From 3dae348e729e690a589f0f78718733480b6ed730 Mon Sep 17 00:00:00 2001 From: Damiano Clementel Date: Mon, 3 Jun 2024 14:11:28 +0100 Subject: [PATCH] Updated DEMO application --- docs/3rdpartylicenses.txt | 867 +++++++++++++++++++++++++++++++ docs/404.html | 2 +- docs/index.html | 2 +- docs/main.01eb911639777ecf.js | 1 - docs/main.499b822249ee9dca.js | 1 + docs/runtime.9c29158757c399f8.js | 1 - docs/runtime.f4e8f20fcf72ae4a.js | 1 + 7 files changed, 871 insertions(+), 4 deletions(-) delete mode 100644 docs/main.01eb911639777ecf.js create mode 100644 docs/main.499b822249ee9dca.js delete mode 100644 docs/runtime.9c29158757c399f8.js create mode 100644 docs/runtime.f4e8f20fcf72ae4a.js diff --git a/docs/3rdpartylicenses.txt b/docs/3rdpartylicenses.txt index 53dc6fd..b77897f 100644 --- a/docs/3rdpartylicenses.txt +++ b/docs/3rdpartylicenses.txt @@ -10,6 +10,77 @@ MIT @angular/router MIT +@ungap/structured-clone +ISC +ISC License + +Copyright (c) 2021, Andrea Giammarchi, @WebReflection + +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. + + +bail +MIT +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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. + + +comma-separated-tokens +MIT +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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. + + d3 ISC Copyright 2010-2023 Mike Bostock @@ -314,6 +385,166 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +decode-named-character-reference +MIT +(The MIT License) + +Copyright (c) 2021 Titus Wormer + +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. + + +devlop +MIT +(The MIT License) + +Copyright (c) 2023 Titus Wormer + +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. + + +estree-util-is-identifier-name +MIT +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +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. + + +extend +MIT +The MIT License (MIT) + +Copyright (c) 2014 Stefan Thomas + +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. + + + +hast-util-to-jsx-runtime +MIT +(The MIT License) + +Copyright (c) 2023 Titus Wormer + +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. + + +hast-util-whitespace +MIT +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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. + + +html-url-attributes +MIT + immer MIT MIT License @@ -364,6 +595,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +inline-style-parser +MIT + internmap ISC Copyright 2021 Mike Bostock @@ -381,6 +615,151 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +is-plain-obj +MIT +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.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. + + +mdast-util-from-markdown +MIT +(The MIT License) + +Copyright (c) 2020 Titus Wormer + +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. + + +mdast-util-to-hast +MIT +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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. + + +mdast-util-to-string +MIT +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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. + + +micromark +MIT + +micromark-core-commonmark +MIT + +micromark-factory-destination +MIT + +micromark-factory-label +MIT + +micromark-factory-space +MIT + +micromark-factory-title +MIT + +micromark-factory-whitespace +MIT + +micromark-util-character +MIT + +micromark-util-chunked +MIT + +micromark-util-classify-character +MIT + +micromark-util-combine-extensions +MIT + +micromark-util-decode-numeric-character-reference +MIT + +micromark-util-decode-string +MIT + +micromark-util-html-tag-name +MIT + +micromark-util-normalize-identifier +MIT + +micromark-util-resolve-all +MIT + +micromark-util-sanitize-uri +MIT + +micromark-util-subtokenize +MIT + molstar MIT The MIT License @@ -430,6 +809,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +ngx-sequence-viewer + ngx-structure-viewer MIT MIT License @@ -455,6 +836,158 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +property-information +MIT +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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. + + +react +MIT +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +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. + + +react-dom +MIT +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +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. + + +react-markdown +MIT +The MIT License (MIT) + +Copyright (c) 2015 Espen Hovlandsdal + +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. + + +remark-parse +MIT +(The MIT License) + +Copyright (c) 2014 Titus Wormer + +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. + + +remark-rehype +MIT +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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. + + rxjs Apache-2.0 Apache License @@ -661,6 +1194,340 @@ Apache-2.0 +scheduler +MIT +MIT License + +Copyright (c) Facebook, Inc. and its affiliates. + +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. + + +space-separated-tokens +MIT +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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. + + +style-to-object +MIT +The MIT License (MIT) + +Copyright (c) 2017 Menglin "Mark" Xu + +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. + + +trim-lines +MIT +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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. + + +trough +MIT +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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. + + +unified +MIT +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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. + + +unist-util-is +MIT +(The MIT license) + +Copyright (c) 2015 Titus Wormer + +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. + + +unist-util-position +MIT +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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. + + +unist-util-stringify-position +MIT +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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. + + +unist-util-visit +MIT +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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. + + +unist-util-visit-parents +MIT +(The MIT License) + +Copyright (c) 2016 Titus Wormer + +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. + + +vfile +MIT +(The MIT License) + +Copyright (c) 2015 Titus Wormer + +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. + + +vfile-message +MIT +(The MIT License) + +Copyright (c) 2017 Titus Wormer + +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. + + xhr2 MIT Copyright (c) 2013 Victor Costan diff --git a/docs/404.html b/docs/404.html index 7546f0a..2f78fb6 100644 --- a/docs/404.html +++ b/docs/404.html @@ -16,5 +16,5 @@ - + diff --git a/docs/index.html b/docs/index.html index 7546f0a..2f78fb6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -16,5 +16,5 @@ - + diff --git a/docs/main.01eb911639777ecf.js b/docs/main.01eb911639777ecf.js deleted file mode 100644 index c7820f8..0000000 --- a/docs/main.01eb911639777ecf.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunkdemo_showcase=self.webpackChunkdemo_showcase||[]).push([[792],{540:(r_,nG,Fn)=>{"use strict";var i_={};Fn.r(i_),Fn.d(i_,{atomicHet:()=>SOe,atomicSequence:()=>_Oe,bundleElementImpl:()=>FJ,bundleGenerator:()=>BJ,defaultBondTest:()=>XB,spheres:()=>COe,water:()=>xOe});var OP={};Fn.r(OP),Fn.d(OP,{all:()=>UJ,atoms:()=>QB,bondedAtomicPairs:()=>kOe,chains:()=>IOe,none:()=>ZB,querySelection:()=>ROe,residues:()=>AOe,rings:()=>MOe});var LP={};Fn.r(LP),Fn.d(LP,{exceptBy:()=>m5e,expandProperty:()=>y5e,includeConnected:()=>b5e,includeSurroundings:()=>f5e,intersectBy:()=>h5e,querySelection:()=>p5e,surroundingLigands:()=>_5e,union:()=>g5e,wholeResidues:()=>u5e});var UP={};Fn.r(UP),Fn.d(UP,{areIntersectedBy:()=>R5e,first:()=>E5e,getCurrentStructureProperties:()=>DT,isConnectedTo:()=>L5e,pick:()=>D5e,withSameAtomProperties:()=>M5e,within:()=>k5e});var VP={};Fn.r(VP),Fn.d(VP,{intersect:()=>V5e,merge:()=>U5e});var zP={};Fn.r(zP),Fn.d(zP,{atomCount:()=>z5e,countQuery:()=>G5e,propertySet:()=>j5e});var GP={};Fn.r(GP),Fn.d(GP,{Download:()=>sre,DownloadBlob:()=>are,ImportJson:()=>Fze,ImportString:()=>Nze,LazyVolume:()=>Oze,ParseBlob:()=>wze,ParseCcp4:()=>Mze,ParseCif:()=>Aze,ParseCube:()=>Ize,ParseDsn6:()=>Rze,ParseDx:()=>kze,ParseJson:()=>Bze,ParsePly:()=>Pze,ParsePrmtop:()=>Dze,ParsePsf:()=>Tze,ParseTop:()=>Eze,RawData:()=>cre,ReadFile:()=>ure});var jP={};Fn.r(jP),Fn.d(jP,{CreateGroup:()=>Lze});var HP={};Fn.r(HP),Fn.d(HP,{CoordinatesFromDcd:()=>vXe,CoordinatesFromNctraj:()=>SXe,CoordinatesFromTrr:()=>xXe,CoordinatesFromXtc:()=>_Xe,CustomModelProperties:()=>Koe,CustomStructureProperties:()=>Qoe,ModelFromTrajectory:()=>qoe,MultiStructureSelectionFromExpression:()=>jXe,ShapeFromPly:()=>XXe,StructureComplexElement:()=>$Xe,StructureComplexElementTypes:()=>Xoe,StructureComponent:()=>YXe,StructureFromModel:()=>VXe,StructureFromTrajectory:()=>UXe,StructureSelectionFromBundle:()=>qXe,StructureSelectionFromExpression:()=>GXe,StructureSelectionFromScript:()=>HXe,TopologyFromPrmtop:()=>wXe,TopologyFromPsf:()=>CXe,TopologyFromTop:()=>AXe,TrajectoryFromBlob:()=>TXe,TrajectoryFromCifCore:()=>BXe,TrajectoryFromCube:()=>FXe,TrajectoryFromGRO:()=>PXe,TrajectoryFromMOL:()=>RXe,TrajectoryFromMOL2:()=>NXe,TrajectoryFromMmCif:()=>DXe,TrajectoryFromModelAndCoordinates:()=>A6,TrajectoryFromPDB:()=>EXe,TrajectoryFromSDF:()=>kXe,TrajectoryFromXYZ:()=>MXe,TransformStructureConformation:()=>zXe});var qP={};Fn.r(qP),Fn.d(qP,{AssignColorVolume:()=>cKe,VolumeFromCcp4:()=>nKe,VolumeFromCube:()=>iKe,VolumeFromDensityServerCif:()=>sKe,VolumeFromDsn6:()=>rKe,VolumeFromDx:()=>oKe,VolumeFromSegmentationCif:()=>aKe});var WP={};Fn.r(WP),Fn.d(WP,{BoxShape3D:()=>Fet,getBoxMesh:()=>m8});var $P={};Fn.r($P),Fn.d($P,{ClippingStructureRepresentation3DFromBundle:()=>Jet,ClippingStructureRepresentation3DFromScript:()=>Qet,ExplodeStructureRepresentation3D:()=>Het,ModelUnitcell3D:()=>rtt,OverpaintStructureRepresentation3DFromBundle:()=>$et,OverpaintStructureRepresentation3DFromScript:()=>Wet,ShapeRepresentation3D:()=>ntt,SpinStructureRepresentation3D:()=>qet,StructureBoundingBox3D:()=>itt,StructureRepresentation3D:()=>yE,StructureSelectionsAngle3D:()=>stt,StructureSelectionsDihedral3D:()=>att,StructureSelectionsDistance3D:()=>ott,StructureSelectionsLabel3D:()=>ctt,StructureSelectionsOrientation3D:()=>utt,StructureSelectionsPlane3D:()=>ltt,SubstanceStructureRepresentation3DFromBundle:()=>Zet,SubstanceStructureRepresentation3DFromScript:()=>Ket,ThemeStrengthRepresentation3D:()=>ett,TransparencyStructureRepresentation3DFromBundle:()=>Xet,TransparencyStructureRepresentation3DFromScript:()=>Yet,UnwindStructureAssemblyRepresentation3D:()=>jet,VolumeRepresentation3D:()=>ttt,VolumeRepresentation3DHelpers:()=>Af});var YP={};Fn.r(YP),Fn.d(YP,{ApplyAction:()=>Vce,ClearHighlights:()=>qce,Highlight:()=>Hce,RemoveObject:()=>zce,SetCurrentObject:()=>Lce,Snapshots:()=>Wce,SyncBehaviors:()=>Oce,ToggleExpanded:()=>Gce,ToggleVisibility:()=>jce,Update:()=>Uce,registerDefault:()=>Ttt,setSubtreeVisibility:()=>Wv});var XP={};Fn.r(XP),Fn.d(XP,{SyncRepresentationToCanvas:()=>$ce,SyncStructureRepresentation3DState:()=>Yce,UpdateRepresentationVisibility:()=>Xce,registerDefault:()=>Ett});var KP={};Fn.r(KP),Fn.d(KP,{Focus:()=>Qce,OrientAxes:()=>Jce,Reset:()=>Kce,ResetAxes:()=>eue,SetSnapshot:()=>Zce,registerDefault:()=>Ptt});var ZP={};Fn.r(ZP),Fn.d(ZP,{Canvas3DSetSettings:()=>Zue,registerDefault:()=>Nit});var QP={};Fn.r(QP),Fn.d(QP,{DefaultFocusLociBindings:()=>Jue,DefaultLociLabelProvider:()=>Vit,DefaultSelectLociBindings:()=>Que,FocusLoci:()=>Git,HighlightLoci:()=>Oit,SelectLoci:()=>Uit});var JP={};Fn.r(JP),Fn.d(JP,{CameraAxisHelper:()=>qit,CameraControls:()=>$it,DefaultClickResetCameraOnEmpty:()=>q8,DefaultClickResetCameraOnEmptySelectMode:()=>W8,DefaultFocusLociBindings:()=>ele,FocusLoci:()=>Hit});var eM={};Fn.r(eM),Fn.d(eM,{AccessibleSurfaceArea:()=>rot,BestDatabaseSequenceMapping:()=>gct,CrossLinkRestraint:()=>Rct,Interactions:()=>dct,SecondaryStructure:()=>fct,StructureInfo:()=>Yit,ValenceModel:()=>pct});var tM={};Fn.r(tM),Fn.d(tM,{AddTrajectory:()=>gut,DownloadStructure:()=>uut,EnableModelCustomProps:()=>hut,EnableStructureCustomProps:()=>mut,LoadTrajectory:()=>yut,PdbDownloadProvider:()=>Dde,UpdateTrajectory:()=>put});var nM={};Fn.r(nM),Fn.d(nM,{AssignColorVolume:()=>Ede,DownloadDensity:()=>but});var rM={};function rG(e,t,n,r,i,o,s){try{var a=e[o](s),c=a.value}catch(u){return void n(u)}a.done?t(c):Promise.resolve(c).then(r,i)}function ie(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(c){rG(o,r,i,s,a,"next",c)}function a(c){rG(o,r,i,s,a,"throw",c)}s(void 0)})}}Fn.r(rM),Fn.d(rM,{DownloadFile:()=>vut,OpenFiles:()=>Pde});let xs=null,KC=1;const tg=Symbol("SIGNAL");function sr(e){const t=xs;return xs=e,t}function iG(e){if((!s_(e)||e.dirty)&&(e.dirty||e.lastCleanEpoch!==KC)){if(!e.producerMustRecompute(e)&&!oM(e))return e.dirty=!1,void(e.lastCleanEpoch=KC);e.producerRecomputeValue(e),e.dirty=!1,e.lastCleanEpoch=KC}}function oM(e){gy(e);for(let t=0;t0}function gy(e){e.producerNode??=[],e.producerIndexOfThis??=[],e.producerLastReadVersion??=[]}let pG=null;function Wi(e){return"function"==typeof e}function aM(e){const n=e(r=>{Error.call(r),r.stack=(new Error).stack});return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}const cM=aM(e=>function(n){e(this),this.message=n?`${n.length} errors occurred during unsubscription:\n${n.map((r,i)=>`${i+1}) ${r.toString()}`).join("\n ")}`:"",this.name="UnsubscriptionError",this.errors=n});function QC(e,t){if(e){const n=e.indexOf(t);0<=n&&e.splice(n,1)}}class Fa{constructor(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let t;if(!this.closed){this.closed=!0;const{_parentage:n}=this;if(n)if(this._parentage=null,Array.isArray(n))for(const o of n)o.remove(this);else n.remove(this);const{initialTeardown:r}=this;if(Wi(r))try{r()}catch(o){t=o instanceof cM?o.errors:[o]}const{_finalizers:i}=this;if(i){this._finalizers=null;for(const o of i)try{bG(o)}catch(s){t=t??[],s instanceof cM?t=[...t,...s.errors]:t.push(s)}}if(t)throw new cM(t)}}add(t){var n;if(t&&t!==this)if(this.closed)bG(t);else{if(t instanceof Fa){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}}_hasParent(t){const{_parentage:n}=this;return n===t||Array.isArray(n)&&n.includes(t)}_addParent(t){const{_parentage:n}=this;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t}_removeParent(t){const{_parentage:n}=this;n===t?this._parentage=null:Array.isArray(n)&&QC(n,t)}remove(t){const{_finalizers:n}=this;n&&QC(n,t),t instanceof Fa&&t._removeParent(this)}}Fa.EMPTY=(()=>{const e=new Fa;return e.closed=!0,e})();const gG=Fa.EMPTY;function yG(e){return e instanceof Fa||e&&"closed"in e&&Wi(e.remove)&&Wi(e.add)&&Wi(e.unsubscribe)}function bG(e){Wi(e)?e():e.unsubscribe()}const ng={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},JC={setTimeout(e,t,...n){const{delegate:r}=JC;return r?.setTimeout?r.setTimeout(e,t,...n):setTimeout(e,t,...n)},clearTimeout(e){const{delegate:t}=JC;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function vG(e){JC.setTimeout(()=>{const{onUnhandledError:t}=ng;if(!t)throw e;t(e)})}function uM(){}const y0e=lM("C",void 0,void 0);function lM(e,t,n){return{kind:e,value:t,error:n}}let rg=null;function ew(e){if(ng.useDeprecatedSynchronousErrorHandling){const t=!rg;if(t&&(rg={errorThrown:!1,error:null}),e(),t){const{errorThrown:n,error:r}=rg;if(rg=null,n)throw r}}else e()}class dM extends Fa{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,yG(t)&&t.add(this)):this.destination=w0e}static create(t,n,r){return new a_(t,n,r)}next(t){this.isStopped?pM(function v0e(e){return lM("N",e,void 0)}(t),this):this._next(t)}error(t){this.isStopped?pM(function b0e(e){return lM("E",void 0,e)}(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?pM(y0e,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}}const x0e=Function.prototype.bind;function fM(e,t){return x0e.call(e,t)}class S0e{constructor(t){this.partialObserver=t}next(t){const{partialObserver:n}=this;if(n.next)try{n.next(t)}catch(r){tw(r)}}error(t){const{partialObserver:n}=this;if(n.error)try{n.error(t)}catch(r){tw(r)}else tw(t)}complete(){const{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(n){tw(n)}}}class a_ extends dM{constructor(t,n,r){let i;if(super(),Wi(t)||!t)i={next:t??void 0,error:n??void 0,complete:r??void 0};else{let o;this&&ng.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=()=>this.unsubscribe(),i={next:t.next&&fM(t.next,o),error:t.error&&fM(t.error,o),complete:t.complete&&fM(t.complete,o)}):i=t}this.destination=new S0e(i)}}function tw(e){ng.useDeprecatedSynchronousErrorHandling?function _0e(e){ng.useDeprecatedSynchronousErrorHandling&&rg&&(rg.errorThrown=!0,rg.error=e)}(e):vG(e)}function pM(e,t){const{onStoppedNotification:n}=ng;n&&JC.setTimeout(()=>n(e,t))}const w0e={closed:!0,next:uM,error:function C0e(e){throw e},complete:uM},hM="function"==typeof Symbol&&Symbol.observable||"@@observable";function vh(e){return e}function _G(...e){return xG(e)}function xG(e){return 0===e.length?vh:1===e.length?e[0]:function(n){return e.reduce((r,i)=>i(r),n)}}let ns=(()=>{class e{constructor(n){n&&(this._subscribe=n)}lift(n){const r=new e;return r.source=this,r.operator=n,r}subscribe(n,r,i){const o=function I0e(e){return e&&e instanceof dM||function A0e(e){return e&&Wi(e.next)&&Wi(e.error)&&Wi(e.complete)}(e)&&yG(e)}(n)?n:new a_(n,r,i);return ew(()=>{const{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(n){try{return this._subscribe(n)}catch(r){n.error(r)}}forEach(n,r){return new(r=SG(r))((i,o)=>{const s=new a_({next:a=>{try{n(a)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(n){var r;return null===(r=this.source)||void 0===r?void 0:r.subscribe(n)}[hM](){return this}pipe(...n){return xG(n)(this)}toPromise(n){return new(n=SG(n))((r,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>r(o))})}}return e.create=t=>new e(t),e})();function SG(e){var t;return null!==(t=e??ng.Promise)&&void 0!==t?t:Promise}const T0e=aM(e=>function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});let mr=(()=>{class e extends ns{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(n){const r=new CG(this,this);return r.operator=n,r}_throwIfClosed(){if(this.closed)throw new T0e}next(n){ew(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(const r of this.currentObservers)r.next(n)}})}error(n){ew(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=n;const{observers:r}=this;for(;r.length;)r.shift().error(n)}})}complete(){ew(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;const{observers:n}=this;for(;n.length;)n.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var n;return(null===(n=this.observers)||void 0===n?void 0:n.length)>0}_trySubscribe(n){return this._throwIfClosed(),super._trySubscribe(n)}_subscribe(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)}_innerSubscribe(n){const{hasError:r,isStopped:i,observers:o}=this;return r||i?gG:(this.currentObservers=null,o.push(n),new Fa(()=>{this.currentObservers=null,QC(o,n)}))}_checkFinalizedStatuses(n){const{hasError:r,thrownError:i,isStopped:o}=this;r?n.error(i):o&&n.complete()}asObservable(){const n=new ns;return n.source=this,n}}return e.create=(t,n)=>new CG(t,n),e})();class CG extends mr{constructor(t,n){super(),this.destination=t,this.source=n}next(t){var n,r;null===(r=null===(n=this.destination)||void 0===n?void 0:n.next)||void 0===r||r.call(n,t)}error(t){var n,r;null===(r=null===(n=this.destination)||void 0===n?void 0:n.error)||void 0===r||r.call(n,t)}complete(){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===n||n.call(t)}_subscribe(t){var n,r;return null!==(r=null===(n=this.source)||void 0===n?void 0:n.subscribe(t))&&void 0!==r?r:gG}}class Ao extends mr{constructor(t){super(),this._value=t}get value(){return this.getValue()}_subscribe(t){const n=super._subscribe(t);return!n.closed&&t.next(this._value),n}getValue(){const{hasError:t,thrownError:n,_value:r}=this;if(t)throw n;return this._throwIfClosed(),r}next(t){super.next(this._value=t)}}function wG(e){return Wi(e?.lift)}function mo(e){return t=>{if(wG(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function Io(e,t,n,r,i){return new D0e(e,t,n,r,i)}class D0e extends dM{constructor(t,n,r,i,o,s){super(t),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=n?function(a){try{n(a)}catch(c){t.error(c)}}:super._next,this._error=i?function(a){try{i(a)}catch(c){t.error(c)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(a){t.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){const{closed:n}=this;super.unsubscribe(),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}}}function qt(e,t){return mo((n,r)=>{let i=0;n.subscribe(Io(r,o=>{r.next(e.call(t,o,i++))}))})}const AG="https://g.co/ng/security#xss";class It extends Error{constructor(t,n){super(function yy(e,t){return`NG0${Math.abs(e)}${t?": "+t:""}`}(t,n)),this.code=t}}function jf(e){return{toString:e}.toString()}const vy="__parameters__";function xy(e,t,n){return jf(()=>{const r=function mM(e){return function(...n){if(e){const r=e(...n);for(const i in r)this[i]=r[i]}}}(t);function i(...o){if(this instanceof i)return r.apply(this,o),this;const s=new i(...o);return a.annotation=s,a;function a(c,u,l){const d=c.hasOwnProperty(vy)?c[vy]:Object.defineProperty(c,vy,{value:[]})[vy];for(;d.length<=l;)d.push(null);return(d[l]=d[l]||[]).push(s),c}}return n&&(i.prototype=Object.create(n.prototype)),i.prototype.ngMetadataName=e,i.annotationCls=i,i})}const si=globalThis;function pi(e){for(let t in e)if(e[t]===pi)return t;throw Error("Could not find renamed property on target object.")}function Ss(e){if("string"==typeof e)return e;if(Array.isArray(e))return"["+e.map(Ss).join(", ")+"]";if(null==e)return""+e;if(e.overriddenName)return`${e.overriddenName}`;if(e.name)return`${e.name}`;const t=e.toString();if(null==t)return""+t;const n=t.indexOf("\n");return-1===n?t:t.substring(0,n)}function gM(e,t){return null==e||""===e?null===t?"":t:null==t||""===t?e:e+" "+t}const P0e=pi({__forward_ref__:pi});function yM(e){return e.__forward_ref__=yM,e.toString=function(){return Ss(this())},e}function En(e){return rw(e)?e():e}function rw(e){return"function"==typeof e&&e.hasOwnProperty(P0e)&&e.__forward_ref__===yM}function Gt(e){return{token:e.token,providedIn:e.providedIn||null,factory:e.factory,value:void 0}}function Sy(e){return{providers:e.providers||[],imports:e.imports||[]}}function iw(e){return EG(e,sw)||EG(e,PG)}function EG(e,t){return e.hasOwnProperty(t)?e[t]:null}function ow(e){return e&&(e.hasOwnProperty(bM)||e.hasOwnProperty(B0e))?e[bM]:null}const sw=pi({\u0275prov:pi}),bM=pi({\u0275inj:pi}),PG=pi({ngInjectableDef:pi}),B0e=pi({ngInjectorDef:pi});class Yt{constructor(t,n){this._desc=t,this.ngMetadataName="InjectionToken",this.\u0275prov=void 0,"number"==typeof n?this.__NG_ELEMENT_ID__=n:void 0!==n&&(this.\u0275prov=Gt({token:this,providedIn:n.providedIn||"root",factory:n.factory}))}get multi(){return this}toString(){return`InjectionToken ${this._desc}`}}function CM(e){return e&&!!e.\u0275providers}const c_=pi({\u0275cmp:pi}),wM=pi({\u0275dir:pi}),AM=pi({\u0275pipe:pi}),RG=pi({\u0275mod:pi}),Hf=pi({\u0275fac:pi}),u_=pi({__NG_ELEMENT_ID__:pi}),kG=pi({__NG_ENV_ID__:pi});function Un(e){return"string"==typeof e?e:null==e?"":String(e)}function IM(e,t){throw new It(-201,!1)}var yr=function(e){return e[e.Default=0]="Default",e[e.Host=1]="Host",e[e.Self=2]="Self",e[e.SkipSelf=4]="SkipSelf",e[e.Optional=8]="Optional",e}(yr||{});let TM;function NG(){return TM}function bc(e){const t=TM;return TM=e,t}function FG(e,t,n){const r=iw(e);return r&&"root"==r.providedIn?void 0===r.value?r.value=r.factory():r.value:n&yr.Optional?null:void 0!==t?t:void IM()}const l_={},DM="__NG_DI_FLAG__",aw="ngTempTokenPath",G0e=/\n/gm,BG="__source";let Cy;function xh(e){const t=Cy;return Cy=e,t}function q0e(e,t=yr.Default){if(void 0===Cy)throw new It(-203,!1);return null===Cy?FG(e,void 0,t):Cy.get(e,t&yr.Optional?null:void 0,t)}function Zt(e,t=yr.Default){return(NG()||q0e)(En(e),t)}function bt(e,t=yr.Default){return Zt(e,cw(t))}function cw(e){return typeof e>"u"||"number"==typeof e?e:(e.optional&&8)|(e.host&&1)|(e.self&&2)|(e.skipSelf&&4)}function EM(e){const t=[];for(let n=0;nArray.isArray(n)?wy(n,t):t(n))}function LG(e,t,n){t>=e.length?e.push(n):e.splice(t,0,n)}function dw(e,t){return t>=e.length-1?e.pop():e.splice(t,1)[0]}function Xc(e,t,n){let r=Ay(e,t);return r>=0?e[1|r]=n:(r=~r,function UG(e,t,n,r){let i=e.length;if(i==t)e.push(n,r);else if(1===i)e.push(r,e[0]),e[0]=n;else{for(i--,e.push(e[i-1],e[i]);i>t;)e[i]=e[i-2],i--;e[t]=n,e[t+1]=r}}(e,r,t,n)),r}function MM(e,t){const n=Ay(e,t);if(n>=0)return e[1|n]}function Ay(e,t){return function VG(e,t,n){let r=0,i=e.length>>n;for(;i!==r;){const o=r+(i-r>>1),s=e[o<t?i=o:r=o+1}return~(i<t){s=o-1;break}}}for(;o-1){let o;for(;++io?"":i[l+1].toLowerCase(),2&r&&u!==d){if(Ol(r))return!1;s=!0}}}}else{if(!s&&!Ol(r)&&!Ol(c))return!1;if(s&&Ol(c))continue;s=!1,r=c|1&r}}return Ol(r)||s}function Ol(e){return!(1&e)}function rye(e,t,n,r){if(null===t)return-1;let i=0;if(r||!n){let o=!1;for(;i-1)for(n++;n0?'="'+a+'"':"")+"]"}else 8&r?i+="."+s:4&r&&(i+=" "+s);else""!==i&&!Ol(s)&&(t+=$G(o,i),i=""),r=s,o=o||!Ol(r);n++}return""!==i&&(t+=$G(o,i)),t}function Mu(e){return jf(()=>{const t=XG(e),n={...t,decls:e.decls,vars:e.vars,template:e.template,consts:e.consts||null,ngContentSelectors:e.ngContentSelectors,onPush:e.changeDetection===hw.OnPush,directiveDefs:null,pipeDefs:null,dependencies:t.standalone&&e.dependencies||null,getStandaloneInjector:null,signals:e.signals??!1,data:e.data||{},encapsulation:e.encapsulation||Fl.Emulated,styles:e.styles||Vr,_:null,schemas:e.schemas||null,tView:null,id:""};KG(n);const r=e.dependencies;return n.directiveDefs=mw(r,!1),n.pipeDefs=mw(r,!0),n.id=function hye(e){let t=0;const n=[e.selectors,e.ngContentSelectors,e.hostVars,e.hostAttrs,e.consts,e.vars,e.decls,e.encapsulation,e.standalone,e.signals,e.exportAs,JSON.stringify(e.inputs),JSON.stringify(e.outputs),Object.getOwnPropertyNames(e.type.prototype),!!e.contentQueries,!!e.viewQuery].join("|");for(const i of n)t=Math.imul(31,t)+i.charCodeAt(0)|0;return t+=2147483648,"c"+t}(n),n})}function dye(e){return dr(e)||Cs(e)}function fye(e){return null!==e}function p_(e){return jf(()=>({type:e.type,bootstrap:e.bootstrap||Vr,declarations:e.declarations||Vr,imports:e.imports||Vr,exports:e.exports||Vr,transitiveCompileScopes:null,schemas:e.schemas||null,id:e.id||null}))}function YG(e,t){if(null==e)return Pd;const n={};for(const r in e)if(e.hasOwnProperty(r)){const i=e[r];let o,s,a=Bl.None;Array.isArray(i)?(a=i[0],o=i[1],s=i[2]??o):(o=i,s=i),t?(n[o]=a!==Bl.None?[r,a]:r,t[o]=s):n[o]=r}return n}function Ba(e){return jf(()=>{const t=XG(e);return KG(t),t})}function _c(e){return{type:e.type,name:e.name,factory:null,pure:!1!==e.pure,standalone:!0===e.standalone,onDestroy:e.type.prototype.ngOnDestroy||null}}function dr(e){return e[c_]||null}function Cs(e){return e[wM]||null}function Qs(e){return e[AM]||null}function sa(e,t){const n=e[RG]||null;if(!n&&!0===t)throw new Error(`Type ${Ss(e)} does not have '\u0275mod' property.`);return n}function XG(e){const t={};return{type:e.type,providersResolver:null,factory:null,hostBindings:e.hostBindings||null,hostVars:e.hostVars||0,hostAttrs:e.hostAttrs||null,contentQueries:e.contentQueries||null,declaredInputs:t,inputTransforms:null,inputConfig:e.inputs||Pd,exportAs:e.exportAs||null,standalone:!0===e.standalone,signals:!0===e.signals,selectors:e.selectors||Vr,viewQuery:e.viewQuery||null,features:e.features||null,setInput:null,findHostDirectiveDefs:null,hostDirectives:null,inputs:YG(e.inputs,t),outputs:YG(e.outputs),debugInfo:null}}function KG(e){e.features?.forEach(t=>t(e))}function mw(e,t){if(!e)return null;const n=t?Qs:dye;return()=>("function"==typeof e?e():e).map(r=>n(r)).filter(fye)}function Iy(e){return{\u0275providers:e}}function mye(...e){return{\u0275providers:FM(0,e),\u0275fromNgModule:!0}}function FM(e,...t){const n=[],r=new Set;let i;const o=s=>{n.push(s)};return wy(t,s=>{const a=s;gw(a,o,[],r)&&(i||=[],i.push(a))}),void 0!==i&&ZG(i,o),n}function ZG(e,t){for(let n=0;n{t(o,r)})}}function gw(e,t,n,r){if(!(e=En(e)))return!1;let i=null,o=ow(e);const s=!o&&dr(e);if(o||s){if(s&&!s.standalone)return!1;i=e}else{const c=e.ngModule;if(o=ow(c),!o)return!1;i=c}const a=r.has(i);if(s){if(a)return!1;if(r.add(i),s.dependencies){const c="function"==typeof s.dependencies?s.dependencies():s.dependencies;for(const u of c)gw(u,t,n,r)}}else{if(!o)return!1;{if(null!=o.imports&&!a){let u;r.add(i);try{wy(o.imports,l=>{gw(l,t,n,r)&&(u||=[],u.push(l))})}finally{}void 0!==u&&ZG(u,t)}if(!a){const u=ig(i)||(()=>new i);t({provide:i,useFactory:u,deps:Vr},i),t({provide:RM,useValue:i,multi:!0},i),t({provide:og,useValue:()=>Zt(i),multi:!0},i)}const c=o.providers;if(null!=c&&!a){const u=e;BM(c,l=>{t(l,u)})}}}return i!==e&&void 0!==e.providers}function BM(e,t){for(let n of e)CM(n)&&(n=n.\u0275providers),Array.isArray(n)?BM(n,t):t(n)}const gye=pi({provide:String,useValue:pi});function OM(e){return null!==e&&"object"==typeof e&&gye in e}function sg(e){return"function"==typeof e}const LM=new Yt(""),yw={},bye={};let UM;function bw(){return void 0===UM&&(UM=new pw),UM}class xc{}class Ty extends xc{get destroyed(){return this._destroyed}constructor(t,n,r,i){super(),this.parent=n,this.source=r,this.scopes=i,this.records=new Map,this._ngOnDestroyHooks=new Set,this._onDestroyHooks=[],this._destroyed=!1,zM(t,s=>this.processProvider(s)),this.records.set(zG,Dy(void 0,this)),i.has("environment")&&this.records.set(xc,Dy(void 0,this));const o=this.records.get(LM);null!=o&&"string"==typeof o.value&&this.scopes.add(o.value),this.injectorDefTypes=new Set(this.get(RM,Vr,yr.Self))}destroy(){this.assertNotDestroyed(),this._destroyed=!0;const t=sr(null);try{for(const r of this._ngOnDestroyHooks)r.ngOnDestroy();const n=this._onDestroyHooks;this._onDestroyHooks=[];for(const r of n)r()}finally{this.records.clear(),this._ngOnDestroyHooks.clear(),this.injectorDefTypes.clear(),sr(t)}}onDestroy(t){return this.assertNotDestroyed(),this._onDestroyHooks.push(t),()=>this.removeOnDestroy(t)}runInContext(t){this.assertNotDestroyed();const n=xh(this),r=bc(void 0);try{return t()}finally{xh(n),bc(r)}}get(t,n=l_,r=yr.Default){if(this.assertNotDestroyed(),t.hasOwnProperty(kG))return t[kG](this);r=cw(r);const o=xh(this),s=bc(void 0);try{if(!(r&yr.SkipSelf)){let c=this.records.get(t);if(void 0===c){const u=function Cye(e){return"function"==typeof e||"object"==typeof e&&e instanceof Yt}(t)&&iw(t);c=u&&this.injectableDefInScope(u)?Dy(VM(t),yw):null,this.records.set(t,c)}if(null!=c)return this.hydrate(t,c)}return(r&yr.Self?bw():this.parent).get(t,n=r&yr.Optional&&n===l_?null:n)}catch(a){if("NullInjectorError"===a.name){if((a[aw]=a[aw]||[]).unshift(Ss(t)),o)throw a;return function $0e(e,t,n,r){const i=e[aw];throw t[BG]&&i.unshift(t[BG]),e.message=function Y0e(e,t,n,r=null){e=e&&"\n"===e.charAt(0)&&"\u0275"==e.charAt(1)?e.slice(2):e;let i=Ss(t);if(Array.isArray(t))i=t.map(Ss).join(" -> ");else if("object"==typeof t){let o=[];for(let s in t)if(t.hasOwnProperty(s)){let a=t[s];o.push(s+":"+("string"==typeof a?JSON.stringify(a):Ss(a)))}i=`{${o.join(", ")}}`}return`${n}${r?"("+r+")":""}[${i}]: ${e.replace(G0e,"\n ")}`}("\n"+e.message,i,n,r),e.ngTokenPath=i,e[aw]=null,e}(a,t,"R3InjectorError",this.source)}throw a}finally{bc(s),xh(o)}}resolveInjectorInitializers(){const t=sr(null),n=xh(this),r=bc(void 0);try{const o=this.get(og,Vr,yr.Self);for(const s of o)s()}finally{xh(n),bc(r),sr(t)}}toString(){const t=[],n=this.records;for(const r of n.keys())t.push(Ss(r));return`R3Injector[${t.join(", ")}]`}assertNotDestroyed(){if(this._destroyed)throw new It(205,!1)}processProvider(t){let n=sg(t=En(t))?t:En(t&&t.provide);const r=function _ye(e){return OM(e)?Dy(void 0,e.useValue):Dy(e9(e),yw)}(t);if(!sg(t)&&!0===t.multi){let i=this.records.get(n);i||(i=Dy(void 0,yw,!0),i.factory=()=>EM(i.multi),this.records.set(n,i)),n=t,i.multi.push(t)}this.records.set(n,r)}hydrate(t,n){const r=sr(null);try{return n.value===yw&&(n.value=bye,n.value=n.factory()),"object"==typeof n.value&&n.value&&function Sye(e){return null!==e&&"object"==typeof e&&"function"==typeof e.ngOnDestroy}(n.value)&&this._ngOnDestroyHooks.add(n.value),n.value}finally{sr(r)}}injectableDefInScope(t){if(!t.providedIn)return!1;const n=En(t.providedIn);return"string"==typeof n?"any"===n||this.scopes.has(n):this.injectorDefTypes.has(n)}removeOnDestroy(t){const n=this._onDestroyHooks.indexOf(t);-1!==n&&this._onDestroyHooks.splice(n,1)}}function VM(e){const t=iw(e),n=null!==t?t.factory:ig(e);if(null!==n)return n;if(e instanceof Yt)throw new It(204,!1);if(e instanceof Function)return function vye(e){if(e.length>0)throw new It(204,!1);const n=function F0e(e){return e&&(e[sw]||e[PG])||null}(e);return null!==n?()=>n.factory(e):()=>new e}(e);throw new It(204,!1)}function e9(e,t,n){let r;if(sg(e)){const i=En(e);return ig(i)||VM(i)}if(OM(e))r=()=>En(e.useValue);else if(function JG(e){return!(!e||!e.useFactory)}(e))r=()=>e.useFactory(...EM(e.deps||[]));else if(function QG(e){return!(!e||!e.useExisting)}(e))r=()=>Zt(En(e.useExisting));else{const i=En(e&&(e.useClass||e.provide));if(!function xye(e){return!!e.deps}(e))return ig(i)||VM(i);r=()=>new i(...EM(e.deps))}return r}function Dy(e,t,n=!1){return{factory:e,value:t,multi:n?[]:void 0}}function zM(e,t){for(const n of e)Array.isArray(n)?zM(n,t):n&&CM(n)?zM(n.\u0275providers,t):t(n)}function Md(e,t){e instanceof Ty&&e.assertNotDestroyed();const r=xh(e),i=bc(void 0);try{return t()}finally{xh(r),bc(i)}}function t9(){return void 0!==NG()||null!=function H0e(){return Cy}()}const Ji=0,Mt=1,bn=2,zo=3,Ll=4,aa=5,Kc=6,Py=7,Mi=8,Js=9,Ul=10,Mn=11,m_=12,r9=13,My=14,go=15,g_=16,Ry=17,qf=18,y_=19,i9=20,Ch=21,xw=22,ag=23,Vn=25,jM=1,Rd=7,ky=9,Go=10;var HM=function(e){return e[e.None=0]="None",e[e.HasTransplantedViews=2]="HasTransplantedViews",e}(HM||{});function ca(e){return Array.isArray(e)&&"object"==typeof e[jM]}function ua(e){return Array.isArray(e)&&!0===e[jM]}function qM(e){return!!(4&e.flags)}function cg(e){return e.componentOffset>-1}function Cw(e){return!(1&~e.flags)}function Vl(e){return!!e.template}function WM(e){return!!(512&e[bn])}class Bye{constructor(t,n,r){this.previousValue=t,this.currentValue=n,this.firstChange=r}isFirstChange(){return this.firstChange}}function c9(e,t,n,r){null!==t?t.applyValueToInputSignal(t,r):e[n]=r}function wh(){return u9}function u9(e){return e.type.prototype.ngOnChanges&&(e.setInput=Lye),Oye}function Oye(){const e=d9(this),t=e?.current;if(t){const n=e.previous;if(n===Pd)e.previous=t;else for(let r in t)n[r]=t[r];e.current=null,this.ngOnChanges(t)}}function Lye(e,t,n,r,i){const o=this.declaredInputs[r],s=d9(e)||function Uye(e,t){return e[l9]=t}(e,{previous:Pd,current:null}),a=s.current||(s.current={}),c=s.previous,u=c[o];a[o]=new Bye(u&&u.currentValue,n,c===Pd),c9(e,t,i,n)}wh.ngInherit=!0;const l9="__ngSimpleChanges__";function d9(e){return e[l9]||null}const kd=function(e,t,n){};let h9=!1;function _i(e){for(;Array.isArray(e);)e=e[Ji];return e}function v_(e,t){return _i(t[e])}function Oa(e,t){return _i(t[e.index])}function __(e,t){return e.data[t]}function Zc(e,t){const n=t[e];return ca(n)?n:n[Ji]}function ZM(e){return!(128&~e[bn])}function Nd(e,t){return null==t?null:e[t]}function m9(e){e[Ry]=0}function qye(e){1024&e[bn]||(e[bn]|=1024,ZM(e)&&x_(e))}function QM(e){return!!(9216&e[bn]||e[ag]?.dirty)}function JM(e){e[Ul].changeDetectionScheduler?.notify(1),QM(e)?x_(e):64&e[bn]&&(function zye(){return h9}()?(e[bn]|=1024,x_(e)):e[Ul].changeDetectionScheduler?.notify())}function x_(e){e[Ul].changeDetectionScheduler?.notify();let t=ug(e);for(;null!==t&&!(8192&t[bn])&&(t[bn]|=8192,ZM(t));)t=ug(t)}function ww(e,t){if(!(256&~e[bn]))throw new It(911,!1);null===e[Ch]&&(e[Ch]=[]),e[Ch].push(t)}function ug(e){const t=e[zo];return ua(t)?t[zo]:t}const Rn={lFrame:A9(null),bindingsEnabled:!0,skipHydrationRootTNode:null};function b9(){return Rn.bindingsEnabled}function it(){return Rn.lFrame.lView}function br(){return Rn.lFrame.tView}function hi(){let e=v9();for(;null!==e&&64===e.type;)e=e.parent;return e}function v9(){return Rn.lFrame.currentTNode}function Fd(e,t){const n=Rn.lFrame;n.currentTNode=e,n.isParent=t}function tR(){return Rn.lFrame.isParent}function La(){const e=Rn.lFrame;let t=e.bindingRootIndex;return-1===t&&(t=e.bindingRootIndex=e.tView.bindingStartIndex),t}function zl(){return Rn.lFrame.bindingIndex++}function ibe(e,t){const n=Rn.lFrame;n.bindingIndex=n.bindingRootIndex=e,rR(t)}function rR(e){Rn.lFrame.currentDirectiveIndex=e}function oR(){return Rn.lFrame.currentQueryIndex}function Aw(e){Rn.lFrame.currentQueryIndex=e}function sbe(e){const t=e[Mt];return 2===t.type?t.declTNode:1===t.type?e[aa]:null}function C9(e,t,n){if(n&yr.SkipSelf){let i=t,o=e;for(;!(i=i.parent,null!==i||n&yr.Host||(i=sbe(o),null===i||(o=o[My],10&i.type))););if(null===i)return!1;t=i,e=o}const r=Rn.lFrame=w9();return r.currentTNode=t,r.lView=e,!0}function sR(e){const t=w9(),n=e[Mt];Rn.lFrame=t,t.currentTNode=n.firstChild,t.lView=e,t.tView=n,t.contextLView=e,t.bindingIndex=n.bindingStartIndex,t.inI18n=!1}function w9(){const e=Rn.lFrame,t=null===e?null:e.child;return null===t?A9(e):t}function A9(e){const t={currentTNode:null,isParent:!0,lView:null,tView:null,selectedIndex:-1,contextLView:null,elementDepthCount:0,currentNamespace:null,currentDirectiveIndex:-1,bindingRootIndex:-1,bindingIndex:-1,currentQueryIndex:0,parent:e,child:null,inI18n:!1};return null!==e&&(e.child=t),t}function I9(){const e=Rn.lFrame;return Rn.lFrame=e.parent,e.currentTNode=null,e.lView=null,e}const T9=I9;function aR(){const e=I9();e.isParent=!0,e.tView=null,e.selectedIndex=-1,e.contextLView=null,e.elementDepthCount=0,e.currentDirectiveIndex=-1,e.currentNamespace=null,e.bindingRootIndex=-1,e.bindingIndex=-1,e.currentQueryIndex=0}function la(){return Rn.lFrame.selectedIndex}function lg(e){Rn.lFrame.selectedIndex=e}function Ri(){const e=Rn.lFrame;return __(e.tView,e.selectedIndex)}let E9=!0;function C_(){return E9}function Bd(e){E9=e}function Iw(e,t){for(let n=t.directiveStart,r=t.directiveEnd;n=r)break}else t[c]<0&&(e[Ry]+=65536),(a>14>16&&(3&e[bn])===t&&(e[bn]+=16384,M9(a,o)):M9(a,o)}const By=-1;class w_{constructor(t,n,r){this.factory=t,this.resolving=!1,this.canSeeViewProviders=n,this.injectImpl=r}}function lR(e){return e!==By}function A_(e){return 32767&e}function I_(e,t){let n=function bbe(e){return e>>16}(e),r=t;for(;n>0;)r=r[My],n--;return r}let dR=!0;function Ew(e){const t=dR;return dR=e,t}const R9=255,k9=5;let vbe=0;const Od={};function Pw(e,t){const n=N9(e,t);if(-1!==n)return n;const r=t[Mt];r.firstCreatePass&&(e.injectorIndex=t.length,fR(r.data,e),fR(t,null),fR(r.blueprint,null));const i=Mw(e,t),o=e.injectorIndex;if(lR(i)){const s=A_(i),a=I_(i,t),c=a[Mt].data;for(let u=0;u<8;u++)t[o+u]=a[s+u]|c[s+u]}return t[o+8]=i,o}function fR(e,t){e.push(0,0,0,0,0,0,0,0,t)}function N9(e,t){return-1===e.injectorIndex||e.parent&&e.parent.injectorIndex===e.injectorIndex||null===t[e.injectorIndex+8]?-1:e.injectorIndex}function Mw(e,t){if(e.parent&&-1!==e.parent.injectorIndex)return e.parent.injectorIndex;let n=0,r=null,i=t;for(;null!==i;){if(r=z9(i),null===r)return By;if(n++,i=i[My],-1!==r.injectorIndex)return r.injectorIndex|n<<16}return By}function pR(e,t,n){!function _be(e,t,n){let r;"string"==typeof n?r=n.charCodeAt(0)||0:n.hasOwnProperty(u_)&&(r=n[u_]),null==r&&(r=n[u_]=vbe++);const i=r&R9;t.data[e+(i>>k9)]|=1<=0?t&R9:wbe:t}(n);if("function"==typeof o){if(!C9(t,e,r))return r&yr.Host?F9(i,0,r):B9(t,n,r,i);try{let s;if(s=o(r),null!=s||r&yr.Optional)return s;IM()}finally{T9()}}else if("number"==typeof o){let s=null,a=N9(e,t),c=By,u=r&yr.Host?t[go][aa]:null;for((-1===a||r&yr.SkipSelf)&&(c=-1===a?Mw(e,t):t[a+8],c!==By&&V9(r,!1)?(s=t[Mt],a=A_(c),t=I_(c,t)):a=-1);-1!==a;){const l=t[Mt];if(U9(o,a,l.data)){const d=Sbe(a,t,n,s,r,u);if(d!==Od)return d}c=t[a+8],c!==By&&V9(r,t[Mt].data[a+8]===u)&&U9(o,a,t)?(s=l,a=A_(c),t=I_(c,t)):a=-1}}return i}function Sbe(e,t,n,r,i,o){const s=t[Mt],a=s.data[e+8],l=Rw(a,s,n,null==r?cg(a)&&dR:r!=s&&!!(3&a.type),i&yr.Host&&o===a);return null!==l?dg(t,s,l,a):Od}function Rw(e,t,n,r,i){const o=e.providerIndexes,s=t.data,a=1048575&o,c=e.directiveStart,l=o>>20,f=i?a+l:e.directiveEnd;for(let p=r?a:a+l;p=c&&m.type===n)return p}if(i){const p=s[c];if(p&&Vl(p)&&p.type===n)return c}return null}function dg(e,t,n,r){let i=e[n];const o=t.data;if(function hbe(e){return e instanceof w_}(i)){const s=i;s.resolving&&function U0e(e,t){throw t&&t.join(" > "),new It(-200,e)}(function Zr(e){return"function"==typeof e?e.name||e.toString():"object"==typeof e&&null!=e&&"function"==typeof e.type?e.type.name||e.type.toString():Un(e)}(o[n]));const a=Ew(s.canSeeViewProviders);s.resolving=!0;const u=s.injectImpl?bc(s.injectImpl):null;C9(e,r,yr.Default);try{i=e[n]=s.factory(void 0,o,e,r),t.firstCreatePass&&n>=r.directiveStart&&function fbe(e,t,n){const{ngOnChanges:r,ngOnInit:i,ngDoCheck:o}=t.type.prototype;if(r){const s=u9(t);(n.preOrderHooks??=[]).push(e,s),(n.preOrderCheckHooks??=[]).push(e,s)}i&&(n.preOrderHooks??=[]).push(0-e,i),o&&((n.preOrderHooks??=[]).push(e,o),(n.preOrderCheckHooks??=[]).push(e,o))}(n,o[n],t)}finally{null!==u&&bc(u),Ew(a),s.resolving=!1,T9()}}return i}function U9(e,t,n){return!!(n[t+(e>>k9)]&1<{const t=e.prototype.constructor,n=t[Hf]||mR(t),r=Object.prototype;let i=Object.getPrototypeOf(e.prototype).constructor;for(;i&&i!==r;){const o=i[Hf]||mR(i);if(o&&o!==n)return o;i=Object.getPrototypeOf(i)}return o=>new o})}function mR(e){return rw(e)?()=>{const t=mR(En(e));return t&&t()}:ig(e)}function z9(e){const t=e[Mt],n=t.type;return 2===n?t.declTNode:1===n?e[aa]:null}function W9(e,t=null,n=null,r){const i=$9(e,t,n,r);return i.resolveInjectorInitializers(),i}function $9(e,t=null,n=null,r,i=new Set){const o=[n||Vr,mye(e)];return r=r||("object"==typeof e?void 0:Ss(e)),new Ty(o,t||bw(),r||null,i)}let Sc=(()=>{class e{static#e=this.THROW_IF_NOT_FOUND=l_;static#t=this.NULL=new pw;static create(n,r){if(Array.isArray(n))return W9({name:""},r,n,"");{const i=n.name??"";return W9({name:i},n.parent,n.providers,i)}}static#n=this.\u0275prov=Gt({token:e,providedIn:"any",factory:()=>Zt(zG)});static#r=this.__NG_ELEMENT_ID__=-1}return e})();function yR(e){return e.ngOriginalError}class Ld{constructor(){this._console=console}handleError(t){const n=this._findOriginalError(t);this._console.error("ERROR",t),n&&this._console.error("ORIGINAL ERROR",n)}_findOriginalError(t){let n=t&&yR(t);for(;n&&yR(n);)n=yR(n);return n||null}}const X9=new Yt("",{providedIn:"root",factory:()=>bt(Ld).handleError.bind(void 0)});let Uy=(()=>{class e{static#e=this.__NG_ELEMENT_ID__=Nbe;static#t=this.__NG_ENV_ID__=n=>n}return e})();class kbe extends Uy{constructor(t){super(),this._lView=t}onDestroy(t){return ww(this._lView,t),()=>function eR(e,t){if(null===e[Ch])return;const n=e[Ch].indexOf(t);-1!==n&&e[Ch].splice(n,1)}(this._lView,t)}}function Nbe(){return new kbe(it())}function Fbe(){return Vy(hi(),it())}function Vy(e,t){return new Ah(Oa(e,t))}let Ah=(()=>{class e{constructor(n){this.nativeElement=n}static#e=this.__NG_ELEMENT_ID__=Fbe}return e})();function Z9(e){return e instanceof Ah?e.nativeElement:e}function bR(e){return t=>{setTimeout(e,void 0,t)}}const Ua=class Bbe extends mr{constructor(t=!1){super(),this.destroyRef=void 0,this.__isAsync=t,t9()&&(this.destroyRef=bt(Uy,{optional:!0})??void 0)}emit(t){const n=sr(null);try{super.next(t)}finally{sr(n)}}subscribe(t,n,r){let i=t,o=n||(()=>null),s=r;if(t&&"object"==typeof t){const c=t;i=c.next?.bind(c),o=c.error?.bind(c),s=c.complete?.bind(c)}this.__isAsync&&(o=bR(o),i&&(i=bR(i)),s&&(s=bR(s)));const a=super.subscribe({next:i,error:o,complete:s});return t instanceof Fa&&t.add(a),a}};function Obe(){return this._results[Symbol.iterator]()}class vR{static#e=Symbol.iterator;get changes(){return this._changes??=new Ua}constructor(t=!1){this._emitDistinctChangesOnly=t,this.dirty=!0,this._onDirty=void 0,this._results=[],this._changesDetected=!1,this._changes=void 0,this.length=0,this.first=void 0,this.last=void 0;const n=vR.prototype;n[Symbol.iterator]||(n[Symbol.iterator]=Obe)}get(t){return this._results[t]}map(t){return this._results.map(t)}filter(t){return this._results.filter(t)}find(t){return this._results.find(t)}reduce(t,n){return this._results.reduce(t,n)}forEach(t){this._results.forEach(t)}some(t){return this._results.some(t)}toArray(){return this._results.slice()}toString(){return this._results.toString()}reset(t,n){this.dirty=!1;const r=function vc(e){return e.flat(Number.POSITIVE_INFINITY)}(t);(this._changesDetected=!function Q0e(e,t,n){if(e.length!==t.length)return!1;for(let r=0;rove}),ove="ng",yj=new Yt(""),Th=new Yt("",{providedIn:"platform",factory:()=>"unknown"}),bj=new Yt("",{providedIn:"root",factory:()=>function Ih(){if(void 0!==CR)return CR;if(typeof document<"u")return document;throw new It(210,!1)}().body?.querySelector("[ngCspNonce]")?.getAttribute("ngCspNonce")||null});let vj=()=>null;function RR(e,t,n=!1){return vj(e,t,n)}const wj=new Yt("",{providedIn:"root",factory:()=>!1});let Hw;function Dj(e){return function OR(){if(void 0===Hw&&(Hw=null,si.trustedTypes))try{Hw=si.trustedTypes.createPolicy("angular#unsafe-bypass",{createHTML:e=>e,createScript:e=>e,createScriptURL:e=>e})}catch{}return Hw}()?.createScriptURL(e)||e}class Ej{constructor(t){this.changingThisBreaksApplicationSecurity=t}toString(){return`SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see ${AG})`}}function Dh(e){return e instanceof Ej?e.changingThisBreaksApplicationSecurity:e}function N_(e,t){const n=function wve(e){return e instanceof Ej&&e.getTypeName()||null}(e);if(null!=n&&n!==t){if("ResourceURL"===n&&"URL"===t)return!0;throw new Error(`Required a safe ${t}, got a ${n} (see ${AG})`)}return n===t}const Dve=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:\/?#]*(?:[\/?#]|$))/i;var Hy=function(e){return e[e.NONE=0]="NONE",e[e.HTML=1]="HTML",e[e.STYLE=2]="STYLE",e[e.SCRIPT=3]="SCRIPT",e[e.URL=4]="URL",e[e.RESOURCE_URL=5]="RESOURCE_URL",e}(Hy||{});function Lj(e){const t=B_();return t?t.sanitize(Hy.URL,e)||"":N_(e,"URL")?Dh(e):function LR(e){return(e=String(e)).match(Dve)?e:"unsafe:"+e}(Un(e))}function Uj(e){const t=B_();if(t)return Dj(t.sanitize(Hy.RESOURCE_URL,e)||"");if(N_(e,"ResourceURL"))return Dj(Dh(e));throw new It(904,!1)}function B_(){const e=it();return e&&e[Ul].sanitizer}function Hj(e){return e.ownerDocument.defaultView}function Qc(e){return e instanceof Function?e():e}var Ph=function(e){return e[e.Important=1]="Important",e[e.DashCase=2]="DashCase",e}(Ph||{});let qR;function WR(e,t){return qR(e,t)}function Wy(e,t,n,r,i){if(null!=r){let o,s=!1;ua(r)?o=r:ca(r)&&(s=!0,r=r[Ji]);const a=_i(r);0===e&&null!==n?null==i?Jj(t,n,a):fg(t,n,a,i||null,!0):1===e&&null!==n?fg(t,n,a,i||null,!0):2===e?function U_(e,t,n){const r=Kw(e,t);r&&function l1e(e,t,n,r){e.removeChild(t,n,r)}(e,r,t,n)}(t,a,s):3===e&&t.destroyNode(a),null!=o&&function p1e(e,t,n,r,i){const o=n[Rd];o!==_i(n)&&Wy(t,e,r,o,i);for(let a=Go;a0&&(e[n-1][Ll]=r[Ll]);const o=dw(e,Go+t);!function r1e(e,t){Kj(e,t),t[Ji]=null,t[aa]=null}(r[Mt],r);const s=o[qf];null!==s&&s.detachView(o[Mt]),r[zo]=null,r[Ll]=null,r[bn]&=-129}return r}function Xw(e,t){if(!(256&t[bn])){const n=t[Mn];n.destroyNode&&Qw(e,t,n,3,null,null),function o1e(e){let t=e[m_];if(!t)return XR(e[Mt],e);for(;t;){let n=null;if(ca(t))n=t[m_];else{const r=t[Go];r&&(n=r)}if(!n){for(;t&&!t[Ll]&&t!==e;)ca(t)&&XR(t[Mt],t),t=t[zo];null===t&&(t=e),ca(t)&&XR(t[Mt],t),n=t&&t[Ll]}t=n}}(t)}}function XR(e,t){if(256&t[bn])return;const n=sr(null);try{t[bn]&=-129,t[bn]|=256,t[ag]&&function lG(e){if(gy(e),s_(e))for(let t=0;t=0?r[s]():r[-s].unsubscribe(),o+=2}else n[o].call(r[n[o+1]]);null!==r&&(t[Py]=null);const i=t[Ch];if(null!==i){t[Ch]=null;for(let o=0;o-1){const{encapsulation:o}=e.data[r.directiveStart+i];if(o===Fl.None||o===Fl.Emulated)return null}return Oa(r,n)}}(e,t.parent,n)}function fg(e,t,n,r,i){e.insertBefore(t,n,r,i)}function Jj(e,t,n){e.appendChild(t,n)}function eH(e,t,n,r,i){null!==r?fg(e,t,n,r,i):Jj(e,t,n)}function Kw(e,t){return e.parentNode(t)}let ZR,rH=function nH(e,t,n){return 40&e.type?Oa(e,n):null};function Zw(e,t,n,r){const i=KR(e,r,t),o=t[Mn],a=function tH(e,t,n){return rH(e,t,n)}(r.parent||t[aa],r,t);if(null!=i)if(Array.isArray(n))for(let c=0;cVn&&lH(e,t,Vn,!1),kd(s?2:0,i),n(r,i)}finally{lg(o),kd(s?3:1,i)}}function tk(e,t,n){if(qM(t)){const r=sr(null);try{const o=t.directiveEnd;for(let s=t.directiveStart;snull;function gH(e,t,n,r,i){for(let o in t){if(!t.hasOwnProperty(o))continue;const s=t[o];if(void 0===s)continue;r??={};let a,c=Bl.None;Array.isArray(s)?(a=s[0],c=s[1]):a=s;let u=o;if(null!==i){if(!i.hasOwnProperty(o))continue;u=i[o]}0===e?yH(r,n,u,a,c):yH(r,n,u,a)}return r}function yH(e,t,n,r,i){let o;e.hasOwnProperty(n)?(o=e[n]).push(t,r):o=e[n]=[t,r],void 0!==i&&o.push(i)}function ok(e,t,n,r){if(b9()){const i=null===r?null:{"":-1},o=function R1e(e,t){const n=e.directiveRegistry;let r=null,i=null;if(n)for(let o=0;o0;){const n=e[--t];if("number"==typeof n&&n<0)return n}return 0})(s)!=a&&s.push(a),s.push(n,r,o)}}(e,t,r,V_(e,n,i.hostVars,Wn),i)}function Ud(e,t,n,r,i,o){const s=Oa(e,t);!function ak(e,t,n,r,i,o,s){if(null==o)e.removeAttribute(t,i,n);else{const a=null==s?Un(o):s(o,r||"",i);e.setAttribute(t,i,a,n)}}(t[Mn],s,o,e.value,n,r,i)}function L1e(e,t,n,r,i,o){const s=o[t];if(null!==s)for(let a=0;a0&&(n[i-1][Ll]=t),r!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{},consumerIsAlwaysLive:!0,consumerMarkedDirty:e=>{x_(e.lView)},consumerOnSignalRead(){this.lView[ag]=this}},DH=100;function nA(e,t=!0,n=0){const r=e[Ul],i=r.rendererFactory;i.begin?.();try{!function $1e(e,t){fk(e,t);let n=0;for(;QM(e);){if(n===DH)throw new It(103,!1);n++,fk(e,1)}}(e,n)}catch(s){throw t&&tA(e,s),s}finally{i.end?.(),r.inlineEffectRunner?.flush()}}function Y1e(e,t,n,r){const i=t[bn];if(!(256&~i))return;t[Ul].inlineEffectRunner?.flush(),sR(t);let s=null,a=null;(function X1e(e){return 2!==e.type})(e)&&(a=function j1e(e){return e[ag]??function H1e(e){const t=TH.pop()??Object.create(W1e);return t.lView=e,t}(e)}(t),s=function cG(e){return e&&(e.nextProducerIndex=0),sr(e)}(a));try{m9(t),function x9(e){return Rn.lFrame.bindingIndex=e}(e.bindingStartIndex),null!==n&&pH(e,t,n,2,r);const c=!(3&~i);if(c){const d=e.preOrderCheckHooks;null!==d&&Tw(t,d,null)}else{const d=e.preOrderHooks;null!==d&&Dw(t,d,0,null),cR(t,0)}if(function K1e(e){for(let t=aj(e);null!==t;t=cj(t)){if(!(t[bn]&HM.HasTransplantedViews))continue;const n=t[ky];for(let r=0;re.nextProducerIndex;)e.producerNode.pop(),e.producerLastReadVersion.pop(),e.producerIndexOfThis.pop()}}(a,s),function q1e(e){e.lView[ag]!==e&&(e.lView=null,TH.push(e))}(a)),aR()}}function EH(e,t){for(let n=aj(e);null!==n;n=cj(n))for(let r=Go;r-1&&(O_(t,r),dw(n,r))}this._attachedToViewContainer=!1}Xw(this._lView[Mt],this._lView)}onDestroy(t){ww(this._lView,t)}markForCheck(){H_(this._cdRefInjectingView||this._lView)}detach(){this._lView[bn]&=-129}reattach(){JM(this._lView),this._lView[bn]|=128}detectChanges(){this._lView[bn]|=1024,nA(this._lView,this.notifyErrorHandler)}checkNoChanges(){}attachToViewContainerRef(){if(this._appRef)throw new It(902,!1);this._attachedToViewContainer=!0}detachFromAppRef(){this._appRef=null,Kj(this._lView[Mt],this._lView)}attachToAppRef(t){if(this._attachedToViewContainer)throw new It(902,!1);this._appRef=t,JM(this._lView)}}let Kf=(()=>{class e{static#e=this.__NG_ELEMENT_ID__=e_e}return e})();const Q1e=Kf,J1e=class extends Q1e{constructor(t,n,r){super(),this._declarationLView=t,this._declarationTContainer=n,this.elementRef=r}get ssrId(){return this._declarationTContainer.tView?.ssrId||null}createEmbeddedView(t,n){return this.createEmbeddedViewImpl(t,n)}createEmbeddedViewImpl(t,n,r){const i=z_(this._declarationLView,this._declarationTContainer,t,{embeddedViewInjector:n,dehydratedView:r});return new q_(i)}};function e_e(){return rA(hi(),it())}function rA(e,t){return 4&e.type?new J1e(t,e,Vy(e,t)):null}let OH=()=>null;function Xy(e,t){return OH(e,t)}class bk{}class w_e{}class LH{}class I_e{resolveComponentFactory(t){throw function A_e(e){const t=Error(`No component factory found for ${Ss(e)}.`);return t.ngComponent=e,t}(t)}}let cA=(()=>{class e{static#e=this.NULL=new I_e}return e})();class VH{}let uA=(()=>{class e{constructor(){this.destroyNode=null}static#e=this.__NG_ELEMENT_ID__=()=>function T_e(){const e=it(),n=Zc(hi().index,e);return(ca(n)?n:e)[Mn]}()}return e})(),D_e=(()=>{class e{static#e=this.\u0275prov=Gt({token:e,providedIn:"root",factory:()=>null})}return e})();const vk={},zH=new Set;function Vd(e){zH.has(e)||(zH.add(e),performance?.mark?.("mark_feature_usage",{detail:{feature:e}}))}function GH(...e){}class Qr{constructor({enableLongStackTrace:t=!1,shouldCoalesceEventChangeDetection:n=!1,shouldCoalesceRunChangeDetection:r=!1}){if(this.hasPendingMacrotasks=!1,this.hasPendingMicrotasks=!1,this.isStable=!0,this.onUnstable=new Ua(!1),this.onMicrotaskEmpty=new Ua(!1),this.onStable=new Ua(!1),this.onError=new Ua(!1),typeof Zone>"u")throw new It(908,!1);Zone.assertZonePatched();const i=this;i._nesting=0,i._outer=i._inner=Zone.current,Zone.TaskTrackingZoneSpec&&(i._inner=i._inner.fork(new Zone.TaskTrackingZoneSpec)),t&&Zone.longStackTraceZoneSpec&&(i._inner=i._inner.fork(Zone.longStackTraceZoneSpec)),i.shouldCoalesceEventChangeDetection=!r&&n,i.shouldCoalesceRunChangeDetection=r,i.lastRequestAnimationFrameId=-1,i.nativeRequestAnimationFrame=function E_e(){const e="function"==typeof si.requestAnimationFrame;let t=si[e?"requestAnimationFrame":"setTimeout"],n=si[e?"cancelAnimationFrame":"clearTimeout"];if(typeof Zone<"u"&&t&&n){const r=t[Zone.__symbol__("OriginalDelegate")];r&&(t=r);const i=n[Zone.__symbol__("OriginalDelegate")];i&&(n=i)}return{nativeRequestAnimationFrame:t,nativeCancelAnimationFrame:n}}().nativeRequestAnimationFrame,function R_e(e){const t=()=>{!function M_e(e){e.isCheckStableRunning||-1!==e.lastRequestAnimationFrameId||(e.lastRequestAnimationFrameId=e.nativeRequestAnimationFrame.call(si,()=>{e.fakeTopEventTask||(e.fakeTopEventTask=Zone.root.scheduleEventTask("fakeTopEventTask",()=>{e.lastRequestAnimationFrameId=-1,xk(e),e.isCheckStableRunning=!0,_k(e),e.isCheckStableRunning=!1},void 0,()=>{},()=>{})),e.fakeTopEventTask.invoke()}),xk(e))}(e)};e._inner=e._inner.fork({name:"angular",properties:{isAngularZone:!0},onInvokeTask:(n,r,i,o,s,a)=>{if(function k_e(e){return!(!Array.isArray(e)||1!==e.length)&&!0===e[0].data?.__ignore_ng_zone__}(a))return n.invokeTask(i,o,s,a);try{return jH(e),n.invokeTask(i,o,s,a)}finally{(e.shouldCoalesceEventChangeDetection&&"eventTask"===o.type||e.shouldCoalesceRunChangeDetection)&&t(),HH(e)}},onInvoke:(n,r,i,o,s,a,c)=>{try{return jH(e),n.invoke(i,o,s,a,c)}finally{e.shouldCoalesceRunChangeDetection&&t(),HH(e)}},onHasTask:(n,r,i,o)=>{n.hasTask(i,o),r===i&&("microTask"==o.change?(e._hasPendingMicrotasks=o.microTask,xk(e),_k(e)):"macroTask"==o.change&&(e.hasPendingMacrotasks=o.macroTask))},onHandleError:(n,r,i,o)=>(n.handleError(i,o),e.runOutsideAngular(()=>e.onError.emit(o)),!1)})}(i)}static isInAngularZone(){return typeof Zone<"u"&&!0===Zone.current.get("isAngularZone")}static assertInAngularZone(){if(!Qr.isInAngularZone())throw new It(909,!1)}static assertNotInAngularZone(){if(Qr.isInAngularZone())throw new It(909,!1)}run(t,n,r){return this._inner.run(t,n,r)}runTask(t,n,r,i){const o=this._inner,s=o.scheduleEventTask("NgZoneEvent: "+i,t,P_e,GH,GH);try{return o.runTask(s,n,r)}finally{o.cancelTask(s)}}runGuarded(t,n,r){return this._inner.runGuarded(t,n,r)}runOutsideAngular(t){return this._outer.run(t)}}const P_e={};function _k(e){if(0==e._nesting&&!e.hasPendingMicrotasks&&!e.isStable)try{e._nesting++,e.onMicrotaskEmpty.emit(null)}finally{if(e._nesting--,!e.hasPendingMicrotasks)try{e.runOutsideAngular(()=>e.onStable.emit(null))}finally{e.isStable=!0}}}function xk(e){e.hasPendingMicrotasks=!!(e._hasPendingMicrotasks||(e.shouldCoalesceEventChangeDetection||e.shouldCoalesceRunChangeDetection)&&-1!==e.lastRequestAnimationFrameId)}function jH(e){e._nesting++,e.isStable&&(e.isStable=!1,e.onUnstable.emit(null))}function HH(e){e._nesting--,_k(e)}var pg=function(e){return e[e.EarlyRead=0]="EarlyRead",e[e.Write=1]="Write",e[e.MixedReadWrite=2]="MixedReadWrite",e[e.Read=3]="Read",e}(pg||{});const WH={destroy(){}};function $H(e,t){!t&&function vw(e){if(!t9())throw new It(-203,!1)}();const n=t?.injector??bt(Sc);if(!function Eh(e){return"browser"===(e??bt(Sc)).get(Th)}(n))return WH;Vd("NgAfterNextRender");const r=n.get(K_),i=r.handler??=new XH,o=t?.phase??pg.MixedReadWrite,s=()=>{i.unregister(c),a()},a=n.get(Uy).onDestroy(s),c=Md(n,()=>new YH(o,()=>{s(),e()}));return i.register(c),{destroy:s}}class YH{constructor(t,n){this.phase=t,this.callbackFn=n,this.zone=bt(Qr),this.errorHandler=bt(Ld,{optional:!0}),bt(bk,{optional:!0})?.notify(1)}invoke(){try{this.zone.runOutsideAngular(this.callbackFn)}catch(t){this.errorHandler?.handleError(t)}}}class XH{constructor(){this.executingCallbacks=!1,this.buckets={[pg.EarlyRead]:new Set,[pg.Write]:new Set,[pg.MixedReadWrite]:new Set,[pg.Read]:new Set},this.deferredCallbacks=new Set}register(t){(this.executingCallbacks?this.deferredCallbacks:this.buckets[t.phase]).add(t)}unregister(t){this.buckets[t.phase].delete(t),this.deferredCallbacks.delete(t)}execute(){this.executingCallbacks=!0;for(const t of Object.values(this.buckets))for(const n of t)n.invoke();this.executingCallbacks=!1;for(const t of this.deferredCallbacks)this.buckets[t.phase].add(t);this.deferredCallbacks.clear()}destroy(){for(const t of Object.values(this.buckets))t.clear();this.deferredCallbacks.clear()}}let K_=(()=>{class e{constructor(){this.handler=null,this.internalCallbacks=[]}execute(){this.executeInternalCallbacks(),this.handler?.execute()}executeInternalCallbacks(){const n=[...this.internalCallbacks];this.internalCallbacks.length=0;for(const r of n)r()}ngOnDestroy(){this.handler?.destroy(),this.handler=null,this.internalCallbacks.length=0}static#e=this.\u0275prov=Gt({token:e,providedIn:"root",factory:()=>new e})}return e})();function dA(e,t,n){let r=n?e.styles:null,i=n?e.classes:null,o=0;if(null!==t)for(let s=0;s0&&cH(e,n,o.join(" "))}}(p,A,h,r),void 0!==n&&function W_e(e,t,n){const r=e.projection=[];for(let i=0;i{class e{static#e=this.__NG_ELEMENT_ID__=Y_e}return e})();function Y_e(){return nq(hi(),it())}const X_e=Gl,eq=class extends X_e{constructor(t,n,r){super(),this._lContainer=t,this._hostTNode=n,this._hostLView=r}get element(){return Vy(this._hostTNode,this._hostLView)}get injector(){return new As(this._hostTNode,this._hostLView)}get parentInjector(){const t=Mw(this._hostTNode,this._hostLView);if(lR(t)){const n=I_(t,this._hostLView),r=A_(t);return new As(n[Mt].data[r+8],n)}return new As(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(t){const n=tq(this._lContainer);return null!==n&&n[t]||null}get length(){return this._lContainer.length-Go}createEmbeddedView(t,n,r){let i,o;"number"==typeof r?i=r:null!=r&&(i=r.index,o=r.injector);const s=Xy(this._lContainer,t.ssrId),a=t.createEmbeddedViewImpl(n||{},o,s);return this.insertImpl(a,i,Yy(this._hostTNode,s)),a}createComponent(t,n,r,i,o){const s=t&&!function h_(e){return"function"==typeof e}(t);let a;if(s)a=n;else{const m=n||{};a=m.index,r=m.injector,i=m.projectableNodes,o=m.environmentInjector||m.ngModuleRef}const c=s?t:new J_(dr(t)),u=r||this.parentInjector;if(!o&&null==c.ngModule){const h=(s?u:this.parentInjector).get(xc,null);h&&(o=h)}const l=dr(c.componentType??{}),d=Xy(this._lContainer,l?.id??null),p=c.create(u,i,d?.firstChild??null,o);return this.insertImpl(p.hostView,a,Yy(this._hostTNode,d)),p}insert(t,n){return this.insertImpl(t,n,!0)}insertImpl(t,n,r){const i=t._lView;if(function Hye(e){return ua(e[zo])}(i)){const a=this.indexOf(t);if(-1!==a)this.detach(a);else{const c=i[zo],u=new eq(c,c[aa],c[zo]);u.detach(u.indexOf(t))}}const o=this._adjustIndex(n),s=this._lContainer;return G_(s,i,o,r),t.attachToViewContainerRef(),LG(Ak(s),o,t),t}move(t,n){return this.insert(t,n)}indexOf(t){const n=tq(this._lContainer);return null!==n?n.indexOf(t):-1}remove(t){const n=this._adjustIndex(t,-1),r=O_(this._lContainer,n);r&&(dw(Ak(this._lContainer),n),Xw(r[Mt],r))}detach(t){const n=this._adjustIndex(t,-1),r=O_(this._lContainer,n);return r&&null!=dw(Ak(this._lContainer),n)?new q_(r):null}_adjustIndex(t,n=0){return t??this.length+n}};function tq(e){return e[8]}function Ak(e){return e[8]||(e[8]=[])}function nq(e,t){let n;const r=t[e.index];return ua(r)?n=r:(n=_H(r,t,null,e),t[e.index]=n,eA(t,n)),rq(n,t,e,r),new eq(n,e,t)}let rq=function oq(e,t,n,r){if(e[Rd])return;let i;i=8&n.type?_i(r):function K_e(e,t){const n=e[Mn],r=n.createComment(""),i=Oa(t,e);return fg(n,Kw(n,i),r,function d1e(e,t){return e.nextSibling(t)}(n,i),!1),r}(t,n),e[Rd]=i},Ik=()=>!1;class Tk{constructor(t){this.queryList=t,this.matches=null}clone(){return new Tk(this.queryList)}setDirty(){this.queryList.setDirty()}}class Dk{constructor(t=[]){this.queries=t}createEmbeddedView(t){const n=t.queries;if(null!==n){const r=null!==t.contentQueries?t.contentQueries[0]:n.length,i=[];for(let o=0;ot.trim())}(t):t}}class Ek{constructor(t=[]){this.queries=t}elementStart(t,n){for(let r=0;r0)r.push(s[a/2]);else{const u=o[a+1],l=t[-c];for(let d=Go;dn()),this.destroyCbs=null}onDestroy(t){this.destroyCbs.push(t)}}class Bk extends Rq{constructor(t){super(),this.moduleType=t}create(t){return new Fk(this.moduleType,t,[])}}class kq extends hg{constructor(t){super(),this.componentFactoryResolver=new QH(this),this.instance=null;const n=new Ty([...t.providers,{provide:hg,useValue:this},{provide:cA,useValue:this.componentFactoryResolver}],t.parent||bw(),t.debugName,new Set(["environment"]));this.injector=n,t.runEnvironmentInitializers&&n.resolveInjectorInitializers()}destroy(){this.injector.destroy()}onDestroy(t){this.injector.onDestroy(t)}}function hA(e,t,n=null){return new kq({providers:e,parent:t,debugName:n,runEnvironmentInitializers:!0}).injector}let kh=(()=>{class e{constructor(){this.taskId=0,this.pendingTasks=new Set,this.hasPendingTasks=new Ao(!1)}get _hasPendingTasks(){return this.hasPendingTasks.value}add(){this._hasPendingTasks||this.hasPendingTasks.next(!0);const n=this.taskId++;return this.pendingTasks.add(n),n}remove(n){this.pendingTasks.delete(n),0===this.pendingTasks.size&&this._hasPendingTasks&&this.hasPendingTasks.next(!1)}ngOnDestroy(){this.pendingTasks.clear(),this._hasPendingTasks&&this.hasPendingTasks.next(!1)}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function zd(e,t,n){return e[t]=n}function jo(e,t,n){return!Object.is(e[t],n)&&(e[t]=n,!0)}function yA(e,t,n,r,i){const o=function mg(e,t,n,r){const i=jo(e,t,n);return jo(e,t+1,r)||i}(e,t,n,r);return jo(e,t+2,i)||o}function Jc(e,t,n,r,i,o,s,a){const c=it(),u=br(),l=e+Vn,d=u.firstCreatePass?function kxe(e,t,n,r,i,o,s,a,c){const u=t.consts,l=$y(t,e,4,s||null,Nd(u,a));ok(t,n,l,Nd(u,c)),Iw(t,l);const d=l.tView=ik(2,l,r,i,o,t.directiveRegistry,t.pipeRegistry,null,t.schemas,u,null);return null!==t.queries&&(t.queries.template(t,l),d.queries=t.queries.embeddedTView(l)),l}(l,u,c,t,n,r,i,o,s):u.data[l];Fd(d,!1);const f=Nq(u,c,d,e);C_()&&Zw(u,c,f,d),da(f,c);const p=_H(f,c,f,d);return c[l]=p,eA(c,p),function iq(e,t,n){return Ik(e,t,n)}(p,d,c),Cw(d)&&nk(u,c,d),null!=s&&rk(c,d,a),Jc}let Nq=function Fq(e,t,n,r){return Bd(!0),t[Mn].createComment("")};function $k(e,t,n,r){const i=it();return jo(i,zl(),t)&&(br(),Ud(Ri(),i,e,t,n,r)),$k}function CA(e,t){return e<<17|t<<2}function Fh(e){return e>>17&32767}function Yk(e){return 2|e}function yg(e){return(131068&e)>>2}function Xk(e,t){return-131069&e|t<<2}function Kk(e){return 1|e}function fW(e,t,n,r){const i=e[n+1],o=null===t;let s=r?Fh(i):yg(i),a=!1;for(;0!==s&&(!1===a||o);){const u=e[s+1];y2e(e[s],t)&&(a=!0,e[s+1]=r?Kk(u):Yk(u)),s=r?Fh(u):yg(u)}a&&(e[n+1]=r?Yk(i):Kk(i))}function y2e(e,t){return null===e||null==t||(Array.isArray(e)?e[1]:e)===t||!(!Array.isArray(e)||"string"!=typeof t)&&Ay(e,t)>=0}function Bh(e,t,n){const r=it();return jo(r,zl(),t)&&function wc(e,t,n,r,i,o,s,a){const c=Oa(t,n);let l,u=t.inputs;!a&&null!=u&&(l=u[r])?(uk(e,n,l,r,i),cg(t)&&function I1e(e,t){const n=Zc(t,e);16&n[bn]||(n[bn]|=64)}(n,t.index)):3&t.type&&(r=function A1e(e){return"class"===e?"className":"for"===e?"htmlFor":"formaction"===e?"formAction":"innerHtml"===e?"innerHTML":"readonly"===e?"readOnly":"tabindex"===e?"tabIndex":e}(r),i=null!=s?s(i,t.value||"",r):i,o.setProperty(c,r,i))}(br(),Ri(),r,e,t,r[Mn],n,!1),Bh}function Zk(e,t,n,r,i){const s=i?"class":"style";uk(e,n,t.inputs[s],s,r)}function pb(e,t,n){return function jl(e,t,n,r){const i=it(),o=br(),s=function $f(e){const t=Rn.lFrame,n=t.bindingIndex;return t.bindingIndex=t.bindingIndex+e,n}(2);o.firstUpdatePass&&function xW(e,t,n,r){const i=e.data;if(null===i[n+1]){const o=i[la()],s=function _W(e,t){return t>=e.expandoStartIndex}(e,n);(function AW(e,t){return!!(e.flags&(t?8:16))})(o,r)&&null===t&&!s&&(t=!1),t=function I2e(e,t,n,r){const i=function iR(e){const t=Rn.lFrame.currentDirectiveIndex;return-1===t?null:e[t]}(e);let o=r?t.residualClasses:t.residualStyles;if(null===i)0===(r?t.classBindings:t.styleBindings)&&(n=sx(n=Qk(null,e,t,n,r),t.attrs,r),o=null);else{const s=t.directiveStylingLast;if(-1===s||e[s]!==i)if(n=Qk(i,e,t,n,r),null===o){let c=function T2e(e,t,n){const r=n?t.classBindings:t.styleBindings;if(0!==yg(r))return e[Fh(r)]}(e,t,r);void 0!==c&&Array.isArray(c)&&(c=Qk(null,e,t,c[1],r),c=sx(c,t.attrs,r),function D2e(e,t,n,r){e[Fh(n?t.classBindings:t.styleBindings)]=r}(e,t,r,c))}else o=function E2e(e,t,n){let r;const i=t.directiveEnd;for(let o=1+t.directiveStylingLast;o0)&&(u=!0)):l=n,i)if(0!==c){const f=Fh(e[a+1]);e[r+1]=CA(f,a),0!==f&&(e[f+1]=Xk(e[f+1],r)),e[a+1]=function p2e(e,t){return 131071&e|t<<17}(e[a+1],r)}else e[r+1]=CA(a,0),0!==a&&(e[a+1]=Xk(e[a+1],r)),a=r;else e[r+1]=CA(c,0),0===a?a=r:e[c+1]=Xk(e[c+1],r),c=r;u&&(e[r+1]=Yk(e[r+1])),fW(e,l,r,!0),fW(e,l,r,!1),function g2e(e,t,n,r,i){const o=i?e.residualClasses:e.residualStyles;null!=o&&"string"==typeof t&&Ay(o,t)>=0&&(n[r+1]=Kk(n[r+1]))}(t,l,e,r,o),s=CA(a,c),o?t.classBindings=s:t.styleBindings=s}(i,o,t,n,s,r)}}(o,e,s,r),t!==Wn&&jo(i,s,t)&&function CW(e,t,n,r,i,o,s,a){if(!(3&t.type))return;const c=e.data,u=c[a+1],l=function h2e(e){return!(1&~e)}(u)?wW(c,t,n,i,yg(u),s):void 0;wA(l)||(wA(o)||function f2e(e){return!(2&~e)}(u)&&(o=wW(c,null,n,i,a,s)),function h1e(e,t,n,r,i){if(t)i?e.addClass(n,r):e.removeClass(n,r);else{let o=-1===r.indexOf("-")?void 0:Ph.DashCase;null==i?e.removeStyle(n,r,o):("string"==typeof i&&i.endsWith("!important")&&(i=i.slice(0,-10),o|=Ph.Important),e.setStyle(n,r,i,o))}}(r,s,v_(la(),n),i,o))}(o,o.data[la()],i,i[Mn],e,i[s+1]=function k2e(e,t){return null==e||""===e||("string"==typeof t?e+=t:"object"==typeof e&&(e=Ss(Dh(e)))),e}(t,n),r,s)}(e,t,n,!1),pb}function Qk(e,t,n,r,i){let o=null;const s=n.directiveEnd;let a=n.directiveStylingLast;for(-1===a?a=n.directiveStart:a++;a0;){const c=e[i],u=Array.isArray(c),l=u?c[1]:c,d=null===l;let f=n[i+1];f===Wn&&(f=d?Vr:void 0);let p=d?MM(f,r):l===r?f:void 0;if(u&&!wA(p)&&(p=MM(c,r)),wA(p)&&(a=p,s))return a;const m=e[i+1];i=s?Fh(m):yg(m)}if(null!==t){let c=o?t.residualClasses:t.residualStyles;null!=c&&(a=MM(c,r))}return a}function wA(e){return void 0!==e}class H2e{destroy(t){}updateValue(t,n){}swap(t,n){const r=Math.min(t,n),i=Math.max(t,n),o=this.detach(i);if(i-r>1){const s=this.detach(r);this.attach(r,o),this.attach(i,s)}else this.attach(r,o)}move(t,n){this.attach(n,this.detach(t))}}function Jk(e,t,n,r,i){return e===n&&Object.is(t,r)?1:Object.is(i(e,t),i(n,r))?-1:0}function eN(e,t,n,r){return!(void 0===t||!t.has(r)||(e.attach(n,t.get(r)),t.delete(r),0))}function IW(e,t,n,r,i){if(eN(e,t,r,n(r,i)))e.updateValue(r,i);else{const o=e.create(r,i);e.attach(r,o)}}function TW(e,t,n,r){const i=new Set;for(let o=t;o<=n;o++)i.add(r(o,e.at(o)));return i}class DW{constructor(){this.kvMap=new Map,this._vMap=void 0}has(t){return this.kvMap.has(t)}delete(t){if(!this.has(t))return!1;const n=this.kvMap.get(t);return void 0!==this._vMap&&this._vMap.has(n)?(this.kvMap.set(t,this._vMap.get(n)),this._vMap.delete(n)):this.kvMap.delete(t),!0}get(t){return this.kvMap.get(t)}set(t,n){if(this.kvMap.has(t)){let r=this.kvMap.get(t);void 0===this._vMap&&(this._vMap=new Map);const i=this._vMap;for(;i.has(r);)r=i.get(r);i.set(r,n)}else this.kvMap.set(t,n)}forEach(t){for(let[n,r]of this.kvMap)if(t(r,n),void 0!==this._vMap){const i=this._vMap;for(;i.has(r);)r=i.get(r),t(r,n)}}}function Va(e,t,n){Vd("NgControlFlow");const r=it(),i=zl(),o=tN(r,Vn+e);if(jo(r,i,t)){const a=sr(null);try{if(dk(o,0),-1!==t){const c=nN(r[Mt],Vn+t),u=Xy(o,c.tView.ssrId);G_(o,z_(r,c,n,{dehydratedView:u}),0,Yy(c,u))}}finally{sr(a)}}else{const a=AH(o,0);void 0!==a&&(a[Mi]=n)}}class W2e{constructor(t,n,r){this.lContainer=t,this.$implicit=n,this.$index=r}get $count(){return this.lContainer.length-Go}}function EW(e){return e}class Y2e{constructor(t,n,r){this.hasEmptyBlock=t,this.trackByFn=n,this.liveCollection=r}}class X2e extends H2e{constructor(t,n,r){super(),this.lContainer=t,this.hostLView=n,this.templateTNode=r,this.needsIndexUpdate=!1}get length(){return this.lContainer.length-Go}at(t){return this.getLView(t)[Mi].$implicit}attach(t,n){const r=n[Kc];this.needsIndexUpdate||=t!==this.length,G_(this.lContainer,n,t,Yy(this.templateTNode,r))}detach(t){return this.needsIndexUpdate||=t!==this.length-1,function K2e(e,t){return O_(e,t)}(this.lContainer,t)}create(t,n){const r=Xy(this.lContainer,this.templateTNode.tView.ssrId);return z_(this.hostLView,this.templateTNode,new W2e(this.lContainer,n,t),{dehydratedView:r})}destroy(t){Xw(t[Mt],t)}updateValue(t,n){this.getLView(t)[Mi].$implicit=n}reset(){this.needsIndexUpdate=!1}updateIndexes(){if(this.needsIndexUpdate)for(let t=0;t(Bd(!0),Yw(r,i,function D9(){return Rn.lFrame.currentNamespace}()));const mb="en-US";let UW=mb;function px(e,t,n,r){const i=it(),o=br(),s=hi();return function aN(e,t,n,r,i,o,s){const a=Cw(r),u=e.firstCreatePass&&CH(e),l=t[Mi],d=SH(t);let f=!0;if(3&r.type||s){const h=Oa(r,t),g=s?s(h):h,y=d.length,b=s?_=>s(_i(_[r.index])):r.index;let x=null;if(!s&&a&&(x=function rCe(e,t,n,r){const i=e.cleanup;if(null!=i)for(let o=0;oc?a[c]:null}"string"==typeof s&&(o+=2)}return null}(e,t,i,r.index)),null!==x)(x.__ngLastListenerFn__||x).__ngNextListenerFn__=o,x.__ngLastListenerFn__=o,f=!1;else{o=p$(r,t,l,o,!1);const _=n.listen(g,i,o);d.push(o,_),u&&u.push(i,b,y,y+1)}}else o=p$(r,t,l,o,!1);const p=r.outputs;let m;if(f&&null!==p&&(m=p[i])){const h=m.length;if(h)for(let g=0;g-1?Zc(e.index,t):t);let c=f$(t,n,r,s),u=o.__ngNextListenerFn__;for(;u;)c=f$(t,n,u,s)&&c,u=u.__ngNextListenerFn__;return i&&!1===c&&s.preventDefault(),c}}function hx(e=1){return function abe(e){return(Rn.lFrame.contextLView=function g9(e,t){for(;e>0;)t=t[My],e--;return t}(e,Rn.lFrame.contextLView))[Mi]}(e)}function uN(e,t,n){uq(e,t,n)}function EA(e){const t=it(),n=br(),r=oR();Aw(r+1);const i=kk(n,r);if(e.dirty&&function jye(e){return!(4&~e[bn])}(t)===!(2&~i.metadata.flags)){if(null===i.matches)e.reset([]);else{const o=fq(t,r);e.reset(o,Z9),e.notifyOnChanges()}return!0}return!1}function PA(){return function Rk(e,t){return e[qf].queries[t].queryList}(it(),oR())}function ar(e,t=""){const n=it(),r=br(),i=e+Vn,o=r.firstCreatePass?$y(r,i,1,t,null):r.data[i],s=k$(r,n,o,t,e);n[i]=s,C_()&&Zw(r,n,s,o),Fd(o,!1)}let k$=(e,t,n,r,i)=>(Bd(!0),function $R(e,t){return e.createText(t)}(t[Mn],r));function ku(e){return lN("",e,""),ku}function lN(e,t,n){const r=it(),i=function ib(e,t,n,r){return jo(e,zl(),n)?t+Un(n)+r:Wn}(r,e,t,n);return i!==Wn&&function Xf(e,t,n){const r=v_(t,e);!function Xj(e,t,n){e.setValue(t,n)}(e[Mn],r,n)}(r,la(),i),lN}function dN(e,t,n,r,i){if(e=En(e),Array.isArray(e))for(let o=0;o>20;if(sg(e)||!e.multi){const p=new w_(u,i,cn),m=pN(c,t,i?l:l+f,d);-1===m?(pR(Pw(a,s),o,c),fN(o,e,t.length),t.push(c),a.directiveStart++,a.directiveEnd++,i&&(a.providerIndexes+=1048576),n.push(p),s.push(p)):(n[m]=p,s[m]=p)}else{const p=pN(c,t,l+f,d),m=pN(c,t,l,l+f),g=m>=0&&n[m];if(i&&!g||!i&&!(p>=0&&n[p])){pR(Pw(a,s),o,c);const y=function TCe(e,t,n,r,i){const o=new w_(e,n,cn);return o.multi=[],o.index=t,o.componentProviders=0,H$(o,i,r&&!n),o}(i?ICe:ACe,n.length,i,r,u);!i&&g&&(n[m].providerFactory=y),fN(o,e,t.length,0),t.push(c),a.directiveStart++,a.directiveEnd++,i&&(a.providerIndexes+=1048576),n.push(y),s.push(y)}else fN(o,e,p>-1?p:m,H$(n[i?m:p],u,!i&&r));!i&&r&&g&&n[m].componentProviders++}}}function fN(e,t,n,r){const i=sg(t),o=function yye(e){return!!e.useClass}(t);if(i||o){const c=(o?En(t.useClass):t).prototype.ngOnDestroy;if(c){const u=e.destroyHooks||(e.destroyHooks=[]);if(!i&&t.multi){const l=u.indexOf(n);-1===l?u.push(n,[r,c]):u[l+1].push(r,c)}else u.push(n,c)}}}function H$(e,t,n){return n&&e.componentProviders++,e.multi.push(t)-1}function pN(e,t,n,r){for(let i=n;i{n.providersResolver=(r,i)=>function wCe(e,t,n){const r=br();if(r.firstCreatePass){const i=Vl(e);dN(n,r.data,r.blueprint,i,!0),dN(t,r.data,r.blueprint,i,!1)}}(r,i?i(e):e,t)}}let DCe=(()=>{class e{constructor(n){this._injector=n,this.cachedInjectors=new Map}getOrCreateStandaloneInjector(n){if(!n.standalone)return null;if(!this.cachedInjectors.has(n)){const r=FM(0,n.type),i=r.length>0?hA([r],this._injector,`Standalone[${n.type.name}]`):null;this.cachedInjectors.set(n,i)}return this.cachedInjectors.get(n)}ngOnDestroy(){try{for(const n of this.cachedInjectors.values())null!==n&&n.destroy()}finally{this.cachedInjectors.clear()}}static#e=this.\u0275prov=Gt({token:e,providedIn:"environment",factory:()=>new e(Zt(xc))})}return e})();function Nu(e){Vd("NgStandalone"),e.getStandaloneInjector=t=>t.get(DCe).getOrCreateStandaloneInjector(e)}function mx(e,t,n,r){return W$(it(),La(),e,t,n,r)}function gN(e,t,n,r,i,o){return function Y$(e,t,n,r,i,o,s,a){const c=t+n;return yA(e,c,i,o,s)?zd(e,c+3,a?r.call(a,i,o,s):r(i,o,s)):gx(e,c+3)}(it(),La(),e,t,n,r,i,o)}function gx(e,t){const n=e[t];return n===Wn?void 0:n}function W$(e,t,n,r,i,o){const s=t+n;return jo(e,s,i)?zd(e,s+1,o?r.call(o,i):r(i)):gx(e,s+1)}function Ga(e,t){const n=br();let r;const i=e+Vn;n.firstCreatePass?(r=function UCe(e,t){if(t)for(let n=t.length-1;n>=0;n--){const r=t[n];if(e===r.name)return r}}(t,n.pipeRegistry),n.data[i]=r,r.onDestroy&&(n.destroyHooks??=[]).push(i,r.onDestroy)):r=n.data[i];const o=r.factory||(r.factory=ig(r.type)),a=bc(cn);try{const c=Ew(!1),u=o();return Ew(c),function lCe(e,t,n,r){n>=e.data.length&&(e.data[n]=null,e.blueprint[n]=null),t[n]=r}(n,it(),i,u),u}finally{bc(a)}}function ja(e,t,n){const r=e+Vn,i=it(),o=function Ny(e,t){return e[t]}(i,r);return function yx(e,t){return e[Mt].data[t].pure}(i,r)?W$(i,La(),t,o.transform,n,o):o.transform(n)}let fY=(()=>{class e{log(n){console.log(n)}warn(n){console.warn(n)}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();const yY=new Yt("");function BA(e){return!!e&&"function"==typeof e.then}function bY(e){return!!e&&"function"==typeof e.subscribe}const AN=new Yt("");let IN=(()=>{class e{constructor(){this.initialized=!1,this.done=!1,this.donePromise=new Promise((n,r)=>{this.resolve=n,this.reject=r}),this.appInits=bt(AN,{optional:!0})??[]}runInitializers(){if(this.initialized)return;const n=[];for(const i of this.appInits){const o=i();if(BA(o))n.push(o);else if(bY(o)){const s=new Promise((a,c)=>{o.subscribe({complete:a,error:c})});n.push(s)}}const r=()=>{this.done=!0,this.resolve()};Promise.all(n).then(()=>{r()}).catch(i=>{this.reject(i)}),0===n.length&&r(),this.initialized=!0}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();const OA=new Yt("");let Oh=(()=>{class e{constructor(){this._bootstrapListeners=[],this._runningTick=!1,this._destroyed=!1,this._destroyListeners=[],this._views=[],this.internalErrorHandler=bt(X9),this.afterRenderEffectManager=bt(K_),this.externalTestViews=new Set,this.beforeRender=new mr,this.afterTick=new mr,this.componentTypes=[],this.components=[],this.isStable=bt(kh).hasPendingTasks.pipe(qt(n=>!n)),this._injector=bt(xc)}get destroyed(){return this._destroyed}get injector(){return this._injector}bootstrap(n,r){const i=n instanceof LH;if(!this._injector.get(IN).done)throw!i&&function Sh(e){const t=dr(e)||Cs(e)||Qs(e);return null!==t&&t.standalone}(n),new It(405,!1);let s;s=i?n:this._injector.get(cA).resolveComponentFactory(n),this.componentTypes.push(s.componentType);const a=function Lwe(e){return e.isBoundToModule}(s)?void 0:this._injector.get(hg),u=s.create(Sc.NULL,[],r||s.selector,a),l=u.location.nativeElement,d=u.injector.get(yY,null);return d?.registerApplication(l),u.onDestroy(()=>{this.detachView(u.hostView),LA(this.components,u),d?.unregisterApplication(l)}),this._loadComponent(u),u}tick(){this._tick(!0)}_tick(n){if(this._runningTick)throw new It(101,!1);const r=sr(null);try{this._runningTick=!0,this.detectChangesInAttachedViews(n)}catch(i){this.internalErrorHandler(i)}finally{this.afterTick.next(),this._runningTick=!1,sr(r)}}detectChangesInAttachedViews(n){let r=0;const i=this.afterRenderEffectManager;for(;;){if(r===DH)throw new It(103,!1);if(n){const o=0===r;this.beforeRender.next(o);for(let{_lView:s,notifyErrorHandler:a}of this._views)Vwe(s,o,a)}if(r++,i.executeInternalCallbacks(),![...this.externalTestViews.keys(),...this._views].some(({_lView:o})=>TN(o))&&(i.execute(),![...this.externalTestViews.keys(),...this._views].some(({_lView:o})=>TN(o))))break}}attachView(n){const r=n;this._views.push(r),r.attachToAppRef(this)}detachView(n){const r=n;LA(this._views,r),r.detachFromAppRef()}_loadComponent(n){this.attachView(n.hostView),this.tick(),this.components.push(n);const r=this._injector.get(OA,[]);[...this._bootstrapListeners,...r].forEach(i=>i(n))}ngOnDestroy(){if(!this._destroyed)try{this._destroyListeners.forEach(n=>n()),this._views.slice().forEach(n=>n.destroy())}finally{this._destroyed=!0,this._views=[],this._bootstrapListeners=[],this._destroyListeners=[]}}onDestroy(n){return this._destroyListeners.push(n),()=>LA(this._destroyListeners,n)}destroy(){if(this._destroyed)throw new It(406,!1);const n=this._injector;n.destroy&&!n.destroyed&&n.destroy()}get viewCount(){return this._views.length}warnIfDestroyed(){}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function LA(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}function Vwe(e,t,n){!t&&!TN(e)||function zwe(e,t,n){let r;n?(r=0,e[bn]|=1024):r=64&e[bn]?0:1,nA(e,t,r)}(e,n,t)}function TN(e){return QM(e)}class Gwe{constructor(t,n){this.ngModuleFactory=t,this.componentFactories=n}}let SY=(()=>{class e{compileModuleSync(n){return new Bk(n)}compileModuleAsync(n){return Promise.resolve(this.compileModuleSync(n))}compileModuleAndAllComponentsSync(n){const r=this.compileModuleSync(n),o=Qc(sa(n).declarations).reduce((s,a)=>{const c=dr(a);return c&&s.push(new J_(c)),s},[]);return new Gwe(r,o)}compileModuleAndAllComponentsAsync(n){return Promise.resolve(this.compileModuleAndAllComponentsSync(n))}clearCache(){}clearCacheFor(n){}getModuleId(n){}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})(),qwe=(()=>{class e{constructor(){this.zone=bt(Qr),this.applicationRef=bt(Oh)}initialize(){this._onMicrotaskEmptySubscription||(this._onMicrotaskEmptySubscription=this.zone.onMicrotaskEmpty.subscribe({next:()=>{this.zone.run(()=>{this.applicationRef.tick()})}}))}ngOnDestroy(){this._onMicrotaskEmptySubscription?.unsubscribe()}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function wY(e){return[{provide:Qr,useFactory:e},{provide:og,multi:!0,useFactory:()=>{const t=bt(qwe,{optional:!0});return()=>t.initialize()}},{provide:og,multi:!0,useFactory:()=>{const t=bt(Ywe);return()=>{t.initialize()}}},{provide:X9,useFactory:Wwe}]}function Wwe(){const e=bt(Qr),t=bt(Ld);return n=>e.runOutsideAngular(()=>t.handleError(n))}function $we(e){return Iy([[],wY(()=>new Qr(function AY(e){return{enableLongStackTrace:!1,shouldCoalesceEventChangeDetection:e?.eventCoalescing??!1,shouldCoalesceRunChangeDetection:e?.runCoalescing??!1}}(e)))])}let Ywe=(()=>{class e{constructor(){this.subscription=new Fa,this.initialized=!1,this.zone=bt(Qr),this.pendingTasks=bt(kh)}initialize(){if(this.initialized)return;this.initialized=!0;let n=null;!this.zone.isStable&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(n=this.pendingTasks.add()),this.zone.runOutsideAngular(()=>{this.subscription.add(this.zone.onStable.subscribe(()=>{Qr.assertNotInAngularZone(),queueMicrotask(()=>{null!==n&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(this.pendingTasks.remove(n),n=null)})}))}),this.subscription.add(this.zone.onUnstable.subscribe(()=>{Qr.assertInAngularZone(),n??=this.pendingTasks.add()}))}ngOnDestroy(){this.subscription.unsubscribe()}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();const Zf=new Yt("",{providedIn:"root",factory:()=>bt(Zf,yr.Optional|yr.SkipSelf)||function Xwe(){return typeof $localize<"u"&&$localize.locale||mb}()}),DN=new Yt("");let Lh=null;let VA=(()=>{class e{static#e=this.__NG_ELEMENT_ID__=tAe}return e})();function tAe(e){return function nAe(e,t,n){if(cg(e)&&!n){const r=Zc(e.index,t);return new q_(r,r)}return 47&e.type?new q_(t[go],t):null}(hi(),it(),!(16&~e))}function DAe(e){try{const{rootComponent:t,appProviders:n,platformProviders:r}=e,i=function eAe(e=[]){if(Lh)return Lh;const t=function DY(e=[],t){return Sc.create({name:t,providers:[{provide:LM,useValue:"platform"},{provide:DN,useValue:new Set([()=>Lh=null])},...e]})}(e);return Lh=t,function vY(){!function f0e(e){pG=e}(()=>{throw new It(600,!1)})}(),function EY(e){e.get(yj,null)?.forEach(n=>n())}(t),t}(r),o=[$we(),...n||[]],a=new kq({providers:o,parent:i,debugName:"",runEnvironmentInitializers:!1}).injector,c=a.get(Qr);return c.run(()=>{a.resolveInjectorInitializers();const u=a.get(Ld,null);let l;c.runOutsideAngular(()=>{l=c.onError.subscribe({next:p=>{u.handleError(p)}})});const d=()=>a.destroy(),f=i.get(DN);return f.add(d),a.onDestroy(()=>{l.unsubscribe(),f.delete(d)}),function _Y(e,t,n){try{const r=n();return BA(r)?r.catch(i=>{throw t.runOutsideAngular(()=>e.handleError(i)),i}):r}catch(r){throw t.runOutsideAngular(()=>e.handleError(r)),r}}(u,c,()=>{const p=a.get(IN);return p.runInitializers(),p.donePromise.then(()=>{!function VW(e){"string"==typeof e&&(UW=e.toLowerCase().replace(/_/g,"-"))}(a.get(Zf,mb)||mb);const h=a.get(Oh);return void 0!==t&&h.bootstrap(t),h})})})}catch(t){return Promise.reject(t)}}function ON(e){return"boolean"==typeof e?e:null!=e&&"false"!==e}function aX(e){const t=sr(null);try{return e()}finally{sr(t)}}let cX=null;function vb(){return cX}class ZAe{}const tu=new Yt("");let LN=(()=>{class e{historyGo(n){throw new Error("")}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:()=>bt(JAe),providedIn:"platform"})}return e})();const QAe=new Yt("");let JAe=(()=>{class e extends LN{constructor(){super(),this._doc=bt(tu),this._location=window.location,this._history=window.history}getBaseHrefFromDOM(){return vb().getBaseHref(this._doc)}onPopState(n){const r=vb().getGlobalEventTarget(this._doc,"window");return r.addEventListener("popstate",n,!1),()=>r.removeEventListener("popstate",n)}onHashChange(n){const r=vb().getGlobalEventTarget(this._doc,"window");return r.addEventListener("hashchange",n,!1),()=>r.removeEventListener("hashchange",n)}get href(){return this._location.href}get protocol(){return this._location.protocol}get hostname(){return this._location.hostname}get port(){return this._location.port}get pathname(){return this._location.pathname}get search(){return this._location.search}get hash(){return this._location.hash}set pathname(n){this._location.pathname=n}pushState(n,r,i){this._history.pushState(n,r,i)}replaceState(n,r,i){this._history.replaceState(n,r,i)}forward(){this._history.forward()}back(){this._history.back()}historyGo(n=0){this._history.go(n)}getState(){return this._history.state}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:()=>new e,providedIn:"platform"})}return e})();function UN(e,t){if(0==e.length)return t;if(0==t.length)return e;let n=0;return e.endsWith("/")&&n++,t.startsWith("/")&&n++,2==n?e+t.substring(1):1==n?e+t:e+"/"+t}function uX(e){const t=e.match(/#|\?|$/),n=t&&t.index||e.length;return e.slice(0,n-("/"===e[n-1]?1:0))+e.slice(n)}function Qf(e){return e&&"?"!==e[0]?"?"+e:e}let _g=(()=>{class e{historyGo(n){throw new Error("")}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:()=>bt(dX),providedIn:"root"})}return e})();const lX=new Yt("");let dX=(()=>{class e extends _g{constructor(n,r){super(),this._platformLocation=n,this._removeListenerFns=[],this._baseHref=r??this._platformLocation.getBaseHrefFromDOM()??bt(tu).location?.origin??""}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(n){this._removeListenerFns.push(this._platformLocation.onPopState(n),this._platformLocation.onHashChange(n))}getBaseHref(){return this._baseHref}prepareExternalUrl(n){return UN(this._baseHref,n)}path(n=!1){const r=this._platformLocation.pathname+Qf(this._platformLocation.search),i=this._platformLocation.hash;return i&&n?`${r}${i}`:r}pushState(n,r,i,o){const s=this.prepareExternalUrl(i+Qf(o));this._platformLocation.pushState(n,r,s)}replaceState(n,r,i,o){const s=this.prepareExternalUrl(i+Qf(o));this._platformLocation.replaceState(n,r,s)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}getState(){return this._platformLocation.getState()}historyGo(n=0){this._platformLocation.historyGo?.(n)}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(LN),Zt(lX,8))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})(),eIe=(()=>{class e extends _g{constructor(n,r){super(),this._platformLocation=n,this._baseHref="",this._removeListenerFns=[],null!=r&&(this._baseHref=r)}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(n){this._removeListenerFns.push(this._platformLocation.onPopState(n),this._platformLocation.onHashChange(n))}getBaseHref(){return this._baseHref}path(n=!1){const r=this._platformLocation.hash??"#";return r.length>0?r.substring(1):r}prepareExternalUrl(n){const r=UN(this._baseHref,n);return r.length>0?"#"+r:r}pushState(n,r,i,o){let s=this.prepareExternalUrl(i+Qf(o));0==s.length&&(s=this._platformLocation.pathname),this._platformLocation.pushState(n,r,s)}replaceState(n,r,i,o){let s=this.prepareExternalUrl(i+Qf(o));0==s.length&&(s=this._platformLocation.pathname),this._platformLocation.replaceState(n,r,s)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}getState(){return this._platformLocation.getState()}historyGo(n=0){this._platformLocation.historyGo?.(n)}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(LN),Zt(lX,8))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac})}return e})(),_b=(()=>{class e{constructor(n){this._subject=new Ua,this._urlChangeListeners=[],this._urlChangeSubscription=null,this._locationStrategy=n;const r=this._locationStrategy.getBaseHref();this._basePath=function rIe(e){if(new RegExp("^(https?:)?//").test(e)){const[,n]=e.split(/\/\/[^\/]+/);return n}return e}(uX(fX(r))),this._locationStrategy.onPopState(i=>{this._subject.emit({url:this.path(!0),pop:!0,state:i.state,type:i.type})})}ngOnDestroy(){this._urlChangeSubscription?.unsubscribe(),this._urlChangeListeners=[]}path(n=!1){return this.normalize(this._locationStrategy.path(n))}getState(){return this._locationStrategy.getState()}isCurrentPathEqualTo(n,r=""){return this.path()==this.normalize(n+Qf(r))}normalize(n){return e.stripTrailingSlash(function nIe(e,t){if(!e||!t.startsWith(e))return t;const n=t.substring(e.length);return""===n||["/",";","?","#"].includes(n[0])?n:t}(this._basePath,fX(n)))}prepareExternalUrl(n){return n&&"/"!==n[0]&&(n="/"+n),this._locationStrategy.prepareExternalUrl(n)}go(n,r="",i=null){this._locationStrategy.pushState(i,"",n,r),this._notifyUrlChangeListeners(this.prepareExternalUrl(n+Qf(r)),i)}replaceState(n,r="",i=null){this._locationStrategy.replaceState(i,"",n,r),this._notifyUrlChangeListeners(this.prepareExternalUrl(n+Qf(r)),i)}forward(){this._locationStrategy.forward()}back(){this._locationStrategy.back()}historyGo(n=0){this._locationStrategy.historyGo?.(n)}onUrlChange(n){return this._urlChangeListeners.push(n),this._urlChangeSubscription??=this.subscribe(r=>{this._notifyUrlChangeListeners(r.url,r.state)}),()=>{const r=this._urlChangeListeners.indexOf(n);this._urlChangeListeners.splice(r,1),0===this._urlChangeListeners.length&&(this._urlChangeSubscription?.unsubscribe(),this._urlChangeSubscription=null)}}_notifyUrlChangeListeners(n="",r){this._urlChangeListeners.forEach(i=>i(n,r))}subscribe(n,r,i){return this._subject.subscribe({next:n,error:r,complete:i})}static#e=this.normalizeQueryParams=Qf;static#t=this.joinWithSlash=UN;static#n=this.stripTrailingSlash=uX;static#r=this.\u0275fac=function(r){return new(r||e)(Zt(_g))};static#i=this.\u0275prov=Gt({token:e,factory:()=>function tIe(){return new _b(Zt(_g))}(),providedIn:"root"})}return e})();function fX(e){return e.replace(/\/index.html$/,"")}function xX(e,t){t=encodeURIComponent(t);for(const n of e.split(";")){const r=n.indexOf("="),[i,o]=-1==r?[n,""]:[n.slice(0,r),n.slice(r+1)];if(i.trim()===t)return decodeURIComponent(o)}return null}class KIe{createSubscription(t,n){return aX(()=>t.subscribe({next:n,error:r=>{throw r}}))}dispose(t){aX(()=>t.unsubscribe())}}class ZIe{createSubscription(t,n){return t.then(n,r=>{throw r})}dispose(t){}}const QIe=new ZIe,JIe=new KIe;let Cx=(()=>{class e{constructor(n){this._latestValue=null,this.markForCheckOnValueUpdate=!0,this._subscription=null,this._obj=null,this._strategy=null,this._ref=n}ngOnDestroy(){this._subscription&&this._dispose(),this._ref=null}transform(n){if(!this._obj){if(n)try{this.markForCheckOnValueUpdate=!1,this._subscribe(n)}finally{this.markForCheckOnValueUpdate=!0}return this._latestValue}return n!==this._obj?(this._dispose(),this.transform(n)):this._latestValue}_subscribe(n){this._obj=n,this._strategy=this._selectStrategy(n),this._subscription=this._strategy.createSubscription(n,r=>this._updateLatestValue(n,r))}_selectStrategy(n){if(BA(n))return QIe;if(bY(n))return JIe;throw function Wl(e,t){return new It(2100,!1)}()}_dispose(){this._strategy.dispose(this._subscription),this._latestValue=null,this._subscription=null,this._obj=null}_updateLatestValue(n,r){n===this._obj&&(this._latestValue=r,this.markForCheckOnValueUpdate&&this._ref?.markForCheck())}static#e=this.\u0275fac=function(r){return new(r||e)(cn(VA,16))};static#t=this.\u0275pipe=_c({name:"async",type:e,pure:!1,standalone:!0})}return e})(),sI=(()=>{class e{transform(n){return JSON.stringify(n,null,2)}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275pipe=_c({name:"json",type:e,pure:!1,standalone:!0})}return e})(),Uh=(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275mod=p_({type:e});static#n=this.\u0275inj=Sy({})}return e})();const DX="browser";function EX(e){return"server"===e}let _Te=(()=>{class e{static#e=this.\u0275prov=Gt({token:e,providedIn:"root",factory:()=>function vTe(e){return e===DX}(bt(Th))?new xTe(bt(tu),window):new CTe})}return e})();class xTe{constructor(t,n){this.document=t,this.window=n,this.offset=()=>[0,0]}setOffset(t){this.offset=Array.isArray(t)?()=>t:t}getScrollPosition(){return[this.window.scrollX,this.window.scrollY]}scrollToPosition(t){this.window.scrollTo(t[0],t[1])}scrollToAnchor(t){const n=function STe(e,t){const n=e.getElementById(t)||e.getElementsByName(t)[0];if(n)return n;if("function"==typeof e.createTreeWalker&&e.body&&"function"==typeof e.body.attachShadow){const r=e.createTreeWalker(e.body,NodeFilter.SHOW_ELEMENT);let i=r.currentNode;for(;i;){const o=i.shadowRoot;if(o){const s=o.getElementById(t)||o.querySelector(`[name="${t}"]`);if(s)return s}i=r.nextNode()}}return null}(this.document,t);n&&(this.scrollToElement(n),n.focus())}setHistoryScrollRestoration(t){this.window.history.scrollRestoration=t}scrollToElement(t){const n=t.getBoundingClientRect(),r=n.left+this.window.pageXOffset,i=n.top+this.window.pageYOffset,o=this.offset();this.window.scrollTo(r-o[0],i-o[1])}}class CTe{setOffset(t){}getScrollPosition(){return[0,0]}scrollToPosition(t){}scrollToAnchor(t){}setHistoryScrollRestoration(t){}}class PX{}class ZTe extends ZAe{constructor(){super(...arguments),this.supportsDOMEvents=!0}}class tF extends ZTe{static makeCurrent(){!function KAe(e){cX??=e}(new tF)}onAndCancel(t,n,r){return t.addEventListener(n,r),()=>{t.removeEventListener(n,r)}}dispatchEvent(t,n){t.dispatchEvent(n)}remove(t){t.parentNode&&t.parentNode.removeChild(t)}createElement(t,n){return(n=n||this.getDefaultDocument()).createElement(t)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(t){return t.nodeType===Node.ELEMENT_NODE}isShadowRoot(t){return t instanceof DocumentFragment}getGlobalEventTarget(t,n){return"window"===n?window:"document"===n?t:"body"===n?t.body:null}getBaseHref(t){const n=function QTe(){return Ix=Ix||document.querySelector("base"),Ix?Ix.getAttribute("href"):null}();return null==n?null:function JTe(e){return new URL(e,document.baseURI).pathname}(n)}resetBaseElement(){Ix=null}getUserAgent(){return window.navigator.userAgent}getCookie(t){return xX(document.cookie,t)}}let Ix=null,tDe=(()=>{class e{build(){return new XMLHttpRequest}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac})}return e})();const nF=new Yt("");let UX=(()=>{class e{constructor(n,r){this._zone=r,this._eventNameToPlugin=new Map,n.forEach(i=>{i.manager=this}),this._plugins=n.slice().reverse()}addEventListener(n,r,i){return this._findPluginFor(r).addEventListener(n,r,i)}getZone(){return this._zone}_findPluginFor(n){let r=this._eventNameToPlugin.get(n);if(r)return r;if(r=this._plugins.find(o=>o.supports(n)),!r)throw new It(5101,!1);return this._eventNameToPlugin.set(n,r),r}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(nF),Zt(Qr))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac})}return e})();class VX{constructor(t){this._doc=t}}const rF="ng-app-id";let zX=(()=>{class e{constructor(n,r,i,o={}){this.doc=n,this.appId=r,this.nonce=i,this.platformId=o,this.styleRef=new Map,this.hostNodes=new Set,this.styleNodesInDOM=this.collectServerRenderedStyles(),this.platformIsServer=EX(o),this.resetHostNodes()}addStyles(n){for(const r of n)1===this.changeUsageCount(r,1)&&this.onStyleAdded(r)}removeStyles(n){for(const r of n)this.changeUsageCount(r,-1)<=0&&this.onStyleRemoved(r)}ngOnDestroy(){const n=this.styleNodesInDOM;n&&(n.forEach(r=>r.remove()),n.clear());for(const r of this.getAllStyles())this.onStyleRemoved(r);this.resetHostNodes()}addHost(n){this.hostNodes.add(n);for(const r of this.getAllStyles())this.addStyleToHost(n,r)}removeHost(n){this.hostNodes.delete(n)}getAllStyles(){return this.styleRef.keys()}onStyleAdded(n){for(const r of this.hostNodes)this.addStyleToHost(r,n)}onStyleRemoved(n){const r=this.styleRef;r.get(n)?.elements?.forEach(i=>i.remove()),r.delete(n)}collectServerRenderedStyles(){const n=this.doc.head?.querySelectorAll(`style[${rF}="${this.appId}"]`);if(n?.length){const r=new Map;return n.forEach(i=>{null!=i.textContent&&r.set(i.textContent,i)}),r}return null}changeUsageCount(n,r){const i=this.styleRef;if(i.has(n)){const o=i.get(n);return o.usage+=r,o.usage}return i.set(n,{usage:r,elements:[]}),r}getStyleElement(n,r){const i=this.styleNodesInDOM,o=i?.get(r);if(o?.parentNode===n)return i.delete(r),o.removeAttribute(rF),o;{const s=this.doc.createElement("style");return this.nonce&&s.setAttribute("nonce",this.nonce),s.textContent=r,this.platformIsServer&&s.setAttribute(rF,this.appId),n.appendChild(s),s}}addStyleToHost(n,r){const i=this.getStyleElement(n,r),o=this.styleRef,s=o.get(r)?.elements;s?s.push(i):o.set(r,{elements:[i],usage:1})}resetHostNodes(){const n=this.hostNodes;n.clear(),n.add(this.doc.head)}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(tu),Zt(wR),Zt(bj,8),Zt(Th))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac})}return e})();const iF={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",math:"http://www.w3.org/1998/MathML/"},oF=/%COMP%/g,oDe=new Yt("",{providedIn:"root",factory:()=>!0});function jX(e,t){return t.map(n=>n.replace(oF,e))}let HX=(()=>{class e{constructor(n,r,i,o,s,a,c,u=null){this.eventManager=n,this.sharedStylesHost=r,this.appId=i,this.removeStylesOnCompDestroy=o,this.doc=s,this.platformId=a,this.ngZone=c,this.nonce=u,this.rendererByCompId=new Map,this.platformIsServer=EX(a),this.defaultRenderer=new sF(n,s,c,this.platformIsServer)}createRenderer(n,r){if(!n||!r)return this.defaultRenderer;this.platformIsServer&&r.encapsulation===Fl.ShadowDom&&(r={...r,encapsulation:Fl.Emulated});const i=this.getOrCreateRenderer(n,r);return i instanceof WX?i.applyToHost(n):i instanceof aF&&i.applyStyles(),i}getOrCreateRenderer(n,r){const i=this.rendererByCompId;let o=i.get(r.id);if(!o){const s=this.doc,a=this.ngZone,c=this.eventManager,u=this.sharedStylesHost,l=this.removeStylesOnCompDestroy,d=this.platformIsServer;switch(r.encapsulation){case Fl.Emulated:o=new WX(c,u,r,this.appId,l,s,a,d);break;case Fl.ShadowDom:return new uDe(c,u,n,r,s,a,this.nonce,d);default:o=new aF(c,u,r,l,s,a,d)}i.set(r.id,o)}return o}ngOnDestroy(){this.rendererByCompId.clear()}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(UX),Zt(zX),Zt(wR),Zt(oDe),Zt(tu),Zt(Th),Zt(Qr),Zt(bj))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac})}return e})();class sF{constructor(t,n,r,i){this.eventManager=t,this.doc=n,this.ngZone=r,this.platformIsServer=i,this.data=Object.create(null),this.throwOnSyntheticProps=!0,this.destroyNode=null}destroy(){}createElement(t,n){return n?this.doc.createElementNS(iF[n]||n,t):this.doc.createElement(t)}createComment(t){return this.doc.createComment(t)}createText(t){return this.doc.createTextNode(t)}appendChild(t,n){(qX(t)?t.content:t).appendChild(n)}insertBefore(t,n,r){t&&(qX(t)?t.content:t).insertBefore(n,r)}removeChild(t,n){t&&t.removeChild(n)}selectRootElement(t,n){let r="string"==typeof t?this.doc.querySelector(t):t;if(!r)throw new It(-5104,!1);return n||(r.textContent=""),r}parentNode(t){return t.parentNode}nextSibling(t){return t.nextSibling}setAttribute(t,n,r,i){if(i){n=i+":"+n;const o=iF[i];o?t.setAttributeNS(o,n,r):t.setAttribute(n,r)}else t.setAttribute(n,r)}removeAttribute(t,n,r){if(r){const i=iF[r];i?t.removeAttributeNS(i,n):t.removeAttribute(`${r}:${n}`)}else t.removeAttribute(n)}addClass(t,n){t.classList.add(n)}removeClass(t,n){t.classList.remove(n)}setStyle(t,n,r,i){i&(Ph.DashCase|Ph.Important)?t.style.setProperty(n,r,i&Ph.Important?"important":""):t.style[n]=r}removeStyle(t,n,r){r&Ph.DashCase?t.style.removeProperty(n):t.style[n]=""}setProperty(t,n,r){null!=t&&(t[n]=r)}setValue(t,n){t.nodeValue=n}listen(t,n,r){if("string"==typeof t&&!(t=vb().getGlobalEventTarget(this.doc,t)))throw new Error(`Unsupported event target ${t} for event ${n}`);return this.eventManager.addEventListener(t,n,this.decoratePreventDefault(r))}decoratePreventDefault(t){return n=>{if("__ngUnwrap__"===n)return t;!1===(this.platformIsServer?this.ngZone.runGuarded(()=>t(n)):t(n))&&n.preventDefault()}}}function qX(e){return"TEMPLATE"===e.tagName&&void 0!==e.content}class uDe extends sF{constructor(t,n,r,i,o,s,a,c){super(t,o,s,c),this.sharedStylesHost=n,this.hostEl=r,this.shadowRoot=r.attachShadow({mode:"open"}),this.sharedStylesHost.addHost(this.shadowRoot);const u=jX(i.id,i.styles);for(const l of u){const d=document.createElement("style");a&&d.setAttribute("nonce",a),d.textContent=l,this.shadowRoot.appendChild(d)}}nodeOrShadowRoot(t){return t===this.hostEl?this.shadowRoot:t}appendChild(t,n){return super.appendChild(this.nodeOrShadowRoot(t),n)}insertBefore(t,n,r){return super.insertBefore(this.nodeOrShadowRoot(t),n,r)}removeChild(t,n){return super.removeChild(this.nodeOrShadowRoot(t),n)}parentNode(t){return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(t)))}destroy(){this.sharedStylesHost.removeHost(this.shadowRoot)}}class aF extends sF{constructor(t,n,r,i,o,s,a,c){super(t,o,s,a),this.sharedStylesHost=n,this.removeStylesOnCompDestroy=i,this.styles=c?jX(c,r.styles):r.styles}applyStyles(){this.sharedStylesHost.addStyles(this.styles)}destroy(){this.removeStylesOnCompDestroy&&this.sharedStylesHost.removeStyles(this.styles)}}class WX extends aF{constructor(t,n,r,i,o,s,a,c){const u=i+"-"+r.id;super(t,n,r,o,s,a,c,u),this.contentAttr=function sDe(e){return"_ngcontent-%COMP%".replace(oF,e)}(u),this.hostAttr=function aDe(e){return"_nghost-%COMP%".replace(oF,e)}(u)}applyToHost(t){this.applyStyles(),this.setAttribute(t,this.hostAttr,"")}createElement(t,n){const r=super.createElement(t,n);return super.setAttribute(r,this.contentAttr,""),r}}let lDe=(()=>{class e extends VX{constructor(n){super(n)}supports(n){return!0}addEventListener(n,r,i){return n.addEventListener(r,i,!1),()=>this.removeEventListener(n,r,i)}removeEventListener(n,r,i){return n.removeEventListener(r,i)}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(tu))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac})}return e})();const $X=["alt","control","meta","shift"],dDe={"\b":"Backspace","\t":"Tab","\x7f":"Delete","\x1b":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},fDe={alt:e=>e.altKey,control:e=>e.ctrlKey,meta:e=>e.metaKey,shift:e=>e.shiftKey};let pDe=(()=>{class e extends VX{constructor(n){super(n)}supports(n){return null!=e.parseEventName(n)}addEventListener(n,r,i){const o=e.parseEventName(r),s=e.eventCallback(o.fullKey,i,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>vb().onAndCancel(n,o.domEventName,s))}static parseEventName(n){const r=n.toLowerCase().split("."),i=r.shift();if(0===r.length||"keydown"!==i&&"keyup"!==i)return null;const o=e._normalizeKey(r.pop());let s="",a=r.indexOf("code");if(a>-1&&(r.splice(a,1),s="code."),$X.forEach(u=>{const l=r.indexOf(u);l>-1&&(r.splice(l,1),s+=u+".")}),s+=o,0!=r.length||0===o.length)return null;const c={};return c.domEventName=i,c.fullKey=s,c}static matchEventFullKeyCode(n,r){let i=dDe[n.key]||n.key,o="";return r.indexOf("code.")>-1&&(i=n.code,o="code."),!(null==i||!i)&&(i=i.toLowerCase()," "===i?i="space":"."===i&&(i="dot"),$X.forEach(s=>{s!==i&&(0,fDe[s])(n)&&(o+=s+".")}),o+=i,o===r)}static eventCallback(n,r,i){return o=>{e.matchEventFullKeyCode(o,n)&&i.runGuarded(()=>r(o))}}static _normalizeKey(n){return"esc"===n?"escape":n}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(tu))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac})}return e})();function YX(e){return{appProviders:[..._De,...e?.providers??[]],platformProviders:bDe}}const bDe=[{provide:Th,useValue:DX},{provide:yj,useValue:function mDe(){tF.makeCurrent()},multi:!0},{provide:tu,useFactory:function yDe(){return function ive(e){CR=e}(document),document},deps:[]}],_De=[{provide:LM,useValue:"root"},{provide:Ld,useFactory:function gDe(){return new Ld},deps:[]},{provide:nF,useClass:lDe,multi:!0,deps:[tu,Qr,Th]},{provide:nF,useClass:pDe,multi:!0,deps:[tu]},HX,zX,UX,{provide:VH,useExisting:HX},{provide:PX,useClass:tDe,deps:[]},[]];let xDe=(()=>{class e{constructor(n){this._doc=n}getTitle(){return this._doc.title}setTitle(n){this._doc.title=n||""}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(tu))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function Vh(e){return this instanceof Vh?(this.v=e,this):new Vh(e)}function tK(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,t=e[Symbol.asyncIterator];return t?t.call(e):(e=function dF(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(a,c){!function i(o,s,a,c){Promise.resolve(c).then(function(u){o({value:u,done:a})},s)}(a,c,(s=e[o](s)).done,s.value)})}}}"function"==typeof SuppressedError&&SuppressedError;const nK=e=>e&&"number"==typeof e.length&&"function"!=typeof e;function rK(e){return Wi(e?.then)}function iK(e){return Wi(e[hM])}function oK(e){return Symbol.asyncIterator&&Wi(e?.[Symbol.asyncIterator])}function sK(e){return new TypeError(`You provided ${null!==e&&"object"==typeof e?"an invalid object":`'${e}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}const aK=function $De(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}();function cK(e){return Wi(e?.[aK])}function uK(e){return function eK(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(f){r[f]&&(i[f]=function(p){return new Promise(function(m,h){o.push([f,p,m,h])>1||a(f,p)})})}function a(f,p){try{!function c(f){f.value instanceof Vh?Promise.resolve(f.value.v).then(u,l):d(o[0][2],f)}(r[f](p))}catch(m){d(o[0][3],m)}}function u(f){a("next",f)}function l(f){a("throw",f)}function d(f,p){f(p),o.shift(),o.length&&a(o[0][0],o[0][1])}}(this,arguments,function*(){const n=e.getReader();try{for(;;){const{value:r,done:i}=yield Vh(n.read());if(i)return yield Vh(void 0);yield yield Vh(r)}}finally{n.releaseLock()}})}function lK(e){return Wi(e?.getReader)}function ru(e){if(e instanceof ns)return e;if(null!=e){if(iK(e))return function YDe(e){return new ns(t=>{const n=e[hM]();if(Wi(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}(e);if(nK(e))return function XDe(e){return new ns(t=>{for(let n=0;n{e.then(n=>{t.closed||(t.next(n),t.complete())},n=>t.error(n)).then(null,vG)})}(e);if(oK(e))return dK(e);if(cK(e))return function ZDe(e){return new ns(t=>{for(const n of e)if(t.next(n),t.closed)return;t.complete()})}(e);if(lK(e))return function QDe(e){return dK(uK(e))}(e)}throw sK(e)}function dK(e){return new ns(t=>{(function JDe(e,t){var n,r,i,o;return function QX(e,t,n,r){return new(n||(n=Promise))(function(o,s){function a(l){try{u(r.next(l))}catch(d){s(d)}}function c(l){try{u(r.throw(l))}catch(d){s(d)}}function u(l){l.done?o(l.value):function i(o){return o instanceof n?o:new n(function(s){s(o)})}(l.value).then(a,c)}u((r=r.apply(e,t||[])).next())})}(this,void 0,void 0,function*(){try{for(n=tK(e);!(r=yield n.next()).done;)if(t.next(r.value),t.closed)return}catch(s){i={error:s}}finally{try{r&&!r.done&&(o=n.return)&&(yield o.call(n))}finally{if(i)throw i.error}}t.complete()})})(e,t).catch(n=>t.error(n))})}function tp(e,t,n,r=0,i=!1){const o=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(o),!i)return o}function fK(e,t=0){return mo((n,r)=>{n.subscribe(Io(r,i=>tp(r,e,()=>r.next(i),t),()=>tp(r,e,()=>r.complete(),t),i=>tp(r,e,()=>r.error(i),t)))})}function pK(e,t=0){return mo((n,r)=>{r.add(e.schedule(()=>n.subscribe(r),t))})}function hK(e,t){if(!e)throw new Error("Iterable cannot be null");return new ns(n=>{tp(n,t,()=>{const r=e[Symbol.asyncIterator]();tp(n,t,()=>{r.next().then(i=>{i.done?n.complete():n.next(i.value)})},0,!0)})})}function $i(e,t){return t?function oEe(e,t){if(null!=e){if(iK(e))return function eEe(e,t){return ru(e).pipe(pK(t),fK(t))}(e,t);if(nK(e))return function nEe(e,t){return new ns(n=>{let r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}(e,t);if(rK(e))return function tEe(e,t){return ru(e).pipe(pK(t),fK(t))}(e,t);if(oK(e))return hK(e,t);if(cK(e))return function rEe(e,t){return new ns(n=>{let r;return tp(n,t,()=>{r=e[aK](),tp(n,t,()=>{let i,o;try{({value:i,done:o}=r.next())}catch(s){return void n.error(s)}o?n.complete():n.next(i)},0,!0)}),()=>Wi(r?.return)&&r.return()})}(e,t);if(lK(e))return function iEe(e,t){return hK(uK(e),t)}(e,t)}throw sK(e)}(e,t):ru(e)}function mK(e){return e&&Wi(e.schedule)}function fF(e){return e[e.length-1]}function gK(e){return Wi(fF(e))?e.pop():void 0}function Sb(e){return mK(fF(e))?e.pop():void 0}function yK(e,t){return"number"==typeof fF(e)?e.pop():t}function Pn(...e){return $i(e,Sb(e))}const{isArray:sEe}=Array,{getPrototypeOf:aEe,prototype:cEe,keys:uEe}=Object;const{isArray:fEe}=Array;function bK(e){return qt(t=>function pEe(e,t){return fEe(t)?e(...t):e(t)}(e,t))}function uI(...e){const t=Sb(e),n=gK(e),{args:r,keys:i}=function lEe(e){if(1===e.length){const t=e[0];if(sEe(t))return{args:t,keys:null};if(function dEe(e){return e&&"object"==typeof e&&aEe(e)===cEe}(t)){const n=uEe(t);return{args:n.map(r=>t[r]),keys:n}}}return{args:e,keys:null}}(e);if(0===r.length)return $i([],t);const o=new ns(vK(r,t,i?s=>function hEe(e,t){return e.reduce((n,r,i)=>(n[r]=t[i],n),{})}(i,s):vh));return n?o.pipe(bK(n)):o}function vK(e,t,n=vh){return r=>{_K(t,()=>{const{length:i}=e,o=new Array(i);let s=i,a=i;for(let c=0;c{const u=$i(e[c],t);let l=!1;u.subscribe(Io(r,d=>{o[c]=d,l||(l=!0,a--),a||r.next(n(o.slice()))},()=>{--s||r.complete()}))},r)},r)}}function _K(e,t,n){e?tp(n,e,t):t()}const lI=aM(e=>function(){e(this),this.name="EmptyError",this.message="no elements in sequence"});function fa(e,t,n=1/0){return Wi(t)?fa((r,i)=>qt((o,s)=>t(r,o,i,s))(ru(e(r,i))),n):("number"==typeof t&&(n=t),mo((r,i)=>function mEe(e,t,n,r,i,o,s,a){const c=[];let u=0,l=0,d=!1;const f=()=>{d&&!c.length&&!u&&t.complete()},p=h=>u{o&&t.next(h),u++;let g=!1;ru(n(h,l++)).subscribe(Io(t,y=>{i?.(y),o?p(y):t.next(y)},()=>{g=!0},void 0,()=>{if(g)try{for(u--;c.length&&um(y)):m(y)}f()}catch(y){t.error(y)}}))};return e.subscribe(Io(t,p,()=>{d=!0,f()})),()=>{a?.()}}(r,i,e,n)))}function xg(e=1/0){return fa(vh,e)}function pF(...e){return function gEe(){return xg(1)}()($i(e,Sb(e)))}function xK(e){return new ns(t=>{ru(e()).subscribe(t)})}function dI(e,t){const n=Wi(e)?e:()=>e,r=i=>i.error(n());return new ns(t?i=>t.schedule(r,0,i):r)}const $l=new ns(e=>e.complete());function hF(){return mo((e,t)=>{let n=null;e._refCount++;const r=Io(t,void 0,void 0,void 0,()=>{if(!e||e._refCount<=0||0<--e._refCount)return void(n=null);const i=e._connection,o=n;n=null,i&&(!o||i===o)&&i.unsubscribe(),t.unsubscribe()});e.subscribe(r),r.closed||(n=e.connect())})}class SK extends ns{constructor(t,n){super(),this.source=t,this.subjectFactory=n,this._subject=null,this._refCount=0,this._connection=null,wG(t)&&(this.lift=t.lift)}_subscribe(t){return this.getSubject().subscribe(t)}getSubject(){const t=this._subject;return(!t||t.isStopped)&&(this._subject=this.subjectFactory()),this._subject}_teardown(){this._refCount=0;const{_connection:t}=this;this._subject=this._connection=null,t?.unsubscribe()}connect(){let t=this._connection;if(!t){t=this._connection=new Fa;const n=this.getSubject();t.add(this.source.subscribe(Io(n,void 0,()=>{this._teardown(),n.complete()},r=>{this._teardown(),n.error(r)},()=>this._teardown()))),t.closed&&(this._connection=null,t=Fa.EMPTY)}return t}refCount(){return hF()(this)}}function To(e,t){return mo((n,r)=>{let i=null,o=0,s=!1;const a=()=>s&&!i&&r.complete();n.subscribe(Io(r,c=>{i?.unsubscribe();let u=0;const l=o++;ru(e(c,l)).subscribe(i=Io(r,d=>r.next(t?t(c,d,l,u++):d),()=>{i=null,a()}))},()=>{s=!0,a()}))})}function Sg(e){return e<=0?()=>$l:mo((t,n)=>{let r=0;t.subscribe(Io(n,i=>{++r<=e&&(n.next(i),e<=r&&n.complete())}))})}function Dx(...e){const t=Sb(e);return mo((n,r)=>{(t?pF(e,n,t):pF(e,n)).subscribe(r)})}function Yl(e,t){return mo((n,r)=>{let i=0;n.subscribe(Io(r,o=>e.call(t,o,i++)&&r.next(o)))})}function fI(e){return mo((t,n)=>{let r=!1;t.subscribe(Io(n,i=>{r=!0,n.next(i)},()=>{r||n.next(e),n.complete()}))})}function CK(e=bEe){return mo((t,n)=>{let r=!1;t.subscribe(Io(n,i=>{r=!0,n.next(i)},()=>r?n.complete():n.error(e())))})}function bEe(){return new lI}function Cg(e,t){const n=arguments.length>=2;return r=>r.pipe(e?Yl((i,o)=>e(i,o,r)):vh,Sg(1),n?fI(t):CK(()=>new lI))}function Cb(e,t){return Wi(t)?fa(e,t,1):fa(e,1)}function jr(e,t,n){const r=Wi(e)||t||n?{next:e,error:t,complete:n}:e;return r?mo((i,o)=>{var s;null===(s=r.subscribe)||void 0===s||s.call(r);let a=!0;i.subscribe(Io(o,c=>{var u;null===(u=r.next)||void 0===u||u.call(r,c),o.next(c)},()=>{var c;a=!1,null===(c=r.complete)||void 0===c||c.call(r),o.complete()},c=>{var u;a=!1,null===(u=r.error)||void 0===u||u.call(r,c),o.error(c)},()=>{var c,u;a&&(null===(c=r.unsubscribe)||void 0===c||c.call(r)),null===(u=r.finalize)||void 0===u||u.call(r)}))}):vh}function wb(e){return mo((t,n)=>{let o,r=null,i=!1;r=t.subscribe(Io(n,void 0,void 0,s=>{o=ru(e(s,wb(e)(t))),r?(r.unsubscribe(),r=null,o.subscribe(n)):i=!0})),i&&(r.unsubscribe(),r=null,o.subscribe(n))})}function mF(e){return e<=0?()=>$l:mo((t,n)=>{let r=[];t.subscribe(Io(n,i=>{r.push(i),e{for(const i of r)n.next(i);n.complete()},void 0,()=>{r=null}))})}function Ex(e){return mo((t,n)=>{try{t.subscribe(n)}finally{n.add(e)}})}const rr="primary",Px=Symbol("RouteTitle");class wEe{constructor(t){this.params=t||{}}has(t){return Object.prototype.hasOwnProperty.call(this.params,t)}get(t){if(this.has(t)){const n=this.params[t];return Array.isArray(n)?n[0]:n}return null}getAll(t){if(this.has(t)){const n=this.params[t];return Array.isArray(n)?n:[n]}return[]}get keys(){return Object.keys(this.params)}}function Ab(e){return new wEe(e)}function AEe(e,t,n){const r=n.path.split("/");if(r.length>e.length||"full"===n.pathMatch&&(t.hasChildren()||r.lengthr[o]===i)}return e===t}function AK(e){return e.length>0?e[e.length-1]:null}function zh(e){return function ADe(e){return!!e&&(e instanceof ns||Wi(e.lift)&&Wi(e.subscribe))}(e)?e:BA(e)?$i(Promise.resolve(e)):Pn(e)}const TEe={exact:function DK(e,t,n){if(!wg(e.segments,t.segments)||!pI(e.segments,t.segments,n)||e.numberOfChildren!==t.numberOfChildren)return!1;for(const r in t.children)if(!e.children[r]||!DK(e.children[r],t.children[r],n))return!1;return!0},subset:EK},IK={exact:function DEe(e,t){return Hd(e,t)},subset:function EEe(e,t){return Object.keys(t).length<=Object.keys(e).length&&Object.keys(t).every(n=>wK(e[n],t[n]))},ignored:()=>!0};function TK(e,t,n){return TEe[n.paths](e.root,t.root,n.matrixParams)&&IK[n.queryParams](e.queryParams,t.queryParams)&&!("exact"===n.fragment&&e.fragment!==t.fragment)}function EK(e,t,n){return PK(e,t,t.segments,n)}function PK(e,t,n,r){if(e.segments.length>n.length){const i=e.segments.slice(0,n.length);return!(!wg(i,n)||t.hasChildren()||!pI(i,n,r))}if(e.segments.length===n.length){if(!wg(e.segments,n)||!pI(e.segments,n,r))return!1;for(const i in t.children)if(!e.children[i]||!EK(e.children[i],t.children[i],r))return!1;return!0}{const i=n.slice(0,e.segments.length),o=n.slice(e.segments.length);return!!(wg(e.segments,i)&&pI(e.segments,i,r)&&e.children[rr])&&PK(e.children[rr],t,o,r)}}function pI(e,t,n){return t.every((r,i)=>IK[n](e[i].parameters,r.parameters))}class Ib{constructor(t=new xi([],{}),n={},r=null){this.root=t,this.queryParams=n,this.fragment=r}get queryParamMap(){return this._queryParamMap??=Ab(this.queryParams),this._queryParamMap}toString(){return REe.serialize(this)}}class xi{constructor(t,n){this.segments=t,this.children=n,this.parent=null,Object.values(n).forEach(r=>r.parent=this)}hasChildren(){return this.numberOfChildren>0}get numberOfChildren(){return Object.keys(this.children).length}toString(){return hI(this)}}class Mx{constructor(t,n){this.path=t,this.parameters=n}get parameterMap(){return this._parameterMap??=Ab(this.parameters),this._parameterMap}toString(){return kK(this)}}function wg(e,t){return e.length===t.length&&e.every((n,r)=>n.path===t[r].path)}let Tb=(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:()=>new yF,providedIn:"root"})}return e})();class yF{parse(t){const n=new jEe(t);return new Ib(n.parseRootSegment(),n.parseQueryParams(),n.parseFragment())}serialize(t){const n=`/${Rx(t.root,!0)}`,r=function FEe(e){const t=Object.entries(e).map(([n,r])=>Array.isArray(r)?r.map(i=>`${mI(n)}=${mI(i)}`).join("&"):`${mI(n)}=${mI(r)}`).filter(n=>n);return t.length?`?${t.join("&")}`:""}(t.queryParams);return`${n}${r}${"string"==typeof t.fragment?`#${function kEe(e){return encodeURI(e)}(t.fragment)}`:""}`}}const REe=new yF;function hI(e){return e.segments.map(t=>kK(t)).join("/")}function Rx(e,t){if(!e.hasChildren())return hI(e);if(t){const n=e.children[rr]?Rx(e.children[rr],!1):"",r=[];return Object.entries(e.children).forEach(([i,o])=>{i!==rr&&r.push(`${i}:${Rx(o,!1)}`)}),r.length>0?`${n}(${r.join("//")})`:n}{const n=function MEe(e,t){let n=[];return Object.entries(e.children).forEach(([r,i])=>{r===rr&&(n=n.concat(t(i,r)))}),Object.entries(e.children).forEach(([r,i])=>{r!==rr&&(n=n.concat(t(i,r)))}),n}(e,(r,i)=>i===rr?[Rx(e.children[rr],!1)]:[`${i}:${Rx(r,!1)}`]);return 1===Object.keys(e.children).length&&null!=e.children[rr]?`${hI(e)}/${n[0]}`:`${hI(e)}/(${n.join("//")})`}}function MK(e){return encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",")}function mI(e){return MK(e).replace(/%3B/gi,";")}function bF(e){return MK(e).replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/%26/gi,"&")}function gI(e){return decodeURIComponent(e)}function RK(e){return gI(e.replace(/\+/g,"%20"))}function kK(e){return`${bF(e.path)}${function NEe(e){return Object.entries(e).map(([t,n])=>`;${bF(t)}=${bF(n)}`).join("")}(e.parameters)}`}const BEe=/^[^\/()?;#]+/;function vF(e){const t=e.match(BEe);return t?t[0]:""}const OEe=/^[^\/()?;=#]+/,UEe=/^[^=?&#]+/,zEe=/^[^&#]+/;class jEe{constructor(t){this.url=t,this.remaining=t}parseRootSegment(){return this.consumeOptional("/"),""===this.remaining||this.peekStartsWith("?")||this.peekStartsWith("#")?new xi([],{}):new xi([],this.parseChildren())}parseQueryParams(){const t={};if(this.consumeOptional("?"))do{this.parseQueryParam(t)}while(this.consumeOptional("&"));return t}parseFragment(){return this.consumeOptional("#")?decodeURIComponent(this.remaining):null}parseChildren(){if(""===this.remaining)return{};this.consumeOptional("/");const t=[];for(this.peekStartsWith("(")||t.push(this.parseSegment());this.peekStartsWith("/")&&!this.peekStartsWith("//")&&!this.peekStartsWith("/(");)this.capture("/"),t.push(this.parseSegment());let n={};this.peekStartsWith("/(")&&(this.capture("/"),n=this.parseParens(!0));let r={};return this.peekStartsWith("(")&&(r=this.parseParens(!1)),(t.length>0||Object.keys(n).length>0)&&(r[rr]=new xi(t,n)),r}parseSegment(){const t=vF(this.remaining);if(""===t&&this.peekStartsWith(";"))throw new It(4009,!1);return this.capture(t),new Mx(gI(t),this.parseMatrixParams())}parseMatrixParams(){const t={};for(;this.consumeOptional(";");)this.parseParam(t);return t}parseParam(t){const n=function LEe(e){const t=e.match(OEe);return t?t[0]:""}(this.remaining);if(!n)return;this.capture(n);let r="";if(this.consumeOptional("=")){const i=vF(this.remaining);i&&(r=i,this.capture(r))}t[gI(n)]=gI(r)}parseQueryParam(t){const n=function VEe(e){const t=e.match(UEe);return t?t[0]:""}(this.remaining);if(!n)return;this.capture(n);let r="";if(this.consumeOptional("=")){const s=function GEe(e){const t=e.match(zEe);return t?t[0]:""}(this.remaining);s&&(r=s,this.capture(r))}const i=RK(n),o=RK(r);if(t.hasOwnProperty(i)){let s=t[i];Array.isArray(s)||(s=[s],t[i]=s),s.push(o)}else t[i]=o}parseParens(t){const n={};for(this.capture("(");!this.consumeOptional(")")&&this.remaining.length>0;){const r=vF(this.remaining),i=this.remaining[r.length];if("/"!==i&&")"!==i&&";"!==i)throw new It(4010,!1);let o;r.indexOf(":")>-1?(o=r.slice(0,r.indexOf(":")),this.capture(o),this.capture(":")):t&&(o=rr);const s=this.parseChildren();n[o]=1===Object.keys(s).length?s[rr]:new xi([],s),this.consumeOptional("//")}return n}peekStartsWith(t){return this.remaining.startsWith(t)}consumeOptional(t){return!!this.peekStartsWith(t)&&(this.remaining=this.remaining.substring(t.length),!0)}capture(t){if(!this.consumeOptional(t))throw new It(4011,!1)}}function NK(e){return e.segments.length>0?new xi([],{[rr]:e}):e}function FK(e){const t={};for(const[r,i]of Object.entries(e.children)){const o=FK(i);if(r===rr&&0===o.segments.length&&o.hasChildren())for(const[s,a]of Object.entries(o.children))t[s]=a;else(o.segments.length>0||o.hasChildren())&&(t[r]=o)}return function HEe(e){if(1===e.numberOfChildren&&e.children[rr]){const t=e.children[rr];return new xi(e.segments.concat(t.segments),t.children)}return e}(new xi(e.segments,t))}function Db(e){return e instanceof Ib}function BK(e){let t;const r=function n(o){const s={};for(const c of o.children){const u=n(c);s[c.outlet]=u}const a=new xi(o.url,s);return o===e&&(t=a),a}(e.root),i=NK(r);return t??i}function OK(e,t,n,r){let i=e;for(;i.parent;)i=i.parent;if(0===t.length)return _F(i,i,i,n,r);const o=function WEe(e){if("string"==typeof e[0]&&1===e.length&&"/"===e[0])return new UK(!0,0,e);let t=0,n=!1;const r=e.reduce((i,o,s)=>{if("object"==typeof o&&null!=o){if(o.outlets){const a={};return Object.entries(o.outlets).forEach(([c,u])=>{a[c]="string"==typeof u?u.split("/"):u}),[...i,{outlets:a}]}if(o.segmentPath)return[...i,o.segmentPath]}return"string"!=typeof o?[...i,o]:0===s?(o.split("/").forEach((a,c)=>{0==c&&"."===a||(0==c&&""===a?n=!0:".."===a?t++:""!=a&&i.push(a))}),i):[...i,o]},[]);return new UK(n,t,r)}(t);if(o.toRoot())return _F(i,i,new xi([],{}),n,r);const s=function $Ee(e,t,n){if(e.isAbsolute)return new bI(t,!0,0);if(!n)return new bI(t,!1,NaN);if(null===n.parent)return new bI(n,!0,0);const r=yI(e.commands[0])?0:1;return function YEe(e,t,n){let r=e,i=t,o=n;for(;o>i;){if(o-=i,r=r.parent,!r)throw new It(4005,!1);i=r.segments.length}return new bI(r,!1,i-o)}(n,n.segments.length-1+r,e.numberOfDoubleDots)}(o,i,e),a=s.processChildren?Nx(s.segmentGroup,s.index,o.commands):VK(s.segmentGroup,s.index,o.commands);return _F(i,s.segmentGroup,a,n,r)}function yI(e){return"object"==typeof e&&null!=e&&!e.outlets&&!e.segmentPath}function kx(e){return"object"==typeof e&&null!=e&&e.outlets}function _F(e,t,n,r,i){let s,o={};r&&Object.entries(r).forEach(([c,u])=>{o[c]=Array.isArray(u)?u.map(l=>`${l}`):`${u}`}),s=e===t?n:LK(e,t,n);const a=NK(FK(s));return new Ib(a,o,i)}function LK(e,t,n){const r={};return Object.entries(e.children).forEach(([i,o])=>{r[i]=o===t?n:LK(o,t,n)}),new xi(e.segments,r)}class UK{constructor(t,n,r){if(this.isAbsolute=t,this.numberOfDoubleDots=n,this.commands=r,t&&r.length>0&&yI(r[0]))throw new It(4003,!1);const i=r.find(kx);if(i&&i!==AK(r))throw new It(4004,!1)}toRoot(){return this.isAbsolute&&1===this.commands.length&&"/"==this.commands[0]}}class bI{constructor(t,n,r){this.segmentGroup=t,this.processChildren=n,this.index=r}}function VK(e,t,n){if(e??=new xi([],{}),0===e.segments.length&&e.hasChildren())return Nx(e,t,n);const r=function KEe(e,t,n){let r=0,i=t;const o={match:!1,pathIndex:0,commandIndex:0};for(;i=n.length)return o;const s=e.segments[i],a=n[r];if(kx(a))break;const c=`${a}`,u=r0&&void 0===c)break;if(c&&u&&"object"==typeof u&&void 0===u.outlets){if(!GK(c,u,s))return o;r+=2}else{if(!GK(c,{},s))return o;r++}i++}return{match:!0,pathIndex:i,commandIndex:r}}(e,t,n),i=n.slice(r.commandIndex);if(r.match&&r.pathIndexo!==rr)&&e.children[rr]&&1===e.numberOfChildren&&0===e.children[rr].segments.length){const o=Nx(e.children[rr],t,n);return new xi(e.segments,o.children)}return Object.entries(r).forEach(([o,s])=>{"string"==typeof s&&(s=[s]),null!==s&&(i[o]=VK(e.children[o],t,s))}),Object.entries(e.children).forEach(([o,s])=>{void 0===r[o]&&(i[o]=s)}),new xi(e.segments,i)}}function xF(e,t,n){const r=e.segments.slice(0,t);let i=0;for(;i{"string"==typeof r&&(r=[r]),null!==r&&(t[n]=xF(new xi([],{}),0,r))}),t}function zK(e){const t={};return Object.entries(e).forEach(([n,r])=>t[n]=`${r}`),t}function GK(e,t,n){return e==n.path&&Hd(t,n.parameters)}const Fx="imperative";var Dr=function(e){return e[e.NavigationStart=0]="NavigationStart",e[e.NavigationEnd=1]="NavigationEnd",e[e.NavigationCancel=2]="NavigationCancel",e[e.NavigationError=3]="NavigationError",e[e.RoutesRecognized=4]="RoutesRecognized",e[e.ResolveStart=5]="ResolveStart",e[e.ResolveEnd=6]="ResolveEnd",e[e.GuardsCheckStart=7]="GuardsCheckStart",e[e.GuardsCheckEnd=8]="GuardsCheckEnd",e[e.RouteConfigLoadStart=9]="RouteConfigLoadStart",e[e.RouteConfigLoadEnd=10]="RouteConfigLoadEnd",e[e.ChildActivationStart=11]="ChildActivationStart",e[e.ChildActivationEnd=12]="ChildActivationEnd",e[e.ActivationStart=13]="ActivationStart",e[e.ActivationEnd=14]="ActivationEnd",e[e.Scroll=15]="Scroll",e[e.NavigationSkipped=16]="NavigationSkipped",e}(Dr||{});class qd{constructor(t,n){this.id=t,this.url=n}}class vI extends qd{constructor(t,n,r="imperative",i=null){super(t,n),this.type=Dr.NavigationStart,this.navigationTrigger=r,this.restoredState=i}toString(){return`NavigationStart(id: ${this.id}, url: '${this.url}')`}}class np extends qd{constructor(t,n,r){super(t,n),this.urlAfterRedirects=r,this.type=Dr.NavigationEnd}toString(){return`NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`}}var iu=function(e){return e[e.Redirect=0]="Redirect",e[e.SupersededByNewNavigation=1]="SupersededByNewNavigation",e[e.NoDataFromResolver=2]="NoDataFromResolver",e[e.GuardRejected=3]="GuardRejected",e}(iu||{}),_I=function(e){return e[e.IgnoredSameUrlNavigation=0]="IgnoredSameUrlNavigation",e[e.IgnoredByUrlHandlingStrategy=1]="IgnoredByUrlHandlingStrategy",e}(_I||{});class Eb extends qd{constructor(t,n,r,i){super(t,n),this.reason=r,this.code=i,this.type=Dr.NavigationCancel}toString(){return`NavigationCancel(id: ${this.id}, url: '${this.url}')`}}class Pb extends qd{constructor(t,n,r,i){super(t,n),this.reason=r,this.code=i,this.type=Dr.NavigationSkipped}}class xI extends qd{constructor(t,n,r,i){super(t,n),this.error=r,this.target=i,this.type=Dr.NavigationError}toString(){return`NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`}}class jK extends qd{constructor(t,n,r,i){super(t,n),this.urlAfterRedirects=r,this.state=i,this.type=Dr.RoutesRecognized}toString(){return`RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class QEe extends qd{constructor(t,n,r,i){super(t,n),this.urlAfterRedirects=r,this.state=i,this.type=Dr.GuardsCheckStart}toString(){return`GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class JEe extends qd{constructor(t,n,r,i,o){super(t,n),this.urlAfterRedirects=r,this.state=i,this.shouldActivate=o,this.type=Dr.GuardsCheckEnd}toString(){return`GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`}}class e3e extends qd{constructor(t,n,r,i){super(t,n),this.urlAfterRedirects=r,this.state=i,this.type=Dr.ResolveStart}toString(){return`ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class t3e extends qd{constructor(t,n,r,i){super(t,n),this.urlAfterRedirects=r,this.state=i,this.type=Dr.ResolveEnd}toString(){return`ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class n3e{constructor(t){this.route=t,this.type=Dr.RouteConfigLoadStart}toString(){return`RouteConfigLoadStart(path: ${this.route.path})`}}class r3e{constructor(t){this.route=t,this.type=Dr.RouteConfigLoadEnd}toString(){return`RouteConfigLoadEnd(path: ${this.route.path})`}}class i3e{constructor(t){this.snapshot=t,this.type=Dr.ChildActivationStart}toString(){return`ChildActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class o3e{constructor(t){this.snapshot=t,this.type=Dr.ChildActivationEnd}toString(){return`ChildActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class s3e{constructor(t){this.snapshot=t,this.type=Dr.ActivationStart}toString(){return`ActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class a3e{constructor(t){this.snapshot=t,this.type=Dr.ActivationEnd}toString(){return`ActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class HK{constructor(t,n,r){this.routerEvent=t,this.position=n,this.anchor=r,this.type=Dr.Scroll}toString(){return`Scroll(anchor: '${this.anchor}', position: '${this.position?`${this.position[0]}, ${this.position[1]}`:null}')`}}class SF{}class CF{constructor(t){this.url=t}}class c3e{constructor(){this.outlet=null,this.route=null,this.injector=null,this.children=new Bx,this.attachRef=null}}let Bx=(()=>{class e{constructor(){this.contexts=new Map}onChildOutletCreated(n,r){const i=this.getOrCreateContext(n);i.outlet=r,this.contexts.set(n,i)}onChildOutletDestroyed(n){const r=this.getContext(n);r&&(r.outlet=null,r.attachRef=null)}onOutletDeactivated(){const n=this.contexts;return this.contexts=new Map,n}onOutletReAttached(n){this.contexts=n}getOrCreateContext(n){let r=this.getContext(n);return r||(r=new c3e,this.contexts.set(n,r)),r}getContext(n){return this.contexts.get(n)||null}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();class qK{constructor(t){this._root=t}get root(){return this._root.value}parent(t){const n=this.pathFromRoot(t);return n.length>1?n[n.length-2]:null}children(t){const n=wF(t,this._root);return n?n.children.map(r=>r.value):[]}firstChild(t){const n=wF(t,this._root);return n&&n.children.length>0?n.children[0].value:null}siblings(t){const n=AF(t,this._root);return n.length<2?[]:n[n.length-2].children.map(i=>i.value).filter(i=>i!==t)}pathFromRoot(t){return AF(t,this._root).map(n=>n.value)}}function wF(e,t){if(e===t.value)return t;for(const n of t.children){const r=wF(e,n);if(r)return r}return null}function AF(e,t){if(e===t.value)return[t];for(const n of t.children){const r=AF(e,n);if(r.length)return r.unshift(t),r}return[]}class Xl{constructor(t,n){this.value=t,this.children=n}toString(){return`TreeNode(${this.value})`}}function Mb(e){const t={};return e&&e.children.forEach(n=>t[n.value.outlet]=n),t}class WK extends qK{constructor(t,n){super(t),this.snapshot=n,DF(this,t)}toString(){return this.snapshot.toString()}}function $K(e){const t=function u3e(e){const o=new TF([],{},{},"",{},rr,e,null,{});return new YK("",new Xl(o,[]))}(e),n=new Ao([new Mx("",{})]),r=new Ao({}),i=new Ao({}),o=new Ao({}),s=new Ao(""),a=new Rb(n,r,o,s,i,rr,e,t.root);return a.snapshot=t.root,new WK(new Xl(a,[]),t)}class Rb{constructor(t,n,r,i,o,s,a,c){this.urlSubject=t,this.paramsSubject=n,this.queryParamsSubject=r,this.fragmentSubject=i,this.dataSubject=o,this.outlet=s,this.component=a,this._futureSnapshot=c,this.title=this.dataSubject?.pipe(qt(u=>u[Px]))??Pn(void 0),this.url=t,this.params=n,this.queryParams=r,this.fragment=i,this.data=o}get routeConfig(){return this._futureSnapshot.routeConfig}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??=this.params.pipe(qt(t=>Ab(t))),this._paramMap}get queryParamMap(){return this._queryParamMap??=this.queryParams.pipe(qt(t=>Ab(t))),this._queryParamMap}toString(){return this.snapshot?this.snapshot.toString():`Future(${this._futureSnapshot})`}}function IF(e,t,n="emptyOnly"){let r;const{routeConfig:i}=e;return r=null===t||"always"!==n&&""!==i?.path&&(t.component||t.routeConfig?.loadComponent)?{params:{...e.params},data:{...e.data},resolve:{...e.data,...e._resolvedData??{}}}:{params:{...t.params,...e.params},data:{...t.data,...e.data},resolve:{...e.data,...t.data,...i?.data,...e._resolvedData}},i&&KK(i)&&(r.resolve[Px]=i.title),r}class TF{get title(){return this.data?.[Px]}constructor(t,n,r,i,o,s,a,c,u){this.url=t,this.params=n,this.queryParams=r,this.fragment=i,this.data=o,this.outlet=s,this.component=a,this.routeConfig=c,this._resolve=u}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??=Ab(this.params),this._paramMap}get queryParamMap(){return this._queryParamMap??=Ab(this.queryParams),this._queryParamMap}toString(){return`Route(url:'${this.url.map(r=>r.toString()).join("/")}', path:'${this.routeConfig?this.routeConfig.path:""}')`}}class YK extends qK{constructor(t,n){super(n),this.url=t,DF(this,n)}toString(){return XK(this._root)}}function DF(e,t){t.value._routerState=e,t.children.forEach(n=>DF(e,n))}function XK(e){const t=e.children.length>0?` { ${e.children.map(XK).join(", ")} } `:"";return`${e.value}${t}`}function EF(e){if(e.snapshot){const t=e.snapshot,n=e._futureSnapshot;e.snapshot=n,Hd(t.queryParams,n.queryParams)||e.queryParamsSubject.next(n.queryParams),t.fragment!==n.fragment&&e.fragmentSubject.next(n.fragment),Hd(t.params,n.params)||e.paramsSubject.next(n.params),function IEe(e,t){if(e.length!==t.length)return!1;for(let n=0;nHd(n.parameters,t[r].parameters))}(e.url,t.url);return n&&!(!e.parent!=!t.parent)&&(!e.parent||PF(e.parent,t.parent))}function KK(e){return"string"==typeof e.title||null===e.title}let MF=(()=>{class e{constructor(){this.activated=null,this._activatedRoute=null,this.name=rr,this.activateEvents=new Ua,this.deactivateEvents=new Ua,this.attachEvents=new Ua,this.detachEvents=new Ua,this.parentContexts=bt(Bx),this.location=bt(Gl),this.changeDetector=bt(VA),this.environmentInjector=bt(xc),this.inputBinder=bt(SI,{optional:!0}),this.supportsBindingToComponentInputs=!0}get activatedComponentRef(){return this.activated}ngOnChanges(n){if(n.name){const{firstChange:r,previousValue:i}=n.name;if(r)return;this.isTrackedInParentContexts(i)&&(this.deactivate(),this.parentContexts.onChildOutletDestroyed(i)),this.initializeOutletWithName()}}ngOnDestroy(){this.isTrackedInParentContexts(this.name)&&this.parentContexts.onChildOutletDestroyed(this.name),this.inputBinder?.unsubscribeFromRouteData(this)}isTrackedInParentContexts(n){return this.parentContexts.getContext(n)?.outlet===this}ngOnInit(){this.initializeOutletWithName()}initializeOutletWithName(){if(this.parentContexts.onChildOutletCreated(this.name,this),this.activated)return;const n=this.parentContexts.getContext(this.name);n?.route&&(n.attachRef?this.attach(n.attachRef,n.route):this.activateWith(n.route,n.injector))}get isActivated(){return!!this.activated}get component(){if(!this.activated)throw new It(4012,!1);return this.activated.instance}get activatedRoute(){if(!this.activated)throw new It(4012,!1);return this._activatedRoute}get activatedRouteData(){return this._activatedRoute?this._activatedRoute.snapshot.data:{}}detach(){if(!this.activated)throw new It(4012,!1);this.location.detach();const n=this.activated;return this.activated=null,this._activatedRoute=null,this.detachEvents.emit(n.instance),n}attach(n,r){this.activated=n,this._activatedRoute=r,this.location.insert(n.hostView),this.inputBinder?.bindActivatedRouteToOutletComponent(this),this.attachEvents.emit(n.instance)}deactivate(){if(this.activated){const n=this.component;this.activated.destroy(),this.activated=null,this._activatedRoute=null,this.deactivateEvents.emit(n)}}activateWith(n,r){if(this.isActivated)throw new It(4013,!1);this._activatedRoute=n;const i=this.location,s=n.snapshot.component,a=this.parentContexts.getOrCreateContext(this.name).children,c=new l3e(n,a,i.injector);this.activated=i.createComponent(s,{index:i.length,injector:c,environmentInjector:r??this.environmentInjector}),this.changeDetector.markForCheck(),this.inputBinder?.bindActivatedRouteToOutletComponent(this),this.activateEvents.emit(this.activated.instance)}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275dir=Ba({type:e,selectors:[["router-outlet"]],inputs:{name:"name"},outputs:{activateEvents:"activate",deactivateEvents:"deactivate",attachEvents:"attach",detachEvents:"detach"},exportAs:["outlet"],standalone:!0,features:[wh]})}return e})();class l3e{constructor(t,n,r){this.route=t,this.childContexts=n,this.parent=r}get(t,n){return t===Rb?this.route:t===Bx?this.childContexts:this.parent.get(t,n)}}const SI=new Yt("");let ZK=(()=>{class e{constructor(){this.outletDataSubscriptions=new Map}bindActivatedRouteToOutletComponent(n){this.unsubscribeFromRouteData(n),this.subscribeToRouteData(n)}unsubscribeFromRouteData(n){this.outletDataSubscriptions.get(n)?.unsubscribe(),this.outletDataSubscriptions.delete(n)}subscribeToRouteData(n){const{activatedRoute:r}=n,i=uI([r.queryParams,r.params,r.data]).pipe(To(([o,s,a],c)=>(a={...o,...s,...a},0===c?Pn(a):Promise.resolve(a)))).subscribe(o=>{if(!n.isActivated||!n.activatedComponentRef||n.activatedRoute!==r||null===r.component)return void this.unsubscribeFromRouteData(n);const s=function XAe(e){const t=dr(e);if(!t)return null;const n=new J_(t);return{get selector(){return n.selector},get type(){return n.componentType},get inputs(){return n.inputs},get outputs(){return n.outputs},get ngContentSelectors(){return n.ngContentSelectors},get isStandalone(){return t.standalone},get isSignal(){return t.signals}}}(r.component);if(s)for(const{templateName:a}of s.inputs)n.activatedComponentRef.setInput(a,o[a]);else this.unsubscribeFromRouteData(n)});this.outletDataSubscriptions.set(n,i)}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac})}return e})();function Ox(e,t,n){if(n&&e.shouldReuseRoute(t.value,n.value.snapshot)){const r=n.value;r._futureSnapshot=t.value;const i=function f3e(e,t,n){return t.children.map(r=>{for(const i of n.children)if(e.shouldReuseRoute(r.value,i.value.snapshot))return Ox(e,r,i);return Ox(e,r)})}(e,t,n);return new Xl(r,i)}{if(e.shouldAttach(t.value)){const o=e.retrieve(t.value);if(null!==o){const s=o.route;return s.value._futureSnapshot=t.value,s.children=t.children.map(a=>Ox(e,a)),s}}const r=function p3e(e){return new Rb(new Ao(e.url),new Ao(e.params),new Ao(e.queryParams),new Ao(e.fragment),new Ao(e.data),e.outlet,e.component,e)}(t.value),i=t.children.map(o=>Ox(e,o));return new Xl(r,i)}}const QK="ngNavigationCancelingError";function JK(e,t){const{redirectTo:n,navigationBehaviorOptions:r}=Db(t)?{redirectTo:t,navigationBehaviorOptions:void 0}:t,i=eZ(!1,iu.Redirect);return i.url=n,i.navigationBehaviorOptions=r,i}function eZ(e,t){const n=new Error(`NavigationCancelingError: ${e||""}`);return n[QK]=!0,n.cancellationCode=t,n}function tZ(e){return!!e&&e[QK]}let nZ=(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275cmp=Mu({type:e,selectors:[["ng-component"]],standalone:!0,features:[Nu],decls:1,vars:0,template:function(r,i){1&r&&gi(0,"router-outlet")},dependencies:[MF],encapsulation:2})}return e})();function RF(e){const t=e.children&&e.children.map(RF),n=t?{...e,children:t}:{...e};return!n.component&&!n.loadComponent&&(t||n.loadChildren)&&n.outlet&&n.outlet!==rr&&(n.component=nZ),n}function Wd(e){return e.outlet||rr}function Lx(e){if(!e)return null;if(e.routeConfig?._injector)return e.routeConfig._injector;for(let t=e.parent;t;t=t.parent){const n=t.routeConfig;if(n?._loadedInjector)return n._loadedInjector;if(n?._injector)return n._injector}return null}class x3e{constructor(t,n,r,i,o){this.routeReuseStrategy=t,this.futureState=n,this.currState=r,this.forwardEvent=i,this.inputBindingEnabled=o}activate(t){const n=this.futureState._root,r=this.currState?this.currState._root:null;this.deactivateChildRoutes(n,r,t),EF(this.futureState.root),this.activateChildRoutes(n,r,t)}deactivateChildRoutes(t,n,r){const i=Mb(n);t.children.forEach(o=>{const s=o.value.outlet;this.deactivateRoutes(o,i[s],r),delete i[s]}),Object.values(i).forEach(o=>{this.deactivateRouteAndItsChildren(o,r)})}deactivateRoutes(t,n,r){const i=t.value,o=n?n.value:null;if(i===o)if(i.component){const s=r.getContext(i.outlet);s&&this.deactivateChildRoutes(t,n,s.children)}else this.deactivateChildRoutes(t,n,r);else o&&this.deactivateRouteAndItsChildren(n,r)}deactivateRouteAndItsChildren(t,n){t.value.component&&this.routeReuseStrategy.shouldDetach(t.value.snapshot)?this.detachAndStoreRouteSubtree(t,n):this.deactivateRouteAndOutlet(t,n)}detachAndStoreRouteSubtree(t,n){const r=n.getContext(t.value.outlet),i=r&&t.value.component?r.children:n,o=Mb(t);for(const s of Object.values(o))this.deactivateRouteAndItsChildren(s,i);if(r&&r.outlet){const s=r.outlet.detach(),a=r.children.onOutletDeactivated();this.routeReuseStrategy.store(t.value.snapshot,{componentRef:s,route:t,contexts:a})}}deactivateRouteAndOutlet(t,n){const r=n.getContext(t.value.outlet),i=r&&t.value.component?r.children:n,o=Mb(t);for(const s of Object.values(o))this.deactivateRouteAndItsChildren(s,i);r&&(r.outlet&&(r.outlet.deactivate(),r.children.onOutletDeactivated()),r.attachRef=null,r.route=null)}activateChildRoutes(t,n,r){const i=Mb(n);t.children.forEach(o=>{this.activateRoutes(o,i[o.value.outlet],r),this.forwardEvent(new a3e(o.value.snapshot))}),t.children.length&&this.forwardEvent(new o3e(t.value.snapshot))}activateRoutes(t,n,r){const i=t.value,o=n?n.value:null;if(EF(i),i===o)if(i.component){const s=r.getOrCreateContext(i.outlet);this.activateChildRoutes(t,n,s.children)}else this.activateChildRoutes(t,n,r);else if(i.component){const s=r.getOrCreateContext(i.outlet);if(this.routeReuseStrategy.shouldAttach(i.snapshot)){const a=this.routeReuseStrategy.retrieve(i.snapshot);this.routeReuseStrategy.store(i.snapshot,null),s.children.onOutletReAttached(a.contexts),s.attachRef=a.componentRef,s.route=a.route.value,s.outlet&&s.outlet.attach(a.componentRef,a.route.value),EF(a.route.value),this.activateChildRoutes(t,null,s.children)}else{const a=Lx(i.snapshot);s.attachRef=null,s.route=i,s.injector=a,s.outlet&&s.outlet.activateWith(i,s.injector),this.activateChildRoutes(t,null,s.children)}}else this.activateChildRoutes(t,null,r)}}class rZ{constructor(t){this.path=t,this.route=this.path[this.path.length-1]}}class CI{constructor(t,n){this.component=t,this.route=n}}function S3e(e,t,n){const r=e._root;return Ux(r,t?t._root:null,n,[r.value])}function kb(e,t){const n=Symbol(),r=t.get(e,n);return r===n?"function"!=typeof e||function N0e(e){return null!==iw(e)}(e)?t.get(e):e:r}function Ux(e,t,n,r,i={canDeactivateChecks:[],canActivateChecks:[]}){const o=Mb(t);return e.children.forEach(s=>{(function w3e(e,t,n,r,i={canDeactivateChecks:[],canActivateChecks:[]}){const o=e.value,s=t?t.value:null,a=n?n.getContext(e.value.outlet):null;if(s&&o.routeConfig===s.routeConfig){const c=function A3e(e,t,n){if("function"==typeof n)return n(e,t);switch(n){case"pathParamsChange":return!wg(e.url,t.url);case"pathParamsOrQueryParamsChange":return!wg(e.url,t.url)||!Hd(e.queryParams,t.queryParams);case"always":return!0;case"paramsOrQueryParamsChange":return!PF(e,t)||!Hd(e.queryParams,t.queryParams);default:return!PF(e,t)}}(s,o,o.routeConfig.runGuardsAndResolvers);c?i.canActivateChecks.push(new rZ(r)):(o.data=s.data,o._resolvedData=s._resolvedData),Ux(e,t,o.component?a?a.children:null:n,r,i),c&&a&&a.outlet&&a.outlet.isActivated&&i.canDeactivateChecks.push(new CI(a.outlet.component,s))}else s&&Vx(t,a,i),i.canActivateChecks.push(new rZ(r)),Ux(e,null,o.component?a?a.children:null:n,r,i)})(s,o[s.value.outlet],n,r.concat([s.value]),i),delete o[s.value.outlet]}),Object.entries(o).forEach(([s,a])=>Vx(a,n.getContext(s),i)),i}function Vx(e,t,n){const r=Mb(e),i=e.value;Object.entries(r).forEach(([o,s])=>{Vx(s,i.component?t?t.children.getContext(o):null:t,n)}),n.canDeactivateChecks.push(new CI(i.component&&t&&t.outlet&&t.outlet.isActivated?t.outlet.component:null,i))}function zx(e){return"function"==typeof e}function iZ(e){return e instanceof lI||"EmptyError"===e?.name}const wI=Symbol("INITIAL_VALUE");function Nb(){return To(e=>uI(e.map(t=>t.pipe(Sg(1),Dx(wI)))).pipe(qt(t=>{for(const n of t)if(!0!==n){if(n===wI)return wI;if(!1===n||n instanceof Ib)return n}return!0}),Yl(t=>t!==wI),Sg(1)))}function oZ(e){return _G(jr(t=>{if(Db(t))throw JK(0,t)}),qt(t=>!0===t))}class kF{constructor(t){this.segmentGroup=t||null}}class NF extends Error{constructor(t){super(),this.urlTree=t}}function Fb(e){return dI(new kF(e))}class H3e{constructor(t,n){this.urlSerializer=t,this.urlTree=n}lineralizeSegments(t,n){let r=[],i=n.root;for(;;){if(r=r.concat(i.segments),0===i.numberOfChildren)return Pn(r);if(i.numberOfChildren>1||!i.children[rr])return dI(new It(4e3,!1));i=i.children[rr]}}applyRedirectCommands(t,n,r){const i=this.applyRedirectCreateUrlTree(n,this.urlSerializer.parse(n),t,r);if(n.startsWith("/"))throw new NF(i);return i}applyRedirectCreateUrlTree(t,n,r,i){const o=this.createSegmentGroup(t,n.root,r,i);return new Ib(o,this.createQueryParams(n.queryParams,this.urlTree.queryParams),n.fragment)}createQueryParams(t,n){const r={};return Object.entries(t).forEach(([i,o])=>{if("string"==typeof o&&o.startsWith(":")){const a=o.substring(1);r[i]=n[a]}else r[i]=o}),r}createSegmentGroup(t,n,r,i){const o=this.createSegments(t,n.segments,r,i);let s={};return Object.entries(n.children).forEach(([a,c])=>{s[a]=this.createSegmentGroup(t,c,r,i)}),new xi(o,s)}createSegments(t,n,r,i){return n.map(o=>o.path.startsWith(":")?this.findPosParam(t,o,i):this.findOrReturn(o,r))}findPosParam(t,n,r){const i=r[n.path.substring(1)];if(!i)throw new It(4001,!1);return i}findOrReturn(t,n){let r=0;for(const i of n){if(i.path===t.path)return n.splice(r),i;r++}return t}}const FF={matched:!1,consumedSegments:[],remainingSegments:[],parameters:{},positionalParamSegments:{}};function q3e(e,t,n,r,i){const o=BF(e,t,n);return o.matched?(r=function m3e(e,t){return e.providers&&!e._injector&&(e._injector=hA(e.providers,t,`Route: ${e.path}`)),e._injector??t}(t,r),function z3e(e,t,n,r){const i=t.canMatch;return i&&0!==i.length?Pn(i.map(s=>{const a=kb(s,e);return zh(function M3e(e){return e&&zx(e.canMatch)}(a)?a.canMatch(t,n):Md(e,()=>a(t,n)))})).pipe(Nb(),oZ()):Pn(!0)}(r,t,n).pipe(qt(s=>!0===s?o:{...FF}))):Pn(o)}function BF(e,t,n){if("**"===t.path)return function W3e(e){return{matched:!0,parameters:e.length>0?AK(e).parameters:{},consumedSegments:e,remainingSegments:[],positionalParamSegments:{}}}(n);if(""===t.path)return"full"===t.pathMatch&&(e.hasChildren()||n.length>0)?{...FF}:{matched:!0,consumedSegments:[],remainingSegments:n,parameters:{},positionalParamSegments:{}};const i=(t.matcher||AEe)(n,e,t);if(!i)return{...FF};const o={};Object.entries(i.posParams??{}).forEach(([a,c])=>{o[a]=c.path});const s=i.consumed.length>0?{...o,...i.consumed[i.consumed.length-1].parameters}:o;return{matched:!0,consumedSegments:i.consumed,remainingSegments:n.slice(i.consumed.length),parameters:s,positionalParamSegments:i.posParams??{}}}function sZ(e,t,n,r){return n.length>0&&function X3e(e,t,n){return n.some(r=>AI(e,t,r)&&Wd(r)!==rr)}(e,n,r)?{segmentGroup:new xi(t,Y3e(r,new xi(n,e.children))),slicedSegments:[]}:0===n.length&&function K3e(e,t,n){return n.some(r=>AI(e,t,r))}(e,n,r)?{segmentGroup:new xi(e.segments,$3e(e,n,r,e.children)),slicedSegments:n}:{segmentGroup:new xi(e.segments,e.children),slicedSegments:n}}function $3e(e,t,n,r){const i={};for(const o of n)if(AI(e,t,o)&&!r[Wd(o)]){const s=new xi([],{});i[Wd(o)]=s}return{...r,...i}}function Y3e(e,t){const n={};n[rr]=t;for(const r of e)if(""===r.path&&Wd(r)!==rr){const i=new xi([],{});n[Wd(r)]=i}return n}function AI(e,t,n){return(!(e.hasChildren()||t.length>0)||"full"!==n.pathMatch)&&""===n.path}class J3e{}class nPe{constructor(t,n,r,i,o,s,a){this.injector=t,this.configLoader=n,this.rootComponentType=r,this.config=i,this.urlTree=o,this.paramsInheritanceStrategy=s,this.urlSerializer=a,this.applyRedirects=new H3e(this.urlSerializer,this.urlTree),this.absoluteRedirectCount=0,this.allowRedirects=!0}noMatchError(t){return new It(4002,`'${t.segmentGroup}'`)}recognize(){const t=sZ(this.urlTree.root,[],[],this.config).segmentGroup;return this.match(t).pipe(qt(n=>{const r=new TF([],Object.freeze({}),Object.freeze({...this.urlTree.queryParams}),this.urlTree.fragment,{},rr,this.rootComponentType,null,{}),i=new Xl(r,n),o=new YK("",i),s=function qEe(e,t,n=null,r=null){return OK(BK(e),t,n,r)}(r,[],this.urlTree.queryParams,this.urlTree.fragment);return s.queryParams=this.urlTree.queryParams,o.url=this.urlSerializer.serialize(s),this.inheritParamsAndData(o._root,null),{state:o,tree:s}}))}match(t){return this.processSegmentGroup(this.injector,this.config,t,rr).pipe(wb(r=>{if(r instanceof NF)return this.urlTree=r.urlTree,this.match(r.urlTree.root);throw r instanceof kF?this.noMatchError(r):r}))}inheritParamsAndData(t,n){const r=t.value,i=IF(r,n,this.paramsInheritanceStrategy);r.params=Object.freeze(i.params),r.data=Object.freeze(i.data),t.children.forEach(o=>this.inheritParamsAndData(o,r))}processSegmentGroup(t,n,r,i){return 0===r.segments.length&&r.hasChildren()?this.processChildren(t,n,r):this.processSegment(t,n,r,r.segments,i,!0).pipe(qt(o=>o instanceof Xl?[o]:[]))}processChildren(t,n,r){const i=[];for(const o of Object.keys(r.children))"primary"===o?i.unshift(o):i.push(o);return $i(i).pipe(Cb(o=>{const s=r.children[o],a=function v3e(e,t){const n=e.filter(r=>Wd(r)===t);return n.push(...e.filter(r=>Wd(r)!==t)),n}(n,o);return this.processSegmentGroup(t,a,s,o)}),function _Ee(e,t){return mo(function vEe(e,t,n,r,i){return(o,s)=>{let a=n,c=t,u=0;o.subscribe(Io(s,l=>{const d=u++;c=a?e(c,l,d):(a=!0,l),r&&s.next(c)},i&&(()=>{a&&s.next(c),s.complete()})))}}(e,t,arguments.length>=2,!0))}((o,s)=>(o.push(...s),o)),fI(null),function xEe(e,t){const n=arguments.length>=2;return r=>r.pipe(e?Yl((i,o)=>e(i,o,r)):vh,mF(1),n?fI(t):CK(()=>new lI))}(),fa(o=>{if(null===o)return Fb(r);const s=aZ(o);return function rPe(e){e.sort((t,n)=>t.value.outlet===rr?-1:n.value.outlet===rr?1:t.value.outlet.localeCompare(n.value.outlet))}(s),Pn(s)}))}processSegment(t,n,r,i,o,s){return $i(n).pipe(Cb(a=>this.processSegmentAgainstRoute(a._injector??t,n,a,r,i,o,s).pipe(wb(c=>{if(c instanceof kF)return Pn(null);throw c}))),Cg(a=>!!a),wb(a=>{if(iZ(a))return function Q3e(e,t,n){return 0===t.length&&!e.children[n]}(r,i,o)?Pn(new J3e):Fb(r);throw a}))}processSegmentAgainstRoute(t,n,r,i,o,s,a){return function Z3e(e,t,n,r){return!!(Wd(e)===r||r!==rr&&AI(t,n,e))&&BF(t,e,n).matched}(r,i,o,s)?void 0===r.redirectTo?this.matchSegmentAgainstRoute(t,i,r,o,s):this.allowRedirects&&a?this.expandSegmentAgainstRouteUsingRedirect(t,i,n,r,o,s):Fb(i):Fb(i)}expandSegmentAgainstRouteUsingRedirect(t,n,r,i,o,s){const{matched:a,consumedSegments:c,positionalParamSegments:u,remainingSegments:l}=BF(n,i,o);if(!a)return Fb(n);i.redirectTo.startsWith("/")&&(this.absoluteRedirectCount++,this.absoluteRedirectCount>31&&(this.allowRedirects=!1));const d=this.applyRedirects.applyRedirectCommands(c,i.redirectTo,u);return this.applyRedirects.lineralizeSegments(i,d).pipe(fa(f=>this.processSegment(t,r,n,f.concat(l),s,!1)))}matchSegmentAgainstRoute(t,n,r,i,o){const s=q3e(n,r,i,t);return"**"===r.path&&(n.children={}),s.pipe(To(a=>a.matched?this.getChildConfig(t=r._injector??t,r,i).pipe(To(({routes:c})=>{const u=r._loadedInjector??t,{consumedSegments:l,remainingSegments:d,parameters:f}=a,p=new TF(l,f,Object.freeze({...this.urlTree.queryParams}),this.urlTree.fragment,function oPe(e){return e.data||{}}(r),Wd(r),r.component??r._loadedComponent??null,r,function sPe(e){return e.resolve||{}}(r)),{segmentGroup:m,slicedSegments:h}=sZ(n,l,d,c);if(0===h.length&&m.hasChildren())return this.processChildren(u,c,m).pipe(qt(y=>null===y?null:new Xl(p,y)));if(0===c.length&&0===h.length)return Pn(new Xl(p,[]));const g=Wd(r)===o;return this.processSegment(u,c,m,h,g?rr:o,!0).pipe(qt(y=>new Xl(p,y instanceof Xl?[y]:[])))})):Fb(n)))}getChildConfig(t,n,r){return n.children?Pn({routes:n.children,injector:t}):n.loadChildren?void 0!==n._loadedRoutes?Pn({routes:n._loadedRoutes,injector:n._loadedInjector}):function V3e(e,t,n,r){const i=t.canLoad;return void 0===i||0===i.length?Pn(!0):Pn(i.map(s=>{const a=kb(s,e);return zh(function T3e(e){return e&&zx(e.canLoad)}(a)?a.canLoad(t,n):Md(e,()=>a(t,n)))})).pipe(Nb(),oZ())}(t,n,r).pipe(fa(i=>i?this.configLoader.loadChildren(t,n).pipe(jr(o=>{n._loadedRoutes=o.routes,n._loadedInjector=o.injector})):function j3e(e){return dI(eZ(!1,iu.GuardRejected))}())):Pn({routes:[],injector:t})}}function iPe(e){const t=e.value.routeConfig;return t&&""===t.path}function aZ(e){const t=[],n=new Set;for(const r of e){if(!iPe(r)){t.push(r);continue}const i=t.find(o=>r.value.routeConfig===o.value.routeConfig);void 0!==i?(i.children.push(...r.children),n.add(i)):t.push(r)}for(const r of n){const i=aZ(r.children);t.push(new Xl(r.value,i))}return t.filter(r=>!n.has(r))}function cZ(e){const t=e.children.map(n=>cZ(n)).flat();return[e,...t]}function OF(e){return To(t=>{const n=e(t);return n?$i(n).pipe(qt(()=>t)):Pn(t)})}let uZ=(()=>{class e{buildTitle(n){let r,i=n.root;for(;void 0!==i;)r=this.getResolvedTitleForRoute(i)??r,i=i.children.find(o=>o.outlet===rr);return r}getResolvedTitleForRoute(n){return n.data[Px]}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:()=>bt(fPe),providedIn:"root"})}return e})(),fPe=(()=>{class e extends uZ{constructor(n){super(),this.title=n}updateTitle(n){const r=this.buildTitle(n);void 0!==r&&this.title.setTitle(r)}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(xDe))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();const Bb=new Yt("",{providedIn:"root",factory:()=>({})}),Ob=new Yt("");let LF=(()=>{class e{constructor(){this.componentLoaders=new WeakMap,this.childrenLoaders=new WeakMap,this.compiler=bt(SY)}loadComponent(n){if(this.componentLoaders.get(n))return this.componentLoaders.get(n);if(n._loadedComponent)return Pn(n._loadedComponent);this.onLoadStartListener&&this.onLoadStartListener(n);const r=zh(n.loadComponent()).pipe(qt(lZ),jr(o=>{this.onLoadEndListener&&this.onLoadEndListener(n),n._loadedComponent=o}),Ex(()=>{this.componentLoaders.delete(n)})),i=new SK(r,()=>new mr).pipe(hF());return this.componentLoaders.set(n,i),i}loadChildren(n,r){if(this.childrenLoaders.get(r))return this.childrenLoaders.get(r);if(r._loadedRoutes)return Pn({routes:r._loadedRoutes,injector:r._loadedInjector});this.onLoadStartListener&&this.onLoadStartListener(r);const o=function pPe(e,t,n,r){return zh(e.loadChildren()).pipe(qt(lZ),fa(i=>i instanceof Rq||Array.isArray(i)?Pn(i):$i(t.compileModuleAsync(i))),qt(i=>{r&&r(e);let o,s,a=!1;return Array.isArray(i)?(s=i,!0):(o=i.create(n).injector,s=o.get(Ob,[],{optional:!0,self:!0}).flat()),{routes:s.map(RF),injector:o}}))}(r,this.compiler,n,this.onLoadEndListener).pipe(Ex(()=>{this.childrenLoaders.delete(r)})),s=new SK(o,()=>new mr).pipe(hF());return this.childrenLoaders.set(r,s),s}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function lZ(e){return function hPe(e){return e&&"object"==typeof e&&"default"in e}(e)?e.default:e}let UF=(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:()=>bt(mPe),providedIn:"root"})}return e})(),mPe=(()=>{class e{shouldProcessUrl(n){return!0}extract(n){return n}merge(n,r){return n}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();const dZ=new Yt(""),fZ=new Yt("");function gPe(e,t,n){const r=e.get(fZ),i=e.get(tu);return e.get(Qr).runOutsideAngular(()=>{if(!i.startViewTransition||r.skipNextTransition)return r.skipNextTransition=!1,Promise.resolve();let o;const s=new Promise(u=>{o=u}),a=i.startViewTransition(()=>(o(),function yPe(e){return new Promise(t=>{$H(t,{injector:e})})}(e))),{onViewTransitionCreated:c}=r;return c&&Md(e,()=>c({transition:a,from:t,to:n})),s})}let II=(()=>{class e{get hasRequestedNavigation(){return 0!==this.navigationId}constructor(){this.currentNavigation=null,this.currentTransition=null,this.lastSuccessfulNavigation=null,this.events=new mr,this.transitionAbortSubject=new mr,this.configLoader=bt(LF),this.environmentInjector=bt(xc),this.urlSerializer=bt(Tb),this.rootContexts=bt(Bx),this.location=bt(_b),this.inputBindingEnabled=null!==bt(SI,{optional:!0}),this.titleStrategy=bt(uZ),this.options=bt(Bb,{optional:!0})||{},this.paramsInheritanceStrategy=this.options.paramsInheritanceStrategy||"emptyOnly",this.urlHandlingStrategy=bt(UF),this.createViewTransition=bt(dZ,{optional:!0}),this.navigationId=0,this.afterPreactivation=()=>Pn(void 0),this.rootComponentType=null,this.configLoader.onLoadEndListener=i=>this.events.next(new r3e(i)),this.configLoader.onLoadStartListener=i=>this.events.next(new n3e(i))}complete(){this.transitions?.complete()}handleNavigationRequest(n){const r=++this.navigationId;this.transitions?.next({...this.transitions.value,...n,id:r})}setupNavigations(n,r,i){return this.transitions=new Ao({id:0,currentUrlTree:r,currentRawUrl:r,extractedUrl:this.urlHandlingStrategy.extract(r),urlAfterRedirects:this.urlHandlingStrategy.extract(r),rawUrl:r,extras:{},resolve:null,reject:null,promise:Promise.resolve(!0),source:Fx,restoredState:null,currentSnapshot:i.snapshot,targetSnapshot:null,currentRouterState:i,targetRouterState:null,guards:{canActivateChecks:[],canDeactivateChecks:[]},guardsResult:null}),this.transitions.pipe(Yl(o=>0!==o.id),qt(o=>({...o,extractedUrl:this.urlHandlingStrategy.extract(o.rawUrl)})),To(o=>{let s=!1,a=!1;return Pn(o).pipe(To(c=>{if(this.navigationId>o.id)return this.cancelNavigationTransition(o,"",iu.SupersededByNewNavigation),$l;this.currentTransition=o,this.currentNavigation={id:c.id,initialUrl:c.rawUrl,extractedUrl:c.extractedUrl,trigger:c.source,extras:c.extras,previousNavigation:this.lastSuccessfulNavigation?{...this.lastSuccessfulNavigation,previousNavigation:null}:null};const u=!n.navigated||this.isUpdatingInternalState()||this.isUpdatedBrowserUrl();if(!u&&"reload"!==(c.extras.onSameUrlNavigation??n.onSameUrlNavigation)){const d="";return this.events.next(new Pb(c.id,this.urlSerializer.serialize(c.rawUrl),d,_I.IgnoredSameUrlNavigation)),c.resolve(null),$l}if(this.urlHandlingStrategy.shouldProcessUrl(c.rawUrl))return Pn(c).pipe(To(d=>{const f=this.transitions?.getValue();return this.events.next(new vI(d.id,this.urlSerializer.serialize(d.extractedUrl),d.source,d.restoredState)),f!==this.transitions?.getValue()?$l:Promise.resolve(d)}),function aPe(e,t,n,r,i,o){return fa(s=>function ePe(e,t,n,r,i,o,s="emptyOnly"){return new nPe(e,t,n,r,i,s,o).recognize()}(e,t,n,r,s.extractedUrl,i,o).pipe(qt(({state:a,tree:c})=>({...s,targetSnapshot:a,urlAfterRedirects:c}))))}(this.environmentInjector,this.configLoader,this.rootComponentType,n.config,this.urlSerializer,this.paramsInheritanceStrategy),jr(d=>{o.targetSnapshot=d.targetSnapshot,o.urlAfterRedirects=d.urlAfterRedirects,this.currentNavigation={...this.currentNavigation,finalUrl:d.urlAfterRedirects};const f=new jK(d.id,this.urlSerializer.serialize(d.extractedUrl),this.urlSerializer.serialize(d.urlAfterRedirects),d.targetSnapshot);this.events.next(f)}));if(u&&this.urlHandlingStrategy.shouldProcessUrl(c.currentRawUrl)){const{id:d,extractedUrl:f,source:p,restoredState:m,extras:h}=c,g=new vI(d,this.urlSerializer.serialize(f),p,m);this.events.next(g);const y=$K(this.rootComponentType).snapshot;return this.currentTransition=o={...c,targetSnapshot:y,urlAfterRedirects:f,extras:{...h,skipLocationChange:!1,replaceUrl:!1}},this.currentNavigation.finalUrl=f,Pn(o)}{const d="";return this.events.next(new Pb(c.id,this.urlSerializer.serialize(c.extractedUrl),d,_I.IgnoredByUrlHandlingStrategy)),c.resolve(null),$l}}),jr(c=>{const u=new QEe(c.id,this.urlSerializer.serialize(c.extractedUrl),this.urlSerializer.serialize(c.urlAfterRedirects),c.targetSnapshot);this.events.next(u)}),qt(c=>(this.currentTransition=o={...c,guards:S3e(c.targetSnapshot,c.currentSnapshot,this.rootContexts)},o)),function R3e(e,t){return fa(n=>{const{targetSnapshot:r,currentSnapshot:i,guards:{canActivateChecks:o,canDeactivateChecks:s}}=n;return 0===s.length&&0===o.length?Pn({...n,guardsResult:!0}):function k3e(e,t,n,r){return $i(e).pipe(fa(i=>function U3e(e,t,n,r,i){const o=t&&t.routeConfig?t.routeConfig.canDeactivate:null;return o&&0!==o.length?Pn(o.map(a=>{const c=Lx(t)??i,u=kb(a,c);return zh(function P3e(e){return e&&zx(e.canDeactivate)}(u)?u.canDeactivate(e,t,n,r):Md(c,()=>u(e,t,n,r))).pipe(Cg())})).pipe(Nb()):Pn(!0)}(i.component,i.route,n,t,r)),Cg(i=>!0!==i,!0))}(s,r,i,e).pipe(fa(a=>a&&function I3e(e){return"boolean"==typeof e}(a)?function N3e(e,t,n,r){return $i(t).pipe(Cb(i=>pF(function B3e(e,t){return null!==e&&t&&t(new i3e(e)),Pn(!0)}(i.route.parent,r),function F3e(e,t){return null!==e&&t&&t(new s3e(e)),Pn(!0)}(i.route,r),function L3e(e,t,n){const r=t[t.length-1],o=t.slice(0,t.length-1).reverse().map(s=>function C3e(e){const t=e.routeConfig?e.routeConfig.canActivateChild:null;return t&&0!==t.length?{node:e,guards:t}:null}(s)).filter(s=>null!==s).map(s=>xK(()=>Pn(s.guards.map(c=>{const u=Lx(s.node)??n,l=kb(c,u);return zh(function E3e(e){return e&&zx(e.canActivateChild)}(l)?l.canActivateChild(r,e):Md(u,()=>l(r,e))).pipe(Cg())})).pipe(Nb())));return Pn(o).pipe(Nb())}(e,i.path,n),function O3e(e,t,n){const r=t.routeConfig?t.routeConfig.canActivate:null;if(!r||0===r.length)return Pn(!0);const i=r.map(o=>xK(()=>{const s=Lx(t)??n,a=kb(o,s);return zh(function D3e(e){return e&&zx(e.canActivate)}(a)?a.canActivate(t,e):Md(s,()=>a(t,e))).pipe(Cg())}));return Pn(i).pipe(Nb())}(e,i.route,n))),Cg(i=>!0!==i,!0))}(r,o,e,t):Pn(a)),qt(a=>({...n,guardsResult:a})))})}(this.environmentInjector,c=>this.events.next(c)),jr(c=>{if(o.guardsResult=c.guardsResult,Db(c.guardsResult))throw JK(0,c.guardsResult);const u=new JEe(c.id,this.urlSerializer.serialize(c.extractedUrl),this.urlSerializer.serialize(c.urlAfterRedirects),c.targetSnapshot,!!c.guardsResult);this.events.next(u)}),Yl(c=>!!c.guardsResult||(this.cancelNavigationTransition(c,"",iu.GuardRejected),!1)),OF(c=>{if(c.guards.canActivateChecks.length)return Pn(c).pipe(jr(u=>{const l=new e3e(u.id,this.urlSerializer.serialize(u.extractedUrl),this.urlSerializer.serialize(u.urlAfterRedirects),u.targetSnapshot);this.events.next(l)}),To(u=>{let l=!1;return Pn(u).pipe(function cPe(e,t){return fa(n=>{const{targetSnapshot:r,guards:{canActivateChecks:i}}=n;if(!i.length)return Pn(n);const o=new Set(i.map(c=>c.route)),s=new Set;for(const c of o)if(!s.has(c))for(const u of cZ(c))s.add(u);let a=0;return $i(s).pipe(Cb(c=>o.has(c)?function uPe(e,t,n,r){const i=e.routeConfig,o=e._resolve;return void 0!==i?.title&&!KK(i)&&(o[Px]=i.title),function lPe(e,t,n,r){const i=gF(e);if(0===i.length)return Pn({});const o={};return $i(i).pipe(fa(s=>function dPe(e,t,n,r){const i=Lx(t)??r,o=kb(e,i);return zh(o.resolve?o.resolve(t,n):Md(i,()=>o(t,n)))}(e[s],t,n,r).pipe(Cg(),jr(a=>{o[s]=a}))),mF(1),function SEe(e){return qt(()=>e)}(o),wb(s=>iZ(s)?$l:dI(s)))}(o,e,t,r).pipe(qt(s=>(e._resolvedData=s,e.data=IF(e,e.parent,n).resolve,null)))}(c,r,e,t):(c.data=IF(c,c.parent,e).resolve,Pn(void 0))),jr(()=>a++),mF(1),fa(c=>a===s.size?Pn(n):$l))})}(this.paramsInheritanceStrategy,this.environmentInjector),jr({next:()=>l=!0,complete:()=>{l||this.cancelNavigationTransition(u,"",iu.NoDataFromResolver)}}))}),jr(u=>{const l=new t3e(u.id,this.urlSerializer.serialize(u.extractedUrl),this.urlSerializer.serialize(u.urlAfterRedirects),u.targetSnapshot);this.events.next(l)}))}),OF(c=>{const u=l=>{const d=[];l.routeConfig?.loadComponent&&!l.routeConfig._loadedComponent&&d.push(this.configLoader.loadComponent(l.routeConfig).pipe(jr(f=>{l.component=f}),qt(()=>{})));for(const f of l.children)d.push(...u(f));return d};return uI(u(c.targetSnapshot.root)).pipe(fI(null),Sg(1))}),OF(()=>this.afterPreactivation()),To(()=>{const{currentSnapshot:c,targetSnapshot:u}=o,l=this.createViewTransition?.(this.environmentInjector,c.root,u.root);return l?$i(l).pipe(qt(()=>o)):Pn(o)}),qt(c=>{const u=function d3e(e,t,n){const r=Ox(e,t._root,n?n._root:void 0);return new WK(r,t)}(n.routeReuseStrategy,c.targetSnapshot,c.currentRouterState);return this.currentTransition=o={...c,targetRouterState:u},this.currentNavigation.targetRouterState=u,o}),jr(()=>{this.events.next(new SF)}),((e,t,n,r)=>qt(i=>(new x3e(t,i.targetRouterState,i.currentRouterState,n,r).activate(e),i)))(this.rootContexts,n.routeReuseStrategy,c=>this.events.next(c),this.inputBindingEnabled),Sg(1),jr({next:c=>{s=!0,this.lastSuccessfulNavigation=this.currentNavigation,this.events.next(new np(c.id,this.urlSerializer.serialize(c.extractedUrl),this.urlSerializer.serialize(c.urlAfterRedirects))),this.titleStrategy?.updateTitle(c.targetRouterState.snapshot),c.resolve(!0)},complete:()=>{s=!0}}),function CEe(e){return mo((t,n)=>{ru(e).subscribe(Io(n,()=>n.complete(),uM)),!n.closed&&t.subscribe(n)})}(this.transitionAbortSubject.pipe(jr(c=>{throw c}))),Ex(()=>{!s&&!a&&this.cancelNavigationTransition(o,"",iu.SupersededByNewNavigation),this.currentTransition?.id===o.id&&(this.currentNavigation=null,this.currentTransition=null)}),wb(c=>{if(a=!0,tZ(c))this.events.next(new Eb(o.id,this.urlSerializer.serialize(o.extractedUrl),c.message,c.cancellationCode)),function h3e(e){return tZ(e)&&Db(e.url)}(c)?this.events.next(new CF(c.url)):o.resolve(!1);else{this.events.next(new xI(o.id,this.urlSerializer.serialize(o.extractedUrl),c,o.targetSnapshot??void 0));try{o.resolve(n.errorHandler(c))}catch(u){this.options.resolveNavigationPromiseOnError?o.resolve(!1):o.reject(u)}}return $l}))}))}cancelNavigationTransition(n,r,i){const o=new Eb(n.id,this.urlSerializer.serialize(n.extractedUrl),r,i);this.events.next(o),n.resolve(!1)}isUpdatingInternalState(){return this.currentTransition?.extractedUrl.toString()!==this.currentTransition?.currentUrlTree.toString()}isUpdatedBrowserUrl(){return this.urlHandlingStrategy.extract(this.urlSerializer.parse(this.location.path(!0))).toString()!==this.currentTransition?.extractedUrl.toString()&&!this.currentTransition?.extras.skipLocationChange}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function bPe(e){return e!==Fx}let vPe=(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:()=>bt(xPe),providedIn:"root"})}return e})();class _Pe{shouldDetach(t){return!1}store(t,n){}shouldAttach(t){return!1}retrieve(t){return null}shouldReuseRoute(t,n){return t.routeConfig===n.routeConfig}}let xPe=(()=>{class e extends _Pe{static#e=this.\u0275fac=(()=>{let n;return function(i){return(n||(n=hR(e)))(i||e)}})();static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})(),pZ=(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:()=>bt(SPe),providedIn:"root"})}return e})(),SPe=(()=>{class e extends pZ{constructor(){super(...arguments),this.location=bt(_b),this.urlSerializer=bt(Tb),this.options=bt(Bb,{optional:!0})||{},this.canceledNavigationResolution=this.options.canceledNavigationResolution||"replace",this.urlHandlingStrategy=bt(UF),this.urlUpdateStrategy=this.options.urlUpdateStrategy||"deferred",this.currentUrlTree=new Ib,this.rawUrlTree=this.currentUrlTree,this.currentPageId=0,this.lastSuccessfulId=-1,this.routerState=$K(null),this.stateMemento=this.createStateMemento()}getCurrentUrlTree(){return this.currentUrlTree}getRawUrlTree(){return this.rawUrlTree}restoredState(){return this.location.getState()}get browserPageId(){return"computed"!==this.canceledNavigationResolution?this.currentPageId:this.restoredState()?.\u0275routerPageId??this.currentPageId}getRouterState(){return this.routerState}createStateMemento(){return{rawUrlTree:this.rawUrlTree,currentUrlTree:this.currentUrlTree,routerState:this.routerState}}registerNonRouterCurrentEntryChangeListener(n){return this.location.subscribe(r=>{"popstate"===r.type&&n(r.url,r.state)})}handleRouterEvent(n,r){if(n instanceof vI)this.stateMemento=this.createStateMemento();else if(n instanceof Pb)this.rawUrlTree=r.initialUrl;else if(n instanceof jK){if("eager"===this.urlUpdateStrategy&&!r.extras.skipLocationChange){const i=this.urlHandlingStrategy.merge(r.finalUrl,r.initialUrl);this.setBrowserUrl(i,r)}}else n instanceof SF?(this.currentUrlTree=r.finalUrl,this.rawUrlTree=this.urlHandlingStrategy.merge(r.finalUrl,r.initialUrl),this.routerState=r.targetRouterState,"deferred"===this.urlUpdateStrategy&&(r.extras.skipLocationChange||this.setBrowserUrl(this.rawUrlTree,r))):n instanceof Eb&&(n.code===iu.GuardRejected||n.code===iu.NoDataFromResolver)?this.restoreHistory(r):n instanceof xI?this.restoreHistory(r,!0):n instanceof np&&(this.lastSuccessfulId=n.id,this.currentPageId=this.browserPageId)}setBrowserUrl(n,r){const i=this.urlSerializer.serialize(n);if(this.location.isCurrentPathEqualTo(i)||r.extras.replaceUrl){const s={...r.extras.state,...this.generateNgRouterState(r.id,this.browserPageId)};this.location.replaceState(i,"",s)}else{const o={...r.extras.state,...this.generateNgRouterState(r.id,this.browserPageId+1)};this.location.go(i,"",o)}}restoreHistory(n,r=!1){if("computed"===this.canceledNavigationResolution){const o=this.currentPageId-this.browserPageId;0!==o?this.location.historyGo(o):this.currentUrlTree===n.finalUrl&&0===o&&(this.resetState(n),this.resetUrlToCurrentUrlTree())}else"replace"===this.canceledNavigationResolution&&(r&&this.resetState(n),this.resetUrlToCurrentUrlTree())}resetState(n){this.routerState=this.stateMemento.routerState,this.currentUrlTree=this.stateMemento.currentUrlTree,this.rawUrlTree=this.urlHandlingStrategy.merge(this.currentUrlTree,n.finalUrl??this.rawUrlTree)}resetUrlToCurrentUrlTree(){this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree),"",this.generateNgRouterState(this.lastSuccessfulId,this.currentPageId))}generateNgRouterState(n,r){return"computed"===this.canceledNavigationResolution?{navigationId:n,\u0275routerPageId:r}:{navigationId:n}}static#e=this.\u0275fac=(()=>{let n;return function(i){return(n||(n=hR(e)))(i||e)}})();static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var Gx=function(e){return e[e.COMPLETE=0]="COMPLETE",e[e.FAILED=1]="FAILED",e[e.REDIRECTING=2]="REDIRECTING",e}(Gx||{});function hZ(e,t){e.events.pipe(Yl(n=>n instanceof np||n instanceof Eb||n instanceof xI||n instanceof Pb),qt(n=>n instanceof np||n instanceof Pb?Gx.COMPLETE:n instanceof Eb&&(n.code===iu.Redirect||n.code===iu.SupersededByNewNavigation)?Gx.REDIRECTING:Gx.FAILED),Yl(n=>n!==Gx.REDIRECTING),Sg(1)).subscribe(()=>{t()})}function CPe(e){throw e}const wPe={paths:"exact",fragment:"ignored",matrixParams:"ignored",queryParams:"exact"},APe={paths:"subset",fragment:"ignored",matrixParams:"ignored",queryParams:"subset"};let Kl=(()=>{class e{get currentUrlTree(){return this.stateManager.getCurrentUrlTree()}get rawUrlTree(){return this.stateManager.getRawUrlTree()}get events(){return this._events}get routerState(){return this.stateManager.getRouterState()}constructor(){this.disposed=!1,this.isNgZoneEnabled=!1,this.console=bt(fY),this.stateManager=bt(pZ),this.options=bt(Bb,{optional:!0})||{},this.pendingTasks=bt(kh),this.urlUpdateStrategy=this.options.urlUpdateStrategy||"deferred",this.navigationTransitions=bt(II),this.urlSerializer=bt(Tb),this.location=bt(_b),this.urlHandlingStrategy=bt(UF),this._events=new mr,this.errorHandler=this.options.errorHandler||CPe,this.navigated=!1,this.routeReuseStrategy=bt(vPe),this.onSameUrlNavigation=this.options.onSameUrlNavigation||"ignore",this.config=bt(Ob,{optional:!0})?.flat()??[],this.componentInputBindingEnabled=!!bt(SI,{optional:!0}),this.eventsSubscription=new Fa,this.isNgZoneEnabled=bt(Qr)instanceof Qr&&Qr.isInAngularZone(),this.resetConfig(this.config),this.navigationTransitions.setupNavigations(this,this.currentUrlTree,this.routerState).subscribe({error:n=>{this.console.warn(n)}}),this.subscribeToNavigationEvents()}subscribeToNavigationEvents(){const n=this.navigationTransitions.events.subscribe(r=>{try{const i=this.navigationTransitions.currentTransition,o=this.navigationTransitions.currentNavigation;if(null!==i&&null!==o)if(this.stateManager.handleRouterEvent(r,o),r instanceof Eb&&r.code!==iu.Redirect&&r.code!==iu.SupersededByNewNavigation)this.navigated=!0;else if(r instanceof np)this.navigated=!0;else if(r instanceof CF){const s=this.urlHandlingStrategy.merge(r.url,i.currentRawUrl),a={info:i.extras.info,skipLocationChange:i.extras.skipLocationChange,replaceUrl:"eager"===this.urlUpdateStrategy||bPe(i.source)};this.scheduleNavigation(s,Fx,null,a,{resolve:i.resolve,reject:i.reject,promise:i.promise})}(function TPe(e){return!(e instanceof SF||e instanceof CF)})(r)&&this._events.next(r)}catch(i){this.navigationTransitions.transitionAbortSubject.next(i)}});this.eventsSubscription.add(n)}resetRootComponentType(n){this.routerState.root.component=n,this.navigationTransitions.rootComponentType=n}initialNavigation(){this.setUpLocationChangeListener(),this.navigationTransitions.hasRequestedNavigation||this.navigateToSyncWithBrowser(this.location.path(!0),Fx,this.stateManager.restoredState())}setUpLocationChangeListener(){this.nonRouterCurrentEntryChangeSubscription??=this.stateManager.registerNonRouterCurrentEntryChangeListener((n,r)=>{setTimeout(()=>{this.navigateToSyncWithBrowser(n,"popstate",r)},0)})}navigateToSyncWithBrowser(n,r,i){const o={replaceUrl:!0},s=i?.navigationId?i:null;if(i){const c={...i};delete c.navigationId,delete c.\u0275routerPageId,0!==Object.keys(c).length&&(o.state=c)}const a=this.parseUrl(n);this.scheduleNavigation(a,r,s,o)}get url(){return this.serializeUrl(this.currentUrlTree)}getCurrentNavigation(){return this.navigationTransitions.currentNavigation}get lastSuccessfulNavigation(){return this.navigationTransitions.lastSuccessfulNavigation}resetConfig(n){this.config=n.map(RF),this.navigated=!1}ngOnDestroy(){this.dispose()}dispose(){this.navigationTransitions.complete(),this.nonRouterCurrentEntryChangeSubscription&&(this.nonRouterCurrentEntryChangeSubscription.unsubscribe(),this.nonRouterCurrentEntryChangeSubscription=void 0),this.disposed=!0,this.eventsSubscription.unsubscribe()}createUrlTree(n,r={}){const{relativeTo:i,queryParams:o,fragment:s,queryParamsHandling:a,preserveFragment:c}=r,u=c?this.currentUrlTree.fragment:s;let d,l=null;switch(a){case"merge":l={...this.currentUrlTree.queryParams,...o};break;case"preserve":l=this.currentUrlTree.queryParams;break;default:l=o||null}null!==l&&(l=this.removeEmptyProps(l));try{d=BK(i?i.snapshot:this.routerState.snapshot.root)}catch{("string"!=typeof n[0]||!n[0].startsWith("/"))&&(n=[]),d=this.currentUrlTree.root}return OK(d,n,l,u??null)}navigateByUrl(n,r={skipLocationChange:!1}){const i=Db(n)?n:this.parseUrl(n),o=this.urlHandlingStrategy.merge(i,this.rawUrlTree);return this.scheduleNavigation(o,Fx,null,r)}navigate(n,r={skipLocationChange:!1}){return function IPe(e){for(let t=0;t(null!=o&&(r[i]=o),r),{})}scheduleNavigation(n,r,i,o,s){if(this.disposed)return Promise.resolve(!1);let a,c,u;s?(a=s.resolve,c=s.reject,u=s.promise):u=new Promise((d,f)=>{a=d,c=f});const l=this.pendingTasks.add();return hZ(this,()=>{queueMicrotask(()=>this.pendingTasks.remove(l))}),this.navigationTransitions.handleNavigationRequest({source:r,restoredState:i,currentUrlTree:this.currentUrlTree,currentRawUrl:this.currentUrlTree,rawUrl:n,extras:o,resolve:a,reject:c,promise:u,currentSnapshot:this.routerState.snapshot,currentRouterState:this.routerState}),u.catch(d=>Promise.reject(d))}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})(),TI=(()=>{class e{constructor(n,r,i,o,s,a){this.router=n,this.route=r,this.tabIndexAttribute=i,this.renderer=o,this.el=s,this.locationStrategy=a,this.href=null,this.commands=null,this.onChanges=new mr,this.preserveFragment=!1,this.skipLocationChange=!1,this.replaceUrl=!1;const c=s.nativeElement.tagName?.toLowerCase();this.isAnchorElement="a"===c||"area"===c,this.isAnchorElement?this.subscription=n.events.subscribe(u=>{u instanceof np&&this.updateHref()}):this.setTabIndexIfNotOnNativeEl("0")}setTabIndexIfNotOnNativeEl(n){null!=this.tabIndexAttribute||this.isAnchorElement||this.applyAttributeValue("tabindex",n)}ngOnChanges(n){this.isAnchorElement&&this.updateHref(),this.onChanges.next(this)}set routerLink(n){null!=n?(this.commands=Array.isArray(n)?n:[n],this.setTabIndexIfNotOnNativeEl("0")):(this.commands=null,this.setTabIndexIfNotOnNativeEl(null))}onClick(n,r,i,o,s){const a=this.urlTree;return!!(null===a||this.isAnchorElement&&(0!==n||r||i||o||s||"string"==typeof this.target&&"_self"!=this.target))||(this.router.navigateByUrl(a,{skipLocationChange:this.skipLocationChange,replaceUrl:this.replaceUrl,state:this.state,info:this.info}),!this.isAnchorElement)}ngOnDestroy(){this.subscription?.unsubscribe()}updateHref(){const n=this.urlTree;this.href=null!==n&&this.locationStrategy?this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(n)):null;const r=null===this.href?null:function Vj(e,t,n){return function jve(e,t){return"src"===t&&("embed"===e||"frame"===e||"iframe"===e||"media"===e||"script"===e)||"href"===t&&("base"===e||"link"===e)?Uj:Lj}(t,n)(e)}(this.href,this.el.nativeElement.tagName.toLowerCase(),"href");this.applyAttributeValue("href",r)}applyAttributeValue(n,r){const i=this.renderer,o=this.el.nativeElement;null!==r?i.setAttribute(o,n,r):i.removeAttribute(o,n)}get urlTree(){return null===this.commands?null:this.router.createUrlTree(this.commands,{relativeTo:void 0!==this.relativeTo?this.relativeTo:this.route,queryParams:this.queryParams,fragment:this.fragment,queryParamsHandling:this.queryParamsHandling,preserveFragment:this.preserveFragment})}static#e=this.\u0275fac=function(r){return new(r||e)(cn(Kl),cn(Rb),function T_(e){return function xbe(e,t){if("class"===t)return e.classes;if("style"===t)return e.styles;const n=e.attrs;if(n){const r=n.length;let i=0;for(;i{class e{constructor(n,r,i,o,s){this.router=n,this.injector=i,this.preloadingStrategy=o,this.loader=s}setUpPreloading(){this.subscription=this.router.events.pipe(Yl(n=>n instanceof np),Cb(()=>this.preload())).subscribe(()=>{})}preload(){return this.processRoutes(this.injector,this.router.config)}ngOnDestroy(){this.subscription&&this.subscription.unsubscribe()}processRoutes(n,r){const i=[];for(const o of r){o.providers&&!o._injector&&(o._injector=hA(o.providers,n,`Route: ${o.path}`));const s=o._injector??n,a=o._loadedInjector??s;(o.loadChildren&&!o._loadedRoutes&&void 0===o.canLoad||o.loadComponent&&!o._loadedComponent)&&i.push(this.preloadConfig(s,o)),(o.children||o._loadedRoutes)&&i.push(this.processRoutes(a,o.children??o._loadedRoutes))}return $i(i).pipe(xg())}preloadConfig(n,r){return this.preloadingStrategy.preload(r,()=>{let i;i=r.loadChildren&&void 0===r.canLoad?this.loader.loadChildren(n,r):Pn(null);const o=i.pipe(fa(s=>null===s?Pn(void 0):(r._loadedRoutes=s.routes,r._loadedInjector=s.injector,this.processRoutes(s.injector??n,s.routes))));return r.loadComponent&&!r._loadedComponent?$i([o,this.loader.loadComponent(r)]).pipe(xg()):o})}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(Kl),Zt(SY),Zt(xc),Zt(mZ),Zt(LF))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();const VF=new Yt("");let gZ=(()=>{class e{constructor(n,r,i,o,s={}){this.urlSerializer=n,this.transitions=r,this.viewportScroller=i,this.zone=o,this.options=s,this.lastId=0,this.lastSource="imperative",this.restoredId=0,this.store={},s.scrollPositionRestoration||="disabled",s.anchorScrolling||="disabled"}init(){"disabled"!==this.options.scrollPositionRestoration&&this.viewportScroller.setHistoryScrollRestoration("manual"),this.routerEventsSubscription=this.createScrollEvents(),this.scrollEventsSubscription=this.consumeScrollEvents()}createScrollEvents(){return this.transitions.events.subscribe(n=>{n instanceof vI?(this.store[this.lastId]=this.viewportScroller.getScrollPosition(),this.lastSource=n.navigationTrigger,this.restoredId=n.restoredState?n.restoredState.navigationId:0):n instanceof np?(this.lastId=n.id,this.scheduleScrollEvent(n,this.urlSerializer.parse(n.urlAfterRedirects).fragment)):n instanceof Pb&&n.code===_I.IgnoredSameUrlNavigation&&(this.lastSource=void 0,this.restoredId=0,this.scheduleScrollEvent(n,this.urlSerializer.parse(n.url).fragment))})}consumeScrollEvents(){return this.transitions.events.subscribe(n=>{n instanceof HK&&(n.position?"top"===this.options.scrollPositionRestoration?this.viewportScroller.scrollToPosition([0,0]):"enabled"===this.options.scrollPositionRestoration&&this.viewportScroller.scrollToPosition(n.position):n.anchor&&"enabled"===this.options.anchorScrolling?this.viewportScroller.scrollToAnchor(n.anchor):"disabled"!==this.options.scrollPositionRestoration&&this.viewportScroller.scrollToPosition([0,0]))})}scheduleScrollEvent(n,r){this.zone.runOutsideAngular(()=>{setTimeout(()=>{this.zone.run(()=>{this.transitions.events.next(new HK(n,"popstate"===this.lastSource?this.store[this.restoredId]:null,r))})},0)})}ngOnDestroy(){this.routerEventsSubscription?.unsubscribe(),this.scrollEventsSubscription?.unsubscribe()}static#e=this.\u0275fac=function(r){!function dH(){throw new Error("invalid")}()};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac})}return e})();function yZ(e){return e.routerState.root}function $d(e,t){return{\u0275kind:e,\u0275providers:t}}function bZ(){const e=bt(Sc);return t=>{const n=e.get(Oh);if(t!==n.components[0])return;const r=e.get(Kl),i=e.get(vZ);1===e.get(zF)&&r.initialNavigation(),e.get(_Z,null,yr.Optional)?.setUpPreloading(),e.get(VF,null,yr.Optional)?.init(),r.resetRootComponentType(n.componentTypes[0]),i.closed||(i.next(),i.complete(),i.unsubscribe())}}const vZ=new Yt("",{factory:()=>new mr}),zF=new Yt("",{providedIn:"root",factory:()=>1}),_Z=new Yt("");function FPe(e){return $d(0,[{provide:_Z,useExisting:PPe},{provide:mZ,useExisting:e}])}function OPe(e){return $d(9,[{provide:dZ,useValue:gPe},{provide:fZ,useValue:{skipNextTransition:!!e?.skipInitialTransition,...e}}])}const xZ=new Yt("ROUTER_FORROOT_GUARD"),LPe=[_b,{provide:Tb,useClass:yF},Kl,Bx,{provide:Rb,useFactory:yZ,deps:[Kl]},LF,[]];let GF=(()=>{class e{constructor(n){}static forRoot(n,r){return{ngModule:e,providers:[LPe,[],{provide:Ob,multi:!0,useValue:n},{provide:xZ,useFactory:GPe,deps:[[Kl,new uw,new lw]]},{provide:Bb,useValue:r||{}},r?.useHash?{provide:_g,useClass:eIe}:{provide:_g,useClass:dX},{provide:VF,useFactory:()=>{const e=bt(_Te),t=bt(Qr),n=bt(Bb),r=bt(II),i=bt(Tb);return n.scrollOffset&&e.setOffset(n.scrollOffset),new gZ(i,r,e,t,n)}},r?.preloadingStrategy?FPe(r.preloadingStrategy).\u0275providers:[],r?.initialNavigation?jPe(r):[],r?.bindToComponentInputs?$d(8,[ZK,{provide:SI,useExisting:ZK}]).\u0275providers:[],r?.enableViewTransitions?OPe().\u0275providers:[],[{provide:SZ,useFactory:bZ},{provide:OA,multi:!0,useExisting:SZ}]]}}static forChild(n){return{ngModule:e,providers:[{provide:Ob,multi:!0,useValue:n}]}}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(xZ,8))};static#t=this.\u0275mod=p_({type:e});static#n=this.\u0275inj=Sy({})}return e})();function GPe(e){return"guarded"}function jPe(e){return["disabled"===e.initialNavigation?$d(3,[{provide:AN,multi:!0,useFactory:()=>{const t=bt(Kl);return()=>{t.setUpLocationChangeListener()}}},{provide:zF,useValue:2}]).\u0275providers:[],"enabledBlocking"===e.initialNavigation?$d(2,[{provide:zF,useValue:0},{provide:AN,multi:!0,deps:[Sc],useFactory:t=>{const n=t.get(QAe,Promise.resolve());return()=>n.then(()=>new Promise(r=>{const i=t.get(Kl),o=t.get(vZ);hZ(i,()=>{r(!0)}),t.get(II).afterPreactivation=()=>(r(!0),o.closed?Pn(void 0):o),i.initialNavigation()}))}}]).\u0275providers:[]]}const SZ=new Yt(""),jF={now:()=>(jF.delegate||Date).now(),delegate:void 0};class ou extends mr{constructor(t=1/0,n=1/0,r=jF){super(),this._bufferSize=t,this._windowTime=n,this._timestampProvider=r,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=n===1/0,this._bufferSize=Math.max(1,t),this._windowTime=Math.max(1,n)}next(t){const{isStopped:n,_buffer:r,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;n||(r.push(t),!i&&r.push(o.now()+s)),this._trimBuffer(),super.next(t)}_subscribe(t){this._throwIfClosed(),this._trimBuffer();const n=this._innerSubscribe(t),{_infiniteTimeWindow:r,_buffer:i}=this,o=i.slice();for(let s=0;s{vK([n,...CZ(e)])(r)})}function Lb(...e){return wZ(...e)}function HF(e,t,...n){if(!0===t)return void e();if(!1===t)return;const r=new a_({next:()=>{r.unsubscribe(),e()}});return ru(t(...n)).subscribe(r)}function Zl(e,t,n){let r,i=!1;return e&&"object"==typeof e?({bufferSize:r=1/0,windowTime:t=1/0,refCount:i=!1,scheduler:n}=e):r=e??1/0,function WPe(e={}){const{connector:t=(()=>new mr),resetOnError:n=!0,resetOnComplete:r=!0,resetOnRefCountZero:i=!0}=e;return o=>{let s,a,c,u=0,l=!1,d=!1;const f=()=>{a?.unsubscribe(),a=void 0},p=()=>{f(),s=c=void 0,l=d=!1},m=()=>{const h=s;p(),h?.unsubscribe()};return mo((h,g)=>{u++,!d&&!l&&f();const y=c=c??t();g.add(()=>{u--,0===u&&!d&&!l&&(a=HF(m,i))}),y.subscribe(g),!s&&u>0&&(s=new a_({next:b=>y.next(b),error:b=>{d=!0,f(),a=HF(p,n,b),y.error(b)},complete:()=>{l=!0,f(),a=HF(p,r),y.complete()}}),ru(h).subscribe(s))})(o)}}({connector:()=>new ou(r,t,n),resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:i})}var ea,e,ir;(e=ea||(ea={})).create=function t(i){return i},e.has=function n(i,o){return!!(i&o)},e.hasAll=function r(i,o){return!!o&&(i&o)===o},function(e){e.create=function t(_=512){return{current:[],offset:0,capacity:_,chunks:[]}},e.getString=function n(_){return _.chunks.length?(_.offset>0&&(_.chunks[_.chunks.length]=_.current.length===_.offset?_.current.join(""):_.current.slice(0,_.offset).join("")),_.chunks.join("")):_.current.length===_.offset?_.current.join(""):_.current.splice(0,_.offset).join("")},e.getSize=function r(_){let S=0;for(const A of _.chunks)S+=A.length;for(let A=0;A<_.offset;A++)S+=_.current[A].length;return S},e.getChunks=function i(_){return _.offset>0&&(_.chunks[_.chunks.length]=_.current.length===_.offset?_.current.join(""):_.current.slice(0,_.offset).join(""),_.offset=0),_.chunks};const o=[];function a(_,S){S>0&&l(_,o[S])}function l(_,S){_.offset===_.capacity&&(_.chunks[_.chunks.length]=_.current.join(""),_.offset=0),_.current[_.offset++]=S}!function(){let _="";for(let S=0;S<512;S++)o[S]=_,_+=" "}(),e.newline=function s(_){l(_,"\n")},e.whitespace=a,e.whitespace1=function c(_){l(_," ")},e.write=function u(_,S){S&&(_.offset===_.capacity&&(_.chunks[_.chunks.length]=_.current.join(""),_.offset=0),_.current[_.offset++]=S)},e.writeSafe=l,e.writePadLeft=function d(_,S,A){S?(a(_,A-S.length),l(_,S)):a(_,A)},e.writePadRight=function f(_,S,A){if(!S)return void a(_,A);const E=A-S.length;l(_,S),a(_,E)},e.writeInteger=function p(_,S){l(_,""+S)},e.writeIntegerAndSpace=function m(_,S){l(_,S+" ")},e.writeIntegerPadLeft=function h(_,S,A){const E=""+S;a(_,A-E.length),l(_,E)},e.writeIntegerPadRight=function g(_,S,A){const E=""+S,w=A-E.length;l(_,E),a(_,w)},e.writeFloat=function y(_,S,A){l(_,""+Math.round(A*S)/A)},e.writeFloatPadLeft=function b(_,S,A,E){const w=""+Math.round(A*S)/A;a(_,E-w.length),l(_,w)},e.writeFloatPadRight=function x(_,S,A,E){const w=""+Math.round(A*S)/A,D=E-w.length;l(_,w),a(_,D)}}(ir||(ir={}));const yi=function(){if(typeof window<"u"&&window.performance){const e=window.performance;return()=>e.now()}return typeof process<"u"&&"undefined"!==process.hrtime&&"function"==typeof process.hrtime?()=>{const e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:Date.now?()=>Date.now():()=>+new Date}();function qF(e,t=!0){if(isNaN(e))return"n/a";const n=Math.floor(e/36e5),r=Math.floor(e/6e4%60),i=Math.floor(e/1e3%60);let o=Math.floor(e%1e3).toString();for(;o.length<3;)o="0"+o;for(;!t&&o.length>1&&"0"===o[o.length-1];)o=o.substr(0,o.length-1);return n>0?`${n}h${r}m${i}.${o}s`:r>0?`${r}m${i}.${o}s`:i>0?`${i}.${o}s`:`${e.toFixed(0)}ms`}var Hr,AZ,jx;function $Pe(e,t){return e-t}function pa(e=0,t=Number.MAX_SAFE_INTEGER){let n=e;return()=>{const r=n;return n=(n+1)%t,r}}!function(e){const t=typeof btoa<"u"?btoa:s=>Buffer.from(s).toString("base64"),n=[];e.create22=function r(){let s=+new Date+yi();for(let a=0;a<16;a++)n[a]=String.fromCharCode((s+255*Math.random())%255|0),s=Math.floor(s/255);return t(n.join("")).replace(/\+/g,"-").replace(/\//g,"_").substr(0,22)},e.createv4=function i(){let s=+new Date+yi();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){const u=(s+16*Math.random())%16|0;return s=Math.floor(s/16),("x"===c?u:3&u|8).toString(16)})},e.is=function o(s){return"string"==typeof s}}(Hr||(Hr={})),function(e){class t{has(m){return!1}forEach(m,h){return h}constructor(){this.size=0}}class n{has(m){return m===this.idx}forEach(m,h){return m(this.idx,h),h}constructor(m){this.idx=m,this.size=1}}class r{has(m){return mm[h++]=g),function YPe(e){Array.prototype.sort.call(e,$Pe)}(m),this._flat=m,this._flat}forEach(m,h){return this._forEach(m,h),h}constructor(m){this.set=m,this._flat=void 0,this.size=m.size}}function a(p){return new o(p)}function l(p,m){return new r(p,m)}e.always=function s(p){return new i(p)},e.never=new t,e.ofSet=a,e.singleton=function c(p){return new n(p)},e.ofUniqueIndices=function u(p){const m=p.length;if(0===m)return new t;if(1===m)return new n(p[0]);let h=0;for(const b of p)b>h&&(h=b);if(m===h)return new i(m);if(m/h<1/12){const b=new Set;for(const x of p)b.add(x);return new o(b)}const y=new Int8Array(h+1);for(const b of p)y[b]=1;return new r(y,p.length)},e.ofMask=l,e.hasAny=function d(p,m){for(const h of m)if(p.has(h))return!0;return!1},e.complement=function f(p,m){let h=0,g=0;if(m.forEach(y=>{p.has(y)||(h++,y>g&&(g=y))}),h/g<1/12){const y=new Set;return m.forEach(b=>{p.has(b)||y.add(b)}),a(y)}{const y=new Uint8Array(g+1);return m.forEach(b=>{p.has(b)||(y[b]=1)}),l(y,h)}}}(AZ||(AZ={})),function(e){e.create=function t(r){return{ref:r}},e.set=function n(r,i){return r.ref=i,r}}(jx||(jx={}));const XPe=pa(0,2147483647);var Gh,k;!function(e){e.create=function t(r,i){return{id:XPe(),version:0,value:r,metadata:i}},e.withValue=function n(r,i){return{id:r.id,version:r.version+1,value:i,metadata:r.metadata}}}(Gh||(Gh={})),function(e){function n(o,s){return jx.set(o,Gh.withValue(o.ref,s))}e.create=function t(o,s){return jx.create(Gh.create(o,s))},e.update=n,e.set=function r(o,s){return jx.set(o,s)},e.updateIfChanged=function i(o,s){return o.ref.value!==s?n(o,s):o}}(k||(k={}));const Ag=function(){};function Wa(e,t){const n=e.length;if(n!==t.length)return!1;for(let r=0;r0&&(xt=1/Math.sqrt(xt),se[0]=he[0]*xt,se[1]=he[1]*xt,se[2]=he[2]*xt),se}function ee(se,he){return se[0]*he[0]+se[1]*he[1]+se[2]*he[2]}function q(se,he,ve){const Te=he[0],yt=he[1],xt=he[2],Ut=ve[0],Nn=ve[1],hn=ve[2];return se[0]=yt*hn-xt*Nn,se[1]=xt*Ut-Te*hn,se[2]=Te*Nn-yt*Ut,se}e.zero=t,e.clone=function n(se){const he=t();return he[0]=se[0],he[1]=se[1],he[2]=se[2],he},e.isFinite=function r(se){return KF(se[0])&&KF(se[1])&&KF(se[2])},e.hasNaN=function i(se){return isNaN(se[0])||isNaN(se[1])||isNaN(se[2])},e.setNaN=function o(se){return se[0]=NaN,se[1]=NaN,se[2]=NaN,se},e.fromObj=function s(se){return l(se.x,se.y,se.z)},e.toObj=function a(se){return{x:se[0],y:se[1],z:se[2]}},e.fromArray=function c(se,he,ve){return se[0]=he[ve+0],se[1]=he[ve+1],se[2]=he[ve+2],se},e.toArray=function u(se,he,ve){return he[ve+0]=se[0],he[ve+1]=se[1],he[ve+2]=se[2],he},e.create=l,e.ofArray=function d(se){const he=t();return he[0]=se[0],he[1]=se[1],he[2]=se[2],he},e.set=function f(se,he,ve,Te){return se[0]=he,se[1]=ve,se[2]=Te,se},e.copy=p,e.add=m,e.sub=h,e.mul=function g(se,he,ve){return se[0]=he[0]*ve[0],se[1]=he[1]*ve[1],se[2]=he[2]*ve[2],se},e.div=function y(se,he,ve){return se[0]=he[0]/ve[0],se[1]=he[1]/ve[1],se[2]=he[2]/ve[2],se},e.scale=b,e.scaleAndAdd=x,e.scaleAndSub=function _(se,he,ve,Te){return se[0]=he[0]-ve[0]*Te,se[1]=he[1]-ve[1]*Te,se[2]=he[2]-ve[2]*Te,se},e.addScalar=function S(se,he,ve){return se[0]=he[0]+ve,se[1]=he[1]+ve,se[2]=he[2]+ve,se},e.subScalar=function A(se,he,ve){return se[0]=he[0]-ve,se[1]=he[1]-ve,se[2]=he[2]-ve,se},e.round=function E(se,he){return se[0]=Math.round(he[0]),se[1]=Math.round(he[1]),se[2]=Math.round(he[2]),se},e.ceil=function w(se,he){return se[0]=Math.ceil(he[0]),se[1]=Math.ceil(he[1]),se[2]=Math.ceil(he[2]),se},e.floor=function D(se,he){return se[0]=Math.floor(he[0]),se[1]=Math.floor(he[1]),se[2]=Math.floor(he[2]),se},e.trunc=function I(se,he){return se[0]=Math.trunc(he[0]),se[1]=Math.trunc(he[1]),se[2]=Math.trunc(he[2]),se},e.abs=function R(se,he){return se[0]=Math.abs(he[0]),se[1]=Math.abs(he[1]),se[2]=Math.abs(he[2]),se},e.min=function T(se,he,ve){return se[0]=Math.min(he[0],ve[0]),se[1]=Math.min(he[1],ve[1]),se[2]=Math.min(he[2],ve[2]),se},e.max=function M(se,he,ve){return se[0]=Math.max(he[0],ve[0]),se[1]=Math.max(he[1],ve[1]),se[2]=Math.max(he[2],ve[2]),se},e.clamp=function N(se,he,ve,Te){return se[0]=Math.max(ve[0],Math.min(Te[0],he[0])),se[1]=Math.max(ve[1],Math.min(Te[1],he[1])),se[2]=Math.max(ve[2],Math.min(Te[2],he[2])),se},e.distance=function V(se,he){const ve=he[0]-se[0],Te=he[1]-se[1],yt=he[2]-se[2];return Math.sqrt(ve*ve+Te*Te+yt*yt)},e.squaredDistance=function F(se,he){const ve=he[0]-se[0],Te=he[1]-se[1],yt=he[2]-se[2];return ve*ve+Te*Te+yt*yt},e.magnitude=function G(se){const he=se[0],ve=se[1],Te=se[2];return Math.sqrt(he*he+ve*ve+Te*Te)},e.squaredMagnitude=L,e.setMagnitude=function z(se,he,ve){return b(se,$(se,he),ve)},e.negate=j,e.inverse=function Z(se,he){return se[0]=1/he[0],se[1]=1/he[1],se[2]=1/he[2],se},e.normalize=$,e.dot=ee,e.cross=q,e.lerp=function O(se,he,ve,Te){const yt=he[0],xt=he[1],Ut=he[2];return se[0]=yt+Te*(ve[0]-yt),se[1]=xt+Te*(ve[1]-xt),se[2]=Ut+Te*(ve[2]-Ut),se};const H=t();function ne(se,he){const ve=Math.sqrt(L(se)*L(he));if(0===ve)return Math.PI/2;const Te=ee(se,he)/ve;return Math.acos(os(Te,-1,1))}e.slerp=function W(se,he,ve,Te){const yt=os(ee(he,ve),-1,1),xt=Math.acos(yt)*Te;return x(H,ve,he,-yt),$(H,H),m(se,b(se,he,Math.cos(xt)),b(H,H,Math.sin(xt)))},e.hermite=function Q(se,he,ve,Te,yt,xt){const Ut=xt*xt,Nn=Ut*(2*xt-3)+1,hn=Ut*(xt-2)+xt,hr=Ut*(xt-1),Pi=Ut*(3-2*xt);return se[0]=he[0]*Nn+ve[0]*hn+Te[0]*hr+yt[0]*Pi,se[1]=he[1]*Nn+ve[1]*hn+Te[1]*hr+yt[1]*Pi,se[2]=he[2]*Nn+ve[2]*hn+Te[2]*hr+yt[2]*Pi,se},e.bezier=function fe(se,he,ve,Te,yt,xt){const Ut=1-xt,Nn=Ut*Ut,hn=xt*xt,hr=Nn*Ut,Pi=3*xt*Nn,Ks=3*hn*Ut,ho=hn*xt;return se[0]=he[0]*hr+ve[0]*Pi+Te[0]*Ks+yt[0]*ho,se[1]=he[1]*hr+ve[1]*Pi+Te[1]*Ks+yt[1]*ho,se[2]=he[2]*hr+ve[2]*Pi+Te[2]*Ks+yt[2]*ho,se},e.quadraticBezier=function X(se,he,ve,Te,yt){return se[0]=XF(he[0],ve[0],Te[0],yt),se[1]=XF(he[1],ve[1],Te[1],yt),se[2]=XF(he[2],ve[2],Te[2],yt),se},e.spline=function J(se,he,ve,Te,yt,xt,Ut){return se[0]=MI(he[0],ve[0],Te[0],yt[0],xt,Ut),se[1]=MI(he[1],ve[1],Te[1],yt[1],xt,Ut),se[2]=MI(he[2],ve[2],Te[2],yt[2],xt,Ut),se},e.random=function ce(se,he){const ve=2*Math.random()*Math.PI,Te=2*Math.random()-1,yt=Math.sqrt(1-Te*Te)*he;return se[0]=Math.cos(ve)*yt,se[1]=Math.sin(ve)*yt,se[2]=Te*he,se},e.transformMat4=function be(se,he,ve){const Te=he[0],yt=he[1],xt=he[2],Ut=1/(ve[3]*Te+ve[7]*yt+ve[11]*xt+ve[15]||1);return se[0]=(ve[0]*Te+ve[4]*yt+ve[8]*xt+ve[12])*Ut,se[1]=(ve[1]*Te+ve[5]*yt+ve[9]*xt+ve[13])*Ut,se[2]=(ve[2]*Te+ve[6]*yt+ve[10]*xt+ve[14])*Ut,se},e.transformDirection=function ae(se,he,ve){const Te=he[0],yt=he[1],xt=he[2];return se[0]=ve[0]*Te+ve[4]*yt+ve[8]*xt,se[1]=ve[1]*Te+ve[5]*yt+ve[9]*xt,se[2]=ve[2]*Te+ve[6]*yt+ve[10]*xt,$(se,se)},e.transformMat4Offset=function me(se,he,ve,Te,yt,xt){const Ut=he[0+yt],Nn=he[1+yt],hn=he[2+yt],hr=1/(ve[3+xt]*Ut+ve[7+xt]*Nn+ve[11+xt]*hn+ve[15+xt]||1);return se[0+Te]=(ve[0+xt]*Ut+ve[4+xt]*Nn+ve[8+xt]*hn+ve[12+xt])*hr,se[1+Te]=(ve[1+xt]*Ut+ve[5+xt]*Nn+ve[9+xt]*hn+ve[13+xt])*hr,se[2+Te]=(ve[2+xt]*Ut+ve[6+xt]*Nn+ve[10+xt]*hn+ve[14+xt])*hr,se},e.transformMat3=function oe(se,he,ve){const Te=he[0],yt=he[1],xt=he[2];return se[0]=Te*ve[0]+yt*ve[3]+xt*ve[6],se[1]=Te*ve[1]+yt*ve[4]+xt*ve[7],se[2]=Te*ve[2]+yt*ve[5]+xt*ve[8],se},e.transformQuat=function K(se,he,ve){const Te=he[0],yt=he[1],xt=he[2],Ut=ve[0],Nn=ve[1],hn=ve[2],hr=ve[3],Pi=hr*Te+Nn*xt-hn*yt,Ks=hr*yt+hn*Te-Ut*xt,ho=hr*xt+Ut*yt-Nn*Te,mc=-Ut*Te-Nn*yt-hn*xt;return se[0]=Pi*hr+mc*-Ut+Ks*-hn-ho*-Nn,se[1]=Ks*hr+mc*-Nn+ho*-Ut-Pi*-hn,se[2]=ho*hr+mc*-hn+Pi*-Nn-Ks*-Ut,se},e.angle=ne;const de=t(),we=t(),Le=t(),We=t(),U=t(),Y=t(),ge=t();e.dihedralAngle=function Se(se,he,ve,Te){h(de,se,he),h(we,ve,he),h(Le,he,ve),h(We,Te,ve),q(U,de,we),q(Y,Le,We);const yt=ne(U,Y);return q(ge,U,Y),ee(we,ge)>0?yt:-yt},e.directionFromSpherical=function Re(se,he,ve,Te){return e.set(se,Te*Math.cos(ve)*Math.sin(he),Te*Math.sin(ve)*Math.sin(he),Te*Math.cos(he))},e.exactEquals=function Ne(se,he){return se[0]===he[0]&&se[1]===he[1]&&se[2]===he[2]},e.equals=function Ge(se,he){const ve=se[0],Te=se[1],yt=se[2],xt=he[0],Ut=he[1],Nn=he[2];return Math.abs(ve-xt)<=vr*Math.max(1,Math.abs(ve),Math.abs(xt))&&Math.abs(Te-Ut)<=vr*Math.max(1,Math.abs(Te),Math.abs(Ut))&&Math.abs(yt-Nn)<=vr*Math.max(1,Math.abs(yt),Math.abs(Nn))};const $e=t();e.makeRotation=function tt(se,he,ve){const Te=ne(he,ve);if(Math.abs(Te)<1e-4)return le.setIdentity(se);if(Math.abs(Te-Math.PI)0?p(se,he):j(se,p(se,he)),se};const Qn=t(),qe=t();e.triangleNormal=function dt(se,he,ve,Te){return h(Qn,ve,he),h(qe,Te,he),$(se,q(se,Qn,qe))},e.toString=function gt(se,he){return`[${se[0].toPrecision(he)} ${se[1].toPrecision(he)} ${se[2].toPrecision(he)}]`},e.origin=l(0,0,0),e.unit=l(1,1,1),e.negUnit=l(-1,-1,-1),e.unitX=l(1,0,0),e.unitY=l(0,1,0),e.unitZ=l(0,0,1),e.negUnitX=l(-1,0,0),e.negUnitY=l(0,-1,0),e.negUnitZ=l(0,0,-1)}(v||(v={}));const Wx=Math.PI/2,EZ=Math.PI/180;function Yn(e){return e*EZ}function su(e){return e/EZ}function $x(e){return 0!==e&&!(e&e-1)}function PZ(e,t){return e*t}function le(){return le.zero()}function Kt(){return Kt.zero()}function Me(){return Me.zero()}function nn(){return nn.zero()}function RI(e){return Object.keys(e)}function Rr(e){throw new Error("unreachable")}function kI(e){return"function"==typeof e?.then}function _r(){return _r.zero()}var wn,te,Xn,QF,Dg,Yx;function Ig(e,t,n){for(;t9||s<0)return o*i|0;i=10*i+s|0}return o*i}function MZ(e,t,n,r){return 43===t.charCodeAt(n)&&n++,e*Math.pow(10,jh(t,n,r))}function rp(e,t,n){let r=t,i=1,o=0,s=0,a=1;for(45===e.charCodeAt(r)?(i=-1,++r):43===e.charCodeAt(r)&&++r;r=0&&c<10)){if(-2===c){for(++r;r=0&&c<10))return 53===c||21===c?MZ(i*(o+s/a),e,r+1,n):i*(o+s/a);s=10*s+c,a*=10,++r}return i*(o+s/a)}if(53===c||21===c)return MZ(i*o,e,r+1,n);break}o=10*o+c,++r}return i*o}function kZ(e,t,n,r){return{schema:n,__array:void 0,isDefined:0===r,rowCount:t,value:o=>e,valueKind:o=>r,toArray:o=>{const{array:s}=qx(t,o);for(let a=0,c=s.length;a!0}}function NI({value:e,valueKind:t,areValuesEqual:n,rowCount:r,schema:i}){return{schema:i,__array:void 0,isDefined:!0,rowCount:r,value:e,valueKind:t||(o=>0),toArray:o=>{const{array:s,start:a}=qx(r,o);for(let c=0,u=s.length;ce(o)===e(s))}}function ip({array:e,schema:t,valueKind:n}){const r=e.length,i=t.T,o="str"===t.valueType?"lowercase"===t.transform?a=>{const c=e[a];return"string"==typeof c?c.toLowerCase():`${c??i}`.toLowerCase()}:"uppercase"===t.transform?a=>{const c=e[a];return"string"==typeof c?c.toUpperCase():`${c??i}`.toUpperCase()}:a=>{const c=e[a];return"string"==typeof c?c:`${c??i}`}:a=>e[a],s=WF(e);return{schema:t,__array:e,isDefined:!0,rowCount:r,value:o,valueKind:n||(a=>0),toArray:"str"===t.valueType?"lowercase"===t.transform?a=>{const{start:c,end:u}=Ub(r,a),l=new(a&&typeof a.array<"u"?a.array:e.constructor)(u-c);for(let d=0,f=u-c;d{const{start:c,end:u}=Ub(r,a),l=new(a&&typeof a.array<"u"?a.array:e.constructor)(u-c);for(let d=0,f=u-c;d{const{start:c,end:u}=Ub(r,a),l=new(a&&typeof a.array<"u"?a.array:e.constructor)(u-c);for(let d=0,f=u-c;dPI(e,a):a=>{const{start:c,end:u}=Ub(r,a);if(0===c&&u===e.length)return e;const l=new(a&&typeof a.array<"u"?a.array:e.constructor)(u-c);for(let d=0,f=u-c;de[a]===e[c]}}function FI(e,t,n){return e[t]-e[n]}function Tg(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function NZ(e,t,n,r){const i=n+r>>1;return t(e,n,r)>0?t(e,n,i)>0?t(e,i,r)>0?i:r:n:t(e,r,i)>0?t(e,i,n)>0?i:n:r}function _Me(e,t,n){const{cmp:r,swap:i,data:o,parts:s}=e;let a=t+1,c=n;for(i(o,t,NZ(o,r,t,n));r(o,c,t)>0;)--c;for(let u=t+1;u<=c;u++){const l=r(o,u,t);if(l>0){for(i(o,u,c),--c;r(o,c,t)>0;)--c;u--}else 0===l&&(i(o,u,a),a++)}for(let u=t;u=r&&t(e,s,s+1)>0;)n(e,s,s+1),s-=1}}function BI(e,t,n){const{parts:r}=e;for(;ts;)--o;for(let a=n+1;a<=o;a++){const c=e[a];if(c>s){for(Tg(e,a,o),--o;e[o]>s;)--o;a--}else c===s&&(Tg(e,a,i),++i)}for(let a=n;a=t&&e[o]>i;)e[o+1]=e[o],o-=1;e[o+1]=i}}function ZF(e,t,n,r){for(;nge)return!1;return!0}function l(U,Y,ge,Se){U[4*ge+Y]=Se}function h(U,Y){return U[0]=Y[0],U[1]=Y[1],U[2]=Y[2],U[3]=Y[3],U[4]=Y[4],U[5]=Y[5],U[6]=Y[6],U[7]=Y[7],U[8]=Y[8],U[9]=Y[9],U[10]=Y[10],U[11]=Y[11],U[12]=Y[12],U[13]=Y[13],U[14]=Y[14],U[15]=Y[15],U}function x(U,Y){const ge=Y[0]+Y[5]+Y[10];let Se=0;return ge>0?(Se=2*Math.sqrt(ge+1),U[3]=.25*Se,U[0]=(Y[6]-Y[9])/Se,U[1]=(Y[8]-Y[2])/Se,U[2]=(Y[1]-Y[4])/Se):Y[0]>Y[5]&&Y[0]>Y[10]?(Se=2*Math.sqrt(1+Y[0]-Y[5]-Y[10]),U[3]=(Y[6]-Y[9])/Se,U[0]=.25*Se,U[1]=(Y[1]+Y[4])/Se,U[2]=(Y[8]+Y[2])/Se):Y[5]>Y[10]?(Se=2*Math.sqrt(1+Y[5]-Y[0]-Y[10]),U[3]=(Y[8]-Y[2])/Se,U[0]=(Y[1]+Y[4])/Se,U[1]=.25*Se,U[2]=(Y[6]+Y[9])/Se):(Se=2*Math.sqrt(1+Y[10]-Y[0]-Y[5]),U[3]=(Y[1]-Y[4])/Se,U[0]=(Y[8]+Y[2])/Se,U[1]=(Y[6]+Y[9])/Se,U[2]=.25*Se),U}function A(U,Y){const ge=Y[0],Se=Y[1],Re=Y[2],Ne=Y[3],Ge=Y[4],$e=Y[5],tt=Y[6],ke=Y[7],Xe=Y[8],ot=Y[9],_t=Y[10],ut=Y[11],Ct=Y[12],Et=Y[13],Xt=Y[14],ln=Y[15],Qn=ge*$e-Se*Ge,qe=ge*tt-Re*Ge,dt=ge*ke-Ne*Ge,gt=Se*tt-Re*$e,se=Se*ke-Ne*$e,he=Re*ke-Ne*tt,ve=Xe*Et-ot*Ct,Te=Xe*Xt-_t*Ct,yt=Xe*ln-ut*Ct,xt=ot*Xt-_t*Et,Ut=ot*ln-ut*Et,Nn=_t*ln-ut*Xt;let hn=Qn*Nn-qe*Ut+dt*xt+gt*yt-se*Te+he*ve;return!!hn&&(hn=1/hn,U[0]=($e*Nn-tt*Ut+ke*xt)*hn,U[1]=(Re*Ut-Se*Nn-Ne*xt)*hn,U[2]=(Et*he-Xt*se+ln*gt)*hn,U[3]=(_t*se-ot*he-ut*gt)*hn,U[4]=(tt*yt-Ge*Nn-ke*Te)*hn,U[5]=(ge*Nn-Re*yt+Ne*Te)*hn,U[6]=(Xt*dt-Ct*he-ln*qe)*hn,U[7]=(Xe*he-_t*dt+ut*qe)*hn,U[8]=(Ge*Ut-$e*yt+ke*ve)*hn,U[9]=(Se*yt-ge*Ut-Ne*ve)*hn,U[10]=(Ct*se-Et*dt+ln*Qn)*hn,U[11]=(ot*dt-Xe*se-ut*Qn)*hn,U[12]=($e*Te-Ge*xt-tt*ve)*hn,U[13]=(ge*xt-Se*Te+Re*ve)*hn,U[14]=(Et*qe-Ct*gt-Xt*Qn)*hn,U[15]=(Xe*gt-ot*qe+_t*Qn)*hn,!0)}function w(U,Y,ge){const Se=Y[0],Re=Y[1],Ne=Y[2],Ge=Y[3],$e=Y[4],tt=Y[5],ke=Y[6],Xe=Y[7],ot=Y[8],_t=Y[9],ut=Y[10],Ct=Y[11],Et=Y[12],Xt=Y[13],ln=Y[14],Qn=Y[15];let qe=ge[0],dt=ge[1],gt=ge[2],se=ge[3];return U[0]=qe*Se+dt*$e+gt*ot+se*Et,U[1]=qe*Re+dt*tt+gt*_t+se*Xt,U[2]=qe*Ne+dt*ke+gt*ut+se*ln,U[3]=qe*Ge+dt*Xe+gt*Ct+se*Qn,qe=ge[4],dt=ge[5],gt=ge[6],se=ge[7],U[4]=qe*Se+dt*$e+gt*ot+se*Et,U[5]=qe*Re+dt*tt+gt*_t+se*Xt,U[6]=qe*Ne+dt*ke+gt*ut+se*ln,U[7]=qe*Ge+dt*Xe+gt*Ct+se*Qn,qe=ge[8],dt=ge[9],gt=ge[10],se=ge[11],U[8]=qe*Se+dt*$e+gt*ot+se*Et,U[9]=qe*Re+dt*tt+gt*_t+se*Xt,U[10]=qe*Ne+dt*ke+gt*ut+se*ln,U[11]=qe*Ge+dt*Xe+gt*Ct+se*Qn,qe=ge[12],dt=ge[13],gt=ge[14],se=ge[15],U[12]=qe*Se+dt*$e+gt*ot+se*Et,U[13]=qe*Re+dt*tt+gt*_t+se*Xt,U[14]=qe*Ne+dt*ke+gt*ut+se*ln,U[15]=qe*Ge+dt*Xe+gt*Ct+se*Qn,U}function F(U,Y,ge){let Se=ge[0],Re=ge[1],Ne=ge[2],Ge=Math.sqrt(Se*Se+Re*Re+Ne*Ne);if(Math.abs(Ge)"u"?vr:Y)},e.hasNaN=function c(U){for(let Y=0;Y<16;Y++)if(isNaN(U[Y]))return!0;return!1},e.areEqual=u,e.setValue=l,e.getValue=function d(U,Y,ge){return U[4*ge+Y]},e.toArray=function f(U,Y,ge){return Y[ge+0]=U[0],Y[ge+1]=U[1],Y[ge+2]=U[2],Y[ge+3]=U[3],Y[ge+4]=U[4],Y[ge+5]=U[5],Y[ge+6]=U[6],Y[ge+7]=U[7],Y[ge+8]=U[8],Y[ge+9]=U[9],Y[ge+10]=U[10],Y[ge+11]=U[11],Y[ge+12]=U[12],Y[ge+13]=U[13],Y[ge+14]=U[14],Y[ge+15]=U[15],Y},e.fromArray=function p(U,Y,ge){return U[0]=Y[ge+0],U[1]=Y[ge+1],U[2]=Y[ge+2],U[3]=Y[ge+3],U[4]=Y[ge+4],U[5]=Y[ge+5],U[6]=Y[ge+6],U[7]=Y[ge+7],U[8]=Y[ge+8],U[9]=Y[ge+9],U[10]=Y[ge+10],U[11]=Y[ge+11],U[12]=Y[ge+12],U[13]=Y[ge+13],U[14]=Y[ge+14],U[15]=Y[ge+15],U},e.fromBasis=function m(U,Y,ge,Se){return i(U),l(U,0,0,Y[0]),l(U,1,0,Y[1]),l(U,2,0,Y[2]),l(U,0,1,ge[0]),l(U,1,1,ge[1]),l(U,2,1,ge[2]),l(U,0,2,Se[0]),l(U,1,2,Se[1]),l(U,2,2,Se[2]),l(U,3,3,1),U},e.copy=h,e.clone=function g(U){return h(t(),U)},e.getTranslation=function y(U,Y){return U[0]=Y[12],U[1]=Y[13],U[2]=Y[14],U},e.getScaling=function b(U,Y){const ge=Y[0],Se=Y[1],Re=Y[2],Ne=Y[4],Ge=Y[5],$e=Y[6],tt=Y[8],ke=Y[9],Xe=Y[10];return U[0]=Math.sqrt(ge*ge+Se*Se+Re*Re),U[1]=Math.sqrt(Ne*Ne+Ge*Ge+$e*$e),U[2]=Math.sqrt(tt*tt+ke*ke+Xe*Xe),U},e.getRotation=x,e.extractRotation=function _(U,Y){const ge=1/Math.sqrt(Y[0]*Y[0]+Y[1]*Y[1]+Y[2]*Y[2]),Se=1/Math.sqrt(Y[4]*Y[4]+Y[5]*Y[5]+Y[6]*Y[6]),Re=1/Math.sqrt(Y[8]*Y[8]+Y[9]*Y[9]+Y[10]*Y[10]);return U[0]=Y[0]*ge,U[1]=Y[1]*ge,U[2]=Y[2]*ge,U[3]=0,U[4]=Y[4]*Se,U[5]=Y[5]*Se,U[6]=Y[6]*Se,U[7]=0,U[8]=Y[8]*Re,U[9]=Y[9]*Re,U[10]=Y[10]*Re,U[11]=0,U[12]=0,U[13]=0,U[14]=0,U[15]=1,U},e.transpose=function S(U,Y){if(U===Y){const ge=Y[1],Se=Y[2],Re=Y[3],Ne=Y[6],Ge=Y[7],$e=Y[11];U[1]=Y[4],U[2]=Y[8],U[3]=Y[12],U[4]=ge,U[6]=Y[9],U[7]=Y[13],U[8]=Se,U[9]=Ne,U[11]=Y[14],U[12]=Re,U[13]=Ge,U[14]=$e}else U[0]=Y[0],U[1]=Y[4],U[2]=Y[8],U[3]=Y[12],U[4]=Y[1],U[5]=Y[5],U[6]=Y[9],U[7]=Y[13],U[8]=Y[2],U[9]=Y[6],U[10]=Y[10],U[11]=Y[14],U[12]=Y[3],U[13]=Y[7],U[14]=Y[11],U[15]=Y[15];return U},e.tryInvert=A,e.invert=function E(U,Y){return A(U,Y)||console.warn("non-invertible matrix.",Y),U},e.mul=w,e.mulOffset=function D(U,Y,ge,Se,Re,Ne){const Ge=Y[0+Re],$e=Y[1+Re],tt=Y[2+Re],ke=Y[3+Re],Xe=Y[4+Re],ot=Y[5+Re],_t=Y[6+Re],ut=Y[7+Re],Ct=Y[8+Re],Et=Y[9+Re],Xt=Y[10+Re],ln=Y[11+Re],Qn=Y[12+Re],qe=Y[13+Re],dt=Y[14+Re],gt=Y[15+Re];let se=ge[0+Ne],he=ge[1+Ne],ve=ge[2+Ne],Te=ge[3+Ne];return U[0+Se]=se*Ge+he*Xe+ve*Ct+Te*Qn,U[1+Se]=se*$e+he*ot+ve*Et+Te*qe,U[2+Se]=se*tt+he*_t+ve*Xt+Te*dt,U[3+Se]=se*ke+he*ut+ve*ln+Te*gt,se=ge[4+Ne],he=ge[5+Ne],ve=ge[6+Ne],Te=ge[7+Ne],U[4+Se]=se*Ge+he*Xe+ve*Ct+Te*Qn,U[5+Se]=se*$e+he*ot+ve*Et+Te*qe,U[6+Se]=se*tt+he*_t+ve*Xt+Te*dt,U[7+Se]=se*ke+he*ut+ve*ln+Te*gt,se=ge[8+Ne],he=ge[9+Ne],ve=ge[10+Ne],Te=ge[11+Ne],U[8+Se]=se*Ge+he*Xe+ve*Ct+Te*Qn,U[9+Se]=se*$e+he*ot+ve*Et+Te*qe,U[10+Se]=se*tt+he*_t+ve*Xt+Te*dt,U[11+Se]=se*ke+he*ut+ve*ln+Te*gt,se=ge[12+Ne],he=ge[13+Ne],ve=ge[14+Ne],Te=ge[15+Ne],U[12+Se]=se*Ge+he*Xe+ve*Ct+Te*Qn,U[13+Se]=se*$e+he*ot+ve*Et+Te*qe,U[14+Se]=se*tt+he*_t+ve*Xt+Te*dt,U[15+Se]=se*ke+he*ut+ve*ln+Te*gt,U},e.mul3=function I(U,Y,ge,Se){return w(U,w(U,Y,ge),Se)},e.translate=function R(U,Y,ge){const Se=ge[0],Re=ge[1],Ne=ge[2];let Ge,$e,tt,ke,Xe,ot,_t,ut,Ct,Et,Xt,ln;return Y===U?(U[12]=Y[0]*Se+Y[4]*Re+Y[8]*Ne+Y[12],U[13]=Y[1]*Se+Y[5]*Re+Y[9]*Ne+Y[13],U[14]=Y[2]*Se+Y[6]*Re+Y[10]*Ne+Y[14],U[15]=Y[3]*Se+Y[7]*Re+Y[11]*Ne+Y[15]):(Ge=Y[0],$e=Y[1],tt=Y[2],ke=Y[3],Xe=Y[4],ot=Y[5],_t=Y[6],ut=Y[7],Ct=Y[8],Et=Y[9],Xt=Y[10],ln=Y[11],U[0]=Ge,U[1]=$e,U[2]=tt,U[3]=ke,U[4]=Xe,U[5]=ot,U[6]=_t,U[7]=ut,U[8]=Ct,U[9]=Et,U[10]=Xt,U[11]=ln,U[12]=Ge*Se+Xe*Re+Ct*Ne+Y[12],U[13]=$e*Se+ot*Re+Et*Ne+Y[13],U[14]=tt*Se+_t*Re+Xt*Ne+Y[14],U[15]=ke*Se+ut*Re+ln*Ne+Y[15]),U},e.fromTranslation=function T(U,Y){return U[0]=1,U[1]=0,U[2]=0,U[3]=0,U[4]=0,U[5]=1,U[6]=0,U[7]=0,U[8]=0,U[9]=0,U[10]=1,U[11]=0,U[12]=Y[0],U[13]=Y[1],U[14]=Y[2],U[15]=1,U},e.setTranslation=function M(U,Y){return U[12]=Y[0],U[13]=Y[1],U[14]=Y[2],U},e.setAxes=function N(U,Y,ge,Se){return U[0]=ge[0],U[4]=ge[1],U[8]=ge[2],U[1]=Se[0],U[5]=Se[1],U[9]=Se[2],U[2]=Y[0],U[6]=Y[1],U[10]=Y[2],U},e.rotate=function V(U,Y,ge,Se){let Re=Se[0],Ne=Se[1],Ge=Se[2],$e=Math.sqrt(Re*Re+Ne*Ne+Ge*Ge);if(Math.abs($e)0&&(ut=1/Math.sqrt(ut),Xe*=ut,ot*=ut,_t*=ut);let Ct=tt*_t-ke*ot,Et=ke*Xe-$e*_t,Xt=$e*ot-tt*Xe;return ut=Ct*Ct+Et*Et+Xt*Xt,ut>0&&(ut=1/Math.sqrt(ut),Ct*=ut,Et*=ut,Xt*=ut),U[0]=Ct,U[1]=Et,U[2]=Xt,U[3]=0,U[4]=ot*Xt-_t*Et,U[5]=_t*Ct-Xe*Xt,U[6]=Xe*Et-ot*Ct,U[7]=0,U[8]=Xe,U[9]=ot,U[10]=_t,U[11]=0,U[12]=Re,U[13]=Ne,U[14]=Ge,U[15]=1,U},e.fromPermutation=function ne(U,Y){i(U);for(let ge=0;ge<4;ge++)l(U,ge,Y[ge],1);return U},e.getMaxScaleOnAxis=function de(U){return Math.sqrt(Math.max(U[0]*U[0]+U[1]*U[1]+U[2]*U[2],U[4]*U[4]+U[5]*U[5]+U[6]*U[6],U[8]*U[8]+U[9]*U[9]+U[10]*U[10]))};const we=[1,0,0],Le=[0,1,0],We=[0,0,1];e.rotX90=F(t(),Yn(90),we),e.rotX180=F(t(),Yn(180),we),e.rotY90=F(t(),Yn(90),Le),e.rotY180=F(t(),Yn(180),Le),e.rotY270=F(t(),Yn(270),Le),e.rotZ90=F(t(),Yn(90),We),e.rotZ180=F(t(),Yn(180),We),e.rotXY90=w(t(),e.rotX90,e.rotY90),e.rotZY90=w(t(),e.rotZ90,e.rotY90),e.rotZYZ90=w(t(),e.rotZY90,e.rotZ90),e.rotZ90X180=w(t(),e.rotZ90,e.rotX180),e.rotY90Z180=w(t(),e.rotY90,e.rotZ180),e.id=n()}(le||(le={})),function(e){function t(){const O=[.1,0,0,0,0,0,0,0,0];return O[0]=0,O}function n(){const O=t();return O[0]=1,O[1]=0,O[2]=0,O[3]=0,O[4]=1,O[5]=0,O[6]=0,O[7]=0,O[8]=1,O}function a(O,H){return O[0]=H[0],O[1]=H[1],O[2]=H[2],O[3]=H[4],O[4]=H[5],O[5]=H[6],O[6]=H[8],O[7]=H[9],O[8]=H[10],O}e.zero=t,e.identity=n,e.setIdentity=function r(O){return O[0]=1,O[1]=0,O[2]=0,O[3]=0,O[4]=1,O[5]=0,O[6]=0,O[7]=0,O[8]=1,O},e.toArray=function i(O,H,W){return H[W+0]=O[0],H[W+1]=O[1],H[W+2]=O[2],H[W+3]=O[3],H[W+4]=O[4],H[W+5]=O[5],H[W+6]=O[6],H[W+7]=O[7],H[W+8]=O[8],H},e.fromArray=function o(O,H,W){return O[0]=H[W+0],O[1]=H[W+1],O[2]=H[W+2],O[3]=H[W+3],O[4]=H[W+4],O[5]=H[W+5],O[6]=H[W+6],O[7]=H[W+7],O[8]=H[W+8],O},e.fromColumns=function s(O,H,W,Q){return O[0]=H[0],O[1]=H[1],O[2]=H[2],O[3]=W[0],O[4]=W[1],O[5]=W[2],O[6]=Q[0],O[7]=Q[1],O[8]=Q[2],O},e.fromMat4=a,e.create=function c(O,H,W,Q,fe,X,J,ce,be){const ae=t();return ae[0]=O,ae[1]=H,ae[2]=W,ae[3]=Q,ae[4]=fe,ae[5]=X,ae[6]=J,ae[7]=ce,ae[8]=be,ae};const u=n();function p(O,H,W){for(let Q=0;Q<9;Q++)if(Math.abs(O[Q]-H[Q])>W)return!1;return!0}function g(O,H){return O[0]=H[0],O[1]=H[1],O[2]=H[2],O[3]=H[3],O[4]=H[4],O[5]=H[5],O[6]=H[6],O[7]=H[7],O[8]=H[8],O}function y(O,H){if(O===H){const W=H[1],Q=H[2],fe=H[5];O[1]=H[3],O[2]=H[6],O[3]=W,O[5]=H[7],O[6]=Q,O[7]=fe}else O[0]=H[0],O[1]=H[3],O[2]=H[6],O[3]=H[1],O[4]=H[4],O[5]=H[7],O[6]=H[2],O[7]=H[5],O[8]=H[8];return O}function b(O,H){const W=H[0],Q=H[1],fe=H[2],X=H[3],J=H[4],ce=H[5],be=H[6],ae=H[7],me=H[8],oe=me*J-ce*ae,K=-me*X+ce*be,ne=ae*X-J*be;let de=W*oe+Q*K+fe*ne;return de?(de=1/de,O[0]=oe*de,O[1]=(-me*Q+fe*ae)*de,O[2]=(ce*Q-fe*J)*de,O[3]=K*de,O[4]=(me*W-fe*be)*de,O[5]=(-ce*W+fe*X)*de,O[6]=ne*de,O[7]=(-ae*W+Q*be)*de,O[8]=(J*W-Q*X)*de,O):(console.warn("non-invertible matrix.",H),O)}function S(O){const fe=O[3],X=O[4],J=O[5],ce=O[6],be=O[7],ae=O[8];return O[0]*(ae*X-J*be)+O[1]*(-ae*fe+J*ce)+O[2]*(be*fe-X*ce)}function A(O){return O[0]+O[4]+O[8]}function E(O,H,W){return O[0]=H[0]-W[0],O[1]=H[1]-W[1],O[2]=H[2]-W[2],O[3]=H[3]-W[3],O[4]=H[4]-W[4],O[5]=H[5]-W[5],O[6]=H[6]-W[6],O[7]=H[7]-W[7],O[8]=H[8]-W[8],O}function T(O,H,W){return O[0]=H[0]*W,O[1]=H[1]*W,O[2]=H[2]*W,O[3]=H[3]*W,O[4]=H[4]*W,O[5]=H[5]*W,O[6]=H[6]*W,O[7]=H[7]*W,O[8]=H[8]*W,O}e.isIdentity=function l(O,H){return p(O,u,typeof H>"u"?vr:H)},e.hasNaN=function d(O){for(let H=0;H<9;H++)if(isNaN(O[H]))return!0;return!1},e.clone=function f(O){return g(t(),O)},e.areEqual=p,e.setValue=function m(O,H,W,Q){O[3*W+H]=Q},e.getValue=function h(O,H,W){return O[3*W+H]},e.copy=g,e.transpose=y,e.invert=b,e.symmtricFromUpper=function x(O,H){return O===H?(O[3]=H[1],O[6]=H[2],O[7]=H[5]):(O[0]=H[0],O[1]=H[1],O[2]=H[2],O[3]=H[1],O[4]=H[4],O[5]=H[5],O[6]=H[2],O[7]=H[5],O[8]=H[8]),O},e.symmtricFromLower=function _(O,H){return O===H?(O[1]=H[3],O[2]=H[6],O[5]=H[7]):(O[0]=H[0],O[1]=H[3],O[2]=H[6],O[3]=H[3],O[4]=H[4],O[5]=H[7],O[6]=H[6],O[7]=H[7],O[8]=H[8]),O},e.determinant=S,e.trace=A,e.sub=E,e.add=function w(O,H,W){return O[0]=H[0]+W[0],O[1]=H[1]+W[1],O[2]=H[2]+W[2],O[3]=H[3]+W[3],O[4]=H[4]+W[4],O[5]=H[5]+W[5],O[6]=H[6]+W[6],O[7]=H[7]+W[7],O[8]=H[8]+W[8],O},e.mul=function D(O,H,W){const Q=H[0],fe=H[1],X=H[2],J=H[3],ce=H[4],be=H[5],ae=H[6],me=H[7],oe=H[8],K=W[0],ne=W[1],de=W[2],we=W[3],Le=W[4],We=W[5],U=W[6],Y=W[7],ge=W[8];return O[0]=K*Q+ne*J+de*ae,O[1]=K*fe+ne*ce+de*me,O[2]=K*X+ne*be+de*oe,O[3]=we*Q+Le*J+We*ae,O[4]=we*fe+Le*ce+We*me,O[5]=we*X+Le*be+We*oe,O[6]=U*Q+Y*J+ge*ae,O[7]=U*fe+Y*ce+ge*me,O[8]=U*X+Y*be+ge*oe,O},e.subScalar=function I(O,H,W){return O[0]=H[0]-W,O[1]=H[1]-W,O[2]=H[2]-W,O[3]=H[3]-W,O[4]=H[4]-W,O[5]=H[5]-W,O[6]=H[6]-W,O[7]=H[7]-W,O[8]=H[8]-W,O},e.addScalar=function R(O,H,W){return O[0]=H[0]+W,O[1]=H[1]+W,O[2]=H[2]+W,O[3]=H[3]+W,O[4]=H[4]+W,O[5]=H[5]+W,O[6]=H[6]+W,O[7]=H[7]+W,O[8]=H[8]+W,O},e.mulScalar=T;const M=Math.PI/3,N=t();e.symmetricEigenvalues=function V(O,H){const W=H[1]*H[1]+H[2]*H[2]+H[5]*H[5];if(0===W)O[0]=H[0],O[1]=H[4],O[2]=H[8];else{const Q=A(H)/3,fe=H[0]-Q,X=H[4]-Q,J=H[8]-Q,be=Math.sqrt((fe*fe+X*X+J*J+2*W)/6);T(N,e.Identity,Q),E(N,H,N),T(N,N,1/be);const ae=S(N)/2,me=ae<=-1?M:ae>=1?0:Math.acos(ae)/3;O[0]=Q+2*be*Math.cos(me),O[2]=Q+2*be*Math.cos(me+2*M),O[1]=3*Q-O[0]-O[2]}return O};const F=[.1,0,0],G=[.1,0,0],L=[.1,0,0],z=[.1,0,0],j=[.1,0,0],Z=[.1,0,0];e.eigenvector=function $(O,H,W){v.set(F,H[0]-W,H[1],H[2]),v.set(G,H[1],H[4]-W,H[5]),v.set(L,H[2],H[5],H[8]-W),v.cross(z,F,G),v.cross(j,F,L),v.cross(Z,G,L);const Q=v.dot(z,z),fe=v.dot(j,j),X=v.dot(Z,Z);let J=Q,ce=0;return fe>J&&(J=fe,ce=1),X>J&&(ce=2),0===ce?v.scale(O,z,1/Math.sqrt(Q)):1===ce?v.scale(O,j,1/Math.sqrt(fe)):v.scale(O,Z,1/Math.sqrt(X)),O},e.directionTransform=function ee(O,H){return a(O,H),b(O,O),y(O,O),O},e.Identity=n(),e.innerProduct=function q(O,H){return O[0]*H[0]+O[1]*H[1]+O[2]*H[2]+O[3]*H[3]+O[4]*H[4]+O[5]*H[5]+O[6]*H[6]+O[7]*H[7]+O[8]*H[8]}}(Kt||(Kt={})),function(e){function t(){const w=[.1,0];return w[0]=0,w}e.zero=t,e.clone=function n(w){const D=t();return D[0]=w[0],D[1]=w[1],D},e.create=function r(w,D){const I=t();return I[0]=w,I[1]=D,I},e.hasNaN=function i(w){return isNaN(w[0])||isNaN(w[1])},e.toArray=function o(w,D,I){return D[I+0]=w[0],D[I+1]=w[1],D},e.fromArray=function s(w,D,I){return w[0]=D[I+0],w[1]=D[I+1],w},e.copy=function a(w,D){return w[0]=D[0],w[1]=D[1],w},e.set=function c(w,D,I){return w[0]=D,w[1]=I,w},e.add=function u(w,D,I){return w[0]=D[0]+I[0],w[1]=D[1]+I[1],w},e.sub=function l(w,D,I){return w[0]=D[0]-I[0],w[1]=D[1]-I[1],w},e.mul=function d(w,D,I){return w[0]=D[0]*I[0],w[1]=D[1]*I[1],w},e.div=function f(w,D,I){return w[0]=D[0]/I[0],w[1]=D[1]/I[1],w},e.scale=function p(w,D,I){return w[0]=D[0]*I,w[1]=D[1]*I,w},e.round=function m(w,D){return w[0]=Math.round(D[0]),w[1]=Math.round(D[1]),w},e.ceil=function h(w,D){return w[0]=Math.ceil(D[0]),w[1]=Math.ceil(D[1]),w},e.floor=function g(w,D){return w[0]=Math.floor(D[0]),w[1]=Math.floor(D[1]),w},e.distance=function y(w,D){const I=D[0]-w[0],R=D[1]-w[1];return Math.sqrt(I*I+R*R)},e.squaredDistance=function b(w,D){const I=D[0]-w[0],R=D[1]-w[1];return I*I+R*R},e.magnitude=function x(w){const D=w[0],I=w[1];return Math.sqrt(D*D+I*I)},e.squaredMagnitude=function _(w){const D=w[0],I=w[1];return D*D+I*I},e.inverse=function S(w,D){return w[0]=1/D[0],w[1]=1/D[1],w},e.areEqual=function A(w,D){return w[0]===D[0]&&w[1]===D[1]},e.toString=function E(w,D){return`[${w[0].toPrecision(D)} ${w[1].toPrecision(D)}}]`}}(Me||(Me={})),function(e){function t(){const T=[.1,0,0,0];return T[0]=0,T}function i(T,M){return T[0]=M.center[0],T[1]=M.center[1],T[2]=M.center[2],T[3]=M.radius,T}e.zero=t,e.clone=function n(T){const M=t();return M[0]=T[0],M[1]=T[1],M[2]=T[2],M[3]=T[3],M},e.create=function r(T,M,N,V){const F=t();return F[0]=T,F[1]=M,F[2]=N,F[3]=V,F},e.fromSphere=i,e.ofSphere=function o(T){return i(t(),T)},e.hasNaN=function s(T){return isNaN(T[0])||isNaN(T[1])||isNaN(T[2])||isNaN(T[3])},e.toArray=function a(T,M,N){return M[N+0]=T[0],M[N+1]=T[1],M[N+2]=T[2],M[N+3]=T[3],M},e.fromArray=function c(T,M,N){return T[0]=M[N+0],T[1]=M[N+1],T[2]=M[N+2],T[3]=M[N+3],T},e.toVec3Array=function u(T,M,N){M[N+0]=T[0],M[N+1]=T[1],M[N+2]=T[2]},e.fromVec3Array=function l(T,M,N){return T[0]=M[N+0],T[1]=M[N+1],T[2]=M[N+2],T[3]=0,T},e.copy=function d(T,M){return T[0]=M[0],T[1]=M[1],T[2]=M[2],T[3]=M[3],T},e.set=function f(T,M,N,V,F){return T[0]=M,T[1]=N,T[2]=V,T[3]=F,T},e.add=function p(T,M,N){return T[0]=M[0]+N[0],T[1]=M[1]+N[1],T[2]=M[2]+N[2],T[3]=M[3]+N[3],T},e.distance=function m(T,M){const N=M[0]-T[0],V=M[1]-T[1],F=M[2]-T[2],G=M[3]-T[3];return Math.sqrt(N*N+V*V+F*F+G*G)},e.scale=function h(T,M,N){return T[0]=M[0]*N,T[1]=M[1]*N,T[2]=M[2]*N,T[4]=M[4]*N,T},e.round=function g(T,M){return T[0]=Math.round(M[0]),T[1]=Math.round(M[1]),T[2]=Math.round(M[2]),T[3]=Math.round(M[3]),T},e.ceil=function y(T,M){return T[0]=Math.ceil(M[0]),T[1]=Math.ceil(M[1]),T[2]=Math.ceil(M[2]),T[3]=Math.ceil(M[3]),T},e.floor=function b(T,M){return T[0]=Math.floor(M[0]),T[1]=Math.floor(M[1]),T[2]=Math.floor(M[2]),T[3]=Math.floor(M[3]),T},e.squaredDistance=function x(T,M){const N=M[0]-T[0],V=M[1]-T[1],F=M[2]-T[2],G=M[3]-T[3];return N*N+V*V+F*F+G*G},e.norm=function _(T){const M=T[0],N=T[1],V=T[2],F=T[3];return Math.sqrt(M*M+N*N+V*V+F*F)},e.squaredNorm=function S(T){const M=T[0],N=T[1],V=T[2],F=T[3];return M*M+N*N+V*V+F*F},e.transformMat4=function A(T,M,N){const V=M[0],F=M[1],G=M[2],L=M[3];return T[0]=N[0]*V+N[4]*F+N[8]*G+N[12]*L,T[1]=N[1]*V+N[5]*F+N[9]*G+N[13]*L,T[2]=N[2]*V+N[6]*F+N[10]*G+N[14]*L,T[3]=N[3]*V+N[7]*F+N[11]*G+N[15]*L,T},e.dot=function E(T,M){return T[0]*M[0]+T[1]*M[1]+T[2]*M[2]+T[3]*M[3]},e.inverse=function w(T,M){return T[0]=1/M[0],T[1]=1/M[1],T[2]=1/M[2],T[3]=1/M[3],T},e.exactEquals=function D(T,M){return T[0]===M[0]&&T[1]===M[1]&&T[2]===M[2]&&T[3]===M[3]},e.equals=function I(T,M){const N=T[0],V=T[1],F=T[2],G=T[3],L=M[0],z=M[1],j=M[2],Z=M[3];return Math.abs(N-L)<=vr*Math.max(1,Math.abs(N),Math.abs(L))&&Math.abs(V-z)<=vr*Math.max(1,Math.abs(V),Math.abs(z))&&Math.abs(F-j)<=vr*Math.max(1,Math.abs(F),Math.abs(j))&&Math.abs(G-Z)<=vr*Math.max(1,Math.abs(G),Math.abs(Z))},e.toString=function R(T,M){return`[${T[0].toPrecision(M)} ${T[1].toPrecision(M)} ${T[2].toPrecision(M)} ${T[3].toPrecision(M)}]`}}(nn||(nn={})),function(e){function t(){const q=[.1,0,0,0];return q[0]=0,q}function n(){const q=t();return q[3]=1,q}function s(q,O,H){H*=.5;const W=Math.sin(H);return q[0]=W*O[0],q[1]=W*O[1],q[2]=W*O[2],q[3]=Math.cos(H),q}function p(q,O,H,W){const Q=O[0],fe=O[1],X=O[2],J=O[3];let oe,K,ne,de,we,ce=H[0],be=H[1],ae=H[2],me=H[3];return K=Q*ce+fe*be+X*ae+J*me,K<0&&(K=-K,ce=-ce,be=-be,ae=-ae,me=-me),1-K>1e-6?(oe=Math.acos(K),ne=Math.sin(oe),de=Math.sin((1-W)*oe)/ne,we=Math.sin(W*oe)/ne):(de=1-W,we=W),q[0]=de*Q+we*ce,q[1]=de*fe+we*be,q[2]=de*X+we*ae,q[3]=de*J+we*me,q}function y(q,O){const H=O[0]+O[4]+O[8];let W;if(H>0)W=Math.sqrt(H+1),q[3]=.5*W,W=.5/W,q[0]=(O[5]-O[7])*W,q[1]=(O[6]-O[2])*W,q[2]=(O[1]-O[3])*W;else{let Q=0;O[4]>O[0]&&(Q=1),O[8]>O[3*Q+Q]&&(Q=2);const fe=(Q+1)%3,X=(Q+2)%3;W=Math.sqrt(O[3*Q+Q]-O[3*fe+fe]-O[3*X+X]+1),q[Q]=.5*W,W=.5/W,q[3]=(O[3*fe+X]-O[3*X+fe])*W,q[fe]=(O[3*fe+Q]+O[3*Q+fe])*W,q[X]=(O[3*X+Q]+O[3*Q+X])*W}return q}e.zero=t,e.identity=n,e.setIdentity=function r(q){q[0]=0,q[1]=0,q[2]=0,q[3]=1},e.hasNaN=function i(q){return isNaN(q[0])||isNaN(q[1])||isNaN(q[2])||isNaN(q[3])},e.create=function o(q,O,H,W){const Q=n();return Q[0]=q,Q[1]=O,Q[2]=H,Q[3]=W,Q},e.setAxisAngle=s,e.getAxisAngle=function a(q,O){const H=2*Math.acos(O[3]),W=Math.sin(H/2);return 0!==W?(q[0]=O[0]/W,q[1]=O[1]/W,q[2]=O[2]/W):(q[0]=1,q[1]=0,q[2]=0),H},e.multiply=function c(q,O,H){const W=O[0],Q=O[1],fe=O[2],X=O[3],J=H[0],ce=H[1],be=H[2],ae=H[3];return q[0]=W*ae+X*J+Q*be-fe*ce,q[1]=Q*ae+X*ce+fe*J-W*be,q[2]=fe*ae+X*be+W*ce-Q*J,q[3]=X*ae-W*J-Q*ce-fe*be,q},e.rotateX=function u(q,O,H){H*=.5;const W=O[0],Q=O[1],fe=O[2],X=O[3],J=Math.sin(H),ce=Math.cos(H);return q[0]=W*ce+X*J,q[1]=Q*ce+fe*J,q[2]=fe*ce-Q*J,q[3]=X*ce-W*J,q},e.rotateY=function l(q,O,H){H*=.5;const W=O[0],Q=O[1],fe=O[2],X=O[3],J=Math.sin(H),ce=Math.cos(H);return q[0]=W*ce-fe*J,q[1]=Q*ce+X*J,q[2]=fe*ce+W*J,q[3]=X*ce-Q*J,q},e.rotateZ=function d(q,O,H){H*=.5;const W=O[0],Q=O[1],fe=O[2],X=O[3],J=Math.sin(H),ce=Math.cos(H);return q[0]=W*ce+Q*J,q[1]=Q*ce-W*J,q[2]=fe*ce+X*J,q[3]=X*ce-fe*J,q},e.calculateW=function f(q,O){const H=O[0],W=O[1],Q=O[2];return q[0]=H,q[1]=W,q[2]=Q,q[3]=Math.sqrt(Math.abs(1-H*H-W*W-Q*Q)),q},e.slerp=p,e.invert=function m(q,O){const H=O[0],W=O[1],Q=O[2],fe=O[3],X=H*H+W*W+Q*Q+fe*fe,J=X?1/X:0;return q[0]=-H*J,q[1]=-W*J,q[2]=-Q*J,q[3]=fe*J,q},e.conjugate=function h(q,O){return q[0]=-O[0],q[1]=-O[1],q[2]=-O[2],q[3]=O[3],q},e.dot=function g(q,O){return q[0]*O[0]+q[1]*O[1]+q[2]*O[2]+q[3]*O[3]},e.fromMat3=y,e.fromEuler=function b(q,O,H){const[W,Q,fe]=O,X=Math.cos(W/2),J=Math.cos(Q/2),ce=Math.cos(fe/2),be=Math.sin(W/2),ae=Math.sin(Q/2),me=Math.sin(fe/2);switch(H){case"XYZ":q[0]=be*J*ce+X*ae*me,q[1]=X*ae*ce-be*J*me,q[2]=X*J*me+be*ae*ce,q[3]=X*J*ce-be*ae*me;break;case"YXZ":q[0]=be*J*ce+X*ae*me,q[1]=X*ae*ce-be*J*me,q[2]=X*J*me-be*ae*ce,q[3]=X*J*ce+be*ae*me;break;case"ZXY":q[0]=be*J*ce-X*ae*me,q[1]=X*ae*ce+be*J*me,q[2]=X*J*me+be*ae*ce,q[3]=X*J*ce-be*ae*me;break;case"ZYX":q[0]=be*J*ce-X*ae*me,q[1]=X*ae*ce+be*J*me,q[2]=X*J*me-be*ae*ce,q[3]=X*J*ce+be*ae*me;break;case"YZX":q[0]=be*J*ce+X*ae*me,q[1]=X*ae*ce+be*J*me,q[2]=X*J*me-be*ae*ce,q[3]=X*J*ce-be*ae*me;break;case"XZY":q[0]=be*J*ce-X*ae*me,q[1]=X*ae*ce-be*J*me,q[2]=X*J*me+be*ae*ce,q[3]=X*J*ce+be*ae*me;break;default:Rr()}return q};const x=[0,0,0];function M(q,O){const H=O[0],W=O[1],Q=O[2],fe=O[3];let X=H*H+W*W+Q*Q+fe*fe;return X>0&&(X=1/Math.sqrt(X),q[0]=H*X,q[1]=W*X,q[2]=Q*X,q[3]=fe*X),q}e.fromUnitVec3=function _(q,O,H){let W=v.dot(O,H)+1;return WMath.abs(O[2])?v.set(x,-O[1],O[0],0):v.set(x,0,-O[2],O[1])):v.cross(x,O,H),q[0]=x[0],q[1]=x[1],q[2]=x[2],q[3]=W,M(q,q),q},e.clone=function S(q){const O=t();return O[0]=q[0],O[1]=q[1],O[2]=q[2],O[3]=q[3],O},e.toArray=function A(q,O,H){return O[H+0]=q[0],O[H+1]=q[1],O[H+2]=q[2],O[H+3]=q[3],O},e.fromArray=function E(q,O,H){return q[0]=O[H+0],q[1]=O[H+1],q[2]=O[H+2],q[3]=O[H+3],q},e.copy=function w(q,O){return q[0]=O[0],q[1]=O[1],q[2]=O[2],q[3]=O[3],q},e.set=function D(q,O,H,W,Q){return q[0]=O,q[1]=H,q[2]=W,q[3]=Q,q},e.exactEquals=function I(q,O){return q[0]===O[0]&&q[1]===O[1]&&q[2]===O[2]&&q[3]===O[3]},e.equals=function R(q,O){const H=q[0],W=q[1],Q=q[2],fe=q[3],X=O[0],J=O[1],ce=O[2],be=O[3];return Math.abs(H-X)<=vr*Math.max(1,Math.abs(H),Math.abs(X))&&Math.abs(W-J)<=vr*Math.max(1,Math.abs(W),Math.abs(J))&&Math.abs(Q-ce)<=vr*Math.max(1,Math.abs(Q),Math.abs(ce))&&Math.abs(fe-be)<=vr*Math.max(1,Math.abs(fe),Math.abs(be))},e.add=function T(q,O,H){return q[0]=O[0]+H[0],q[1]=O[1]+H[1],q[2]=O[2]+H[2],q[3]=O[3]+H[3],q},e.normalize=M;const N=[0,0,0],V=[1,0,0],F=[0,1,0];e.rotationTo=function G(q,O,H){const W=v.dot(O,H);return W<-.999999?(v.cross(N,V,O),v.magnitude(N)<1e-6&&v.cross(N,F,O),v.normalize(N,N),s(q,N,Math.PI),q):W>.999999?(q[0]=0,q[1]=0,q[2]=0,q[3]=1,q):(v.cross(N,O,H),q[0]=N[0],q[1]=N[1],q[2]=N[2],q[3]=1+W,M(q,q))};const L=t(),z=t();e.sqlerp=function j(q,O,H,W,Q,fe){return p(L,O,Q,fe),p(z,H,W,fe),p(q,L,z,2*fe*(1-fe)),q};const Z=[0,0,0,0,0,0,0,0,0];e.setAxes=function $(q,O,H,W){return Z[0]=H[0],Z[3]=H[1],Z[6]=H[2],Z[1]=W[0],Z[4]=W[1],Z[7]=W[2],Z[2]=-O[0],Z[5]=-O[1],Z[8]=-O[2],M(q,y(q,Z))},e.toString=function ee(q,O){return`[${q[0].toPrecision(O)} ${q[1].toPrecision(O)} ${q[2].toPrecision(O)} ${q[3].toPrecision(O)}]`},e.Identity=n()}(_r||(_r={})),function(e){function r(S,A,E){const w=function t(S,A,E){const w=[];for(let I=0;Iw[D],set:(w,D,I)=>w[D]=I,add:(w,D,I)=>w[D]+=I,dataOffset:w=>w,getCoords:(w,D)=>(D[0]=w,D)};case 2:if(0===E[0]&&1===E[1]){const w=A[0];return{get:(D,I,R)=>D[R*w+I],set:(D,I,R,T)=>D[R*w+I]=T,add:(D,I,R,T)=>D[R*w+I]+=T,dataOffset:(D,I)=>I*w+D,getCoords:(D,I)=>(I[0]=D%w,I[1]=Math.floor(D/w),I)}}if(1===E[0]&&0===E[1]){const w=A[1];return{get:(D,I,R)=>D[I*w+R],set:(D,I,R,T)=>D[I*w+R]=T,add:(D,I,R,T)=>D[I*w+R]+=T,dataOffset:(D,I)=>D*w+I,getCoords:(D,I)=>(I[0]=Math.floor(D/w),I[1]=D%w,I)}}throw new Error("bad axis order");case 3:if(0===E[0]&&1===E[1]&&2===E[2]){const w=A[0],D=A[1],I=w*D;return{get:(R,T,M,N)=>R[T+M*w+N*I],set:(R,T,M,N,V)=>R[T+M*w+N*I]=V,add:(R,T,M,N,V)=>R[T+M*w+N*I]+=V,dataOffset:(R,T,M)=>R+T*w+M*I,getCoords:(R,T)=>{const M=Math.floor(R/w);return T[0]=R%w,T[1]=M%D,T[2]=Math.floor(M/D),T}}}if(0===E[0]&&2===E[1]&&1===E[2]){const w=A[0],D=A[2],I=w*D;return{get:(R,T,M,N)=>R[T+N*w+M*I],set:(R,T,M,N,V)=>R[T+N*w+M*I]=V,add:(R,T,M,N,V)=>R[T+N*w+M*I]+=V,dataOffset:(R,T,M)=>R+M*w+T*I,getCoords:(R,T)=>{const M=Math.floor(R/w);return T[0]=R%w,T[1]=Math.floor(M/D),T[2]=M%D,T}}}if(1===E[0]&&0===E[1]&&2===E[2]){const w=A[1],D=A[0],I=w*D;return{get:(R,T,M,N)=>R[M+T*w+N*I],set:(R,T,M,N,V)=>R[M+T*w+N*I]=V,add:(R,T,M,N,V)=>R[M+T*w+N*I]+=V,dataOffset:(R,T,M)=>T+R*w+M*I,getCoords:(R,T)=>{const M=Math.floor(R/w);return T[0]=M%D,T[1]=R%w,T[2]=Math.floor(M/D),T}}}if(1===E[0]&&2===E[1]&&0===E[2]){const w=A[1],D=A[2],I=w*D;return{get:(R,T,M,N)=>R[M+N*w+T*I],set:(R,T,M,N,V)=>R[M+N*w+T*I]=V,add:(R,T,M,N,V)=>R[M+N*w+T*I]+=V,dataOffset:(R,T,M)=>T+M*w+R*I,getCoords:(R,T)=>{const M=Math.floor(R/w);return T[0]=Math.floor(M/D),T[1]=R%w,T[2]=M%D,T}}}if(2===E[0]&&0===E[1]&&1===E[2]){const w=A[2],D=A[0],I=w*D;return{get:(R,T,M,N)=>R[N+T*w+M*I],set:(R,T,M,N,V)=>R[N+T*w+M*I]=V,add:(R,T,M,N,V)=>R[N+T*w+M*I]+=V,dataOffset:(R,T,M)=>M+R*w+T*I,getCoords:(R,T)=>{const M=Math.floor(R/w);return T[0]=M%D,T[1]=Math.floor(M/D),T[2]=R%w,T}}}if(2===E[0]&&1===E[1]&&0===E[2]){const w=A[2],D=A[1],I=w*D;return{get:(R,T,M,N)=>R[N+M*w+T*I],set:(R,T,M,N,V)=>R[N+M*w+T*I]=V,add:(R,T,M,N,V)=>R[N+M*w+T*I]+=V,dataOffset:(R,T,M)=>M+T*w+R*I,getCoords:(R,T)=>{const M=Math.floor(R/w);return T[0]=Math.floor(M/D),T[1]=M%D,T[2]=R%w,T}}}throw new Error("bad axis order");default:return{get:(w,...D)=>w[h(S,D)],set:(w,...D)=>w[h(S,D)]=D[D.length-1],add:(w,...D)=>w[h(S,D)]+=D[D.length-1],dataOffset:(...w)=>h(S,w),getCoords:(w,D)=>function g(S,A,E){const{dimensions:w,axisOrderFastToSlow:D}=S,I=w.length;let R=A;for(let T=0;Tnew(w||S.defaultCtor)(E)}function h(S,A){const{accessDimensions:E,axisOrderFastToSlow:w}=S,D=E.length-1;let I=E[D]*A[w[D]];for(let R=D-1;R>=0;R--)I=(I+A[w[R]])*E[R];return I}function b(S,A){const E=[];for(let w=0;wb(E,A)},e.convertToCanonicalAxisIndicesSlowToFast=function _(S){const A=new Int32Array(S.length);for(let E=0;Eb(E,A)}}(wn||(wn={})),function(e){let t;function r(I,R){return kZ(R.T,I,R,1)}function o(I){return NI(I)}!function(I){function N(z,j=I.float){return{"@type":"tensor",T:z.create(),space:z,valueType:"tensor",baseType:j}}I.str={"@type":"str",T:"",valueType:"str"},I.ustr={"@type":"str",T:"",valueType:"str",transform:"uppercase"},I.lstr={"@type":"str",T:"",valueType:"str",transform:"lowercase"},I.int={"@type":"int",T:0,valueType:"int"},I.coord={"@type":"coord",T:0,valueType:"float"},I.float={"@type":"float",T:0,valueType:"float"},I.Str=function R(z){var j;return{"@type":"str",T:null!==(j=z?.defaultValue)&&void 0!==j?j:"",transform:z?.transform,valueType:"str"}},I.Int=function T(z=0){return{"@type":"int",T:z,valueType:"int"}},I.Float=function M(z=0){return{"@type":"float",T:z,valueType:"float"}},I.Tensor=N,I.Vector=function V(z,j=I.float){return N(wn.Vector(z,"int"===j["@type"]?Int32Array:Float64Array),j)},I.Matrix=function F(z,j,Z=I.float){return N(wn.ColumnMajorMatrix(z,j,"int"===Z["@type"]?Int32Array:Float64Array),Z)},I.Aliased=function G(z){return z},I.List=function L(z,j,Z=[]){return{"@type":"list",T:Z,separator:z,itemParse:j,valueType:"list"}}}(t=e.Schema||(e.Schema={})),e.is=function n(I){return!!I&&!!I.schema&&!!I.value},e.ValueKind={Present:0,NotPresent:1,Unknown:2},e.Undefined=r,e.ofConst=function i(I,R,T){return kZ(I,R,T,0)},e.ofLambda=o,e.range=function s(I,R){return o({value:T=>T+I,rowCount:Math.max(R-I+1,0),schema:t.int})},e.ofArray=function a(I){return ip(I)},e.ofIntArray=function c(I){return ip({array:I,schema:t.int})},e.ofFloatArray=function u(I){return ip({array:I,schema:t.float})},e.ofStringArray=function l(I){return ip({array:I,schema:t.str})},e.ofStringAliasArray=function d(I){return ip({array:I,schema:t.Aliased(t.str)})},e.ofStringListArray=function f(I,R=","){return ip({array:I,schema:t.List(R,T=>T)})},e.ofIntTokens=function p(I){const{count:R,data:T,indices:M}=I;return NI({value:N=>jh(T,M[2*N],M[2*N+1])||0,rowCount:R,schema:t.int})},e.ofFloatTokens=function m(I){const{count:R,data:T,indices:M}=I;return NI({value:N=>rp(T,M[2*N],M[2*N+1])||0,rowCount:R,schema:t.float})},e.ofStringTokens=function h(I){const{count:R,data:T,indices:M}=I;return NI({value:N=>{const V=T.substring(M[2*N],M[2*N+1]);return"."===V||"?"===V?"":V},rowCount:R,schema:t.str})},e.window=function g(I,R,T){return function cMe(e,t,n){return e.isDefined?0===t&&n===e.rowCount?e:e.__array&&WF(e.__array)?function uMe(e,t,n){const r=PI(e.__array,{start:t,end:n}),i=e.valueKind;return ip({array:r,schema:e.schema,valueKind:o=>i(t+o)})}(e,t,n):function lMe(e,t,n){const r=e.value,i=e.valueKind,o=e.areValuesEqual,s=0===t?r:c=>r(c+t),a=n-t;return{schema:e.schema,__array:void 0,isDefined:e.isDefined,rowCount:a,value:s,valueKind:0===t?i:c=>i(c+t),toArray:c=>{const{array:u}=qx(a,c);for(let l=0,d=u.length;lo(c+t,u+t)}}(e,t,n):te.Undefined(n-t,e.schema)}(I,R,T)},e.view=function y(I,R,T=!0){return function fMe(e,t,n){return 0===e.rowCount||n&&function dMe(e,t){if(e.length!==t)return!1;for(let n=0,r=e.length;ni(t[o])})}(e,t):function hMe(e,t){const n=e.value,r=e.valueKind,i=e.areValuesEqual,s=t.length;return{schema:e.schema,__array:void 0,isDefined:e.isDefined,rowCount:s,value:a=>n(t[a]),valueKind:a=>r(t[a]),toArray:a=>{const{array:c}=qx(s,a);for(let u=0,l=c.length;ui(t[a],t[c])}}(e,t)}(I,R,T)},e.createFirstIndexMap=function b(I){return function sMe(e){const t=new Map;for(let n=0,r=e.rowCount;nt.has(n)?t.get(n):-1}(I)},e.mapToArray=function _(I,R,T){return function mMe(e,t,n){const r=new n(e.rowCount);for(let i=0,o=e.rowCount;iS[I][D],valueKind:I=>typeof S[I][D]>"u"?1:0});return A},e.ofArrays=function a(_,S){var A;const E=Object.create(null),w=Object.keys(_);E._rowCount=0,E._columns=w,E._schema=_;for(const D of w)typeof S[D]<"u"?(E[D]=te.ofArray({array:S[D],schema:_[D]}),E._rowCount=null===(A=S[D])||void 0===A?void 0:A.length):E[D]=te.Undefined(E._rowCount,_[D]);return E},e.view=c,e.pick=function u(_,S,A){const E=[];for(let w=0,D=_._rowCount;wS(I,R));let E=!0;for(let D=0,I=A.length;D0}has(t){return this._set.has(t)}assets(t,n){const r=this._assets.get(t);if(r)for(const i of r)i.dispose();n?this._assets.set(t,n):this._assets.delete(t)}dispose(){this._assets.forEach(t=>{for(const n of t)n.dispose()})}}const OI=Object.prototype.hasOwnProperty;function IMe(e,t){let n=!1;for(const r of Object.keys(t))if(OI.call(t,r)&&t[r]!==e[r]){n=!0;break}return n?Object.assign({},e,t):e}function JF(e,t){if(!e)return!t;if(!t)return!1;const n=Object.keys(e);if(Object.keys(t).length!==n.length)return!1;for(const r of n)if(!OI.call(e,r)||e[r]!==t[r])return!1;return!0}function Jl(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Array){const t=[];for(let n=0,r=e.length;nt&&(t=e[n]);return t}function LI(e){let t=1/0;for(let n=0,r=e.length;nn&&(n=e[r]);return[t,n]}function OZ(e,t=1,n=0){const r=e.length;let i=0;for(let o=n;o=0||(e.push(t),0))}function Eg(e,t){const n=e.indexOf(t);if(n<0)return!1;for(let r=n,i=e.length-1;rwindow.setImmediate(e,...t),clearImmediate:e=>window.clearImmediate(e)}:{setImmediate,clearImmediate}:function kMe(){const e=function(){const h=typeof window<"u"&&window,g=typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&self;return h||typeof global<"u"&&global||g}(),t={},n=typeof document<"u"?document:void 0;let i,r=1;function s(h){delete t[h]}function c(h){const g=t[h];s(h),function a(h){const g=h.callback,y=h.args;switch(y.length){case 0:g();break;case 1:g(y[0]);break;case 2:g(y[0],y[1]);break;case 3:g(y[0],y[1],y[2]);break;default:g.apply(void 0,y)}}(g)}return typeof process<"u"&&"[object process]"==={}.toString.call(process)?function u(){i=function(h){process.nextTick(function(){c(h)})}}():function l(){if(e&&e.postMessage&&!e.importScripts){let h=!0;const g=e.onmessage;return e.onmessage=function(){h=!1},e.postMessage("","*"),e.onmessage=g,h}}()?function d(){const h="setImmediate$"+Math.random()+"$",g=function(y){y.source===e&&"string"==typeof y.data&&0===y.data.indexOf(h)&&c(+y.data.slice(h.length))};window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent("onmessage",g),i=function(y){window.postMessage(h+y,"*")}}():typeof MessageChannel<"u"?function f(){const h=new MessageChannel;h.port1.onmessage=function(g){c(g.data)},i=function(g){h.port2.postMessage(g)}}():n&&"onreadystatechange"in n.createElement("script")?function p(){const h=n.documentElement;i=function(g){let y=n.createElement("script");y.onreadystatechange=function(){c(g),y.onreadystatechange=null,h.removeChild(y),y=null},h.appendChild(y)}}():function m(){i=function(h){setTimeout(c,0,h)}}(),{setImmediate:function o(h,...g){return"function"!=typeof h&&(h=new Function(""+h)),t[r]={callback:h,args:g},i(r),r++},clearImmediate:s}}();function NMe(e){tB.setImmediate(e)}const Zx={setImmediate:tB.setImmediate,clearImmediate:tB.clearImmediate,immediatePromise:()=>new Promise(NMe),delay:(e,t=void 0)=>new Promise(n=>setTimeout(n,e,t))};let Qx=function(){try{return!0}catch{return!1}}(),un=function(){try{const t=process.env.DEBUG;return"*"===t||"molstar"===t}catch{return!1}}(),lt=!1;const Jx=[],nB=typeof performance<"u"&&!!performance.mark&&performance.measure&<var e2;function LMe(e,t,n=250){const r=zZ(e,t,n);return new jI(r,r.root)}function UZ(e,t){return rB(t,e)}function VZ(e){return{taskId:e.id,taskName:e.name,message:"",startedTime:0,canAbort:!0,isIndeterminate:!0,current:0,max:0}}function zZ(e,t,n){const r={abortRequested:!1,treeAborted:!1,reason:""};return{updateRateMs:n,lastNotified:yi(),observer:t,abortToken:r,taskId:e.id,root:{progress:VZ(e),children:[]},tryAbort:VMe(r)}}function VMe(e){return t=>{e.abortRequested=!0,e.reason=t||e.reason}}function GZ(e){return{progress:{...e.progress},children:e.children.map(GZ)}}function jZ(e){return e.progress.canAbort&&e.children.every(jZ)}function rB(e,t){return iB.apply(this,arguments)}function iB(){return iB=ie(function*(e,t){e2.markStart(e),t.node.progress.startedTime=yi();try{const n=yield e.f(t);return e2.markEnd(e),e2.measure(e),t.info.abortToken.abortRequested&&HZ(t.info),n}catch(n){throw Oe.isAbort(n)&&(t.isAborted=!0,t.node.children.length>0&&(yield new Promise(r=>{t.onChildrenFinished=r})),e.onAbort&&e.onAbort()),n}}),iB.apply(this,arguments)}function HZ(e){throw e.abortToken.treeAborted||(e.abortToken.treeAborted=!0,qZ(e.root),WZ(e,yi())),Oe.Aborted(e.abortToken.reason)}function qZ(e){const t=e.progress;t.isIndeterminate=!0,t.canAbort=!1,t.message="Aborting...";for(const n of e.children)qZ(n)}function WZ(e,t){e.lastNotified=t;const n=function zMe(e){return{root:GZ(e.root),canAbort:jZ(e.root),requestAbort:e.tryAbort}}(e);e.observer(n)}!function(e){function t(s){return`startTask${s.id}`}function n(s){return`endTask${s.id}`}e.markStart=function r(s){nB&&performance.mark(t(s))},e.markEnd=function i(s){nB&&performance.mark(n(s))},e.measure=function o(s){nB&&performance.measure(`\u2733\ufe0f ${s.name}`,t(s),n(s))}}(e2||(e2={}));class jI{checkAborted(){this.info.abortToken.abortRequested&&(this.isAborted=!0,HZ(this.info))}get shouldUpdate(){return this.checkAborted(),yi()-this.lastUpdatedTime>this.info.updateRateMs}updateProgress(t){if(this.checkAborted(),!t)return;const n=this.node.progress;"string"==typeof t?(n.message=t,n.isIndeterminate=!0):(typeof t.canAbort<"u"&&(n.canAbort=t.canAbort),typeof t.message<"u"&&(n.message=t.message),typeof t.current<"u"&&(n.current=t.current),typeof t.max<"u"&&(n.max=t.max),n.isIndeterminate=typeof n.current>"u"||typeof n.max>"u",typeof t.isIndeterminate<"u"&&(n.isIndeterminate=t.isIndeterminate))}update(t,n){if(this.lastUpdatedTime=yi(),this.updateProgress(t),!n)return WZ(this.info,this.lastUpdatedTime),this.checkAborted(),Zx.immediatePromise()}runChild(t,n){var r=this;return ie(function*(){r.updateProgress(n);const i={progress:VZ(t),children:[]},o=r.node.children;o.push(i);const s=new jI(r.info,i);try{return yield rB(t,s)}catch(a){if(Oe.isAbort(a)&&r.isAborted)return;throw a}finally{const a=o.indexOf(i);if(a>=0){for(let c=a,u=o.length-1;c0;){s+=u;const d=yi()-c;l+=d,a+=d,e.shouldUpdate&&(yield i(e,n,s),o=Math.round(l*s/a)+1,c=yi(),l=0)}return e.shouldUpdate&&(yield i(e,n,s)),n}),oB.apply(this,arguments)}function HMe(e,t,n){return e[t].keys[p].key){l=!1;break}if(c&&l){for(let p=0;p"Aborted"+(d?": "+d:"")}},e.create=o,e.constant=function s(d,f){return o(d,function(){var p=ie(function*(m){return f});return function(m){return p.apply(this,arguments)}}())},e.empty=function a(){return o("",function(){var d=ie(function*(f){});return function(f){return d.apply(this,arguments)}}())},e.fail=function c(d,f){return o(d,function(){var p=ie(function*(m){throw new Error(f)});return function(m){return p.apply(this,arguments)}}())},e.resolveInContext=function u(d,f){return n(d)?f?d.runInContext(f):d.run():d};const l=pa(0,1073741823)}(Oe||(Oe={})),function(e){function t(r,i=""){const o=r.progress;if(!r.children.length)return o.isIndeterminate?`${i}${o.taskName}: ${o.message}`:`${i}${o.taskName}: [${o.current}/${o.max}] ${o.message}`;const s=i+" |_ ",a=r.children.map(c=>t(c,s));return o.isIndeterminate?`${i}${o.taskName}: ${o.message}\n${a.join("\n")}`:`${i}${o.taskName}: [${o.current}/${o.max}] ${o.message}\n${a.join("\n")}`}e.format=function n(r){return t(r.root)}}($Z||($Z={})),function(e){function n(f){const p=f.growBy*f.elementSize;f.currentSize=p,f.currentIndex=0,f.currentChunk=new f.ctor(p),f.allocatedSize+=p,f.chunks[f.chunks.length]=f.currentChunk}function l(f,p){const{ctor:m,chunks:h,currentIndex:g}=f;if(!h.length)return new m(0);if(1===h.length&&(p||g===f.allocatedSize))return h[0];let y=0;for(let S=0,A=h.length-1;S=f.currentSize)b.set(_,x);else for(let S=0,A=_.length;S=f.currentSize&&n(f);const y=f.currentChunk,b=f.currentIndex;return y[b]=p,y[b+1]=m,y[b+2]=h,y[b+3]=g,f.currentIndex+=4,f.elementCount++},e.add3=function i(f,p,m,h){f.currentIndex>=f.currentSize&&n(f);const g=f.currentChunk,y=f.currentIndex;return g[y]=p,g[y+1]=m,g[y+2]=h,f.currentIndex+=3,f.elementCount++},e.add2=function o(f,p,m){f.currentIndex>=f.currentSize&&n(f);const h=f.currentChunk,g=f.currentIndex;return h[g]=p,h[g+1]=m,f.currentIndex+=2,f.elementCount++},e.add=function s(f,p){return f.currentIndex>=f.currentSize&&n(f),f.currentChunk[f.currentIndex]=p,f.currentIndex+=1,f.elementCount++},e.addRepeat=function a(f,p,m){for(let h=0;h=f.currentSize&&n(f),f.currentChunk[f.currentIndex++]=m,f.elementCount++;return f.elementCount},e.addMany=function c(f,p){const{elementSize:m}=f;for(let h=0,g=p.length;h=f.currentSize&&n(f);const{currentChunk:y}=f;for(let b=0;b"u")return g;if("number"==typeof h)return g.currentChunk=new f(h*p),g.allocatedSize=h*p,g.currentSize=g.currentChunk.length,g.chunks[0]=g.currentChunk,g;const y=h;if(y.length%p!=0)throw new Error("initialChunk length must be a multiple of the element size.");return g.currentChunk=y,g.allocatedSize=y.length,g.currentSize=y.length,g.chunks[0]=y,g}}(ze||(ze={}));class WMe{createGroup(t,n){const r=this.id++,i=[t];return this.groups[r]=i,{id:r,keys:i,value:n}}add(t,n){const r=this.getHash(n);if(this.byHash.has(r)){const i=this.byHash.get(r);for(let s=0,a=i.length;s>4;return t=(3735928559^t)+(t<<5),t^=t>>11,t}function Pg(e,t){let n=23;return n=31*n+e|0,n=31*n+t|0,n^=n>>4,n=(3735928559^n)+(n<<5),n^=n>>11,n}function aB(e){let t=0;for(let n=0,r=e.length;n>>0}function cB(e,t){for(let n=0,r=e.length;n=n&&t0&&r>0&&WI(e)>=qI(t)&&qI(e)<=WI(t)}function cRe(e,t){return Mg(e)?!Mg(t)||sp(e)<=sp(t)&&Hh(e)>=Hh(t):0===Mg(t)}function fB(e,t){const n=sp(e);if(t<=n)return 0;const r=Hh(e);return t>=r?r-n:t-n}function uRe(e,t,n){const r=sp(n),i=sp(e);if(t<=r+i)return r;const o=Hh(n);return t>=o+i?o:t-i}function JZ(e,t,n){return dB(fB(e,t),fB(e,n+1))}function lRe(e,t){return QZ(e,t)?dB(Math.max(sp(e),sp(t)),Math.min(Hh(e),Hh(t))):KZ}function dRe(e,t){return Mg(JZ(e,qI(t),WI(t)))}var Ce;!function(e){e.Empty=KZ,e.ofSingleton=t=>ZZ(t,t),e.ofRange=ZZ,e.ofBounds=dB,e.ofLength=eRe,e.is=tRe,e.has=iRe,e.indexOf=oRe,e.getAt=sRe,e.start=sp,e.end=Hh,e.min=qI,e.max=WI,e.size=Mg,e.hashCode=nRe,e.toString=rRe,e.areEqual=aRe,e.areIntersecting=QZ,e.isSubInterval=cRe,e.findPredecessorIndex=fB,e.findPredecessorIndexInInterval=uRe,e.findRange=JZ,e.intersectionSize=dRe,e.intersect=lRe}(Ce||(Ce={}));const n2=[];function fRe(e){return[e]}function pRe(e){return e}function hRe(e){return Ou(e),e}function eQ(e,t){if(t2?function XMe(e,t,n,r){let i=23;return i=31*i+e|0,i=31*i+t|0,i=31*i+n|0,i=31*i+r|0,i^=i>>4,i=(3735928559^i)+(i<<5),i^=i>>11,i}(t,e[0],e[t-1],e[t>>1]):function YMe(e,t,n){let r=23;return r=31*r+e|0,r=31*r+t|0,r=31*r+n|0,r^=r>>4,r=(3735928559^r)+(r<<5),r^=r>>11,r}(t,e[0],e[t-1]):0}function vRe(e){const t=e.length;return t>5?`[${e[0]}, ${e[1]}, ..., ${e[t-1]}], length ${t}`:`[${e.join(", ")}]`}function rQ(e,t){const n=e.length;return 0===n?-1:e[0]<=t&&t<=e[n-1]?sQ(e,t,0,n):-1}function _Re(e,t,n){return iQ(e,t,Ce.start(n),Ce.end(n))}function iQ(e,t,n,r){return 0===e.length||r<=n?-1:e[n]<=t&&t<=e[r-1]?sQ(e,t,n,r):-1}function xRe(e,t){return rQ(e,t)>=0}function oQ(e,t){if(e===t)return!0;let n=e.length;if(n!==t.length||e[0]!==t[0]||e[n-1]!==t[n-1])return!1;if(tQ(e))return!0;n--;for(let r=1;re[n-1]?n:aQ(e,t,0,n)}function SRe(e,t,n){const r=Ce.start(n),i=Ce.end(n),o=e[r];return t<=o?r:i>r&&t>e[i-1]?i:t-o<=11?function wRe(e,t,n,r){for(let i=n;io){for(let c=i;c<=o;c++)if(t===e[c])return c;return-1}const s=i+o>>1,a=e[s];if(ta))return s;i=s+1}}return-1}function aQ(e,t,n,r){let i=n,o=r-1;for(;io){for(let c=i;c<=o;c++)if(t<=e[c])return c;return o+1}const s=i+o>>1,a=e[s];if(ta))return s;i=s+1}}return i>o?o+1:e[i]>=t?i:i+1}function ARe(e,t){if(e===t)return!0;let{startI:n,startJ:r,endI:i,endJ:o}=kg(e,t);for(;na))return!0;r++}}return!1}function IRe(e,t){if(e===t)return!0;const n=t.length;let{startI:r,startJ:i,endI:o,endJ:s}=kg(e,t);if(s-iu?i++:(r++,i++,a++)}return a===n}function cQ(e,t){if(e===t)return e;const n=e.length,r=t.length;if(0===n)return t;if(0===r)return e;if(e[0]>t[0])return cQ(t,e);const{startI:i,startJ:o,endI:s,endJ:a}=kg(e,t),c=mB(e,t,i,o,s,a);if(c===n&&c===r||c===r)return e;if(c===n)return t;const u=new Int32Array(n+r-c);let l=0,d=0,f=0;for(l=0;lt[d];)u[f++]=t[d++];for(;lm?(u[f++]=m,d++):(u[f++]=p,l++,d++)}for(;ll?a++:(s++,a++,c++)}return c}function DRe(e,t){if(e===t)return e;const{startI:n,startJ:r,endI:i,endJ:o}=kg(e,t),s=mB(e,t,n,r,i,o),a=e.length,c=t.length;if(!s)return n2;if(s===a&&s===c||s===c)return t;if(s===a)return e;const u=new Int32Array(s);let l=0,d=n,f=r;for(;dm||(u[l++]=p,d++),f++)}return u}function ERe(e,t){if(e===t)return n2;const n=e.length,{startI:r,startJ:i,endI:o,endJ:s}=kg(e,t);let a=r,c=i,u=0;for(;ap?c++:(a++,c++,u++)}if(!u)return e;if(u>=n)return n2;const l=new Int32Array(n-u);let d=0;for(let f=0;fp||a++,c++)}for(;ap?a++:(s++,a++,c++)}if(!c)return n2;if(c===e.length)return lB(0,e.length-1);const l=new Int32Array(c);let d=0;for(s=n,a=r;sp||(l[d++]=s,s++),a++)}return l}const ap={startI:0,startJ:0,endI:0,endJ:0};function kg(e,t){const n=e.length,r=t.length,i=n/r;return n>=128||r>=128||i<=.34||i>=2.99?(ap.startI=Rg(e,pB(t)),ap.startJ=Rg(t,pB(e)),ap.endI=Rg(e,hB(t)),ap.endJ=Rg(t,hB(e))):(ap.startI=0,ap.startJ=0,ap.endI=n,ap.endJ=r),ap}var je;!function(e){e.Empty=n2,e.ofUnsortedArray=hRe,e.ofSingleton=fRe,e.ofSortedArray=pRe,e.ofRange=eQ,e.ofBounds=(t,n)=>eQ(t,n-1),e.is=mRe,e.isRange=tQ,e.has=xRe,e.indexOf=rQ,e.indexOfInInterval=_Re,e.indexOfInRange=iQ,e.start=pB,e.end=hB,e.min=gRe,e.max=yRe,e.size=nQ,e.hashCode=bRe,e.toString=vRe,e.areEqual=oQ,e.areIntersecting=ARe,e.isSubset=IRe,e.union=cQ,e.intersect=DRe,e.subtract=ERe,e.findPredecessorIndex=Rg,e.findPredecessorIndexInInterval=SRe,e.findRange=CRe,e.intersectionSize=TRe,e.deduplicate=PRe,e.indicesOf=MRe}(je||(je={}));const Kd=Ce.Empty,RRe=Ce.ofSingleton,kRe=Ce.ofRange,NRe=Ce.ofBounds;function ed(e){return e.length?je.isRange(e)?Ce.ofRange(e[0],e[e.length-1]):e:Kd}function Ng(e){return Ce.is(e)?Ce.size(e):je.size(e)}function FRe(e,t){return Ce.is(e)?Ce.has(e,t):je.has(e,t)}function BRe(e,t){return Ce.is(e)?Ce.indexOf(e,t):je.indexOf(e,t)}function gB(e,t){return Ce.is(e)?Ce.getAt(e,t):e[t]}function Vb(e){return Ce.is(e)?Ce.min(e):je.min(e)}function zb(e){return Ce.is(e)?Ce.max(e):je.max(e)}function ORe(e){return Ce.is(e)?Ce.start(e):je.start(e)}function LRe(e){return Ce.is(e)?Ce.end(e):je.end(e)}function URe(e){return Ce.is(e)?Ce.hashCode(e):je.hashCode(e)}function zRe(e,t){return Ce.is(e)?Ce.is(t)?Ce.areEqual(e,t):uQ(e,t):Ce.is(t)?uQ(t,e):je.areEqual(e,t)}function GRe(e,t){return Ce.is(e)?Ce.is(t)?Ce.areIntersecting(e,t):lQ(t,e):Ce.is(t)?lQ(e,t):je.areIntersecting(e,t)}function jRe(e,t){return Ce.is(e)?Ce.is(t)?Ce.isSubInterval(e,t):function QRe(e,t){const n=Ce.min(e),r=Ce.max(e);if(r-n+1==0)return!1;const i=je.min(t),o=je.max(t);return i>=n&&o<=r}(e,t):Ce.is(t)?function ZRe(e,t){const n=Ce.min(t),r=Ce.max(t);if(r-n+1==0)return!0;const i=je.min(e),o=je.max(e);if(no)return!1;const s=je.findRange(e,n,r);return Ce.size(s)===Ce.size(t)}(e,t):je.isSubset(e,t)}function HRe(e,t){return Ce.is(e)?Ce.findPredecessorIndex(e,t):je.findPredecessorIndex(e,t)}function qRe(e,t,n){return Ce.is(e)?Ce.findPredecessorIndexInInterval(e,t,n):je.findPredecessorIndexInInterval(e,t,n)}function WRe(e,t,n){return Ce.is(e)?Ce.findRange(e,t,n):je.findRange(e,t,n)}function $Re(e,t){return Ce.is(e)?Ce.is(t)?Ce.intersectionSize(e,t):fQ(t,e):Ce.is(t)?fQ(e,t):je.intersectionSize(e,t)}function YRe(e,t){return Ce.is(e)?Ce.is(t)?function tke(e,t){if(Ce.areEqual(e,t))return e;const n=Ce.size(e),r=Ce.size(t);if(!r)return e;if(!n)return t;const i=Ce.min(e),o=Ce.min(t);if(function JRe(e,t){const n=Ng(e),r=Ng(t);return 0===n&&0===r||n>0&&r>0&&zb(e)>=Vb(t)&&Vb(e)<=zb(t)}(e,t))return Ce.ofRange(Math.min(i,o),Math.max(Ce.max(e),Ce.max(t)));let s,a,c,u;i=zb(t):0===Ng(t)}(t,e))return t;const r=Ce.min(t),i=Ce.max(t),o=je.findRange(e,r,i),s=Ce.start(o),a=Ce.end(o),c=new Int32Array(s+(e.length-a)+n);let u=0;for(let l=0;lm||(c++,l++),d++)}if(0===c)return Kd;if(c===i&&c===o)return e;const f=new Int32Array(c);for(u=0,l=0,d=s;lm||(f[u++]=d,l++),d++)}return ed(f)}var Fe,en,Lu,$I,Dc,td,Ms,ft,Gb,ui;function hQ(e){const t=je.ofSortedArray(e),n=je.max(t),r=new Int32Array(n);for(let i=0,o=e.length-1;i=Fe.max(e)?-1:Fe.findPredecessorIndex(e,n-1);return Fe.findRange(t,Fe.getAt(e,i),Fe.getAt(e,i+1)-1)}!function(e){e.Empty=Kd,e.ofSingleton=RRe,e.ofRange=kRe,e.ofBounds=NRe,e.ofSortedArray=ed,e.has=FRe,e.indexOf=BRe,e.getAt=gB,e.min=Vb,e.max=zb,e.start=ORe,e.end=LRe,e.size=Ng,e.hashCode=URe,e.areEqual=zRe,e.areIntersecting=GRe,e.isSubset=jRe,e.union=YRe,e.intersect=XRe,e.indexedIntersect=ake,e.subtract=KRe,e.findPredecessorIndex=HRe,e.findPredecessorIndexInInterval=qRe,e.findRange=WRe,e.intersectionSize=$Re,e.forEach=function t(a,c,u){return function oke(e,t,n){if(Ce.is(e)){const r=Ce.min(e);for(let i=r,o=Ce.max(e);i<=o;i++)t(i,i-r,n)}else for(let r=0,i=e.length;rc.push(u)),c},e.toString=function s(a){return function VRe(e){return Ce.is(e)?Ce.toString(e):je.toString(e)}(a)}}(Fe||(Fe={}));class fke{move(){for(;this.hasNext;){if(this.updateValue()){this.value.index=this.segmentMin++,this.hasNext=this.segmentMax>=this.segmentMin&&Ce.size(this.setRange)>0;break}this.updateSegmentRange()}return this.value}updateValue(){const n=Fe.findPredecessorIndexInInterval(this.set,this.segments[this.segmentMin+1],this.setRange);return this.value.start=Ce.start(this.setRange),this.value.end=n,this.setRange=Ce.ofBounds(n,Ce.end(this.setRange)),n>this.value.start}updateSegmentRange(){const t=Ce.min(this.setRange),n=Ce.max(this.setRange);n=this.segmentMin)}setSegment(t){this.setRange=Ce.ofBounds(t.start,t.end),this.updateSegmentRange()}constructor(t,n,r,i){this.segments=t,this.segmentMap=n,this.set=r,this.segmentMin=0,this.segmentMax=0,this.setRange=Ce.Empty,this.value={index:0,start:0,end:0},this.hasNext=!1,this.setRange=i,this.updateSegmentRange()}}function pke(e,t,n){const r=typeof n<"u"?Ce.ofBounds(n.start,n.end):Ce.ofBounds(0,Fe.size(t));return new fke(e.offsets,e.index,t,r)}!function(e){e.create=hQ,e.ofOffsets=cke,e.count=uke,e.getSegment=lke,e.projectValue=dke,e.transientSegments=pke}(en||(en={}));class mke{remove(t){const{prev:n,next:r}=this,i=n[t],o=r[t];i>=0&&(r[i]=o,n[t]=-1),o>=0&&(n[o]=i,r[t]=-1),t===this.head&&(this.head=i<0?o:i)}has(t){return this.prev[t]>=0||this.next[t]>=0||this.head===t}constructor(t){this.head=t>0?0:-1,this.prev=new Int32Array(t),this.next=new Int32Array(t);for(let n=0;n0,this.xs=t,this.index=-1,this.lastValue=t.length>0?t[0]:void 0}}class mQ{move(){return++this.value,this.hasNext=this.value=t}}class yke{move(){return this.hasNext=!1,this.value}constructor(t){this.value=t,this.hasNext=!0}}class bke{move(){const t=this.f(this.base.move());return this.hasNext=this.base.hasNext,t}constructor(t,n){this.base=t,this.f=n,this.hasNext=!1,this.hasNext=t.hasNext}}class vke{move(){const t=this.next;return this.hasNext=this.findNext(),t}findNext(){for(;this.base.hasNext;)if(this.next=this.base.move(),this.p(this.next))return!0;return!1}constructor(t,n){this.base=t,this.p=n,this.hasNext=this.findNext()}}function gQ(e,t,n,r,i){const{b:o,offset:s}=e,a=[];for(let c=0,u=t.length;c1&&gQ(e,a,n,r-1,i)}!function(e){e.Empty=new mQ(0,-1),e.Array=function t(a){return new gke(a)},e.Value=function n(a){return new yke(a)},e.Range=function r(a,c){return new mQ(a,c)},e.map=function i(a,c){return new bke(a,c)},e.filter=function o(a,c){return new vke(a,c)},e.forEach=function s(a,c,u){for(;a.hasNext;)if(c(a.move(),u))return u;return u}}($I||($I={})),function(e){e.areEqual=function t(d,f){if(d===f)return!0;if(d.vertexCount!==f.vertexCount||d.edgeCount!==f.edgeCount)return!1;const{a:p,b:m,offset:h}=d,{a:g,b:y,offset:b}=f;for(let x=0,_=d.a.length;x<_;x++)if(p[x]!==g[x])return!1;for(let x=0,_=d.b.length;x<_;x++)if(m[x]!==y[x])return!1;for(let x=0,_=d.offset.length;x<_;x++)if(h[x]!==b[x])return!1;for(const x of Object.keys(d.edgeProps)){const _=d.edgeProps[x],S=f.edgeProps[x];if(!S)return!1;for(let A=0,E=_.length;Ap&&(m=p,h=f);const g=uu(m,h);return!this.included.has(g)&&(this.included.add(g),this.xs[this.xs.length]=m,this.ys[this.ys.length]=h,!0)}getGraph(){return a(this.vertexCount,this.xs,this.ys)}getEdgeBuiler(){return new i(this.vertexCount,this.xs,this.ys)}constructor(f){this.vertexCount=f,this.xs=[],this.ys=[],this.included=new Set}},e.fromVertexPairs=a,e.induceByVertices=function c(d,f,p){const{b:m,offset:h,vertexCount:g,edgeProps:y}=d,b=new Int32Array(g);for(let R=0,T=f.length;RR&&0!==b[m[T]]&&x++;const _=new Int32Array(f.length+1),S=new Int32Array(2*x),A=new Int32Array(2*x),E=new Int32Array(2*x);let w=0,D=0;for(let R=0;R0;){const x=y.pop(),_=p[x];for(let S=h[x],A=h[x+1];S=0&&(y.push(b.head),p[b.head]=++m,b.remove(b.head))}return{componentCount:f,componentIndex:p}},e.areVertexSetsConnected=function l(d,f,p,m){if(je.areIntersecting(f,p))return!0;if(m<1)return!1;const h=new Set;for(let g=0,y=f.length;gn.substring(r[2*a],r[2*a+1]):"int"===o?a=>jh(n,r[2*a],r[2*a+1])||0:a=>rp(n,r[2*a],r[2*a+1])||0;return{schema:t,__array:void 0,isDefined:!0,rowCount:i,value:s,valueKind:a=>0,toArray:a=>Ps(i,s,a),areValuesEqual:yQ(e)}}function yQ(e){const{data:t,indices:n}=e;return function(r,i){const o=n[2*r],s=n[2*i],a=n[2*r+1]-o;if(a!==n[2*i+1]-s)return!1;for(let c=0;cr[i]}}function Zd(e,t,n){return function Rke(e,t,n){const r=Object.create(null);for(const i of Object.keys(e))r[i]=Fke(i,e[i],t,n);return QF.ofTables(t.header,e,r)}(e,t,n)}function Dke(e){switch(e.valueType){case"str":return(t,n,r)=>function Eke(e,t,n,r){return{schema:e,__array:t.__array,isDefined:t.isDefined,rowCount:t.rowCount,value:"lowercase"===e.transform?i=>n(i).toLowerCase():"uppercase"===e.transform?i=>n(i).toUpperCase():n,valueKind:t.valueKind,areValuesEqual:t.areValuesEqual,toArray:"lowercase"===e.transform?i=>Array.from(r(i)).map(o=>o.toLowerCase()):"uppercase"===e.transform?i=>Array.from(r(i)).map(o=>o.toUpperCase()):r}}(e,t,t.str,t.toStringArray);case"int":return(t,n,r)=>vQ(e,t,t.int,t.toIntArray);case"float":return(t,n,r)=>vQ(e,t,t.float,t.toFloatArray);case"list":throw new Error("Use createListColumn instead.");case"tensor":throw new Error("Use createTensorColumn instead.")}}function vQ(e,t,n,r){return{schema:e,__array:t.__array,isDefined:t.isDefined,rowCount:t.rowCount,value:n,valueKind:t.valueKind,areValuesEqual:t.areValuesEqual,toArray:r}}function Pke(e,t,n){const r=e.separator,i=e.itemParse,o=t.getField(n),s=o?c=>o.str(c).split(r).map(u=>i(u.trim())).filter(u=>!!u):c=>[];return{schema:e,__array:void 0,isDefined:!!o,rowCount:t.rowCount,value:s,valueKind:o?o.valueKind:()=>1,areValuesEqual:(c,u)=>Wa(s(c),s(u)),toArray:c=>Ps(t.rowCount,s,c)}}function Mke(e,t,n){const r=e.space,i=t.fieldNames.includes(`${n}[0]`)||t.fieldNames.includes(`${n}[0][0]`)||t.fieldNames.includes(`${n}[0][0][0]`),o=i?0:1,s=t.fieldNames.includes(`${n}_1`)||t.fieldNames.includes(`${n}_11`)||t.fieldNames.includes(`${n}_111`)?"underscore":"brackets",a=function wke(e,t,n,r){const i=n?0:1;switch(t){case 1:return"brackets"===r?o=>`${e}[${o+i}]`:o=>`${e}_${o+i}`;case 2:return"brackets"===r?(o,s)=>`${e}[${o+i}][${s+i}]`:(o,s)=>`${e}_${o+i}${s+i}`;case 3:return"brackets"===r?(o,s,a)=>`${e}[${o+i}][${s+i}][${a+i}]`:(o,s,a)=>`${e}_${o+i}${s+i}${a+i}`;default:throw new Error("Tensors with rank > 3 or rank 0 are currently not supported.")}}(n,r.rank,i,s),c=t.getField(a(o,o,o))||te.Undefined(t.rowCount,e),u=d=>function Ake(e,t,n,r){const i=t.create();if(1===t.rank){const o=t.dimensions[0];for(let s=0;s 3 or rank 0 are currently not supported.");{const o=t.dimensions[0],s=t.dimensions[1],a=t.dimensions[2];for(let c=0;cwn.areEqualExact(u(d),u(f)),toArray:d=>Ps(t.rowCount,u,d)}}!function(e){e.create=function t(n,r){const{name:i}=n,o=new _ke;return{descriptor:n,formatRegistry:o,isApplicable:s=>o.isApplicable(s),get(s){const a=r?.asDynamic?s._dynamicPropertyData:s._staticPropertyData;if(a[i])return a[i];if(s.customProperties.has(n))return;const c=o.get(s.sourceData.kind);return c?(a[i]=c(s),s.customProperties.add(n),a[i]):void 0},set(s,a){r?.asDynamic?s._dynamicPropertyData[i]=a:s._staticPropertyData[i]=a},delete(s){r?.asDynamic?delete s._dynamicPropertyData[i]:delete s._staticPropertyData[i]}}}}(td||(td={})),function(e){e.Descriptor={name:"index_pair_bonds"},e.Provider=td.create(e.Descriptor,{asDynamic:!0}),e.DefaultProps={maxDistance:-1},e.fromData=function t(r,i={}){const o={...e.DefaultProps,...i},{pairs:s,count:a}=r;return{bonds:xke(s.indexA.toArray(),s.indexB.toArray(),{key:s.key&&s.key.toArray(),operatorA:s.operatorA&&s.operatorA.toArray(),operatorB:s.operatorB&&s.operatorB.toArray(),order:s.order&&s.order.toArray(),distance:s.distance&&s.distance.toArray(),flag:s.flag&&s.flag.toArray()},a),maxDistance:o.maxDistance}},e.getEdgeIndexForOperators=function n(r,i,o,s,a){let c,u,l,d;i0?o[s[0]].rowCount:0,name:i,fieldNames:s,getField:a=>o[a]}}e.empty=function t(i){return{rowCount:0,name:i,fieldNames:[],getField(o){}}},e.ofFields=n,e.ofTable=function r(i,o){const s={};for(const a of o._columns)s[a]=ft.ofColumn(o[a]);return n(i,s)}}(ss||(ss={})),function(e){function n(a){const c=a.length,u=p=>{const m=a[p];return m&&"."!==m&&"?"!==m?m:""},l=p=>{const m=a[p];return jh(m,0,m.length)||0},d=p=>{const m=a[p];return rp(m,0,m.length)||0};return{__array:void 0,binaryEncoding:void 0,isDefined:!0,rowCount:c,str:u,int:l,float:d,valueKind:p=>{const m=a[p],h=m.length;if(h>1)return 0;if(0===h)return 1;const g=m.charCodeAt(0);return 46===g?1:63===g?2:0},areValuesEqual:(p,m)=>a[p]===a[m],toStringArray:p=>p?Ps(c,u,p):a,toIntArray:p=>Ps(c,l,p),toFloatArray:p=>Ps(c,d,p)}}function o(a){const{rowCount:c,valueKind:u,areValuesEqual:l,isDefined:d}=a;let f,p,m;switch(a.schema.valueType){case"float":case"int":f=g=>""+a.value(g),p=a.value,m=a.value;break;case"str":f=a.value,p=g=>{const y=a.value(g);return jh(y,0,y.length)||0},m=g=>{const y=a.value(g);return rp(y,0,y.length)||0};break;case"list":const{separator:h}=a.schema;f=g=>a.value(g).join(h),p=g=>NaN,m=g=>NaN;break;default:throw new Error(`unsupported valueType '${a.schema.valueType}'`)}return{__array:void 0,binaryEncoding:void 0,isDefined:d,rowCount:c,str:f,int:p,float:m,valueKind:u,areValuesEqual:l,toStringArray:h=>Ps(c,f,h),toIntArray:h=>Ps(c,p,h),toFloatArray:h=>Ps(c,m,h)}}e.ofString=function t(a){return n([a])},e.ofStrings=n,e.ofNumbers=function r(a){const c=a.length,u=p=>""+a[p],l=p=>a[p],f=p=>!p||p.array&&a instanceof p.array?a:Ps(c,l,p);return{__array:void 0,binaryEncoding:void 0,isDefined:!0,rowCount:c,str:u,int:l,float:l,valueKind:p=>0,areValuesEqual:(p,m)=>a[p]===a[m],toStringArray:p=>Ps(c,u,p),toIntArray:f,toFloatArray:f}},e.ofTokens=function i(a){const{data:c,indices:u,count:l}=a,d=h=>{const g=c.substring(u[2*h],u[2*h+1]);return"."===g||"?"===g?"":g},f=h=>jh(c,u[2*h],u[2*h+1])||0,p=h=>rp(c,u[2*h],u[2*h+1])||0;return{__array:void 0,binaryEncoding:void 0,isDefined:!0,rowCount:l,str:d,int:f,float:p,valueKind:h=>{const g=u[2*h],y=u[2*h+1]-g;if(y>1)return 0;if(0===y)return 1;const b=c.charCodeAt(g);return 46===b?1:63===b?2:0},areValuesEqual:yQ(a),toStringArray:h=>Ps(l,d,h),toIntArray:h=>Ps(l,f,h),toFloatArray:h=>Ps(l,p,h)}},e.ofColumn=o,e.ofUndefined=function s(a,c){return o(te.Undefined(a,c))}}(ft||(ft={})),function(e){function t(i){return i.replace(".","_").replace(/\[/,"_").replace(/(\[|\])/g,"")}e.canonical=t,e.equal=function n(i,o){return t(i)===t(o)},e.create=function r(i,o,s=!1){const a=`${i}${o?`.${o}`:""}`;return s?t(a):a}}(Gb||(Gb={}));class _Q{constructor(t,n,r){this._isDefined=r;const i=Object.keys(n);this._rowCount=t.rowCount,this._columns=i,this._schema=n;const o=Object.create(null);for(const s of i)Object.defineProperty(this,s,{get:function(){if(o[s])return o[s];const a=n[s];if("list"===a.valueType)o[s]=Pke(a,t,s);else if("tensor"===a.valueType)o[s]=Mke(a,t,s);else{const c=Dke(a),u=t.getField(s);o[s]=u?c(u,t,s):te.Undefined(t.rowCount,a)}return o[s]},enumerable:!0,configurable:!1})}}function Nke(e,t,n,r){const i=Gb.create(t,e),o=Gb.canonical(i);if(o in n)return n[o];if(r&&i in r)for(const s of r[i]){const a=Gb.canonical(s);if(a in n)return n[a]}}function Fke(e,t,n,r){let i=n.categories[e];if(r){const o=function kke(e){const t=Object.create(null);for(const n of Object.keys(e.categories))for(const r of e.categories[n].fieldNames)t[Gb.create(n,r,!0)]=e.categories[n].getField(r);return t}(n),s=Object.create(null),a=[];let c=0;for(const u of Object.keys(t)){const l=Nke(u,e,o,r);l&&(s[u]=l,a.push(u),c=l.rowCount)}i={rowCount:c,name:e,fieldNames:[...a],getField:u=>s[u]}}return new _Q(i||ss.empty(e),t,!!i)}function jb(e,t,n){const r=new Float32Array(e);for(let i=0;i(t=Math.abs(t))?(t/=e,e*Math.sqrt(1+t*t)):t>0?(e/=t,t*Math.sqrt(1+e*e)):0}!function(e){function n(r,i,o){const s=function Gke(e){const t="number"==typeof e?function Uke(e){switch(e){case 1146:return 146;case 1148:return 149;case 1155:return 157;case 1160:return 163;case 1161:return 165;case 1166:return 171;case 1167:return 173;case 1003:return 237;case 1004:return 238;case 1005:return 239;case 2005:return 240;case 3005:return 241;case 4005:return 242;case 5005:return 243;case 1006:return 244;case 1007:return 245;case 1008:return 246;case 1009:return 247;case 1010:return 248;case 1011:return 249;case 1012:return 250;case 1013:return 251;case 1014:return 252;case 2014:return 253;case 3014:return 254;case 1015:return 255;case 1017:return 256;case 2017:return 257;case 1018:return 258;case 2018:return 259;case 3018:return 260;case 1020:return 261;case 1021:return 262;case 1022:return 263;case 1023:return 264;case 1059:return 265;case 1094:return 266;case 1197:return 267}let t=0;return e>146&&++t,e>148&&++t,e>155&&++t,e>160&&++t,e>161&&++t,e>166&&++t,e>167&&++t,e-1+t}(e):r2[e];return typeof t>"u"||typeof xQ[t]>"u"?-1:t}(r);if(s<0)return console.warn(`Unknown spacegroup '${r}', returning a 'P 1' with cellsize [1, 1, 1]`),e.Zero;const a=i[0]*i[1]*i[2],c=o[0],u=o[1],l=o[2],d=i[0],f=i[1],p=i[2],m=Math.cos(u),h=(Math.cos(c)-Math.cos(u)*Math.cos(l))/Math.sin(l),g=Math.sqrt(1-m*m-h*h),y=[d,0,0],b=[Math.cos(l)*f,Math.sin(l)*f,0],x=[m*p,h*p,g*p],_=le.ofRows([[y[0],b[0],x[0],0],[0,b[1],x[1],0],[0,0,x[2],0],[0,0,0,1]]);return{index:s,size:i,volume:a,anglesInRadians:o,toFractional:le.invert(le.zero(),_),fromFractional:_}}e.Zero=n("P 1",v.create(1,1,1),v.create(Math.PI/2,Math.PI/2,Math.PI/2)),e.isZero=function t(r){return!r||0===r.index&&1===r.size[0]&&1===r.size[1]&&1===r.size[1]},e.create=n}(ma||(ma={})),function(e){function t(g){const y=Lke[g.index].map(_=>function d(g){return le.ofRows([vB[g[0]],vB[g[1]],vB[g[2]],[0,0,0,1]])}(Oke[_]));return{name:xQ[g.index],num:zke[g.index],cell:g,operators:y}}e.ZeroP1=t(ma.Zero),e.create=t;const n=v(),r=le();function i(g,y,b,x,_,S){return v.set(n,b,x,_),le.fromTranslation(r,n),le.mul(S,le.mul(S,le.mul(S,g.cell.fromFractional,r),g.operators[y]),g.cell.toFractional)}e.setOperatorMatrix=i,e.getSymmetryOperator=function o(g,y,b,x,_){const S=i(g,y,b,x,_,le.zero());return ui.create(`${y+1}_${5+b}${5+x}${5+_}`,S,{hkl:v.create(b,x,_),spgrOp:y})};const s=v(),a=v(),c=v(),u=v();function p(g,y,b){const x=[];if(g>0?x.push("+X"):g<0&&x.push("-X"),y>0?x.push("+Y"):y<0&&x.push("-Y"),b>0?x.push("+Z"):b<0&&x.push("-Z"),1===x.length)return"+"===x[0].charAt(0)?x[0].substr(1):x[0];if(2===x.length){const _=x[0].charAt(0),S=x[1].charAt(0);if("+"===_)return`${x[0].substr(1)}${x[1]}`;if("+"===S)return`${x[1].substr(1)}${x[0]}`}throw new Error(`unknown rotation '${x}', ${g} ${y} ${b}`)}function m(g){switch(g){case.5:return"1/2";case 1/4:return"1/4";case 3/4:return"3/4";case 1/3:return"1/3";case 2/3:return"2/3";case 1/6:return"1/6";case 5/6:return"5/6"}return""}function h(g,y){return""===y?g:g.length>2?`${g}+${y}`:"-"===g.charAt(0)?`${y}${g}`:`${y}+${g}`}e.getSymmetryOperatorRef=function l(g,y,b,x,_,S){const A=le.zero();v.set(n,b,x,_),v.floor(s,S),le.copy(A,g.operators[y]),v.floor(a,v.transformMat4(a,S,A)),le.getTranslation(u,A),v.sub(u,u,a),v.add(u,u,s),v.add(u,u,n),le.setTranslation(A,u),le.mul(A,g.cell.fromFractional,A),le.mul(A,A,g.cell.toFractional),v.sub(c,a,s);const E=b-c[0],w=x-c[1],D=_-c[2];return ui.create(`${y+1}_${5+E}${5+w}${5+D}`,A,{hkl:v.create(E,w,D),spgrOp:y})},e.getOperatorXyz=function f(g){return[h(p(g[0],g[4],g[8]),m(g[12])),h(p(g[1],g[5],g[9]),m(g[13])),h(p(g[2],g[6],g[10]),m(g[14]))].join(",")}}(Ec||(Ec={})),function(e){e.add=function t(o,s,a){o.squaredDistances[o.count]=a,o.indices[o.count++]=s},e.reset=function n(o){o.count=0},e.create=function r(){return{count:0,indices:[],squaredDistances:[]}},e.copy=function i(o,s){for(let a=0;a>16?L:-L,e[l*t+f]=G;for(p=0;p<2;p++)for(d=0;d0?M>c&&(c=M):M>u&&(u=M),v.projectPointOnVector(m,v.fromArray(m,s,I),y.dirB,g);const N=v.dot(y.dirB,v.normalize(h,v.sub(h,m,g))),V=v.distance(m,g);N>0?V>l&&(l=V):V>d&&(d=V),v.projectPointOnVector(m,v.fromArray(m,s,I),y.dirC,g);const F=v.dot(y.dirC,v.normalize(h,v.sub(h,m,g))),G=v.distance(m,g);F>0?G>f&&(f=G):G>p&&(p=G)}const b=v.setMagnitude(v(),y.dirA,(c+u)/2),x=v.setMagnitude(v(),y.dirB,(l+d)/2),_=v.setMagnitude(v(),y.dirC,(f+p)/2),S=v.isFinite(b),A=v.isFinite(x),E=v.isFinite(_),w=v(),D=function(I,R,T){v.copy(i,g),S&&v.scaleAndAdd(i,i,y.dirA,I),A&&v.scaleAndAdd(i,i,y.dirB,R),E&&v.scaleAndAdd(i,i,y.dirC,T),v.add(w,w,i)};return D(c,l,f),D(c,l,-p),D(c,-d,-p),D(c,-d,f),D(-u,-d,-p),D(-u,-d,f),D(-u,l,f),D(-u,l,-p),v.scale(w,w,1/8),Rs.create(w,b,x,_)}e.calculateBoxAxes=o}(nd||(nd={})),function(e){function t(T){return void 0!==T.extrema}function n(T,M){return{center:T,radius:M}}function a(T,M){return void 0!==T.extrema?(T.extrema.length=0,T.extrema.push(...M)):T.extrema=M,T}e.hasExtrema=t,e.create=n,e.zero=function r(){return{center:v(),radius:0}},e.clone=function i(T){const M=n(v.clone(T.center),T.radius);return t(T)&&(M.extrema=T.extrema.map(N=>v.clone(N))),M},e.set=function o(T,M,N){return v.copy(T.center,M),T.radius=N,T},e.copy=function s(T,M){return v.copy(T.center,M.center),T.radius=M.radius,t(M)&&a(T,M.extrema.map(N=>v.clone(N))),T},e.setExtrema=a,e.computeBounding=function c(T){const{x:M,y:N,z:V,indices:F}=T;let G=0,L=0,z=0,j=0;const Z=Fe.size(F);for(let $=0;$0&&(G/=Z,L/=Z,z/=Z);for(let $=0;$j&&(j=W)}return{center:v.create(G,L,z),radius:Math.sqrt(j)}},e.transform=function u(T,M,N){return v.transformMat4(T.center,M.center,N),T.radius=M.radius*le.getMaxScaleOnAxis(N),t(M)&&a(T,M.extrema.map(V=>v.transformMat4(v(),V,N))),T},e.translate=function l(T,M,N){return v.add(T.center,M.center,N),t(M)&&a(T,M.extrema.map(V=>v.add(v(),V,N))),T},e.toArray=function d(T,M,N){return v.toArray(T.center,M,N),M[N+3]=T.radius,M},e.fromArray=function f(T,M,N){return v.fromArray(T.center,M,N),T.radius=M[N+3],T},e.fromBox3D=function p(T,M){return v.scale(T.center,v.add(T.center,M.max,M.min),.5),T.radius=v.distance(T.center,M.max),e.setExtrema(T,[v.create(M.min[0],M.min[1],M.min[2]),v.create(M.max[0],M.max[1],M.max[2]),v.create(M.max[0],M.min[1],M.min[2]),v.create(M.min[0],M.max[1],M.max[2]),v.create(M.min[0],M.min[1],M.max[2]),v.create(M.max[0],M.min[1],M.max[2]),v.create(M.max[0],M.max[1],M.min[2]),v.create(M.min[0],M.max[1],M.min[2])]),T},e.fromAxes3D=function m(T,M){return v.copy(T.center,M.origin),T.radius=Math.max(v.magnitude(M.dirA),v.magnitude(M.dirB),v.magnitude(M.dirC)),T};const h=v();e.fromDimensionsAndTransform=function g(T,M,N){const[V,F,G]=M,L=v.create(0,0,0);v.transformMat4(L,L,N);const z=v.create(V,F,G);v.transformMat4(z,z,N);const j=v.create(V,0,0);v.transformMat4(j,j,N);const Z=v.create(0,F,G);v.transformMat4(Z,Z,N);const $=v.create(0,0,G);v.transformMat4($,$,N);const ee=v.create(V,0,G);v.transformMat4(ee,ee,N);const q=v.create(V,F,0);v.transformMat4(q,q,N);const O=v.create(0,F,0);v.transformMat4(O,O,N),v.add(h,L,z),v.scale(h,h,.5);const H=Math.max(v.distance(L,z),v.distance(j,Z));return e.set(T,h,H/2),e.setExtrema(T,[L,z,j,Z,$,ee,q,O]),T};const y=v();e.addVec3=function b(T,M,N){return v.distance(M.center,N)v.clone(V)),...N.extrema.map(V=>v.clone(V))]),T};const _=v();e.expand=function S(T,M,N){var V,F;if(v.copy(T.center,M.center),T.radius=M.radius+N,M.radius<1e-12||(null!==(F=null===(V=M.extrema)||void 0===V?void 0:V.length)&&void 0!==F?F:0)<=1)return T.extrema=void 0,T;if(t(M)){const G=new Float32Array(3*M.extrema.length);for(let z=0;z{v.normalize(_,v.sub(_,z,M.center));const j=v.clone(z),Z=v.dot(_,L.dirA)<0?-1:1;v.scaleAndAdd(j,j,L.dirA,Z);const $=v.dot(_,L.dirB)<0?-1:1;v.scaleAndAdd(j,j,L.dirB,$);const ee=v.dot(_,L.dirC)<0?-1:1;return v.scaleAndAdd(j,j,L.dirC,ee),v.distance(T.center,j)>T.radius&&(M.extrema.length>=14&&v.normalize(_,v.sub(_,j,M.center)),v.scaleAndAdd(j,T.center,_,T.radius)),j}))}return T},e.exactEquals=function A(T,M){return T.radius===M.radius&&v.exactEquals(T.center,M.center)},e.equals=function E(T,M){const N=T.radius,V=M.radius;return Math.abs(N-V)<=vr*Math.max(1,Math.abs(N),Math.abs(V))&&v.equals(T.center,M.center)},e.includes=function w(T,M){if(t(M)){for(const N of M.extrema)if(v.distance(T.center,N)>T.radius)return!1;return!0}return v.distance(T.center,M.center)+M.radius<=T.radius},e.overlaps=function D(T,M){return v.distance(T.center,M.center)<=T.radius+M.radius},e.distance=function I(T,M){return v.distance(T.center,M.center)-T.radius+M.radius},e.distanceToVec=function R(T,M){const{center:N,radius:V}=T;return v.distance(M,N)-V}}(_e||(_e={})),function(e){function n(){return{min:v(),max:v()}}function r(D,I){return v.copy(D.min,I.min),v.copy(D.max,I.max),D}e.create=function t(D,I){return{min:D,max:I}},e.zero=n,e.copy=r,e.clone=function i(D){return r(n(),D)};const o=v();function a(D,I){for(let R=0,T=I.length;R=14?c(D,I.extrema):(v.set(o,I.radius,I.radius,I.radius),v.sub(D.min,I.center,o),v.add(D.max,I.center,o),D)},e.addVec3Array=a,e.fromVec3Array=c,e.addSphere3D=function u(D,I){return _e.hasExtrema(I)&&I.extrema.length>=14?a(D,I.extrema):(g(D,v.subScalar(o,I.center,I.radius)),g(D,v.addScalar(o,I.center,I.radius)),D)},e.intersectsSphere3D=function l(D,I){return v.clamp(o,I.center,D.min,D.max),v.squaredDistance(o,I.center)<=I.radius*I.radius},e.computeBounding=function d(D){const I=v.create(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),R=v.create(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),{x:T,y:M,z:N,indices:V}=D;for(let F=0,G=Fe.size(V);FD.max[0]||I[1]D.max[1]||I[2]D.max[2])},e.overlaps=function A(D,I){return!(D.max[0]I.max[0]||D.max[1]I.max[1]||D.max[2]I.max[2])},e.containsSphere3D=function E(D,I){const R=I.center,T=I.radius;return!(R[0]-TD.max[0]||R[1]-TD.max[1]||R[2]-TD.max[2])},e.nearestIntersectionWithRay=function w(D,I,R,T){const[M,N,V]=I.min,[F,G,L]=I.max,[z,j,Z]=R,$=1/T[0],ee=1/T[1],q=1/T[2];let O,H,W,Q,fe,X;return $>=0?(O=(M-z)*$,H=(F-z)*$):(O=(F-z)*$,H=(M-z)*$),ee>=0?(W=(N-j)*ee,Q=(G-j)*ee):(W=(G-j)*ee,Q=(N-j)*ee),q>=0?(fe=(V-Z)*q,X=(L-Z)*q):(fe=(L-Z)*q,X=(V-Z)*q),W>O&&(O=W),QO&&(O=fe),X0)throw new Error("New key is larger than old key");t.key=n;const r=t.parent;r&&this._compare(t,r)<0&&(this._cut(t,r,this._minNode),this._cascadingCut(r,this._minNode)),this._compare(t,this._minNode)<0&&(this._minNode=t)}delete(t){const n=t.parent;n&&(this._cut(t,n,this._minNode),this._cascadingCut(n,this._minNode)),this._minNode=t,this.extractMinimum()}extractMinimum(){const t=this._minNode;if(t){if(t.child){let r=t.child;do{r.parent=null,r=r.next}while(r!==t.child)}let n=null;t.next!==t&&(n=t.next),this._removeNodeFromList(t),this._nodeCount--,this._minNode=this._mergeLists(n,t.child),this._minNode&&(this._minNode=this._consolidate(this._minNode))}return t}findMinimum(){return this._minNode}insert(t,n){const r=new Yke(t,n);return this._minNode=this._mergeLists(this._minNode,r),this._nodeCount++,r}isEmpty(){return null===this._minNode}size(){return null===this._minNode?0:this._getNodeListSize(this._minNode)}union(t){this._minNode=this._mergeLists(this._minNode,t._minNode),this._nodeCount+=t._nodeCount}_defaultCompare(t,n){return t.key>n.key?1:t.key0){const s=i;i=o,o=s}this._linkHeaps(o,i),n[i.degree]=null,i.degree++,o=n[i.degree]}n[i.degree]=i}let r=null;for(let i=0;i=d.length;const fe=d[j];if(0!==fe){const X=L,J=fe-1,ce=c[J],ae=ce+u[J];for(let me=ce;meL&&(L=Le),Hb.insert(Le,oe)}X=o))for(let J=-O;J<=O;J++){const ce=I+J;if(!(ce<0||ce>=s))for(let be=-H;be<=H;be++){const ae=R+be;if(!(ae<0||ae>=a||(j=(X*s+ce)*a+ae,SB.has(j)||(SB.add(j),i2.has(j))))){if(!N){const me=n[0]+X*y[0]-x,oe=n[1]+ce*y[1]-_,K=n[2]+ae*y[2]-S;if(me*me+oe*oe+K*K-ee>L){$.push(X,ce,ae,j);continue}}G.push(X,ce,ae,j),V++}}}}}if(N=!1,0===V){if(1===A){const Q=Hb.findMinimum();if(Q){const{key:fe,value:X}=Q;return Uu.add(t,X,fe),!0}}else for(;!Hb.isEmpty()&&(Z||Hb.findMinimum().key<=L)&&t.count=A||T||t.count>=w)return t.count>0;if(N=!0,z=!0,$.length>0){for(let Q=0,fe=$.length;Q0){const p=Math.ceil(c/u),m=Math.pow(p/(o[0]*o[1]*o[2]),1/3);a=[Math.ceil(o[0]*m),Math.ceil(o[1]*m),Math.ceil(o[2]*m)],s=[o[0]/a[0],o[1]/a[1],o[2]/a[2]]}else s=o,a=[1,1,1];return function Zke(e){const{expandedBox:t,size:[n,r,i],data:{x:o,y:s,z:a,radius:c,indices:u},elementCount:l,delta:d}=e,f=n*r*i,{min:[p,m,h]}=t;let g=0,y=0;const b=new Uint32Array(f),x=new Int32Array(l);for(let w=0;wg&&(g=c[D])}const _=new Int32Array(y);for(let w=0,D=0;w0&&(b[w]=D+1,_[D]=I,D+=1)}const S=new Uint32Array(y);for(let w=1;w0){const I=D-1;E[S[I]+A[I]]=w,A[I]+=1}}return{size:e.size,bucketArray:E,bucketCounts:_,bucketOffset:S,grid:b,delta:d,min:e.expandedBox.min,data:e.data,maxRadius:g,expandedBox:e.expandedBox,boundingBox:e.boundingBox,boundingSphere:e.boundingSphere}}({size:a,data:{x:e.x,y:e.y,z:e.z,indices:i,radius:e.radius},expandedBox:r,boundingBox:t.box,boundingSphere:t.sphere,elementCount:c,delta:s})}(t,n,r);this.ctx=function Jke(e){return{grid:e,x:.1,y:.1,z:.1,k:1,stopIf:void 0,radius:.1,isCheck:!1}}(i),this.boundary={box:i.boundingBox,sphere:i.boundingSphere},this.buckets={offset:i.bucketOffset,count:i.bucketCounts,array:i.bucketArray},this.result=Uu.create()}}function CQ(e,t){const{min:n,size:[r,i,o],bucketOffset:s,bucketCounts:a,bucketArray:c,grid:u,data:{x:l,y:d,z:f,indices:p,radius:m},delta:h,maxRadius:g}=e.grid,{radius:y,isCheck:b,x,y:_,z:S}=e,A=y+g,E=A*A;Uu.reset(t);const w=Math.max(0,Math.floor((x-A-n[0])/h[0])),D=Math.max(0,Math.floor((_-A-n[1])/h[1])),I=Math.max(0,Math.floor((S-A-n[2])/h[2])),R=Math.min(r-1,Math.floor((x+A-n[0])/h[0])),T=Math.min(i-1,Math.floor((_+A-n[1])/h[1])),M=Math.min(o-1,Math.floor((S+A-n[2])/h[2]));if(w>R||D>T||I>M)return!1;for(let N=w;N<=R;N++)for(let V=D;V<=T;V++)for(let F=I;F<=M;F++){const G=u[(N*i+V)*o+F];if(0===G)continue;const L=G-1,z=s[L],Z=z+a[L];for(let $=z;$0&&Math.sqrt(W)-m[ee]>y)continue;if(b)return!0;Uu.add(t,c[$],W)}}}return t.count>0}const wQ=v(),qh=v(),i2=new Set,SB=new Set,eNe=[.1],tNe=[.1],nNe=[.1],Hb=new SQ;var nt,kr,Ae,as,Ot,zn;!function(e){function t(p,m,h){return{kind:"element-location",structure:p,unit:m,element:h||0}}e.create=t,e.clone=function n(p){return t(p.structure,p.unit,p.element)},e.set=function r(p,m,h,g){return m&&(p.structure=m),h&&(p.unit=h),void 0!==g&&(p.element=g),p},e.copy=function i(p,m){return p.unit=m.unit,p.element=m.element,p},e.is=function o(p){return!!p&&"element-location"===p.kind},e.areEqual=function s(p,m){return p.unit===m.unit&&p.element===m.element};const a=v(),c=v();e.distance=function u(p,m){return p.unit.conformation.position(p.element,a),m.unit.conformation.position(m.element,c),v.distance(a,c)},e.position=function l(p,m){return m.unit.conformation.position(m.element,p)},e.residueIndex=function d(p){return p.unit.model.atomicHierarchy.residueAtomSegments.index[p.element]},e.chainIndex=function f(p){return p.unit.model.atomicHierarchy.chainAtomSegments.index[p.element]}}(nt||(nt={}));class iNe{add(t){const n=this.getHash(t);if(this.byHash.has(n)){const r=this.byHash.get(n);for(let i=0,o=r.length;i`${r}-${i.toLocaleLowerCase()}${o}`).replace(t,(n,r,i,o)=>`${r}-${i.toLocaleLowerCase()}${o}`)}function PQ(e,t,n){if(XI(n))return n.info.namespace=e,n.info.name=n.info.name||EQ(t),void(n.id=`${n.info.namespace}.${n.info.name}`);const r=`${n["@namespace"]||EQ(t)}`,i=e?`${e}.${r}`:r;for(const o of Object.keys(n))"object"!=typeof n[o]&&!XI(n[o])||PQ(i,o,n[o])}function MQ(e,t){if(XI(e))t.push(e);else for(const n of Object.keys(e))"object"!=typeof e[n]&&!XI(e[n])||MQ(e[n],t)}function $o(e,t){return $t(Ot.Dictionary({0:ct(e)}),e,t)}function Wh(e,t){return $t(Ot.List(e,{nonEmpty:!0}),e,t)}function Vu(e,t,n){return $t(Ot.Dictionary({0:ct(e),1:ct(e)}),t,n)}!function(e){e.create=function t(){return{keys:new Set,array:[]}},e.add=function n({keys:i,array:o},s,a){return!i.has(s)&&(i.add(s),o[o.length]=a,!0)},e.has=function r({keys:i},o){return i.has(o)}}(kr||(kr={})),function(e){function n(a,c,u){return{kind:"value",namespace:a,name:c,parent:u}}function o(a,c,u,l){const d=Object.create(null);for(const f of l)d[f]=!0;return{kind:"oneof",namespace:a,name:c,type:u,values:d}}e.Variable=function t(a,c,u){return{kind:"variable",name:a,type:c,isConstraint:u}},e.Value=n,e.Container=function r(a,c,u,l){return{kind:"container",namespace:a,name:c,child:u,alias:l}},e.Union=function i(a){return{kind:"union",types:a}},e.OneOf=o,e.Any={kind:"any"},e.AnyValue={kind:"any-value"},e.Num=n("","Number"),e.Str=n("","String"),e.Bool=o("","Bool",e.Str,["true","false"]),e.oneOfValues=function s({values:a}){return Object.keys(a).sort()}}(Ae||(Ae={})),function(e){function s(c){return!!c&&!!c.head&&"object"==typeof c}function a(c){return!!c&&"string"==typeof c.name}e.Symbol=function t(c){return{name:c}},e.Apply=function n(c,u){return u?{head:c,args:u}:{head:c}},e.isArgumentsArray=function r(c){return!!c&&Array.isArray(c)},e.isArgumentsMap=function i(c){return!!c&&!Array.isArray(c)},e.isLiteral=function o(c){return!s(c)&&!a(c)},e.isApply=s,e.isSymbol=a}(as||(as={})),function(e){function t(r){return{kind:"dictionary",map:r,"@type":0}}e.None=t({}),e.Dictionary=t,e.List=function n(r,i){const{nonEmpty:o=!1}=i||{};return{kind:"list",type:r,nonEmpty:o,"@type":0}}}(Ot||(Ot={})),function(e){e.AnyVar=Ae.Variable("a",Ae.Any),e.AnyValueVar=Ae.Variable("a",Ae.Any),e.ConstrainedVar=Ae.Variable("a",Ae.Any,!0),e.Regex=Ae.Value("Core","Regex"),e.Set=t=>Ae.Container("Core","Set",t||e.AnyValueVar),e.List=t=>Ae.Container("Core","List",t||e.AnyVar),e.Fn=(t,n)=>Ae.Container("Core","Fn",t||e.AnyVar,n),e.Flags=(t,n)=>Ae.Container("Core","Flags",t,n),e.BitFlags=e.Flags(Ae.Num,"BitFlags")}(zn||(zn={})),Ot.Dictionary({0:ct(Ae.Num),1:ct(Ae.Num)});const AB={"@header":"Language Primitives",type:{"@header":"Types",bool:$t(Ot.Dictionary({0:ct(Ae.AnyValue)}),Ae.Bool,"Convert a value to boolean."),num:$t(Ot.Dictionary({0:ct(Ae.AnyValue)}),Ae.Num,"Convert a value to number."),str:$t(Ot.Dictionary({0:ct(Ae.AnyValue)}),Ae.Str,"Convert a value to string."),regex:$t(Ot.Dictionary({0:ct(Ae.Str,{description:"Expression"}),1:ct(Ae.Str,{isOptional:!0,description:"Flags, e.g. 'i' for ignore case"})}),zn.Regex,"Creates a regular expression from a string using the ECMAscript syntax."),list:$t(Ot.List(zn.AnyVar),zn.List()),set:$t(Ot.List(zn.AnyValueVar),zn.Set()),bitflags:$t(Ot.Dictionary({0:ct(Ae.Num)}),zn.BitFlags,"Interpret a number as bitflags."),compositeKey:$t(Ot.List(Ae.AnyValue),Ae.AnyValue)},logic:{"@header":"Logic",not:$o(Ae.Bool),and:Wh(Ae.Bool),or:Wh(Ae.Bool)},ctrl:{"@header":"Control",eval:$t(Ot.Dictionary({0:ct(zn.Fn(zn.AnyVar))}),zn.AnyVar,"Evaluate a function."),fn:$t(Ot.Dictionary({0:ct(zn.AnyVar)}),zn.Fn(zn.AnyVar),'Wrap an expression to a "lazy" function.'),if:$t(Ot.Dictionary({0:ct(Ae.Bool,{description:"Condition"}),1:ct(Ae.Variable("a",Ae.Any),{description:"If true"}),2:ct(Ae.Variable("b",Ae.Any),{description:"If false"})}),Ae.Union([Ae.Variable("a",Ae.Any),Ae.Variable("b",Ae.Any)])),assoc:$t(Ot.Dictionary({0:ct(Ae.Str,{description:"Name"}),1:ct(Ae.Variable("a",Ae.Any),{description:"Value to assign"})}),Ae.Variable("a",Ae.Any))},rel:{"@header":"Relational",eq:Vu(Ae.Variable("a",Ae.AnyValue,!0),Ae.Bool),neq:Vu(Ae.Variable("a",Ae.AnyValue,!0),Ae.Bool),lt:Vu(Ae.Num,Ae.Bool),lte:Vu(Ae.Num,Ae.Bool),gr:Vu(Ae.Num,Ae.Bool),gre:Vu(Ae.Num,Ae.Bool),inRange:$t(Ot.Dictionary({0:ct(Ae.Num,{description:"Value to test"}),1:ct(Ae.Num,{description:"Minimum value"}),2:ct(Ae.Num,{description:"Maximum value"})}),Ae.Bool,"Check if the value of the 1st argument is >= 2nd and <= 3rd.")},math:{"@header":"Math",add:Wh(Ae.Num),sub:Wh(Ae.Num),mult:Wh(Ae.Num),div:Vu(Ae.Num,Ae.Num),pow:Vu(Ae.Num,Ae.Num),mod:Vu(Ae.Num,Ae.Num),min:Wh(Ae.Num),max:Wh(Ae.Num),cantorPairing:Vu(Ae.Num,Ae.Num),sortedCantorPairing:Vu(Ae.Num,Ae.Num),invertCantorPairing:$t(Ot.Dictionary({0:ct(Ae.Num)}),zn.List(Ae.Num)),floor:$o(Ae.Num),ceil:$o(Ae.Num),roundInt:$o(Ae.Num),trunc:$o(Ae.Num),abs:$o(Ae.Num),sign:$o(Ae.Num),sqrt:$o(Ae.Num),cbrt:$o(Ae.Num),sin:$o(Ae.Num),cos:$o(Ae.Num),tan:$o(Ae.Num),asin:$o(Ae.Num),acos:$o(Ae.Num),atan:$o(Ae.Num),sinh:$o(Ae.Num),cosh:$o(Ae.Num),tanh:$o(Ae.Num),exp:$o(Ae.Num),log:$o(Ae.Num),log10:$o(Ae.Num),atan2:Vu(Ae.Num,Ae.Num)},str:{"@header":"Strings",concat:Wh(Ae.Str),match:$t(Ot.Dictionary({0:ct(zn.Regex),1:ct(Ae.Str)}),Ae.Bool)},list:{"@header":"Lists",getAt:$t(Ot.Dictionary({0:ct(zn.List()),1:ct(Ae.Num)}),zn.AnyVar),equal:$t(Ot.Dictionary({0:ct(zn.List()),1:ct(zn.List())}),Ae.Bool)},set:{"@header":"Sets",has:$t(Ot.Dictionary({0:ct(zn.Set(zn.ConstrainedVar)),1:ct(zn.ConstrainedVar)}),Ae.Bool,"Check if the the 1st argument includes the value of the 2nd."),isSubset:$t(Ot.Dictionary({0:ct(zn.Set(zn.ConstrainedVar)),1:ct(zn.Set(zn.ConstrainedVar))}),Ae.Bool,"Check if the the 1st argument is a subset of the 2nd.")},flags:{"@header":"Flags",hasAny:$t(Ot.Dictionary({0:ct(zn.Flags(zn.ConstrainedVar)),1:ct(zn.Flags(zn.ConstrainedVar))}),Ae.Bool,"Check if the the 1st argument has at least one of the 2nd one's flags."),hasAll:$t(Ot.Dictionary({0:ct(zn.Flags(zn.ConstrainedVar)),1:ct(zn.Flags(zn.ConstrainedVar))}),Ae.Bool,"Check if the the 1st argument has all 2nd one's flags.")}};TQ(AB);const mNe=DQ(AB);var wt;function Bn(e,t){return $t(Ot.Dictionary({0:ct(wt.ElementReference,{isOptional:!0,defaultValue:"slot.current-atom"})}),e,t)}function qb(e,t){return $t(Ot.None,e,t)}!function(){const e=Object.create(null);for(const t of mNe)e[t.id]=t}(),function(e){e.ElementSymbol=Ae.Value("Structure","ElementSymbol"),e.AtomName=Ae.Value("Structure","AtomName"),e.BondFlag=Ae.OneOf("Structure","BondFlag",Ae.Str,["covalent","metallic","ion","hydrogen","sulfide","computed","aromatic"]),e.BondFlags=zn.Flags(e.BondFlag,"BondFlags"),e.SecondaryStructureFlag=Ae.OneOf("Structure","SecondaryStructureFlag",Ae.Str,["alpha","beta","3-10","pi","sheet","strand","helix","turn","none"]),e.SecondaryStructureFlags=zn.Flags(e.SecondaryStructureFlag,"SecondaryStructureFlag"),e.RingFingerprint=Ae.Value("Structure","RingFingerprint"),e.EntityType=Ae.OneOf("Structure","EntityType",Ae.Str,["polymer","non-polymer","water","branched"]),e.EntitySubtype=Ae.OneOf("Structure","EntitySubtype",Ae.Str,["other","polypeptide(D)","polypeptide(L)","polydeoxyribonucleotide","polyribonucleotide","polydeoxyribonucleotide/polyribonucleotide hybrid","cyclic-pseudo-peptide","peptide nucleic acid","oligosaccharide"]),e.ObjectPrimitive=Ae.OneOf("Structure","ObjectPrimitive",Ae.Str,["atomistic","sphere","gaussian","other"]),e.ResidueId=Ae.Value("Structure","ResidueId"),e.ElementSet=Ae.Value("Structure","ElementSet"),e.ElementSelection=Ae.Value("Structure","ElementSelection"),e.ElementReference=Ae.Value("Structure","ElementReference"),e.ElementSelectionQuery=zn.Fn(e.ElementSelection,"ElementSelectionQuery")}(wt||(wt={}));const ye={core:AB,structureQuery:{"@header":"Structure Queries",type:{"@header":"Types",elementSymbol:$t(Ot.Dictionary({0:ct(Ae.Str)}),wt.ElementSymbol,"Create element symbol representation from a string value."),atomName:$t(Ot.Dictionary({0:ct(Ae.AnyValue)}),wt.AtomName,"Convert a value to an atom name."),entityType:$t(Ot.Dictionary({0:ct(wt.EntityType)}),wt.EntityType,`Create normalized representation of entity type: ${Ae.oneOfValues(wt.EntityType).join(", ")}.`),bondFlags:$t(Ot.List(wt.BondFlag),wt.BondFlags,`Create bond flags representation from a list of strings. Allowed flags: ${Ae.oneOfValues(wt.BondFlag).join(", ")}.`),ringFingerprint:$t(Ot.List(wt.ElementSymbol,{nonEmpty:!0}),wt.RingFingerprint,"Create ring fingerprint from the supplied atom element list."),secondaryStructureFlags:$t(Ot.List(wt.SecondaryStructureFlag),wt.SecondaryStructureFlags,`Create secondary structure flags representation from a list of strings. Allowed flags: ${Ae.oneOfValues(wt.SecondaryStructureFlag).join(", ")}.`),authResidueId:$t(Ot.Dictionary({0:ct(Ae.Str,{description:"auth_asym_id"}),1:ct(Ae.Num,{description:"auth_seq_id"}),2:ct(Ae.Str,{description:"pdbx_PDB_ins_code",isOptional:!0})}),wt.ResidueId,'Residue identifier based on "auth_" annotation.'),labelResidueId:$t(Ot.Dictionary({0:ct(Ae.Str,{description:"label_entity_id"}),1:ct(Ae.Str,{description:"label_asym_id"}),2:ct(Ae.Num,{description:"label_seq_id"}),3:ct(Ae.Str,{description:"pdbx_PDB_ins_code",isOptional:!0})}),wt.ResidueId,'Residue identifier based on mmCIF\'s "label_" annotation.')},slot:{"@header":"Iteration Slots",element:$t(Ot.None,wt.ElementReference,"A reference to the current element."),elementSetReduce:$t(Ot.None,Ae.Variable("a",Ae.AnyValue,!0),"Current value of the element set reducer.")},generator:{"@header":"Generators",all:$t(Ot.None,wt.ElementSelectionQuery,"The entire structure."),atomGroups:$t(Ot.Dictionary({"entity-test":ct(Ae.Bool,{isOptional:!0,defaultValue:!0,description:"Test for the 1st atom of every entity"}),"chain-test":ct(Ae.Bool,{isOptional:!0,defaultValue:!0,description:"Test for the 1st atom of every chain"}),"residue-test":ct(Ae.Bool,{isOptional:!0,defaultValue:!0,description:"Test for the 1st atom every residue"}),"atom-test":ct(Ae.Bool,{isOptional:!0,defaultValue:!0}),"group-by":ct(Ae.Any,{isOptional:!0,defaultValue:"atom-key",description:"Group atoms to sets based on this property. Default: each atom has its own set"})}),wt.ElementSelectionQuery,"Return all atoms for which the tests are satisfied, grouped into sets."),bondedAtomicPairs:$t(Ot.Dictionary({0:ct(Ae.Bool,{isOptional:!0,defaultValue:"true for covalent bonds",description:"Test each bond with this predicate. Each bond is visited twice with swapped atom order."})}),wt.ElementSelectionQuery,"Return all pairs of atoms for which the test is satisfied."),rings:$t(Ot.Dictionary({fingerprint:ct(wt.RingFingerprint,{isOptional:!0}),"only-aromatic":ct(Ae.Bool,{isOptional:!0,defaultValue:!1})}),wt.ElementSelectionQuery,"Return all rings or those with the specified fingerprint and/or only aromatic rings."),queryInSelection:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),query:ct(wt.ElementSelectionQuery),"in-complement":ct(Ae.Bool,{isOptional:!0,defaultValue:!1})}),wt.ElementSelectionQuery,"Executes query only on atoms that are in the source selection."),empty:$t(Ot.None,wt.ElementSelectionQuery,"Nada.")},modifier:{"@header":"Selection Modifications",queryEach:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),query:ct(wt.ElementSelectionQuery)}),wt.ElementSelectionQuery,"Query every atom set in the input selection separately."),intersectBy:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),by:ct(wt.ElementSelectionQuery)}),wt.ElementSelectionQuery,"Intersect each atom set from the first sequence from atoms in the second one."),exceptBy:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),by:ct(wt.ElementSelectionQuery)}),wt.ElementSelectionQuery,"Remove all atoms from 'selection' that occur in 'by'."),unionBy:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),by:ct(wt.ElementSelectionQuery)}),wt.ElementSelectionQuery,"For each atom set A in the orginal sequence, combine all atoms sets in the target selection that intersect with A."),union:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery)}),wt.ElementSelectionQuery,"Collects all atom sets in the sequence into a single atom set."),cluster:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),"min-distance":ct(Ae.Num,{isOptional:!0,defaultValue:0}),"max-distance":ct(Ae.Num),"min-size":ct(Ae.Num,{description:"Minimal number of sets to merge, must be at least 2",isOptional:!0,defaultValue:2}),"max-size":ct(Ae.Num,{description:"Maximal number of sets to merge, if not set, no limit",isOptional:!0})}),wt.ElementSelectionQuery,"Combines atom sets that have mutual distance in the interval [min-radius, max-radius]. Minimum/maximum size determines how many atom sets can be combined."),includeSurroundings:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),radius:ct(Ae.Num),"atom-radius":ct(Ae.Num,{isOptional:!0,defaultValue:0,description:"Value added to each atom before the distance check, for example VDW radius. Using this argument is computationally demanding."}),"as-whole-residues":ct(Ae.Bool,{isOptional:!0})}),wt.ElementSelectionQuery,"For each atom set in the selection, include all surrouding atoms/residues that are within the specified radius."),surroundingLigands:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),radius:ct(Ae.Num),"include-water":ct(Ae.Bool,{isOptional:!0,defaultValue:!0})}),wt.ElementSelectionQuery,"Find all ligands components around the source query."),includeConnected:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),"bond-test":ct(Ae.Bool,{isOptional:!0,defaultValue:"true for covalent bonds"}),"layer-count":ct(Ae.Num,{isOptional:!0,defaultValue:1,description:"Number of bonded layers to include."}),"fixed-point":ct(Ae.Bool,{isOptional:!0,defaultValue:!1,description:"Continue adding layers as long as new connections exist."}),"as-whole-residues":ct(Ae.Bool,{isOptional:!0})}),wt.ElementSelectionQuery,"Pick all atom sets that are connected to the target."),wholeResidues:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery)}),wt.ElementSelectionQuery,"Expand the selection to whole residues."),expandProperty:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),property:ct(Ae.AnyValue)}),wt.ElementSelectionQuery,"To each atom set in the selection, add all atoms that have the same property value that was already present in the set.")},filter:{"@header":"Selection Filters",pick:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),test:ct(Ae.Bool)}),wt.ElementSelectionQuery,"Pick all atom sets that satisfy the test."),first:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery)}),wt.ElementSelectionQuery,"Take the 1st atom set in the sequence."),withSameAtomProperties:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),source:ct(wt.ElementSelectionQuery),property:ct(Ae.Any)}),wt.ElementSelectionQuery,"Pick all atom sets for which the set of given atom properties is a subset of the source properties."),intersectedBy:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),by:ct(wt.ElementSelectionQuery)}),wt.ElementSelectionQuery,"Pick all atom sets that have non-zero intersection with the target."),within:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),target:ct(wt.ElementSelectionQuery),"min-radius":ct(Ae.Num,{isOptional:!0,defaultValue:0}),"max-radius":ct(Ae.Num),"atom-radius":ct(Ae.Num,{isOptional:!0,defaultValue:0,description:"Value added to each atom before the distance check, for example VDW radius. Using this argument is computationally demanding."}),invert:ct(Ae.Bool,{isOptional:!0,defaultValue:!1,description:"If true, pick only atom sets that are further than the specified radius."})}),wt.ElementSelectionQuery,"Pick all atom sets from selection that have any atom within the radius of any atom from target."),isConnectedTo:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery),target:ct(wt.ElementSelectionQuery),"bond-test":ct(Ae.Bool,{isOptional:!0,defaultValue:"true for covalent bonds"}),disjunct:ct(Ae.Bool,{isOptional:!0,defaultValue:!0,description:"If true, there must exist a bond to an atom that lies outside the given atom set to pass test."}),invert:ct(Ae.Bool,{isOptional:!0,defaultValue:!1,description:"If true, return atom sets that are not connected."})}),wt.ElementSelectionQuery,"Pick all atom sets that are connected to the target.")},combinator:{"@header":"Selection Combinators",intersect:$t(Ot.List(wt.ElementSelectionQuery),wt.ElementSelectionQuery,"Return all unique atom sets that appear in all of the source selections."),merge:$t(Ot.List(wt.ElementSelectionQuery),wt.ElementSelectionQuery,"Merges multiple selections into a single one. Only unique atom sets are kept."),distanceCluster:$t(Ot.Dictionary({matrix:ct(zn.List(zn.List(Ae.Num)),{description:"Distance matrix, represented as list of rows (num[][])). Lower triangle is min distance, upper triangle is max distance."}),selections:ct(zn.List(wt.ElementSelectionQuery),{description:"A list of held selections."})}),wt.ElementSelectionQuery,"Pick combinations of atom sets from the source sequences that are mutually within distances specified by a matrix.")},atomSet:{"@header":"Atom Sets",atomCount:$t(Ot.None,Ae.Num),countQuery:$t(Ot.Dictionary({0:ct(wt.ElementSelectionQuery)}),Ae.Num,"Counts the number of occurences of a specific query inside the current atom set."),reduce:$t(Ot.Dictionary({initial:ct(Ae.Variable("a",Ae.AnyValue,!0),{description:"Initial value assigned to slot.atom-set-reduce. Current atom is set to the 1st atom of the current set for this."}),value:ct(Ae.Variable("a",Ae.AnyValue,!0),{description:"Expression executed for each atom in the set"})}),Ae.Variable("a",Ae.AnyValue,!0),"Execute the value expression for each atom in the current atom set and return the result. Works the same way as Array.reduce in JavaScript (``result = value(value(...value(initial)))``)"),propertySet:$t(Ot.Dictionary({0:ct(zn.ConstrainedVar)}),zn.Set(zn.ConstrainedVar),"Returns a set with all values of the given property in the current atom set.")},atomProperty:{"@header":"Atom Properties",core:{"@header":"Core Properties",elementSymbol:Bn(wt.ElementSymbol),vdw:Bn(Ae.Num,"Van der Waals radius"),mass:Bn(Ae.Num,"Atomic weight"),atomicNumber:Bn(Ae.Num,"Atomic number"),x:Bn(Ae.Num,"Cartesian X coordinate"),y:Bn(Ae.Num,"Cartesian Y coordinate"),z:Bn(Ae.Num,"Cartesian Z coordinate"),atomKey:Bn(Ae.AnyValue,"Unique value for each atom. Main use case is grouping of atoms."),bondCount:$t(Ot.Dictionary({0:ct(wt.ElementReference,{isOptional:!0,defaultValue:"slot.current-atom"}),flags:ct(wt.BondFlags,{isOptional:!0,defaultValue:"covalent"})}),Ae.Num,"Number of bonds (by default only covalent bonds are counted)."),sourceIndex:Bn(Ae.Num,"Index of the atom/element in the input file."),operatorName:Bn(Ae.Str,"Name of the symmetry operator applied to this element."),operatorKey:Bn(Ae.Num,"Key of the symmetry operator applied to this element."),modelIndex:Bn(Ae.Num,"Index of the model in the input file."),modelLabel:Bn(Ae.Str,"Label/header of the model in the input file.")},topology:{connectedComponentKey:Bn(Ae.AnyValue,"Unique value for each connected component.")},macromolecular:{"@header":"Macromolecular Properties (derived from the mmCIF format)",authResidueId:Bn(wt.ResidueId,"type.auth-residue-id symbol executed on current atom's residue"),labelResidueId:Bn(wt.ResidueId,"type.label-residue-id symbol executed on current atom's residue"),residueKey:Bn(Ae.AnyValue,"Unique value for each tuple ``(label_entity_id,auth_asym_id, auth_seq_id, pdbx_PDB_ins_code)``, main use case is grouping of atoms"),chainKey:Bn(Ae.AnyValue,"Unique value for each tuple ``(label_entity_id, auth_asym_id)``, main use case is grouping of atoms"),entityKey:Bn(Ae.AnyValue,"Unique value for each tuple ``label_entity_id``, main use case is grouping of atoms"),isHet:Bn(Ae.Bool,"Equivalent to atom_site.group_PDB !== ATOM"),id:Bn(Ae.Num,"_atom_site.id"),label_atom_id:Bn(wt.AtomName),label_alt_id:Bn(Ae.Str),label_comp_id:Bn(Ae.Str),label_asym_id:Bn(Ae.Str),label_entity_id:Bn(Ae.Str),label_seq_id:Bn(Ae.Num),auth_atom_id:Bn(wt.AtomName),auth_comp_id:Bn(Ae.Str),auth_asym_id:Bn(Ae.Str),auth_seq_id:Bn(Ae.Num),pdbx_PDB_ins_code:Bn(Ae.Str),pdbx_formal_charge:Bn(Ae.Num),occupancy:Bn(Ae.Num),B_iso_or_equiv:Bn(Ae.Num),entityType:Bn(wt.EntityType,"Type of the entity as defined in mmCIF (polymer, non-polymer, branched, water)"),entitySubtype:Bn(wt.EntitySubtype,"Subtype of the entity as defined in mmCIF _entity_poly.type and _pdbx_entity_branch.type (other, polypeptide(D), polypeptide(L), polydeoxyribonucleotide, polyribonucleotide, polydeoxyribonucleotide/polyribonucleotide hybrid, cyclic-pseudo-peptide, peptide nucleic acid, oligosaccharide)"),entityPrdId:Bn(Ae.Str,"The PRD ID of the entity."),entityDescription:Bn(zn.List(Ae.Str)),objectPrimitive:Bn(wt.ObjectPrimitive,"Type of the primitive object used to model this segment as defined in mmCIF/IHM (atomistic, sphere, gaussian, other)"),secondaryStructureKey:Bn(Ae.AnyValue,"Unique value for each secondary structure element."),secondaryStructureFlags:Bn(wt.SecondaryStructureFlags),isModified:Bn(Ae.Bool,"True if the atom belongs to modification of a standard residue."),modifiedParentName:Bn(Ae.Str,"'3-letter' code of the modifed parent residue."),isNonStandard:Bn(Ae.Bool,"True if this is a non-standard residue."),chemCompType:Bn(Ae.Str,"Type of the chemical component as defined in mmCIF.")}},bondProperty:{"@header":"Bond Properties",flags:qb(wt.BondFlags),order:qb(Ae.Num),key:qb(Ae.Num),length:qb(Ae.Num),atomA:qb(wt.ElementReference),atomB:qb(wt.ElementReference)}},internal:{"@header":"Internal Queries",generator:{"@header":"Generators",bundleElement:$t(Ot.Dictionary({groupedUnits:ct(Ae.Any),set:ct(Ae.Any),ranges:ct(Ae.Any)}),Ae.Any),bundle:$t(Ot.Dictionary({elements:ct(Ae.Any)}),wt.ElementSelectionQuery,"A selection with single structure containing represented by the bundle."),current:$t(Ot.None,wt.ElementSelectionQuery,"Current selection provided by the query context. Avoid using this in State Transforms.")}}};TQ(ye);const TNe=DQ(ye);var ue;function Yo(){return Yo.zero()}function id(){return id.zero()}function st(e){return e}function Gn(e,t,n,r){return{label:e,description:n,list:r,type:t}}function KI(e,t,n){const r={};for(const i in e){let o=e[i];o=st.saturate(o,t),o=st.darken(o,-n),r[i]=o}return r}function RQ(e,t=" "){return e.replace(/([a-z\xE0-\xFF])([A-Z\xC0\xDF])/g,`$1${t}$2`)}!function(){const e=Object.create(null);for(const t of TNe)e[t.id]=t}(),function(e){e.core=ye.core,e.struct=ye.structureQuery,e.internal=ye.internal,e.atomName=function t(b){return e.struct.type.atomName([b])},e.es=function n(b){return e.struct.type.elementSymbol([b])},e.list=function r(...b){return e.core.type.list(b)},e.set=function i(...b){return e.core.type.set(b)},e.re=function o(b,x){return e.core.type.regex([b,x])},e.fn=function s(b){return e.core.ctrl.fn([b])},e.evaluate=function a(b){return e.core.ctrl.eval([b])};const c=e.struct.atomProperty.core,u=e.struct.atomProperty.macromolecular,l=e.struct.atomProperty.topology;function d(b){return c[b]()}function f(b){return l[b]()}function p(b){return u[b]()}e.acp=d,e.atp=f,e.ammp=p;const m=e.struct.atomSet.propertySet;e.acpSet=function h(b){return m([d(b)])},e.atpSet=function g(b){return m([f(b)])},e.ammpSet=function y(b){return m([p(b)])}}(ue||(ue={})),function(e){function t(){const T=[.1,0,0];return T[0]=0,T}function c(T,M){const[N,V,F]=M,G=Math.sqrt(V*V+F*F);let L=(su(Math.atan2(F,V))+360)%360;return 0===Math.round(1e4*G)&&(L=Number.NaN),T[0]=L,T[1]=G,T[2]=N,T}function l(T,M,N){return T[0]=M[0]-h*N,T[1]=M[1],T[2]=M[2],T}e.zero=t,e.create=function n(T,M,N){const V=t();return V[0]=T,V[1]=M,V[2]=N,V},e.set=function r(T,M,N,V){return T[0]=M,T[1]=N,T[2]=V,T},e.distance=function i(T,M){const N=M[0]-T[0],V=M[1]-T[1],F=M[2]-T[2];return Math.sqrt(N*N+V*V+F*F)},e.fromColor=function o(T,M){const[N,V,F]=st.toRgb(M),[G,L,z]=function R(T,M,N){return[I((.4124564*(T=D(T))+.3575761*(M=D(M))+.1804375*(N=D(N)))/g),I((.2126729*T+.7151522*M+.072175*N)/y),I((.0193339*T+.119192*M+.9503041*N)/b)]}(N,V,F),j=116*L-16;return T[0]=j<0?0:j,T[1]=500*(G-L),T[2]=200*(L-z),T},e.fromHcl=function s(T,M){return id.toLab(T,M)},e.toColor=function a(T){let M=(T[0]+16)/116,N=isNaN(T[1])?M:M+T[1]/500,V=isNaN(T[2])?M:M-T[2]/200;M=y*w(M),N=g*w(N),V=b*w(V);const F=E(3.2404542*N-1.5371385*M-.4985314*V),G=E(-.969266*N+1.8760108*M+.041556*V),L=E(.0556434*N-.2040259*M+1.0572252*V);return st.fromRgb(Math.round(os(F,0,255)),Math.round(os(G,0,255)),Math.round(os(L,0,255)))},e.toHcl=c,e.copy=function u(T,M){return T[0]=M[0],T[1]=M[1],T[2]=M[2],T},e.darken=l,e.lighten=function d(T,M,N){return l(T,M,-N)};const f=[0,0,0];function p(T,M,N){return c(f,M),id.toLab(T,id.saturate(f,f,N))}e.saturate=p,e.desaturate=function m(T,M,N){return p(T,M,-N)};const h=18,g=.95047,y=1,b=1.08883,x=.137931034,_=.206896552,S=.12841855,A=.008856452;function E(T){return 255*(T<=.00304?12.92*T:1.055*Math.pow(T,1/2.4)-.055)}function w(T){return T>_?T*T*T:S*(T-x)}function D(T){return(T/=255)<=.04045?T/12.92:Math.pow((T+.055)/1.055,2.4)}function I(T){return T>A?Math.pow(T,1/3):T/S+x}}(Yo||(Yo={})),function(e){function t(){const b=[.1,0,0];return b[0]=0,b}e.zero=t,e.create=function n(b,x,_){const S=t();return S[0]=b,S[1]=x,S[2]=_,S},e.set=function r(b,x,_,S){return b[0]=x,b[1]=_,b[2]=S,b},e.hasHue=function i(b){return!isNaN(b[0])};const o=[0,0,0];e.fromColor=function s(b,x){return Yo.toHcl(b,Yo.fromColor(o,x))},e.fromLab=function a(b,x){return Yo.toHcl(b,x)};const c=[0,0,0];function l(b,x){let[_,S,A]=x;return isNaN(_)&&(_=0),_=Yn(_),b[0]=A,b[1]=Math.cos(_)*S,b[2]=Math.sin(_)*S,b}function f(b,x,_){return b[0]=x[0],b[1]=Math.max(0,x[1]+y*_),b[2]=x[2],b}e.toColor=function u(b){return Yo.toColor(l(c,b))},e.toLab=l,e.copy=function d(b,x){return b[0]=x[0],b[1]=x[1],b[2]=x[2],b},e.saturate=f,e.desaturate=function p(b,x,_){return f(b,x,-_)};const m=[0,0,0];function h(b,x,_){return l(m,x),Yo.toHcl(b,Yo.darken(m,m,_))}e.darken=h,e.lighten=function g(b,x,_){return h(b,x,-_)};const y=18}(id||(id={})),function(e){function u(F,G,L){return F<<16|G<<8|L}function l(F,G,L){return 255*F<<16|255*G<<8|255*L}function b(F){const G=F>>16&255;return G!==(F>>8&255)||G!==(255&F)}e.toStyle=function t(F){return`rgb(${F>>16&255}, ${F>>8&255}, ${255&F})`},e.toHexStyle=function n(F){return"#"+("000000"+F.toString(16)).slice(-6)},e.toHexString=function r(F){return"0x"+("000000"+F.toString(16)).slice(-6)},e.toRgbString=function i(F){return`RGB: ${e.toRgb(F).join(", ")}`},e.toRgb=function o(F){return[F>>16&255,F>>8&255,255&F]},e.toRgbNormalized=function s(F){return[(F>>16&255)/255,(F>>8&255)/255,(255&F)/255]},e.fromHexStyle=function a(F){return parseInt(F.replace("#","0x"))},e.fromHexString=function c(F){return parseInt(F)},e.fromRgb=u,e.fromNormalizedRgb=l,e.fromArray=function d(F,G){return u(F[G],F[G+1],F[G+2])},e.fromNormalizedArray=function f(F,G){return l(F[G],F[G+1],F[G+2])},e.toArray=function p(F,G,L){return G[L]=F>>16&255,G[L+1]=F>>8&255,G[L+2]=255&F,G},e.toArrayNormalized=function m(F,G,L){return G[L]=(F>>16&255)/255,G[L+1]=(F>>8&255)/255,G[L+2]=(255&F)/255,G},e.toVec3=function h(F,G){return F[0]=G>>16&255,F[1]=G>>8&255,F[2]=255&G,F},e.toVec3Normalized=function g(F,G){return F[0]=(G>>16&255)/255,F[1]=(G>>8&255)/255,F[2]=(255&G)/255,F},e.interpolate=function y(F,G,L){const z=F>>16&255,j=F>>8&255,Z=255&F;return z+((G>>16&255)-z)*L<<16|j+((G>>8&255)-j)*L<<8|Z+((255&G)-Z)*L},e.hasHue=b;const x=[0,0,0];function _(F,G){return b(F)?(id.fromColor(x,F),id.toColor(id.saturate(x,x,G))):F}e.saturate=_,e.desaturate=function S(F,G){return _(F,-G)};const A=[0,0,0];function E(F,G){return Yo.fromColor(A,F),Yo.toColor(Yo.darken(A,A,G))}function D(F){return F<=.03928?F/12.92:Math.pow((F+.055)/1.055,2.4)}function I(F){return.2126*D((F>>16&255)/255)+.7152*D((F>>8&255)/255)+.0722*D((255&F)/255)}function T(F){return F<.04045?.0773993808*F:Math.pow(.9478672986*F+.0521327014,2.4)}function N(F){return F<.0031308?12.92*F:1.055*Math.pow(F,.41666)-.055}e.darken=E,e.lighten=function w(F,G){return E(F,-G)},e.luminance=I,e.contrast=function R(F,G){const L=I(F),z=I(G);return L>z?(L+.05)/(z+.05):(z+.05)/(L+.05)},e.sRGBToLinear=function M(F){return l(T((F>>16&255)/255),T((F>>8&255)/255),T((255&F)/255))},e.linearToSRGB=function V(F){return l(N((F>>16&255)/255),N((F>>8&255)/255),N((255&F)/255))}}(st||(st={}));const PNe=e=>e.toUpperCase();function Fg(e){return e.toLowerCase().replace(/^\w|\s\w/g,PNe)}function zu(e){return Fg(RQ(function kQ(e){return e.replace(/_/g," ")}(function NQ(e){return e.replace(/-/g," ")}(e))))}function to(e,t,n,r){const i=r.length;if(i>n-t)return!1;for(let o=0;o]+>/g,"")}function s2(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Pc={"orange-red":Gn("Orange-Red","sequential","Orange-Red, sequential color scheme from ColorBrewer 2.0",[16775148,16705736,16635038,16628612,16551257,15689032,14102559,11730944,8323072]),"purple-blue":Gn("Purple-Blue","sequential","Purple-Blue, sequential color scheme from ColorBrewer 2.0",[16775163,15525874,13685222,10927579,7645647,3576e3,356528,285325,145496]),"blue-purple":Gn("Blue-Purple","sequential","Blue-Purple, sequential color scheme from ColorBrewer 2.0",[16252157,14740724,12571622,10403034,9213638,9202609,8929693,8458108,5046347]),oranges:Gn("Oranges","sequential","",[16774635,16705230,16634018,16625259,16616764,15821075,14239745,10892803,8333060]),"blue-green":Gn("Blue-Green","sequential","",[16252157,15070713,13429990,10082505,6734500,4304502,2329413,27948,17435]),"yellow-orange-brown":Gn("Yellow-Orange-Brown","sequential","",[16777189,16775100,16704401,16696399,16685353,15495188,13388802,10040324,6694150]),"yellow-green":Gn("Yellow-Green","sequential","",[16777189,16252089,14282915,11394446,7915129,4303709,2327619,26679,17705]),reds:Gn("Reds","sequential","",[16774640,16703698,16563105,16552562,16476746,15678252,13309981,10817301,6750221]),"red-purple":Gn("Red-Purple","sequential","",[16775155,16638173,16565696,16424885,16214177,14496919,11403646,7995767,4784234]),greens:Gn("Greens","sequential","",[16252149,15070688,13101504,10607003,7652470,4303709,2329413,27948,17435]),"yellow-green-blue":Gn("Yellow-Green-Blue","sequential","",[16777177,15595697,13101492,8375739,4306628,1937856,2252456,2438292,531800]),purples:Gn("Purples","sequential","",[16579581,15724021,14342891,12369372,10394312,8420794,6967715,5515151,4128893]),"green-blue":Gn("Green-Blue","sequential","",[16252144,14742491,13429701,11066805,8113348,5157843,2854078,551084,540801]),greys:Gn("Greys","sequential","",[16777215,15790320,14277081,12434877,9868950,7566195,5395026,2434341,0]),"yellow-orange-red":Gn("Yellow-Orange-Red","sequential","",[16777164,16772512,16701814,16691788,16616764,16535082,14883356,12386342,8388646]),"purple-red":Gn("Purple-Red","sequential","",[16250105,15196655,13941210,13210823,14640560,15149450,13505110,9961539,6750239]),blues:Gn("Blues","sequential","",[16251903,14609399,13032431,10406625,7057110,4362950,2191797,545180,536683]),"purple-blue-green":Gn("Purple-Blue-Green","sequential","",[16775163,15524592,13685222,10927579,6793679,3576e3,164234,93273,83510]),spectral:Gn("Spectral","diverging","",[10355010,13975119,16018755,16625249,16703627,16777151,15136152,11263396,6734501,3311805,6180770]),"red-yellow-green":Gn("Red-Yellow-Green","diverging","",[10813478,14102567,16018755,16625249,16703627,16777151,14282635,10934634,6733155,1742928,26679]),"red-blue":Gn("Red-Blue","diverging","",[6750239,11671595,14049357,16033154,16636871,16250871,13755888,9618910,4428739,2188972,340065]),"pink-yellow-green":Gn("Pink-Yellow-Green","diverging","",[9306450,12917629,14579630,15840986,16638191,16250871,15136208,12116358,8371265,5083681,2581529]),"purple-green":Gn("Purple-Green","diverging","",[4194379,7744131,10055851,12756431,15193320,16250871,14282963,10935200,5942881,1800247,17435]),"red-yellow-blue":Gn("Red-Yellow-Blue","diverging","Red-Yellow-Blue, diverging color scheme from ColorBrewer 2.0",[10813478,14102567,16018755,16625249,16703632,16777151,14742520,11262441,7646673,4552116,3225237]),"brown-white-green":Gn("Brown-White-Green","diverging","",[5517317,9195786,12550445,14664317,16181443,16119285,13101797,8441281,3512207,91742,15408]),"red-grey":Gn("Red-Grey","diverging","",[6750239,11671595,14049357,16033154,16636871,16777215,14737632,12237498,8882055,5066061,1710618]),"orange-purple":Gn("Orange-Purple","diverging","",[8338184,11753478,14713364,16627811,16703670,16250871,14211819,11709394,8418220,5515144,2949195]),"set-2":Gn("Set-2","qualitative","",[6734501,16551266,9281739,15174339,10934356,16767279,15058068,11776947]),accent:Gn("Accent","qualitative","",[8374655,12496596,16629894,16777113,3697840,15729279,12540695,6710886]),"set-1":Gn("Set-1","qualitative","",[14948892,3636920,5091146,9981603,16744192,16777011,10901032,16220607,10066329]),"set-3":Gn("Set-3","qualitative","",[9294791,16777139,12499674,16482418,8434131,16626786,11787881,16567781,14277081,12353725,13429701,16772463]),"dark-2":Gn("Dark-2","qualitative","",[1810039,14245634,7696563,15149450,6727198,15117058,10909213,6710886]),paired:Gn("Paired","qualitative","",[10931939,2062516,11722634,3383340,16489113,14883356,16629615,16744192,13284054,6962586,16777113,11622696]),"pastel-2":Gn("Pastel-2","qualitative","",[11789005,16633260,13358568,16042724,15136201,16773806,15852236,13421772]),"pastel-1":Gn("Pastel-1","qualitative","",[16495790,11783651,13429701,14601188,16701862,16777164,15063229,16636652,15921906]),"many-distinct":Gn("Many-Distinct","qualitative","",[1810039,14245634,7696563,15149450,6727198,15117058,10909213,6710886,14948892,3636920,5091146,9981603,16744192,16777011,10901032,16220607,10066329,6734501,16551266,9281739,15174339,10934356,16767279,15058068,11776947]),magma:Gn("Magma","sequential","Perceptually uniform shades of black-red-white",[4329332,4853881,5378684,5903742,6363263,6888576,7413633,7938689,8463745,8988801,9513600,10038655,10563454,11088508,11613562,12138360,12728949,13254258,13714030,14239338,14699366,15094114,15489119,15753309,16017499,16216411,16350045,16483424,16551523,16619368,16621934,16689780,16692091,16694402,16696969,16633746,16636058,16638371,16575148,16577461,16514239]),inferno:Gn("Inferno","sequential","Perceptually uniform shades of black-red-yellow",[4721514,5246316,5771373,6296430,6821486,7346542,7871597,8396651,8921450,9446504,9971557,10496610,10956127,11481435,12006486,12466258,12926285,13386056,13780802,14241085,14570295,14965297,15229227,15558693,15757342,15956248,16154897,16288267,16421638,16489734,16492043,16494612,16496926,16368426,16305463,16111429,15982678,15853928,15856253,16119953,16580260]),plasma:Gn("Plasma","sequential","Perceptually uniform shades of blue-red-yellow",[1771148,2426257,3081365,3671193,4195228,4784799,5308834,5833124,6357158,6815911,7340200,7864744,8324007,8783782,9309348,9769377,10164126,10624154,11018902,11413393,11808141,12137352,12466307,12795519,13124730,13453685,13717361,14046573,14309992,14573668,14837344,15035483,15299159,15497299,15695438,15893834,16091974,16224833,16357693,16425017,16557877,16625457,16627245,16629289,16631334,16567845,16438820,16310052,16115494,15921190,15726625]),viridis:Gn("Viridis","sequential","Perceptually uniform shades of blue-green-yellow",[4524123,4656994,4658793,4726127,4727668,4663929,4599933,4535937,4406404,4276870,4081800,3952010,3822475,3627148,3497356,3302029,3172237,3042446,2912654,2782862,2652814,2523022,2393229,2328973,2198924,2069132,2004874,2005897,2007175,2139525,2337154,2666111,3060348,3520376,4045684,4570991,5227369,5883748,6605661,7392854,8180303,8967495,9819967,10672695,11525166,12443174,13295646,14148121,15000344,15852828,16639780]),cividis:Gn("Cividis","sequential","Perceptually uniform shades of blue-green-yellow, should look effectively identical to colorblind and non-colorblind users",[11367,12400,537456,1455727,2046574,2571629,3031404,3425388,3754092,4148075,4476779,4805227,5133932,5396844,5725549,5988462,6317166,6580079,6843249,7171698,7434867,7697781,7960951,8289656,8618104,8881272,9209976,9538679,9867127,10195830,10524533,10853235,11181938,11510640,11839343,12168045,12497002,12891240,13219941,13548642,13943134,14271834,14666326,14995025,15389516,15718470,16112703,16507190,16639799]),twilight:Gn("Twilight","sequential","Perceptually uniform shades of white-blue-black-red-white, cyclic",[14670305,14211037,13554648,12766675,11847630,10993866,10139847,9351365,8628419,8036290,7509952,7048895,6718653,6519739,6386105,6252470,6184114,6181293,6112935,6044831,5976470,5777291,5447293,5052270,4592479,4067665,3674181,3281211,3150646,3543352,4067644,4657728,5379141,6166345,6953549,7741007,8463184,9120336,9777743,10304079,10830671,11291984,11687762,12083541,12348505,12613471,12878439,13077872,13211771,13411209,13545111,13809830,14074293,14338756,14537169,14735067,14801121]),turbo:Gn("Turbo","sequential","Improved (smooth) rainbow colormap for visualization",[4866485,4872413,4354034,3770361,3120629,2667241,2475736,2611140,3073454,3928216,5109892,6487408,8126047,9829201,11531332,13167162,14605618,15780908,16693543,16753699,16748063,16741916,16146200,15026195,13644558,12198408,10818563,9833728]),rainbow:Gn("Rainbow","sequential","",[3367393,3516485,16383744,15501073,12526114]),"red-white-blue":Gn("Red-White-Blue","diverging","",[12526114,16777215,3367393])},FQ=Object.keys(Pc).map(e=>[e,Pc[e].label,Fg(Pc[e].type)]);function cp(e){return e in Pc?Pc[e]:(console.warn(`unknown color list named '${e}'`),Pc["red-yellow-blue"])}function $h(e){return{kind:"table-legend",table:e}}FQ.filter(e=>"diverging"===Pc[e[0]].type||"sequential"===Pc[e[0]].type),FQ.filter(e=>"qualitative"===Pc[e[0]].type);const NNe={domain:[0,1],reverse:!1,listOrName:"red-yellow-blue",minLabel:"",maxLabel:""};var Gu;!function(e){e.create=function t(n){const{domain:r,reverse:i,listOrName:o}={...NNe,...n},s="string"==typeof o?cp(o).list:o,a=i?s.slice().reverse():s,c=a.length-1;let u=0,l=0,d=0;function f(y,b){l=y,d=b,u=d-l||1}f(r[0],r[1]);const p=Ds(n.minLabel,l.toString()),m=Ds(n.maxLabel,d.toString());let h;if(a.every(y=>Array.isArray(y))){const y=[...a];y.sort((S,A)=>S[1]-A[1]);const b=y.map(S=>S[0]),x=je.ofSortedArray(y.map(S=>S[1])),_=b.length-1;h=S=>{const A=os((S-l)/u,0,1),E=je.findPredecessorIndex(x,A);if(0===E)return b[l];if(E>_)return b[_];const w=x[E-1],I=os((A-w)/(x[E]-w),0,1);return st.interpolate(b[E-1],b[E],I)}}else h=y=>{const b=Math.min(a.length-1,Math.max(0,(y-l)/u*c)),x=Math.floor(b),_=a[x],S=a[Math.ceil(b)];return st.interpolate(_,S,b-x)};return{color:h,colorToArray:(y,b,x)=>{st.toArray(h(y),b,x)},normalizedColorToArray:(y,b,x)=>{st.toArrayNormalized(h(y),b,x)},setDomain:f,get legend(){return function kNe(e,t,n){return{kind:"scale-legend",minLabel:e,maxLabel:t,colors:n}}(p,m,a)}}}}(Gu||(Gu={}));const BQ=new Set(["145","147","149","289","291","293","445","475","491","510","604","045","05L","07E","07Y","08U","09X","0AT","0BD","0H0","0HX","0LP","0MK","0NZ","0TS","0UB","0V4","0WK","0XY","0YT","10M","12E","14T","15L","16F","16G","16O","17T","18D","18O","18T","1AR","1BW","1CF","1FT","1GL","1GN","1JB","1LL","1NA","1S3","1S4","1SD","1X4","20S","20X","22O","22S","23V","24S","25E","26M","26O","26Q","26R","26V","26W","26Y","27C","2DG","2DR","2F8","2FG","2FL","2FP","2GL","2GS","2H5","2HA","2M4","2M5","2M8","2OS","2SI","2WP","2WS","32O","34V","38J","3BU","3CM","3DO","3DY","3FM","3GR","3HD","3J3","3J4","3LJ","3LR","3MF","3MG","3MK","3R3","3S6","3SA","3YW","40J","42D","44S","46D","46M","46Z","48Z","49A","49S","49T","49V","4AM","4CQ","4GC","4GL","4GP","4JA","4N2","4NN","4QY","4R1","4RS","4SG","4U0","4U1","4U2","4UZ","4V5","50A","51N","56N","57S","5DI","5GF","5GO","5II","5KQ","5KS","5KT","5KV","5L2","5L3","5LS","5LT","5MM","5N6","5QP","5RP","5SA","5SP","5TH","5TJ","5TK","5TM","61J","62I","64K","66O","6BG","6C2","6DM","6GB","6GP","6GR","6K3","6KH","6KL","6KS","6KU","6KW","6LA","6LS","6LW","6MJ","6MN","6PG","6PY","6PZ","6S2","6SA","6UD","6Y6","6YR","6ZC","73E","79J","7CV","7D1","7GP","7JZ","7K2","7K3","7NU","7SA","83Y","89Y","8B7","8B9","8EX","8GA","8GG","8GP","8I4","8LM","8LR","8OQ","8PK","8S0","8YV","95Z","96O","98U","9AM","9C1","9CD","9GP","9KJ","9MR","9OK","9PG","9QG","9QZ","9S7","9SG","9SJ","9SM","9SP","9T1","9T7","9VP","9WJ","9WN","9WZ","9YW","A0K","A1Q","A2G","A5C","A6P","AAL","AAO","ABC","ABD","ABE","ABF","ABL","AC1","ACG","ACR","ACX","ADA","ADG","ADR","AF1","AFD","AFL","AFO","AFP","AFR","AGC","AGH","AGL","AGR","AH2","AH8","AHG","AHM","AHR","AIG","ALL","ALX","AMG","AMN","AMU","AMV","ANA","AOG","AOS","AQA","ARA","ARB","ARE","ARI","ARW","ASC","ASG","ASO","AXP","AXR","AY9","AZC","B0D","B16","B1H","B1N","B2G","B4G","B6D","B7G","B8D","B9D","BBK","BBV","BCD","BCW","BDF","BDG","BDP","BDR","BDZ","BEM","BFN","BFP","BG6","BG8","BGC","BGL","BGN","BGP","BGS","BHG","BM3","BM7","BMA","BMX","BND","BNG","BNX","BO1","BOG","BQY","BRI","BS7","BTG","BTU","BW3","BWG","BXF","BXP","BXX","BXY","BZD","C3B","C3G","C3X","C4B","C4W","C4X","C5X","CAP","CBF","CBI","CBK","CDR","CE5","CE6","CE8","CEG","CEX","CEY","CEZ","CGF","CJB","CKB","CKP","CNP","CR1","CR6","CRA","CT3","CTO","CTR","CTT","D0N","D1M","D5E","D6G","DAF","DAG","DAN","DDA","DDB","DDL","DEG","DEL","DFR","DFX","DG0","DGC","DGD","DGM","DGO","DGS","DGU","DIG","DJB","DJE","DK4","DKX","DKZ","DL6","DLD","DLF","DLG","DMU","DNO","DO8","DOM","DP5","DPC","DQQ","DQR","DR2","DR3","DR4","DR5","DRI","DSR","DT6","DVC","DYM","E3M","E4P","E5G","EAG","EBG","EBQ","EEN","EEQ","EGA","EJT","EMP","EMZ","EPG","EQP","EQV","ERE","ERI","ETT","EUS","F1P","F1X","F55","F58","F6P","F8X","FBP","FCA","FCB","FCT","FDP","FDQ","FFC","FFX","FIF","FIX","FK9","FKD","FMF","FMO","FNG","FNY","FRU","FSA","FSI","FSM","FSR","FSW","FU4","FUB","FUC","FUD","FUF","FUL","FUY","FVQ","FX1","FYJ","G0S","G16","G1P","G20","G28","G2F","G3F","G3I","G4D","G4S","G6D","G6P","G6S","G7P","G8Z","GAA","GAC","GAD","GAF","GAL","GAT","GBH","GC1","GC4","GC9","GCB","GCD","GCN","GCO","GCS","GCT","GCU","GCV","GCW","GDA","GDL","GE1","GE3","GFP","GIV","GL0","GL1","GL2","GL4","GL5","GL6","GL7","GL9","GLA","GLB","GLC","GLD","GLF","GLG","GLO","GLP","GLS","GLT","GLW","GM0","GMB","GMH","GMT","GMZ","GN1","GN4","GNS","GNX","GP0","GP1","GP4","GPH","GPK","GPM","GPO","GPQ","GPU","GPV","GPW","GQ1","GRF","GRX","GS1","GS4","GS9","GSA","GSD","GTE","GTH","GTK","GTM","GTR","GU0","GU1","GU2","GU3","GU4","GU5","GU6","GU8","GU9","GUF","GUL","GUP","GUZ","GXL","GXV","GYE","GYG","GYP","GYU","GYV","GZL","H1M","H1S","H2P","H3S","H53","H6Q","H6Z","HBZ","HD4","HDL","HMS","HNV","HNW","HSG","HSH","HSJ","HSQ","HSR","HSU","HSX","HSY","HSZ","HTG","HTM","HVC","I57","IAB","IDC","IDF","IDG","IDR","IDS","IDT","IDU","IDX","IDY","IEM","IN1","IPT","ISD","ISL","ISX","IVG","IXD","J5B","JFZ","JHM","JLT","JRV","JS2","JSV","JV4","JVA","JVS","JZR","K5B","K99","KBA","KBG","KD5","KDA","KDB","KDD","KDE","KDF","KDM","KDN","KDO","KDR","KFN","KG1","KGM","KHP","KME","KO1","KO2","KOT","KQC","KTU","L1L","L6N","L6S","L6T","LAG","LAH","LAI","LAK","LAO","LAT","LB2","LBS","LBT","LCN","LDY","LEC","LER","LFC","LFR","LGC","LGU","LKA","LKS","LM2","LMO","LMT","LMU","LNV","LOG","LOX","LPK","LRH","LSM","LTG","LTM","LVO","LVZ","LXB","LXC","LXZ","LZ0","M1F","M1P","M2F","M3M","M3N","M55","M6D","M6P","M7B","M7P","M8C","MA1","MA2","MA3","MA8","MAB","MAF","MAG","MAL","MAN","MAT","MAV","MAW","MBE","MBF","MBG","MCU","MDA","MDP","MFA","MFB","MFU","MG5","MGA","MGC","MGL","MGS","MJJ","MLB","MLR","MMA","MMN","MN0","MNA","MQG","MQT","MRH","MRP","MSX","MTT","MUB","MUG","MUR","MVP","MXY","MXZ","MYG","N1L","N3U","N9S","NA1","NAA","NAG","NBG","NBX","NBY","NDG","NED","NFG","NG1","NG6","NGA","NGB","NGC","NGE","NGF","NGK","NGL","NGR","NGS","NGY","NGZ","NHF","NLC","NM6","NM9","NNG","NPF","NSQ","NT1","NTF","NTO","NTP","NXD","NYT","O1G","OAK","OEL","OI7","OPM","ORP","OSU","OTG","OTN","OTU","OX2","P53","P6P","P8E","PA1","PA5","PAV","PDX","PH5","PKM","PNA","PNG","PNJ","PNW","PPC","PRP","PSG","PSJ","PSV","PTQ","PUF","PZU","QDK","QIF","QKH","QPS","QV4","R1P","R1X","R2B","R2G","R5P","RAA","RAE","RAF","RAM","RAO","RAT","RB5","RBL","RCD","RDP","REL","RER","RF5","RG1","RGG","RHA","RHC","RI2","RIB","RIP","RM4","RNS","RNT","ROB","ROR","RP3","RP5","RP6","RPA","RR7","RRJ","RRY","RST","RTG","RTV","RUB","RUG","RUU","RV7","RVG","RVM","RWI","RY7","RZM","S6P","S7P","S81","SA0","SCG","SCR","SDD","SDY","SEJ","SF6","SF9","SFJ","SFU","SG4","SG5","SG6","SG7","SGA","SGC","SGD","SGN","SGS","SHB","SHD","SHG","SI3","SIA","SID","SIO","SIZ","SLB","SLM","SLT","SMD","SN5","SNG","SOE","SOG","SOL","SOR","SR1","SSG","SSH","STW","STZ","SUC","SUP","SUS","SWE","SZZ","T68","T6D","T6P","T6T","TA6","TAG","TCB","TCG","TDG","TEU","TF0","TFU","TGA","TGK","TGR","TGY","TH1","TM5","TM6","TM9","TMR","TMX","TNX","TOA","TOC","TQY","TRE","TRV","TS8","TT7","TTV","TTZ","TU4","TUG","TUJ","TUP","TUR","TVD","TVG","TVM","TVS","TVV","TVY","TW7","TWA","TWD","TWG","TWJ","TWY","TXB","TY6","TYV","U1Y","U2A","U2D","U63","U8V","U97","U9A","U9D","U9G","U9J","U9M","UAP","UBH","UBO","UCD","UDC","UEA","V3M","V3P","V71","VDF","VG1","VJ1","VJ4","VKN","VTB","W9T","WIA","WOO","WUN","WZ1","WZ2","WZ4","X0X","X1P","X1X","X2F","X2Y","X34","X4S","X5S","X6X","X6Y","XBP","XDP","XDX","XGP","XIL","XKJ","XLF","XLS","XMM","XS2","XUL","XXM","XXR","XXX","XY6","XY9","XYB","XYF","XYL","XYP","XYS","XYT","XYZ","YDR","YIO","YJM","YKR","YO5","YX0","YX1","YYB","YYD","YYH","YYJ","YYK","YYM","YYQ","YYR","YZ0","YZT","Z0F","Z15","Z16","Z2D","Z2T","Z3K","Z3L","Z3Q","Z3U","Z4K","Z4R","Z4S","Z4U","Z4V","Z4W","Z4Y","Z57","Z5J","Z5L","Z61","Z6G","Z6H","Z6J","Z6W","Z8H","Z8T","Z9D","Z9E","Z9H","Z9K","Z9L","Z9M","Z9N","Z9W","ZB0","ZB1","ZB2","ZB3","ZCD","ZCZ","ZD0","ZDC","ZDM","ZDO","ZEE","ZEL","ZGE","ZMR","UMQ","SQD"]);var Nr=function(e){return e[e.FilledSphere=0]="FilledSphere",e[e.FilledCube=1]="FilledCube",e[e.CrossedCube=2]="CrossedCube",e[e.DividedDiamond=3]="DividedDiamond",e[e.FilledCone=4]="FilledCone",e[e.DevidedCone=5]="DevidedCone",e[e.FlatBox=6]="FlatBox",e[e.FilledStar=7]="FilledStar",e[e.FilledDiamond=8]="FilledDiamond",e[e.FlatDiamond=9]="FlatDiamond",e[e.FlatHexagon=10]="FlatHexagon",e[e.Pentagon=11]="Pentagon",e[e.DiamondPrism=12]="DiamondPrism",e[e.PentagonalPrism=13]="PentagonalPrism",e[e.HexagonalPrism=14]="HexagonalPrism",e[e.HeptagonalPrism=15]="HeptagonalPrism",e}(Nr||{});var vt=function(e){return e[e.Hexose=0]="Hexose",e[e.HexNAc=1]="HexNAc",e[e.Hexosamine=2]="Hexosamine",e[e.Hexuronate=3]="Hexuronate",e[e.Deoxyhexose=4]="Deoxyhexose",e[e.DeoxyhexNAc=5]="DeoxyhexNAc",e[e.DiDeoxyhexose=6]="DiDeoxyhexose",e[e.Pentose=7]="Pentose",e[e.Deoxynonulosonate=8]="Deoxynonulosonate",e[e.DiDeoxynonulosonate=9]="DiDeoxynonulosonate",e[e.Unknown=10]="Unknown",e[e.Assigned=11]="Assigned",e}(vt||{});const BNe={[vt.Hexose]:Nr.FilledSphere,[vt.HexNAc]:Nr.FilledCube,[vt.Hexosamine]:Nr.CrossedCube,[vt.Hexuronate]:Nr.DividedDiamond,[vt.Deoxyhexose]:Nr.FilledCone,[vt.DeoxyhexNAc]:Nr.DevidedCone,[vt.DiDeoxyhexose]:Nr.FlatBox,[vt.Pentose]:Nr.FilledStar,[vt.Deoxynonulosonate]:Nr.FilledDiamond,[vt.DiDeoxynonulosonate]:Nr.FlatDiamond,[vt.Unknown]:Nr.FlatHexagon,[vt.Assigned]:Nr.Pentagon};function ONe(e,t){return e===vt.Unknown?4===t?Nr.DiamondPrism:5===t?Nr.PentagonalPrism:6===t?Nr.HexagonalPrism:7===t?Nr.HeptagonalPrism:Nr.FlatHexagon:BNe[e]}const TB={abbr:"Unk",name:"Unknown",color:15854817,type:vt.Unknown},Wb=[{abbr:"Glc",name:"Glucose",color:37052,type:vt.Hexose},{abbr:"Man",name:"Mannose",color:42577,type:vt.Hexose},{abbr:"Gal",name:"Galactose",color:16765952,type:vt.Hexose},{abbr:"Gul",name:"Gulose",color:16021792,type:vt.Hexose},{abbr:"Alt",name:"Altrose",color:16162465,type:vt.Hexose},{abbr:"All",name:"Allose",color:10830745,type:vt.Hexose},{abbr:"Tal",name:"Talose",color:9424105,type:vt.Hexose},{abbr:"Ido",name:"Idose",color:10582605,type:vt.Hexose},{abbr:"GlcNAc",name:"N-Acetyl Glucosamine",color:37052,type:vt.HexNAc},{abbr:"ManNAc",name:"N-Acetyl Mannosamine",color:42577,type:vt.HexNAc},{abbr:"GalNAc",name:"N-Acetyl Galactosamine",color:16765952,type:vt.HexNAc},{abbr:"GulNAc",name:"N-Acetyl Gulosamine",color:16021792,type:vt.HexNAc},{abbr:"AltNAc",name:"N-Acetyl Altrosamine",color:16162465,type:vt.HexNAc},{abbr:"AllNAc",name:"N-Acetyl Allosamine",color:10830745,type:vt.HexNAc},{abbr:"TalNAc",name:"N-Acetyl Talosamine",color:9424105,type:vt.HexNAc},{abbr:"IdoNAc",name:"N-Acetyl Idosamine",color:10582605,type:vt.HexNAc},{abbr:"GlcN",name:"Glucosamine",color:37052,type:vt.Hexosamine},{abbr:"ManN",name:"Mannosamine",color:42577,type:vt.Hexosamine},{abbr:"GalN",name:"Galactosamine",color:16765952,type:vt.Hexosamine},{abbr:"GulN",name:"Gulosamine",color:16021792,type:vt.Hexosamine},{abbr:"AltN",name:"Altrosamine",color:16162465,type:vt.Hexosamine},{abbr:"AllN",name:"Allosamine",color:10830745,type:vt.Hexosamine},{abbr:"TalN",name:"Talosamine",color:9424105,type:vt.Hexosamine},{abbr:"IdoN",name:"Idosamine",color:10582605,type:vt.Hexosamine},{abbr:"GlcA",name:"Glucuronic Acid",color:37052,type:vt.Hexuronate},{abbr:"ManA",name:"Mannuronic Acid",color:42577,type:vt.Hexuronate},{abbr:"GalA",name:"Galacturonic Acid",color:16765952,type:vt.Hexuronate},{abbr:"GulA",name:"Guluronic Acid",color:16021792,type:vt.Hexuronate},{abbr:"AltA",name:"Altruronic Acid",color:16162465,type:vt.Hexuronate},{abbr:"AllA",name:"Alluronic Acid",color:10830745,type:vt.Hexuronate},{abbr:"TalA",name:"Taluronic Acid",color:9424105,type:vt.Hexuronate},{abbr:"IdoA",name:"Iduronic Acid",color:10582605,type:vt.Hexuronate},{abbr:"Qui",name:"Quinovose",color:37052,type:vt.Deoxyhexose},{abbr:"Rha",name:"Rhamnose",color:42577,type:vt.Deoxyhexose},{abbr:"6dGul",name:"6-Deoxy Gulose",color:16021792,type:vt.Deoxyhexose},{abbr:"6dAlt",name:"6-Deoxy Altrose",color:16162465,type:vt.Deoxyhexose},{abbr:"6dTal",name:"6-Deoxy Talose",color:9424105,type:vt.Deoxyhexose},{abbr:"Fuc",name:"Fucose",color:15539236,type:vt.Deoxyhexose},{abbr:"QuiNAc",name:"N-Acetyl Quinovosamine",color:37052,type:vt.DeoxyhexNAc},{abbr:"RhaNAc",name:"N-Acetyl Rhamnosamine",color:42577,type:vt.DeoxyhexNAc},{abbr:"6dAltNAc",name:"N-Acetyl 6-Deoxy Altrosamine",color:16162465,type:vt.DeoxyhexNAc},{abbr:"6dTalNAc",name:"N-Acetyl 6-Deoxy Talosamine",color:9424105,type:vt.DeoxyhexNAc},{abbr:"FucNAc",name:"N-Acetyl Fucosamine",color:15539236,type:vt.DeoxyhexNAc},{abbr:"Oli",name:"Olivose",color:37052,type:vt.DiDeoxyhexose},{abbr:"Tyv",name:"Tyvelose",color:42577,type:vt.DiDeoxyhexose},{abbr:"Abe",name:"Abequose",color:16021792,type:vt.DiDeoxyhexose},{abbr:"Par",name:"Paratose",color:16162465,type:vt.DiDeoxyhexose},{abbr:"Dig",name:"Digitoxose",color:10830745,type:vt.DiDeoxyhexose},{abbr:"Col",name:"Colitose",color:9424105,type:vt.DiDeoxyhexose},{abbr:"Ara",name:"Arabinose",color:42577,type:vt.Pentose},{abbr:"Lyx",name:"Lyxose",color:16765952,type:vt.Pentose},{abbr:"Xyl",name:"Xylose",color:16021792,type:vt.Pentose},{abbr:"Rib",name:"Ribose",color:16162465,type:vt.Pentose},{abbr:"Kdn",name:"Keto-Deoxy Nonulonic Acid",color:42577,type:vt.Deoxynonulosonate},{abbr:"Neu5Ac",name:"N-Acetyl Neuraminic Acid",color:10830745,type:vt.Deoxynonulosonate},{abbr:"Neu5Gc",name:"N-Glycolyl Neuraminic Acid",color:9424105,type:vt.Deoxynonulosonate},{abbr:"Neu",name:"Neuraminic Acid",color:10582605,type:vt.Deoxynonulosonate},{abbr:"Sia",name:"Sialic acid",color:15539236,type:vt.Deoxynonulosonate},{abbr:"Pse",name:"Pseudaminic Acid",color:42577,type:vt.DiDeoxynonulosonate},{abbr:"Leg",name:"Legionaminic Acid",color:16765952,type:vt.DiDeoxynonulosonate},{abbr:"Aci",name:"Acinetaminic Acid",color:16162465,type:vt.DiDeoxynonulosonate},{abbr:"4eLeg",name:"4-Epilegionaminic Acid",color:9424105,type:vt.DiDeoxynonulosonate},{abbr:"Bac",name:"Bacillosamine",color:37052,type:vt.Unknown},{abbr:"LDmanHep",name:"L-Glycero-D-Manno Heptose",color:42577,type:vt.Unknown},{abbr:"Kdo",name:"Keto-Deoxy Octulonic Acid",color:16765952,type:vt.Unknown},{abbr:"Dha",name:"3-Deoxy Lyxo-Heptulosaric Acid",color:16021792,type:vt.Unknown},{abbr:"DDmanHep",name:"D-Glycero-D-Manno-Heptose",color:16162465,type:vt.Unknown},{abbr:"MurNAc",name:"N-Acetyl Muramic Acid",color:10830745,type:vt.Unknown},{abbr:"MurNGc",name:"N-Glycolyl Muramic Acid",color:9424105,type:vt.Unknown},{abbr:"Mur",name:"Muramic Acid",color:10582605,type:vt.Unknown},{abbr:"Api",name:"Apicose",color:42577,type:vt.Assigned},{abbr:"Fru",name:"Fructose",color:42577,type:vt.Assigned},{abbr:"Tag",name:"Tagatose",color:16765952,type:vt.Assigned},{abbr:"Sor",name:"Sorbose",color:16021792,type:vt.Assigned},{abbr:"Psi",name:"Psicose",color:16162465,type:vt.Assigned}],LNe=function(){const e=new Map;for(let t=0,n=Wb.length;t{e.has(t)||e.set(t,TB)}),e}(),zNe=function(){const e=new Map;for(let t=0,n=Wb.length;t{e.has(t)||e.set(t,TB)}),e}();let up=UQ;var Si;!function(e){e.toArray=function t(p){return Array.from(p.values())},e.isSuperset=function n(p,m){if(p.size[e[0],Bg(e[1])])),WNe={0:{trace:new Set,directionFrom:new Set,directionTo:new Set,backboneStart:new Set,backboneEnd:new Set,coarseBackbone:new Set},1:{trace:new Set(["CA"]),directionFrom:new Set(["C"]),directionTo:new Set(["O","OC1","O1","OX1","OXT","OT1"]),backboneStart:new Set(["N"]),backboneEnd:new Set(["C"]),coarseBackbone:new Set(["CA","BB","CA1"])},2:{trace:new Set(["CA"]),directionFrom:new Set(["C"]),directionTo:new Set(["O"]),backboneStart:new Set(["N"]),backboneEnd:new Set(["CD"]),coarseBackbone:new Set(["CA"])},3:{trace:new Set(["CA"]),directionFrom:new Set(["C"]),directionTo:new Set(["O"]),backboneStart:new Set(["N"]),backboneEnd:new Set(["CG"]),coarseBackbone:new Set(["CA"])},4:{trace:new Set(["O3'","O3*"]),directionFrom:new Set(["C4'","C4*"]),directionTo:new Set(["C3'","C3*"]),backboneStart:new Set(["P"]),backboneEnd:new Set(["O3'","O3*"]),coarseBackbone:new Set(["P"])},5:{trace:new Set(["O3'","O3*"]),directionFrom:new Set(["C3'","C3*"]),directionTo:new Set(["C1'","C1*"]),backboneStart:new Set(["P"]),backboneEnd:new Set(["O3'","O3*"]),coarseBackbone:new Set(["P"])},6:{trace:new Set(["N4'","N4*"]),directionFrom:new Set(["N4'","N4*"]),directionTo:new Set(["C7'","C7*"]),backboneStart:new Set(["N1'","N1*"]),backboneEnd:new Set(["C'","C*"]),coarseBackbone:new Set(["P"])}},lp=new Set(["CA","C","N","O","O1","O2","OC1","OC2","OT1","OT2","OX1","OXT","H","H1","H2","H3","HA","HN","HXT","BB"]),ZI=new Set(["P","OP1","OP2","HOP2","HOP3","O2'","O3'","O4'","O5'","C1'","C2'","C3'","C4'","C5'","H1'","H2'","H2''","HO2'","H3'","H4'","H5'","H5''","HO3'","HO5'","O2*","O3*","O4*","O5*","C1*","C2*","C3*","C4*","C5*"]),jQ=new Set(["d-peptide linking","d-peptide nh3 amino terminus","d-peptide cooh carboxy terminus","d-gamma-peptide, c-delta linking","d-beta-peptide, c-gamma linking"]),HQ=new Set(["l-peptide linking","l-peptide nh3 amino terminus","l-peptide cooh carboxy terminus","l-gamma-peptide, c-delta linking","l-beta-peptide, c-gamma linking"]),$Ne=new Set(["d-gamma-peptide, c-delta linking","l-gamma-peptide, c-delta linking"]),YNe=new Set(["d-beta-peptide, c-gamma linking","l-beta-peptide, c-gamma linking"]),XNe=new Set(["d-peptide nh3 amino terminus","d-peptide cooh carboxy terminus","l-peptide nh3 amino terminus","l-peptide cooh carboxy terminus"]),qQ=new Set(["peptide linking","peptide-like"]),KNe=Si.unionMany(jQ,HQ,qQ),WQ=new Set(["dna linking","l-dna linking","dna oh 5 prime terminus","dna oh 3 prime terminus"]),$Q=new Set(["rna linking","l-rna linking","rna oh 5 prime terminus","rna oh 3 prime terminus"]),YQ=Si.unionMany(new Set(["d-saccharide, beta linking","l-saccharide, beta linking","d-saccharide, alpha linking","l-saccharide, alpha linking","l-saccharide","d-saccharide","saccharide"]),new Set(["d-saccharide 1,4 and 1,4 linking","l-saccharide 1,4 and 1,4 linking","d-saccharide 1,4 and 1,6 linking","l-saccharide 1,4 and 1,6 linking"])),ZNe=new Set(["non-polymer","other"]),QNe=new Set(["ion"]),JNe=new Set(["lipid"]),QI=new Set(["SOL","WAT","HOH","H2O","W","DOD","D3O","TIP","TIP3","TIP4","SPC"]),DB=new Set(["HIS","ARG","LYS","ILE","PHE","LEU","TRP","ALA","MET","PRO","CYS","ASN","VAL","GLY","SER","GLN","TYR","ASP","GLU","THR","SEC","PYL","UNK","MSE","SEP","TPO","PTR","PCA","HYP","HSD","HSE","HSP","LSN","ASPP","GLUP","HID","HIE","HIP","LYN","ASH","GLH"]),XQ=new Set(["DAL","DAR","DSG","DAS","DCY","DGL","DGN","DHI","DIL","DLE","DLY","MED","DPN","DPR","DSN","DTH","DTR","DTY","DVA","DNE"]),a2=Si.unionMany(DB,XQ),eFe=new Set(["NME","ACE","NH2","FOR","FMT"]),c2=new Set(["A","C","T","G","I","U","N"]),u2=new Set(["DA","DC","DT","DG","DI","DU","DN"]),EB=new Set(["APN","CPN","TPN","GPN"]),tFe=new Set(["A","G","I","DA","DG","DI","APN","GPN"]),nFe=new Set(["C","T","U","DC","DT","DU","CPN","TPN"]),JI=Si.unionMany(c2,u2,EB),rFe=e=>tFe.has(e.toUpperCase()),iFe=e=>nFe.has(e.toUpperCase()),$b=Si.unionMany(a2,JI);function Yh(e,t){return t=t.toUpperCase(),EB.has(t)?8:KNe.has(e)?5:$Q.has(e)?6:WQ.has(e)?7:YQ.has(e)?9:QI.has(t)?2:zQ.has(t)?3:VQ.has(t)?4:ZNe.has(e)?up.has(t)?9:a2.has(t)?5:c2.has(t)?6:u2.has(t)?7:1:0}function oFe(e,t){return 5===t?$Ne.has(e)?2:YNe.has(e)?3:XNe.has(e)?0:1:6===t?4:7===t?5:8===t?6:0}function KQ(e){return e=e.toUpperCase(),a2.has(e)?"peptide linking":c2.has(e)?"rna linking":u2.has(e)?"dna linking":up.has(e)?"saccharide":"other"}function aFe(e){return e=e.toUpperCase(),QI.has(e)?"water":$b.has(e)?"polymer":up.has(e)?"branched":"non-polymer"}function cFe(e,t){return e=e.toUpperCase(),HQ.has(t)?"polypeptide(L)":jQ.has(t)?"polypeptide(D)":$Q.has(t)?"polyribonucleotide":WQ.has(t)?"polydeoxyribonucleotide":YQ.has(t)||up.has(e)?"oligosaccharide":EB.has(e)?"peptide nucleic acid":DB.has(e)?"polypeptide(L)":XQ.has(e)?"polypeptide(D)":c2.has(e)?"polyribonucleotide":u2.has(e)?"polydeoxyribonucleotide":QNe.has(t)||zQ.has(e)?"ion":JNe.has(t)||VQ.has(e)?"lipid":qQ.has(t)?"peptide-like":"other"}function eT(e){return Ya(e)||ZQ(e)}function Ya(e){return 7===e||6===e||8===e}function ZQ(e){return 5===e}var cr,jn;!function(e){e.is=ea.has,e.create=ea.create,e.SecondaryStructureMmcif={helx_lh_27_p:1058,helx_lh_3t_p:2082,helx_lh_al_p:4130,helx_lh_a_n:524321,helx_lh_b_n:1048609,helx_lh_ga_p:8226,helx_lh_n:33,helx_lh_om_p:16418,helx_lh_ot_n:131105,helx_lh_ot_p:546,helx_lh_p:34,helx_lh_pi_p:32802,helx_lh_pp_p:65570,helx_lh_z_n:262177,helx_n:1,helx_ot_n:1,helx_ot_p:2,helx_p:2,helx_rh_27_p:1090,helx_rh_3t_p:2114,helx_rh_al_p:4162,helx_rh_a_n:524353,helx_rh_b_n:1048641,helx_rh_ga_p:8258,helx_rh_n:65,helx_rh_om_p:16450,helx_rh_ot_n:131137,helx_rh_ot_p:578,helx_rh_p:66,helx_rh_pi_p:32834,helx_rh_pp_p:65602,helx_rh_z_n:262209,strn:4194308,turn_ot_p:33554448,turn_p:16,turn_ty1p_p:67109136,turn_ty1_p:67109008,turn_ty2p_p:134218e3,turn_ty2_p:134217872,turn_ty3p_p:268435728,turn_ty3_p:268435600,bend:8,other:0},e.SecondaryStructurePdb={1:4162,2:16450,3:32834,4:8258,5:2114,6:4130,7:16418,8:8226,9:1026,10:65538},e.SecondaryStructureStride={H:4098,G:2050,I:32770,E:8388612,B:4194308,T:16,C:536870912},e.SecondaryStructureDssp={H:4098,B:4194308,E:8388612,G:2050,I:32770,T:16,S:8}}(cr||(cr={})),function(e){function o(a){switch(a){case"covalent":return 1;case"metal-coordination":return 2;case"hydrogen-bond":return 4;case"disulfide":return 8;case"aromatic":return 16;case"computed":return 32}}e.is=ea.has,e.create=function t(a){return ea.create(a)},e.isCovalent=function n(a){return!!(1&a)},e.isAll=function r(a){return a===Math.pow(2,6)-1},e.Names={covalent:1,"metal-coordination":2,"hydrogen-bond":4,disulfide:8,aromatic:16,computed:32},e.isName=function i(a){return a in e.Names},e.fromName=o,e.fromNames=function s(a){let c=0;for(let u=0,l=a.length;uthis.radiusSq&&(this.radiusSq=n)}radiusSphereStep(t,n){const r=dFe(t,this.center)+n,i=r*r;i>this.radiusSq&&(this.radiusSq=i)}getSphere(t){return t||(t=_e()),v.copy(t.center,this.center),t.radius=Math.sqrt(this.radiusSq),t}getCount(){return this.count}constructor(){this.count=0,this.center=v(),this.radiusSq=0}}!function(e){const t=new e,n=v(),r=v();e.fromArrays=function i({x:a,y:c,z:u},l){t.reset();const d=a.length;for(let f=0;f{s.forEach(a=>{n+=a.edgeCount,a.connectedIndices.forEach(c=>{a.getEdges(c).forEach(u=>{const{unitA:l,unitB:d}=a,f=ju.getEdgeKey(c,l,u.indexB,d);i.set(f,r.length);const p=ju.getVertexKey(c,l),m=o.get(p);void 0===m?o.set(p,[r.length]):m.push(r.length),r.push({...u,indexA:c,unitA:l,unitB:d})})})})}),this.edgeCount=n,this.edges=r,this.edgeKeyIndex=i,this.vertexKeyIndex=o}}!function(e){class t{hasEdges(a){return this.edgeMap.has(a)}getEdges(a){return this.edgeMap.has(a)?this.edgeMap.get(a):QQ}get areUnitsOrdered(){return this.unitA0?i:t<0?n:(n+r)/1.95}const gFe=RB.H;function dp(e){return e===gFe}const yFe=new Map([["HIS|CD2|CG",2],["HIS|CE1|ND1",2],["ARG|CZ|NH2",2],["PHE|CE1|CZ",2],["PHE|CD2|CE2",2],["PHE|CD1|CG",2],["TRP|CD1|CG",2],["TRP|CD2|CE2",2],["TRP|CE3|CZ3",2],["TRP|CH2|CZ2",2],["ASN|CG|OD1",2],["GLN|CD|OE1",2],["TYR|CD1|CG",2],["TYR|CD2|CE2",2],["TYR|CE1|CZ",2],["ASP|CG|OD1",2],["GLU|CD|OE1",2],["G|C8|N7",2],["G|C4|C5",2],["G|C2|N3",2],["G|C6|O6",2],["C|C4|N3",2],["C|C5|C6",2],["C|C2|O2",2],["A|C2|N3",2],["A|C6|N1",2],["A|C4|C5",2],["A|C8|N7",2],["U|C5|C6",2],["U|C2|O2",2],["U|C4|O4",2],["DG|C8|N7",2],["DG|C4|C5",2],["DG|C2|N3",2],["DG|C6|O6",2],["DC|C4|N3",2],["DC|C5|C6",2],["DC|C2|O2",2],["DA|C2|N3",2],["DA|C6|N1",2],["DA|C4|C5",2],["DA|C8|N7",2],["DT|C5|C6",2],["DT|C2|O2",2],["DT|C4|O4",2]]);function bFe(e,t,n){return[t,n]=tn&&([e,n]=[n,e],[t,r]=[r,t]),vFe.get(`${e}|${t}|${n}|${r}`)||1}var fp=te.Schema;const re=fp.str,Ie=fp.int,_n=fp.float,kB=fp.coord,Tt=fp.Aliased,Kh=fp.Matrix,nT=fp.Vector,xr=fp.lstr,Lg=fp.List,On={atom_site:{auth_asym_id:re,auth_atom_id:re,auth_comp_id:re,auth_seq_id:Ie,B_iso_or_equiv:_n,Cartn_x:kB,Cartn_y:kB,Cartn_z:kB,group_PDB:Tt(re),id:Ie,label_alt_id:re,label_asym_id:re,label_atom_id:re,label_comp_id:re,label_entity_id:re,label_seq_id:Ie,occupancy:_n,type_symbol:re,pdbx_PDB_ins_code:re,pdbx_PDB_model_num:Ie,pdbx_formal_charge:Ie,pdbx_label_index:Ie,pdbx_sifts_xref_db_name:re,pdbx_sifts_xref_db_acc:re,pdbx_sifts_xref_db_num:re,pdbx_sifts_xref_db_res:re,ihm_model_id:Ie},atom_site_anisotrop:{id:Ie,type_symbol:re,U:Kh(3,3),U_esd:Kh(3,3),pdbx_auth_seq_id:re,pdbx_auth_asym_id:re,pdbx_auth_atom_id:re,pdbx_auth_comp_id:re,pdbx_label_seq_id:Ie,pdbx_label_alt_id:re,pdbx_label_asym_id:re,pdbx_label_atom_id:re,pdbx_label_comp_id:re,pdbx_PDB_ins_code:re},atom_sites:{entry_id:re,fract_transf_matrix:Kh(3,3),fract_transf_vector:nT(3)},audit_author:{name:re,pdbx_ordinal:Ie,identifier_ORCID:re},audit_conform:{dict_location:re,dict_name:re,dict_version:re},cell:{angle_alpha:_n,angle_beta:_n,angle_gamma:_n,entry_id:re,length_a:_n,length_b:_n,length_c:_n,Z_PDB:Ie,pdbx_unique_axis:re},chem_comp:{formula:re,formula_weight:_n,id:re,mon_nstd_flag:Tt(xr),name:re,type:Tt(xr),pdbx_synonyms:Lg(";",e=>e)},chem_comp_bond:{atom_id_1:re,atom_id_2:re,comp_id:re,value_order:Tt(xr),pdbx_ordinal:Ie,pdbx_stereo_config:Tt(xr),pdbx_aromatic_flag:Tt(xr)},citation:{book_publisher:re,country:re,id:re,journal_abbrev:re,journal_id_ASTM:re,journal_id_CSD:re,journal_id_ISSN:re,journal_volume:re,page_first:re,page_last:re,title:re,year:Ie,pdbx_database_id_DOI:re,pdbx_database_id_PubMed:Ie},citation_author:{citation_id:re,name:re,ordinal:Ie},database_2:{database_id:Tt(xr),database_code:re},entity:{details:re,formula_weight:_n,id:re,src_method:Tt(xr),type:Tt(xr),pdbx_description:Lg(",",e=>e),pdbx_number_of_molecules:Ie,pdbx_mutation:re,pdbx_fragment:re,pdbx_ec:Lg(",",e=>e)},entity_poly:{entity_id:re,nstd_linkage:Tt(xr),nstd_monomer:Tt(xr),type:Tt(re),pdbx_strand_id:Lg(",",e=>e),pdbx_seq_one_letter_code:re,pdbx_seq_one_letter_code_can:re,pdbx_target_identifier:re},entity_poly_seq:{entity_id:re,hetero:Tt(xr),mon_id:re,num:Ie},entry:{id:re},exptl:{entry_id:re,method:Tt(re)},software:{classification:re,date:re,description:re,name:re,type:Tt(xr),version:re,pdbx_ordinal:Ie},struct:{entry_id:re,title:re,pdbx_descriptor:re},struct_asym:{details:re,entity_id:re,id:re,pdbx_modified:re,pdbx_blank_PDB_chainid_flag:Tt(re)},struct_conf:{beg_label_asym_id:re,beg_label_comp_id:re,beg_label_seq_id:Ie,beg_auth_asym_id:re,beg_auth_comp_id:re,beg_auth_seq_id:Ie,conf_type_id:Tt(xr),details:re,end_label_asym_id:re,end_label_comp_id:re,end_label_seq_id:Ie,end_auth_asym_id:re,end_auth_comp_id:re,end_auth_seq_id:Ie,id:re,pdbx_beg_PDB_ins_code:re,pdbx_end_PDB_ins_code:re,pdbx_PDB_helix_class:re,pdbx_PDB_helix_length:Ie,pdbx_PDB_helix_id:re},struct_conn:{conn_type_id:Tt(xr),details:re,id:re,ptnr1_label_asym_id:re,ptnr1_label_atom_id:re,ptnr1_label_comp_id:re,ptnr1_label_seq_id:Ie,ptnr1_auth_asym_id:re,ptnr1_auth_comp_id:re,ptnr1_auth_seq_id:Ie,ptnr1_symmetry:re,ptnr2_label_asym_id:re,ptnr2_label_atom_id:re,ptnr2_label_comp_id:re,ptnr2_label_seq_id:Ie,ptnr2_auth_asym_id:re,ptnr2_auth_comp_id:re,ptnr2_auth_seq_id:Ie,ptnr2_symmetry:re,pdbx_ptnr1_PDB_ins_code:re,pdbx_ptnr1_label_alt_id:re,pdbx_ptnr1_standard_comp_id:re,pdbx_ptnr2_PDB_ins_code:re,pdbx_ptnr2_label_alt_id:re,pdbx_ptnr3_PDB_ins_code:re,pdbx_ptnr3_label_alt_id:re,pdbx_ptnr3_label_asym_id:re,pdbx_ptnr3_label_atom_id:re,pdbx_ptnr3_label_comp_id:re,pdbx_ptnr3_label_seq_id:Ie,pdbx_PDB_id:re,pdbx_dist_value:_n,pdbx_value_order:Tt(xr)},struct_conn_type:{criteria:re,id:Tt(xr),reference:re},struct_keywords:{entry_id:re,text:Lg(",",e=>e),pdbx_keywords:re},struct_ncs_oper:{code:Tt(re),details:re,id:Ie,matrix:Kh(3,3),vector:nT(3)},struct_sheet_range:{beg_label_asym_id:re,beg_label_comp_id:re,beg_label_seq_id:Ie,end_label_asym_id:re,end_label_comp_id:re,end_label_seq_id:Ie,beg_auth_asym_id:re,beg_auth_comp_id:re,beg_auth_seq_id:Ie,end_auth_asym_id:re,end_auth_comp_id:re,end_auth_seq_id:Ie,id:re,sheet_id:re,pdbx_beg_PDB_ins_code:re,pdbx_end_PDB_ins_code:re},struct_site:{details:re,id:re,pdbx_num_residues:Ie,pdbx_evidence_code:re,pdbx_auth_asym_id:re,pdbx_auth_comp_id:re,pdbx_auth_seq_id:re,pdbx_auth_ins_code:re},struct_site_gen:{details:re,id:re,label_alt_id:re,label_asym_id:re,label_atom_id:re,label_comp_id:re,label_seq_id:Ie,auth_asym_id:re,auth_comp_id:re,auth_seq_id:re,site_id:re,symmetry:re,pdbx_auth_ins_code:re,pdbx_num_res:Ie},symmetry:{entry_id:re,cell_setting:Tt(xr),Int_Tables_number:Ie,space_group_name_Hall:re,"space_group_name_H-M":re},pdbx_database_status:{status_code:Tt(re),status_code_sf:Tt(re),status_code_mr:Tt(re),entry_id:re,recvd_initial_deposition_date:re,SG_entry:Tt(xr),deposit_site:Tt(re),process_site:Tt(re),status_code_cs:Tt(re),methods_development_category:Tt(re),pdb_format_compatible:Tt(xr)},pdbx_nonpoly_scheme:{asym_id:re,entity_id:re,mon_id:re,pdb_strand_id:re,ndb_seq_num:re,pdb_seq_num:re,auth_seq_num:re,pdb_mon_id:re,auth_mon_id:re,pdb_ins_code:re},pdbx_database_related:{db_name:re,details:re,db_id:re,content_type:Tt(re)},pdbx_entity_nonpoly:{entity_id:re,comp_id:re,name:re},pdbx_chem_comp_synonyms:{name:re,comp_id:re,provenance:Tt(re)},pdbx_chem_comp_identifier:{comp_id:re,identifier:re,type:Tt(re),program:re,program_version:re},pdbx_unobs_or_zero_occ_residues:{id:Ie,polymer_flag:Tt(xr),occupancy_flag:Tt(Ie),PDB_model_num:Ie,auth_asym_id:re,auth_comp_id:re,auth_seq_id:re,PDB_ins_code:re,label_asym_id:re,label_comp_id:re,label_seq_id:Ie},pdbx_struct_mod_residue:{id:Ie,auth_asym_id:re,auth_comp_id:re,auth_seq_id:Ie,PDB_ins_code:re,label_asym_id:re,label_comp_id:re,label_seq_id:Ie,parent_comp_id:re,details:re},pdbx_struct_oper_list:{id:re,type:Tt(re),name:re,symmetry_operation:re,matrix:Kh(3,3),vector:nT(3)},pdbx_struct_assembly:{method_details:re,oligomeric_details:re,oligomeric_count:Ie,details:re,id:re},pdbx_struct_assembly_gen:{asym_id_list:Lg(",",e=>e),assembly_id:re,oper_expression:re},pdbx_reference_entity_list:{prd_id:re,ref_entity_id:re,type:Tt(xr),details:re,component_id:Ie},pdbx_reference_entity_link:{link_id:Ie,prd_id:re,details:re,ref_entity_id_1:re,ref_entity_id_2:re,entity_seq_num_1:Ie,entity_seq_num_2:Ie,comp_id_1:re,comp_id_2:re,atom_id_1:re,atom_id_2:re,value_order:Tt(xr),component_1:Ie,component_2:Ie,link_class:Tt(re)},pdbx_reference_entity_poly_link:{link_id:Ie,prd_id:re,ref_entity_id:re,component_id:Ie,entity_seq_num_1:Ie,entity_seq_num_2:Ie,comp_id_1:re,comp_id_2:re,atom_id_1:re,atom_id_2:re,value_order:Tt(xr)},pdbx_molecule:{prd_id:re,instance_id:Ie,asym_id:re},pdbx_molecule_features:{prd_id:re,class:Tt(xr),type:Tt(xr),name:re,details:re},entity_src_nat:{entity_id:re,pdbx_organism_scientific:re,pdbx_plasmid_name:re,pdbx_src_id:Ie,pdbx_beg_seq_num:Ie,pdbx_end_seq_num:Ie},entity_src_gen:{entity_id:re,pdbx_gene_src_gene:Lg(",",e=>e),pdbx_gene_src_scientific_name:re,plasmid_name:re,pdbx_src_id:Ie,pdbx_beg_seq_num:Ie,pdbx_end_seq_num:Ie},pdbx_entity_src_syn:{organism_scientific:re,entity_id:re,pdbx_src_id:Ie,pdbx_beg_seq_num:Ie,pdbx_end_seq_num:Ie},pdbx_entity_branch_descriptor:{entity_id:re,descriptor:re,type:Tt(xr),program:re,program_version:re,ordinal:Ie},pdbx_entity_instance_feature:{details:re,feature_type:Tt(re),auth_asym_id:re,asym_id:re,auth_seq_num:re,seq_num:Ie,comp_id:re,auth_comp_id:re,ordinal:Ie},pdbx_entity_branch_list:{entity_id:re,hetero:Tt(xr),comp_id:re,num:Ie},pdbx_entity_branch_link:{link_id:Ie,details:re,entity_id:re,entity_branch_list_num_1:Ie,entity_branch_list_num_2:Ie,comp_id_1:re,comp_id_2:re,atom_id_1:re,leaving_atom_id_1:re,atom_stereo_config_1:Tt(xr),atom_id_2:re,leaving_atom_id_2:re,atom_stereo_config_2:Tt(xr),value_order:Tt(xr)},pdbx_entity_branch:{entity_id:re,type:Tt(re)},pdbx_branch_scheme:{entity_id:re,hetero:Tt(xr),asym_id:re,mon_id:re,num:Ie,pdb_asym_id:re,pdb_seq_num:re,pdb_mon_id:re,auth_asym_id:re,auth_seq_num:re,auth_mon_id:re},pdbx_chem_comp_related:{comp_id:re,related_comp_id:re,relationship_type:Tt(re),details:re},ihm_starting_model_details:{starting_model_id:re,entity_id:re,entity_description:re,asym_id:re,entity_poly_segment_id:Ie,starting_model_source:Tt(re),starting_model_auth_asym_id:re,starting_model_sequence_offset:Ie,dataset_list_id:Ie},ihm_starting_comparative_models:{id:Ie,starting_model_id:re,starting_model_auth_asym_id:re,starting_model_seq_id_begin:Ie,starting_model_seq_id_end:Ie,template_auth_asym_id:re,template_seq_id_begin:Ie,template_seq_id_end:Ie,template_sequence_identity:_n,template_sequence_identity_denominator:Tt(Ie),template_dataset_list_id:Ie,alignment_file_id:Ie},ihm_starting_model_seq_dif:{id:Ie,entity_id:re,asym_id:re,seq_id:Ie,comp_id:re,starting_model_id:re,db_asym_id:re,db_seq_id:Ie,db_comp_id:re,details:re},ihm_model_representation:{id:Ie,name:re,details:re},ihm_model_representation_details:{id:Ie,representation_id:Ie,entity_poly_segment_id:Ie,entity_id:re,entity_description:re,entity_asym_id:re,model_object_primitive:Tt(re),starting_model_id:re,model_mode:Tt(re),model_granularity:Tt(re),model_object_count:Ie},ihm_struct_assembly_details:{id:Ie,assembly_id:Ie,parent_assembly_id:Ie,entity_description:re,entity_id:re,asym_id:re,entity_poly_segment_id:Ie},ihm_struct_assembly:{id:Ie,name:re,description:re},ihm_modeling_protocol:{id:Ie,num_steps:Ie,protocol_name:re},ihm_modeling_protocol_details:{id:Ie,protocol_id:Ie,step_id:Ie,struct_assembly_id:Ie,dataset_group_id:Ie,struct_assembly_description:re,step_name:re,step_method:re,num_models_begin:Ie,num_models_end:Ie,multi_scale_flag:Tt(xr),multi_state_flag:Tt(xr),ordered_flag:Tt(xr),script_file_id:Ie,software_id:Ie},ihm_multi_state_modeling:{state_id:Ie,state_group_id:Ie,population_fraction:_n,population_fraction_sd:_n,state_type:re,state_name:re,experiment_type:Tt(re),details:re},ihm_modeling_post_process:{id:Ie,protocol_id:Ie,analysis_id:Ie,step_id:Ie,type:Tt(re),feature:Tt(re),num_models_begin:Ie,num_models_end:Ie},ihm_ensemble_info:{ensemble_id:Ie,ensemble_name:re,post_process_id:Ie,model_group_id:Ie,ensemble_clustering_method:Tt(re),ensemble_clustering_feature:Tt(re),num_ensemble_models:Ie,num_ensemble_models_deposited:Ie,ensemble_precision_value:_n,ensemble_file_id:Ie},ihm_model_list:{model_id:Ie,model_name:re,assembly_id:Ie,protocol_id:Ie,representation_id:Ie},ihm_model_group:{id:Ie,name:re,details:re},ihm_model_group_link:{model_id:Ie,group_id:Ie},ihm_model_representative:{id:Ie,model_group_id:Ie,model_id:Ie,selection_criteria:Tt(re)},ihm_dataset_list:{id:Ie,data_type:Tt(re),database_hosted:Tt(xr)},ihm_dataset_group:{id:Ie,name:re,application:Tt(re),details:re},ihm_dataset_group_link:{dataset_list_id:Ie,group_id:Ie},ihm_related_datasets:{dataset_list_id_derived:Ie,dataset_list_id_primary:Ie},ihm_dataset_related_db_reference:{id:Ie,dataset_list_id:Ie,db_name:Tt(re),accession_code:re,version:re,details:re},ihm_external_reference_info:{reference_id:Ie,reference_provider:re,reference_type:Tt(re),reference:re,refers_to:Tt(re),associated_url:re},ihm_external_files:{id:Ie,reference_id:Ie,file_path:re,content_type:Tt(re),file_size_bytes:_n,details:re},ihm_dataset_external_reference:{id:Ie,dataset_list_id:Ie,file_id:Ie},ihm_localization_density_files:{id:Ie,file_id:Ie,ensemble_id:Ie,entity_id:re,entity_poly_segment_id:Ie,asym_id:re},ihm_predicted_contact_restraint:{id:Ie,group_id:Ie,entity_id_1:re,entity_id_2:re,asym_id_1:re,asym_id_2:re,comp_id_1:re,comp_id_2:re,seq_id_1:Ie,seq_id_2:Ie,rep_atom_1:Tt(re),rep_atom_2:Tt(re),distance_lower_limit:_n,distance_upper_limit:_n,probability:_n,restraint_type:Tt(re),model_granularity:Tt(re),dataset_list_id:Ie,software_id:Ie},ihm_cross_link_list:{id:Ie,group_id:Ie,entity_description_1:re,entity_description_2:re,entity_id_1:re,entity_id_2:re,comp_id_1:re,comp_id_2:re,seq_id_1:Ie,seq_id_2:Ie,linker_type:Tt(re),dataset_list_id:Ie},ihm_cross_link_restraint:{id:Ie,group_id:Ie,entity_id_1:re,entity_id_2:re,asym_id_1:re,asym_id_2:re,comp_id_1:re,comp_id_2:re,seq_id_1:Ie,seq_id_2:Ie,atom_id_1:re,atom_id_2:re,restraint_type:Tt(re),conditional_crosslink_flag:Tt(re),model_granularity:Tt(re),distance_threshold:_n,psi:_n,sigma_1:_n,sigma_2:_n},ihm_cross_link_result_parameters:{id:Ie,restraint_id:Ie,model_id:Ie,psi:_n,sigma_1:_n,sigma_2:_n},ihm_2dem_class_average_restraint:{id:Ie,dataset_list_id:Ie,number_raw_micrographs:Ie,pixel_size_width:_n,pixel_size_height:_n,image_resolution:_n,image_segment_flag:Tt(xr),number_of_projections:Ie,struct_assembly_id:Ie,details:re},ihm_2dem_class_average_fitting:{id:Ie,restraint_id:Ie,model_id:Ie,cross_correlation_coefficient:_n,rot_matrix:Kh(3,3),tr_vector:nT(3)},ihm_3dem_restraint:{id:Ie,dataset_list_id:Ie,model_id:Ie,struct_assembly_id:Ie,fitting_method:re,number_of_gaussians:Ie,cross_correlation_coefficient:_n},ihm_sas_restraint:{id:Ie,dataset_list_id:Ie,model_id:Ie,struct_assembly_id:Ie,profile_segment_flag:Tt(xr),fitting_atom_type:re,fitting_method:re,fitting_state:Tt(re),radius_of_gyration:_n,chi_value:_n,details:re},ihm_starting_model_coord:{ordinal_id:Ie,starting_model_id:re,group_PDB:Tt(re),id:Ie,type_symbol:re,entity_id:re,atom_id:re,comp_id:re,seq_id:Ie,asym_id:re,Cartn_x:_n,Cartn_y:_n,Cartn_z:_n,B_iso_or_equiv:_n},ihm_sphere_obj_site:{id:Ie,entity_id:re,seq_id_begin:Ie,seq_id_end:Ie,asym_id:re,Cartn_x:_n,Cartn_y:_n,Cartn_z:_n,object_radius:_n,rmsf:_n,model_id:Ie},ihm_gaussian_obj_site:{id:Ie,entity_id:re,seq_id_begin:Ie,seq_id_end:Ie,asym_id:re,mean_Cartn_x:_n,mean_Cartn_y:_n,mean_Cartn_z:_n,weight:_n,covariance_matrix:Kh(3,3),model_id:Ie},ihm_gaussian_obj_ensemble:{id:Ie,entity_id:re,seq_id_begin:Ie,seq_id_end:Ie,asym_id:re,mean_Cartn_x:_n,mean_Cartn_y:_n,mean_Cartn_z:_n,weight:_n,covariance_matrix:Kh(3,3),ensemble_id:Ie},ihm_feature_list:{feature_id:Ie,feature_type:Tt(re),entity_type:Tt(re)},ihm_poly_residue_feature:{ordinal_id:Ie,feature_id:Ie,entity_id:re,asym_id:re,comp_id_begin:re,comp_id_end:re,seq_id_begin:Ie,seq_id_end:Ie},ihm_derived_distance_restraint:{id:Ie,group_id:Ie,feature_id_1:Ie,feature_id_2:Ie,group_conditionality:Tt(re),random_exclusion_fraction:_n,distance_upper_limit:_n,restraint_type:Tt(re),dataset_list_id:Ie},ma_model_list:{ordinal_id:Ie,model_id:Ie,model_group_id:Ie,model_name:re,model_group_name:re,model_type:Tt(re),data_id:Ie},ma_target_entity:{entity_id:re,data_id:Ie,origin:Tt(re)},ma_target_entity_instance:{asym_id:re,entity_id:re,details:re},ma_target_ref_db_details:{target_entity_id:re,db_name:Tt(re),db_code:re,db_accession:re,seq_db_isoform:re,seq_db_align_begin:re,seq_db_align_end:re,ncbi_taxonomy_id:re,organism_scientific:re},ma_data:{id:Ie,content_type:Tt(re),content_type_other_details:re,name:re},ma_software_group:{ordinal_id:Ie,group_id:Ie,software_id:Ie},ma_qa_metric:{id:Ie,name:re,type:Tt(re),mode:Tt(re),software_group_id:Ie},ma_qa_metric_global:{ordinal_id:Ie,model_id:Ie,metric_id:Ie,metric_value:_n},ma_qa_metric_local:{ordinal_id:Ie,model_id:Ie,label_asym_id:re,label_seq_id:Ie,label_comp_id:re,metric_id:Ie,metric_value:_n}};var Jn;!function(e){let t;var o;let n;(o=t=e.IntDataType||(e.IntDataType={}))[o.Int8=1]="Int8",o[o.Int16=2]="Int16",o[o.Int32=3]="Int32",o[o.Uint8=4]="Uint8",o[o.Uint16=5]="Uint16",o[o.Uint32=6]="Uint32",function(o){o[o.Float32=32]="Float32",o[o.Float64=33]="Float64"}(n=e.FloatDataType||(e.FloatDataType={})),e.getDataType=function r(o){let s;return s=o instanceof Int8Array?e.IntDataType.Int8:o instanceof Int16Array?e.IntDataType.Int16:o instanceof Int32Array?e.IntDataType.Int32:o instanceof Uint8Array?e.IntDataType.Uint8:o instanceof Uint16Array?e.IntDataType.Uint16:o instanceof Uint32Array?e.IntDataType.Uint32:o instanceof Float32Array?e.FloatDataType.Float32:o instanceof Float64Array?e.FloatDataType.Float64:e.IntDataType.Int32,s},e.isSignedIntegerDataType=function i(o){if(o instanceof Int8Array||o instanceof Int16Array||o instanceof Int32Array)return!0;for(let s=0,a=o.length;s=0;n--)t=wFe(t,e.encoding[n]);return t}function wFe(e,t){switch(t.kind){case"ByteArray":switch(t.type){case Jn.IntDataType.Uint8:return e;case Jn.IntDataType.Int8:return function AFe(e){return new Int8Array(e.buffer,e.byteOffset)}(e);case Jn.IntDataType.Int16:return function IFe(e){return Yb(e,2,Int16Array)}(e);case Jn.IntDataType.Uint16:return function TFe(e){return Yb(e,2,Uint16Array)}(e);case Jn.IntDataType.Int32:return function DFe(e){return Yb(e,4,Int32Array)}(e);case Jn.IntDataType.Uint32:return function EFe(e){return Yb(e,4,Uint32Array)}(e);case Jn.FloatDataType.Float32:return function PFe(e){return Yb(e,4,Float32Array)}(e);case Jn.FloatDataType.Float64:return function MFe(e){return Yb(e,8,Float64Array)}(e);default:Rr()}case"FixedPoint":return function RFe(e,t){const n=e.length,r=rJ(t.srcType,n),i=1/t.factor;for(let o=0;o=0?Math.ceil((p+1)/m):Math.ceil((p+1)/(-m-1))}function i({limit8:p,limit16:m},h,g){h.pack8+=t(g,p),h.pack16+=t(g,m),h.count+=1}function o(p,m){p.pack8+=t(m,127),p.pack16+=t(m,32767),p.count+=1}function s(p){return 4*p.count<2*p.pack16?{length:4*p.count,elem:4}:2*p.pack16g.length-y.length),h}e.getSize=d,e.classify=function f(p){if(p.length<2)return Ln.by(Ln.byteArray);switch(d(p)[0].kind){case"pack":return Ln.by(Ln.integerPacking);case"rle":return Ln.by(Ln.runLength).and(Ln.integerPacking);case"delta":return Ln.by(Ln.delta).and(Ln.integerPacking);case"delta-rle":return Ln.by(Ln.delta).and(Ln.runLength).and(Ln.integerPacking);default:Rr()}}}(f2||(f2={})),function(e){e.classify=function n(i){const{mantissaDigits:s,integerDigits:a}=function GFe(e,t,n){let r=1,i=0;for(let o=0,s=e.length;o=0){const c=VFe(e[o],t,n);c<0?r=-1:c>r&&(r=c)}const a=Math.abs(e[o]);if(a>n){const c=Math.floor(Math.log10(Math.abs(a)))+1;c>i&&(i=c)}}return{mantissaDigits:r,integerDigits:i}}(i,4,1e-6);if(s<0||s+a>10)return Ln.by(Ln.byteArray);if(0===s)return f2.classify(i);const c=function r(i){let o=1;for(let s=0;sn[e].value(t)}function qFe(e){return(t,n)=>n[e].value(t).join(n[e].schema.separator)}function VB(e,...t){return(n,r)=>r[e].schema.space.get(r[e].value(n),...t)}function p2(e){return(t,n)=>n[e].valueKind(t)}function WFe(e,t){const n=[],i=p2(e);if(1===t.rank){const o=t.dimensions[0];for(let s=0;s 3 or rank 0 are currently not supported.");{const o=t.dimensions[0],s=t.dimensions[1],a=t.dimensions[2];for(let c=0;c!!t.shouldInclude)?e.fields.filter(t=>!t.shouldInclude||e.source.some(n=>t.shouldInclude(n.data))):e.fields}function sJ(e,t){const n=e.instance(t),r=n.source.filter(s=>s.rowCount>0);return r.length?{instance:n,rowCount:r.reduce((s,a)=>s+a.rowCount,0),source:r.map(s=>({data:s.data,keys:()=>s.keys?s.keys():$I.Range(0,s.rowCount-1),rowCount:s.rowCount}))}:{instance:n,rowCount:0,source:[]}}!function(e){function t(i){return new iT([i])}function r(i){switch(i.kind){case"ByteArray":return Ln.byteArray;case"FixedPoint":return Ln.fixedPoint(i.factor);case"IntervalQuantization":return Ln.intervalQuantizaiton(i.min,i.max,i.numSteps);case"RunLength":return Ln.runLength;case"Delta":return Ln.delta;case"IntegerPacking":return Ln.integerPacking;case"StringArray":return Ln.stringArray}}e.by=t,e.fromEncoding=function n(i){let o=t(r(i[0]));for(let s=1;s=0?I/S|0:I/A|0}return E+=_.length,E}e.byteArray=s,e.fixedPoint=function c(_){return S=>function a(_,S){const A=Jn.getDataType(_),E=new Int32Array(_.length);for(let w=0,D=_.length;wfunction u(_,S,A,E,w){const D=Jn.getDataType(_);if(!_.length)return{encodings:[{kind:"IntervalQuantization",min:S,max:A,numSteps:E,srcType:D}],data:new Int32Array(0)};if(A=A?E-1:0|Math.round((N-S)/I)}return{encodings:[{kind:"IntervalQuantization",min:S,max:A,numSteps:E,srcType:D}],data:R}}(w,_,S,A,E)},e.runLength=function d(_){let S=Jn.getDataType(_);if(void 0===S&&(_=new Int32Array(_),S=Jn.IntDataType.Int32),!_.length)return{encodings:[{kind:"RunLength",srcType:S,srcSize:0}],data:new Int32Array(0)};let A=2;for(let I=1,R=_.length;I=0)for(;M>=A;)D[I]=A,++I,M-=A;else for(;M<=E;)D[I]=E,++I,M-=E;D[I]=M,++I}const R=s(D);return{encodings:[{kind:"IntegerPacking",byteCount:S.bytesPerElement,isUnsigned:!S.isSigned,srcSize:w},R.encodings[0]],data:R.data}}(_,S)},e.stringArray=function x(_){const S=Object.create(null),A=[],E=new Int32Array(_.length),w=ze.create(Int32Array,1,Math.min(1024,_.length<32?_.length+1:Math.round(_.length/8)+1));ze.add(w,0);let D=0,I=0;for(const F of _){if(null==F){E[I++]=-1;continue}let G=S[F];void 0===G&&(D+=F.length,G=A.length,A[G]=F,S[F]=G,ze.add(w,D)),E[I++]=G}const R=ze.compact(w),M=FB(R).encode(R),V=FB(E).encode(E);return{encodings:[{kind:"StringArray",dataEncoding:V.encoding,stringData:A.join(""),offsetEncoding:M.encoding,offsets:M.data}],data:V.data}}}(Ln||(Ln={})),function(e){function n(a,c,u){return{name:a,type:1,value:c,valueKind:u&&u.valueKind,defaultFormat:u?{encoder:u.encoder,typedArray:u.typedArray}:void 0,shouldInclude:u&&u.shouldInclude}}e.str=function t(a,c,u){return{name:a,type:0,value:c,valueKind:u&&u.valueKind,defaultFormat:u&&u.encoder?{encoder:u.encoder}:void 0,shouldInclude:u&&u.shouldInclude}},e.int=n,e.float=function r(a,c,u){return{name:a,type:2,value:c,valueKind:u&&u.valueKind,defaultFormat:u?{encoder:u.encoder,typedArray:u.typedArray,digitCount:typeof u.digitCount<"u"?u.digitCount:void 0}:void 0,shouldInclude:u&&u.shouldInclude}},e.index=function i(a){return n(a,(c,u,l)=>l+1,{typedArray:Int32Array,encoder:Ln.by(Ln.delta).and(Ln.runLength).and(Ln.integerPacking)})};class o{constructor(){this.fields=[]}index(c){return this.fields.push(e.index(c)),this}str(c,u,l){return this.fields.push(e.str(c,u,l)),this}int(c,u,l){return this.fields.push(e.int(c,u,l)),this}vec(c,u,l){for(let d=0;du.split(".")[0]);return{includeCategory:u=>!o.includes(u)&&(i.length<=0||-1!==i.indexOf(u)),includeField(u,l){const d=u+"."+l;return!a.includes(d)&&(!c.includes(u)||s.includes(d))}}},e.DefaultFilter={includeCategory:r=>!0,includeField:(r,i)=>!0},e.DefaultFormatter={getFormat(r,i){}},e.ofTable=function n(r,i){return i?{fields:oJ(r._schema),source:[{data:r,rowCount:i.length,keys:()=>$I.Array(i)}]}:{fields:oJ(r._schema),source:[{data:r,rowCount:r._rowCount}]}}}(lu||(lu={})),function(e){function t(r,i,o){r.startDataBlock(i);for(const s of o._tableNames)r.writeCategory({name:s,instance:()=>lu.ofTable(o[s])})}e.writeDatabase=t,e.writeDatabaseCollection=function n(r,i){for(const o of Object.keys(i))t(r,o,i[o])}}(LB||(LB={}));class YFe{constructor(){this.builder=ir.create(),this.encoded=!1,this.dataBlockCreated=!1,this.filter=lu.DefaultFilter,this.formatter=lu.DefaultFormatter,this.isBinary=!1,this.binaryEncodingProvider=void 0}setFilter(t){this.filter=t||lu.DefaultFilter}isCategoryIncluded(t){return this.filter.includeCategory(t)}setFormatter(t){this.formatter=t||lu.DefaultFormatter}startDataBlock(t){this.dataBlockCreated=!0,ir.write(this.builder,`data_${(t||"").replace(/[ \n\t]/g,"").toUpperCase()}\n#\n`)}writeCategory(t,n,r){if(this.encoded)throw new Error("The writer contents have already been encoded, no more writing.");if(!this.dataBlockCreated)throw new Error("No data block created.");if(!r?.ignoreFilter&&!this.filter.includeCategory(t.name))return;const{instance:i,rowCount:o,source:s}=sJ(t,n);o&&(1===o?function XFe(e,t,n,r,i,o){const s=zB(t),a=n[0],c=a.data;let u=s.reduce((p,m)=>i.includeField(e.name,m.name)?Math.max(p,m.name.length):0,0);if(0===u)return;u+=e.name.length+6;const d=a.keys().move(),f=cJ(e.name,t.fields,o);for(let p=0;pi.includeField(e.name,d.name)),c=a.length;if(0===c)return;const u=cJ(e.name,a,o);uJ(r,"loop_");for(let d=0;d=0}(c)?(oT(e,c),!0):function nBe(e,t){if(!t)return ir.writeSafe(e,". "),!1;const n=t.charCodeAt(0);let r=!1,i=0,o=!1,s=!1;for(let a=0,c=t.length-1;a<=c;a++)switch(t.charCodeAt(a)){case 9:case 32:r=!0;break;case 10:return oT(e,t),!0;case 34:if(a&&a===c)break;if(o)return oT(e,t),!0;s=!0,r=!0,i=0;break;case 39:if(a&&a===c)break;if(s)return oT(e,t),!0;o=!0,r=!0,i=1}return!r&&(35===n||36===n||59===n||91===n||93===n||95===n)&&(r=!0),r?(ir.writeSafe(e,i?'"':"'"),ir.writeSafe(e,t),ir.writeSafe(e,i?'" ':"' ")):(ir.writeSafe(e,t),ir.writeSafe(e," ")),!1}(e,c);1===u?function QFe(e,t){ir.writeInteger(e,t),ir.whitespace1(e)}(e,c):function JFe(e,t,n){ir.writeFloat(e,t,n),ir.whitespace1(e)}(e,c,i)}return!1}function cJ(e,t,n){const r=[];for(const i of t){const o=n.getFormat(e,i.name);r[r.length]=o&&typeof o.digitCount<"u"?2===i.type?Math.pow(10,Math.max(0,Math.min(o.digitCount,15))):0:2===i.type?Math.pow(10,$Fe(i)):0}return r}function uJ(e,t){ir.write(e,t),ir.newline(e)}function oT(e,t){ir.writeSafe(e,"\n;"+t),ir.writeSafe(e,"\n;\n")}function Xb(e,t,n){for(let r=0,i=n.length;r>>0&127;else if(o<2048)e[t++]=o>>>6&31|192,e[t++]=o>>>0&63|128;else if(o<65536)e[t++]=o>>>12&15|224,e[t++]=o>>>6&63|128,e[t++]=o>>>0&63|128;else{if(!(o<1114112))throw new Error("bad codepoint "+o);e[t++]=o>>>18&7|240,e[t++]=o>>>12&63|128,e[t++]=o>>>6&63|128,e[t++]=o>>>0&63|128}}}const rBe=function(){const e=[];for(let t=0;t<1024;t++)e[t]=String.fromCharCode(t);return e}();function lJ(e){throw new Error(e)}const dJ=typeof TextDecoder<"u"?new TextDecoder:void 0;function GB(e,t,n){if(dJ){const r=t||n!==e.length?e.subarray(t,t+n):e;return dJ.decode(r)}return function iBe(e,t,n){const r=rBe;let i,o=0;const s=[];for(let c=t,u=t+n;c0&&(i[i.length]=s.slice(0,o).join("")),i.join("")):s.slice(0,o).join("")}(e,t,n)}function sT(e){let t=0;for(let n=0,r=e.length;n=0){if(e<128)return 1;if(e<256)return 2;if(e<65536)return 3;if(e<4294967296)return 5;throw new Error("Number too big 0x"+e.toString(16))}if(e>=-32)return 1;if(e>=-128)return 2;if(e>=-32768)return 3;if(e>=-2147483648)return 5;throw new Error("Number too small -0x"+e.toString(16).substr(1))}if("boolean"===t||null==e)return 1;if("object"===t){let n,r=0;if(Array.isArray(e)){n=e.length;for(let i=0;i=0){if(e<128)return t.setUint8(r,e),1;if(e<256)return t.setUint8(r,204),t.setUint8(r+1,e),2;if(e<65536)return t.setUint8(r,205),t.setUint16(r+1,e),3;if(e<4294967296)return t.setUint8(r,206),t.setUint32(r+1,e),5;throw new Error("Number too big 0x"+e.toString(16))}if(e>=-32)return t.setInt8(r,e),1;if(e>=-128)return t.setUint8(r,208),t.setInt8(r+1,e),2;if(e>=-32768)return t.setUint8(r,209),t.setInt16(r+1,e),3;if(e>=-2147483648)return t.setUint8(r,210),t.setInt32(r+1,e),5;throw new Error("Number too small -0x"+(-e).toString(16).substr(1))}if(null==e)return t.setUint8(r,192),1;if("boolean"===i)return t.setUint8(r,e?195:194),1;if("object"===i){let o,s=0;const a=Array.isArray(e);let c;if(a?o=e.length:(c=Object.keys(e),o=c.length),o<16?(t.setUint8(r,o|(a?144:128)),s=1):o<65536?(t.setUint8(r,a?220:222),t.setUint16(r+1,o),s=3):o<4294967296&&(t.setUint8(r,a?221:223),t.setUint32(r+1,o),s=5),a)for(let u=0;ui.properties.chemicalComponentMap.has(o.comp_id.value(s)))},e.getEntriesFromChemCompBond=function n(i){const o=new Map;function s(h){if(o.has(h))return o.get(h);const g=new r(h);return o.set(h,g),g}const{comp_id:a,atom_id_1:c,atom_id_2:u,value_order:l,pdbx_aromatic_flag:d,_rowCount:f,pdbx_ordinal:p}=i;let m=s(a.value(0));for(let h=0;h=0)return!0;return!1}e.Descriptor={name:"struct_conn",cifExport:{prefix:"",categories:[{name:"struct_conn",instance(o){const s=e.Provider.get(o.firstModel);if(!s||0===s.entries.length)return Bi.Category.Empty;const a=o.structures[0],c=[];for(const u of s.entries)n(a,u.partnerA.atomIndex)&&n(a,u.partnerB.atomIndex)&&(c[c.length]=u.rowIndex);return Bi.Category.ofTable(s.data,c)}}]}},e.Provider=td.create(e.Descriptor),e.isExhaustive=function t(o){const s=e.Provider.get(o);return!!s&&s.data.id.rowCount/o.atomicConformation.atomId.rowCount>.95},e.getAtomIndexFromEntries=function r(o){const s=new Map;for(const a of o){const{partnerA:{atomIndex:c},partnerB:{atomIndex:u}}=a;s.has(c)?s.get(c).push(a):s.set(c,[a]),s.has(u)?s.get(u).push(a):s.set(u,[a])}return s},e.getEntriesFromStructConn=function i(o,s){const{conn_type_id:a,pdbx_dist_value:c,pdbx_value_order:u}=o,l={label_asym_id:o.ptnr1_label_asym_id,label_seq_id:o.ptnr1_label_seq_id,auth_seq_id:o.ptnr1_auth_seq_id,label_atom_id:o.ptnr1_label_atom_id,label_alt_id:o.pdbx_ptnr1_label_alt_id,ins_code:o.pdbx_ptnr1_PDB_ins_code,symmetry:o.ptnr1_symmetry},d={label_asym_id:o.ptnr2_label_asym_id,label_seq_id:o.ptnr2_label_seq_id,auth_seq_id:o.ptnr2_auth_seq_id,label_atom_id:o.ptnr2_label_atom_id,label_alt_id:o.pdbx_ptnr2_label_alt_id,ins_code:o.pdbx_ptnr2_PDB_ins_code,symmetry:o.ptnr2_symmetry},f=Array.from(s.entities.data.id.toArray()),p=(h,g)=>{if(0!==g.label_asym_id.valueKind(h))return;const y=g.label_asym_id.value(h),b=g.label_atom_id.value(h);if(!b)return;const x=g.auth_seq_id.valueKind(h)===te.ValueKind.Present?g.auth_seq_id.value(h):g.label_seq_id.value(h),_=g.ins_code.value(h),S=g.label_alt_id.value(h);for(const A of f){const E=s.atomicHierarchy.index.findResidue(A,y,x,_);if(E<0)continue;const w=s.atomicHierarchy.index.findAtomOnResidue(E,b,S);if(!(w<0))return{residueIndex:E,atomIndex:w,symmetry:g.symmetry.value(h)}}},m=[];for(let h=0;hMs.Provider.get(o)),i=e.models.some(o=>du.isExhaustive(o));return t.noCompute||e.isCoarseGrained&&!r&&!i||Ve.eachUnitPair(e,(o,s)=>{!function wBe(e,t,n,r){const{maxRadius:i}=n,{elements:o,residueIndex:s}=e,{x:a,y:c,z:u}=e.model.atomicConformation,{elements:l,residueIndex:d}=t,f=e.elements.length,{type_symbol:p,label_alt_id:m,label_atom_id:h,label_comp_id:g}=e.model.atomicHierarchy.atoms,{type_symbol:y,label_alt_id:b,label_atom_id:x,label_comp_id:_}=t.model.atomicHierarchy.atoms,{auth_seq_id:S}=e.model.atomicHierarchy.residues,{auth_seq_id:A}=t.model.atomicHierarchy.residues,{occupancy:E}=e.model.atomicConformation,{occupancy:w}=t.model.atomicConformation,D=E.isDefined&&w.isDefined,I=e.model===t.model&&du.Provider.get(e.model),R=!n.forceCompute&&e.model===t.model&&Ms.Provider.get(e.model),{atomSourceIndex:T}=e.model.atomicHierarchy,{invertedIndex:M}=R?sn.getInvertedAtomSourceIndex(t.model):{invertedIndex:void 0},N=e.model===t.model&&du.isExhaustive(e.model),V=le.mul(CBe,t.conformation.operator.inverse,e.conformation.operator.matrix),F=!le.isIdentity(V),{center:G,radius:L}=t.boundary.sphere,z=(L+i)*(L+i);r.startUnitPair(e.id,t.id);const j=e.conformation.operator.key,Z=t.conformation.operator.key;for(let $=0;$z)continue;if(!n.forceCompute&&R){const{maxDistance:K}=R,{offset:ne,b:de,edgeProps:{order:we,distance:Le,flag:We,key:U,operatorA:Y,operatorB:ge}}=R.bonds,Se=T.value(ee),Re=Qd(p.value(ee));for(let Ne=ne[Se],Ge=ne[Se+1];Ne=0&&ke!==j&&ke!==Z||Xe>=0&&Xe!==Z&&Xe!==j)continue;const ot=Qd(p.value($e)),_t=Le[Ne],ut=yJ(e,ee,t,$e);let Ct=!1;_t>=0?Ct=ai(ut,_t,.3):K>=0?Ct=uti||(r.add($,We,{order:ne.order,flag:ne.flags,key:ne.rowIndex}),K=!0)}if(K)continue}if(N)continue;const O=E.value(ee),{lookup3d:H}=t,{indices:W,count:Q,squaredDistances:fe}=H.find(Vg[0],Vg[1],Vg[2],i);if(0===Q)continue;const X=Qd(p.value(ee)),J=dp(X),ce=Xh(X),be=m.value(ee),ae=d2.has(X),me=h.value(ee),oe=g.value(s[ee]);for(let K=0;Kt.validUnit(o),validUnitPair:(o,s)=>t.validUnitPair(e,o,s)}),new l2(n.getMap())}(e,{...n,validUnit:t&&t.validUnit||(r=>Ee.isAtomic(r)),validUnitPair:t&&t.validUnitPair||((r,i,o)=>{if(!Ve.validUnitPair(r,i,o))return!1;const a=i.model.atomicHierarchy.derived.residue.moleculeType,c=o.model.atomicHierarchy.derived.residue.moleculeType,u=!(Ee.isAtomic(i)&&2===a[i.residueIndex[i.elements[0]]]||Ee.isAtomic(o)&&2===c[o.residueIndex[o.elements[0]]]),l=!Ee.isAtomic(i)||3!==a[i.residueIndex[i.elements[0]]],d=!Ee.isAtomic(o)||3!==c[o.residueIndex[o.elements[0]]];return!(!u&&n.ignoreWater||(!l||!d)&&n.ignoreIon)||function DBe(e,t){if(e.model!==t.model||!Ee.isAtomic(e)||!Ee.isAtomic(t))return!1;const n=du.Provider.get(e.model);if(!n)return!1;const r=e.elements.length=t.elements.length?e:t,{elements:o}=r,{elements:s}=i,{indexOf:a}=je;for(let c=0,u=o.length;c=0)return!0}return!1}(i,o)})})}var Lt;function bJ(e){e.count=e.endVertex-e.startVertex;const{isRingAtom:t,pred:n,color:r,depth:i,marked:o}=e;for(let s=0;s=0;y--)h[g++]=e.startVertex+a[y],r[a[y]]=1;Ou(h);for(let y=0,b=e.currentRings.length;yx.length&&je.isSubset(h,x))return!1}return e.currentRings.push(je.ofSortedArray(h)),!0}function xJ(e,t,n){const{bonds:r,startVertex:i,endVertex:o,isRingAtom:s,marked:a,queue:c,pred:u,depth:l}=e,{elements:d}=e.unit,{b:f,edgeProps:{flags:p},offset:m}=r;a[t]=n,l[t]=0,c[0]=t;let h=0,g=1;for(;h=o||!jn.isCovalent(p[A]))continue;if(e.hasAltLoc){const I=e.altLoc.value(d[E]);if(I&&e.currentAltLoc!==I)continue}const w=E-i;if(a[w]===n){if(u[w]!==y&&u[y]!==w&&kBe(e,y,w,s))return n+1;continue}const D=Math.min(l[w],b+1);D>5||(l[w]=D,a[w]=n,c[g++]=w,u[w]=y)}}return n+1}function SJ(e){const t=e.length,n=new Int32Array(2*t);for(let s=0;s{const _=y.unitMap.get(x.aUnit.id);if(!_)return;const S=y.unitMap.get(x.bUnit.id);if(!S)return;const E=je.indexOf(_.elements,x.aUnit.elements[x.aIndex]);if(-1===E)return;const D=je.indexOf(S.elements,x.bUnit.elements[x.bIndex]);-1!==D&&b.push(t(g.structure,_,E,g.structure,S,D))}),i(y,b)},e.toStructureElementLoci=function u(g){const y=[],b=new Map;for(const x of g.bonds){const{aIndex:_,aUnit:S,bIndex:A,bUnit:E}=x;S===E?b.has(S.id)?b.get(S.id).push(_,A):b.set(S.id,[_,A]):(b.has(S.id)?b.get(S.id).push(_):b.set(S.id,[_]),b.has(E.id)?b.get(E.id).push(A):b.set(E.id,[A]))}return b.forEach((x,_)=>{y.push({unit:g.structure.unitMap.get(_),indices:je.deduplicate(je.ofUnsortedArray(x))})}),De(g.structure,y)},e.toFirstStructureElementLoci=function l(g){const{aUnit:y,aIndex:b}=g.bonds[0];return De(g.structure,[{unit:y,indices:Fe.ofSingleton(b)}])},e.getType=function d(g,y){if(y.aUnit===y.bUnit){const b=y.aUnit.bonds,x=b.getEdgeIndex(y.aIndex,y.bIndex);return jn.create(x<0?0:b.edgeProps.flags[x])}{const b=g.interUnitBonds.getBondFromLocation(y);return jn.create(b?b.props.flag:0)}},e.getOrder=function f(g,y){if(y.aUnit===y.bUnit){const b=y.aUnit.bonds,x=b.getEdgeIndex(y.aIndex,y.bIndex);return x<0?0:b.edgeProps.order[x]}{const b=g.interUnitBonds.getBondFromLocation(y);return b?b.props.order:0}},e.getIntraUnitBondCount=function p(g){let y=0;for(let b=0,x=g.units.length;b{const{aUnit:S,aIndex:A,bUnit:E,bIndex:w}=g.bonds[b];S.conformation.position(S.elements[A],x),E.conformation.position(E.elements[w],_)},y)}}(Lt||(Lt={}));const OBe=new Set;function Qh(e,t){const n=WNe[e];if(void 0!==n){const r=n[t];if(void 0!==r)return r}return OBe}const wJ=v.zero();function AJ(e,t){const n=e.conformation,r=new Float32Array(3*t.length),{elements:i}=e;for(let o=0,s=t.length;o=y||i.addEdge(c,y)}}}const o=Dc.connectedComponents(i.getGraph()),s=o.componentIndex,a=[];for(let c=0;c=0&&(n.has(a)?n.get(a).push(s):n.set(a,[s]))}}(function(e){function n(a){return function NBe(e){const t=e.length,n=new Array(t);for(let s=0;s0)return!1;const y=nd.calculateMomentsAxes(AJ(a,c));return v.magnitude(y.dirC)<.05},e.getAltId=function s(a,c){const{label_alt_id:u}=a.model.atomicHierarchy.atoms,{elements:l}=a;for(let d=0,f=c.length;dFe.max(S)||o(_)this.maxDist[t]&&(this.maxDist[t]=r,EJ(this.extrema[2*t+1],n))}computeSphereExtrema(t,n,r){const i=this.dir[t],o=DJ(i,n);o-rthis.maxDist[t]&&(this.maxDist[t]=o+r,KBe(this.extrema[2*t+1],n,i,r))}includeSphere(t){if(_e.hasExtrema(t)&&t.extrema.length>1)for(const n of t.extrema)this.includePosition(n);else this.includePositionRadius(t.center,t.radius)}includePosition(t){for(let n=0;n1)for(const n of t.extrema)this.radiusPosition(n);else this.radiusPositionRadius(t.center,t.radius)}radiusPosition(t){this.centroidHelper.radiusStep(t)}radiusPositionRadius(t,n){this.centroidHelper.radiusSphereStep(t,n)}getSphere(t){return _e.setExtrema(this.centroidHelper.getSphere(t),this.extrema.slice())}getBox(t){return St.fromVec3Array(t||St(),this.extrema)}reset(){for(let t=0;t{const r=v.create(n[0],n[1],n[2]);return v.normalize(r,r)})}(t),this.dirLength=this.dir.length,this.reset()}}const lT=[[1,0,0],[0,1,0],[0,0,1]],HB=[[1,1,1],[-1,1,1],[-1,-1,1],[1,-1,1]],PJ=[[1,1,0],[1,-1,0],[1,0,1],[1,0,-1],[0,1,1],[0,1,-1]],QBe=[[0,1,2],[0,2,1],[1,0,2],[2,0,1],[1,2,0],[2,1,0],[0,1,-2],[0,2,-1],[1,0,-2],[2,0,-1],[1,-2,0],[2,-1,0]],JBe=[[1,1,2],[2,1,1],[1,2,1],[1,-1,2],[1,1,-2],[1,-1,-2],[2,-1,1],[2,1,-1],[2,-1,-1],[1,-2,1],[1,2,-1],[1,-2,-1]],eOe=[[2,2,1],[1,2,2],[2,1,2],[2,-2,1],[2,2,-1],[2,-2,-1],[1,-2,2],[1,2,-2],[1,-2,-2],[2,-1,2],[2,1,-2],[2,-1,-2]],MJ=v.set,tOe=new fu("14"),nOe=new fu("98");function qB(e){const t=St.computeBounding(e);return{box:t,sphere:_e.fromBox3D(_e(),t)}}const dT=v();function pp(e){const{x:t,y:n,z:r,radius:i,indices:o}=e,s=Fe.size(o);if(s>25e4)return qB(e);const a=function rOe(e){return e>1e4?tOe:nOe}(s);a.reset();for(let u=0;u{const n=[];let r=0;for(let i=0;iZe.unit.operator_name(l.element),ui.DefaultName),Sr.pred.inSet(l=>Ze.chain.label_asym_id(l.element),o.asymIds))});n[n.length]={selector:u,operators:c,asymIds:o.asymIds},r+=c.length}return n}}(s,r))}function cOe(e){const t=[],n=[];for(let r=0;r{const s=[];o.split(",").forEach(a=>{const c=a.indexOf("-");if(c>0){const u=parseInt(a.substring(0,c)),l=parseInt(a.substr(c+1));for(let d=u;d<=l;d++)s[s.length]=d.toString()}else s[s.length]=a.trim()}),r[r.length]=s}),r}function hOe(e){if(0===e._rowCount)return;const{id:t,matrix:n,vector:r}=e,i=On.struct_ncs_oper.matrix.space,o=On.struct_ncs_oper.vector.space,s=[];for(let a=0;a{const h=c.length;c.push(je.ofUnsortedArray([f,p,m])),u.set(t2(f,p),m),l.has(f)?l.get(f).push(h):l.set(f,[h])};for(let f=0;f=2){d(f,m[0],m[1]);for(let h=1,g=m.length;hu.get(t2(f,p)),getTripletIndices:f=>l.get(f),triplets:c}}function kJ(){return{result:Kb.create(),closeUnitsResult:Uu.create(),unitGroupResult:Uu.create()}}!function(e){e.create=function t(n,r,i){return new e(n,r,i)}}($B||($B={})),function(e){e.Default={assemblies:[],spacegroup:Ec.ZeroP1,isNonStandardCrystalFrame:!1},e.findAssembly=function t(r,i){const o=i.toLocaleLowerCase(),s=no.Provider.get(r);return s?cB(s.assemblies,a=>a.id.toLowerCase()===o):void 0},e.getUnitcellLabel=function n(r){const{cell:i,name:o,num:s}=r.spacegroup,{size:a,anglesInRadians:c}=i,u=a[0].toFixed(2),l=a[1].toFixed(2),d=a[2].toFixed(2),f=su(c[0]).toFixed(2),p=su(c[1]).toFixed(2),m=su(c[2]).toFixed(2),h=[];return h.push(`Unit Cell ${o} #${s}`),h.push(`${u}\xd7${l}\xd7${d} \u212b`),h.push(`\u03b1=${f}\xb0 \u03b2=${p}\xb0 \u03b3=${m}\xb0`),h.join(" | ")}}(h2||(h2={})),function(e){e.Descriptor={name:"model_symmetry"},e.Provider=td.create(e.Descriptor),e.fromData=function t(r){const i=function iOe(e,t,n){if(!e._rowCount)return[];const r=function aOe(e){const{id:t,matrix:n,vector:r,_schema:i}=e,o=new Map,s=v();for(let a=0,c=e._rowCount;az[j]}(L=t=e.Kinds||(e.Kinds={}))[L.Atomic=0]="Atomic",L[L.Spheres=1]="Spheres",L[L.Gaussians=2]="Gaussians",e.isAtomic=function n(L){return 0===L.kind},e.isCoarse=function r(L){return 1===L.kind||2===L.kind},e.isSpheres=function i(L){return 1===L.kind},e.isGaussians=function o(L){return 2===L.kind},e.create=function s(L,z,j,Z,$,ee,q,O,H){switch($){case 0:return new y(L,z,j,Z,ee,O,ui.createMapping(q,ee.atomicConformation),H??{});case 1:return w(L,z,j,Z,ee,1,O,ui.createMapping(q,ee.coarseConformation.spheres,h(ee)),H??{});case 2:return w(L,z,j,Z,ee,2,O,ui.createMapping(q,ee.coarseConformation.gaussians,z=>0),H??{})}},e.SymmetryGroup=u,function(L){L.areInvariantElementsEqual=function z(Z,$){return Z.hashCode===$.hashCode&&je.areEqual(Z.elements,$.elements)},L.getUnitSymmetryGroupsIndexMap=function j(Z){const $=Lu.Mutable();for(let ee=0,q=Z.length;ee=M)continue;const N=je.indexOf(e.elements,M);if(N<0)continue;const V=f[R],F=p[R];if(V>=0&&V!==S||F>=0&&F!==S)continue;const G=Qd(r.value(M)),L=u[R],z=hBe(e,E,M);let j=!1;L>=0?j=ai(z,L,.3):o>=0?j=z1&&(N=!1)}}}return fJ(S,A,w,E,D,s,T||M&&N)}(e,n)}(this),z.set(this.elements,j)),this.props.bonds=j,this.props.bonds}get rings(){return this.props.rings||(this.props.rings=uT.create(this)),this.props.rings}get resonance(){return this.props.resonance||(this.props.resonance=function mOe(e){return{delocalizedTriplets:gOe(e)}}(this)),this.props.resonance}get polymerElements(){return this.props.polymerElements||(this.props.polymerElements=function GBe(e){const t=[],{elements:n,model:r}=e,{residueAtomSegments:i}=e.model.atomicHierarchy,{traceElementIndex:o}=r.atomicHierarchy.derived.residue,s=wr.transientSegments(e.model.atomicRanges.polymerRanges,n),a=en.transientSegments(i,n);for(;s.hasNext;){const c=s.move();for(a.setSegment(c);a.hasNext;){const u=a.move(),{start:l,end:d,index:f}=u;if(Fe.areIntersecting(Ce.ofRange(n[l],n[d-1]),n)){const p=o[f];t.push(-1===p?i.offsets[f]:p)}}}return je.ofSortedArray(t)}(this)),this.props.polymerElements}get gapElements(){return this.props.gapElements||(this.props.gapElements=function HBe(e){const t=[],{elements:n,model:r,residueIndex:i}=e,{residueAtomSegments:o}=e.model.atomicHierarchy,{traceElementIndex:s}=r.atomicHierarchy.derived.residue,a=wr.transientSegments(e.model.atomicRanges.gapRanges,e.elements);for(;a.hasNext;){const c=a.move(),u=i[n[c.start]],l=i[n[c.end-1]],d=s[u],f=s[l];t.push(-1===d?o.offsets[u]:d),t.push(-1===f?o.offsets[l]:f)}return je.ofSortedArray(t)}(this)),this.props.gapElements}get nucleotideElements(){return this.props.nucleotideElements||(this.props.nucleotideElements=function WBe(e){const t=[],{elements:n,model:r}=e,{chainAtomSegments:i,residueAtomSegments:o}=r.atomicHierarchy,{moleculeType:s,traceElementIndex:a}=r.atomicHierarchy.derived.residue,c=en.transientSegments(i,n),u=en.transientSegments(o,n);for(;c.hasNext;)for(u.setSegment(c.move());u.hasNext;){const{index:l}=u.move();if(Ya(s[l])){const d=a[l];t.push(-1===d?o.offsets[l]:d)}}return je.ofSortedArray(t)}(this)),this.props.nucleotideElements}get proteinElements(){return this.props.proteinElements||(this.props.proteinElements=function $Be(e){const t=[],{elements:n,model:r}=e,{chainAtomSegments:i,residueAtomSegments:o}=r.atomicHierarchy,{moleculeType:s,traceElementIndex:a}=r.atomicHierarchy.derived.residue,c=en.transientSegments(i,n),u=en.transientSegments(o,n);for(;c.hasNext;)for(u.setSegment(c.move());u.hasNext;){const{index:l}=u.move();if(ZQ(s[l])){const d=a[l];t.push(-1===d?o.offsets[l]:d)}}return je.ofSortedArray(t)}(this)),this.props.proteinElements}get residueCount(){if(void 0!==this.props.residueCount)return this.props.residueCount;let z=0;const j=en.transientSegments(this.model.atomicHierarchy.residueAtomSegments,this.elements);for(;j.hasNext;)j.move(),z+=1;return this.props.residueCount=z,this.props.residueCount}getResidueIndex(z){return this.residueIndex[this.elements[z]]}constructor(z,j,Z,$,ee,q,O,H){this.kind=0,this.objectPrimitive="atomistic",this.id=z,this.invariantId=j,this.chainGroupId=Z,this.traits=$,this.model=ee,this.elements=q,this.conformation=O,this.residueIndex=ee.atomicHierarchy.residueAtomSegments.index,this.chainIndex=ee.atomicHierarchy.chainAtomSegments.index,this.props=H}}e.Atomic=y;class x{getChild(z){return z.length===this.elements.length?this:w(this.id,this.invariantId,this.chainGroupId,this.traits,this.model,this.kind,z,this.conformation,{})}applyOperator(z,j,Z=!1){const $=Z?j:ui.compose(this.conformation.operator,j);return w(z,this.invariantId,this.chainGroupId,this.traits,this.model,this.kind,this.elements,ui.createMapping($,this.getCoarseConformation(),this.conformation.r),this.props)}remapModel(z,j,Z){const $=this.getCoarseConformation(),ee=_(this.kind,z);Z||(Z={...this.props},e.isSameConformation(this,z)||(Z.boundary=void 0,Z.lookup3d=void 0,Z.principalAxes=void 0));const q=$!==ee?ui.createMapping(this.conformation.operator,ee,1===this.kind?h(z):z=>0):this.conformation;return new x(this.id,this.invariantId,this.chainGroupId,this.traits,z,this.kind,this.elements,q,Z)}get boundary(){if(this.props.boundary)return this.props.boundary;const{x:z,y:j,z:Z}=this.getCoarseConformation();return this.props.boundary=p.is(this.traits,f.FastBoundary)?qB({x:z,y:j,z:Z,indices:this.elements}):pp({x:z,y:j,z:Z,indices:this.elements}),this.props.boundary}get lookup3d(){if(this.props.lookup3d)return this.props.lookup3d;const{x:z,y:j,z:Z}=this.getCoarseConformation();return this.props.lookup3d=rd({x:z,y:j,z:Z,indices:this.elements},this.boundary),this.props.lookup3d}get principalAxes(){return this.props.principalAxes||(this.props.principalAxes=TJ(this)),this.props.principalAxes}get polymerElements(){return this.props.polymerElements||(this.props.polymerElements=function jBe(e){const t=[],{elements:n,model:r}=e,{spheres:i,gaussians:o}=r.coarseHierarchy,s=Ee.isSpheres(e)?i.polymerRanges:o.polymerRanges,a=wr.transientSegments(s,n);for(;a.hasNext;){const{start:c,end:u}=a.move();for(let l=c;l(u+=c[p].elements.length)>=i,o.closeUnitsResult);if(0===l.count)return s;let d=0,f=-Number.MAX_VALUE;for(let p=0,m=l.count;p=i&&fs||c.addElement(b[y.indices[x]])}c.commitUnit()}}check(t,n,r,i){const{units:o}=this.structure,s=this.unitLookup.find(t,n,r,i);if(0===s.count)return!1;for(let a=0,c=s.count;a0&&(i[i.length]=a.getChild(u))}return Ve.create(i,{parent:e.parent||t.parent})}function XB(e){return jn.isCovalent(e.atomicBond.type)}function _Oe(){return function(t){const{inputStructure:n}=t,r=nt.create(n),i=[];for(const o of n.units){if(0!==o.kind)continue;r.unit=o;const s=o.elements;if(r.element=s[0],"polymer"!==Ze.entity.type(r))continue;const a=en.transientSegments(o.model.atomicHierarchy.residueAtomSegments,s);let c=0;for(;a.hasNext;)c++,a.move();c<8||i.push(o)}return pt.Singletons(n,Ve.create(i,{parent:n}))}}function xOe(){return function(t){const{inputStructure:n}=t,r=nt.create(n),i=[];for(const o of n.units)0===o.kind&&(r.unit=o,r.element=o.elements[0],"water"===Ze.entity.type(r)&&i.push(o));return pt.Singletons(n,Ve.create(i,{parent:n}))}}function SOe(){return function(t){const{inputStructure:n}=t,r=nt.create(n),i=[];for(const o of n.units){if(0!==o.kind)continue;r.unit=o;const s=o.elements;if(r.element=s[0],"water"!==Ze.entity.type(r)){if("polymer"===Ze.entity.type(r)){const a=en.transientSegments(o.model.atomicHierarchy.residueAtomSegments,s);let c=0;for(;a.hasNext;)c++,a.move();if(c>=8)continue}i.push(o)}}return pt.Singletons(n,Ve.create(i,{parent:n}))}}function COe(){return function(t){const{inputStructure:n}=t,r=[];for(const i of n.units)1===i.kind&&r.push(i);return pt.Singletons(n,Ve.create(r,{parent:n}))}}function FJ(e,t,n){return{groupedUnits:e,ranges:t,set:n}}function BJ(e){return function(n){return pt.Sequence(n.inputStructure,[Kn.toStructure({hash:n.inputStructure.hashCode,elements:e},n.inputStructure)])}}!function(e){function t(y,b){return{kind:"singletons",source:y,structure:b}}function n(y,b){return{kind:"sequence",source:y,structures:b}}function r(y){return t(y,Ve.Empty)}function i(y){return"singletons"===y.kind}function o(y){return i(y)?0===y.structure.units.length:0===y.structures.length}function a(y){return o(y)?Ve.Empty:i(y)?y.structure:m2(y.source,y.structures)}function l(y,b,x){return 0===b.length?r(y):x?t(y,m2(y,b)):n(y,b)}e.Singletons=t,e.Sequence=n,e.Empty=r,e.isSingleton=i,e.isEmpty=o,e.structureCount=function s(y){return i(y)?y.structure.elementCount:y.structures.length},e.unionStructure=a,e.toLociWithCurrentUnits=function c(y){const b=[],{unitMap:x}=y.source;for(const _ of a(y).units)b[b.length]=_===x.get(_.id)?{unit:_,indices:Fe.ofBounds(0,_.elements.length)}:{unit:_,indices:Fe.ofSortedArray(je.indicesOf(x.get(_.id).elements,_.elements))};return De(y.source,b)},e.toLociWithSourceUnits=function u(y){const b=[],{unitMap:x}=y.source;for(const _ of a(y).units){const S=x.get(_.id);b[b.length]=S===_?{unit:S,indices:Fe.ofBounds(0,S.elements.length)}:{unit:S,indices:Fe.ofSortedArray(je.indicesOf(S.elements,_.elements))}}return De(y.source,b)};class d{add(b){const x=b.elementCount;0!==x&&(this.structures[this.structures.length]=b,1!==x&&(this.allSingletons=!1))}getSelection(){return l(this.source,this.structures,this.allSingletons)}constructor(b){this.source=b,this.structures=[],this.allSingletons=!0}}class f{add(b){const x=b.elementCount;0===x||!this.uniqueSets.add(b)||(this.structures[this.structures.length]=b,1!==x&&(this.allSingletons=!1))}getSelection(){return l(this.structure,this.structures,this.allSingletons)}constructor(b){this.structure=b,this.structures=[],this.allSingletons=!0,this.uniqueSets=CB(Ve.hashCode,Ve.areUnitIdsAndIndicesEqual)}}e.LinearBuilder=function p(y){return new d(y)},e.UniqueBuilder=function m(y){return new f(y)},e.forEach=function h(y,b){let x=0;if(e.isSingleton(y))for(const _ of y.structure.units){const{elements:S}=_;for(let A=0,E=S.length;A2)y.push(g[S],g[A-1]);else for(let E=S;E{const h=[];m.groupedUnits.forEach(g=>h.push(je.ofUnsortedArray(g))),h.sort((g,y)=>g[0]-y[0]),p.push({groupedUnits:h,set:m.set,ranges:m.ranges})}),{hash:l.structure.hashCode,elements:p}}function i(l,d){const f=[];for(let p=0,m=l.length;pue.core.type.list(d))),ranges:ue.core.type.list(l.ranges),set:ue.core.type.list(l.set)})}e.Empty={hash:-1,elements:[]},e.fromSubStructure=function t(l,d){return r(pt.toLociWithSourceUnits(pt.Singletons(l,d)))},e.fromSelection=function n(l){return r(pt.toLociWithSourceUnits(l))},e.fromLoci=r,e.toLoci=function o(l,d){-1!==l.hash&&l.hash!==d.hashCode&&new Error("Bundle not compatible with given structure");const f=[];for(const p of l.elements)for(const m of p.groupedUnits){const h=i(m,d);if(0===h.length)continue;let g;if(0===p.ranges.length)g=p.set;else if(0===p.set.length)if(2===p.ranges.length)g=Ce.ofRange(p.ranges[0],p.ranges[1]);else{const y=new Int32Array(wr.size(p.ranges));wr.forEach(p.ranges,(b,x)=>y[x]=b),g=je.ofSortedArray(y)}else{const y=wr.size(p.ranges),b=new Int32Array(p.set.length+y);wr.forEach(p.ranges,(x,_)=>b[_]=x),b.set(p.set,y),g=je.ofUnsortedArray(b)}for(const y of h)f.push({unit:y,indices:g})}return De(d,f)},e.toStructure=function s(l,d){-1!==l.hash&&l.hash!==d.hashCode&&new Error("Bundle not compatible with given structure");const f=[];for(const p of l.elements)for(const m of p.groupedUnits){const h=i(m,d);if(0===h.length)continue;const g=h[0].elements,y=wr.size(p.ranges),b=p.set.length,x=new Int32Array(b+y);let _;if(0===y){for(let S=0,A=b;Sx[A]=g[S]),_=je.ofSortedArray(x);else if(je.min(p.set)>wr.max(p.ranges)){wr.forEach(p.ranges,(S,A)=>x[A]=g[S]);for(let S=0,A=b;Sje.max(p.set)){for(let S=0,A=b;Sx[A+b]=g[S]),_=je.ofSortedArray(x)}else{wr.forEach(p.ranges,(S,A)=>x[A]=g[S]);for(let S=0,A=b;S0?this.currentAtomicBondStack.pop():void 0}pushCurrentStructure(){this.currentStructure&&this.currentStructureStack.push(this.currentStructure)}popCurrentStructure(){this.currentStructure=this.currentStructureStack.length?this.currentStructureStack.pop():void 0}pushInputStructure(t){this.inputStructureStack.push(this.inputStructure),this.inputStructure=t}popInputStructure(){if(0===this.inputStructureStack.length)throw new Error("Must push before pop.");this.inputStructure=this.inputStructureStack.pop()}throwIfTimedOut(){if(0!==this.timeoutMs&&yi()-this.timeCreated>this.timeoutMs)throw new Error(`The query took too long to execute (> ${this.timeoutMs/1e3}s).`)}tryGetCurrentSelection(){if(!this.currentSelection)throw new Error("The current selection is not assigned.");return this.currentSelection}constructor(t,n){this.currentElementStack=[],this.currentAtomicBondStack=[],this.currentStructureStack=[],this.inputStructureStack=[],this.timeCreated=yi(),this.element=nt.create(void 0),this.currentStructure=void 0,this.atomicBond=new OJ,this.currentSelection=void 0,this.inputStructure=t,this.timeoutMs=n&&n.timeoutMs||0,this.currentSelection=n&&n.currentSelection}}class OJ{constructor(){this.a=nt.create(void 0),this.aIndex=0,this.b=nt.create(void 0),this.bIndex=0,this.type=0,this.order=0,this.key=-1,this.testFn=XB}setStructure(t){this.a.structure=t,this.b.structure=t}setTestFn(t){this.testFn=t||XB}test(t,n){return!!this.testFn(t)||!!n&&(this.swap(),this.testFn(t))}swap(){const t=this.aIndex;this.aIndex=this.bIndex,this.bIndex=t;const n=this.a.unit;this.a.unit=this.b.unit,this.b.unit=n;const r=this.a.element;this.a.element=this.b.element,this.b.element=r}get length(){return nt.distance(this.a,this.b)}}!function(e){e.run=function t(n,r,i){return n(new qu(r,i))}}(LJ||(LJ={}));class KB{add(t){t.elementCount&&(1!==t.elementCount&&(this.allSingletons=!1),this.set.add(t)&&(this.structures[this.structures.length]=t))}getSelection(){return this.allSingletons?pt.Singletons(this.source,m2(this.source,this.structures)):pt.Sequence(this.source,this.structures)}constructor(t){this.source=t,this.set=CB(Ve.hashCode,Ve.areUnitIdsAndIndicesEqual),this.structures=[],this.allSingletons=!0}}class wOe{add(t,n,r){let i=this.builderMap.get(t);i||(i=this.source.subsetBuilder(!0),this.builders[this.builders.length]=i,this.builderMap.set(t,i)),i.addToUnit(n,r)}allSingletons(){for(let t=0,n=this.builders.length;t1)return!1;return!0}singletonSelection(){const t=this.source.subsetBuilder(!0),n=nt.create(this.source);for(let r=0,i=this.builders.length;rpt.Sequence(e.inputStructure,[]),UJ=e=>pt.Singletons(e.inputStructure,e.inputStructure);function AOe(e){return QB({...e,groupBy:t=>Ze.residue.key(t.element)})}function IOe(e){return QB({...e,groupBy:t=>Ze.chain.key(t.element)})}function Jh(e){return!0}function TOe(e){return 0}function QB(e){if(!e||!(e.atomTest||e.residueTest||e.chainTest||e.entityTest||e.unitTest||e.groupBy))return UJ;if(e.atomTest&&!e.residueTest&&!e.chainTest&&!e.entityTest&&!e.unitTest&&!e.groupBy)return function DOe(e){return function(n){const{inputStructure:r}=n,{units:i}=r,o=n.pushCurrentElement(),s=r.subsetBuilder(!0);o.structure=r;for(const a of i){o.unit=a;const c=a.elements;s.beginUnit(a.id);for(let u=0,l=c.length;u0?kr.create():this.currentUnit}addElement(t){kr.add(this.currentUnit,t,t)&&this.elementCount++}commitUnit(){0===this.currentUnit.array.length||this.unitMap.has(this.parentId)||(this.ids[this.ids.length]=this.parentId,this.unitMap.set(this.parentId,this.currentUnit),this.parentId=-1)}getStructure(){if(this.isEmpty)return Ve.Empty;const t=[];Ou(this.ids);const n=nf.UnitEquivalenceBuilder();for(let r=0,i=this.ids.length;r1&&Ou(a);let u=s.getChild(je.ofSortedArray(a));const l=n.add(u.id,u);u!==l&&(u=l.applyOperator(u.id,u.conformation.operator,!0)),t[t.length]=u}return Ve.create(t,{parent:this.parent})}get isEmpty(){return 0===this.elementCount}constructor(t){this.parent=t,this.ids=[],this.unitMap=Lu.Mutable(),this.parentId=-1,this.currentUnit=kr.create(),this.elementCount=0}}function ht(e){return{data:e,position:0,length:e.length,lineNumber:1,tokenStart:0,tokenEnd:0}}var He,Fr;function VJ(e){for(;e.position=e.length)return void(e.tokenType=6);e.tokenStart=e.position,e.tokenEnd=e.position,e.isEscaped=!1;const n=e.data.charCodeAt(e.position);switch(n){case 35:(function UOe(e){for(;e.position=5&&95===e.data.charCodeAt(e.tokenStart+4)?function zOe(e){let t=e.data.charCodeAt(e.tokenStart);return!(68!==t&&100!==t||(t=e.data.charCodeAt(e.tokenStart+1),65!==t&&97!==t)||(t=e.data.charCodeAt(e.tokenStart+2),84!==t&&116!==t)||(t=e.data.charCodeAt(e.tokenStart+3),65!==t&&97!==t))}(e)?0:function GOe(e){let t=e.data.charCodeAt(e.tokenStart);return!(83!==t&&115!==t||(t=e.data.charCodeAt(e.tokenStart+1),65!==t&&97!==t)||(t=e.data.charCodeAt(e.tokenStart+2),86!==t&&118!==t)||(t=e.data.charCodeAt(e.tokenStart+3),69!==t&&101!==t))}(e)?1:function jOe(e){if(e.tokenEnd-e.tokenStart!=5)return!1;let t=e.data.charCodeAt(e.tokenStart);return!(76!==t&&108!==t||(t=e.data.charCodeAt(e.tokenStart+1),79!==t&&111!==t)||(t=e.data.charCodeAt(e.tokenStart+2),79!==t&&111!==t)||(t=e.data.charCodeAt(e.tokenStart+3),80!==t&&112!==t))}(e)?2:3:3}}function em(e){for(HJ(e);5===e.tokenType;)HJ(e)}function hT(){return{categoryNames:[],categoryData:Object.create(null)}}function tO(e,t){const n=Object.create(null);for(const r of e){const i=t[r];n[r]=ss(i.name,i.rowCount,i.fieldNames,i.fields)}return n}function qJ(e,t,n){return bB(e.categoryNames,tO(e.categoryNames,e.categoryData),t,n)}function YOe(e,t){return bB(e.categoryNames,tO(e.categoryNames,e.categoryData),t)}function nO(e,t,n,r,i){if(t in e.categoryData){const o=e.categoryData[t];o.fieldNames.push(...r),Object.assign(o.fields,i)}else e.categoryData[t]={name:t,rowCount:n,fieldNames:r,fields:i},e.categoryNames.push(t)}function XOe(e,t){const n=e.tokenStart,r=GJ(e),i=jJ(e,r),o=Object.create(null),s=[];let a=!0;for(;a;){if(4!==e.tokenType||!qOe(e,n,r)){a=!1;break}const c=eO(e).substring(i.length+1);if(em(e),3!==e.tokenType)return{hasError:!0,errorLine:e.lineNumber,errorMessage:"Expected value."};o[c]=ft.ofTokens({data:e.data,indices:[e.tokenStart,e.tokenEnd],count:1}),s[s.length]=c,em(e)}return nO(t,i.substr(1),1,s,o),{hasError:!1,errorLine:0,errorMessage:""}}function KOe(e,t){const{tokenizer:n,tokens:r,fieldCount:i}=t;let o=t.tokenCount,s=0;for(;3===n.tokenType&&s0&&n.push(qJ(o,i,s)),i=e.substring(r.tokenStart+5,r.tokenEnd),o=hT(),s=[],em(r)}else if(1===l){if(r.tokenEnd-r.tokenStart==5)a.categoryNames.length>0&&(s[s.length]=YOe(a,u)),r.inSaveFrame=!1;else{if(r.inSaveFrame)return Zb(r.lineNumber,"Save frames cannot be nested.");r.inSaveFrame=!0,u=e.substring(r.tokenStart+5,r.tokenEnd),a=hT()}em(r)}else if(2===l){const d=yield QOe(r,r.inSaveFrame?a:o);if(d.hasError)return Zb(d.errorLine,d.errorMessage)}else{if(4!==l)return console.log(r.tokenType,ht.getTokenString(r)),Zb(r.lineNumber,"Unexpected token. Expected data_, loop_, or data name.");{const d=XOe(r,r.inSaveFrame?a:o);if(d.hasError)return Zb(d.errorLine,d.errorMessage)}}}return r.inSaveFrame?Zb(r.lineNumber,`Unfinished save frame (${c.header}).`):((o.categoryNames.length>0||s.length>0)&&n.push(qJ(o,i,s)),function JOe(e){return Fr.success(e)}(bQ(n)))}),iO.apply(this,arguments)}function WJ(e){return Oe.create("Parse CIF",function(){var t=ie(function*(n){return yield function e4e(e,t){return iO.apply(this,arguments)}(e,n)});return function(n){return t.apply(this,arguments)}}())}function $J(e){return gT({buffer:e,offset:0,dataView:new DataView(e.buffer)})}function oO(e,t){const n={};for(let r=0;rr.name),getField(r){const i=t[r];if(i)return n[r]||(n[r]=function t4e(e){const t=e.mask?rT(e.mask):void 0,n=rT(e.data),r=WF(n),i=r?t?u=>0===t[u]?""+n[u]:"":u=>""+n[u]:t?u=>0===t[u]?n[u]:"":u=>n[u],o=r?u=>n[u]:u=>{const l=n[u];return jh(l,0,l.length)},s=r?u=>n[u]:u=>{const l=n[u];return rp(l,0,l.length)},c=n.length;return{__array:n,binaryEncoding:e.data.encoding,isDefined:!0,rowCount:c,str:i,int:o,float:s,valueKind:t?u=>t[u]:u=>0,areValuesEqual:(u,l)=>n[u]===n[l],toStringArray:u=>Ps(c,i,u),toIntArray:r?u=>PI(n,u):u=>Ps(c,o,u),toFloatArray:r?u=>PI(n,u):u=>Ps(c,s,u)}}(i)),n[r]}}}function YJ(e){return Oe.create("Parse BinaryCIF",function(){var t=ie(function*(n){const r=[0,3];try{const i=$J(e);if(!function n4e(e,t){for(let n=0;n<2;n++)if(e[n]>t[n])return!1;return!0}(r,i.version.match(/(\d)\.(\d)\.\d/).slice(1).map(s=>+s)))return Fr.error(`Unsupported format version. Current ${i.version}, required ${r.join(".")}.`);const o=bQ(i.dataBlocks.map(s=>{const a=Object.create(null);for(const c of s.categories)a[c.name.substr(1)]=r4e(c);return bB(s.categories.map(c=>c.name.substr(1)),a,s.header)}));return Fr.success(o)}catch(i){return Fr.error(""+i)}});return function(n){return t.apply(this,arguments)}}())}!function(e){function t(_){return _.data.substring(_.tokenStart,_.tokenEnd)}function r(_){const{data:S}=_;for(;_.position<_.length;)switch(S.charCodeAt(_.position)){case 10:return _.tokenEnd=_.position,++_.position,++_.lineNumber,!0;case 13:return _.tokenEnd=_.position,++_.position,++_.lineNumber,10===S.charCodeAt(_.position)&&++_.position,!0;default:++_.position}return _.tokenEnd=_.position,_.tokenStart!==_.tokenEnd}function o(_){return _.tokenStart=_.position,r(_)}function c(_,S,A){let E=0;for(let w=0;w{const T=Math.min(S-D,I);return c(R,T,w),D+=T,T},(I,R)=>I.update({message:"Parsing...",current:R.position,max:R.length})),w})).apply(this,arguments)}function g(){return(g=ie(function*(_,S,A=1e5){const E=e(_),w=He.create(E.data,Math.max(_.length/80,2));return yield op(S,A,E,(D,I)=>(function m(_,S,A){let E=0;for(let w=0;wD.update({message:"Parsing...",current:I.position,max:I.length})),w})).apply(this,arguments)}function x(_,S,A){const{data:E}=_;let w=S,D=A-1,I=E.charCodeAt(w);for(;(9===I||32===I)&&w<=D;)I=E.charCodeAt(++w);for(I=E.charCodeAt(D);(9===I||32===I)&&D>=w;)I=E.charCodeAt(--D);return _.tokenStart=w,_.tokenEnd=D+1,_.position=A,_}e.getTokenString=t,e.reset=function n(_){_.position=0,_.lineNumber=1,_.tokenStart=0,_.tokenEnd=0},e.eatLine=r,e.markStart=function i(_){_.tokenStart=_.position},e.markLine=o,e.readLine=function s(_){return o(_),t(_)},e.readLineTrim=function a(_){o(_);const S=_.position;return x(_,_.tokenStart,_.tokenEnd),_.position=S,t(_)},e.markLines=function u(_,S){const A=He.create(_.data,2*S);return c(_,S,A),A},e.readLines=function l(_,S){const A=[];for(let E=0;Eu.indicesLenMinus2&&function t(s){const a=new Uint32Array(1.61*s.indices.length|0);a.set(s.indices),s.indices=a,s.indicesLenMinus2=a.length-2|0}(u),u.indices[u.offset++]=a,u.indices[u.offset++]=c,s.count++}e.add=n,e.addToken=function r(s,a){n(s,a.tokenStart,a.tokenEnd)},e.addUnchecked=function i(s,a,c){s.indices[s.offset++]=a,s.indices[s.offset++]=c,s.count++},e.create=function o(s,a){return{data:s,indicesLenMinus2:(a=Math.max(10,a))-2|0,count:0,offset:0,indices:new Uint32Array(a)}}}(He||(He={})),function(e){e.error=function t(o,s=-1){return new r(o,s)},e.success=function n(o,s=[]){return new i(o,s)};class r{toString(){return this.line>=0?`[Line ${this.line}] ${this.message}`:this.message}constructor(s,a){this.message=s,this.line=a,this.isError=!0}}e.Error=r;class i{constructor(s,a){this.result=s,this.warnings=a,this.isError=!1}}e.Success=i}(Fr||(Fr={}));var zg=te.Schema;const qr=zg.str,XJ=zg.List,Jd=zg.lstr,pu=zg.Aliased,g2=zg.int,Qb=zg.coord,o4e={chem_comp:{formula:qr,formula_weight:zg.float,id:qr,mon_nstd_parent_comp_id:XJ(",",e=>e),name:qr,one_letter_code:qr,three_letter_code:qr,type:pu(Jd),pdbx_synonyms:XJ(";",e=>e),pdbx_type:qr,pdbx_ambiguous_flag:qr,pdbx_replaced_by:qr,pdbx_replaces:qr,pdbx_formal_charge:g2,pdbx_model_coordinates_details:qr,pdbx_model_coordinates_db_code:qr,pdbx_ideal_coordinates_details:qr,pdbx_ideal_coordinates_missing_flag:pu(Jd),pdbx_model_coordinates_missing_flag:pu(Jd),pdbx_initial_date:qr,pdbx_modified_date:qr,pdbx_release_status:pu(qr),pdbx_processing_site:pu(qr)},chem_comp_atom:{alt_atom_id:qr,atom_id:qr,charge:g2,model_Cartn_x:Qb,model_Cartn_y:Qb,model_Cartn_z:Qb,comp_id:qr,type_symbol:qr,pdbx_align:g2,pdbx_ordinal:g2,pdbx_model_Cartn_x_ideal:Qb,pdbx_model_Cartn_y_ideal:Qb,pdbx_model_Cartn_z_ideal:Qb,pdbx_stereo_config:pu(Jd),pdbx_aromatic_flag:pu(Jd),pdbx_leaving_atom_flag:pu(Jd)},chem_comp_bond:{atom_id_1:qr,atom_id_2:qr,comp_id:qr,value_order:pu(Jd),pdbx_ordinal:g2,pdbx_stereo_config:pu(Jd),pdbx_aromatic_flag:pu(Jd)},pdbx_chem_comp_descriptor:{comp_id:qr,descriptor:qr,type:pu(Jd),program:qr,program_version:qr},pdbx_chem_comp_identifier:{comp_id:qr,identifier:qr,type:pu(qr),program:qr,program_version:qr}};var y2=te.Schema;const mn=y2.str,hp=y2.lstr,Xa=y2.Aliased,Wu=y2.int,a4e={pdbx_reference_molecule:{prd_id:mn,formula_weight:y2.float,formula:mn,type:Xa(hp),type_evidence_code:mn,class:Xa(hp),class_evidence_code:mn,name:mn,represent_as:Xa(hp),chem_comp_id:mn,compound_details:mn,description:mn,representative_PDB_id_code:mn,release_status:Xa(hp),replaces:mn,replaced_by:mn},pdbx_reference_entity_list:{prd_id:mn,ref_entity_id:mn,type:Xa(hp),details:mn,component_id:Wu},pdbx_reference_entity_nonpoly:{prd_id:mn,ref_entity_id:mn,name:mn,chem_comp_id:mn},pdbx_reference_entity_link:{link_id:Wu,prd_id:mn,details:mn,ref_entity_id_1:mn,ref_entity_id_2:mn,entity_seq_num_1:Wu,entity_seq_num_2:Wu,comp_id_1:mn,comp_id_2:mn,atom_id_1:mn,atom_id_2:mn,value_order:Xa(hp),component_1:Wu,component_2:Wu,link_class:Xa(mn)},pdbx_reference_entity_poly_link:{link_id:Wu,prd_id:mn,ref_entity_id:mn,component_id:Wu,entity_seq_num_1:Wu,entity_seq_num_2:Wu,comp_id_1:mn,comp_id_2:mn,atom_id_1:mn,atom_id_2:mn,value_order:Xa(hp)},pdbx_reference_entity_poly:{prd_id:mn,ref_entity_id:mn,type:Xa(mn),db_code:mn,db_name:mn},pdbx_reference_entity_poly_seq:{prd_id:mn,ref_entity_id:mn,mon_id:mn,parent_mon_id:mn,num:Wu,observed:Xa(hp),hetero:Xa(hp)},pdbx_reference_entity_sequence:{prd_id:mn,ref_entity_id:mn,type:Xa(mn),NRP_flag:Xa(mn),one_letter_codes:mn},pdbx_reference_entity_src_nat:{prd_id:mn,ref_entity_id:mn,ordinal:Wu,organism_scientific:mn,taxid:mn,db_code:mn,db_name:mn},pdbx_prd_audit:{prd_id:mn,date:mn,processing_site:Xa(mn),action_type:Xa(mn)}};var KJ=te.Schema;const Eo=KJ.str,u4e={datablock:{id:Eo,description:Eo},dictionary:{title:Eo,datablock_id:Eo,version:Eo},dictionary_history:{version:Eo,update:Eo,revision:Eo},sub_category:{id:Eo,description:Eo},category_group_list:{id:Eo,parent_id:Eo,description:Eo},item_type_list:{code:Eo,primitive_code:Eo,construct:Eo,detail:Eo},item_units_list:{code:Eo,detail:Eo},item_units_conversion:{from_code:Eo,to_code:Eo,operator:Eo,factor:KJ.float}};var b2=te.Schema;const ef=b2.str,yT=b2.int,mp=b2.float,bT=b2.Aliased,tm=b2.Vector,ZJ=(bT(ef),bT(ef),bT(ef),bT(ef),tm(3),tm(3),{volume_data_3d_info:{name:ef,axis_order:tm(3,yT),origin:tm(3),dimensions:tm(3),sample_rate:yT,sample_count:tm(3,yT),spacegroup_number:yT,spacegroup_cell_size:tm(3),spacegroup_cell_angles:tm(3),mean_source:mp,mean_sampled:mp,sigma_source:mp,sigma_sampled:mp,min_source:mp,min_sampled:mp,max_source:mp,max_sampled:mp},volume_data_3d:{values:mp}});var vT=te.Schema;const ro=vT.float,cO=vT.int,ti=vT.str,d4e={cell:{angle_alpha:ro,angle_beta:ro,angle_gamma:ro,formula_units_z:cO,length_a:ro,length_b:ro,length_c:ro,volume:ro},chemical:{melting_point:ro,name_common:ti,name_systematic:ti},chemical_formula:{moiety:ti,sum:ti,weight:ro},space_group:{crystal_system:ti,it_number:cO,"name_h-m_full":ti},space_group_symop:{operation_xyz:ti},geom_bond:{atom_site_label_1:ti,atom_site_label_2:ti,distance:ro,publ_flag:ti,site_symmetry_1:ti,site_symmetry_2:ti,valence:ro},audit:{block_doi:ti},database_code:{cod:ti,csd:ti,depnum_ccdc_archive:ti,depnum_ccdc_fiz:ti,icsd:ti,mdf:ti,nbs:ti},atom_site:{adp_type:ti,calc_flag:ti,disorder_assembly:ti,disorder_group:ti,fract_x:ro,fract_y:ro,fract_z:ro,label:ti,occupancy:ro,refinement_flags:ti,site_symmetry_multiplicity:cO,type_symbol:ti,u_iso_or_equiv:ro},atom_site_aniso:{label:ti,u_11:ro,u:(0,vT.Matrix)(3,3),u_12:ro,u_13:ro,u_22:ro,u_23:ro,u_33:ro},atom_type:{description:ti,symbol:ti},atom_type_scat:{dispersion_imag:ro,dispersion_real:ro,source:ti}},f4e={"cell.formula_units_z":["cell_formula_units_Z"],"space_group.it_number":["space_group_IT_number","symmetry_Int_Tables_number"],"space_group.name_h-m_full":["symmetry_space_group_name_H-M"],"space_group_symop.operation_xyz":["symmetry_equiv_pos_as_xyz"],"geom_bond.atom_site_label_1":["geom_bond_atom_site_id_1"],"geom_bond.atom_site_label_2":["geom_bond_atom_site_id_2"],"geom_bond.distance":["geom_bond_dist"],"audit.block_doi":["audit_block_DOI"],"database_code.cod":["database_code_COD"],"database_code.csd":["database_code_CSD"],"database_code.depnum_ccdc_archive":["database_code_depnum_CCDC_archive"],"database_code.depnum_ccdc_fiz":["database_code_depnum_CCDC_fiz"],"database_code.icsd":["database_code_ICSD"],"database_code.mdf":["database_code_MDF"],"database_code.nbs":["database_code_NBS"],"atom_site.adp_type":["atom_site_ADP_type","atom_site_thermal_displace_type"],"atom_site.label":["atom_site_id"],"atom_site.site_symmetry_multiplicity":["atom_site_symmetry_multiplicity"],"atom_site.u_iso_or_equiv":["atom_site_U_iso_or_equiv"],"atom_site_aniso.label":["atom_site_anisotrop_id"],"atom_site_aniso.u_11":["atom_site_aniso_U_11","atom_site_anisotrop_U_11"],"atom_site_aniso.u_12":["atom_site_aniso_U_12","atom_site_anisotrop_U_12"],"atom_site_aniso.u_13":["atom_site_aniso_U_13","atom_site_anisotrop_U_13"],"atom_site_aniso.u_22":["atom_site_aniso_U_22","atom_site_anisotrop_U_22"],"atom_site_aniso.u_23":["atom_site_aniso_U_23","atom_site_anisotrop_U_23"],"atom_site_aniso.u_33":["atom_site_aniso_U_33","atom_site_anisotrop_U_33"]},uO=te.Schema.int,h4e={volume_data_3d_info:ZJ.volume_data_3d_info,segmentation_data_table:{set_id:uO,segment_id:uO},segmentation_data_3d:{values:uO}},od={parse:e=>"string"==typeof e?WJ(e):YJ(e),parseText:WJ,parseBinary:YJ,toDatabaseCollection:function Ike(e,t,n){const r={};for(const i of t.blocks)r[i.header]=Zd(e,i,n);return r},toDatabase:Zd,schema:{mmCIF:e=>Zd(On,e),CCD:e=>Zd(o4e,e),BIRD:e=>Zd(a4e,e),dic:e=>Zd(u4e,e),cifCore:e=>Zd(d4e,e,f4e),densityServer:e=>Zd(ZJ,e),segmentation:e=>Zd(h4e,e)}},m4e={type_symbol:te.Schema.Aliased(On.atom_site.type_symbol),label_atom_id:On.atom_site.label_atom_id,auth_atom_id:On.atom_site.auth_atom_id,label_alt_id:On.atom_site.label_alt_id,label_comp_id:On.atom_site.label_comp_id,auth_comp_id:On.atom_site.auth_comp_id,pdbx_formal_charge:On.atom_site.pdbx_formal_charge},g4e={group_PDB:On.atom_site.group_PDB,label_seq_id:On.atom_site.label_seq_id,auth_seq_id:On.atom_site.auth_seq_id,pdbx_PDB_ins_code:On.atom_site.pdbx_PDB_ins_code},y4e={label_asym_id:On.atom_site.label_asym_id,auth_asym_id:On.atom_site.auth_asym_id,label_entity_id:On.atom_site.label_entity_id};var lO,Gg;!function(e){e.EmptyResidueKey=function t(){return{label_entity_id:"",label_asym_id:"",auth_seq_id:0,pdbx_PDB_ins_code:void 0}}}(lO||(lO={})),function(e){function t(i,o){return i.residueAtomSegments.index[i.chainAtomSegments.offsets[o]]}function n(i,o){return i.residueAtomSegments.index[i.chainAtomSegments.offsets[o+1]-1]+1}e.chainStartResidueIndex=t,e.chainEndResidueIndexExcl=n,e.chainResidueCount=function r(i,o){return n(i,o)-t(i,o)}}(Gg||(Gg={}));const _T={H:1,D:1,T:1,HE:2,LI:3,BE:4,B:5,C:6,N:7,O:8,F:9,NE:10,NA:11,MG:12,AL:13,SI:14,P:15,S:16,CL:17,AR:18,K:19,CA:20,SC:21,TI:22,V:23,CR:24,MN:25,FE:26,CO:27,NI:28,CU:29,ZN:30,GA:31,GE:32,AS:33,SE:34,BR:35,KR:36,RB:37,SR:38,Y:39,ZR:40,NB:41,MO:42,TC:43,RU:44,RH:45,PD:46,AG:47,CD:48,IN:49,SN:50,SB:51,TE:52,I:53,XE:54,CS:55,BA:56,LA:57,CE:58,PR:59,ND:60,PM:61,SM:62,EU:63,GD:64,TB:65,DY:66,HO:67,ER:68,TM:69,YB:70,LU:71,HF:72,TA:73,W:74,RE:75,OS:76,IR:77,PT:78,AU:79,HG:80,TL:81,PB:82,BI:83,PO:84,AT:85,RN:86,FR:87,RA:88,AC:89,TH:90,PA:91,U:92,NP:93,PU:94,AM:95,CM:96,BK:97,CF:98,ES:99,FM:100,MD:101,NO:102,LR:103,RF:104,DB:105,SG:106,BH:107,HS:108,MT:109},b4e={1:1.1,2:1.4,3:1.81,4:1.53,5:1.92,6:1.7,7:1.55,8:1.52,9:1.47,10:1.54,11:2.27,12:1.73,13:1.84,14:2.1,15:1.8,16:1.8,17:1.75,18:1.88,19:2.75,20:2.31,21:2.3,22:2.15,23:2.05,24:2.05,25:2.05,26:2.05,27:2,28:2,29:2,30:2.1,31:1.87,32:2.11,33:1.85,34:1.9,35:1.83,36:2.02,37:3.03,38:2.49,39:2.4,40:2.3,41:2.15,42:2.1,43:2.05,44:2.05,45:2,46:2.05,47:2.1,48:2.2,49:2.2,50:1.93,51:2.17,52:2.06,53:1.98,54:2.16,55:3.43,56:2.68,57:2.5,58:2.48,59:2.47,60:2.45,61:2.43,62:2.42,63:2.4,64:2.38,65:2.37,66:2.35,67:2.33,68:2.32,69:2.3,70:2.28,71:2.27,72:2.25,73:2.2,74:2.1,75:2.05,76:2,77:2,78:2.05,79:2.1,80:2.05,81:1.96,82:2.02,83:2.07,84:1.97,85:2.02,86:2.2,87:3.48,88:2.83,89:2,90:2.4,91:2,92:2.3,93:2,94:2,95:2,96:2,97:2,98:2,99:2,100:2,101:2,102:2,103:2,104:2,105:2,106:2,107:2,108:2,109:2},v4e={1:1.008,2:4.0026,3:6.94,4:9.0122,5:10.81,6:10.81,7:14.007,8:15.999,9:18.998,10:20.18,11:22.99,12:24.305,13:26.982,14:28.085,15:30.974,16:32.06,17:35.45,18:39.948,19:39.098,20:40.078,21:44.956,22:47.867,23:50.942,24:51.996,25:54.938,26:55.845,27:58.933,28:58.693,29:63.546,30:65.38,31:69.723,32:72.63,33:74.922,34:78.971,35:79.904,36:83.798,37:85.468,38:87.62,39:88.906,40:91.224,41:92.906,42:95.95,43:96.906,44:101.07,45:102.91,46:106.42,47:107.87,48:112.41,49:114.82,50:118.71,51:121.76,52:127.6,53:127.6,54:131.29,55:132.91,56:137.33,57:138.91,58:140.12,59:140.91,60:144.24,61:144.912,62:150.36,63:151.96,64:157.25,65:158.93,66:162.5,67:164.93,68:167.26,69:168.93,70:173.05,71:174.97,72:178.49,73:180.95,74:183.84,75:186.21,76:190.23,77:192.22,78:195.08,79:196.97,80:200.59,81:204.38,82:207.2,83:208.98,84:1.97,85:2.02,86:2.2,87:3.48,88:2.83,89:2,90:232.04,91:231.04,92:238.03,93:237.048,94:244.064,95:243.061,96:247.07,97:247.07,98:251.079,99:252.083,100:257.095,101:258.098,102:259.101,103:262.11,104:267.122,105:270.131,106:271.134,107:270.133,108:270.134,109:278.156},_4e=1.7,S4e=0;function v2(e){const t=_T[e];return void 0===t?_4e:b4e[t]}function _2(e){const t=_T[e];return void 0===t?S4e:t}function QJ(e,t,n,r){return{type:e,key:t,elements:n,getIndex:r}}var jg;function T4e(e,t,n,r,i,o){const{auth_seq_id:s,label_seq_id:a,pdbx_PDB_ins_code:c}=e.residues,{endSeqId:u,endInsCode:l,key:d,type:f}=n,p="label"===t?a:s;let m=r;for(;mu||h===u&&c.value(m)===l)break;m++}}!function(e){e.Descriptor={name:"model_secondary_structure"},e.Provider=td.create(e.Descriptor),e.fromStruct=function t(n,r,i){const o=new Map,s=[{kind:"none"}],a=function w4e(e,t){if(e._rowCount>0){if(0!==e.beg_label_seq_id.valueKind(0)||0!==e.end_label_seq_id.valueKind(0))return"auth"}else if(t&&(0!==t.beg_label_seq_id.valueKind(0)||0!==t.end_label_seq_id.valueKind(0)))return"auth";return"label"}(n,r);(function A4e(e,t,n,r){if(!e._rowCount)return;const{beg_label_asym_id:i,beg_label_seq_id:o,beg_auth_seq_id:s,pdbx_beg_PDB_ins_code:a}=e,{end_label_seq_id:c,end_auth_seq_id:u,pdbx_end_PDB_ins_code:l}=e,{pdbx_PDB_helix_class:d,conf_type_id:f,details:p}=e,m="label"===t?o:s,h="label"===t?c:u;for(let g=0,y=e._rowCount;g0&&function D4e(e,t,n,r){const{count:i}=e.chainAtomSegments,{label_asym_id:o}=e.chains,{auth_seq_id:s,label_seq_id:a,pdbx_PDB_ins_code:c}=e.residues,u="label"===t?a:s;for(let l=0;ld)}}(jg||(jg={}));const E4e={U:On.atom_site_anisotrop.U,U_esd:On.atom_site_anisotrop.U_esd};var tf,Hg;!function(e){e.Schema=E4e,e.Descriptor={name:"atom_site_anisotrop",cifExport:{prefix:"",categories:[{name:"atom_site_anisotrop",instance:r=>e.Provider.get(r.firstModel)&&Er.is(r.firstModel.sourceData)?Bi.Category.ofTable(r.firstModel.sourceData.data.db.atom_site_anisotrop):Bi.Category.Empty}]}},e.Provider=td.create(e.Descriptor),e.getElementToAnsiotrop=function t(r,i){const o=new Int32Array(r.rowCount);o.fill(-1);for(let a=0,c=r.rowCount;a0},e.writeMmCif=function s(a,c){a.writeCategory({name:t,instance(){const u=Xn.ofRows(e.Schema.molstar_global_model_transform_info,[{matrix:c}]);return Bi.Category.ofTable(u)}})}}(Hg||(Hg={})),te.Schema.Str();const P4e={...On.chem_comp,type:te.Schema.Aliased(te.Schema.str)};function M4e(e,t){const{ihm_model_group:n,ihm_model_group_link:r}=t,i=Xn.pickRow(r,o=>r.model_id.value(o)===e);if(i){const o=Xn.pickRow(n,s=>n.id.value(s)===i.group_id);if(o)return o.name}return""}function JJ(e){for(let t=0,n=e.rowCount;tthis.namesMap.set(n[0],n[1]))}}const k4e=[new Set(["CA"]),new Set(["C"]),new Set(["N"])],N4e=[new Set(["P","O3'","O3*"]),new Set(["C4'","C4*"]),new Set(["O2'","O2*","F2'","F2*"])],F4e=[new Set(["P","O3'","O3*"]),new Set(["C3'","C3*"]),new Set(["O2'","O2*","F2'","F2*"])],B4e=new Set(["FMN","NCN","FNS","FMA","ATP","ADP","AMP","GTP","GDP","GMP","LIG"]),eee=function(){const e=new Map;return[{id:"HIS",name:"HISTIDINE",type:"l-peptide linking"},{id:"ARG",name:"ARGININE",type:"l-peptide linking"},{id:"LYS",name:"LYSINE",type:"l-peptide linking"},{id:"ILE",name:"ISOLEUCINE",type:"l-peptide linking"},{id:"PHE",name:"PHENYLALANINE",type:"l-peptide linking"},{id:"LEU",name:"LEUCINE",type:"l-peptide linking"},{id:"TRP",name:"TRYPTOPHAN",type:"l-peptide linking"},{id:"ALA",name:"ALANINE",type:"l-peptide linking"},{id:"MET",name:"METHIONINE",type:"l-peptide linking"},{id:"CYS",name:"CYSTEINE",type:"l-peptide linking"},{id:"ASN",name:"ASPARAGINE",type:"l-peptide linking"},{id:"VAL",name:"VALINE",type:"l-peptide linking"},{id:"GLY",name:"GLYCINE",type:"peptide linking"},{id:"SER",name:"SERINE",type:"l-peptide linking"},{id:"GLN",name:"GLUTAMINE",type:"l-peptide linking"},{id:"TYR",name:"TYROSINE",type:"l-peptide linking"},{id:"ASP",name:"ASPARTIC ACID",type:"l-peptide linking"},{id:"GLU",name:"GLUTAMIC ACID",type:"l-peptide linking"},{id:"THR",name:"THREONINE",type:"l-peptide linking"},{id:"PRO",name:"PROLINE",type:"l-peptide linking"},{id:"SEC",name:"SELENOCYSTEINE",type:"l-peptide linking"},{id:"PYL",name:"PYRROLYSINE",type:"l-peptide linking"},{id:"MSE",name:"SELENOMETHIONINE",type:"l-peptide linking"},{id:"SEP",name:"PHOSPHOSERINE",type:"l-peptide linking"},{id:"TPO",name:"PHOSPHOTHREONINE",type:"l-peptide linking"},{id:"PTR",name:"O-PHOSPHOTYROSINE",type:"l-peptide linking"},{id:"PCA",name:"PYROGLUTAMIC ACID",type:"l-peptide linking"},{id:"A",name:"ADENOSINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"C",name:"CYTIDINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"T",name:"THYMIDINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"G",name:"GUANOSINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"I",name:"INOSINIC ACID",type:"rna linking"},{id:"U",name:"URIDINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"DA",name:"2'-DEOXYADENOSINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DC",name:"2'-DEOXYCYTIDINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DT",name:"THYMIDINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DG",name:"2'-DEOXYGUANOSINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DI",name:"2'-DEOXYINOSINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DU",name:"2'-DEOXYURIDINE-5'-MONOPHOSPHATE",type:"dna linking"}].forEach(n=>e.set(n.id,n)),e}(),tee=function(){const e=new Map;return[{id:"ZN2",name:"ZINC ION",type:"ion"},{id:"SOD",name:"SODIUM ION",type:"ion"},{id:"CES",name:"CESIUM ION",type:"ion"},{id:"CLA",name:"CHLORIDE ION",type:"ion"},{id:"CAL",name:"CALCIUM ION",type:"ion"},{id:"POT",name:"POTASSIUM ION",type:"ion"}].forEach(n=>e.set(n.id,n)),e}();class ad{set(t){this.comps.set(t.id,t),this.ids.push(t.id),this.names.push(t.name),this.types.push(t.type),this.mon_nstd_flags.push($b.has(t.id)?"y":"n")}getAtomIds(t){const n=new Set,r=this.seqId.value(t);for(;tthis.namesMap.set(n[0],n[1]))}constructor(t,n){this.seqId=t,this.atomId=n,this.namesMap=new Map,this.comps=new Map,this.ids=[],this.names=[],this.types=[],this.mon_nstd_flags=[]}}var Er,x2;function dO(e,t){const n=Er.fromFrame(e,void 0,void 0,t),r=$u(n.data.db,!0);return Oe.create("Create mmCIF Model",i=>af(r,n,i))}function fO(){return fO=ie(function*(e,t,n){const r=yield nee(e,t,{coordinateType:"ideal",cartn_x:"pdbx_model_Cartn_x_ideal",cartn_y:"pdbx_model_Cartn_y_ideal",cartn_z:"pdbx_model_Cartn_z_ideal"},n),i=yield nee(e,t,{coordinateType:"model",cartn_x:"model_Cartn_x",cartn_y:"model_Cartn_y",cartn_z:"model_Cartn_z"},n),o=[];r&&o.push(r),i&&o.push(i);for(let s=0,a=o.length;s0||(x[x.length]=O);const _=x.length,S=te.ofConst("A",_,te.Schema.str),A=te.ofConst(1,_,te.Schema.int),E=te.ofConst("1",_,te.Schema.str),w=te.ofConst(1,_,te.Schema.float),D=te.ofConst(1,_,te.Schema.int),I=te.view(p,x),R=te.view(h,x),T=te.view(o[c],x),M=te.view(o[u],x),N=te.view(o[l],x),V=te.view(g,x),F=te.view(y,x),G=te.view(m,x),L=Xn.ofPartialColumns(ks.atom_site,{auth_asym_id:S,auth_atom_id:I,auth_comp_id:R,auth_seq_id:A,Cartn_x:T,Cartn_y:M,Cartn_z:N,id:V,label_asym_id:S,label_atom_id:I,label_comp_id:R,label_seq_id:A,label_entity_id:E,occupancy:w,type_symbol:F,pdbx_PDB_model_num:D,pdbx_formal_charge:G},_),z=new sd;z.setNames([[f,`${d} (${a})`]]),z.getEntityId(f,0,"A");const j=new ad(A,y);j.setNames([[f,`${d} (${a})`]]),j.add(f,0);const Z=$u({entity:z.getEntityTable(),chem_comp:j.getChemCompTable(),atom_site:L}),$=yield af(Z,t,r);if(!$.representative)return;const ee=$.representative,q=Ug.getEntriesFromChemCompBond(s);return Ug.Provider.set(ee,{data:s,entries:q}),x2.CoordinateType.set(ee,a),$.representative}),pO.apply(this,arguments)}no.Provider.formatRegistry.add("mmCIF",function O4e(e){if(Er.is(e.sourceData))return no.fromData(e.sourceData.data.db)}),jg.Provider.formatRegistry.add("mmCIF",function L4e(e){if(!Er.is(e.sourceData))return;const{struct_conf:t,struct_sheet_range:n}=e.sourceData.data.db;return jg.fromStruct(t,n,e.atomicHierarchy)}),tf.Provider.formatRegistry.add("mmCIF",function U4e(e){if(!Er.is(e.sourceData))return;const{atom_site_anisotrop:t}=e.sourceData.data.db;return{data:Xn.ofColumns(tf.Schema,t),elementToAnsiotrop:tf.getElementToAnsiotrop(e.atomicConformation.atomId,t.id)}},function V4e(e){return!!Er.is(e.sourceData)&&e.sourceData.data.db.atom_site_anisotrop.U.isDefined}),Ug.Provider.formatRegistry.add("mmCIF",function z4e(e){if(!Er.is(e.sourceData))return;const{chem_comp_bond:t}=e.sourceData.data.db;return 0!==t._rowCount?{data:t,entries:Ug.getEntriesFromChemCompBond(t)}:void 0}),du.Provider.formatRegistry.add("mmCIF",function G4e(e){if(!Er.is(e.sourceData))return;const{struct_conn:t}=e.sourceData.data.db;if(0===t._rowCount)return;const n=du.getEntriesFromStructConn(t,e);return{data:t,byAtomIndex:du.getAtomIndexFromEntries(n),entries:n}}),Hg.Provider.formatRegistry.add("mmCIF",Hg.fromMmCif,Hg.hasData),function(e){e.is=function t(r){return"mmCIF"===r?.kind},e.fromFrame=function n(r,i,o,s){return i||(i=od.schema.mmCIF(r)),{kind:"mmCIF",name:i._name,data:{db:i,file:s,frame:r,source:o}}}}(Er||(Er={})),function(e){const t="__CcdCoordinateType__";e.CoordinateType={get:i=>i._staticPropertyData[t],set:(i,o)=>i._staticPropertyData[t]=o},e.is=function n(i){return"CCD"===i?.kind},e.fromFrame=function r(i,o){return o||(o=od.schema.CCD(i)),{kind:"CCD",name:o._name,data:{db:o,frame:i}}}}(x2||(x2={}));const qg=typeof process<"u"&&null!=process.versions&&null!=process.versions.node,S2=function q4e(){return typeof XMLHttpRequest>"u"||qg?Fn(684):XMLHttpRequest}(),hO=function W4e(){if(typeof File>"u"||qg){class e{arrayBuffer(){return this.blob.arrayBuffer()}slice(n,r,i){return this.blob.slice(n,r,i)}stream(){return this.blob.stream()}text(){return this.blob.text()}constructor(n,r,i){var o;this.blob=new Blob(n,i),this.size=this.blob.size,this.type=this.blob.type,this.name=r,this.lastModified=null!==(o=i?.lastModified)&&void 0!==o?o:0,this.webkitRelativePath=""}}return e}return File}();function gp(e,t){return e[t]|e[t+1]<<8}function Wg(e,t,n){e[t]=255&n,e[t+1]=n>>8&255}function $g(e,t){return 16777216*e[t+3]+(e[t+2]<<16|e[t+1]<<8|e[t])}function yp(e,t,n){e[t]=255&n,e[t+1]=n>>8&255,e[t+2]=n>>16&255,e[t+3]=n>>24&255}function X4e(e){return e.length<2?"0"+e:e}function ree(e){const t=e.length;let n=0;for(let r=0;r>>1:n>>>=1;e[t]=n}return e}();function iee(e,t,n){return 4294967295^function J4e(e,t,n,r){for(let i=0;i>>8;return e}(4294967295,e,t,n)}const mt=function(){const e=Uint16Array,t=Uint32Array;return{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new t(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new t(286),dhst:new t(30),ihst:new t(19),lits:new t(15e3),strt:new e(65536),prev:new e(32768)}}();function C2(e,t,n){const r=e.length,i=mt.rev15;for(let o=0;o>1<<4|a,u=t-a;let l=e[o]<>>15-t]=c,l++}}function nm(e,t){const n=e.length,r=mt.bl_count;for(let s=0;s<=t;s++)r[s]=0;for(let s=1;s>>r}function tLe(e,t){const{data:n,noBuf:r}=e;let{buf:i,BFINAL:o,off:s,pos:a}=e,c=0;for(;0===o&&cy&&(y=S)}a+=3*g,nm(mt.itree,y),C2(mt.itree,y,mt.imap),u=mt.lmap,l=mt.dmap,a=rLe(mt.imap,(1<>>4;if(h>>>8){if(256===h)break;{let g=s+h-254;if(h>264){const S=mt.ldef[h-257];g=s+(S>>>3)+rm(n,a,7&S),a+=7&S}const y=l[bO(n,a)&f];a+=15&y;const x=mt.ddef[y>>>4],_=(x>>>4)+yO(n,a,15&x);for(a+=15&x,r&&(i=gO(i,s+(1<<17)));s>>3),h=n[m-4]|n[m-3]<<8;r&&(i=gO(i,s+h)),i.set(new Uint8Array(n.buffer,n.byteOffset+m,h),s),a=m+h<<3,s+=h}}e.buf=i,e.BFINAL=o,e.off=s,e.pos=a}function mO(){return mO=ie(function*(e,t,n){if(3===t[0]&&0===t[1])return n||new Uint8Array(0);const r=function eLe(e,t){const n=void 0===t;return void 0===t&&(t=new Uint8Array(e.length>>>2<<3)),{data:e,buf:t,noBuf:n,BFINAL:0,off:0,pos:0}}(t,n);for(;0===r.BFINAL;)e.shouldUpdate&&(yield e.update({message:"Inflating blocks...",current:r.pos,max:t.length})),tLe(r,100);return r.buf.length===r.off?r.buf:r.buf.slice(0,r.off)}),mO.apply(this,arguments)}function gO(e,t){const n=e.length;if(t<=n)return e;const r=new Uint8Array(Math.max(n<<1,t));return r.set(e,0),r}function rLe(e,t,n,r,i,o){let s=0;for(;s>>4;if(c<=15)o[s]=c,s++;else{let u=0,l=0;16===c?(l=3+rm(r,i,2),i+=2,u=o[s-1]):17===c?(l=3+rm(r,i,3),i+=3):18===c&&(l=11+rm(r,i,7),i+=7);const d=s+l;for(;s>>1;for(;oi&&(i=a),o++}for(;o>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)}function vO(e,t,n){const r=[],i=e.length,o=t.length;for(let m=0;mn&&(function iLe(e,t,n){let r=0,i=0;const o=1<t;r++){const s=e[r].d;e[r].d=t,i+=o-(1<>>=n-t;i>0;){const s=e[r].d;s=0;r--)e[r].d===t&&i<0&&(e[r].d--,i++);0!==i&&console.log("debt left")}(a,n,p),p=n);for(let m=0;m14e3||l>26697)&&r-s>100&&(c>>16,S=65535&x,A=lee(_,mt.of0);mt.lhst[257+A]++;const E=lee(S,mt.df0);mt.dhst[E]++,f+=mt.exb[A]+mt.dxb[E],h[u]=_<<23|s-c,h[u+1]=S<<16|A<<8|E,u+=2,c=s+_}else mt.lhst[n[s]]++;l++}}e.i=s,e.pos=a,e.cvrd=c,e.li=u,e.lc=l,e.bs=d,e.ebits=f,e.c=p,e.nc=m}!function(){for(let n=0;n<32768;n++){let r=n;r=(2863311530&r)>>>1|(1431655765&r)<<1,r=(3435973836&r)>>>2|(858993459&r)<<2,r=(4042322160&r)>>>4|(252645135&r)<<4,r=(4278255360&r)>>>8|(16711935&r)<<8,mt.rev15[n]=(r>>>16|r<<16)>>>17}function t(n,r,i){for(;0!=r--;)n.push(0,i)}for(let n=0;n<32;n++)mt.ldef[n]=mt.of0[n]<<3|mt.exb[n],mt.ddef[n]=mt.df0[n]<<4|mt.dxb[n];t(mt.fltree,144,8),t(mt.fltree,112,9),t(mt.fltree,24,7),t(mt.fltree,8,8),nm(mt.fltree,9),C2(mt.fltree,9,mt.flmap),w2(mt.fltree,9),t(mt.fdtree,32,5),nm(mt.fdtree,5),C2(mt.fdtree,5,mt.fdmap),w2(mt.fdtree,5),t(mt.itree,19,0),t(mt.ltree,286,0),t(mt.dtree,30,0),t(mt.ttree,320,0)}();const aLe=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]];function xO(){return xO=ie(function*(e,t,n,r,i){const o=function oLe(e,t,n,r){const{lits:i,strt:o,prev:s}=mt;return{data:e,out:t,opt:aLe[r],i:0,pos:n<<3,cvrd:0,dlen:e.length,li:0,lc:0,bs:0,ebits:0,c:0,nc:0,lits:i,strt:o,prev:s}}(t,n,r,i),{dlen:s}=o;if(0===i){let{i:m,pos:h}=o;for(;m>>3}for(s>2&&(o.nc=SO(t,0),o.strt[o.nc]=0);o.i>>3}),xO.apply(this,arguments)}function uLe(e,t,n,r,i,o){let s=32767&t,a=n[s],c=s-a+32768&32767;if(a===s||r!==SO(e,t-c))return 0;let u=0,l=0;const d=Math.min(32767,t);for(;c<=d&&0!=--o&&a!==s;){if(0===u||e[t+u]===e[t+u-c]){let f=lLe(e,t,c);if(f>u){if(u=f,l=c,u>=i)break;c+2p&&(p=y,a=h)}}}s=a,a=n[s],c+=s-a+32768&32767}return u<<16|l}function lLe(e,t,n){if(e[t]!==e[t-n]||e[t+1]!==e[t+1-n]||e[t+2]!==e[t+2-n])return 0;const r=t,i=Math.min(e.length,t+258);for(t+=3;t4&&0===mt.itree[1+(mt.ordr[a-1]<<1)];)a--;return[e,t,s,r,o,a,n,i]}(),y=32+(c+3&7?8-(c+3&7):0)+(s<<3),b=r+A2(mt.fltree,mt.lhst)+A2(mt.fdtree,mt.dhst);let x=r+A2(mt.ltree,mt.lhst)+A2(mt.dtree,mt.dhst);x+=14+3*m+A2(mt.itree,mt.ihst)+(2*mt.ihst[16]+3*mt.ihst[17]+7*mt.ihst[18]);for(let S=0;S<286;S++)mt.lhst[S]=0;for(let S=0;S<30;S++)mt.dhst[S]=0;for(let S=0;S<19;S++)mt.ihst[S]=0;const _=y>>23,R=E+(8388607&D);for(;E>16,N=T>>8&255,V=255&T;Yg(a,c=I2(257+N,S,a,c),I-mt.of0[N]),ST(a,c=I2(V,A,a,c+=mt.exb[N]),M-mt.df0[V]),c+=mt.dxb[V],E+=I}}c=I2(256,S,a,c)}return c}function aee(e,t,n,r,i){let o=i>>>3;return r[o]=n,r[o+1]=n>>>8,r[o+2]=255-r[o],r[o+3]=255-r[o+1],o+=4,r.set(new Uint8Array(e.buffer,t,n),o),i+(n+4<<3)}function A2(e,t){let n=0;for(let r=0;r15&&(Yg(n,r,s),r+=a)}return r}function uee(e,t){let n=e.length;for(;2!==n&&0===e[n-1];)n-=2;for(let r=0;r>>1,138);u<11?t.push(17,u-3):t.push(18,u-11),r+=2*u-2}else if(i===a&&o===i&&s===i){let c=r+5;for(;c+2>>1,6);t.push(16,u-3),r+=2*u-2}else t.push(i,0)}return n>>>1}function lee(e,t){let n=0;return t[16|n]<=e&&(n|=16),t[8|n]<=e&&(n|=8),t[4|n]<=e&&(n|=4),t[2|n]<=e&&(n|=2),t[1|n]<=e&&(n|=1),n}function I2(e,t,n,r){return ST(n,r,t[e<<1]),r+t[1+(e<<1)]}function Yg(e,t,n){const r=t>>>3;e[r]|=n<<=7&t,e[r+1]|=n>>>8}function ST(e,t,n){const r=t>>>3;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16}function T2(e,t){return CO.apply(this,arguments)}function CO(){return CO=ie(function*(e,t,n=!1){const r=Object.create(null),i=new Uint8Array(t);if(19280!==gp(i,0))throw new Error('Invalid ZIP file. A valid ZIP file must start with two magic bytes \\x50\\x4b ("PK" in ASCII).');let o=i.length-4;for(;101010256!==$g(i,o);)o--;let s=o;s+=4,s+=4;const a=gp(i,s);s+=2,s+=2,s+=4;const c=$g(i,s);s+=4,s=c;for(let u=0;u>18,e[t+i+1]=128|s>>12&63,e[t+i+2]=128|s>>6&63,e[t+i+3]=128|63&s,i+=4}else e[t+i]=224|s>>12,e[t+i+1]=128|s>>6&63,e[t+i+2]=128|63&s,i+=3;else e[t+i]=192|s>>6,e[t+i+1]=128|63&s,i+=2;else e[t+i]=s,i++}return i}(e,t,n);return t+=a,0===i&&(e.set(s,t),t+=s.length),t}var Yu=function(e){return e[e.None=0]="None",e[e.Gzip=1]="Gzip",e[e.Zip=2]="Zip",e}(Yu||{});function bp(e,t){return function NO(e,t){if(qg)return function xLe(e,t){return Oe.create("Read File",function(){var n=ie(function*(r){const i="zip"===t?Yu.None:hee(e.name);let o;return yield r.update({message:"Opening file...",canAbort:!1}),o="binary"===t||"zip"===t||i!==Yu.None?yield e.arrayBuffer():yield e.text(),yield r.update({message:"Processing file...",canAbort:!1}),yield mee(r,o,t,i)});return function(r){return n.apply(this,arguments)}}())}(e,t);let n;return Oe.create("Read File",function(){var r=ie(function*(i){try{n=new FileReader;const o="zip"===t?Yu.None:hee(e.name);"binary"===t||"zip"===t||o!==Yu.None?n.readAsArrayBuffer(e):n.readAsText(e),yield i.update({message:"Opening file...",canAbort:!0});const s=yield pee(i,"Reading...",n);return yield i.update({message:"Processing file...",canAbort:!1}),yield mee(i,s.result,t,o)}finally{n=void 0}});return function(i){return r.apply(this,arguments)}}(),()=>{n&&n.abort()})}(e,t)}function MO(e){return"string"==typeof e?gee(e,e,"string"):gee(e.title,e.url,e.type||"string",e.body,e.headers)}function fee(e){return e?"Failed to download data. Possible reasons: Resource is not available, or CORS is not allowed on the server.":"Failed to open file."}function pee(e,t,n){return new Promise((r,i)=>{if(function bLe(e){if(!qg&&e instanceof FileReader)return e.readyState===FileReader.DONE;if(e instanceof S2)return e.readyState===S2.DONE;throw new Error("unknown data type")}(n)){const{error:s}=n;return void(null!=s?i(s??fee(n instanceof S2)):r(n))}let o=!1;n.onerror=s=>{if(o)return;const{error:a}=s.target;i(a??fee(n instanceof S2))},n.onprogress=s=>{if(e.shouldUpdate&&!o)try{e.update(s.lengthComputable?{message:t,isIndeterminate:!1,current:s.loaded,max:s.total}:{message:`${t} ${(s.loaded/1024/1024).toFixed(2)} MB`,isIndeterminate:!0})}catch(a){o=!0,i(a)}},n.onload=s=>{r(n)}})}function hee(e){return/\.gz$/i.test(e)?Yu.Gzip:/\.zip$/i.test(e)?Yu.Zip:Yu.None}const vLe=/^(__MACOSX|.DS_Store)/;function RO(){return RO=ie(function*(e,t,n){switch(n){case Yu.None:return t;case Yu.Gzip:return function pLe(e,t,n){return TO.apply(this,arguments)}(e,t);case Yu.Zip:const r=yield T2(e,t.buffer),i=Object.keys(r).filter(o=>!vLe.test(o));if(1!==i.length)throw new Error("can only decompress zip files with a single entry");return r[i[0]]}}),RO.apply(this,arguments)}function mee(e,t,n,r){return kO.apply(this,arguments)}function kO(){return kO=ie(function*(e,t,n,r){let i=t instanceof ArrayBuffer?new Uint8Array(t):t;if(null===i)throw new Error("no data given");if(r!==Yu.None){if(!(i instanceof Uint8Array))throw new Error("need Uint8Array for decompression");const o=yield function _Le(e,t,n){return RO.apply(this,arguments)}(e,i,r);"string"===n?(yield e.update({message:"Decoding text..."}),i=GB(o,0,o.length)):i=o}if("binary"===n&&i instanceof Uint8Array)return i;if("zip"===n&&i instanceof Uint8Array)return yield T2(e,i.buffer);if("string"===n&&"string"==typeof i)return i;if("xml"===n&&"string"==typeof i)return(new DOMParser).parseFromString(i,"application/xml");if("json"===n&&"string"==typeof i)return JSON.parse(i);throw new Error(`could not get requested response data '${n}'`)}),kO.apply(this,arguments)}let BO,FO=(()=>{class e{static get(){return this.pool.length?this.pool.pop():new S2}static emptyFunc(){}static deposit(n){this.pool.length=200&&e.status<400){const{response:n}=e;if(FO.deposit(e),("binary"===t||"zip"===t)&&n instanceof ArrayBuffer)return new Uint8Array(n);if("string"===t&&"string"==typeof n)return n;if("xml"===t&&n instanceof XMLDocument)return n;if("json"===t&&"object"==typeof n)return n;throw new Error(`could not get requested response data '${t}'`)}throw FO.deposit(e),new Error(`Download failed with status code ${e.status}`)}(c,n)});return function(a){return s.apply(this,arguments)}}(),()=>{o&&(o.abort(),o=void 0)})}function OO(){return OO=ie(function*(e,t,n,r){const i=n.length,o=new Array(n.length);yield e.update({message:"Downloading...",current:0,max:i});let s=[],a=[],c=0;for(let l=Math.min(i,r);c0;){const l=yield Promise.race(s),d=n[l.index],f=a.indexOf(l.index);if(u++,"error"===l.kind&&!d.canFail)throw new Error(`${d.url}: ${l.error}`);if(e.shouldUpdate&&(yield e.update({message:"Downloading...",current:u,max:i})),o[l.index]=l,s=s.filter(yee,f),a=a.filter(yee,f),c{l.release(u)}}},e.getUrl=function s(c){return"string"==typeof c?c:c.url},e.getUrlAsset=function a(c,u,l){return"string"==typeof u?c.tryFindUrl(u,l)||t(u,{body:l}):u}}(fr||(fr={}));class TLe{constructor(){this._assets=new Map}get assets(){return uB(this._assets.values())}tryFindUrl(t,n){const r=this.assets.values();for(;;){const i=r.next();if(i.done)return;const o=i.value.asset;if(fr.isUrl(o)&&o.url===t&&(o.body||"")===(n||""))return o}}set(t,n){this._assets.set(t.id,{asset:t,file:n,refCount:0})}get(t){return this._assets.get(t.id)}delete(t){return this._assets.delete(t.id)}has(t){return this._assets.has(t.id)}resolve(t,n,r=!0){var i=this;return fr.isUrl(t)?Oe.create(`Download ${t.title||t.url}`,function(){var o=ie(function*(s){if(i._assets.has(t.id)){const u=i._assets.get(t.id);return u.refCount++,fr.Wrapper(yield bp(u.file,n).runInContext(s),t,i)}if(!r)return fr.Wrapper(yield MO({...t,type:n}).runInContext(s),t,i);const a=yield MO({...t,type:"binary"}).runInContext(s),c=new hO([a],"raw-data");return i._assets.set(t.id,{asset:t,file:c,refCount:1}),fr.Wrapper(yield bp(c,n).runInContext(s),t,i)});return function(s){return o.apply(this,arguments)}}()):Oe.create(`Read ${t.name}`,function(){var o=ie(function*(s){if(i._assets.has(t.id)){const a=i._assets.get(t.id);return a.refCount++,fr.Wrapper(yield bp(a.file,n).runInContext(s),t,i)}if(!(t.file instanceof hO))throw new Error(`Cannot resolve file asset '${t.name}' (${t.id})`);return r&&i._assets.set(t.id,{asset:t,file:t.file,refCount:1}),fr.Wrapper(yield bp(t.file,n).runInContext(s),t,i)});return function(s){return o.apply(this,arguments)}}())}release(t){const n=this._assets.get(t.id);n&&(n.refCount--,n.refCount<=0&&this._assets.delete(t.id))}clear(){this._assets.clear()}dispose(){this.clear()}}!function(e){function t(oe,K){return K&&(K.label&&(oe.label=K.label),K.description&&(oe.description=K.description),K.legend&&(oe.legend=K.legend),K.fieldLabels&&(oe.fieldLabels=K.fieldLabels),K.isHidden&&(oe.isHidden=K.isHidden),K.shortLabel&&(oe.shortLabel=K.shortLabel),K.twoColumns&&(oe.twoColumns=K.twoColumns),K.isEssential&&(oe.isEssential=K.isEssential),K.category&&(oe.category=K.category),K.hideIf&&(oe.hideIf=K.hideIf),K.help&&(oe.help=K.help)),oe}function i(oe,K,ne){return t({type:"select",defaultValue:me(oe,K),options:K,cycle:ne?.cycle},ne)}function h(oe,K){return K&&(typeof K.min<"u"&&(oe.min=K.min),typeof K.max<"u"&&(oe.max=K.max),typeof K.step<"u"&&(oe.step=K.step)),oe}function x(oe,K){const ne=t({type:"group",defaultValue:K?.customDefault||F(oe),params:oe},K);return K?.presets&&(ne.presets=K.presets),K?.isExpanded&&(ne.isExpanded=K.isExpanded),K?.isFlat&&(ne.isFlat=K.isFlat),K?.pivot&&(ne.pivot=K.pivot),ne}function w(){return F(this.element)}function D(){throw new Error("getValue not set. Fix runtime.")}function F(oe){const K={};for(const ne of Object.keys(oe))oe[ne].isOptional||(K[ne]=oe[ne].defaultValue);return K}function G(oe,K,ne){return()=>oe(K,ne)}function L(oe,K,ne){if(K)if("value-ref"===oe.type){K.getValue=K.ref?G(oe.resolveRef,K.ref,ne):()=>{throw new Error("Unset ref in ValueRef value.")}}else if("data-ref"===oe.type){K.getValue=K.ref?G(ne,K.ref,ne):()=>{throw new Error("Unset ref in ValueRef value.")}}else if("group"===oe.type)Z(oe.params,K,ne);else if("mapped"===oe.type){const de=K;L(oe.map(de.name),de.params,ne)}else if("object-list"===oe.type){if(!j(oe.element))return;for(const de of K)Z(oe.element,de,ne)}}function z(oe){if("value-ref"===oe.type||"data-ref"===oe.type)return!0;if("group"===oe.type){if(j(oe.params))return!0}else if("mapped"===oe.type){for(const[K]of oe.select.options)if(z(oe.map(K)))return!0}else if("object-list"===oe.type)return j(oe.element);return!1}function j(oe){for(const K of Object.keys(oe))if(z(oe[K]))return!0;return!1}function Z(oe,K,ne){for(const de of Object.keys(oe))L(oe[de],K?.[de],ne)}function O(oe,K,ne){if(K===ne)return!0;if("object"!=typeof K||"object"!=typeof ne)return!1;for(const de of Object.keys(oe))if(!H(oe[de],K[de],ne[de]))return!1;return!0}function H(oe,K,ne){if(K===ne)return!0;if("group"===oe.type)return O(oe.params,K,ne);if("mapped"===oe.type){const de=K,we=ne;return de.name===we.name&&H(oe.map(de.name),de.params,we.params)}if("multi-select"===oe.type){const de=K,we=ne;if(de.length!==we.length)return!1;if(de.length<10){for(let Le=0,We=de.length;Le"u")return ne?oe.defaultValue:void 0;if(!fe(oe.select,de.name))return oe.defaultValue;const we=oe.map(de.name);return{name:de.name,params:X(we,de.params,ne)}}if("select"===oe.type)return fe(oe,K)?K:oe.defaultValue;if("multi-select"===oe.type){if(!Array.isArray(K))return oe.defaultValue;const de=K.filter(function(we){return fe(this,we)},oe);return K.length>0&&0===de.length?oe.defaultValue:de}return"object-list"===oe.type?Array.isArray(K)?K.map(de=>J(oe.element,de,ne?"all":"skip")):oe.defaultValue:K}function J(oe,K,ne){if("object"!=typeof K||null===K)return ne?F(oe):K;const de=Object.create(null);for(const we of Object.keys(oe)){const Le=oe[we];void 0===K[we]?"all"===ne&&(de[we]=Le.defaultValue):de[we]=X(Le,K[we],"skip"!==ne)}return de}function me(oe,K){for(const ne of K)if(ne[0]===oe)return oe;return K.length>0?K[0][0]:void 0}e.Essential={isEssential:!0},e.Optional=function n(oe){const K={...oe};return K.isOptional=!0,K},e.Value=function r(oe,K){return t({type:"value",defaultValue:oe},K)},e.Select=i,e.MultiSelect=function o(oe,K,ne){const de=t({type:"multi-select",defaultValue:oe,options:K},ne);return ne?.emptyValue&&(de.emptyValue=ne.emptyValue),de},e.Boolean=function s(oe,K){return t({type:"boolean",defaultValue:oe},K)},e.Text=function a(oe="",K){return t({type:"text",defaultValue:oe,multiline:K?.multiline,placeholder:K?.placeholder,disableInteractiveUpdates:K?.disableInteractiveUpdates},K)},e.Color=function c(oe,K){const ne=t({type:"color",defaultValue:oe},K);return K?.isExpanded&&(ne.isExpanded=K.isExpanded),ne},e.ColorList=function u(oe,K){let ne;if("string"==typeof oe){const de=cp(oe);ne={kind:"qualitative"!==de.type?"interpolate":"set",colors:de.list}}else ne=oe;return t({type:"color-list",presetKind:K?.presetKind||"all",defaultValue:ne,offsets:!!K?.offsets},K)},e.Vec3=function l(oe,K,ne){return t(h({type:"vec3",defaultValue:oe},K),ne)},e.Mat4=function d(oe,K){return t({type:"mat4",defaultValue:oe},K)},e.Url=function f(oe,K){return t({type:"url",defaultValue:"string"==typeof oe?fr.Url(oe):fr.Url(oe.url,{body:oe.body})},K)},e.File=function p(oe){const K=t({type:"file",defaultValue:null},oe);return oe?.accept&&(K.accept=oe.accept),K},e.FileList=function m(oe){const K=t({type:"file-list",defaultValue:null},oe);return oe?.accept&&(K.accept=oe.accept),K},e.Numeric=function g(oe,K,ne){const de=t(h({type:"number",defaultValue:oe},K),ne);return ne?.immediateUpdate&&(de.immediateUpdate=!0),de},e.Interval=function y(oe,K,ne){return t(h({type:"interval",defaultValue:oe},K),ne)},e.LineGraph=function b(oe,K){const ne=t({type:"line-graph",defaultValue:oe},K);return K?.getVolume&&(ne.getVolume=K.getVolume),ne},e.Group=x,e.EmptyGroup=function _(oe){return x({},oe)},e.Mapped=function S(oe,K,ne,de){const we=me(oe,K);return t({type:"mapped",defaultValue:{name:we,params:ne(we).defaultValue},select:i(we,K,de),map:ne},de)},e.MappedStatic=function A(oe,K,ne){const de=ne?.options?ne.options:Object.keys(K).map(Le=>[Le,K[Le].label||zu(Le)]),we=me(oe,de);return t({type:"mapped",defaultValue:{name:we,params:K[we].defaultValue},select:i(we,de,ne),map:Le=>K[Le]},ne)},e.ObjectList=function E(oe,K,ne){return t({type:"object-list",element:oe,getLabel:K,ctor:w,defaultValue:ne?.defaultValue||[]},ne)},e.ValueRef=function I(oe,K,ne){var de;return t({type:"value-ref",defaultValue:{ref:null!==(de=ne?.defaultRef)&&void 0!==de?de:"",getValue:D},getOptions:oe,resolveRef:K},ne)},e.DataRef=function R(oe){var K;return t({type:"data-ref",defaultValue:{ref:null!==(K=oe?.defaultRef)&&void 0!==K?K:"",getValue:D}},oe)},e.Converted=function T(oe,K,ne){return t({type:"converted",defaultValue:K(ne.defaultValue),converted:ne,fromValue:oe,toValue:K},ne)},e.Conditioned=function M(oe,K,ne,de,we){const Le=Object.keys(K).map(We=>[We,We]);return t({type:"conditioned",select:i(ne(oe),Le,we),defaultValue:oe,conditionParams:K,conditionForValue:ne,conditionedValue:de},we)},e.Script=function N(oe,K){return t({type:"script",defaultValue:oe},K)},e.For=function V(oe){return 0},e.getDefaultValues=F,e.resolveRefs=Z,e.setDefaultValues=function $(oe,K){for(const ne of Object.keys(oe))oe[ne].isOptional||(oe[ne].defaultValue=K[ne])},e.clone=function ee(oe){return Jl(oe)},e.validate=function q(oe,K){},e.areEqual=O,e.isParamEqual=H,e.merge=W,e.mergeParam=Q,e.normalizeParams=J,e.objectToOptions=function ce(oe,K){const ne=[];for(const de of Object.keys(oe))if(K){const we=K(de,oe[de]);ne.push("string"==typeof we?[de,we]:[de,we[0],we[1]])}else ne.push("string"==typeof oe[de]?[de,oe[de]]:[de,null===K?de:zu(de)]);return ne},e.arrayToOptions=function be(oe,K){const ne=[];for(const de of oe)ne.push(K?[de,K(de)]:[de,null===K?de:zu(de)]);return ne},e.optionLabel=function ae(oe,K){for(const ne of oe.options)if(ne[0]===K)return ne[1];return""}}(C||(C={}));const ELe=9,CT=-27.888,PLe=-.5,vee=-9.9;function MLe(e,t,n,r){const i=v.distance(e,r),o=v.distance(t,r),s=v.distance(t,n),a=v.distance(e,n),l=CT/i-CT/o+(CT/s-CT/a);return l0&&(t.secondStart-e.secondEnd<6&&t.firstStart-e.firstEnd<3||t.secondStart-e.secondEnd<3)}function xee(e){return vn.is(e,8)||vn.is(e,1)||vn.is(e,16)}const HLe={oldDefinition:C.Boolean(!0,{description:"Whether to use the old DSSP convention for the annotation of turns and helices, causes them to be two residues shorter"}),oldOrdering:C.Boolean(!0,{description:"Alpha-helices are preferred over 3-10 helices"})};function qLe(e,t){return UO.apply(this,arguments)}function UO(){return UO=ie(function*(e,t){const n=function jLe(e){const{index:t}=e.model.atomicHierarchy,{proteinElements:n,residueIndex:r}=e,i=n.length,o=new Uint32Array(i),s=new Int32Array(i),a=new Int32Array(i),c=new Int32Array(i),u=new Int32Array(i);for(let l=0;lPLe||(f[f.length]=w,p[p.length]=F,m[m.length]=z)}}return function kLe(e,t,n,r){const i=new Dc.DirectedEdgeBuilder(e,t,n),o=new Float32Array(i.slotCount);for(let s=0,a=i.edgeCount;s-1===S?v.setNaN(A):o.position(S,A);let l=v(),d=v(),f=v(),p=v(),m=v(),h=v();const g=v(),y=v(),b=v();if(0===c)return{phi:new Float32Array(0),psi:new Float32Array(0)};const x=new Float32Array(c-1),_=new Float32Array(c-1);u(-1,l),u(-1,d),u(-1,f),u(n[0],p),u(a[i[0]],m),u(r[0],h),u(n[1],g),u(a[i[1]],y),u(r[1],b);for(let S=0;S-1===y?v.setNaN(b):i.position(y,b),l=v(),d=v(),f=v(),p=v(),m=v(),h=v(),g=v();e:for(let y=2;y6.25)continue e}const A=o[s[y]],E=o[s[y+2]];u(o[s[y-2]],l),u(A,d),u(E,f),v.sub(h,l,d),v.sub(g,d,f);const w=su(v.angle(h,g));w&&w>70&&(n[y]|=32)}}(p),function ULe(e){const{proteinInfo:t,hbonds:n,flags:r,bridges:i}=e,{offset:o,b:s}=n;let a,c;for(let u=0,l=t.residueIndices.length;up||(a=u+1,c=p,a!==c&&-1!==n.getDirectedEdgeIndex(c,a+1)&&(r[a]|=2,r[c]|=2,i[i.length]=new wT(a,c,0)),a=u,c=p-1,a!==c&&-1!==n.getDirectedEdgeIndex(c-1,a)&&(r[a]|=2,r[c]|=2,i[i.length]=new wT(c,a,0)),a=u,c=p,a!==c&&-1!==n.getDirectedEdgeIndex(c,a)&&(r[a]|=2,r[c]|=2,i[i.length]=new wT(c,a,1)),a=u+1,c=p-1,a!==c&&-1!==n.getDirectedEdgeIndex(c-1,a+1)&&(r[a]|=2,r[c]|=2,i[i.length]=new wT(c,a,1)))}i.sort((u,l)=>u.partner1>l.partner1?1:u.partner1je.indexOf(r,x))}),UO.apply(this,arguments)}function WLe(e,t,n){return"helix"===e?{kind:"helix",flags:n(t)}:"sheet"===e?{kind:"sheet",flags:n(t)}:"turn"===e||"bend"===e?{kind:"turn",flags:n(t)}:{kind:"none"}}function $Le(e){return e===cr.SecondaryStructureDssp.H||e===cr.SecondaryStructureDssp.G||e===cr.SecondaryStructureDssp.I?"helix":e===cr.SecondaryStructureDssp.B||e===cr.SecondaryStructureDssp.E?"sheet":e===cr.SecondaryStructureDssp.T?"turn":e===cr.SecondaryStructureDssp.S?"bend":"none"}function YLe(e){return vn.is(e,1)?cr.SecondaryStructureDssp.H:vn.is(e,4)?cr.SecondaryStructureDssp.E:vn.is(e,2)?cr.SecondaryStructureDssp.B:vn.is(e,8)?cr.SecondaryStructureDssp.G:vn.is(e,16)?cr.SecondaryStructureDssp.I:vn.is(e,64)?cr.SecondaryStructureDssp.T:vn.is(e,32)?cr.SecondaryStructureDssp.S:0}function XLe(e){return vn.is(e,1)?"H":vn.is(e,4)?"E":vn.is(e,2)?"B":vn.is(e,8)?"G":vn.is(e,16)?"I":vn.is(e,64)?"T":vn.is(e,32)?"S":"-"}function KLe(e){return vn.is(e,16)?cr.SecondaryStructureDssp.I:vn.is(e,1)?cr.SecondaryStructureDssp.H:vn.is(e,4)?cr.SecondaryStructureDssp.E:vn.is(e,2)?cr.SecondaryStructureDssp.B:vn.is(e,8)?cr.SecondaryStructureDssp.G:vn.is(e,64)?cr.SecondaryStructureDssp.T:vn.is(e,32)?cr.SecondaryStructureDssp.S:0}function ZLe(e){return vn.is(e,16)?"I":vn.is(e,1)?"H":vn.is(e,4)?"E":vn.is(e,2)?"B":vn.is(e,8)?"G":vn.is(e,64)?"T":vn.is(e,32)?"S":"-"}var vp;function See(e){let t="model";if(e){t="dssp";for(let n=0,r=e.models.length;n(i in c[o]||(c[o][i]={props:{...C.getDefaultValues(r.getParams(c))},data:Gh.create(void 0)}),c[o][i]),a=(c,u,l)=>{const d=s(c);c[o][i]={props:u,data:Gh.withValue(d.data,l)}};return{label:r.label,descriptor:r.descriptor,isHidden:r.isHidden,getParams:c=>{const u=C.clone(r.getParams(c));return C.setDefaultValues(u,s(c).props),u},defaultParams:r.defaultParams,isApplicable:r.isApplicable,attach:(c=ie(function*(u,l,d={},f){f&&l.customPropertyDescriptors.reference(r.descriptor,!0),"root"===r.type&&(l=l.root);const p=s(l.root).props,m=s(l),h=C.merge(r.defaultParams,p,d);if(m.data.value&&C.areEqual(r.defaultParams,m.props,h))return;const{value:g,assets:y}=yield r.obtain(u,l,h);l.customPropertyDescriptors.add(r.descriptor),l.customPropertyDescriptors.assets(r.descriptor,y),a(l,h,g)}),function(l,d){return c.apply(this,arguments)}),ref:(c,u)=>c.customPropertyDescriptors.reference(r.descriptor,u),get:c=>s(c).data,set:(c,u={},l)=>{"root"===r.type&&(c=c.root);const d=s(c),f=C.merge(r.defaultParams,d.props,u);C.areEqual(r.defaultParams,d.props,f)||(a(c,f,l),c.customPropertyDescriptors.assets(r.descriptor))},props:c=>s(c).props};var c}e.createProvider=t,e.createSimple=function n(r,i,o){const s={value:C.Value(o,{isHidden:!0})};return t({label:zu(r),descriptor:au({name:r}),isHidden:!0,type:i,defaultParams:s,getParams:()=>({value:C.Value(o,{isHidden:!0})}),isApplicable:()=>!0,obtain:(a=ie(function*(c,u,l){return{...C.getDefaultValues(s),...l}}),function(u,l,d){return a.apply(this,arguments)})});var a}}(vp||(vp={}));const Cee=See(),Xu=vp.createProvider({label:"Secondary Structure",descriptor:au({name:"molstar_computed_secondary_structure"}),type:"root",defaultParams:Cee,getParams:See,isApplicable:e=>!0,obtain:function(){var e=ie(function*(t,n,r){const i={...C.getDefaultValues(Cee),...r};switch(i.type.name){case"dssp":return{value:yield JLe(n,i.type.params)};case"model":return{value:yield e5e(n)}}});return function(n,r,i){return e.apply(this,arguments)}}()});function JLe(e,t){return VO.apply(this,arguments)}function VO(){return VO=ie(function*(e,t){const n=new Map;for(let r=0,i=e.unitSymmetryGroups.length;re.element,x:e=>e.unit.conformation.x(e.element),y:e=>e.unit.conformation.y(e.element),z:e=>e.unit.conformation.z(e.element),id:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicConformation.atomId.value(e.element):Oi(),occupancy:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicConformation.occupancy.value(e.element):Oi(),B_iso_or_equiv:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicConformation.B_iso_or_equiv.value(e.element):Oi(),sourceIndex:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atomSourceIndex.value(e.element):e.element,type_symbol:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.type_symbol.value(e.element):Oi(),label_atom_id:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.label_atom_id.value(e.element):Oi(),auth_atom_id:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.auth_atom_id.value(e.element):Oi(),label_alt_id:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.label_alt_id.value(e.element):Oi(),label_comp_id:AT,auth_comp_id:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.auth_comp_id.value(e.element):Oi(),pdbx_formal_charge:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.pdbx_formal_charge.value(e.element):Oi(),vdw_radius:e=>Ee.isAtomic(e.unit)?v2(e.unit.model.atomicHierarchy.atoms.type_symbol.value(e.element)):Oi()};function AT(e){return Ee.isAtomic(e.unit)||Oi(),e.unit.model.atomicHierarchy.atoms.label_comp_id.value(e.element)}function GO(e){return Ee.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.label_seq_id.value(e.unit.residueIndex[e.element]):Oi()}function wee(e){Ee.isAtomic(e.unit)||Oi();const t=e.unit.model.sequence.byEntityKey[Ka(e)];return t&&t.sequence.microHet.get(GO(e))||[AT(e)]}const r5e={key:e=>Ee.isAtomic(e.unit)?e.unit.residueIndex[e.element]:Oi(),group_PDB:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.group_PDB.value(e.unit.residueIndex[e.element]):Oi(),label_seq_id:GO,auth_seq_id:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.auth_seq_id.value(e.unit.residueIndex[e.element]):Oi(),pdbx_PDB_ins_code:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.pdbx_PDB_ins_code.value(e.unit.residueIndex[e.element]):Oi(),isNonStandard:e=>Ee.isAtomic(e.unit)?wee(e).some(t=>"n"===e.unit.model.properties.chemicalComponentMap.get(t).mon_nstd_flag[0]):Oi(),hasMicroheterogeneity:function n5e(e){Ee.isAtomic(e.unit)||Oi();const t=e.unit.model.sequence.byEntityKey[Ka(e)];return t&&t.sequence.microHet.has(GO(e))},microheterogeneityCompIds:wee,secondary_structure_type:e=>{var t;Ee.isAtomic(e.unit)||Oi();const n=null===(t=Xu.get(e.structure).value)||void 0===t?void 0:t.get(e.unit.invariantId);return n?n.type[n.getIndex(e.unit.residueIndex[e.element])]:536870912},secondary_structure_key:e=>{var t;Ee.isAtomic(e.unit)||Oi();const n=null===(t=Xu.get(e.structure).value)||void 0===t?void 0:t.get(e.unit.invariantId);return n?n.key[n.getIndex(e.unit.residueIndex[e.element])]:-1},chem_comp_type:e=>Ee.isAtomic(e.unit)?e.unit.model.properties.chemicalComponentMap.get(AT(e)).type:Oi()},i5e={key:e=>Ee.isAtomic(e.unit)?e.unit.chainIndex[e.element]:Oi(),label_asym_id:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicHierarchy.chains.label_asym_id.value(e.unit.chainIndex[e.element]):Oi(),auth_asym_id:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicHierarchy.chains.auth_asym_id.value(e.unit.chainIndex[e.element]):Oi(),label_entity_id:e=>Ee.isAtomic(e.unit)?e.unit.model.atomicHierarchy.chains.label_entity_id.value(e.unit.chainIndex[e.element]):Oi()},o5e={key:D2.key,entityKey:e=>Ee.isCoarse(e.unit)?e.unit.coarseElements.entityKey[e.element]:_p(),x:D2.x,y:D2.y,z:D2.z,asym_id:e=>Ee.isCoarse(e.unit)?e.unit.coarseElements.asym_id.value(e.element):_p(),entity_id:e=>Ee.isCoarse(e.unit)?e.unit.coarseElements.entity_id.value(e.element):_p(),seq_id_begin:e=>Ee.isCoarse(e.unit)?e.unit.coarseElements.seq_id_begin.value(e.element):_p(),seq_id_end:e=>Ee.isCoarse(e.unit)?e.unit.coarseElements.seq_id_end.value(e.element):_p(),sphere_radius:e=>Ee.isSpheres(e.unit)?e.unit.coarseConformation.radius[e.element]:_p("spheres"),sphere_rmsf:e=>Ee.isSpheres(e.unit)?e.unit.coarseConformation.rmsf[e.element]:_p("spheres"),gaussian_weight:e=>Ee.isGaussians(e.unit)?e.unit.coarseConformation.weight[e.element]:_p("gaussians"),gaussian_covariance_matrix:e=>Ee.isGaussians(e.unit)?e.unit.coarseConformation.covariance_matrix[e.element]:_p("gaussians")};function Ka(e){switch(e.unit.kind){case 0:return e.unit.model.atomicHierarchy.index.getEntityFromChain(e.unit.chainIndex[e.element]);case 1:return e.unit.model.coarseHierarchy.spheres.entityKey[e.element];case 2:return e.unit.model.coarseHierarchy.gaussians.entityKey[e.element]}}const s5e={key:Ka,id:e=>e.unit.model.entities.data.id.value(Ka(e)),type:e=>e.unit.model.entities.data.type.value(Ka(e)),src_method:e=>e.unit.model.entities.data.src_method.value(Ka(e)),pdbx_description:e=>e.unit.model.entities.data.pdbx_description.value(Ka(e)),formula_weight:e=>e.unit.model.entities.data.formula_weight.value(Ka(e)),pdbx_number_of_molecules:e=>e.unit.model.entities.data.pdbx_number_of_molecules.value(Ka(e)),details:e=>e.unit.model.entities.data.details.value(Ka(e)),pdbx_mutation:e=>e.unit.model.entities.data.pdbx_mutation.value(Ka(e)),pdbx_fragment:e=>e.unit.model.entities.data.pdbx_fragment.value(Ka(e)),pdbx_ec:e=>e.unit.model.entities.data.pdbx_ec.value(Ka(e)),subtype:e=>e.unit.model.entities.subtype.value(Ka(e)),prd_id:e=>{var t,n;return null!==(n=null===(t=e.unit.model.entities.prd_id)||void 0===t?void 0:t.value(Ka(e)))&&void 0!==n?n:""}},a5e=[],c5e={id:e=>e.unit.id,chainGroupId:e=>e.unit.chainGroupId,multiChain:e=>Ee.Traits.is(e.unit.traits,Ee.Trait.MultiChain),object_primitive:e=>e.unit.objectPrimitive,operator_name:e=>e.unit.conformation.operator.name,operator_key:e=>e.unit.conformation.operator.key,model_index:e=>e.unit.model.modelNum,model_label:e=>e.unit.model.label,model_entry_id:e=>e.unit.model.entryId,hkl:e=>e.unit.conformation.operator.hkl,spgrOp:e=>e.unit.conformation.operator.spgrOp,model_num:e=>e.unit.model.modelNum,pdbx_struct_assembly_id:e=>{var t;return(null===(t=e.unit.conformation.operator.assembly)||void 0===t?void 0:t.id)||ui.DefaultName},pdbx_struct_oper_list_ids:e=>{var t;return(null===(t=e.unit.conformation.operator.assembly)||void 0===t?void 0:t.operList)||a5e},struct_ncs_oper_id:e=>e.unit.conformation.operator.ncsId},Ze={constant:{true:e=>!0,false:e=>!1,zero:e=>0},atom:D2,residue:r5e,chain:i5e,entity:s5e,unit:c5e,coarse:o5e};class E2{add(t){let n=this.index.get(t.label_asym_id);n||(n=new Map,this.index.set(t.label_asym_id,n));let r=n.get(t.label_seq_id);return r||(r=[],n.set(t.label_seq_id,r)),!this._find(t,r)&&(r.push(t),!0)}hasLabelAsymId(t){return this.index.has(t)}has(t){var n,r;const i=Aee(t);if(!this.index.has(i))return;const o=this.index.get(i),s=Iee(t);if(!o.has(s))return;const a=o.get(s),c=Tee(t),u=Dee(t),l=Eee(t),d=null!==(n=Pee(t))&&void 0!==n?n:"1_555";for(const f of a)if(f.label_comp_id===c&&f.label_alt_id===u&&f.ins_code===l&&(!this.checkOperator||(null!==(r=f.operator_name)&&void 0!==r?r:"1_555")===d))return f}static getLabel(t,n=!1){var r;return`${t.label_asym_id} ${t.label_comp_id} ${t.label_seq_id}:${t.ins_code}:${t.label_alt_id}${n?" "+(null!==(r=t.operator_name)&&void 0!==r?r:"1_555"):""}`}static getEntryFromLocation(t){var n;return{label_asym_id:Aee(t),label_comp_id:Tee(t),label_seq_id:Iee(t),label_alt_id:Dee(t),ins_code:Eee(t),operator_name:null!==(n=Pee(t))&&void 0!==n?n:"1_555"}}_find(t,n){var r,i;for(const o of n)if(o.label_comp_id===t.label_comp_id&&o.label_alt_id===t.label_alt_id&&o.ins_code===t.ins_code&&(!this.checkOperator||(null!==(r=o.operator_name)&&void 0!==r?r:"1_555")===(null!==(i=t.operator_name)&&void 0!==i?i:"1_555")))return!0;return!1}constructor(t){var n;this.index=new Map,this.checkOperator=!1,this.checkOperator=null!==(n=t?.checkOperator)&&void 0!==n&&n}}const Aee=Ze.chain.label_asym_id,Iee=Ze.residue.label_seq_id,Tee=Ze.atom.label_comp_id,Dee=Ze.atom.label_alt_id,Eee=Ze.residue.pdbx_PDB_ins_code,Pee=Ze.unit.operator_name;function Jb(e,t,n){const r=t.subsetBuilder(!0);for(const i of n.units){if(0!==i.kind){r.setUnit(i.id,i.elements);continue}const{residueAtomSegments:o}=i.model.atomicHierarchy,s=t.unitMap.get(i.id).elements,a=i.elements;r.beginUnit(i.id);const c=en.transientSegments(o,a);for(;c.hasNext;){const u=c.move().index;for(let l=o.offsets[u],d=o.offsets[u+1];l(e.element.structure=n.structure,e.element.unit=n.unit,e.element.element=n.element,t(e))}function d5e(e,t){let n=0;e.element.structure=e.inputStructure;for(const r of e.inputStructure.units){e.element.unit=r;const i=r.elements;for(let o=0,s=i.length;on&&(n=c)}}return e.throwIfTimedOut(),n}function f5e(e,t){return function(r){const i=e(r);if(t.elementRadius){const o={...t,elementRadius:t.elementRadius,elementRadiusClosure:l5e(r,t.elementRadius),sourceMaxRadius:d5e(r,t.elementRadius)};if(pt.isSingleton(i)){const s=Mee(r,r.inputStructure,i.structure,o);return pt.Singletons(r.inputStructure,s)}{const s=new KB(r.inputStructure);for(const a of i.structures)s.add(Mee(r,r.inputStructure,a,o));return s.getSelection()}}if(pt.isSingleton(i)){const o=jO(r,r.inputStructure,i.structure,t);return pt.Singletons(r.inputStructure,o)}{const o=new KB(r.inputStructure);for(const s of i.structures)o.add(jO(r,r.inputStructure,s,t));return o.getSelection()}}}function p5e(e,t){return function(r){const i=e(r);if(0===pt.structureCount(i))return i;const o=pt.UniqueBuilder(r.inputStructure),s=a=>o.add(a);return pt.forEach(i,(a,c)=>{r.pushInputStructure(a),pt.forEach(t(r),s),r.popInputStructure(),c%10==0&&r.throwIfTimedOut()}),o.getSelection()}}function h5e(e,t){return function(r){const i=e(r);if(0===pt.structureCount(i))return i;const o=t(r);if(0===pt.structureCount(o))return pt.Empty(r.inputStructure);const s=pt.unionStructure(o),a=pt.UniqueBuilder(r.inputStructure);return pt.forEach(i,(c,u)=>{const l=NJ(s,c);0!==l.elementCount&&a.add(l),u%50==0&&r.throwIfTimedOut()}),a.getSelection()}}function m5e(e,t){return function(r){const i=e(r);if(0===pt.structureCount(i))return i;const o=t(r);if(0===pt.structureCount(o))return i;const s=pt.unionStructure(o),a=pt.UniqueBuilder(r.inputStructure);return pt.forEach(i,(c,u)=>{const l=YB(c,s);0!==l.elementCount&&a.add(l),u%50==0&&r.throwIfTimedOut()}),a.getSelection()}}function g5e(e){return function(n){const r=pt.LinearBuilder(n.inputStructure);return r.add(pt.unionStructure(e(n))),r.getSelection()}}function y5e(e,t){return function(r){const i=e(r),o=new Map,s=[];r.pushCurrentElement(),pt.forEach(i,(c,u)=>{r.element.structure=c;for(const l of c.units){r.element.unit=l;const d=l.elements;for(let f=0,p=d.length;f{let f=l;if(i)for(;;){const p=f.elementCount;if(f=Ree(a,n,f),f.elementCount===p)break}else for(let p=0;p=0)f.addElementRange(h,b.start,b.end);else if(d.hasLabelAsymId(x))for(y.setSegment(b);y.hasNext;){const S=y.move();u.element=h[S.start],d.has(u)&&f.addElementRange(h,S.start,S.end)}}f.commitUnit(),i.throwIfTimedOut()}const p=m2(i.inputStructure,[f.getStructure(),o]);if(n){const m=new pT(i.inputStructure),h=i.inputStructure.lookup3d;for(const g of p.units){const y=g.conformation,b=g.elements;for(let x=0,_=b.length;x<_;x++){const S=b[x];h.findIntoBuilderIf(y.x(S),y.y(S),y.z(S),t,m,S5e),m.addToUnit(g.id,S)}i.throwIfTimedOut()}return pt.Sequence(i.inputStructure,[m.getStructure()])}return pt.Sequence(i.inputStructure,[p])}}const x5e=Ze.entity.type;function S5e(e){return"water"===x5e(e)}class A5e{constructor(){this.vertices=new Map,this.edges=new Map}addVertex(t,n){this.vertices.has(n)||(this.vertices.set(n,t),this.edges.set(n,[]))}addEdge(t,n){const r=E2.getLabel(t),i=E2.getLabel(n);this.addVertex(t,r),this.addVertex(n,i),eo(this.edges.get(r),i),eo(this.edges.get(i),r)}addComponent(t,n){const r=E2.getLabel(t);if(!this.vertices.has(r))return void n.add(t);const i=new Set,o=new Set,s=[r];for(o.add(r),n.add(t);s.length>0;){const a=s.pop();i.add(a);const c=this.vertices.get(a);for(const u of this.edges.get(a)){if(i.has(u)||(s.push(u),o.has(u)))continue;o.add(u);const l=this.vertices.get(u);n.add(c.operator_name===l.operator_name?{...l,operator_name:t.operator_name}:l)}}}}var IT,TT,HO;function D5e(e,t){return n=>{const r=e(n),i=pt.LinearBuilder(n.inputStructure);return n.pushCurrentElement(),pt.forEach(r,(o,s)=>{n.currentStructure=o,t(n)&&i.add(o),s%100&&n.throwIfTimedOut()}),n.popCurrentStructure(),i.getSelection()}}function E5e(e){return t=>{const n=e(t),r=pt.LinearBuilder(t.inputStructure);if("singletons"===n.kind){if(n.structure.elementCount>0){const i=n.structure.units[0],o=Ve.create([i.getChild(je.ofSingleton(i.elements[0]))],{parent:t.inputStructure});r.add(o)}}else n.structures.length>0&&r.add(n.structures[0]);return r.getSelection()}}function DT(e,t,n){const{units:r}=e.currentStructure,i=e.pushCurrentElement();i.structure=e.currentStructure;for(const o of r){i.unit=o;const s=o.elements,a=t;if(a){for(let c=0,u=s.length;c{const i=e(r),o=function P5e(e,t,n){const r=new Set,i=t(e);return e.pushCurrentElement(),pt.forEach(i,(o,s)=>{e.currentStructure=o,DT(e,n,r),s%10&&e.throwIfTimedOut()}),e.popCurrentElement(),r}(r,t,n),s=pt.LinearBuilder(r.inputStructure);return r.pushCurrentStructure(),pt.forEach(i,(a,c)=>{r.currentStructure=a;const u=DT(r,n,new Set);Si.isSuperset(o,u)&&s.add(a),c%10&&r.throwIfTimedOut()}),r.popCurrentStructure(),s.getSelection()}}function R5e(e,t){return n=>{const r=pt.unionStructure(t(n)),i=pt.LinearBuilder(n.inputStructure);return pt.forEach(e(n),(o,s)=>{fT(r,o)&&i.add(o),s%10&&n.throwIfTimedOut()}),i.getSelection()}}function k5e(e){return t=>{const n={queryCtx:t,selection:e.query(t),target:e.target(t),maxRadius:e.maxRadius,minRadius:e.minRadius?Math.max(0,e.minRadius):0,elementRadius:e.elementRadius,invert:!!e.invert};return 0===n.minRadius&&typeof e.minRadius>"u"?function N5e({queryCtx:e,selection:t,target:n,maxRadius:r,invert:i}){const o=pt.unionStructure(n).lookup3d,s=pt.LinearBuilder(e.inputStructure),a=v.zero();return pt.forEach(t,(c,u)=>{const{units:l}=c;let d=!1;for(let f=0,p=l.length;f{let l=function T5e(e,t,n,r,i){return 0===t.elementCount||0===n.elementCount||(t.elementCount<=n.elementCount?TT.check(e,t,n,r,i):TT.check(e,n,t,r,i))}(e,s,c,r,o);i&&(l=!l),l&&a.add(c),u%10==0&&e.throwIfTimedOut()}),e.popCurrentElement(),a.getSelection()}(n):function B5e({queryCtx:e,selection:t,target:n,minRadius:r,maxRadius:i,invert:o,elementRadius:s}){const a=pt.unionStructure(n),c=pt.LinearBuilder(e.inputStructure);return e.pushCurrentElement(),pt.forEach(t,(u,l)=>{let d=function I5e(e,t,n,r,i,o){return 0===t.elementCount||0===n.elementCount||(t.elementCount<=n.elementCount?IT.check(e,t,n,r,i,o):IT.check(e,n,t,r,i,o))}(e,a,u,r,i,s);o&&(d=!d),d&&c.add(u),l%10==0&&e.throwIfTimedOut()}),e.popCurrentElement(),c.getSelection()}(n)}}function L5e({query:e,target:t,disjunct:n,invert:r,bondTest:i}){return o=>{const s=t(o);if(pt.isEmpty(s))return s;const a=e(o);if(pt.isEmpty(a))return a;const c={queryCtx:o,input:o.inputStructure,disjunct:n,target:pt.unionStructure(s)},u=pt.LinearBuilder(o.inputStructure);return o.pushCurrentBond(),o.atomicBond.setTestFn(i),pt.forEach(a,(l,d)=>{(function O5e(e,t){const{queryCtx:n,input:r,target:i,disjunct:o}=e,s=n.atomicBond,a=r.interUnitBonds;s.setStructure(r);for(const c of t.units){if(!Ee.isAtomic(c))continue;const u=r.unitMap.get(c.id),{offset:l,b:d,edgeProps:{flags:f,order:p,key:m}}=u.bonds,h=a.getConnectedUnits(c.id),g=h.length,y=c.elements,b=u.elements;for(let x=0,_=y.length;x<_;x++){const S=je.indexOf(b,y[x]);s.a.unit=u,s.b.unit=u;for(let A=l[S],E=l[S+1];A{const n=pt.UniqueBuilder(t.inputStructure);for(let r=0;r{n.add(i),r%100&&t.throwIfTimedOut()});return n.getSelection()}}function V5e(e){return 0===e.length?ZB:1===e.length?e[0]:t=>{const n=[];for(let a=0;aa.hashCode,Ve.areUnitIdsAndIndicesEqual);pt.forEach(n[r],a=>o.add(a));const s=pt.UniqueBuilder(t.inputStructure);for(let a=0;a{o.has(c)&&s.add(c)}),t.throwIfTimedOut());return s.getSelection()}}function z5e(e){return e.currentStructure.elementCount}function G5e(e){return t=>{const n=e(t);return pt.structureCount(n)}}function j5e(e){return t=>DT(t,e,new Set)}!function(e){const t=v();function n(s,a,c,u,l,d,f){const{elements:p,conformation:m}=a,h=t;s.element.unit=a;let g=!1;for(let y=0,b=p.length;yf(m)===p},e.lt=function r(f,p){return m=>f(m)f(m)<=p},e.gt=function o(f,p){return m=>f(m)>p},e.gte=function s(f,p){return m=>f(m)>=p},e.inSet=function u(f,p){if(function t(f){return!!f&&!!f.has}(p))return m=>p.has(f(m));{if(0===p.length)return c;const m=new Set;for(let h=0;hm.has(f(h))}},e.and=function l(...f){switch(f.length){case 0:return a;case 1:return f[0];case 2:{const p=f[0],m=f[1];return h=>p(h)&&m(h)}case 3:{const p=f[0],m=f[1],h=f[2];return g=>p(g)&&m(g)&&h(g)}case 4:{const p=f[0],m=f[1],h=f[2],g=f[3];return y=>p(y)&&m(y)&&h(y)&&g(y)}case 5:{const p=f[0],m=f[1],h=f[2],g=f[3],y=f[4];return b=>p(b)&&m(b)&&h(b)&&g(b)&&y(b)}case 6:{const p=f[0],m=f[1],h=f[2],g=f[3],y=f[4],b=f[5];return x=>p(x)&&m(x)&&h(x)&&g(x)&&y(x)&&b(x)}default:{const p=f.length;return m=>{for(let h=0;hp(h)||m(h)}case 3:{const p=f[0],m=f[1],h=f[2];return g=>p(g)||m(g)||h(g)}case 4:{const p=f[0],m=f[1],h=f[2],g=f[3];return y=>p(y)||m(y)||h(y)||g(y)}case 5:{const p=f[0],m=f[1],h=f[2],g=f[3],y=f[4];return b=>p(b)||m(b)||h(b)||g(b)||y(b)}case 6:{const p=f[0],m=f[1],h=f[2],g=f[3],y=f[4],b=f[5];return x=>p(x)||m(x)||h(x)||g(x)||y(x)||b(x)}default:{const p=f.length;return m=>{for(let h=0;hZe.unit.operator_name(t.element),ui.DefaultName),Sr.pred.inSet(t=>Ze.chain.label_asym_id(t.element),e))})}function kee(e,t,n,r,i,o){const{spacegroup:s,ncsOperators:a}=e,c=[],{toFractional:u}=s.cell,l=v.transformMat4(v(),o,u),d=Ec.getSymmetryOperatorRef(s,t,n,r,i,l);if(a&&a.length)for(let f=0,p=a.length;f=0&&t[1]<=0&&n[1]>=0&&t[2]<=0&&n[2]>=0&&(a[0]=Ec.getSymmetryOperator(i,0,0,0,0));for(let c=0;cfunction Y5e(e,t,n){return $O.apply(this,arguments)}(f,l,d))},e.buildSymmetryRange=function i(l,d,f){return Oe.create("Build Symmetry",p=>function $5e(e,t,n,r){return WO.apply(this,arguments)}(p,l,d,f))},e.buildNcs=function o(l){return Oe.create("Build NCS",d=>function W5e(e,t){return qO.apply(this,arguments)}(d,l))},e.areUnitsEquivalent=s,e.UnitEquivalenceBuilder=a,e.computeTransformGroups=function c(l){const d=a();for(const p of l.units)d.add(p.id,p);const f=[];for(const p of d.groups)f.push(Ee.SymmetryGroup(p.map(m=>l.unitMap.get(m))));return f},e.areTransformGroupsEquivalent=function u(l,d){if(l.length!==d.length)return!1;for(let f=0,p=l.length;f0?[]:this.currentUnit}addElement(t){this.currentUnit[this.currentUnit.length]=t,this.elementCount++}addElementRange(t,n,r){for(let i=n;i1&&Ou(c);let d=a.getChild(je.ofSortedArray(c));const f=r.add(d.id,d);d!==f&&(d=f.applyOperator(d.id,d.conformation.operator,!0)),n[n.length]=d}return Ve.create(n,{parent:this.parent})}getStructure(){return this._getStructure(!1)}getStructureDeduplicate(){return this._getStructure(!0)}setSingletonLocation(t){const n=this.ids[0];t.unit=this.parent.unitMap.get(n),t.element=this.unitMap.get(n)[0]}get isEmpty(){return 0===this.elementCount}constructor(t,n){this.parent=t,this.isSorted=n,this.ids=[],this.unitMap=Lu.Mutable(),this.parentId=-1,this.currentUnit=[],this.elementCount=0}}function Bee(e,t){let n=1;for(;t--;)n*=e--;return n}class Q5e{move(){if(this.hasNext){let t=0,n=0,r=this.index;for(;r;r>>>=1,t++)1&r&&(this.value[n++]=this.array[t]);this.index=function Z5e(e){const t=e&-e,n=e+t;return n|((n&-n)/t>>1)-1}(this.index),this.hasNext=this.indexe?0:Bee(e,t)/Bee(t,t)}(t.length,n),this.maxIndex=1<0&&n<=t.length}}function Oee(e,t){const n=[],r=new Q5e(e,t);for(;r.hasNext;)n.push(r.move().slice());return n}const Xg=[],J5e={links:Xg,terminalLinks:Xg,elements:Xg,partialElements:Xg,getElementIndices:()=>Xg,getLinkIndices:()=>Xg,getTerminalLinkIndices:()=>Xg},cs=Bg("C"),P2=Bg("O"),e6e=[Hu.elementFingerprint([cs,cs,cs,P2]),Hu.elementFingerprint([cs,cs,cs,cs,P2]),Hu.elementFingerprint([cs,cs,cs,cs,cs,P2]),Hu.elementFingerprint([cs,cs,cs,cs,cs,cs,P2])];function t6e(e,t){let n=-1,r=-1,i=-1,o=-1;const{elements:s}=e,{type_symbol:a,label_atom_id:c}=e.model.atomicHierarchy.atoms,{b:u,offset:l}=e.bonds;for(let d=0,f=t.length;d0}get customPropertyDescriptors(){return this.state.customProps||(this.state.customProps=new Ql),this.state.customProps}get currentPropertyData(){return this.state.propertyData||(this.state.propertyData=Object.create(null)),this.state.propertyData}get inheritedPropertyData(){return this.parent?this.parent.currentPropertyData:this.currentPropertyData}get polymerResidueCount(){return-1===this.state.polymerResidueCount&&(this.state.polymerResidueCount=function v6e(e){const{units:t}=e;let n=0;for(let r=0,i=t.length;r0&&(n+=1);return n}(this)),this.state.polymerUnitCount}get uniqueElementCount(){return-1===this.state.uniqueElementCount&&(this.state.uniqueElementCount=function b6e(e){const{unitSymmetryGroups:t}=e;let n=0;for(let r=0,i=t.length;rsn.isCoarseGrained(t))}get isEmpty(){return 0===this.units.length}get hashCode(){return-1!==this.state.hashCode?this.state.hashCode:this.computeHash()}get transformHash(){return-1!==this.state.transformHash||(this.state.transformHash=ha(this.units.map(t=>t.id))),this.state.transformHash}computeHash(){let t=23;for(let n=0,r=this.units.length;n500?c6e:u6e}(t.length);n.reset();for(let r=0,i=t.length;rf+p.properties.saccharideComponentMap.size,0))return J5e;const t=[],n=[],r=[],i=[],o=new Map;function s(f,p,m){return`${f}|${p}|${m}`}function a(f,p){o.has(f)?o.get(f).push(p):o.set(f,[p])}function c(f,p){v.sub(r[f].geometry.direction,r[p].geometry.center,r[f].geometry.center),v.normalize(r[f].geometry.direction,r[f].geometry.direction)}const u=v();function l(f,p,m){const g=r[f].geometry;v.sub(g.direction,m.conformation.position(m.elements[p],u),g.center),v.normalize(g.direction,g.direction)}for(let f=0,p=e.units.length;f{h.connectedIndices.forEach(g=>{h.getEdges(g).forEach(({props:y,indexB:b})=>{if(!jn.isCovalent(y.flag))return;const x=e.unitMap.get(h.unitA),_=e.unitMap.get(h.unitB),S=d(x,g),A=d(_,b);if(S.length>0&&A.length>0){const E=S.length,w=A.length;for(let D=0,I=Math.max(E,w);Di[r.get(a.id)]+Fe.indexOf(a.elements,c)}}(this))}get model(){if(this.state.model)return this.state.model;if(this.state.representativeModel)return this.state.representativeModel;if(this.state.masterModel)return this.state.masterModel;const t=this.models;if(t.length>1)throw new Error("The structure is based on multiple models and has neither a master- nor a representative-model.");return this.state.model=t[0],this.state.model}get masterModel(){return this.state.masterModel}get representativeModel(){return this.state.representativeModel}hasElement(t){return!!this.unitMap.has(t.unit.id)&&je.has(this.unitMap.get(t.unit.id).elements,t.element)}getModelIndex(t){return this.models.indexOf(t)}remapModel(t){const{dynamicBonds:n,interUnitBonds:r,parent:i}=this.state,o=[];for(const s of this.unitSymmetryGroups){const a=s.units[0].remapModel(t,n);o.push(a);for(let c=1,u=s.units.length;c0?X[0].id:0;for(let ne=0,de=X.length;ne2e5||p(X,ne)?g(X,U,oe,We,de):oe.addUnit(0,X,de,U,We?Ee.Trait.MultiChain:Ee.Trait.None):oe.addUnit(0,X,de,U,We?Ee.Trait.MultiChain:Ee.Trait.None)}const K=X.coarseHierarchy;return K.isDefined&&(K.spheres.count>0&&y(oe,X,X.coarseHierarchy.spheres,1),K.gaussians.count>0&&y(oe,X,X.coarseHierarchy.gaussians,2)),oe.getStructure()}function p(X,J){const ce=X.atomicHierarchy.index.getEntityFromChain(J);return"water"===X.entities.data.type.value(ce)}function m(X,J){const ce=X.atomicHierarchy.index.getEntityFromChain(J);return"polymer"===X.entities.data.type.value(ce)}function h(X,J,ce,be,ae){const{x:me,y:oe,z:K}=X.atomicConformation,ne={x:me,y:oe,z:K,indices:J},de=rd(ne,pp(ne),8192),{offset:we,count:Le,array:We}=de.buckets,U=(be?Ee.Trait.MultiChain:Ee.Trait.None)|(we.length>1?Ee.Trait.Partitioned:Ee.Trait.None);ce.beginChainGroup();for(let Y=0,ge=we.length;Y1?Ee.Trait.Partitioned:Ee.Trait.None);ce.beginChainGroup();for(let $e=0,tt=Se.length;$eEe.conformationId(J)).join("|"))},e.areUnitIdsEqual=E,e.areUnitIdsAndIndicesEqual=function w(X,J){if(X===J)return!0;if(!E(X,J))return!1;for(let ce=0,be=X.units.length;ce=this.structure.units.length?this.hasNext=!1:(this.current.unit=this.structure.units[this.unitIndex],this.elements=this.current.unit.elements,this.maxIdx=this.elements.length-1,0===this.maxIdx&&(this.hasNext=this.unitIndex+10,this.hasNext&&(this.elements=J.units[0].elements,this.maxIdx=this.elements.length-1,this.current.unit=J.units[0])}};const N=v();function V(X,J,ce){const{elements:be,conformation:ae}=X,me=N;let oe=Number.MAX_VALUE;for(let K=0,ne=be.length;KJ.units[0].polymerElements.length>0)}let H;var X;e.distance=function L(X,J){if(0===X.elementCount||0===J.elementCount)return 0;const{units:ce}=X;let be=Number.MAX_VALUE;for(let ae=0,me=ce.length;aeae(ne)))return;const oe=X.lookup3d,K=v();for(const ne of X.units){if(!ae(ne))continue;const de=ne.boundary.sphere;v.transformMat4(K,de.center,ne.conformation.operator.matrix);const we=oe.findUnitIndices(K[0],K[1],K[2],de.radius+be);for(let Le=0;Le=We.id||!ae(We)||!me(ne,We)||(We.elements.length>=ne.elements.length?J(ne,We):J(We,ne))}}},e.eachAtomicHierarchyElement=function $(X,{chain:J,residue:ce,atom:be}){const ae=nt.create(X);for(const me of X.units){if(0!==me.kind)continue;ae.unit=me;const{elements:oe}=me,K=en.transientSegments(me.model.atomicHierarchy.chainAtomSegments,oe),ne=en.transientSegments(me.model.atomicHierarchy.residueAtomSegments,oe);for(;K.hasNext;){const de=K.move();if(J&&(ae.element=oe[de.start],J(ae)),ce||be)for(ne.setSegment(de);ne.hasNext;){const we=ne.move();if(ce&&(ae.element=oe[we.start],ce(ae)),be)for(let Le=we.start,We=we.end;Le=be.largeResidueCount*ce?function O(X,J){const ce=ee(X);return ce.length>=1&&ce[0].units.length>J.highSymmetryUnitCount}(X,be)?H.Huge:H.Gigantic:function q(X,J){const ce=ee(X);return 1===ce.length&&ce[0].units.length>2&&ce[0].units[0].polymerElements.length0)return!1;return!0}function o(Q){let fe=0;for(const{indices:X}of Q.elements)fe+="number"==typeof X?w6e(X):X.length;return fe}function u(Q){return r(Q)?Q:e(Q.structure,[{unit:Q.elements[0].unit,indices:Fe.ofSingleton(Fe.start(Q.elements[0].indices))}])}function _(Q){return Q.length>3&&je.isRange(Q)?Ce.ofRange(Q[0],Q[Q.length-1]):je.ofSortedArray(Q)}function S(Q,fe){const X=[],J=new Set;for(const ce of Q.elements)if(E(ce))X[X.length]=ce;else if(0===ce.unit.kind){const be=ce.unit.elements,ae=ce.unit.model.atomicHierarchy,{label_alt_id:me}=ce.unit.model.atomicHierarchy.atoms,{index:oe,offsets:K}=ae.residueAtomSegments,ne=[],de=ce.indices,we=Fe.size(de);let Le=0;for(;Le=0){const Ne=me.value(ge);(!fe||Y||!Ne||J.has(Ne))&&(ne[ne.length]=Re)}}}X[X.length]={unit:ce.unit,indices:_(ne)}}else X[X.length]=ce;return e(Q.structure,X)}function A(Q){switch(Q.kind){case 0:return Q.model.atomicHierarchy.chainAtomSegments;case 1:return Q.model.coarseHierarchy.spheres.chainElementSegments;case 2:return Q.model.coarseHierarchy.gaussians.chainElementSegments}}function E(Q){return Q.unit.elements.length===Fe.size(Q.indices)}function w(Q,fe,X){const{index:J}=A(Q),ce=Q.elements;let be=0;for(let me=0,oe=ce.length;me0&&(X[X.length]={unit:Q,indices:_(ae)})}function D(Q,fe,X,J,ce){const{index:be}=A(Q.elements[0].unit),ae=new Set;for(let me=fe;me({unit:fe,indices:Fe.ofBounds(0,fe.elements.length)})))},e.none=function a(Q){return e(Q,[])},e.getFirstLocation=function c(Q,fe){if(r(Q))return;const X=Q.elements[0].unit,J=X.elements[Fe.getAt(Q.elements[0].indices,0)];return fe?(fe.structure=Q.structure,fe.unit=Q.elements[0].unit,fe.element=J,fe):nt.create(Q.structure,X,J)},e.firstElement=u,e.firstResidue=function l(Q){return r(Q)?Q:S(u(Q))},e.firstChain=function d(Q){return r(Q)?Q:I(u(Q))},e.toStructure=function f(Q){const fe=[];for(const X of Q.elements){const{unit:J,indices:ce}=X,be=new Int32Array(Fe.size(ce));Fe.forEach(ce,(ae,me)=>be[me]=J.elements[ae]),fe.push(J.getChild(je.ofSortedArray(be)))}return Ve.create(fe,{parent:Q.structure.parent})},e.forEachLocation=function p(Q,fe){if(e.isEmpty(Q))return;const X=nt.create(Q.structure);for(const J of Q.elements){const{unit:ce,indices:be}=J;X.unit=ce;const{elements:ae}=J.unit;for(let me=0,oe=Fe.size(be);me{if(!fe.unitMap.has(J.unit.id))return;const ce=fe.unitMap.get(J.unit.id),be=Fe.indexedIntersect(J.indices,J.unit.elements,ce.elements);Fe.size(be)>0&&X.push({unit:ce,indices:be})}),e(fe,X)},e.union=function h(Q,fe){if(Q.elements.length>fe.elements.length)return h(fe,Q);if(e.isEmpty(Q))return fe;const X=new Map;for(const ce of Q.elements)X.set(ce.unit.id,ce.indices);const J=[];for(const ce of fe.elements)X.has(ce.unit.id)?(J[J.length]={unit:ce.unit,indices:Fe.union(X.get(ce.unit.id),ce.indices)},X.delete(ce.unit.id)):J[J.length]=ce;return X.forEach((ce,be)=>{J[J.length]={unit:Q.structure.unitMap.get(be),indices:ce}}),e(Q.structure,J)},e.subtract=function g(Q,fe){const X=new Map;for(const ce of fe.elements)X.set(ce.unit.id,ce.indices);const J=[];for(const ce of Q.elements)if(X.has(ce.unit.id)){const be=Fe.subtract(ce.indices,X.get(ce.unit.id));if(0===Fe.size(be))continue;J[J.length]={unit:ce.unit,indices:be}}else J[J.length]=ce;return e(Q.structure,J)},e.intersect=function y(Q,fe){const X=new Map;for(const ce of Q.elements)X.set(ce.unit.id,ce.indices);const J=[];for(const ce of fe.elements){if(!X.has(ce.unit.id))continue;const be=Fe.intersect(X.get(ce.unit.id),ce.indices);0!==Fe.size(be)&&(J[J.length]={unit:ce.unit,indices:be})}return e(Q.structure,J)},e.areIntersecting=function b(Q,fe){if(Q.elements.length>fe.elements.length)return b(fe,Q);if(e.isEmpty(Q))return e.isEmpty(fe);const X=new Map;for(const J of Q.elements)X.set(J.unit.id,J.indices);for(const J of fe.elements)if(X.has(J.unit.id)&&Fe.areIntersecting(X.get(J.unit.id),J.indices))return!0;return!1},e.isSubset=function x(Q,fe){if(e.isEmpty(Q))return e.isEmpty(fe);const X=new Map;for(const ce of Q.elements)X.set(ce.unit.id,ce.indices);let J=!1;for(const ce of fe.elements)if(X.has(ce.unit.id)){if(!Fe.isSubset(X.get(ce.unit.id),ce.indices))return!1;J=!0}return J},e.extendToWholeResidues=S,e.extendToWholeChains=I,e.extendToWholeEntities=function T(Q){const fe=[],X=nt.create(Q.structure),J=new Set,{units:ce}=Q.structure;for(let be=0,ae=Q.elements.length;be12)be[be.length]=fe[K],be[be.length]=fe[ne-1];else for(let de=K;de{fe+=o(ce)});const X=new Float32Array(3*fe);let J=0;return Q.forEach(ce=>{$(ce,X,J),J+=3*o(ce)}),nd.ofPositions(X)},e.toExpression=function H(Q){if(e.isEmpty(Q))return ue.struct.generator.empty();const fe=Q.structure.models,X=new Map;for(const me of Q.elements){const{indices:oe}=me,{elements:K}=me.unit,ne=me.unit.conformation.operator.name;let de;X.has(ne)?de=X.get(ne).xs:(de=kr.create(),X.set(ne,{modelLabel:me.unit.model.label,modelIndex:me.unit.model.modelNum,xs:de}));for(let we=0,Le=Fe.size(oe);we1,oe.modelLabel,oe.modelIndex))}const be=new Map;for(let me=0,oe=J.length;me{const{ranges:oe,set:K}=me.atom,{opName:ne}=me.chain,de=ue.struct.atomProperty.core.operatorName(),we=ue.struct.atomProperty.core.sourceIndex(),Le=[];K.length>0&&(Le[Le.length]=ue.core.set.has([ue.core.type.set(K),we]));for(let We=0,U=oe.length/2;We1?ue.core.logic.or(Le):Le[0],"chain-test":ne.length>1?ue.core.set.has([ue.core.type.set(ne),de]):ue.core.rel.eq([de,ne[0]]),"entity-test":ue.core.logic.and([ue.core.rel.eq([ue.struct.atomProperty.core.modelLabel(),We]),ue.core.rel.eq([ue.struct.atomProperty.core.modelIndex(),U])])}))}else ae.push(ue.struct.generator.atomGroups({"atom-test":Le.length>1?ue.core.logic.or(Le):Le[0],"chain-test":ne.length>1?ue.core.set.has([ue.core.type.set(ne),de]):ue.core.rel.eq([de,ne[0]])}))}),ue.struct.modifier.union([1===ae.length?ae[0]:ue.struct.combinator.merge(ae.map(me=>ue.struct.modifier.union([me])))])}}(De||(De={})),function(e){function t(){return{elementCount:0,conformationCount:0,residueCount:0,chainCount:0,unitCount:0,structureCount:0,firstElementLoc:nt.create(void 0),firstConformationLoc:nt.create(void 0),firstResidueLoc:nt.create(void 0),firstChainLoc:nt.create(void 0),firstUnitLoc:nt.create(void 0),firstStructureLoc:nt.create(void 0)}}function n(c,u,l){const d=c.get(u)||0;c.set(u,d+l)}function r(c,u,l){const{indices:d,unit:f}=l,{elements:p}=f,m=Fe.size(d),h=new Map,g=new Map;if(m>0&&nt.set(c.firstElementLoc,u,f,p[Fe.start(d)]),m===p.length)c.unitCount+=1,1===c.unitCount&&nt.set(c.firstUnitLoc,u,f,p[Fe.start(d)]);else if(1===m){if(Ee.Traits.is(f.traits,Ee.Trait.MultiChain))return;c.elementCount+=1,1===c.elementCount&&nt.set(c.firstElementLoc,u,f,p[Fe.start(d)])}else if(Ee.isAtomic(f)){const{index:y,offsets:b}=f.model.atomicHierarchy.residueAtomSegments,{label_alt_id:x}=f.model.atomicHierarchy.atoms;let _=0;for(;_{if(g.get(D)===w){if(""!==D&&(c.conformationCount+=1,1===c.conformationCount))for(let I=b[E],R=b[E+1];I{g[_+1]-g[_]===x&&(c.chainCount+=1,1===c.chainCount&&(b=_))}),!(b<0))for(let x=d;x(i in c[o]||(c[o][i]={props:{...C.getDefaultValues(r.getParams(c))},data:Gh.create(void 0)}),c[o][i]),a=(c,u,l)=>{const d=s(c);c[o][i]={props:u,data:Gh.withValue(d.data,l)}};return{label:r.label,descriptor:r.descriptor,isHidden:r.isHidden,getParams:c=>{const u=C.clone(r.getParams(c));return C.setDefaultValues(u,s(c).props),u},defaultParams:r.defaultParams,isApplicable:r.isApplicable,attach:(c=ie(function*(u,l,d={},f){f&&l.customProperties.reference(r.descriptor,!0);const p=s(l),m=C.merge(r.defaultParams,p.props,d);if(p.data.value&&C.areEqual(r.defaultParams,p.props,m))return;const{value:h,assets:g}=yield r.obtain(u,l,m);l.customProperties.add(r.descriptor),l.customProperties.assets(r.descriptor,g),a(l,m,h)}),function(l,d){return c.apply(this,arguments)}),ref:(c,u)=>c.customProperties.reference(r.descriptor,u),get:c=>{var u;return null===(u=s(c))||void 0===u?void 0:u.data},set:(c,u={},l)=>{const d=s(c),f=C.merge(r.defaultParams,d.props,u);C.areEqual(r.defaultParams,d.props,f)||(a(c,f,l),c.customProperties.assets(r.descriptor))},props:c=>s(c).props};var c}e.createProvider=t,e.createSimple=function n(r,i,o){const s={value:C.Value(o,{isHidden:!0})};return t({label:zu(r),descriptor:au({name:r}),isHidden:!0,type:i,defaultParams:s,getParams:()=>({value:C.Value(o,{isHidden:!0})}),isApplicable:()=>!0,obtain:(a=ie(function*(c,u,l){return{...C.getDefaultValues(s),...l}}),function(u,l,d){return a.apply(this,arguments)})});var a}}(Kg||(Kg={})),function(e){var o;function t(o){if(!Er.is(o.sourceData))return!1;const{pdbx_sifts_xref_db_name:s,pdbx_sifts_xref_db_acc:a,pdbx_sifts_xref_db_num:c,pdbx_sifts_xref_db_res:u}=o.sourceData.data.db.atom_site;return s.isDefined&&a.isDefined&&c.isDefined&&u.isDefined}function i(o){if(!Er.is(o.sourceData))return;const{pdbx_sifts_xref_db_name:s,pdbx_sifts_xref_db_acc:a,pdbx_sifts_xref_db_num:c,pdbx_sifts_xref_db_res:u}=o.sourceData.data.db.atom_site;if(!(s.isDefined&&a.isDefined&&c.isDefined&&u.isDefined))return;const{atomSourceIndex:l}=o.atomicHierarchy,{count:d,offsets:f}=o.atomicHierarchy.residueAtomSegments,p=new Array(d),m=new Array(d),h=new Array(d),g=new Array(d);for(let y=0;y({}),isApplicable:o=>t(o),obtain:(o=ie(function*(s,a){return{value:i(a)}}),function(a,c){return o.apply(this,arguments)})}),e.isAvailable=t,e.getKey=function n(o){const s=o.unit.model,a=e.Provider.get(s).value;return a?a.accession[s.atomicHierarchy.residueAtomSegments.index[o.element]]:""},e.getLabel=function r(o){const s=o.unit.model,a=e.Provider.get(s).value;if(!a)return;const c=s.atomicHierarchy.residueAtomSegments.index[o.element],u=a.dbName[c];return u?`${u} ${a.accession[c]} ${a.num[c]} ${a.residue[c]}`:void 0}}(sf||(sf={}));function M2(e,t){if(Er.is(e.sourceData))return e.sourceData.data.db[t]}function Hee(e){if(0===e.length)return[];if(1===e.length)return e[0].entityIndices;const t=kr.create();for(const n of e)for(const r of n.entityIndices)kr.add(t,r,r);return Ou(t.array),t.array}function Zu(e,t){return{name:e,instance({structures:n}){if(t&&!t(n[0]))return Bi.Category.Empty;const r=n[0].model;if(!Er.is(r.sourceData))return Bi.Category.Empty;const i=r.sourceData.data.db[e];return i&&i._rowCount?Bi.Category.ofTable(i):Bi.Category.Empty}}}var qee=Bi.Category;XO("struct_asym"),XO("entity_poly"),XO("entity_poly_seq");function XO(e){return{name:e,instance:({structures:t,cache:n})=>function W6e(e,t,n){const r=M2(e[0].model,t);if(!r)return qee.Empty;const{entity_id:i}=r,o=n.uniqueEntityIds||(n.uniqueEntityIds=function O6e(e){if(0===e.length)return new Set;const t=e[0].model.entities.data.id;return new Set(Hee(e).map(n=>t.value(n)))}(e)),s=te.indicesOf(i,a=>o.has(a));return qee.ofTable(r,s)}(t,e,n)}}var KO;!function(e){e.create=function t(n){const r=Array.isArray(n)?n:[n];return{structures:r,firstModel:r[0].model,cache:Object.create(null)}}}(KO||(KO={}));function ZO(e){return e.units.every(t=>t.conformation.operator.isIdentity)}function QO(e){return ZO(e)&&e.units.every(t=>!t.conformation.operator.assembly&&!t.conformation.operator.suffix)}var JO;Zu("entry"),Zu("exptl"),Zu("cell",ZO),Zu("symmetry",ZO),Zu("pdbx_struct_assembly",QO),Zu("pdbx_struct_assembly_gen",QO),Zu("pdbx_struct_oper_list",QO),Zu("pdbx_entity_branch"),Zu("pdbx_entity_branch_link"),Zu("pdbx_branch_scheme"),Zu("struct_conn"),Zu("atom_sites"),function(e){e.AtomSitePositionsFieldNames=new Set(["id","Cartn_x","Cartn_y","Cartn_z"])}(JO||(JO={}));const Q6e={molstar_atom_site_operator_mapping:{label_asym_id:te.Schema.Str(),auth_asym_id:te.Schema.Str(),operator_name:te.Schema.Str(),suffix:te.Schema.Str(),assembly_id:te.Schema.Str(),assembly_operator_id:te.Schema.Int(),symmetry_operator_index:te.Schema.Int(),symmetry_hkl:te.Schema.Vector(3),ncs_id:te.Schema.Int()}},$ee=(e,t)=>typeof t[e].operator.assembly>"u"?1:0,e4=(e,t)=>-1===t[e].operator.spgrOp?1:0;function tv(e,t){return t?1===t.length?uu(t.charCodeAt(0),e):2===t.length?uu(t.charCodeAt(0),uu(t.charCodeAt(1),e)):`${e} ${t}`:e}function r8e(e,t,n,r){if(e.has(t)){const i=e.get(t);i.has(n)||i.set(n,r)}else{const i=new Map;e.set(t,i),i.set(n,r)}}function i8e(e){throw new Error(`Missing entity entry for entity id '${e}'.`)}Bi.fields().str("label_asym_id",(e,t)=>t[e].label_asym_id).str("auth_asym_id",(e,t)=>t[e].auth_asym_id).str("operator_name",(e,t)=>t[e].operator.name).str("suffix",(e,t)=>t[e].operator.suffix).str("assembly_id",(e,t)=>{var n;return(null===(n=t[e].operator.assembly)||void 0===n?void 0:n.id)||""},{valueKind:$ee}).int("assembly_operator_id",(e,t)=>{var n;return(null===(n=t[e].operator.assembly)||void 0===n?void 0:n.operId)||0},{valueKind:$ee}).int("symmetry_operator_index",(e,t)=>t[e].operator.spgrOp,{valueKind:e4}).vec("symmetry_hkl",[(e,t)=>t[e].operator.hkl[0],(e,t)=>t[e].operator.hkl[1],(e,t)=>t[e].operator.hkl[2]],{valueKind:e4}).int("ncs_id",(e,t)=>t[e].operator.ncsId,{valueKind:e4}).getFields();const R2=lO.EmptyResidueKey();class s8e{getEntityFromChain(t){return this.map.chain_index_entity_index[t]}findEntity(t){const n=this.map.label_asym_id.get(t);return void 0!==n?n:-1}findChainLabel(t){const n=this.entityIndex(t.label_entity_id);if(n<0||!this.map.entity_index_label_asym_id.has(n))return-1;const r=this.map.entity_index_label_asym_id.get(n);return r&&r.has(t.label_asym_id)?r.get(t.label_asym_id):-1}findChainAuth(t){if(!this.map.auth_asym_id_auth_seq_id.has(t.auth_asym_id))return-1;const n=this.map.auth_asym_id_auth_seq_id.get(t.auth_asym_id);return n.has(t.auth_seq_id)?n.get(t.auth_seq_id):-1}findResidue(t,n,r,i){let o;1===arguments.length?o=t:(R2.label_entity_id=t,R2.label_asym_id=n,R2.auth_seq_id=r,R2.pdbx_PDB_ins_code=i,o=R2);const s=this.findChainLabel(o);if(s<0)return-1;const a=this.map.chain_index_auth_seq_id.get(s),c=tv(o.auth_seq_id,o.pdbx_PDB_ins_code||"");return a.has(c)?a.get(c):-1}findResidueLabel(t){const n=this.findChainLabel(t);if(n<0)return-1;const r=this.map.chain_index_label_seq_id.get(n),i=tv(t.label_seq_id,t.pdbx_PDB_ins_code||"");return r.has(i)?r.get(i):-1}findResidueAuth(t){const n=this.findChainAuth(t);if(n<0)return-1;const r=this.map.chain_index_auth_seq_id.get(n),i=tv(t.auth_seq_id,t.pdbx_PDB_ins_code||"");return r.has(i)?r.get(i):-1}findResidueInsertion(t){const n=this.findChainLabel(t);if(n<0)return-1;const r=this.map.chain_index_label_seq_id.get(n),i=tv(t.label_seq_id,t.pdbx_PDB_ins_code||"");if(r.has(i))return r.get(i);const o=je.findPredecessorIndex(this.map.label_seq_id,t.label_seq_id),s=Gg.chainStartResidueIndex(this.map.segments,n);if(o=a?a:o}findAtom(t){const n=this.findResidue(t);return n<0?-1:typeof t.label_alt_id>"u"?t4(this.residueOffsets[n],this.residueOffsets[n+1],this.map.label_atom_id,t.label_atom_id):n4(this.residueOffsets[n],this.residueOffsets[n+1],this.map.label_atom_id,this.map.label_alt_id,t.label_atom_id,t.label_alt_id)}findAtomAuth(t){const n=this.findResidueAuth(t);return n<0?-1:typeof t.label_alt_id>"u"?t4(this.residueOffsets[n],this.residueOffsets[n+1],this.map.auth_atom_id,t.auth_atom_id):n4(this.residueOffsets[n],this.residueOffsets[n+1],this.map.auth_atom_id,this.map.label_alt_id,t.auth_atom_id,t.label_alt_id)}findAtomOnResidue(t,n,r){return typeof r>"u"?t4(this.residueOffsets[t],this.residueOffsets[t+1],this.map.label_atom_id,n):n4(this.residueOffsets[t],this.residueOffsets[t+1],this.map.label_atom_id,this.map.label_alt_id,n,r)}findAtomsOnResidue(t,n){return function a8e(e,t,n,r){for(let i=e;i=c[u+1]&&(u+=1,l=0),s[d]=++l;i.label_seq_id=te.ofIntArray(s)}return Xn.columnToArray(i,"label_seq_id",Int32Array),Xn.columnToArray(i,"auth_seq_id",Int32Array),{atoms:r,residues:i,chains:o,atomSourceIndex:t}}(e,t,s),c=function h8e(e,t){const n=new Map;if(!Er.is(t))return n;const{molstar_atom_site_operator_mapping:r}=Zd(Q6e,t.data.frame);if(0===r._rowCount)return n;const i=new Map,o=new Map;for(let l=0;l-1,findChainKey:()=>-1,getEntityFromChain:()=>-1,count:0,entity_id:te.Undefined(0,te.Schema.str),asym_id:te.Undefined(0,te.Schema.str),seq_id_begin:te.Undefined(0,te.Schema.int),seq_id_end:te.Undefined(0,te.Schema.int),chainElementSegments:en.create([]),polymerRanges:wr.ofSortedRanges([]),gapRanges:wr.ofSortedRanges([])};var Kee=function(e){return e.Empty={isDefined:!1,spheres:Xee,gaussians:Xee},e}(Kee||{});function g8e(e,t,n){if(e.has(t))return e.get(t);const r=n.index++;return e.set(t,r),r}function y8e(e,t){if(e.has(t))return e.get(t);const n=new Map;return e.set(t,n),n}function v8e(e){throw new Error(`Missing entity entry for entity id '${e}'.`)}function Zee(e,t){const{entity_id:n,asym_id:r,seq_id_begin:i,seq_id_end:o,count:s,chainElementSegments:a}=e,c=new Map,u=new Map,l={index:0},d=new Int32Array(s),f=new Int32Array(s),p=new Int32Array(a.count);for(let y=0;y{const c=r(s);if(c<0)return-1;const u=t.get(c);return u.has(a)?u.get(a):-1},findSequenceKey:(s,a,c)=>{const u=r(s);if(u<0)return-1;const l=t.get(u);if(void 0===l)return-1;const d=l.get(a);if(void 0===d)return-1;const f=n.get(d),{elementIndices:p,seqRanges:m}=f,h=wr.firstIntersectionIndex(m,Fe.ofSingleton(c));return-1!==h?p[h]:-1}}}(t,u,c);return{chainKey:d,entityKey:f,findSequenceKey:h,findChainKey:m,getEntityFromChain:y=>p[y]}}function Qee(e,t){const n=[],r=[],i=en.transientSegments(e.chainElementSegments,Ce.ofBounds(0,e.count)),{seq_id_begin:o,seq_id_end:s}=e;for(;i.hasNext;){const{start:a,end:c}=i.move();let u=-1,l=-1;for(let d=a;d1&&(n.push(u,d-1),r.push(d-1,d),u=d),d===c-1&&n.push(u,d),l=f}}return{polymerRanges:wr.ofSortedRanges(n),gapRanges:wr.ofSortedRanges(r)}}const Jee={hierarchy:Kee.Empty,conformation:void 0};function C8e(e,t,n){const r=[0];for(let i=1,o=e.rowCount;i{if(t.has(n))return t.get(n);const r=e(n);return t.set(n,r),r}}function T8e(e){const t=new Map,n=(i,o,s)=>`${i}|${o}|${s}`,r=e.pdbx_unobs_or_zero_occ_residues;for(let i=0,o=r._rowCount;it.has(n(i,o,s)),get:(i,o,s)=>t.get(n(i,o,s)),size:t.size}}function D8e(e){const t=new Map;if(e.chem_comp._rowCount>0){const{id:n}=e.chem_comp;for(let r=0,i=n.rowCount;r{t.set(r,function sFe(e){return{formula:"",formula_weight:0,id:e,name:e,mon_nstd_flag:$b.has(e)?"y":"n",pdbx_synonyms:[],type:KQ(e)}}(r))});return t}function E8e(e){const t=new Map;if(e.pdbx_chem_comp_identifier._rowCount>0){const{comp_id:n,type:r,identifier:i}=e.pdbx_chem_comp_identifier;for(let o=0,s=n.rowCount;o0){const{id:n,type:r}=e.chem_comp;for(let i=0,o=n.rowCount;i{!t.has(i)&&n.has(i)&&t.set(i,r)})}return t}!function(e){let t;var u;(u=t=e.Kind||(e.Kind={})).Protein="protein",u.RNA="RNA",u.DNA="DNA",u.Generic="generic",e.getSequenceString=function n(u){const l=u.code.toArray();return(l instanceof Array?l:Array.from(l)).join("")},e.ofResidueNames=function o(u,l){if(0===l.rowCount)throw new Error("cannot be empty");const d=function r(u){for(let l=0,d=Math.min(u.rowCount,10);l"X";break;default:Rr()}return l&&l.size>0?f=>{const p=d(f);return"X"===p&&l.has(f)?d(l.get(f)):p}:d}(l),m=[],h=[],g=[],y=new Map;let b=0;const x=new Map;for(let S=0,A=f.rowCount;S{const I=p(D);return"X"===I?D:I});_[S]=`(${w.join("|")})`}else _[S]="X"===m[S]?h[S]:m[S]}this.length=b,this.code=te.ofStringArray(m),this.compId=te.ofStringArray(h),this.seqId=te.ofIntArray(g),this.label=te.ofStringArray(_),this.microHet=y,this.indexMap=x}}e.ofSequenceRanges=function a(u,l){return new c(t.Generic,u,l)};class c{index(l){return l-this.minSeqId}constructor(l,d,f){this.kind=l,this.seqIdStart=d,this.seqIdEnd=f,this.microHet=new Map;let p=0,m=Number.MAX_SAFE_INTEGER;for(let g=0,y=this.seqIdStart.rowCount;gg+m+1,rowCount:h,schema:te.Schema.int}),this.compId=te.ofConst("",h,te.Schema.str),this.length=h,this.minSeqId=m}}}(k2||(k2={})),function(e){const t={byEntityKey:{},sequences:[]};function n(...a){const c=[],u={};for(let l=0,d=a.length;l{const t=new Set,{label_comp_id:n,auth_comp_id:r}=e.atom_site,i=n.isDefined?n:r;for(let o=0,s=i.rowCount;o0?yield function F8e(e,t,n,r){return c4.apply(this,arguments)}(n,e,r,t):yield function N8e(e,t,n,r){return s4.apply(this,arguments)}(n,e,r,t);for(let o=0;o0?i[i.length-1]:void 0);i.push(d),a=c}}return i}),s4.apply(this,arguments)}function a4(e,t){const n=new Map,r=e._rowCount;let i=0;for(;iF._dynamicPropertyData[u]||{index:0,size:1},set:(F,G)=>F._dynamicPropertyData[u]=G};const l="__AsymIdCount__";e.AsymIdCount={get(F){if(F._dynamicPropertyData[l])return F._dynamicPropertyData[l];const G=function RMe(e){const t=new Set,n=new Set;return e.properties.structAsymMap.forEach(({auth_id:r},i)=>{t.add(r),n.add(i)}),{auth:t.size,label:n.size}}(F);return F._dynamicPropertyData[l]=G,G}},e.AsymIdOffset=Kg.createSimple("asym_id_offset","static"),e.Index=Kg.createSimple("index","static"),e.MaxIndex=Kg.createSimple("max_index","static"),e.getRoot=function d(F){return F.parent||F},e.areHierarchiesEqual=function f(F,G){return F.atomicHierarchy===G.atomicHierarchy&&F.coarseHierarchy===G.coarseHierarchy};const p="__CoordinatesHistory__";e.CoordinatesHistory={get:F=>F._staticPropertyData[p],set:(F,G)=>F._staticPropertyData[p]=G};const m="__CoarseGrained__";function h(F){let G=e.CoarseGrained.get(F);if(void 0===G){let L=0;const{polymerType:z}=F.atomicHierarchy.derived.residue;for(let q=0;qF._staticPropertyData[m],set:(F,G)=>F._staticPropertyData[m]=G},e.isCoarseGrained=h,e.hasCarbohydrate=function g(F){return F.properties.saccharideComponentMap.size>0},e.hasProtein=function y(F){const{subtype:G}=F.entities;for(let L=0,z=G.rowCount;L=0)return!0;return!1}function I(F){if(!Er.is(F.sourceData))return!1;const{db:G}=F.sourceData.data;for(let L=0;L=0)return!0;return!1}function T(F){if(!Er.is(F.sourceData)||!D(F))return!1;const{db:G}=F.sourceData.data,{status_code_sf:L}=G.pdbx_database_status;return L.isDefined&&"REL"===L.value(0)}function M(F){if(!Er.is(F.sourceData))return!1;const{db:G}=F.sourceData.data,{db_name:L,content_type:z}=G.pdbx_database_related;for(let j=0,Z=G.pdbx_database_related._rowCount;j=0)return!0;return!1},e.hasXrayMap=T,e.hasEmMap=M,e.hasDensityMap=N,e.probablyHasDensityMap=function V(F){if(!Er.is(F.sourceData))return!1;const{db:G}=F.sourceData.data;return N(F)||_(F)&&(!G.exptl.method.isDefined||D(F)&&(!G.pdbx_database_status.status_code_sf.isDefined||2===G.pdbx_database_status.status_code_sf.valueKind(0))||I(F)&&!G.pdbx_database_related.db_name.isDefined)}}(sn||(sn={})),function(e){e.getCifDataSource=function t(d,f,p){if(!f)return{rowCount:0};if(p&&p[f.id])return p[f.id];const m=f.getElements(d),h={data:m,rowCount:m.elements.length};return p&&(p[f.id]=h),h},e.fromAtomMap=function n(d){return new mte(d)},e.fromAtomArray=function r(d){return new mte(u4(d))};const i=d=>d.atomicHierarchy.residueAtomSegments;e.fromResidueMap=function o(d){return new RT("residue",d,i,0)},e.fromResidueArray=function s(d){return new RT("residue",u4(d),i,0)};const a=d=>d.atomicHierarchy.chainAtomSegments;e.fromChainMap=function c(d){return new RT("chain",d,a,0)},e.fromChainArray=function u(d){return new RT("chain",u4(d),a,0)},e.fromEntityMap=function l(d){return new B8e(d)}}(hte||(hte={}));class RT{has(t){return this.map.has(t)}get(t){return this.map.get(t)}getStructureElements(t){const n=t.models;if(1!==n.length)throw new Error("Only works on structures with a single model.");const r=new Set,i=t.unitSymmetryGroups,o=[],s=this.segmentGetter(n[0]);for(const a of i){const c=a.units[0];if(c.kind!==this.kind)continue;const u=en.transientSegments(s,c.elements);for(;u.hasNext;){const l=u.move();!this.has(l.index)||r.has(l.index)||(r.add(l.index),o[o.length]=nt.create(t,c,c.elements[l.start]))}}return o.sort((a,c)=>a.element-c.element),o}getElements(t){const n=this.segmentGetter(t.model).index,r=this.getStructureElements(t);return{elements:r,property:i=>this.get(n[r[i].element])}}constructor(t,n,r,i){this.level=t,this.map=n,this.segmentGetter=r,this.id=Hr.create22(),this.kind=i}}class mte{has(t){return this.map.has(t)}get(t){return this.map.get(t)}getStructureElements(t){if(1!==t.models.length)throw new Error("Only works on structures with a single model.");const r=new Set,i=t.unitSymmetryGroups,o=[];for(const s of i){const a=s.units[0];if(a.kind!==this.kind)continue;const c=a.elements;for(let u=0,l=c.length;us.element-a.element),o}getElements(t){const n=this.getStructureElements(t);return{elements:n,property:r=>this.get(n[r].element)}}constructor(t){this.map=t,this.id=Hr.create22(),this.level="atom",this.kind=0}}class B8e{has(t){return this.map.has(t)}get(t){return this.map.get(t)}getStructureElements(t){const n=t.models;if(1!==n.length)throw new Error("Only works on structures with a single model.");const r=n[0].atomicHierarchy.index,i=new Set,o=t.unitSymmetryGroups,s=[],a=n[0].atomicHierarchy.chainAtomSegments;for(const c of o){const u=c.units[0];if(u.kind!==this.kind)continue;const l=en.transientSegments(a,u.elements);for(;l.hasNext;){const d=l.move(),f=r.getEntityFromChain(d.index);!this.has(f)||i.has(f)||(i.add(f),s[s.length]=nt.create(t,u,u.elements[d.start]))}}return s.sort((c,u)=>c.element-u.element),s}getElements(t){const n=this.getStructureElements(t),r=t.model.atomicHierarchy.chainAtomSegments.index,i=t.model.atomicHierarchy.index;return{elements:n,property:o=>this.get(i.getEntityFromChain(r[n[o].element]))}}constructor(t){this.map=t,this.id=Hr.create22(),this.level="entity",this.kind=0}}!function(e){function t(a){const c=new DataView(a.buffer);return Object.assign(a.subarray(0),{readInt8:u=>c.getInt8(u),readUInt8:u=>c.getUint8(u),writeInt8:(u,l)=>c.setInt8(l,u),writeUInt8:(u,l)=>c.setUint8(l,u),readInt16LE:u=>c.getInt16(u,!0),readInt32LE:u=>c.getInt32(u,!0),readUInt16LE:u=>c.getUint16(u,!0),readUInt32LE:u=>c.getUint32(u,!0),readFloatLE:u=>c.getFloat32(u,!0),readDoubleLE:u=>c.getFloat64(u,!0),writeInt16LE:(u,l)=>c.setInt16(l,u,!0),writeInt32LE:(u,l)=>c.setInt32(l,u,!0),writeUInt16LE:(u,l)=>c.setUint16(l,u,!0),writeUInt32LE:(u,l)=>c.setUint32(l,u,!0),writeFloatLE:(u,l)=>c.setFloat32(l,u,!0),writeDoubleLE:(u,l)=>c.setFloat64(l,u,!0),readInt16BE:u=>c.getInt16(u,!1),readInt32BE:u=>c.getInt32(u,!1),readUInt16BE:u=>c.getUint16(u,!1),readUInt32BE:u=>c.getUint32(u,!1),readFloatBE:u=>c.getFloat32(u,!1),readDoubleBE:u=>c.getFloat64(u,!1),writeInt16BE:(u,l)=>c.setInt16(l,u,!1),writeInt32BE:(u,l)=>c.setInt32(l,u,!1),writeUInt16BE:(u,l)=>c.setUint16(l,u,!1),writeUInt32BE:(u,l)=>c.setUint32(l,u,!1),writeFloatBE:(u,l)=>c.setFloat32(l,u,!1),writeDoubleBE:(u,l)=>c.setFloat64(l,u,!1),copy:(u,l,d,f)=>(l=Ds(l,0),d=Ds(d,0),f=Ds(f,a.length),u.set(a.subarray(d,f),l),f-d)})}function i(a,c,u,l,d){for(let f=0,p=u;f>8&255}},e.ensureLittleEndian=function s(a,c,u,l,d){e.IsNativeEndianLittle||!u||l<=1||i(a,c,u,l,d)}}(cd||(cd={})),function(e){e.fromBuffer=function t(n,r){return{name:r,readBuffer:(i,o,s,a)=>{let c,u;if("number"==typeof o){s=Ds(s,o);const l=i,d=Math.min(n.length,l+s);c=d-l,u=cd.fromUint8Array(new Uint8Array(n.buffer,l,d-l))}else{s=Ds(s,o.length);const l=i,d=Math.min(n.length,l+s);o.set(n.subarray(l,d),a),c=d-l,u=o}return s!==c&&console.warn(`byteCount ${s} and bytesRead ${c} differ`),Promise.resolve({bytesRead:c,buffer:u})},writeBuffer:(i,o,s)=>(s=Ds(s,o.length),console.error(".writeBuffer not implemented for FileHandle.fromBuffer"),Promise.resolve(0)),writeBufferSync:(i,o,s)=>(s=Ds(s,o.length),console.error(".writeSync not implemented for FileHandle.fromBuffer"),0),close:Ag}}}(kT||(kT={}));var us=function(e){return e.Float32="float32",e.Int8="int8",e.Int16="int16",e.Uint16="uint16",e}(us||{});function gte(e){return e===us.Float32?4:e===us.Int16||e===us.Uint16?2:1}function O8e(e,t,n=0,r){return e===us.Float32?new Float32Array(t,n,r):e===us.Int16?new Int16Array(t,n,r):e===us.Uint16?new Uint16Array(t,n,r):new Int8Array(t,n,r)}function l4(){return l4=ie(function*(e,t,n,r,i,o){return yield t.readBuffer(n,e.readBuffer,r,i),e.elementByteSize>1&&(void 0!==o&&o!==cd.IsNativeEndianLittle||!cd.IsNativeEndianLittle)&&cd.flipByteOrder(e.readBuffer,e.valuesBuffer,r,e.elementByteSize,i),e.values}),l4.apply(this,arguments)}function d4(){return d4=ie(function*(e){const{buffer:n}=yield e.readBuffer(0,1024),r=String.fromCharCode(n.readUInt8(208),n.readUInt8(209),n.readUInt8(210),n.readUInt8(211));if("MAP "!==r)throw new Error('ccp4 format error, missing "MAP " string');const i=[n.readUInt8(212),n.readUInt8(213)];let o=!1;68===i[0]&&65===i[1]?o=!0:17===i[0]&&17===i[1]?o=!1:n.readInt32LE(12)<=16&&(o=!0);const s=o?u=>n.readInt32LE(4*u):u=>n.readInt32BE(4*u),a=o?u=>n.readFloatLE(4*u):u=>n.readFloatBE(4*u);return{header:{NC:s(0),NR:s(1),NS:s(2),MODE:s(3),NCSTART:s(4),NRSTART:s(5),NSSTART:s(6),NX:s(7),NY:s(8),NZ:s(9),xLength:a(10),yLength:a(11),zLength:a(12),alpha:a(13),beta:a(14),gamma:a(15),MAPC:s(16),MAPR:s(17),MAPS:s(18),AMIN:a(19),AMAX:a(20),AMEAN:a(21),ISPG:s(22),NSYMBT:s(23),LSKFLG:s(24),SKWMAT:[],SKWTRN:[],userFlag1:s(39),userFlag2:s(40),originX:a(49),originY:a(50),originZ:a(51),MAP:r,MACHST:i,ARMS:a(54)},littleEndian:o}}),d4.apply(this,arguments)}function f4(){return f4=ie(function*(e,t,n,r,i,o){if(bte(e)){const s=3*i;yield n.readBuffer(r,t.readBuffer,i,s);const a=new Int8Array(t.valuesBuffer.buffer,s),c=(e.AMAX-e.AMIN)/255,u=.5*(e.AMIN+e.AMAX+c);for(let l=0,d=i;le.readInt16LE(2*i):i=>e.readInt16BE(2*i),r=1/n(17);return{xStart:n(0),yStart:n(1),zStart:n(2),xExtent:n(3),yExtent:n(4),zExtent:n(5),xRate:n(6),yRate:n(7),zRate:n(8),xlen:n(9)*r,ylen:n(10)*r,zlen:n(11)*r,alpha:n(12)*r,beta:n(13)*r,gamma:n(14)*r,divisor:n(15)/100,summand:n(16),sigma:void 0}}function _te(e){const{xExtent:t,yExtent:n,zExtent:r}=e;return{xBlocks:Math.ceil(t/8),yBlocks:Math.ceil(n/8),zBlocks:Math.ceil(r/8)}}function m4(){return m4=ie(function*(e){const{buffer:t}=yield e.readBuffer(0,h4),n=String.fromCharCode.apply(null,t),r=n.startsWith(":-)"),i=r||100===t.readInt16LE(36);return{header:r?W8e(n):$8e(t,i),littleEndian:i}}),m4.apply(this,arguments)}function g4(){return g4=ie(function*(e,t,n,r){r||cd.flipByteOrderInPlace2(t.buffer);const{divisor:i,summand:o,xExtent:s,yExtent:a,zExtent:c}=e,{xBlocks:u,yBlocks:l,zBlocks:d}=_te(e);let f=0;for(let p=0;pl.get(d)})}function cUe(e,t){const{elements:n,tokenizer:r}=e,{count:i,property:o}=t,s=He.create(r.data,2*i*3),a=new Uint32Array(i+1);let c=0;for(let d=0,f=i;d{const f=a[d]+1,p=l.value(f-1);for(let m=f,h=f+p;mr.get(i)}}(r,i.map(c=>c.name),o);return Fr.success(a)}),v4.apply(this,arguments)}const{readLine:NT,skipWhitespace:Ste,eatValue:Cte,eatLine:dUe,markStart:_4}=ht,FT=/\s+/,fUe=/(^\*|REMARK)*/;function hUe(e,t){return x4.apply(this,arguments)}function x4(){return x4=ie(function*(e,t){const{tokenizer:n}=e,r=He.create(n.data,2*t),i=He.create(n.data,2*t),o=He.create(n.data,2*t),s=He.create(n.data,2*t),a=He.create(n.data,2*t),c=He.create(n.data,2*t),u=He.create(n.data,2*t),l=He.create(n.data,2*t),{position:d}=n,f=NT(n).trim();n.position=d;const p=7===f.split(FT).length,m=p?6:8,{length:h}=n;let g=0;return yield op(e.runtimeCtx,1e5,void 0,y=>{const b=Math.min(t-g,y);for(let x=0;xy.update({message:"Parsing...",current:n.position,max:h})),{count:t,atomId:Jt(r)(te.Schema.int),segmentName:p?Jt(o)(te.Schema.str):Jt(i)(te.Schema.str),residueId:Jt(o)(te.Schema.int),residueName:p?Jt(o)(te.Schema.str):Jt(s)(te.Schema.str),atomName:Jt(a)(te.Schema.str),atomType:Jt(c)(te.Schema.str),charge:Jt(u)(te.Schema.float),mass:Jt(l)(te.Schema.float)}}),x4.apply(this,arguments)}function mUe(e,t){return S4.apply(this,arguments)}function S4(){return S4=ie(function*(e,t){const{tokenizer:n}=e,r=He.create(n.data,2*t),i=He.create(n.data,2*t),{length:o}=n;let s=0;return yield op(e.runtimeCtx,10,void 0,a=>{const c=Math.min(t-s,a);for(let u=0;ua.update({message:"Parsing...",current:n.position,max:o})),{count:t,atomIdA:Jt(r)(te.Schema.int),atomIdB:Jt(i)(te.Schema.int)}}),S4.apply(this,arguments)}function gUe(e,t){const n=[];for(let r=0;rn(i)},e.create=n,e.hasTag=function r(i,o){if(!i.tags)return!1;for(const s of i.tags)if(s===o)return!0;return!1},e.Null={id:Hr.create22(),type:{name:"Null",typeClass:"Null"},data:void 0,label:"Null"}}(li||(li={})),function(e){e.is=function t(r){return!!(r&&r.transform&&r.parent&&r.status)},e.resolve=function n(r,i){const o="string"==typeof i?i:e.is(i)?i.transform.ref:i.ref;return r.cells.get(o)}}(N2||(N2={}));class wte{get cell(){var t;return null===(t=this.state)||void 0===t?void 0:t.cells.get(this.ref)}get obj(){var t,n;return null===(n=null===(t=this.state)||void 0===t?void 0:t.cells.get(this.ref))||void 0===n?void 0:n.obj}get data(){var t;return null===(t=this.obj)||void 0===t?void 0:t.data}update(t,n){if(!this.state)throw new Error("To use update() from StateObjectSelector, 'state' must be defined.");return n||(n=this.state.build()),(n||this.state.build()).to(this).update(t),n}checkValid(){if(!this.state)throw new Error("Unassigned State.");const t=this.cell;if(!t)throw new Error("Not created at all. Did you await/then the corresponding state update?");if("ok"===t.status)return!0;throw"error"===t.status?new Error(t.errorText):t.obj===li.Null?new Error("The object is Null."):new Error("Unresolved. Did you await/then the corresponding state update?")}get isOk(){const t=this.cell;return t&&"ok"===t.status&&t.obj!==li.Null}constructor(t,n){this.ref=t,this.state=n}}!function(e){function n(i,o){if(o)return N2.is(o)?o:"string"==typeof o?i.cells.get(o):o.cell}e.resolveRef=function t(i){var o;if(i)return"string"==typeof i?i:N2.is(i)?i.transform.ref:null===(o=i.cell)||void 0===o?void 0:o.transform.ref},e.resolve=n,e.resolveAndCheck=function r(i,o){const s=n(i,o);if(s&&s.obj&&"ok"===s.status)return s}}(ls||(ls={}));var F2="delete",Yi=5,Qu=1<>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?nv(e)+t:t}function Ate(){return!0}function B2(e,t,n){return(0===e&&!Tte(e)||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function rv(e,t){return Ite(e,t,0)}function O2(e,t){return Ite(e,t,t)}function Ite(e,t,n){return void 0===e?n:Tte(e)?t===1/0?t:0|Math.max(0,t+e):void 0===t||t===e?e:0|Math.min(t,e)}function Tte(e){return e<0||0===e&&1/e==-1/0}var Dte="@@__IMMUTABLE_ITERABLE__@@";function Qa(e){return!(!e||!e[Dte])}var Ete="@@__IMMUTABLE_KEYED__@@";function Li(e){return!(!e||!e[Ete])}var Pte="@@__IMMUTABLE_INDEXED__@@";function ga(e){return!(!e||!e[Pte])}function L2(e){return Li(e)||ga(e)}var yo=function(t){return Qa(t)?t:ec(t)},el=function(e){function t(n){return Li(n)?n:am(n)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t}(yo),Zg=function(e){function t(n){return ga(n)?n:il(n)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t}(yo),iv=function(e){function t(n){return Qa(n)&&!L2(n)?n:av(n)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t}(yo);yo.Keyed=el,yo.Indexed=Zg,yo.Set=iv;var Mte="@@__IMMUTABLE_SEQ__@@";function BT(e){return!(!e||!e[Mte])}var Rte="@@__IMMUTABLE_RECORD__@@";function Qg(e){return!(!e||!e[Rte])}function tl(e){return Qa(e)||Qg(e)}var ov="@@__IMMUTABLE_ORDERED__@@";function nl(e){return!(!e||!e[ov])}var U2=0,ud=1,rl=2,I4="function"==typeof Symbol&&Symbol.iterator,kte="@@iterator",OT=I4||kte,Wr=function(t){this.next=t};function Xi(e,t,n,r){var i=0===e?t:1===e?n:[t,n];return r?r.value=i:r={value:i,done:!1},r}function Ja(){return{value:void 0,done:!0}}function T4(e){return!!Array.isArray(e)||!!LT(e)}function Nte(e){return e&&"function"==typeof e.next}function D4(e){var t=LT(e);return t&&t.call(e)}function LT(e){var t=e&&(I4&&e[I4]||e[kte]);if("function"==typeof t)return t}Wr.prototype.toString=function(){return"[Iterator]"},Wr.KEYS=U2,Wr.VALUES=ud,Wr.ENTRIES=rl,Wr.prototype.inspect=Wr.prototype.toSource=function(){return this.toString()},Wr.prototype[OT]=function(){return this};var sv=Object.prototype.hasOwnProperty;function E4(e){return!(!Array.isArray(e)&&"string"!=typeof e)||e&&"object"==typeof e&&Number.isInteger(e.length)&&e.length>=0&&(0===e.length?1===Object.keys(e).length:e.hasOwnProperty(e.length-1))}var ec=function(e){function t(n){return null==n?M4():tl(n)?n.toSeq():function SUe(e){var t=k4(e);if(t)return function vUe(e){var t=LT(e);return t&&t===e.entries}(e)?t.fromEntrySeq():function _Ue(e){var t=LT(e);return t&&t===e.keys}(e)?t.toSetSeq():t;if("object"==typeof e)return new P4(e);throw new TypeError("Expected Array or collection object of values, or keyed object: "+e)}(n)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.toSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq {","}")},t.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},t.prototype.__iterate=function(r,i){var o=this._cache;if(o){for(var s=o.length,a=0;a!==s;){var c=o[i?s-++a:a++];if(!1===r(c[1],c[0],this))break}return a}return this.__iterateUncached(r,i)},t.prototype.__iterator=function(r,i){var o=this._cache;if(o){var s=o.length,a=0;return new Wr(function(){if(a===s)return{value:void 0,done:!0};var c=o[i?s-++a:a++];return Xi(r,c[0],c[1])})}return this.__iteratorUncached(r,i)},t}(yo),am=function(e){function t(n){return null==n?M4().toKeyedSeq():Qa(n)?Li(n)?n.toSeq():n.fromEntrySeq():Qg(n)?n.toSeq():R4(n)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.toKeyedSeq=function(){return this},t}(ec),il=function(e){function t(n){return null==n?M4():Qa(n)?Li(n)?n.entrySeq():n.toIndexedSeq():Qg(n)?n.toSeq().entrySeq():Bte(n)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.of=function(){return t(arguments)},t.prototype.toIndexedSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq [","]")},t}(ec),av=function(e){function t(n){return(Qa(n)&&!L2(n)?n:il(n)).toSetSeq()}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.of=function(){return t(arguments)},t.prototype.toSetSeq=function(){return this},t}(ec);ec.isSeq=BT,ec.Keyed=am,ec.Set=av,ec.Indexed=il,ec.prototype[Mte]=!0;var Jg=function(e){function t(n){this._array=n,this.size=n.length}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.get=function(r,i){return this.has(r)?this._array[sm(this,r)]:i},t.prototype.__iterate=function(r,i){for(var o=this._array,s=o.length,a=0;a!==s;){var c=i?s-++a:a++;if(!1===r(o[c],c,this))break}return a},t.prototype.__iterator=function(r,i){var o=this._array,s=o.length,a=0;return new Wr(function(){if(a===s)return{value:void 0,done:!0};var c=i?s-++a:a++;return Xi(r,c,o[c])})},t}(il),P4=function(e){function t(n){var r=Object.keys(n).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(n):[]);this._object=n,this._keys=r,this.size=r.length}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.get=function(r,i){return void 0===i||this.has(r)?this._object[r]:i},t.prototype.has=function(r){return sv.call(this._object,r)},t.prototype.__iterate=function(r,i){for(var o=this._object,s=this._keys,a=s.length,c=0;c!==a;){var u=s[i?a-++c:c++];if(!1===r(o[u],u,this))break}return c},t.prototype.__iterator=function(r,i){var o=this._object,s=this._keys,a=s.length,c=0;return new Wr(function(){if(c===a)return{value:void 0,done:!0};var u=s[i?a-++c:c++];return Xi(r,u,o[u])})},t}(am);P4.prototype[ov]=!0;var Fte,xUe=function(e){function t(n){this._collection=n,this.size=n.length||n.size}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.__iterateUncached=function(r,i){if(i)return this.cacheResult().__iterate(r,i);var s=D4(this._collection),a=0;if(Nte(s))for(var c;!(c=s.next()).done&&!1!==r(c.value,a++,this););return a},t.prototype.__iteratorUncached=function(r,i){if(i)return this.cacheResult().__iterator(r,i);var s=D4(this._collection);if(!Nte(s))return new Wr(Ja);var a=0;return new Wr(function(){var c=s.next();return c.done?c:Xi(r,a++,c.value)})},t}(il);function M4(){return Fte||(Fte=new Jg([]))}function R4(e){var t=k4(e);if(t)return t.fromEntrySeq();if("object"==typeof e)return new P4(e);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+e)}function Bte(e){var t=k4(e);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+e)}function k4(e){return E4(e)?new Jg(e):T4(e)?new xUe(e):void 0}var Ote="@@__IMMUTABLE_MAP__@@";function UT(e){return!(!e||!e[Ote])}function N4(e){return UT(e)&&nl(e)}function F4(e){return!(!e||"function"!=typeof e.equals||"function"!=typeof e.hashCode)}function Ns(e,t){if(e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if((e=e.valueOf())===(t=t.valueOf())||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!!(F4(e)&&F4(t)&&e.equals(t))}var V2="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,n){var r=65535&(t|=0),i=65535&(n|=0);return r*i+((t>>>16)*i+r*(n>>>16)<<16>>>0)|0};function VT(e){return e>>>1&1073741824|3221225471&e}var CUe=Object.prototype.valueOf;function Mc(e){if(null==e)return Lte(e);if("function"==typeof e.hashCode)return VT(e.hashCode(e));var t=function EUe(e){return e.valueOf!==CUe&&"function"==typeof e.valueOf?e.valueOf(e):e}(e);if(null==t)return Lte(t);switch(typeof t){case"boolean":return t?1108378657:1108378656;case"number":return function wUe(e){if(e!=e||e===1/0)return 0;var t=0|e;for(t!==e&&(t^=4294967295*e);e>4294967295;)t^=e/=4294967295;return VT(t)}(t);case"string":return t.length>PUe?function AUe(e){var t=z4[e];return void 0===t&&(t=B4(e),V4===MUe&&(V4=0,z4={}),V4++,z4[e]=t),t}(t):B4(t);case"object":case"function":return function TUe(e){var t;if(O4&&void 0!==(t=L4.get(e))||void 0!==(t=e[e0])||!Vte&&(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[e0])||(t=function DUe(e){if(e&&e.nodeType>0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}(e),void 0!==t)))return t;if(t=zte(),O4)L4.set(e,t);else{if(void 0!==Ute&&!1===Ute(e))throw new Error("Non-extensible objects are not allowed as keys.");if(Vte)Object.defineProperty(e,e0,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(void 0!==e.propertyIsEnumerable&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable)e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},e.propertyIsEnumerable[e0]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[e0]=t}}return t}(t);case"symbol":return function IUe(e){var t=Gte[e];return void 0!==t||(t=zte(),Gte[e]=t),t}(t);default:if("function"==typeof t.toString)return B4(t.toString());throw new Error("Value type "+typeof t+" cannot be hashed.")}}function Lte(e){return null===e?1108378658:1108378659}function B4(e){for(var t=0,n=0;n=0&&(u.get=function(l,d){return(l=sm(this,l))>=0&&lc)return{value:void 0,done:!0};var h=f.next();return r||l===ud||h.done?h:Xi(l,m-1,l===U2?void 0:h.value[1],h)})},u}function Xte(e,t,n,r){var i=cf(e);return i.__iterateUncached=function(o,s){var a=this;if(s)return this.cacheResult().__iterate(o,s);var c=!0,u=0;return e.__iterate(function(l,d,f){if(!c||!(c=t.call(n,l,d,f)))return u++,o(l,r?d:u-1,a)}),u},i.__iteratorUncached=function(o,s){var a=this;if(s)return this.cacheResult().__iterator(o,s);var c=e.__iterator(rl,s),u=!0,l=0;return new Wr(function(){var d,f,p;do{if((d=c.next()).done)return r||o===ud?d:Xi(o,l++,o===U2?void 0:d.value[1],d);var m=d.value;f=m[0],p=m[1],u&&(u=t.call(n,p,f,a))}while(u);return o===rl?d:Xi(o,f,p,d)})},i}function Kte(e,t,n){var r=cf(e);return r.__iterateUncached=function(i,o){if(o)return this.cacheResult().__iterate(i,o);var s=0,a=!1;return function c(u,l){u.__iterate(function(d,f){return(!t||l0}function jT(e,t,n,r){var i=cf(e),o=new Jg(n).map(function(s){return s.size});return i.size=r?o.max():o.min(),i.__iterate=function(s,a){for(var u,c=this.__iterator(ud,a),l=0;!(u=c.next()).done&&!1!==s(u.value,l++,this););return l},i.__iteratorUncached=function(s,a){var c=n.map(function(d){return d=yo(d),D4(a?d.reverse():d)}),u=0,l=!1;return new Wr(function(){var d;return l||(d=c.map(function(f){return f.next()}),l=r?d.every(function(f){return f.done}):d.some(function(f){return f.done})),l?{value:void 0,done:!0}:Xi(s,u++,t.apply(null,d.map(function(f){return f.value})))})},i}function Ti(e,t){return e===t?e:BT(e)?t:e.constructor(t)}function Qte(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function H4(e){return Li(e)?el:ga(e)?Zg:iv}function cf(e){return Object.create((Li(e)?am:ga(e)?il:av).prototype)}function q4(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):ec.prototype.cacheResult.call(this)}function Jte(e,t){return void 0===e&&void 0===t?0:void 0===e?1:void 0===t?-1:e>t?1:e0;)t[n]=arguments[n+1];if("function"!=typeof e)throw new TypeError("Invalid merger function: "+e);return une(this,t,e)}function une(e,t,n){for(var r=[],i=0;i0;)t[n]=arguments[n+1];return G2(this,t,e)}function eL(e){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];return t0(this,e,ld(),function(r){return j2(r,t)})}function tL(e){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];return t0(this,e,ld(),function(r){return G2(r,t)})}function H2(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}function q2(){return this.__ownerID?this:this.__ensureOwner(new A4)}function W2(){return this.__ensureOwner()}function nL(){return this.__altered}var gu=function(e){function t(n){return null==n?ld():UT(n)&&!nl(n)?n:ld().withMutations(function(r){var i=e(n);mu(i.size),i.forEach(function(o,s){return r.set(s,o)})})}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.of=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];return ld().withMutations(function(o){for(var s=0;s=r.length)throw new Error("Missing value for key: "+r[s]);o.set(r[s],r[s+1])}})},t.prototype.toString=function(){return this.__toString("Map {","}")},t.prototype.get=function(r,i){return this._root?this._root.get(0,void 0,r,i):i},t.prototype.set=function(r,i){return hne(this,r,i)},t.prototype.remove=function(r){return hne(this,r,Pr)},t.prototype.deleteAll=function(r){var i=yo(r);return 0===i.size?this:this.withMutations(function(o){i.forEach(function(s){return o.remove(s)})})},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):ld()},t.prototype.sort=function(r){return ol(cv(this,r))},t.prototype.sortBy=function(r,i){return ol(cv(this,i,r))},t.prototype.map=function(r,i){var o=this;return this.withMutations(function(s){s.forEach(function(a,c){s.set(c,r.call(i,a,c,o))})})},t.prototype.__iterator=function(r,i){return new WUe(this,r,i)},t.prototype.__iterate=function(r,i){var o=this,s=0;return this._root&&this._root.iterate(function(a){return s++,r(a[1],a[0],o)},i),s},t.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?iL(this.size,this._root,r,this.__hash):0===this.size?ld():(this.__ownerID=r,this.__altered=!1,this)},t}(el);gu.isMap=UT;var Ki=gu.prototype;Ki[Ote]=!0,Ki[F2]=Ki.remove,Ki.removeAll=Ki.deleteAll,Ki.setIn=X4,Ki.removeIn=Ki.deleteIn=K4,Ki.update=Q4,Ki.updateIn=J4,Ki.merge=Ki.concat=ane,Ki.mergeWith=cne,Ki.mergeDeep=lne,Ki.mergeDeepWith=dne,Ki.mergeIn=eL,Ki.mergeDeepIn=tL,Ki.withMutations=H2,Ki.wasAltered=nL,Ki.asImmutable=W2,Ki["@@transducer/init"]=Ki.asMutable=q2,Ki["@@transducer/step"]=function(e,t){return e.set(t[0],t[1])},Ki["@@transducer/result"]=function(e){return e.asImmutable()};var $2=function(t,n){this.ownerID=t,this.entries=n};$2.prototype.get=function(t,n,r,i){for(var o=this.entries,s=0,a=o.length;s=QUe)return function $Ue(e,t,n,r){e||(e=new A4);for(var i=new Sp(e,Mc(n),[n,r]),o=0;o>>t)&Za),s=this.bitmap;return s&o?this.nodes[gne(s&o-1)].get(t+Yi,n,r,i):i},uv.prototype.update=function(t,n,r,i,o,s,a){void 0===r&&(r=Mc(i));var c=(0===n?r:r>>>n)&Za,u=1<=JUe)return function XUe(e,t,n,r,i){for(var o=0,s=new Array(Qu),a=0;0!==n;a++,n>>>=1)s[a]=1&n?t[o++]:void 0;return s[r]=i,new Y2(e,o+1,s)}(t,p,l,c,h);if(d&&!h&&2===p.length&&mne(p[1^f]))return p[1^f];if(d&&h&&1===p.length&&mne(h))return h;var g=t&&t===this.ownerID,y=d?h?l:l^u:l|u,b=d?h?yne(p,f,h,g):function ZUe(e,t,n){var r=e.length-1;if(n&&t===r)return e.pop(),e;for(var i=new Array(r),o=0,s=0;s>>t)&Za];return s?s.get(t+Yi,n,r,i):i},Y2.prototype.update=function(t,n,r,i,o,s,a){void 0===r&&(r=Mc(i));var c=(0===n?r:r>>>n)&Za,l=this.nodes,d=l[c];if(o===Pr&&!d)return this;var f=oL(d,t,n+Yi,r,i,o,s,a);if(f===d)return this;var p=this.count;if(d){if(!f&&--p>>n)&Za,s=(0===n?r:r>>>n)&Za,c=o===s?[sL(e,t,n+Yi,r,i)]:(a=new Sp(t,r,i),o>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,127&(e+=e>>8)+(e>>16)}function yne(e,t,n,r){var i=r?e:uf(e);return i[t]=n,i}var QUe=Qu/4,JUe=Qu/2,eVe=Qu/4,bne="@@__IMMUTABLE_LIST__@@";function aL(e){return!(!e||!e[bne])}var Cp=function(e){function t(n){var r=qT();if(null==n)return r;if(aL(n))return n;var i=e(n),o=i.size;return 0===o?r:(mu(o),o>0&&o=0&&r=e.size||t<0)return e.withMutations(function(s){t<0?lm(s,t).set(0,n):lm(s,0,t+1).set(t,n)});var r=e._tail,i=e._root,o={value:!1};return(t+=e._origin)>=Z2(e._capacity)?r=cL(r,e.__ownerID,0,t,n,o):i=cL(i,e.__ownerID,e._level,t,n,o),o.value?e.__ownerID?(e._root=i,e._tail=r,e.__hash=void 0,e.__altered=!0,e):K2(e._origin,e._capacity,e._level,i,r):e}(this,r,i)},t.prototype.remove=function(r){return this.has(r)?0===r?this.shift():r===this.size-1?this.pop():this.splice(r,1):this},t.prototype.insert=function(r,i){return this.splice(r,0,i)},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=Yi,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):qT()},t.prototype.push=function(){var r=arguments,i=this.size;return this.withMutations(function(o){lm(o,0,i+r.length);for(var s=0;s>>n&Za;if(i>=this.array.length)return new um([],t);var s,o=0===i;if(n>0){var a=this.array[i];if((s=a&&a.removeBefore(t,n-Yi,r))===a&&o)return this}if(o&&!s)return this;var c=dv(this,t);if(!o)for(var u=0;u>>n&Za;if(i>=this.array.length)return this;if(n>0){var s=this.array[i];if((o=s&&s.removeAfter(t,n-Yi,r))===s&&i===this.array.length-1)return this}var a=dv(this,t);return a.array.splice(i+1),o&&(a.array[i]=o),a};var _ne,X2={};function vne(e,t){var n=e._origin,r=e._capacity,i=Z2(r),o=e._tail;return function s(u,l,d){return 0===l?function a(u,l){var d=l===i?o&&o.array:u&&u.array,f=l>n?0:n-l,p=r-l;return p>Qu&&(p=Qu),function(){if(f===p)return X2;var m=t?--p:f++;return d&&d[m]}}(u,d):function c(u,l,d){var f,p=u&&u.array,m=d>n?0:n-d>>l,h=1+(r-d>>l);return h>Qu&&(h=Qu),function(){for(;;){if(f){var g=f();if(g!==X2)return g;f=null}if(m===h)return X2;var y=t?--h:m++;f=s(p&&p[y],l-Yi,d+(y<>>n&Za,a=e&&s0){var u=e&&e.array[s],l=cL(u,t,n-Yi,r,i,o);return l===u?e:((c=dv(e,t)).array[s]=l,c)}return a&&e.array[s]===i?e:(o&&Ju(o),c=dv(e,t),void 0===i&&s===c.array.length-1?c.array.pop():c.array[s]=i,c)}function dv(e,t){return t&&e&&t===e.ownerID?e:new um(e?e.array.slice():[],t)}function xne(e,t){if(t>=Z2(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&Za],r-=Yi;return n}}function lm(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new A4,i=e._origin,o=e._capacity,s=i+t,a=void 0===n?o:n<0?o+n:i+n;if(s===i&&a===o)return e;if(s>=a)return e.clear();for(var c=e._level,u=e._root,l=0;s+l<0;)u=new um(u&&u.array.length?[void 0,u]:[],r),l+=1<<(c+=Yi);l&&(s+=l,i+=l,a+=l,o+=l);for(var d=Z2(o),f=Z2(a);f>=1<d?new um([],r):p;if(p&&f>d&&sYi;g-=Yi){var y=d>>>g&Za;h=h.array[y]=dv(h.array[y],r)}h.array[d>>>Yi&Za]=p}if(a=f)s-=f,a-=f,c=Yi,u=null,m=m&&m.removeBefore(r,0,s);else if(s>i||f>>c&Za;if(b!==f>>>c&Za)break;b&&(l+=(1<i&&(u=u.removeBefore(r,c,s-l)),u&&f>>Yi<=Qu&&i.size>=2*r.size?(a=(c=i.filter(function(u,l){return void 0!==u&&o!==l})).toKeyedSeq().map(function(u){return u[0]}).flip().toMap(),e.__ownerID&&(a.__ownerID=c.__ownerID=e.__ownerID)):(a=r.remove(t),c=o===i.size-1?i.pop():i.set(o,void 0))}else if(s){if(n===i.get(o)[1])return e;a=r,c=i.set(o,[t,n])}else a=r.set(t,i.size),c=i.set(i.size,[t,n]);return e.__ownerID?(e.size=a.size,e._map=a,e._list=c,e.__hash=void 0,e.__altered=!0,e):uL(a,c)}ol.isOrderedMap=N4,ol.prototype[ov]=!0,ol.prototype[F2]=ol.prototype.remove;var wne="@@__IMMUTABLE_STACK__@@";function WT(e){return!(!e||!e[wne])}var $T=function(e){function t(n){return null==n?YT():WT(n)?n:YT().pushAll(n)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("Stack [","]")},t.prototype.get=function(r,i){var o=this._head;for(r=sm(this,r);o&&r--;)o=o.next;return o?o.value:i},t.prototype.peek=function(){return this._head&&this._head.value},t.prototype.push=function(){var r=arguments;if(0===arguments.length)return this;for(var i=this.size+arguments.length,o=this._head,s=arguments.length-1;s>=0;s--)o={value:r[s],next:o};return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):J2(i,o)},t.prototype.pushAll=function(r){if(0===(r=e(r)).size)return this;if(0===this.size&&WT(r))return r;mu(r.size);var i=this.size,o=this._head;return r.__iterate(function(s){i++,o={value:s,next:o}},!0),this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):J2(i,o)},t.prototype.pop=function(){return this.slice(1)},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):YT()},t.prototype.slice=function(r,i){if(B2(r,i,this.size))return this;var o=rv(r,this.size);if(O2(i,this.size)!==this.size)return e.prototype.slice.call(this,r,i);for(var a=this.size-o,c=this._head;o--;)c=c.next;return this.__ownerID?(this.size=a,this._head=c,this.__hash=void 0,this.__altered=!0,this):J2(a,c)},t.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?J2(this.size,this._head,r,this.__hash):0===this.size?YT():(this.__ownerID=r,this.__altered=!1,this)},t.prototype.__iterate=function(r,i){var o=this;if(i)return new Jg(this.toArray()).__iterate(function(c,u){return r(c,u,o)},i);for(var s=0,a=this._head;a&&!1!==r(a.value,s++,this);)a=a.next;return s},t.prototype.__iterator=function(r,i){if(i)return new Jg(this.toArray()).__iterator(r,i);var o=0,s=this._head;return new Wr(function(){if(s){var a=s.value;return s=s.next,Xi(r,o++,a)}return{value:void 0,done:!0}})},t}(Zg);$T.isStack=WT;var Ane,tc=$T.prototype;function J2(e,t,n,r){var i=Object.create(tc);return i.size=e,i._head=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function YT(){return Ane||(Ane=J2(0))}tc[wne]=!0,tc.shift=tc.pop,tc.unshift=tc.push,tc.unshiftAll=tc.pushAll,tc.withMutations=H2,tc.wasAltered=nL,tc.asImmutable=W2,tc["@@transducer/init"]=tc.asMutable=q2,tc["@@transducer/step"]=function(e,t){return e.unshift(t)},tc["@@transducer/result"]=function(e){return e.asImmutable()};var Ine="@@__IMMUTABLE_SET__@@";function XT(e){return!(!e||!e[Ine])}function lL(e){return XT(e)&&nl(e)}function dL(e,t){if(e===t)return!0;if(!Qa(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||Li(e)!==Li(t)||ga(e)!==ga(t)||nl(e)!==nl(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!L2(e);if(nl(e)){var r=e.entries();return t.every(function(c,u){var l=r.next().value;return l&&Ns(l[1],c)&&(n||Ns(l[0],u))})&&r.next().done}var i=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{i=!0;var o=e;e=t,t=o}var s=!0,a=t.__iterate(function(c,u){if(n?!e.has(c):i?!Ns(c,e.get(u,Pr)):!Ns(e.get(u,Pr),c))return s=!1,!1});return s&&e.size===a}function n0(e,t){var n=function(r){e.prototype[r]=t[r]};return Object.keys(t).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(n),e}function KT(e){if(!e||"object"!=typeof e)return e;if(!Qa(e)){if(!cm(e))return e;e=ec(e)}if(Li(e)){var t={};return e.__iterate(function(r,i){t[i]=KT(r)}),t}var n=[];return e.__iterate(function(r){n.push(KT(r))}),n}var eS=function(e){function t(n){return null==n?tS():XT(n)&&!nl(n)?n:tS().withMutations(function(r){var i=e(n);mu(i.size),i.forEach(function(o){return r.add(o)})})}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(r){return this(el(r).keySeq())},t.intersect=function(r){return(r=yo(r).toArray()).length?ta.intersect.apply(t(r.pop()),r):tS()},t.union=function(r){return(r=yo(r).toArray()).length?ta.union.apply(t(r.pop()),r):tS()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(r){return this._map.has(r)},t.prototype.add=function(r){return ZT(this,this._map.set(r,r))},t.prototype.remove=function(r){return ZT(this,this._map.remove(r))},t.prototype.clear=function(){return ZT(this,this._map.clear())},t.prototype.map=function(r,i){var o=this,s=!1,a=ZT(this,this._map.mapEntries(function(c){var u=c[1],l=r.call(i,u,u,o);return l!==u&&(s=!0),[l,l]},i));return s?a:this},t.prototype.union=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];return 0===(r=r.filter(function(o){return 0!==o.size})).length?this:0!==this.size||this.__ownerID||1!==r.length?this.withMutations(function(o){for(var s=0;s=0&&i=0&&o>>-15,461845907),t=V2(t<<13|t>>>-13,5),t=V2((t=t+3864292196^e)^t>>>16,2246822507),t=VT((t=V2(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(n?t?function(o,s){r=31*r+One(Mc(o),Mc(s))|0}:function(o,s){r=r+One(Mc(o),Mc(s))|0}:t?function(o){r=31*r+Mc(o)|0}:function(o){r=r+Mc(o)|0}),r)}(this))}});var ya=yo.prototype;ya[Dte]=!0,ya[OT]=ya.values,ya.toJSON=ya.toArray,ya.__toStringMapper=z2,ya.inspect=ya.toSource=function(){return this.toString()},ya.chain=ya.flatMap,ya.contains=ya.includes,n0(el,{flip:function(){return Ti(this,Wte(this))},mapEntries:function(t,n){var r=this,i=0;return Ti(this,this.toSeq().map(function(o,s){return t.call(n,[s,o],i++,r)}).fromEntrySeq())},mapKeys:function(t,n){var r=this;return Ti(this,this.toSeq().flip().map(function(i,o){return t.call(n,i,o,r)}).flip())}});var nS=el.prototype;nS[Ete]=!0,nS[OT]=ya.entries,nS.toJSON=Rne,nS.__toStringMapper=function(e,t){return z2(t)+": "+z2(e)},n0(Zg,{toKeyedSeq:function(){return new zT(this,!1)},filter:function(t,n){return Ti(this,Yte(this,t,n,!1))},findIndex:function(t,n){var r=this.findEntry(t,n);return r?r[0]:-1},indexOf:function(t){var n=this.keyOf(t);return void 0===n?-1:n},lastIndexOf:function(t){var n=this.lastKeyOf(t);return void 0===n?-1:n},reverse:function(){return Ti(this,G4(this,!1))},slice:function(t,n){return Ti(this,j4(this,t,n,!1))},splice:function(t,n){var r=arguments.length;if(n=Math.max(n||0,0),0===r||2===r&&!n)return this;t=rv(t,t<0?this.count():this.size);var i=this.slice(0,t);return Ti(this,1===r?i:i.concat(uf(arguments,2),this.slice(t+n)))},findLastIndex:function(t,n){var r=this.findLastEntry(t,n);return r?r[0]:-1},first:function(t){return this.get(0,t)},flatten:function(t){return Ti(this,Kte(this,t,!1))},get:function(t,n){return(t=sm(this,t))<0||this.size===1/0||void 0!==this.size&&t>this.size?n:this.find(function(r,i){return i===t},void 0,n)},has:function(t){return(t=sm(this,t))>=0&&(void 0!==this.size?this.size===1/0||tt?-1:0}function One(e,t){return e^t+2654435769+(e<<6)+(e>>2)}pv.has=ya.includes,pv.contains=pv.includes,pv.keys=pv.values,n0(am,nS),n0(il,fv),n0(av,pv);var sl=function(e){function t(n){return null==n?mL():lL(n)?n:mL().withMutations(function(r){var i=iv(n);mu(i.size),i.forEach(function(o){return r.add(o)})})}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(r){return this(el(r).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t}(eS);sl.isOrderedSet=lL;var Une,r0=sl.prototype;function Lne(e,t){var n=Object.create(r0);return n.size=e?e.size:0,n._map=e,n.__ownerID=t,n}function mL(){return Une||(Une=Lne(Q2()))}r0[ov]=!0,r0.zip=fv.zip,r0.zipWith=fv.zipWith,r0.zipAll=fv.zipAll,r0.__empty=mL,r0.__make=Lne;var Es=function(t,n){var r;!function cVe(e){if(Qg(e))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(tl(e))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(null===e||"object"!=typeof e)throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}(t);var i=function(a){var c=this;if(a instanceof i)return a;if(!(this instanceof i))return new i(a);if(!r){r=!0;var u=Object.keys(t),l=o._indices={};o._name=n,o._keys=u,o._defaultValues=t;for(var d=0;d({action:o,params:s}),id:Hr.create22(),definition:i,createDefaultParams:(s,a)=>i.params?C.getDefaultValues(i.params(s,a)):{}};return o}let r;e.create=t,e.fromTransformer=function n(i){const o=i.definition;return t({from:o.from,display:o.display,params:o.params,isApplicable:i.definition.isApplicable?(s,a,c)=>i.definition.isApplicable(s,c):void 0,run({cell:s,state:a,params:c}){const u=a.build().to(s.transform.ref).apply(i,c);return a.updateTree(u)}})},(r=e.Builder||(e.Builder={})).build=s=>function o(s){return a=>t({from:s.from instanceof Array?s.from:s.from?[s.from]:[],display:"string"==typeof s.display?{name:s.display}:s.display?s.display:{name:"Unnamed State Action"},params:"object"==typeof s.params?()=>s.params:s.params?s.params:void 0,isApplicable:s.isApplicable,..."function"==typeof a?{run:a}:a})}(s),e.build=r.build}(nc||(nc={})),function(e){let r;var h;e.getParamDefinition=function t(h,g,y){return h.definition.params?h.definition.params(g,y):{}},e.is=function n(h){return!!h&&"function"==typeof h.toAction&&"function"==typeof h.apply},(h=r=e.UpdateResult||(e.UpdateResult={}))[h.Unchanged=0]="Unchanged",h[h.Updated=1]="Updated",h[h.Recreate=2]="Recreate",h[h.Null=3]="Null";const i=new Map,o=new Map;function l(h,g){const{name:y}=g,b=`${h}.${y}`;if(i.has(b))throw new Error(`A transform with id '${y}' is already registered. Please pick a unique identifier for your transforms and/or register them only once. This is to ensure that transforms can be serialized and replayed.`);const x={apply:(_,S,A)=>ur.create(_,x,S,A),toAction:()=>nc.fromTransformer(x),namespace:h,id:b,definition:g,createDefaultParams:(_,S)=>g.params?C.getDefaultValues(g.params(_,S)):{}};return i.set(b,x),function s(h){for(const g of h.definition.from)o.has(g.type)?o.get(g.type).push(h):o.set(g.type,[h])}(x),x}let p;e.getAll=function a(){return Array.from(i.values())},e.get=function c(h){const g=i.get(h);if(!g)throw new Error(`A transformer with signature '${h}' is not registered.`);return g},e.fromType=function u(h){return o.get(h)||[]},e.create=l,e.factory=function d(h){return g=>l(h,g)},e.builderFactory=function f(h){return p.build(h)},function(h){h.build=function y(b){return x=>function g(b,x){return _=>l(b,{name:x.name,from:x.from instanceof Array?x.from:[x.from],to:x.to instanceof Array?x.to:[x.to],display:"string"==typeof x.display?{name:x.display}:x.display?x.display:{name:Fg(x.name.replace(/[-]/g," "))},params:"object"==typeof x.params?()=>x.params:x.params?x.params:void 0,isDecorator:x.isDecorator,..._})}(b,x)}}(p=e.Builder||(e.Builder={})),e.build=function m(h){return p.build(h)},e.ROOT=l("build-in",{name:"root",from:[],to:[],display:{name:"Root",description:"For internal use."},apply(){throw new Error("should never be applied")},update:()=>r.Unchanged})}(Qe||(Qe={})),function(e){function o(g,y,b,x){const _=x&&x.ref?x.ref:Hr.create22();let S;return x&&x.tags&&(S="string"==typeof x.tags?[x.tags]:x.tags,0===S.length?S=void 0:S.sort()),{parent:g,transformer:y,state:x?.state||{},tags:S,ref:_,dependsOn:x&&x.dependsOn,params:b,version:Hr.create22()}}function d(g,y){return!!g.tags&&g.tags.indexOf(y)>=0}function p(g){return g}e.RootRef="-=root=-",e.areStatesEqual=function t(g,y){return!!g.isHidden!=!!y.isHidden||!!g.isCollapsed!=!!y.isCollapsed||!!g.isGhost!=!!y.isGhost||!!g.isLocked!=!!y.isLocked},e.isStateChange=function n(g,y){return!!y&&(typeof y.isCollapsed<"u"&&g.isCollapsed!==y.isCollapsed||typeof y.isHidden<"u"&&g.isHidden!==y.isHidden||typeof y.isGhost<"u"&&g.isGhost!==y.isGhost||typeof y.isLocked<"u"&&g.isLocked!==y.isLocked)},e.assignState=function r(g,y){if(!y)return!1;let b=!1;for(const x of Object.keys(y)){const _=y[x];!!_!=!!g[x]&&(b=!0,g[x]=_)}return b},e.syncState=function i(g,y){if(!y)return!1;let b=!1;for(const x of Object.keys(y)){const _=y[x];!!_!=!!g[x]&&(b=!0,void 0!==_?g[x]=_:delete g[x])}for(const x of Object.keys(g)){const _=y[x];!!_!=!!g[x]&&(b=!0,void 0!==_?g[x]=_:delete g[x])}return b},e.create=o,e.withParams=function s(g,y){return{...g,params:y,version:Hr.create22()}},e.withState=function a(g,y){return y?{...g,state:{...g.state,...y}}:g},e.withTags=function c(g,y){let b;return y&&(b="string"==typeof y?[y]:y,0===b.length?b=void 0:b.sort()),{...g,tags:b,version:Hr.create22()}},e.withParent=function u(g,y){return{...g,parent:y,version:Hr.create22()}},e.createRoot=function l(g){return o(e.RootRef,Qe.ROOT,{},{ref:e.RootRef,state:g})},e.hasTag=d,e.hasTags=function f(g,y){if(!g.tags)return"string"!=typeof y&&0===y.length;if("string"==typeof y)return d(g,y);for(const b of y)if(g.tags.indexOf(b)<0)return!1;return!0},e.toJSON=function m(g){const y=g.transformer.definition.customSerialization?g.transformer.definition.customSerialization.toJSON:p;let b;for(const x of Object.keys(g.state))g.state[x]&&(b||(b={}),b[x]=!0);return{parent:g.parent,transformer:g.transformer.id,params:g.params?y(g.params):void 0,state:b,tags:g.tags,ref:g.ref,dependsOn:g.dependsOn,version:g.version}},e.fromJSON=function h(g){const y=Qe.get(g.transformer);return{parent:g.parent,transformer:y,params:g.params?(y.definition.customSerialization?y.definition.customSerialization.fromJSON:p)(g.params):void 0,state:g.state||{},tags:g.tags,ref:g.ref,dependsOn:g.dependsOn,version:g.version}}}(ur||(ur={}));class hVe{get childMutations(){return this._childMutations||(this._childMutations=new Map),this._childMutations}get dependencyMutations(){return this._dependencyMutations||(this._dependencyMutations=new Map),this._dependencyMutations}changeNodes(){this.changedNodes||(this.changedNodes=!0,this.transforms=this.transforms.asMutable())}changeChildren(){this.changedChildren||(this.changedChildren=!0,this.children=this.children.asMutable())}changeDependencies(){this.changedDependencies||(this.changedDependencies=!0,this.dependencies=this.dependencies.asMutable())}get root(){return this.transforms.get(ur.RootRef)}asTransient(){return this.asImmutable().asTransient()}addChild(t,n){if(this.changeChildren(),this.childMutations.has(t))this.childMutations.get(t).add(n);else{const r=this.children.get(t).asMutable();r.add(n),this.children.set(t,r),this.childMutations.set(t,r)}}removeChild(t,n){if(this.changeChildren(),this.childMutations.has(t))this.childMutations.get(t).remove(n);else{const r=this.children.get(t).asMutable();r.remove(n),this.children.set(t,r),this.childMutations.set(t,r)}}clearRoot(){const t=ur.RootRef;if(0===this.children.get(t).size)return;this.changeChildren();const n=sl();this.children.set(t,n),this.childMutations.set(t,n)}mutateDependency(t,n,r){let i=this.dependencyMutations.get(t);if(!i){const o=this.dependencies.get(t);if(!o&&"remove"===r)return;this.changeDependencies(),i=o?o.asMutable():sl().asMutable(),this.dependencyMutations.set(t,i),this.dependencies.set(t,i)}"add"===r?i.add(n):i.remove(n)}changeParent(t,n){QT(this.transforms,t);const r=this.transforms.get(t);this.removeChild(r.parent,t),this.addChild(n,t),this.changeNodes(),this.transforms.set(t,ur.withParent(r,n))}add(t){const n=t.ref;this.transforms.has(t.ref)&&this.transforms.get(t.ref).parent!==t.parent&&function yVe(e){throw new Error(`Transform '${e}' is already present in the tree.`)}(t.ref);const r=this.children.get(t.parent);if(r||function bVe(e){throw new Error(`Parent '${e}' must be present in the tree.`)}(t.parent),r.has(t.ref)||this.addChild(t.parent,t.ref),this.children.has(t.ref)||(this.changedChildren||(this.changedChildren=!0,this.children=this.children.asMutable()),this.children.set(t.ref,sl())),this.changeNodes(),this.transforms.set(n,t),t.dependsOn)for(const i of t.dependsOn)this.mutateDependency(i,n,"add");return this}setParams(t,n){QT(this.transforms,t);const r=this.transforms.get(t);return!JF(r.params,n)&&(this.changedNodes||(this.changedNodes=!0,this.transforms=this.transforms.asMutable()),this.transforms.set(r.ref,ur.withParams(r,n)),!0)}setTags(t,n){QT(this.transforms,t);const r=this.transforms.get(t),i=ur.withParams(r,n);return!LZ(r.tags,i.tags)&&(this.changedNodes||(this.changedNodes=!0,this.transforms=this.transforms.asMutable()),this.transforms.set(r.ref,i),!0)}assignState(t,n){QT(this.transforms,t);const r=this.transforms.get(t);if(this._stateUpdates&&this._stateUpdates.has(t))return ur.assignState(r.state,n),r;{this._stateUpdates||(this._stateUpdates=new Set),this._stateUpdates.add(r.ref),this.changeNodes();const i=ur.withState(r,n);return this.transforms.set(t,i),i}}remove(t){const n=this.transforms.get(t);if(!n)return[];const r=bo.subtreePostOrder(this,n);if(t===ur.RootRef){if(r.pop(),0===r.length)return r;this.clearRoot()}else{if(0===r.length)return r;this.removeChild(n.parent,n.ref)}this.changeNodes(),this.changeChildren();for(const o of r)this.transforms.delete(o.ref),this.children.delete(o.ref),this._childMutations&&this._childMutations.delete(o.ref);const i=[];for(const o of r){if(o.dependsOn)for(const s of o.dependsOn)this.transforms.has(s)&&this.mutateDependency(s,o.ref,"remove");if(this.dependencies.has(o.ref)){const s=this.dependencies.get(o.ref).toArray();this.changeDependencies(),this.dependencies.delete(o.ref),this._dependencyMutations&&this._dependencyMutations.delete(o.ref);for(const a of s)if(this.transforms.has(a))for(const c of this.remove(a))i[i.length]=c}}for(const o of i)r[r.length]=o;return r}asImmutable(){return this.changedNodes||this.changedChildren||this._childMutations?(this._childMutations&&this._childMutations.forEach(mVe,this.children),this._dependencyMutations&&this._dependencyMutations.forEach(gVe,this.dependencies),bo.create(this.changedNodes?this.transforms.asImmutable():this.transforms,this.changedChildren?this.children.asImmutable():this.children,this.changedDependencies?this.dependencies.asImmutable():this.dependencies)):this.tree}constructor(t){this.tree=t,this.transforms=this.tree.transforms,this.children=this.tree.children,this.dependencies=this.tree.dependencies,this.changedNodes=!1,this.changedChildren=!1,this.changedDependencies=!1,this._childMutations=void 0,this._dependencyMutations=void 0,this._stateUpdates=void 0}}function mVe(e,t){this.set(t,e.asImmutable())}function gVe(e,t){0===e.size?this.delete(t):this.set(t,e.asImmutable())}function QT(e,t){if(!e.has(t))throw new Error(`Node '${t}' is not present in the tree.`)}!function(e){class t{get root(){return this.transforms.get(ur.RootRef)}asTransient(){return new hVe(this)}constructor(_,S,A){this.transforms=_,this.children=S,this.dependencies=A}}function r(x,_,S){return new t(x,_,S)}function i(x){o(this,this.tree.transforms.get(x))}function o(x,_){const S=x.tree.children.get(_.ref);S&&S.size&&S.forEach(i,x),x.f(_,x.tree,x.state)}function s(x,_,S,A){const E={tree:x,state:S,f:A};return o(E,_),E.state}function a(x){c(this,this.tree.transforms.get(x))}function c(x,_){const S=x.f(_,x.tree,x.state);if("boolean"==typeof S&&!S)return;const A=x.tree.children.get(_.ref);A&&A.size&&A.forEach(a,x)}function u(x,_,S,A){const E={tree:x,state:S,f:A};return c(E,_),E.state}function l(x,_,S){S.push(x)}function f(x,_,S){S.push(ur.toJSON(x))}function g(x,_,S){if(_===S)return!0;const E=x.children.get(_).values();for(;;){const w=E.next();if(w.done)return!1;if(g(x,w.value,S))return!0}}e.createEmpty=function n(x){const _=x||ur.createRoot();return r(gu([[_.ref,_]]),gu([[_.ref,sl()]]),gu())},e.create=r,e.doPostOrder=s,e.doPreOrder=u,e.subtreePostOrder=function d(x,_){return s(x,_,[],l)},e.toJSON=function p(x){const _=[];return u(x,x.root,_,f),{transforms:_}},e.fromJSON=function m(x){const _=gu().asMutable(),S=gu().asMutable(),A=gu().asMutable();for(const w of x.transforms){const D=ur.fromJSON(w);_.set(D.ref,D),S.has(D.ref)||S.set(D.ref,sl().asMutable()),D.ref!==D.parent&&S.get(D.parent).add(D.ref)}const E=new Set;for(const w of x.transforms){const D=w.ref;if(S.set(D,S.get(D).asImmutable()),w.dependsOn)for(const I of w.dependsOn)E.add(I),A.has(I)?A.get(I).add(D):A.set(I,sl([D]).asMutable())}return E.forEach(w=>{A.set(w,A.get(w).asImmutable())}),r(_.asImmutable(),S.asImmutable(),A.asImmutable())},e.dump=function h(x){console.log({tr:x.transforms.keySeq().toArray(),tr1:x.transforms.valueSeq().toArray().map(_=>_.ref),ch:x.children.keySeq().toArray()})},e.subtreeHasRef=function y(x,_,S){return!(!x.transforms.has(_)||!x.transforms.has(S))&&g(x,_,S)},e.getDecoratorRoot=function b(x,_){const S=x.children.get(_);if(1!==S.size)return _;const A=x.transforms.get(S.first());return A.transformer.definition.isDecorator?b(x,A.ref):_}}(bo||(bo={})),function(e){function t(O,H){return n(O)(H)}function n(O){const H=O||u.root;let W;return W=function i(O){return void 0!==O.compile}(H)?H.compile():function r(O){return void 0!==O.transform&&void 0!==O.status}(H)?u.byValue(H).compile():function o(O){return"function"==typeof O}(H)?H:u.byRef(H).compile(),W}e.select=t,e.compile=n;const s={select(O){return t(this,O||this.state)}};function a(O,H){s[O]=function(...W){return H.call(void 0,this,...W)}}function c(O){return Object.create(s,{compile:{writable:!1,configurable:!1,value:O}})}let u;function l(O,H){const W=n(O);return c(()=>Q=>{const fe=[];for(const X of W(Q))for(const J of H(X,Q))fe.push(J);return fe})}function d(O,H){const W=n(O);return c(()=>Q=>{const fe=[];for(const X of W(Q)){const J=H(X,Q);J&&fe.push(J)}return fe})}function f(O){const H=n(O);return c(()=>W=>{const Q=new Set,fe=[];for(const X of H(W))X&&(Q.has(X.transform.ref)||(Q.add(X.transform.ref),fe.push(X)));return fe})}function p(O){const H=n(O);return c(()=>W=>{const Q=H(W);return Q.length?[Q[0]]:[]})}function m(O,H){return l(O,W=>H(W)?[W]:[])}function h(O,H){return m(O,W=>W.status===H)}function g(O,H){return m(O,W=>!!W.transform.tags&&W.transform.tags.indexOf(H)>=0)}function y(O){return l(O,(H,W)=>{const Q=[];return bo.doPreOrder(W.tree,W.tree.transforms.get(H.transform.ref),Q,(fe,X,J)=>{J.push(fe.ref)}),Q.map(fe=>W.cells.get(fe))})}function b(O){return l(O,(H,W)=>{const Q=[];return W.tree.children.get(H.transform.ref).forEach(fe=>Q.push(W.cells.get(fe))),Q})}function x(O,H){return m(O,W=>!!W.obj&&W.obj.type===H.type)}function _(O,H){return f(d(O,(W,Q)=>T(Q.tree,Q.cells,W.transform.ref,H)))}function S(O,H){return f(d(O,(W,Q)=>V(Q.tree,Q.cells,W.transform.ref,H)))}function A(O,H){return f(d(O,(W,Q)=>N(Q.tree,Q.cells,W.transform.ref,H)))}function E(O,H){return m(O,W=>W.transform.transformer===H)}function w(O,H){return f(d(O,(W,Q)=>M(Q.tree,Q.cells,W.transform.ref,H)))}function D(O,H){return f(d(O,(W,Q)=>F(Q.tree,Q.cells,W.transform.ref,H)))}function I(O){return f(d(O,(H,W)=>W.cells.get(W.tree.transforms.get(H.transform.ref).parent)))}function R(O,H,W,Q,fe){let J,X=O.transforms.get(W);for(;;){X=O.transforms.get(X.parent);const ce=H.get(X.ref);if(ce.obj&&Q(ce)&&(J=ce,fe)||X.ref===ur.RootRef)return J}}function T(O,H,W,Q){return R(O,H,W,Q,!0)}function M(O,H,W,Q){return R(O,H,W,Q,!1)}function N(O,H,W,Q){return T(O,H,W,Array.isArray(Q)?fe=>Q.indexOf(fe.transform.transformer)>=0:fe=>fe.transform.transformer===Q)}function V(O,H,W,Q){return T(O,H,W,G(Q))}function F(O,H,W,Q){return M(O,H,W,G(Q))}function G(O){return Array.isArray(O)?H=>{for(const W of O)if(W.type===H.obj.type)return!0}:H=>H.obj.type===O.type}function z(O,H,W){if(O.tags)for(const Q of O.tags)if(W.tags.has(Q)){W.refs[Q]=O.ref;break}return!0}function Z(O,H,W){return!(O.tags&&O.tags.indexOf(W.tag)>=0&&(W.ref=O.ref,1))}function ee(O,H,W){if(O.tags){const Q=W.tags.size;let fe=0;for(const X of O.tags)if(W.tags.has(X)&&(fe++,fe===Q)){W.refs.push(O);break}}else 0===W.tags.size&&W.refs.push(O)}(function(O){function ce(oe,K,ne){const de=ne.cells.get(oe.ref);return!de||!de.obj||de.obj.type!==ne.type||(ne.roots.push(de),!1)}function be(oe,K,ne){const de=ne.cells.get(oe.ref);return de&&de.obj&&de.obj.type===ne.type&&ne.ret.push(de),!0}function ae(oe,K,ne){const de=ne.cells.get(oe.ref);return de&&de.obj&&de.transform.transformer===ne.t&&ne.ret.push(de),!0}function me(oe,K,ne){const de=ne.cells.get(oe.ref);return de&&"error"===de.status&&de.transform.transformer===ne.t&&ne.ret.push(de),!0}O.root=c(()=>oe=>[oe.cells.get(oe.tree.root.ref)]),O.byRef=function H(...oe){return c(()=>K=>{const ne=[];for(const de of oe){const we=K.cells.get(de);we&&ne.push(we)}return ne})},O.byValue=function W(...oe){return c(()=>K=>oe)},O.rootsOfType=function Q(oe,K=ur.RootRef){return c(()=>ne=>{const de={roots:[],cells:ne.cells,type:oe.type};return bo.doPreOrder(ne.tree,ne.tree.transforms.get(K),de,ce),de.roots})},O.ofType=function fe(oe,K=ur.RootRef){return c(()=>ne=>{const de={ret:[],cells:ne.cells,type:oe.type};return bo.doPreOrder(ne.tree,ne.tree.transforms.get(K),de,be),de.ret})},O.ofTransformer=function X(oe,K=ur.RootRef){return c(()=>ne=>{const de={ret:[],cells:ne.cells,t:oe};return bo.doPreOrder(ne.tree,ne.tree.transforms.get(K),de,ae),de.ret})},O.ofTransformerWithError=function J(oe,K=ur.RootRef){return c(()=>ne=>{const de={ret:[],cells:ne.cells,t:oe};return bo.doPreOrder(ne.tree,ne.tree.transforms.get(K),de,me),de.ret})}})(u=e.Generators||(e.Generators={})),a("flatMap",l),e.flatMap=l,a("mapObject",d),e.mapObject=d,a("unique",f),e.unique=f,a("first",p),e.first=p,a("filter",m),e.filter=m,a("withStatus",h),e.withStatus=h,a("withTag",g),e.withTag=g,a("subtree",y),e.subtree=y,a("children",b),e.children=b,a("ofType",x),e.ofType=x,a("ancestor",_),e.ancestor=_,a("ancestorOfType",S),e.ancestorOfType=S,a("ancestorWithTransformer",A),e.ancestorWithTransformer=A,a("withTransformer",E),e.withTransformer=E,a("root",w),e.root=w,a("rootOfType",D),e.rootOfType=D,a("parent",I),e.parent=I,e.findAncestor=T,e.findRoot=M,e.findAncestorWithTransformer=N,e.findAncestorOfType=V,e.findRootOfType=F,e.findUniqueTagsInSubtree=function L(O,H,W){return bo.doPreOrder(O,O.transforms.get(H),{refs:{},tags:W},z).refs},e.findTagInSubtree=function j(O,H,W){return bo.doPreOrder(O,O.transforms.get(H),{ref:void 0,tag:W},Z).ref},e.findWithAllTags=function $(O,H,W){return bo.doPreOrder(O,O.transforms.get(H),{refs:[],tags:W},ee).refs},e.tryFindDecorator=function q(O,H,W){if(O.transforms.get(H).transformer===W)return O.cells.get(H);const fe=O.tree.children.get(H);if(1!==fe.size)return;const X=fe.first();return O.transforms.get(X).transformer.definition.isDecorator?q(O,X,W):void 0}}(In||(In={})),function(e){e.create=function t(){const n=new vVe,r=()=>n.create();return r.dispose=()=>n.dispose(),r.behavior=i=>n.behavior(i),r}}(wp||(wp={}));class vVe{constructor(){this._eventList=[],this._disposed=!1}create(){const t=new mr;return this._eventList.push(t),t}behavior(t){const n=new Ao(t);return this._eventList.push(n),n}dispose(){if(!this._disposed){for(const t of this._eventList)t.complete();this._disposed=!0}}}var vL=Symbol.for("immer-nothing"),rS=Symbol.for("immer-draftable"),zr=Symbol.for("immer-state");function Fs(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var o0=Object.getPrototypeOf;function dm(e){return!!e&&!!e[zr]}function lf(e){return!!e&&(zne(e)||Array.isArray(e)||!!e[rS]||!!e.constructor?.[rS]||oS(e)||sS(e))}var _Ve=Object.prototype.constructor.toString();function zne(e){if(!e||"object"!=typeof e)return!1;const t=o0(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===_Ve}function mv(e,t){0===s0(e)?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function s0(e){const t=e[zr];return t?t.type_:Array.isArray(e)?1:oS(e)?2:sS(e)?3:0}function iS(e,t){return 2===s0(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Gne(e,t,n){const r=s0(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function oS(e){return e instanceof Map}function sS(e){return e instanceof Set}function Bs(e){return e.copy_||e.base_}function xL(e,t){if(oS(e))return new Map(e);if(sS(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&zne(e))return o0(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[zr];let r=Reflect.ownKeys(n);for(let i=0;i1&&(e.set=e.add=e.clear=e.delete=SVe),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>SL(r,!0))),e}function SVe(){Fs(2)}function JT(e){return Object.isFrozen(e)}var aS,CL={};function a0(e){const t=CL[e];return t||Fs(0),t}function eD(){return aS}function Hne(e,t){t&&(a0("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function wL(e){AL(e),e.drafts_.forEach(wVe),e.drafts_=null}function AL(e){e===aS&&(aS=e.parent_)}function qne(e){return aS=function CVe(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}(aS,e)}function wVe(e){const t=e[zr];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Wne(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[zr].modified_&&(wL(t),Fs(4)),lf(e)&&(e=tD(t,e),t.parent_||nD(t,e)),t.patches_&&a0("Patches").generateReplacementPatches_(n[zr].base_,e,t.patches_,t.inversePatches_)):e=tD(t,n,[]),wL(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==vL?e:void 0}function tD(e,t,n){if(JT(t))return t;const r=t[zr];if(!r)return mv(t,(i,o)=>$ne(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return nD(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let o=i,s=!1;3===r.type_&&(o=new Set(i),i.clear(),s=!0),mv(o,(a,c)=>$ne(e,r,i,a,c,n,s)),nD(e,i,!1),n&&e.patches_&&a0("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function $ne(e,t,n,r,i,o,s){if(dm(i)){const c=tD(e,i,o&&t&&3!==t.type_&&!iS(t.assigned_,r)?o.concat(r):void 0);if(Gne(n,r,c),!dm(c))return;e.canAutoFreeze_=!1}else s&&n.add(i);if(lf(i)&&!JT(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;tD(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof r&&Object.prototype.propertyIsEnumerable.call(n,r)&&nD(e,i)}}function nD(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&SL(t,n)}var IL={get(e,t){if(t===zr)return e;const n=Bs(e);if(!iS(n,t))return function IVe(e,t,n){const r=Yne(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!lf(r)?r:r===TL(e.base_,t)?(DL(e),e.copy_[t]=uS(r,e)):r},has:(e,t)=>t in Bs(e),ownKeys:e=>Reflect.ownKeys(Bs(e)),set(e,t,n){const r=Yne(Bs(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=TL(Bs(e),t),o=i?.[zr];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(function xVe(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(n,i)&&(void 0!==n||iS(e.base_,t)))return!0;DL(e),Ap(e)}return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==TL(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,DL(e),Ap(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Bs(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}},defineProperty(){Fs(11)},getPrototypeOf:e=>o0(e.base_),setPrototypeOf(){Fs(12)}},cS={};function TL(e,t){const n=e[zr];return(n?Bs(n):e)[t]}function Yne(e,t){if(!(t in e))return;let n=o0(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=o0(n)}}function Ap(e){e.modified_||(e.modified_=!0,e.parent_&&Ap(e.parent_))}function DL(e){e.copy_||(e.copy_=xL(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function uS(e,t){const n=oS(e)?a0("MapSet").proxyMap_(e,t):sS(e)?a0("MapSet").proxySet_(e,t):function AVe(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:eD(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=IL;n&&(i=[r],o=cS);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:eD()).drafts_.push(n),n}function Xne(e){if(!lf(e)||JT(e))return e;const t=e[zr];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=xL(e,t.scope_.immer_.useStrictShallowCopy_)}else n=xL(e,!0);return mv(n,(r,i)=>{Gne(n,r,Xne(i))}),t&&(t.finalized_=!1),n}mv(IL,(e,t)=>{cS[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),cS.deleteProperty=function(e,t){return cS.set.call(this,e,t,void 0)},cS.set=function(e,t,n){return IL.set.call(this,e[0],t,n,e[0])};var u0,df,rD,yu=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if("function"==typeof t&&"function"!=typeof n){const o=n;n=t;const s=this;return function(c=o,...u){return s.produce(c,l=>n.call(this,l,...u))}}let i;if("function"!=typeof n&&Fs(6),void 0!==r&&"function"!=typeof r&&Fs(7),lf(t)){const o=qne(this),s=uS(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?wL(o):AL(o)}return Hne(o,r),Wne(i,o)}if(!t||"object"!=typeof t){if(i=n(t),void 0===i&&(i=t),i===vL&&(i=void 0),this.autoFreeze_&&SL(i,!0),r){const o=[],s=[];a0("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}Fs(1)},this.produceWithPatches=(t,n)=>{if("function"==typeof t)return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let r,i;return[this.produce(t,n,(s,a)=>{r=s,i=a}),r,i]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){lf(e)||Fs(8),dm(e)&&(e=function DVe(e){return dm(e)||Fs(10),Xne(e)}(e));const t=qne(this),n=uS(e,void 0);return n[zr].isManual_=!0,AL(t),n}finishDraft(e,t){const n=e&&e[zr];(!n||!n.isManual_)&&Fs(9);const{scope_:r}=n;return Hne(r,t),Wne(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=a0("Patches").applyPatches_;return dm(e)?r(e,t):this.produce(e,i=>r(i,t))}},c0=yu.produce,EVe=(yu.produceWithPatches.bind(yu),yu.setAutoFreeze.bind(yu));function Kne(...e){let t;const n=[];for(const r of e)if(r)if(t||(t=new Set),"string"==typeof r){if(t.has(r))continue;t.add(r),n.push(r)}else for(const i of r)t.has(i)||(t.add(i),n.push(i));return n}yu.setUseStrictShallowCopy.bind(yu),yu.applyPatches.bind(yu),yu.createDraft.bind(yu),yu.finishDraft.bind(yu),function(e){function t(s){if(!s.state||s.state.tree===s.editInfo.sourceTree)return s.tree.asImmutable();const a=s.state.tree.asTransient();for(const c of s.actions)switch(c.kind){case"add":a.add(c.transform);break;case"update":a.setParams(c.ref,c.params);break;case"delete":a.remove(c.ref);break;case"insert":{const u=a.children.get(c.ref).toArray();a.add(c.transform);for(const l of u)a.changeParent(l,c.transform.ref);break}}return s.editInfo.sourceTree=s.tree,a.asImmutable()}e.is=function n(s){return!!s&&"function"==typeof s.getTree},e.isTo=function r(s){return!!s&&"function"==typeof s.getTree&&"string"==typeof s.ref},e.Root=class i{get editInfo(){return this.state.editInfo}get currentTree(){return this.state.tree}to(a){const c="string"==typeof a?a:N2.is(a)?a.transform.ref:a.ref;return new o(this.state,c,this)}toRoot(){return new o(this.state,this.state.tree.root.ref,this)}delete(a){const c=ls.resolveRef(a);return c&&this.state.tree.transforms.has(c)?(this.editInfo.count++,this.state.tree.remove(c),this.state.actions.push({kind:"delete",ref:c}),this):this}getTree(){return t(this.state)}commit(a){if(!this.state.state)throw new Error("Cannot commit template tree");return this.state.state.runTask(this.state.state.updateTree(this,a))}constructor(a,c){this.state={state:c,tree:a.asTransient(),actions:[],editInfo:{applied:!1,sourceTree:a,count:0,lastUpdate:void 0}}}};class o{get editInfo(){return this.state.editInfo}get selector(){return new wte(this.ref,this.state.state)}getApplyRoot(){return bo.getDecoratorRoot(this.state.tree,this.ref)}apply(a,c,u){if(a.definition.isDecorator)return this.insert(a,c,u);const l=this.getApplyRoot(),d=a.apply(l,c,u);return this.state.tree.add(d),this.editInfo.count++,this.editInfo.lastUpdate=d.ref,this.state.actions.push({kind:"add",transform:d}),new o(this.state,d.ref,this.root)}applyOrUpdate(a,c,u,l){if(this.state.tree.transforms.has(a)){const d=this.to(a);return u&&d.update(u),d}return this.apply(c,u,{...l,ref:a})}applyOrUpdateTagged(a,c,u,l){if(c.definition.isDecorator)throw new Error("Can't use applyOrUpdateTagged on decorator transformers.");const d=this.getApplyRoot(),f=this.state.tree.children.get(d).values();for(;;){const m=f.next();if(m.done)break;const h=this.state.tree.transforms.get(m.value);if(h&&ur.hasTags(h,a)){const g=this.to(m.value);return g.updateTagged(u,Kne(h.tags,a,l&&l.tags)),g}}const p=c.apply(d,u,{...l,tags:Kne(a,l&&l.tags)});return this.state.tree.add(p),this.editInfo.count++,this.editInfo.lastUpdate=p.ref,this.state.actions.push({kind:"add",transform:p}),new o(this.state,p.ref,this.root)}group(a,c,u){return this.apply(a,c,u)}insert(a,c,u){const l=this.state.tree.children.get(this.ref).toArray(),d=a.apply(this.ref,c,u);this.state.tree.add(d);for(const f of l)this.state.tree.changeParent(f,d.ref);return this.editInfo.count++,this.editInfo.lastUpdate=d.ref,this.state.actions.push({kind:"insert",ref:this.ref,transform:d}),new o(this.state,d.ref,this.root)}updateTagged(a,c){(this.state.tree.setParams(this.ref,a)||this.state.tree.setTags(this.ref,c))&&(this.editInfo.count++,this.editInfo.lastUpdate=this.ref,this.state.actions.push({kind:"update",ref:this.ref,params:a}))}update(a,c){let u;if(c){const l=this.state.tree.transforms.get(this.ref);u=c0(l.params,c)}else u="function"==typeof a?c0(this.state.tree.transforms.get(this.ref).params,a):a;return this.state.tree.setParams(this.ref,u)&&(this.editInfo.count++,this.editInfo.lastUpdate=this.ref,this.state.actions.push({kind:"update",ref:this.ref,params:u})),this.root}to(a){return this.root.to(a)}toRoot(){return this.root.toRoot()}delete(a){return this.root.delete(a)}getTree(){return t(this.state)}commit(a){if(!this.state.state)throw new Error("Cannot commit template tree");return this.state.state.runTask(this.state.state.updateTree(this,a))}constructor(a,c,u){if(this.state=a,this.root=u,this.ref=c,!this.state.tree.transforms.has(c))throw new Error(`Could not find node '${c}'.`)}}e.To=o}(u0||(u0={}));class PVe{constructor(){this.ev=wp.create(),this.actions=new Map,this.fromTypeIndex=new Map,this.events={added:this.ev(),removed:this.ev()}}add(t){const n=Qe.is(t)?t.toAction():t;if(this.actions.has(n.id))return this;this.actions.set(n.id,n);for(const r of n.definition.from)this.fromTypeIndex.has(r.type)?this.fromTypeIndex.get(r.type).push(n):this.fromTypeIndex.set(r.type,[n]);return this.events.added.next(void 0),this}remove(t){const n=Qe.is(t)?t.toAction().id:Hr.is(t)?t:t.id,r=this.actions.get(n);if(!r)return this;this.actions.delete(n);for(const i of r.definition.from){const o=this.fromTypeIndex.get(i.type);o&&(Eg(o,r),0===o.length&&this.fromTypeIndex.delete(i.type))}return this.events.removed.next(void 0),this}fromCell(t,n){const r=t.obj;if(!r)return[];const i=this.fromTypeIndex.get(r.type);if(!i)return[];let o=!1;for(const a of i)if(a.definition.isApplicable){o=!0;break}if(!o)return i;const s=[];for(const a of i)a.definition.isApplicable?a.definition.isApplicable(r,t.transform,n)&&s.push(a):s.push(a);return s}dispose(){this.ev.dispose()}}!function(e){e.message=function t(o){return{type:"message",timestamp:new Date,message:o}},e.error=function n(o){return{type:"error",timestamp:new Date,message:o}},e.warning=function r(o){return{type:"warning",timestamp:new Date,message:o}},e.info=function i(o){return{type:"info",timestamp:new Date,message:o}}}(df||(df={})),function(e){e.Impl=class t{get current(){return this._current}set current(o){this._current=o}getAncestorOfType(o){if(!this._current)return;let s=this._current;for(;;){if(s=this.cells.get(s.transform.parent),!s.obj)return;if(s.obj.type===o.type)return s.obj;if(s.transform.ref===ur.RootRef)return}}getRootOfType(o){if(!this._current)return;let a,s=this._current;for(;;){if(!s.obj)return;if(s.obj.type===o.type&&(a=s),s.transform.ref===ur.RootRef)return a?a.obj:void 0;s=this.cells.get(s.transform.parent)}}constructor(o){this.cells=o,this._current=void 0}},e.getDecoratorChain=function n(i,o){const s=i.cells;let a=s.get(o);const c=[a];for(;a?.transform.transformer.definition.isDecorator;)a=s.get(a.transform.parent),c.push(a);return c},e.getRootOfType=function r(i,o,s){let a,c=i.cells.get(s);if(c)for(;;){if(!c.obj)return;if(c.obj.type===o.type&&(a=c),c.transform.ref===ur.RootRef)return a?a.obj:void 0;c=i.cells.get(c.transform.parent)}}}(rD||(rD={}));class MVe{constructor(){this.queue=[],this.signal=new mr}get length(){return this.queue.length}enqueue(t){return this.queue.push(t),1===this.queue.length||this.waitFor(t)}handled(t){Xx(this.queue,t),this.queue.length>0&&this.signal.next({v:this.queue[0],stillPresent:!0})}remove(t){const n=Xx(this.queue,t);return n&&this.signal.next({v:t,stillPresent:!1}),n}waitFor(t){return new Promise(n=>{const r=this.signal.subscribe(({v:i,stillPresent:o})=>{i===t&&(r.unsubscribe(),n(o))})})}}class iD{get tree(){return this._tree}get transforms(){return this._tree.transforms}get current(){return this.behaviors.currentObject.value.ref}get root(){return this.cells.get(this._tree.root.ref)}build(){return new u0.Root(this.tree,this)}addHistory(t,n){0!==this.historyCapacity&&(this.history.unshift([t,n||"Update"]),this.history.length>this.historyCapacity&&this.history.pop(),this.events.historyUpdated.next({state:this}))}clearHistory(){0!==this.history.length&&(this.history=[],this.events.historyUpdated.next({state:this}))}get latestUndoLabel(){return this.history.length>0?this.history[0][1]:void 0}get canUndo(){return this.history.length>0}undo(){var t=this;return Oe.create("Undo",function(){var n=ie(function*(r){const i=t.history.shift();if(i){t.events.historyUpdated.next({state:t}),t.undoingHistory=!0;try{yield t.updateTree(i[0],{canUndo:!1}).runInContext(r)}finally{t.undoingHistory=!1}}});return function(r){return n.apply(this,arguments)}}())}getSnapshot(){return{tree:bo.toJSON(this._tree)}}setSnapshot(t){const n=bo.fromJSON(t.tree);return this.updateTree(n)}setCurrent(t){this.behaviors.currentObject.next({state:this,ref:t})}updateCellState(t,n){const r=this.cells.get(t);if(!r)return;const i="function"==typeof n?n(r.state):n;ur.assignState(r.state,i)&&(r.transform=this._tree.assignState(r.transform.ref,i),this.events.cell.stateUpdated.next({state:this,ref:t,cell:r}))}dispose(){this.ev.dispose(),this.actions.dispose()}select(t){return In.select(t,this)}selectQ(t){return In.select("string"==typeof t?t:t(In.Generators),this)}applyAction(t,n,r=ur.RootRef){return Oe.create("Apply Action",i=>{const o=this.cells.get(r);if(!o)throw new Error(`'${r}' does not exist.`);if("ok"!==o.status)throw new Error(`Action cannot be applied to a cell with status '${o.status}'`);return NL(t.definition.run({ref:r,cell:o,a:o.obj,params:n,state:this},this.globalContext),i)})}transaction(t,n){var r=this;return Oe.create("State Transaction",function(){var i=ie(function*(o){const s=r.inTransaction,a=r._tree.asImmutable();let c=!1;try{s||r.behaviors.isUpdating.next(!0),r.inTransaction=!0,r.inTransactionError=!1,yield t(o),r.inTransactionError&&(c=!0,yield r.updateTree(a).runInContext(o))}catch(u){if(c||(c=!0,yield r.updateTree(a).runInContext(o),r.events.log.next(df.error("Error during state transaction, reverting"))),s)throw r.inTransactionError=!0,u;if(n?.rethrowErrors)throw u;console.error(u)}finally{s||(r.inTransaction=!1,r.events.changed.next({state:r,inTransaction:!1}),r.behaviors.isUpdating.next(!1),c||(n?.canUndo?r.addHistory(a,"string"==typeof n.canUndo?n.canUndo:void 0):r.clearHistory()))}});return function(o){return i.apply(this,arguments)}}())}get inUpdate(){return this._inUpdate}updateTree(t,n){var r=this;const i={tree:t,options:n};return Oe.create("Update Tree",function(){var o=ie(function*(s){if(!(yield r.updateQueue.enqueue(i)))return;r._inUpdate=!0;const c=n?.canUndo?r._tree.asImmutable():void 0;let u=!1;r.inTransaction||r.behaviors.isUpdating.next(!0);try{if(u0.is(t)){if(t.editInfo.applied)throw new Error("This builder has already been applied. Create a new builder for further state updates");t.editInfo.applied=!0}r.reverted=!1;const l=n&&(n.revertIfAborted||n.revertOnError)?yield r._revertibleTreeUpdate(s,i,n):yield r._updateTree(s,i);return u=r.reverted,l.ctx.hadError&&(r.inTransactionError=!0),l.cell?new wte(l.cell.transform.ref,r):void 0}finally{r._inUpdate=!1,r.updateQueue.handled(i),r.inTransaction||(r.behaviors.isUpdating.next(!1),n?.canUndo?u||r.addHistory(c,"string"==typeof n.canUndo?n.canUndo:void 0):r.undoingHistory||r.clearHistory())}});return function(s){return o.apply(this,arguments)}}(),()=>{this.updateQueue.remove(i)})}_revertibleTreeUpdate(t,n,r){var i=this;return ie(function*(){const o=i.tree,s=yield i._updateTree(t,n);return(s.ctx.hadError||s.ctx.wasAborted)&&r.revertOnError||s.ctx.wasAborted&&r.revertIfAborted?(i.reverted=!0,yield i._updateTree(t,{tree:o,options:n.options})):s})()}_updateTree(t,n){var r=this;return ie(function*(){let i=!1;const o=r.updateTreeAndCreateCtx(n.tree,t,n.options);try{return i=yield function kVe(e){return EL.apply(this,arguments)}(o),u0.isTo(n.tree)?{ctx:o,cell:r.select(n.tree.ref)[0]}:{ctx:o}}finally{r.spine.current=void 0,i&&r.events.changed.next({state:r,inTransaction:r.inTransaction})}})()}updateTreeAndCreateCtx(t,n,r){const i=(u0.is(t)?t.getTree():t).asTransient(),o=this._tree;this._tree=i;const s=this.cells,a={parent:this,editInfo:u0.is(t)?t.editInfo:void 0,errorFree:this.errorFree,taskCtx:n,oldTree:o,tree:i,cells:this.cells,spine:this.spine,results:[],options:{...RVe,...r},changed:!1,hadError:!1,wasAborted:!1,newCurrent:void 0,getCellData:c=>{var u;return null===(u=s.get(c).obj)||void 0===u?void 0:u.data}};return this.errorFree=!0,a}constructor(t,n){this.errorFree=!0,this.ev=wp.create(),this.globalContext=void 0,this.events={cell:{stateUpdated:this.ev(),created:this.ev(),removed:this.ev()},object:{updated:this.ev(),created:this.ev(),removed:this.ev()},log:this.ev(),changed:this.ev(),historyUpdated:this.ev()},this.behaviors={currentObject:this.ev.behavior({state:this,ref:ur.RootRef}),isUpdating:this.ev.behavior(!1)},this.actions=new PVe,this.cells=new Map,this.spine=new rD.Impl(this.cells),this.tryGetCellData=o=>{var s,a;const c=null===(a=null===(s=this.cells.get(o))||void 0===s?void 0:s.obj)||void 0===a?void 0:a.data;if(void 0===c)throw new Error(`Cell '${o}' data undefined.`);return c},this.historyCapacity=5,this.history=[],this.undoingHistory=!1,this.inTransaction=!1,this.inTransactionError=!1,this._inUpdate=!1,this.reverted=!1,this.updateQueue=new MVe,this._tree=bo.createEmpty(ur.createRoot(n&&n.rootState)).asTransient();const i=this._tree.root;this.runTask=n.runTask,void 0!==n?.historyCapacity&&(this.historyCapacity=n.historyCapacity),this.cells.set(i.ref,{parent:this,transform:i,sourceRef:void 0,obj:t,status:"ok",state:{...i.state},errorText:void 0,params:{definition:{},values:{}},paramsNormalizedVersion:i.version,dependencies:{dependentBy:[],dependsOn:[]},cache:{}}),this.globalContext=n&&n.globalContext}}!function(e){let n;e.create=function t(r,i){return new e(r,i)},(n=e.ObjectEvent||(e.ObjectEvent={})).isCell=function i(o,s){return!!s&&o.ref===s.transform.ref&&o.state===s.parent}}(iD||(iD={}));const RVe={doNotLogTiming:!1,doNotUpdateCurrent:!0,revertIfAborted:!1,revertOnError:!1,canUndo:!1};function EL(){return EL=ie(function*(e){let n,i,r=[];if(e.editInfo&&1===e.editInfo.count&&e.editInfo.lastUpdate&&e.editInfo.sourceTree===e.oldTree)n=[],i=[e.editInfo.lastUpdate];else{n=function OVe(e){const t={newTree:e.tree,cells:e.cells,deletes:[]};return bo.doPostOrder(e.oldTree,e.oldTree.root,t,BVe),t.deletes}(e);const a=e.parent.current;let c=!1;for(const u of n)if(u===a){c=!0;break}if(c){const u=Zne(e.oldTree,a,n,e.cells);e.parent.setCurrent(u)}for(let u=n.length-1;u>=0;u--){const l=e.cells.get(n[u]);l&&sD(l.transform,l.obj,l?.transform.params,l.cache,e.parent.globalContext)}for(const u of n){const l=e.cells.get(u);l&&(l.parent=void 0,GVe(l));const d=l&&l.obj;e.cells.delete(u),r.push(d)}i=function NVe(e,t){const n={roots:[],cells:e};return bo.doPreOrder(t,t.root,n,FVe),n.roots}(e.cells,e.tree)}const o=function qVe(e,t){const n={ctx:e,visited:new Set,added:[]};for(const i of t)bo.doPreOrder(e.tree,e.tree.transforms.get(i),n,jVe);for(const i of n.added)HVe(i,e);let r;return n.visited.forEach(i=>{const o=e.cells.get(i);for(const s of o.dependencies.dependentBy)n.visited.has(s.transform.ref)||(r||(r=kr.create()),kr.add(r,s.transform.ref,s))}),{added:n.added,dependent:r?r.array:void 0}}(e,i);for(const a of o.added)e.parent.events.cell.created.next({state:e.parent,ref:a.transform.ref,cell:a});for(let a=0;a0||i.length>0||e.changed}),EL.apply(this,arguments)}function FVe(e,t,n){const r=n.cells.get(e.ref);return r&&r.transform.version===e.version?!("error"===r.status||r&&r.obj===li.Null):(n.roots.push(e.ref),!1)}function BVe(e,t,n){!n.newTree.transforms.has(e.ref)&&n.cells.has(e.ref)&&n.deletes.push(e.ref)}function LVe(e,t,n){const r=n.cells.get(e.ref);!r||!ur.syncState(r.state,e.state)||n.parent.events.cell.stateUpdated.next({state:n.parent,ref:e.ref,cell:r})}function oD(e,t,n,r){const i=e.cells.get(t),o=i.status!==n;i.status=n,i.errorText=r,o&&e.parent.events.cell.stateUpdated.next({state:e.parent,ref:t,cell:i})}function VVe(e,t,n){n.cells.get(e.ref).transform=e,oD(n,e.ref,"pending")}function GVe(e){for(const t of e.dependencies.dependsOn)Eg(t.dependencies.dependentBy,e)}function jVe(e,t,{ctx:n,added:r,visited:i}){if(i.add(e.ref),n.cells.has(e.ref))return;const o={parent:n.parent,transform:e,sourceRef:void 0,status:"pending",state:{...e.state},errorText:void 0,params:void 0,paramsNormalizedVersion:"",dependencies:{dependentBy:[],dependsOn:[]},cache:void 0};n.cells.set(e.ref,o),r.push(o)}function HVe(e,t){if(e.transform.dependsOn)for(const n of e.transform.dependsOn){if(!t.tree.transforms.get(n))throw new Error("Cannot depend on a non-existent transform.");const i=t.cells.get(n);eo(e.dependencies.dependsOn,i),eo(i.dependencies.dependentBy,e)}}function Zne(e,t,n,r){return Qne(e,t,new Set(n),r)}function Qne(e,t,n,r){if(t===ur.RootRef)return t;const i=e.transforms.get(t),o=e.children.get(i.parent).values();let s,a=!1;for(;;){const c=o.next();if(c.done)break;if(n.has(c.value))continue;const u=r.get(c.value);if(!u||"error"===u.status||u.obj===li.Null)continue;const l=e.transforms.get(c.value);if(!l.state.isGhost){if(c.value===t){a=!0,n.has(t)||(s=t);continue}if(a)return l.ref;s=l.ref}}return s||Qne(e,i.parent,n,r)}function PL(e,t,n,r){r||(e.hadError=!0,e.parent.errorFree=!1);const i=e.cells.get(t);if(n){e.wasAborted=e.wasAborted||Oe.isAbort(n);const s=""+n;oD(e,t,"error",s),r||e.parent.events.log.next({type:"error",timestamp:new Date,message:s})}else i.params=void 0;if(i.obj){const s=i.obj;i.obj=void 0,i.cache=void 0,e.parent.events.object.removed.next({state:e.parent,ref:t,obj:s})}const o=e.tree.children.get(t).values();for(;;){const s=o.next();if(s.done)return;PL(e,s.value,void 0,r)}}const WVe="Parent is null";function Jne(e,t){return ML.apply(this,arguments)}function ML(){return ML=ie(function*(e,t){oD(e,t,"processing");let n=!1;try{const i=yi(),o=yield function YVe(e,t){return RL.apply(this,arguments)}(e,t),s=yi()-i;"none"!==o.action&&(e.changed=!0),oD(e,t,"ok"),e.results.push(o),"created"===o.action?(n=o.obj===li.Null,!n&&!e.options.doNotLogTiming&&e.parent.events.log.next(df.info(`Created ${o.obj.label} in ${qF(s)}.`))):("updated"===o.action||"replaced"===o.action)&&(n=o.obj===li.Null,!n&&!e.options.doNotLogTiming&&e.parent.events.log.next(df.info(`Updated ${o.obj.label} in ${qF(s)}.`)))}catch(i){return e.changed=!0,e.hadError||(e.newCurrent=t),PL(e,t,i,!1),void console.error(i)}const r=e.tree.children.get(t).values();for(;;){const i=r.next();if(i.done)return;n?PL(e,i.value,void 0,!0):yield Jne(e,i.value)}}),ML.apply(this,arguments)}function RL(){return RL=ie(function*(e,t){var n;const{oldTree:r,tree:i}=e,o=e.cells.get(t),s=o.transform;if(o.transform.ref===ur.RootRef)return{action:"none"};const a=e.cells.get(o.transform.parent);if(a?.obj===li.Null)return o.sourceRef=a.transform.ref,r.transforms.has(t)&&o.params?(sD(s,o.obj,o.params.values,o.cache,e.parent.globalContext),o.params=void 0,o.obj=li.Null,{ref:t,action:"updated",obj:o.obj}):(o.params=void 0,{ref:t,action:"created",obj:li.Null});const u=0===s.transformer.definition.from.length?a:In.findAncestorOfType(i,e.cells,t,s.transformer.definition.from);if(!u)throw new Error(`No suitable parent found for '${t}'`);e.spine.current=o;const l=u.obj;o.sourceRef=u.transform.ref;const d=function $Ve(e,t,n,r){const i=t.transformer.definition.params,o=i?i(n,e.parent.globalContext):{};if(r.paramsNormalizedVersion!==t.version)t.params=C.normalizeParams(o,t.params,"all"),r.paramsNormalizedVersion=t.version;else{const s=C.getDefaultValues(o);t.params=t.params?function AMe(e,t){for(const n of Object.keys(t))OI.call(t,n)&&typeof e[n]>"u"&&(e[n]=t[n]);return e}(t.params,s):s}return C.resolveRefs(o,t.params,e.getCellData),{definition:o,values:t.params}}(e,s,l,o);if(!r.transforms.has(t)||!o.params){o.params=d;const f=yield tre(e,o,s.transformer,l,d.values);return kL(f,s),o.obj=f,{ref:t,action:"created",obj:f}}{const f=o.params.values,p=o.cache,m=null===(n=o.obj)||void 0===n?void 0:n.data,h=d.values;switch(o.params=d,o.obj&&o.obj!==li.Null?yield function XVe(e,t,n,r,i,o,s){return FL.apply(this,arguments)}(e,o,s.transformer,l,o.obj,f,h):Qe.UpdateResult.Recreate){case Qe.UpdateResult.Recreate:{const y=o.obj;sD(s,y,f,p,e.parent.globalContext);const b=yield tre(e,o,s.transformer,l,h);return kL(b,s),o.obj=b,{ref:t,action:"replaced",oldObj:y,obj:b}}case Qe.UpdateResult.Updated:return kL(o.obj,s),{ref:t,action:"updated",oldData:m,obj:o.obj};case Qe.UpdateResult.Null:return sD(s,o.obj,f,p,e.parent.globalContext),o.obj=li.Null,{ref:t,action:"updated",obj:o.obj};default:return{action:"none"}}}}),RL.apply(this,arguments)}function sD(e,t,n,r,i){var o,s;null===(s=(o=e.transformer.definition).dispose)||void 0===s||s.call(o,{b:t!==li.Null?t:void 0,params:n,cache:r},i)}function kL(e,t){!e||e===li.Null||(e.tags=t.tags)}function NL(e,t){return"function"==typeof e.runInContext?e.runInContext(t):e}function ere(e){if(0===e.dependencies.dependsOn.length)return;const t=Object.create(null);for(const n of e.dependencies.dependsOn){if(!n.obj)throw new Error("Unresolved dependency.");t[n.transform.ref]=n.obj}return t}function tre(e,t,n,r,i){return t.cache||(t.cache=Object.create(null)),NL(n.definition.apply({a:r,params:i,cache:t.cache,spine:e.spine,dependencies:ere(t)},e.parent.globalContext),e.taskCtx)}function FL(){return FL=ie(function*(e,t,n,r,i,o,s){return n.definition.update?(t.cache||(t.cache=Object.create(null)),NL(n.definition.update({a:r,oldParams:o,b:i,newParams:s,cache:t.cache,spine:e.spine,dependencies:ere(t)},e.parent.globalContext),e.taskCtx)):Qe.UpdateResult.Recreate}),FL.apply(this,arguments)}var pe,Rt;!function(e){function r(f){return e.Create({...f,typeClass:"Representation3D"})}e.Create=li.factory(),e.isRepresentation3D=function t(f){return!!f&&"Representation3D"===f.type.typeClass},e.isBehavior=function n(f){return!!f&&"Behavior"===f.type.typeClass},e.CreateRepresentation3D=r,e.CreateBehavior=function i(f){return e.Create({...f,typeClass:"Behavior"})};class o extends(e.Create({name:"Root",typeClass:"Root"})){}e.Root=o;class s extends(e.Create({name:"Group",typeClass:"Group"})){}let a,c,u,l,d;e.Group=s,function(f){class p extends(e.Create({name:"String Data",typeClass:"Data"})){}f.String=p;class m extends(e.Create({name:"Binary Data",typeClass:"Data"})){}f.Binary=m;class h extends(e.Create({name:"Data Blob",typeClass:"Data"})){}f.Blob=h}(a=e.Data||(e.Data={})),function(f){class p extends(e.Create({name:"JSON Data",typeClass:"Data"})){}f.Json=p;class m extends(e.Create({name:"CIF File",typeClass:"Data"})){}f.Cif=m;class h extends(e.Create({name:"Cube File",typeClass:"Data"})){}f.Cube=h;class g extends(e.Create({name:"PSF File",typeClass:"Data"})){}f.Psf=g;class y extends(e.Create({name:"PRMTOP File",typeClass:"Data"})){}f.Prmtop=y;class b extends(e.Create({name:"TOP File",typeClass:"Data"})){}f.Top=b;class x extends(e.Create({name:"PLY File",typeClass:"Data"})){}f.Ply=x;class _ extends(e.Create({name:"CCP4/MRC/MAP File",typeClass:"Data"})){}f.Ccp4=_;class S extends(e.Create({name:"DSN6/BRIX File",typeClass:"Data"})){}f.Dsn6=S;class A extends(e.Create({name:"DX File",typeClass:"Data"})){}f.Dx=A;class E extends(e.Create({name:"Format Blob",typeClass:"Data"})){}f.Blob=E}(c=e.Format||(e.Format={})),function(f){class p extends(e.Create({name:"Coordinates",typeClass:"Object"})){}f.Coordinates=p;class m extends(e.Create({name:"Topology",typeClass:"Object"})){}f.Topology=m;class h extends(e.Create({name:"Model",typeClass:"Object"})){}f.Model=h;class g extends(e.Create({name:"Trajectory",typeClass:"Object"})){}f.Trajectory=g;class y extends(e.Create({name:"Structure",typeClass:"Object"})){}f.Structure=y,function(b){class x extends(r({name:"Structure 3D"})){}b.Representation3D=x;class _ extends(e.Create({name:"Structure 3D State",typeClass:"Object"})){}b.Representation3DState=_;class S extends(e.Create({name:"Selections",typeClass:"Object"})){}b.Selections=S}(y=f.Structure||(f.Structure={}))}(u=e.Molecule||(e.Molecule={})),function(f){class p extends(e.Create({name:"Volume",typeClass:"Object"})){}f.Data=p;class m extends(e.Create({name:"Lazy Volume",typeClass:"Object"})){}f.Lazy=m;class h extends(r({name:"Volume 3D"})){}f.Representation3D=h}(l=e.Volume||(e.Volume={})),function(f){class p extends(e.Create({name:"Shape Provider",typeClass:"Object"})){}f.Provider=p;class m extends(r({name:"Shape 3D"})){}f.Representation3D=m}(d=e.Shape||(e.Shape={}))}(pe||(pe={})),function(e){e.CreateBuiltIn=Qe.factory("ms-plugin"),e.BuiltIn=Qe.builderFactory("ms-plugin")}(Rt||(Rt={}));const nre=.529177210859;function JVe(e,t){return Oe.create("Parse Cube",function(){var n=ie(function*(r){yield r.update("Reading header...");const i=ht(e),{header:o,atoms:s}=function KVe(e){const t=ht.readLines(e,6),n=(b,x)=>{const _=+t[b].trim().split(/\s+/g)[x];return Number.isNaN(_)?0:_},r=b=>{const x=n(b+2,0),_=nre;return[Math.abs(x),v.create(n(b+2,1)*_,n(b+2,2)*_,n(b+2,3)*_),x]},i=t[0].trim(),o=t[1].trim(),[s,a,c]=r(0),[u,l]=r(1),[d,f]=r(2),[p,m]=r(3),h=function ZVe(e,t,n){const r=new Int32Array(t),i=new Float64Array(t),o=new Float32Array(t),s=new Float32Array(t),a=new Float32Array(t);for(let c=0;c=0){let b=n(2,4);0===b&&(b=1);for(let x=0;x{const u=Math.min(r,s+a);for(let l=s;la.update({current:Math.min(u,r),max:r}))}(r,i,o);return Fr.success({header:o,atoms:s,values:a,name:t})});return function(r){return n.apply(this,arguments)}}())}function rre(e){const t={h:v()};let n=0,r=0;const i=/\s+/g;for(;;){const o=ht.readLine(e);let s;if(o.startsWith("object 1"))s=o.split(i),t.dim=v.create(parseInt(s[5]),parseInt(s[6]),parseInt(s[7]));else if(o.startsWith("origin"))s=o.split(i),t.min=v.create(parseFloat(s[1]),parseFloat(s[2]),parseFloat(s[3]));else if(o.startsWith("delta"))s=o.split(i),0===r?t.h[0]=parseFloat(s[1]):1===r?t.h[1]=parseFloat(s[2]):2===r&&(t.h[2]=parseFloat(s[3])),r+=1;else if(o.startsWith("object 3")){n+=o.length+1;break}n+=o.length+1}return{header:t,headerByteCount:n}}function BL(){return BL=ie(function*(e,t,n){yield e.update("Reading header...");const r=ht(t),{header:i}=rre(r);yield e.update("Reading values...");const o=yield function eze(e,t,n){const r=n.dim[0]*n.dim[1]*n.dim[2],i=1e6,o=new Float64Array(r);let s=0;return op(e,i,o,(a,c)=>{const u=Math.min(r,s+a);for(let l=s;la.update({current:Math.min(u,r),max:r}))}(e,r,i);return Fr.success({header:i,values:o,name:n})}),BL.apply(this,arguments)}function OL(){return OL=ie(function*(e,t,n){yield e.update("Reading header...");const i=ht(GB(t,0,1e3)),{header:o,headerByteCount:s}=rre(i);yield e.update("Reading values...");const a=o.dim[0]*o.dim[1]*o.dim[2],c=new DataView(t.buffer,t.byteOffset+s),u=new Float64Array(a);for(let l=0;l{e.set(xn[t],t)})}(),Object.keys({NATOM:"",NTYPES:"",NBONH:"",MBONA:"",NTHETH:"",MTHETA:"",NPHIH:"",MPHIA:"",NHPARM:"",NPARM:"",NNB:"",NRES:"",NBONA:"",NTHETA:"",NPHIA:"",NUMBND:"",NUMANG:"",NPTRA:"",NATYP:"",NPHB:"",IFPERT:"",NBPER:"",NGPER:"",NDPER:"",MBPER:"",MGPER:"",MDPER:"",IFBOX:"",NMXRS:"",IFCAP:"",NUMEXTRA:"",NCOPY:""})),{readLine:aD,markLine:ore,trim:ize}=ht;function sze(e){const{tokenizer:t}=e,n=[];for(;t.tokenEnd{n[i]=0});let r=0;for(;t.tokenEnd1e5&&t.shouldUpdate&&(o=n.position,yield t.update({current:n.position,max:n.length}));const s=aD(r.tokenizer).trim();if(s.startsWith("%VERSION"))i.version=s.substring(8).trim();else if(s.startsWith("%FLAG")){const a=s.substring(5).trim();if(!aD(r.tokenizer).trim().startsWith("%FORMAT"))throw new Error("expected %FORMAT");if("TITLE"===a)i.title=sze(r);else if("POINTERS"===a)i.pointers=aze(r);else if("ATOM_NAME"===a){const u=fm(r,i.pointers.NATOM,20,4);i.atomName=Jt(u)(te.Schema.str)}else if("CHARGE"===a){const u=fm(r,i.pointers.NATOM,5,16);i.charge=Jt(u)(te.Schema.float)}else if("MASS"===a){const u=fm(r,i.pointers.NATOM,5,16);i.mass=Jt(u)(te.Schema.float)}else if("RESIDUE_LABEL"===a){const u=fm(r,i.pointers.NRES,20,4);i.residueLabel=Jt(u)(te.Schema.str)}else if("RESIDUE_POINTER"===a){const u=fm(r,i.pointers.NRES,10,8);i.residuePointer=Jt(u)(te.Schema.int)}else if("BONDS_INC_HYDROGEN"===a){const u=fm(r,3*i.pointers.NBONH,10,8);i.bondsIncHydrogen=Jt(u)(te.Schema.int)}else if("BONDS_WITHOUT_HYDROGEN"===a){const u=fm(r,3*i.pointers.NBONA,10,8);i.bondsWithoutHydrogen=Jt(u)(te.Schema.int)}else if("RADII"===a){const u=fm(r,i.pointers.NATOM,5,16);i.radii=Jt(u)(te.Schema.float)}else for(;n.tokenEnd=t.length));){const i=t.data[t.position];if("["===i)break;if(";"!==i&&"*"!==i){for(let o=0;o<2;++o)switch(hm(t),cD(t),VL(t),o){case 0:He.add(n,t.tokenStart,t.tokenEnd);break;case 1:He.add(r,t.tokenStart,t.tokenEnd)}pze(t),cD(t)}else pm(t)}return Xn.ofColumns(fze,{compound:Jt(n)(te.Schema.str),molCount:Jt(r)(te.Schema.int)})}function zL(){return zL=ie(function*(e,t){const n=ht(e),r=function hze(e,t){return{tokenizer:e,runtimeCtx:t}}(n,t),i=Object.create(null);let o=0;i.compounds={};let s={},a="";function c(){a&&s.atoms&&(i.compounds[a]=s,s={},a="")}for(;n.tokenEnd1e5&&t.shouldUpdate&&(o=n.position,yield t.update({current:n.position,max:n.length}));const u=UL(r.tokenizer).trim();if(u&&"*"!==u[0]&&";"!==u[0]){if(u.startsWith("#include"))throw new Error("#include statements not allowed");if(u.startsWith("[")){const l=u.match(mze);if(null===l)throw new Error("expected field name");const d=l[1];if("moleculetype"===d)c(),a=yze(r);else if("atoms"===d)s.atoms=bze(r);else if("bonds"===d)s.bonds=vze(r);else if("system"===d)i.system=_ze(r);else if("molecules"===d)c(),i.molecules=xze(r);else for(;n.tokenEndOe.create("Download",function(){var r=ie(function*(i){const o=fr.getUrlAsset(n.managers.asset,e.url),s=yield n.managers.asset.resolve(o,e.isBinary?"binary":"string").runInContext(i);return t.asset=s,e.isBinary?new pe.Data.Binary(s.data,{label:e.label?e.label:o.url}):new pe.Data.String(s.data,{label:e.label?e.label:o.url})});return function(i){return r.apply(this,arguments)}}()),dispose({cache:e}){var t;null===(t=e?.asset)||void 0===t||t.dispose()},update:({oldParams:e,newParams:t,b:n})=>e.url!==t.url||e.isBinary!==t.isBinary?Qe.UpdateResult.Recreate:e.label!==t.label?(n.label=t.label||("string"==typeof t.url?t.url:t.url.url),Qe.UpdateResult.Updated):Qe.UpdateResult.Unchanged}),are=Rt.BuiltIn({name:"download-blob",display:{name:"Download Blob",description:"Download multiple string or binary data from the specified URLs."},from:pe.Root,to:pe.Data.Blob,params:{sources:C.ObjectList({id:C.Text("",{label:"Unique ID"}),url:C.Url("https://www.ebi.ac.uk/pdbe/static/entry/1cbs_updated.cif",{description:"Resource URL. Must be the same domain or support CORS."}),isBinary:C.Optional(C.Boolean(!1,{description:"If true, download data as binary (string otherwise)"})),canFail:C.Optional(C.Boolean(!1,{description:"Indicate whether the download can fail and not be included in the blob as a result."}))},e=>`${e.id}: ${e.url}`),maxConcurrency:C.Optional(C.Numeric(4,{min:1,max:12,step:1},{description:"The maximum number of concurrent downloads."}))}})({apply:({params:e,cache:t},n)=>Oe.create("Download Blob",function(){var r=ie(function*(i){const o=[],s=yield function ILe(e,t,n,r){return OO.apply(this,arguments)}(i,n.managers.asset,e.sources,e.maxConcurrency||4),a=[];for(let c=0;cOe.create("Raw Data",ie(function*(){return"string"==typeof e.data?new pe.Data.String(e.data,{label:e.label?e.label:"String"}):Array.isArray(e.data)||e.data instanceof ArrayBuffer?new pe.Data.Binary(new Uint8Array(e.data),{label:e.label?e.label:"Binary"}):e.data instanceof Uint8Array?new pe.Data.Binary(e.data,{label:e.label?e.label:"Binary"}):void Rr()})),update:({oldParams:e,newParams:t,b:n})=>e.data!==t.data?Qe.UpdateResult.Recreate:e.label!==t.label?(n.label=t.label||n.label,Qe.UpdateResult.Updated):Qe.UpdateResult.Unchanged,customSerialization:{toJSON(e){if("string"==typeof e.data||Array.isArray(e.data))return e;if(e.data instanceof ArrayBuffer){const t=new Uint8Array(e.data),n=new Array(t.length);for(let r=0,i=t.length;re}}),ure=Rt.BuiltIn({name:"read-file",display:{name:"Read File",description:"Read string or binary data from the specified file"},from:pe.Root,to:[pe.Data.String,pe.Data.Binary],params:{file:C.File(),label:C.Optional(C.Text("")),isBinary:C.Optional(C.Boolean(!1,{description:"If true, open file as as binary (string otherwise)"}))}})({apply:({params:e,cache:t},n)=>Oe.create("Open File",function(){var r=ie(function*(i){if(null===e.file)return n.log.error("No file(s) selected"),li.Null;const o=yield n.managers.asset.resolve(e.file,e.isBinary?"binary":"string").runInContext(i);return t.asset=o,e.isBinary?new pe.Data.Binary(o.data,{label:e.label?e.label:e.file.name}):new pe.Data.String(o.data,{label:e.label?e.label:e.file.name})});return function(i){return r.apply(this,arguments)}}()),dispose({cache:e}){var t;null===(t=e?.asset)||void 0===t||t.dispose()},update({oldParams:e,newParams:t,b:n}){var r;return e.label!==t.label?(n.label=t.label||(null===(r=e.file)||void 0===r?void 0:r.name)||"",Qe.UpdateResult.Updated):Qe.UpdateResult.Unchanged},isSerializable:()=>({isSerializable:!1,reason:"Cannot serialize user loaded files."})}),wze=Rt.BuiltIn({name:"parse-blob",display:{name:"Parse Blob",description:"Parse multiple data enties"},from:pe.Data.Blob,to:pe.Format.Blob,params:{formats:C.ObjectList({id:C.Text("",{label:"Unique ID"}),format:C.Select("cif",[["cif","cif"]])},e=>`${e.id}: ${e.format}`)}})({apply:({a:e,params:t},n)=>Oe.create("Parse Blob",function(){var r=ie(function*(i){const o=new Map;for(const a of t.formats)o.set(a.id,a.format);const s=[];for(const a of e.data){if(!o.has(a.id))continue;const c=yield("string"===a.kind?od.parse(a.data):od.parseBinary(a.data)).runInContext(i);if(c.isError)throw new Error(`${a.id}: ${c.message}`);s.push({id:a.id,kind:"cif",data:c.result})}return new pe.Format.Blob(s,{label:"Format Blob",description:`${s.length} ${1===s.length?"entry":"entries"}`})});return function(i){return r.apply(this,arguments)}}())}),Aze=Rt.BuiltIn({name:"parse-cif",display:{name:"Parse CIF",description:"Parse CIF from String or Binary data"},from:[pe.Data.String,pe.Data.Binary],to:pe.Format.Cif})({apply:({a:e})=>Oe.create("Parse CIF",function(){var t=ie(function*(n){const r=yield("string"==typeof e.data?od.parse(e.data):od.parseBinary(e.data)).runInContext(n);if(r.isError)throw new Error(r.message);return 0===r.result.blocks.length?li.Null:new pe.Format.Cif(r.result)});return function(n){return t.apply(this,arguments)}}())}),Ize=Rt.BuiltIn({name:"parse-cube",display:{name:"Parse Cube",description:"Parse Cube from String data"},from:pe.Data.String,to:pe.Format.Cube})({apply:({a:e})=>Oe.create("Parse Cube",function(){var t=ie(function*(n){const r=yield JVe(e.data,e.label).runInContext(n);if(r.isError)throw new Error(r.message);return new pe.Format.Cube(r.result)});return function(n){return t.apply(this,arguments)}}())}),Tze=Rt.BuiltIn({name:"parse-psf",display:{name:"Parse PSF",description:"Parse PSF from String data"},from:[pe.Data.String],to:pe.Format.Psf})({apply:({a:e})=>Oe.create("Parse PSF",function(){var t=ie(function*(n){const r=yield function bUe(e){return Oe.create("Parse PSF",function(){var t=ie(function*(n){return yield function yUe(e,t){return C4.apply(this,arguments)}(e,n)});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);return new pe.Format.Psf(r.result)});return function(n){return t.apply(this,arguments)}}())}),Dze=Rt.BuiltIn({name:"parse-prmtop",display:{name:"Parse PRMTOP",description:"Parse PRMTOP from String data"},from:[pe.Data.String],to:pe.Format.Prmtop})({apply:({a:e})=>Oe.create("Parse PRMTOP",function(){var t=ie(function*(n){const r=yield function uze(e){return Oe.create("Parse PRMTOP",function(){var t=ie(function*(n){return yield function cze(e,t){return LL.apply(this,arguments)}(e,n)});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);return new pe.Format.Prmtop(r.result)});return function(n){return t.apply(this,arguments)}}())}),Eze=Rt.BuiltIn({name:"parse-top",display:{name:"Parse TOP",description:"Parse TOP from String data"},from:[pe.Data.String],to:pe.Format.Top})({apply:({a:e})=>Oe.create("Parse TOP",function(){var t=ie(function*(n){const r=yield function Cze(e){return Oe.create("Parse TOP",function(){var t=ie(function*(n){return yield function Sze(e,t){return zL.apply(this,arguments)}(e,n)});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);return new pe.Format.Top(r.result)});return function(n){return t.apply(this,arguments)}}())}),Pze=Rt.BuiltIn({name:"parse-ply",display:{name:"Parse PLY",description:"Parse PLY from String data"},from:[pe.Data.String],to:pe.Format.Ply})({apply:({a:e})=>Oe.create("Parse PLY",function(){var t=ie(function*(n){const r=yield function lUe(e){return Oe.create("Parse PLY",function(){var t=ie(function*(n){return yield function uUe(e,t){return v4.apply(this,arguments)}(e,n)});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);return new pe.Format.Ply(r.result,{label:r.result.comments[0]||"PLY Data"})});return function(n){return t.apply(this,arguments)}}())}),Mze=Rt.BuiltIn({name:"parse-ccp4",display:{name:"Parse CCP4/MRC/MAP",description:"Parse CCP4/MRC/MAP from Binary data"},from:[pe.Data.Binary],to:pe.Format.Ccp4})({apply:({a:e})=>Oe.create("Parse CCP4/MRC/MAP",function(){var t=ie(function*(n){const r=yield function q8e(e,t){return function H8e(e,t){return Oe.create("Parse CCP4/MRC/MAP",function(){var n=ie(function*(r){try{return Fr.success(yield function j8e(e,t,n){return p4.apply(this,arguments)}(e,t,r))}catch(i){return Fr.error(i)}});return function(r){return n.apply(this,arguments)}}())}(kT.fromBuffer(cd.fromUint8Array(e),t),e.length)}(e.data,e.label).runInContext(n);if(r.isError)throw new Error(r.message);return new pe.Format.Ccp4(r.result)});return function(n){return t.apply(this,arguments)}}())}),Rze=Rt.BuiltIn({name:"parse-dsn6",display:{name:"Parse DSN6/BRIX",description:"Parse CCP4/BRIX from Binary data"},from:[pe.Data.Binary],to:pe.Format.Dsn6})({apply:({a:e})=>Oe.create("Parse DSN6/BRIX",function(){var t=ie(function*(n){const r=yield function J8e(e,t){return function Q8e(e,t){return Oe.create("Parse DSN6/BRIX",function(){var n=ie(function*(r){try{return Fr.success(yield function Z8e(e,t,n){return y4.apply(this,arguments)}(e,t,r))}catch(i){return Fr.error(i)}});return function(r){return n.apply(this,arguments)}}())}(kT.fromBuffer(cd.fromUint8Array(e),t),e.length)}(e.data,e.label).runInContext(n);if(r.isError)throw new Error(r.message);return new pe.Format.Dsn6(r.result)});return function(n){return t.apply(this,arguments)}}())}),kze=Rt.BuiltIn({name:"parse-dx",display:{name:"Parse DX",description:"Parse DX from Binary/String data"},from:[pe.Data.Binary,pe.Data.String],to:pe.Format.Dx})({apply:({a:e})=>Oe.create("Parse DX",function(){var t=ie(function*(n){const r=yield function rze(e,t){return Oe.create("Parse DX",n=>"string"==typeof e?function tze(e,t,n){return BL.apply(this,arguments)}(n,e,t):function nze(e,t,n){return OL.apply(this,arguments)}(n,e,t))}(e.data,e.label).runInContext(n);if(r.isError)throw new Error(r.message);return new pe.Format.Dx(r.result)});return function(n){return t.apply(this,arguments)}}())}),Nze=Rt.BuiltIn({name:"import-string",display:{name:"Import String",description:"Import given data as a string"},from:pe.Root,to:pe.Data.String,params:{data:C.Value(""),label:C.Optional(C.Text(""))}})({apply:({params:{data:e,label:t}})=>new pe.Data.String(e,{label:t||""}),update:({oldParams:e,newParams:t,b:n})=>e.data!==t.data?Qe.UpdateResult.Recreate:e.label!==t.label?(n.label=t.label||"",Qe.UpdateResult.Updated):Qe.UpdateResult.Unchanged,isSerializable:()=>({isSerializable:!1,reason:"Cannot serialize user imported strings."})}),Fze=Rt.BuiltIn({name:"import-json",display:{name:"Import JSON",description:"Import given data as a JSON"},from:pe.Root,to:pe.Format.Json,params:{data:C.Value({}),label:C.Optional(C.Text(""))}})({apply:({params:{data:e,label:t}})=>new pe.Format.Json(e,{label:t||""}),update:({oldParams:e,newParams:t,b:n})=>e.data!==t.data?Qe.UpdateResult.Recreate:e.label!==t.label?(n.label=t.label||"",Qe.UpdateResult.Updated):Qe.UpdateResult.Unchanged,isSerializable:()=>({isSerializable:!1,reason:"Cannot serialize user imported JSON."})}),Bze=Rt.BuiltIn({name:"parse-json",display:{name:"Parse JSON",description:"Parse JSON from String data"},from:[pe.Data.String],to:pe.Format.Json})({apply:({a:e})=>Oe.create("Parse JSON",function(){var t=ie(function*(n){const r=yield new Response(e.data).json();return new pe.Format.Json(r)});return function(n){return t.apply(this,arguments)}}())}),Oze=Rt.BuiltIn({name:"lazy-volume",display:{name:"Lazy Volume",description:"A placeholder for lazy loaded volume representation"},from:pe.Root,to:pe.Volume.Lazy,params:{url:C.Url(""),isBinary:C.Boolean(!1),format:C.Text("ccp4"),entryId:C.Value("",{isHidden:!0}),isovalues:C.ObjectList({type:C.Text("relative"),value:C.Numeric(0),color:C.Color(xn.black),alpha:C.Numeric(1,{min:0,max:1,step:.01}),volumeIndex:C.Numeric(0)},e=>`${e.type} ${e.value}`)}})({apply:({params:t})=>Oe.create("Lazy Volume",function(){var n=ie(function*(r){const i=Array.isArray(t.entryId)?t.entryId.join(", "):t.entryId;return new pe.Volume.Lazy(t,{label:`${i||t.url}`,description:"Lazy Volume"})});return function(r){return n.apply(this,arguments)}}())}),Lze=Rt.BuiltIn({name:"create-group",display:{name:"Group"},from:[],to:pe.Group,params:{label:C.Text("Group"),description:C.Optional(C.Text(""))}})({apply:({params:e})=>new pe.Group({},e),update:({oldParams:e,newParams:t,b:n})=>EI(e,t)?Qe.UpdateResult.Unchanged:(n.label=t.label,n.description=t.description,Qe.UpdateResult.Updated)});function Hze(e,t){return{tokenizer:e,header:{title:"",timeInPs:0,hasVelocities:!1,precision:{position:0,velocity:0},box:[0,0,0]},numberOfAtoms:0,runtimeCtx:t}}function qze(e){const{tokenizer:t,header:n}=e;let r=ht.readLine(t);0===r.trim().length&&(r=ht.readLine(t));const i=r.lastIndexOf("t=");i>=0?(n.timeInPs=parseFloat(r.substring(i+2)),n.title=r.substring(0,i).trim(),n.title&&","===n.title[n.title.length-1]&&(n.title=n.title.substring(0,n.title.length-1))):n.title=r}function Wze(e){const{tokenizer:t}=e;ht.markLine(t);const n=ht.getTokenString(t);e.numberOfAtoms=parseInt(n)}function $ze(e){return GL.apply(this,arguments)}function GL(){return GL=ie(function*(e){const{tokenizer:t,numberOfAtoms:n}=e,r=yield ht.readLinesAsync(t,n,e.runtimeCtx,1e5),o=t.data.substring(r.indices[0],r.indices[1]).substring(20).match(/\.\d+/g),s=6===o.length;e.header.hasVelocities=s,e.header.precision.position=o[0].length-1,e.header.precision.velocity=s?o[3].length-1:0;const c=e.header.precision.position+5,u=20+3*c,l=e.header.precision.velocity+4,d=function zze(e){return function(t,n,r){return function Gze(e,t,n,r){const{data:i,indices:o,count:s}=e,{valueType:a}=r,c="str"===a?u=>{const l=o[2*u]+t,d=o[2*u+1];if(l>=d)return"";let f=l+n;return f>d&&(f=d),function NOe(e,t,n){let r=t,i=n-1,o=e.charCodeAt(r);for(;(9===o||32===o)&&r<=i;)o=e.charCodeAt(++r);for(o=e.charCodeAt(i);(9===o||32===o)&&i>=r;)o=e.charCodeAt(--i);return e.substring(r,i+1)}(i,l,f)}:"int"===a?u=>{const l=o[2*u]+t;return l>o[2*u+1]?0:Ig(i,l,l+n)}:u=>{const l=o[2*u]+t;return l>o[2*u+1]?0:function iMe(e,t,n){for(;t0,toArray:u=>Ps(s,c,u),areValuesEqual:(u,l)=>c(u)===c(l)}}(e,t,n,r)}}(r),f=te.Undefined(e.numberOfAtoms,te.Schema.float);return{count:e.numberOfAtoms,residueNumber:d(0,5,te.Schema.int),residueName:d(5,5,te.Schema.str),atomName:d(10,5,te.Schema.str),atomNumber:d(15,5,te.Schema.int),x:d(20,c,te.Schema.float),y:d(20+c,c,te.Schema.float),z:d(20+2*c,c,te.Schema.float),vx:s?d(u,l,te.Schema.float):f,vy:s?d(u+l,l,te.Schema.float):f,vz:s?d(u+2*l,l,te.Schema.float):f}}),GL.apply(this,arguments)}function Yze(e){const{tokenizer:t}=e,n=ht.readLine(t).trim().split(/\s+/g);e.header.box=[+n[0],+n[1],+n[2]]}function jL(){return jL=ie(function*(e,t){const n=ht(e);yield t.update({message:"Parsing...",current:0,max:e.length});const r=[];for(;n.position0?Math.ceil(e/r):0;return{width:r,height:i,length:r*i*t}}(e,t);return{array:r=r&&r.length>=i?r:new n(i),width:o,height:s}}const al=v(),r7e=new fu("14"),i7e=new fu("98");function hre(e){return e>1e5?r7e:i7e}function Ip(e,t,n){const r=3*n,i=hre(t);i.reset();for(let s=0,a=3*t;s>2),r=t-4>>2,i=4*r;let o=0;if(r<0)for(let s=0;s>16]}for(let s=i;s!1),s){if(e%n!=0)throw new Error("incompatible groupCount and stride");const a={location:rc,location2:rc,index:0,groupIndex:0,instanceIndex:0,isSecondary:!1};let c=a.groupIndex(c&&(a.groupIndex=l,a.instanceIndex=d,a.index=d*e+l,a.location=r(l,f?-1:d),p&&(a.location2=s(l,f?-1:d)),a.isSecondary=o(l,f?-1:d),l+=n,l===e?(++d,u=!0,d=85}return!1}(e);return{instancedArrays:t,standardDerivatives:r,elementIndexUint:n,textureFloat:i,textureFloatLinear:o,textureHalfFloat:s,textureHalfFloatLinear:a,depthTexture:c,blendMinMax:u,vertexArrayObject:l,fragDepth:d,colorBufferFloat:f,colorBufferHalfFloat:p,drawBuffers:m,drawBuffersIndexed:h,shaderTextureLod:g,sRGB:y,disjointTimerQuery:b,multiDraw:x,drawInstancedBaseVertexBaseInstance:_,multiDrawInstancedBaseVertexBaseInstance:S,parallelShaderCompile:A,fboRenderMipmap:E,provokingVertex:w,clipCullDistance:D,conservativeDepth:I,stencilTexturing:R,clipControl:T,noNonInstancedActiveAttribs:M}}var d0;!function(e){e.create=function t(i,o,s){return{array:i,width:o,height:s}},e.flipY=function n(i){const{array:o,width:s,height:a}=i,u=s*(o.length/(s*a));for(let l=0,d=a/2;l 0.0 && uBumpAmplitude > 0.0 && bumpiness > 0.0) {\n material.rgb += fbm(vModelPosition * uBumpFrequency) * uBumpAmplitude * bumpiness;\n material.rgb -= 0.5 * uBumpAmplitude * bumpiness;\n }\n #endif\n\n gl_FragColor = material;\n#else\n #ifdef bumpEnabled\n if (uBumpFrequency > 0.0 && uBumpAmplitude > 0.0 && bumpiness > 0.0) {\n normal = perturbNormal(-vViewPosition, normal, fbm(vModelPosition * uBumpFrequency), (uBumpAmplitude * bumpiness) / uBumpFrequency);\n }\n #endif\n\n vec4 color = material;\n\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n\n PhysicalMaterial physicalMaterial;\n physicalMaterial.diffuseColor = color.rgb * (1.0 - metalness);\n #ifdef enabledFragDepth\n physicalMaterial.roughness = min(max(roughness, 0.0525), 1.0);\n #else\n vec3 dxy = max(abs(dFdx(normal)), abs(dFdy(normal)));\n float geometryRoughness = max(max(dxy.x, dxy.y), dxy.z);\n physicalMaterial.roughness = min(max(roughness, 0.0525) + geometryRoughness, 1.0);\n #endif\n physicalMaterial.specularColor = mix(vec3(0.04), color.rgb, metalness);\n physicalMaterial.specularF90 = 1.0;\n\n GeometricContext geometry;\n geometry.position = -vViewPosition;\n geometry.normal = normal;\n geometry.viewDir = normalize(vViewPosition);\n\n IncidentLight directLight;\n #pragma unroll_loop_start\n for (int i = 0; i < dLightCount; ++i) {\n directLight.direction = uLightDirection[i];\n directLight.color = uLightColor[i] * PI; // * PI for punctual light\n RE_Direct_Physical(directLight, geometry, physicalMaterial, reflectedLight);\n }\n #pragma unroll_loop_end\n\n vec3 irradiance = uAmbientColor * PI; // * PI for punctual light\n RE_IndirectDiffuse_Physical(irradiance, geometry, physicalMaterial, reflectedLight);\n\n // indirect specular only metals\n vec3 radiance = uAmbientColor * metalness;\n vec3 iblIrradiance = uAmbientColor * metalness;\n vec3 clearcoatRadiance = vec3(0.0);\n RE_IndirectSpecular_Physical(radiance, iblIrradiance, clearcoatRadiance, geometry, physicalMaterial, reflectedLight);\n\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n outgoingLight = clamp(outgoingLight, 0.01, 0.99); // prevents black artifacts on specular highlight with transparent background\n\n gl_FragColor = vec4(outgoingLight, color.a);\n#endif\n\n#if defined(dXrayShaded_on)\n gl_FragColor.a *= 1.0 - pow(abs(dot(normal, vec3(0.0, 0.0, 1.0))), uXrayEdgeFalloff);\n#elif defined(dXrayShaded_inverted)\n gl_FragColor.a *= pow(abs(dot(normal, vec3(0.0, 0.0, 1.0))), uXrayEdgeFalloff);\n#endif\n\ngl_FragColor.rgb *= uExposure;\n",apply_marker_color:"\n\n#if defined(dColorMarker)\n if (marker > 0.0) {\n if ((uMarkerPriority == 1 && marker != 2.0) || (uMarkerPriority != 1 && marker == 1.0)) {\n gl_FragColor.rgb = mix(gl_FragColor.rgb, uHighlightColor, uHighlightStrength);\n gl_FragColor.a = max(gl_FragColor.a, uHighlightStrength * 0.002); // for direct-volume rendering\n } else {\n gl_FragColor.rgb = mix(gl_FragColor.rgb, uSelectColor, uSelectStrength);\n gl_FragColor.a = max(gl_FragColor.a, uSelectStrength * 0.002); // for direct-volume rendering\n }\n } else if (uMarkerAverage > 0.0) {\n gl_FragColor.rgb = mix(gl_FragColor.rgb, uDimColor, uDimStrength);\n gl_FragColor.a = max(gl_FragColor.a, uDimStrength * 0.002); // for direct-volume rendering\n }\n#endif\n",assign_clipping_varying:"\n#if dClipObjectCount != 0 && defined(dClipping)\n #if defined(dClippingType_instance)\n vClipping = readFromTexture(tClipping, aInstance, uClippingTexDim).a;\n #elif defined(dMarkerType_groupInstance)\n vClipping = readFromTexture(tClipping, aInstance * float(uGroupCount) + group, uClippingTexDim).a;\n #endif\n#endif\n",assign_color_varying:"\n#if defined(dRenderVariant_color)\n #if defined(dColorType_attribute)\n vColor.rgb = aColor;\n #elif defined(dColorType_instance)\n vColor.rgb = readFromTexture(tColor, aInstance, uColorTexDim).rgb;\n #elif defined(dColorType_group)\n #if defined(dDualColor)\n vec4 color2;\n if (aColorMode == 2.0) {\n vColor.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n } else {\n vColor.rgb = readFromTexture(tColor, group * 2.0, uColorTexDim).rgb;\n color2.rgb = readFromTexture(tColor, group * 2.0 + 1.0, uColorTexDim).rgb;\n }\n #else\n vColor.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n #endif\n #elif defined(dColorType_groupInstance)\n #if defined(dDualColor)\n vec4 color2;\n if (aColorMode == 2.0) {\n vColor.rgb = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n } else {\n vColor.rgb = readFromTexture(tColor, (aInstance * float(uGroupCount) + group) * 2.0, uColorTexDim).rgb;\n color2.rgb = readFromTexture(tColor, (aInstance * float(uGroupCount) + group) * 2.0 + 1.0, uColorTexDim).rgb;\n }\n #else\n vColor.rgb = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n #endif\n #elif defined(dColorType_vertex)\n vColor.rgb = readFromTexture(tColor, VertexID, uColorTexDim).rgb;\n #elif defined(dColorType_vertexInstance)\n vColor.rgb = readFromTexture(tColor, int(aInstance) * uVertexCount + VertexID, uColorTexDim).rgb;\n #elif defined(dColorType_volume)\n vec3 cgridPos = (uColorGridTransform.w * (position - uColorGridTransform.xyz)) / uColorGridDim;\n vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;\n #elif defined(dColorType_volumeInstance)\n vec3 cgridPos = (uColorGridTransform.w * (vModelPosition - uColorGridTransform.xyz)) / uColorGridDim;\n vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;\n #endif\n\n #ifdef dUsePalette\n vPaletteV = ((vColor.r * 256.0 * 256.0 * 255.0 + vColor.g * 256.0 * 255.0 + vColor.b * 255.0) - 1.0) / 16777215.0;\n #endif\n\n #ifdef dOverpaint\n #if defined(dOverpaintType_instance)\n vOverpaint = readFromTexture(tOverpaint, aInstance, uOverpaintTexDim);\n #elif defined(dOverpaintType_groupInstance)\n vOverpaint = readFromTexture(tOverpaint, aInstance * float(uGroupCount) + group, uOverpaintTexDim);\n #elif defined(dOverpaintType_vertexInstance)\n vOverpaint = readFromTexture(tOverpaint, int(aInstance) * uVertexCount + VertexID, uOverpaintTexDim);\n #elif defined(dOverpaintType_volumeInstance)\n vec3 ogridPos = (uOverpaintGridTransform.w * (vModelPosition - uOverpaintGridTransform.xyz)) / uOverpaintGridDim;\n vOverpaint = texture3dFrom2dLinear(tOverpaintGrid, ogridPos, uOverpaintGridDim, uOverpaintTexDim);\n #endif\n\n // pre-mix to avoid darkening due to empty overpaint\n #ifdef dColorType_uniform\n vOverpaint.rgb = mix(uColor.rgb, vOverpaint.rgb, vOverpaint.a);\n #else\n vOverpaint.rgb = mix(vColor.rgb, vOverpaint.rgb, vOverpaint.a);\n #endif\n vOverpaint *= uOverpaintStrength;\n #endif\n\n #ifdef dSubstance\n #if defined(dSubstanceType_instance)\n vSubstance = readFromTexture(tSubstance, aInstance, uSubstanceTexDim);\n #elif defined(dSubstanceType_groupInstance)\n vSubstance = readFromTexture(tSubstance, aInstance * float(uGroupCount) + group, uSubstanceTexDim);\n #elif defined(dSubstanceType_vertexInstance)\n vSubstance = readFromTexture(tSubstance, int(aInstance) * uVertexCount + VertexID, uSubstanceTexDim);\n #elif defined(dSubstanceType_volumeInstance)\n vec3 sgridPos = (uSubstanceGridTransform.w * (vModelPosition - uSubstanceGridTransform.xyz)) / uSubstanceGridDim;\n vSubstance = texture3dFrom2dLinear(tSubstanceGrid, sgridPos, uSubstanceGridDim, uSubstanceTexDim);\n #endif\n\n // pre-mix to avoid artifacts due to empty substance\n vSubstance.rgb = mix(vec3(uMetalness, uRoughness, uBumpiness), vSubstance.rgb, vSubstance.a);\n vSubstance *= uSubstanceStrength;\n #endif\n#elif defined(dRenderVariant_pick)\n #ifdef requiredDrawBuffers\n vObject = vec4(packIntToRGB(float(uObjectId)), 1.0);\n vInstance = vec4(packIntToRGB(aInstance), 1.0);\n vGroup = vec4(packIntToRGB(group), 1.0);\n #else\n if (uPickType == 1) {\n vColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n vColor = vec4(packIntToRGB(aInstance), 1.0);\n } else {\n vColor = vec4(packIntToRGB(group), 1.0);\n }\n #endif\n#endif\n\n#ifdef dTransparency\n #if defined(dTransparencyType_instance)\n vTransparency = readFromTexture(tTransparency, aInstance, uTransparencyTexDim).a;\n #elif defined(dTransparencyType_groupInstance)\n vTransparency = readFromTexture(tTransparency, aInstance * float(uGroupCount) + group, uTransparencyTexDim).a;\n #elif defined(dTransparencyType_vertexInstance)\n vTransparency = readFromTexture(tTransparency, int(aInstance) * uVertexCount + VertexID, uTransparencyTexDim).a;\n #elif defined(dTransparencyType_volumeInstance)\n vec3 tgridPos = (uTransparencyGridTransform.w * (vModelPosition - uTransparencyGridTransform.xyz)) / uTransparencyGridDim;\n vTransparency = texture3dFrom2dLinear(tTransparencyGrid, tgridPos, uTransparencyGridDim, uTransparencyTexDim).a;\n #endif\n vTransparency *= uTransparencyStrength;\n#endif\n",assign_group:"\n#ifdef dGeometryType_textureMesh\n float group = unpackRGBToInt(readFromTexture(tGroup, VertexID, uGeoTexDim).rgb);\n#else\n float group = aGroup;\n#endif\n",assign_marker_varying:"\n#if defined(dNeedsMarker)\n #if defined(dMarkerType_instance)\n vMarker = readFromTexture(tMarker, aInstance, uMarkerTexDim).a;\n #elif defined(dMarkerType_groupInstance)\n vMarker = readFromTexture(tMarker, aInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n #endif\n#endif\n",assign_material_color:"\n#if defined(dNeedsMarker)\n float marker = uMarker;\n if (uMarker == -1.0) {\n marker = floor(vMarker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n#endif\n\n#if defined(dRenderVariant_color)\n #if defined(dUsePalette)\n vec4 material = vec4(texture2D(tPalette, vec2(vPaletteV, 0.5)).rgb, uAlpha);\n #elif defined(dColorType_uniform)\n vec4 material = vec4(uColor, uAlpha);\n #elif defined(dColorType_varying)\n vec4 material = vec4(vColor.rgb, uAlpha);\n #endif\n\n // mix material with overpaint\n #if defined(dOverpaint)\n material.rgb = mix(material.rgb, vOverpaint.rgb, vOverpaint.a);\n #endif\n\n float metalness = uMetalness;\n float roughness = uRoughness;\n float bumpiness = uBumpiness;\n #ifdef dSubstance\n metalness = mix(metalness, vSubstance.r, vSubstance.a);\n roughness = mix(roughness, vSubstance.g, vSubstance.a);\n bumpiness = mix(bumpiness, vSubstance.b, vSubstance.a);\n #endif\n#elif defined(dRenderVariant_depth)\n if (fragmentDepth > getDepth(gl_FragCoord.xy / uDrawingBufferSize)) {\n discard;\n }\n\n #ifndef dXrayShaded\n #if defined(dTransparency)\n float dta = 1.0 - vTransparency;\n if (vTransparency < 0.2) dta = 1.0; // hard cutoff looks better\n\n if (uRenderMask == MaskTransparent && uAlpha * dta == 1.0) {\n discard;\n } else if (uRenderMask == MaskOpaque && uAlpha * dta < 1.0) {\n discard;\n }\n #else\n if (uRenderMask == MaskTransparent && uAlpha == 1.0) {\n discard;\n } else if (uRenderMask == MaskOpaque && uAlpha < 1.0) {\n discard;\n }\n #endif\n #else\n if (uRenderMask == MaskOpaque) {\n discard;\n }\n #endif\n\n vec4 material = packDepthToRGBA(fragmentDepth);\n#elif defined(dRenderVariant_marking)\n vec4 material;\n if(uMarkingType == 1) {\n if (marker > 0.0)\n discard;\n #ifdef enabledFragDepth\n material = packDepthToRGBA(gl_FragDepthEXT);\n #else\n material = packDepthToRGBA(gl_FragCoord.z);\n #endif\n } else {\n if (marker == 0.0)\n discard;\n float depthTest = 1.0;\n if (uMarkingDepthTest) {\n depthTest = (fragmentDepth >= getDepthPacked(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;\n }\n bool isHighlight = intMod(marker, 2.0) > 0.1;\n float viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);\n float fogFactor = smoothstep(uFogNear, uFogFar, abs(viewZ));\n if (fogFactor == 1.0)\n discard;\n material = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0 - fogFactor);\n }\n#endif\n\n// apply per-group transparency\n#if defined(dTransparency) && (defined(dRenderVariant_pick) || defined(dRenderVariant_color))\n float ta = 1.0 - vTransparency;\n if (vTransparency < 0.09) ta = 1.0; // hard cutoff looks better\n\n #if defined(dRenderVariant_pick)\n if (ta < uPickingAlphaThreshold)\n discard; // ignore so the element below can be picked\n #elif defined(dRenderVariant_color)\n material.a *= ta;\n\n #if defined(dRenderVariant_colorBlended)\n #if defined(dTransparentBackfaces_off)\n if ((uRenderMask == MaskOpaque && material.a < 1.0) ||\n (uRenderMask == MaskTransparent && material.a == 1.0) ||\n (interior && material.a < 1.0)\n ) {\n discard;\n }\n #elif defined(dTransparentBackfaces_on)\n if ((uRenderMask == MaskOpaque && material.a < 1.0) ||\n (uRenderMask == MaskTransparent && material.a == 1.0)\n ) {\n discard;\n }\n #elif defined(dTransparentBackfaces_opaque)\n if (interior) {\n material.a = 1.0;\n } else if (\n (uRenderMask == MaskOpaque && material.a < 1.0) ||\n (uRenderMask == MaskTransparent && material.a == 1.0)\n ) {\n discard;\n }\n #endif\n #endif\n #endif\n#endif\n",assign_position:"\nmat4 model = uModel * aTransform;\nmat4 modelView = uView * model;\n#ifdef dGeometryType_textureMesh\n vec3 position = readFromTexture(tPosition, VertexID, uGeoTexDim).xyz;\n#else\n vec3 position = aPosition;\n#endif\nvec4 position4 = vec4(position, 1.0);\n// for accessing tColorGrid in vert shader and for clipping in frag shader\nvModelPosition = (model * position4).xyz;\nvec4 mvPosition = modelView * position4;\nvViewPosition = mvPosition.xyz;\ngl_Position = uProjection * mvPosition;\n",assign_size:"\n#if defined(dSizeType_uniform)\n float size = uSize;\n#elif defined(dSizeType_attribute)\n float size = aSize;\n#elif defined(dSizeType_instance)\n float size = unpackRGBToInt(readFromTexture(tSize, aInstance, uSizeTexDim).rgb);\n#elif defined(dSizeType_group)\n float size = unpackRGBToInt(readFromTexture(tSize, group, uSizeTexDim).rgb);\n#elif defined(dSizeType_groupInstance)\n float size = unpackRGBToInt(readFromTexture(tSize, aInstance * float(uGroupCount) + group, uSizeTexDim).rgb);\n#endif\n\n#if defined(dSizeType_instance) || defined(dSizeType_group) || defined(dSizeType_groupInstance)\n size /= 100.0; // NOTE factor also set in TypeScript\n#endif\n\nsize *= uSizeFactor;\n",check_picking_alpha:"\nfloat viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);\nfloat fogFactor = smoothstep(uFogNear, uFogFar, abs(viewZ));\nfloat alpha = (1.0 - fogFactor) * uAlpha;\n// if not opaque enough ignore so the element below can be picked\nif (uAlpha < uPickingAlphaThreshold || alpha < 0.1) {\n #ifdef dTransparentBackfaces_opaque\n if (!interior) discard;\n #else\n discard;\n #endif\n}\n",clip_instance:"\n#if defined(dClipVariant_instance) && dClipObjectCount != 0\n vec4 mCenter = uModel * aTransform * vec4(uInvariantBoundingSphere.xyz, 1.0);\n if (clipTest(vec4(mCenter.xyz, uInvariantBoundingSphere.w)))\n // move out of [ -w, +w ] to 'discard' in vert shader\n gl_Position.z = 2.0 * gl_Position.w;\n#endif\n",clip_pixel:"\n#if defined(dClipVariant_pixel) && dClipObjectCount != 0\n if (clipTest(vec4(vModelPosition, 0.0)))\n discard;\n#endif\n",color_frag_params:"\nuniform float uMetalness;\nuniform float uRoughness;\nuniform float uBumpiness;\n#ifdef bumpEnabled\n uniform float uBumpFrequency;\n uniform float uBumpAmplitude;\n#endif\n\n#if defined(dRenderVariant_color)\n #if defined(dColorType_uniform)\n uniform vec3 uColor;\n #elif defined(dColorType_varying)\n varying vec4 vColor;\n #endif\n\n #ifdef dUsePalette\n uniform sampler2D tPalette;\n varying float vPaletteV;\n #endif\n\n #ifdef dOverpaint\n varying vec4 vOverpaint;\n #endif\n\n #ifdef dSubstance\n varying vec4 vSubstance;\n #endif\n#elif defined(dRenderVariant_pick)\n #if __VERSION__ == 100 || !defined(dVaryingGroup)\n #ifdef requiredDrawBuffers\n varying vec4 vObject;\n varying vec4 vInstance;\n varying vec4 vGroup;\n #else\n varying vec4 vColor;\n #endif\n #else\n #ifdef requiredDrawBuffers\n flat in vec4 vObject;\n flat in vec4 vInstance;\n flat in vec4 vGroup;\n #else\n flat in vec4 vColor;\n #endif\n #endif\n#endif\n\n#ifdef dTransparency\n varying float vTransparency;\n#endif\n",color_vert_params:"\nuniform float uMetalness;\nuniform float uRoughness;\nuniform float uBumpiness;\n\n#if defined(dRenderVariant_color)\n #if defined(dColorType_uniform)\n uniform vec3 uColor;\n #elif defined(dColorType_attribute)\n varying vec4 vColor;\n attribute vec3 aColor;\n #elif defined(dColorType_texture)\n varying vec4 vColor;\n uniform vec2 uColorTexDim;\n uniform sampler2D tColor;\n #elif defined(dColorType_grid)\n varying vec4 vColor;\n uniform vec2 uColorTexDim;\n uniform vec3 uColorGridDim;\n uniform vec4 uColorGridTransform;\n uniform sampler2D tColorGrid;\n #elif defined(dColorType_direct)\n varying vec4 vColor;\n #endif\n\n #ifdef dUsePalette\n varying float vPaletteV;\n #endif\n\n #ifdef dOverpaint\n #if defined(dOverpaintType_instance) || defined(dOverpaintType_groupInstance) || defined(dOverpaintType_vertexInstance)\n varying vec4 vOverpaint;\n uniform vec2 uOverpaintTexDim;\n uniform sampler2D tOverpaint;\n #elif defined(dOverpaintType_volumeInstance)\n varying vec4 vOverpaint;\n uniform vec2 uOverpaintTexDim;\n uniform vec3 uOverpaintGridDim;\n uniform vec4 uOverpaintGridTransform;\n uniform sampler2D tOverpaintGrid;\n #endif\n uniform float uOverpaintStrength;\n #endif\n\n #ifdef dSubstance\n #if defined(dSubstanceType_instance) || defined(dSubstanceType_groupInstance) || defined(dSubstanceType_vertexInstance)\n varying vec4 vSubstance;\n uniform vec2 uSubstanceTexDim;\n uniform sampler2D tSubstance;\n #elif defined(dSubstanceType_volumeInstance)\n varying vec4 vSubstance;\n uniform vec2 uSubstanceTexDim;\n uniform vec3 uSubstanceGridDim;\n uniform vec4 uSubstanceGridTransform;\n uniform sampler2D tSubstanceGrid;\n #endif\n uniform float uSubstanceStrength;\n #endif\n#elif defined(dRenderVariant_pick)\n #if __VERSION__ == 100 || !defined(dVaryingGroup)\n #ifdef requiredDrawBuffers\n varying vec4 vObject;\n varying vec4 vInstance;\n varying vec4 vGroup;\n #else\n varying vec4 vColor;\n #endif\n #else\n #ifdef requiredDrawBuffers\n flat out vec4 vObject;\n flat out vec4 vInstance;\n flat out vec4 vGroup;\n #else\n flat out vec4 vColor;\n #endif\n #endif\n#endif\n\n#ifdef dTransparency\n #if defined(dTransparencyType_instance) || defined(dTransparencyType_groupInstance) || defined(dTransparencyType_vertexInstance)\n varying float vTransparency;\n uniform vec2 uTransparencyTexDim;\n uniform sampler2D tTransparency;\n #elif defined(dTransparencyType_volumeInstance)\n varying float vTransparency;\n uniform vec2 uTransparencyTexDim;\n uniform vec3 uTransparencyGridDim;\n uniform vec4 uTransparencyGridTransform;\n uniform sampler2D tTransparencyGrid;\n #endif\n uniform float uTransparencyStrength;\n#endif\n",common_clip:"\n#if dClipObjectCount != 0\n vec3 quaternionTransform(const in vec4 q, const in vec3 v) {\n vec3 t = 2.0 * cross(q.xyz, v);\n return v + q.w * t + cross(q.xyz, t);\n }\n\n vec4 computePlane(const in vec3 normal, const in vec3 inPoint) {\n return vec4(normalize(normal), -dot(normal, inPoint));\n }\n\n float planeSD(const in vec4 plane, const in vec3 center) {\n return -dot(plane.xyz, center - plane.xyz * -plane.w);\n }\n\n float sphereSD(const in vec3 position, const in vec4 rotation, const in vec3 size, const in vec3 center) {\n return (\n length(quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position) / size) - 1.0\n ) * min(min(size.x, size.y), size.z);\n }\n\n float cubeSD(const in vec3 position, const in vec4 rotation, const in vec3 size, const in vec3 center) {\n vec3 d = abs(quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position)) - size;\n return min(max(d.x, max(d.y, d.z)), 0.0) + length(max(d, 0.0));\n }\n\n float cylinderSD(const in vec3 position, const in vec4 rotation, const in vec3 size, const in vec3 center) {\n vec3 t = quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position);\n\n vec2 d = abs(vec2(length(t.xz), t.y)) - size.xy;\n return min(max(d.x, d.y), 0.0) + length(max(d, 0.0));\n }\n\n float infiniteConeSD(const in vec3 position, const in vec4 rotation, const in vec3 size, const in vec3 center) {\n vec3 t = quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position);\n\n float q = length(t.xy);\n return dot(size.xy, vec2(q, t.z));\n }\n\n float getSignedDistance(const in vec3 center, const in int type, const in vec3 position, const in vec4 rotation, const in vec3 scale) {\n if (type == 1) {\n vec3 normal = quaternionTransform(rotation, vec3(0.0, 1.0, 0.0));\n vec4 plane = computePlane(normal, position);\n return planeSD(plane, center);\n } else if (type == 2) {\n return sphereSD(position, rotation, scale * 0.5, center);\n } else if (type == 3) {\n return cubeSD(position, rotation, scale * 0.5, center);\n } else if (type == 4) {\n return cylinderSD(position, rotation, scale * 0.5, center);\n } else if (type == 5) {\n return infiniteConeSD(position, rotation, scale * 0.5, center);\n } else {\n return 0.1;\n }\n }\n\n #if __VERSION__ == 100\n // 8-bit\n int bitwiseAnd(in int a, in int b) {\n int d = 128;\n int result = 0;\n for (int i = 0; i < 8; ++i) {\n if (d <= 0) break;\n if (a >= d && b >= d) result += d;\n if (a >= d) a -= d;\n if (b >= d) b -= d;\n d /= 2;\n }\n return result;\n }\n\n bool hasBit(const in int mask, const in int bit) {\n return bitwiseAnd(mask, bit) == 0;\n }\n #else\n bool hasBit(const in int mask, const in int bit) {\n return (mask & bit) == 0;\n }\n #endif\n\n bool clipTest(const in vec4 sphere) {\n // flag is a bit-flag for clip-objects to ignore (note, object ids start at 1 not 0)\n #if defined(dClipping)\n int flag = int(floor(vClipping * 255.0 + 0.5));\n #else\n int flag = 0;\n #endif\n\n #pragma unroll_loop_start\n for (int i = 0; i < dClipObjectCount; ++i) {\n if (flag == 0 || hasBit(flag, UNROLLED_LOOP_INDEX + 1)) {\n // TODO take sphere radius into account?\n bool test = getSignedDistance(sphere.xyz, uClipObjectType[i], uClipObjectPosition[i], uClipObjectRotation[i], uClipObjectScale[i]) <= 0.0;\n if ((!uClipObjectInvert[i] && test) || (uClipObjectInvert[i] && !test)) {\n return true;\n }\n }\n }\n #pragma unroll_loop_end\n return false;\n }\n#endif\n",common_frag_params:'\nuniform int uObjectId;\nuniform int uInstanceCount;\nuniform int uGroupCount;\n\nuniform int uPickType;\nuniform int uMarkingType;\n\nuniform vec4 uCameraPlane;\nuniform vec4 uLod;\n\n#if dClipObjectCount != 0\n uniform int uClipObjectType[dClipObjectCount];\n uniform bool uClipObjectInvert[dClipObjectCount];\n uniform vec3 uClipObjectPosition[dClipObjectCount];\n uniform vec4 uClipObjectRotation[dClipObjectCount];\n uniform vec3 uClipObjectScale[dClipObjectCount];\n\n #if defined(dClipping)\n #if __VERSION__ == 100 || defined(dClippingType_instance) || !defined(dVaryingGroup)\n varying float vClipping;\n #else\n flat in float vClipping;\n #endif\n #endif\n#endif\n\n#if defined(dColorMarker)\n uniform vec3 uHighlightColor;\n uniform vec3 uSelectColor;\n uniform vec3 uDimColor;\n uniform float uHighlightStrength;\n uniform float uSelectStrength;\n uniform float uDimStrength;\n uniform int uMarkerPriority;\n uniform float uMarkerAverage;\n#endif\n\n#if defined(dNeedsMarker)\n uniform float uMarker;\n #if __VERSION__ == 100 || defined(dMarkerType_instance) || !defined(dVaryingGroup)\n varying float vMarker;\n #else\n flat in float vMarker;\n #endif\n#endif\n\n#if defined(dRenderVariant_colorDpoit)\n #define MAX_DPOIT_DEPTH 99999.0 // NOTE constant also set in TypeScript\n uniform sampler2D tDpoitDepth;\n uniform sampler2D tDpoitFrontColor;\n#endif\n\nvarying vec3 vModelPosition;\nvarying vec3 vViewPosition;\n\nuniform vec2 uViewOffset;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uIsOrtho;\n\nuniform bool uFog;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\n\nuniform float uAlpha;\nuniform float uPickingAlphaThreshold;\nuniform bool uTransparentBackground;\n\nuniform bool uDoubleSided;\nuniform float uInteriorDarkening;\nuniform bool uInteriorColorFlag;\nuniform vec3 uInteriorColor;\nbool interior;\n\nuniform float uXrayEdgeFalloff;\nuniform float uExposure;\n\nuniform mat4 uProjection;\n\nuniform int uRenderMask;\nuniform bool uMarkingDepthTest;\n\nuniform sampler2D tDepth;\nuniform vec2 uDrawingBufferSize;\n\nfloat getDepthPacked(const in vec2 coords) {\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n}\n\nfloat getDepth(const in vec2 coords) {\n #ifdef depthTextureSupport\n return texture2D(tDepth, coords).r;\n #else\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n #endif\n}\n\nfloat calcDepth(const in vec3 pos) {\n vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;\n return 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\n\n// "Bump Mapping Unparametrized Surfaces on the GPU" Morten S. Mikkelsen\n// https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf\nvec3 perturbNormal(in vec3 position, in vec3 normal, in float height, in float scale) {\n vec3 sigmaS = dFdx(position);\n vec3 sigmaT = dFdy(position);\n\n vec3 r1 = cross(sigmaT, normal);\n vec3 r2 = cross(normal, sigmaS);\n float det = dot(sigmaS, r1);\n\n float bs = dFdx(height);\n float bt = dFdy(height);\n\n vec3 surfGrad = sign(det) * (bs * r1 + bt * r2);\n return normalize(abs(det) * normal - scale * surfGrad);\n}\n\nfloat hash(in float h) {\n return fract(sin(h) * 43758.5453123);\n}\n\nfloat noise(in vec3 x) {\n vec3 p = floor(x);\n vec3 f = fract(x);\n f = f * f * (3.0 - 2.0 * f);\n\n float n = p.x + p.y * 157.0 + 113.0 * p.z;\n return mix(\n mix(mix(hash(n + 0.0), hash(n + 1.0), f.x),\n mix(hash(n + 157.0), hash(n + 158.0), f.x), f.y),\n mix(mix(hash(n + 113.0), hash(n + 114.0), f.x),\n mix(hash(n + 270.0), hash(n + 271.0), f.x), f.y), f.z);\n}\n\nfloat fbm(in vec3 p) {\n float f = 0.0;\n f += 0.5 * noise(p);\n p *= 2.01;\n f += 0.25 * noise(p);\n p *= 2.02;\n f += 0.125 * noise(p);\n\n return f;\n}\n',common_vert_params:"\nuniform mat4 uProjection, uModel, uView;\nuniform vec3 uCameraPosition;\nuniform vec4 uCameraPlane;\n\nuniform int uObjectId;\nuniform int uVertexCount;\nuniform int uInstanceCount;\nuniform int uGroupCount;\nuniform vec4 uInvariantBoundingSphere;\nuniform vec4 uLod;\n\nuniform bool uDoubleSided;\nuniform int uPickType;\n\n#if dClipObjectCount != 0\n uniform int uClipObjectType[dClipObjectCount];\n uniform bool uClipObjectInvert[dClipObjectCount];\n uniform vec3 uClipObjectPosition[dClipObjectCount];\n uniform vec4 uClipObjectRotation[dClipObjectCount];\n uniform vec3 uClipObjectScale[dClipObjectCount];\n\n #if defined(dClipping)\n uniform vec2 uClippingTexDim;\n uniform sampler2D tClipping;\n #if __VERSION__ == 100 || defined(dClippingType_instance) || !defined(dVaryingGroup)\n varying float vClipping;\n #else\n flat out float vClipping;\n #endif\n #endif\n#endif\n\n#if defined(dNeedsMarker)\n uniform float uMarker;\n uniform vec2 uMarkerTexDim;\n uniform sampler2D tMarker;\n #if __VERSION__ == 100 || defined(dMarkerType_instance) || !defined(dVaryingGroup)\n varying float vMarker;\n #else\n flat out float vMarker;\n #endif\n#endif\n\nvarying vec3 vModelPosition;\nvarying vec3 vViewPosition;\n\n#if defined(noNonInstancedActiveAttribs)\n // int() is needed for some Safari versions\n // see https://bugs.webkit.org/show_bug.cgi?id=244152\n #define VertexID int(gl_VertexID)\n#else\n attribute float aVertex;\n #define VertexID int(aVertex)\n#endif\n\n#if defined(enabledMultiDraw)\n #define DrawID gl_DrawID\n#else\n #define DrawID uDrawId\n#endif\n",common:"\n// TODO find a better place for these convenience defines\n\n#if defined(dRenderVariant_colorBlended) || defined(dRenderVariant_colorWboit) || defined(dRenderVariant_colorDpoit)\n #define dRenderVariant_color\n#endif\n\n#if defined(dColorType_instance) || defined(dColorType_group) || defined(dColorType_groupInstance) || defined(dColorType_vertex) || defined(dColorType_vertexInstance)\n #define dColorType_texture\n#endif\n\n#if defined(dColorType_volume) || defined(dColorType_volumeInstance)\n #define dColorType_grid\n#endif\n\n#if defined(dColorType_attribute) || defined(dColorType_texture) || defined(dColorType_grid)\n #define dColorType_varying\n#endif\n\n#if (defined(dRenderVariant_color) && defined(dColorMarker)) || defined(dRenderVariant_marking)\n #define dNeedsMarker\n#endif\n\n#if defined(dXrayShaded_on) || defined(dXrayShaded_inverted)\n #define dXrayShaded\n#endif\n\n#define MaskAll 0\n#define MaskOpaque 1\n#define MaskTransparent 2\n\n//\n\n#define PI 3.14159265\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n\n#define saturate(a) clamp(a, 0.0, 1.0)\n\n#if __VERSION__ == 100\n #define round(x) floor((x) + 0.5)\n#endif\n\nfloat intDiv(const in float a, const in float b) { return float(int(a) / int(b)); }\nvec2 ivec2Div(const in vec2 a, const in vec2 b) { return vec2(ivec2(a) / ivec2(b)); }\nfloat intMod(const in float a, const in float b) { return a - b * float(int(a) / int(b)); }\nint imod(const in int a, const in int b) { return a - b * (a / b); }\n\nfloat pow2(const in float x) { return x * x; }\n\nvec3 packIntToRGB(in float value) {\n value = clamp(round(value), 0.0, 16777216.0 - 1.0) + 1.0;\n vec3 c = vec3(0.0);\n c.b = mod(value, 256.0);\n value = floor(value / 256.0);\n c.g = mod(value, 256.0);\n value = floor(value / 256.0);\n c.r = mod(value, 256.0);\n return c / 255.0;\n}\nfloat unpackRGBToInt(const in vec3 rgb) {\n return (floor(rgb.r * 255.0 + 0.5) * 256.0 * 256.0 + floor(rgb.g * 255.0 + 0.5) * 256.0 + floor(rgb.b * 255.0 + 0.5)) - 1.0;\n}\n\nvec2 packUnitIntervalToRG(const in float v) {\n vec2 enc;\n enc.xy = vec2(fract(v * 256.0), v);\n enc.y -= enc.x * (1.0 / 256.0);\n enc.xy *= 256.0 / 255.0;\n\n return enc;\n}\n\nfloat unpackRGToUnitInterval(const in vec2 enc) {\n return dot(enc, vec2(255.0 / (256.0 * 256.0), 255.0 / 256.0));\n}\n\nvec3 screenSpaceToViewSpace(const in vec3 ssPos, const in mat4 invProjection) {\n vec4 p = vec4(ssPos * 2.0 - 1.0, 1.0);\n p = invProjection * p;\n return p.xyz / p.w;\n}\n\nconst float PackUpscale = 256.0 / 255.0; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255.0 / 256.0; // 0..1 -> fraction (excluding 1)\nconst vec3 PackFactors = vec3(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.0);\nconst float ShiftRight8 = 1.0 / 256.0;\n\nvec4 packDepthToRGBA(const in float v) {\n vec4 r = vec4(fract(v * PackFactors), v);\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\n return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n return dot(v, UnpackFactors);\n}\n\nvec4 sRGBToLinear(const in vec4 c) {\n return vec4(mix(pow(c.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), c.rgb * 0.0773993808, vec3(lessThanEqual(c.rgb, vec3(0.04045)))), c.a);\n}\nvec4 linearTosRGB(const in vec4 c) {\n return vec4(mix(pow(c.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), c.rgb * 12.92, vec3(lessThanEqual(c.rgb, vec3(0.0031308)))), c.a);\n}\n\nfloat linearizeDepth(const in float depth, const in float near, const in float far) {\n return (2.0 * near) / (far + near - depth * (far - near));\n}\n\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\n return (near * far) / ((far - near) * invClipZ - far);\n}\n\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\n return linearClipZ * (near - far) - near;\n}\n\nfloat depthToViewZ(const in float isOrtho, const in float linearClipZ, const in float near, const in float far) {\n return isOrtho == 1.0 ? orthographicDepthToViewZ(linearClipZ, near, far) : perspectiveDepthToViewZ(linearClipZ, near, far);\n}\n\n#if __VERSION__ == 100\n // transpose\n\n float transpose(const in float m) {\n return m;\n }\n\n mat2 transpose2(const in mat2 m) {\n return mat2(\n m[0][0], m[1][0],\n m[0][1], m[1][1]\n );\n }\n\n mat3 transpose3(const in mat3 m) {\n return mat3(\n m[0][0], m[1][0], m[2][0],\n m[0][1], m[1][1], m[2][1],\n m[0][2], m[1][2], m[2][2]\n );\n }\n\n mat4 transpose4(const in mat4 m) {\n return mat4(\n m[0][0], m[1][0], m[2][0], m[3][0],\n m[0][1], m[1][1], m[2][1], m[3][1],\n m[0][2], m[1][2], m[2][2], m[3][2],\n m[0][3], m[1][3], m[2][3], m[3][3]\n );\n }\n\n // inverse\n\n float inverse(const in float m) {\n return 1.0 / m;\n }\n\n mat2 inverse2(const in mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n }\n\n mat3 inverse3(const in mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n }\n\n mat4 inverse4(const in mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n }\n\n #define isNaN(x) ((x) != (x))\n #define isInf(x) ((x) == (x) + 1.0)\n#else\n #define transpose2(m) transpose(m)\n #define transpose3(m) transpose(m)\n #define transpose4(m) transpose(m)\n\n #define inverse2(m) inverse(m)\n #define inverse3(m) inverse(m)\n #define inverse4(m) inverse(m)\n\n #define isNaN isnan\n #define isInf isinf\n#endif\n",fade_lod:"\nif (uLod.w == 0.0 && (uLod.x != 0.0 || uLod.y != 0.0)) {\n float d = dot(uCameraPlane.xyz, vModelPosition) + uCameraPlane.w;\n float ta = min(\n smoothstep(uLod.x, uLod.x + uLod.z, d),\n 1.0 - smoothstep(uLod.y - uLod.z, uLod.y, d)\n );\n\n #if defined(dRenderVariant_color)\n float at = 0.0;\n\n // shift by view-offset during multi-sample rendering to allow for blending\n vec2 coord = gl_FragCoord.xy + uViewOffset * 0.25;\n\n const mat4 thresholdMatrix = mat4(\n 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,\n 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,\n 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,\n 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0\n );\n int ci = int(intMod(coord.x, 4.0));\n int ri = int(intMod(coord.y, 4.0));\n #if __VERSION__ == 100\n vec4 i = vec4(float(ci * 4 + ri));\n vec4 v = thresholdMatrix[0] * vec4(equal(i, vec4(0.0, 1.0, 2.0, 3.0))) +\n thresholdMatrix[1] * vec4(equal(i, vec4(4.0, 5.0, 6.0, 7.0))) +\n thresholdMatrix[2] * vec4(equal(i, vec4(8.0, 9.0, 10.0, 11.0))) +\n thresholdMatrix[3] * vec4(equal(i, vec4(12.0, 13.0, 14.0, 15.0)));\n at = v.x + v.y + v.z + v.w;\n #else\n at = thresholdMatrix[ci][ri];\n #endif\n\n if (ta < 0.99 && (ta < 0.01 || ta < at)) {\n discard;\n }\n #else\n if (ta < uPickingAlphaThreshold) {\n discard;\n }\n #endif\n}\n",float_to_rgba:"\n // floatToRgba adapted from https://github.com/equinor/glsl-float-to-rgba\n // MIT License, Copyright (c) 2020 Equinor\n\n float shiftRight (float v, float amt) {\n v = floor(v) + 0.5;\n return floor(v / exp2(amt));\n }\n float shiftLeft (float v, float amt) {\n return floor(v * exp2(amt) + 0.5);\n }\n float maskLast (float v, float bits) {\n return mod(v, shiftLeft(1.0, bits));\n }\n float extractBits (float num, float from, float to) {\n from = floor(from + 0.5); to = floor(to + 0.5);\n return maskLast(shiftRight(num, from), to - from);\n }\n\n vec4 floatToRgba(float texelFloat, bool littleEndian) {\n if (texelFloat == 0.0) return vec4(0.0, 0.0, 0.0, 0.0);\n float sign = texelFloat > 0.0 ? 0.0 : 1.0;\n texelFloat = abs(texelFloat);\n float exponent = floor(log2(texelFloat));\n float biased_exponent = exponent + 127.0;\n float fraction = ((texelFloat / exp2(exponent)) - 1.0) * 8388608.0;\n float t = biased_exponent / 2.0;\n float last_bit_of_biased_exponent = fract(t) * 2.0;\n float remaining_bits_of_biased_exponent = floor(t);\n float byte4 = extractBits(fraction, 0.0, 8.0) / 255.0;\n float byte3 = extractBits(fraction, 8.0, 16.0) / 255.0;\n float byte2 = (last_bit_of_biased_exponent * 128.0 + extractBits(fraction, 16.0, 23.0)) / 255.0;\n float byte1 = (sign * 128.0 + remaining_bits_of_biased_exponent) / 255.0;\n return (\n littleEndian\n ? vec4(byte4, byte3, byte2, byte1)\n : vec4(byte1, byte2, byte3, byte4)\n );\n }\n",light_frag_params:"\n#if dLightCount != 0\n uniform vec3 uLightDirection[dLightCount];\n uniform vec3 uLightColor[dLightCount];\n#endif\nuniform vec3 uAmbientColor;\n\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\n\nvec3 BRDF_Lambert(const in vec3 diffuseColor) {\n return RECIPROCAL_PI * diffuseColor;\n}\n\nvec3 F_Schlick(const in vec3 f0, const in float f90, const in float dotVH) {\n // Original approximation by Christophe Schlick '94\n // float fresnel = pow( 1.0 - dotVH, 5.0 );\n // Optimized variant (presented by Epic at SIGGRAPH '13)\n // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n float fresnel = exp2((-5.55473 * dotVH - 6.98316) * dotVH);\n return f0 * (1.0 - fresnel) + (f90 * fresnel);\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat V_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {\n float a2 = pow2(alpha);\n float gv = dotNL * sqrt(a2 + (1.0 - a2) * pow2(dotNV));\n float gl = dotNV * sqrt(a2 + (1.0 - a2) * pow2(dotNL));\n return 0.5 / max(gv + gl, EPSILON);\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is \"roughness squared\" in Disney\u2019s reparameterization\nfloat D_GGX(const in float alpha, const in float dotNH) {\n float a2 = pow2(alpha);\n float denom = pow2(dotNH) * (a2 - 1.0) + 1.0; // avoid alpha = 0 with dotNH = 1\n return RECIPROCAL_PI * a2 / pow2(denom);\n}\n\n// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility\nvec3 BRDF_GGX(const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness) {\n float alpha = pow2(roughness); // UE4's roughness\n vec3 halfDir = normalize( lightDir + viewDir);\n float dotNL = saturate(dot(normal, lightDir));\n float dotNV = saturate(dot(normal, viewDir));\n float dotNH = saturate(dot(normal, halfDir));\n float dotVH = saturate(dot(viewDir, halfDir));\n vec3 F = F_Schlick(f0, f90, dotVH);\n float V = V_GGX_SmithCorrelated(alpha, dotNL, dotNV);\n float D = D_GGX(alpha, dotNH);\n return F * (V * D);\n}\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via 'environmentBRDF' from \"Physically Based Shading on Mobile\"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile\nvec2 DFGApprox(const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n float dotNV = saturate(dot(normal, viewDir));\n const vec4 c0 = vec4(-1, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\n vec2 fab = vec2(-1.04, 1.04) * a004 + r.zw;\n return fab;\n}\n\n// Fdez-Ag\xfcera's \"Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting\"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\nvoid computeMultiscattering(const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter) {\n vec2 fab = DFGApprox(normal, viewDir, roughness);\n vec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = specularColor + (1.0 - specularColor) * 0.047619; // 1/21\n vec3 Fms = FssEss * Favg / (1.0 - Ems * Favg);\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n\nvoid RE_Direct_Physical(const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directSpecular += irradiance * BRDF_GGX(directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness);\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectDiffuse_Physical(const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n // Both indirect specular and indirect diffuse light accumulate here\n vec3 singleScattering = vec3(0.0);\n vec3 multiScattering = vec3(0.0);\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n computeMultiscattering(geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering);\n vec3 diffuse = material.diffuseColor * (1.0 - ( singleScattering + multiScattering));\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n",matrix_scale:"\nfloat matrixScale(in mat4 m){\n vec4 r = m[0];\n return sqrt(r[0] * r[0] + r[1] * r[1] + r[2] * r[2]);\n}\n",normal_frag_params:"\nvarying vec3 vNormal;\n",read_from_texture:"\nvec4 readFromTexture(const in sampler2D tex, const in float i, const in vec2 dim) {\n float x = intMod(i, dim.x);\n float y = floor(intDiv(i, dim.x));\n vec2 uv = (vec2(x, y) + 0.5) / dim;\n return texture2D(tex, uv);\n}\n\nvec4 readFromTexture(const in sampler2D tex, const in int i, const in vec2 dim) {\n int x = imod(i, int(dim.x));\n int y = i / int(dim.x);\n vec2 uv = (vec2(x, y) + 0.5) / dim;\n return texture2D(tex, uv);\n}\n",rgba_to_float:'\n // rgbaToFloat adapted from https://github.com/ihmeuw/glsl-rgba-to-float\n // BSD 3-Clause License\n //\n // Copyright (c) 2019, Institute for Health Metrics and Evaluation All rights reserved.\n // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n // - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n // - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n // - Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n //\n // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n // IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n // OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n // OF THE POSSIBILITY OF SUCH DAMAGE.\n\n ivec4 floatsToBytes(vec4 inputFloats, bool littleEndian) {\n ivec4 bytes = ivec4(inputFloats * 255.0);\n return (\n littleEndian\n ? bytes.abgr\n : bytes\n );\n }\n\n // Break the four bytes down into an array of 32 bits.\n void bytesToBits(const in ivec4 bytes, out bool bits[32]) {\n for (int channelIndex = 0; channelIndex < 4; ++channelIndex) {\n float acc = float(bytes[channelIndex]);\n for (int indexInByte = 7; indexInByte >= 0; --indexInByte) {\n float powerOfTwo = exp2(float(indexInByte));\n bool bit = acc >= powerOfTwo;\n bits[channelIndex * 8 + (7 - indexInByte)] = bit;\n acc = mod(acc, powerOfTwo);\n }\n }\n }\n\n // Compute the exponent of the 32-bit float.\n float getExponent(bool bits[32]) {\n const int startIndex = 1;\n const int bitStringLength = 8;\n const int endBeforeIndex = startIndex + bitStringLength;\n float acc = 0.0;\n int pow2 = bitStringLength - 1;\n for (int bitIndex = startIndex; bitIndex < endBeforeIndex; ++bitIndex) {\n acc += float(bits[bitIndex]) * exp2(float(pow2--));\n }\n return acc;\n }\n\n // Compute the mantissa of the 32-bit float.\n float getMantissa(bool bits[32], bool subnormal) {\n const int startIndex = 9;\n const int bitStringLength = 23;\n const int endBeforeIndex = startIndex + bitStringLength;\n // Leading/implicit/hidden bit convention:\n // If the number is not subnormal (with exponent 0), we add a leading 1 digit.\n float acc = float(!subnormal) * exp2(float(bitStringLength));\n int pow2 = bitStringLength - 1;\n for (int bitIndex = startIndex; bitIndex < endBeforeIndex; ++bitIndex) {\n acc += float(bits[bitIndex]) * exp2(float(pow2--));\n }\n return acc;\n }\n\n // Parse the float from its 32 bits.\n float bitsToFloat(bool bits[32]) {\n float signBit = float(bits[0]) * -2.0 + 1.0;\n float exponent = getExponent(bits);\n bool subnormal = abs(exponent - 0.0) < 0.01;\n float mantissa = getMantissa(bits, subnormal);\n float exponentBias = 127.0;\n return signBit * mantissa * exp2(exponent - exponentBias - 23.0);\n }\n\n float rgbaToFloat(vec4 texelRGBA, bool littleEndian) {\n ivec4 rgbaBytes = floatsToBytes(texelRGBA, littleEndian);\n bool bits[32];\n bytesToBits(rgbaBytes, bits);\n return bitsToFloat(bits);\n }\n',size_vert_params:"\n#if defined(dSizeType_uniform)\n uniform float uSize;\n#elif defined(dSizeType_attribute)\n attribute float aSize;\n#elif defined(dSizeType_instance) || defined(dSizeType_group) || defined(dSizeType_groupInstance)\n uniform vec2 uSizeTexDim;\n uniform sampler2D tSize;\n#endif\n\nuniform float uSizeFactor;\n",texture3d_from_1d_trilinear:"\nvec4 texture3dFrom1dTrilinear(const in sampler2D tex, const in vec3 pos, const in vec3 gridDim, const in vec2 texDim, const in float offset) {\n float gdYZ = gridDim.z * gridDim.y;\n float gdZ = gridDim.z;\n vec3 p0 = floor(pos * gridDim);\n vec3 p1 = ceil(pos * gridDim);\n vec3 pd = (pos * gridDim - p0) / (p1 - p0);\n vec4 s000 = readFromTexture(tex, offset + p0.z + p0.y * gdZ + p0.x * gdYZ, texDim);\n vec4 s100 = readFromTexture(tex, offset + p0.z + p0.y * gdZ + p1.x * gdYZ, texDim);\n vec4 s001 = readFromTexture(tex, offset + p1.z + p0.y * gdZ + p0.x * gdYZ, texDim);\n vec4 s101 = readFromTexture(tex, offset + p1.z + p0.y * gdZ + p1.x * gdYZ, texDim);\n vec4 s010 = readFromTexture(tex, offset + p0.z + p1.y * gdZ + p0.x * gdYZ, texDim);\n vec4 s110 = readFromTexture(tex, offset + p0.z + p1.y * gdZ + p1.x * gdYZ, texDim);\n vec4 s011 = readFromTexture(tex, offset + p1.z + p1.y * gdZ + p0.x * gdYZ, texDim);\n vec4 s111 = readFromTexture(tex, offset + p1.z + p1.y * gdZ + p1.x * gdYZ, texDim);\n vec4 s00 = mix(s000, s100, pd.x);\n vec4 s01 = mix(s001, s101, pd.x);\n vec4 s10 = mix(s010, s110, pd.x);\n vec4 s11 = mix(s011, s111, pd.x);\n vec4 s0 = mix(s00, s10, pd.y);\n vec4 s1 = mix(s01, s11, pd.y);\n return mix(s0, s1, pd.z);\n}\n",texture3d_from_2d_linear:"\nvec4 texture3dFrom2dLinear(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n float zSlice0 = floor(pos.z * gridDim.z);\n float column0 = intMod(zSlice0 * gridDim.x, texDim.x) / gridDim.x;\n float row0 = floor(intDiv(zSlice0 * gridDim.x, texDim.x));\n vec2 coord0 = (vec2(column0 * gridDim.x, row0 * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;\n vec4 color0 = texture2D(tex, coord0);\n\n float zSlice1 = zSlice0 + 1.0;\n float column1 = intMod(zSlice1 * gridDim.x, texDim.x) / gridDim.x;\n float row1 = floor(intDiv(zSlice1 * gridDim.x, texDim.x));\n vec2 coord1 = (vec2(column1 * gridDim.x, row1 * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;\n vec4 color1 = texture2D(tex, coord1);\n\n float delta0 = abs((pos.z * gridDim.z) - zSlice0);\n return mix(color0, color1, delta0);\n}\n",texture3d_from_2d_nearest:"\nvec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice\n float column = intMod(zSlice * gridDim.x, texDim.x) / gridDim.x;\n float row = floor(intDiv(zSlice * gridDim.x, texDim.x));\n vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;\n return texture2D(tex, coord);\n}\n",wboit_write:"\n#if defined(dRenderVariant_colorWboit)\n if (uRenderMask == MaskOpaque) {\n if (preFogAlpha < 1.0) {\n discard;\n }\n } else if (uRenderMask == MaskTransparent) {\n if (preFogAlpha != 1.0 && fragmentDepth < getDepth(gl_FragCoord.xy / uDrawingBufferSize)) {\n #ifdef dTransparentBackfaces_off\n if (interior) discard;\n #endif\n float alpha = gl_FragColor.a;\n float wboitWeight = alpha * clamp(pow(1.0 - fragmentDepth, 2.0), 0.01, 1.0);\n gl_FragColor = vec4(gl_FragColor.rgb * alpha * wboitWeight, alpha);\n // extra alpha is to handle pre-multiplied alpha\n #ifndef dGeometryType_directVolume\n gl_FragData[1] = vec4((uTransparentBackground ? alpha : 1.0) * alpha * wboitWeight);\n #else\n gl_FragData[1] = vec4(alpha * alpha * wboitWeight);\n #endif\n } else {\n discard;\n }\n }\n#endif\n",dpoit_write:"\n#if defined(dRenderVariant_colorDpoit)\n if (uRenderMask == MaskOpaque) {\n if (preFogAlpha < 1.0) {\n discard;\n }\n } else if (uRenderMask == MaskTransparent) {\n vec2 coords = gl_FragCoord.xy / uDrawingBufferSize;\n if (preFogAlpha != 1.0 && fragmentDepth < getDepth(coords)) {\n #ifdef dTransparentBackfaces_off\n if (interior) discard;\n #endif\n\n // adapted from https://github.com/tsherif/webgl2examples\n // The MIT License, Copyright 2017 Tarek Sherif, Shuai Shao\n\n vec2 lastDepth = texture2D(tDpoitDepth, coords).rg;\n vec4 lastFrontColor = texture2D(tDpoitFrontColor, coords);\n\n vec4 fragColor = gl_FragColor;\n\n // depth value always increases\n // so we can use MAX blend equation\n gl_FragData[2].rg = vec2(-MAX_DPOIT_DEPTH);\n\n // front color always increases\n // so we can use MAX blend equation\n gl_FragColor = lastFrontColor;\n\n // back color is separately blend afterwards each pass\n gl_FragData[1] = vec4(0.0);\n\n float nearestDepth = -lastDepth.x;\n float furthestDepth = lastDepth.y;\n float alphaMultiplier = 1.0 - lastFrontColor.a;\n\n if (fragmentDepth < nearestDepth || fragmentDepth > furthestDepth) {\n // Skip this depth since it's been peeled.\n return;\n }\n\n if (fragmentDepth > nearestDepth && fragmentDepth < furthestDepth) {\n // This needs to be peeled.\n // The ones remaining after MAX blended for\n // all need-to-peel will be peeled next pass.\n gl_FragData[2].rg = vec2(-fragmentDepth, fragmentDepth);\n return;\n }\n\n // write to back and front color buffer\n if (fragmentDepth == nearestDepth) {\n gl_FragColor.rgb += fragColor.rgb * fragColor.a * alphaMultiplier;\n gl_FragColor.a = 1.0 - alphaMultiplier * (1.0 - fragColor.a);\n } else {\n gl_FragData[1] += fragColor;\n }\n\n } else {\n discard;\n }\n }\n#endif\n"},sGe=/^(?!\/\/)\s*#include\s+(\S+)/gm,aGe=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*\+\+i\s*\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g,cGe=/[ \t]*\/\/.*\n/g,uGe=/[ \t]*\/\*[\s\S]*?\*\//g,lGe=/\n{2,}/g;function Sre(e){return e.replace(sGe,(t,n)=>{const r=oGe[n];if(!r)throw new Error(`empty chunk, '${n}'`);return r}).trim().replace(cGe,"\n").replace(uGe,"\n").replace(lGe,"\n")}function fGe(e,t,n,r){let i="";for(let o=parseInt(t);o radius) discard;\n #elif defined(dPointStyle_fuzzy)\n float dist = distance(gl_PointCoord, center);\n float fuzzyAlpha = 1.0 - smoothstep(0.0, radius, dist);\n if (fuzzyAlpha < 0.0001) discard;\n #endif\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #ifdef requiredDrawBuffers\n gl_FragColor = vObject;\n gl_FragData[1] = vInstance;\n gl_FragData[2] = vGroup;\n gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n #else\n gl_FragColor = vColor;\n #endif\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n gl_FragColor = material;\n\n #if defined(dPointStyle_fuzzy)\n gl_FragColor.a *= fuzzyAlpha;\n #endif\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #endif\n}\n",{drawBuffers:"optional"},{},hD),mGe=Br("spheres","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform mat4 uModelView;\nuniform mat4 uInvProjection;\nuniform float uIsOrtho;\n\nuniform vec2 uTexDim;\nuniform sampler2D tPositionGroup;\n\nattribute mat4 aTransform;\nattribute float aInstance;\n\nvarying float vRadius;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\n#include matrix_scale\n\n/**\n * Bounding rectangle of a clipped, perspective-projected 3D Sphere.\n * Michael Mara, Morgan McGuire. 2013\n *\n * Specialization by Arseny Kapoulkine, MIT License Copyright (c) 2018\n * https://github.com/zeux/niagara\n */\nvoid sphereProjection(const in vec3 p, const in float r, const in vec2 mapping) {\n vec3 pr = p * r;\n float pzr2 = p.z * p.z - r * r;\n\n float vx = sqrt(p.x * p.x + pzr2);\n float minx = ((vx * p.x - pr.z) / (vx * p.z + pr.x)) * uProjection[0][0];\n float maxx = ((vx * p.x + pr.z) / (vx * p.z - pr.x)) * uProjection[0][0];\n\n float vy = sqrt(p.y * p.y + pzr2);\n float miny = ((vy * p.y - pr.z) / (vy * p.z + pr.y)) * uProjection[1][1];\n float maxy = ((vy * p.y + pr.z) / (vy * p.z - pr.y)) * uProjection[1][1];\n\n gl_Position.xy = vec2(maxx + minx, maxy + miny) * -0.5;\n gl_Position.xy -= mapping * vec2(maxx - minx, maxy - miny) * 0.5;\n gl_Position.xy *= gl_Position.w;\n}\n\nvoid main(void){\n vec2 mapping = vec2(1.0, 1.0); // vertices 2 and 5\n #if __VERSION__ == 100\n int m = imod(VertexID, 6);\n #else\n int m = VertexID % 6;\n #endif\n if (m == 0) {\n mapping = vec2(-1.0, 1.0);\n } else if (m == 1 || m == 3) {\n mapping = vec2(-1.0, -1.0);\n } else if (m == 4) {\n mapping = vec2(1.0, -1.0);\n }\n\n vec4 positionGroup = readFromTexture(tPositionGroup, VertexID / 6, uTexDim);\n vec3 position = positionGroup.rgb;\n float group = positionGroup.a;\n\n #include assign_color_varying\n #include assign_marker_varying\n #include assign_clipping_varying\n #include assign_size\n\n vRadius = size * matrixScale(uModelView);\n\n vec4 position4 = vec4(position, 1.0);\n vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader\n\n float d;\n if (uLod.w != 0.0 && (uLod.x != 0.0 || uLod.y != 0.0)) {\n d = dot(uCameraPlane.xyz, vModelPosition) + uCameraPlane.w;\n float f = min(\n smoothstep(uLod.x, uLod.x + uLod.z, d),\n 1.0 - smoothstep(uLod.y - uLod.z, uLod.y, d)\n ) * uLod.w;\n vRadius *= f;\n }\n\n vec4 mvPosition = uModelView * aTransform * position4;\n\n #ifdef dApproximate\n vec4 mvCorner = vec4(mvPosition.xyz, 1.0);\n mvCorner.xy += mapping * vRadius;\n gl_Position = uProjection * mvCorner;\n #else\n if (uIsOrtho == 1.0) {\n vec4 mvCorner = vec4(mvPosition.xyz, 1.0);\n mvCorner.xy += mapping * vRadius;\n gl_Position = uProjection * mvCorner;\n } else {\n gl_Position = uProjection * vec4(mvPosition.xyz, 1.0);\n sphereProjection(mvPosition.xyz, vRadius, mapping);\n }\n #endif\n\n vec4 vPoint4 = uInvProjection * gl_Position;\n vPoint = vPoint4.xyz / vPoint4.w;\n vPointViewPosition = -mvPosition.xyz / mvPosition.w;\n\n if (gl_Position.z < -gl_Position.w) {\n mvPosition.z -= 2.0 * vRadius; // avoid clipping\n gl_Position.z = (uProjection * vec4(mvPosition.xyz, 1.0)).z;\n }\n\n if (uLod.w != 0.0 && (uLod.x != 0.0 || uLod.y != 0.0)) {\n if (d < uLod.x || d > uLod.y) {\n // move out of [ -w, +w ] to 'discard' in vert shader\n gl_Position.z = 2.0 * gl_Position.w;\n }\n }\n\n #if defined(dClipPrimitive) && !defined(dClipVariant_instance) && dClipObjectCount != 0\n if (clipTest(vec4(vModelPosition.xyz, 0.0))) {\n // move out of [ -w, +w ] to 'discard' in vert shader\n gl_Position.z = 2.0 * gl_Position.w;\n }\n #else\n #include clip_instance\n #endif\n}\n","\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\nuniform mat4 uInvView;\nuniform float uAlphaThickness;\n\nvarying float vRadius;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\n#ifdef dSolidInterior\n const bool solidInterior = true;\n#else\n const bool solidInterior = false;\n#endif\n\nbool SphereImpostor(out vec3 modelPos, out vec3 cameraPos, out vec3 cameraNormal, out bool interior, out float fragmentDepth){\n vec3 cameraSpherePos = -vPointViewPosition;\n\n vec3 rayOrigin = mix(vec3(0.0, 0.0, 0.0), vPoint, uIsOrtho);\n vec3 rayDirection = mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n vec3 cameraSphereDir = mix(cameraSpherePos, rayOrigin - cameraSpherePos, uIsOrtho);\n\n float B = dot(rayDirection, cameraSphereDir);\n float det = B * B + vRadius * vRadius - dot(cameraSphereDir, cameraSphereDir);\n\n if (det < 0.0) return false;\n\n float sqrtDet = sqrt(det);\n float posT = mix(B + sqrtDet, B - sqrtDet, uIsOrtho);\n float negT = mix(B - sqrtDet, B + sqrtDet, uIsOrtho);\n\n cameraPos = rayDirection * negT + rayOrigin;\n modelPos = (uInvView * vec4(cameraPos, 1.0)).xyz;\n fragmentDepth = calcDepth(cameraPos);\n\n bool objectClipped = false;\n\n #if !defined(dClipPrimitive) && defined(dClipVariant_pixel) && dClipObjectCount != 0\n if (clipTest(vec4(modelPos, 0.0))) {\n objectClipped = true;\n fragmentDepth = -1.0;\n }\n #endif\n\n if (fragmentDepth > 0.0) {\n cameraNormal = normalize(cameraPos - cameraSpherePos);\n interior = false;\n return true;\n } else if (uDoubleSided || solidInterior) {\n cameraPos = rayDirection * posT + rayOrigin;\n modelPos = (uInvView * vec4(cameraPos, 1.0)).xyz;\n fragmentDepth = calcDepth(cameraPos);\n cameraNormal = -normalize(cameraPos - cameraSpherePos);\n interior = true;\n if (fragmentDepth > 0.0) {\n #ifdef dSolidInterior\n if (!objectClipped) {\n fragmentDepth = 0.0 + (0.0000001 / vRadius);\n cameraNormal = -mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n }\n #endif\n return true;\n }\n }\n\n return false;\n}\n\nvoid main(void){\n vec3 cameraNormal;\n float fragmentDepth;\n\n #ifdef dApproximate\n vec3 pointDir = -vPointViewPosition - vPoint;\n if (dot(pointDir, pointDir) > vRadius * vRadius) discard;\n vec3 vViewPosition = -vPointViewPosition;\n fragmentDepth = gl_FragCoord.z;\n #if !defined(dIgnoreLight) || defined(dXrayShaded)\n pointDir.z -= cos(length(pointDir) / vRadius);\n cameraNormal = -normalize(pointDir / vRadius);\n #endif\n interior = false;\n #else\n vec3 modelPos;\n vec3 cameraPos;\n bool hit = SphereImpostor(modelPos, cameraPos, cameraNormal, interior, fragmentDepth);\n if (!hit) discard;\n\n if (fragmentDepth < 0.0) discard;\n if (fragmentDepth > 1.0) discard;\n\n gl_FragDepthEXT = fragmentDepth;\n\n vec3 vModelPosition = modelPos;\n vec3 vViewPosition = cameraPos;\n #endif\n\n #include fade_lod\n #if !defined(dClipPrimitive) && defined(dClipVariant_pixel) && dClipObjectCount != 0\n #include clip_pixel\n #endif\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #ifdef requiredDrawBuffers\n gl_FragColor = vObject;\n gl_FragData[1] = vInstance;\n gl_FragData[2] = vGroup;\n gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n #else\n gl_FragColor = vColor;\n #endif\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n vec3 normal = -cameraNormal;\n #include apply_light_color\n\n if (uRenderMask == MaskTransparent && uAlphaThickness > 0.0) {\n gl_FragColor.a *= min(1.0, vRadius / uAlphaThickness);\n }\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #endif\n}\n",{fragDepth:"required",drawBuffers:"optional"},{},lS),gGe=Br("cylinders","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform mat4 uModelView;\n\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nattribute vec3 aMapping;\nattribute vec3 aStart;\nattribute vec3 aEnd;\nattribute float aScale;\nattribute float aCap;\nattribute float aColorMode;\n\nvarying mat4 vTransform;\nvarying vec3 vStart;\nvarying vec3 vEnd;\nvarying float vSize;\nvarying float vCap;\n\nuniform float uIsOrtho;\nuniform vec3 uCameraDir;\n\nvoid main() {\n #include assign_group\n #include assign_color_varying\n #include assign_marker_varying\n #include assign_clipping_varying\n #include assign_size\n\n mat4 modelTransform = uModel * aTransform;\n\n vTransform = aTransform;\n vStart = (modelTransform * vec4(aStart, 1.0)).xyz;\n vEnd = (modelTransform * vec4(aEnd, 1.0)).xyz;\n vSize = size * aScale;\n vCap = aCap;\n\n vModelPosition = (vStart + vEnd) * 0.5;\n vec3 camDir = -mix(normalize(vModelPosition - uCameraPosition), uCameraDir, uIsOrtho);\n vec3 dir = vEnd - vStart;\n float f = aMapping.x > 0.0 ? 1.0 : 0.0;\n // ensure cylinder 'dir' is pointing towards the camera\n if(dot(camDir, dir) < 0.0) {\n dir = -dir;\n f = 1.0 - f;\n }\n\n vec3 left = cross(camDir, dir);\n vec3 up = cross(left, dir);\n left = vSize * normalize(left);\n up = vSize * normalize(up);\n\n // move vertex in object-space from center to corner\n vModelPosition += aMapping.x * dir + aMapping.y * left + aMapping.z * up;\n\n vec4 mvPosition = uView * vec4(vModelPosition, 1.0);\n vViewPosition = mvPosition.xyz;\n gl_Position = uProjection * mvPosition;\n\n if (gl_Position.z < -gl_Position.w) {\n mvPosition.z -= 2.0 * (length(vEnd - vStart) + vSize); // avoid clipping\n gl_Position.z = (uProjection * mvPosition).z;\n }\n\n #if defined(dDualColor) && defined(dRenderVariant_color) && (defined(dColorType_group) || defined(dColorType_groupInstance))\n // dual-color mixing\n // - for aColorMode between 0 and 1 use aColorMode to interpolate\n // - for aColorMode == 2 do nothing, i.e., use vColor\n // - for aColorMode == 3 use position on cylinder axis to interpolate\n if (aColorMode <= 1.0){\n vColor.rgb = mix(vColor.rgb, color2.rgb, aColorMode);\n } else if (aColorMode == 3.0) {\n vColor.rgb = mix(vColor.rgb, color2.rgb, mix(-0.25, 1.25, f / 1.5));\n }\n #endif\n\n #include clip_instance\n}\n","\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\nuniform mat4 uView;\n\nvarying mat4 vTransform;\nvarying vec3 vStart;\nvarying vec3 vEnd;\nvarying float vSize;\nvarying float vCap;\n\nuniform vec3 uCameraDir;\nuniform vec3 uCameraPosition;\nuniform mat4 uInvView;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\n#ifdef dSolidInterior\n const bool solidInterior = true;\n#else\n const bool solidInterior = false;\n#endif\n\n// adapted from https://www.shadertoy.com/view/4lcSRn\n// The MIT License, Copyright 2016 Inigo Quilez\nbool CylinderImpostor(\n in vec3 rayOrigin, in vec3 rayDir,\n in vec3 start, in vec3 end, in float radius,\n out vec3 cameraNormal, out bool interior,\n out vec3 modelPosition, out vec3 viewPosition, out float fragmentDepth\n){\n vec3 ba = end - start;\n vec3 oc = rayOrigin - start;\n\n float baba = dot(ba, ba);\n float bard = dot(ba, rayDir);\n float baoc = dot(ba, oc);\n\n float k2 = baba - bard * bard;\n float k1 = baba * dot(oc, rayDir) - baoc * bard;\n float k0 = baba * dot(oc, oc) - baoc * baoc - radius * radius * baba;\n\n float h = k1 * k1 - k2 * k0;\n if (h < 0.0) return false;\n\n bool topCap = (vCap > 0.9 && vCap < 1.1) || vCap >= 2.9;\n bool bottomCap = (vCap > 1.9 && vCap < 2.1) || vCap >= 2.9;\n\n #ifdef dSolidInterior\n bool topInterior = !topCap;\n bool bottomInterior = !bottomCap;\n topCap = true;\n bottomCap = true;\n #else\n bool topInterior = false;\n bool bottomInterior = false;\n #endif\n\n bool clipped = false;\n bool objectClipped = false;\n\n // body outside\n h = sqrt(h);\n float t = (-k1 - h) / k2;\n float y = baoc + t * bard;\n if (y > 0.0 && y < baba) {\n interior = false;\n cameraNormal = (oc + t * rayDir - ba * y / baba) / radius;\n modelPosition = rayOrigin + t * rayDir;\n viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n fragmentDepth = calcDepth(viewPosition);\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n if (clipTest(vec4(modelPosition, 0.0))) {\n objectClipped = true;\n fragmentDepth = -1.0;\n #ifdef dSolidInterior\n topCap = !topInterior;\n bottomCap = !bottomInterior;\n #endif\n }\n #endif\n if (fragmentDepth > 0.0) return true;\n clipped = true;\n }\n\n if (!clipped) {\n if (topCap && y < 0.0) {\n // top cap\n t = -baoc / bard;\n if (abs(k1 + k2 * t) < h) {\n interior = topInterior;\n cameraNormal = -ba / baba;\n modelPosition = rayOrigin + t * rayDir;\n viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n fragmentDepth = calcDepth(viewPosition);\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n if (clipTest(vec4(modelPosition, 0.0))) {\n objectClipped = true;\n fragmentDepth = -1.0;\n #ifdef dSolidInterior\n topCap = !topInterior;\n bottomCap = !bottomInterior;\n #endif\n }\n #endif\n if (fragmentDepth > 0.0) {\n #ifdef dSolidInterior\n if (interior) cameraNormal = -rayDir;\n #endif\n return true;\n }\n }\n } else if (bottomCap && y >= 0.0) {\n // bottom cap\n t = (baba - baoc) / bard;\n if (abs(k1 + k2 * t) < h) {\n interior = bottomInterior;\n cameraNormal = ba / baba;\n modelPosition = rayOrigin + t * rayDir;\n viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n fragmentDepth = calcDepth(viewPosition);\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n if (clipTest(vec4(modelPosition, 0.0))) {\n objectClipped = true;\n fragmentDepth = -1.0;\n #ifdef dSolidInterior\n topCap = !topInterior;\n bottomCap = !bottomInterior;\n #endif\n }\n #endif\n if (fragmentDepth > 0.0) {\n #ifdef dSolidInterior\n if (interior) cameraNormal = -rayDir;\n #endif\n return true;\n }\n }\n }\n }\n\n if (uDoubleSided || solidInterior) {\n // body inside\n h = -h;\n t = (-k1 - h) / k2;\n y = baoc + t * bard;\n if (y > 0.0 && y < baba) {\n interior = true;\n cameraNormal = -(oc + t * rayDir - ba * y / baba) / radius;\n modelPosition = rayOrigin + t * rayDir;\n viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n fragmentDepth = calcDepth(viewPosition);\n if (fragmentDepth > 0.0) {\n #ifdef dSolidInterior\n if (!objectClipped) {\n fragmentDepth = 0.0 + (0.0000002 / vSize);\n cameraNormal = -rayDir;\n }\n #endif\n return true;\n }\n }\n\n if (topCap && y < 0.0) {\n // top cap\n t = -baoc / bard;\n if (abs(k1 + k2 * t) < -h) {\n interior = true;\n cameraNormal = ba / baba;\n modelPosition = rayOrigin + t * rayDir;\n viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n fragmentDepth = calcDepth(viewPosition);\n if (fragmentDepth > 0.0) {\n #ifdef dSolidInterior\n if (!objectClipped) {\n fragmentDepth = 0.0 + (0.0000002 / vSize);\n cameraNormal = -rayDir;\n }\n #endif\n return true;\n }\n }\n } else if (bottomCap && y >= 0.0) {\n // bottom cap\n t = (baba - baoc) / bard;\n if (abs(k1 + k2 * t) < -h) {\n interior = true;\n cameraNormal = -ba / baba;\n modelPosition = rayOrigin + t * rayDir;\n viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n fragmentDepth = calcDepth(viewPosition);\n if (fragmentDepth > 0.0) {\n #ifdef dSolidInterior\n if (!objectClipped) {\n fragmentDepth = 0.0 + (0.0000002 / vSize);\n cameraNormal = -rayDir;\n }\n #endif\n return true;\n }\n }\n }\n }\n\n return false;\n}\n\nvoid main() {\n vec3 rayOrigin = vModelPosition;\n vec3 rayDir = mix(normalize(vModelPosition - uCameraPosition), uCameraDir, uIsOrtho);\n\n vec3 cameraNormal;\n vec3 modelPosition;\n vec3 viewPosition;\n float fragmentDepth;\n bool hit = CylinderImpostor(rayOrigin, rayDir, vStart, vEnd, vSize, cameraNormal, interior, modelPosition, viewPosition, fragmentDepth);\n if (!hit) discard;\n\n if (fragmentDepth < 0.0) discard;\n if (fragmentDepth > 1.0) discard;\n\n gl_FragDepthEXT = fragmentDepth;\n\n vec3 vViewPosition = viewPosition;\n vec3 vModelPosition = modelPosition;\n\n #include fade_lod\n #include clip_pixel\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #ifdef requiredDrawBuffers\n gl_FragColor = vObject;\n gl_FragData[1] = vInstance;\n gl_FragData[2] = vGroup;\n gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n #else\n gl_FragColor = vColor;\n #endif\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n mat3 normalMatrix = transpose3(inverse3(mat3(uView)));\n vec3 normal = normalize(normalMatrix * -normalize(cameraNormal));\n #include apply_light_color\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #endif\n}\n",{fragDepth:"required",drawBuffers:"optional"},{},lS),yGe=Br("text","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform mat4 uModelView;\n\nattribute vec3 aPosition;\nattribute vec2 aMapping;\nattribute float aDepth;\nattribute vec2 aTexCoord;\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nuniform float uOffsetX;\nuniform float uOffsetY;\nuniform float uOffsetZ;\n\nuniform float uIsOrtho;\nuniform float uPixelRatio;\nuniform vec4 uViewport;\n\nvarying vec2 vTexCoord;\n\n#include matrix_scale\n\nvoid main(void){\n #include assign_group\n #include assign_color_varying\n #include assign_marker_varying\n #include assign_clipping_varying\n #include assign_size\n\n vTexCoord = aTexCoord;\n\n float scale = matrixScale(uModelView);\n\n float offsetX = uOffsetX * scale;\n float offsetY = uOffsetY * scale;\n float offsetZ = (uOffsetZ + aDepth * 0.95) * scale;\n\n vec4 position4 = vec4(aPosition, 1.0);\n vec4 mvPosition = uModelView * aTransform * position4;\n\n vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader\n\n // TODO\n // #ifdef FIXED_SIZE\n // if (ortho) {\n // scale /= pixelRatio * ((uViewport.w / 2.0) / -uCameraPosition.z) * 0.1;\n // } else {\n // scale /= pixelRatio * ((uViewport.w / 2.0) / -mvPosition.z) * 0.1;\n // }\n // #endif\n\n vec4 mvCorner = vec4(mvPosition.xyz, 1.0);\n\n if (vTexCoord.x == 10.0) { // indicates background plane\n // move a bit to the back, taking distance to camera into account to avoid z-fighting\n offsetZ -= 0.001 * distance(uCameraPosition, (uProjection * mvCorner).xyz);\n }\n\n mvCorner.xy += aMapping * size * scale;\n mvCorner.x += offsetX;\n mvCorner.y += offsetY;\n\n if (uIsOrtho == 1.0) {\n mvCorner.z += offsetZ;\n } else {\n mvCorner.xyz += normalize(-mvCorner.xyz) * offsetZ;\n }\n\n gl_Position = uProjection * mvCorner;\n\n vViewPosition = -mvCorner.xyz;\n\n #include clip_instance\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nuniform sampler2D tFont;\n\nuniform vec3 uBorderColor;\nuniform float uBorderWidth;\nuniform vec3 uBackgroundColor;\nuniform float uBackgroundOpacity;\n\nvarying vec2 vTexCoord;\n\nconst float smoothness = 32.0;\nconst float gamma = 2.2;\n\nvoid main2(){\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n\nvoid main(){\n #include fade_lod\n #include clip_pixel\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n if (vTexCoord.x > 1.0) {\n #if defined(dRenderVariant_color)\n material = vec4(uBackgroundColor, uBackgroundOpacity * material.a);\n #endif\n } else {\n // retrieve signed distance\n float sdf = texture2D(tFont, vTexCoord).a + uBorderWidth;\n\n // perform adaptive anti-aliasing of the edges\n float w = clamp(smoothness * (abs(dFdx(vTexCoord.x)) + abs(dFdy(vTexCoord.y))), 0.0, 0.5);\n float a = smoothstep(0.5 - w, 0.5 + w, sdf);\n\n // gamma correction for linear attenuation\n a = pow(a, 1.0 / gamma);\n\n if (a < 0.5) discard;\n\n #if defined(dRenderVariant_color)\n material.a *= a;\n\n // add border\n float t = 0.5 + uBorderWidth;\n if (uBorderWidth > 0.0 && sdf < t) {\n material.xyz = mix(uBorderColor, material.xyz, smoothstep(t - w, t, sdf));\n }\n #endif\n }\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #ifdef requiredDrawBuffers\n gl_FragColor = vObject;\n gl_FragData[1] = vInstance;\n gl_FragData[2] = vGroup;\n gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n #else\n gl_FragColor = vColor;\n #endif\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n gl_FragColor = material;\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #endif\n}\n",{drawBuffers:"optional"},{},hD),bGe=Br("lines","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform float uPixelRatio;\nuniform vec4 uViewport;\n\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nattribute vec2 aMapping;\nattribute vec3 aStart;\nattribute vec3 aEnd;\n\nvoid trimSegment(const in vec4 start, inout vec4 end) {\n // trim end segment so it terminates between the camera plane and the near plane\n // conservative estimate of the near plane\n float a = uProjection[2][2]; // 3rd entry in 3rd column\n float b = uProjection[3][2]; // 3rd entry in 4th column\n float nearEstimate = -0.5 * b / a;\n float alpha = (nearEstimate - start.z) / (end.z - start.z);\n end.xyz = mix(start.xyz, end.xyz, alpha);\n}\n\nvoid main(){\n float aspect = uViewport.z / uViewport.w;\n\n #include assign_group\n #include assign_color_varying\n #include assign_marker_varying\n #include assign_clipping_varying\n #include assign_size\n\n mat4 modelView = uView * uModel * aTransform;\n\n // camera space\n vec4 start = modelView * vec4(aStart, 1.0);\n vec4 end = modelView * vec4(aEnd, 1.0);\n\n // assign position\n vec4 position4 = vec4((aMapping.y < 0.5) ? aStart : aEnd, 1.0);\n vec4 mvPosition = modelView * position4;\n vViewPosition = mvPosition.xyz;\n\n vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader\n\n // special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n // but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n // perhaps there is a more elegant solution -- WestLangley\n bool perspective = (uProjection[2][3] == -1.0); // 4th entry in the 3rd column\n if (perspective) {\n if (start.z < 0.0 && end.z >= 0.0) {\n trimSegment(start, end);\n } else if (end.z < 0.0 && start.z >= 0.0) {\n trimSegment(end, start);\n }\n }\n\n // clip space\n vec4 clipStart = uProjection * start;\n vec4 clipEnd = uProjection * end;\n\n // ndc space\n vec2 ndcStart = clipStart.xy / clipStart.w;\n vec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n // direction\n vec2 dir = ndcEnd - ndcStart;\n\n // account for clip-space aspect ratio\n dir.x *= aspect;\n dir = normalize(dir);\n\n // perpendicular to dir\n vec2 offset = vec2(dir.y, - dir.x);\n\n // undo aspect ratio adjustment\n dir.x /= aspect;\n offset.x /= aspect;\n\n // sign flip\n if (aMapping.x < 0.0) offset *= -1.0;\n\n // calculate linewidth\n float linewidth;\n #ifdef dLineSizeAttenuation\n linewidth = size * uPixelRatio * ((uViewport.w / 2.0) / -start.z) * 5.0;\n #else\n linewidth = size * uPixelRatio;\n #endif\n linewidth = max(1.0, linewidth);\n\n // adjust for linewidth\n offset *= linewidth;\n\n // adjust for clip-space to screen-space conversion\n offset /= uViewport.w;\n\n // select end\n vec4 clip = (aMapping.y < 0.5) ? clipStart : clipEnd;\n\n // back to clip space\n offset *= clip.w;\n clip.xy += offset;\n gl_Position = clip;\n\n #include clip_instance\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nvoid main(){\n #include fade_lod\n #include clip_pixel\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #ifdef requiredDrawBuffers\n gl_FragColor = vObject;\n gl_FragData[1] = vInstance;\n gl_FragData[2] = vGroup;\n gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n #else\n gl_FragColor = vColor;\n #endif\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n gl_FragColor = material;\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #endif\n}\n",{drawBuffers:"optional"},{},hD),wre=Br("mesh","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include common_clip\n#include texture3d_from_2d_linear\n\n#ifdef dGeometryType_textureMesh\n uniform vec2 uGeoTexDim;\n uniform sampler2D tPosition;\n uniform sampler2D tGroup;\n uniform sampler2D tNormal;\n#else\n attribute vec3 aPosition;\n attribute float aGroup;\n attribute vec3 aNormal;\n#endif\nattribute mat4 aTransform;\nattribute float aInstance;\n\nvarying vec3 vNormal;\n\nvoid main(){\n #include assign_group\n #include assign_marker_varying\n #include assign_clipping_varying\n #include assign_position\n #include assign_color_varying\n #include clip_instance\n\n #ifdef dGeometryType_textureMesh\n vec3 normal = readFromTexture(tNormal, VertexID, uGeoTexDim).xyz;\n #else\n vec3 normal = aNormal;\n #endif\n mat3 normalMatrix = transpose3(inverse3(mat3(modelView)));\n vec3 transformedNormal = normalize(normalMatrix * normalize(normal));\n #if defined(dFlipSided)\n if (!uDoubleSided) { // TODO checking uDoubleSided should not be required, ASR\n transformedNormal = -transformedNormal;\n }\n #endif\n vNormal = transformedNormal;\n}\n","\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include normal_frag_params\n#include common_clip\n\nvoid main() {\n #include fade_lod\n #include clip_pixel\n\n // Workaround for buggy gl_FrontFacing (e.g. on some integrated Intel GPUs)\n vec3 fdx = dFdx(vViewPosition);\n vec3 fdy = dFdy(vViewPosition);\n vec3 faceNormal = normalize(cross(fdx,fdy));\n bool frontFacing = dot(vNormal, faceNormal) > 0.0;\n\n #if defined(dFlipSided)\n interior = frontFacing;\n #else\n interior = !frontFacing;\n #endif\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #ifdef requiredDrawBuffers\n gl_FragColor = vObject;\n gl_FragData[1] = vInstance;\n gl_FragData[2] = vGroup;\n gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n #else\n gl_FragColor = vColor;\n #endif\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #if defined(dFlatShaded)\n vec3 normal = -faceNormal;\n #else\n vec3 normal = -normalize(vNormal);\n if (uDoubleSided) normal *= float(frontFacing) * 2.0 - 1.0;\n #endif\n #include apply_light_color\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #endif\n}\n",{drawBuffers:"optional"},{},lS),vGe=Br("direct-volume","\nprecision highp float;\n\nattribute vec3 aPosition;\nattribute mat4 aTransform;\nattribute float aInstance;\n\nuniform mat4 uModelView;\nuniform mat4 uProjection;\nuniform vec4 uInvariantBoundingSphere;\n\nvarying vec3 vOrigPos;\nvarying float vInstance;\nvarying vec4 vBoundingSphere;\nvarying mat4 vTransform;\n\nuniform vec3 uBboxSize;\nuniform vec3 uBboxMin;\nuniform vec3 uBboxMax;\nuniform vec3 uGridDim;\nuniform mat4 uTransform;\n\nuniform mat4 uUnitToCartn;\n\nvoid main() {\n vec4 unitCoord = vec4(aPosition + vec3(0.5), 1.0);\n vec4 mvPosition = uModelView * aTransform * uUnitToCartn * unitCoord;\n\n vOrigPos = (aTransform * uUnitToCartn * unitCoord).xyz;\n vInstance = aInstance;\n vBoundingSphere = vec4(\n (aTransform * vec4(uInvariantBoundingSphere.xyz, 1.0)).xyz,\n uInvariantBoundingSphere.w\n );\n vTransform = aTransform;\n\n gl_Position = uProjection * mvPosition;\n\n // move z position to near clip plane (but not too close to get precision issues)\n gl_Position.z = gl_Position.w - 0.01;\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include light_frag_params\n\n#if dClipObjectCount != 0\n uniform int uClipObjectType[dClipObjectCount];\n uniform bool uClipObjectInvert[dClipObjectCount];\n uniform vec3 uClipObjectPosition[dClipObjectCount];\n uniform vec4 uClipObjectRotation[dClipObjectCount];\n uniform vec3 uClipObjectScale[dClipObjectCount];\n#endif\n#include common_clip\n\n#include read_from_texture\n#include texture3d_from_1d_trilinear\n#include texture3d_from_2d_nearest\n#include texture3d_from_2d_linear\n\nuniform mat4 uProjection, uTransform, uModelView, uModel, uView;\nuniform vec3 uCameraDir;\n\nuniform sampler2D tDepth;\nuniform vec2 uDrawingBufferSize;\n\nvarying vec3 vOrigPos;\nvarying float vInstance;\nvarying vec4 vBoundingSphere;\nvarying mat4 vTransform;\n\nuniform mat4 uInvView;\nuniform vec3 uGridDim;\nuniform vec3 uBboxSize;\nuniform sampler2D tTransferTex;\nuniform float uTransferScale;\nuniform float uStepScale;\nuniform float uJumpLength;\n\nuniform int uObjectId;\nuniform int uVertexCount;\nuniform int uInstanceCount;\nuniform int uGroupCount;\n\n#if defined(dColorMarker)\n uniform vec3 uHighlightColor;\n uniform vec3 uSelectColor;\n uniform vec3 uDimColor;\n uniform float uHighlightStrength;\n uniform float uSelectStrength;\n uniform float uDimStrength;\n uniform int uMarkerPriority;\n uniform float uMarkerAverage;\n\n uniform float uMarker;\n uniform vec2 uMarkerTexDim;\n uniform sampler2D tMarker;\n#endif\n\nuniform float uMetalness;\nuniform float uRoughness;\n\nuniform bool uFog;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\n\nuniform float uAlpha;\nuniform bool uTransparentBackground;\nuniform float uXrayEdgeFalloff;\nuniform float uExposure;\n\nuniform int uRenderMask;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uIsOrtho;\n\nuniform vec3 uCellDim;\nuniform vec3 uCameraPosition;\nuniform mat4 uCartnToUnit;\n\n#if __VERSION__ != 100\n // for webgl1 this is given as a 'define'\n uniform int uMaxSteps;\n#endif\n\n#if defined(dGridTexType_2d)\n precision highp sampler2D;\n uniform sampler2D tGridTex;\n uniform vec3 uGridTexDim;\n#elif defined(dGridTexType_3d)\n precision highp sampler3D;\n uniform sampler3D tGridTex;\n#endif\n\n#if defined(dColorType_uniform)\n uniform vec3 uColor;\n#elif defined(dColorType_texture)\n uniform vec2 uColorTexDim;\n uniform sampler2D tColor;\n#endif\n\n#ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance) || defined(dOverpaintType_vertexInstance)\n uniform vec2 uOverpaintTexDim;\n uniform sampler2D tOverpaint;\n #endif\n#endif\n\n#ifdef dUsePalette\n uniform sampler2D tPalette;\n#endif\n\n#if defined(dGridTexType_2d)\n vec4 textureVal(vec3 pos) {\n return texture3dFrom2dLinear(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n }\n vec4 textureGroup(vec3 pos) {\n return texture3dFrom2dNearest(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n }\n#elif defined(dGridTexType_3d)\n vec4 textureVal(vec3 pos) {\n return texture(tGridTex, pos + (vec3(0.5) / uGridDim));\n }\n vec4 textureGroup(vec3 pos) {\n return texelFetch(tGridTex, ivec3(pos * uGridDim), 0);\n }\n#endif\n\nfloat calcDepth(const in vec3 pos) {\n vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;\n return 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\n\nfloat transferFunction(float value) {\n return texture2D(tTransferTex, vec2(value, 0.0)).a;\n}\n\nfloat getDepth(const in vec2 coords) {\n #ifdef depthTextureSupport\n return texture2D(tDepth, coords).r;\n #else\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n #endif\n}\n\nconst float gradOffset = 0.5;\n\nvec3 v3m4(vec3 p, mat4 m) {\n return (m * vec4(p, 1.0)).xyz;\n}\n\nfloat preFogAlphaBlended = 0.0;\n\nvec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {\n mat3 normalMatrix = transpose3(inverse3(mat3(uModelView * vTransform)));\n mat4 cartnToUnit = uCartnToUnit * inverse4(vTransform);\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n mat4 modelTransform = uModel * vTransform * uTransform;\n #endif\n mat4 modelViewTransform = uModelView * vTransform * uTransform;\n\n vec3 scaleVol = vec3(1.0) / uGridDim;\n vec3 pos = startLoc;\n vec4 cell;\n float prevValue = -1.0;\n float value = 0.0;\n vec4 src = vec4(0.0);\n vec4 dst = vec4(0.0);\n float fragmentDepth;\n\n vec3 posMin = vec3(0.0);\n vec3 posMax = vec3(1.0) - vec3(1.0) / uGridDim;\n\n vec3 unitPos;\n\n vec3 nextPos;\n float nextValue;\n\n vec4 material;\n vec4 overpaint;\n float metalness = uMetalness;\n float roughness = uRoughness;\n\n vec3 gradient = vec3(1.0);\n vec3 dx = vec3(gradOffset * scaleVol.x, 0.0, 0.0);\n vec3 dy = vec3(0.0, gradOffset * scaleVol.y, 0.0);\n vec3 dz = vec3(0.0, 0.0, gradOffset * scaleVol.z);\n\n float maxDist = min(vBoundingSphere.w * 2.0, uFar - uNear);\n float maxDistSq = maxDist * maxDist;\n\n for (int i = 0; i < uMaxSteps; ++i) {\n // break when beyond bounding-sphere or far-plane\n vec3 distVec = startLoc - pos;\n if (dot(distVec, distVec) > maxDistSq) break;\n\n unitPos = v3m4(pos, cartnToUnit);\n\n // continue when outside of grid\n if (unitPos.x > posMax.x || unitPos.y > posMax.y || unitPos.z > posMax.z ||\n unitPos.x < posMin.x || unitPos.y < posMin.y || unitPos.z < posMin.z\n ) {\n prevValue = value;\n pos += step;\n continue;\n }\n\n cell = textureVal(unitPos);\n value = cell.a; // current voxel value\n\n if (uJumpLength > 0.0 && value < 0.01) {\n nextPos = pos + rayDir * uJumpLength;\n nextValue = textureVal(v3m4(nextPos, cartnToUnit)).a;\n if (nextValue < 0.01) {\n prevValue = nextValue;\n pos = nextPos;\n continue;\n }\n }\n\n vec4 mvPosition = modelViewTransform * vec4(unitPos * uGridDim, 1.0);\n if (calcDepth(mvPosition.xyz) > getDepth(gl_FragCoord.xy / uDrawingBufferSize))\n break;\n\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n vec3 vModelPosition = v3m4(unitPos * uGridDim, modelTransform);\n if (clipTest(vec4(vModelPosition, 0.0))) {\n prevValue = value;\n pos += step;\n continue;\n }\n #endif\n\n vec3 vViewPosition = mvPosition.xyz;\n material.a = transferFunction(value);\n\n #ifdef dPackedGroup\n float group = unpackRGBToInt(textureGroup(floor(unitPos * uGridDim + 0.5) / uGridDim).rgb);\n #else\n vec3 g = floor(unitPos * uGridDim + 0.5);\n // note that we swap x and z because the texture is flipped around y\n #if defined(dAxisOrder_012)\n float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y; // 210\n #elif defined(dAxisOrder_021)\n float group = g.y + g.z * uGridDim.y + g.x * uGridDim.y * uGridDim.z; // 120\n #elif defined(dAxisOrder_102)\n float group = g.z + g.x * uGridDim.z + g.y * uGridDim.z * uGridDim.x; // 201\n #elif defined(dAxisOrder_120)\n float group = g.x + g.z * uGridDim.x + g.y * uGridDim.x * uGridDim.z; // 021\n #elif defined(dAxisOrder_201)\n float group = g.y + g.x * uGridDim.y + g.z * uGridDim.y * uGridDim.x; // 102\n #elif defined(dAxisOrder_210)\n float group = g.x + g.y * uGridDim.x + g.z * uGridDim.x * uGridDim.y; // 012\n #endif\n #endif\n\n #if defined(dColorType_direct) && defined(dUsePalette)\n material.rgb = texture2D(tPalette, vec2(value, 0.0)).rgb;\n #elif defined(dColorType_uniform)\n material.rgb = uColor;\n #elif defined(dColorType_instance)\n material.rgb = readFromTexture(tColor, vInstance, uColorTexDim).rgb;\n #elif defined(dColorType_group)\n material.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n #elif defined(dColorType_groupInstance)\n material.rgb = readFromTexture(tColor, vInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n #elif defined(dColorType_vertex)\n material.rgb = texture3dFrom1dTrilinear(tColor, unitPos, uGridDim, uColorTexDim, 0.0).rgb;\n #elif defined(dColorType_vertexInstance)\n material.rgb = texture3dFrom1dTrilinear(tColor, unitPos, uGridDim, uColorTexDim, vInstance * float(uVertexCount)).rgb;\n #endif\n\n #ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance)\n overpaint = readFromTexture(tOverpaint, vInstance * float(uGroupCount) + group, uOverpaintTexDim);\n #elif defined(dOverpaintType_vertexInstance)\n overpaint = texture3dFrom1dTrilinear(tOverpaint, unitPos, uGridDim, uOverpaintTexDim, vInstance * float(uVertexCount));\n #endif\n\n material.rgb = mix(material.rgb, overpaint.rgb, overpaint.a);\n #endif\n\n #ifdef dIgnoreLight\n gl_FragColor.rgb = material.rgb;\n #else\n if (material.a >= 0.01) {\n #ifdef dPackedGroup\n // compute gradient by central differences\n gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a;\n gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a;\n gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a;\n #else\n gradient = cell.xyz * 2.0 - 1.0;\n #endif\n vec3 normal = -normalize(normalMatrix * normalize(gradient));\n #include apply_light_color\n } else {\n gl_FragColor.rgb = material.rgb;\n }\n #endif\n\n gl_FragColor.a = material.a * uAlpha * uTransferScale;\n\n #if defined(dColorMarker)\n float marker = uMarker;\n if (uMarker == -1.0) {\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n #endif\n #include apply_marker_color\n\n preFogAlphaBlended = (1.0 - preFogAlphaBlended) * gl_FragColor.a + preFogAlphaBlended;\n fragmentDepth = calcDepth(mvPosition.xyz);\n #include apply_fog\n\n src = gl_FragColor;\n\n if (!uTransparentBackground) {\n // done in 'apply_fog' otherwise\n src.rgb *= src.a;\n }\n dst = (1.0 - dst.a) * src + dst; // standard blending\n\n // break if the color is opaque enough\n if (dst.a > 0.95)\n break;\n\n pos += step;\n }\n\n return dst;\n}\n\n// TODO: support float texture for higher precision values???\n// TODO: support clipping exclusion texture support\n\nvoid main() {\n if (gl_FrontFacing)\n discard;\n\n vec3 rayDir = mix(normalize(vOrigPos - uCameraPosition), uCameraDir, uIsOrtho);\n vec3 step = rayDir * uStepScale;\n\n float boundingSphereNear = distance(vBoundingSphere.xyz, uCameraPosition) - vBoundingSphere.w;\n float d = max(uNear, boundingSphereNear) - mix(0.0, distance(vOrigPos, uCameraPosition), uIsOrtho);\n vec3 start = mix(uCameraPosition, vOrigPos, uIsOrtho) + (d * rayDir);\n gl_FragColor = raymarch(start, step, rayDir);\n\n float fragmentDepth = calcDepth((uModelView * vec4(start, 1.0)).xyz);\n float preFogAlpha = clamp(preFogAlphaBlended, 0.0, 1.0);\n #include wboit_write\n}\n",{fragDepth:"optional",drawBuffers:"optional"},{},lS),_Ge=Br("image","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_vert_params\n\nattribute vec3 aPosition;\nattribute vec2 aUv;\nattribute mat4 aTransform;\nattribute float aInstance;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\nvoid main() {\n #include assign_position\n\n vUv = aUv;\n vInstance = aInstance;\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_frag_params\n#include common_clip\n\nuniform vec2 uImageTexDim;\nuniform sampler2D tImageTex;\nuniform sampler2D tGroupTex;\n\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\n#if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell) || defined(dInterpolation_bspline)\n #define dInterpolation_cubic\n#endif\n\n#if defined(dInterpolation_cubic)\n #if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell)\n #if defined(dInterpolation_catmulrom)\n const float B = 0.0;\n const float C = 0.5;\n #elif defined(dInterpolation_mitchell)\n const float B = 0.333;\n const float C = 0.333;\n #endif\n\n float cubicFilter(float x){\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f < 1.0) {\n return ((12.0 - 9.0 * B - 6.0 * C) * (f * f * f) +\n (-18.0 + 12.0 * B + 6.0 * C) * (f * f) +\n (6.0 - 2.0 * B)) / 6.0;\n }else if (f >= 1.0 && f < 2.0){\n return ((-B - 6.0 * C) * ( f * f * f)\n + (6.0 * B + 30.0 * C) * (f * f) +\n (-(12.0 * B) - 48.0 * C) * f +\n 8.0 * B + 24.0 * C) / 6.0;\n }else{\n return 0.0;\n }\n }\n #elif defined(dInterpolation_bspline)\n float cubicFilter(float x) {\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f >= 0.0 && f <= 1.0){\n return (2.0 / 3.0) + (0.5) * (f * f * f) - (f * f);\n } else if (f > 1.0 && f <= 2.0) {\n return 1.0 / 6.0 * pow((2.0 - f), 3.0);\n }\n return 1.0;\n }\n #endif\n\n vec4 biCubic(sampler2D tex, vec2 texCoord) {\n vec2 texelSize = 1.0 / uImageTexDim;\n texCoord -= texelSize / 2.0;\n vec4 nSum = vec4(0.0);\n float nDenom = 0.0;\n vec2 cell = fract(texCoord * uImageTexDim);\n for (float m = -1.0; m <= 2.0; ++m) {\n for (float n = -1.0; n <= 2.0; ++n) {\n vec4 vecData = texture2D(tex, texCoord + texelSize * vec2(m, n));\n float c = cubicFilter(m - cell.x) * cubicFilter(-n + cell.y);\n nSum += vecData * c;\n nDenom += c;\n }\n }\n return nSum / nDenom;\n }\n#endif\n\nvoid main() {\n #include fade_lod\n #include clip_pixel\n\n #if defined(dInterpolation_cubic)\n vec4 imageData = biCubic(tImageTex, vUv);\n #else\n vec4 imageData = texture2D(tImageTex, vUv);\n #endif\n imageData.a = clamp(imageData.a, 0.0, 1.0);\n if (imageData.a > 0.9) imageData.a = 1.0;\n\n float fragmentDepth = gl_FragCoord.z;\n\n #if defined(dRenderVariant_pick)\n if (imageData.a < 0.3)\n discard;\n #ifdef requiredDrawBuffers\n gl_FragColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n gl_FragData[1] = vec4(packIntToRGB(vInstance), 1.0);\n gl_FragData[2] = vec4(texture2D(tGroupTex, vUv).rgb, 1.0);\n gl_FragData[3] = packDepthToRGBA(gl_FragCoord.z);\n #else\n gl_FragColor = vColor;\n if (uPickType == 1) {\n gl_FragColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n gl_FragColor = vec4(packIntToRGB(vInstance), 1.0);\n } else {\n gl_FragColor = vec4(texture2D(tGroupTex, vUv).rgb, 1.0);\n }\n #endif\n #elif defined(dRenderVariant_depth)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n #elif defined(dRenderVariant_marking)\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n if (uMarkingType == 1) {\n if (marker > 0.0 || imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n } else {\n if (marker == 0.0 || imageData.a < 0.05)\n discard;\n float depthTest = 1.0;\n if (uMarkingDepthTest) {\n depthTest = (fragmentDepth >= getDepthPacked(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;\n }\n bool isHighlight = intMod(marker, 2.0) > 0.1;\n gl_FragColor = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0);\n }\n #elif defined(dRenderVariant_color)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = imageData;\n gl_FragColor.a *= uAlpha;\n\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #endif\n}\n",{drawBuffers:"optional"},{},hD);function Are(e,t){var n;if(void 0===e)return"";const r=(null===(n=e.dRenderVariant)||void 0===n?void 0:n.ref.value)||"",i=[];for(const o in e){if(t?.(o,r,e))continue;const a=e[o].ref.value;void 0!==a&&("string"==typeof a?i.push(`#define ${o}_${a}`):"number"==typeof a?i.push(`#define ${o} ${a}`):"boolean"==typeof a?a&&i.push(`#define ${o}`):Rr())}return i.join("\n")+"\n"}const CGe="\n#define attribute in\n#define varying out\n#define texture2D texture\n",wGe="\n#define varying in\n#define texture2D texture\n#define textureCube texture\n#define texture2DLodEXT textureLod\n#define textureCubeLodEXT textureLod\n\n#define gl_FragColor out_FragData0\n#define gl_FragDepthEXT gl_FragDepth\n\n#define depthTextureSupport\n";function EGe(e,t){switch(t){case"b":case"b[]":return e.BOOL;case"f":case"f[]":return e.FLOAT;case"i":case"i[]":return e.INT;case"v2":case"v2[]":return e.FLOAT_VEC2;case"v3":case"v3[]":return e.FLOAT_VEC3;case"v4":case"v4[]":return e.FLOAT_VEC4;case"iv2":case"iv2[]":return e.INT_VEC2;case"iv3":case"iv3[]":return e.INT_VEC3;case"iv4":case"iv4[]":return e.INT_VEC4;case"m3":case"m3[]":return e.FLOAT_MAT3;case"m4":case"m4[]":return e.FLOAT_MAT4;default:console.error(`unknown uniform kind '${t}'`)}}function MGe(e,t,n){e.uniform1f(t,n)}function RGe(e,t,n){e.uniform1fv(t,n)}function kGe(e,t,n){e.uniform1i(t,n)}function NGe(e,t,n){e.uniform1iv(t,n)}function FGe(e,t,n){e.uniform2fv(t,n)}function BGe(e,t,n){e.uniform3fv(t,n)}function OGe(e,t,n){e.uniform4fv(t,n)}function LGe(e,t,n){e.uniform2iv(t,n)}function UGe(e,t,n){e.uniform3iv(t,n)}function VGe(e,t,n){e.uniform4iv(t,n)}function zGe(e,t,n){e.uniformMatrix3fv(t,!1,n)}function GGe(e,t,n){e.uniformMatrix4fv(t,!1,n)}function Ire(e){switch(e){case"f":return MGe;case"f[]":return RGe;case"i":case"t":case"b":return kGe;case"i[]":case"t[]":case"b[]":return NGe;case"v2":case"v2[]":return FGe;case"v3":case"v3[]":return BGe;case"v4":case"v4[]":return OGe;case"iv2":case"iv2[]":return LGe;case"iv3":case"iv3[]":return UGe;case"iv4":case"iv4[]":return VGe;case"m3":case"m3[]":return zGe;case"m4":case"m4[]":return GGe}}const qGe=pa();function WL(e){const t=e.createBuffer();if(null===t)throw new Error("Could not create WebGL buffer");return t}function Tre(e,t,n,r){let i=WL(e);const o=function WGe(e,t){switch(t){case"static":return e.STATIC_DRAW;case"dynamic":return e.DYNAMIC_DRAW;case"stream":return e.STREAM_DRAW}}(e,n),s=function YGe(e,t){switch(t){case"attribute":return e.ARRAY_BUFFER;case"elements":return e.ELEMENT_ARRAY_BUFFER;case"uniform":if(Wt(e))return e.UNIFORM_BUFFER;throw new Error("WebGL2 is required for uniform buffers")}}(e,r),a=function $Ge(e,t){return t instanceof Uint8Array?e.UNSIGNED_BYTE:t instanceof Int8Array?e.BYTE:t instanceof Uint16Array?e.UNSIGNED_SHORT:t instanceof Int16Array?e.SHORT:t instanceof Uint32Array?e.UNSIGNED_INT:t instanceof Int32Array?e.INT:t instanceof Float32Array?e.FLOAT:void Rr()}(e,t),c=t.BYTES_PER_ELEMENT,u=t.length;function l(f){e.bindBuffer(s,i),e.bufferData(s,f,o)}l(t);let d=!1;return{id:qGe(),_usageHint:o,_bufferType:s,_dataType:a,_bpe:c,length:u,getBuffer:()=>i,updateData:l,updateSubData:(f,p,m)=>{e.bindBuffer(s,i),m-p===f.length?e.bufferSubData(s,0,f):e.bufferSubData(s,p*c,f.subarray(p,p+m))},reset:()=>{i=WL(e),l(t)},destroy:()=>{d||(e.deleteBuffer(i),d=!0)}}}function XGe(e,t,n){if("float32"===t)switch(n){case 1:return e.FLOAT;case 2:return e.FLOAT_VEC2;case 3:return e.FLOAT_VEC3;case 4:return e.FLOAT_VEC4;case 16:return e.FLOAT_MAT4}Rr()}const JGe=pa();function $L(e){const t=e.createProgram();if(null===t)throw new Error("Could not create WebGL program");return t}function i9e(e,t,n,r,i){const{defineValues:o,shaderCode:s,schema:a}=i;let c=$L(e);const u=JGe(),l=function DGe(e,t,n,r){const i=Are(n,r.ignoreDefine),o=Are(n,r.ignoreDefine),s=Wt(e)?function AGe(e,t){const n=["#version 300 es"];if(t.drawBuffers&&e.drawBuffers&&n.push("#define requiredDrawBuffers"),t.multiDraw)if(e.multiDraw)n.push("#extension GL_ANGLE_multi_draw : require"),n.push("#define enabledMultiDraw");else if("required"===t.multiDraw)throw new Error("required 'GL_ANGLE_multi_draw' extension not available");if(t.clipCullDistance)if(e.clipCullDistance)n.push("#extension GL_ANGLE_clip_cull_distance : enable"),n.push("#define enabledClipCullDistance");else if("required"===t.clipCullDistance)throw new Error("required 'GL_ANGLE_clip_cull_distance' extension not available");if(t.conservativeDepth)if(e.conservativeDepth)n.push("#extension GL_EXT_conservative_depth : enable"),n.push("#define enabledConservativeDepth");else if("required"===t.conservativeDepth)throw new Error("required 'GL_EXT_conservative_depth' extension not available");return e.noNonInstancedActiveAttribs&&n.push("#define noNonInstancedActiveAttribs"),n.push(CGe),n.join("\n")+"\n"}(t,r.extensions):function xGe(e,t){const n=[];if(t.drawBuffers)if(e.drawBuffers)n.push("#define requiredDrawBuffers");else if("required"===t.drawBuffers)throw new Error("required 'GL_EXT_draw_buffers' extension not available");if(t.multiDraw)if(e.multiDraw)n.push("#extension GL_ANGLE_multi_draw : require"),n.push("#define enabledMultiDraw");else if("required"===t.multiDraw)throw new Error("required 'GL_ANGLE_multi_draw' extension not available");return n.join("\n")+"\n"}(t,r.extensions),a=Wt(e)?function IGe(e,t,n,r){const i=["#version 300 es",`layout(location = 0) out highp ${r[0]||"vec4"} out_FragData0;`];if(n.fragDepth&&t.fragDepth&&i.push("#define enabledFragDepth"),n.drawBuffers&&t.drawBuffers){i.push("#define requiredDrawBuffers");for(let s=1,a=e.getParameter(e.MAX_DRAW_BUFFERS);s{const o=n[i];if("attribute"===o.type){const s=e.getAttribLocation(t,i);r[i]=s}else if("uniform"===o.type){let s=e.getUniformLocation(t,i);null===s&&function PGe(e){return e.endsWith("[]")}(o.kind)&&(s=e.getUniformLocation(t,i+"[0]")),r[i]=s}else if("texture"===o.type){const s=e.getUniformLocation(t,i);r[i]=s}}),r}(e,c,a),m=function jGe(e){const t={};return Object.keys(e).forEach(n=>{const r=e[n];"uniform"===r.type?t[n]=Ire(r.kind):"texture"===r.type&&(t[n]=Ire("t"))}),t}(a),un&&(function t9e(e,t,n){const r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i{t.currentProgramId=u,e.useProgram(c)},setUniforms:y=>{for(let b=0,x=y.length;b{const x=p[y];null!==x&&m[y](e,x,b)},bindAttributes:y=>{t.clearVertexAttribsState();for(let b=0,x=y.length;b{for(let x=0,_=y.length;x<_;++x){const[S,A]=y[x],E=p[S];-1!==E&&A.changeOffset(E,b)}},bindTextures:(y,b)=>{for(let x=0,_=y.length;x<_;++x){const[S,A]=y[x],E=p[S];null!=E&&(A.bind(x+b),m[S](e,E,x+b))}},reset:()=>{c=$L(e),h()},destroy:()=>{g||(d.destroy(),f.destroy(),e.deleteProgram(c),g=!0)}}}const o9e=pa();function mD(e,t){const{type:n,source:r}=t,i=e.createShader("vert"===n?e.VERTEX_SHADER:e.FRAGMENT_SHADER);if(null===i)throw new Error(`Error creating ${n} shader`);if(e.shaderSource(i,r),e.compileShader(i),un&&!1===e.getShaderParameter(i,e.COMPILE_STATUS))throw console.warn(`'${n}' shader info log '${e.getShaderInfoLog(i)}'\n${function s9e(e){const t=e.split("\n");for(let n=0;n{const o=e(i);let s=r.get(o);return s||(s=function c9e(e,t=0){return{value:e,usageCount:t}}(t(i)),r.set(o,s)),s.usageCount+=1,function u9e(e){return{free:()=>{e.usageCount-=1},value:e.value}}(s)},clear:()=>{r.forEach((i,o)=>{i.usageCount<=0&&(i.usageCount<0&&console.warn("Reference usageCount below zero."),n(i.value),r.delete(o))})},get count(){return r.size},dispose:()=>{r.forEach(i=>n(i.value)),r.clear()}}}const l9e=pa();function Ere(e){const t=e.createRenderbuffer();if(null===t)throw new Error("Could not create WebGL renderbuffer");return t}const h9e=pa();function Pre(e){const{vertexArrayObject:t}=e;if(!t)throw new Error("VertexArrayObject not supported");const n=t.createVertexArray();if(!n)throw new Error("Could not create WebGL vertex array");return n}function Mre(e){const{vertexArrayObject:t}=e;if(null===t)throw new Error("VertexArrayObject not supported");return t}function Rre(e){return{...e.value,destroy:()=>{e.free()}}}function y9e(e,t,n,r){const i={attribute:new Set,elements:new Set,framebuffer:new Set,program:new Set,renderbuffer:new Set,shader:new Set,texture:new Set,cubeTexture:new Set,vertexArray:new Set};function o(u,l){return i[u].add(l),n.resourceCounts[u]+=1,{...l,destroy:()=>{l.destroy(),i[u].delete(l),n.resourceCounts[u]-=1}}}const s=Dre(u=>JSON.stringify(u),u=>o("shader",function a9e(e,t){let n=mD(e,t);return{id:o9e(),attach:r=>{e.attachShader(r,n)},reset:()=>{n=mD(e,t)},destroy:()=>{e.deleteShader(n)}}}(e,u)),u=>{u.destroy()});function a(u,l){return Rre(s.get({type:u,source:l}))}const c=Dre(u=>{var l;const d=[u.shaderCode.id],f=(null===(l=u.defineValues.dRenderVariant)||void 0===l?void 0:l.ref.value)||"";return Object.keys(u.defineValues).forEach(p=>{var m,h;null!==(h=(m=u.shaderCode).ignoreDefine)&&void 0!==h&&h.call(m,p,f,u.defineValues)||d.push(aB(p),function g9e(e){return"boolean"==typeof e?e?1:0:"number"==typeof e?1e4*e:aB(e)}(u.defineValues[p].ref.value))}),ha(d).toString()},u=>o("program",i9e(e,t,r,a,u)),u=>{u.destroy()});return{attribute:(u,l,d,f)=>o("attribute",function KGe(e,t,n,r,i,o,s="static"){const{instancedArrays:a}=n,c=Tre(e,r,s,"attribute"),{_bufferType:u,_dataType:l,_bpe:d}=c;return{...c,divisor:o,bind:f=>{if(e.bindBuffer(u,c.getBuffer()),16===i)for(let p=0;p<4;++p)t.enableVertexAttrib(f+p),e.vertexAttribPointer(f+p,4,l,!1,16*d,4*p*d),a.vertexAttribDivisor(f+p,o);else t.enableVertexAttrib(f),e.vertexAttribPointer(f,i,l,!1,0,0),a.vertexAttribDivisor(f,o)},changeOffset:(f,p)=>{const m=p*d*i;if(e.bindBuffer(u,c.getBuffer()),16===i)for(let h=0;h<4;++h)e.vertexAttribPointer(f+h,4,l,!1,16*d,4*h*d+m);else e.vertexAttribPointer(f,i,l,!1,0,m)}}}(e,t,r,u,l,d,f)),elements:(u,l)=>o("elements",function QGe(e,t,n="static"){const r=Tre(e,t,n,"elements");return{...r,bind:()=>{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.getBuffer())}}}(e,u,l)),framebuffer:()=>o("framebuffer",function a7e(e){let t=vre(e),n=!1;return{id:bre(),bind:()=>e.bindFramebuffer(e.FRAMEBUFFER,t),reset:()=>{t=vre(e)},destroy:()=>{n||(e.deleteFramebuffer(t),n=!0)}}}(e)),program:(u,l,d)=>Rre(c.get({defineValues:u,shaderCode:l,schema:d})),renderbuffer:(u,l,d,f)=>o("renderbuffer",function p9e(e,t,n,r,i){let o=Ere(e);const s=()=>e.bindRenderbuffer(e.RENDERBUFFER,o),a=function d9e(e,t){switch(t){case"depth16":return e.DEPTH_COMPONENT16;case"stencil8":return e.STENCIL_INDEX8;case"rgba4":return e.RGBA4;case"depth-stencil":return e.DEPTH_STENCIL;case"depth24":if(Wt(e))return e.DEPTH_COMPONENT24;throw new Error("WebGL2 needed for `depth24` renderbuffer format");case"depth32f":if(Wt(e))return e.DEPTH_COMPONENT32F;throw new Error("WebGL2 needed for `depth32f` renderbuffer format");case"depth24-stencil8":if(Wt(e))return e.DEPTH24_STENCIL8;throw new Error("WebGL2 needed for `depth24-stencil8` renderbuffer format");case"depth32f-stencil8":if(Wt(e))return e.DEPTH32F_STENCIL8;throw new Error("WebGL2 needed for `depth32f-stencil8` renderbuffer format")}}(e,t),c=function f9e(e,t){switch(t){case"depth":return e.DEPTH_ATTACHMENT;case"stencil":return e.STENCIL_ATTACHMENT;case"depth-stencil":return e.DEPTH_STENCIL_ATTACHMENT;case"color0":return e.COLOR_ATTACHMENT0}}(e,n);function u(){s(),e.renderbufferStorage(e.RENDERBUFFER,a,r,i)}u();let l=!1;return{id:l9e(),bind:s,attachFramebuffer:d=>{d.bind(),s(),e.framebufferRenderbuffer(e.FRAMEBUFFER,c,e.RENDERBUFFER,o),un&&pD(e)},detachFramebuffer:d=>{d.bind(),s(),e.framebufferRenderbuffer(e.FRAMEBUFFER,c,e.RENDERBUFFER,null),un&&pD(e)},setSize:(d,f)=>{r=d,i=f,u()},reset:()=>{o=Ere(e),u()},destroy:()=>{l||(e.deleteRenderbuffer(o),l=!0)}}}(e,u,l,d,f)),shader:a,texture:(u,l,d,f)=>o("texture",function mje(e,t,n,r,i,o){const s=XL();let a=Xre(e);if(n.endsWith("float32")&&"float"!==i||n.endsWith("float16")&&"fp16"!==i||n.endsWith("uint8")&&"ubyte"!==i||n.endsWith("int32")&&"int"!==i||n.endsWith("depth")&&"ushort"!==i&&"float"!==i)throw new Error(`texture kind '${n}' and type '${i}' are incompatible`);if(!t.depthTexture&&"depth"===r)throw new Error("extension 'WEBGL_depth_texture' needed for 'depth' texture format");const c=function uje(e,t){switch(t){case"image-uint8":case"image-float32":case"image-float16":case"image-depth":return e.TEXTURE_2D}if(Wt(e))switch(t){case"image-int32":return e.TEXTURE_2D;case"volume-uint8":case"volume-float32":case"volume-float16":return e.TEXTURE_3D}throw new Error(`unknown texture kind '${t}'`)}(e,n),u=Wre(e,o),l=Hre(e,r,i),d=function lje(e,t,n){if(Wt(e))switch(t){case"alpha":switch(n){case"ubyte":return e.ALPHA;case"float":return e.R32F;case"fp16":return e.R16F;case"int":return e.R32I}case"rg":switch(n){case"ubyte":return e.RG;case"float":return e.RG32F;case"fp16":return e.RG16F;case"int":return e.RG32I}case"rgb":switch(n){case"ubyte":return e.RGB;case"float":return e.RGB32F;case"fp16":return e.RGB16F;case"int":return e.RGB32I}case"rgba":switch(n){case"ubyte":return e.RGBA;case"float":return e.RGBA32F;case"fp16":return e.RGBA16F;case"int":return e.RGBA32I}case"depth":switch(n){case"ushort":return e.DEPTH_COMPONENT16;case"float":return e.DEPTH_COMPONENT32F}}return Hre(e,t,n)}(e,r,i),f=function pje(e,t,n){switch(n){case"ubyte":return e.UNSIGNED_BYTE;case"ushort":return e.UNSIGNED_SHORT;case"float":return e.FLOAT;case"fp16":if(t.textureHalfFloat)return t.textureHalfFloat.HALF_FLOAT;throw new Error('extension "texture_half_float" unavailable');case"int":if(Wt(e))return e.INT;throw new Error('texture type "int" requires webgl2')}}(e,t,i);function p(){e.bindTexture(c,a),e.texParameteri(c,e.TEXTURE_MAG_FILTER,u),e.texParameteri(c,e.TEXTURE_MIN_FILTER,u),e.texParameteri(c,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(c,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(c,null)}p();let y,m=0,h=0,g=0,b=!1,x=!1;function _(w,D,I){if(0===w||0===D||Wt(e)&&c===e.TEXTURE_3D&&0===I)throw new Error("empty textures are not allowed");if(m!==w||h!==D||g!==(I||0))if(m=w,h=D,g=I||0,e.bindTexture(c,a),c===e.TEXTURE_2D)e.texImage2D(c,0,d,m,h,0,l,f,null);else{if(!Wt(e)||c!==e.TEXTURE_3D||void 0===g)throw new Error("unknown texture target");e.texImage3D(c,0,d,m,h,g,0,l,f,null)}}function S(w,D=!1){if(0===w.width||0===w.height||!$re(w)&&Wt(e)&&Yre(0,c,e)&&0===w.depth)throw new Error("empty textures are not allowed");if(e.bindTexture(c,a),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),$re(w))m=w.width,h=w.height,e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.bindTexture(e.TEXTURE_2D,a),e.texImage2D(e.TEXTURE_2D,0,d,l,f,w);else if(function hje(e,t,n){return t===n.TEXTURE_2D}(0,c,e)){const I=w.filter?Wre(e,w.filter):u;e.texParameteri(c,e.TEXTURE_MAG_FILTER,I),e.texParameteri(c,e.TEXTURE_MIN_FILTER,I),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!!w.flipY),D?e.texSubImage2D(c,0,0,0,w.width,w.height,l,f,w.array):(m=w.width,h=w.height,e.texImage2D(c,0,d,m,h,0,l,f,w.array))}else{if(!Wt(e)||!Yre(0,c,e))throw new Error("unknown texture target");e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),D?e.texSubImage3D(c,0,0,0,0,w.width,w.height,w.depth,l,f,w.array):(m=w.width,h=w.height,g=w.depth,e.texImage3D(c,0,d,m,h,g,0,l,f,w.array))}e.bindTexture(c,null),y=w}function A(){if(c!==e.TEXTURE_2D)throw new Error("mipmap only supported for 2d textures");if(!(Wt(e)||$x(m)&&$x(h)))throw new Error("mipmap unsupported for non-power-of-two textures and webgl1");e.bindTexture(c,a),e.texParameteri(c,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.generateMipmap(c),e.bindTexture(c,null),b=!0}return _(1,1,Wt(e)&&c===e.TEXTURE_3D?1:0),{id:s,target:c,format:l,internalFormat:d,type:f,filter:u,getWidth:()=>m,getHeight:()=>h,getDepth:()=>g,getByteCount:()=>qre(r,i,m,h,g),define:_,load:S,mipmap:A,bind:w=>{e.activeTexture(e.TEXTURE0+w),e.bindTexture(c,a)},unbind:w=>{e.activeTexture(e.TEXTURE0+w),e.bindTexture(c,null)},attachFramebuffer:function E(w,D,I){if(w.bind(),c===e.TEXTURE_2D)e.framebufferTexture2D(e.FRAMEBUFFER,yD(e,t,D),e.TEXTURE_2D,a,0);else{if(!Wt(e)||c!==e.TEXTURE_3D)throw new Error("unknown/unsupported texture target");if(void 0===I)throw new Error("need `layer` to attach 3D texture");e.framebufferTextureLayer(e.FRAMEBUFFER,yD(e,t,D),a,0,I)}},detachFramebuffer:(w,D)=>{if(w.bind(),c===e.TEXTURE_2D)e.framebufferTexture2D(e.FRAMEBUFFER,yD(e,t,D),e.TEXTURE_2D,null,0);else{if(!Wt(e)||c!==e.TEXTURE_3D)throw new Error("unknown texture target");e.framebufferTextureLayer(e.FRAMEBUFFER,yD(e,t,D),null,0,0)}},reset:()=>{a=Xre(e),p();const[w,D,I]=[m,h,g];m=0,h=0,g=0,_(w,D,I),y&&S(y),b&&A()},destroy:()=>{x||(e.deleteTexture(a),x=!0)}}}(e,r,u,l,d,f)),cubeTexture:(u,l,d)=>o("cubeTexture",function yje(e,t,n,r){const i=e.TEXTURE_CUBE_MAP,o=e.LINEAR,s=e.RGBA,a=e.RGBA,c=e.UNSIGNED_BYTE;let u=0;const l=e.createTexture();e.bindTexture(i,l);let d=0;$a(t,(p,m)=>{if(!p)return;const g=function gje(e,t){switch(t){case"nx":return e.TEXTURE_CUBE_MAP_NEGATIVE_X;case"ny":return e.TEXTURE_CUBE_MAP_NEGATIVE_Y;case"nz":return e.TEXTURE_CUBE_MAP_NEGATIVE_Z;case"px":return e.TEXTURE_CUBE_MAP_POSITIVE_X;case"py":return e.TEXTURE_CUBE_MAP_POSITIVE_Y;case"pz":return e.TEXTURE_CUBE_MAP_POSITIVE_Z}}(e,m),y=new Image;p instanceof File?y.src=URL.createObjectURL(p):kI(p)?p.then(b=>{y.src=URL.createObjectURL(b)}):y.src=p,y.addEventListener("load",()=>{0===u&&(u=y.width),e.texImage2D(g,0,s,u,u,0,a,c,null),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.bindTexture(i,l),e.texImage2D(g,0,s,a,c,y),d+=1,6===d&&(f||(n?(e.texParameteri(i,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.generateMipmap(i)):e.texParameteri(i,e.TEXTURE_MIN_FILTER,o),e.texParameteri(i,e.TEXTURE_MAG_FILTER,o)),r?.(f))}),y.addEventListener("error",()=>{r?.(!0)})});let f=!1;return{id:XL(),target:i,format:a,internalFormat:s,type:c,filter:o,getWidth:()=>u,getHeight:()=>u,getDepth:()=>0,getByteCount:()=>6*qre("rgba","ubyte",u,u,0)*(n?2:1),define:()=>{},load:()=>{},mipmap:()=>{},bind:p=>{e.activeTexture(e.TEXTURE0+p),e.bindTexture(i,l)},unbind:p=>{e.activeTexture(e.TEXTURE0+p),e.bindTexture(i,null)},attachFramebuffer:()=>{},detachFramebuffer:()=>{},reset:()=>{},destroy:()=>{f||(e.deleteTexture(l),f=!0)}}}(e,u,l,d)),vertexArray:(u,l,d)=>o("vertexArray",function m9e(e,t,n,r,i){const o=h9e();let s=Pre(t),a=Mre(t);function c(){a.bindVertexArray(s),i&&i.bind(),n.bindAttributes(r),a.bindVertexArray(null)}c();let u=!1;return{id:o,bind:()=>{a.bindVertexArray(s)},update:c,reset:()=>{s=Pre(t),a=Mre(t),c()},destroy:()=>{u||(i&&(a.bindVertexArray(s),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)),a.deleteVertexArray(s),u=!0)}}}(e,r,u,l,d)),getByteCounts:()=>{let u=0;i.texture.forEach(f=>{u+=f.getByteCount()}),i.cubeTexture.forEach(f=>{u+=f.getByteCount()});let l=0;i.attribute.forEach(f=>{l+=4*f.length});let d=0;return i.elements.forEach(f=>{d+=4*f.length}),{texture:u,attribute:l,elements:d}},reset:()=>{i.attribute.forEach(u=>u.reset()),i.elements.forEach(u=>u.reset()),i.framebuffer.forEach(u=>u.reset()),i.renderbuffer.forEach(u=>u.reset()),i.shader.forEach(u=>u.reset()),i.program.forEach(u=>u.reset()),i.vertexArray.forEach(u=>u.reset()),i.texture.forEach(u=>u.reset())},destroy:()=>{i.attribute.forEach(u=>u.destroy()),i.elements.forEach(u=>u.destroy()),i.framebuffer.forEach(u=>u.destroy()),i.renderbuffer.forEach(u=>u.destroy()),i.shader.forEach(u=>u.destroy()),i.program.forEach(u=>u.destroy()),i.vertexArray.forEach(u=>u.destroy()),i.texture.forEach(u=>u.destroy()),s.clear(),c.clear()}}}const kre=pa();class Nre{add(t,n){let r=this.avgs.get(t)||n;return r=function _9e(e,t,n){return(e-=e/n)+t/n}(r,n,this.count),this.avgs.set(t,r),r}get(t){return this.avgs.get(t)}stats(){return Object.fromEntries(this.avgs.entries())}constructor(t){this.count=t,this.avgs=new Map}}function Fre(e){e.map(t=>{const n=function w9e(e){const t=`${(e.gpuElapsed/1e3/1e3).toFixed(2)}`,n=`${(e.gpuAvg/1e3/1e3).toFixed(2)}`,r=`${e.cpuElapsed.toFixed(2)}`,i=`${e.cpuAvg.toFixed(2)}`;return`${e.label} ${t} ms (avg. ${n} ms) | CPU: ${r} ms (avg. ${i} ms)`}(t);t.children.length||t.calls?(console.groupCollapsed(n),t.calls&&console.log(t.calls),Fre(t.children),console.groupEnd()):console.log(n)})}function Bre(e,t){switch(t){case e.NO_ERROR:return"no error";case e.INVALID_ENUM:return"invalid enum";case e.INVALID_VALUE:return"invalid value";case e.INVALID_OPERATION:return"invalid operation";case e.INVALID_FRAMEBUFFER_OPERATION:return"invalid framebuffer operation";case e.OUT_OF_MEMORY:return"out of memory";case e.CONTEXT_LOST_WEBGL:return"context lost"}return"unknown error"}function Ore(e){const t=e.getError();if(t!==e.NO_ERROR)throw new Error(`WebGL error: '${Bre(e,t)}'`)}function gD(e){e.bindFramebuffer(e.FRAMEBUFFER,null)}const Lre=new Uint8Array(4);function Ure(e,t,n){e.getSyncParameter(t,e.SYNC_STATUS)===e.SIGNALED?(e.deleteSync(t),n()):Zx.setImmediate(Ure,e,t,n)}function Vre(e,t){const n=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);n?Zx.setImmediate(Ure,e,n,t):(console.warn("Could not create a WebGLSync object"),e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,Lre),t())}let zre=!1;function Gre(e){e.bindFramebuffer(e.FRAMEBUFFER,null),e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,Lre)}function YL(e,t,n,r,i,o){if(un&&pD(e),o instanceof Uint8Array)e.readPixels(t,n,r,i,e.RGBA,e.UNSIGNED_BYTE,o);else if(o instanceof Float32Array)e.readPixels(t,n,r,i,e.RGBA,e.FLOAT,o);else{if(!(o instanceof Int32Array&&Wt(e)))throw new Error("unsupported readPixels buffer type");e.readPixels(t,n,r,i,e.RGBA_INTEGER,e.INT,o)}un&&Ore(e)}function Wt(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext}const sje="\nattribute vec4 aPosition;\n\nvoid main() {\n gl_Position = aPosition;\n}",aje="\nprecision mediump float;\nuniform vec4 uColor;\nuniform sampler2D uTexture;\n\nvoid main() {\n gl_FragColor = texture2D(uTexture, vec2(0.5, 0.5)) * uColor;\n}",cje=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]);function jre(e,t){const n=mD(e,{type:"vert",source:sje}),r=mD(e,{type:"frag",source:aje});if(!n||!r)return!1;const i=$L(e);e.attachShader(i,n),e.attachShader(i,r),e.linkProgram(i),e.useProgram(i);const o=e.getAttribLocation(i,"aPosition"),s=e.getUniformLocation(i,"uColor");if(!s)return un&&console.log("error getting 'uColor' uniform location"),!1;const a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,cje,e.STATIC_DRAW),e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0);const c=e.createTexture(),u=new Uint8Array([255,255,255,255]);e.bindTexture(e.TEXTURE_2D,c),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,u);const l=e.createTexture();e.bindTexture(e.TEXTURE_2D,l),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,t,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);const d=e.createFramebuffer();if(e.bindFramebuffer(e.FRAMEBUFFER,d),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l,0),e.checkFramebufferStatus(e.FRAMEBUFFER)!==e.FRAMEBUFFER_COMPLETE)return un&&console.log(`error creating framebuffer for '${t}'`),!1;e.bindTexture(e.TEXTURE_2D,c),e.uniform4fv(s,[0,10,20,1]),e.drawArrays(e.TRIANGLES,0,6),e.bindTexture(e.TEXTURE_2D,l),e.bindFramebuffer(e.FRAMEBUFFER,null),e.clearColor(1,0,0,1),e.clear(e.COLOR_BUFFER_BIT),e.uniform4fv(s,[0,.1,.05,1]),e.drawArrays(e.TRIANGLES,0,6);const p=new Uint8Array(4);if(e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,p),0!==p[0]||p[1]<248||p[2]<248||p[3]<254)return un&&console.log(`not able to actually render to '${t}' texture`),!1;if(t===e.FLOAT){e.bindFramebuffer(e.FRAMEBUFFER,d);const m=new Float32Array(4);e.readPixels(0,0,1,1,e.RGBA,e.FLOAT,m);const h=e.getError();if(h)return un&&console.log(`error reading float pixels: '${Bre(e,h)}'`),!1}return!0}const XL=pa();function Hre(e,t,n){switch(t){case"alpha":return Wt(e)&&"float"===n?e.RED:Wt(e)&&"int"===n?e.RED_INTEGER:e.ALPHA;case"rgb":return Wt(e)&&"int"===n?e.RGB_INTEGER:e.RGB;case"rg":if(Wt(e)&&"float"===n)return e.RG;if(Wt(e)&&"int"===n)return e.RG_INTEGER;throw new Error('texture format "rg" requires webgl2 and type "float" or int"');case"rgba":return Wt(e)&&"int"===n?e.RGBA_INTEGER:e.RGBA;case"depth":return e.DEPTH_COMPONENT}}function qre(e,t,n,r,i){return function dje(e){switch(e){case"alpha":return 1;case"rg":return 2;case"rgb":return 3;case"rgba":case"depth":return 4}}(e)*function fje(e){switch(e){case"ubyte":return 1;case"ushort":case"fp16":return 2;case"float":case"int":return 4}}(t)*n*r*(i||1)}function Wre(e,t){switch(t){case"nearest":return e.NEAREST;case"linear":return e.LINEAR}}function yD(e,t,n){switch(n){case"depth":return e.DEPTH_ATTACHMENT;case"stencil":return e.STENCIL_ATTACHMENT;case"color0":case 0:return e.COLOR_ATTACHMENT0}if(t.drawBuffers)switch(n){case"color1":case 1:return t.drawBuffers.COLOR_ATTACHMENT1;case"color2":case 2:return t.drawBuffers.COLOR_ATTACHMENT2;case"color3":case 3:return t.drawBuffers.COLOR_ATTACHMENT3;case"color4":case 4:return t.drawBuffers.COLOR_ATTACHMENT4;case"color5":case 5:return t.drawBuffers.COLOR_ATTACHMENT5;case"color6":case 6:return t.drawBuffers.COLOR_ATTACHMENT6;case"color7":case 7:return t.drawBuffers.COLOR_ATTACHMENT7}throw new Error("unknown texture attachment")}function $re(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement}function Yre(e,t,n){return t===n.TEXTURE_3D}function Xre(e){const t=e.createTexture();if(null===t)throw new Error("Could not create WebGL texture");return t}function Kre(e,t,n){const{resources:r}=e,i=[];return Object.keys(t).forEach(o=>{const s=t[o];if("texture"===s.type){const a=n[o];if(a)if("texture"===s.kind)i[i.length]=[o,a.ref.value];else{const c=r.texture(s.kind,s.format,s.dataType,s.filter);c.load(a.ref.value),i[i.length]=[o,c]}}}),i}function Zre(e,t,n){const r=new Image;r.onload=function(){n.load(r),k.update(t,n)},r.src=e}const Qre=-1;function Os(e){var t;const n=null!==(t=e?.TEXTURE_2D)&&void 0!==t?t:3553;return{id:XL(),target:n,format:Qre,internalFormat:0,type:0,filter:0,getWidth:()=>0,getHeight:()=>0,getDepth:()=>0,getByteCount:()=>0,define:()=>{},load:()=>{},mipmap:()=>{},bind:r=>{e&&(e.activeTexture(e.TEXTURE0+r),e.bindTexture(n,null))},unbind:r=>{e&&(e.activeTexture(e.TEXTURE0+r),e.bindTexture(n,null))},attachFramebuffer:()=>{throw new Error("cannot attach null-texture to a framebuffer")},detachFramebuffer:()=>{throw new Error("cannot detach null-texture from a framebuffer")},reset:()=>{},destroy:()=>{}}}function bu(e,t,n,r){const i=function vje(e,t,n,r){switch(n.granularity){case"uniform":return function Sje(e,t,n){return function xje(e,t){return t?(k.update(t.uColor,st.toVec3Normalized(t.uColor.ref.value,e)),k.updateIfChanged(t.dColorType,"uniform"),t):{uColor:k.create(st.toVec3Normalized(v(),e)),tColor:k.create({array:new Uint8Array(3),width:1,height:1}),tColorGrid:k.create(Os()),tPalette:k.create({array:new Uint8Array(3),width:1,height:1}),uColorTexDim:k.create(Me.create(1,1)),uColorGridDim:k.create(v.create(1,1,1)),uColorGridTransform:k.create(nn.create(0,0,0,1)),dColorType:k.create("uniform"),dUsePalette:k.create(!1)}}(t(rc,!1),n)}(0,n.color,r);case"instance":return e.nonInstanceable?Jre(e,n.color,r):function Cje(e,t,n){const{instanceCount:r}=e,i=Po(Math.max(1,r),3,Uint8Array,n&&n.tColor.ref.value.array);for(e.reset();e.hasNext;){const{location:o,isSecondary:s,instanceIndex:a}=e.move();st.toArray(t(o,s),i.array,3*a),e.skipInstance()}return dS(i,"instance",n)}(e,n.color,r);case"group":return Jre(e,n.color,r);case"groupInstance":return function wje(e,t,n){const{groupCount:r,instanceCount:i,hasLocation2:o}=e,a=Po(Math.max(1,i*r*(o?2:1)),3,Uint8Array,n&&n.tColor.ref.value.array);e.reset();const c=o?6:3;for(;e.hasNext;){const{location:u,location2:l,isSecondary:d,index:f}=e.move();st.toArray(t(u,d),a.array,f*c),o&&st.toArray(t(l,d),a.array,f*c+3)}return dS(a,"groupInstance",n)}(e,n.color,r);case"vertex":return function Aje(e,t,n){const{groupCount:r,stride:i}=e,o=Po(Math.max(1,r),3,Uint8Array,n&&n.tColor.ref.value.array);for(e.reset(),e.voidInstances();e.hasNext&&!e.isNextNewInstance;){const{location:s,isSecondary:a,groupIndex:c}=e.move(),u=t(s,a);for(let l=0;l=16*t?o.transform.ref.value:new Float32Array(16*t);a.set(e),k.update(o.transform,a),k.updateIfChanged(o.uInstanceCount,t),k.updateIfChanged(o.instanceCount,t);const c=o.aTransform.ref.value.length>=16*t?o.aTransform.ref.value:new Float32Array(16*t);k.update(o.aTransform,c);const u=o.extraTransform.ref.value.length>=16*t?o.extraTransform.ref.value:new Float32Array(16*t);k.update(o.extraTransform,vD(u,t));const l=o.aInstance.ref.value.length>=t?o.aInstance.ref.value:new Float32Array(t);k.update(o.aInstance,Tc(l,t)),k.update(o.hasReflection,s)}else o={aTransform:k.create(new Float32Array(16*t)),matrix:k.create(le.identity()),transform:k.create(new Float32Array(e)),extraTransform:k.create(vD(new Float32Array(16*t),t)),uInstanceCount:k.create(t),instanceCount:k.create(t),aInstance:k.create(Tc(new Float32Array(t))),hasReflection:k.create(s),instanceGrid:k.create({cellSize:0,cellCount:0,cellOffsets:new Uint32Array,cellSpheres:new Float32Array,cellTransform:new Float32Array,cellInstance:new Float32Array,batchSize:0,batchCount:0,batchOffsets:new Uint32Array,batchSpheres:new Float32Array,batchCell:new Uint32Array})};return nie(o,n,r,i),o}const QL=new Float32Array(16);function JL(e){return ZL(new Float32Array(QL),1,void 0,0,0,e)}function vD(e,t){for(let n=0;n0){const l=function Pje(e,t,n){const r=function Mje(e,t){const{instanceCount:n,instance:r,transform:i,invariantBoundingSphere:o}=e,s=new Float32Array(n),a=new Float32Array(n),c=new Float32Array(n),u=Fe.ofBounds(0,n),l=St.setEmpty(St()),{center:d,radius:f}=o,p=v.create(f,f,f),m=v();for(let M=0;Mn,props:t,description:Fje,legend:$h([["uniform",n]])}}const Oje={name:"uniform",label:"Uniform",category:ni.Misc,factory:f0,getParams:function Bje(e){return bv},defaultValues:C.getDefaultValues(bv),isApplicable:e=>!0},iie={value:C.Numeric(1,{min:0,max:20,step:.1})};function e5(e,t){const n=t.value;return{factory:e5,granularity:"uniform",size:()=>n,props:t,description:"Gives everything the same, uniform size."}}const Vje={name:"uniform",label:"Uniform",category:"",factory:e5,getParams:function Uje(e){return iie},defaultValues:C.getDefaultValues(iie),isApplicable:e=>!0};function ba(e){return{...ba.Zero,...e}}function gm(){}!function(e){e.Zero={metalness:0,roughness:0,bumpiness:0},e.toArray=function t(i,o,s){return o[s]=255*i.metalness,o[s+1]=255*i.roughness,o[s+2]=255*i.bumpiness,o},e.toString=function n({metalness:i,roughness:o,bumpiness:s}){return`M ${i.toFixed(2)} | R ${o.toFixed(2)} | B ${s.toFixed(2)}`},e.getParam=function r(i){return C.Group({metalness:C.Numeric(0,{min:0,max:1,step:.01}),roughness:C.Numeric(1,{min:0,max:1,step:.01}),bumpiness:C.Numeric(0,{min:0,max:1,step:.01})},{...i,presets:[[{metalness:0,roughness:1,bumpiness:0},"Matte"],[{metalness:0,roughness:.2,bumpiness:0},"Plastic"],[{metalness:0,roughness:.6,bumpiness:0},"Glossy"],[{metalness:1,roughness:.6,bumpiness:0},"Metallic"]]})}}(ba||(ba={})),function(e){e.Type={none:0,plane:1,sphere:2,cube:3,cylinder:4,infiniteCone:5},e.Params={variant:C.Select("pixel",C.arrayToOptions(["instance","pixel"])),objects:C.ObjectList({type:C.Select("plane",C.objectToOptions(e.Type,c=>zu(c))),invert:C.Boolean(!1),position:C.Vec3(v()),rotation:C.Group({axis:C.Vec3(v.create(1,0,0)),angle:C.Numeric(0,{min:-180,max:180,step:1},{description:"Angle in Degrees"})},{isExpanded:!0}),scale:C.Vec3(v.create(1,1,1))},c=>zu(c.type))};const n=_r(),r=_r(),i=v(),o=v();e.getClip=function s(c,u){const l=c.objects.length,{type:d,invert:f,position:p,rotation:m,scale:h}=u?.objects||function t(c){return{count:0,type:new Array(c).fill(1),invert:new Array(c).fill(!1),position:new Array(3*c).fill(0),rotation:new Array(4*c).fill(0),scale:new Array(3*c).fill(1)}}(l);for(let g=0;g1.2&&(r=2)),{resolution:n,stride:r}}}var rt;function Gje(e,t,n,r){for(let i=t;itypeof s.quality<"u"&&"custom"!==s.quality},e.Params={alpha:C.Numeric(1,{min:0,max:1,step:.01},{label:"Opacity",isEssential:!0,description:"How opaque/transparent the representation is rendered."}),quality:C.Select("auto",t5,{isEssential:!0,description:"Visual/rendering quality of the representation."}),material:ba.getParam(),clip:C.Group(gm.Params),instanceGranularity:C.Boolean(!1,{description:"Use instance granularity for marker, transparency, clipping, overpaint, substance data to save memory."}),lod:C.Vec3(v(),void 0,{...e.CullingLodCategory,description:"Level of detail.",fieldLabels:{x:"Min Distance",y:"Max Distance",z:"Overlap (Shader)"}}),cellSize:C.Numeric(200,{min:0,max:5e3,step:100},{...e.CullingLodCategory,description:"Instance grid cell size."}),batchSize:C.Numeric(2e3,{min:0,max:5e4,step:500},{...e.CullingLodCategory,description:"Instance grid batch size."})},e.createSimple=function t(s=xn.grey,a=1,c){return c||(c=JL()),{transform:c,locationIterator:Mr(1,c.instanceCount.ref.value,1,()=>rc,!1,()=>!1),theme:{color:f0(0,{value:s,lightness:0,saturation:0}),size:e5(0,{value:a})}}},e.createValues=function n(s,a){const c=gm.getClip(s.clip);return{alpha:k.create(s.alpha),uAlpha:k.create(s.alpha),uVertexCount:k.create(a.vertexCount),uGroupCount:k.create(a.groupCount),drawCount:k.create(a.drawCount),uMetalness:k.create(s.material.metalness),uRoughness:k.create(s.material.roughness),uBumpiness:k.create(s.material.bumpiness),dLightCount:k.create(1),dColorMarker:k.create(!0),dClipObjectCount:k.create(c.objects.count),dClipVariant:k.create(c.variant),uClipObjectType:k.create(c.objects.type),uClipObjectInvert:k.create(c.objects.invert),uClipObjectPosition:k.create(c.objects.position),uClipObjectRotation:k.create(c.objects.rotation),uClipObjectScale:k.create(c.objects.scale),instanceGranularity:k.create(s.instanceGranularity),uLod:k.create(nn.create(s.lod[0],s.lod[1],s.lod[2],0))}},e.updateValues=function r(s,a){k.updateIfChanged(s.alpha,a.alpha),k.updateIfChanged(s.uMetalness,a.material.metalness),k.updateIfChanged(s.uRoughness,a.material.roughness),k.updateIfChanged(s.uBumpiness,a.material.bumpiness);const c=gm.getClip(a.clip);k.updateIfChanged(s.dClipObjectCount,c.objects.count),k.updateIfChanged(s.dClipVariant,c.variant),k.update(s.uClipObjectType,c.objects.type),k.update(s.uClipObjectInvert,c.objects.invert),k.update(s.uClipObjectPosition,c.objects.position),k.update(s.uClipObjectRotation,c.objects.rotation),k.update(s.uClipObjectScale,c.objects.scale),k.updateIfChanged(s.instanceGranularity,a.instanceGranularity),k.update(s.uLod,nn.set(s.uLod.ref.value,a.lod[0],a.lod[1],a.lod[2],0))},e.createRenderableState=function i(s={}){const a=void 0===s.alpha||1===s.alpha;return{disposed:!1,visible:!0,alphaFactor:1,pickable:!0,colorOnly:!1,opaque:a,writeDepth:a}},e.updateRenderableState=function o(s,a){s.opaque=a.alpha*s.alphaFactor>=1,s.writeDepth=s.opaque}}(rt||(rt={}));const aie={array:new Uint8Array(4),width:1,height:1};function Dp(e){return e?(k.update(e.tOverpaint,aie),k.update(e.uOverpaintTexDim,Me.create(1,1)),e):{tOverpaint:k.create(aie),uOverpaintTexDim:k.create(Me.create(1,1)),dOverpaint:k.create(!1),tOverpaintGrid:k.create(Os()),uOverpaintGridDim:k.create(v.create(1,1,1)),uOverpaintGridTransform:k.create(nn.create(0,0,0,1)),dOverpaintType:k.create("groupInstance"),uOverpaintStrength:k.create(1)}}function Hje(e,t,n,r){for(let i=t;i=3*T?R.normalBuffer.ref.value:new Float32Array(3*T);F===R.normalBuffer.ref.value&&F.fill(0,0,3*T),dre(N,V,F,T,M),k.update(R.normalBuffer,F)},e.checkForDuplicateVertices=function a(R,T=3){const M=R.vertexBuffer.ref.value,N=new Map,V=(L,z)=>`${L[0].toFixed(z)}|${L[1].toFixed(z)}|${L[2].toFixed(z)}`;let F=0;const G=v();for(let L=0,z=R.vertexCount;L{const L=t2(F,G),z=N.get(L)||0;N.set(L,z+1)};for(let F=0;F{1===N&&(XZ(M,V),T.add(M[0]),T.add(M[1]))}),T}function h(R,T,M){const N=new Map,V=(F,G)=>{N.has(F)?eo(N.get(F),G):N.set(F,[G])};return T.forEach(F=>{const G=R[F];for(const L of G)T.has(L)&&1===M.get(t2(F,L))&&V(F,L)}),N}function y(R,T,M,N){var V;const{vertexBuffer:F,indexBuffer:G,normalBuffer:L,triangleCount:z}=R,j=F.ref.value,Z=G.ref.value,$=L.ref.value,ee=ze.create(Uint32Array,3,1024,z);let q=0;for(let de=0;deM.get(de).length<2).map(de=>{const we=M.get(de);return v.fromArray(O,j,3*de),v.fromArray(H,j,3*we[0]),v.fromArray(W,j,3*we[1]),v.sub(fe,H,O),v.sub(X,W,O),[de,v.angle(fe,X)]});K.sort(([,de],[,we])=>de-we);for(const[de,we]of K){if(oe.has(de)||we>me)continue;const Le=M.get(de);if(T[Le[0]].includes(Le[1])&&(null===(V=M.get(Le[0]))||void 0===V||!V.includes(Le[1]))||(v.fromArray(O,j,3*de),v.fromArray(H,j,3*Le[0]),v.fromArray(W,j,3*Le[1]),v.sub(fe,H,O),v.sub(X,W,O),v.add(ce,fe,X),v.squaredDistance(O,H)>=N))continue;let We=!1;for(const U of T[de])if(!Le.includes(U)&&(v.fromArray(Q,j,3*U),v.sub(J,Q,O),v.dot(ce,J)<0)){We=!0;break}We&&(v.fromArray(be,$,3*de),v.triangleNormal(ae,O,H,W),v.dot(ae,be)>0?ze.add3(ee,de,Le[0],Le[1]):ze.add3(ee,Le[1],Le[0],de),oe.add(de),oe.add(Le[0]),oe.add(Le[1]),q+=1)}const ne=ze.compact(ee);return R.triangleCount=q,k.update(G,ne),R}function _(R,T){const M=R.vertexCount,N=T.instanceCount.ref.value,V=mm(),F=V.position,G=R.vertexBuffer.ref.value,L=T.aTransform.ref.value;return Mr(M,N,1,(j,Z)=>(Z<0?v.fromArray(F,G,3*j):v.transformMat4Offset(F,G,L,0,3*j,16*Z),V))}function S(R,T,M,N,V){const{instanceCount:F,groupCount:G}=M,z=bu(M,_(R,T),N.color),j=V.instanceGranularity?Vi(F,"instance"):Vi(F*G,"groupInstance"),Z=Dp(),$=Ep(),ee=Mp(),q=Pp(),O={drawCount:3*R.triangleCount,vertexCount:R.vertexCount,groupCount:G,instanceCount:F},H=_e.clone(R.boundingSphere),W=fs(H,T.aTransform.ref.value,F,0);return{dGeometryType:k.create("mesh"),aPosition:R.vertexBuffer,aNormal:R.normalBuffer,aGroup:R.groupBuffer,elements:R.indexBuffer,dVaryingGroup:R.varyingGroup,boundingSphere:k.create(W),invariantBoundingSphere:k.create(H),uInvariantBoundingSphere:k.create(nn.ofSphere(H)),...z,...j,...Z,...$,...ee,...q,...T,...rt.createValues(V,O),uDoubleSided:k.create(V.doubleSided),dFlatShaded:k.create(V.flatShaded),dFlipSided:k.create(V.flipSided),dIgnoreLight:k.create(V.ignoreLight),dXrayShaded:k.create("inverted"===V.xrayShaded?"inverted":!0===V.xrayShaded?"on":"off"),dTransparentBackfaces:k.create(V.transparentBackfaces),uBumpFrequency:k.create(V.bumpFrequency),uBumpAmplitude:k.create(V.bumpAmplitude),meta:k.create(R.meta)}}function I(R,T){rt.updateRenderableState(R,T),R.opaque=R.opaque&&!T.xrayShaded,R.writeDepth=R.opaque}e.transform=function u(R,T){const M=R.vertexBuffer.ref.value;l0(T,M,0,R.vertexCount),le.isTranslationAndUniformScaling(T)||function Qze(e,t,n,r){for(let i=0,o=3*r;i{const q=R.vertexBuffer.ref.value;Z.set(q),T.forEach((H,W)=>{if(2!==H.length)return;v.fromArray(F,q,3*W),v.fromArray(G,q,3*H[0]),v.fromArray(L,q,3*H[1]);const Q=1/v.distance(F,G),fe=1/v.distance(F,L);v.scale(G,G,Q),v.scale(L,L,fe),v.add(z,G,L),v.scale(z,z,1/(Q+fe)),v.sub(z,z,F),v.scale(z,z,ee),v.add(z,F,z),v.toArray(z,Z,3*W)});const O=R.vertexBuffer.ref.value;k.update(R.vertexBuffer,Z),Z=O};for(let ee=0;ee{v.toArray(a,n,o),v.toArray(c,n,o+3),v.toArray(u,n,o+6),v.triangleNormal(xD,a,c,u);for(let l=0;l<3;++l)v.toArray(xD,r,o+3*l),i[s+l]=o/3+l;o+=9,s+=3},addQuad:(a,c,u,l)=>{v.toArray(a,n,o),v.toArray(c,n,o+3),v.toArray(u,n,o+6),v.toArray(l,n,o+9),v.triangleNormal(xD,a,c,u);for(let f=0;f<4;++f)v.toArray(xD,r,o+3*f);const d=o/3;i[s]=d,i[s+1]=d+1,i[s+2]=d+2,i[s+3]=d+2,i[s+4]=d+3,i[s+5]=d,o+=12,s+=6},getPrimitive:()=>({vertices:n,normals:r,indices:i})}}const _v=v(),tHe=Kt();function n5(e,t){const{vertices:n,normals:r}=e,i=Kt.directionTransform(tHe,t);for(let o=0,s=n.length;o{t.push(r(i),r(o),r(s))}}}(),{vertices:s,indices:a}=o;(function u(d){const f=v(),p=v(),m=v();for(let h=0;h0&&y(!0),a&&n>0&&y(!1),{vertices:new Float32Array(d),normals:new Float32Array(f),indices:new Uint32Array(l)};function y(b){const x=!0===b?t:n,_=!0===b?1:-1,S=p;for(let E=1;E<=i;++E)d.push(0,h*_,0),f.push(0,_,0),++p;const A=p;for(let E=0;E<=i;++E){const D=E/i*u+c,I=Math.cos(D),R=Math.sin(D);d.push(x*R,h*_,x*I),f.push(0,_,0),++p}for(let E=0;E(w<0?v.fromArray(x,_,3*E):v.transformMat4Offset(x,_,S,0,3*E,16*w),b))}function c(m,h,g,y,b){const{instanceCount:x,groupCount:_}=g,A=bu(g,a(m,h),y.color),E=kp(g,y.size),w=b.instanceGranularity?Vi(x,"instance"):Vi(x*_,"groupInstance"),D=Dp(),I=Ep(),R=Mp(),T=Pp(),M={drawCount:m.pointCount,vertexCount:m.pointCount,groupCount:_,instanceCount:x},N=_e.clone(m.boundingSphere),V=fs(N,h.aTransform.ref.value,x,0);return{dGeometryType:k.create("points"),aPosition:m.centerBuffer,aGroup:m.groupBuffer,boundingSphere:k.create(V),invariantBoundingSphere:k.create(N),uInvariantBoundingSphere:k.create(nn.ofSphere(N)),...A,...E,...w,...D,...I,...R,...T,...h,...rt.createValues(b,M),uSizeFactor:k.create(b.sizeFactor),dPointSizeAttenuation:k.create(b.pointSizeAttenuation),dPointStyle:k.create(b.pointStyle)}}function p(m,h){rt.updateRenderableState(m,h),m.opaque=m.opaque&&"fuzzy"!==h.pointStyle,m.writeDepth=m.opaque}e.create=t,e.createEmpty=n,e.transform=function s(m,h){const g=m.centerBuffer.ref.value;l0(h,g,0,m.pointCount),k.update(m.centerBuffer,g)},e.StyleTypes={square:"Square",circle:"Circle",fuzzy:"Fuzzy"},e.StyleTypeNames=Object.keys(e.StyleTypes),e.Params={...rt.Params,sizeFactor:C.Numeric(3,{min:0,max:10,step:.1}),pointSizeAttenuation:C.Boolean(!1),pointStyle:C.Select("square",C.objectToOptions(e.StyleTypes))},e.Utils={Params:e.Params,createEmpty:n,createValues:c,createValuesSimple:function u(m,h,g,y,b){const x=rt.createSimple(g,y,b),_={...C.getDefaultValues(e.Params),...h};return c(m,x.transform,x.locationIterator,x.theme,_)},updateValues:function l(m,h){rt.updateValues(m,h),k.updateIfChanged(m.uSizeFactor,h.sizeFactor),k.updateIfChanged(m.dPointSizeAttenuation,h.pointSizeAttenuation),k.updateIfChanged(m.dPointStyle,h.pointStyle)},updateBoundingSphere:function d(m,h){const g=_e.clone(h.boundingSphere),y=fs(g,m.aTransform.ref.value,m.instanceCount.ref.value,0);_e.equals(y,m.boundingSphere.ref.value)||k.update(m.boundingSphere,y),_e.equals(g,m.invariantBoundingSphere.ref.value)||(k.update(m.invariantBoundingSphere,g),k.update(m.uInvariantBoundingSphere,nn.fromSphere(m.uInvariantBoundingSphere.ref.value,g)))},createRenderableState:function f(m){const h=rt.createRenderableState(m);return p(h,m),h},updateRenderableState:p,createPositionIterator:a}}(ym||(ym={}));const b5={},Fie={fontFamily:C.Select("sans-serif",[["sans-serif","Sans Serif"],["monospace","Monospace"],["serif","Serif"],["cursive","Cursive"]]),fontQuality:C.Select(3,[[0,"lower"],[1,"low"],[2,"medium"],[3,"high"],[4,"higher"]]),fontStyle:C.Select("normal",[["normal","Normal"],["italic","Italic"],["oblique","Oblique"]]),fontVariant:C.Select("normal",[["normal","Normal"],["small-caps","Small Caps"]]),fontWeight:C.Select("normal",[["normal","Normal"],["bold","Bold"]])};class MHe{constructor(t={}){this.mapped={},this.scratchW=0,this.scratchH=0,this.currentX=0,this.currentY=0,this.cutoff=.5;const n={...C.getDefaultValues(Fie),...t};this.props=n;const r=32*(n.fontQuality+1);this.buffer=r/8,this.radius=r/3,this.lineHeight=Math.round(r+2*this.buffer+this.radius),this.maxWidth=Math.round(.75*this.lineHeight),this.texture=Po(350*this.lineHeight*this.maxWidth,1,Uint8Array),this.scratchContext=function kHe(e,t,n){if(qg)return function RHe(){throw new Error("When running in Node.js and wanting to use Canvas API, call mol-util/data-source's setCanvasModule function first and pass imported `canvas` module to it.")}().createCanvas(e,t).getContext("2d",n);{const r=document.createElement("canvas");return r.width=e,r.height=t,r.getContext("2d",n)}}(this.maxWidth,this.lineHeight,{willReadFrequently:!0}),this.scratchContext.font=`${n.fontStyle} ${n.fontVariant} ${n.fontWeight} ${r}px ${n.fontFamily}`,this.scratchContext.fillStyle="black",this.scratchContext.textBaseline="middle",this.scratchData=new Uint8Array(this.lineHeight*this.maxWidth),this.gridOuter=new Float64Array(this.lineHeight*this.maxWidth),this.gridInner=new Float64Array(this.lineHeight*this.maxWidth),this.f=new Float64Array(Math.max(this.lineHeight,this.maxWidth)),this.d=new Float64Array(Math.max(this.lineHeight,this.maxWidth)),this.z=new Float64Array(Math.max(this.lineHeight,this.maxWidth)+1),this.v=new Int16Array(Math.max(this.lineHeight,this.maxWidth)),this.middle=Math.ceil(this.lineHeight/2),this.placeholder=this.get("\ufffd")}get(t){if(void 0===this.mapped[t]){this.draw(t);const{array:n,width:r,height:i}=this.texture,o=this.scratchData;if(this.currentX+this.scratchW>r&&(this.currentX=0,this.currentY+=this.scratchH),this.currentY+this.scratchH>i)return console.warn("canvas to small"),this.placeholder;this.mapped[t]={x:this.currentX,y:this.currentY,w:this.scratchW,h:this.scratchH,nw:this.scratchW/this.lineHeight,nh:this.scratchH/this.lineHeight};for(let s=0;si&&(i=u);const l=Math.abs(e[c+1]);l>i&&(i=l);const d=Math.abs(t[s]);d>o&&(o=d)}return Math.max(o,r+r*i)}!function(e){function t(p,m,h,g,y,b,x,_,S){return S?function o(p,m,h,g,y,b,x,_,S){return S.charCount=_,k.update(S.fontTexture,p),k.update(S.centerBuffer,m),k.update(S.mappingBuffer,h),k.update(S.depthBuffer,g),k.update(S.indexBuffer,y),k.update(S.groupBuffer,b),k.update(S.tcoordBuffer,x),S}(p,m,h,g,y,b,x,_,S):function i(p,m,h,g,y,b,x,_){const S=_e();let A,E=-1,w=-1;const D={kind:"text",charCount:_,fontTexture:k.create(p),centerBuffer:k.create(m),mappingBuffer:k.create(h),depthBuffer:k.create(g),indexBuffer:k.create(y),groupBuffer:k.create(b),tcoordBuffer:k.create(x),get boundingSphere(){const I=r(D);if(I!==E){const R=Ip(D.centerBuffer.ref.value,4*D.charCount,4);_e.copy(S,R),E=I}return S},get groupMapping(){return D.groupBuffer.ref.version!==w&&(A=yv(D.groupBuffer.ref.value,D.charCount,4),w=D.groupBuffer.ref.version),A},setBoundingSphere(I){_e.copy(S,I),E=r(D)}};return D}(p,m,h,g,y,b,x,_)}function n(p){return t(p?p.fontTexture.ref.value:Po(0,1,Uint8Array),p?p.centerBuffer.ref.value:new Float32Array(0),p?p.mappingBuffer.ref.value:new Float32Array(0),p?p.depthBuffer.ref.value:new Float32Array(0),p?p.indexBuffer.ref.value:new Uint32Array(0),p?p.groupBuffer.ref.value:new Float32Array(0),p?p.tcoordBuffer.ref.value:new Float32Array(0),0,p)}function r(p){return ha([p.charCount,p.fontTexture.ref.version,p.centerBuffer.ref.version,p.mappingBuffer.ref.version,p.depthBuffer.ref.version,p.indexBuffer.ref.version,p.groupBuffer.ref.version,p.tcoordBuffer.ref.version])}function s(p,m){const h=4*p.charCount,g=m.instanceCount.ref.value,y=mm(),b=y.position,x=p.centerBuffer.ref.value,_=m.aTransform.ref.value;return Mr(h,g,4,(A,E)=>(E<0?v.fromArray(b,x,3*A):v.transformMat4Offset(b,x,_,0,3*A,16*E),y))}function a(p,m,h,g,y){const{instanceCount:b,groupCount:x}=h,S=bu(h,s(p,m),g.color),A=kp(h,g.size),E=y.instanceGranularity?Vi(b,"instance"):Vi(b*x,"groupInstance"),w=Dp(),D=Ep(),I=Mp(),R=Pp(),T={drawCount:2*p.charCount*3,vertexCount:4*p.charCount,groupCount:x,instanceCount:b},M=Bie(p.mappingBuffer.ref.value,p.depthBuffer.ref.value,p.charCount,gS(A)),N=_e.expand(_e(),p.boundingSphere,M),V=fs(N,m.aTransform.ref.value,b,0);return{dGeometryType:k.create("text"),aPosition:p.centerBuffer,aMapping:p.mappingBuffer,aDepth:p.depthBuffer,aGroup:p.groupBuffer,elements:p.indexBuffer,boundingSphere:k.create(V),invariantBoundingSphere:k.create(N),uInvariantBoundingSphere:k.create(nn.ofSphere(N)),...S,...A,...E,...w,...D,...I,...R,...m,aTexCoord:p.tcoordBuffer,tFont:p.fontTexture,padding:k.create(M),...rt.createValues(y,T),uSizeFactor:k.create(y.sizeFactor),uBorderWidth:k.create(os(y.borderWidth,0,.5)),uBorderColor:k.create(st.toArrayNormalized(y.borderColor,v.zero(),0)),uOffsetX:k.create(y.offsetX),uOffsetY:k.create(y.offsetY),uOffsetZ:k.create(y.offsetZ),uBackgroundColor:k.create(st.toArrayNormalized(y.backgroundColor,v.zero(),0)),uBackgroundOpacity:k.create(y.backgroundOpacity)}}function f(p,m){rt.updateRenderableState(p,m),p.pickable=!1,p.opaque=!1,p.writeDepth=!0}e.create=t,e.createEmpty=n,e.Params={...rt.Params,...Fie,sizeFactor:C.Numeric(1,{min:0,max:10,step:.1}),borderWidth:C.Numeric(0,{min:0,max:.5,step:.01}),borderColor:C.Color(xn.grey),offsetX:C.Numeric(0,{min:0,max:10,step:.1}),offsetY:C.Numeric(0,{min:0,max:10,step:.1}),offsetZ:C.Numeric(0,{min:0,max:10,step:.1}),background:C.Boolean(!1),backgroundMargin:C.Numeric(.2,{min:0,max:1,step:.01}),backgroundColor:C.Color(xn.grey),backgroundOpacity:C.Numeric(1,{min:0,max:1,step:.01}),tether:C.Boolean(!1),tetherLength:C.Numeric(1,{min:0,max:5,step:.1}),tetherBaseWidth:C.Numeric(.3,{min:0,max:1,step:.01}),attachment:C.Select("middle-center",[["bottom-left","bottom-left"],["bottom-center","bottom-center"],["bottom-right","bottom-right"],["middle-left","middle-left"],["middle-center","middle-center"],["middle-right","middle-right"],["top-left","top-left"],["top-center","top-center"],["top-right","top-right"]])},e.Utils={Params:e.Params,createEmpty:n,createValues:a,createValuesSimple:function c(p,m,h,g,y){const b=rt.createSimple(h,g,y),x={...C.getDefaultValues(e.Params),...m};return a(p,b.transform,b.locationIterator,b.theme,x)},updateValues:function u(p,m){rt.updateValues(p,m),k.updateIfChanged(p.uSizeFactor,m.sizeFactor),k.updateIfChanged(p.uBorderWidth,m.borderWidth),st.fromNormalizedArray(p.uBorderColor.ref.value,0)!==m.borderColor&&(st.toArrayNormalized(m.borderColor,p.uBorderColor.ref.value,0),k.update(p.uBorderColor,p.uBorderColor.ref.value)),k.updateIfChanged(p.uOffsetX,m.offsetX),k.updateIfChanged(p.uOffsetY,m.offsetY),k.updateIfChanged(p.uOffsetZ,m.offsetZ),st.fromNormalizedArray(p.uBackgroundColor.ref.value,0)!==m.backgroundColor&&(st.toArrayNormalized(m.backgroundColor,p.uBackgroundColor.ref.value,0),k.update(p.uBackgroundColor,p.uBackgroundColor.ref.value)),k.updateIfChanged(p.uBackgroundOpacity,m.backgroundOpacity)},updateBoundingSphere:function l(p,m){const h=Bie(p.aMapping.ref.value,p.aDepth.ref.value,m.charCount,gS(p)),g=_e.expand(_e(),m.boundingSphere,h),y=fs(g,p.aTransform.ref.value,p.instanceCount.ref.value,0);_e.equals(y,p.boundingSphere.ref.value)||k.update(p.boundingSphere,y),_e.equals(g,p.invariantBoundingSphere.ref.value)||(k.update(p.invariantBoundingSphere,g),k.update(p.uInvariantBoundingSphere,nn.fromSphere(p.uInvariantBoundingSphere.ref.value,g))),k.update(p.padding,h)},createRenderableState:function d(p){const m=rt.createRenderableState(p);return f(m,p),m},updateRenderableState:f,createPositionIterator:s}}(vu||(vu={}));const ic=v(),fd=v(),yS=v(),Oie=ze.add,DD=ze.add3;var Fc,di;!function(e){e.create=function t(n=2048,r=1024,i){const o=ze.create(Float32Array,1,r,i?i.groupBuffer.ref.value:n),s=ze.create(Float32Array,3,r,i?i.startBuffer.ref.value:n),a=ze.create(Float32Array,3,r,i?i.endBuffer.ref.value:n),c=(d,f,p,m,h,g,y)=>{for(let b=0;b<4;++b)DD(s,d,f,p),DD(a,m,h,g),Oie(o,y)},l=(d,f,p,m)=>{const h=v.distance(d,f),g=p%2!=0,y=Math.floor((p+1)/2),b=h/(p+.5);v.setMagnitude(yS,v.sub(yS,f,d),b),v.copy(ic,d);for(let x=0;x{for(let m=0;m<4;++m)DD(s,d[0],d[1],d[2]),DD(a,f[0],f[1],f[2]),Oie(o,p)},addFixedCountDashes:l,addFixedLengthDashes:(d,f,p,m)=>{const h=v.distance(d,f);l(d,f,h/p,m)},addCage:(d,f,p)=>{const{vertices:m,edges:h}=f;for(let g=0,y=h.length;g{const d=o.elementCount/4,f=ze.compact(o,!0),p=ze.compact(s,!0),m=ze.compact(a,!0),h=i&&d<=i.lineCount?i.mappingBuffer.ref.value:new Float32Array(8*d),g=i&&d<=i.lineCount?i.indexBuffer.ref.value:new Uint32Array(6*d);return(!i||d>i.lineCount)&&function NHe(e,t,n){for(let r=0;rx.lineCount&&(k.update(x.mappingBuffer,p),k.update(x.indexBuffer,m)),x.lineCount=b,k.update(x.groupBuffer,h),k.update(x.startBuffer,g),k.update(x.endBuffer,y),x}(p,m,h,g,y,b,x):function o(p,m,h,g,y,b){const x=_e();let _,S=-1,A=-1;const E={kind:"lines",lineCount:b,mappingBuffer:k.create(p),indexBuffer:k.create(m),groupBuffer:k.create(h),startBuffer:k.create(g),endBuffer:k.create(y),get boundingSphere(){const w=i(E);if(w!==S){const D=Ip(E.startBuffer.ref.value,4*E.lineCount,4),I=Ip(E.endBuffer.ref.value,4*E.lineCount,4);_e.expandBySphere(x,D,I),S=w}return x},get groupMapping(){return E.groupBuffer.ref.version!==A&&(_=yv(E.groupBuffer.ref.value,E.lineCount,4),A=E.groupBuffer.ref.version),_},setBoundingSphere(w){_e.copy(x,w),S=i(E)}};return E}(p,m,h,g,y,b)}function n(p){return t(p?p.mappingBuffer.ref.value:new Float32Array(0),p?p.indexBuffer.ref.value:new Uint32Array(0),p?p.groupBuffer.ref.value:new Float32Array(0),p?p.startBuffer.ref.value:new Float32Array(0),p?p.endBuffer.ref.value:new Float32Array(0),0,p)}function i(p){return ha([p.lineCount,p.mappingBuffer.ref.version,p.indexBuffer.ref.version,p.groupBuffer.ref.version,p.startBuffer.ref.version,p.endBuffer.ref.version])}function c(p,m){const h=4*p.lineCount,g=m.instanceCount.ref.value,y=mm(),b=y.position,x=p.startBuffer.ref.value,_=p.endBuffer.ref.value,S=m.aTransform.ref.value;return Mr(h,g,2,(E,w)=>{const D=E%4==0?x:_;return w<0?v.fromArray(b,D,3*E):v.transformMat4Offset(b,D,S,0,3*E,16*w),y})}function u(p,m,h,g,y){const{instanceCount:b,groupCount:x}=h,S=bu(h,c(p,m),g.color),A=kp(h,g.size),E=y.instanceGranularity?Vi(b,"instance"):Vi(b*x,"groupInstance"),w=Dp(),D=Ep(),I=Mp(),R=Pp(),T={drawCount:2*p.lineCount*3,vertexCount:4*p.lineCount,groupCount:x,instanceCount:b},M=_e.clone(p.boundingSphere),N=fs(M,m.aTransform.ref.value,b,0);return{dGeometryType:k.create("lines"),aMapping:p.mappingBuffer,aGroup:p.groupBuffer,aStart:p.startBuffer,aEnd:p.endBuffer,elements:p.indexBuffer,boundingSphere:k.create(N),invariantBoundingSphere:k.create(M),uInvariantBoundingSphere:k.create(nn.ofSphere(M)),...S,...A,...E,...w,...D,...I,...R,...m,...rt.createValues(y,T),uSizeFactor:k.create(y.sizeFactor),dLineSizeAttenuation:k.create(y.lineSizeAttenuation),uDoubleSided:k.create(!0),dFlipSided:k.create(!1)}}e.create=t,e.createEmpty=n,e.fromMesh=function r(p,m){const h=p.vertexBuffer.ref.value,g=p.indexBuffer.ref.value,y=p.groupBuffer.ref.value,b=Fc.create(3*p.triangleCount,p.triangleCount/10,m);for(let x=0,_=3*p.triangleCount;x<_;x+=3){const S=g[x],A=g[x+1],E=g[x+2],w=h[3*S],D=h[3*S+1],I=h[3*S+2],R=h[3*A],T=h[3*A+1],M=h[3*A+2],N=h[3*E],V=h[3*E+1],F=h[3*E+2];b.add(w,D,I,R,T,M,y[S]),b.add(w,D,I,N,V,F,y[S]),b.add(R,T,M,N,V,F,y[A])}return b.getLines()},e.transform=function a(p,m){const h=p.startBuffer.ref.value;l0(m,h,0,4*p.lineCount),k.update(p.startBuffer,h);const g=p.endBuffer.ref.value;l0(m,g,0,4*p.lineCount),k.update(p.endBuffer,g)},e.Params={...rt.Params,sizeFactor:C.Numeric(2,{min:0,max:10,step:.1}),lineSizeAttenuation:C.Boolean(!1)},e.Utils={Params:e.Params,createEmpty:n,createValues:u,createValuesSimple:function l(p,m,h,g,y){const b=rt.createSimple(h,g,y),x={...C.getDefaultValues(e.Params),...m};return u(p,b.transform,b.locationIterator,b.theme,x)},updateValues:function d(p,m){rt.updateValues(p,m),k.updateIfChanged(p.uSizeFactor,m.sizeFactor),k.updateIfChanged(p.dLineSizeAttenuation,m.lineSizeAttenuation)},updateBoundingSphere:function f(p,m){const h=_e.clone(m.boundingSphere),g=fs(h,p.aTransform.ref.value,p.instanceCount.ref.value,0);_e.equals(g,p.boundingSphere.ref.value)||k.update(p.boundingSphere,g),_e.equals(h,p.invariantBoundingSphere.ref.value)||(k.update(p.invariantBoundingSphere,h),k.update(p.uInvariantBoundingSphere,nn.fromSphere(p.uInvariantBoundingSphere.ref.value,h)))},createRenderableState:rt.createRenderableState,updateRenderableState:rt.updateRenderableState,createPositionIterator:c}}(di||(di={}));const Np=v(),Fp=v(),Bp=v(),Av=v(),ao=hf(4,!0);function Lie(e){const r=vv(12,e?36:24);for(let i=0;i<4;++i){const o=(i+1)%4;v.set(Np,ao[3*i],ao[3*i+1],-.5),v.set(Fp,ao[3*o],ao[3*o+1],-.5),v.set(Bp,ao[3*o],ao[3*o+1],.5),v.set(Av,ao[3*i],ao[3*i+1],.5),e?r.add(Np,Fp,Bp):r.addQuad(Np,Fp,Bp,Av)}return v.set(Np,ao[0],ao[1],-.5),v.set(Fp,ao[3],ao[4],-.5),v.set(Bp,ao[6],ao[7],-.5),v.set(Av,ao[9],ao[10],-.5),e?r.add(Bp,Fp,Np):r.addQuad(Av,Bp,Fp,Np),v.set(Np,ao[0],ao[1],.5),v.set(Fp,ao[3],ao[4],.5),v.set(Bp,ao[6],ao[7],.5),v.set(Av,ao[9],ao[10],.5),e?r.add(Np,Fp,Bp):r.addQuad(Np,Fp,Bp,Av),r.getPrimitive()}let _5,S5,C5;function x5(){return _5||(_5=Lie(!1)),_5}function Uie(){return C5||(C5=fS([.5,.5,-.5,-.5,.5,-.5,-.5,-.5,-.5,.5,-.5,-.5,.5,.5,.5,-.5,.5,.5,-.5,-.5,.5,.5,-.5,.5],[0,4,1,5,2,6,3,7,0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4])),C5}function Vie(e){return e.map(t=>({x:t[0],alpha:t[1]}))}function zie(e,t){const n=[{x:0,alpha:0},{x:0,alpha:0},...e,{x:1,alpha:0},{x:1,alpha:0}],i=t?t.ref.value.array:new Uint8Array(256);let s,a,c,u,l,d,o=0;const f=e.length+1;for(let m=0;m=t?c=t-1:c<0&&(c=0),o[c]++}return{min:n,max:r,binWidth:i,counts:o}}var Ko,ED,MD,et;function jie(e,t){return Oe.create("Create Volume",function(){var n=ie(function*(r){const{volume_data_3d_info:i,volume_data_3d:o}=e,s=ma.create(i.spacegroup_number.value(0),v.ofArray(i.spacegroup_cell_size.value(0)),v.scale(v.zero(),v.ofArray(i.spacegroup_cell_angles.value(0)),Math.PI/180)),a=i.axis_order.value(0),c=wn.convertToCanonicalAxisIndicesFastToSlow(a),u=c(i.sample_count.value(0)),l=wn.Space(u,wn.invertAxisOrder(a),Float32Array),d=wn.create(l,wn.Data1(o.values.toArray({array:Float32Array}))),f=v.ofArray(c(i.origin.value(0))),p=v.ofArray(c(i.dimensions.value(0)));return{label:t?.label,entryId:t?.entryId,grid:{transform:{kind:"spacegroup",cell:s,fractionalBox:St.create(f,v.add(v.zero(),f,p))},cells:d,stats:{min:i.min_sampled.value(0),max:i.max_sampled.value(0),mean:i.mean_sampled.value(0),sigma:i.sigma_sampled.value(0)}},sourceData:MD.create(e),customProperties:new Ql,_propertyData:Object.create(null)}});return function(r){return n.apply(this,arguments)}}())}!function(e){e.One={transform:{kind:"matrix",matrix:le.identity()},cells:wn.create(wn.Space([1,1,1],[0,1,2]),wn.Data1([0])),stats:{min:0,max:0,mean:0,sigma:0}};const t=le.zero(),n=le.zero();e.getGridToCartesianTransform=function r(c){if("matrix"===c.transform.kind)return le.copy(le(),c.transform.matrix);if("spacegroup"===c.transform.kind){const{cells:{space:u}}=c,l=le.fromScaling(t,v.div(v.zero(),St.size(v.zero(),c.transform.fractionalBox),v.ofArray(u.dimensions))),d=le.fromTranslation(n,c.transform.fractionalBox.min);return le.mul3(le.zero(),c.transform.cell.fromFractional,d,l)}return le.identity()},e.areEquivalent=function i(c,u){return c===u},e.isEmpty=function o(c){return 0===c.cells.data.length},e.getBoundingSphere=function s(c,u){u||(u=_e());const l=c.cells.space.dimensions,d=e.getGridToCartesianTransform(c);return _e.fromDimensionsAndTransform(u,l,d)},e.getHistogram=function a(c,u){let l=c._historams;return l||(l=c._historams={}),l[u]||(l[u]=function BHe(e,t,n){if(n)return Gie(e,t,n.min,n.max);{const[r,i]=cu(e);return Gie(e,t,r,i)}}(c.cells.data,u,{min:c.stats.min,max:c.stats.max})),l[u]}}(Ko||(Ko={})),function(e){e.is=function t(r){return"cube"===r?.kind},e.create=function n(r){return{kind:"cube",name:r.name,data:r}}}(ED||(ED={})),function(e){e.is=function t(r){return"dscif"===r?.kind},e.create=function n(r){return{kind:"dscif",name:r._name,data:r}}}(MD||(MD={})),function(e){let n;e.is=function t(y){var b,x,_,S;return(null===(S=null===(_=null===(x=null===(b=y?.grid)||void 0===b?void 0:b.cells)||void 0===x?void 0:x.space)||void 0===_?void 0:_.dimensions)||void 0===S?void 0:S.length)&&y?.sourceData&&y?.customProperties&&y?._propertyData},function(y){function E(I,R){return"absolute"===I.kind?I:{kind:"absolute",absoluteValue:y.calcAbsolute(R,I.relativeValue)}}y.areSame=function b(I,R,T){return ai(E(I,T).absoluteValue,E(R,T).absoluteValue,T.sigma/100)},y.absolute=function x(I){return{kind:"absolute",absoluteValue:I}},y.relative=function _(I){return{kind:"relative",relativeValue:I}},y.calcAbsolute=function S(I,R){return R*I.sigma+I.mean},y.calcRelative=function A(I,R){return 0===I.sigma?0:(R-I.mean)/I.sigma},y.toAbsolute=E,y.toRelative=function w(I,R){return"relative"===I.kind?I:{kind:"relative",relativeValue:y.calcRelative(R,I.absoluteValue)}},y.toString=function D(I){return"relative"===I.kind?`${I.relativeValue.toFixed(2)} \u03c3`:`${I.absoluteValue.toPrecision(4)}`}}(n=e.IsoValue||(e.IsoValue={})),e.adjustedIsoValue=function r(y,b,x){if("relative"===x)return n.relative(b);const _=n.absolute(b);if(MD.is(y.sourceData)){const S={min:y.sourceData.data.volume_data_3d_info.min_source.value(0),max:y.sourceData.data.volume_data_3d_info.max_source.value(0),mean:y.sourceData.data.volume_data_3d_info.mean_source.value(0),sigma:y.sourceData.data.volume_data_3d_info.sigma_source.value(0)};return e.IsoValue.toRelative(_,S)}return _};const i={min:-1,max:1,mean:0,sigma:.1};function o(y,b){const x=b||i,{min:_,max:S,mean:A,sigma:E}=x,w=(_-A)/E,D=(S-A)/E;let I=y;return"absolute"===y.kind?y.absoluteValue<_?I=e.IsoValue.absolute(_):y.absoluteValue>S&&(I=e.IsoValue.absolute(S)):y.relativeValueD&&(I=e.IsoValue.relative(D)),C.Conditioned(I,{absolute:C.Converted(R=>e.IsoValue.toAbsolute(R,Ko.One.stats).absoluteValue,R=>e.IsoValue.absolute(R),C.Numeric(A,{min:_,max:S,step:iJ(E/100,2)},{immediateUpdate:!0})),relative:C.Converted(R=>e.IsoValue.toRelative(R,Ko.One.stats).relativeValue,R=>e.IsoValue.relative(R),C.Numeric(Math.min(1,D),{min:w,max:D,step:iJ(Math.round((S-_)/E)/100,2)},{immediateUpdate:!0}))},R=>"absolute"===R.kind?"absolute":"relative",(R,T)=>"absolute"===T?e.IsoValue.toAbsolute(R,x):e.IsoValue.toRelative(R,x),{isEssential:!0})}let m,h,g;e.createIsoValueParam=o,e.IsoValueParam=o(e.IsoValue.relative(2)),e.One={label:"",grid:Ko.One,sourceData:{kind:"",name:"",data:{}},customProperties:new Ql,_propertyData:Object.create(null)},e.areEquivalent=function s(y,b){return Ko.areEquivalent(y.grid,b.grid)},e.isEmpty=function a(y){return Ko.isEmpty(y.grid)},e.isOrbitals=function c(y){return!!ED.is(y.sourceData)&&y.sourceData.data.header.orbitals},e.Loci=function u(y){return{kind:"volume-loci",volume:y}},e.isLoci=function l(y){return!!y&&"volume-loci"===y.kind},e.areLociEqual=function d(y,b){return y.volume===b.volume},e.isLociEmpty=function f(y){return Ko.isEmpty(y.volume.grid)},e.getBoundingSphere=function p(y,b){return Ko.getBoundingSphere(y.grid,b)},function(y){y.Loci=function b(w,D){return{kind:"isosurface-loci",volume:w,isoValue:D}},y.isLoci=function x(w){return!!w&&"isosurface-loci"===w.kind},y.areLociEqual=function _(w,D){return w.volume===D.volume&&e.IsoValue.areSame(w.isoValue,D.isoValue,w.volume.grid.stats)},y.isLociEmpty=function S(w){return 0===w.volume.grid.cells.data.length};const A=St();y.getBoundingSphere=function E(w,D,I){const R=e.IsoValue.toAbsolute(D,w.grid.stats).absoluteValue,T=R<0,M=[0,0,0],N=w.grid.cells.space.getCoords,V=w.grid.cells.data,[F,G,L]=w.grid.cells.space.dimensions;let z=F-1,j=G-1,Z=L-1,$=0,ee=0,q=0;for(let H=0,W=V.length;H=R)&&(N(H,M),M[0]$&&($=M[0]),M[1]>ee&&(ee=M[1]),M[2]>q&&(q=M[2]));v.set(A.min,z-1,j-1,Z-1),v.set(A.max,$+1,ee+1,q+1);const O=Ko.getGridToCartesianTransform(w.grid);return St.transform(A,A,O),_e.fromBox3D(I||_e(),A)}}(m=e.Isosurface||(e.Isosurface={})),function(y){y.Loci=function b(D,I){return{kind:"cell-loci",volume:D,indices:I}},y.isLoci=function x(D){return!!D&&"cell-loci"===D.kind},y.areLociEqual=function _(D,I){return D.volume===I.volume&&Fe.areEqual(D.indices,I.indices)},y.isLociEmpty=function S(D){return 0===Fe.size(D.indices)};const A=new fu("98"),E=v();y.getBoundingSphere=function w(D,I,R){A.reset();const T=Ko.getGridToCartesianTransform(D.grid),{getCoords:M}=D.grid.cells.space;for(let V=0,F=Fe.size(I);Vy._propertyData.__segmentation__}}(et||(et={}));const w5=x5();var _u,fl,xa;function Ar(e,t,n){return{type:"attribute",kind:e,itemSize:t,divisor:n}}function xe(e,t){return{type:"uniform",kind:e,variant:t}}function jt(e,t,n,r,i){return{type:"texture",kind:e,format:t,dataType:n,filter:r,variant:i}}function Iv(e){return{type:"elements",kind:e}}function Ft(e,t){return{type:"define",kind:e,options:t}}function ri(e){return{type:"value",kind:e}}!function(e){function t(g,y,b,x,_,S,A,E,w,D){return D?function i(g,y,b,x,_,S,A,E,w,D){const I=S.getWidth(),R=S.getHeight(),T=S.getDepth();return k.update(D.gridDimension,y),k.update(D.gridTexture,S),k.update(D.gridTextureDim,v.set(D.gridTextureDim.ref.value,I,R,T)),k.update(D.gridStats,nn.set(D.gridStats.ref.value,A.min,A.max,A.mean,A.sigma)),k.update(D.bboxMin,g.min),k.update(D.bboxMax,g.max),k.update(D.bboxSize,v.sub(D.bboxSize.ref.value,g.max,g.min)),k.update(D.transform,b),k.update(D.cellDim,_),k.update(D.unitToCartn,x),k.update(D.cartnToUnit,le.invert(le(),x)),k.updateIfChanged(D.packedGroup,E),k.updateIfChanged(D.axisOrder,v.fromArray(D.axisOrder.ref.value,w,0)),D}(g,y,b,x,_,S,A,E,w,D):function r(g,y,b,x,_,S,A,E,w){const D=_e();let I=-1;const R=S.getWidth(),T=S.getHeight(),M=S.getDepth(),N={kind:"direct-volume",gridDimension:k.create(y),gridTexture:k.create(S),gridTextureDim:k.create(v.create(R,T,M)),gridStats:k.create(nn.create(A.min,A.max,A.mean,A.sigma)),bboxMin:k.create(g.min),bboxMax:k.create(g.max),bboxSize:k.create(v.sub(v(),g.max,g.min)),transform:k.create(b),cellDim:k.create(_),unitToCartn:k.create(x),cartnToUnit:k.create(le.invert(le(),x)),get boundingSphere(){const V=n(N);if(V!==I){const F=function LHe(e,t){return _e.fromDimensionsAndTransform(_e(),e,t)}(N.gridDimension.ref.value,N.transform.ref.value);_e.copy(D,F),I=V}return D},packedGroup:k.create(E),axisOrder:k.create(w),setBoundingSphere(V){_e.copy(D,V),I=n(N)}};return N}(g,y,b,x,_,S,A,E,w)}function n(g){return ha([g.bboxSize.ref.version,g.gridDimension.ref.version,g.gridTexture.ref.version,g.transform.ref.version,g.gridStats.ref.version])}function o(g){return t(St(),v(),le.identity(),le.identity(),v(),Os(),Ko.One.stats,!1,v.create(0,1,2),g)}function a(g,y){return Math.ceil(v.magnitude(g)*y)}function c(g,y){return Math.min(...g)*(1/y)}function u(g){return 1/g}function l(g,y,b,x,_){const{gridTexture:S,gridTextureDim:A,gridStats:E}=g,{bboxSize:w,bboxMin:D,bboxMax:I,gridDimension:R,transform:T}=g,{instanceCount:M,groupCount:N}=b,F=bu(b,e.Utils.createPositionIterator(g,y),x.color),G=_.instanceGranularity?Vi(M,"instance"):Vi(M*N,"groupInstance"),L=Dp(),z=Ep(),j=Mp(),Z=Pp(),[$,ee,q]=R.ref.value,O={drawCount:w5.indices.length,vertexCount:$*ee*q,groupCount:N,instanceCount:M},H=_e.clone(g.boundingSphere),W=fs(H,y.aTransform.ref.value,M,0),fe=zie(Vie(_.controlPoints));return{dGeometryType:k.create("directVolume"),...F,...G,...L,...z,...j,...Z,...y,...rt.createValues(_,O),aPosition:k.create(w5.vertices),elements:k.create(w5.indices),boundingSphere:k.create(W),invariantBoundingSphere:k.create(H),uInvariantBoundingSphere:k.create(nn.ofSphere(H)),uBboxMin:D,uBboxMax:I,uBboxSize:w,uMaxSteps:k.create(a(R.ref.value,_.stepsPerCell)),uStepScale:k.create(c(g.cellDim.ref.value,_.stepsPerCell)),uJumpLength:k.create(_.jumpLength),uTransform:T,uGridDim:R,tTransferTex:fe,uTransferScale:k.create(u(_.stepsPerCell)),dGridTexType:k.create(S.ref.value.getDepth()>0?"3d":"2d"),uGridTexDim:A,tGridTex:S,uGridStats:E,uCellDim:g.cellDim,uCartnToUnit:g.cartnToUnit,uUnitToCartn:g.unitToCartn,dPackedGroup:g.packedGroup,dAxisOrder:k.create(g.axisOrder.ref.value.join("")),dIgnoreLight:k.create(_.ignoreLight),dXrayShaded:k.create("inverted"===_.xrayShaded?"inverted":!0===_.xrayShaded?"on":"off")}}e.create=t,e.createEmpty=o,e.Params={...rt.Params,ignoreLight:C.Boolean(!1,rt.ShadingCategory),xrayShaded:C.Select(!1,[[!1,"Off"],[!0,"On"],["inverted","Inverted"]],rt.ShadingCategory),controlPoints:C.LineGraph([Me.create(.19,0),Me.create(.2,.05),Me.create(.25,.05),Me.create(.26,0),Me.create(.79,0),Me.create(.8,.05),Me.create(.85,.05),Me.create(.86,0)],{isEssential:!0}),stepsPerCell:C.Numeric(3,{min:1,max:10,step:1}),jumpLength:C.Numeric(0,{min:0,max:20,step:.1})},e.Utils={Params:e.Params,createEmpty:o,createValues:l,createValuesSimple:function d(g,y,b,x,_){const S=rt.createSimple(b,x,_),A={...C.getDefaultValues(e.Params),...y};return l(g,S.transform,S.locationIterator,S.theme,A)},updateValues:function f(g,y){rt.updateValues(g,y),k.updateIfChanged(g.dIgnoreLight,y.ignoreLight),k.updateIfChanged(g.dXrayShaded,"inverted"===y.xrayShaded?"inverted":!0===y.xrayShaded?"on":"off"),zie(Vie(y.controlPoints),g.tTransferTex),k.updateIfChanged(g.uMaxSteps,a(g.uGridDim.ref.value,y.stepsPerCell)),k.updateIfChanged(g.uStepScale,c(g.uCellDim.ref.value,y.stepsPerCell)),k.updateIfChanged(g.uTransferScale,u(y.stepsPerCell)),k.updateIfChanged(g.uJumpLength,y.jumpLength)},updateBoundingSphere:function p(g,y){const b=_e.clone(y.boundingSphere),x=fs(b,g.aTransform.ref.value,g.instanceCount.ref.value,0);_e.equals(x,g.boundingSphere.ref.value)||k.update(g.boundingSphere,x),_e.equals(b,g.invariantBoundingSphere.ref.value)||(k.update(g.invariantBoundingSphere,b),k.update(g.uInvariantBoundingSphere,nn.fromSphere(g.uInvariantBoundingSphere.ref.value,b)))},createRenderableState:function m(g){const y=rt.createRenderableState(g);return y.opaque=!1,y.writeDepth=!1,y},updateRenderableState:function h(g,y){rt.updateRenderableState(g,y),g.opaque=!1,g.writeDepth=!1},createPositionIterator:function s(g,y){const b=g.transform.ref.value,[x,_,S]=g.gridDimension.ref.value,A=x*_*S,E=y.instanceCount.ref.value,w=mm(),D=w.position,I=y.aTransform.ref.value;return Mr(A,E,1,(T,M)=>{const N=Math.floor(T/S);return D[0]=Math.floor(N/_),D[1]=N%_,D[2]=T%S,v.transformMat4(D,D,b),M>=0&&v.transformMat4Offset(D,D,I,0,0,16*M),w})}}}(_u||(_u={})),function(e){function t(x,_,S,A){return A?function o(x,_,S,A){return A.sphereCount=S,k.update(A.centerBuffer,x),k.update(A.groupBuffer,_),A.shaderData.update(),A}(x,_,S,A):function i(x,_,S){const A=_e();let E,w=-1,D=-1;const I=k.create(Po(1,4,Float32Array)),R=k.create(Me.create(0,0)),T=k.create([]),M=k.create(0),N={kind:"spheres",sphereCount:S,centerBuffer:k.create(x),groupBuffer:k.create(_),get boundingSphere(){const V=r(N);if(V!==w){const F=Ip(N.centerBuffer.ref.value,4*N.sphereCount,4);_e.copy(A,F),w=V}return A},get groupMapping(){return N.groupBuffer.ref.version!==D&&(E=yv(N.groupBuffer.ref.value,N.sphereCount,4),D=N.groupBuffer.ref.version),E},setBoundingSphere(V){_e.copy(A,V),w=r(N)},shaderData:{positionGroup:I,texDim:R,lodLevels:T,sizeFactor:M,update(V){var F,G;const L=null!==(F=V?.lodLevels)&&void 0!==F?F:u(T.ref.value),z=null!==(G=V?.sizeFactor)&&void 0!==G?G:M.ref.value,j=d(L,z),Z=Po(N.sphereCount,4,Float32Array,I.ref.value.array),$=s(Z,N.centerBuffer.ref.value,N.groupBuffer.ref.value,N.sphereCount,j),ee=$?c(L,z,$,N.sphereCount):[];k.update(I,Z),k.update(R,Me.set(R.ref.value,Z.width,Z.height)),k.update(T,ee),k.update(M,z)}}};return N}(x,_,S)}function n(x){return t(x?x.centerBuffer.ref.value:new Float32Array(0),x?x.groupBuffer.ref.value:new Float32Array(0),0,x)}function r(x){return ha([x.sphereCount,x.centerBuffer.ref.version,x.groupBuffer.ref.version])}function s(x,_,S,A,E){const{array:w}=x;if(0===E.length){for(let R=0;R{const D=l(E,_);return[E.minDistance,E.maxDistance,E.overlap,S[S.length-1-w],Math.pow(Math.min(A,D),1/E.scaleBias),E.stride,E.scaleBias]})}function u(x){return x.map(_=>({minDistance:_[0],maxDistance:_[1],overlap:_[2],stride:_[5],scaleBias:_[6]}))}function l(x,_){return Math.max(1,Math.round(x.stride/Math.pow(_,x.scaleBias)))}function d(x,_){return x.map(S=>l(S,_)).reverse()}function f(x,_){const S=x.sphereCount,A=_.instanceCount.ref.value,E=mm(),w=E.position,D=x.centerBuffer.ref.value,I=_.aTransform.ref.value;return Mr(S,A,1,(T,M)=>(M<0?v.fromArray(w,D,3*T):v.transformMat4Offset(w,D,I,0,3*T,16*M),E))}function p(x,_,S,A,E){const{instanceCount:w,groupCount:D}=S,R=bu(S,f(x,_),A.color),T=kp(S,A.size),M=E.instanceGranularity?Vi(w,"instance"):Vi(w*D,"groupInstance"),N=Dp(),V=Ep(),F=Mp(),G=Pp(),L={drawCount:2*x.sphereCount*3,vertexCount:6*x.sphereCount,groupCount:D,instanceCount:w},z=x.boundingSphere.radius?gS(T)*E.sizeFactor:0,j=_e.expand(_e(),x.boundingSphere,z),Z=fs(j,_.aTransform.ref.value,w,0);return x.shaderData.update({lodLevels:E.lodLevels,sizeFactor:E.sizeFactor}),{dGeometryType:k.create("spheres"),uTexDim:x.shaderData.texDim,tPositionGroup:x.shaderData.positionGroup,boundingSphere:k.create(Z),invariantBoundingSphere:k.create(j),uInvariantBoundingSphere:k.create(nn.ofSphere(j)),...R,...T,...M,...N,...V,...F,...G,..._,padding:k.create(z),...rt.createValues(E,L),uSizeFactor:x.shaderData.sizeFactor,uDoubleSided:k.create(E.doubleSided),dIgnoreLight:k.create(E.ignoreLight),dXrayShaded:k.create("inverted"===E.xrayShaded?"inverted":!0===E.xrayShaded?"on":"off"),dTransparentBackfaces:k.create(E.transparentBackfaces),dSolidInterior:k.create(E.solidInterior),dClipPrimitive:k.create(E.clipPrimitive),dApproximate:k.create(E.approximate),uAlphaThickness:k.create(E.alphaThickness),uBumpFrequency:k.create(E.bumpFrequency),uBumpAmplitude:k.create(E.bumpAmplitude),lodLevels:x.shaderData.lodLevels,centerBuffer:x.centerBuffer,groupBuffer:x.groupBuffer}}function b(x,_){rt.updateRenderableState(x,_),x.opaque=x.opaque&&!_.xrayShaded,x.writeDepth=x.opaque}e.create=t,e.createEmpty=n,e.Params={...rt.Params,sizeFactor:C.Numeric(1,{min:0,max:10,step:.1}),doubleSided:C.Boolean(!1,rt.CustomQualityParamInfo),ignoreLight:C.Boolean(!1,rt.ShadingCategory),xrayShaded:C.Select(!1,[[!1,"Off"],[!0,"On"],["inverted","Inverted"]],rt.ShadingCategory),transparentBackfaces:C.Select("off",C.arrayToOptions(["off","on","opaque"]),rt.ShadingCategory),solidInterior:C.Boolean(!0,rt.ShadingCategory),clipPrimitive:C.Boolean(!1,{...rt.ShadingCategory,description:"Clip whole sphere instead of cutting it."}),approximate:C.Boolean(!1,{...rt.ShadingCategory,description:"Faster rendering, but has artifacts."}),alphaThickness:C.Numeric(0,{min:0,max:20,step:1},{...rt.ShadingCategory,description:"If not zero, adjusts alpha for radius."}),bumpFrequency:C.Numeric(0,{min:0,max:10,step:.1},rt.ShadingCategory),bumpAmplitude:C.Numeric(1,{min:0,max:5,step:.1},rt.ShadingCategory),lodLevels:C.ObjectList({minDistance:C.Numeric(0),maxDistance:C.Numeric(0),overlap:C.Numeric(0),stride:C.Numeric(0),scaleBias:C.Numeric(3,{min:.1,max:10,step:.1})},x=>`${x.stride}`,{...rt.CullingLodCategory,defaultValue:[]})},e.Utils={Params:e.Params,createEmpty:n,createValues:p,createValuesSimple:function m(x,_,S,A,E){const w=rt.createSimple(S,A,E),D={...C.getDefaultValues(e.Params),..._};return p(x,w.transform,w.locationIterator,w.theme,D)},updateValues:function h(x,_){rt.updateValues(x,_),k.updateIfChanged(x.uSizeFactor,_.sizeFactor),k.updateIfChanged(x.uDoubleSided,_.doubleSided),k.updateIfChanged(x.dIgnoreLight,_.ignoreLight),k.updateIfChanged(x.dXrayShaded,"inverted"===_.xrayShaded?"inverted":!0===_.xrayShaded?"on":"off"),k.updateIfChanged(x.dTransparentBackfaces,_.transparentBackfaces),k.updateIfChanged(x.dSolidInterior,_.solidInterior),k.updateIfChanged(x.dClipPrimitive,_.clipPrimitive),k.updateIfChanged(x.dApproximate,_.approximate),k.updateIfChanged(x.uAlphaThickness,_.alphaThickness),k.updateIfChanged(x.uBumpFrequency,_.bumpFrequency),k.updateIfChanged(x.uBumpAmplitude,_.bumpAmplitude);const S=u(x.lodLevels.ref.value);if(!function a(x,_){if(x.length!==_.length)return!1;for(let S=0,A=x.length;Src);m.namedFramebuffers[i]||(m.namedFramebuffers[i]=m.resources.framebuffer());const h=m.namedFramebuffers[i],[g,y]=f.geoTextureDim.ref.value,b=new Float32Array(g*y*4);h.bind(),f.vertexTexture.ref.value.attachFramebuffer(h,0),m.readPixels(0,0,g,y,b);const x=f.vertexCount,_=p.instanceCount.ref.value,S=mm(),A=S.position,E=b,w=p.aTransform.ref.value;return Mr(x,_,1,(I,R)=>(R<0?v.fromArray(A,E,4*I):v.transformMat4Offset(A,E,w,0,4*I,16*R),S))}};const i="texture-mesh";function s(f,p,m,h,g){const{instanceCount:y,groupCount:b}=m,_=bu(m,e.Utils.createPositionIterator(f,p),h.color),S=g.instanceGranularity?Vi(y,"instance"):Vi(y*b,"groupInstance"),A=Dp(),E=Ep(),w=Mp(),D=Pp(),I={drawCount:f.vertexCount,vertexCount:f.vertexCount,groupCount:b,instanceCount:y},R=_e.clone(f.boundingSphere),T=fs(R,p.aTransform.ref.value,y,0);return{dGeometryType:k.create("textureMesh"),uGeoTexDim:f.geoTextureDim,tPosition:f.vertexTexture,tGroup:f.groupTexture,tNormal:f.normalTexture,dVaryingGroup:f.varyingGroup,boundingSphere:k.create(T),invariantBoundingSphere:k.create(R),uInvariantBoundingSphere:k.create(nn.ofSphere(R)),..._,...S,...A,...E,...w,...D,...p,...rt.createValues(g,I),uDoubleSided:k.create(g.doubleSided),dFlatShaded:k.create(g.flatShaded),dFlipSided:k.create(g.flipSided),dIgnoreLight:k.create(g.ignoreLight),dXrayShaded:k.create("inverted"===g.xrayShaded?"inverted":!0===g.xrayShaded?"on":"off"),dTransparentBackfaces:k.create(g.transparentBackfaces),uBumpFrequency:k.create(g.bumpFrequency),uBumpAmplitude:k.create(g.bumpAmplitude),meta:k.create(f.meta)}}function d(f,p){rt.updateRenderableState(f,p),f.opaque=f.opaque&&!p.xrayShaded,f.writeDepth=f.opaque}}(xa||(xa={}));const Op={uDrawId:xe("i"),uModel:xe("m4"),uView:xe("m4"),uInvView:xe("m4"),uModelView:xe("m4"),uInvModelView:xe("m4"),uProjection:xe("m4"),uInvProjection:xe("m4"),uModelViewProjection:xe("m4"),uInvModelViewProjection:xe("m4"),uIsOrtho:xe("f"),uPixelRatio:xe("f"),uViewport:xe("v4"),uViewOffset:xe("v2"),uDrawingBufferSize:xe("v2"),uCameraPosition:xe("v3"),uCameraDir:xe("v3"),uCameraPlane:xe("v4"),uNear:xe("f"),uFar:xe("f"),uFog:xe("b"),uFogNear:xe("f"),uFogFar:xe("f"),uFogColor:xe("v3"),uTransparentBackground:xe("b"),uLightDirection:xe("v3[]"),uLightColor:xe("v3[]"),uAmbientColor:xe("v3"),uPickingAlphaThreshold:xe("f"),uInteriorDarkening:xe("f"),uInteriorColorFlag:xe("b"),uInteriorColor:xe("v3"),uHighlightColor:xe("v3"),uSelectColor:xe("v3"),uDimColor:xe("v3"),uHighlightStrength:xe("f"),uSelectStrength:xe("f"),uDimStrength:xe("f"),uMarkerPriority:xe("i"),uMarkerAverage:xe("f"),uXrayEdgeFalloff:xe("f"),uExposure:xe("f"),uRenderMask:xe("i"),uMarkingDepthTest:xe("b"),uMarkingType:xe("i"),uPickType:xe("i")},Lp={tDepth:jt("texture","depth","ushort","nearest"),tDpoitDepth:jt("texture","rg","float","nearest"),tDpoitFrontColor:jt("texture","rgba","float","nearest"),tDpoitBackColor:jt("texture","rgba","float","nearest")},Up={uObjectId:xe("i")},zHe={uColor:xe("v3","material"),uColorTexDim:xe("v2"),uColorGridDim:xe("v3"),uColorGridTransform:xe("v4"),tColor:jt("image-uint8","rgb","ubyte","nearest"),tPalette:jt("image-uint8","rgb","ubyte","nearest"),tColorGrid:jt("texture","rgb","ubyte","linear"),dColorType:Ft("string",["uniform","attribute","instance","group","groupInstance","vertex","vertexInstance","volume","volumeInstance","direct"]),dUsePalette:Ft("boolean")},bS={uSize:xe("f","material"),uSizeTexDim:xe("v2"),tSize:jt("image-uint8","rgb","ubyte","nearest"),dSizeType:Ft("string",["uniform","attribute","instance","group","groupInstance"]),uSizeFactor:xe("f","material")},GHe={uMarker:xe("f"),uMarkerTexDim:xe("v2"),tMarker:jt("image-uint8","alpha","ubyte","nearest"),markerAverage:ri("number"),markerStatus:ri("number"),dMarkerType:Ft("string",["instance","groupInstance"])},jHe={uOverpaintTexDim:xe("v2"),tOverpaint:jt("image-uint8","rgba","ubyte","nearest"),dOverpaint:Ft("boolean"),uOverpaintGridDim:xe("v3"),uOverpaintGridTransform:xe("v4"),tOverpaintGrid:jt("texture","rgba","ubyte","linear"),dOverpaintType:Ft("string",["instance","groupInstance","volumeInstance"]),uOverpaintStrength:xe("f","material")},HHe={uTransparencyTexDim:xe("v2"),tTransparency:jt("image-uint8","alpha","ubyte","nearest"),dTransparency:Ft("boolean"),transparencyAverage:ri("number"),uTransparencyGridDim:xe("v3"),uTransparencyGridTransform:xe("v4"),tTransparencyGrid:jt("texture","alpha","ubyte","linear"),dTransparencyType:Ft("string",["instance","groupInstance","volumeInstance"]),uTransparencyStrength:xe("f","material")},qHe={uSubstanceTexDim:xe("v2"),tSubstance:jt("image-uint8","rgba","ubyte","nearest"),dSubstance:Ft("boolean"),uSubstanceGridDim:xe("v3"),uSubstanceGridTransform:xe("v4"),tSubstanceGrid:jt("texture","rgba","ubyte","linear"),dSubstanceType:Ft("string",["instance","groupInstance","volumeInstance"]),uSubstanceStrength:xe("f","material")},WHe={uClippingTexDim:xe("v2"),tClipping:jt("image-uint8","alpha","ubyte","nearest"),dClipping:Ft("boolean"),dClippingType:Ft("string",["instance","groupInstance"])},Vp={dGeometryType:Ft("string",["cylinders","directVolume","image","lines","mesh","points","spheres","text","textureMesh"]),...zHe,...GHe,...jHe,...HHe,...qHe,...WHe,dLightCount:Ft("number"),dColorMarker:Ft("boolean"),dClipObjectCount:Ft("number"),dClipVariant:Ft("string",["instance","pixel"]),uClipObjectType:xe("i[]","material"),uClipObjectInvert:xe("b[]","material"),uClipObjectPosition:xe("v3[]","material"),uClipObjectRotation:xe("v4[]","material"),uClipObjectScale:xe("v3[]","material"),aInstance:Ar("float32",1,1),aTransform:Ar("float32",16,1),uAlpha:xe("f","material"),uMetalness:xe("f","material"),uRoughness:xe("f","material"),uBumpiness:xe("f","material"),uVertexCount:xe("i"),uInstanceCount:xe("i"),uGroupCount:xe("i"),uInvariantBoundingSphere:xe("v4"),uLod:xe("v4"),drawCount:ri("number"),instanceCount:ri("number"),alpha:ri("number"),matrix:ri("m4"),transform:ri("float32"),extraTransform:ri("float32"),hasReflection:ri("boolean"),instanceGranularity:ri("boolean"),boundingSphere:ri("sphere"),invariantBoundingSphere:ri("sphere"),instanceGrid:ri("instanceGrid")},ps="\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nvoid main(void) {\n vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n gl_Position = vec4(position, 0.0, 1.0);\n}\n",YHe=pa(),KHe=Object.keys({color:"",pick:"",depth:"",marking:""}),ZHe=Object.keys({compute:""});function A5(e,t,n,r,i){return n={...n,dRenderVariant:k.create(t)},void 0===i.dRenderVariant&&Object.defineProperty(i,"dRenderVariant",{value:Ft("string")}),e.resources.program(n,r,i)}function I5(e,t){if("color"===e)switch(t){case"blended":return"colorBlended";case"wboit":return"colorWboit";case"dpoit":return"colorDpoit"}return e}function zp(e,t,n,r,i,o,s){return Hie(e,t,n,r,i,o,KHe,s)}function zi(e,t,n,r,i,o=-1){return Hie(e,t,n,r,i,o,ZHe,void 0)}function Hie(e,t,n,r,i,o,s,a){const c=YHe(),{stats:u,state:l,resources:d}=e,{instancedArrays:f,vertexArrayObject:p,multiDrawInstancedBaseVertexBaseInstance:m,drawInstancedBaseVertexBaseInstance:h}=e.extensions;i.uVertexCount&&!e.extensions.noNonInstancedActiveAttribs&&(i.aVertex=k.create(Tc(new Float32Array(i.uVertexCount.ref.value))),r.aVertex=Ar("float32",1,0));const{attributeValues:g,defineValues:y,textureValues:b,materialTextureValues:x,uniformValues:_,materialUniformValues:S,bufferedUniformValues:A}=function UHe(e,t){const n={},r={},i={},o={},s={},a={},c={};return Object.keys(e).forEach(u=>{const l=e[u];"attribute"===l.type&&(n[u]=t[u]),"define"===l.type&&(r[u]=t[u]),"texture"===l.type&&void 0!==t[u]&&("material"===l.variant?o[u]=t[u]:i[u]=t[u]),"uniform"===l.type&&void 0!==t[u]&&("material"===l.variant?a[u]=t[u]:"buffered"===l.variant?c[u]=t[u]:s[u]=t[u])}),{attributeValues:n,defineValues:r,textureValues:i,materialTextureValues:o,uniformValues:s,materialUniformValues:a,bufferedUniformValues:c}}(r,i),E=Object.entries(_),w=Object.entries(S),D=Object.entries(A),I=Object.entries(function HGe(e){const t={};return Object.keys(e).forEach(n=>{t[n]=k.create(Jl(e[n].ref.value))}),t}(A)),R=Object.entries(y),T=function VHe(e){const t={};return Object.keys(e).forEach(n=>{t[n]=e[n].ref.version}),t}(i),M=function XHe(e,t){const{gl:n}=e;switch(t){case"points":return n.POINTS;case"lines":return n.LINES;case"line-strip":return n.LINE_STRIP;case"line-loop":return n.LINE_LOOP;case"triangles":return n.TRIANGLES;case"triangle-strip":return n.TRIANGLE_STRIP;case"triangle-fan":return n.TRIANGLE_FAN}}(e,t),N={};for(const W of s)N[W]=A5(e,I5(W,a),y,n,r);const V=Kre(e,r,b),F=Kre(e,r,x),G=function ZGe(e,t,n){const r=[];return Object.keys(t).forEach(i=>{const o=t[i];"attribute"===o.type&&(r[r.length]=[i,e.resources.attribute(n[i].ref.value,o.itemSize,o.divisor)])}),r}(e,r,g),L=[];for(let W=0,Q=G.length;WN[W],setTransparency:W=>{if(W!==a){a=W;for(const Q of s)N[Q].destroy(),N[Q]=A5(e,I5(Q,a),y,n,r)}},render:(W,Q,fe)=>{if(0===$||0===ee)return;const X=N[W];if(X.id===H&&l.currentRenderItemId===c)X.setUniforms(E),X.bindTextures(V,Q);else{const J=Z[W];(X.id!==l.currentProgramId||X.id!==H||-1===o||o!==l.currentMaterialId)&&(X.id!==l.currentProgramId&&X.use(),X.setUniforms(w),X.bindTextures(F,Q+V.length),l.currentMaterialId=o,H=X.id),X.setUniforms(E),X.setUniforms(I),X.bindTextures(V,Q),J?(J.bind(),z&&z.bind()):(z&&z.bind(),X.bindAttributes(G)),l.currentRenderItemId=c}if(un)try{pD(e.gl)}catch(J){throw new Error(`Framebuffer error rendering item id ${c}: '${J}'`)}if(fe){for(const J of fe)if(0!==J.count){if(X.setUniforms(J.uniforms),m)z?m.multiDrawElementsInstancedBaseVertexBaseInstance(M,J.counts,0,z._dataType,J.offsets,0,J.instanceCounts,0,J.baseVertices,0,J.baseInstances,0,J.count):m.multiDrawArraysInstancedBaseInstance(M,J.firsts,0,J.counts,0,J.instanceCounts,0,J.baseInstances,0,J.count);else if(h)if(z)for(let ce=0;ce0&&(X.uniform("uDrawId",ce),h.drawElementsInstancedBaseVertexBaseInstance(M,J.counts[ce],z._dataType,J.offsets[ce],J.instanceCounts[ce],J.baseVertices[ce],J.baseInstances[ce]));else for(let ce=0;ce0&&(X.uniform("uDrawId",ce),h.drawArraysInstancedBaseInstance(M,J.firsts[ce],J.counts[ce],J.instanceCounts[ce],J.baseInstances[ce]));else if(z)for(let ce=0;ce0&&(X.uniform("uDrawId",ce),X.offsetAttributes(L,J.baseInstances[ce]),f.drawElementsInstanced(M,J.counts[ce],z._dataType,J.offsets[ce],J.instanceCounts[ce]));else for(let ce=0;ce0&&(X.uniform("uDrawId",ce),X.offsetAttributes(L,J.baseInstances[ce]),f.drawArraysInstanced(M,0,J.counts[ce],J.instanceCounts[ce]));if(lt){m?u.calls.multiDrawInstancedBase+=1:h?u.calls.drawInstancedBase+=J.count:u.calls.drawInstanced+=J.count;for(let ce=0;ce{if(function JHe(e){e.attributes=!1,e.defines=!1,e.elements=!1,e.textures=!1}(q),i.aVertex){const W=i.uVertexCount.ref.value;i.aVertex.ref.value.length=J.ref.value.length)X.updateSubData(J.ref.value,0,X.length);else{X.destroy();const{itemSize:ce,divisor:be}=r[fe];G[W][1]=d.attribute(J.ref.value,ce,be),q.attributes=!0}T[fe]=J.ref.version}}if(z&&i.elements.ref.version!==T.elements&&(z.length>=i.elements.ref.value.length?z.updateSubData(i.elements.ref.value,0,z.length):(z.destroy(),z=d.elements(i.elements.ref.value),q.elements=!0),T.elements=i.elements.ref.version),q.attributes||q.defines||q.elements)for(const W of s){const Q=Z[W];Q&&Q.destroy(),Z[W]=p?d.vertexArray(N[W],G,z):null}for(let W=0,Q=V.length;W{if(!O){for(const W of s){N[W].destroy();const Q=Z[W];Q&&Q.destroy()}V.forEach(([W,Q])=>{"texture"!==r[W].kind&&Q.destroy()}),F.forEach(([W,Q])=>{"texture"!==r[W].kind&&Q.destroy()}),G.forEach(([W,Q])=>Q.destroy()),z&&z.destroy(),u.drawCount-=$,u.instanceCount-=ee,u.instancedDrawCount-=ee*$,O=!0}}}}function Gi(){return Gi.create(v.create(1,0,0),0)}function p0(){return p0.create(Gi(),Gi(),Gi(),Gi(),Gi(),Gi())}!function(e){function n(h,g){return v.copy(h.normal,g.normal),h.constant=g.constant,h}function c(h,g,y){return v.copy(h.normal,g),h.constant=-v.dot(h.normal,y),h}e.create=function t(h,g){return{normal:h,constant:g}},e.copy=n,e.clone=function r(h){return n(e(),h)},e.normalize=function i(h,g){const y=1/v.magnitude(g.normal);return v.scale(h.normal,g.normal,y),h.constant=g.constant*y,h},e.negate=function o(h,g){return v.negate(h.normal,g.normal),h.constant=-g.constant,h},e.toArray=function s(h,g,y){return v.toArray(h.normal,g,y),g[y+3]=h.constant,g},e.fromArray=function a(h,g,y){return v.fromArray(h.normal,g,y),h.constant=g[y+3],h},e.fromNormalAndCoplanarPoint=c,e.fromCoplanarPoints=function u(h,g,y,b){return c(h,v.triangleNormal(v(),g,y,b),g),h};const l=v();function f(h,g){return v.dot(h.normal,g)+h.constant}e.setUnnormalized=function d(h,g,y,b,x){v.set(l,g,y,b);const _=1/v.magnitude(l);return v.scale(h.normal,l,_),h.constant=x*_,h},e.distanceToPoint=f,e.distanceToSpher3D=function p(h,g){return f(h,g.center)-g.radius},e.projectPoint=function m(h,g,y){return v.scaleAndAdd(h,h,g.normal,-f(g,y))}}(Gi||(Gi={})),function(e){function n(u,l){for(let d=0;d<6;++d)Gi.copy(u[d],l[d]);return u}e.create=function t(u,l,d,f,p,m){return[u,l,d,f,p,m]},e.copy=n,e.clone=function r(u){return n(e(),u)},e.fromProjectionMatrix=function i(u,l){const d=l[0],f=l[1],p=l[2],m=l[3],h=l[4],g=l[5],y=l[6],b=l[7],x=l[8],_=l[9],S=l[10],A=l[11],E=l[12],w=l[13],D=l[14],I=l[15];return Gi.setUnnormalized(u[0],m-d,b-h,A-x,I-E),Gi.setUnnormalized(u[1],m+d,b+h,A+x,I+E),Gi.setUnnormalized(u[2],m+f,b+g,A+_,I+w),Gi.setUnnormalized(u[3],m-f,b-g,A-_,I-w),Gi.setUnnormalized(u[4],m-p,b-y,A-S,I-D),Gi.setUnnormalized(u[5],m+p,b+y,A+S,I+D),u},e.intersectsSphere3D=function o(u,l){const d=l.center,f=-l.radius;for(let p=0;p<6;++p)if(Gi.distanceToPoint(u[p],d)0?l.max[0]:l.min[0],s[1]=f.normal[1]>0?l.max[1]:l.min[1],s[2]=f.normal[2]>0?l.max[2]:l.min[2],Gi.distanceToPoint(f,s)<0)return!1}return!0},e.containsPoint=function c(u,l){for(let d=0;d<6;++d)if(Gi.distanceToPoint(u[d],l)<0)return!1;return!0}}(p0||(p0={}));const RD=Gi.distanceToPoint,kD=p0.intersectsSphere3D,ND=_e.fromArray,qie=pa();function T5(e,t){return t&&t.instanceCounts.length>=e?t:{firsts:new Int32Array(e),counts:new Int32Array(e),offsets:new Int32Array(e),instanceCounts:new Int32Array(e),baseVertices:new Int32Array(e),baseInstances:new Uint32Array(e),count:0,uniforms:[]}}function Gp(e,t,n){const r=qie();let i=T5(0);const o=[];let s=!1,a=-1;const c=_e(),u=()=>{var l;const d=null===(l=t.lodLevels)||void 0===l?void 0:l.ref.value;if(d&&d.length>0){const{cellCount:f}=t.instanceGrid.ref.value;o.length=d.length;for(let p=0,m=d.length;p{var m,h;if(s=!1,0===t.drawCount.ref.value||0===t.instanceCount.ref.value||!t.instanceGrid.ref.value)return;const{cellOffsets:g,cellSpheres:y,cellCount:b,batchOffsets:x,batchSpheres:_,batchCount:S,batchCell:A,batchSize:E}=t.instanceGrid.ref.value,[w,D]=t.uLod.ref.value,I=0!==w||0!==D,R=2*E,T=null===(m=t.lodLevels)||void 0===m?void 0:m.ref.value;if(T&&T.length>0){if((null===(h=t.lodLevels)||void 0===h?void 0:h.ref.version)!==a)u();else for(let M=0,N=T.length;MD))lt&&(p.culled.lod+=g[A[V-1]+1]-g[A[N]]);else if(kD(d,c))if(null!==f&&f(c))lt&&(p.culled.occlusion+=g[A[V-1]+1]-g[A[N]]);else for(let L=N;LD))lt&&(p.culled.lod+=$);else if(kD(d,c))if(null!==f&&ee-c.radiusT[q][1])continue;const H=o[q],W=H.count;W>0&&H.baseInstances[W-1]+H.instanceCounts[W-1]===j&&H.counts[W-1]===T[q][3]?H.instanceCounts[W-1]+=$:(H.counts[W]=T[q][3],H.instanceCounts[W]=$,H.baseInstances[W]=j,H.count+=1)}else lt&&(p.culled.frustum+=$)}else lt&&(p.culled.frustum+=g[A[V-1]+1]-g[A[N]])}}else{i=T5(b,i);const{baseInstances:M,instanceCounts:N,counts:V}=i;let F=0;for(let G=0;GD){lt&&(p.culled.lod+=g[A[z-1]+1]-g[A[L]]);continue}}if(!kD(d,c)){lt&&(p.culled.frustum+=g[A[z-1]+1]-g[A[L]]);continue}if(null!==f&&f(c)){lt&&(p.culled.occlusion+=g[A[z-1]+1]-g[A[L]]);continue}for(let Z=L;ZD)?lt&&(p.culled.lod+=O):kD(d,c)?null!==f&&H-c.radius0&&M[F-1]+N[F-1]===ee?N[F-1]+=O:(V[F]=t.drawCount.ref.value,N[F]=O,M[F]=ee,F+=1):lt&&(p.culled.frustum+=O)}}}i.count=F,o.length=1,o[0]=i,o[0].uniforms.length=0}s=!0},uncull:()=>{s=!1},render:(l,d)=>{t.uAlpha&&t.alpha&&k.updateIfChanged(t.uAlpha,os(t.alpha.ref.value*n.alphaFactor,0,1)),e.render(l,d,s?o:void 0)},getProgram:l=>e.getProgram(l),setTransparency:l=>e.setTransparency(l),update:()=>{e.update(),u()},dispose:()=>e.destroy()}}function ji(e,t){return{id:qie(),values:t,render:()=>e.render("compute",0),update:()=>e.update(),dispose:()=>e.destroy()}}const D5=new Float32Array([1,1,-1,1,-1,-1,-1,-1,1,-1,1,1]),vo={drawCount:ri("number"),instanceCount:ri("number"),aPosition:Ar("float32",2,0),uQuadScale:xe("v2")},_o={drawCount:k.create(6),instanceCount:k.create(1),aPosition:k.create(D5),uQuadScale:k.create(Me.create(1,1))},eqe={...vo,tColor:jt("texture","rgba","ubyte","nearest"),uTexSize:xe("v2")},tqe=Br("copy",ps,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSize;\n\nvoid main() {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n gl_FragColor = texture2D(tColor, coords);\n}\n");function Tv(e,t){const n={..._o,tColor:k.create(t),uTexSize:k.create(Me.create(t.getWidth(),t.getHeight()))},r={...eqe};return ji(zi(e,"triangles",tqe,r,n),n)}const Wie=new Uint32Array([0,1,2,1,3,2]),rqe=new Float32Array([0,1,0,0,1,1,1,0]),$ie={nearest:"Nearest",catmulrom:"Catmulrom (Cubic)",mitchell:"Mitchell (Cubic)",bspline:"B-Spline (Cubic)"},iqe=Object.keys($ie);var jp,oc,Zo;!function(e){function t(f,p,m,h){return h?function i(f,p,m,h){const g=f.width,y=f.height;return k.update(h.imageTexture,f),k.update(h.imageTextureDim,Me.set(h.imageTextureDim.ref.value,g,y)),k.update(h.cornerBuffer,p),k.update(h.groupTexture,m),h}(f,p,m,h):function r(f,p,m){const h=_e();let g=-1;const y=f.width,b=f.height,x={kind:"image",imageTexture:k.create(f),imageTextureDim:k.create(Me.create(y,b)),cornerBuffer:k.create(p),groupTexture:k.create(m),get boundingSphere(){const _=function n(f){return ha([f.cornerBuffer.ref.version])}(x);if(_!==g){const S=function oqe(e){const t=v(),n=[];for(let o=0,s=e.length;or&&(r=s)}const i=_e.create(t,r);return _e.setExtrema(i,n),i}(x.cornerBuffer.ref.value);_e.copy(h,S),g=_}return h}};return x}(f,p,m)}function o(f){return t(Po(0,4,Uint8Array),f?f.cornerBuffer.ref.value:new Float32Array(24),Po(0,4,Uint8Array),f)}function s(f,p,m,h,g){const{instanceCount:y,groupCount:b}=m,_=bu(m,e.Utils.createPositionIterator(f,p),h.color),S=g.instanceGranularity?Vi(y,"instance"):Vi(y*b,"groupInstance"),A=Dp(),E=Ep(),w=Mp(),D=Pp(),I={drawCount:Wie.length,vertexCount:D5.length/3,groupCount:b,instanceCount:y},R=_e.clone(f.boundingSphere),T=fs(R,p.aTransform.ref.value,y,0);return{dGeometryType:k.create("image"),..._,...S,...A,...E,...w,...D,...p,...rt.createValues(g,I),aPosition:f.cornerBuffer,aUv:k.create(rqe),elements:k.create(Wie),aGroup:k.create(Tc(new Float32Array(4))),boundingSphere:k.create(T),invariantBoundingSphere:k.create(R),uInvariantBoundingSphere:k.create(nn.ofSphere(R)),dInterpolation:k.create(g.interpolation),uImageTexDim:f.imageTextureDim,tImageTex:f.imageTexture,tGroupTex:f.groupTexture}}e.create=t,e.createEmpty=o,e.Params={...rt.Params,interpolation:C.Select("bspline",C.objectToOptions($ie))},e.Utils={Params:e.Params,createEmpty:o,createValues:s,createValuesSimple:function a(f,p,m,h,g){const y=rt.createSimple(m,h,g),b={...C.getDefaultValues(e.Params),...p};return s(f,y.transform,y.locationIterator,y.theme,b)},updateValues:function c(f,p){rt.updateValues(f,p),k.updateIfChanged(f.dInterpolation,p.interpolation)},updateBoundingSphere:function u(f,p){const m=_e.clone(p.boundingSphere),h=fs(m,f.aTransform.ref.value,f.instanceCount.ref.value,0);_e.equals(h,f.boundingSphere.ref.value)||k.update(f.boundingSphere,h),_e.equals(m,f.invariantBoundingSphere.ref.value)||(k.update(f.invariantBoundingSphere,m),k.update(f.uInvariantBoundingSphere,nn.fromSphere(f.uInvariantBoundingSphere.ref.value,m)))},createRenderableState:function l(f){const p=rt.createRenderableState(f);return p.opaque=!1,p},updateRenderableState:function d(f,p){rt.updateRenderableState(f,p),f.opaque=!1},createPositionIterator:()=>Mr(1,1,1,()=>rc)}}(jp||(jp={})),function(e){function t(m,h,g,y,b,x,_,S,A,E){return E?function o(m,h,g,y,b,x,_,S,A,E){return A>E.cylinderCount&&(k.update(E.mappingBuffer,m),k.update(E.indexBuffer,h)),E.cylinderCount=A,k.update(E.groupBuffer,g),k.update(E.startBuffer,y),k.update(E.endBuffer,b),k.update(E.scaleBuffer,x),k.update(E.capBuffer,_),k.update(E.colorModeBuffer,S),E}(m,h,g,y,b,x,_,S,A,E):function i(m,h,g,y,b,x,_,S,A){const E=_e();let w,D=-1,I=-1;const R={kind:"cylinders",cylinderCount:A,mappingBuffer:k.create(m),indexBuffer:k.create(h),groupBuffer:k.create(g),startBuffer:k.create(y),endBuffer:k.create(b),scaleBuffer:k.create(x),capBuffer:k.create(_),colorModeBuffer:k.create(S),get boundingSphere(){const T=r(R);if(T!==D){const M=Ip(R.startBuffer.ref.value,6*R.cylinderCount,6),N=Ip(R.endBuffer.ref.value,6*R.cylinderCount,6);_e.expandBySphere(E,M,N),D=T}return E},get groupMapping(){return R.groupBuffer.ref.version!==I&&(w=yv(R.groupBuffer.ref.value,R.cylinderCount,6),I=R.groupBuffer.ref.version),w},setBoundingSphere(T){_e.copy(E,T),D=r(R)}};return R}(m,h,g,y,b,x,_,S,A)}function n(m){return t(m?m.mappingBuffer.ref.value:new Float32Array(0),m?m.indexBuffer.ref.value:new Uint32Array(0),m?m.groupBuffer.ref.value:new Float32Array(0),m?m.startBuffer.ref.value:new Float32Array(0),m?m.endBuffer.ref.value:new Float32Array(0),m?m.scaleBuffer.ref.value:new Float32Array(0),m?m.capBuffer.ref.value:new Float32Array(0),m?m.colorModeBuffer.ref.value:new Float32Array(0),0,m)}function r(m){return ha([m.cylinderCount,m.mappingBuffer.ref.version,m.indexBuffer.ref.version,m.groupBuffer.ref.version,m.startBuffer.ref.version,m.endBuffer.ref.version,m.scaleBuffer.ref.version,m.capBuffer.ref.version,m.colorModeBuffer.ref.version])}function a(m,h){const g=6*m.cylinderCount,y=h.instanceCount.ref.value,b=mm(),x=b.position,_=m.startBuffer.ref.value,S=m.endBuffer.ref.value,A=h.aTransform.ref.value;return Mr(g,y,2,(w,D)=>{const I=w%6==0?_:S;return D<0?v.fromArray(x,I,3*w):v.transformMat4Offset(x,I,A,0,3*w,16*D),b})}function c(m,h,g,y,b){const{instanceCount:x,groupCount:_}=g,A=bu(g,a(m,h),y.color),E=kp(g,y.size),w=b.instanceGranularity?Vi(x,"instance"):Vi(x*_,"groupInstance"),D=Dp(),I=Ep(),R=Mp(),T=Pp(),M={drawCount:4*m.cylinderCount*3,vertexCount:6*m.cylinderCount,groupCount:_,instanceCount:x},N=gS(E)*b.sizeFactor,V=_e.clone(m.boundingSphere),F=fs(V,h.aTransform.ref.value,x,0);return{dGeometryType:k.create("cylinders"),aMapping:m.mappingBuffer,aGroup:m.groupBuffer,aStart:m.startBuffer,aEnd:m.endBuffer,aScale:m.scaleBuffer,aCap:m.capBuffer,aColorMode:m.colorModeBuffer,elements:m.indexBuffer,boundingSphere:k.create(F),invariantBoundingSphere:k.create(V),uInvariantBoundingSphere:k.create(nn.ofSphere(V)),...A,...E,...w,...D,...I,...R,...T,...h,padding:k.create(N),...rt.createValues(b,M),uSizeFactor:k.create(b.sizeFactor*b.sizeAspectRatio),uDoubleSided:k.create(b.doubleSided),dIgnoreLight:k.create(b.ignoreLight),dXrayShaded:k.create("inverted"===b.xrayShaded?"inverted":!0===b.xrayShaded?"on":"off"),dTransparentBackfaces:k.create(b.transparentBackfaces),dSolidInterior:k.create(b.solidInterior),uBumpFrequency:k.create(b.bumpFrequency),uBumpAmplitude:k.create(b.bumpAmplitude),dDualColor:k.create("interpolate"===b.colorMode)}}function p(m,h){rt.updateRenderableState(m,h),m.opaque=m.opaque&&!h.xrayShaded,m.writeDepth=m.opaque}e.create=t,e.createEmpty=n,e.transform=function s(m,h){const g=m.startBuffer.ref.value;l0(h,g,0,6*m.cylinderCount),k.update(m.startBuffer,g);const y=m.endBuffer.ref.value;l0(h,y,0,6*m.cylinderCount),k.update(m.endBuffer,y)},e.Params={...rt.Params,sizeFactor:C.Numeric(1,{min:0,max:10,step:.1}),sizeAspectRatio:C.Numeric(1,{min:0,max:3,step:.01}),doubleSided:C.Boolean(!1,rt.CustomQualityParamInfo),ignoreLight:C.Boolean(!1,rt.ShadingCategory),xrayShaded:C.Select(!1,[[!1,"Off"],[!0,"On"],["inverted","Inverted"]],rt.ShadingCategory),transparentBackfaces:C.Select("off",C.arrayToOptions(["off","on","opaque"]),rt.ShadingCategory),solidInterior:C.Boolean(!0,rt.ShadingCategory),bumpFrequency:C.Numeric(0,{min:0,max:10,step:.1},rt.ShadingCategory),bumpAmplitude:C.Numeric(1,{min:0,max:5,step:.1},rt.ShadingCategory),colorMode:C.Select("default",C.arrayToOptions(["default","interpolate"]),rt.ShadingCategory)},e.Utils={Params:e.Params,createEmpty:n,createValues:c,createValuesSimple:function u(m,h,g,y,b){const x=rt.createSimple(g,y,b),_={...C.getDefaultValues(e.Params),...h};return c(m,x.transform,x.locationIterator,x.theme,_)},updateValues:function l(m,h){rt.updateValues(m,h),k.updateIfChanged(m.uSizeFactor,h.sizeFactor*h.sizeAspectRatio),k.updateIfChanged(m.uDoubleSided,h.doubleSided),k.updateIfChanged(m.dIgnoreLight,h.ignoreLight),k.updateIfChanged(m.dXrayShaded,"inverted"===h.xrayShaded?"inverted":!0===h.xrayShaded?"on":"off"),k.updateIfChanged(m.dTransparentBackfaces,h.transparentBackfaces),k.updateIfChanged(m.dSolidInterior,h.solidInterior),k.updateIfChanged(m.uBumpFrequency,h.bumpFrequency),k.updateIfChanged(m.uBumpAmplitude,h.bumpAmplitude),k.updateIfChanged(m.dDualColor,"interpolate"===h.colorMode)},updateBoundingSphere:function d(m,h){const g=_e.clone(h.boundingSphere),y=fs(g,m.aTransform.ref.value,m.instanceCount.ref.value,0);_e.equals(y,m.boundingSphere.ref.value)||k.update(m.boundingSphere,y),_e.equals(g,m.invariantBoundingSphere.ref.value)||(k.update(m.invariantBoundingSphere,g),k.update(m.uInvariantBoundingSphere,nn.fromSphere(m.uInvariantBoundingSphere.ref.value,g)))},createRenderableState:function f(m){const h=rt.createRenderableState(m);return p(h,m),h},updateRenderableState:p,createPositionIterator:a}}(oc||(oc={})),function(e){function t(s){switch(s.kind){case"mesh":return 3*s.triangleCount;case"points":return s.pointCount;case"spheres":return 2*s.sphereCount*3;case"cylinders":return 4*s.cylinderCount*3;case"text":return 2*s.charCount*3;case"lines":return 2*s.lineCount*3;case"direct-volume":return 36;case"image":return 6;case"texture-mesh":return s.vertexCount}}e.getDrawCount=t,e.getVertexCount=function n(s){switch(s.kind){case"mesh":case"texture-mesh":return s.vertexCount;case"points":return s.pointCount;case"spheres":return 6*s.sphereCount;case"cylinders":return 6*s.cylinderCount;case"text":return 4*s.charCount;case"lines":return 4*s.lineCount;case"direct-volume":const[a,c,u]=s.gridDimension.ref.value;return a*c*u;case"image":return 4}},e.getGroupCount=function r(s){switch(s.kind){case"mesh":case"points":case"spheres":case"cylinders":case"text":case"lines":return 0===t(s)?0:Xd(s.groupBuffer.ref.value)+1;case"direct-volume":return 1;case"image":return Xd(s.groupTexture.ref.value.array)+1;case"texture-mesh":return s.groupCount}},e.getUtils=function i(s){switch(s.kind){case"mesh":return Nt.Utils;case"points":return ym.Utils;case"spheres":return fl.Utils;case"cylinders":return oc.Utils;case"text":return vu.Utils;case"lines":return di.Utils;case"direct-volume":return _u.Utils;case"image":return jp.Utils;case"texture-mesh":return xa.Utils}},e.getGranularity=function o(s,a){return"instance"===a&&s.nonInstanceable?"group":a}}(Zo||(Zo={}));const Yie={};function M5(e,t){return{factory:M5,granularity:"groupInstance",size:n=>ra.isLocation(n)?n.shape.getSize(n.group,n.instance):1,props:t,description:"Assigns sizes as defined by the shape object."}}const uqe={name:"shape-group",label:"Shape Group",category:"",factory:M5,getParams:function cqe(e){return Yie},defaultValues:C.getDefaultValues(Yie),isApplicable:e=>!!e.shape},lqe=st(13421772),Xie={};function R5(e,t){return{factory:R5,granularity:"groupInstance",color:n=>ra.isLocation(n)?n.shape.getColor(n.group,n.instance):lqe,props:t,description:"Assigns colors as defined by the shape object."}}const pqe={name:"shape-group",label:"Shape Group",category:ni.Misc,factory:R5,getParams:function fqe(e){return Xie},defaultValues:C.getDefaultValues(Xie),isApplicable:e=>!!e.shape},hqe={...Vp,aPosition:Ar("float32",3,0),elements:Iv("uint32"),uBboxMin:xe("v3"),uBboxMax:xe("v3"),uBboxSize:xe("v3"),uMaxSteps:xe("i"),uStepScale:xe("f"),uJumpLength:xe("f"),uTransform:xe("m4"),uGridDim:xe("v3"),tTransferTex:jt("image-uint8","alpha","ubyte","linear"),uTransferScale:xe("f","material"),dGridTexType:Ft("string",["2d","3d"]),uGridTexDim:xe("v3"),tGridTex:jt("texture","rgba","ubyte","linear"),uGridStats:xe("v4"),uCellDim:xe("v3"),uCartnToUnit:xe("m4"),uUnitToCartn:xe("m4"),dPackedGroup:Ft("boolean"),dAxisOrder:Ft("string",["012","021","102","120","201","210"]),dIgnoreLight:Ft("boolean"),dXrayShaded:Ft("string",["off","on","inverted"])},gqe={...Vp,aGroup:Ar("float32",1,0),aPosition:Ar("float32",3,0),aNormal:Ar("float32",3,0),elements:Iv("uint32"),dVaryingGroup:Ft("boolean"),dFlatShaded:Ft("boolean"),uDoubleSided:xe("b","material"),dFlipSided:Ft("boolean"),dIgnoreLight:Ft("boolean"),dXrayShaded:Ft("string",["off","on","inverted"]),dTransparentBackfaces:Ft("string",["off","on","opaque"]),uBumpFrequency:xe("f","material"),uBumpAmplitude:xe("f","material"),meta:ri("unknown")},bqe={...Vp,...bS,aGroup:Ar("float32",1,0),aPosition:Ar("float32",3,0),dPointSizeAttenuation:Ft("boolean"),dPointStyle:Ft("string",["square","circle","fuzzy"])},_qe={...Vp,...bS,aGroup:Ar("float32",1,0),aMapping:Ar("float32",2,0),aStart:Ar("float32",3,0),aEnd:Ar("float32",3,0),elements:Iv("uint32"),dLineSizeAttenuation:Ft("boolean"),uDoubleSided:xe("b","material"),dFlipSided:Ft("boolean")},Sqe={...Vp,...bS,uTexDim:xe("v2"),tPositionGroup:jt("image-float32","rgba","float","nearest"),padding:ri("number"),uDoubleSided:xe("b","material"),dIgnoreLight:Ft("boolean"),dXrayShaded:Ft("string",["off","on","inverted"]),dTransparentBackfaces:Ft("string",["off","on","opaque"]),dSolidInterior:Ft("boolean"),dClipPrimitive:Ft("boolean"),dApproximate:Ft("boolean"),uAlphaThickness:xe("f"),uBumpFrequency:xe("f","material"),uBumpAmplitude:xe("f","material"),lodLevels:ri("unknown"),centerBuffer:ri("float32"),groupBuffer:ri("float32")},wqe={...Vp,...bS,aGroup:Ar("float32",1,0),aPosition:Ar("float32",3,0),aMapping:Ar("float32",2,0),aDepth:Ar("float32",1,0),elements:Iv("uint32"),aTexCoord:Ar("float32",2,0),tFont:jt("image-uint8","alpha","ubyte","linear"),padding:ri("number"),uBorderWidth:xe("f","material"),uBorderColor:xe("v3","material"),uOffsetX:xe("f","material"),uOffsetY:xe("f","material"),uOffsetZ:xe("f","material"),uBackgroundColor:xe("v3","material"),uBackgroundOpacity:xe("f","material")},Iqe={...Vp,uGeoTexDim:xe("v2","buffered"),tPosition:jt("texture","rgb","float","nearest"),tGroup:jt("texture","alpha","float","nearest"),tNormal:jt("texture","rgb","float","nearest"),dVaryingGroup:Ft("boolean"),dFlatShaded:Ft("boolean"),uDoubleSided:xe("b","material"),dFlipSided:Ft("boolean"),dIgnoreLight:Ft("boolean"),dXrayShaded:Ft("string",["off","on","inverted"]),dTransparentBackfaces:Ft("string",["off","on","opaque"]),uBumpFrequency:xe("f","material"),uBumpAmplitude:xe("f","material"),meta:ri("unknown")},Dqe={...Vp,aGroup:Ar("float32",1,0),aPosition:Ar("float32",3,0),aUv:Ar("float32",2,0),elements:Iv("uint32"),uImageTexDim:xe("v2"),tImageTex:jt("image-uint8","rgba","ubyte","nearest"),tGroupTex:jt("image-uint8","rgba","ubyte","nearest"),dInterpolation:Ft("string",iqe)},Pqe={...Vp,...bS,aGroup:Ar("float32",1,0),aStart:Ar("float32",3,0),aEnd:Ar("float32",3,0),aMapping:Ar("float32",3,0),aScale:Ar("float32",1,0),aCap:Ar("float32",1,0),aColorMode:Ar("float32",1,0),elements:Iv("uint32"),padding:ri("number"),uDoubleSided:xe("b","material"),dIgnoreLight:Ft("boolean"),dXrayShaded:Ft("string",["off","on","inverted"]),dTransparentBackfaces:Ft("string",["off","on","opaque"]),dSolidInterior:Ft("boolean"),uBumpFrequency:xe("f","material"),uBumpAmplitude:xe("f","material"),dDualColor:Ft("boolean")},Rqe=pa(0,2147483647),Hp=pa(0,2147483647);function Ev(e,t,n,r){return{id:Rqe(),type:e,values:t,state:n,materialId:r}}var qn,ra;function Kie(e){const t=e&&e.getElement("vertex"),n=e&&e.getElement("material"),r={group:"",vRed:"",vGreen:"",vBlue:"",mRed:"",mGreen:"",mBlue:""},i=[["",""]],o=[["",""]];if(t){for(let c=0,u=t.propertyNames.length;c(f.group=m,f.instance=h,f))}function i(l,d,f,p,m){const h=m&&m.aTransform.ref.value.length>=16*l.length?m.aTransform.ref.value:new Float32Array(16*l.length);for(let g=0,y=l.length;g{for(let A=b[S],E=b[S+1];A{for(let A=b[S],E=b[S+1];A{const A=p.shape.getSize(S,_);h{const m="material"===i?p:u[p];return st.fromRgb(o.value(m),s.value(m),a.value(m))},()=>1,p=>`${l} ${c[p]}`,f)}function Lqe(){let e,t,n,r,i,o;return function(){var a=ie(function*(c,u,l,d){const f=u.source.getElement("vertex");if(!f)throw new Error("missing vertex element");const p=u.source.getElement("face");if(!p)throw new Error("missing face element");const m=u.source.getElement("material");let h=!1,g=!1;return(!e||e!=e)&&(h=!0),(!t||!C.isParamEqual(Zie.grouping,t.grouping,l.grouping))&&(h=!0),(!t||!C.isParamEqual(Zie.coloring,t.coloring,l.coloring))&&(g=!0),h?(i=Qie(f,m,l),o=function Oqe(e,t){const{grouping:n}=t,{rowCount:r}=e,i="vertex"===n.name?e.getProperty(n.params.group):void 0,o="vertex"===n.name?zu(n.params.group):"Vertex",s=i?i.toArray({array:Uint32Array}):Tc(new Uint32Array(r)),a=i?Xd(s):r-1,c=new Uint32Array(a+1);for(let u=0,l=s.length;u=48&&s<=57)&&i<=o;)s=t.charCodeAt(++i);for(s=t.charCodeAt(o);(32===s||s>=48&&s<=57)&&o>=i;)s=t.charCodeAt(--o);if(++o,i===o||i+1===o)return He.add(e,i,o);if(s=t.charCodeAt(i),i+2===o){const a=t.charCodeAt(i+1);if(!((78!==s&&110!==s||65!==a&&97!==a)&&(67!==s&&99!==s||76!==a&&108!==a)&&(70!==s&&102!==s||69!==a&&101!==a)&&(83!==s&&115!==s||73!==a&&105!==a)&&(66!==s&&98!==s||82!==a&&114!==a)&&(65!==s&&97!==s||83!==a&&115!==a)))return He.add(e,i,i+2)}if(67===s||99===s||72===s||104===s||78===s||110===s||79===s||111===s||80===s||112===s||83===s||115===s)return He.add(e,i,i+1);He.add(e,i,i)}!function(e){function t(i,o){return{size:i,anglesInRadians:o}}function n(){return t(v(),v())}e.create=t,e.empty=n,e.fromBasis=function r(i,o,s){const a=v.magnitude(i),c=v.magnitude(o),u=v.magnitude(s),l=Math.acos(v.dot(o,s)/(c*u)),d=Math.acos(v.dot(i,s)/(a*u)),f=Math.acos(v.dot(i,o)/(a*c));return a<=0||c<=0||u<=0||l>=Math.PI||d>=Math.PI||f>=Math.PI?n():t(v.create(a,c,u),v.create(l,d,f))}}(Wp||(Wp={}));const Gqe=new Set(["NA","CL","FE","SI","BR","AS","LI"]),jqe=new Set(["C","H","N","O","P","S","F","B"]),Hqe=/^[\s\d]+|[\s\d]+$/g;function Pv(e,t){const n=(e=e.replace(Hqe,"").toUpperCase()).length;if(0===n||1===n||Gqe.has(e))return e;if(3===n&&t===e){if("SOD"===e)return"NA";if("POT"===e)return"K";if("CES"===e)return"CS";if("CAL"===e)return"CA";if("CLA"===e)return"CL"}return jqe.has(e[0])?e[0]:""}const N5="ABCDEFGHIJKLMNOPQRSTUVWXYZ",vS=cte(function qqe(e){let n=e,r=0,i=N5[n%26];for(;n>=26;)n=Math.floor(n/26),i+=N5[n%26],r+=1;return r>=5&&console.warn("getChainId overflow"),i});function Wqe(e,t){const n=e.atomName,r=e.residueName,i=new Array(e.count),o=new Array(e.count),s=new Uint32Array(e.count),a=new Uint32Array(e.count),c=new Array(e.count),u=new sd,l=new ad(e.residueNumber,e.atomName);let d="",f=0,p="",m=0,h=0,g=-1;for(let x=0,_=e.count;x<_;++x){const S=e.residueNumber.value(x);if(S!==g){const A=e.residueName.value(x),E=Yh(l.add(A,x).type,A);(E!==h||S!==g+1&&!(99999===g&&0===S))&&(p=vS(f),f+=1,m=0),d=u.getEntityId(A,E,p),m+=1,g=S,h=E}i[x]=d,o[x]=p,s[x]=m,a[x]=x,c[x]=Pv(e.atomName.value(x),e.residueName.value(x))}const y=te.ofStringArray(o),b=Xn.ofPartialColumns(ks.atom_site,{auth_asym_id:y,auth_atom_id:n,auth_comp_id:r,auth_seq_id:e.residueNumber,Cartn_x:te.ofFloatArray(te.mapToArray(e.x,x=>10*x,Float32Array)),Cartn_y:te.ofFloatArray(te.mapToArray(e.y,x=>10*x,Float32Array)),Cartn_z:te.ofFloatArray(te.mapToArray(e.z,x=>10*x,Float32Array)),id:te.ofIntArray(a),label_asym_id:y,label_atom_id:n,label_comp_id:r,label_seq_id:te.ofIntArray(s),label_entity_id:te.ofStringArray(i),occupancy:te.ofConst(1,e.count,te.Schema.float),type_symbol:te.ofStringArray(c),pdbx_PDB_model_num:te.ofConst(t,e.count,te.Schema.int)},e.count);return $u({entity:u.getEntityTable(),chem_comp:l.getChemCompTable(),atom_site:b})}var F5;function Yqe(e,t){const n=(o,s)=>(t.substr(o,s)||"").trim(),r={entry_id:ft.ofString(e),length_a:ft.ofString(n(6,9)),length_b:ft.ofString(n(15,9)),length_c:ft.ofString(n(24,9)),angle_alpha:ft.ofString(n(33,7)),angle_beta:ft.ofString(n(40,7)),angle_gamma:ft.ofString(n(47,7)),Z_PDB:ft.ofString(n(66,4)),pdbx_unique_axis:ft.ofString("?")},i={entry_id:ft.ofString(e),"space_group_name_H-M":ft.ofString(n(55,11)),Int_Tables_number:ft.ofString("?"),cell_setting:ft.ofString("?"),space_group_name_Hall:ft.ofString("?")};return[ss.ofFields("cell",r),ss.ofFields("symmetry",i)]}function eoe(e,t){return{id:e,details:t,groups:[]}}function Xqe(e,t,n){const r=[];let i,o,s,a=1,c=1;const u=h=>e.data.substring(e.indices[2*h],e.indices[2*h+1]);for(let h=t;hh.id)),details:ft.ofStrings(r.map(h=>h.details))},d=[];for(const h of r)for(const g of h.groups)d.push({assembly_id:h.id,oper_expression:g.operators.map(y=>y.id).join(","),asym_id_list:g.chains.join(",")});const f={assembly_id:ft.ofStrings(d.map(h=>h.assembly_id)),oper_expression:ft.ofStrings(d.map(h=>h.oper_expression)),asym_id_list:ft.ofStrings(d.map(h=>h.asym_id_list))},p=[];for(const h of r)for(const g of h.groups)for(const y of g.operators){const b={id:""+y.id,type:"?",name:"?",symmetry_operation:"?"};for(let x=0;x<3;x++){for(let _=0;_<3;_++)b[`matrix[${x+1}][${_+1}]`]=""+le.getValue(y.matrix,x,_);b[`vector[${x+1}]`]=""+le.getValue(y.matrix,x,3)}p.push(b)}const m={id:ft.ofStrings(p.map(h=>h.id)),type:ft.ofStrings(p.map(h=>h.type)),name:ft.ofStrings(p.map(h=>h.name)),symmetry_operation:ft.ofStrings(p.map(h=>h.symmetry_operation))};for(let h=0;h<3;h++){for(let y=0;y<3;y++){const b=`matrix[${h+1}][${y+1}]`;m[b]=ft.ofStrings(p.map(x=>x[b]))}const g=`vector[${h+1}]`;m[g]=ft.ofStrings(p.map(y=>y[g]))}return[ss.ofFields("pdbx_struct_assembly",l),ss.ofFields("pdbx_struct_assembly_gen",f),ss.ofFields("pdbx_struct_oper_list",m)]}function Kqe(e,t,n){const r=[];let i;const o=u=>e.data.substring(e.indices[2*u],e.indices[2*u+1]);for(let u=t;uu.id)),code:ft.ofStrings(s.map(u=>u.code)),details:ft.ofStrings(s.map(u=>u.details))};for(let u=0;u<3;u++){for(let d=0;d<3;d++){const f=`matrix[${u+1}][${d+1}]`;c[f]=ft.ofStrings(s.map(p=>p[f]))}const l=`vector[${u+1}]`;c[l]=ft.ofStrings(s.map(d=>d[l]))}return[ss.ofFields("struct_ncs_oper",c)]}!function(e){e.is=function t(r){return"gro"===r?.kind},e.fromGro=function n(r){return{kind:"gro",name:r.structures[0].header.title,data:r}}}(F5||(F5={}));const Zqe={1:"helx_rh_al_p",2:"helx_rh_om_p",3:"helx_rh_pi_p",4:"helx_rh_ga_p",5:"helx_rh_3t_p",6:"helx_lh_al_p",7:"helx_lh_om_p",8:"helx_lh_ga_p",9:"helx_rh_27_p",10:"helx_rh_pp_p"};function Jqe(e,t,n){const r=[],i=l=>e.data.substring(e.indices[2*l],e.indices[2*l+1]);for(let l=t;ll.initChainID)),s=ft.ofStrings(r.map(l=>l.initResName)),a=ft.ofStrings(r.map(l=>l.endChainID)),c=ft.ofStrings(r.map(l=>l.endResName)),u={beg_label_asym_id:o,beg_label_comp_id:s,beg_label_seq_id:ft.ofUndefined(r.length,te.Schema.int),beg_auth_asym_id:o,beg_auth_comp_id:s,beg_auth_seq_id:ft.ofStrings(r.map(l=>l.initSeqNum)),conf_type_id:ft.ofStrings(r.map(l=>function Qqe(e){return Zqe[e]||"helx_p"}(l.helixClass))),details:ft.ofStrings(r.map(l=>l.comment)),end_label_asym_id:a,end_label_comp_id:c,end_label_seq_id:ft.ofUndefined(r.length,te.Schema.int),end_auth_asym_id:a,end_auth_comp_id:c,end_auth_seq_id:ft.ofStrings(r.map(l=>l.endSeqNum)),id:ft.ofStrings(r.map(l=>l.serNum)),pdbx_beg_PDB_ins_code:ft.ofStrings(r.map(l=>l.initICode)),pdbx_end_PDB_ins_code:ft.ofStrings(r.map(l=>l.endICode)),pdbx_PDB_helix_class:ft.ofStrings(r.map(l=>l.helixClass)),pdbx_PDB_helix_length:ft.ofStrings(r.map(l=>l.length)),pdbx_PDB_helix_id:ft.ofStrings(r.map(l=>l.helixID))};return ss.ofFields("struct_conf",u)}function eWe(e,t,n){const r=[],i=f=>e.data.substring(e.indices[2*f],e.indices[2*f+1]);for(let f=t;ff.initChainID)),s=ft.ofStrings(r.map(f=>f.initResName)),a=ft.ofStrings(r.map(f=>f.initSeqNum)),c=ft.ofStrings(r.map(f=>f.endChainID)),u=ft.ofStrings(r.map(f=>f.endResName)),l=ft.ofStrings(r.map(f=>f.endSeqNum)),d={beg_label_asym_id:o,beg_label_comp_id:s,beg_label_seq_id:a,beg_auth_asym_id:o,beg_auth_comp_id:s,beg_auth_seq_id:a,end_label_asym_id:c,end_label_comp_id:c,end_label_seq_id:l,end_auth_asym_id:c,end_auth_comp_id:u,end_auth_seq_id:l,id:ft.ofStrings(r.map(f=>f.strand)),sheet_id:ft.ofStrings(r.map(f=>f.sheetID)),pdbx_beg_PDB_ins_code:ft.ofStrings(r.map(f=>f.initICode)),pdbx_end_PDB_ins_code:ft.ofStrings(r.map(f=>f.endICode))};return ss.ofFields("struct_sheet_range",d)}const tWe={MOL_ID:"",MOLECULE:"",CHAIN:"",FRAGMENT:"",SYNONYM:"",EC:"",ENGINEERED:"",MUTATION:"",OTHER_DETAILS:""};function nWe(e,t,n){const r=c=>e.data.substring(e.indices[2*c],e.indices[2*c+1]);let i,o={chains:[],description:""};const s=[];for(let c=t;ce.data.substring(e.indices[2*o],e.indices[2*o+1]),i=new Map;for(let o=t;o=66?He.addToken(e.B_iso_or_equiv,ht.trim(n,r+60,r+66)):He.add(e.B_iso_or_equiv,0,0),o&&He.addToken(e.partial_charge,ht.trim(n,r+70,r+76)),a>=78&&!o?(ht.trim(n,r+76,r+78),n.tokenStart=78?(ht.trim(n,r+76,r+78),n.tokenStartHe.create(e,2*t);return{index:0,group_PDB:r(),id:[],auth_atom_id:r(),label_alt_id:r(),auth_comp_id:r(),auth_asym_id:r(),auth_seq_id:r(),pdbx_PDB_ins_code:r(),Cartn_x:r(),Cartn_y:r(),Cartn_z:r(),occupancy:r(),B_iso_or_equiv:r(),type_symbol:r(),pdbx_PDB_model_num:[],label_entity_id:[],partial_charge:r()}}(n,s),l=function sWe(e,t){const r=()=>new Float32Array(t),i=()=>He.create(e,2*t);return{index:0,count:t,id:[],type_symbol:i(),pdbx_label_atom_id:i(),pdbx_label_alt_id:i(),pdbx_label_comp_id:i(),pdbx_label_asym_id:i(),pdbx_label_seq_id:i(),pdbx_PDB_ins_code:i(),"U[1][1]":r(),"U[2][2]":r(),"U[3][3]":r(),"U[1][2]":r(),"U[1][3]":r(),"U[2][3]":r(),pdbx_auth_seq_id:i(),pdbx_auth_comp_id:i(),pdbx_auth_asym_id:i(),pdbx_auth_atom_id:i()}}(n,a),d=new sd,f=[],p=[];let g,m=0,h="",y=!1;const b=new Set;for(let I=0,R=t.count;Ie.data.substring(e.indices[2*E],e.indices[2*E+1]),s=[],a=[],c=[],u=[],l=[],d=[],f=[],p=[],m=[],h=[],g=[],y=[],b=[],x=[],_=[11,16,21,26];let S=1;for(let E=t;EM||void 0===I[M]&&(s.push(`covale${S}`),a.push("covale"),c.push(r.label_asym_id.str(D)),u.push(r.label_seq_id.int(D)),l.push(r.auth_seq_id.int(D)),d.push(r.label_atom_id.str(D)),f.push(r.label_alt_id.str(D)),p.push(r.pdbx_PDB_ins_code.str(D)),m.push(r.label_asym_id.str(M)),h.push(r.label_seq_id.int(M)),g.push(r.auth_seq_id.int(M)),y.push(r.label_atom_id.str(M)),b.push(r.label_alt_id.str(M)),x.push(r.pdbx_PDB_ins_code.str(M)),S+=1))}}const A={id:ft.ofStrings(s),conn_type_id:ft.ofStrings(a),ptnr1_label_asym_id:ft.ofStrings(c),ptnr1_label_seq_id:ft.ofNumbers(u),ptnr1_auth_seq_id:ft.ofNumbers(l),ptnr1_label_atom_id:ft.ofStrings(d),pdbx_ptnr1_label_alt_id:ft.ofStrings(f),pdbx_ptnr1_PDB_ins_code:ft.ofStrings(p),ptnr2_label_asym_id:ft.ofStrings(m),ptnr2_label_seq_id:ft.ofNumbers(h),ptnr2_auth_seq_id:ft.ofNumbers(g),ptnr2_label_atom_id:ft.ofStrings(y),pdbx_ptnr2_label_alt_id:ft.ofStrings(b),pdbx_ptnr2_PDB_ins_code:ft.ofStrings(x)};return ss.ofFields("struct_conn",A)}(t,g[0],g[1],w));const D={entity:ss.ofTable("entity",d.getEntityTable()),chem_comp:ss.ofTable("chem_comp",E.getChemCompTable()),atom_site:ss.ofFields("atom_site",w),atom_site_anisotrop:ss.ofFields("atom_site_anisotrop",aWe(l))};for(const I of f)D[I.name]=I;return{header:e.id||"PDB",categoryNames:Object.keys(D),categories:D}}),B5.apply(this,arguments)}var Mv,O5,L5;function mWe(e){return Object.keys(e).filter(t=>!isNaN(t)).map(t=>+t).sort((t,n)=>t-n).map(t=>e[t])}function U5(e,t,n){return e&&void 0!==e[t]?e[t]:n}function Je(e,...t){return{kind:"alias",aliases:t,symbol:e}}function BD(e,t,...n){return e.info.namespace="molscript-macro",e.id=`molscript-macro.${e.info.name}`,{kind:"macro",symbol:e,translate:t,aliases:[e.info.name,...n]}}function gWe(e){return"alias"===e.kind||"macro"===e.kind}!function(e){e.Descriptor={name:"atom_partial_charge"},e.Provider=td.create(e.Descriptor)}(Mv||(Mv={})),function(e){e.is=function t(r){return"pdb"===r?.kind},e.create=function n(r){return{kind:"pdb",name:r.id||"",data:r}}}(O5||(O5={})),function(e){e.is=function t(r){return"psf"===r?.kind},e.fromPsf=function n(r){return{kind:"psf",name:r.id,data:r}}}(L5||(L5={}));const yWe=[["Core symbols",Je(ye.core.type.bool,"bool"),Je(ye.core.type.num,"num"),Je(ye.core.type.str,"str"),Je(ye.core.type.regex,"regex"),Je(ye.core.type.list,"list"),Je(ye.core.type.set,"set"),Je(ye.core.type.compositeKey,"composite-key"),Je(ye.core.logic.not,"not"),Je(ye.core.logic.and,"and"),Je(ye.core.logic.or,"or"),Je(ye.core.ctrl.if,"if"),Je(ye.core.ctrl.fn,"fn"),Je(ye.core.ctrl.eval,"eval"),Je(ye.core.math.add,"add","+"),Je(ye.core.math.sub,"sub","-"),Je(ye.core.math.mult,"mult","*"),Je(ye.core.math.div,"div","/"),Je(ye.core.math.pow,"pow","**"),Je(ye.core.math.mod,"mod"),Je(ye.core.math.min,"min"),Je(ye.core.math.max,"max"),Je(ye.core.math.cantorPairing,"cantor-pairing"),Je(ye.core.math.sortedCantorPairing,"sorted-cantor-pairing"),Je(ye.core.math.invertCantorPairing,"invert-cantor-pairing"),Je(ye.core.math.floor,"floor"),Je(ye.core.math.ceil,"ceil"),Je(ye.core.math.roundInt,"round"),Je(ye.core.math.trunc,"trunc"),Je(ye.core.math.abs,"abs"),Je(ye.core.math.sign,"sign"),Je(ye.core.math.sqrt,"sqrt"),Je(ye.core.math.cbrt,"cbrt"),Je(ye.core.math.sin,"sin"),Je(ye.core.math.cos,"cos"),Je(ye.core.math.tan,"tan"),Je(ye.core.math.asin,"asin"),Je(ye.core.math.acos,"acos"),Je(ye.core.math.atan,"atan"),Je(ye.core.math.sinh,"sinh"),Je(ye.core.math.cosh,"cosh"),Je(ye.core.math.tanh,"tanh"),Je(ye.core.math.exp,"exp"),Je(ye.core.math.log,"log"),Je(ye.core.math.log10,"log10"),Je(ye.core.math.atan2,"atan2"),Je(ye.core.rel.eq,"eq","="),Je(ye.core.rel.neq,"neq","!="),Je(ye.core.rel.lt,"lt","<"),Je(ye.core.rel.lte,"lte","<="),Je(ye.core.rel.gr,"gr",">"),Je(ye.core.rel.gre,"gre",">="),Je(ye.core.rel.inRange,"in-range"),Je(ye.core.str.concat,"concat"),Je(ye.core.str.match,"regex.match"),Je(ye.core.list.getAt,"list.get"),Je(ye.core.set.has,"set.has"),Je(ye.core.set.isSubset,"set.subset")],["Structure",["Types",Je(ye.structureQuery.type.entityType,"ent-type"),Je(ye.structureQuery.type.authResidueId,"auth-resid"),Je(ye.structureQuery.type.labelResidueId,"label-resid"),Je(ye.structureQuery.type.ringFingerprint,"ringfp"),Je(ye.structureQuery.type.bondFlags,"bond-flags")],["Slots",Je(ye.structureQuery.slot.elementSetReduce,"atom.set.reduce.value")],["Generators",Je(ye.structureQuery.generator.atomGroups,"sel.atom.atom-groups"),Je(ye.structureQuery.generator.queryInSelection,"sel.atom.query-in-selection"),Je(ye.structureQuery.generator.rings,"sel.atom.rings"),Je(ye.structureQuery.generator.empty,"sel.atom.empty"),Je(ye.structureQuery.generator.all,"sel.atom.all"),Je(ye.structureQuery.generator.bondedAtomicPairs,"sel.atom.bonded-pairs"),BD(o2("sel.atom.atoms",Ot.Dictionary({0:ct(Ae.Bool,{isOptional:!0,defaultValue:!0,description:"Test applied to each atom."})}),wt.ElementSelection,"A selection of singleton atom sets."),e=>ue.struct.generator.atomGroups({"atom-test":U5(e,0,!0)})),BD(o2("sel.atom.res",Ot.Dictionary({0:ct(Ae.Bool,{isOptional:!0,defaultValue:!0,description:"Test applied to the 1st atom of each residue."})}),wt.ElementSelection,"A selection of atom sets grouped by residue."),e=>ue.struct.generator.atomGroups({"residue-test":U5(e,0,!0),"group-by":ue.ammp("residueKey")})),BD(o2("sel.atom.chains",Ot.Dictionary({0:ct(Ae.Bool,{isOptional:!0,defaultValue:!0,description:"Test applied to the 1st atom of each chain."})}),wt.ElementSelection,"A selection of atom sets grouped by chain."),e=>ue.struct.generator.atomGroups({"chain-test":U5(e,0,!0),"group-by":ue.ammp("chainKey")}))],["Modifiers",Je(ye.structureQuery.modifier.queryEach,"sel.atom.query-each"),Je(ye.structureQuery.modifier.intersectBy,"sel.atom.intersect-by"),Je(ye.structureQuery.modifier.exceptBy,"sel.atom.except-by"),Je(ye.structureQuery.modifier.unionBy,"sel.atom.union-by"),Je(ye.structureQuery.modifier.union,"sel.atom.union"),Je(ye.structureQuery.modifier.cluster,"sel.atom.cluster"),Je(ye.structureQuery.modifier.includeSurroundings,"sel.atom.include-surroundings"),Je(ye.structureQuery.modifier.surroundingLigands,"sel.atom.surrounding-ligands"),Je(ye.structureQuery.modifier.includeConnected,"sel.atom.include-connected"),Je(ye.structureQuery.modifier.expandProperty,"sel.atom.expand-property")],["Filters",Je(ye.structureQuery.filter.pick,"sel.atom.pick"),Je(ye.structureQuery.filter.first,"sel.atom.first"),Je(ye.structureQuery.filter.withSameAtomProperties,"sel.atom.with-same-atom-properties"),Je(ye.structureQuery.filter.intersectedBy,"sel.atom.intersected-by"),Je(ye.structureQuery.filter.within,"sel.atom.within"),Je(ye.structureQuery.filter.isConnectedTo,"sel.atom.is-connected-to")],["Combinators",Je(ye.structureQuery.combinator.intersect,"sel.atom.intersect"),Je(ye.structureQuery.combinator.merge,"sel.atom.merge"),Je(ye.structureQuery.combinator.distanceCluster,"sel.atom.dist-cluster")],["Atom Set Properties",Je(ye.structureQuery.atomSet.atomCount,"atom.set.atom-count"),Je(ye.structureQuery.atomSet.countQuery,"atom.set.count-query"),Je(ye.structureQuery.atomSet.reduce,"atom.set.reduce"),Je(ye.structureQuery.atomSet.propertySet,"atom.set.property")],["Atom Properties",Je(ye.structureQuery.atomProperty.core.elementSymbol,"atom.el"),Je(ye.structureQuery.atomProperty.core.vdw,"atom.vdw"),Je(ye.structureQuery.atomProperty.core.mass,"atom.mass"),Je(ye.structureQuery.atomProperty.core.atomicNumber,"atom.atomic-number"),Je(ye.structureQuery.atomProperty.core.x,"atom.x"),Je(ye.structureQuery.atomProperty.core.y,"atom.y"),Je(ye.structureQuery.atomProperty.core.z,"atom.z"),Je(ye.structureQuery.atomProperty.core.sourceIndex,"atom.src-index"),Je(ye.structureQuery.atomProperty.core.operatorName,"atom.op-name"),Je(ye.structureQuery.atomProperty.core.operatorKey,"atom.op-key"),Je(ye.structureQuery.atomProperty.core.modelIndex,"atom.model-index"),Je(ye.structureQuery.atomProperty.core.modelLabel,"atom.model-label"),Je(ye.structureQuery.atomProperty.core.atomKey,"atom.key"),Je(ye.structureQuery.atomProperty.core.bondCount,"atom.bond-count"),Je(ye.structureQuery.atomProperty.topology.connectedComponentKey,"atom.key.molecule"),Je(ye.structureQuery.atomProperty.macromolecular.authResidueId,"atom.auth-resid"),Je(ye.structureQuery.atomProperty.macromolecular.labelResidueId,"atom.label-resid"),Je(ye.structureQuery.atomProperty.macromolecular.residueKey,"atom.key.res"),Je(ye.structureQuery.atomProperty.macromolecular.chainKey,"atom.key.chain"),Je(ye.structureQuery.atomProperty.macromolecular.entityKey,"atom.key.entity"),Je(ye.structureQuery.atomProperty.macromolecular.isHet,"atom.is-het"),Je(ye.structureQuery.atomProperty.macromolecular.id,"atom.id"),Je(ye.structureQuery.atomProperty.macromolecular.label_atom_id,"atom.label_atom_id"),Je(ye.structureQuery.atomProperty.macromolecular.label_alt_id,"atom.label_alt_id","atom.altloc"),Je(ye.structureQuery.atomProperty.macromolecular.label_comp_id,"atom.label_comp_id"),Je(ye.structureQuery.atomProperty.macromolecular.label_asym_id,"atom.label_asym_id"),Je(ye.structureQuery.atomProperty.macromolecular.label_entity_id,"atom.label_entity_id"),Je(ye.structureQuery.atomProperty.macromolecular.label_seq_id,"atom.label_seq_id"),Je(ye.structureQuery.atomProperty.macromolecular.auth_atom_id,"atom.auth_atom_id","atom.name"),Je(ye.structureQuery.atomProperty.macromolecular.auth_comp_id,"atom.auth_comp_id","atom.resname"),Je(ye.structureQuery.atomProperty.macromolecular.auth_asym_id,"atom.auth_asym_id","atom.chain"),Je(ye.structureQuery.atomProperty.macromolecular.auth_seq_id,"atom.auth_seq_id","atom.resno"),Je(ye.structureQuery.atomProperty.macromolecular.pdbx_PDB_ins_code,"atom.pdbx_PDB_ins_code","atom.inscode"),Je(ye.structureQuery.atomProperty.macromolecular.pdbx_formal_charge,"atom.pdbx_formal_charge"),Je(ye.structureQuery.atomProperty.macromolecular.occupancy,"atom.occupancy"),Je(ye.structureQuery.atomProperty.macromolecular.B_iso_or_equiv,"atom.B_iso_or_equiv","atom.bfactor"),Je(ye.structureQuery.atomProperty.macromolecular.entityType,"atom.entity-type"),Je(ye.structureQuery.atomProperty.macromolecular.entitySubtype,"atom.entity-subtype"),Je(ye.structureQuery.atomProperty.macromolecular.entityPrdId,"atom.entity-prd-id"),Je(ye.structureQuery.atomProperty.macromolecular.entityDescription,"atom.entity-description"),Je(ye.structureQuery.atomProperty.macromolecular.objectPrimitive,"atom.object-primitive"),Je(ye.structureQuery.atomProperty.macromolecular.chemCompType,"atom.chem-comp-type"),Je(ye.structureQuery.atomProperty.macromolecular.secondaryStructureKey,"atom.key.sec-struct"),Je(ye.structureQuery.atomProperty.macromolecular.isModified,"atom.is-modified"),Je(ye.structureQuery.atomProperty.macromolecular.modifiedParentName,"atom.modified-parent")],["Bond Properties",Je(ye.structureQuery.bondProperty.order,"bond.order"),Je(ye.structureQuery.bondProperty.length,"bond.length"),Je(ye.structureQuery.bondProperty.key,"bond.key"),Je(ye.structureQuery.bondProperty.atomA,"bond.atom-a"),Je(ye.structureQuery.bondProperty.atomB,"bond.atom-b"),BD(o2("bond.is",Ot.List(wt.BondFlag),Ae.Bool,`Test if the current bond has at least one (or all if partial = false) of the specified flags: ${Ae.oneOfValues(wt.BondFlag).join(", ")}`),e=>ue.core.flags.hasAny([ue.struct.bondProperty.flags(),ue.struct.type.bondFlags(mWe(e))]))]]],noe=[];!function roe(e){for(const t of e)gWe(t)?noe.push(t):t instanceof Array&&roe(t)}(yWe);const OD=function(){const e=[],t=Object.create(null),n=kr.create(),r=kr.create();for(const i of noe){for(const s of i.aliases){if(e.push([s,i]),t[s])throw new Error(`Alias '${s}' already in use.`);t[s]=i}const o=i.symbol.args;if("dictionary"===o.kind)for(const s of Object.keys(o.map)){isNaN(s)&&kr.add(n,s,s);const a=o.map[s];"oneof"===a.type.kind&&Ae.oneOfValues(a.type).forEach(c=>kr.add(r,c,c))}else"oneof"===o.type.kind&&Ae.oneOfValues(o.type).forEach(s=>kr.add(r,s,s))}return{symbolList:e,symbolMap:t,namedArgs:n.array,constants:r.array}}(),Rv=OD.symbolMap;function _S(e){if(as.isLiteral(e))return e;if(as.isSymbol(e)){if(!Rv[e.name])return e;const s=Rv[e.name];if("alias"===s.kind)return as.Symbol(Rv[e.name].symbol.id);throw s.translate([])}const t=as.isSymbol(e.head)&&!!Rv[e.head.name]&&"macro"===Rv[e.head.name].kind,n=t?e.head:_S(e.head),r=n!==e.head;if(!e.args)return t?_S(e.head):r?as.Apply(n):e;let o,i=!1;if(as.isArgumentsArray(e.args)){o=[];for(let s=0,a=e.args.length;s12?"...'":"'";return` at line ${n.line} column ${n.column}, got ${r>0?"'...":"'"}${e.slice(r,r+12)}${o}`}(e,t)}`}(t,n);throw new Error(r)}}or(t){return Be.alt(this,t)}trim(t){return this.wrap(t,t)}wrap(t,n){return V5(1,"string"==typeof t?Be.string(t):t,this,"string"==typeof n?Be.string(n):n)}thru(t){return t(this)}then(t){return V5(1,this,t)}many(){return new Be((t,n)=>{const r=[];let i;for(;;){if(i=pl(this._(t,n),i),!i.status)return pl(Sa(n,r),i);if(n===i.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");n=i.index,r.push(i.value)}})}times(t,n){const r=typeof n>"u"?t:n;return new Be((i,o)=>{const s=[];let a,c,u;for(u=0;ut)}atMost(t){return this.times(0,t)}atLeast(t){return Be.seq(this.times(t),this.many()).map(n=>[...n[0],...n[1]])}map(t){return new Be((n,r)=>{const i=this._(n,r);return i.status?pl(Sa(i.index,t(i.value)),i):i})}skip(t){return V5(0,this,t)}mark(){return Be.seq(Be.index,this,Be.index).map(t=>({start:t[0],value:t[1],end:t[2]}))}node(t){return Be.seq(Be.index,this,Be.index).map(n=>({name:t,start:n[0],value:n[1],end:n[2]}))}sepBy(t){return Be.sepBy(this,t)}sepBy1(t){return Be.sepBy1(this,t)}lookahead(t){return this.skip(Be.lookahead(t))}notFollowedBy(t){return this.skip(Be.notFollowedBy(t))}desc(t){return new Be((n,r)=>{const i=this._(n,r);return i.status||(i.expected=[t]),i})}fallback(t){return this.or(Be.succeed(t))}ap(t){return Be.seq(t,this).map(([n,r])=>n(r))}chain(t){return new Be((n,r)=>{const i=this._(n,r);return i.status?pl(t(i.value)._(n,i.index),i):i})}}function V5(e,...t){const n=t.length;return new Be((r,i)=>{let o,s,a=i;for(let c=0;ct.furthest)return e;const n=e.furthest===t.furthest?function SWe(e,t){const n=e.length,r=t.length;if(0===n)return t;if(0===r)return e;const i=new Set,o=[];for(let s=0;s{let T;const M=new Array(D);let N=R;for(let V=0;V{let T;for(let M=0;M[R[0],...R[1]])}function a(w){const D=`'${w}'`;if(1===w.length){const I=w.charCodeAt(0);return new e((R,T)=>R.charCodeAt(T)===I?Sa(T+1,w):$p(T,D))}return new e((I,R)=>{const T=R+w.length;return I.slice(R,T)===w?Sa(T,w):$p(R,D)})}function l(w,D=0){const I=function u(w){return RegExp("^(?:"+w.source+")",function c(w){const D=""+w;return D.slice(D.lastIndexOf("/")+1)}(w))}(w),R=""+w;return new e((T,M)=>{const N=I.exec(T.slice(M));return N?0<=D&&D<=N.length?Sa(M+N[0].length,N[D]):$p(M,`invalid match group (0 to ${N.length}) in ${R}`):$p(M,R)})}function d(w){return new e((D,I)=>Sa(I,w))}function f(w){return new e((D,I)=>$p(I,w))}function h(w){return new e((D,I)=>{const R=D.charAt(I);return I{const T=w()._;return D._=T,T(I,R)});return D}e.seqMap=function t(w,D,I){const R=[].slice.call(arguments);if(0===R.length)throw new Error("seqMap needs at least one argument");const T=R.pop();return function wWe(e){if("function"!=typeof e)throw new Error("not a function: "+e)}(T),r.apply(null,R).map(function(M){return T.apply(null,M)})},e.createLanguage=function n(w){const D={};for(const I of Object.keys(w))!function(R){D[R]=_(()=>w[R](D))}(I);return D},e.seq=r,e.alt=i,e.sepBy=function o(w,D){return s(w,D).or(d([]))},e.sepBy1=s,e.string=a,e.regexp=l,e.succeed=d,e.fail=f,e.lookahead=function p(w){if(function CWe(e){return e instanceof Be}(w))return new e((D,I)=>{const R=w._(D,I);return R.status&&(R.index=I,R.value=null),R});if("string"==typeof w)return p(a(w));if(w instanceof RegExp)return p(l(w));throw new Error("not a string, regexp, or parser: "+w)},e.notFollowedBy=function m(w){return new e((D,I)=>{const R=w._(D,I);return R.status?$p(I,'not "'+D.slice(I,R.index)+'"'):Sa(I,null)})},e.test=h,e.oneOf=function g(w){return h(D=>w.indexOf(D)>=0)},e.noneOf=function y(w){return h(D=>w.indexOf(D)<0)},e.range=function b(w,D){return h(I=>w<=I&&I<=D).desc(w+"-"+D)},e.takeWhile=function x(w){return new e((D,I)=>{let R=I;for(;RD>=w.length?$p(D,"any character"):Sa(D+1,w.charAt(D))),e.all=new e(function(w,D){return Sa(w.length,w.slice(D))}),e.eof=new e(function(w,D){return DBe.alt(i,d,o,s).trim(n)),i=Be.takeWhile(_=>"`"!==_).trim("`").map(t.str),o=Be.regexp(/[^()\[\]{};`,\n\r\s]+/).map(t.symb),s=Be.regexp(/\s*;+([^\n\r]*)\n/,1).map(t.comment),a=r.many(),c=a.wrap("(",")").map(_=>t.list("(",_)),u=a.wrap("[","]").map(_=>t.list("[",_)),l=a.wrap("{","}").map(_=>t.list("{",_)),d=Be.alt(c,u,l),f=r.many();function m(_){switch(_.kind){case"string":return _.value;case"symbol":{const S=_.value;if(S.length>1)switch(S.charAt(0)){case".":return ue.atomName(S.substr(1));case"_":return ue.struct.type.elementSymbol([S.substr(1)])}return"true"===S||"false"!==S&&(function b(_){return/-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?/.test(_)&&!isNaN(+_)}(S)?+S:as.Symbol(S))}case"list":switch(_.bracket){case"[":return ue.core.type.list(y(_.nodes).map(m));case"{":return ue.core.type.set(y(_.nodes).map(m));case"(":{if("comment"===_.nodes[0].kind)throw new Error("Invalid expression");const S=m(_.nodes[0]);return as.Apply(S,function h(_){if(_.length<=1)return;if(!function g(_){for(let S=1,A=_.length;S1&&":"===E.value.charAt(0))return!0}return!1}(_)){const w=[];for(let D=1,I=_.length;D1&&":"===I.value.charAt(0)){const R=I.value.substr(1);for(++w;w=D)throw new Error(`There must be a value foolowed a named arg ':${R}'.`);if("comment"===_[w].kind)throw new Error("Invalid expression");S[R]=m(_[w]),isNaN(+R)&&(A=!1)}else S[E++]=m(I)}if(A){const w=Object.keys(S).map(I=>+I).sort((I,R)=>I-R);let D=!0;for(let I=0,R=w.length;I"comment"!==A.kind):_}e.parse=function x(_){const S=function p(_){return f.tryParse(_)}(_),A=[];for(const E of S)"comment"!==E.kind&&(A[A.length]=m(E));return A}}(z5||(z5={}));const $r=ue;function Ca(e,t,n){const r=Be.lazy(()=>Be.seq(e,r).map(i=>n(...i)).or(t));return r}function LD(e,t,n){return Be.seqMap(t,e.many(),(r,i)=>i.reduce((o,s)=>n(s,o),r))}function sc(e,t,n){return Be.seqMap(t,Be.seq(e,t).many(),(r,i)=>i.reduce((o,s)=>{const[a,c]=s;return n(a,o,c)},r))}function xS(e,t){return e.reduce((r,i)=>{const o=i.isUnsupported?bm(`operator '${i.name}' not supported`):i.map;return i.type(i.rule,r,o)},t)}function Yp(e,t=0){return Be.optWhitespace.then(Be.regexp(e,t).skip(Be.optWhitespace))}function xu(e,t=0){return Be.regexp(e,t).skip(Be.optWhitespace)}function UD(e,t=0){return Be.optWhitespace.then(Be.regexp(e,t))}function G5(e,t){const n=t?`${e}|${s2(t)}`:e;return Yp(RegExp(`(${n})\\s+([-+]?[0-9]*\\.?[0-9]+)\\s+OF`,"i"),2).map(parseFloat)}function bm(e){return function(){throw new Error(e)}}function j5(e){return 1===e.length?e[0]:e.length>1?$r.core.logic.and(e):void 0}function H5(e,t){if(!t||void 0===t.op||void 0===t.val)return t&&void 0!==t.flags?$r.core.flags.hasAny([e,t.flags]):t&&void 0!==t.min&&void 0!==t.max?$r.core.rel.inRange([e,t.min,t.max]):Array.isArray(t)?t.length>1?$r.core.set.has([$r.core.type.set(t),e]):$r.core.rel.eq([e,t[0]]):$r.core.rel.eq([e,t]);{const n=[e,t.val];switch(t.op){case"=":return $r.core.rel.eq(n);case"!=":return $r.core.rel.neq(n);case">":return $r.core.rel.gr(n);case"<":return $r.core.rel.lt(n);case">=":return $r.core.rel.gre(n);case"<=":return $r.core.rel.lte(n);default:throw new Error(`operator '${t.op}' not supported`)}}}function Su(e){return $r.struct.generator.queryInSelection({0:e,query:$r.struct.generator.all(),"in-complement":!0})}function vf(e,t){return e.length{const r=e[n],i=bm(`property '${n}' not supported`),o=Be.regexp(r.regex).map(c=>(r.isUnsupported&&i(),H5(r.property,r.map(c)))),s=Be.regexp(q5(n,r.abbr)).trim(Be.optWhitespace),a=c=>$r.struct.generator.atomGroups({[r.level]:c});t.push(r.isNumeric?s.then(Be.seq(Be.regexp(/>=|<=|=|!=|>|(r.isUnsupported&&i(),H5(r.property,{op:c[0],val:c[1]}))).map(a):s.then(o).map(a))}),t}function W5(e){const t=[];return Object.keys(e).sort(vf).forEach(n=>{const r=e[n],i=r.map?r.map:bm(`keyword '${n}' not supported`),o=Be.regexp(q5(n,r.abbr)).map(i);t.push(o)}),t}function $5(e,t){const n=[];return Object.keys(e).sort(vf).forEach(r=>{const i=e[r],o=bm(`property '${r}' not supported`),s=Be.regexp(q5(r,i.abbr)).lookahead(t).map(()=>(i.isUnsupported&&o(),i.property));n.push(s)}),n}function Y5(e,t,n,r){const i=[];for(const o in e)i.push(o),e[o].abbr&&i.push(...e[o].abbr);for(const o in t)i.push(o),t[o].abbr&&i.push(...t[o].abbr);return n.forEach(o=>{i.push(o.name),o.abbr&&i.push(...o.abbr)}),i}function _f(e){return $r.core.type.set(e.map($r.atomName))}function xf(e){return $r.struct.generator.queryInSelection({0:e,query:$r.struct.generator.all()})}function SS(e,t,n){switch(e.head.name){case"structure-query.atom-property.macromolecular.label_atom_id":return $r.atomName(t);case"structure-query.atom-property.core.element-symbol":return $r.es(t);case"structure-query.atom-property.macromolecular.secondary-structure-flags":return n&&(t=[n[t.toUpperCase()]||"none"]),$r.struct.type.secondaryStructureFlags([t]);default:return t}}const EWe=["entityKey","label_entity_id","entityType"],PWe=["chainKey","label_asym_id","label_entity_id","auth_asym_id","entityType"],MWe=["residueKey","label_comp_id","label_seq_id","auth_comp_id","auth_seq_id","pdbx_formal_charge","secondaryStructureKey","secondaryStructureFlags","isModified","modifiedParentName"];function RWe(e){if(e.head.name.startsWith("structure-query.atom-property.macromolecular.")){const t=e.head.name.substr(45);if(EWe.includes(t))return"entity-test";if(PWe.includes(t))return"chain-test";if(MWe.includes(t))return"residue-test"}return"atom-test"}const kWe=["structure-query.atom-property.macromolecular.secondary-structure-flags"];function er(e){return $r.struct.generator.atomGroups({"residue-test":$r.core.set.has([$r.core.type.set(e),$r.ammp("label_comp_id")])})}const xo=ue,hl=/[-+]?[0-9]*\.?[0-9]+/,CS=/[0-9]+/;function Qt(e){return e}const FWe={none:"none",turn:"turn",sheet:"beta",helix:"helix",dna:"dna",rna:"rna",carbohydrate:"carbohydrate",helix310:"3-10",helixalpha:"alpha",helixpi:"pi",0:"none",1:"turn",2:"beta",3:"helix",4:"dna",5:"rna",6:"carbohydrate",7:"3-10",8:"alpha",9:"pi"};function aoe(e){if(e.head){if(e.head.name&&"core.type.regex"===e.head.name&&(e=e.args[0].replace(/^\^|\$$/g,"")),e=FWe[e.toString().toLowerCase()]||"none",-1!==["dna","rna","carbohydrate"].indexOf(e))throw new Error("values 'dna', 'rna', 'carbohydrate' not yet supported for 'structure' property");return xo.struct.type.secondaryStructureFlags([e])}}const coe={adpmax:{"@desc":"the maximum anisotropic displacement parameter for the selected atom","@examples":[""],isUnsupported:!0,regex:hl,map:e=>parseFloat(e),level:"atom-test"},adpmin:{"@desc":"the minimum anisotropic displacement parameter for the selected atom","@examples":[""],isUnsupported:!0,regex:hl,map:e=>parseFloat(e),level:"atom-test"},altloc:{"@desc":"PDB alternate location identifier","@examples":["altloc = A"],regex:/[a-zA-Z0-9]/,map:Qt,level:"atom-test",property:xo.ammp("label_alt_id")},altname:{"@desc":"an alternative name given to atoms by some file readers (for example, P2N)","@examples":[""],isUnsupported:!0,regex:/[a-zA-Z0-9]/,map:Qt,level:"atom-test"},atomID:{"@desc":"special atom IDs for PDB atoms assigned by Jmol","@examples":[""],isUnsupported:!0,regex:CS,map:e=>parseInt(e),level:"atom-test"},atomIndex:{"@desc":"atom 0-based index; a unique number for each atom regardless of the number of models loaded","@examples":[""],isUnsupported:!0,regex:CS,map:e=>parseInt(e),level:"atom-test"},atomName:{"@desc":"atom name","@examples":["atomName = CA"],regex:/[a-zA-Z0-9]+/,map:e=>xo.atomName(e),level:"atom-test",property:xo.ammp("label_atom_id")},atomno:{"@desc":'sequential number; you can use "@" instead of "atomno=" -- for example, select @33 or Var x = @33 or @35',"@examples":[""],isUnsupported:!0,regex:CS,map:e=>parseInt(e),level:"atom-test"},atomType:{"@desc":"atom type (mol2, AMBER files) or atom name (other file types)","@examples":["atomType = OH"],regex:/[a-zA-Z0-9]+/,map:e=>xo.atomName(e),level:"atom-test",property:xo.ammp("label_atom_id")},atomX:{"@desc":"Cartesian X coordinate (or just X)","@examples":["x = 4.2"],abbr:["X"],isNumeric:!0,regex:hl,map:e=>parseFloat(e),level:"atom-test",property:xo.acp("x")},atomY:{"@desc":"Cartesian Y coordinate (or just Y)","@examples":["y < 42"],abbr:["Y"],isNumeric:!0,regex:hl,map:e=>parseFloat(e),level:"atom-test",property:xo.acp("y")},atomZ:{"@desc":"Cartesian Z coordinate (or just Z)","@examples":["Z > 10"],abbr:["Z"],isNumeric:!0,regex:hl,map:e=>parseFloat(e),level:"atom-test",property:xo.acp("z")},bondcount:{"@desc":"covalent bond count","@examples":["bondcount = 0"],isNumeric:!0,regex:CS,map:e=>parseInt(e),level:"atom-test",property:xo.acp("bondCount")},bondingRadius:{"@desc":"radius used for auto bonding; synonymous with ionic and ionicRadius","@examples":[""],abbr:["ionic","ionicRadius"],isUnsupported:!0,regex:hl,map:e=>parseFloat(e),level:"atom-test"},cell:{"@desc":'crystallographic unit cell, expressed either in lattice integer notation (111-999) or as a coordinate in ijk space, where {1 1 1} is the same as 555. ANDing two cells, for example select cell=555 and cell=556, selects the atoms on the common face. (Note: in the specifc case of CELL, only "=" is allowed as a comparator.)',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},configuration:{"@desc":'Only in the context {configuration=n}, this option selects the set of atoms with either no ALTLOC specified or those atoms having this index into the array of altlocs within its model. So, for example, if the model has altloc "A" and "B", select configuration=1 is equivalent to select altloc="" or altloc="A", and print {configuration=2} is equivalent to print {altloc="" or altloc="B"}. Configuration 0 is "all atoms in a model having configurations", and an invalid configuration number gives no atoms. (Note: in the specifc case of CONFIGURATION, only "=" is allowed as a comparator.)',"@examples":[""],isUnsupported:!0,regex:CS,map:e=>parseInt(e),level:"atom-test"},chain:{"@desc":'protein chain. For newer CIF files allowing multicharacter chain specifications, use quotations marks: select chain="AA". For these multicharacter desigations, case is not checked unless the CIF file has lower-case chain designations.',"@examples":["chain = A",'chain = "AA"'],regex:/[a-zA-Z0-9]+/,map:Qt,level:"chain-test",property:xo.ammp("auth_asym_id")},chainNo:{"@desc":'chain number; sequentially counted from 1 for each model; chainNo == 0 means"no chain" or PDB chain identifier indicated as a blank (Jmol 14.0).',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},color:{"@desc":"the atom color","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},covalentRadius:{"@desc":"covalent bonding radius, synonymous with covalent. Not used by Jmol, but could be used, for example, in {*}.spacefill={*}.covalentRadius.all.","@examples":[""],abbr:["covalent"],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},cs:{"@desc":"chemical shift calculated using computational results that include magnetic shielding tensors.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},element:{"@desc":'element symbol. The value of this parameter depends upon the context. Used with select structure=x, x can be either the quoted element symbol, "H", "He", "Li", etc. or atomic number. In all other contexts, the value is the element symbol. When the atom is a specific isotope, the string will contain the isotope number -- "13C", for example.',"@examples":["element=Fe"],regex:/[a-zA-Z]+/,map:e=>xo.es(e),level:"atom-test",property:xo.acp("elementSymbol")},elemno:{"@desc":"atomic element number","@examples":["elemno=8"],regex:/[0-9\s{}-]+/,map:e=>parseInt(e),level:"atom-test",property:xo.acp("atomicNumber")},eta:{"@desc":"Based on Carlos M. Duarte, Leven M. Wadley, and Anna Marie Pyle, RNA structure comparison, motif search and discovery using a reduced representation of RNA conformational space, Nucleic Acids Research, 2003, Vol. 31, No. 16 4755-4761. The parameter eta is the C4'[i-1]-P[i]-C4'[i]-P[i+1] dihedral angle; theta is the P[i]-C4'[i]-P[i+1]-C4'[i+1] dihedral angle. Both are measured on a 0-360 degree scale because they are commonly near 180 degrees. Using the commands plot PROPERTIES eta theta resno; select visible;wireframe only one can create these authors' \"RNA worm\" graph.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},theta:{"@desc":"Based on Carlos M. Duarte, Leven M. Wadley, and Anna Marie Pyle, RNA structure comparison, motif search and discovery using a reduced representation of RNA conformational space, Nucleic Acids Research, 2003, Vol. 31, No. 16 4755-4761. The parameter eta is the C4'[i-1]-P[i]-C4'[i]-P[i+1] dihedral angle; theta is the P[i]-C4'[i]-P[i+1]-C4'[i+1] dihedral angle. Both are measured on a 0-360 degree scale because they are commonly near 180 degrees. Using the commands plot PROPERTIES eta theta resno; select visible;wireframe only one can create these authors' \"RNA worm\" graph.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},file:{"@desc":"file number containing this atom","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},formalCharge:{"@desc":"formal charge","@examples":["formalCharge=1"],regex:hl,map:e=>parseFloat(e),level:"atom-test",property:xo.ammp("pdbx_formal_charge")},format:{"@desc":"format (label) of the atom.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},fXyz:{"@desc":"fractional XYZ coordinates","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},fX:{"@desc":"fractional X coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},fY:{"@desc":"fractional Y coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},fZ:{"@desc":"fractional Z coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},fuxyz:{"@desc":"fractional XYZ coordinates in the unitcell coordinate system","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},fux:{"@desc":"fractional X coordinate in the unitcell coordinate system","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},fuy:{"@desc":"fractional Y coordinate in the unitcell coordinate system","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},fuz:{"@desc":"fractional Z coordinate in the unit cell coordinate system","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},group:{"@desc":"3-letter residue code","@examples":["group = ALA"],regex:/[a-zA-Z0-9]{1,3}/,map:Qt,level:"residue-test",property:xo.ammp("label_comp_id")},group1:{"@desc":"single-letter residue code (amino acids only)","@examples":["group1 = G"],regex:/[a-zA-Z]/,map:Qt,level:"residue-test",property:xo.ammp("label_comp_id")},groupID:{"@desc":"group ID number: A unique ID for each amino acid or nucleic acid residue in a PDB file. 0 noGroup 1-5 ALA, ARG, ASN, ASP, CYS 6-10 GLN, GLU, GLY, HIS, ILE 11-15 LEU, LYS, MET, PHE, PRO 16-20 SER, THR, TRP, TYR, VAL 21-23 ASX, GLX, UNK 24-29 A, +A, G, +G, I, +I 30-35 C, +C, T, +T, U, +U Additional unique numbers are assigned arbitrarily by Jmol and cannot be used reproducibly.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},groupindex:{"@desc":"overall group index","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},hydrophobicity:{"@desc":"Aminoacid residue scale of hydrophobicity based on Rose, G. D., Geselowitz, A. R., Lesser, G. J., Lee, R. H., and Zehfus, M. H. (1985). Hydrophobicity of amino acid residues in globular proteins, Science, 229(4716):834-838.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},identify:{"@desc":"for a PDB/mmCIF file, a label such as [ILE]7^1:A.CD1%A/3 #47, which includes the group ([ILE]), residue number with optional insertion code (7^1), chain (:A), atom name (CD1), alternate location if present (%A), PDB model number (/3, for NMR models when one file is loaded; /file.model such as /2.3 if more than one file is loaded), and atom number (#47). For non-PDB data, the information is shorter -- for example, H15/2.1 #6, indicating atom name (H15), full file.model number (/2.1), and atom number (#6). If only a single model is loaded, %[identify] does not include the model number.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},insertion:{"@desc":"protein residue insertion code","@examples":["insertion=A"],regex:/[a-zA-Z0-9]/,map:Qt,level:"atom-test",property:xo.ammp("pdbx_PDB_ins_code")},label:{"@desc":"current atom label (same as format)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},mass:{"@desc":"atomic mass -- especially useful with appended .max or .sum","@examples":["mass > 13"],regex:hl,map:e=>parseFloat(e),level:"atom-test",property:xo.acp("mass")},model:{"@desc":"model number","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},modelindex:{"@desc":"a unique number for each model, starting with 0 and spanning all models in all files","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},modO:{"@desc":"currently calculated occupancy from modulation (0 to 100; NaN if atom has no occupancy modulation)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},modXYZ:{"@desc":"currently calculated displacement modulation (for incommensurately modulated structures). Also modX, modY, modZ for individual components. For atoms without modultion, {xx}.modXYZ is -1 and {xx}.modX is NaN, and in a label %[modXYZ] and %[modX] are blank.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},molecule:{"@desc":"molecule number","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},monomer:{"@desc":"monomer number (group number) in a polymer (usually a chain), starting with 1, or 0 if not part of a biopolymer -- that is, not a connected carbohydrate, amino acid, or nucleic acid (Jmol 14.3.15)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},ms:{"@desc":"magnetic shielding calculated from file-loaded tensors.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},occupancy:{"@desc":'CIF file site occupancy. In SELECT command comparisons ("select occupancy < 90"), an integer n implies measurement on a 0-100 scale; also, in the context %[occupancy] or %q for a label, the reported number is a percentage. In all other cases, such as when %Q is used in a label or when a decimal number is used in a comparison, the scale is 0.0 - 1.0.',"@examples":["occupancy < 1"],regex:hl,map:e=>parseFloat(e),level:"atom-test",property:xo.ammp("occupancy")},partialCharge:{"@desc":"partial charge","@examples":[""],isUnsupported:!0,regex:hl,map:e=>parseFloat(e),level:"atom-test"},phi:{"@desc":"protein group PHI angle for atom's residue","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},polymer:{"@desc":"sequential polymer number in a model, starting with 1.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},polymerLength:{"@desc":"polymer length","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},property_xx:{"@desc":"a property created using the DATA command","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},psi:{"@desc":"protein group PSI angle for the atom's residue","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},radius:{"@desc":'currently displayed radius -- In SELECT command comparisons ("select radius=n"), integer n implies Rasmol units 1/250 Angstroms; in all other cases or when a decimal number is used, the units are Angstroms.',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},resno:{"@desc":"PDB residue number, not including insertion code (see also seqcode, below)","@examples":["resno = 100"],regex:/-?[0-9]+/,map:e=>parseInt(e),level:"residue-test",property:xo.ammp("auth_seq_id")},selected:{"@desc":"1.0 if atom is selected; 0.0 if not","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},sequence:{"@desc":'PDB one-character sequence code, as a string of characters, with "?" indicated where single-character codes are not available',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},seqcode:{"@desc":'PDB residue number, including insertion code (for example, 234^2; "seqcode" option added in Jmol 14.3.16)',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},seqid:{"@desc":"(mmCIF only) the value from _atom_site.label_seq_id; a pointer to _entity_poly_seq.num in the ENTITY_POLY_SEQ category specifying the sequence of monomers in a polymer. Allowance is made for the possibility of microheterogeneity in a sample by allowing a given sequence number to be correlated with more than one monomer id. (Jmol 14.2.3)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},shape:{"@desc":'hybridization geometry such as "tetrahedral"',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},site:{"@desc":"crystallographic site number","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},spacefill:{"@desc":"currently displayed radius","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},straightness:{"@desc":'quaternion-derived straightness (second derivative of the quaternion describing the orientation of the residue. This quantity will have different values depending upon the setting of quaternionFrame as "A" (alpha-carbon/phosphorus atom only), "C" (alpha-carbon/pyrimidine or purine base based), "P" (carbonyl-carbon peptide plane/phosphorus tetrahedron based), or "N" (amide-nitrogen based). The default is alpha-carbon based, which corresponds closely to the following combination of Ramachandran angles involving three consecutive residues i-1, i, and i+1: -psii-1 - phii + psii + phii+1.',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},strucno:{"@desc":"a unique number for each helix, sheet, or turn in a model, starting with 1.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},structure:{"@desc":'The value of this parameter depends upon the context. Used with select structure=x, x can be either the quoted keyword "none", "turn", "sheet", "helix", "dna", "rna", or "carbohydrate" or a respective number 0-6. In the context {*}.structure, the return value is a number; in the context label %[structure], the return is one of the six keywords.',"@examples":['structure="helix"',"structure=3"],regex:/none|turn|sheet|helix|dna|rna|carbohydrate|[0-6]/i,map:Qt,level:"residue-test",property:"structure"},substructure:{"@desc":'like structure, the value of this parameter depends upon the context. Used with select substructure=x, x can be either the quoted keyword "none", "turn", "sheet", "helix", "dna", "rna", "carbohydrate", "helix310", "helixalpha", or "helixpi", or the respective number 0-9. In the context {*}.substructure, the return value is a number; in the context label %[substructure], the return is one of the nine keywords.',"@examples":['substructure = "alphahelix"',"substructure =9"],regex:/none|turn|sheet|helix|dna|rna|carbohydrate|helix310|helixalpha|helixpi|[0-9]/i,map:Qt,level:"residue-test",property:"structure"},surfacedistance:{"@desc":"A value related to the distance of an atom to a nominal molecular surface. 0 indicates at the surface. Positive numbers are minimum distances in Angstroms from the given atom to the surface.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},symop:{"@desc":'the first symmetry operation code that generated this atom by Jmol; an integer starting with 1. See also symmetry, below. This operator is only present if the file contains space group information and the file was loaded using the {i, j, k} option so as to generate symmetry-based atoms. To select only the original atoms prior to application of symmetry, you can either use "SYMOP=n", where n is the symmetry operator corresponding to "x,y,z", or you can specify instead simply "NOT symmetry" the way you might specify "NOT hydrogen". Note that atoms in special positions will have multiple operator matches. These atoms can be selected using the keyword SPECIALPOSITION. The special form select SYMOP=nijk selects a specific translation of atoms from the given crystallographic symmetry operation. Comparators <, <=, >, >=, and != can be used and only apply to the ijk part of the designation. The ijk are relative, not absolute. Thus, symop=2555 selects for atoms that have been transformed by symop=2 but not subjected to any further translation. select symop=1555 is identical to select not symmetry. All other ijk are relative to these selections for 555. If the model was loaded using load "filename.cif" {444 666 1}, where the 1 indicates that all symmetry-generated atoms are to be packed within cell 555 and then translated to fill the other 26 specified cells, then select symop=3555 is nearly the same as select symop=3 and cell=555. (The difference being that cell=555 selects for all atoms that are on any edge of the cell, while symop=3555 does not.) However, the situation is different if instead the model was loaded using load "filename.cif" {444 666 0}, where the 0 indicates that symmetry-generated atoms are to be placed exactly where their symmetry operator would put them (x,-y,z being different then from x, 1-y, z). In that case, select symop=3555 is for all atoms that have been generated using symmetry operation 3 but have not had any additional translations applied to the x,y,z expression found in the CIF file. If, for example, symmetry operation 3 is -x,-y,-z, then load "filename.cif" {444 666 0} will place an atom originally at {1/2, 1/2, 1/2} at positions {-1/2, -1/2, -1/2} (symop=3555) and {-3/2, -3/2, -3/2} (symop=3444) and 24 other sites.',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},symmetry:{"@desc":'as "symmetry" or in a label as lower-case "o" gives list of crystallographic symmetry operators generating this atom with lattice designations,such as 3555; upper-case "%O" in a label gives a list without the lattice designations. See also symop, above.',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},temperature:{"@desc":"yes yes temperature factor (B-factor)","@examples":["temperature >= 20"],regex:hl,map:e=>parseFloat(e),level:"atom-test",property:xo.ammp("B_iso_or_equiv")},unitXyz:{"@desc":"unit cell XYZ coordinates","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},uX:{"@desc":"unit cell X coordinate normalized to [0,1)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},uY:{"@desc":"unit cell Y coordinate normalized to [0,1)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},uZ:{"@desc":"unit cell Z coordinate normalized to [0,1)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},valence:{"@desc":"the valence of an atom (sum of bonds, where double bond counts as 2 and triple bond counts as 3","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},vanderwaals:{"@desc":"van der Waals radius","@examples":["vanderwaals >2"],regex:hl,map:e=>parseFloat(e),level:"atom-test",property:xo.acp("vdw")},vectorScale:{"@desc":"vibration vector scale","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},volume:{"@desc":"approximate van der Waals volume for this atom. Note, {*}.volume gives an average; use {*}.volume.sum to get total volume.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},vXyz:{"@desc":"vibration vector, or individual components as %vx %vy %vz. For atoms without vibration vectors, {xx}.vXyz is -1; in a label, %[vxyz] is blank.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},vX:{"@desc":"vibration vector X coordinate; for atoms without vibration vector, {xx}.vX is NaN (same for vY and vZ)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},vY:{"@desc":"vibration vector Y coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},vZ:{"@desc":"vibration vector Z coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"},xyz:{"@desc":"Cartesian XYZ coordinates; select xyz > 1.0 selects atoms more than one Angstrom from the origin.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Qt,level:"atom-test"}},uoe=ue,loe=[{"@desc":"Selects atoms that are not included in s1.","@examples":["not ARG"],name:"not",type:Ca,rule:Be.alt(Be.regex(/NOT/i).skip(Be.whitespace),Be.string("!").skip(Be.optWhitespace)),map:(e,t)=>Su(t)},{"@desc":"Selects atoms included in both s1 and s2.","@examples":["ASP and .CA"],name:"and",type:sc,rule:Yp(/AND|&/i),map:(e,t,n)=>uoe.struct.modifier.intersectBy({0:t,by:n})},{"@desc":"Selects atoms included in either s1 or s2.","@examples":["ASP or GLU"],name:"or",type:sc,rule:Yp(/OR|\||,/i),map:(e,t,n)=>uoe.struct.combinator.merge([t,n])}],Pe=ue,Ci={acidic:["ASP","GLU"],aliphatic:["ALA","GLY","ILE","LEU","VAL"],amino:["ALA","ARG","ASN","ASP","CYS","GLN","GLU","GLY","HIS","ILE","LEU","LYS","MET","PHE","PRO","SER","THR","TRP","TYR","VAL","ASX","GLX","UNK"],aromatic:["HIS","PHE","TRP","TYR"],basic:["ARG","HIS","LYS"],buried:["ALA","CYS","ILE","LEU","MET","PHE","TRP","VAL"],cg:["CYT","C","GUA","G"],cyclic:["HIS","PHE","PRO","TRP","TYR"],hydrophobic:["ALA","GLY","ILE","LEU","MET","PHE","PRO","TRP","TYR","VAL"],large:["ARG","GLU","GLN","HIS","ILE","LEU","LYS","MET","PHE","TRP","TYR"],medium:["ASN","ASP","CYS","PRO","THR","VAL"],small:["ALA","GLY","SER"],nucleic:["G","C","A","T","U","I","DG","DC","DA","DT","DU","DI","+G","+C","+A","+T","+U","+I"]},doe_nucleic=["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*","C2'","C1'","O4'","O2'"],doe_protein=["C","N","CA"];function wS(){return Pe.struct.combinator.merge([Pe.struct.generator.atomGroups({"residue-test":Pe.core.set.has([Pe.set(...Ci.nucleic),Pe.ammp("label_comp_id")])}),Pe.struct.filter.pick({0:Pe.struct.generator.atomGroups({"group-by":Pe.ammp("residueKey")}),test:Pe.core.logic.and([Pe.core.rel.eq([Pe.struct.atomSet.atomCount(),1]),Pe.core.rel.eq([Pe.ammp("label_atom_id"),Pe.atomName("P")])])}),Pe.struct.filter.pick({0:Pe.struct.generator.atomGroups({"group-by":Pe.ammp("residueKey")}),test:Pe.core.logic.or([Pe.core.set.isSubset([_f(["C1'","C2'","O3'","C3'","C4'","C5'","O5'"]),Pe.ammpSet("label_atom_id")]),Pe.core.set.isSubset([_f(["C1*","C2*","O3*","C3*","C4*","C5*","O5*"]),Pe.ammpSet("label_atom_id")])])})])}const foe={all:{"@desc":"all atoms; same as *",abbr:["*"],map:()=>Pe.struct.generator.all()},bonded:{"@desc":"covalently bonded",map:()=>Pe.struct.generator.atomGroups({"atom-test":Pe.core.rel.gr([Pe.struct.atomProperty.core.bondCount({flags:Pe.struct.type.bondFlags(["covalent","metallic","sulfide"])}),0])})},clickable:{"@desc":"actually visible -- having some visible aspect such as wireframe, spacefill, or a label showing, or the alpha-carbon or phosphorus atom in a biomolecule that is rendered with only cartoon, rocket, or other biomolecule-specific shape."},connected:{"@desc":"bonded in any way, including hydrogen bonds",map:()=>Pe.struct.generator.atomGroups({"atom-test":Pe.core.rel.gr([Pe.struct.atomProperty.core.bondCount({flags:Pe.struct.type.bondFlags()}),0])})},displayed:{"@desc":"displayed using the display or hide command; not necessarily visible"},hidden:{"@desc":"hidden using the display or hide command"},none:{"@desc":"no atoms",map:()=>Pe.struct.generator.empty()},selected:{"@desc":"atoms that have been selected; defaults to all when a file is first loaded"},thisModel:{"@desc":'atoms in the current frame set, as defined by frame, model, or animation commands. If more than one model is in this set, "thisModel" refers to all of them, regardless of atom displayed/hidden status.'},visible:{"@desc":"visible in any way, including PDB residue atoms for which a cartoon or other such rendering makes their group visible, even if they themselves are not visible."},subset:{"@desc":"the currently defined subset. Note that if a subset is currently defined, then select/display all is the same as select/display subset, restrict none is the same as restrict not subset. In addition, select not subset selects nothing."},specialPosition:{"@desc":"atoms in crystal structures that are at special positions - that is, for which there is more than one operator that leads to them."},unitcell:{"@desc":"atoms within the current unitcell, which may be offset. This includes atoms on the faces and at the vertices of the unitcell."},polyhedra:{"@desc":"all central atoms for which polyhedra have been created. See also polyhera(n), below. (Jmol 14.4)"},nonmetal:{"@desc":"_H,_He,_B,_C,_N,_O,_F,_Ne,_Si,_P,_S,_Cl,_Ar,_As,_Se,_Br,_Kr,_Te,_I,_Xe,_At,_Rn",map:()=>Pe.struct.generator.atomGroups({"atom-test":Pe.core.set.has([Pe.set(...["H","He","B","C","N","O","F","Ne","Si","P","S","Cl","Ar","As","Se","Br","Kr","Te","I","Xe","At","Rn"].map(Pe.es)),Pe.acp("elementSymbol")])})},metal:{"@desc":"!nonmetal",map:()=>Pe.struct.generator.atomGroups({"atom-test":Pe.core.logic.not([Pe.core.set.has([Pe.set(...["H","He","B","C","N","O","F","Ne","Si","P","S","Cl","Ar","As","Se","Br","Kr","Te","I","Xe","At","Rn"].map(Pe.es)),Pe.acp("elementSymbol")])])})},alkaliMetal:{"@desc":"_Li,_Na,_K,_Rb,_Cs,_Fr",map:()=>Pe.struct.generator.atomGroups({"atom-test":Pe.core.set.has([Pe.set(...["Li","Na","K","Rb","Cs","Fr"].map(Pe.es)),Pe.acp("elementSymbol")])})},alkalineEarth:{"@desc":"_Be,_Mg,_Ca,_Sr,_Ba,_Ra",map:()=>Pe.struct.generator.atomGroups({"atom-test":Pe.core.set.has([Pe.set(...["Be","Mg","Ca","Sr","Ba","Ra"].map(Pe.es)),Pe.acp("elementSymbol")])})},nobleGas:{"@desc":"_He,_Ne,_Ar,_Kr,_Xe,_Rn",map:()=>Pe.struct.generator.atomGroups({"atom-test":Pe.core.set.has([Pe.set(...["He","Ne","Ar","Kr","Xe","Rn"].map(Pe.es)),Pe.acp("elementSymbol")])})},metalloid:{"@desc":"_B,_Si,_Ge,_As,_Sb,_Te",map:()=>Pe.struct.generator.atomGroups({"atom-test":Pe.core.set.has([Pe.set(...["B","Si","Ge","As","Sb","Te"].map(Pe.es)),Pe.acp("elementSymbol")])})},transitionMetal:{"@desc":"(includes La and Ac) elemno>=21 and elemno<=30, elemno=57, elemno=89, elemno>=39 and elemno<=48, elemno>=72 and elemno<=80, elemno>=104 and elemno<=112",map:()=>Pe.struct.generator.atomGroups({"atom-test":Pe.core.logic.or([Pe.core.rel.inRange([Pe.acp("atomicNumber"),21,30]),Pe.core.rel.inRange([Pe.acp("atomicNumber"),39,48]),Pe.core.rel.inRange([Pe.acp("atomicNumber"),72,80]),Pe.core.rel.inRange([Pe.acp("atomicNumber"),104,112]),Pe.core.set.has([Pe.set(57,89),Pe.acp("atomicNumber")])])})},lanthanide:{"@desc":"(does not include La) elemno>57 and elemno<=71",map:()=>Pe.struct.generator.atomGroups({"atom-test":Pe.core.rel.inRange([Pe.acp("atomicNumber"),57,71])})},actinide:{"@desc":"(does not include Ac) elemno>89 and elemno<=103",map:()=>Pe.struct.generator.atomGroups({"atom-test":Pe.core.rel.inRange([Pe.acp("atomicNumber"),89,103])})},isaromatic:{"@desc":"atoms connected with the AROMATIC, AROMATICSINGLE, or AROMATICDOUBLE bond types",map:()=>Pe.struct.generator.atomGroups({"atom-test":Pe.core.rel.gr([Pe.struct.atomProperty.core.bondCount({flags:Pe.struct.type.bondFlags(["aromatic"])}),0])})},carbohydrate:{"@desc":""},ions:{"@desc":'(specifically the PDB designations "PO4" and "SO4")'},ligand:{"@desc":'(originally "hetero and not solvent"; changed to "!(protein,nucleic,water,UREA)" for Jmol 12.2)'},nucleic:{"@desc":'any group that (a) has one of the following group names: G, C, A, T, U, I, DG, DC, DA, DT, DU, DI, +G, +C, +A, +T, +U, +I; or (b) can be identified as a group that is only one atom, with name "P"; or (c) has all of the following atoms (prime, \', can replace * here): C1*, C2*, C3*, O3*, C4*, C5*, and O5*.',map:()=>wS()},purine:{"@desc":"any nucleic group that (a) has one of the following group names: A, G, I, DA, DG, DI, +A, +G, or +I; or (b) also has atoms N7, C8, and N9.",map:()=>Pe.struct.modifier.intersectBy({0:wS(),by:Pe.struct.combinator.merge([Pe.struct.generator.atomGroups({"residue-test":Pe.core.set.has([Pe.set("A","G","I","DA","DG","DI","+A","+G","+I"),Pe.ammp("label_comp_id")])}),Pe.struct.filter.pick({0:Pe.struct.generator.atomGroups({"group-by":Pe.ammp("residueKey")}),test:Pe.core.set.isSubset([_f(["N7","C8","N9"]),Pe.ammpSet("label_atom_id")])})])})},pyrimidine:{"@desc":"any nucleic group that (a) has one of the following group names: C, T, U, DC, DT, DU, +C, +T, +U; or (b) also has atom O2.",map:()=>Pe.struct.modifier.intersectBy({0:wS(),by:Pe.struct.combinator.merge([Pe.struct.generator.atomGroups({"residue-test":Pe.core.set.has([Pe.set("C","T","U","DC","DT","DU","+C","+T","+U"),Pe.ammp("label_comp_id")])}),Pe.struct.filter.pick({0:Pe.struct.generator.atomGroups({"group-by":Pe.ammp("residueKey")}),test:Pe.core.logic.or([Pe.core.set.has([Pe.ammpSet("label_atom_id"),Pe.atomName("O2*")]),Pe.core.set.has([Pe.ammpSet("label_atom_id"),Pe.atomName("O2'")])])})])})},dna:{"@desc":"any nucleic group that (a) has one of the following group names: DG, DC, DA, DT, DU, DI, T, +G, +C, +A, +T; or (b) has neither atom O2* or O2'.",map:()=>Pe.struct.modifier.intersectBy({0:wS(),by:Pe.struct.combinator.merge([Pe.struct.generator.atomGroups({"residue-test":Pe.core.set.has([Pe.set("DG","DC","DA","DT","DU","DI","T","+G","+C","+A","+T"),Pe.ammp("label_comp_id")])}),Pe.struct.filter.pick({0:Pe.struct.generator.atomGroups({"group-by":Pe.ammp("residueKey")}),test:Pe.core.logic.not([Pe.core.logic.or([Pe.core.set.has([Pe.ammpSet("label_atom_id"),Pe.atomName("O2*")]),Pe.core.set.has([Pe.ammpSet("label_atom_id"),Pe.atomName("O2'")])])])})])})},rna:{"@desc":"any nucleic group that (a) has one of the following group names: G, C, A, U, I, +U, +I; or (b) has atom O2* or O2'.",map:()=>Pe.struct.modifier.intersectBy({0:wS(),by:Pe.struct.combinator.merge([Pe.struct.generator.atomGroups({"residue-test":Pe.core.set.has([Pe.set("G","C","A","U","I","+U","+I"),Pe.ammp("label_comp_id")])}),Pe.struct.filter.pick({0:Pe.struct.generator.atomGroups({"group-by":Pe.ammp("residueKey")}),test:Pe.core.logic.or([Pe.core.set.has([Pe.ammpSet("label_atom_id"),Pe.atomName("O2*")]),Pe.core.set.has([Pe.ammpSet("label_atom_id"),Pe.atomName("O2'")])])})])})},protein:{"@desc":'defined as a group that (a) has one of the following group names: ALA, ARG, ASN, ASP, CYS, GLN, GLU, GLY, HIS, ILE, LEU, LYS, MET, PHE, PRO, SER, THR, TRP, TYR, VAL, ASX, GLX, or UNK; or (b) contains PDB atom designations [C, O, CA, and N] bonded correctly; or (c) does not contain "O" but contains [C, CA, and N] bonded correctly; or (d) has only one atom, which has name CA and does not have the group name CA (indicating a calcium atom).',map:()=>function BWe(){return Pe.struct.generator.atomGroups({"residue-test":Pe.core.set.has([Pe.set(...Ci.amino),Pe.ammp("label_comp_id")])})}()},acidic:{"@desc":"ASP GLU",map:()=>er(Ci.acidic)},acyclic:{"@desc":"amino and not cyclic",map:()=>Pe.struct.modifier.intersectBy({0:er(Ci.amino),by:Su(er(Ci.cyclic))})},aliphatic:{"@desc":"ALA GLY ILE LEU VAL",map:()=>er(Ci.aliphatic)},amino:{"@desc":"all twenty standard amino acids, plus ASX, GLX, UNK",map:()=>er(Ci.amino)},aromatic:{"@desc":'HIS PHE TRP TYR (see also "isaromatic" for aromatic bonds)',map:()=>er(Ci.aromatic)},basic:{"@desc":"ARG HIS LYS",map:()=>er(Ci.basic)},buried:{"@desc":"ALA CYS ILE LEU MET PHE TRP VAL",map:()=>er(Ci.buried)},charged:{"@desc":"same as acidic or basic -- ASP GLU, ARG HIS LYS",map:()=>er(Ci.acidic.concat(Ci.basic))},cyclic:{"@desc":"HIS PHE PRO TRP TYR",map:()=>er(Ci.cyclic)},helix:{"@desc":"secondary structure-related.",map:()=>Pe.struct.generator.atomGroups({"residue-test":Pe.core.flags.hasAny([Pe.struct.type.secondaryStructureFlags(["helix"]),Pe.ammp("secondaryStructureFlags")])})},helixalpha:{"@desc":"secondary structure-related.",map:()=>Pe.struct.generator.atomGroups({"residue-test":Pe.core.flags.hasAny([Pe.struct.type.secondaryStructureFlags(["alpha"]),Pe.ammp("secondaryStructureFlags")])})},helix310:{"@desc":"secondary structure-related.",map:()=>Pe.struct.generator.atomGroups({"residue-test":Pe.core.flags.hasAny([Pe.struct.type.secondaryStructureFlags(["3-10"]),Pe.ammp("secondaryStructureFlags")])})},helixpi:{"@desc":"secondary structure-related.",map:()=>Pe.struct.generator.atomGroups({"residue-test":Pe.core.flags.hasAny([Pe.struct.type.secondaryStructureFlags(["pi"]),Pe.ammp("secondaryStructureFlags")])})},hetero:{"@desc":"PDB atoms designated as HETATM",map:()=>Pe.struct.generator.atomGroups({"atom-test":Pe.ammp("isHet")})},hydrophobic:{"@desc":"ALA GLY ILE LEU MET PHE PRO TRP TYR VAL",map:()=>er(Ci.hydrophobic)},large:{"@desc":"ARG GLU GLN HIS ILE LEU LYS MET PHE TRP TYR",map:()=>er(Ci.large)},medium:{"@desc":"ASN ASP CYS PRO THR VAL",map:()=>er(Ci.medium)},negative:{"@desc":"same as acidic -- ASP GLU",map:()=>er(Ci.acidic)},neutral:{"@desc":"amino and not (acidic or basic)",map:()=>Pe.struct.modifier.intersectBy({0:er(Ci.amino),by:Su(er(Ci.acidic.concat(Ci.basic)))})},polar:{"@desc":"amino and not hydrophobic",map:()=>Pe.struct.modifier.intersectBy({0:er(Ci.amino),by:Su(er(Ci.hydrophobic))})},positive:{"@desc":"same as basic -- ARG HIS LYS",map:()=>er(Ci.basic)},sheet:{"@desc":"secondary structure-related",map:()=>Pe.struct.generator.atomGroups({"residue-test":Pe.core.flags.hasAny([Pe.struct.type.secondaryStructureFlags(["sheet"]),Pe.ammp("secondaryStructureFlags")])})},small:{"@desc":"ALA GLY SER",map:()=>er(Ci.small)},surface:{"@desc":"amino and not buried",map:()=>Pe.struct.modifier.intersectBy({0:er(Ci.amino),by:Su(er(Ci.buried))})},turn:{"@desc":"secondary structure-related",map:()=>Pe.struct.generator.atomGroups({"residue-test":Pe.core.flags.hasAny([Pe.struct.type.secondaryStructureFlags(["turn"]),Pe.ammp("secondaryStructureFlags")])})},alpha:{"@desc":"(*.CA)",map:()=>Pe.struct.generator.atomGroups({"atom-test":Pe.core.rel.eq([Pe.atomName("CA"),Pe.ammp("label_atom_id")])})},base:{"@desc":"(nucleic bases)"},backbone:{"@desc":"(*.C, *.CA, *.N, and all nucleic other than the bases themselves)",abbr:["mainchain"],map:()=>function OWe(){return Pe.struct.combinator.merge([Pe.struct.modifier.intersectBy({0:Pe.struct.generator.atomGroups({"residue-test":Pe.core.set.has([Pe.core.type.set(Ci.amino),Pe.ammp("label_comp_id")])}),by:Pe.struct.generator.atomGroups({"atom-test":Pe.core.set.has([Pe.core.type.set(doe_protein),Pe.ammp("label_atom_id")])})}),Pe.struct.modifier.intersectBy({0:Pe.struct.generator.atomGroups({"residue-test":Pe.core.set.has([Pe.core.type.set(Ci.nucleic),Pe.ammp("label_comp_id")])}),by:Pe.struct.generator.atomGroups({"atom-test":Pe.core.set.has([Pe.core.type.set(doe_nucleic),Pe.ammp("label_atom_id")])})})])}()},sidechain:{"@desc":"((protein or nucleic) and not backbone)"},spine:{"@desc":"(*.CA, *.N, *.C for proteins; *.P, *.O3', *.O5', *.C3', *.C4', *.C5 for nucleic acids)"},leadatom:{"@desc":"(*.CA, *.P, and terminal *.O5')"},solvent:{"@desc":'PDB "HOH", water, also the connected set of H-O-H in any model'}},An=ue,LWe=[{"@desc":"value comparisons","@examples":[],name:"=",abbr:["=="],type:sc,rule:Be.regexp(/\s*(LIKE|>=|<=|=|!=|>|<)\s*/i,1),map:(e,t,n)=>{let r;if("structure"===t?r=An.core.flags.hasAny([An.ammp("secondaryStructureFlags"),aoe(n)]):"structure"===n?r=An.core.flags.hasAny([An.ammp("secondaryStructureFlags"),aoe(t)]):void 0!==t.head?"core.type.regex"===t.head.name&&(r=An.core.str.match([t,An.core.type.str([n])])):void 0!==n.head?"core.type.regex"===n.head.name&&(r=An.core.str.match([n,An.core.type.str([t])])):"LIKE"===e.toUpperCase()&&(r=An.core.str.match(t.head?[An.core.type.regex([`^${n}$`,"i"]),An.core.type.str([t])]:[An.core.type.regex([`^${t}$`,"i"]),An.core.type.str([n])])),!r)switch(t.head&&(n=SS(t,n)),n.head&&(t=SS(n,t)),e){case"=":r=An.core.rel.eq([t,n]);break;case"!=":r=An.core.rel.neq([t,n]);break;case">":r=An.core.rel.gr([t,n]);break;case"<":r=An.core.rel.lt([t,n]);break;case">=":r=An.core.rel.gre([t,n]);break;case"<=":r=An.core.rel.lte([t,n]);break;default:throw new Error(`value operator '${e}' not supported`)}return An.struct.generator.atomGroups({"atom-test":r})}}];function UWe(e){const[t,n,r,i,o,s,a]=e[1],c={};o&&(c["chain-test"]=An.core.rel.eq([An.ammp("auth_asym_id"),o]));const u=[];t&&u.push(An.core.rel.eq([An.ammp("label_comp_id"),t])),n&&u.push(An.core.logic.and([An.core.rel.gre([An.ammp("auth_seq_id"),n[0]]),An.core.rel.lte([An.ammp("auth_seq_id"),n[1]])])),r&&u.push(An.core.rel.eq([An.ammp("auth_seq_id"),r])),i&&u.push(An.core.rel.eq([An.ammp("pdbx_PDB_ins_code"),i])),u.length&&(c["residue-test"]=j5(u));const l=[];return s&&l.push(An.core.rel.eq([An.ammp("auth_atom_id"),s])),a&&l.push(An.core.rel.eq([An.ammp("label_alt_id"),a])),l.length&&(c["atom-test"]=j5(l)),An.struct.generator.atomGroups(c)}const VWe=Be.createLanguage({Integer:()=>Be.regexp(/-?[0-9]+/).map(Number).desc("integer"),Parens:function(e){return Be.alt(e.Parens,e.Operator,e.Expression).wrap(Be.regexp(/\(\s*/),Be.regexp(/\s*\)/))},Expression:function(e){return Be.alt(e.Keywords,e.AtomExpression.map(UWe),e.Within.map(t=>An.struct.modifier.includeSurroundings({0:t[1],radius:t[0]})),e.ValueQuery,e.Element.map(t=>An.struct.generator.atomGroups({"atom-test":An.core.rel.eq([An.acp("elementSymbol"),An.struct.type.elementSymbol(t)])})),e.Resname.map(t=>An.struct.generator.atomGroups({"residue-test":An.core.rel.eq([An.ammp("label_comp_id"),t])})))},Operator:function(e){return xS(loe,Be.alt(e.Parens,e.Expression))},AtomExpression:function(e){return Be.seq(Be.lookahead(e.AtomPrefix),Be.seq(e.BracketedResname.or(Be.of(null)),e.ResnoRange.or(Be.of(null)),e.Resno.or(Be.of(null)),e.Inscode.or(Be.of(null)),e.Chainname.or(Be.of(null)),e.Atomname.or(Be.of(null)),e.Altloc.or(Be.of(null)),e.Model.or(Be.of(null)))).desc("expression")},AtomPrefix:()=>Be.regexp(/[\[0-9:^%/.-]/).desc("atom-prefix"),Chainname:()=>Be.regexp(/:([A-Za-z]{1,3})/,1).desc("chainname"),Model:()=>Be.regexp(/\/([0-9]+)/,1).map(Number).desc("model"),Element:()=>Be.regexp(/_([A-Za-z]{1,3})/,1).desc("element"),Atomname:()=>Be.regexp(/\.([a-zA-Z0-9]{1,4})/,1).map(An.atomName).desc("atomname"),Resname:()=>Be.regexp(/[a-zA-Z0-9]{1,4}/).desc("resname"),Resno:e=>e.Integer.desc("resno"),Altloc:()=>Be.regexp(/%([a-zA-Z0-9])/,1).desc("altloc"),Inscode:()=>Be.regexp(/\^([a-zA-Z0-9])/,1).desc("inscode"),BracketedResname:()=>Be.regexp(/\[([a-zA-Z0-9]{1,4})\]/,1).desc("bracketed-resname"),ResnoRange:e=>Be.seq(e.Integer.skip(Be.seq(Be.optWhitespace,Be.string("-"),Be.optWhitespace)),e.Integer).desc("resno-range"),Within:e=>Be.regexp(/within/i).skip(Be.regexp(/\s*\(\s*/)).then(Be.seq(e.Integer.skip(Be.regexp(/\s*,\s*/)),e.Query)).skip(Be.regexp(/\)/)),Keywords:()=>Be.alt(...W5(foe)).desc("keyword"),Query:function(e){return Be.alt(e.Operator,e.Parens,e.Expression).trim(Be.optWhitespace)},Number:function(){return Be.regexp(/-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?/).map(Number).desc("number")},String:function(){const e=Y5(coe,foe,loe).sort(vf).map(s2).join("|");return Be.alt(Be.regexp(new RegExp(`(?!(${e}))[A-Z0-9_]+`,"i")),Be.regexp(/'((?:[^"\\]|\\.)*)'/,1),Be.regexp(/"((?:[^"\\]|\\.)*)"/,1).map(t=>An.core.type.regex([`^${t}$`,"i"]))).desc("string")},Value:function(e){return Be.alt(e.Number,e.String)},ValueParens:function(e){return Be.alt(e.ValueParens,e.ValueOperator,e.ValueExpressions).wrap(Be.string("("),Be.string(")"))},ValuePropertyNames:function(){return Be.alt(...$5(coe,/LIKE|>=|<=|=|!=|>|<|\)|\s/i))},ValueOperator:function(e){return xS(LWe,Be.alt(e.ValueParens,e.ValueExpressions))},ValueExpressions:function(e){return Be.alt(e.Value,e.ValuePropertyNames)},ValueQuery:function(e){return Be.alt(e.ValueOperator.map(t=>{if(t.head){if(t.head.name.startsWith("structure-query.generator"))return t}else if("string"==typeof t&&t.length<=4)return An.struct.generator.atomGroups({"residue-test":An.core.rel.eq([An.ammp("label_comp_id"),t])});throw new Error(`values must be part of an comparison, value '${t}'`)}))}}),Ls=ue,VD=/[-+]?[0-9]*\.?[0-9]+/;function kv(e){return e.split("+").map(t=>t.replace(/^["']|["']$/g,""))}function X5(e){if(e.includes("-")&&e.includes("+")){const t=e.split("+").map(r=>r.replace(/^["']|["']$/g,"")),n=[];return t.forEach(r=>{if(r.includes("-")&&!r.startsWith("-")){const[i,o]=r.split("-").map(s=>parseInt(s));for(let s=i;s<=o;s++)n.push(s)}else if(r.includes("-")&&r.startsWith("-")&&r.match(/[0-9]+-[-0-9]+/)){const i=-parseInt(r.split("-")[1]);let o;o=r.includes("--")?-parseInt(r.split("-")[3]):parseInt(r.split("-")[2]);for(let s=i;s<=o;s++)n.push(s)}else r.includes("-")&&r.startsWith("-")&&r.match(/[0-9]+-[-0-9]+/),n.push(parseInt(r))}),n}if(e.includes("-")&&!e.includes("+")){const t=[];if(e.startsWith("-"))if(e.startsWith("-")&&e.match(/[0-9]+-[-0-9]+/)){const n=-parseInt(e.split("-")[1]);let r;r=e.includes("--")?-parseInt(e.split("-")[3]):parseInt(e.split("-")[2]);for(let i=n;i<=r;i++)t.push(i)}else e.startsWith("-")&&e.match(/[0-9]+-[-0-9]+/),t.push(parseInt(e));else{const[n,r]=e.split("-").map(i=>parseInt(i));for(let i=n;i<=r;i++)t.push(i)}return t}return!e.includes("-")&&e.includes("+")?kv(e).map(t=>parseInt(t)):[parseInt(e)]}const HWe={H:"helix",S:"beta",L:"none"},zD={symbol:{"@desc":"chemical-symbol-list: list of 1- or 2-letter chemical symbols from the periodic table","@examples":["symbol O+N"],abbr:["e."],regex:/[a-zA-Z'"+]+/,map:function jWe(e){return e.split("+").map(Ls.struct.type.elementSymbol)},level:"atom-test",property:Ls.acp("elementSymbol")},name:{"@desc":"atom-name-list: list of up to 4-letter codes for atoms in proteins or nucleic acids","@examples":["name CA+CB+CG+CD"],abbr:["n."],regex:/[a-zA-Z0-9'"+]+/,map:function GWe(e){return e.split("+").map(Ls.atomName)},level:"atom-test",property:Ls.ammp("label_atom_id")},resn:{"@desc":"residue-name-list: list of 3-letter codes for amino acids or list of up to 2-letter codes for nucleic acids","@examples":["resn ASP+GLU+ASN+GLN","resn A+G"],abbr:["resname","r."],regex:/[a-zA-Z0-9'"+]+/,map:kv,level:"residue-test",property:Ls.ammp("label_comp_id")},resi:{"@desc":"residue-identifier-list list of up to 4-digit residue numbers or residue-identifier-range","@examples":["resi 1+10+100+1000","resi 1-10"],abbr:["resident","residue","resid","i."],regex:/[0-9+-]+/,map:X5,level:"residue-test",property:Ls.ammp("auth_seq_id")},alt:{"@desc":"alternate-conformation-identifier-list list of single letters","@examples":["alt A+B",'alt ""','alt ""+A'],abbr:[],regex:/[a-zA-Z0-9'"+]+/,map:kv,level:"atom-test",property:Ls.ammp("label_alt_id")},chain:{"@desc":"chain-identifier-list list of single letters or sometimes numbers","@examples":["chain A"],abbr:["c."],regex:/[a-zA-Z0-9'"+]+/,map:kv,level:"chain-test",property:Ls.ammp("auth_asym_id")},segi:{"@desc":"segment-identifier-list list of up to 4 letter identifiers","@examples":["segi lig"],abbr:["segid","s."],regex:/[a-zA-Z0-9'"+]+/,map:kv,level:"chain-test",property:Ls.ammp("label_asym_id")},flag:{"@desc":"flag-number a single integer from 0 to 31","@examples":["flag 0"],isUnsupported:!0,abbr:["f."],regex:/[0-9]+/,map:e=>parseInt(e),level:"atom-test"},numeric_type:{"@desc":"type-number a single integer","@examples":["nt. 5"],isUnsupported:!0,abbr:["nt."],regex:/[0-9]+/,map:e=>parseInt(e),level:"atom-test"},text_type:{"@desc":"type-string a list of up to 4 letter codes","@examples":["text_type HA+HC"],isUnsupported:!0,abbr:["tt."],regex:/[a-zA-Z0-9'"+]+/,map:kv,level:"atom-test"},id:{"@desc":"external-index-number a single integer","@examples":["id 23"],regex:/[0-9+-]+/,map:X5,level:"atom-test",property:Ls.ammp("id")},index:{"@desc":"internal-index-number a single integer","@examples":["index 11"],regex:/[0-9+-]+/,map:X5,level:"atom-test",property:Ls.ammp("id")},ss:{"@desc":"secondary-structure-type list of single letters. Helical regions should be assigned H and sheet regions S. Loop regions can either be assigned L or be blank.","@examples":["ss H+S+L",'ss S+""'],abbr:[],regex:/[a-zA-Z'"+]+/,map:function qWe(e){return{flags:Ls.struct.type.secondaryStructureFlags(e.toUpperCase().split("+").map(t=>HWe[t]||"none"))}},level:"residue-test",property:Ls.ammp("secondaryStructureFlags")},b:{"@desc":"comparison-operator b-factor-value a real number","@examples":["b > 10"],isNumeric:!0,abbr:[],regex:VD,map:e=>parseFloat(e),level:"atom-test",property:Ls.ammp("B_iso_or_equiv")},q:{"@desc":"comparison-operator occupancy-value a real number","@examples":["q <0.50"],isNumeric:!0,abbr:[],regex:VD,map:e=>parseFloat(e),level:"atom-test",property:Ls.ammp("occupancy")},formal_charge:{"@desc":"comparison-operator formal charge-value an integer","@examples":["fc. = -1"],isNumeric:!0,abbr:["fc."],regex:VD,map:e=>parseFloat(e),level:"atom-test",property:Ls.ammp("pdbx_formal_charge")},partial_charge:{"@desc":"comparison-operator partial charge-value a real number","@examples":["pc. > 1"],isUnsupported:!0,isNumeric:!0,abbr:["pc."],regex:VD,map:e=>parseFloat(e),level:"atom-test"},elem:{"@desc":'str atomic element symbol string ("X" if undefined)',"@examples":["elem N"],regex:/[a-zA-Z0-9]{1,3}/,map:e=>Ls.es(e),level:"atom-test",property:Ls.acp("elementSymbol")}},gn=ue,poe=[{"@desc":"Selects atoms that are not included in s1.","@examples":["NOT resn ALA","not (resi 42 or chain A)","!resi 42 or chain A"],name:"not",type:Ca,rule:Be.alt(Be.regexp(/NOT/i).skip(Be.whitespace),Be.string("!").skip(Be.optWhitespace)),map:(e,t)=>Su(t)},{"@desc":"Selects atoms included in both s1 and s2.","@examples":["chain A AND name CA"],name:"and",type:sc,rule:Yp(/AND|&/i),map:(e,t,n)=>gn.struct.modifier.intersectBy({0:t,by:n})},{"@desc":"Selects atoms included in either s1 or s2.","@examples":["chain A OR chain B"],name:"or",type:sc,rule:Yp(/OR|\|/i),map:(e,t,n)=>gn.struct.combinator.merge([t,n])},{"@desc":"Selects atoms in s1 whose identifiers name, resi, resn, chain and segi all match atoms in s2.","@examples":["chain A IN chain B"],name:"in",type:sc,rule:Yp(/IN/i),map:(e,t,n)=>gn.struct.filter.withSameAtomProperties({0:t,source:n,property:gn.core.type.compositeKey([gn.ammp("label_atom_id"),gn.ammp("label_seq_id"),gn.ammp("label_comp_id"),gn.ammp("auth_asym_id"),gn.ammp("label_asym_id")])})},{"@desc":"Selects atoms in s1 whose identifiers name and resi match atoms in s2.","@examples":["chain A LIKE chain B"],name:"like",type:sc,rule:Yp(/LIKE|l\./i),map:(e,t,n)=>gn.struct.filter.withSameAtomProperties({0:t,source:n,property:gn.core.type.compositeKey([gn.ammp("label_atom_id"),gn.ammp("label_seq_id")])})},{"@desc":"Selects all atoms whose van der Waals radii are separated from the van der Waals radii of s1 by a minimum of X Angstroms.","@examples":["solvent GAP 2"],name:"gap",type:LD,rule:UD(/GAP\s+([-+]?[0-9]*\.?[0-9]+)/i,1).map(e=>parseFloat(e)),map:(e,t)=>gn.struct.filter.within({0:gn.struct.generator.all(),target:t,"atom-radius":gn.acp("vdw"),"max-radius":e,invert:!0})},{"@desc":"Selects atoms with centers within X Angstroms of the center of any atom in s1.","@examples":["resname LIG AROUND 1"],name:"around",abbr:["a."],type:LD,rule:UD(/(AROUND|a\.)\s+([-+]?[0-9]*\.?[0-9]+)/i,2).map(e=>parseFloat(e)),map:(e,t)=>gn.struct.modifier.exceptBy({0:gn.struct.filter.within({0:gn.struct.generator.all(),target:t,"max-radius":e}),by:t})},{"@desc":"Expands s1 by all atoms within X Angstroms of the center of any atom in s1.","@examples":["chain A EXPAND 3"],name:"expand",abbr:["x."],type:LD,rule:UD(/(EXPAND|x\.)\s+([-+]?[0-9]*\.?[0-9]+)/i,2).map(e=>parseFloat(e)),map:(e,t)=>gn.struct.modifier.includeSurroundings({0:t,radius:e})},{"@desc":"Selects atoms in s1 that are within X Angstroms of any atom in s2.","@examples":["chain A WITHIN 3 OF chain B"],name:"within",abbr:["w."],type:sc,rule:G5("WITHIN","w."),map:(e,t,n)=>gn.struct.filter.within({0:t,target:n,"max-radius":e})},{"@desc":"Same as within, but excludes s2 from the selection (and thus is identical to s1 and s2 around X).","@examples":["chain A NEAR_TO 3 OF chain B"],name:"near_to",abbr:["nto."],type:sc,rule:G5("NEAR_TO","nto."),map:(e,t,n)=>gn.struct.modifier.exceptBy({0:gn.struct.filter.within({0:t,target:n,"max-radius":e}),by:n})},{"@desc":"Selects atoms in s1 that are at least X Anstroms away from s2.","@examples":["solvent BEYOND 2 OF chain A"],name:"beyond",abbr:["be."],type:sc,rule:G5("BEYOND","be."),map:(e,t,n)=>gn.struct.modifier.exceptBy({0:gn.struct.filter.within({0:t,target:n,"max-radius":e,invert:!0}),by:n})},{"@desc":"Expands selection to complete residues.","@examples":["BYRESIDUE name N"],name:"byresidue",abbr:["byresi","byres","br."],type:Ca,rule:xu(/BYRESIDUE|byresi|byres|br\./i),map:(e,t)=>xf(gn.struct.modifier.expandProperty({0:gn.struct.modifier.union({0:t}),property:gn.ammp("residueKey")}))},{"@desc":"Completely selects all alpha carbons in all residues covered by a selection.","@examples":["BYCALPHA chain A"],name:"bycalpha",abbr:["bca."],type:Ca,rule:xu(/BYCALPHA|bca\./i),map:(e,t)=>gn.struct.generator.queryInSelection({0:gn.struct.modifier.expandProperty({0:gn.struct.modifier.union({0:t}),property:gn.ammp("residueKey")}),query:gn.struct.generator.atomGroups({"atom-test":gn.core.rel.eq([gn.atomName("CA"),gn.ammp("label_atom_id")])})})},{"@desc":"Expands selection to complete molecules.","@examples":["BYMOLECULE resi 20-30"],name:"bymolecule",isUnsupported:!0,abbr:["bymol","bm."],type:Ca,rule:xu(/BYMOLECULE|bymol|bm\./i),map:(e,t)=>xf(gn.struct.modifier.expandProperty({0:gn.struct.modifier.union({0:t}),property:gn.atp("connectedComponentKey")}))},{"@desc":"Expands selection to complete fragments.","@examples":["BYFRAGMENT resi 10"],name:"byfragment",abbr:["byfrag","bf."],isUnsupported:!0,type:Ca,rule:xu(/BYFRAGMENT|byfrag|bf\./i),map:(e,t)=>[e,t]},{"@desc":"Expands selection to complete segments.","@examples":["BYSEGMENT resn CYS"],name:"bysegment",abbr:["bysegi","byseg","bs."],type:Ca,rule:xu(/BYSEGMENT|bysegi|byseg|bs\./i),map:(e,t)=>xf(gn.struct.modifier.expandProperty({0:gn.struct.modifier.union({0:t}),property:gn.ammp("chainKey")}))},{"@desc":"Expands selection to complete objects.","@examples":["BYOBJECT chain A"],name:"byobject",abbr:["byobj","bo."],isUnsupported:!0,type:Ca,rule:xu(/BYOBJECT|byobj|bo\./i),map:(e,t)=>[e,t]},{"@desc":"Expands selection to unit cell.","@examples":["BYCELL chain A"],name:"bycell",isUnsupported:!0,type:Ca,rule:xu(/BYCELL/i),map:(e,t)=>[e,t]},{"@desc":"All rings of size \u2264 7 which have at least one atom in s1.","@examples":["BYRING resn HEM"],name:"byring",type:Ca,rule:xu(/BYRING/i),map:(e,t)=>xf(gn.struct.modifier.intersectBy({0:gn.struct.filter.pick({0:gn.struct.generator.rings(),test:gn.core.logic.and([gn.core.rel.lte([gn.struct.atomSet.atomCount(),7]),gn.core.rel.gr([gn.struct.atomSet.countQuery([t]),1])])}),by:t}))},{"@desc":"Selects atoms directly bonded to s1, excludes s1.","@examples":["NEIGHBOR resn CYS"],name:"neighbor",type:Ca,abbr:["nbr."],rule:xu(/NEIGHBOR|nbr\./i),map:(e,t)=>gn.struct.modifier.exceptBy({0:xf(gn.struct.modifier.includeConnected({0:gn.struct.modifier.union({0:t}),"bond-test":!0})),by:t})},{"@desc":"Selects atoms directly bonded to s1, may include s1.","@examples":["BOUND_TO name CA"],name:"bound_to",abbr:["bto."],type:Ca,rule:xu(/BOUND_TO|bto\./i),map:(e,t)=>xf(gn.struct.modifier.includeConnected({0:gn.struct.modifier.union({0:t})}))},{"@desc":"Extends s1 by X bonds connected to atoms in s1.","@examples":["resname LIG EXTEND 3"],name:"extend",abbr:["xt."],type:LD,rule:UD(/(EXTEND|xt\.)\s+([0-9]+)/i,2).map(e=>parseInt(e)),map:(e,t)=>xf(gn.struct.modifier.includeConnected({0:gn.struct.modifier.union({0:t}),"bond-test":!0,"layer-count":e}))}],Dt=ue,wa={nucleic:["A","C","T","G","U","DA","DC","DT","DG","DU"],protein:["ALA","ARG","ASN","ASP","CYS","CYX","GLN","GLU","GLY","HIS","HID","HIE","HIP","ILE","LEU","LYS","MET","MSE","PHE","PRO","SER","THR","TRP","TYR","VAL"],solvent:["HOH","WAT","H20","TIP","SOL"]},hoe_nucleic=["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*","C2'","C1'","O4'","O2'"],hoe_protein=["C","N","CA","O"];function moe(){return Dt.struct.combinator.merge([Dt.struct.modifier.intersectBy({0:Dt.struct.generator.atomGroups({"residue-test":Dt.core.set.has([Dt.core.type.set(wa.protein),Dt.ammp("label_comp_id")])}),by:Dt.struct.generator.atomGroups({"atom-test":Dt.core.set.has([Dt.core.type.set(hoe_protein),Dt.ammp("label_atom_id")])})}),Dt.struct.modifier.intersectBy({0:Dt.struct.generator.atomGroups({"residue-test":Dt.core.set.has([Dt.core.type.set(wa.nucleic),Dt.ammp("label_comp_id")])}),by:Dt.struct.generator.atomGroups({"atom-test":Dt.core.set.has([Dt.core.type.set(hoe_nucleic),Dt.ammp("label_atom_id")])})})])}const goe={all:{"@desc":"All atoms currently loaded into PyMOL",abbr:["*"],map:()=>Dt.struct.generator.all()},none:{"@desc":"No atoms (empty selection)",map:()=>Dt.struct.generator.empty()},hydrogens:{"@desc":"All hydrogen atoms currently loaded into PyMOL",abbr:["hydro","h."],map:()=>Dt.struct.generator.atomGroups({"atom-test":Dt.core.rel.eq([Dt.acp("elementSymbol"),Dt.es("H")])})},hetatm:{"@desc":"All atoms loaded from Protein Data Bank HETATM records",abbr:["het"],map:()=>Dt.struct.generator.atomGroups({"atom-test":Dt.core.rel.eq([Dt.ammp("isHet"),!0])})},visible:{"@desc":"All atoms in enabled objects with at least one visible representation",abbr:["v."]},polymer:{"@desc":"All atoms on the polymer (not het). Finds atoms with residue identifiers matching a known polymer, such a peptide and DNA.",abbr:["pol."],map:()=>Dt.struct.generator.atomGroups({"residue-test":Dt.core.set.has([Dt.core.type.set(wa.nucleic.concat(wa.protein)),Dt.ammp("label_comp_id")])})},sidechain:{"@desc":"Polymer non-backbone atoms (new in PyMOL 1.6.1)",abbr:["sc."],map:()=>Dt.struct.modifier.exceptBy({0:Dt.struct.generator.atomGroups({"residue-test":Dt.core.set.has([Dt.core.type.set(wa.nucleic.concat(wa.protein)),Dt.ammp("label_comp_id")])}),by:moe()})},present:{"@desc":"All atoms with defined coordinates in the current state (used in creating movies)",abbr:["pr."]},center:{"@desc":"Pseudo-atom at the center of the scene"},origin:{"@desc":"Pseudo-atom at the origin of rotation"},enabled:{"@desc":"All enabled objects or selections from the object list."},masked:{"@desc":"All masked atoms.",abbr:["msk."]},protected:{"@desc":"All protected atoms.",abbr:["pr."]},bonded:{"@desc":"All bonded atoms",map:()=>Dt.struct.generator.atomGroups({"atom-test":Dt.core.rel.gr([Dt.struct.atomProperty.core.bondCount({flags:Dt.struct.type.bondFlags(["covalent","metallic","sulfide"])}),0])})},donors:{"@desc":"All hydrogen bond donor atoms.",abbr:["don."]},acceptors:{"@desc":"All hydrogen bond acceptor atoms.",abbr:["acc."]},fixed:{"@desc":"All fixed atoms.",abbr:["fxd."]},restrained:{"@desc":"All restrained atoms.",abbr:["rst."]},organic:{"@desc":"All atoms in non-polymer organic compounds (e.g. ligands, buffers). Finds carbon-containing molecules that do not match known polymers.",abbr:["org."],map:()=>xf(Dt.struct.modifier.expandProperty({0:Dt.struct.modifier.union([Dt.struct.generator.queryInSelection({0:Dt.struct.generator.atomGroups({"residue-test":Dt.core.logic.not([Dt.core.set.has([Dt.core.type.set(wa.nucleic.concat(wa.protein)),Dt.ammp("label_comp_id")])])}),query:Dt.struct.generator.atomGroups({"atom-test":Dt.core.rel.eq([Dt.es("C"),Dt.acp("elementSymbol")])})})]),property:Dt.ammp("residueKey")}))},inorganic:{"@desc":"All non-polymer inorganic atoms/ions. Finds atoms in molecules that do not contain carbon and do not match any known solvent residues.",abbr:["ino."],map:()=>xf(Dt.struct.modifier.expandProperty({0:Dt.struct.modifier.union([Dt.struct.filter.pick({0:Dt.struct.generator.atomGroups({"residue-test":Dt.core.logic.not([Dt.core.set.has([Dt.core.type.set(wa.nucleic.concat(wa.protein).concat(wa.solvent)),Dt.ammp("label_comp_id")])]),"group-by":Dt.ammp("residueKey")}),test:Dt.core.logic.not([Dt.core.set.has([Dt.struct.atomSet.propertySet([Dt.acp("elementSymbol")]),Dt.es("C")])])})]),property:Dt.ammp("residueKey")}))},solvent:{"@desc":"All water molecules. The hardcoded solvent residue identifiers are currently: HOH, WAT, H20, TIP, SOL.",abbr:["sol."],map:()=>Dt.struct.generator.atomGroups({"residue-test":Dt.core.set.has([Dt.core.type.set(wa.solvent),Dt.ammp("label_comp_id")])})},guide:{"@desc":"All protein CA and nucleic acid C4*/C4",map:()=>Dt.struct.combinator.merge([Dt.struct.generator.atomGroups({"atom-test":Dt.core.rel.eq([Dt.atomName("CA"),Dt.ammp("label_atom_id")]),"residue-test":Dt.core.set.has([Dt.core.type.set(wa.protein),Dt.ammp("label_comp_id")])}),Dt.struct.generator.atomGroups({"atom-test":Dt.core.set.has([_f(["C4*","C4'"]),Dt.ammp("label_atom_id")]),"residue-test":Dt.core.set.has([Dt.core.type.set(wa.nucleic),Dt.ammp("label_comp_id")])})])},metals:{"@desc":"All metal atoms (new in PyMOL 1.6.1)"},backbone:{"@desc":"Polymer backbone atoms (new in PyMOL 1.6.1)",abbr:["bb."],map:()=>moe()},"polymer.protein":{"@desc":"Protein (New in PyMOL 2.1)",abbr:["polymer.protein"],map:()=>Dt.struct.generator.atomGroups({"residue-test":Dt.core.set.has([Dt.core.type.set(wa.protein),Dt.ammp("label_comp_id")])})},"polymer.nucleic":{"@desc":"Nucleic Acid (New in PyMOL 2.1)",abbr:["polymer.nucleic"],map:()=>Dt.struct.generator.atomGroups({"residue-test":Dt.core.set.has([Dt.core.type.set(wa.nucleic),Dt.ammp("label_comp_id")])})}},WWe=ue,So=function TWe(e){const t={};return Object.keys(e).sort(vf).forEach(n=>{const r=e[n],i=bm(`property '${n}' not supported`),o=Be.regexp(r.regex).map(s=>(r.isUnsupported&&i(),H5(r.property,r.map(s))));r.isNumeric||(t[n]=o)}),t}(zD),Mo=Be.string("/");function bi(e){return e.or(Be.of(null))}function $We(e){const t={},n={};for(const r in e){const i=zD[r];if(!i)throw new Error(`property '${r}' not supported, value '${e[r]}'`);null!==e[r]&&(n[i.level]||(n[i.level]=[]),n[i.level].push(e[r]))}for(const r in n)t[r]=j5(n[r]);return WWe.struct.generator.atomGroups(t)}const YWe=Be.createLanguage({Parens:function(e){return Be.alt(e.Parens,e.Operator,e.Expression).wrap(Be.string("("),Be.string(")"))},Expression:function(e){return Be.alt(e.Keywords,e.AtomSelectionMacro.map($We),e.NamedAtomProperties,e.Pepseq,e.Rep,e.Object)},AtomSelectionMacro:function(e){return Be.alt(Mo.then(Be.alt(Be.seq(bi(e.ObjectProperty).skip(Mo),bi(So.segi).skip(Mo),bi(So.chain).skip(Mo),bi(So.resi).skip(Mo),bi(So.name)).map(t=>({object:t[0],segi:t[1],chain:t[2],resi:t[3],name:t[4]})),Be.seq(bi(e.ObjectProperty).skip(Mo),bi(So.segi).skip(Mo),bi(So.chain).skip(Mo),bi(So.resi)).map(t=>({object:t[0],segi:t[1],chain:t[2],resi:t[3]})),Be.seq(bi(e.ObjectProperty).skip(Mo),bi(So.segi).skip(Mo),bi(So.chain)).map(t=>({object:t[0],segi:t[1],chain:t[2]})),Be.seq(bi(e.ObjectProperty).skip(Mo),bi(So.segi)).map(t=>({object:t[0],segi:t[1]})),Be.seq(bi(e.ObjectProperty)).map(t=>({object:t[0]})))),Be.alt(Be.seq(bi(e.ObjectProperty).skip(Mo),bi(So.segi).skip(Mo),bi(So.chain).skip(Mo),bi(So.resi).skip(Mo),bi(So.name)).map(t=>({object:t[0],segi:t[1],chain:t[2],resi:t[3],name:t[4]})),Be.seq(bi(So.segi).skip(Mo),bi(So.chain).skip(Mo),bi(So.resi).skip(Mo),bi(So.name)).map(t=>({segi:t[0],chain:t[1],resi:t[2],name:t[3]})),Be.seq(bi(So.chain).skip(Mo),bi(So.resi).skip(Mo),bi(So.name)).map(t=>({chain:t[0],resi:t[1],name:t[2]})),Be.seq(bi(So.resi).skip(Mo),bi(So.name)).map(t=>({resi:t[0],name:t[1]}))))},NamedAtomProperties:function(){return Be.alt(...ooe(zD))},Keywords:()=>Be.alt(...W5(goe)),ObjectProperty:()=>{const e=Y5(zD,goe,poe).sort(vf).map(s2).join("|");return Be.regexp(new RegExp(`(?!(${e}))[A-Z0-9_]+`,"i"))},Object:e=>e.ObjectProperty.notFollowedBy(Mo).map(t=>{throw new Error(`property 'object' not supported, value '${t}'`)}),Pepseq:()=>Be.regexp(/(PEPSEQ|ps\.)\s+([a-z]+)/i,2).map(bm("operator 'pepseq' not supported")),Rep:()=>Be.regexp(/REP\s+(lines|spheres|mesh|ribbon|cartoon|sticks|dots|surface|labels|extent|nonbonded|nb_spheres|slice|extent|slice|dashes|angles|dihedrals|cgo|cell|callback|everything)/i,1).map(bm("operator 'rep' not supported")),Operator:function(e){return xS(poe,Be.alt(e.Parens,e.Expression,e.Operator))},Query:function(e){return Be.alt(e.Operator,e.Parens,e.Expression).trim(Be.optWhitespace)}}),co=ue,Bc=/[-+]?[0-9]*\.?[0-9]+/,GD=/[+]?[0-9]+/,AS=/[-+]?[0-9]+/;function h0(e){return e}const yoe={T:"turn",E:"sheet",B:"strand",H:"alpha",G:"3-10",I:"pi",C:"none"};function K5(e){return co.struct.type.secondaryStructureFlags([yoe[e.toUpperCase()]||"none"])}const m0={name:{"@desc":"str atom name","@examples":["name CA"],regex:/[a-zA-Z0-9]+/,map:co.atomName,level:"atom-test",property:co.ammp("label_atom_id")},type:{"@desc":"str atom type","@examples":["type C3"],isUnsupported:!0,regex:/[a-zA-Z0-9]+/,map:h0,level:"atom-test"},index:{"@desc":"num the atom number, starting at 0","@examples":["index 10"],isNumeric:!0,regex:GD,map:e=>parseInt(e)-1,level:"atom-test",property:co.ammp("id")},serial:{"@desc":"num the atom number, starting at 1","@examples":["serial 11"],isNumeric:!0,regex:GD,map:e=>parseInt(e),level:"atom-test",property:co.ammp("id")},atomicnumber:{"@desc":"num atomic number (0 if undefined)","@examples":["atomicnumber 13"],isNumeric:!0,regex:GD,map:e=>parseInt(e),level:"atom-test",property:co.acp("atomicNumber")},element:{"@desc":'str atomic element symbol string ("X" if undefined)',"@examples":["element N"],regex:/[a-zA-Z0-9]{1,3}/,map:e=>co.es(e),level:"atom-test",property:co.acp("elementSymbol")},altloc:{"@desc":"str alternate location/conformation identifier","@examples":["altloc C"],regex:/[a-zA-Z0-9]+/,map:h0,level:"atom-test",property:co.ammp("label_alt_id")},chain:{"@desc":"str the one-character chain identifier","@examples":["chain A"],regex:/[a-zA-Z0-9]+/,map:h0,level:"residue-test",property:co.ammp("auth_asym_id")},residue:{"@desc":"num a set of connected atoms with the same residue number","@examples":["residue < 11","residue 11"],isNumeric:!0,regex:AS,map:e=>parseInt(e),level:"residue-test",property:co.ammp("auth_seq_id")},fragment:{"@desc":"num a set of connected residues","@examples":["fragment 42"],isUnsupported:!0,isNumeric:!0,regex:AS,map:e=>parseInt(e),level:"residue-test"},pfrag:{"@desc":"num a set of connected protein residues","@examples":["pfrag 42"],isUnsupported:!0,isNumeric:!0,regex:AS,map:e=>parseInt(e),level:"residue-test"},nfrag:{"@desc":"num a set of connected nucleic residues","@examples":["nfrag 42"],isUnsupported:!0,isNumeric:!0,regex:AS,map:e=>parseInt(e),level:"residue-test"},sequence:{"@desc":"str a sequence given by one letter names","@examples":["sequence PGATTACA"],isUnsupported:!0,regex:/[a-zA-Z0-9]+/,map:h0,level:"residue-test"},numbonds:{"@desc":"num number of bonds","@examples":["numbonds = 2","numbonds >= 3"],isNumeric:!0,regex:GD,map:e=>parseInt(e),level:"atom-test",property:co.acp("bondCount")},resname:{"@desc":"str residue name","@examples":["resname ALA"],regex:/[a-zA-Z0-9]+/,map:h0,level:"residue-test",property:co.ammp("auth_comp_id")},resid:{"@desc":"num residue id","@examples":["resid 42"],isNumeric:!0,regex:AS,map:e=>parseInt(e),level:"residue-test",property:co.ammp("auth_seq_id")},segname:{"@desc":"str segment name","@examples":["segname B"],regex:/[a-zA-Z0-9]+/,map:h0,level:"residue-test",property:co.ammp("label_asym_id")},x:{"@desc":"float x coordinate","@examples":["x 42"],isNumeric:!0,regex:Bc,map:e=>parseFloat(e),level:"atom-test",property:co.acp("x")},y:{"@desc":"float y coordinate","@examples":["y > 1.7"],isNumeric:!0,regex:Bc,map:e=>parseFloat(e),level:"atom-test",property:co.acp("y")},z:{"@desc":"float z coordinate","@examples":["z < 11","z > -21"],isNumeric:!0,regex:Bc,map:e=>parseFloat(e),level:"atom-test",property:co.acp("z")},radius:{"@desc":"float atomic radius","@examples":["radius > 1.3"],isNumeric:!0,regex:Bc,map:e=>parseFloat(e),level:"atom-test",property:co.acp("vdw")},mass:{"@desc":"float atomic mass","@examples":["mass > 2"],isNumeric:!0,regex:Bc,map:e=>parseFloat(e),level:"atom-test",property:co.acp("mass")},charge:{"@desc":"float atomic charge","@examples":["charge > 0","charge 1"],isNumeric:!0,regex:Bc,map:e=>parseFloat(e),level:"atom-test",property:co.ammp("pdbx_formal_charge")},beta:{"@desc":"float temperature factor","@examples":["beta < 20","beta > 35"],isNumeric:!0,regex:Bc,map:e=>parseFloat(e),level:"atom-test",property:co.ammp("B_iso_or_equiv")},occupancy:{"@desc":"float occupancy","@examples":["occupancy 1","occupancy < 1"],isNumeric:!0,regex:Bc,map:e=>parseFloat(e),level:"atom-test",property:co.ammp("occupancy")},user:{"@desc":"float time-varying user-specified value","@examples":["user < 0.1"],isUnsupported:!0,isNumeric:!0,regex:Bc,map:e=>parseFloat(e),level:"atom-test"},rasmol:{"@desc":"str translates Rasmol selection string to VMD","@examples":["rasmol 'all'"],isUnsupported:!0,regex:/[^']*/,map:h0,level:"atom-test"},structure:{"@desc":"str single letter name for the secondary structure","@examples":["structure H","structure H E"],regex:/T|E|B|H|G|I|C/i,map:K5,level:"atom-test",property:co.ammp("secondaryStructureFlags")},phi:{"@desc":"float phi backbone conformational angles","@examples":["phi < 160"],isUnsupported:!0,isNumeric:!0,regex:Bc,map:e=>parseFloat(e),level:"residue-test"},psi:{"@desc":"float psi backbone conformational angles","@examples":["psi < 160"],isUnsupported:!0,isNumeric:!0,regex:Bc,map:e=>parseFloat(e),level:"residue-test"},ufx:{"@desc":"num force to apply in the x coordinate","@examples":["ufx 1"],isUnsupported:!0,isNumeric:!0,regex:Bc,map:e=>parseInt(e),level:"atom-test"},ufy:{"@desc":"num force to apply in the y coordinate","@examples":["ufy 1"],isUnsupported:!0,isNumeric:!0,regex:Bc,map:e=>parseInt(e),level:"atom-test"},ufz:{"@desc":"num force to apply in the z coordinate","@examples":["ufz 1"],isUnsupported:!0,isNumeric:!0,regex:Bc,map:e=>parseInt(e),level:"atom-test"}},g0=ue,KWe=Object.keys(m0).sort(vf).filter(e=>!m0[e].isUnsupported).join("|"),boe=[{"@desc":"Selects atoms that are not included in s1.","@examples":["not protein"],name:"not",type:Ca,rule:Be.regexp(/NOT/i).skip(Be.whitespace),map:(e,t)=>Su(t)},{"@desc":"Selects atoms within a specified distance of a selection","@examples":["within 5 of name FE"],name:"within",type:Ca,rule:xu(/WITHIN\s+([-+]?[0-9]*\.?[0-9]+)\s+OF/i,1).map(e=>parseFloat(e)),map:(e,t)=>g0.struct.modifier.includeSurroundings({0:t,radius:e})},{"@desc":"Exclusive within, equivalent to (within 3 of X) and not X","@examples":["exwithin 10 of resname HEM"],name:"exwithin",type:Ca,rule:xu(/EXWITHIN\s+([-+]?[0-9]*\.?[0-9]+)\s+OF/i,1).map(e=>parseFloat(e)),map:(e,t)=>g0.struct.modifier.exceptBy({0:g0.struct.modifier.includeSurroundings({0:t,radius:e}),by:t})},{"@desc":"Selects atoms which have the same keyword as the atoms in a given selection","@examples":["same resid as name FE"],name:"same",type:Ca,rule:xu(new RegExp(`SAME\\s+(${KWe})\\s+AS`,"i"),1).map(e=>m0[e].property),map:(e,t)=>g0.struct.filter.withSameAtomProperties({0:g0.struct.generator.all(),source:t,property:e})},{"@desc":"Selects atoms included in both s1 and s2.","@examples":["backbone and protein"],name:"and",type:sc,rule:Be.alt(Yp(/AND/i),Be.whitespace),map:(e,t,n)=>g0.struct.modifier.intersectBy({0:t,by:n})},{"@desc":"Selects atoms included in either s1 or s2.","@examples":["water or protein"],name:"or",type:sc,rule:Yp(/OR/i),map:(e,t,n)=>g0.struct.combinator.merge([t,n])}],Dn=ue;function Xp(){return Dn.struct.filter.pick({0:Dn.struct.generator.atomGroups({"group-by":Dn.ammp("residueKey")}),test:Dn.core.set.isSubset([_f(["C","N","CA","O"]),Dn.ammpSet("label_atom_id")])})}function Z5(){return Dn.struct.filter.pick({0:Dn.struct.generator.atomGroups({"group-by":Dn.ammp("residueKey")}),test:Dn.core.logic.and([Dn.core.set.isSubset([_f(["P"]),Dn.ammpSet("label_atom_id")]),Dn.core.logic.or([Dn.core.set.isSubset([_f(["O3'","C3'","C4'","C5'","O5'"]),Dn.ammpSet("label_atom_id")]),Dn.core.set.isSubset([_f(["O3*","C3*","C4*","C5*","O5*"]),Dn.ammpSet("label_atom_id")])])])})}function voe(){return Dn.struct.combinator.merge([Dn.struct.generator.queryInSelection({0:Xp(),query:Dn.struct.generator.atomGroups({"atom-test":Dn.core.set.has([_f(_oe.protein),Dn.ammp("label_atom_id")])})}),Dn.struct.generator.queryInSelection({0:Z5(),query:Dn.struct.generator.atomGroups({"atom-test":Dn.core.set.has([_f(_oe.nucleic),Dn.ammp("label_atom_id")])})})])}function Sf(e){return Dn.struct.generator.atomGroups({"residue-test":Dn.core.flags.hasAll([Dn.ammp("secondaryStructureFlags"),Dn.struct.type.secondaryStructureFlags(e)])})}const _oe={nucleic:["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*"],protein:["C","N","CA","O"]},Ro={acidic:["ASP","GLU"],aliphatic:["ALA","GLY","ILE","LEU","VAL"],aromatic:["HIS","PHE","TRP","TYR"],at:["ADA","A","THY","T"],basic:["ARG","HIS","LYS"],buried:["ALA","LEU","VAL","ILE","PHE","CYS","MET","TRP"],cg:["CYT","C","GUA","G"],cyclic:["HIS","PHE","PRO","TRP","TYR"],hydrophobic:["ALA","LEU","VAL","ILE","PRO","PHE","MET","TRP"],medium:["VAL","THR","ASP","ASN","PRO","CYS","ASX","PCA","HYP"],neutral:["VAL","PHE","GLN","TYR","HIS","CYS","MET","TRP","ASX","GLX","PCA","HYP"],purine:["ADE","A","GUA","G"],pyrimidine:["CYT","C","THY","T","URI","U"],small:["ALA","GLY","SER"],water:["H2O","HH0","OHH","HOH","OH2","SOL","WAT","TIP","TIP2","TIP3","TIP4"]},xoe={all:{"@desc":"everything",map:()=>Dn.struct.generator.all()},none:{"@desc":"nothing",map:()=>Dn.struct.generator.empty()},protein:{"@desc":"a residue with atoms named C, N, CA, and O",map:()=>Xp()},nucleic:{"@desc":"a residue with atoms named P, O1P, O2P and either O3', C3', C4', C5', O5' or O3*, C3*, C4*, C5*, O5*. This definition assumes that the base is phosphorylated, an assumption which will be corrected in the future.",map:()=>Z5()},backbone:{"@desc":"the C, N, CA, and O atoms of a protein and the equivalent atoms in a nucleic acid.",map:()=>voe()},sidechain:{"@desc":"non-backbone atoms and bonds",map:()=>Su(voe())},water:{"@desc":"all atoms with the resname H2O, HH0, OHH, HOH, OH2, SOL, WAT, TIP, TIP2, TIP3 or TIP4",abbr:["waters"],map:()=>er(Ro.water)},at:{"@desc":"residues named ADA A THY T",map:()=>er(Ro.at)},acidic:{"@desc":"residues named ASP GLU",map:()=>er(Ro.acidic)},acyclic:{"@desc":'"protein and not cyclic"',map:()=>Dn.struct.modifier.intersectBy({0:Xp(),by:Su(er(Ro.cyclic))})},aliphatic:{"@desc":"residues named ALA GLY ILE LEU VAL",map:()=>er(Ro.aliphatic)},alpha:{"@desc":"atom's residue is an alpha helix",map:()=>Sf(["alpha"])},amino:{"@desc":"a residue with atoms named C, N, CA, and O",map:()=>Xp()},aromatic:{"@desc":"residues named HIS PHE TRP TYR",map:()=>er(Ro.aromatic)},basic:{"@desc":"residues named ARG HIS LYS",map:()=>er(Ro.basic)},bonded:{"@desc":"atoms for which numbonds > 0",map:()=>xf(Dn.struct.filter.pick({0:Dn.struct.modifier.includeConnected({0:Dn.struct.generator.all(),"bond-test":Dn.core.flags.hasAny([Dn.struct.bondProperty.flags(),Dn.struct.type.bondFlags(["covalent","metallic","sulfide"])])}),test:Dn.core.rel.gr([Dn.struct.atomSet.atomCount(),1])}))},buried:{"@desc":"residues named ALA LEU VAL ILE PHE CYS MET TRP",map:()=>er(Ro.buried)},cg:{"@desc":"residues named CYT C GUA G",map:()=>er(Ro.cg)},charged:{"@desc":'"basic or acidic"',map:()=>er(Ro.basic.concat(Ro.acidic))},cyclic:{"@desc":"residues named HIS PHE PRO TRP TYR",map:()=>er(Ro.cyclic)},hetero:{"@desc":'"not (protein or nucleic)"',map:()=>Su(Dn.struct.combinator.merge([Xp(),Z5()]))},hydrogen:{"@desc":'name "[0-9]?H.*"',map:()=>Dn.struct.generator.atomGroups({"atom-test":Dn.core.str.match([Dn.core.type.regex(["^[0-9]?[H].*$","i"]),Dn.core.type.str([Dn.ammp("label_atom_id")])])})},large:{"@desc":'"protein and not (small or medium)"',map:()=>Dn.struct.modifier.intersectBy({0:Xp(),by:Su(er(Ro.small.concat(Ro.medium)))})},medium:{"@desc":"residues named VAL THR ASP ASN PRO CYS ASX PCA HYP",map:()=>er(Ro.medium)},neutral:{"@desc":"residues named VAL PHE GLN TYR HIS CYS MET TRP ASX GLX PCA HYP",map:()=>er(Ro.neutral)},hydrophobic:{"@desc":"hydrophobic resname ALA LEU VAL ILE PRO PHE MET TRP",map:()=>er(Ro.hydrophobic)},polar:{"@desc":'"protein and not hydrophobic"',map:()=>Dn.struct.modifier.intersectBy({0:Xp(),by:Su(er(Ro.hydrophobic))})},purine:{"@desc":"residues named ADE A GUA G",map:()=>er(Ro.purine)},pyrimidine:{"@desc":"residues named CYT C THY T URI U",map:()=>er(Ro.pyrimidine)},small:{"@desc":"residues named ALA GLY SER",map:()=>er(Ro.small)},surface:{"@desc":'"protein and not buried"',map:()=>Dn.struct.modifier.intersectBy({0:Xp(),by:Su(er(Ro.buried))})},alpha_helix:{"@desc":"atom's residue is in an alpha helix",map:()=>Sf(["alpha"])},pi_helix:{"@desc":"atom's residue is in a pi helix",map:()=>Sf(["pi"])},helix_3_10:{"@desc":"atom's residue is in a 3-10 helix",map:()=>Sf(["3-10"])},helix:{"@desc":"atom's residue is in an alpha or pi or 3-10 helix",map:()=>Sf(["helix"])},extended_beta:{"@desc":"atom's residue is a beta sheet",map:()=>Sf(["sheet"])},bridge_beta:{"@desc":"atom's residue is a beta sheet",map:()=>Sf(["strand"])},sheet:{"@desc":"atom's residue is a beta sheet",map:()=>Sf(["beta"])},turn:{"@desc":"atom's residue is in a turn conformation",map:()=>Sf(["turn"])},coil:{"@desc":"atom's residue is in a coil conformation",map:()=>Dn.struct.modifier.intersectBy({0:Xp(),by:Sf(["none"])})}},ia=ue,ZWe={sqr:{"@desc":"square of x","@examples":["sqr(2)"],map:e=>ia.core.math.pow([e,2])},sqrt:{"@desc":"square root of x","@examples":["sqrt(2)"],map:e=>ia.core.math.sqrt([e])},abs:{"@desc":"absolute value of x","@examples":["abs(2)"],map:e=>ia.core.math.abs([e])},floor:{"@desc":"largest integer not greater than x","@examples":["floor(2)"],map:e=>ia.core.math.floor([e])},ceil:{"@desc":"smallest integer not less than x","@examples":["ceil(2)"],map:e=>ia.core.math.ceil([e])},sin:{"@desc":"sine of x","@examples":["sin(2)"],map:e=>ia.core.math.sin([e])},cos:{"@desc":"cosine of x","@examples":["cos(2)"],map:e=>ia.core.math.cos([e])},tan:{"@desc":"tangent of x","@examples":["tan(2)"],map:e=>ia.core.math.tan([e])},atan:{"@desc":"arctangent of x","@examples":["atan(2)"],map:e=>ia.core.math.atan([e])},asin:{"@desc":"arcsin of x","@examples":["asin(2)"],map:e=>ia.core.math.asin([e])},acos:{"@desc":"arccos of x","@examples":["acos(2)"],map:e=>ia.core.math.acos([e])},sinh:{"@desc":"hyperbolic sine of x","@examples":["sinh(2)"],map:e=>ia.core.math.sinh([e])},cosh:{"@desc":"hyperbolic cosine of x","@examples":["cosh(2)"],map:e=>ia.core.math.cosh([e])},tanh:{"@desc":"hyperbolic tangent of x","@examples":["tanh(2)"],map:e=>ia.core.math.tanh([e])},exp:{"@desc":"e to the power x","@examples":["exp(2)"],map:e=>ia.core.math.exp([e])},log:{"@desc":"natural log of x","@examples":["log(2)"],map:e=>ia.core.math.log([e])},log10:{"@desc":"log base 10 of x","@examples":["log10(2)"],map:e=>ia.core.math.log10([e])}},Di=ue,QWe=[{"@desc":"multiplication, division","@examples":[],name:"mul-div",type:sc,rule:Be.regexp(/\s*(\*|\/)\s*/,1),map:(e,t,n)=>{switch(e){case"*":return Di.core.math.mult([t,n]);case"/":return Di.core.math.div([t,n]);default:throw new Error(`value operator '${e}' not supported`)}}},{"@desc":"addition, substraction","@examples":[],name:"add-sub",type:sc,rule:Be.regexp(/\s*(-|\+)\s*/,1),map:(e,t,n)=>{switch(e){case"-":return Di.core.math.sub([t,n]);case"+":return Di.core.math.add([t,n]);default:throw new Error(`value operator '${e}' not supported`)}}},{"@desc":"value comparisons","@examples":[],name:"comparison",type:sc,rule:Be.alt(Be.regexp(/\s*(=~|==|>=|<=|=|!=|>|<)\s*/,1),Be.whitespace.result("=")),map:(e,t,n)=>{let r;if(void 0!==t.head?("structure-query.atom-property.macromolecular.secondary-structure-flags"===t.head.name&&(r=Di.core.flags.hasAny([t,K5(n)])),"core.type.regex"===t.head.name&&(r=Di.core.str.match([t,Di.core.type.str([n])]))):void 0!==n.head?("structure-query.atom-property.macromolecular.secondary-structure-flags"===n.head.name&&(r=Di.core.flags.hasAny([n,K5(t)])),"core.type.regex"===n.head.name&&(r=Di.core.str.match([n,Di.core.type.str([t])]))):"=~"===e&&(r=Di.core.str.match(t.head?[Di.core.type.regex([`^${n}$`,"i"]),Di.core.type.str([t])]:[Di.core.type.regex([`^${t}$`,"i"]),Di.core.type.str([n])])),!r)switch(t.head&&(n=SS(t,n)),n.head&&(t=SS(n,t)),e){case"=":case"==":r=Di.core.rel.eq([t,n]);break;case"!=":r=Di.core.rel.neq([t,n]);break;case">":r=Di.core.rel.gr([t,n]);break;case"<":r=Di.core.rel.lt([t,n]);break;case">=":r=Di.core.rel.gre([t,n]);break;case"<=":r=Di.core.rel.lte([t,n]);break;default:throw new Error(`value operator '${e}' not supported`)}return Di.struct.generator.atomGroups({"atom-test":r})}}],JWe=Be.createLanguage({Parens:function(e){return Be.alt(e.Parens,e.Operator,e.Expression).wrap(Be.string("("),Be.string(")"))},Expression:function(e){return Be.alt(e.RangeListProperty,e.ValueQuery,e.Keywords)},NamedAtomProperties:function(){return Be.alt(...ooe(m0))},Keywords:()=>Be.alt(...W5(xoe)),ValueRange:function(e){return Be.seq(e.Value.skip(Be.regexp(/\s+TO\s+/i)),e.Value).map(t=>({range:t}))},RangeListProperty:function(e){return Be.seq(Be.alt(...$5(m0,/\s/)).skip(Be.whitespace),Be.alt(e.ValueRange,e.Value).sepBy1(Be.whitespace)).map(t=>{const[n,r]=t,i=[],o=[];r.forEach(u=>{u.range?o.push(Di.core.rel.inRange([n,u.range[0],u.range[1]])):i.push(SS(n,u,yoe))});const s=function IWe(e){return 1===e.length?e[0]:e.length>1?$r.core.logic.or(e):void 0}(o),a=function NWe(e,t){if(kWe.includes(e.head.name)){const n=t[0].head,r=[];return t.forEach(i=>r.push(...i.args[0])),$r.core.flags.hasAny([e,{head:n,args:r}])}return 1===t.length?$r.core.rel.eq([e,t[0]]):t.length>1?$r.core.set.has([$r.core.type.set(t),e]):void 0}(n,i);let c;return c=s&&a?Di.core.logic.or([s,a]):s||a,Di.struct.generator.atomGroups({[RWe(n)]:c})})},Operator:function(e){return xS(boe,Be.alt(e.Parens,e.Expression,e.ValueQuery))},Query:function(e){return Be.alt(e.Operator,e.Parens,e.Expression).trim(Be.optWhitespace)},Number:function(){return Be.regexp(/-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?/).map(Number).desc("number")},String:function(){const e=Y5(m0,xoe,boe).sort(vf).map(s2).join("|");return Be.alt(Be.regexp(new RegExp(`(?!(${e}))[A-Z0-9_]+`,"i")),Be.regexp(/'((?:[^"\\]|\\.)*)'/,1),Be.regexp(/"((?:[^"\\]|\\.)*)"/,1).map(t=>Di.core.type.regex([`^${t}$`,"i"]))).desc("string")},Value:function(e){return Be.alt(e.Number,e.String)},ValueParens:function(e){return Be.alt(e.ValueParens,e.ValueOperator,e.ValueExpressions).wrap(Be.string("("),Be.string(")"))},ValuePropertyNames:function(){return Be.alt(...$5(m0,/=~|==|>=|<=|=|!=|>|<|\)|\s|\+|-|\*|\//i))},ValueOperator:function(e){return xS(QWe,Be.alt(e.ValueParens,e.ValueExpressions))},ValueExpressions:function(e){return Be.alt(e.ValueFunctions,e.Value,e.ValuePropertyNames)},ValueFunctions:function(e){return Be.alt(...function DWe(e,t){const n=[],r=Be.regexp(/\(\s*/),i=Be.regexp(/\s*\)/);return Object.keys(e).sort(vf).forEach(o=>{const s=e[o],a=s.map?s.map:bm(`function '${o}' not supported`),c=Be.regexp(new RegExp(o,"i")).skip(r).then(t).skip(i).map(a);n.push(c)}),n}(ZWe,e.ValueOperator))},ValueQuery:function(e){return Be.alt(e.ValueOperator.map(t=>{if(!t.head.name||!t.head.name.startsWith("structure-query.generator"))throw new Error(`values must be part of an comparison, value '${t}'`);return t}))}}),e$e={pymol:e=>YWe.Query.tryParse(e),vmd:e=>JWe.Query.tryParse(e),jmol:e=>VWe.Query.tryParse(e)},jD=new class n$e{constructor(){this.map=new Map}removeSymbol(t){this.map.delete(t.symbol.id)}addSymbol(t){this.map.has(t.symbol.id)&&console.warn(`Symbol '${t.symbol.id}' already added. Call removeSymbol/removeCustomProps re-adding the symbol.`),this.map.set(t.symbol.id,t)}addCustomProp(t){if(t.symbols)for(const n of Object.keys(t.symbols))this.addSymbol(t.symbols[n])}removeCustomProp(t){if(t.symbols)for(const n of Object.keys(t.symbols))this.removeSymbol(t.symbols[n])}getRuntime(t){return this.map.get(t)}};class r$e{constructor(t){this.table=t,this.constQueryContext=new qu(Ve.Empty)}}var Soe,y0,IS,Nv;!function(e){e.Const=function t(r){return{kind:"const",value:r}},e.Dynamic=function n(r){return{kind:"dynamic",runtime:r}}}(Soe||(Soe={})),function(e){e.Const=function t(r){return{isConst:!0,fn:function(o){return r}}},e.Dynamic=function n(r){return{isConst:!1,fn:r}}}(y0||(y0={})),function(e){e.forEachEval=function t(n,r,i,o){if("number"==typeof n.length)for(let s=0,a=n.length;so[i]=r,[])}),rn(ye.core.type.set,function(t,n){return IS.forEachEval(n,t,function(i,o,s){return s.add(i)},new Set)}),rn(ye.core.type.regex,function(t,n){return new RegExp(n[0](t),n[1]&&n[1](t)||"")}),rn(ye.core.type.bitflags,function(t,n){return+n[0](t)}),rn(ye.core.type.compositeKey,function(t,n){return IS.forEachEval(n,t,(r,i,o)=>o[i]=""+r,[]).join("-")}),rn(ye.core.logic.not,(e,t)=>!t[0](e)),rn(ye.core.logic.and,(e,t)=>{if("number"==typeof t.length){for(let n=0,r=t.length;n{if("number"==typeof t.length){for(let n=0,r=t.length;nt[0](e)===t[1](e)),rn(ye.core.rel.neq,(e,t)=>t[0](e)!==t[1](e)),rn(ye.core.rel.lt,(e,t)=>t[0](e)t[0](e)<=t[1](e)),rn(ye.core.rel.gr,(e,t)=>t[0](e)>t[1](e)),rn(ye.core.rel.gre,(e,t)=>t[0](e)>=t[1](e)),rn(ye.core.rel.inRange,(e,t)=>{const n=t[0](e);return n>=t[1](e)&&n<=t[2](e)}),rn(ye.core.math.add,(e,t)=>{let n=0;if("number"==typeof t.length)for(let r=0,i=t.length;r{let n=0;if("number"==typeof t.length){if(1===t.length)return-t[0](e);n=t[0](e)||0;for(let r=1,i=t.length;r{let n=1;if("number"==typeof t.length)for(let r=0,i=t.length;rt[0](e)/t[1](e)),rn(ye.core.math.pow,(e,t)=>Math.pow(t[0](e),t[1](e))),rn(ye.core.math.mod,(e,t)=>t[0](e)%t[1](e)),rn(ye.core.math.min,(e,t)=>{let n=Number.POSITIVE_INFINITY;if("number"==typeof t.length)for(let r=0,i=t.length;r{let n=Number.NEGATIVE_INFINITY;if("number"==typeof t.length)for(let r=0,i=t.length;ruu(t[0](e),t[1](e))),rn(ye.core.math.sortedCantorPairing,(e,t)=>t2(t[0](e),t[1](e))),rn(ye.core.math.invertCantorPairing,(e,t)=>XZ([0,0],t[0](e))),rn(ye.core.math.floor,(e,t)=>Math.floor(t[0](e))),rn(ye.core.math.ceil,(e,t)=>Math.ceil(t[0](e))),rn(ye.core.math.roundInt,(e,t)=>Math.round(t[0](e))),rn(ye.core.math.trunc,(e,t)=>Math.trunc(t[0](e))),rn(ye.core.math.abs,(e,t)=>Math.abs(t[0](e))),rn(ye.core.math.sign,(e,t)=>Math.sign(t[0](e))),rn(ye.core.math.sqrt,(e,t)=>Math.sqrt(t[0](e))),rn(ye.core.math.cbrt,(e,t)=>Math.cbrt(t[0](e))),rn(ye.core.math.sin,(e,t)=>Math.sin(t[0](e))),rn(ye.core.math.cos,(e,t)=>Math.cos(t[0](e))),rn(ye.core.math.tan,(e,t)=>Math.tan(t[0](e))),rn(ye.core.math.asin,(e,t)=>Math.asin(t[0](e))),rn(ye.core.math.acos,(e,t)=>Math.acos(t[0](e))),rn(ye.core.math.atan,(e,t)=>Math.atan(t[0](e))),rn(ye.core.math.sinh,(e,t)=>Math.sinh(t[0](e))),rn(ye.core.math.cosh,(e,t)=>Math.cosh(t[0](e))),rn(ye.core.math.tanh,(e,t)=>Math.tanh(t[0](e))),rn(ye.core.math.exp,(e,t)=>Math.exp(t[0](e))),rn(ye.core.math.log,(e,t)=>Math.log(t[0](e))),rn(ye.core.math.log10,(e,t)=>Math.log10(t[0](e))),rn(ye.core.math.atan2,(e,t)=>Math.atan2(t[0](e),t[1](e))),rn(ye.core.str.match,(e,t)=>t[0](e).test(t[1](e))),rn(ye.core.str.concat,(e,t)=>{const n=[];if("number"==typeof t.length)for(let r=0,i=t.length;rt[0](e)[t[1](e)]),rn(ye.core.list.equal,(e,t)=>LZ(t[0](e),t[1](e))),rn(ye.core.set.has,function(t,n){return n[0](t).has(n[1](t))}),rn(ye.core.set.isSubset,function(t,n){return Si.isSuperset(n[1](t),n[0](t))}),rn(ye.core.flags.hasAny,(e,t)=>{const n=t[1](e),r=t[0](e);return n?!!(r&n):!!r}),rn(ye.core.flags.hasAll,(e,t)=>{const n=t[1](e),r=t[0](e);return n?(r&n)===n:!r}),rn(ye.structureQuery.type.elementSymbol,(e,t)=>Bg(t[0](e))),rn(ye.structureQuery.type.atomName,(e,t)=>function MNe(e){return e?"string"==typeof e?e.toUpperCase():`${e}`.toUpperCase():""}(t[0](e))),rn(ye.structureQuery.type.bondFlags,(e,t)=>{let n=0;if("number"==typeof t.length)for(let r=0,i=t.length;rHu.elementFingerprint(function o$e(e,t){const n=[];if(!t)return n;if("number"==typeof t.length)for(let r=0,i=t.length;r{let n=0;if("number"==typeof t.length)for(let r=0,i=t.length;rSr.filters.pick(t[0],t.test)(e)),Vt(ye.structureQuery.filter.first,(e,t)=>Sr.filters.first(t[0])(e)),Vt(ye.structureQuery.filter.withSameAtomProperties,(e,t)=>Sr.filters.withSameAtomProperties(t[0],t.source,t.property)(e)),Vt(ye.structureQuery.filter.intersectedBy,(e,t)=>Sr.filters.areIntersectedBy(t[0],t.by)(e)),Vt(ye.structureQuery.filter.within,(e,t)=>{var n,r,i;return Sr.filters.within({query:t[0],target:t.target,minRadius:null===(n=t["min-radius"])||void 0===n?void 0:n.call(t,e),maxRadius:null===(r=t["max-radius"])||void 0===r?void 0:r.call(t,e),elementRadius:t["atom-radius"],invert:null===(i=t.invert)||void 0===i?void 0:i.call(t,e)})(e)}),Vt(ye.structureQuery.filter.isConnectedTo,(e,t)=>{var n,r;return Sr.filters.isConnectedTo({query:t[0],target:t.target,disjunct:null===(n=t.disjunct)||void 0===n?void 0:n.call(t,e),invert:null===(r=t.invert)||void 0===r?void 0:r.call(t,e),bondTest:t["bond-test"]})(e)}),Vt(ye.structureQuery.generator.atomGroups,function(t,n){return Sr.generators.atoms({entityTest:n["entity-test"],chainTest:n["chain-test"],residueTest:n["residue-test"],atomTest:n["atom-test"],groupBy:n["group-by"]})(t)}),Vt(ye.structureQuery.generator.all,function(t){return Sr.generators.all(t)}),Vt(ye.structureQuery.generator.empty,function(t){return Sr.generators.none(t)}),Vt(ye.structureQuery.generator.bondedAtomicPairs,function(t,n){return Sr.generators.bondedAtomicPairs(n&&n[0])(t)}),Vt(ye.structureQuery.generator.rings,function(t,n){var r,i;return Sr.generators.rings(null===(r=n?.fingerprint)||void 0===r?void 0:r.call(n,t),null===(i=n?.["only-aromatic"])||void 0===i?void 0:i.call(n,t))(t)}),Vt(ye.structureQuery.generator.queryInSelection,function(t,n){var r;return Sr.generators.querySelection(n[0],n.query,null===(r=n["in-complement"])||void 0===r?void 0:r.call(n,t))(t)}),Vt(ye.structureQuery.modifier.includeSurroundings,function(t,n){return Sr.modifiers.includeSurroundings(n[0],{radius:n.radius(t),wholeResidues:!(!n["as-whole-residues"]||!n["as-whole-residues"](t)),elementRadius:n["atom-radius"]})(t)}),Vt(ye.structureQuery.modifier.surroundingLigands,function(t,n){return Sr.modifiers.surroundingLigands({query:n[0],radius:n.radius(t),includeWater:!(!n["include-water"]||!n["include-water"](t))})(t)}),Vt(ye.structureQuery.modifier.wholeResidues,function(t,n){return Sr.modifiers.wholeResidues(n[0])(t)}),Vt(ye.structureQuery.modifier.union,function(t,n){return Sr.modifiers.union(n[0])(t)}),Vt(ye.structureQuery.modifier.expandProperty,function(t,n){return Sr.modifiers.expandProperty(n[0],n.property)(t)}),Vt(ye.structureQuery.modifier.exceptBy,function(t,n){return Sr.modifiers.exceptBy(n[0],n.by)(t)}),Vt(ye.structureQuery.modifier.includeConnected,function(t,n){var r,i;return Sr.modifiers.includeConnected({query:n[0],bondTest:n["bond-test"],wholeResidues:!(!n["as-whole-residues"]||!n["as-whole-residues"](t)),layerCount:n["layer-count"]&&n["layer-count"](t)||1,fixedPoint:null!==(i=null===(r=n["fixed-point"])||void 0===r?void 0:r.call(n,t))&&void 0!==i&&i})(t)}),Vt(ye.structureQuery.modifier.intersectBy,function(t,n){return Sr.modifiers.intersectBy(n[0],n.by)(t)}),Vt(ye.structureQuery.combinator.merge,(e,t)=>Sr.combinators.merge(t)(e)),Vt(ye.structureQuery.atomProperty.core.elementSymbol,Gr(Ze.atom.type_symbol)),Vt(ye.structureQuery.atomProperty.core.vdw,(e,t)=>v2(Ze.atom.type_symbol(t&&t[0]&&t[0](e)||e.element))),Vt(ye.structureQuery.atomProperty.core.mass,(e,t)=>function C4e(e){const t=_T[e];return void 0===t?10.81:v4e[t]}(Ze.atom.type_symbol(t&&t[0]&&t[0](e)||e.element))),Vt(ye.structureQuery.atomProperty.core.atomicNumber,(e,t)=>_2(Ze.atom.type_symbol(t&&t[0]&&t[0](e)||e.element))),Vt(ye.structureQuery.atomProperty.core.x,Gr(Ze.atom.x)),Vt(ye.structureQuery.atomProperty.core.y,Gr(Ze.atom.y)),Vt(ye.structureQuery.atomProperty.core.z,Gr(Ze.atom.z)),Vt(ye.structureQuery.atomProperty.core.sourceIndex,Gr(Ze.atom.sourceIndex)),Vt(ye.structureQuery.atomProperty.core.operatorName,Gr(Ze.unit.operator_name)),Vt(ye.structureQuery.atomProperty.core.operatorKey,Gr(Ze.unit.operator_key)),Vt(ye.structureQuery.atomProperty.core.modelIndex,Gr(Ze.unit.model_index)),Vt(ye.structureQuery.atomProperty.core.modelLabel,Gr(Ze.unit.model_label)),Vt(ye.structureQuery.atomProperty.core.atomKey,(e,t)=>{const n=t&&t[0]&&t[0](e)||e.element;return uu(n.unit.id,n.element)}),Vt(ye.structureQuery.atomProperty.macromolecular.residueKey,(e,t)=>function A6e(e){return Ee.isAtomic(e.unit)?e.unit.residueIndex[e.element]:-1}(t&&t[0]&&t[0](e)||e.element)),Vt(ye.structureQuery.atomProperty.macromolecular.chainKey,(e,t)=>function I6e(e){return Ee.isAtomic(e.unit)?e.unit.chainIndex[e.element]:-1}(t&&t[0]&&t[0](e)||e.element)),Vt(ye.structureQuery.atomProperty.macromolecular.entityKey,(e,t)=>function T6e(e){return Ze.entity.key(e)}(t&&t[0]&&t[0](e)||e.element)),Vt(ye.structureQuery.atomProperty.macromolecular.id,Gr(Ze.atom.id)),Vt(ye.structureQuery.atomProperty.macromolecular.isHet,(e,t)=>"ATOM"!==Ze.residue.group_PDB(t&&t[0]&&t[0](e)||e.element)),Vt(ye.structureQuery.atomProperty.macromolecular.label_atom_id,Gr(Ze.atom.label_atom_id)),Vt(ye.structureQuery.atomProperty.macromolecular.label_alt_id,Gr(Ze.atom.label_alt_id)),Vt(ye.structureQuery.atomProperty.macromolecular.label_comp_id,Gr(Ze.atom.label_comp_id)),Vt(ye.structureQuery.atomProperty.macromolecular.label_seq_id,Gr(Ze.residue.label_seq_id)),Vt(ye.structureQuery.atomProperty.macromolecular.label_asym_id,Gr(Ze.chain.label_asym_id)),Vt(ye.structureQuery.atomProperty.macromolecular.label_entity_id,Gr(Ze.entity.id)),Vt(ye.structureQuery.atomProperty.macromolecular.auth_atom_id,Gr(Ze.atom.auth_atom_id)),Vt(ye.structureQuery.atomProperty.macromolecular.auth_comp_id,Gr(Ze.atom.auth_comp_id)),Vt(ye.structureQuery.atomProperty.macromolecular.auth_seq_id,Gr(Ze.residue.auth_seq_id)),Vt(ye.structureQuery.atomProperty.macromolecular.auth_asym_id,Gr(Ze.chain.auth_asym_id)),Vt(ye.structureQuery.atomProperty.macromolecular.pdbx_PDB_ins_code,Gr(Ze.residue.pdbx_PDB_ins_code)),Vt(ye.structureQuery.atomProperty.macromolecular.pdbx_formal_charge,Gr(Ze.atom.pdbx_formal_charge)),Vt(ye.structureQuery.atomProperty.macromolecular.occupancy,Gr(Ze.atom.occupancy)),Vt(ye.structureQuery.atomProperty.macromolecular.B_iso_or_equiv,Gr(Ze.atom.B_iso_or_equiv)),Vt(ye.structureQuery.atomProperty.macromolecular.entityType,Gr(Ze.entity.type)),Vt(ye.structureQuery.atomProperty.macromolecular.entitySubtype,Gr(Ze.entity.subtype)),Vt(ye.structureQuery.atomProperty.macromolecular.entityPrdId,Gr(Ze.entity.prd_id)),Vt(ye.structureQuery.atomProperty.macromolecular.entityDescription,Gr(Ze.entity.pdbx_description)),Vt(ye.structureQuery.atomProperty.macromolecular.objectPrimitive,Gr(Ze.unit.object_primitive)),Vt(ye.structureQuery.atomProperty.macromolecular.isNonStandard,Gr(Ze.residue.isNonStandard)),Vt(ye.structureQuery.atomProperty.macromolecular.secondaryStructureKey,Gr(Ze.residue.secondary_structure_key)),Vt(ye.structureQuery.atomProperty.macromolecular.secondaryStructureFlags,Gr(Ze.residue.secondary_structure_type)),Vt(ye.structureQuery.atomProperty.macromolecular.chemCompType,Gr(Ze.residue.chem_comp_type)),Vt(ye.structureQuery.atomSet.atomCount,function(t,n){return Sr.atomset.atomCount(t)}),Vt(ye.structureQuery.atomSet.countQuery,function(t,n){return Sr.atomset.countQuery(n[0])(t)}),Vt(ye.structureQuery.atomSet.propertySet,function(t,n){return Sr.atomset.propertySet(n[0])(t)}),Vt(ye.structureQuery.bondProperty.order,(e,t)=>e.atomicBond.order),Vt(ye.structureQuery.bondProperty.flags,(e,t)=>e.atomicBond.type),Vt(ye.structureQuery.bondProperty.key,(e,t)=>e.atomicBond.key),Vt(ye.structureQuery.bondProperty.atomA,(e,t)=>e.atomicBond.a),Vt(ye.structureQuery.bondProperty.atomB,(e,t)=>e.atomicBond.b),Vt(ye.structureQuery.bondProperty.length,(e,t)=>e.atomicBond.length),Vt(ye.internal.generator.bundleElement,function(t,n){return FJ(n.groupedUnits(t),n.ranges(t),n.set(t))}),Vt(ye.internal.generator.bundle,function(t,n){return BJ(n.elements(t))(t)}),Vt(ye.internal.generator.current,function(t,n){return t.tryGetCurrentSelection()})];function Gr(e){return(t,n)=>e(n&&n[0]&&n[0](t)||t.element)}function Aoe(e,t){return e|(jn.isName(t)?jn.fromName(t):0)}function Ioe(e,t){switch(t.toLowerCase()){case"helix":return 2|e;case"alpha":return 4098|e;case"pi":return 32770|e;case"310":return 2050|e;case"beta":return 4|e;case"strand":return 4194308|e;case"sheet":return 8388612|e;case"turn":return 16|e;case"bend":return 8|e;case"coil":return 536870912|e;default:return e}}function ko(e,t){return{expression:e,language:t}}!function(){for(const e of i$e)jD.addSymbol(e)}(),function(e){function r(a){switch(a.language){case"mol-script":const c=function AWe(e){return z5.parse(e)}(a.expression);if(0===c.length)throw new Error("No query");return bWe(c[0]);case"pymol":case"jmol":case"vmd":return function t$e(e,t){try{return e$e[e](t)}catch(n){throw console.error(n.message),n}}(a.language,a.expression);default:Rr()}}function i(a){return TS(r(a))}e.Info={"mol-script":"Mol-Script",pymol:"PyMOL",vmd:"VMD",jmol:"Jmol"},e.is=function t(a){return!!a&&"string"==typeof a.expression&&!!a.language},e.areEqual=function n(a,c){return a.language===c.language&&a.expression===c.expression},e.toExpression=r,e.toQuery=i,e.toLoci=function o(a,c){const l=i(a)(new qu(c));return pt.toLociWithSourceUnits(l)},e.getStructureSelection=function s(a,c,u){return TS("function"==typeof a?a(ue):a)(new qu(c,u))}}(ko||(ko={}));const Fv={dynamicBonds:C.Optional(C.Boolean(!1,{description:"Ensure bonds are recalculated upon model changes. Also enables calculation of inter-unit bonds in water molecules and ions."}))};var b0,Aa;!function(e){function r(p,m,h,g,y){return i.apply(this,arguments)}function i(){return(i=ie(function*(p,m,h,g,y){let b;const x=no.Provider.get(h);!g&&x&&0!==x.assemblies.length&&(g=x.assemblies[0].id),x&&0!==x.assemblies.length?(b=h2.findAssembly(h,g||""),b||p.log.warn(`Model '${h.entryId}' has no assembly called '${g}', returning model structure.`)):p.log.warn(`Model '${h.entryId}' has no assembly, returning model structure.`);const _=Ve.ofModel(h,y);if(!b){const E={label:"Model",description:Ve.elementDescription(_)};return new pe.Molecule.Structure(_,E)}g=b.id;const S=yield nf.buildAssembly(_,g).runInContext(m),A={label:`Assembly ${g}`,description:Ve.elementDescription(S)};return new pe.Molecule.Structure(S,A)})).apply(this,arguments)}function s(){return(s=ie(function*(p,m,h,g,y){const b=Ve.ofModel(m,y),x=yield nf.buildSymmetryRange(b,h,g).runInContext(p),_={label:`Symmetry [${h}] to [${g}]`,description:Ve.elementDescription(x)};return new pe.Molecule.Structure(x,_)})).apply(this,arguments)}function c(){return(c=ie(function*(p,m,h,g){const y=Ve.ofModel(m,g),b=yield nf.builderSymmetryMates(y,h).runInContext(p),x={label:"Symmetry Mates",description:Ve.elementDescription(b)};return new pe.Molecule.Structure(b,x)})).apply(this,arguments)}function l(){return(l=ie(function*(p,m,h,g,y){const b=Ve.ofModel(m,y),x=yield nf.buildSymmetryAssembly(b,h,g).runInContext(p),_={label:"Symmetry Assembly",description:Ve.elementDescription(x)};return new pe.Molecule.Structure(x,_)})).apply(this,arguments)}function f(){return f=ie(function*(p,m,h,g){const y=g?.params,b=no.Provider.get(h);if(!b||!g||"model"===g.name){const x=Ve.ofModel(h,y);return new pe.Molecule.Structure(x,{label:"Model",description:Ve.elementDescription(x)})}if("auto"===g.name){if(0===b.assemblies.length){const x=Ve.ofModel(h,y);return new pe.Molecule.Structure(x,{label:"Model",description:Ve.elementDescription(x)})}return r(p,m,h,void 0,y)}return"assembly"===g.name?r(p,m,h,g.params.id,y):"symmetry"===g.name?function o(p,m,h,g,y){return s.apply(this,arguments)}(m,h,g.params.ijkMin,g.params.ijkMax,y):"symmetry-mates"===g.name?function a(p,m,h,g){return c.apply(this,arguments)}(m,h,g.params.radius,y):"symmetry-assembly"===g.name?function u(p,m,h,g,y){return l.apply(this,arguments)}(m,h,g.params.generators,b,y):void Rr()}),f.apply(this,arguments)}e.getParams=function t(p,m){const h=p&&no.Provider.get(p),g=h?h.assemblies.map(A=>[A.id,`${A.id}: ${zu(A.details)}`]):[],y=!h||!ma.isZero(h.spacegroup.cell),b=[];if(h){const{operators:A}=h.spacegroup;for(let E=0,w=A.length;E{x.push([A.id,A.id===A.auth_id?A.id:`${A.id} [auth ${A.auth_id}]`])});const _={auto:C.Group(Fv),model:C.Group(Fv),assembly:C.Group({id:C.Optional(p?C.Select(g.length?g[0][0]:"",g,{label:"Asm Id",description:"Assembly Id"}):C.Text("",{label:"Asm Id",description:"Assembly Id (use empty for the 1st assembly)"})),...Fv},{isFlat:!0}),"symmetry-mates":C.Group({radius:C.Numeric(5,{min:0,max:50,step:1}),...Fv},{isFlat:!0}),symmetry:C.Group({ijkMin:C.Vec3(v.create(-1,-1,-1),{step:1},{label:"Min IJK",fieldLabels:{x:"I",y:"J",z:"K"}}),ijkMax:C.Vec3(v.create(1,1,1),{step:1},{label:"Max IJK",fieldLabels:{x:"I",y:"J",z:"K"}}),...Fv},{isFlat:!0}),"symmetry-assembly":C.Group({generators:C.ObjectList({operators:C.ObjectList({index:C.Select(0,b),shift:C.Vec3(v(),{step:1},{label:"IJK",fieldLabels:{x:"I",y:"J",z:"K"}})},A=>`${A.index+1}_${A.shift.map(E=>E+5).join("")}`,{defaultValue:[]}),asymIds:C.MultiSelect([],x)},A=>`${A.asymIds.length} asym ids, ${A.operators.length} operators`,{defaultValue:[]}),...Fv},{isFlat:!0})},S=[];return"auto"===m&&S.push(["auto","Auto"]),S.push(["model","Model"]),g.length>0&&S.push(["assembly","Assembly"]),y&&(S.push(["symmetry-mates","Symmetry Mates"]),S.push(["symmetry","Symmetry (indices)"]),S.push(["symmetry-assembly","Symmetry (assembly)"])),{type:C.MappedStatic(m||"model",_,{options:S})}},e.canAutoUpdate=function n(p,m){return!("symmetry-assembly"===m.name||"symmetry"===m.name&&"symmetry"===p.name)},e.create=function d(p,m,h,g){return f.apply(this,arguments)}}(b0||(b0={})),function(e){function n(a,c){const u=ko.is(c)?c:void 0,l=ko.is(c)?ko.toExpression(c):c;return{script:u,expression:l,compiled:TS(l),originalStructure:a,currentStructure:a}}function r(a,c){return a.compiled(new qu(c))}e.isUnchanged=function t(a,c,u){return a.currentStructure===u&&(ko.is(c)?!!a.script&&ko.areEqual(a.script,c):a.expression===c)},e.create=n,e.run=r,e.createAndRun=function i(a,c){const u=n(a,c);return{entry:u,selection:r(u,a)}},e.updateStructure=function o(a,c){return a.currentStructure=c,a.compiled(new qu(c))},e.updateStructureObject=function s(a,c,u){const l=pt.unionStructure(c);a.label=`${u||"Selection"}`,a.description=Ve.elementDescription(l),a.data=l}}(Aa||(Aa={}));const s$e=new Set(["LI","NA","K","RB","CS","FR"]),c$e=new Set(["BE","MG","CA","SR","BA","RA"]),g$e=new Set(["ZN","GA","CD","IN","SN","HG","TI","PB","BI","PO","CN"]),v$e=new Set(["F","CL","BR","I","AT"]);function _$e(e){return v$e.has(e)}function Toe(e){const t=_2(e);return t>=21&&t<=29||t>=39&&t<=47||t>=72&&t<=79||t>=104&&t<=108}function C$e(e){return function a$e(e){return s$e.has(e)}(e)||function u$e(e){return c$e.has(e)}(e)||function x$e(e){const t=_2(e);return t>=57&&t<=71}(e)||function S$e(e){const t=_2(e);return t>=89&&t<=103}(e)||Toe(e)||function y$e(e){return g$e.has(e)}(e)}var pr=function(e){return e.Type="Type",e.Structure="Structure Property",e.Atom="Atom Property",e.Bond="Bond Property",e.Residue="Residue Property",e.AminoAcid="Amino Acid",e.NucleicBase="Nucleic Base",e.Manipulate="Manipulate Selection",e.Validation="Validation",e.Misc="Miscellaneous",e.Internal="Internal",e}(pr||{});function lr(e,t,n={}){var r;let i;return{label:e,expression:t,description:n.description||"",category:null!==(r=n.category)&&void 0!==r?r:pr.Misc,isHidden:!!n.isHidden,priority:n.priority||0,referencesCurrent:!!n.referencesCurrent,get query(){return i||(i=TS(t)),i},ensureCustomProperties:n.ensureCustomProperties,getSelection:(o,s,a)=>ie(function*(){const c=o.managers.structure.selection.getStructure(a),u=c?pt.Sequence(a,[c]):pt.Empty(a);return n.ensureCustomProperties&&(yield n.ensureCustomProperties({runtime:s,assetManager:o.managers.asset},a)),i||(i=TS(t)),i(new qu(a,{currentSelection:u}))})()}}const w$e=lr("All",ue.struct.generator.all(),{category:"",priority:1e3}),A$e=lr("Current Selection",ue.internal.generator.current(),{category:"",referencesCurrent:!0}),I$e=lr("Polymer",ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":ue.core.logic.and([ue.core.rel.eq([ue.ammp("entityType"),"polymer"]),ue.core.str.match([ue.re("(polypeptide|cyclic-pseudo-peptide|peptide-like|nucleotide|peptide nucleic acid)","i"),ue.ammp("entitySubtype")])])})]),{category:pr.Type}),T$e=lr("Trace",ue.struct.modifier.union([ue.struct.combinator.merge([ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":ue.core.rel.eq([ue.ammp("entityType"),"polymer"]),"chain-test":ue.core.set.has([ue.set("sphere","gaussian"),ue.ammp("objectPrimitive")])})]),ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":ue.core.rel.eq([ue.ammp("entityType"),"polymer"]),"chain-test":ue.core.rel.eq([ue.ammp("objectPrimitive"),"atomistic"]),"atom-test":ue.core.set.has([ue.set("CA","P"),ue.ammp("label_atom_id")])})])])]),{category:pr.Structure}),Bv=ue.core.logic.and([ue.core.rel.eq([ue.ammp("entityType"),"polymer"]),ue.core.str.match([ue.re("(polypeptide|cyclic-pseudo-peptide|peptide-like)","i"),ue.ammp("entitySubtype")])]),HD=ue.core.logic.and([ue.core.rel.eq([ue.ammp("entityType"),"polymer"]),ue.core.str.match([ue.re("(nucleotide|peptide nucleic acid)","i"),ue.ammp("entitySubtype")])]),v0=ue.core.str.match([ue.re("non-polymer|(amino|carboxy) terminus|peptide-like","i"),ue.ammp("chemCompType")]),D$e=lr("Backbone",ue.struct.modifier.union([ue.struct.combinator.merge([ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":Bv,"chain-test":ue.core.rel.eq([ue.ammp("objectPrimitive"),"atomistic"]),"residue-test":ue.core.logic.not([v0]),"atom-test":ue.core.set.has([ue.set(...Si.toArray(lp)),ue.ammp("label_atom_id")])})]),ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":HD,"chain-test":ue.core.rel.eq([ue.ammp("objectPrimitive"),"atomistic"]),"residue-test":ue.core.logic.not([v0]),"atom-test":ue.core.set.has([ue.set(...Si.toArray(ZI)),ue.ammp("label_atom_id")])})])])]),{category:pr.Structure}),E$e=lr("Sidechain",ue.struct.modifier.union([ue.struct.combinator.merge([ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":Bv,"chain-test":ue.core.rel.eq([ue.ammp("objectPrimitive"),"atomistic"]),"residue-test":ue.core.logic.not([v0]),"atom-test":ue.core.logic.or([ue.core.logic.not([ue.core.set.has([ue.set(...Si.toArray(lp)),ue.ammp("label_atom_id")])])])})]),ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":HD,"chain-test":ue.core.rel.eq([ue.ammp("objectPrimitive"),"atomistic"]),"residue-test":ue.core.logic.not([v0]),"atom-test":ue.core.logic.or([ue.core.logic.not([ue.core.set.has([ue.set(...Si.toArray(ZI)),ue.ammp("label_atom_id")])])])})])])]),{category:pr.Structure}),P$e=lr("Sidechain with Trace",ue.struct.modifier.union([ue.struct.combinator.merge([ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":Bv,"chain-test":ue.core.rel.eq([ue.ammp("objectPrimitive"),"atomistic"]),"residue-test":ue.core.logic.not([v0]),"atom-test":ue.core.logic.or([ue.core.logic.not([ue.core.set.has([ue.set(...Si.toArray(lp)),ue.ammp("label_atom_id")])]),ue.core.rel.eq([ue.ammp("label_atom_id"),"CA"]),ue.core.logic.and([ue.core.rel.eq([ue.ammp("auth_comp_id"),"PRO"]),ue.core.rel.eq([ue.ammp("label_atom_id"),"N"])])])})]),ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":HD,"chain-test":ue.core.rel.eq([ue.ammp("objectPrimitive"),"atomistic"]),"residue-test":ue.core.logic.not([v0]),"atom-test":ue.core.logic.or([ue.core.logic.not([ue.core.set.has([ue.set(...Si.toArray(ZI)),ue.ammp("label_atom_id")])]),ue.core.rel.eq([ue.ammp("label_atom_id"),"P"])])})])])]),{category:pr.Structure}),M$e=lr("Protein",ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":Bv})]),{category:pr.Type}),R$e=lr("Nucleic",ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":HD})]),{category:pr.Type}),k$e=lr("Helix",ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":Bv,"residue-test":ue.core.flags.hasAny([ue.ammp("secondaryStructureFlags"),ue.core.type.bitflags([2])])})]),{category:pr.Structure,ensureCustomProperties:(e,t)=>Xu.attach(e,t)}),N$e=lr("Beta Strand/Sheet",ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":Bv,"residue-test":ue.core.flags.hasAny([ue.ammp("secondaryStructureFlags"),ue.core.type.bitflags([4])])})]),{category:pr.Structure,ensureCustomProperties:(e,t)=>Xu.attach(e,t)}),F$e=lr("Water",ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":ue.core.rel.eq([ue.ammp("entityType"),"water"])})]),{category:pr.Type}),B$e=lr("Ion",ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":ue.core.rel.eq([ue.ammp("entitySubtype"),"ion"])})]),{category:pr.Type}),O$e=lr("Lipid",ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":ue.core.rel.eq([ue.ammp("entitySubtype"),"lipid"])})]),{category:pr.Type}),qD=lr("Carbohydrate",ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":ue.core.logic.or([ue.core.rel.eq([ue.ammp("entityType"),"branched"]),ue.core.logic.and([ue.core.rel.eq([ue.ammp("entityType"),"non-polymer"]),ue.core.str.match([ue.re("oligosaccharide","i"),ue.ammp("entitySubtype")])])])})]),{category:pr.Type}),Doe=lr("Carbohydrate with Connected",ue.struct.modifier.union([ue.struct.modifier.includeConnected({0:qD.expression,"layer-count":1,"as-whole-residues":!0})]),{category:pr.Internal,isHidden:!0}),Eoe=lr("Connected to Carbohydrate",ue.struct.modifier.union([ue.struct.modifier.exceptBy({0:Doe.expression,by:qD.expression})]),{category:pr.Internal,isHidden:!0}),J5=lr("Ligand",ue.struct.modifier.union([ue.struct.modifier.exceptBy({0:ue.struct.modifier.union([ue.struct.combinator.merge([ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":ue.core.logic.and([ue.core.logic.or([ue.core.rel.eq([ue.ammp("entityType"),"non-polymer"]),ue.core.rel.neq([ue.ammp("entityPrdId"),""])]),ue.core.logic.not([ue.core.str.match([ue.re("(oligosaccharide|lipid|ion)","i"),ue.ammp("entitySubtype")])])]),"chain-test":ue.core.rel.eq([ue.ammp("objectPrimitive"),"atomistic"]),"residue-test":ue.core.logic.not([ue.core.str.match([ue.re("saccharide","i"),ue.ammp("chemCompType")])])})]),ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":ue.core.rel.eq([ue.ammp("entityType"),"polymer"]),"chain-test":ue.core.rel.eq([ue.ammp("objectPrimitive"),"atomistic"]),"residue-test":v0})])])]),by:ue.struct.combinator.merge([ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":ue.core.rel.eq([ue.ammp("entityType"),"polymer"]),"chain-test":ue.core.rel.eq([ue.ammp("objectPrimitive"),"atomistic"]),"residue-test":ue.core.set.has([ue.set(...Si.toArray($b)),ue.ammp("label_comp_id")])})]),ue.struct.generator.atomGroups({"chain-test":ue.core.rel.eq([ue.ammp("objectPrimitive"),"atomistic"]),"residue-test":ue.core.set.has([ue.set(...Si.toArray(eFe)),ue.ammp("label_comp_id")])})])})]),{category:pr.Type}),Poe=lr("Ligand with Connected",ue.struct.modifier.union([ue.struct.modifier.exceptBy({0:ue.struct.modifier.union([ue.struct.modifier.includeConnected({0:J5.expression,"layer-count":1,"as-whole-residues":!0,"bond-test":ue.core.flags.hasAny([ue.struct.bondProperty.flags(),ue.core.type.bitflags([3])])})]),by:qD.expression})]),{category:pr.Internal,isHidden:!0}),Moe=lr("Connected to Ligand",ue.struct.modifier.union([ue.struct.modifier.exceptBy({0:Poe.expression,by:J5.expression})]),{category:pr.Internal,isHidden:!0}),L$e=lr("Connected to Ligand or Carbohydrate",ue.struct.modifier.union([ue.struct.combinator.merge([Eoe.expression,Moe.expression])]),{category:pr.Internal,isHidden:!0}),U$e=lr("Disulfide Bridges",ue.struct.modifier.union([ue.struct.combinator.merge([ue.struct.modifier.union([ue.struct.modifier.wholeResidues([ue.struct.filter.isConnectedTo({0:ue.struct.generator.atomGroups({"residue-test":ue.core.set.has([ue.set("CYS"),ue.ammp("auth_comp_id")]),"atom-test":ue.core.set.has([ue.set("SG"),ue.ammp("label_atom_id")])}),target:ue.struct.generator.atomGroups({"residue-test":ue.core.set.has([ue.set("CYS"),ue.ammp("auth_comp_id")]),"atom-test":ue.core.set.has([ue.set("SG"),ue.ammp("label_atom_id")])}),"bond-test":!0})])]),ue.struct.modifier.union([ue.struct.modifier.wholeResidues([ue.struct.modifier.union([ue.struct.generator.bondedAtomicPairs({0:ue.core.flags.hasAny([ue.struct.bondProperty.flags(),ue.core.type.bitflags([8])])})])])])])]),{category:pr.Bond}),V$e=lr("NOS Bridges",ue.struct.modifier.union([ue.struct.modifier.wholeResidues([ue.struct.filter.isConnectedTo({0:ue.struct.generator.atomGroups({"residue-test":ue.core.set.has([ue.set("CSO","LYS"),ue.ammp("auth_comp_id")]),"atom-test":ue.core.set.has([ue.set("OD","NZ"),ue.ammp("label_atom_id")])}),target:ue.struct.generator.atomGroups({"residue-test":ue.core.set.has([ue.set("CSO","LYS"),ue.ammp("auth_comp_id")]),"atom-test":ue.core.set.has([ue.set("OD","NZ"),ue.ammp("label_atom_id")])}),"bond-test":!0})])]),{category:pr.Bond}),z$e=lr("Non-standard Residues in Polymers",ue.struct.modifier.union([ue.struct.generator.atomGroups({"entity-test":ue.core.rel.eq([ue.ammp("entityType"),"polymer"]),"chain-test":ue.core.rel.eq([ue.ammp("objectPrimitive"),"atomistic"]),"residue-test":ue.ammp("isNonStandard")})]),{category:pr.Residue}),G$e=lr("Coarse Elements",ue.struct.modifier.union([ue.struct.generator.atomGroups({"chain-test":ue.core.set.has([ue.set("sphere","gaussian"),ue.ammp("objectPrimitive")])})]),{category:pr.Type}),j$e=lr("Rings in Residues",ue.struct.modifier.union([ue.struct.generator.rings()]),{category:pr.Residue}),H$e=lr("Aromatic Rings in Residues",ue.struct.modifier.union([ue.struct.generator.rings({"only-aromatic":!0})]),{category:pr.Residue}),q$e=lr("Surrounding Residues (5 \u212b) of Selection",ue.struct.modifier.union([ue.struct.modifier.exceptBy({0:ue.struct.modifier.includeSurroundings({0:ue.internal.generator.current(),radius:5,"as-whole-residues":!0}),by:ue.internal.generator.current()})]),{description:"Select residues within 5 \u212b of the current selection.",category:pr.Manipulate,referencesCurrent:!0}),W$e=lr("Surrounding Ligands (5 \u212b) of Selection",ue.struct.modifier.union([ue.struct.modifier.surroundingLigands({0:ue.internal.generator.current(),radius:5,"include-water":!0})]),{description:"Select ligand components within 5 \u212b of the current selection.",category:pr.Manipulate,referencesCurrent:!0}),$$e=lr("Surrounding Atoms (5 \u212b) of Selection",ue.struct.modifier.union([ue.struct.modifier.exceptBy({0:ue.struct.modifier.includeSurroundings({0:ue.internal.generator.current(),radius:5,"as-whole-residues":!1}),by:ue.internal.generator.current()})]),{description:"Select atoms within 5 \u212b of the current selection.",category:pr.Manipulate,referencesCurrent:!0}),Y$e=lr("Inverse / Complement of Selection",ue.struct.modifier.union([ue.struct.modifier.exceptBy({0:ue.struct.generator.all(),by:ue.internal.generator.current()})]),{description:"Select everything not in the current selection.",category:pr.Manipulate,referencesCurrent:!0}),X$e=lr("Residues Covalently Bonded to Selection",ue.struct.modifier.union([ue.struct.modifier.includeConnected({0:ue.internal.generator.current(),"layer-count":1,"as-whole-residues":!0})]),{description:"Select residues covalently bonded to current selection.",category:pr.Manipulate,referencesCurrent:!0}),K$e=lr("Covalently Bonded Component",ue.struct.modifier.union([ue.struct.modifier.includeConnected({0:ue.internal.generator.current(),"fixed-point":!0})]),{description:"Select covalently bonded component based on current selection.",category:pr.Manipulate,referencesCurrent:!0}),Z$e=lr("Residues with Cov. or Metallic Bond to Selection",ue.struct.modifier.union([ue.struct.modifier.includeConnected({0:ue.internal.generator.current(),"layer-count":1,"as-whole-residues":!0,"bond-test":ue.core.flags.hasAny([ue.struct.bondProperty.flags(),ue.core.type.bitflags([3])])})]),{description:"Select residues with covalent or metallic bond to current selection.",category:pr.Manipulate,referencesCurrent:!0}),Q$e=lr("Whole Residues of Selection",ue.struct.modifier.union([ue.struct.modifier.wholeResidues({0:ue.internal.generator.current()})]),{description:"Expand current selection to whole residues.",category:pr.Manipulate,referencesCurrent:!0}),J$e=[[["HIS"],"Histidine"],[["ARG"],"Arginine"],[["LYS"],"Lysine"],[["ILE"],"Isoleucine"],[["PHE"],"Phenylalanine"],[["LEU"],"Leucine"],[["TRP"],"Tryptophan"],[["ALA"],"Alanine"],[["MET"],"Methionine"],[["PRO"],"Proline"],[["CYS"],"Cysteine"],[["ASN"],"Asparagine"],[["VAL"],"Valine"],[["GLY"],"Glycine"],[["SER"],"Serine"],[["GLN"],"Glutamine"],[["TYR"],"Tyrosine"],[["ASP"],"Aspartic Acid"],[["GLU"],"Glutamic Acid"],[["THR"],"Threonine"],[["SEC"],"Selenocysteine"],[["PYL"],"Pyrrolysine"],[["UNK"],"Unknown"]].sort((e,t)=>e[1]t[1]?1:0),eYe=[[["A","DA"],"Adenosine"],[["C","DC"],"Cytidine"],[["T","DT"],"Thymidine"],[["G","DG"],"Guanosine"],[["I","DI"],"Inosine"],[["U","DU"],"Uridine"],[["N","DN"],"Unknown"]].sort((e,t)=>e[1]t[1]?1:0);function e6([e,t],n,r=0){const i=1!==e.length||Roe.has(e[0])?`${t} (${e.join(", ")})`:`[${e[0]}] ${t}`;return lr(i,ue.struct.modifier.union([ue.struct.generator.atomGroups({"residue-test":ue.core.set.has([ue.set(...e),ue.ammp("auth_comp_id")])})]),{category:n,priority:r,description:i})}const Roe=Si.unionMany(DB,c2,u2,QI),No={all:w$e,current:A$e,polymer:I$e,trace:T$e,backbone:D$e,sidechain:E$e,sidechainWithTrace:P$e,protein:M$e,nucleic:R$e,helix:k$e,beta:N$e,water:F$e,ion:B$e,lipid:O$e,branched:qD,branchedPlusConnected:Doe,branchedConnectedOnly:Eoe,ligand:J5,ligandPlusConnected:Poe,ligandConnectedOnly:Moe,connectedOnly:L$e,disulfideBridges:U$e,nosBridges:V$e,nonStandardPolymer:z$e,coarse:G$e,ring:j$e,aromaticRing:H$e,surroundings:q$e,surroundingLigands:W$e,surroundingAtoms:$$e,complement:Y$e,covalentlyBonded:X$e,covalentlyOrMetallicBonded:Z$e,covalentlyBondedComponent:K$e,wholeResidues:Q$e};class rYe{add(t){this.list.push(t),this.options.push([t,t.label,t.category]),this.version+=1}remove(t){const n=this.list.indexOf(t);-1!==n&&(this.list.splice(n,1),this.options.splice(n,1),this.version+=1)}constructor(){this.list=[],this.options=[],this.version=1,this.list.push(...Object.values(No),...J$e.map(t=>e6(t,pr.AminoAcid)),...eYe.map(t=>e6(t,pr.NucleicBase))),this.options.push(...this.list.map(t=>[t,t.label,t.category]))}}function aYe(e){switch(e){case 7:return-3;case 6:return-2;case 5:return-1;case 0:case 4:return 0;case 3:return 1;case 2:return 2;case 1:return 3;default:return console.error(`Value ${e} is outside the 0-7 range, defaulting to 0.`),0}}function koe(e,t){const n=He.create(e.data,2*t),r=He.create(e.data,2*t),i=He.create(e.data,2*t),o=He.create(e.data,2*t),s=He.create(e.data,2*t);for(let a=0;a0)for(let g=0;g0){const g=te.ofIntArray(te.mapToArray(i.atomIdxA,_=>_-1,Int32Array)),y=te.ofIntArray(te.mapToArray(i.atomIdxB,_=>_-1,Int32Array)),b=te.asArrayColumn(i.order,Int32Array),x=Ms.fromData({pairs:{indexA:g,indexB:y,order:b},count:r.count},{maxDistance:1/0});Ms.Provider.set(h.representative,x)}return h}),t6.apply(this,arguments)}var n6,DS,o6;function r6(){return r6=ie(function*(e,t,n){var r;const i=e.atom_site._rowCount,o=te.ofConst("MOL",i,te.Schema.str),s=te.ofConst("A",i,te.Schema.str),a=te.ofConst(1,i,te.Schema.int),c=function pYe(e){const{cell:t,space_group:n}=e,r=function fYe(e){const t=e.it_number.value(0),n=e["name_h-m_full"].value(0).replace("-"," ");return e.it_number.isDefined?t:n}(n),i=ma.create(r,v.create(t.length_a.value(0),t.length_b.value(0),t.length_c.value(0)),v.scale(v(),v.create(t.angle_alpha.value(0),t.angle_beta.value(0),t.angle_gamma.value(0)),Math.PI/180));return{spacegroup:Ec.create(i),assemblies:[],isNonStandardCrystalFrame:!1,ncsOperators:[]}}(e),u=c.spacegroup.cell.fromFractional,{fract_x:l,fract_y:d,fract_z:f}=e.atom_site,p=new Float32Array(i),m=new Float32Array(i),h=new Float32Array(i),g=v();for(let R=0;R0){const R=I.representative;no.Provider.set(R,c);const T=e.geom_bond._rowCount;if(T>0){const M={},{label:N}=e.atom_site;for(let W=0,Q=N.rowCount;Wfunction HNe(e){return GQ.has(e)?GQ.get(e):Bg("H")}(d)),schema:te.Schema.Aliased(te.Schema.str)}),s=te.ofConst(1,n.count,te.Schema.int),a=Xn.ofPartialColumns(ks.atom_site,{auth_asym_id:i,auth_atom_id:o,auth_comp_id:r,auth_seq_id:s,Cartn_x:te.asArrayColumn(n.x,Float32Array),Cartn_y:te.asArrayColumn(n.y,Float32Array),Cartn_z:te.asArrayColumn(n.z,Float32Array),id:te.range(0,n.count-1),label_asym_id:i,label_atom_id:o,label_comp_id:r,label_seq_id:s,label_entity_id:te.ofConst("1",n.count,te.Schema.str),occupancy:te.ofConst(1,n.count,te.Schema.float),type_symbol:o,pdbx_PDB_model_num:te.ofConst(1,n.count,te.Schema.int)},n.count),c=new sd;c.setNames([["MOL","Unknown Entity"]]),c.getEntityId("MOL",0,"A");const u=new ad(s,o);u.setNames([["MOL","Unknown Molecule"]]),u.add("MOL",0);const l=$u({entity:c.getEntityTable(),chem_comp:u.getChemCompTable(),atom_site:a});return yield af(l,o6.create(e),t)}),i6.apply(this,arguments)}!function(e){e.is=function t(r){return"mol"===r?.kind},e.create=function n(r){return{kind:"mol",name:r.title,data:r}}}(n6||(n6={})),tf.Provider.formatRegistry.add("cifCore",function mYe(e){if(!DS.is(e.sourceData))return;const{atom_site:t,atom_site_aniso:n}=e.sourceData.data.db;return{data:Xn.ofPartialColumns(tf.Schema,{U:n.u},n._rowCount),elementToAnsiotrop:tf.getElementToAnsiotropFromLabel(t.label,n.label)}},function gYe(e){return!!DS.is(e.sourceData)&&e.sourceData.data.db.atom_site_aniso.u.isDefined}),function(e){e.is=function t(r){return"cifCore"===r?.kind},e.fromFrame=function n(r,i){return i||(i=od.schema.cifCore(r)),{kind:"cifCore",name:i.database_code.depnum_ccdc_archive.value(0)||i.database_code.depnum_ccdc_fiz.value(0)||i.database_code.icsd.value(0)||i.database_code.mdf.value(0)||i.database_code.nbs.value(0)||i.database_code.csd.value(0)||i.database_code.cod.value(0)||i._name,data:{db:i,frame:r}}}}(DS||(DS={})),function(e){e.is=function t(r){return"cube"===r?.kind},e.create=function n(r){return{kind:"cube",name:r.header.comment1,data:r}}}(o6||(o6={}));const{skipWhitespace:s6,eatValue:Ooe,markLine:ml,getTokenString:gl,readLine:Loe}=ht;function xYe(e,t){return{tokenizer:e,molecule:{mol_name:"",num_atoms:0,num_bonds:0,num_subst:0,num_feat:0,num_sets:0,mol_type:"",charge_type:"",status_bits:"",mol_comment:""},runtimeCtx:t}}const Uoe=/\s+/g;function SYe(e){const{tokenizer:t,molecule:n}=e;for(;"@MOLECULE"!==gl(t)&&t.position"))return;n.mol_type=i,ml(t);const o=gl(t);if(o.startsWith("@"))return;n.charge_type=o,ml(t);const s=gl(t);if(s.startsWith("@"))return;n.status_bits=s,ml(t);const a=gl(t);a.startsWith("@")||(n.mol_comment=a)}function CYe(e){return a6.apply(this,arguments)}function a6(){return a6=ie(function*(e){const{tokenizer:t,molecule:n}=e;for(;"@ATOM"!==gl(t)&&t.position{const D=Math.min(n.num_atoms-A,w);for(let I=0;Iw.update({message:"Parsing...",current:t.position,max:S})),{count:n.num_atoms,atom_id:Jt(c)(te.Schema.int),atom_name:Jt(u)(te.Schema.str),x:Jt(l)(te.Schema.float),y:Jt(d)(te.Schema.float),z:Jt(f)(te.Schema.float),atom_type:a>5?Jt(p)(te.Schema.str):_,subst_id:a>6?Jt(m)(te.Schema.int):x,subst_name:a>7?Jt(h)(te.Schema.str):_,charge:a>8?Jt(g)(te.Schema.float):b,status_bit:a>9?Jt(y)(te.Schema.str):_}}),a6.apply(this,arguments)}function wYe(e){return c6.apply(this,arguments)}function c6(){return c6=ie(function*(e){const{tokenizer:t,molecule:n}=e;for(;"@BOND"!==gl(t)&&t.position{const y=Math.min(n.num_bonds-m,g);for(let b=0;bg.update({message:"Parsing...",current:t.position,max:p})),{count:n.num_bonds,bond_id:Jt(c)(te.Schema.int),origin_atom_id:Jt(u)(te.Schema.int),target_atom_id:Jt(l)(te.Schema.int),bond_type:Jt(d)(te.Schema.str),status_bits:a>4?Jt(f)(te.Schema.str):te.Undefined(n.num_bonds,te.Schema.str)}}),c6.apply(this,arguments)}function AYe(e){const{tokenizer:t}=e;for(;t.positionMOLECULE"===r)return;if("@CRYSIN"===r)break;ml(t)}if(t.position>=t.data.length)return;ml(t);const n=gl(t).trim().split(Uoe);return{a:parseFloat(n[0]),b:parseFloat(n[1]),c:parseFloat(n[2]),alpha:parseFloat(n[3]),beta:parseFloat(n[4]),gamma:parseFloat(n[5]),spaceGroup:parseInt(n[6],10),setting:parseInt(n[7],10)}}function u6(){return u6=ie(function*(e,t,n){const r=ht(t);e.update({message:"Parsing...",current:0,max:t.length});const i=[];for(;r.positionMOLECULE"!==gl(r)&&r.position0){const y=te.ofIntArray(te.mapToArray(a.origin_atom_id,w=>w-1,Int32Array)),b=te.ofIntArray(te.mapToArray(a.target_atom_id,w=>w-1,Int32Array)),x=a.bond_id,_=te.ofIntArray(te.mapToArray(a.bond_type,w=>{switch(w){case"ar":case"am":case"un":return 1;case"du":case"nc":return 0;default:return parseInt(w)}},Int8Array)),S=te.ofIntArray(te.mapToArray(a.bond_type,w=>{switch(w){case"ar":case"am":return 17;case"du":case"nc":return 0;default:return 1}},Int8Array)),A=Ms.fromData({pairs:{key:x,indexA:y,indexB:b,order:_,flag:S},count:s.count},{maxDistance:c?-1:1/0}),E=g.representative;if(Ms.Provider.set(E,A),Mv.Provider.set(E,{data:s.charge,type:o.charge_type}),c){const w=EYe(c);w&&no.Provider.set(E,w)}n.push(E)}}return new xp(n)}),l6.apply(this,arguments)}function EYe(e){if(1!==e.setting)return;const t=ma.create(e.spaceGroup,v.create(e.a,e.b,e.c),v.scale(v(),v.create(e.alpha,e.beta,e.gamma),Math.PI/180));return{spacegroup:Ec.create(t),assemblies:[],isNonStandardCrystalFrame:!1,ncsOperators:[]}}var d6;!function(e){e.is=function t(r){return"mol2"===r?.kind},e.create=function n(r){return{kind:"mol2",name:r.name,data:r}}}(d6||(d6={}));const Ov=new Uint32Array([0,0,0,0,0,0,0,0,0,8,10,12,16,20,25,32,40,50,64,80,101,128,161,203,256,322,406,512,645,812,1024,1290,1625,2048,2580,3250,4096,5060,6501,8192,10321,13003,16384,20642,26007,32768,41285,52015,65536,82570,104031,131072,165140,208063,262144,330280,416127,524287,660561,832255,1048576,1321122,1664510,2097152,2642245,3329021,4194304,5284491,6658042,8388607,10568983,13316085,16777216]),f6=9;var Oc,h6;function MYe(){throw new Error("(xdrfile error) Undefined error.")}function p6(){return p6=ie(function*(e,t){const n=new DataView(t.buffer,t.byteOffset),r={frames:[],boxes:[],times:[],timeOffset:0,deltaTime:0},i=r.frames,o=r.boxes,s=r.times,a=[0,0,0,0,0,0],c=[0,0,0],u=[0,0,0],l=[0,0,0],d=[.1,.1,.1],f=[.1,.1,.1];let p=0;const m=Oc.buf;for(;;){let h;const g=n.getInt32(p+4);p+=12,s.push(n.getFloat32(p)),p+=4;const y=new Float32Array(9);for(let b=0;b<9;++b)y[b]=10*n.getFloat32(p),p+=4;if(o.push(y),g<=9){h={count:g/3,x:new Float32Array(g/3),y:new Float32Array(g/3),z:new Float32Array(g/3)};for(let b=0;b16777215?(u[0]=Oc.sizeOfInt(c[0]),u[1]=Oc.sizeOfInt(c[1]),u[2]=Oc.sizeOfInt(c[2]),S=0):S=Oc.sizeOfInts(3,c);let A=n.getInt32(p);p+=4;let E=A-1;E=f6>E?f6:E;let w=Ov[E]/2|0,D=Ov[A]/2|0;l[0]=l[1]=l[2]=Ov[A];const I=4*Math.ceil(n.getInt32(p)/4);p+=4;const R=1/_;let T=0,M=0;for(d[0]=d[1]=d[2]=0;M0){d[0]=d[1]=d[2]=0;for(let F=0;Ff6?Ov[A-1]/2|0:0):V>0&&(w=D,D=Ov[A]/2|0),l[0]=l[1]=l[2]=Ov[A],(0===l[0]||0===l[1]||0===l[2])&&MYe()}p+=I}for(let b=0;b=t.length)break}return s.length>=1&&(r.timeOffset=s[0]),s.length>=2&&(r.deltaTime=s[1]-s[0]),r}),p6.apply(this,arguments)}function FYe(e){let t=e.position>=e.data.length-1?0:+ht.readLine(e);isNaN(t)&&(t=0);const n=ht.readLine(e),r=new Float64Array(t),i=new Float64Array(t),o=new Float64Array(t),s=new Array(t);for(let a=0;a=d&&f<32;)f++,d<<=1;return f};const n=new Uint8Array(32);e.sizeOfInts=function r(l,d){let f=1,p=0;n[0]=1;for(let h=0;h>=8;for(;0!==y;)n[g++]=255&y,y>>=8;f=g}let m=1;for(f--;n[f]>=m;)p++,m*=2;return p+8*f};const i=new ArrayBuffer(24);e.buf=new Int32Array(i);const o=new Uint32Array(i);function s(l,d,f){let p=f;const m=(1<=8;)g=g<<8|l[d+y++],b|=g>>h<0&&(h>h&(1<>o[1]&255}e.decodeBits=s;const c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];e.decodeInts=function u(l,d,f,p,m){let h=f,g=0;for(c[0]=0,c[1]=0,c[2]=0,c[3]=0;h>8;)c[g++]=a(l,d),h-=8;h>0&&(c[g++]=s(l,d,h));for(let y=2;y>0;y--){let b=0;const x=p[y];for(let _=g-1;_>=0;_--){b=b<<8|c[_];const S=b/x|0;c[_]=S,b-=S*x}m[y]=b}m[0]=c[0]|c[1]<<8|c[2]<<16|c[3]<<24}}(Oc||(Oc={})),function(e){e.is=function t(r){return"xyz"===r?.kind},e.create=function n(r){return{kind:"xyz",name:"xyz",data:r}}}(h6||(h6={}));const m6="$$$$";function WYe(e){const t=ht.readLine(e).trim(),n=ht.readLine(e).trim(),r=ht.readLine(e).trim(),i=ht.readLine(e),o=function VYe(e){return e.trim().endsWith("V3000")}(i),{atomCount:s,bondCount:a}=o?function zYe(e){const t=He.create(e.data,1),n=He.create(e.data,1);return ht.eatLine(e),Kp(e),Kp(e),Kp(e),Zp(e,t),Zp(e,n),ht.eatLine(e),{atomCount:Jt(t)(te.Schema.int).value(0),bondCount:Jt(n)(te.Schema.int).value(0)}}(e):function qYe(e){return{atomCount:+e.substr(0,3),bondCount:+e.substr(3,3)}}(i);if(Number.isNaN(s)||Number.isNaN(a)){for(;e.position ")){He.add(t,e.tokenStart+2,e.tokenEnd),ht.markLine(e);const i=e.tokenStart;let o=e.tokenEnd,s=!1;for(;e.position ")){He.add(n,i,o),s=!0;break}o=e.tokenEnd}s||He.add(n,i,o)}}return{dataHeader:Jt(t)(te.Schema.str),data:Jt(n)(te.Schema.str)}}(e);return{molFile:{title:t,program:n,comment:r,atoms:u,bonds:l,formalCharges:d},dataItems:f}}var g6;function XYe(e){return Oe.create("Parse SDF",t=>Boe(e.molFile,g6.create(e),t))}function y6(){return y6=ie(function*(e){const t=new DataView(e.buffer),n={frames:[],boxes:[],times:[],timeOffset:0,deltaTime:0},r=n.frames,i=n.boxes,o=n.times;let s=0;for(;;){s+=8;const a=t.getInt32(s);s+=4,s+=a;const c=t.getInt32(s+8),u=t.getInt32(s+12),l=t.getInt32(s+16),d=t.getInt32(s+28),f=t.getInt32(s+32),p=t.getInt32(s+36),m=t.getInt32(s+40);s+=52;const h=c/9,g=3*m;if(o.push(8===h?t.getFloat64(s):t.getFloat32(s)),s+=2*h,c){const y=new Float32Array(9);if(8===h)for(let b=0;b<9;++b)y[b]=10*t.getFloat64(s),s+=8;else for(let b=0;b<9;++b)y[b]=10*t.getFloat32(s),s+=4;i.push(y)}if(s+=u,s+=l,d){const y=new Float32Array(m),b=new Float32Array(m),x=new Float32Array(m);if(8===h)for(let _=0;_>8&65280|E>>24&255}const S=new Float32Array(e.buffer,s,g);for(let A=0;A=e.byteLength)break}return o.length>=1&&(n.timeOffset=o[0]),o.length>=2&&(n.deltaTime=o[1]-o[0]),n}),y6.apply(this,arguments)}!function(e){e.is=function t(r){return"sdf"===r?.kind},e.create=function n(r){return{kind:"sdf",name:r.molFile.title,data:r}}}(g6||(g6={}));const b6=[];class eXe{constructor(t,n={}){this._mark=0,this._marks=[],this.offset=0,this.littleEndian=!0;let r=!1;void 0===t&&(t=8192),"number"==typeof t?t=new ArrayBuffer(t):r=!0;const i=n.offset?n.offset>>>0:0,o=t.byteLength-i;let s=i;t instanceof ArrayBuffer||(t.byteLength!==t.buffer.byteLength&&(s=t.byteOffset+i),t=t.buffer),this._lastWrittenByte=r?o:0,this.buffer=t,this.length=o,this.byteLength=o,this.byteOffset=s,this._data=new DataView(this.buffer,s,o)}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t){return void 0===t&&(t=1),this.offset+=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const t=this._marks.pop();if(void 0===t)throw new Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t){if(void 0===t&&(t=1),!this.available(t)){const r=2*(this.offset+t),i=new Uint8Array(r);i.set(new Uint8Array(this.buffer)),this.buffer=i.buffer,this.length=this.byteLength=r,this._data=new DataView(this.buffer)}return this}readBoolean(){return 0!==this.readUint8()}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t){void 0===t&&(t=1);const n=new Uint8Array(t);for(let r=0;rthis._lastWrittenByte&&(this._lastWrittenByte=this.offset)}}function yl(e,t){if(e)throw new TypeError("Not a valid NetCDF v3.x file: "+t)}function Voe(e){e.offset%4!=0&&e.skip(4-e.offset%4)}function v6(e){const t=e.readUint32(),n=e.readChars(t);return Voe(e),n}const uo={BYTE:1,CHAR:2,SHORT:3,INT:4,FLOAT:5,DOUBLE:6};function zoe(e){switch(Number(e)){case uo.BYTE:return"byte";case uo.CHAR:return"char";case uo.SHORT:return"short";case uo.INT:return"int";case uo.FLOAT:return"float";case uo.DOUBLE:return"double";default:return"undefined"}}function Goe(e){switch(Number(e)){case uo.BYTE:case uo.CHAR:return 1;case uo.SHORT:return 2;case uo.INT:case uo.FLOAT:return 4;case uo.DOUBLE:return 8;default:return-1}}function joe(e){switch(String(e)){case"byte":return uo.BYTE;case"char":return uo.CHAR;case"short":return uo.SHORT;case"int":return uo.INT;case"float":return uo.FLOAT;case"double":return uo.DOUBLE;default:return-1}}function WD(e,t){if(1!==e){const n=new Array(e);for(let r=0;r6,"non valid type "+s);const a=e.readUint32(),c=_6(e,s,a);Voe(e),t[i]={name:o,type:zoe(s),value:c}}}return t}class lXe{constructor(t){const n=new eXe(t);n.setBigEndian(),yl("CDF"!==n.readChars(3),"should start with CDF");const r=n.readByte();yl(r>2,"unknown version"),this.header=function aXe(e,t){const n={recordDimension:{length:e.readUint32()}};n.version=t;const r=function cXe(e){let t,n,r;const i=e.readUint32();if(i===Lv)return yl(e.readUint32()!==Lv,"wrong empty tag for list of dimensions"),[];{yl(10!==i,"wrong tag for list of dimensions");const o=e.readUint32();t=new Array(o);for(let s=0;s6,"non valid type "+f);const p=e.readUint32();let m=e.readUint32();2===n&&(yl(m>0,"offsets larger than 4GB not supported"),m=e.readUint32()),l[0]===t&&(i+=p),o[a]={name:c,dimensions:l,attributes:d,type:zoe(f),size:p,offset:m,record:l[0]===t}}}return{variables:o,recordStep:i}}(e,r.recordId,t);return n.variables=i.variables,n.recordDimension.recordStep=i.recordStep,n}(n,r),this.buffer=n}get version(){return 1===this.header.version?"classic format":"64-bit offset format"}get recordDimension(){return this.header.recordDimension}get dimensions(){return this.header.dimensions}get globalAttributes(){return this.header.globalAttributes}get variables(){return this.header.variables}hasDataVariable(t){return this.header.variables&&-1!==this.header.variables.findIndex(n=>n.name===t)}getDataVariable(t){var n;let r;if(r="string"==typeof t?null===(n=this.header.variables)||void 0===n?void 0:n.find(i=>i.name===t):t,void 0===r)throw new Error("variable not found");return this.buffer.seek(r.offset),r.record?function rXe(e,t,n){const r=joe(t.type),i=t.size?t.size/Goe(r):1,o=n.length,s=new Array(o),a=n.recordStep;for(let c=0;c=1&&(n.timeOffset=n.time[0]),n.time.length>=2&&(n.deltaTime=n.time[1]-n.time[0])),n}),x6.apply(this,arguments)}var S6,C6;!function(e){e.is=function t(r){return"prmtop"===r?.kind},e.fromPrmtop=function n(r){return{kind:"prmtop",name:r.title.join(" ")||"PRMTOP",data:r}}}(S6||(S6={})),function(e){e.is=function t(r){return"top"===r?.kind},e.fromTop=function n(r){return{kind:"top",name:r.system||"TOP",data:r}}}(C6||(C6={}));const vXe=Rt.BuiltIn({name:"coordinates-from-dcd",display:{name:"Parse DCD",description:"Parse DCD binary data."},from:[pe.Data.Binary],to:pe.Molecule.Coordinates})({apply:({a:e})=>Oe.create("Parse DCD",function(){var t=ie(function*(n){const r=yield function Vze(e){return Oe.create("Parse DCD",function(){var t=ie(function*(n){try{const r=function Uze(e){const t=new DataView(e.buffer),n=Object.create(null),r=[];let i=0;const o=new Int32Array(e.buffer,0,23),s=o[0]!==t.getInt32(0);if(84!==o[0]){const h=e.byteLength;for(let g=0;g28672){const t=[];for(let n=0;n0)throw new Error("dcd format with fixed atoms unsupported, aborting");const p=n.NATOM,m=4*p;for(let h=0,g=n.NSET;h=1?(r.ISTART-1)*i.value:0,i.unit),s=[];for(let a=0,c=e.frames.length;a=-1&&d[1]<=1&&d[3]>=-1&&d[3]<=1&&d[4]>=-1&&d[4]<=1?Wp.create(v.create(d[0],d[2],d[5]),v.create(Yn(90-90*Math.asin(d[1])/Wx),Yn(90-90*Math.asin(d[3])/Wx),Yn(90-90*Math.asin(d[4])/Wx))):d[0]<0||d[1]<0||d[2]<0||d[3]<0||d[4]<0||d[5]<0||d[3]>180||d[4]>180||d[5]>180?Wp.fromBasis(v.create(d[0],d[1],d[3]),v.create(d[1],d[2],d[4]),v.create(d[3],d[4],d[5])):Wp.create(v.create(d[0],d[2],d[5]),v.create(Yn(ai(d[1],0,vr)?90:d[1]),Yn(ai(d[3],0,vr)?90:d[3]),Yn(ai(d[4],0,vr)?90:d[4])))}s.push(l)}return Dg.create(s,i,o)});return function(n){return t.apply(this,arguments)}}())}(r.result).runInContext(n);return new pe.Molecule.Coordinates(i,{label:e.label,description:"Coordinates"})});return function(n){return t.apply(this,arguments)}}())}),_Xe=Rt.BuiltIn({name:"coordinates-from-xtc",display:{name:"Parse XTC",description:"Parse XTC binary data."},from:[pe.Data.Binary],to:pe.Molecule.Coordinates})({apply:({a:e})=>Oe.create("Parse XTC",function(){var t=ie(function*(n){const r=yield function kYe(e){return Oe.create("Parse XTC",function(){var t=ie(function*(n){try{n.update({canAbort:!0,message:"Parsing trajectory..."});const r=yield function RYe(e,t){return p6.apply(this,arguments)}(n,e);return Fr.success(r)}catch(r){return Fr.error(""+r)}});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);const i=yield function NYe(e){return Oe.create("Parse XTC",function(){var t=ie(function*(n){yield n.update("Converting to coordinates");const r=Ic(e.deltaTime,"step"),i=Ic(e.timeOffset,r.unit),o=[];for(let s=0,a=e.frames.length;sOe.create("Parse TRR",function(){var t=ie(function*(n){const r=yield function ZYe(e){return Oe.create("Parse TRR",function(){var t=ie(function*(n){try{n.update({canAbort:!0,message:"Parsing trajectory..."});const r=yield function KYe(e){return y6.apply(this,arguments)}(e);return Fr.success(r)}catch(r){return Fr.error(""+r)}});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);const i=yield function QYe(e){return Oe.create("Parse TRR",function(){var t=ie(function*(n){yield n.update("Converting to coordinates");const r=Ic(e.deltaTime,"step"),i=Ic(e.timeOffset,r.unit),o=[];for(let s=0,a=e.frames.length;sOe.create("Parse NCTRAJ",function(){var t=ie(function*(n){const r=yield function fXe(e){return Oe.create("Parse NCTRAJ",function(){var t=ie(function*(n){try{n.update({canAbort:!0,message:"Parsing trajectory..."});const r=yield function dXe(e){return x6.apply(this,arguments)}(e);return Fr.success(r)}catch(r){return Fr.error(""+r)}});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);const i=yield function pXe(e){return Oe.create("Parse NCTRAJ",function(){var t=ie(function*(n){yield n.update("Converting to coordinates");const r=Ic(e.deltaTime,"step"),i=Ic(e.timeOffset,r.unit),o=[];for(let s=0,a=e.coordinates.length;sOe.create("Create Topology",function(){var t=ie(function*(n){const r=yield function hWe(e){return Oe.create("Parse PSF",function(){var t=ie(function*(n){const r=L5.fromPsf(e),i=function pWe(e){const t=new Array(e.count),n=new Array(e.count),r=new Uint32Array(e.count),i=new Uint32Array(e.count),o=new Array(e.count),s=new sd,a=new ad(e.residueId,e.atomName);let c="",u=0,l="",d=0,f=e.segmentName.value(0),p=!1,m=0,h=-1;for(let y=0,b=e.count;yo.value(c)-1,rowCount:o.rowCount,schema:o.schema}),indexB:te.ofLambda({value:c=>s.value(c)-1,rowCount:s.rowCount,schema:s.schema}),order:te.ofConst(1,e.bonds.count,te.Schema.int)};return Yx.create(e.id,i,a,r)});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);return new pe.Molecule.Topology(r,{label:r.label||e.label,description:"Topology"})});return function(n){return t.apply(this,arguments)}}())}),wXe=Rt.BuiltIn({name:"topology-from-prmtop",display:{name:"PRMTOP Topology",description:"Create topology from PRMTOP."},from:[pe.Format.Prmtop],to:pe.Molecule.Topology})({apply:({a:e})=>Oe.create("Create Topology",function(){var t=ie(function*(n){const r=yield function mXe(e){return Oe.create("Parse PRMTOP",function(){var t=ie(function*(n){const r=S6.fromPrmtop(e),i=function hXe(e){const{pointers:t,residuePointer:n,residueLabel:r,atomName:i}=e,o=t.NATOM,s=t.NRES,a=new Uint32Array(o),c=[],u=(M,N,V)=>{const F=r.value(M);for(let G=N,L=V;GddOe.create("Create Topology",function(){var t=ie(function*(n){const r=yield function bXe(e){return Oe.create("Parse TOP",function(){var t=ie(function*(n){const r=C6.fromTop(e),i=function gXe(e){const{molecules:t,compounds:n}=e,r={};let i=0;for(let M=0,N=t._rowCount;MOe.create("Create trajectory from model/topology and coordinates",function(){var n=ie(function*(r){const i=t[e.coordinatesRef].data,o=yield function IXe(e,t,n){return w6.apply(this,arguments)}(r,t[e.modelRef],i);return new pe.Molecule.Trajectory(o,{label:"Trajectory",description:`${o.frameCount} model${1===o.frameCount?"":"s"}`})});return function(r){return n.apply(this,arguments)}}())}),TXe=Rt.BuiltIn({name:"trajectory-from-blob",display:{name:"Parse Blob",description:"Parse format blob into a single trajectory."},from:pe.Format.Blob,to:pe.Molecule.Trajectory})({apply:({a:e})=>Oe.create("Parse Format Blob",function(){var t=ie(function*(n){const r=[];for(const o of e.data){if("cif"!==o.kind)continue;const s=o.data.blocks[0],a=yield dO(s).runInContext(n);if(0===a.frameCount)throw new Error("No models found.");for(let c=0;c!0===r.loadAllBlocks})),blockIndex:C.Optional(C.Numeric(0,{min:0,step:1},{description:"Zero-based index of the block to parse. Only applies when Block Header parameter is not specified.",hideIf:r=>!0===r.loadAllBlocks||r.blockHeader}))};const{blocks:t}=e.data,n=t.map(r=>[r.header,r.header]);return n.push(["","[Use Block Index]"]),{loadAllBlocks:C.Optional(C.Boolean(!1,{description:"If True, ignore Block Header and Block Index parameters and parse all data blocks into a single trajectory."})),blockHeader:C.Optional(C.Select(t[0]&&t[0].header,n,{description:"Header of the block to parse. If not specifed, Block Index parameter applies.",hideIf:r=>!0===r.loadAllBlocks})),blockIndex:C.Optional(C.Numeric(0,{min:0,step:1,max:t.length-1},{description:"Zero-based index of the block to parse. Only applies when Block Header parameter is not specified.",hideIf:r=>!0===r.loadAllBlocks||r.blockHeader}))}}})({isApplicable:e=>e.data.blocks.length>0,apply:({a:e,params:t})=>Oe.create("Parse mmCIF",function(){var n=ie(function*(r){var i;let o;if(t.loadAllBlocks){const a=[];for(const c of e.data.blocks){r.shouldUpdate&&(yield r.update(`Parsing ${c.header}...`));const u=yield dO(c).runInContext(r);for(let l=0;ll.header===a);if(!c)throw new Error(`Data block '${[a]}' not found.`);o=!c.categoryNames.includes("chem_comp_atom")||c.categoryNames.includes("atom_site")||c.categoryNames.includes("ihm_sphere_obj_site")||c.categoryNames.includes("ihm_gaussian_obj_site")?yield dO(c,e.data).runInContext(r):yield function j4e(e){const t=x2.fromFrame(e);return Oe.create("Create CCD Models",n=>function H4e(e,t,n){return fO.apply(this,arguments)}(t.data.db,x2.fromFrame(e),n))}(c).runInContext(r)}if(0===o.frameCount)throw new Error("No models found.");const s=Qp(o);return new pe.Molecule.Trajectory(o,s)});return function(r){return n.apply(this,arguments)}}())}),EXe=Rt.BuiltIn({name:"trajectory-from-pdb",display:{name:"Parse PDB",description:"Parse PDB string and create trajectory."},from:[pe.Data.String],to:pe.Molecule.Trajectory,params:{isPdbqt:C.Boolean(!1)}})({apply:({a:e,params:t})=>Oe.create("Parse PDB",function(){var n=ie(function*(r){const i=yield function Zze(e,t,n=!1){return Oe.create("Parse PDB",function(){var r=ie(function*(i){return Fr.success({lines:yield ht.readAllLinesAsync(e,i),id:t,isPdbqt:n})});return function(i){return r.apply(this,arguments)}}())}(e.data,e.label,t.isPdbqt).runInContext(r);if(i.isError)throw new Error(i.message);const o=yield function fWe(e){return Oe.create("Parse PDB",function(){var t=ie(function*(n){var r;yield n.update("Converting to mmCIF");const i=yield function dWe(e){return B5.apply(this,arguments)}(e),o=Er.fromFrame(i,void 0,O5.create(e)),s=$u(o.data.db,!0),a=yield af(s,o,n),c=null===(r=i.categories.atom_site)||void 0===r?void 0:r.getField("partial_charge");if(c&&1===a.frameCount){const u=a.representative,l=u.atomicHierarchy.atomSourceIndex,f=te.isIdentity(l)?void 0:l.toArray({array:Int32Array}),p=c.toFloatArray(),m=te.ofFloatArray(f?te.mapToArray(l,h=>p[h],Float32Array):p);Mv.Provider.set(u,{data:m,type:"GASTEIGER"})}return a});return function(n){return t.apply(this,arguments)}}())}(i.result).runInContext(r),s=Qp(o);return new pe.Molecule.Trajectory(o,s)});return function(r){return n.apply(this,arguments)}}())}),PXe=Rt.BuiltIn({name:"trajectory-from-gro",display:{name:"Parse GRO",description:"Parse GRO string and create trajectory."},from:[pe.Data.String],to:pe.Molecule.Trajectory})({apply:({a:e})=>Oe.create("Parse GRO",function(){var t=ie(function*(n){const r=yield function Kze(e){return Oe.create("Parse GRO",function(){var t=ie(function*(n){return yield function Xze(e,t){return jL.apply(this,arguments)}(e,n)});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);const i=yield function $qe(e){return Oe.create("Parse GRO",function(){var t=ie(function*(n){const r=F5.fromGro(e),i=[];for(let o=0,s=e.structures.length;oOe.create("Parse XYZ",function(){var t=ie(function*(n){const r=yield function OYe(e){return Oe.create("Parse Mol",ie(function*(){return function BYe(e){const t=ht(e),n=[];for(;;){const i=FYe(t);if(0===i.count)break;n.push(i)}return Fr.success({molecules:n})}(e)}))}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);const i=yield function UYe(e){return Oe.create("Parse XYZ",t=>function LYe(e,t){const{molecules:n}=e;let r=0;for(const x of n)r+=x.count;const i=new Array(r),o=new Int32Array(r),s=new Float32Array(r),a=new Float32Array(r),c=new Float32Array(r),u=new Int32Array(r);let l=0;for(let x=0;xOe.create("Parse MOL",function(){var t=ie(function*(n){const r=yield function lYe(e){return Oe.create("Parse Mol",ie(function*(){return function uYe(e){const t=ht(e),n=ht.readLine(t).trim(),r=ht.readLine(t).trim(),i=ht.readLine(t).trim(),o=ht.readLine(t),s=+o.substr(0,3),a=+o.substr(3,3),c=koe(t,s),u=Noe(t,a),l=Foe(t);return Fr.success({title:n,program:r,comment:i,atoms:c,bonds:u,formalCharges:l})}(e)}))}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);const i=yield function dYe(e){return Oe.create("Parse MOL",t=>Boe(e,void 0,t))}(r.result).runInContext(n),o=Qp(i);return new pe.Molecule.Trajectory(i,o)});return function(n){return t.apply(this,arguments)}}())}),kXe=Rt.BuiltIn({name:"trajectory-from-sdf",display:{name:"Parse SDF",description:"Parse SDF string and create trajectory."},from:[pe.Data.String],to:pe.Molecule.Trajectory})({apply:({a:e})=>Oe.create("Parse SDF",function(){var t=ie(function*(n){const r=yield function YYe(e){return Oe.create("Parse Sdf",ie(function*(){return function $Ye(e){const t=ht(e),n=[];for(;t.positionOe.create("Parse MOL2",function(){var t=ie(function*(n){const r=yield function TYe(e,t){return Oe.create("Parse MOL2",function(){var n=ie(function*(r){return yield function IYe(e,t,n){return u6.apply(this,arguments)}(r,e,t)});return function(r){return n.apply(this,arguments)}}())}(e.data,e.label).runInContext(n);if(r.isError)throw new Error(r.message);const i=yield function PYe(e){return Oe.create("Parse MOL2",t=>function DYe(e,t){return l6.apply(this,arguments)}(e,t))}(r.result).runInContext(n),o=Qp(i);return new pe.Molecule.Trajectory(i,o)});return function(n){return t.apply(this,arguments)}}())}),FXe=Rt.BuiltIn({name:"trajectory-from-cube",display:{name:"Parse Cube",description:"Parse Cube file to create a trajectory."},from:pe.Format.Cube,to:pe.Molecule.Trajectory})({apply:({a:e})=>Oe.create("Parse MOL",function(){var t=ie(function*(n){const r=yield function vYe(e){return Oe.create("Parse Cube",t=>function bYe(e,t){return i6.apply(this,arguments)}(e,t))}(e.data).runInContext(n),i=Qp(r);return new pe.Molecule.Trajectory(r,i)});return function(n){return t.apply(this,arguments)}}())}),BXe=Rt.BuiltIn({name:"trajectory-from-cif-core",display:{name:"Parse CIF Core",description:"Identify and create all separate models in the specified CIF data block"},from:pe.Format.Cif,to:pe.Molecule.Trajectory,params(e){if(!e)return{blockHeader:C.Optional(C.Text(void 0,{description:"Header of the block to parse. If none is specifed, the 1st data block in the file is used."}))};const{blocks:t}=e.data;return{blockHeader:C.Optional(C.Select(t[0]&&t[0].header,t.map(n=>[n.header,n.header]),{description:"Header of the block to parse"}))}}})({apply:({a:e,params:t})=>Oe.create("Parse CIF Core",function(){var n=ie(function*(r){const i=t.blockHeader||e.data.blocks[0].header,o=e.data.blocks.find(c=>c.header===i);if(!o)throw new Error(`Data block '${[i]}' not found.`);const s=yield function yYe(e){const t=DS.fromFrame(e);return Oe.create("Parse CIF Core",n=>function hYe(e,t,n){return r6.apply(this,arguments)}(t.data.db,t,n))}(o).runInContext(r);if(0===s.frameCount)throw new Error("No models found.");const a=Qp(s);return new pe.Molecule.Trajectory(s,a)});return function(r){return n.apply(this,arguments)}}())}),OXe=e=>e+1,LXe=e=>e-1,qoe=Rt.BuiltIn({name:"model-from-trajectory",display:{name:"Molecular Model",description:"Create a molecular model from specified index in a trajectory."},from:pe.Molecule.Trajectory,to:pe.Molecule.Model,params:e=>e?{modelIndex:C.Converted(OXe,LXe,C.Numeric(1,{min:1,max:e.data.frameCount,step:1},{description:"Model Index",immediateUpdate:!0}))}:{modelIndex:C.Numeric(0,{},{description:"Zero-based index of the model",immediateUpdate:!0})}})({isApplicable:e=>e.data.frameCount>0,apply:({a:e,params:t})=>Oe.create("Model from Trajectory",function(){var n=ie(function*(r){let i=t.modelIndex%e.data.frameCount;i<0&&(i+=e.data.frameCount);const o=yield Oe.resolveInContext(e.data.getFrameAtIndex(i),r);return new pe.Molecule.Model(o,{label:`Model ${i+1}`,description:1===e.data.frameCount?void 0:`of ${e.data.frameCount}`})});return function(r){return n.apply(this,arguments)}}()),interpolate:(e,t,n)=>({modelIndex:n>=1?t.modelIndex:e.modelIndex+Math.floor((t.modelIndex-e.modelIndex+1)*n)}),dispose({b:e}){e?.data.customProperties.dispose()}}),UXe=Rt.BuiltIn({name:"structure-from-trajectory",display:{name:"Structure from Trajectory",description:"Create a molecular structure from a trajectory."},from:pe.Molecule.Trajectory,to:pe.Molecule.Structure})({apply:({a:e})=>Oe.create("Build Structure",function(){var t=ie(function*(n){const r=yield Ve.ofTrajectory(e.data,n),i={label:"Ensemble",description:Ve.elementDescription(r)};return new pe.Molecule.Structure(r,i)});return function(n){return t.apply(this,arguments)}}()),dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),VXe=Rt.BuiltIn({name:"structure-from-model",display:{name:"Structure",description:"Create a molecular structure (model, assembly, or symmetry) from the specified model."},from:pe.Molecule.Model,to:pe.Molecule.Structure,params:e=>b0.getParams(e&&e.data)})({canAutoUpdate:({oldParams:e,newParams:t})=>b0.canAutoUpdate(e.type,t.type),apply:({a:e,params:t},n)=>Oe.create("Build Structure",function(){var r=ie(function*(i){return b0.create(n,i,e.data,t&&t.type)});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,oldParams:n,newParams:r})=>Yd(n,r)?t.data.model===e.data?Qe.UpdateResult.Unchanged:sn.areHierarchiesEqual(e.data,t.data.model)?(t.data=t.data.remapModel(e.data),Qe.UpdateResult.Updated):Qe.UpdateResult.Recreate:Qe.UpdateResult.Recreate,dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),Woe=v(),$oe=le(),Yoe=le(),zXe=Rt.BuiltIn({name:"transform-structure-conformation",display:{name:"Transform Conformation"},isDecorator:!0,from:pe.Molecule.Structure,to:pe.Molecule.Structure,params:{transform:C.MappedStatic("components",{components:C.Group({axis:C.Vec3(v.create(1,0,0)),angle:C.Numeric(0,{min:-180,max:180,step:.1}),translation:C.Vec3(v.create(0,0,0))},{isFlat:!0}),matrix:C.Group({data:C.Mat4(le.identity()),transpose:C.Boolean(!1)},{isFlat:!0})},{label:"Kind"})}})({canAutoUpdate:({newParams:e})=>"matrix"!==e.transform.name,apply({a:e,params:t}){const n=le();if("components"===t.transform.name){const{axis:i,angle:o,translation:s}=t.transform.params,a=e.data.boundary.sphere.center;le.fromTranslation($oe,v.negate(Woe,a)),le.fromTranslation(Yoe,v.add(Woe,a,s));const c=le.fromRotation(le(),Math.PI/180*o,v.normalize(v(),i));le.mul3(n,Yoe,c,$oe)}else"matrix"===t.transform.name&&(le.copy(n,t.transform.params.data),t.transform.params.transpose&&le.transpose(n,n));const r=Ve.transform(e.data,n);return new pe.Molecule.Structure(r,{label:e.label,description:`${e.description} [Transformed]`})},dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),GXe=Rt.BuiltIn({name:"structure-selection-from-expression",display:{name:"Selection",description:"Create a molecular structure from the specified expression."},from:pe.Molecule.Structure,to:pe.Molecule.Structure,params:()=>({expression:C.Value(ue.struct.generator.all,{isHidden:!0}),label:C.Optional(C.Text("",{isHidden:!0}))})})({apply({a:e,params:t,cache:n}){const{selection:r,entry:i}=Aa.createAndRun(e.data,t.expression);if(n.entry=i,pt.isEmpty(r))return li.Null;const o=pt.unionStructure(r),s={label:`${t.label||"Selection"}`,description:Ve.elementDescription(o)};return new pe.Molecule.Structure(o,s)},update:({a:e,b:t,oldParams:n,newParams:r,cache:i})=>{if(n.expression!==r.expression)return Qe.UpdateResult.Recreate;const o=i.entry;if(o.currentStructure===e.data)return Qe.UpdateResult.Unchanged;const s=Aa.updateStructure(o,e.data);return pt.isEmpty(s)?Qe.UpdateResult.Null:(Aa.updateStructureObject(t,s,r.label),Qe.UpdateResult.Updated)},dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),jXe=Rt.BuiltIn({name:"structure-multi-selection-from-expression",display:{name:"Multi-structure Measurement Selection",description:"Create selection object from multiple structures."},from:pe.Root,to:pe.Molecule.Structure.Selections,params:()=>({selections:C.ObjectList({key:C.Text(void 0,{description:"A unique key."}),ref:C.Text(),groupId:C.Optional(C.Text()),expression:C.Value(ue.struct.generator.empty)},e=>e.ref,{isHidden:!0}),isTransitive:C.Optional(C.Boolean(!1,{isHidden:!0,description:"Remap the selections from the original structure if structurally equivalent."})),label:C.Optional(C.Text("",{isHidden:!0}))})})({apply({params:e,cache:t,dependencies:n}){const r=new Map,i=[];let o=0;for(const a of e.selections){const{selection:c,entry:u}=Aa.createAndRun(n[a.ref].data,a.expression);r.set(a.key,u);const l=pt.toLociWithSourceUnits(c);i.push({key:a.key,loci:l,groupId:a.groupId}),o+=De.size(l)}return t.entries=r,new pe.Molecule.Structure.Selections(i,{label:`${e.label||"Multi-selection"}`,description:`${e.selections.length} source(s), ${o} element(s) total`})},update:({b:e,oldParams:t,newParams:n,cache:r,dependencies:i})=>{if(!!t.isTransitive!=!!n.isTransitive)return Qe.UpdateResult.Recreate;const o=r.entries,s=new Map,a=new Map;for(const d of e.data)a.set(d.key,d);let c=!1,u=0;const l=[];for(const d of n.selections){const f=i[d.ref].data;let p=!1;if(o.has(d.key)){const m=o.get(d.key);if(Aa.isUnchanged(m,d.expression,f)&&a.has(d.key)){const h=a.get(d.key);h.groupId!==d.groupId&&(h.groupId=d.groupId,c=!0),s.set(d.key,m),l.push(h),u+=De.size(h.loci);continue}if(m.expression!==d.expression)p=!0;else{let h=!1;if(n.isTransitive)if(Ve.areUnitIdsAndIndicesEqual(m.originalStructure,f)){const g=Aa.run(m,m.originalStructure);m.currentStructure=f,s.set(d.key,m);const y=De.remap(pt.toLociWithSourceUnits(g),f);l.push({key:d.key,loci:y,groupId:d.groupId}),u+=De.size(y),c=!0}else h=!0;else h=!0;if(h){c=!0;const g=Aa.updateStructure(m,f);s.set(d.key,m);const y=pt.toLociWithSourceUnits(g);l.push({key:d.key,loci:y,groupId:d.groupId}),u+=De.size(y)}}}else p=!0;if(p){c=!0;const{selection:m,entry:h}=Aa.createAndRun(f,d.expression);s.set(d.key,h);const g=pt.toLociWithSourceUnits(m);l.push({key:d.key,loci:g}),u+=De.size(g)}}return c?(r.entries=s,e.data=l,e.label=`${n.label||"Multi-selection"}`,e.description=`${l.length} source(s), ${u} element(s) total`,Qe.UpdateResult.Updated):Qe.UpdateResult.Unchanged}}),HXe=Rt.BuiltIn({name:"structure-selection-from-script",display:{name:"Selection",description:"Create a molecular structure from the specified script."},from:pe.Molecule.Structure,to:pe.Molecule.Structure,params:()=>({script:C.Script({language:"mol-script",expression:"(sel.atom.atom-groups :residue-test (= atom.resname ALA))"}),label:C.Optional(C.Text(""))})})({apply({a:e,params:t,cache:n}){const{selection:r,entry:i}=Aa.createAndRun(e.data,t.script);n.entry=i;const o=pt.unionStructure(r),s={label:`${t.label||"Selection"}`,description:Ve.elementDescription(o)};return new pe.Molecule.Structure(o,s)},update:({a:e,b:t,oldParams:n,newParams:r,cache:i})=>{if(!ko.areEqual(n.script,r.script))return Qe.UpdateResult.Recreate;const o=i.entry;if(o.currentStructure===e.data)return Qe.UpdateResult.Unchanged;const s=Aa.updateStructure(o,e.data);return Aa.updateStructureObject(t,s,r.label),Qe.UpdateResult.Updated},dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),qXe=Rt.BuiltIn({name:"structure-selection-from-bundle",display:{name:"Selection",description:"Create a molecular structure from the specified structure-element bundle."},from:pe.Molecule.Structure,to:pe.Molecule.Structure,params:()=>({bundle:C.Value(Kn.Empty,{isHidden:!0}),label:C.Optional(C.Text("",{isHidden:!0}))})})({apply({a:e,params:t,cache:n}){if(t.bundle.hash!==e.data.hashCode)return li.Null;n.source=e.data;const r=Kn.toStructure(t.bundle,e.data);if(0===r.elementCount)return li.Null;const i={label:`${t.label||"Selection"}`,description:Ve.elementDescription(r)};return new pe.Molecule.Structure(r,i)},update:({a:e,b:t,oldParams:n,newParams:r,cache:i})=>{if(!Kn.areEqual(n.bundle,r.bundle))return Qe.UpdateResult.Recreate;if(r.bundle.hash!==e.data.hashCode)return Qe.UpdateResult.Null;if(i.source===e.data)return Qe.UpdateResult.Unchanged;i.source=e.data;const o=Kn.toStructure(r.bundle,e.data);return 0===o.elementCount?Qe.UpdateResult.Null:(t.label=`${r.label||"Selection"}`,t.description=Ve.elementDescription(o),t.data=o,Qe.UpdateResult.Updated)},dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),Xoe={polymer:"polymer",protein:"protein",nucleic:"nucleic",water:"water",branched:"branched",ligand:"ligand","non-standard":"non-standard",coarse:"coarse","atomic-sequence":"atomic-sequence","atomic-het":"atomic-het",spheres:"spheres"},WXe=C.objectToOptions(Xoe),$Xe=Rt.BuiltIn({name:"structure-complex-element",display:{name:"Complex Element",description:"Create a molecular structure from the specified model."},from:pe.Molecule.Structure,to:pe.Molecule.Structure,params:{type:C.Select("atomic-sequence",WXe,{isHidden:!0})}})({apply({a:e,params:t}){let n,r;switch(t.type){case"polymer":n=No.polymer.query,r="Polymer";break;case"protein":n=No.protein.query,r="Protein";break;case"nucleic":n=No.nucleic.query,r="Nucleic";break;case"water":n=Sr.internal.water(),r="Water";break;case"branched":n=No.branchedPlusConnected.query,r="Branched";break;case"ligand":n=No.ligandPlusConnected.query,r="Ligand";break;case"non-standard":n=No.nonStandardPolymer.query,r="Non-standard";break;case"coarse":n=No.coarse.query,r="Coarse";break;case"atomic-sequence":n=Sr.internal.atomicSequence(),r="Sequence";break;case"atomic-het":n=Sr.internal.atomicHet(),r="HET Groups/Ligands";break;case"spheres":n=Sr.internal.spheres(),r="Coarse Spheres";break;default:Rr()}const i=n(new qu(e.data)),o=pt.unionStructure(i);return 0===o.elementCount?li.Null:new pe.Molecule.Structure(o,{label:r,description:Ve.elementDescription(o)})},dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),YXe=Rt.BuiltIn({name:"structure-component",display:{name:"Component",description:"A molecular structure component."},from:pe.Molecule.Structure,to:pe.Molecule.Structure,params:()=>({type:C.MappedStatic("static",{static:C.Text("polymer"),expression:C.Value(ue.struct.generator.all),bundle:C.Value(Kn.Empty),script:C.Script({language:"mol-script",expression:"(sel.atom.all)"})},{isHidden:!0}),nullIfEmpty:C.Optional(C.Boolean(!0,{isHidden:!0})),label:C.Text("",{isHidden:!0})})})({apply:({a:e,params:t,cache:n})=>function oYe(e,t,n){n.source=e;let i,r=Ve.Empty;switch(t.type.name){case"static":{let s;switch(t.type.params){case"all":s=No.all.query,i="All";break;case"polymer":s=No.polymer.query,i="Polymer";break;case"protein":s=No.protein.query,i="Protein";break;case"nucleic":s=No.nucleic.query,i="Nucleic";break;case"water":s=Sr.internal.water(),i="Water";break;case"ion":s=No.ion.query,i="Ion";break;case"lipid":s=No.lipid.query,i="Lipid";break;case"branched":s=No.branchedPlusConnected.query,i="Branched";break;case"ligand":s=No.ligandPlusConnected.query,i="Ligand";break;case"non-standard":s=No.nonStandardPolymer.query,i="Non-standard";break;case"coarse":s=No.coarse.query,i="Coarse";break;default:Rr()}const a=s(new qu(e));r=pt.unionStructure(a);break}case"script":case"expression":{const{selection:s,entry:a}=Aa.createAndRun(e,t.type.params);n.entry=a,r=pt.unionStructure(s);break}case"bundle":if(t.type.params.hash!==e.hashCode)break;r=Kn.toStructure(t.type.params,e)}if(t.nullIfEmpty&&0===r.elementCount)return li.Null;const o={label:`${t.label||i||"Component"}`,description:Ve.elementDescription(r)};return new pe.Molecule.Structure(r,o)}(e.data,t,n),update:({a:e,b:t,oldParams:n,newParams:r,cache:i})=>function sYe(e,t,n,r,i){if(n.type.name!==r.type.name)return Qe.UpdateResult.Recreate;let o=!1;switch(r.type.name){case"static":return n.type.params===r.type.params&&Ve.areEquivalent(e,i.source)?t.data.model===e.model?Qe.UpdateResult.Unchanged:sn.areHierarchiesEqual(e.model,t.data.model)?(t.data=t.data.remapModel(e.model),Qe.UpdateResult.Updated):Qe.UpdateResult.Recreate:Qe.UpdateResult.Recreate;case"script":if(!ko.areEqual(n.type.params,r.type.params))return Qe.UpdateResult.Recreate;case"expression":{if(n.type.params!==r.type.params)return Qe.UpdateResult.Recreate;if(e===i.source)break;const a=Aa.updateStructure(i.entry,e);i.source=e,t.data=pt.unionStructure(a),Aa.updateStructureObject(t,a,r.label),o=!0;break}case"bundle":if(e===i.source&&Kn.areEqual(n.type.params,r.type.params))break;i.source=e,r.type.params.hash!==e.hashCode?(o=0!==t.data.elementCount,t.data=0===t.data.elementCount?t.data:Ve.Empty):(o=!0,t.data=Kn.toStructure(r.type.params,e))}if(o){if(r.nullIfEmpty&&0===t.data.elementCount)return Qe.UpdateResult.Null;t.description=Ve.elementDescription(t.data)}return n.label!==r.label&&(o=!0,t.label=`${r.label||t.label}`),o?Qe.UpdateResult.Updated:Qe.UpdateResult.Unchanged}(e.data,t,n,r,i),dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),Koe=Rt.BuiltIn({name:"custom-model-properties",display:{name:"Custom Model Properties"},isDecorator:!0,from:pe.Molecule.Model,to:pe.Molecule.Model,params:(e,t)=>t.customModelProperties.getParams(e?.data)})({apply:({a:e,params:t},n)=>Oe.create("Custom Props",function(){var r=ie(function*(i){return yield Zoe(e.data,n,i,t),new pe.Molecule.Model(e.data,{label:e.label,description:e.description})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,oldParams:n,newParams:r},i)=>Oe.create("Custom Props",function(){var o=ie(function*(s){t.data=e.data,t.label=e.label,t.description=e.description;for(const a of n.autoAttach){const c=i.customModelProperties.get(a);c&&e.data.customProperties.reference(c.descriptor,!1)}return yield Zoe(e.data,i,s,r),Qe.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}()),dispose({b:e}){e?.data.customProperties.dispose()}});function Zoe(e,t,n,r){return I6.apply(this,arguments)}function I6(){return I6=ie(function*(e,t,n,r){const i={runtime:n,assetManager:t.managers.asset},{autoAttach:o,properties:s}=r;for(const a of Object.keys(s)){const c=t.customModelProperties.get(a),u=s[a];if(o.includes(a)||c.isHidden)try{yield c.attach(i,e,u,!0)}catch(l){t.log.warn(`Error attaching model prop '${a}': ${l}`)}else c.set(e,u)}}),I6.apply(this,arguments)}const Qoe=Rt.BuiltIn({name:"custom-structure-properties",display:{name:"Custom Structure Properties"},isDecorator:!0,from:pe.Molecule.Structure,to:pe.Molecule.Structure,params:(e,t)=>t.customStructureProperties.getParams(e?.data.root)})({apply:({a:e,params:t},n)=>Oe.create("Custom Props",function(){var r=ie(function*(i){return yield Joe(e.data.root,n,i,t),new pe.Molecule.Structure(e.data,{label:e.label,description:e.description})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,oldParams:n,newParams:r},i)=>e.data!==t.data?Qe.UpdateResult.Recreate:Oe.create("Custom Props",function(){var o=ie(function*(s){t.data=e.data,t.label=e.label,t.description=e.description;for(const a of n.autoAttach){const c=i.customStructureProperties.get(a);c&&e.data.customPropertyDescriptors.reference(c.descriptor,!1)}return yield Joe(e.data.root,i,s,r),Qe.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}()),dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}});function Joe(e,t,n,r){return T6.apply(this,arguments)}function T6(){return T6=ie(function*(e,t,n,r){const i={runtime:n,assetManager:t.managers.asset},{autoAttach:o,properties:s}=r;for(const a of Object.keys(s)){const c=t.customStructureProperties.get(a),u=s[a];if(o.includes(a)||c.isHidden)try{yield c.attach(i,e,u,!0)}catch(l){t.log.warn(`Error attaching structure prop '${a}': ${l}`)}else c.set(e,u)}}),T6.apply(this,arguments)}const XXe=Rt.BuiltIn({name:"shape-from-ply",display:{name:"Shape from PLY",description:"Create Shape from PLY data"},from:pe.Format.Ply,to:pe.Shape.Provider,params:e=>({transforms:C.Optional(C.Value([],{isHidden:!0})),label:C.Optional(C.Text("",{isHidden:!0}))})})({apply:({a:e,params:t})=>Oe.create("Create shape from PLY",function(){var n=ie(function*(r){const i=yield function Uqe(e,t){return Oe.create("Shape Provider",function(){var n=ie(function*(r){return{label:"Mesh",data:{source:e,transforms:t?.transforms},params:Kie(e),getShape:Lqe(),geometryUtils:Nt.Utils}});return function(r){return n.apply(this,arguments)}}())}(e.data,t).runInContext(r);return new pe.Shape.Provider(i,{label:t.label||"Shape"})});return function(r){return n.apply(this,arguments)}}())});var D6,E6,P6,M6;!function(e){e.is=function t(r){return"ccp4"===r?.kind},e.create=function n(r){return{kind:"ccp4",name:r.name,data:r}}}(D6||(D6={})),function(e){e.is=function t(r){return"dsn6"===r?.kind},e.create=function n(r){return{kind:"dsn6",name:r.name,data:r}}}(E6||(E6={})),function(e){e.is=function t(r){return"dx"===r?.kind},e.create=function n(r){return{kind:"dx",name:r.name,data:r}}}(P6||(P6={})),function(e){e.is=function t(r){return"segcif"===r?.kind},e.create=function n(r){return{kind:"segcif",name:r._name,data:r}}}(M6||(M6={}));const nKe=Rt.BuiltIn({name:"volume-from-ccp4",display:{name:"Volume from CCP4/MRC/MAP",description:"Create Volume from CCP4/MRC/MAP data"},from:pe.Format.Ccp4,to:pe.Volume.Data,params:e=>({voxelSize:C.Vec3(v.create(1,1,1)),offset:C.Vec3(v.create(0,0,0)),entryId:C.Text("")})})({apply:({a:e,params:t})=>Oe.create("Create volume from CCP4/MRC/MAP",function(){var n=ie(function*(r){const i=yield function QXe(e,t){return Oe.create("Create Volume",function(){var n=ie(function*(r){const{header:i,values:o}=e,s=v.create(i.xLength,i.yLength,i.zLength);t&&t.voxelSize&&v.mul(s,s,t.voxelSize);const a=v.create(Yn(i.alpha),Yn(i.beta),Yn(i.gamma)),u=ma.create((i.ISPG>65536?0:i.ISPG)||"P 1",s,a),l=v.create(i.MAPC-1,i.MAPR-1,i.MAPS-1),d=wn.convertToCanonicalAxisIndicesFastToSlow(l),f=[i.NX,i.NY,i.NZ],p=d([i.NC,i.NR,i.NS]),m=function KXe(e){return 0===e.originX&&0===e.originY&&0===e.originZ?v.create(e.NCSTART,e.NRSTART,e.NSSTART):v.create(e.originX/(e.xLength/e.NX),e.originY/(e.yLength/e.NY),e.originZ/(e.zLength/e.NZ))}(i);t?.offset&&v.add(m,m,t.offset);const h=d(m),g=v.create(h[0]/f[0],h[1]/f[1],h[2]/f[2]),y=v.create(p[0]/f[0],p[1]/f[1],p[2]/f[2]),b=wn.Space(p,wn.invertAxisOrder(l),function ZXe(e){const t=vte(e);switch(t){case us.Float32:return Float32Array;case us.Int8:return Int8Array;case us.Int16:return Int16Array;case us.Uint16:return Uint16Array}throw Error(`${t} is not a supported value format.`)}(i)),x=wn.create(b,wn.Data1(o)),_=0===i.AMIN&&0===i.AMAX&&0===i.AMEAN&&0===i.ARMS;return{label:t?.label,entryId:t?.entryId,grid:{transform:{kind:"spacegroup",cell:u,fractionalBox:St.create(g,v.add(v.zero(),g,y))},cells:x,stats:{min:isNaN(i.AMIN)||_?LI(o):i.AMIN,max:isNaN(i.AMAX)||_?Xd(o):i.AMAX,mean:isNaN(i.AMEAN)||_?UI(o):i.AMEAN,sigma:isNaN(i.ARMS)||0===i.ARMS?VI(o):i.ARMS}},sourceData:D6.create(e),customProperties:new Ql,_propertyData:Object.create(null)}});return function(r){return n.apply(this,arguments)}}())}(e.data,{...t,label:e.data.name||e.label}).runInContext(r);return new pe.Volume.Data(i,{label:i.label||"Volume",description:`Volume ${e.data.header.NX}\xd7${e.data.header.NX}\xd7${e.data.header.NX}`})});return function(r){return n.apply(this,arguments)}}()),dispose({b:e}){e?.data.customProperties.dispose()}}),rKe=Rt.BuiltIn({name:"volume-from-dsn6",display:{name:"Volume from DSN6/BRIX",description:"Create Volume from DSN6/BRIX data"},from:pe.Format.Dsn6,to:pe.Volume.Data,params:e=>({voxelSize:C.Vec3(v.create(1,1,1)),entryId:C.Text("")})})({apply:({a:e,params:t})=>Oe.create("Create volume from DSN6/BRIX",function(){var n=ie(function*(r){const i=yield function JXe(e,t){return Oe.create("Create Volume",function(){var n=ie(function*(r){const{header:i,values:o}=e,s=v.create(i.xlen,i.ylen,i.zlen);t&&t.voxelSize&&v.mul(s,s,t.voxelSize);const a=v.create(Yn(i.alpha),Yn(i.beta),Yn(i.gamma)),c=ma.create("P 1",s,a),u=[i.xRate,i.yRate,i.zRate],l=[i.xExtent,i.yExtent,i.zExtent],d=[i.xStart,i.yStart,i.zStart],f=v.create(d[0]/u[0],d[1]/u[1],d[2]/u[2]),p=v.create(l[0]/u[0],l[1]/u[1],l[2]/u[2]),m=wn.Space(l,[0,1,2],Float32Array),h=wn.create(m,wn.Data1(o));return{label:t?.label,entryId:t?.entryId,grid:{transform:{kind:"spacegroup",cell:c,fractionalBox:St.create(f,v.add(v.zero(),f,p))},cells:h,stats:{min:LI(o),max:Xd(o),mean:UI(o),sigma:void 0!==i.sigma?i.sigma:VI(o)}},sourceData:E6.create(e),customProperties:new Ql,_propertyData:Object.create(null)}});return function(r){return n.apply(this,arguments)}}())}(e.data,{...t,label:e.data.name||e.label}).runInContext(r);return new pe.Volume.Data(i,{label:i.label||"Volume",description:`Volume ${e.data.header.xExtent}\xd7${e.data.header.yExtent}\xd7${e.data.header.zExtent}`})});return function(r){return n.apply(this,arguments)}}()),dispose({b:e}){e?.data.customProperties.dispose()}}),iKe=Rt.BuiltIn({name:"volume-from-cube",display:{name:"Volume from Cube",description:"Create Volume from Cube data"},from:pe.Format.Cube,to:pe.Volume.Data,params:e=>({dataIndex:e?C.Select(0,e.data.header.dataSetIds.map((n,r)=>[r,`${n}`])):C.Numeric(0),entryId:C.Text("")})})({apply:({a:e,params:t})=>Oe.create("Create volume from Cube",function(){var n=ie(function*(r){const i=yield function OHe(e,t){return Oe.create("Create Volume",ie(function*(){const{header:n,values:r}=e,i=wn.Space(n.dim,[0,1,2],Float64Array);let o;if(0===n.dataSetIds.length)o=r;else{const[u,l,d]=n.dim,f=(t?.dataIndex||0)+1;let p=0,m=0;o=new Float64Array(u*l*d);for(let h=0;hOe.create("Parse DX",function(){var t=ie(function*(n){const r=yield function eKe(e,t){return Oe.create("Create Volume",ie(function*(){const{header:n,values:r}=e,i=wn.Space(n.dim,[0,1,2],Float64Array),o=wn.create(i,wn.Data1(r)),s=le.fromTranslation(le(),n.min),a=le.fromScaling(le(),n.h);return le.mul(s,s,a),{label:t?.label,entryId:t?.entryId,grid:{transform:{kind:"matrix",matrix:s},cells:o,stats:{min:LI(r),max:Xd(r),mean:UI(r),sigma:VI(r)}},sourceData:P6.create(e),customProperties:new Ql,_propertyData:Object.create(null)}}))}(e.data,{label:e.data.name||e.label}).runInContext(n);return new pe.Volume.Data(r,{label:r.label||"Volume",description:`Volume ${e.data.header.dim[0]}\xd7${e.data.header.dim[1]}\xd7${e.data.header.dim[2]}`})});return function(n){return t.apply(this,arguments)}}()),dispose({b:e}){e?.data.customProperties.dispose()}}),sKe=Rt.BuiltIn({name:"volume-from-density-server-cif",display:{name:"Volume from density-server CIF",description:"Identify and create all separate models in the specified CIF data block"},from:pe.Format.Cif,to:pe.Volume.Data,params(e){if(!e)return{blockHeader:C.Optional(C.Text(void 0,{description:"Header of the block to parse. If none is specifed, the 1st data block in the file is used."})),entryId:C.Text("")};const t=e.data.blocks.slice(1);return{blockHeader:C.Optional(C.Select(t[0]&&t[0].header,t.map(n=>[n.header,n.header]),{description:"Header of the block to parse"})),entryId:C.Text("")}}})({isApplicable:e=>e.data.blocks.length>0,apply:({a:e,params:t})=>Oe.create("Parse density-server CIF",function(){var n=ie(function*(r){var i;const o=t.blockHeader||e.data.blocks[1].header,s=e.data.blocks.find(p=>p.header===o);if(!s)throw new Error(`Data block '${[o]}' not found.`);const a=od.schema.densityServer(s),c=yield jie(a,{entryId:t.entryId}).runInContext(r),[u,l,d]=c.grid.cells.space.dimensions,f={label:null!==(i=t.entryId)&&void 0!==i?i:a.volume_data_3d_info.name.value(0),description:`Volume ${u}\xd7${l}\xd7${d}`};return new pe.Volume.Data(c,f)});return function(r){return n.apply(this,arguments)}}()),dispose({b:e}){e?.data.customProperties.dispose()}}),aKe=Rt.BuiltIn({name:"volume-from-segmentation-cif",display:{name:"Volume from Segmentation CIF"},from:pe.Format.Cif,to:pe.Volume.Data,params(e){const t=e?.data.blocks.slice(1);return{blockHeader:C.Optional(t?C.Select(t[0]&&t[0].header,t.map(r=>[r.header,r.header]),{description:"Header of the block to parse"}):C.Text(void 0,{description:"Header of the block to parse. If none is specifed, the 1st data block in the file is used."})),segmentLabels:C.ObjectList({id:C.Numeric(-1),label:C.Text("")},r=>`${r.id} = ${r.label}`,{description:"Mapping of segment IDs to segment labels"}),ownerId:C.Text("",{isHidden:!0,description:"Reference to the object which manages this volume"})}}})({isApplicable:e=>e.data.blocks.length>0,apply:({a:e,params:t})=>Oe.create("Parse segmentation CIF",function(){var n=ie(function*(r){const i=t.blockHeader||e.data.blocks[1].header,o=e.data.blocks.find(p=>p.header===i);if(!o)throw new Error(`Data block '${[i]}' not found.`);const s=od.schema.segmentation(o),a={};for(const p of t.segmentLabels)a[p.id]=p.label;const c=yield function tKe(e,t){return Oe.create("Create Segmentation Volume",function(){var n=ie(function*(r){var i;const{volume_data_3d_info:o,segmentation_data_3d:s}=e,a=ma.create(o.spacegroup_number.value(0),v.ofArray(o.spacegroup_cell_size.value(0)),v.scale(v(),v.ofArray(o.spacegroup_cell_angles.value(0)),Math.PI/180)),c=o.axis_order.value(0),u=wn.convertToCanonicalAxisIndicesFastToSlow(c),l=u(o.sample_count.value(0)),d=wn.Space(l,wn.invertAxisOrder(c),Float32Array),f=wn.create(d,wn.Data1(s.values.toArray({array:Float32Array}))),p=v.ofArray(u(o.origin.value(0))),m=v.ofArray(u(o.dimensions.value(0))),h={label:t?.label,entryId:void 0,grid:{transform:{kind:"spacegroup",cell:a,fractionalBox:St.create(p,v.add(v(),p,m))},cells:f,stats:{min:0,max:1,mean:0,sigma:1}},sourceData:M6.create(e),customProperties:new Ql,_propertyData:{ownerId:t?.ownerId}};et.PickingGranularity.set(h,"object");const g=new Map,y=new Map,{segment_id:b,set_id:x}=e.segmentation_data_table;for(let V=0,F=b.rowCount;V{V.forEach(G=>{g.has(G)||g.set(G,new Set),g.get(G).add(F)})});const _=[0,0,0],S=f.space.getCoords,A=f.data,[E,w,D]=h.grid.cells.space.dimensions,I=E-1,R=w-1,T=D-1,M={};y.forEach((V,F)=>{M[F]=[I,R,T,-1,-1,-1]});for(let V=0,F=A.length;VL[3]&&(L[3]=_[0]),_[1]>L[4]&&(L[4]=_[1]),_[2]>L[5]&&(L[5]=_[2])}const N={};return g.forEach((V,F)=>{N[F]=St.create(v.create(I,R,T),v.create(-1,-1,-1))}),$a(M,(V,F)=>{y.get(parseInt(F)).forEach(G=>{const L=N[G];V[0]L.max[0]&&(L.max[0]=V[3]),V[4]>L.max[1]&&(L.max[1]=V[4]),V[5]>L.max[2]&&(L.max[2]=V[5])})}),et.Segmentation.set(h,{segments:g,sets:y,bounds:N,labels:null!==(i=t?.segmentLabels)&&void 0!==i?i:{}}),h});return function(r){return n.apply(this,arguments)}}())}(s,{segmentLabels:a,ownerId:t.ownerId}).runInContext(r),[u,l,d]=c.grid.cells.space.dimensions,f={label:s.volume_data_3d_info.name.value(0),description:`Segmentation ${u}\xd7${l}\xd7${d}`};return new pe.Volume.Data(c,f)});return function(r){return n.apply(this,arguments)}}()),dispose({b:e}){e?.data.customProperties.dispose()}}),cKe=Rt.BuiltIn({name:"assign-color-volume",display:{name:"Assign Color Volume",description:"Assigns another volume to be available for coloring."},from:pe.Volume.Data,to:pe.Volume.Data,isDecorator:!0,params(e,t){if(!e)return{ref:C.Text()};const n=t.state.data.select(In.Generators.root.subtree().ofType(pe.Volume.Data).filter(r=>{var i;return!(!r.obj||null!==(i=r.obj)&&void 0!==i&&i.data.colorVolume||r.obj===e)}));return 0===n.length?{ref:C.Text("",{isHidden:!0})}:{ref:C.Select(n[0].transform.ref,n.map(r=>[r.transform.ref,r.obj.label]))}}})({apply:({a:e,params:t,dependencies:n})=>Oe.create("Assign Color Volume",function(){var r=ie(function*(i){if(!n||!n[t.ref])throw new Error("Dependency not available.");const s={...e.data,colorVolume:n[t.ref].data};return new pe.Volume.Data(s,{label:e.label,description:"Volume + Colors"})});return function(i){return r.apply(this,arguments)}}())}),$D=st(13421772),ese={},dKe={name:"carbohydrate-symbol",label:"Carbohydrate Symbol",category:ni.Residue,factory:function tse(e,t){let n;if(e.structure){const{elements:r,getElementIndices:i}=e.structure.carbohydrates,o=(s,a)=>{if(!Ee.isAtomic(s))return $D;const c=i(s,a);return c.length>0?r[c[0]].component.color:$D};n=(s,a)=>a?15854817:nt.is(s)?o(s.unit,s.element):Lt.isLocation(s)?o(s.aUnit,s.aUnit.elements[s.aIndex]):$D}else n=()=>$D;return{factory:tse,granularity:"group",color:n,props:t,description:"Assigns colors according to the Symbol Nomenclature for Glycans (SNFG).",legend:$h(UNe)}},getParams:function lKe(e){return ese},defaultValues:C.getDefaultValues(ese),isApplicable:e=>!!e.structure&&e.structure.models.some(t=>sn.hasCarbohydrate(t))},nse={hue:C.Interval([1,360],{min:0,max:360,step:1}),chroma:C.Interval([40,70],{min:0,max:100,step:1}),luminance:C.Interval([15,85],{min:0,max:100,step:1}),sort:C.Select("contrast",C.arrayToOptions(["none","contrast"]),{description:"no sorting leaves colors approximately ordered by hue"}),clusteringStepCount:C.Numeric(50,{min:10,max:200,step:1},{isHidden:!0}),minSampleCount:C.Numeric(800,{min:100,max:5e3,step:100},{isHidden:!0}),sampleCountFactor:C.Numeric(5,{min:1,max:100,step:1},{isHidden:!0})},Uv=2,_0=[0,0,0],x0=[0,0,0];function fKe(e,t){return Yo.toHcl(_0,e),Yo.fromColor(x0,Yo.toColor(e)),_0[0]>=t.hue[0]&&_0[0]<=t.hue[1]&&_0[1]>=t.chroma[0]&&_0[1]<=t.chroma[1]&&_0[2]>=t.luminance[0]&&_0[2]<=t.luminance[1]&&x0[0]>=e[0]-Uv&&x0[0]<=e[0]+Uv&&x0[1]>=e[1]-Uv&&x0[1]<=e[1]+Uv&&x0[2]>=e[2]-Uv&&x0[2]<=e[2]+Uv}function rse(e,t){let n=1/0,r=0;for(let i=0;i`${e+1}`,minLabel:"Start",maxLabel:"End"};function ac(e,t,n={}){var r;let i,o;if("colors"===t.palette.name&&"interpolate"===t.palette.params.list.kind){const{list:s}=t.palette.params,a=[0,e-1],{minLabel:c,maxLabel:u}={...ose,...n};let l=s.colors;0===l.length&&(l=cp(ise.colorList).list);const d=Gu.create({listOrName:l,domain:a,minLabel:c,maxLabel:u});o=d.legend,i=d.color}else{let s;"colors"===t.palette.name?(s=t.palette.params.list.colors.map(l=>Array.isArray(l)?l[0]:l),0===s.length&&(s=cp("dark-2").list.map(l=>Array.isArray(l)?l[0]:l))):(e=Math.min(e,t.palette.params.maxCount),s=function mKe(e,t={}){const n={...C.getDefaultValues(nse),...t};if(e<=0)return[];const r=function hKe(e,t){const n=new Map,r=Math.ceil(Math.cbrt(e)),i=id(),o=Math.max((t.hue[1]-t.hue[0])/r,1),s=Math.max((t.chroma[1]-t.chroma[0])/r,1),a=Math.max((t.luminance[1]-t.luminance[0])/r,1);for(let c=t.hue[0]+o/2;c<=t.hue[1];c+=o)for(let u=t.chroma[0]+s/2;u<=t.chroma[1];u+=s)for(let l=t.luminance[0]+a/2;l<=t.luminance[1];l+=a){const d=Yo.fromHcl(Yo(),id.set(i,c,u,l));fKe(d,t)&&n.set(Yo.toColor(d),d)}return Array.from(n.values())}(Math.max(n.minSampleCount,e*n.sampleCountFactor),n);if(r.length=e));c+=s);for(let c=1;c<=n.clusteringStepCount;++c){const u=Jl(o),l=Jl(r);for(let f=0;f0;){const r=n[n.length-1];let i=0,o=Number.NEGATIVE_INFINITY;for(let s=0;so&&(o=a,i=s)}n.push(t.splice(i,1)[0])}return n}(i):i).map(c=>Yo.toColor(c))}(e,t.palette.params));const a=null!==(r=n.valueLabel)&&void 0!==r?r:ose.valueLabel,c=s.length,u=[];for(let l=0;ls[l%c]}return{color:i,legend:o}}const sse=st(16448250),yKe="Gives every chain a color based on its `asym_id` value.",ES={asymId:C.Select("auth",C.arrayToOptions(["auth","label"])),...Ia({type:"colors",colorList:"many-distinct"})};function ase(e,t){const n=function vKe(e,t){switch(e.kind){case 0:return"auth"===t?Ze.chain.auth_asym_id:Ze.chain.label_asym_id;case 1:case 2:return Ze.coarse.asym_id}}(e.unit,t)(e);return e.structure.root.models.length>1?cse(e.unit.model,n):n}function cse(e,t){return`${t}|${(sn.Index.get(e).value||0)+1}`}function PS(e,t){let n,r;if(e.structure){const i=nt.create(e.structure.root),o=function _Ke(e,t){const n=new Map;for(const r of e.models){const i=sn.AsymIdOffset.get(r).value,o=("auth"===t?i?.auth:i?.label)||0;let s=0;r.properties.structAsymMap.forEach(({auth_id:a},c)=>{const u="auth"===t?a:c,l=e.models.length>1?cse(r,u):u;n.has(l)||(n.set(l,s+o),++s)})}return n}(e.structure.root,t.asymId),s=Array.from(o.keys()),c=ac(o.size,t,{valueLabel:u=>s[u]});r=c.legend,n=u=>{let l;if(nt.is(u)){const d=ase(u,t.asymId);l=o.get(d)}else if(Lt.isLocation(u)){i.unit=u.aUnit,i.element=u.aUnit.elements[u.aIndex];const d=ase(i,t.asymId);l=o.get(d)}return void 0===l?sse:c.color(l)}}else n=()=>sse;return{factory:PS,granularity:"group",color:n,props:t,description:yKe,legend:r}}const use={name:"chain-id",label:"Chain Id",category:ni.Chain,factory:PS,getParams:function bKe(e){var t;const n=C.clone(ES);return!(null===(t=e.structure)||void 0===t)&&t.models.some(r=>r.coarseHierarchy.isDefined)&&(n.asymId.defaultValue="label"),n},defaultValues:C.getDefaultValues(ES),isApplicable:e=>!!e.structure},lse=st(13421772),dse={...Ia({type:"colors",colorList:"red-yellow-blue"})},CKe={name:"element-index",label:"Element Index",category:ni.Atom,factory:function fse(e,t){let n,r;if(e.structure){const{units:i}=e.structure.root,o=i.length,s=new Map,a=new Map;let c=0;for(let l=0;l{if(nt.is(l)){const d=a.get(l.unit.id),f=Fe.findPredecessorIndex(i[d].elements,l.element);return u.color(s.get(d)+f)}if(Lt.isLocation(l)){const d=a.get(l.aUnit.id),f=Fe.findPredecessorIndex(i[d].elements,l.aUnit.elements[l.aIndex]);return u.color(s.get(d)+f)}return lse}}else n=()=>lse;return{factory:fse,granularity:"groupInstance",preferSmoothing:!0,color:n,props:t,description:"Gives every element (atom or coarse sphere/gaussian) a unique color based on the position (index) of the element in the list of elements in the structure.",legend:r}},getParams:function SKe(e){return dse},defaultValues:C.getDefaultValues(dse),isApplicable:e=>!!e.structure};function YD(e){const t={};return $a(e,(n,r)=>{t[r]=C.Color(e[r])}),t}const pse=st(13421772),AKe="Assigns a color based on the operator name of a transformed chain.",R6={...Ia({type:"colors",colorList:"many-distinct"})};function k6(e,t){let n,r;if(e.structure){const i=function TKe(e){const t=new Map;for(let n=0,r=e.units.length;no[c]});r=a.legend,n=c=>{let u;return nt.is(c)?u=i.get(c.unit.conformation.operator.name):Lt.isLocation(c)&&(u=i.get(c.aUnit.conformation.operator.name)),void 0===u?pse:a.color(u)}}else n=()=>pse;return{factory:k6,granularity:"instance",color:n,props:t,description:AKe,legend:r}}const N6={name:"operator-name",label:"Operator Name",category:ni.Symmetry,factory:k6,getParams:function IKe(e){return C.clone(R6)},defaultValues:C.getDefaultValues(R6),isApplicable:e=>!!e.structure},hse=st(16448250),EKe="Gives every chain a color based on its `label_entity_id` value.",RS={...Ia({type:"colors",colorList:"many-distinct"})};function kS(e,t){return`${e}|${t}`}function mse(e){switch(e.unit.kind){case 0:return Ze.chain.label_entity_id(e);case 1:case 2:return Ze.coarse.entity_id(e)}}function NS(e,t){let n,r;if(e.structure){const i=nt.create(e.structure.root),o=function MKe(e){const t=new Map;for(let n=0,r=e.models.length;ns[u]});r=c.legend,n=u=>{let l;if(nt.is(u)){const p=kS(mse(u),u.structure.models.indexOf(u.unit.model));l=o.get(p)}else if(Lt.isLocation(u)){i.unit=u.aUnit,i.element=u.aUnit.elements[u.aIndex];const p=kS(mse(i),i.structure.models.indexOf(i.unit.model));l=o.get(p)}return void 0===l?hse:c.color(l)}}else n=()=>hse;return{factory:NS,granularity:"group",color:n,props:t,description:EKe,legend:r}}const RKe={name:"entity-id",label:"Entity Id",category:ni.Chain,factory:NS,getParams:function PKe(e){return C.clone(RS)},defaultValues:C.getDefaultValues(RS),isApplicable:e=>!!e.structure},F6="dark-2",XD=st(16448250),kKe="Gives ranges of a polymer chain a color based on the entity source it originates from (e.g. gene, plasmid, organism).",FS={...Ia({type:"colors",colorList:F6})};function gse(e,t){return`${e}|${t}`}function FKe(e,t,n,r,i,o){return`${e}|${t}|${n}|${o||i||r}`}function B6(e,t,n,r,i,o,s,a){const{entity_id:c,pdbx_src_id:u,pdbx_beg_seq_num:l,pdbx_end_seq_num:d}=i;for(let f=0,p=i._rowCount;f{const r=n.split("|"),i=r[2];return`${function jFe(e){e=e.trim();const t=parseInt(e,10);return!isNaN(t)&&t.toString()===e}(r[3])?"Unnamed "+ ++t:r[3]}${i?` (${i})`:""}`})}(a),l=ac(a.size,t,{valueLabel:f=>c[f]});r=l.legend;const d=f=>{const h=gse(o.indexOf(f.unit.model),Ze.entity.id(f)),g=s.get(h);if(g){const y=g[Ze.residue.label_seq_id(f)-1]-1;return-1===y?XD:l.color(y)}return XD};n=f=>nt.is(f)?d(f):Lt.isLocation(f)?(i.unit=f.aUnit,i.element=f.aUnit.elements[f.aIndex],d(i)):XD}else n=()=>XD;return{factory:BS,granularity:"group",color:n,props:t,description:kKe,legend:r}}const OKe={name:"entity-source",label:"Entity Source",category:ni.Chain,factory:BS,getParams:function NKe(e){const t=C.clone(FS);return e.structure&&yse(e.structure.root.models).srcKeySerialMap.size>Pc[F6].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params={...t.palette.defaultValue.params,list:{kind:"interpolate",colors:cp(F6).list}}),t},defaultValues:C.getDefaultValues(FS),isApplicable:e=>!!e.structure},bse=st(13421772),LKe="Gives every model a unique color based on its index.",OS={...Ia({type:"colors",colorList:"many-distinct"})};function LS(e,t){var n;let r,i;if(e.structure){const s=ac((null!==(n=sn.MaxIndex.get(e.structure.models[0]).value)&&void 0!==n?n:-1)+1,t);i=s.legend,r=a=>nt.is(a)?s.color(sn.Index.get(a.unit.model).value||0):Lt.isLocation(a)?s.color(sn.Index.get(a.aUnit.model).value||0):bse}else r=()=>bse;return{factory:LS,granularity:"instance",color:r,props:t,description:LKe,legend:i}}const VKe={name:"model-index",label:"Model Index",category:ni.Chain,factory:LS,getParams:function UKe(e){return C.clone(OS)},defaultValues:C.getDefaultValues(OS),isApplicable:e=>!!e.structure&&e.structure.elementCount>0},vse=st(13421772),zKe="Gives every structure a unique color based on its index.",US={...Ia({type:"colors",colorList:"many-distinct"})};function VS(e,t){var n;let r,i;if(e.structure){const s=ac((null!==(n=Ve.MaxIndex.get(e.structure).value)&&void 0!==n?n:-1)+1,t);i=s.legend,r=a=>nt.is(a)?s.color(Ve.Index.get(a.structure).value||0):Lt.isLocation(a)?s.color(Ve.Index.get(a.aStructure).value||0):vse}else r=()=>vse;return{factory:VS,granularity:"instance",color:r,props:t,description:zKe,legend:i}}const jKe={name:"structure-index",label:"Structure Index",category:ni.Chain,factory:VS,getParams:function GKe(e){return C.clone(US)},defaultValues:C.getDefaultValues(US),isApplicable:e=>!!e.structure&&e.structure.elementCount>0},O6="dark-2",_se=st(13421772),HKe="Gives every chain instance (single chain or collection of single elements) a unique color based on the position (index) of the chain in the list of chains in the structure.",L6={...Ia({type:"colors",colorList:O6})};function U6(e,t){let n,r;if(e.structure){const{units:i}=e.structure.root,o=ac(i.length,t);r=o.legend;const s=new Map;for(let a=0,c=i.length;ant.is(a)?s.get(a.unit.id):Lt.isLocation(a)?s.get(a.aUnit.id):_se}else n=()=>_se;return{factory:U6,granularity:"instance",color:n,props:t,description:HKe,legend:r}}const WKe={name:"unit-index",label:"Chain Instance",category:ni.Chain,factory:U6,getParams:function qKe(e){const t=C.clone(L6);return e.structure&&e.structure.root.units.length>Pc[O6].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params={...t.palette.defaultValue.params,list:{kind:"interpolate",colors:cp(O6).list}}),t},defaultValues:C.getDefaultValues(L6),isApplicable:e=>!!e.structure},xse={H:16777215,D:16777152,T:16777120,HE:14286847,LI:13402367,BE:12779264,B:16758197,C:9474192,N:3166456,O:16715021,F:9494608,NE:11789301,NA:11230450,MG:9109248,AL:12560038,SI:1578e4,P:16744448,S:16777008,CL:2093087,AR:8442339,K:9388244,CA:4062976,SC:15132390,TI:12567239,V:10921643,CR:9083335,MN:10255047,FE:14706227,CO:15765664,NI:5296208,CU:13140019,ZN:8224944,GA:12750735,GE:6721423,AS:12419299,SE:16752896,BR:10889513,KR:6076625,RB:7351984,SR:65280,Y:9764863,ZR:9756896,NB:7586505,MO:5551541,TC:3907230,RU:2396047,RH:687500,PD:27013,AG:12632256,CD:16767375,IN:10909043,SN:6717568,SB:10380213,TE:13924864,I:9699476,XE:9699476,CS:5707663,BA:51456,LA:7394559,CE:16777159,PR:14286791,ND:13107143,PM:10747847,SM:9437127,EU:6422471,GD:4587463,TB:3211207,DY:2097095,HO:65436,ER:58997,TM:54354,YB:48952,LU:43812,HF:5096191,TA:5089023,W:2200790,RE:2522539,OS:2516630,IR:1528967,PT:13684960,AU:16765219,HG:12105936,TL:10900557,PB:5724513,BI:10375093,PO:11230208,AT:7688005,RN:4358806,FR:4325478,RA:32e3,AC:7384058,TH:47871,PA:41471,U:36863,NP:33023,PU:27647,AM:5528818,CM:7888099,BK:9064419,CF:10565332,ES:11739092,FM:11739066,MD:11734438,NO:12389767,LR:13041766,RF:13369433,DB:13697103,SG:14221381,BH:14680120,HS:15073326,MT:15400998,DS:16777215,RG:16777215,CN:16777215,UUT:16777215,FL:16777215,UUP:16777215,LV:16777215,UUH:16777215},Sse=st(16777215),V6={carbonColor:C.MappedStatic("chain-id",{"chain-id":C.Group(ES),"unit-index":C.Group(L6,{label:"Chain Instance"}),"entity-id":C.Group(RS),"entity-source":C.Group(FS),"operator-name":C.Group(R6),"model-index":C.Group(OS),"structure-index":C.Group(US),uniform:C.Group(bv),"element-symbol":C.EmptyGroup()},{description:"Use chain-id coloring for carbon atoms."}),saturation:C.Numeric(0,{min:-6,max:6,step:.1}),lightness:C.Numeric(.2,{min:-6,max:6,step:.1}),colors:C.MappedStatic("default",{default:C.EmptyGroup(),custom:C.Group(YD(xse))})};function z6(e,t){var n;const r=KI("default"===t.colors.name?xse:t.colors.params,t.saturation,t.lightness),i=null===(n=function KKe(e,t){switch(t.name){case"chain-id":return PS(e,t.params);case"unit-index":return U6(e,t.params);case"entity-id":return NS(e,t.params);case"entity-source":return BS(e,t.params);case"operator-name":return k6(e,t.params);case"model-index":return LS(e,t.params);case"structure-index":return VS(e,t.params);case"uniform":return f0(0,t.params);case"element-symbol":return;default:Rr()}}(e,t.carbonColor))||void 0===n?void 0:n.color;function o(c,u){return i&&"C"===c?i(u,!1):function XKe(e,t){const n=e[t];return void 0===n?Sse:n}(r,c)}return{factory:z6,granularity:"operator-name"===t.carbonColor.name||"unit-index"===t.carbonColor.name?"groupInstance":"group",preferSmoothing:!0,color:function s(c){if(nt.is(c)){if(Ee.isAtomic(c.unit)){const{type_symbol:u}=c.unit.model.atomicHierarchy.atoms;return o(u.value(c.element),c)}}else if(Lt.isLocation(c)&&Ee.isAtomic(c.aUnit)){const{type_symbol:u}=c.aUnit.model.atomicHierarchy.atoms;return o(u.value(c.aUnit.elements[c.aIndex]),c)}return Sse},props:t,description:"Assigns a color to every atom according to its chemical element.",legend:$h(Object.keys(r).map(c=>[c,r[c]]))}}const ZKe={name:"element-symbol",label:"Element Symbol",category:ni.Atom,factory:z6,getParams:function YKe(e){return C.clone(V6)},defaultValues:C.getDefaultValues(V6),isApplicable:e=>!!e.structure},Cse={water:3697840,ion:15729279,protein:12496596,RNA:16629894,DNA:12540695,PNA:4367514,saccharide:8374655},G6=st(16777113),KD={saturation:C.Numeric(0,{min:-6,max:6,step:.1}),lightness:C.Numeric(0,{min:-6,max:6,step:.1}),colors:C.MappedStatic("default",{default:C.EmptyGroup(),custom:C.Group(YD(Cse))})};function wse(e,t,n){switch(jB(t,n)){case 2:return e.water;case 3:return e.ion;case 5:return e.protein;case 6:return e.RNA;case 7:return e.DNA;case 8:return e.PNA;case 9:return e.saccharide}return G6}function ZD(e,t){const n=KI("default"===t.colors.name?Cse:t.colors.params,t.saturation,t.lightness);return{factory:ZD,granularity:"group",color:function r(i){return nt.is(i)?wse(n,i.unit,i.element):Lt.isLocation(i)?wse(n,i.aUnit,i.aUnit.elements[i.aIndex]):G6},props:t,description:"Assigns a color based on the molecule type of a residue.",legend:$h(Object.keys(n).map(i=>[i,n[i]]).concat([["Other/unknown",G6]]))}}const eZe={name:"molecule-type",label:"Molecule Type",category:ni.Residue,factory:ZD,getParams:function JKe(e){return KD},defaultValues:C.getDefaultValues(KD),isApplicable:e=>!!e.structure},j6="dark-2",Ase=st(16448250),Ise={...Ia({type:"colors",colorList:j6})};function Tse(e){switch(e.kind){case 0:return Ze.chain.label_asym_id;case 1:case 2:return Ze.coarse.asym_id}}function Dse(e){const t=new Map;for(let n=0,r=e.unitSymmetryGroups.length;ns[u]});r=c.legend,n=u=>{let l;if(nt.is(u)){const d=Tse(u.unit);l=o.get(d(u))}else if(Lt.isLocation(u)){const d=Tse(u.aUnit);i.unit=u.aUnit,i.element=u.aUnit.elements[u.aIndex],l=o.get(d(i))}return void 0===l?Ase:c.color(l)}}else n=()=>Ase;return{factory:Ese,granularity:"group",color:n,props:t,description:"Gives every polymer chain a color based on its `asym_id` value.",legend:r}},getParams:function nZe(e){const t=C.clone(Ise);return e.structure&&Dse(e.structure.root).size>Pc[j6].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params={...t.palette.defaultValue.params,list:{kind:"interpolate",colors:cp(j6).list}}),t},defaultValues:C.getDefaultValues(Ise),isApplicable:e=>!!e.structure},H6="dark-2",Pse=st(13421772),Mse={...Ia({type:"colors",colorList:H6})};function Rse(e){let t=0;const{units:n}=e;for(let r=0,i=n.length;r0&&++t;return t}const sZe={name:"polymer-index",label:"Polymer Chain Instance",category:ni.Chain,factory:function kse(e,t){let n,r;if(e.structure){const i=ac(Rse(e.structure.root),t);r=i.legend;const{units:o}=e.structure.root,s=new Map;for(let a=0,c=0,u=o.length;a0&&(s.set(o[a].id,i.color(c)),++c);n=a=>{let c;return nt.is(a)?c=s.get(a.unit.id):Lt.isLocation(a)&&(c=s.get(a.aUnit.id)),void 0!==c?c:Pse}}else n=()=>Pse;return{factory:kse,granularity:"instance",color:n,props:t,description:"Gives every polymer chain instance a unique color based on the position (index) of the polymer in the list of polymers in the structure.",legend:r}},getParams:function oZe(e){const t=C.clone(Mse);return e.structure&&Rse(e.structure.root)>Pc[H6].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params={...t.palette.defaultValue.params,list:{kind:"interpolate",colors:cp(H6).list}}),t},defaultValues:C.getDefaultValues(Mse),isApplicable:e=>!!e.structure},Nse={ALA:9240460,ARG:124,ASN:16743536,ASP:10485826,CYS:16777072,GLN:16731212,GLU:6684672,GLY:15658734,HIS:7368959,ILE:19456,LEU:4546117,LYS:4671416,MET:12099650,PHE:5459026,PRO:5395026,SER:16740418,THR:12078080,TRP:5195264,TYR:9203788,VAL:16747775,A:14423100,G:3329330,I:10145074,C:16766720,T:4286945,U:4251856,DA:14423100,DG:3329330,DI:10145074,DC:16766720,DT:4286945,DU:4251856,APN:14423100,GPN:3329330,CPN:16766720,TPN:4286945},q6=st(16711935),W6={saturation:C.Numeric(0,{min:-6,max:6,step:.1}),lightness:C.Numeric(1,{min:-6,max:6,step:.1}),colors:C.MappedStatic("default",{default:C.EmptyGroup(),custom:C.Group(YD(Nse))})};function Fse(e,t){return e.model.atomicHierarchy.atoms.label_comp_id.value(t)}function Bse(e,t){const n=e.coarseElements.seq_id_begin.value(t);if(n===e.coarseElements.seq_id_end.value(t))return e.model.sequence.byEntityKey[e.coarseElements.entityKey[t]].sequence.compId.value(n-1)}function QD(e,t){const n=e[t];return void 0===n?q6:n}function $6(e,t){const n=KI("default"===t.colors.name?Nse:t.colors.params,t.saturation,t.lightness);return{factory:$6,granularity:"group",preferSmoothing:!0,color:function r(i){if(nt.is(i)){if(Ee.isAtomic(i.unit)){const o=Fse(i.unit,i.element);return QD(n,o)}{const o=Bse(i.unit,i.element);if(o)return QD(n,o)}}else if(Lt.isLocation(i)){if(Ee.isAtomic(i.aUnit)){const o=Fse(i.aUnit,i.aUnit.elements[i.aIndex]);return QD(n,o)}{const o=Bse(i.aUnit,i.aUnit.elements[i.aIndex]);if(o)return QD(n,o)}}return q6},props:t,description:"Assigns a color to every residue according to its name.",legend:$h(Object.keys(n).map(i=>[i,n[i]]).concat([["Unknown",q6]]))}}const uZe={name:"residue-name",label:"Residue Name",category:ni.Residue,factory:$6,getParams:function cZe(e){return W6},defaultValues:C.getDefaultValues(W6),isApplicable:e=>!!e.structure},Ose={alphaHelix:16711808,threeTenHelix:10485888,piHelix:6291584,betaTurn:6324479,betaStrand:16762880,coil:16777215,bend:6740169,turn:45670,dna:11403518,rna:16580962,carbohydrate:10921722},Y6=st(8421504),X6={saturation:C.Numeric(-1,{min:-6,max:6,step:.1}),lightness:C.Numeric(0,{min:-6,max:6,step:.1}),colors:C.MappedStatic("default",{default:C.EmptyGroup(),custom:C.Group(YD(Ose))})};function Lse(e,t,n,r){let i=cr.create(0);if(r&&Ee.isAtomic(t)){const o=r.get(t.invariantId);o&&(i=o.type[o.getIndex(t.residueIndex[n])])}if(cr.is(i,2))return cr.is(i,2048)?e.threeTenHelix:cr.is(i,32768)?e.piHelix:e.alphaHelix;if(cr.is(i,4))return e.betaStrand;if(cr.is(i,8))return e.bend;if(cr.is(i,16))return e.turn;{const o=jB(t,n);if(7===o)return e.dna;if(6===o)return e.rna;if(9===o)return e.carbohydrate;if(5===o)return e.coil}return Y6}function K6(e,t){const n=e.structure&&Xu.get(e.structure),r=n?Pg(n.id,n.version):-1,i=KI("default"===t.colors.name?Ose:t.colors.params,t.saturation,t.lightness);return{factory:K6,granularity:"group",preferSmoothing:!0,color:function o(s){return nt.is(s)?Lse(i,s.unit,s.element,n?.value):Lt.isLocation(s)?Lse(i,s.aUnit,s.aUnit.elements[s.aIndex],n?.value):Y6},props:t,contextHash:r,description:"Assigns a color based on the type of secondary structure and basic molecule type.",legend:$h(Object.keys(i).map(s=>[s,i[s]]).concat([["Other",Y6]]))}}const fZe={name:"secondary-structure",label:"Secondary Structure",category:ni.Residue,factory:K6,getParams:function dZe(e){return X6},defaultValues:C.getDefaultValues(X6),isApplicable:e=>!!e.structure,ensureCustomProperties:{attach:(e,t)=>t.structure?Xu.attach(e,t.structure,void 0,!0):Promise.resolve(),detach:e=>e.structure&&Xu.ref(e.structure,!1)}},pZe=st(13421772),Use={list:C.ColorList("turbo",{presetKind:"scale"})};function Vse(e,t){const{model:n}=e;switch(e.kind){case 0:return n.atomicHierarchy.residues.label_seq_id.value(n.atomicHierarchy.residueAtomSegments.index[t]);case 1:return Math.round((n.coarseHierarchy.spheres.seq_id_begin.value(t)+n.coarseHierarchy.spheres.seq_id_end.value(t))/2);case 2:return Math.round((n.coarseHierarchy.gaussians.seq_id_begin.value(t)+n.coarseHierarchy.gaussians.seq_id_end.value(t))/2)}}function zse(e,t){const{model:n}=e;let r="";switch(e.kind){case 0:r=n.atomicHierarchy.chains.label_entity_id.value(n.atomicHierarchy.chainAtomSegments.index[t]);break;case 1:r=n.coarseHierarchy.spheres.entity_id.value(t);break;case 2:r=n.coarseHierarchy.gaussians.entity_id.value(t)}if(""===r)return 0;const i=n.entities.getEntityIndex(r);if(-1===i)return 0;const o=n.sequence.byEntityKey[i];return void 0===o?0:o.sequence.length}const gZe={name:"sequence-id",label:"Sequence Id",category:ni.Residue,factory:function Gse(e,t){const n=Gu.create({listOrName:t.list.colors,minLabel:"Start",maxLabel:"End"});return{factory:Gse,granularity:"group",preferSmoothing:!0,color:i=>{if(nt.is(i)){const{unit:o,element:s}=i,a=Vse(o,s);if(a>0){const c=zse(o,s);if(c)return n.setDomain(0,c-1),n.color(a)}}else if(Lt.isLocation(i)){const{aUnit:o,aIndex:s}=i,a=Vse(o,o.elements[s]);if(a>0){const c=zse(o,o.elements[s]);if(c)return n.setDomain(0,c-1),n.color(a)}}return pZe},props:t,description:"Gives every polymer residue a color based on its `seq_id` value.",legend:n?n.legend:void 0}},getParams:function mZe(e){return Use},defaultValues:C.getDefaultValues(Use),isApplicable:e=>!!e.structure},yZe=st(16777113),jse={domain:C.Interval([0,100]),list:C.ColorList("red-white-blue",{presetKind:"scale"})};function Hse(e,t){return Ee.isAtomic(e)?e.model.atomicConformation.B_iso_or_equiv.value(t):Ee.isSpheres(e)?e.model.coarseConformation.spheres.rmsf[t]:0}const _Ze={name:"uncertainty",label:"Uncertainty/Disorder",category:ni.Atom,factory:function qse(e,t){const n=Gu.create({reverse:!0,domain:t.domain,listOrName:t.list.colors});return{factory:qse,granularity:"group",preferSmoothing:!0,color:function r(i){return nt.is(i)?n.color(Hse(i.unit,i.element)):Lt.isLocation(i)?n.color(Hse(i.aUnit,i.aUnit.elements[i.aIndex])):yZe},props:t,description:"Assigns a color based on the uncertainty or disorder of an element's position, e.g. B-factor or RMSF, depending on the data availability and experimental technique.",legend:n?n.legend:void 0}},getParams:function vZe(e){return jse},defaultValues:C.getDefaultValues(jse),isApplicable:e=>!!e.structure&&e.structure.models.some(t=>t.atomicConformation.B_iso_or_equiv.isDefined||t.coarseHierarchy.isDefined)},xZe=st(15658734),Wse={style:C.MappedStatic("entity-id",{uniform:C.Group(bv),"chain-id":C.Group(ES),"entity-id":C.Group(RS),"entity-source":C.Group(FS),"molecule-type":C.Group(KD),"model-index":C.Group(OS),"structure-index":C.Group(US)}),carbonLightness:C.Numeric(.8,{min:-6,max:6,step:.1})},AZe={name:"illustrative",label:"Illustrative",category:ni.Misc,factory:function $se(e,t){const{color:n,legend:r}=function wZe(e,t){switch(t.name){case"uniform":return f0(0,t.params);case"chain-id":return PS(e,t.params);case"entity-id":return NS(e,t.params);case"entity-source":return BS(e,t.params);case"molecule-type":return ZD(0,t.params);case"model-index":return LS(e,t.params);case"structure-index":return VS(e,t.params);default:Rr()}}(e,t.style);function i(s,a){const c=n(s,!1);return"C"===a?st.lighten(c,t.carbonLightness):c}return{factory:$se,granularity:"group",preferSmoothing:!0,color:function o(s){if(nt.is(s)&&Ee.isAtomic(s.unit)){const a=s.unit.model.atomicHierarchy.atoms.type_symbol.value(s.element);return i(s,a)}if(Lt.isLocation(s)&&Ee.isAtomic(s.aUnit)){const c=s.aUnit.model.atomicHierarchy.atoms.type_symbol.value(s.aUnit.elements[s.aIndex]);return i(s,c)}return xZe},props:t,description:"Assigns an illustrative color that gives every chain a color based on the chosen style but with lighter carbons (inspired by David Goodsell's Molecule of the Month style).",legend:r}},getParams:function CZe(e){return C.clone(Wse)},defaultValues:C.getDefaultValues(Wse),isApplicable:e=>!!e.structure},Yse={list:C.ColorList("red-yellow-green",{presetKind:"scale"}),scale:C.Select("DGwif",[["DGwif","DG water-membrane"],["DGwoct","DG water-octanol"],["Oct-IF","DG difference"]])},DZe={DGwif:0,DGwoct:1,"Oct-IF":2};function Xse(e,t){return e.model.atomicHierarchy.atoms.label_comp_id.value(t)}function Kse(e,t){const n=e.coarseElements.seq_id_begin.value(t);if(n===e.coarseElements.seq_id_end.value(t))return e.model.sequence.byEntityKey[e.coarseElements.entityKey[t]].sequence.compId.value(n-1)}const PZe={name:"hydrophobicity",label:"Hydrophobicity",category:ni.Residue,factory:function Zse(e,t){const n=DZe[t.scale];let r=1/0,i=-1/0;for(const a in PB){const c=PB[a][n];r=Math.min(r,c),i=Math.max(i,c)}const o=Gu.create({listOrName:t.list.colors,domain:[i,r],minLabel:"Hydrophilic",maxLabel:"Hydrophobic"});return{factory:Zse,granularity:"group",preferSmoothing:!0,color:function s(a){let c;return nt.is(a)?c=Ee.isAtomic(a.unit)?Xse(a.unit,a.element):Kse(a.unit,a.element):Lt.isLocation(a)&&(c=Ee.isAtomic(a.aUnit)?Xse(a.aUnit,a.aUnit.elements[a.aIndex]):Kse(a.aUnit,a.aUnit.elements[a.aIndex])),o.color(c?function EZe(e,t){const n=PB[e];return void 0===n?0:n[t]}(c,n):0)},props:t,description:'Assigns a color to every amino acid according to the "Experimentally determined hydrophobicity scale for proteins at membrane interfaces" by Wimely and White (doi:10.1038/nsb1096-842).',legend:o?o.legend:void 0}},getParams:function TZe(e){return Yse},defaultValues:C.getDefaultValues(Yse),isApplicable:e=>!!e.structure},Qse=st(13421772),Jse={...Ia({type:"colors",colorList:"purples"})},kZe={name:"trajectory-index",label:"Trajectory Index",category:ni.Chain,factory:function eae(e,t){var n,r;let i,o;if(e.structure){const{models:s}=e.structure.root;let a=0;for(const l of s)a=Math.max(a,(null===(n=sn.TrajectoryInfo.get(l))||void 0===n?void 0:n.size)||0);const c=ac(a,t);o=c.legend;const u=new Map;for(let l=0,d=s.length;lnt.is(l)?u.get(sn.TrajectoryInfo.get(l.unit.model).index):Lt.isLocation(l)?u.get(sn.TrajectoryInfo.get(l.aUnit.model).index):Qse}else i=()=>Qse;return{factory:eae,granularity:"instance",color:i,props:t,description:"Gives every model (frame) a unique color based on the index in its trajectory.",legend:o}},getParams:function RZe(e){return C.clone(Jse)},defaultValues:C.getDefaultValues(Jse),isApplicable:e=>!!e.structure&&e.structure.elementCount>0&&sn.TrajectoryInfo.get(e.structure.models[0]).size>1},NZe=st(13421772),tae={domain:C.Interval([0,1]),list:C.ColorList("purples",{presetKind:"scale"})};function nae(e,t){return Ee.isAtomic(e)?e.model.atomicConformation.occupancy.value(t):0}const OZe={name:"occupancy",label:"Occupancy",category:ni.Atom,factory:function rae(e,t){const n=Gu.create({reverse:!1,domain:t.domain,listOrName:t.list.colors});return{factory:rae,granularity:"group",preferSmoothing:!0,color:function r(i){return nt.is(i)?n.color(nae(i.unit,i.element)):Lt.isLocation(i)?n.color(nae(i.aUnit,i.aUnit.elements[i.aIndex])):NZe},props:t,description:"Assigns a color based on the occupancy of an atom.",legend:n?n.legend:void 0}},getParams:function BZe(e){return tae},defaultValues:C.getDefaultValues(tae),isApplicable:e=>!!e.structure&&e.structure.models.some(t=>t.atomicConformation.occupancy.isDefined)},Z6="dark-2",iae=st(13421772),oae={...Ia({type:"colors",colorList:Z6})},zS=1e4;function Q6(e){return e.map(t=>`${t+zS}`.padStart(5,"0")).join("")}function J6(e){const t=function zFe(e,t){return Math.abs(e)t+5).join("")}function sae(e){const t=new Map,n=new Set;for(let s=0,a=e.units.length;st.set(s,t.size)),{min:J6(r[0]),max:J6(r[r.length-1]),map:t}}const VZe={name:"operator-hkl",label:"Operator HKL",category:ni.Symmetry,factory:function aae(e,t){let n,r;if(e.structure){const{min:i,max:o,map:s}=sae(e.structure.root),a=[];s.forEach((l,d)=>{const f=l%s.size,p=e8(J6(d));void 0===a[f]?a[f]=p:a[f]+=`, ${p}`});const c={minLabel:e8(i),maxLabel:e8(o),valueLabel:l=>a[l]},u=ac(s.size,t,c);r=u.legend,n=l=>{let d;if(nt.is(l)){const f=Q6(l.unit.conformation.operator.hkl);d=s.get(f)}else if(Lt.isLocation(l)){const f=Q6(l.aUnit.conformation.operator.hkl);d=s.get(f)}return void 0===d?iae:u.color(d)}}else n=()=>iae;return{factory:aae,granularity:"instance",color:n,props:t,description:"Assigns a color based on the operator HKL value of a transformed chain.",legend:r}},getParams:function UZe(e){const t=C.clone(oae);return e.structure&&sae(e.structure.root).map.size>Pc[Z6].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params={...t.palette.defaultValue.params,list:{kind:"interpolate",colors:cp(Z6).list}}),t},defaultValues:C.getDefaultValues(oae),isApplicable:e=>!!e.structure},t8=st(16777113),cae={domain:C.Interval([-1,1]),list:C.ColorList("red-white-blue",{presetKind:"scale"})};function uae(e,t){var n;return null===(n=Mv.Provider.get(e.model))||void 0===n?void 0:n.data.value(t)}const jZe={name:"partial-charge",label:"Partial Charge",category:ni.Atom,factory:function lae(e,t){const n=Gu.create({domain:t.domain,listOrName:t.list.colors});return{factory:lae,granularity:"group",preferSmoothing:!0,color:function r(i){if(nt.is(i)){const o=uae(i.unit,i.element);return void 0!==o?n.color(o):t8}if(Lt.isLocation(i)){const o=uae(i.aUnit,i.aUnit.elements[i.aIndex]);return void 0!==o?n.color(o):t8}return t8},props:t,description:"Assigns a color based on the partial charge of an atom.",legend:n?n.legend:void 0}},getParams:function GZe(e){return cae},defaultValues:C.getDefaultValues(cae),isApplicable:e=>!!e.structure&&e.structure.models.some(t=>void 0!==Mv.Provider.get(t))},dae=st(16448250),fae={...Ia({type:"colors",colorList:"many-distinct"})},YZe={name:"atom-id",label:"Atom Id",category:ni.Atom,factory:function pae(e,t){let n,r;if(e.structure){const i=nt.create(e.structure.root),o=function $Ze(e){const t=new Map;for(const n of e.models){const{label_atom_id:r}=n.atomicHierarchy.atoms;for(let i=0,o=r.rowCount;is[u]});r=c.legend,n=u=>{let l;if(nt.is(u)){const d=Ze.atom.label_atom_id(u);l=o.get(d)}else if(Lt.isLocation(u)){i.unit=u.aUnit,i.element=u.aUnit.elements[u.aIndex];const d=Ze.atom.label_atom_id(i);l=o.get(d)}return void 0===l?dae:c.color(l)}}else n=()=>dae;return{factory:pae,granularity:"group",preferSmoothing:!0,color:n,props:t,description:"Gives every atom a color based on its `label_atom_id` value.",legend:r}},getParams:function WZe(e){return C.clone(fae)},defaultValues:C.getDefaultValues(fae),isApplicable:e=>!!e.structure},hae={colorList:C.ColorList({kind:"interpolate",colors:[[xn.white,0],[xn.red,.25],[xn.white,.5],[xn.blue,.75],[xn.white,1]]},{offsets:!0,isEssential:!0})},ZZe={name:"volume-value",label:"Volume Value",category:ni.Misc,factory:function mae(e,t){const n=Gu.create({domain:[0,1],listOrName:t.colorList.colors}),r=[];for(let o=0;o<256;++o)r[o]=n.color(o/255);return{factory:mae,granularity:"direct",props:t,description:"Assign color based on the given value of a volume cell.",legend:n.legend,palette:{colors:r,filter:"linear"}}},getParams:function KZe(e){return hae},defaultValues:C.getDefaultValues(hae),isApplicable:e=>!!e.volume&&!et.Segmentation.get(e.volume)},gae=st(13421772),yae={...Ia({type:"colors",colorList:"many-distinct"})},eQe={name:"volume-segment",label:"Volume Segment",category:ni.Misc,factory:function bae(e,t){let n,r;const i=e.volume&&et.Segmentation.get(e.volume);if(i){const o=i.segments.size,s=Array.from(i.segments.keys()),a=ac(o,t);r=a.legend,n=c=>et.Segment.isLocation(c)?a.color(s.indexOf(c.segment)):gae}else n=()=>gae;return{factory:bae,granularity:"instance",color:n,props:t,description:"Gives every volume segment a unique color.",legend:r}},getParams:function JZe(e){return C.clone(yae)},defaultValues:C.getDefaultValues(yae),isApplicable:e=>!!e.volume&&!!et.Segmentation.get(e.volume)},vae={volume:C.ValueRef(e=>e.state.data.selectQ(n=>n.root.subtree().filter(r=>{var i;return et.is(null===(i=r.obj)||void 0===i?void 0:i.data)})).map(n=>{var r,i;return[n.transform.ref,null!==(i=null===(r=n.obj)||void 0===r?void 0:r.label)&&void 0!==i?i:""]}),(e,t)=>t(e)),coloring:C.MappedStatic("absolute-value",{"absolute-value":C.Group({domain:C.MappedStatic("auto",{custom:C.Interval([-1,1]),auto:C.Group({symmetric:C.Boolean(!1,{description:"If true the automatic range is determined as [-|max|, |max|]."})})}),list:C.ColorList("red-white-blue",{presetKind:"scale"})}),"relative-value":C.Group({domain:C.MappedStatic("auto",{custom:C.Interval([-1,1]),auto:C.Group({symmetric:C.Boolean(!1,{description:"If true the automatic range is determined as [-|max|, |max|]."})})}),list:C.ColorList("red-white-blue",{presetKind:"scale"})})}),defaultColor:C.Color(st(13421772))},nQe={name:"external-volume",label:"External Volume",category:ni.Misc,factory:function _ae(e,t){let n,r;try{n=t.volume.getValue()}catch{}if(n){const i=t.coloring.params,{stats:o}=n.grid,s="custom"===i.domain.name?i.domain.params:[o.min,o.max],a="relative-value"===t.coloring.name;if("auto"===i.domain.name&&a&&(s[0]=(s[0]-o.mean)/o.sigma,s[1]=(s[1]-o.mean)/o.sigma),"auto"===t.coloring.params.domain.name&&t.coloring.params.domain.params.symmetric){const y=Math.max(Math.abs(s[0]),Math.abs(s[1]));s[0]=-y,s[1]=y}const c=Gu.create({domain:s,listOrName:i.list.colors}),u=Ko.getGridToCartesianTransform(n.grid);le.invert(u,u);const l=v(),{dimensions:d,get:f}=n.grid.cells.space,p=n.grid.cells.data,[m,h,g]=d;r=y=>{if(!function o7e(e){return!!e&&"position-location"===e.kind}(y))return t.defaultColor;v.copy(l,y.position),v.transformMat4(l,l,u);const b=Math.floor(l[0]),x=Math.floor(l[1]),_=Math.floor(l[2]);if(b<0||b>=m||x<0||x>=h||_<0||_>=g)return t.defaultColor;const S=l[0]-b,A=l[1]-x,E=l[2]-_,w=Math.min(b+1,m-1),D=Math.min(x+1,h-1),I=Math.min(_+1,g-1);let R=f(p,b,x,_),T=f(p,w,x,_),M=f(p,b,D,_),N=f(p,w,D,_);const V=ci(ci(R,T,S),ci(M,N,S),A);R=f(p,b,x,I),T=f(p,w,x,I),M=f(p,b,D,I),N=f(p,w,D,I);const F=ci(ci(R,T,S),ci(M,N,S),A);let G=ci(V,F,E);return a&&(G=(G-o.mean)/o.sigma),c.color(G)}}else r=()=>t.defaultColor;return{factory:_ae,granularity:"vertex",preferSmoothing:!0,color:r,props:t,description:"Assigns a color based volume value at a given vertex."}},getParams:()=>vae,defaultValues:C.getDefaultValues(vae),isApplicable:e=>!0},xae={mainchain:C.MappedStatic("molecule-type",{uniform:C.Group(bv),"chain-id":C.Group(ES),"entity-id":C.Group(RS),"entity-source":C.Group(FS),"molecule-type":C.Group(KD),"model-index":C.Group(OS),"structure-index":C.Group(US),"secondary-structure":C.Group(X6)}),sidechain:C.MappedStatic("residue-name",{uniform:C.Group(bv),"residue-name":C.Group(W6),"element-symbol":C.Group(V6)})},aQe={name:"cartoon",label:"Cartoon",category:ni.Misc,factory:function Sae(e,t){var n,r;const i=function oQe(e,t){switch(t.name){case"uniform":return f0(0,t.params);case"chain-id":return PS(e,t.params);case"entity-id":return NS(e,t.params);case"entity-source":return BS(e,t.params);case"molecule-type":return ZD(0,t.params);case"model-index":return LS(e,t.params);case"structure-index":return VS(e,t.params);case"secondary-structure":return K6(e,t.params);default:Rr()}}(e,t.mainchain),o=function sQe(e,t){switch(t.name){case"uniform":return f0(0,t.params);case"residue-name":return $6(0,t.params);case"element-symbol":return z6(e,t.params);default:Rr()}}(e,t.sidechain);let a=i.legend;return"table-legend"===(null===(n=i.legend)||void 0===n?void 0:n.kind)&&"table-legend"===(null===(r=o.legend)||void 0===r?void 0:r.kind)&&(a={kind:"table-legend",table:[...i.legend.table,...o.legend.table]}),{factory:Sae,granularity:"group",preferSmoothing:!1,color:function s(c,u){return u?i.color(c,!1):o.color(c,!1)},props:t,description:"Uses separate themes for coloring mainchain and sidechain visuals.",legend:a}},getParams:function iQe(e){return C.clone(xae)},defaultValues:C.getDefaultValues(xae),isApplicable:e=>!!e.structure};var Lc;!function(e){e.Category=ni,e.PaletteScale=16777215,e.EmptyFactory=()=>e.Empty;const t=st(13421772);e.Empty={factory:e.EmptyFactory,granularity:"uniform",color:()=>t,props:{}},e.areEqual=function n(i,o){return i.contextHash===o.contextHash&&i.factory===o.factory&&Yd(i.props,o.props)},e.EmptyProvider={name:"",label:"",category:"",factory:e.EmptyFactory,getParams:()=>({}),defaultValues:{},isApplicable:()=>!0},e.createRegistry=function r(){return new Eae(e.BuiltIn,e.EmptyProvider)},e.BuiltIn={"atom-id":YZe,"carbohydrate-symbol":dKe,cartoon:aQe,"chain-id":use,"element-index":CKe,"element-symbol":ZKe,"entity-id":RKe,"entity-source":OKe,hydrophobicity:PZe,illustrative:AZe,"model-index":VKe,"molecule-type":eZe,occupancy:OZe,"operator-hkl":VZe,"operator-name":N6,"partial-charge":jZe,"polymer-id":rZe,"polymer-index":sZe,"residue-name":uZe,"secondary-structure":fZe,"sequence-id":gZe,"shape-group":pqe,"structure-index":jKe,"trajectory-index":kZe,uncertainty:_Ze,"unit-index":WKe,uniform:Oje,"volume-segment":eQe,"volume-value":ZZe,"external-volume":nQe}}(Lc||(Lc={}));const Cae={scale:C.Numeric(1,{min:.1,max:5,step:.1})};function n8(e,t){return Ee.isAtomic(e)?v2(e.model.atomicHierarchy.atoms.type_symbol.value(t)):Ee.isSpheres(e)?e.model.coarseConformation.spheres.radius[t]:0}const dQe={name:"physical",label:"Physical",category:"",factory:function wae(e,t){const n=void 0===t.scale?1:t.scale;return{factory:wae,granularity:"group",size:function r(i){let o;return o=nt.is(i)?n*n8(i.unit,i.element):Lt.isLocation(i)?n*Math.min(n8(i.aUnit,i.aUnit.elements[i.aIndex]),n8(i.bUnit,i.bUnit.elements[i.bIndex])):1*n,o},props:t,description:"Assigns a physical size, i.e. vdW radius for atoms or given radius for coarse spheres."}},getParams:function lQe(e){return Cae},defaultValues:C.getDefaultValues(Cae),isApplicable:e=>!!e.structure},Aae={bfactorFactor:C.Numeric(.1,{min:0,max:1,step:.01}),rmsfFactor:C.Numeric(.05,{min:0,max:1,step:.01}),baseSize:C.Numeric(.2,{min:0,max:2,step:.1})};function Iae(e,t,n){return Ee.isAtomic(e)?e.model.atomicConformation.B_iso_or_equiv.value(t)*n.bfactorFactor:Ee.isSpheres(e)?e.model.coarseConformation.spheres.rmsf[t]*n.rmsfFactor:0}const hQe={name:"uncertainty",label:"Uncertainty/Disorder",category:"",factory:function Tae(e,t){return{factory:Tae,granularity:"group",size:function n(r){let i=t.baseSize;return nt.is(r)?i+=Iae(r.unit,r.element,t):Lt.isLocation(r)&&(i+=Iae(r.aUnit,r.aUnit.elements[r.aIndex],t)),i},props:t,description:"Assigns a size reflecting the uncertainty or disorder of an element's position, e.g. B-factor or RMSF, depending on the data availability and experimental technique."}},getParams:function pQe(e){return Aae},defaultValues:C.getDefaultValues(Aae),isApplicable:e=>!!e.structure&&e.structure.models.some(t=>t.atomicConformation.B_iso_or_equiv.isDefined||t.coarseHierarchy.isDefined)};var Qo,Fo;function Dae(e){return e.map(t=>[t.name,t.provider.label,t.provider.category])}!function(e){e.EmptyFactory=()=>e.Empty,e.Empty={factory:e.EmptyFactory,granularity:"uniform",size:()=>1,props:{}},e.areEqual=function t(r,i){return r.contextHash===i.contextHash&&r.factory===i.factory&&Yd(r.props,i.props)},e.EmptyProvider={name:"",label:"",category:"",factory:e.EmptyFactory,getParams:()=>({}),defaultValues:{},isApplicable:()=>!0},e.createRegistry=function n(){return new Eae(e.BuiltIn,e.EmptyProvider)},e.BuiltIn={physical:dQe,"shape-group":uqe,uncertainty:hQe,uniform:Vje}}(Qo||(Qo={})),function(e){function n(){return{color:Lc.Empty,size:Qo.Empty}}function i(){return(i=ie(function*(s,a,c,u){var l,d;yield null===(l=a.colorThemeRegistry.get(u.colorTheme.name).ensureCustomProperties)||void 0===l?void 0:l.attach(s,c),yield null===(d=a.sizeThemeRegistry.get(u.sizeTheme.name).ensureCustomProperties)||void 0===d?void 0:d.attach(s,c)})).apply(this,arguments)}e.create=function t(s,a,c,u){u=u||n();const l=c.colorTheme,d=c.sizeTheme;return u.color=s.colorThemeRegistry.create(l.name,a,l.params),u.size=s.sizeThemeRegistry.create(d.name,a,d.params),u},e.createEmpty=n,e.ensureDependencies=function r(s,a,c,u){return i.apply(this,arguments)},e.releaseDependencies=function o(s,a,c){var u,l;null===(u=s.colorThemeRegistry.get(c.colorTheme.name).ensureCustomProperties)||void 0===u||u.detach(a),null===(l=s.sizeThemeRegistry.get(c.sizeTheme.name).ensureCustomProperties)||void 0===l||l.detach(a)}}(Fo||(Fo={}));class Eae{get default(){return this._list[0]}get list(){return this._list}get types(){return Dae(this._list)}constructor(t,n){this.emptyProvider=n,this._list=[],this._map=new Map,this._name=new Map,$a(t,(r,i)=>{if(r.name!==i)throw new Error(`Fix build in themes to have matching names. ${r.name} ${i}`);this.add(r)})}sort(){this._list.sort((t,n)=>t.provider.category===n.provider.category?t.provider.labeln.provider.label?1:0:t.provider.categoryr.name===t.name),1);const n=this._map.get(t.name);n&&(this._map.delete(t.name),this._name.delete(n))}has(t){return this._map.has(t.name)}get(t){return this._map.get(t)||this.emptyProvider}getName(t){if(!this._name.has(t))throw new Error(`'${t.label}' is not a registered theme provider.`);return this._name.get(t)}create(t,n,r={}){const i=this.get(t);return i.factory(n,{...C.getDefaultValues(i.getParams(n)),...r})}getApplicableList(t){return this._list.filter(n=>n.provider.isApplicable(t))}getApplicableTypes(t){return Dae(this.getApplicableList(t))}clear(){this._list.length=0,this._map.clear(),this._name.clear()}}var Us,Bt=function(e){return e[e.None=0]="None",e[e.Highlight=1]="Highlight",e[e.RemoveHighlight=2]="RemoveHighlight",e[e.Select=4]="Select",e[e.Deselect=8]="Deselect",e[e.Toggle=16]="Toggle",e[e.Clear=32]="Clear",e}(Bt||{});function r8(e,t,n){switch(n){case Bt.Highlight:e[t]|=1;break;case Bt.RemoveHighlight:e[t]&=-2;break;case Bt.Select:e[t]|=2;break;case Bt.Deselect:e[t]&=-3;break;case Bt.Toggle:e[t]^=2;break;case Bt.Clear:e[t]=0}}function i8(e,t,n){if(n===Bt.None)return!1;if(Ce.is(t)){const r=Ce.start(t),i=Ce.end(t),o=r+3>>2,s=o+(i-4*o>>2);if(s<=o){for(let f=r;f>2),c=r,u=Math.min(4*o,i),l=Math.max(r,4*s),d=i;switch(n){case Bt.Highlight:for(let f=o;fa(y)).filter(y=>!!y);t.reset();for(const y of g)t.includePositionRadius(y.center,y.radius);t.finishedIncludeStep();for(const y of g)t.radiusPositionRadius(y.center,y.radius);return t.getSphere()},e.areEqual=function r(h,g){return!!(Uc(h)&&Uc(g)||Ta(h)&&Ta(g))||(GS(h)&&GS(g)?function bQe(e,t){if(!Hx(e.data,t.data)||e.tag!==t.tag||e.elements.length!==t.elements.length)return!1;for(let n=0,r=e.elements.length;nh,residue:h=>De.is(h)?De.extendToWholeResidues(h,!0):h,chain:h=>De.is(h)?De.extendToWholeChains(h):h,entity:h=>De.is(h)?De.extendToWholeEntities(h):h,model:h=>De.is(h)?De.extendToWholeModels(h):h,operator:h=>De.is(h)?De.extendToWholeOperators(h):h,structure:h=>De.is(h)?Ve.toStructureElementLoci(h.structure):ra.isLoci(h)?qn.Loci(h.shape):et.Cell.isLoci(h)?et.Loci(h.volume):h,elementInstances:h=>De.is(h)?De.extendToAllInstances(h):h,residueInstances:h=>De.is(h)?De.extendToAllInstances(De.extendToWholeResidues(h,!0)):h,chainInstances:h=>De.is(h)?De.extendToAllInstances(De.extendToWholeChains(h)):h};function p(h,g){return d[g](h)}e.GranularityOptions=C.objectToOptions(d,h=>{switch(h){case"element":return"Atom/Coarse Element";case"elementInstances":return["Atom/Coarse Element Instances","With Symmetry"];case"structure":return"Structure/Shape";default:return h.indexOf("Instances")?[zu(h),"With Symmetry"]:zu(h)}}),e.simpleGranularity=function f(h){return h.replace("Instances","")},e.applyGranularity=p,e.normalize=function m(h,g,y=!1){return("element"!==g||y)&&Lt.isLoci(h)&&(h=Lt.toStructureElementLoci(h)),Ve.isLoci(h)&&(h=Ve.toStructureElementLoci(h.structure)),De.is(h)&&(h=De.remap(h,h.structure.root)),g&&(h=p(h,g)),h}}(pn||(pn={})),function(e){function n(u){return 0===u.layers.length}e.Empty={kind:"empty-loci",layers:[]},e.areEqual=function t(u,l){if(0===u.layers.length&&0===l.layers.length)return!0;if(u.layers.length!==l.layers.length)return!1;for(let d=0,f=u.layers.length;d{const g=-1===h,y=g?st(0):h;p.push({loci:m,color:y,clear:g})}),{kind:"element-loci",layers:p}}return u},e.filter=function o(u,l){if(n(u))return u;if("element-loci"===u.kind){const{structure:d}=u.layers[0].loci,f=[];for(const p of u.layers){let{loci:m,color:h,clear:g}=p;const y=De.remap(m,l);m=De.remap(y,d),De.isEmpty(m)||f.push({loci:m,color:h,clear:g})}return{kind:"element-loci",layers:f}}return u},e.ofScript=function s(u,l){const d=[];for(let f=0,p=u.length;f{p.push({loci:m,value:h})}),{kind:"element-loci",layers:p}}return u},e.filter=function o(u,l){if(n(u))return u;if("element-loci"===u.kind){const{structure:d}=u.layers[0].loci,f=[];for(const p of u.layers){let{loci:m,value:h}=p;const g=De.remap(m,l);m=De.remap(g,d),De.isEmpty(m)||f.push({loci:m,value:h})}return{kind:"element-loci",layers:f}}return u},e.ofScript=function s(u,l){const d=[];for(let f=0,p=u.length;fn.lowestElementCount?"lowest":r>n.lowerElementCount?"lower":r>n.lowElementCount?"low":r>n.mediumElementCount?"medium":r>n.highElementCount?"high":"higher"}function o8(e,t){let n=Ds(e.quality,"auto"),r=Ds(e.detail,1),i=Ds(e.radialSegments,12),o=Ds(e.linearSegments,8),s=Ds(e.resolution,2),a=Ds(e.probePositions,12),c=Ds(e.doubleSided,!0),u=0;if("auto"===n)if(t instanceof Ve)n=Pae(t.root),u=function xQe(e){if(1===e.root.models.length){const t=no.Provider.get(e.root.model);if(t&&"P 1"===t.spacegroup.name&&!ma.isZero(t.spacegroup.cell))return t.spacegroup.cell.volume}return St.volume(e.root.boundary.box)}(t);else if(et.is(t)){const[l,d,f]=t.grid.cells.space.dimensions;u=l*d*f,n=u<1e7?"medium":"low"}switch(n){case"highest":r=3,i=36,o=18,s=.1,a=72,c=!0;break;case"higher":r=3,i=28,o=14,s=.3,a=48,c=!0;break;case"high":r=2,i=20,o=10,s=.5,a=36,c=!0;break;case"medium":r=1,i=12,o=8,s=.8,a=24,c=!0;break;case"low":r=0,i=8,o=3,s=1.3,a=24,c=!1;break;case"lower":r=0,i=4,o=2,s=3,a=12,c=!1;break;case"lowest":r=0,i=2,o=1,s=8,a=12,c=!1}return s=Math.max(s,u/5e8),s=Math.min(s,20),"off"===e.transparentBackfaces&&(void 0!==e.alpha&&e.alpha<1||e.xrayShaded)&&(c=!1),{detail:r,radialSegments:i,linearSegments:o,resolution:s,probePositions:a,doubleSided:c}}const tE=v.set,Mae=v.normalize,Rae=v.sub,kae=v.addScalar,nE=v.scale,Nae=v.toArray;function rE(e,t,n,r){let i=!1;if(et.isLoci(e)){if(!et.areEquivalent(e.volume,t))return!1;r(Ce.ofLength(t.grid.cells.data.length))&&(i=!0)}else if(et.Isosurface.isLoci(e)){if(!et.areEquivalent(e.volume,t))return!1;if(n?.isoValue){if(!et.IsoValue.areSame(e.isoValue,n.isoValue,t.grid.stats))return!1;r(Ce.ofLength(t.grid.cells.data.length))&&(i=!0)}else{const{stats:o,cells:{data:s}}=t.grid,a=o.sigma,c=et.IsoValue.toAbsolute(e.isoValue,o).absoluteValue;for(let u=0,l=s.length;u{r(Ce.ofSingleton(o))&&(i=!0)})}else if(et.Segment.isLoci(e)){if(!et.areEquivalent(e.volume,t))return!1;if(n?.segments){if(!je.areIntersecting(e.segments,n.segments))return!1;r(Ce.ofLength(t.grid.cells.data.length))&&(i=!0)}else{const o=et.Segmentation.get(t);if(o){const s=new Set;for(let u=0,l=e.segments.length;u2)continue;const ge=2-Y,Se=N(ne,we,We);for(let Re=0;Reu)throw new Error("outputStride + itemOffset must NOT be larger than colorStride");const f=e.colorType.endsWith("Instance"),p=f?e.instanceCount:1,m=Po(Math.max(1,p*t),d,Uint8Array),{array:h}=m,[g,y]=o,b=s[0],x=v.fromArray(v(),a,0),_=a[3];function S(I,R,T){const M=Math.floor(T*g%b/g),N=Math.floor(T*g/b);return u*(N*y*b+R*b+(M*g+I))}const A=v(),E=v(),w=v(),D=v();for(let I=0;Is.drawCount.ref.value||i!==s.stride.ref.value)&&k.update(s.aSample,Bae(a,i)),k.updateIfChanged(s.drawCount,a),k.updateIfChanged(s.instanceCount,t.instanceCount),k.updateIfChanged(s.stride,i),k.updateIfChanged(s.uGroupCount,t.groupCount),k.update(s.aTransform,t.transformBuffer),k.update(s.aInstance,t.instanceBuffer),k.update(s.uGeoTexDim,Me.set(s.uGeoTexDim.ref.value,t.positionTexture.getWidth(),t.positionTexture.getHeight())),k.update(s.tPosition,t.positionTexture),k.update(s.tGroup,t.groupTexture),k.update(s.uColorTexDim,Me.set(s.uColorTexDim.ref.value,t.colorData.getWidth(),t.colorData.getHeight())),k.update(s.tColor,t.colorData),k.updateIfChanged(s.dColorType,t.colorType),k.updateIfChanged(s.uCurrentSlice,0),k.updateIfChanged(s.uCurrentX,0),k.updateIfChanged(s.uCurrentY,0),k.update(s.uBboxMin,n.min),k.update(s.uBboxSize,o),k.updateIfChanged(s.uResolution,r),e.namedComputeRenderables[Cu].update()}else e.namedComputeRenderables[Cu]=function OQe(e,t,n,r,i){const o=v.sub(v(),n.max,n.min),s=Math.round(t.vertexCount/i),a={drawCount:k.create(s),instanceCount:k.create(t.instanceCount),stride:k.create(i),uGroupCount:k.create(t.groupCount),aTransform:k.create(t.transformBuffer),aInstance:k.create(t.instanceBuffer),aSample:k.create(Bae(s,i)),uGeoTexDim:k.create(Me.create(t.positionTexture.getWidth(),t.positionTexture.getHeight())),tPosition:k.create(t.positionTexture),tGroup:k.create(t.groupTexture),uColorTexDim:k.create(Me.create(t.colorData.getWidth(),t.colorData.getHeight())),tColor:k.create(t.colorData),dColorType:k.create(t.colorType),uCurrentSlice:k.create(0),uCurrentX:k.create(0),uCurrentY:k.create(0),uBboxMin:k.create(n.min),uBboxSize:k.create(o),uResolution:k.create(r)},c={...FQe};return ji(zi(e,"points",Br("accumulate",NQe,kQe,{drawBuffers:"required"}),c,a),a)}(e,t,n,r,i);return e.namedComputeRenderables[Cu]}(r,e,m,t,n);c.currentRenderItemId=-1,D.bind(),o.drawBuffers([o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1]);const{uCurrentSlice:M,uCurrentX:N,uCurrentY:V}=T.values;lt&&r.timer.mark("ColorAccumulate.render"),function LQe(e){const{gl:t,state:n}=e;n.disable(t.CULL_FACE),n.enable(t.BLEND),n.disable(t.DEPTH_TEST),n.enable(t.SCISSOR_TEST),n.depthMask(!1),n.clearColor(0,0,0,0),n.blendFunc(t.ONE,t.ONE),n.blendEquation(t.FUNC_ADD)}(r),c.viewport(0,0,A,E),c.scissor(0,0,A,E),s.clear(s.COLOR_BUFFER_BIT),k.update(V,0);let F=0,G=0,L=0;for(let $=0;$=w&&(F-=w,G+=_,L=0,k.update(V,G)),k.update(N,L),k.update(M,$),c.viewport(L,G,x,_),c.scissor(L,G,x,_),T.render(),++F,L+=x;I.detachFramebuffer(D,0),R.detachFramebuffer(D,1),o.drawBuffers([s.COLOR_ATTACHMENT0,s.NONE]),lt&&r.timer.markEnd("ColorAccumulate.render"),lt&&r.timer.mark("ColorNormalize.render"),(!i||function bje(e){return e.format===Qre}(i))&&(i=a.texture("image-uint8","rgba","ubyte","linear")),i.define(A,E);const z=function VQe(e,t,n){if(e.namedComputeRenderables[HS]){const r=e.namedComputeRenderables[HS].values;k.update(r.tColor,t),k.update(r.tCount,n),k.update(r.uTexSize,Me.set(r.uTexSize.ref.value,t.getWidth(),t.getHeight())),e.namedComputeRenderables[HS].update()}else e.namedComputeRenderables[HS]=function zQe(e,t,n){const r={..._o,tColor:k.create(t),tCount:k.create(n),uTexSize:k.create(Me.create(t.getWidth(),t.getHeight()))},i={...UQe};return ji(zi(e,"triangles",Br("normalize",ps,RQe),i,r),r)}(e,t,n);return e.namedComputeRenderables[HS]}(r,I,R);c.currentRenderItemId=-1,function GQe(e){const{gl:t,state:n}=e;n.disable(t.CULL_FACE),n.enable(t.BLEND),n.disable(t.DEPTH_TEST),n.enable(t.SCISSOR_TEST),n.depthMask(!1),n.clearColor(0,0,0,0),n.blendFunc(t.ONE,t.ONE),n.blendEquation(t.FUNC_ADD)}(r),i.attachFramebuffer(D,0),c.viewport(0,0,A,E),c.scissor(0,0,A,E),s.clear(s.COLOR_BUFFER_BIT),z.render(),lt&&r.timer.markEnd("ColorNormalize.render");const j=nn.create(b[0],b[1],b[2],h),Z=d?"volumeInstance":"volume";return lt&&r.timer.markEnd("calcTextureMeshColorSmoothing"),{texture:i,gridDim:y,gridTexDim:Me.create(A,E),gridTransform:j,type:Z}}const s8="color-smoothing-rgb",Vv="color-smoothing-rgba",a8="color-smoothing-alpha";function Oae(e,t,n,r,i){if(!function HQe(e){return"group"===e||"groupInstance"===e}(e.dColorType.ref.value))return;n*=3,r.namedTextures[s8]||(r.namedTextures[s8]=r.resources.texture("image-uint8","rgb","ubyte","nearest"));const o=r.namedTextures[s8];o.load(e.tColor.ref.value);const s=sE({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionTexture:e.tPosition.ref.value,groupTexture:e.tGroup.ref.value,colorData:o,colorType:e.dColorType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value},t,n,r,i);k.updateIfChanged(e.dColorType,s.type),k.update(e.tColorGrid,s.texture),k.update(e.uColorTexDim,s.gridTexDim),k.update(e.uColorGridDim,s.gridDim),k.update(e.uColorGridTransform,s.gridTransform)}var Sn,Lae;function Yr(e,t){return{kind:e,layers:t}}function zs(e,t){return{kind:e,layers:t}}!function(e){e.setVisibility=function t(f,p){f&&(f.state.visible=p)},e.setAlphaFactor=function n(f,p){f&&(f.state.alphaFactor=p)},e.setPickable=function r(f,p){f&&(f.state.pickable=p)},e.setColorOnly=function i(f,p){f&&(f.state.colorOnly=p)},e.mark=function o(f,p,m,h,g){if(!f||Ta(p))return!1;const{tMarker:y,uMarker:b,markerAverage:x,markerStatus:_,uGroupCount:S,instanceCount:A,instanceGranularity:E}=f.values,w=E.ref.value?A.ref.value:S.ref.value*A.ref.value,{array:D}=y.ref.value,I=_.ref.value;if(!Uc(p)){let N=0;if(h(p,V=>(N+=Ce.size(V),!0),!0),0===N)return!1;N===w&&(p=JD)}let R=!1,T=-1,M=-1;if(Uc(p)){const N=function gQe(e,t){let n=-1,r=-1;switch(e){case Bt.Highlight:0===t||1===t?(n=1,r=1):2===t||3===t?(n=1,r=3):n=1;break;case Bt.RemoveHighlight:0===t||1===t?(n=0,r=0):(2===t||3===t)&&(n=1,r=2);break;case Bt.Select:1===t||3===t?(n=1,r=3):0===t||2===t?(n=1,r=2):n=1;break;case Bt.Deselect:1===t||3===t?(n=1,r=1):(0===t||2===t)&&(n=0,r=0);break;case Bt.Toggle:1===t?(n=1,r=3):2===t?(n=0,r=0):3===t?(n=1,r=1):0===t&&(n=1,r=2);break;case Bt.Clear:n=0,r=0}return{average:n,status:r}}(m,I);-1!==N.status?(R=I!==N.status,R&&function mQe(e,t,n){e.fill(t,0,n)}(D,N.status,w)):R=i8(D,Ce.ofLength(w),m),T=N.average,M=N.status}else R=h(p,N=>i8(D,N,m),!0),R&&(T=function yQe(e,t){switch(e){case Bt.Highlight:return.5;case Bt.RemoveHighlight:return 0===t?0:2===t||3===t?.5:-1;case Bt.Select:return.5;case Bt.Deselect:return 1===t||3===t?.5:0===t?0:-1;case Bt.Toggle:return-1===t?-1:.5;case Bt.Clear:return-1===t?-1:0===t?0:.5;case Bt.None:return-1;default:Rr()}}(m,I),g&&-1!==g.status&&-1===T&&Us.isReverse(g.action,m)&&pn.areEqual(p,g.loci)&&(M=g.status,T=0===M?0:.5));return R&&(-1===T&&(T=mre(D,w),0===T&&(M=0)),g&&(g.action=m,g.loci=p,g.status=I),k.updateIfChanged(b,M),-1===M&&k.update(y,y.ref.value),k.updateIfChanged(x,T),k.updateIfChanged(_,M)),R},e.setOverpaint=function s(f,p,m,h,g){if(!f)return;const{tOverpaint:y,dOverpaintType:b,dOverpaint:x,uGroupCount:_,instanceCount:S,instanceGranularity:A}=f.values,E=A.ref.value?S.ref.value:_.ref.value*S.ref.value,w=A.ref.value?"instance":"groupInstance";!function jje(e,t,n){const r=Po(Math.max(1,e),4,Uint8Array,n&&n.tOverpaint.ref.value.array);n?(k.update(n.tOverpaint,r),k.update(n.uOverpaintTexDim,Me.create(r.width,r.height)),k.updateIfChanged(n.dOverpaint,e>0),k.updateIfChanged(n.dOverpaintType,t)):(k.create(r),k.create(Me.create(r.width,r.height)),k.create(e>0),k.create(Os()),k.create(v.create(1,1,1)),k.create(nn.create(0,0,0,1)),k.create(t),k.create(1))}(p.layers.length?E:0,w,f.values);const{array:D}=y.ref.value;h&&sie(D,0,E);for(let I=0,R=p.layers.length;I{const G=Ce.start(F),L=Ce.end(F);return N?sie(D,G,L):Gje(D,G,L,M)},!1)}if(k.update(y,y.ref.value),k.updateIfChanged(b,w),k.updateIfChanged(x,p.layers.length>0),0!==p.layers.length&&"instance"!==w&&g&&Tp(g.props)){const{geometry:I,props:R,webgl:T}=g;if("mesh"===I.kind){const{resolution:M,overpaintTexture:N}=I.meta,V=cl(R.smoothColors,!0,M);V&&(function TQe(e,t,n,r,i){if(!function IQe(e){return"groupInstance"===e}(e.dOverpaintType.ref.value))return;const o=iE({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionBuffer:e.aPosition.ref.value,groupBuffer:e.aGroup.ref.value,colorData:e.tOverpaint.ref.value,colorType:e.dOverpaintType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value,itemSize:4},t,n,r,i);"volume"===o.kind?(k.updateIfChanged(e.dOverpaintType,o.type),k.update(e.tOverpaintGrid,o.texture),k.update(e.uOverpaintTexDim,o.gridTexDim),k.update(e.uOverpaintGridDim,o.gridDim),k.update(e.uOverpaintGridTransform,o.gridTransform)):"vertex"===o.kind&&(k.updateIfChanged(e.dOverpaintType,o.type),k.update(e.tOverpaint,o.texture),k.update(e.uOverpaintTexDim,o.texDim))}(f.values,V.resolution,V.stride,T,N),I.meta.overpaintTexture=f.values.tOverpaintGrid.ref.value)}else if(T&&"texture-mesh"===I.kind){const{resolution:M,overpaintTexture:N}=I.meta,V=cl(R.smoothColors,!0,M);V&&(function WQe(e,t,n,r,i){if(!function qQe(e){return"groupInstance"===e}(e.dOverpaintType.ref.value))return;n*=3,r.namedTextures[Vv]||(r.namedTextures[Vv]=r.resources.texture("image-uint8","rgba","ubyte","nearest"));const o=r.namedTextures[Vv];o.load(e.tOverpaint.ref.value);const s=sE({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionTexture:e.tPosition.ref.value,groupTexture:e.tGroup.ref.value,colorData:o,colorType:e.dOverpaintType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value},t,n,r,i);k.updateIfChanged(e.dOverpaintType,s.type),k.update(e.tOverpaintGrid,s.texture),k.update(e.uOverpaintTexDim,s.gridTexDim),k.update(e.uOverpaintGridDim,s.gridDim),k.update(e.uOverpaintGridTransform,s.gridTransform)}(f.values,V.resolution,V.stride,T,N),I.meta.overpaintTexture=f.values.tOverpaintGrid.ref.value)}}},e.setTransparency=function a(f,p,m,h,g){if(!f)return;const{tTransparency:y,dTransparencyType:b,transparencyAverage:x,dTransparency:_,uGroupCount:S,instanceCount:A,instanceGranularity:E}=f.values,w=E.ref.value?A.ref.value:S.ref.value*A.ref.value,D=E.ref.value?"instance":"groupInstance";!function Wje(e,t,n){const r=Po(Math.max(1,e),1,Uint8Array,n&&n.tTransparency.ref.value.array);n?(k.update(n.tTransparency,r),k.update(n.uTransparencyTexDim,Me.create(r.width,r.height)),k.updateIfChanged(n.dTransparency,e>0),k.updateIfChanged(n.transparencyAverage,cie(r.array,e)),k.updateIfChanged(n.dTransparencyType,t)):(k.create(r),k.create(Me.create(r.width,r.height)),k.create(e>0),k.create(0),k.create(Os()),k.create(v.create(1,1,1)),k.create(nn.create(0,0,0,1)),k.create(t),k.create(1))}(p.layers.length?w:0,D,f.values);const{array:I}=y.ref.value;h&&function qje(e,t,n){e.fill(0,t,n)}(I,0,w);for(let R=0,T=p.layers.length;R{const G=Ce.start(F),L=Ce.end(F);return Hje(I,G,L,N)},!1)}if(k.update(y,y.ref.value),k.updateIfChanged(x,cie(I,w)),k.updateIfChanged(b,D),k.updateIfChanged(_,p.layers.length>0),0!==p.layers.length&&"instance"!==D&&g&&Tp(g.props)){const{geometry:R,props:T,webgl:M}=g;if("mesh"===R.kind){const{resolution:N,transparencyTexture:V}=R.meta,F=cl(T.smoothColors,!0,N);F&&(function EQe(e,t,n,r,i){if(!function DQe(e){return"groupInstance"===e}(e.dTransparencyType.ref.value))return;const o=iE({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionBuffer:e.aPosition.ref.value,groupBuffer:e.aGroup.ref.value,colorData:e.tTransparency.ref.value,colorType:e.dTransparencyType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value,itemSize:1},t,n,r,i);"volume"===o.kind?(k.updateIfChanged(e.dTransparencyType,o.type),k.update(e.tTransparencyGrid,o.texture),k.update(e.uTransparencyTexDim,o.gridTexDim),k.update(e.uTransparencyGridDim,o.gridDim),k.update(e.uTransparencyGridTransform,o.gridTransform)):"vertex"===o.kind&&(k.updateIfChanged(e.dTransparencyType,o.type),k.update(e.tTransparency,o.texture),k.update(e.uTransparencyTexDim,o.texDim))}(f.values,F.resolution,F.stride,M,V),R.meta.transparencyTexture=f.values.tTransparencyGrid.ref.value)}else if(M&&"texture-mesh"===R.kind){const{resolution:N,transparencyTexture:V}=R.meta,F=cl(T.smoothColors,!0,N);F&&(function YQe(e,t,n,r,i){if(!function $Qe(e){return"groupInstance"===e}(e.dTransparencyType.ref.value))return;n*=3,r.namedTextures[a8]||(r.namedTextures[a8]=r.resources.texture("image-uint8","alpha","ubyte","nearest"));const o=r.namedTextures[a8];o.load(e.tTransparency.ref.value);const s=sE({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionTexture:e.tPosition.ref.value,groupTexture:e.tGroup.ref.value,colorData:o,colorType:e.dTransparencyType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value},t,n,r,i);k.updateIfChanged(e.dTransparencyType,s.type),k.update(e.tTransparencyGrid,s.texture),k.update(e.uTransparencyTexDim,s.gridTexDim),k.update(e.uTransparencyGridDim,s.gridDim),k.update(e.uTransparencyGridTransform,s.gridTransform)}(f.values,F.resolution,F.stride,M,V),R.meta.transparencyTexture=f.values.tTransparencyGrid.ref.value)}}},e.setSubstance=function c(f,p,m,h,g){if(!f)return;const{tSubstance:y,dSubstanceType:b,dSubstance:x,uGroupCount:_,instanceCount:S,instanceGranularity:A}=f.values,E=A.ref.value?S.ref.value:_.ref.value*S.ref.value,w=A.ref.value?"instance":"groupInstance";!function Zje(e,t,n){const r=Po(Math.max(1,e),4,Uint8Array,n&&n.tSubstance.ref.value.array);n?(k.update(n.tSubstance,r),k.update(n.uSubstanceTexDim,Me.create(r.width,r.height)),k.updateIfChanged(n.dSubstance,e>0),k.updateIfChanged(n.dSubstanceType,t)):(k.create(r),k.create(Me.create(r.width,r.height)),k.create(e>0),k.create(Os()),k.create(v.create(1,1,1)),k.create(nn.create(0,0,0,1)),k.create(t),k.create(1))}(p.layers.length?E:0,w,f.values);const{array:D}=y.ref.value;h&&die(D,0,E);for(let I=0,R=p.layers.length;I{const G=Ce.start(F),L=Ce.end(F);return N?die(D,G,L):Kje(D,G,L,M)},!1)}if(k.update(y,y.ref.value),k.updateIfChanged(b,w),k.updateIfChanged(x,p.layers.length>0),0!==p.layers.length&&"instance"!==w&&g&&Tp(g.props)){const{geometry:I,props:R,webgl:T}=g;if("mesh"===I.kind){const{resolution:M,substanceTexture:N}=I.meta,V=cl(R.smoothColors,!0,M);V&&(function MQe(e,t,n,r,i){if(!function PQe(e){return"groupInstance"===e}(e.dSubstanceType.ref.value))return;const o=iE({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionBuffer:e.aPosition.ref.value,groupBuffer:e.aGroup.ref.value,colorData:e.tSubstance.ref.value,colorType:e.dSubstanceType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value,itemSize:4},t,n,r,i);"volume"===o.kind?(k.updateIfChanged(e.dSubstanceType,o.type),k.update(e.tSubstanceGrid,o.texture),k.update(e.uSubstanceTexDim,o.gridTexDim),k.update(e.uSubstanceGridDim,o.gridDim),k.update(e.uSubstanceGridTransform,o.gridTransform)):"vertex"===o.kind&&(k.updateIfChanged(e.dSubstanceType,o.type),k.update(e.tSubstance,o.texture),k.update(e.uSubstanceTexDim,o.texDim))}(f.values,V.resolution,V.stride,T,N),I.meta.substanceTexture=f.values.tSubstanceGrid.ref.value)}else if(T&&"texture-mesh"===I.kind){const{resolution:M,substanceTexture:N}=I.meta,V=cl(R.smoothColors,!0,M);V&&(function KQe(e,t,n,r,i){if(!function XQe(e){return"groupInstance"===e}(e.dSubstanceType.ref.value))return;n*=3,r.namedTextures[Vv]||(r.namedTextures[Vv]=r.resources.texture("image-uint8","rgba","ubyte","nearest"));const o=r.namedTextures[Vv];o.load(e.tSubstance.ref.value);const s=sE({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionTexture:e.tPosition.ref.value,groupTexture:e.tGroup.ref.value,colorData:o,colorType:e.dSubstanceType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value},t,n,r,i);k.updateIfChanged(e.dSubstanceType,s.type),k.update(e.tSubstanceGrid,s.texture),k.update(e.uSubstanceTexDim,s.gridTexDim),k.update(e.uSubstanceGridDim,s.gridDim),k.update(e.uSubstanceGridTransform,s.gridTransform)}(f.values,V.resolution,V.stride,T,N),I.meta.substanceTexture=f.values.tSubstanceGrid.ref.value)}}},e.setClipping=function u(f,p,m,h){if(!f)return;const{tClipping:g,dClippingType:y,dClipping:b,uGroupCount:x,instanceCount:_,instanceGranularity:S}=f.values,A=S.ref.value?_.ref.value:x.ref.value*_.ref.value,{layers:E}=p,w=S.ref.value?"instance":"groupInstance";!function Xje(e,t,n){const r=Po(Math.max(1,e),1,Uint8Array,n&&n.tClipping.ref.value.array);n?(k.update(n.tClipping,r),k.update(n.uClippingTexDim,Me.create(r.width,r.height)),k.updateIfChanged(n.dClipping,e>0),k.updateIfChanged(n.dClippingType,t)):(k.create(r),k.create(Me.create(r.width,r.height)),k.create(e>0),k.create(t))}(E.length?A:0,w,f.values);const{array:D}=g.ref.value;h&&function Yje(e,t,n){e.fill(0,t,n)}(D,0,A);for(let I=0,R=p.layers.length;I{const F=Ce.start(V),G=Ce.end(V);return $je(D,F,G,M)},!1)}k.update(g,g.ref.value),k.updateIfChanged(y,w),k.updateIfChanged(b,p.layers.length>0)},e.setThemeStrength=function l(f,p){f&&(k.updateIfChanged(f.values.uOverpaintStrength,p.overpaint),k.updateIfChanged(f.values.uTransparencyStrength,p.transparency),k.updateIfChanged(f.values.uSubstanceStrength,p.substance))},e.setTransform=function d(f,p,m){if(!f||!p&&!m)return;const{values:h}=f;p&&(le.copy(h.matrix.ref.value,p),k.update(h.matrix,h.matrix.ref.value)),m?(h.extraTransform.ref.value.set(m),k.update(h.extraTransform,h.extraTransform.ref.value)):null===m&&(vD(h.extraTransform.ref.value,h.instanceCount.ref.value),k.update(h.extraTransform,h.extraTransform.ref.value)),nie(h,h.invariantBoundingSphere.ref.value,h.instanceGrid.ref.value.cellSize,h.instanceGrid.ref.value.batchSize);const g=fs(h.invariantBoundingSphere.ref.value,h.transform.ref.value,h.instanceCount.ref.value,0);k.update(h.boundingSphere,g)}}(Sn||(Sn={})),function(e){let t;function r(l){return 0===l.layers.length}e.Empty={kind:"empty-loci",layers:[]},function(l){let d;var y;function m(y){switch(y){case"one":return d.One;case"two":return d.Two;case"three":return d.Three;case"four":return d.Four;case"five":return d.Five;case"six":return d.Six}}l.is=ea.has,(y=d=l.Flag||(l.Flag={}))[y.None=0]="None",y[y.One=1]="One",y[y.Two=2]="Two",y[y.Three=4]="Three",y[y.Four=8]="Four",y[y.Five=16]="Five",y[y.Six=32]="Six",l.create=function f(y){return ea.create(y)},l.Names={one:d.One,two:d.Two,three:d.Three,four:d.Four,five:d.Five,six:d.Six},l.isName=function p(y){return y in l.Names},l.fromName=m,l.fromNames=function h(y){let b=d.None;for(let x=0,_=y.length;x<_;++x)b|=m(y[x]);return b},l.toNames=function g(y){const b=[];return l.is(y,d.One)&&b.push("one"),l.is(y,d.Two)&&b.push("two"),l.is(y,d.Three)&&b.push("three"),l.is(y,d.Four)&&b.push("four"),l.is(y,d.Five)&&b.push("five"),l.is(y,d.Six)&&b.push("six"),b}}(t=e.Groups||(e.Groups={})),e.areEqual=function n(l,d){if(l.layers.length!==d.layers.length)return!1;for(let f=0,p=l.layers.length;f{m.push({loci:h,groups:g})}),{kind:"element-loci",layers:m}}return l},e.filter=function s(l,d){if(r(l))return l;if("element-loci"===l.kind){const{structure:f}=l.layers[0].loci,p=[];for(const m of l.layers){let{loci:h,groups:g}=m;const y=De.remap(h,d);h=De.remap(y,f),De.isEmpty(h)||p.push({loci:h,groups:g})}return{kind:"element-loci",layers:p}}return l},e.ofScript=function a(l,d){const f=[];for(let p=0,m=l.length;p{m.push({loci:h,material:g,clear:!1})}),{kind:"element-loci",layers:m}}return u},e.filter=function o(u,l){if(n(u))return u;if("element-loci"===u.kind){const{structure:d}=u.layers[0].loci,f=[];for(const p of u.layers){let{loci:m,material:h,clear:g}=p;const y=De.remap(m,l);m=De.remap(y,d),De.isEmpty(m)||f.push({loci:m,material:h,clear:g})}return{kind:"element-loci",layers:f}}return u},e.ofScript=function s(u,l){const d=[];for(let f=0,p=u.length;fyn.Empty,getParams:()=>({}),defaultValues:{},defaultColorTheme:Lc.EmptyProvider,defaultSizeTheme:Qo.EmptyProvider,isApplicable:()=>!0};function Uae(e){return e.map(t=>[t.name,t.provider.label])}class Vae{get default(){return this._list[0]}get types(){return Uae(this._list)}constructor(){this._list=[],this._map=new Map,this._name=new Map}add(t){if(this._map.has(t.name))throw new Error(`${t.name} already registered.`);this._list.push({name:t.name,provider:t}),this._map.set(t.name,t),this._name.set(t,t.name)}getName(t){if(!this._name.has(t))throw new Error(`'${t.label}' is not a registered represenatation provider.`);return this._name.get(t)}remove(t){const n=t.name;this._list.splice(this._list.findIndex(i=>i.name===n),1);const r=this._map.get(n);r&&(this._map.delete(n),this._name.delete(r))}get(t){return this._map.get(t)||ZQe}get list(){return this._list}getApplicableList(t){return this._list.filter(n=>n.provider.isApplicable(t))}getApplicableTypes(t){return Uae(this.getApplicableList(t))}clear(){this._list.length=0,this._map.clear(),this._name.clear()}}var yn;function Jo(e,t,n={}){let r=0;const i=new mr,o=yn.createState(),s=Hp(),a=[];let c,u,l=-1;const d=Fo.createEmpty();let m,h,f=C.getDefaultValues(t.Params);n.modifyState&&yn.updateState(o,n.modifyState(o));const g=Cf.create();function _(S,A){return Uc(S)||qn.isLoci(S)&&S.shape===u?A(Ce.ofBounds(0,f.instanceGranularity?u.transforms.length:u.groupCount*u.transforms.length)):f.instanceGranularity?function x(S,A,E){let w=!1;if(!ra.isLoci(S)||ra.isLociEmpty(S)||S.shape!==A)return!1;for(const D of S.groups)E(Ce.ofSingleton(D.instance))&&(w=!0);return w}(S,u,A):function QQe(e,t,n){if(!ra.isLoci(e)||e.shape!==t)return!1;let r=!1;const{groupCount:i}=t,{groups:o}=e;for(const{ids:s,instance:a}of o)if(Ce.is(s)){const c=a*i+Ce.start(s),u=a*i+Ce.end(s);n(Ce.ofBounds(c,u))&&(r=!0)}else for(let c=0,u=s.length;c[qn.Loci(u)],eachLocation:S=>{for(m.reset();m.hasNext;){const{location:A,isSecondary:E}=m.move();S(A,E)}},mark(S,A){if(!Us.is(o.markerActions,A))return!1;if(ra.isLoci(S)||qn.isLoci(S)){if(S.shape!==u)return!1}else if(!Uc(S))return!1;return Sn.mark(c,S,A,_)},setState(S){n.modifyState&&(S=n.modifyState(S)),c&&(void 0!==S.visible&&Sn.setVisibility(c,S.visible),void 0!==S.alphaFactor&&Sn.setAlphaFactor(c,S.alphaFactor),void 0!==S.pickable&&Sn.setPickable(c,S.pickable),void 0!==S.colorOnly&&Sn.setColorOnly(c,S.colorOnly),void 0!==S.overpaint&&Sn.setOverpaint(c,S.overpaint,_,!0),void 0!==S.transparency&&Sn.setTransparency(c,S.transparency,_,!0),void 0!==S.substance&&Sn.setSubstance(c,S.substance,_,!0),void 0!==S.transform&&Sn.setTransform(c,S.transform)),yn.updateState(o,S)},setTheme(S){un&&console.warn("The `ShapeRepresentation` theme is fixed to `ShapeGroupColorTheme` and `ShapeGroupSizeTheme`. Colors are taken from `Shape.getColor` and sizes from `Shape.getSize`")},destroy(){a.length=0,c&&(c.state.disposed=!0,c=void 0)}}}!function(e){let t;var a;function n(){return{visible:!0,alphaFactor:1,pickable:!0,colorOnly:!1,syncManually:!1,transform:le.identity(),overpaint:Bo.Empty,transparency:Vs.Empty,substance:zs.Empty,clipping:Yr.Empty,themeStrength:{overpaint:1,transparency:1,substance:1},markerActions:Us.All}}function r(a,c){void 0!==c.visible&&(a.visible=c.visible),void 0!==c.alphaFactor&&(a.alphaFactor=c.alphaFactor),void 0!==c.pickable&&(a.pickable=c.pickable),void 0!==c.colorOnly&&(a.colorOnly=c.colorOnly),void 0!==c.overpaint&&(a.overpaint=c.overpaint),void 0!==c.transparency&&(a.transparency=c.transparency),void 0!==c.substance&&(a.substance=c.substance),void 0!==c.clipping&&(a.clipping=c.clipping),void 0!==c.themeStrength&&(a.themeStrength=c.themeStrength),void 0!==c.syncManually&&(a.syncManually=c.syncManually),void 0!==c.transform&&le.copy(a.transform,c.transform),void 0!==c.markerActions&&(a.markerActions=c.markerActions)}(a=t=e.Loci||(e.Loci={})).areEqual=function c(l,d){return l.repr===d.repr&&pn.areEqual(l.loci,d.loci)},a.isEmpty=function u(l){return pn.isEmpty(l.loci)},a.Empty={loci:$n},e.createState=n,e.updateState=r,e.StateBuilder={create:n,update:r},e.Empty={label:"",groupCount:0,renderObjects:[],geometryVersion:-1,props:{},params:{},updated:new mr,state:n(),theme:Fo.createEmpty(),createOrUpdate:()=>Oe.constant("",void 0),setState:()=>{},setTheme:()=>{},getLoci:()=>$n,getAllLoci:()=>[],eachLocation:()=>{},mark:()=>!1,destroy:()=>{}};class i{constructor(){this.curr=new Set,this.next=new Set,this._version=-1}get version(){return this._version}add(c,u){this.next.add(uu(c,u))}snapshot(){Si.areEqual(this.curr,this.next)||(this._version+=1),[this.curr,this.next]=[this.next,this.curr],this.next.clear()}}e.GeometryState=i,e.createMulti=function o(a,c,u,l,d){let f=0;const p=new mr,m=new i,h=l.create();let y,b,x,g=Fo.createEmpty();const _={},S=Object.keys(d).map((A,E)=>{_[E]=A;const w=d[A](c,u);return w.setState(h),w});return{label:a,updated:p,get groupCount(){let A=0;if(b){const{visuals:E}=b;for(let w=0,D=S.length;w{E&&E!==x&&(y=u(c,E),x=E,b||(b=C.getDefaultValues(y)));const w=o8(Object.assign({},b,A),x);Object.assign(b,A,w);const{visuals:D}=b;return Oe.create(`Creating or updating '${a}' representation`,function(){var I=ie(function*(R){for(let T=0,M=S.length;T{const{visuals:E}=b;for(let w=0,D=S.length;w{const A=[],{visuals:E}=b;for(let w=0,D=S.length;w{const{visuals:E}=b;for(let w=0,D=S.length;w{let w=!1;for(let D=0,I=S.length;D{l.update(h,A);for(let E=0,w=S.length;E{g=A;for(let E=0,w=S.length;E{const y=o8(Object.assign({},h,g));return Object.assign(h,g,y),Oe.create(`Updating '${a}' representation`,function(){var b=ie(function*(x){d.add(0,c.id),d.snapshot(),l.next(u++)});return function(x){return b.apply(this,arguments)}}())},get state(){return f},get theme(){return p},getLoci:()=>$n,getAllLoci:()=>[],eachLocation:()=>{},mark:(g,y)=>!1,setState:g=>{void 0!==g.visible&&Sn.setVisibility(c,g.visible),void 0!==g.alphaFactor&&Sn.setAlphaFactor(c,g.alphaFactor),void 0!==g.pickable&&Sn.setPickable(c,g.pickable),void 0!==g.colorOnly&&Sn.setColorOnly(c,g.colorOnly),void 0!==g.themeStrength&&Sn.setThemeStrength(c,g.themeStrength),void 0!==g.transform&&Sn.setTransform(c,g.transform),e.updateState(f,g)},setTheme:()=>{},destroy(){}}}}(yn||(yn={}));const zae=le();class zv{constructor(t){this.structure=t,this.groupUnitTransforms=[],this.unitOffsetMap=Lu.Mutable(),this.groupIndexMap=Lu.Mutable(),this._isIdentity=void 0,this.version=0,this.unitTransforms=new Float32Array(16*t.units.length),this.size=t.units.length,this.reset();let n=0;for(let r=0,i=t.unitSymmetryGroups.length;rJo(aJe,Nt.Utils)},Zae={...iJe};function aJe(e,t,n,r){const i=function sJe(e,t,n){const r=at.createState(256,128,n),{fromFractional:i}=e.symmetry.spacegroup.cell;v.copy(pd,e.ref),"center"===t.attachment?(v.trunc(pd,pd),v.subScalar(pd,pd,.5)):v.floor(pd,pd),le.fromTranslation(Kae,pd);const o=yie(gie(tJe),Kae),s=Math.cbrt(e.symmetry.spacegroup.cell.volume)/300*t.cellScale;r.currentGroup=1,at.addCage(r,i,o,s,2,20);const a=_e.fromDimensionsAndTransform(_e(),v.unit,i);v.transformMat4(pd,pd,i),_e.translate(a,a,pd),_e.expand(a,a,s);const c=at.getMesh(r);return c.setBoundingSphere(a),c}(t,n,r&&r.geometry),o=h2.getUnitcellLabel(t.symmetry);return qn.create(o,t,i,()=>n.cellColor,()=>1,()=>o)}function Qae(e,t,n){const r=v();return"model"===n.ref&&v.transformMat4(r,sn.getCenter(e),t.spacegroup.cell.toFractional),{symmetry:t,ref:r}}const bl=new Uint16Array([0,1,2,1,3,2]),S0=ze.add3,Gs=ze.add2,Jae=ze.add;var wf;!function(e){e.create=function t(n={},r=2048,i=1024,o){r*=2,i*=2;const s=ze.create(Float32Array,3,i,o?o.centerBuffer.ref.value:r),a=ze.create(Float32Array,2,i,o?o.mappingBuffer.ref.value:r),c=ze.create(Float32Array,1,i,o?o.depthBuffer.ref.value:r),u=ze.create(Uint32Array,3,i,o?o.indexBuffer.ref.value:r),l=ze.create(Float32Array,1,i,o?o.groupBuffer.ref.value:r),d=ze.create(Float32Array,2,i,o?o.tcoordBuffer.ref.value:r),f={...C.getDefaultValues(vu.Params),...n},{attachment:p,background:m,backgroundMargin:h,tether:g,tetherLength:y,tetherBaseWidth:b}=f,x=function PHe(e){const t=JSON.stringify(e);return void 0===b5[t]&&(b5[t]=new MHe(e)),b5[t]}(f),_=.4*h,S=x.buffer/x.lineHeight,A=(E,w,D,I,R)=>{S0(s,E,w,D),Jae(c,I),Jae(l,R)};return{add:(E,w,D,I,R,T,M)=>{let N=0;const V=E.length;for(let q=0;q{const E=x.texture,w=ze.compact(s,!0),D=ze.compact(a,!0),I=ze.compact(c,!0),R=ze.compact(u,!0),T=ze.compact(l,!0),M=ze.compact(d,!0);return vu.create(E,w,D,I,R,T,M,u.elementCount/2,o)}}}}(wf||(wf={}));const jv={granularity:"element",condensed:!1,reverse:!1,countsOnly:!1,hidePrefix:!1,htmlStyling:!0};function uE(e,t={}){var n;switch(e.kind){case"structure-loci":return e.structure.models.map(d=>d.entry).filter(d=>!!d).join(", ");case"element-loci":return lE(rf.ofLoci(e),t);case"bond-loci":const r=e.bonds[0];return r?c8(r,t):"";case"shape-loci":return e.shape.name;case"group-loci":const i=e.groups[0];return i?e.shape.getLabel(Fe.start(i.ids),i.instance):"";case"every-loci":return"Everything";case"empty-loci":return"Nothing";case"data-loci":return e.getLabel();case"volume-loci":return e.volume.label||"Volume";case"isosurface-loci":return[`${e.volume.label||"Volume"}`,`Isosurface at ${et.IsoValue.toString(e.isoValue)}`].join(" | ");case"cell-loci":const o=Fe.size(e.indices),s=Fe.start(e.indices),a=et.IsoValue.absolute(e.volume.grid.cells.data[s]),c=et.IsoValue.toRelative(a,e.volume.grid.stats),u=[`${e.volume.label||"Volume"}`,1===o?`Cell #${s}`:`${o} Cells`];return 1===o&&u.push(`${et.IsoValue.toString(a)} (${et.IsoValue.toString(c)})`),u.join(" | ");case"segment-loci":const l=null===(n=et.Segmentation.get(e.volume))||void 0===n?void 0:n.labels;if(l&&1===e.segments.length){const d=l[e.segments[0]];if(d)return d}return[`${e.volume.label||"Volume"}`,1===e.segments.length?`Segment ${e.segments[0]}`:`${e.segments.length} Segments`].join(" | ")}}function Hv(e,t){return 1===e?`1 ${t}`:`${e} ${t}s`}function qS(e,t,n,r,i,o){return`${Jp(t,{granularity:n,hidePrefix:r,reverse:i,condensed:o})} [+ ${Hv(e-1,`other ${Fg(n)}`)}]`}function lE(e,t={}){const n={...jv,...t},r=function lJe(e,t=!1,n=!1,r=!1,i=!1){const{structureCount:o,chainCount:s,residueCount:a,conformationCount:c,elementCount:u}=e;if(!t&&1===u&&0===a&&0===s)return Jp(e.firstElementLoc,{hidePrefix:n,condensed:r,granularity:"element",reverse:i});if(!t&&0===u&&1===a&&0===s)return Jp(e.firstResidueLoc,{hidePrefix:n,condensed:r,granularity:"residue",reverse:i});if(t||0!==u||0!==a||1!==s){if(t){const l=[];return o>0&&l.push(Hv(o,"Structure")),s>0&&l.push(Hv(s,"Chain")),a>0&&l.push(Hv(a,"Residue")),c>0&&l.push(Hv(c,"Conformation")),u>0&&l.push(Hv(u,"Element")),l.join(" + ")}{const l=[];return o>0&&l.push(1===o?Jp(e.firstStructureLoc,{hidePrefix:n,condensed:r,granularity:"structure",reverse:i}):qS(o,e.firstStructureLoc,"structure",n,i,r)),s>0&&(l.push(1===s?Jp(e.firstChainLoc,{condensed:r,granularity:"chain",hidePrefix:n,reverse:i}):qS(s,e.firstChainLoc,"chain",n,i,r)),n=!0),a>0&&(l.push(1===a?Jp(e.firstResidueLoc,{condensed:r,granularity:"residue",hidePrefix:n,reverse:i}):qS(a,e.firstResidueLoc,"residue",n,i,r)),n=!0),c>0&&(l.push(1===c?Jp(e.firstConformationLoc,{condensed:r,granularity:"conformation",hidePrefix:n,reverse:i}):qS(c,e.firstConformationLoc,"conformation",n,i,r)),n=!0),u>0&&l.push(1===u?Jp(e.firstElementLoc,{condensed:r,granularity:"element",hidePrefix:n,reverse:i}):qS(u,e.firstElementLoc,"element",n,i,r)),l.join(" + ")}}{const{unit:l}=e.firstChainLoc,d=Ee.isAtomic(l)&&1===function uJe(e){const{elements:t,model:n}=e,{chainAtomSegments:r,residueAtomSegments:i}=n.atomicHierarchy;return i.index[r.offsets[r.index[t[t.length-1]]+1]-1]-i.index[r.offsets[r.index[t[0]]]]+1}(l)||Ee.Traits.is(l.traits,Ee.Trait.MultiChain)?"residue":"chain";return Jp(e.firstChainLoc,{hidePrefix:n,condensed:r,granularity:d,reverse:i})}}(e,n.countsOnly,n.hidePrefix,n.condensed,n.reverse);return n.htmlStyling?r:IB(r)}function dE(e,t={}){const n=rf.create();for(const r of e)rf.add(n,n,rf.ofLoci(r));return lE(n,t)}function c8(e,t={}){return fE({loci:[De(e.aStructure,[{unit:e.aUnit,indices:Fe.ofSingleton(e.aIndex)}]),De(e.bStructure,[{unit:e.bUnit,indices:Fe.ofSingleton(e.bIndex)}])]},t)}function fE(e,t={}){const n={...jv,...t},r=function dJe(e,t){const{granularity:n,hidePrefix:r,reverse:i,condensed:o}=t;let s=!0;for(const a of e.loci)if(!De.is(a)||1!==De.size(a)){s=!1;break}if(s){const c=e.loci.map(l=>{const{unit:d,indices:f}=l.elements[0];return nt.create(l.structure,d,d.elements[Fe.start(f)])}).map(l=>ece(l,n,r,i||o));if(o)return c.map(l=>l[0].replace(/\[.*\]/g,"").trim()).filter(l=>!!l).join(" \u2014 ");let u=0;for(let l=0,d=Math.min(...c.map(f=>f.length))-1;l0){const l=[c[0].join(" | ")];for(let d=1,f=c.length;d!!p).join(" | "));return l.join(" \u2014 ")}return c.map(l=>l.filter(d=>!!d).join(" | ")).filter(l=>!!l).join("
")}return e.loci.map(c=>uE(c,t)).filter(c=>!!c).join(o?" \u2014 ":"
")}(e,n);return n.htmlStyling?r:IB(r)}function Jp(e,t={}){var n,r;const i={...jv,...t},o=ece(e,i.granularity,i.hidePrefix,i.reverse||i.condensed),s=i.condensed?null!==(r=null===(n=o[0])||void 0===n?void 0:n.replace(/\[.*\]/g,"").trim())&&void 0!==r?r:"":o.filter(a=>!!a).join(" | ");return i.htmlStyling?s:IB(s)}function ece(e,t="element",n=!1,r=!1){const i=[];if(!n){let o=e.unit.model.entry;o.length>30&&(o=o.substr(0,27)+"\u2026"),i.push(`${o}`),"structure"!==t&&(i.push(`Model ${e.unit.model.modelNum}`),i.push(`Instance ${e.unit.conformation.operator.name}`))}return Ee.isAtomic(e.unit)?i.push(...function fJe(e,t,n=!1){const r=nt.residueIndex(e),i=Ze.chain.label_asym_id(e),o=Ze.chain.auth_asym_id(e),s=0===e.unit.model.atomicHierarchy.residues.label_seq_id.valueKind(r),a=Ze.residue.label_seq_id(e),c=Ze.residue.auth_seq_id(e),u=Ze.residue.pdbx_PDB_ins_code(e),l=Ze.atom.label_comp_id(e),d=Ze.atom.label_atom_id(e),f=Ze.atom.label_alt_id(e),p=Ze.atom.occupancy(e),m=Ze.residue.microheterogeneityCompIds(e),h="residue"===t&&m.length>1?`(${m.join("|")})`:l,g=[];switch(t){case"element":g.push(`${d}${f?`%${f}`:""}`);case"conformation":"conformation"===t&&f&&g.push(`Conformation ${f}`);case"residue":const y=a!==c&&s?a:c;g.push(`${h} ${y}${y!==c?` [auth ${c}]`:""}${u||""}`);case"chain":i===o?g.push(`${i}`):"chain"===t&&Ee.Traits.is(e.unit.traits,Ee.Trait.MultiChain)?g.push(`[auth ${o}]`):g.push(`${i} [auth ${o}]`)}return g.length>0&&1!==p&&!n&&(g[0]=`${g[0]} [occupancy ${Math.round(100*p)/100}]`),g.reverse()}(e,t,r)):Ee.isCoarse(e.unit)?i.push(...function pJe(e,t){const n=Ze.coarse.asym_id(e),r=Ze.coarse.seq_id_begin(e),i=Ze.coarse.seq_id_end(e),o=[];switch(t){case"element":case"conformation":case"residue":if(r===i){const s=Ze.coarse.entityKey(e),c=e.unit.model.sequence.byEntityKey[s].sequence.compId.value(r-1);o.push(`${c} ${r}`)}else o.push(`${r}-${i}`);case"chain":o.push(`${n}`)}return o.reverse()}(e,t)):i.push("Unknown"),r?i.reverse():i}function u8(e,t={}){const n={...jv,measureOnly:!1,unitLabel:"\u212b",...t},[r,i]=e.loci.map(a=>pn.getCenter(a)),o=`${v.distance(r,i).toFixed(2)} ${n.unitLabel}`;if(n.measureOnly)return o;const s=fE(e,n);return n.condensed?`${o} | ${s}`:`Distance ${o}
${s}`}function l8(e,t={}){const n={...jv,measureOnly:!1,...t},[r,i,o]=e.loci.map(l=>pn.getCenter(l)),s=v.sub(v(),r,i),a=v.sub(v(),o,i),c=`${su(v.angle(s,a)).toFixed(2)}\xb0`;if(n.measureOnly)return c;const u=fE(e,n);return n.condensed?`${c} | ${u}`:`Angle ${c}
${u}`}function d8(e,t={}){const n={...jv,measureOnly:!1,...t},[r,i,o,s]=e.loci.map(u=>pn.getCenter(u)),a=`${su(v.dihedralAngle(r,i,o,s)).toFixed(2)}\xb0`;if(n.measureOnly)return a;const c=fE(e,n);return n.condensed?`${a} | ${c}`:`Dihedral ${a}
${c}`}const tce={customText:C.Text("",{label:"Text",description:"Override the label with custom value.",isEssential:!0}),textColor:C.Color(xn.black,{isEssential:!0}),textSize:C.Numeric(.5,{min:.1,max:10,step:.1},{isEssential:!0})},pE={...vu.Params,...tce,borderWidth:C.Numeric(.2,{min:0,max:.5,step:.01})},nce={unitLabel:C.Text("\u212b",{isEssential:!0})},hJe={...di.Params,...nce,lineSizeAttenuation:C.Boolean(!0),linesColor:C.Color(xn.lightgreen,{isEssential:!0}),linesSize:C.Numeric(.075,{min:.01,max:5,step:.01}),dashLength:C.Numeric(.2,{min:.01,max:.2,step:.01})},mJe={...pE,...nce},rce={lines:(e,t)=>Jo(bJe,di.Utils,{modifyState:n=>({...n,markerActions:Us.Highlighting})}),text:(e,t)=>Jo(_Je,vu.Utils,{modifyState:n=>({...n,markerActions:Bt.None})})},ice={...hJe,...mJe,visuals:C.MultiSelect(["lines","text"],C.objectToOptions(rce))};function oce(e,t){const{sphereA:n,sphereB:r,center:i}=t,[o,s]=e.loci;return pn.getBoundingSphere(o,n),pn.getBoundingSphere(s,r),v.add(i,n.center,r.center),v.scale(i,i,.5),t.distance=v.distance(n.center,r.center),t}const WS=function gJe(){return{sphereA:_e(),sphereB:_e(),center:v(),distance:0}}();function sce(e,t){return 1===e.pairs.length?`Distance ${u8(e.pairs[0],{unitLabel:t,measureOnly:!0})}`:`${e.pairs.length} Distances`}function bJe(e,t,n,r){const i=function yJe(e,t,n){const r=Fc.create(128,64,n);for(let i=0,o=e.pairs.length;in.linesColor,()=>n.linesSize,a=>u8(t.pairs[a],n))}function _Je(e,t,n,r){const i=function vJe(e,t,n){const r=wf.create(t,128,64,n);for(let i=0,o=e.pairs.length;in.textColor,()=>n.textSize,a=>u8(t.pairs[a],n))}function ace(e){return{pairs:[{loci:[e[0].loci,e[1].loci]}]}}function cce(e){return{triples:[{loci:[e[0].loci,e[1].loci,e[2].loci]}]}}function uce(e){return{quads:[{loci:[e[0].loci,e[1].loci,e[2].loci,e[3].loci]}]}}function lce(e){return{infos:[{loci:e[0].loci}]}}function dce(e){return{locis:e.map(t=>t.loci)}}function fce(e){return{locis:e.map(t=>t.loci)}}const SJe={...pE},pce={text:(e,t)=>Jo(IJe,vu.Utils)},hce={...SJe,scaleByRadius:C.Boolean(!0),visuals:C.MultiSelect(["text"],C.objectToOptions(pce)),snapshotKey:C.Text("",{isEssential:!0,disableInteractiveUpdates:!0,description:"Activate the snapshot with the provided key when clicking on the label"}),tooltip:C.Text("",{isEssential:!0,multiline:!0,disableInteractiveUpdates:!0,placeholder:"Tooltip",description:"Tooltip text to be displayed when hovering over the label"})},CJe=_e();function f8(e,t=!1){return e.label||uE(e.loci,{hidePrefix:!0,htmlStyling:!1,condensed:t})}function IJe(e,t,n,r){var i,o;const s=function AJe(e,t,n){const r=wf.create(t,128,64,n),i=t.customText.trim();for(let o=0,s=e.infos.length;oc:u?d=>u:d=>f8(t.infos[d]),qn.create(a,t,s,()=>n.textColor,()=>n.textSize,l)}const C0=v(),DJe=le.identity(),w0=new Float32Array(18),EJe=new Uint8Array([0,1,2,3,4,5]);v.zero(),v.zero();const _m=v(),MJe=v(),RJe=v(),kJe=v(),NJe=le.identity(),mce=new Float32Array(24),FJe=new Uint8Array([0,1,0,3,0,6,1,2,1,7,2,3,2,4,3,5,4,5,4,7,5,6,6,7]),OJe=le.identity(),gce=v();function p8(e,t,n,r,i,o){at.addPrimitive(e,function LJe(e,t,n,r,i){return v.add(gce,t,n),le.targetTo(e,t,gce,r),le.setTranslation(e,t),le.scale(e,e,i)}(OJe,t,n,r,i),_ie(o))}const h8={color:C.Color(xn.orange),scaleFactor:C.Numeric(1,{min:.1,max:10,step:.1}),radiusScale:C.Numeric(2,{min:.1,max:10,step:.1})},UJe={...Nt.Params,...h8},VJe={...Nt.Params,...h8},zJe={...Nt.Params,...h8},yce={axes:(e,t)=>Jo(HJe,Nt.Utils),box:(e,t)=>Jo($Je,Nt.Utils),ellipsoid:(e,t)=>Jo(KJe,Nt.Utils)},bce={...UJe,...VJe,...zJe,visuals:C.MultiSelect(["box"],C.objectToOptions(yce))};function HJe(e,t,n,r){const i=function jJe(e,t,n){const r=at.createState(256,128,n),i=De.getPrincipalAxesMany(e.locis);return Rs.scale(i.momentsAxes,i.momentsAxes,t.scaleFactor),r.currentGroup=0,function PJe(e,t,n,r,i){const{origin:o,dirA:s,dirB:a,dirC:c}=t;v.add(C0,o,s),v.toArray(v.add(C0,o,s),w0,0),v.toArray(v.sub(C0,o,s),w0,3),v.toArray(v.add(C0,o,a),w0,6),v.toArray(v.sub(C0,o,a),w0,9),v.toArray(v.add(C0,o,c),w0,12),v.toArray(v.sub(C0,o,c),w0,15);const u=fS(w0,EJe),l=Rs.volume(t),d=Math.cbrt(l)/300*n;at.addCage(e,DJe,u,d,r,i)}(r,i.momentsAxes,t.radiusScale,2,20),at.getMesh(r)}(t,n,r&&r.geometry),o=function GJe(e){return`Principal Axes of ${dE(e,{countsOnly:!0})}`}(t.locis);return qn.create(o,t,i,()=>n.color,()=>1,()=>o)}function $Je(e,t,n,r){const i=function WJe(e,t,n){const r=at.createState(256,128,n),i=De.getPrincipalAxesMany(e.locis);return Rs.scale(i.boxAxes,i.boxAxes,t.scaleFactor),r.currentGroup=0,function BJe(e,t,n,r,i){const{origin:o,dirA:s,dirB:a,dirC:c}=t,u=v.negate(MJe,s),l=v.negate(RJe,a),d=v.negate(kJe,c);let f=0;const p=function(y,b,x){v.copy(_m,o),v.add(_m,_m,y),v.add(_m,_m,b),v.add(_m,_m,x),v.toArray(_m,mce,f),f+=3};p(s,a,c),p(s,a,d),p(s,l,d),p(s,l,c),p(u,l,d),p(u,l,c),p(u,a,c),p(u,a,d);const m=fS(mce,FJe),h=Rs.volume(t),g=Math.cbrt(h)/300*n;at.addCage(e,NJe,m,g,r,i)}(r,i.boxAxes,t.radiusScale,2,20),at.getMesh(r)}(t,n,r&&r.geometry),o=function qJe(e){return`Oriented Box of ${dE(e,{countsOnly:!0})}`}(t.locis);return qn.create(o,t,i,()=>n.color,()=>1,()=>o)}function KJe(e,t,n,r){const i=function XJe(e,t,n){const r=at.createState(256,128,n),o=De.getPrincipalAxesMany(e.locis).boxAxes,{origin:s,dirA:a,dirB:c}=o,u=Rs.size(v(),o);v.scale(u,u,.5*t.scaleFactor);const l=v.create(u[2],u[1],u[0]);return r.currentGroup=0,p8(r,s,a,c,l,2),at.getMesh(r)}(t,n,r&&r.geometry),o=function YJe(e){return`Oriented Ellipsoid of ${dE(e,{countsOnly:!0})}`}(t.locis);return qn.create(o,t,i,()=>n.color,()=>1,()=>o)}const QJe={radius:1,segments:36,thetaStart:0,thetaLength:2*Math.PI};function vce(e){const{radius:t,segments:n,thetaStart:r,thetaLength:i}={...QJe,...e},o=i===2*Math.PI,s=o?n+1:n+2,a=new Float32Array(3*s),c=new Float32Array(3*s),u=new Uint32Array(3*n);a[0]=0,a[1]=0,a[2]=0,c[0]=0,c[1]=1,c[2]=0;for(let l=0,d=3;lJo(iet,di.Utils,{modifyState:n=>({...n,pickable:!1})}),arc:(e,t)=>Jo(set,di.Utils,{modifyState:n=>({...n,pickable:!1})}),sector:(e,t)=>Jo(cet,Nt.Utils,{modifyProps:n=>({...n,alpha:n.sectorOpacity}),modifyState:n=>({...n,markerActions:Us.Highlighting})}),text:(e,t)=>Jo(det,vu.Utils,{modifyState:n=>({...n,markerActions:Bt.None})})},Cce={...JJe,...eet,...tet,...pE,visuals:C.MultiSelect(["vectors","sector","text"],C.objectToOptions(Sce))},xm=v(),$S=le();function hE(e,t,n){const{sphereA:r,sphereB:i,sphereC:o}=t,{arcDirA:s,arcDirC:a,arcNormal:c}=t,[u,l,d]=e.loci;pn.getBoundingSphere(u,r),pn.getBoundingSphere(l,i),pn.getBoundingSphere(d,o),v.sub(s,r.center,i.center),v.sub(a,o.center,i.center),v.cross(c,s,a);const p=Math.min(v.magnitude(s),v.magnitude(a))*n;return t.radius=p,t.angle=v.angle(s,a),t}function wce(e,t){const{radius:n,angle:r}=e,i=t?PZ(r,n)/t:32;return le.targetTo($S,e.sphereB.center,e.sphereA.center,e.arcNormal),le.setTranslation($S,e.sphereB.center),le.mul($S,$S,le.rotY180),n5(vce({radius:n,thetaLength:r,segments:i}),$S)}const js=function net(){return{sphereA:_e(),sphereB:_e(),sphereC:_e(),arcDirA:v(),arcDirC:v(),arcNormal:v(),radius:0,angle:0}}();function mE(e){return 1===e.triples.length?`Angle ${l8(e.triples[0],{measureOnly:!0})}`:`${e.triples.length} Angles`}function iet(e,t,n,r){const i=function ret(e,t,n){const r=Fc.create(128,64,n);for(let i=0,o=e.triples.length;in.color,()=>n.linesSize,()=>"")}function set(e,t,n,r){const i=function oet(e,t,n){const r=Fc.create(128,64,n);for(let i=0,o=e.triples.length;in.color,()=>n.linesSize,()=>"")}function cet(e,t,n,r){const i=function aet(e,t,n){const r=at.createState(128,64,n);for(let i=0,o=e.triples.length;in.color,()=>1,a=>l8(t.triples[a]))}function det(e,t,n,r){const i=function uet(e,t,n){const r=wf.create(t,128,64,n);for(let i=0,o=e.triples.length;in.textColor,()=>n.textSize,a=>l8(t.triples[a]))}const Ace={color:C.Color(xn.lightgreen),arcScale:C.Numeric(.7,{min:.01,max:1,step:.01})},gE={...di.Params,...Ace,lineSizeAttenuation:C.Boolean(!0),linesSize:C.Numeric(.04,{min:.01,max:5,step:.01}),dashLength:C.Numeric(.04,{min:.01,max:.2,step:.01})},pet={...gE},het={...gE},met={...gE},get={...gE},yet={...Nt.Params,...Ace,ignoreLight:C.Boolean(!0),sectorOpacity:C.Numeric(.75,{min:0,max:1,step:.01})},Ice={vectors:(e,t)=>Jo(_et,di.Utils,{modifyState:n=>({...n,pickable:!1})}),extenders:(e,t)=>Jo(Tet,di.Utils,{modifyState:n=>({...n,pickable:!1})}),connector:(e,t)=>Jo(Cet,di.Utils,{modifyState:n=>({...n,pickable:!1})}),arms:(e,t)=>Jo(Aet,di.Utils,{modifyState:n=>({...n,pickable:!1})}),arc:(e,t)=>Jo(Eet,di.Utils,{modifyState:n=>({...n,pickable:!1})}),sector:(e,t)=>Jo(Met,Nt.Utils,{modifyProps:n=>({...n,alpha:n.sectorOpacity}),modifyState:n=>({...n,markerActions:Us.Highlighting})}),text:(e,t)=>Jo(ket,vu.Utils,{modifyState:n=>({...n,markerActions:Bt.None})})},Tce={...pet,...het,...met,...get,...yet,...pE,visuals:C.MultiSelect(["extenders","arms","sector","text"],C.objectToOptions(Ice))},Da=v(),YS=le();function A0(e,t,n){const{sphereA:r,sphereB:i,sphereC:o,sphereD:s,dirBA:a,dirCD:c,projA:u,projD:l}=t,{arcPointA:d,arcPointD:f,arcDirA:p,arcDirD:m,arcCenter:h,arcNormal:g}=t,[y,b,x,_]=e.loci;pn.getBoundingSphere(y,r),pn.getBoundingSphere(b,i),pn.getBoundingSphere(x,o),pn.getBoundingSphere(_,s),v.add(h,i.center,o.center),v.scale(h,h,.5),v.sub(a,r.center,i.center),v.sub(c,s.center,o.center),v.add(d,h,a),v.add(f,h,c),v.sub(g,o.center,i.center),v.orthogonalize(p,g,a),v.orthogonalize(m,g,c),v.projectPointOnVector(u,d,p,h),v.projectPointOnVector(l,f,m,h);const A=Math.min(v.distance(u,h),v.distance(l,h))*n;v.setMagnitude(p,p,A),v.setMagnitude(m,m,A),v.add(d,h,p),v.add(f,h,m),t.radius=A,t.angle=v.dihedralAngle(r.center,i.center,o.center,s.center),v.matchDirection(Da,g,v.sub(Da,d,r.center));const E=v.angle(a,Da),w=A/Math.cos(E-Wx);v.add(u,i.center,v.setMagnitude(Da,a,w)),v.matchDirection(Da,g,v.sub(Da,f,s.center));const D=v.angle(c,Da),I=A/Math.cos(D-Wx);return v.add(l,o.center,v.setMagnitude(Da,c,I)),t}function Dce(e,t){const{radius:n,angle:r}=e,i=t?PZ(r,n)/t:32;return le.targetTo(YS,e.arcCenter,r<0?e.arcPointD:e.arcPointA,e.arcNormal),le.setTranslation(YS,e.arcCenter),le.mul(YS,YS,le.rotY180),n5(vce({radius:n,thetaLength:Math.abs(r),segments:i}),YS)}const Xr=function bet(){return{sphereA:_e(),sphereB:_e(),sphereC:_e(),sphereD:_e(),dirBA:v(),dirCD:v(),projA:v(),projD:v(),arcPointA:v(),arcPointD:v(),arcDirA:v(),arcDirD:v(),arcCenter:v(),arcNormal:v(),radius:0,angle:0}}();function I0(e){return 1===e.quads.length?`Dihedral ${d8(e.quads[0],{measureOnly:!0})}`:`${e.quads.length} Dihedrals`}function _et(e,t,n,r){const i=function vet(e,t,n){const r=Fc.create(128,64,n);for(let i=0,o=e.quads.length;in.color,()=>n.linesSize,()=>"")}function Cet(e,t,n,r){const i=function xet(e,t,n){const r=Fc.create(128,64,n);for(let i=0,o=e.quads.length;in.color,()=>n.linesSize,()=>"")}function Aet(e,t,n,r){const i=function wet(e,t,n){const r=Fc.create(128,64,n);for(let i=0,o=e.quads.length;in.color,()=>n.linesSize,()=>"")}function Tet(e,t,n,r){const i=function Iet(e,t,n){const r=Fc.create(128,64,n);for(let i=0,o=e.quads.length;in.color,()=>n.linesSize,()=>"")}function Eet(e,t,n,r){const i=function Det(e,t,n){const r=Fc.create(128,64,n);for(let i=0,o=e.quads.length;in.color,()=>n.linesSize,()=>"")}function Met(e,t,n,r){const i=function Pet(e,t,n){const r=at.createState(128,64,n);for(let i=0,o=e.quads.length;in.color,()=>1,a=>d8(t.quads[a]))}function ket(e,t,n,r){const i=function Ret(e,t,n){const r=wf.create(t,128,64,n);for(let i=0,o=e.quads.length;in.textColor,()=>n.textSize,a=>d8(t.quads[a]))}const Fet=Rt.BuiltIn({name:"box-shape-3d",display:"Box Shape",from:pe.Root,to:pe.Shape.Provider,params:{bottomLeft:C.Vec3(v()),topRight:C.Vec3(v.create(1,1,1)),radius:C.Numeric(.15,{min:.01,max:4,step:.01}),color:C.Color(xn.red)}})({canAutoUpdate:()=>!0,apply:({params:e})=>Oe.create("Shape Representation",function(){var t=ie(function*(n){return new pe.Shape.Provider({label:"Box",data:e,params:Nt.Params,getShape:(r,i)=>{const o=m8(St.create(e.bottomLeft,e.topRight),e.radius);return qn.create("Box",i,o,()=>i.color,()=>1,()=>"Box")},geometryUtils:Nt.Utils},{label:"Box"})});return function(n){return t.apply(this,arguments)}}())});function m8(e,t,n){const r=v.sub(v(),e.max,e.min),i=le.fromTranslation(le(),v.create(.5,.5,.5)),o=le.fromScaling(le(),r),s=le.fromTranslation(le(),e.min),a=le.mul3(le(),s,o,i),c=at.createState(256,128,n);c.currentGroup=1,at.addCage(c,a,Uie(),t,2,20);const u=at.getMesh(c),l=v.scaleAndAdd(v(),e.min,r,.5),d=v.distance(e.min,l);return u.setBoundingSphere(_e.create(l,d)),u}const Ece={vertices:new Float32Array([-.5,.5,0,.5,.5,0,-.5,-.5,0,.5,-.5,0]),normals:new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1]),indices:new Uint32Array([0,2,1,1,2,3])};new Uint32Array([0,1,2,3,3,1,2,0]);const Let={...Nt.Params,color:C.Color(xn.orange),scaleFactor:C.Numeric(1,{min:.1,max:10,step:.1})},Pce={plane:(e,t)=>Jo(zet,Nt.Utils)},Mce={...Let,visuals:C.MultiSelect(["plane"],C.objectToOptions(Pce))},Sm=le(),g8=v();function zet(e,t,n,r){const i=function Vet(e,t,n){const r=at.createState(256,128,n),o=De.getPrincipalAxesMany(e.locis).boxAxes,s=function Oet(){return Ece}();return v.add(g8,o.origin,o.dirC),le.targetTo(Sm,g8,o.origin,o.dirB),le.scale(Sm,Sm,Rs.size(g8,o)),le.scaleUniformly(Sm,Sm,t.scaleFactor),le.setTranslation(Sm,o.origin),r.currentGroup=0,at.addPrimitive(r,Sm,s),at.addPrimitiveFlipped(r,Sm,s),at.getMesh(r)}(t,n,r&&r.geometry),o=function Uet(e){return`Best Fit Plane of ${dE(e,{countsOnly:!0})}`}(t.locis);return qn.create(o,t,i,()=>n.color,()=>1,()=>o)}const yE=Rt.BuiltIn({name:"structure-representation-3d",display:"3D Representation",from:pe.Molecule.Structure,to:pe.Molecule.Structure.Representation3D,params:(e,t)=>{const{registry:n,themes:r}=t.representation.structure,i=n.get(n.default.name);if(!e){const a={help:c=>{const{name:u,params:l}=c,f=r.colorThemeRegistry.get(u).factory({},l);return{description:f.description,legend:f.legend}}};return{type:C.Mapped(n.default.name,n.types,c=>C.Group(n.get(c).getParams(r,Ve.Empty))),colorTheme:C.Mapped(i.defaultColorTheme.name,r.colorThemeRegistry.types,c=>C.Group(r.colorThemeRegistry.get(c).getParams({structure:Ve.Empty})),a),sizeTheme:C.Mapped(i.defaultSizeTheme.name,r.sizeThemeRegistry.types,c=>C.Group(r.sizeThemeRegistry.get(c).getParams({structure:Ve.Empty})))}}const o={structure:e.data},s={help:a=>{const{name:c,params:u}=a,d=r.colorThemeRegistry.get(c).factory(o,u);return{description:d.description,legend:d.legend}}};return{type:C.Mapped(n.default.name,n.getApplicableTypes(e.data),a=>C.Group(n.get(a).getParams(r,e.data))),colorTheme:C.Mapped(i.defaultColorTheme.name,r.colorThemeRegistry.getApplicableTypes(o),a=>C.Group(r.colorThemeRegistry.get(a).getParams(o)),s),sizeTheme:C.Mapped(i.defaultSizeTheme.name,r.sizeThemeRegistry.getApplicableTypes(o),a=>C.Group(r.sizeThemeRegistry.get(a).getParams(o)))}}})({canAutoUpdate:({a:e,oldParams:t,newParams:n})=>e.data.elementCount<1e4||t.type.name===n.type.name&&"custom"!==n.type.params.quality,apply:({a:e,params:t},r)=>Oe.create("Structure Representation",function(){var i=ie(function*(o){var s,a;const c={runtime:o,assetManager:r.managers.asset},u=r.representation.structure.registry.get(t.type.name),l=(null===(s=u.getData)||void 0===s?void 0:s.call(u,e.data,t.type.params))||e.data;u.ensureCustomProperties&&(yield u.ensureCustomProperties.attach(c,l));const d=u.factory({webgl:null===(a=r.canvas3d)||void 0===a?void 0:a.webgl,...r.representation.structure.themes},u.getParams);yield Fo.ensureDependencies(c,r.representation.structure.themes,{structure:l},t),d.setTheme(Fo.create(r.representation.structure.themes,{structure:l},t));const f=t.type.params||{};return yield d.createOrUpdate(f,l).runInContext(o),new pe.Molecule.Structure.Representation3D({repr:d,sourceData:e.data},{label:u.label})});return function(o){return i.apply(this,arguments)}}()),update:({a:e,b:t,oldParams:n,newParams:r},o)=>Oe.create("Structure Representation",function(){var s=ie(function*(a){var c,u;if(r.type.name!==n.type.name)return Qe.UpdateResult.Recreate;const l=o.representation.structure.registry.get(r.type.name);if(null!==(c=l.mustRecreate)&&void 0!==c&&c.call(l,n.type.params,r.type.params))return Qe.UpdateResult.Recreate;const d=(null===(u=l.getData)||void 0===u?void 0:u.call(l,e.data,r.type.params))||e.data,f={runtime:a,assetManager:o.managers.asset};l.ensureCustomProperties&&(yield l.ensureCustomProperties.attach(f,d)),Fo.releaseDependencies(o.representation.structure.themes,{structure:t.data.sourceData},n),yield Fo.ensureDependencies(f,o.representation.structure.themes,{structure:d},r),t.data.repr.setTheme(Fo.create(o.representation.structure.themes,{structure:d},r));const p={...t.data.repr.props,...r.type.params};return yield t.data.repr.createOrUpdate(p,d).runInContext(a),t.data.sourceData=e.data,Qe.UpdateResult.Updated});return function(a){return s.apply(this,arguments)}}()),dispose({b:e,params:t},n){if(!e||!t)return;const r=e.data.sourceData,i=n.representation.structure.registry.get(t.type.name);i.ensureCustomProperties&&i.ensureCustomProperties.detach(r),Fo.releaseDependencies(n.representation.structure.themes,{structure:r},t)},interpolate(e,t,n){if("uniform"!==e.colorTheme.name||"uniform"!==t.colorTheme.name)return n<=.5?e:t;const o=st.interpolate(e.colorTheme.params.value,t.colorTheme.params.value,n);return{type:n<=.5?e.type:t.type,colorTheme:{name:"uniform",params:{value:o}},sizeTheme:n<=.5?e.sizeTheme:t.sizeTheme}}}),jet=Rt.BuiltIn({name:"unwind-structure-assembly-representation-3d",display:"Unwind Assembly 3D Representation",from:pe.Molecule.Structure.Representation3D,to:pe.Molecule.Structure.Representation3DState,params:{t:C.Numeric(0,{min:0,max:1,step:.01})}})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=new zv(n);return jae(n,r,t.t),new pe.Molecule.Structure.Representation3DState({state:{unitTransforms:r},initialState:{unitTransforms:new zv(n)},info:n,repr:e.data.repr},{label:`Unwind T = ${t.t.toFixed(2)}`})},update({a:e,b:t,newParams:n,oldParams:r}){const i=t.data.info;return e.data.sourceData!==i||e.data.repr!==t.data.repr?Qe.UpdateResult.Recreate:r.t===n.t?Qe.UpdateResult.Unchanged:(jae(i,t.data.state.unitTransforms,n.t),t.label=`Unwind T = ${n.t.toFixed(2)}`,t.data.repr=e.data.repr,Qe.UpdateResult.Updated)}}),Het=Rt.BuiltIn({name:"explode-structure-representation-3d",display:"Explode 3D Representation",from:pe.Molecule.Structure.Representation3D,to:pe.Molecule.Structure.Representation3DState,params:{t:C.Numeric(0,{min:0,max:1,step:.01})}})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=new zv(n);return qae(n,r,t.t,n.root.boundary.sphere),new pe.Molecule.Structure.Representation3DState({state:{unitTransforms:r},initialState:{unitTransforms:new zv(n)},info:n,repr:e.data.repr},{label:`Explode T = ${t.t.toFixed(2)}`})},update({a:e,b:t,newParams:n,oldParams:r}){const i=e.data.sourceData;return t.data.info!==i||e.data.repr!==t.data.repr?Qe.UpdateResult.Recreate:r.t===n.t?Qe.UpdateResult.Unchanged:(qae(i,t.data.state.unitTransforms,n.t,i.root.boundary.sphere),t.label=`Explode T = ${n.t.toFixed(2)}`,t.data.repr=e.data.repr,Qe.UpdateResult.Updated)}}),qet=Rt.BuiltIn({name:"spin-structure-representation-3d",display:"Spin 3D Representation",from:pe.Molecule.Structure.Representation3D,to:pe.Molecule.Structure.Representation3DState,params:{t:C.Numeric(0,{min:0,max:1,step:.01}),...JQe}})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=new zv(n),{axis:i,origin:o}=Wae(n.root,t);return Xae(n,r,t.t,i,o),new pe.Molecule.Structure.Representation3DState({state:{unitTransforms:r},initialState:{unitTransforms:new zv(n)},info:n,repr:e.data.repr},{label:`Spin T = ${t.t.toFixed(2)}`})},update({a:e,b:t,newParams:n,oldParams:r}){const i=e.data.sourceData;if(t.data.info!==i||e.data.repr!==t.data.repr)return Qe.UpdateResult.Recreate;if(r.t===n.t&&r.axis===n.axis&&r.origin===n.origin)return Qe.UpdateResult.Unchanged;const o=t.data.state.unitTransforms,{axis:s,origin:a}=Wae(i.root,n);return Xae(i,o,n.t,s,a),t.label=`Spin T = ${n.t.toFixed(2)}`,t.data.repr=e.data.repr,Qe.UpdateResult.Updated}}),Wet=Rt.BuiltIn({name:"overpaint-structure-representation-3d-from-script",display:"Overpaint 3D Representation",from:pe.Molecule.Structure.Representation3D,to:pe.Molecule.Structure.Representation3DState,params:()=>({layers:C.ObjectList({script:C.Script(ko("(sel.atom.all)","mol-script")),color:C.Color(xn.blueviolet),clear:C.Boolean(!1)},e=>`${e.clear?"Clear":st.toRgbString(e.color)}`,{defaultValue:[{script:ko("(sel.atom.all)","mol-script"),color:xn.blueviolet,clear:!1}]})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=e.data.repr.geometryVersion,i=Bo.ofScript(t.layers,n);return new pe.Molecule.Structure.Representation3DState({state:{overpaint:i},initialState:{overpaint:Bo.Empty},info:{structure:n,geometryVersion:r},repr:e.data.repr},{label:`Overpaint (${i.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info,o=e.data.sourceData;if(o!==i.structure||e.data.repr!==t.data.repr)return Qe.UpdateResult.Recreate;const s=e.data.repr.geometryVersion;if(s!==i.geometryVersion&&Tp(e.data.repr.props))return Qe.UpdateResult.Recreate;const a=t.data.state.overpaint,c=Bo.ofScript(n.layers,o);return Bo.areEqual(a,c)?Qe.UpdateResult.Unchanged:(i.geometryVersion=s,t.data.state.overpaint=c,t.data.repr=e.data.repr,t.label=`Overpaint (${c.layers.length} Layers)`,Qe.UpdateResult.Updated)}}),$et=Rt.BuiltIn({name:"overpaint-structure-representation-3d-from-bundle",display:"Overpaint 3D Representation",from:pe.Molecule.Structure.Representation3D,to:pe.Molecule.Structure.Representation3DState,params:()=>({layers:C.ObjectList({bundle:C.Value(Kn.Empty),color:C.Color(xn.blueviolet),clear:C.Boolean(!1)},e=>`${e.clear?"Clear":st.toRgbString(e.color)}`,{defaultValue:[{bundle:Kn.Empty,color:xn.blueviolet,clear:!1}],isHidden:!0})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=e.data.repr.geometryVersion,i=Bo.ofBundle(t.layers,n);return new pe.Molecule.Structure.Representation3DState({state:{overpaint:i},initialState:{overpaint:Bo.Empty},info:{structure:n,geometryVersion:r},repr:e.data.repr},{label:`Overpaint (${i.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info,o=e.data.sourceData;if(o!==i.structure||e.data.repr!==t.data.repr)return Qe.UpdateResult.Recreate;const s=e.data.repr.geometryVersion;if(s!==i.geometryVersion&&Tp(e.data.repr.props))return Qe.UpdateResult.Recreate;const a=t.data.state.overpaint,c=Bo.ofBundle(n.layers,o);return Bo.areEqual(a,c)?Qe.UpdateResult.Unchanged:(i.geometryVersion=s,t.data.state.overpaint=c,t.data.repr=e.data.repr,t.label=`Overpaint (${c.layers.length} Layers)`,Qe.UpdateResult.Updated)}}),Yet=Rt.BuiltIn({name:"transparency-structure-representation-3d-from-script",display:"Transparency 3D Representation",from:pe.Molecule.Structure.Representation3D,to:pe.Molecule.Structure.Representation3DState,params:()=>({layers:C.ObjectList({script:C.Script(ko("(sel.atom.all)","mol-script")),value:C.Numeric(.5,{min:0,max:1,step:.01},{label:"Transparency"})},e=>`Transparency (${e.value})`,{defaultValue:[{script:ko("(sel.atom.all)","mol-script"),value:.5}]})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=e.data.repr.geometryVersion,i=Vs.ofScript(t.layers,n);return new pe.Molecule.Structure.Representation3DState({state:{transparency:i},initialState:{transparency:Vs.Empty},info:{structure:n,geometryVersion:r},repr:e.data.repr},{label:`Transparency (${i.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info,o=e.data.sourceData;if(o!==i.structure||e.data.repr!==t.data.repr)return Qe.UpdateResult.Recreate;const s=e.data.repr.geometryVersion;if(s!==i.geometryVersion&&Tp(e.data.repr.props))return Qe.UpdateResult.Recreate;const a=t.data.state.transparency,c=Vs.ofScript(n.layers,o);return Vs.areEqual(a,c)?Qe.UpdateResult.Unchanged:(i.geometryVersion=s,t.data.state.transparency=c,t.data.repr=e.data.repr,t.label=`Transparency (${c.layers.length} Layers)`,Qe.UpdateResult.Updated)}}),Xet=Rt.BuiltIn({name:"transparency-structure-representation-3d-from-bundle",display:"Transparency 3D Representation",from:pe.Molecule.Structure.Representation3D,to:pe.Molecule.Structure.Representation3DState,params:()=>({layers:C.ObjectList({bundle:C.Value(Kn.Empty),value:C.Numeric(.5,{min:0,max:1,step:.01},{label:"Transparency"})},e=>`Transparency (${e.value})`,{defaultValue:[{bundle:Kn.Empty,value:.5}],isHidden:!0})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=e.data.repr.geometryVersion,i=Vs.ofBundle(t.layers,n);return new pe.Molecule.Structure.Representation3DState({state:{transparency:i},initialState:{transparency:Vs.Empty},info:{structure:n,geometryVersion:r},repr:e.data.repr},{label:`Transparency (${i.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info,o=e.data.sourceData;if(o!==i.structure||e.data.repr!==t.data.repr)return Qe.UpdateResult.Recreate;const s=e.data.repr.geometryVersion;if(s!==i.geometryVersion&&Tp(e.data.repr.props))return Qe.UpdateResult.Recreate;const a=t.data.state.transparency,c=Vs.ofBundle(n.layers,o);return Vs.areEqual(a,c)?Qe.UpdateResult.Unchanged:(i.geometryVersion=s,t.data.state.transparency=c,t.data.repr=e.data.repr,t.label=`Transparency (${c.layers.length} Layers)`,Qe.UpdateResult.Updated)}}),Ket=Rt.BuiltIn({name:"substance-structure-representation-3d-from-script",display:"Substance 3D Representation",from:pe.Molecule.Structure.Representation3D,to:pe.Molecule.Structure.Representation3DState,params:()=>({layers:C.ObjectList({script:C.Script(ko("(sel.atom.all)","mol-script")),material:ba.getParam(),clear:C.Boolean(!1)},e=>`${e.clear?"Clear":ba.toString(e.material)}`,{defaultValue:[{script:ko("(sel.atom.all)","mol-script"),material:ba({roughness:1}),clear:!1}]})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=e.data.repr.geometryVersion,i=zs.ofScript(t.layers,n);return new pe.Molecule.Structure.Representation3DState({state:{substance:i},initialState:{substance:zs.Empty},info:{structure:n,geometryVersion:r},repr:e.data.repr},{label:`Substance (${i.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info,o=e.data.sourceData;if(o!==i.structure||e.data.repr!==t.data.repr)return Qe.UpdateResult.Recreate;const s=e.data.repr.geometryVersion;if(s!==i.geometryVersion&&Tp(e.data.repr.props))return Qe.UpdateResult.Recreate;const a=t.data.state.substance,c=zs.ofScript(n.layers,o);return zs.areEqual(a,c)?Qe.UpdateResult.Unchanged:(i.geometryVersion=s,t.data.state.substance=c,t.data.repr=e.data.repr,t.label=`Substance (${c.layers.length} Layers)`,Qe.UpdateResult.Updated)}}),Zet=Rt.BuiltIn({name:"substance-structure-representation-3d-from-bundle",display:"Substance 3D Representation",from:pe.Molecule.Structure.Representation3D,to:pe.Molecule.Structure.Representation3DState,params:()=>({layers:C.ObjectList({bundle:C.Value(Kn.Empty),material:ba.getParam(),clear:C.Boolean(!1)},e=>`${e.clear?"Clear":ba.toString(e.material)}`,{defaultValue:[{bundle:Kn.Empty,material:ba({roughness:1}),clear:!1}],isHidden:!0})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=e.data.repr.geometryVersion,i=zs.ofBundle(t.layers,n);return new pe.Molecule.Structure.Representation3DState({state:{substance:i},initialState:{substance:zs.Empty},info:{structure:n,geometryVersion:r},repr:e.data.repr},{label:`Substance (${i.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info,o=e.data.sourceData;if(o!==i.structure||e.data.repr!==t.data.repr)return Qe.UpdateResult.Recreate;const s=e.data.repr.geometryVersion;if(s!==i.geometryVersion&&Tp(e.data.repr.props))return Qe.UpdateResult.Recreate;const a=t.data.state.substance,c=zs.ofBundle(n.layers,o);return zs.areEqual(a,c)?Qe.UpdateResult.Unchanged:(i.geometryVersion=s,t.data.state.substance=c,t.data.repr=e.data.repr,t.label=`Substance (${c.layers.length} Layers)`,Qe.UpdateResult.Updated)}}),Qet=Rt.BuiltIn({name:"clipping-structure-representation-3d-from-script",display:"Clipping 3D Representation",from:pe.Molecule.Structure.Representation3D,to:pe.Molecule.Structure.Representation3DState,params:()=>({layers:C.ObjectList({script:C.Script(ko("(sel.atom.all)","mol-script")),groups:C.Converted(e=>Yr.Groups.toNames(e),e=>Yr.Groups.fromNames(e),C.MultiSelect(RI(Yr.Groups.Names),C.objectToOptions(Yr.Groups.Names)))},e=>`${Yr.Groups.toNames(e.groups).length} group(s)`,{defaultValue:[{script:ko("(sel.atom.all)","mol-script"),groups:Yr.Groups.Flag.None}]})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=Yr.ofScript(t.layers,n);return new pe.Molecule.Structure.Representation3DState({state:{clipping:r},initialState:{clipping:Yr.Empty},info:n,repr:e.data.repr},{label:`Clipping (${r.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info;if(e.data.sourceData!==i||e.data.repr!==t.data.repr)return Qe.UpdateResult.Recreate;const o=t.data.state.clipping,s=Yr.ofScript(n.layers,i);return Yr.areEqual(o,s)?Qe.UpdateResult.Unchanged:(t.data.state.clipping=s,t.data.repr=e.data.repr,t.label=`Clipping (${s.layers.length} Layers)`,Qe.UpdateResult.Updated)}}),Jet=Rt.BuiltIn({name:"clipping-structure-representation-3d-from-bundle",display:"Clipping 3D Representation",from:pe.Molecule.Structure.Representation3D,to:pe.Molecule.Structure.Representation3DState,params:()=>({layers:C.ObjectList({bundle:C.Value(Kn.Empty),groups:C.Converted(e=>Yr.Groups.toNames(e),e=>Yr.Groups.fromNames(e),C.MultiSelect(RI(Yr.Groups.Names),C.objectToOptions(Yr.Groups.Names)))},e=>`${Yr.Groups.toNames(e.groups).length} group(s)`,{defaultValue:[{bundle:Kn.Empty,groups:Yr.Groups.Flag.None}],isHidden:!0})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=Yr.ofBundle(t.layers,n);return new pe.Molecule.Structure.Representation3DState({state:{clipping:r},initialState:{clipping:Yr.Empty},info:n,repr:e.data.repr},{label:`Clipping (${r.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info;if(e.data.sourceData!==i||e.data.repr!==t.data.repr)return Qe.UpdateResult.Recreate;const o=t.data.state.clipping,s=Yr.ofBundle(n.layers,i);return Yr.areEqual(o,s)?Qe.UpdateResult.Unchanged:(t.data.state.clipping=s,t.data.repr=e.data.repr,t.label=`Clipping (${s.layers.length} Layers)`,Qe.UpdateResult.Updated)}}),ett=Rt.BuiltIn({name:"theme-strength-representation-3d",display:"Theme Strength 3D Representation",from:pe.Molecule.Structure.Representation3D,to:pe.Molecule.Structure.Representation3DState,params:()=>({overpaintStrength:C.Numeric(1,{min:0,max:1,step:.01}),transparencyStrength:C.Numeric(1,{min:0,max:1,step:.01}),substanceStrength:C.Numeric(1,{min:0,max:1,step:.01})})})({canAutoUpdate:()=>!0,apply:({a:e,params:t})=>new pe.Molecule.Structure.Representation3DState({state:{themeStrength:{overpaint:t.overpaintStrength,transparency:t.transparencyStrength,substance:t.substanceStrength}},initialState:{themeStrength:{overpaint:1,transparency:1,substance:1}},info:{},repr:e.data.repr},{label:"Theme Strength",description:`${t.overpaintStrength.toFixed(2)}, ${t.transparencyStrength.toFixed(2)}, ${t.substanceStrength.toFixed(2)}`}),update({a:e,b:t,newParams:n}){var i,o,s;return n.overpaintStrength===(null===(i=t.data.state.themeStrength)||void 0===i?void 0:i.overpaint)&&n.transparencyStrength===(null===(o=t.data.state.themeStrength)||void 0===o?void 0:o.transparency)&&n.substanceStrength===(null===(s=t.data.state.themeStrength)||void 0===s?void 0:s.substance)?Qe.UpdateResult.Unchanged:(t.data.state.themeStrength={overpaint:n.overpaintStrength,transparency:n.transparencyStrength,substance:n.substanceStrength},t.data.repr=e.data.repr,t.label="Theme Strength",t.description=`${n.overpaintStrength.toFixed(2)}, ${n.transparencyStrength.toFixed(2)}, ${n.substanceStrength.toFixed(2)}`,Qe.UpdateResult.Updated)},interpolate:(e,t,n)=>({overpaintStrength:ci(e.overpaintStrength,t.overpaintStrength,n),transparencyStrength:ci(e.transparencyStrength,t.transparencyStrength,n),substanceStrength:ci(e.substanceStrength,t.substanceStrength,n)})});var Af;!function(e){e.getDefaultParams=function t(i,o,s,a,c,u,l,d){const f=i.representation.volume.registry.get(o),p=i.representation.volume.themes.colorThemeRegistry.get(c||f.defaultColorTheme.name),m=i.representation.volume.themes.sizeThemeRegistry.get(l||f.defaultSizeTheme.name),h=C.getDefaultValues(f.getParams(i.representation.volume.themes,s));return{type:{name:o,params:a?{...h,...a}:h},colorTheme:{name:p.name,params:u?{...p.defaultValues,...u}:p.defaultValues},sizeTheme:{name:m.name,params:d?{...m.defaultValues,...d}:m.defaultValues}}},e.getDefaultParamsStatic=function n(i,o,s,a,c,u,l){const d=i.representation.volume.registry.get(o),f=i.representation.volume.themes.colorThemeRegistry.get(a||d.defaultColorTheme.name),p=i.representation.volume.themes.sizeThemeRegistry.get(u||d.defaultSizeTheme.name);return{type:{name:o,params:s?{...d.defaultValues,...s}:d.defaultValues},colorTheme:{name:d.defaultColorTheme.name,params:c?{...f.defaultValues,...c}:f.defaultValues},sizeTheme:{name:d.defaultSizeTheme.name,params:l?{...p.defaultValues,...l}:p.defaultValues}}},e.getDescription=function r(i){var o,s,a,c;return i.isoValue?et.IsoValue.toString(i.isoValue):null!==(s=null===(o=i.renderMode)||void 0===o?void 0:o.params)&&void 0!==s&&s.isoValue?et.IsoValue.toString(null===(c=null===(a=i.renderMode)||void 0===a?void 0:a.params)||void 0===c?void 0:c.isoValue):void 0}}(Af||(Af={}));const ttt=Rt.BuiltIn({name:"volume-representation-3d",display:"3D Representation",from:pe.Volume.Data,to:pe.Volume.Representation3D,params:(e,t)=>{const{registry:n,themes:r}=t.representation.volume,i=n.get(n.default.name);if(!e)return{type:C.Mapped(n.default.name,n.types,s=>C.Group(n.get(s).getParams(r,et.One))),colorTheme:C.Mapped(i.defaultColorTheme.name,r.colorThemeRegistry.types,s=>C.Group(r.colorThemeRegistry.get(s).getParams({volume:et.One}))),sizeTheme:C.Mapped(i.defaultSizeTheme.name,r.sizeThemeRegistry.types,s=>C.Group(r.sizeThemeRegistry.get(s).getParams({volume:et.One})))};const o={volume:e.data};return{type:C.Mapped(n.default.name,n.types,s=>C.Group(n.get(s).getParams(r,e.data))),colorTheme:C.Mapped(i.defaultColorTheme.name,r.colorThemeRegistry.getApplicableTypes(o),s=>C.Group(r.colorThemeRegistry.get(s).getParams(o))),sizeTheme:C.Mapped(i.defaultSizeTheme.name,r.sizeThemeRegistry.getApplicableTypes(o),s=>C.Group(r.sizeThemeRegistry.get(s).getParams(o)))}}})({canAutoUpdate:({oldParams:e,newParams:t})=>e.type.name===t.type.name,apply:({a:e,params:t},n)=>Oe.create("Volume Representation",function(){var r=ie(function*(i){var o;const s={runtime:i,assetManager:n.managers.asset},a=n.representation.volume.registry.get(t.type.name);a.ensureCustomProperties&&(yield a.ensureCustomProperties.attach(s,e.data));const c=a.factory({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.volume.themes},a.getParams);c.setTheme(Fo.create(n.representation.volume.themes,{volume:e.data},t));const u=t.type.params||{};return yield c.createOrUpdate(u,e.data).runInContext(i),new pe.Volume.Representation3D({repr:c,sourceData:e.data},{label:a.label,description:Af.getDescription(u)})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,oldParams:n,newParams:r},i)=>Oe.create("Volume Representation",function(){var o=ie(function*(s){var a;if(r.type.name!==n.type.name)return null===(a=i.representation.volume.registry.get(n.type.name).ensureCustomProperties)||void 0===a||a.detach(e.data),Qe.UpdateResult.Recreate;const c={...t.data.repr.props,...r.type.params};return t.data.repr.setTheme(Fo.create(i.representation.volume.themes,{volume:e.data},r)),yield t.data.repr.createOrUpdate(c,e.data).runInContext(s),t.data.sourceData=e.data,t.description=Af.getDescription(c),Qe.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),ntt=Rt.BuiltIn({name:"shape-representation-3d",display:"3D Representation",from:pe.Shape.Provider,to:pe.Shape.Representation3D,params:(e,t)=>e?e.data.params:rt.Params})({canAutoUpdate:()=>!0,apply:({a:e,params:t},n)=>Oe.create("Shape Representation",function(){var r=ie(function*(i){const o={...C.getDefaultValues(e.data.params),...t},s=Jo(e.data.getShape,e.data.geometryUtils);return yield s.createOrUpdate(o,e.data.data).runInContext(i),new pe.Shape.Representation3D({repr:s,sourceData:e.data},{label:e.data.label})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Oe.create("Shape Representation",function(){var o=ie(function*(s){const a={...t.data.repr.props,...r};return yield t.data.repr.createOrUpdate(a,e.data.data).runInContext(s),t.data.sourceData=e.data,Qe.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),rtt=Rt.BuiltIn({name:"model-unitcell-3d",display:"Model Unit Cell",from:pe.Molecule.Model,to:pe.Shape.Representation3D,params:()=>({...Zae})})({isApplicable:e=>!!no.Provider.get(e.data),canAutoUpdate:({})=>!0,apply:({a:e,params:t},n)=>Oe.create("Model Unit Cell",function(){var r=ie(function*(i){var o;const s=no.Provider.get(e.data);if(!s)return li.Null;const a=Qae(e.data,s,t),c=function cJe(e,t){return yn.createMulti("Unit Cell",e,t,yn.StateBuilder,oJe)}({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.structure.themes},()=>Zae);return yield c.createOrUpdate(t,a).runInContext(i),new pe.Shape.Representation3D({repr:c,sourceData:a},{label:"Unit Cell",description:s.spacegroup.name})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:n})=>Oe.create("Model Unit Cell",function(){var r=ie(function*(i){const o=no.Provider.get(e.data);if(!o)return Qe.UpdateResult.Null;const s={...t.data.repr.props,...n},a=Qae(e.data,o,s);return yield t.data.repr.createOrUpdate(s,a).runInContext(i),t.data.sourceData=a,Qe.UpdateResult.Updated});return function(i){return r.apply(this,arguments)}}())}),itt=Rt.BuiltIn({name:"structure-bounding-box-3d",display:"Bounding Box",from:pe.Molecule.Structure,to:pe.Shape.Representation3D,params:{radius:C.Numeric(.05,{min:.01,max:4,step:.01},{isEssential:!0}),color:C.Color(xn.red,{isEssential:!0}),...Nt.Params}})({canAutoUpdate:()=>!0,apply:({a:e,params:t},n)=>Oe.create("Bounding Box",function(){var r=ie(function*(i){const o=Jo((s,a,c,u)=>{const l=m8(a.box,a.radius,u?.geometry);return qn.create("Bouding Box",a,l,()=>a.color,()=>1,()=>"Bounding Box")},Nt.Utils);return yield o.createOrUpdate(t,{box:e.data.boundary.box,radius:t.radius,color:t.color}).runInContext(i),new pe.Shape.Representation3D({repr:o,sourceData:e.data},{label:"Bounding Box"})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Oe.create("Bounding Box",function(){var o=ie(function*(s){return yield t.data.repr.createOrUpdate(r,{box:e.data.boundary.box,radius:r.radius,color:r.color}).runInContext(s),t.data.sourceData=e.data,Qe.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),ott=Rt.BuiltIn({name:"structure-selections-distance-3d",display:"3D Distance",from:pe.Molecule.Structure.Selections,to:pe.Shape.Representation3D,params:()=>({...ice})})({canAutoUpdate:({})=>!0,apply:({a:e,params:t},n)=>Oe.create("Structure Distance",function(){var r=ie(function*(i){var o;const s=ace(e.data),a=function xJe(e,t){return yn.createMulti("Distance",e,t,yn.StateBuilder,rce)}({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.structure.themes},()=>ice);return yield a.createOrUpdate(t,s).runInContext(i),new pe.Shape.Representation3D({repr:a,sourceData:s},{label:"Distance"})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Oe.create("Structure Distance",function(){var o=ie(function*(s){const a={...t.data.repr.props,...r},c=ace(e.data);return yield t.data.repr.createOrUpdate(a,c).runInContext(s),t.data.sourceData=c,Qe.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),stt=Rt.BuiltIn({name:"structure-selections-angle-3d",display:"3D Angle",from:pe.Molecule.Structure.Selections,to:pe.Shape.Representation3D,params:()=>({...Cce})})({canAutoUpdate:({})=>!0,apply:({a:e,params:t},n)=>Oe.create("Structure Angle",function(){var r=ie(function*(i){var o;const s=cce(e.data),a=function fet(e,t){return yn.createMulti("Angle",e,t,yn.StateBuilder,Sce)}({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.structure.themes},()=>Cce);return yield a.createOrUpdate(t,s).runInContext(i),new pe.Shape.Representation3D({repr:a,sourceData:s},{label:"Angle"})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Oe.create("Structure Angle",function(){var o=ie(function*(s){const a={...t.data.repr.props,...r},c=cce(e.data);return yield t.data.repr.createOrUpdate(a,c).runInContext(s),t.data.sourceData=c,Qe.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),att=Rt.BuiltIn({name:"structure-selections-dihedral-3d",display:"3D Dihedral",from:pe.Molecule.Structure.Selections,to:pe.Shape.Representation3D,params:()=>({...Tce})})({canAutoUpdate:({})=>!0,apply:({a:e,params:t},n)=>Oe.create("Structure Dihedral",function(){var r=ie(function*(i){var o;const s=uce(e.data),a=function Net(e,t){return yn.createMulti("Dihedral",e,t,yn.StateBuilder,Ice)}({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.structure.themes},()=>Tce);return yield a.createOrUpdate(t,s).runInContext(i),new pe.Shape.Representation3D({repr:a,sourceData:s},{label:"Dihedral"})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Oe.create("Structure Dihedral",function(){var o=ie(function*(s){const a={...t.data.repr.props,...r},c=uce(e.data);return yield t.data.repr.createOrUpdate(a,c).runInContext(s),t.data.sourceData=c,Qe.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),ctt=Rt.BuiltIn({name:"structure-selections-label-3d",display:"3D Label",from:pe.Molecule.Structure.Selections,to:pe.Shape.Representation3D,params:()=>({...hce})})({canAutoUpdate:({})=>!0,apply:({a:e,params:t},n)=>Oe.create("Structure Label",function(){var r=ie(function*(i){var o,s,a;const c=lce(e.data),u=function TJe(e,t){return yn.createMulti("Label",e,t,yn.StateBuilder,pce)}({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.structure.themes},()=>hce);yield u.createOrUpdate(t,c).runInContext(i);const l=!!(null!==(s=t.snapshotKey)&&void 0!==s&&s.trim()||null!==(a=t.tooltip)&&void 0!==a&&a.trim());return u.setState({pickable:l,markerActions:l?Us.Highlighting:Bt.None}),new pe.Shape.Representation3D({repr:u,sourceData:c},{label:"Label"})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Oe.create("Structure Label",function(){var o=ie(function*(s){var a,c;const u={...t.data.repr.props,...r},l=lce(e.data);yield t.data.repr.createOrUpdate(u,l).runInContext(s),t.data.sourceData=l;const d=!!(null!==(a=r.snapshotKey)&&void 0!==a&&a.trim()||null!==(c=r.tooltip)&&void 0!==c&&c.trim());return t.data.repr.setState({pickable:d,markerActions:d?Us.Highlighting:Bt.None}),Qe.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),utt=Rt.BuiltIn({name:"structure-selections-orientation-3d",display:"3D Orientation",from:pe.Molecule.Structure.Selections,to:pe.Shape.Representation3D,params:()=>({...bce})})({canAutoUpdate:({})=>!0,apply:({a:e,params:t},n)=>Oe.create("Structure Orientation",function(){var r=ie(function*(i){var o;const s=dce(e.data),a=function ZJe(e,t){const n=yn.createMulti("Orientation",e,t,yn.StateBuilder,yce);return n.setState({markerActions:Us.Highlighting}),n}({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.structure.themes},()=>bce);return yield a.createOrUpdate(t,s).runInContext(i),new pe.Shape.Representation3D({repr:a,sourceData:s},{label:"Orientation"})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Oe.create("Structure Orientation",function(){var o=ie(function*(s){const a={...t.data.repr.props,...r},c=dce(e.data);return yield t.data.repr.createOrUpdate(a,c).runInContext(s),t.data.sourceData=c,Qe.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),ltt=Rt.BuiltIn({name:"structure-selections-plane-3d",display:"3D Plane",from:pe.Molecule.Structure.Selections,to:pe.Shape.Representation3D,params:()=>({...Mce})})({canAutoUpdate:({})=>!0,apply:({a:e,params:t},n)=>Oe.create("Structure Plane",function(){var r=ie(function*(i){var o;const s=fce(e.data),a=function Get(e,t){const n=yn.createMulti("Plane",e,t,yn.StateBuilder,Pce);return n.setState({markerActions:Us.Highlighting}),n}({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.structure.themes},()=>Mce);return yield a.createOrUpdate(t,s).runInContext(i),new pe.Shape.Representation3D({repr:a,sourceData:s},{label:"Plane"})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Oe.create("Structure Plane",function(){var o=ie(function*(s){const a={...t.data.repr.props,...r},c=fce(e.data);return yield t.data.repr.createOrUpdate(a,c).runInContext(s),t.data.sourceData=c,Qe.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),Ye={Data:GP,Misc:jP,Model:HP,Volume:qP,Representation:$P,Shape:WP};function XS(e){let t;return e=e.replace(/^#/,""),[t,e]=[e.slice(6,8),e.slice(0,6)],[st.fromHexStyle("#"+e),1-+("0x"+(t||"ff"))/255]}const ftt=Qe.builderFactory("interactions")({name:"interactions",from:pe.Root,to:pe.Shape.Provider,params:{data:C.Value(void 0,{isHidden:!1})}})({apply:({params:e})=>new pe.Shape.Provider({label:"",data:e.data,params:Nt.Params,geometryUtils:Nt.Utils,getShape:(t,n)=>function dtt(e){const t=at.createState(512,512);for(let n=0;ne[n].color,()=>1,n=>e[n].label)}(n)},{label:""})});let KS=(()=>{class e{constructor(){this.settings$=new ou}set settings(n){this.settings$.next(this._settings=n)}get settings(){return this._settings}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();var eh;function ii(){const e=(t,n)=>t.commands.dispatch(e,n||{});return e.subscribe=(t,n)=>t.commands.subscribe(e,n),e.id=Hr.create22(),e}!function(e){e.create=function t(r){return r},e.getDuration=function n(r,i){var o,s;if(i.customDurationMs)return i.customDurationMs;const a=null===(s=(o=i.definition).getDuration)||void 0===s?void 0:s.call(o,i.params,r);return"fixed"===a?.kind?a.durationMs:void 0}}(eh||(eh={}));class ptt{constructor(){this.subs=new Map,this.disposing=!1}subscribe(t,n){let r=this.subs.get(t.id);return r||(r=[],this.subs.set(t.id,r)),r.push(n),{unsubscribe:()=>{const i=this.subs.get(t.id);if(!i)return;const o=i.indexOf(n);if(!(o<0)){for(let s=o+1;s{this.disposing?i("disposed"):this.subs.get(t.id)?this.resolve({cmd:t,params:n,resolve:r,reject:i}):r()})}dispose(){this.subs.clear()}resolve(t){var n=this;return ie(function*(){const r=n.subs.get(t.cmd.id);if(r)try{for(const i of r)yield i(t.params);t.resolve()}catch(i){t.reject(i)}else t.resolve()})()}}const Cn={State:{SetCurrentObject:ii(),ApplyAction:ii(),Update:ii(),RemoveObject:ii(),ToggleExpanded:ii(),ToggleVisibility:ii(),Snapshots:{Add:ii(),Replace:ii(),Move:ii(),Remove:ii(),Apply:ii(),Clear:ii(),Upload:ii(),Fetch:ii(),DownloadToFile:ii(),OpenFile:ii(),OpenUrl:ii()}},Interactivity:{Object:{Highlight:ii()},Structure:{Highlight:ii(),Select:ii()},ClearHighlights:ii()},Layout:{Update:ii()},Toast:{Show:ii(),Hide:ii()},Camera:{Reset:ii(),SetSnapshot:ii(),Focus:ii(),OrientAxes:ii(),ResetAxes:ii()},Canvas3D:{SetSettings:ii(),ResetSettings:ii()}},htt=eh.create({name:"built-in.animate-assembly-unwind",display:{name:"Unwind Assembly"},isExportable:!0,params:e=>{const t=[["all","All"]],n=e.state.data.select(In.Generators.rootsOfType(pe.Molecule.Structure));for(const r of n)t.push([r.transform.ref,r.obj.data.models[0].label]);return{durationInMs:C.Numeric(3e3,{min:100,max:1e4,step:100}),playOnce:C.Boolean(!1),target:C.Select(t[0][0],t)}},canApply:e=>({canApply:e.state.data.select(In.Generators.ofType(pe.Molecule.Structure.Representation3D,ur.RootRef)).length>0}),getDuration:e=>({kind:"fixed",durationMs:e.durationInMs}),initialState:()=>({t:0}),setup(e,t,n){const r=n.state.data,o=r.select(In.Generators.ofType(pe.Molecule.Structure.Representation3D,e.target&&"all"!==e.target?e.target:ur.RootRef)),s=r.build();let a=!1;for(const c of o)r.select(In.Generators.ofTransformer(Ye.Representation.UnwindStructureAssemblyRepresentation3D,c.transform.ref)).length>0||(a=!0,s.to(c).apply(Ye.Representation.UnwindStructureAssemblyRepresentation3D,{t:0},{tags:"animate-assembly-unwind"}));if(a)return s.commit({doNotUpdateCurrent:!0})},teardown(e,t,n){const r=n.state.data,i=r.select(In.Generators.ofType(pe.Molecule.Structure.Representation3DState).withTag("animate-assembly-unwind"));if(0===i.length)return;const o=r.build();for(const s of i)o.delete(s.transform.ref);return o.commit()},apply:(e,t,n)=>ie(function*(){const r=n.plugin.state.data,o=r.select(In.Generators.ofTransformer(Ye.Representation.UnwindStructureAssemblyRepresentation3D,n.params.target&&"all"!==n.params.target?n.params.target:ur.RootRef));if(0===o.length)return{kind:"finished"};const s=r.build();let c=e.t+(t.current-t.lastApplied)/n.params.durationInMs,u=!1;n.params.playOnce&&c>=1?(u=!0,c=1):c%=1;for(const l of o)s.to(l).update({t:c});return yield Cn.State.Update(n.plugin,{state:r,tree:s,options:{doNotLogTiming:!0}}),u?{kind:"finished"}:{kind:"next",state:{t:c}}})()}),bE=v(),Rce=v(),kce=_r(),mtt=eh.create({name:"built-in.animate-camera-spin",display:{name:"Camera Spin",description:"Spin the 3D scene around the x-axis in view space"},isExportable:!0,params:()=>({durationInMs:C.Numeric(4e3,{min:100,max:2e4,step:100}),speed:C.Numeric(1,{min:1,max:10,step:1},{description:"How many times to spin in the specified duration."}),direction:C.Select("cw",[["cw","Clockwise"],["ccw","Counter Clockwise"]],{cycle:!0})}),initialState:(e,t)=>{var n;return{snapshot:null===(n=t.canvas3d)||void 0===n?void 0:n.camera.getSnapshot()}},getDuration:e=>({kind:"fixed",durationMs:e.durationInMs}),teardown:(e,t,n)=>{var r;null===(r=n.canvas3d)||void 0===r||r.requestCameraReset({snapshot:t.snapshot,durationMs:0})},apply:(e,t,n)=>ie(function*(){var r,i;if(0===t.current)return{kind:"next",state:e};const o=e.snapshot;if(o.radiusMax<1e-4)return{kind:"finished"};const s=t.animation?(null===(r=t.animation)||void 0===r?void 0:r.currentFrame)/(t.animation.frameCount+1):os(t.current/n.params.durationInMs,0,1),a=2*Math.PI*s*n.params.speed*("ccw"===n.params.direction?-1:1);v.sub(bE,o.position,o.target),v.normalize(Rce,o.up),_r.setAxisAngle(kce,Rce,a),v.transformQuat(bE,bE,kce);const c=v.add(v(),o.target,bE);return null===(i=n.plugin.canvas3d)||void 0===i||i.requestCameraReset({snapshot:{...o,position:c},durationMs:0}),s>=.99999?{kind:"finished"}:{kind:"next",state:e}})()}),gtt=eh.create({name:"built-in.animate-model-index",display:{name:"Animate Trajectory"},isExportable:!0,params:()=>({mode:C.MappedStatic("loop",{palindrome:C.Group({}),loop:C.Group({direction:C.Select("forward",[["forward","Forward"],["backward","Backward"]])}),once:C.Group({direction:C.Select("forward",[["forward","Forward"],["backward","Backward"]])},{isFlat:!0})},{options:[["palindrome","Palindrome"],["loop","Loop"],["once","Once"]]}),duration:C.MappedStatic("fixed",{fixed:C.Group({durationInS:C.Numeric(5,{min:1,max:120,step:.1},{description:"Duration in seconds"})},{isFlat:!0}),computed:C.Group({targetFps:C.Numeric(30,{min:5,max:250,step:1},{label:"Target FPS"})},{isFlat:!0}),sequential:C.Group({maxFps:C.Numeric(30,{min:5,max:60,step:1})},{isFlat:!0})})}),canApply(e){const t=e.state.data,n=t.select(In.Generators.ofTransformer(Ye.Model.ModelFromTrajectory));for(const r of n){const i=In.findAncestorOfType(t.tree,t.cells,r.transform.ref,pe.Molecule.Trajectory);if(i&&i.obj&&i.obj.data.frameCount>1)return{canApply:!0}}return{canApply:!1,reason:"No trajectory to animate"}},getDuration:(e,t)=>{var n;if("fixed"===(null===(n=e.duration)||void 0===n?void 0:n.name))return{kind:"fixed",durationMs:1e3*e.duration.params.durationInS};if("computed"===e.duration.name){const r=t.state.data,i=r.select(In.Generators.ofTransformer(Ye.Model.ModelFromTrajectory));let o=0;for(const s of i){const a=In.findAncestorOfType(r.tree,r.cells,s.transform.ref,pe.Molecule.Trajectory);a&&a.obj&&(o=Math.max(Math.ceil(1e3*a.obj.data.frameCount/e.duration.params.targetFps),o))}return{kind:"fixed",durationMs:o}}return{kind:"unknown"}},initialState:()=>({}),apply:(e,t,n)=>ie(function*(){if("sequential"===n.params.duration.name&&t.current>0&&t.current-t.lastApplied<1e3/n.params.duration.params.maxFps)return{kind:"skip"};const r=n.plugin.state.data,i=r.select(In.Generators.ofTransformer(Ye.Model.ModelFromTrajectory));if(0===i.length)return{kind:"finished"};const o=r.build(),s=n.params,a=e.palindromeDirections||{};let c=!1,u=!0;for(const l of i){const d=In.findAncestorOfType(r.tree,r.cells,l.transform.ref,pe.Molecule.Trajectory);if(!d||!d.obj)continue;const f=d.obj;f.data.frameCount<=1||o.to(l).update(p=>{const m=f.data.frameCount;if(1===m)return p;if(u=!1,"sequential"===s.duration.name){let h=1;if("once"===s.mode.name){if(h="backward"===s.mode.params.direction?-1:1,-1===h&&0===p.modelIndex||1===h&&p.modelIndex===m-1)return c=!0,p}else"palindrome"===s.mode.name&&(h=0===p.modelIndex?1:p.modelIndex===m-1?-1:a[l.transform.ref]||1);a[l.transform.ref]=h;let g=(p.modelIndex+h)%m;return g<0&&(g+=m),c=c||-1===h&&0===g||1===h&&g===m-1,{modelIndex:g}}{const h="fixed"===s.duration.name?1e3*s.duration.params.durationInS:Math.ceil(1e3*f.data.frameCount/s.duration.params.targetFps);if("once"===s.mode.name&&t.current>=h)return c=!0,{modelIndex:f.data.frameCount-1};let g=t.current%h/h;return"loop"===s.mode.name&&"backward"===s.mode.params.direction&&(g=1-g),"palindrome"===s.mode.name&&(g*=2,g>1&&(g=2-g)),{modelIndex:Math.min(Math.floor(f.data.frameCount*g),f.data.frameCount-1)}}})}return u||(yield Cn.State.Update(n.plugin,{state:r,tree:o,options:{doNotLogTiming:!0}})),u||"once"===s.mode.name&&c?{kind:"finished"}:"palindrome"===s.mode.name?{kind:"next",state:{palindromeDirections:a}}:{kind:"next",state:{}}})()});function Nce(e,t){return y8.apply(this,arguments)}function y8(){return y8=ie(function*(e,t,n=!1){var r;t.snapshot.data&&(yield e.runTask(e.state.data.setSnapshot(t.snapshot.data))),t.snapshot.camera&&(null===(r=e.canvas3d)||void 0===r||r.requestCameraReset({snapshot:t.snapshot.camera.current,durationMs:n||"instant"===t.snapshot.camera.transitionStyle?0:t.snapshot.camera.transitionDurationInMs}))}),y8.apply(this,arguments)}const ytt=eh.create({name:"built-in.animate-state-snapshots",display:{name:"State Snapshots"},isExportable:!0,params:()=>({}),canApply(e){const t=e.managers.snapshot.state.entries;return t.size<2?{canApply:!1,reason:"At least 2 states required."}:t.some(n=>!!n?.snapshot.startAnimation)?{canApply:!1,reason:"Nested animations not supported."}:{canApply:e.managers.snapshot.state.entries.size>1}},setup(e,t,n){const r=n.managers.snapshot.state.entries.get(0);Nce(n,r,!0)},getDuration:(e,t)=>({kind:"fixed",durationMs:t.managers.snapshot.state.entries.toArray().reduce((n,r)=>{var i;return n+(null!==(i=r.snapshot.durationInMs)&&void 0!==i?i:0)},0)}),initialState:(e,t)=>{const n=t.managers.snapshot.state.entries.toArray();return{totalDuration:n.reduce((r,i)=>{var o;return r+(null!==(o=i.snapshot.durationInMs)&&void 0!==o?o:0)},0),snapshots:n,currentIndex:0}},apply:(e,t,n)=>ie(function*(){var r;if(t.current>=e.totalDuration)return{kind:"finished"};let i=0,o=0;for(const s of e.snapshots){if(i+=null!==(r=s.snapshot.durationInMs)&&void 0!==r?r:0,t.current=e.snapshots.length?{kind:"finished"}:o===e.currentIndex?{kind:"skip"}:(Nce(n.plugin,e.snapshots[o]),{kind:"next",state:{...e,currentIndex:o}})})()});var tr;!function(e){class t extends(pe.Create({name:"Root",typeClass:"Root"})){}e.Root=t;class n extends(pe.Create({name:"Category",typeClass:"Object"})){}e.Category=n;class r extends(pe.CreateBehavior({name:"Behavior"})){}e.Behavior=r,e.Categories={common:"Common",representation:"Representation",interaction:"Interaction","custom-props":"Custom Properties",misc:"Miscellaneous"},e.CreateCategory=Rt.BuiltIn({name:"create-behavior-category",display:{name:"Behavior Category"},from:t,to:n,params:{label:C.Text("",{isHidden:!0})}})({apply:({params:l})=>new n({},{label:l.label})});const i=new Map;e.getCategoryId=function o(l){return i.get(l.id)},e.create=function s(l){const d=Rt.CreateBuiltIn({name:l.name,display:l.display,from:[t],to:[r],params:l.params,apply({params:f},p){const m=l.label?l.label(f):{label:l.display.name,description:l.display.description};return new r(new l.ctor(p,f),m)},update:({b:f,newParams:p})=>Oe.create("Update Behavior",ie(function*(){return f.data.update&&(yield f.data.update(p))?Qe.UpdateResult.Updated:Qe.UpdateResult.Unchanged})),canAutoUpdate:l.canAutoUpdate});return i.set(d.id,l.category),d},e.simpleCommandHandler=function a(l,d){return class{register(){this.sub=l.subscribe(this.ctx,f=>d(f,this.ctx))}dispose(){this.sub&&this.sub.unsubscribe(),this.sub=void 0}constructor(f){this.ctx=f,this.sub=void 0}}},e.Handler=class c{subscribeCommand(d,f){this.subs.push(d.subscribe(this.ctx,f))}subscribeObservable(d,f){this.subs.push(d.subscribe(f))}track(d){this.subs.push(d)}dispose(){for(const d of this.subs)d.unsubscribe();this.subs=[]}update(d){return!EI(d,this.params)&&(this.params=d,!0)}constructor(d,f){this.ctx=d,this.params=f,this.subs=[]}},e.WithSubscribers=class u{subscribeCommand(d,f){this.subs.push(d.subscribe(this.plugin,f))}subscribeObservable(d,f){const p=d.subscribe(f);return this.subs.push(p),{unsubscribe:()=>{const m=this.subs.indexOf(p);m>=0&&(this.subs.splice(m,1),p.unsubscribe())}}}dispose(){for(const d of this.subs)d.unsubscribe();this.subs=[]}constructor(d,f){this.plugin=d,this.params=f,this.subs=[]}}}(tr||(tr={}));class ZS{constructor(){this.subs=void 0}subscribe(t,n){typeof this.subs>"u"&&(this.subs=[]);let r=t.subscribe(n);return this.subs.push(r),{unsubscribe:()=>{r&&this.subs&&Eg(this.subs,r)&&(r.unsubscribe(),r=void 0)}}}get ev(){return this._ev||(this._ev=wp.create())}dispose(){if(this._ev&&this._ev.dispose(),this.subs){for(const t of this.subs)t.unsubscribe();this.subs=void 0}}}class th extends ZS{updateState(...t){const n=this.state,r=function BZ(e,t){let n=e;for(let r=0;r{const o=s=>{s?r(s):i("no blob returned")};HTMLCanvasElement.prototype.toBlob?e.toBlob(o,t,n):function xtt(e,t,n,r){const i=atob(e.toDataURL(n,r).split(",")[1]),o=i.length,s=o>>2,a=new Uint8Array(o),c=new Uint32Array(a.buffer,0,s);let u=0;for(let d=0;d{class e extends th{getIndex(n){return this.state.entries.indexOf(n)}getEntry(n){if(n)return this.entryMap.get(n)}remove(n){const r=this.entryMap.get(n);r&&(r?.image&&this.plugin.managers.asset.delete(r.image),this.entryMap.delete(n),this.updateState({current:this.state.current===n?void 0:this.state.current,entries:this.state.entries.delete(this.getIndex(r))}),this.events.changed.next(void 0))}add(n){this.entryMap.set(n.snapshot.id,n),this.updateState({current:n.snapshot.id,entries:this.state.entries.push(n)}),this.events.changed.next(void 0)}replace(n,r,i){var o,s,a;const c=this.getEntry(n);if(!c)return;this.defaultSnapshotId=void 0,c?.image&&this.plugin.managers.asset.delete(c.image);const u=this.getIndex(c),l=e.Entry(r,{key:null!==(o=i?.key)&&void 0!==o?o:c.key,name:null!==(s=i?.name)&&void 0!==s?s:c.name,description:null!==(a=i?.description)&&void 0!==a?a:c.description,image:i?.image});this.entryMap.set(r.id,l),this.updateState({current:l.snapshot.id,entries:this.state.entries.set(u,l)}),this.events.changed.next(void 0)}move(n,r){const i=this.state.entries.size;if(i<2)return;const o=this.getEntry(n);if(!o)return;const s=this.getIndex(o);let a=(s+r)%i;a<0&&(a+=i);const c=this.state.entries.get(a),u=this.state.entries.asMutable();u.set(a,o),u.set(s,c),this.updateState({current:o.snapshot.id,entries:u.asImmutable()}),this.events.changed.next(void 0)}update(n,r){var i,o,s;const a=this.getIndex(n);if(a<0)return;const c=this.state.entries.set(a,{...n,key:(null===(i=r.key)||void 0===i?void 0:i.trim())||void 0,name:(null===(o=r.name)||void 0===o?void 0:o.trim())||void 0,description:(null===(s=r.description)||void 0===s?void 0:s.trim())||void 0});this.updateState({entries:c}),this.entryMap.set(n.snapshot.id,this.state.entries.get(a)),this.events.changed.next(void 0)}clear(){0!==this.state.entries.size&&(this.entryMap.forEach(n=>{n?.image&&this.plugin.managers.asset.delete(n.image)}),this.entryMap.clear(),this.updateState({current:void 0,entries:Cp()}),this.events.changed.next(void 0))}applyKey(n){const r=this.state.entries.find(i=>i.key===n);r&&(this.updateState({current:r.snapshot.id}),this.events.changed.next(void 0),this.plugin.state.setSnapshot(r.snapshot))}setCurrent(n){const r=this.getEntry(n);return r&&(this.updateState({current:n}),this.events.changed.next(void 0)),r&&r.snapshot}getNextId(n,r){const i=this.state.entries.size;if(!n){if(0===i)return;return this.state.entries.get(-1===r?i-1:0).snapshot.id}const o=this.getEntry(n);if(!o)return;let s=this.getIndex(o);return s<0?void 0:(s=(s+r)%i,s<0&&(s+=i),this.state.entries.get(s).snapshot.id)}setStateSnapshot(n){var r=this;return ie(function*(){r.clear();const i=Cp().asMutable();for(const c of n.entries)r.entryMap.set(c.snapshot.id,c),i.push(c);const o=n.current?n.current:n.entries.length>0?n.entries[0].snapshot.id:void 0;if(r.updateState({current:o,entries:i.asImmutable(),isPlaying:!1,nextSnapshotDelayInMs:n.playback?n.playback.nextSnapshotDelayInMs:e.DefaultNextSnapshotDelayInMs}),r.events.changed.next(void 0),!o)return;const s=r.getEntry(o),a=s&&s.snapshot;return a?(yield r.plugin.state.setSnapshot(a),n.playback&&n.playback.isPlaying&&r.play(!0),a):void 0})()}syncCurrent(n){var r=this;return ie(function*(){var i,o;const s=0===r.state.entries.size,a=1===r.state.entries.size&&r.state.current&&r.state.current===r.defaultSnapshotId;if(!s&&!a)return;const c=r.plugin.state.getSnapshot(n?.params),u=(null!==(o=null===(i=n?.params)||void 0===i?void 0:i.image)&&void 0!==o?o:r.plugin.state.snapshotParams.value.image)?yield e.getCanvasImageAsset(r.plugin,`${c.id}-image.png`):void 0;if(s)r.add(e.Entry(c,{name:n?.name,description:n?.description,image:u}));else if(a){const l=r.getEntry(r.state.current);l?.image&&r.plugin.managers.asset.delete(l.image),r.replace(r.state.current,c,{image:u})}r.defaultSnapshotId=c.id})()}getStateSnapshot(n){var r=this;return ie(function*(){return yield r.syncCurrent(n),{timestamp:+new Date,version:"4.0.1",name:n&&n.name,description:n&&n.description,current:r.state.current,playback:{isPlaying:!(!n||!n.playOnLoad),nextSnapshotDelayInMs:r.state.nextSnapshotDelayInMs},entries:r.state.entries.valueSeq().toArray()}})()}serialize(n){var r=this;return ie(function*(){const i=JSON.stringify(yield r.getStateSnapshot({params:n?.params}),null,2);if(!n?.type||"json"===n.type||"molj"===n.type)return new Blob([i],{type:"application/json;charset=utf-8"});{const o=new Uint8Array(sT(i));Xb(o,0,i);const s={"state.json":o},a=[];for(const{asset:u,file:l}of r.plugin.managers.asset.assets)a.push([u.id,u]),s[`assets/${u.id}`]=new Uint8Array(yield l.arrayBuffer());if(a.length>0){const u=JSON.stringify(a,null,2),l=new Uint8Array(sT(u));Xb(l,0,u),s["assets.json"]=l}const c=yield r.plugin.runTask(function mLe(e,t=!1){return Oe.create("Zip",n=>function gLe(e,t){return PO.apply(this,arguments)}(n,e,t))}(s));return new Blob([c],{type:"application/zip"})}})()}open(n){var r=this;return ie(function*(){try{const i=n.name.toLowerCase();if(i.endsWith("json")||i.endsWith("molj")){const o=yield r.plugin.runTask(bp(n,"string")),s=JSON.parse(o);e.isStateSnapshot(s)?yield r.setStateSnapshot(s):e.isStateSnapshot(s.data)?yield r.setStateSnapshot(s.data):yield r.plugin.state.setSnapshot(s)}else{const o=yield r.plugin.runTask(bp(n,"zip")),s=Object.create(null);$a(o,(l,d)=>{if("state.json"===d||"assets.json"===d)return;const f=d.substring(d.indexOf("/")+1);s[f]=l});const a=new File([o["state.json"]],"state.json"),c=yield r.plugin.runTask(bp(a,"string"));if(o["assets.json"]){const l=new File([o["assets.json"]],"assets.json"),d=JSON.parse(yield r.plugin.runTask(bp(l,"string")));for(const[f,p]of d)r.plugin.managers.asset.set(p,new File([s[f]],p.name))}const u=JSON.parse(c);yield r.setStateSnapshot(u)}r.events.opened.next(void 0)}catch(i){console.error(i),r.plugin.log.error("Error reading state")}})()}play(n=!1){if(this.updateState({isPlaying:!0}),n){const r=this.getEntry(this.state.current);if(!r)return void this.next();this.events.changed.next(void 0);const i=r.snapshot;this.timeoutHandle=setTimeout(this.next,typeof i.durationInMs<"u"?i.durationInMs:this.state.nextSnapshotDelayInMs)}else this.next()}stop(){this.updateState({isPlaying:!1}),typeof this.timeoutHandle<"u"&&clearTimeout(this.timeoutHandle),this.timeoutHandle=void 0,this.events.changed.next(void 0)}togglePlay(){this.state.isPlaying?(this.stop(),this.plugin.managers.animation.stop()):this.play()}dispose(){super.dispose(),this.entryMap.clear()}constructor(n){var r;super({current:void 0,entries:Cp(),isPlaying:!1,nextSnapshotDelayInMs:e.DefaultNextSnapshotDelayInMs}),r=this,this.plugin=n,this.entryMap=new Map,this.defaultSnapshotId=void 0,this.events={changed:this.ev(),opened:this.ev()},this.timeoutHandle=void 0,this.next=ie(function*(){r.timeoutHandle=void 0;const i=r.getNextId(r.state.current,1);if(!i||i===r.state.current)return void r.stop();const o=r.setCurrent(i);yield r.plugin.state.setSnapshot(o),r.state.isPlaying&&(r.timeoutHandle=setTimeout(r.next,typeof o.durationInMs<"u"?o.durationInMs:r.state.nextSnapshotDelayInMs))})}}return e.DefaultNextSnapshotDelayInMs=1500,e})();function Fce(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{const n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(n)}}function Bce(e,t="download"){if(e)if("download"in HTMLAnchorElement.prototype){const n=document.createElement("a");n.download=t,n.rel="noopener","string"==typeof e?(n.href=e,Fce(n)):(n.href=URL.createObjectURL(e),setTimeout(()=>URL.revokeObjectURL(n.href),4e4),setTimeout(()=>Fce(n)))}else if(typeof navigator<"u"&&navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(e,t);else{const n=window.navigator.userAgent,r=/Safari/i.test(n),i=/CriOS\/[\d]+/.test(n),o=s=>{!function Ctt(e){window.open(e,"_blank")||(window.location.href=e)}(i?s:s.replace(/^data:[^;]*;/,"data:attachment/file;"))};if((r||i)&&FileReader)if(e instanceof Blob){const s=new FileReader;s.onloadend=()=>o(s.result),s.readAsDataURL(e)}else o(e);else{const s=URL.createObjectURL("string"==typeof e?new Blob([e]):e);location.href=s,setTimeout(()=>URL.revokeObjectURL(s),4e4)}}}function x8(e,t){return`${e}${"/"===e[e.length-1]||"/"===t[0]?"":"/"}${t}`}!function(e){function i(){return(i=ie(function*(o,s){if(!o.helpers.viewportScreenshot)return;const a=o.helpers.viewportScreenshot.getPreview(512);if(!a)return;const c=yield v8(a.canvas,"png"),u=new File([c],s),l={kind:"file",id:Hr.create22(),name:s};return o.managers.asset.set(l,u),l})).apply(this,arguments)}e.Entry=function t(o,s){return{timestamp:+new Date,snapshot:o,...s}},e.isStateSnapshot=function n(o){return!!o&&!!o.timestamp&&!!o.entries},e.getCanvasImageAsset=function r(o,s){return i.apply(this,arguments)}}(qv||(qv={}));const wtt={get preferWebGl1(){if(typeof navigator>"u"||typeof window>"u")return!1;if(["Version/15.1 Safari","Version/15.2 Safari","Version/15.3 Safari"].some(i=>navigator.userAgent.indexOf(i)>0))return!0;const t=/iPad|iPhone|iPod/.test(navigator.userAgent),n=navigator.userAgent.includes("Macintosh"),r=navigator.maxTouchPoints>=4;return!window.MSStream&&(t||n&&r)}};class Att{toString(){return this.key}valueOf(){return this.key}constructor(t,n){this.key=t,this.defaultValue=n}}function fi(e,t){return new Att(e,t)}const qi={item:fi,General:{IsBusyTimeoutMs:fi("plugin-config.is-busy-timeout",750),DisableAntialiasing:fi("plugin-config.disable-antialiasing",!1),DisablePreserveDrawingBuffer:fi("plugin-config.disable-preserve-drawing-buffer",!1),PixelScale:fi("plugin-config.pixel-scale",1),PickScale:fi("plugin-config.pick-scale",.25),Transparency:fi("plugin-config.transparency","wboit"),PreferWebGl1:fi("plugin-config.prefer-webgl1",wtt.preferWebGl1),AllowMajorPerformanceCaveat:fi("plugin-config.allow-major-performance-caveat",!1),PowerPreference:fi("plugin-config.power-preference","high-performance")},State:{DefaultServer:fi("plugin-state.server","https://webchem.ncbr.muni.cz/molstar-state"),CurrentServer:fi("plugin-state.server","https://webchem.ncbr.muni.cz/molstar-state"),HistoryCapacity:fi("history-capacity.server",5)},VolumeStreaming:{Enabled:fi("volume-streaming.enabled",!0),DefaultServer:fi("volume-streaming.server","https://ds.litemol.org"),CanStream:fi("volume-streaming.can-stream",(e,t)=>1===e.models.length&&sn.probablyHasDensityMap(e.models[0])),EmdbHeaderServer:fi("volume-streaming.emdb-header-server","https://files.wwpdb.org/pub/emdb/structures")},Viewport:{ShowExpand:fi("viewer.show-expand-button",!0),ShowControls:fi("viewer.show-controls-button",!0),ShowSettings:fi("viewer.show-settings-button",!0),ShowSelectionMode:fi("viewer.show-selection-model-button",!0),ShowAnimation:fi("viewer.show-animation-button",!0),ShowTrajectoryControls:fi("viewer.show-trajectory-controls",!0)},Download:{DefaultPdbProvider:fi("download.default-pdb-provider","pdbe"),DefaultEmdbProvider:fi("download.default-emdb-provider","pdbe")},Structure:{SizeThresholds:fi("structure.size-thresholds",Ve.DefaultSizeThresholds),DefaultRepresentationPreset:fi("structure.default-representation-preset","auto"),DefaultRepresentationPresetParams:fi("structure.default-representation-preset-params",{}),SaccharideCompIdMapType:fi("structure.saccharide-comp-id-map-type","default")},Background:{Styles:fi("background.styles",[])}};class Itt{get(t){return this._config.has(t)?this._config.get(t):t.defaultValue}set(t,n){this._config.set(t,n)}delete(t){this._config.delete(t)}constructor(t){this._config=new Map,t&&t.forEach(([n,r])=>this._config.set(n,r))}}function Ttt(e){Oce(e),Lce(e),Uce(e),Vce(e),zce(e),Gce(e),jce(e),Hce(e),qce(e),Wce(e)}function Oce(e){e.state.events.object.created.subscribe(t=>{pe.isBehavior(t.obj)&&t.obj.data.register(t.ref)}),e.state.events.object.removed.subscribe(t=>{var n,r,i,o;pe.isBehavior(t.obj)&&(null===(r=(n=t.obj.data).unregister)||void 0===r||r.call(n),null===(o=(i=t.obj.data).dispose)||void 0===o||o.call(i))}),e.state.events.object.updated.subscribe(t=>{var n,r,i,o;"recreate"===t.action&&(t.oldObj&&pe.isBehavior(t.oldObj)&&(null===(r=(n=t.oldObj.data).unregister)||void 0===r||r.call(n),null===(o=(i=t.oldObj.data).dispose)||void 0===o||o.call(i)),t.obj&&pe.isBehavior(t.obj)&&t.obj.data.register(t.ref))})}function Lce(e){Cn.State.SetCurrentObject.subscribe(e,({state:t,ref:n})=>t.setCurrent(n))}function Uce(e){Cn.State.Update.subscribe(e,({state:t,tree:n,options:r})=>e.runTask(t.updateTree(n,r)))}function Vce(e){Cn.State.ApplyAction.subscribe(e,({state:t,action:n,ref:r})=>e.runTask(t.applyAction(n.action,n.params,r)))}function zce(e){function t(n,r){const i=n.build().delete(r);return e.runTask(n.updateTree(i))}Cn.State.RemoveObject.subscribe(e,({state:n,ref:r,removeParentGhosts:i})=>{if(!i)return t(n,r);{const o=n.tree;let s=o.transforms.get(r);if(s.parent===r)return t(n,r);for(;;){const a=o.children.get(s.parent);if(s.parent===s.ref||a.size>1)return t(n,s.ref);const c=o.transforms.get(s.parent);if(!c.state.isGhost)return t(n,s.ref);s=c}}})}function Gce(e){Cn.State.ToggleExpanded.subscribe(e,({state:t,ref:n})=>t.updateCellState(n,({isCollapsed:r})=>({isCollapsed:!r})))}function jce(e){Cn.State.ToggleVisibility.subscribe(e,({state:t,ref:n})=>Wv(t,n,!t.cells.get(n).state.isHidden))}function Wv(e,t,n){bo.doPreOrder(e.tree,e.transforms.get(t),{state:e,value:n},Dtt)}function Dtt(e,t,n){n.state.updateCellState(e.ref,{isHidden:n.value})}function Hce(e){Cn.Interactivity.Object.Highlight.subscribe(e,({state:t,ref:n})=>{if(!e.canvas3d||e.isBusy)return;e.managers.interactivity.lociHighlights.clearHighlights();const r="string"==typeof n?[n]:n;for(const i of r){const o=t.cells.get(i);if(o)if(pe.Molecule.Structure.is(o.obj))e.managers.interactivity.lociHighlights.highlight({loci:Ve.Loci(o.obj.data)},!1);else if(o&&pe.isRepresentation3D(o.obj)){const{repr:s}=o.obj.data;for(const a of s.getAllLoci())e.managers.interactivity.lociHighlights.highlight({loci:a,repr:s},!1)}else if(pe.Molecule.Structure.Selections.is(o.obj))for(const s of o.obj.data)e.managers.interactivity.lociHighlights.highlight({loci:s.loci},!1)}})}function qce(e){Cn.Interactivity.ClearHighlights.subscribe(e,()=>{e.managers.interactivity.lociHighlights.clearHighlights()})}function Wce(e){e.config.set(qi.State.CurrentServer,e.config.get(qi.State.DefaultServer)),Cn.State.Snapshots.Clear.subscribe(e,()=>{e.managers.snapshot.clear()}),Cn.State.Snapshots.Remove.subscribe(e,({id:t})=>{e.managers.snapshot.remove(t)}),Cn.State.Snapshots.Add.subscribe(e,function(){var t=ie(function*({key:n,name:r,description:i,params:o}){var s;const a=e.state.getSnapshot(o),c=(null!==(s=o?.image)&&void 0!==s?s:e.state.snapshotParams.value.image)?yield qv.getCanvasImageAsset(e,`${a.id}-image.png`):void 0,u=qv.Entry(a,{key:n,name:r,description:i,image:c});e.managers.snapshot.add(u)});return function(n){return t.apply(this,arguments)}}()),Cn.State.Snapshots.Replace.subscribe(e,function(){var t=ie(function*({id:n,params:r}){var i;const o=e.state.getSnapshot(r),s=(null!==(i=r?.image)&&void 0!==i?i:e.state.snapshotParams.value.image)?yield qv.getCanvasImageAsset(e,`${o.id}-image.png`):void 0;e.managers.snapshot.replace(n,e.state.getSnapshot(r),{image:s})});return function(n){return t.apply(this,arguments)}}()),Cn.State.Snapshots.Move.subscribe(e,({id:t,dir:n})=>{e.managers.snapshot.move(t,n)}),Cn.State.Snapshots.Apply.subscribe(e,({id:t})=>{const n=e.managers.snapshot.setCurrent(t);if(n)return e.state.setSnapshot(n)}),Cn.State.Snapshots.Upload.subscribe(e,function(){var t=ie(function*({name:n,description:r,playOnLoad:i,serverUrl:o}){return fetch(x8(o,`set?name=${encodeURIComponent(n||"")}&description=${encodeURIComponent(r||"")}`),{method:"POST",mode:"cors",referrer:"no-referrer",headers:{"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify(yield e.managers.snapshot.getStateSnapshot({name:n,description:r,playOnLoad:i}))})});return function(n){return t.apply(this,arguments)}}()),Cn.State.Snapshots.Fetch.subscribe(e,function(){var t=ie(function*({url:n}){const r=yield e.runTask(e.fetch({url:n,type:"json"}));yield e.managers.snapshot.setStateSnapshot(r.data)});return function(n){return t.apply(this,arguments)}}()),Cn.State.Snapshots.DownloadToFile.subscribe(e,function(){var t=ie(function*({name:n,type:r,params:i}){const o=`mol-star_state_${n||function Stt(){const e=new Date;return e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate()+"-"+e.getHours()+"-"+e.getMinutes()+"-"+e.getSeconds()}()}.${"json"===r?"molj":"molx"}`;Bce(yield e.managers.snapshot.serialize({type:r,params:i}),`${o}`)});return function(n){return t.apply(this,arguments)}}()),Cn.State.Snapshots.OpenFile.subscribe(e,({file:t})=>e.managers.snapshot.open(t)),Cn.State.Snapshots.OpenUrl.subscribe(e,function(){var t=ie(function*({url:n,type:r}){const i=yield e.runTask(e.fetch({url:n,type:"binary"}));return e.managers.snapshot.open(new File([i],`state.${r}`))});return function(n){return t.apply(this,arguments)}}())}function Ett(e){$ce(e),Yce(e),Xce(e)}function $ce(e){const t=e.state.data.events;t.object.created.subscribe(n=>{var r;pe.isRepresentation3D(n.obj)&&(S8(n.state.cells.get(n.ref),n.obj.data.repr),n.obj.data.repr.setState({syncManually:!0}),null===(r=e.canvas3d)||void 0===r||r.add(n.obj.data.repr))}),t.object.updated.subscribe(n=>{var r,i;n.oldObj&&pe.isRepresentation3D(n.oldObj)&&(null===(r=e.canvas3d)||void 0===r||r.remove(n.oldObj.data.repr),n.oldObj.data.repr.destroy()),pe.isRepresentation3D(n.obj)&&(S8(n.state.cells.get(n.ref),n.obj.data.repr),"recreate"===n.action&&n.obj.data.repr.setState({syncManually:!0}),null===(i=e.canvas3d)||void 0===i||i.add(n.obj.data.repr))}),t.object.removed.subscribe(n=>{var r;pe.isRepresentation3D(n.obj)&&(null===(r=e.canvas3d)||void 0===r||r.remove(n.obj.data.repr),n.obj.data.repr.destroy())})}function Yce(e){const t=e.state.data.events;t.object.created.subscribe(n=>{var r;if(!pe.Molecule.Structure.Representation3DState.is(n.obj))return;const i=n.obj.data;i.repr.setState(i.state),null===(r=e.canvas3d)||void 0===r||r.update(i.repr)}),t.object.updated.subscribe(n=>{var r;if(!pe.Molecule.Structure.Representation3DState.is(n.obj))return;const i=n.obj.data;i.repr.setState(i.state),null===(r=e.canvas3d)||void 0===r||r.update(i.repr)}),t.object.removed.subscribe(n=>{var r;if(!pe.Molecule.Structure.Representation3DState.is(n.obj))return;const i=n.obj.data;i.repr.setState(i.initialState),null===(r=e.canvas3d)||void 0===r||r.update(i.repr)})}function Xce(e){e.state.data.events.cell.stateUpdated.subscribe(t=>{var n;const r=t.state.cells.get(t.ref);pe.isRepresentation3D(r.obj)&&S8(r,r.obj.data.repr)&&(null===(n=e.canvas3d)||void 0===n||n.syncVisibility())})}function S8(e,t){return t.state.visible===!!e.state.isHidden&&(t.setState({visible:!e.state.isHidden}),!0)}function Ptt(e){Kce(e),Qce(e),Zce(e),Jce(e),eue(e)}function Kce(e){Cn.Camera.Reset.subscribe(e,t=>{e.managers.camera.reset(t?.snapshot,t?.durationMs)})}function Zce(e){Cn.Camera.SetSnapshot.subscribe(e,({snapshot:t,durationMs:n})=>{e.managers.camera.setSnapshot(t,n)})}function Qce(e){Cn.Camera.Focus.subscribe(e,({center:t,radius:n,durationMs:r})=>{e.managers.camera.focusSphere({center:t,radius:n},{durationMs:r}),e.events.canvas3d.settingsUpdated.next(void 0)})}function Jce(e){Cn.Camera.OrientAxes.subscribe(e,({structures:t,durationMs:n})=>{e.managers.camera.orientAxes(t,n)})}function eue(e){Cn.Camera.ResetAxes.subscribe(e,({durationMs:t})=>{e.managers.camera.resetAxes(t)})}function Lo(){return Lo.zero()}!function(e){e.zero=function t(){return{x:0,y:0,width:0,height:0}},e.create=function n(c,u,l,d){return{x:c,y:u,width:l,height:d}},e.clone=function r(c){return{...c}},e.copy=function i(c,u){return Object.assign(c,u)},e.set=function o(c,u,l,d,f){return c.x=u,c.y=l,c.width=d,c.height=f,c},e.toVec4=function s(c,u){return c[0]=u.x,c[1]=u.y,c[2]=u.width,c[3]=u.height,c},e.equals=function a(c,u){return c.x===u.x&&c.y===u.y&&c.width===u.width&&c.height===u.height}}(Lo||(Lo={}));const If=nn();function vE(e,t,n,r){const{x:i,y:o,width:s,height:a}=n,u=t[1]-o,l=t[2];return e[0]=2*(t[0]-i)/s-1,e[1]=2*u/a-1,e[2]=2*l-1,v.transformMat4(e,e,r)}function C8(e){if("object"==typeof e){if("buttons"in e)return e.buttons;if("which"in e){const t=e.which;if(2===t)return 4;if(3===t)return 2;if(t>0)return 1<=0)return 1<!0,pixelScale:1};var wu,Zi;!function(e){function t(o,s){return o.shift===s.shift&&o.alt===s.alt&&o.control===s.control&&o.meta===s.meta}function i(o={}){return{shift:!!o.shift,alt:!!o.alt,control:!!o.control,meta:!!o.meta}}e.None=i(),e.areEqual=t,e.areNone=function n(o){return t(o,e.None)},e.size=function r(o){if(!o)return 0;let s=0;return o.shift&&s++,o.alt&&s++,o.control&&s++,o.meta&&s++,s},e.create=i}(wu||(wu={})),function(e){let t;var n;e.has=ea.has,e.create=ea.create,(n=t=e.Flag||(e.Flag={}))[n.None=0]="None",n[n.Primary=1]="Primary",n[n.Secondary=2]="Secondary",n[n.Auxilary=4]="Auxilary",n[n.Forth=8]="Forth",n[n.Five=16]="Five"}(Zi||(Zi={}));const rue={key:"",code:"",modifiers:wu.None,x:-1,y:-1,pageX:-1,pageY:-1,preventDefault:Ag};var T0=function(e){return e[e.Stopped=0]="Stopped",e[e.Started=1]="Started",e[e.Moving=2]="Moving",e}(T0||{});function iue(){return{drag:new mr,interactionEnd:new mr,click:new mr,move:new mr,wheel:new mr,pinch:new mr,gesture:new mr,resize:new mr,leave:new mr,enter:new mr,modifiers:new mr,key:new mr,keyUp:new mr,keyDown:new mr,lock:new mr}}const Rtt=["Backspace","Delete"];var w8;!function(e){e.create=function t(r={}){const{noScroll:i,noContextMenu:o}={...nue,...r};return{noScroll:i,noContextMenu:o,pointerLock:!1,width:0,height:0,pixelRatio:1,...iue(),setPixelScale:Ag,requestPointerLock:Ag,exitPointerLock:Ag,dispose:Ag}},e.fromElement=function n(r,i={}){let{noScroll:o,noContextMenu:a,noPinchZoom:c,noTextSelect:u,mask:l,pixelScale:d,preventGestures:f}={...nue,...i},p=r.clientWidth*I(),m=r.clientHeight*I(),h=!1,g=Lo(),y=0,b=0;const x=Me(),_=Me(),S=Me(),A=Me(),E=Me(),w={shift:!1,alt:!1,control:!1,meta:!1},D={x:-1,y:-1,pageX:-1,pageY:-1};function I(){return window.devicePixelRatio*d}function R(){return{...w}}function T(Ue){return Ue.target===document.body||Ue.target===r}let z,M=T0.Stopped,N=!1,V=Zi.create(Zi.Flag.None),F=Zi.Flag.None,G=!1,L=!1;typeof window.ResizeObserver<"u"&&(z=new window.ResizeObserver(Ut));const j=iue(),{drag:Z,interactionEnd:$,wheel:ee,pinch:q,gesture:O,click:H,move:W,leave:Q,enter:fe,resize:X,modifiers:J,key:ce,keyUp:be,keyDown:ae,lock:me}=j;function ne(){h=r.ownerDocument.pointerLockElement===r,Ed(h),me.next(h)}function de(){console.error("Unable to use Pointer Lock API"),h=!1,Ed(h),me.next(h)}function we(Ue){l(Ue.clientX,Ue.clientY)&&a&&Ue.preventDefault()}function Le(Ue){w.alt=Ue.altKey,w.shift=Ue.shiftKey,w.control=Ue.ctrlKey,w.meta=Ue.metaKey}function We(){(V||w.shift||w.alt||w.meta||w.control)&&(V=0,w.shift=w.alt=w.control=w.meta=!1)}function U(Ue){let tn=!1;!w.alt&&Ue.altKey&&(tn=!0,w.alt=!0),!w.shift&&Ue.shiftKey&&(tn=!0,w.shift=!0),!w.control&&Ue.ctrlKey&&(tn=!0,w.control=!0),!w.meta&&Ue.metaKey&&(tn=!0,w.meta=!0),tn&&G&&J.next(R()),T(Ue)&&G&&ae.next({key:Ue.key,code:Ue.code,modifiers:R(),...D,preventDefault:()=>Ue.preventDefault()})}function Y(Ue){let tn=!1;w.alt&&!Ue.altKey&&(tn=!0,w.alt=!1),w.shift&&!Ue.shiftKey&&(tn=!0,w.shift=!1),w.control&&!Ue.ctrlKey&&(tn=!0,w.control=!1),w.meta&&!Ue.metaKey&&(tn=!0,w.meta=!1),tn&&G&&J.next(R()),Rtt.includes(Ue.key)&&ge(Ue),T(Ue)&&G&&be.next({key:Ue.key,code:Ue.code,modifiers:R(),...D,preventDefault:()=>Ue.preventDefault()})}function ge(Ue){!T(Ue)||!G||ce.next({key:Ue.key,code:Ue.code,modifiers:R(),...D,preventDefault:()=>Ue.preventDefault()})}function Se(Ue){const tn=Ue.touches[0],Ke=Ue.touches[1];return{clientX:(tn.clientX+Ke.clientX)/2,clientY:(tn.clientY+Ke.clientY)/2,pageX:(tn.pageX+Ke.pageX)/2,pageY:(tn.pageY+Ke.pageY)/2,target:Ue.target}}function Re(Ue){const tn=Ue.touches[0].pageX-Ue.touches[1].pageX,Ke=Ue.touches[0].pageY-Ue.touches[1].pageY;return Math.sqrt(tn*tn+Ke*Ke)}!function oe(){r.addEventListener("contextmenu",we,!1),r.addEventListener("wheel",dt,!1),r.addEventListener("mousedown",ut,!1),window.addEventListener("mousemove",Ct,!1),window.addEventListener("mouseup",Et,!1),r.addEventListener("touchstart",Xe,!1),r.addEventListener("touchmove",_t,!1),r.addEventListener("touchend",ot,!1),r.addEventListener("gesturechange",yt,!1),r.addEventListener("gesturestart",ve,!1),r.addEventListener("gestureend",xt,!1),window.addEventListener("blur",We),window.addEventListener("keyup",Y,!1),window.addEventListener("keydown",U,!1),window.addEventListener("keypress",ge,!1),document.addEventListener("pointerlockchange",ne,!1),document.addEventListener("pointerlockerror",de,!1),null!=z?z.observe(r.parentElement):window.addEventListener("resize",Ut,!1)}();let Ge,Ne=-1;const $e=Me(),tt=Me();function Xe(Ue){if(Ue.preventDefault(),Ge=void 0,Ne=-1,1===Ue.touches.length)Ne=0,Me.set($e,Ue.touches[0].pageX,Ue.touches[0].pageY),Ge=Ue.touches[0],V=F=Zi.Flag.Primary,ln(Ue.touches[0]);else if(2===Ue.touches.length){V=Zi.Flag.Secondary&Zi.Flag.Auxilary,F=Zi.Flag.Secondary,ln(Se(Ue));const tn=Re(Ue);y=tn,q.next({distance:tn,fraction:1,fractionDelta:0,delta:0,isStart:!0,buttons:V,button:F,modifiers:R()})}else 3===Ue.touches.length&&(V=F=Zi.Flag.Forth,ln(Se(Ue)))}function ot(Ue){if(Xt(),Ge&&Ne<=4){const tn=Ge;if(!l(tn.clientX,tn.clientY))return;hr(tt,tn);const{pageX:Ke,pageY:Pt}=Pi(tn),[Ht,Ur]=tt;H.next({x:Ht,y:Ur,pageX:Ke,pageY:Pt,buttons:V,button:F,modifiers:R()})}Ge=void 0}function _t(Ue){if(F=Zi.Flag.None,c&&(Ue.preventDefault(),Ue.stopPropagation(),Ue.originalEvent&&(Ue.originalEvent.preventDefault(),Ue.originalEvent.stopPropagation())),Ge=void 0,1===Ue.touches.length)V=Zi.Flag.Primary,Ge=Ue.touches[0],function ke(Ue){Ne<0||(Me.set(tt,Ue.touches[0].pageX,Ue.touches[0].pageY),Ne+=Me.distance($e,tt),Me.copy($e,tt))}(Ue),qe(Ue.touches[0]);else if(2===Ue.touches.length){const tn=Re(Ue),Ke=y-tn;if(Math.abs(Ke)<4)V=Zi.Flag.Secondary,qe(Se(Ue));else{V=Zi.Flag.Auxilary,Le(Ue);const Pt=y/tn;q.next({delta:Ke,fraction:Pt,fractionDelta:b-Pt,distance:tn,isStart:!1,buttons:V,button:F,modifiers:R()}),b=Pt}y=tn}else 3===Ue.touches.length&&(V=Zi.Flag.Forth,qe(Se(Ue)))}function ut(Ue){Le(Ue),V=C8(Ue),F=tue(Ue),ln(Ue)}function Ct(Ue){Le(Ue),V=C8(Ue),F=Zi.Flag.None,qe(Ue)}function Et(Ue){Le(Ue),V=C8(Ue),F=tue(Ue),function Qn(Ue){if(M=T0.Stopped,l(Ue.clientX,Ue.clientY)){if(hr(S,Ue),!L&&Me.distance(S,x)<4){const{pageX:tn,pageY:Ke}=Pi(Ue),[Pt,Ht]=S;H.next({x:Pt,y:Ht,pageX:tn,pageY:Ke,buttons:V,button:F,modifiers:R()})}L=!1}}(Ue),Xt()}function Xt(){$.next(void 0)}function ln(Ue){l(Ue.clientX,Ue.clientY)&&(hr(_,Ue),Me.copy(x,_),Nn(_)&&(M=T0.Started))}function qe(Ue){var tn;hr(S,Ue);const{pageX:Ke,pageY:Pt}=Pi(Ue),[Ht,Ur]=S,{movementX:Zs,movementY:Na}=Ue,gc=Nn(S)&&l(Ue.clientX,Ue.clientY);if(G&&!gc?Q.next(void 0):!G&&gc&&fe.next(void 0),G=gc,D.x=Ht,D.y=Ur,D.pageX=Ke,D.pageY=Pt,W.next({x:Ht,y:Ur,pageX:Ke,pageY:Pt,movementX:Zs,movementY:Na,buttons:V,button:F,modifiers:R(),inside:gc,onElement:Ue.target===r}),M===T0.Stopped||(u&&(null===(tn=Ue.preventDefault)||void 0===tn||tn.call(Ue)),Me.div(A,Me.sub(A,S,_),function hn(Ue){return Ue[0]=r.clientWidth,Ue[1]=r.clientHeight,Ue}(E)),Me.magnitude(A)=4&&(L=!0);const[Jm,eg]=A;Z.next({x:Ht,y:Ur,dx:Jm,dy:eg,pageX:Ke,pageY:Pt,buttons:V,button:F,modifiers:R(),isStart:yc}),Me.copy(_,S),M=T0.Moving}function dt(Ue){if(!l(Ue.clientX,Ue.clientY))return;hr(S,Ue);const{pageX:tn,pageY:Ke}=Pi(Ue),[Pt,Ht]=S;o&&Ue.preventDefault();const Ur=function ktt(e){let i=0,o=0,s=0,a=0,c=0;return"detail"in e&&(o=e.detail),"wheelDelta"in e&&(o=-e.wheelDelta/120),"wheelDeltaY"in e&&(o=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(i=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(i=o,o=0),s=10*i,a=10*o,"deltaY"in e&&(a=e.deltaY),"deltaX"in e&&(s=e.deltaX),"deltaZ"in e&&(c=e.deltaZ),(s||a||c)&&e.deltaMode&&(1===e.deltaMode?(s*=40,a*=40,c*=40):(s*=800,a*=800,c*=800)),s&&!i&&(i=s<1?-1:1),a&&!o&&(o=a<1?-1:1),{spinX:i,spinY:o,dx:s,dy:a,dz:c}}(Ue);V=F=Zi.Flag.Auxilary,(Ur.dx||Ur.dy||Ur.dz)&&ee.next({x:Pt,y:Ht,pageX:tn,pageY:Ke,...Ur,buttons:V,button:F,modifiers:R()})}function gt(Ue){var tn,Ke;f&&(Ue.preventDefault(),null===(tn=Ue.stopImmediatePropagation)||void 0===tn||tn.call(Ue),null===(Ke=Ue.stopPropagation)||void 0===Ke||Ke.call(Ue))}let se=0,he=0;function ve(Ue){gt(Ue),se=Ue.scale,he=Ue.rotation,O.next({scale:Ue.scale,rotation:Ue.rotation,deltaRotation:0,deltaScale:0,isStart:!0})}function Te(Ue,tn){O.next({scale:Ue.scale,rotation:Ue.rotation,deltaRotation:he-Ue.rotation,deltaScale:se-Ue.scale,isEnd:tn}),he=Ue.rotation,se=Ue.scale}function yt(Ue){gt(Ue),Te(Ue)}function xt(Ue){gt(Ue),Te(Ue,!0)}function Ut(){X.next({})}function Nn(Ue){if(r instanceof Window||r instanceof Document||r===document.body)return!0;{const tn=r.getBoundingClientRect();return Ue[0]>=0&&Ue[1]>=0&&Ue[0]{d=Ue,p=r.clientWidth*I(),m=r.clientHeight*I()},requestPointerLock:Ue=>{g=Ue,h||r.requestPointerLock()},exitPointerLock:()=>{h&&r.ownerDocument.exitPointerLock()},dispose:function K(){N||(N=!0,r.removeEventListener("contextmenu",we,!1),r.removeEventListener("wheel",dt,!1),r.removeEventListener("mousedown",ut,!1),window.removeEventListener("mousemove",Ct,!1),window.removeEventListener("mouseup",Et,!1),r.removeEventListener("touchstart",Xe,!1),r.removeEventListener("touchmove",_t,!1),r.removeEventListener("touchend",ot,!1),r.removeEventListener("gesturechange",yt,!1),r.removeEventListener("gesturestart",ve,!1),r.removeEventListener("gestureend",xt,!1),window.removeEventListener("blur",We),window.removeEventListener("keyup",Y,!1),window.removeEventListener("keydown",U,!1),window.removeEventListener("keypress",ge,!1),document.removeEventListener("pointerlockchange",ne,!1),document.removeEventListener("pointerlockerror",de,!1),ho.remove(),null!=z?(z.unobserve(r.parentElement),z.disconnect()):window.removeEventListener("resize",Ut,!1))}}}}(w8||(w8={}));var D0=function(e){return e[e.None=0]="None",e[e.Object=1]="Object",e[e.Instance=2]="Instance",e[e.Group=3]="Group",e}(D0||{}),_E=function(e){return e[e.None=0]="None",e[e.Depth=1]="Depth",e[e.Mask=2]="Mask",e}(_E||{});const A8={backgroundColor:C.Color(st(0),{description:"Background color of the 3D canvas"}),pickingAlphaThreshold:C.Numeric(.5,{min:0,max:1,step:.01},{description:"The minimum opacity value needed for an object to be pickable."}),interiorDarkening:C.Numeric(.5,{min:0,max:1,step:.01}),interiorColorFlag:C.Boolean(!0,{label:"Use Interior Color"}),interiorColor:C.Color(st.fromNormalizedRgb(.3,.3,.3)),colorMarker:C.Boolean(!0,{description:"Enable color marker"}),highlightColor:C.Color(st.fromNormalizedRgb(1,.4,.6)),selectColor:C.Color(st.fromNormalizedRgb(.2,1,.1)),dimColor:C.Color(st.fromNormalizedRgb(1,1,1)),highlightStrength:C.Numeric(.3,{min:0,max:1,step:.1}),selectStrength:C.Numeric(.3,{min:0,max:1,step:.1}),dimStrength:C.Numeric(0,{min:0,max:1,step:.1}),markerPriority:C.Select(1,[[1,"Highlight"],[2,"Select"]]),xrayEdgeFalloff:C.Numeric(1,{min:0,max:3,step:.1}),exposure:C.Numeric(1,{min:0,max:3,step:.01}),light:C.ObjectList({inclination:C.Numeric(150,{min:0,max:180,step:1}),azimuth:C.Numeric(320,{min:0,max:360,step:1}),color:C.Color(st.fromNormalizedRgb(1,1,1)),intensity:C.Numeric(.6,{min:0,max:5,step:.01})},e=>st.toHexString(e.color),{defaultValue:[{inclination:150,azimuth:320,color:st.fromNormalizedRgb(1,1,1),intensity:.6}]}),ambientColor:C.Color(st.fromNormalizedRgb(1,1,1)),ambientIntensity:C.Numeric(.4,{min:0,max:2,step:.01})},oue=v(),I8=v();function sue(e,t){const n=e.length,{direction:r,color:i}=t||{direction:new Array(3*n).fill(0),color:new Array(3*n).fill(0)};for(let o=0;o{var K,ne,de;if(ae.state.disposed||!ae.state.visible||!ae.state.pickable&&"pick"===me||!p0.intersectsSphere3D(R,ae.values.boundingSphere.ref.value))return;const[we,Le]=ae.values.uLod.ref.value;if(0!==we||0!==Le){const{center:Y,radius:ge}=ae.values.boundingSphere.ref.value,Se=Gi.distanceToPoint(D,Y);if(Se+geLe)return}ae.values.instanceGrid.ref.value.cellSize>1||ae.values.lodLevels?ae.cull(D,R,p,n.stats):ae.uncull();let We=!1;ae.values.dLightCount.ref.value!==c.count&&(k.update(ae.values.dLightCount,c.count),We=!0),ae.values.dColorMarker.ref.value!==a.colorMarker&&(k.update(ae.values.dColorMarker,a.colorMarker),We=!0),We&&ae.update();const U=ae.getProgram(me);if(o.currentProgramId!==U.id&&(V=!0,U.use()),V&&(U.setUniforms(N),U.bindTextures(h,0),V=!1),"directVolume"===ae.values.dGeometryType.ref.value){if("color"!==me)return;o.disable(i.CULL_FACE),o.frontFace(i.CCW),3===oe&&(o.disable(i.DEPTH_TEST),o.depthMask(!1))}else 1===oe?(o.enable(i.CULL_FACE),null!==(K=ae.values.dFlipSided)&&void 0!==K&&K.ref.value?(o.frontFace(i.CW),o.cullFace(i.FRONT)):(o.frontFace(i.CCW),o.cullFace(i.BACK))):2===oe?(o.enable(i.CULL_FACE),null!==(ne=ae.values.dFlipSided)&&void 0!==ne&&ne.ref.value?(o.frontFace(i.CW),o.cullFace(i.BACK)):(o.frontFace(i.CCW),o.cullFace(i.FRONT))):(ae.values.uDoubleSided?ae.values.uDoubleSided.ref.value||ae.values.hasReflection.ref.value?o.disable(i.CULL_FACE):o.enable(i.CULL_FACE):o.disable(i.CULL_FACE),null!==(de=ae.values.dFlipSided)&&void 0!==de&&de.ref.value?(o.frontFace(i.CW),o.cullFace(i.FRONT)):(o.frontFace(i.CCW),o.cullFace(i.BACK)));ae.render(me,h.length)},L=(ae,me,oe,K,ne)=>{GI(h,"tDepth",oe||m),k.update(M.uModel,ae.view),k.update(M.uModelView,le.mul(b,me.view,ae.view)),k.update(M.uInvModelView,le.invert(x,b)),k.update(M.uModelViewProjection,le.mul(S,b,me.projection)),k.update(M.uInvModelViewProjection,le.invert(A,S)),k.updateIfChanged(M.uRenderMask,K),k.updateIfChanged(M.uMarkingDepthTest,ne),o.enable(i.SCISSOR_TEST),o.colorMask(!0,!0,!0,!0);const{x:de,y:we,width:Le,height:We}=u;o.viewport(de,we,Le,We),o.scissor(de,we,Le,We),V=!0,o.currentRenderItemId=-1},H=(ae,me,oe)=>{var K,ne;lt&&n.timer.mark("Renderer.renderBlendedOpaque"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),L(ae,me,oe,1,!1);const{renderables:de}=ae;for(let we=0,Le=de.length;we{var K,ne;lt&&n.timer.mark("Renderer.renderBlendedTransparent"),o.enable(i.DEPTH_TEST),L(ae,me,oe,2,!1);const{renderables:de}=ae;f?o.blendFunc(i.ONE,i.ONE_MINUS_SRC_ALPHA):o.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA),o.enable(i.BLEND),o.depthMask(!0);for(let we=0,Le=de.length;we0)&&(null!==(K=We.values.uDoubleSided)&&void 0!==K&&K.ref.value?("opaque"!==(null===(ne=We.values.dTransparentBackfaces)||void 0===ne?void 0:ne.ref.value)&&F(We,"color",2),F(We,"color",1)):F(We,"color",0))}lt&&n.timer.markEnd("Renderer.renderBlendedTransparent")};return{clear:(ae,me)=>{o.enable(i.SCISSOR_TEST),o.enable(i.DEPTH_TEST),o.colorMask(!0,!0,!0,!0),o.depthMask(!0),f&&!me?o.clearColor(0,0,0,0):ae?o.clearColor(d[0],d[1],d[2],1):o.clearColor(1,1,1,1),i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT)},clearDepth:(ae=!1)=>{o.enable(i.SCISSOR_TEST),ae?(o.colorMask(!0,!0,!0,!0),o.clearColor(1,1,1,1),i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT)):(o.enable(i.DEPTH_TEST),o.depthMask(!0),i.clear(i.DEPTH_BUFFER_BIT))},update:(ae,me)=>{k.update(M.uView,ae.view),k.update(M.uInvView,le.invert(y,ae.view)),k.update(M.uProjection,ae.projection),k.update(M.uInvProjection,le.invert(_,ae.projection)),k.updateIfChanged(M.uIsOrtho,"orthographic"===ae.state.mode?1:0),k.update(M.uViewOffset,ae.viewOffset.enabled?Me.set(I,16*ae.viewOffset.offsetX,16*ae.viewOffset.offsetY):Me.set(I,0,0)),k.update(M.uCameraPosition,v.copy(w,ae.state.position)),k.update(M.uCameraDir,v.normalize(E,v.sub(E,ae.state.target,ae.state.position))),k.updateIfChanged(M.uFar,ae.far),k.updateIfChanged(M.uNear,ae.near),k.updateIfChanged(M.uFog,ae.state.fog>0),k.updateIfChanged(M.uFogFar,ae.fogFar),k.updateIfChanged(M.uFogNear,ae.fogNear),k.updateIfChanged(M.uTransparentBackground,f),p0.fromProjectionMatrix(R,ae.projectionView),Gi.copy(D,R[5]),D.constant-=Gi.distanceToPoint(D,w),k.update(M.uCameraPlane,Gi.toArray(D,M.uCameraPlane.ref.value,0)),k.updateIfChanged(M.uMarkerAverage,me.markerAverage)},renderPick:(ae,me,oe,K,ne)=>{lt&&n.timer.mark("Renderer.renderPick"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),L(ae,me,K,0,!1),k.updateIfChanged(M.uPickType,ne);const{renderables:de}=ae;for(let we=0,Le=de.length;we{lt&&n.timer.mark("Renderer.renderDepth"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),L(ae,me,oe,0,!1);const{renderables:K}=ae;for(let ne=0,de=K.length;ne{var K,ne;lt&&n.timer.mark("Renderer.renderDepthOpaque"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),L(ae,me,oe,1,!1);const{renderables:de}=ae;for(let we=0,Le=de.length;we{var K,ne;lt&&n.timer.mark("Renderer.renderDepthTransparent"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),L(ae,me,oe,2,!1);const{renderables:de}=ae;for(let we=0,Le=de.length;we0||U)&&F(We,"depth",0)}lt&&n.timer.markEnd("Renderer.renderDepthTransparent")},renderMarkingDepth:(ae,me,oe)=>{lt&&n.timer.mark("Renderer.renderMarkingDepth"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),L(ae,me,oe,0,!1),k.updateIfChanged(M.uMarkingType,_E.Depth);const{renderables:K}=ae;for(let ne=0,de=K.length;ne{lt&&n.timer.mark("Renderer.renderMarkingMask"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),L(ae,me,oe,0,!!oe),k.updateIfChanged(M.uMarkingType,_E.Mask);const{renderables:K}=ae;for(let ne=0,de=K.length;ne0&&F(K[ne],"marking",0);lt&&n.timer.markEnd("Renderer.renderMarkingMask")},renderBlended:(ae,me)=>{ae.hasOpaque&&H(ae,me,null),ae.opacityAverage<1&&W(ae,me,null)},renderBlendedOpaque:H,renderBlendedTransparent:W,renderBlendedVolume:(ae,me,oe)=>{lt&&n.timer.mark("Renderer.renderBlendedVolume"),o.blendFunc(i.ONE,i.ONE_MINUS_SRC_ALPHA),o.enable(i.BLEND),L(ae,me,oe,2,!1);const{renderables:K}=ae;for(let ne=0,de=K.length;ne{var K,ne,de,we;lt&&n.timer.mark("Renderer.renderWboitOpaque"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),L(ae,me,oe,1,!1);const{renderables:Le}=ae;for(let We=0,U=Le.length;We{var K,ne,de;lt&&n.timer.mark("Renderer.renderWboitTransparent"),L(ae,me,oe,2,!1);const{renderables:we}=ae;for(let Le=0,We=we.length;Le0||"directVolume"===U.values.dGeometryType.ref.value||"fuzzy"===(null===(de=U.values.dPointStyle)||void 0===de?void 0:de.ref.value)||"text"===U.values.dGeometryType.ref.value||ge)&&F(U,"color",0)}lt&&n.timer.markEnd("Renderer.renderWboitTransparent")},renderDpoitOpaque:(ae,me,oe)=>{var K,ne,de,we;lt&&n.timer.mark("Renderer.renderDpoitOpaque"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),L(ae,me,oe,1,!1);const{renderables:Le}=ae;for(let We=0,U=Le.length;We{var ne,de,we;lt&&n.timer.mark("Renderer.renderDpoitTransparent"),o.enable(i.BLEND),GI(h,"tDpoitDepth",K.depth),GI(h,"tDpoitFrontColor",K.frontColor),GI(h,"tDpoitBackColor",K.backColor),L(ae,me,oe,2,!1);const{renderables:Le}=ae;for(let We=0,U=Le.length;We0||"fuzzy"===(null===(we=Y.values.dPointStyle)||void 0===we?void 0:we.ref.value)||"text"===Y.values.dGeometryType.ref.value||Se)&&F(Y,"color",0)}lt&&n.timer.markEnd("Renderer.renderDpoitTransparent")},renderDpoitVolume:(ae,me,oe)=>{lt&&n.timer.mark("Renderer.renderDpoitVolume"),o.blendFunc(i.ONE,i.ONE_MINUS_SRC_ALPHA),o.enable(i.BLEND),L(ae,me,oe,2,!1);const{renderables:K}=ae;for(let ne=0,de=K.length;ne{void 0!==ae.backgroundColor&&ae.backgroundColor!==a.backgroundColor&&(a.backgroundColor=ae.backgroundColor,st.toVec3Normalized(d,a.backgroundColor),k.update(M.uFogColor,v.copy(M.uFogColor.ref.value,d))),void 0!==ae.pickingAlphaThreshold&&ae.pickingAlphaThreshold!==a.pickingAlphaThreshold&&(a.pickingAlphaThreshold=ae.pickingAlphaThreshold,k.update(M.uPickingAlphaThreshold,a.pickingAlphaThreshold)),void 0!==ae.interiorDarkening&&ae.interiorDarkening!==a.interiorDarkening&&(a.interiorDarkening=ae.interiorDarkening,k.update(M.uInteriorDarkening,a.interiorDarkening)),void 0!==ae.interiorColorFlag&&ae.interiorColorFlag!==a.interiorColorFlag&&(a.interiorColorFlag=ae.interiorColorFlag,k.update(M.uInteriorColorFlag,a.interiorColorFlag)),void 0!==ae.interiorColor&&ae.interiorColor!==a.interiorColor&&(a.interiorColor=ae.interiorColor,k.update(M.uInteriorColor,st.toVec3Normalized(M.uInteriorColor.ref.value,a.interiorColor))),void 0!==ae.colorMarker&&ae.colorMarker!==a.colorMarker&&(a.colorMarker=ae.colorMarker),void 0!==ae.highlightColor&&ae.highlightColor!==a.highlightColor&&(a.highlightColor=ae.highlightColor,k.update(M.uHighlightColor,st.toVec3Normalized(M.uHighlightColor.ref.value,a.highlightColor))),void 0!==ae.selectColor&&ae.selectColor!==a.selectColor&&(a.selectColor=ae.selectColor,k.update(M.uSelectColor,st.toVec3Normalized(M.uSelectColor.ref.value,a.selectColor))),void 0!==ae.dimColor&&ae.dimColor!==a.dimColor&&(a.dimColor=ae.dimColor,k.update(M.uDimColor,st.toVec3Normalized(M.uDimColor.ref.value,a.dimColor))),void 0!==ae.highlightStrength&&ae.highlightStrength!==a.highlightStrength&&(a.highlightStrength=ae.highlightStrength,k.update(M.uHighlightStrength,a.highlightStrength)),void 0!==ae.selectStrength&&ae.selectStrength!==a.selectStrength&&(a.selectStrength=ae.selectStrength,k.update(M.uSelectStrength,a.selectStrength)),void 0!==ae.dimStrength&&ae.dimStrength!==a.dimStrength&&(a.dimStrength=ae.dimStrength,k.update(M.uDimStrength,a.dimStrength)),void 0!==ae.markerPriority&&ae.markerPriority!==a.markerPriority&&(a.markerPriority=ae.markerPriority,k.update(M.uMarkerPriority,a.markerPriority)),void 0!==ae.xrayEdgeFalloff&&ae.xrayEdgeFalloff!==a.xrayEdgeFalloff&&(a.xrayEdgeFalloff=ae.xrayEdgeFalloff,k.update(M.uXrayEdgeFalloff,a.xrayEdgeFalloff)),void 0!==ae.exposure&&ae.exposure!==a.exposure&&(a.exposure=ae.exposure,k.update(M.uExposure,a.exposure)),void 0!==ae.light&&!Yd(ae.light,a.light)&&(a.light=ae.light,Object.assign(c,sue(ae.light,c)),k.update(M.uLightDirection,c.direction),k.update(M.uLightColor,c.color)),void 0!==ae.ambientColor&&ae.ambientColor!==a.ambientColor&&(a.ambientColor=ae.ambientColor,v.scale(T,st.toArrayNormalized(a.ambientColor,T,0),a.ambientIntensity),k.update(M.uAmbientColor,T)),void 0!==ae.ambientIntensity&&ae.ambientIntensity!==a.ambientIntensity&&(a.ambientIntensity=ae.ambientIntensity,v.scale(T,st.toArrayNormalized(a.ambientColor,T,0),a.ambientIntensity),k.update(M.uAmbientColor,T))},setViewport:(ae,me,oe,K)=>{o.viewport(ae,me,oe,K),o.scissor(ae,me,oe,K),(ae!==u.x||me!==u.y||oe!==u.width||K!==u.height)&&(Lo.set(u,ae,me,oe,K),k.update(M.uViewport,nn.set(M.uViewport.ref.value,ae,me,oe,K)))},setTransparentBackground:ae=>{f=ae},setDrawingBufferSize:(ae,me)=>{(ae!==l[0]||me!==l[1])&&k.update(M.uDrawingBufferSize,Me.set(l,ae,me))},setPixelRatio:ae=>{k.update(M.uPixelRatio,ae)},setOcclusionTest:ae=>{p=ae},props:a,get stats(){return{programCount:n.stats.resourceCounts.program,shaderCount:n.stats.resourceCounts.shader,attributeCount:n.stats.resourceCounts.attribute,elementsCount:n.stats.resourceCounts.elements,framebufferCount:n.stats.resourceCounts.framebuffer,renderbufferCount:n.stats.resourceCounts.renderbuffer,textureCount:n.stats.resourceCounts.texture,vertexArrayCount:n.stats.resourceCounts.vertexArray,drawCount:s.drawCount,instanceCount:s.instanceCount,instancedDrawCount:s.instancedDrawCount}},get light(){return c},dispose:()=>{}}}}(T8||(T8={})),function(e){function s(l){return l.triggers.map(c.format).join(" or ")}function c(l,d){return c.create(l,d)}var l;e.create=function t(l,d="",f=""){return{triggers:l,action:d,description:f}},e.isBinding=function n(l){return!!l&&Array.isArray(l.triggers)&&"string"==typeof l.action},e.Empty={triggers:[],action:"",description:""},e.isEmpty=function r(l){return 0===l.triggers.length||l.triggers.every(d=>void 0===d.buttons&&void 0===d.modifiers&&!d.code)},e.match=function i(l,d,f){return l.triggers.some(p=>c.match(p,d,f))},e.matchKey=function o(l,d,f,p){return l.triggers.some(m=>c.matchKey(m,d,f,p))},e.formatTriggers=s,e.format=function a(l,d=""){return function RNe(e,t){const n=Object.keys(t),r=Object.values(t);return new Function(...n,`return \`${e}\`;`)(...r)}(l.description||zu(d),{triggers:""+s(l)+""})},e.Trigger=c,e.TriggerKey=function u(l,d){return c.create(void 0,d,l)},(l=c=e.Trigger||(e.Trigger={})).create=function d(h,g,y){return{buttons:h,modifiers:g,code:y}},l.Empty={},l.match=function f(h,g,y){const{buttons:b,modifiers:x}=h;return void 0!==b&&(b===g||Zi.has(b,g))&&(!x||wu.areEqual(x,y))},l.matchKey=function p(h,g,y,b){const{modifiers:x,code:_}=h;return void 0!==_&&(_===g||1===_.length&&4===g.length&&g.startsWith("Key")&&!!b&&1===b.length&&b.toUpperCase()===_.toUpperCase())&&(!x||wu.areEqual(x,y))},l.format=function m(h){const g=[],y=function Ntt(e,t){const n=[];return void 0!==e||t?0===e?n.push("mouse hover"):void 0!==e&&(Cm.has(e,Cm.Flag.Primary)&&n.push("left mouse button"),Cm.has(e,Cm.Flag.Secondary)&&n.push("right mouse button"),Cm.has(e,Cm.Flag.Auxilary)&&n.push("wheel/middle mouse button"),Cm.has(e,Cm.Flag.Forth)&&n.push("three fingers")):n.push("any mouse button"),n.join(" + ")}(h.buttons,h.code);y&&g.push(y);const b=function Btt(e){return e?.startsWith("Key")&&(e=e.substring(3)),e&&function ENe(e){return Fg(RQ(e))}(e).toLowerCase()}(h.code);b&&g.push(b);const x=function Ftt(e,t){const n=[];return e?(e.alt&&n.push("alt key"),e.control&&n.push("control key"),e.meta&&n.push("meta/command key"),e.shift&&n.push("shift key"),t&&0===n.length&&n.push("no key")):t&&n.push("any key"),n.join(" + ")}(h.modifiers);return x&&g.push(x),g.join(" + ")}}(At||(At={}));const Cm=Zi,wm=Zi,Au=wu,Am=At.Trigger,Vc=At.TriggerKey,aue={dragRotate:At([Am(wm.Flag.Primary,Au.create())],"Rotate","Drag using ${triggers}"),dragRotateZ:At([Am(wm.Flag.Primary,Au.create({shift:!0,control:!0}))],"Rotate around z-axis (roll)","Drag using ${triggers}"),dragPan:At([Am(wm.Flag.Secondary,Au.create()),Am(wm.Flag.Primary,Au.create({control:!0}))],"Pan","Drag using ${triggers}"),dragZoom:At.Empty,dragFocus:At([Am(wm.Flag.Forth,Au.create())],"Focus","Drag using ${triggers}"),dragFocusZoom:At([Am(wm.Flag.Auxilary,Au.create())],"Focus and zoom","Drag using ${triggers}"),scrollZoom:At([Am(wm.Flag.Auxilary,Au.create())],"Zoom","Scroll using ${triggers}"),scrollFocus:At([Am(wm.Flag.Auxilary,Au.create({shift:!0}))],"Clip","Scroll using ${triggers}"),scrollFocusZoom:At.Empty,keyMoveForward:At([Vc("KeyW")],"Move forward","Press ${triggers}"),keyMoveBack:At([Vc("KeyS")],"Move back","Press ${triggers}"),keyMoveLeft:At([Vc("KeyA")],"Move left","Press ${triggers}"),keyMoveRight:At([Vc("KeyD")],"Move right","Press ${triggers}"),keyMoveUp:At([Vc("KeyR")],"Move up","Press ${triggers}"),keyMoveDown:At([Vc("KeyF")],"Move down","Press ${triggers}"),keyRollLeft:At([Vc("KeyQ")],"Roll left","Press ${triggers}"),keyRollRight:At([Vc("KeyE")],"Roll right","Press ${triggers}"),keyPitchUp:At([Vc("ArrowUp",Au.create({shift:!0}))],"Pitch up","Press ${triggers}"),keyPitchDown:At([Vc("ArrowDown",Au.create({shift:!0}))],"Pitch down","Press ${triggers}"),keyYawLeft:At([Vc("ArrowLeft",Au.create({shift:!0}))],"Yaw left","Press ${triggers}"),keyYawRight:At([Vc("ArrowRight",Au.create({shift:!0}))],"Yaw right","Press ${triggers}"),boostMove:At([Vc("ShiftLeft")],"Boost move","Press ${triggers}"),enablePointerLock:At([Vc("Space",Au.create({control:!0}))],"Enable pointer lock","Press ${triggers}")},cue={noScroll:C.Boolean(!0,{isHidden:!0}),rotateSpeed:C.Numeric(5,{min:1,max:10,step:1}),zoomSpeed:C.Numeric(7,{min:1,max:15,step:1}),panSpeed:C.Numeric(1,{min:.1,max:5,step:.1}),moveSpeed:C.Numeric(.75,{min:.1,max:3,step:.1}),boostMoveFactor:C.Numeric(5,{min:.1,max:10,step:.1}),flyMode:C.Boolean(!1),animate:C.MappedStatic("off",{off:C.EmptyGroup(),spin:C.Group({speed:C.Numeric(1,{min:-20,max:20,step:1})},{description:"Spin the 3D scene around the x-axis in view space"}),rock:C.Group({speed:C.Numeric(.3,{min:-5,max:5,step:.1}),angle:C.Numeric(10,{min:0,max:90,step:1},{description:"How many degrees to rotate in each direction."})},{description:"Rock the 3D scene around the x-axis in view space"})}),staticMoving:C.Boolean(!0,{isHidden:!0}),dynamicDampingFactor:C.Numeric(.2,{},{isHidden:!0}),minDistance:C.Numeric(.01,{},{isHidden:!0}),maxDistance:C.Numeric(1e150,{},{isHidden:!0}),gestureScaleFactor:C.Numeric(1,{},{isHidden:!0}),maxWheelDelta:C.Numeric(.02,{},{isHidden:!0}),bindings:C.Value(aue,{isHidden:!0}),autoAdjustMinMaxDistance:C.MappedStatic("on",{off:C.EmptyGroup(),on:C.Group({minDistanceFactor:C.Numeric(0),minDistancePadding:C.Numeric(5),maxDistanceFactor:C.Numeric(10),maxDistanceMin:C.Numeric(20)})},{isHidden:!0})};var D8,xE;!function(e){e.create=function t(n,r,i,o={}){const s={...C.getDefaultValues(cue),...o,bindings:{...aue,...o.bindings}},a=s.bindings,c=Lo.clone(r.viewport);let u=!1;const l=n.drag.subscribe(function Qn({x:Ke,y:Pt,pageX:Ht,pageY:Ur,buttons:Zs,modifiers:Na,isStart:gc}){const yc=Ct(Ke,Pt);if(gc&&yc||!gc&&!_)return;_=!0,Ue();const Jm=At.match(a.dragRotate,Zs,Na),eg=At.match(a.dragRotateZ,Zs,Na),Z1=At.match(a.dragPan,Zs,Na),Q1=At.match(a.dragZoom,Zs,Na),J1=At.match(a.dragFocus,Zs,Na),hy=At.match(a.dragFocusZoom,Zs,Na);Q(Ht,Ur),function H(Ke,Pt){Me.set(O,(Ke-c.x)/c.width,(Pt-c.y)/c.height)}(Ht,Ur);const e_=n.pixelRatio,t_=(Ke*e_-c.width/2-c.x)/c.width,n_=-(n.height-Pt*e_-c.height/2-c.y)/c.height;if(gc&&(Jm&&(Me.copy(w,W),Me.copy(E,w)),eg&&(Me.set(T,t_,n_),Me.copy(R,T)),(Q1||hy)&&(Me.copy(F,O),Me.copy(G,F)),J1&&(Me.copy(L,O),Me.copy(z,L)),Z1&&(Me.copy(j,O),Me.copy(Z,j))),Jm&&Me.copy(w,W),eg&&Me.set(T,t_,n_),(Q1||hy)&&Me.copy(G,O),J1&&Me.copy(z,O),hy){const my=v.distance(r.state.position,r.state.target);r.setState({radius:my/5})}Z1&&Me.copy(Z,O)}),d=n.interactionEnd.subscribe(function qe(){_=!1}),f=n.wheel.subscribe(function dt({x:Ke,y:Pt,spinX:Ht,spinY:Ur,dz:Zs,buttons:Na,modifiers:gc}){if(Ct(Ke,Pt))return;let yc=function nMe(...e){let t=0,n=0;for(let r=0,i=e.length;rn&&(t=o,n=s)}return t}(.075*Ht,.075*Ur,1e-4*Zs);yc<-s.maxWheelDelta?yc=-s.maxWheelDelta:yc>s.maxWheelDelta&&(yc=s.maxWheelDelta),At.match(a.scrollZoom,Na,gc)&&(G[1]+=yc),At.match(a.scrollFocus,Na,gc)&&(z[1]+=yc)}),p=n.pinch.subscribe(function gt({fractionDelta:Ke,buttons:Pt,modifiers:Ht}){At.match(a.scrollZoom,Pt,Ht)&&(_=!0,G[1]+=s.gestureScaleFactor*Ke)}),m=n.gesture.subscribe(function se({deltaScale:Ke}){_=!0,G[1]+=s.gestureScaleFactor*Ke}),h=n.keyDown.subscribe(function ve({modifiers:Ke,code:Pt,key:Ht,x:Ur,y:Zs}){Ct(Ur,Zs)||(At.matchKey(a.keyMoveForward,Pt,Ke,Ht)?ke.moveForward=1:At.matchKey(a.keyMoveBack,Pt,Ke,Ht)?ke.moveBack=1:At.matchKey(a.keyMoveLeft,Pt,Ke,Ht)?ke.moveLeft=1:At.matchKey(a.keyMoveRight,Pt,Ke,Ht)?ke.moveRight=1:At.matchKey(a.keyMoveUp,Pt,Ke,Ht)?ke.moveUp=1:At.matchKey(a.keyMoveDown,Pt,Ke,Ht)?ke.moveDown=1:At.matchKey(a.keyRollLeft,Pt,Ke,Ht)?ke.rollLeft=1:At.matchKey(a.keyRollRight,Pt,Ke,Ht)?ke.rollRight=1:At.matchKey(a.keyPitchUp,Pt,Ke,Ht)?ke.pitchUp=1:At.matchKey(a.keyPitchDown,Pt,Ke,Ht)?ke.pitchDown=1:At.matchKey(a.keyYawLeft,Pt,Ke,Ht)?ke.yawLeft=1:At.matchKey(a.keyYawRight,Pt,Ke,Ht)&&(ke.yawRight=1),At.matchKey(a.boostMove,Pt,Ke,Ht)&&(ke.boostMove=1),At.matchKey(a.enablePointerLock,Pt,Ke,Ht)&&n.requestPointerLock(c))}),g=n.keyUp.subscribe(function Te({modifiers:Ke,code:Pt,key:Ht,x:Ur,y:Zs}){var Na,gc,yc,Jm,eg,Z1,Q1,J1,hy,e_,t_,n_;if(Ct(Ur,Zs))return;let my=!1;Pt.startsWith("Alt")?(my=!0,Ke.alt=!0):Pt.startsWith("Shift")?(my=!0,Ke.shift=!0):Pt.startsWith("Control")?(my=!0,Ke.control=!0):Pt.startsWith("Meta")&&(my=!0,Ke.meta=!0);const Wc=[];my?(ke.moveForward&&Wc.push((null===(Na=a.keyMoveForward.triggers[0])||void 0===Na?void 0:Na.code)||""),ke.moveBack&&Wc.push((null===(gc=a.keyMoveBack.triggers[0])||void 0===gc?void 0:gc.code)||""),ke.moveLeft&&Wc.push((null===(yc=a.keyMoveLeft.triggers[0])||void 0===yc?void 0:yc.code)||""),ke.moveRight&&Wc.push((null===(Jm=a.keyMoveRight.triggers[0])||void 0===Jm?void 0:Jm.code)||""),ke.moveUp&&Wc.push((null===(eg=a.keyMoveUp.triggers[0])||void 0===eg?void 0:eg.code)||""),ke.moveDown&&Wc.push((null===(Z1=a.keyMoveDown.triggers[0])||void 0===Z1?void 0:Z1.code)||""),ke.rollLeft&&Wc.push((null===(Q1=a.keyRollLeft.triggers[0])||void 0===Q1?void 0:Q1.code)||""),ke.rollRight&&Wc.push((null===(J1=a.keyRollRight.triggers[0])||void 0===J1?void 0:J1.code)||""),ke.pitchUp&&Wc.push((null===(hy=a.keyPitchUp.triggers[0])||void 0===hy?void 0:hy.code)||""),ke.pitchDown&&Wc.push((null===(e_=a.keyPitchDown.triggers[0])||void 0===e_?void 0:e_.code)||""),ke.yawLeft&&Wc.push((null===(t_=a.keyYawLeft.triggers[0])||void 0===t_?void 0:t_.code)||""),ke.yawRight&&Wc.push((null===(n_=a.keyYawRight.triggers[0])||void 0===n_?void 0:n_.code)||"")):Wc.push(Pt);for(const Nl of Wc)At.matchKey(a.keyMoveForward,Nl,Ke,Ht)?ke.moveForward=0:At.matchKey(a.keyMoveBack,Nl,Ke,Ht)?ke.moveBack=0:At.matchKey(a.keyMoveLeft,Nl,Ke,Ht)?ke.moveLeft=0:At.matchKey(a.keyMoveRight,Nl,Ke,Ht)?ke.moveRight=0:At.matchKey(a.keyMoveUp,Nl,Ke,Ht)?ke.moveUp=0:At.matchKey(a.keyMoveDown,Nl,Ke,Ht)?ke.moveDown=0:At.matchKey(a.keyRollLeft,Nl,Ke,Ht)?ke.rollLeft=0:At.matchKey(a.keyRollRight,Nl,Ke,Ht)?ke.rollRight=0:At.matchKey(a.keyPitchUp,Nl,Ke,Ht)?ke.pitchUp=0:At.matchKey(a.keyPitchDown,Nl,Ke,Ht)?ke.pitchDown=0:At.matchKey(a.keyYawLeft,Nl,Ke,Ht)?ke.yawLeft=0:At.matchKey(a.keyYawRight,Nl,Ke,Ht)&&(ke.yawRight=0);At.matchKey(a.boostMove,Pt,Ke,Ht)&&(ke.boostMove=0)}),y=n.move.subscribe(function he({movementX:Ke,movementY:Pt}){if(!n.pointerLock||void 0===Ke||void 0===Pt)return;const Ht=.5*c.width-c.x,Ur=.5*c.height-c.y;Me.copy(E,Q(Ht,Ur)),Me.copy(w,Q(Ke+Ht,Pt+Ur))}),b=n.lock.subscribe(function Ut(Ke){Ke?yt():xt()}),x=n.leave.subscribe(function hn(){!function Nn(){ke.moveForward=0,ke.moveBack=0,ke.moveLeft=0,ke.moveRight=0,ke.moveUp=0,ke.moveDown=0,ke.rollLeft=0,ke.rollRight=0,ke.pitchUp=0,ke.pitchDown=0,ke.yawLeft=0,ke.yawRight=0,ke.boostMove=0}()});let _=!1;const S=v(),A=v(),E=Me(),w=Me(),D=v();let I=0;const R=Me(),T=Me();let M=0,N=0,V=0;const F=Me(),G=Me(),L=Me(),z=Me(),j=Me(),Z=Me(),$=v.clone(r.target),ee=v.clone(r.position),q=v.clone(r.up),O=Me(),W=Me();function Q(Ke,Pt){return Me.set(W,(Ke-.5*c.width-c.x)/(.5*c.width),(c.height+2*(c.y-Pt))/c.width)}function fe(){return s.rotateSpeed*n.pixelRatio*(n.width/n.height)}const X=v(),J=_r(),ce=v(),be=v(),ae=v(),me=v(),K=_r(),ne=v(),we=_r(),Le=v(),U=_r(),Y=v(),Ne=Me(),Ge=v(),$e=v(),ke={moveUp:0,moveDown:0,moveLeft:0,moveRight:0,moveForward:0,moveBack:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0,boostMove:0},Xe=v(),ot=v();function ut(){const Ke=Math.min(Math.max(1e3*r.state.radiusMax,.01),s.maxDistance);v.squaredMagnitude(A)>Ke*Ke&&(v.setMagnitude(A,A,Ke),v.add(r.position,r.target,A),Me.copy(F,G),Me.copy(L,z)),v.squaredMagnitude(A)c.x+c.width||n.height-Pt>c.y+c.height||Ke0&&("spin"===s.animate.name?function Ks(Ke){if("spin"!==s.animate.name||0===s.animate.params.speed||_)return;const Pt=s.animate.params.speed/1e3;Pi[0]=60*Math.min(Math.abs(Ke),125)/1e3*Pt,Me.add(w,E,Pi)}(Pt):"rock"===s.animate.name&&function Ed(Ke){if("rock"!==s.animate.name||0===s.animate.params.speed||_)return;const Pt=Ke/1e3*s.animate.params.speed,Ht=Yn(s.animate.params.angle)/fe(),Ur=Math.sin(ho*Math.PI*2)*Ht,Zs=Math.sin((ho+Pt)*Math.PI*2)*Ht;mc[0]=Zs-Ur,Me.add(w,E,mc),ho+=Pt,ho>=1&&(ho=0)}(Pt)),v.sub(A,r.position,r.target),function oe(){const Ke=w[0]-E[0],Pt=w[1]-E[1];v.set(me,Ke,Pt,0);const Ht=v.magnitude(me)*fe();Ht?(v.sub(A,r.position,r.target),v.normalize(ce,A),v.normalize(be,r.up),v.normalize(ae,v.cross(ae,be,ce)),v.setMagnitude(be,be,Pt),v.setMagnitude(ae,ae,Ke),v.add(me,be,ae),v.normalize(X,v.cross(X,me,A)),_r.setAxisAngle(J,X,Ht),v.transformQuat(A,A,J),v.transformQuat(r.up,r.up,J),v.copy(D,X),I=Ht):!s.staticMoving&&I&&(I*=Math.sqrt(1-s.dynamicDampingFactor),v.sub(A,r.position,r.target),_r.setAxisAngle(J,D,I),v.transformQuat(A,A,J),v.transformQuat(r.up,r.up,J)),Me.copy(E,w)}(),function de(){const Ke=(ke.rollRight-ke.rollLeft)/45,Pt=(T[0]-R[0])*-Math.sign(T[1]),Ht=(T[1]-R[1])*-Math.sign(T[0]),Ur=-s.rotateSpeed*(-Pt+Ht)+Ke;Ur?(v.normalize(ne,A),_r.setAxisAngle(K,ne,Ur),v.transformQuat(r.up,r.up,K),M=Ur):!s.staticMoving&&M&&(M*=Math.sqrt(1-s.dynamicDampingFactor),v.normalize(ne,A),_r.setAxisAngle(K,ne,M),v.transformQuat(r.up,r.up,K)),Me.copy(R,T)}(),function We(){const Pt=(ke.pitchUp-ke.pitchDown)/(s.flyMode?360:90)*-s.rotateSpeed;Pt?(v.cross(Le,A,r.up),v.normalize(Le,Le),_r.setAxisAngle(we,Le,Pt),v.transformQuat(A,A,we),v.transformQuat(r.up,r.up,we),N=Pt):!s.staticMoving&&N&&(N*=Math.sqrt(1-s.dynamicDampingFactor),v.cross(Le,A,r.up),v.normalize(Le,Le),_r.setAxisAngle(we,Le,N),v.transformQuat(A,A,we),v.transformQuat(r.up,r.up,we))}(),function ge(){const Pt=(ke.yawRight-ke.yawLeft)/(s.flyMode?360:90)*-s.rotateSpeed;Pt?(v.normalize(Y,r.up),_r.setAxisAngle(U,Y,Pt),v.transformQuat(A,A,U),v.transformQuat(r.up,r.up,U),V=Pt):!s.staticMoving&&V&&(V*=Math.sqrt(1-s.dynamicDampingFactor),v.normalize(Y,r.up),_r.setAxisAngle(U,Y,V),v.transformQuat(A,A,U),v.transformQuat(r.up,r.up,U))}(),function Se(){const Ke=1+(G[1]-F[1])*s.zoomSpeed;1!==Ke&&Ke>0&&v.scale(A,A,Ke),s.staticMoving?Me.copy(F,G):F[1]+=(G[1]-F[1])*s.dynamicDampingFactor}(),function Re(){const Ke=(z[1]-L[1])*s.zoomSpeed;if(0!==Ke){const Pt=Math.max(1,r.state.radius+r.state.radius*Ke);r.setState({radius:Pt})}s.staticMoving?Me.copy(L,z):L[1]+=(z[1]-L[1])*s.dynamicDampingFactor}(),function tt(){if(Me.sub(Ne,Me.copy(Ne,Z),j),Me.squaredMagnitude(Ne)){const Ke=n.pixelRatio*s.panSpeed;Ne[0]*=1/r.zoom*r.viewport.width*Ke,Ne[1]*=1/r.zoom*r.viewport.height*Ke,v.cross($e,v.copy($e,A),r.up),v.setMagnitude($e,$e,Ne[0]),v.setMagnitude(Ge,r.up,Ne[1]),v.add($e,$e,Ge),v.add(r.position,r.position,$e),v.add(r.target,r.target,$e),s.staticMoving?Me.copy(j,Z):(Me.sub(Ne,Z,j),Me.scale(Ne,Ne,s.dynamicDampingFactor),Me.add(j,j,Ne))}}(),v.add(r.position,r.target,A),ut(),Et>0&&function _t(Ke){v.sub(ot,r.position,r.target);const Pt=Math.max(r.state.minNear,s.minDistance);v.setMagnitude(ot,ot,Pt);const Ht=.06*Ke*s.moveSpeed*(1===ke.boostMove?s.boostMoveFactor:1);if(1===ke.moveForward&&(v.normalize(Xe,ot),v.scaleAndSub(r.position,r.position,Xe,Ht),(s.flyMode||n.pointerLock)&&v.sub(r.target,r.position,ot)),1===ke.moveBack&&(v.normalize(Xe,ot),v.scaleAndAdd(r.position,r.position,Xe,Ht),(s.flyMode||n.pointerLock)&&v.sub(r.target,r.position,ot)),1===ke.moveLeft&&(v.cross(Xe,ot,r.up),v.normalize(Xe,Xe),s.flyMode||n.pointerLock?(v.scaleAndAdd(r.position,r.position,Xe,Ht),v.sub(r.target,r.position,ot)):(v.scaleAndSub(r.position,r.position,Xe,Ht),v.sub(r.target,r.position,A))),1===ke.moveRight&&(v.cross(Xe,ot,r.up),v.normalize(Xe,Xe),s.flyMode||n.pointerLock?(v.scaleAndSub(r.position,r.position,Xe,Ht),v.sub(r.target,r.position,ot)):(v.scaleAndAdd(r.position,r.position,Xe,Ht),v.sub(r.target,r.position,A))),1===ke.moveUp&&(v.normalize(Xe,r.up),s.flyMode||n.pointerLock?(v.scaleAndAdd(r.position,r.position,Xe,Ht),v.sub(r.target,r.position,ot)):(v.scaleAndSub(r.position,r.position,Xe,Ht),v.sub(r.target,r.position,A))),1===ke.moveDown&&(v.normalize(Xe,r.up),s.flyMode||n.pointerLock?(v.scaleAndSub(r.position,r.position,Xe,Ht),v.sub(r.target,r.position,ot)):(v.scaleAndAdd(r.position,r.position,Xe,Ht),v.sub(r.target,r.position,A))),s.flyMode||n.pointerLock){const Ur=v.distance(r.position,i.boundingSphereVisible.center);r.setState({minFar:Ur+i.boundingSphereVisible.radius})}}(Math.min(Pt,250)),v.sub(A,r.position,r.target),ut(),v.squaredDistance(S,r.position)>vr&&v.copy(S,r.position),Et=Ke}function yt(){v.sub(ot,r.position,r.target);const Ke=Math.max(r.state.minNear,s.minDistance);v.setMagnitude(ot,ot,Ke),v.sub(r.target,r.position,ot);const Pt=v.distance(r.position,i.boundingSphereVisible.center);r.setState({minFar:Pt+i.boundingSphereVisible.radius})}function xt(){const{center:Ke,radius:Pt}=i.boundingSphereVisible;if(v.distance(r.position,Ke)>Pt){const Ur=r.getFocus(Ke,Pt);r.setState({...Ur,minFar:0})}else r.setState({minFar:0,radius:i.boundingSphereVisible.radius})}const Pi=Me.create(.005,0);let ho=0;const mc=Me.create(.005,0);function Ue(){ho=0}return{viewport:c,get isAnimating(){return"off"!==s.animate.name},get isMoving(){return 1===ke.moveForward||1===ke.moveBack||1===ke.moveLeft||1===ke.moveRight||1===ke.moveUp||1===ke.moveDown||1===ke.rollLeft||1===ke.rollRight||1===ke.pitchUp||1===ke.pitchDown||1===ke.yawLeft||1===ke.yawRight},get props(){return s},setProps:Ke=>{var Pt;"rock"===(null===(Pt=Ke.animate)||void 0===Pt?void 0:Pt.name)&&"rock"!==s.animate.name&&Ue(),void 0!==Ke.flyMode&&Ke.flyMode!==s.flyMode&&(Ke.flyMode?yt():xt()),Object.assign(s,Ke),Object.assign(a,Ke.bindings)},start:function tn(Ke){Et=-1,Xt(Ke)},update:Xt,reset:function ln(){v.copy(r.target,$),v.copy(r.position,ee),v.copy(r.up,q),v.sub(A,r.position,r.target),v.copy(S,r.position)},dispose:function hr(){u||(u=!0,l.unsubscribe(),f.unsubscribe(),p.unsubscribe(),m.unsubscribe(),d.unsubscribe(),h.unsubscribe(),g.unsubscribe(),y.unsubscribe(),b.unsubscribe(),x.unsubscribe())}}}}(D8||(D8={})),function(e){e.create=function t(){return{view:le.identity(),position:v.create(0,0,0),direction:v.create(0,0,-1),up:v.create(0,1,0)}};const n=v.zero();e.update=function r(i){v.add(n,i.position,i.direction),le.lookAt(i.view,i.position,n,i.up)}}(xE||(xE={}));class Ott{constructor(){this.removeList=wB(),this.removeMap=new Map,this.addList=wB(),this.addMap=new Map}get isEmpty(){return 0===this.removeList.count&&0===this.addList.count}get size(){return this.removeMap.size+this.addMap.size}add(t){if(this.removeMap.has(t)){const r=this.removeMap.get(t);this.removeMap.delete(t),this.removeList.remove(r)}if(this.addMap.has(t))return;const n=this.addList.addLast(t);this.addMap.set(t,n)}remove(t){if(this.addMap.has(t)){const r=this.addMap.get(t);this.addMap.delete(t),this.addList.remove(r)}if(this.removeMap.has(t))return;const n=this.removeList.addLast(t);this.removeMap.set(t,n)}tryGetRemove(){const t=this.removeList.removeFirst();return t&&this.removeMap.delete(t),t}tryGetAdd(){const t=this.addList.removeFirst();return t&&this.addMap.delete(t),t}}const QS=new fu("98");function uue(e,t,n){QS.reset();for(let r=0,i=e.length;r{r=L;for(let z=0,j=o.length;zR.add(L),remove:L=>R.remove(L),commit:(L=Number.MAX_VALUE)=>function I(L){const z=yi();let j=0;for(;;){const Z=R.tryGetRemove();if(!Z)break;if(w(Z),++j%100==0&&yi()-z>L)return!1}for(;;){const Z=R.tryGetAdd();if(!Z)break;if(E(Z),++j%100==0&&yi()-z>L)return!1}return o.sort(Ltt),f=!0,p=!0,m=!0,!0}(L),get commitQueueSize(){return R.size},get needsCommit(){return!R.isEmpty},has:L=>i.has(L),clear:()=>{for(let L=0,z=o.length;L{i.forEach(L)},get count(){return o.length},get boundingSphere(){return l&&(uue(o,s,!1),l=!1),s},get boundingSphereVisible(){return d&&(uue(o,a,!0),d=!1),a},get markerAverage(){return f&&(h=function V(){if(0===c.length)return 0;let L=0,z=0;for(let j=0,Z=c.length;j0?z/L:0}(),f=!1),h},get opacityAverage(){return p&&(g=function F(){var L,z;if(0===c.length)return 0;let j=0,Z=0;for(let $=0,ee=c.length;$0?Z/j:0}(),p=!1),g},get hasOpaque(){return m&&(y=function G(){var L;if(0===c.length)return!1;for(let z=0,j=c.length;z0)&&gr.copySnapshot(this._source,this.camera.state),this.inTransition||gr.copySnapshot(this._target,this.camera.state),gr.copySnapshot(this._target,t),this._target.radius>this._target.radiusMax&&(this._target.radius=this._target.radiusMax),this._target.radius<.01&&(this._target.radius=.01),this._target.radiusMax<.01&&(this._target.radiusMax=.01),!this.inTransition&&n<=0||typeof t.mode<"u"&&t.mode!==this.camera.state.mode?this.finish(this._target):(this.inTransition=!0,this.func=r||Yv.defaultTransition,(!this.inTransition||n>0)&&(this.start=this.t,this.durationMs=n))}tick(t){this.t=t,this.update()}finish(t){gr.copySnapshot(this.camera.state,t),this.inTransition=!1}update(){if(!this.inTransition)return;const t=Math.min((this.t-this.start)/this.durationMs,1);1!==t?(this.func(this._current,t,this._source,this._target),gr.copySnapshot(this.camera.state,this._current)):this.finish(this._target)}constructor(t){this.camera=t,this.t=0,this.func=Yv.defaultTransition,this.start=0,this.inTransition=!1,this.durationMs=0,this._source=gr.createDefaultSnapshot(),this._target=gr.createDefaultSnapshot(),this._current=gr.createDefaultSnapshot()}}!function(e){const t=_r.identity();e.defaultTransition=function n(r,i,o,s){gr.copySnapshot(r,s),_r.slerp(t,_r.Identity,_r.rotationTo(t,o.up,s.up),i),v.transformQuat(r.up,o.up,t),v.lerp(r.target,o.target,s.target,i),v.lerp(r.position,o.position,s.position,i),r.radius=ci(o.radius,s.radius,i),r.radiusMax=ci(o.radiusMax,s.radiusMax,i),r.fov=ci(o.fov,s.fov,i),r.fog=ci(o.fog,s.fog,i)}}(Yv||(Yv={}));const lue=v(),due=v(),SE=nn();class gr{get position(){return this.state.position}set position(t){v.copy(this.state.position,t)}get up(){return this.state.up}set up(t){v.copy(this.state.up,t)}get target(){return this.state.target}set target(t){v.copy(this.state.target,t)}update(){const t=this.state;if(0===t.radiusMax)return!1;const n=2*Math.tan(t.fov/2)*v.distance(t.position,t.target);switch(this.zoom=this.viewport.height/n,function ztt(e){let{radius:t,radiusMax:n,fog:i,clipFar:o,minNear:s,minFar:a}=e.state;t<.01&&(t=.01);const c=Math.max(o?t:n,a),u=v.distance(e.position,e.target);let l=u-t,d=u+c;l=Math.max(Math.min(n,s),l),d=Math.max(s,d),l===d&&(d=l+.01);const p=u-c*(-(50-i)/50),m=d;e.near=l,e.far=d,e.fogNear=p,e.fogFar=m}(this),this.state.mode){case"orthographic":!function Utt(e){const{viewport:t,zoom:n,near:r,far:i,viewOffset:o}=e,s=-t.width/2,a=t.width/2,c=t.height/2,u=-t.height/2,l=(a-s)/(2*n),d=(c-u)/(2*n),f=(a+s)/2,p=(c+u)/2;let m=f-l,h=f+l,g=p+d,y=p-d;if(o.enabled){const b=n/(o.width/o.fullWidth),x=n/(o.height/o.fullHeight),_=(a-s)/o.width,S=(c-u)/o.height;m+=_*(o.offsetX/b),h=m+_*(o.width/b),g-=S*(o.offsetY/x),y=g-S*(o.height/x)}le.ortho(e.projection,m,h,g,y,r,i),le.lookAt(e.view,e.position,e.target,e.up)}(this);break;case"perspective":!function Vtt(e){const t=e.viewport.width/e.viewport.height,{near:n,far:r,viewOffset:i}=e;let o=n*Math.tan(.5*e.state.fov),s=2*o,a=t*s,c=-.5*a;i.enabled&&(c+=i.offsetX*a/i.fullWidth,o-=i.offsetY*s/i.fullHeight,a*=i.width/i.fullWidth,s*=i.height/i.fullHeight),le.perspective(e.projection,c,c+a,o,o-s,n,r),le.lookAt(e.view,e.position,e.target,e.up)}(this);break;default:Rr()}const r=!le.areEqual(this.projection,this.prevProjection,vr)||!le.areEqual(this.view,this.prevView,vr);if(r){if(le.mul(this.projectionView,this.projection,this.view),!le.tryInvert(this.inverseProjectionView,this.projectionView))return le.copy(this.view,this.prevView),le.copy(this.projection,this.prevProjection),le.mul(this.projectionView,this.projection,this.view),!1;le.copy(this.prevView,this.view),le.copy(this.prevProjection,this.projection)}return r}setState(t,n){this.transition.apply(t,n),this.stateChanged.next(t)}getSnapshot(){return gr.copySnapshot(gr.createDefaultSnapshot(),this.state)}getTargetDistance(t){return gr.targetDistance(t,this.state.mode,this.state.fov,this.viewport.width,this.viewport.height)}getFocus(t,n,r,i,o){var s,a;const c=Math.max(n,.01),u=this.getTargetDistance(c);v.sub(this.deltaDirection,null!==(s=o?.target)&&void 0!==s?s:this.target,null!==(a=o?.position)&&void 0!==a?a:this.position),i&&v.matchDirection(this.deltaDirection,i,this.deltaDirection),v.setMagnitude(this.deltaDirection,this.deltaDirection,u),v.sub(this.newPosition,t,this.deltaDirection);const l=gr.copySnapshot(gr.createDefaultSnapshot(),this.state);return l.target=v.clone(t),l.radius=c,l.position=v.clone(this.newPosition),r&&v.matchDirection(l.up,r,l.up),l}getCenter(t,n){v.sub(this.deltaDirection,this.target,this.position),v.sub(this.newPosition,t,this.deltaDirection);const r=gr.copySnapshot(gr.createDefaultSnapshot(),this.state);return r.target=v.clone(t),r.position=v.clone(this.newPosition),n&&(r.radius=Math.max(n,.01)),r}getInvariantFocus(t,n,r,i){const o=Math.max(n,.01),s=this.getTargetDistance(o);v.copy(this.deltaDirection,i),v.setMagnitude(this.deltaDirection,this.deltaDirection,s),v.sub(this.newPosition,t,this.deltaDirection);const a=gr.copySnapshot(gr.createDefaultSnapshot(),this.state);return a.target=v.clone(t),a.radius=o,a.position=v.clone(this.newPosition),v.copy(a.up,r),a}focus(t,n,r,i,o){n>0&&this.setState(this.getFocus(t,n,i,o),r)}center(t,n){this.setState(this.getCenter(t),n)}project(t,n){return function Mtt(e,t,n,r){const{x:i,y:o,width:s,height:a}=n;nn.set(If,t[0],t[1],t[2],1),nn.transformMat4(If,If,r);const c=If[3];return 0!==c&&(If[0]/=c,If[1]/=c,If[2]/=c),e[0]=(If[0]+1)*s*.5+i,e[1]=(If[1]+1)*a*.5+o,e[2]=.5*(If[2]+1),e[3]=0===c?0:1/c,e}(t,n,this.viewport,this.projectionView)}unproject(t,n){return vE(t,n,this.viewport,this.inverseProjectionView)}getPixelSize(t){return this.project(SE,t),this.unproject(lue,SE),SE[0]+=1,this.unproject(due,SE),v.distance(lue,due)}constructor(t,n=Lo.create(0,0,128,128)){this.view=le.identity(),this.projection=le.identity(),this.projectionView=le.identity(),this.inverseProjectionView=le.identity(),this.state=gr.createDefaultSnapshot(),this.viewOffset=gr.ViewOffset(),this.near=1,this.far=1e4,this.fogNear=5e3,this.fogFar=1e4,this.zoom=1,this.transition=new Yv(this),this.stateChanged=new Ao(this.state),this.prevProjection=le.identity(),this.prevView=le.identity(),this.deltaDirection=v(),this.newPosition=v(),this.viewport=n,gr.copySnapshot(this.state,t)}}!function(e){e.ViewOffset=function t(){return{enabled:!1,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}},e.setViewOffset=function n(c,u,l,d,f,p,m){c.fullWidth=u,c.fullHeight=l,c.offsetX=d,c.offsetY=f,c.width=p,c.height=m},e.copyViewOffset=function r(c,u){c.enabled=u.enabled,c.fullWidth=u.fullWidth,c.fullHeight=u.fullHeight,c.offsetX=u.offsetX,c.offsetY=u.offsetY,c.width=u.width,c.height=u.height},e.targetDistance=function i(c,u,l,d,f){const p=Math.max(c,.01),h=f{const o=this.objectsData.get(i),s=CE(this.scene,r.values.boundingSphere.ref.value,o,xn.tomato,Wtt);s&&this.objectsData.set(i,s);const a=this.instancesData.get(i),c=CE(this.scene,r.values.invariantBoundingSphere.ref.value,a,xn.skyblue,$tt,{aTransform:i.values.aTransform,matrix:i.values.matrix,transform:i.values.transform,extraTransform:i.values.extraTransform,uInstanceCount:i.values.uInstanceCount,instanceCount:i.values.instanceCount,aInstance:i.values.aInstance,hasReflection:i.values.hasReflection,instanceGrid:i.values.instanceGrid});c&&this.instancesData.set(i,c)}),this.objectsData.forEach((r,i)=>{this.parent.has(i)||(this.scene.remove(r.renderObject),this.objectsData.delete(i))}),this.instancesData.forEach((r,i)=>{this.parent.has(i)||(this.scene.remove(r.renderObject),this.instancesData.delete(i))}),this.scene.update(void 0,!1),this.scene.commit()}syncVisibility(){this.sceneData&&(this.sceneData.renderObject.state.visible=this._props.sceneBoundingSpheres),this.visibleSceneData&&(this.visibleSceneData.renderObject.state.visible=this._props.visibleSceneBoundingSpheres),this.parent.forEach((t,n)=>{const r=this.objectsData.get(n);r&&(r.renderObject.state.visible=n.state.visible&&this._props.objectBoundingSpheres);const i=this.instancesData.get(n);i&&(i.renderObject.state.visible=n.state.visible&&this._props.instanceBoundingSpheres)})}clear(){this.sceneData=void 0,this.objectsData.clear(),this.scene.clear()}get isEnabled(){return this._props.sceneBoundingSpheres||this._props.visibleSceneBoundingSpheres||this._props.objectBoundingSpheres||this._props.instanceBoundingSpheres}get props(){return this._props}setProps(t){Object.assign(this._props,t),this.isEnabled&&this.update()}}function CE(e,t,n,r,i,o){if(!n||!_e.equals(n.boundingSphere,t)){const s=function jtt(e,t){const r=xv(2),i=at.createState(r,r/2,t);if(e.radius&&(Zn(i,e.center,e.radius,2),_e.hasExtrema(e)))for(const o of e.extrema)Zn(i,o,1,0);return at.getMesh(i)}(t,n&&n.mesh),a=n?n.renderObject:function Ytt(e,t,n,r){return Ev("mesh",Nt.Utils.createValuesSimple(e,{alpha:.1,doubleSided:!1,cellSize:0,batchSize:0},t,1,r),{disposed:!1,visible:!0,alphaFactor:1,pickable:!1,colorOnly:!1,opaque:!1,writeDepth:!1},n)}(s,r,i,o);return n?k.updateIfChanged(a.values.drawCount,Zo.getDrawCount(s)):e.add(a),{boundingSphere:_e.clone(t),renderObject:a,mesh:s}}}const Htt=Hp(),qtt=Hp(),Wtt=Hp(),$tt=Hp();var E0=function(e){return e[e.Move=0]="Move",e[e.Click=1]="Click",e[e.Drag=2]="Drag",e}(E0||{});const P8=v(),M8=v(),fue=v(),pue={maxFps:C.Numeric(30,{min:10,max:60,step:10}),preferAtomPixelPadding:C.Numeric(3,{min:0,max:20,step:1},{description:"Number of extra pixels at which to prefer atoms over bonds."})};class Xtt{setProps(t){Object.assign(this.props,t)}identify(t,n){const r=this.startX!==this.endX||this.startY!==this.endY||this.input.pointerLock&&!this.controls.isMoving;if(t===E0.Drag)return void(r&&!this.outsideViewport(this.startX,this.startY)&&(this.events.drag.next({current:this.prevLoci,buttons:this.buttons,button:this.button,modifiers:this.modifiers,pageStart:Me.create(this.startX,this.startY),pageEnd:Me.create(this.endX,this.endY)}),this.startX=this.endX,this.startY=this.endY));if(r){const o=this.canvasIdentify(this.endX,this.endY);this.id=o?.id,this.position=o?.position,this.startX=this.endX,this.startY=this.endY}if(t===E0.Click){const o=this.getLoci(this.id,this.position);return this.events.click.next({current:o,buttons:this.buttons,button:this.button,modifiers:this.modifiers,page:Me.create(this.endX,this.endY),position:this.position}),void(this.prevLoci=o)}if(!this.inside||this.currentIdentifyT!==n||!r||this.outsideViewport(this.endX,this.endY))return;const i=this.getLoci(this.id,this.position);this.events.hover.next({current:i,buttons:this.buttons,button:this.button,modifiers:this.modifiers,page:Me.create(this.endX,this.endY),position:this.position}),this.prevLoci=i}tick(t){this.inside&&t-this.prevT>1e3/this.props.maxFps&&(this.prevT=t,this.currentIdentifyT=t,this.identify(this.isInteracting?E0.Drag:E0.Move,t))}leave(){this.inside=!1,yn.Loci.isEmpty(this.prevLoci)||(this.prevLoci=yn.Loci.Empty,this.events.hover.next({current:this.prevLoci,buttons:this.buttons,button:this.button,modifiers:this.modifiers}))}move(t,n,r,i,o){this.inside=!0,this.buttons=r,this.button=i,this.modifiers=o,this.endX=t,this.endY=n}click(t,n,r,i,o){this.endX=t,this.endY=n,this.buttons=r,this.button=i,this.modifiers=o,this.identify(E0.Click,0)}drag(t,n,r,i,o){this.endX=t,this.endY=n,this.buttons=r,this.button=i,this.modifiers=o,this.identify(E0.Drag,0)}modify(t){wu.areEqual(t,this.modifiers)||(this.modifiers=t,this.events.hover.next({current:this.prevLoci,buttons:this.buttons,button:this.button,modifiers:this.modifiers,page:Me.create(this.endX,this.endY),position:this.position}))}outsideViewport(t,n){const{input:r,camera:{viewport:i}}=this;return n*=r.pixelRatio,(t*=r.pixelRatio)>i.x+i.width||r.height-n>i.y+i.height||t{this.isInteracting=!0,this.drag(a,c,u,l,d)}),r.move.subscribe(({x:a,y:c,inside:u,buttons:l,button:d,modifiers:f,onElement:p})=>{if(u&&!this.isInteracting){if(!p)return void this.leave();this.move(a,c,l,d,f)}}),r.leave.subscribe(()=>{this.leave()}),r.click.subscribe(({x:a,y:c,buttons:u,button:l,modifiers:d})=>{this.outsideViewport(a,c)||this.click(a,c,u,l,d)}),r.interactionEnd.subscribe(()=>{this.isInteracting=!1}),r.modifiers.subscribe(a=>{this.modify(a)})}}const tnt={edgeThresholdMin:C.Numeric(.0312,{min:.0312,max:.0833,step:1e-4},{description:"Trims the algorithm from processing darks."}),edgeThresholdMax:C.Numeric(.063,{min:.063,max:.333,step:.001},{description:"The minimum amount of local contrast required to apply algorithm."}),iterations:C.Numeric(12,{min:0,max:16,step:1},{description:"Number of edge exploration steps."}),subpixelQuality:C.Numeric(.3,{min:0,max:1,step:.01},{description:"Choose the amount of sub-pixel aliasing removal."})};class nnt{constructor(t,n){this.webgl=t,this.renderable=function ont(e,t){const n=t.getWidth(),r=t.getHeight(),i={..._o,tColor:k.create(t),uTexSizeInv:k.create(Me.create(1/n,1/r)),dEdgeThresholdMin:k.create(.0312),dEdgeThresholdMax:k.create(.125),dIterations:k.create(12),dSubpixelQuality:k.create(.3)},o={...rnt};return ji(zi(e,"triangles",int,o,i),i)}(t,n)}updateState(t){const{gl:n,state:r}=this.webgl;r.enable(n.SCISSOR_TEST),r.disable(n.BLEND),r.disable(n.DEPTH_TEST),r.depthMask(!1);const{x:i,y:o,width:s,height:a}=t;r.viewport(i,o,s,a),r.scissor(i,o,s,a),r.clearColor(0,0,0,1),n.clear(n.COLOR_BUFFER_BIT)}setSize(t,n){k.update(this.renderable.values.uTexSizeInv,Me.set(this.renderable.values.uTexSizeInv.ref.value,1/t,1/n))}update(t,n){const{values:r}=this.renderable,{edgeThresholdMin:i,edgeThresholdMax:o,iterations:s,subpixelQuality:a}=n;let c=!1;r.tColor.ref.value!==t&&(k.update(this.renderable.values.tColor,t),c=!0),r.dEdgeThresholdMin.ref.value!==i&&(c=!0),k.updateIfChanged(r.dEdgeThresholdMin,i),r.dEdgeThresholdMax.ref.value!==o&&(c=!0),k.updateIfChanged(r.dEdgeThresholdMax,o),r.dIterations.ref.value!==s&&(c=!0),k.updateIfChanged(r.dIterations,s),r.dSubpixelQuality.ref.value!==a&&(c=!0),k.updateIfChanged(r.dSubpixelQuality,a),c&&this.renderable.update()}render(t,n){lt&&this.webgl.timer.mark("FxaaPass.render"),n?n.bind():this.webgl.unbindFramebuffer(),this.updateState(t),this.renderable.render(),lt&&this.webgl.timer.markEnd("FxaaPass.render")}}const rnt={...vo,tColor:jt("texture","rgba","ubyte","linear"),uTexSizeInv:xe("v2"),dEdgeThresholdMin:Ft("number"),dEdgeThresholdMax:Ft("number"),dIterations:Ft("number"),dSubpixelQuality:Ft("number")},int=Br("fxaa",ps,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\n// adapted from https://github.com/kosua20/Rendu\n// MIT License Copyright (c) 2017 Simon Rodriguez\n\n#define QUALITY(q) ((q) < 5 ? 1.0 : ((q) > 5 ? ((q) < 10 ? 2.0 : ((q) < 11 ? 4.0 : 8.0)) : 1.5))\n\nfloat rgb2luma(vec3 rgb){\n return sqrt(dot(rgb, vec3(0.299, 0.587, 0.114)));\n}\n\nfloat sampleLuma(vec2 uv) {\n return rgb2luma(texture2D(tColor, uv).rgb);\n}\n\nfloat sampleLuma(vec2 uv, float uOffset, float vOffset) {\n uv += uTexSizeInv * vec2(uOffset, vOffset);\n return sampleLuma(uv);\n}\n\nvoid main(void) {\n vec2 coords = gl_FragCoord.xy * uTexSizeInv;\n vec2 inverseScreenSize = uTexSizeInv;\n\n vec4 colorCenter = texture2D(tColor, coords);\n\n // Luma at the current fragment\n float lumaCenter = rgb2luma(colorCenter.rgb);\n\n // Luma at the four direct neighbours of the current fragment.\n float lumaDown = sampleLuma(coords, 0.0, -1.0);\n float lumaUp = sampleLuma(coords, 0.0, 1.0);\n float lumaLeft = sampleLuma(coords, -1.0, 0.0);\n float lumaRight = sampleLuma(coords, 1.0, 0.0);\n\n // Find the maximum and minimum luma around the current fragment.\n float lumaMin = min(lumaCenter, min(min(lumaDown, lumaUp), min(lumaLeft, lumaRight)));\n float lumaMax = max(lumaCenter, max(max(lumaDown, lumaUp), max(lumaLeft, lumaRight)));\n\n // Compute the delta.\n float lumaRange = lumaMax - lumaMin;\n\n // If the luma variation is lower that a threshold (or if we are in a really dark area),\n // we are not on an edge, don't perform any AA.\n if (lumaRange < max(dEdgeThresholdMin, lumaMax * dEdgeThresholdMax)) {\n gl_FragColor = colorCenter;\n return;\n }\n\n // Query the 4 remaining corners lumas.\n float lumaDownLeft = sampleLuma(coords, -1.0, -1.0);\n float lumaUpRight = sampleLuma(coords, 1.0, 1.0);\n float lumaUpLeft = sampleLuma(coords, -1.0, 1.0);\n float lumaDownRight = sampleLuma(coords, 1.0, -1.0);\n\n // Combine the four edges lumas (using intermediary variables for future computations\n // with the same values).\n float lumaDownUp = lumaDown + lumaUp;\n float lumaLeftRight = lumaLeft + lumaRight;\n\n // Same for corners\n float lumaLeftCorners = lumaDownLeft + lumaUpLeft;\n float lumaDownCorners = lumaDownLeft + lumaDownRight;\n float lumaRightCorners = lumaDownRight + lumaUpRight;\n float lumaUpCorners = lumaUpRight + lumaUpLeft;\n\n // Compute an estimation of the gradient along the horizontal and vertical axis.\n float edgeHorizontal = abs(-2.0 * lumaLeft + lumaLeftCorners) + abs(-2.0 * lumaCenter + lumaDownUp) * 2.0 + abs(-2.0 * lumaRight + lumaRightCorners);\n float edgeVertical = abs(-2.0 * lumaUp + lumaUpCorners) + abs(-2.0 * lumaCenter + lumaLeftRight) * 2.0 + abs(-2.0 * lumaDown + lumaDownCorners);\n\n // Is the local edge horizontal or vertical ?\n bool isHorizontal = (edgeHorizontal >= edgeVertical);\n\n // Choose the step size (one pixel) accordingly.\n float stepLength = isHorizontal ? inverseScreenSize.y : inverseScreenSize.x;\n\n // Select the two neighboring texels lumas in the opposite direction to the local edge.\n float luma1 = isHorizontal ? lumaDown : lumaLeft;\n float luma2 = isHorizontal ? lumaUp : lumaRight;\n // Compute gradients in this direction.\n float gradient1 = luma1 - lumaCenter;\n float gradient2 = luma2 - lumaCenter;\n\n // Which direction is the steepest ?\n bool is1Steepest = abs(gradient1) >= abs(gradient2);\n\n // Gradient in the corresponding direction, normalized.\n float gradientScaled = 0.25 * max(abs(gradient1), abs(gradient2));\n\n // Average luma in the correct direction.\n float lumaLocalAverage = 0.0;\n if(is1Steepest){\n // Switch the direction\n stepLength = -stepLength;\n lumaLocalAverage = 0.5 * (luma1 + lumaCenter);\n } else {\n lumaLocalAverage = 0.5 * (luma2 + lumaCenter);\n }\n\n // Shift UV in the correct direction by half a pixel.\n vec2 currentUv = coords;\n if(isHorizontal){\n currentUv.y += stepLength * 0.5;\n } else {\n currentUv.x += stepLength * 0.5;\n }\n\n // Compute offset (for each iteration step) in the right direction.\n vec2 offset = isHorizontal ? vec2(inverseScreenSize.x, 0.0) : vec2(0.0, inverseScreenSize.y);\n // Compute UVs to explore on each side of the edge, orthogonally.\n // The QUALITY allows us to step faster.\n vec2 uv1 = currentUv - offset * QUALITY(0);\n vec2 uv2 = currentUv + offset * QUALITY(0);\n\n // Read the lumas at both current extremities of the exploration segment,\n // and compute the delta wrt to the local average luma.\n float lumaEnd1 = sampleLuma(uv1);\n float lumaEnd2 = sampleLuma(uv2);\n lumaEnd1 -= lumaLocalAverage;\n lumaEnd2 -= lumaLocalAverage;\n\n // If the luma deltas at the current extremities is larger than the local gradient,\n // we have reached the side of the edge.\n bool reached1 = abs(lumaEnd1) >= gradientScaled;\n bool reached2 = abs(lumaEnd2) >= gradientScaled;\n bool reachedBoth = reached1 && reached2;\n\n // If the side is not reached, we continue to explore in this direction.\n if(!reached1){\n uv1 -= offset * QUALITY(1);\n }\n if(!reached2){\n uv2 += offset * QUALITY(1);\n }\n\n // If both sides have not been reached, continue to explore.\n if(!reachedBoth){\n for(int i = 2; i < dIterations; i++){\n // If needed, read luma in 1st direction, compute delta.\n if(!reached1){\n lumaEnd1 = sampleLuma(uv1);\n lumaEnd1 = lumaEnd1 - lumaLocalAverage;\n }\n // If needed, read luma in opposite direction, compute delta.\n if(!reached2){\n lumaEnd2 = sampleLuma(uv2);\n lumaEnd2 = lumaEnd2 - lumaLocalAverage;\n }\n // If the luma deltas at the current extremities is larger than the local gradient,\n // we have reached the side of the edge.\n reached1 = abs(lumaEnd1) >= gradientScaled;\n reached2 = abs(lumaEnd2) >= gradientScaled;\n reachedBoth = reached1 && reached2;\n\n // If the side is not reached, we continue to explore in this direction,\n // with a variable quality.\n if(!reached1){\n uv1 -= offset * QUALITY(i);\n }\n if(!reached2){\n uv2 += offset * QUALITY(i);\n }\n\n // If both sides have been reached, stop the exploration.\n if(reachedBoth){\n break;\n }\n }\n }\n\n // Compute the distances to each side edge of the edge (!).\n float distance1 = isHorizontal ? (coords.x - uv1.x) : (coords.y - uv1.y);\n float distance2 = isHorizontal ? (uv2.x - coords.x) : (uv2.y - coords.y);\n\n // In which direction is the side of the edge closer ?\n bool isDirection1 = distance1 < distance2;\n float distanceFinal = min(distance1, distance2);\n\n // Thickness of the edge.\n float edgeThickness = (distance1 + distance2);\n\n // Is the luma at center smaller than the local average ?\n bool isLumaCenterSmaller = lumaCenter < lumaLocalAverage;\n\n // If the luma at center is smaller than at its neighbour,\n // the delta luma at each end should be positive (same variation).\n bool correctVariation1 = (lumaEnd1 < 0.0) != isLumaCenterSmaller;\n bool correctVariation2 = (lumaEnd2 < 0.0) != isLumaCenterSmaller;\n\n // Only keep the result in the direction of the closer side of the edge.\n bool correctVariation = isDirection1 ? correctVariation1 : correctVariation2;\n\n // UV offset: read in the direction of the closest side of the edge.\n float pixelOffset = - distanceFinal / edgeThickness + 0.5;\n\n // If the luma variation is incorrect, do not offset.\n float finalOffset = correctVariation ? pixelOffset : 0.0;\n\n // Sub-pixel shifting\n // Full weighted average of the luma over the 3x3 neighborhood.\n float lumaAverage = (1.0 / 12.0) * (2.0 * (lumaDownUp + lumaLeftRight) + lumaLeftCorners + lumaRightCorners);\n // Ratio of the delta between the global average and the center luma,\n // over the luma range in the 3x3 neighborhood.\n float subPixelOffset1 = clamp(abs(lumaAverage - lumaCenter) / lumaRange, 0.0, 1.0);\n float subPixelOffset2 = (-2.0 * subPixelOffset1 + 3.0) * subPixelOffset1 * subPixelOffset1;\n // Compute a sub-pixel offset based on this delta.\n float subPixelOffsetFinal = subPixelOffset2 * subPixelOffset2 * float(dSubpixelQuality);\n\n // Pick the biggest of the two offsets.\n finalOffset = max(finalOffset, subPixelOffsetFinal);\n\n // Compute the final UV coordinates.\n vec2 finalUv = coords;\n if(isHorizontal){\n finalUv.y += finalOffset * stepLength;\n } else {\n finalUv.x += finalOffset * stepLength;\n }\n\n // Read the color at the new UV coordinates, and use it.\n gl_FragColor = texture2D(tColor, finalUv);\n}\n"),fnt={edgeThreshold:C.Numeric(.1,{min:.05,max:.15,step:.01}),maxSearchSteps:C.Numeric(16,{min:0,max:32,step:1})};class pnt{get supported(){return this._supported}constructor(t,n){if(this.webgl=t,this._supported=!1,typeof HTMLImageElement>"u")return void(un&&console.log('Missing "HTMLImageElement" required for "SMAA"'));const r=n.getWidth(),i=n.getHeight();this.edgesTarget=t.createRenderTarget(r,i,!1,"uint8","linear"),this.weightsTarget=t.createRenderTarget(r,i,!1,"uint8","linear"),this.edgesRenderable=function gnt(e,t){const n=t.getWidth(),r=t.getHeight(),i={..._o,tColor:k.create(t),uTexSizeInv:k.create(Me.create(1/n,1/r)),uViewport:k.create(nn()),dEdgeThreshold:k.create(.1)},o={...hnt};return ji(zi(e,"triangles",mnt,o,i),i)}(t,n),this.weightsRenderable=function vnt(e,t){const n=t.getWidth(),r=t.getHeight(),i=e.resources.texture("image-uint8","rgb","ubyte","linear"),o=e.resources.texture("image-uint8","rgba","ubyte","nearest"),s={..._o,tEdges:k.create(t),tArea:k.create(i),tSearch:k.create(o),uTexSizeInv:k.create(Me.create(1/n,1/r)),uViewport:k.create(nn()),dMaxSearchSteps:k.create(16)};Zre("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAIAAACOVPcQAACBeklEQVR42u39W4xlWXrnh/3WWvuciIzMrKxrV8/0rWbY0+SQFKcb4owIkSIFCjY9AC1BT/LYBozRi+EX+cV+8IMsYAaCwRcBwjzMiw2jAWtgwC8WR5Q8mDFHZLNHTarZGrLJJllt1W2qKrsumZWZcTvn7L3W54e1vrXX3vuciLPPORFR1XE2EomorB0nVuz//r71re/y/1eMvb4Cb3N11xV/PP/2v4UBAwJG/7H8urx6/25/Gf8O5hypMQ0EEEQwAqLfoN/Z+97f/SW+/NvcgQk4sGBJK6H7N4PFVL+K+e0N11yNfkKvwUdwdlUAXPHHL38oa15f/i/46Ih6SuMSPmLAYAwyRKn7dfMGH97jaMFBYCJUgotIC2YAdu+LyW9vvubxAP8kAL8H/koAuOKP3+q6+xGnd5kdYCeECnGIJViwGJMAkQKfDvB3WZxjLKGh8VSCCzhwEWBpMc5/kBbjawT4HnwJfhr+pPBIu7uu+OOTo9vsmtQcniMBGkKFd4jDWMSCRUpLjJYNJkM+IRzQ+PQvIeAMTrBS2LEiaiR9b/5PuT6Ap/AcfAFO4Y3dA3DFH7/VS+M8k4baEAQfMI4QfbVDDGIRg7GKaIY52qAjTAgTvGBAPGIIghOCYAUrGFNgzA7Q3QhgCwfwAnwe5vDejgG44o/fbm1C5ZlYQvQDARPAIQGxCWBM+wWl37ZQESb4gImexGMDouhGLx1Cst0Saa4b4AqO4Hk4gxo+3DHAV/nx27p3JziPM2pVgoiia5MdEzCGULprIN7gEEeQ5IQxEBBBQnxhsDb5auGmAAYcHMA9eAAz8PBol8/xij9+C4Djlim4gJjWcwZBhCBgMIIYxGAVIkH3ZtcBuLdtRFMWsPGoY9rN+HoBji9VBYdwD2ZQg4cnO7OSq/z4rU5KKdwVbFAjNojCQzTlCLPFSxtamwh2jMUcEgg2Wm/6XgErIBhBckQtGN3CzbVacERgCnfgLswhnvqf7QyAq/z4rRZm1YglYE3affGITaZsdIe2FmMIpnOCap25I6jt2kCwCW0D1uAD9sZctNGXcQIHCkINDQgc78aCr+zjtw3BU/ijdpw3zhCwcaONwBvdeS2YZKkJNJsMPf2JKEvC28RXxxI0ASJyzQCjCEQrO4Q7sFArEzjZhaFc4cdv+/JFdKULM4px0DfUBI2hIsy06BqLhGTQEVdbfAIZXYMPesq6VoCHICzUyjwInO4Y411//LYLs6TDa9wvg2CC2rElgAnpTBziThxaL22MYhzfkghz6GAs2VHbbdM91VZu1MEEpupMMwKyVTb5ij9+u4VJG/5EgEMMmFF01cFai3isRbKbzb+YaU/MQbAm2XSMoUPAmvZzbuKYRIFApbtlrfFuUGd6vq2hXNnH78ZLh/iFhsQG3T4D1ib7k5CC6vY0DCbtrohgLEIClXiGtl10zc0CnEGIhhatLBva7NP58Tvw0qE8yWhARLQ8h4+AhQSP+I4F5xoU+VilGRJs6wnS7ruti/4KvAY/CfdgqjsMy4pf8fodQO8/gnuX3f/3xi3om1/h7THr+co3x93PP9+FBUfbNUjcjEmhcrkT+8K7ml7V10Jo05mpIEFy1NmCJWx9SIKKt+EjAL4Ez8EBVOB6havuT/rByPvHXK+9zUcfcbb254+9fydJknYnRr1oGfdaiAgpxu1Rx/Rek8KISftx3L+DfsLWAANn8Hvw0/AFeAGO9DFV3c6D+CcWbL8Dj9e7f+T1k8AZv/d7+PXWM/Z+VvdCrIvuAKO09RpEEQJM0Ci6+B4xhTWr4cZNOvhktabw0ta0rSJmqz3Yw5/AKXwenod7cAhTmBSPKf6JBdvH8IP17h95pXqw50/+BFnj88fev4NchyaK47OPhhtI8RFSvAfDSNh0Ck0p2gLxGkib5NJj/JWCr90EWQJvwBzO4AHcgztwAFN1evHPUVGwfXON+0debT1YeGON9Yy9/63X+OguiwmhIhQhD7l4sMqlG3D86Suc3qWZ4rWjI1X7u0Ytw6x3rIMeIOPDprfe2XzNgyj6PahhBjO4C3e6puDgXrdg+/5l948vF3bqwZetZ+z9Rx9zdIY5pInPK4Nk0t+l52xdK2B45Qd87nM8fsD5EfUhIcJcERw4RdqqH7Yde5V7m1vhNmtedkz6EDzUMF/2jJYWbC+4fzzA/Y+/8PPH3j9dcBAPIRP8JLXd5BpAu03aziOL3VVHZzz3CXWDPWd+SH2AnxIqQoTZpo9Ckc6HIrFbAbzNmlcg8Ag8NFDDAhbJvTBZXbC94P7t68EXfv6o+21gUtPETU7bbkLxvNKRFG2+KXzvtObonPP4rBvsgmaKj404DlshFole1Glfh02fE7bYR7dZ82oTewIBGn1Md6CG6YUF26X376oevOLzx95vhUmgblI6LBZwTCDY7vMq0op5WVXgsObOXJ+1x3qaBl9j1FeLxbhU9w1F+Wiba6s1X/TBz1LnUfuYDi4r2C69f1f14BWfP+p+W2GFKuC9phcELMYRRLur9DEZTUdEH+iEqWdaM7X4WOoPGI+ZYD2+wcQ+y+ioHUZ9dTDbArzxmi/bJI9BND0Ynd6lBdve/butBw8+f/T9D3ABa3AG8W3VPX4hBin+bj8dMMmSpp5pg7fJ6xrBFE2WQQEWnV8Qg3FbAWzYfM1rREEnmvkN2o1+acG2d/9u68GDzx91v3mAjb1zkpqT21OipPKO0b9TO5W0nTdOmAQm0TObts3aBKgwARtoPDiCT0gHgwnbArzxmtcLc08HgF1asN0C4Ms/fvD5I+7PhfqyXE/b7RbbrGyRQRT9ARZcwAUmgdoz0ehJ9Fn7QAhUjhDAQSw0bV3T3WbNa59jzmiP6GsWbGXDX2ytjy8+f9T97fiBPq9YeLdBmyuizZHaqXITnXiMUEEVcJ7K4j3BFPurtB4bixW8wTpweL8DC95szWMOqucFYGsWbGU7p3TxxxefP+r+oTVktxY0v5hbq3KiOKYnY8ddJVSBxuMMVffNbxwIOERShst73HZ78DZrHpmJmH3K6sGz0fe3UUj0eyRrSCGTTc+rjVNoGzNSv05srAxUBh8IhqChiQgVNIIBH3AVPnrsnXQZbLTm8ammv8eVXn/vWpaTem5IXRlt+U/LA21zhSb9cye6jcOfCnOwhIAYXAMVTUNV0QhVha9xjgA27ODJbLbmitt3tRN80lqG6N/khgot4ZVlOyO4WNg3OIMzhIZQpUEHieg2im6F91hB3I2tubql6BYNN9Hj5S7G0G2tahslBWKDnOiIvuAEDzakDQKDNFQT6gbn8E2y4BBubM230YIpBnDbMa+y3dx0n1S0BtuG62lCCXwcY0F72T1VRR3t2ONcsmDjbmzNt9RFs2LO2hQNyb022JisaI8rAWuw4HI3FuAIhZdOGIcdjLJvvObqlpqvWTJnnQbyi/1M9O8UxWhBs//H42I0q1Yb/XPGONzcmm+ri172mHKvZBpHkJaNJz6v9jxqiklDj3U4CA2ugpAaYMWqNXsdXbmJNd9egCnJEsphXNM+MnK3m0FCJ5S1kmJpa3DgPVbnQnPGWIDspW9ozbcO4K/9LkfaQO2KHuqlfFXSbdNzcEcwoqNEFE9zcIXu9/6n/ym/BC/C3aJLzEKPuYVlbFnfhZ8kcWxV3dbv4bKl28566wD+8C53aw49lTABp9PWbsB+knfc/Li3eVizf5vv/xmvnPKg5ihwKEwlrcHqucuVcVOxEv8aH37E3ZqpZypUulrHEtIWKUr+txHg+ojZDGlwnqmkGlzcVi1dLiNSJiHjfbRNOPwKpx9TVdTn3K05DBx4psIk4Ei8aCkJahRgffk4YnEXe07T4H2RR1u27E6wfQsBDofUgjFUFnwC2AiVtA+05J2zpiDK2Oa0c5fmAecN1iJzmpqFZxqYBCYhFTCsUNEmUnIcZ6aEA5rQVhEywG6w7HSW02XfOoBlQmjwulOFQAg66SvJblrTEX1YtJ3uG15T/BH1OfOQeuR8g/c0gdpT5fx2SKbs9EfHTKdM8A1GaJRHLVIwhcGyydZsbifAFVKl5EMKNU2Hryo+06BeTgqnxzYjThVySDikbtJPieco75lYfKAJOMEZBTjoITuWHXXZVhcUDIS2hpiXHV9Ku4u44bN5OYLDOkJo8w+xJSMbhBRHEdEs9JZUCkQrPMAvaHyLkxgkEHxiNkx/x2YB0mGsQ8EUWj/stW5YLhtS5SMu+/YBbNPDCkGTUybN8krRLBGPlZkVOA0j+a1+rkyQKWGaPHPLZOkJhioQYnVZ2hS3zVxMtgC46KuRwbJNd9nV2PHgb36F194ecf/Yeu2vAFe5nm/bRBFrnY4BauE8ERmZRFUn0k8hbftiVYSKMEme2dJCJSCGYAlNqh87bXOPdUkGy24P6d1ll21MBqqx48Fvv8ZHH8HZFY7j/uAq1xMJUFqCSUlJPmNbIiNsmwuMs/q9CMtsZsFO6SprzCS1Z7QL8xCQClEelpjTduDMsmWD8S1PT152BtvmIGvUeDA/yRn83u/x0/4qxoPHjx+PXY9pqX9bgMvh/Nz9kpP4pOe1/fYf3axUiMdHLlPpZCNjgtNFAhcHEDxTumNONhHrBduW+vOyY++70WWnPXj98eA4kOt/mj/5E05l9+O4o8ePx67HFqyC+qSSnyselqjZGaVK2TadbFLPWAQ4NBhHqDCCV7OTpo34AlSSylPtIdd2AJZlyzYQrDJ5lcWGNceD80CunPLGGzsfD+7wRb95NevJI5docQ3tgCyr5bGnyaPRlmwNsFELViOOx9loebGNq2moDOKpHLVP5al2cymWHbkfzGXL7kfRl44H9wZy33tvt+PB/Xnf93e+nh5ZlU18wCiRUa9m7kib9LYuOk+hudQNbxwm0AQqbfloimaB2lM5fChex+ylMwuTbfmXQtmWlenZljbdXTLuOxjI/fDDHY4Hjx8/Hrse0zXfPFxbUN1kKqSCCSk50m0Ajtx3ub9XHBKHXESb8iO6E+qGytF4nO0OG3SXzbJlhxBnKtKyl0NwybjvYCD30aMdjgePHz8eu56SVTBbgxJMliQ3Oauwg0QHxXE2Ez/EIReLdQj42Gzb4CLS0YJD9xUx7bsi0vJi5mUbW1QzL0h0PFk17rtiIPfJk52MB48fPx67npJJwyrBa2RCCQRTbGZSPCxTPOiND4G2pYyOQ4h4jINIJh5wFU1NFZt+IsZ59LSnDqBjZ2awbOku+yInunLcd8VA7rNnOxkPHj9+PGY9B0MWJJNozOJmlglvDMXDEozdhQWbgs/U6oBanGzLrdSNNnZFjOkmbi5bNt1lX7JLLhn3vXAg9/h4y/Hg8ePHI9dzQMEkWCgdRfYykYKnkP7D4rIujsujaKPBsB54vE2TS00ccvFY/Tth7JXeq1hz+qgVy04sAJawTsvOknHfCwdyT062HA8eP348Zj0vdoXF4pilKa2BROed+9fyw9rWRXeTFXESMOanvDZfJuJaSXouQdMdDJZtekZcLLvEeK04d8m474UDuaenW44Hjx8/Xns9YYqZpszGWB3AN/4VHw+k7WSFtJ3Qicuqb/NlVmgXWsxh570xg2UwxUw3WfO6B5nOuO8aA7lnZxuPB48fPx6znm1i4bsfcbaptF3zNT78eFPtwi1OaCNOqp1x3zUGcs/PN++AGD1+fMXrSVm2baTtPhPahbPhA71wIHd2bXzRa69nG+3CraTtPivahV/55tXWg8fyRY/9AdsY8VbSdp8V7cKrrgdfM//z6ILQFtJ2nxHtwmuoB4/kf74+gLeRtvvMaBdeSz34+vifx0YG20jbfTa0C6+tHrwe//NmOG0L8EbSdp8R7cLrrQe/996O+ai3ujQOskpTNULa7jOjXXj99eCd8lHvoFiwsbTdZ0a78PrrwTvlo966pLuRtB2fFe3Cm6oHP9kNH/W2FryxtN1nTLvwRurBO+Kj3pWXHidtx2dFu/Bm68Fb81HvykuPlrb7LGkX3mw9eGs+6h1Y8MbSdjegXcguQLjmevDpTQLMxtJ2N6NdyBZu9AbrwVvwUW+LbteULUpCdqm0HTelXbhNPe8G68Gb8lFvVfYfSNuxvrTdTWoXbozAzdaDZzfkorOj1oxVxlIMlpSIlpLrt8D4hrQL17z+c3h6hU/wv4Q/utps4+bm+6P/hIcf0JwQ5oQGPBL0eKPTYEXTW+eL/2DKn73J9BTXYANG57hz1cEMviVf/4tf5b/6C5pTQkMIWoAq7hTpOJjtAM4pxKu5vg5vXeUrtI09/Mo/5H+4z+Mp5xULh7cEm2QbRP2tFIKR7WM3fPf/jZ3SWCqLM2l4NxID5zB72HQXv3jj/8mLR5xXNA5v8EbFQEz7PpRfl1+MB/hlAN65qgDn3wTgH13hK7T59bmP+NIx1SHHU84nLOITt3iVz8mNO+lPrjGAnBFqmioNn1mTyk1ta47R6d4MrX7tjrnjYUpdUbv2rVr6YpVfsGG58AG8Ah9eyUN8CX4WfgV+G8LVWPDGb+Zd4cU584CtqSbMKxauxTg+dyn/LkVgA+IR8KHtejeFKRtTmLLpxN6mYVLjYxwXf5x2VofiZcp/lwKk4wGOpYDnoIZPdg/AAbwMfx0+ge9dgZvYjuqKe4HnGnykYo5TvJbG0Vj12JagRhwKa44H95ShkZa5RyLGGdfYvG7aw1TsF6iapPAS29mNS3NmsTQZCmgTzFwgL3upCTgtBTRwvGMAKrgLn4evwin8+afJRcff+8izUGUM63GOOuAs3tJkw7J4kyoNreqrpO6cYLQeFUd7TTpr5YOTLc9RUUogUOVJQ1GYJaFLAW0oTmKyYS46ZooP4S4EON3xQ5zC8/CX4CnM4c1PE8ApexpoYuzqlP3d4S3OJP8ZDK7cKWNaTlqmgDiiHwl1YsE41w1zT4iRTm3DBqxvOUsbMKKDa/EHxagtnta072ejc3DOIh5ojvh8l3tk1JF/AV6FU6jh3U8HwEazLgdCLYSQ+MYiAI2ltomkzttUb0gGHdSUUgsIYjTzLG3mObX4FBRaYtpDVNZrih9TgTeYOBxsEnN1gOCTM8Bsw/ieMc75w9kuAT6A+/AiHGvN/+Gn4KRkiuzpNNDYhDGFndWRpE6SVfm8U5bxnSgVV2jrg6JCKmneqey8VMFgq2+AM/i4L4RUbfSi27lNXZ7R7W9RTcq/q9fk4Xw3AMQd4I5ifAZz8FcVtm9SAom/dyN4lczJQW/kC42ZrHgcCoIf1oVMKkVItmMBi9cOeNHGLqOZk+QqQmrbc5YmYgxELUUN35z2iohstgfLIFmcMV7s4CFmI74L9+EFmGsi+tGnAOD4Yk9gIpo01Y4cA43BWGygMdr4YZekG3OBIUXXNukvJS8tqa06e+lSDCtnqqMFu6hWHXCF+WaYt64m9QBmNxi7Ioy7D+fa1yHw+FMAcPt7SysFLtoG4PXAk7JOA3aAxBRqUiAdU9Yp5lK3HLSRFtOim0sa8euEt08xvKjYjzeJ2GU7YawexrnKI9tmobInjFXCewpwriY9+RR4aaezFhMhGCppKwom0ChrgFlKzyPKkGlTW1YQrE9HJqu8hKGgMc6hVi5QRq0PZxNfrYNgE64utmRv6KKHRpxf6VDUaOvNP5jCEx5q185My/7RKz69UQu2im5k4/eownpxZxNLwiZ1AZTO2ZjWjkU9uaB2HFn6Q3u0JcsSx/qV9hTEApRzeBLDJQXxYmTnq7bdLa3+uqFrxLJ5w1TehnNHx5ECvCh2g2c3hHH5YsfdaSKddztfjQ6imKFGSyFwlLzxEGPp6r5IevVjk1AMx3wMqi1NxDVjLBiPs9tbsCkIY5we5/ML22zrCScFxnNtzsr9Wcc3CnD+pYO+4VXXiDE0oc/vQQ/fDK3oPESJMYXNmJa/DuloJZkcTpcYE8lIH8Dz8DJMiynNC86Mb2lNaaqP/+L7f2fcE/yP7/Lde8xfgSOdMxvOixZf/9p3+M4hT1+F+zApxg9XfUvYjc8qX2lfOOpK2gNRtB4flpFu9FTKCp2XJRgXnX6olp1zyYjTKJSkGmLE2NjUr1bxFM4AeAAHBUFIeSLqXR+NvH/M9fOnfHzOD2vCSyQJKzfgsCh+yi/Mmc35F2fUrw7miW33W9hBD1vpuUojFphIyvg7aTeoymDkIkeW3XLHmguMzbIAJejN6B5MDrhipE2y6SoFRO/AK/AcHHZHNIfiWrEe/C6cr3f/yOvrQKB+zMM55/GQdLDsR+ifr5Fiuu+/y+M78LzOE5dsNuXC3PYvYWd8NXvphLSkJIasrlD2/HOqQ+RjcRdjKTGWYhhVUm4yxlyiGPuMsZR7sMCHUBeTuNWA7if+ifXgc/hovftHXs/DV+Fvwe+f8shzMiMcweFgBly3//vwJfg5AN4450fn1Hd1Rm1aBLu22Dy3y3H2+OqMemkbGZ4jozcDjJf6596xOLpC0eMTHbKnxLxH27uZ/bMTGs2jOaMOY4m87CfQwF0dw53oa1k80JRuz/XgS+8fX3N9Af4qPIMfzKgCp4H5TDGe9GGeFPzSsZz80SlPTxXjgwJmC45njzgt2vbQ4b4OAdUK4/vWhO8d8v6EE8fMUsfakXbPpFJeLs2ubM/qdm/la3WP91uWhxXHjoWhyRUq2iJ/+5mA73zwIIo+LoZ/SgvIRjAd1IMvvn98PfgOvAJfhhm8scAKVWDuaRaK8aQ9f7vuPDH6Bj47ZXau7rqYJ66mTDwEDU6lLbCjCK0qTXyl5mnDoeNRxanj3FJbaksTk0faXxHxLrssgPkWB9LnA/MFleXcJozzjwsUvUG0X/QCve51qkMDXp9mtcyOy3rwBfdvVJK7D6/ACSzg3RoruIq5UDeESfEmVclDxnniU82vxMLtceD0hGZWzBNPMM/jSPne2OVatiTKUpY5vY7gc0LdUAWeWM5tH+O2I66AOWw9xT2BuyRVLGdoDHUsVRXOo/c+ZdRXvFfnxWyIV4upFLCl9eAL7h8Zv0QH8Ry8pA2cHzQpGesctVA37ZtklBTgHjyvdSeKY/RZw/kJMk0Y25cSNRWSigQtlULPTw+kzuJPeYEkXjQRpoGZobYsLF79pyd1dMRHInbgFTZqNLhDqiIsTNpoex2WLcy0/X6rHcdMMQvFSd5dWA++4P7xv89deACnmr36uGlL69bRCL6BSZsS6c0TU2TKK5gtWCzgAOOwQcurqk9j8whvziZSMLcq5hbuwBEsYjopUBkqw1yYBGpLA97SRElEmx5MCInBY5vgLk94iKqSWmhIGmkJ4Bi9m4L645J68LyY4wsFYBfUg5feP/6gWWm58IEmKQM89hq7KsZNaKtP5TxxrUZZVkNmMJtjbKrGxLNEbHPJxhqy7lAmbC32ZqeF6lTaknRWcYaFpfLUBh/rwaQycCCJmW15Kstv6jRHyJFry2C1ahkkIW0LO75s61+owxK1y3XqweX9m5YLM2DPFeOjn/iiqCKJ+yKXF8t5Yl/kNsqaSCryxPq5xWTFIaP8KSW0RYxqupaUf0RcTNSSdJZGcKYdYA6kdtrtmyBckfKXwqk0pHpUHlwWaffjNRBYFPUDWa8e3Lt/o0R0CdisKDM89cX0pvRHEfM8ca4t0s2Xx4kgo91MPQJ/0c9MQYq0co8MBh7bz1fio0UUHLR4aAIOvOmoYO6kwlEVODSSTliWtOtH6sPkrtctF9ZtJ9GIerBskvhdVS5cFNv9s1BU0AbdUgdK4FG+dRnjFmDTzniRMdZO1QhzMK355vigbdkpz9P6qjUGE5J2qAcXmwJ20cZUiAD0z+pGMx6xkzJkmEf40Hr4qZfVg2XzF9YOyoV5BjzVkUJngKf8lgNYwKECEHrCNDrWZzMlflS3yBhr/InyoUgBc/lKT4pxVrrC6g1YwcceK3BmNxZcAtz3j5EIpqguh9H6wc011YN75cKDLpFDxuwkrPQmUwW4KTbj9mZTwBwLq4aQMUZbHm1rylJ46dzR0dua2n3RYCWZsiHROeywyJGR7mXKlpryyCiouY56sFkBWEnkEB/raeh/Sw4162KeuAxMQpEkzy5alMY5wamMsWKKrtW2WpEWNnReZWONKWjrdsKZarpFjqCslq773PLmEhM448Pc3+FKr1+94vv/rfw4tEcu+lKTBe4kZSdijBrykwv9vbCMPcLQTygBjzVckSLPRVGslqdunwJ4oegtFOYb4SwxNgWLCmD7T9kVjTv5YDgpo0XBmN34Z/rEHp0sgyz7lngsrm4lvMm2Mr1zNOJYJ5cuxuQxwMGJq/TP5emlb8fsQBZviK4t8hFL+zbhtlpwaRSxQRWfeETjuauPsdGxsBVdO7nmP4xvzSoT29pRl7kGqz+k26B3Oy0YNV+SXbbQas1ctC/GarskRdFpKczVAF1ZXnLcpaMuzVe6lZ2g/1ndcvOVgRG3sdUAY1bKD6achijMPdMxV4muKVorSpiDHituH7rSTs7n/4y5DhRXo4FVBN4vO/zbAcxhENzGbHCzU/98Mcx5e7a31kWjw9FCe/zNeYyQjZsWb1uc7U33pN4Mji6hCLhivqfa9Ss6xLg031AgfesA/l99m9fgvnaF9JoE6bYKmkGNK3aPbHB96w3+DnxFm4hs0drLsk7U8kf/N/CvwQNtllna0rjq61sH8L80HAuvwH1tvBy2ChqWSCaYTaGN19sTvlfzFD6n+iKTbvtayfrfe9ueWh6GJFoxLdr7V72a5ZpvHcCPDzma0wTO4EgbLyedxstO81n57LYBOBzyfsOhUKsW1J1BB5vr/tz8RyqOFylQP9Tvst2JALsC5lsH8PyQ40DV4ANzYa4dedNiKNR1s+x2wwbR7q4/4cTxqEk4LWDebfisuo36JXLiWFjOtLrlNWh3K1rRS4xvHcDNlFnNmWBBAl5SWaL3oPOfnvbr5pdjVnEaeBJSYjuLEkyLLsWhKccadmOphZkOPgVdalj2QpSmfOsADhMWE2ZBu4+EEJI4wKTAuCoC4xwQbWXBltpxbjkXJtKxxabo9e7tyhlgb6gNlSbUpMh+l/FaqzVwewGu8BW1Zx7pTpQDJUjb8tsUTW6+GDXbMn3mLbXlXJiGdggxFAoUrtPS3wE4Nk02UZG2OOzlk7fRs7i95QCLo3E0jtrjnM7SR3uS1p4qtS2nJ5OwtQVHgOvArLBFijZUV9QtSl8dAY5d0E0hM0w3HS2DpIeB6m/A1+HfhJcGUq4sOxH+x3f5+VO+Ds9rYNI7zPXOYWPrtf8bYMx6fuOAX5jzNR0PdsuON+X1f7EERxMJJoU6GkTEWBvVolVlb5lh3tKCg6Wx1IbaMDdJ+9sUCc5KC46hKGCk3IVOS4TCqdBNfUs7Kd4iXf2RjnT/LLysJy3XDcHLh/vde3x8DoGvwgsa67vBk91G5Pe/HbOe7xwym0NXbtiuuDkGO2IJDh9oQvJ4cY4vdoqLDuoH9Zl2F/ofsekn8lkuhIlhQcffUtSjytFyp++p6NiE7Rqx/lodgKVoceEp/CP4FfjrquZaTtj2AvH5K/ywpn7M34K/SsoYDAdIN448I1/0/wveW289T1/lX5xBzc8N5IaHr0XMOQdHsIkDuJFifj20pBm5jzwUv9e2FhwRsvhAbalCIuIw3bhJihY3p6nTFFIZgiSYjfTf3aXuOjmeGn4bPoGvwl+CFzTRczBIuHBEeImHc37/lGfwZR0cXzVDOvaKfNHvwe+suZ771K/y/XcBlsoN996JpBhoE2toYxOznNEOS5TJc6Id5GEXLjrWo+LEWGNpPDU4WAwsIRROu+1vM+0oW37z/MBN9kqHnSArwPfgFJ7Cq/Ai3Ie7g7ncmI09v8sjzw9mzOAEXoIHxURueaAce5V80f/DOuuZwHM8vsMb5wBzOFWM7wymTXPAEvm4vcFpZ2ut0VZRjkiP2MlmLd6DIpbGSiHOjdnUHN90hRYmhTnmvhzp1iKDNj+b7t5hi79lWGwQ+HN9RsfFMy0FXbEwhfuczKgCbyxYwBmcFhhvo/7a44v+i3XWcwDP86PzpGQYdWh7csP5dBvZ1jNzdxC8pBGuxqSW5vw40nBpj5JhMwvOzN0RWqERHMr4Lv1kWX84xLR830G3j6yqZ1a8UstTlW+qJPOZ+sZ7xZPKTJLhiNOAFd6tk+jrTH31ncLOxid8+nzRb128HhUcru/y0Wn6iT254YPC6FtVSIMoW2sk727AhvTtrWKZTvgsmckfXYZWeNRXx/3YQ2OUxLDrbHtN11IwrgXT6c8dATDwLniYwxzO4RzuQqTKSC5gAofMZ1QBK3zQ4JWobFbcvJm87FK+6JXrKahLn54m3p+McXzzYtP8VF/QpJuh1OwieElEoI1pRxPS09FBrkq2tWCU59+HdhNtTIqKm8EBrw2RTOEDpG3IKo2Y7mFdLm3ZeVjYwVw11o/oznceMve4CgMfNym/utA/d/ILMR7gpXzRy9eDsgLcgbs8O2Va1L0zzIdwGGemTBuwROHeoMShkUc7P+ISY3KH5ZZeWqO8mFTxQYeXTNuzvvK5FGPdQfuu00DwYFY9dyhctEt+OJDdnucfpmyhzUJzfsJjr29l8S0bXBfwRS9ZT26tmMIdZucch5ZboMz3Nio3nIOsYHCGoDT4kUA9MiXEp9Xsui1S8th/kbWIrMBxDGLodWUQIWcvnXy+9M23xPiSMOiRPqM+YMXkUN3gXFrZJwXGzUaMpJfyRS9ZT0lPe8TpScuRlbMHeUmlaKDoNuy62iWNTWNFYjoxFzuJs8oR+RhRx7O4SVNSXpa0ZJQ0K1LAHDQ+D9IepkMXpcsq5EVCvClBUIzDhDoyKwDw1Lc59GbTeORivugw1IcuaEOaGWdNm+Ps5fQ7/tm0DjMegq3yM3vb5j12qUId5UZD2oxDSEWOZMSqFl/W+5oynWDa/aI04tJRQ2eTXusg86SQVu/nwSYwpW6wLjlqIzwLuxGIvoAvul0PS+ZNz0/akp/pniO/8JDnGyaCkzbhl6YcqmK/69prxPqtpx2+Km9al9sjL+rwMgHw4jE/C8/HQ3m1vBuL1fldbzd8mOueVJ92syqdEY4KJjSCde3mcRw2TA6szxedn+zwhZMps0XrqEsiUjnC1hw0TELC2Ek7uAAdzcheXv1BYLagspxpzSAoZZUsIzIq35MnFQ9DOrlNB30jq3L4pkhccKUAA8/ocvN1Rzx9QyOtERs4CVsJRK/DF71kPYrxYsGsm6RMh4cps5g1DOmM54Ly1ii0Hd3Y/BMk8VWFgBVmhqrkJCPBHAolwZaWzLR9Vb7bcWdX9NyUYE+uB2BKfuaeBUcjDljbYVY4DdtsVWvzRZdWnyUzDpjNl1Du3aloAjVJTNDpcIOVVhrHFF66lLfJL1zJr9PQ2nFJSBaKoDe+sAvLufZVHVzYh7W0h/c6AAZ+7Tvj6q9j68G/cTCS/3n1vLKHZwNi+P+pS0WkZNMBMUl+LDLuiE4omZy71r3UFMwNJV+VJ/GC5ixVUkBStsT4gGKh0Gm4Oy3qvq7Lbmq24nPdDuDR9deR11XzP4vFu3TYzfnIyiSVmgizUYGqkIXNdKTY9pgb9D2Ix5t0+NHkVzCdU03suWkkVZAoCONCn0T35gAeW38de43mf97sMOpSvj4aa1KYUm58USI7Wxxes03bAZdRzk6UtbzMaCQ6IxO0dy7X+XsjoD16hpsBeGz9dfzHj+R/Hp8nCxZRqkEDTaCKCSywjiaoMJ1TITE9eg7Jqnq8HL6gDwiZb0u0V0Rr/rmvqjxKuaLCX7ZWXTvAY+uvm3z8CP7nzVpngqrJpZKwWnCUjIviYVlirlGOzPLI3SMVyp/elvBUjjDkNhrtufFFErQ8pmdSlbK16toBHlt/HV8uHMX/vEGALkV3RJREiSlopxwdMXOZPLZ+ix+kAHpMKIk8UtE1ygtquttwxNhphrIZ1IBzjGF3IIGxGcBj6q8bHJBG8T9vdsoWrTFEuebEZuVxhhClH6P5Zo89OG9fwHNjtNQTpD0TG9PJLEYqvEY6Rlxy+ZZGfL0Aj62/bnQCXp//eeM4KzfQVJbgMQbUjlMFIm6TpcfWlZje7NBSV6IsEVmumWIbjiloUzQX9OzYdo8L1wjw2PrrpimONfmfNyzKklrgnEkSzT5QWYQW40YShyzqsRmMXbvVxKtGuYyMKaU1ugenLDm5Ily4iT14fP11Mx+xJv+zZ3MvnfdFqxU3a1W/FTB4m3Qfsyc1XUcdVhDeUDZXSFHHLQj/Y5jtC7ZqM0CXGwB4bP11i3LhOvzPGygYtiUBiwQV/4wFO0majijGsafHyRLu0yG6q35cL1rOpVxr2s5cM2jJYMCdc10Aj6q/blRpWJ//+dmm5psMl0KA2+AFRx9jMe2WbC4jQxnikd4DU8TwUjRVacgdlhmr3bpddzuJ9zXqr2xnxJfzP29RexdtjDVZqzkqa6PyvcojGrfkXiJ8SEtml/nYskicv0ivlxbqjemwUjMw5evdg8fUX9nOiC/lf94Q2i7MURk9nW1MSj5j8eAyV6y5CN2S6qbnw3vdA1Iwq+XOSCl663udN3IzLnrt+us25cI1+Z83SXQUldqQq0b5XOT17bGpLd6ssN1VMPf8c+jG8L3NeCnMdF+Ra3fRa9dft39/LuZ/3vwHoHrqGmQFafmiQw6eyzMxS05K4bL9uA+SKUQzCnSDkqOGokXyJvbgJ/BHI+qvY69//4rl20NsmK2ou2dTsyIALv/91/8n3P2Aao71WFGi8KKv1fRC5+J67Q/507/E/SOshqN5TsmYIjVt+kcjAx98iz/4SaojbIV1rexE7/C29HcYD/DX4a0rBOF5VTu7omsb11L/AWcVlcVZHSsqGuXLLp9ha8I//w3Mv+T4Ew7nTBsmgapoCrNFObIcN4pf/Ob/mrvHTGqqgAupL8qWjWPS9m/31jAe4DjA+4+uCoQoT/zOzlrNd3qd4SdphFxsUvYwGWbTWtISc3wNOWH+kHBMfc6kpmpwPgHWwqaSUG2ZWWheYOGQGaHB+eQ/kn6b3pOgLV+ODSn94wDvr8Bvb70/LLuiPPEr8OGVWfDmr45PZyccEmsVXZGe1pRNX9SU5+AVQkNTIVPCHF/jGmyDC9j4R9LfWcQvfiETmgMMUCMN1uNCakkweZsowdYobiMSlnKA93u7NzTXlSfe+SVbfnPQXmg9LpYAQxpwEtONyEyaueWM4FPjjyjG3uOaFmBTWDNgBXGEiQpsaWhnAqIijB07Dlsy3fUGeP989xbWkyf+FF2SNEtT1E0f4DYYVlxFlbaSMPIRMk/3iMU5pME2SIWJvjckciebkQuIRRyhUvkHg/iUljG5kzVog5hV7vIlCuBrmlhvgPfNHQM8lCf+FEGsYbMIBC0qC9a0uuy2wLXVbLBaP5kjHokCRxapkQyzI4QEcwgYHRZBp+XEFTqXFuNVzMtjXLJgX4gAid24Hjwc4N3dtVSe+NNiwTrzH4WVUOlDobUqr1FuAgYllc8pmzoVrELRHSIW8ViPxNy4xwjBpyR55I6J220qQTZYR4guvUICJiSpr9gFFle4RcF/OMB7BRiX8sSfhpNSO3lvEZCQfLUVTKT78Ek1LRLhWN+yLyTnp8qWUZ46b6vxdRGXfHVqx3eI75YaLa4iNNiK4NOW7wPW6lhbSOF9/M9qw8e/aoB3d156qTzxp8pXx5BKAsYSTOIIiPkp68GmTq7sZtvyzBQaRLNxIZ+paozHWoLFeExIhRBrWitHCAHrCF7/thhD8JhYz84wg93QRV88wLuLY8zF8sQ36qF1J455bOlgnELfshKVxYOXKVuKx0jaj22sczTQqPqtV/XDgpswmGTWWMSDw3ssyUunLLrVPGjYRsH5ggHeHSWiV8kT33ycFSfMgkoOK8apCye0J6VW6GOYvffgU9RWsukEi2kUV2nl4dOYUzRik9p7bcA4ggdJ53LxKcEe17B1R8eqAd7dOepV8sTXf5lhejoL85hUdhDdknPtKHFhljOT+bdq0hxbm35p2nc8+Ja1Iw+tJykgp0EWuAAZYwMVwac5KzYMslhvgHdHRrxKnvhTYcfKsxTxtTETkjHO7rr3zjoV25lAQHrqpV7bTiy2aXMmUhTBnKS91jhtR3GEoF0oLnWhWNnYgtcc4N0FxlcgT7yz3TgNIKkscx9jtV1ZKpWW+Ub1tc1eOv5ucdgpx+FJy9pgbLE7xDyXb/f+hLHVGeitHOi6A7ybo3sF8sS7w7cgdk0nJaOn3hLj3uyD0Zp5pazFIUXUpuTTU18d1EPkDoX8SkmWTnVIozEdbTcZjoqxhNHf1JrSS/AcvHjZ/SMHhL/7i5z+POsTUh/8BvNfYMTA8n+yU/MlTZxSJDRStqvEuLQKWwDctMTQogUDyQRoTQG5Kc6oQRE1yV1jCA7ri7jdZyK0sYTRjCR0Hnnd+y7nHxNgTULqw+8wj0mQKxpYvhjm9uSUxg+TTy7s2GtLUGcywhXSKZN275GsqlclX90J6bRI1aouxmgL7Q0Nen5ziM80SqMIo8cSOo+8XplT/5DHNWsSUr/6lLN/QQ3rDyzLruEW5enpf7KqZoShEduuSFOV7DLX7Ye+GmXb6/hnNNqKsVXuMDFpb9Y9eH3C6NGEzuOuI3gpMH/I6e+zDiH1fXi15t3vA1czsLws0TGEtmPEJdiiFPwlwKbgLHAFk4P6ZyPdymYYHGE0dutsChQBl2JcBFlrEkY/N5bQeXQ18gjunuMfMfsBlxJSx3niO485fwO4fGD5T/+3fPQqkneWVdwnw/3bMPkW9Wbqg+iC765Zk+xcT98ibKZc2EdgHcLoF8cSOo/Oc8fS+OyEULF4g4sJqXVcmfMfsc7A8v1/yfGXmL9I6Fn5pRwZhsPv0TxFNlAfZCvG+Oohi82UC5f/2IsJo0cTOm9YrDoKhFPEUr/LBYTUNht9zelHXDqwfPCIw4owp3mOcIQcLttWXFe3VZ/j5H3cIc0G6oPbCR+6Y2xF2EC5cGUm6wKC5tGEzhsWqw5hNidUiKX5gFWE1GXh4/Qplw4sVzOmx9QxU78g3EF6wnZlEN4FzJ1QPSLEZz1KfXC7vd8ssGdIbNUYpVx4UapyFUHzJoTOo1McSkeNn1M5MDQfs4qQuhhX5vQZFw8suwWTcyYTgioISk2YdmkhehG4PkE7w51inyAGGaU+uCXADabGzJR1fn3lwkty0asIo8cROm9Vy1g0yDxxtPvHDAmpu+PKnM8Ix1wwsGw91YJqhteaWgjYBmmQiebmSpwKKzE19hx7jkzSWOm66oPbzZ8Yj6kxVSpYjVAuvLzYMCRo3oTQecOOjjgi3NQ4l9K5/hOGhNTdcWVOTrlgYNkEXINbpCkBRyqhp+LdRB3g0OU6rMfW2HPCFFMV9nSp+uB2woepdbLBuJQyaw/ZFysXrlXwHxI0b0LovEkiOpXGA1Ijagf+KUNC6rKNa9bQnLFqYNkEnMc1uJrg2u64ELPBHpkgWbmwKpJoDhMwNbbGzAp7Yg31wS2T5rGtzit59PrKhesWG550CZpHEzpv2NGRaxlNjbMqpmEIzygJqQfjypycs2pg2cS2RY9r8HUqkqdEgKTWtWTKoRvOBPDYBltja2SO0RGjy9UHtxwRjA11ujbKF+ti5cIR9eCnxUg6owidtyoU5tK4NLji5Q3HCtiyF2IqLGYsHViOXTXOYxucDqG0HyttqYAKqYo3KTY1ekyDXRAm2AWh9JmsVh/ccg9WJ2E8YjG201sPq5ULxxX8n3XLXuMInbft2mk80rRGjCGctJ8/GFdmEQ9Ug4FlE1ll1Y7jtiraqm5Fe04VV8lvSVBL8hiPrfFVd8+7QH3Qbu2ipTVi8cvSGivc9cj8yvH11YMHdNSERtuOslM97feYFOPKzGcsI4zW0YGAbTAOaxCnxdfiYUmVWslxiIblCeAYr9VYR1gM7GmoPrilunSxxeT3DN/2eBQ9H11+nk1adn6VK71+5+Jfct4/el10/7KBZfNryUunWSCPxPECk1rdOv1WVSrQmpC+Tl46YD3ikQYcpunSQgzVB2VHFhxHVGKDgMEY5GLlQnP7FMDzw7IacAWnO6sBr12u+XanW2AO0wQ8pknnFhsL7KYIqhkEPmEXFkwaN5KQphbkUmG72wgw7WSm9RiL9QT925hkjiVIIhphFS9HKI6/8QAjlpXqg9W2C0apyaVDwKQwrwLY3j6ADR13ZyUNByQXHQu6RY09Hu6zMqXRaNZGS/KEJs0cJEe9VH1QdvBSJv9h09eiRmy0V2uJcqHcShcdvbSNg5fxkenkVprXM9rDVnX24/y9MVtncvbKY706anNl3ASll9a43UiacVquXGhvq4s2FP62NGKfQLIQYu9q1WmdMfmUrDGt8eDS0cXozH/fjmUH6Jruvm50hBDSaEU/2Ru2LEN/dl006TSc/g7tfJERxGMsgDUEr104pfWH9lQaN+M4KWQjwZbVc2rZVNHsyHal23wZtIs2JJqtIc/WLXXRFCpJkfE9jvWlfFbsNQ9pP5ZBS0zKh4R0aMFj1IjTcTnvi0Zz2rt7NdvQb2mgbju1plsH8MmbnEk7KbK0b+wC2iy3aX3szW8xeZvDwET6hWZYwqTXSSG+wMETKum0Dq/q+x62gt2ua2ppAo309TRk9TPazfV3qL9H8z7uhGqGqxNVg/FKx0HBl9OVUORn8Q8Jx9gFttGQUDr3tzcXX9xGgN0EpzN9mdZ3GATtPhL+CjxFDmkeEU6x56kqZRusLzALXVqkCN7zMEcqwjmywDQ6OhyUe0Xao1Qpyncrg6wKp9XfWDsaZplElvQ/b3sdweeghorwBDlHzgk1JmMc/wiERICVy2VJFdMjFuLQSp3S0W3+sngt2njwNgLssFGVQdJ0tu0KH4ky1LW4yrbkuaA6Iy9oz/qEMMXMMDWyIHhsAyFZc2peV9hc7kiKvfULxCl9iddfRK1f8kk9qvbdOoBtOg7ZkOZ5MsGrSHsokgLXUp9y88smniwWyuFSIRVmjplga3yD8Uij5QS1ZiM4U3Qw5QlSm2bXjFe6jzzBFtpg+/YBbLAWG7OPynNjlCw65fukGNdkJRf7yM1fOxVzbxOJVocFoYIaGwH22mIQkrvu1E2nGuebxIgW9U9TSiukPGU+Lt++c3DJPKhyhEEbXCQLUpae2exiKy6tMPe9mDRBFCEMTWrtwxN8qvuGnt6MoihKWS5NSyBhbH8StXoAz8PLOrRgLtOT/+4vcu+7vDLnqNvztOq7fmd8sMmY9Xzn1zj8Dq8+XVdu2Nv0IIySgEdQo3xVHps3Q5i3fLFsV4aiqzAiBhbgMDEd1uh8qZZ+lwhjkgokkOIv4xNJmyncdfUUzgB4oFMBtiu71Xumpz/P+cfUP+SlwFExwWW62r7b+LSPxqxn/gvMZ5z9C16t15UbNlq+jbGJtco7p8wbYlL4alSyfWdeuu0j7JA3JFNuVAwtst7F7FhWBbPFNKIUORndWtLraFLmMu7KFVDDOzqkeaiN33YAW/r76wR4XDN/yN1z7hejPau06EddkS/6XThfcz1fI/4K736fO48vlxt2PXJYFaeUkFS8U15XE3428xdtn2kc8GQlf1vkIaNRRnOMvLTWrZbElEHeLWi1o0dlKPAh1MVgbbVquPJ5+Cr8LU5/H/+I2QlHIU2ClXM9G8v7Rr7oc/hozfUUgsPnb3D+I+7WF8kNO92GY0SNvuxiE+2Bt8prVJTkzE64sfOstxuwfxUUoyk8VjcTlsqe2qITSFoSj6Epd4KsT6BZOWmtgE3hBfir8IzZDwgV4ZTZvD8VvPHERo8v+vL1DASHTz/i9OlKueHDjK5Rnx/JB1Vb1ioXdBra16dmt7dgik10yA/FwJSVY6XjA3oy4SqM2frqDPPSRMex9qs3XQtoWxMj7/Er8GWYsXgjaVz4OYumP2+9kbxvny/6kvWsEBw+fcb5bInc8APdhpOSs01tEqIkoiZjbAqKMruLbJYddHuHFRIyJcbdEdbl2sVLaySygunutBg96Y2/JjKRCdyHV+AEFtTvIpbKIXOamknYSiB6KV/0JetZITgcjjk5ZdaskBtWO86UF0ap6ozGXJk2WNiRUlCPFir66lzdm/SLSuK7EUdPz8f1z29Skq6F1fXg8+5UVR6bszncP4Tn4KUkkdJ8UFCY1zR1i8RmL/qQL3rlei4THG7OODlnKko4oI01kd3CaM08Ia18kC3GNoVaO9iDh+hWxSyTXFABXoau7Q6q9OxYg/OVEMw6jdbtSrJ9cBcewGmaZmg+bvkUnUUaGr+ZfnMH45Ivevl61hMcXsxYLFTu1hTm2zViCp7u0o5l+2PSUh9bDj6FgYypufBDhqK2+oXkiuHFHR3zfj+9PtA8oR0xnqX8qn+sx3bFODSbbF0X8EUvWQ8jBIcjo5bRmLOljDNtcqNtOe756h3l0VhKa9hDd2l1eqmsnh0MNMT/Cqnx6BInumhLT8luljzQ53RiJeA/0dxe5NK0o2fA1+GLXr6eNQWHNUOJssQaTRlGpLHKL9fD+IrQzTOMZS9fNQD4AnRNVxvTdjC+fJdcDDWQcyB00B0t9BDwTxXgaAfzDZ/DBXzRnfWMFRwuNqocOmX6OKNkY63h5n/fFcB28McVHqnXZVI27K0i4rDLNE9lDKV/rT+udVbD8dFFu2GGZ8mOt0kAXcoX3ZkIWVtw+MNf5NjR2FbivROHmhV1/pj2egv/fMGIOWTIWrV3Av8N9imV9IWml36H6cUjqEWNv9aNc+veb2sH46PRaHSuMBxvtW+twxctq0z+QsHhux8Q7rCY4Ct8lqsx7c6Sy0dl5T89rIeEuZKoVctIk1hNpfavER6yyH1Vvm3MbsUHy4ab4hWr/OZPcsRBphnaV65/ZcdYPNNwsjN/djlf9NqCw9U5ExCPcdhKxUgLSmfROpLp4WSUr8ojdwbncbvCf+a/YzRaEc6QOvXcGO256TXc5Lab9POvB+AWY7PigWYjzhifbovuunzRawsO24ZqQQAqguBtmpmPB7ysXJfyDDaV/aPGillgz1MdQg4u5MYaEtBNNHFjkRlSpd65lp4hd2AVPTfbV7FGpyIOfmNc/XVsPfg7vzaS/3nkvLL593ANLvMuRMGpQIhiF7kUEW9QDpAUbTWYBcbp4WpacHHY1aacqQyjGZS9HI3yCBT9kUZJhVOD+zUDvEH9ddR11fzPcTDQ5TlgB0KwqdXSavk9BC0pKp0WmcuowSw07VXmXC5guzSa4p0UvRw2lbDiYUx0ExJJRzWzi6Gm8cnEkfXXsdcG/M/jAJa0+bmCgdmQ9CYlNlSYZOKixmRsgiFxkrmW4l3KdFKv1DM8tk6WxPYJZhUUzcd8Kdtgrw/gkfXXDT7+avmfVak32qhtkg6NVdUS5wgkru1YzIkSduTW1FDwVWV3JQVJVuieTc0y4iDpFwc7/BvSalvKdQM8sv662cevz/+8sQVnjVAT0W2wLllw1JiMhJRxgDjCjLQsOzSFSgZqx7lAW1JW0e03yAD3asC+GD3NbQhbe+mN5GXH1F83KDOM4n/e5JIuH4NpdQARrFPBVptUNcjj4cVMcFSRTE2NpR1LEYbYMmfWpXgP9KejaPsLUhuvLCsVXznAG9dfx9SR1ud/3hZdCLHb1GMdPqRJgqDmm76mHbvOXDtiO2QPUcKo/TWkQ0i2JFXpBoo7vij1i1Lp3ADAo+qvG3V0rM//vFnnTE4hxd5Ka/Cor5YEdsLVJyKtDgVoHgtW11pWSjolPNMnrlrVj9Fv2Qn60twMwKPqr+N/wvr8z5tZcDsDrv06tkqyzESM85Ycv6XBWA2birlNCXrI6VbD2lx2L0vQO0QVTVVLH4SE67fgsfVXv8n7sz7/85Z7cMtbE6f088wSaR4kCkCm10s6pKbJhfqiUNGLq+0gLWC6eUAZFPnLjwqtKd8EwGvWX59t7iPW4X/eAN1svgRVSY990YZg06BD1ohLMtyFTI4pKTJsS9xREq9EOaPWiO2gpms7397x6nQJkbh+Fz2q/rqRROX6/M8bJrqlVW4l6JEptKeUFuMYUbtCQ7CIttpGc6MY93x1r1vgAnRXvY5cvwWPqb9uWQm+lP95QxdNMeWhOq1x0Db55C7GcUv2ZUuN6n8iKzsvOxibC//Yfs9Na8r2Rlz02vXXDT57FP/zJi66/EJSmsJKa8QxnoqW3VLQ+jZVUtJwJ8PNX1NQCwfNgdhhHD9on7PdRdrdGPF28rJr1F+3LBdeyv+8yYfLoMYet1vX4upNAjVvwOUWnlNXJXlkzk5Il6kqeoiL0C07qno+/CYBXq/+utlnsz7/Mzvy0tmI4zm4ag23PRN3t/CWryoUVJGm+5+K8RJ0V8Hc88/XHUX/HfiAq7t+BH+x6v8t438enWmdJwFA6ZINriLGKv/95f8lT9/FnyA1NMVEvQyaXuu+gz36f/DD73E4pwqpLcvm/o0Vle78n//+L/NPvoefp1pTJye6e4A/D082FERa5/opeH9zpvh13cNm19/4v/LDe5xMWTi8I0Ta0qKlK27AS/v3/r+/x/2GO9K2c7kVMonDpq7//jc5PKCxeNPpFVzaRr01wF8C4Pu76hXuX18H4LduTr79guuFD3n5BHfI+ZRFhY8w29TYhbbLi/bvBdqKE4fUgg1pBKnV3FEaCWOWyA+m3WpORZr/j+9TKJtW8yBTF2/ZEODI9/QavHkVdGFp/Pjn4Q+u5hXapsP5sOH+OXXA1LiKuqJxiMNbhTkbdJTCy4llEt6NnqRT4dhg1V3nbdrm6dYMecA1yTOL4PWTE9L5VzPFlLBCvlG58AhehnN4uHsAYinyJ+AZ/NkVvELbfOBUuOO5syBIEtiqHU1k9XeISX5bsimrkUUhnGDxourN8SgUsCZVtKyGbyGzHXdjOhsAvOAswSRyIBddRdEZWP6GZhNK/yjwew9ehBo+3jEADu7Ay2n8mDc+TS7awUHg0OMzR0LABhqLD4hJEh/BEGyBdGlSJoXYXtr+3HS4ijzVpgi0paWXtdruGTknXBz+11qT1Q2inxaTzQCO46P3lfLpyS4fou2PH/PupwZgCxNhGlj4IvUuWEsTkqMWm6i4xCSMc9N1RDQoCVcuGItJ/MRWefais+3synowi/dESgJjkilnWnBTGvRWmaw8oR15257t7CHmCf8HOn7cwI8+NQBXMBEmAa8PMRemrNCEhLGEhDQKcGZWS319BX9PFBEwGTbRBhLbDcaV3drFcDqk5kCTd2JF1Wp0HraqBx8U0wwBTnbpCadwBA/gTH/CDrcCs93LV8E0YlmmcyQRQnjBa8JESmGUfIjK/7fkaDJpmD2QptFNVJU1bbtIAjjWQizepOKptRjbzR9Kag6xZmMLLjHOtcLT3Tx9o/0EcTT1XN3E45u24AiwEypDJXihKjQxjLprEwcmRKclaDNZCVqr/V8mYWyFADbusiY5hvgFoU2vio49RgJLn5OsReRFN6tabeetiiy0V7KFHT3HyZLx491u95sn4K1QQSPKM9hNT0wMVvAWbzDSVdrKw4zRjZMyJIHkfq1VAVCDl/bUhNKlGq0zGr05+YAceXVPCttVk0oqjVwMPt+BBefx4yPtGVkUsqY3CHDPiCM5ngupUwCdbkpd8kbPrCWHhkmtIKLEetF2499eS1jZlIPGYnlcPXeM2KD9vLS0bW3ktYNqUllpKLn5ZrsxlIzxvDu5eHxzGLctkZLEY4PgSOg2IUVVcUONzUDBEpRaMoXNmUc0tFZrTZquiLyKxrSm3DvIW9Fil+AkhXu5PhEPx9mUNwqypDvZWdKlhIJQY7vn2OsnmBeOWnYZ0m1iwbbw1U60by5om47iHRV6fOgzjMf/DAZrlP40Z7syxpLK0lJ0gqaAK1c2KQKu7tabTXkLFz0sCftuwX++MyNeNn68k5Buq23YQhUh0SNTJa1ioQ0p4nUG2y0XilF1JqODqdImloPS4Bp111DEWT0jJjVv95uX9BBV7eB3bUWcu0acSVM23YZdd8R8UbQUxJ9wdu3oMuhdt929ME+mh6JXJ8di2RxbTi6TbrDquqV4aUKR2iwT6aZbyOwEXN3DUsWr8Hn4EhwNyHuXHh7/pdaUjtR7vnDh/d8c9xD/s5f501eQ1+CuDiCvGhk1AN/4Tf74RfxPwD3toLarR0zNtsnPzmS64KIRk861dMWCU8ArasG9T9H0ZBpsDGnjtAOM2+/LuIb2iIUGXNgl5ZmKD/Tw8TlaAuihaFP5yrw18v4x1898zIdP+DDAX1bM3GAMvPgRP/cJn3zCW013nrhHkrITyvYuwOUkcHuKlRSW5C6rzIdY4ppnF7J8aAJbQepgbJYBjCY9usGXDKQxq7RZfh9eg5d1UHMVATRaD/4BHK93/1iAgYZ/+jqPn8Dn4UExmWrpa3+ZOK6MvM3bjwfzxNWA2dhs8+51XHSPJiaAhGSpWevEs5xHLXcEGFXYiCONySH3fPWq93JIsBiSWvWyc3CAN+EcXoT7rCSANloPPoa31rt/5PUA/gp8Q/jDD3hyrjzlR8VkanfOvB1XPubt17vzxAfdSVbD1pzAnfgyF3ycadOTOTXhpEUoLC1HZyNGW3dtmjeXgr2r56JNmRwdNNWaQVBddd6rh4MhviEB9EFRD/7RGvePvCbwAL4Mx/D6M541hHO4D3e7g6PafdcZVw689z7NGTwo5om7A8sPhccT6qKcl9NJl9aM/9kX+e59Hh1yPqGuCCZxuITcsmNaJ5F7d0q6J3H48TO1/+M57085q2icdu2U+W36Ldllz9Agiv4YGljoEN908EzvDOrBF98/vtJwCC/BF2AG75xxEmjmMIcjxbjoaxqOK3/4hPOZzhMPBpYPG44CM0dTVm1LjLtUWWVz1Bcf8tEx0zs8O2A2YVHRxKYOiy/aOVoAaMu0i7ubu43njjmd4ibMHU1sIDHaQNKrZND/FZYdk54oCXetjq7E7IVl9eAL7t+oHnwXXtLx44czzoRFHBztYVwtH1d+NOMkupZ5MTM+gUmq90X+Bh9zjRlmaQ+m7YMqUL/veemcecAtOJ0yq1JnVlN27di2E0+Klp1tAJ4KRw1eMI7aJjsO3R8kPSI3fUFXnIOfdQe86sIIVtWDL7h//Ok6vj8vwDk08NEcI8zz7OhBy+WwalzZeZ4+0XniRfst9pAJqQHDGLzVQ2pheZnnv1OWhwO43/AgcvAEXEVVpa4db9sGvNK8wjaENHkfFQ4Ci5i7dqnQlPoLQrHXZDvO3BIXZbJOBrOaEbML6sFL798I4FhKihjHMsPjBUZYCMFr6nvaArxqXPn4lCa+cHfSa2cP27g3Z3ziYTRrcbQNGLQmGF3F3cBdzzzX7AILx0IB9rbwn9kx2G1FW3Inic+ZLIsVvKR8Zwfj0l1fkqo8LWY1M3IX14OX3r9RKTIO+d9XzAI8qRPGPn/4NC2n6o4rN8XJ82TOIvuVA8zLKUHRFgBCetlDZlqR1gLKjS39xoE7Bt8UvA6BxuEDjU3tFsEijgA+615tmZkXKqiEENrh41iLDDZNq4pKTWR3LZfnos81LOuNa15cD956vLMsJd1rqYp51gDUQqMYm2XsxnUhD2jg1DM7SeuJxxgrmpfISSXVIJIS5qJJSvJPEQ49DQTVIbYWJ9QWa/E2+c/oPK1drmC7WSfJRNKBO5Yjvcp7Gc3dmmI/Xh1kDTEuiSnWqQf37h+fTMhGnDf6dsS8SQfQWlqqwXXGlc/PEZ/SC5mtzIV0nAshlQdM/LvUtYutrEZ/Y+EAFtq1k28zQhOwLr1AIeANzhF8t9qzTdZf2qRKO6MWE9ohBYwibbOmrFtNmg3mcS+tB28xv2uKd/agYCvOP+GkSc+0lr7RXzyufL7QbkUpjLjEWFLqOIkAGu2B0tNlO9Eau2W1qcOUvVRgKzypKIQZ5KI3q0MLzqTNRYqiZOqmtqloIRlmkBHVpHmRYV6/HixbO6UC47KOFJnoMrVyr7wYz+SlW6GUaghYbY1I6kkxA2W1fSJokUdSh2LQ1GAimRGm0MT+uu57H5l7QgOWxERpO9moLRPgTtquWCfFlGlIjQaRly9odmzMOWY+IBO5tB4sW/0+VWGUh32qYk79EidWKrjWuiLpiVNGFWFRJVktyeXWmbgBBzVl8anPuXyNJlBJOlKLTgAbi/EYHVHxWiDaVR06GnHQNpJcWcK2jJtiCfG2sEHLzuI66sGrMK47nPIInPnu799935aOK2cvmvubrE38ZzZjrELCmXM2hM7UcpXD2oC3+ECVp7xtIuxptJ0jUr3sBmBS47TVxlvJ1Sqb/E0uLdvLj0lLr29ypdd/eMX3f6lrxGlKwKQxEGvw0qHbkbwrF3uHKwVENbIV2wZ13kNEF6zD+x24aLNMfDTCbDPnEikZFyTNttxWBXDaBuM8KtI2rmaMdUY7cXcUPstqTGvBGSrFWIpNMfbdea990bvAOC1YX0qbc6smDS1mPxSJoW4fwEXvjMmhlijDRq6qale6aJEuFGoppYDoBELQzLBuh/mZNx7jkinv0EtnUp50lO9hbNK57lZaMAWuWR5Yo9/kYwcYI0t4gWM47Umnl3YmpeBPqSyNp3K7s2DSAS/39KRuEN2bS4xvowV3dFRMx/VFcp2Yp8w2nTO9hCXtHG1kF1L4KlrJr2wKfyq77R7MKpFKzWlY9UkhYxyHWW6nBWPaudvEAl3CGcNpSXPZ6R9BbBtIl6cHL3gIBi+42CYXqCx1gfGWe7Ap0h3luyXdt1MKy4YUT9xSF01G16YEdWsouW9mgDHd3veyA97H+Ya47ZmEbqMY72oPztCGvK0onL44AvgC49saZKkWRz4veWljE1FHjbRJaWv6ZKKtl875h4CziFCZhG5rx7tefsl0aRT1bMHZjm8dwL/6u7wCRysaQblQoG5yAQN5zpatMNY/+yf8z+GLcH/Qn0iX2W2oEfXP4GvwQHuIL9AYGnaO3zqAX6946nkgqZNnUhx43DIdQtMFeOPrgy/y3Yd85HlJWwjLFkU3kFwq28xPnuPhMWeS+tDLV9Otllq7pQCf3uXJDN9wFDiUTgefHaiYbdfi3b3u8+iY6TnzhgehI1LTe8lcd7s1wJSzKbahCRxKKztTLXstGAiu3a6rPuQs5pk9TWAan5f0BZmGf7Ylxzzk/A7PAs4QPPPAHeFQ2hbFHszlgZuKZsJcUmbDC40sEU403cEjczstOEypa+YxevL4QBC8oRYqWdK6b7sK25tfE+oDZgtOQ2Jg8T41HGcBE6fTWHn4JtHcu9S7uYgU5KSCkl/mcnq+5/YBXOEr6lCUCwOTOM1taOI8mSxx1NsCXBEmLKbMAg5MkwbLmpBaFOPrNSlO2HnLiEqW3tHEwd8AeiQLmn+2gxjC3k6AxREqvKcJbTEzlpLiw4rNZK6oJdidbMMGX9FULKr0AkW+2qDEPBNNm5QAt2Ik2nftNWHetubosHLo2nG4vQA7GkcVCgVCgaDixHqo9UUn1A6OshapaNR/LPRYFV8siT1cCtJE0k/3WtaNSuUZYKPnsVIW0xXWnMUxq5+En4Kvw/MqQmVXnAXj9Z+9zM98zM/Agy7F/qqj2Nh67b8HjFnPP3iBn/tkpdzwEJX/whIcQUXOaikeliCRGUk7tiwF0rItwMEhjkZ309hikFoRAmLTpEXWuHS6y+am/KB/fM50aLEhGnSMwkpxzOov4H0AvgovwJ1iGzDLtJn/9BU+fAINfwUe6FHSLhu83viV/+/HrOePX+STT2B9uWGbrMHHLldRBlhS/CJQmcRxJFqZica01XixAZsYiH1uolZxLrR/SgxVIJjkpQP4PE9sE59LKLr7kltSBogS5tyszzH8Fvw8/AS8rNOg0xUS9fIaHwb+6et8Q/gyvKRjf5OusOzGx8evA/BP4IP11uN/grca5O0lcsPLJ5YjwI4QkJBOHa0WdMZYGxPbh2W2nR9v3WxEWqgp/G3+6VZbRLSAAZ3BhdhAaUL33VUSw9yjEsvbaQ9u4A/gGXwZXoEHOuU1GSj2chf+Mo+f8IcfcAxfIKVmyunRbYQVnoevwgfw3TXXcw++xNuP4fhyueEUNttEduRVaDttddoP0eSxLe2LENk6itYxlrxBNBYrNNKSQmeaLcm9c8UsaB5WyO6675yyQIAWSDpBVoA/gxmcwEvwoDv0m58UE7gHn+fJOa8/Ywan8EKRfjsopF83eCglX/Sfr7OeaRoQfvt1CGvIDccH5BCvw1sWIzRGC/66t0VTcLZQZtm6PlAasbOJ9iwWtUo7biktTSIPxnR24jxP1ZKaqq+2RcXM9OrBAm/AAs7hDJ5bNmGb+KIfwCs8a3jnjBrOFeMjHSCdbKr+2uOLfnOd9eiA8Hvvwwq54VbP2OqwkB48Ytc4YEOiH2vTXqodabfWEOzso4qxdbqD5L6tbtNPECqbhnA708DZH4QOJUXqScmUlks7Ot6FBuZw3n2mEbaUX7kDzxHOOQk8nKWMzAzu6ZZ8sOFw4RK+6PcuXo9tB4SbMz58ApfKDXf3szjNIIbGpD5TKTRxGkEMLjLl+K3wlWXBsCUxIDU+jbOiysESqAy1MGUJpXgwbTWzNOVEziIXZrJ+VIztl1PUBxTSo0dwn2bOmfDRPD3TRTGlfbCJvO9KvuhL1hMHhB9wPuPRLGHcdOWG2xc0U+5bQtAJT0nRTewXL1pgk2+rZAdeWmz3jxAqfNQQdzTlbF8uJ5ecEIWvTkevAHpwz7w78QujlD/Lr491bD8/1vhM2yrUQRrWXNQY4fGilfctMWYjL72UL/qS9eiA8EmN88nbNdour+PBbbAjOjIa4iBhfFg6rxeKdEGcL6p3EWR1Qq2Qkhs2DrnkRnmN9tG2EAqmgPw6hoL7Oza7B+3SCrR9tRftko+Lsf2F/mkTndN2LmzuMcKTuj/mX2+4Va3ki16+nnJY+S7MefpkidxwnV+4wkXH8TKnX0tsYzYp29DOOoSW1nf7nTh2akYiWmcJOuTidSaqESrTYpwjJJNVGQr+rLI7WsqerHW6Kp/oM2pKuV7T1QY9gjqlZp41/WfKpl56FV/0kvXQFRyeQ83xaTu5E8p5dNP3dUF34ihyI3GSpeCsywSh22ZJdWto9winhqifb7VRvgktxp13vyjrS0EjvrRfZ62uyqddSWaWYlwTPAtJZ2oZ3j/Sgi/mi+6vpzesfAcWNA0n8xVyw90GVFGuZjTXEQy+6GfLGLMLL523f5E0OmxVjDoOuRiH91RKU+vtoCtH7TgmvBLvtFXWLW15H9GTdVw8ow4IlRLeHECN9ym1e9K0I+Cbnhgv4Yu+aD2HaQJ80XDqOzSGAV4+4yCqBxrsJAX6ZTIoX36QnvzhhzzMfFW2dZVLOJfo0zbce5OvwXMFaZ81mOnlTVXpDZsQNuoYWveketKb5+6JOOsgX+NTm7H49fUTlx+WLuWL7qxnOFh4BxpmJx0p2gDzA/BUARuS6phR+pUsY7MMboAHx5xNsSVfVZcYSwqCKrqon7zM+8ecCkeS4nm3rINuaWvVNnMRI1IRpxTqx8PZUZ0Br/UEduo3B3hNvmgZfs9gQPj8vIOxd2kndir3awvJ6BLvoUuOfFWNYB0LR1OQJoUySKb9IlOBx74q1+ADC2G6rOdmFdJcD8BkfualA+BdjOOzP9uUhGUEX/TwhZsUduwRr8wNuXKurCixLBgpQI0mDbJr9dIqUuV+92ngkJZ7xduCk2yZKbfWrH1VBiTg9VdzsgRjW3CVXCvAwDd+c1z9dWw9+B+8MJL/eY15ZQ/HqvTwVdsZn5WQsgRRnMaWaecu3jFvMBEmgg+FJFZsnSl0zjB9OqPYaBD7qmoVyImFvzi41usesV0julaAR9dfR15Xzv9sEruRDyk1nb+QaLU67T885GTls6YgcY+UiMa25M/pwGrbCfzkvR3e0jjtuaFtnwuagHTSb5y7boBH119HXhvwP487jJLsLJ4XnUkHX5sLbS61dpiAXRoZSCrFJ+EjpeU3puVfitngYNo6PJrAigKktmwjyQdZpfq30mmtulaAx9Zfx15Xzv+cyeuiBFUs9zq8Kq+XB9a4PVvph3GV4E3y8HENJrN55H1X2p8VyqSKwVusJDKzXOZzplWdzBUFK9e+B4+uv468xvI/b5xtSAkBHQaPvtqWzllVvEOxPbuiE6+j2pvjcKsbvI7txnRErgfH7LdXqjq0IokKzga14GzQ23SSbCQvO6r+Or7SMIr/efOkkqSdMnj9mBx2DRsiY29Uj6+qK9ZrssCKaptR6HKURdwUYeUWA2kPzVKQO8ku2nU3Anhs/XWkBx3F/7wJtCTTTIKftthue1ty9xvNYLY/zo5KSbIuKbXpbEdSyeRyYdAIwKY2neyoc3+k1XUaufYga3T9daMUx/r8z1s10ITknIO0kuoMt+TB8jK0lpayqqjsJ2qtXAYwBU932zinimgmd6mTRDnQfr88q36NAI+tv24E8Pr8zxtasBqx0+xHH9HhlrwsxxNUfKOHQaZBITNf0uccj8GXiVmXAuPEAKSdN/4GLHhs/XWj92dN/uetNuBMnVR+XWDc25JLjo5Mg5IZIq226tmCsip2zZliL213YrTlL2hcFjpCduyim3M7/eB16q/blQsv5X/esDRbtJeabLIosWy3ycavwLhtxdWzbMmHiBTiVjJo6lCLjXZsi7p9PEPnsq6X6wd4bP11i0rD5fzPm/0A6brrIsllenZs0lCJlU4abakR59enZKrKe3BZihbTxlyZ2zl1+g0wvgmA166/bhwDrcn/7Ddz0eWZuJvfSESug6NzZsox3Z04FIxz0mUjMwVOOVTq1CQ0AhdbBGVdjG/CgsfUX7esJl3K/7ytWHRv683praW/8iDOCqWLLhpljDY1ZpzK75QiaZoOTpLKl60auHS/97oBXrv+umU9+FL+5+NtLFgjqVLCdbmj7pY5zPCPLOHNCwXGOcLquOhi8CmCWvbcuO73XmMUPab+ug3A6/A/78Bwe0bcS2+tgHn4J5pyS2WbOck0F51Vq3LcjhLvZ67p1ABbaL2H67bg78BfjKi/jr3+T/ABV3ilLmNXTI2SpvxWBtt6/Z//D0z/FXaGbSBgylzlsEGp+5//xrd4/ae4d8DUUjlslfIYS3t06HZpvfQtvv0N7AHWqtjP2pW08QD/FLy//da38vo8PNlKHf5y37Dxdfe/oj4kVIgFq3koLReSR76W/bx//n9k8jonZxzWTANVwEniDsg87sOSd/z7//PvMp3jQiptGVWFX2caezzAXwfgtzYUvbr0iozs32c3Uge7varH+CNE6cvEYmzbPZ9hMaYDdjK4V2iecf6EcEbdUDVUARda2KzO/JtCuDbNQB/iTeL0EG1JSO1jbXS+nLxtPMDPw1fh5+EPrgSEKE/8Gry5A73ui87AmxwdatyMEBCPNOCSKUeRZ2P6Myb5MRvgCHmA9ywsMifU+AYXcB6Xa5GibUC5TSyerxyh0j6QgLVpdyhfArRTTLqQjwe4HOD9s92D4Ap54odXAPBWLAwB02igG5Kkc+piN4lvODIFGAZgT+EO4Si1s7fjSR7vcQETUkRm9O+MXyo9OYhfe4xt9STQ2pcZRLayCV90b4D3jR0DYAfyxJ+eywg2IL7NTMXna7S/RpQ63JhWEM8U41ZyQGjwsVS0QBrEKLu8xwZsbi4wLcCT+OGidPIOCe1PiSc9Qt+go+vYqB7cG+B9d8cAD+WJPz0Am2gxXgU9IneOqDpAAXOsOltVuMzpdakJXrdPCzXiNVUpCeOos5cxnpQT39G+XVLhs1osQVvJKPZyNq8HDwd4d7pNDuWJPxVX7MSzqUDU6gfadKiNlUFTzLeFHHDlzO4kpa7aiKhBPGKwOqxsBAmYkOIpipyXcQSPlRTf+Tii0U3EJGaZsDER2qoB3h2hu0qe+NNwUooYU8y5mILbJe6OuX+2FTKy7bieTDAemaQyQ0CPthljSWO+xmFDIYiESjM5xKd6Ik5lvLq5GrQ3aCMLvmCA9wowLuWJb9xF59hVVP6O0CrBi3ZjZSNOvRy+I6klNVRJYRBaEzdN+imiUXQ8iVF8fsp+W4JXw7WISW7fDh7lptWkCwZ4d7QTXyBPfJMYK7SijjFppGnlIVJBJBYj7eUwtiP1IBXGI1XCsjNpbjENVpSAJ2hq2LTywEly3hUYazt31J8w2+aiLx3g3fohXixPfOMYm6zCGs9LVo9MoW3MCJE7R5u/WsOIjrqBoHUO0bJE9vxBpbhsd3+Nb4/vtPCZ4oZYCitNeYuC/8UDvDvy0qvkiW/cgqNqRyzqSZa/s0mqNGjtKOoTm14zZpUauiQgVfqtQiZjq7Q27JNaSK5ExRcrGCXO1FJYh6jR6CFqK7bZdQZ4t8g0rSlPfP1RdBtqaa9diqtzJkQ9duSryi2brQXbxDwbRUpFMBHjRj8+Nt7GDKgvph9okW7LX47gu0SpGnnFQ1S1lYldOsC7hYteR574ZuKs7Ei1lBsfdz7IZoxzzCVmmVqaSySzQbBVAWDek+N4jh9E/4VqZrJjPwiv9BC1XcvOWgO8275CVyBPvAtTVlDJfZkaZGU7NpqBogAj/xEHkeAuJihWYCxGN6e8+9JtSegFXF1TrhhLGP1fak3pebgPz192/8gB4d/6WT7+GdYnpH7hH/DJzzFiYPn/vjW0SgNpTNuPIZoAEZv8tlGw4+RLxy+ZjnKa5NdFoC7UaW0aduoYse6+bXg1DLg6UfRYwmhGEjqPvF75U558SANrElK/+MdpXvmqBpaXOa/MTZaa1DOcSiLaw9j0NNNst3c+63c7EKTpkvKHzu6bPbP0RkuHAVcbRY8ijP46MIbQeeT1mhA+5PV/inyDdQipf8LTvMXbwvoDy7IruDNVZKTfV4CTSRUYdybUCnGU7KUTDxLgCknqUm5aAW6/1p6eMsOYsphLzsHrE0Y/P5bQedx1F/4yPHnMB3/IOoTU9+BL8PhtjuFKBpZXnYNJxTuv+2XqolKR2UQgHhS5novuxVySJhBNRF3SoKK1XZbbXjVwWNyOjlqWJjrWJIy+P5bQedyldNScP+HZ61xKSK3jyrz+NiHG1hcOLL/+P+PDF2gOkekKGiNWKgJ+8Z/x8Iv4DdQHzcpZyF4v19I27w9/yPGDFQvmEpKtqv/TLiWMfn4sofMm9eAH8Ao0zzh7h4sJqYtxZd5/D7hkYPneDzl5idlzNHcIB0jVlQ+8ULzw/nc5/ojzl2juE0apD7LRnJxe04dMz2iOCFNtGFpTuXA5AhcTRo8mdN4kz30nVjEC4YTZQy4gpC7GlTlrePKhGsKKgeXpCYeO0MAd/GH7yKQUlXPLOasOH3FnSphjHuDvEu4gB8g66oNbtr6eMbFIA4fIBJkgayoXriw2XEDQPJrQeROAlY6aeYOcMf+IVYTU3XFlZufMHinGywaW3YLpObVBAsbjF4QJMsVUSayjk4voPsHJOQfPWDhCgDnmDl6XIRerD24HsGtw86RMHOLvVSHrKBdeVE26gKB5NKHzaIwLOmrqBWJYZDLhASG16c0Tn+CdRhWDgWXnqRZUTnPIHuMJTfLVpkoYy5CzylHVTGZMTwkGAo2HBlkQplrJX6U+uF1wZz2uwS1SQ12IqWaPuO4baZaEFBdukksJmkcTOm+YJSvoqPFzxFA/YUhIvWxcmSdPWTWwbAKVp6rxTtPFUZfKIwpzm4IoMfaYQLWgmlG5FME2gdBgm+J7J+rtS/XBbaVLsR7bpPQnpMFlo2doWaVceHk9+MkyguZNCJ1He+kuHTWyQAzNM5YSUg/GlTk9ZunAsg1qELVOhUSAK0LABIJHLKbqaEbHZLL1VA3VgqoiOKXYiS+HRyaEKgsfIqX64HYWbLRXy/qWoylIV9gudL1OWBNgBgTNmxA6b4txDT4gi3Ri7xFSLxtXpmmYnzAcWDZgY8d503LFogz5sbonDgkKcxGsWsE1OI+rcQtlgBBCSOKD1mtqYpIU8cTvBmAT0yZe+zUzeY92fYjTtGipXLhuR0ePoHk0ofNWBX+lo8Z7pAZDk8mEw5L7dVyZZoE/pTewbI6SNbiAL5xeygW4xPRuLCGbhcO4RIeTMFYHEJkYyEO9HmJfXMDEj/LaH781wHHZEtqSQ/69UnGpzH7LKIAZEDSPJnTesJTUa+rwTepI9dLJEawYV+ZkRn9g+QirD8vF8Mq0jFQ29js6kCS3E1+jZIhgPNanHdHFqFvPJLHqFwQqbIA4jhDxcNsOCCQLDomaL/dr5lyJaJU6FxPFjO3JOh3kVMcROo8u+C+jo05GjMF3P3/FuDLn5x2M04xXULPwaS6hBYki+MrMdZJSgPHlcB7nCR5bJ9Kr5ACUn9jk5kivdd8tk95SOGrtqu9lr2IhK65ZtEl7ZKrp7DrqwZfRUSN1el7+7NJxZbywOC8neNKTch5vsTEMNsoCCqHBCqIPRjIPkm0BjvFODGtto99rCl+d3wmHkW0FPdpZtC7MMcVtGFQjJLX5bdQ2+x9ypdc313uj8xlsrfuLgWXz1cRhZvJYX0iNVBRcVcmCXZs6aEf3RQF2WI/TcCbKmGU3IOoDJGDdDub0+hYckt6PlGu2BcxmhbTdj/klhccLGJMcqRjMJP1jW2ETqLSWJ/29MAoORluJ+6LPffBZbi5gqi5h6catQpmOT7/OFf5UorRpLzCqcMltBLhwd1are3kztrSzXO0LUbXRQcdLh/RdSZ+swRm819REDrtqzC4es6Gw4JCKlSnjYVpo0xeq33PrADbFLL3RuCmObVmPN+24kfa+AojDuM4umKe2QwCf6EN906HwjujaitDs5o0s1y+k3lgbT2W2i7FJdnwbLXhJUBq/9liTctSmFC/0OqUinb0QddTWamtjbHRFuWJJ6NpqZ8vO3fZJ37Db+2GkaPYLGHs7XTTdiFQJ68SkVJFVmY6McR5UycflNCsccHFaV9FNbR4NttLxw4pQ7wJd066Z0ohVbzihaxHVExd/ay04oxUKWt+AsdiQ9OUyZ2krzN19IZIwafSTFgIBnMV73ADj7V/K8u1MaY2sJp2HWm0f41tqwajEvdHWOJs510MaAqN4aoSiPCXtN2KSi46dUxHdaMquar82O1x5jqhDGvqmoE9LfxcY3zqA7/x3HA67r9ZG4O6Cuxu12/+TP+eLP+I+HErqDDCDVmBDO4larujNe7x8om2rMug0MX0rL1+IWwdwfR+p1TNTyNmVJ85ljWzbWuGv8/C7HD/izjkHNZNYlhZcUOKVzKFUxsxxN/kax+8zPWPSFKw80rJr9Tizyj3o1gEsdwgWGoxPezDdZ1TSENE1dLdNvuKL+I84nxKesZgxXVA1VA1OcL49dFlpFV5yJMhzyCmNQ+a4BqusPJ2bB+xo8V9u3x48VVIEPS/mc3DvAbXyoYr6VgDfh5do5hhHOCXMqBZUPhWYbWZECwVJljLgMUWOCB4MUuMaxGNUQDVI50TQ+S3kFgIcu2qKkNSHVoM0SHsgoZxP2d5HH8B9woOk4x5bPkKtAHucZsdykjxuIpbUrSILgrT8G7G5oCW+K0990o7E3T6AdW4TilH5kDjds+H64kS0mz24grtwlzDHBJqI8YJQExotPvoC4JBq0lEjjQkyBZ8oH2LnRsQ4Hu1QsgDTJbO8fQDnllitkxuVskoiKbRF9VwzMDvxHAdwB7mD9yCplhHFEyUWHx3WtwCbSMMTCUCcEmSGlg4gTXkHpZXWQ7kpznK3EmCHiXInqndkQjunG5kxTKEeGye7jWz9cyMR2mGiFQ15ENRBTbCp+Gh86vAyASdgmJq2MC6hoADQ3GosP0QHbnMHjyBQvQqfhy/BUbeHd5WY/G/9LK/8Ka8Jd7UFeNWEZvzPb458Dn8DGLOe3/wGL/4xP+HXlRt+M1PE2iLhR8t+lfgxsuh7AfO2AOf+owWhSZRYQbd622hbpKWKuU+XuvNzP0OseRDa+mObgDHJUSc/pKx31QdKffQ5OIJpt8GWjlgTwMc/w5MPCR/yl1XC2a2Yut54SvOtMev55Of45BOat9aWG27p2ZVORRvnEk1hqWMVUmqa7S2YtvlIpspuF1pt0syuZS2NV14mUidCSfzQzg+KqvIYCMljIx2YK2AO34fX4GWdu5xcIAb8MzTw+j/lyWM+Dw/gjs4GD6ehNgA48kX/AI7XXM/XAN4WHr+9ntywqoCakCqmKP0rmQrJJEErG2Upg1JObr01lKQy4jskWalKYfJ/EDLMpjNSHFEUAde2fltaDgmrNaWQ9+AAb8I5vKjz3L1n1LriB/BXkG/wwR9y/oRX4LlioHA4LzP2inzRx/DWmutRweFjeP3tNeSGlaE1Fde0OS11yOpmbIp2u/jF1n2RRZviJM0yBT3IZl2HWImKjQOxIyeU325b/qWyU9Moj1o07tS0G7qJDoGHg5m8yeCxMoEH8GU45tnrNM84D2l297DQ9t1YP7jki/7RmutRweEA77/HWXOh3HCxkRgldDQkAjNTMl2Iloc1qN5JfJeeTlyTRzxURTdn1Ixv2uKjs12AbdEWlBtmVdk2k7FFwj07PCZ9XAwW3dG+8xKzNFr4EnwBZpy9Qzhh3jDXebBpYcpuo4fQ44u+fD1dweEnHzI7v0xuuOALRUV8rXpFyfSTQYkhd7IHm07jpyhlkCmI0ALYqPTpUxXS+z4jgDj1Pflvmz5ecuItpIBxyTHpSTGWd9g1ApfD/bvwUhL4nT1EzqgX7cxfCcNmb3mPL/qi9SwTHJ49oj5ZLjccbTG3pRmlYi6JCG0mQrAt1+i2UXTZ2dv9IlQpN5naMYtviaXlTrFpoMsl3bOAFEa8sqPj2WCMrx3Yjx99qFwO59Aw/wgx+HlqNz8oZvA3exRDvuhL1jMQHPaOJ0+XyA3fp1OfM3qObEVdhxjvynxNMXQV4+GJyvOEFqeQBaIbbO7i63rpxCltdZShPFxkjM2FPVkn3TG+Rp9pO3l2RzFegGfxGDHIAh8SteR0C4HopXzRF61nheDw6TFN05Ebvq8M3VKKpGjjO6r7nhudTEGMtYM92HTDaR1FDMXJ1eThsbKfywyoWwrzRSXkc51flG3vIid62h29bIcFbTGhfV+faaB+ohj7dPN0C2e2lC96+XouFByen9AsunLDJZ9z7NExiUc0OuoYW6UZkIyx2YUR2z6/TiRjyKMx5GbbjLHvHuf7YmtKghf34LJfx63Yg8vrvN2zC7lY0x0tvKezo4HmGYDU+Gab6dFL+KI761lDcNifcjLrrr9LWZJctG1FfU1uwhoQE22ObjdfkSzY63CbU5hzs21WeTddH2BaL11Gi7lVdlxP1nkxqhnKhVY6knS3EPgVGg1JpN5cP/hivujOelhXcPj8HC/LyI6MkteVjlolBdMmF3a3DbsuAYhL44dxzthWSN065xxUd55Lmf0wRbOYOqH09/o9WbO2VtFdaMb4qBgtFJoT1SqoN8wPXMoXLb3p1PUEhxfnnLzGzBI0Ku7FxrKsNJj/8bn/H8fPIVOd3rfrklUB/DOeO+nkghgSPzrlPxluCMtOnDL4Yml6dK1r3vsgMxgtPOrMFUZbEUbTdIzii5beq72G4PD0DKnwjmBULUVFmy8t+k7fZ3pKc0Q4UC6jpVRqS9Umv8bxw35flZVOU1X7qkjnhZlsMbk24qQ6Hz7QcuL6sDC0iHHki96Uh2UdvmgZnjIvExy2TeJdMDZNSbdZyAHe/Yd1xsQhHiKzjh7GxQ4yqMPaywPkjMamvqrYpmO7Knad+ZQC5msCuAPWUoxrxVhrGv7a+KLXFhyONdTMrZ7ke23qiO40ZJUyzgYyX5XyL0mV7NiUzEs9mjtbMN0dERqwyAJpigad0B3/zRV7s4PIfXSu6YV/MK7+OrYe/JvfGMn/PHJe2fyUdtnFrKRNpXV0Y2559aWPt/G4BlvjTMtXlVIWCnNyA3YQBDmYIodFz41PvXPSa6rq9lWZawZ4dP115HXV/M/tnFkkrBOdzg6aP4pID+MZnTJ1SuuB6iZlyiox4HT2y3YBtkUKWooacBQUDTpjwaDt5poBHl1/HXltwP887lKKXxNUEyPqpGTyA699UqY/lt9yGdlUKra0fFWS+36iylVWrAyd7Uw0CZM0z7xKTOduznLIjG2Hx8cDPLb+OvK6Bv7n1DYci4CxUuRxrjBc0bb4vD3rN5Zz36ntLb83eVJIB8LiIzCmn6SMPjlX+yNlTjvIGjs+QzHPf60Aj62/jrzG8j9vYMFtm1VoRWCJdmw7z9N0t+c8cxZpPeK4aTRicS25QhrVtUp7U578chk4q04Wx4YoQSjFryUlpcQ1AbxZ/XVMknIU//OGl7Q6z9Zpxi0+3yFhSkjUDpnCIUhLWVX23KQ+L9vKvFKI0ZWFQgkDLvBoylrHNVmaw10zwCPrr5tlodfnf94EWnQ0lFRWy8pW9LbkLsyUVDc2NSTHGDtnD1uMtchjbCeb1mpxFP0YbcClhzdLu6lfO8Bj6q+bdT2sz/+8SZCV7VIxtt0DUn9L7r4cLYWDSXnseEpOGFuty0qbOVlS7NNzs5FOGJUqQpl2Q64/yBpZf90sxbE+//PGdZ02HSipCbmD6NItmQ4Lk5XUrGpDMkhbMm2ZVheNYV+VbUWTcv99+2NyX1VoafSuC+AN6q9bFIMv5X/eagNWXZxEa9JjlMwNWb00akGUkSoepp1/yRuuqHGbUn3UdBSTxBU6SEVklzWRUkPndVvw2PrrpjvxOvzPmwHc0hpmq82npi7GRro8dXp0KXnUQmhZbRL7NEVp1uuZmO45vuzKsHrktS3GLWXODVjw+vXXLYx4Hf7njRPd0i3aoAGX6W29GnaV5YdyDj9TFkakje7GHYzDoObfddHtOSpoi2SmzJHrB3hM/XUDDEbxP2/oosszcRlehWXUvzHv4TpBVktHqwenFo8uLVmy4DKLa5d3RtLrmrM3aMFr1183E4sewf+85VWeg1c5ag276NZrM9IJVNcmLEvDNaV62aq+14IAOGFsBt973Ra8Xv11YzXwNfmft7Jg2oS+XOyoC8/cwzi66Dhmgk38kUmP1CUiYWOX1bpD2zWXt2FCp7uq8703APAa9dfNdscR/M/bZLIyouVxqJfeWvG9Je+JVckHQ9+CI9NWxz+blX/KYYvO5n2tAP/vrlZ7+8/h9y+9qeB/Hnt967e5mevX10rALDWK//FaAT5MXdBXdP0C/BAes792c40H+AiAp1e1oH8HgH94g/Lttx1gp63op1eyoM/Bvw5/G/7xFbqJPcCXnmBiwDPb/YKO4FX4OjyCb289db2/Noqicw4i7N6TVtoz8tNwDH+8x/i6Ae7lmaQVENzJFb3Di/BFeAwz+Is9SjeQySpPqbLFlNmyz47z5a/AF+AYFvDmHqibSXTEzoT4Gc3OALaqAP4KPFUJ6n+1x+rGAM6Zd78bgJ0a8QN4GU614vxwD9e1Amy6CcskNrczLx1JIp6HE5UZD/DBHrFr2oNlgG4Odv226BodoryjGJ9q2T/AR3vQrsOCS0ctXZi3ruLlhpFDJYl4HmYtjQCP9rhdn4suySLKDt6wLcC52h8xPlcjju1fn+yhuw4LZsAGUuo2b4Fx2UwQu77uqRHXGtg92aN3tQCbFexc0uk93vhTXbct6y7MulLycoUljx8ngDMBg1tvJjAazpEmOtxlzclvj1vQf1Tx7QlPDpGpqgtdSKz/d9/hdy1vTfFHSmC9dGDZbLiezz7Ac801HirGZsWjydfZyPvHXL/Y8Mjzg8BxTZiuwKz4Eb8sBE9zznszmjvFwHKPIWUnwhqfVRcd4Ck0K6ate48m1oOfrX3/yOtvAsJ8zsPAM89sjnddmuLuDPjX9Bu/L7x7xpMzFk6nWtyQfPg278Gn4Aekz2ZgOmU9eJ37R14vwE/BL8G3aibCiWMWWDQ0ZtkPMnlcGeAu/Ag+8ZyecU5BPuy2ILD+sQqyZhAKmn7XZd+jIMTN9eBL7x95xVLSX4On8EcNlXDqmBlqS13jG4LpmGbkF/0CnOi3H8ETOIXzmnmtb0a16Tzxj1sUvQCBiXZGDtmB3KAefPH94xcUa/6vwRn80GOFyjEXFpba4A1e8KQfFF+259tx5XS4egYn8fQsLGrqGrHbztr+uByTahWuL1NUGbDpsnrwBfePPwHHIf9X4RnM4Z2ABWdxUBlqQ2PwhuDxoS0vvqB1JzS0P4h2nA/QgTrsJFn+Y3AOjs9JFC07CGWX1oNX3T/yHOzgDjwPn1PM3g9Jk9lZrMEpxnlPmBbjyo2+KFXRU52TJM/2ALcY57RUzjObbjqxVw++4P6RAOf58pcVsw9Daje3htriYrpDOonre3CudSe6bfkTEgHBHuDiyu5MCsc7BHhYDx7ePxLjqigXZsw+ijMHFhuwBmtoTPtOxOrTvYJDnC75dnUbhfwu/ZW9AgYd+peL68HD+0emKquiXHhWjJg/UrkJYzuiaL3E9aI/ytrCvAd4GcYZMCkSQxfUg3v3j8c4e90j5ZTPdvmJJGHnOCI2nHS8081X013pHuBlV1gB2MX1YNmWLHqqGN/TWmG0y6clJWthxNUl48q38Bi8vtMKyzzpFdSDhxZ5WBA5ZLt8Jv3895DduBlgbPYAj8C4B8hO68FDkoh5lydC4FiWvBOVqjYdqjiLv92t8yPDjrDaiHdUD15qkSURSGmXJwOMSxWAXYwr3zaAufJ66l+94vv3AO+vPcD7aw/w/toDvL/2AO+vPcD7aw/wHuD9tQd4f+0B3l97gPfXHuD9tQd4f+0B3l97gG8LwP8G/AL8O/A5OCq0Ys2KIdv/qOIXG/4mvFAMF16gZD+2Xvu/B8as5+8bfllWyg0zaNO5bfXj6vfhhwD86/Aq3NfRS9t9WPnhfnvCIw/CT8GLcFTMnpntdF/z9V+PWc/vWoIH+FL3Znv57PitcdGP4R/C34avw5fgRVUInCwbsn1yyA8C8zm/BH8NXoXnVE6wVPjdeCI38kX/3+Ct9dbz1pTmHFRu+Hm4O9Ch3clr99negxfwj+ER/DR8EV6B5+DuQOnTgUw5rnkY+FbNU3gNXh0o/JYTuWOvyBf9FvzX663HH/HejO8LwAl8Hl5YLTd8q7sqA3wbjuExfAFegQdwfyDoSkWY8swzEf6o4Qyewefg+cHNbqMQruSL/u/WWc+E5g7vnnEXgDmcDeSGb/F4cBcCgT+GGRzDU3hZYburAt9TEtHgbM6JoxJ+6NMzzTcf6c2bycv2+KK/f+l6LBzw5IwfqZJhA3M472pWT/ajKxnjv4AFnMEpnBTPND6s2J7qHbPAqcMK74T2mZ4VGB9uJA465It+/eL1WKhYOD7xHOkr1ajK7d0C4+ke4Hy9qXZwpgLr+Znm/uNFw8xQOSy8H9IzjUrd9+BIfenYaylf9FsXr8fBAadnPIEDna8IBcwlxnuA0/Wv6GAWPd7dDIKjMdSWueAsBj4M7TOd06qBbwDwKr7oleuxMOEcTuEZTHWvDYUO7aHqAe0Bbq+HEFRzOz7WVoTDQkVds7A4sIIxfCQdCefFRoIOF/NFL1mPab/nvOakSL/Q1aFtNpUb/nFOVX6gzyg/1nISyDfUhsokIzaBR9Kxm80s5mK+6P56il1jXic7nhQxsxSm3OwBHl4fFdLqi64nDQZvqE2at7cWAp/IVvrN6/BFL1mPhYrGMBfOi4PyjuSGf6wBBh7p/FZTghCNWGgMzlBbrNJoPJX2mW5mwZfyRffXo7OFi5pZcS4qZUrlViptrXtw+GQoyhDPS+ANjcGBNRiLCQDPZPMHuiZfdFpPSTcQwwKYdRNqpkjm7AFeeT0pJzALgo7g8YYGrMHS0iocy+YTm2vyRUvvpXCIpQ5pe666TJrcygnScUf/p0NDs/iAI/nqDHC8TmQT8x3NF91l76oDdQGwu61Z6E0ABv7uO1dbf/37Zlv+Zw/Pbh8f1s4Avur6657/+YYBvur6657/+YYBvur6657/+YYBvur6657/+aYBvuL6657/+VMA8FXWX/f8zzcN8BXXX/f8zzcNMFdbf93zP38KLPiK6697/uebtuArrr/u+Z9vGmCusP6653/+1FjwVdZf9/zPN7oHX339dc//fNMu+irrr3v+50+Bi+Zq6697/uebA/jz8Pudf9ht/fWv517J/XUzAP8C/BAeX9WCDrUpZ3/dEMBxgPcfbtTVvsYV5Yn32u03B3Ac4P3b8I+vxNBKeeL9dRMAlwO83959qGO78sT769oB7g3w/vGVYFzKE++v6wV4OMD7F7tckFkmT7y/rhHgpQO8b+4Y46XyxPvrugBeNcB7BRiX8sT767oAvmCA9woAHsoT76+rBJjLBnh3txOvkifeX1dswZcO8G6N7sXyxPvr6i340gHe3TnqVfLE++uKAb50gHcXLnrX8sR7gNdPRqwzwLu7Y/FO5Yn3AK9jXCMGeHdgxDuVJ75VAI8ljP7PAb3/RfjcZfePHBB+79dpfpH1CanN30d+mT1h9GqAxxJGM5LQeeQ1+Tb+EQJrElLb38VHQ94TRq900aMIo8cSOo+8Dp8QfsB8zpqE1NO3OI9Zrj1h9EV78PqE0WMJnUdeU6E+Jjyk/hbrEFIfeWbvId8H9oTRFwdZaxJGvziW0Hn0gqYB/wyZ0PwRlxJST+BOw9m77Amj14ii1yGM/txYQudN0qDzGe4EqfA/5GJCagsHcPaEPWH0esekSwmjRxM6b5JEcZ4ww50ilvAOFxBSx4yLW+A/YU8YvfY5+ALC6NGEzhtmyZoFZoarwBLeZxUhtY4rc3bKnjB6TKJjFUHzJoTOozF2YBpsjcyxDgzhQ1YRUse8+J4wenwmaylB82hC5w0zoRXUNXaRBmSMQUqiWSWkLsaVqc/ZE0aPTFUuJWgeTei8SfLZQeMxNaZSIzbII4aE1Nmr13P2hNHjc9E9guYNCZ032YlNwESMLcZiLQHkE4aE1BFg0yAR4z1h9AiAGRA0jyZ03tyIxWMajMPWBIsxYJCnlITU5ShiHYdZ94TR4wCmSxg9jtB5KyPGYzymAYexWEMwAPIsAdYdV6aObmNPGD0aYLoEzaMJnTc0Ygs+YDw0GAtqxBjkuP38bMRWCHn73xNGjz75P73WenCEJnhwyVe3AEe8TtKdJcYhBl97wuhNAObK66lvD/9J9NS75v17wuitAN5fe4D31x7g/bUHeH/tAd5fe4D3AO+vPcD7aw/w/toDvL/2AO+vPcD7aw/w/toDvAd4f/24ABzZ8o+KLsSLS+Pv/TqTb3P4hKlQrTGh+fbIBT0Axqznnb+L/V2mb3HkN5Mb/nEHeK7d4IcDld6lmDW/iH9E+AH1MdOw/Jlu2T1xNmY98sv4wHnD7D3uNHu54WUuOsBTbQuvBsPT/UfzNxGYzwkP8c+Yz3C+r/i6DcyRL/rZ+utRwWH5PmfvcvYEt9jLDS/bg0/B64DWKrQM8AL8FPwS9beQCe6EMKNZYJol37jBMy35otdaz0Bw2H/C2Smc7+WGB0HWDELBmOByA3r5QONo4V+DpzR/hFS4U8wMW1PXNB4TOqYz9urxRV++ntWCw/U59Ty9ebdWbrgfRS9AYKKN63ZokZVygr8GZ/gfIhZXIXPsAlNjPOLBby5c1eOLvmQ9lwkOy5x6QV1j5TYqpS05JtUgUHUp5toHGsVfn4NX4RnMCe+AxTpwmApTYxqMxwfCeJGjpXzRF61nbcHhUBPqWze9svwcHJ+S6NPscKrEjug78Dx8Lj3T8D4YxGIdxmJcwhi34fzZUr7olevZCw5vkOhoClq5zBPZAnygD/Tl9EzDh6kl3VhsHYcDEb+hCtJSvuiV69kLDm+WycrOTArHmB5/VYyP6jOVjwgGawk2zQOaTcc1L+aLXrKeveDwZqlKrw8U9Y1p66uK8dEzdYwBeUQAY7DbyYNezBfdWQ97weEtAKYQg2xJIkuveAT3dYeLGH+ShrWNwZgN0b2YL7qznr3g8JYAo5bQBziPjx7BPZ0d9RCQp4UZbnFdzBddor4XHN4KYMrB2qHFRIzzcLAHQZ5the5ovui94PCWAPefaYnxIdzRwdHCbuR4B+tbiy96Lzi8E4D7z7S0mEPd+eqO3cT53Z0Y8SV80XvB4Z0ADJi/f7X113f+7p7/+UYBvur6657/+YYBvur6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+VMA8FXWX/f8z58OgK+y/rrnf75RgLna+uue//lTA/CV1V/3/M837aKvvv6653++UQvmauuve/7nTwfAV1N/3fM/fzr24Cuuv+75nz8FFnxl9dc9//MOr/8/glixwRuUfM4AAAAASUVORK5CYII=",s.tArea,i),Zre("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAhCAAAAABIXyLAAAAAOElEQVRIx2NgGAWjYBSMglEwEICREYRgFBZBqDCSLA2MGPUIVQETE9iNUAqLR5gIeoQKRgwXjwAAGn4AtaFeYLEAAAAASUVORK5CYII=",s.tSearch,o);const a={...ynt};return ji(zi(e,"triangles",bnt,a,s),s)}(t,this.edgesTarget.texture),this.blendRenderable=function Snt(e,t,n){const r=t.getWidth(),i=t.getHeight(),o={..._o,tColor:k.create(t),tWeights:k.create(n),uTexSizeInv:k.create(Me.create(1/r,1/i)),uViewport:k.create(nn())},s={..._nt};return ji(zi(e,"triangles",xnt,s,o),o)}(t,n,this.weightsTarget.texture),this._supported=!0}updateState(t){const{gl:n,state:r}=this.webgl;r.enable(n.SCISSOR_TEST),r.disable(n.BLEND),r.disable(n.DEPTH_TEST),r.depthMask(!1);const{x:i,y:o,width:s,height:a}=t;r.viewport(i,o,s,a),r.scissor(i,o,s,a),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,1),n.clear(n.COLOR_BUFFER_BIT),k.update(this.edgesRenderable.values.uViewport,Lo.toVec4(this.edgesRenderable.values.uViewport.ref.value,t)),k.update(this.weightsRenderable.values.uViewport,Lo.toVec4(this.weightsRenderable.values.uViewport.ref.value,t)),k.update(this.blendRenderable.values.uViewport,Lo.toVec4(this.blendRenderable.values.uViewport.ref.value,t))}setSize(t,n){const r=this.edgesTarget.getWidth(),i=this.edgesTarget.getHeight();(t!==r||n!==i)&&(this.edgesTarget.setSize(t,n),this.weightsTarget.setSize(t,n),k.update(this.edgesRenderable.values.uTexSizeInv,Me.set(this.edgesRenderable.values.uTexSizeInv.ref.value,1/t,1/n)),k.update(this.weightsRenderable.values.uTexSizeInv,Me.set(this.weightsRenderable.values.uTexSizeInv.ref.value,1/t,1/n)),k.update(this.blendRenderable.values.uTexSizeInv,Me.set(this.blendRenderable.values.uTexSizeInv.ref.value,1/t,1/n)))}update(t,n){let r=!1;this.edgesRenderable.values.tColor.ref.value!==t&&(k.update(this.edgesRenderable.values.tColor,t),r=!0),this.edgesRenderable.values.dEdgeThreshold.ref.value!==n.edgeThreshold&&(k.update(this.edgesRenderable.values.dEdgeThreshold,n.edgeThreshold),r=!0),r&&this.edgesRenderable.update(),this.weightsRenderable.values.dMaxSearchSteps.ref.value!==n.maxSearchSteps&&(k.update(this.weightsRenderable.values.dMaxSearchSteps,n.maxSearchSteps),this.weightsRenderable.update()),this.blendRenderable.values.tColor.ref.value!==t&&(k.update(this.blendRenderable.values.tColor,t),this.blendRenderable.update())}render(t,n){lt&&this.webgl.timer.mark("SmaaPass.render"),this.edgesTarget.bind(),this.updateState(t),this.edgesRenderable.render(),this.weightsTarget.bind(),this.updateState(t),this.weightsRenderable.render(),n?n.bind():this.webgl.unbindFramebuffer(),this.updateState(t),this.blendRenderable.render(),lt&&this.webgl.timer.markEnd("SmaaPass.render")}}const hnt={...vo,tColor:jt("texture","rgba","ubyte","linear"),uTexSizeInv:xe("v2"),uViewport:xe("v4"),dEdgeThreshold:Ft("number")},mnt=Br("smaa-edges","\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nuniform vec2 uTexSizeInv;\nuniform vec4 uViewport;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\n\nvoid SMAAEdgeDetectionVS(vec2 texCoord) {\n vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-1.0, 0.0, 0.0, 1.0); // WebGL port note: Changed sign in W component\n vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(1.0, 0.0, 0.0, -1.0); // WebGL port note: Changed sign in W component\n vOffset[2] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-2.0, 0.0, 0.0, 2.0); // WebGL port note: Changed sign in W component\n}\n\nvoid main() {\n vec2 scale = uViewport.zw * uTexSizeInv;\n vec2 shift = uViewport.xy * uTexSizeInv;\n vUv = (aPosition + 1.0) * 0.5 * scale + shift;\n SMAAEdgeDetectionVS(vUv);\n vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n gl_Position = vec4(position, 0.0, 1.0);\n}\n","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\n\nvec4 SMAAColorEdgeDetectionPS(vec2 texcoord, vec4 offset[3], sampler2D colorTex) {\n vec2 threshold = vec2(dEdgeThreshold, dEdgeThreshold);\n\n // Calculate color deltas:\n vec4 delta;\n vec3 C = texture2D(colorTex, texcoord).rgb;\n\n vec3 Cleft = texture2D(colorTex, offset[0].xy).rgb;\n vec3 t = abs(C - Cleft);\n delta.x = max(max(t.r, t.g), t.b);\n\n vec3 Ctop = texture2D(colorTex, offset[0].zw).rgb;\n t = abs(C - Ctop);\n delta.y = max(max(t.r, t.g), t.b);\n\n // We do the usual threshold:\n vec2 edges = step(threshold, delta.xy);\n\n // Then discard if there is no edge:\n if (dot(edges, vec2(1.0, 1.0 )) == 0.0)\n discard;\n\n // Calculate right and bottom deltas:\n vec3 Cright = texture2D(colorTex, offset[1].xy).rgb;\n t = abs( C - Cright );\n delta.z = max(max(t.r, t.g), t.b);\n\n vec3 Cbottom = texture2D(colorTex, offset[1].zw).rgb;\n t = abs(C - Cbottom);\n delta.w = max(max(t.r, t.g), t.b);\n\n // Calculate the maximum delta in the direct neighborhood:\n float maxDelta = max(max(max(delta.x, delta.y), delta.z), delta.w );\n\n // Calculate left-left and top-top deltas:\n vec3 Cleftleft = texture2D(colorTex, offset[2].xy).rgb;\n t = abs( C - Cleftleft );\n delta.z = max(max(t.r, t.g), t.b);\n\n vec3 Ctoptop = texture2D(colorTex, offset[2].zw).rgb;\n t = abs(C - Ctoptop);\n delta.w = max(max(t.r, t.g), t.b);\n\n // Calculate the final maximum delta:\n maxDelta = max(max(maxDelta, delta.z), delta.w);\n\n // Local contrast adaptation in action:\n edges.xy *= step(0.5 * maxDelta, delta.xy);\n\n return vec4(edges, 0.0, 0.0);\n}\n\nvoid main() {\n gl_FragColor = SMAAColorEdgeDetectionPS(vUv, vOffset, tColor);\n}\n"),ynt={...vo,tEdges:jt("texture","rgba","ubyte","linear"),tArea:jt("texture","rgb","ubyte","linear"),tSearch:jt("texture","rgba","ubyte","nearest"),uTexSizeInv:xe("v2"),uViewport:xe("v4"),dMaxSearchSteps:Ft("number")},bnt=Br("smaa-weights","\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nuniform vec2 uTexSizeInv;\nuniform vec4 uViewport;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\nvarying vec2 vPixCoord;\n\nvoid SMAABlendingWeightCalculationVS(vec2 texCoord) {\n vPixCoord = texCoord / uTexSizeInv;\n\n // We will use these offsets for the searches later on (see @PSEUDO_GATHER4):\n vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-0.25, 0.125, 1.25, 0.125); // WebGL port note: Changed sign in Y and W components\n vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-0.125, 0.25, -0.125, -1.25); // WebGL port note: Changed sign in Y and W components\n\n // And these for the searches, they indicate the ends of the loops:\n vOffset[2] = vec4(vOffset[0].xz, vOffset[1].yw) + vec4(-2.0, 2.0, -2.0, 2.0) * uTexSizeInv.xxyy * float(dMaxSearchSteps);\n}\n\nvoid main() {\n vec2 scale = uViewport.zw * uTexSizeInv;\n vec2 shift = uViewport.xy * uTexSizeInv;\n vUv = (aPosition + 1.0) * 0.5 * scale + shift;\n SMAABlendingWeightCalculationVS(vUv);\n vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n gl_Position = vec4(position, 0.0, 1.0);\n}\n","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#define SMAASampleLevelZeroOffset(tex, coord, offset) texture2D(tex, coord + float(offset) * uTexSizeInv, 0.0)\n\n#define SMAA_AREATEX_MAX_DISTANCE 16\n#define SMAA_AREATEX_PIXEL_SIZE (1.0 / vec2(160.0, 560.0))\n#define SMAA_AREATEX_SUBTEX_SIZE (1.0 / 7.0)\n\nuniform sampler2D tEdges;\nuniform sampler2D tArea;\nuniform sampler2D tSearch;\nuniform vec2 uTexSizeInv;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\nvarying vec2 vPixCoord;\n\n#if __VERSION__ == 100\n vec2 round(vec2 x) {\n return sign(x) * floor(abs(x) + 0.5);\n }\n#endif\n\nfloat SMAASearchLength(sampler2D searchTex, vec2 e, float bias, float scale) {\n // Not required if searchTex accesses are set to point:\n // float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0);\n // e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE +\n // e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;\n e.r = bias + e.r * scale;\n return 255.0 * texture2D(searchTex, e, 0.0).r;\n}\n\nfloat SMAASearchXLeft(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n /**\n * @PSEUDO_GATHER4\n * This texCoord has been offset by (-0.25, -0.125) in the vertex shader to\n * sample between edge, thus fetching four edges in a row.\n * Sampling with different offsets in each direction allows to disambiguate\n * which edges are active from the four fetched ones.\n */\n vec2 e = vec2(0.0, 1.0);\n\n for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n e = texture2D( edgesTex, texCoord, 0.0).rg;\n texCoord -= vec2(2.0, 0.0) * uTexSizeInv;\n if (!(texCoord.x > end && e.g > 0.8281 && e.r == 0.0)) break;\n }\n\n // We correct the previous (-0.25, -0.125) offset we applied:\n texCoord.x += 0.25 * uTexSizeInv.x;\n\n // The searches are bias by 1, so adjust the coords accordingly:\n texCoord.x += uTexSizeInv.x;\n\n // Disambiguate the length added by the last step:\n texCoord.x += 2.0 * uTexSizeInv.x; // Undo last step\n texCoord.x -= uTexSizeInv.x * SMAASearchLength(searchTex, e, 0.0, 0.5);\n\n return texCoord.x;\n}\n\nfloat SMAASearchXRight(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n vec2 e = vec2( 0.0, 1.0 );\n\n for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n e = texture2D(edgesTex, texCoord, 0.0).rg;\n texCoord += vec2(2.0, 0.0) * uTexSizeInv;\n if (!(texCoord.x < end && e.g > 0.8281 && e.r == 0.0)) break;\n }\n\n texCoord.x -= 0.25 * uTexSizeInv.x;\n texCoord.x -= uTexSizeInv.x;\n texCoord.x -= 2.0 * uTexSizeInv.x;\n texCoord.x += uTexSizeInv.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );\n\n return texCoord.x;\n}\n\nfloat SMAASearchYUp(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n vec2 e = vec2( 1.0, 0.0 );\n\n for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n e = texture2D(edgesTex, texCoord, 0.0).rg;\n texCoord += vec2(0.0, 2.0) * uTexSizeInv; // WebGL port note: Changed sign\n if (!(texCoord.y > end && e.r > 0.8281 && e.g == 0.0)) break;\n }\n\n texCoord.y -= 0.25 * uTexSizeInv.y; // WebGL port note: Changed sign\n texCoord.y -= uTexSizeInv.y; // WebGL port note: Changed sign\n texCoord.y -= 2.0 * uTexSizeInv.y; // WebGL port note: Changed sign\n texCoord.y += uTexSizeInv.y * SMAASearchLength(searchTex, e.gr, 0.0, 0.5); // WebGL port note: Changed sign\n\n return texCoord.y;\n}\n\nfloat SMAASearchYDown(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n vec2 e = vec2( 1.0, 0.0 );\n\n for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n e = texture2D(edgesTex, texCoord, 0.0).rg;\n texCoord -= vec2( 0.0, 2.0 ) * uTexSizeInv; // WebGL port note: Changed sign\n if (!(texCoord.y < end && e.r > 0.8281 && e.g == 0.0)) break;\n }\n\n texCoord.y += 0.25 * uTexSizeInv.y; // WebGL port note: Changed sign\n texCoord.y += uTexSizeInv.y; // WebGL port note: Changed sign\n texCoord.y += 2.0 * uTexSizeInv.y; // WebGL port note: Changed sign\n texCoord.y -= uTexSizeInv.y * SMAASearchLength(searchTex, e.gr, 0.5, 0.5); // WebGL port note: Changed sign\n\n return texCoord.y;\n}\n\nvec2 SMAAArea(sampler2D areaTex, vec2 dist, float e1, float e2, float offset) {\n // Rounding prevents precision errors of bilinear filtering:\n vec2 texCoord = float(SMAA_AREATEX_MAX_DISTANCE) * round(4.0 * vec2(e1, e2)) + dist;\n\n // We do a scale and bias for mapping to texel space:\n texCoord = SMAA_AREATEX_PIXEL_SIZE * texCoord + (0.5 * SMAA_AREATEX_PIXEL_SIZE);\n\n // Move to proper place, according to the subpixel offset:\n texCoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;\n\n return texture2D(areaTex, texCoord, 0.0).rg;\n}\n\nvec4 SMAABlendingWeightCalculationPS(vec2 texCoord, vec2 pixCoord, vec4 offset[3], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices) {\n vec4 weights = vec4(0.0, 0.0, 0.0, 0.0);\n\n vec2 e = texture2D(edgesTex, texCoord).rg;\n\n if (e.g > 0.0) { // Edge at north\n vec2 d;\n\n // Find the distance to the left:\n vec2 coords;\n coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x );\n coords.y = offset[1].y; // offset[1].y = texCoord.y - 0.25 * uTexSizeInv.y (@CROSSING_OFFSET)\n d.x = coords.x;\n\n // Now fetch the left crossing edges, two at a time using bilinear\n // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to\n // discern what value each edge has:\n float e1 = texture2D(edgesTex, coords, 0.0).r;\n\n // Find the distance to the right:\n coords.x = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y);\n d.y = coords.x;\n\n // We want the distances to be in pixel units (doing this here allow to\n // better interleave arithmetic and memory accesses):\n d = d / uTexSizeInv.x - pixCoord.x;\n\n // SMAAArea below needs a sqrt, as the areas texture is compressed\n // quadratically:\n vec2 sqrt_d = sqrt(abs(d));\n\n // Fetch the right crossing edges:\n coords.y -= 1.0 * uTexSizeInv.y; // WebGL port note: Added\n float e2 = SMAASampleLevelZeroOffset(edgesTex, coords, ivec2(1, 0)).r;\n\n // Ok, we know how this pattern looks like, now it is time for getting\n // the actual area:\n weights.rg = SMAAArea(areaTex, sqrt_d, e1, e2, float(subsampleIndices.y));\n }\n\n if (e.r > 0.0) { // Edge at west\n vec2 d;\n\n // Find the distance to the top:\n vec2 coords;\n\n coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z );\n coords.x = offset[0].x; // offset[1].x = texCoord.x - 0.25 * uTexSizeInv.x;\n d.x = coords.y;\n\n // Fetch the top crossing edges:\n float e1 = texture2D(edgesTex, coords, 0.0).g;\n\n // Find the distance to the bottom:\n coords.y = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w);\n d.y = coords.y;\n\n // We want the distances to be in pixel units:\n d = d / uTexSizeInv.y - pixCoord.y;\n\n // SMAAArea below needs a sqrt, as the areas texture is compressed\n // quadratically:\n vec2 sqrt_d = sqrt(abs(d));\n\n // Fetch the bottom crossing edges:\n coords.y -= 1.0 * uTexSizeInv.y; // WebGL port note: Added\n float e2 = SMAASampleLevelZeroOffset(edgesTex, coords, ivec2(0, 1)).g;\n\n // Get the area for this direction:\n weights.ba = SMAAArea(areaTex, sqrt_d, e1, e2, float(subsampleIndices.x));\n }\n\n return weights;\n}\n\nvoid main() {\n gl_FragColor = SMAABlendingWeightCalculationPS(vUv, vPixCoord, vOffset, tEdges, tArea, tSearch, ivec4(0.0));\n}\n"),_nt={...vo,tColor:jt("texture","rgba","ubyte","linear"),tWeights:jt("texture","rgba","ubyte","linear"),uTexSizeInv:xe("v2"),uViewport:xe("v4")},xnt=Br("smaa-blend","\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nuniform vec2 uTexSizeInv;\nuniform vec4 uViewport;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[2];\n\nvoid SMAANeighborhoodBlendingVS(vec2 texCoord) {\n vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-1.0, 0.0, 0.0, 1.0); // WebGL port note: Changed sign in W component\n vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(1.0, 0.0, 0.0, -1.0); // WebGL port note: Changed sign in W component\n}\n\nvoid main() {\n vec2 scale = uViewport.zw * uTexSizeInv;\n vec2 shift = uViewport.xy * uTexSizeInv;\n vUv = (aPosition + 1.0) * 0.5 * scale + shift;\n SMAANeighborhoodBlendingVS(vUv);\n vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n gl_Position = vec4(position, 0.0, 1.0);\n}\n","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tWeights;\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[2];\n\nvec4 SMAANeighborhoodBlendingPS(vec2 texCoord, vec4 offset[2], sampler2D colorTex, sampler2D blendTex) {\n // Fetch the blending weights for current pixel:\n vec4 a;\n a.xz = texture2D(blendTex, texCoord).xz;\n a.y = texture2D(blendTex, offset[1].zw).g;\n a.w = texture2D(blendTex, offset[1].xy).a;\n\n // Is there any blending weight with a value greater than 0.0?\n if (dot(a, vec4(1.0, 1.0, 1.0, 1.0)) < 1e-5) {\n return texture2D(colorTex, texCoord, 0.0);\n } else {\n // Up to 4 lines can be crossing a pixel (one through each edge). We\n // favor blending by choosing the line with the maximum weight for each\n // direction:\n vec2 offset;\n offset.x = a.a > a.b ? a.a : -a.b; // left vs. right\n offset.y = a.g > a.r ? -a.g : a.r; // top vs. bottom // WebGL port note: Changed signs\n\n // Then we go in the direction that has the maximum weight:\n if (abs(offset.x) > abs(offset.y)) { // horizontal vs. vertical\n offset.y = 0.0;\n } else {\n offset.x = 0.0;\n }\n\n // Fetch the opposite color and lerp by hand:\n vec4 C = texture2D(colorTex, texCoord, 0.0);\n texCoord += sign(offset) * uTexSizeInv;\n vec4 Cop = texture2D(colorTex, texCoord, 0.0);\n float s = abs(offset.x) > abs(offset.y) ? abs(offset.x) : abs(offset.y);\n\n // WebGL port note: Added gamma correction\n C.xyz = pow(C.xyz, vec3(2.2));\n Cop.xyz = pow(Cop.xyz, vec3(2.2));\n vec4 mixed = mix(C, Cop, s);\n mixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));\n\n return mixed;\n }\n}\n\nvoid main() {\n gl_FragColor = SMAANeighborhoodBlendingPS(vUv, vOffset, tColor, tWeights);\n}\n"),hue={opacity:C.Numeric(1,{min:0,max:1,step:.01}),saturation:C.Numeric(0,{min:-1,max:1,step:.01}),lightness:C.Numeric(0,{min:-1,max:1,step:.01})},Tnt={faces:C.MappedStatic("urls",{urls:C.Group({nx:C.Text("",{label:"Negative X / Left"}),ny:C.Text("",{label:"Negative Y / Bottom"}),nz:C.Text("",{label:"Negative Z / Back"}),px:C.Text("",{label:"Positive X / Right"}),py:C.Text("",{label:"Positive Y / Top"}),pz:C.Text("",{label:"Positive Z / Front"})},{isExpanded:!0,label:"URLs"}),files:C.Group({nx:C.File({label:"Negative X / Left",accept:"image/*"}),ny:C.File({label:"Negative Y / Bottom",accept:"image/*"}),nz:C.File({label:"Negative Z / Back",accept:"image/*"}),px:C.File({label:"Positive X / Right",accept:"image/*"}),py:C.File({label:"Positive Y / Top",accept:"image/*"}),pz:C.File({label:"Positive Z / Front",accept:"image/*"})},{isExpanded:!0,label:"Files"})}),blur:C.Numeric(0,{min:0,max:1,step:.01},{description:'Note, this only works in WebGL2 or when "EXT_shader_texture_lod" is available.'}),...hue},Dnt={source:C.MappedStatic("url",{url:C.Text(""),file:C.File({accept:"image/*"})}),blur:C.Numeric(0,{min:0,max:1,step:.01},{description:'Note, this only works in WebGL2 or with power-of-two images and when "EXT_shader_texture_lod" is available.'}),...hue,coverage:C.Select("viewport",C.arrayToOptions(["viewport","canvas"]))},Ent={topColor:C.Color(st(14540253)),bottomColor:C.Color(st(15658734)),ratio:C.Numeric(.5,{min:0,max:1,step:.01}),coverage:C.Select("viewport",C.arrayToOptions(["viewport","canvas"]))},Pnt={centerColor:C.Color(st(14540253)),edgeColor:C.Color(st(15658734)),ratio:C.Numeric(.5,{min:0,max:1,step:.01}),coverage:C.Select("viewport",C.arrayToOptions(["viewport","canvas"]))},Mnt={variant:C.MappedStatic("off",{off:C.EmptyGroup(),skybox:C.Group(Tnt,{isExpanded:!0}),image:C.Group(Dnt,{isExpanded:!0}),horizontalGradient:C.Group(Ent,{isExpanded:!0}),radialGradient:C.Group(Pnt,{isExpanded:!0})},{label:"Environment"})};class Rnt{constructor(t,n,r,i){this.webgl=t,this.assetManager=n,this.camera=new gr,this.target=v(),this.position=v(),this.dir=v(),this.renderable=function znt(e,t,n){const r={drawCount:k.create(6),instanceCount:k.create(1),aPosition:k.create(D5),tSkybox:k.create(Os()),tImage:k.create(Os()),uImageScale:k.create(Me()),uImageOffset:k.create(Me()),uTexSize:k.create(Me.create(t,n)),uViewport:k.create(nn()),uViewportAdjusted:k.create(!0),uViewDirectionProjectionInverse:k.create(le()),uGradientColorA:k.create(v()),uGradientColorB:k.create(v()),uGradientRatio:k.create(.5),uBlur:k.create(0),uOpacity:k.create(1),uSaturation:k.create(0),uLightness:k.create(0),dVariant:k.create("skybox")},i={...Unt};return ji(zi(e,"triangles",Vnt,i,r),r)}(t,r,i)}setSize(t,n){const[r,i]=this.renderable.values.uTexSize.ref.value;(t!==r||n!==i)&&k.update(this.renderable.values.uTexSize,Me.set(this.renderable.values.uTexSize.ref.value,t,n))}clearSkybox(){void 0!==this.skybox&&(this.skybox.texture.destroy(),this.skybox.assets.forEach(t=>this.assetManager.release(t)),this.skybox=void 0)}updateSkybox(t,n,r){var i;const o=null===(i=this.skybox)||void 0===i?void 0:i.props.faces,s=n.faces.params;if(!(s.nx&&s.ny&&s.nz&&s.px&&s.py&&s.pz))return this.clearSkybox(),void r?.(!1);if(this.skybox&&o&&function Fnt(e,t){return gue(e)===gue(t)}(n.faces,this.skybox.props.faces))r?.(!1);else{this.clearSkybox();const{texture:u,assets:l}=function Bnt(e,t,n,r){const i=function knt(e,t){return"urls"===t.name?{nx:fr.getUrlAsset(e,t.params.nx),ny:fr.getUrlAsset(e,t.params.ny),nz:fr.getUrlAsset(e,t.params.nz),px:fr.getUrlAsset(e,t.params.px),py:fr.getUrlAsset(e,t.params.py),pz:fr.getUrlAsset(e,t.params.pz)}:{nx:t.params.nx,ny:t.params.ny,nz:t.params.nz,px:t.params.px,py:t.params.py,pz:t.params.pz}}(t,n),o=function Nnt(e,t){const n=r=>e.resolve(r,"binary").run().then(i=>new Blob([i.data]));return{nx:n(t.nx),ny:n(t.ny),nz:n(t.nz),px:n(t.px),py:n(t.py),pz:n(t.pz)}}(t,i),s=[i.nx,i.ny,i.nz,i.px,i.py,i.pz];return typeof HTMLImageElement>"u"?(console.error('Missing "HTMLImageElement" required for background skybox'),r?.(!0),{texture:Os(),assets:s}):{texture:e.resources.cubeTexture(o,!0,r),assets:s}}(this.webgl,this.assetManager,n.faces,d=>{this.skybox&&(this.skybox.loaded=!d),r?.(!0)});this.skybox={texture:u,props:{...n},assets:l,loaded:!1},k.update(this.renderable.values.tSkybox,u),this.renderable.update()}if(!this.skybox)return;let a=t;"orthographic"===t.state.mode&&(this.camera.setState({...t.state,mode:"perspective"}),this.camera.update(),a=this.camera);const c=this.renderable.values.uViewDirectionProjectionInverse.ref.value;v.sub(this.dir,a.state.position,a.state.target),v.setMagnitude(this.dir,this.dir,.1),v.copy(this.position,this.dir),le.lookAt(c,this.position,this.target,a.state.up),le.mul(c,a.projection,c),le.invert(c,c),k.update(this.renderable.values.uViewDirectionProjectionInverse,c),k.updateIfChanged(this.renderable.values.uBlur,n.blur),k.updateIfChanged(this.renderable.values.uOpacity,n.opacity),k.updateIfChanged(this.renderable.values.uSaturation,n.saturation),k.updateIfChanged(this.renderable.values.uLightness,n.lightness),k.updateIfChanged(this.renderable.values.dVariant,"skybox"),this.renderable.update()}clearImage(){void 0!==this.image&&(this.image.texture.destroy(),this.assetManager.release(this.image.asset),this.image=void 0)}updateImage(t,n){if(!t.source.params)return this.clearImage(),void n?.(!1);if(this.image&&this.image.props.source.params&&function Ont(e,t){return bue(e)===bue(t)}(t.source,this.image.props.source))n?.(!1);else{this.clearImage();const{texture:r,asset:i}=function Lnt(e,t,n,r){const i="url"===n.name?fr.getUrlAsset(t,n.params):n.params;if(typeof HTMLImageElement>"u")return console.error('Missing "HTMLImageElement" required for background image'),r?.(!0),{texture:Os(),asset:i};const o=e.resources.texture("image-uint8","rgba","ubyte","linear"),s=new Image;return s.onload=()=>{o.load(s),(e.isWebGL2||$x(s.width)&&$x(s.height))&&o.mipmap(),r?.()},s.onerror=()=>{r?.(!0)},t.resolve(i,"binary").run().then(a=>{const c=new Blob([a.data]);s.src=URL.createObjectURL(c)}),{texture:o,asset:i}}(this.webgl,this.assetManager,t.source,o=>{this.image&&(this.image.loaded=!o),n?.(!0)});this.image={texture:r,props:{...t},asset:i,loaded:!1},k.update(this.renderable.values.tImage,r),this.renderable.update()}this.image&&(k.updateIfChanged(this.renderable.values.uBlur,t.blur),k.updateIfChanged(this.renderable.values.uOpacity,t.opacity),k.updateIfChanged(this.renderable.values.uSaturation,t.saturation),k.updateIfChanged(this.renderable.values.uLightness,t.lightness),k.updateIfChanged(this.renderable.values.uViewportAdjusted,"viewport"===t.coverage),k.updateIfChanged(this.renderable.values.dVariant,"image"),this.renderable.update())}updateImageScaling(){var t,n;const r=this.renderable.values,[i,o]=r.uTexSize.ref.value,s=(null===(t=this.image)||void 0===t?void 0:t.texture.getWidth())||0,a=(null===(n=this.image)||void 0===n?void 0:n.texture.getHeight())||0,c=i/o;k.update(r.uImageScale,cc?Me.set(r.uImageOffset.ref.value,(1-c/f)/2,0):Me.set(r.uImageOffset.ref.value,0,(1-f/c)/2))}updateGradient(t,n,r,i,o){k.update(this.renderable.values.uGradientColorA,st.toVec3Normalized(this.renderable.values.uGradientColorA.ref.value,t)),k.update(this.renderable.values.uGradientColorB,st.toVec3Normalized(this.renderable.values.uGradientColorB.ref.value,n)),k.updateIfChanged(this.renderable.values.uGradientRatio,r),k.updateIfChanged(this.renderable.values.uViewportAdjusted,o),k.updateIfChanged(this.renderable.values.dVariant,i),this.renderable.update()}update(t,n,r){if("off"===n.variant.name)return this.clearSkybox(),this.clearImage(),void r?.(!1);"skybox"===n.variant.name?(this.clearImage(),this.updateSkybox(t,n.variant.params,r)):"image"===n.variant.name?(this.clearSkybox(),this.updateImage(n.variant.params,r)):"horizontalGradient"===n.variant.name?(this.clearSkybox(),this.clearImage(),this.updateGradient(n.variant.params.topColor,n.variant.params.bottomColor,n.variant.params.ratio,n.variant.name,"viewport"===n.variant.params.coverage),r?.(!1)):"radialGradient"===n.variant.name&&(this.clearSkybox(),this.clearImage(),this.updateGradient(n.variant.params.centerColor,n.variant.params.edgeColor,n.variant.params.ratio,n.variant.name,"viewport"===n.variant.params.coverage),r?.(!1));const{x:i,y:o,width:s,height:a}=t.viewport;k.update(this.renderable.values.uViewport,nn.set(this.renderable.values.uViewport.ref.value,i,o,s,a))}isEnabled(t){return!!(this.skybox&&this.skybox.loaded||this.image&&this.image.loaded||"horizontalGradient"===t.variant.name||"radialGradient"===t.variant.name)}isReady(){return!!(this.skybox&&this.skybox.loaded||this.image&&this.image.loaded||"horizontalGradient"===this.renderable.values.dVariant.ref.value||"radialGradient"===this.renderable.values.dVariant.ref.value)}render(){this.isReady()&&("image"===this.renderable.values.dVariant.ref.value&&this.updateImageScaling(),lt&&this.webgl.timer.mark("BackgroundPass.render"),this.renderable.render(),lt&&this.webgl.timer.markEnd("BackgroundPass.render"))}dispose(){this.clearSkybox(),this.clearImage()}}const mue="background-skybox";function gue(e){var t,n,r,i,o,s;return"urls"===e.name?`${mue}_${e.params.nx}|${e.params.ny}|${e.params.nz}|${e.params.px}|${e.params.py}|${e.params.pz}`:`${mue}_${null===(t=e.params.nx)||void 0===t?void 0:t.id}|${null===(n=e.params.ny)||void 0===n?void 0:n.id}|${null===(r=e.params.nz)||void 0===r?void 0:r.id}|${null===(i=e.params.px)||void 0===i?void 0:i.id}|${null===(o=e.params.py)||void 0===o?void 0:o.id}|${null===(s=e.params.pz)||void 0===s?void 0:s.id}`}const yue="background-image";function bue(e){var t;return"url"===e.name?`${yue}_${e.params}`:`${yue}_${null===(t=e.params)||void 0===t?void 0:t.id}`}const Unt={drawCount:ri("number"),instanceCount:ri("number"),aPosition:Ar("float32",2,0),tSkybox:jt("texture","rgba","ubyte","linear"),tImage:jt("texture","rgba","ubyte","linear"),uImageScale:xe("v2"),uImageOffset:xe("v2"),uTexSize:xe("v2"),uViewport:xe("v4"),uViewportAdjusted:xe("b"),uViewDirectionProjectionInverse:xe("m4"),uGradientColorA:xe("v3"),uGradientColorB:xe("v3"),uGradientRatio:xe("f"),uBlur:xe("f"),uOpacity:xe("f"),uSaturation:xe("f"),uLightness:xe("f"),dVariant:Ft("string",["skybox","image","verticalGradient","horizontalGradient","radialGradient"])},Vnt=Br("background","\nprecision mediump float;\n\nattribute vec2 aPosition;\n\nvarying vec4 vPosition;\n\nvoid main() {\n vPosition = vec4(aPosition, 1.0, 1.0);\n gl_Position = vec4(aPosition, 1.0, 1.0);\n}\n","\nprecision mediump float;\nprecision mediump samplerCube;\nprecision mediump sampler2D;\n\n#if defined(dVariant_skybox)\n uniform samplerCube tSkybox;\n uniform mat4 uViewDirectionProjectionInverse;\n uniform float uBlur;\n uniform float uOpacity;\n uniform float uSaturation;\n uniform float uLightness;\n#elif defined(dVariant_image)\n uniform sampler2D tImage;\n uniform vec2 uImageScale;\n uniform vec2 uImageOffset;\n uniform float uBlur;\n uniform float uOpacity;\n uniform float uSaturation;\n uniform float uLightness;\n#elif defined(dVariant_horizontalGradient) || defined(dVariant_radialGradient)\n uniform vec3 uGradientColorA;\n uniform vec3 uGradientColorB;\n uniform float uGradientRatio;\n#endif\n\nuniform vec2 uTexSize;\nuniform vec4 uViewport;\nuniform bool uViewportAdjusted;\nvarying vec4 vPosition;\n\n// TODO: add as general pp option to remove banding?\n// Iestyn's RGB dither from http://alex.vlachos.com/graphics/Alex_Vlachos_Advanced_VR_Rendering_GDC2015.pdf\nvec3 ScreenSpaceDither(vec2 vScreenPos) {\n vec3 vDither = vec3(dot(vec2(171.0, 231.0), vScreenPos.xy));\n vDither.rgb = fract(vDither.rgb / vec3(103.0, 71.0, 97.0));\n return vDither.rgb / 255.0;\n}\n\nvec3 saturateColor(vec3 c, float amount) {\n // https://www.w3.org/TR/WCAG21/#dfn-relative-luminance\n const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n vec3 intensity = vec3(dot(c, W));\n return mix(intensity, c, 1.0 + amount);\n}\n\nvec3 lightenColor(vec3 c, float amount) {\n return c + amount;\n}\n\nvoid main() {\n #if defined(dVariant_skybox)\n vec4 t = uViewDirectionProjectionInverse * vPosition;\n #ifdef enabledShaderTextureLod\n gl_FragColor = textureCubeLodEXT(tSkybox, normalize(t.xyz / t.w), uBlur * 8.0);\n #else\n gl_FragColor = textureCube(tSkybox, normalize(t.xyz / t.w));\n #endif\n gl_FragColor.a = uOpacity;\n gl_FragColor.rgb = lightenColor(saturateColor(gl_FragColor.rgb, uSaturation), uLightness);\n #elif defined(dVariant_image)\n vec2 coords;\n if (uViewportAdjusted) {\n coords = ((gl_FragCoord.xy - uViewport.xy) * (uTexSize / uViewport.zw) / uImageScale) + uImageOffset;\n } else {\n coords = (gl_FragCoord.xy / uImageScale) + uImageOffset;\n }\n #ifdef enabledShaderTextureLod\n gl_FragColor = texture2DLodEXT(tImage, vec2(coords.x, 1.0 - coords.y), uBlur * 8.0);\n #else\n gl_FragColor = texture2D(tImage, vec2(coords.x, 1.0 - coords.y));\n #endif\n gl_FragColor.a = uOpacity;\n gl_FragColor.rgb = lightenColor(saturateColor(gl_FragColor.rgb, uSaturation), uLightness);\n #elif defined(dVariant_horizontalGradient)\n float d;\n if (uViewportAdjusted) {\n d = ((gl_FragCoord.y - uViewport.y) * (uTexSize.y / uViewport.w) / uTexSize.y) + 1.0 - (uGradientRatio * 2.0);\n } else {\n d = (gl_FragCoord.y / uTexSize.y) + 1.0 - (uGradientRatio * 2.0);\n }\n gl_FragColor = vec4(mix(uGradientColorB, uGradientColorA, clamp(d, 0.0, 1.0)), 1.0);\n gl_FragColor.rgb += ScreenSpaceDither(gl_FragCoord.xy);\n #elif defined(dVariant_radialGradient)\n float d;\n if (uViewportAdjusted) {\n d = distance(vec2(0.5), (gl_FragCoord.xy - uViewport.xy) * (uTexSize / uViewport.zw) / uTexSize) + uGradientRatio - 0.5;\n } else {\n d = distance(vec2(0.5), gl_FragCoord.xy / uTexSize) + uGradientRatio - 0.5;\n }\n gl_FragColor = vec4(mix(uGradientColorB, uGradientColorA, 1.0 - clamp(d, 0.0, 1.0)), 1.0);\n gl_FragColor.rgb += ScreenSpaceDither(gl_FragCoord.xy);\n #endif\n}\n",{shaderTextureLod:"optional"}),Hnt={sharpness:C.Numeric(.5,{min:0,max:1,step:.05}),denoise:C.Boolean(!0)};class qnt{constructor(t,n){this.webgl=t,this.renderable=function Ynt(e,t){const n=t.getWidth(),r=t.getHeight(),i={..._o,tColor:k.create(t),uTexSizeInv:k.create(Me.create(1/n,1/r)),uSharpness:k.create(.5),dDenoise:k.create(!0)},o={...Wnt};return ji(zi(e,"triangles",$nt,o,i),i)}(t,n)}updateState(t){const{gl:n,state:r}=this.webgl;r.enable(n.SCISSOR_TEST),r.disable(n.BLEND),r.disable(n.DEPTH_TEST),r.depthMask(!1);const{x:i,y:o,width:s,height:a}=t;r.viewport(i,o,s,a),r.scissor(i,o,s,a),r.clearColor(0,0,0,1),n.clear(n.COLOR_BUFFER_BIT)}setSize(t,n){k.update(this.renderable.values.uTexSizeInv,Me.set(this.renderable.values.uTexSizeInv.ref.value,1/t,1/n))}update(t,n){const{values:r}=this.renderable,{sharpness:i,denoise:o}=n;let s=!1;r.tColor.ref.value!==t&&(k.update(this.renderable.values.tColor,t),s=!0),k.updateIfChanged(r.uSharpness,2-2*Math.pow(i,.25)),r.dDenoise.ref.value!==o&&(s=!0),k.updateIfChanged(r.dDenoise,o),s&&this.renderable.update()}render(t,n){lt&&this.webgl.timer.mark("CasPass.render"),n?n.bind():this.webgl.unbindFramebuffer(),this.updateState(t),this.renderable.render(),lt&&this.webgl.timer.markEnd("CasPass.render")}}const Wnt={...vo,tColor:jt("texture","rgba","ubyte","linear"),uTexSizeInv:xe("v2"),uSharpness:xe("f"),dDenoise:Ft("boolean")},$nt=Br("cas",ps,"\nprecision mediump float;\nprecision mediump sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\nuniform float uSharpness;\n\n// adapted from https://www.shadertoy.com/view/stXSWB\n\n/*\n* FidelityFX Super Resolution scales up a low resolution\n* image, while adding fine detail.\n*\n* MIT Open License\n*\n* https://gpuopen.com/fsr\n*\n* Left: FSR processed\n* Right: Original texture, bilinear interpolation\n*\n* Mouse at top: Sharpness 0 stops (maximum)\n* Mouse at bottom: Sharpness 2 stops (minimum)\n*\n* It works in two passes-\n* EASU upsamples the image with a clamped Lanczos kernel.\n* RCAS sharpens the image at the target resolution.\n*\n* I needed to make a few changes to improve readability and\n* WebGL compatibility in an algorithm I don't fully understand.\n* Expect bugs.\n*\n* Shader not currently running for WebGL1 targets (eg. mobile Safari)\n*\n* There is kind of no point to using FSR in Shadertoy, as it renders buffers\n* at full target resolution. But this might be useful for WebGL based demos\n* running smaller-than-target render buffers.\n*\n* For sharpening with a full resolution render buffer,\n* FidelityFX CAS is a better option.\n* https://www.shadertoy.com/view/ftsXzM\n*\n* For readability and compatibility, these optimisations have been removed:\n* * Fast approximate inverse and inversesqrt\n* * textureGather fetches (not WebGL compatible)\n* * Multiplying by reciprocal instead of division\n*\n* Apologies to AMD for the numerous slowdowns and errors I have introduced.\n*\n*/\n\n/***** RCAS *****/\n#define FSR_RCAS_LIMIT (0.25-(1.0/16.0))\n\n// Input callback prototypes that need to be implemented by calling shader\nvec4 FsrRcasLoadF(vec2 p);\n//------------------------------------------------------------------------------------------------------------------------------\nvoid FsrRcasCon(\n out float con,\n // The scale is {0.0 := maximum, to N>0, where N is the number of stops (halving) of the reduction of sharpness}.\n float sharpness\n) {\n // Transform from stops to linear value.\n con = exp2(-sharpness);\n}\n\nvec3 FsrRcasF(\n vec2 ip, // Integer pixel position in output.\n float con\n) {\n // Constant generated by RcasSetup().\n // Algorithm uses minimal 3x3 pixel neighborhood.\n // b\n // d e f\n // h\n vec2 sp = vec2(ip);\n vec3 b = FsrRcasLoadF(sp + vec2( 0,-1)).rgb;\n vec3 d = FsrRcasLoadF(sp + vec2(-1, 0)).rgb;\n vec3 e = FsrRcasLoadF(sp).rgb;\n vec3 f = FsrRcasLoadF(sp + vec2( 1, 0)).rgb;\n vec3 h = FsrRcasLoadF(sp + vec2( 0, 1)).rgb;\n\n // Luma times 2.\n float bL = b.g + .5 * (b.b + b.r);\n float dL = d.g + .5 * (d.b + d.r);\n float eL = e.g + .5 * (e.b + e.r);\n float fL = f.g + .5 * (f.b + f.r);\n float hL = h.g + .5 * (h.b + h.r);\n\n // Noise detection.\n #ifdef dDenoise\n float nz = .25 * (bL + dL + fL + hL) - eL;\n nz=clamp(\n abs(nz)\n /(\n max(max(bL,dL),max(eL,max(fL,hL)))\n -min(min(bL,dL),min(eL,min(fL,hL)))\n ),\n 0., 1.\n );\n nz=1.-.5*nz;\n #endif\n\n // Min and max of ring.\n vec3 mn4 = min(b, min(f, h));\n vec3 mx4 = max(b, max(f, h));\n\n // Immediate constants for peak range.\n vec2 peakC = vec2(1., -4.);\n\n // Limiters, these need to be high precision RCPs.\n vec3 hitMin = mn4 / (4. * mx4);\n vec3 hitMax = (peakC.x - mx4) / (4.* mn4 + peakC.y);\n vec3 lobeRGB = max(-hitMin, hitMax);\n float lobe = max(\n -FSR_RCAS_LIMIT,\n min(max(lobeRGB.r, max(lobeRGB.g, lobeRGB.b)), 0.)\n )*con;\n\n // Apply noise removal.\n #ifdef dDenoise\n lobe *= nz;\n #endif\n\n // Resolve, which needs the medium precision rcp approximation to avoid visible tonality changes.\n return (lobe * (b + d + h + f) + e) / (4. * lobe + 1.);\n}\n\n\nvec4 FsrRcasLoadF(vec2 p) {\n return texture2D(tColor, p * uTexSizeInv);\n}\n\nvoid main() {\n // Set up constants\n float con;\n FsrRcasCon(con, uSharpness);\n\n // Perform RCAS pass\n vec3 col = FsrRcasF(gl_FragCoord.xy, con);\n\n gl_FragColor = vec4(col, FsrRcasLoadF(gl_FragCoord.xy).a);\n}\n"),Xnt={...vo,tDepthOpaque:jt("texture","rgba","ubyte","nearest"),tDepthTransparent:jt("texture","rgba","ubyte","nearest"),uTexSize:xe("v2"),dOrthographic:Ft("number"),uNear:xe("f"),uFar:xe("f"),uInvProjection:xe("m4"),uOutlineThreshold:xe("f"),dTransparentOutline:Ft("boolean")},Znt={...vo,tDepth:jt("texture","rgba","ubyte","nearest"),uTexSize:xe("v2"),uProjection:xe("m4"),uInvProjection:xe("m4"),uBounds:xe("v4"),dOrthographic:Ft("number"),uNear:xe("f"),uFar:xe("f"),dSteps:Ft("number"),uMaxDistance:xe("f"),uTolerance:xe("f"),uBias:xe("f"),uLightDirection:xe("v3[]"),uLightColor:xe("v3[]"),dLightCount:Ft("number")},Jnt={...vo,tDepth:jt("texture","rgba","ubyte","nearest"),tDepthHalf:jt("texture","rgba","ubyte","nearest"),tDepthQuarter:jt("texture","rgba","ubyte","nearest"),uSamples:xe("v3[]"),dNSamples:Ft("number"),uProjection:xe("m4"),uInvProjection:xe("m4"),uBounds:xe("v4"),uTexSize:xe("v2"),uRadius:xe("f"),uBias:xe("f"),dMultiScale:Ft("boolean"),dLevels:Ft("number"),uLevelRadius:xe("f[]"),uLevelBias:xe("f[]"),uNearThreshold:xe("f"),uFarThreshold:xe("f")},trt={...vo,tSsaoDepth:jt("texture","rgba","ubyte","nearest"),uTexSize:xe("v2"),uKernel:xe("f[]"),dOcclusionKernelSize:Ft("number"),uBlurDirectionX:xe("f"),uBlurDirectionY:xe("f"),uInvProjection:xe("m4"),uNear:xe("f"),uFar:xe("f"),uBounds:xe("v4"),dOrthographic:Ft("number")};function vue(e,t,n){const r={..._o,tSsaoDepth:k.create(t),uTexSize:k.create(Me.create(t.getWidth(),t.getHeight())),uKernel:k.create(_ue(15)),dOcclusionKernelSize:k.create(15),uBlurDirectionX:k.create("horizontal"===n?1:0),uBlurDirectionY:k.create("vertical"===n?1:0),uInvProjection:k.create(le.identity()),uNear:k.create(0),uFar:k.create(1e4),uBounds:k.create(nn()),dOrthographic:k.create(0)},i={...trt};return ji(zi(e,"triangles",Br("ssao_blur",ps,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tSsaoDepth;\nuniform vec2 uTexSize;\nuniform vec4 uBounds;\n\nuniform float uKernel[dOcclusionKernelSize];\n\nuniform float uBlurDirectionX;\nuniform float uBlurDirectionY;\n\nuniform mat4 uInvProjection;\nuniform float uNear;\nuniform float uFar;\n\n#include common\n\nfloat getViewZ(const in float depth) {\n #if dOrthographic == 1\n return orthographicDepthToViewZ(depth, uNear, uFar);\n #else\n return perspectiveDepthToViewZ(depth, uNear, uFar);\n #endif\n}\n\nbool isBackground(const in float depth) {\n return depth == 1.0;\n}\n\nbool outsideBounds(const in vec2 p) {\n return p.x < uBounds.x || p.y < uBounds.y || p.x > uBounds.z || p.y > uBounds.w;\n}\n\nfloat getPixelSize(const in vec2 coords, const in float depth) {\n vec3 viewPos0 = screenSpaceToViewSpace(vec3(coords, depth), uInvProjection);\n vec3 viewPos1 = screenSpaceToViewSpace(vec3(coords + vec2(1.0, 0.0) / uTexSize, depth), uInvProjection);\n return distance(viewPos0, viewPos1);\n}\n\nvoid main(void) {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n\n vec2 packedDepth = texture2D(tSsaoDepth, coords).zw;\n\n if (outsideBounds(coords)) {\n gl_FragColor = vec4(packUnitIntervalToRG(1.0), packedDepth);\n return;\n }\n\n float selfDepth = unpackRGToUnitInterval(packedDepth);\n // if background and if second pass\n if (isBackground(selfDepth) && uBlurDirectionY != 0.0) {\n gl_FragColor = vec4(packUnitIntervalToRG(1.0), packedDepth);\n return;\n }\n\n float selfViewZ = getViewZ(selfDepth);\n float pixelSize = getPixelSize(coords, selfDepth);\n float maxDiffViewZ = pixelSize * 10.0;\n\n vec2 offset = vec2(uBlurDirectionX, uBlurDirectionY) / uTexSize;\n\n float sum = 0.0;\n float kernelSum = 0.0;\n // only if kernelSize is odd\n for (int i = -dOcclusionKernelSize / 2; i <= dOcclusionKernelSize / 2; i++) {\n if (abs(float(i)) > 1.0 && abs(float(i)) * pixelSize > 0.8) continue;\n\n vec2 sampleCoords = coords + float(i) * offset;\n if (outsideBounds(sampleCoords)) {\n continue;\n }\n\n vec4 sampleSsaoDepth = texture2D(tSsaoDepth, sampleCoords);\n\n float sampleDepth = unpackRGToUnitInterval(sampleSsaoDepth.zw);\n if (isBackground(sampleDepth)) {\n continue;\n }\n\n if (abs(float(i)) > 1.0) {\n float sampleViewZ = getViewZ(sampleDepth);\n if (abs(selfViewZ - sampleViewZ) > maxDiffViewZ) {\n continue;\n }\n }\n\n float kernel = uKernel[int(abs(float(i)))]; // abs is not defined for int in webgl1\n float sampleValue = unpackRGToUnitInterval(sampleSsaoDepth.xy);\n\n sum += kernel * sampleValue;\n kernelSum += kernel;\n }\n\n gl_FragColor = vec4(packUnitIntervalToRG(sum / kernelSum), packedDepth);\n}\n"),i,r),r)}function _ue(e){const t=e/3,n=Math.floor((e+1)/2),r=[];for(let i=0;i`${e.radius}, ${e.bias}`,{defaultValue:[{radius:2,bias:1},{radius:5,bias:1},{radius:8,bias:1},{radius:11,bias:1}]}),nearThreshold:C.Numeric(10,{min:0,max:50,step:1}),farThreshold:C.Numeric(1500,{min:0,max:1e4,step:100})}),off:C.Group({})},{cycle:!0}),radius:C.Numeric(5,{min:0,max:20,step:.1},{description:"Final occlusion radius is 2^x",hideIf:e=>"on"===e?.multiScale.name}),bias:C.Numeric(.8,{min:0,max:3,step:.1}),blurKernelSize:C.Numeric(15,{min:1,max:25,step:2}),resolutionScale:C.Numeric(1,{min:.1,max:1,step:.05},{description:"Adjust resolution of occlusion calculation"}),color:C.Color(st(0))}),off:C.Group({})},{cycle:!0,description:"Darken occluded crevices with the ambient occlusion effect"}),shadow:C.MappedStatic("off",{on:C.Group({steps:C.Numeric(1,{min:1,max:64,step:1}),bias:C.Numeric(.6,{min:0,max:1,step:.01}),maxDistance:C.Numeric(3,{min:0,max:256,step:1}),tolerance:C.Numeric(1,{min:0,max:10,step:.1})}),off:C.Group({})},{cycle:!0,description:"Simplistic shadows"}),outline:C.MappedStatic("off",{on:C.Group({scale:C.Numeric(1,{min:1,max:5,step:1}),threshold:C.Numeric(.33,{min:.01,max:1,step:.01}),color:C.Color(st(0)),includeTransparent:C.Boolean(!0,{description:"Whether to show outline for transparent objects"})}),off:C.Group({})},{cycle:!0,description:"Draw outline around 3D objects"}),antialiasing:C.MappedStatic("smaa",{fxaa:C.Group(tnt),smaa:C.Group(fnt),off:C.Group({})},{options:[["fxaa","FXAA"],["smaa","SMAA"],["off","Off"]],description:"Smooth pixel edges"}),sharpening:C.MappedStatic("off",{on:C.Group(Hnt),off:C.Group({})},{cycle:!0,description:"Contrast Adaptive Sharpening"}),background:C.Group(Mnt,{isFlat:!0})};class uc{static isEnabled(t){return"on"===t.occlusion.name||"on"===t.shadow.name||"on"===t.outline.name||"off"!==t.background.variant.name}static isTransparentOutlineEnabled(t){return"on"===t.outline.name&&t.outline.params.includeTransparent}calcSsaoScale(t){return Math.min(1,1/this.webgl.pixelRatio)*t}constructor(t,n,r){this.webgl=t,this.drawPass=r,this.bgColor=v(),this.occlusionOffset=[0,0],this.transparentBackground=!1;const{colorTarget:i,depthTextureTransparent:o,depthTextureOpaque:s}=r,a=i.getWidth(),c=i.getHeight();this.nSamples=1,this.blurKernelSize=1,this.ssaoScale=this.calcSsaoScale(1),this.levels=[],this.target=t.createRenderTarget(a,c,!1,"uint8","linear"),this.outlinesTarget=t.createRenderTarget(a,c,!1),this.outlinesRenderable=function Knt(e,t,n,r){const i=t.getWidth(),o=t.getHeight(),s={..._o,tDepthOpaque:k.create(t),tDepthTransparent:k.create(n),uTexSize:k.create(Me.create(i,o)),dOrthographic:k.create(0),uNear:k.create(1),uFar:k.create(1e4),uInvProjection:k.create(le.identity()),uOutlineThreshold:k.create(.33),dTransparentOutline:k.create(r)},a={...Xnt};return ji(zi(e,"triangles",Br("outlines",ps,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tDepthOpaque;\nuniform sampler2D tDepthTransparent;\nuniform vec2 uTexSize;\n\nuniform float uNear;\nuniform float uFar;\nuniform mat4 uInvProjection;\n\nuniform float uOutlineThreshold;\n\n#include common\n\nfloat getViewZ(const in float depth) {\n #if dOrthographic == 1\n return orthographicDepthToViewZ(depth, uNear, uFar);\n #else\n return perspectiveDepthToViewZ(depth, uNear, uFar);\n #endif\n}\n\nfloat getDepthOpaque(const in vec2 coords) {\n #ifdef depthTextureSupport\n return texture2D(tDepthOpaque, coords).r;\n #else\n return unpackRGBAToDepth(texture2D(tDepthOpaque, coords));\n #endif\n}\n\nfloat getDepthTransparent(const in vec2 coords) {\n #ifdef dTransparentOutline\n return unpackRGBAToDepth(texture2D(tDepthTransparent, coords));\n #else\n return 1.0;\n #endif\n}\n\nbool isBackground(const in float depth) {\n return depth == 1.0;\n}\n\nfloat getPixelSize(const in vec2 coords, const in float depth) {\n vec3 viewPos0 = screenSpaceToViewSpace(vec3(coords, depth), uInvProjection);\n vec3 viewPos1 = screenSpaceToViewSpace(vec3(coords + vec2(1.0, 0.0) / uTexSize, depth), uInvProjection);\n return distance(viewPos0, viewPos1);\n}\n\nvoid main(void) {\n float backgroundViewZ = 2.0 * uFar;\n\n vec2 coords = gl_FragCoord.xy / uTexSize;\n vec2 invTexSize = 1.0 / uTexSize;\n\n float selfDepthOpaque = getDepthOpaque(coords);\n float selfViewZOpaque = isBackground(selfDepthOpaque) ? backgroundViewZ : getViewZ(selfDepthOpaque);\n float pixelSizeOpaque = getPixelSize(coords, selfDepthOpaque) * uOutlineThreshold;\n\n float selfDepthTransparent = getDepthTransparent(coords);\n float selfViewZTransparent = isBackground(selfDepthTransparent) ? backgroundViewZ : getViewZ(selfDepthTransparent);\n float pixelSizeTransparent = getPixelSize(coords, selfDepthTransparent) * uOutlineThreshold;\n\n float outline = 1.0;\n float bestDepth = 1.0;\n float transparentFlag = 0.0;\n\n for (int y = -1; y <= 1; y++) {\n for (int x = -1; x <= 1; x++) {\n vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;\n\n float sampleDepthOpaque = getDepthOpaque(sampleCoords);\n float sampleDepthTransparent = getDepthTransparent(sampleCoords);\n\n float sampleViewZOpaque = isBackground(sampleDepthOpaque) ? backgroundViewZ : getViewZ(sampleDepthOpaque);\n if (abs(selfViewZOpaque - sampleViewZOpaque) > pixelSizeOpaque && selfDepthOpaque > sampleDepthOpaque && sampleDepthOpaque <= bestDepth) {\n outline = 0.0;\n bestDepth = sampleDepthOpaque;\n }\n\n if (sampleDepthTransparent < sampleDepthOpaque) {\n float sampleViewZTransparent = isBackground(sampleDepthTransparent) ? backgroundViewZ : getViewZ(sampleDepthTransparent);\n if (abs(selfViewZTransparent - sampleViewZTransparent) > pixelSizeTransparent && selfDepthTransparent > sampleDepthTransparent && sampleDepthTransparent <= bestDepth) {\n outline = 0.0;\n bestDepth = sampleDepthTransparent;\n transparentFlag = 1.0;\n }\n }\n }\n }\n\n gl_FragColor = vec4(outline, packUnitIntervalToRG(bestDepth), transparentFlag);\n}\n"),a,s),s)}(t,s,o,!0),this.shadowsTarget=t.createRenderTarget(a,c,!1),this.shadowsRenderable=function Qnt(e,t){const n=t.getWidth(),r=t.getHeight(),i={..._o,tDepth:k.create(t),uTexSize:k.create(Me.create(n,r)),uProjection:k.create(le.identity()),uInvProjection:k.create(le.identity()),uBounds:k.create(nn()),dOrthographic:k.create(0),uNear:k.create(1),uFar:k.create(1e4),dSteps:k.create(1),uMaxDistance:k.create(3),uTolerance:k.create(1),uBias:k.create(.6),uLightDirection:k.create([]),uLightColor:k.create([]),dLightCount:k.create(0)},o={...Znt};return ji(zi(e,"triangles",Br("shadows",ps,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n\nuniform sampler2D tDepth;\nuniform vec2 uTexSize;\nuniform vec4 uBounds;\n\nuniform float uNear;\nuniform float uFar;\n\n#if dLightCount != 0\n uniform vec3 uLightDirection[dLightCount];\n uniform vec3 uLightColor[dLightCount];\n#endif\n\nuniform mat4 uProjection;\nuniform mat4 uInvProjection;\n\nuniform float uMaxDistance;\nuniform float uTolerance;\nuniform float uBias;\n\nbool isBackground(const in float depth) {\n return depth == 1.0;\n}\n\nbool outsideBounds(const in vec2 p) {\n return p.x < uBounds.x || p.y < uBounds.y || p.x > uBounds.z || p.y > uBounds.w;\n}\n\nfloat getViewZ(const in float depth) {\n #if dOrthographic == 1\n return orthographicDepthToViewZ(depth, uNear, uFar);\n #else\n return perspectiveDepthToViewZ(depth, uNear, uFar);\n #endif\n}\n\nfloat getDepth(const in vec2 coords) {\n #ifdef depthTextureSupport\n return texture2D(tDepth, coords).r;\n #else\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n #endif\n}\n\nfloat screenFade(const in vec2 coords) {\n vec2 c = (coords - uBounds.xy) / (uBounds.zw - uBounds.xy);\n vec2 fade = max(12.0 * abs(c - 0.5) - 5.0, vec2(0.0));\n return saturate(1.0 - dot(fade, fade));\n}\n\n// based on https://panoskarabelas.com/posts/screen_space_shadows/\nfloat screenSpaceShadow(const in vec3 position, const in vec3 lightDirection, const in float stepLength) {\n // Ray position and direction (in view-space)\n vec3 rayPos = position;\n vec3 rayDir = -lightDirection;\n\n // Compute ray step\n vec3 rayStep = rayDir * stepLength;\n\n // Ray march towards the light\n float occlusion = 0.0;\n vec4 rayCoords = vec4(0.0);\n for (int i = 0; i < dSteps; ++i) {\n // Step the ray\n rayPos += rayStep;\n\n rayCoords = uProjection * vec4(rayPos, 1.0);\n rayCoords.xyz = (rayCoords.xyz / rayCoords.w) * 0.5 + 0.5;\n\n if (outsideBounds(rayCoords.xy))\n return 1.0;\n\n // Compute the difference between the ray's and the camera's depth\n float depth = getDepth(rayCoords.xy);\n float viewZ = getViewZ(depth);\n float zDelta = rayPos.z - viewZ;\n\n if (zDelta < uTolerance) {\n occlusion = 1.0;\n\n // Fade out as we approach the edges of the screen\n occlusion *= screenFade(rayCoords.xy);\n\n break;\n }\n }\n\n return 1.0 - (uBias * occlusion);\n}\n\nvoid main(void) {\n vec2 invTexSize = 1.0 / uTexSize;\n vec2 selfCoords = gl_FragCoord.xy * invTexSize;\n\n float selfDepth = getDepth(selfCoords);\n\n if (isBackground(selfDepth)) {\n gl_FragColor = vec4(0.0);\n return;\n }\n\n vec3 selfViewPos = screenSpaceToViewSpace(vec3(selfCoords, selfDepth), uInvProjection);\n float stepLength = uMaxDistance / float(dSteps);\n\n float o = 1.0;\n #if dLightCount != 0\n float sh[dLightCount];\n #pragma unroll_loop_start\n for (int i = 0; i < dLightCount; ++i) {\n sh[i] = screenSpaceShadow(selfViewPos, uLightDirection[i], stepLength);\n o = min(o, sh[i]);\n }\n #pragma unroll_loop_end\n #endif\n\n gl_FragColor = vec4(o);\n}\n"),o,i),i)}(t,s),this.ssaoFramebuffer=t.resources.framebuffer(),this.ssaoBlurFirstPassFramebuffer=t.resources.framebuffer(),this.ssaoBlurSecondPassFramebuffer=t.resources.framebuffer();const u=Math.floor(a*this.ssaoScale),l=Math.floor(c*this.ssaoScale),d=Math.max(1,Math.floor(.5*u)),f=Math.max(1,Math.floor(.5*l)),p=Math.max(1,Math.floor(.25*u)),m=Math.max(1,Math.floor(.25*l));this.downsampledDepthTarget=r.packedDepth?t.createRenderTarget(u,l,!1,"uint8","linear","rgba"):t.createRenderTarget(u,l,!1,"float32","linear",t.isWebGL2?"alpha":"rgba"),this.downsampleDepthRenderable=Tv(t,s);const h=1===this.ssaoScale?s:this.downsampledDepthTarget.texture;this.depthHalfTarget=r.packedDepth?t.createRenderTarget(d,f,!1,"uint8","linear","rgba"):t.createRenderTarget(d,f,!1,"float32","linear",t.isWebGL2?"alpha":"rgba"),this.depthHalfRenderable=Tv(t,h),this.depthQuarterTarget=r.packedDepth?t.createRenderTarget(p,m,!1,"uint8","linear","rgba"):t.createRenderTarget(p,m,!1,"float32","linear",t.isWebGL2?"alpha":"rgba"),this.depthQuarterRenderable=Tv(t,this.depthHalfTarget.texture),this.ssaoDepthTexture=t.resources.texture("image-uint8","rgba","ubyte","linear"),this.ssaoDepthTexture.define(u,l),this.ssaoDepthTexture.attachFramebuffer(this.ssaoFramebuffer,"color0"),this.ssaoDepthBlurProxyTexture=t.resources.texture("image-uint8","rgba","ubyte","linear"),this.ssaoDepthBlurProxyTexture.define(u,l),this.ssaoDepthBlurProxyTexture.attachFramebuffer(this.ssaoBlurFirstPassFramebuffer,"color0"),this.ssaoDepthTexture.attachFramebuffer(this.ssaoBlurSecondPassFramebuffer,"color0"),this.ssaoRenderable=function ert(e,t,n,r){const i={..._o,tDepth:k.create(t),tDepthHalf:k.create(n),tDepthQuarter:k.create(r),uSamples:k.create(xue(32)),dNSamples:k.create(32),uProjection:k.create(le.identity()),uInvProjection:k.create(le.identity()),uBounds:k.create(nn()),uTexSize:k.create(Me.create(e.gl.drawingBufferWidth,e.gl.drawingBufferHeight)),uRadius:k.create(Math.pow(2,5)),uBias:k.create(.8),dMultiScale:k.create(!1),dLevels:k.create(3),uLevelRadius:k.create([Math.pow(2,2),Math.pow(2,5),Math.pow(2,8)]),uLevelBias:k.create([.8,.8,.8]),uNearThreshold:k.create(10),uFarThreshold:k.create(1500)},o={...Jnt};return ji(zi(e,"triangles",Br("ssao",ps,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n\nuniform sampler2D tDepth;\nuniform sampler2D tDepthHalf;\nuniform sampler2D tDepthQuarter;\nuniform vec2 uTexSize;\nuniform vec4 uBounds;\n\nuniform vec3 uSamples[dNSamples];\n\nuniform mat4 uProjection;\nuniform mat4 uInvProjection;\n\n#ifdef dMultiScale\n uniform float uLevelRadius[dLevels];\n uniform float uLevelBias[dLevels];\n uniform float uNearThreshold;\n uniform float uFarThreshold;\n#else\n uniform float uRadius;\n#endif\nuniform float uBias;\n\nfloat smootherstep(float edge0, float edge1, float x) {\n x = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n return x * x * x * (x * (x * 6.0 - 15.0) + 10.0);\n}\n\nfloat noise(const in vec2 coords) {\n float a = 12.9898;\n float b = 78.233;\n float c = 43758.5453;\n float dt = dot(coords, vec2(a,b));\n float sn = mod(dt, PI);\n return abs(fract(sin(sn) * c)); // is abs necessary?\n}\n\nvec2 getNoiseVec2(const in vec2 coords) {\n return vec2(noise(coords), noise(coords + vec2(PI, 2.71828)));\n}\n\nbool isBackground(const in float depth) {\n return depth == 1.0;\n}\n\nfloat getDepth(const in vec2 coords) {\n vec2 c = vec2(clamp(coords.x, uBounds.x, uBounds.z), clamp(coords.y, uBounds.y, uBounds.w));\n #ifdef depthTextureSupport\n return texture2D(tDepth, c).r;\n #else\n return unpackRGBAToDepth(texture2D(tDepth, c));\n #endif\n}\n\n#define dQuarterThreshold 0.1\n#define dHalfThreshold 0.05\n\nfloat getMappedDepth(const in vec2 coords, const in vec2 selfCoords) {\n vec2 c = vec2(clamp(coords.x, uBounds.x, uBounds.z), clamp(coords.y, uBounds.y, uBounds.w));\n float d = distance(coords, selfCoords);\n #ifdef depthTextureSupport\n if (d > dQuarterThreshold) {\n return texture2D(tDepthQuarter, c).r;\n } else if (d > dHalfThreshold) {\n return texture2D(tDepthHalf, c).r;\n } else {\n return texture2D(tDepth, c).r;\n }\n #else\n if (d > dQuarterThreshold) {\n return unpackRGBAToDepth(texture2D(tDepthQuarter, c));\n } else if (d > dHalfThreshold) {\n return unpackRGBAToDepth(texture2D(tDepthHalf, c));\n } else {\n return unpackRGBAToDepth(texture2D(tDepth, c));\n }\n #endif\n}\n\nvec3 normalFromDepth(const in float depth, const in float depth1, const in float depth2, vec2 offset1, vec2 offset2) {\n vec3 p1 = vec3(offset1, depth1 - depth);\n vec3 p2 = vec3(offset2, depth2 - depth);\n\n vec3 normal = cross(p1, p2);\n normal.z = -normal.z;\n\n return normalize(normal);\n}\n\nfloat getPixelSize(const in vec2 coords, const in float depth) {\n vec3 viewPos0 = screenSpaceToViewSpace(vec3(coords, depth), uInvProjection);\n vec3 viewPos1 = screenSpaceToViewSpace(vec3(coords + vec2(1.0, 0.0) / uTexSize, depth), uInvProjection);\n return distance(viewPos0, viewPos1);\n}\n\n// StarCraft II Ambient Occlusion by [Filion and McNaughton 2008]\nvoid main(void) {\n vec2 invTexSize = 1.0 / uTexSize;\n vec2 selfCoords = gl_FragCoord.xy * invTexSize;\n\n float selfDepth = getDepth(selfCoords);\n vec2 selfPackedDepth = packUnitIntervalToRG(selfDepth);\n\n if (isBackground(selfDepth)) {\n gl_FragColor = vec4(packUnitIntervalToRG(1.0), selfPackedDepth);\n return;\n }\n\n vec2 offset1 = vec2(0.0, invTexSize.y);\n vec2 offset2 = vec2(invTexSize.x, 0.0);\n\n float selfDepth1 = getDepth(selfCoords + offset1);\n float selfDepth2 = getDepth(selfCoords + offset2);\n\n vec3 selfViewNormal = normalFromDepth(selfDepth, selfDepth1, selfDepth2, offset1, offset2);\n vec3 selfViewPos = screenSpaceToViewSpace(vec3(selfCoords, selfDepth), uInvProjection);\n\n vec3 randomVec = normalize(vec3(getNoiseVec2(selfCoords) * 2.0 - 1.0, 0.0));\n vec3 tangent = normalize(randomVec - selfViewNormal * dot(randomVec, selfViewNormal));\n vec3 bitangent = cross(selfViewNormal, tangent);\n mat3 TBN = mat3(tangent, bitangent, selfViewNormal);\n\n float occlusion = 0.0;\n #ifdef dMultiScale\n float pixelSize = getPixelSize(selfCoords, selfDepth);\n\n for(int l = 0; l < dLevels; l++) {\n // TODO: smooth transition\n if (pixelSize * uNearThreshold > uLevelRadius[l]) continue;\n if (pixelSize * uFarThreshold < uLevelRadius[l]) continue;\n\n float levelOcclusion = 0.0;\n for(int i = 0; i < dNSamples; i++) {\n vec3 sampleViewPos = TBN * uSamples[i];\n sampleViewPos = selfViewPos + sampleViewPos * uLevelRadius[l];\n\n vec4 offset = vec4(sampleViewPos, 1.0);\n offset = uProjection * offset;\n offset.xyz = (offset.xyz / offset.w) * 0.5 + 0.5;\n\n float sampleDepth = getMappedDepth(offset.xy, selfCoords);\n float sampleViewZ = screenSpaceToViewSpace(vec3(offset.xy, sampleDepth), uInvProjection).z;\n\n levelOcclusion += step(sampleViewPos.z + 0.025, sampleViewZ) * smootherstep(0.0, 1.0, uLevelRadius[l] / abs(selfViewPos.z - sampleViewZ)) * uLevelBias[l];\n }\n occlusion = max(occlusion, levelOcclusion);\n }\n #else\n for(int i = 0; i < dNSamples; i++) {\n vec3 sampleViewPos = TBN * uSamples[i];\n sampleViewPos = selfViewPos + sampleViewPos * uRadius;\n\n vec4 offset = vec4(sampleViewPos, 1.0);\n offset = uProjection * offset;\n offset.xyz = (offset.xyz / offset.w) * 0.5 + 0.5;\n\n float sampleDepth = getMappedDepth(offset.xy, selfCoords);\n float sampleViewZ = screenSpaceToViewSpace(vec3(offset.xy, sampleDepth), uInvProjection).z;\n\n occlusion += step(sampleViewPos.z + 0.025, sampleViewZ) * smootherstep(0.0, 1.0, uRadius / abs(selfViewPos.z - sampleViewZ));\n }\n #endif\n occlusion = 1.0 - (uBias * occlusion / float(dNSamples));\n\n vec2 packedOcclusion = packUnitIntervalToRG(clamp(occlusion, 0.01, 1.0));\n\n gl_FragColor = vec4(packedOcclusion, selfPackedDepth);\n}\n"),o,i),i)}(t,h,this.depthHalfTarget.texture,this.depthQuarterTarget.texture),this.ssaoBlurFirstPassRenderable=vue(t,this.ssaoDepthTexture,"horizontal"),this.ssaoBlurSecondPassRenderable=vue(t,this.ssaoDepthBlurProxyTexture,"vertical"),this.renderable=function rrt(e,t,n,r,i,o,s,a){const c={..._o,tSsaoDepth:k.create(s),tColor:k.create(t),tDepthOpaque:k.create(n),tDepthTransparent:k.create(r),tShadows:k.create(i),tOutlines:k.create(o),uTexSize:k.create(Me.create(t.getWidth(),t.getHeight())),dOrthographic:k.create(0),uNear:k.create(1),uFar:k.create(1e4),uFogNear:k.create(1e4),uFogFar:k.create(1e4),uFogColor:k.create(v.create(1,1,1)),uOutlineColor:k.create(v.create(0,0,0)),uOcclusionColor:k.create(v.create(0,0,0)),uTransparentBackground:k.create(!1),dOcclusionEnable:k.create(!0),uOcclusionOffset:k.create(Me.create(0,0)),dShadowEnable:k.create(!1),dOutlineEnable:k.create(!1),dOutlineScale:k.create(1),dTransparentOutline:k.create(a)},u={...nrt};return ji(zi(e,"triangles",Br("postprocessing",ps,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tSsaoDepth;\nuniform sampler2D tColor;\nuniform sampler2D tDepthOpaque;\nuniform sampler2D tDepthTransparent;\nuniform sampler2D tShadows;\nuniform sampler2D tOutlines;\nuniform vec2 uTexSize;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\nuniform vec3 uOutlineColor;\nuniform vec3 uOcclusionColor;\nuniform bool uTransparentBackground;\nuniform vec2 uOcclusionOffset;\n\n#include common\n\nfloat getViewZ(const in float depth) {\n #if dOrthographic == 1\n return orthographicDepthToViewZ(depth, uNear, uFar);\n #else\n return perspectiveDepthToViewZ(depth, uNear, uFar);\n #endif\n}\n\nfloat getDepthOpaque(const in vec2 coords) {\n #ifdef depthTextureSupport\n return texture2D(tDepthOpaque, coords).r;\n #else\n return unpackRGBAToDepth(texture2D(tDepthOpaque, coords));\n #endif\n}\n\nfloat getDepthTransparent(const in vec2 coords) {\n #ifdef dTransparentOutline\n return unpackRGBAToDepth(texture2D(tDepthTransparent, coords));\n #else\n return 1.0;\n #endif\n}\n\nbool isBackground(const in float depth) {\n return depth == 1.0;\n}\n\nfloat getOutline(const in vec2 coords, const in float opaqueDepth, out float closestTexel) {\n float backgroundViewZ = 2.0 * uFar;\n vec2 invTexSize = 1.0 / uTexSize;\n\n float transparentDepth = getDepthTransparent(coords);\n float opaqueSelfViewZ = isBackground(opaqueDepth) ? backgroundViewZ : getViewZ(opaqueDepth);\n float transparentSelfViewZ = isBackground(transparentDepth) ? backgroundViewZ : getViewZ(transparentDepth);\n float selfDepth = min(opaqueDepth, transparentDepth);\n\n float outline = 1.0;\n closestTexel = 1.0;\n for (int y = -dOutlineScale; y <= dOutlineScale; y++) {\n for (int x = -dOutlineScale; x <= dOutlineScale; x++) {\n if (x * x + y * y > dOutlineScale * dOutlineScale) {\n continue;\n }\n\n vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;\n\n vec4 sampleOutlineCombined = texture2D(tOutlines, sampleCoords);\n float sampleOutline = sampleOutlineCombined.r;\n float sampleOutlineDepth = unpackRGToUnitInterval(sampleOutlineCombined.gb);\n float sampleOutlineViewZ = isBackground(sampleOutlineDepth) ? backgroundViewZ : getViewZ(sampleOutlineDepth);\n\n float selfViewZ = sampleOutlineCombined.a == 0.0 ? opaqueSelfViewZ : transparentSelfViewZ;\n if (sampleOutline == 0.0 && sampleOutlineDepth < closestTexel) {\n outline = 0.0;\n closestTexel = sampleOutlineDepth;\n }\n }\n }\n return closestTexel < opaqueDepth ? outline : 1.0;\n}\n\nfloat getSsao(vec2 coords) {\n float rawSsao = unpackRGToUnitInterval(texture2D(tSsaoDepth, coords).xy);\n if (rawSsao > 0.999) {\n return 1.0;\n } else if (rawSsao > 0.001) {\n return rawSsao;\n }\n // treat values close to 0.0 as errors and return no occlusion\n return 1.0;\n}\n\nvoid main(void) {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n vec4 color = texture2D(tColor, coords);\n\n float viewDist;\n float fogFactor;\n float opaqueDepth = getDepthOpaque(coords);\n\n #ifdef dOcclusionEnable\n if (!isBackground(opaqueDepth)) {\n viewDist = abs(getViewZ(opaqueDepth));\n fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n float occlusionFactor = getSsao(coords + uOcclusionOffset);\n if (!uTransparentBackground) {\n color.rgb = mix(mix(uOcclusionColor, uFogColor, fogFactor), color.rgb, occlusionFactor);\n } else {\n color.rgb = mix(uOcclusionColor * (1.0 - fogFactor), color.rgb, occlusionFactor);\n }\n }\n #endif\n\n #ifdef dShadowEnable\n if (!isBackground(opaqueDepth)) {\n viewDist = abs(getViewZ(opaqueDepth));\n fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n vec4 shadow = texture2D(tShadows, coords);\n if (!uTransparentBackground) {\n color.rgb = mix(mix(vec3(0), uFogColor, fogFactor), color.rgb, shadow.a);\n } else {\n color.rgb = mix(vec3(0) * (1.0 - fogFactor), color.rgb, shadow.a);\n }\n }\n #endif\n\n // outline needs to be handled after occlusion and shadow to keep them clean\n #ifdef dOutlineEnable\n float closestTexel;\n float outline = getOutline(coords, opaqueDepth, closestTexel);\n if (outline == 0.0) {\n viewDist = abs(getViewZ(closestTexel));\n fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n if (!uTransparentBackground) {\n color.rgb = mix(uOutlineColor, uFogColor, fogFactor);\n } else {\n color.a = 1.0 - fogFactor;\n color.rgb = mix(uOutlineColor, color.rgb, fogFactor);\n }\n }\n #endif\n\n gl_FragColor = color;\n}\n"),u,c),c)}(t,i.texture,s,o,this.shadowsTarget.texture,this.outlinesTarget.texture,this.ssaoDepthTexture,!0),this.background=new Rnt(t,n,a,c)}setSize(t,n){const[r,i]=this.renderable.values.uTexSize.ref.value,o=this.calcSsaoScale(1);if(t!==r||n!==i||this.ssaoScale!==o){this.ssaoScale=o,this.target.setSize(t,n),this.outlinesTarget.setSize(t,n),this.shadowsTarget.setSize(t,n);const s=Math.floor(t*this.ssaoScale),a=Math.floor(n*this.ssaoScale);this.downsampledDepthTarget.setSize(s,a),this.ssaoDepthTexture.define(s,a),this.ssaoDepthBlurProxyTexture.define(s,a);const c=Math.max(1,Math.floor(.5*s)),u=Math.max(1,Math.floor(.5*a));this.depthHalfTarget.setSize(c,u);const l=Math.max(1,Math.floor(.25*s)),d=Math.max(1,Math.floor(.25*a));this.depthQuarterTarget.setSize(l,d),k.update(this.renderable.values.uTexSize,Me.set(this.renderable.values.uTexSize.ref.value,t,n)),k.update(this.outlinesRenderable.values.uTexSize,Me.set(this.outlinesRenderable.values.uTexSize.ref.value,t,n)),k.update(this.shadowsRenderable.values.uTexSize,Me.set(this.shadowsRenderable.values.uTexSize.ref.value,t,n)),k.update(this.downsampleDepthRenderable.values.uTexSize,Me.set(this.downsampleDepthRenderable.values.uTexSize.ref.value,s,a)),k.update(this.depthHalfRenderable.values.uTexSize,Me.set(this.depthHalfRenderable.values.uTexSize.ref.value,c,u)),k.update(this.depthQuarterRenderable.values.uTexSize,Me.set(this.depthQuarterRenderable.values.uTexSize.ref.value,l,d)),k.update(this.ssaoRenderable.values.uTexSize,Me.set(this.ssaoRenderable.values.uTexSize.ref.value,s,a)),k.update(this.ssaoBlurFirstPassRenderable.values.uTexSize,Me.set(this.ssaoBlurFirstPassRenderable.values.uTexSize.ref.value,s,a)),k.update(this.ssaoBlurSecondPassRenderable.values.uTexSize,Me.set(this.ssaoBlurSecondPassRenderable.values.uTexSize.ref.value,s,a));const f=1===this.ssaoScale?this.drawPass.depthTextureOpaque:this.downsampledDepthTarget.texture;k.update(this.depthHalfRenderable.values.tColor,f),k.update(this.ssaoRenderable.values.tDepth,f),this.depthHalfRenderable.update(),this.ssaoRenderable.update(),this.background.setSize(t,n)}}updateState(t,n,r,i,o){var s;let a=!1,c=!1,u=!1,l=!1,d=!1,f=!1;const p="orthographic"===t.state.mode?1:0,m="on"===i.outline.name,h="on"===i.shadow.name,g="on"===i.occlusion.name,y=le.identity();le.invert(y,t.projection);const[b,x]=this.renderable.values.uTexSize.ref.value,_=t.viewport;if("on"===i.occlusion.name){k.update(this.ssaoRenderable.values.uProjection,t.projection),k.update(this.ssaoRenderable.values.uInvProjection,y);const E=this.ssaoRenderable.values.uBounds,w=this.ssaoScale;nn.set(E.ref.value,Math.floor(_.x*w)/(b*w),Math.floor(_.y*w)/(x*w),Math.ceil((_.x+_.width)*w)/(b*w),Math.ceil((_.y+_.height)*w)/(x*w)),k.update(E,E.ref.value),k.update(this.ssaoBlurFirstPassRenderable.values.uBounds,E.ref.value),k.update(this.ssaoBlurSecondPassRenderable.values.uBounds,E.ref.value),k.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.uNear,t.near),k.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.uNear,t.near),k.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.uFar,t.far),k.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.uFar,t.far),k.update(this.ssaoBlurFirstPassRenderable.values.uInvProjection,y),k.update(this.ssaoBlurSecondPassRenderable.values.uInvProjection,y),this.ssaoBlurFirstPassRenderable.values.dOrthographic.ref.value!==p&&(l=!0,k.update(this.ssaoBlurFirstPassRenderable.values.dOrthographic,p),k.update(this.ssaoBlurSecondPassRenderable.values.dOrthographic,p)),this.nSamples!==i.occlusion.params.samples&&(u=!0,this.nSamples=i.occlusion.params.samples,k.update(this.ssaoRenderable.values.uSamples,xue(this.nSamples)),k.updateIfChanged(this.ssaoRenderable.values.dNSamples,this.nSamples));const D="on"===i.occlusion.params.multiScale.name;if(this.ssaoRenderable.values.dMultiScale.ref.value!==D&&(u=!0,k.update(this.ssaoRenderable.values.dMultiScale,D)),"on"===i.occlusion.params.multiScale.name){const R=i.occlusion.params.multiScale.params;if(!Yd(this.levels,R.levels)){u=!0,this.levels=R.levels;const T=function irt(e,t){const n=e.length,{radius:r,bias:i}=t||{radius:new Array(3*n).fill(0),bias:new Array(3*n).fill(0)};e=e.slice().sort((o,s)=>o.radius-s.radius);for(let o=0;o=p.length)return-2;const{x:m,y:h,width:g,height:y}=o.viewport,b=1/p.length;if(-1===t)u.render(n,r,!1),k.update(s.values.uWeight,1),k.update(s.values.tColor,u.getColorTarget(r.postprocessing).texture),s.update(),c.bind(),f.disable(d.BLEND),f.disable(d.DEPTH_TEST),f.depthMask(!1),f.viewport(m,h,g,y),f.scissor(m,h,g,y),s.render(),t+=1;else{o.viewOffset.enabled=!0,k.update(s.values.tColor,u.getColorTarget(r.postprocessing).texture),k.update(s.values.uWeight,b),s.update();const _=Math.pow(2,Math.max(0,r.multiSample.sampleLevel-2));for(let S=0;S<_;++S){const A=p[t];if(gr.setViewOffset(o.viewOffset,g,y,A[0],A[1],g,y),o.update(),0===t?u.postprocessing.setOcclusionOffset(0,0):u.postprocessing.setOcclusionOffset(A[0]/g,A[1]/y),u.render(n,r,!1),a.bind(),f.enable(d.BLEND),f.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),f.blendFuncSeparate(d.ONE,d.ONE,d.ONE,d.ONE),f.disable(d.DEPTH_TEST),f.depthMask(!1),f.viewport(m,h,g,y),f.scissor(m,h,g,y),0===t&&(f.clearColor(0,0,0,0),d.clear(d.COLOR_BUFFER_BIT)),s.render(),(t+=1)>=p.length)break}}u.postprocessing.setOcclusionOffset(0,0),this.bindOutputTarget(i),f.viewport(m,h,g,y),f.scissor(m,h,g,y);const x=t*b;return x>0&&(k.update(s.values.uWeight,1),k.update(s.values.tColor,a.texture),s.update(),f.disable(d.BLEND),s.render()),x<1&&(k.update(s.values.uWeight,1-x),k.update(s.values.tColor,c.texture),s.update(),0===x?f.disable(d.BLEND):f.enable(d.BLEND),s.render()),o.viewOffset.enabled=!1,o.update(),lt&&l.timer.markEnd("MultiSamplePass.renderTemporalMultiSample"),t>=p.length?-2:t}}const k8=[[[0,0]],[[0,0],[-4,-4]],[[0,0],[6,-2],[-6,2],[2,6]],[[0,0],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[0,0],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[0,0],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];k8.forEach(e=>{e.forEach(t=>{t[0]*=.0625,t[1]*=.0625})});class wue{update(t,n){return t&&(this.sampleIndex=-1),"temporal"===n.mode&&-2!==this.sampleIndex}render(t,n,r,i){return this.sampleIndex=this.multiSamplePass.render(this.sampleIndex,t,n,r,!!i),this.sampleIndex<0}constructor(t){this.multiSamplePass=t,this.sampleIndex=-2}}const Aue={eyeSeparation:C.Numeric(.062,{min:.02,max:.1,step:.001},{description:"Distance between left and right camera."}),focus:C.Numeric(10,{min:1,max:20,step:.1},{description:"Apparent object distance."})},urt=C.getDefaultValues(Aue);class Xv{get viewport(){return this.parent.viewport}get viewOffset(){return this.parent.viewOffset}constructor(t,n={}){this.parent=t,this.left=new Iue,this.right=new Iue,this.props={...urt,...n}}setProps(t){Object.assign(this.props,t)}update(){this.parent.update(),function lrt(e,t,n,r){Lo.copy(n.viewport,e.viewport),le.copy(n.view,e.view),le.copy(n.projection,e.projection),gr.copySnapshot(n.state,e.state),gr.copyViewOffset(n.viewOffset,e.viewOffset),n.far=e.far,n.near=e.near,n.fogFar=e.fogFar,n.fogNear=e.fogNear,Lo.copy(r.viewport,e.viewport),le.copy(r.view,e.view),le.copy(r.projection,e.projection),gr.copySnapshot(r.state,e.state),gr.copyViewOffset(r.viewOffset,e.viewOffset),r.far=e.far,r.near=e.near,r.fogFar=e.fogFar,r.fogNear=e.fogNear;const i=Math.floor(e.viewport.width/2),o=i/e.viewport.height;n.viewport.width=i,r.viewport.x+=i,r.viewport.width-=i;const s=t.eyeSeparation/2,a=s*e.near/t.focus,c=e.near*Math.tan(.5*e.state.fov);let u,l;Tue[12]=-s,Due[12]=s,u=-c*o+a,l=c*o+a,n.projection[0]=2*e.near/(l-u),n.projection[8]=(l+u)/(l-u),le.mul(n.view,n.view,Tue),le.mul(n.projectionView,n.projection,n.view),le.invert(n.inverseProjectionView,n.projectionView),u=-c*o-a,l=c*o-a,r.projection[0]=2*e.near/(l-u),r.projection[8]=(l+u)/(l-u),le.mul(r.view,r.view,Due),le.mul(r.projectionView,r.projection,r.view),le.invert(r.inverseProjectionView,r.projectionView)}(this.parent,this.props,this.left,this.right)}}!function(e){e.is=function t(n){return"left"in n&&"right"in n}}(Xv||(Xv={}));class Iue{constructor(){this.viewport=Lo.create(0,0,0,0),this.view=le(),this.projection=le(),this.projectionView=le(),this.inverseProjectionView=le(),this.state=gr.createDefaultSnapshot(),this.viewOffset=gr.ViewOffset(),this.far=0,this.near=0,this.fogFar=0,this.fogNear=0}}const Tue=le.identity(),Due=le.identity(),N8=Math.pow(2,24)-2;class drt{constructor(t,n,r){this.webgl=t,this.drawPass=n,this.pickScale=r;const i=r/t.pixelRatio;this.pickWidth=Math.ceil(n.colorTarget.getWidth()*i),this.pickHeight=Math.ceil(n.colorTarget.getHeight()*i);const{resources:o,extensions:{drawBuffers:s},gl:a}=t;s?(this.objectPickTexture=o.texture("image-uint8","rgba","ubyte","nearest"),this.objectPickTexture.define(this.pickWidth,this.pickHeight),this.instancePickTexture=o.texture("image-uint8","rgba","ubyte","nearest"),this.instancePickTexture.define(this.pickWidth,this.pickHeight),this.groupPickTexture=o.texture("image-uint8","rgba","ubyte","nearest"),this.groupPickTexture.define(this.pickWidth,this.pickHeight),this.depthPickTexture=o.texture("image-uint8","rgba","ubyte","nearest"),this.depthPickTexture.define(this.pickWidth,this.pickHeight),this.framebuffer=o.framebuffer(),this.objectPickFramebuffer=o.framebuffer(),this.instancePickFramebuffer=o.framebuffer(),this.groupPickFramebuffer=o.framebuffer(),this.depthPickFramebuffer=o.framebuffer(),this.framebuffer.bind(),s.drawBuffers([s.COLOR_ATTACHMENT0,s.COLOR_ATTACHMENT1,s.COLOR_ATTACHMENT2,s.COLOR_ATTACHMENT3]),this.objectPickTexture.attachFramebuffer(this.framebuffer,"color0"),this.instancePickTexture.attachFramebuffer(this.framebuffer,"color1"),this.groupPickTexture.attachFramebuffer(this.framebuffer,"color2"),this.depthPickTexture.attachFramebuffer(this.framebuffer,"color3"),this.depthRenderbuffer=Wt(a)?o.renderbuffer("depth32f","depth",this.pickWidth,this.pickHeight):o.renderbuffer("depth16","depth",this.pickWidth,this.pickHeight),this.depthRenderbuffer.attachFramebuffer(this.framebuffer),this.objectPickTexture.attachFramebuffer(this.objectPickFramebuffer,"color0"),this.instancePickTexture.attachFramebuffer(this.instancePickFramebuffer,"color0"),this.groupPickTexture.attachFramebuffer(this.groupPickFramebuffer,"color0"),this.depthPickTexture.attachFramebuffer(this.depthPickFramebuffer,"color0")):(this.objectPickTarget=t.createRenderTarget(this.pickWidth,this.pickHeight),this.instancePickTarget=t.createRenderTarget(this.pickWidth,this.pickHeight),this.groupPickTarget=t.createRenderTarget(this.pickWidth,this.pickHeight),this.depthPickTarget=t.createRenderTarget(this.pickWidth,this.pickHeight))}get pickRatio(){return this.pickScale/this.webgl.pixelRatio}setPickScale(t){this.pickScale=t,this.syncSize()}bindObject(){this.webgl.extensions.drawBuffers?this.objectPickFramebuffer.bind():this.objectPickTarget.bind()}bindInstance(){this.webgl.extensions.drawBuffers?this.instancePickFramebuffer.bind():this.instancePickTarget.bind()}bindGroup(){this.webgl.extensions.drawBuffers?this.groupPickFramebuffer.bind():this.groupPickTarget.bind()}bindDepth(){this.webgl.extensions.drawBuffers?this.depthPickFramebuffer.bind():this.depthPickTarget.bind()}get drawingBufferHeight(){return this.drawPass.colorTarget.getHeight()}syncSize(){const t=this.pickScale/this.webgl.pixelRatio,n=Math.ceil(this.drawPass.colorTarget.getWidth()*t),r=Math.ceil(this.drawPass.colorTarget.getHeight()*t);(n!==this.pickWidth||r!==this.pickHeight)&&(this.pickWidth=n,this.pickHeight=r,this.webgl.extensions.drawBuffers?(this.objectPickTexture.define(this.pickWidth,this.pickHeight),this.instancePickTexture.define(this.pickWidth,this.pickHeight),this.groupPickTexture.define(this.pickWidth,this.pickHeight),this.depthPickTexture.define(this.pickWidth,this.pickHeight),this.depthRenderbuffer.setSize(this.pickWidth,this.pickHeight)):(this.objectPickTarget.setSize(this.pickWidth,this.pickHeight),this.instancePickTarget.setSize(this.pickWidth,this.pickHeight),this.groupPickTarget.setSize(this.pickWidth,this.pickHeight),this.depthPickTarget.setSize(this.pickWidth,this.pickHeight)))}renderVariant(t,n,r,i,o,s){t.clear(!1),t.update(n,r),t.renderPick(r.primitives,n,o,null,s),i.handle.isEnabled&&t.renderPick(i.handle.scene,n,o,null,s),i.camera.isEnabled&&(i.camera.update(n),t.update(i.camera.camera,i.camera.scene),t.renderPick(i.camera.scene,i.camera.camera,o,null,s))}render(t,n,r,i){this.webgl.extensions.drawBuffers?(this.framebuffer.bind(),this.renderVariant(t,n,r,i,"pick",D0.None)):(this.objectPickTarget.bind(),this.renderVariant(t,n,r,i,"pick",D0.Object),this.instancePickTarget.bind(),this.renderVariant(t,n,r,i,"pick",D0.Instance),this.groupPickTarget.bind(),this.renderVariant(t,n,r,i,"pick",D0.Group),this.depthPickTarget.bind(),this.renderVariant(t,n,r,i,"depth",D0.None))}}class frt{setupBuffers(){const t=this.pickWidth*this.pickHeight*4;(!this.objectBuffer||this.objectBuffer.length!==t)&&(this.objectBuffer=new Uint8Array(t),this.instanceBuffer=new Uint8Array(t),this.groupBuffer=new Uint8Array(t),this.depthBuffer=new Uint8Array(t))}setViewport(t,n,r,i){Lo.set(this.viewport,t,n,r,i),this.pickRatio=this.pickPass.pickRatio,this.pickX=Math.ceil(t*this.pickRatio),this.pickY=Math.ceil(n*this.pickRatio);const o=Math.floor(r*this.pickRatio),s=Math.floor(i*this.pickRatio);(o!==this.pickWidth||s!==this.pickHeight)&&(this.pickWidth=o,this.pickHeight=s,this.halfPickWidth=Math.floor(this.pickWidth/2),this.setupBuffers()),this.spiral=function rMe(e){let t=0,n=0;const r=[0,-1],i=2*e+1,o=i/2,s=[];for(let a=Math.pow(i,2);a>0;--a)-o0&&t===1-n)&&([r[0],r[1]]=[-r[1],r[0]]),t+=r[0],n+=r[1];return s}(Math.round(this.pickRatio*this.pickPadding))}syncBuffers(){lt&&this.webgl.timer.mark("PickHelper.syncBuffers");const{pickX:t,pickY:n,pickWidth:r,pickHeight:i}=this;this.pickPass.bindObject(),this.webgl.readPixels(t,n,r,i,this.objectBuffer),this.pickPass.bindInstance(),this.webgl.readPixels(t,n,r,i,this.instanceBuffer),this.pickPass.bindGroup(),this.webgl.readPixels(t,n,r,i,this.groupBuffer),this.pickPass.bindDepth(),this.webgl.readPixels(t,n,r,i,this.depthBuffer),lt&&this.webgl.timer.markEnd("PickHelper.syncBuffers")}getBufferIdx(t,n){return 4*(n*this.pickWidth+t)}getDepth(t,n){const r=this.getBufferIdx(t,n),i=this.depthBuffer;return function SHe(e,t,n,r){return nn.set(Rie,e/255,t/255,n/255,r/255),nn.dot(Rie,xHe)}(i[r],i[r+1],i[r+2],i[r+3])}getId(t,n,r){const i=this.getBufferIdx(t,n);return m5(r[i],r[i+1],r[i+2])}render(t){lt&&this.webgl.timer.mark("PickHelper.render",!0);const{pickX:n,pickY:r,pickWidth:i,pickHeight:o,halfPickWidth:s}=this,{renderer:a,scene:c,helper:u}=this;a.setTransparentBackground(!1),a.setDrawingBufferSize(i,o),a.setPixelRatio(this.pickRatio),Xv.is(t)?(a.setViewport(n,r,s,o),this.pickPass.render(a,t.left,c,u),a.setViewport(n+s,r,i-s,o),this.pickPass.render(a,t.right,c,u)):(a.setViewport(n,r,i,o),this.pickPass.render(a,t,c,u)),this.dirty=!1,lt&&this.webgl.timer.markEnd("PickHelper.render")}identifyInternal(t,n,r){const{webgl:i,pickRatio:o}=this;if(i.isContextLost)return;t*=i.pixelRatio,n=this.pickPass.drawingBufferHeight-(n*=i.pixelRatio);const{viewport:s}=this;if(ts.x+s.width||n>s.y+s.height)return;this.dirty&&(lt&&this.webgl.timer.mark("PickHelper.identify"),this.render(r),this.syncBuffers(),lt&&this.webgl.timer.markEnd("PickHelper.identify"));const a=t-s.x,c=n-s.y,u=Math.floor(a*o),l=Math.floor(c*o),d=this.getId(u,l,this.objectBuffer);if(-1===d||d===N8)return;const f=this.getId(u,l,this.instanceBuffer);if(-1===f||f===N8)return;const p=this.getId(u,l,this.groupBuffer);if(-1===p||p===N8)return;const m=this.getDepth(u,l),h=v.create(t,n,m);if(Xv.is(r)){const g=Math.floor(s.width/2);t>s.x+g?(h[0]=s.x+2*(a-g),vE(h,h,s,r.right.inverseProjectionView)):(h[0]=s.x+2*a,vE(h,h,s,r.left.inverseProjectionView))}else vE(h,h,s,r.inverseProjectionView);return{id:{objectId:d,instanceId:f,groupId:p},position:h}}identify(t,n,r){for(const i of this.spiral){const o=this.identifyInternal(t+i[0],n+i[1],r);if(o)return o}}constructor(t,n,r,i,o,s,a=1){this.webgl=t,this.renderer=n,this.scene=r,this.helper=i,this.pickPass=o,this.pickPadding=a,this.dirty=!0,this.viewport=Lo(),this.setViewport(s.x,s.y,s.width,s.height)}}const hrt={...vo,tWboitA:jt("texture","rgba","float","nearest"),tWboitB:jt("texture","rgba","float","nearest"),uTexSize:xe("v2")},mrt=Br("evaluate-wboit",ps,"\nprecision highp float;\n\nuniform sampler2D tWboitA;\nuniform sampler2D tWboitB;\nuniform vec2 uTexSize;\n\nvoid main() {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n\n vec4 accum = texture2D(tWboitA, coords);\n float r = 1.0 - accum.a;\n\n accum.a = texture2D(tWboitB, coords).r;\n // divisor needs to allow very small values for nice fading\n gl_FragColor = vec4(accum.rgb / clamp(accum.a, 0.00000001, 50000.0), r);\n}\n");class F8{get supported(){return this._supported}bind(){const{state:t,gl:n}=this.webgl;this.framebuffer.bind(),t.clearColor(0,0,0,1),n.clear(n.COLOR_BUFFER_BIT),t.disable(n.DEPTH_TEST),t.blendFuncSeparate(n.ONE,n.ONE,n.ZERO,n.ONE_MINUS_SRC_ALPHA),t.enable(n.BLEND)}render(){lt&&this.webgl.timer.mark("WboitPass.render");const{state:t,gl:n}=this.webgl;t.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),t.enable(n.BLEND),this.renderable.update(),this.renderable.render(),lt&&this.webgl.timer.markEnd("WboitPass.render")}setSize(t,n){const[r,i]=this.renderable.values.uTexSize.ref.value;(t!==r||n!==i)&&(this.textureA.define(t,n),this.textureB.define(t,n),this.depthRenderbuffer.setSize(t,n),k.update(this.renderable.values.uTexSize,Me.set(this.renderable.values.uTexSize.ref.value,t,n)))}reset(){this._supported&&this._init()}_init(){const{extensions:{drawBuffers:t}}=this.webgl;this.framebuffer.bind(),t.drawBuffers([t.COLOR_ATTACHMENT0,t.COLOR_ATTACHMENT1]),this.textureA.attachFramebuffer(this.framebuffer,"color0"),this.textureB.attachFramebuffer(this.framebuffer,"color1"),this.depthRenderbuffer.attachFramebuffer(this.framebuffer)}static isSupported(t){const{extensions:{drawBuffers:n,textureFloat:r,colorBufferFloat:i,depthTexture:o}}=t;if(r&&i&&o&&n)return!0;if(un){const s=[];r||s.push("textureFloat"),i||s.push("colorBufferFloat"),o||s.push("depthTexture"),n||s.push("drawBuffers"),console.log(`Missing "${s.join('", "')}" extensions required for "wboit"`)}return!1}constructor(t,n,r){if(this.webgl=t,this._supported=!1,!F8.isSupported(t))return;const{resources:i,gl:o}=t;this.textureA=i.texture("image-float32","rgba","float","nearest"),this.textureA.define(n,r),this.textureB=i.texture("image-float32","rgba","float","nearest"),this.textureB.define(n,r),this.depthRenderbuffer=Wt(o)?i.renderbuffer("depth32f","depth",n,r):i.renderbuffer("depth16","depth",n,r),this.renderable=function grt(e,t,n){const r={..._o,tWboitA:k.create(t),tWboitB:k.create(n),uTexSize:k.create(Me.create(t.getWidth(),t.getHeight()))},i={...hrt};return ji(zi(e,"triangles",mrt,i,r),r)}(t,this.textureA,this.textureB),this.framebuffer=i.framebuffer(),this._supported=!0,this._init()}}const vrt={...vo,tDpoitBackColor:jt("texture","rgba","float","nearest"),uTexSize:xe("v2")},_rt=Br("blend-back-dpoit",ps,"\n precision highp float;\n\n uniform sampler2D tDpoitBackColor;\n uniform vec2 uTexSize;\n\n void main() {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n gl_FragColor = texture2D(tDpoitBackColor, coords);\n if (gl_FragColor.a == 0.0) {\n discard;\n }\n }\n"),Srt={...vo,tDpoitFrontColor:jt("texture","rgba","float","nearest"),uTexSize:xe("v2")},Crt=Br("evaluate-dpoit",ps,"\nprecision highp float;\n\nuniform sampler2D tDpoitFrontColor;\nuniform vec2 uTexSize;\n\nvoid main() {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n gl_FragColor = texture2D(tDpoitFrontColor, coords);\n}\n");class B8{get supported(){return this._supported}bind(){const{state:t,gl:n,extensions:{blendMinMax:r}}=this.webgl;return this.passCount=0,this.depthFramebuffers[0].bind(),t.clearColor(this.DEPTH_CLEAR_VALUE,this.DEPTH_CLEAR_VALUE,0,0),n.clear(n.COLOR_BUFFER_BIT),this.depthFramebuffers[1].bind(),t.clearColor(-this.MIN_DEPTH,this.MAX_DEPTH,0,0),n.clear(n.COLOR_BUFFER_BIT),this.colorFramebuffers[0].bind(),t.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),this.colorFramebuffers[1].bind(),t.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),this.depthFramebuffers[0].bind(),t.blendEquation(r.MAX),t.depthMask(!1),{depth:this.depthTextures[1],frontColor:this.colorFrontTextures[1],backColor:this.colorBackTextures[1]}}bindDualDepthPeeling(){const{state:t,gl:n,extensions:{blendMinMax:r}}=this.webgl;return this.readId=this.passCount%2,this.writeId=1-this.readId,this.passCount+=1,this.depthFramebuffers[this.writeId].bind(),t.clearColor(this.DEPTH_CLEAR_VALUE,this.DEPTH_CLEAR_VALUE,0,0),n.clear(n.COLOR_BUFFER_BIT),this.colorFramebuffers[this.writeId].bind(),t.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),this.depthFramebuffers[this.writeId].bind(),t.blendEquation(r.MAX),t.depthMask(!1),{depth:this.depthTextures[this.readId],frontColor:this.colorFrontTextures[this.readId],backColor:this.colorBackTextures[this.readId]}}renderBlendBack(){lt&&this.webgl.timer.mark("DpoitPass.renderBlendBack");const{state:t,gl:n}=this.webgl;t.blendEquation(n.FUNC_ADD),t.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),k.update(this.blendBackRenderable.values.tDpoitBackColor,this.colorBackTextures[this.writeId]),this.blendBackRenderable.update(),this.blendBackRenderable.render(),lt&&this.webgl.timer.markEnd("DpoitPass.renderBlendBack")}render(){lt&&this.webgl.timer.mark("DpoitPass.render");const{state:t,gl:n}=this.webgl;t.blendFunc(n.ONE,n.ONE_MINUS_SRC_ALPHA),k.update(this.renderable.values.tDpoitFrontColor,this.colorFrontTextures[this.writeId]),this.renderable.update(),this.renderable.render(),lt&&this.webgl.timer.markEnd("DpoitPass.render")}setSize(t,n){const[r,i]=this.renderable.values.uTexSize.ref.value;if(t!==r||n!==i){for(let o=0;o<2;o++)this.depthTextures[o].define(t,n),this.colorFrontTextures[o].define(t,n),this.colorBackTextures[o].define(t,n);k.update(this.renderable.values.uTexSize,Me.set(this.renderable.values.uTexSize.ref.value,t,n)),k.update(this.blendBackRenderable.values.uTexSize,Me.set(this.blendBackRenderable.values.uTexSize.ref.value,t,n))}}reset(){this._supported&&this._init()}_init(){const{extensions:{drawBuffers:t}}=this.webgl;for(let n=0;n<2;n++)this.depthFramebuffers[n].bind(),t.drawBuffers([t.COLOR_ATTACHMENT0,t.COLOR_ATTACHMENT1,t.COLOR_ATTACHMENT2]),this.colorFrontTextures[n].attachFramebuffer(this.depthFramebuffers[n],"color0"),this.colorBackTextures[n].attachFramebuffer(this.depthFramebuffers[n],"color1"),this.depthTextures[n].attachFramebuffer(this.depthFramebuffers[n],"color2"),this.colorFramebuffers[n].bind(),t.drawBuffers([t.COLOR_ATTACHMENT0,t.COLOR_ATTACHMENT1]),this.colorFrontTextures[n].attachFramebuffer(this.colorFramebuffers[n],"color0"),this.colorBackTextures[n].attachFramebuffer(this.colorFramebuffers[n],"color1")}static isSupported(t){const{extensions:{drawBuffers:n,textureFloat:r,colorBufferFloat:i,blendMinMax:o}}=t;if(r&&i&&n&&o)return!0;if(un){const s=[];r||s.push("textureFloat"),i||s.push("colorBufferFloat"),n||s.push("drawBuffers"),o||s.push("blendMinMax"),console.log(`Missing "${s.join('", "')}" extensions required for "dpoit"`)}return!1}constructor(t,n,r){if(this.webgl=t,this.DEPTH_CLEAR_VALUE=-99999,this.MAX_DEPTH=1,this.MIN_DEPTH=0,this.passCount=0,this._supported=!1,!B8.isSupported(t))return;const{resources:i,extensions:{colorBufferHalfFloat:o,textureHalfFloat:s}}=t;Wt(t.gl)?(this.depthTextures=[i.texture("image-float32","rg","float","nearest"),i.texture("image-float32","rg","float","nearest")],this.colorFrontTextures=o&&s?[i.texture("image-float16","rgba","fp16","nearest"),i.texture("image-float16","rgba","fp16","nearest")]:[i.texture("image-float32","rgba","float","nearest"),i.texture("image-float32","rgba","float","nearest")],this.colorBackTextures=o&&s?[i.texture("image-float16","rgba","fp16","nearest"),i.texture("image-float16","rgba","fp16","nearest")]:[i.texture("image-float32","rgba","float","nearest"),i.texture("image-float32","rgba","float","nearest")]):(this.depthTextures=[i.texture("image-float32","rgba","float","nearest"),i.texture("image-float32","rgba","float","nearest")],this.colorFrontTextures=[i.texture("image-float32","rgba","float","nearest"),i.texture("image-float32","rgba","float","nearest")],this.colorBackTextures=[i.texture("image-float32","rgba","float","nearest"),i.texture("image-float32","rgba","float","nearest")]),this.depthTextures[0].define(n,r),this.depthTextures[1].define(n,r),this.colorFrontTextures[0].define(n,r),this.colorFrontTextures[1].define(n,r),this.colorBackTextures[0].define(n,r),this.colorBackTextures[1].define(n,r),this.depthFramebuffers=[i.framebuffer(),i.framebuffer()],this.colorFramebuffers=[i.framebuffer(),i.framebuffer()],this.blendBackRenderable=function xrt(e,t){const n={..._o,tDpoitBackColor:k.create(t),uTexSize:k.create(Me.create(t.getWidth(),t.getHeight()))},r={...vrt};return ji(zi(e,"triangles",_rt,r,n),n)}(t,this.colorBackTextures[0]),this.renderable=function wrt(e,t){const n={..._o,tDpoitFrontColor:k.create(t),uTexSize:k.create(Me.create(t.getWidth(),t.getHeight()))},r={...Srt};return ji(zi(e,"triangles",Crt,r,n),n)}(t,this.colorFrontTextures[0]),this._supported=!0,this._init()}}const Eue={enabled:C.Boolean(!0),highlightEdgeColor:C.Color(st.darken(st.fromNormalizedRgb(1,.4,.6),1)),selectEdgeColor:C.Color(st.darken(st.fromNormalizedRgb(.2,1,.1),1)),edgeScale:C.Numeric(1,{min:1,max:3,step:1},{description:"Thickness of the edge."}),highlightEdgeStrength:C.Numeric(1,{min:0,max:1,step:.1}),selectEdgeStrength:C.Numeric(1,{min:0,max:1,step:.1}),ghostEdgeStrength:C.Numeric(.3,{min:0,max:1,step:.1},{description:"Opacity of the hidden edges that are covered by other geometry. When set to 1, one less geometry render pass is done."}),innerEdgeFactor:C.Numeric(1.5,{min:0,max:3,step:.1},{description:"Factor to multiply the inner edge color with - for added contrast."})};class Pue{static isEnabled(t){return t.enabled}constructor(t,n,r){this.webgl=t,this.depthTarget=t.createRenderTarget(n,r),this.maskTarget=t.createRenderTarget(n,r),this.edgesTarget=t.createRenderTarget(n,r),this.edge=function Ert(e,t){const n=t.getWidth(),r=t.getHeight(),i={..._o,tMaskTexture:k.create(t),uTexSizeInv:k.create(Me.create(1/n,1/r)),dEdgeScale:k.create(1)},o={...Trt};return ji(zi(e,"triangles",Drt,o,i),i)}(t,this.maskTarget.texture),this.overlay=function Rrt(e,t){const n=t.getWidth(),r=t.getHeight(),i={..._o,tEdgeTexture:k.create(t),uTexSizeInv:k.create(Me.create(1/n,1/r)),uHighlightEdgeColor:k.create(v()),uSelectEdgeColor:k.create(v()),uHighlightEdgeStrength:k.create(1),uSelectEdgeStrength:k.create(1),uGhostEdgeStrength:k.create(0),uInnerEdgeFactor:k.create(0)},o={...Prt};return ji(zi(e,"triangles",Mrt,o,i),i)}(t,this.edgesTarget.texture)}setEdgeState(t){const{gl:n,state:r}=this.webgl;r.enable(n.SCISSOR_TEST),r.enable(n.BLEND),r.blendFunc(n.ONE,n.ONE),r.blendEquation(n.FUNC_ADD),r.disable(n.DEPTH_TEST),r.depthMask(!1);const{x:i,y:o,width:s,height:a}=t;r.viewport(i,o,s,a),r.scissor(i,o,s,a),r.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT)}setOverlayState(t){const{gl:n,state:r}=this.webgl;r.enable(n.SCISSOR_TEST),r.enable(n.BLEND),r.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),r.blendEquation(n.FUNC_ADD),r.disable(n.DEPTH_TEST),r.depthMask(!1);const{x:i,y:o,width:s,height:a}=t;r.viewport(i,o,s,a),r.scissor(i,o,s,a)}setSize(t,n){const r=this.depthTarget.getWidth(),i=this.depthTarget.getHeight();(t!==r||n!==i)&&(this.depthTarget.setSize(t,n),this.maskTarget.setSize(t,n),this.edgesTarget.setSize(t,n),k.update(this.edge.values.uTexSizeInv,Me.set(this.edge.values.uTexSizeInv.ref.value,1/t,1/n)),k.update(this.overlay.values.uTexSizeInv,Me.set(this.overlay.values.uTexSizeInv.ref.value,1/t,1/n)))}update(t){const{highlightEdgeColor:n,selectEdgeColor:r,edgeScale:i,innerEdgeFactor:o,ghostEdgeStrength:s,highlightEdgeStrength:a,selectEdgeStrength:c}=t,{values:u}=this.edge,l=Math.max(1,Math.round(i*this.webgl.pixelRatio));u.dEdgeScale.ref.value!==l&&(k.update(u.dEdgeScale,l),this.edge.update());const{values:d}=this.overlay;k.update(d.uHighlightEdgeColor,st.toVec3Normalized(d.uHighlightEdgeColor.ref.value,n)),k.update(d.uSelectEdgeColor,st.toVec3Normalized(d.uSelectEdgeColor.ref.value,r)),k.updateIfChanged(d.uInnerEdgeFactor,o),k.updateIfChanged(d.uGhostEdgeStrength,s),k.updateIfChanged(d.uHighlightEdgeStrength,a),k.updateIfChanged(d.uSelectEdgeStrength,c)}render(t,n){lt&&this.webgl.timer.mark("MarkingPass.render"),this.edgesTarget.bind(),this.setEdgeState(t),this.edge.render(),n?n.bind():this.webgl.unbindFramebuffer(),this.setOverlayState(t),this.overlay.render(),lt&&this.webgl.timer.markEnd("MarkingPass.render")}}const Trt={...vo,tMaskTexture:jt("texture","rgba","ubyte","linear"),uTexSizeInv:xe("v2"),dEdgeScale:Ft("number")},Drt=Br("edge",ps,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform sampler2D tMaskTexture;\nuniform vec2 uTexSizeInv;\n\nvoid main() {\n vec2 coords = gl_FragCoord.xy * uTexSizeInv;\n vec4 offset = vec4(float(dEdgeScale), 0.0, 0.0, float(dEdgeScale)) * vec4(uTexSizeInv, uTexSizeInv);\n vec4 c0 = texture2D(tMaskTexture, coords);\n vec4 c1 = texture2D(tMaskTexture, coords + offset.xy);\n vec4 c2 = texture2D(tMaskTexture, coords - offset.xy);\n vec4 c3 = texture2D(tMaskTexture, coords + offset.yw);\n vec4 c4 = texture2D(tMaskTexture, coords - offset.yw);\n float diff1 = (c1.r - c2.r) * 0.5;\n float diff2 = (c3.r - c4.r) * 0.5;\n float d = length(vec2(diff1, diff2));\n if (d <= 0.0)\n discard;\n float a1 = min(c1.g, c2.g);\n float a2 = min(c3.g, c4.g);\n float visibility = min(a1, a2) > 0.001 ? 1.0 : 0.0;\n float mask = c0.r;\n float marker = min(c1.b, min(c2.b, min(c3.b, c4.b)));\n float fogAlpha = min(c1.a, min(c2.a, min(c3.a, c4.a)));\n gl_FragColor = vec4(visibility, mask, marker, fogAlpha);\n}\n"),Prt={...vo,tEdgeTexture:jt("texture","rgba","ubyte","linear"),uTexSizeInv:xe("v2"),uHighlightEdgeColor:xe("v3"),uSelectEdgeColor:xe("v3"),uHighlightEdgeStrength:xe("f"),uSelectEdgeStrength:xe("f"),uGhostEdgeStrength:xe("f"),uInnerEdgeFactor:xe("f")},Mrt=Br("overlay",ps,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform vec2 uTexSizeInv;\nuniform sampler2D tEdgeTexture;\nuniform vec3 uHighlightEdgeColor;\nuniform vec3 uSelectEdgeColor;\nuniform float uHighlightEdgeStrength;\nuniform float uSelectEdgeStrength;\nuniform float uGhostEdgeStrength;\nuniform float uInnerEdgeFactor;\n\nvoid main() {\n vec2 coords = gl_FragCoord.xy * uTexSizeInv;\n vec4 edgeValue = texture2D(tEdgeTexture, coords);\n if (edgeValue.a > 0.0) {\n vec3 edgeColor = edgeValue.b == 1.0 ? uHighlightEdgeColor : uSelectEdgeColor;\n gl_FragColor.rgb = edgeValue.g > 0.0 ? edgeColor : edgeColor * uInnerEdgeFactor;\n gl_FragColor.a = (edgeValue.r == 1.0 ? uGhostEdgeStrength : 1.0) * edgeValue.a;\n float edgeStrength = edgeValue.b == 1.0 ? uHighlightEdgeStrength : uSelectEdgeStrength;\n gl_FragColor.a *= edgeStrength;\n } else {\n gl_FragColor = vec4(0.0);\n }\n}\n");class Mue{setTransparency(t){this.transparencyMode="wboit"===t?this.wboit.supported?"wboit":"blended":"dpoit"===t&&this.dpoit.supported?"dpoit":"blended",this.depthTextureOpaque.detachFramebuffer(this.postprocessing.target.framebuffer,"depth")}get transparency(){return this.transparencyMode}constructor(t,n,r,i,o){this.webgl=t,this.transparencyMode="blended";const{extensions:s,resources:a,isWebGL2:c}=t;this.drawTarget=function v9e(e){return{id:kre(),texture:Os(e),framebuffer:{id:bre(),bind:()=>{},reset:()=>{},destroy:()=>{}},depthRenderbuffer:null,getWidth:()=>0,getHeight:()=>0,bind:()=>{e.bindFramebuffer(e.FRAMEBUFFER,null)},setSize:()=>{},reset:()=>{},destroy:()=>{}}}(t.gl),this.colorTarget=t.createRenderTarget(r,i,!0,"uint8","linear"),this.packedDepth=!s.depthTexture,this.depthTargetTransparent=t.createRenderTarget(r,i),this.depthTextureTransparent=this.depthTargetTransparent.texture,this.depthTargetOpaque=this.packedDepth?t.createRenderTarget(r,i):null,this.depthTextureOpaque=this.depthTargetOpaque?this.depthTargetOpaque.texture:a.texture("image-depth","depth",c?"float":"ushort","nearest"),this.packedDepth||this.depthTextureOpaque.define(r,i),this.wboit=new F8(t,r,i),this.dpoit=new B8(t,r,i),this.marking=new Pue(t,r,i),this.postprocessing=new uc(t,n,this),this.antialiasing=new R8(t,this),this.copyFboTarget=Tv(t,this.colorTarget.texture),this.copyFboPostprocessing=Tv(t,this.postprocessing.target.texture),this.setTransparency(o)}reset(){this.wboit.reset(),this.dpoit.reset()}setSize(t,n){const r=this.colorTarget.getWidth(),i=this.colorTarget.getHeight();(t!==r||n!==i)&&(this.colorTarget.setSize(t,n),this.depthTargetTransparent.setSize(t,n),this.depthTargetOpaque?this.depthTargetOpaque.setSize(t,n):this.depthTextureOpaque.define(t,n),k.update(this.copyFboTarget.values.uTexSize,Me.set(this.copyFboTarget.values.uTexSize.ref.value,t,n)),k.update(this.copyFboPostprocessing.values.uTexSize,Me.set(this.copyFboPostprocessing.values.uTexSize.ref.value,t,n))),this.wboit.supported&&this.wboit.setSize(t,n),this.dpoit.supported&&this.dpoit.setSize(t,n),this.marking.setSize(t,n),this.postprocessing.setSize(t,n),this.antialiasing.setSize(t,n)}_renderDpoit(t,n,r,i,o,s){if(!this.dpoit.supported)throw new Error("expected dpoit to be supported");if(this.depthTextureOpaque.attachFramebuffer(this.colorTarget.framebuffer,"depth"),t.clear(!0),r.hasOpaque&&t.renderDpoitOpaque(r.primitives,n,null),uc.isEnabled(s)&&(uc.isTransparentOutlineEnabled(s)&&(this.depthTargetTransparent.bind(),t.clearDepth(!0),r.opacityAverage<1&&t.renderDepthTransparent(r.primitives,n,this.depthTextureOpaque)),this.postprocessing.render(n,!1,o,t.props.backgroundColor,s,t.light)),this.depthTextureOpaque.detachFramebuffer(this.colorTarget.framebuffer,"depth"),r.opacityAverage<1){const a=uc.isEnabled(s)?this.postprocessing.target:this.colorTarget,c=this.dpoit.bind();t.renderDpoitTransparent(r.primitives,n,this.depthTextureOpaque,c);for(let u=0;u0&&t.renderDpoitVolume(r.volumes,n,this.depthTextureOpaque)}_renderWboit(t,n,r,i,o){if(!this.wboit.supported)throw new Error("expected wboit to be supported");this.depthTextureOpaque.attachFramebuffer(this.colorTarget.framebuffer,"depth"),t.clear(!0),r.hasOpaque&&t.renderWboitOpaque(r.primitives,n,null),uc.isEnabled(o)&&(uc.isTransparentOutlineEnabled(o)&&(this.depthTargetTransparent.bind(),t.clearDepth(!0),r.opacityAverage<1&&t.renderDepthTransparent(r.primitives,n,this.depthTextureOpaque)),this.postprocessing.render(n,!1,i,t.props.backgroundColor,o,t.light)),(r.opacityAverage<1||r.volumes.renderables.length>0)&&(this.wboit.bind(),r.opacityAverage<1&&t.renderWboitTransparent(r.primitives,n,this.depthTextureOpaque),r.volumes.renderables.length>0&&t.renderWboitTransparent(r.volumes,n,this.depthTextureOpaque),uc.isEnabled(o)?this.postprocessing.target.bind():this.colorTarget.bind(),this.wboit.render())}_renderBlended(t,n,r,i,o,s){var a,c,u,l;if(i?this.drawTarget.bind():this.packedDepth?this.colorTarget.bind():this.depthTextureOpaque.attachFramebuffer(this.colorTarget.framebuffer,"depth"),t.clear(!0),r.hasOpaque&&t.renderBlendedOpaque(r.primitives,n,null),!i&&(this.depthTargetOpaque&&(this.depthTargetOpaque.bind(),t.clearDepth(!0),t.renderDepthOpaque(r.primitives,n,null),this.colorTarget.bind()),uc.isEnabled(s)&&(this.packedDepth?null===(a=this.colorTarget.depthRenderbuffer)||void 0===a||a.detachFramebuffer(this.postprocessing.target.framebuffer):this.depthTextureOpaque.detachFramebuffer(this.postprocessing.target.framebuffer,"depth"),uc.isTransparentOutlineEnabled(s)&&(this.depthTargetTransparent.bind(),t.clearDepth(!0),r.opacityAverage<1&&t.renderDepthTransparent(r.primitives,n,this.depthTextureOpaque)),this.postprocessing.render(n,!1,o,t.props.backgroundColor,s,t.light),this.packedDepth?null===(c=this.colorTarget.depthRenderbuffer)||void 0===c||c.attachFramebuffer(this.postprocessing.target.framebuffer):this.depthTextureOpaque.attachFramebuffer(this.postprocessing.target.framebuffer,"depth")),r.volumes.renderables.length>0)){const d=uc.isEnabled(s)?this.postprocessing.target:this.colorTarget;this.packedDepth?null===(u=this.colorTarget.depthRenderbuffer)||void 0===u||u.detachFramebuffer(d.framebuffer):this.depthTextureOpaque.detachFramebuffer(d.framebuffer,"depth"),d.bind(),t.renderBlendedVolume(r.volumes,n,this.depthTextureOpaque),this.packedDepth?null===(l=this.colorTarget.depthRenderbuffer)||void 0===l||l.attachFramebuffer(d.framebuffer):this.depthTextureOpaque.attachFramebuffer(d.framebuffer,"depth"),d.bind()}r.opacityAverage<1&&t.renderBlendedTransparent(r.primitives,n,null)}_render(t,n,r,i,o,s,a){const c=r.volumes.renderables.length>0,u=uc.isEnabled(a.postprocessing),l=R8.isEnabled(a.postprocessing),d=Pue.isEnabled(a.marking),{x:f,y:p,width:m,height:h}=n.viewport;t.setViewport(f,p,m,h),t.update(n,r),s&&!l&&o&&(this.drawTarget.bind(),t.clear(!1));let g=!1;"wboit"===this.transparencyMode&&this.wboit.supported?(this._renderWboit(t,n,r,s,a.postprocessing),g=!0):"dpoit"===this.transparencyMode&&this.dpoit.supported?(this._renderDpoit(t,n,r,a.dpoitIterations,s,a.postprocessing),g=!0):this._renderBlended(t,n,r,!c&&!u&&!l&&o,s,a.postprocessing);const y=u?this.postprocessing.target:!o||c||g?this.colorTarget:this.drawTarget;if(d&&r.markerAverage>0){const b=a.marking.ghostEdgeStrength<1;b&&1!==r.markerAverage&&(this.marking.depthTarget.bind(),t.clear(!1,!0),t.renderMarkingDepth(r.primitives,n,null)),this.marking.maskTarget.bind(),t.clear(!1,!0),t.renderMarkingMask(r.primitives,n,b?this.marking.depthTarget.texture:null),this.marking.update(a.marking),this.marking.render(n.viewport,y)}else y.bind();i.debug.isEnabled&&(i.debug.syncVisibility(),t.renderBlended(i.debug.scene,n)),i.handle.isEnabled&&t.renderBlended(i.handle.scene,n),i.camera.isEnabled&&(i.camera.update(n),t.update(i.camera.camera,i.camera.scene),t.renderBlended(i.camera.scene,i.camera.camera)),l?this.antialiasing.render(n,o,a.postprocessing):o&&(this.drawTarget.bind(),this.webgl.state.disable(this.webgl.gl.DEPTH_TEST),u?this.copyFboPostprocessing.render():(c||g)&&this.copyFboTarget.render()),this.webgl.gl.flush()}render(t,n,r){lt&&this.webgl.timer.mark("DrawPass.render");const{renderer:i,camera:o,scene:s,helper:a}=t;this.postprocessing.setTransparentBackground(n.transparentBackground);const c=n.transparentBackground||this.postprocessing.background.isEnabled(n.postprocessing.background);i.setTransparentBackground(c),i.setDrawingBufferSize(this.colorTarget.getWidth(),this.colorTarget.getHeight()),i.setPixelRatio(this.webgl.pixelRatio),Xv.is(o)?(lt&&this.webgl.timer.mark("StereoCamera.left"),this._render(i,o.left,s,a,r,c,n),lt&&this.webgl.timer.markEnd("StereoCamera.left"),lt&&this.webgl.timer.mark("StereoCamera.right"),this._render(i,o.right,s,a,r,c,n),lt&&this.webgl.timer.markEnd("StereoCamera.right")):this._render(i,o,s,a,r,c,n),lt&&this.webgl.timer.markEnd("DrawPass.render")}getColorTarget(t){return R8.isEnabled(t)?this.antialiasing.target:uc.isEnabled(t)?this.postprocessing.target:this.colorTarget}}const krt={alpha:C.Numeric(.51,{min:0,max:1,step:.01},{isEssential:!0,label:"Opacity"}),colorX:C.Color(xn.red,{isEssential:!0}),colorY:C.Color(xn.green,{isEssential:!0}),colorZ:C.Color(xn.blue,{isEssential:!0}),scale:C.Numeric(.33,{min:.1,max:2,step:.1},{isEssential:!0}),location:C.Select("bottom-left",C.arrayToOptions(["bottom-left","bottom-right","top-left","top-right"])),locationOffsetX:C.Numeric(0),locationOffsetY:C.Numeric(0),originColor:C.Color(xn.grey),radiusScale:C.Numeric(.075,{min:.01,max:.3,step:.001}),showPlanes:C.Boolean(!0),planeColorXY:C.Color(xn.grey,{label:"Plane Color XY"}),planeColorXZ:C.Color(xn.grey,{label:"Plane Color XZ"}),planeColorYZ:C.Color(xn.grey,{label:"Plane Color YZ"}),showLabels:C.Boolean(!1),labelX:C.Text("X"),labelY:C.Text("Y"),labelZ:C.Text("Z"),labelColorX:C.Color(xn.grey),labelColorY:C.Color(xn.grey),labelColorZ:C.Color(xn.grey),labelOpacity:C.Numeric(1,{min:0,max:1,step:.01}),labelScale:C.Numeric(.25,{min:.1,max:1,step:.01})},IE={axes:C.MappedStatic("on",{on:C.Group(krt),off:C.Group({})},{cycle:!0,description:"Show camera orientation axes"})};class Rue{constructor(t,n={}){this.webgl=t,this.props={axes:{name:"off",params:{}}},this.pixelRatio=1,this.eachGroup=(r,i)=>{if(!O8(r))return!1;let o=!1;if(this.meshRenderObject){const s=this.meshRenderObject.values.uGroupCount.ref.value;for(const{groupId:a,instanceId:c}of r.elements)i(Ce.ofSingleton(c*s+a))&&(o=!0)}if(this.textRenderObject){const s=this.textRenderObject.values.uGroupCount.ref.value;for(const{groupId:a,instanceId:c}of r.elements)i(Ce.ofSingleton(c*s+a))&&(o=!0)}return o},this.scene=$v.create(t,"blended"),this.camera=new gr,v.set(this.camera.up,0,1,0),v.set(this.camera.target,0,0,0),this.setProps(n)}setProps(t){this.props=c0(this.props,n=>{if(void 0!==t.axes&&(n.axes.name=t.axes.name,"on"===t.axes.name)){this.scene.clear(),this.pixelRatio=this.webgl.pixelRatio;const r={...t.axes.params,scale:t.axes.params.scale*this.pixelRatio,labelScale:t.axes.params.labelScale*this.pixelRatio};this.meshRenderObject=function Urt(e){const t=function Lrt(e,t){const n=100*e.scale,r=function Ort(e,t){const n=at.createState(512,256,t),r=100*e.scale,i=e.radiusScale*r,o=e.showLabels?100*e.labelScale/3:0,s=v.scale(v(),v.unitX,r-o),a=v.scale(v(),v.unitY,r-o),c=v.scale(v(),v.unitZ,r-o),u={radiusTop:i,radiusBottom:i,radialSegments:32};if(n.currentGroup=Cr.Origin,Zn(n,v.origin,i,2),n.currentGroup=Cr.X,Zn(n,s,i,2),Hn(n,v.origin,s,1,u),n.currentGroup=Cr.Y,Zn(n,a,i,2),Hn(n,v.origin,a,1,u),n.currentGroup=Cr.Z,Zn(n,c,i,2),Hn(n,v.origin,c,1,u),e.showPlanes){v.scale(s,s,.5),v.scale(a,a,.5),v.scale(c,c,.5),n.currentGroup=Cr.XY,at.addTriangle(n,v.origin,s,a),at.addTriangle(n,v.origin,a,s);const l=v.add(v(),s,a);at.addTriangle(n,l,s,a),at.addTriangle(n,l,a,s),n.currentGroup=Cr.XZ,at.addTriangle(n,v.origin,s,c),at.addTriangle(n,v.origin,c,s);const d=v.add(v(),s,c);at.addTriangle(n,d,s,c),at.addTriangle(n,d,c,s),n.currentGroup=Cr.YZ,at.addTriangle(n,v.origin,a,c),at.addTriangle(n,v.origin,c,a);const f=v.add(v(),a,c);at.addTriangle(n,f,a,c),at.addTriangle(n,f,c,a)}return at.getMesh(n)}(e,t?.geometry);r.setBoundingSphere(_e.create(v.create(n/2,n/2,n/2),n+n/4));return qn.create("axes-mesh",{},r,o=>{switch(o){case Cr.X:return e.colorX;case Cr.Y:return e.colorY;case Cr.Z:return e.colorZ;case Cr.XY:return e.planeColorXY;case Cr.XZ:return e.planeColorXZ;case Cr.YZ:return e.planeColorYZ;case Cr.Origin:return e.originColor;default:return xn.grey}},()=>1,()=>"")}(e);return qn.createRenderObject(t,{...C.getDefaultValues(Nt.Params),...e,ignoreLight:!0,cellSize:0})}(r),this.scene.add(this.meshRenderObject),t.axes.params.showLabels?(this.textRenderObject=function Grt(e){const t=function zrt(e,t){const n=100*e.scale,r=function Vrt(e,t){const n=wf.create(e,8,8,t),r=100*e.scale,i=v.scale(v(),v.unitX,r),o=v.scale(v(),v.unitY,r),s=v.scale(v(),v.unitZ,r),a=100*e.labelScale;return n.add(e.labelX,i[0],i[1],i[2],0,a,Cr.X),n.add(e.labelY,o[0],o[1],o[2],0,a,Cr.Y),n.add(e.labelZ,s[0],s[1],s[2],0,a,Cr.Z),n.getText()}(e,t?.geometry);r.setBoundingSphere(_e.create(v.create(n/2,n/2,n/2),n));return qn.create("axes-text",{},r,o=>{switch(o){case Cr.X:return e.labelColorX;case Cr.Y:return e.labelColorY;case Cr.Z:return e.labelColorZ;default:return xn.grey}},()=>1,()=>"")}(e);return qn.createRenderObject(t,{...C.getDefaultValues(vu.Params),...e,alpha:e.labelOpacity,cellSize:0})}(r),this.scene.add(this.textRenderObject)):this.textRenderObject=void 0,this.scene.commit(),v.set(this.camera.position,0,0,200*r.scale),le.lookAt(this.camera.view,this.camera.position,this.camera.target,this.camera.up),n.axes.params={...t.axes.params}}})}get isEnabled(){return"on"===this.props.axes.name}getLoci(t){const{objectId:n,groupId:r,instanceId:i}=t;return(this.meshRenderObject&&n===this.meshRenderObject.id||this.textRenderObject&&n===this.textRenderObject.id)&&r!==Cr.None?function Frt(e,t,n){return eE("camera-axes",e,[{groupId:t,instanceId:n}],void 0,()=>function Nrt(e,t){const n=t.props.axes,r="on"===n.name?n.params.labelX:"X",i="on"===n.name?n.params.labelY:"Y",o="on"===n.name?n.params.labelZ:"Z";switch(e){case Cr.X:return`${r} Axis`;case Cr.Y:return`${i} Axis`;case Cr.Z:return`${o} Axis`;case Cr.XY:return`${r}${i} Plane`;case Cr.XZ:return`${r}${o} Plane`;case Cr.YZ:return`${i}${o} Plane`;case Cr.Origin:return"Origin";default:return"Axes"}}(t,e))}(this,r,i):$n}mark(t,n){return!(!Us.is(Us.Highlighting,n)||!(Uc(t)||O8(t)&&t.data===this))&&(Sn.mark(this.meshRenderObject,t,n,this.eachGroup)||Sn.mark(this.textRenderObject,t,n,this.eachGroup))}update(t){if(!this.meshRenderObject||"off"===this.props.axes.name)return;this.pixelRatio!==this.webgl.pixelRatio&&this.setProps(this.props),function Brt(e,t,n){const{near:r,far:i}=e,o=-t.width/2,s=t.width/2,a=t.height/2,c=-t.height/2,u=(s-o)/2,l=(a-c)/2,d=(s+o)/2,f=(a+c)/2;let p=d-u,m=d+u,h=f+l,g=f-l;if(n.enabled){const y=(s-o)/n.width,b=(a-c)/n.height;p+=y*n.offsetX,m=p+y*n.width,h-=b*n.offsetY,g=h-b*n.height}le.ortho(e.projection,p,m,h,g,r,i)}(this.camera,t.viewport,t.viewOffset),le.extractRotation(this.scene.view,t.view);const n=this.textRenderObject?this.textRenderObject.values.boundingSphere.ref.value.radius:this.meshRenderObject.values.boundingSphere.ref.value.radius,r=this.props.axes.params.location,i=this.props.axes.params.locationOffsetX*this.pixelRatio,o=this.props.axes.params.locationOffsetY*this.pixelRatio;"bottom-left"===r?le.setTranslation(this.scene.view,v.create(-t.viewport.width/2+n+i,-t.viewport.height/2+n+o,0)):"bottom-right"===r?le.setTranslation(this.scene.view,v.create(t.viewport.width/2-n-i,-t.viewport.height/2+n+o,0)):"top-left"===r?le.setTranslation(this.scene.view,v.create(-t.viewport.width/2+n+i,t.viewport.height/2-n-o,0)):"top-right"===r?le.setTranslation(this.scene.view,v.create(t.viewport.width/2-n-i,t.viewport.height/2-n-o,0)):Rr()}}var Cr=function(e){return e[e.None=0]="None",e[e.X=1]="X",e[e.Y=2]="Y",e[e.Z=3]="Z",e[e.XY=4]="XY",e[e.XZ=5]="XZ",e[e.YZ=6]="YZ",e[e.Origin=7]="Origin",e}(Cr||{});function O8(e){return"data-loci"===e.kind&&"camera-axes"===e.tag}const jrt={transparentBackground:C.Boolean(!1),dpoitIterations:C.Numeric(2,{min:1,max:10,step:1}),multiSample:C.Group(Cue),postprocessing:C.Group(Sue),marking:C.Group(Eue),cameraHelper:C.Group(IE)};class Hrt{get colorTarget(){return this._colorTarget}get width(){return this._width}get height(){return this._height}constructor(t,n,r,i,o,s,a,c){this.webgl=t,this.renderer=r,this.scene=i,this.camera=o,this._width=0,this._height=0,this._camera=new gr,this.props={...C.getDefaultValues(jrt),...c},this.drawPass=new Mue(t,n,128,128,a),this.multiSamplePass=new AE(t,this.drawPass),this.multiSampleHelper=new wue(this.multiSamplePass),this.helper={camera:new Rue(t,this.props.cameraHelper),debug:s.debug,handle:s.handle},this.setSize(1024,768)}updateBackground(){return new Promise(t=>{this.drawPass.postprocessing.background.update(this.camera,this.props.postprocessing.background,()=>{t()})})}setSize(t,n){t===this._width&&n===this._height||(this._width=t,this._height=n,this.drawPass.setSize(t,n),this.multiSamplePass.syncSize())}setProps(t={}){Object.assign(this.props,t),t.cameraHelper&&this.helper.camera.setProps(t.cameraHelper)}render(){gr.copySnapshot(this._camera.state,this.camera.state),Lo.set(this._camera.viewport,0,0,this._width,this._height),this._camera.update();const t={renderer:this.renderer,camera:this._camera,scene:this.scene,helper:this.helper};AE.isEnabled(this.props.multiSample)?(this.multiSampleHelper.render(t,this.props,!1),this._colorTarget=this.multiSamplePass.colorTarget):(this.drawPass.render(t,this.props,!1),this._colorTarget=this.drawPass.getColorTarget(this.props.postprocessing))}getImageData(t,n,r){var i,o;this.setSize(t,n),this.render(),this.colorTarget.bind();const s=null!==(i=r?.width)&&void 0!==i?i:t,a=null!==(o=r?.height)&&void 0!==o?o:n,c=new Uint8Array(s*a*4);r?this.webgl.readPixels(r.x,n-r.y-r.height,s,a,c):this.webgl.readPixels(0,0,s,a,c);const u=d0.create(c,s,a);return d0.flipY(u),d0.divideByAlpha(u),new ImageData(new Uint8ClampedArray(c),s,a)}}const qrt={...Nt.Params,alpha:{...Nt.Params.alpha,defaultValue:1},ignoreLight:{...Nt.Params.ignoreLight,defaultValue:!0},colorX:C.Color(xn.red,{isEssential:!0}),colorY:C.Color(xn.green,{isEssential:!0}),colorZ:C.Color(xn.blue,{isEssential:!0}),scale:C.Numeric(.33,{min:.1,max:2,step:.1},{isEssential:!0})},kue={handle:C.MappedStatic("off",{on:C.Group(qrt),off:C.Group({})},{cycle:!0,description:"Show handle tool"})};class Wrt{getBoundingSphere(t,n){return this.renderObject&&(_e.copy(t,this.renderObject.values.invariantBoundingSphere.ref.value),le.fromArray(this._transform,this.renderObject.values.aTransform.ref.value,16*n),_e.transform(t,t,this._transform)),t}setProps(t){this.props=c0(this.props,n=>{if(void 0!==t.handle&&(n.handle.name=t.handle.name,"on"===t.handle.name)){this.scene.clear(),this.pixelRatio=this.webgl.pixelRatio;const r={...t.handle.params,scale:t.handle.params.scale*this.webgl.pixelRatio,cellSize:0};this.renderObject=function Krt(e){const t=function Xrt(e,t){const n=10*e.scale,r=function $rt(e,t){const n=at.createState(512,256,t),r=.05*e,i=v.scale(v(),v.unitX,e),o=v.scale(v(),v.unitY,e),s=v.scale(v(),v.unitZ,e),a={radiusTop:r,radiusBottom:r,radialSegments:32};return n.currentGroup=P0.TranslateScreenXY,Zn(n,v.origin,3*r,2),n.currentGroup=P0.TranslateObjectX,Zn(n,i,r,2),Hn(n,v.origin,i,1,a),n.currentGroup=P0.TranslateObjectY,Zn(n,o,r,2),Hn(n,v.origin,o,1,a),n.currentGroup=P0.TranslateObjectZ,Zn(n,s,r,2),Hn(n,v.origin,s,1,a),at.getMesh(n)}(n,t?.geometry);r.setBoundingSphere(_e.create(v.create(n/2,n/2,n/2),n+n/4));return qn.create("handle",{},r,o=>{switch(o){case P0.TranslateObjectX:return e.colorX;case P0.TranslateObjectY:return e.colorY;case P0.TranslateObjectZ:return e.colorZ;default:return xn.grey}},()=>1,()=>"")}(e);return qn.createRenderObject(t,e)}(r),this.scene.add(this.renderObject),this.scene.commit(),n.handle.params={...t.handle.params}}})}get isEnabled(){return"on"===this.props.handle.name}update(t,n,r){this.renderObject&&(this.pixelRatio!==this.webgl.pixelRatio&&this.setProps(this.props),le.setTranslation(this.renderObject.values.aTransform.ref.value,n),le.fromMat3(this.renderObject.values.aTransform.ref.value,r),k.update(this.renderObject.values.aTransform,this.renderObject.values.aTransform.ref.value),this.scene.update([this.renderObject],!0))}getLoci(t){const{objectId:n,groupId:r,instanceId:i}=t;return this.renderObject&&n===this.renderObject.id?function Yrt(e,t,n){return eE("handle",e,[{groupId:t,instanceId:n}],r=>e.getBoundingSphere(r,n),()=>`Handle Helper | Group Id ${t} | Instance Id ${n}`)}(this,r,i):$n}mark(t,n){return!(!Us.is(Us.Highlighting,n)||!(Uc(t)||Nue(t)&&t.data===this))&&Sn.mark(this.renderObject,t,n,this.eachGroup)}constructor(t,n={}){this.webgl=t,this.props={handle:{name:"off",params:{}}},this.pixelRatio=1,this._transform=le(),this.eachGroup=(r,i)=>{if(!this.renderObject||!Nue(r))return!1;let o=!1;const s=this.renderObject.values.uGroupCount.ref.value,{elements:a}=r;for(const{groupId:c,instanceId:u}of a)i(Ce.ofSingleton(u*s+c))&&(o=!0);return o},this.scene=$v.create(t,"blended"),this.setProps(n)}}const P0={None:0,TranslateScreenXY:1,TranslateObjectX:3,TranslateObjectY:4,TranslateObjectZ:5};function Nue(e){return"data-loci"===e.kind&&"handle"===e.tag}const Zrt={debug:C.Group(E8),camera:C.Group({helper:C.Group(IE)}),handle:C.Group(kue)},Qrt=C.getDefaultValues(Zrt);class Jrt{constructor(t,n,r={}){const i={...Qrt,...r};this.debug=new Gtt(t,n,i.debug),this.camera=new Rue(t,i.camera.helper),this.handle=new Wrt(t,i.handle)}}class eit{constructor(t,n,r={}){this.webgl=t;const{gl:i}=t;this.draw=new Mue(t,n,i.drawingBufferWidth,i.drawingBufferHeight,r.transparency||"blended"),this.pick=new drt(t,this.draw,r.pickScale||.25),this.multiSample=new AE(t,this.draw)}setPickScale(t){this.pick.setPickScale(t)}setTransparency(t){this.draw.setTransparency(t)}updateSize(){const{gl:t}=this.webgl,n=Math.max(t.drawingBufferWidth,2),r=Math.max(t.drawingBufferHeight,2);this.draw.setSize(n,r),this.pick.syncSize(),this.multiSample.syncSize()}}const nit={...vo,tPreviousLevel:jt("texture","alpha","float","nearest"),uInvSize:xe("v2"),uOffset:xe("v2")},rit=Br("hi-z",ps,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform sampler2D tPreviousLevel;\nuniform vec2 uInvSize;\nuniform vec2 uOffset;\n\nvoid main(void) {\n vec2 position = gl_FragCoord.xy * uInvSize + uOffset;\n\n float x = texture(tPreviousLevel, position).r;\n float y = textureOffset(tPreviousLevel, position, ivec2(-1, 0)).r;\n float z = textureOffset(tPreviousLevel, position, ivec2(-1, -1)).r;\n float w = textureOffset(tPreviousLevel, position, ivec2(0, -1)).r;\n\n gl_FragColor = vec4(max(max(x, y), max(z, w)));\n}\n"),Fue=new ArrayBuffer(4);new Int32Array(Fue),new Float32Array(Fue);const Bue=new ArrayBuffer(4),cit=new Int32Array(Bue),uit=new Float32Array(Bue);function Kv(e){return function lit(e){return cit[0]=(1<<23)*((e<-126?-126:e)+126.94269504),uit[0]}(1.44269504*e)}const Oue=new ArrayBuffer(8);new Int32Array(Oue),new Float32Array(Oue);const Uue=new ArrayBuffer(4),dit=new Int32Array(Uue),fit=new Float32Array(Uue);Math,Math,Math,Math,Math,Math,Math,Math,Math;const Gue=new ArrayBuffer(16);new Int32Array(Gue),new Float32Array(Gue);const jue=new ArrayBuffer(8);new Int32Array(jue),new Float32Array(jue);const que=new ArrayBuffer(4);new Int32Array(que),new Float32Array(que),Math;const Ait=v.transformMat4,$ue=nn.set,Iit=function V8(e){return fit[0]=e,1.1920928955078125e-7*dit[0]-126.94269504};function PE(e,t,n,r){return-1===r[11]?function Tit(e,t,n){return t*n/((n-t)*e-n)}(e,t,n):function Dit(e,t,n){return e*(t-n)-t}(e,t,n)}const Yue={enabled:C.Boolean(!1,{description:"Hierarchical Z-buffer occlusion culling. Only available for WebGL2."}),maxFrameLag:C.Numeric(10,{min:1,max:30,step:1},{description:"Maximum number of frames to wait for Z-buffer data."}),minLevel:C.Numeric(3,{min:1,max:10,step:1})};class Rit{clear(){if(!this.supported)return;const{gl:t}=this.webgl;Wt(t)&&(null!==this.sync&&(t.deleteSync(this.sync),this.sync=null),this.frameLag=0,this.ready=!1,this.debug&&(this.debug.rect.style.display="none",this.debug.container.style.display="none"))}render(t){if(!this.supported||!this.props.enabled)return;const{gl:n,state:r}=this.webgl;if(!Wt(n)||null!==this.sync)return;this.nextNear=t.near,this.nextFar=t.far,le.copy(this.nextView,t.view),le.copy(this.nextProjection,t.projection),lt&&this.webgl.timer.mark("hi-Z"),r.disable(n.CULL_FACE),r.disable(n.BLEND),r.disable(n.DEPTH_TEST),r.disable(n.SCISSOR_TEST),r.depthMask(!1),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0);const i=this.renderable.values,o=Math.pow(2,Math.ceil(Math.log(Math.max(n.drawingBufferWidth,n.drawingBufferHeight))/Math.log(2))-1);for(let c=0,u=this.levelData.length;c0?(k.update(i.uInvSize,l.invSize),k.update(i.uOffset,Me.set(i.uOffset.ref.value,0,0)),k.update(i.tPreviousLevel,this.levelData[c-1].texture)):(k.update(i.uInvSize,Me.set(i.uInvSize.ref.value,1/o,1/o)),k.update(i.uOffset,Me.set(i.uOffset.ref.value,this.viewport.x/n.drawingBufferWidth,this.viewport.y/n.drawingBufferHeight)),k.update(i.tPreviousLevel,this.drawPass.depthTextureOpaque)),r.currentRenderItemId=-1,r.viewport(0,0,l.size[0],l.size[1]),n.clear(n.COLOR_BUFFER_BIT),this.renderable.update(),this.renderable.render(),c>=this.props.minLevel&&(this.tex.bind(0),n.copyTexSubImage2D(n.TEXTURE_2D,0,l.offset,0,0,0,l.size[0],l.size[1]),this.tex.unbind(0))}this.tex.attachFramebuffer(this.fb,0);const s=this.tex.getWidth(),a=this.tex.getHeight();n.bindBuffer(n.PIXEL_PACK_BUFFER,this.buf),n.bufferData(n.PIXEL_PACK_BUFFER,this.buffer.byteLength,n.STREAM_READ),n.readPixels(0,0,s,a,n.RED,n.FLOAT,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null),this.sync=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0),n.flush(),lt&&this.webgl.timer.markEnd("hi-Z")}tick(){if(!this.supported||!this.props.enabled||null===this.sync)return;const{gl:t}=this.webgl;if(!Wt(t))return;const n=t.clientWaitSync(this.sync,0,0);n===t.WAIT_FAILED||this.frameLag>=this.props.maxFrameLag?(t.deleteSync(this.sync),this.sync=null,this.frameLag=0,this.ready=!1):n===t.TIMEOUT_EXPIRED?this.frameLag+=1:(t.bindBuffer(t.PIXEL_PACK_BUFFER,this.buf),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this.buffer),t.bindBuffer(t.PIXEL_PACK_BUFFER,null),t.deleteSync(this.sync),this.sync=null,this.frameLag=0,this.ready=!0,this.near=this.nextNear,this.far=this.nextFar,le.copy(this.view,this.nextView),le.copy(this.projection,this.nextProjection))}transform(t){const{view:n,vp:r}=this;return Ait(r,t.center,n),{vp:r,r:1.2*t.radius+1.52}}project(t,n){const{projection:r,aabb:i,viewport:o}=this;!function Mit(e,t,n,r){return-1===r[11]?function Eit(e,t,n,r){const i=t[0]*n,o=t[1]*n,s=t[2]*n,a=t[2]*t[2]-n*n,c=Math.sqrt(t[0]*t[0]+a),u=(c*t[0]-s)/(c*t[2]+i)*r[0],l=(c*t[0]+s)/(c*t[2]-i)*r[0],d=Math.sqrt(t[1]*t[1]+a);return $ue(e,-.5*l+.5,(d*t[1]-s)/(d*t[2]+o)*r[5]*.5+.5,-.5*u+.5,(d*t[1]+s)/(d*t[2]-o)*r[5]*.5+.5)}(e,t,n,r):function Pit(e,t,n,r){const i=r[0],o=r[5];return $ue(e,(t[0]-n)*i*.5+.5,(t[1]+n)*o*-.5+.5,(t[0]+n)*i*.5+.5,(t[1]-n)*o*-.5+.5)}(e,t,n,r)}(i,t,n,r);const s=i[2]-i[0],a=i[3]-i[1],c=Math.max(s*o.width,a*o.height);return{aabb:i,w:s,h:a,pr:c,lod:Math.ceil(Iit(c/2))}}setViewport(t,n,r,i){if(!this.supported)return;r=Math.max(r,2),i=Math.max(i,2),Lo.set(this.viewport,t,n,r,i);const o=Math.ceil(Math.log(Math.max(r,i))/Math.log(2));if(o===this.levelData.length)return;const{minLevel:s}=this.props;this.buffer=new Float32Array(Math.pow(2,o-s)*Math.pow(2,o-1-s)),this.tex.define(Math.pow(2,o-s),Math.pow(2,o-1-s));for(const c of this.levelData)c.framebuffer.destroy(),c.texture.destroy();this.levelData.length=0;for(let c=0;c=s&&(this.levelData[c].offset=a,a+=l.size[0])}this.clear()}setProps(t){if(this.supported)if(this.props.minLevel!==t.minLevel){Object.assign(this.props,t);const{x:n,y:r,width:i,height:o}=this.viewport;this.setViewport(n,r,i,o)}else Object.assign(this.props,t),this.props.enabled||this.clear()}initDebug(t){if(!t.parentElement)return;const n=document.createElement("div");Object.assign(n.style,{display:"block",position:"absolute",pointerEvents:"none"}),t.parentElement.appendChild(n);const r=document.createElement("canvas"),i=r.getContext("2d");if(!i)throw new Error("Could not create canvas 2d context");Object.assign(r.style,{width:"100%",height:"100%",imageRendering:"pixelated",position:"relative",pointerEvents:"none"}),n.appendChild(r);const o=document.createElement("div");Object.assign(o.style,{display:"none",position:"absolute",pointerEvents:"none"}),t.parentElement.appendChild(o),this.debug={container:n,canvas:r,ctx:i,rect:o}}canDebug(t){return this.supported&&this.props.enabled&&this.ready&&!!this.debug}showRect(t,n){if(!this.canDebug(this.debug))return;const{gl:{drawingBufferHeight:r},pixelRatio:i}=this.webgl,{viewport:{x:o,y:s,width:a,height:c}}=this,u=(t[0]*a+o)/i,l=(t[1]*c-s)/i;Object.assign(this.debug.rect.style,{border:n?"solid red":"solid green",display:"block",left:`${u}px`,top:`${l+(r-c)/i}px`,width:(t[2]*a+o)/i-u+"px",height:(t[3]*c-s)/i-l+"px"})}showBuffer(t){if(!this.canDebug(this.debug))return;if(t>=this.levelData.length||t{if(!this.supported||!this.props.enabled||!this.ready)return!1;const{vp:l,r:d}=this.transform(u),{near:f,far:p,projection:m}=this,h=l[2]+d;if(-h=this.levelData.length||x=w||T+1>=w)return!1;const N=(w-T-1)*M+R+_;if(h>PE(this.buffer[N],f,p,m)||h>PE(this.buffer[N+1],f,p,m))return!1;const V=(w-T+1-1)*M+R+_;return!(h>PE(this.buffer[V],f,p,m)||h>PE(this.buffer[V+1],f,p,m))};const{gl:o,extensions:s}=t;if(!Wt(o)||!s.colorBufferFloat)return un&&console.log('Missing webgl2 and/or colorBufferFloat support required for "Hi-Z"'),void(this.supported=!1);this.fb=t.resources.framebuffer(),this.tex=t.resources.texture("image-float32","alpha","float","nearest"),this.tex.attachFramebuffer(this.fb,0);const a=o.getParameter(o.IMPLEMENTATION_COLOR_READ_FORMAT),c=o.getParameter(o.IMPLEMENTATION_COLOR_READ_TYPE);if(a!==o.RED||c!==o.FLOAT)return un&&console.log('Missing red/float reading support required for "Hi-Z"'),void(this.supported=!1);this.supported=!0,this.props={...C.getDefaultValues(Yue),...i},this.buf=WL(o),this.renderable=function iit(e,t){const n={..._o,tPreviousLevel:k.create(t),uInvSize:k.create(Me()),uOffset:k.create(Me())},r={...nit};return ji(zi(e,"triangles",rit,r,n),n)}(t,this.drawPass.depthTextureOpaque),un&&r&&this.initDebug(r)}}const Xue={camera:C.Group({mode:C.Select("perspective",C.arrayToOptions(["perspective","orthographic"]),{label:"Camera"}),helper:C.Group(IE,{isFlat:!0}),stereo:C.MappedStatic("off",{on:C.Group(Aue),off:C.Group({})},{cycle:!0,hideIf:e=>"perspective"!==e?.mode}),fov:C.Numeric(45,{min:10,max:130,step:1},{label:"Field of View"}),manualReset:C.Boolean(!1,{isHidden:!0})},{pivot:"mode"}),cameraFog:C.MappedStatic("on",{on:C.Group({intensity:C.Numeric(15,{min:1,max:100,step:1})}),off:C.Group({})},{cycle:!0,description:"Show fog in the distance"}),cameraClipping:C.Group({radius:C.Numeric(100,{min:0,max:99,step:1},{label:"Clipping",description:"How much of the scene to show."}),far:C.Boolean(!0,{description:"Hide scene in the distance"}),minNear:C.Numeric(5,{min:.1,max:100,step:.1},{description:"Note, may cause performance issues rendering impostors when set too small and cause issues with outline rendering when too close to 0."})},{pivot:"radius"}),viewport:C.MappedStatic("canvas",{canvas:C.Group({}),"static-frame":C.Group({x:C.Numeric(0),y:C.Numeric(0),width:C.Numeric(128),height:C.Numeric(128)}),"relative-frame":C.Group({x:C.Numeric(.33,{min:0,max:1,step:.01}),y:C.Numeric(.33,{min:0,max:1,step:.01}),width:C.Numeric(.5,{min:.01,max:1,step:.01}),height:C.Numeric(.5,{min:.01,max:1,step:.01})})}),cameraResetDurationMs:C.Numeric(250,{min:0,max:1e3,step:1},{description:"The time it takes to reset the camera."}),sceneRadiusFactor:C.Numeric(1,{min:1,max:10,step:.1}),transparentBackground:C.Boolean(!1),dpoitIterations:C.Numeric(2,{min:1,max:10,step:1}),pickPadding:C.Numeric(3,{min:0,max:10,step:1},{description:"extra pixels to around target to check in case target is empty"}),multiSample:C.Group(Cue),postprocessing:C.Group(Sue),marking:C.Group(Eue),hiZ:C.Group(Yue),renderer:C.Group(A8),trackball:C.Group(cue),interaction:C.Group(pue),debug:C.Group(E8),handle:C.Group(kue)},j8=C.getDefaultValues(Xue);var ME;!function(e){e.DefaultAttribs={powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,antialias:!0,preserveDrawingBuffer:!0,preferWebGl1:!1,handleResize:()=>{}},e.Params={pixelScale:C.Numeric(1,{min:.1,max:2,step:.05}),pickScale:C.Numeric(.25,{min:.1,max:1,step:.05}),transparency:C.Select("wboit",[["blended","Blended"],["wboit","Weighted, Blended"],["dpoit","Depth Peeling"]])},e.DefaultProps=C.getDefaultValues(e.Params),e.fromCanvas=function t(n,r,i={},o={}){const s={...e.DefaultAttribs,...i},a={...e.DefaultProps,...o},{powerPreference:c,failIfMajorPerformanceCaveat:u,antialias:l,preserveDrawingBuffer:d,preferWebGl1:f}=s,p=function A9e(e,t){function n(i){try{return e.getContext(i,t)}catch{return null}}const r=(t?.preferWebGl1?null:n("webgl2"))||n("webgl")||n("experimental-webgl");return un&&console.log(`isWebgl2: ${Wt(r)}`),r}(n,{powerPreference:c,failIfMajorPerformanceCaveat:u,antialias:l,preserveDrawingBuffer:d,alpha:!0,depth:!0,premultipliedAlpha:!0,preferWebGl1:f});if(null===p)throw new Error("Could not create a WebGL rendering context");const{pixelScale:m,pickScale:h,transparency:g}=a,y=w8.fromElement(n,{pixelScale:m,preventGestures:!0}),b=function P9e(e,t={}){const n=_re(e),r=function u7e(e,t){let n={},r=e.getParameter(e.FRONT_FACE),i=e.getParameter(e.CULL_FACE_MODE),o=e.getParameter(e.DEPTH_WRITEMASK),s=e.getParameter(e.DEPTH_CLEAR_VALUE),a=e.getParameter(e.DEPTH_FUNC),c=e.getParameter(e.COLOR_WRITEMASK),u=e.getParameter(e.COLOR_CLEAR_VALUE),l=e.getParameter(e.BLEND_SRC_RGB),d=e.getParameter(e.BLEND_DST_RGB),f=e.getParameter(e.BLEND_SRC_ALPHA),p=e.getParameter(e.BLEND_DST_ALPHA),m=e.getParameter(e.BLEND_COLOR),h=e.getParameter(e.BLEND_EQUATION_RGB),g=e.getParameter(e.BLEND_EQUATION_ALPHA),y=e.getParameter(e.STENCIL_FUNC),b=e.getParameter(e.STENCIL_VALUE_MASK),x=e.getParameter(e.STENCIL_REF),_=e.getParameter(e.STENCIL_BACK_FUNC),S=e.getParameter(e.STENCIL_BACK_VALUE_MASK),A=e.getParameter(e.STENCIL_BACK_REF),E=e.getParameter(e.STENCIL_WRITEMASK),w=e.getParameter(e.STENCIL_BACK_WRITEMASK),D=e.getParameter(e.STENCIL_FAIL),I=e.getParameter(e.STENCIL_PASS_DEPTH_PASS),R=e.getParameter(e.STENCIL_PASS_DEPTH_FAIL),T=e.getParameter(e.STENCIL_BACK_FAIL),M=e.getParameter(e.STENCIL_BACK_PASS_DEPTH_PASS),N=e.getParameter(e.STENCIL_BACK_PASS_DEPTH_FAIL),V=e.getParameter(e.MAX_VERTEX_ATTRIBS);const F=[];let G=e.getParameter(e.VIEWPORT),L=e.getParameter(e.SCISSOR_BOX),z=t.clipControl?e.getParameter(t.clipControl.CLIP_ORIGIN):-1,j=t.clipControl?e.getParameter(t.clipControl.CLIP_DEPTH_MODE):-1;const Z=()=>{for(let $=0;${!0!==n[$]&&(e.enable($),n[$]=!0)},disable:$=>{!1!==n[$]&&(e.disable($),n[$]=!1)},frontFace:$=>{$!==r&&(e.frontFace($),r=$)},cullFace:$=>{$!==i&&(e.cullFace($),i=$)},depthMask:$=>{$!==o&&(e.depthMask($),o=$)},clearDepth:$=>{$!==s&&(e.clearDepth($),s=$)},depthFunc:$=>{$!==a&&(e.depthFunc($),a=$)},colorMask:($,ee,q,O)=>{($!==c[0]||ee!==c[1]||q!==c[2]||O!==c[3])&&(e.colorMask($,ee,q,O),c[0]=$,c[1]=ee,c[2]=q,c[3]=O)},clearColor:($,ee,q,O)=>{($!==u[0]||ee!==u[1]||q!==u[2]||O!==u[3])&&(e.clearColor($,ee,q,O),u[0]=$,u[1]=ee,u[2]=q,u[3]=O)},blendFunc:($,ee)=>{($!==l||ee!==d||$!==f||ee!==p)&&(e.blendFunc($,ee),l=$,d=ee,f=$,p=ee)},blendFuncSeparate:($,ee,q,O)=>{($!==l||ee!==d||q!==f||O!==p)&&(e.blendFuncSeparate($,ee,q,O),l=$,d=ee,f=q,p=O)},blendEquation:$=>{($!==h||$!==g)&&(e.blendEquation($),h=$,g=$)},blendEquationSeparate:($,ee)=>{($!==h||ee!==g)&&(e.blendEquationSeparate($,ee),h=$,g=ee)},blendColor:($,ee,q,O)=>{($!==m[0]||ee!==m[1]||q!==m[2]||O!==m[3])&&(e.blendColor($,ee,q,O),m[0]=$,m[1]=ee,m[2]=q,m[3]=O)},stencilFunc:($,ee,q)=>{($!==y||ee!==x||q!==b||$!==_||ee!==A||q!==S)&&(e.stencilFunc($,ee,q),y=$,x=ee,b=q,_=$,A=ee,S=q)},stencilFuncSeparate:($,ee,q,O)=>{$===e.FRONT?(ee!==y||q!==x||O!==b)&&(e.stencilFuncSeparate($,ee,q,O),y=ee,x=q,b=O):$===e.BACK?(ee!==_||q!==A||O!==S)&&(e.stencilFuncSeparate($,ee,q,O),_=ee,A=q,S=O):$===e.FRONT_AND_BACK&&(ee!==y||q!==x||O!==b||ee!==_||q!==A||O!==S)&&(e.stencilFuncSeparate($,ee,q,O),y=ee,x=q,b=O,_=ee,A=q,S=O)},stencilMask:$=>{($!==E||$!==w)&&(e.stencilMask($),E=$,w=$)},stencilMaskSeparate:($,ee)=>{$===e.FRONT?ee!==E&&(e.stencilMaskSeparate($,ee),E=ee):$===e.BACK?ee!==w&&(e.stencilMaskSeparate($,ee),w=ee):$===e.FRONT_AND_BACK&&(ee!==E||ee!==w)&&(e.stencilMaskSeparate($,ee),E=ee,w=ee)},stencilOp:($,ee,q)=>{($!==D||ee!==R||q!==I||$!==T||ee!==N||q!==M)&&(e.stencilOp($,ee,q),D=$,R=ee,I=q,T=$,N=ee,M=q)},stencilOpSeparate:($,ee,q,O)=>{$===e.FRONT?(ee!==D||q!==R||O!==I)&&(e.stencilOpSeparate($,ee,q,O),D=ee,R=q,I=O):$===e.BACK?(ee!==T||q!==N||O!==M)&&(e.stencilOpSeparate($,ee,q,O),T=ee,N=q,M=O):$===e.FRONT_AND_BACK&&(ee!==D||q!==R||O!==I||ee!==T||q!==N||O!==M)&&(e.stencilOpSeparate($,ee,q,O),D=ee,R=q,I=O,T=ee,N=q,M=O)},enableVertexAttrib:$=>{e.enableVertexAttribArray($),F[$]=1},clearVertexAttribsState:Z,disableUnusedVertexAttribs:()=>{for(let $=0;${($!==G[0]||ee!==G[1]||q!==G[2]||O!==G[3])&&(e.viewport($,ee,q,O),G[0]=$,G[1]=ee,G[2]=q,G[3]=O)},scissor:($,ee,q,O)=>{($!==L[0]||ee!==L[1]||q!==L[2]||O!==L[3])&&(e.scissor($,ee,q,O),L[0]=$,L[1]=ee,L[2]=q,L[3]=O)},clipControl:t.clipControl?($,ee)=>{($!==z||ee!==j)&&(t.clipControl.clipControl($,ee),z=$,j=ee)}:void 0,reset:()=>{n={},r=e.getParameter(e.FRONT_FACE),i=e.getParameter(e.CULL_FACE_MODE),o=e.getParameter(e.DEPTH_WRITEMASK),s=e.getParameter(e.DEPTH_CLEAR_VALUE),a=e.getParameter(e.DEPTH_FUNC),c=e.getParameter(e.COLOR_WRITEMASK),u=e.getParameter(e.COLOR_CLEAR_VALUE),l=e.getParameter(e.BLEND_SRC_RGB),d=e.getParameter(e.BLEND_DST_RGB),f=e.getParameter(e.BLEND_SRC_ALPHA),p=e.getParameter(e.BLEND_DST_ALPHA),m=e.getParameter(e.BLEND_COLOR),h=e.getParameter(e.BLEND_EQUATION_RGB),g=e.getParameter(e.BLEND_EQUATION_ALPHA),y=e.getParameter(e.STENCIL_FUNC),b=e.getParameter(e.STENCIL_VALUE_MASK),x=e.getParameter(e.STENCIL_REF),_=e.getParameter(e.STENCIL_BACK_FUNC),S=e.getParameter(e.STENCIL_BACK_VALUE_MASK),A=e.getParameter(e.STENCIL_BACK_REF),E=e.getParameter(e.STENCIL_WRITEMASK),w=e.getParameter(e.STENCIL_BACK_WRITEMASK),D=e.getParameter(e.STENCIL_FAIL),I=e.getParameter(e.STENCIL_PASS_DEPTH_PASS),R=e.getParameter(e.STENCIL_PASS_DEPTH_FAIL),T=e.getParameter(e.STENCIL_BACK_FAIL),M=e.getParameter(e.STENCIL_BACK_PASS_DEPTH_PASS),N=e.getParameter(e.STENCIL_BACK_PASS_DEPTH_FAIL),V=e.getParameter(e.MAX_VERTEX_ATTRIBS),F.length=0;for(let $=0;${o&&(a.forEach((y,b)=>{o.deleteQuery(b)}),c.clear(),f=[],p=null)},g=()=>{if(!o)return;const y=function S9e(e){return e.disjointTimerQuery?e.disjointTimerQuery.createQuery():null}(t);y&&(o.beginQuery(o.TIME_ELAPSED,y),c.forEach((b,x)=>{b.queries.push(y)}),a.set(y,{refCount:c.size}),p=y)};return{resolve:()=>{const y=[];if(!o||!f.length)return y;a.forEach((x,_)=>{if(void 0!==x.timeElapsed)return;const S=o.getQueryParameter(_,o.QUERY_RESULT_AVAILABLE),A=e.getParameter(o.GPU_DISJOINT);if(S&&!A){const E=o.getQueryParameter(_,o.QUERY_RESULT);x.timeElapsed=E}(S||A)&&o.deleteQuery(_)});const b=[];for(const x of f)if(x.queries.every(_=>{var S;return void 0!==(null===(S=a.get(_))||void 0===S?void 0:S.timeElapsed)})){let _=0;for(const S of x.queries){const A=a.get(S);_+=A.timeElapsed,A.refCount-=1}if(x.timeElapsed=_,x.root){const S=[],A=(w,D)=>{for(const I of w){const R=I.timeElapsed,T=I.cpu.end-I.cpu.start,M={label:I.label,gpuElapsed:R,gpuAvg:l.add(I.label,R),cpuElapsed:T,cpuAvg:d.add(I.label,T),children:[],calls:I.calls};D.push(M),A(I.children,M.children)}};A(x.children,S);const E=x.cpu.end-x.cpu.start;y.push({label:x.label,gpuElapsed:_,gpuAvg:l.add(x.label,_),cpuElapsed:E,cpuAvg:d.add(x.label,E),children:S,calls:x.calls})}}else b.push(x);return f=b,a.forEach((x,_)=>{0===x.refCount&&a.delete(_)}),y},mark:(y,b=!1)=>{if(!o)return;if(c.has(y))throw new Error(`Timer mark for '${y}' already exists`);null!==p&&o.endQuery(o.TIME_ELAPSED);const x={label:y,queries:[],children:[],root:null===p,cpu:{start:yi(),end:-1},captureStats:b};if(c.set(y,x),u.length&&u[u.length-1].children.push(x),u.push(x),b){if(m)throw new Error("Already capturing stats");(function x9e(e){e.calls.drawInstanced=0,e.calls.drawInstancedBase=0,e.calls.multiDrawInstancedBase=0,e.calls.counts=0,e.culled.lod=0,e.culled.frustum=0,e.culled.occlusion=0})(n),m=!0}g()},markEnd:y=>{var b;if(!o)return;const x=c.get(y);if(!x)throw new Error(`Timer mark for '${y}' does not exist`);if((null===(b=u.pop())||void 0===b?void 0:b.label)!==y)throw new Error(`Timer mark for '${y}' has pending nested mark`);o.endQuery(o.TIME_ELAPSED),c.delete(y),x.cpu.end=yi(),x.captureStats&&(x.calls={...n.calls},m=!1),f.push(x),c.size>0?g():p=null},stats:()=>({gpu:l.stats(),cpu:d.stats()}),formatedStats:()=>{const y={},b=l.stats(),x=d.stats();for(const _ of Object.keys(b)){const S=`${(b[_]/1e3/1e3).toFixed(2)}`,A=`${x[_].toFixed(2)}`;y[_]=`${S} ms | CPU: ${A} ms`}return y},clear:h,destroy:()=>{h()}}}(e,n,i),a={maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),max3dTextureSize:Wt(e)?e.getParameter(e.MAX_3D_TEXTURE_SIZE):0,maxRenderbufferSize:e.getParameter(e.MAX_RENDERBUFFER_SIZE),maxDrawBuffers:n.drawBuffers?e.getParameter(n.drawBuffers.MAX_DRAW_BUFFERS):0,maxTextureImageUnits:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)};if(a.maxVertexTextureImageUnits<8)throw new Error('Need "MAX_VERTEX_TEXTURE_IMAGE_UNITS" >= 8');const c=n.provokingVertex;c?.provokingVertex(c.FIRST_VERTEX_CONVENTION);let u=!1;const l=new Ao(0);let f,d=t.pixelScale||1;if(Wt(e)){const m=e.createBuffer();let h,g,y=!1;const b=()=>{e.bindBuffer(e.PIXEL_PACK_BUFFER,m),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,h),e.bindBuffer(e.PIXEL_PACK_BUFFER,null),y=!1,g(),g=void 0,h=void 0};f=(x,_,S,A,E)=>new Promise((w,D)=>{y?D("Can not call multiple readPixelsAsync at the same time"):(y=!0,e.bindBuffer(e.PIXEL_PACK_BUFFER,m),e.bufferData(e.PIXEL_PACK_BUFFER,S*A*4,e.STREAM_READ),e.readPixels(x,_,S,A,e.RGBA,e.UNSIGNED_BYTE,0),e.bindBuffer(e.PIXEL_PACK_BUFFER,null),g=w,h=E,Vre(e,b))})}else f=function(){var m=ie(function*(h,g,y,b,x){YL(e,h,g,y,b,x)});return function(g,y,b,x,_){return m.apply(this,arguments)}}();const p=new Set;return{gl:e,isWebGL2:Wt(e),get pixelRatio(){return(typeof window<"u"&&window.devicePixelRatio||1)*(d||1)},extensions:n,state:r,stats:i,resources:o,timer:s,get maxTextureSize(){return a.maxTextureSize},get max3dTextureSize(){return a.max3dTextureSize},get maxRenderbufferSize(){return a.maxRenderbufferSize},get maxDrawBuffers(){return a.maxDrawBuffers},get maxTextureImageUnits(){return a.maxTextureImageUnits},namedComputeRenderables:Object.create(null),namedFramebuffers:Object.create(null),namedTextures:Object.create(null),get isContextLost(){return u||e.isContextLost()},contextRestored:l,setContextLost:()=>{u=!0},handleContextRestored:m=>{Object.assign(n,_re(e)),r.reset(),r.currentMaterialId=-1,r.currentProgramId=-1,r.currentRenderItemId=-1,o.reset(),p.forEach(h=>h.reset()),m?.(),u=!1,l.next(yi())},setPixelScale:m=>{d=m},createRenderTarget:(m,h,g,y,b,x)=>{const _=function b9e(e,t,n,r,i=!0,o="uint8",s="nearest",a="rgba"){if("alpha"===a&&!Wt(e))throw new Error("cannot render to alpha format in webgl1");const c=t.framebuffer(),u="fp16"===o?t.texture("image-float16",a,"fp16",s):"float32"===o?t.texture("image-float32",a,"float",s):t.texture("image-uint8",a,"ubyte",s),l=i?Wt(e)?t.renderbuffer("depth32f","depth",n,r):t.renderbuffer("depth16","depth",n,r):null;function d(){u.define(n,r),u.attachFramebuffer(c,"color0"),l&&l.attachFramebuffer(c)}d();let f=!1;return{id:kre(),texture:u,framebuffer:c,depthRenderbuffer:l,getWidth:()=>n,getHeight:()=>r,bind:()=>{c.bind()},setSize:(p,m)=>{n===p&&r===m||(u.define(n=p,r=m),l&&l.setSize(n,r))},reset:()=>{d()},destroy:()=>{f||(u.destroy(),c.destroy(),l&&l.destroy(),f=!0)}}}(e,o,m,h,g,y,b,x);return p.add(_),{..._,destroy:()=>{_.destroy(),p.delete(_)}}},unbindFramebuffer:()=>gD(e),readPixels:(m,h,g,y,b)=>{YL(e,m,h,g,y,b)},readPixelsAsync:f,waitForGpuCommandsComplete:()=>function T9e(e){return new Promise(t=>{Wt(e)?Vre(e,t):(zre||(console.info("Sync object not supported in WebGL"),zre=!0),Gre(e),t())})}(e),waitForGpuCommandsCompleteSync:()=>Gre(e),getDrawingBufferPixelData:()=>function D9e(e,t){const n=e.drawingBufferWidth,r=e.drawingBufferHeight,i=new Uint8Array(n*r*4);return gD(e),t.viewport(0,0,n,r),YL(e,0,0,n,r,i),d0.flipY(d0.create(i,n,r))}(e,r),clear:(m,h,g,y)=>{gD(e),r.enable(e.SCISSOR_TEST),r.depthMask(!0),r.colorMask(!0,!0,!0,!0),r.clearColor(m,h,g,y),r.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),r.scissor(0,0,e.drawingBufferWidth,e.drawingBufferHeight),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)},destroy:m=>{var h,g;o.destroy(),function I9e(e){const t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);for(let i=0;i{b.isContextLost||!D.shiftKey||!D.ctrlKey||!D.altKey||(un&&console.log("lose context"),w.loseContext(),setTimeout(()=>{b.isContextLost&&(un&&console.log("restore context"),w.restoreContext())},1e3))},!1)}const _=new Ao(0),S=w=>{b.setContextLost(),w.preventDefault(),un&&console.log("context lost"),_.next(yi())},A=()=>{b.isContextLost&&(b.handleContextRestored(()=>{x.draw.reset()}),un&&console.log("context restored"))};n.addEventListener("webglcontextlost",S,!1),n.addEventListener("webglcontextrestored",A,!1);const E=new Ao(void 0);return{canvas:n,webgl:b,input:y,passes:x,attribs:s,get props(){return{...a}},contextLost:_,contextRestored:b.contextRestored,assetManager:r,changed:E,setProps:w=>{if(!w)return;let D=!1;void 0!==w.pixelScale&&w.pixelScale!==a.pixelScale&&(a.pixelScale=w.pixelScale,y.setPixelScale(w.pixelScale),b.setPixelScale(w.pixelScale),s.handleResize(),D=!0),void 0!==w.pickScale&&w.pickScale!==a.pickScale&&(a.pickScale=w.pickScale,x.setPickScale(w.pickScale),D=!0),void 0!==w.transparency&&w.transparency!==a.transparency&&(a.transparency=w.transparency,x.setTransparency(w.transparency),D=!0),D&&E.next(void 0)},dispose:w=>{y.dispose(),n.removeEventListener("webglcontextlost",S,!1),n.removeEventListener("webglcontextrestored",A,!1),b.destroy(w)}}}}(ME||(ME={}));const kit=typeof window<"u"?window.requestAnimationFrame:e=>setImmediate(()=>e(Date.now())),Kue=typeof window<"u"?window.cancelAnimationFrame:e=>clearImmediate(e);var H8;function Nit(e){Zue(e)}function Zue(e){Cn.Canvas3D.ResetSettings.subscribe(e,()=>{var t;null===(t=e.canvas3d)||void 0===t||t.setProps(j8),e.events.canvas3d.settingsUpdated.next(void 0)}),Cn.Canvas3D.SetSettings.subscribe(e,t=>{var n;e.canvas3d&&(null===(n=e.canvas3d)||void 0===n||n.setProps(t.settings),e.events.canvas3d.settingsUpdated.next(void 0))})}!function(e){e.create=function t(n,r={}){var i;const{webgl:o,input:s,passes:a,assetManager:c,canvas:u}=n,l={...Jl(j8),...Jl(r)},d=new Map,f=new Map,p=new Ao(0);let m=yi();const h=new Ao(0),g=new Ao(0),y=new Ao(0),{gl:b,contextRestored:x}=o;let _=0,S=0,A=128,E=128,w=!1,D=0;ln();const I=$v.create(o,n.props.transparency);function R(){return I.boundingSphere.radius*l.sceneRadiusFactor}const T=new gr({position:v.create(0,0,100),mode:l.camera.mode,fog:"on"===l.cameraFog.name?l.cameraFog.params.intensity:0,clipFar:l.cameraClipping.far,minNear:l.cameraClipping.minNear,fov:Yn(l.camera.fov)},{x:_,y:S,width:A,height:E}),M=new Xv(T,l.camera.stereo.params),N=D8.create(s,T,I,l.trackball),V=new Jrt(o,I,l),F=new Rit(o,a.draw,u,l.hiZ),G=T8.create(o,l.renderer);G.setOcclusionTest(F.isOccluded);const L=new frt(o,G,I,V,a.pick,{x:_,y:S,width:A,height:E},l.pickPadding),z=new Xtt(We,H,s,T,N,l.interaction),j=new wue(a.multiSample);a.draw.postprocessing.background.update(T,l.postprocessing.background,qe=>{qe&&me()});let $,ee,Z=!1,q=!1,O=!0;function H(qe){let dt=$n,gt=yn.Empty;if(qe){const se=V.camera.getLoci(qe);if(se!==$n)return{loci:se,repr:gt};dt=V.handle.getLoci(qe),d.forEach((he,ve)=>{const Te=ve.getLoci(qe);Ta(Te)||(Ta(dt)||console.warn("found another loci, this should not happen"),dt=Te,gt=ve)})}return{loci:dt,repr:gt}}let W=[];function X(qe,dt){const{repr:gt,loci:se}=qe;let he=!1;return gt?he=gt.mark(se,dt)||he:d.forEach((ve,Te)=>{he=Te.mark(se,dt)||he}),he=V.handle.mark(se,dt)||he,he=V.camera.mark(se,dt)||he,he}let ce=!1,be=!1;function ae(qe){be||function J(qe){if(o.isContextLost)return!1;let dt=!1;if(q&&(Et(!1),q=!1,dt=!0),_>b.drawingBufferWidth||_+A<0||S>b.drawingBufferHeight||S+E<0)return!1;const gt=function fe(){let qe=!1;for(const[dt,gt]of W)qe=X(dt,gt)||qe;return W=[],qe&&(I.update(void 0,!0),V.handle.scene.update(void 0,!0),V.camera.scene.update(void 0,!0)),qe}()&&(G.props.colorMarker||l.marking.enabled);let se=!1;N.update(D);const he=T.update(),ve=qe||he||dt||w;w=!1;const Te=j.update(gt||ve,l.multiSample);if(ve||Te||gt){let yt=T;"on"===l.camera.stereo.name&&(M.update(),yt=M),lt&&o.timer.mark("Canvas3D.render",!0);const xt={renderer:G,camera:yt,scene:I,helper:V};AE.isEnabled(l.multiSample)?j.render(xt,l,!0,l.multiSample.reduceFlicker&&!he&>&&!N.isAnimating):a.draw.render(xt,l,!0),F.render(T),lt&&o.timer.markEnd("Canvas3D.render"),L.dirty=L.dirty||ve,se=!0}return se}(!!qe?.force)&&O&&h.next(yi()-m)}function me(){w=!0}let oe=0;function K(qe,dt){D=qe,U(dt?.isSynchronous),T.transition.tick(D),F.tick(),!dt?.manualDraw&&(ae(),!T.transition.inTransition&&!o.isContextLost&&z.tick(D))}function ne(){K(yi()),oe=kit(ne)}function We(qe,dt){return o.isContextLost?void 0:L.identify(qe,dt,"on"===l.camera.stereo.name?M:T)}function U(qe=!1){(function Ge(qe){return!I.needsCommit||(_e.copy(ge,I.boundingSphereVisible),F.clear(),I.commit(qe?void 0:Ne)?(y.next(0),V.debug.isEnabled&&V.debug.update(),!l.camera.manualReset&&(0===p.value||function Re(){if(0===T.state.radiusMax)return!0;if(T.transition.inTransition||ee)return!1;let qe=!0,dt=!0;_e.set(Se,T.state.target,T.state.radius);for(const gt of I.renderables){if(!gt.state.visible)continue;const se=gt.values.boundingSphere.ref.value;if(!se.radius)continue;dt=!1;const he=v.distance(Se.center,se.center);if((he>Se.radius||he>se.radius||se.radius>T.state.radiusMax)&&!_e.includes(ge,se))return!0;_e.overlaps(Se,se)&&(qe=!1)}return qe||!dt&&Se.radius<=.1}())&&(Z=!0),0===ge.radius&&($=0),l.camera.manualReset||T.setState({radiusMax:R()},0),p.next(d.size),un&&$e(),!0):(y.next(I.commitQueueSize),!1))})(qe)&&(function Y(){if(!Z)return;const qe=I.boundingSphereVisible,{center:dt,radius:gt}=qe,se=N.props.autoAdjustMinMaxDistance;if("on"===se.name){const he=se.params.minDistanceFactor*gt+se.params.minDistancePadding,ve=Math.max(se.params.maxDistanceFactor*gt,se.params.maxDistanceMin);N.setProps({minDistance:he,maxDistance:ve})}if(gt>0){const he=void 0===$?l.cameraResetDurationMs:$,ve=T.getFocus(dt,gt),Te="function"==typeof ee?ee(I,T):ee,yt=Te?{...ve,...Te}:ve;T.setState({...yt,radiusMax:R()},he)}$=void 0,ee=void 0,Z=!1}(),ce&&(V.debug.isEnabled&&V.debug.update(),ae({force:!0}),ce=!1),g.next(yi()))}const ge=_e(),Se=_e(),Ne=250;function $e(){const qe=I.renderables.map(he=>({drawCount:he.values.drawCount.ref.value,instanceCount:he.values.instanceCount.ref.value,materialId:he.materialId,renderItemId:he.id}));console.groupCollapsed(`${qe.length} RenderItems`),qe.length<50?console.table(qe):console.log(qe),console.log(JSON.stringify(o.stats,void 0,4));const{texture:dt,attribute:gt,elements:se}=o.resources.getByteCounts();console.log(JSON.stringify({texture:`${(dt/1024/1024).toFixed(3)} MiB`,attribute:`${(gt/1024/1024).toFixed(3)} MiB`,elements:`${(se/1024/1024).toFixed(3)} MiB`},void 0,4)),console.log(JSON.stringify(o.timer.formatedStats(),void 0,4)),console.groupEnd()}function _t(){const qe=I.boundingSphere.radius>0?100-Math.round(T.transition.target.radius/R()*100):0;return{camera:{mode:T.state.mode,helper:{...V.camera.props},stereo:{...l.camera.stereo},fov:Math.round(su(T.state.fov)),manualReset:!!l.camera.manualReset},cameraFog:T.state.fog>0?{name:"on",params:{intensity:T.state.fog}}:{name:"off",params:{}},cameraClipping:{far:T.state.clipFar,radius:qe,minNear:T.state.minNear},cameraResetDurationMs:l.cameraResetDurationMs,sceneRadiusFactor:l.sceneRadiusFactor,transparentBackground:l.transparentBackground,dpoitIterations:l.dpoitIterations,pickPadding:l.pickPadding,viewport:l.viewport,postprocessing:{...l.postprocessing},marking:{...l.marking},multiSample:{...l.multiSample},hiZ:{...F.props},renderer:{...G.props},trackball:{...N.props},interaction:{...z.props},debug:{...V.debug.props},handle:{...V.handle.props}}}const ut=x.subscribe(()=>{L.dirty=!0,ae({force:!0}),ae({force:!0})}),Ct=new Ao(0);function Et(qe=!0){a.updateSize(),ln(),Qn(),qe&&me(),Ct.next(+new Date)}!function FMe(e){Jx.includes(e)||Jx.push(e)}($e);const Xt=null===(i=n.changed)||void 0===i?void 0:i.subscribe(()=>{I.setTransparency(n.props.transparency),me()});if(un&&u){let qe;const dt=gt=>{const se=gt&&pn.getBoundingSphere(pn.normalize(gt,"residue"));F.debugOcclusion(se)};s.click.subscribe(gt=>{if(!gt.modifiers.control||2!==gt.button)return;const se=We(gt.x,gt.y);if(!se)return qe=void 0,void dt(qe);qe=H(se.id).loci,dt(qe)}),h.subscribe(()=>{setTimeout(()=>{dt(qe)},100)})}return{webgl:o,add:function tt(qe){!function Xe(qe){f.has(qe)||f.set(qe,qe.updated.subscribe(dt=>{qe.state.syncManually||tt(qe)}))}(qe);const dt=d.get(qe),gt=new Set;qe.renderObjects.forEach(se=>gt.add(se)),dt?Si.areEqual(gt,dt)||(gt.forEach(se=>{dt.has(se)||I.add(se)}),dt.forEach(se=>{gt.has(se)||I.remove(se)})):qe.renderObjects.forEach(se=>I.add(se)),d.set(qe,gt),I.update(qe.renderObjects,!1),ce=!0,un&&$e()},remove:function ke(qe){!function ot(qe){const dt=f.get(qe);dt&&(dt.unsubscribe(),f.delete(qe))}(qe);const dt=d.get(qe);dt&&(dt.forEach(gt=>I.remove(gt)),d.delete(qe),ce=!0,un&&$e())},commit:U,update:(qe,dt)=>{if(qe){if(!d.has(qe))return;I.update(qe.renderObjects,!!dt)}else I.update(void 0,!!dt);ce=!0},clear:()=>{f.forEach(qe=>qe.unsubscribe()),f.clear(),d.clear(),I.clear(),V.debug.clear(),me(),p.next(d.size)},syncVisibility:()=>{0===T.state.radiusMax&&(Z=!0,$=0),I.syncVisibility()&&V.debug.isEnabled&&V.debug.update(),me()},requestDraw:me,tick:K,animate:function we(){be=!1,N.start(yi()),0===oe&&ne()},resetTime:function de(qe){m=qe,N.start(qe)},pause:function Le(qe=!1){be=qe,Kue(oe),oe=0},resume:()=>{be=!1},identify:We,mark:function Q(qe,dt){W.push([qe,dt])},getLoci:H,handleResize:Et,requestResize:()=>{q=!0},requestCameraReset:qe=>{$=qe?.durationMs,ee=qe?.snapshot,Z=!0},camera:T,boundingSphere:I.boundingSphere,boundingSphereVisible:I.boundingSphereVisible,get notifyDidDraw(){return O},set notifyDidDraw(qe){O=qe},didDraw:h,commited:g,commitQueueSize:y,reprCount:p,resized:Ct,setProps:(qe,dt=!1)=>{var gt,se,he,ve;const Te="function"==typeof qe?c0(_t(),qe):qe;void 0!==Te.sceneRadiusFactor&&(l.sceneRadiusFactor=Te.sceneRadiusFactor,T.setState({radiusMax:R()},0));const yt=Object.create(null);Te.camera&&void 0!==Te.camera.mode&&Te.camera.mode!==T.state.mode&&(yt.mode=Te.camera.mode);const xt=Math.round(su(T.state.fov));if(Te.camera&&void 0!==Te.camera.fov&&Te.camera.fov!==xt&&(yt.fov=Yn(Te.camera.fov)),void 0!==Te.cameraFog&&Te.cameraFog.params){const Ut="on"===Te.cameraFog.name?Te.cameraFog.params.intensity:0;Ut!==T.state.fog&&(yt.fog=Ut)}if(void 0!==Te.cameraClipping&&(void 0!==Te.cameraClipping.far&&Te.cameraClipping.far!==T.state.clipFar&&(yt.clipFar=Te.cameraClipping.far),void 0!==Te.cameraClipping.minNear&&Te.cameraClipping.minNear!==T.state.minNear&&(yt.minNear=Te.cameraClipping.minNear),void 0!==Te.cameraClipping.radius)){const Ut=R()/100*(100-Te.cameraClipping.radius);Ut>0&&Ut!==yt.radius&&(yt.radius=Math.max(Ut,.01))}Object.keys(yt).length>0&&T.setState(yt),!(null===(gt=Te.camera)||void 0===gt)&>.helper&&V.camera.setProps(Te.camera.helper),void 0!==(null===(se=Te.camera)||void 0===se?void 0:se.manualReset)&&(l.camera.manualReset=Te.camera.manualReset),void 0!==(null===(he=Te.camera)||void 0===he?void 0:he.stereo)&&(Object.assign(l.camera.stereo,Te.camera.stereo),M.setProps(l.camera.stereo.params)),void 0!==Te.cameraResetDurationMs&&(l.cameraResetDurationMs=Te.cameraResetDurationMs),void 0!==Te.transparentBackground&&(l.transparentBackground=Te.transparentBackground),void 0!==Te.dpoitIterations&&(l.dpoitIterations=Te.dpoitIterations),void 0!==Te.pickPadding&&(l.pickPadding=Te.pickPadding),void 0!==Te.viewport&&(l.viewport===Te.viewport||l.viewport.name===Te.viewport.name&&Hx(l.viewport.params,Te.viewport.params)||(l.viewport=Te.viewport,ln(),Qn())),!(null===(ve=Te.postprocessing)||void 0===ve)&&ve.background&&(Object.assign(l.postprocessing.background,Te.postprocessing.background),a.draw.postprocessing.background.update(T,l.postprocessing.background,Ut=>{Ut&&!dt&&me()})),Te.postprocessing&&Object.assign(l.postprocessing,Te.postprocessing),Te.marking&&Object.assign(l.marking,Te.marking),Te.multiSample&&Object.assign(l.multiSample,Te.multiSample),Te.hiZ&&F.setProps(Te.hiZ),Te.renderer&&G.setProps(Te.renderer),Te.trackball&&N.setProps(Te.trackball),Te.interaction&&z.setProps(Te.interaction),Te.debug&&V.debug.setProps(Te.debug),Te.handle&&V.handle.setProps(Te.handle),"orthographic"===yt.mode&&(l.camera.stereo.name="off"),dt||me()},getImagePass:(qe={})=>new Hrt(o,c,G,I,T,V,a.draw.transparency,qe),getRenderObjects(){const qe=[];return I.forEach((dt,gt)=>qe.push(gt)),qe},get props(){return _t()},get input(){return s},get stats(){return G.stats},get interaction(){return z.events},dispose:()=>{ut.unsubscribe(),Xt?.unsubscribe(),Kue(oe),W=[],I.clear(),V.debug.clear(),N.dispose(),G.dispose(),z.dispose(),F.dispose(),function BMe(e){const t=Jx.indexOf(e);-1!==t&&Jx.splice(t,1)}($e)}};function ln(){const qe=_,dt=S,gt=A,se=E;"canvas"===l.viewport.name?(_=0,S=0,A=b.drawingBufferWidth,E=b.drawingBufferHeight):"static-frame"===l.viewport.name?(_=l.viewport.params.x*o.pixelRatio,E=l.viewport.params.height*o.pixelRatio,S=b.drawingBufferHeight-E-l.viewport.params.y*o.pixelRatio,A=l.viewport.params.width*o.pixelRatio):"relative-frame"===l.viewport.name&&(_=Math.round(l.viewport.params.x*b.drawingBufferWidth),E=Math.round(l.viewport.params.height*b.drawingBufferHeight),S=Math.round(b.drawingBufferHeight-E-l.viewport.params.y*b.drawingBufferHeight),A=Math.round(l.viewport.params.width*b.drawingBufferWidth)),(qe!==_||dt!==S||gt!==A||se!==E)&&(w=!0)}function Qn(){L.setViewport(_,S,A,E),G.setViewport(_,S,A,E),Lo.set(T.viewport,_,S,A,E),Lo.set(N.viewport,_,S,A,E),F.setViewport(_,S,A,E)}}}(H8||(H8={}));const M0=Zi,Tm=wu,R0=At.Trigger,Fit={hoverHighlightOnly:At([R0(M0.Flag.None)],"Highlight","Hover element using ${triggers}"),hoverHighlightOnlyExtend:At([R0(M0.Flag.None,Tm.create({shift:!0}))],"Extend highlight","From selected to hovered element along polymer using ${triggers}")},Bit={bindings:C.Value(Fit,{isHidden:!0}),ignore:C.Value([],{isHidden:!0}),preferAtoms:C.Boolean(!1,{description:"Always prefer atoms over bonds"}),mark:C.Boolean(!0)},Oit=tr.create({name:"representation-highlight-loci",category:"interaction",ctor:class extends tr.Handler{constructor(){super(...arguments),this.lociMarkProvider=(e,t)=>{!this.ctx.canvas3d||!this.params.mark||this.ctx.canvas3d.mark(e,t)}}getLoci(e){return this.params.preferAtoms&&Lt.isLoci(e)&&2===e.bonds.length?Lt.toFirstStructureElementLoci(e):e}register(){this.subscribeObservable(this.ctx.behaviors.interaction.hover,({current:e,buttons:t,modifiers:n})=>{if(!this.ctx.canvas3d||this.ctx.isBusy)return;const r=this.getLoci(e.loci);if(this.params.ignore.includes(r.kind))return void this.ctx.managers.interactivity.lociHighlights.highlightOnly({repr:e.repr,loci:$n});let i=!1;At.match(this.params.bindings.hoverHighlightOnly,t,n)&&(this.ctx.managers.interactivity.lociHighlights.highlightOnly({loci:r}),i=!0),At.match(this.params.bindings.hoverHighlightOnlyExtend,t,n)&&(this.ctx.managers.interactivity.lociHighlights.highlightOnlyExtend({loci:r}),i=!0),i||this.ctx.managers.interactivity.lociHighlights.highlightOnly({repr:e.repr,loci:$n})}),this.ctx.managers.interactivity.lociHighlights.addProvider(this.lociMarkProvider)}unregister(){this.ctx.managers.interactivity.lociHighlights.removeProvider(this.lociMarkProvider)}},params:()=>Bit,display:{name:"Highlight Loci on Canvas"}}),Que={clickSelect:At.Empty,clickToggleExtend:At([R0(M0.Flag.Primary,Tm.create({shift:!0}))],"Toggle extended selection","Click on element using ${triggers} to extend selection along polymer"),clickSelectOnly:At.Empty,clickToggle:At([R0(M0.Flag.Primary,Tm.create())],"Toggle selection","Click on element using ${triggers}"),clickDeselect:At.Empty,clickDeselectAllOnEmpty:At([R0(M0.Flag.Primary,Tm.create())],"Deselect all","Click on nothing using ${triggers}")},Lit={bindings:C.Value(Que,{isHidden:!0}),ignore:C.Value([],{isHidden:!0}),preferAtoms:C.Boolean(!1,{description:"Always prefer atoms over bonds"}),mark:C.Boolean(!0)},Uit=tr.create({name:"representation-select-loci",category:"interaction",ctor:class extends tr.Handler{getLoci(e){return this.params.preferAtoms&&Lt.isLoci(e)&&2===e.bonds.length?Lt.toFirstStructureElementLoci(e):e}applySelectMark(e,t){const n=this.ctx.state.data.cells.get(e);if(n&&pe.isRepresentation3D(n.obj)){this.spine.current=n;const r=this.spine.getRootOfType(pe.Molecule.Structure);if(r){t&&this.lociMarkProvider({loci:Ve.Loci(r.data)},Bt.Deselect);const i=this.ctx.managers.structure.selection.getLoci(r.data);this.lociMarkProvider({loci:i},Bt.Select)}}}register(){const t=r=>!pn.isEmpty(r),n=[["clickSelect",r=>this.ctx.managers.interactivity.lociSelects.select(r),t],["clickToggle",r=>this.ctx.managers.interactivity.lociSelects.toggle(r),t],["clickToggleExtend",r=>this.ctx.managers.interactivity.lociSelects.toggleExtend(r),t],["clickSelectOnly",r=>this.ctx.managers.interactivity.lociSelects.selectOnly(r),t],["clickDeselect",r=>this.ctx.managers.interactivity.lociSelects.deselect(r),t],["clickDeselectAllOnEmpty",()=>this.ctx.managers.interactivity.lociSelects.deselectAll(),r=>pn.isEmpty(r)]];n.sort((r,i)=>{const o=this.params.bindings[r[0]],s=this.params.bindings[i[0]],a=0===o.triggers.length?0:Xd(o.triggers.map(u=>Tm.size(u.modifiers)));return(0===s.triggers.length?0:Xd(s.triggers.map(u=>Tm.size(u.modifiers))))-a}),this.subscribeObservable(this.ctx.behaviors.interaction.click,({current:r,button:i,modifiers:o})=>{if(!this.ctx.canvas3d||this.ctx.isBusy||!this.ctx.selectionMode)return;const s=this.getLoci(r.loci);if(!this.params.ignore.includes(s.kind))for(const[a,c,u]of n)if(At.match(this.params.bindings[a],i,o)&&(!u||u(s))){c({repr:r.repr,loci:s});break}}),this.ctx.managers.interactivity.lociSelects.addProvider(this.lociMarkProvider),this.subscribeObservable(this.ctx.state.events.object.created,({ref:r})=>this.applySelectMark(r)),this.subscribeObservable(this.ctx.state.events.object.updated,({ref:r,obj:i,oldObj:o,oldData:s,action:a})=>{const c=this.ctx.state.data.cells.get(r);if(c&&pe.Molecule.Structure.is(c.obj)){const u=i.data,l="recreate"===a?o?.data:"in-place"===a?s:void 0;if(l&&Ve.areEquivalent(u,l)&&Ve.areHierarchiesEqual(u,l))return;const d=this.ctx.state.data.select(In.children(r).ofType(pe.Molecule.Structure.Representation3D));for(const f of d)this.applySelectMark(f.transform.ref,!0)}})}unregister(){this.ctx.managers.interactivity.lociSelects.removeProvider(this.lociMarkProvider)}constructor(e,t){super(e,t),this.lociMarkProvider=(n,r)=>{!this.ctx.canvas3d||!this.params.mark||this.ctx.canvas3d.mark({loci:n.loci},r)},this.spine=new rD.Impl(e.state.data.cells)}},params:()=>Lit,display:{name:"Select Loci on Canvas"}}),Vit=tr.create({name:"default-loci-label-provider",category:"interaction",ctor:class{register(){this.ctx.managers.lociLabels.addProvider(this.f)}unregister(){this.ctx.managers.lociLabels.removeProvider(this.f)}constructor(e){this.ctx=e,this.f={label:t=>{const n=[];if(De.is(t)){const r=new Set;for(const{unit:i}of t.elements){const o=nt.create(t.structure,i,i.elements[0]),s=Ze.entity.pdbx_description(o).join(", ");r.add(s)}1===r.size&&r.forEach(i=>n.push(i))}return n.push(uE(t)),n.filter(r=>!!r).join("
")},group:t=>t.toString().replace(/Model [0-9]+/g,"Models"),priority:100}}},display:{name:"Provide Default Loci Label"}}),Jue={clickFocus:At([R0(M0.Flag.Primary,Tm.create())],"Representation Focus","Click element using ${triggers}"),clickFocusAdd:At([R0(M0.Flag.Primary,Tm.create({shift:!0}))],"Representation Focus Add","Click element using ${triggers}"),clickFocusSelectMode:At([],"Representation Focus","Click element using ${triggers}"),clickFocusAddSelectMode:At([],"Representation Focus Add","Click element using ${triggers}")},zit={bindings:C.Value(Jue,{isHidden:!0})},Git=tr.create({name:"representation-focus-loci",category:"interaction",ctor:class extends tr.Handler{register(){this.subscribeObservable(this.ctx.behaviors.interaction.click,({current:e,button:t,modifiers:n})=>{var r,i,o,s,a;const{clickFocus:c,clickFocusAdd:u,clickFocusSelectMode:l,clickFocusAddSelectMode:d}=this.params.bindings,p=At.match(this.ctx.selectionMode?l:c,t,n),m=null!==(s=null===(o=null===(i=null===(r=e.repr)||void 0===r?void 0:r.props)||void 0===i?void 0:i.snapshotKey)||void 0===o?void 0:o.trim())&&void 0!==s?s:"";if(!this.ctx.selectionMode&&p&&m)return void this.ctx.managers.snapshot.applyKey(m);const{granularity:h}=this.ctx.managers.interactivity.props;if("residue"!==h&&"element"!==h)return;const y=At.match(this.ctx.selectionMode?d:u,t,n);if(!p&&!y)return;const b=pn.normalize(e.loci,"residue"),x=this.ctx.managers.structure.focus.current;if(x&&pn.areEqual(x.loci,b))this.ctx.managers.structure.focus.clear();else if(p)this.ctx.managers.structure.focus.setFromLoci(b);else{this.ctx.managers.structure.focus.addFromLoci(b);const _=null===(a=this.ctx.managers.structure.focus.current)||void 0===a?void 0:a.loci;_&&this.ctx.managers.camera.focusLoci(_)}})}},params:()=>zit,display:{name:"Representation Focus Loci on Canvas"}}),Tf=Zi,hd=wu,Df=At.Trigger,RE=At.TriggerKey,q8=At([Df(Tf.Flag.Primary,hd.create()),Df(Tf.Flag.Secondary,hd.create()),Df(Tf.Flag.Primary,hd.create({control:!0}))],"Reset camera focus","Click on nothing using ${triggers}"),W8=At([Df(Tf.Flag.Secondary,hd.create()),Df(Tf.Flag.Primary,hd.create({control:!0}))],"Reset camera focus","Click on nothing using ${triggers}"),ele={clickCenterFocus:At([Df(Tf.Flag.Primary,hd.create()),Df(Tf.Flag.Secondary,hd.create()),Df(Tf.Flag.Primary,hd.create({control:!0}))],"Camera center and focus","Click element using ${triggers}"),clickCenterFocusSelectMode:At([Df(Tf.Flag.Secondary,hd.create()),Df(Tf.Flag.Primary,hd.create({control:!0}))],"Camera center and focus","Click element using ${triggers}"),clickResetCameraOnEmpty:q8,clickResetCameraOnEmptySelectMode:W8},jit={minRadius:C.Numeric(8,{min:1,max:50,step:1}),extraRadius:C.Numeric(4,{min:1,max:50,step:1},{description:"Value added to the bounding-sphere radius of the Loci"}),durationMs:C.Numeric(250,{min:0,max:1e3,step:1},{description:"Camera transition duration"}),bindings:C.Value(ele,{isHidden:!0})},Hit=tr.create({name:"camera-focus-loci",category:"interaction",ctor:class extends tr.Handler{register(){this.subscribeObservable(this.ctx.behaviors.interaction.click,({current:e,button:t,modifiers:n})=>{var r,i;if(!this.ctx.canvas3d)return;const o=this.ctx.selectionMode?this.params.bindings.clickCenterFocusSelectMode:this.params.bindings.clickCenterFocus,s=this.ctx.selectionMode?null!==(r=this.params.bindings.clickResetCameraOnEmptySelectMode)&&void 0!==r?r:W8:null!==(i=this.params.bindings.clickResetCameraOnEmpty)&&void 0!==i?i:q8;if(pn.isEmpty(e.loci)&&At.match(s,t,n))Cn.Camera.Reset(this.ctx,{});else if(At.match(o,t,n)){const a=pn.normalize(e.loci,this.ctx.managers.interactivity.props.granularity);this.ctx.managers.camera.focusLoci(a,this.params)}})}},params:()=>jit,display:{name:"Camera Focus Loci on Canvas"}}),qit=tr.create({name:"camera-axis-helper",category:"interaction",ctor:class extends tr.Handler{register(){let e=Cr.None,t=0;this.subscribeObservable(this.ctx.behaviors.interaction.click,({current:n})=>{if(!this.ctx.canvas3d||!O8(n.loci))return;const r=n.loci.elements[0].groupId;if(r===Cr.None)return e=Cr.None,void(t=0);const{camera:i}=this.ctx.canvas3d;let o,s;if(r>=Cr.X&&r<=Cr.Z){e=Cr.None,t=0;const a=v.sub(v(),i.target,i.position),c=v.cross(v(),a,i.up);s=v(),s[r-1]=1,o=v.cross(v(),s,c),0===v.magnitude(o)&&(o=a)}else e===r?t=(t+1)%2:(e=r,t=0),r===Cr.XY?(s=t?v.unitX:v.unitY,o=v.negUnitZ):r===Cr.XZ?(s=t?v.unitX:v.unitZ,o=v.negUnitY):(s=t?v.unitY:v.unitZ,o=v.negUnitX);this.ctx.canvas3d.requestCameraReset({snapshot:(a,c)=>c.getInvariantFocus(a.boundingSphereVisible.center,a.boundingSphereVisible.radius,s,o)})})}},params:()=>({}),display:{name:"Camera Axis Helper"}}),tle={keySpinAnimation:At([RE("I")],"Spin Animation","Press ${triggers}"),keyRockAnimation:At([RE("O")],"Rock Animation","Press ${triggers}"),keyToggleFlyMode:At([RE("Space",hd.create({shift:!0}))],"Toggle Fly Mode","Press ${triggers}"),keyResetView:At([RE("T")],"Reset View","Press ${triggers}")},Wit={bindings:C.Value(tle,{isHidden:!0})},$it=tr.create({name:"camera-controls",category:"interaction",ctor:class extends tr.Handler{register(){this.subscribeObservable(this.ctx.behaviors.interaction.key,({code:e,key:t,modifiers:n})=>{var r;if(!this.ctx.canvas3d)return;const i={...tle,...this.params.bindings},o=this.ctx.canvas3d.props.trackball;if(At.matchKey(i.keySpinAnimation,e,n,t)){const s="spin"!==o.animate.name?"spin":"off";this.ctx.canvas3d.setProps("off"===s?{trackball:{animate:{name:s,params:{}}}}:{trackball:{animate:{name:s,params:{speed:1}}}})}if(At.matchKey(i.keyRockAnimation,e,n,t)){const s="rock"!==o.animate.name?"rock":"off";this.ctx.canvas3d.setProps("off"===s?{trackball:{animate:{name:s,params:{}}}}:{trackball:{animate:{name:s,params:{speed:.3,angle:10}}}})}if(At.matchKey(i.keyToggleFlyMode,e,n,t)){const s=!o.flyMode;this.ctx.canvas3d.setProps({trackball:{flyMode:s}}),null!==(r=this.ctx.canvas3dContext)&&void 0!==r&&r.canvas&&(this.ctx.canvas3dContext.canvas.style.cursor=s?"crosshair":"unset")}At.matchKey(i.keyResetView,e,n,t)&&Cn.Camera.Reset(this.ctx,{})})}},params:()=>Wit,display:{name:"Camera Controls on Canvas"}}),Yit=tr.create({name:"structure-info-prop",category:"custom-props",display:{name:"Structure Info"},ctor:class extends tr.Handler{get maxModelIndex(){var e,t;let n=-1;const r=this.ctx.state.data.select(In.Generators.rootsOfType(pe.Molecule.Model));for(const i of r){const o=(null===(e=i.obj)||void 0===e?void 0:e.data)&&sn.Index.get(null===(t=i.obj)||void 0===t?void 0:t.data).value;void 0!==o&&o>n&&(n=o)}return n}get maxStructureIndex(){var e,t;let n=-1;const r=this.ctx.state.data.select(In.Generators.rootsOfType(pe.Molecule.Structure));for(const i of r){const o=(null===(e=i.obj)||void 0===e?void 0:e.data)&&Ve.Index.get(null===(t=i.obj)||void 0===t?void 0:t.data).value;void 0!==o&&o>n&&(n=o)}return n}get asymIdOffset(){var e;let t=0,n=0;const r=this.ctx.state.data.select(In.Generators.rootsOfType(pe.Molecule.Model));for(const i of r){const o=null===(e=i.obj)||void 0===e?void 0:e.data;if(o){const s=sn.AsymIdCount.get(o),a=sn.AsymIdOffset.get(o).value;void 0!==s&&void 0!==a&&(t=Math.max(t,a.auth+s.auth),n=Math.max(n,a.label+s.label))}}return{auth:t,label:n}}setModelMaxIndex(){var e;const t=this.maxModelIndex,n=this.ctx.state.data.select(In.Generators.rootsOfType(pe.Molecule.Model));for(const r of n){const i=null===(e=r.obj)||void 0===e?void 0:e.data;i&&sn.MaxIndex.get(i).value!==t&&sn.MaxIndex.set(i,{value:t},t)}}setStructureMaxIndex(){var e;const t=this.maxModelIndex,n=this.ctx.state.data.select(In.Generators.rootsOfType(pe.Molecule.Structure));for(const r of n){const i=null===(e=r.obj)||void 0===e?void 0:e.data;i&&Ve.MaxIndex.get(i).value!==t&&Ve.MaxIndex.set(i,{value:t},t)}}handleModel(e,t){if(void 0===sn.Index.get(e).value){const r=(t&&sn.Index.get(t).value)??this.maxModelIndex+1;sn.Index.set(e,{value:r},r)}if(void 0===sn.AsymIdOffset.get(e).value){const r=(t&&sn.AsymIdOffset.get(t).value)??{...this.asymIdOffset};sn.AsymIdOffset.set(e,{value:r},r)}}handleStructure(e,t){if(void 0!==e.parent||void 0!==Ve.Index.get(e).value)return;const r=(t&&Ve.Index.get(t).value)??this.maxStructureIndex+1;Ve.Index.set(e,{value:r},r)}handle(e,t,n){pe.Molecule.Structure.is(t)?!this.ctx.state.data.tree.transforms.get(e).transformer.definition.isDecorator&&void 0===t.data.parent&&this.handleStructure(t.data,n?.data):pe.Molecule.Model.is(t)&&(this.ctx.state.data.tree.transforms.get(e).transformer.definition.isDecorator||this.handleModel(t.data,n?.data))}register(){this.ctx.customModelProperties.register(sn.AsymIdOffset,!0),this.ctx.customModelProperties.register(sn.Index,!0),this.ctx.customModelProperties.register(sn.MaxIndex,!0),this.ctx.customStructureProperties.register(Ve.Index,!0),this.ctx.customStructureProperties.register(Ve.MaxIndex,!0),this.subscribeObservable(this.ctx.state.data.events.object.created,e=>{this.handle(e.ref,e.obj),this.setModelMaxIndex(),this.setStructureMaxIndex()}),this.subscribeObservable(this.ctx.state.data.events.object.updated,e=>{this.handle(e.ref,e.obj,e.oldObj)})}unregister(){this.ctx.customModelProperties.unregister(sn.AsymIdOffset.descriptor.name),this.ctx.customModelProperties.unregister(sn.Index.descriptor.name),this.ctx.customModelProperties.unregister(sn.MaxIndex.descriptor.name),this.ctx.customStructureProperties.unregister(Ve.Index.descriptor.name),this.ctx.customStructureProperties.unregister(Ve.MaxIndex.descriptor.name)}}}),Dm=[-1,1.76,1.87,1.65,1.5,1.4,1.85,1.8,1.6,1.4],nle={ALA:121,ARG:265,ASN:187,ASP:187,CYS:148,GLU:214,GLN:214,GLY:97,HIS:216,ILE:195,LEU:191,LYS:230,MET:203,PHE:228,PRO:154,SER:143,THR:163,TRP:264,TYR:255,VAL:165};function Zit(e,t,n){switch(t){case"O":return 5;case"S":return 6;case"N":return"NZ"===e?4:3;case"C":switch(e){case"C":case"CE1":case"CE2":case"CE3":case"CH2":case"CZ":case"CZ2":case"CZ3":return 1;case"CA":case"CB":case"CE":case"CG1":case"CG2":return 2;default:switch(n){case"PHE":case"TRP":case"TYR":case"HIS":case"ASP":case"ASN":return 1;case"PRO":case"LYS":case"ARG":case"MET":case"ILE":case"LEU":return 2;case"GLU":case"GLN":return"CD"===e?1:2}}}return $8(t)}function Qit(e,t,n){switch(t){case"C":return 7;case"N":return 8;case"P":return 9;case"O":return 5}return $8(t)}function $8(e){const t=v2(e);let n=Dm.indexOf(t);return-1===n&&(n=Dm.length,Dm[n]=t),n}function Y8(){return Y8=ie(function*(e,t){const{atomRadiusType:n}=t;for(let r=0;rG[0]-L[0]);let F=0;e:for(let G=0;G$)continue e}++F}s[o[b]]+=c*F*M*M}}const ile={numberOfSpherePoints:C.Numeric(92,{min:12,max:360,step:1},{description:"Number of sphere points to sample per atom: 92 (original paper), 960 (BioJava), 3000 (EPPIC) - see Shrake A, Rupley JA: Environment and exposure to solvent of protein atoms. Lysozyme and insulin. J Mol Biol 1973."}),probeSize:C.Numeric(1.4,{min:.1,max:4,step:.01},{description:"Corresponds to the size of a water molecule: 1.4 (original paper), 1.5 (occassionally used)"}),nonPolymer:C.Boolean(!1,{description:"Include non-polymer atoms as occluders."}),traceOnly:C.Boolean(!1,{description:"Compute only using alpha-carbons, if true increase probeSize accordingly (e.g., 4 A). Considers only canonical amino acids."})};var Qv;!function(e){function r(){return r=ie(function*(l,d,f){const p=function i(l,d){const{elementCount:f,atomicResidueCount:p}=l,{probeSize:m,nonPolymer:h,traceOnly:g,numberOfSpherePoints:y}=d;return{structure:l,probeSize:m,nonPolymer:h,traceOnly:g,spherePoints:o(y),scalingConstant:4*Math.PI/y,maxLookupRadius:2*d.probeSize+2*Dm[2],atomRadiusType:new Int8Array(f),serialResidueIndex:new Int32Array(f),area:new Float32Array(p)}}(d,f);(function Kit(e){const{key:t}=Ze.residue,{type_symbol:n,label_atom_id:r,label_comp_id:i}=Ze.atom,{structure:o,atomRadiusType:s,serialResidueIndex:a}=e,c=nt.create(o);let u=0,l=0,d=-1;c.structure=o;for(let f=0,p=0,m=o.units.length;f{if(!Ee.isAtomic(e.element.unit))return!1;const t=vl.get(e.element.structure).value;return!!t&&1===Qv.getFlag(e.element,t)}),isAccessible:Nv.Dynamic(IQ("computed","accessible-surface-area.is-accessible",Ae.Bool),e=>{if(!Ee.isAtomic(e.element.unit))return!1;const t=vl.get(e.element.structure).value;return!!t&&2===Qv.getFlag(e.element,t)})},vl=vp.createProvider({label:"Accessible Surface Area",descriptor:au({name:"molstar_accessible_surface_area",symbols:K8}),type:"root",defaultParams:X8,getParams:e=>X8,isApplicable:e=>!0,obtain:function(){var e=ie(function*(t,n,r){const i={...C.getDefaultValues(X8),...r};return{value:yield Qv.compute(n,i).runInContext(t.runtime)}});return function(n,r,i){return e.apply(this,arguments)}}()}),Z8=st(16448250),ole={list:C.ColorList("rainbow",{presetKind:"scale"})},ale={name:"accessible-surface-area",label:"Accessible Surface Area",category:Lc.Category.Residue,factory:function sle(e,t){let n;const r=Gu.create({listOrName:t.list.colors,minLabel:"buried",maxLabel:"exposed",domain:[0,1]}),i=e.structure&&vl.get(e.structure),o=i?Pg(i.id,i.version):-1;if(i?.value&&e.structure){const s=nt.create(e.structure),a=i.value,c=u=>{const l=Qv.getNormalizedValue(u,a);return-1===l?Z8:r.color(l)};n=u=>nt.is(u)&&Ee.isAtomic(u.unit)?c(u):Lt.isLocation(u)?(s.unit=u.aUnit,s.element=u.aUnit.elements[u.aIndex],c(s)):Z8}else n=()=>Z8;return{factory:sle,granularity:"group",preferSmoothing:!0,color:n,props:t,contextHash:o,description:"Assigns a color based on the relative accessible surface area of a residue.",legend:r?r.legend:void 0}},getParams:function not(e){return ole},defaultValues:C.getDefaultValues(ole),isApplicable:e=>!!e.structure,ensureCustomProperties:{attach:(e,t)=>t.structure?vl.attach(e,t.structure,void 0,!0):Promise.resolve(),detach:e=>e.structure&&vl.ref(e.structure,!1)}},rot=tr.create({name:"computed-accessible-surface-area-prop",category:"custom-props",display:{name:"Accessible Surface Area"},ctor:class extends tr.Handler{constructor(){super(...arguments),this.provider=vl,this.labelProvider={label:e=>{if(this.params.showTooltip)return function iot(e){if("element-loci"===e.kind){if(0===e.elements.length)return;const t=vl.get(e.structure).value;if(!t||e.structure.customPropertyDescriptors.hasReference(vl.descriptor))return;const{getSerialIndex:n}=e.structure.root.serialMapping,{area:r,serialResidueIndex:i}=t,o=new Set;let s=0;for(const{indices:c,unit:u}of e.elements){const{elements:l}=u;Fe.forEach(c,d=>{const f=i[n(u,l[d])];-1!==f&&!o.has(f)&&(s+=r[f],o.add(f))})}return 0===o.size?void 0:`Accessible Surface Area (${o.size} ${o.size>1?"Residues sum":"Residue"}): ${s.toFixed(2)} \u212b2`}if("structure-loci"===e.kind){const t=vl.get(e.structure).value;return!t||e.structure.customPropertyDescriptors.hasReference(vl.descriptor)?void 0:`Accessible Surface Area (Whole Structure): ${OZ(t.area).toFixed(2)} \u212b2`}}(e)}}}update(e){const t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t}register(){jD.addCustomProp(this.provider.descriptor),this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach),this.ctx.representation.structure.themes.colorThemeRegistry.add(ale),this.ctx.managers.lociLabels.addProvider(this.labelProvider),this.ctx.query.structure.registry.add(cle),this.ctx.query.structure.registry.add(ule)}unregister(){jD.removeCustomProp(this.provider.descriptor),this.ctx.customStructureProperties.unregister(this.provider.descriptor.name),this.ctx.representation.structure.themes.colorThemeRegistry.remove(ale),this.ctx.managers.lociLabels.removeProvider(this.labelProvider),this.ctx.query.structure.registry.remove(cle),this.ctx.query.structure.registry.remove(ule)}},params:()=>({autoAttach:C.Boolean(!1),showTooltip:C.Boolean(!0)})}),cle=lr("Buried Protein Residues",ue.struct.modifier.union([ue.struct.modifier.wholeResidues([ue.struct.modifier.union([ue.struct.generator.atomGroups({"chain-test":ue.core.rel.eq([ue.ammp("objectPrimitive"),"atomistic"]),"residue-test":K8.isBuried.symbol()})])])]),{description:"Select buried protein residues.",category:pr.Residue,ensureCustomProperties:(e,t)=>vl.attach(e,t)}),ule=lr("Accessible Protein Residues",ue.struct.modifier.union([ue.struct.modifier.wholeResidues([ue.struct.modifier.union([ue.struct.generator.atomGroups({"chain-test":ue.core.rel.eq([ue.ammp("objectPrimitive"),"atomistic"]),"residue-test":K8.isAccessible.symbol()})])])]),{description:"Select accessible protein residues.",category:pr.Residue,ensureCustomProperties:(e,t)=>vl.attach(e,t)});function or(e,t){return e.model.atomicHierarchy.atoms.type_symbol.value(e.elements[t])}function lle(e,t){return e.model.atomicHierarchy.atoms.pdbx_formal_charge.value(e.elements[t])}function tC(e,t){return e.model.atomicHierarchy.atoms.label_atom_id.value(e.elements[t])}function kE(e,t){return e.model.atomicHierarchy.atoms.label_alt_id.value(e.elements[t])}function Q8(e,t){return e.model.atomicHierarchy.atoms.label_comp_id.value(e.elements[t])}function Ef(e,t,n){return function oot(e,t,n){let r=0;const i=e.interUnitBonds.getEdgeIndices(n,t.id);for(let o=0,s=i.length;o{or(o,s)===r&&(i+=1)}),i}function J8(e,t,n){const{offset:r,b:i,edgeProps:{flags:o}}=e.bonds;for(let s=r[t],a=r[t+1];s{"H"!==or(s,a)&&(s.conformation.position(s.elements[a],e1),v.sub(FE,e1,k0),o.push(v.angle(NE,FE)))}),o}function fle(e,t,n,r,i){t.conformation.position(t.elements[n],k0),r.conformation.position(r.elements[i],BE),v.sub(NE,BE,k0);const o=[v(),v()];let a,c,s=0;if(dc(e,t,n,(u,l)=>{s>1||"H"!==or(u,l)&&(a=u,c=l,u.conformation.position(u.elements[l],e1),v.sub(o[s++],e1,k0))}),1===s&&a&&c&&dc(e,a,c,(u,l)=>{s>1||u===t&&l===n||"H"!==or(u,l)&&(u.conformation.position(u.elements[l],e1),v.sub(o[s++],e1,k0))}),2===s)return v.cross(FE,o[0],o[1]),Math.abs(Math.PI/2-v.angle(FE,NE))}const eU=new Lt.ElementBondIterator,tU=new Lt.ElementBondIterator,t1=new Lt.ElementBondIterator,nU=new Lt.ElementBondIterator;function hot(e,t,n,r){const i=lc(e,t,n,"H"),o=or(t,n);let s=lle(t,n);const a="always"===r.assignCharge||"auto"===r.assignCharge&&0===s,c="always"===r.assignH||"auto"===r.assignH&&0===i,u=Ef(e,t,n),l=function pot(e,t,n){let r=0;const{offset:i,edgeProps:{flags:o,order:s}}=t.bonds;for(let a=i[n],c=i[n+1];a{const c=e.interUnitBonds.edges[a];jn.isCovalent(c.props.flag)&&(r+=c.props.order)}),r}(e,t,n),d=function fot(e,t,n){const r=or(t,n),i="O"===r||"N"===r;if(i&&4===Ef(e,t,n))return!1;for(eU.setElement(e,t,n);eU.hasNext;){const o=eU.move();if(o.order>1)return!0;if(i){const s=or(o.otherUnit,o.otherIndex);for(tU.setElement(e,o.otherUnit,o.otherIndex);tU.hasNext;){const a=tU.move();if(a.order>1){if(("P"===s||"S"===s)&&"O"===or(a.otherUnit,a.otherIndex))continue;return!0}}}}return!1}(e,t,n),f=l-u>0;let p=0,m=wi.Unknown;switch(o){case"H":a&&(0===u?(s=1,m=wi.Spherical):1===u&&(s=0,m=wi.Terminal));break;case"C":a&&(s=0),c&&(p=Math.max(0,4-l-Math.abs(s))),m=Jv(u+p+Math.max(0,-s));break;case"N":if(a)if(c)if(d&&l<4)s=u-i==1&&l-i==2?1:0;else for(t1.setElement(e,t,n);t1.hasNext;){const h=t1.move(),g=or(h.otherUnit,h.otherIndex);if("S"===g||C$e(g)){s=0;break}s=1}else s=l-3;c&&(p=Math.max(0,3-l+s)),m=Jv(d&&!f?u+p-s:u+p+1-s);break;case"O":if(a&&(c||(s=l-2),1===l)){t1.setElement(e,t,n);e:for(;t1.hasNext;){const h=t1.move();for(nU.setElement(e,h.otherUnit,h.otherIndex);nU.hasNext;){const g=nU.move();if((g.otherUnit!==t||g.otherIndex!==n)&&"O"===or(g.otherUnit,g.otherIndex)&&2===g.order){s=-1;break e}}}}c&&(p=Math.max(0,2-l+s)),m=Jv(d&&!f?u+p-s+1:u+p-s+2);break;case"S":a&&(c||(s=l<=3&&0===lc(e,t,n,"O")?l-2:0)),c&&l<2&&(p=Math.max(0,2-l+s)),l<=3&&(m=Jv(u+p-s+2));break;case"F":case"CL":case"BR":case"I":case"AT":a&&(s=l-1);break;case"LI":case"NA":case"K":case"RB":case"CS":case"FR":a&&(s=1-l);break;case"BE":case"MG":case"CA":case"SR":case"BA":case"RA":a&&(s=2-l);break;default:un&&console.warn("Requested charge, protonation for an unhandled element",o)}return[s,p,p+i,m]}function mot(e,t,n){const r=t.elements.length,i=new Int8Array(r),o=new Int8Array(r),s=new Int8Array(r),a=new Int8Array(r),c=!!e.parent;let u;if(c){const l=e.root.unitMap.get(t.id);if(u=je.indicesOf(l.elements,t.elements),u.length!==t.elements.length)throw new Error("expected to find an index for every element");t=l,e=e.root}for(let l=0;liU,isApplicable:e=>!0,obtain:function(){var e=ie(function*(t,n,r){const i={...C.getDefaultValues(iU),...r};return{value:yield got(t.runtime,n,i)}});return function(n,r,i){return e.apply(this,arguments)}}()});var Ai,oU,sU;!function(e){function n(d,f){const p=new Int32Array(f+1),m=new Int32Array(f),h=new Int32Array(f),{members:g,count:y,offsets:b}=d;for(let S=0,A=b[y];Si(f,h)}},e.createSubset=i,e.Info=function o(d,f,p){const m=nC.get(d).value;if(!m||!m.has(f.id))throw new Error("valence model required");return{unit:f,types:p.types,feature:-1,x:p.x,y:p.y,z:p.z,members:p.members,offsets:p.offsets,idealGeometry:m.get(f.id).idealGeometry}},e.position=function s(d,f){return v.set(d,f.x[f.feature],f.y[f.feature],f.z[f.feature]),v.transformMat4(d,d,f.unit.conformation.operator.matrix),d};const a=v(),c=v();e.distance=function u(d,f){const m=f.members[f.offsets[f.feature]];return d.unit.conformation.position(d.unit.elements[d.members[d.offsets[d.feature]]],a),f.unit.conformation.position(f.unit.elements[m],c),v.distance(a,c)},e.Provider=function l(d,f){return{types:new Set(d),add:f}}}(Ai||(Ai={})),function(e){e.create=function t(n=2048,r=1024,i){const o=ze.create(Float32Array,1,r,i?i.x:n),s=ze.create(Float32Array,1,r,i?i.y:n),a=ze.create(Float32Array,1,r,i?i.z:n),c=ze.create(Uint8Array,1,r,i?i.types:n),u=ze.create(Uint8Array,1,r,i?i.groups:n),l=ze.create(Uint32Array,1,r,i?i.offsets:n),d=ze.create(Uint32Array,1,r,i?i.members:n),f={x:0,y:0,z:0,offset:0,count:0};return{startState:()=>{f.x=0,f.y=0,f.z=0,f.offset=d.elementCount,f.count=0},pushMember:(p,m,h,g)=>{ze.add(d,g),f.x+=p,f.y+=m,f.z+=h,f.count+=1},finishState:(p,m)=>{const{count:h}=f;0!==h&&(ze.add(c,p),ze.add(u,m),ze.add(o,f.x/h),ze.add(s,f.y/h),ze.add(a,f.z/h),ze.add(l,f.offset))},add:(p,m,h,g,y,b)=>{ze.add(c,p),ze.add(u,m),ze.add(o,h),ze.add(s,g),ze.add(a,y),ze.add(l,d.elementCount),ze.add(d,b)},getFeatures:p=>{ze.add(l,d.elementCount);const m=ze.compact(o,!0),h=ze.compact(s,!0),g=ze.compact(a,!0);return Ai.create(p,{x:m,y:h,z:g,count:o.elementCount,types:ze.compact(c,!0),groups:ze.compact(u,!0),offsets:ze.compact(l,!0),members:ze.compact(d,!0)})}}}}(oU||(oU={})),function(e){e.createElementsIndex=function t(n,r,i){const o=new Int32Array(i+1),s=new Int32Array(i),a=new Int32Array(i),{members:c,offsets:u}=r;for(let f=0,p=2*n.edgeCount;fh)){for(let g=u[m],y=u[m+1];gh)){for(let g=u[m],y=u[m+1];gd||(d=sU.createElementsIndex(l,n,r))})}}}}(aU||(aU={})),function(e){e.create=function t(){const n=new ju.Builder;return{startUnitPair(r,i){n.startUnitPair(r.id,i.id)},finishUnitPair(){n.finishUnitPair()},add(r,i,o){n.add(r,i,{type:o,flag:Pf.None})},getContacts:r=>new yot(n.getMap(),r)}}}(cU||(cU={}));const xot={lineOfSightDistFactor:C.Numeric(1,{min:0,max:3,step:.1})},Sot=3;function mle(e,t,n){const r=t.members[t.offsets[t.feature]],i=n.members[n.offsets[n.feature]];if(r===i&&t.unit===n.unit)return!1;const o=kE(t.unit,r),s=kE(n.unit,i);return!(o&&s&&o!==s||t.unit===n.unit&&t.unit.model.atomicHierarchy.residueAtomSegments.count>1&&t.unit.residueIndex[t.unit.elements[r]]===n.unit.residueIndex[n.unit.elements[i]]||function uot(e,t,n,r,i){return t===r?function aot(e,t,n){const{offset:r,b:i,edgeProps:{flags:o}}=e.bonds;for(let s=r[t],a=r[t+1];s{Rot.includes(or(d,f))&&(l=!0)}),l&&n.add(7,Ir.None,i[r[a]],o[r[a]],s[r[a]],a)}}}),zot={name:"halogen-bonds",params:Dot,createTester:e=>{const t=function Oot(e){return{angleMax:Yn(e.angleMax)}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([6,7]),getType:(n,r,i)=>function Lot(e,t,n,r){const i=t.types[t.feature];if(!function Not(e,t){return 7===e&&6===t||6===e&&7===t}(i,n.types[n.feature]))return;const[s,a]=6===i?[t,n]:[n,t],c=s.members[s.offsets[s.feature]],u=a.members[a.offsets[a.feature]],l=OE(e,s.unit,c,a.unit,u);if(1!==l.length||Fot-l[0]>r.angleMax)return;const d=OE(e,a.unit,u,s.unit,c);return 0===d.length||d.some(f=>Bot-f>r.angleMax)?void 0:kn.HalogenBond}(n,r,i,t)}}},vle={distanceMax:C.Numeric(3.5,{min:1,max:5,step:.1}),backbone:C.Boolean(!0,{description:"Include backbone-to-backbone hydrogen bonds"}),accAngleDevMax:C.Numeric(45,{min:0,max:180,step:1},{description:"Max deviation from ideal acceptor angle"}),donAngleDevMax:C.Numeric(45,{min:0,max:180,step:1},{description:"Max deviation from ideal donor angle"}),accOutOfPlaneAngleMax:C.Numeric(90,{min:0,max:180,step:1}),donOutOfPlaneAngleMax:C.Numeric(45,{min:0,max:180,step:1})},Got={...vle,water:C.Boolean(!1,{description:"Include water-to-water hydrogen bonds"}),sulfurDistanceMax:C.Numeric(4.1,{min:1,max:5,step:.1})},jot={...vle};function dU(e,t){const n=nC.get(e).value;if(!n)throw Error("expected valence model to be available");const r=n.get(t.id);if(!r)throw Error("expected valence model for unit to be available");return r}function Wot(e,t){const{elementAromaticRingIndices:n,all:r}=e.rings,i=n.get(t);if(void 0===i)return!1;for(let o=0,s=i.length;oMath.abs(a-l)>r.maxDonAngleDev))return;if(t.idealGeometry[i]===wi.Trigonal){const l=fle(e,t.unit,i,n.unit,o);if(void 0!==l&&l>r.maxDonOutOfPlaneAngle)return}const c=OE(e,n.unit,o,t.unit,i),u=dle.get(n.idealGeometry[o])||wle;if(!c.some(l=>u-l>r.maxAccAngleDev)){if(n.idealGeometry[o]===wi.Trigonal){const l=fle(e,n.unit,o,t.unit,i);if(void 0!==l&&l>r.maxAccOutOfPlaneAngle)return}return!0}}const nst=Ai.Provider([4],function Hot(e,t,n){const{totalH:r}=dU(e,t),{elements:i}=t,{x:o,y:s,z:a}=t.model.atomicConformation;for(let c=0,u=i.length;c0&&("N"===l||"O"===l||"S"===l))&&n.add(4,Ir.None,o[i[c]],s[i[c]],a[i[c]],c)}}),rst=Ai.Provider([9],function qot(e,t,n){const{totalH:r}=dU(e,t),{elements:i}=t,{x:o,y:s,z:a}=t.model.atomicConformation;for(let c=0,u=i.length;c0&&(lc(e,t,c,"N")>0||lc(e,t,c,"O")>0||Wot(t,c))&&n.add(9,Ir.None,o[i[c]],s[i[c]],a[i[c]],c)}),ist=Ai.Provider([5],function $ot(e,t,n){const{charge:r,implicitH:i,idealGeometry:o}=dU(e,t),{elements:s}=t,{x:a,y:c,z:u}=t.model.atomicConformation,l=d=>{n.add(5,Ir.None,a[s[d]],c[s[d]],u[s[d]],d)};for(let d=0,f=s.length;d{const t=Math.max(e.distanceMax,e.sulfurDistanceMax),n=function Jot(e){return{...Cle(e),includeWater:e.water,maxSulfurDistSq:e.sulfurDistanceMax*e.sulfurDistanceMax,maxDistSq:e.distanceMax*e.distanceMax}}(e);return{maxDistance:t,requiredFeatures:new Set([4,5]),getType:(r,i,o,s)=>function est(e,t,n,r,i){const s=n.types[n.feature];if(!function Zot(e,t){return 5===e&&4===t||4===e&&5===t}(t.types[t.feature],s))return;const[a,c]=5===s?[t,n]:[n,t],u=a.members[a.offsets[a.feature]],l=c.members[c.offsets[c.feature]];return r>("S"===or(a.unit,u)||"S"===or(c.unit,l)?i.maxSulfurDistSq:i.maxDistSq)||!i.includeWater&&function Kot(e,t,n,r){return _le(e,t)&&_le(n,r)}(a.unit,u,c.unit,l)||!Ale(e,a,c,i)?void 0:kn.HydrogenBond}(r,i,o,s,n)}}},sst={name:"weak-hydrogen-bonds",params:jot,createTester:e=>{const t=Cle(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([9,5]),getType:(n,r,i,o)=>function tst(e,t,n,r,i){const s=n.types[n.feature];if(!function Qot(e,t){return 9===e&&5===t||5===e&&9===t}(t.types[t.feature],s))return;const[a,c]=5===s?[t,n]:[n,t];return Ale(e,a,c,i)?kn.WeakHydrogenBond:void 0}(n,r,i,0,t)}}};function cst(e,t,n){return"S"===or(t,n)&&3===lc(e,t,n,"O")}function ust(e,t,n){return"S"===or(t,n)&&4===lc(e,t,n,"O")}function Tle(e,t,n){return"P"===or(t,n)&&lc(e,t,n,"O")===Ef(e,t,n)}function dst(e,t,n){let r=0;return"C"===or(t,n)&&2===lc(e,t,n,"O")&&1===lc(e,t,n,"C")&&dc(e,t,n,(i,o)=>{"O"===or(i,o)&&Ef(e,i,o)-lc(e,i,o,"H")==1&&(r+=1)}),2===r}function fst(e,t,n){let r=0;return"C"===or(t,n)&&3===Ef(e,t,n)&&3===lc(e,t,n,"N")&&dc(e,t,n,(i,o)=>{Ef(e,i,o)-lc(e,i,o,"H")==1&&(r+=1)}),2===r}function pst(e,t,n){let r=0;return"C"===or(t,n)&&3===Ef(e,t,n)&&2===lc(e,t,n,"N")&&1===lc(e,t,n,"C")&&dc(e,t,n,(i,o)=>{Ef(e,i,o)-lc(e,i,o,"H")==1&&(r+=1)}),2===r}const hst=new Set(["N","O","S","F","CL","BR","I"]);const yst={distanceMax:C.Numeric(5,{min:0,max:8,step:.1})},bst={distanceMax:C.Numeric(5.5,{min:1,max:8,step:.1}),offsetMax:C.Numeric(2,{min:0,max:4,step:.1}),angleDevMax:C.Numeric(30,{min:0,max:180,step:1})},vst={distanceMax:C.Numeric(6,{min:1,max:8,step:.1}),offsetMax:C.Numeric(2,{min:0,max:4,step:.1})},_st=["ARG","HIS","LYS"],xst=["GLU","ASP"];function Dle(e,t){const n=nC.get(e).value;if(!n)throw Error("expected valence model to be available");const r=n.get(t.id);if(!r)throw Error("expected valence model for unit to be available");return r}const Ele=v(),Ple=v(),LE=v(),n1=v(),UE=v(),VE=v();function fU(e,t){const{unit:n,feature:r,offsets:i,members:o}=t,{elements:s}=n,a=i[r];return t.unit.conformation.position(s[o[a]],LE),t.unit.conformation.position(s[o[a+1]],n1),t.unit.conformation.position(s[o[a+2]],UE),v.triangleNormal(e,LE,n1,UE)}const pU=function(e,t,n){return Ai.position(LE,e),Ai.position(n1,t),v.sub(UE,LE,n1),v.projectOnPlane(VE,UE,n),v.add(VE,VE,n1),v.distance(VE,n1)},Rst=Yn(180),Mle=Yn(90),rC=v(),hU=v();const Bst=Ai.Provider([2],function Cst(e,t,n){const{charge:r}=Dle(e,t),{elements:i}=t,{x:o,y:s,z:a}=t.model.atomicConformation,c=new Set,{label_comp_id:u}=t.model.atomicHierarchy.atoms,l=en.transientSegments(t.model.atomicHierarchy.residueAtomSegments,i);for(;l.hasNext;){const{index:d,start:f,end:p}=l.move(),m=u.value(t.model.atomicHierarchy.residueAtomSegments.offsets[d]);if(xst.includes(m)){n.startState();for(let h=f;h{"O"===or(t,y)&&n.pushMember(o[i[y]],s[i[y]],a[i[y]],y)}),n.finishState(2,Ir.Phosphate));else if(!$b.has(m)){for(let h=f;h{"O"===or(t,b)&&(c.add(b),n.pushMember(o[i[b]],s[i[b]],a[i[b]],b))}),n.finishState(2,g))}for(let h=f;h{"N"===or(t,b)&&(c.add(b),n.pushMember(o[i[b]],s[i[b]],a[i[b]],b))}),n.finishState(1,g))}for(let h=f;h0&&!c.has(h)&&n.add(1,Ir.None,o[i[h]],s[i[h]],a[i[h]],h)}}}),Lst=Ai.Provider([3],function wst(e,t,n){const{elements:r}=t,{x:i,y:o,z:s}=t.model.atomicConformation;for(const a of t.rings.aromaticRings){const c=t.rings.all[a];n.startState();for(let u=0,l=c.length;u{const t=function Est(e){return{distanceMaxSq:e.distanceMax*e.distanceMax}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([2,1]),getType:(n,r,i,o)=>function kst(e,t,n,r,i){if(function Ast(e,t){return 2===e&&1===t||1===e&&2===t}(t.types[t.feature],n.types[n.feature])&&function Dst(e,t,n){const{feature:r,offsets:i,members:o}=e,{feature:s,offsets:a,members:c}=t;for(let u=i[r],l=i[r+1];u{const t=function Pst(e){return{offsetMax:e.offsetMax,angleDevMax:Yn(e.angleDevMax)}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([3]),getType:(n,r,i,o)=>function Nst(e,t,n,r,i){if(function Ist(e,t){return 3===e&&3===t}(t.types[t.feature],n.types[n.feature])){fU(rC,t),fU(hU,n);const a=v.angle(rC,hU);if(Math.min(pU(t,n,hU),pU(n,t,rC))<=i.offsetMax){if(a<=i.angleDevMax||a>=Rst-i.angleDevMax)return kn.PiStacking;if(a<=i.angleDevMax+Mle&&a>=Mle-i.angleDevMax)return kn.PiStacking}}}(0,r,i,0,t)}}},zst={name:"cation-pi",params:vst,createTester:e=>{const t=function Mst(e){return{offsetMax:e.offsetMax}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([3,1]),getType:(n,r,i,o)=>function Fst(e,t,n,r,i){const o=t.types[t.feature];if(function Tst(e,t){return 3===e&&1===t||1===e&&3===t}(o,n.types[n.feature])){const[a,c]=3===o?[t,n]:[n,t];if(fU(rC,a),pU(c,a,rC)<=i.offsetMax)return kn.CationPi}}(0,r,i,0,t)}}},Gst={distanceMax:C.Numeric(4,{min:1,max:5,step:.1})},Wst=Ai.Provider([8],function jst(e,t,n){const{elements:r}=t,{x:i,y:o,z:s}=t.model.atomicConformation;for(let a=0,c=r.length;a{const p=or(d,f);"C"!==p&&"H"!==p&&(l=!1)})):"F"===u&&(l=!0),l&&n.add(8,Ir.None,i[r[a]],o[r[a]],s[r[a]],a)}}),$st={name:"hydrophobic",params:Gst,createTester:e=>({maxDistance:e.distanceMax,requiredFeatures:new Set([8]),getType:(t,n,r,i)=>function qst(e,t,n,r){if(!function Hst(e,t){return 8===e&&8===t}(t.types[t.feature],n.types[n.feature]))return;const a=n.members[n.offsets[n.feature]];return"F"!==or(t.unit,t.members[t.offsets[t.feature]])||"F"!==or(n.unit,a)?kn.Hydrophobic:void 0}(0,n,r)})},Yst={distanceMax:C.Numeric(3,{min:1,max:5,step:.1})},Xst=["LI","NA","K","RB","CS","MG","CA","SR","BA","AL","GA","IN","TL","SC","SN","PB","BI","SB","HG"];function Rle(e){return!lp.has(e)}function Zst(e){return lp.has(e)}function Qst(e){return ZI.has(e)}function kle(e,t){return 12===e?11===t||12===t:13===e?10===t:void 0}const tat=Ai.Provider([13,12],function Kst(e,t,n){const{elements:r}=t,{x:i,y:o,z:s}=t.model.atomicConformation;for(let a=0,c=r.length;a({maxDistance:e.distanceMax,requiredFeatures:new Set([13,12,10,11]),getType:(t,n,r,i)=>function eat(e,t,n,r){const i=t.types[t.feature],o=n.types[n.feature];if(kle(i,o)||kle(o,i))return kn.MetalCoordination}(0,n,r)})};function oat(e,t){const{contacts:n}=t,r=function(u,l,d,f,p){const[m,h]=f.get(d)||[1/0,-1];un.edges[u].props.flag=Pf.Filtered;let a,c;return{isApplicable:u=>u===kn.Hydrophobic,handleInterContact:(u,l,d)=>{i(u,l,d,o,s)},startUnit:(u,l,d)=>{a=new Map,c=f=>l.edgeProps.flag[f]=Pf.Filtered},handleIntraContact:(u,l,d)=>{i(u,l,d,a,c)}}}function sat(e,t){const{contacts:n}=t,r=(i,o)=>{const s=9===i.types[i.feature]?o:i,a=s.members[s.offsets[s.feature]],{edgeProps:{type:c},elementsIndex:{offsets:u,indices:l}}=t.unitsContacts.get(s.unit.id);for(let f=u[a],p=u[a+1];fi===kn.WeakHydrogenBond,handleInterContact:(i,o,s)=>{r(o,s)&&(n.edges[i].props.flag=Pf.Filtered)},startUnit:()=>{},handleIntraContact:(i,o,s)=>{if(r(o,s)){const{flag:a}=t.unitsContacts.get(o.unit.id).edgeProps;a[i]=Pf.Filtered}}}}function mU(e,t,n,r,i){const{offsets:o,feature:s}=n,{offsets:a,feature:c}=r;for(let u=o[s],l=o[s+1];ur===kn.Ionic,handleInterContact:(r,i,o)=>{mU([kn.HydrogenBond,kn.WeakHydrogenBond],r,i,o,n)},startUnit:()=>{},handleIntraContact:(r,i,o)=>{gU([kn.HydrogenBond,kn.WeakHydrogenBond],r,i,o,t.unitsContacts.get(i.unit.id))}}}function cat(e,t){const{contacts:n}=t;return{isApplicable:r=>r===kn.Hydrophobic||r===kn.CationPi,handleInterContact:(r,i,o)=>{mU([kn.PiStacking],r,i,o,n)},startUnit:()=>{},handleIntraContact:(r,i,o)=>{gU([kn.PiStacking],r,i,o,t.unitsContacts.get(i.unit.id))}}}function uat(e,t){const{contacts:n}=t;return{isApplicable:r=>r===kn.Ionic,handleInterContact:(r,i,o)=>{mU([kn.MetalCoordination],r,i,o,n)},startUnit:()=>{},handleIntraContact:(r,i,o)=>{gU([kn.MetalCoordination],r,i,o,t.unitsContacts.get(i.unit.id))}}}var nh;!function(e){function i(l,d){const{unitA:f,indexA:p,unitB:m,indexB:h}=d,{contacts:g,unitsContacts:y}=l;if(f===m){const b=y.get(f.id),x=b.getDirectedEdgeIndex(p,h);return hle(b.edgeProps.type[x])}{const b=g.getEdgeIndex(p,f.id,h,m.id);return hle(g.edges[b].props.type)}}function c(l,d,f){const{unitsFeatures:p}=l;return Og.fromPairProvider(d.length,(m,h,g)=>{const y=d[m];Ai.setPosition(h,y.unitA,y.indexA,p.get(y.unitA.id)),Ai.setPosition(g,y.unitB,y.indexB,p.get(y.unitB.id))},f)}function u(l,d,f){const p=f[0];if(void 0===p)return"";const{unitA:m,indexA:h,unitB:g,indexB:y}=p,{unitsFeatures:b}=d,{members:x,offsets:_}=b.get(m.id),{members:S,offsets:A}=b.get(g.id),E={granularity:"element"};return(_[h+1]-_[h]>1||A[y+1]-A[y]>1)&&(E.granularity="residue"),[i(d,p),c8(Lt.Location(l,m,x[_[h]],l,g,S[A[y]]),E)].join("
")}e.Location=function t(l,d,f,p,m,h){return yre("interactions",{structure:d,interactions:l},{unitA:f,indexA:p,unitB:m,indexB:h})},e.isLocation=function n(l){return!!l&&"data-location"===l.kind&&"interactions"===l.tag},e.areLocationsEqual=function r(l,d){return l.data.structure===d.data.structure&&l.data.interactions===d.data.interactions&&l.element.indexA===d.element.indexA&&l.element.indexB===d.element.indexB&&l.element.unitA===d.element.unitA&&l.element.unitB===d.element.unitB},e.locationLabel=function o(l){return i(l.data.interactions,l.element)},e.Loci=function s(l,d,f){return eE("interactions",{structure:l,interactions:d},f,p=>c(d,f,p),()=>u(l,d,f))},e.isLoci=function a(l){return!!l&&"data-loci"===l.kind&&"interactions"===l.tag},e.getBoundingSphere=c,e.getLabel=u}(nh||(nh={}));const lat=[nst,rst,ist,Bst,Ost,Lst,Uot,Vot,Wst,tat,nat],zE={ionic:Ust,"pi-stacking":Vst,"cation-pi":zst,"halogen-bonds":zot,"hydrogen-bonds":ost,"weak-hydrogen-bonds":sst,hydrophobic:$st,"metal-coordination":rat},fat=function dat(e=[]){const t=Object.create(null);return Object.keys(zE).forEach(n=>{t[n]=C.MappedStatic(e.includes(n)?"on":"off",{on:C.Group(zE[n].params),off:C.Group({})},{cycle:!0})}),t}(["cation-pi","pi-stacking","hydrogen-bonds","halogen-bonds","metal-coordination"]),Nle={providers:C.Group(fat,{isFlat:!0}),contacts:C.Group(xot,{label:"Advanced Options"})};function pat(e,t,n){return yU.apply(this,arguments)}function yU(){return yU=ie(function*(e,t,n){const r={...C.getDefaultValues(Nle),...n};yield nC.attach(e,t);const i=[];RI(zE).forEach(d=>{const{name:f,params:p}=r.providers[d];"on"===f&&i.push(zE[d].createTester(p))});const o=new Set;i.forEach(d=>Si.add(o,d.requiredFeatures));const s=lat.filter(d=>Si.areIntersecting(o,d.types)),a=Lu.Mutable(),c=Lu.Mutable();for(let d=0,f=t.unitSymmetryGroups.length;d{const a=t.get(o.id),c=t.get(s.id);!function Tot(e,t,n,r,i,o,s,a){const{count:c,x:u,y:l,z:d}=n,{lookup3d:f}=i,p=le.mul(Iot,r.conformation.operator.inverse,t.conformation.operator.matrix),m=!le.isIdentity(p),h=v(),g=Math.max(...s.map(E=>E.maxDistance)),{center:y,radius:b}=f.boundary.sphere,x=(b+g)*(b+g),_=a.lineOfSightDistFactor,S=Ai.Info(e,t,n),A=Ai.Info(e,r,i);o.startUnitPair(t,r);for(let E=0;Ex)continue;const{indices:w,count:D,squaredDistances:I}=f.find(h[0],h[1],h[2],g);if(0!==D){S.feature=E;for(let R=0;Ro.maxDistance)),validUnit:o=>Ee.isAtomic(o),validUnitPair:(o,s)=>Ve.validUnitPair(e,o,s)}),i.getContacts(t)}(t,a,i,r.contacts),l={unitsFeatures:a,unitsContacts:c,contacts:u};return function iat(e,t){const{contacts:n,unitsContacts:r,unitsFeatures:i}=t,o=[oat(0,t),sat(0,t),aat(0,t),cat(0,t),uat(0,t)];for(let a=0,c=n.edgeCount;abU,isApplicable:e=>!e.isCoarseGrained,obtain:function(){var e=ie(function*(t,n,r){const i={...C.getDefaultValues(bU),...r};return{value:yield pat(t,n,i)}});return function(n,r,i){return e.apply(this,arguments)}}()}),vU=st(13421772),Ea_HydrogenBond=2851770,Ea_Hydrophobic=8421504,Ea_HalogenBond=4259775,Ea_Ionic=15779860,Ea_MetalCoordination=9191577,Ea_CationPi=16744448,Ea_PiStacking=9220966,Ea_WeakHydrogenBond=12967404,bat=[["Hydrogen Bond",Ea_HydrogenBond],["Hydrophobic",Ea_Hydrophobic],["Halogen Bond",Ea_HalogenBond],["Ionic",Ea_Ionic],["Metal Coordination",Ea_MetalCoordination],["Cation Pi",Ea_CationPi],["Pi Stacking",Ea_PiStacking],["Weak HydrogenBond",Ea_WeakHydrogenBond]];function Fle(e){switch(e){case kn.HydrogenBond:return Ea_HydrogenBond;case kn.Hydrophobic:return Ea_Hydrophobic;case kn.HalogenBond:return Ea_HalogenBond;case kn.Ionic:return Ea_Ionic;case kn.MetalCoordination:return Ea_MetalCoordination;case kn.CationPi:return Ea_CationPi;case kn.PiStacking:return Ea_PiStacking;case kn.WeakHydrogenBond:return Ea_WeakHydrogenBond;case kn.Unknown:return vU}}const Ble={},_U={name:"interaction-type",label:"Interaction Type",category:Lc.Category.Misc,factory:function Ole(e,t){let n;const r=e.structure?Qi.get(e.structure):void 0,i=r?Pg(r.id,r.version):-1;return n=r&&r.value?o=>{if(nh.isLocation(o)){const{unitsContacts:s,contacts:a}=o.data.interactions,{unitA:c,unitB:u,indexA:l,indexB:d}=o.element;if(c===u){const f=s.get(c.id),p=f.getDirectedEdgeIndex(l,d);return Fle(f.edgeProps.type[p])}{const f=a.getEdgeIndex(l,c.id,d,u.id);return Fle(a.edges[f].props.type)}}return vU}:()=>vU,{factory:Ole,granularity:"group",color:n,props:t,contextHash:i,description:"Assigns colors according the interaction type of a link.",legend:$h(bat)}},getParams:function vat(e){return Ble},defaultValues:C.getDefaultValues(Ble),isApplicable:e=>!!e.structure,ensureCustomProperties:{attach:(e,t)=>t.structure?Qi.attach(e,t.structure,void 0,!0):Promise.resolve(),detach:e=>e.structure&&Qi.ref(e.structure,!1)}};function Iu(e,t,n,r){let i=0;const{webgl:o}=t,s=new mr,a=new yn.GeometryState,c=Hp(),u=[],l=ms.create();let d,f,p,m,h=Fo.createEmpty();function S(w){if(ms.update(l,w),void 0!==w.visible&&d&&d.setVisibility(w.visible&&(null===l.unitTransforms||l.unitTransforms.isIdentity)),void 0!==w.alphaFactor&&d&&d.setAlphaFactor(w.alphaFactor),void 0!==w.pickable&&d&&d.setPickable(w.pickable),void 0!==w.overpaint&&d){const D=Bo.remap(w.overpaint,f);d.setOverpaint(D,o)}if(void 0!==w.transparency&&d){const D=Vs.remap(w.transparency,f);d.setTransparency(D,o)}if(void 0!==w.substance&&d){const D=zs.remap(w.substance,f);d.setSubstance(D,o)}if(void 0!==w.clipping&&d){const D=Yr.remap(w.clipping,f);d.setClipping(D)}void 0!==w.themeStrength&&d&&d.setThemeStrength(w.themeStrength),void 0!==w.transform&&d&&d.setTransform(w.transform),void 0!==w.unitTransforms&&d&&d.setVisibility(l.visible&&(null===w.unitTransforms||w.unitTransforms.isIdentity))}return{label:e,get groupCount(){return d?d.groupCount:0},get props(){return m},get params(){return p},get state(){return l},get theme(){return h},get geometryVersion(){return a.version},renderObjects:u,updated:s,createOrUpdate:function g(w={},D){return D&&D!==f&&(p=n(t,D),f=D,m||(m=C.getDefaultValues(p))),m=Object.assign({},m,w),Oe.create("Creating or updating ComplexRepresentation",function(){var I=ie(function*(R){var T;let M=!1;d?null!==(T=d.mustRecreate)&&void 0!==T&&T.call(d,f,m,o)&&(d.destroy(),d=r(c,f,m,o),M=!0):(d=r(c,f,m,o),M=!0);const N=d.createOrUpdate({webgl:o,runtime:R},h,m,D);N&&(yield N),M&&S(l),u.length=0,d&&d.renderObject&&(u.push(d.renderObject),a.add(d.renderObject.id,d.geometryVersion)),a.snapshot(),i+=1,s.next(i)});return function(R){return I.apply(this,arguments)}}())},setState:S,setTheme:function A(w){h=w},getLoci:function y(w){return d?d.getLoci(w):$n},getAllLoci:function b(){var w;return[Ve.Loci(null!==(w=f.child)&&void 0!==w?w:f)]},eachLocation:function x(w){d?.eachLocation(w)},mark:function _(w,D){if(!f||!Us.is(l.markerActions,D))return!1;if(Ve.isLoci(w)||De.is(w)||Lt.isLoci(w)){if(!Ve.areRootsEquivalent(w.structure,f))return!1;w=pn.remap(w,f),(Ve.isLoci(w)||De.is(w)&&De.isWholeStructure(w))&&(w=JD)}else if(!Uc(w)&&!GS(w))return!1;return!pn.isEmpty(w)&&!!d&&d.mark(w,D)},destroy:function E(){d&&d.destroy()}}}const _at=le.toArray;function Lle(e,t,n){const{elements:r,model:i}=t;if(-1!==Fe.indexOf(r,n)){const{index:o,offsets:s}=i.atomicHierarchy.residueAtomSegments,a=o[n],c=[];for(let l=s[a],d=s[a+1];ls.unitMap.has(d.id)):e.group.units,c=a.length,u=16*c,l=o&&o.aTransform.ref.value.length>=u?o.aTransform.ref.value:new Float32Array(u);for(let d=0;dc-a);const i=Math.floor(Math.cbrt(n)*Math.cbrt(n)),o=r[0]*r[1];return{area:o,areaCells:Math.ceil(o/(t*t)),maxAreaCells:i}}function Pm(e,t,n=Vle){const{area:r,areaCells:i,maxAreaCells:o}=zle(e,t.resolution,n),s=i>o?Math.sqrt(r/o):t.resolution;return{...t,resolution:s}}const GE={ignoreHydrogens:C.Boolean(!1,{description:"Whether or not to include hydrogen atoms in the surface calculation."}),ignoreHydrogensVariant:C.Select("all",C.arrayToOptions(["all","non-polar"])),traceOnly:C.Boolean(!1,{description:"Whether or not to only use trace atoms in the surface calculation."}),includeParent:C.Boolean(!1,{description:"Include elements of the parent structure in surface calculation to get a surface patch of the current structure."})},Iat=(C.getDefaultValues(GE),v());function Gle(e,t,n,r){return v.squaredDistance(v.set(Iat,e,t,n),r)}function jE(e,t,n,r){const{ignoreHydrogens:i,ignoreHydrogensVariant:o,traceOnly:s,includeParent:a}=r,c=a?e.root.unitMap.get(t.id):t,u=a&&c!==t,{x:l,y:d,z:f}=function Aat(e){switch(e.kind){case 0:return e.model.atomicConformation;case 1:return e.model.coarseConformation.spheres;case 2:return e.model.coarseConformation.gaussians}}(c),{elements:p}=c,{center:m,radius:h}=t.boundary.sphere,y=(h+11)*(h+11);let b,x;if(i||s||u){const w=[],D=[];for(let I=0,R=p.length;Iy||(w.push(T),D.push(I))}b=je.ofSortedArray(w),x=D}else b=p,x=Tc(new Int32Array(b.length));a&&c!==t&&function Tat(e,t,n){let r=0;const i=t.length;for(let o=0,s=n.length;o(A.element=w,n.size(A))}}function HE(e,t,n){const{ignoreHydrogens:r,ignoreHydrogensVariant:i,traceOnly:o,includeParent:s}=n,a=s&&!!e.parent,c=nt.create(e.root),{center:u,radius:l}=e.boundary.sphere,f=(l+11)*(l+11);let p,m,h,g,y,b;if(r||o||a){const{getSerialIndex:A}=e.serialMapping,E=a?e.root.units:e.units,w=[],D=[],I=[],R=[],T=[];for(let M=0,N=E.length;Mf||(w.push($),D.push(ee),I.push(q),c.element=Z,R.push(t.size(c)),a?-1===(L?je.indexOf(L.elements,Z):-1)?T.push(-2):T.push(A(L,Z)):T.push(A(V,Z)))}}p=w,m=D,h=I,g=R,y=T,b=Fe.ofRange(0,y.length)}else{const{elementCount:A}=e,E=new Float32Array(A),w=new Float32Array(A),D=new Float32Array(A),I=new Float32Array(A);for(let R=0,T=0,M=e.units.length;Rg[A]}}const jle=_T.H;function md(e,t,n,r){if(Ee.isCoarse(t)||t.model.atomicHierarchy.derived.atom.atomicNumber[n]!==jle)return!1;if("all"===r)return!0;const i=function gst(e,t,n){let r=!1;return dc(e,t,n,(i,o)=>{(function mst(e){return hst.has(e)})(or(i,o))&&(r=!0)}),r}(e,t,je.indexOf(t.elements,n));return!!(i&&"polar"===r||!i&&"non-polar"===r)}function Dat(e,t){return e[t]===jle}function xU(e,t){if(Ee.isCoarse(e))return!0;const n=e.model.atomicHierarchy.atoms.label_atom_id.value(t);return"CA"===n||"BB"===n||"P"===n}function oC(e){return C.MultiSelect(e,Cat,{description:"For which kinds of units/chains to show the representation visuals."})}const fc={unitKinds:oC(["atomic","spheres"]),includeParent:C.Boolean(!1,{isHidden:!0})},Hle={...Nt.Params},qle={...fl.Params},Wle={...oc.Params},Eat={...ym.Params},$le={...di.Params},Yle={...vu.Params},Xle={..._u.Params},Kle={...xa.Params};function N0(e,t){const{defaultProps:n,createGeometry:r,createLocationIterator:i,getLoci:o,eachLocation:s,setUpdateState:a,mustRecreate:c,processValues:u,dispose:l}=e,{updateValues:d,updateBoundingSphere:f,updateRenderableState:p,createPositionIterator:m}=e.geometryUtils,h=Cf.create(),g={loci:$n,action:Bt.None,status:-1};let y,b,x,_,E,w,I,R,S=Object.assign({},n),A=Fo.createEmpty(),D=-1;function M(L){if(h.createNew){if(I=i(_,b),!L)throw new Error("expected geometry to be given");y=function Pat(e,t,n,r,i,o){const{createValues:s,createRenderableState:a}=Zo.getUtils(t),u=s(t,JL(),n,r,i),l=a(i);return Ev(t.kind,u,l,o)}(0,L,I,x,b,t),R=m(L,y.values)}else{if(!y)throw new Error("expected renderObject to be available");if(h.updateTransform){I=i(_,b);const{instanceCount:z,groupCount:j}=I;b.instanceGranularity?Vi(z,"instance",y.values):Vi(z*j,"groupInstance",y.values)}if(h.createGeometry){if(!L)throw new Error("expected geometry to be given");k.updateIfChanged(y.values.drawCount,Zo.getDrawCount(L)),k.updateIfChanged(y.values.uVertexCount,Zo.getVertexCount(L)),k.updateIfChanged(y.values.uGroupCount,Zo.getGroupCount(L))}(h.updateTransform||h.createGeometry)&&(f(y.values,L||w),R=m(w,y.values)),h.updateSize&&"uSize"in y.values&&kp(I,x.size,y.values),h.updateColor&&bu(I,R,x.color,y.values),d(y.values,b),p(y.state,b)}S=b,A=x,E=_,L&&(w=L,D+=1)}function F(L,z,j){return function N(L){return!!(Uc(L)||Ve.isLoci(L)&&Ve.areRootsEquivalent(L.structure,E)||De.is(L)&&Ve.areRootsEquivalent(L.structure,E)&&De.isWholeStructure(L))}(L)?z(Ce.ofBounds(0,S.instanceGranularity?I.instanceCount:I.groupCount*I.instanceCount)):S.instanceGranularity?function V(L,z,j){let Z=!1;return!(!De.is(L)&&!Lt.isLoci(L)||!Ve.areEquivalent(L.structure,z))&&(j(Ce.ofSingleton(0))&&(Z=!0),Z)}(L,E,z):s(L,E,z,j)}function G(L){y&&u?.(y.values,w,S,A,L.webgl)}return{get groupCount(){return I?I.count:0},get renderObject(){return I&&I.count?y:void 0},get geometryVersion(){return D},createOrUpdate(L,z,j={},Z){if(function T(L,z,j){if(!j&&!E)throw new Error("missing structure");if(b=Object.assign({},S,z),x=L,_=j,Cf.reset(h),!y||!E)return h.createNew=!0,void(h.createGeometry=!0);a(h,b,S,x,A,_,E),Ve.areEquivalent(_,E)||(h.createGeometry=!0),Ve.areHierarchiesEqual(_,E)||(h.updateTransform=!0,h.createGeometry=!0),Lc.areEqual(L.color,A.color)||(h.updateColor=!0),Yd(b.unitKinds,S.unitKinds)||(h.createGeometry=!0),E.child!==_.child&&(h.createGeometry=!0),b.instanceGranularity!==S.instanceGranularity&&(h.updateTransform=!0),h.updateSize&&!("uSize"in y.values)&&(h.createGeometry=!0),h.createGeometry&&(h.updateColor=!0,h.updateSize=!0)}(z,j,Z||E),h.createGeometry){const $=r(L,_,x,b,w);if(kI($))return $.then(ee=>{M(ee),G(L)});M($)}else M();G(L)},getLoci:L=>y?o(L,E,y.id):$n,eachLocation(L){for(I.reset();I.hasNext;){const{location:z,isSecondary:j}=I.move();L(z,j)}},mark:(L,z)=>Sn.mark(y,L,z,F,g),setVisibility(L){Sn.setVisibility(y,L)},setAlphaFactor(L){Sn.setAlphaFactor(y,L)},setPickable(L){Sn.setPickable(y,L)},setColorOnly(L){Sn.setColorOnly(y,L)},setTransform(L,z){Sn.setTransform(y,L,z)},setOverpaint(L,z){Sn.setOverpaint(y,L,F,!0,{geometry:w,props:S,webgl:z})},setTransparency(L,z){Sn.setTransparency(y,L,F,!0,{geometry:w,props:S,webgl:z})},setSubstance(L,z){Sn.setSubstance(y,L,F,!0,{geometry:w,props:S,webgl:z})},setClipping(L){Sn.setClipping(y,L,F,!0)},setThemeStrength(L){Sn.setThemeStrength(y,L)},destroy(){l?.(w),y&&(y.state.disposed=!0,y=void 0)},mustRecreate:c}}const r1={...Hle,...fc};function rh(e,t){return N0({...e,setUpdateState:(n,r,i,o,s,a,c)=>{e.setUpdateState(n,r,i,o,s,a,c),Qo.areEqual(o.size,s.size)||(n.createGeometry=!0)},geometryUtils:Nt.Utils},t)}const Mat={...qle,...fc},kat={...Wle,...fc},Fat={...$le,...fc},Oat={...Yle,...fc},Uat={...Xle,...fc},zat={...Kle,...fc};function vi(e,t,n,r){let i=0;const{webgl:o}=t,s=new mr,a=Hp(),c=[],u=new yn.GeometryState,l=ms.create();let f,p,m,h,d=new Map,g=Fo.createEmpty();function A(I,R,T){const{visible:M,alphaFactor:N,pickable:V,overpaint:F,transparency:G,substance:L,clipping:z,themeStrength:j,transform:Z,unitTransforms:$}=T;void 0!==M&&I.setVisibility(M),void 0!==N&&I.setAlphaFactor(N),void 0!==V&&I.setPickable(V),void 0!==F&&I.setOverpaint(F,o),void 0!==G&&I.setTransparency(G,o),void 0!==L&&I.setSubstance(L,o),void 0!==z&&I.setClipping(z),void 0!==j&&I.setThemeStrength(j),void 0!==Z&&(Z!==l.transform||!le.areEqual(Z,l.transform,vr))&&I.setTransform(Z),void 0!==$&&($?I.setTransform(void 0,$.getSymmetryGroupTransforms(R)):$!==l.unitTransforms&&I.setTransform(void 0,null))}return{label:e,get groupCount(){let I=0;return d.forEach(({visual:R})=>{R.renderObject&&(I+=R.groupCount)}),I},get geometryVersion(){return u.version},get props(){return h},get params(){return m},get state(){return l},get theme(){return g},renderObjects:c,updated:s,createOrUpdate:function y(I={},R){return R&&R!==f&&(m=n(t,R),h||(h=C.getDefaultValues(m))),h=Object.assign({},h,I),Oe.create("Creating or updating UnitsRepresentation",function(){var T=ie(function*(M){var N,V,F;if(!f&&!R)throw new Error("missing structure");if(R&&!f){p=R.unitSymmetryGroups;for(let G=0;GG.push(L));for(let L=0,z=G.length;L{L.destroy()})}c.length=0,d.forEach(({visual:G})=>{G.renderObject&&(c.push(G.renderObject),u.add(G.renderObject.id,G.geometryVersion))}),u.snapshot(),R&&(f=R),s.next(i++)});return function(M){return T.apply(this,arguments)}}())},setState:function E(I){const{visible:R,alphaFactor:T,pickable:M,overpaint:N,transparency:V,substance:F,clipping:G,themeStrength:L,transform:z,unitTransforms:j,syncManually:Z,markerActions:$}=I,ee={};void 0!==R&&(ee.visible=R),void 0!==T&&(ee.alphaFactor=T),void 0!==M&&(ee.pickable=M),void 0!==N&&f&&(ee.overpaint=Bo.remap(N,f)),void 0!==V&&f&&(ee.transparency=Vs.remap(V,f)),void 0!==F&&f&&(ee.substance=zs.remap(F,f)),void 0!==G&&f&&(ee.clipping=Yr.remap(G,f)),void 0!==L&&(ee.themeStrength=L),void 0!==z&&!le.areEqual(z,l.transform,vr)&&(ee.transform=z),(j!==l.unitTransforms||j?.version!==l.unitTransformsVersion)&&(ee.unitTransforms=j,l.unitTransformsVersion=j?j?.version:-1),void 0!==Z&&(ee.syncManually=Z),void 0!==$&&(ee.markerActions=$),d.forEach(({visual:q,group:O})=>A(q,O,ee)),ms.update(l,ee)},setTheme:function w(I){g=I},getLoci:function b(I){let R=$n;return d.forEach(({visual:T})=>{const M=T.getLoci(I);Ta(M)||(R=M)}),R},getAllLoci:function _(){var I;return[Ve.Loci(null!==(I=f.child)&&void 0!==I?I:f)]},eachLocation:function x(I){d.forEach(({visual:R})=>{R.eachLocation(I)})},mark:function S(I,R){if(!f||!Us.is(l.markerActions,R))return!1;if(Ve.isLoci(I)||De.is(I)||Lt.isLoci(I)){if(!Ve.areRootsEquivalent(I.structure,f))return!1;I=pn.remap(I,f),(Ve.isLoci(I)||De.is(I)&&De.isWholeStructure(I))&&(I=JD)}else if(!Uc(I)&&!GS(I))return!1;if(pn.isEmpty(I))return!1;let T=!1;return d.forEach(({visual:M})=>{T=M.mark(I,R)||T}),T},destroy:function D(){d.forEach(({visual:I})=>I.destroy()),d.clear()}}}function Mm(e,t){const{defaultProps:n,createGeometry:r,createLocationIterator:i,getLoci:o,eachLocation:s,setUpdateState:a,mustRecreate:c,processValues:u,dispose:l}=e,{createEmpty:d,updateValues:f,updateBoundingSphere:p,updateRenderableState:m,createPositionIterator:h}=e.geometryUtils,g=Cf.create(),y={loci:$n,action:Bt.None,status:-1};let b,S,A,E,w,D,R,T,x=Object.assign({},n),_=Fo.createEmpty(),I=-1;function N(j){if(g.createNew){if(R=i(S,x),!j)throw new Error("expected geometry to be given");b=function jat(e,t,n,r,i,o){const{createValues:s,createRenderableState:a}=Zo.getUtils(t),u=s(t,Ule(e,i.includeParent,t.boundingSphere,i.cellSize,i.batchSize),n,r,i),l=a(i);return Ev(t.kind,u,l,o)}(S,j,R,_,x,t),T=h(j,b.values)}else{if(!b)throw new Error("expected renderObject to be available");if(g.updateTransform){R=i(S,x);const{instanceCount:Z,groupCount:$}=R;x.instanceGranularity?Vi(Z,"instance",b.values):Vi(Z*$,"groupInstance",b.values)}if(g.updateMatrix&&(Ule(S,x.includeParent,b.values.invariantBoundingSphere.ref.value,x.cellSize,x.batchSize,b.values),"lodLevels"in b.values&&k.update(b.values.lodLevels,b.values.lodLevels.ref.value)),g.createGeometry){if(!j)throw new Error("expected geometry to be given");k.updateIfChanged(b.values.drawCount,Zo.getDrawCount(j)),k.updateIfChanged(b.values.uVertexCount,Zo.getVertexCount(j)),k.updateIfChanged(b.values.uGroupCount,Zo.getGroupCount(j))}(g.updateTransform||g.createGeometry)&&(p(b.values,j||D),T=h(j||D,b.values)),g.updateSize&&"uSize"in b.values&&kp(R,_.size,b.values),g.updateColor&&bu(R,T,_.color,b.values),f(b.values,x),m(b.state,x)}A=x,E=_,w=S,j&&(D=j,I+=1)}function L(j,Z,$){return function F(j){return!!(Uc(j)||Ve.isLoci(j)&&Ve.areRootsEquivalent(j.structure,w.structure)||De.is(j)&&Ve.areRootsEquivalent(j.structure,w.structure)&&De.isWholeStructure(j))}(j)?Z(Ce.ofBounds(0,A.instanceGranularity?R.instanceCount:R.groupCount*R.instanceCount)):A.instanceGranularity?function G(j,Z,$){let ee=!1;if(Lt.isLoci(j)){const{structure:q,group:O}=Z;if(!Ve.areEquivalent(j.structure,q))return!1;for(const H of j.bonds){if(H.aUnit!==H.bUnit)continue;const W=O.unitIndexMap.get(H.aUnit.id);void 0!==W&&$(Ce.ofSingleton(W))&&(ee=!0)}}else if(De.is(j)){const{structure:q,group:O}=Z;if(!Ve.areEquivalent(j.structure,q))return!1;for(const H of j.elements){const W=O.unitIndexMap.get(H.unit.id);void 0!==W&&$(Ce.ofSingleton(W))&&(ee=!0)}}return ee}(j,w,Z):s(j,w,Z,$)}function z(j){b&&u?.(b.values,D,A,E,j.webgl)}return{get groupCount(){return R?R.count:0},get renderObject(){return R&&R.count?b:void 0},get geometryVersion(){return I},createOrUpdate(j,Z,$,ee){if(function M(j,Z,$){if(!$&&!w)throw new Error("missing structureGroup");if(x=Z,_=j,S=$,Cf.reset(g),!b||!w)return g.createNew=!0,void(g.createGeometry=!0);a(g,x,A,_,E,S,w),Ve.areHierarchiesEqual(w.structure,S.structure)||(g.updateTransform=!0,g.updateColor=!0,g.updateSize=!0),Lc.areEqual(_.color,E.color)||(g.updateColor=!0),w.structure.child!==S.structure.child&&(g.createGeometry=!0),(x.instanceGranularity!==A.instanceGranularity||x.cellSize!==A.cellSize||x.batchSize!==A.batchSize)&&(g.updateTransform=!0),Yd(x.unitKinds,A.unitKinds)||(g.createGeometry=!0),S.group.transformHash!==w.group.transformHash&&(S.group.units.length!==w.group.units.length||g.updateColor?g.updateTransform=!0:g.updateMatrix=!0);const ee=S.group.units[0],q=w.group.units[0];Ee.areOperatorsEqual(ee,q)||(g.updateTransform=!0),Ee.areConformationsEqual(ee,q)||(g.createGeometry=!0),g.updateTransform&&(g.updateMatrix=!0),g.updateSize&&!("uSize"in b.values)&&(g.createGeometry=!0),(g.createGeometry||g.updateTransform)&&(w.structure.hashCode!==S.structure.hashCode&&(g.updateColor=!0,g.updateSize=!0),(_.color.granularity.startsWith("vertex")||b.values.dColorType.ref.value.startsWith("vertex")||_.color.granularity.startsWith("volume")||b.values.dColorType.ref.value.startsWith("volume"))&&(g.updateColor=!0))}(Z,$,ee||w),g.createGeometry){const q=function V(j,Z,$,ee,q,O){return function wat(e,t){for(let n=0,r=e.length;n{N(O),z(j)});N(q)}else N();z(j)},getLoci:j=>b?o(j,w,b.id):$n,eachLocation(j){for(R.reset();R.hasNext;){const{location:Z,isSecondary:$}=R.move();j(Z,$)}},mark(j,Z){let $=!0;if(De.is(j)){$=!1;const{invariantId:ee}=w.group.units[0];for(const q of j.elements)if(q.unit.invariantId===ee){$=!0;break}}return!!$&&Sn.mark(b,j,Z,L,y)},setVisibility(j){Sn.setVisibility(b,j)},setAlphaFactor(j){Sn.setAlphaFactor(b,j)},setPickable(j){Sn.setPickable(b,j)},setColorOnly(j){Sn.setColorOnly(b,j)},setTransform(j,Z){Sn.setTransform(b,j,Z)},setOverpaint(j,Z){Sn.setOverpaint(b,j,L,!0,{geometry:D,props:A,webgl:Z})},setTransparency(j,Z){Sn.setTransparency(b,j,L,!0,{geometry:D,props:A,webgl:Z})},setSubstance(j,Z){Sn.setSubstance(b,j,L,!0,{geometry:D,props:A,webgl:Z})},setClipping(j){Sn.setClipping(b,j,L,!0)},setThemeStrength(j){Sn.setThemeStrength(b,j)},destroy(){l?.(D),b&&(b.state.disposed=!0,b=void 0)},mustRecreate:c}}const hs={...Hle,...fc};function Hs(e,t){return Mm({...e,setUpdateState:(n,r,i,o,s,a,c)=>{e.setUpdateState(n,r,i,o,s,a,c),Qo.areEqual(o.size,s.size)||(n.createGeometry=!0)},geometryUtils:Nt.Utils},t)}const SU={...qle,...fc};function CU(e,t){return Mm({...e,setUpdateState:(n,r,i,o,s,a,c)=>{e.setUpdateState(n,r,i,o,s,a,c),Qo.areEqual(o.size,s.size)||(n.updateSize=!0)},geometryUtils:fl.Utils},t)}const wU={...Wle,...fc};function AU(e,t){return Mm({...e,setUpdateState:(n,r,i,o,s,a,c)=>{e.setUpdateState(n,r,i,o,s,a,c),Qo.areEqual(o.size,s.size)||(n.updateSize=!0)},geometryUtils:oc.Utils},t)}const Hat={...Eat,...fc},qE={...$le,...fc};function WE(e,t){return Mm({...e,setUpdateState:(n,r,i,o,s,a,c)=>{e.setUpdateState(n,r,i,o,s,a,c),Qo.areEqual(o.size,s.size)||(n.updateSize=!0)},geometryUtils:di.Utils},t)}const Wat={...Xle,...fc},Yat={...Kle,...fc},ms={create:()=>({...yn.createState(),unitTransforms:null,unitTransformsVersion:-1}),update:(e,t)=>{yn.updateState(e,t),void 0!==t.unitTransforms&&(e.unitTransforms=t.unitTransforms)}},ih=v(),i1=v(),sC=v(),$E=ze.add,Zle=ze.add3;var aC;!function(e){e.create=function t(n=2048,r=1024,i){const o=ze.create(Float32Array,1,r,i?i.groupBuffer.ref.value:n),s=ze.create(Float32Array,3,r,i?i.startBuffer.ref.value:n),a=ze.create(Float32Array,3,r,i?i.endBuffer.ref.value:n),c=ze.create(Float32Array,1,r,i?i.scaleBuffer.ref.value:n),u=ze.create(Float32Array,1,r,i?i.capBuffer.ref.value:n),l=ze.create(Float32Array,1,r,i?i.colorModeBuffer.ref.value:n),d=(p,m,h,g,y,b,x,_,S,A,E)=>{for(let w=0;w<6;++w)Zle(s,p,m,h),Zle(a,g,y,b),$E(o,E),$E(c,x),$E(u,(_?1:0)+(S?2:0)),$E(l,A)},f=(p,m,h,g,y,b,x,_,S)=>{const A=v.distance(p,m),E=h%2!=0,w=Math.floor((h+1)/2),D=A/(h+.5);let I=2;v.setMagnitude(sC,v.sub(sC,m,p),D),v.copy(ih,p);for(let R=0;R{const S=v.distance(p,m);f(p,m,S/h,g,y,b,!0,x,_)},getCylinders:()=>{const p=o.elementCount/6,m=ze.compact(o,!0),h=ze.compact(s,!0),g=ze.compact(a,!0),y=ze.compact(c,!0),b=ze.compact(u,!0),x=ze.compact(l,!0),_=i&&p<=i.cylinderCount?i.mappingBuffer.ref.value:new Float32Array(18*p),S=i&&p<=i.cylinderCount?i.indexBuffer.ref.value:new Uint32Array(12*p);return(!i||p>i.cylinderCount)&&function Kat(e,t,n){for(let r=0;r0,z=c(F),j=a?a(F):0,Z=S&&!!l&&l(F),[$,ee]=L?[Z,m]:[m,Z];if(E.currentGroup=F,0===j)M.radiusTop=M.radiusBottom=z,M.topCap=$,M.bottomCap=ee,Hn(E,w,D,.5,M);else if(1===j)M.radiusTop=M.radiusBottom=z*x,M.topCap=M.bottomCap=_,wv(E,w,D,.5,b,Z,M);else if(2===j||3===j||4===j||5===j||7===j||8===j){const q=2===j||3===j?2:4===j||5===j?3:1.5,O=z*(d/(.5*q)),H=(z-O)*f;if(IU(I,w,D,o?o(F):null),M.topCap=$,M.bottomCap=ee,7===j||8===j){M.radiusTop=M.radiusBottom=z,Hn(E,w,D,.5,M);const W=z+h*z+h*z*g;qs(Or,Co(Or,D,w),.5*z),Ei(w,w,Or),Co(D,D,Or),M.radiusTop=M.radiusBottom=z*h,M.topCap=M.bottomCap=_,qs(I,I,W),Co(w,w,I),Co(D,D,I),wv(E,w,D,.5,y,Z,M),8===j&&(qs(I,I,2*W),Ei(w,w,I),Ei(D,D,I),wv(E,w,D,.5,y,Z,M))}else if(3===j||5===j){const W=z+O+d*z*f;qs(I,I,W),M.radiusTop=M.radiusBottom=z,Hn(E,w,D,.5,M),gd(Or,Or,f*d*.2),Ei(w,w,Or),Co(D,D,Or),M.radiusTop=M.radiusBottom=O,M.topCap=L?Z:_,M.bottomCap=L?_:Z,qs(I,I,W),Co(w,w,I),Co(D,D,I),Hn(E,w,D,.5,M),3===q&&(qs(I,I,2*W),Ei(w,w,I),Ei(D,D,I),Hn(E,w,D,.5,M))}else qs(I,I,H),M.radiusTop=M.radiusBottom=O,3===q&&Hn(E,w,D,.5,M),vHe(E,w,D,.5,I,M)}else 6===j&&(gd(Or,Or,.475),Ei(w,w,Or),Co(D,D,Or),M.radiusTop=M.radiusBottom=z,M.topCap=$,M.bottomCap=ee,Hn(E,w,D,.5,M))}const N=r?_e.clone(r.boundingSphere):void 0,V=at.getMesh(E);return 0===T?{mesh:V}:(v.scale(R,R,1/T),N&&v.distance(R,N.center)/N.radius<.1?{mesh:V,boundingSphere:N}:{mesh:V})}function Jle(e,t,n,r){const{linkCount:i,referencePosition:o,position:s,style:a,radius:c,ignore:u,stub:l}=t;if(!i)return{cylinders:oc.createEmpty(r)};const{linkScale:d,linkSpacing:f,linkCap:p,aromaticScale:m,aromaticSpacing:h,aromaticDashCount:g,dashCount:y,dashScale:b,dashCap:x,stubCap:_,colorMode:S}=n,A="interpolate"===S,E=!0===A?3:2,w=2*i,D=aC.create(w,w/4,r),I=v(),R=v(),T=v(),M=v(),N=v();let V=0;for(let L=0,z=i;L{const Z=S[j];if(E&&"all"===w||Z!==kn.HydrogenBond&&Z!==kn.WeakHydrogenBond)v.set(L,f[b[j]],p[b[j]],m[b[j]]),v.set(z,f[x[j]],p[x[j]],m[x[j]]);else{const $=h[g[b[j]]],ee=h[g[x[j]]];R.invariantPosition(I[$],M),R.invariantPosition(I[ee],N);let q=v.distance(M,N),O=q;v.copy(L,M),v.copy(z,N),J8(t,$,(H,W)=>{if(md(n,t,I[W],"polar")){R.invariantPosition(I[W],T);const Q=v.distance(T,N);Q{if(md(n,t,I[W],"polar")){R.invariantPosition(I[W],T);const Q=v.distance(T,M);Q1,radius:L=>{c.element=I[h[g[b[L]]]];const z=r.size.size(c);c.element=I[h[g[x[L]]]];const j=r.size.size(c);return Math.min(z,j)*A},ignore:L=>{if(_[L]===Pf.Filtered)return!0;if(a)if("stub"===D){const z=b[L];for(let j=g[z],Z=g[z+1];j0){const L=_e.expand(_e(),(a??t).boundary.sphere,1*A);F.setBoundingSphere(L)}return F})).apply(this,arguments)}const nde={...hs,...F0,...tde};function ect(e){return Hs({defaultProps:C.getDefaultValues(nde),createGeometry:Jat,createLocationIterator:rct,getLoci:tct,eachLocation:nct,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.dashCount!==r.dashCount||n.dashScale!==r.dashScale||n.dashCap!==r.dashCap||n.radialSegments!==r.radialSegments||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.parentDisplay!==r.parentDisplay;const c=Qi.get(s.structure).version;t.info.interactionsHash!==c&&(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.info.interactionsHash=c)}},e)}function tct(e,t,n){const{objectId:r,instanceId:i,groupId:o}=e;if(n===r){const{structure:s,group:a}=t,c=s.unitMap.get(a.units[i].id),u=Qi.get(s).value,{a:l,b:d}=u.unitsContacts.get(c.id);return nh.Loci(s,u,[{unitA:c,indexA:l[o],unitB:c,indexB:d[o]},{unitA:c,indexA:d[o],unitB:c,indexB:l[o]}])}return $n}const DU=new Set;function nct(e,t,n,r){let i=!1;if(nh.isLoci(e)){const{structure:o,group:s}=t;if(!Ve.areEquivalent(e.data.structure,o))return!1;const a=Qi.get(o).value;if(e.data.interactions!==a)return!1;const u=a.unitsContacts.get(s.units[0].id),l=2*u.edgeCount;for(const d of e.elements){if(d.unitA!==d.unitB)continue;const f=s.unitIndexMap.get(d.unitA.id);if(void 0!==f){const p=u.getDirectedEdgeIndex(d.indexA,d.indexB);-1!==p&&n(Ce.ofSingleton(f*l+p))&&(i=!0)}}}else if(De.is(e)){const{structure:o,group:s}=t;if(!Ve.areEquivalent(e.structure,o))return!1;const a=Qi.get(o).value;if(!a)return!1;const c=s.units[0],u=a.unitsContacts.get(c.id),l=a.unitsFeatures.get(c.id),d=2*u.edgeCount,{offset:f}=u,{offsets:p,indices:m}=l.elementsIndex,{members:h,offsets:g}=l;for(const y of e.elements){const b=s.unitIndexMap.get(y.unit.id);void 0!==b&&(Fe.forEach(y.indices,x=>{for(let _=p[x],S=p[x+1];_{if(r){const _=u.a[x];for(let A=g[_],E=g[_+1];A{const p=n.units[f];return u.unitA=p,u.indexA=o.a[d],u.unitB=p,u.indexB=o.b[d],c})}function ict(e,t,n,r,i){if(!t.hasAtomic)return Nt.createEmpty(i);const o=nt.create(t),s=Qi.get(t).value,{contacts:a,unitsFeatures:c}=s,{edgeCount:u,edges:l}=a,{sizeFactor:d,ignoreHydrogens:f,ignoreHydrogensVariant:p,parentDisplay:m}=r;if(!u)return Nt.createEmpty(i);const{child:h}=t,g=v(),y=v(),b=v(),x={linkCount:u,position:(A,E,w)=>{const{unitA:D,indexA:I,unitB:R,indexB:T,props:{type:M}}=l[w],N=c.get(D),V=c.get(R),F=t.unitMap.get(D),G=t.unitMap.get(R);if(f&&"all"===p||M!==kn.HydrogenBond&&M!==kn.WeakHydrogenBond)v.set(A,N.x[I],N.y[I],N.z[I]),v.transformMat4(A,A,F.conformation.operator.matrix),v.set(E,V.x[T],V.y[T],V.z[T]),v.transformMat4(E,E,G.conformation.operator.matrix);else{const L=N.members[N.offsets[I]],z=V.members[V.offsets[T]];F.conformation.position(F.elements[L],y),G.conformation.position(G.elements[z],b);let j=v.distance(y,b),Z=j;v.copy(A,y),v.copy(E,b),dc(t,F,L,($,ee)=>{const q=$.elements[ee];if(md(t,$,q,"polar")){$.conformation.position(q,g);const O=v.distance(g,b);O{const q=$.elements[ee];if(md(t,$,q,"polar")){$.conformation.position(q,g);const O=v.distance(g,y);O1,radius:A=>{const E=l[A],w=c.get(E.unitA);o.unit=t.unitMap.get(E.unitA),o.element=o.unit.elements[w.members[w.offsets[E.indexA]]];const D=n.size.size(o),I=c.get(E.unitB);o.unit=t.unitMap.get(E.unitB),o.element=o.unit.elements[I.members[I.offsets[E.indexB]]];const R=n.size.size(o);return Math.min(D,R)*d},ignore:A=>{if(l[A].props.flag===Pf.Filtered)return!0;if(h){const E=l[A];if("stub"===m){const w=h.unitMap.get(E.unitA);if(!w)return!0;const D=t.unitMap.get(E.unitA),{offsets:I,members:R}=c.get(E.unitA);for(let T=I[E.indexA],M=I[E.indexA+1];T0){const{child:A}=t,E=_e.expand(_e(),(A??t).boundary.sphere,1*d);_.setBoundingSphere(E)}return _}const rde={...r1,...F0,...tde};function oct(e){return rh({defaultProps:C.getDefaultValues(rde),createGeometry:ict,createLocationIterator:cct,getLoci:sct,eachLocation:act,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.dashCount!==r.dashCount||n.dashScale!==r.dashScale||n.dashCap!==r.dashCap||n.radialSegments!==r.radialSegments||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.parentDisplay!==r.parentDisplay;const c=Qi.get(s).version;t.info.interactionsHash!==c&&(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.info.interactionsHash=c)}},e)}function sct(e,t,n){const{objectId:r,groupId:i}=e;if(n===r){const o=Qi.get(t).value,s=o.contacts.edges[i],a=t.unitMap.get(s.unitA),c=t.unitMap.get(s.unitB);return nh.Loci(t,o,[{unitA:a,indexA:s.indexA,unitB:c,indexB:s.indexB},{unitA:c,indexA:s.indexB,unitB:a,indexB:s.indexA}])}return $n}const YE=new Map,EU=new Set;function act(e,t,n,r){let i=!1;if(nh.isLoci(e)){if(!Ve.areEquivalent(e.data.structure,t))return!1;const o=Qi.get(t).value;if(e.data.interactions!==o)return!1;const{contacts:s}=o;for(const a of e.elements){const c=s.getEdgeIndex(a.indexA,a.unitA.id,a.indexB,a.unitB.id);-1!==c&&n(Ce.ofSingleton(c))&&(i=!0)}}else if(De.is(e)){if(!Ve.areEquivalent(e.structure,t)||r&&1===e.elements.length)return!1;const o=Qi.get(t).value;if(!o)return!1;const{contacts:s,unitsFeatures:a}=o;for(const c of e.elements)YE.set(c.unit.id,c.indices);for(const c of e.elements){const{unit:u}=c;Ee.isAtomic(u)&&Fe.forEach(c.indices,l=>{for(const d of s.getContactIndicesForElement(l,u))EU.add(d)})}EU.forEach(c=>{if(r){const{indexA:u,unitA:l,indexB:d,unitB:f}=s.edges[c],p=YE.get(l),m=YE.get(f);if(!p||!m)return;const{offsets:h,members:g}=a.get(l);for(let x=h[u],_=h[u+1];x<_;++x)if(!Fe.has(p,g[x]))return;const{offsets:y,members:b}=a.get(f);for(let x=y[d],_=y[d+1];x<_;++x)if(!Fe.has(m,b[x]))return}n(Ce.ofSingleton(c))&&(i=!0)}),YE.clear(),EU.clear()}return i}function cct(e){const t=Qi.get(e).value,{contacts:n}=t,r=n.edgeCount,o=nh.Location(t,e),{element:s}=o;return Mr(r,1,1,c=>{const u=n.edges[c];return s.unitA=e.unitMap.get(u.unitA),s.indexA=u.indexA,s.unitB=e.unitMap.get(u.unitB),s.indexB=u.indexB,o},!0)}const ide={"intra-unit":(e,t)=>vi("Intra-unit interactions cylinder",e,t,ect),"inter-unit":(e,t)=>Iu("Inter-unit interactions cylinder",e,t,oct)},ode={...nde,...rde,unitKinds:oC(["atomic"]),sizeFactor:C.Numeric(.2,{min:.01,max:1,step:.01}),visuals:C.MultiSelect(["intra-unit","inter-unit"],C.objectToOptions(ide))},XE={name:"interactions",label:"Non-covalent Interactions",description:"Displays non-covalent interactions as dashed cylinders.",factory:function lct(e,t){return yn.createMulti("Interactions",e,t,ms,ide)},getParams:function uct(e,t){return C.clone(ode)},defaultValues:C.getDefaultValues(ode),defaultColorTheme:{name:"interaction-type"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.elementCount>0&&Qi.isApplicable(e),ensureCustomProperties:{attach:(e,t)=>Qi.attach(e,t,void 0,!0),detach:e=>Qi.ref(e,!1)},getData:(e,t)=>t.includeParent?e.asParent():e,mustRecreate:(e,t)=>e.includeParent!==t.includeParent},dct=tr.create({name:"computed-interactions-prop",category:"custom-props",display:{name:"Interactions"},ctor:class extends tr.Handler{constructor(){super(...arguments),this.provider=Qi,this.labelProvider={label:e=>{if(this.params.showTooltip&&"element-loci"===e.kind){if(0===e.elements.length)return;const t=[],n=this.getStructures(e.structure);for(const r of n){const i=this.provider.get(r).value;if(!i)continue;const o=De.remap(e,r);if(1!==o.elements.length)continue;const s=o.elements[0];if(1!==Fe.size(s.indices))continue;const a=i.unitsFeatures.get(s.unit.id);if(!a)continue;const c=[],u=[],l=[],d=Fe.start(s.indices),{types:f,groups:p,elementsIndex:{indices:m,offsets:h}}=a;for(let g=h[d],y=h[d+1];gTypes ${c.join(", ")}`),u.length&&l.push(`Groups ${u.join(", ")}`),l.length&&t.push(`Interaction Feature: ${l.join(" | ")}`)}return t.length?t.join("
"):void 0}}}}getStructures(e){const t=[],n=this.ctx.helpers.substructureParent.get(e);if(n){const i=this.ctx.state.data.select(In.Generators.ofType(pe.Molecule.Structure,n.transform.ref));for(const o of i)o.obj&&eo(t,o.obj.data)}return t}update(e){const t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t}register(){this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach),this.ctx.representation.structure.themes.colorThemeRegistry.add(_U),this.ctx.managers.lociLabels.addProvider(this.labelProvider),this.ctx.representation.structure.registry.add(XE)}unregister(){this.ctx.customStructureProperties.unregister(this.provider.descriptor.name),this.ctx.representation.structure.themes.colorThemeRegistry.remove(_U),this.ctx.managers.lociLabels.removeProvider(this.labelProvider),this.ctx.representation.structure.registry.remove(XE)}},params:()=>({autoAttach:C.Boolean(!1),showTooltip:C.Boolean(!0)})}),fct=tr.create({name:"computed-secondary-structure-prop",category:"custom-props",display:{name:"Secondary Structure"},ctor:class extends tr.Handler{constructor(){super(...arguments),this.provider=Xu}update(e){const t=this.params.autoAttach!==e.autoAttach;return this.params.autoAttach=e.autoAttach,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t}register(){this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach)}unregister(){this.ctx.customStructureProperties.unregister(this.provider.descriptor.name)}},params:()=>({autoAttach:C.Boolean(!1)})}),pct=tr.create({name:"computed-valence-model-prop",category:"custom-props",display:{name:"Valence Model"},ctor:class extends tr.Handler{constructor(){super(...arguments),this.provider=nC,this.labelProvider={label:e=>{if(this.params.showTooltip&&"element-loci"===e.kind){if(0===e.elements.length)return;const t=[],n=this.getStructures(e.structure);for(const r of n){const i=this.provider.get(r).value;if(!i)continue;const o=De.remap(e,r);if(1!==o.elements.length)continue;const s=o.elements[0];if(1!==Fe.size(s.indices))continue;const a=i.get(s.unit.id);if(!a)continue;const c=Fe.start(s.indices),d=a.implicitH[c],f=a.totalH[c];t.push(`Valence Model: Charge ${a.charge[c]} | Ideal Geometry ${dot(a.idealGeometry[c])} | Implicit H ${d} | Total H ${f}`)}return t.length?t.join("
"):void 0}}}}getStructures(e){const t=[],n=this.ctx.helpers.substructureParent.get(e);if(n){const i=this.ctx.state.data.select(In.Generators.ofType(pe.Molecule.Structure,n.transform.ref));for(const o of i)o.obj&&eo(t,o.obj.data)}return t}update(e){const t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t}register(){this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach),this.ctx.managers.lociLabels.addProvider(this.labelProvider)}unregister(){this.ctx.customStructureProperties.unregister(this.provider.descriptor.name),this.ctx.managers.lociLabels.removeProvider(this.labelProvider)}},params:()=>({autoAttach:C.Boolean(!1),showTooltip:C.Boolean(!0)})}),PU=st(16448250),cC=new Map,sde={...Ia({type:"colors",colorList:"set-1"})},cde={name:"sifts-mapping",label:"SIFTS Mapping",category:Lc.Category.Residue,factory:function ade(e,t){let n;if(e.structure){for(const a of e.structure.models){const c=sf.Provider.get(a).value;if(c)for(const u of c.accession)!u||cC.has(u)||cC.set(u,cC.size)}const r=nt.create(e.structure),i=ac(cC.size+1,t,{valueLabel:a=>`${a}`}),o=new Map,s=a=>{const c=sf.getKey(a);if(!c)return PU;if(o.has(c))return o.get(c);const u=i.color(cC.get(c));return o.set(c,u),u};n=a=>nt.is(a)&&Ee.isAtomic(a.unit)?s(a):Lt.isLocation(a)?(r.unit=a.aUnit,r.element=a.aUnit.elements[a.aIndex],s(r)):PU}else n=()=>PU;return{factory:ade,granularity:"group",preferSmoothing:!0,color:n,props:t,description:"Assigns a color based on SIFTS mapping."}},getParams:function mct(e){return sde},defaultValues:C.getDefaultValues(sde),isApplicable:e=>{var t;return!(null===(t=e.structure)||void 0===t||!t.models.some(n=>sf.Provider.isApplicable(n)))},ensureCustomProperties:{attach:function(){var e=ie(function*(t,n){if(n.structure)for(const r of n.structure.models)yield sf.Provider.attach(t,r,void 0,!0)});return function(n,r){return e.apply(this,arguments)}}(),detach:e=>{if(e.structure)for(const t of e.structure.models)sf.Provider.ref(t,!1)}}},gct=tr.create({name:"sifts-mapping-prop",category:"custom-props",display:{name:"SIFTS Mapping"},ctor:class extends tr.Handler{constructor(){super(...arguments),this.provider=sf.Provider,this.labelProvider={label:e=>{if(this.params.showTooltip)return function yct(e){if("element-loci"===e.kind){if(0===e.elements.length)return;const t=e.elements[0],n=t.unit,r=nt.create(e.structure,n,n.elements[Fe.getAt(t.indices,0)]);return sf.getLabel(r)}}(e)}}}update(e){const t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t}register(){this.ctx.customModelProperties.register(this.provider,this.params.autoAttach),this.ctx.representation.structure.themes.colorThemeRegistry.add(cde),this.ctx.managers.lociLabels.addProvider(this.labelProvider)}unregister(){this.ctx.customModelProperties.unregister(this.provider.descriptor.name),this.ctx.representation.structure.themes.colorThemeRegistry.remove(cde),this.ctx.managers.lociLabels.removeProvider(this.labelProvider)}},params:()=>({autoAttach:C.Boolean(!0),showTooltip:C.Boolean(!0)})});var oh;!function(e){e.Descriptor={name:"ihm_cross_link_restraint"},e.Provider=td.create(e.Descriptor),e.fromTable=function t(n,r){const i={entity_id:n.entity_id_1,asym_id:n.asym_id_1,seq_id:n.seq_id_1,atom_id:n.atom_id_1},o={entity_id:n.entity_id_2,asym_id:n.asym_id_2,seq_id:n.seq_id_2,atom_id:n.atom_id_2};function s(p,m,h){const g=p.get(m);g?g.push(h):p.set(m,[h])}function a(p,m){const h=m.entity_id.value(p),g=m.asym_id.value(p),y=m.seq_id.value(p);if("by-atom"===n.model_granularity.value(p)){const b=r.atomicHierarchy.index.findAtom({auth_seq_id:y,label_asym_id:g,label_atom_id:m.atom_id.value(p),label_entity_id:h});b>=0&&s(u,b,p)}else if(r.coarseHierarchy.isDefined){const b=r.coarseHierarchy.spheres.findSequenceKey(h,g,y);if(b>=0)s(l,b,p);else{const x=r.coarseHierarchy.gaussians.findSequenceKey(h,g,y);x>=0&&s(d,x,p)}}}const u=new Map,l=new Map,d=new Map,f=[];for(let p=0;p{const g=function c(p){switch(p){case 0:return u;case 1:return l;case 2:return d}}(m).get(p);return void 0!==g?g:f},data:n}}}(oh||(oh={}));const bct=[];function ude(e,t,n,r){return`${e}|${t.id}|${n}|${r.id}`}class lde{getPairIndices(t,n,r,i){const o=ude(t,n,r,i);return this.pairKeyIndices.get(o)||bct}getPairs(t,n,r,i){return this.getPairIndices(t,n,r,i).map(s=>this.pairs[s])}constructor(t){this.pairs=t;const n=new Map;this.pairs.forEach((r,i)=>{const o=ude(r.indexA,r.unitA,r.indexB,r.unitB),s=n.get(o);s?s.push(i):n.set(o,[i])}),this.count=t.length,this.pairKeyIndices=n}}const sh=vp.createProvider({label:"Cross Link Restraint",descriptor:au({name:"integrative-cross-link-restraint"}),type:"local",defaultParams:{},getParams:e=>({}),isApplicable:e=>e.models.some(t=>!!oh.Provider.get(t)),obtain:function(){var e=ie(function*(t,n,r){return{value:xct(n)}});return function(n,r,i){return e.apply(this,arguments)}}()});var yd;function dde(e,t,n){const{elements:r}=t,i=r.length,o=t.kind;for(let s=0;se.set(c,s))}function vct(e,t,n){if(t.model!==n.model||"mmCIF"!==t.model.sourceData.kind)return;const r=oh.Provider.get(t.model);if(!r)return;const i=new Map,o=new Map;dde(i,t,r),dde(o,n,r),i.forEach((s,a)=>{const c=o.get(a);void 0!==c&&e.push(KE(t,s,n,c,r,a),KE(n,c,t,s,r,a))})}function _ct(e,t){if("mmCIF"!==t.model.sourceData.kind)return;const n=oh.Provider.get(t.model);if(!n)return;const{elements:r}=t,i=r.length,o=t.kind,s=new Map;for(let a=0;a{const l=s.get(u);l?l.push(a):s.set(u,[a])});s.forEach((a,c)=>{if(a.length<2)return;const[u,l]=a;e.push(KE(t,u,t,l,n,c),KE(t,l,t,u,n,c))})}function KE(e,t,n,r,i,o){return{unitA:e,indexA:t,unitB:n,indexB:r,restraintType:i.data.restraint_type.value(o),distanceThreshold:i.data.distance_threshold.value(o),psi:i.data.psi.value(o),sigma1:i.data.sigma_1.value(o),sigma2:i.data.sigma_2.value(o)}}function xct(e){const t=[];if(!e.models.some(r=>oh.Provider.get(r)))return new lde(t);const n=e.units.length;for(let r=0;r{const m=o.pairs[p],h=m.unitA,g=m.unitB;h.conformation.position(h.elements[m.indexA],d),g.conformation.position(g.elements[m.indexB],f)},radius:d=>{const f=o.pairs[d];return a.unit=f.unitA,a.element=f.unitA.elements[f.indexA],n.size.size(a)*s}},{mesh:u,boundingSphere:l}=B0(0,c,r,i);if(l)u.setBoundingSphere(l);else if(u.triangleCount>0){const d=_e.expand(_e(),t.boundary.sphere,1*s);u.setBoundingSphere(d)}return u}!function(e){let t;(t=e.Tag||(e.Tag={})).CrossLinkRestraint="cross-link-restraint",e.isApplicable=function n(h){return h.models.some(g=>!!oh.Provider.get(g))};const r=v(),i=v();function o(h){return h.unitA.conformation.position(h.unitA.elements[h.indexA],r),h.unitB.conformation.position(h.unitB.elements[h.indexB],i),v.distance(r,i)}function u(h,g){const y=h.pairs[g];return`Cross Link Restraint | Type: ${y.restraintType} | Threshold: ${y.distanceThreshold} \u212b | Psi: ${y.psi} | Sigma 1: ${y.sigma1} | Sigma 2: ${y.sigma2} | Distance: ${o(y).toFixed(2)} \u212b`}function p(h,g,y){return Og.fromPairProvider(g.length,(b,x,_)=>{const S=h.pairs[g[b]];S.unitA.conformation.position(S.unitA.elements[S.indexA],x),S.unitB.conformation.position(S.unitB.elements[S.indexB],_)},y)}function m(h,g,y){const b=y[0];if(void 0===b)return"";const x=g.pairs[b];return[u(g,b),c8(Lt.Location(h,x.unitA,x.indexA,h,x.unitB,x.indexB))].join("
")}e.distance=o,e.Location=function s(h,g,y){return yre("cross-link-restraints",{structure:g,crossLinkRestraints:h},y)},e.isLocation=function a(h){return!!h&&"data-location"===h.kind&&"cross-link-restraints"===h.tag},e.areLocationsEqual=function c(h,g){return h.data.structure===g.data.structure&&h.data.crossLinkRestraints===g.data.crossLinkRestraints&&h.element===g.element},e.locationLabel=function l(h){return u(h.data.crossLinkRestraints,h.element)},e.Loci=function d(h,g,y){return eE("cross-link-restraints",{structure:h,crossLinkRestraints:g},y,b=>p(g,y,b),()=>m(h,g,y))},e.isLoci=function f(h){return!!h&&"data-loci"===h.kind&&"interactions"===h.tag},e.getBoundingSphere=p,e.getLabel=m}(yd||(yd={}));const fde={...r1,...F0,sizeFactor:C.Numeric(.5,{min:0,max:10,step:.1})};function Cct(e){return rh({defaultProps:C.getDefaultValues(fde),createGeometry:Sct,createLocationIterator:wct,getLoci:Act,eachLocation:Ict,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.radialSegments!==r.radialSegments||n.linkCap!==r.linkCap}},e)}function wct(e){const t=sh.get(e).value,{pairs:n}=t,r=n.length,o=yd.Location(t,e);return Mr(r,1,1,a=>(o.element=a,o),!0)}function Act(e,t,n){const{objectId:r,groupId:i}=e;if(n===r){const o=sh.get(t).value;if(o.pairs[i])return yd.Loci(t,o,[i])}return $n}function Ict(e,t,n){let r=!1;if(yd.isLoci(e)){if(!Ve.areEquivalent(e.data.structure,t))return!1;const i=sh.get(t).value;if(e.data.crossLinkRestraints!==i)return!1;for(const o of e.elements)n(Ce.ofSingleton(o))&&(r=!0)}return r}const Tct={"cross-link-restraint":(e,t)=>Iu("Cross-link restraint",e,t,Cct)},pde={...fde},hde={name:yd.Tag.CrossLinkRestraint,label:"Cross Link Restraint",description:"Displays cross-link restraints.",factory:function Ect(e,t){return yn.createMulti("CrossLinkRestraint",e,t,ms,Tct)},getParams:function Dct(e,t){return C.clone(pde)},defaultValues:C.getDefaultValues(pde),defaultColorTheme:{name:yd.Tag.CrossLinkRestraint},defaultSizeTheme:{name:"uniform"},isApplicable:e=>yd.isApplicable(e),ensureCustomProperties:{attach:(e,t)=>sh.attach(e,t,void 0,!0),detach:e=>sh.ref(e,!1)}},mde=st(13421772),gde={domain:C.Interval([.5,1.5],{step:.01}),list:C.ColorList("red-grey",{presetKind:"scale"})},bde={name:"cross-link",label:"Cross Link",category:Lc.Category.Misc,factory:function yde(e,t){let n,r;const i=e.structure&&sh.get(e.structure).value;if(i){r=Gu.create({domain:t.domain,listOrName:t.list.colors});const o=r.color;n=s=>{if(yd.isLocation(s)){const a=i.pairs[s.element];if(a)return o(yd.distance(a)/a.distanceThreshold)}return mde}}else n=()=>mde;return{factory:yde,granularity:"group",color:n,props:t,description:"Colors cross-links by the deviation of the observed distance versus the modeled distance (e.g. modeled / `ihm_cross_link_restraint.distance_threshold`).",legend:r?r.legend:void 0}},getParams:function Mct(e){return gde},defaultValues:C.getDefaultValues(gde),isApplicable:e=>!!e.structure&&yd.isApplicable(e.structure),ensureCustomProperties:{attach:(e,t)=>t.structure?sh.attach(e,t.structure,void 0,!0):Promise.resolve(),detach:e=>e.structure&&sh.ref(e.structure,!1)}},Rct=tr.create({name:"integrative-cross-link-restraint",category:"custom-props",display:{name:"Cross Link Restraint"},ctor:class extends tr.Handler{constructor(){super(...arguments),this.provider=oh.Provider}register(){this.provider.formatRegistry.add("mmCIF",kct),this.ctx.representation.structure.themes.colorThemeRegistry.add(bde),this.ctx.representation.structure.registry.add(hde)}unregister(){this.provider.formatRegistry.remove("mmCIF"),this.ctx.representation.structure.themes.colorThemeRegistry.remove(bde),this.ctx.representation.structure.registry.remove(hde)}}});function kct(e){if(!Er.is(e.sourceData))return;const{ihm_cross_link_restraint:t}=e.sourceData.data.db;return 0!==t._rowCount?oh.fromTable(t,e):void 0}const ZE={State:YP,Representation:XP,Camera:KP,Misc:ZP},zc={Representation:QP,Camera:JP,CustomProps:eM};function QE(e,t,n={}){return"string"==typeof n.type||"string"==typeof n.color||"string"==typeof n.size?function Nct(e,t,n){const r=n.type&&e.representation.structure.registry.get(n.type)||e.representation.structure.registry.default.provider,i=n.color&&e.representation.structure.themes.colorThemeRegistry.get(n.color)||e.representation.structure.themes.colorThemeRegistry.get(r.defaultColorTheme.name),o=n.size&&e.representation.structure.themes.sizeThemeRegistry.get(n.size)||e.representation.structure.themes.sizeThemeRegistry.get(r.defaultSizeTheme.name);return _de(e,t,{type:r,typeParams:n.typeParams,color:i,colorParams:n.colorParams,size:o,sizeParams:n.sizeParams})}(e,t||Ve.Empty,n):_de(e,t||Ve.Empty,n)}function MU(e,t,n,r,i){const{registry:o,themes:s}=e.representation.structure,a=o.get(n||o.default.name),c=s.colorThemeRegistry.get(r||a.defaultColorTheme.name),u=C.getDefaultValues(c.getParams({structure:t||Ve.Empty}));return c.name===a.defaultColorTheme.name&&Object.assign(u,a.defaultColorTheme.props),{name:c.name,params:Object.assign(u,i)}}function vde(e,t,n,r,i){const{registry:o,themes:s}=e.representation.structure,a=o.get(n||o.default.name),c=s.sizeThemeRegistry.get(r||a.defaultSizeTheme.name),u=C.getDefaultValues(c.getParams({structure:t||Ve.Empty}));return c.name===a.defaultSizeTheme.name&&Object.assign(u,a.defaultSizeTheme.props),{name:c.name,params:Object.assign(u,i)}}function _de(e,t,n={}){const{themes:r}=e.representation.structure,i={structure:t},o=n.type||e.representation.structure.registry.default.provider,s=C.getDefaultValues(o.getParams(r,t)),a=Object.assign(s,n.typeParams),c=n.color||r.colorThemeRegistry.get(o.defaultColorTheme.name),u=C.getDefaultValues(c.getParams(i));c.name===o.defaultColorTheme.name&&Object.assign(u,o.defaultColorTheme.props);const l=Object.assign(u,n.colorParams),d=n.size||r.sizeThemeRegistry.get(o.defaultSizeTheme.name),f=C.getDefaultValues(d.getParams(i));d.name===o.defaultSizeTheme.name&&Object.assign(f,o.defaultSizeTheme.props);const p=Object.assign(f,n.sizeParams);return{type:{name:o.name,params:a},colorTheme:{name:c.name,params:l},sizeTheme:{name:d.name,params:p}}}const xde=["target","surroundings","interactions"];var oi=function(e){return e.TargetSel="structure-focus-target-sel",e.TargetRepr="structure-focus-target-repr",e.SurrSel="structure-focus-surr-sel",e.SurrRepr="structure-focus-surr-repr",e.SurrNciRepr="structure-focus-surr-nci-repr",e}(oi||{});const Bct=new Set([oi.TargetSel,oi.TargetRepr,oi.SurrSel,oi.SurrRepr,oi.SurrNciRepr]),JE=tr.create({name:"create-structure-focus-representation",display:{name:"Structure Focus Representation"},category:"interaction",ctor:class Oct extends tr.WithSubscribers{constructor(){super(...arguments),this.currentSource=void 0}get surrLabel(){return`[Focus] Surroundings (${this.params.expandRadius} \xc5)`}getReprParams(t){return{...t,type:{name:t.type.name,params:{...t.type.params,ignoreHydrogens:this.params.ignoreHydrogens,ignoreHydrogensVariant:this.params.ignoreHydrogensVariant,ignoreLight:this.params.ignoreLight,material:this.params.material,clip:this.params.clip}}}}ensureShape(t){var n;const r=this.plugin.state.data,i=r.tree,o=r.build(),s=In.findUniqueTagsInSubtree(i,t.transform.ref,Bct);s[oi.TargetSel]||(s[oi.TargetSel]=o.to(t).apply(Ye.Model.StructureSelectionFromBundle,{bundle:Kn.Empty,label:"[Focus] Target"},{tags:oi.TargetSel}).ref),s[oi.SurrSel]||(s[oi.SurrSel]=o.to(t).apply(Ye.Model.StructureSelectionFromExpression,{expression:ue.struct.generator.empty(),label:this.surrLabel},{tags:oi.SurrSel}).ref);const a=this.params.components;return a.indexOf("target")>=0&&!s[oi.TargetRepr]&&(s[oi.TargetRepr]=o.to(s[oi.TargetSel]).apply(Ye.Representation.StructureRepresentation3D,this.getReprParams(this.params.targetParams),{tags:oi.TargetRepr}).ref),a.indexOf("surroundings")>=0&&!s[oi.SurrRepr]&&(s[oi.SurrRepr]=o.to(s[oi.SurrSel]).apply(Ye.Representation.StructureRepresentation3D,this.getReprParams(this.params.surroundingsParams),{tags:oi.SurrRepr}).ref),a.indexOf("interactions")>=0&&!s[oi.SurrNciRepr]&&t.obj&&XE.isApplicable(null===(n=t.obj)||void 0===n?void 0:n.data)&&(s[oi.SurrNciRepr]=o.to(s[oi.SurrSel]).apply(Ye.Representation.StructureRepresentation3D,this.getReprParams(this.params.nciParams),{tags:oi.SurrNciRepr}).ref),{state:r,builder:o,refs:s}}clear(t){const n=this.plugin.state.data;this.currentSource=void 0;const r=n.select(In.Generators.byRef(t).subtree().withTag(oi.TargetSel)),i=n.select(In.Generators.byRef(t).subtree().withTag(oi.SurrSel));if(0===r.length&&0===i.length)return;const o=n.build(),s=Kn.Empty;for(const c of r)o.to(c).update(Ye.Model.StructureSelectionFromBundle,u=>({...u,bundle:s}));const a=ue.struct.generator.empty();for(const c of i)o.to(c).update(Ye.Model.StructureSelectionFromExpression,u=>({...u,expression:a}));return Cn.State.Update(this.plugin,{state:n,tree:o,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}})}focus(t){var n=this;return ie(function*(){const r=n.plugin.helpers.substructureParent.get(t.structure);if(!r||!r.obj)return;n.currentSource=t;const i=De.remap(t,r.obj.data),o=De.extendToWholeResidues(i),s=Kn.fromLoci(o),a=Kn.toExpression(s);let c=ue.struct.modifier.includeSurroundings({0:a,radius:n.params.expandRadius,"as-whole-residues":!0});n.params.excludeTargetFromSurroundings&&(c=ue.struct.modifier.exceptBy({0:c,by:a}));const{state:u,builder:l,refs:d}=n.ensureShape(r);l.to(d[oi.TargetSel]).update(Ye.Model.StructureSelectionFromBundle,f=>({...f,bundle:s})),l.to(d[oi.SurrSel]).update(Ye.Model.StructureSelectionFromExpression,f=>({...f,expression:c,label:n.surrLabel})),yield Cn.State.Update(n.plugin,{state:u,tree:l,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}})})()}register(t){this.subscribeObservable(this.plugin.managers.structure.focus.behaviors.current,n=>{n?this.focus(n.loci):this.clear(ur.RootRef)})}update(t){var n=this;return ie(function*(){const r=n.params;if(n.params=t,r.excludeTargetFromSurroundings!==t.excludeTargetFromSurroundings)return n.currentSource&&n.focus(n.currentSource),!0;const i=n.plugin.state.data,o=i.build(),s=In.Generators.root.subtree(),a=n.params.components;let c=a.indexOf("target")>=0;for(const u of i.select(s.withTag(oi.TargetRepr)))c?o.to(u).update(n.getReprParams(n.params.targetParams)):o.delete(u.transform.ref);c=a.indexOf("surroundings")>=0;for(const u of i.select(s.withTag(oi.SurrRepr)))c?o.to(u).update(n.getReprParams(n.params.surroundingsParams)):o.delete(u.transform.ref);c=a.indexOf("interactions")>=0;for(const u of i.select(s.withTag(oi.SurrNciRepr)))c?o.to(u).update(n.getReprParams(n.params.nciParams)):o.delete(u.transform.ref);return yield Cn.State.Update(n.plugin,{state:i,tree:o,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}}),t.expandRadius!==r.expandRadius&&n.currentSource&&n.focus(n.currentSource),!0})()}},params:(e,t)=>(e=>{const t=Ye.Representation.StructureRepresentation3D.definition.params(void 0,e);return{expandRadius:C.Numeric(5,{min:1,max:10,step:1}),targetParams:C.Group(t,{label:"Target",customDefault:QE(e,void 0,{type:"ball-and-stick",size:"physical",typeParams:{sizeFactor:.22,sizeAspectRatio:.73,adjustCylinderLength:!0,xrayShaded:!0,aromaticBonds:!1,multipleBonds:"off",excludeTypes:["hydrogen-bond","metal-coordination"]}})}),surroundingsParams:C.Group(t,{label:"Surroundings",customDefault:QE(e,void 0,{type:"ball-and-stick",size:"physical",typeParams:{sizeFactor:.16,excludeTypes:["hydrogen-bond","metal-coordination"]}})}),nciParams:C.Group(t,{label:"Non-covalent Int.",customDefault:QE(e,void 0,{type:XE,color:_U,size:Qo.BuiltIn.uniform})}),components:C.MultiSelect(xde,C.arrayToOptions(xde)),excludeTargetFromSurroundings:C.Boolean(!1,{label:"Exclude Target",description:'Exclude the focus "target" from the surroudings component.'}),ignoreHydrogens:C.Boolean(!1),ignoreHydrogensVariant:C.Select("all",C.arrayToOptions(["all","non-polar"])),ignoreLight:C.Boolean(!1),material:ba.getParam(),clip:C.Group(gm.Params)}})(t)});function oa(e){return e}!function(e){function t(o){return"chain-id"===o?{name:o,params:use.defaultValues}:"operator-name"===o?{name:o,params:N6.defaultValues}:{name:o,params:{}}}e.CommonParams={ignoreHydrogens:C.Optional(C.Boolean(!1)),ignoreHydrogensVariant:C.Optional(C.Select("all",C.arrayToOptions(["all","non-polar"]))),ignoreLight:C.Optional(C.Boolean(!1)),quality:C.Optional(C.Select("auto",t5)),theme:C.Optional(C.Group({globalName:C.Optional(C.Text("")),globalColorParams:C.Optional(C.Value({},{isHidden:!0})),carbonColor:C.Optional(C.Select("chain-id",C.arrayToOptions(["chain-id","operator-name","element-symbol"]))),symmetryColor:C.Optional(C.Text("")),symmetryColorParams:C.Optional(C.Value({},{isHidden:!0})),focus:C.Optional(C.Group({name:C.Optional(C.Text("")),params:C.Optional(C.Value({}))}))}))},e.reprBuilder=function r(o,s,a){var c,u,l,d,f,p,m,h,g,y,b,x,_,S;const A=o.state.data.build(),E=o.builders.structure.representation,w=o.managers.structure.component.state.options.hydrogens,D={quality:o.managers.structure.component.state.options.visualQuality,ignoreHydrogens:"all"!==w,ignoreHydrogensVariant:"only-polar"===w?"non-polar":"all",ignoreLight:o.managers.structure.component.state.options.ignoreLight};s.quality&&"auto"!==s.quality&&(D.quality=s.quality),void 0!==s.ignoreHydrogens&&(D.ignoreHydrogens=!!s.ignoreHydrogens),void 0!==s.ignoreHydrogensVariant&&(D.ignoreHydrogensVariant=s.ignoreHydrogensVariant),void 0!==s.ignoreLight&&(D.ignoreLight=!!s.ignoreLight);const I=null!==(c=s.theme)&&void 0!==c&&c.globalName?null===(u=s.theme)||void 0===u?void 0:u.globalName:void 0,R=void 0!==(null===(l=s.theme)||void 0===l?void 0:l.carbonColor)?{carbonColor:t(null===(d=s.theme)||void 0===d?void 0:d.carbonColor),...null===(f=s.theme)||void 0===f?void 0:f.globalColorParams}:{...null===(p=s.theme)||void 0===p?void 0:p.globalColorParams},T=a&&null!==(m=s.theme)&&void 0!==m&&m.symmetryColor&&function n(o){return o.units.some(s=>!s.conformation.operator.assembly&&s.conformation.operator.spgrOp>=0)}(a)?null===(h=s.theme)||void 0===h?void 0:h.symmetryColor:I;return{update:A,builder:E,color:I,symmetryColor:T,symmetryColorParams:null!==(g=s.theme)&&void 0!==g&&g.symmetryColorParams?{...null===(y=s.theme)||void 0===y?void 0:y.globalColorParams,...null===(b=s.theme)||void 0===b?void 0:b.symmetryColorParams}:{...null===(x=s.theme)||void 0===x?void 0:x.globalColorParams},globalColorParams:null!==(_=s.theme)&&void 0!==_&&_.globalColorParams?{...null===(S=s.theme)||void 0===S?void 0:S.globalColorParams}:void 0,typeParams:D,ballAndStickColor:R}},e.updateFocusRepr=function i(o,s,a,c){if(o.state.hasBehavior(JE))return o.state.updateBehavior(JE,u=>{const l=MU(o,s,"ball-and-stick",a||"element-symbol",c);u.surroundingsParams.colorTheme=l,u.targetParams.colorTheme=l})}}(oa||(oa={}));const km=oa.CommonParams,O0=oa.reprBuilder,L0=oa.updateFocusRepr,Lct=oa({id:"preset-structure-representation-auto",display:{name:"Automatic",description:"Show representations based on the size of the structure. Smaller structures are shown with more detail than larger ones, ranging from atomistic display to coarse surfaces."},params:()=>km,apply(e,t,n){var r,i;const o=null===(i=null===(r=ls.resolveAndCheck(n.state.data,e))||void 0===r?void 0:r.obj)||void 0===i?void 0:i.data;if(!o)return{};const s=n.config.get(qi.Structure.SizeThresholds)||Ve.DefaultSizeThresholds,a=Ve.getSize(o,s),c=o.polymerResidueCount/o.polymerGapCount;switch(a){case Ve.Size.Gigantic:case Ve.Size.Huge:return Cde.apply(e,t,n);case Ve.Size.Large:return wde.apply(e,t,n);case Ve.Size.Medium:if(c>3)return Sde.apply(e,t,n);case Ve.Size.Small:return Ade.apply(e,{...t,showCarbohydrateSymbol:!0},n);default:Rr()}}}),Uct=oa({id:"preset-structure-representation-empty",display:{name:"Empty",description:"Removes all existing representations."},apply:(e,t,n)=>ie(function*(){return{}})()}),uC="Basic",Sde=oa({id:"preset-structure-representation-polymer-and-ligand",display:{name:"Polymer & Ligand",group:uC,description:"Shows polymers as Cartoon, ligands as Ball & Stick, carbohydrates as 3D-SNFG and water molecules semi-transparent."},params:()=>km,apply:(e,t,n)=>ie(function*(){var r,i,o,s,a,c,u,l,d,f;const p=ls.resolveAndCheck(n.state.data,e);if(!p)return{};const m={polymer:yield pc(n,p,"polymer"),ligand:yield pc(n,p,"ligand"),nonStandard:yield pc(n,p,"non-standard"),branched:yield pc(n,p,"branched",{label:"Carbohydrate"}),water:yield pc(n,p,"water"),ion:yield pc(n,p,"ion"),lipid:yield pc(n,p,"lipid"),coarse:yield pc(n,p,"coarse")},h=p.obj.data,g={sizeFactor:h.isCoarseGrained?.8:.2},y=((null===(o=null===(i=null===(r=m.water)||void 0===r?void 0:r.obj)||void 0===i?void 0:i.data)||void 0===o?void 0:o.elementCount)||0)>5e4?"line":"ball-and-stick",b=((null===(c=null===(a=null===(s=m.lipid)||void 0===s?void 0:s.obj)||void 0===a?void 0:a.data)||void 0===c?void 0:c.elementCount)||0)>2e4?"line":"ball-and-stick",{update:x,builder:_,typeParams:S,color:A,symmetryColor:E,symmetryColorParams:w,globalColorParams:D,ballAndStickColor:I}=O0(n,t,h),R={polymer:_.buildRepresentation(x,m.polymer,{type:"cartoon",typeParams:{...S,...g},color:E,colorParams:w},{tag:"polymer"}),ligand:_.buildRepresentation(x,m.ligand,{type:"ball-and-stick",typeParams:S,color:A,colorParams:I},{tag:"ligand"}),nonStandard:_.buildRepresentation(x,m.nonStandard,{type:"ball-and-stick",typeParams:S,color:A,colorParams:I},{tag:"non-standard"}),branchedBallAndStick:_.buildRepresentation(x,m.branched,{type:"ball-and-stick",typeParams:{...S,alpha:.3},color:A,colorParams:I},{tag:"branched-ball-and-stick"}),branchedSnfg3d:_.buildRepresentation(x,m.branched,{type:"carbohydrate",typeParams:S,color:A,colorParams:D},{tag:"branched-snfg-3d"}),water:_.buildRepresentation(x,m.water,{type:y,typeParams:{...S,alpha:.6,visuals:"line"===y?["intra-bond","element-point"]:void 0},color:A,colorParams:{carbonColor:{name:"element-symbol",params:{}},...D}},{tag:"water"}),ion:_.buildRepresentation(x,m.ion,{type:"ball-and-stick",typeParams:S,color:A,colorParams:{carbonColor:{name:"element-symbol",params:{}},...D}},{tag:"ion"}),lipid:_.buildRepresentation(x,m.lipid,{type:b,typeParams:{...S,alpha:.6,visuals:"line"===b?["intra-bond"]:void 0},color:A,colorParams:{carbonColor:{name:"element-symbol",params:{}},...D}},{tag:"lipid"}),coarse:_.buildRepresentation(x,m.coarse,{type:"spacefill",typeParams:S,color:A||"chain-id",colorParams:D},{tag:"coarse"})};return yield x.commit({revertOnError:!1}),yield L0(n,h,null===(l=null===(u=t.theme)||void 0===u?void 0:u.focus)||void 0===l?void 0:l.name,null===(f=null===(d=t.theme)||void 0===d?void 0:d.focus)||void 0===f?void 0:f.params),{components:m,representations:R}})()}),Vct=oa({id:"preset-structure-representation-protein-and-nucleic",display:{name:"Protein & Nucleic",group:uC,description:"Shows proteins as Cartoon and RNA/DNA as Gaussian Surface."},params:()=>km,apply:(e,t,n)=>ie(function*(){var r,i,o,s;const a=ls.resolveAndCheck(n.state.data,e);if(!a)return{};const c={protein:yield Ide(n,a,"protein"),nucleic:yield Ide(n,a,"nucleic")},u=a.obj.data,l={sizeFactor:u.isCoarseGrained?.8:.2},d={radiusOffset:u.isCoarseGrained?2:0,smoothness:u.isCoarseGrained?1:1.5},{update:f,builder:p,typeParams:m,symmetryColor:h,symmetryColorParams:g}=O0(n,t,u),y={protein:p.buildRepresentation(f,c.protein,{type:"cartoon",typeParams:{...m,...l},color:h,colorParams:g},{tag:"protein"}),nucleic:p.buildRepresentation(f,c.nucleic,{type:"gaussian-surface",typeParams:{...m,...d},color:h,colorParams:g},{tag:"nucleic"})};return yield f.commit({revertOnError:!0}),yield L0(n,u,null===(i=null===(r=t.theme)||void 0===r?void 0:r.focus)||void 0===i?void 0:i.name,null===(s=null===(o=t.theme)||void 0===o?void 0:o.focus)||void 0===s?void 0:s.params),{components:c,representations:y}})()}),Cde=oa({id:"preset-structure-representation-coarse-surface",display:{name:"Coarse Surface",group:uC,description:"Shows polymers and lipids as coarse Gaussian Surface."},params:()=>km,apply:(e,t,n)=>ie(function*(){var r,i,o,s;const a=ls.resolveAndCheck(n.state.data,e);if(!a)return{};const c={polymer:yield pc(n,a,"polymer"),lipid:yield pc(n,a,"lipid")},u=a.obj.data,l=n.config.get(qi.Structure.SizeThresholds)||Ve.DefaultSizeThresholds,d=Ve.getSize(u,l),f=Object.create(null);d===Ve.Size.Gigantic?Object.assign(f,{traceOnly:!u.isCoarseGrained,radiusOffset:2,smoothness:1,visuals:["structure-gaussian-surface-mesh"]}):d===Ve.Size.Huge?Object.assign(f,{radiusOffset:u.isCoarseGrained?2:0,smoothness:1}):u.isCoarseGrained&&Object.assign(f,{radiusOffset:2,smoothness:1});const{update:p,builder:m,typeParams:h,symmetryColor:g,symmetryColorParams:y}=O0(n,t,u),b={polymer:m.buildRepresentation(p,c.polymer,{type:"gaussian-surface",typeParams:{...h,...f},color:g,colorParams:y},{tag:"polymer"}),lipid:m.buildRepresentation(p,c.lipid,{type:"gaussian-surface",typeParams:{...h,...f},color:g,colorParams:y},{tag:"lipid"})};return yield p.commit({revertOnError:!0}),yield L0(n,u,null===(i=null===(r=t.theme)||void 0===r?void 0:r.focus)||void 0===i?void 0:i.name,null===(s=null===(o=t.theme)||void 0===o?void 0:o.focus)||void 0===s?void 0:s.params),{components:c,representations:b}})()}),wde=oa({id:"preset-structure-representation-polymer-cartoon",display:{name:"Polymer Cartoon",group:uC,description:"Shows polymers as Cartoon."},params:()=>km,apply:(e,t,n)=>ie(function*(){var r,i,o,s;const a=ls.resolveAndCheck(n.state.data,e);if(!a)return{};const c={polymer:yield pc(n,a,"polymer")},u=a.obj.data,l={sizeFactor:u.isCoarseGrained?.8:.2},{update:d,builder:f,typeParams:p,symmetryColor:m,symmetryColorParams:h}=O0(n,t,u),g={polymer:f.buildRepresentation(d,c.polymer,{type:"cartoon",typeParams:{...p,...l},color:m,colorParams:h},{tag:"polymer"})};return yield d.commit({revertOnError:!0}),yield L0(n,u,null===(i=null===(r=t.theme)||void 0===r?void 0:r.focus)||void 0===i?void 0:i.name,null===(s=null===(o=t.theme)||void 0===o?void 0:o.focus)||void 0===s?void 0:s.params),{components:c,representations:g}})()}),Ade=oa({id:"preset-structure-representation-atomic-detail",display:{name:"Atomic Detail",group:uC,description:"Shows everything in atomic detail with Ball & Stick."},params:()=>({...km,showCarbohydrateSymbol:C.Boolean(!1)}),apply:(e,t,n)=>ie(function*(){var r,i,o,s,a,c;const u=ls.resolveAndCheck(n.state.data,e);if(!u)return{};const l={all:yield pc(n,u,"all"),branched:void 0},d=u.obj.data,f=d.elementCount>1e5,p=d.atomicResidueCount&&d.elementCount>1e3&&d.atomicResidueCount/d.elementCount<3,m=d.models[0],h=!!Ms.Provider.get(m)||du.isExhaustive(m);let g="ball-and-stick";d.isCoarseGrained?g=d.elementCount>1e6?"point":"spacefill":p&&!h?g="spacefill":f&&(g="line");const y=t.showCarbohydrateSymbol&&!f&&!p;y&&Object.assign(l,{branched:yield pc(n,u,"branched",{label:"Carbohydrate"})});const{update:b,builder:x,typeParams:_,color:S,ballAndStickColor:A,globalColorParams:E}=O0(n,t,d),w=p&&!h?{carbonColor:{name:"element-symbol",params:{}},...E}:A,D={all:x.buildRepresentation(b,l.all,{type:g,typeParams:_,color:S,colorParams:w},{tag:"all"})};return y&&Object.assign(D,{snfg3d:x.buildRepresentation(b,l.branched,{type:"carbohydrate",typeParams:{..._,alpha:.4,visuals:["carbohydrate-symbol"]},color:S,colorParams:E},{tag:"snfg-3d"})}),yield b.commit({revertOnError:!0}),yield L0(n,d,null!==(o=null===(i=null===(r=t.theme)||void 0===r?void 0:r.focus)||void 0===i?void 0:i.name)&&void 0!==o?o:S,null!==(c=null===(a=null===(s=t.theme)||void 0===s?void 0:s.focus)||void 0===a?void 0:a.params)&&void 0!==c?c:w),{components:l,representations:D}})()}),zct=oa({id:"preset-structure-representation-illustrative",display:{name:"Illustrative",group:"Miscellaneous",description:"..."},params:()=>({...km,showCarbohydrateSymbol:C.Boolean(!1)}),apply:(e,t,n)=>ie(function*(){var r,i,o,s,a;const c=ls.resolveAndCheck(n.state.data,e);if(!c)return{};const u={all:yield pc(n,c,"all"),branched:void 0},l=c.obj.data,{update:d,builder:f,typeParams:p,color:m}=O0(n,t,l),h={all:f.buildRepresentation(d,u.all,{type:"spacefill",typeParams:{...p,ignoreLight:!0},color:"illustrative"},{tag:"all"})};return yield d.commit({revertOnError:!0}),yield L0(n,l,null!==(o=null===(i=null===(r=t.theme)||void 0===r?void 0:r.focus)||void 0===i?void 0:i.name)&&void 0!==o?o:m,null===(a=null===(s=t.theme)||void 0===s?void 0:s.focus)||void 0===a?void 0:a.params),{components:u,representations:h}})()}),Gct=oa({id:"preset-structure-representation-auto-lod",display:{name:"Automatic Detail",group:"Miscellaneous",description:"Shows more (or less) detailed representations automatically based on camera distance."},params:()=>km,apply:(e,t,n)=>ie(function*(){var r,i,o,s;const a=ls.resolveAndCheck(n.state.data,e);if(!a)return{};const c={all:yield pc(n,a,"all")},u=a.obj.data,l={sizeFactor:u.isCoarseGrained?.8:.2},{update:d,builder:f,typeParams:p,color:m,symmetryColor:h,symmetryColorParams:g,ballAndStickColor:y}=O0(n,t,u),b={gaussianSurface:f.buildRepresentation(d,c.all,{type:"gaussian-surface",typeParams:{...p,lod:v.create(30,1e7,100)},color:h,colorParams:g},{tag:"gaussian-surface"}),cartoon:f.buildRepresentation(d,c.all,{type:"cartoon",typeParams:{...p,...l,lod:v.create(-20,300,100)},color:h,colorParams:g},{tag:"cartoon"}),ballAndStick:f.buildRepresentation(d,c.all,{type:"ball-and-stick",typeParams:{...p,lod:v.create(-20,40,20)},color:m,colorParams:y},{tag:"ball-and-stick"})};return yield d.commit({revertOnError:!1}),yield L0(n,u,null===(i=null===(r=t.theme)||void 0===r?void 0:r.focus)||void 0===i?void 0:i.name,null===(s=null===(o=t.theme)||void 0===o?void 0:o.focus)||void 0===s?void 0:s.params),{components:c,representations:b}})()});function pc(e,t,n,r){return e.builders.structure.tryCreateComponentStatic(t,n,r)}function Ide(e,t,n,r){return e.builders.structure.tryCreateComponentFromSelection(t,No[n],`selection-${n}`,r)}const Mf={empty:Uct,auto:Lct,"atomic-detail":Ade,"polymer-cartoon":wde,"polymer-and-ligand":Sde,"protein-and-nucleic":Vct,"coarse-surface":Cde,illustrative:zct,"auto-lod":Gct};function e3(e,t){if("bcif"===e.ext)try{const{encoder:n}=$J(t);if(n.startsWith("VolumeServer"))return"dscif";if(n.startsWith("volseg-volume-server"))return"segcif"}catch(n){console.error(n)}else if("cif"===e.ext){const n=t;if(n.startsWith("data_SERVER\n#\n_density_server_result"))return"dscif";if(n.startsWith("data_SERVER\n#\ndata_SEGMENTATION_DATA"))return"segcif";if(n.includes("atom_site_fract_x")||n.includes("atom_site.fract_x"))return"coreCif"}return-1}const bd="Trajectory";function ah(e,t){return e.builders.structure.hierarchy.applyPreset(t.trajectory,"default")}const jct={label:"mmCIF",description:"mmCIF",category:bd,stringExtensions:["cif","mmcif","mcif"],binaryExtensions:["bcif"],isApplicable:(e,t)=>"mmcif"===e.ext||"mcif"===e.ext||("cif"===e.ext||"bcif"===e.ext)&&-1===e3(e,t),parse:function(){var e=ie(function*(t,n,r){var i,o;const a=t.state.data.build().to(n).apply(Ye.Data.ParseCif,void 0,{state:{isGhost:!0}}),c=yield a.apply(Ye.Model.TrajectoryFromMmCif,void 0,{tags:r?.trajectoryTags}).commit({revertOnError:!0});return((null===(o=null===(i=a.selector.cell)||void 0===i?void 0:i.obj)||void 0===o?void 0:o.data.blocks.length)||0)>1&&t.state.data.updateCellState(a.ref,{isGhost:!1}),{trajectory:c}});return function(n,r,i){return e.apply(this,arguments)}}(),visuals:ah},Hct={label:"cifCore",description:"CIF Core",category:bd,stringExtensions:["cif"],isApplicable:(e,t)=>"cif"===e.ext&&"coreCif"===e3(e,t),parse:function(){var e=ie(function*(t,n,r){var i,o;const a=t.state.data.build().to(n).apply(Ye.Data.ParseCif,void 0,{state:{isGhost:!0}}),c=yield a.apply(Ye.Model.TrajectoryFromCifCore,void 0,{tags:r?.trajectoryTags}).commit({revertOnError:!0});return((null===(o=null===(i=a.selector.cell)||void 0===i?void 0:i.obj)||void 0===o?void 0:o.data.blocks.length)||0)>1&&t.state.data.updateCellState(a.ref,{isGhost:!1}),{trajectory:c}});return function(n,r,i){return e.apply(this,arguments)}}(),visuals:ah};function U0(e,t){return function(){var n=ie(function*(r,i,o){return{trajectory:yield r.state.data.build().to(i).apply(e,t,{tags:o?.trajectoryTags}).commit({revertOnError:!0})}});return function(r,i,o){return n.apply(this,arguments)}}()}const qct={label:"PDB",description:"PDB",category:bd,stringExtensions:["pdb","ent"],parse:U0(Ye.Model.TrajectoryFromPDB),visuals:ah},Wct={label:"PDBQT",description:"PDBQT",category:bd,stringExtensions:["pdbqt"],parse:U0(Ye.Model.TrajectoryFromPDB,{isPdbqt:!0}),visuals:ah},$ct={label:"XYZ",description:"XYZ",category:bd,stringExtensions:["xyz"],parse:U0(Ye.Model.TrajectoryFromXYZ),visuals:ah},Tde=[["mmcif",jct],["cifCore",Hct],["pdb",qct],["pdbqt",Wct],["gro",{label:"GRO",description:"GRO",category:bd,stringExtensions:["gro"],binaryExtensions:[],parse:U0(Ye.Model.TrajectoryFromGRO),visuals:ah}],["xyz",$ct],["mol",{label:"MOL",description:"MOL",category:bd,stringExtensions:["mol"],parse:U0(Ye.Model.TrajectoryFromMOL),visuals:ah}],["sdf",{label:"SDF",description:"SDF",category:bd,stringExtensions:["sdf","sd"],parse:U0(Ye.Model.TrajectoryFromSDF),visuals:ah}],["mol2",{label:"MOL2",description:"MOL2",category:bd,stringExtensions:["mol2"],parse:U0(Ye.Model.TrajectoryFromMOL2),visuals:ah}]],Qct=["gz","zip"];function o1(e){let t=e,n="";const r=t.lastIndexOf("?"),i=-1!==r?t.substring(r):"";t=t.substring(0,-1===r?t.length:r);const o=t.replace(/^.*[\\/]/,"");let s=o.substring(0,o.lastIndexOf("."));const a=o.split(".");let c=a.length>1?(a.pop()||"").toLowerCase():"";const u=t.match(/^(.+):\/\/(.+)$/);u&&(n=u[1].toLowerCase(),t=u[2]||"");const l=t.substring(0,t.lastIndexOf("/")+1);return Qct.includes(c)&&(c=(t.substr(0,t.length-c.length-1).split(".").pop()||"").toLowerCase(),s=s.substr(0,s.length-c.length-1)),{path:t,name:o,ext:c,base:s,dir:l,protocol:n,query:i}}const lC="Topology",Jct={label:"PSF",description:"PSF",category:lC,stringExtensions:["psf"],parse:function(){var e=ie(function*(t,n){const r=t.state.data.build().to(n).apply(Ye.Data.ParsePsf,{},{state:{isGhost:!0}}),i=r.apply(Ye.Model.TopologyFromPsf);return yield r.commit(),{format:r.selector,topology:i.selector}});return function(n,r){return e.apply(this,arguments)}}()},eut={label:"PRMTOP",description:"PRMTOP",category:lC,stringExtensions:["prmtop","parm7"],parse:function(){var e=ie(function*(t,n){const r=t.state.data.build().to(n).apply(Ye.Data.ParsePrmtop,{},{state:{isGhost:!0}}),i=r.apply(Ye.Model.TopologyFromPrmtop);return yield r.commit(),{format:r.selector,topology:i.selector}});return function(n,r){return e.apply(this,arguments)}}()},tut={label:"TOP",description:"TOP",category:lC,stringExtensions:["top"],parse:function(){var e=ie(function*(t,n){const r=t.state.data.build().to(n).apply(Ye.Data.ParseTop,{},{state:{isGhost:!0}}),i=r.apply(Ye.Model.TopologyFromTop);return yield r.commit(),{format:r.selector,topology:i.selector}});return function(n,r){return e.apply(this,arguments)}}()},nut=[["psf",Jct],["prmtop",eut],["top",tut]],s1="Coordinates",rut={label:"DCD",description:"DCD",category:s1,binaryExtensions:["dcd"],parse:(e,t)=>e.state.data.build().to(t).apply(Ye.Model.CoordinatesFromDcd).commit()},iut={label:"XTC",description:"XTC",category:s1,binaryExtensions:["xtc"],parse:(e,t)=>e.state.data.build().to(t).apply(Ye.Model.CoordinatesFromXtc).commit()},out={label:"TRR",description:"TRR",category:s1,binaryExtensions:["trr"],parse:(e,t)=>e.state.data.build().to(t).apply(Ye.Model.CoordinatesFromTrr).commit()},sut={label:"NCTRAJ",description:"NCTRAJ",category:s1,binaryExtensions:["nc","nctraj"],parse:(e,t)=>e.state.data.build().to(t).apply(Ye.Model.CoordinatesFromNctraj).commit()},aut=[["dcd",rut],["xtc",iut],["trr",out],["nctraj",sut]],Dde={rcsb:C.Group({encoding:C.Select("bcif",C.arrayToOptions(["cif","bcif"]))},{label:"RCSB PDB",isFlat:!0}),pdbe:C.Group({variant:C.Select("updated-bcif",[["updated-bcif","Updated (bcif)"],["updated","Updated"],["archival","Archival"]])},{label:"PDBe",isFlat:!0}),pdbj:C.EmptyGroup({label:"PDBj"})},uut=nc.build({from:pe.Root,display:{name:"Download Structure",description:"Load a structure from the provided source and create its representation."},params:(e,t)=>{const n=(e=>{const t=e.config.get(qi.Structure.DefaultRepresentationPreset)||Mf.auto.id;return C.Group({type:b0.getParams(void 0,"auto").type,representation:C.Select(t,e.builders.structure.representation.getPresets().map(n=>[n.id,n.display.name,n.display.group]),{description:"Which representation preset to use."}),representationParams:C.Group(oa.CommonParams,{isHidden:!0}),asTrajectory:C.Optional(C.Boolean(!1,{description:"Load all entries into a single trajectory."}))},{isExpanded:!1})})(t),r=t.config.get(qi.Download.DefaultPdbProvider)||"pdbe";return{source:C.MappedStatic("pdb",{pdb:C.Group({provider:C.Group({id:C.Text("1tqn",{label:"PDB Id(s)",description:"One or more comma/space separated PDB ids."}),server:C.MappedStatic(r,Dde)},{pivot:"id"}),options:n},{isFlat:!0,label:"PDB"}),"pdb-dev":C.Group({provider:C.Group({id:C.Text("PDBDEV_00000001",{label:"PDB-Dev Id(s)",description:"One or more comma/space separated ids."}),encoding:C.Select("bcif",C.arrayToOptions(["cif","bcif"]))},{pivot:"id"}),options:n},{isFlat:!0,label:"PDB-Dev"}),swissmodel:C.Group({id:C.Text("Q9Y2I8",{label:"UniProtKB AC(s)",description:"One or more comma/space separated ACs."}),options:n},{isFlat:!0,label:"SWISS-MODEL",description:"Loads the best homology model or experimental structure"}),alphafolddb:C.Group({id:C.Text("Q8W3K0",{label:"UniProtKB AC(s)",description:"One or more comma/space separated ACs."}),options:n},{isFlat:!0,label:"AlphaFold DB",description:"Loads the predicted model if available"}),modelarchive:C.Group({id:C.Text("ma-bak-cepc-0003",{label:"Accession Code(s)",description:"One or more comma/space separated ACs."}),options:n},{isFlat:!0,label:"Model Archive"}),pubchem:C.Group({id:C.Text("2244,2245",{label:"PubChem ID",description:"One or more comma/space separated IDs."}),options:n},{isFlat:!0,label:"PubChem",description:"Loads 3D conformer from PubChem."}),url:C.Group({url:C.Url(""),format:C.Select("mmcif",C.arrayToOptions(Tde.map(i=>i[0]),i=>i)),isBinary:C.Boolean(!1),label:C.Optional(C.Text("")),options:n},{isFlat:!0,label:"URL"})})}}})(({params:e,state:t},n)=>Oe.create("Download Structure",function(){var r=ie(function*(i){n.behaviors.layout.leftPanelTabName.next("data");const o=e.source;let s,a=!1,c="mmcif";switch(o.name){case"url":s=[{url:o.params.url,isBinary:o.params.isBinary,label:o.params.label||void 0}],c=o.params.format;break;case"pdb":s=yield"pdbe"===o.params.provider.server.name?function lut(e){return kU.apply(this,arguments)}(o):"pdbj"===o.params.provider.server.name?function dut(e){return NU.apply(this,arguments)}(o):"rcsb"===o.params.provider.server.name?function fut(e){return FU.apply(this,arguments)}(o):Rr(),a=!!o.params.options.asTrajectory;break;case"pdb-dev":s=yield vd(o.params.provider.id,f=>{const p=f.toUpperCase().startsWith("PDBDEV_")?f:`PDBDEV_${f.padStart(8,"0")}`;return"bcif"===o.params.provider.encoding?`https://pdb-dev.wwpdb.org/bcif/${p.toUpperCase()}.bcif`:`https://pdb-dev.wwpdb.org/cif/${p.toUpperCase()}.cif`},f=>f.toUpperCase().startsWith("PDBDEV_")?f:`PDBDEV_${f.padStart(8,"0")}`,"bcif"===o.params.provider.encoding),a=!!o.params.options.asTrajectory;break;case"swissmodel":s=yield vd(o.params.id,f=>`https://swissmodel.expasy.org/repository/uniprot/${f.toUpperCase()}.pdb`,f=>`SWISS-MODEL: ${f}`,!1),a=!!o.params.options.asTrajectory,c="pdb";break;case"alphafolddb":s=yield vd(o.params.id,function(){var f=ie(function*(p){const m=`https://www.alphafold.ebi.ac.uk/api/prediction/${p.toUpperCase()}`,h=yield n.runTask(n.fetch({url:m,type:"json"}));if(Array.isArray(h)&&h.length>0)return h[0].cifUrl;throw new Error(`No AlphaFold DB entry for '${p}'`)});return function(p){return f.apply(this,arguments)}}(),f=>`AlphaFold DB: ${f}`,!1),a=!!o.params.options.asTrajectory,c="mmcif";break;case"modelarchive":s=yield vd(o.params.id,f=>`https://www.modelarchive.org/doi/10.5452/${f.toLowerCase()}.cif`,f=>`Model Archive: ${f}`,!1),a=!!o.params.options.asTrajectory,c="mmcif";break;case"pubchem":s=yield vd(o.params.id,f=>`https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/CID/${f.trim()}/record/SDF/?record_type=3d`,f=>`PubChem: ${f}`,!1),a=!!o.params.options.asTrajectory,c="mol";break;default:Rr()}const u=e.source.params.options.representation||n.config.get(qi.Structure.DefaultRepresentationPreset)||Mf.auto.id,l=u!==Mf.empty.id,d="auto"===o.params.options.type.name?void 0:o.params.options.type;yield t.transaction(ie(function*(){var f;if(s.length>0&&a){const p=yield n.builders.data.downloadBlob({sources:s.map((h,g)=>({id:""+g,url:h.url,isBinary:h.isBinary})),maxConcurrency:6},{state:{isGhost:!0}}),m=yield n.builders.structure.parseTrajectory(p,{formats:s.map((h,g)=>({id:""+g,format:"cif"}))});yield n.builders.structure.hierarchy.applyPreset(m,"default",{structure:d,showUnitcell:l,representationPreset:u,representationPresetParams:e.source.params.options.representationParams})}else for(const p of s){const m=yield n.builders.data.download(p,{state:{isGhost:!0}}),h="auto"===c?n.dataFormats.auto(o1(fr.getUrl(p.url)),null===(f=m.cell)||void 0===f?void 0:f.obj):n.dataFormats.get(c);if(!h)throw new Error("unknown file format");const g=yield n.builders.structure.parseTrajectory(m,h);yield n.builders.structure.hierarchy.applyPreset(g,"default",{structure:d,showUnitcell:l,representationPreset:u,representationPresetParams:e.source.params.options.representationParams})}})).runInContext(i)});return function(i){return r.apply(this,arguments)}}()));function vd(e,t,n,r){return RU.apply(this,arguments)}function RU(){return RU=ie(function*(e,t,n,r){const i=e.split(/[,\s]/).map(s=>s.trim()).filter(s=>!!s&&(s.length>=4||/^[1-9][0-9]*$/.test(s))),o=[];for(const s of i)o.push({url:fr.Url(yield t(s)),isBinary:r,label:n(s)});return o}),RU.apply(this,arguments)}function kU(){return kU=ie(function*(e){if("pdb"!==e.name||"pdbe"!==e.params.provider.server.name)throw new Error("expected pdbe");return"updated"===e.params.provider.server.params.variant?vd(e.params.provider.id,t=>`https://www.ebi.ac.uk/pdbe/static/entry/${t.toLowerCase()}_updated.cif`,t=>`PDBe: ${t} (updated cif)`,!1):"updated-bcif"===e.params.provider.server.params.variant?vd(e.params.provider.id,t=>`https://www.ebi.ac.uk/pdbe/entry-files/download/${t.toLowerCase()}.bcif`,t=>`PDBe: ${t} (updated cif)`,!0):vd(e.params.provider.id,t=>`https://www.ebi.ac.uk/pdbe/static/entry/${t.toLowerCase()}.cif`,t=>`PDBe: ${t} (cif)`,!1)}),kU.apply(this,arguments)}function NU(){return NU=ie(function*(e){if("pdb"!==e.name||"pdbj"!==e.params.provider.server.name)throw new Error("expected pdbj");return vd(e.params.provider.id,t=>`https://data.pdbjbk1.pdbj.org/pub/pdb/data/structures/divided/mmCIF/${t.toLowerCase().substring(1,3)}/${t.toLowerCase()}.cif`,t=>`PDBj: ${t} (cif)`,!1)}),NU.apply(this,arguments)}function FU(){return FU=ie(function*(e){if("pdb"!==e.name||"rcsb"!==e.params.provider.server.name)throw new Error("expected rcsb");return"cif"===e.params.provider.server.params.encoding?vd(e.params.provider.id,t=>`https://files.rcsb.org/download/${t.toUpperCase()}.cif`,t=>`RCSB PDB: ${t} (cif)`,!1):vd(e.params.provider.id,t=>`https://models.rcsb.org/${t.toUpperCase()}.bcif`,t=>`RCSB PDB: ${t} (bcif)`,!0)}),FU.apply(this,arguments)}const put=nc.build({display:{name:"Update Trajectory"},params:{action:C.Select("advance",C.arrayToOptions(["advance","reset"])),by:C.Optional(C.Numeric(1,{min:-1,max:1,step:1}))}})(({params:e,state:t})=>{const n=t.selectQ(i=>i.ofTransformer(Ye.Model.ModelFromTrajectory)),r=t.build();if("reset"===e.action)for(const i of n)r.to(i).update({modelIndex:0});else for(const i of n){const o=In.findAncestorOfType(t.tree,t.cells,i.transform.ref,pe.Molecule.Trajectory);if(!o||!o.obj)continue;const s=o.obj;r.to(i).update(a=>{let c=(a.modelIndex+e.by)%s.data.frameCount;return c<0&&(c+=s.data.frameCount),{modelIndex:c}})}return t.updateTree(r)}),hut=nc.build({display:{name:"Custom Model Properties",description:"Enable parameters for custom properties of the model."},from:pe.Molecule.Model,params:(e,t)=>t.customModelProperties.getParams(e?.data),isApplicable:(e,t,n)=>t.transformer!==Koe})(({ref:e,params:t},n)=>n.builders.structure.insertModelProperties(e,t)),mut=nc.build({display:{name:"Custom Structure Properties",description:"Enable parameters for custom properties of the structure."},from:pe.Molecule.Structure,params:(e,t)=>t.customStructureProperties.getParams(e?.data),isApplicable:(e,t,n)=>t.transformer!==Qoe})(({ref:e,params:t},n)=>n.builders.structure.insertStructureProperties(e,t)),gut=nc.build({display:{name:"Add Trajectory",description:"Add trajectory from existing model/topology and coordinates."},from:pe.Root,params(e,t){const n=t.state.data,i=[...n.selectQ(a=>a.rootsOfType(pe.Molecule.Model)),...n.selectQ(a=>a.rootsOfType(pe.Molecule.Topology))].map(a=>[a.transform.ref,a.obj.label]),s=n.selectQ(a=>a.rootsOfType(pe.Molecule.Coordinates)).map(a=>[a.transform.ref,a.obj.label]);return{model:C.Select(i.length?i[0][0]:"",i),coordinates:C.Select(s.length?s[0][0]:"",s)}}})(({params:e,state:t},n)=>Oe.create("Add Trajectory",r=>t.transaction(ie(function*(){const i=[e.model,e.coordinates],o=t.build().toRoot().apply(A6,{modelRef:e.model,coordinatesRef:e.coordinates},{dependsOn:i}).apply(Ye.Model.ModelFromTrajectory,{modelIndex:0});yield t.updateTree(o).runInContext(r);const s=yield n.builders.structure.createStructure(o.selector);yield n.builders.structure.representation.applyPreset(s,"auto")})).runInContext(r))),yut=nc.build({display:{name:"Load Trajectory",description:"Load trajectory of model/topology and coordinates from URL or file."},from:pe.Root,params(e,t){const{options:n}=t.dataFormats,r=n.filter(a=>a[2]===bd||a[2]===lC),i=n.filter(a=>a[2]===s1),o=[],s=[];for(const{provider:a}of t.dataFormats.list)a.category===bd||a.category===lC?(a.binaryExtensions&&o.push(...a.binaryExtensions),a.stringExtensions&&o.push(...a.stringExtensions)):a.category===s1&&(a.binaryExtensions&&s.push(...a.binaryExtensions),a.stringExtensions&&s.push(...a.stringExtensions));return{source:C.MappedStatic("file",{url:C.Group({model:C.Group({url:C.Url(""),format:C.Select(r[0][0],r),isBinary:C.Boolean(!1)},{isExpanded:!0}),coordinates:C.Group({url:C.Url(""),format:C.Select(i[0][0],i)},{isExpanded:!0})},{isFlat:!0}),file:C.Group({model:C.File({accept:o.map(a=>`.${a}`).join(","),label:"Model"}),coordinates:C.File({accept:s.map(a=>`.${a}`).join(","),label:"Coordinates"})},{isFlat:!0})},{options:[["url","URL"],["file","File"]]})}}})(({params:e,state:t},n)=>Oe.create("Load Trajectory",r=>t.transaction(ie(function*(){const i=e.source;if("file"===i.name&&(null===i.params.model||null===i.params.coordinates))return void n.log.error("No file(s) selected");if(!("url"!==i.name||i.params.model&&i.params.coordinates))return void n.log.error("No URL(s) given");const o=function(){var a=ie(function*(c,u,l){const d=yield n.builders.data.download({url:c,isBinary:l}),f=n.dataFormats.get(u);if(f)return f.parse(n,d);n.log.warn(`LoadTrajectory: could not find data provider for '${u}'`)});return function(u,l,d){return a.apply(this,arguments)}}(),s=function(){var a=ie(function*(c){var u,l,d;if(!c)throw new Error("No file selected");const f=o1(null!==(l=null===(u=c.file)||void 0===u?void 0:u.name)&&void 0!==l?l:""),p=n.dataFormats.binaryExtensions.has(f.ext),{data:m}=yield n.builders.data.readFile({file:c,isBinary:p}),h=n.dataFormats.auto(f,null===(d=m.cell)||void 0===d?void 0:d.obj);return h?h.parse(n,m):(n.log.warn(`LoadTrajectory: could not find data provider for '${f.ext}'`),void(yield n.state.data.build().delete(m).commit()))});return function(u){return a.apply(this,arguments)}}();try{const a="url"===i.name?yield o(i.params.model.url,i.params.model.format,i.params.model.isBinary):yield s(i.params.model);let c;c="trajectory"in a?yield t.build().to(a.trajectory).apply(qoe,{modelIndex:0}).commit():a.topology;const u="url"===i.name?yield o(i.params.coordinates.url,i.params.coordinates.format,!0):yield s(i.params.coordinates),l=[c.ref,u.ref],d=t.build().toRoot().apply(A6,{modelRef:c.ref,coordinatesRef:u.ref},{dependsOn:l}).apply(Ye.Model.ModelFromTrajectory,{modelIndex:0});yield t.updateTree(d).runInContext(r);const f=yield n.builders.structure.createStructure(d.selector);yield n.builders.structure.representation.applyPreset(f,"auto")}catch(a){console.error(a),n.log.error("Error loading trajectory")}})).runInContext(r))),but=nc.build({from:pe.Root,display:{name:"Download Density",description:"Load a density from the provided source and create its default visual."},params:(e,t)=>{const{options:n}=t.dataFormats;return{source:C.MappedStatic("pdb-xray",{"pdb-xray":C.Group({provider:C.Group({id:C.Text("1tqn",{label:"Id"}),server:C.Select("rcsb",[["pdbe","PDBe"],["rcsb","RCSB PDB"]])},{pivot:"id"}),type:C.Select("2fofc",[["2fofc","2Fo-Fc"],["fofc","Fo-Fc"]])},{isFlat:!0}),"pdb-xray-ds":C.Group({provider:C.Group({id:C.Text("1tqn",{label:"Id"}),server:C.Select("pdbe",[["pdbe","PDBe"],["rcsb","RCSB PDB"]])},{pivot:"id"}),detail:C.Numeric(3,{min:0,max:6,step:1},{label:"Detail"})},{isFlat:!0}),"pdb-emd-ds":C.Group({provider:C.Group({id:C.Text("emd-8004",{label:"Id"}),server:C.Select("pdbe",[["pdbe","PDBe"],["rcsb","RCSB PDB"]])},{pivot:"id"}),detail:C.Numeric(3,{min:0,max:6,step:1},{label:"Detail"})},{isFlat:!0}),url:C.Group({url:C.Url(""),isBinary:C.Boolean(!1),format:C.Select("auto",n)},{isFlat:!0})},{options:[["pdb-xray","PDB X-ray maps"],["pdb-emd-ds","PDB EMD Density Server"],["pdb-xray-ds","PDB X-ray Density Server"],["url","URL"]]})}}})(({params:e},t)=>Oe.create("Download Density",function(){var n=ie(function*(r){var i,o;const s=e.source;let a,c;switch(s.name){case"url":a=s.params;break;case"pdb-xray":a="pdbe"===s.params.provider.server?{url:fr.Url("2fofc"===s.params.type?`https://www.ebi.ac.uk/pdbe/coordinates/files/${s.params.provider.id.toLowerCase()}.ccp4`:`https://www.ebi.ac.uk/pdbe/coordinates/files/${s.params.provider.id.toLowerCase()}_diff.ccp4`),isBinary:!0,label:`PDBe X-ray map: ${s.params.provider.id}`}:{url:fr.Url("2fofc"===s.params.type?`https://edmaps.rcsb.org/maps/${s.params.provider.id.toLowerCase()}_2fofc.dsn6`:`https://edmaps.rcsb.org/maps/${s.params.provider.id.toLowerCase()}_fofc.dsn6`),isBinary:!0,label:`RCSB X-ray map: ${s.params.provider.id}`};break;case"pdb-emd-ds":a="pdbe"===s.params.provider.server?{url:fr.Url(`https://www.ebi.ac.uk/pdbe/densities/emd/${s.params.provider.id.toLowerCase()}/cell?detail=${s.params.detail}`),isBinary:!0,label:`PDBe EMD Density Server: ${s.params.provider.id}`}:{url:fr.Url(`https://maps.rcsb.org/em/${s.params.provider.id.toLowerCase()}/cell?detail=${s.params.detail}`),isBinary:!0,label:`RCSB PDB EMD Density Server: ${s.params.provider.id}`};break;case"pdb-xray-ds":a="pdbe"===s.params.provider.server?{url:fr.Url(`https://www.ebi.ac.uk/pdbe/densities/x-ray/${s.params.provider.id.toLowerCase()}/cell?detail=${s.params.detail}`),isBinary:!0,label:`PDBe X-ray Density Server: ${s.params.provider.id}`}:{url:fr.Url(`https://maps.rcsb.org/x-ray/${s.params.provider.id.toLowerCase()}/cell?detail=${s.params.detail}`),isBinary:!0,label:`RCSB PDB X-ray Density Server: ${s.params.provider.id}`};break;default:Rr()}const u=yield t.builders.data.download(a);let l;switch(s.name){case"url":a=s.params,c="auto"===s.params.format?t.dataFormats.auto(o1(fr.getUrl(a.url)),null===(i=u.cell)||void 0===i?void 0:i.obj):t.dataFormats.get(s.params.format);break;case"pdb-xray":l=s.params.provider.id,c=t.dataFormats.get("pdbe"===s.params.provider.server?"ccp4":"dsn6");break;case"pdb-emd-ds":case"pdb-xray-ds":l=s.params.provider.id,c=t.dataFormats.get("dscif");break;default:Rr()}if(!c)return void t.log.warn("DownloadDensity: Format provider not found.");const d=yield c.parse(t,u,{entryId:l});yield null===(o=c.visuals)||void 0===o?void 0:o.call(c,t,d)});return function(r){return n.apply(this,arguments)}}())),Ede=nc.build({display:{name:"Assign Volume Colors",description:"Assigns another volume to be available for coloring."},from:pe.Volume.Data,isApplicable:e=>!e.data.colorVolume,params(e,t){const n=t.state.data.select(In.Generators.root.subtree().ofType(pe.Volume.Data).filter(r=>{var i;return!(!r.obj||null!==(i=r.obj)&&void 0!==i&&i.data.colorVolume||r.obj===e)}));return 0===n.length?{ref:C.Text("",{isHidden:!0,label:"Volume"})}:{ref:C.Select(n[0].transform.ref,n.map(r=>[r.transform.ref,r.obj.label]),{label:"Volume"})}}})(({ref:e,params:t},r)=>r.build().to(e).apply(Ye.Volume.AssignColorVolume,{ref:t.ref},{dependsOn:[t.ref]}).commit());function t3(e,t,n,r){return BU.apply(this,arguments)}function BU(){return BU=ie(function*(e,t,n,r){var i,o,s,a;const c=o1(null!==(o=null===(i=e.file)||void 0===i?void 0:i.name)&&void 0!==o?o:""),u=t.dataFormats.binaryExtensions.has(c.ext),{data:l}=yield t.builders.data.readFile({file:e,isBinary:u}),d="auto"===n?t.dataFormats.auto(c,null===(s=l.cell)||void 0===s?void 0:s.obj):t.dataFormats.get(n);if(!d)return t.log.warn(`OpenFiles: could not find data provider for '${c.ext}'`),void(yield t.state.data.build().delete(l).commit());const f=yield d.parse(t,l);r&&(yield null===(a=d.visuals)||void 0===a?void 0:a.call(d,t,f))}),BU.apply(this,arguments)}const Pde=nc.build({display:{name:"Open Files",description:"Load one or more files and optionally create default visuals"},from:pe.Root,params:(e,t)=>{const{extensions:n,options:r}=t.dataFormats;return{files:C.FileList({accept:Array.from(n.values()).map(i=>`.${i}`).join(",")+",.gz,.zip",multiple:!0}),format:C.MappedStatic("auto",{auto:C.EmptyGroup(),specific:C.Select(r[0][0],r)}),visuals:C.Boolean(!0,{description:"Add default visuals"})}}})(({params:e,state:t},n)=>Oe.create("Open Files",function(){var r=ie(function*(i){n.behaviors.layout.leftPanelTabName.next("data"),yield t.transaction(ie(function*(){if(null!==e.files)for(const o of e.files)try{if(o.file&&o.name.toLowerCase().endsWith(".zip")){const s=yield T2(i,yield o.file.arrayBuffer());for(const[a,c]of Object.entries(s)){if(!(c instanceof Uint8Array)||0===c.length)continue;const u=fr.File(new File([c],a));yield t3(u,n,"auto",e.visuals)}}else{const s="auto"===e.format.name?"auto":e.format.params;yield t3(o,n,s,e.visuals)}}catch(s){console.error(s),n.log.error(`Error opening file '${o.name}'`)}else n.log.error("No file(s) selected")})).runInContext(i)});return function(i){return r.apply(this,arguments)}}())),vut=nc.build({display:{name:"Download File",description:"Load one or more file from an URL"},from:pe.Root,params:(e,t)=>{const n=[...t.dataFormats.options,["zip","Zip"],["gzip","Gzip"]];return{url:C.Url(""),format:C.Select(n[0][0],n),isBinary:C.Boolean(!1),visuals:C.Boolean(!0,{description:"Add default visuals"})}}})(({params:e,state:t},n)=>Oe.create("Open Files",function(){var r=ie(function*(i){n.behaviors.layout.leftPanelTabName.next("data"),yield t.transaction(ie(function*(){var o,s,a;try{if("zip"===e.format||"gzip"===e.format){const c=yield n.builders.data.download({url:e.url,isBinary:!0});if("zip"===e.format){const u=yield T2(i,(null===(o=c.obj)||void 0===o?void 0:o.data).buffer);for(const[l,d]of Object.entries(u)){if(!(d instanceof Uint8Array)||0===d.length)continue;const f=fr.File(new File([d],l));yield t3(f,n,"auto",e.visuals)}}else{const l=o1(fr.getUrl(e.url)).name;yield t3(fr.File(new File([null===(s=c.obj)||void 0===s?void 0:s.data],l)),n,"auto",e.visuals)}}else{const c=n.dataFormats.get(e.format);if(!c)return void n.log.warn(`DownloadFile: could not find data provider for '${e.format}'`);const u=yield n.builders.data.download({url:e.url,isBinary:e.isBinary}),l=yield c.parse(n,u);e.visuals&&(yield null===(a=c.visuals)||void 0===a?void 0:a.call(c,n,l))}}catch(c){console.error(c),n.log.error(`Error downloading '${"string"==typeof e.url?e.url:e.url.url}'`)}})).runInContext(i)});return function(i){return r.apply(this,arguments)}}())),V0={Structure:tM,Volume:nM,DataFormat:rM};class OU extends(pe.Create({name:"Volume Streaming",typeClass:"Object"})){}var Mde,dC;function Rde(e,t,n,r){return LU.apply(this,arguments)}function LU(){return LU=ie(function*(e,t,n,r){switch(e){case"emdb":return kde(t,n,r);case"pdbe":return function wut(e,t,n){return VU.apply(this,arguments)}(t,n,r)}}),LU.apply(this,arguments)}function kde(e,t,n){return UU.apply(this,arguments)}function UU(){return UU=ie(function*(e,t,n){const r=e.config.get(qi.VolumeStreaming.EmdbHeaderServer),s=(yield e.fetch({url:`${r}/${n.toUpperCase()}/header/${n.toLowerCase()}.xml`,type:"xml"}).runInContext(t)).getElementsByTagName("map")[0].getElementsByTagName("contour");let a=s[0];for(let u=1;uu.primary))||void 0===o?void 0:o.level)&&void 0!==s?s:c[0].level:function Aut(e,t,n){return zU.apply(this,arguments)}(e,t,n)}),VU.apply(this,arguments)}function zU(){return zU=ie(function*(e,t,n){var r,i,o;n=n.toUpperCase();const s=yield e.fetch({url:`https://www.ebi.ac.uk/pdbe/api/emdb/entry/map/${n}`,type:"json"}).runInContext(t),a=s?.[n];let c;return void 0!==(null===(o=null===(i=null===(r=a?.[0])||void 0===r?void 0:r.map)||void 0===i?void 0:i.contour_level)||void 0===o?void 0:o.value)&&(c=+a[0].map.contour_level.value),c}),zU.apply(this,arguments)}function Iut(e,t,n){return GU.apply(this,arguments)}function GU(){return GU=ie(function*(e,t,n){var r;const i=yield e.fetch({url:`https://www.ebi.ac.uk/pdbe/api/pdb/entry/summary/${n}`,type:"json"}).runInContext(t),o=i?.[n],s=[];if(null===(r=o?.[0])||void 0===r||!r.related_structures)throw new Error(`No related EMDB entry found for '${n}'.`);{const a=o[0].related_structures.filter(c=>"EMDB"===c.resource&&"associated EM volume"===c.relationship);if(!a.length)throw new Error(`No related EMDB entry found for '${n}'.`);s.push(...a.map(c=>c.accession))}return s}),GU.apply(this,arguments)}!function(e){let t;var n;(n=t=e.ValueType||(e.ValueType={})).Float32="float32",n.Int8="int8"}(Mde||(Mde={})),function(e){e.create=function n(s){return{entries:wB(),capacity:Math.max(1,s)}},e.get=function r(s,a){for(let c=s.entries.first;c;c=c.next)if(c.value.key===a)return s.entries.remove(c),s.entries.addLast(c.value),c.value.data},e.set=function i(s,a,c){let u;if(s.entries.count>=s.capacity){const l=s.entries.first;u=l.value.data,s.entries.remove(l)}return s.entries.addLast(function t(s,a){return{key:s,data:a}}(a,c)),u},e.remove=function o(s,a){for(let c=s.entries.first;c;c=c.next)if(c.value.key===a){s.entries.remove(c);break}}}(dC||(dC={}));class Tut extends Fa{constructor(t,n){super()}schedule(t,n=0){return this}}const n3={setInterval(e,t,...n){const{delegate:r}=n3;return r?.setInterval?r.setInterval(e,t,...n):setInterval(e,t,...n)},clearInterval(e){const{delegate:t}=n3;return(t?.clearInterval||clearInterval)(e)},delegate:void 0};class fC{constructor(t,n=fC.now){this.schedulerActionCtor=t,this.now=n}schedule(t,n=0,r){return new this.schedulerActionCtor(this,t).schedule(r,n)}}fC.now=jF.now;const r3=new class Eut extends fC{constructor(t,n=fC.now){super(t,n),this.actions=[],this._active=!1}flush(t){const{actions:n}=this;if(this._active)return void n.push(t);let r;this._active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=n.shift());if(this._active=!1,r){for(;t=n.shift();)t.unsubscribe();throw r}}}(class Dut extends Tut{constructor(t,n){super(t,n),this.scheduler=t,this.work=n,this.pending=!1}schedule(t,n=0){var r;if(this.closed)return this;this.state=t;const i=this.id,o=this.scheduler;return null!=i&&(this.id=this.recycleAsyncId(o,i,n)),this.pending=!0,this.delay=n,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,n),this}requestAsyncId(t,n,r=0){return n3.setInterval(t.flush.bind(t,this),r)}recycleAsyncId(t,n,r=0){if(null!=r&&this.delay===r&&!1===this.pending)return n;null!=n&&n3.clearInterval(n)}execute(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;const r=this._execute(t,n);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(t,n){let i,r=!1;try{this.work(t)}catch(o){r=!0,i=o||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){const{id:t,scheduler:n}=this,{actions:r}=n;this.work=this.state=this.scheduler=null,this.pending=!1,QC(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,super.unsubscribe()}}}),Put=r3;function Nde(e=0,t,n=Put){let r=-1;return null!=t&&(mK(t)?n=t:r=t),new ns(i=>{let o=function Rut(e){return e instanceof Date&&!isNaN(e)}(e)?+e-n.now():e;o<0&&(o=0);let s=0;return n.schedule(function(){i.closed||(i.next(s++),0<=r?this.schedule(void 0,r):i.complete())},o)})}function Fde(e,t=r3,n){const r=Nde(e,t);return function Mut(e,t){return mo((n,r)=>{const{leading:i=!0,trailing:o=!1}=t??{};let s=!1,a=null,c=null,u=!1;const l=()=>{c?.unsubscribe(),c=null,o&&(p(),u&&r.complete())},d=()=>{c=null,u&&r.complete()},f=m=>c=ru(e(m)).subscribe(Io(r,l,d)),p=()=>{if(s){s=!1;const m=a;a=null,r.next(m),!u&&f(m)}};n.subscribe(Io(r,m=>{s=!0,a=m,(!c||c.closed)&&(i?p():f(m))},()=>{u=!0,(!(o&&s&&c)||c.closed)&&r.complete()}))})}(()=>r,n)}function Bde(e,t=vh){return e=e??kut,mo((n,r)=>{let i,o=!0;n.subscribe(Io(r,s=>{const a=t(s);(o||!e(i,a))&&(o=!1,i=a,r.next(s))}))})}function kut(e,t){return e===t}class Nut{constructor(t=!1){this.isRunning=!1,this.queue=[],this.counter=0,this.log=t}enqueue(t){this.log&&console.log("SingleAsyncQueue enqueue",this.counter),this.queue[0]={id:this.counter,func:t},this.counter++,this.run()}run(){var t=this;return ie(function*(){if(t.isRunning)return;const n=t.queue.pop();if(n){t.isRunning=!0;try{t.log&&console.log("SingleAsyncQueue run",n.id),yield n.func(),t.log&&console.log("SingleAsyncQueue complete",n.id)}finally{t.isRunning=!1,t.run()}}})()}}class Tu extends(pe.CreateBehavior({name:"Volume Streaming"})){}function Nm(e,t,n){return{i:e,j:t,k:n}}function xl(e,t){return{a:e,b:t}}!function(e){function t(c,u,l,d,f={}){var p,m,h,g;return C.Group({isoValue:et.createIsoValueParam(null!==(p=f.isoValue)&&void 0!==p?p:l,d),color:C.Color(null!==(m=f.color)&&void 0!==m?m:u),wireframe:C.Boolean(null!==(h=f.wireframe)&&void 0!==h&&h),opacity:C.Numeric(null!==(g=f.opacity)&&void 0!==g?g:.3,{min:0,max:1,step:.01})},{label:c,isExpanded:!0})}e.RootTag="volume-streaming-info";const n={byteOffset:0,rate:1,sampleCount:[1,1,1],valuesInfo:[{mean:0,min:-1,max:1,sigma:.1},{mean:0,min:-1,max:1,sigma:.1}]};function i(c){const{entryData:u,defaultView:l,structure:d,channelParams:f={}}=c,p=u||{kind:"em",header:{sampling:[n],availablePrecisions:[{precision:0,maxVoxels:0}]},emDefaultContourLevel:et.IsoValue.relative(0)},m=d&&d.boundary.box||St();return{view:C.MappedStatic(l||("em"===p.kind?"auto":"selection-box"),{off:C.Group({}),box:C.Group({bottomLeft:C.Vec3(m.min),topRight:C.Vec3(m.max)},{description:"Static box defined by cartesian coords.",isFlat:!0}),"selection-box":C.Group({radius:C.Numeric(5,{min:0,max:50,step:.5},{description:"Radius in \u212b within which the volume is shown."}),bottomLeft:C.Vec3(v.create(0,0,0),{},{isHidden:!0}),topRight:C.Vec3(v.create(0,0,0),{},{isHidden:!0})},{description:"Box around focused element.",isFlat:!0}),"camera-target":C.Group({radius:C.Numeric(.5,{min:0,max:1,step:.05},{description:"Radius within which the volume is shown (relative to the field of view)."}),dynamicDetailLevel:o(p.header.availablePrecisions,0,{label:"Dynamic Detail"}),bottomLeft:C.Vec3(v.create(0,0,0),{},{isHidden:!0}),topRight:C.Vec3(v.create(0,0,0),{},{isHidden:!0})},{description:"Box around camera target.",isFlat:!0}),cell:C.Group({}),auto:C.Group({radius:C.Numeric(5,{min:0,max:50,step:.5},{description:"Radius in \u212b within which the volume is shown."}),selectionDetailLevel:o(p.header.availablePrecisions,6,{label:"Selection Detail"}),isSelection:C.Boolean(!1,{isHidden:!0}),bottomLeft:C.Vec3(m.min,{},{isHidden:!0}),topRight:C.Vec3(m.max,{},{isHidden:!0})},{description:"Box around focused element.",isFlat:!0})},{options:e.ViewTypeOptions,description:'Controls what of the volume is displayed. "Off" hides the volume alltogether. "Bounded box" shows the volume inside the given box. "Around Interaction" shows the volume around the focused element/atom. "Whole Structure" shows the volume for the whole structure.'}),detailLevel:o(p.header.availablePrecisions,3),channels:C.Group("em"===p.kind?{em:t("EM",st(6524815),p.emDefaultContourLevel||et.IsoValue.relative(1),p.header.sampling[0].valuesInfo[0],f.em)}:{"2fo-fc":t("2Fo-Fc",st(3367602),et.IsoValue.relative(1.5),p.header.sampling[0].valuesInfo[0],f["2fo-fc"]),"fo-fc(+ve)":t("Fo-Fc(+ve)",st(3390259),et.IsoValue.relative(3),p.header.sampling[0].valuesInfo[1],f["fo-fc(+ve)"]),"fo-fc(-ve)":t("Fo-Fc(-ve)",st(12268339),et.IsoValue.relative(-3),p.header.sampling[0].valuesInfo[1],f["fo-fc(-ve)"])},{isFlat:!0})}}function o(c,u,l){return C.Select(Math.min(u,c.length-1),c.map((d,f)=>[f,`${f+1} [ ${0|Math.pow(d.maxVoxels,1/3)}^3 cells ]`]),{description:"Determines the maximum number of voxels. Depending on the size of the volume options are in the range from 1 (0.52M voxels) to 7 (25.17M voxels).",...l})}function s(c){return{entry:{name:c.entry.name,params:{detailLevel:c.entry.params.detailLevel,channels:c.entry.params.channels,view:{name:c.entry.params.view.name,params:{...c.entry.params.view.params}}}}}}e.createParams=function r(c={}){const{data:u,defaultView:l,channelParams:d}=c,f=new Map;u&&u.entries.forEach(h=>f.set(h.dataId,h));const p=u?u.entries.map(h=>[h.dataId,h.dataId]):[];return{entry:C.Mapped(u?u.entries[0].dataId:"",p,h=>C.Group(i({entryData:f.get(h),defaultView:l,structure:u&&u.structure,channelParams:d})))}},e.createEntryParams=i,e.copyParams=s,e.ViewTypeOptions=[["off","Off"],["box","Bounded Box"],["selection-box","Around Focus"],["camera-target","Around Camera"],["cell","Whole Structure"],["auto","Auto"]],e.ChannelTypeOptions=[["em","em"],["2fo-fc","2fo-fc"],["fo-fc(+ve)","fo-fc(+ve)"],["fo-fc(-ve)","fo-fc(-ve)"]],e.Behavior=class a extends tr.WithSubscribers{get info(){return this.infoMap.get(this.params.entry.name)}queryData(u){var l=this;return ie(function*(){let d=x8(l.data.serverUrl,`${l.info.kind}/${l.info.dataId.toLowerCase()}`);if(u){const{min:b,max:x}=u;d+=`/box/${b.map(_=>Math.round(1e3*_)/1e3).join(",")}/${x.map(_=>Math.round(1e3*_)/1e3).join(",")}`}else d+="/cell";let f=l.params.entry.params.detailLevel;"auto"===l.params.entry.params.view.name&&l.params.entry.params.view.params.isSelection&&(f=l.params.entry.params.view.params.selectionDetailLevel),"camera-target"===l.params.entry.params.view.name&&u&&(f=l.decideDetail(u,l.params.entry.params.view.params.dynamicDetailLevel)),d+=`?detail=${f}`;const p=dC.get(l.cache,d);if(p)return p.data;const m=fr.getUrlAsset(l.plugin.managers.asset,d),h=yield l.plugin.runTask(l.plugin.managers.asset.resolve(m,"binary")),g=yield l.parseCif(h.data);if(!g)return;const y=dC.set(l.cache,d,{data:g,asset:h});return y&&y.asset.dispose(),g})()}parseCif(u){var l=this;return ie(function*(){const d=yield l.plugin.runTask(od.parseBinary(u));if(d.isError)return void l.plugin.log.error("VolumeStreaming, parsing CIF: "+d.toString());if(d.result.blocks.length<2)return void l.plugin.log.error("VolumeStreaming: Invalid data.");const f={};for(let p=1;p{!pe.Molecule.Structure.is(l.obj)||!De.is(this.lastLoci)||this.lastLoci.structure===l.obj.data&&(this.lastLoci=$n)}),this.subscribeObservable(this.plugin.state.events.object.updated,l=>{!pe.Molecule.Structure.is(l.oldObj)||!De.is(this.lastLoci)||this.lastLoci.structure===l.oldObj.data&&(this.lastLoci=$n)}),this.subscribeObservable(this.plugin.managers.structure.focus.behaviors.current,l=>{if(!this.plugin.state.data.tree.children.has(this.ref))return;const d=l?l.loci:$n;switch(this.params.entry.params.view.name){case"auto":this.updateAuto(d);break;case"selection-box":this.updateSelectionBox(d);break;default:this.lastLoci=d}})}unregister(){let u=this.cache.entries.first;for(;u;)u.value.data.asset.dispose(),u=u.next}isCameraTargetSame(u,l){if(!u||!l)return!1;const d=v.equals(u.target,l.target),f=v.squaredDistance(u.target,u.position),p=v.squaredDistance(l.target,l.position),m=Math.abs(f-p)/f<.001;return d&&m}cameraTargetDistance(u){return v.distance(u.target,u.position)}getBoxFromLoci(u){var l,d,f;if(pn.isEmpty(u)||Ta(u))return St();const p=this.plugin.helpers.substructureParent.get(u.structure,!0);if(!p)return St();const m=this.getStructureRoot();if(!m||(null===(l=m.obj)||void 0===l?void 0:l.data)!==(null===(d=p.obj)||void 0===d?void 0:d.data))return St();const h=Hg.get(null===(f=m.obj)||void 0===f?void 0:f.data.models[0]);h&&le.invert(this._invTransform,h);const g=De.extendToWholeResidues(u),y=De.getBoundary(g,h&&!Number.isNaN(this._invTransform[0])?this._invTransform:void 0).box;return 1===De.size(g)&&St.expand(y,y,v.create(1,1,1)),y}updateAuto(u){var l=this;this.updateQueue.enqueue(ie(function*(){l.lastLoci=u,Ta(u)?yield l.updateParams("x-ray"===l.info.kind?l.data.structure.boundary.box:void 0,!1):yield l.updateParams(l.getBoxFromLoci(u),!0)}))}updateSelectionBox(u){var l=this;this.updateQueue.enqueue(ie(function*(){l.lastLoci=pn.areEqual(l.lastLoci,u)?$n:u;const d=l.getBoxFromLoci(l.lastLoci);yield l.updateParams(d)}))}updateCameraTarget(u){var l=this;this.updateQueue.enqueue(ie(function*(){var d,f,p;const m=null===(d=l.plugin.canvas3d)||void 0===d?void 0:d.props.camera.manualReset;try{m||null===(f=l.plugin.canvas3d)||void 0===f||f.setProps({camera:{manualReset:!0}});const h=l.boxFromCameraTarget(u,!0);yield l.updateParams(h)}finally{m||null===(p=l.plugin.canvas3d)||void 0===p||p.setProps({camera:{manualReset:m}})}}))}boxFromCameraTarget(u,l){var d;const f=u.target,p=this.cameraTargetDistance(u);let h=Math.tan(.5*u.fov)*p;const g=null===(d=this.plugin.canvas3d)||void 0===d?void 0:d.camera.viewport;let b,x,_;if(g&&g.width>g.height&&(h*=g.width/g.height),h*="camera-target"===this.params.entry.params.view.name?this.params.entry.params.view.params.radius:.5,l){const S=v.zero();St.size(S,this.data.structure.boundary.box),b=Math.min(h,.5*S[0]),x=Math.min(h,.5*S[1]),_=Math.min(h,.5*S[2])}else b=x=_=h;return St.create(v.create(f[0]-b,f[1]-x,f[2]-_),v.create(f[0]+b,f[1]+x,f[2]+_))}decideDetail(u,l){const d="x-ray"===this.info.kind?St.volume(this.data.structure.boundary.box):this.info.header.spacegroup.size.reduce((g,y)=>g*y,1);let p=St.volume(u)/d;const m=this.info.header.availablePrecisions.length-1;let h=l;for(;p<=.5&&hl.updateCameraTarget(g))),f=l.boxFromCameraTarget(l.plugin.canvas3d.camera.getSnapshot(),!0);break;case"cell":f="x-ray"===l.info.kind?l.data.structure.boundary.box:void 0;break;case"auto":if(f=u.entry.params.view.params.isSelection||"x-ray"===l.info.kind?St.create(v.clone(u.entry.params.view.params.bottomLeft),v.clone(u.entry.params.view.params.topRight)):void 0,f&&(p=St.volume(f)<1e-4,u.entry.params.view.params.isSelection)){const g=u.entry.params.view.params.radius;St.expand(f,f,v.create(g,g,g))}}const m=p?{}:yield l.queryData(f);if(!m)return!1;const h=u.entry.params.channels;return"x-ray"===l.info.kind?(l.channels["2fo-fc"]=l.createChannel(m["2FO-FC"]||et.One,h["2fo-fc"],l.info.header.sampling[0].valuesInfo[0]),l.channels["fo-fc(+ve)"]=l.createChannel(m["FO-FC"]||et.One,h["fo-fc(+ve)"],l.info.header.sampling[0].valuesInfo[1]),l.channels["fo-fc(-ve)"]=l.createChannel(m["FO-FC"]||et.One,h["fo-fc(-ve)"],l.info.header.sampling[0].valuesInfo[1])):l.channels.em=l.createChannel(m.EM||et.One,h.em,l.info.header.sampling[0].valuesInfo[0]),!0})()}createChannel(u,l,d){return{data:u,color:l.color,wireframe:l.wireframe,opacity:l.opacity,isoValue:"relative"===l.isoValue.kind?l.isoValue:et.IsoValue.toRelative(l.isoValue,d)}}getDescription(){return"selection-box"===this.params.entry.params.view.name?"Selection":"camera-target"===this.params.entry.params.view.name?"Camera":"box"===this.params.entry.params.view.name?"Static Box":"cell"===this.params.entry.params.view.name?"Cell":""}constructor(u,l){super(u,{}),this.plugin=u,this.data=l,this.cache=dC.create(25),this.params={},this.lastLoci=$n,this.ref="",this.cameraTargetObservable=this.plugin.canvas3d.didDraw.pipe(Fde(500,void 0,{leading:!0,trailing:!0}),qt(()=>{var d;return null===(d=this.plugin.canvas3d)||void 0===d?void 0:d.camera.getSnapshot()}),Bde((d,f)=>this.isCameraTargetSame(d,f)),Yl(d=>void 0!==d)),this.cameraTargetSubscription=void 0,this.channels={},this._invTransform=le(),this.infoMap=new Map,this.data.entries.forEach(d=>this.infoMap.set(d.dataId,d)),this.updateQueue=new Nut}}}(Tu||(Tu={}));const lo=[Nm(0,0,0),Nm(1,0,0),Nm(1,1,0),Nm(0,1,0),Nm(0,0,1),Nm(1,0,1),Nm(1,1,1),Nm(0,1,1)],Fut=[xl(lo[0],lo[1]),xl(lo[1],lo[2]),xl(lo[2],lo[3]),xl(lo[3],lo[0]),xl(lo[4],lo[5]),xl(lo[5],lo[6]),xl(lo[6],lo[7]),xl(lo[7],lo[4]),xl(lo[0],lo[4]),xl(lo[1],lo[5]),xl(lo[2],lo[6]),xl(lo[3],lo[7])],But=[{i:0,j:0,k:0,e:0},{i:1,j:0,k:0,e:1},{i:0,j:1,k:0,e:0},{i:0,j:0,k:0,e:1},{i:0,j:0,k:1,e:0},{i:1,j:0,k:1,e:1},{i:0,j:1,k:1,e:0},{i:0,j:0,k:1,e:1},{i:0,j:0,k:0,e:2},{i:1,j:0,k:0,e:2},{i:1,j:1,k:0,e:2},{i:0,j:1,k:0,e:2}],Out=[0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0],a1=[[],[0,8,3],[0,1,9],[1,8,3,9,8,1],[1,2,10],[0,8,3,1,2,10],[9,2,10,0,2,9],[2,8,3,2,10,8,10,9,8],[3,11,2],[0,11,2,8,11,0],[1,9,0,2,3,11],[1,11,2,1,9,11,9,8,11],[3,10,1,11,10,3],[0,10,1,0,8,10,8,11,10],[3,9,0,3,11,9,11,10,9],[9,8,10,10,8,11],[4,7,8],[4,3,0,7,3,4],[0,1,9,8,4,7],[4,1,9,4,7,1,7,3,1],[1,2,10,8,4,7],[3,4,7,3,0,4,1,2,10],[9,2,10,9,0,2,8,4,7],[2,10,9,2,9,7,2,7,3,7,9,4],[8,4,7,3,11,2],[11,4,7,11,2,4,2,0,4],[9,0,1,8,4,7,2,3,11],[4,7,11,9,4,11,9,11,2,9,2,1],[3,10,1,3,11,10,7,8,4],[1,11,10,1,4,11,1,0,4,7,11,4],[4,7,8,9,0,11,9,11,10,11,0,3],[4,7,11,4,11,9,9,11,10],[9,5,4],[9,5,4,0,8,3],[0,5,4,1,5,0],[8,5,4,8,3,5,3,1,5],[1,2,10,9,5,4],[3,0,8,1,2,10,4,9,5],[5,2,10,5,4,2,4,0,2],[2,10,5,3,2,5,3,5,4,3,4,8],[9,5,4,2,3,11],[0,11,2,0,8,11,4,9,5],[0,5,4,0,1,5,2,3,11],[2,1,5,2,5,8,2,8,11,4,8,5],[10,3,11,10,1,3,9,5,4],[4,9,5,0,8,1,8,10,1,8,11,10],[5,4,0,5,0,11,5,11,10,11,0,3],[5,4,8,5,8,10,10,8,11],[9,7,8,5,7,9],[9,3,0,9,5,3,5,7,3],[0,7,8,0,1,7,1,5,7],[1,5,3,3,5,7],[9,7,8,9,5,7,10,1,2],[10,1,2,9,5,0,5,3,0,5,7,3],[8,0,2,8,2,5,8,5,7,10,5,2],[2,10,5,2,5,3,3,5,7],[7,9,5,7,8,9,3,11,2],[9,5,7,9,7,2,9,2,0,2,7,11],[2,3,11,0,1,8,1,7,8,1,5,7],[11,2,1,11,1,7,7,1,5],[9,5,8,8,5,7,10,1,3,10,3,11],[5,7,0,5,0,9,7,11,0,1,0,10,11,10,0],[11,10,0,11,0,3,10,5,0,8,0,7,5,7,0],[11,10,5,7,11,5],[10,6,5],[0,8,3,5,10,6],[9,0,1,5,10,6],[1,8,3,1,9,8,5,10,6],[1,6,5,2,6,1],[1,6,5,1,2,6,3,0,8],[9,6,5,9,0,6,0,2,6],[5,9,8,5,8,2,5,2,6,3,2,8],[2,3,11,10,6,5],[11,0,8,11,2,0,10,6,5],[0,1,9,2,3,11,5,10,6],[5,10,6,1,9,2,9,11,2,9,8,11],[6,3,11,6,5,3,5,1,3],[0,8,11,0,11,5,0,5,1,5,11,6],[3,11,6,0,3,6,0,6,5,0,5,9],[6,5,9,6,9,11,11,9,8],[5,10,6,4,7,8],[4,3,0,4,7,3,6,5,10],[1,9,0,5,10,6,8,4,7],[10,6,5,1,9,7,1,7,3,7,9,4],[6,1,2,6,5,1,4,7,8],[1,2,5,5,2,6,3,0,4,3,4,7],[8,4,7,9,0,5,0,6,5,0,2,6],[7,3,9,7,9,4,3,2,9,5,9,6,2,6,9],[3,11,2,7,8,4,10,6,5],[5,10,6,4,7,2,4,2,0,2,7,11],[0,1,9,4,7,8,2,3,11,5,10,6],[9,2,1,9,11,2,9,4,11,7,11,4,5,10,6],[8,4,7,3,11,5,3,5,1,5,11,6],[5,1,11,5,11,6,1,0,11,7,11,4,0,4,11],[0,5,9,0,6,5,0,3,6,11,6,3,8,4,7],[6,5,9,6,9,11,4,7,9,7,11,9],[10,4,9,6,4,10],[4,10,6,4,9,10,0,8,3],[10,0,1,10,6,0,6,4,0],[8,3,1,8,1,6,8,6,4,6,1,10],[1,4,9,1,2,4,2,6,4],[3,0,8,1,2,9,2,4,9,2,6,4],[0,2,4,4,2,6],[8,3,2,8,2,4,4,2,6],[10,4,9,10,6,4,11,2,3],[0,8,2,2,8,11,4,9,10,4,10,6],[3,11,2,0,1,6,0,6,4,6,1,10],[6,4,1,6,1,10,4,8,1,2,1,11,8,11,1],[9,6,4,9,3,6,9,1,3,11,6,3],[8,11,1,8,1,0,11,6,1,9,1,4,6,4,1],[3,11,6,3,6,0,0,6,4],[6,4,8,11,6,8],[7,10,6,7,8,10,8,9,10],[0,7,3,0,10,7,0,9,10,6,7,10],[10,6,7,1,10,7,1,7,8,1,8,0],[10,6,7,10,7,1,1,7,3],[1,2,6,1,6,8,1,8,9,8,6,7],[2,6,9,2,9,1,6,7,9,0,9,3,7,3,9],[7,8,0,7,0,6,6,0,2],[7,3,2,6,7,2],[2,3,11,10,6,8,10,8,9,8,6,7],[2,0,7,2,7,11,0,9,7,6,7,10,9,10,7],[1,8,0,1,7,8,1,10,7,6,7,10,2,3,11],[11,2,1,11,1,7,10,6,1,6,7,1],[8,9,6,8,6,7,9,1,6,11,6,3,1,3,6],[0,9,1,11,6,7],[7,8,0,7,0,6,3,11,0,11,6,0],[7,11,6],[7,6,11],[3,0,8,11,7,6],[0,1,9,11,7,6],[8,1,9,8,3,1,11,7,6],[10,1,2,6,11,7],[1,2,10,3,0,8,6,11,7],[2,9,0,2,10,9,6,11,7],[6,11,7,2,10,3,10,8,3,10,9,8],[7,2,3,6,2,7],[7,0,8,7,6,0,6,2,0],[2,7,6,2,3,7,0,1,9],[1,6,2,1,8,6,1,9,8,8,7,6],[10,7,6,10,1,7,1,3,7],[10,7,6,1,7,10,1,8,7,1,0,8],[0,3,7,0,7,10,0,10,9,6,10,7],[7,6,10,7,10,8,8,10,9],[6,8,4,11,8,6],[3,6,11,3,0,6,0,4,6],[8,6,11,8,4,6,9,0,1],[9,4,6,9,6,3,9,3,1,11,3,6],[6,8,4,6,11,8,2,10,1],[1,2,10,3,0,11,0,6,11,0,4,6],[4,11,8,4,6,11,0,2,9,2,10,9],[10,9,3,10,3,2,9,4,3,11,3,6,4,6,3],[8,2,3,8,4,2,4,6,2],[0,4,2,4,6,2],[1,9,0,2,3,4,2,4,6,4,3,8],[1,9,4,1,4,2,2,4,6],[8,1,3,8,6,1,8,4,6,6,10,1],[10,1,0,10,0,6,6,0,4],[4,6,3,4,3,8,6,10,3,0,3,9,10,9,3],[10,9,4,6,10,4],[4,9,5,7,6,11],[0,8,3,4,9,5,11,7,6],[5,0,1,5,4,0,7,6,11],[11,7,6,8,3,4,3,5,4,3,1,5],[9,5,4,10,1,2,7,6,11],[6,11,7,1,2,10,0,8,3,4,9,5],[7,6,11,5,4,10,4,2,10,4,0,2],[3,4,8,3,5,4,3,2,5,10,5,2,11,7,6],[7,2,3,7,6,2,5,4,9],[9,5,4,0,8,6,0,6,2,6,8,7],[3,6,2,3,7,6,1,5,0,5,4,0],[6,2,8,6,8,7,2,1,8,4,8,5,1,5,8],[9,5,4,10,1,6,1,7,6,1,3,7],[1,6,10,1,7,6,1,0,7,8,7,0,9,5,4],[4,0,10,4,10,5,0,3,10,6,10,7,3,7,10],[7,6,10,7,10,8,5,4,10,4,8,10],[6,9,5,6,11,9,11,8,9],[3,6,11,0,6,3,0,5,6,0,9,5],[0,11,8,0,5,11,0,1,5,5,6,11],[6,11,3,6,3,5,5,3,1],[1,2,10,9,5,11,9,11,8,11,5,6],[0,11,3,0,6,11,0,9,6,5,6,9,1,2,10],[11,8,5,11,5,6,8,0,5,10,5,2,0,2,5],[6,11,3,6,3,5,2,10,3,10,5,3],[5,8,9,5,2,8,5,6,2,3,8,2],[9,5,6,9,6,0,0,6,2],[1,5,8,1,8,0,5,6,8,3,8,2,6,2,8],[1,5,6,2,1,6],[1,3,6,1,6,10,3,8,6,5,6,9,8,9,6],[10,1,0,10,0,6,9,5,0,5,6,0],[0,3,8,5,6,10],[10,5,6],[11,5,10,7,5,11],[11,5,10,11,7,5,8,3,0],[5,11,7,5,10,11,1,9,0],[10,7,5,10,11,7,9,8,1,8,3,1],[11,1,2,11,7,1,7,5,1],[0,8,3,1,2,7,1,7,5,7,2,11],[9,7,5,9,2,7,9,0,2,2,11,7],[7,5,2,7,2,11,5,9,2,3,2,8,9,8,2],[2,5,10,2,3,5,3,7,5],[8,2,0,8,5,2,8,7,5,10,2,5],[9,0,1,5,10,3,5,3,7,3,10,2],[9,8,2,9,2,1,8,7,2,10,2,5,7,5,2],[1,3,5,3,7,5],[0,8,7,0,7,1,1,7,5],[9,0,3,9,3,5,5,3,7],[9,8,7,5,9,7],[5,8,4,5,10,8,10,11,8],[5,0,4,5,11,0,5,10,11,11,3,0],[0,1,9,8,4,10,8,10,11,10,4,5],[10,11,4,10,4,5,11,3,4,9,4,1,3,1,4],[2,5,1,2,8,5,2,11,8,4,5,8],[0,4,11,0,11,3,4,5,11,2,11,1,5,1,11],[0,2,5,0,5,9,2,11,5,4,5,8,11,8,5],[9,4,5,2,11,3],[2,5,10,3,5,2,3,4,5,3,8,4],[5,10,2,5,2,4,4,2,0],[3,10,2,3,5,10,3,8,5,4,5,8,0,1,9],[5,10,2,5,2,4,1,9,2,9,4,2],[8,4,5,8,5,3,3,5,1],[0,4,5,1,0,5],[8,4,5,8,5,3,9,0,5,0,3,5],[9,4,5],[4,11,7,4,9,11,9,10,11],[0,8,3,4,9,7,9,11,7,9,10,11],[1,10,11,1,11,4,1,4,0,7,4,11],[3,1,4,3,4,8,1,10,4,7,4,11,10,11,4],[4,11,7,9,11,4,9,2,11,9,1,2],[9,7,4,9,11,7,9,1,11,2,11,1,0,8,3],[11,7,4,11,4,2,2,4,0],[11,7,4,11,4,2,8,3,4,3,2,4],[2,9,10,2,7,9,2,3,7,7,4,9],[9,10,7,9,7,4,10,2,7,8,7,0,2,0,7],[3,7,10,3,10,2,7,4,10,1,10,0,4,0,10],[1,10,2,8,7,4],[4,9,1,4,1,7,7,1,3],[4,9,1,4,1,7,0,8,1,8,7,1],[4,0,3,7,4,3],[4,8,7],[9,10,8,10,11,8],[3,0,9,3,9,11,11,9,10],[0,1,10,0,10,8,8,10,11],[3,1,10,11,3,10],[1,2,11,1,11,9,9,11,8],[3,0,9,3,9,11,1,2,9,2,11,9],[0,2,11,8,0,11],[3,2,11],[2,3,8,2,8,10,10,8,9],[9,10,2,0,9,2],[2,3,8,2,8,10,0,1,8,1,10,8],[1,10,2],[1,3,8,9,1,8],[0,9,1],[0,3,8],[]],jU=[[0,4,4,4,2,0,0,0,2,2,0,0],[4,0,4,4,0,8,0,0,0,8,8,0],[4,4,0,4,0,0,8,0,0,0,8,8],[4,4,4,0,0,0,0,1,1,0,0,1],[2,0,0,0,0,8,8,8,2,2,0,0],[0,8,0,0,8,0,8,8,0,8,8,0],[0,0,8,0,8,8,0,8,0,0,8,8],[0,0,0,1,8,8,8,0,1,0,0,1],[2,0,0,1,2,0,0,1,0,2,0,1],[2,8,0,0,2,8,0,0,2,0,8,0],[0,8,8,0,0,8,8,0,0,8,0,8],[0,0,8,1,0,0,8,1,1,0,8,0]];function Ode(e){return{...e,bottomLeft:Ds(e.bottomLeft,[0,0,0]),topRight:Ds(e.topRight,e.scalarField.space.dimensions)}}function Lde(e){return{dX:e.topRight[0]-e.bottomLeft[0],dY:e.topRight[1]-e.bottomLeft[1],dZ:e.topRight[2]-e.bottomLeft[2]}}function c1(e,t){return Oe.create("Marching Cubes Mesh",function(){var n=ie(function*(r){const i=Ode(e),{dX:o,dY:s,dZ:a}=Lde(i),u=function Lut(e,t){const n=Math.min(65536,4*e),r=ze.create(Float32Array,3,e,t&&t.vertexBuffer.ref.value),i=ze.create(Float32Array,3,e,t&&t.normalBuffer.ref.value),o=ze.create(Float32Array,1,e,t&&t.groupBuffer.ref.value),s=ze.create(Uint32Array,3,n,t&&t.indexBuffer.ref.value);let a=0,c=0;return{addVertex:(u,l,d)=>(++a,ze.add3(r,u,l,d)),addNormal:(u,l,d)=>{ze.add3(i,u,l,d)},addGroup:u=>{ze.add(o,u)},addTriangle:(u,l,d,f)=>{const p=u[l],m=u[d],h=u[f];p>=0&&m>=0&&h>=0&&(++c,ze.add3(s,p,m,h))},get:()=>{const u=ze.compact(r,!0),l=ze.compact(i,!0),d=ze.compact(s,!0),f=ze.compact(o,!0);return Nt.create(u,d,l,f,a,c,t)}}}(Math.min(262144,Math.max(o*s*a/32,1024)),t);return yield new Ude(r,u,i).run(),u.get()});return function(r){return n.apply(this,arguments)}}())}function HU(e,t){return Oe.create("Marching Cubes Lines",function(){var n=ie(function*(r){const i=Ode(e),{dX:o,dY:s,dZ:a}=Lde(i),u=function Uut(e,t){const n=ze.create(Float32Array,3,e),r=ze.create(Float32Array,1,e),i=ze.create(Float32Array,2,e);let o=0;return{addVertex:(s,a,c)=>ze.add3(n,s,a,c),addNormal:()=>Ag,addGroup:s=>{ze.add(r,s)},addTriangle:(s,a,c,u,l)=>{s[a]>=0&&s[c]>=0&&s[u]>=0&&(jU[a][c]&l&&(++o,ze.add2(i,s[a],s[c])),jU[c][u]&l&&(++o,ze.add2(i,s[c],s[u])),jU[a][u]&l&&(++o,ze.add2(i,s[a],s[u])))},get:()=>{const s=ze.compact(n,!0),a=ze.compact(i,!0),c=ze.compact(r,!0),u=Fc.create(o,o/10,t);for(let l=0;l0)return i-1;const o=this.scalarField,s=this.scalarFieldGet,a=Fut[t],c=a.a,u=a.b,l=c.i+this.i,d=c.j+this.j,f=c.k+this.k,p=u.i+this.i,m=u.j+this.j,h=u.k+this.k,g=s(o,l,d,f),y=s(o,p,m,h),b=(this.isoLevel-g)/(g-y);if(this.idField){const M=this.idFieldGet(this.idField,l,d,f),N=this.idFieldGet(this.idField,p,m,h);let V=b<.5?M:N;if(-1===V&&(V=b<.5?N:M),-2===V)return-1;this.builder.addGroup(V)}else this.builder.addGroup(0);const x=this.builder.addVertex(l+b*(l-p),d+b*(d-m),f+b*(f-h));this.verticesOnEdges[r]=x+1;const _=s(o,Math.max(0,l-1),d,f)-s(o,Math.min(this.nX-1,l+1),d,f),S=s(o,l,Math.max(0,d-1),f)-s(o,l,Math.min(this.nY-1,d+1),f),A=s(o,l,d,Math.max(0,f-1))-s(o,l,d,Math.min(this.nZ,f+1)),I=_+b*(_-(s(o,Math.max(0,p-1),m,h)-s(o,Math.min(this.nX-1,p+1),m,h))),R=S+b*(S-(s(o,p,Math.max(0,m-1),h)-s(o,p,Math.min(this.nY-1,m+1),h))),T=A+b*(A-(s(o,p,m,Math.max(0,h-1))-s(o,p,m,Math.min(this.nZ-1,h+1))));return this.isoLevel>=0?this.builder.addNormal(I,R,T):this.builder.addNormal(-I,-R,-T),x}constructor(t,n){this.builder=t,this.vertList=[0,0,0,0,0,0,0,0,0,0,0,0],this.i=0,this.j=0,this.k=0;const r=n.scalarField.space.dimensions;this.nX=r[0],this.nY=r[1],this.nZ=r[2],this.isoLevel=n.isoLevel,this.scalarFieldGet=n.scalarField.space.get,this.scalarField=n.scalarField.data,n.idField&&(this.idField=n.idField.data,this.idFieldGet=n.idField.space.get),this.verticesOnEdges=new Int32Array(3*this.nX*this.nY*2)}get(t,n,r){return this.scalarFieldGet(this.scalarField,t,n,r)}processCell(t,n,r,i){let o=0;if(this.get(t,n,r)0&&(this.vertList[0]=this.interpolate(0)),(2&s)>0&&(this.vertList[1]=this.interpolate(1)),(4&s)>0&&(this.vertList[2]=this.interpolate(2)),(8&s)>0&&(this.vertList[3]=this.interpolate(3)),(16&s)>0&&(this.vertList[4]=this.interpolate(4)),(32&s)>0&&(this.vertList[5]=this.interpolate(5)),(64&s)>0&&(this.vertList[6]=this.interpolate(6)),(128&s)>0&&(this.vertList[7]=this.interpolate(7)),(256&s)>0&&(this.vertList[8]=this.interpolate(8)),(512&s)>0&&(this.vertList[9]=this.interpolate(9)),(1024&s)>0&&(this.vertList[10]=this.interpolate(10)),(2048&s)>0&&(this.vertList[11]=this.interpolate(11));const a=a1[o];for(let c=0;c=0?this.builder.addTriangle(this.vertList,u,l,d,i):this.builder.addTriangle(this.vertList,d,l,u,i)}}}function z0(e,t){const{defaultProps:n,createGeometry:r,createLocationIterator:i,getLoci:o,eachLocation:s,setUpdateState:a,mustRecreate:c,dispose:u}=e,{updateValues:l,updateBoundingSphere:d,updateRenderableState:f,createPositionIterator:p}=e.geometryUtils,m=Cf.create();let h,g,y,b,x,A,E,w,I,R,_=Object.assign({},n),S=Fo.createEmpty(),D=-1;function M(F){if(m.createNew){if(I=i(b,x),!F)throw new Error("expected geometry to be given");h=function zut(e,t,n,r,i,o){const{createValues:s,createRenderableState:a}=Zo.getUtils(t),u=s(t,JL(),n,r,i),l=a(i);return Ev(t.kind,u,l,o)}(0,F,I,y,g,t),R=p(F,h.values)}else{if(!h)throw new Error("expected renderObject to be available");if(m.updateTransform){I=i(b,x);const{instanceCount:G,groupCount:L}=I;g.instanceGranularity?Vi(G,"instance",h.values):Vi(G*L,"groupInstance",h.values)}else I.reset();if(m.createGeometry){if(!F)throw new Error("expected geometry to be given");k.updateIfChanged(h.values.drawCount,Zo.getDrawCount(F)),k.updateIfChanged(h.values.uVertexCount,Zo.getVertexCount(F)),k.updateIfChanged(h.values.uGroupCount,Zo.getGroupCount(F))}(m.updateTransform||m.createGeometry)&&(d(h.values,F||w),R=p(F||w,h.values)),m.updateSize&&"uSize"in h.values&&kp(I,y.size,h.values),m.updateColor&&bu(I,R,y.color,h.values),l(h.values,g),f(h.state,g)}_=g,S=y,A=b,E=x,F&&(w=F,D+=1)}function V(F,G){return Uc(F)?G(Ce.ofBounds(0,_.instanceGranularity?I.instanceCount:I.groupCount*I.instanceCount)):_.instanceGranularity?function N(F,G,L,z){let j=!1;if(et.Cell.isLoci(F)){if(et.Cell.isLociEmpty(F)||!et.areEquivalent(F.volume,G))return!1;z(Ce.ofSingleton(0))&&(j=!0)}else if(et.Segment.isLoci(F)){if(et.Segment.isLociEmpty(F)||!et.areEquivalent(F.volume,G)||!je.has(F.segments,L))return!1;z(Ce.ofSingleton(0))&&(j=!0)}return j}(F,A,E,G):s(F,A,E,_,G)}return{get groupCount(){return I?I.count:0},get renderObject(){return h},get geometryVersion(){return D},createOrUpdate:(F,G,L={},z)=>ie(function*(){if(function T(F,G,L,z){if(!L&&!A)throw new Error("missing volume");g=Object.assign({},_,G),y=F,b=L,x=z,Cf.reset(m),h?(!et.areEquivalent(b,A)||x!==E)&&(m.createNew=!0):m.createNew=!0,m.createNew?m.createGeometry=!0:(a(m,L,g,_,y,S),Lc.areEqual(F.color,S.color)||(m.updateColor=!0),m.createGeometry&&(m.updateColor=!0),g.instanceGranularity!==_.instanceGranularity&&(m.updateTransform=!0))}(G,L,z?.volume||A,z?.key||E),m.createGeometry){const j=r(F,b,x,y,g,w);return kI(j)?j.then(M):M(j)}M()})(),getLoci:F=>h?o(F,A,E,_,h.id):$n,eachLocation(F){for(I.reset();I.hasNext;){const{location:G,isSecondary:L}=I.move();F(G,L)}},mark:(F,G)=>Sn.mark(h,F,G,V),setVisibility(F){Sn.setVisibility(h,F)},setAlphaFactor(F){Sn.setAlphaFactor(h,F)},setPickable(F){Sn.setPickable(h,F)},setColorOnly(F){Sn.setColorOnly(h,F)},setTransform(F,G){Sn.setTransform(h,F,G)},setOverpaint:F=>Sn.setOverpaint(h,F,V,!0),setTransparency:F=>Sn.setTransparency(h,F,V,!0),setSubstance:F=>Sn.setSubstance(h,F,V,!0),setClipping:F=>Sn.setClipping(h,F,V,!0),setThemeStrength(F){Sn.setThemeStrength(h,F)},destroy(){u?.(w),h&&(h.state.disposed=!0,h=void 0)},mustRecreate:c}}function pC(e,t,n,r,i,o=(()=>[-1])){let s=0;const{webgl:a}=t,c=new mr,u=new yn.GeometryState,l=Hp(),d=[],f=yn.createState(),p=new Map;let m,h,g,y,b=Fo.createEmpty();function x(R,T){return _.apply(this,arguments)}function _(){return(_=ie(function*(R,T){var M;let N=p.get(T);return N?!(null===(M=N.mustRecreate)||void 0===M)&&M.call(N,{volume:m,key:T},y,a)&&(N.destroy(),N=r(l,m,T,y,a),p.set(T,N)):(N=r(l,m,T,y,a),p.set(T,N)),N.createOrUpdate({webgl:a,runtime:R},b,y,{volume:m,key:T})})).apply(this,arguments)}return{label:e,get groupCount(){let R=0;return p.forEach(T=>{T.renderObject&&(R+=T.groupCount)}),R},get props(){return y},get params(){return g},get state(){return f},get theme(){return b},get geometryVersion(){return u.version},renderObjects:d,updated:c,createOrUpdate:function S(R={},T){T&&T!==m&&(g=n(t,T),m=T,y||(y=C.getDefaultValues(g)));const M=o8(Object.assign({},y,R),m);return Object.assign(y,R,M),h=o(y),Oe.create("Creating or updating VolumeRepresentation",function(){var N=ie(function*(V){const F=new Set(p.keys());for(let G=0,L=h.length;G{var L;null===(L=p.get(G))||void 0===L||L.destroy(),p.delete(G)}),d.length=0,p.forEach(G=>{G.renderObject&&(d.push(G.renderObject),u.add(G.renderObject.id,G.geometryVersion))}),u.snapshot(),c.next(s++)});return function(V){return N.apply(this,arguments)}}())},setState:function w(R){const{visible:T,alphaFactor:M,pickable:N,overpaint:V,transparency:F,substance:G,clipping:L,transform:z,themeStrength:j,syncManually:Z,markerActions:$}=R,ee={};void 0!==T&&(ee.visible=T),void 0!==M&&(ee.alphaFactor=M),void 0!==N&&(ee.pickable=N),void 0!==V&&(ee.overpaint=V),void 0!==F&&(ee.transparency=F),void 0!==G&&(ee.substance=G),void 0!==L&&(ee.clipping=L),void 0!==j&&(ee.themeStrength=j),void 0!==z&&!le.areEqual(z,f.transform,vr)&&(ee.transform=z),void 0!==Z&&(ee.syncManually=Z),void 0!==$&&(ee.markerActions=$),p.forEach(q=>function E(R,T){void 0!==T.visible&&R&&R.setVisibility(T.visible),void 0!==T.alphaFactor&&R&&R.setAlphaFactor(T.alphaFactor),void 0!==T.pickable&&R&&R.setPickable(T.pickable),void 0!==T.overpaint&&R&&R.setOverpaint(T.overpaint),void 0!==T.transparency&&R&&R.setTransparency(T.transparency),void 0!==T.substance&&R&&R.setSubstance(T.substance),void 0!==T.clipping&&R&&R.setClipping(T.clipping),void 0!==T.transform&&R&&R.setTransform(T.transform),void 0!==T.themeStrength&&R&&R.setThemeStrength(T.themeStrength)}(q,ee)),yn.updateState(f,R)},setTheme:function D(R){b=R},getLoci:R=>{let T=$n;return p.forEach(M=>{const N=M.getLoci(R);Ta(N)||(T=N)}),T},getAllLoci:()=>[i(m,y)],eachLocation:R=>{p.forEach(T=>{T.eachLocation(R)})},mark:function A(R,T){let M=!1;return p.forEach(N=>{M=N.mark(R,T)||M}),M},destroy:function I(){p.forEach(R=>R.destroy()),p.clear()}}}const Gut="\nprecision highp float;\nprecision highp int;\n\n#if __VERSION__ == 100\n precision highp sampler2D;\n uniform sampler2D tTexture;\n#else\n precision highp isampler2D;\n uniform isampler2D tTexture;\n#endif\n\nvoid main(void) {\n #if __VERSION__ == 100\n gl_FragColor = texture2D(tTexture, vec2(0.5));\n #else\n gl_FragColor = ivec4(texture2D(tTexture, vec2(0.5)).r);\n #endif\n}\n",jut={...vo,tTexture:jt("texture","rgba","float","nearest")},Sl="histopyramid-sum";const i3=new Uint8Array(4),Vde=new Int32Array(4),Yut="\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tInputLevel;\n\n// previous level used to evaluate the new level\n#if __VERSION__ == 100\n uniform sampler2D tPreviousLevel;\n#else\n precision highp isampler2D;\n uniform isampler2D tPreviousLevel;\n#endif\n\n// inverted size of the previous level texture.\nuniform float uSize;\nuniform float uTexSize;\nuniform bool uFirst;\n\n#include common\n\nvoid main(void) {\n float k = 0.5 * uSize;\n vec2 position = floor((gl_FragCoord.xy / uTexSize) / uSize) * uSize;\n\n #if __VERSION__ == 100\n float a, b, c, d;\n\n if (uFirst) {\n a = texture2D(tInputLevel, position).r * 255.0;\n b = texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0;\n c = texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0;\n d = texture2D(tInputLevel, position + vec2(k, k)).r * 255.0;\n } else {\n a = unpackRGBToInt(texture2D(tPreviousLevel, position).rgb);\n b = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(k, 0.0)).rgb);\n c = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(0.0, k)).rgb);\n d = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(k, k)).rgb);\n }\n gl_FragColor = vec4(packIntToRGB(a + b + c + d), 1.0);\n #else\n int a, b, c, d;\n\n if (uFirst) {\n a = int(texture2D(tInputLevel, position).r * 255.0);\n b = int(texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0);\n c = int(texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0);\n d = int(texture2D(tInputLevel, position + vec2(k, k)).r * 255.0);\n } else {\n a = texture2D(tPreviousLevel, position).r;\n b = texture2D(tPreviousLevel, position + vec2(k, 0.0)).r;\n c = texture2D(tPreviousLevel, position + vec2(0.0, k)).r;\n d = texture2D(tPreviousLevel, position + vec2(k, k)).r;\n }\n gl_FragColor = ivec4(a + b + c + d);\n #endif\n}\n",Xut={...vo,tInputLevel:jt("texture","rgba","float","nearest"),tPreviousLevel:jt("texture","rgba","float","nearest"),uSize:xe("f"),uTexSize:xe("f"),uFirst:xe("b")},Fm="histogram-pyramid";function Qut(e,t){const n=Math.pow(2,t),r=`level${t}`,i=e.isWebGL2?o3(r,e,"image-int32","alpha","int","nearest"):o3(r,e,"image-uint8","rgba","ubyte","nearest");i.define(n,n);let o=function elt(e,t){return t.namedFramebuffers[`${Fm}-${e}`]}(r,e);return o||(o=zde(r,e),i.attachFramebuffer(o,0)),{texture:i,framebuffer:o}}function zde(e,t){const n=`${Fm}-${e}`;return t.namedFramebuffers[n]||(t.namedFramebuffers[n]=t.resources.framebuffer()),t.namedFramebuffers[n]}function o3(e,t,n,r,i,o){const s=`${Fm}-${e}`;return t.namedTextures[s]||(t.namedTextures[s]=t.resources.texture(n,r,i,o)),t.namedTextures[s]}function tlt(e,t,n,r){lt&&e.timer.mark("createHistogramPyramid");const{gl:i,state:o}=e,s=t.getWidth();if(s!==t.getHeight()||!$x(s))throw new Error("inputTexture must be of square power-of-two size");const c=Math.ceil(Math.log(s)/Math.log(2)),u=Math.pow(2,c),l=Math.pow(2,c),d=Math.pow(2,c-1),f=e.isWebGL2?o3("pyramid",e,"image-int32","alpha","int","nearest"):o3("pyramid",e,"image-uint8","rgba","ubyte","nearest");f.define(l,d);const p=zde("pyramid",e);f.attachFramebuffer(p,0),o.viewport(0,0,l,d),Wt(i)?i.clearBufferiv(i.COLOR,0,[0,0,0,0]):i.clear(i.COLOR_BUFFER_BIT);const m=[];for(let x=0;x0&&(k.update(h.values.tPreviousLevel,m[c-x].texture),h.update()),o.currentRenderItemId=-1,o.viewport(0,0,A,A),o.scissor(0,0,A,A),Wt(i)?i.clearBufferiv(i.COLOR,0,[0,0,0,0]):i.clear(i.COLOR_BUFFER_BIT),o.scissor(0,0,r[0],r[1]),h.render(),f.bind(0),i.copyTexSubImage2D(i.TEXTURE_2D,0,g,0,0,0,A,A),f.unbind(0),g+=A}i.finish(),lt&&e.timer.markEnd("createHistogramPyramid");const y=Math.max(1,function $ut(e,t){lt&&e.timer.mark("getHistopyramidSum");const{gl:n,state:r,resources:i}=e,o=function Hut(e,t){return e.namedComputeRenderables[Sl]?(k.update(e.namedComputeRenderables[Sl].values.tTexture,t),e.namedComputeRenderables[Sl].update()):e.namedComputeRenderables[Sl]=function qut(e,t){const n={..._o,tTexture:k.create(t)},r={...jut};return ji(zi(e,"triangles",Br("sum",ps,Gut,{},{0:"ivec4"}),r,n),n)}(e,t),e.namedComputeRenderables[Sl]}(e,t);e.state.currentRenderItemId=-1,e.namedFramebuffers[Sl]||(e.namedFramebuffers[Sl]=i.framebuffer());const s=e.namedFramebuffers[Sl];return e.namedTextures[Sl]||(e.namedTextures[Sl]=Wt(n)?i.texture("image-int32","rgba","int","nearest"):i.texture("image-uint8","rgba","ubyte","nearest"),e.namedTextures[Sl].define(1,1)),e.namedTextures[Sl].attachFramebuffer(s,0),function Wut(e){const{gl:t,state:n}=e;n.disable(t.CULL_FACE),n.disable(t.BLEND),n.disable(t.DEPTH_TEST),n.disable(t.SCISSOR_TEST),n.depthMask(!1),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0)}(e),r.viewport(0,0,1,1),o.render(),n.finish(),e.readPixels(0,0,1,1,Wt(n)?Vde:i3),e.unbindFramebuffer(),lt&&e.timer.markEnd("getHistopyramidSum"),Wt(n)?Vde[0]:m5(i3[0],i3[1],i3[2])}(e,m[0].texture));return{pyramidTex:f,count:y,height:Math.ceil(y/Math.pow(2,c)),levels:c,scale:n}}let hC,mC;function nlt(){if(void 0!==hC)return hC;hC=Po(256,1,Uint8Array);const{array:e}=hC;for(let t=0,n=a1.length;tMr(t.grid.cells.data.length,1,1,()=>rc),getLoci:WU,eachLocation:$U,setUpdateState:(t,n,r,i)=>{et.IsoValue.areSame(r.isoValue,i.isoValue,n.grid.stats)||(t.createGeometry=!0)},geometryUtils:xa.Utils,mustRecreate:(t,n,r)=>!n.tryUseGpu||!r||!qU(t.volume,r),dispose:t=>{t.vertexTexture.ref.value.destroy(),t.groupTexture.ref.value.destroy(),t.normalTexture.ref.value.destroy(),t.doubleBuffer.destroy()}},e)}(e):function vlt(e){return z0({defaultProps:C.getDefaultValues(XU),createGeometry:blt,createLocationIterator:t=>Mr(t.grid.cells.data.length,1,1,()=>rc),getLoci:WU,eachLocation:$U,setUpdateState:(t,n,r,i)=>{et.IsoValue.areSame(r.isoValue,i.isoValue,n.grid.stats)||(t.createGeometry=!0)},geometryUtils:Nt.Utils,mustRecreate:(t,n,r)=>n.tryUseGpu&&!!r&&qU(t.volume,r)},e)}(e)}function jde(e,t){return et.Isosurface.Loci(e,t.isoValue)}function WU(e,t,n,r,i){const{objectId:o,groupId:s}=e;if(i===o){const a=et.PickingGranularity.get(t);return"volume"===a?et.Loci(t):"object"===a?et.Isosurface.Loci(t,r.isoValue):et.Cell.Loci(t,Ce.ofSingleton(s))}return $n}function $U(e,t,n,r,i){return rE(e,t,{isoValue:r.isoValue},i)}function blt(e,t,n,r,i,o){return YU.apply(this,arguments)}function YU(){return YU=ie(function*(e,t,n,r,i,o){e.runtime.update({message:"Marching cubes..."});const s=Tc(new Int32Array(t.grid.cells.data.length)),a=yield c1({isoLevel:et.IsoValue.toAbsolute(i.isoValue,t.grid.stats).absoluteValue,scalarField:t.grid.cells,idField:wn.create(t.grid.cells.space,wn.Data1(s))},o).runAsChild(e.runtime),c=Ko.getGridToCartesianTransform(t.grid);return Nt.transform(a,c),e.webgl&&!e.webgl.isWebGL2?(Nt.uniformTriangleGroup(a,!1),k.updateIfChanged(a.varyingGroup,!1)):k.updateIfChanged(a.varyingGroup,!0),a.setBoundingSphere(et.Isosurface.getBoundingSphere(t,i.isoValue)),a}),YU.apply(this,arguments)}const XU={...Nt.Params,...xa.Params,...Gde,quality:{...Nt.Params.quality,isEssential:!1},tryUseGpu:C.Boolean(!0)};var KU;function _lt(e,t,n,r,i,o){return ZU.apply(this,arguments)}function ZU(){return ZU=ie(function*(e,t,n,r,i,o){if(!e.webgl)throw new Error("webgl context required to create volume isosurface texture-mesh");if(t.grid.cells.data.length<=1)return xa.createEmpty(o);const{max:s,min:a}=t.grid.stats,c=s-a,u=et.IsoValue.toAbsolute(i.isoValue,t.grid.stats).absoluteValue,l=(u-a)/c,{texture:d,gridDimension:f,gridTexDim:p,gridTexScale:m,transform:h}=KU.get(t,e.webgl),g=t.grid.cells.space.axisOrderSlowToFast,y=o?.doubleBuffer.get(),b=s3(e.webgl,d,f,p,m,h,l,u<0,!1,g,!0,y?.vertex,y?.group,y?.normal),x=t.grid.cells.data.length,_=et.getBoundingSphere(t),S=xa.create(b.vertexCount,x,b.vertexTexture,b.groupTexture,b.normalTexture,_,o);return S.meta.webgl=e.webgl,S}),ZU.apply(this,arguments)}function Slt(e,t,n,r,i,o){return QU.apply(this,arguments)}function QU(){return QU=ie(function*(e,t,n,r,i,o){e.runtime.update({message:"Marching cubes..."});const s=Tc(new Int32Array(t.grid.cells.data.length)),a=yield HU({isoLevel:et.IsoValue.toAbsolute(i.isoValue,t.grid.stats).absoluteValue,scalarField:t.grid.cells,idField:wn.create(t.grid.cells.space,wn.Data1(s))},o).runAsChild(e.runtime),c=Ko.getGridToCartesianTransform(t.grid);return di.transform(a,c),a.setBoundingSphere(et.Isosurface.getBoundingSphere(t,i.isoValue)),a}),QU.apply(this,arguments)}!function(e){const t="volume-isosurface-texture";e.descriptor=au({name:t}),e.get=function n(r,i){const{resources:o}=i,s=Ko.getGridToCartesianTransform(r.grid),a=v.clone(r.grid.cells.space.dimensions),{width:c,height:u,powerOfTwoSize:l}=vm(a,gC),d=v.create(c,u,0),f=Me.create(c/l,u/l);if(l>i.maxTextureSize/2)throw new Error("volume too large for gpu isosurface extraction");if(!r._propertyData[t]){r._propertyData[t]=o.texture("image-uint8","alpha","ubyte","linear");const p=r._propertyData[t];p.define(l,l),p.load(Fae(r,"data",gC),!0),r.customProperties.add(e.descriptor),r.customProperties.assets(e.descriptor,[{dispose:()=>p.destroy()}])}return a[0]+=gC,a[1]+=gC,{texture:r._propertyData[t],transform:s,gridDimension:a,gridTexDim:d,gridTexScale:f}}}(KU||(KU={}));const Hde={...di.Params,...Gde,quality:{...di.Params.quality,isEssential:!1},sizeFactor:C.Numeric(3,{min:0,max:10,step:.1})};function Clt(e){return z0({defaultProps:C.getDefaultValues(Hde),createGeometry:Slt,createLocationIterator:t=>Mr(t.grid.cells.data.length,1,1,()=>rc),getLoci:WU,eachLocation:$U,setUpdateState:(t,n,r,i)=>{et.IsoValue.areSame(r.isoValue,i.isoValue,n.grid.stats)||(t.createGeometry=!0)},geometryUtils:di.Utils},e)}const qde={solid:(e,t)=>pC("Isosurface mesh",e,t,ylt,jde),wireframe:(e,t)=>pC("Isosurface wireframe",e,t,Clt,jde)},Wde={...XU,...Hde,visuals:C.MultiSelect(["solid"],C.objectToOptions(qde)),bumpFrequency:C.Numeric(1,{min:0,max:10,step:.1},rt.ShadingCategory)},Ilt={name:"isosurface",label:"Isosurface",description:"Displays a triangulated isosurface of volumetric data.",factory:function Alt(e,t){return yn.createMulti("Isosurface",e,t,yn.StateBuilder,qde)},getParams:function wlt(e,t){const n=C.clone(Wde);return n.isoValue=et.createIsoValueParam(et.IsoValue.relative(2),t.grid.stats),n},defaultValues:C.getDefaultValues(Wde),defaultColorTheme:{name:"uniform"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>!et.isEmpty(e)&&!et.Segmentation.get(e)};function Tlt(e,t,n,r,i,o){return JU.apply(this,arguments)}function JU(){return JU=ie(function*(e,t,n,r,i,o){const{dimension:{name:s},isoValue:a}=i,{space:c,data:u}=t.grid.cells,{min:l,max:d}=t.grid.stats,f=et.IsoValue.toAbsolute(a,t.grid.stats).absoluteValue,p="color"in r.color?r.color.color(rc,!1):st(16777215),[m,h,g]=st.toRgbNormalized(p),{width:y,height:b,x,y:_,z:S,x0:A,y0:E,z0:w,nx:D,ny:I,nz:R}=eV(t.grid,i),T=new Float32Array("x"===s?[x,0,0,x,_,0,x,0,S,x,_,S]:"y"===s?[0,_,0,x,_,0,0,_,S,x,_,S]:[0,0,S,0,_,S,x,0,S,x,_,S]),M=new Uint8Array(y*b*4),N=function Dlt(e,t){const{space:n}=e.cells,{width:r,height:i,x0:o,y0:s,z0:a,nx:c,ny:u,nz:l}=eV(e,t),d=new Uint8Array(r*i*4);let f=0;for(let p=s;p=f?255:0,V+=4}const F={width:y,height:b,array:M,flipY:!0},G={width:y,height:b,array:N,flipY:!0};return l0(Ko.getGridToCartesianTransform(t.grid),T,0,4),jp.create(F,T,G,o)}),JU.apply(this,arguments)}function eV(e,t){const{dimension:{name:n,params:r}}=t,{space:i}=e.cells;let o,s,a,c,u,l=0,d=0,f=0,[p,m,h]=i.dimensions;return"x"===n?(a=r,c=m-1,u=h-1,o=h,s=m,l=a,p=l+1):"y"===n?(a=p-1,c=r,u=h-1,o=h,s=p,d=c,m=d+1):(a=p-1,c=m-1,u=r,o=p,s=m,f=u,h=f+1),{width:o,height:s,x:a,y:c,z:u,x0:l,y0:d,z0:f,nx:p,ny:m,nz:h}}function $de(e,t){const n=function Elt(e,t){const{space:n}=e.cells,{width:r,height:i,x0:o,y0:s,z0:a,nx:c,ny:u,nz:l}=eV(e,t),d=new Uint32Array(r*i);let f=0;for(let p=s;pMr(t.grid.cells.data.length,1,1,()=>rc),getLoci:Plt,eachLocation:Mlt,setUpdateState:(t,n,r,i,o,s)=>{t.createGeometry=r.dimension.name!==i.dimension.name||r.dimension.params!==i.dimension.params||!et.IsoValue.areSame(r.isoValue,i.isoValue,n.grid.stats)||!Lc.areEqual(o.color,s.color)},geometryUtils:{...jp.Utils,createRenderableState:t=>{const n=jp.Utils.createRenderableState(t);return Yde(n,t),n},updateRenderableState:Yde}},e)}function Yde(e,t){jp.Utils.updateRenderableState(e,t),e.opaque=!1,e.writeDepth=!0}const Flt={name:"slice",label:"Slice",description:"Slice of volume rendered as image with interpolation.",factory:function Nlt(e,t){return pC("Slice",e,t,klt,$de)},getParams:function Rlt(e,t){const n=C.clone(tV),r=t.grid.cells.space.dimensions;return n.dimension=C.MappedStatic("x",{x:C.Numeric(0,{min:0,max:r[0]-1,step:1}),y:C.Numeric(0,{min:0,max:r[1]-1,step:1}),z:C.Numeric(0,{min:0,max:r[2]-1,step:1})},{isEssential:!0}),n.isoValue=et.createIsoValueParam(et.IsoValue.absolute(t.grid.stats.min),t.grid.stats),n},defaultValues:C.getDefaultValues(tV),defaultColorTheme:{name:"uniform"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>!et.isEmpty(e)&&!et.Segmentation.get(e)};function Xde(e,t){const n=St();return St.add(n,e),St.transform(n,n,t),n}function Kde(e){if("matrix"===e.transform.kind)return{unitToCartn:le.mul(le(),e.transform.matrix,le.fromScaling(le(),e.cells.space.dimensions)),cellDim:le.getScaling(v(),e.transform.matrix)};const t=e.transform.fractionalBox,n=St.size(v(),t);return{unitToCartn:le.mul3(le(),e.transform.cell.fromFractional,le.fromTranslation(le(),t.min),le.fromScaling(le(),n)),cellDim:v.div(v(),e.transform.cell.size,e.cells.space.dimensions)}}function Llt(e,t,n,r,i,o){return nV.apply(this,arguments)}function nV(){return nV=ie(function*(e,t,n,r,i,o){const{webgl:a}=e;if(void 0===a)throw new Error("DirectVolumeVisual requires `webgl` in props");return a.isWebGL2?function Olt(e,t,n,r){const i=n.grid.cells.space.dimensions;if(Math.max(...i)>t.max3dTextureSize/2)throw new Error("volume too large for direct-volume rendering");const o=function SQe(e){const{cells:{space:t,data:n},stats:{max:r,min:i}}=e.grid,[o,s,a]=t.dimensions,{dataOffset:c}=t,u=new Uint8Array(o*s*a*4),l={array:u,width:o,height:s,depth:a},d=r-i,f=v(),p=v(),m=o-1,h=s-1,g=a-1;let y=0;for(let b=0;bt.maxTextureSize/2)throw new Error("volume too large for direct-volume rendering");const a=Fae(n,"normals"),c=Ko.getGridToCartesianTransform(n.grid),u=Xde(i,c),l=r?r.gridTexture.ref.value:t.resources.texture("image-uint8","rgba","ubyte","linear");l.load(a);const{unitToCartn:d,cellDim:f}=Kde(n.grid);return _u.create(u,i,c,d,f,l,n.grid.stats,!1,n.grid.cells.space.axisOrderSlowToFast,r)}(0,a,t,o)}),nV.apply(this,arguments)}function Ult(e,t){return et.Loci(e)}function Vlt(e,t,n,r,i){const{objectId:o,groupId:s}=e;return i===o?et.Cell.Loci(t,Ce.ofSingleton(s)):$n}function zlt(e,t,n,r,i){return rE(e,t,void 0,i)}const rV={..._u.Params,quality:{..._u.Params.quality,isEssential:!1}};function jlt(e){return z0({defaultProps:C.getDefaultValues(rV),createGeometry:Llt,createLocationIterator:t=>Mr(t.grid.cells.data.length,1,1,()=>rc),getLoci:Vlt,eachLocation:zlt,setUpdateState:(t,n,r,i)=>{},geometryUtils:_u.Utils,dispose:t=>{t.gridTexture.ref.value.destroy()}},e)}const qlt={name:"direct-volume",label:"Direct Volume",description:"Direct rendering of volumetric data.",factory:function Hlt(e,t){return pC("Direct Volume",e,t,jlt,Ult)},getParams:function Glt(e,t){const n=C.clone(rV);return n.controlPoints.getVolume=()=>t,n},defaultValues:C.getDefaultValues(rV),defaultColorTheme:{name:"volume-value"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>!et.isEmpty(e)&&!et.Segmentation.get(e)},Wlt={segments:C.Converted(e=>e.map(t=>`${t}`),e=>e.map(t=>parseInt(t)),C.MultiSelect(["0"],C.arrayToOptions(["0"]),{isEssential:!0}))},yC=1;function iV(e,t){if(e.grid.cells.data.length{const r=et.Segment.Location(t,n);return Mr(t.grid.cells.data.length,1,1,()=>r)},getLoci:Qde,eachLocation:Jde,setUpdateState:(t,n,r,i)=>{},geometryUtils:xa.Utils,mustRecreate:(t,n,r)=>!n.tryUseGpu||!r||!iV(t.volume,r),dispose:t=>{t.vertexTexture.ref.value.destroy(),t.groupTexture.ref.value.destroy(),t.normalTexture.ref.value.destroy(),t.doubleBuffer.destroy()}},e)}(e):function Jlt(e){return z0({defaultProps:C.getDefaultValues(sV),createGeometry:Qlt,createLocationIterator:(t,n)=>{const r=et.Segment.Location(t,n);return Mr(t.grid.cells.data.length,1,1,()=>r)},getLoci:Qde,eachLocation:Jde,setUpdateState:(t,n,r,i)=>{},geometryUtils:Nt.Utils,mustRecreate:(t,n,r)=>n.tryUseGpu&&!!r&&iV(t.volume,r)},e)}(e)}function Klt(e,t){return et.Segment.Loci(e,t.segments)}function Qde(e,t,n,r,i){const{objectId:o,groupId:s}=e;if(i===o){const a=et.PickingGranularity.get(t);return"volume"===a?et.Loci(t):"object"===a?et.Segment.Loci(t,[n]):et.Cell.Loci(t,Ce.ofSingleton(s))}return $n}function Jde(e,t,n,r,i){return rE(e,t,{segments:je.ofSingleton(n)},i)}function Qlt(e,t,n,r,i,o){return oV.apply(this,arguments)}function oV(){return oV=ie(function*(e,t,n,r,i,o){const s=et.Segmentation.get(t);if(!s)throw new Error("missing volume segmentation");e.runtime.update({message:"Marching cubes..."});const a=St.clone(s.bounds[n]);St.expand(a,a,v.create(2,2,2));const u=function Zlt(e,t,n){const r=n.data,i=n.space.dataOffset,o=St.size(v(),t),[s,a,c]=o,u=s-1,l=a-1,d=c-1,[f,p,m]=t.min,[h,g,y]=t.max,b=[...n.space.axisOrderSlowToFast],x=wn.Space(o,b,Uint8Array),_=wn.create(x,x.create()),S=_.data,A=x.set;for(let E=0;En.maxTextureSize/2)throw new Error("volume too large for gpu segment extraction");n.namedTextures[aV]||(n.namedTextures[aV]=i.texture("image-uint8","alpha","ubyte","linear"));const p=n.namedTextures[aV];p.define(l,l);const m=Array.from(r.segments.get(t).values());return p.load(function CQe(e,t,n,r=0){const i=e.grid.cells.data,o=St.size(v(),n),s=e.grid.cells.space.dataOffset,{width:a,height:c}=vm(o,r),l=new Uint8Array(a*c*1),d={array:l,width:a,height:c},[f,p,m]=o,h=f-1,g=p-1,y=m-1,b=f+r,x=p+r,[_,S,A]=n.min,[E,w,D]=n.max;for(let I=0;IpC("Segment mesh",e,t,Xlt,Klt,rdt)},tfe={...sV,visuals:C.MultiSelect(["segment"],C.objectToOptions(efe)),bumpFrequency:C.Numeric(1,{min:0,max:10,step:.1},rt.ShadingCategory)},sdt={name:"segment",label:"Segment",description:"Displays a triangulated segment of volumetric data.",factory:function odt(e,t){return yn.createMulti("Segment",e,t,yn.StateBuilder,efe)},getParams:function idt(e,t){const n=C.clone(tfe),r=et.Segmentation.get(t);if(r){const i=Array.from(r.segments.keys());n.segments=C.Converted(o=>o.map(s=>`${s}`),o=>o.map(s=>parseInt(s)),C.MultiSelect(i.map(o=>`${o}`),C.arrayToOptions(i.map(o=>`${o}`)),{isEssential:!0}))}return n},defaultValues:C.getDefaultValues(tfe),defaultColorTheme:{name:"volume-segment"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>!et.isEmpty(e)&&!!et.Segmentation.get(e)};class u1 extends Vae{constructor(){super(),$a(u1.BuiltIn,(t,n)=>{if(t.name!==n)throw new Error(`Fix BuiltInVolumeRepresentations to have matching names. ${t.name} ${n}`);this.add(t)})}}function nfe(e,t,n,r){e.push({source:"em"===t?{name:"em",params:{isoValue:et.IsoValue.absolute(r||0)}}:{name:"x-ray",params:{}},dataId:n})}!function(e){e.BuiltIn={isosurface:Ilt,slice:Flt,"direct-volume":qlt,segment:sdt}}(u1||(u1={}));const adt=nc.build({display:{name:"Volume Streaming"},from:pe.Molecule.Structure,params(e,t){const n=function _ut(e,t="x-ray"){if(!e)return t;const n=e.models[0];return Er.is(n.sourceData)?sn.hasEmMap(n)?"em":sn.hasXrayMap(n)?"x-ray":sn.isFromEm(n)?"em":sn.isFromXray(n)?"x-ray":t:t}(e&&e.data),r=function Cut(e,t){if(!t||!t.models.length)return[];const n=t.models[0];switch(e){case"em":return function xut(e){const t=[];if(!Er.is(e.sourceData))return[e.entryId];const{db_id:n,db_name:r,content_type:i}=e.sourceData.data.db.pdbx_database_related;if(!r.isDefined)return[e.entryId];for(let o=0,s=r.rowCount;oi,{defaultValue:r.map(i=>({id:i}))}),defaultView:C.Select("em"===n?"auto":"selection-box",Tu.ViewTypeOptions),options:C.Group({serverUrl:C.Text(t.config.get(qi.VolumeStreaming.DefaultServer)||"https://ds.litemol.org"),behaviorRef:C.Text("",{isHidden:!0}),emContourProvider:C.Select("emdb",[["emdb","EMDB"],["pdbe","PDBe"]],{isHidden:!0}),channelParams:C.Value({},{isHidden:!0})})}},isApplicable:(e,t,n)=>{const r=n.config.get(qi.VolumeStreaming.CanStream);return r?r(e.data,n):1===e.data.models.length&&sn.probablyHasDensityMap(e.data.models[0])}})(({ref:e,state:t,params:n},r)=>Oe.create("Volume Streaming",function(){var i=ie(function*(o){const s=[];for(let f=0,p=n.entries.length;f0&&(yield r.managers.structure.hierarchy.remove(u?.toArray()));const l=c.cell.obj,d=t.build().to(a.ref).apply(rfe,C.getDefaultValues(Tu.createParams({data:l.data,defaultView:n.defaultView,channelParams:n.options.channelParams})),{ref:n.options.behaviorRef?n.options.behaviorRef:void 0});"em"===n.method?d.apply(a3,{channel:"em"},{state:{isGhost:!0},tags:"em"}):(d.apply(a3,{channel:"2fo-fc"},{state:{isGhost:!0},tags:"2fo-fc"}),d.apply(a3,{channel:"fo-fc(+ve)"},{state:{isGhost:!0},tags:"fo-fc(+ve)"}),d.apply(a3,{channel:"fo-fc(-ve)"},{state:{isGhost:!0},tags:"fo-fc(-ve)"})),yield t.updateTree(d).runInContext(o)});return function(o){return i.apply(this,arguments)}}())),cdt=nc.build({display:{name:"Boxify Volume Streaming",description:"Make the current box permanent."},from:Tu,isApplicable:e=>"selection-box"===e.data.params.entry.params.view.name})(({a:e,ref:t,state:n},r)=>{const i=e.data.params;if("selection-box"!==i.entry.params.view.name)return;const o=St.create(v.clone(i.entry.params.view.params.bottomLeft),v.clone(i.entry.params.view.params.topRight)),s=i.entry.params.view.params.radius;St.expand(o,o,v.create(s,s,s));const a={...i,entry:{name:i.entry.name,params:{...i.entry.params,view:{name:"box",params:{bottomLeft:o.min,topRight:o.max}}}}};return n.updateTree(n.build().to(t).update(a))}),udt={dataId:C.Text(""),source:C.MappedStatic("x-ray",{em:C.Group({isoValue:et.createIsoValueParam(et.IsoValue.relative(1))}),"x-ray":C.Group({})})},ldt=Rt.BuiltIn({name:"create-volume-streaming-info",display:{name:"Volume Streaming Info"},from:pe.Molecule.Structure,to:OU,params:e=>({serverUrl:C.Text("https://ds.litemol.org"),entries:C.ObjectList(udt,({dataId:t})=>t,{defaultValue:[{dataId:"",source:{name:"x-ray",params:{}}}]})})})({apply:({a:e,params:t},n)=>Oe.create("",function(){var r=ie(function*(i){const o=[];for(let a=0,c=t.entries.length;aa.dataId).join(", ")}`})});return function(i){return r.apply(this,arguments)}}())}),rfe=Rt.BuiltIn({name:"create-volume-streaming-behavior",display:{name:"Volume Streaming Behavior"},from:OU,to:Tu,params:e=>Tu.createParams({data:e&&e.data})})({canAutoUpdate:({oldParams:e,newParams:t})=>e.entry.params.view===t.entry.params.view||"selection-box"===t.entry.params.view.name||"camera-target"===t.entry.params.view.name||"off"===t.entry.params.view.name,apply:({a:e,params:t},n)=>Oe.create("Volume streaming",function(){var r=ie(function*(i){const o=new Tu.Behavior(n,e.data);return yield o.update(t),new Tu(o,{label:"Volume Streaming",description:o.getDescription()})});return function(i){return r.apply(this,arguments)}}()),update:({b:t,oldParams:n,newParams:r})=>Oe.create("Update Volume Streaming",function(){var i=ie(function*(o){if(n.entry.name!==r.entry.name&&"em"in r.entry.params.channels){const{emDefaultContourLevel:a}=t.data.infoMap.get(r.entry.name);a&&(r.entry.params.channels.em.isoValue=a)}const s=(yield t.data.update(r))?Qe.UpdateResult.Updated:Qe.UpdateResult.Unchanged;return t.description=t.data.getDescription(),s});return function(o){return i.apply(this,arguments)}}())}),a3=Rt.BuiltIn({name:"create-volume-streaming-visual",display:{name:"Volume Streaming Visual"},from:Tu,to:pe.Volume.Representation3D,params:{channel:C.Select("em",Tu.ChannelTypeOptions,{isHidden:!0})}})({apply:({a:e,params:t,spine:n},r)=>Oe.create("Volume Representation",function(){var i=ie(function*(o){var s,a;const c=e.data.channels[t.channel];if(!c)return li.Null;const u=ife(e.data,t.channel),l=u1.BuiltIn.isosurface,d=u.type.params||{},f=l.factory({webgl:null===(s=r.canvas3d)||void 0===s?void 0:s.webgl,...r.representation.volume.themes},l.getParams);f.setTheme(Fo.create(r.representation.volume.themes,{volume:c.data},u));const p=null===(a=n.getAncestorOfType(pe.Molecule.Structure))||void 0===a?void 0:a.data,m=0===p?.models.length?void 0:Hg.get(p?.models[0]);return yield f.createOrUpdate(d,c.data).runInContext(o),m&&f.setState({transform:m}),new pe.Volume.Representation3D({repr:f,sourceData:c.data},{label:`${Math.round(100*c.isoValue.relativeValue)/100} \u03c3 [${t.channel}]`})});return function(o){return i.apply(this,arguments)}}()),update:({a:e,b:t,newParams:n},i)=>Oe.create("Volume Representation",function(){var o=ie(function*(s){const a=e.data.channels[n.channel];if(!a)return Qe.UpdateResult.Unchanged;const c=t.data.repr.state.visible,u=ife(e.data,n.channel),l={...t.data.repr.props,...u.type.params};return t.data.repr.setTheme(Fo.create(i.representation.volume.themes,{volume:a.data},u)),yield t.data.repr.createOrUpdate(l,a.data).runInContext(s),t.data.repr.setState({visible:c}),t.data.sourceData=a.data,Qe.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())});function ife(e,t){const n=e.channels[t];return Af.getDefaultParamsStatic(e.plugin,"isosurface",{isoValue:n.isoValue,alpha:n.opacity,visuals:n.wireframe?["wireframe"]:["solid"]},"uniform",{value:n.color})}const ddt=eh.create({name:"built-in.animate-state-interpolation",display:{name:"Animate State (experimental)"},params:()=>({transtionDurationInMs:C.Numeric(2e3,{min:100,max:3e4,step:10})}),canApply:e=>({canApply:e.managers.snapshot.state.entries.size>1}),initialState:()=>({}),apply:(e,t,n)=>ie(function*(){const r=n.plugin.managers.snapshot.state.entries;if(r.size<2)return{kind:"finished"};const i=t.current%n.params.transtionDurationInMs/n.params.transtionDurationInMs,o=Math.floor(t.current/n.params.transtionDurationInMs)%r.size;let s=Math.ceil(t.current/n.params.transtionDurationInMs);s===o&&s++,s%=r.size;const a=r.get(o).snapshot,c=r.get(s).snapshot;if(!a.data||!c.data)return{kind:"skip"};const u=a.data.tree.transforms,l=c.data.tree.transforms,d=n.plugin.state.data,f=d.build();for(const p of u)for(const m of l){if(m.ref!==p.ref||m.version===p.version)continue;const h=ur.fromJSON(p),g=ur.fromJSON(m),y=d.cells.get(p.ref);if(!y)continue;let b;b=h.transformer.definition.interpolate?h.transformer.definition.interpolate(h.params,g.params,i,n.plugin):i<=.5?h.params:g.params,Hx(y,b)||f.to(p.ref).update(b)}return yield Cn.State.Update(n.plugin,{state:d,tree:f,options:{doNotLogTiming:!0}}),{kind:"next",state:{}}})()}),fdt=eh.create({name:"built-in.animate-structure-spin",display:{name:"Spin Structure"},isExportable:!0,params:()=>({durationInMs:C.Numeric(3e3,{min:100,max:1e4,step:100})}),initialState:()=>({t:0}),getDuration:e=>({kind:"fixed",durationMs:e.durationInMs}),setup:(e,t,n)=>ie(function*(){const r=n.state.data,i=r.select(In.Generators.ofType(pe.Molecule.Structure.Representation3D)),o=r.build();let s=!1;for(const a of i)r.select(In.Generators.ofTransformer(Ye.Representation.SpinStructureRepresentation3D,a.transform.ref)).length>0||(s=!0,o.to(a.transform.ref).apply(Ye.Representation.SpinStructureRepresentation3D,{t:0},{tags:"animate-structure-spin"}));if(s)return o.commit({doNotUpdateCurrent:!0})})(),teardown(e,t,n){const r=n.state.data,i=r.select(In.Generators.ofType(pe.Molecule.Structure.Representation3DState).withTag("animate-structure-spin"));if(0===i.length)return;const o=r.build();for(const s of i)o.delete(s.transform.ref);return o.commit()},apply:(e,t,n)=>ie(function*(){var r;const i=n.plugin.state.data,o=i.select(In.Generators.ofTransformer(Ye.Representation.SpinStructureRepresentation3D));if(0===o.length)return{kind:"finished"};const s=i.build(),c=(e.t+(t.current-t.lastApplied)/n.params.durationInMs)%1;for(const u of o)s.to(u).update({...null===(r=u.params)||void 0===r?void 0:r.values,t:c});return yield Cn.State.Update(n.plugin,{state:i,tree:s,options:{doNotLogTiming:!0}}),{kind:"next",state:{t:c}}})()}),c3=v(),ofe=v(),sfe=_r(),pdt=eh.create({name:"built-in.animate-camera-rock",display:{name:"Camera Rock",description:"Rock the 3D scene around the x-axis in view space"},isExportable:!0,params:()=>({durationInMs:C.Numeric(4e3,{min:100,max:2e4,step:100}),speed:C.Numeric(1,{min:1,max:10,step:1},{description:"How many times to rock from side to side."}),angle:C.Numeric(10,{min:0,max:180,step:1},{description:"How many degrees to rotate in each direction."})}),initialState:(e,t)=>({snapshot:t.canvas3d.camera.getSnapshot()}),getDuration:e=>({kind:"fixed",durationMs:e.durationInMs}),teardown:(e,t,n)=>{var r;null===(r=n.canvas3d)||void 0===r||r.requestCameraReset({snapshot:t.snapshot,durationMs:0})},apply:(e,t,n)=>ie(function*(){var r,i;if(0===t.current)return{kind:"next",state:e};const o=e.snapshot;if(o.radiusMax<1e-4)return{kind:"finished"};const s=t.animation?(null===(r=t.animation)||void 0===r?void 0:r.currentFrame)/(t.animation.frameCount+1):os(t.current/n.params.durationInMs,0,1),a=Math.sin(s*n.params.speed*Math.PI*2)*Yn(n.params.angle);v.sub(c3,o.position,o.target),v.normalize(ofe,o.up),_r.setAxisAngle(sfe,ofe,a),v.transformQuat(c3,c3,sfe);const c=v.add(v(),o.target,c3);return null===(i=n.plugin.canvas3d)||void 0===i||i.requestCameraReset({snapshot:{...o,position:c},durationMs:0}),s>=.99999?{kind:"finished"}:{kind:"next",state:e}})()});var an,u3;function ch(...e){const t=Sb(e),n=yK(e,1/0),r=e;return r.length?1===r.length?ru(r[0]):xg(n)($i(r,t)):$l}function afe(e,t=r3){return mo((n,r)=>{let i=null,o=null,s=null;const a=()=>{if(i){i.unsubscribe(),i=null;const u=o;o=null,r.next(u)}};function c(){const u=s+e,l=t.now();if(l{o=u,s=t.now(),i||(i=t.schedule(c,e),r.add(i))},()=>{a(),r.complete()},void 0,()=>{o=i=null}))})}!function(e){e.Action=function t(r,i){return{action:r,customControl:i&&i.customControl,autoUpdate:i&&i.autoUpdate}},e.Behavior=function n(r,i={}){return{transformer:r,defaultParams:i}}}(an||(an={})),function(e){e.Registry=class t{constructor(){this.providers=ol().asMutable(),this.defaultAutoAttachValues=new Map}getParams(r){const i={},o=[],s=[];if(r){const a=this.providers.values();for(;;){const c=a.next();if(c.done)break;const u=c.value;u.isApplicable(r)&&(u.isHidden||(o.push([u.descriptor.name,u.label]),this.defaultAutoAttachValues.get(u.descriptor.name)&&s.push(u.descriptor.name)),i[u.descriptor.name]=C.Group({...u.getParams(r)},{label:u.label,isHidden:u.isHidden}))}}return{autoAttach:C.MultiSelect(s,o),properties:C.Group(i,{isFlat:!0})}}setDefaultAutoAttach(r,i){this.defaultAutoAttachValues.set(r,i)}get(r){if(!this.providers.get(r))throw new Error(`Custom property '${r}' is not registered.`);return this.providers.get(r)}register(r,i){this.providers.set(r.descriptor.name,r),this.defaultAutoAttachValues.set(r.descriptor.name,i)}unregister(r){this.providers.delete(r),this.defaultAutoAttachValues.delete(r)}}}(u3||(u3={}));class mdt{get dataState(){return this.plugin.state.data}rawData(t,n){return this.dataState.build().toRoot().apply(cre,t,n).commit({revertOnError:!0})}download(t,n){return this.dataState.build().toRoot().apply(sre,t,n).commit({revertOnError:!0})}downloadBlob(t,n){return this.dataState.build().toRoot().apply(are,t,n).commit({revertOnError:!0})}readFile(t,n){var r=this;return ie(function*(){var i,o,s;return{data:yield r.dataState.build().toRoot().apply(ure,t,n).commit({revertOnError:!0}),fileInfo:o1(null!==(s=null===(o=null===(i=t.file)||void 0===i?void 0:i.file)||void 0===o?void 0:o.name)&&void 0!==s?s:"")}})()}constructor(t){this.plugin=t}}class gdt{get dataState(){return this.plugin.state.data}resolveProvider(t){var n;return"string"==typeof t?null!==(n=Mf[t])&&void 0!==n?n:cB(this._providers,r=>r.id===t):t}hasPreset(t){for(const n of this._providers)if(!n.isApplicable||n.isApplicable(t,this.plugin))return!0;return!1}get providers(){return this._providers}getPresets(t){if(!t)return this.providers;const n=[];for(const r of this._providers)r.isApplicable&&!r.isApplicable(t,this.plugin)||n.push(r);return n}getPresetSelect(t){const n=[];for(const r of this._providers)t&&r.isApplicable&&!r.isApplicable(t,this.plugin)||n.push([r.id,r.display.name,r.display.group]);return C.Select("auto",n)}getPresetsWithOptions(t){const n=[],r=Object.create(null);for(const i of this._providers)i.isApplicable&&!i.isApplicable(t,this.plugin)||(n.push([i.id,i.display.name]),r[i.id]=i.params?C.Group(i.params(t,this.plugin)):C.EmptyGroup());return 0===n.length?C.MappedStatic("",{"":C.EmptyGroup()}):C.MappedStatic(n[0][0],r,{options:n})}registerPreset(t){if(this.providerMap.has(t.id))throw new Error(`Representation provider with id '${t.id}' already registered.`);this._providers.push(t),this.providerMap.set(t.id,t)}unregisterPreset(t){this.providerMap.delete(t.id),Xx(this._providers,t)}applyPreset(t,n,r){var i;const o=this.resolveProvider(n);if(!o)return;const a=ls.resolveAndCheck(this.plugin.state.data,t);if(!a)return void(Qx||console.warn("Applying structure repr. provider to bad cell."));const c=(null===(i=o.params)||void 0===i?void 0:i.call(o,a.obj,this.plugin))||{};let u=r||(o.params?C.getDefaultValues(c):{});const l=this.plugin.config.get(qi.Structure.DefaultRepresentationPresetParams);u=C.merge(c,l,u);const d=Oe.create(`${o.display.name}`,()=>o.apply(a,u,this.plugin));return this.plugin.runTask(d)}addRepresentation(t,n,r){var i=this;return ie(function*(){const o=i.dataState.build(),s=i.buildRepresentation(o,t,n,r);if(s)return yield o.commit(),s})()}buildRepresentation(t,n,r,i){var o,s;if(!n)return;const a=null===(s=null===(o=ls.resolveAndCheck(this.dataState,n))||void 0===o?void 0:o.obj)||void 0===s?void 0:s.data;if(!a)return;const c=QE(this.plugin,a,r);return i?.tag?t.to(n).applyOrUpdateTagged(i.tag,yE,c,{state:i?.initialState}).selector:t.to(n).apply(yE,c,{state:i?.initialState}).selector}constructor(t){this.plugin=t,this._providers=[],this.providerMap=new Map,this.defaultProvider=Mf.auto,$a(Mf,n=>this.registerPreset(n))}}function Om(e){return e}!function(e){e.CommonParams=(t,n)=>({modelProperties:C.Optional(C.Group(Qe.getParamDefinition(Ye.Model.CustomModelProperties,void 0,n))),structureProperties:C.Optional(C.Group(Qe.getParamDefinition(Ye.Model.CustomStructureProperties,void 0,n))),representationPreset:C.Optional(C.Text("auto"))})}(Om||(Om={}));const l3=Om.CommonParams,cfe=Om({id:"preset-trajectory-default",display:{name:"Default (Assembly)",group:"Preset",description:"Shows the first assembly or, if that is unavailable, the first model."},isApplicable:e=>!0,params:(e,t)=>({model:C.Optional(C.Group(Qe.getParamDefinition(Ye.Model.ModelFromTrajectory,e,t))),showUnitcell:C.Optional(C.Boolean(!1)),structure:C.Optional(b0.getParams(void 0,"assembly").type),representationPresetParams:C.Optional(C.Group(oa.CommonParams)),...l3(e,t)}),apply:(e,t,n)=>ie(function*(){const r=n.builders.structure,i=yield r.createModel(e,t.model),o=yield r.insertModelProperties(i,t.modelProperties),s=yield r.createStructure(o||i,t.structure),a=yield r.insertStructureProperties(s,t.structureProperties),c=void 0===t.showUnitcell||t.showUnitcell?yield r.tryCreateUnitcell(o,void 0,{isHidden:!0}):void 0,u=t.representationPreset||n.config.get(qi.Structure.DefaultRepresentationPreset)||Mf.auto.id;return{model:i,modelProperties:o,unitcell:c,structure:s,structureProperties:a,representation:yield n.builders.structure.representation.applyPreset(a,u,t.representationPresetParams)}})()}),ydt=Om({id:"preset-trajectory-all-models",display:{name:"All Models",group:"Preset",description:"Shows all models; colored by trajectory-index."},isApplicable:e=>e.data.frameCount>1,params:(e,t)=>({useDefaultIfSingleModel:C.Optional(C.Boolean(!1)),representationPresetParams:C.Optional(C.Group(oa.CommonParams)),...l3(e,t)}),apply:(e,t,n)=>ie(function*(){var r,i;const o=null===(i=null===(r=ls.resolveAndCheck(n.state.data,e))||void 0===r?void 0:r.obj)||void 0===i?void 0:i.data;if(!o)return{};if(1===o.frameCount&&t.useDefaultIfSingleModel)return cfe.apply(e,t,n);const s=n.builders.structure,a=[],c=[];for(let u=0;u({model:C.Optional(C.Group(Qe.getParamDefinition(Ye.Model.ModelFromTrajectory,e,t))),...l3(e,t)});function lfe(e,t,n,r){return uV.apply(this,arguments)}function uV(){return uV=ie(function*(e,t,n,r){const i=r.builders.structure,o=yield i.createModel(t,n.model),s=yield i.insertModelProperties(o,n.modelProperties),a=yield i.createStructure(s||o,{name:"symmetry",params:e}),c=yield i.insertStructureProperties(a,n.structureProperties),u=yield i.tryCreateUnitcell(s,void 0,{isHidden:!1}),l=n.representationPreset||r.config.get(qi.Structure.DefaultRepresentationPreset)||Mf.auto.id;return{model:o,modelProperties:s,unitcell:u,structure:a,structureProperties:c,representation:yield r.builders.structure.representation.applyPreset(c,l,{theme:{globalName:e.theme}})}}),uV.apply(this,arguments)}const bdt=Om({id:"preset-trajectory-unitcell",display:{name:"Unit Cell",group:"Preset",description:"Shows the fully populated unit cell."},isApplicable:e=>sn.hasCrystalSymmetry(e.data.representative),params:ufe,apply:(e,t,n)=>ie(function*(){return yield lfe({ijkMin:v.create(0,0,0),ijkMax:v.create(0,0,0)},e,t,n)})()}),vdt=Om({id:"preset-trajectory-supercell",display:{name:"Super Cell",group:"Preset",description:"Shows the super cell, i.e. the central unit cell and all adjacent unit cells."},isApplicable:e=>sn.hasCrystalSymmetry(e.data.representative),params:ufe,apply:(e,t,n)=>ie(function*(){return yield lfe({ijkMin:v.create(-1,-1,-1),ijkMax:v.create(1,1,1),theme:"operator-hkl"},e,t,n)})()}),_dt=Om({id:"preset-trajectory-crystal-contacts",display:{name:"Crystal Contacts",group:"Preset",description:"Showsasymetric unit and chains from neighbours within 5 \u212b, i.e., symmetry mates."},isApplicable:e=>sn.hasCrystalSymmetry(e.data.representative),params:(e,t)=>({model:C.Optional(C.Group(Qe.getParamDefinition(Ye.Model.ModelFromTrajectory,e,t))),...l3(e,t)}),apply:(e,t,n)=>ie(function*(){const r=n.builders.structure,i=yield r.createModel(e,t.model),o=yield r.insertModelProperties(i,t.modelProperties),s=yield r.createStructure(o||i,{name:"symmetry-mates",params:{radius:5}}),a=yield r.insertStructureProperties(s,t.structureProperties),c=yield r.tryCreateUnitcell(o,void 0,{isHidden:!0}),u=t.representationPreset||n.config.get(qi.Structure.DefaultRepresentationPreset)||Mf.auto.id;return{model:i,modelProperties:o,unitcell:c,structure:s,structureProperties:a,representation:yield n.builders.structure.representation.applyPreset(a,u,{theme:{globalName:"operator-name",carbonColor:"operator-name",focus:{name:"element-symbol",params:{carbonColor:{name:"operator-name",params:N6.defaultValues}}}}})}})()}),lV={default:cfe,"all-models":ydt,unitcell:bdt,supercell:vdt,crystalContacts:_dt};class xdt{resolveProvider(t){var n;return"string"==typeof t?null!==(n=lV[t])&&void 0!==n?n:cB(this._providers,r=>r.id===t):t}hasPreset(t){for(const n of this._providers)if(!n.isApplicable||n.isApplicable(t,this.plugin))return!0;return!1}get providers(){return this._providers}getPresets(t){if(!t)return this.providers;const n=[];for(const r of this._providers)r.isApplicable&&!r.isApplicable(t,this.plugin)||n.push(r);return n}getPresetSelect(t){const n=[];for(const r of this._providers)t&&r.isApplicable&&!r.isApplicable(t,this.plugin)||n.push([r.id,r.display.name]);return C.Select("auto",n)}getPresetsWithOptions(t){const n=[],r=Object.create(null);for(const i of this._providers)i.isApplicable&&!i.isApplicable(t,this.plugin)||(n.push([i.id,i.display.name]),r[i.id]=i.params?C.Group(i.params(t,this.plugin)):C.EmptyGroup());return 0===n.length?C.MappedStatic("",{"":C.EmptyGroup()}):C.MappedStatic(n[0][0],r,{options:n})}registerPreset(t){if(this.providerMap.has(t.id))throw new Error(`Hierarchy provider with id '${t.id}' already registered.`);this._providers.push(t),this.providerMap.set(t.id,t)}unregisterPreset(t){this.providerMap.delete(t.id),Xx(this._providers,t)}applyPreset(t,n,r){const i=this.resolveProvider(n);if(!i)return;const s=ls.resolveAndCheck(this.plugin.state.data,t);if(!s)return void(Qx||console.warn("Applying hierarchy preset provider to bad cell."));const a=r||(i.params?C.getDefaultValues(i.params(s.obj,this.plugin)):{}),c=Oe.create(`${i.display.name}`,()=>i.apply(s,a,this.plugin));return this.plugin.runTask(c)}constructor(t){this.plugin=t,this._providers=[],this.providerMap=new Map,this.defaultProvider=lV.default,$a(lV,n=>this.registerPreset(n))}}class Sdt{get dataState(){return this.plugin.state.data}parseTrajectoryData(t,n){var r=this;return ie(function*(){const i="string"==typeof n?r.plugin.dataFormats.get(n):n;if(!i)throw new Error(`'${n}' is not a supported data format.`);const{trajectory:o}=yield i.parse(r.plugin,t);return o})()}parseTrajectoryBlob(t,n){return this.dataState.build().to(t).apply(Ye.Data.ParseBlob,n,{state:{isGhost:!0}}).apply(Ye.Model.TrajectoryFromBlob,void 0).commit({revertOnError:!0})}parseTrajectory(t,n){const r=ls.resolveAndCheck(this.dataState,t);if(!r)throw new Error("Invalid data cell.");return pe.Data.Blob.is(r.obj)?this.parseTrajectoryBlob(t,n):this.parseTrajectoryData(t,n)}createModel(t,n,r){return this.dataState.build().to(t).apply(Ye.Model.ModelFromTrajectory,n||{modelIndex:0},{state:r}).commit({revertOnError:!0})}insertModelProperties(t,n,r){return this.dataState.build().to(t).apply(Ye.Model.CustomModelProperties,n,{state:r}).commit({revertOnError:!0})}tryCreateUnitcell(t,n,r){var i,o,s;const a=this.dataState,c=null===(o=null===(i=ls.resolveAndCheck(a,t))||void 0===i?void 0:i.obj)||void 0===o?void 0:o.data;if(!c)return;const u=null===(s=no.Provider.get(c))||void 0===s?void 0:s.spacegroup.cell;return ma.isZero(u)?void 0:a.build().to(t).apply(Ye.Representation.ModelUnitcell3D,n,{state:r}).commit({revertOnError:!0})}createStructure(t,n,r,i){var o;const s=this.dataState;if(!n){const c=ls.resolveAndCheck(s,t);if(c){const u=no.Provider.get(null===(o=c.obj)||void 0===o?void 0:o.data);(!u||0===u?.assemblies.length)&&(n={name:"model",params:{}})}}return s.build().to(t).apply(Ye.Model.StructureFromModel,{type:n||{name:"assembly",params:{}}},{state:r,tags:i}).commit({revertOnError:!0})}insertStructureProperties(t,n){return this.dataState.build().to(t).apply(Ye.Model.CustomStructureProperties,n).commit({revertOnError:!0})}isComponentTransform(t){return t.transform.transformer===Ye.Model.StructureComponent}tryCreateComponent(t,n,r,i){var o=this;return ie(function*(){var s,a;const c=o.dataState,u=c.build().to(t),l=`structure-component-${r}`,d=u.applyOrUpdateTagged(l,Ye.Model.StructureComponent,n,{tags:i?[...i,l]:[l]});yield d.commit();const f=d.selector;if(f.isOk&&0!==(null===(a=null===(s=f.cell)||void 0===s?void 0:s.obj)||void 0===a?void 0:a.data.elementCount))return f;yield c.build().delete(f.ref).commit()})()}tryCreateComponentFromExpression(t,n,r,i){return this.tryCreateComponent(t,{type:{name:"expression",params:n},nullIfEmpty:!0,label:(i?.label||"").trim()},r,i?.tags)}tryCreateComponentStatic(t,n,r){return this.tryCreateComponent(t,{type:{name:"static",params:n},nullIfEmpty:!0,label:(r?.label||"").trim()},`static-${n}`,r?.tags)}tryCreateComponentFromSelection(t,n,r,i){var o=this;return this.plugin.runTask(Oe.create("Query Component",function(){var s=ie(function*(a){var c,u;let{label:l,tags:d}=i||{};l=(l||"").trim();const f=null===(u=null===(c=ls.resolveAndCheck(o.dataState,t))||void 0===c?void 0:c.obj)||void 0===u?void 0:u.data;if(!f)return;const p=n.referencesCurrent?{type:{name:"bundle",params:Kn.fromSelection(yield n.getSelection(o.plugin,a,f))},nullIfEmpty:!0,label:l||n.label}:{type:{name:"expression",params:n.expression},nullIfEmpty:!0,label:l||n.label};return n.ensureCustomProperties&&(yield n.ensureCustomProperties({runtime:a,assetManager:o.plugin.managers.asset},f)),o.tryCreateComponent(t,p,r,d)});return function(a){return s.apply(this,arguments)}}()))}constructor(t){this.plugin=t,this.hierarchy=new xdt(this.plugin),this.representation=new gdt(this.plugin)}}function bC(e,t,n={}){return"string"==typeof n.type||"string"==typeof n.color||"string"==typeof n.size?function Cdt(e,t,n){const r=n.type&&e.representation.volume.registry.get(n.type)||e.representation.volume.registry.default.provider,i=n.color&&e.representation.volume.themes.colorThemeRegistry.get(n.color)||e.representation.volume.themes.colorThemeRegistry.get(r.defaultColorTheme.name),o=n.size&&e.representation.volume.themes.sizeThemeRegistry.get(n.size)||e.representation.volume.themes.sizeThemeRegistry.get(r.defaultSizeTheme.name);return dfe(e,t,{type:r,typeParams:n.typeParams,color:i,colorParams:n.colorParams,size:o,sizeParams:n.sizeParams})}(e,t||et.One,n):dfe(e,t||et.One,n)}function dfe(e,t,n={}){const{themes:r}=e.representation.volume,i={volume:t},o=n.type||e.representation.volume.registry.default.provider,s=C.getDefaultValues(o.getParams(r,t)),a=Object.assign(s,n.typeParams),c=n.color||r.colorThemeRegistry.get(o.defaultColorTheme.name),u=C.getDefaultValues(c.getParams(i));c.name===o.defaultColorTheme.name&&Object.assign(u,o.defaultColorTheme.props);const l=Object.assign(u,n.colorParams),d=n.size||r.sizeThemeRegistry.get(o.defaultSizeTheme.name),f=C.getDefaultValues(d.getParams(i));d.name===o.defaultSizeTheme.name&&Object.assign(f,o.defaultSizeTheme.props);const p=Object.assign(f,n.sizeParams);return{type:{name:o.name,params:a},colorTheme:{name:c.name,params:l},sizeTheme:{name:d.name,params:p}}}var dV,d3;!function(e){e.create=function t(n){const{name:r}=n;return{descriptor:n,get:i=>i._propertyData[r],set(i,o){i.customProperties.add(n),i._propertyData[r]=o}}}}(dV||(dV={})),function(e){e.Descriptor={name:"recommended_iso_value"},e.Provider=dV.create(e.Descriptor)}(d3||(d3={}));const l1="Volume";function vC(e,t){return fV.apply(this,arguments)}function fV(){return fV=ie(function*(e,t){if(!t)return;const{entryId:n}=t;return n&&n.toLowerCase().startsWith("emd")?e.runTask(Oe.create("Try Set Recommended IsoValue",function(){var r=ie(function*(i){try{const o=yield kde(e,i,n);d3.Provider.set(t,et.IsoValue.absolute(o))}catch(o){console.warn(o)}});return function(i){return r.apply(this,arguments)}}())):void 0}),fV.apply(this,arguments)}function ffe(e){const t=d3.Provider.get(e);if(t)return"relative"===t.kind?t:et.adjustedIsoValue(e,t.absoluteValue,"absolute")}function pV(e,t){return hV.apply(this,arguments)}function hV(){return hV=ie(function*(e,t){const n={},r=t.volume.data&&ffe(t.volume.data);return r&&(n.isoValue=r),[yield e.build().to(t.volume).apply(Ye.Representation.VolumeRepresentation3D,bC(e,t.volume.data,{type:"isosurface",typeParams:n})).commit()]}),hV.apply(this,arguments)}const wdt={label:"CCP4/MRC/MAP",description:"CCP4/MRC/MAP",category:l1,binaryExtensions:["ccp4","mrc","map"],parse:function(){var e=ie(function*(t,n,r){const i=t.build().to(n).apply(Ye.Data.ParseCcp4,{},{state:{isGhost:!0}}),o=i.apply(Ye.Volume.VolumeFromCcp4,{entryId:r?.entryId});return yield i.commit({revertOnError:!0}),yield vC(t,o.selector.data),{format:i.selector,volume:o.selector}});return function(n,r,i){return e.apply(this,arguments)}}(),visuals:pV},Adt={label:"DSN6/BRIX",description:"DSN6/BRIX",category:l1,binaryExtensions:["dsn6","brix"],parse:function(){var e=ie(function*(t,n,r){const i=t.build().to(n).apply(Ye.Data.ParseDsn6,{},{state:{isGhost:!0}}),o=i.apply(Ye.Volume.VolumeFromDsn6,{entryId:r?.entryId});return yield i.commit({revertOnError:!0}),yield vC(t,o.selector.data),{format:i.selector,volume:o.selector}});return function(n,r,i){return e.apply(this,arguments)}}(),visuals:pV},Idt={label:"DX",description:"DX",category:l1,stringExtensions:["dx"],binaryExtensions:["dxbin"],parse:function(){var e=ie(function*(t,n,r){const o=t.build().to(n).apply(Ye.Data.ParseDx,{},{state:{isGhost:!0}}).apply(Ye.Volume.VolumeFromDx,{entryId:r?.entryId});return yield o.commit({revertOnError:!0}),yield vC(t,o.selector.data),{volume:o.selector}});return function(n,r,i){return e.apply(this,arguments)}}(),visuals:pV},Tdt={label:"Cube",description:"Cube",category:l1,stringExtensions:["cub","cube"],parse:function(){var e=ie(function*(t,n,r){const i=t.build().to(n).apply(Ye.Data.ParseCube,{},{state:{isGhost:!0}}),o=i.apply(Ye.Volume.VolumeFromCube,{entryId:r?.entryId}),s=i.apply(Ye.Model.TrajectoryFromCube,void 0,{state:{isGhost:!0}}).apply(Ye.Model.ModelFromTrajectory).apply(Ye.Model.StructureFromModel);return yield i.commit({revertOnError:!0}),yield vC(t,o.selector.data),{format:i.selector,volume:o.selector,structure:s.selector}});return function(n,r,i){return e.apply(this,arguments)}}(),visuals:function(){var e=ie(function*(t,n){var r,i;const o=t.build(),s=[],a=null===(i=null===(r=n.volume.cell)||void 0===r?void 0:r.obj)||void 0===i?void 0:i.data;if(a&&et.isOrbitals(a)){const l=o.to(n.volume).apply(Ye.Representation.VolumeRepresentation3D,bC(t,a,{type:"isosurface",typeParams:{isoValue:et.IsoValue.relative(1),alpha:.4},color:"uniform",colorParams:{value:xn.blue}})),d=o.to(n.volume).apply(Ye.Representation.VolumeRepresentation3D,bC(t,a,{type:"isosurface",typeParams:{isoValue:et.IsoValue.relative(-1),alpha:.4},color:"uniform",colorParams:{value:xn.red}}));s.push(l.selector,d.selector)}else{const l=o.to(n.volume).apply(Ye.Representation.VolumeRepresentation3D,bC(t,a,{type:"isosurface",typeParams:{isoValue:et.IsoValue.relative(2),alpha:.4},color:"uniform",colorParams:{value:xn.grey}}));s.push(l.selector)}const c=yield t.builders.structure.representation.applyPreset(n.structure,"auto");yield o.commit();const u=[];return $a(c?.representations,l=>{l&&u.push(l)}),[...s,...u]});return function(n,r){return e.apply(this,arguments)}}()},Ddt={label:"DensityServer CIF",description:"DensityServer CIF",category:l1,stringExtensions:["cif"],binaryExtensions:["bcif"],isApplicable:(e,t)=>"dscif"===e3(e,t),parse:function(){var e=ie(function*(t,n,r){var i;const o=yield t.build().to(n).apply(Ye.Data.ParseCif).commit(),s=t.build().to(o),a=o.obj.data.blocks;if(0===a.length)throw new Error("no data blocks");const c=[];let u=0;for(const l of a){if("SERVER"===l.header.toUpperCase())continue;const d=Array.isArray(r?.entryId)?r?.entryId[u]:r?.entryId;(null===(i=l.categories.volume_data_3d_info)||void 0===i?void 0:i.rowCount)>0&&(c.push(s.apply(Ye.Volume.VolumeFromDensityServerCif,{blockHeader:l.header,entryId:d}).selector),u++)}yield s.commit();for(const l of c)yield vC(t,l.data);return{volumes:c}});return function(n,r,i){return e.apply(this,arguments)}}(),visuals:function(){var e=ie(function*(t,n){const{volumes:r}=n,i=t.build(),o=[];if(r.length>0){const s=r[0].data&&ffe(r[0].data)||et.IsoValue.relative(1.5);o[0]=i.to(r[0]).apply(Ye.Representation.VolumeRepresentation3D,Af.getDefaultParamsStatic(t,"isosurface",{isoValue:s,alpha:1},"uniform",{value:xn.teal})).selector}if(r.length>1){const s=Af.getDefaultParamsStatic(t,"isosurface",{isoValue:et.IsoValue.relative(3),alpha:.3},"uniform",{value:xn.green}),a=Af.getDefaultParamsStatic(t,"isosurface",{isoValue:et.IsoValue.relative(-3),alpha:.3},"uniform",{value:xn.red});o[o.length]=i.to(r[1]).apply(Ye.Representation.VolumeRepresentation3D,s).selector,o[o.length]=i.to(r[1]).apply(Ye.Representation.VolumeRepresentation3D,a).selector}return yield i.commit(),o});return function(n,r){return e.apply(this,arguments)}}()},Edt={label:"Segmentation CIF",description:"Segmentation CIF",category:l1,stringExtensions:["cif"],binaryExtensions:["bcif"],isApplicable:(e,t)=>"segcif"===e3(e,t),parse:function(){var e=ie(function*(t,n){var r;const i=yield t.build().to(n).apply(Ye.Data.ParseCif).commit(),o=t.build().to(i),s=i.obj.data.blocks;if(0===s.length)throw new Error("no data blocks");const a=[];for(const c of s)"SERVER"!==c.header.toUpperCase()&&(null===(r=c.categories.volume_data_3d_info)||void 0===r?void 0:r.rowCount)>0&&a.push(o.apply(Ye.Volume.VolumeFromSegmentationCif,{blockHeader:c.header}).selector);return yield o.commit(),{volumes:a}});return function(n,r){return e.apply(this,arguments)}}(),visuals:function(){var e=ie(function*(t,n){const{volumes:r}=n,i=t.build(),o=[];return r.length>0&&et.Segmentation.get(r[0].data)&&(o[o.length]=i.to(r[0]).apply(Ye.Representation.VolumeRepresentation3D,Af.getDefaultParams(t,"segment",r[0].data,{alpha:1,instanceGranularity:!0},"volume-segment",{})).selector),yield i.commit(),o});return function(n,r){return e.apply(this,arguments)}}()},Pdt=[["ccp4",wdt],["dsn6",Adt],["cube",Tdt],["dx",Idt],["dscif",Ddt],["segcif",Edt]],Mdt=[["ply",{label:"PLY",description:"PLY",category:"Shape",stringExtensions:["ply"],parse:function(){var e=ie(function*(t,n){const r=t.state.data.build().to(n).apply(Ye.Data.ParsePly,{},{state:{isGhost:!0}}),i=r.apply(Ye.Model.ShapeFromPly);return yield r.commit(),{format:r.selector,shape:i.selector}});return function(n,r){return e.apply(this,arguments)}}(),visuals:(e,t)=>e.state.data.build().to(t.shape).apply(Ye.Representation.ShapeRepresentation3D).commit()}]];class Rdt{get types(){return this._list.map(t=>[t.name,t.provider.label])}get extensions(){if(this._extensions)return this._extensions;const t=new Set;return this._list.forEach(({provider:n})=>{var r,i;null===(r=n.stringExtensions)||void 0===r||r.forEach(o=>t.add(o)),null===(i=n.binaryExtensions)||void 0===i||i.forEach(o=>t.add(o))}),this._extensions=t,t}get binaryExtensions(){if(this._binaryExtensions)return this._binaryExtensions;const t=new Set;return this._list.forEach(({provider:n})=>{var r;return null===(r=n.binaryExtensions)||void 0===r?void 0:r.forEach(i=>t.add(i))}),this._binaryExtensions=t,t}get options(){if(this._options)return this._options;const t=[];return this._list.forEach(({name:n,provider:r})=>t.push([n,r.label,r.category||""])),this._options=t,t}constructor(){this._list=[],this._map=new Map,this._extensions=void 0,this._binaryExtensions=void 0,this._options=void 0;for(const[t,n]of Pdt)this.add(t,n);for(const[t,n]of nut)this.add(t,n);for(const[t,n]of aut)this.add(t,n);for(const[t,n]of Mdt)this.add(t,n);for(const[t,n]of Tde)this.add(t,n)}_clear(){this._extensions=void 0,this._binaryExtensions=void 0,this._options=void 0}add(t,n){this._clear(),this._list.push({name:t,provider:n}),this._map.set(t,n)}remove(t){this._clear(),this._list.splice(this._list.findIndex(n=>n.name===t),1),this._map.delete(t)}auto(t,n){var r,i;for(let o=0,s=this.list.length;o[t.name,t.display.name]),{label:"Animation"})}),this._params}updateParams(t){if(this.isEmpty)return;this.updateState({params:{...this.state.params,...t}});const n=this.map.get(this.state.params.current),r=n.params(this.context);this._current={anim:n,params:r,paramValues:C.getDefaultValues(r),state:{},startedTime:-1,lastTime:0},this.triggerUpdate()}updateCurrentParams(t){this.isEmpty||(this._current.paramValues={...this._current.paramValues,...t},this.triggerUpdate())}register(t){this.map.has(t.name)?this.context.log.error(`Animation '${t.name}' is already registered.`):(this._params=void 0,this.map.set(t.name,t),this._animations.push(t),1===this._animations.length?this.updateParams({current:t.name}):this.triggerUpdate())}play(t,n){var r=this;return ie(function*(){yield r.stop(),r.map.has(t.name)||r.register(t),r.updateParams({current:t.name}),r.updateCurrentParams(n),yield r.start()})()}tick(t,n,r){var i=this;return ie(function*(){i.currentTime=t,!i.isStopped&&(n||r?yield i.applyFrame(r):i.applyAsync())})()}start(){var t=this;return ie(function*(){t.updateState({animationState:"playing"}),t.context.behaviors.state.isAnimating.value||t.context.behaviors.state.isAnimating.next(!0),t.triggerUpdate();const n=t._current.anim;let r=t._current.anim.initialState(t._current.paramValues,t.context);if(n.setup){const i=yield n.setup(t._current.paramValues,r,t.context);i&&(r=i)}t._current.lastTime=0,t._current.startedTime=-1,t._current.state=r,t.isStopped=!1})()}stop(){var t=this;return ie(function*(){if(t.isStopped=!0,"stopped"!==t.state.animationState){const n=t._current.anim;n.teardown&&(yield n.teardown(t._current.paramValues,t._current.state,t.context)),t.updateState({animationState:"stopped"}),t.triggerUpdate()}t.context.behaviors.state.isAnimating.value&&t.context.behaviors.state.isAnimating.next(!1)})()}get isAnimating(){return"playing"===this.state.animationState}applyAsync(){var t=this;return ie(function*(){if(!t.isApplying){t.isApplying=!0;try{yield t.applyFrame()}finally{t.isApplying=!1}}})()}applyFrame(t){var n=this;return ie(function*(){const r=n.currentTime;n._current.startedTime<0&&(n._current.startedTime=r);const i=yield n._current.anim.apply(n._current.state,{lastApplied:n._current.lastTime,current:r-n._current.startedTime,animation:t},{params:n._current.paramValues,plugin:n.context});"finished"===i.kind?n.stop():"next"===i.kind&&(n._current.state=i.state,n._current.lastTime=r-n._current.startedTime),n.triggerApply()})()}getSnapshot(){return this.current?{state:this.state,current:{paramValues:this._current.paramValues,state:this._current.anim.stateSerialization?this._current.anim.stateSerialization.toJSON(this._current.state):this._current.state}}:{state:this.state}}setSnapshot(t){this.isEmpty||(this.updateState({animationState:t.state.animationState}),this.updateParams(t.state.params),t.current&&(this.current.paramValues=t.current.paramValues,this.current.state=this._current.anim.stateSerialization?this._current.anim.stateSerialization.fromJSON(t.current.state):t.current.state,this.triggerUpdate(),"playing"===this.state.animationState&&this.resume()))}resume(){var t=this;return ie(function*(){t._current.lastTime=0,t._current.startedTime=-1;const n=t._current.anim;t.context.behaviors.state.isAnimating.value||t.context.behaviors.state.isAnimating.next(!0),n.setup&&(yield n.setup(t._current.paramValues,t._current.state,t.context)),t.isStopped=!1})()}constructor(t){super({params:{current:""},animationState:"stopped"}),this.context=t,this.map=new Map,this._animations=[],this.currentTime=0,this._params=void 0,this.events={updated:this.ev(),applied:this.ev()},this.isStopped=!0,this.isApplying=!1}}function pfe(e,t,n){const r=n[0],i=n[1],o=n[2];return(r*e[0]+i*e[1]+o*e[2]+(-r*t[0]-i*t[1]-o*t[2]))/Math.sqrt(r*r+i*i+o*o)}const Rf={identity:Kt.create(1,0,0,0,1,0,0,0,1),rotX90:Kt.create(1,0,0,0,0,1,0,-1,0),rotY90:Kt.create(0,0,-1,0,1,0,1,0,0),rotZ90:Kt.create(0,1,0,-1,0,0,0,0,1),rotX270:Kt.create(1,0,0,0,0,-1,0,1,0),rotY270:Kt.create(0,0,1,0,1,0,-1,0,0),rotZ270:Kt.create(0,-1,0,1,0,0,0,0,1),rotX180:Kt.create(1,0,0,0,-1,0,0,0,-1),rotY180:Kt.create(-1,0,0,0,1,0,0,0,-1),rotZ180:Kt.create(-1,0,0,0,-1,0,0,0,1)};function mV(e,t){const{onlyTrace:n,skipHydrogens:r,skipWater:i}=t,{x:o,y:s,z:a,type_symbol:c,label_comp_id:u}=Ze.atom,l=[];for(const d of e){const f=nt.create(d);for(const p of d.units){f.unit=p;const m=n?p.polymerElements:p.elements;for(let h=0;hi,n)}focusLoci(t,n){let r;if(Array.isArray(t)&&t.length>1){const i=[];for(const o of t){const s=pn.getBoundingSphere(this.transformedLoci(o));s&&i.push(s)}if(0===i.length)return;this.boundaryHelper.reset();for(const o of i)this.boundaryHelper.includeSphere(o);this.boundaryHelper.finishedIncludeStep();for(const o of i)this.boundaryHelper.radiusSphere(o);r=this.boundaryHelper.getSphere()}else if(Array.isArray(t)){if(0===t.length)return;r=pn.getBoundingSphere(this.transformedLoci(t[0]))}else r=pn.getBoundingSphere(this.transformedLoci(t));r&&this.focusSphere(r,n)}focusSpheres(t,n,r){const i=[];for(const o of t){const s=n(o);s&&i.push(s)}if(0!==i.length){if(1===i.length)return this.focusSphere(i[0],r);this.boundaryHelper.reset();for(const o of i)this.boundaryHelper.includeSphere(o);this.boundaryHelper.finishedIncludeStep();for(const o of i)this.boundaryHelper.radiusSphere(o);this.focusSphere(this.boundaryHelper.getSphere(),r)}}focusSphere(t,n){var r;const{canvas3d:i}=this.plugin;if(!i)return;const{extraRadius:o,minRadius:s,durationMs:a}={...$dt,...n},c=Math.max(t.radius+o,s);if(n?.principalAxes){const u=function Odt(e,t,n){if(!e.canvas3d)return;const{origin:r,dirA:i,dirB:o,dirC:s}=n.principalAxes.boxAxes,a=v.clone(i),c=v.clone(s);if(n.positionToFlip){const{aroundX:l,aroundY:d}=function Fdt(e,t,n,r){const i=pfe(e,t,r);return{aroundX:pfe(e,t,n)<0,aroundY:i<0}}(n.positionToFlip,r,a,o);l&&(v.negate(c,c),v.negate(a,a)),d&&v.negate(c,c)}const u=v.scale(v(),r,-100);return v.dot(u,a)<=0&&v.negate(c,c),v.dot(v.unitY,c)<=0&&v.negate(a,a),e.canvas3d.camera.getFocus(r,t,a,c,gr.createDefaultSnapshot())}(this.plugin,c,n);null===(r=this.plugin.canvas3d)||void 0===r||r.requestCameraReset({durationMs:a,snapshot:u})}else{const u=i.camera.getFocus(t.center,c);i.requestCameraReset({durationMs:a,snapshot:u})}}orientAxes(t,n){if(!this.plugin.canvas3d)return;t||(t=this.plugin.state.data.selectQ(a=>a.ofType(pe.Molecule.Structure)).filter(a=>a.obj&&!a.transform.transformer.definition.isDecorator&&!a.obj.data.parent).map(a=>{var c;return null===(c=a.obj)||void 0===c?void 0:c.data}).filter(a=>!!a));const{rotation:r}=function Udt(e,t){const n=function zdt(e,t){let n;return n=mV(e,{onlyTrace:!0}),n.length>=3*t||(n=mV(e,{skipHydrogens:!0,skipWater:!0}),n.length>=3*t)||(n=mV(e,{})),n}(e,3);return function Vdt(e,t){if(0===e.length)return console.warn("Skipping PCA, no atoms"),{rotation:Rf.identity,origin:v.zero()};const n=nd.calculateMomentsAxes(e),r=nd.calculateNormalizedAxes(n),i=function qdt(e,t,n){const r=Kt();return Kt.setValue(r,0,0,e[0]),Kt.setValue(r,0,1,e[1]),Kt.setValue(r,0,2,e[2]),Kt.setValue(r,1,0,t[0]),Kt.setValue(r,1,1,t[1]),Kt.setValue(r,1,2,t[2]),Kt.setValue(r,2,0,n[0]),Kt.setValue(r,2,1,n[1]),Kt.setValue(r,2,2,n[2]),r}(r.dirA,r.dirB,r.dirC);!function Wdt(e){Kt.determinant(e)<0&&(Kt.setValue(e,2,0,-Kt.getValue(e,2,0)),Kt.setValue(e,2,1,-Kt.getValue(e,2,1)),Kt.setValue(e,2,2,-Kt.getValue(e,2,2)))}(i);const o=t?function Gdt(e,t){let n=Rf.identity,r=0;const i=Kt();for(const o of[Rf.identity,Rf.rotX180,Rf.rotY180,Rf.rotZ180]){const s=Kt.innerProduct(Kt.mul(i,o,e),t);s>r&&(n=o,r=s)}return n}(i,t):function jdt(e,t,n){const r=v.create(Kt.getValue(t,0,0),Kt.getValue(t,0,1),Kt.getValue(t,0,2)),i=v.create(Kt.getValue(t,1,0),Kt.getValue(t,1,1),Kt.getValue(t,1,2)),o=v.create(Kt.getValue(t,2,0),Kt.getValue(t,2,1),Kt.getValue(t,2,2)),s=Math.floor(e.length/3),a=v();let c=0,u=0,l=0;for(let p=0;ps!==o)}normalizedLoci(o,s,a=!1){const{loci:c,repr:u}=o;return{loci:pn.normalize(c,s?this.props.granularity:void 0,a),repr:u}}mark(o,s,a=!1){if(!pn.isEmpty(o.loci))for(const c of this.providers)c(o,s,a)}dispose(){this.providers.length=0,this.sel.dispose()}constructor(o,s={}){this.ctx=o,this.providers=[],this.props=C.getDefaultValues(e.Params),this.sel=o.managers.structure.selection,this.setProps(s)}}e.LociMarkManager=t,e.LociHighlightManager=class n extends t{constructor(){super(...arguments),this.prev=[],this.clearHighlights=(o=!1)=>{for(const s of this.prev)this.mark(s,Bt.RemoveHighlight,o);this.prev.length=0}}isHighlighted(o){for(const s of this.prev)if(yn.Loci.areEqual(s,o))return!0;return!1}addHighlight(o){this.mark(o,Bt.Highlight),this.prev.push(o)}highlight(o,s=!0){const a=this.normalizedLoci(o,s);this.isHighlighted(a)||this.addHighlight(a)}highlightOnly(o,s=!0){const a=this.normalizedLoci(o,s);this.isHighlighted(a)||(pn.isEmpty(a.loci)?this.clearHighlights():(this.clearHighlights(!0),this.addHighlight(a)))}highlightOnlyExtend(o,s=!0){const a=this.normalizedLoci(o,s);if(De.is(a.loci)){const c={loci:this.sel.tryGetRange(a.loci)||a.loci,repr:a.repr};this.isHighlighted(c)||(pn.isEmpty(c.loci)?this.clearHighlights():(this.clearHighlights(!0),this.addHighlight(c)))}}dispose(){super.dispose(),this.prev.length=0}},e.LociSelectManager=class r extends t{toggle(o,s=!0){if(pn.isEmpty(o.loci))return;const a=this.normalizedLoci(o,s,!0);De.is(a.loci)?this.toggleSel(a):super.mark(a,Bt.Toggle)}toggleExtend(o,s=!0){if(pn.isEmpty(o.loci))return;const a=this.normalizedLoci(o,s,!0);if(De.is(a.loci)){const c=this.sel.tryGetRange(a.loci)||a.loci;this.toggleSel({loci:c,repr:a.repr})}}select(o,s=!0){const a=this.normalizedLoci(o,s,!0);De.is(a.loci)&&this.sel.modify("add",a.loci),this.mark(a,Bt.Select)}selectJoin(o,s=!0){const a=this.normalizedLoci(o,s,!0);De.is(a.loci)&&this.sel.modify("intersect",a.loci),this.mark(a,Bt.Select)}selectOnly(o,s=!0){const a=this.normalizedLoci(o,s,!0);De.is(a.loci)&&(this.mark({loci:Ve.Loci(a.loci.structure),repr:a.repr},Bt.Deselect),this.sel.modify("set",a.loci)),this.mark(a,Bt.Select)}deselect(o,s=!0){const a=this.normalizedLoci(o,s,!0);De.is(a.loci)&&this.sel.modify("remove",a.loci),this.mark(a,Bt.Deselect)}deselectAll(){this.sel.clear(),this.mark({loci:JD},Bt.Deselect)}deselectAllOnEmpty(o){Ta(o.loci)&&this.deselectAll()}mark(o,s){const{loci:a}=o;if(!pn.isEmpty(a))if(De.is(a)){const c=this.sel.getLoci(a.structure);super.mark({loci:Ve.Loci(a.structure)},Bt.Deselect,!pn.isEmpty(c)),super.mark({loci:c},Bt.Select)}else super.mark(o,s)}toggleSel(o){this.sel.has(o.loci)?(this.sel.modify("remove",o.loci),this.mark(o,Bt.Deselect)):(this.sel.modify("add",o.loci),this.mark(o,Bt.Select))}}}(Lm||(Lm={}));class Xdt{clearProviders(){this.providers=[],this.isDirty=!0,this.showLabels()}addProvider(t){this.providers.push(t),this.providers.sort((n,r)=>(r.priority||0)-(n.priority||0)),this.isDirty=!0,this.showLabels()}removeProvider(t){this.providers=this.providers.filter(n=>n!==t),this.isDirty=!0,this.showLabels()}mark(t,n){const r=this.locis.findIndex(i=>yn.Loci.areEqual(t,i));-1===r&&n===Bt.Highlight?(this.locis.push(t),this.isDirty=!0):-1!==r&&n===Bt.RemoveHighlight&&(Kx(this.locis,r),this.isDirty=!0)}showLabels(){this.ctx.behaviors.labels.highlight.next({labels:this.getLabels()})}getLabels(){if(this.isDirty){this.groupedLabels.clear(),this.labels.length=0;for(const t of this.providers)for(const n of this.locis){if(pn.isEmpty(n.loci))continue;const r=t.label(n.loci,n.repr);if(r){const i=t.group?t.group(r):r.toString(),o=this.groupedLabels.get(i);o?o.push(r):this.groupedLabels.set(i,[r])}}this.labels.length=0,this.groupedLabels.forEach((t,n)=>{const r=t.length,i=r>1&&t[0]!==t[1]?n:t[0];this.labels.push(1===r?i:`${i} || \xd7 ${r}`)}),this.isDirty=!1}return this.labels}constructor(t){this.ctx=t,this.providers=[],this.locis=[],this.isDirty=!1,this.labels=[],this.groupedLabels=new Map,t.managers.interactivity.lociHighlights.addProvider((n,r,i)=>{0!==this.providers.length&&(this.mark(n,r),i||this.showLabels())})}}const mfe="overpaint-controls";function gfe(e,t,n,r,i){return gV.apply(this,arguments)}function gV(){return gV=ie(function*(e,t,n,r,i){yield function yfe(e,t,n){return bV.apply(this,arguments)}(e,t,function(){var o=ie(function*(s,a,c){if(i&&i.length>0&&!i.includes(a.params.values.type.name))return;const u=a.obj.data.sourceData,l=yield r(u.root);if(pn.isEmpty(l)||Ta(l))return;const d={bundle:Kn.fromLoci(l),color:-1===n?st(0):n,clear:-1===n};if(c){const p=bfe([...c.params.values.layers,d],u);s.to(c).update(Bo.toBundle(p))}else{const f=bfe([d],u);s.to(a.transform.ref).apply(Ye.Representation.OverpaintStructureRepresentation3DFromBundle,Bo.toBundle(f),{tags:mfe})}});return function(s,a,c){return o.apply(this,arguments)}}())}),gV.apply(this,arguments)}function bV(){return bV=ie(function*(e,t,n){const r=e.state.data,i=r.build();for(const o of t)for(const s of o.representations){const a=r.select(In.Generators.ofTransformer(Ye.Representation.OverpaintStructureRepresentation3DFromBundle,s.cell.transform.ref).withTag(mfe));yield n(i,s.cell,a[0])}return i.commit({doNotUpdateCurrent:!0})}),bV.apply(this,arguments)}function bfe(e,t){const n=Bo.ofBundle(e,t.root),r=Bo.merge(n);return Bo.filter(r,t)}const vfe="clipping-controls";function Kdt(e,t,n,r,i){return vV.apply(this,arguments)}function vV(){return vV=ie(function*(e,t,n,r,i){yield function Zdt(e,t,n){return _V.apply(this,arguments)}(e,t,function(){var o=ie(function*(s,a,c){if(i&&i.length>0&&!i.includes(a.params.values.type.name))return;const u=a.obj.data.sourceData,l=yield r(u.root);if(pn.isEmpty(l)||Ta(l))return;const d={bundle:Kn.fromLoci(l),groups:n};if(c){const p=_fe([...c.params.values.layers,d],u);s.to(c).update(Yr.toBundle(p))}else{const f=_fe([d],u);s.to(a.transform.ref).apply(Ye.Representation.ClippingStructureRepresentation3DFromBundle,Yr.toBundle(f),{tags:vfe})}});return function(s,a,c){return o.apply(this,arguments)}}())}),vV.apply(this,arguments)}function _V(){return _V=ie(function*(e,t,n){const r=e.state.data,i=r.build();for(const o of t)for(const s of o.representations){const a=r.select(In.Generators.ofTransformer(Ye.Representation.ClippingStructureRepresentation3DFromBundle,s.cell.transform.ref).withTag(vfe));yield n(i,s.cell,a[0])}return i.commit({doNotUpdateCurrent:!0})}),_V.apply(this,arguments)}function _fe(e,t){const n=Yr.ofBundle(e,t.root),r=Yr.merge(n);return Yr.filter(r,t)}const xfe="transparency-controls";function Qdt(e,t,n,r,i){return xV.apply(this,arguments)}function xV(){return xV=ie(function*(e,t,n,r,i){yield function Sfe(e,t,n){return CV.apply(this,arguments)}(e,t,function(){var o=ie(function*(s,a,c){if(i&&i.length>0&&!i.includes(a.params.values.type.name))return;const u=a.obj.data.sourceData,l=yield r(u.root);if(pn.isEmpty(l)||Ta(l))return;const d={bundle:Kn.fromLoci(l),value:n};if(c){const p=Cfe([...c.params.values.layers,d],u);s.to(c).update(Vs.toBundle(p))}else{const f=Cfe([d],u);s.to(a.transform.ref).apply(Ye.Representation.TransparencyStructureRepresentation3DFromBundle,Vs.toBundle(f),{tags:xfe})}});return function(s,a,c){return o.apply(this,arguments)}}())}),xV.apply(this,arguments)}function CV(){return CV=ie(function*(e,t,n){const r=e.state.data,i=r.build();for(const o of t)for(const s of o.representations){const a=r.select(In.Generators.ofTransformer(Ye.Representation.TransparencyStructureRepresentation3DFromBundle,s.cell.transform.ref).withTag(xfe));yield n(i,s.cell,a[0])}return i.commit({doNotUpdateCurrent:!0})}),CV.apply(this,arguments)}function Cfe(e,t){const n=Vs.ofBundle(e,t.root),r=Vs.merge(n);return Vs.filter(r,t)}const wfe="substance-controls";function Afe(e,t,n,r,i){return wV.apply(this,arguments)}function wV(){return wV=ie(function*(e,t,n,r,i){yield function Ife(e,t,n){return IV.apply(this,arguments)}(e,t,function(){var o=ie(function*(s,a,c){if(i&&i.length>0&&!i.includes(a.params.values.type.name))return;const u=a.obj.data.sourceData,l=yield r(u.root);if(pn.isEmpty(l)||Ta(l))return;const d={bundle:Kn.fromLoci(l),material:n??ba(),clear:!n};if(c){const p=Tfe([...c.params.values.layers,d],u);s.to(c).update(zs.toBundle(p))}else{const f=Tfe([d],u);s.to(a.transform.ref).apply(Ye.Representation.SubstanceStructureRepresentation3DFromBundle,zs.toBundle(f),{tags:wfe})}});return function(s,a,c){return o.apply(this,arguments)}}())}),wV.apply(this,arguments)}function IV(){return IV=ie(function*(e,t,n){const r=e.state.data,i=r.build();for(const o of t)for(const s of o.representations){const a=r.select(In.Generators.ofTransformer(Ye.Representation.SubstanceStructureRepresentation3DFromBundle,s.cell.transform.ref).withTag(wfe));yield n(i,s.cell,a[0])}return i.commit({doNotUpdateCurrent:!0})}),IV.apply(this,arguments)}function Tfe(e,t){const n=zs.ofBundle(e,t.root),r=zs.merge(n);return zs.filter(r,t)}class _C extends th{get currentStructures(){return this.plugin.managers.structure.hierarchy.selection.structures}get pivotStructure(){return this.currentStructures[0]}_setSnapshotState(t){this.updateState({options:t}),this.events.optionsUpdated.next(void 0)}setOptions(t){var n=this;return ie(function*(){const r=t.interactions!==n.state.options.interactions;n.updateState({options:t}),n.events.optionsUpdated.next(void 0);const i=n.dataState.build();for(const o of n.currentStructures)for(const s of o.components)n.updateReprParams(i,s);return n.plugin.dataTransaction(ie(function*(){yield i.commit(),yield n.plugin.state.updateBehavior(JE,o=>{o.ignoreHydrogens="all"!==t.hydrogens,o.ignoreHydrogensVariant="only-polar"===t.hydrogens?"non-polar":"all",o.ignoreLight=t.ignoreLight,o.material=t.materialStyle,o.clip=t.clipObjects}),r&&(yield n.updateInterationProps())}))})()}updateReprParams(t,n){const{hydrogens:r,visualQuality:i,ignoreLight:o,materialStyle:s,clipObjects:a}=this.state.options,c="all"!==r,u="only-polar"===r?"non-polar":"all";for(const l of n.representations){if(l.cell.transform.transformer!==yE)continue;const d=l.cell.transform.params;(!!d.type.params.ignoreHydrogens!==c||d.type.params.ignoreHydrogensVariant!==u||d.type.params.quality!==i||d.type.params.ignoreLight!==o||!Hx(d.type.params.material,s)||!C.areEqual(gm.Params,d.type.params.clip,a))&&t.to(l.cell).update(f=>{f.type.params.ignoreHydrogens=c,f.type.params.ignoreHydrogensVariant=u,f.type.params.quality=i,f.type.params.ignoreLight=o,f.type.params.material=s,f.type.params.clip=a})}}updateInterationProps(){var t=this;return ie(function*(){var n,r,i;for(const o of t.currentStructures){const s=Qi.getParams(null===(n=o.cell.obj)||void 0===n?void 0:n.data);if(o.properties){const a=null===(r=o.properties.cell.transform.params)||void 0===r?void 0:r.properties[Qi.descriptor.name];if(C.areEqual(s,a,t.state.options.interactions))continue;yield t.dataState.build().to(o.properties.cell).update(c=>{c.properties[Qi.descriptor.name]=t.state.options.interactions}).commit()}else{const a=t.plugin.customStructureProperties.getParams(null===(i=o.cell.obj)||void 0===i?void 0:i.data),c=C.getDefaultValues(a);if(C.areEqual(s,c.properties[Qi.descriptor.name],t.state.options.interactions))continue;c.properties[Qi.descriptor.name]=t.state.options.interactions,yield t.plugin.builders.structure.insertStructureProperties(o.cell,c)}}})()}applyPreset(t,n,r){var i=this;return this.plugin.dataTransaction(ie(function*(){for(const o of t){const s=yield i.plugin.builders.structure.representation.applyPreset(o.cell,n,r);yield i.syncPreset(o,s)}}),{canUndo:"Preset"})}syncPreset(t,n){if(!n||!n.components)return this.clearComponents([t]);const r=new Set;if($a(n.components,a=>{a&&r.add(a.ref)}),n.representations&&$a(n.representations,a=>{a&&r.add(a.ref)}),0===r.size)return this.clearComponents([t]);let i=!1;const o=this.dataState.build(),s=a=>{r.has(a.cell.transform.ref)||(i=!0,o.delete(a.cell))};for(const a of t.components){s(a);for(const c of a.representations)s(c);if(a.genericRepresentations)for(const c of a.genericRepresentations)s(c)}if(t.genericRepresentations)for(const a of t.genericRepresentations)s(a);return i?o.commit():void 0}clear(t){return this.clearComponents(t)}selectThis(t){var n;const r=this.plugin.managers.structure.selection;r.clear();for(const i of t){const o=Ve.toSubStructureElementLoci(i.structure.cell.obj.data,null===(n=i.cell.obj)||void 0===n?void 0:n.data);r.fromLoci("set",o)}}canBeModified(t){return this.plugin.builders.structure.isComponentTransform(t.cell)}modifyByCurrentSelection(t,n){var r=this;return this.plugin.runTask(Oe.create("Modify Component",function(){var i=ie(function*(o){const s=r.dataState.build();for(const a of t){if(!r.canBeModified(a))continue;const c=r.plugin.managers.structure.selection.getStructure(a.structure.cell.obj.data);!c||0===c.elementCount||r.modifyComponent(s,a,c,n)}yield r.dataState.updateTree(s,{canUndo:"Modify Selection"}).runInContext(o)});return function(o){return i.apply(this,arguments)}}()))}toggleVisibility(t,n){if(0!==t.length)if(n){const r=t[0].representations.indexOf(n),i=!n.cell.state.isHidden;for(const o of t){const s=o.representations[r];s&&Wv(this.dataState,s.cell.transform.ref,i)}}else{const r=!t[0].cell.state.isHidden;for(const i of t)Wv(this.dataState,i.cell.transform.ref,r)}}removeRepresentations(t,n){if(0===t.length)return;const r=[];if(n){const i=t[0].representations.indexOf(n);if(i<0)return;for(const o of t)o.representations[i]&&r.push(o.representations[i])}else for(const i of t)for(const o of i.representations)r.push(o);return this.plugin.managers.structure.hierarchy.remove(r,!0)}updateRepresentations(t,n,r){if(0===t.length)return Promise.resolve();const i=t[0].representations.indexOf(n);if(i<0)return Promise.resolve();const o=this.dataState.build();for(const s of t){const a=s.representations[i];a&&a.cell.transform.transformer===n.cell.transform.transformer&&o.to(a.cell).update(r)}return o.commit({canUndo:"Update Representation"})}updateRepresentationsTheme(t,n){var r,i,o,s;if(0===t.length)return;const a=this.dataState.build();for(const c of t)for(const u of c.representations){const l=u.cell.transform.params,d="function"==typeof n?n(c,u):n,f="default"===d.color?MU(this.plugin,null===(r=c.structure.cell.obj)||void 0===r?void 0:r.data,l?.type.name):d.color?MU(this.plugin,null===(i=c.structure.cell.obj)||void 0===i?void 0:i.data,l?.type.name,d.color,d.colorParams):void 0,p="default"===d.size?vde(this.plugin,null===(o=c.structure.cell.obj)||void 0===o?void 0:o.data,l?.type.name):d.color?vde(this.plugin,null===(s=c.structure.cell.obj)||void 0===s?void 0:s.data,l?.type.name,d.size,d.sizeParams):void 0;(f||p)&&a.to(u.cell).update(m=>{f&&(m.colorTheme=f),p&&(m.sizeTheme=p)})}return a.commit({canUndo:"Update Theme"})}addRepresentation(t,n){var r=this;if(0===t.length)return;const{hydrogens:i,visualQuality:o,ignoreLight:s,materialStyle:a,clipObjects:c}=this.state.options,d={ignoreHydrogens:"all"!==i,ignoreHydrogensVariant:"only-polar"===i?"non-polar":"all",quality:o,ignoreLight:s,material:a,clip:c};return this.plugin.dataTransaction(ie(function*(){for(const f of t)yield r.plugin.builders.structure.representation.addRepresentation(f.cell,{type:r.plugin.representation.structure.registry.get(n),typeParams:d})}),{canUndo:"Add Representation"})}tryFindComponent(t,n){var r=this;if(0!==t.components.length)return this.plugin.runTask(Oe.create("Find Component",function(){var i=ie(function*(o){var s,a;const c=null===(s=t.cell.obj)||void 0===s?void 0:s.data;if(!c)return;const u=pt.unionStructure(yield n.getSelection(r.plugin,o,c));for(const l of t.components){const d=null===(a=l.cell.obj)||void 0===a?void 0:a.data;if(d&&l.cell.parent&&vOe(u,d))return l.cell}});return function(o){return i.apply(this,arguments)}}()))}add(t,n){var r=this;return ie(function*(){return r.plugin.dataTransaction(ie(function*(){const i=n||r.currentStructures;if(0===i.length)return;const{hydrogens:o,visualQuality:s,ignoreLight:a,materialStyle:c,clipObjects:u}=r.state.options,f={ignoreHydrogens:"all"!==o,ignoreHydrogensVariant:"only-polar"===o?"non-polar":"all",quality:s,ignoreLight:a,material:c,clip:u},p=Hr.create22();for(const m of i){let h;t.options.checkExisting&&(h=yield r.tryFindComponent(m,t.selection)),h||(h=yield r.plugin.builders.structure.tryCreateComponentFromSelection(m.cell,t.selection,p,{label:t.options.label||(t.selection===No.current?"Custom Selection":"")})),"none"!==t.representation&&h&&(yield r.plugin.builders.structure.representation.addRepresentation(h,{type:r.plugin.representation.structure.registry.get(t.representation),typeParams:f}))}}),{canUndo:"Add Selection"})})()}applyTheme(t,n){var r=this;return ie(function*(){return r.plugin.dataTransaction(function(){var i=ie(function*(o){const s=n||r.currentStructures;if(0===s.length)return;const a=function(){var c=ie(function*(u){return pt.toLociWithSourceUnits(yield t.selection.getSelection(r.plugin,o,u))});return function(l){return c.apply(this,arguments)}}();for(const c of s)if("color"===t.action.name){const u=t.action.params;yield gfe(r.plugin,c.components,u.color,a,t.representations)}else if("resetColor"===t.action.name)yield gfe(r.plugin,c.components,-1,a,t.representations);else if("transparency"===t.action.name){const u=t.action.params;yield Qdt(r.plugin,c.components,u.value,a,t.representations)}else if("material"===t.action.name){const u=t.action.params;yield Afe(r.plugin,c.components,u.material,a,t.representations)}else if("resetMaterial"===t.action.name)yield Afe(r.plugin,c.components,void 0,a,t.representations);else if("clipping"===t.action.name){const u=t.action.params;yield Kdt(r.plugin,c.components,Yr.Groups.fromNames(u.excludeGroups),a,t.representations)}});return function(o){return i.apply(this,arguments)}}(),{canUndo:"Apply Theme"})})()}modifyComponent(t,n,r,i){var o,s,a;const c=null===(o=n.cell.obj)||void 0===o?void 0:o.data;if(!c||("subtract"===i||"intersect"===i)&&!fT(c,r))return;const u=null===(s=n.structure.cell.obj)||void 0===s?void 0:s.data,l="union"===i?m2(u,[c,r]):"intersect"===i?NJ(c,r):YB(c,r);if(0===l.elementCount)t.delete(n.cell.transform.ref);else{const f={type:{name:"bundle",params:Kn.fromSubStructure(u,l)},nullIfEmpty:!0,label:null===(a=n.cell.obj)||void 0===a?void 0:a.label};t.to(n.cell).update(f)}}updateLabel(t,n){var r,i;const o={type:null===(r=t.cell.params)||void 0===r?void 0:r.values.type,nullIfEmpty:null===(i=t.cell.params)||void 0===i?void 0:i.values.nullIfEmpty,label:n};this.dataState.build().to(t.cell).update(o).commit()}get dataState(){return this.plugin.state.data}clearComponents(t){const n=this.dataState.build();for(const r of t)for(const i of r.components)n.delete(i.cell.transform.ref);return n.commit({canUndo:"Clear Selections"})}constructor(t){super({options:C.getDefaultValues(_C.OptionsParams)}),this.plugin=t,this.events={optionsUpdated:this.ev()}}}!function(e){function r(o,s){var a,c;return null!==(a=s?.cell.obj)&&void 0!==a&&a.data?o.representation.structure.registry.getApplicableTypes(null===(c=s.cell.obj)||void 0===c?void 0:c.data):o.representation.structure.registry.types}function i(o,s,a,c){const u=[...a,...r(o,s)];return C.Select(u[0][0],u,{label:c})}e.OptionsParams={hydrogens:C.Select("all",[["all","Show All"],["hide-all","Hide All"],["only-polar","Only Polar"]],{description:"Determine display of hydrogen atoms in representations"}),visualQuality:C.Select("auto",t5,{description:"Control the visual/rendering quality of representations"}),ignoreLight:C.Boolean(!1,{description:"Ignore light for stylized rendering of representations"}),materialStyle:ba.getParam(),clipObjects:C.Group(gm.Params),interactions:C.Group(Qi.defaultParams,{label:"Non-covalent Interactions"})},e.getAddParams=function t(o,s){const{options:a}=o.query.structure.registry;return s={pivot:o.managers.structure.component.pivotStructure,allowNone:!0,hideSelection:!1,checkExisting:!1,...s},{selection:C.Select(a[1][0],a,{isHidden:s?.hideSelection}),representation:i(o,s?.pivot,s?.allowNone?[["none","< Create Later >"]]:[]),options:C.Group({label:C.Text(""),checkExisting:C.Boolean(!!s?.checkExisting,{help:()=>({description:"Checks if a selection with the specifield elements already exists to avoid creating duplicate components."})})})}},e.getThemeParams=function n(o,s){const{options:a}=o.query.structure.registry;return{selection:C.Select(a[1][0],a,{isHidden:!1}),action:C.MappedStatic("color",{color:C.Group({color:C.Color(xn.blue,{isExpanded:!0})},{isFlat:!0}),resetColor:C.EmptyGroup({label:"Reset Color"}),transparency:C.Group({value:C.Numeric(.5,{min:0,max:1,step:.01})},{isFlat:!0}),material:C.Group({material:ba.getParam({isFlat:!0})},{isFlat:!0}),resetMaterial:C.EmptyGroup({label:"Reset Material"}),clipping:C.Group({excludeGroups:C.MultiSelect([],C.objectToOptions(Yr.Groups.Names))},{isFlat:!0})}),representations:C.MultiSelect([],r(o,s),{emptyValue:"All"})}},e.getRepresentationTypes=r}(_C||(_C={}));class eft extends th{get current(){return this.state.current}get history(){return this.state.history}tryAddHistory(t){if(De.isEmpty(t.loci))return;let r,n=0;for(const i of this.state.history){if(De.areEqual(i.loci,t.loci)){r=i;break}n++}if(r)return Kx(this.state.history,n),this.state.history.unshift(t),void this.events.historyUpdated.next(void 0);this.state.history.unshift(t),this.state.history.length>8&&this.state.history.pop(),this.events.historyUpdated.next(void 0)}set(t){this.tryAddHistory(t),(!this.state.current||!De.areEqual(this.state.current.loci,t.loci))&&(this.state.current=t,this.behaviors.current.next(t))}setFromLoci(t){const n=pn.normalize(t);De.is(n)&&!De.isEmpty(n)?this.set({loci:n,label:uE(n,{reverse:!0,hidePrefix:!0,htmlStyling:!1})}):this.clear()}addFromLoci(t){const n=this.state.current&&De.is(t)&&t.structure===this.state.current.loci.structure?De.union(t,this.state.current.loci):t;this.setFromLoci(n)}clear(){this.state.current&&(this.state.current=void 0,this.behaviors.current.next(void 0))}getSnapshot(){if(!this.current)return{};const t=this.plugin.helpers.substructureParent.get(this.current.loci.structure),n=t?.transform.ref;return n?{current:{label:this.current.label,ref:n,bundle:Kn.fromLoci(this.current.loci),category:this.current.category}}:{}}setSnapshot(t){var n,r;if(!t.current)return void this.clear();const{label:i,ref:o,bundle:s,category:a}=t.current,c=null===(r=null===(n=this.plugin.state.data.select(In.Generators.byRef(o))[0])||void 0===n?void 0:n.obj)||void 0===r?void 0:r.data;if(!c)return;const u=Kn.toLoci(s,c);this.set({label:i,loci:u,category:a})}constructor(t){super({history:[]}),this.plugin=t,this.events={historyUpdated:this.ev()},this.behaviors={current:this.ev.behavior(void 0)},t.state.data.events.object.removed.subscribe(({obj:r})=>{var i;if(!pe.Molecule.Structure.is(r))return;(null===(i=this.current)||void 0===i?void 0:i.loci.structure)===r.data&&this.clear();const o=[];for(const s of this.history)s.loci.structure===r.data&&o.push(s);o.length!==this.history.length&&(this.history.length=0,this.history.push(...o),this.events.historyUpdated.next(void 0))});const n=_e();t.state.data.events.object.updated.subscribe(({oldData:r,obj:i,action:o})=>{var s;if(pe.Molecule.Structure.is(i)&&r!==i.data&&"in-place"===o){const a=this.state.current;if(a&&a.loci.structure===r){const u=De.remap(a.loci,i.data);this.state.current={...a,loci:u},this.behaviors.current.next(this.state.current),pn.getBoundingSphere(u,n);const l=null===(s=this.plugin.canvas3d)||void 0===s?void 0:s.camera,d=l.getTargetDistance(n.radius+4);(v.distance(l.target,n.center)>n.radius||d>l.viewport.height/l.zoom)&&this.plugin.managers.camera.focusSphere(n,{durationMs:0})}}})}}function TV(){return{trajectories:[],models:[],structures:[],refs:new Map}}function nft(e){return{kind:"trajectory",cell:e,version:e.transform.version,models:[]}}function Dfe(e,t){return{kind:"model",cell:e,version:e.transform.version,trajectory:t,structures:[]}}function rft(e,t){return{kind:"model-properties",cell:e,version:e.transform.version,model:t}}function ift(e,t){return{kind:"model-unitcell",cell:e,version:e.transform.version,model:t}}function Efe(e,t){return{kind:"structure",cell:e,version:e.transform.version,model:t,components:[]}}function oft(e,t){return{kind:"structure-properties",cell:e,version:e.transform.version,structure:t}}function sft(e,t){return{kind:"structure-transform",cell:e,version:e.transform.version,structure:t}}function aft(e,t){return{kind:"structure-volume-streaming",cell:e,version:e.transform.version,structure:t}}function cft(e){return e.transform.tags?[...e.transform.tags].sort().join():e.transform.ref}function uft(e,t){return{kind:"structure-component",cell:e,version:e.transform.version,structure:t,key:cft(e),representations:[]}}function lft(e,t){return{kind:"structure-representation",cell:e,version:e.transform.version,component:t}}function dft(e,t){return{kind:"generic-representation",cell:e,version:e.transform.version,parent:t}}function d1(e,t,n,r,...i){const o=r(...i);n.push(o),e.hierarchy.refs.set(t.transform.ref,o);const s=e.oldHierarchy.refs.get(t.transform.ref);return s?s.version!==t.transform.version&&(e.changed=!0):(e.added.add(o.cell.transform.ref),e.changed=!0),o}function G0(e,t,n,...r){const i=n(...r);e.hierarchy.refs.set(t.transform.ref,i);const o=e.oldHierarchy.refs.get(t.transform.ref);return o?o.version!==t.transform.version&&(e.changed=!0):(e.added.add(i.cell.transform.ref),e.changed=!0),i}function Pfe(e){return t=>e.is(t.obj)}function Mfe(e,t){return(n,r)=>!t(r)&&e.is(n.obj)}function f3(e){return t=>t.transform.transformer===e}function j0(){}const pft=[[Pfe(pe.Molecule.Trajectory),(e,t)=>{e.currentTrajectory=d1(e,t,e.hierarchy.trajectories,nft,t)},e=>e.currentTrajectory=void 0],[Mfe(pe.Molecule.Model,e=>e.currentModel),(e,t)=>{e.currentModel=e.currentTrajectory?d1(e,t,e.currentTrajectory.models,Dfe,t,e.currentTrajectory):G0(e,t,Dfe,t),e.hierarchy.models.push(e.currentModel)},e=>e.currentModel=void 0],[f3(Ye.Model.CustomModelProperties),(e,t)=>{if(!e.currentModel)return!1;e.currentModel.properties=G0(e,t,rft,t,e.currentModel)},j0],[f3(Ye.Representation.ModelUnitcell3D),(e,t)=>{if(!e.currentModel)return!1;e.currentModel.unitcell=G0(e,t,ift,t,e.currentModel)},j0],[Mfe(pe.Molecule.Structure,e=>e.currentStructure),(e,t)=>{e.currentStructure=e.currentModel?d1(e,t,e.currentModel.structures,Efe,t,e.currentModel):G0(e,t,Efe,t),e.hierarchy.structures.push(e.currentStructure)},e=>e.currentStructure=void 0],[f3(Ye.Model.CustomStructureProperties),(e,t)=>{if(!e.currentStructure)return!1;e.currentStructure.properties=G0(e,t,oft,t,e.currentStructure)},j0],[f3(Ye.Model.TransformStructureConformation),(e,t)=>{if(!e.currentStructure)return!1;e.currentStructure.transform=G0(e,t,sft,t,e.currentStructure)},j0],[Pfe(Tu),(e,t)=>(e.currentStructure&&(e.currentStructure.volumeStreaming=G0(e,t,aft,t,e.currentStructure)),!1),j0],[(e,t)=>!(t.currentComponent||!t.currentStructure||e.transform.transformer.definition.isDecorator)&&pe.Molecule.Structure.is(e.obj),(e,t)=>{e.currentStructure&&(e.currentComponent=d1(e,t,e.currentStructure.components,uft,t,e.currentStructure))},e=>e.currentComponent=void 0],[(e,t)=>!e.state.isGhost&&!!t.currentComponent&&pe.Molecule.Structure.Representation3D.is(e.obj),(e,t)=>(e.currentComponent&&d1(e,t,e.currentComponent.representations,lft,t,e.currentComponent),!1),j0],[e=>!e.state.isGhost&&pe.isRepresentation3D(e.obj),(e,t)=>{const n=e.currentComponent||e.currentStructure||e.currentModel;n&&(n.genericRepresentations||(n.genericRepresentations=[]),d1(e,t,n.genericRepresentations,dft,t,n))},j0]];function Rfe(e){if(!e||!e?.parent||!e.parent.cells.has(e.transform.ref))return!1;const{obj:t}=e;return!(!t||t===li.Null||"ok"!==e.status&&"error"!==e.status)}function hft(e){const{cell:t}=e;Rfe(t)||(this.changed=!0)}function mft(e){kfe(this,this.tree.transforms.get(e))}function kfe(e,t){const{state:n}=e,r=n.state.cells.get(t.ref);if(!Rfe(r))return;let i,o=!1;for(const[a,c,u]of pft)if(a(r,n)){if(!1===c(n,r)){o=!0;break}i=u;break}if(o)return;const s=e.tree.children.get(t.ref);s&&s.size&&s.forEach(mft,e),i&&i(n)}class xC extends ZS{get dataState(){return this.plugin.state.data}get currentComponentGroups(){return this._currentComponentGroups||(this._currentComponentGroups=xC.getComponentGroups(this.selection.structures)),this._currentComponentGroups}get seletionSet(){if(this._currentSelectionSet)return this._currentSelectionSet;this._currentSelectionSet=new Set;for(const t of this.selection.trajectories)this._currentSelectionSet.add(t.cell.transform.ref);for(const t of this.selection.models)this._currentSelectionSet.add(t.cell.transform.ref);for(const t of this.selection.structures)this._currentSelectionSet.add(t.cell.transform.ref);return this._currentSelectionSet}get current(){return this.sync(!1),this.state.hierarchy}get selection(){return this.sync(!1),this.state.selection}getStructuresWithSelection(){const t=this.plugin.managers.structure.hierarchy.current.structures,n=[];for(const r of t)this.plugin.managers.structure.selection.structureHasSelection(r)&&n.push(r);return n}findStructure(t){if(!t)return;const n=this.plugin.helpers.substructureParent.get(t);if(!n)return;const r=this.plugin.state.data.selectQ(i=>i.byValue(n).rootOfType(pe.Molecule.Structure))[0];return r?this.behaviors.selection.value.structures.find(i=>i.cell===r):void 0}syncCurrent(t,n){const r=this.seletionSet,i=[];for(const o of t){const s=o.cell.transform.ref;(r.has(s)||n.has(s))&&i.push(o)}return 0===i.length?t.length>0?[t[0]]:[]:i}sync(t){if(!t&&this.dataState.inUpdate)return;if(this.state.syncedTree===this.dataState.tree)return void(t&&!this.state.notified&&(this.state.notified=!0,this.behaviors.selection.next({hierarchy:this.state.hierarchy,...this.state.selection})));this.state.syncedTree=this.dataState.tree;const n=function tft(e,t){const n=function fft(e,t){return{state:e,oldHierarchy:t,hierarchy:TV(),changed:!1,added:new Set}}(e,t||TV());return function gft(e,t){kfe({tree:e,state:t},e.root)}(e.tree,n),t&&t.refs.forEach(hft,n),{hierarchy:n.hierarchy,added:n.added,changed:n.changed}}(this.plugin.state.data,this.current);if(!n.changed)return;const{hierarchy:r}=n,i=this.syncCurrent(r.trajectories,n.added),o=this.syncCurrent(r.models,n.added),s=this.syncCurrent(r.structures,n.added);this._currentComponentGroups=void 0,this._currentSelectionSet=void 0,this.state.hierarchy=r,this.state.selection.trajectories=i,this.state.selection.models=o,this.state.selection.structures=s,t?(this.state.notified=!0,this.behaviors.selection.next({hierarchy:r,trajectories:i,models:o,structures:s})):this.state.notified=!1}updateCurrent(t,n){const r=this.current,i="add"===n?Si.union(this.seletionSet,new Set(t.map(c=>c.cell.transform.ref))):Si.difference(this.seletionSet,new Set(t.map(c=>c.cell.transform.ref))),o=[],s=[],a=[];for(const c of r.trajectories)i.has(c.cell.transform.ref)&&o.push(c);for(const c of r.models)i.has(c.cell.transform.ref)&&s.push(c);for(const c of r.structures)i.has(c.cell.transform.ref)&&a.push(c);this._currentComponentGroups=void 0,this._currentSelectionSet=void 0,this.state.selection.trajectories=o,this.state.selection.models=s,this.state.selection.structures=a,this.behaviors.selection.next({hierarchy:r,trajectories:o,models:s,structures:a})}remove(t,n){if(0===t.length)return;const r=this.plugin.state.data.build();for(const i of t)r.delete("string"==typeof i?i:i.cell.transform.ref);return r.commit({canUndo:!!n&&"Remove"})}toggleVisibility(t,n){if(0===t.length)return;const r=void 0!==n?"show"!==n:!t[0].cell.state.isHidden;for(const i of t)Wv(this.dataState,i.cell.transform.ref,r)}applyPreset(t,n,r){var i=this;return this.plugin.dataTransaction(ie(function*(){for(const o of t)o.models.length>0&&(yield i.clearTrajectory(o)),yield i.plugin.builders.structure.hierarchy.applyPreset(o.cell,n,r)}))}updateStructure(t,n){var r=this;return ie(function*(){yield r.plugin.dataTransaction(ie(function*(){const i=bo.getDecoratorRoot(r.dataState.tree,t.cell.transform.ref),o=r.dataState.tree.children.get(i).toArray();yield r.remove(o,!1),yield r.plugin.state.updateTransform(r.plugin.state.data,t.cell.transform.ref,n,"Structure Type"),yield r.plugin.builders.structure.representation.applyPreset(t.cell.transform.ref,"auto")}),{canUndo:"Structure Type"}),Cn.Camera.Reset(r.plugin)})()}clearTrajectory(t){const n=this.dataState.build();for(const r of t.models)n.delete(r.cell);return n.commit()}constructor(t){super(),this.plugin=t,this.state={syncedTree:this.dataState.tree,notified:!1,hierarchy:TV(),selection:{trajectories:[],models:[],structures:[]}},this.behaviors={selection:this.ev.behavior({hierarchy:this.current,trajectories:this.selection.trajectories,models:this.selection.models,structures:this.selection.structures})},this._currentComponentGroups=void 0,this._currentSelectionSet=void 0,this.subscribe(t.state.data.events.changed,n=>{n.inTransaction||t.behaviors.state.isAnimating.value||this.sync(!0)}),this.subscribe(t.behaviors.state.isAnimating,n=>{!n&&!t.behaviors.state.isUpdating.value&&this.sync(!0)})}}!function(e){e.getComponentGroups=function t(r){if(!r.length)return[];if(1===r.length)return r[0].components.map(s=>[s]);const i=[],o=new Map;for(const s of r)for(const a of s.components){const c=a.key;if(!c)continue;let u=o.get(c);u||(u=[],o.set(c,u),i.push(u)),u.push(a)}return i},e.getSelectedStructuresDescription=function n(r){var i,o,s,a,c,u,l,d,f;const{structures:p}=r.managers.structure.hierarchy.selection;if(0===p.length)return"";if(1===p.length){const y=p[0],b=null===(i=y.cell.obj)||void 0===i?void 0:i.data;if(!b)return(null===(o=y.cell.obj)||void 0===o?void 0:o.label)||"Structure";const x=b.models[0]||b.representativeModel||b.masterModel;if(!x)return(null===(s=y.cell.obj)||void 0===s?void 0:s.label)||"Structure";const _=x.entryId;return null!==(c=null===(a=y.model)||void 0===a?void 0:a.trajectory)&&void 0!==c&&c.models&&1===y.model.trajectory.models.length?_:y.model?`${null===(u=y.model.cell.obj)||void 0===u?void 0:u.label} | ${_}`:_}const m=p[0],h=null===(l=m?.model)||void 0===l?void 0:l.trajectory;let g=!0;for(const y of p)if((null===(d=y?.model)||void 0===d?void 0:d.trajectory)!==h){g=!1;break}return g&&h?`${null===(f=h.cell.obj)||void 0===f?void 0:f.label} | ${p.length} structures`:`${p.length} structures`}}(xC||(xC={}));const DV="measurement-group",p3="measurement-order-label",yft={distanceUnitLabel:C.Text("\u212b",{isEssential:!0}),textColor:tce.textColor},bft=C.getDefaultValues(yft);class vft extends th{stateUpdated(){this.behaviors.state.next(this.state)}getGroup(){const n=In.findTagInSubtree(this.plugin.state.data.tree,ur.RootRef,DV),r=this.plugin.state.data.build();return n?r.to(n):r.toRoot().group(Ye.Misc.CreateGroup,{label:"Measurements"},{tags:DV})}setOptions(t){var n=this;return ie(function*(){n.updateState({options:t})&&n.stateUpdated();const r=n.plugin.state.data.build();for(const i of n.state.distances)r.to(i).update(o=>{o.unitLabel=t.distanceUnitLabel,o.textColor=t.textColor});for(const i of n.state.labels)r.to(i).update(o=>{o.textColor=t.textColor});for(const i of n.state.angles)r.to(i).update(o=>{o.textColor=t.textColor});for(const i of n.state.dihedrals)r.to(i).update(o=>{o.textColor=t.textColor});0!==r.editInfo.count&&(yield Cn.State.Update(n.plugin,{state:n.plugin.state.data,tree:r,options:{doNotLogTiming:!0}}))})()}addDistance(t,n,r){var i=this;return ie(function*(){const o=i.plugin.helpers.substructureParent.get(t.structure),s=i.plugin.helpers.substructureParent.get(n.structure);if(!o||!s)return;const a=[o.transform.ref];eo(a,s.transform.ref);const c=i.getGroup();c.apply(Ye.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",groupId:"a",ref:o.transform.ref,expression:De.toExpression(t)},{key:"b",groupId:"b",ref:s.transform.ref,expression:De.toExpression(n)}],isTransitive:!0,label:"Distance"},{dependsOn:a,tags:r?.selectionTags}).apply(Ye.Representation.StructureSelectionsDistance3D,{customText:r?.customText||"",unitLabel:i.state.options.distanceUnitLabel,textColor:i.state.options.textColor,...r?.lineParams,...r?.labelParams,...r?.visualParams},{tags:r?.reprTags});const u=i.plugin.state.data;yield Cn.State.Update(i.plugin,{state:u,tree:c,options:{doNotLogTiming:!0}})})()}addAngle(t,n,r,i){var o=this;return ie(function*(){const s=o.plugin.helpers.substructureParent.get(t.structure),a=o.plugin.helpers.substructureParent.get(n.structure),c=o.plugin.helpers.substructureParent.get(r.structure);if(!s||!a||!c)return;const u=[s.transform.ref];eo(u,a.transform.ref),eo(u,c.transform.ref);const l=o.getGroup();l.apply(Ye.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",ref:s.transform.ref,expression:De.toExpression(t)},{key:"b",ref:a.transform.ref,expression:De.toExpression(n)},{key:"c",ref:c.transform.ref,expression:De.toExpression(r)}],isTransitive:!0,label:"Angle"},{dependsOn:u,tags:i?.selectionTags}).apply(Ye.Representation.StructureSelectionsAngle3D,{customText:i?.customText||"",textColor:o.state.options.textColor,...i?.lineParams,...i?.labelParams,...i?.visualParams},{tags:i?.reprTags});const d=o.plugin.state.data;yield Cn.State.Update(o.plugin,{state:d,tree:l,options:{doNotLogTiming:!0}})})()}addDihedral(t,n,r,i,o){var s=this;return ie(function*(){const a=s.plugin.helpers.substructureParent.get(t.structure),c=s.plugin.helpers.substructureParent.get(n.structure),u=s.plugin.helpers.substructureParent.get(r.structure),l=s.plugin.helpers.substructureParent.get(i.structure);if(!(a&&c&&u&&l))return;const d=[a.transform.ref];eo(d,c.transform.ref),eo(d,u.transform.ref),eo(d,l.transform.ref);const f=s.getGroup();f.apply(Ye.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",ref:a.transform.ref,expression:De.toExpression(t)},{key:"b",ref:c.transform.ref,expression:De.toExpression(n)},{key:"c",ref:u.transform.ref,expression:De.toExpression(r)},{key:"d",ref:l.transform.ref,expression:De.toExpression(i)}],isTransitive:!0,label:"Dihedral"},{dependsOn:d,tags:o?.selectionTags}).apply(Ye.Representation.StructureSelectionsDihedral3D,{customText:o?.customText||"",textColor:s.state.options.textColor,...o?.lineParams,...o?.labelParams,...o?.visualParams},{tags:o?.reprTags});const p=s.plugin.state.data;yield Cn.State.Update(s.plugin,{state:p,tree:f,options:{doNotLogTiming:!0}})})()}addLabel(t,n){var r=this;return ie(function*(){const i=r.plugin.helpers.substructureParent.get(t.structure);if(!i)return;const o=[i.transform.ref],s=r.getGroup();s.apply(Ye.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",ref:i.transform.ref,expression:De.toExpression(t)}],isTransitive:!0,label:"Label"},{dependsOn:o,tags:n?.selectionTags}).apply(Ye.Representation.StructureSelectionsLabel3D,{textColor:r.state.options.textColor,...n?.labelParams,...n?.visualParams},{tags:n?.reprTags});const a=r.plugin.state.data;yield Cn.State.Update(r.plugin,{state:a,tree:s,options:{doNotLogTiming:!0}})})()}addOrientation(t){var n=this;return ie(function*(){const r=[],i=[];for(let a=0,c=t.length;a{n.inTransaction||t.behaviors.state.isAnimating.value||this.sync()}),t.behaviors.state.isAnimating.subscribe(n=>{!n&&!t.behaviors.state.isUpdating.value&&this.sync()})}}const SC=new fu("98");class xft extends th{get entries(){return this.state.entries}get additionsHistory(){return this.state.additionsHistory}get stats(){return this.state.stats||(this.state.stats=this.calcStats()),this.state.stats}getEntry(t){const n=this.plugin.helpers.substructureParent.get(t,!0);if(!n)return;const r=n.transform.ref;if(!this.entries.has(r)){const i=new EV(De(t,[]));return this.entries.set(r,i),i}return this.entries.get(r)}calcStats(){let t=0,n=0;const r=rf.create();this.entries.forEach(o=>{const{elements:s}=o.selection;if(s.length){t+=1;for(let a=0,c=s.length;a24&&this.additionsHistory.pop(),this.events.additionsHistoryUpdated.next(void 0)}clearHistory(){0!==this.state.additionsHistory.length&&(this.state.additionsHistory=[],this.events.additionsHistoryUpdated.next(void 0))}clearHistoryForStructure(t){const n=[];for(const r of this.state.additionsHistory)r.loci.structure.root===t.root&&n.push(r);for(const r of n)this.modifyHistory(r,"remove");0!==n.length&&this.events.additionsHistoryUpdated.next(void 0)}onRemove(t,n){var r;this.entries.has(t)&&(this.entries.delete(t),n?.data&&this.clearHistoryForStructure(n.data),(null===(r=this.referenceLoci)||void 0===r?void 0:r.structure)===n?.data&&(this.referenceLoci=void 0),this.state.stats=void 0,this.events.changed.next(void 0))}onUpdate(t,n,r){var i,o,s,a;if(n===r||n?.data===r.data)return;const c=this.plugin.helpers.substructureParent.get(r.data,!0);if(!c||t!==c.transform.ref||!this.entries.has(t))return;const u=null===(o=null===(i=this.plugin.helpers.substructureParent.get(r.data))||void 0===i?void 0:i.obj)||void 0===o?void 0:o.data;if(u)if(!n?.data||Ve.areUnitIdsAndIndicesEqual(n.data,r.data)){this.entries.set(t,function Cft(e,t){return new EV(De.remap(e.selection,t))}(this.entries.get(t),u)),(null===(s=this.referenceLoci)||void 0===s?void 0:s.structure.root)===u.root&&(this.referenceLoci=De.remap(this.referenceLoci,u));let l=!1;for(const d of this.state.additionsHistory)d.loci.structure.root===u.root&&(d.loci=De.remap(d.loci,u),l=!0);l&&this.events.additionsHistoryUpdated.next(void 0)}else this.entries.set(t,new EV(De(u,[]))),(null===(a=this.referenceLoci)||void 0===a?void 0:a.structure.root)===u.root&&(this.referenceLoci=void 0),this.clearHistoryForStructure(u),this.state.stats=void 0,this.events.changed.next(void 0)}clear(){const t=this.entries.keys(),n=[];for(;;){const r=t.next();if(r.done)break;const i=this.entries.get(r.value);De.isEmpty(i.selection)||n.push(i.selection),i.selection=De(i.selection.structure,[])}return this.referenceLoci=void 0,this.state.stats=void 0,this.events.changed.next(void 0),this.events.loci.clear.next(void 0),this.clearHistory(),n}getLoci(t){const n=this.getEntry(t);return n?n.selection:$n}getStructure(t){const n=this.getEntry(t);if(n)return n.structure}structureHasSelection(t){var n,r;const i=null===(r=null===(n=t.cell)||void 0===n?void 0:n.obj)||void 0===r?void 0:r.data;if(!i)return!1;const o=this.getEntry(i);return!!o&&!De.isEmpty(o.selection)}has(t){if(De.is(t)){const n=this.getEntry(t.structure);if(n)return De.isSubset(n.selection,t)}return!1}tryGetRange(t){if(!De.is(t)||1!==t.elements.length||!this.getEntry(t.structure))return;const r=t.elements[0];if(!r)return;const i=this.referenceLoci;if(!i||!De.is(i)||i.structure!==t.structure)return;let o;for(const s of i.elements)if(r.unit===s.unit){o=s;break}return o&&r.unit===o.unit?function wft(e,t,n){const r=Math.min(Fe.min(t.indices),Fe.min(n.indices)),i=Math.max(Fe.max(t.indices),Fe.max(n.indices));return De(e,[{unit:t.unit,indices:Fe.ofRange(r,i)}])}(t.structure,o,r):void 0}elementCount(){let t=0;return this.entries.forEach(n=>{t+=De.size(n.selection)}),t}getBoundary(){const t=v.create(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),n=v.create(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);SC.reset();const r=[];this.entries.forEach(i=>{const o=i.selection;De.isEmpty(o)||r.push(De.getBoundary(o))});for(let i=0,o=r.length;in.selection))}modify(t,n){let r=!1;switch(t){case"add":r=this.add(n);break;case"remove":r=this.remove(n);break;case"intersect":r=this.intersect(n);break;case"set":r=this.set(n)}r&&(this.state.stats=void 0,this.events.changed.next(void 0))}get applicableStructures(){return this.plugin.managers.structure.hierarchy.selection.structures.filter(t=>!!t.cell.obj).map(t=>t.cell.obj.data)}triggerInteraction(t,n,r=!0){switch(t){case"add":this.plugin.managers.interactivity.lociSelects.select({loci:n},r);break;case"remove":this.plugin.managers.interactivity.lociSelects.deselect({loci:n},r);break;case"intersect":this.plugin.managers.interactivity.lociSelects.selectJoin({loci:n},r);break;case"set":this.plugin.managers.interactivity.lociSelects.selectOnly({loci:n},r)}}fromLoci(t,n,r=!0){this.triggerInteraction(t,n,r)}fromCompiledQuery(t,n,r=!0){for(const i of this.applicableStructures){const o=n(new qu(i));this.triggerInteraction(t,pt.toLociWithSourceUnits(o),r)}}fromSelectionQuery(t,n,r=!0){var i=this;this.plugin.runTask(Oe.create("Structure Selection",function(){var o=ie(function*(s){for(const a of i.applicableStructures){const c=yield n.getSelection(i.plugin,s,a);i.triggerInteraction(t,pt.toLociWithSourceUnits(c),r)}});return function(s){return o.apply(this,arguments)}}()))}fromSelections(t){var n;const r=ls.resolveAndCheck(this.plugin.state.data,t);if(r&&r.obj){if(!pe.Molecule.Structure.Selections.is(r.obj))return void console.warn("fromSelections applied to wrong object type.",r.obj);this.clear();for(const i of null===(n=r.obj)||void 0===n?void 0:n.data)this.fromLoci("set",i.loci)}}getSnapshot(){const t=[];return this.entries.forEach((n,r)=>{t.push({ref:r,bundle:Kn.fromLoci(n.selection)})}),{entries:t}}setSnapshot(t){var n,r;this.entries.clear();for(const{ref:i,bundle:o}of t.entries){const s=null===(r=null===(n=this.plugin.state.data.select(In.Generators.byRef(i))[0])||void 0===n?void 0:n.obj)||void 0===r?void 0:r.data;if(!s)continue;const a=Kn.toLoci(o,s);this.fromLoci("set",a,!1)}}constructor(t){super({entries:new Map,additionsHistory:[],stats:{structureCount:0,elementCount:0,label:"Nothing Selected"}}),this.plugin=t,this.events={changed:this.ev(),additionsHistoryUpdated:this.ev(),loci:{add:this.ev(),remove:this.ev(),clear:this.ev()}},t.helpers.substructureParent.events.removed.subscribe(n=>this.onRemove(n.ref,n.obj)),t.helpers.substructureParent.events.updated.subscribe(n=>this.onUpdate(n.ref,n.oldObj,n.obj))}}class EV{get selection(){return this._selection}set selection(t){this._selection=t,this._structure=void 0}get structure(){return this._structure||(this._structure=pn.isEmpty(this._selection)?void 0:De.toStructure(this._selection)),this._structure}constructor(t){this._structure=void 0,this._selection=t}}function PV(){return{volumes:[],lazyVolumes:[],refs:new Map}}function Ift(e){return{kind:"volume",cell:e,version:e.transform.version,representations:[]}}function Tft(e){return{kind:"lazy-volume",cell:e,version:e.transform.version}}function Dft(e,t){return{kind:"volume-representation",cell:e,version:e.transform.version,volume:t}}function MV(e,t,n,r,...i){const o=r(...i);n.push(o),e.hierarchy.refs.set(t.transform.ref,o);const s=e.oldHierarchy.refs.get(t.transform.ref);return s?s.version!==t.transform.version&&(e.changed=!0):(e.added.add(o.cell.transform.ref),e.changed=!0),o}function Nfe(){}const Mft=[[function Pft(e,t){return(n,r)=>!t(r)&&e.is(n.obj)}(pe.Volume.Data,e=>e.currentVolume),(e,t)=>{e.currentVolume=MV(e,t,e.hierarchy.volumes,Ift,t)},e=>e.currentVolume=void 0],[e=>pe.Volume.Lazy.is(e.obj),(e,t)=>{MV(e,t,e.hierarchy.lazyVolumes,Tft,t)},Nfe],[(e,t)=>!e.state.isGhost&&!!t.currentVolume&&pe.Volume.Representation3D.is(e.obj),(e,t)=>(e.currentVolume&&MV(e,t,e.currentVolume.representations,Dft,t,e.currentVolume),!1),Nfe]];function Ffe(e){if(!e||!e?.parent||!e.parent.cells.has(e.transform.ref))return!1;const{obj:t}=e;return!(!t||t===li.Null||"ok"!==e.status&&"error"!==e.status)}function Rft(e){const{cell:t}=e;Ffe(t)||(this.changed=!0)}function kft(e){Bfe(this,this.tree.transforms.get(e))}function Bfe(e,t){const{state:n}=e,r=n.state.cells.get(t.ref);if(!Ffe(r))return;let i,o=!1;for(const[a,c,u]of Mft)if(a(r,n)){if(!1===c(n,r)){o=!0;break}i=u;break}if(o)return;const s=e.tree.children.get(t.ref);s&&s.size&&s.forEach(kft,e),i&&i(n)}class RV extends ZS{get dataState(){return this.plugin.state.data}get current(){return this.sync(!1),this.state.hierarchy}get selection(){return this.sync(!1),this.state.selection}sync(t){if(!t&&this.dataState.inUpdate)return;if(this.state.syncedTree===this.dataState.tree)return void(t&&!this.state.notified&&(this.state.notified=!0,this.behaviors.selection.next({hierarchy:this.state.hierarchy,volume:this.state.selection})));this.state.syncedTree=this.dataState.tree;const n=function Aft(e,t){const n=function Eft(e,t){return{state:e,oldHierarchy:t,hierarchy:PV(),changed:!1,added:new Set}}(e,t||PV());return function Nft(e,t){Bfe({tree:e,state:t},e.root)}(e.tree,n),t&&t.refs.forEach(Rft,n),{hierarchy:n.hierarchy,added:n.added,changed:n.changed}}(this.plugin.state.data,this.current);if(!n.changed)return;const{hierarchy:r}=n;this.state.hierarchy=r,this.state.selection=this.state.selection&&r.refs.has(this.state.selection.cell.transform.ref)?r.refs.get(this.state.selection.cell.transform.ref):r.volumes[0],t?(this.state.notified=!0,this.behaviors.selection.next({hierarchy:r,volume:this.state.selection})):this.state.notified=!1}setCurrent(t){this.state.selection=t||this.state.hierarchy.volumes[0],this.behaviors.selection.next({hierarchy:this.state.hierarchy,volume:t||this.state.hierarchy.volumes[0]})}remove(t,n){if(0===t.length)return;const r=this.plugin.state.data.build();for(const i of t)r.delete("string"==typeof i?i:i.cell.transform.ref);return r.commit({canUndo:!!n&&"Remove"})}toggleVisibility(t,n){if(0===t.length)return;const r=void 0!==n?"show"!==n:!t[0].cell.state.isHidden;for(const i of t)Wv(this.dataState,i.cell.transform.ref,r)}addRepresentation(t,n){var r;return this.dataState.build().to(t.cell).apply(Ye.Representation.VolumeRepresentation3D,bC(this.plugin,null===(r=t.cell.obj)||void 0===r?void 0:r.data,{type:n})).commit({canUndo:"Add Representation"})}constructor(t){super(),this.plugin=t,this.state={syncedTree:this.dataState.tree,notified:!1,hierarchy:PV(),selection:void 0},this.behaviors={selection:this.ev.behavior({hierarchy:this.current,volume:this.selection})},this.subscribe(t.state.data.events.changed,n=>{n.inTransaction||t.behaviors.state.isAnimating.value||this.sync(!0)}),this.subscribe(t.behaviors.state.isAnimating,n=>{!n&&!t.behaviors.state.isUpdating.value&&this.sync(!0)})}}!function(e){e.getRepresentationTypes=function t(n,r){var i,o;return null!==(i=r?.cell.obj)&&void 0!==i&&i.data?n.representation.volume.registry.getApplicableTypes(null===(o=r.cell.obj)||void 0===o?void 0:o.data):n.representation.volume.registry.types}}(RV||(RV={}));const kV=[["full","Full"],["hidden","Hidden"]],Bft={isExpanded:C.Boolean(!1),showControls:C.Boolean(!0),regionState:C.Group({left:C.Select("full",[["full","Full"],["collapsed","Collapsed"],["hidden","Hidden"]]),top:C.Select("full",kV),right:C.Select("full",kV),bottom:C.Select("full",kV)}),controlsDisplay:C.Value("outside",{isHidden:!0})};class Oft extends th{updateProps(t){const n=!!this.state.isExpanded;this.updateState(t),this.root&&"boolean"==typeof t.isExpanded&&t.isExpanded!==n&&this.handleExpand(),this.events.updated.next(void 0)}setProps(t){this.updateState(t)}setRoot(t){this.root=t,this.state.isExpanded&&this.handleExpand()}getScrollElement(){return document.scrollingElement?document.scrollingElement:document.documentElement?document.documentElement:document.body}handleExpand(){try{const t=document.getElementsByTagName("body")[0],n=document.getElementsByTagName("head")[0];if(!t||!n||!this.root)return;if(this.state.isExpanded){const r=n.children,i=[];let o=!1;for(let l=0;lthis.updateProps(n.state)),typeof document<"u"&&(this.expandedViewport=document.createElement("meta"),this.expandedViewport.name="viewport",this.expandedViewport.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0")}}const NV={includeTypes:C.MultiSelect(RI(jn.Names),C.objectToOptions(jn.Names)),excludeTypes:C.MultiSelect([],C.objectToOptions(jn.Names)),ignoreHydrogens:C.Boolean(!1),ignoreHydrogensVariant:C.Select("all",C.arrayToOptions(["all","non-polar"])),aromaticBonds:C.Boolean(!0,{description:"Display aromatic bonds with dashes"}),multipleBonds:C.Select("symmetric",C.arrayToOptions(["off","symmetric","offset"]))},FV=(C.getDefaultValues(NV),{...F0,...NV,adjustCylinderLength:C.Boolean(!1,{description:"Shorten cylinders to reduce overlap with spheres. Useful for for transparent bonds. Not working well with aromatic bonds."})}),BV=(C.getDefaultValues(FV),{...Qle,...NV});function h3(e,t,n){return!jn.is(e,n)||jn.is(t,n)}function Ofe(e,t,n){const r=t.elements,i=t.bonds,{a:o,b:s,edgeProps:a}=i,{flags:c}=a,{ignoreHydrogens:u,ignoreHydrogensVariant:l,includeTypes:d,excludeTypes:f}=n,p=jn.fromNames(d),m=jn.fromNames(f),h=jn.isAll(p)&&0===m,{child:g}=e,y=g?.unitMap.get(t.id);if(g&&!y)throw new Error("expected childUnit to exist if child exists");if(!h||u||g)return b=>{const x=o[b],_=s[b];return!!(y&&!je.has(y.elements,r[x])||!h&&h3(p,m,c[b]))||!!u&&!(!md(e,t,r[x],l)&&!md(e,t,r[_],l))}}function Lfe(e,t){const n=e.interUnitBonds,{edges:r}=n,{ignoreHydrogens:i,ignoreHydrogensVariant:o,includeTypes:s,excludeTypes:a}=t,c=jn.fromNames(s),u=jn.fromNames(a),l=jn.isAll(c)&&0===u,{child:d}=e;if(!l||i||d)return f=>{if(d){const p=r[f],m=d.unitMap.get(p.unitA);if(!m)return!0;const g=e.unitMap.get(p.unitA).elements[p.indexA];if(!je.has(m.elements,g))return!0}if(i){const p=r[f],m=e.unitMap.get(p.unitA),h=e.unitMap.get(p.unitB);if(md(e,m,m.elements[p.indexA],o)||md(e,h,h.elements[p.indexB],o))return!0}return!(l||!h3(c,u,r[f].props.flag))}}var Um;function OV(e,t,n){const{objectId:r,instanceId:i,groupId:o}=e;if(n===r){const{structure:s,group:a}=t,c=a.units[i];if(Ee.isAtomic(c)){const{target:u}=s,l=c.bonds.a[o],d=c.bonds.b[o];return Lt.Loci(u,[Lt.Location(u,c,l,u,c,d),Lt.Location(u,c,d,u,c,l)])}}return $n}function LV(e,t,n,r){let i=!1;if(Lt.isLoci(e)){const{structure:o,group:s}=t;if(!Ve.areEquivalent(e.structure,o))return!1;const a=s.units[0];if(!Ee.isAtomic(a))return!1;const c=2*a.bonds.edgeCount;for(const u of e.bonds){if(u.aUnit!==u.bUnit)continue;const l=s.unitIndexMap.get(u.aUnit.id);if(void 0!==l){const d=a.bonds.getDirectedEdgeIndex(u.aIndex,u.bIndex);-1!==d&&n(Ce.ofSingleton(l*c+d))&&(i=!0)}}}else if(De.is(e)){const{structure:o,group:s}=t;if(!Ve.areEquivalent(e.structure,o))return!1;const a=s.units[0];if(!Ee.isAtomic(a))return!1;const c=2*a.bonds.edgeCount;for(const u of e.elements){const l=s.unitIndexMap.get(u.unit.id);if(void 0!==l){const{offset:d,b:f}=a.bonds;Fe.forEach(u.indices,p=>{for(let m=d[p],h=d[p+1];m{const m=o.units[p];return l.aUnit=m,l.bUnit=m,l.aIndex=m.bonds.a[f],l.bIndex=m.bonds.b[f],l};if(i?.includeLocation2){const f=Lt.Location(s,void 0,void 0,s,void 0,void 0);return Mr(c,u,1,d,!1,()=>!1,(m,h)=>{const g=o.units[h];return f.aUnit=g,f.bUnit=g,f.aIndex=g.bonds.b[m],f.bIndex=g.bonds.a[m],f})}return Mr(c,u,1,d)},e.fromStructure=function n(r,i){const o=r.interUnitBonds.edgeCount,a=Lt.Location(r,void 0,void 0,r,void 0,void 0),c=u=>{const l=r.interUnitBonds.edges[u];return a.aUnit=r.unitMap.get(l.unitA),a.aIndex=l.indexA,a.bUnit=r.unitMap.get(l.unitB),a.bIndex=l.indexB,a};if(i?.includeLocation2){const u=Lt.Location(r,void 0,void 0,r,void 0,void 0);return Mr(o,1,1,c,!0,()=>!1,d=>{const f=r.interUnitBonds.edges[d];return u.aUnit=r.unitMap.get(f.unitB),u.aIndex=f.indexB,u.bUnit=r.unitMap.get(f.unitA),u.bIndex=f.indexA,u})}return Mr(o,1,1,c,!0)}}(Um||(Um={}));const VV=new Map;function zV(e,t,n,r){let i=!1;if(Lt.isLoci(e)){if(!Ve.areEquivalent(e.structure,t))return!1;for(const o of e.bonds){const s=t.interUnitBonds.getBondIndexFromLocation(o);-1!==s&&n(Ce.ofSingleton(s))&&(i=!0)}}else if(De.is(e)){if(!Ve.areEquivalent(e.structure,t)||r&&1===e.elements.length)return!1;for(const o of e.elements)VV.set(o.unit.id,o.indices);for(const o of e.elements){const{unit:s}=o;Ee.isAtomic(s)&&t.interUnitBonds.getConnectedUnits(s.id).forEach(a=>{const c=VV.get(a.unitB);(!r||c)&&Fe.forEach(o.indices,u=>{a.connectedIndices.includes(u)&&a.getEdges(u).forEach(l=>{if(!r||c&&Fe.has(c,l.indexB)){const d=t.interUnitBonds.getEdgeIndex(u,s.id,l.indexB,a.unitB);n(Ce.ofSingleton(d))&&(i=!0)}})})})}VV.clear()}return i}const GV=jn.is;function Ufe(e,t,n,r){const i=e.elements,o=e.bonds,{edgeCount:s,a,b:c,edgeProps:u,offset:l}=o,{order:d,flags:f}=u,{sizeFactor:p,sizeAspectRatio:m,adjustCylinderLength:h,aromaticBonds:g,includeTypes:y,excludeTypes:b,multipleBonds:x}=r,_="off"===x,S="symmetric"===x,w=h3(jn.fromNames(y),jn.fromNames(b),32),D=v(),I=v(),R=e.conformation;let T;const M=nt.create(t,e),N=Lt.Location(t,e,void 0,t,e,void 0),{child:V}=t;if(r.includeParent&&V){const $=V.unitMap.get(e.id);if(!$)throw new Error("expected childUnit to exist");T=ee=>{const O=i[c[ee]];return je.has($.elements,i[a[ee]])&&!je.has($.elements,O)}}const{elementRingIndices:z,elementAromaticRingIndices:j}=e.rings,Z=g?e.resonance.delocalizedTriplets:void 0;return{linkCount:2*s,referencePosition:$=>{let ee=a[$],q=c[$];const O=Z?.getThirdElement(ee,q);if(void 0!==O)return R.invariantPosition(i[O],D);ee>q&&([ee,q]=[q,ee]),l[ee+1]-l[ee]==1&&([ee,q]=[q,ee]);const H=j.get(ee)||z.get(ee);let W=0;for(let Q=l[ee],fe=l[ee+1];QW&&(W=ce,R.invariantPosition(i[X],D))}}}return W>0?D:null},position:($,ee,q)=>{if(R.invariantPosition(i[a[q]],$),R.invariantPosition(i[c[q]],ee),h){const O=($=>(M.element=i[a[$]],n.size.size(M)*p))(q),H=($=>(M.element=i[c[$]],n.size.size(M)*p))(q),W=Math.min(O,H)*m,Q=Math.sqrt(Math.max(0,O*O-W*W))-.05,fe=Math.sqrt(Math.max(0,H*H-W*W))-.05;if(Q<=.01&&fe<=.01)return;v.normalize(I,v.sub(I,ee,$)),v.scaleAndAdd($,$,I,Q),v.scaleAndAdd(ee,ee,I,-fe)}},style:$=>{const ee=d[$],q=f[$];if(GV(q,2)||GV(q,4))return 1;if(3===ee)return _?0:S?4:5;if(g){const H=c[$],W=j.get(a[$]),Q=j.get(H),fe=W&&Q?zI(W,Q):0;if(GV(q,16)||fe&&!w)return 2===fe?8:7}return 2!==ee||_?0:S?2:3},radius:$=>($=>(N.aIndex=a[$],N.bIndex=c[$],n.size.size(N)*p))($)*m,ignore:Ofe(t,e,r),stub:T}}function Lft(e,t,n,r,i,o){if(!Ee.isAtomic(t)||!t.bonds.edgeCount)return oc.createEmpty(o);const{child:s}=n,a=s?.unitMap.get(t.id);if(s&&!a)return oc.createEmpty(o);const c=Ufe(t,n,r,i),{cylinders:u,boundingSphere:l}=Jle(0,c,i,o);if(l)u.setBoundingSphere(l);else if(u.cylinderCount>0){const d=_e.expand(_e(),(a??t).boundary.sphere,1*i.sizeFactor);u.setBoundingSphere(d)}return u}function Uft(e,t,n,r,i,o){if(!Ee.isAtomic(t)||!t.bonds.edgeCount)return Nt.createEmpty(o);const{child:s}=n,a=s?.unitMap.get(t.id);if(s&&!a)return Nt.createEmpty(o);const c=Ufe(t,n,r,i),{mesh:u,boundingSphere:l}=B0(0,c,i,o);if(l)u.setBoundingSphere(l);else if(u.triangleCount>0){const d=_e.expand(_e(),(a??t).boundary.sphere,1*i.sizeFactor);u.setBoundingSphere(d)}return u}const m3={...hs,...wU,...FV,sizeFactor:C.Numeric(.3,{min:0,max:10,step:.01}),sizeAspectRatio:C.Numeric(2/3,{min:0,max:3,step:.01}),tryUseImpostor:C.Boolean(!0),includeParent:C.Boolean(!1)};function Vfe(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth?function Vft(e){return AU({defaultProps:C.getDefaultValues(m3),createGeometry:Lft,createLocationIterator:(t,n)=>Um.fromGroup(t,{includeLocation2:"interpolate"===n.colorMode}),getLoci:OV,eachLocation:LV,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.sizeAspectRatio!==r.sizeAspectRatio||n.linkScale!==r.linkScale||n.linkSpacing!==r.linkSpacing||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.linkCap!==r.linkCap||n.aromaticScale!==r.aromaticScale||n.aromaticSpacing!==r.aromaticSpacing||n.aromaticDashCount!==r.aromaticDashCount||n.dashCount!==r.dashCount||n.dashScale!==r.dashScale||n.dashCap!==r.dashCap||n.stubCap!==r.stubCap||!Wa(n.includeTypes,r.includeTypes)||!Wa(n.excludeTypes,r.excludeTypes)||n.adjustCylinderLength!==r.adjustCylinderLength||n.aromaticBonds!==r.aromaticBonds||n.multipleBonds!==r.multipleBonds,n.colorMode!==r.colorMode&&(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0);const c=s.group.units[0],u=a.group.units[0];Ee.isAtomic(c)&&Ee.isAtomic(u)&&(Dc.areEqual(c.bonds,u.bonds)||(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.updateSize=!0))},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function zft(e){return Hs({defaultProps:C.getDefaultValues(m3),createGeometry:Uft,createLocationIterator:t=>Um.fromGroup(t),getLoci:OV,eachLocation:LV,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.sizeAspectRatio!==r.sizeAspectRatio||n.radialSegments!==r.radialSegments||n.linkScale!==r.linkScale||n.linkSpacing!==r.linkSpacing||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.linkCap!==r.linkCap||n.aromaticScale!==r.aromaticScale||n.aromaticSpacing!==r.aromaticSpacing||n.aromaticDashCount!==r.aromaticDashCount||n.dashCount!==r.dashCount||n.dashScale!==r.dashScale||n.dashCap!==r.dashCap||n.stubCap!==r.stubCap||!Wa(n.includeTypes,r.includeTypes)||!Wa(n.excludeTypes,r.excludeTypes)||n.adjustCylinderLength!==r.adjustCylinderLength||n.aromaticBonds!==r.aromaticBonds||n.multipleBonds!==r.multipleBonds;const c=s.group.units[0],u=a.group.units[0];Ee.isAtomic(c)&&Ee.isAtomic(u)&&(Dc.areEqual(c.bonds,u.bonds)||(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.updateSize=!0))},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}const jV=new Lt.ElementBondIterator;function zfe(e,t,n,r){for(jV.setElement(t,n,r);jV.hasNext;){const i=jV.move();return i.otherUnit.conformation.position(i.otherUnit.elements[i.otherIndex],e),e}return null}const Gfe=v();function jfe(e,t,n){const r=nt.create(e),i=Lt.Location(e,void 0,void 0,e,void 0,void 0),o=e.interUnitBonds,{edgeCount:s,edges:a}=o,{sizeFactor:c,sizeAspectRatio:u,adjustCylinderLength:l,aromaticBonds:d,multipleBonds:f}=n,p="off"===f,m="symmetric"===f,h=v();let g;const{child:y}=e;return n.includeParent&&y&&(g=S=>{const A=a[S],E=y.unitMap.get(A.unitA),w=y.unitMap.get(A.unitB),I=e.unitMap.get(A.unitA).elements[A.indexA],T=e.unitMap.get(A.unitB).elements[A.indexB];return E&&je.has(E.elements,I)&&(!w||!je.has(w.elements,T))}),{linkCount:s,referencePosition:S=>{const A=a[S];let E,w,D,I;if(A.unitAA.unitB))throw new Error("same units in createInterUnitBondCylinderMesh");E=e.unitMap.get(A.unitB),w=e.unitMap.get(A.unitA),D=A.indexB,I=A.indexA}return zfe(Gfe,e,E,D)||zfe(Gfe,e,w,I)},position:(S,A,E)=>{const w=a[E],D=e.unitMap.get(w.unitA),I=e.unitMap.get(w.unitB);if(D.conformation.position(D.elements[w.indexA],S),I.conformation.position(I.elements[w.indexB],A),l){const R=(S=>{const A=a[S];return r.unit=e.unitMap.get(A.unitA),r.element=r.unit.elements[A.indexA],t.size.size(r)*c})(E),T=(S=>{const A=a[S];return r.unit=e.unitMap.get(A.unitB),r.element=r.unit.elements[A.indexB],t.size.size(r)*c})(E),M=Math.min(R,T)*u,N=Math.sqrt(Math.max(0,R*R-M*M))-.05,V=Math.sqrt(Math.max(0,T*T-M*M))-.05;if(N<=.01&&V<=.01)return;v.normalize(h,v.sub(h,A,S)),v.scaleAndAdd(S,S,h,N),v.scaleAndAdd(A,A,h,-V)}},style:S=>{const A=a[S].props.order,E=ea.create(a[S].props.flag);return jn.is(E,2)||jn.is(E,4)?1:3===A?p?0:m?4:5:d&&jn.is(E,16)?7:2!==A||p?0:m?2:3},radius:S=>(S=>{const A=a[S];return i.aUnit=e.unitMap.get(A.unitA),i.aIndex=A.indexA,i.bUnit=e.unitMap.get(A.unitB),i.bIndex=A.indexB,t.size.size(i)*c})(S)*u,ignore:Lfe(e,n),stub:g}}function Gft(e,t,n,r,i){if(!t.interUnitBonds.edgeCount)return oc.createEmpty(i);const o=jfe(t,n,r),{cylinders:s,boundingSphere:a}=Jle(0,o,r,i);if(a)s.setBoundingSphere(a);else if(s.cylinderCount>0){const{child:c}=t,u=_e.expand(_e(),(c??t).boundary.sphere,1*r.sizeFactor);s.setBoundingSphere(u)}return s}function jft(e,t,n,r,i){if(!t.interUnitBonds.edgeCount)return Nt.createEmpty(i);const o=jfe(t,n,r),{mesh:s,boundingSphere:a}=B0(0,o,r,i);if(a)s.setBoundingSphere(a);else if(s.triangleCount>0){const{child:c}=t,u=_e.expand(_e(),(c??t).boundary.sphere,1*r.sizeFactor);s.setBoundingSphere(u)}return s}const g3={...r1,...kat,...FV,sizeFactor:C.Numeric(.3,{min:0,max:10,step:.01}),sizeAspectRatio:C.Numeric(2/3,{min:0,max:3,step:.01}),tryUseImpostor:C.Boolean(!0),includeParent:C.Boolean(!1)};function Hfe(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth?function Hft(e){return function Nat(e,t){return N0({...e,setUpdateState:(n,r,i,o,s,a,c)=>{e.setUpdateState(n,r,i,o,s,a,c),Qo.areEqual(o.size,s.size)||(n.updateSize=!0)},geometryUtils:oc.Utils},t)}({defaultProps:C.getDefaultValues(g3),createGeometry:Gft,createLocationIterator:(t,n)=>Um.fromStructure(t,{includeLocation2:"interpolate"===n.colorMode}),getLoci:UV,eachLocation:zV,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.sizeAspectRatio!==r.sizeAspectRatio||n.linkScale!==r.linkScale||n.linkSpacing!==r.linkSpacing||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.linkCap!==r.linkCap||n.aromaticScale!==r.aromaticScale||n.aromaticSpacing!==r.aromaticSpacing||n.aromaticDashCount!==r.aromaticDashCount||n.dashCount!==r.dashCount||n.dashScale!==r.dashScale||n.dashCap!==r.dashCap||n.stubCap!==r.stubCap||!Wa(n.includeTypes,r.includeTypes)||!Wa(n.excludeTypes,r.excludeTypes)||n.adjustCylinderLength!==r.adjustCylinderLength||n.multipleBonds!==r.multipleBonds,n.colorMode!==r.colorMode&&(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0),s.interUnitBonds!==a.interUnitBonds&&(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.updateSize=!0)},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function qft(e){return rh({defaultProps:C.getDefaultValues(g3),createGeometry:jft,createLocationIterator:t=>Um.fromStructure(t),getLoci:UV,eachLocation:zV,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.sizeAspectRatio!==r.sizeAspectRatio||n.radialSegments!==r.radialSegments||n.linkScale!==r.linkScale||n.linkSpacing!==r.linkSpacing||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.linkCap!==r.linkCap||n.aromaticScale!==r.aromaticScale||n.aromaticSpacing!==r.aromaticSpacing||n.aromaticDashCount!==r.aromaticDashCount||n.dashCount!==r.dashCount||n.dashScale!==r.dashScale||n.dashCap!==r.dashCap||n.stubCap!==r.stubCap||!Wa(n.includeTypes,r.includeTypes)||!Wa(n.excludeTypes,r.excludeTypes)||n.adjustCylinderLength!==r.adjustCylinderLength||n.multipleBonds!==r.multipleBonds,s.interUnitBonds!==a.interUnitBonds&&(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.updateSize=!0)},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}const Wft=ze.add3,$ft=ze.add;var f1;!function(e){e.create=function t(n=2048,r=1024,i){const o=ze.create(Float32Array,3,r,i?i.centerBuffer.ref.value:n),s=ze.create(Float32Array,1,r,i?i.groupBuffer.ref.value:n);return{add:(a,c,u,l)=>{Wft(o,a,c,u),$ft(s,l)},getSpheres:()=>{const a=ze.compact(o,!0),c=ze.compact(s,!0);return fl.create(a,c,o.elementCount,i)}}}}(f1||(f1={}));const p1=v.add;function H0(e,t,n){const{ignoreHydrogens:r,ignoreHydrogensVariant:i,traceOnly:o}=n,s=Ee.isCoarse(t),{child:a}=e,c=a?.unitMap.get(t.id);if(a&&!c)throw new Error("expected childUnit to exist if child exists");if(a||r||o)return u=>!!c&&!je.has(c.elements,u)||!s&&r&&md(e,t,u,i)||o&&!xU(t,u)}function Yft(e,t,n,r,i,o){const{child:s}=n,a=s?.unitMap.get(t.id);if(s&&!a)return Nt.createEmpty(o);const{detail:c,sizeFactor:u,stride:l}=i,{elements:d,conformation:f}=t,p=d.length,m=p*xv(c),h=at.createState(m,m/2,o),g=v(),y=H0(n,t,i),b=nt.create(n,t),x=r.size.size,_=v();let S=0,A=0;for(let I=0;IS&&(S=R),h.currentGroup=I,Zn(h,g,R*u,c)}const E=o?_e.clone(o.boundingSphere):void 0,w=at.getMesh(h);if(0===A)return w;let D;return v.scale(_,_,1/A),D=E&&v.distance(_,E.center)/E.radius<.1?E:_e.expand(_e(),(a??t).boundary.sphere,S*u+.05),w.setBoundingSphere(D),w}function Xft(e,t,n,r,i,o){const{child:s}=n,a=s?.unitMap.get(t.id);if(s&&!a)return fl.createEmpty(o);const{sizeFactor:c,stride:u}=i,{elements:l,conformation:d}=t,f=l.length,p=f1.create(f,f/2,o),m=v(),h=H0(n,t,i),g=nt.create(n,t),y=r.size.size,b=v();let x=0,_=0;if(u&&u>1||h||"uniform"!==r.size.granularity)for(let w=0;wx&&(x=D)}else{for(let w=0;wh&&(h=N),f.currentGroup=u(_,M),Zn(f,D,N*a,s)}}const y=i?_e.clone(i.boundingSphere):void 0,b=at.getMesh(f);if(0===g)return b;let x;return v.scale(m,m,1/g),x=y&&v.distance(m,y.center)/y.radius<1?y:_e.expand(_e(),(o??t).boundary.sphere,h*a+.05),b.setBoundingSphere(x),b}function Zft(e,t,n,r,i){const{child:o}=t,{sizeFactor:s,stride:a}=r,{getSerialIndex:c}=t.serialMapping,u=t.elementCount,l=f1.create(u,u/2,i),d=n.size.size,f=v();let p=0,m=0;for(const b of t.units){const x=o?.unitMap.get(b.id);if(o&&!x)return fl.createEmpty(i);const{elements:_,conformation:S}=b,A=_.length,E=v(),w=H0(t,b,r),D=nt.create(t,b);if(a&&a>1||w||"uniform"!==n.size.granularity)for(let I=0;Ip&&(p=T)}else{for(let I=0;I{const f=i.units[d];return c.unit=f,c.element=f.elements[l],c})},e.fromStructure=function n(r){const{units:i,elementCount:o}=r,s=o,{unitIndices:c,elementIndices:u}=r.serialMapping,l=nt.create(r);return Mr(s,1,1,f=>(l.unit=i[c[f]],l.element=u[f],l),!0)}}(gs||(gs={}));const qfe={sizeFactor:C.Numeric(1,{min:0,max:10,step:.1}),detail:C.Numeric(0,{min:0,max:3,step:1},rt.CustomQualityParamInfo),ignoreHydrogens:C.Boolean(!1),ignoreHydrogensVariant:C.Select("all",C.arrayToOptions(["all","non-polar"])),traceOnly:C.Boolean(!1),tryUseImpostor:C.Boolean(!0),stride:C.Numeric(1,{min:1,max:100,step:1})},y3={...hs,...SU,...qfe};function Wfe(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth&&r.extensions.textureFloat?function Qft(e){return CU({defaultProps:C.getDefaultValues(y3),createGeometry:Xft,createLocationIterator:gs.fromGroup,getLoci:Sd,eachLocation:xd,setUpdateState:(t,n,r)=>{t.createGeometry=n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.traceOnly!==r.traceOnly||n.stride!==r.stride},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function Jft(e){return Hs({defaultProps:C.getDefaultValues(y3),createGeometry:Yft,createLocationIterator:gs.fromGroup,getLoci:Sd,eachLocation:xd,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.traceOnly!==r.traceOnly||n.stride!==r.stride},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}const $fe={...r1,...Mat,...qfe};function ept(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth&&r.extensions.textureFloat?function tpt(e){return function Rat(e,t){return N0({...e,setUpdateState:(n,r,i,o,s,a,c)=>{e.setUpdateState(n,r,i,o,s,a,c),Qo.areEqual(o.size,s.size)||(n.updateSize=!0)},geometryUtils:fl.Utils},t)}({defaultProps:C.getDefaultValues($fe),createGeometry:Zft,createLocationIterator:gs.fromStructure,getLoci:W0,eachLocation:q0,setUpdateState:(t,n,r)=>{t.createGeometry=n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.traceOnly!==r.traceOnly||n.stride!==r.stride},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function npt(e){return rh({defaultProps:C.getDefaultValues($fe),createGeometry:Kft,createLocationIterator:gs.fromStructure,getLoci:W0,eachLocation:q0,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.traceOnly!==r.traceOnly||n.stride!==r.stride},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}const Yfe={"element-sphere":(e,t)=>vi("Element sphere",e,t,Wfe),"intra-bond":(e,t)=>vi("Intra-unit bond cylinder",e,t,Vfe),"inter-bond":(e,t)=>Iu("Inter-unit bond cylinder",e,t,Hfe)},HV={...y3,traceOnly:C.Boolean(!1,{isHidden:!0}),...m3,...g3,includeParent:C.Boolean(!1),unitKinds:oC(["atomic"]),sizeFactor:C.Numeric(.15,{min:.01,max:10,step:.01}),sizeAspectRatio:C.Numeric(2/3,{min:.01,max:3,step:.01}),visuals:C.MultiSelect(["element-sphere","intra-bond","inter-bond"],C.objectToOptions(Yfe)),bumpFrequency:C.Numeric(0,{min:0,max:10,step:.1},rt.ShadingCategory)},opt={name:"ball-and-stick",label:"Ball & Stick",description:"Displays atoms as spheres and bonds as cylinders.",factory:function ipt(e,t){return yn.createMulti("Ball & Stick",e,t,ms,Yfe)},getParams:function rpt(e,t){if(Ve.getSize(t)>=Ve.Size.Huge){const r=C.clone(HV);return r.visuals.defaultValue=["element-sphere","intra-bond"],r}return HV},defaultValues:C.getDefaultValues(HV),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"physical"},isApplicable:e=>e.elementCount>0,getData:(e,t)=>t.includeParent?e.asParent():e,mustRecreate:(e,t)=>e.includeParent!==t.includeParent};function spt(e,t,n,r,i){const{links:o,elements:s}=t.carbohydrates,{linkSizeFactor:a}=r,c=nt.create(t),u={linkCount:o.length,position:(f,p,m)=>{const h=o[m];v.copy(f,s[h.carbohydrateIndexA].geometry.center),v.copy(p,s[h.carbohydrateIndexB].geometry.center)},radius:f=>{const m=s[o[f].carbohydrateIndexA],h=m.unit.rings.all[m.ringIndex];return c.unit=m.unit,c.element=m.unit.elements[h[0]],n.size.size(c)*a}},{mesh:l,boundingSphere:d}=B0(0,u,r,i);if(d)l.setBoundingSphere(d);else if(l.triangleCount>0){const f=_e.expand(_e(),t.boundary.sphere,1*a);l.setBoundingSphere(f)}return l}const Xfe={...hs,...F0,linkSizeFactor:C.Numeric(.3,{min:0,max:3,step:.01})};function apt(e){return rh({defaultProps:C.getDefaultValues(Xfe),createGeometry:spt,createLocationIterator:cpt,getLoci:upt,eachLocation:lpt,setUpdateState:(t,n,r)=>{t.createGeometry=n.linkSizeFactor!==r.linkSizeFactor||n.radialSegments!==r.radialSegments||n.linkCap!==r.linkCap}},e)}function cpt(e){const{elements:t,links:n}=e.carbohydrates,r=n.length,o=nt.create(e);return Mr(r,1,1,a=>{const u=t[n[a].carbohydrateIndexA],l=u.unit.rings.all[u.ringIndex];return o.unit=u.unit,o.element=u.unit.elements[l[0]],o},!0)}function upt(e,t,n){const{objectId:r,groupId:i}=e;if(n===r){const{links:o,elements:s}=t.carbohydrates,a=o[i],c=s[a.carbohydrateIndexA],u=s[a.carbohydrateIndexB];return De.union(iC(t,c.unit,c.residueIndex,c.altId),iC(t,u.unit,u.residueIndex,u.altId))}return $n}const qV=new Set;function lpt(e,t,n){let r=!1;if(!De.is(e)||!Ve.areEquivalent(e.structure,t))return!1;const{getLinkIndices:i}=t.carbohydrates;for(const{unit:o,indices:s}of e.elements)Ee.isAtomic(o)&&(qV.clear(),Fe.forEach(s,a=>{const c=i(o,o.elements[a]);for(let u=0,l=c.length;u{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail}},e)}function kpt(e){const t=e.carbohydrates.elements,n=2*t.length,i=nt.create(e);return Mr(n,1,1,function o(a,c){const u=t[Math.floor(a/2)],l=u.unit.rings.all[u.ringIndex];return i.unit=u.unit,i.element=u.unit.elements[l[0]],i},!0,function s(a,c){return a%2==1})}function Npt(e,t,n){const{objectId:r,groupId:i}=e;if(n===r){const o=t.carbohydrates.elements[Math.floor(i/2)];return iC(t,o.unit,o.residueIndex,o.altId)}return $n}const rz=new Set;function Fpt(e,t,n){const{getElementIndices:r}=t.carbohydrates;let i=!1;if(!De.is(e)||!Ve.areEquivalent(e.structure,t))return!1;for(const{unit:o,indices:s}of e.elements)Ee.isAtomic(o)&&(rz.clear(),Fe.forEach(s,a=>{const c=r(o,o.elements[a]);for(let u=0,l=c.length;u{const h=o[m];h.fromCarbohydrate?(v.copy(f,s[h.carbohydrateIndex].geometry.center),h.elementUnit.conformation.position(h.elementUnit.elements[h.elementIndex],p)):(h.elementUnit.conformation.position(h.elementUnit.elements[h.elementIndex],f),v.copy(p,s[h.carbohydrateIndex].geometry.center))},radius:f=>{const p=o[f];if(p.fromCarbohydrate){const m=s[p.carbohydrateIndex],h=m.unit.rings.all[m.ringIndex];c.unit=m.unit,c.element=m.unit.elements[h[0]]}else c.unit=p.elementUnit,c.element=p.elementUnit.elements[p.elementIndex];return n.size.size(c)*a},style:f=>{const p=o[f],h=Qd(p.elementUnit.model.atomicHierarchy.atoms.type_symbol.value(p.elementUnit.elements[p.elementIndex]));return d2.has(h)?1:0}},{mesh:l,boundingSphere:d}=B0(0,u,r,i);if(d)l.setBoundingSphere(d);else if(l.triangleCount>0){const f=_e.expand(_e(),t.boundary.sphere,1*a);l.setBoundingSphere(f)}return l}const ope={...hs,...F0,terminalLinkSizeFactor:C.Numeric(.2,{min:0,max:3,step:.01})};function Opt(e){return rh({defaultProps:C.getDefaultValues(ope),createGeometry:Bpt,createLocationIterator:Lpt,getLoci:Upt,eachLocation:Vpt,setUpdateState:(t,n,r)=>{t.createGeometry=n.terminalLinkSizeFactor!==r.terminalLinkSizeFactor||n.radialSegments!==r.radialSegments||n.linkCap!==r.linkCap}},e)}function Lpt(e){const{elements:t,terminalLinks:n}=e.carbohydrates,r=n.length,o=nt.create(e);return Mr(r,1,1,a=>{const c=n[a];if(c.fromCarbohydrate){const u=t[c.carbohydrateIndex],l=u.unit.rings.all[u.ringIndex];o.unit=u.unit,o.element=u.unit.elements[l[0]]}else o.unit=c.elementUnit,o.element=c.elementUnit.elements[c.elementIndex];return o},!0)}function Upt(e,t,n){const{objectId:r,groupId:i}=e;if(n===r){const{terminalLinks:o,elements:s}=t.carbohydrates,a=o[i],c=s[a.carbohydrateIndex];return De.union(iC(t,c.unit,c.residueIndex,c.altId),function xat(e,t,n){const{elements:r,model:i}=t,{label_alt_id:o}=i.atomicHierarchy.atoms,s=o.value(n);if(-1!==Fe.indexOf(r,n)){const{index:a}=i.atomicHierarchy.residueAtomSegments;return iC(e,t,a[n],s)}return De(e,[])}(t,a.elementUnit,a.elementUnit.elements[a.elementIndex]))}return $n}const iz=new Set;function Vpt(e,t,n){let r=!1;if(!De.is(e)||!Ve.areEquivalent(e.structure,t))return!1;const{getTerminalLinkIndices:i}=t.carbohydrates;for(const{unit:o,indices:s}of e.elements)Ee.isAtomic(o)&&(iz.clear(),Fe.forEach(s,a=>{const c=i(o,o.elements[a]);for(let u=0,l=c.length;uIu("Carbohydrate symbol mesh",e,t,Rpt),"carbohydrate-link":(e,t)=>Iu("Carbohydrate link cylinder",e,t,apt),"carbohydrate-terminal-link":(e,t)=>Iu("Carbohydrate terminal link cylinder",e,t,Opt)},ape={...ipe,...Xfe,...ope,visuals:C.MultiSelect(["carbohydrate-symbol","carbohydrate-link","carbohydrate-terminal-link"],C.objectToOptions(spe)),bumpFrequency:C.Numeric(0,{min:0,max:10,step:.1},rt.ShadingCategory)},jpt={name:"carbohydrate",label:"Carbohydrate",description:"Displays carbohydrate symbols (3D SNFG).",factory:function Gpt(e,t){return yn.createMulti("Carbohydrate",e,t,ms,spe)},getParams:function zpt(e,t){return ape},defaultValues:C.getDefaultValues(ape),defaultColorTheme:{name:"carbohydrate-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.models.some(t=>sn.hasCarbohydrate(t))};function cpe(e,t){switch(e.kind){case 0:return function Hpt(e,t){const n=e.model.atomicRanges.cyclicPolymerMap,r=wr.transientSegments(AC(e),e.elements),i=en.transientSegments(e.model.atomicHierarchy.residueAtomSegments,e.elements),o=e.model.atomicHierarchy.derived.residue.traceElementIndex,{moleculeType:s}=e.model.atomicHierarchy.derived.residue;let a=-1,c=-1,u=!0,l=-1,d=0;for(;r.hasNext;){for(u=!0,l=d,i.setSegment(r.move());i.hasNext;){if(u){const p=i.move().index;if(++d,!i.hasNext)continue;u=!1,c=p}a=c,c=i.move().index,t(o[a],o[c],d-1,d,s[a]),++d}n.has(c)&&(a=c,c=n.get(a),t(o[a],o[c],d-1,l,s[a]))}}(e,t);case 1:case 2:return function qpt(e,t){const n=wr.transientSegments(AC(e),e.elements),{elements:r}=e;let i=!0,o=0;for(;n.hasNext;){i=!0;const s=n.move();for(let u=s.start,l=s.end;ul)continue;i=!1}t(r[u-1],r[u],o-1,o,0),++o}}}(e,t)}}function upe(e,t){switch(e.kind){case 0:return function Wpt(e,t){const n=wr.transientSegments(AC(e),e.elements),r=en.transientSegments(e.model.atomicHierarchy.residueAtomSegments,e.elements),i=e.model.atomicHierarchy.derived.residue.traceElementIndex;let o=0;for(;n.hasNext;)for(r.setSegment(n.move());r.hasNext;)t(i[r.move().index],o),++o}(e,t);case 1:case 2:return function $pt(e,t){const n=wr.transientSegments(AC(e),e.elements),{elements:r}=e;let i=0;for(;n.hasNext;){const o=n.move();for(let c=o.start,u=o.end;c({}),isApplicable:e=>!0,obtain:function(){var e=ie(function*(t,n){return{value:Zpt(n)}});return function(n,r){return e.apply(this,arguments)}}()});function Cd(e){return cr.is(e,2)}function sz(e,t,n={}){switch(e.kind){case 0:return new Jpt(e,t,n);case 1:case 2:return new eht(e,t)}}const _3=cr.create(536870912);function dpe(e,t){return{center:nt.create(e,t),centerPrev:nt.create(e,t),centerNext:nt.create(e,t),first:!1,last:!1,initial:!1,final:!1,secStrucFirst:!1,secStrucLast:!1,secStrucType:_3,moleculeType:0,coarseBackboneFirst:!1,coarseBackboneLast:!1,isCoarseBackbone:!1,p0:v(),p1:v(),p2:v(),p3:v(),p4:v(),d12:v(),d23:v()}}const on=v(),x3=v(),S3=v();class Jpt{atomicPos(t,n){-1!==n&&(t[0]=this.atomicConformation.x[n],t[1]=this.atomicConformation.y[n],t[2]=this.atomicConformation.z[n])}pos(t,n,r){const i=this.traceElementIndex[n];this.helixOrientationCenters&&Cd(r)?v.fromArray(t,this.helixOrientationCenters,3*n):this.atomicPos(t,i)}updateResidueSegmentRange(t){const{index:n}=this.residueAtomSegments;this.residueSegmentMin=n[this.polymerRanges[2*t.index]],this.residueSegmentMax=n[this.polymerRanges[2*t.index+1]]}getResidueIndex(t){if(tthis.residueSegmentMax){const n=this.cyclicPolymerMap.get(this.residueSegmentMax);t=void 0!==n?n+(t-this.residueSegmentMax-1):this.residueSegmentMax}return t}getSecStruc(t){if(this.secondaryStructure){const{type:n,getIndex:r}=this.secondaryStructure,i=n[r(t)];return Cd(i)?2:i}return _3}setControlPoint(t,n,r,i,o){(function Qpt(e){return cr.is(e,4)})(o)||this.helixOrientationCenters&&Cd(o)?v.scale(t,v.add(t,n,v.add(t,i,v.add(t,r,r))),1/4):v.copy(t,r)}setFromToVector(t,n,r){this.value.isCoarseBackbone||this.helixOrientationCenters&&Cd(r)?v.set(t,1,0,0):(this.atomicPos(x3,this.directionFromElementIndex[n]),this.atomicPos(S3,this.directionToElementIndex[n]),v.sub(t,S3,x3))}setDirection(t,n,r,i){v.matchDirection(x3,n,r),v.matchDirection(S3,i,r),v.scale(t,v.add(t,x3,v.add(t,S3,v.add(t,r,r))),1/4)}move(){const{residueIt:t,polymerIt:n,value:r}=this;if(0===this.state)for(;n.hasNext;)if(this.polymerSegment=n.move(),t.setSegment(this.polymerSegment),this.updateResidueSegmentRange(this.polymerSegment),t.hasNext){this.state=1;const i=this.residueAtomSegments.index[this.unit.elements[this.polymerSegment.start]],o=this.getResidueIndex(i-1);this.currSecStrucType=i===o?_3:this.getSecStruc(o),this.nextSecStrucType=this.getSecStruc(i),this.currCoarseBackbone=-1===this.directionFromElementIndex[o]||-1===this.directionToElementIndex[o],this.nextCoarseBackbone=-1===this.directionFromElementIndex[i]||-1===this.directionToElementIndex[i];break}if(1===this.state){const{index:i}=t.move(),o=this.getResidueIndex(i-3),s=this.getResidueIndex(i-2),a=this.getResidueIndex(i-1),c=this.getResidueIndex(i+1),u=this.getResidueIndex(i+2),l=this.getResidueIndex(i+3);this.prevSecStrucType=this.getSecStruc(a),this.currSecStrucType=this.getSecStruc(i),this.nextSecStrucType=i===c?_3:this.getSecStruc(c),this.prevCoarseBackbone=this.currCoarseBackbone,this.currCoarseBackbone=this.nextCoarseBackbone,this.nextCoarseBackbone=-1===this.directionFromElementIndex[c]||-1===this.directionToElementIndex[c],r.secStrucType=this.currSecStrucType,r.secStrucFirst=this.prevSecStrucType!==this.currSecStrucType,r.secStrucLast=this.currSecStrucType!==this.nextSecStrucType,r.isCoarseBackbone=this.currCoarseBackbone,r.coarseBackboneFirst=this.prevCoarseBackbone!==this.currCoarseBackbone,r.coarseBackboneLast=this.currCoarseBackbone!==this.nextCoarseBackbone,r.first=i===this.residueSegmentMin,r.last=i===this.residueSegmentMax,r.moleculeType=this.moleculeType[i],r.initial=i===a,r.final=i===c,r.centerPrev.element=this.traceElementIndex[a],r.center.element=this.traceElementIndex[i],r.centerNext.element=this.traceElementIndex[c];const d=this.getSecStruc(o),f=this.getSecStruc(s),p=this.getSecStruc(a),m=this.getSecStruc(i),h=this.getSecStruc(c),g=this.getSecStruc(u),y=this.getSecStruc(l);this.pos(this.p0,o,d),this.pos(this.p1,s,f),this.pos(this.p2,a,p),this.pos(this.p3,i,m),this.pos(this.p4,c,h),this.pos(this.p5,u,g),this.pos(this.p6,l,y);const b=Cd(d),x=Cd(f),_=Cd(p),S=Cd(m),A=Cd(h),E=Cd(g),w=Cd(y);this.helixOrientationCenters&&(S!==_?S?(v.copy(this.p0,this.p3),v.copy(this.p1,this.p3),v.copy(this.p2,this.p3)):_&&(v.scale(on,v.sub(on,this.p2,this.p3),2),v.add(this.p2,this.p3,on),v.add(this.p1,this.p2,on),v.add(this.p0,this.p1,on)):S!==x?S?(v.copy(this.p0,this.p2),v.copy(this.p1,this.p2)):x&&(v.scale(on,v.sub(on,this.p1,this.p2),2),v.add(this.p1,this.p2,on),v.add(this.p0,this.p1,on)):S!==b&&(S?v.copy(this.p0,this.p1):b&&(v.scale(on,v.sub(on,this.p0,this.p1),2),v.add(this.p0,this.p1,on))),S!==A?S?(v.copy(this.p4,this.p3),v.copy(this.p5,this.p3),v.copy(this.p6,this.p3)):A&&(v.scale(on,v.sub(on,this.p4,this.p3),2),v.add(this.p4,this.p3,on),v.add(this.p5,this.p4,on),v.add(this.p6,this.p5,on)):S!==E?S?(v.copy(this.p5,this.p4),v.copy(this.p6,this.p4)):E&&(v.scale(on,v.sub(on,this.p5,this.p4),2),v.add(this.p5,this.p4,on),v.add(this.p6,this.p5,on)):S!==w&&(S?v.copy(this.p6,this.p5):w&&(v.scale(on,v.sub(on,this.p6,this.p5),2),v.add(this.p6,this.p5,on)))),this.setFromToVector(this.d01,a,p),this.setFromToVector(this.d12,i,m),this.setFromToVector(this.d23,c,h),this.setFromToVector(this.d34,u,g);const D=S&&this.helixOrientationCenters,I=1.5;i===a||m!==p&&D?(v.setMagnitude(on,v.sub(on,this.p3,this.p4),I),v.add(this.p2,this.p3,on),v.add(this.p1,this.p2,on),v.add(this.p0,this.p1,on)):a===s||m!==f&&D?(v.setMagnitude(on,v.sub(on,this.p2,this.p3),I),v.add(this.p1,this.p2,on),v.add(this.p0,this.p1,on)):(s===o||m!==d&&D)&&(v.setMagnitude(on,v.sub(on,this.p1,this.p2),I),v.add(this.p0,this.p1,on)),i===c||m!==h&&D?(v.setMagnitude(on,v.sub(on,this.p3,this.p2),I),v.add(this.p4,this.p3,on),v.add(this.p5,this.p4,on),v.add(this.p6,this.p5,on)):c===u||m!==g&&D?(v.setMagnitude(on,v.sub(on,this.p4,this.p3),I),v.add(this.p5,this.p4,on),v.add(this.p6,this.p5,on)):(u===l||m!==y&&D)&&(v.setMagnitude(on,v.sub(on,this.p5,this.p4),I),v.add(this.p6,this.p5,on)),this.setControlPoint(r.p0,this.p0,this.p1,this.p2,f),this.setControlPoint(r.p1,this.p1,this.p2,this.p3,p),this.setControlPoint(r.p2,this.p2,this.p3,this.p4,m),this.setControlPoint(r.p3,this.p3,this.p4,this.p5,h),this.setControlPoint(r.p4,this.p4,this.p5,this.p6,g),this.setDirection(r.d12,this.d01,this.d12,this.d23),this.setDirection(r.d23,this.d12,this.d23,this.d34),t.hasNext||(this.state=0)}return this.hasNext=t.hasNext||n.hasNext,this.value}constructor(t,n,r={}){var i;if(this.unit=t,this.state=0,this.p0=v(),this.p1=v(),this.p2=v(),this.p3=v(),this.p4=v(),this.p5=v(),this.p6=v(),this.d01=v(),this.d12=v(),this.d23=v(),this.d34=v(),this.hasNext=!1,this.atomicConformation=t.model.atomicConformation,this.residueAtomSegments=t.model.atomicHierarchy.residueAtomSegments,this.polymerRanges=t.model.atomicRanges.polymerRanges,this.traceElementIndex=t.model.atomicHierarchy.derived.residue.traceElementIndex,this.directionFromElementIndex=t.model.atomicHierarchy.derived.residue.directionFromElementIndex,this.directionToElementIndex=t.model.atomicHierarchy.derived.residue.directionToElementIndex,this.moleculeType=t.model.atomicHierarchy.derived.residue.moleculeType,this.cyclicPolymerMap=t.model.atomicRanges.cyclicPolymerMap,this.polymerIt=wr.transientSegments(this.polymerRanges,t.elements),this.residueIt=en.transientSegments(this.residueAtomSegments,t.elements),this.value=dpe(n,t),this.hasNext=this.residueIt.hasNext&&this.polymerIt.hasNext,r.ignoreSecondaryStructure||(this.secondaryStructure=null===(i=Xu.get(n).value)||void 0===i?void 0:i.get(t.invariantId)),r.useHelixOrientation){const o=oz.get(t.model).value;if(!o)throw new Error("missing helix-orientation");this.helixOrientationCenters=o.centers}}}class eht{getElementIndex(t){return Math.min(Math.max(this.polymerSegment.start,t),this.polymerSegment.end-1)}pos(t,n){const r=this.unit.elements[n];t[0]=this.conformation.x[r],t[1]=this.conformation.y[r],t[2]=this.conformation.z[r]}move(){if(0===this.state)for(;this.polymerIt.hasNext;)if(this.polymerSegment=this.polymerIt.move(),this.elementIndex=this.polymerSegment.start,this.elementIndex=this.polymerSegment.end&&(this.state=0)}return this.hasNext=this.elementIndex+1=0)){a=u;break}}if(s<0)return!1;let c=s;for(let u=o;u>a;u--){const l=n[u];if(l<0)continue;const d=Fe.indexOf(t,l);if(d>=0){c=d;break}}return r(Ce.ofRange(e+s,e+c))}function xpe(e,t,n,r,i){let o=!1;const{elements:s}=i.unit,{traceElementIndex:a}=i.unit.model.atomicHierarchy.derived.residue,{index:c}=i.unit.model.atomicHierarchy.residueAtomSegments,u=n(i.unit);if(Ce.is(i.indices))o=0===Ce.start(i.indices)&&Ce.end(i.indices)===i.unit.elements.length?r(Ce.ofBounds(e,e+t))||o:_pe(e,u,a,r,c[s[Ce.min(i.indices)]],c[s[Ce.max(i.indices)]])||o;else{const{indices:l}=i;for(let d=0,f=l.length;d1)break;m=g,h++}d=h-1,o=_pe(e,u,a,r,p,m)||o}}return o}function uht(e){return e.polymerElements}function X0(e,t,n){let r=!1;if(!De.is(e))return!1;const{structure:i,group:o}=t;if(!Ve.areEquivalent(e.structure,i))return!1;const s=o.units[0].polymerElements.length;for(const a of e.elements){if(!o.unitIndexMap.has(a.unit.id))continue;const c=o.unitIndexMap.get(a.unit.id)*s;if(Ee.isAtomic(a.unit))r=xpe(c,s,uht,n,a)||r;else if(Ce.is(a.indices)){const u=c+Ce.start(a.indices),l=c+Ce.end(a.indices);r=n(Ce.ofBounds(u,l))||r}else for(let u=0,l=a.indices.length;u{const l=Fe.indexOf(a.unit.gapElements,a.unit.elements[u]);-1!==l&&n(Ce.ofSingleton(c*s+l))&&(r=!0)})}}return r}function K0(e,t,n){const{objectId:r,instanceId:i,groupId:o}=e;if(n===r){const{structure:s,group:a}=t,c=a.units[i];if(Ee.isAtomic(c))return Lle(s,c,c.nucleotideElements[o])}return $n}function fht(e){return e.nucleotideElements}function Z0(e,t,n){let r=!1;if(!De.is(e))return!1;const{structure:i,group:o}=t;if(!Ve.areEquivalent(e.structure,i))return!1;const s=o.units[0];if(!Ee.isAtomic(s))return!1;const{nucleotideElements:a}=s,c=a.length;for(const u of e.elements){if(!Ee.isAtomic(u.unit)||!o.unitIndexMap.has(u.unit.id))continue;const l=o.unitIndexMap.get(u.unit.id)*c;Ee.isAtomic(u.unit)&&(r=xpe(l,c,fht,n,u)||r)}return r}!function(e){e.fromGroup=function t(n,r){const{group:i,structure:o}=n,s=i.units[0].polymerElements,a=s.length,c=i.units.length,u=nt.create(o),d=!!r?.asSecondary;return Mr(a,c,1,(p,m)=>(u.unit=i.units[m],u.element=s[p],u),!1,function f(p,m){return d})}}(lh||(lh={})),function(e){e.fromGroup=function t(n){const{group:r,structure:i}=n,o=r.units[0].gapElements,s=o.length,a=r.units.length,c=nt.create(i);return Mr(s,a,1,(l,d)=>(c.unit=r.units[d],c.element=o[l],c))}}(gz||(gz={})),function(e){e.fromGroup=function t(n){const{group:r,structure:i}=n,o=r.units[0],s=Ee.isAtomic(o)?o.nucleotideElements:[],a=s.length,c=r.units.length,u=nt.create(i);return Mr(a,c,1,(d,f)=>(u.unit=r.units[f],u.element=s[d],u))}}(dh||(dh={}));const pht=v(),hht=v();function Q0(e,t){const{model:n,conformation:r}=e,{residueAtomSegments:i,atoms:o,index:s}=n.atomicHierarchy,{label_comp_id:a}=o,c=a.value(i.offsets[t]);let u=rFe(c),l=iFe(c);if(!u&&!l){const d=s.findAtomOnResidue(t,"C4"),f=s.findAtomOnResidue(t,"N9");-1!==d&&-1!==f&&v.distance(r.invariantPosition(d,pht),r.invariantPosition(f,hht))<1.6?u=!0:l=!0}return{isPurine:u,isPyrimidine:l}}function ey(e,t,n){const r=t.model.atomicHierarchy.index,{traceElementIndex:i}=t.model.atomicHierarchy.derived.residue;return e.trace=i[n],e.N1=r.findAtomOnResidue(n,"N1"),e.C2=r.findAtomOnResidue(n,"C2"),e.N3=r.findAtomOnResidue(n,"N3"),e.C4=r.findAtomOnResidue(n,"C4"),e.C5=r.findAtomOnResidue(n,"C5"),-1===e.C5&&(e.C5=r.findAtomOnResidue(n,"N5")),e.C6=r.findAtomOnResidue(n,"C6"),e.N7=r.findAtomOnResidue(n,"N7"),-1===e.N7&&(e.N7=r.findAtomOnResidue(n,"C7")),e.C8=r.findAtomOnResidue(n,"C8"),e.N9=r.findAtomOnResidue(n,"N9"),e}function y1(e){return-1!==e.trace&&-1!==e.N1&&-1!==e.C2&&-1!==e.N3&&-1!==e.C4&&-1!==e.C5&&-1!==e.C6&&-1!==e.N7&&-1!==e.C8&&-1!==e.N9}function ty(e,t,n){const r=t.model.atomicHierarchy.index,{traceElementIndex:i}=t.model.atomicHierarchy.derived.residue;return e.trace=i[n],e.N1=r.findAtomOnResidue(n,"N1"),-1===e.N1&&(e.N1=r.findAtomOnResidue(n,"C1")),e.C2=r.findAtomOnResidue(n,"C2"),e.N3=r.findAtomOnResidue(n,"N3"),e.C4=r.findAtomOnResidue(n,"C4"),e.C5=r.findAtomOnResidue(n,"C5"),e.C6=r.findAtomOnResidue(n,"C6"),e}function b1(e){return-1!==e.trace&&-1!==e.N1&&-1!==e.C2&&-1!==e.N3&&-1!==e.C4&&-1!==e.C5&&-1!==e.C6}function IC(e,t,n){const r=t.model.atomicHierarchy.index,{traceElementIndex:i}=t.model.atomicHierarchy.derived.residue;return e.trace=i[n],e.C1_1=r.findAtomOnResidue(n,"C1'"),e.C2_1=r.findAtomOnResidue(n,"C2'"),e.C3_1=r.findAtomOnResidue(n,"C3'"),e.C4_1=r.findAtomOnResidue(n,"C4'"),e.O4_1=r.findAtomOnResidue(n,"O4'"),e}function TC(e){return-1!==e.trace&&-1!==e.C1_1&&-1!==e.C2_1&&-1!==e.C3_1&&-1!==e.C4_1&&-1!==e.O4_1}const T3=v(),yz=v(),Spe=v(),Cpe=v(),wpe=v(),Ape=v(),D3=v(),bz=v(),vz=v(),Ipe=v(),DC=le.identity(),mht=v(),Tpe=x5(),Dpe={sizeFactor:C.Numeric(.2,{min:0,max:10,step:.01}),thicknessFactor:C.Numeric(1,{min:0,max:2,step:.01}),radialSegments:C.Numeric(16,{min:2,max:56,step:2},rt.CustomQualityParamInfo)};function ght(e,t,n,r,i,o){if(!Ee.isAtomic(t))return Nt.createEmpty(o);const s=t.nucleotideElements.length;if(!s)return Nt.createEmpty(o);const{sizeFactor:a,thicknessFactor:c,radialSegments:u}=i,l=s*(Tpe.vertices.length/3+2*u),d=at.createState(l,l/4,o),{elements:f,model:p,conformation:m}=t,{chainAtomSegments:h,residueAtomSegments:g}=p.atomicHierarchy,{moleculeType:y}=p.atomicHierarchy.derived.residue,b=en.transientSegments(h,f),x=en.transientSegments(g,f),_=1*a,A=c*a*2,E={radiusTop:_,radiusBottom:_,radialSegments:u,bottomCap:!0};let w=0;for(;b.hasNext;)for(x.setSegment(b.move());x.hasNext;){const{index:R}=x.move();if(Ya(y[R])){const T={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};let M=-1,N=-1,V=-1,F=-1,G=-1,L=4.5;const{isPurine:z,isPyrimidine:j}=Q0(t,R);z?(L=4.5,ey(T,t,R),M=T.N1,N=T.C4,V=T.C6,F=T.C2,G=T.N9):j&&(L=3,ty(T,t,R),M=T.N3,N=T.C6,V=T.C4,F=T.C2,G=T.N1),-1!==G&&-1!==T.trace&&(m.invariantPosition(G,wpe),m.invariantPosition(T.trace,Ape),d.currentGroup=w,Hn(d,wpe,Ape,1,E),-1!==M&&-1!==N&&-1!==V&&-1!==F&&(m.invariantPosition(M,T3),m.invariantPosition(N,yz),m.invariantPosition(V,Spe),m.invariantPosition(F,Cpe),v.normalize(D3,v.sub(D3,yz,T3)),v.normalize(bz,v.sub(bz,Cpe,Spe)),v.normalize(vz,v.cross(vz,D3,bz)),le.targetTo(DC,T3,yz,vz),v.scaleAndAdd(Ipe,T3,D3,L/2-.2),le.scale(DC,DC,v.set(mht,4.5,A,L)),le.setTranslation(DC,Ipe),at.addPrimitive(d,DC,Tpe))),++w}}const D=at.getMesh(d),I=_e.expand(_e(),t.boundary.sphere,_);return D.setBoundingSphere(I),D}C.getDefaultValues(Dpe);const Epe={...hs,...Dpe};function yht(e){return Hs({defaultProps:C.getDefaultValues(Epe),createGeometry:ght,createLocationIterator:dh.fromGroup,getLoci:K0,eachLocation:Z0,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.thicknessFactor!==r.thicknessFactor||n.radialSegments!==r.radialSegments}},e)}const E3=v(),jm=v(),P3=v(),M3=v(),v1=v(),_1=v(),R3=v(),Ppe=v(),Mpe=v(),k3=v(),Hm=v(),Rpe={sizeFactor:C.Numeric(.2,{min:0,max:10,step:.01}),thicknessFactor:C.Numeric(1,{min:0,max:2,step:.01}),radialSegments:C.Numeric(16,{min:2,max:56,step:2},rt.CustomQualityParamInfo),detail:C.Numeric(0,{min:0,max:3,step:1},rt.CustomQualityParamInfo)},N3=(C.getDefaultValues(Rpe),new Float32Array(54)),bht=new Uint32Array([0,1,2,3,4,5,6,7,16,17,14,15,12,13,8,9,10,11,0,1]),vht=new Uint32Array([8,12,14,16,6,4,2,0,10]),_ht=new Uint32Array([9,11,1,3,5,7,17,15,13]),F3=new Float32Array(36),xht=new Uint32Array([0,1,2,3,4,5,6,7,8,9,10,11,0,1]),Sht=new Uint32Array([0,10,8,6,4,2]),Cht=new Uint32Array([1,3,5,7,9,11]),kpe=v();function Npe(e,t,...n){for(let r=0,i=n.length;r{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.thicknessFactor!==r.thicknessFactor||n.radialSegments!==r.radialSegments}},e)}const x1=v(),B3=v(),O3=v(),S1=v(),C1=v(),L3=v(),Bpe=v(),Ope=v(),Lpe=v(),U3=v(),_z=v(),V3=v(),z3=v(),xz=v(),w1=v(),Ws=v(),A1=v(),Upe={sizeFactor:C.Numeric(.2,{min:0,max:10,step:.01}),thicknessFactor:C.Numeric(1,{min:0,max:2,step:.01})},G3=(C.getDefaultValues(Upe),new Float32Array(54)),Iht=new Uint32Array([0,1,2,3,4,5,6,7,16,17,14,15,12,13,8,9,10,11,0,1]),Tht=new Uint32Array([8,12,14,16,6,4,2,0,10]),Dht=new Uint32Array([9,11,1,3,5,7,17,15,13]),j3=new Float32Array(36),Eht=new Uint32Array([2,3,4,5,6,7,8,9,10,11,2,3]),Pht=new Uint32Array([0,10,8,6,4,2,10]),Mht=new Uint32Array([1,3,5,7,9,11,3]),H3=new Float32Array(36),Rht=new Uint32Array([0,1,2,3,4,5,6,7,8,9,10,11,0,1]),kht=new Uint32Array([0,10,8,6,4,2]),Nht=new Uint32Array([1,3,5,7,9,11]),Vpe=v();function Sz(e,t,...n){for(let r=0,i=n.length;r{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.thicknessFactor!==r.thicknessFactor}},e)}const $s=v(),Kr=v(),ys=v(),bs=v(),fo=v(),po=v(),vs=v(),kf=v(),Nf=v(),Uo=v(),Vo=v(),Ff=v(),Gc=v(),Bf=v(),Of=v(),Cz={...hs,...wU,sizeFactor:C.Numeric(.3,{min:0,max:10,step:.01}),radialSegments:C.Numeric(16,{min:2,max:56,step:2},rt.CustomQualityParamInfo),tryUseImpostor:C.Boolean(!0)};function Oht(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth?function Uht(e){return AU({defaultProps:C.getDefaultValues(Cz),createGeometry:Lht,createLocationIterator:dh.fromGroup,getLoci:K0,eachLocation:Z0,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function zht(e){return Hs({defaultProps:C.getDefaultValues(Cz),createGeometry:Vht,createLocationIterator:dh.fromGroup,getLoci:K0,eachLocation:Z0,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.radialSegments!==r.radialSegments},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}function Lht(e,t,n,r,i,o){if(!Ee.isAtomic(t))return oc.createEmpty(o);const s=t.nucleotideElements.length;if(!s)return oc.createEmpty(o);const a=15*s,c=aC.create(a,a/4,o),{elements:u,model:l,conformation:d}=t,{chainAtomSegments:f,residueAtomSegments:p}=l.atomicHierarchy,{moleculeType:m}=l.atomicHierarchy.derived.residue,h=en.transientSegments(f,u),g=en.transientSegments(p,u);let y=0;for(;h.hasNext;)for(g.setSegment(h.move());g.hasNext;){const{index:S}=g.move();if(Ya(m[S])){const A={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};IC(A,t,S),TC(A)&&(d.invariantPosition(A.C1_1,Vo),d.invariantPosition(A.C2_1,Ff),d.invariantPosition(A.C3_1,Gc),d.invariantPosition(A.C4_1,Bf),d.invariantPosition(A.O4_1,Of),d.invariantPosition(A.trace,$s),c.add(Gc[0],Gc[1],Gc[2],$s[0],$s[1],$s[2],1,!0,!0,2,y),c.add(Gc[0],Gc[1],Gc[2],Bf[0],Bf[1],Bf[2],1,!0,!0,2,y),c.add(Bf[0],Bf[1],Bf[2],Of[0],Of[1],Of[2],1,!0,!0,2,y),c.add(Of[0],Of[1],Of[2],Vo[0],Vo[1],Vo[2],1,!0,!0,2,y),c.add(Vo[0],Vo[1],Vo[2],Ff[0],Ff[1],Ff[2],1,!0,!0,2,y),c.add(Ff[0],Ff[1],Ff[2],Gc[0],Gc[1],Gc[2],1,!0,!0,2,y));const{isPurine:E,isPyrimidine:w}=Q0(t,S);E?(ey(A,t,S),-1!==A.C1_1&&-1!==A.N9?(d.invariantPosition(A.C1_1,Vo),d.invariantPosition(A.N9,Uo),c.add(Uo[0],Uo[1],Uo[2],Vo[0],Vo[1],Vo[2],1,!0,!0,2,y)):-1!==A.N9&&-1!==A.trace&&(d.invariantPosition(A.N9,Uo),d.invariantPosition(A.trace,$s),c.add(Uo[0],Uo[1],Uo[2],$s[0],$s[1],$s[2],1,!0,!0,2,y)),y1(A)&&(d.invariantPosition(A.N1,Kr),d.invariantPosition(A.C2,ys),d.invariantPosition(A.N3,bs),d.invariantPosition(A.C4,fo),d.invariantPosition(A.C5,po),d.invariantPosition(A.C6,vs),d.invariantPosition(A.N7,kf),d.invariantPosition(A.C8,Nf),d.invariantPosition(A.N9,Uo),c.add(Uo[0],Uo[1],Uo[2],Nf[0],Nf[1],Nf[2],1,!0,!0,2,y),c.add(Nf[0],Nf[1],Nf[2],kf[0],kf[1],kf[2],1,!0,!0,2,y),c.add(kf[0],kf[1],kf[2],po[0],po[1],po[2],1,!0,!0,2,y),c.add(po[0],po[1],po[2],vs[0],vs[1],vs[2],1,!0,!0,2,y),c.add(vs[0],vs[1],vs[2],Kr[0],Kr[1],Kr[2],1,!0,!0,2,y),c.add(Kr[0],Kr[1],Kr[2],ys[0],ys[1],ys[2],1,!0,!0,2,y),c.add(ys[0],ys[1],ys[2],bs[0],bs[1],bs[2],1,!0,!0,2,y),c.add(bs[0],bs[1],bs[2],fo[0],fo[1],fo[2],1,!0,!0,2,y),c.add(fo[0],fo[1],fo[2],po[0],po[1],po[2],1,!0,!0,2,y),c.add(fo[0],fo[1],fo[2],Uo[0],Uo[1],Uo[2],1,!0,!0,2,y))):w&&(ty(A,t,S),-1!==A.C1_1&&-1!==A.N1?(d.invariantPosition(A.N1,Kr),d.invariantPosition(A.C1_1,Vo),c.add(Kr[0],Kr[1],Kr[2],Vo[0],Vo[1],Vo[2],1,!0,!0,2,y)):-1!==A.N1&&-1!==A.trace&&(d.invariantPosition(A.N1,Kr),d.invariantPosition(A.trace,$s),c.add(Kr[0],Kr[1],Kr[2],$s[0],$s[1],$s[2],1,!0,!0,2,y)),b1(A)&&(d.invariantPosition(A.N1,Kr),d.invariantPosition(A.C2,ys),d.invariantPosition(A.N3,bs),d.invariantPosition(A.C4,fo),d.invariantPosition(A.C5,po),d.invariantPosition(A.C6,vs),c.add(Kr[0],Kr[1],Kr[2],vs[0],vs[1],vs[2],1,!0,!0,2,y),c.add(vs[0],vs[1],vs[2],po[0],po[1],po[2],1,!0,!0,2,y),c.add(po[0],po[1],po[2],fo[0],fo[1],fo[2],1,!0,!0,2,y),c.add(fo[0],fo[1],fo[2],bs[0],bs[1],bs[2],1,!0,!0,2,y),c.add(bs[0],bs[1],bs[2],ys[0],ys[1],ys[2],1,!0,!0,2,y),c.add(ys[0],ys[1],ys[2],Kr[0],Kr[1],Kr[2],1,!0,!0,2,y))),++y}}const x=c.getCylinders(),_=_e.expand(_e(),t.boundary.sphere,1*i.sizeFactor);return x.setBoundingSphere(_),x}function Vht(e,t,n,r,i,o){if(!Ee.isAtomic(t))return Nt.createEmpty(o);const s=t.nucleotideElements.length;if(!s)return Nt.createEmpty(o);const{sizeFactor:a,radialSegments:c}=i,u=s*(15*c),l=at.createState(u,u/4,o),{elements:d,model:f,conformation:p}=t,{chainAtomSegments:m,residueAtomSegments:h}=f.atomicHierarchy,{moleculeType:g}=f.atomicHierarchy.derived.residue,y=en.transientSegments(m,d),b=en.transientSegments(h,d),x={radiusTop:1*a,radiusBottom:1*a,radialSegments:c};let _=0;for(;y.hasNext;)for(b.setSegment(y.move());b.hasNext;){const{index:E}=b.move();if(Ya(g[E])){const w={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};l.currentGroup=_,IC(w,t,E),TC(w)&&(p.invariantPosition(w.C1_1,Vo),p.invariantPosition(w.C2_1,Ff),p.invariantPosition(w.C3_1,Gc),p.invariantPosition(w.C4_1,Bf),p.invariantPosition(w.O4_1,Of),p.invariantPosition(w.trace,$s),Hn(l,Gc,$s,1,x),Hn(l,Gc,Bf,1,x),Hn(l,Bf,Of,1,x),Hn(l,Of,Vo,1,x),Hn(l,Vo,Ff,1,x),Hn(l,Ff,Gc,1,x));const{isPurine:D,isPyrimidine:I}=Q0(t,E);D?(ey(w,t,E),-1!==w.C1_1&&-1!==w.N9?(p.invariantPosition(w.C1_1,Vo),p.invariantPosition(w.N9,Uo),Hn(l,Uo,Vo,1,x)):-1!==w.N9&&-1!==w.trace&&(p.invariantPosition(w.N9,Uo),p.invariantPosition(w.trace,$s),Hn(l,Uo,$s,1,x)),y1(w)&&(p.invariantPosition(w.N1,Kr),p.invariantPosition(w.C2,ys),p.invariantPosition(w.N3,bs),p.invariantPosition(w.C4,fo),p.invariantPosition(w.C5,po),p.invariantPosition(w.C6,vs),p.invariantPosition(w.N7,kf),p.invariantPosition(w.C8,Nf),p.invariantPosition(w.N9,Uo),Hn(l,Uo,Nf,1,x),Hn(l,Nf,kf,1,x),Hn(l,kf,po,1,x),Hn(l,po,vs,1,x),Hn(l,vs,Kr,1,x),Hn(l,Kr,ys,1,x),Hn(l,ys,bs,1,x),Hn(l,bs,fo,1,x),Hn(l,fo,po,1,x),Hn(l,fo,Uo,1,x))):I&&(ty(w,t,E),-1!==w.C1_1&&-1!==w.N1?(p.invariantPosition(w.N1,Kr),p.invariantPosition(w.C1_1,Vo),Hn(l,Kr,Vo,1,x)):-1!==w.N1&&-1!==w.trace&&(p.invariantPosition(w.N1,Kr),p.invariantPosition(w.trace,$s),Hn(l,Kr,$s,1,x)),b1(w)&&(p.invariantPosition(w.N1,Kr),p.invariantPosition(w.C2,ys),p.invariantPosition(w.N3,bs),p.invariantPosition(w.C4,fo),p.invariantPosition(w.C5,po),p.invariantPosition(w.C6,vs),Hn(l,Kr,vs,1,x),Hn(l,vs,po,1,x),Hn(l,po,fo,1,x),Hn(l,fo,bs,1,x),Hn(l,bs,ys,1,x),Hn(l,ys,Kr,1,x))),++_}}const S=at.getMesh(l),A=_e.expand(_e(),t.boundary.sphere,1*i.sizeFactor);return S.setBoundingSphere(A),S}const I1=v(),Cl=v(),wl=v(),Al=v(),Il=v(),Du=v(),Tl=v(),T1=v(),D1=v(),E1=v(),P1=v(),M1=v(),R1=v(),k1=v(),N1=v(),wz={...hs,...SU,sizeFactor:C.Numeric(.3,{min:0,max:10,step:.01}),detail:C.Numeric(0,{min:0,max:3,step:1},rt.CustomQualityParamInfo),tryUseImpostor:C.Boolean(!0)};function Ght(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth?function Hht(e){return CU({defaultProps:C.getDefaultValues(wz),createGeometry:jht,createLocationIterator:dh.fromGroup,getLoci:K0,eachLocation:Z0,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function Wht(e){return Hs({defaultProps:C.getDefaultValues(wz),createGeometry:qht,createLocationIterator:dh.fromGroup,getLoci:K0,eachLocation:Z0,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}function jht(e,t,n,r,i,o){if(!Ee.isAtomic(t))return fl.createEmpty(o);const s=t.nucleotideElements.length;if(!s)return fl.createEmpty(o);const a=15*s,c=f1.create(a,a/4,o),{elements:u,model:l,conformation:d}=t,{chainAtomSegments:f,residueAtomSegments:p}=l.atomicHierarchy,{moleculeType:m}=l.atomicHierarchy.derived.residue,h=en.transientSegments(f,u),g=en.transientSegments(p,u);let y=0;for(;h.hasNext;)for(g.setSegment(h.move());g.hasNext;){const{index:_}=g.move();if(Ya(m[_])){const S={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};IC(S,t,_),TC(S)&&(d.invariantPosition(S.C1_1,P1),d.invariantPosition(S.C2_1,M1),d.invariantPosition(S.C3_1,R1),d.invariantPosition(S.C4_1,k1),d.invariantPosition(S.O4_1,N1),d.invariantPosition(S.trace,I1),c.add(I1[0],I1[1],I1[2],y),c.add(R1[0],R1[1],R1[2],y),c.add(k1[0],k1[1],k1[2],y),c.add(N1[0],N1[1],N1[2],y),c.add(P1[0],P1[1],P1[2],y),c.add(M1[0],M1[1],M1[2],y));const{isPurine:A,isPyrimidine:E}=Q0(t,_);A?(ey(S,t,_),y1(S)&&(d.invariantPosition(S.N1,Cl),d.invariantPosition(S.C2,wl),d.invariantPosition(S.N3,Al),d.invariantPosition(S.C4,Il),d.invariantPosition(S.C5,Du),d.invariantPosition(S.C6,Tl),d.invariantPosition(S.N7,T1),d.invariantPosition(S.C8,D1),d.invariantPosition(S.N9,E1),c.add(E1[0],E1[1],E1[2],y),c.add(D1[0],D1[1],D1[2],y),c.add(T1[0],T1[1],T1[2],y),c.add(Du[0],Du[1],Du[2],y),c.add(Tl[0],Tl[1],Tl[2],y),c.add(Cl[0],Cl[1],Cl[2],y),c.add(wl[0],wl[1],wl[2],y),c.add(Al[0],Al[1],Al[2],y),c.add(Il[0],Il[1],Il[2],y))):E&&(ty(S,t,_),b1(S)&&(d.invariantPosition(S.N1,Cl),d.invariantPosition(S.C2,wl),d.invariantPosition(S.N3,Al),d.invariantPosition(S.C4,Il),d.invariantPosition(S.C5,Du),d.invariantPosition(S.C6,Tl),c.add(Cl[0],Cl[1],Cl[2],y),c.add(Tl[0],Tl[1],Tl[2],y),c.add(Du[0],Du[1],Du[2],y),c.add(Il[0],Il[1],Il[2],y),c.add(Al[0],Al[1],Al[2],y),c.add(wl[0],wl[1],wl[2],y))),++y}}const b=c.getSpheres(),x=_e.expand(_e(),t.boundary.sphere,1*i.sizeFactor);return b.setBoundingSphere(x),b}function qht(e,t,n,r,i,o){if(!Ee.isAtomic(t))return Nt.createEmpty(o);const s=t.nucleotideElements.length;if(!s)return Nt.createEmpty(o);const{sizeFactor:a,detail:c}=i,u=s*xv(c),l=at.createState(u,u/2,o),{elements:d,model:f,conformation:p}=t,{chainAtomSegments:m,residueAtomSegments:h}=f.atomicHierarchy,{moleculeType:g}=f.atomicHierarchy.derived.residue,y=en.transientSegments(m,d),b=en.transientSegments(h,d),x=1*a;let _=0;for(;y.hasNext;)for(b.setSegment(y.move());b.hasNext;){const{index:E}=b.move();if(Ya(g[E])){const w={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};l.currentGroup=_,IC(w,t,E),TC(w)&&(p.invariantPosition(w.C1_1,P1),p.invariantPosition(w.C2_1,M1),p.invariantPosition(w.C3_1,R1),p.invariantPosition(w.C4_1,k1),p.invariantPosition(w.O4_1,N1),p.invariantPosition(w.trace,I1),Zn(l,I1,x,c),Zn(l,k1,x,c),Zn(l,N1,x,c),Zn(l,P1,x,c),Zn(l,M1,x,c),Zn(l,R1,x,c));const{isPurine:D,isPyrimidine:I}=Q0(t,E);D?(ey(w,t,E),y1(w)&&(p.invariantPosition(w.N1,Cl),p.invariantPosition(w.C2,wl),p.invariantPosition(w.N3,Al),p.invariantPosition(w.C4,Il),p.invariantPosition(w.C5,Du),p.invariantPosition(w.C6,Tl),p.invariantPosition(w.N7,T1),p.invariantPosition(w.C8,D1),p.invariantPosition(w.N9,E1),Zn(l,D1,x,c),Zn(l,T1,x,c),Zn(l,Du,x,c),Zn(l,Tl,x,c),Zn(l,Cl,x,c),Zn(l,wl,x,c),Zn(l,Al,x,c),Zn(l,Il,x,c),Zn(l,Du,x,c),Zn(l,E1,x,c))):I&&(ty(w,t,E),b1(w)&&(p.invariantPosition(w.N1,Cl),p.invariantPosition(w.C2,wl),p.invariantPosition(w.N3,Al),p.invariantPosition(w.C4,Il),p.invariantPosition(w.C5,Du),p.invariantPosition(w.C6,Tl),Zn(l,Tl,x,c),Zn(l,Du,x,c),Zn(l,Il,x,c),Zn(l,Al,x,c),Zn(l,wl,x,c),Zn(l,Cl,x,c))),++_}}const S=at.getMesh(l),A=_e.expand(_e(),t.boundary.sphere,1*i.sizeFactor);return S.setBoundingSphere(A),S}const ny=v.zero(),F1=v.zero(),ry=v.zero(),Gpe=v.zero(),es=hf(3,!1);let Az;const iy=le.identity(),Xht=v.zero(),jpe=v.zero(),Hpe=v.zero(),Tz=v.zero(),Kht=4,Zht=4,Qht=6,Jht=function Yht(){return Az||(Az=function $ht(){const e=vv(8);for(let t=0;t<3;++t){const n=(t+1)%3;v.set(ny,es[3*t],es[3*t+1],-.5),v.set(F1,es[3*n],es[3*n+1],-.5),v.set(ry,es[3*n],es[3*n+1],.5),v.set(Gpe,es[3*t],es[3*t+1],.5),e.add(ny,F1,ry),e.add(ry,Gpe,ny)}return v.set(ny,es[0],es[1],-.5),v.set(F1,es[3],es[4],-.5),v.set(ry,es[6],es[7],-.5),e.add(ry,F1,ny),v.set(ny,es[0],es[1],.5),v.set(F1,es[3],es[4],.5),v.set(ry,es[6],es[7],.5),e.add(ny,F1,ry),e.getPrimitive()}()),Az}(),qpe={sizeFactor:C.Numeric(.2,{min:0,max:10,step:.01})};function emt(e,t,n,r,i,o){const s=t.polymerElements.length;if(!s)return Nt.createEmpty(o);const{sizeFactor:a}=i,c=24*s,u=at.createState(c,c/10,o),d=uz(1),{normalVectors:f,binormalVectors:p}=d;let m=0;const h=sz(t,n);for(;h.hasNext;){const b=h.move();u.currentGroup=m;const x=Ya(b.moleculeType),_=cr.is(b.secStrucType,4);if(lz(d,b,x||_?.5:.9,x?.3:.5),_&&!b.secStrucLast||!_){const E=r.size.size(b.center)*a,w=Kht*E,D=Zht*E,I=Qht*E,R=x?p:f;v.fromArray(jpe,R,0),v.fromArray(Hpe,R,3),v.normalize(Tz,v.add(Tz,jpe,Hpe)),le.targetTo(iy,b.p3,b.p1,Tz),le.mul(iy,iy,le.rotY90Z180),le.scale(iy,iy,v.set(Xht,I,D,w)),le.setTranslation(iy,b.p2),at.addPrimitive(u,iy,Jht)}++m}const g=at.getMesh(u),y=_e.expand(_e(),t.boundary.sphere,1*i.sizeFactor);return g.setBoundingSphere(y),g}C.getDefaultValues(qpe);const Wpe={...hs,...qpe};function tmt(e){return Hs({defaultProps:C.getDefaultValues(Wpe),createGeometry:emt,createLocationIterator:t=>lh.fromGroup(t),getLoci:Y0,eachLocation:X0,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor}},e)}const Dz=10,$pe={sizeFactor:C.Numeric(.2,{min:0,max:10,step:.01}),radialSegments:C.Numeric(16,{min:2,max:56,step:2},rt.CustomQualityParamInfo)};function nmt(e,t,n,r,i,o){const s=t.gapElements.length;if(!s)return Nt.createEmpty(o);const{sizeFactor:a,radialSegments:c}=i,u=Dz*c*2*s*2,l=at.createState(u,u/10,o),d=v(),f=v(),p={radiusTop:1,radiusBottom:1,topCap:!0,bottomCap:!0,radialSegments:c};let m=0;const h=function Ypt(e,t){switch(t.kind){case 0:return new Xpt(e,t);case 1:case 2:return new Kpt(e,t)}}(n,t);for(;h.hasNext;){const{centerA:b,centerB:x}=h.move();b.element===x.element||(t.conformation.invariantPosition(b.element,d),t.conformation.invariantPosition(x.element,f),p.radiusTop=p.radiusBottom=r.size.size(b)*a,l.currentGroup=m,wv(l,d,f,.5,Dz,!1,p),p.radiusTop=p.radiusBottom=r.size.size(x)*a,l.currentGroup=m+1,wv(l,f,d,.5,Dz,!1,p)),m+=2}const g=at.getMesh(l),y=_e.expand(_e(),t.boundary.sphere,1*i.sizeFactor);return g.setBoundingSphere(y),g}C.getDefaultValues($pe);const q3={...hs,...$pe};function Ez(e){return Hs({defaultProps:C.getDefaultValues(q3),createGeometry:nmt,createLocationIterator:gz.fromGroup,getLoci:lht,eachLocation:dht,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.radialSegments!==r.radialSegments}},e)}const nr=v(),Tr=v(),rmt=v(),Eu=v(),Lf=v(),W3=v(),$3=v(),EC=v(),Ad=v(),Uf=v(),Pz=v(),qm=v(),Wm=v(),$m=v(),Ym=v(),Dl=v.fromArray,B1=v.scale,El=v.add,fh=v.sub,imt=v.magnitude,Ype=v.negate,Mz=v.copy,Xpe=v.cross,omt=v.set,Lr=ze.add3,smt=ze.add;function Y3(e,t,n,r,i,o,s,a,c){const{vertices:u,normals:l,indices:d}=t,f=u.elementCount;if(Dl(nr,r,e),B1($3,nr,s),B1(W3,nr,a),Dl(Tr,i,e),B1(Eu,Tr,o),Xpe(Uf,Tr,nr),Dl(Ad,n,e),El(qm,El(qm,Ad,Eu),W3),fh(Wm,El(Wm,Ad,Eu),$3),fh($m,fh($m,Ad,Eu),$3),El(Ym,fh(Ym,Ad,Eu),W3),s0?(Dl(nr,t,0),Dl(Tr,t,3*i),g=a/imt(fh(rmt,Tr,nr))):omt(EC,0,0,0);for(let b=0;b<=i;++b){const x=o[b],S=0===a?s[b]:a*(1-b/i),A=3*b;Dl(Lf,n,A),B1(Lf,Lf,S),Dl(Eu,r,A),B1(Eu,Eu,x),a>0&&(Dl(nr,n,A),Dl(Tr,r,A),B1(EC,Xpe(EC,nr,Tr),g)),Dl(Ad,t,A),Dl(Uf,n,A),Dl(Pz,r,A),El(nr,El(nr,Ad,Eu),Lf),El(Tr,Uf,EC),Lr(d,nr[0],nr[1],nr[2]),Lr(f,Tr[0],Tr[1],Tr[2]),El(nr,fh(nr,Ad,Eu),Lf),Lr(d,nr[0],nr[1],nr[2]),Lr(f,Tr[0],Tr[1],Tr[2]),Ype(Tr,Pz),Lr(d,nr[0],nr[1],nr[2]),Lr(f,Tr[0],Tr[1],Tr[2]),fh(nr,fh(nr,Ad,Eu),Lf),Lr(d,nr[0],nr[1],nr[2]),Lr(f,Tr[0],Tr[1],Tr[2]),El(Tr,Ype(Tr,Uf),EC),Lr(d,nr[0],nr[1],nr[2]),Lr(f,Tr[0],Tr[1],Tr[2]),fh(nr,El(nr,Ad,Eu),Lf),Lr(d,nr[0],nr[1],nr[2]),Lr(f,Tr[0],Tr[1],Tr[2]),Mz(Tr,Pz),Lr(d,nr[0],nr[1],nr[2]),Lr(f,Tr[0],Tr[1],Tr[2]),El(nr,El(nr,Ad,Eu),Lf),Lr(d,nr[0],nr[1],nr[2]),Lr(f,Tr[0],Tr[1],Tr[2])}for(let b=0;b0){const b=o[0],x=s[0];Y3(0,e,t,n,r,b,a,-x,!1),Y3(0,e,t,n,r,b,-a,x,!1)}if(u&&0===a){const x=s[i];Y3(3*i,e,t,n,r,o[i],x,x,!0)}for(let b=0,x=8*(i+1)+(c?4:a>0?8:0)+(u&&0===a?4:0);bD;for(let T=0;T=_?I-D:-I+D:T>=x&&T<_?-I+D:I-D;Rz(ts,ts,Ys,M),T===x||T===x-1?K3(wo,Ys,Pa,0,1):T===_||T===_-1?K3(wo,Ys,Pa,0,-1):K3(wo,Ys,Pa,y[T],b[T])}else O1(ts,Ys,Pa,hc,I*y[T],D*b[T]),K3(wo,Ys,Pa,D*y[T],I*b[T]);amt(wo,wo),Ma(f,ts[0],ts[1],ts[2]),Ma(p,wo[0],wo[1],wo[2])}}const S=Math.round(o/2);for(let E=0;ED;R&&(I-=D),g=f.elementCount;for(let T=0;T=_?I:-I)):O1(ts,Ys,Pa,hc,I*y[T],D*b[T]),Ma(f,ts[0],ts[1],ts[2]),Ma(p,wo[0],wo[1],wo[2]),Ma(m,g+(T+1)%o,g+T,w)}if(u){const E=3*i,w=f.elementCount;ph(Ys,n,E),ph(Pa,r,E),ph(hc,t,E),Kpe(wo,Ys,Pa),Ma(f,hc[0],hc[1],hc[2]),Ma(p,wo[0],wo[1],wo[2]);const D=s[i];let I=a[i];const R="rounded"===l&&I>D;R&&(I-=D),g=f.elementCount;for(let T=0;T=_?I:-I)):O1(ts,Ys,Pa,hc,I*y[T],D*b[T]),Ma(f,ts[0],ts[1],ts[2]),Ma(p,wo[0],wo[1],wo[2]),Ma(m,g+T,g+(T+1)%o,w)}ze.addRepeat(h,(i+1)*o+(c?o+1:0)+(u?o+1:0),d)}const hh=v.fromArray,dmt=v.magnitude,Fz=v.sub,Zpe=v.add,Bz=v.scale,fmt=v.negate,pmt=v.copy,hmt=v.cross,Pl=ze.add3,mmt=ze.add,_s=v(),Xs=v(),gmt=v(),Oz=v(),oy=v(),Qpe=v(),PC=v(),ymt=v(),Lz=v();function Z3(e,t,n,r,i,o,s,a){const{currentGroup:c,vertices:u,normals:l,indices:d,groups:f}=e,p=u.elementCount;let m=0;a>0&&(hh(_s,t,0),hh(Xs,t,3*i),m=a/dmt(Fz(gmt,Xs,_s)));for(let g=0;g<=i;++g){const y=o[g],x=0===a?s[g]:a*(1-g/i),_=3*g;hh(oy,n,_),Bz(oy,oy,x),hh(Oz,r,_),Bz(Oz,Oz,y),a>0&&(hh(_s,n,_),hh(Xs,r,_),Bz(Qpe,hmt(Qpe,_s,Xs),m)),hh(PC,t,_),hh(ymt,n,_),hh(Lz,r,_),Zpe(_s,PC,oy),fmt(Xs,Lz),Pl(u,_s[0],_s[1],_s[2]),Pl(l,Xs[0],Xs[1],Xs[2]),Fz(_s,PC,oy),Pl(u,_s[0],_s[1],_s[2]),Pl(l,Xs[0],Xs[1],Xs[2]),Zpe(_s,PC,oy),pmt(Xs,Lz),Pl(u,_s[0],_s[1],_s[2]),Pl(l,Xs[0],Xs[1],Xs[2]),Fz(_s,PC,oy),Pl(u,_s[0],_s[1],_s[2]),Pl(l,Xs[0],Xs[1],Xs[2])}for(let g=0;glh.fromGroup(t,{asSecondary:!0}),getLoci:Y0,eachLocation:X0,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.tubularHelices!==r.tubularHelices||n.detail!==r.detail||n.linearSegments!==r.linearSegments||n.radialSegments!==r.radialSegments||n.aspectRatio!==r.aspectRatio||n.arrowFactor!==r.arrowFactor||n.helixProfile!==r.helixProfile||n.nucleicProfile!==r.nucleicProfile;const c=Xu.get(s.structure).version;t.info.secondaryStructureHash!==c&&(void 0!==t.info.secondaryStructureHash&&(t.createGeometry=!0),t.info.secondaryStructureHash=c)}},e)}const the={"polymer-trace":(e,t)=>vi("Polymer trace mesh",e,t,vmt),"polymer-gap":(e,t)=>vi("Polymer gap cylinder",e,t,Ez),"nucleotide-block":(e,t)=>vi("Nucleotide block mesh",e,t,yht),"nucleotide-ring":(e,t)=>vi("Nucleotide ring mesh",e,t,Aht),"nucleotide-atomic-ring-fill":(e,t)=>vi("Nucleotide atomic ring fill",e,t,Bht),"nucleotide-atomic-bond":(e,t)=>vi("Nucleotide atomic bond",e,t,Oht),"nucleotide-atomic-element":(e,t)=>vi("Nucleotide atomic element",e,t,Ght),"direction-wedge":(e,t)=>vi("Polymer direction wedge",e,t,tmt)},nhe={...ehe,...q3,...Epe,...Fpe,...Cz,...wz,...zpe,...Wpe,sizeFactor:C.Numeric(.2,{min:0,max:10,step:.01}),visuals:C.MultiSelect(["polymer-trace","polymer-gap","nucleotide-ring","nucleotide-atomic-ring-fill","nucleotide-atomic-bond","nucleotide-atomic-element"],C.objectToOptions(the)),bumpFrequency:C.Numeric(2,{min:0,max:10,step:.1},rt.ShadingCategory),colorMode:C.Select("default",C.arrayToOptions(["default","interpolate"]),{...rt.ShadingCategory,isHidden:!0})},Smt={name:"cartoon",label:"Cartoon",description:"Displays ribbons, planks, tubes smoothly following the trace atoms of polymers.",factory:function xmt(e,t){return yn.createMulti("Cartoon",e,t,ms,the)},getParams:function _mt(e,t){const n=C.clone(nhe);let r=!1,i=!1;return t.units.forEach(o=>{!r&&Ee.isAtomic(o)&&o.nucleotideElements.length&&(r=!0),!i&&o.gapElements.length&&(i=!0)}),n.visuals.defaultValue=["polymer-trace"],r&&n.visuals.defaultValue.push("nucleotide-ring"),i&&n.visuals.defaultValue.push("polymer-gap"),n},defaultValues:C.getDefaultValues(nhe),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.polymerResidueCount>0,ensureCustomProperties:{attach:function(){var e=ie(function*(t,n){yield Xu.attach(t,n,void 0,!0);for(const r of n.models)yield oz.attach(t,r,void 0,!0)});return function(n,r){return e.apply(this,arguments)}}(),detach:e=>{Xu.ref(e,!1);for(const t of e.models)oz.ref(t,!1)}}},rhe={...hs,sizeFactor:C.Numeric(1,{min:0,max:10,step:.1}),detail:C.Numeric(0,{min:0,max:3,step:1},rt.CustomQualityParamInfo),ignoreHydrogens:C.Boolean(!1)};function Cmt(e){return Hs({defaultProps:C.getDefaultValues(rhe),createGeometry:wmt,createLocationIterator:gs.fromGroup,getLoci:Sd,eachLocation:xd,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail||n.ignoreHydrogens!==r.ignoreHydrogens}},e)}function wmt(e,t,n,r,i,o){const{child:s}=n,a=s?.unitMap.get(t.id);if(s&&!a)return Nt.createEmpty(o);const{detail:c,sizeFactor:u,ignoreHydrogens:l}=i,{elements:d,model:f}=t,{atomicNumber:p}=t.model.atomicHierarchy.derived.atom,m=d.length,h=m*xv(c),g=at.createState(h,h/2,o),y=tf.Provider.get(f);if(!y)return Nt.createEmpty(o);const b=v(),x=Kt(),_=v(),S=v(),A=v(),{elementToAnsiotrop:E,data:w}=y,{U:D}=w,I=w._schema.U.space,R=t.conformation,T=nt.create(n);T.unit=t;for(let V=0;Vvi("Ellipsoid Mesh",e,t,Cmt),"intra-bond":(e,t)=>vi("Intra-unit bond cylinder",e,t,Vfe),"inter-bond":(e,t)=>Iu("Inter-unit bond cylinder",e,t,Hfe)},ohe={...rhe,...m3,...g3,includeParent:C.Boolean(!1),adjustCylinderLength:C.Boolean(!1,{isHidden:!0}),unitKinds:oC(["atomic"]),sizeFactor:C.Numeric(1,{min:.01,max:10,step:.01}),sizeAspectRatio:C.Numeric(.1,{min:.01,max:3,step:.01}),linkCap:C.Boolean(!0),visuals:C.MultiSelect(["ellipsoid-mesh","intra-bond","inter-bond"],C.objectToOptions(ihe)),bumpFrequency:C.Numeric(0,{min:0,max:10,step:.1},rt.ShadingCategory)},Tmt={name:"ellipsoid",label:"Ellipsoid",description:"Displays anisotropic displacement ellipsoids of atomic elements plus bonds as cylinders.",factory:function Imt(e,t){return yn.createMulti("Ellipsoid",e,t,ms,ihe)},getParams:function Amt(e,t){return ohe},defaultValues:C.getDefaultValues(ohe),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.elementCount>0&&e.models.some(t=>tf.Provider.isApplicable(t)),getData:(e,t)=>t.includeParent?e.asParent():e,mustRecreate:(e,t)=>e.includeParent!==t.includeParent},Dmt="\nprecision highp float;\n\nattribute vec3 aPosition;\nattribute float aRadius;\n\nvarying vec3 vPosition;\nvarying float vRadiusSqInv;\n\n#if defined(dCalcType_groupId)\n attribute float aGroup;\n varying float vGroup;\n#endif\n\nuniform vec3 uBboxSize;\nuniform vec3 uBboxMin;\nuniform float uResolution;\n\nvoid main() {\n vRadiusSqInv = 1.0 / (aRadius * aRadius);\n #if defined(dCalcType_groupId)\n vGroup = aGroup;\n #endif\n gl_PointSize = ceil(((aRadius * 3.0) / uResolution) + uResolution);\n vPosition = (aPosition - uBboxMin) / uResolution;\n gl_Position = vec4(((aPosition - uBboxMin) / uBboxSize) * 2.0 - 1.0, 1.0);\n}\n",Emt="\nprecision highp float;\n\nvarying vec3 vPosition;\nvarying float vRadiusSqInv;\n#if defined(dCalcType_groupId)\n #if defined(dGridTexType_2d)\n precision highp sampler2D;\n uniform sampler2D tMinDistanceTex;\n uniform vec3 uGridTexDim;\n #elif defined(dGridTexType_3d)\n precision highp sampler3D;\n uniform sampler3D tMinDistanceTex;\n #endif\n varying float vGroup;\n#endif\n\n#include common\n\nuniform vec3 uGridDim;\nuniform vec2 uGridTexScale;\nuniform float uCurrentSlice;\nuniform float uCurrentX;\nuniform float uCurrentY;\nuniform float uAlpha;\nuniform float uResolution;\nuniform float uRadiusFactorInv;\n\nvoid main() {\n vec2 v = gl_FragCoord.xy - vec2(uCurrentX, uCurrentY) - 0.5;\n vec3 fragPos = vec3(v.x, v.y, uCurrentSlice);\n float dist = distance(fragPos, vPosition) * uResolution;\n\n #if defined(dCalcType_density)\n float density = exp(-uAlpha * ((dist * dist) * vRadiusSqInv));\n gl_FragColor.a = density * uRadiusFactorInv;\n #elif defined(dCalcType_minDistance)\n gl_FragColor.a = 1.0 - dist * uRadiusFactorInv;\n #elif defined(dCalcType_groupId)\n #if defined(dGridTexType_2d)\n float minDistance = 1.0 - texture2D(tMinDistanceTex, (gl_FragCoord.xy) / (uGridTexDim.xy / uGridTexScale)).a;\n #elif defined(dGridTexType_3d)\n float minDistance = 1.0 - texelFetch(tMinDistanceTex, ivec3(gl_FragCoord.xy, uCurrentSlice), 0).a;\n #endif\n if (dist * uRadiusFactorInv > minDistance + uResolution * 0.05)\n discard;\n gl_FragColor.rgb = packIntToRGB(vGroup);\n #endif\n}\n",Pmt={drawCount:ri("number"),instanceCount:ri("number"),aRadius:Ar("float32",1,0),aPosition:Ar("float32",3,0),aGroup:Ar("float32",1,0),uCurrentSlice:xe("f"),uCurrentX:xe("f"),uCurrentY:xe("f"),uBboxMin:xe("v3","material"),uBboxSize:xe("v3","material"),uGridDim:xe("v3","material"),uGridTexDim:xe("v3","material"),uGridTexScale:xe("v2","material"),uAlpha:xe("f","material"),uResolution:xe("f","material"),uRadiusFactorInv:xe("f","material"),tMinDistanceTex:jt("texture","rgba","float","nearest","material"),dGridTexType:Ft("string",["2d","3d"]),dCalcType:Ft("string",["density","minDistance","groupId"])},Vf="gaussian-density";function Uz(e){return e.namedFramebuffers[Vf]||(e.namedFramebuffers[Vf]=e.resources.framebuffer()),e.namedFramebuffers[Vf]}function Vz(e,t,n,r,i,o){const s=`${Vf}-${e}`;return t.namedTextures[s]||(t.namedTextures[s]=t.resources.texture(n,r,i,o)),t.namedTextures[s]}function she(e,t,n,r,i,o){return e.isWebGL2?function Mmt(e,t,n,r,i,o){lt&&e.timer.mark("GaussianDensityTexture3d");const s=function Rmt(e,t,n,r,i,o){const{gl:s,resources:a,state:c,extensions:{colorBufferFloat:u,textureFloat:l,colorBufferHalfFloat:d,textureHalfFloat:f}}=e,{smoothness:p,resolution:m}=i,{drawCount:h,positions:g,radii:y,groups:b,scale:x,expandedBox:_,dim:S,maxRadius:A}=lhe(t,n,r,i),[E,w,D]=S,I=Vz("min-dist-3d",e,"volume-uint8","rgba","ubyte","nearest");I.define(E,w,D);const R=Me.create(1,1),T=2*A,M=dhe(e,h,g,y,b,I,_,S,S,R,p,m,T),{uCurrentSlice:N}=M.values,V=Uz(e);function F(G,L){c.currentRenderItemId=-1;for(let z=0;z=N&&(X-=N,J+=I,ce=0,k.update(O,J)),k.update(q,ce),k.update(ee,be),u.viewport(ce,J,D,I),u.scissor(ce,J,D,I),$.render(),++X,ce+=D;a.flush()}return H.bind(),fhe(e),s||(s=f&&p?c.texture("image-float16","rgba","fp16","linear"):l&&d?c.texture("image-float32","rgba","float","linear"):c.texture("image-uint8","rgba","ubyte","linear")),s.define(z,j),hhe(e,$),W(s,!0),m&&(phe(e,$),W(Z,!0),mhe(e,$),W(s,!1)),{texture:s,scale:S,bbox:A,gridDim:E,gridTexDim:F,gridTexScale:G,radiusFactor:L,resolution:g,maxRadius:w}}(e,t,n,r,i,o,s);return lt&&e.timer.markEnd("GaussianDensityTexture2d"),ahe(a)}function ahe({texture:e,scale:t,bbox:n,gridDim:r,gridTexDim:i,gridTexScale:o,radiusFactor:s,resolution:a,maxRadius:c}){return{transform:che(t,n),texture:e,bbox:n,gridDim:r,gridTexDim:i,gridTexScale:o,radiusFactor:s,resolution:a,maxRadius:c}}function che(e,t){const n=le.identity();return le.fromScaling(n,e),le.setTranslation(n,t.min),n}function lhe(e,t,n,r){const{resolution:i,radiusOffset:o}=r,s=1/i,{indices:a,x:c,y:u,z:l,id:d}=e,f=Fe.size(a),p=new Float32Array(3*f),m=new Float32Array(f),h=new Float32Array(f);let g=0;for(let A=0;A0?"3d":"2d"),k.updateIfChanged(m.dCalcType,"density"),e.namedComputeRenderables[Vf].update()}else e.namedComputeRenderables[Vf]=function kmt(e,t,n,r,i,o,s,a,c,u,l,d,f){const p=v.sub(v(),s.max,s.min),m={drawCount:k.create(t),instanceCount:k.create(1),aRadius:k.create(r),aPosition:k.create(n),aGroup:k.create(i),uCurrentSlice:k.create(0),uCurrentX:k.create(0),uCurrentY:k.create(0),uBboxMin:k.create(s.min),uBboxSize:k.create(p),uGridDim:k.create(a),uGridTexDim:k.create(c),uGridTexScale:k.create(u),uAlpha:k.create(l),uResolution:k.create(d),uRadiusFactorInv:k.create(1/f),tMinDistanceTex:k.create(o),dGridTexType:k.create(o.getDepth()>0?"3d":"2d"),dCalcType:k.create("density")},h={...Pmt};return ji(zi(e,"points",Br(Vf,Dmt,Emt),h,m),m)}(e,t,n,r,i,o,s,a,c,u,l,d,f);return e.namedComputeRenderables[Vf]}function fhe(e){const{gl:t,state:n}=e;n.disable(t.CULL_FACE),n.enable(t.BLEND),n.disable(t.DEPTH_TEST),n.enable(t.SCISSOR_TEST),n.depthMask(!1),n.clearColor(0,0,0,0)}function phe(e,t){const{gl:n,state:r}=e;if(k.update(t.values.dCalcType,"minDistance"),t.update(),r.colorMask(!1,!1,!1,!0),r.blendFunc(n.ONE,n.ONE),!e.extensions.blendMinMax)throw new Error("GPU gaussian surface calculation requires EXT_blend_minmax");r.blendEquation(e.extensions.blendMinMax.MAX)}function hhe(e,t){const{gl:n,state:r}=e;k.update(t.values.dCalcType,"density"),t.update(),r.colorMask(!1,!1,!1,!0),r.blendFunc(n.ONE,n.ONE),r.blendEquation(n.FUNC_ADD)}function mhe(e,t){const{gl:n,state:r}=e;k.update(t.values.dCalcType,"groupId"),t.update(),r.colorMask(!0,!0,!0,!1),r.blendFunc(n.ONE,n.ZERO),r.blendEquation(n.FUNC_ADD)}function ghe(e,t,n,r,i){return Gz.apply(this,arguments)}function Gz(){return Gz=ie(function*(e,t,n,r,i){const{resolution:o,radiusOffset:s,smoothness:a}=i,c=1/o,{indices:u,x:l,y:d,z:f,id:p}=t,m=Fe.size(u),h=new Float32Array(m);let g=0;for(let W=0;Wj[ln]&&(j[ln]=Xt,D[ln]=p?p[fe]:fe)}}}}}}function O(){return(O=ie(function*(){for(let W=0;W1)return!1;const r=n.maxTextureSize/3,{areaCells:i,maxAreaCells:o}=zle(e.boundary.box,t.resolution,r*r);return i{e.setUpdateState(n,r,i,o,s,a,c),Qo.areEqual(o.size,s.size)||(n.createGeometry=!0)},geometryUtils:xa.Utils},t)}({defaultProps:C.getDefaultValues(jz),createGeometry:$mt,createLocationIterator:gs.fromGroup,getLoci:Sd,eachLocation:xd,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.radiusOffset!==r.radiusOffset&&(t.createGeometry=!0),n.smoothness!==r.smoothness&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0),n.smoothColors.name!==r.smoothColors.name?t.updateColor=!0:"on"===n.smoothColors.name&&"on"===r.smoothColors.name&&(n.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(t.updateColor=!0),n.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(t.updateColor=!0))},mustRecreate:(t,n,r)=>!n.tryUseGpu||!r||!L1(t.structure,n,r),processValues:(t,n,r,i,o)=>{const{resolution:s,colorTexture:a}=n.meta,c=cl(r.smoothColors,i.color.preferSmoothing,s);c&&o&&(Oae(t,c.resolution,c.stride,o,a),n.meta.colorTexture=t.tColorGrid.ref.value)},dispose:t=>{var n;t.vertexTexture.ref.value.destroy(),t.groupTexture.ref.value.destroy(),t.normalTexture.ref.value.destroy(),t.doubleBuffer.destroy(),null===(n=t.meta.colorTexture)||void 0===n||n.destroy()}},e)}(e):function Hmt(e){return Hs({defaultProps:C.getDefaultValues(jz),createGeometry:jmt,createLocationIterator:gs.fromGroup,getLoci:Sd,eachLocation:xd,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.radiusOffset!==r.radiusOffset&&(t.createGeometry=!0),n.smoothness!==r.smoothness&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0),n.smoothColors.name!==r.smoothColors.name?t.updateColor=!0:"on"===n.smoothColors.name&&"on"===r.smoothColors.name&&(n.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(t.updateColor=!0),n.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(t.updateColor=!0))},mustRecreate:(t,n,r)=>n.tryUseGpu&&!!r&&L1(t.structure,n,r),processValues:(t,n,r,i,o)=>{const{resolution:s,colorTexture:a}=n.meta,c=cl(r.smoothColors,i.color.preferSmoothing,s);c&&(oE(t,c.resolution,c.stride,o,a),n.meta.colorTexture=t.tColorGrid.ref.value)},dispose:t=>{var n;null===(n=t.meta.colorTexture)||void 0===n||n.destroy()}},e)}(e)}function Gmt(e,t,n,r){return n.tryUseGpu&&r&&xhe(r)&&L1(t,n,r)?function Kmt(e){return function Gat(e,t){return N0({...e,setUpdateState:(n,r,i,o,s,a,c)=>{e.setUpdateState(n,r,i,o,s,a,c),Qo.areEqual(o.size,s.size)||(n.createGeometry=!0)},geometryUtils:xa.Utils},t)}({defaultProps:C.getDefaultValues(_he),createGeometry:Xmt,createLocationIterator:gs.fromStructure,getLoci:W0,eachLocation:q0,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.radiusOffset!==r.radiusOffset&&(t.createGeometry=!0),n.smoothness!==r.smoothness&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0),n.smoothColors.name!==r.smoothColors.name?t.updateColor=!0:"on"===n.smoothColors.name&&"on"===r.smoothColors.name&&(n.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(t.updateColor=!0),n.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(t.updateColor=!0))},mustRecreate:(t,n,r)=>!n.tryUseGpu||!r||!L1(t,n,r),processValues:(t,n,r,i,o)=>{const{resolution:s,colorTexture:a}=n.meta,c=cl(r.smoothColors,i.color.preferSmoothing,s);c&&o&&(Oae(t,c.resolution,c.stride,o,a),n.meta.colorTexture=t.tColorGrid.ref.value)},dispose:t=>{var n;t.vertexTexture.ref.value.destroy(),t.groupTexture.ref.value.destroy(),t.normalTexture.ref.value.destroy(),t.doubleBuffer.destroy(),null===(n=t.meta.colorTexture)||void 0===n||n.destroy()}},e)}(e):function Wmt(e){return rh({defaultProps:C.getDefaultValues(_he),createGeometry:qmt,createLocationIterator:gs.fromStructure,getLoci:W0,eachLocation:q0,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.radiusOffset!==r.radiusOffset&&(t.createGeometry=!0),n.smoothness!==r.smoothness&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.smoothColors.name!==r.smoothColors.name?t.updateColor=!0:"on"===n.smoothColors.name&&"on"===r.smoothColors.name&&(n.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(t.updateColor=!0),n.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(t.updateColor=!0))},mustRecreate:(t,n,r)=>n.tryUseGpu&&!!r&&L1(t,n,r),processValues:(t,n,r,i,o)=>{const{resolution:s,colorTexture:a}=n.meta,c=cl(r.smoothColors,i.color.preferSmoothing,s);c&&(oE(t,c.resolution,c.stride,o,a),n.meta.colorTexture=t.tColorGrid.ref.value)},dispose:t=>{var n;null===(n=t.meta.colorTexture)||void 0===n||n.destroy()}},e)}(e)}function jmt(e,t,n,r,i,o){return Hz.apply(this,arguments)}function Hz(){return Hz=ie(function*(e,t,n,r,i,o){const{smoothness:s}=i,{transform:a,field:c,idField:u,radiusFactor:l,resolution:d,maxRadius:f}=yield bhe(n,t,r.size,i).runInContext(e.runtime),p={isoLevel:Math.exp(-s)/l,scalarField:c,idField:u},m=yield c1(p,o).runAsChild(e.runtime);m.meta.resolution=d,Nt.transform(m,a),e.webgl&&!e.webgl.isWebGL2?(Nt.uniformTriangleGroup(m),k.updateIfChanged(m.varyingGroup,!1)):k.updateIfChanged(m.varyingGroup,!0);const h=_e.expand(_e(),t.boundary.sphere,f);return m.setBoundingSphere(h),m}),Hz.apply(this,arguments)}function qmt(e,t,n,r,i){return qz.apply(this,arguments)}function qz(){return qz=ie(function*(e,t,n,r,i){const{smoothness:o}=r,{transform:s,field:a,idField:c,radiusFactor:u,resolution:l,maxRadius:d}=yield function Lmt(e,t,n){const{position:r,boundary:i,radius:o}=HE(e,t,n),s=Pm(i.box,n);return Oe.create("Gaussian Density",function(){var a=ie(function*(c){return yield ghe(c,r,i.box,o,s)});return function(c){return a.apply(this,arguments)}}())}(t,n.size,r).runInContext(e.runtime),f={isoLevel:Math.exp(-o)/u,scalarField:a,idField:c},p=yield c1(f,i).runAsChild(e.runtime);p.meta.resolution=l,Nt.transform(p,s),e.webgl&&!e.webgl.isWebGL2?(Nt.uniformTriangleGroup(p),k.updateIfChanged(p.varyingGroup,!1)):k.updateIfChanged(p.varyingGroup,!0);const m=_e.expand(_e(),t.boundary.sphere,d);return p.setBoundingSphere(m),p}),qz.apply(this,arguments)}const U1="gaussian-surface";function $mt(e,t,n,r,i,o){return Wz.apply(this,arguments)}function Wz(){return Wz=ie(function*(e,t,n,r,i,o){if(!e.webgl)throw new Error("webgl context required to create gaussian surface texture-mesh");lt&&e.webgl.timer.mark("createGaussianSurfaceTextureMesh");const{namedTextures:s,resources:a,extensions:{colorBufferFloat:c,textureFloat:u,colorBufferHalfFloat:l,textureHalfFloat:d}}=e.webgl;s[U1]||(s[U1]=l&&d?a.texture("image-float16","rgba","fp16","linear"):c&&u?a.texture("image-float32","rgba","float","linear"):a.texture("image-uint8","rgba","ubyte","linear"));const f=yield function Omt(e,t,n,r,i,o,s){const{position:a,boundary:c,radius:u}=jE(e,t,n,i),l=Pm(c.box,i,yhe(o,e));return Oe.create("Gaussian Density",function(){var d=ie(function*(f){return zz(o,a,c.box,u,r,l,s)});return function(f){return d.apply(this,arguments)}}())}(n,t,r.size,!0,i,e.webgl,s[U1]).runInContext(e.runtime),p=Math.exp(-i.smoothness)/f.radiusFactor,m=v.create(0,1,2),h=o?.doubleBuffer.get(),g=s3(e.webgl,f.texture,f.gridDim,f.gridTexDim,f.gridTexScale,f.transform,p,!1,!0,m,!0,h?.vertex,h?.group,h?.normal);lt&&e.webgl.timer.markEnd("createGaussianSurfaceTextureMesh");const y=t.elements.length,b=_e.expand(_e(),t.boundary.sphere,f.maxRadius),x=xa.create(g.vertexCount,y,g.vertexTexture,g.groupTexture,g.normalTexture,b,o);return x.meta.resolution=f.resolution,x.meta.webgl=e.webgl,x}),Wz.apply(this,arguments)}function Xmt(e,t,n,r,i){return $z.apply(this,arguments)}function $z(){return $z=ie(function*(e,t,n,r,i){if(!e.webgl)throw new Error("webgl context required to create structure gaussian surface texture-mesh");lt&&e.webgl.timer.mark("createStructureGaussianSurfaceTextureMesh");const{namedTextures:o,resources:s,extensions:{colorBufferFloat:a,textureFloat:c,colorBufferHalfFloat:u,textureHalfFloat:l}}=e.webgl;o[U1]||(o[U1]=u&&l?s.texture("image-float16","rgba","fp16","linear"):a&&c?s.texture("image-float32","rgba","float","linear"):s.texture("image-uint8","rgba","ubyte","linear"));const d=yield function Vmt(e,t,n,r,i,o){const{box:s}=e.lookup3d.boundary,{position:a,boundary:c,radius:u}=HE(e,t,r),l=Pm(c.box,r);return Oe.create("Gaussian Density",function(){var d=ie(function*(f){return zz(i,a,s,u,n,l,o)});return function(f){return d.apply(this,arguments)}}())}(t,n.size,!0,r,e.webgl,o[U1]).runInContext(e.runtime),f=Math.exp(-r.smoothness)/d.radiusFactor,p=v.create(0,1,2),m=i?.doubleBuffer.get(),h=s3(e.webgl,d.texture,d.gridDim,d.gridTexDim,d.gridTexScale,d.transform,f,!1,!0,p,!0,m?.vertex,m?.group,m?.normal);lt&&e.webgl.timer.markEnd("createStructureGaussianSurfaceTextureMesh");const g=t.elementCount,y=_e.expand(_e(),t.boundary.sphere,d.maxRadius),b=xa.create(h.vertexCount,g,h.vertexTexture,h.groupTexture,h.normalTexture,y,i);return b.meta.resolution=d.resolution,b.meta.webgl=e.webgl,b}),$z.apply(this,arguments)}function Zmt(e,t,n,r,i,o){return Yz.apply(this,arguments)}function Yz(){return Yz=ie(function*(e,t,n,r,i,o){const{smoothness:s}=i,{transform:a,field:c,idField:u,maxRadius:l}=yield bhe(n,t,r.size,i).runInContext(e.runtime),d={isoLevel:Math.exp(-s),scalarField:c,idField:u},f=yield HU(d,o).runAsChild(e.runtime);di.transform(f,a);const p=_e.expand(_e(),t.boundary.sphere,l);return f.setBoundingSphere(p),f}),Yz.apply(this,arguments)}const She={...qE,...MC,sizeFactor:C.Numeric(3,{min:0,max:10,step:.1}),lineSizeAttenuation:C.Boolean(!1),ignoreHydrogens:C.Boolean(!1),ignoreHydrogensVariant:C.Select("all",C.arrayToOptions(["all","non-polar"])),includeParent:C.Boolean(!1,{isHidden:!0})};function Qmt(e){return WE({defaultProps:C.getDefaultValues(She),createGeometry:Zmt,createLocationIterator:gs.fromGroup,getLoci:Sd,eachLocation:xd,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.radiusOffset!==r.radiusOffset&&(t.createGeometry=!0),n.smoothness!==r.smoothness&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0)}},e)}const Che={"gaussian-surface-mesh":(e,t)=>vi("Gaussian surface mesh",e,t,zmt),"structure-gaussian-surface-mesh":(e,t)=>Iu("Structure-Gaussian surface mesh",e,t,Gmt),"gaussian-surface-wireframe":(e,t)=>vi("Gaussian surface wireframe",e,t,Qmt)},whe={...jz,...She,visuals:C.MultiSelect(["gaussian-surface-mesh"],C.objectToOptions(Che)),bumpFrequency:C.Numeric(1,{min:0,max:10,step:.1},rt.ShadingCategory)},tgt={name:"gaussian-surface",label:"Gaussian Surface",description:"Displays a gaussian molecular surface.",factory:function egt(e,t){return yn.createMulti("Gaussian Surface",e,t,ms,Che)},getParams:function Jmt(e,t){return whe},defaultValues:C.getDefaultValues(whe),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"physical"},isApplicable:e=>e.elementCount>0},Ahe={...Oat,background:C.Boolean(!1),backgroundMargin:C.Numeric(0,{min:0,max:1,step:.01}),backgroundColor:C.Color(xn.black),backgroundOpacity:C.Numeric(.5,{min:0,max:1,step:.01}),borderWidth:C.Numeric(.25,{min:0,max:.5,step:.01}),level:C.Select("residue",[["chain","Chain"],["residue","Residue"],["element","Element"]],{isEssential:!0}),ignoreHydrogens:C.Boolean(!1),ignoreHydrogensVariant:C.Select("all",C.arrayToOptions(["all","non-polar"])),chainScale:C.Numeric(10,{min:0,max:20,step:.1}),residueScale:C.Numeric(1,{min:0,max:20,step:.1}),elementScale:C.Numeric(.5,{min:0,max:20,step:.1})};function ngt(e){return function Lat(e,t){return N0({...e,setUpdateState:(n,r,i,o,s,a,c)=>{e.setUpdateState(n,r,i,o,s,a,c),Qo.areEqual(o.size,s.size)||(n.updateSize=!0),r.background!==i.background&&(n.createGeometry=!0),r.backgroundMargin!==i.backgroundMargin&&(n.createGeometry=!0),r.tether!==i.tether&&(n.createGeometry=!0),r.tetherLength!==i.tetherLength&&(n.createGeometry=!0),r.tetherBaseWidth!==i.tetherBaseWidth&&(n.createGeometry=!0),r.attachment!==i.attachment&&(n.createGeometry=!0),r.fontFamily!==i.fontFamily&&(n.createGeometry=!0),r.fontQuality!==i.fontQuality&&(n.createGeometry=!0),r.fontStyle!==i.fontStyle&&(n.createGeometry=!0),r.fontVariant!==i.fontVariant&&(n.createGeometry=!0),r.fontWeight!==i.fontWeight&&(n.createGeometry=!0)},geometryUtils:vu.Utils},t)}({defaultProps:C.getDefaultValues(Ahe),createGeometry:rgt,createLocationIterator:gs.fromStructure,getLoci:W0,eachLocation:q0,setUpdateState:(t,n,r)=>{t.createGeometry=n.level!==r.level||"chain"===n.level&&n.chainScale!==r.chainScale||"residue"===n.level&&n.residueScale!==r.residueScale||"element"===n.level&&n.elementScale!==r.elementScale||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant}},e)}function rgt(e,t,n,r,i){switch(r.level){case"chain":return function igt(e,t,n,r,i){const o=nt.create(t),{units:s,serialMapping:a}=t,{auth_asym_id:c,label_asym_id:u}=Ze.chain,{cumulativeUnitElementCount:l}=a,d=s.length,{chainScale:f}=r,p=wf.create(r,d,d/2,i);for(let m=0,h=s.length;mIu("Label text",e,t,ngt)},The={...Ahe,visuals:C.MultiSelect(["label-text"],C.objectToOptions(Ihe))},ugt={name:"label",label:"Label",description:"Displays labels.",factory:function cgt(e,t){const n=yn.createMulti("Label",e,t,ms,Ihe);return n.setState({pickable:!1,markerActions:Bt.None}),n},getParams:function agt(e,t){return The},defaultValues:C.getDefaultValues(The),defaultColorTheme:{name:"uniform"},defaultSizeTheme:{name:"physical"},isApplicable:e=>e.elementCount>0},Xz={probeRadius:C.Numeric(1.4,{min:0,max:10,step:.1},{description:"Radius of the probe tracing the molecular surface."}),resolution:C.Numeric(.5,{min:.01,max:20,step:.01},{description:"Grid resolution/cell spacing.",...rt.CustomQualityParamInfo}),probePositions:C.Numeric(36,{min:12,max:90,step:1},{description:"Number of positions tested for probe target intersection.",...rt.CustomQualityParamInfo})};function Kz(){return Kz=ie(function*(e,t,n,r,i,o){let s=-1;function a(Y,ge,Se,Re,Ne){if(-1!==s){const Ge=s;if(Ge!==Re&&Ge!==Ne&&c(Ge,Y,ge,Se))return Ge;s=-1}for(let Ge=0,$e=R.count;Ge<$e;++Ge){const tt=Fe.getAt(T,R.indices[Ge]);if(tt!==Re&&tt!==Ne&&c(tt,Y,ge,Se))return s=tt,tt}return-1}function c(Y,ge,Se,Re){const Ne=G[Y],Ge=M[Y]-ge,$e=N[Y]-Se,tt=V[Y]-Re;return Ge*Ge+$e*$e+tt*tt0&&Ue{n.resolution!==r.resolution&&(t.createGeometry=!0),n.probeRadius!==r.probeRadius&&(t.createGeometry=!0),n.probePositions!==r.probePositions&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0),n.smoothColors.name!==r.smoothColors.name?t.updateColor=!0:"on"===n.smoothColors.name&&"on"===r.smoothColors.name&&(n.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(t.updateColor=!0),n.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(t.updateColor=!0))},processValues:(t,n,r,i,o)=>{const{resolution:s,colorTexture:a}=n.meta,c=cl(r.smoothColors,i.color.preferSmoothing,s);c&&(oE(t,c.resolution,c.stride,o,a),n.meta.colorTexture=t.tColorGrid.ref.value)},dispose:t=>{var n;null===(n=t.meta.colorTexture)||void 0===n||n.destroy()}},e)}function bgt(e,t,n,r,i){return e7.apply(this,arguments)}function e7(){return e7=ie(function*(e,t,n,r,i){const{transform:o,field:s,idField:a,resolution:c,maxRadius:u}=yield function mgt(e,t,n){const{position:r,boundary:i,maxRadius:o}=function hgt(e,t,n){const{probeRadius:r}=n,{position:i,boundary:o,radius:s}=HE(e,t,n),{indices:a}=i,c=Fe.size(a),u=new Float32Array(Fe.end(a));let l=0;for(let d=0;d{n.resolution!==r.resolution&&(t.createGeometry=!0),n.probeRadius!==r.probeRadius&&(t.createGeometry=!0),n.probePositions!==r.probePositions&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0),n.smoothColors.name!==r.smoothColors.name?t.updateColor=!0:"on"===n.smoothColors.name&&"on"===r.smoothColors.name&&(n.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(t.updateColor=!0),n.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(t.updateColor=!0))},processValues:(t,n,r,i,o)=>{const{resolution:s,colorTexture:a}=n.meta,c=cl(r.smoothColors,i.color.preferSmoothing,s);c&&(oE(t,c.resolution,c.stride,o,a),n.meta.colorTexture=t.tColorGrid.ref.value)},dispose:t=>{var n;null===(n=t.meta.colorTexture)||void 0===n||n.destroy()}},e)}const Phe={...qE,...Xz,...GE,sizeFactor:C.Numeric(1.5,{min:0,max:10,step:.1})};function _gt(e,t,n,r,i,o){return t7.apply(this,arguments)}function t7(){return t7=ie(function*(e,t,n,r,i,o){const{transform:s,field:a,idField:c,maxRadius:u}=yield Dhe(n,t,r.size,i).runInContext(e.runtime),l={isoLevel:i.probeRadius,scalarField:a,idField:c},d=yield HU(l,o).runAsChild(e.runtime);di.transform(d,s);const f=_e.expand(_e(),t.boundary.sphere,u);return d.setBoundingSphere(f),d}),t7.apply(this,arguments)}function xgt(e){return WE({defaultProps:C.getDefaultValues(Phe),createGeometry:_gt,createLocationIterator:gs.fromGroup,getLoci:Sd,eachLocation:xd,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.probeRadius!==r.probeRadius&&(t.createGeometry=!0),n.probePositions!==r.probePositions&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0)}},e)}const Mhe={"molecular-surface-mesh":(e,t)=>vi("Molecular surface mesh",e,t,ygt),"structure-molecular-surface-mesh":(e,t)=>Iu("Structure Molecular surface mesh",e,t,vgt),"molecular-surface-wireframe":(e,t)=>vi("Molecular surface wireframe",e,t,xgt)},Rhe={...Qz,...Phe,visuals:C.MultiSelect(["molecular-surface-mesh"],C.objectToOptions(Mhe)),bumpFrequency:C.Numeric(1,{min:0,max:10,step:.1},rt.ShadingCategory)},wgt={name:"molecular-surface",label:"Molecular Surface",description:"Displays a molecular surface.",factory:function Cgt(e,t){return yn.createMulti("Molecular Surface",e,t,ms,Mhe)},getParams:function Sgt(e,t){return Rhe},defaultValues:C.getDefaultValues(Rhe),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"physical"},isApplicable:e=>e.elementCount>0},khe={...hs,sizeFactor:C.Numeric(1,{min:0,max:2,step:.1}),detail:C.Numeric(0,{min:0,max:3,step:1},rt.CustomQualityParamInfo)};function Agt(e){return Hs({defaultProps:C.getDefaultValues(khe),createGeometry:Tgt,createLocationIterator:Dgt,getLoci:Egt,eachLocation:Pgt,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail}},e)}function Tgt(e,t,n,r,i,o){if(!function Igt(e){if(Ee.Traits.is(e.traits,Ee.Trait.MultiChain)||Ee.Traits.is(e.traits,Ee.Trait.Partitioned))return!1;if(Ee.isCoarse(e))return!0;if(0===e.elements.length)return!1;const n=e.model.atomicHierarchy.derived.residue.moleculeType[e.residueIndex[e.elements[0]]];return!(3===n||2===n)}(t))return Nt.createEmpty(o);const{detail:s,sizeFactor:a}=i,u=at.createState(256,128,o),l=t.principalAxes.boxAxes,{origin:d,dirA:f,dirB:p}=l,m=Rs.size(v(),l);v.scale(m,m,a/2);const h=v.create(m[2],m[1],m[0]);u.currentGroup=0,p8(u,d,f,p,h,s+1);const g=at.getMesh(u),y=_e.expand(_e(),t.boundary.sphere,1*i.sizeFactor);return g.setBoundingSphere(y),g}function Dgt(e){const{group:t,structure:n}=e,i=t.units.length,o=nt.create(n);return Mr(1,i,1,(a,c)=>{const u=t.units[c];return o.unit=u,o.element=u.elements[a],o})}function Egt(e,t,n){const{objectId:r,instanceId:i}=e;if(n===r){const{structure:o,group:s}=t,a=s.units[i];return De(o,[{unit:a,indices:Fe.ofBounds(0,a.elements.length)}])}return $n}function Pgt(e,t,n){let r=!1;if(!De.is(e))return!1;const{structure:i,group:o}=t;if(!Ve.areEquivalent(e.structure,i))return!1;const s=o.elements.length;for(const a of e.elements){const c=o.unitIndexMap.get(a.unit.id);void 0!==c&&Fe.size(a.indices)===s&&n(Ce.ofSingleton(c))&&(r=!0)}return r}const Nhe={"orientation-ellipsoid-mesh":(e,t)=>vi("Orientation ellipsoid mesh",e,t,Agt)},Fhe={...khe,visuals:C.MultiSelect(["orientation-ellipsoid-mesh"],C.objectToOptions(Nhe)),bumpFrequency:C.Numeric(1,{min:0,max:10,step:.1},rt.ShadingCategory)},kgt={name:"orientation",label:"Orientation",description:"Displays orientation ellipsoids for polymer chains.",factory:function Rgt(e,t){return yn.createMulti("Orientation",e,t,ms,Nhe)},getParams:function Mgt(e,t){return Fhe},defaultValues:C.getDefaultValues(Fhe),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.elementCount>0},Ngt=ze.add3,Fgt=ze.add;var n7;!function(e){e.create=function t(n=2048,r=1024,i){const o=ze.create(Float32Array,3,r,i?i.centerBuffer.ref.value:n),s=ze.create(Float32Array,1,r,i?i.groupBuffer.ref.value:n);return{add:(a,c,u,l)=>{Ngt(o,a,c,u),Fgt(s,l)},getPoints:()=>{const a=ze.compact(o,!0),c=ze.compact(s,!0);return ym.create(a,c,o.elementCount,i)}}}}(n7||(n7={}));const Bhe=v.add,r7={...Hat,pointSizeAttenuation:C.Boolean(!1),ignoreHydrogens:C.Boolean(!1),ignoreHydrogensVariant:C.Select("all",C.arrayToOptions(["all","non-polar"])),traceOnly:C.Boolean(!1),stride:C.Numeric(1,{min:1,max:100,step:1})};function Bgt(e,t,n,r,i,o){const{child:s}=n;if(s&&!s.unitMap.get(t.id))return ym.createEmpty(o);const a=t.elements,c=a.length,u=n7.create(c,c/10,o),l=v(),d=t.conformation,f=H0(n,t,i),p=v();let m=0;if(f)for(let b=0;b{e.setUpdateState(n,r,i,o,s,a,c),Qo.areEqual(o.size,s.size)||(n.updateSize=!0)},geometryUtils:ym.Utils},t)}({defaultProps:C.getDefaultValues(r7),createGeometry:Bgt,createLocationIterator:gs.fromGroup,getLoci:Sd,eachLocation:xd,setUpdateState:(t,n,r)=>{t.createGeometry=n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.traceOnly!==r.traceOnly||n.stride!==r.stride}},e)}const Ogt={"element-point":(e,t)=>vi("Points",e,t,Ohe)},Lhe={...r7},Vgt={name:"point",label:"Point",description:"Displays elements (atoms, coarse spheres) as points.",factory:function Ugt(e,t){return yn.createMulti("Point",e,t,ms,Ogt)},getParams:function Lgt(e,t){return Lhe},defaultValues:C.getDefaultValues(Lhe),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.elementCount>0},Uhe={sizeFactor:C.Numeric(.2,{min:0,max:10,step:.01}),detail:C.Numeric(0,{min:0,max:3,step:1},rt.CustomQualityParamInfo),linearSegments:C.Numeric(8,{min:1,max:48,step:1},rt.CustomQualityParamInfo),radialSegments:C.Numeric(16,{min:2,max:56,step:2},rt.CustomQualityParamInfo)},Hc=(C.getDefaultValues(Uhe),v());function zgt(e,t,n,r,i,o){const s=t.polymerElements.length;if(!s)return Nt.createEmpty(o);const{sizeFactor:a,detail:c,linearSegments:u,radialSegments:l}=i,d=u*l*s+(l+1)*s*2,f=at.createState(d,d/10,o),p=uz(u),{curvePoints:m,normalVectors:h,binormalVectors:g,widthValues:y,heightValues:b}=p;let x=0;const _=sz(t,n,{ignoreSecondaryStructure:!0});for(;_.hasNext;){const E=_.move();f.currentGroup=x;const D=Ya(E.moleculeType)?A3:w3;lz(p,E,bpe,D);const I=E.coarseBackboneFirst||E.first,R=E.coarseBackboneLast||E.last,T=r.size.size(E.centerPrev)*a,M=r.size.size(E.center)*a,N=r.size.size(E.centerNext)*a;mz(p,T,M,N,T,M,N,D);let V=u;if(E.initial){V=Math.max(Math.round(u*D),1);const F=u-V;m.copyWithin(0,3*F),g.copyWithin(0,3*F),h.copyWithin(0,3*F),y.copyWithin(0,3*F),b.copyWithin(0,3*F),v.fromArray(Hc,m,3),v.normalize(Hc,v.sub(Hc,E.p2,Hc)),v.scaleAndAdd(Hc,E.p2,Hc,M*I3),v.toArray(Hc,m,0)}else E.final&&(V=Math.max(Math.round(u*(1-D)),1),v.fromArray(Hc,m,3*V-3),v.normalize(Hc,v.sub(Hc,E.p2,Hc)),v.scaleAndAdd(Hc,E.p2,Hc,M*I3),v.toArray(Hc,m,3*V));!0===E.initial&&!0===E.final?Zn(f,E.p2,2*M,c):2===l?Z3(f,m,h,g,V,y,b,0):4===l?X3(f,m,h,g,V,y,b,0,I,R):Nz(f,m,h,g,V,l,y,b,I,R,"elliptical"),++x}const S=at.getMesh(f),A=_e.expand(_e(),t.boundary.sphere,1*i.sizeFactor);return S.setBoundingSphere(A),S}const Vhe={...hs,...Uhe};function Ggt(e){return Hs({defaultProps:C.getDefaultValues(Vhe),createGeometry:zgt,createLocationIterator:t=>lh.fromGroup(t,{asSecondary:!0}),getLoci:Y0,eachLocation:X0,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail||n.linearSegments!==r.linearSegments||n.radialSegments!==r.radialSegments}},e)}const zhe={"polymer-tube":(e,t)=>vi("Polymer tube mesh",e,t,Ggt),"polymer-gap":(e,t)=>vi("Polymer gap cylinder",e,t,Ez)},Ghe={...Vhe,...q3,sizeFactor:C.Numeric(.2,{min:0,max:10,step:.01}),visuals:C.MultiSelect(["polymer-tube","polymer-gap"],C.objectToOptions(zhe)),bumpFrequency:C.Numeric(2,{min:0,max:10,step:.1},rt.ShadingCategory)},qgt={name:"putty",label:"Putty",description:"Displays a tube smoothly following the trace atoms of polymers.",factory:function Hgt(e,t){return yn.createMulti("Putty",e,t,ms,zhe)},getParams:function jgt(e,t){const n=C.clone(Ghe);let r=!1,i=!1;return t.units.forEach(o=>{!r&&Ee.isAtomic(o)&&o.nucleotideElements.length&&(r=!0),!i&&o.gapElements.length&&(i=!0)}),n.visuals.defaultValue=["polymer-tube"],i&&n.visuals.defaultValue.push("polymer-gap"),n},defaultValues:C.getDefaultValues(Ghe),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uncertainty"},isApplicable:e=>e.polymerResidueCount>0},jhe={"element-sphere":(e,t)=>vi("Sphere mesh/impostor",e,t,Wfe),"structure-element-sphere":(e,t)=>Iu("Structure sphere mesh/impostor",e,t,ept)},i7={...y3,bumpFrequency:C.Numeric(1,{min:0,max:10,step:.1},rt.ShadingCategory),visuals:C.MultiSelect(["element-sphere"],C.objectToOptions(jhe))};let Q3;const Ygt={name:"spacefill",label:"Spacefill",description:"Displays atomic/coarse elements as spheres.",factory:function $gt(e,t){return yn.createMulti("Spacefill",e,t,ms,jhe)},getParams:function Wgt(e,t){return t.isCoarseGrained?(Q3||(Q3=C.clone(i7),Q3.sizeFactor.defaultValue=2),Q3):i7},defaultValues:C.getDefaultValues(i7),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"physical"},isApplicable:e=>e.elementCount>0},o7=jn.is;function Xgt(e,t,n,r,i,o){if(!Ee.isAtomic(t))return di.createEmpty(o);const{child:s}=n,a=s?.unitMap.get(t.id);if(s&&!a)return di.createEmpty(o);const c=nt.create(n,t),u=t.elements,l=t.bonds,{edgeCount:d,a:f,b:p,edgeProps:m,offset:h}=l;if(!d)return di.createEmpty(o);const{order:g,flags:y}=m,{sizeFactor:b,aromaticBonds:x,includeTypes:_,excludeTypes:S,multipleBonds:A}=i,E="off"===A,w="symmetric"===A,R=h3(jn.fromNames(_),jn.fromNames(S),32),T=v(),M=t.conformation,{elementRingIndices:N,elementAromaticRingIndices:V}=t.rings,F=x?t.resonance.delocalizedTriplets:void 0,G={linkCount:2*d,referencePosition:j=>{let Z=f[j],$=p[j];const ee=F?.getThirdElement(Z,$);if(void 0!==ee)return M.invariantPosition(u[ee],T);Z>$&&([Z,$]=[$,Z]),h[Z+1]-h[Z]==1&&([Z,$]=[$,Z]);const q=V.get(Z)||N.get(Z);let O=0;for(let H=h[Z],W=h[Z+1];HO&&(O=X,M.invariantPosition(u[Q],T))}}}return O>0?T:null},position:(j,Z,$)=>{M.invariantPosition(u[f[$]],j),M.invariantPosition(u[p[$]],Z)},style:j=>{const Z=g[j],$=y[j];if(o7($,2)||o7($,4))return 1;if(3===Z)return E?0:w?4:5;if(x){const q=p[j],O=V.get(f[j]),H=V.get(q),W=O&&H?zI(O,H):0;if(o7($,16)||W&&!R)return 2===W?8:7}return 2!==Z||E?0:w?2:3},radius:j=>{c.element=u[f[j]];const Z=r.size.size(c);c.element=u[p[j]];const $=r.size.size(c);return Math.min(Z,$)*b},ignore:Ofe(n,t,i)},{lines:L,boundingSphere:z}=ede(0,G,i,o);if(z)L.setBoundingSphere(z);else if(L.lineCount>0){const j=_e.expand(_e(),(a??t).boundary.sphere,1*b);L.setBoundingSphere(j)}return L}const Hhe={...qE,...BV,includeParent:C.Boolean(!1)};function Kgt(e){return WE({defaultProps:C.getDefaultValues(Hhe),createGeometry:Xgt,createLocationIterator:t=>Um.fromGroup(t),getLoci:OV,eachLocation:LV,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.linkScale!==r.linkScale||n.linkSpacing!==r.linkSpacing||n.aromaticDashCount!==r.aromaticDashCount||n.dashCount!==r.dashCount||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||!Wa(n.includeTypes,r.includeTypes)||!Wa(n.excludeTypes,r.excludeTypes)||n.aromaticBonds!==r.aromaticBonds||n.multipleBonds!==r.multipleBonds;const c=s.group.units[0],u=a.group.units[0];Ee.isAtomic(c)&&Ee.isAtomic(u)&&(Dc.areEqual(c.bonds,u.bonds)||(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.updateSize=!0))}},e)}const s7=new Lt.ElementBondIterator;function qhe(e,t,n,r){for(s7.setElement(t,n,r);s7.hasNext;){const i=s7.move();return i.otherUnit.conformation.position(i.otherUnit.elements[i.otherIndex],e),e}return null}function Zgt(e,t,n,r,i){const o=t.interUnitBonds,{edgeCount:s,edges:a}=o;if(!s)return di.createEmpty(i);const{sizeFactor:c,aromaticBonds:u,multipleBonds:l}=r,d="off"===l,f="symmetric"===l,p=v(),m=nt.create(),h={linkCount:s,referencePosition:b=>{const x=a[b];let _,S,A,E;if(x.unitAx.unitB))throw new Error("same units in createInterUnitBondLines");_=t.unitMap.get(x.unitB),S=t.unitMap.get(x.unitA),A=x.indexB,E=x.indexA}return qhe(p,t,_,A)||qhe(p,t,S,E)},position:(b,x,_)=>{const S=a[_],A=t.unitMap.get(S.unitA),E=t.unitMap.get(S.unitB);A.conformation.position(A.elements[S.indexA],b),E.conformation.position(E.elements[S.indexB],x)},style:b=>{const x=a[b].props.order,_=ea.create(a[b].props.flag);return jn.is(_,2)||jn.is(_,4)?1:3===x?d?0:f?4:5:u&&jn.is(_,16)?7:2!==x||d?0:f?2:3},radius:b=>{const x=a[b];m.structure=t,m.unit=t.unitMap.get(x.unitA),m.element=m.unit.elements[x.indexA];const _=n.size.size(m);m.unit=t.unitMap.get(x.unitB),m.element=m.unit.elements[x.indexB];const S=n.size.size(m);return Math.min(_,S)*c},ignore:Lfe(t,r)},{lines:g,boundingSphere:y}=ede(0,h,r,i);if(y)g.setBoundingSphere(y);else if(g.lineCount>0){const{child:b}=t,x=_e.expand(_e(),(b??t).boundary.sphere,1*c);g.setBoundingSphere(x)}return g}const Whe={...Fat,...BV,includeParent:C.Boolean(!1)};function Qgt(e){return function Bat(e,t){return N0({...e,setUpdateState:(n,r,i,o,s,a,c)=>{e.setUpdateState(n,r,i,o,s,a,c),Qo.areEqual(o.size,s.size)||(n.updateSize=!0)},geometryUtils:di.Utils},t)}({defaultProps:C.getDefaultValues(Whe),createGeometry:Zgt,createLocationIterator:t=>Um.fromStructure(t),getLoci:UV,eachLocation:zV,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.linkScale!==r.linkScale||n.linkSpacing!==r.linkSpacing||n.aromaticDashCount!==r.aromaticDashCount||n.dashCount!==r.dashCount||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||!Wa(n.includeTypes,r.includeTypes)||!Wa(n.excludeTypes,r.excludeTypes)||n.multipleBonds!==r.multipleBonds,s.interUnitBonds!==a.interUnitBonds&&(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.updateSize=!0)}},e)}const V1=v.scaleAndAdd,$he=v.unitX,Yhe=v.unitY,Xhe=v.unitZ,Khe={...qE,lineSizeAttenuation:C.Boolean(!1),ignoreHydrogens:C.Boolean(!1),ignoreHydrogensVariant:C.Select("all",C.arrayToOptions(["all","non-polar"])),traceOnly:C.Boolean(!1),crosses:C.Select("lone",C.arrayToOptions(["lone","all"])),crossSize:C.Numeric(.35,{min:0,max:2,step:.01})};function Jgt(e,t,n,r,i,o){const{child:s}=n;if(s&&!s.unitMap.get(t.id))return di.createEmpty(o);const a=t.elements,c=a.length,u=Fc.create(c,c/10,o),l=v(),d=v(),f=v(),p=t.conformation,m=H0(n,t,i),h=i.crossSize/2,g="lone"===i.crosses;for(let x=0;x{t.createGeometry=n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.traceOnly!==r.traceOnly||n.crosses!==r.crosses||n.crossSize!==r.crossSize}},e)}const Zhe={"intra-bond":(e,t)=>vi("Intra-unit bond line",e,t,Kgt),"inter-bond":(e,t)=>Iu("Inter-unit bond line",e,t,Qgt),"element-point":(e,t)=>vi("Points",e,t,Ohe),"element-cross":(e,t)=>vi("Crosses",e,t,e0t)},a7={...Hhe,...Whe,...r7,...Khe,pointStyle:C.Select("circle",C.objectToOptions(ym.StyleTypes)),multipleBonds:C.Select("offset",C.arrayToOptions(["off","symmetric","offset"])),includeParent:C.Boolean(!1),sizeFactor:C.Numeric(2,{min:.01,max:10,step:.01}),unitKinds:oC(["atomic"]),visuals:C.MultiSelect(["intra-bond","inter-bond","element-point","element-cross"],C.objectToOptions(Zhe))},r0t={name:"line",label:"Line",description:"Displays bonds as lines and atoms as points or croses.",factory:function n0t(e,t){return yn.createMulti("Line",e,t,ms,Zhe)},getParams:function t0t(e,t){if(Ve.getSize(t)>=Ve.Size.Huge){const r=C.clone(a7);return r.visuals.defaultValue=["intra-bond","element-point","element-cross"],r}return a7},defaultValues:C.getDefaultValues(a7),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.elementCount>0,getData:(e,t)=>t.includeParent?e.asParent():e,mustRecreate:(e,t)=>e.includeParent!==t.includeParent};function i0t(e,t,n,r,i){return c7.apply(this,arguments)}function c7(){return c7=ie(function*(e,t,n,r,i){const{runtime:o,webgl:s}=e;if(!s||!s.extensions.blendMinMax)throw new Error("GaussianDensityVolume requires `webgl` and `blendMinMax` extension");const a=i?i.gridTexture.ref.value:void 0,c=yield function Umt(e,t,n,r,i){const{position:o,boundary:s,radius:a}=HE(e,t,n),c=Pm(s.box,n);return Oe.create("Gaussian Density",function(){var u=ie(function*(l){return she(r,o,s.box,a,c,i)});return function(l){return u.apply(this,arguments)}}())}(t,n.size,r,s,a).runInContext(o),{transform:u,texture:l,bbox:d,gridDim:f}=c,m=le.mul(le(),u,le.fromScaling(le(),f)),h=le.getScaling(v(),u),g=v.create(0,1,2),y=_u.create(d,f,u,m,h,l,{min:0,max:1,mean:.04,sigma:.01},!0,g,i),b=_e.expand(_e(),t.boundary.sphere,c.maxRadius);return y.setBoundingSphere(b),y}),c7.apply(this,arguments)}const Qhe={...Uat,...MC,ignoreHydrogens:C.Boolean(!1),ignoreHydrogensVariant:C.Select("all",C.arrayToOptions(["all","non-polar"])),includeParent:C.Boolean(!1,{isHidden:!0})};function o0t(e){return function Vat(e,t){return N0({...e,setUpdateState:(n,r,i,o,s,a,c)=>{e.setUpdateState(n,r,i,o,s,a,c),Qo.areEqual(o.size,s.size)||(n.createGeometry=!0)},geometryUtils:_u.Utils},t)}({defaultProps:C.getDefaultValues(Qhe),createGeometry:i0t,createLocationIterator:gs.fromStructure,getLoci:W0,eachLocation:q0,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.radiusOffset!==r.radiusOffset&&(t.createGeometry=!0),n.smoothness!==r.smoothness&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0)},dispose:t=>{t.gridTexture.ref.value.destroy()}},e)}function s0t(e,t,n,r,i,o){return u7.apply(this,arguments)}function u7(){return u7=ie(function*(e,t,n,r,i,o){const{runtime:s,webgl:a}=e;if(!a)throw new Error("GaussianDensityVolume requires `webgl`");const c=o?o.gridTexture.ref.value:void 0,u=yield function Bmt(e,t,n,r,i,o){const{position:s,boundary:a,radius:c}=jE(e,t,n,r),u=Pm(a.box,r,yhe(i,e));return Oe.create("Gaussian Density",function(){var l=ie(function*(d){return she(i,s,a.box,c,u,o)});return function(d){return l.apply(this,arguments)}}())}(n,t,r.size,i,a,c).runInContext(s),{transform:l,texture:d,bbox:f,gridDim:p}=u,h=le.mul(le(),l,le.fromScaling(le(),p)),g=le.getScaling(v(),l),y=v.create(0,1,2),b=_u.create(f,p,l,h,g,d,{min:0,max:1,mean:.04,sigma:.01},!0,y,o),x=_e.expand(_e(),t.boundary.sphere,u.maxRadius);return b.setBoundingSphere(x),b}),u7.apply(this,arguments)}const a0t={...Wat,...MC,ignoreHydrogens:C.Boolean(!1),ignoreHydrogensVariant:C.Select("all",C.arrayToOptions(["all","non-polar"])),includeParent:C.Boolean(!1,{isHidden:!0})};function c0t(e){return function $at(e,t){return Mm({...e,setUpdateState:(n,r,i,o,s,a,c)=>{e.setUpdateState(n,r,i,o,s,a,c),Qo.areEqual(o.size,s.size)||(n.createGeometry=!0)},geometryUtils:_u.Utils},t)}({defaultProps:C.getDefaultValues(a0t),createGeometry:s0t,createLocationIterator:gs.fromGroup,getLoci:Sd,eachLocation:xd,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.radiusOffset!==r.radiusOffset&&(t.createGeometry=!0),n.smoothness!==r.smoothness&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0)},dispose:t=>{t.gridTexture.ref.value.destroy()}},e)}const Jhe={"gaussian-volume":(e,t)=>Iu("Gaussian volume",e,t,o0t),"units-gaussian-volume":(e,t)=>vi("Units-Gaussian volume",e,t,c0t)},eme={...Qhe,jumpLength:C.Numeric(4,{min:0,max:20,step:.1}),visuals:C.MultiSelect(["gaussian-volume"],C.objectToOptions(Jhe))},d0t={name:"gaussian-volume",label:"Gaussian Volume",description:"Displays a gaussian molecular density using direct volume rendering.",factory:function l0t(e,t){return yn.createMulti("Gaussian Volume",e,t,ms,Jhe)},getParams:function u0t(e,t){return eme},defaultValues:C.getDefaultValues(eme),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"physical"},isApplicable:e=>e.elementCount>0},f0t=v.scale,p0t=v.add,h0t=v.sub,l7={...hs,...wU,sizeFactor:C.Numeric(.3,{min:0,max:10,step:.01}),radialSegments:C.Numeric(16,{min:2,max:56,step:2},rt.CustomQualityParamInfo),tryUseImpostor:C.Boolean(!0)};function m0t(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth?function y0t(e){return AU({defaultProps:C.getDefaultValues(l7),createGeometry:g0t,createLocationIterator:t=>lh.fromGroup(t),getLoci:Y0,eachLocation:X0,setUpdateState:(t,n,r)=>{},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function v0t(e){return Hs({defaultProps:C.getDefaultValues(l7),createGeometry:b0t,createLocationIterator:t=>lh.fromGroup(t),getLoci:Y0,eachLocation:X0,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.radialSegments!==r.radialSegments},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}function g0t(e,t,n,r,i,o){const s=t.polymerElements.length;if(!s)return oc.createEmpty(o);const a=2*s,c=aC.create(a,a/4,o),u=t.conformation,l=v(),d=v(),f=v();cpe(t,function(g,y,b,x,_){u.invariantPosition(g,l),u.invariantPosition(y,d);const A=Ya(_)?A3:w3;p0t(f,l,f0t(f,h0t(f,d,l),A)),c.add(l[0],l[1],l[2],f[0],f[1],f[2],1,!1,!1,2,b),c.add(f[0],f[1],f[2],d[0],d[1],d[2],1,!1,!1,2,x)});const m=c.getCylinders(),h=_e.expand(_e(),t.boundary.sphere,1*i.sizeFactor);return m.setBoundingSphere(h),m}function b0t(e,t,n,r,i,o){const s=t.polymerElements.length;if(!s)return Nt.createEmpty(o);const{radialSegments:a,sizeFactor:c}=i,u=2*a*s*2,l=at.createState(u,u/10,o),d=t.conformation,f=v(),p=v(),m={radiusTop:1,radiusBottom:1,radialSegments:a},h=nt.create(n,t),g=nt.create(n,t);cpe(t,function(_,S,A,E,w){h.element=_,g.element=S,d.invariantPosition(h.element,f),d.invariantPosition(g.element,p);const I=Ya(w)?A3:w3;m.radiusTop=m.radiusBottom=r.size.size(h)*c,l.currentGroup=A,Hn(l,f,p,I,m),m.radiusTop=m.radiusBottom=r.size.size(g)*c,l.currentGroup=E,Hn(l,p,f,1-I,m)});const b=at.getMesh(l),x=_e.expand(_e(),t.boundary.sphere,1*i.sizeFactor);return b.setBoundingSphere(x),b}const d7={...hs,...SU,sizeFactor:C.Numeric(.3,{min:0,max:10,step:.01}),detail:C.Numeric(0,{min:0,max:3,step:1},rt.CustomQualityParamInfo),tryUseImpostor:C.Boolean(!0)};function _0t(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth&&r.extensions.textureFloat?function S0t(e){return CU({defaultProps:C.getDefaultValues(d7),createGeometry:x0t,createLocationIterator:t=>lh.fromGroup(t),getLoci:Y0,eachLocation:X0,setUpdateState:(t,n,r)=>{},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function w0t(e){return Hs({defaultProps:C.getDefaultValues(d7),createGeometry:C0t,createLocationIterator:t=>lh.fromGroup(t),getLoci:Y0,eachLocation:X0,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}function x0t(e,t,n,r,i,o){const s=t.polymerElements.length;if(!s)return fl.createEmpty(o);const a=f1.create(s,s/2,o),c=t.conformation,u=v();upe(t,(p,m)=>{c.invariantPosition(p,u),a.add(u[0],u[1],u[2],m)});const d=a.getSpheres(),f=_e.expand(_e(),t.boundary.sphere,1*i.sizeFactor);return d.setBoundingSphere(f),d}function C0t(e,t,n,r,i,o){const s=t.polymerElements.length;if(!s)return Nt.createEmpty(o);const{detail:a,sizeFactor:c}=i,u=s*xv(a),l=at.createState(u,u/2,o),d=t.conformation,f=v(),p=nt.create(n,t);upe(t,(y,b)=>{p.element=y,d.invariantPosition(p.element,f),l.currentGroup=b,Zn(l,f,r.size.size(p)*c,a)});const h=at.getMesh(l),g=_e.expand(_e(),t.boundary.sphere,1*i.sizeFactor);return h.setBoundingSphere(g),h}const tme={"polymer-backbone-cylinder":(e,t)=>vi("Polymer backbone cylinder",e,t,m0t),"polymer-backbone-sphere":(e,t)=>vi("Polymer backbone sphere",e,t,_0t),"polymer-gap":(e,t)=>vi("Polymer gap cylinder",e,t,Ez)},nme={...d7,...l7,...q3,sizeAspectRatio:C.Numeric(1,{min:.1,max:3,step:.1}),visuals:C.MultiSelect(["polymer-backbone-cylinder","polymer-backbone-sphere","polymer-gap"],C.objectToOptions(tme)),bumpFrequency:C.Numeric(0,{min:0,max:10,step:.1},rt.ShadingCategory),colorMode:C.Select("default",C.arrayToOptions(["default","interpolate"]),{...rt.ShadingCategory,isHidden:!0})},T0t={name:"backbone",label:"Backbone",description:"Displays polymer backbone with cylinders and spheres.",factory:function I0t(e,t){return yn.createMulti("Backbone",e,t,ms,tme)},getParams:function A0t(e,t){const n=C.clone(nme);let r=!1;return t.units.forEach(i=>{!r&&i.gapElements.length&&(r=!0)}),n.visuals.defaultValue=["polymer-backbone-cylinder","polymer-backbone-sphere"],r&&n.visuals.defaultValue.push("polymer-gap"),n},defaultValues:C.getDefaultValues(nme),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.polymerResidueCount>0};class kC extends Vae{constructor(){super(),$a(kC.BuiltIn,(t,n)=>{if(t.name!==n)throw new Error(`Fix BuiltInStructureRepresentations to have matching names. ${t.name} ${n}`);this.add(t)})}}!function(e){e.BuiltIn={cartoon:Smt,backbone:T0t,"ball-and-stick":opt,carbohydrate:jpt,ellipsoid:Tmt,"gaussian-surface":tgt,"gaussian-volume":d0t,label:ugt,line:r0t,"molecular-surface":wgt,orientation:kgt,point:Vgt,putty:qgt,spacefill:Ygt}}(kC||(kC={}));class D0t{get isAnimating(){return this._isAnimating}tick(t,n){var r=this;return ie(function*(){var i,o;if(yield r.plugin.managers.animation.tick(t,n?.isSynchronous,n?.animation),null===(i=r.plugin.canvas3d)||void 0===i||i.tick(t,n),lt){const s=null===(o=r.plugin.canvas3d)||void 0===o?void 0:o.webgl.timer.resolve();if(s)for(const a of s)Fre([a])}})()}resetTime(t=yi()){var n;null===(n=this.plugin.canvas3d)||void 0===n||n.resetTime(t)}start(t){var n;null===(n=this.plugin.canvas3d)||void 0===n||n.resume(),this._isAnimating=!0,this.resetTime(),t?.immediate?this.frame():this.currentFrame=requestAnimationFrame(this.frame)}stop(t){var n;this._isAnimating=!1,void 0!==this.currentFrame&&(cancelAnimationFrame(this.currentFrame),this.currentFrame=void 0),t?.noDraw&&(null===(n=this.plugin.canvas3d)||void 0===n||n.pause(t?.noDraw))}constructor(t){this.plugin=t,this.currentFrame=void 0,this._isAnimating=!1,this.frame=()=>{this.tick(yi()),this._isAnimating&&(this.currentFrame=requestAnimationFrame(this.frame))}}}class z1 extends ZS{get animation(){return this.plugin.managers.animation}getSnapshot(t){var n,r,i;const o={...this.snapshotParams.value,...t};return{id:Hr.create22(),data:o.data?this.data.getSnapshot():void 0,behaviour:o.behavior?this.behaviors.getSnapshot():void 0,animation:o.animation?this.animation.getSnapshot():void 0,startAnimation:o.startAnimation?!!o.startAnimation:void 0,camera:o.camera?{current:this.plugin.canvas3d.camera.getSnapshot(),transitionStyle:o.cameraTransition.name,transitionDurationInMs:"animate"===(null===(n=o?.cameraTransition)||void 0===n?void 0:n.name)?o.cameraTransition.params.durationInMs:void 0}:void 0,canvas3dContext:o.canvas3dContext?{props:null===(r=this.plugin.canvas3dContext)||void 0===r?void 0:r.props}:void 0,canvas3d:o.canvas3d?{props:null===(i=this.plugin.canvas3d)||void 0===i?void 0:i.props}:void 0,interactivity:o.interactivity?{props:this.plugin.managers.interactivity.props}:void 0,structureFocus:this.plugin.managers.structure.focus.getSnapshot(),structureSelection:o.structureSelection?this.plugin.managers.structure.selection.getSnapshot():void 0,structureComponentManager:o.componentManager?{options:this.plugin.managers.structure.component.state.options}:void 0,durationInMs:o?.durationInMs}}setSnapshot(t){var n=this;return ie(function*(){var r,i,o,s,a;if(yield n.animation.stop(),!(null===(r=t.structureComponentManager)||void 0===r)&&r.options&&n.plugin.managers.structure.component._setSnapshotState(null===(i=t.structureComponentManager)||void 0===i?void 0:i.options),t.behaviour&&(yield n.plugin.runTask(n.behaviors.setSnapshot(t.behaviour))),t.data&&(yield n.plugin.runTask(n.data.setSnapshot(t.data))),null!==(o=t.canvas3d)&&void 0!==o&&o.props){const c=C.normalizeParams(Xue,t.canvas3d.props,"children");yield Cn.Canvas3D.SetSettings(n.plugin,{settings:c})}if(null!==(s=t.canvas3dContext)&&void 0!==s&&s.props){const c=C.normalizeParams(ME.Params,t.canvas3dContext.props,"children");null===(a=n.plugin.canvas3dContext)||void 0===a||a.setProps(c)}t.interactivity&&t.interactivity.props&&n.plugin.managers.interactivity.setProps(t.interactivity.props),t.structureFocus&&n.plugin.managers.structure.focus.setSnapshot(t.structureFocus),t.structureSelection&&n.plugin.managers.structure.selection.setSnapshot(t.structureSelection),t.animation&&n.animation.setSnapshot(t.animation),t.camera&&Cn.Camera.Reset(n.plugin,{snapshot:t.camera.current,durationMs:"animate"===t.camera.transitionStyle?t.camera.transitionDurationInMs:void 0}),t.startAnimation&&n.animation.start()})()}updateTransform(t,n,r,i){const o=t.build().to(n).update(r);return Cn.State.Update(this.plugin,{state:t,tree:o,options:{canUndo:i}})}hasBehavior(t){return this.behaviors.tree.transforms.has(t.id)}updateBehavior(t,n){const r=this.behaviors.build();if(this.behaviors.tree.transforms.has(t.id))r.to(t.id).update(n);else{const i=t.createDefaultParams(void 0,this.plugin);r.to(tr.getCategoryId(t)).apply(t,c0(i,n),{ref:t.id})}return this.plugin.runTask(this.behaviors.updateTree(r))}dispose(){this.behaviors.cells.forEach(t=>{var n,r,i,o;tr.Behavior.is(t.obj)&&(null===(r=(n=t.obj.data).unregister)||void 0===r||r.call(n),null===(o=(i=t.obj.data).dispose)||void 0===o||o.call(i))}),super.dispose(),this.data.dispose(),this.behaviors.dispose(),this.animation.dispose()}constructor(t){super(),this.plugin=t,this.data=iD.create(new pe.Root({}),{runTask:this.plugin.runTask,globalContext:this.plugin,historyCapacity:this.plugin.config.get(qi.State.HistoryCapacity)}),this.behaviors=iD.create(new tr.Root({}),{runTask:this.plugin.runTask,globalContext:this.plugin,rootState:{isLocked:!0}}),this.events={cell:{stateUpdated:ch(this.data.events.cell.stateUpdated,this.behaviors.events.cell.stateUpdated),created:ch(this.data.events.cell.created,this.behaviors.events.cell.created),removed:ch(this.data.events.cell.removed,this.behaviors.events.cell.removed)},object:{created:ch(this.data.events.object.created,this.behaviors.events.object.created),removed:ch(this.data.events.object.removed,this.behaviors.events.object.removed),updated:ch(this.data.events.object.updated,this.behaviors.events.object.updated)}},this.snapshotParams=this.ev.behavior(z1.DefaultSnapshotParams),this.setSnapshotParams=n=>{this.snapshotParams.next({...z1.DefaultSnapshotParams,...n})}}}!function(e){e.SnapshotParams={durationInMs:C.Numeric(1500,{min:100,max:15e3,step:100},{label:"Duration in ms"}),data:C.Boolean(!0),behavior:C.Boolean(!1),structureSelection:C.Boolean(!1),componentManager:C.Boolean(!0),animation:C.Boolean(!0),startAnimation:C.Boolean(!1),canvas3d:C.Boolean(!0),canvas3dContext:C.Boolean(!0),interactivity:C.Boolean(!0),camera:C.Boolean(!0),cameraTransition:C.MappedStatic("animate",{animate:C.Group({durationInMs:C.Numeric(250,{min:100,max:5e3,step:500},{label:"Duration in ms"})}),instant:C.Group({})},{options:[["animate","Animate"],["instant","Instant"]]}),image:C.Boolean(!1)},e.DefaultSnapshotParams=C.getDefaultValues(e.SnapshotParams)}(z1||(z1={}));class E0t{getDecorator(t){const n=this.plugin.state.data.tree,r=n.children.get(t);if(1!==r.size)return t;const i=r.first();return n.transforms.get(i).transformer.definition.isDecorator?this.getDecorator(i):t}get(t,n=!1){const r=this.root.get(t);if(r)return this.plugin.state.data.cells.get(n?r.ref:this.getDecorator(r.ref))}addMapping(t,n,r){if(!pe.Molecule.Structure.is(r))return!1;if(this.tracked.set(n,r.data),this.root.has(r.data))this.root.get(r.data).count++;else{const i=t.select(In.Generators.byRef(n).rootOfType([pe.Molecule.Structure]))[0];this.root.set(r.data,i?{ref:i.transform.ref,count:1}:{ref:n,count:1})}return!0}removeMapping(t){if(!this.tracked.has(t))return!1;const n=this.tracked.get(t);this.tracked.delete(t);const r=this.root.get(n);return r.count>1?r.count--:this.root.delete(n),!0}updateMapping(t,n,r,i){return!!pe.Molecule.Structure.is(i)&&(this.removeMapping(n),this.addMapping(t,n,i),!0)}dispose(){this.ev.dispose()}constructor(t){this.plugin=t,this.ev=wp.create(),this.events={updated:this.ev(),removed:this.ev()},this.root=new Map,this.tracked=new Map,t.state.data.events.object.created.subscribe(n=>{this.addMapping(n.state,n.ref,n.obj)}),t.state.data.events.object.removed.subscribe(n=>{this.removeMapping(n.ref)&&this.events.removed.next({ref:n.ref,obj:n.obj})}),t.state.data.events.object.updated.subscribe(n=>{this.updateMapping(n.state,n.ref,n.oldObj,n.obj)&&this.events.updated.next({ref:n.ref,oldObj:n.oldObj,obj:n.obj})})}}class f7{constructor(){this.ev=wp.create(),this.id=0,this.runningTasks=new Set,this.abortRequests=new Map,this.options=new Map,this.currentContext=[],this.events={progress:this.ev(),finished:this.ev()}}tryGetAbortTaskId(t){if(this.abortRequests.has(t.progress.taskId))return t.progress.taskId;for(const n of t.children){const r=this.tryGetAbortTaskId(n);if(void 0!==r)return r}}track(t,n){return r=>{var i;if(r.canAbort&&r.requestAbort){const s=this.tryGetAbortTaskId(r.root);void 0!==s&&r.requestAbort(this.abortRequests.get(s))}const o=yi()-r.root.progress.startedTime;this.events.progress.next({id:t,useOverlay:null===(i=this.options.get(n))||void 0===i?void 0:i.useOverlay,level:o<250?"none":"background",progress:r})}}run(t,n){var r=this;return ie(function*(){const i=r.id++;let o;n?.createNewContext||0===r.currentContext.length?o={ctx:LMe(t,r.track(i,t.id),100),refCount:1}:(o=r.currentContext[r.currentContext.length-1],o.refCount++);try{return r.options.set(t.id,{useOverlay:!!n?.useOverlay}),r.runningTasks.add(t.id),yield UZ(o.ctx,t)}finally{r.options.delete(t.id),r.runningTasks.delete(t.id),r.events.finished.next({id:i}),r.abortRequests.delete(t.id),o.refCount--,0===o.refCount&&Xx(r.currentContext,o)}})()}requestAbortAll(t){this.runningTasks.forEach(n=>this.abortRequests.set(n,t))}requestAbort(t,n){this.abortRequests.set("number"==typeof t?t:t.root.progress.taskId,n)}dispose(){this.ev.dispose()}}!function(e){function t(r){return new Promise(i=>setTimeout(i,r))}e.testTask=function n(r){return Oe.create("Test",function(){var i=ie(function*(o){let s=0;for(;s!!n&&n.key===t)}show(t){let r,n=this.state.entries;const i=++this.serialId;let o;t.key&&(r=this.findByKey(t.key))?(void 0!==r.timeout&&clearTimeout(r.timeout),o=r.serialNumber,n=n.remove(r.id)):o=++this.serialNumber,r={id:i,serialNumber:o,key:t.key,title:t.title,message:t.message,timeout:this.timeout(i,t.timeoutMs),hide:()=>this.hideId(i)},this.updateState({entries:n.set(i,r)})&&this.events.changed.next(void 0)}timeout(t,n){if(void 0!==n)return n<0&&(n=500),setTimeout(()=>{const r=this.state.entries.get(t);r.timeout=void 0,this.hide(r)},n)}hideId(t){this.hide(this.state.entries.get(t))}hide(t){t&&(void 0!==t.timeout&&clearTimeout(t.timeout),t.hide=void 0,this.updateState({entries:this.state.entries.delete(t.id)})&&this.events.changed.next(void 0))}constructor(t){super({entries:ol()}),this.events={changed:this.ev()},this.serialNumber=0,this.serialId=0,Cn.Toast.Show.subscribe(t,n=>this.show(n)),Cn.Toast.Hide.subscribe(t,n=>this.hide(this.findByKey(n.key)))}}class M0t extends ZS{createParams(){const t=Math.min(this.plugin.canvas3d?this.plugin.canvas3d.webgl.maxRenderbufferSize:4096,4096);return{resolution:C.MappedStatic("viewport",{viewport:C.Group({}),hd:C.Group({}),"full-hd":C.Group({}),"ultra-hd":C.Group({}),custom:C.Group({width:C.Numeric(1920,{min:128,max:t,step:1}),height:C.Numeric(1080,{min:128,max:t,step:1})},{isFlat:!0})},{options:[["viewport","Viewport"],["hd","HD (1280 x 720)"],["full-hd","Full HD (1920 x 1080)"],["ultra-hd","Ultra HD (3840 x 2160)"],["custom","Custom"]]}),transparent:C.Boolean(!1),axes:IE.axes}}get params(){return this._params?this._params:this._params=this.createParams()}get values(){return this.behaviors.values.value}get cropParams(){return this.behaviors.cropParams.value}get relativeCrop(){return this.behaviors.relativeCrop.value}getCanvasSize(){var t,n;return{width:(null===(t=this.plugin.canvas3d)||void 0===t?void 0:t.webgl.gl.drawingBufferWidth)||0,height:(null===(n=this.plugin.canvas3d)||void 0===n?void 0:n.webgl.gl.drawingBufferHeight)||0}}getSize(){const t=this.values;switch(t.resolution.name){case"viewport":return this.getCanvasSize();case"hd":return{width:1280,height:720};case"full-hd":return{width:1920,height:1080};case"ultra-hd":return{width:3840,height:2160};default:return{width:t.resolution.params.width,height:t.resolution.params.height}}}createPass(t){const n=this.plugin.canvas3d,{colorBufferFloat:r,textureFloat:i}=n.webgl.extensions,o=n.props.postprocessing.occlusion;return n.getImagePass({transparentBackground:this.values.transparent,cameraHelper:{axes:this.values.axes},multiSample:{...n.props.multiSample,mode:t?"on":"off",sampleLevel:r&&i?4:2},postprocessing:{...n.props.postprocessing,occlusion:"on"===o.name?{name:"on",params:{...o.params,samples:128,resolutionScale:n.webgl.pixelRatio}}:o},marking:{...n.props.marking}})}get previewPass(){return this._previewPass||(this._previewPass=this.createPass(!1))}get imagePass(){if(this._imagePass){const t=this.plugin.canvas3d,n=t.props.postprocessing.occlusion;return this._imagePass.setProps({cameraHelper:{axes:this.values.axes},transparentBackground:this.values.transparent,postprocessing:{...t.props.postprocessing,occlusion:"on"===n.name?{name:"on",params:{...n.params,samples:128,resolutionScale:t.webgl.pixelRatio}}:n},marking:{...t.props.marking}}),this._imagePass}return this._imagePass=this.createPass(!0)}getFilename(t=".png"){const n=this.plugin.state.data.select(In.Generators.rootsOfType(pe.Molecule.Model)).map(o=>o.obj.data),r=new Set;return n.forEach(o=>r.add(o.entryId.toUpperCase())),`${Si.toArray(r).join("-")||"molstar-image"}${t}`}resetCrop(){this.behaviors.relativeCrop.next({x:0,y:0,width:1,height:1})}toggleAutocrop(){this.cropParams.auto?(this.behaviors.cropParams.next({...this.cropParams,auto:!1}),this.resetCrop()):this.behaviors.cropParams.next({...this.cropParams,auto:!0})}get isFullFrame(){const t=this.relativeCrop;return ai(t.x,0,1e-5)&&ai(t.y,0,1e-5)&&ai(t.width,1,1e-5)&&ai(t.height,1,1e-5)}autocrop(t=this.cropParams.relativePadding){const{data:n,width:r,height:i}=this.previewData.image,o=this.previewData.transparent,s=o?this.previewData.background:4278190080|this.previewData.background;let a=r,c=0,u=i,l=0;for(let m=0;mc&&(c=g),ml&&(l=m)}}if(a>c){const m=a;a=c,c=m}if(u>l){const m=u;u=l,l=m}const d=c-a+1,f=l-u+1;a-=t*d,c+=t*d,u-=t*f,l+=t*f;const p={x:Math.max(0,a/r),y:Math.max(0,u/i),width:Math.min(1,(c-a+1)/r),height:Math.min(1,(l-u+1)/i)};this.behaviors.relativeCrop.next(p)}getPreview(t=320){const{width:n,height:r}=this.getSize();if(n<=0||r<=0)return;const i=n/r;let o=0,s=0;i>1?(o=t,s=Math.round(t/i)):(s=t,o=Math.round(t*i));const a=this.plugin.canvas3d.props;this.previewPass.setProps({cameraHelper:{axes:this.values.axes},transparentBackground:this.values.transparent,postprocessing:a.postprocessing,marking:a.marking});const c=this.previewPass.getImageData(o,s),u=this.previewCanvas;u.width=c.width,u.height=c.height,this.previewData.image=c,this.previewData.background=a.renderer.backgroundColor,this.previewData.transparent=this.values.transparent;const l=u.getContext("2d");if(!l)throw new Error("Could not create canvas 2d context");return l.putImageData(c,0,0),this.cropParams.auto&&this.autocrop(),this.events.previewed.next(void 0),{canvas:u,width:o,height:s}}getSizeAndViewport(){const{width:t,height:n}=this.getSize(),r=this.relativeCrop,i={x:Math.floor(r.x*t),y:Math.floor(r.y*n),width:Math.ceil(r.width*t),height:Math.ceil(r.height*n)};return i.width+i.x>t&&(i.width=t-i.x),i.height+i.y>n&&(i.height=n-i.y),{width:t,height:n,viewport:i}}draw(t){var n=this;return ie(function*(){const{width:r,height:i,viewport:o}=n.getSizeAndViewport();if(r<=0||i<=0)return;yield t.update("Rendering image...");const s=n.imagePass;yield s.updateBackground();const a=s.getImageData(r,i,o);yield t.update("Encoding image...");const c=n.canvas;c.width=a.width,c.height=a.height;const u=c.getContext("2d");if(!u)throw new Error("Could not create canvas 2d context");u.putImageData(a,0,0)})()}copyToClipboardTask(){var t=this;const n=navigator.clipboard;if(n?.write)return Oe.create("Copy Image",function(){var r=ie(function*(i){yield t.draw(i),yield i.update("Converting image...");const o=yield v8(t.canvas,"png"),s=new ClipboardItem({"image/png":o});yield n.write([s]),t.plugin.log.message("Image copied to clipboard.")});return function(i){return r.apply(this,arguments)}}());this.plugin.log.error("clipboard.write not supported!")}getImageDataUri(){var t=this;return this.plugin.runTask(Oe.create("Generate Image",function(){var n=ie(function*(r){return yield t.draw(r),yield r.update("Converting image..."),t.canvas.toDataURL("png")});return function(r){return n.apply(this,arguments)}}()))}copyToClipboard(){const t=this.copyToClipboardTask();if(t)return this.plugin.runTask(t)}downloadTask(t){var n=this;return Oe.create("Download Image",function(){var r=ie(function*(i){yield n.draw(i),yield i.update("Downloading image..."),Bce(yield v8(n.canvas,"png"),t??n.getFilename())});return function(i){return r.apply(this,arguments)}}())}download(t){this.plugin.runTask(this.downloadTask(t))}constructor(t){super(),this.plugin=t,this._params=void 0,this.behaviors={values:this.ev.behavior({transparent:this.params.transparent.defaultValue,axes:{name:"off",params:{}},resolution:this.params.resolution.defaultValue}),cropParams:this.ev.behavior({auto:!0,relativePadding:.1}),relativeCrop:this.ev.behavior({x:0,y:0,width:1,height:1})},this.events={previewed:this.ev()},this.canvas=document.createElement("canvas"),this.previewCanvas=document.createElement("canvas"),this.previewData={image:{data:new Uint8ClampedArray(1),width:1,height:0},background:st(0),transparent:!1}}}class R0t{addHandler(t,n){const r=this.handlers.findIndex(i=>i[0]===t);r<0?this.handlers.push([t,n]):this.handlers[r][1]=n}removeHandler(t){const n=this.handlers.findIndex(r=>r[0]===t);n>=0&&this.handlers.splice(n,1)}handle(t){var n=this;return ie(function*(){for(let r=n.handlers.length-1;r>=0;r--){const i=n.handlers[r][1];if(yield i(t,n.plugin))return}!function k0t(e,t){const n=t.filter(r=>{const i=r.name.toLowerCase();return i.endsWith(".molx")||i.endsWith(".molj")});n.length>0?Cn.State.Snapshots.OpenFile(e,{file:n[0]}):e.runTask(e.state.data.applyAction(Pde,{files:t.map(r=>fr.File(r)),format:{name:"auto",params:{}},visuals:!0}))}(n.plugin,t)})()}dispose(){this.handlers.length=0}constructor(t){this.plugin=t,this.handlers=[]}}class N0t{get isInitialized(){return this._isInitialized}build(){return this.state.data.build()}initContainer(t){var n;if(this.canvasContainer)return!0;const r=document.createElement("div");Object.assign(r.style,{position:"absolute",left:0,top:0,right:0,bottom:0,"-webkit-user-select":"none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none","touch-action":"manipulation"});let i=null===(n=t?.canvas3dContext)||void 0===n?void 0:n.canvas;return i||(i=document.createElement("canvas"),t?.checkeredCanvasBackground&&Object.assign(i.style,{"background-image":"linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%, lightgrey), linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%, lightgrey)","background-size":"60px 60px","background-position":"0 0, 30px 30px"}),r.appendChild(i)),!!this.initViewer(i,r,t?.canvas3dContext)&&(this.canvasContainer=r,!0)}mount(t,n){var r;if(this.disposed)throw new Error("Cannot mount a disposed context");return!!this.initContainer(n)&&(this.canvasContainer.parentElement!==t&&(null===(r=this.canvasContainer.parentElement)||void 0===r||r.removeChild(this.canvasContainer)),t.appendChild(this.canvasContainer),this.handleResize(),!0)}unmount(){var t,n;null===(n=null===(t=this.canvasContainer)||void 0===t?void 0:t.parentElement)||void 0===n||n.removeChild(this.canvasContainer)}initViewer(t,n,r){var i,o,s,a,c,u;try{this.layout.setRoot(n),this.spec.layout&&this.spec.layout.initial&&this.layout.setProps(this.spec.layout.initial),r||(r=ME.fromCanvas(t,this.managers.asset,{antialias:!(null!==(i=this.config.get(qi.General.DisableAntialiasing))&&void 0!==i&&i),preserveDrawingBuffer:!(null!==(o=this.config.get(qi.General.DisablePreserveDrawingBuffer))&&void 0!==o&&o),preferWebGl1:this.config.get(qi.General.PreferWebGl1)||!1,failIfMajorPerformanceCaveat:!(null!==(s=this.config.get(qi.General.AllowMajorPerformanceCaveat))&&void 0!==s&&s),powerPreference:this.config.get(qi.General.PowerPreference)||"high-performance",handleResize:this.handleResize},{pixelScale:this.config.get(qi.General.PixelScale)||1,pickScale:this.config.get(qi.General.PickScale)||.25,transparency:this.config.get(qi.General.Transparency)||"wboit"})),this.canvas3dContext=r,this.canvas3d=H8.create(this.canvas3dContext),this.canvas3dInit.next(!0);let l=this.spec.canvas3d;const d=st(16579577);return l?(void 0===(null===(c=l.renderer)||void 0===c?void 0:c.backgroundColor)&&(l=c0(l,f=>{f.renderer?f.renderer.backgroundColor=d:f.renderer={backgroundColor:d}})),null===(u=this.canvas3d)||void 0===u||u.setProps(l)):null===(a=this.canvas3d)||void 0===a||a.setProps({renderer:{backgroundColor:d}}),this.animationLoop.start(),this.helpers.viewportScreenshot=new M0t(this),this.subs.push(this.canvas3d.interaction.click.subscribe(f=>this.behaviors.interaction.click.next(f))),this.subs.push(this.canvas3d.interaction.drag.subscribe(f=>this.behaviors.interaction.drag.next(f))),this.subs.push(this.canvas3d.interaction.hover.subscribe(f=>this.behaviors.interaction.hover.next(f))),this.subs.push(this.canvas3d.input.resize.pipe(afe(50),Fde(100,void 0,{leading:!1,trailing:!0})).subscribe(()=>this.handleResize())),this.subs.push(this.canvas3d.input.keyDown.subscribe(f=>this.behaviors.interaction.key.next(f))),this.subs.push(this.canvas3d.input.keyUp.subscribe(f=>this.behaviors.interaction.keyReleased.next(f))),this.subs.push(this.layout.events.updated.subscribe(()=>requestAnimationFrame(()=>this.handleResize()))),this.handleResize(),Zx.setImmediate(()=>this.initCanvas3dPromiseCallbacks[0]()),!0}catch(l){return this.log.error(""+l),console.error(l),Zx.setImmediate(()=>this.initCanvas3dPromiseCallbacks[1](l)),!1}}get isBusy(){return this.behaviors.state.isAnimating.value||this.behaviors.state.isUpdating.value}get selectionMode(){return this.behaviors.interaction.selectionMode.value}set selectionMode(t){this.behaviors.interaction.selectionMode.next(t)}dataTransaction(t,n){return this.runTask(this.state.data.transaction(t,n))}clear(t=!1){var n;return t&&(null===(n=this.canvas3d)||void 0===n||n.setProps(j8)),Cn.State.RemoveObject(this,{state:this.state.data,ref:ur.RootRef})}dispose(t){var n,r;if(!this.disposed){for(const i of this.subs)i.unsubscribe();this.subs=[],this.animationLoop.stop(),this.commands.dispose(),null===(n=this.canvas3d)||void 0===n||n.dispose(),null===(r=this.canvas3dContext)||void 0===r||r.dispose(t),this.ev.dispose(),this.state.dispose(),this.helpers.substructureParent.dispose(),$a(this.managers,i=>{var o;return null===(o=i?.dispose)||void 0===o?void 0:o.call(i)}),$a(this.managers.structure,i=>{var o;return null===(o=i?.dispose)||void 0===o?void 0:o.call(i)}),$a(this.managers.volume,i=>{var o;return null===(o=i?.dispose)||void 0===o?void 0:o.call(i)}),this.unmount(),this.canvasContainer=void 0,this.customState={},this.disposed=!0}}initBehaviorEvents(){this.subs.push(ch(this.state.data.behaviors.isUpdating,this.state.behaviors.behaviors.isUpdating).subscribe(s=>{this.behaviors.state.isUpdating.value!==s&&this.behaviors.state.isUpdating.next(s)}));const t=this.config.get(qi.General.IsBusyTimeoutMs)||750,n=this.behaviors.state.isBusy;let r;const i=()=>{n.value||n.next(!0)},o=()=>{void 0!==r&&clearTimeout(r),r=void 0};this.subs.push(ch(this.behaviors.state.isUpdating,this.behaviors.state.isAnimating).subscribe(s=>{this.behaviors.state.isUpdating.value||this.behaviors.state.isAnimating.value?n.value||(o(),r=setTimeout(i,t)):(o(),n.next(!1))})),this.subs.push(this.behaviors.interaction.selectionMode.subscribe(s=>{var a;s||null===(a=this.managers.interactivity)||void 0===a||a.lociSelects.deselectAll()}))}initBuiltInBehavior(){ZE.State.registerDefault(this),ZE.Representation.registerDefault(this),ZE.Camera.registerDefault(this),ZE.Misc.registerDefault(this),this.subs.push(ch(this.state.data.events.log,this.state.behaviors.events.log).subscribe(t=>this.events.log.next(t)))}initBehaviors(){var t=this;return ie(function*(){let n=t.state.behaviors.build();for(const r of Object.keys(tr.Categories))n.toRoot().apply(tr.CreateCategory,{label:tr.Categories[r]},{ref:r,state:{isLocked:!0}});for(const r of t.spec.behaviors)"custom-props"===tr.getCategoryId(r.transformer)&&n.to(tr.getCategoryId(r.transformer)).apply(r.transformer,r.defaultParams,{ref:r.transformer.id});yield t.runTask(t.state.behaviors.updateTree(n,{doNotUpdateCurrent:!0,doNotLogTiming:!0})),n=t.state.behaviors.build();for(const r of t.spec.behaviors)"custom-props"!==tr.getCategoryId(r.transformer)&&n.to(tr.getCategoryId(r.transformer)).apply(r.transformer,r.defaultParams,{ref:r.transformer.id});yield t.runTask(t.state.behaviors.updateTree(n,{doNotUpdateCurrent:!0,doNotLogTiming:!0}))})()}initCustomFormats(){if(this.spec.customFormats)for(const t of this.spec.customFormats)this.dataFormats.add(t[0],t[1])}initAnimations(){if(this.spec.animations)for(const t of this.spec.animations)this.managers.animation.register(t)}initDataActions(){if(this.spec.actions)for(const t of this.spec.actions)this.state.data.actions.add(t.action)}init(){var t=this;return ie(function*(){try{t.subs.push(t.events.log.subscribe(n=>t.log.entries=t.log.entries.push(n))),t.initCustomFormats(),t.initBehaviorEvents(),t.initBuiltInBehavior(),t.managers.interactivity=new Lm(t),t.managers.lociLabels=new Xdt(t),t.builders.structure=new Sdt(t),t.initAnimations(),t.initDataActions(),yield t.initBehaviors(),t.log.message(`Mol* Plugin 4.0.1 [${btt.toLocaleString()}]`),Qx||t.log.message("Development mode enabled"),un&&t.log.message("Debug mode enabled"),t._isInitialized=!0,t.initializedPromiseCallbacks[0]()}catch(n){throw t.initializedPromiseCallbacks[1](n),n}})()}constructor(t){var n;this.spec=t,this.runTask=(r,i)=>this.managers.task.run(r,i),this.resolveTask=r=>{if(r)return Oe.is(r)?this.runTask(r):r},this.subs=[],this.initCanvas3dPromiseCallbacks=[()=>{},()=>{}],this._isInitialized=!1,this.initializedPromiseCallbacks=[()=>{},()=>{}],this.disposed=!1,this.canvasContainer=void 0,this.ev=wp.create(),this.config=new Itt(this.spec.config),this.state=new z1(this),this.commands=new ptt,this.canvas3dInit=this.ev.behavior(!1),this.behaviors={state:{isAnimating:this.ev.behavior(!1),isUpdating:this.ev.behavior(!1),isBusy:this.ev.behavior(!1)},interaction:{hover:this.ev.behavior({current:yn.Loci.Empty,modifiers:wu.None,buttons:0,button:0}),click:this.ev.behavior({current:yn.Loci.Empty,modifiers:wu.None,buttons:0,button:0}),drag:this.ev.behavior({current:yn.Loci.Empty,modifiers:wu.None,buttons:0,button:0,pageStart:Me(),pageEnd:Me()}),key:this.ev.behavior(rue),keyReleased:this.ev.behavior(rue),selectionMode:this.ev.behavior(!1)},labels:{highlight:this.ev.behavior({labels:[]})},layout:{leftPanelTabName:this.ev.behavior("root")},canvas3d:{initialized:this.canvas3dInit.pipe(Yl(r=>!!r),Sg(1))}},this.canvas3dInitialized=new Promise((r,i)=>{this.initCanvas3dPromiseCallbacks=[r,i]}),this.initialized=new Promise((r,i)=>{this.initializedPromiseCallbacks=[r,i]}),this.layout=new Oft(this),this.animationLoop=new D0t(this),this.representation={structure:{registry:new kC,themes:{colorThemeRegistry:Lc.createRegistry(),sizeThemeRegistry:Qo.createRegistry()}},volume:{registry:new u1,themes:{colorThemeRegistry:Lc.createRegistry(),sizeThemeRegistry:Qo.createRegistry()}}},this.query={structure:{registry:new rYe}},this.dataFormats=new Rdt,this.builders={data:new mdt(this),structure:void 0},this.helpers={substructureParent:new E0t(this),viewportScreenshot:void 0},this.managers={structure:{hierarchy:new xC(this),component:new _C(this),measurement:new vft(this),selection:new xft(this),focus:new eft(this)},volume:{hierarchy:new RV(this)},interactivity:void 0,camera:new Ydt(this),animation:new kdt(this),snapshot:new qv(this),lociLabels:void 0,toast:new P0t(this),asset:new TLe,task:new f7,dragAndDrop:new R0t(this)},this.events={log:this.ev(),task:this.managers.task.events,canvas3d:{settingsUpdated:this.ev()}},this.customModelProperties=new u3.Registry,this.customStructureProperties=new u3.Registry,this.customStructureControls=new Map,this.customImportControls=new Map,this.genericRepresentationControls=new Map,this.customState=Object.create(null),this.handleResize=()=>{var r,i;const o=null===(r=this.canvas3dContext)||void 0===r?void 0:r.canvas,s=this.layout.root;s&&o&&(function _tt(e,t,n=1){let r=window.innerWidth,i=window.innerHeight;t!==document.body&&(r=t.offsetWidth,i=t.offsetHeight),function vtt(e,t,n,r=1){e.width=Math.round(window.devicePixelRatio*r*t),e.height=Math.round(window.devicePixelRatio*r*n),Object.assign(e.style,{width:`${t}px`,height:`${n}px`})}(e,r,i,n)}(o,s,this.canvas3dContext.props.pixelScale),null===(i=this.canvas3d)||void 0===i||i.requestResize())},this.log={entries:Cp(),entry:r=>this.events.log.next(r),error:r=>this.events.log.next(df.error(r)),message:r=>this.events.log.next(df.message(r)),info:r=>this.events.log.next(df.info(r)),warn:r=>this.events.log.next(df.warning(r))},this.fetch=MO,EVe(!1),function GNe(e){up="default"===e?UQ:zNe}(null!==(n=this.config.get(qi.Structure.SaccharideCompIdMapType))&&void 0!==n?n:"default")}}let NC=(()=>{class e{set container(n){this.container$.next(n)}constructor(n){this.settingsService=n,this.container$=new ou(1),this.plugin=new N0t({actions:[an.Action(V0.Structure.DownloadStructure),an.Action(V0.Volume.DownloadDensity),an.Action(V0.DataFormat.DownloadFile),an.Action(V0.DataFormat.OpenFiles),an.Action(V0.Structure.LoadTrajectory),an.Action(V0.Structure.EnableModelCustomProps),an.Action(V0.Structure.EnableStructureCustomProps),an.Action(adt),an.Action(cdt),an.Action(rfe),an.Action(Ye.Data.Download),an.Action(Ye.Data.ParseCif),an.Action(Ye.Data.ParseCcp4),an.Action(Ye.Data.ParseDsn6),an.Action(Ye.Model.TrajectoryFromMmCif),an.Action(Ye.Model.TrajectoryFromCifCore),an.Action(Ye.Model.TrajectoryFromPDB),an.Action(Ye.Model.TransformStructureConformation),an.Action(Ye.Model.StructureFromModel),an.Action(Ye.Model.StructureFromTrajectory),an.Action(Ye.Model.ModelFromTrajectory),an.Action(Ye.Model.StructureSelectionFromScript),an.Action(Ye.Representation.StructureRepresentation3D),an.Action(Ye.Representation.StructureSelectionsDistance3D),an.Action(Ye.Representation.StructureSelectionsAngle3D),an.Action(Ye.Representation.StructureSelectionsDihedral3D),an.Action(Ye.Representation.StructureSelectionsLabel3D),an.Action(Ye.Representation.StructureSelectionsOrientation3D),an.Action(Ye.Representation.ModelUnitcell3D),an.Action(Ye.Representation.StructureBoundingBox3D),an.Action(Ye.Representation.ExplodeStructureRepresentation3D),an.Action(Ye.Representation.SpinStructureRepresentation3D),an.Action(Ye.Representation.UnwindStructureAssemblyRepresentation3D),an.Action(Ye.Representation.OverpaintStructureRepresentation3DFromScript),an.Action(Ye.Representation.TransparencyStructureRepresentation3DFromScript),an.Action(Ye.Representation.ClippingStructureRepresentation3DFromScript),an.Action(Ye.Representation.SubstanceStructureRepresentation3DFromScript),an.Action(Ye.Representation.ThemeStrengthRepresentation3D),an.Action(Ede),an.Action(Ye.Volume.VolumeFromCcp4),an.Action(Ye.Volume.VolumeFromDsn6),an.Action(Ye.Volume.VolumeFromCube),an.Action(Ye.Volume.VolumeFromDx),an.Action(Ye.Representation.VolumeRepresentation3D)],behaviors:[an.Behavior(zc.Representation.HighlightLoci),an.Behavior(zc.Representation.SelectLoci),an.Behavior(zc.Representation.DefaultLociLabelProvider),an.Behavior(zc.Representation.FocusLoci),an.Behavior(zc.Camera.FocusLoci),an.Behavior(zc.Camera.CameraAxisHelper),an.Behavior(zc.Camera.CameraControls),an.Behavior(JE),an.Behavior(zc.CustomProps.StructureInfo),an.Behavior(zc.CustomProps.AccessibleSurfaceArea),an.Behavior(zc.CustomProps.BestDatabaseSequenceMapping),an.Behavior(zc.CustomProps.Interactions),an.Behavior(zc.CustomProps.SecondaryStructure),an.Behavior(zc.CustomProps.ValenceModel),an.Behavior(zc.CustomProps.CrossLinkRestraint)],animations:[gtt,mtt,pdt,ytt,htt,fdt,ddt]});const r=this.settingsService.settings$;this.plugin$=this.container$.pipe(qt(i=>{const o=i.nativeElement;return{div:o,canvas:o.firstElementChild}}),jr(({div:i,canvas:o})=>this.plugin.initViewer(o,i)),To(()=>$i(this.plugin.init())),qt(()=>this.plugin),Zl(1),Lb(r),qt(([i,o])=>{if(i.canvas3d){const[s,a]=XS(o["background-color"]);i.canvas3d.setProps({renderer:{backgroundColor:s,pickingAlphaThreshold:a}})}return i}))}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(KS))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})(),J3=(()=>{class e{set source(n){this.source$.next(n)}constructor(n,r){var i=this;this.settingsService=n,this.pluginService=r,this.source$=new ou,this.structure$=uI([this.pluginService.plugin$,this.source$]).pipe(qt(([a,c])=>({plugin:a,source:c})),To(({source:a})=>$i(ie(function*(){return"local"===a.type?{data:yield i.parseLocalSource(a),source:a}:{data:yield i.parseRemoteSource(a),source:a}})())),To(({data:a,source:c})=>$i(ie(function*(){const u=i.pluginService.plugin,l=yield u.builders.structure.parseTrajectory(a,c.format),d=yield u.builders.structure.createModel(l,{modelIndex:0}),m=yield u.builders.structure.createStructure(d,{name:"model",params:{}}),h=yield u.builders.structure.tryCreateComponentStatic(m,"polymer",{label:c.label}),[g]=XS(i.settingsService.settings["backbone-color"]);return yield u.builders.structure.representation.addRepresentation(h,{type:"cartoon",color:"uniform",colorParams:{value:g}}),m.cell?.obj?.data})())),jr(a=>{let c=0;const u=this.r2i=new Map,l=this.i2r=new Map;Ve.eachAtomicHierarchyElement(a,{residue:d=>{const f=Ze.residue.auth_seq_id(d),p=Ze.residue.pdbx_PDB_ins_code(d),h=(Ze.chain.auth_asym_id(d)+f+p).trim();u.set(h,c),l.set(c,h),c++}})}),Zl(1))}parseRemoteSource(n){var r=this;return ie(function*(){const i=fr.Url(n.link);return r.pluginService.plugin.builders.data.download({url:i,label:n.label,isBinary:n.binary})})()}parseLocalSource(n){var r=this;return ie(function*(){const i=n.binary,o=n.label,s=r.pluginService.plugin;if("string"==typeof n.data)return s.builders.data.rawData({data:n.data,label:o});let a;a=n.data instanceof File?fr.File(n.data):fr.File(new File([n.data],`${o}.${"mmcif"===n.format?"cif":"ent"}`));const{data:c}=yield s.builders.data.readFile({file:a,label:o,isBinary:i});return c})()}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(KS),Zt(NC))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();function p7(e,t){return function F0t(e,t){const n=ko.getStructureSelection(e,t);return pt.toLociWithSourceUnits(n)}(ue.struct.generator.atomGroups({"residue-test":ue.core.set.has([ue.set(...e),ue.core.str.concat([ue.ammp("auth_asym_id"),ue.ammp("auth_seq_id"),ue.ammp("pdbx_PDB_ins_code")])])}),t)}let rme=(()=>{class e{set loci(n){this.loci$.next(n)}set interactions(n){this.interactions$.next(n)}constructor(n,r,i){this.structureService=n,this.settingsService=r,this.pluginService=i,this.loci$=new ou(1),this.interactions$=new ou(1);const o=this.getLociRepresentation(),s=this.getInteractionsRepresentation();this.representation$=this.structureService.structure$.pipe(Lb(o),Lb(s),qt(()=>{}),Zl(1)),this._representation=this.representation$.subscribe()}ngOnDestroy(){this._representation.unsubscribe()}getLociRepresentation(){return this.structureService.structure$.pipe(Lb(this.loci$),qt(([n,r])=>({structure:n,loci:r})),qt(({structure:n,loci:r})=>{const i=[...this.structureService.i2r.values()];return{structure:n,loci:r.map(s=>{if(s.start){s={...s,end:s.end||s.start};const a=this.structureService.r2i.get(s.chain+s.start),c=this.structureService.r2i.get(s.chain+s.end);return{...s,ids:i.slice(a,c+1)}}return{...s,ids:i.filter(a=>a.startsWith(s.chain))}})}}),To(({structure:n,loci:r})=>{const i=[];for(const{ids:c,color:u}of r){const l=p7(c,n),d=Kn.fromLoci(l),[f]=XS(u||this.settingsService.settings["backbone-color"]);i.push({bundle:d,color:f,clear:!1})}const o=this.pluginService.plugin,s=o.state.data.build(),a=function B0t(e,t){const n=Bo.ofBundle(e,t.root),r=Bo.merge(n);return Bo.filter(r,t)}(i,n);for(const c of o.managers.structure.hierarchy.current.structures)for(const u of c.components)for(const l of u.representations){s.to(l.cell.transform.ref).apply(Ye.Representation.OverpaintStructureRepresentation3DFromBundle,Bo.toBundle(a));const d=p7([...this.structureService.i2r.values()],n),f=Kn.fromLoci(d),[p,m]=XS(this.settingsService.settings["backbone-color"]);s.to(l.cell.transform.ref).apply(Ye.Representation.TransparencyStructureRepresentation3DFromBundle,{layers:[{bundle:f,value:m}]})}return $i(s.commit({doNotUpdateCurrent:!0}))}))}getInteractionsRepresentation(){let n;return this.structureService.structure$.pipe(Lb(this.interactions$),qt(([r,i])=>({structure:r,interactions:i})),qt(({structure:r,interactions:i})=>{const o=i.reduce((s,{from:a,to:c})=>[...s,a,c],[]);return Ve.eachAtomicHierarchyElement(r,{atom:s=>{const a=v.create(Ze.atom.x(s),Ze.atom.y(s),Ze.atom.z(s));for(const c of o)c.coordinates||(c["atom.id"]===Ze.atom.id(s)||c["chain.id"]===Ze.chain.auth_asym_id(s)&&c["residue.id"]===Ze.residue.auth_seq_id(s)+Ze.residue.pdbx_PDB_ins_code(s)&&c["atom.name"]===Ze.atom.auth_atom_id(s))&&(c.coordinates=a)}}),{structure:r,interactions:i=i.filter(({from:s,to:a})=>s.coordinates&&a.coordinates)}}),To(({interactions:r})=>{const o=this.pluginService.plugin.state.data.build(),s=r.map(({from:c,to:u,color:l,label:d,size:f})=>({from:c.coordinates,to:u.coordinates,color:XS(l||this.settingsService.settings["interaction-color"]).at(0),size:f||this.settingsService.settings["interaction-size"],label:d}));return n&&o.delete(n),n=o.toRoot().apply(ftt,{data:s}).apply(Ye.Representation.ShapeRepresentation3D).ref,$i(o.commit({doNotUpdateCurrent:!0}))}),Zl(1))}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(J3),Zt(KS),Zt(NC))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();let ime=(()=>{class e{set highlights(n){this.input$.next(n)}constructor(n,r){this.structureService=n,this.pluginService=r,this.input$=new ou(1);const i=this.pluginService.plugin,o=i.behaviors.interaction.hover,s=this.structureService.structure$.pipe(Lb(this.input$),qt(([c,u])=>({structure:c,highlights:u})),qt(({structure:c,highlights:u})=>{if(u){const l=[...this.structureService.i2r.values()],d=this.structureService.r2i.get(u.chain+u.start),f=this.structureService.r2i.get(u.chain+u.end);return{structure:c,highlights:{...u,ids:l.slice(d,f+1)}}}return{structure:c,highlights:{start:"",end:"",chain:"",ids:[]}}}),qt(({structure:c,highlights:u})=>{if(u.ids.length>0){const l=p7(u.ids,c);i.managers.interactivity.lociHighlights.highlightOnly({loci:l})}}));this.output$=o.pipe(qt(c=>{if(c&&"element-loci"===c.current.loci.kind&&De.is(c.current.loci)){const u=De.getFirstLocation(c.current.loci);if(u){const l=Ze.chain.auth_asym_id(u),p=Ze.residue.auth_seq_id(u)+Ze.residue.pdbx_PDB_ins_code(u);return{start:p,end:p+"",chain:l}}}}),Zl(1),jr(c=>console.log("Highlighted",c)));const a=s.pipe(function L0t(...e){return function O0t(...e){const t=Sb(e),n=yK(e,1/0);return e=CZ(e),mo((r,i)=>{xg(n)($i([r,...e],t)).subscribe(i)})}(...e)}(this.output$),qt(()=>{}));this._highlights=a.subscribe()}ngOnDestroy(){this._highlights.unsubscribe()}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(J3),Zt(NC))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();const U0t=["container"];let eP=(()=>{class e{set container(n){this.pluginService.container=n}set source(n){this.structureService.source=n}set loci(n){this.representationService.loci=n}set interactions(n){this.representationService.interactions=n}set settings(n){this.settingsService.settings=n}set highlights(n){this.highlightService.highlights=n}constructor(n,r,i,o,s){this.representationService=n,this.highlightService=r,this.structureService=i,this.settingsService=o,this.pluginService=s,this.highlights$=this.highlightService.output$}static#e=this.\u0275fac=function(r){return new(r||e)(cn(rme),cn(ime),cn(J3),cn(KS),cn(NC))};static#t=this.\u0275cmp=Mu({type:e,selectors:[["ngx-structure-viewer"]],viewQuery:function(r,i){if(1&r&&uN(U0t,5),2&r){let o;EA(o=PA())&&(i.container=o.first)}},inputs:{source:"source",loci:"loci",interactions:"interactions",settings:"settings",highlights:"highlights"},outputs:{highlights$:"highlights"},standalone:!0,features:[mN([rme,ime,J3,KS,NC]),Nu],decls:4,vars:0,consts:[["container",""],["canvas",""],[2,"position","relative","width","100%","height","100%"],[2,"position","absolute","left","0","top","0","width","100%","height","100%"]],template:function(r,i){1&r&&(dn(0,"div",2,0),gi(2,"canvas",3,1),fn())}})}return e})();function ome(e=0,t=r3){return e<0&&(e=0),Nde(e,e,t)}const sme=e=>({coordinates:e}),ame=e=>({"atom.id":e}),cme=(e,t,n)=>({"chain.id":e,"residue.id":t,"atom.id":n});function V0t(e,t){1&e&&gi(0,"div",9),2&e&&pb("background-color",t)}function z0t(e,t){1&e&&(dn(0,"code",6)(1,"pre",10),ar(2),Ga(3,"json"),fn()()),2&e&&(mi(2),ku(ja(3,1,mx(3,sme,t.coordinates))))}function G0t(e,t){1&e&&(dn(0,"code",6)(1,"pre",10),ar(2),Ga(3,"json"),fn()()),2&e&&(mi(2),ku(ja(3,1,mx(3,sme,t.coordinates))))}function j0t(e,t){1&e&&gi(0,"div",9),2&e&&pb("background-color",t)}function H0t(e,t){1&e&&(dn(0,"code",6)(1,"pre",10),ar(2),Ga(3,"json"),fn()()),2&e&&(mi(2),ku(ja(3,1,mx(3,ame,t["atom.id"]))))}function q0t(e,t){1&e&&(dn(0,"code",6)(1,"pre",10),ar(2),Ga(3,"json"),fn()()),2&e&&(mi(2),ku(ja(3,1,mx(3,ame,t["atom.id"]))))}function W0t(e,t){1&e&&gi(0,"div",9),2&e&&pb("background-color",t)}function $0t(e,t){if(1&e&&(dn(0,"code",6)(1,"pre",10),ar(2),Ga(3,"json"),fn()()),2&e){const n=t;mi(2),ku(ja(3,1,gN(3,cme,n["chain.id"],n["residue.id"],n["atom.id"])))}}function Y0t(e,t){if(1&e&&(dn(0,"code",6)(1,"pre",10),ar(2),Ga(3,"json"),fn()()),2&e){const n=t;mi(2),ku(ja(3,1,gN(3,cme,n["chain.id"],n["residue.id"],n["atom.id"])))}}function X0t(e,t){if(1&e&&gi(0,"ngx-structure-viewer",8),2&e){const n=hx();Bh("settings",n.settings)("source",n.source)("interactions",t)}}let K0t=(()=>{class e{constructor(n){this.location=n,this.settings={"background-color":"#2b3035ff","backbone-color":"#6ea8fe40","interaction-color":"#ff0000ff","interaction-size":.5},this.source={type:"remote",format:"mmcif",label:"8VAP.A",binary:!1,link:this.location.prepareExternalUrl("assets/8vap.A.cif")},this.interactions=[{from:{coordinates:v.create(165.36768,188.18981,113.00826)},to:{coordinates:v.create(160.33379,162.30181,108.49545)},color:"#ff4500"},{from:{"atom.id":211},to:{"atom.id":374},color:"#adff2f"},{from:{"chain.id":"A","residue.id":"148","atom.name":"CA"},to:{"chain.id":"A","residue.id":"89","atom.name":"CD"},color:"#8a2be2"}],this.interactions$=ome(3e3).pipe(qt(()=>this.interactions.map(r=>({...r}))),qt(r=>r.sort(()=>Math.random()-.5)),qt(r=>[r[0]]),Dx([this.interactions[0]]),Zl(1))}static#e=this.\u0275fac=function(r){return new(r||e)(cn(_b))};static#t=this.\u0275cmp=Mu({type:e,selectors:[["app-section-interactions"]],standalone:!0,features:[Nu],decls:29,vars:12,consts:[[1,"row","mb-3"],[1,"col-6"],[1,"mb-3"],[1,"mb-1"],[1,"d-flex","flex-row","align-items-stretch","gap-1"],[1,"d-block","p-2",3,"background-color"],[1,"d-block","flex-1"],[1,"rounded","squared","overflow-hidden","bg-body-tertiary"],[3,"settings","source","interactions"],[1,"d-block","p-2"],[1,"bg-body-tertiary","p-3","m-0"]],template:function(r,i){if(1&r&&(dn(0,"div",0)(1,"div",1)(2,"h2"),ar(3,"Interactions"),fn(),dn(4,"div",2)(5,"p",3),ar(6,"1. Provide atom coordinates"),fn(),dn(7,"div",4),Jc(8,V0t,1,2,"div",5)(9,z0t,4,5,"code",6)(10,G0t,4,5,"code",6),fn()(),dn(11,"div",2)(12,"p",3),ar(13,"2. Provide atom identifier"),fn(),dn(14,"div",4),Jc(15,j0t,1,2,"div",5)(16,H0t,4,5,"code",6)(17,q0t,4,5,"code",6),fn()(),dn(18,"div",2)(19,"p",3),ar(20,"3. Provide chain, residue identifier and atom name"),fn(),dn(21,"div",4),Jc(22,W0t,1,2,"div",5)(23,$0t,4,7,"code",6)(24,Y0t,4,7,"code",6),fn()()(),dn(25,"div",1)(26,"div",7),Jc(27,X0t,1,3,"ngx-structure-viewer",8),Ga(28,"async"),fn()()()),2&r){let o,s,a,c,u,l,d,f,p,m;mi(8),Va(8,(o=i.interactions[0].color)?8:-1,o),mi(),Va(9,(s=i.interactions[0].from)?9:-1,s),mi(),Va(10,(a=i.interactions[0].to)?10:-1,a),mi(5),Va(15,(c=i.interactions[1].color)?15:-1,c),mi(),Va(16,(u=i.interactions[1].from)?16:-1,u),mi(),Va(17,(l=i.interactions[1].to)?17:-1,l),mi(5),Va(22,(d=i.interactions[2].color)?22:-1,d),mi(),Va(23,(f=i.interactions[2].from)?23:-1,f),mi(),Va(24,(p=i.interactions[2].to)?24:-1,p),mi(3),Va(27,(m=ja(28,10,i.interactions$))?27:-1,m)}},dependencies:[eP,Uh,Cx,sI]})}return e})();class tP{}class nP{}class Rl{constructor(t){this.normalizedNames=new Map,this.lazyUpdate=null,t?"string"==typeof t?this.lazyInit=()=>{this.headers=new Map,t.split("\n").forEach(n=>{const r=n.indexOf(":");if(r>0){const i=n.slice(0,r),o=i.toLowerCase(),s=n.slice(r+1).trim();this.maybeSetNormalizedName(i,o),this.headers.has(o)?this.headers.get(o).push(s):this.headers.set(o,[s])}})}:typeof Headers<"u"&&t instanceof Headers?(this.headers=new Map,t.forEach((n,r)=>{this.setHeaderEntries(r,n)})):this.lazyInit=()=>{this.headers=new Map,Object.entries(t).forEach(([n,r])=>{this.setHeaderEntries(n,r)})}:this.headers=new Map}has(t){return this.init(),this.headers.has(t.toLowerCase())}get(t){this.init();const n=this.headers.get(t.toLowerCase());return n&&n.length>0?n[0]:null}keys(){return this.init(),Array.from(this.normalizedNames.values())}getAll(t){return this.init(),this.headers.get(t.toLowerCase())||null}append(t,n){return this.clone({name:t,value:n,op:"a"})}set(t,n){return this.clone({name:t,value:n,op:"s"})}delete(t,n){return this.clone({name:t,value:n,op:"d"})}maybeSetNormalizedName(t,n){this.normalizedNames.has(n)||this.normalizedNames.set(n,t)}init(){this.lazyInit&&(this.lazyInit instanceof Rl?this.copyFrom(this.lazyInit):this.lazyInit(),this.lazyInit=null,this.lazyUpdate&&(this.lazyUpdate.forEach(t=>this.applyUpdate(t)),this.lazyUpdate=null))}copyFrom(t){t.init(),Array.from(t.headers.keys()).forEach(n=>{this.headers.set(n,t.headers.get(n)),this.normalizedNames.set(n,t.normalizedNames.get(n))})}clone(t){const n=new Rl;return n.lazyInit=this.lazyInit&&this.lazyInit instanceof Rl?this.lazyInit:this,n.lazyUpdate=(this.lazyUpdate||[]).concat([t]),n}applyUpdate(t){const n=t.name.toLowerCase();switch(t.op){case"a":case"s":let r=t.value;if("string"==typeof r&&(r=[r]),0===r.length)return;this.maybeSetNormalizedName(t.name,n);const i=("a"===t.op?this.headers.get(n):void 0)||[];i.push(...r),this.headers.set(n,i);break;case"d":const o=t.value;if(o){let s=this.headers.get(n);if(!s)return;s=s.filter(a=>-1===o.indexOf(a)),0===s.length?(this.headers.delete(n),this.normalizedNames.delete(n)):this.headers.set(n,s)}else this.headers.delete(n),this.normalizedNames.delete(n)}}setHeaderEntries(t,n){const r=(Array.isArray(n)?n:[n]).map(o=>o.toString()),i=t.toLowerCase();this.headers.set(i,r),this.maybeSetNormalizedName(t,i)}forEach(t){this.init(),Array.from(this.normalizedNames.keys()).forEach(n=>t(this.normalizedNames.get(n),this.headers.get(n)))}}class Z0t{encodeKey(t){return ume(t)}encodeValue(t){return ume(t)}decodeKey(t){return decodeURIComponent(t)}decodeValue(t){return decodeURIComponent(t)}}const J0t=/%(\d[a-f0-9])/gi,eyt={40:"@","3A":":",24:"$","2C":",","3B":";","3D":"=","3F":"?","2F":"/"};function ume(e){return encodeURIComponent(e).replace(J0t,(t,n)=>eyt[n]??t)}function rP(e){return`${e}`}class Xm{constructor(t={}){if(this.updates=null,this.cloneFrom=null,this.encoder=t.encoder||new Z0t,t.fromString){if(t.fromObject)throw new Error("Cannot specify both fromString and fromObject.");this.map=function Q0t(e,t){const n=new Map;return e.length>0&&e.replace(/^\?/,"").split("&").forEach(i=>{const o=i.indexOf("="),[s,a]=-1==o?[t.decodeKey(i),""]:[t.decodeKey(i.slice(0,o)),t.decodeValue(i.slice(o+1))],c=n.get(s)||[];c.push(a),n.set(s,c)}),n}(t.fromString,this.encoder)}else t.fromObject?(this.map=new Map,Object.keys(t.fromObject).forEach(n=>{const r=t.fromObject[n],i=Array.isArray(r)?r.map(rP):[rP(r)];this.map.set(n,i)})):this.map=null}has(t){return this.init(),this.map.has(t)}get(t){this.init();const n=this.map.get(t);return n?n[0]:null}getAll(t){return this.init(),this.map.get(t)||null}keys(){return this.init(),Array.from(this.map.keys())}append(t,n){return this.clone({param:t,value:n,op:"a"})}appendAll(t){const n=[];return Object.keys(t).forEach(r=>{const i=t[r];Array.isArray(i)?i.forEach(o=>{n.push({param:r,value:o,op:"a"})}):n.push({param:r,value:i,op:"a"})}),this.clone(n)}set(t,n){return this.clone({param:t,value:n,op:"s"})}delete(t,n){return this.clone({param:t,value:n,op:"d"})}toString(){return this.init(),this.keys().map(t=>{const n=this.encoder.encodeKey(t);return this.map.get(t).map(r=>n+"="+this.encoder.encodeValue(r)).join("&")}).filter(t=>""!==t).join("&")}clone(t){const n=new Xm({encoder:this.encoder});return n.cloneFrom=this.cloneFrom||this,n.updates=(this.updates||[]).concat(t),n}init(){null===this.map&&(this.map=new Map),null!==this.cloneFrom&&(this.cloneFrom.init(),this.cloneFrom.keys().forEach(t=>this.map.set(t,this.cloneFrom.map.get(t))),this.updates.forEach(t=>{switch(t.op){case"a":case"s":const n=("a"===t.op?this.map.get(t.param):void 0)||[];n.push(rP(t.value)),this.map.set(t.param,n);break;case"d":if(void 0===t.value){this.map.delete(t.param);break}{let r=this.map.get(t.param)||[];const i=r.indexOf(rP(t.value));-1!==i&&r.splice(i,1),r.length>0?this.map.set(t.param,r):this.map.delete(t.param)}}}),this.cloneFrom=this.updates=null)}}class tyt{constructor(){this.map=new Map}set(t,n){return this.map.set(t,n),this}get(t){return this.map.has(t)||this.map.set(t,t.defaultValue()),this.map.get(t)}delete(t){return this.map.delete(t),this}has(t){return this.map.has(t)}keys(){return this.map.keys()}}function lme(e){return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer}function dme(e){return typeof Blob<"u"&&e instanceof Blob}function fme(e){return typeof FormData<"u"&&e instanceof FormData}class FC{constructor(t,n,r,i){let o;if(this.url=n,this.body=null,this.reportProgress=!1,this.withCredentials=!1,this.responseType="json",this.method=t.toUpperCase(),function nyt(e){switch(e){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"JSONP":return!1;default:return!0}}(this.method)||i?(this.body=void 0!==r?r:null,o=i):o=r,o&&(this.reportProgress=!!o.reportProgress,this.withCredentials=!!o.withCredentials,o.responseType&&(this.responseType=o.responseType),o.headers&&(this.headers=o.headers),o.context&&(this.context=o.context),o.params&&(this.params=o.params),this.transferCache=o.transferCache),this.headers??=new Rl,this.context??=new tyt,this.params){const s=this.params.toString();if(0===s.length)this.urlWithParams=n;else{const a=n.indexOf("?");this.urlWithParams=n+(-1===a?"?":ad.set(f,t.setHeaders[f]),c)),t.setParams&&(u=Object.keys(t.setParams).reduce((d,f)=>d.set(f,t.setParams[f]),u)),new FC(n,r,o,{params:u,headers:c,context:l,reportProgress:a,responseType:i,withCredentials:s})}}var Km=function(e){return e[e.Sent=0]="Sent",e[e.UploadProgress=1]="UploadProgress",e[e.ResponseHeader=2]="ResponseHeader",e[e.DownloadProgress=3]="DownloadProgress",e[e.Response=4]="Response",e[e.User=5]="User",e}(Km||{});class h7{constructor(t,n=BC.Ok,r="OK"){this.headers=t.headers||new Rl,this.status=void 0!==t.status?t.status:n,this.statusText=t.statusText||r,this.url=t.url||null,this.ok=this.status>=200&&this.status<300}}class iP extends h7{constructor(t={}){super(t),this.type=Km.ResponseHeader}clone(t={}){return new iP({headers:t.headers||this.headers,status:void 0!==t.status?t.status:this.status,statusText:t.statusText||this.statusText,url:t.url||this.url||void 0})}}class sy extends h7{constructor(t={}){super(t),this.type=Km.Response,this.body=void 0!==t.body?t.body:null}clone(t={}){return new sy({body:void 0!==t.body?t.body:this.body,headers:t.headers||this.headers,status:void 0!==t.status?t.status:this.status,statusText:t.statusText||this.statusText,url:t.url||this.url||void 0})}}class G1 extends h7{constructor(t){super(t,0,"Unknown Error"),this.name="HttpErrorResponse",this.ok=!1,this.message=this.status>=200&&this.status<300?`Http failure during parsing for ${t.url||"(unknown url)"}`:`Http failure response for ${t.url||"(unknown url)"}: ${t.status} ${t.statusText}`,this.error=t.error||null}}var BC=function(e){return e[e.Continue=100]="Continue",e[e.SwitchingProtocols=101]="SwitchingProtocols",e[e.Processing=102]="Processing",e[e.EarlyHints=103]="EarlyHints",e[e.Ok=200]="Ok",e[e.Created=201]="Created",e[e.Accepted=202]="Accepted",e[e.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",e[e.NoContent=204]="NoContent",e[e.ResetContent=205]="ResetContent",e[e.PartialContent=206]="PartialContent",e[e.MultiStatus=207]="MultiStatus",e[e.AlreadyReported=208]="AlreadyReported",e[e.ImUsed=226]="ImUsed",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.Found=302]="Found",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.Unused=306]="Unused",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.LengthRequired=411]="LengthRequired",e[e.PreconditionFailed=412]="PreconditionFailed",e[e.PayloadTooLarge=413]="PayloadTooLarge",e[e.UriTooLong=414]="UriTooLong",e[e.UnsupportedMediaType=415]="UnsupportedMediaType",e[e.RangeNotSatisfiable=416]="RangeNotSatisfiable",e[e.ExpectationFailed=417]="ExpectationFailed",e[e.ImATeapot=418]="ImATeapot",e[e.MisdirectedRequest=421]="MisdirectedRequest",e[e.UnprocessableEntity=422]="UnprocessableEntity",e[e.Locked=423]="Locked",e[e.FailedDependency=424]="FailedDependency",e[e.TooEarly=425]="TooEarly",e[e.UpgradeRequired=426]="UpgradeRequired",e[e.PreconditionRequired=428]="PreconditionRequired",e[e.TooManyRequests=429]="TooManyRequests",e[e.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",e[e.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout",e[e.HttpVersionNotSupported=505]="HttpVersionNotSupported",e[e.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",e[e.InsufficientStorage=507]="InsufficientStorage",e[e.LoopDetected=508]="LoopDetected",e[e.NotExtended=510]="NotExtended",e[e.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",e}(BC||{});function m7(e,t){return{body:t,headers:e.headers,context:e.context,observe:e.observe,params:e.params,reportProgress:e.reportProgress,responseType:e.responseType,withCredentials:e.withCredentials,transferCache:e.transferCache}}let pme=(()=>{class e{constructor(n){this.handler=n}request(n,r,i={}){let o;if(n instanceof FC)o=n;else{let c,u;c=i.headers instanceof Rl?i.headers:new Rl(i.headers),i.params&&(u=i.params instanceof Xm?i.params:new Xm({fromObject:i.params})),o=new FC(n,r,void 0!==i.body?i.body:null,{headers:c,context:i.context,params:u,reportProgress:i.reportProgress,responseType:i.responseType||"json",withCredentials:i.withCredentials,transferCache:i.transferCache})}const s=Pn(o).pipe(Cb(c=>this.handler.handle(c)));if(n instanceof FC||"events"===i.observe)return s;const a=s.pipe(Yl(c=>c instanceof sy));switch(i.observe||"body"){case"body":switch(o.responseType){case"arraybuffer":return a.pipe(qt(c=>{if(null!==c.body&&!(c.body instanceof ArrayBuffer))throw new Error("Response is not an ArrayBuffer.");return c.body}));case"blob":return a.pipe(qt(c=>{if(null!==c.body&&!(c.body instanceof Blob))throw new Error("Response is not a Blob.");return c.body}));case"text":return a.pipe(qt(c=>{if(null!==c.body&&"string"!=typeof c.body)throw new Error("Response is not a string.");return c.body}));default:return a.pipe(qt(c=>c.body))}case"response":return a;default:throw new Error(`Unreachable: unhandled observe type ${i.observe}}`)}}delete(n,r={}){return this.request("DELETE",n,r)}get(n,r={}){return this.request("GET",n,r)}head(n,r={}){return this.request("HEAD",n,r)}jsonp(n,r){return this.request("JSONP",n,{params:(new Xm).append(r,"JSONP_CALLBACK"),observe:"body",responseType:"json"})}options(n,r={}){return this.request("OPTIONS",n,r)}patch(n,r,i={}){return this.request("PATCH",n,m7(i,r))}post(n,r,i={}){return this.request("POST",n,m7(i,r))}put(n,r,i={}){return this.request("PUT",n,m7(i,r))}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(tP))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac})}return e})();function mme(e,t){return t(e)}function cyt(e,t){return(n,r)=>t.intercept(n,{handle:i=>e(i,r)})}const lyt=new Yt(""),OC=new Yt(""),gme=new Yt(""),yme=new Yt("");function dyt(){let e=null;return(t,n)=>{null===e&&(e=(bt(lyt,{optional:!0})??[]).reduceRight(cyt,mme));const r=bt(kh),i=r.add();return e(t,n).pipe(Ex(()=>r.remove(i)))}}let bme=(()=>{class e extends tP{constructor(n,r){super(),this.backend=n,this.injector=r,this.chain=null,this.pendingTasks=bt(kh);const i=bt(yme,{optional:!0});this.backend=i??n}handle(n){if(null===this.chain){const i=Array.from(new Set([...this.injector.get(OC),...this.injector.get(gme,[])]));this.chain=i.reduceRight((o,s)=>function uyt(e,t,n){return(r,i)=>Md(n,()=>t(r,o=>e(o,i)))}(o,s,this.injector),mme)}const r=this.pendingTasks.add();return this.chain(n,i=>this.backend.handle(i)).pipe(Ex(()=>this.pendingTasks.remove(r)))}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(nP),Zt(xc))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac})}return e})();const gyt=/^\)\]\}',?\n/;let _me=(()=>{class e{constructor(n){this.xhrFactory=n}handle(n){if("JSONP"===n.method)throw new It(-2800,!1);const r=this.xhrFactory;return(r.\u0275loadImpl?$i(r.\u0275loadImpl()):Pn(null)).pipe(To(()=>new ns(o=>{const s=r.build();if(s.open(n.method,n.urlWithParams),n.withCredentials&&(s.withCredentials=!0),n.headers.forEach((h,g)=>s.setRequestHeader(h,g.join(","))),n.headers.has("Accept")||s.setRequestHeader("Accept","application/json, text/plain, */*"),!n.headers.has("Content-Type")){const h=n.detectContentTypeHeader();null!==h&&s.setRequestHeader("Content-Type",h)}if(n.responseType){const h=n.responseType.toLowerCase();s.responseType="json"!==h?h:"text"}const a=n.serializeBody();let c=null;const u=()=>{if(null!==c)return c;const h=s.statusText||"OK",g=new Rl(s.getAllResponseHeaders()),y=function yyt(e){return"responseURL"in e&&e.responseURL?e.responseURL:/^X-Request-URL:/m.test(e.getAllResponseHeaders())?e.getResponseHeader("X-Request-URL"):null}(s)||n.url;return c=new iP({headers:g,status:s.status,statusText:h,url:y}),c},l=()=>{let{headers:h,status:g,statusText:y,url:b}=u(),x=null;g!==BC.NoContent&&(x=typeof s.response>"u"?s.responseText:s.response),0===g&&(g=x?BC.Ok:0);let _=g>=200&&g<300;if("json"===n.responseType&&"string"==typeof x){const S=x;x=x.replace(gyt,"");try{x=""!==x?JSON.parse(x):null}catch(A){x=S,_&&(_=!1,x={error:A,text:x})}}_?(o.next(new sy({body:x,headers:h,status:g,statusText:y,url:b||void 0})),o.complete()):o.error(new G1({error:x,headers:h,status:g,statusText:y,url:b||void 0}))},d=h=>{const{url:g}=u(),y=new G1({error:h,status:s.status||0,statusText:s.statusText||"Unknown Error",url:g||void 0});o.error(y)};let f=!1;const p=h=>{f||(o.next(u()),f=!0);let g={type:Km.DownloadProgress,loaded:h.loaded};h.lengthComputable&&(g.total=h.total),"text"===n.responseType&&s.responseText&&(g.partialText=s.responseText),o.next(g)},m=h=>{let g={type:Km.UploadProgress,loaded:h.loaded};h.lengthComputable&&(g.total=h.total),o.next(g)};return s.addEventListener("load",l),s.addEventListener("error",d),s.addEventListener("timeout",d),s.addEventListener("abort",d),n.reportProgress&&(s.addEventListener("progress",p),null!==a&&s.upload&&s.upload.addEventListener("progress",m)),s.send(a),o.next({type:Km.Sent}),()=>{s.removeEventListener("error",d),s.removeEventListener("abort",d),s.removeEventListener("load",l),s.removeEventListener("timeout",d),n.reportProgress&&(s.removeEventListener("progress",p),null!==a&&s.upload&&s.upload.removeEventListener("progress",m)),s.readyState!==s.DONE&&s.abort()}})))}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(PX))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac})}return e})();const b7=new Yt(""),xme=new Yt("",{providedIn:"root",factory:()=>"XSRF-TOKEN"}),Sme=new Yt("",{providedIn:"root",factory:()=>"X-XSRF-TOKEN"});class Cme{}let _yt=(()=>{class e{constructor(n,r,i){this.doc=n,this.platform=r,this.cookieName=i,this.lastCookieString="",this.lastToken=null,this.parseCount=0}getToken(){if("server"===this.platform)return null;const n=this.doc.cookie||"";return n!==this.lastCookieString&&(this.parseCount++,this.lastToken=xX(n,this.cookieName),this.lastCookieString=n),this.lastToken}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(tu),Zt(Th),Zt(xme))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac})}return e})();function xyt(e,t){const n=e.url.toLowerCase();if(!bt(b7)||"GET"===e.method||"HEAD"===e.method||n.startsWith("http://")||n.startsWith("https://"))return t(e);const r=bt(Cme).getToken(),i=bt(Sme);return null!=r&&!e.headers.has(i)&&(e=e.clone({headers:e.headers.set(i,r)})),t(e)}var Zm=function(e){return e[e.Interceptors=0]="Interceptors",e[e.LegacyInterceptors=1]="LegacyInterceptors",e[e.CustomXsrfConfiguration=2]="CustomXsrfConfiguration",e[e.NoXsrfProtection=3]="NoXsrfProtection",e[e.JsonpSupport=4]="JsonpSupport",e[e.RequestsMadeViaParent=5]="RequestsMadeViaParent",e[e.Fetch=6]="Fetch",e}(Zm||{});function Syt(...e){const t=[pme,_me,bme,{provide:tP,useExisting:bme},{provide:nP,useExisting:_me},{provide:OC,useValue:xyt,multi:!0},{provide:b7,useValue:!0},{provide:Cme,useClass:_yt}];for(const n of e)t.push(...n.\u0275providers);return Iy(t)}const wme=new Yt("");function Cyt(){return function ay(e,t){return{\u0275kind:e,\u0275providers:t}}(Zm.LegacyInterceptors,[{provide:wme,useFactory:dyt},{provide:OC,useExisting:wme,multi:!0}])}let wyt=(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275mod=p_({type:e});static#n=this.\u0275inj=Sy({providers:[Syt(Cyt())]})}return e})();function Pyt(e,t){1&e&&gi(0,"ngx-structure-viewer",5),2&e&&Bh("settings",hx().settings)("source",t)}function Myt(e,t){1&e&&gi(0,"ngx-structure-viewer",5),2&e&&Bh("settings",hx().settings)("source",t)}let Ryt=(()=>{class e{constructor(n){this.http=n,this.local={type:"local",format:"mmcif",label:"8VAP.A",binary:!1,data:"..."},this.remote={type:"remote",format:"mmcif",label:"8VAP",binary:!1,link:"..."},this.settings={"background-color":"#2b3035ff","backbone-color":"#6ea8fecc","interaction-color":"#ff0000ff","interaction-size":1},this.local$=this.http.get("assets/8vap.A.cif",{responseType:"text"}).pipe(qt(r=>new Blob([r],{type:"text/plain"})),qt(r=>({...this.local,data:r}))),this.remote$=Pn({...this.remote,link:"https://files.rcsb.org/view/8VAP.cif"})}static#e=this.\u0275fac=function(r){return new(r||e)(cn(pme))};static#t=this.\u0275cmp=Mu({type:e,selectors:[["app-section-sources"]],standalone:!0,features:[Nu],decls:25,vars:12,consts:[[1,"row","mb-3"],[1,"col-6"],[1,"d-flex","flex-row","align-items-start","gap-3","mb-3"],[1,"d-block","flex-grow-1"],[1,"rounded","squared","bg-body-tertiary","overflow-hidden"],[3,"settings","source"],[1,"d-block","flex-shrink-0","bg-body-tertiary","p-3"],[1,"mb-0"]],template:function(r,i){if(1&r&&(dn(0,"div",0)(1,"div",1)(2,"h2"),ar(3,"Upload local structure"),fn(),dn(4,"div",2)(5,"div",3)(6,"div",4),Jc(7,Pyt,1,2,"ngx-structure-viewer",5),Ga(8,"async"),fn()(),dn(9,"code",6)(10,"pre",7),ar(11),Ga(12,"json"),fn()()()(),dn(13,"div",1)(14,"h2"),ar(15,"Download remote structure"),fn(),dn(16,"div",2)(17,"div",3)(18,"div",4),Jc(19,Myt,1,2,"ngx-structure-viewer",5),Ga(20,"async"),fn()(),dn(21,"code",6)(22,"pre",7),ar(23),Ga(24,"json"),fn()()()()()),2&r){let o,s;mi(7),Va(7,(o=ja(8,4,i.local$))?7:-1,o),mi(4),ku(ja(12,6,i.local)),mi(8),Va(19,(s=ja(20,8,i.remote$))?19:-1,s),mi(4),ku(ja(24,10,i.remote))}},dependencies:[eP,wyt,Uh,Cx,sI]})}return e})();function kyt(e,t){if(1&e&&(dn(0,"div",6)(1,"div",7),gi(2,"div",8),dn(3,"code",9)(4,"pre",10),ar(5),Ga(6,"json"),fn()()()()),2&e){const n=t.$implicit;mi(2),pb("background-color",n.color),mi(3),ku(ja(6,3,n))}}function Nyt(e,t){if(1&e&&(dn(0,"div",0)(1,"div",1)(2,"div",2),gi(3,"ngx-structure-viewer",3),fn()(),dn(4,"div",4)(5,"h2"),ar(6,"Color chain"),fn(),dn(7,"div",5),function PW(e,t,n,r,i,o,s,a,c,u,l,d,f){Vd("NgControlFlow");const p=void 0!==c,m=it(),h=a?s.bind(m[go][Mi]):s,g=new Y2e(p,h);m[Vn+e]=g,Jc(e+1,t,n,r,i,o),p&&Jc(e+2,c,u,l,d,f)}(8,kyt,7,5,"div",6,EW),fn()()()),2&e){const n=t,r=hx();mi(3),Bh("settings",r.settings)("source",r.source)("loci",n),mi(5),function MW(e){const t=sr(null),n=la();try{const r=it(),i=r[Mt],o=r[n];if(void 0===o.liveCollection){const a=n+1,c=tN(r,a),u=nN(i,a);o.liveCollection=new X2e(c,r,u)}else o.liveCollection.reset();const s=o.liveCollection;if(function q2e(e,t,n){let r,i,o=0,s=e.length-1;if(Array.isArray(t)){let a=t.length-1;for(;o<=s&&o<=a;){const c=e.at(o),u=t[o],l=Jk(o,c,o,u,n);if(0!==l){l<0&&e.updateValue(o,u),o++;continue}const d=e.at(s),f=t[a],p=Jk(s,d,a,f,n);if(0!==p){p<0&&e.updateValue(s,f),s--,a--;continue}const m=n(o,c),h=n(s,d),g=n(o,u);if(Object.is(g,h)){const y=n(a,f);Object.is(y,m)?(e.swap(o,s),e.updateValue(s,f),a--,s--):e.move(s,o),e.updateValue(o,u),o++}else if(r??=new DW,i??=TW(e,o,s,n),eN(e,r,o,g))e.updateValue(o,u),o++,s++;else if(i.has(g))r.set(m,e.detach(o)),s--;else{const y=e.create(o,t[o]);e.attach(o,y),o++,s++}}for(;o<=a;)IW(e,r,n,o,t[o]),o++}else if(null!=t){const a=t[Symbol.iterator]();let c=a.next();for(;!c.done&&o<=s;){const u=e.at(o),l=c.value,d=Jk(o,u,o,l,n);if(0!==d)d<0&&e.updateValue(o,l),o++,c=a.next();else{r??=new DW,i??=TW(e,o,s,n);const f=n(o,l);if(eN(e,r,o,f))e.updateValue(o,l),o++,s++,c=a.next();else if(i.has(f)){const p=n(o,u);r.set(p,e.detach(o)),s--}else e.attach(o,e.create(o,l)),o++,s++,c=a.next()}}for(;!c.done;)IW(e,r,n,e.length,c.value),c=a.next()}for(;o<=s;)e.destroy(e.detach(s--));r?.forEach(a=>{e.destroy(a)})}(s,e,o.trackByFn),s.updateIndexes(),o.hasEmptyBlock){const a=zl(),c=0===s.length;if(jo(r,a,c)){const u=n+2,l=tN(r,u);if(c){const d=nN(i,u),f=Xy(l,d.tView.ssrId);G_(l,z_(r,d,void 0,{dehydratedView:f}),0,Yy(d,f))}else dk(l,0)}}}finally{sr(t)}}(n)}}let Fyt=(()=>{class e{constructor(){this.settings={"background-color":"#2b3035ff","backbone-color":"#6ea8fecc","interaction-color":"#ff0000ff","interaction-size":1},this.source={type:"remote",format:"mmcif",label:"8VAP",binary:!1,link:"assets/8vap.cif"};const n=[{chain:"A",color:"#6f42c1"},{chain:"B",color:"#0d6efd"},{chain:"C",color:"#dc3545"},{chain:"D",color:"#ffc107"},{chain:"E",color:"#28a745"},{chain:"F",color:"#17a2b8"},{chain:"G",color:"#fd7e14"}];this.chains$=ome(3e3).pipe(qt(()=>n.map(r=>r.color)),qt(r=>r.sort(()=>Math.random()-.5)),qt(r=>r.map((i,o)=>({...n[o],color:i}))),Dx(n),Zl(1))}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275cmp=Mu({type:e,selectors:[["app-section-chains"]],standalone:!0,features:[Nu],decls:2,vars:3,consts:[[1,"row","mb-3"],[1,"col-9"],[1,"rounded","squared","overflow-hidden","shadow-sm"],[3,"settings","source","loci"],[1,"col-3","pt-0","p-3"],[1,"d-flex","flex-column","gap-2"],[1,"flex-1"],[1,"d-flex","flex-row","gap-2"],[1,"d-block","flex-shrink-0","p-2"],[1,"bg-body-tertiary","flex-grow-1","p-3"],[1,"m-0"]],template:function(r,i){if(1&r&&(Jc(0,Nyt,10,3,"div",0),Ga(1,"async")),2&r){let o;Va(0,(o=ja(1,1,i.chains$))?0:-1,o)}},dependencies:[eP,Uh,Cx,sI],changeDetection:0})}return e})();function Byt(e,t){1&e&&(dn(0,"div",4)(1,"code",6),ar(2),fn()()),2&e&&(mi(2),ku(t))}let Oyt=(()=>{class e{constructor(){this.label$=new ou(1),this.settings={"background-color":"#2b3035ff","backbone-color":"#6ea8fecc","interaction-color":"#ff0000ff","interaction-size":1},this.source={type:"remote",format:"mmcif",label:"8VAP",binary:!1,link:"assets/8vap.cif"}}onHighlights(n){this.label$.next(n?`Chain: ${n.chain}; Start: ${n.start}; End: ${n.end}.`:"")}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275cmp=Mu({type:e,selectors:[["app-section-highlights"]],standalone:!0,features:[Nu],decls:9,vars:5,consts:[[1,"row","mb-3"],[1,"col-6","position-relative"],[1,"squared","rounded","overflow-hidden","bg-body-tertiary"],[3,"highlights","settings","source"],[1,"d-block","position-absolute","bottom-0","end-0","w-auto","h-auto","pe-3"],[1,"col-6"],[1,"d-block","p-3"]],template:function(r,i){if(1&r&&(dn(0,"div",0)(1,"div",1)(2,"div",2)(3,"ngx-structure-viewer",3),px("highlights",function(s){return i.onHighlights(s)}),fn()(),Jc(4,Byt,3,1,"div",4),Ga(5,"async"),fn(),dn(6,"div",5)(7,"h2"),ar(8,"Highlights"),fn()()()),2&r){let o;mi(3),Bh("settings",i.settings)("source",i.source),mi(),Va(4,(o=ja(5,3,i.label$))?4:-1,o)}},dependencies:[eP,Uh,Cx],changeDetection:0})}return e})(),Lyt=(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275cmp=Mu({type:e,selectors:[["page-structure-viewer"]],standalone:!0,features:[Nu],decls:13,vars:0,consts:[[1,"container","pt-3"],[1,"mb-3"]],template:function(r,i){1&r&&(dn(0,"div",0)(1,"div",1)(2,"h1"),ar(3,"Structure viewer"),fn(),dn(4,"p"),ar(5," The "),dn(6,"b"),ar(7,"ngx-structure-viewer"),fn(),ar(8," is a Mol* wrapper for Angular. It is a viewer for molecular structures and can be used to visualize and interact with 3D molecular structures. It works out of the box with the latest releases of Angular and automatized the most common features of Mol*. "),fn()(),gi(9,"app-section-sources")(10,"app-section-chains")(11,"app-section-interactions")(12,"app-section-highlights"),fn())},dependencies:[K0t,Oyt,Ryt,Fyt,GF,Uh],styles:[".progress-bar[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_progress 10s linear infinite;width:0}@keyframes _ngcontent-%COMP%_progress{0%{width:0}to{width:100%}}"]})}return e})();function Uyt(e){return e}function Vyt(e){return"translate("+e+",0)"}function zyt(e){return"translate(0,"+e+")"}function Gyt(e){return t=>+e(t)}function jyt(e,t){return t=Math.max(0,e.bandwidth()-2*t)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function Hyt(){return!this.__axis}function cP(e,t){var n=[],r=null,i=null,o=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,u=1===e||4===e?-1:1,l=4===e||2===e?"x":"y",d=1===e||3===e?Vyt:zyt;function f(p){var m=r??(t.ticks?t.ticks.apply(t,n):t.domain()),h=i??(t.tickFormat?t.tickFormat.apply(t,n):Uyt),g=Math.max(o,0)+a,y=t.range(),b=+y[0]+c,x=+y[y.length-1]+c,_=(t.bandwidth?jyt:Gyt)(t.copy(),c),S=p.selection?p.selection():p,A=S.selectAll(".domain").data([null]),E=S.selectAll(".tick").data(m,t).order(),w=E.exit(),D=E.enter().append("g").attr("class","tick"),I=E.select("line"),R=E.select("text");A=A.merge(A.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),E=E.merge(D),I=I.merge(D.append("line").attr("stroke","currentColor").attr(l+"2",u*o)),R=R.merge(D.append("text").attr("fill","currentColor").attr(l,u*g).attr("dy",1===e?"0em":3===e?"0.71em":"0.32em")),p!==S&&(A=A.transition(p),E=E.transition(p),I=I.transition(p),R=R.transition(p),w=w.transition(p).attr("opacity",1e-6).attr("transform",function(T){return isFinite(T=_(T))?d(T+c):this.getAttribute("transform")}),D.attr("opacity",1e-6).attr("transform",function(T){var M=this.parentNode.__axis;return d((M&&isFinite(M=M(T))?M:_(T))+c)})),w.remove(),A.attr("d",4===e||2===e?s?"M"+u*s+","+b+"H"+c+"V"+x+"H"+u*s:"M"+c+","+b+"V"+x:s?"M"+b+","+u*s+"V"+c+"H"+x+"V"+u*s:"M"+b+","+c+"H"+x),E.attr("opacity",1).attr("transform",function(T){return d(_(T)+c)}),I.attr(l+"2",u*o),R.attr(l,u*g).text(h),S.filter(Hyt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===e?"start":4===e?"end":"middle"),S.each(function(){this.__axis=_})}return f.scale=function(p){return arguments.length?(t=p,f):t},f.ticks=function(){return n=Array.from(arguments),f},f.tickArguments=function(p){return arguments.length?(n=null==p?[]:Array.from(p),f):n.slice()},f.tickValues=function(p){return arguments.length?(r=null==p?null:Array.from(p),f):r&&r.slice()},f.tickFormat=function(p){return arguments.length?(i=p,f):i},f.tickSize=function(p){return arguments.length?(o=s=+p,f):o},f.tickSizeInner=function(p){return arguments.length?(o=+p,f):o},f.tickSizeOuter=function(p){return arguments.length?(s=+p,f):s},f.tickPadding=function(p){return arguments.length?(a=+p,f):a},f.offset=function(p){return arguments.length?(c=+p,f):c},f}function Wyt(){}function _7(e){return null==e?Wyt:function(){return this.querySelector(e)}}function Xyt(){return[]}function Rme(e){return null==e?Xyt:function(){return this.querySelectorAll(e)}}function kme(e){return function(){return this.matches(e)}}function Nme(e){return function(t){return t.matches(e)}}var Qyt=Array.prototype.find;function ebt(){return this.firstElementChild}var nbt=Array.prototype.filter;function rbt(){return Array.from(this.children)}function Fme(e){return new Array(e.length)}function uP(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function ubt(e,t,n,r,i,o){for(var a,s=0,c=t.length,u=o.length;st?1:e>=t?0:NaN}uP.prototype={constructor:uP,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};var x7="http://www.w3.org/1999/xhtml";const Bme={svg:"http://www.w3.org/2000/svg",xhtml:x7,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function lP(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),Bme.hasOwnProperty(t)?{space:Bme[t],local:e}:e}function Ibt(e){return function(){this.removeAttribute(e)}}function Tbt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Dbt(e,t){return function(){this.setAttribute(e,t)}}function Ebt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Pbt(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function Mbt(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Ome(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function kbt(e){return function(){this.style.removeProperty(e)}}function Nbt(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Fbt(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function j1(e,t){return e.style.getPropertyValue(t)||Ome(e).getComputedStyle(e,null).getPropertyValue(t)}function Obt(e){return function(){delete this[e]}}function Lbt(e,t){return function(){this[e]=t}}function Ubt(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function Lme(e){return e.trim().split(/^|\s+/)}function S7(e){return e.classList||new Ume(e)}function Ume(e){this._node=e,this._names=Lme(e.getAttribute("class")||"")}function Vme(e,t){for(var n=S7(e),r=-1,i=t.length;++r=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var jme=[null];function Pu(e,t){this._groups=e,this._parents=t}function Hme(){return new Pu([[document.documentElement]],jme)}Pu.prototype=Hme.prototype={constructor:Pu,select:function $yt(e){"function"!=typeof e&&(e=_7(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=x&&(x=b+1);!(S=g[x])&&++x=0;)(s=r[i])&&(o&&4^s.compareDocumentPosition(o)&&o.parentNode.insertBefore(s,o),o=s);return this},sort:function bbt(e){function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}e||(e=vbt);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==t?kbt:"function"==typeof t?Fbt:Nbt)(e,t,n??"")):j1(this.node(),e)},property:function Vbt(e,t){return arguments.length>1?this.each((null==t?Obt:"function"==typeof t?Ubt:Lbt)(e,t)):this.node()[e]},classed:function Hbt(e,t){var n=Lme(e+"");if(arguments.length<2){for(var r=S7(this.node()),i=-1,o=n.length;++i=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}(e+""),o=r.length;if(!(arguments.length<2)){for(a=t?yvt:gvt,i=0;i{}};function qme(){for(var r,e=0,t=arguments.length,n={};e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}(e+"",n),o=-1,s=r.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++o0)for(var i,o,n=new Array(i),r=0;r=0&&e._call.call(void 0,t),e=e._next;--H1}()}finally{H1=0,function Pvt(){for(var e,n,t=fP,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:fP=n);GC=e,A7(r)}(),cy=0}}function Evt(){var e=jC.now(),t=e-pP;t>Yme&&(hP-=t,pP=e)}function A7(e){H1||(VC&&(VC=clearTimeout(VC)),e-cy>24?(e<1/0&&(VC=setTimeout(Zme,e-jC.now()-hP)),zC&&(zC=clearInterval(zC))):(zC||(pP=jC.now(),zC=setInterval(Evt,Yme)),H1=1,Xme(Zme)))}function Qme(e,t,n){var r=new mP;return r.restart(i=>{r.stop(),e(i+t)},t=null==t?0:+t,n),r}mP.prototype=Kme.prototype={constructor:mP,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?w7():+n)+(null==t?0:+t),!this._next&&GC!==this&&(GC?GC._next=this:fP=this,GC=this),this._call=e,this._time=n,A7()},stop:function(){this._call&&(this._call=null,this._time=1/0,A7())}};var Mvt=$me("start","end","cancel","interrupt"),Rvt=[],Jme=0,I7=2,gP=3,T7=5,yP=6;function bP(e,t,n,r,i,o){var s=e.__transition;if(s){if(n in s)return}else e.__transition={};!function kvt(e,t,n){var i,r=e.__transition;function s(u){var l,d,f,p;if(1!==n.state)return c();for(l in r)if((p=r[l]).name===n.name){if(p.state===gP)return Qme(s);4===p.state?(p.state=yP,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[l]):+lJme)throw new Error("too late; already scheduled");return n}function zf(e,t){var n=Id(e,t);if(n.state>gP)throw new Error("too late; already running");return n}function Id(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function vP(e,t){var r,i,s,n=e.__transition,o=!0;if(n){for(s in t=null==t?null:t+"",n)(r=n[s]).name===t?(i=r.state>I7&&r.state180?l+=360:l-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:Td(u,l)})):l&&d.push(i(d)+"rotate("+l+r)}(u.rotate,l.rotate,d,f),function a(u,l,d,f){u!==l?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:Td(u,l)}):l&&d.push(i(d)+"skewX("+l+r)}(u.skewX,l.skewX,d,f),function c(u,l,d,f,p,m){if(u!==d||l!==f){var h=p.push(i(p)+"scale(",null,",",null,")");m.push({i:h-4,x:Td(u,d)},{i:h-2,x:Td(l,f)})}else(1!==d||1!==f)&&p.push(i(p)+"scale("+d+","+f+")")}(u.scaleX,u.scaleY,l.scaleX,l.scaleY,d,f),u=l=null,function(p){for(var g,m=-1,h=f.length;++m>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?SP(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?SP(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=jvt.exec(e))?new qc(t[1],t[2],t[3],1):(t=Hvt.exec(e))?new qc(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=qvt.exec(e))?SP(t[1],t[2],t[3],t[4]):(t=Wvt.exec(e))?SP(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=$vt.exec(e))?fge(t[1],t[2]/100,t[3]/100,1):(t=Yvt.exec(e))?fge(t[1],t[2]/100,t[3]/100,t[4]):sge.hasOwnProperty(e)?uge(sge[e]):"transparent"===e?new qc(NaN,NaN,NaN,0):null}function uge(e){return new qc(e>>16&255,e>>8&255,255&e,1)}function SP(e,t,n,r){return r<=0&&(e=t=n=NaN),new qc(e,t,n,r)}function CP(e,t,n,r){return 1===arguments.length?function Zvt(e){return e instanceof HC||(e=uy(e)),e?new qc((e=e.rgb()).r,e.g,e.b,e.opacity):new qc}(e):new qc(e,t,n,r??1)}function qc(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function lge(){return`#${dy(this.r)}${dy(this.g)}${dy(this.b)}`}function dge(){const e=wP(this.opacity);return`${1===e?"rgb(":"rgba("}${ly(this.r)}, ${ly(this.g)}, ${ly(this.b)}${1===e?")":`, ${e})`}`}function wP(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ly(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function dy(e){return((e=ly(e))<16?"0":"")+e.toString(16)}function fge(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Dd(e,t,n,r)}function pge(e){if(e instanceof Dd)return new Dd(e.h,e.s,e.l,e.opacity);if(e instanceof HC||(e=uy(e)),!e)return new Dd;if(e instanceof Dd)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(s=t===o?(n-r)/a+6*(n0&&c<1?0:s,new Dd(s,a,c,e.opacity)}function Dd(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function hge(e){return(e=(e||0)%360)<0?e+360:e}function AP(e){return Math.max(0,Math.min(1,e||0))}function R7(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function mge(e,t,n,r,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*n+(1+3*e+3*o-3*s)*r+s*i)/6}M7(HC,uy,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:age,formatHex:age,formatHex8:function Xvt(){return this.rgb().formatHex8()},formatHsl:function Kvt(){return pge(this).formatHsl()},formatRgb:cge,toString:cge}),M7(qc,CP,oge(HC,{brighter(e){return e=null==e?xP:Math.pow(xP,e),new qc(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new qc(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new qc(ly(this.r),ly(this.g),ly(this.b),wP(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:lge,formatHex:lge,formatHex8:function Qvt(){return`#${dy(this.r)}${dy(this.g)}${dy(this.b)}${dy(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:dge,toString:dge})),M7(Dd,function Jvt(e,t,n,r){return 1===arguments.length?pge(e):new Dd(e,t,n,r??1)},oge(HC,{brighter(e){return e=null==e?xP:Math.pow(xP,e),new Dd(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Dd(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new qc(R7(e>=240?e-240:e+120,i,r),R7(e,i,r),R7(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Dd(hge(this.h),AP(this.s),AP(this.l),wP(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=wP(this.opacity);return`${1===e?"hsl(":"hsla("}${hge(this.h)}, ${100*AP(this.s)}%, ${100*AP(this.l)}%${1===e?")":`, ${e})`}`}}));const k7=e=>()=>e;function yge(e,t){var n=t-e;return n?function gge(e,t){return function(n){return e+n*t}}(e,n):k7(isNaN(e)?t:e)}const IP=function e(t){var n=function r1t(e){return 1==(e=+e)?yge:function(t,n){return n-t?function n1t(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):k7(isNaN(t)?n:t)}}(t);function r(i,o){var s=n((i=CP(i)).r,(o=CP(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),u=yge(i.opacity,o.opacity);return function(l){return i.r=s(l),i.g=a(l),i.b=c(l),i.opacity=u(l),i+""}}return r.gamma=e,r}(1);function bge(e){return function(t){var s,a,n=t.length,r=new Array(n),i=new Array(n),o=new Array(n);for(s=0;s=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1];return mge((n-r/t)*t,r>0?e[r-1]:2*i-o,i,o,rn&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:Td(r,i)})),n=F7.lastIndex;return n=0&&(t=t.slice(0,n)),!t||"start"===t})}(t)?D7:zf;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}(n,e,t))},attr:function f1t(e,t){var n=lP(e),r="transform"===n?Lvt:_ge;return this.attrTween(e,"function"==typeof t?(n.local?d1t:l1t)(n,r,P7(this,"attr."+e,t)):null==t?(n.local?a1t:s1t)(n):(n.local?u1t:c1t)(n,r,t))},attrTween:function y1t(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var r=lP(e);return this.tween(n,(r.local?m1t:g1t)(r,t))},style:function j1t(e,t,n){var r="transform"==(e+="")?Ovt:_ge;return null==t?this.styleTween(e,function U1t(e,t){var n,r,i;return function(){var o=j1(this,e),s=(this.style.removeProperty(e),j1(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}(e,r)).on("end.style."+e,xge(e)):"function"==typeof t?this.styleTween(e,function z1t(e,t,n){var r,i,o;return function(){var s=j1(this,e),a=n(this),c=a+"";return null==a&&(this.style.removeProperty(e),c=a=j1(this,e)),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}(e,r,P7(this,"style."+e,t))).each(function G1t(e,t){var n,r,i,a,o="style."+t,s="end."+o;return function(){var c=zf(this,e),u=c.on,l=null==c.value[o]?a||(a=xge(t)):void 0;(u!==n||i!==l)&&(r=(n=u).copy()).on(s,i=l),c.on=r}}(this._id,e)):this.styleTween(e,function V1t(e,t,n){var r,o,i=n+"";return function(){var s=j1(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}(e,r,t),n).on("end.style."+e,null)},styleTween:function W1t(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw new Error;return this.tween(r,function q1t(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&function H1t(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}(e,s,n)),r}return o._value=t,o}(e,t,n??""))},text:function X1t(e){return this.tween("text","function"==typeof e?function Y1t(e){return function(){var t=e(this);this.textContent=t??""}}(P7(this,"text",e)):function $1t(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function Q1t(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function Z1t(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&function K1t(e){return function(t){this.textContent=e.call(this,t)}}(i)),t}return r._value=e,r}(e))},remove:function N1t(){return this.on("end.remove",function k1t(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function zvt(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s,r=Id(this.node(),n).tween,i=0,o=r.length;i1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Y1(e){return(e=EP(Math.abs(e)))?e[1]:NaN}["w","e"].map($C),["n","s"].map($C),["n","w","e","s","nw","ne","sw","se"].map($C);var Dge,y_t=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function PP(e){if(!(t=y_t.exec(e)))throw new Error("invalid format: "+e);var t;return new V7({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function V7(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function Ege(e,t){var n=EP(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}PP.prototype=V7.prototype,V7.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Pge={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function h_t(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Ege(100*e,t),r:Ege,s:function v_t(e,t){var n=EP(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(Dge=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+EP(e,Math.max(0,t+o-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Mge(e){return e}var MP,z7,Nge,Rge=Array.prototype.map,kge=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"];!function x_t(e){MP=function __t(e){var t=void 0===e.grouping||void 0===e.thousands?Mge:function m_t(e,t){return function(n,r){for(var i=n.length,o=[],s=0,a=e[0],c=0;i>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),o.push(n.substring(i-=a,i+a)),!((c+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}(Rge.call(e.grouping,Number),e.thousands+""),n=void 0===e.currency?"":e.currency[0]+"",r=void 0===e.currency?"":e.currency[1]+"",i=void 0===e.decimal?".":e.decimal+"",o=void 0===e.numerals?Mge:function g_t(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}(Rge.call(e.numerals,String)),s=void 0===e.percent?"%":e.percent+"",a=void 0===e.minus?"\u2212":e.minus+"",c=void 0===e.nan?"NaN":e.nan+"";function u(d){var f=(d=PP(d)).fill,p=d.align,m=d.sign,h=d.symbol,g=d.zero,y=d.width,b=d.comma,x=d.precision,_=d.trim,S=d.type;"n"===S?(b=!0,S="g"):Pge[S]||(void 0===x&&(x=12),_=!0,S="g"),(g||"0"===f&&"="===p)&&(g=!0,f="0",p="=");var A="$"===h?n:"#"===h&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",E="$"===h?r:/[%p]/.test(S)?s:"",w=Pge[S],D=/[defgprs%]/.test(S);function I(R){var N,V,F,T=A,M=E;if("c"===S)M=w(R)+M,R="";else{var G=(R=+R)<0||1/R<0;if(R=isNaN(R)?c:w(Math.abs(R),x),_&&(R=function b_t(e){e:for(var i,t=e.length,n=1,r=-1;n0&&(r=0)}return r>0?e.slice(0,r)+e.slice(i+1):e}(R)),G&&0==+R&&"+"!==m&&(G=!1),T=(G?"("===m?m:a:"-"===m||"("===m?"":m)+T,M=("s"===S?kge[8+Dge/3]:"")+M+(G&&"("===m?")":""),D)for(N=-1,V=R.length;++N(F=R.charCodeAt(N))||F>57){M=(46===F?i+R.slice(N+1):R.slice(N))+M,R=R.slice(0,N);break}}b&&!g&&(R=t(R,1/0));var L=T.length+R.length+M.length,z=L>1)+T+R+M+z.slice(L);break;default:R=z+T+R+M}return o(R)}return x=void 0===x?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x)),I.toString=function(){return d+""},I}return{format:u,formatPrefix:function l(d,f){var p=u(((d=PP(d)).type="f",d)),m=3*Math.max(-8,Math.min(8,Math.floor(Y1(f)/3))),h=Math.pow(10,-m),g=kge[8+m/3];return function(y){return p(h*y)+g}}}}(e),z7=MP.format,Nge=MP.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});const S_t=Math.sqrt(50),C_t=Math.sqrt(10),w_t=Math.sqrt(2);function RP(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=S_t?10:o>=C_t?5:o>=w_t?2:1;let a,c,u;return i<0?(u=Math.pow(10,-i)/s,a=Math.round(e*u),c=Math.round(t*u),a/ut&&--c,u=-u):(u=Math.pow(10,i)*s,a=Math.round(e/u),c=Math.round(t/u),a*ut&&--c),ct?1:e>=t?0:NaN}function T_t(e,t){return null==e||null==t?NaN:te?1:t>=e?0:NaN}function Fge(e){let t,n,r;function i(a,c,u=0,l=a.length){if(u>>1;n(a[d],c)<0?u=d+1:l=d}while(ukP(e(a),c),r=(a,c)=>e(a)-c):(t=e===kP||e===T_t?e:D_t,n=e,r=e),{left:i,center:function s(a,c,u=0,l=a.length){const d=i(a,c,u,l-1);return d>u&&r(a[d-1],c)>-r(a[d],c)?d-1:d},right:function o(a,c,u=0,l=a.length){if(u>>1;n(a[d],c)<=0?u=d+1:l=d}while(u0))return[];if((e=+e)==(t=+t))return[e];const r=t=i))return[];const a=o-i+1,c=new Array(a);if(r)if(s<0)for(let u=0;u0;){if((u=G7(s,a,n))===c)return r[i]=s,r[o]=a,t(r);if(u>0)s=Math.floor(s/u)*u,a=Math.ceil(a/u)*u;else{if(!(u<0))break;s=Math.ceil(s*u)/u,a=Math.floor(a*u)/u}c=u}return e},e}function Vge(){var e=function H_t(){return function j_t(){var r,i,o,a,c,u,e=Lge,t=Lge,n=j7,s=X1;function l(){var f=Math.min(e.length,t.length);return s!==X1&&(s=function U_t(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}(e[0],e[f-1])),a=f>2?z_t:V_t,c=u=null,d}function d(f){return null==f||isNaN(f=+f)?o:(c||(c=a(e.map(r),t,n)))(r(s(f)))}return d.invert=function(f){return s(i((u||(u=a(t,e.map(r),Td)))(f)))},d.domain=function(f){return arguments.length?(e=Array.from(f,L_t),l()):e.slice()},d.range=function(f){return arguments.length?(t=Array.from(f),l()):t.slice()},d.rangeRound=function(f){return t=Array.from(f),n=B_t,l()},d.clamp=function(f){return arguments.length?(s=!!f||X1,l()):s!==X1},d.interpolate=function(f){return arguments.length?(n=f,l()):n},d.unknown=function(f){return arguments.length?(o=f,d):o},function(f,p){return r=f,i=p,l()}}()(X1,X1)}();return e.copy=function(){return function G_t(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}(e,Vge())},Uge.apply(e,arguments),X_t(e)}class zge extends Map{constructor(t,n=Hge){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(q7(this,t))}has(t){return super.has(q7(this,t))}set(t,n){return super.set(function Gge({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}(this,t),n)}delete(t){return super.delete(function jge({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}(this,t))}}function q7({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Hge(e){return null!==e&&"object"==typeof e?e.valueOf():e}Set;const qge=Symbol("implicit");function Wge(){var e=new zge,t=[],n=[],r=qge;function i(o){let s=e.get(o);if(void 0===s){if(r!==qge)return r;e.set(o,s=t.push(o)-1)}return n[s%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new zge;for(const s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return Wge(t,n).unknown(r)},Uge.apply(i,arguments),i}function kl(e){return"string"==typeof e?new Pu([[document.querySelector(e)]],[document.documentElement]):new Pu([[e]],jme)}function K1(e){return function(){return e}}function $ge(e){this._context=e}function Q_t(e){return new $ge(e)}$ge.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};const W7=Math.PI,$7=2*W7,fy=1e-6,J_t=$7-fy;function Yge(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Yge;const n=10**t;return function(r){this._+=r[0];for(let i=1,o=r.length;ify)if(Math.abs(d*c-u*l)>fy&&o){let p=r-s,m=i-a,h=c*c+u*u,g=p*p+m*m,y=Math.sqrt(h),b=Math.sqrt(f),x=o*Math.tan((W7-Math.acos((h+f-g)/(2*y*b)))/2),_=x/b,S=x/y;Math.abs(_-1)>fy&&this._append`L${t+_*l},${n+_*d}`,this._append`A${o},${o},0,0,${+(d*p>l*m)},${this._x1=t+S*c},${this._y1=n+S*u}`}else this._append`L${this._x1=t},${this._y1=n}`}arc(t,n,r,i,o,s){if(t=+t,n=+n,s=!!s,(r=+r)<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),c=r*Math.sin(i),u=t+a,l=n+c,d=1^s,f=s?i-o:o-i;null===this._x1?this._append`M${u},${l}`:(Math.abs(this._x1-u)>fy||Math.abs(this._y1-l)>fy)&&this._append`L${u},${l}`,r&&(f<0&&(f=f%$7+$7),f>J_t?this._append`A${r},${r},0,1,${d},${t-a},${n-c}A${r},${r},0,1,${d},${this._x1=u},${this._y1=l}`:f>fy&&this._append`A${r},${r},0,${+(f>=W7)},${d},${this._x1=t+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function rxt(e){return e[0]}function ixt(e){return e[1]}function Xge(e){return e<0?-1:1}function Kge(e,t,n){var r=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),a=(o*i+s*r)/(r+i);return(Xge(o)+Xge(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function Zge(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Y7(e,t,n){var r=e._x0,o=e._x1,s=e._y1,a=(o-r)/3;e._context.bezierCurveTo(r+a,e._y0+a*t,o-a,s-a*n,o,s)}function FP(e){this._context=e}function Jge(e){this._context=e}function sxt(e){return new FP(e)}FP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Y7(this,this._t0,Zge(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Y7(this,Zge(this,n=Kge(this,e,t)),n);break;default:Y7(this,this._t0,n=Kge(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(function Qge(e){this._context=new Jge(e)}.prototype=Object.create(FP.prototype)).point=function(e,t){FP.prototype.point.call(this,t,e)},Jge.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,o){this._context.bezierCurveTo(t,e,r,n,o,i)}};const X7={capture:!0,passive:!1};function K7(e){e.preventDefault(),e.stopImmediatePropagation()}function e0e(e){return((e=Math.exp(e))+1/e)/2}const fxt=function e(t,n,r){function i(o,s){var g,y,a=o[0],c=o[1],u=o[2],f=s[2],p=s[0]-a,m=s[1]-c,h=p*p+m*m;if(h<1e-12)y=Math.log(f/u)/t,g=function(E){return[a+E*p,c+E*m,u*Math.exp(t*E*y)]};else{var b=Math.sqrt(h),x=(f*f-u*u+r*h)/(2*u*n*b),_=(f*f-u*u-r*h)/(2*f*n*b),S=Math.log(Math.sqrt(x*x+1)-x),A=Math.log(Math.sqrt(_*_+1)-_);y=(A-S)/t,g=function(E){var w=E*y,D=e0e(S),I=u/(n*b)*(D*function dxt(e){return((e=Math.exp(2*e))-1)/(e+1)}(t*w+S)-function lxt(e){return((e=Math.exp(e))-1/e)/2}(S));return[a+I*p,c+I*m,u*D/e0e(t*w+S)]}}return g.duration=1e3*y*t/Math.SQRT2,g}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s;return e(s,a,a*a)},i}(Math.SQRT2,2,4);function py(e,t){if(e=function pxt(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const BP=e=>()=>e;function hxt(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function bh(e,t,n){this.k=e,this.x=t,this.y=n}bh.prototype={constructor:bh,scale:function(e){return 1===e?this:new bh(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new bh(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Z7=new bh(1,0,0);function Q7(e){e.stopImmediatePropagation()}function YC(e){e.preventDefault(),e.stopImmediatePropagation()}function gxt(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function yxt(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function t0e(){return this.__zoom||Z7}function bxt(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function vxt(){return navigator.maxTouchPoints||"ontouchstart"in this}function _xt(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}let XC=(()=>{class e{get div(){return this.root.nativeElement}get width(){return this.div.offsetWidth}get margin(){const{"margin-top":n,"margin-right":r,"margin-bottom":i,"margin-left":o}=this.settings;return{top:n,right:r,bottom:i,left:o}}constructor(){this.initialize$=new ou(1),this.initialized$=this.initialize$.pipe(jr(n=>this.root=n),qt(()=>{const n=function K_t(e){return kl(C7(e).call(document.documentElement))}("svg"),r=n.node();if(!r)throw new Error("Could not create SVG node");return this.div.append(r),n}),jr(n=>this.svg=n),jr(n=>{const r=n.append("defs");this.clip=r.append("SVG:clipPath").attr("id","clip").append("SVG:rect"),this.draw=n.append("g").attr("class","features").attr("clip-path","url(#clip)"),this.zoom=function xxt(){var l,d,f,e=gxt,t=yxt,n=_xt,r=bxt,i=vxt,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=fxt,u=$me("start","zoom","end"),p=500,m=150,h=0,g=10;function y(N){N.property("__zoom",t0e).on("wheel.zoom",w,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",I).filter(i).on("touchstart.zoom",R).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function b(N,V){return(V=Math.max(o[0],Math.min(o[1],V)))===N.k?N:new bh(V,N.x,N.y)}function x(N,V,F){var G=V[0]-F[0]*N.k,L=V[1]-F[1]*N.k;return G===N.x&&L===N.y?N:new bh(N.k,G,L)}function _(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function S(N,V,F,G){N.on("start.zoom",function(){A(this,arguments).event(G).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(G).end()}).tween("zoom",function(){var L=this,z=arguments,j=A(L,z).event(G),Z=t.apply(L,z),$=null==F?_(Z):"function"==typeof F?F.apply(L,z):F,ee=Math.max(Z[1][0]-Z[0][0],Z[1][1]-Z[0][1]),q=L.__zoom,O="function"==typeof V?V.apply(L,z):V,H=c(q.invert($).concat(ee/q.k),O.invert($).concat(ee/O.k));return function(W){if(1===W)W=O;else{var Q=H(W),fe=ee/Q[2];W=new bh(fe,$[0]-Q[0]*fe,$[1]-Q[1]*fe)}j.zoom(null,W)}})}function A(N,V,F){return!F&&N.__zooming||new E(N,V)}function E(N,V){this.that=N,this.args=V,this.active=0,this.sourceEvent=null,this.extent=t.apply(N,V),this.taps=0}function w(N,...V){if(e.apply(this,arguments)){var F=A(this,V).event(N),G=this.__zoom,L=Math.max(o[0],Math.min(o[1],G.k*Math.pow(2,r.apply(this,arguments)))),z=py(N);if(F.wheel)(F.mouse[0][0]!==z[0]||F.mouse[0][1]!==z[1])&&(F.mouse[1]=G.invert(F.mouse[0]=z)),clearTimeout(F.wheel);else{if(G.k===L)return;F.mouse=[z,G.invert(z)],vP(this),F.start()}YC(N),F.wheel=setTimeout(function j(){F.wheel=null,F.end()},m),F.zoom("mouse",n(x(b(G,L),F.mouse[0],F.mouse[1]),F.extent,s))}}function D(N,...V){if(!f&&e.apply(this,arguments)){var F=N.currentTarget,G=A(this,V,!0).event(N),L=kl(N.view).on("mousemove.zoom",function $(q){if(YC(q),!G.moved){var O=q.clientX-j,H=q.clientY-Z;G.moved=O*O+H*H>h}G.event(q).zoom("mouse",n(x(G.that.__zoom,G.mouse[0]=py(q,F),G.mouse[1]),G.extent,s))},!0).on("mouseup.zoom",function ee(q){L.on("mousemove.zoom mouseup.zoom",null),function cxt(e,t){var n=e.document.documentElement,r=kl(e).on("dragstart.drag",null);t&&(r.on("click.drag",K7,X7),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(q.view,G.moved),YC(q),G.event(q).end()},!0),z=py(N,F),j=N.clientX,Z=N.clientY;(function axt(e){var t=e.document.documentElement,n=kl(e).on("dragstart.drag",K7,X7);"onselectstart"in t?n.on("selectstart.drag",K7,X7):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")})(N.view),Q7(N),G.mouse=[z,this.__zoom.invert(z)],vP(this),G.start()}}function I(N,...V){if(e.apply(this,arguments)){var F=this.__zoom,G=py(N.changedTouches?N.changedTouches[0]:N,this),L=F.invert(G),j=n(x(b(F,F.k*(N.shiftKey?.5:2)),G,L),t.apply(this,V),s);YC(N),a>0?kl(this).transition().duration(a).call(S,j,G,N):kl(this).call(y.transform,j,G,N)}}function R(N,...V){if(e.apply(this,arguments)){var z,j,Z,$,F=N.touches,G=F.length,L=A(this,V,N.changedTouches.length===G).event(N);for(Q7(N),j=0;j{const r=n.append("g").attr("class","x axis"),i=n.append("g").attr("class","y axis");this.axes={x:r,y:i}}),jr(()=>this.scale={x:Vge(),y:Wge()}),Zl(1))}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();function Sxt(e){return"trace"!==e.type?{type:"trace",values:[e],label:e.label}:{...e,type:"trace"}}let J7=(()=>{class e{set hierarchy(n){let r=0;for(n=[...n],this._traces=new Map,this._parent=new Map,this._children=new Map;n.length>0;){const i=n.splice(0,1).at(0),{nested:o,...s}=i,a=Object.assign(i,Sxt(s));this._children.set(a,[]);for(const u of o||[])this._parent.set(u,r),n.push(u);const c=this.getParent(a);c&&this._children.get(c).push(r),this._traces.set(r,a),r++}}get traces(){return this._traces}getTrace(n){return this.traces.get(n)}getParent(n){const r=this._parent.get(n);return r&&this._traces.get(r)}getBranch(n){const r=[],i=[n];for(;i.length>0;){const o=i.pop();r.push(o);const s=this.getChildren(o);i.push(...s)}return r}getChildren(n){return this._children.get(n).map(i=>this._traces.get(i))}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function n0e(e,t,n){e.attr("height",t.height).attr("width",t.width).attr("y",n.top).attr("x",n.left)}let eG=(()=>{class e{get svg(){return this.initializeService.svg}get div(){return this.initializeService.div}get height(){return this.div.offsetHeight}get width(){return this.div.offsetWidth}get margin(){return this.initializeService.margin}get scale(){return this.initializeService.scale}get axes(){return this.initializeService.axes}constructor(n){this.initializeService=n,this.resize$=new ou(1);const r=this.resize$.pipe(qt(()=>({width:this.width,height:this.height})),afe(100),Bde((i,o)=>i.width===o.width),qt(()=>{}),Dx(void 0));this.resized$=r.pipe(qt(()=>this.updateRoot()),qt(()=>this.updateDraw()),qt(()=>this.updateAxes()),qt(()=>this.updateRangeX()),qt(()=>this.updateRangeY()),jr(()=>console.log("Resized!")))}updateRoot(){const{y:n}=this.scale,i=n.range().at(-1)+this.margin.bottom,o=this.width;this.svg.attr("height",i).attr("width",o)}updateDraw(){const n={width:0,height:0};n.height=this.height-this.margin.top-this.margin.bottom,n.width=this.width-this.margin.left-this.margin.right,n0e(this.initializeService.clip,n,this.margin),n0e(this.initializeService.events,n,this.margin)}updateAxes(){const{x:n,y:r}=this.axes;n.attr("transform",`translate(0, ${this.height-this.margin.top})`),r.attr("transform",`translate(${this.margin.left}, 0)`)}updateRangeX(){const n=this.scale.x,r=this.width,{left:i,right:o}=this.margin;n.range([i,r-o])}updateRangeY(){}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(XC))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})(),r0e=(()=>{class e{get draw(){return this.initService.draw}constructor(n){this.initService=n,this.zoom$=new ou(1);const i=this.initService.initialized$.pipe(qt(()=>this._scale={x:this.initService.scale.x.copy(),y:this.initService.scale.y.copy()}),Zl(1)).pipe(To(()=>this.zoom$),qt(o=>{const{x:s}=this._scale,{x:a}=this.initService.scale,c=o.transform.rescaleX(s),[u,l]=c.domain();return a.domain([u,l]),this.initService.scale}),Dx(this.initService.scale));this.zoomed$=i.pipe(qt(()=>{const o=this.initService.axes,s=this.initService.scale,a=s.x.ticks().filter(u=>Number.isInteger(u)).slice(1,-1),c=function qyt(e){return cP(3,e)}(s.x).tickValues(a).tickFormat(z7(".0f"));o.x.call(c)}),jr(()=>console.log("Zoomed!")))}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(XC))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();const i0e={H:"blue",K:"blue",R:"blue",D:"red",E:"red",S:"green",T:"green",N:"green",Q:"green",A:"white",V:"white",L:"white",I:"white",M:"white",F:"magenta",W:"magenta",Y:"magenta",P:"brown",G:"brown",C:"yellow",B:"grey",Z:"grey",X:"grey","-":"grey"},tG=(parseFloat(getComputedStyle(document.documentElement).fontSize),e=>e.id),Qm=(e,t)=>t;let o0e=(()=>{class e{constructor(n,r,i){this.initializeService=n,this.featuresService=r,this.resizeService=i,this.traces$=new ou(1),this.sequence$=new ou(1),this.draw$=this.sequence$.pipe(jr(o=>{this.initializeService.scale.x.domain([0,o.length+1])}),qt(o=>this.createSequence(o)),Zl(1),To(()=>this.traces$),jr(o=>this.updateScale(o)),jr(o=>this.createLabels(o)),jr(o=>this.createGrid(o)),jr(o=>this.createTraces(o)),Zl(1)),this.drawn$=this.draw$.pipe(qt(()=>this.updateSequence()),qt(()=>this.updateGrid()),qt(()=>this.updateLabels()),qt(()=>this.updateTraces()),jr(()=>console.log("Re-drawn!")))}updateScale(n){const r=this.initializeService.scale.y,i=["sequence",...n.map(({id:s})=>String(s))],o=i.reduce((s,a,c)=>{if(0===c&&"sequence"===a){const d=this.initializeService.settings["margin-top"];return[d,d+this.initializeService.settings["line-height"]]}const u=this.featuresService.getTrace(+a);if(u){const l=s.at(-1);let d=u["line-height"]||this.initializeService.settings["line-height"];return"dodge"===u.position&&(d=u.values.reduce((f,p)=>f+(p["line-height"]||this.initializeService.settings["line-height"]),0)),[...s,l+d]}throw new Error("Trace not found")},[]);r.domain(i).range(o)}createSequence(n){const i=this.initializeService.draw.selectAll("g.sequence").data([n]).join("g").attr("class","sequence");this.residues=i.selectAll("g.residue").data(n).join("g").attr("id",(o,s)=>`residue-${s+1}`).attr("class","residue"),this.residues.append("rect").attr("class","color").attr("fill",o=>(o=>i0e[o]||i0e.X)(o)).attr("fill-opacity",.1),this.residues.append("text").attr("class","name").text(o=>""+o)}updateSequence(){const n=this.initializeService.settings["line-height"],r=this.initializeService.margin,{x:i,y:o}=this.initializeService.scale,s=i(1)-i(0);this.residues.select("rect.color").attr("x",(a,c)=>i(c+.5)).attr("y",r.top).attr("width",()=>s).attr("height","100%"),this.residues.select("text.name").attr("x",(a,c)=>i(c+1)).attr("y",o("sequence")+n/2).attr("width",()=>s).attr("height",n).attr("dominant-baseline","central").style("text-anchor","middle")}createLabels(n){const r=this.initializeService.settings,{left:i}=this.initializeService.margin,o=this.initializeService.svg.selectAll("g.labels").data([n],Qm).join("g").attr("class","labels");this.labels=o.selectAll("g.label").data([{id:"sequence",label:"Sequence",visible:!0},...n],tG).join("g").attr("id",s=>"label-"+String(s.id)).attr("class","label"),this.labels.selectAll("rect").data(s=>[s],Qm).join("rect").attr("height",s=>s["line-height"]||r["line-height"]).attr("width",()=>i).attr("fill","none").attr("stroke","#D3D3D380"),this.labels.selectAll("text").data(s=>[s],Qm).join("text").text(s=>(s.label||"")+" "+(s.visible?"(visible)":"(hidden)")).attr("height",s=>s["line-height"]||r["line-height"]).attr("width",()=>i).filter(s=>"sequence"!==s.id).on("click",(s,a)=>{a.visible=!1===a.visible;const c=Array.from(this.featuresService.traces.values()),u=new Array;for(const l of c){const{visible:d}={visible:!0,...l};if(!0!==d){const f=this.featuresService.getBranch(l).slice(1);u.push(...f)}}this.traces$.next(c.filter(l=>!u.includes(l)))})}updateLabels(){const n=this.initializeService.scale.y,r=this.initializeService.settings;this.labels.select("rect").attr("y",i=>n(String(i.id))).attr("x",0),this.labels.select("text").attr("y",i=>n(String(i.id))+(i["line-height"]||r["line-height"])/2).attr("x",0).attr("dominant-baseline","central")}createGrid(n){const r=this.initializeService.svg.selectAll("g.grid").data([n],Qm).join("g").attr("class","grid");this.grid=r.selectAll("rect.grid-line").data(n,tG).join("rect").attr("id",i=>"grid-"+String(i.id)).attr("class","grid-line")}updateGrid(){const n=this.initializeService.scale.y,r=this.initializeService.width,i=this.initializeService.margin,o=this.initializeService.settings;this.grid.attr("x",i.left).attr("y",s=>{const c=s.values.sort((f,p)=>"continuous"===f.type?-1:"continuous"===p.type?1:0)[0],u=n(String(s.id)),l=c["line-height"]||s["line-height"]||o["line-height"];return"continuous"!==c.type?u+l/2-.5:u+l/2-(c["content-size"]||s["content-size"]||o["content-size"])/2}).attr("width",r-i.left-i.right).attr("height",s=>{const a=s.values[0];return"continuous"===a.type?a["content-size"]||s["content-size"]||o["content-size"]:1}).attr("fill",this.initializeService.settings["grid-color"])}createTraces(n){this.traces=this.initializeService.draw.selectAll("g.trace").data(n,tG).join("g").attr("id",r=>"trace-"+String(r.id)).attr("class","trace"),this.traces.each(function(r){kl(this).selectAll("g.feature").data(r.values,Qm).join("g").attr("class","feature").each(function(o){const s=kl(this);"continuous"===o.type?s.selectAll("path.continuous").data([o],Qm).join("path").attr("class","continuous").attr("fill","pink").attr("fill-opacity",0).attr("stroke","#ff1493").attr("stroke-opacity",1).attr("stroke-width",2):s.selectAll("rect.locus").data(o.values,Qm).join("rect").attr("class","locus").attr("fill","steelblue").attr("fill-opacity",.3).attr("stroke","steelblue").attr("stroke-opacity",1).attr("stroke-width",1.5)})})}updateTraces(){const n=this.initializeService.scale,r=this.initializeService.settings;this.traces.each(function(i){const o=i.values;kl(this).selectAll("g.feature").each(function(a,c){const u=kl(this),l=o[c],d=n.y(String(i.id)),f=l["line-height"]||i["line-height"]||r["line-height"],p=l["content-size"]||i["content-size"]||r["content-size"];if("continuous"===l.type){const m=l.values,h=void 0!==l.min?l.min:Math.min(...l.values),g=void 0!==l.max?l.max:Math.max(...l.values),y=m.map((_,S)=>[S+1,1-(_-h)/(g-h)]),b=u.select("path.continuous"),x=function oxt(e,t){var n=K1(!0),r=null,i=Q_t,o=null,s=function nxt(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new NP(t)}(a);function a(c){var u,d,p,l=(c=function Z_t(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}(c)).length,f=!1;for(null==r&&(o=i(p=s())),u=0;u<=l;++u)!(un.x(_)).y(([_,S])=>d+f/2-p/2+p*S);b.attr("d",x(y))}else{const m=n.x(1)-n.x(0);u.selectAll("rect.locus").data(l.values,Qm).attr("x",h=>n.x(h.start-.5)).attr("y",d+f/2-p/2).attr("height",p).attr("width",h=>{const{start:g,end:y}={end:h.start+1,...h};return m*(y-g)})}})})}static#e=this.\u0275fac=function(r){return new(r||e)(Zt(XC),Zt(J7),Zt(eG))};static#t=this.\u0275prov=Gt({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();const Cxt=["root"];let wxt=(()=>{class e{set settings(n){this.initService.settings=n}set features(n){this.featuresService.hierarchy=n;const r=Array.from(this.featuresService.traces.entries()).map(([i,o])=>Object.assign(o,{id:i,visible:!0}));this.traces$.next(r)}constructor(n,r,i,o,s){this.featuresService=n,this.initService=r,this.resizeService=i,this.zoomService=o,this.drawService=s,this.traces$=this.drawService.traces$,this.sequence$=this.drawService.sequence$,this.update$=this.initService.initialized$.pipe(To(()=>this.drawService.draw$),To(()=>this.resizeService.resized$),jr(()=>{const{margin:a,width:c}=this.resizeService,u=this.sequence.length+1;this.initService.zoom.extent([[a.left,0],[c-a.right,1/0]]).scaleExtent([1,u/5]).translateExtent([[a.left,0],[c-a.right,0]]).on("zoom",l=>{this.onFeaturesZoom(l)})}),To(()=>this.zoomService.zoomed$),To(()=>this.drawService.drawn$)),this._update=this.update$.subscribe()}ngOnChanges(n){n&&n.sequence&&this.sequence$.next(this.sequence)}ngAfterViewInit(){this.initService.initialize$.next(this._root)}ngOnDestroy(){this._update.unsubscribe()}onResize(n){this.resizeService.resize$.next(n)}onFeaturesZoom(n){this.zoomService.zoom$.next(n)}static#e=this.\u0275fac=function(r){return new(r||e)(cn(J7),cn(XC),cn(eG),cn(r0e),cn(o0e))};static#t=this.\u0275cmp=Mu({type:e,selectors:[["ngx-features-viewer"]],viewQuery:function(r,i){if(1&r&&uN(Cxt,5),2&r){let o;EA(o=PA())&&(i._root=o.first)}},hostBindings:function(r,i){1&r&&px("resize",function(s){return i.onResize(s)},0,Hj)},inputs:{settings:"settings",features:"features",sequence:"sequence"},standalone:!0,features:[mN([XC,J7,eG,o0e,r0e]),wh,Nu],decls:2,vars:0,consts:[["root",""],[2,"position","relative","display","block","width","100%","height","100%"]],template:function(r,i){1&r&&gi(0,"div",1,0)},styles:['@charset "UTF-8";.labels #label-sequence .parent div{cursor:default}.labels #label-sequence .parent div i{display:none}.labels .label .children-0>i{visibility:hidden}.labels .label i:before{transition:transform .4s}.labels .label.active i:before{transform:roate(0deg)}.labels .label:not(.active) i:before{transform:rotate(-90deg)}.labels .label div{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;align-items:center;box-sizing:border-box;height:100%;width:100%;cursor:pointer}.labels .label div span{text-wrap:wrap;line-break:anywhere;flex-shrink:1;flex-grow:1}.labels .label div i{flex-shrink:0;flex-grow:0}.labels div.depth-0{width:100%;padding:0 .25rem 0 .75rem}.labels div.depth-1{width:100%;padding:0 .25rem 0 1.5rem}.labels div.depth-2{width:100%;padding:0 .25rem 0 2.25rem}.labels div.depth-3{width:100%;padding:0 .25rem 0 3rem}.labels div.depth-4{width:100%;padding:0 .25rem 0 3.75rem}.labels div.depth-5{width:100%;padding:0 .25rem 0 4.5rem}/*!\n * Bootstrap Icons v1.11.3 (https://icons.getbootstrap.com/)\n * Copyright 2019-2024 The Bootstrap Authors\n * Licensed under MIT (https://github.com/twbs/icons/blob/main/LICENSE)\n */@font-face{font-display:block;font-family:bootstrap-icons;src:url(bootstrap-icons.bfa90bda92a84a6a.woff2) format("woff2"),url(bootstrap-icons.70a9dee9e5ab72aa.woff) format("woff")}.bi:before,[class^=bi-]:before,[class*=" bi-"]:before{display:inline-block;font-family:bootstrap-icons!important;font-style:normal;font-weight:400!important;font-variant:normal;text-transform:none;line-height:1;vertical-align:-.125em;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.bi-123:before{content:"\\f67f"}.bi-alarm-fill:before{content:"\\f101"}.bi-alarm:before{content:"\\f102"}.bi-align-bottom:before{content:"\\f103"}.bi-align-center:before{content:"\\f104"}.bi-align-end:before{content:"\\f105"}.bi-align-middle:before{content:"\\f106"}.bi-align-start:before{content:"\\f107"}.bi-align-top:before{content:"\\f108"}.bi-alt:before{content:"\\f109"}.bi-app-indicator:before{content:"\\f10a"}.bi-app:before{content:"\\f10b"}.bi-archive-fill:before{content:"\\f10c"}.bi-archive:before{content:"\\f10d"}.bi-arrow-90deg-down:before{content:"\\f10e"}.bi-arrow-90deg-left:before{content:"\\f10f"}.bi-arrow-90deg-right:before{content:"\\f110"}.bi-arrow-90deg-up:before{content:"\\f111"}.bi-arrow-bar-down:before{content:"\\f112"}.bi-arrow-bar-left:before{content:"\\f113"}.bi-arrow-bar-right:before{content:"\\f114"}.bi-arrow-bar-up:before{content:"\\f115"}.bi-arrow-clockwise:before{content:"\\f116"}.bi-arrow-counterclockwise:before{content:"\\f117"}.bi-arrow-down-circle-fill:before{content:"\\f118"}.bi-arrow-down-circle:before{content:"\\f119"}.bi-arrow-down-left-circle-fill:before{content:"\\f11a"}.bi-arrow-down-left-circle:before{content:"\\f11b"}.bi-arrow-down-left-square-fill:before{content:"\\f11c"}.bi-arrow-down-left-square:before{content:"\\f11d"}.bi-arrow-down-left:before{content:"\\f11e"}.bi-arrow-down-right-circle-fill:before{content:"\\f11f"}.bi-arrow-down-right-circle:before{content:"\\f120"}.bi-arrow-down-right-square-fill:before{content:"\\f121"}.bi-arrow-down-right-square:before{content:"\\f122"}.bi-arrow-down-right:before{content:"\\f123"}.bi-arrow-down-short:before{content:"\\f124"}.bi-arrow-down-square-fill:before{content:"\\f125"}.bi-arrow-down-square:before{content:"\\f126"}.bi-arrow-down-up:before{content:"\\f127"}.bi-arrow-down:before{content:"\\f128"}.bi-arrow-left-circle-fill:before{content:"\\f129"}.bi-arrow-left-circle:before{content:"\\f12a"}.bi-arrow-left-right:before{content:"\\f12b"}.bi-arrow-left-short:before{content:"\\f12c"}.bi-arrow-left-square-fill:before{content:"\\f12d"}.bi-arrow-left-square:before{content:"\\f12e"}.bi-arrow-left:before{content:"\\f12f"}.bi-arrow-repeat:before{content:"\\f130"}.bi-arrow-return-left:before{content:"\\f131"}.bi-arrow-return-right:before{content:"\\f132"}.bi-arrow-right-circle-fill:before{content:"\\f133"}.bi-arrow-right-circle:before{content:"\\f134"}.bi-arrow-right-short:before{content:"\\f135"}.bi-arrow-right-square-fill:before{content:"\\f136"}.bi-arrow-right-square:before{content:"\\f137"}.bi-arrow-right:before{content:"\\f138"}.bi-arrow-up-circle-fill:before{content:"\\f139"}.bi-arrow-up-circle:before{content:"\\f13a"}.bi-arrow-up-left-circle-fill:before{content:"\\f13b"}.bi-arrow-up-left-circle:before{content:"\\f13c"}.bi-arrow-up-left-square-fill:before{content:"\\f13d"}.bi-arrow-up-left-square:before{content:"\\f13e"}.bi-arrow-up-left:before{content:"\\f13f"}.bi-arrow-up-right-circle-fill:before{content:"\\f140"}.bi-arrow-up-right-circle:before{content:"\\f141"}.bi-arrow-up-right-square-fill:before{content:"\\f142"}.bi-arrow-up-right-square:before{content:"\\f143"}.bi-arrow-up-right:before{content:"\\f144"}.bi-arrow-up-short:before{content:"\\f145"}.bi-arrow-up-square-fill:before{content:"\\f146"}.bi-arrow-up-square:before{content:"\\f147"}.bi-arrow-up:before{content:"\\f148"}.bi-arrows-angle-contract:before{content:"\\f149"}.bi-arrows-angle-expand:before{content:"\\f14a"}.bi-arrows-collapse:before{content:"\\f14b"}.bi-arrows-expand:before{content:"\\f14c"}.bi-arrows-fullscreen:before{content:"\\f14d"}.bi-arrows-move:before{content:"\\f14e"}.bi-aspect-ratio-fill:before{content:"\\f14f"}.bi-aspect-ratio:before{content:"\\f150"}.bi-asterisk:before{content:"\\f151"}.bi-at:before{content:"\\f152"}.bi-award-fill:before{content:"\\f153"}.bi-award:before{content:"\\f154"}.bi-back:before{content:"\\f155"}.bi-backspace-fill:before{content:"\\f156"}.bi-backspace-reverse-fill:before{content:"\\f157"}.bi-backspace-reverse:before{content:"\\f158"}.bi-backspace:before{content:"\\f159"}.bi-badge-3d-fill:before{content:"\\f15a"}.bi-badge-3d:before{content:"\\f15b"}.bi-badge-4k-fill:before{content:"\\f15c"}.bi-badge-4k:before{content:"\\f15d"}.bi-badge-8k-fill:before{content:"\\f15e"}.bi-badge-8k:before{content:"\\f15f"}.bi-badge-ad-fill:before{content:"\\f160"}.bi-badge-ad:before{content:"\\f161"}.bi-badge-ar-fill:before{content:"\\f162"}.bi-badge-ar:before{content:"\\f163"}.bi-badge-cc-fill:before{content:"\\f164"}.bi-badge-cc:before{content:"\\f165"}.bi-badge-hd-fill:before{content:"\\f166"}.bi-badge-hd:before{content:"\\f167"}.bi-badge-tm-fill:before{content:"\\f168"}.bi-badge-tm:before{content:"\\f169"}.bi-badge-vo-fill:before{content:"\\f16a"}.bi-badge-vo:before{content:"\\f16b"}.bi-badge-vr-fill:before{content:"\\f16c"}.bi-badge-vr:before{content:"\\f16d"}.bi-badge-wc-fill:before{content:"\\f16e"}.bi-badge-wc:before{content:"\\f16f"}.bi-bag-check-fill:before{content:"\\f170"}.bi-bag-check:before{content:"\\f171"}.bi-bag-dash-fill:before{content:"\\f172"}.bi-bag-dash:before{content:"\\f173"}.bi-bag-fill:before{content:"\\f174"}.bi-bag-plus-fill:before{content:"\\f175"}.bi-bag-plus:before{content:"\\f176"}.bi-bag-x-fill:before{content:"\\f177"}.bi-bag-x:before{content:"\\f178"}.bi-bag:before{content:"\\f179"}.bi-bar-chart-fill:before{content:"\\f17a"}.bi-bar-chart-line-fill:before{content:"\\f17b"}.bi-bar-chart-line:before{content:"\\f17c"}.bi-bar-chart-steps:before{content:"\\f17d"}.bi-bar-chart:before{content:"\\f17e"}.bi-basket-fill:before{content:"\\f17f"}.bi-basket:before{content:"\\f180"}.bi-basket2-fill:before{content:"\\f181"}.bi-basket2:before{content:"\\f182"}.bi-basket3-fill:before{content:"\\f183"}.bi-basket3:before{content:"\\f184"}.bi-battery-charging:before{content:"\\f185"}.bi-battery-full:before{content:"\\f186"}.bi-battery-half:before{content:"\\f187"}.bi-battery:before{content:"\\f188"}.bi-bell-fill:before{content:"\\f189"}.bi-bell:before{content:"\\f18a"}.bi-bezier:before{content:"\\f18b"}.bi-bezier2:before{content:"\\f18c"}.bi-bicycle:before{content:"\\f18d"}.bi-binoculars-fill:before{content:"\\f18e"}.bi-binoculars:before{content:"\\f18f"}.bi-blockquote-left:before{content:"\\f190"}.bi-blockquote-right:before{content:"\\f191"}.bi-book-fill:before{content:"\\f192"}.bi-book-half:before{content:"\\f193"}.bi-book:before{content:"\\f194"}.bi-bookmark-check-fill:before{content:"\\f195"}.bi-bookmark-check:before{content:"\\f196"}.bi-bookmark-dash-fill:before{content:"\\f197"}.bi-bookmark-dash:before{content:"\\f198"}.bi-bookmark-fill:before{content:"\\f199"}.bi-bookmark-heart-fill:before{content:"\\f19a"}.bi-bookmark-heart:before{content:"\\f19b"}.bi-bookmark-plus-fill:before{content:"\\f19c"}.bi-bookmark-plus:before{content:"\\f19d"}.bi-bookmark-star-fill:before{content:"\\f19e"}.bi-bookmark-star:before{content:"\\f19f"}.bi-bookmark-x-fill:before{content:"\\f1a0"}.bi-bookmark-x:before{content:"\\f1a1"}.bi-bookmark:before{content:"\\f1a2"}.bi-bookmarks-fill:before{content:"\\f1a3"}.bi-bookmarks:before{content:"\\f1a4"}.bi-bookshelf:before{content:"\\f1a5"}.bi-bootstrap-fill:before{content:"\\f1a6"}.bi-bootstrap-reboot:before{content:"\\f1a7"}.bi-bootstrap:before{content:"\\f1a8"}.bi-border-all:before{content:"\\f1a9"}.bi-border-bottom:before{content:"\\f1aa"}.bi-border-center:before{content:"\\f1ab"}.bi-border-inner:before{content:"\\f1ac"}.bi-border-left:before{content:"\\f1ad"}.bi-border-middle:before{content:"\\f1ae"}.bi-border-outer:before{content:"\\f1af"}.bi-border-right:before{content:"\\f1b0"}.bi-border-style:before{content:"\\f1b1"}.bi-border-top:before{content:"\\f1b2"}.bi-border-width:before{content:"\\f1b3"}.bi-border:before{content:"\\f1b4"}.bi-bounding-box-circles:before{content:"\\f1b5"}.bi-bounding-box:before{content:"\\f1b6"}.bi-box-arrow-down-left:before{content:"\\f1b7"}.bi-box-arrow-down-right:before{content:"\\f1b8"}.bi-box-arrow-down:before{content:"\\f1b9"}.bi-box-arrow-in-down-left:before{content:"\\f1ba"}.bi-box-arrow-in-down-right:before{content:"\\f1bb"}.bi-box-arrow-in-down:before{content:"\\f1bc"}.bi-box-arrow-in-left:before{content:"\\f1bd"}.bi-box-arrow-in-right:before{content:"\\f1be"}.bi-box-arrow-in-up-left:before{content:"\\f1bf"}.bi-box-arrow-in-up-right:before{content:"\\f1c0"}.bi-box-arrow-in-up:before{content:"\\f1c1"}.bi-box-arrow-left:before{content:"\\f1c2"}.bi-box-arrow-right:before{content:"\\f1c3"}.bi-box-arrow-up-left:before{content:"\\f1c4"}.bi-box-arrow-up-right:before{content:"\\f1c5"}.bi-box-arrow-up:before{content:"\\f1c6"}.bi-box-seam:before{content:"\\f1c7"}.bi-box:before{content:"\\f1c8"}.bi-braces:before{content:"\\f1c9"}.bi-bricks:before{content:"\\f1ca"}.bi-briefcase-fill:before{content:"\\f1cb"}.bi-briefcase:before{content:"\\f1cc"}.bi-brightness-alt-high-fill:before{content:"\\f1cd"}.bi-brightness-alt-high:before{content:"\\f1ce"}.bi-brightness-alt-low-fill:before{content:"\\f1cf"}.bi-brightness-alt-low:before{content:"\\f1d0"}.bi-brightness-high-fill:before{content:"\\f1d1"}.bi-brightness-high:before{content:"\\f1d2"}.bi-brightness-low-fill:before{content:"\\f1d3"}.bi-brightness-low:before{content:"\\f1d4"}.bi-broadcast-pin:before{content:"\\f1d5"}.bi-broadcast:before{content:"\\f1d6"}.bi-brush-fill:before{content:"\\f1d7"}.bi-brush:before{content:"\\f1d8"}.bi-bucket-fill:before{content:"\\f1d9"}.bi-bucket:before{content:"\\f1da"}.bi-bug-fill:before{content:"\\f1db"}.bi-bug:before{content:"\\f1dc"}.bi-building:before{content:"\\f1dd"}.bi-bullseye:before{content:"\\f1de"}.bi-calculator-fill:before{content:"\\f1df"}.bi-calculator:before{content:"\\f1e0"}.bi-calendar-check-fill:before{content:"\\f1e1"}.bi-calendar-check:before{content:"\\f1e2"}.bi-calendar-date-fill:before{content:"\\f1e3"}.bi-calendar-date:before{content:"\\f1e4"}.bi-calendar-day-fill:before{content:"\\f1e5"}.bi-calendar-day:before{content:"\\f1e6"}.bi-calendar-event-fill:before{content:"\\f1e7"}.bi-calendar-event:before{content:"\\f1e8"}.bi-calendar-fill:before{content:"\\f1e9"}.bi-calendar-minus-fill:before{content:"\\f1ea"}.bi-calendar-minus:before{content:"\\f1eb"}.bi-calendar-month-fill:before{content:"\\f1ec"}.bi-calendar-month:before{content:"\\f1ed"}.bi-calendar-plus-fill:before{content:"\\f1ee"}.bi-calendar-plus:before{content:"\\f1ef"}.bi-calendar-range-fill:before{content:"\\f1f0"}.bi-calendar-range:before{content:"\\f1f1"}.bi-calendar-week-fill:before{content:"\\f1f2"}.bi-calendar-week:before{content:"\\f1f3"}.bi-calendar-x-fill:before{content:"\\f1f4"}.bi-calendar-x:before{content:"\\f1f5"}.bi-calendar:before{content:"\\f1f6"}.bi-calendar2-check-fill:before{content:"\\f1f7"}.bi-calendar2-check:before{content:"\\f1f8"}.bi-calendar2-date-fill:before{content:"\\f1f9"}.bi-calendar2-date:before{content:"\\f1fa"}.bi-calendar2-day-fill:before{content:"\\f1fb"}.bi-calendar2-day:before{content:"\\f1fc"}.bi-calendar2-event-fill:before{content:"\\f1fd"}.bi-calendar2-event:before{content:"\\f1fe"}.bi-calendar2-fill:before{content:"\\f1ff"}.bi-calendar2-minus-fill:before{content:"\\f200"}.bi-calendar2-minus:before{content:"\\f201"}.bi-calendar2-month-fill:before{content:"\\f202"}.bi-calendar2-month:before{content:"\\f203"}.bi-calendar2-plus-fill:before{content:"\\f204"}.bi-calendar2-plus:before{content:"\\f205"}.bi-calendar2-range-fill:before{content:"\\f206"}.bi-calendar2-range:before{content:"\\f207"}.bi-calendar2-week-fill:before{content:"\\f208"}.bi-calendar2-week:before{content:"\\f209"}.bi-calendar2-x-fill:before{content:"\\f20a"}.bi-calendar2-x:before{content:"\\f20b"}.bi-calendar2:before{content:"\\f20c"}.bi-calendar3-event-fill:before{content:"\\f20d"}.bi-calendar3-event:before{content:"\\f20e"}.bi-calendar3-fill:before{content:"\\f20f"}.bi-calendar3-range-fill:before{content:"\\f210"}.bi-calendar3-range:before{content:"\\f211"}.bi-calendar3-week-fill:before{content:"\\f212"}.bi-calendar3-week:before{content:"\\f213"}.bi-calendar3:before{content:"\\f214"}.bi-calendar4-event:before{content:"\\f215"}.bi-calendar4-range:before{content:"\\f216"}.bi-calendar4-week:before{content:"\\f217"}.bi-calendar4:before{content:"\\f218"}.bi-camera-fill:before{content:"\\f219"}.bi-camera-reels-fill:before{content:"\\f21a"}.bi-camera-reels:before{content:"\\f21b"}.bi-camera-video-fill:before{content:"\\f21c"}.bi-camera-video-off-fill:before{content:"\\f21d"}.bi-camera-video-off:before{content:"\\f21e"}.bi-camera-video:before{content:"\\f21f"}.bi-camera:before{content:"\\f220"}.bi-camera2:before{content:"\\f221"}.bi-capslock-fill:before{content:"\\f222"}.bi-capslock:before{content:"\\f223"}.bi-card-checklist:before{content:"\\f224"}.bi-card-heading:before{content:"\\f225"}.bi-card-image:before{content:"\\f226"}.bi-card-list:before{content:"\\f227"}.bi-card-text:before{content:"\\f228"}.bi-caret-down-fill:before{content:"\\f229"}.bi-caret-down-square-fill:before{content:"\\f22a"}.bi-caret-down-square:before{content:"\\f22b"}.bi-caret-down:before{content:"\\f22c"}.bi-caret-left-fill:before{content:"\\f22d"}.bi-caret-left-square-fill:before{content:"\\f22e"}.bi-caret-left-square:before{content:"\\f22f"}.bi-caret-left:before{content:"\\f230"}.bi-caret-right-fill:before{content:"\\f231"}.bi-caret-right-square-fill:before{content:"\\f232"}.bi-caret-right-square:before{content:"\\f233"}.bi-caret-right:before{content:"\\f234"}.bi-caret-up-fill:before{content:"\\f235"}.bi-caret-up-square-fill:before{content:"\\f236"}.bi-caret-up-square:before{content:"\\f237"}.bi-caret-up:before{content:"\\f238"}.bi-cart-check-fill:before{content:"\\f239"}.bi-cart-check:before{content:"\\f23a"}.bi-cart-dash-fill:before{content:"\\f23b"}.bi-cart-dash:before{content:"\\f23c"}.bi-cart-fill:before{content:"\\f23d"}.bi-cart-plus-fill:before{content:"\\f23e"}.bi-cart-plus:before{content:"\\f23f"}.bi-cart-x-fill:before{content:"\\f240"}.bi-cart-x:before{content:"\\f241"}.bi-cart:before{content:"\\f242"}.bi-cart2:before{content:"\\f243"}.bi-cart3:before{content:"\\f244"}.bi-cart4:before{content:"\\f245"}.bi-cash-stack:before{content:"\\f246"}.bi-cash:before{content:"\\f247"}.bi-cast:before{content:"\\f248"}.bi-chat-dots-fill:before{content:"\\f249"}.bi-chat-dots:before{content:"\\f24a"}.bi-chat-fill:before{content:"\\f24b"}.bi-chat-left-dots-fill:before{content:"\\f24c"}.bi-chat-left-dots:before{content:"\\f24d"}.bi-chat-left-fill:before{content:"\\f24e"}.bi-chat-left-quote-fill:before{content:"\\f24f"}.bi-chat-left-quote:before{content:"\\f250"}.bi-chat-left-text-fill:before{content:"\\f251"}.bi-chat-left-text:before{content:"\\f252"}.bi-chat-left:before{content:"\\f253"}.bi-chat-quote-fill:before{content:"\\f254"}.bi-chat-quote:before{content:"\\f255"}.bi-chat-right-dots-fill:before{content:"\\f256"}.bi-chat-right-dots:before{content:"\\f257"}.bi-chat-right-fill:before{content:"\\f258"}.bi-chat-right-quote-fill:before{content:"\\f259"}.bi-chat-right-quote:before{content:"\\f25a"}.bi-chat-right-text-fill:before{content:"\\f25b"}.bi-chat-right-text:before{content:"\\f25c"}.bi-chat-right:before{content:"\\f25d"}.bi-chat-square-dots-fill:before{content:"\\f25e"}.bi-chat-square-dots:before{content:"\\f25f"}.bi-chat-square-fill:before{content:"\\f260"}.bi-chat-square-quote-fill:before{content:"\\f261"}.bi-chat-square-quote:before{content:"\\f262"}.bi-chat-square-text-fill:before{content:"\\f263"}.bi-chat-square-text:before{content:"\\f264"}.bi-chat-square:before{content:"\\f265"}.bi-chat-text-fill:before{content:"\\f266"}.bi-chat-text:before{content:"\\f267"}.bi-chat:before{content:"\\f268"}.bi-check-all:before{content:"\\f269"}.bi-check-circle-fill:before{content:"\\f26a"}.bi-check-circle:before{content:"\\f26b"}.bi-check-square-fill:before{content:"\\f26c"}.bi-check-square:before{content:"\\f26d"}.bi-check:before{content:"\\f26e"}.bi-check2-all:before{content:"\\f26f"}.bi-check2-circle:before{content:"\\f270"}.bi-check2-square:before{content:"\\f271"}.bi-check2:before{content:"\\f272"}.bi-chevron-bar-contract:before{content:"\\f273"}.bi-chevron-bar-down:before{content:"\\f274"}.bi-chevron-bar-expand:before{content:"\\f275"}.bi-chevron-bar-left:before{content:"\\f276"}.bi-chevron-bar-right:before{content:"\\f277"}.bi-chevron-bar-up:before{content:"\\f278"}.bi-chevron-compact-down:before{content:"\\f279"}.bi-chevron-compact-left:before{content:"\\f27a"}.bi-chevron-compact-right:before{content:"\\f27b"}.bi-chevron-compact-up:before{content:"\\f27c"}.bi-chevron-contract:before{content:"\\f27d"}.bi-chevron-double-down:before{content:"\\f27e"}.bi-chevron-double-left:before{content:"\\f27f"}.bi-chevron-double-right:before{content:"\\f280"}.bi-chevron-double-up:before{content:"\\f281"}.bi-chevron-down:before{content:"\\f282"}.bi-chevron-expand:before{content:"\\f283"}.bi-chevron-left:before{content:"\\f284"}.bi-chevron-right:before{content:"\\f285"}.bi-chevron-up:before{content:"\\f286"}.bi-circle-fill:before{content:"\\f287"}.bi-circle-half:before{content:"\\f288"}.bi-circle-square:before{content:"\\f289"}.bi-circle:before{content:"\\f28a"}.bi-clipboard-check:before{content:"\\f28b"}.bi-clipboard-data:before{content:"\\f28c"}.bi-clipboard-minus:before{content:"\\f28d"}.bi-clipboard-plus:before{content:"\\f28e"}.bi-clipboard-x:before{content:"\\f28f"}.bi-clipboard:before{content:"\\f290"}.bi-clock-fill:before{content:"\\f291"}.bi-clock-history:before{content:"\\f292"}.bi-clock:before{content:"\\f293"}.bi-cloud-arrow-down-fill:before{content:"\\f294"}.bi-cloud-arrow-down:before{content:"\\f295"}.bi-cloud-arrow-up-fill:before{content:"\\f296"}.bi-cloud-arrow-up:before{content:"\\f297"}.bi-cloud-check-fill:before{content:"\\f298"}.bi-cloud-check:before{content:"\\f299"}.bi-cloud-download-fill:before{content:"\\f29a"}.bi-cloud-download:before{content:"\\f29b"}.bi-cloud-drizzle-fill:before{content:"\\f29c"}.bi-cloud-drizzle:before{content:"\\f29d"}.bi-cloud-fill:before{content:"\\f29e"}.bi-cloud-fog-fill:before{content:"\\f29f"}.bi-cloud-fog:before{content:"\\f2a0"}.bi-cloud-fog2-fill:before{content:"\\f2a1"}.bi-cloud-fog2:before{content:"\\f2a2"}.bi-cloud-hail-fill:before{content:"\\f2a3"}.bi-cloud-hail:before{content:"\\f2a4"}.bi-cloud-haze-fill:before{content:"\\f2a6"}.bi-cloud-haze:before{content:"\\f2a7"}.bi-cloud-haze2-fill:before{content:"\\f2a8"}.bi-cloud-lightning-fill:before{content:"\\f2a9"}.bi-cloud-lightning-rain-fill:before{content:"\\f2aa"}.bi-cloud-lightning-rain:before{content:"\\f2ab"}.bi-cloud-lightning:before{content:"\\f2ac"}.bi-cloud-minus-fill:before{content:"\\f2ad"}.bi-cloud-minus:before{content:"\\f2ae"}.bi-cloud-moon-fill:before{content:"\\f2af"}.bi-cloud-moon:before{content:"\\f2b0"}.bi-cloud-plus-fill:before{content:"\\f2b1"}.bi-cloud-plus:before{content:"\\f2b2"}.bi-cloud-rain-fill:before{content:"\\f2b3"}.bi-cloud-rain-heavy-fill:before{content:"\\f2b4"}.bi-cloud-rain-heavy:before{content:"\\f2b5"}.bi-cloud-rain:before{content:"\\f2b6"}.bi-cloud-slash-fill:before{content:"\\f2b7"}.bi-cloud-slash:before{content:"\\f2b8"}.bi-cloud-sleet-fill:before{content:"\\f2b9"}.bi-cloud-sleet:before{content:"\\f2ba"}.bi-cloud-snow-fill:before{content:"\\f2bb"}.bi-cloud-snow:before{content:"\\f2bc"}.bi-cloud-sun-fill:before{content:"\\f2bd"}.bi-cloud-sun:before{content:"\\f2be"}.bi-cloud-upload-fill:before{content:"\\f2bf"}.bi-cloud-upload:before{content:"\\f2c0"}.bi-cloud:before{content:"\\f2c1"}.bi-clouds-fill:before{content:"\\f2c2"}.bi-clouds:before{content:"\\f2c3"}.bi-cloudy-fill:before{content:"\\f2c4"}.bi-cloudy:before{content:"\\f2c5"}.bi-code-slash:before{content:"\\f2c6"}.bi-code-square:before{content:"\\f2c7"}.bi-code:before{content:"\\f2c8"}.bi-collection-fill:before{content:"\\f2c9"}.bi-collection-play-fill:before{content:"\\f2ca"}.bi-collection-play:before{content:"\\f2cb"}.bi-collection:before{content:"\\f2cc"}.bi-columns-gap:before{content:"\\f2cd"}.bi-columns:before{content:"\\f2ce"}.bi-command:before{content:"\\f2cf"}.bi-compass-fill:before{content:"\\f2d0"}.bi-compass:before{content:"\\f2d1"}.bi-cone-striped:before{content:"\\f2d2"}.bi-cone:before{content:"\\f2d3"}.bi-controller:before{content:"\\f2d4"}.bi-cpu-fill:before{content:"\\f2d5"}.bi-cpu:before{content:"\\f2d6"}.bi-credit-card-2-back-fill:before{content:"\\f2d7"}.bi-credit-card-2-back:before{content:"\\f2d8"}.bi-credit-card-2-front-fill:before{content:"\\f2d9"}.bi-credit-card-2-front:before{content:"\\f2da"}.bi-credit-card-fill:before{content:"\\f2db"}.bi-credit-card:before{content:"\\f2dc"}.bi-crop:before{content:"\\f2dd"}.bi-cup-fill:before{content:"\\f2de"}.bi-cup-straw:before{content:"\\f2df"}.bi-cup:before{content:"\\f2e0"}.bi-cursor-fill:before{content:"\\f2e1"}.bi-cursor-text:before{content:"\\f2e2"}.bi-cursor:before{content:"\\f2e3"}.bi-dash-circle-dotted:before{content:"\\f2e4"}.bi-dash-circle-fill:before{content:"\\f2e5"}.bi-dash-circle:before{content:"\\f2e6"}.bi-dash-square-dotted:before{content:"\\f2e7"}.bi-dash-square-fill:before{content:"\\f2e8"}.bi-dash-square:before{content:"\\f2e9"}.bi-dash:before{content:"\\f2ea"}.bi-diagram-2-fill:before{content:"\\f2eb"}.bi-diagram-2:before{content:"\\f2ec"}.bi-diagram-3-fill:before{content:"\\f2ed"}.bi-diagram-3:before{content:"\\f2ee"}.bi-diamond-fill:before{content:"\\f2ef"}.bi-diamond-half:before{content:"\\f2f0"}.bi-diamond:before{content:"\\f2f1"}.bi-dice-1-fill:before{content:"\\f2f2"}.bi-dice-1:before{content:"\\f2f3"}.bi-dice-2-fill:before{content:"\\f2f4"}.bi-dice-2:before{content:"\\f2f5"}.bi-dice-3-fill:before{content:"\\f2f6"}.bi-dice-3:before{content:"\\f2f7"}.bi-dice-4-fill:before{content:"\\f2f8"}.bi-dice-4:before{content:"\\f2f9"}.bi-dice-5-fill:before{content:"\\f2fa"}.bi-dice-5:before{content:"\\f2fb"}.bi-dice-6-fill:before{content:"\\f2fc"}.bi-dice-6:before{content:"\\f2fd"}.bi-disc-fill:before{content:"\\f2fe"}.bi-disc:before{content:"\\f2ff"}.bi-discord:before{content:"\\f300"}.bi-display-fill:before{content:"\\f301"}.bi-display:before{content:"\\f302"}.bi-distribute-horizontal:before{content:"\\f303"}.bi-distribute-vertical:before{content:"\\f304"}.bi-door-closed-fill:before{content:"\\f305"}.bi-door-closed:before{content:"\\f306"}.bi-door-open-fill:before{content:"\\f307"}.bi-door-open:before{content:"\\f308"}.bi-dot:before{content:"\\f309"}.bi-download:before{content:"\\f30a"}.bi-droplet-fill:before{content:"\\f30b"}.bi-droplet-half:before{content:"\\f30c"}.bi-droplet:before{content:"\\f30d"}.bi-earbuds:before{content:"\\f30e"}.bi-easel-fill:before{content:"\\f30f"}.bi-easel:before{content:"\\f310"}.bi-egg-fill:before{content:"\\f311"}.bi-egg-fried:before{content:"\\f312"}.bi-egg:before{content:"\\f313"}.bi-eject-fill:before{content:"\\f314"}.bi-eject:before{content:"\\f315"}.bi-emoji-angry-fill:before{content:"\\f316"}.bi-emoji-angry:before{content:"\\f317"}.bi-emoji-dizzy-fill:before{content:"\\f318"}.bi-emoji-dizzy:before{content:"\\f319"}.bi-emoji-expressionless-fill:before{content:"\\f31a"}.bi-emoji-expressionless:before{content:"\\f31b"}.bi-emoji-frown-fill:before{content:"\\f31c"}.bi-emoji-frown:before{content:"\\f31d"}.bi-emoji-heart-eyes-fill:before{content:"\\f31e"}.bi-emoji-heart-eyes:before{content:"\\f31f"}.bi-emoji-laughing-fill:before{content:"\\f320"}.bi-emoji-laughing:before{content:"\\f321"}.bi-emoji-neutral-fill:before{content:"\\f322"}.bi-emoji-neutral:before{content:"\\f323"}.bi-emoji-smile-fill:before{content:"\\f324"}.bi-emoji-smile-upside-down-fill:before{content:"\\f325"}.bi-emoji-smile-upside-down:before{content:"\\f326"}.bi-emoji-smile:before{content:"\\f327"}.bi-emoji-sunglasses-fill:before{content:"\\f328"}.bi-emoji-sunglasses:before{content:"\\f329"}.bi-emoji-wink-fill:before{content:"\\f32a"}.bi-emoji-wink:before{content:"\\f32b"}.bi-envelope-fill:before{content:"\\f32c"}.bi-envelope-open-fill:before{content:"\\f32d"}.bi-envelope-open:before{content:"\\f32e"}.bi-envelope:before{content:"\\f32f"}.bi-eraser-fill:before{content:"\\f330"}.bi-eraser:before{content:"\\f331"}.bi-exclamation-circle-fill:before{content:"\\f332"}.bi-exclamation-circle:before{content:"\\f333"}.bi-exclamation-diamond-fill:before{content:"\\f334"}.bi-exclamation-diamond:before{content:"\\f335"}.bi-exclamation-octagon-fill:before{content:"\\f336"}.bi-exclamation-octagon:before{content:"\\f337"}.bi-exclamation-square-fill:before{content:"\\f338"}.bi-exclamation-square:before{content:"\\f339"}.bi-exclamation-triangle-fill:before{content:"\\f33a"}.bi-exclamation-triangle:before{content:"\\f33b"}.bi-exclamation:before{content:"\\f33c"}.bi-exclude:before{content:"\\f33d"}.bi-eye-fill:before{content:"\\f33e"}.bi-eye-slash-fill:before{content:"\\f33f"}.bi-eye-slash:before{content:"\\f340"}.bi-eye:before{content:"\\f341"}.bi-eyedropper:before{content:"\\f342"}.bi-eyeglasses:before{content:"\\f343"}.bi-facebook:before{content:"\\f344"}.bi-file-arrow-down-fill:before{content:"\\f345"}.bi-file-arrow-down:before{content:"\\f346"}.bi-file-arrow-up-fill:before{content:"\\f347"}.bi-file-arrow-up:before{content:"\\f348"}.bi-file-bar-graph-fill:before{content:"\\f349"}.bi-file-bar-graph:before{content:"\\f34a"}.bi-file-binary-fill:before{content:"\\f34b"}.bi-file-binary:before{content:"\\f34c"}.bi-file-break-fill:before{content:"\\f34d"}.bi-file-break:before{content:"\\f34e"}.bi-file-check-fill:before{content:"\\f34f"}.bi-file-check:before{content:"\\f350"}.bi-file-code-fill:before{content:"\\f351"}.bi-file-code:before{content:"\\f352"}.bi-file-diff-fill:before{content:"\\f353"}.bi-file-diff:before{content:"\\f354"}.bi-file-earmark-arrow-down-fill:before{content:"\\f355"}.bi-file-earmark-arrow-down:before{content:"\\f356"}.bi-file-earmark-arrow-up-fill:before{content:"\\f357"}.bi-file-earmark-arrow-up:before{content:"\\f358"}.bi-file-earmark-bar-graph-fill:before{content:"\\f359"}.bi-file-earmark-bar-graph:before{content:"\\f35a"}.bi-file-earmark-binary-fill:before{content:"\\f35b"}.bi-file-earmark-binary:before{content:"\\f35c"}.bi-file-earmark-break-fill:before{content:"\\f35d"}.bi-file-earmark-break:before{content:"\\f35e"}.bi-file-earmark-check-fill:before{content:"\\f35f"}.bi-file-earmark-check:before{content:"\\f360"}.bi-file-earmark-code-fill:before{content:"\\f361"}.bi-file-earmark-code:before{content:"\\f362"}.bi-file-earmark-diff-fill:before{content:"\\f363"}.bi-file-earmark-diff:before{content:"\\f364"}.bi-file-earmark-easel-fill:before{content:"\\f365"}.bi-file-earmark-easel:before{content:"\\f366"}.bi-file-earmark-excel-fill:before{content:"\\f367"}.bi-file-earmark-excel:before{content:"\\f368"}.bi-file-earmark-fill:before{content:"\\f369"}.bi-file-earmark-font-fill:before{content:"\\f36a"}.bi-file-earmark-font:before{content:"\\f36b"}.bi-file-earmark-image-fill:before{content:"\\f36c"}.bi-file-earmark-image:before{content:"\\f36d"}.bi-file-earmark-lock-fill:before{content:"\\f36e"}.bi-file-earmark-lock:before{content:"\\f36f"}.bi-file-earmark-lock2-fill:before{content:"\\f370"}.bi-file-earmark-lock2:before{content:"\\f371"}.bi-file-earmark-medical-fill:before{content:"\\f372"}.bi-file-earmark-medical:before{content:"\\f373"}.bi-file-earmark-minus-fill:before{content:"\\f374"}.bi-file-earmark-minus:before{content:"\\f375"}.bi-file-earmark-music-fill:before{content:"\\f376"}.bi-file-earmark-music:before{content:"\\f377"}.bi-file-earmark-person-fill:before{content:"\\f378"}.bi-file-earmark-person:before{content:"\\f379"}.bi-file-earmark-play-fill:before{content:"\\f37a"}.bi-file-earmark-play:before{content:"\\f37b"}.bi-file-earmark-plus-fill:before{content:"\\f37c"}.bi-file-earmark-plus:before{content:"\\f37d"}.bi-file-earmark-post-fill:before{content:"\\f37e"}.bi-file-earmark-post:before{content:"\\f37f"}.bi-file-earmark-ppt-fill:before{content:"\\f380"}.bi-file-earmark-ppt:before{content:"\\f381"}.bi-file-earmark-richtext-fill:before{content:"\\f382"}.bi-file-earmark-richtext:before{content:"\\f383"}.bi-file-earmark-ruled-fill:before{content:"\\f384"}.bi-file-earmark-ruled:before{content:"\\f385"}.bi-file-earmark-slides-fill:before{content:"\\f386"}.bi-file-earmark-slides:before{content:"\\f387"}.bi-file-earmark-spreadsheet-fill:before{content:"\\f388"}.bi-file-earmark-spreadsheet:before{content:"\\f389"}.bi-file-earmark-text-fill:before{content:"\\f38a"}.bi-file-earmark-text:before{content:"\\f38b"}.bi-file-earmark-word-fill:before{content:"\\f38c"}.bi-file-earmark-word:before{content:"\\f38d"}.bi-file-earmark-x-fill:before{content:"\\f38e"}.bi-file-earmark-x:before{content:"\\f38f"}.bi-file-earmark-zip-fill:before{content:"\\f390"}.bi-file-earmark-zip:before{content:"\\f391"}.bi-file-earmark:before{content:"\\f392"}.bi-file-easel-fill:before{content:"\\f393"}.bi-file-easel:before{content:"\\f394"}.bi-file-excel-fill:before{content:"\\f395"}.bi-file-excel:before{content:"\\f396"}.bi-file-fill:before{content:"\\f397"}.bi-file-font-fill:before{content:"\\f398"}.bi-file-font:before{content:"\\f399"}.bi-file-image-fill:before{content:"\\f39a"}.bi-file-image:before{content:"\\f39b"}.bi-file-lock-fill:before{content:"\\f39c"}.bi-file-lock:before{content:"\\f39d"}.bi-file-lock2-fill:before{content:"\\f39e"}.bi-file-lock2:before{content:"\\f39f"}.bi-file-medical-fill:before{content:"\\f3a0"}.bi-file-medical:before{content:"\\f3a1"}.bi-file-minus-fill:before{content:"\\f3a2"}.bi-file-minus:before{content:"\\f3a3"}.bi-file-music-fill:before{content:"\\f3a4"}.bi-file-music:before{content:"\\f3a5"}.bi-file-person-fill:before{content:"\\f3a6"}.bi-file-person:before{content:"\\f3a7"}.bi-file-play-fill:before{content:"\\f3a8"}.bi-file-play:before{content:"\\f3a9"}.bi-file-plus-fill:before{content:"\\f3aa"}.bi-file-plus:before{content:"\\f3ab"}.bi-file-post-fill:before{content:"\\f3ac"}.bi-file-post:before{content:"\\f3ad"}.bi-file-ppt-fill:before{content:"\\f3ae"}.bi-file-ppt:before{content:"\\f3af"}.bi-file-richtext-fill:before{content:"\\f3b0"}.bi-file-richtext:before{content:"\\f3b1"}.bi-file-ruled-fill:before{content:"\\f3b2"}.bi-file-ruled:before{content:"\\f3b3"}.bi-file-slides-fill:before{content:"\\f3b4"}.bi-file-slides:before{content:"\\f3b5"}.bi-file-spreadsheet-fill:before{content:"\\f3b6"}.bi-file-spreadsheet:before{content:"\\f3b7"}.bi-file-text-fill:before{content:"\\f3b8"}.bi-file-text:before{content:"\\f3b9"}.bi-file-word-fill:before{content:"\\f3ba"}.bi-file-word:before{content:"\\f3bb"}.bi-file-x-fill:before{content:"\\f3bc"}.bi-file-x:before{content:"\\f3bd"}.bi-file-zip-fill:before{content:"\\f3be"}.bi-file-zip:before{content:"\\f3bf"}.bi-file:before{content:"\\f3c0"}.bi-files-alt:before{content:"\\f3c1"}.bi-files:before{content:"\\f3c2"}.bi-film:before{content:"\\f3c3"}.bi-filter-circle-fill:before{content:"\\f3c4"}.bi-filter-circle:before{content:"\\f3c5"}.bi-filter-left:before{content:"\\f3c6"}.bi-filter-right:before{content:"\\f3c7"}.bi-filter-square-fill:before{content:"\\f3c8"}.bi-filter-square:before{content:"\\f3c9"}.bi-filter:before{content:"\\f3ca"}.bi-flag-fill:before{content:"\\f3cb"}.bi-flag:before{content:"\\f3cc"}.bi-flower1:before{content:"\\f3cd"}.bi-flower2:before{content:"\\f3ce"}.bi-flower3:before{content:"\\f3cf"}.bi-folder-check:before{content:"\\f3d0"}.bi-folder-fill:before{content:"\\f3d1"}.bi-folder-minus:before{content:"\\f3d2"}.bi-folder-plus:before{content:"\\f3d3"}.bi-folder-symlink-fill:before{content:"\\f3d4"}.bi-folder-symlink:before{content:"\\f3d5"}.bi-folder-x:before{content:"\\f3d6"}.bi-folder:before{content:"\\f3d7"}.bi-folder2-open:before{content:"\\f3d8"}.bi-folder2:before{content:"\\f3d9"}.bi-fonts:before{content:"\\f3da"}.bi-forward-fill:before{content:"\\f3db"}.bi-forward:before{content:"\\f3dc"}.bi-front:before{content:"\\f3dd"}.bi-fullscreen-exit:before{content:"\\f3de"}.bi-fullscreen:before{content:"\\f3df"}.bi-funnel-fill:before{content:"\\f3e0"}.bi-funnel:before{content:"\\f3e1"}.bi-gear-fill:before{content:"\\f3e2"}.bi-gear-wide-connected:before{content:"\\f3e3"}.bi-gear-wide:before{content:"\\f3e4"}.bi-gear:before{content:"\\f3e5"}.bi-gem:before{content:"\\f3e6"}.bi-geo-alt-fill:before{content:"\\f3e7"}.bi-geo-alt:before{content:"\\f3e8"}.bi-geo-fill:before{content:"\\f3e9"}.bi-geo:before{content:"\\f3ea"}.bi-gift-fill:before{content:"\\f3eb"}.bi-gift:before{content:"\\f3ec"}.bi-github:before{content:"\\f3ed"}.bi-globe:before{content:"\\f3ee"}.bi-globe2:before{content:"\\f3ef"}.bi-google:before{content:"\\f3f0"}.bi-graph-down:before{content:"\\f3f1"}.bi-graph-up:before{content:"\\f3f2"}.bi-grid-1x2-fill:before{content:"\\f3f3"}.bi-grid-1x2:before{content:"\\f3f4"}.bi-grid-3x2-gap-fill:before{content:"\\f3f5"}.bi-grid-3x2-gap:before{content:"\\f3f6"}.bi-grid-3x2:before{content:"\\f3f7"}.bi-grid-3x3-gap-fill:before{content:"\\f3f8"}.bi-grid-3x3-gap:before{content:"\\f3f9"}.bi-grid-3x3:before{content:"\\f3fa"}.bi-grid-fill:before{content:"\\f3fb"}.bi-grid:before{content:"\\f3fc"}.bi-grip-horizontal:before{content:"\\f3fd"}.bi-grip-vertical:before{content:"\\f3fe"}.bi-hammer:before{content:"\\f3ff"}.bi-hand-index-fill:before{content:"\\f400"}.bi-hand-index-thumb-fill:before{content:"\\f401"}.bi-hand-index-thumb:before{content:"\\f402"}.bi-hand-index:before{content:"\\f403"}.bi-hand-thumbs-down-fill:before{content:"\\f404"}.bi-hand-thumbs-down:before{content:"\\f405"}.bi-hand-thumbs-up-fill:before{content:"\\f406"}.bi-hand-thumbs-up:before{content:"\\f407"}.bi-handbag-fill:before{content:"\\f408"}.bi-handbag:before{content:"\\f409"}.bi-hash:before{content:"\\f40a"}.bi-hdd-fill:before{content:"\\f40b"}.bi-hdd-network-fill:before{content:"\\f40c"}.bi-hdd-network:before{content:"\\f40d"}.bi-hdd-rack-fill:before{content:"\\f40e"}.bi-hdd-rack:before{content:"\\f40f"}.bi-hdd-stack-fill:before{content:"\\f410"}.bi-hdd-stack:before{content:"\\f411"}.bi-hdd:before{content:"\\f412"}.bi-headphones:before{content:"\\f413"}.bi-headset:before{content:"\\f414"}.bi-heart-fill:before{content:"\\f415"}.bi-heart-half:before{content:"\\f416"}.bi-heart:before{content:"\\f417"}.bi-heptagon-fill:before{content:"\\f418"}.bi-heptagon-half:before{content:"\\f419"}.bi-heptagon:before{content:"\\f41a"}.bi-hexagon-fill:before{content:"\\f41b"}.bi-hexagon-half:before{content:"\\f41c"}.bi-hexagon:before{content:"\\f41d"}.bi-hourglass-bottom:before{content:"\\f41e"}.bi-hourglass-split:before{content:"\\f41f"}.bi-hourglass-top:before{content:"\\f420"}.bi-hourglass:before{content:"\\f421"}.bi-house-door-fill:before{content:"\\f422"}.bi-house-door:before{content:"\\f423"}.bi-house-fill:before{content:"\\f424"}.bi-house:before{content:"\\f425"}.bi-hr:before{content:"\\f426"}.bi-hurricane:before{content:"\\f427"}.bi-image-alt:before{content:"\\f428"}.bi-image-fill:before{content:"\\f429"}.bi-image:before{content:"\\f42a"}.bi-images:before{content:"\\f42b"}.bi-inbox-fill:before{content:"\\f42c"}.bi-inbox:before{content:"\\f42d"}.bi-inboxes-fill:before{content:"\\f42e"}.bi-inboxes:before{content:"\\f42f"}.bi-info-circle-fill:before{content:"\\f430"}.bi-info-circle:before{content:"\\f431"}.bi-info-square-fill:before{content:"\\f432"}.bi-info-square:before{content:"\\f433"}.bi-info:before{content:"\\f434"}.bi-input-cursor-text:before{content:"\\f435"}.bi-input-cursor:before{content:"\\f436"}.bi-instagram:before{content:"\\f437"}.bi-intersect:before{content:"\\f438"}.bi-journal-album:before{content:"\\f439"}.bi-journal-arrow-down:before{content:"\\f43a"}.bi-journal-arrow-up:before{content:"\\f43b"}.bi-journal-bookmark-fill:before{content:"\\f43c"}.bi-journal-bookmark:before{content:"\\f43d"}.bi-journal-check:before{content:"\\f43e"}.bi-journal-code:before{content:"\\f43f"}.bi-journal-medical:before{content:"\\f440"}.bi-journal-minus:before{content:"\\f441"}.bi-journal-plus:before{content:"\\f442"}.bi-journal-richtext:before{content:"\\f443"}.bi-journal-text:before{content:"\\f444"}.bi-journal-x:before{content:"\\f445"}.bi-journal:before{content:"\\f446"}.bi-journals:before{content:"\\f447"}.bi-joystick:before{content:"\\f448"}.bi-justify-left:before{content:"\\f449"}.bi-justify-right:before{content:"\\f44a"}.bi-justify:before{content:"\\f44b"}.bi-kanban-fill:before{content:"\\f44c"}.bi-kanban:before{content:"\\f44d"}.bi-key-fill:before{content:"\\f44e"}.bi-key:before{content:"\\f44f"}.bi-keyboard-fill:before{content:"\\f450"}.bi-keyboard:before{content:"\\f451"}.bi-ladder:before{content:"\\f452"}.bi-lamp-fill:before{content:"\\f453"}.bi-lamp:before{content:"\\f454"}.bi-laptop-fill:before{content:"\\f455"}.bi-laptop:before{content:"\\f456"}.bi-layer-backward:before{content:"\\f457"}.bi-layer-forward:before{content:"\\f458"}.bi-layers-fill:before{content:"\\f459"}.bi-layers-half:before{content:"\\f45a"}.bi-layers:before{content:"\\f45b"}.bi-layout-sidebar-inset-reverse:before{content:"\\f45c"}.bi-layout-sidebar-inset:before{content:"\\f45d"}.bi-layout-sidebar-reverse:before{content:"\\f45e"}.bi-layout-sidebar:before{content:"\\f45f"}.bi-layout-split:before{content:"\\f460"}.bi-layout-text-sidebar-reverse:before{content:"\\f461"}.bi-layout-text-sidebar:before{content:"\\f462"}.bi-layout-text-window-reverse:before{content:"\\f463"}.bi-layout-text-window:before{content:"\\f464"}.bi-layout-three-columns:before{content:"\\f465"}.bi-layout-wtf:before{content:"\\f466"}.bi-life-preserver:before{content:"\\f467"}.bi-lightbulb-fill:before{content:"\\f468"}.bi-lightbulb-off-fill:before{content:"\\f469"}.bi-lightbulb-off:before{content:"\\f46a"}.bi-lightbulb:before{content:"\\f46b"}.bi-lightning-charge-fill:before{content:"\\f46c"}.bi-lightning-charge:before{content:"\\f46d"}.bi-lightning-fill:before{content:"\\f46e"}.bi-lightning:before{content:"\\f46f"}.bi-link-45deg:before{content:"\\f470"}.bi-link:before{content:"\\f471"}.bi-linkedin:before{content:"\\f472"}.bi-list-check:before{content:"\\f473"}.bi-list-nested:before{content:"\\f474"}.bi-list-ol:before{content:"\\f475"}.bi-list-stars:before{content:"\\f476"}.bi-list-task:before{content:"\\f477"}.bi-list-ul:before{content:"\\f478"}.bi-list:before{content:"\\f479"}.bi-lock-fill:before{content:"\\f47a"}.bi-lock:before{content:"\\f47b"}.bi-mailbox:before{content:"\\f47c"}.bi-mailbox2:before{content:"\\f47d"}.bi-map-fill:before{content:"\\f47e"}.bi-map:before{content:"\\f47f"}.bi-markdown-fill:before{content:"\\f480"}.bi-markdown:before{content:"\\f481"}.bi-mask:before{content:"\\f482"}.bi-megaphone-fill:before{content:"\\f483"}.bi-megaphone:before{content:"\\f484"}.bi-menu-app-fill:before{content:"\\f485"}.bi-menu-app:before{content:"\\f486"}.bi-menu-button-fill:before{content:"\\f487"}.bi-menu-button-wide-fill:before{content:"\\f488"}.bi-menu-button-wide:before{content:"\\f489"}.bi-menu-button:before{content:"\\f48a"}.bi-menu-down:before{content:"\\f48b"}.bi-menu-up:before{content:"\\f48c"}.bi-mic-fill:before{content:"\\f48d"}.bi-mic-mute-fill:before{content:"\\f48e"}.bi-mic-mute:before{content:"\\f48f"}.bi-mic:before{content:"\\f490"}.bi-minecart-loaded:before{content:"\\f491"}.bi-minecart:before{content:"\\f492"}.bi-moisture:before{content:"\\f493"}.bi-moon-fill:before{content:"\\f494"}.bi-moon-stars-fill:before{content:"\\f495"}.bi-moon-stars:before{content:"\\f496"}.bi-moon:before{content:"\\f497"}.bi-mouse-fill:before{content:"\\f498"}.bi-mouse:before{content:"\\f499"}.bi-mouse2-fill:before{content:"\\f49a"}.bi-mouse2:before{content:"\\f49b"}.bi-mouse3-fill:before{content:"\\f49c"}.bi-mouse3:before{content:"\\f49d"}.bi-music-note-beamed:before{content:"\\f49e"}.bi-music-note-list:before{content:"\\f49f"}.bi-music-note:before{content:"\\f4a0"}.bi-music-player-fill:before{content:"\\f4a1"}.bi-music-player:before{content:"\\f4a2"}.bi-newspaper:before{content:"\\f4a3"}.bi-node-minus-fill:before{content:"\\f4a4"}.bi-node-minus:before{content:"\\f4a5"}.bi-node-plus-fill:before{content:"\\f4a6"}.bi-node-plus:before{content:"\\f4a7"}.bi-nut-fill:before{content:"\\f4a8"}.bi-nut:before{content:"\\f4a9"}.bi-octagon-fill:before{content:"\\f4aa"}.bi-octagon-half:before{content:"\\f4ab"}.bi-octagon:before{content:"\\f4ac"}.bi-option:before{content:"\\f4ad"}.bi-outlet:before{content:"\\f4ae"}.bi-paint-bucket:before{content:"\\f4af"}.bi-palette-fill:before{content:"\\f4b0"}.bi-palette:before{content:"\\f4b1"}.bi-palette2:before{content:"\\f4b2"}.bi-paperclip:before{content:"\\f4b3"}.bi-paragraph:before{content:"\\f4b4"}.bi-patch-check-fill:before{content:"\\f4b5"}.bi-patch-check:before{content:"\\f4b6"}.bi-patch-exclamation-fill:before{content:"\\f4b7"}.bi-patch-exclamation:before{content:"\\f4b8"}.bi-patch-minus-fill:before{content:"\\f4b9"}.bi-patch-minus:before{content:"\\f4ba"}.bi-patch-plus-fill:before{content:"\\f4bb"}.bi-patch-plus:before{content:"\\f4bc"}.bi-patch-question-fill:before{content:"\\f4bd"}.bi-patch-question:before{content:"\\f4be"}.bi-pause-btn-fill:before{content:"\\f4bf"}.bi-pause-btn:before{content:"\\f4c0"}.bi-pause-circle-fill:before{content:"\\f4c1"}.bi-pause-circle:before{content:"\\f4c2"}.bi-pause-fill:before{content:"\\f4c3"}.bi-pause:before{content:"\\f4c4"}.bi-peace-fill:before{content:"\\f4c5"}.bi-peace:before{content:"\\f4c6"}.bi-pen-fill:before{content:"\\f4c7"}.bi-pen:before{content:"\\f4c8"}.bi-pencil-fill:before{content:"\\f4c9"}.bi-pencil-square:before{content:"\\f4ca"}.bi-pencil:before{content:"\\f4cb"}.bi-pentagon-fill:before{content:"\\f4cc"}.bi-pentagon-half:before{content:"\\f4cd"}.bi-pentagon:before{content:"\\f4ce"}.bi-people-fill:before{content:"\\f4cf"}.bi-people:before{content:"\\f4d0"}.bi-percent:before{content:"\\f4d1"}.bi-person-badge-fill:before{content:"\\f4d2"}.bi-person-badge:before{content:"\\f4d3"}.bi-person-bounding-box:before{content:"\\f4d4"}.bi-person-check-fill:before{content:"\\f4d5"}.bi-person-check:before{content:"\\f4d6"}.bi-person-circle:before{content:"\\f4d7"}.bi-person-dash-fill:before{content:"\\f4d8"}.bi-person-dash:before{content:"\\f4d9"}.bi-person-fill:before{content:"\\f4da"}.bi-person-lines-fill:before{content:"\\f4db"}.bi-person-plus-fill:before{content:"\\f4dc"}.bi-person-plus:before{content:"\\f4dd"}.bi-person-square:before{content:"\\f4de"}.bi-person-x-fill:before{content:"\\f4df"}.bi-person-x:before{content:"\\f4e0"}.bi-person:before{content:"\\f4e1"}.bi-phone-fill:before{content:"\\f4e2"}.bi-phone-landscape-fill:before{content:"\\f4e3"}.bi-phone-landscape:before{content:"\\f4e4"}.bi-phone-vibrate-fill:before{content:"\\f4e5"}.bi-phone-vibrate:before{content:"\\f4e6"}.bi-phone:before{content:"\\f4e7"}.bi-pie-chart-fill:before{content:"\\f4e8"}.bi-pie-chart:before{content:"\\f4e9"}.bi-pin-angle-fill:before{content:"\\f4ea"}.bi-pin-angle:before{content:"\\f4eb"}.bi-pin-fill:before{content:"\\f4ec"}.bi-pin:before{content:"\\f4ed"}.bi-pip-fill:before{content:"\\f4ee"}.bi-pip:before{content:"\\f4ef"}.bi-play-btn-fill:before{content:"\\f4f0"}.bi-play-btn:before{content:"\\f4f1"}.bi-play-circle-fill:before{content:"\\f4f2"}.bi-play-circle:before{content:"\\f4f3"}.bi-play-fill:before{content:"\\f4f4"}.bi-play:before{content:"\\f4f5"}.bi-plug-fill:before{content:"\\f4f6"}.bi-plug:before{content:"\\f4f7"}.bi-plus-circle-dotted:before{content:"\\f4f8"}.bi-plus-circle-fill:before{content:"\\f4f9"}.bi-plus-circle:before{content:"\\f4fa"}.bi-plus-square-dotted:before{content:"\\f4fb"}.bi-plus-square-fill:before{content:"\\f4fc"}.bi-plus-square:before{content:"\\f4fd"}.bi-plus:before{content:"\\f4fe"}.bi-power:before{content:"\\f4ff"}.bi-printer-fill:before{content:"\\f500"}.bi-printer:before{content:"\\f501"}.bi-puzzle-fill:before{content:"\\f502"}.bi-puzzle:before{content:"\\f503"}.bi-question-circle-fill:before{content:"\\f504"}.bi-question-circle:before{content:"\\f505"}.bi-question-diamond-fill:before{content:"\\f506"}.bi-question-diamond:before{content:"\\f507"}.bi-question-octagon-fill:before{content:"\\f508"}.bi-question-octagon:before{content:"\\f509"}.bi-question-square-fill:before{content:"\\f50a"}.bi-question-square:before{content:"\\f50b"}.bi-question:before{content:"\\f50c"}.bi-rainbow:before{content:"\\f50d"}.bi-receipt-cutoff:before{content:"\\f50e"}.bi-receipt:before{content:"\\f50f"}.bi-reception-0:before{content:"\\f510"}.bi-reception-1:before{content:"\\f511"}.bi-reception-2:before{content:"\\f512"}.bi-reception-3:before{content:"\\f513"}.bi-reception-4:before{content:"\\f514"}.bi-record-btn-fill:before{content:"\\f515"}.bi-record-btn:before{content:"\\f516"}.bi-record-circle-fill:before{content:"\\f517"}.bi-record-circle:before{content:"\\f518"}.bi-record-fill:before{content:"\\f519"}.bi-record:before{content:"\\f51a"}.bi-record2-fill:before{content:"\\f51b"}.bi-record2:before{content:"\\f51c"}.bi-reply-all-fill:before{content:"\\f51d"}.bi-reply-all:before{content:"\\f51e"}.bi-reply-fill:before{content:"\\f51f"}.bi-reply:before{content:"\\f520"}.bi-rss-fill:before{content:"\\f521"}.bi-rss:before{content:"\\f522"}.bi-rulers:before{content:"\\f523"}.bi-save-fill:before{content:"\\f524"}.bi-save:before{content:"\\f525"}.bi-save2-fill:before{content:"\\f526"}.bi-save2:before{content:"\\f527"}.bi-scissors:before{content:"\\f528"}.bi-screwdriver:before{content:"\\f529"}.bi-search:before{content:"\\f52a"}.bi-segmented-nav:before{content:"\\f52b"}.bi-server:before{content:"\\f52c"}.bi-share-fill:before{content:"\\f52d"}.bi-share:before{content:"\\f52e"}.bi-shield-check:before{content:"\\f52f"}.bi-shield-exclamation:before{content:"\\f530"}.bi-shield-fill-check:before{content:"\\f531"}.bi-shield-fill-exclamation:before{content:"\\f532"}.bi-shield-fill-minus:before{content:"\\f533"}.bi-shield-fill-plus:before{content:"\\f534"}.bi-shield-fill-x:before{content:"\\f535"}.bi-shield-fill:before{content:"\\f536"}.bi-shield-lock-fill:before{content:"\\f537"}.bi-shield-lock:before{content:"\\f538"}.bi-shield-minus:before{content:"\\f539"}.bi-shield-plus:before{content:"\\f53a"}.bi-shield-shaded:before{content:"\\f53b"}.bi-shield-slash-fill:before{content:"\\f53c"}.bi-shield-slash:before{content:"\\f53d"}.bi-shield-x:before{content:"\\f53e"}.bi-shield:before{content:"\\f53f"}.bi-shift-fill:before{content:"\\f540"}.bi-shift:before{content:"\\f541"}.bi-shop-window:before{content:"\\f542"}.bi-shop:before{content:"\\f543"}.bi-shuffle:before{content:"\\f544"}.bi-signpost-2-fill:before{content:"\\f545"}.bi-signpost-2:before{content:"\\f546"}.bi-signpost-fill:before{content:"\\f547"}.bi-signpost-split-fill:before{content:"\\f548"}.bi-signpost-split:before{content:"\\f549"}.bi-signpost:before{content:"\\f54a"}.bi-sim-fill:before{content:"\\f54b"}.bi-sim:before{content:"\\f54c"}.bi-skip-backward-btn-fill:before{content:"\\f54d"}.bi-skip-backward-btn:before{content:"\\f54e"}.bi-skip-backward-circle-fill:before{content:"\\f54f"}.bi-skip-backward-circle:before{content:"\\f550"}.bi-skip-backward-fill:before{content:"\\f551"}.bi-skip-backward:before{content:"\\f552"}.bi-skip-end-btn-fill:before{content:"\\f553"}.bi-skip-end-btn:before{content:"\\f554"}.bi-skip-end-circle-fill:before{content:"\\f555"}.bi-skip-end-circle:before{content:"\\f556"}.bi-skip-end-fill:before{content:"\\f557"}.bi-skip-end:before{content:"\\f558"}.bi-skip-forward-btn-fill:before{content:"\\f559"}.bi-skip-forward-btn:before{content:"\\f55a"}.bi-skip-forward-circle-fill:before{content:"\\f55b"}.bi-skip-forward-circle:before{content:"\\f55c"}.bi-skip-forward-fill:before{content:"\\f55d"}.bi-skip-forward:before{content:"\\f55e"}.bi-skip-start-btn-fill:before{content:"\\f55f"}.bi-skip-start-btn:before{content:"\\f560"}.bi-skip-start-circle-fill:before{content:"\\f561"}.bi-skip-start-circle:before{content:"\\f562"}.bi-skip-start-fill:before{content:"\\f563"}.bi-skip-start:before{content:"\\f564"}.bi-slack:before{content:"\\f565"}.bi-slash-circle-fill:before{content:"\\f566"}.bi-slash-circle:before{content:"\\f567"}.bi-slash-square-fill:before{content:"\\f568"}.bi-slash-square:before{content:"\\f569"}.bi-slash:before{content:"\\f56a"}.bi-sliders:before{content:"\\f56b"}.bi-smartwatch:before{content:"\\f56c"}.bi-snow:before{content:"\\f56d"}.bi-snow2:before{content:"\\f56e"}.bi-snow3:before{content:"\\f56f"}.bi-sort-alpha-down-alt:before{content:"\\f570"}.bi-sort-alpha-down:before{content:"\\f571"}.bi-sort-alpha-up-alt:before{content:"\\f572"}.bi-sort-alpha-up:before{content:"\\f573"}.bi-sort-down-alt:before{content:"\\f574"}.bi-sort-down:before{content:"\\f575"}.bi-sort-numeric-down-alt:before{content:"\\f576"}.bi-sort-numeric-down:before{content:"\\f577"}.bi-sort-numeric-up-alt:before{content:"\\f578"}.bi-sort-numeric-up:before{content:"\\f579"}.bi-sort-up-alt:before{content:"\\f57a"}.bi-sort-up:before{content:"\\f57b"}.bi-soundwave:before{content:"\\f57c"}.bi-speaker-fill:before{content:"\\f57d"}.bi-speaker:before{content:"\\f57e"}.bi-speedometer:before{content:"\\f57f"}.bi-speedometer2:before{content:"\\f580"}.bi-spellcheck:before{content:"\\f581"}.bi-square-fill:before{content:"\\f582"}.bi-square-half:before{content:"\\f583"}.bi-square:before{content:"\\f584"}.bi-stack:before{content:"\\f585"}.bi-star-fill:before{content:"\\f586"}.bi-star-half:before{content:"\\f587"}.bi-star:before{content:"\\f588"}.bi-stars:before{content:"\\f589"}.bi-stickies-fill:before{content:"\\f58a"}.bi-stickies:before{content:"\\f58b"}.bi-sticky-fill:before{content:"\\f58c"}.bi-sticky:before{content:"\\f58d"}.bi-stop-btn-fill:before{content:"\\f58e"}.bi-stop-btn:before{content:"\\f58f"}.bi-stop-circle-fill:before{content:"\\f590"}.bi-stop-circle:before{content:"\\f591"}.bi-stop-fill:before{content:"\\f592"}.bi-stop:before{content:"\\f593"}.bi-stoplights-fill:before{content:"\\f594"}.bi-stoplights:before{content:"\\f595"}.bi-stopwatch-fill:before{content:"\\f596"}.bi-stopwatch:before{content:"\\f597"}.bi-subtract:before{content:"\\f598"}.bi-suit-club-fill:before{content:"\\f599"}.bi-suit-club:before{content:"\\f59a"}.bi-suit-diamond-fill:before{content:"\\f59b"}.bi-suit-diamond:before{content:"\\f59c"}.bi-suit-heart-fill:before{content:"\\f59d"}.bi-suit-heart:before{content:"\\f59e"}.bi-suit-spade-fill:before{content:"\\f59f"}.bi-suit-spade:before{content:"\\f5a0"}.bi-sun-fill:before{content:"\\f5a1"}.bi-sun:before{content:"\\f5a2"}.bi-sunglasses:before{content:"\\f5a3"}.bi-sunrise-fill:before{content:"\\f5a4"}.bi-sunrise:before{content:"\\f5a5"}.bi-sunset-fill:before{content:"\\f5a6"}.bi-sunset:before{content:"\\f5a7"}.bi-symmetry-horizontal:before{content:"\\f5a8"}.bi-symmetry-vertical:before{content:"\\f5a9"}.bi-table:before{content:"\\f5aa"}.bi-tablet-fill:before{content:"\\f5ab"}.bi-tablet-landscape-fill:before{content:"\\f5ac"}.bi-tablet-landscape:before{content:"\\f5ad"}.bi-tablet:before{content:"\\f5ae"}.bi-tag-fill:before{content:"\\f5af"}.bi-tag:before{content:"\\f5b0"}.bi-tags-fill:before{content:"\\f5b1"}.bi-tags:before{content:"\\f5b2"}.bi-telegram:before{content:"\\f5b3"}.bi-telephone-fill:before{content:"\\f5b4"}.bi-telephone-forward-fill:before{content:"\\f5b5"}.bi-telephone-forward:before{content:"\\f5b6"}.bi-telephone-inbound-fill:before{content:"\\f5b7"}.bi-telephone-inbound:before{content:"\\f5b8"}.bi-telephone-minus-fill:before{content:"\\f5b9"}.bi-telephone-minus:before{content:"\\f5ba"}.bi-telephone-outbound-fill:before{content:"\\f5bb"}.bi-telephone-outbound:before{content:"\\f5bc"}.bi-telephone-plus-fill:before{content:"\\f5bd"}.bi-telephone-plus:before{content:"\\f5be"}.bi-telephone-x-fill:before{content:"\\f5bf"}.bi-telephone-x:before{content:"\\f5c0"}.bi-telephone:before{content:"\\f5c1"}.bi-terminal-fill:before{content:"\\f5c2"}.bi-terminal:before{content:"\\f5c3"}.bi-text-center:before{content:"\\f5c4"}.bi-text-indent-left:before{content:"\\f5c5"}.bi-text-indent-right:before{content:"\\f5c6"}.bi-text-left:before{content:"\\f5c7"}.bi-text-paragraph:before{content:"\\f5c8"}.bi-text-right:before{content:"\\f5c9"}.bi-textarea-resize:before{content:"\\f5ca"}.bi-textarea-t:before{content:"\\f5cb"}.bi-textarea:before{content:"\\f5cc"}.bi-thermometer-half:before{content:"\\f5cd"}.bi-thermometer-high:before{content:"\\f5ce"}.bi-thermometer-low:before{content:"\\f5cf"}.bi-thermometer-snow:before{content:"\\f5d0"}.bi-thermometer-sun:before{content:"\\f5d1"}.bi-thermometer:before{content:"\\f5d2"}.bi-three-dots-vertical:before{content:"\\f5d3"}.bi-three-dots:before{content:"\\f5d4"}.bi-toggle-off:before{content:"\\f5d5"}.bi-toggle-on:before{content:"\\f5d6"}.bi-toggle2-off:before{content:"\\f5d7"}.bi-toggle2-on:before{content:"\\f5d8"}.bi-toggles:before{content:"\\f5d9"}.bi-toggles2:before{content:"\\f5da"}.bi-tools:before{content:"\\f5db"}.bi-tornado:before{content:"\\f5dc"}.bi-trash-fill:before{content:"\\f5dd"}.bi-trash:before{content:"\\f5de"}.bi-trash2-fill:before{content:"\\f5df"}.bi-trash2:before{content:"\\f5e0"}.bi-tree-fill:before{content:"\\f5e1"}.bi-tree:before{content:"\\f5e2"}.bi-triangle-fill:before{content:"\\f5e3"}.bi-triangle-half:before{content:"\\f5e4"}.bi-triangle:before{content:"\\f5e5"}.bi-trophy-fill:before{content:"\\f5e6"}.bi-trophy:before{content:"\\f5e7"}.bi-tropical-storm:before{content:"\\f5e8"}.bi-truck-flatbed:before{content:"\\f5e9"}.bi-truck:before{content:"\\f5ea"}.bi-tsunami:before{content:"\\f5eb"}.bi-tv-fill:before{content:"\\f5ec"}.bi-tv:before{content:"\\f5ed"}.bi-twitch:before{content:"\\f5ee"}.bi-twitter:before{content:"\\f5ef"}.bi-type-bold:before{content:"\\f5f0"}.bi-type-h1:before{content:"\\f5f1"}.bi-type-h2:before{content:"\\f5f2"}.bi-type-h3:before{content:"\\f5f3"}.bi-type-italic:before{content:"\\f5f4"}.bi-type-strikethrough:before{content:"\\f5f5"}.bi-type-underline:before{content:"\\f5f6"}.bi-type:before{content:"\\f5f7"}.bi-ui-checks-grid:before{content:"\\f5f8"}.bi-ui-checks:before{content:"\\f5f9"}.bi-ui-radios-grid:before{content:"\\f5fa"}.bi-ui-radios:before{content:"\\f5fb"}.bi-umbrella-fill:before{content:"\\f5fc"}.bi-umbrella:before{content:"\\f5fd"}.bi-union:before{content:"\\f5fe"}.bi-unlock-fill:before{content:"\\f5ff"}.bi-unlock:before{content:"\\f600"}.bi-upc-scan:before{content:"\\f601"}.bi-upc:before{content:"\\f602"}.bi-upload:before{content:"\\f603"}.bi-vector-pen:before{content:"\\f604"}.bi-view-list:before{content:"\\f605"}.bi-view-stacked:before{content:"\\f606"}.bi-vinyl-fill:before{content:"\\f607"}.bi-vinyl:before{content:"\\f608"}.bi-voicemail:before{content:"\\f609"}.bi-volume-down-fill:before{content:"\\f60a"}.bi-volume-down:before{content:"\\f60b"}.bi-volume-mute-fill:before{content:"\\f60c"}.bi-volume-mute:before{content:"\\f60d"}.bi-volume-off-fill:before{content:"\\f60e"}.bi-volume-off:before{content:"\\f60f"}.bi-volume-up-fill:before{content:"\\f610"}.bi-volume-up:before{content:"\\f611"}.bi-vr:before{content:"\\f612"}.bi-wallet-fill:before{content:"\\f613"}.bi-wallet:before{content:"\\f614"}.bi-wallet2:before{content:"\\f615"}.bi-watch:before{content:"\\f616"}.bi-water:before{content:"\\f617"}.bi-whatsapp:before{content:"\\f618"}.bi-wifi-1:before{content:"\\f619"}.bi-wifi-2:before{content:"\\f61a"}.bi-wifi-off:before{content:"\\f61b"}.bi-wifi:before{content:"\\f61c"}.bi-wind:before{content:"\\f61d"}.bi-window-dock:before{content:"\\f61e"}.bi-window-sidebar:before{content:"\\f61f"}.bi-window:before{content:"\\f620"}.bi-wrench:before{content:"\\f621"}.bi-x-circle-fill:before{content:"\\f622"}.bi-x-circle:before{content:"\\f623"}.bi-x-diamond-fill:before{content:"\\f624"}.bi-x-diamond:before{content:"\\f625"}.bi-x-octagon-fill:before{content:"\\f626"}.bi-x-octagon:before{content:"\\f627"}.bi-x-square-fill:before{content:"\\f628"}.bi-x-square:before{content:"\\f629"}.bi-x:before{content:"\\f62a"}.bi-youtube:before{content:"\\f62b"}.bi-zoom-in:before{content:"\\f62c"}.bi-zoom-out:before{content:"\\f62d"}.bi-bank:before{content:"\\f62e"}.bi-bank2:before{content:"\\f62f"}.bi-bell-slash-fill:before{content:"\\f630"}.bi-bell-slash:before{content:"\\f631"}.bi-cash-coin:before{content:"\\f632"}.bi-check-lg:before{content:"\\f633"}.bi-coin:before{content:"\\f634"}.bi-currency-bitcoin:before{content:"\\f635"}.bi-currency-dollar:before{content:"\\f636"}.bi-currency-euro:before{content:"\\f637"}.bi-currency-exchange:before{content:"\\f638"}.bi-currency-pound:before{content:"\\f639"}.bi-currency-yen:before{content:"\\f63a"}.bi-dash-lg:before{content:"\\f63b"}.bi-exclamation-lg:before{content:"\\f63c"}.bi-file-earmark-pdf-fill:before{content:"\\f63d"}.bi-file-earmark-pdf:before{content:"\\f63e"}.bi-file-pdf-fill:before{content:"\\f63f"}.bi-file-pdf:before{content:"\\f640"}.bi-gender-ambiguous:before{content:"\\f641"}.bi-gender-female:before{content:"\\f642"}.bi-gender-male:before{content:"\\f643"}.bi-gender-trans:before{content:"\\f644"}.bi-headset-vr:before{content:"\\f645"}.bi-info-lg:before{content:"\\f646"}.bi-mastodon:before{content:"\\f647"}.bi-messenger:before{content:"\\f648"}.bi-piggy-bank-fill:before{content:"\\f649"}.bi-piggy-bank:before{content:"\\f64a"}.bi-pin-map-fill:before{content:"\\f64b"}.bi-pin-map:before{content:"\\f64c"}.bi-plus-lg:before{content:"\\f64d"}.bi-question-lg:before{content:"\\f64e"}.bi-recycle:before{content:"\\f64f"}.bi-reddit:before{content:"\\f650"}.bi-safe-fill:before{content:"\\f651"}.bi-safe2-fill:before{content:"\\f652"}.bi-safe2:before{content:"\\f653"}.bi-sd-card-fill:before{content:"\\f654"}.bi-sd-card:before{content:"\\f655"}.bi-skype:before{content:"\\f656"}.bi-slash-lg:before{content:"\\f657"}.bi-translate:before{content:"\\f658"}.bi-x-lg:before{content:"\\f659"}.bi-safe:before{content:"\\f65a"}.bi-apple:before{content:"\\f65b"}.bi-microsoft:before{content:"\\f65d"}.bi-windows:before{content:"\\f65e"}.bi-behance:before{content:"\\f65c"}.bi-dribbble:before{content:"\\f65f"}.bi-line:before{content:"\\f660"}.bi-medium:before{content:"\\f661"}.bi-paypal:before{content:"\\f662"}.bi-pinterest:before{content:"\\f663"}.bi-signal:before{content:"\\f664"}.bi-snapchat:before{content:"\\f665"}.bi-spotify:before{content:"\\f666"}.bi-stack-overflow:before{content:"\\f667"}.bi-strava:before{content:"\\f668"}.bi-wordpress:before{content:"\\f669"}.bi-vimeo:before{content:"\\f66a"}.bi-activity:before{content:"\\f66b"}.bi-easel2-fill:before{content:"\\f66c"}.bi-easel2:before{content:"\\f66d"}.bi-easel3-fill:before{content:"\\f66e"}.bi-easel3:before{content:"\\f66f"}.bi-fan:before{content:"\\f670"}.bi-fingerprint:before{content:"\\f671"}.bi-graph-down-arrow:before{content:"\\f672"}.bi-graph-up-arrow:before{content:"\\f673"}.bi-hypnotize:before{content:"\\f674"}.bi-magic:before{content:"\\f675"}.bi-person-rolodex:before{content:"\\f676"}.bi-person-video:before{content:"\\f677"}.bi-person-video2:before{content:"\\f678"}.bi-person-video3:before{content:"\\f679"}.bi-person-workspace:before{content:"\\f67a"}.bi-radioactive:before{content:"\\f67b"}.bi-webcam-fill:before{content:"\\f67c"}.bi-webcam:before{content:"\\f67d"}.bi-yin-yang:before{content:"\\f67e"}.bi-bandaid-fill:before{content:"\\f680"}.bi-bandaid:before{content:"\\f681"}.bi-bluetooth:before{content:"\\f682"}.bi-body-text:before{content:"\\f683"}.bi-boombox:before{content:"\\f684"}.bi-boxes:before{content:"\\f685"}.bi-dpad-fill:before{content:"\\f686"}.bi-dpad:before{content:"\\f687"}.bi-ear-fill:before{content:"\\f688"}.bi-ear:before{content:"\\f689"}.bi-envelope-check-fill:before{content:"\\f68b"}.bi-envelope-check:before{content:"\\f68c"}.bi-envelope-dash-fill:before{content:"\\f68e"}.bi-envelope-dash:before{content:"\\f68f"}.bi-envelope-exclamation-fill:before{content:"\\f691"}.bi-envelope-exclamation:before{content:"\\f692"}.bi-envelope-plus-fill:before{content:"\\f693"}.bi-envelope-plus:before{content:"\\f694"}.bi-envelope-slash-fill:before{content:"\\f696"}.bi-envelope-slash:before{content:"\\f697"}.bi-envelope-x-fill:before{content:"\\f699"}.bi-envelope-x:before{content:"\\f69a"}.bi-explicit-fill:before{content:"\\f69b"}.bi-explicit:before{content:"\\f69c"}.bi-git:before{content:"\\f69d"}.bi-infinity:before{content:"\\f69e"}.bi-list-columns-reverse:before{content:"\\f69f"}.bi-list-columns:before{content:"\\f6a0"}.bi-meta:before{content:"\\f6a1"}.bi-nintendo-switch:before{content:"\\f6a4"}.bi-pc-display-horizontal:before{content:"\\f6a5"}.bi-pc-display:before{content:"\\f6a6"}.bi-pc-horizontal:before{content:"\\f6a7"}.bi-pc:before{content:"\\f6a8"}.bi-playstation:before{content:"\\f6a9"}.bi-plus-slash-minus:before{content:"\\f6aa"}.bi-projector-fill:before{content:"\\f6ab"}.bi-projector:before{content:"\\f6ac"}.bi-qr-code-scan:before{content:"\\f6ad"}.bi-qr-code:before{content:"\\f6ae"}.bi-quora:before{content:"\\f6af"}.bi-quote:before{content:"\\f6b0"}.bi-robot:before{content:"\\f6b1"}.bi-send-check-fill:before{content:"\\f6b2"}.bi-send-check:before{content:"\\f6b3"}.bi-send-dash-fill:before{content:"\\f6b4"}.bi-send-dash:before{content:"\\f6b5"}.bi-send-exclamation-fill:before{content:"\\f6b7"}.bi-send-exclamation:before{content:"\\f6b8"}.bi-send-fill:before{content:"\\f6b9"}.bi-send-plus-fill:before{content:"\\f6ba"}.bi-send-plus:before{content:"\\f6bb"}.bi-send-slash-fill:before{content:"\\f6bc"}.bi-send-slash:before{content:"\\f6bd"}.bi-send-x-fill:before{content:"\\f6be"}.bi-send-x:before{content:"\\f6bf"}.bi-send:before{content:"\\f6c0"}.bi-steam:before{content:"\\f6c1"}.bi-terminal-dash:before{content:"\\f6c3"}.bi-terminal-plus:before{content:"\\f6c4"}.bi-terminal-split:before{content:"\\f6c5"}.bi-ticket-detailed-fill:before{content:"\\f6c6"}.bi-ticket-detailed:before{content:"\\f6c7"}.bi-ticket-fill:before{content:"\\f6c8"}.bi-ticket-perforated-fill:before{content:"\\f6c9"}.bi-ticket-perforated:before{content:"\\f6ca"}.bi-ticket:before{content:"\\f6cb"}.bi-tiktok:before{content:"\\f6cc"}.bi-window-dash:before{content:"\\f6cd"}.bi-window-desktop:before{content:"\\f6ce"}.bi-window-fullscreen:before{content:"\\f6cf"}.bi-window-plus:before{content:"\\f6d0"}.bi-window-split:before{content:"\\f6d1"}.bi-window-stack:before{content:"\\f6d2"}.bi-window-x:before{content:"\\f6d3"}.bi-xbox:before{content:"\\f6d4"}.bi-ethernet:before{content:"\\f6d5"}.bi-hdmi-fill:before{content:"\\f6d6"}.bi-hdmi:before{content:"\\f6d7"}.bi-usb-c-fill:before{content:"\\f6d8"}.bi-usb-c:before{content:"\\f6d9"}.bi-usb-fill:before{content:"\\f6da"}.bi-usb-plug-fill:before{content:"\\f6db"}.bi-usb-plug:before{content:"\\f6dc"}.bi-usb-symbol:before{content:"\\f6dd"}.bi-usb:before{content:"\\f6de"}.bi-boombox-fill:before{content:"\\f6df"}.bi-displayport:before{content:"\\f6e1"}.bi-gpu-card:before{content:"\\f6e2"}.bi-memory:before{content:"\\f6e3"}.bi-modem-fill:before{content:"\\f6e4"}.bi-modem:before{content:"\\f6e5"}.bi-motherboard-fill:before{content:"\\f6e6"}.bi-motherboard:before{content:"\\f6e7"}.bi-optical-audio-fill:before{content:"\\f6e8"}.bi-optical-audio:before{content:"\\f6e9"}.bi-pci-card:before{content:"\\f6ea"}.bi-router-fill:before{content:"\\f6eb"}.bi-router:before{content:"\\f6ec"}.bi-thunderbolt-fill:before{content:"\\f6ef"}.bi-thunderbolt:before{content:"\\f6f0"}.bi-usb-drive-fill:before{content:"\\f6f1"}.bi-usb-drive:before{content:"\\f6f2"}.bi-usb-micro-fill:before{content:"\\f6f3"}.bi-usb-micro:before{content:"\\f6f4"}.bi-usb-mini-fill:before{content:"\\f6f5"}.bi-usb-mini:before{content:"\\f6f6"}.bi-cloud-haze2:before{content:"\\f6f7"}.bi-device-hdd-fill:before{content:"\\f6f8"}.bi-device-hdd:before{content:"\\f6f9"}.bi-device-ssd-fill:before{content:"\\f6fa"}.bi-device-ssd:before{content:"\\f6fb"}.bi-displayport-fill:before{content:"\\f6fc"}.bi-mortarboard-fill:before{content:"\\f6fd"}.bi-mortarboard:before{content:"\\f6fe"}.bi-terminal-x:before{content:"\\f6ff"}.bi-arrow-through-heart-fill:before{content:"\\f700"}.bi-arrow-through-heart:before{content:"\\f701"}.bi-badge-sd-fill:before{content:"\\f702"}.bi-badge-sd:before{content:"\\f703"}.bi-bag-heart-fill:before{content:"\\f704"}.bi-bag-heart:before{content:"\\f705"}.bi-balloon-fill:before{content:"\\f706"}.bi-balloon-heart-fill:before{content:"\\f707"}.bi-balloon-heart:before{content:"\\f708"}.bi-balloon:before{content:"\\f709"}.bi-box2-fill:before{content:"\\f70a"}.bi-box2-heart-fill:before{content:"\\f70b"}.bi-box2-heart:before{content:"\\f70c"}.bi-box2:before{content:"\\f70d"}.bi-braces-asterisk:before{content:"\\f70e"}.bi-calendar-heart-fill:before{content:"\\f70f"}.bi-calendar-heart:before{content:"\\f710"}.bi-calendar2-heart-fill:before{content:"\\f711"}.bi-calendar2-heart:before{content:"\\f712"}.bi-chat-heart-fill:before{content:"\\f713"}.bi-chat-heart:before{content:"\\f714"}.bi-chat-left-heart-fill:before{content:"\\f715"}.bi-chat-left-heart:before{content:"\\f716"}.bi-chat-right-heart-fill:before{content:"\\f717"}.bi-chat-right-heart:before{content:"\\f718"}.bi-chat-square-heart-fill:before{content:"\\f719"}.bi-chat-square-heart:before{content:"\\f71a"}.bi-clipboard-check-fill:before{content:"\\f71b"}.bi-clipboard-data-fill:before{content:"\\f71c"}.bi-clipboard-fill:before{content:"\\f71d"}.bi-clipboard-heart-fill:before{content:"\\f71e"}.bi-clipboard-heart:before{content:"\\f71f"}.bi-clipboard-minus-fill:before{content:"\\f720"}.bi-clipboard-plus-fill:before{content:"\\f721"}.bi-clipboard-pulse:before{content:"\\f722"}.bi-clipboard-x-fill:before{content:"\\f723"}.bi-clipboard2-check-fill:before{content:"\\f724"}.bi-clipboard2-check:before{content:"\\f725"}.bi-clipboard2-data-fill:before{content:"\\f726"}.bi-clipboard2-data:before{content:"\\f727"}.bi-clipboard2-fill:before{content:"\\f728"}.bi-clipboard2-heart-fill:before{content:"\\f729"}.bi-clipboard2-heart:before{content:"\\f72a"}.bi-clipboard2-minus-fill:before{content:"\\f72b"}.bi-clipboard2-minus:before{content:"\\f72c"}.bi-clipboard2-plus-fill:before{content:"\\f72d"}.bi-clipboard2-plus:before{content:"\\f72e"}.bi-clipboard2-pulse-fill:before{content:"\\f72f"}.bi-clipboard2-pulse:before{content:"\\f730"}.bi-clipboard2-x-fill:before{content:"\\f731"}.bi-clipboard2-x:before{content:"\\f732"}.bi-clipboard2:before{content:"\\f733"}.bi-emoji-kiss-fill:before{content:"\\f734"}.bi-emoji-kiss:before{content:"\\f735"}.bi-envelope-heart-fill:before{content:"\\f736"}.bi-envelope-heart:before{content:"\\f737"}.bi-envelope-open-heart-fill:before{content:"\\f738"}.bi-envelope-open-heart:before{content:"\\f739"}.bi-envelope-paper-fill:before{content:"\\f73a"}.bi-envelope-paper-heart-fill:before{content:"\\f73b"}.bi-envelope-paper-heart:before{content:"\\f73c"}.bi-envelope-paper:before{content:"\\f73d"}.bi-filetype-aac:before{content:"\\f73e"}.bi-filetype-ai:before{content:"\\f73f"}.bi-filetype-bmp:before{content:"\\f740"}.bi-filetype-cs:before{content:"\\f741"}.bi-filetype-css:before{content:"\\f742"}.bi-filetype-csv:before{content:"\\f743"}.bi-filetype-doc:before{content:"\\f744"}.bi-filetype-docx:before{content:"\\f745"}.bi-filetype-exe:before{content:"\\f746"}.bi-filetype-gif:before{content:"\\f747"}.bi-filetype-heic:before{content:"\\f748"}.bi-filetype-html:before{content:"\\f749"}.bi-filetype-java:before{content:"\\f74a"}.bi-filetype-jpg:before{content:"\\f74b"}.bi-filetype-js:before{content:"\\f74c"}.bi-filetype-jsx:before{content:"\\f74d"}.bi-filetype-key:before{content:"\\f74e"}.bi-filetype-m4p:before{content:"\\f74f"}.bi-filetype-md:before{content:"\\f750"}.bi-filetype-mdx:before{content:"\\f751"}.bi-filetype-mov:before{content:"\\f752"}.bi-filetype-mp3:before{content:"\\f753"}.bi-filetype-mp4:before{content:"\\f754"}.bi-filetype-otf:before{content:"\\f755"}.bi-filetype-pdf:before{content:"\\f756"}.bi-filetype-php:before{content:"\\f757"}.bi-filetype-png:before{content:"\\f758"}.bi-filetype-ppt:before{content:"\\f75a"}.bi-filetype-psd:before{content:"\\f75b"}.bi-filetype-py:before{content:"\\f75c"}.bi-filetype-raw:before{content:"\\f75d"}.bi-filetype-rb:before{content:"\\f75e"}.bi-filetype-sass:before{content:"\\f75f"}.bi-filetype-scss:before{content:"\\f760"}.bi-filetype-sh:before{content:"\\f761"}.bi-filetype-svg:before{content:"\\f762"}.bi-filetype-tiff:before{content:"\\f763"}.bi-filetype-tsx:before{content:"\\f764"}.bi-filetype-ttf:before{content:"\\f765"}.bi-filetype-txt:before{content:"\\f766"}.bi-filetype-wav:before{content:"\\f767"}.bi-filetype-woff:before{content:"\\f768"}.bi-filetype-xls:before{content:"\\f76a"}.bi-filetype-xml:before{content:"\\f76b"}.bi-filetype-yml:before{content:"\\f76c"}.bi-heart-arrow:before{content:"\\f76d"}.bi-heart-pulse-fill:before{content:"\\f76e"}.bi-heart-pulse:before{content:"\\f76f"}.bi-heartbreak-fill:before{content:"\\f770"}.bi-heartbreak:before{content:"\\f771"}.bi-hearts:before{content:"\\f772"}.bi-hospital-fill:before{content:"\\f773"}.bi-hospital:before{content:"\\f774"}.bi-house-heart-fill:before{content:"\\f775"}.bi-house-heart:before{content:"\\f776"}.bi-incognito:before{content:"\\f777"}.bi-magnet-fill:before{content:"\\f778"}.bi-magnet:before{content:"\\f779"}.bi-person-heart:before{content:"\\f77a"}.bi-person-hearts:before{content:"\\f77b"}.bi-phone-flip:before{content:"\\f77c"}.bi-plugin:before{content:"\\f77d"}.bi-postage-fill:before{content:"\\f77e"}.bi-postage-heart-fill:before{content:"\\f77f"}.bi-postage-heart:before{content:"\\f780"}.bi-postage:before{content:"\\f781"}.bi-postcard-fill:before{content:"\\f782"}.bi-postcard-heart-fill:before{content:"\\f783"}.bi-postcard-heart:before{content:"\\f784"}.bi-postcard:before{content:"\\f785"}.bi-search-heart-fill:before{content:"\\f786"}.bi-search-heart:before{content:"\\f787"}.bi-sliders2-vertical:before{content:"\\f788"}.bi-sliders2:before{content:"\\f789"}.bi-trash3-fill:before{content:"\\f78a"}.bi-trash3:before{content:"\\f78b"}.bi-valentine:before{content:"\\f78c"}.bi-valentine2:before{content:"\\f78d"}.bi-wrench-adjustable-circle-fill:before{content:"\\f78e"}.bi-wrench-adjustable-circle:before{content:"\\f78f"}.bi-wrench-adjustable:before{content:"\\f790"}.bi-filetype-json:before{content:"\\f791"}.bi-filetype-pptx:before{content:"\\f792"}.bi-filetype-xlsx:before{content:"\\f793"}.bi-1-circle-fill:before{content:"\\f796"}.bi-1-circle:before{content:"\\f797"}.bi-1-square-fill:before{content:"\\f798"}.bi-1-square:before{content:"\\f799"}.bi-2-circle-fill:before{content:"\\f79c"}.bi-2-circle:before{content:"\\f79d"}.bi-2-square-fill:before{content:"\\f79e"}.bi-2-square:before{content:"\\f79f"}.bi-3-circle-fill:before{content:"\\f7a2"}.bi-3-circle:before{content:"\\f7a3"}.bi-3-square-fill:before{content:"\\f7a4"}.bi-3-square:before{content:"\\f7a5"}.bi-4-circle-fill:before{content:"\\f7a8"}.bi-4-circle:before{content:"\\f7a9"}.bi-4-square-fill:before{content:"\\f7aa"}.bi-4-square:before{content:"\\f7ab"}.bi-5-circle-fill:before{content:"\\f7ae"}.bi-5-circle:before{content:"\\f7af"}.bi-5-square-fill:before{content:"\\f7b0"}.bi-5-square:before{content:"\\f7b1"}.bi-6-circle-fill:before{content:"\\f7b4"}.bi-6-circle:before{content:"\\f7b5"}.bi-6-square-fill:before{content:"\\f7b6"}.bi-6-square:before{content:"\\f7b7"}.bi-7-circle-fill:before{content:"\\f7ba"}.bi-7-circle:before{content:"\\f7bb"}.bi-7-square-fill:before{content:"\\f7bc"}.bi-7-square:before{content:"\\f7bd"}.bi-8-circle-fill:before{content:"\\f7c0"}.bi-8-circle:before{content:"\\f7c1"}.bi-8-square-fill:before{content:"\\f7c2"}.bi-8-square:before{content:"\\f7c3"}.bi-9-circle-fill:before{content:"\\f7c6"}.bi-9-circle:before{content:"\\f7c7"}.bi-9-square-fill:before{content:"\\f7c8"}.bi-9-square:before{content:"\\f7c9"}.bi-airplane-engines-fill:before{content:"\\f7ca"}.bi-airplane-engines:before{content:"\\f7cb"}.bi-airplane-fill:before{content:"\\f7cc"}.bi-airplane:before{content:"\\f7cd"}.bi-alexa:before{content:"\\f7ce"}.bi-alipay:before{content:"\\f7cf"}.bi-android:before{content:"\\f7d0"}.bi-android2:before{content:"\\f7d1"}.bi-box-fill:before{content:"\\f7d2"}.bi-box-seam-fill:before{content:"\\f7d3"}.bi-browser-chrome:before{content:"\\f7d4"}.bi-browser-edge:before{content:"\\f7d5"}.bi-browser-firefox:before{content:"\\f7d6"}.bi-browser-safari:before{content:"\\f7d7"}.bi-c-circle-fill:before{content:"\\f7da"}.bi-c-circle:before{content:"\\f7db"}.bi-c-square-fill:before{content:"\\f7dc"}.bi-c-square:before{content:"\\f7dd"}.bi-capsule-pill:before{content:"\\f7de"}.bi-capsule:before{content:"\\f7df"}.bi-car-front-fill:before{content:"\\f7e0"}.bi-car-front:before{content:"\\f7e1"}.bi-cassette-fill:before{content:"\\f7e2"}.bi-cassette:before{content:"\\f7e3"}.bi-cc-circle-fill:before{content:"\\f7e6"}.bi-cc-circle:before{content:"\\f7e7"}.bi-cc-square-fill:before{content:"\\f7e8"}.bi-cc-square:before{content:"\\f7e9"}.bi-cup-hot-fill:before{content:"\\f7ea"}.bi-cup-hot:before{content:"\\f7eb"}.bi-currency-rupee:before{content:"\\f7ec"}.bi-dropbox:before{content:"\\f7ed"}.bi-escape:before{content:"\\f7ee"}.bi-fast-forward-btn-fill:before{content:"\\f7ef"}.bi-fast-forward-btn:before{content:"\\f7f0"}.bi-fast-forward-circle-fill:before{content:"\\f7f1"}.bi-fast-forward-circle:before{content:"\\f7f2"}.bi-fast-forward-fill:before{content:"\\f7f3"}.bi-fast-forward:before{content:"\\f7f4"}.bi-filetype-sql:before{content:"\\f7f5"}.bi-fire:before{content:"\\f7f6"}.bi-google-play:before{content:"\\f7f7"}.bi-h-circle-fill:before{content:"\\f7fa"}.bi-h-circle:before{content:"\\f7fb"}.bi-h-square-fill:before{content:"\\f7fc"}.bi-h-square:before{content:"\\f7fd"}.bi-indent:before{content:"\\f7fe"}.bi-lungs-fill:before{content:"\\f7ff"}.bi-lungs:before{content:"\\f800"}.bi-microsoft-teams:before{content:"\\f801"}.bi-p-circle-fill:before{content:"\\f804"}.bi-p-circle:before{content:"\\f805"}.bi-p-square-fill:before{content:"\\f806"}.bi-p-square:before{content:"\\f807"}.bi-pass-fill:before{content:"\\f808"}.bi-pass:before{content:"\\f809"}.bi-prescription:before{content:"\\f80a"}.bi-prescription2:before{content:"\\f80b"}.bi-r-circle-fill:before{content:"\\f80e"}.bi-r-circle:before{content:"\\f80f"}.bi-r-square-fill:before{content:"\\f810"}.bi-r-square:before{content:"\\f811"}.bi-repeat-1:before{content:"\\f812"}.bi-repeat:before{content:"\\f813"}.bi-rewind-btn-fill:before{content:"\\f814"}.bi-rewind-btn:before{content:"\\f815"}.bi-rewind-circle-fill:before{content:"\\f816"}.bi-rewind-circle:before{content:"\\f817"}.bi-rewind-fill:before{content:"\\f818"}.bi-rewind:before{content:"\\f819"}.bi-train-freight-front-fill:before{content:"\\f81a"}.bi-train-freight-front:before{content:"\\f81b"}.bi-train-front-fill:before{content:"\\f81c"}.bi-train-front:before{content:"\\f81d"}.bi-train-lightrail-front-fill:before{content:"\\f81e"}.bi-train-lightrail-front:before{content:"\\f81f"}.bi-truck-front-fill:before{content:"\\f820"}.bi-truck-front:before{content:"\\f821"}.bi-ubuntu:before{content:"\\f822"}.bi-unindent:before{content:"\\f823"}.bi-unity:before{content:"\\f824"}.bi-universal-access-circle:before{content:"\\f825"}.bi-universal-access:before{content:"\\f826"}.bi-virus:before{content:"\\f827"}.bi-virus2:before{content:"\\f828"}.bi-wechat:before{content:"\\f829"}.bi-yelp:before{content:"\\f82a"}.bi-sign-stop-fill:before{content:"\\f82b"}.bi-sign-stop-lights-fill:before{content:"\\f82c"}.bi-sign-stop-lights:before{content:"\\f82d"}.bi-sign-stop:before{content:"\\f82e"}.bi-sign-turn-left-fill:before{content:"\\f82f"}.bi-sign-turn-left:before{content:"\\f830"}.bi-sign-turn-right-fill:before{content:"\\f831"}.bi-sign-turn-right:before{content:"\\f832"}.bi-sign-turn-slight-left-fill:before{content:"\\f833"}.bi-sign-turn-slight-left:before{content:"\\f834"}.bi-sign-turn-slight-right-fill:before{content:"\\f835"}.bi-sign-turn-slight-right:before{content:"\\f836"}.bi-sign-yield-fill:before{content:"\\f837"}.bi-sign-yield:before{content:"\\f838"}.bi-ev-station-fill:before{content:"\\f839"}.bi-ev-station:before{content:"\\f83a"}.bi-fuel-pump-diesel-fill:before{content:"\\f83b"}.bi-fuel-pump-diesel:before{content:"\\f83c"}.bi-fuel-pump-fill:before{content:"\\f83d"}.bi-fuel-pump:before{content:"\\f83e"}.bi-0-circle-fill:before{content:"\\f83f"}.bi-0-circle:before{content:"\\f840"}.bi-0-square-fill:before{content:"\\f841"}.bi-0-square:before{content:"\\f842"}.bi-rocket-fill:before{content:"\\f843"}.bi-rocket-takeoff-fill:before{content:"\\f844"}.bi-rocket-takeoff:before{content:"\\f845"}.bi-rocket:before{content:"\\f846"}.bi-stripe:before{content:"\\f847"}.bi-subscript:before{content:"\\f848"}.bi-superscript:before{content:"\\f849"}.bi-trello:before{content:"\\f84a"}.bi-envelope-at-fill:before{content:"\\f84b"}.bi-envelope-at:before{content:"\\f84c"}.bi-regex:before{content:"\\f84d"}.bi-text-wrap:before{content:"\\f84e"}.bi-sign-dead-end-fill:before{content:"\\f84f"}.bi-sign-dead-end:before{content:"\\f850"}.bi-sign-do-not-enter-fill:before{content:"\\f851"}.bi-sign-do-not-enter:before{content:"\\f852"}.bi-sign-intersection-fill:before{content:"\\f853"}.bi-sign-intersection-side-fill:before{content:"\\f854"}.bi-sign-intersection-side:before{content:"\\f855"}.bi-sign-intersection-t-fill:before{content:"\\f856"}.bi-sign-intersection-t:before{content:"\\f857"}.bi-sign-intersection-y-fill:before{content:"\\f858"}.bi-sign-intersection-y:before{content:"\\f859"}.bi-sign-intersection:before{content:"\\f85a"}.bi-sign-merge-left-fill:before{content:"\\f85b"}.bi-sign-merge-left:before{content:"\\f85c"}.bi-sign-merge-right-fill:before{content:"\\f85d"}.bi-sign-merge-right:before{content:"\\f85e"}.bi-sign-no-left-turn-fill:before{content:"\\f85f"}.bi-sign-no-left-turn:before{content:"\\f860"}.bi-sign-no-parking-fill:before{content:"\\f861"}.bi-sign-no-parking:before{content:"\\f862"}.bi-sign-no-right-turn-fill:before{content:"\\f863"}.bi-sign-no-right-turn:before{content:"\\f864"}.bi-sign-railroad-fill:before{content:"\\f865"}.bi-sign-railroad:before{content:"\\f866"}.bi-building-add:before{content:"\\f867"}.bi-building-check:before{content:"\\f868"}.bi-building-dash:before{content:"\\f869"}.bi-building-down:before{content:"\\f86a"}.bi-building-exclamation:before{content:"\\f86b"}.bi-building-fill-add:before{content:"\\f86c"}.bi-building-fill-check:before{content:"\\f86d"}.bi-building-fill-dash:before{content:"\\f86e"}.bi-building-fill-down:before{content:"\\f86f"}.bi-building-fill-exclamation:before{content:"\\f870"}.bi-building-fill-gear:before{content:"\\f871"}.bi-building-fill-lock:before{content:"\\f872"}.bi-building-fill-slash:before{content:"\\f873"}.bi-building-fill-up:before{content:"\\f874"}.bi-building-fill-x:before{content:"\\f875"}.bi-building-fill:before{content:"\\f876"}.bi-building-gear:before{content:"\\f877"}.bi-building-lock:before{content:"\\f878"}.bi-building-slash:before{content:"\\f879"}.bi-building-up:before{content:"\\f87a"}.bi-building-x:before{content:"\\f87b"}.bi-buildings-fill:before{content:"\\f87c"}.bi-buildings:before{content:"\\f87d"}.bi-bus-front-fill:before{content:"\\f87e"}.bi-bus-front:before{content:"\\f87f"}.bi-ev-front-fill:before{content:"\\f880"}.bi-ev-front:before{content:"\\f881"}.bi-globe-americas:before{content:"\\f882"}.bi-globe-asia-australia:before{content:"\\f883"}.bi-globe-central-south-asia:before{content:"\\f884"}.bi-globe-europe-africa:before{content:"\\f885"}.bi-house-add-fill:before{content:"\\f886"}.bi-house-add:before{content:"\\f887"}.bi-house-check-fill:before{content:"\\f888"}.bi-house-check:before{content:"\\f889"}.bi-house-dash-fill:before{content:"\\f88a"}.bi-house-dash:before{content:"\\f88b"}.bi-house-down-fill:before{content:"\\f88c"}.bi-house-down:before{content:"\\f88d"}.bi-house-exclamation-fill:before{content:"\\f88e"}.bi-house-exclamation:before{content:"\\f88f"}.bi-house-gear-fill:before{content:"\\f890"}.bi-house-gear:before{content:"\\f891"}.bi-house-lock-fill:before{content:"\\f892"}.bi-house-lock:before{content:"\\f893"}.bi-house-slash-fill:before{content:"\\f894"}.bi-house-slash:before{content:"\\f895"}.bi-house-up-fill:before{content:"\\f896"}.bi-house-up:before{content:"\\f897"}.bi-house-x-fill:before{content:"\\f898"}.bi-house-x:before{content:"\\f899"}.bi-person-add:before{content:"\\f89a"}.bi-person-down:before{content:"\\f89b"}.bi-person-exclamation:before{content:"\\f89c"}.bi-person-fill-add:before{content:"\\f89d"}.bi-person-fill-check:before{content:"\\f89e"}.bi-person-fill-dash:before{content:"\\f89f"}.bi-person-fill-down:before{content:"\\f8a0"}.bi-person-fill-exclamation:before{content:"\\f8a1"}.bi-person-fill-gear:before{content:"\\f8a2"}.bi-person-fill-lock:before{content:"\\f8a3"}.bi-person-fill-slash:before{content:"\\f8a4"}.bi-person-fill-up:before{content:"\\f8a5"}.bi-person-fill-x:before{content:"\\f8a6"}.bi-person-gear:before{content:"\\f8a7"}.bi-person-lock:before{content:"\\f8a8"}.bi-person-slash:before{content:"\\f8a9"}.bi-person-up:before{content:"\\f8aa"}.bi-scooter:before{content:"\\f8ab"}.bi-taxi-front-fill:before{content:"\\f8ac"}.bi-taxi-front:before{content:"\\f8ad"}.bi-amd:before{content:"\\f8ae"}.bi-database-add:before{content:"\\f8af"}.bi-database-check:before{content:"\\f8b0"}.bi-database-dash:before{content:"\\f8b1"}.bi-database-down:before{content:"\\f8b2"}.bi-database-exclamation:before{content:"\\f8b3"}.bi-database-fill-add:before{content:"\\f8b4"}.bi-database-fill-check:before{content:"\\f8b5"}.bi-database-fill-dash:before{content:"\\f8b6"}.bi-database-fill-down:before{content:"\\f8b7"}.bi-database-fill-exclamation:before{content:"\\f8b8"}.bi-database-fill-gear:before{content:"\\f8b9"}.bi-database-fill-lock:before{content:"\\f8ba"}.bi-database-fill-slash:before{content:"\\f8bb"}.bi-database-fill-up:before{content:"\\f8bc"}.bi-database-fill-x:before{content:"\\f8bd"}.bi-database-fill:before{content:"\\f8be"}.bi-database-gear:before{content:"\\f8bf"}.bi-database-lock:before{content:"\\f8c0"}.bi-database-slash:before{content:"\\f8c1"}.bi-database-up:before{content:"\\f8c2"}.bi-database-x:before{content:"\\f8c3"}.bi-database:before{content:"\\f8c4"}.bi-houses-fill:before{content:"\\f8c5"}.bi-houses:before{content:"\\f8c6"}.bi-nvidia:before{content:"\\f8c7"}.bi-person-vcard-fill:before{content:"\\f8c8"}.bi-person-vcard:before{content:"\\f8c9"}.bi-sina-weibo:before{content:"\\f8ca"}.bi-tencent-qq:before{content:"\\f8cb"}.bi-wikipedia:before{content:"\\f8cc"}.bi-alphabet-uppercase:before{content:"\\f2a5"}.bi-alphabet:before{content:"\\f68a"}.bi-amazon:before{content:"\\f68d"}.bi-arrows-collapse-vertical:before{content:"\\f690"}.bi-arrows-expand-vertical:before{content:"\\f695"}.bi-arrows-vertical:before{content:"\\f698"}.bi-arrows:before{content:"\\f6a2"}.bi-ban-fill:before{content:"\\f6a3"}.bi-ban:before{content:"\\f6b6"}.bi-bing:before{content:"\\f6c2"}.bi-cake:before{content:"\\f6e0"}.bi-cake2:before{content:"\\f6ed"}.bi-cookie:before{content:"\\f6ee"}.bi-copy:before{content:"\\f759"}.bi-crosshair:before{content:"\\f769"}.bi-crosshair2:before{content:"\\f794"}.bi-emoji-astonished-fill:before{content:"\\f795"}.bi-emoji-astonished:before{content:"\\f79a"}.bi-emoji-grimace-fill:before{content:"\\f79b"}.bi-emoji-grimace:before{content:"\\f7a0"}.bi-emoji-grin-fill:before{content:"\\f7a1"}.bi-emoji-grin:before{content:"\\f7a6"}.bi-emoji-surprise-fill:before{content:"\\f7a7"}.bi-emoji-surprise:before{content:"\\f7ac"}.bi-emoji-tear-fill:before{content:"\\f7ad"}.bi-emoji-tear:before{content:"\\f7b2"}.bi-envelope-arrow-down-fill:before{content:"\\f7b3"}.bi-envelope-arrow-down:before{content:"\\f7b8"}.bi-envelope-arrow-up-fill:before{content:"\\f7b9"}.bi-envelope-arrow-up:before{content:"\\f7be"}.bi-feather:before{content:"\\f7bf"}.bi-feather2:before{content:"\\f7c4"}.bi-floppy-fill:before{content:"\\f7c5"}.bi-floppy:before{content:"\\f7d8"}.bi-floppy2-fill:before{content:"\\f7d9"}.bi-floppy2:before{content:"\\f7e4"}.bi-gitlab:before{content:"\\f7e5"}.bi-highlighter:before{content:"\\f7f8"}.bi-marker-tip:before{content:"\\f802"}.bi-nvme-fill:before{content:"\\f803"}.bi-nvme:before{content:"\\f80c"}.bi-opencollective:before{content:"\\f80d"}.bi-pci-card-network:before{content:"\\f8cd"}.bi-pci-card-sound:before{content:"\\f8ce"}.bi-radar:before{content:"\\f8cf"}.bi-send-arrow-down-fill:before{content:"\\f8d0"}.bi-send-arrow-down:before{content:"\\f8d1"}.bi-send-arrow-up-fill:before{content:"\\f8d2"}.bi-send-arrow-up:before{content:"\\f8d3"}.bi-sim-slash-fill:before{content:"\\f8d4"}.bi-sim-slash:before{content:"\\f8d5"}.bi-sourceforge:before{content:"\\f8d6"}.bi-substack:before{content:"\\f8d7"}.bi-threads-fill:before{content:"\\f8d8"}.bi-threads:before{content:"\\f8d9"}.bi-transparency:before{content:"\\f8da"}.bi-twitter-x:before{content:"\\f8db"}.bi-type-h4:before{content:"\\f8dc"}.bi-type-h5:before{content:"\\f8dd"}.bi-type-h6:before{content:"\\f8de"}.bi-backpack-fill:before{content:"\\f8df"}.bi-backpack:before{content:"\\f8e0"}.bi-backpack2-fill:before{content:"\\f8e1"}.bi-backpack2:before{content:"\\f8e2"}.bi-backpack3-fill:before{content:"\\f8e3"}.bi-backpack3:before{content:"\\f8e4"}.bi-backpack4-fill:before{content:"\\f8e5"}.bi-backpack4:before{content:"\\f8e6"}.bi-brilliance:before{content:"\\f8e7"}.bi-cake-fill:before{content:"\\f8e8"}.bi-cake2-fill:before{content:"\\f8e9"}.bi-duffle-fill:before{content:"\\f8ea"}.bi-duffle:before{content:"\\f8eb"}.bi-exposure:before{content:"\\f8ec"}.bi-gender-neuter:before{content:"\\f8ed"}.bi-highlights:before{content:"\\f8ee"}.bi-luggage-fill:before{content:"\\f8ef"}.bi-luggage:before{content:"\\f8f0"}.bi-mailbox-flag:before{content:"\\f8f1"}.bi-mailbox2-flag:before{content:"\\f8f2"}.bi-noise-reduction:before{content:"\\f8f3"}.bi-passport-fill:before{content:"\\f8f4"}.bi-passport:before{content:"\\f8f5"}.bi-person-arms-up:before{content:"\\f8f6"}.bi-person-raised-hand:before{content:"\\f8f7"}.bi-person-standing-dress:before{content:"\\f8f8"}.bi-person-standing:before{content:"\\f8f9"}.bi-person-walking:before{content:"\\f8fa"}.bi-person-wheelchair:before{content:"\\f8fb"}.bi-shadows:before{content:"\\f8fc"}.bi-suitcase-fill:before{content:"\\f8fd"}.bi-suitcase-lg-fill:before{content:"\\f8fe"}.bi-suitcase-lg:before{content:"\\f8ff"}.bi-suitcase:before{content:"\\f900"}.bi-suitcase2-fill:before{content:"\\f901"}.bi-suitcase2:before{content:"\\f902"}.bi-vignette:before{content:"\\f903"}foreignObject.loci{box-sizing:border-box;border-radius:.375rem;position:relative;display:block}foreignObject.loci div.foreground{position:relative;display:flex;height:100%;width:100%;justify-content:center;align-items:center;box-sizing:inherit;border-radius:inherit;border-width:1px;border-style:solid;opacity:1}foreignObject.loci div.background{position:absolute;left:0;top:0;display:block;height:100%;width:100%;opacity:.3}foreignObject.pins div.foreground{position:relative;display:flex;height:100%;width:100%;justify-content:center;align-items:flex-end;box-sizing:border-box}foreignObject.dssp div.foreground{position:relative;display:flex;height:100%;width:100%;justify-content:center;align-items:flex-end;box-sizing:border-box}foreignObject.dssp i[class^=dssp]{position:relative;visibility:hidden;display:flex;height:100%;width:100%}foreignObject.dssp i.dssp-helix{visibility:visible;background-color:inherit;-webkit-mask-image:url(dssp-helix.74d0a47e4d7ed27e.svg);mask-image:url(dssp-helix.74d0a47e4d7ed27e.svg);-webkit-mask-position:0 center;mask-position:0 center;-webkit-mask-size:auto 100%;mask-size:auto 100%}foreignObject.dssp i.dssp-strand{display:flex;visibility:hidden}foreignObject.dssp i.dssp-strand:before{visibility:visible;background-color:inherit;-webkit-mask-image:url(dssp-strand-tail.783864b28823e2c7.svg);mask-image:url(dssp-strand-tail.783864b28823e2c7.svg);-webkit-mask-position:0 center;mask-position:0 center;-webkit-mask-size:auto 100%;mask-size:auto 100%;flex-shrink:1;flex-grow:1;content:""}foreignObject.dssp i.dssp-strand:after{visibility:visible;background-color:inherit;-webkit-mask-image:url(dssp-strand-head.85a295955fb4c220.svg);mask-image:url(dssp-strand-head.85a295955fb4c220.svg);-webkit-mask-position:0 center;mask-position:0 center;-webkit-mask-size:auto 100%;mask-size:auto 100%;flex-shrink:0;flex-grow:0;content:"";width:31px}.axis-grid line{stroke-opacity:.3;stroke:gray}.axis-grid line:nth-child(1){stroke-dasharray:2}.y.axis .tick text{display:none}\n'],encapsulation:2})}return e})();const Axt={providers:[function MPe(e,...t){return Iy([{provide:Ob,multi:!0,useValue:e},[],{provide:Rb,useFactory:yZ,deps:[Kl]},{provide:OA,multi:!0,useFactory:bZ},t.map(n=>n.\u0275providers)])}([{path:"structure",component:Lyt},{path:"feature",component:(()=>{class e{constructor(){this.settings={"line-height":24,"content-size":16,"background-color":"transparent","trace-color":"pink","grid-color":"white","margin-top":24,"margin-right":24,"margin-bottom":24,"margin-left":128},this.sequence=["M","E","E","P","Q"],this.features=[{label:"Feature #1",type:"continuous",values:[1.2,2.7,5.4,2.8,3.7]},{label:"Feature #2",type:"loci",values:[{start:1,end:3},{start:4,end:5}]},{label:"Feature #3",type:"trace",position:"overlap",values:[{type:"loci",values:[{start:3,end:5}]},{type:"loci",values:[{start:1,end:4}]},{type:"continuous",values:[3.2,1.1,.7,.9,2.2]}]},{label:"Feature #4",type:"loci",values:[{start:1,end:2},{start:3,end:4}],nested:[{label:"Feature #5",type:"trace",values:[{type:"loci",values:[{start:1,end:1},{start:2,end:5}]},{type:"loci",values:[{start:2,end:4}]}]},{label:"Feature #6",type:"continuous",values:[.2,1.1,3.7,2.8,2.9]}]}]}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275cmp=Mu({type:e,selectors:[["page-features-viewer"]],standalone:!0,features:[Nu],decls:14,vars:3,consts:[[1,"container","pt-3"],[1,"mb-3"],[1,"d-flex","flex-row","gap-3","mb-3"],[2,"display","block","width","1rem","height","1rem","background","black","font-size","1rem","line-height","1rem"],[2,"display","block","width","1rem","height","auto","background","black","color","white","font-size","1rem","line-height",".5rem"],[2,"display","block","width","auto","height","1rem","background","black","color","white","font-size","1rem","line-height","1rem"],[2,"display","block","height","auto","width","100%"],[3,"sequence","features","settings"]],template:function(r,i){1&r&&(dn(0,"div",0)(1,"div",1)(2,"h1"),ar(3,"Feature viewer"),fn(),dn(4,"p"),ar(5," The feature viewer allows you to represent features on a reference seqeunce... "),fn()(),dn(6,"div",2),gi(7,"div",3),dn(8,"div",4),ar(9,"W"),fn(),dn(10,"div",5),ar(11,"W"),fn()(),dn(12,"div",6),gi(13,"ngx-features-viewer",7),fn()()),2&r&&(mi(13),Bh("sequence",i.sequence)("features",i.features)("settings",i.settings))},dependencies:[Uh,wxt],changeDetection:0})}return e})()},{path:"",component:(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275cmp=Mu({type:e,selectors:[["page-home"]],standalone:!0,features:[Nu],decls:48,vars:0,consts:[[1,"container","pt-3"],[1,"row"],[1,"col-12"],[1,"mb-3"],[1,"row","align-items-stretch","mb-3"],[1,"col-4"],["routerLink","/structure",1,"product-card","rounded","bg-body-tertiary","p-3","mb-3"],[1,"bi","bi-boxes","me-3"],["src","assets/structure-viewer.png","alt","Structure viewer",1,"w-100","h-auto","mb-3"],[1,"text-justify","mb-3"],[1,"text-center","mt-auto"],[1,"badge","rounded-pill","text-bg-warning"],[1,"bi","bi-chevron-right"],[1,"col-4","product"],["routerLink","/feature",1,"product-card","rounded","bg-body-tertiary","p-3","mb-3"],[1,"bi","bi-sliders"],["routerLink","/sequence",1,"product-card","rounded","bg-body-tertiary","p-3","mb-3"],[1,"bi","bi-body-text"],[1,"rounded","bg-body-tertiary","shadow-sm","p-3","mb-3"],[1,"bi","bi-share-fill"]],template:function(r,i){1&r&&(dn(0,"div",0)(1,"div",1)(2,"div",2)(3,"h1",3),ar(4,"Products"),fn()()(),dn(5,"div",4)(6,"div",5)(7,"div",6)(8,"h2"),gi(9,"i",7),ar(10," Structure viewer "),fn(),gi(11,"img",8),dn(12,"p",9),ar(13," Visualize and interact with 3D molecular structures. Provides Mol* functionalities out-of-the-box for Angular developers. "),fn(),dn(14,"div",10)(15,"span",11),ar(16," Try it out "),gi(17,"i",12),fn()()()(),dn(18,"div",13)(19,"div",14)(20,"h2"),gi(21,"i",15),ar(22," Feature viewer "),fn(),dn(23,"p",3),ar(24," The feature viewer is a powerful tool designed for visualizing features of biological sequences, such as proteins, DNA, or RNA. It provides a comprehensive set of functionalities to explore and analyze these sequences. With the feature viewer, users can easily identify and visualize various features, including structural elements, functional domains, mutations, and more. It offers a user-friendly interface with intuitive gestures and actions, allowing users to zoom in and out, pan across the sequence, highlight specific regions, and perform interactive selections. Whether you are a biologist, bioinformatician, or researcher, the feature viewer is an indispensable tool for gaining insights into the intricate details of biological sequences. "),fn(),dn(25,"div",10)(26,"span",11),ar(27," Try it out "),gi(28,"i",12),fn()()()(),dn(29,"div",5)(30,"div",16)(31,"h2"),gi(32,"i",17),ar(33," Sequence viewer "),fn(),dn(34,"p",3),ar(35," The sequence viewer is a specialized tool designed for visualizing multiple sequence alignments and other features across protein sequences. It provides a comprehensive view of the similarities and differences between multiple protein sequences, allowing users to easily identify conserved regions, mutations, and other important features. The sequence viewer supports various display options, enabling users to customize the view according to their needs. It also allows for interactive exploration, with features such as zooming and panning, highlighting specific regions, and hovering over specific points for more detailed information. This makes the sequence viewer an essential tool for bioinformaticians and researchers studying protein sequences and their relationships. "),fn(),dn(36,"div",10)(37,"span",11),ar(38," Try it out "),gi(39,"i",12),fn()()()()(),dn(40,"div",1)(41,"div",2)(42,"div",18)(43,"h2"),gi(44,"i",19),ar(45," Enhanced interactivity"),fn(),dn(46,"p"),ar(47," Our components are designed starting from the same, generic data structures. This is meant to easily wire up various compoents in the same page. Hence, implementing interactivity out-of-the-box "),fn()()()()())},dependencies:[Uh,GF,TI],styles:[".product-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:nowrap;height:100%;width:100%;cursor:pointer;box-shadow:0 .125rem .25rem #00000013}.product-card[_ngcontent-%COMP%]:hover{box-shadow:0 .5rem 1rem #00000026}"]})}return e})()},{path:"**",redirectTo:""}])]};(function hDe(e,t){return DAe({rootComponent:e,...YX(t)})})((()=>{class e{constructor(){this.title="ngx-bio-tools",this.sequence="MLPGLALLLLAAWTARALEVPTDGNAGLLAEPQIAMFCGRLNMHMNVQNGKWDSDPSGTKTCIDTKEGILQYCQEVYPELQITNVVEANQPVTIQNWCKRGRKQCKTHPHFVIPYRCLVGEFVSDALLVPDKCKFLHQERMDVCETHLHWHTVAKETCSEKSTNLHDYGMLLPCGIDKFRGVEFVCCPLAEESDNVDSADAEEDDSDVWWGGADTDYADGSEDKVVEVAEEEEVAEVEEEEADDDEDDEDGDEVEEEAEEPYEEATERTTSIATTTTTTTESVEEVVREVCSEQAETGPCRAMISRWYFDVTEGKCAPFFYGGCGGNRNNFDTEEYCMAVCGSAMSQSLLKTTQEPLARDPVKLPTTAASTPDAVDKYLETPGDENEHAHFQKAKERLEAKHRERMSQVMREWEEAERQAKNLPKADKKAVIQHFQEKVESLEQEAANERQQLVETHMARVEAMLNDRRRLALENYITALQAVPPRPRHVFNMLKKYVRAEQKDRQHTLKHFEHVRMVDPKKAAQIRSQVMTHLRVIYERMNQSLSLLYNVPAVAEEIQDEVDELLQKEQNYSDDVLANMISEPRISYGNDALMPSLTETKTTVELLPVNGEFSLDDLQPWHSFGADSVPANTENEVEPVDARPAADRGLTTRPGSGLTNIKTEEISEVKMDAEFRHDSGYEVHHQKLVFFAEDVGSNKGAIIGLMVGGVVIATVIVITLVMLKKKQYTSIHHGVVEVDAAVTPEERHLSKMQQNGYENPTYKFFEQMQN".split(""),this.features=[{id:0,type:"continuous",color:"blue",values:this.sequence.map(()=>Math.random()),parent:void 0,height:128},{id:1,type:"loci",color:"red",values:[{start:1,end:3},{start:5,end:6}],parent:void 0,height:96},{id:2,type:"pins",color:"green",values:[{start:5},{start:100,color:"blue"},{start:400,color:"red"}],parent:1},{id:3,type:"loci",color:"orange",values:[{start:10,end:20},{start:30,end:70}],parent:1},{id:4,type:"loci",color:"purple",values:[{start:100,end:300}],parent:void 0},{id:5,type:"dssp",color:"black",values:[{start:30,end:90,code:"H",color:"orange"},{start:120,end:300,code:"E",color:"purple"}],parent:void 0}]}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275cmp=Mu({type:e,selectors:[["app-root"]],standalone:!0,features:[Nu],decls:17,vars:0,consts:[[1,"navbar"],[1,"container-fluid"],["href","#",1,"navbar-brand"],["src","assets/ngx-biocomp-up-white.svg","alt","ngx-biocomp-up","height","32",1,"d-inline-block","align-text-top"],[1,"container-fluid","bg-dark","pt-2","pb-2"],[1,"row"],[1,"col-3","d-flex","justify-content-start"],["src","assets/biocomp.svg","alt","BioComputing UP","height","36"],[1,"col-6","d-flex","align-items-center","justify-content-center"],["href","https://github.com/damiclem",1,"text-light","small"],[1,"bi","bi-github"],[1,"col-3","d-flex","justify-content-end"],["src","assets/unipd.svg","alt","University of Padua","height","36"]],template:function(r,i){1&r&&(dn(0,"header")(1,"nav",0)(2,"div",1)(3,"a",2),gi(4,"img",3),fn()()()(),dn(5,"main"),gi(6,"router-outlet"),fn(),dn(7,"footer",4)(8,"div",5)(9,"div",6),gi(10,"img",7),fn(),dn(11,"div",8)(12,"a",9),ar(13," Developed by Damiano Clementel "),gi(14,"i",10),fn()(),dn(15,"div",11),gi(16,"img",12),fn()()())},dependencies:[Uh,GF,MF],styles:["[_nghost-%COMP%]{height:inherit;display:inherit;flex-direction:inherit}"]})}return e})(),Axt).catch(e=>console.error(e))},684:r_=>{r_.exports=XMLHttpRequest}},r_=>{r_(r_.s=540)}]); \ No newline at end of file diff --git a/docs/main.499b822249ee9dca.js b/docs/main.499b822249ee9dca.js new file mode 100644 index 0000000..ff08084 --- /dev/null +++ b/docs/main.499b822249ee9dca.js @@ -0,0 +1 @@ +(self.webpackChunkdemo_showcase=self.webpackChunkdemo_showcase||[]).push([[792],{273:(ga,an,ln)=>{"use strict";var Wr={};ln.r(Wr),ln.d(Wr,{atomicHet:()=>Hje,atomicSequence:()=>zje,bundleElementImpl:()=>aae,bundleGenerator:()=>lae,defaultBondTest:()=>Sz,spheres:()=>Gje,water:()=>Vje});var Ms={};ln.r(Ms),ln.d(Ms,{all:()=>uae,atoms:()=>Iz,bondedAtomicPairs:()=>eUe,chains:()=>$je,none:()=>Az,querySelection:()=>Jje,residues:()=>Wje,rings:()=>Qje});var Ki={};ln.r(Ki),ln.d(Ki,{exceptBy:()=>O7e,expandProperty:()=>L7e,includeConnected:()=>j7e,includeSurroundings:()=>R7e,intersectBy:()=>F7e,querySelection:()=>N7e,surroundingLigands:()=>z7e,union:()=>B7e,wholeResidues:()=>P7e});var At={};ln.r(At),ln.d(At,{areIntersectedBy:()=>J7e,first:()=>K7e,getCurrentStructureProperties:()=>E5,isConnectedTo:()=>oVe,pick:()=>X7e,withSameAtomProperties:()=>Q7e,within:()=>eVe});var Ma={};ln.r(Ma),ln.d(Ma,{intersect:()=>aVe,merge:()=>sVe});var rs={};ln.r(rs),ln.d(rs,{atomCount:()=>lVe,countQuery:()=>cVe,propertySet:()=>uVe});var Ci={};ln.r(Ci),ln.d(Ci,{Download:()=>Pue,DownloadBlob:()=>kue,ImportJson:()=>nWe,ImportString:()=>tWe,LazyVolume:()=>iWe,ParseBlob:()=>qqe,ParseCcp4:()=>Qqe,ParseCif:()=>Wqe,ParseCube:()=>$qe,ParseDsn6:()=>Jqe,ParseDx:()=>eWe,ParseJson:()=>rWe,ParsePly:()=>Zqe,ParsePrmtop:()=>Xqe,ParsePsf:()=>Yqe,ParseTop:()=>Kqe,RawData:()=>Mue,ReadFile:()=>Rue});var rr={};ln.r(rr),ln.d(rr,{CreateGroup:()=>oWe});var or={};ln.r(or),ln.d(or,{CoordinatesFromDcd:()=>Wtt,CoordinatesFromNctraj:()=>Xtt,CoordinatesFromTrr:()=>Ytt,CoordinatesFromXtc:()=>$tt,CustomModelProperties:()=>xpe,CustomStructureProperties:()=>Spe,ModelFromTrajectory:()=>mpe,MultiStructureSelectionFromExpression:()=>gnt,ShapeFromPly:()=>Snt,StructureComplexElement:()=>xnt,StructureComplexElementTypes:()=>vpe,StructureComponent:()=>_nt,StructureFromModel:()=>pnt,StructureFromTrajectory:()=>fnt,StructureSelectionFromBundle:()=>bnt,StructureSelectionFromExpression:()=>mnt,StructureSelectionFromScript:()=>ynt,TopologyFromPrmtop:()=>Ztt,TopologyFromPsf:()=>Ktt,TopologyFromTop:()=>Qtt,TrajectoryFromBlob:()=>ent,TrajectoryFromCifCore:()=>cnt,TrajectoryFromCube:()=>lnt,TrajectoryFromGRO:()=>rnt,TrajectoryFromMOL:()=>ont,TrajectoryFromMOL2:()=>ant,TrajectoryFromMmCif:()=>tnt,TrajectoryFromModelAndCoordinates:()=>JH,TrajectoryFromPDB:()=>nnt,TrajectoryFromSDF:()=>snt,TrajectoryFromXYZ:()=>int,TransformStructureConformation:()=>hnt});var kr={};ln.r(kr),ln.d(kr,{AssignColorVolume:()=>Fnt,VolumeFromCcp4:()=>Dnt,VolumeFromCube:()=>knt,VolumeFromDensityServerCif:()=>Rnt,VolumeFromDsn6:()=>Pnt,VolumeFromDx:()=>Mnt,VolumeFromSegmentationCif:()=>Nnt});var lr={};ln.r(lr),ln.d(lr,{BoxShape3D:()=>sat,getBoxMesh:()=>LG});var Rs={};ln.r(Rs),ln.d(Rs,{ClippingStructureRepresentation3DFromBundle:()=>wat,ClippingStructureRepresentation3DFromScript:()=>Cat,ExplodeStructureRepresentation3D:()=>mat,ModelUnitcell3D:()=>Tat,OverpaintStructureRepresentation3DFromBundle:()=>bat,OverpaintStructureRepresentation3DFromScript:()=>yat,ShapeRepresentation3D:()=>Eat,SpinStructureRepresentation3D:()=>gat,StructureBoundingBox3D:()=>Dat,StructureRepresentation3D:()=>hF,StructureSelectionsAngle3D:()=>kat,StructureSelectionsDihedral3D:()=>Mat,StructureSelectionsDistance3D:()=>Pat,StructureSelectionsLabel3D:()=>Rat,StructureSelectionsOrientation3D:()=>Nat,StructureSelectionsPlane3D:()=>Fat,SubstanceStructureRepresentation3DFromBundle:()=>Sat,SubstanceStructureRepresentation3DFromScript:()=>_at,ThemeStrengthRepresentation3D:()=>Aat,TransparencyStructureRepresentation3DFromBundle:()=>xat,TransparencyStructureRepresentation3DFromScript:()=>vat,UnwindStructureAssemblyRepresentation3D:()=>hat,VolumeRepresentation3D:()=>Iat,VolumeRepresentation3DHelpers:()=>Eg});var zo={};ln.r(zo),ln.d(zo,{ApplyAction:()=>Oge,ClearHighlights:()=>zge,Highlight:()=>Uge,RemoveObject:()=>Bge,SetCurrentObject:()=>Nge,Snapshots:()=>Vge,SyncBehaviors:()=>Rge,ToggleExpanded:()=>Lge,ToggleVisibility:()=>jge,Update:()=>Fge,registerDefault:()=>Vct,setSubtreeVisibility:()=>G_});var xr={};ln.r(xr),ln.d(xr,{SyncRepresentationToCanvas:()=>Hge,SyncStructureRepresentation3DState:()=>Gge,UpdateRepresentationVisibility:()=>qge,registerDefault:()=>Gct});var ea={};ln.r(ea),ln.d(ea,{Focus:()=>Yge,OrientAxes:()=>Xge,Reset:()=>Wge,ResetAxes:()=>Kge,SetSnapshot:()=>$ge,registerDefault:()=>qct});var ta={};ln.r(ta),ln.d(ta,{Canvas3DSetSettings:()=>G0e,registerDefault:()=>Xft});var vi={};ln.r(vi),ln.d(vi,{DefaultFocusLociBindings:()=>$0e,DefaultLociLabelProvider:()=>ept,DefaultSelectLociBindings:()=>q0e,FocusLoci:()=>OF,HighlightLoci:()=>Qft,SelectLoci:()=>W0e});var to={};ln.r(to),ln.d(to,{CameraAxisHelper:()=>ipt,CameraControls:()=>spt,DefaultClickResetCameraOnEmpty:()=>Vq,DefaultClickResetCameraOnEmptySelectMode:()=>Hq,DefaultFocusLociBindings:()=>Y0e,FocusLoci:()=>rpt});var Ul={};ln.r(Ul),ln.d(Ul,{AccessibleSurfaceArea:()=>gpt,BestDatabaseSequenceMapping:()=>Dgt,CrossLinkRestraint:()=>qgt,Interactions:()=>wgt,SecondaryStructure:()=>Agt,StructureInfo:()=>apt,ValenceModel:()=>Igt});var Cc={};ln.r(Cc),ln.d(Cc,{AddTrajectory:()=>D0t,DownloadStructure:()=>C0t,EnableModelCustomProps:()=>E0t,EnableStructureCustomProps:()=>T0t,LoadTrajectory:()=>P0t,PdbDownloadProvider:()=>Sbe,UpdateTrajectory:()=>sO});var wc={};ln.r(wc),ln.d(wc,{AssignColorVolume:()=>Cbe,DownloadDensity:()=>k0t});var Ss={};ln.r(Ss),ln.d(Ss,{DownloadFile:()=>M0t,OpenFiles:()=>NW});var Cs={};ln.r(Cs),ln.d(Cs,{boolean:()=>di,booleanish:()=>wl,commaOrSpaceSeparated:()=>Lf,commaSeparated:()=>xI,number:()=>en,overloadedBoolean:()=>Jxe,spaceSeparated:()=>xs});var Al={};function Ac(e,t,n,r,i,o,s){try{var a=e[o](s),l=a.value}catch(c){return void n(c)}a.done?t(l):Promise.resolve(l).then(r,i)}function le(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(l){Ac(o,r,i,s,a,"next",l)}function a(l){Ac(o,r,i,s,a,"throw",l)}s(void 0)})}}ln.r(Al),ln.d(Al,{attentionMarkers:()=>yIt,contentInitial:()=>dIt,disable:()=>bIt,document:()=>uIt,flow:()=>pIt,flowInitial:()=>fIt,insideSpan:()=>gIt,string:()=>hIt,text:()=>mIt});let Zi=null,fr=1;const no=Symbol("SIGNAL");function hr(e){const t=Zi;return Zi=e,t}function fi(e){if((!xm(e)||e.dirty)&&(e.dirty||e.lastCleanEpoch!==fr)){if(!e.producerMustRecompute(e)&&!Ic(e))return e.dirty=!1,void(e.lastCleanEpoch=fr);e.producerRecomputeValue(e),e.dirty=!1,e.lastCleanEpoch=fr}}function Ic(e){Jg(e);for(let t=0;t0}function Jg(e){e.producerNode??=[],e.producerIndexOfThis??=[],e.producerLastReadVersion??=[]}let hb=null;function Yo(e){return"function"==typeof e}function Tv(e){const n=e(r=>{Error.call(r),r.stack=(new Error).stack});return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}const Dv=Tv(e=>function(n){e(this),this.message=n?`${n.length} errors occurred during unsubscription:\n${n.map((r,i)=>`${i+1}) ${r.toString()}`).join("\n ")}`:"",this.name="UnsubscriptionError",this.errors=n});function mb(e,t){if(e){const n=e.indexOf(t);0<=n&&e.splice(n,1)}}class Il{constructor(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let t;if(!this.closed){this.closed=!0;const{_parentage:n}=this;if(n)if(this._parentage=null,Array.isArray(n))for(const o of n)o.remove(this);else n.remove(this);const{initialTeardown:r}=this;if(Yo(r))try{r()}catch(o){t=o instanceof Dv?o.errors:[o]}const{_finalizers:i}=this;if(i){this._finalizers=null;for(const o of i)try{n0(o)}catch(s){t=t??[],s instanceof Dv?t=[...t,...s.errors]:t.push(s)}}if(t)throw new Dv(t)}}add(t){var n;if(t&&t!==this)if(this.closed)n0(t);else{if(t instanceof Il){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}}_hasParent(t){const{_parentage:n}=this;return n===t||Array.isArray(n)&&n.includes(t)}_addParent(t){const{_parentage:n}=this;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t}_removeParent(t){const{_parentage:n}=this;n===t?this._parentage=null:Array.isArray(n)&&mb(n,t)}remove(t){const{_finalizers:n}=this;n&&mb(n,t),t instanceof Il&&t._removeParent(this)}}Il.EMPTY=(()=>{const e=new Il;return e.closed=!0,e})();const $2=Il.EMPTY;function t0(e){return e instanceof Il||e&&"closed"in e&&Yo(e.remove)&&Yo(e.add)&&Yo(e.unsubscribe)}function n0(e){Yo(e)?e():e.unsubscribe()}const _m={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Pv={setTimeout(e,t,...n){const{delegate:r}=Pv;return r?.setTimeout?r.setTimeout(e,t,...n):setTimeout(e,t,...n)},clearTimeout(e){const{delegate:t}=Pv;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function qI(e){Pv.setTimeout(()=>{const{onUnhandledError:t}=_m;if(!t)throw e;t(e)})}function kv(){}const Ek=r0("C",void 0,void 0);function r0(e,t,n){return{kind:e,value:t,error:n}}let oh=null;function Sm(e){if(_m.useDeprecatedSynchronousErrorHandling){const t=!oh;if(t&&(oh={errorThrown:!1,error:null}),e(),t){const{errorThrown:n,error:r}=oh;if(oh=null,n)throw r}}else e()}class o0 extends Il{constructor(t){super(),this.isStopped=!1,t?(this.destination=t,t0(t)&&t.add(this)):this.destination=Dk}static create(t,n,r){return new Mv(t,n,r)}next(t){this.isStopped?sh(function Tk(e){return r0("N",e,void 0)}(t),this):this._next(t)}error(t){this.isStopped?sh(function WI(e){return r0("E",void 0,e)}(t),this):(this.isStopped=!0,this._error(t))}complete(){this.isStopped?sh(Ek,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(t){this.destination.next(t)}_error(t){try{this.destination.error(t)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}}const Y2=Function.prototype.bind;function gb(e,t){return Y2.call(e,t)}class $I{constructor(t){this.partialObserver=t}next(t){const{partialObserver:n}=this;if(n.next)try{n.next(t)}catch(r){X2(r)}}error(t){const{partialObserver:n}=this;if(n.error)try{n.error(t)}catch(r){X2(r)}else X2(t)}complete(){const{partialObserver:t}=this;if(t.complete)try{t.complete()}catch(n){X2(n)}}}class Mv extends o0{constructor(t,n,r){let i;if(super(),Yo(t)||!t)i={next:t??void 0,error:n??void 0,complete:r??void 0};else{let o;this&&_m.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=()=>this.unsubscribe(),i={next:t.next&&gb(t.next,o),error:t.error&&gb(t.error,o),complete:t.complete&&gb(t.complete,o)}):i=t}this.destination=new $I(i)}}function X2(e){_m.useDeprecatedSynchronousErrorHandling?function aL(e){_m.useDeprecatedSynchronousErrorHandling&&oh&&(oh.errorThrown=!0,oh.error=e)}(e):qI(e)}function sh(e,t){const{onStoppedNotification:n}=_m;n&&Pv.setTimeout(()=>n(e,t))}const Dk={closed:!0,next:kv,error:function lL(e){throw e},complete:kv},K2="function"==typeof Symbol&&Symbol.observable||"@@observable";function ah(e){return e}function YI(...e){return XI(e)}function XI(e){return 0===e.length?ah:1===e.length?e[0]:function(n){return e.reduce((r,i)=>i(r),n)}}let Ra=(()=>{class e{constructor(n){n&&(this._subscribe=n)}lift(n){const r=new e;return r.source=this,r.operator=n,r}subscribe(n,r,i){const o=function uL(e){return e&&e instanceof o0||function cL(e){return e&&Yo(e.next)&&Yo(e.error)&&Yo(e.complete)}(e)&&t0(e)}(n)?n:new Mv(n,r,i);return Sm(()=>{const{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(n){try{return this._subscribe(n)}catch(r){n.error(r)}}forEach(n,r){return new(r=KI(r))((i,o)=>{const s=new Mv({next:a=>{try{n(a)}catch(l){o(l),s.unsubscribe()}},error:o,complete:i});this.subscribe(s)})}_subscribe(n){var r;return null===(r=this.source)||void 0===r?void 0:r.subscribe(n)}[K2](){return this}pipe(...n){return XI(n)(this)}toPromise(n){return new(n=KI(n))((r,i)=>{let o;this.subscribe(s=>o=s,s=>i(s),()=>r(o))})}}return e.create=t=>new e(t),e})();function KI(e){var t;return null!==(t=e??_m.Promise)&&void 0!==t?t:Promise}const na=Tv(e=>function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});let si=(()=>{class e extends Ra{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(n){const r=new Z2(this,this);return r.operator=n,r}_throwIfClosed(){if(this.closed)throw new na}next(n){Sm(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(const r of this.currentObservers)r.next(n)}})}error(n){Sm(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=n;const{observers:r}=this;for(;r.length;)r.shift().error(n)}})}complete(){Sm(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;const{observers:n}=this;for(;n.length;)n.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var n;return(null===(n=this.observers)||void 0===n?void 0:n.length)>0}_trySubscribe(n){return this._throwIfClosed(),super._trySubscribe(n)}_subscribe(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)}_innerSubscribe(n){const{hasError:r,isStopped:i,observers:o}=this;return r||i?$2:(this.currentObservers=null,o.push(n),new Il(()=>{this.currentObservers=null,mb(o,n)}))}_checkFinalizedStatuses(n){const{hasError:r,thrownError:i,isStopped:o}=this;r?n.error(i):o&&n.complete()}asObservable(){const n=new Ra;return n.source=this,n}}return e.create=(t,n)=>new Z2(t,n),e})();class Z2 extends si{constructor(t,n){super(),this.destination=t,this.source=n}next(t){var n,r;null===(r=null===(n=this.destination)||void 0===n?void 0:n.next)||void 0===r||r.call(n,t)}error(t){var n,r;null===(r=null===(n=this.destination)||void 0===n?void 0:n.error)||void 0===r||r.call(n,t)}complete(){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===n||n.call(t)}_subscribe(t){var n,r;return null!==(r=null===(n=this.source)||void 0===n?void 0:n.subscribe(t))&&void 0!==r?r:$2}}class Ao extends si{constructor(t){super(),this._value=t}get value(){return this.getValue()}_subscribe(t){const n=super._subscribe(t);return!n.closed&&t.next(this._value),n}getValue(){const{hasError:t,thrownError:n,_value:r}=this;if(t)throw n;return this._throwIfClosed(),r}next(t){super.next(this._value=t)}}function Rv(e){return Yo(e?.lift)}function is(e){return t=>{if(Rv(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function Xo(e,t,n,r,i){return new Q2(e,t,n,r,i)}class Q2 extends o0{constructor(t,n,r,i,o,s){super(t),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=n?function(a){try{n(a)}catch(l){t.error(l)}}:super._next,this._error=i?function(a){try{i(a)}catch(l){t.error(l)}finally{this.unsubscribe()}}:super._error,this._complete=r?function(){try{r()}catch(a){t.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){const{closed:n}=this;super.unsubscribe(),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}}}function hn(e,t){return is((n,r)=>{let i=0;n.subscribe(Xo(r,o=>{r.next(e.call(t,o,i++))}))})}const ad="https://g.co/ng/security#xss";class Xt extends Error{constructor(t,n){super(function yb(e,t){return`NG0${Math.abs(e)}${t?": "+t:""}`}(t,n)),this.code=t}}function lh(e){return{toString:e}.toString()}const Cm="__parameters__";function vb(e,t,n){return lh(()=>{const r=function a0(e){return function(...n){if(e){const r=e(...n);for(const i in r)this[i]=r[i]}}}(t);function i(...o){if(this instanceof i)return r.apply(this,o),this;const s=new i(...o);return a.annotation=s,a;function a(l,c,u){const d=l.hasOwnProperty(Cm)?l[Cm]:Object.defineProperty(l,Cm,{value:[]})[Cm];for(;d.length<=u;)d.push(null);return(d[u]=d[u]||[]).push(s),l}}return n&&(i.prototype=Object.create(n.prototype)),i.prototype.ngMetadataName=e,i.annotationCls=i,i})}const Gn=globalThis;function Qi(e){for(let t in e)if(e[t]===Qi)return t;throw Error("Could not find renamed property on target object.")}function ya(e){if("string"==typeof e)return e;if(Array.isArray(e))return"["+e.map(ya).join(", ")+"]";if(null==e)return""+e;if(e.overriddenName)return`${e.overriddenName}`;if(e.name)return`${e.name}`;const t=e.toString();if(null==t)return""+t;const n=t.indexOf("\n");return-1===n?t:t.substring(0,n)}function nS(e,t){return null==e||""===e?null===t?"":t:null==t||""===t?e:e+" "+t}const rS=Qi({__forward_ref__:Qi});function Vf(e){return e.__forward_ref__=Vf,e.toString=function(){return ya(this())},e}function Zn(e){return qd(e)?e():e}function qd(e){return"function"==typeof e&&e.hasOwnProperty(rS)&&e.__forward_ref__===Vf}function gn(e){return{token:e.token,providedIn:e.providedIn||null,factory:e.factory,value:void 0}}function c0(e){return{providers:e.providers||[],imports:e.imports||[]}}function u0(e){return Bv(e,zl)||Bv(e,lS)}function Bv(e,t){return e.hasOwnProperty(t)?e[t]:null}function Lv(e){return e&&(e.hasOwnProperty(Am)||e.hasOwnProperty(jv))?e[Am]:null}const zl=Qi({\u0275prov:Qi}),Am=Qi({\u0275inj:Qi}),lS=Qi({ngInjectableDef:Qi}),jv=Qi({ngInjectorDef:Qi});class jn{constructor(t,n){this._desc=t,this.ngMetadataName="InjectionToken",this.\u0275prov=void 0,"number"==typeof n?this.__NG_ELEMENT_ID__=n:void 0!==n&&(this.\u0275prov=gn({token:this,providedIn:n.providedIn||"root",factory:n.factory}))}get multi(){return this}toString(){return`InjectionToken ${this._desc}`}}function tE(e){return e&&!!e.\u0275providers}const Vv=Qi({\u0275cmp:Qi}),nE=Qi({\u0275dir:Qi}),rE=Qi({\u0275pipe:Qi}),iE=Qi({\u0275mod:Qi}),uh=Qi({\u0275fac:Qi}),Hv=Qi({__NG_ELEMENT_ID__:Qi}),jk=Qi({__NG_ENV_ID__:Qi});function Tr(e){return"string"==typeof e?e:null==e?"":String(e)}function oE(e,t){throw new Xt(-201,!1)}var gi=function(e){return e[e.Default=0]="Default",e[e.Host=1]="Host",e[e.Self=2]="Self",e[e.SkipSelf=4]="SkipSelf",e[e.Optional=8]="Optional",e}(gi||{});let sE;function Uk(){return sE}function Uc(e){const t=sE;return sE=e,t}function zk(e,t,n){const r=u0(e);return r&&"root"==r.providedIn?void 0===r.value?r.value=r.factory():r.value:n&gi.Optional?null:void 0!==t?t:void oE()}const Gv={},uS="__NG_DI_FLAG__",qv="ngTempTokenPath",Gk=/\n/gm,d0="__source";let Sb;function Im(e){const t=Sb;return Sb=e,t}function Wk(e,t=gi.Default){if(void 0===Sb)throw new Xt(-203,!1);return null===Sb?zk(e,void 0,t):Sb.get(e,t&gi.Optional?null:void 0,t)}function Rn(e,t=gi.Default){return(Uk()||Wk)(Zn(e),t)}function qt(e,t=gi.Default){return Rn(e,dS(t))}function dS(e){return typeof e>"u"||"number"==typeof e?e:(e.optional&&8)|(e.host&&1)|(e.self&&2)|(e.skipSelf&&4)}function wb(e){const t=[];for(let n=0;nArray.isArray(n)?Vl(n,t):t(n))}function Ab(e,t,n){t>=e.length?e.push(n):e.splice(t,0,n)}function Yv(e,t){return t>=e.length-1?e.pop():e.splice(t,1)[0]}function xu(e,t,n){let r=Tm(e,t);return r>=0?e[1|r]=n:(r=~r,function hS(e,t,n,r){let i=e.length;if(i==t)e.push(n,r);else if(1===i)e.push(r,e[0]),e[0]=n;else{for(i--,e.push(e[i-1],e[i]);i>t;)e[i]=e[i-2],i--;e[t]=n,e[t+1]=r}}(e,r,t,n)),r}function Em(e,t){const n=Tm(e,t);if(n>=0)return e[1|n]}function Tm(e,t){return function gS(e,t,n){let r=0,i=e.length>>n;for(;i!==r;){const o=r+(i-r>>1),s=e[o<t?i=o:r=o+1}return~(i<t){s=o-1;break}}}for(;o-1){let o;for(;++io?"":i[u+1].toLowerCase(),2&r&&c!==d){if(dd(r))return!1;s=!0}}}}else{if(!s&&!dd(r)&&!dd(l))return!1;if(s&&dd(l))continue;s=!1,r=l|1&r}}return dd(r)||s}function dd(e){return!(1&e)}function Ko(e,t,n,r){if(null===t)return-1;let i=0;if(r||!n){let o=!1;for(;i-1)for(n++;n0?'="'+a+'"':"")+"]"}else 8&r?i+="."+s:4&r&&(i+=" "+s);else""!==i&&!dd(s)&&(t+=Ib(o,i),i=""),r=s,o=o||!dd(r);n++}return""!==i&&(t+=Ib(o,i)),t}function $d(e){return lh(()=>{const t=nM(e),n={...t,decls:e.decls,vars:e.vars,template:e.template,consts:e.consts||null,ngContentSelectors:e.ngContentSelectors,onPush:e.changeDetection===Kv.OnPush,directiveDefs:null,pipeDefs:null,dependencies:t.standalone&&e.dependencies||null,getStandaloneInjector:null,signals:e.signals??!1,data:e.data||{},encapsulation:e.encapsulation||cd.Emulated,styles:e.styles||xi,_:null,schemas:e.schemas||null,tView:null,id:""};wS(n);const r=e.dependencies;return n.directiveDefs=Yd(r,!1),n.pipeDefs=Yd(r,!0),n.id=function Tb(e){let t=0;const n=[e.selectors,e.ngContentSelectors,e.hostVars,e.hostAttrs,e.consts,e.vars,e.decls,e.encapsulation,e.standalone,e.signals,e.exportAs,JSON.stringify(e.inputs),JSON.stringify(e.outputs),Object.getOwnPropertyNames(e.type.prototype),!!e.contentQueries,!!e.viewQuery].join("|");for(const i of n)t=Math.imul(31,t)+i.charCodeAt(0)|0;return t+=2147483648,"c"+t}(n),n})}function wL(e){return Yr(e)||ra(e)}function tM(e){return null!==e}function g0(e){return lh(()=>({type:e.type,bootstrap:e.bootstrap||xi,declarations:e.declarations||xi,imports:e.imports||xi,exports:e.exports||xi,transitiveCompileScopes:null,schemas:e.schemas||null,id:e.id||null}))}function Qv(e,t){if(null==e)return Wd;const n={};for(const r in e)if(e.hasOwnProperty(r)){const i=e[r];let o,s,a=ud.None;Array.isArray(i)?(a=i[0],o=i[1],s=i[2]??o):(o=i,s=i),t?(n[o]=a!==ud.None?[r,a]:r,t[o]=s):n[o]=r}return n}function Ja(e){return lh(()=>{const t=nM(e);return wS(t),t})}function Hl(e){return{type:e.type,name:e.name,factory:null,pure:!1!==e.pure,standalone:!0===e.standalone,onDestroy:e.type.prototype.ngOnDestroy||null}}function Yr(e){return e[Vv]||null}function ra(e){return e[nE]||null}function Tl(e){return e[rE]||null}function Gl(e,t){const n=e[iE]||null;if(!n&&!0===t)throw new Error(`Type ${ya(e)} does not have '\u0275mod' property.`);return n}function nM(e){const t={};return{type:e.type,providersResolver:null,factory:null,hostBindings:e.hostBindings||null,hostVars:e.hostVars||0,hostAttrs:e.hostAttrs||null,contentQueries:e.contentQueries||null,declaredInputs:t,inputTransforms:null,inputConfig:e.inputs||Wd,exportAs:e.exportAs||null,standalone:!0===e.standalone,signals:!0===e.signals,selectors:e.selectors||xi,viewQuery:e.viewQuery||null,features:e.features||null,setInput:null,findHostDirectiveDefs:null,hostDirectives:null,inputs:Qv(e.inputs,t),outputs:Qv(e.outputs),debugInfo:null}}function wS(e){e.features?.forEach(t=>t(e))}function Yd(e,t){if(!e)return null;const n=t?Tl:wL;return()=>("function"==typeof e?e():e).map(r=>n(r)).filter(tM)}function Vc(e){return{\u0275providers:e}}function Jv(...e){return{\u0275providers:Xd(0,e),\u0275fromNgModule:!0}}function Xd(e,...t){const n=[],r=new Set;let i;const o=s=>{n.push(s)};return Vl(t,s=>{const a=s;IS(a,o,[],r)&&(i||=[],i.push(a))}),void 0!==i&&AS(i,o),n}function AS(e,t){for(let n=0;n{t(o,r)})}}function IS(e,t,n,r){if(!(e=Zn(e)))return!1;let i=null,o=Lv(e);const s=!o&&Yr(e);if(o||s){if(s&&!s.standalone)return!1;i=e}else{const l=e.ngModule;if(o=Lv(l),!o)return!1;i=l}const a=r.has(i);if(s){if(a)return!1;if(r.add(i),s.dependencies){const l="function"==typeof s.dependencies?s.dependencies():s.dependencies;for(const c of l)IS(c,t,n,r)}}else{if(!o)return!1;{if(null!=o.imports&&!a){let c;r.add(i);try{Vl(o.imports,u=>{IS(u,t,n,r)&&(c||=[],c.push(u))})}finally{}void 0!==c&&AS(c,t)}if(!a){const c=f0(i)||(()=>new i);t({provide:i,useFactory:c,deps:xi},i),t({provide:bS,useValue:i,multi:!0},i),t({provide:ld,useValue:()=>Rn(i),multi:!0},i)}const l=o.providers;if(null!=l&&!a){const c=e;ph(l,u=>{t(u,c)})}}}return i!==e&&void 0!==e.providers}function ph(e,t){for(let n of e)tE(n)&&(n=n.\u0275providers),Array.isArray(n)?ph(n,t):t(n)}const ex=Qi({provide:String,useValue:Qi});function Dm(e){return null!==e&&"object"==typeof e&&ex in e}function fd(e){return"function"==typeof e}const No=new jn(""),ho={},km={};let el;function Dl(){return void 0===el&&(el=new p0),el}class Na{}class Kd extends Na{get destroyed(){return this._destroyed}constructor(t,n,r,i){super(),this.parent=n,this.source=r,this.scopes=i,this.records=new Map,this._ngOnDestroyHooks=new Set,this._onDestroyHooks=[],this._destroyed=!1,nx(t,s=>this.processProvider(s)),this.records.set(yS,hh(void 0,this)),i.has("environment")&&this.records.set(Na,hh(void 0,this));const o=this.records.get(No);null!=o&&"string"==typeof o.value&&this.scopes.add(o.value),this.injectorDefTypes=new Set(this.get(bS,xi,gi.Self))}destroy(){this.assertNotDestroyed(),this._destroyed=!0;const t=hr(null);try{for(const r of this._ngOnDestroyHooks)r.ngOnDestroy();const n=this._onDestroyHooks;this._onDestroyHooks=[];for(const r of n)r()}finally{this.records.clear(),this._ngOnDestroyHooks.clear(),this.injectorDefTypes.clear(),hr(t)}}onDestroy(t){return this.assertNotDestroyed(),this._onDestroyHooks.push(t),()=>this.removeOnDestroy(t)}runInContext(t){this.assertNotDestroyed();const n=Im(this),r=Uc(void 0);try{return t()}finally{Im(n),Uc(r)}}get(t,n=Gv,r=gi.Default){if(this.assertNotDestroyed(),t.hasOwnProperty(jk))return t[jk](this);r=dS(r);const o=Im(this),s=Uc(void 0);try{if(!(r&gi.SkipSelf)){let l=this.records.get(t);if(void 0===l){const c=function DS(e){return"function"==typeof e||"object"==typeof e&&e instanceof jn}(t)&&u0(t);l=c&&this.injectableDefInScope(c)?hh(ql(t),ho):null,this.records.set(t,l)}if(null!=l)return this.hydrate(t,l)}return(r&gi.Self?Dl():this.parent).get(t,n=r&gi.Optional&&n===Gv?null:n)}catch(a){if("NullInjectorError"===a.name){if((a[qv]=a[qv]||[]).unshift(ya(t)),o)throw a;return function aE(e,t,n,r){const i=e[qv];throw t[d0]&&i.unshift(t[d0]),e.message=function lE(e,t,n,r=null){e=e&&"\n"===e.charAt(0)&&"\u0275"==e.charAt(1)?e.slice(2):e;let i=ya(t);if(Array.isArray(t))i=t.map(ya).join(" -> ");else if("object"==typeof t){let o=[];for(let s in t)if(t.hasOwnProperty(s)){let a=t[s];o.push(s+":"+("string"==typeof a?JSON.stringify(a):ya(a)))}i=`{${o.join(", ")}}`}return`${n}${r?"("+r+")":""}[${i}]: ${e.replace(Gk,"\n ")}`}("\n"+e.message,i,n,r),e.ngTokenPath=i,e[qv]=null,e}(a,t,"R3InjectorError",this.source)}throw a}finally{Uc(s),Im(o)}}resolveInjectorInitializers(){const t=hr(null),n=Im(this),r=Uc(void 0);try{const o=this.get(ld,xi,gi.Self);for(const s of o)s()}finally{Im(n),Uc(r),hr(t)}}toString(){const t=[],n=this.records;for(const r of n.keys())t.push(ya(r));return`R3Injector[${t.join(", ")}]`}assertNotDestroyed(){if(this._destroyed)throw new Xt(205,!1)}processProvider(t){let n=fd(t=Zn(t))?t:Zn(t&&t.provide);const r=function iM(e){return Dm(e)?hh(void 0,e.useValue):hh(dE(e),ho)}(t);if(!fd(t)&&!0===t.multi){let i=this.records.get(n);i||(i=hh(void 0,ho,!0),i.factory=()=>wb(i.multi),this.records.set(n,i)),n=t,i.multi.push(t)}this.records.set(n,r)}hydrate(t,n){const r=hr(null);try{return n.value===ho&&(n.value=km,n.value=n.factory()),"object"==typeof n.value&&n.value&&function mh(e){return null!==e&&"object"==typeof e&&"function"==typeof e.ngOnDestroy}(n.value)&&this._ngOnDestroyHooks.add(n.value),n.value}finally{hr(r)}}injectableDefInScope(t){if(!t.providedIn)return!1;const n=Zn(t.providedIn);return"string"==typeof n?"any"===n||this.scopes.has(n):this.injectorDefTypes.has(n)}removeOnDestroy(t){const n=this._onDestroyHooks.indexOf(t);-1!==n&&this._onDestroyHooks.splice(n,1)}}function ql(e){const t=u0(e),n=null!==t?t.factory:f0(e);if(null!==n)return n;if(e instanceof jn)throw new Xt(204,!1);if(e instanceof Function)return function TS(e){if(e.length>0)throw new Xt(204,!1);const n=function aS(e){return e&&(e[zl]||e[lS])||null}(e);return null!==n?()=>n.factory(e):()=>new e}(e);throw new Xt(204,!1)}function dE(e,t,n){let r;if(fd(e)){const i=Zn(e);return f0(i)||ql(i)}if(Dm(e))r=()=>Zn(e.useValue);else if(function ES(e){return!(!e||!e.useFactory)}(e))r=()=>e.useFactory(...wb(e.deps||[]));else if(function tx(e){return!(!e||!e.useExisting)}(e))r=()=>Rn(Zn(e.useExisting));else{const i=Zn(e&&(e.useClass||e.provide));if(!function oM(e){return!!e.deps}(e))return f0(i)||ql(i);r=()=>new i(...wb(e.deps))}return r}function hh(e,t,n=!1){return{factory:e,value:t,multi:n?[]:void 0}}function nx(e,t){for(const n of e)Array.isArray(n)?nx(n,t):n&&tE(n)?nx(n.\u0275providers,t):t(n)}function Hf(e,t){e instanceof Kd&&e.assertNotDestroyed();const r=Im(e),i=Uc(void 0);try{return t()}finally{Im(r),Uc(i)}}function sM(){return void 0!==Uk()||null!=function bL(){return Sb}()}const wr=0,Ht=1,Wn=2,Fs=3,Su=4,tl=5,Hc=6,bh=7,Fo=8,Os=9,Cu=10,_r=11,Tc=12,rx=13,vh=14,Io=15,b0=16,Mm=17,ef=18,v0=19,x0=20,Fa=21,Gf=22,xh=23,Ar=25,tf=1,md=7,Gc=9,Eo=10;var Pb=function(e){return e[e.None=0]="None",e[e.HasTransplantedViews=2]="HasTransplantedViews",e}(Pb||{});function Pl(e){return Array.isArray(e)&&"object"==typeof e[tf]}function Oa(e){return Array.isArray(e)&&!0===e[tf]}function kS(e){return!!(4&e.flags)}function Rm(e){return e.componentOffset>-1}function kb(e){return!(1&~e.flags)}function qc(e){return!!e.template}function MS(e){return!!(512&e[Wn])}class _0{constructor(t,n,r){this.previousValue=t,this.currentValue=n,this.firstChange=r}isFirstChange(){return this.firstChange}}function ss(e,t,n,r){null!==t?t.applyValueToInputSignal(t,r):e[n]=r}function Oo(){return Ba}function Ba(e){return e.type.prototype.ngOnChanges&&(e.setInput=cx),LS}function LS(){const e=mM(this),t=e?.current;if(t){const n=e.previous;if(n===Wd)e.previous=t;else for(let r in t)n[r]=t[r];e.current=null,this.ngOnChanges(t)}}function cx(e,t,n,r,i){const o=this.declaredInputs[r],s=mM(e)||function $l(e,t){return e[Nb]=t}(e,{previous:Wd,current:null}),a=s.current||(s.current={}),l=s.previous,c=l[o];a[o]=new _0(c&&c.currentValue,n,l===Wd),ss(e,t,i,n)}Oo.ngInherit=!0;const Nb="__ngSimpleChanges__";function mM(e){return e[Nb]||null}const gd=function(e,t,n){};let Fb=!1;function mo(e){for(;Array.isArray(e);)e=e[wr];return e}function Ob(e,t){return mo(t[e])}function Yl(e,t){return mo(t[e.index])}function Bb(e,t){return e.data[t]}function Wc(e,t){const n=t[e];return Pl(n)?n:n[wr]}function US(e){return!(128&~e[Wn])}function Au(e,t){return null==t?null:e[t]}function yE(e){e[Mm]=0}function bE(e){1024&e[Wn]||(e[Wn]|=1024,US(e)&&Lb(e))}function VS(e){return!!(9216&e[Wn]||e[xh]?.dirty)}function HS(e){e[Cu].changeDetectionScheduler?.notify(1),VS(e)?Lb(e):64&e[Wn]&&(function gE(){return Fb}()?(e[Wn]|=1024,Lb(e)):e[Cu].changeDetectionScheduler?.notify())}function Lb(e){e[Cu].changeDetectionScheduler?.notify();let t=Nm(e);for(;null!==t&&!(8192&t[Wn])&&(t[Wn]|=8192,US(t));)t=Nm(t)}function jb(e,t){if(!(256&~e[Wn]))throw new Xt(911,!1);null===e[Fa]&&(e[Fa]=[]),e[Fa].push(t)}function Nm(e){const t=e[Fs];return Oa(t)?t[Fs]:t}const yr={lFrame:mx(null),bindingsEnabled:!0,skipHydrationRootTNode:null};function xE(){return yr.bindingsEnabled}function _t(){return yr.lFrame.lView}function ai(){return yr.lFrame.tView}function Sh(e){return yr.lFrame.contextLView=e,e[Fo]}function qf(e){return yr.lFrame.contextLView=null,e}function ro(){let e=_E();for(;null!==e&&64===e.type;)e=e.parent;return e}function _E(){return yr.lFrame.currentTNode}function rf(e,t){const n=yr.lFrame;n.currentTNode=e,n.isParent=t}function SE(){return yr.lFrame.isParent}function Xl(){yr.lFrame.isParent=!1}function Kl(){const e=yr.lFrame;let t=e.bindingRootIndex;return-1===t&&(t=e.bindingRootIndex=e.tView.bindingStartIndex),t}function Iu(){return yr.lFrame.bindingIndex++}function xM(e,t){const n=yr.lFrame;n.bindingIndex=n.bindingRootIndex=e,fx(t)}function fx(e){yr.lFrame.currentDirectiveIndex=e}function px(){return yr.lFrame.currentQueryIndex}function w0(e){yr.lFrame.currentQueryIndex=e}function FL(e){const t=e[Ht];return 2===t.type?t.declTNode:1===t.type?e[tl]:null}function TE(e,t,n){if(n&gi.SkipSelf){let i=t,o=e;for(;!(i=i.parent,null!==i||n&gi.Host||(i=FL(o),null===i||(o=o[vh],10&i.type))););if(null===i)return!1;t=i,e=o}const r=yr.lFrame=DE();return r.currentTNode=t,r.lView=e,!0}function hx(e){const t=DE(),n=e[Ht];yr.lFrame=t,t.currentTNode=n.firstChild,t.lView=e,t.tView=n,t.contextLView=e,t.bindingIndex=n.bindingStartIndex,t.inI18n=!1}function DE(){const e=yr.lFrame,t=null===e?null:e.child;return null===t?mx(e):t}function mx(e){const t={currentTNode:null,isParent:!0,lView:null,tView:null,selectedIndex:-1,contextLView:null,elementDepthCount:0,currentNamespace:null,currentDirectiveIndex:-1,bindingRootIndex:-1,bindingIndex:-1,currentQueryIndex:0,parent:e,child:null,inI18n:!1};return null!==e&&(e.child=t),t}function Yf(){const e=yr.lFrame;return yr.lFrame=e.parent,e.currentTNode=null,e.lView=null,e}const _M=Yf;function $S(){const e=Yf();e.isParent=!0,e.tView=null,e.selectedIndex=-1,e.contextLView=null,e.elementDepthCount=0,e.currentDirectiveIndex=-1,e.currentNamespace=null,e.bindingRootIndex=-1,e.bindingIndex=-1,e.currentQueryIndex=0}function kl(){return yr.lFrame.selectedIndex}function Fm(e){yr.lFrame.selectedIndex=e}function io(){const e=yr.lFrame;return Bb(e.tView,e.selectedIndex)}let SM=!0;function vn(){return SM}function Pc(e){SM=e}function gx(e,t){for(let n=t.directiveStart,r=t.directiveEnd;n=r)break}else t[l]<0&&(e[Mm]+=65536),(a>14>16&&(3&e[Wn])===t&&(e[Wn]+=16384,ME(a,o)):ME(a,o)}const A0=-1;class I0{constructor(t,n,r){this.factory=t,this.resolving=!1,this.canSeeViewProviders=n,this.injectImpl=r}}function ZS(e){return e!==A0}function $c(e){return 32767&e}function Hb(e,t){let n=function jL(e){return e>>16}(e),r=t;for(;n>0;)r=r[vh],n--;return r}let QS=!0;function yx(e){const t=QS;return QS=e,t}const AM=255,bx=5;let NE=0;const ia={};function oa(e,t){const n=nl(e,t);if(-1!==n)return n;const r=t[Ht];r.firstCreatePass&&(e.injectorIndex=t.length,Bs(r.data,e),Bs(t,null),Bs(r.blueprint,null));const i=Ql(e,t),o=e.injectorIndex;if(ZS(i)){const s=$c(i),a=Hb(i,t),l=a[Ht].data;for(let c=0;c<8;c++)t[o+c]=a[s+c]|l[s+c]}return t[o+8]=i,o}function Bs(e,t){e.push(0,0,0,0,0,0,0,0,t)}function nl(e,t){return-1===e.injectorIndex||e.parent&&e.parent.injectorIndex===e.injectorIndex||null===t[e.injectorIndex+8]?-1:e.injectorIndex}function Ql(e,t){if(e.parent&&-1!==e.parent.injectorIndex)return e.parent.injectorIndex;let n=0,r=null,i=t;for(;null!==i;){if(r=Sx(i),null===r)return A0;if(n++,i=i[vh],-1!==r.injectorIndex)return r.injectorIndex|n<<16}return A0}function Lm(e,t,n){!function Oi(e,t,n){let r;"string"==typeof n?r=n.charCodeAt(0)||0:n.hasOwnProperty(Hv)&&(r=n[Hv]),null==r&&(r=n[Hv]=NE++);const i=r&AM;t.data[e+(i>>bx)]|=1<=0?t&AM:zm:t}(n);if("function"==typeof o){if(!TE(t,e,r))return r&gi.Host?Gb(i,0,r):jm(t,n,r,i);try{let s;if(s=o(r),null!=s||r&gi.Optional)return s;oE()}finally{_M()}}else if("number"==typeof o){let s=null,a=nl(e,t),l=A0,c=r&gi.Host?t[Io][tl]:null;for((-1===a||r&gi.SkipSelf)&&(l=-1===a?Ql(e,t):t[a+8],l!==A0&&_x(r,!1)?(s=t[Ht],a=$c(l),t=Hb(l,t)):a=-1);-1!==a;){const u=t[Ht];if(Kf(o,a,u.data)){const d=xx(a,t,n,s,r,c);if(d!==ia)return d}l=t[a+8],l!==A0&&_x(r,t[Ht].data[a+8]===c)&&Kf(o,a,t)?(s=u,a=$c(l),t=Hb(l,t)):a=-1}}return i}function xx(e,t,n,r,i,o){const s=t[Ht],a=s.data[e+8],u=Rl(a,s,n,null==r?Rm(a)&&QS:r!=s&&!!(3&a.type),i&gi.Host&&o===a);return null!==u?Ch(t,s,u,a):ia}function Rl(e,t,n,r,i){const o=e.providerIndexes,s=t.data,a=1048575&o,l=e.directiveStart,u=o>>20,f=i?a+u:e.directiveEnd;for(let p=r?a:a+u;p=l&&m.type===n)return p}if(i){const p=s[l];if(p&&qc(p)&&p.type===n)return l}return null}function Ch(e,t,n,r){let i=e[n];const o=t.data;if(function RE(e){return e instanceof I0}(i)){const s=i;s.resolving&&function mL(e,t){throw t&&t.join(" > "),new Xt(-200,e)}(function Fi(e){return"function"==typeof e?e.name||e.toString():"object"==typeof e&&null!=e&&"function"==typeof e.type?e.type.name||e.type.toString():Tr(e)}(o[n]));const a=yx(s.canSeeViewProviders);s.resolving=!0;const c=s.injectImpl?Uc(s.injectImpl):null;TE(e,r,gi.Default);try{i=e[n]=s.factory(void 0,o,e,r),t.firstCreatePass&&n>=r.directiveStart&&function kE(e,t,n){const{ngOnChanges:r,ngOnInit:i,ngDoCheck:o}=t.type.prototype;if(r){const s=Ba(t);(n.preOrderHooks??=[]).push(e,s),(n.preOrderCheckHooks??=[]).push(e,s)}i&&(n.preOrderHooks??=[]).push(0-e,i),o&&((n.preOrderHooks??=[]).push(e,o),(n.preOrderCheckHooks??=[]).push(e,o))}(n,o[n],t)}finally{null!==c&&Uc(c),yx(a),s.resolving=!1,_M()}}return i}function Kf(e,t,n){return!!(n[t+(e>>bx)]&1<{const t=e.prototype.constructor,n=t[uh]||E0(t),r=Object.prototype;let i=Object.getPrototypeOf(e.prototype).constructor;for(;i&&i!==r;){const o=i[uh]||E0(i);if(o&&o!==n)return o;i=Object.getPrototypeOf(i)}return o=>new o})}function E0(e){return qd(e)?()=>{const t=E0(Zn(e));return t&&t()}:f0(e)}function Sx(e){const t=e[Ht],n=t.type;return 2===n?t.declTNode:1===n?e[tl]:null}function UE(e,t=null,n=null,r){const i=zE(e,t,n,r);return i.resolveInjectorInitializers(),i}function zE(e,t=null,n=null,r,i=new Set){const o=[n||xi,Jv(e)];return r=r||("object"==typeof e?void 0:ya(e)),new Kd(o,t||Dl(),r||null,i)}let Jl=(()=>{class e{static#e=this.THROW_IF_NOT_FOUND=Gv;static#t=this.NULL=new p0;static create(n,r){if(Array.isArray(n))return UE({name:""},r,n,"");{const i=n.name??"";return UE({name:i},n.parent,n.providers,i)}}static#n=this.\u0275prov=gn({token:e,providedIn:"any",factory:()=>Rn(yS)});static#r=this.__NG_ELEMENT_ID__=-1}return e})();function tC(e){return e.ngOriginalError}class af{constructor(){this._console=console}handleError(t){const n=this._findOriginalError(t);this._console.error("ERROR",t),n&&this._console.error("ORIGINAL ERROR",n)}_findOriginalError(t){let n=t&&tC(t);for(;n&&tC(n);)n=tC(n);return n||null}}const Hm=new jn("",{providedIn:"root",factory:()=>qt(af).handleError.bind(void 0)});let Yb=(()=>{class e{static#e=this.__NG_ELEMENT_ID__=TM;static#t=this.__NG_ENV_ID__=n=>n}return e})();class Xb extends Yb{constructor(t){super(),this._lView=t}onDestroy(t){return jb(this._lView,t),()=>function GS(e,t){if(null===e[Fa])return;const n=e[Fa].indexOf(t);-1!==n&&e[Fa].splice(n,1)}(this._lView,t)}}function TM(){return new Xb(_t())}function DM(){return Kb(ro(),_t())}function Kb(e,t){return new Ua(Yl(e,t))}let Ua=(()=>{class e{constructor(n){this.nativeElement=n}static#e=this.__NG_ELEMENT_ID__=DM}return e})();function nC(e){return e instanceof Ua?e.nativeElement:e}function Zf(e){return t=>{setTimeout(e,void 0,t)}}const rl=class GL extends si{constructor(t=!1){super(),this.destroyRef=void 0,this.__isAsync=t,sM()&&(this.destroyRef=qt(Yb,{optional:!0})??void 0)}emit(t){const n=hr(null);try{super.next(t)}finally{hr(n)}}subscribe(t,n,r){let i=t,o=n||(()=>null),s=r;if(t&&"object"==typeof t){const l=t;i=l.next?.bind(l),o=l.error?.bind(l),s=l.complete?.bind(l)}this.__isAsync&&(o=Zf(o),i&&(i=Zf(i)),s&&(s=Zf(s)));const a=super.subscribe({next:i,error:o,complete:s});return t instanceof Il&&t.add(a),a}};function D0(){return this._results[Symbol.iterator]()}class Zb{static#e=Symbol.iterator;get changes(){return this._changes??=new rl}constructor(t=!1){this._emitDistinctChangesOnly=t,this.dirty=!0,this._onDirty=void 0,this._results=[],this._changesDetected=!1,this._changes=void 0,this.length=0,this.first=void 0,this.last=void 0;const n=Zb.prototype;n[Symbol.iterator]||(n[Symbol.iterator]=D0)}get(t){return this._results[t]}map(t){return this._results.map(t)}filter(t){return this._results.filter(t)}find(t){return this._results.find(t)}reduce(t,n){return this._results.reduce(t,n)}forEach(t){this._results.forEach(t)}some(t){return this._results.some(t)}toArray(){return this._results.slice()}toString(){return this._results.toString()}reset(t,n){this.dirty=!1;const r=function zc(e){return e.flat(Number.POSITIVE_INFINITY)}(t);(this._changesDetected=!function xL(e,t,n){if(e.length!==t.length)return!1;for(let r=0;rxCe}),xCe="ng",QK=new jn(""),Ex=new jn("",{providedIn:"platform",factory:()=>"unknown"}),JK=new jn("",{providedIn:"root",factory:()=>function e1(){if(void 0!==Qf)return Qf;if(typeof document<"u")return document;throw new Xt(210,!1)}().body?.querySelector("[ngCspNonce]")?.getAttribute("ngCspNonce")||null});let eZ=()=>null;function t6(e,t,n=!1){return eZ(e,t,n)}const oZ=new jn("",{providedIn:"root",factory:()=>!1});let VM;function cZ(e){return function s6(){if(void 0===VM&&(VM=null,Gn.trustedTypes))try{VM=Gn.trustedTypes.createPolicy("angular#unsafe-bypass",{createHTML:e=>e,createScript:e=>e,createScriptURL:e=>e})}catch{}return VM}()?.createScriptURL(e)||e}class uZ{constructor(t){this.changingThisBreaksApplicationSecurity=t}toString(){return`SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see ${ad})`}}function t1(e){return e instanceof uZ?e.changingThisBreaksApplicationSecurity:e}function YE(e,t){const n=function jCe(e){return e instanceof uZ&&e.getTypeName()||null}(e);if(null!=n&&n!==t){if("ResourceURL"===n&&"URL"===t)return!0;throw new Error(`Required a safe ${t}, got a ${n} (see ${ad})`)}return n===t}const HCe=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:\/?#]*(?:[\/?#]|$))/i;var hC=function(e){return e[e.NONE=0]="NONE",e[e.HTML=1]="HTML",e[e.STYLE=2]="STYLE",e[e.SCRIPT=3]="SCRIPT",e[e.URL=4]="URL",e[e.RESOURCE_URL=5]="RESOURCE_URL",e}(hC||{});function vZ(e){const t=KE();return t?t.sanitize(hC.URL,e)||"":YE(e,"URL")?t1(e):function a6(e){return(e=String(e)).match(HCe)?e:"unsafe:"+e}(Tr(e))}function xZ(e){const t=KE();if(t)return cZ(t.sanitize(hC.RESOURCE_URL,e)||"");if(YE(e,"ResourceURL"))return cZ(t1(e));throw new Xt(904,!1)}function KE(){const e=_t();return e&&e[Cu].sanitizer}const owe=/^>|^->||--!>|)/g,awe="\u200b$1\u200b";function AZ(e){return e.ownerDocument.defaultView}function lf(e){return e instanceof Function?e():e}var r1=function(e){return e[e.Important=1]="Important",e[e.DashCase=2]="DashCase",e}(r1||{});let h6;function m6(e,t){return h6(e,t)}function gC(e,t,n,r,i){if(null!=r){let o,s=!1;Oa(r)?o=r:Pl(r)&&(s=!0,r=r[wr]);const a=mo(r);0===e&&null!==n?null==i?NZ(t,n,a):Tx(t,n,a,i||null,!0):1===e&&null!==n?Tx(t,n,a,i||null,!0):2===e?function JE(e,t,n){const r=YM(e,t);r&&function Awe(e,t,n,r){e.removeChild(t,n,r)}(e,r,t,n)}(t,a,s):3===e&&t.destroyNode(a),null!=o&&function Twe(e,t,n,r,i){const o=n[md];o!==mo(n)&&gC(t,e,r,o,i);for(let a=Eo;at.replace(swe,awe))}(t))}function WM(e,t,n){return e.createElement(t,n)}function kZ(e,t){t[Cu].changeDetectionScheduler?.notify(1),KM(e,t,t[_r],2,null,null)}function MZ(e,t){const n=e[Gc],r=n.indexOf(t);n.splice(r,1)}function ZE(e,t){if(e.length<=Eo)return;const n=Eo+t,r=e[n];if(r){const i=r[b0];null!==i&&i!==e&&MZ(i,r),t>0&&(e[n-1][Su]=r[Su]);const o=Yv(e,Eo+t);!function bwe(e,t){kZ(e,t),t[wr]=null,t[tl]=null}(r[Ht],r);const s=o[ef];null!==s&&s.detachView(o[Ht]),r[Fs]=null,r[Su]=null,r[Wn]&=-129}return r}function $M(e,t){if(!(256&t[Wn])){const n=t[_r];n.destroyNode&&KM(e,t,n,3,null,null),function xwe(e){let t=e[Tc];if(!t)return b6(e[Ht],e);for(;t;){let n=null;if(Pl(t))n=t[Tc];else{const r=t[Eo];r&&(n=r)}if(!n){for(;t&&!t[Su]&&t!==e;)Pl(t)&&b6(t[Ht],t),t=t[Fs];null===t&&(t=e),Pl(t)&&b6(t[Ht],t),n=t&&t[Su]}t=n}}(t)}}function b6(e,t){if(256&t[Wn])return;const n=hr(null);try{t[Wn]&=-129,t[Wn]|=256,t[xh]&&function ih(e){if(Jg(e),xm(e))for(let t=0;t=0?r[s]():r[-s].unsubscribe(),o+=2}else n[o].call(r[n[o+1]]);null!==r&&(t[bh]=null);const i=t[Fa];if(null!==i){t[Fa]=null;for(let o=0;o-1){const{encapsulation:o}=e.data[r.directiveStart+i];if(o===cd.None||o===cd.Emulated)return null}return Yl(r,n)}}(e,t.parent,n)}function Tx(e,t,n,r,i){e.insertBefore(t,n,r,i)}function NZ(e,t,n){e.appendChild(t,n)}function FZ(e,t,n,r,i){null!==r?Tx(e,t,n,r,i):NZ(e,t,n)}function YM(e,t){return e.parentNode(t)}let x6,LZ=function BZ(e,t,n){return 40&e.type?Yl(e,n):null};function XM(e,t,n,r){const i=v6(e,r,t),o=t[_r],a=function OZ(e,t,n){return LZ(e,t,n)}(r.parent||t[tl],r,t);if(null!=i)if(Array.isArray(n))for(let l=0;lAr&&qZ(e,t,Ar,!1),gd(s?2:0,i),n(r,i)}finally{Fm(o),gd(s?3:1,i)}}function w6(e,t,n){if(kS(t)){const r=hr(null);try{const o=t.directiveEnd;for(let s=t.directiveStart;snull;function ZZ(e,t,n,r,i){for(let o in t){if(!t.hasOwnProperty(o))continue;const s=t[o];if(void 0===s)continue;r??={};let a,l=ud.None;Array.isArray(s)?(a=s[0],l=s[1]):a=s;let c=o;if(null!==i){if(!i.hasOwnProperty(o))continue;c=i[o]}0===e?QZ(r,n,c,a,l):QZ(r,n,c,a)}return r}function QZ(e,t,n,r,i){let o;e.hasOwnProperty(n)?(o=e[n]).push(t,r):o=e[n]=[t,r],void 0!==i&&o.push(i)}function T6(e,t,n,r){if(xE()){const i=null===r?null:{"":-1},o=function $we(e,t){const n=e.directiveRegistry;let r=null,i=null;if(n)for(let o=0;o0;){const n=e[--t];if("number"==typeof n&&n<0)return n}return 0})(s)!=a&&s.push(a),s.push(n,r,o)}}(e,t,r,eT(e,n,i.hostVars,Gr),i)}function Gm(e,t,n,r,i,o){const s=Yl(e,t);!function P6(e,t,n,r,i,o,s){if(null==o)e.removeAttribute(t,i,n);else{const a=null==s?Tr(o):s(o,r||"",i);e.setAttribute(t,i,a,n)}}(t[_r],s,o,e.value,n,r,i)}function Jwe(e,t,n,r,i,o){const s=o[t];if(null!==s)for(let a=0;a0&&(n[i-1][Su]=t),r!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{},consumerIsAlwaysLive:!0,consumerMarkedDirty:e=>{Lb(e.lView)},consumerOnSignalRead(){this.lView[xh]=this}},cQ=100;function e4(e,t=!0,n=0){const r=e[Cu],i=r.rendererFactory;i.begin?.();try{!function lAe(e,t){F6(e,t);let n=0;for(;VS(e);){if(n===cQ)throw new Xt(103,!1);n++,F6(e,1)}}(e,n)}catch(s){throw t&&JM(e,s),s}finally{i.end?.(),r.inlineEffectRunner?.flush()}}function cAe(e,t,n,r){const i=t[Wn];if(!(256&~i))return;t[Cu].inlineEffectRunner?.flush(),hx(t);let s=null,a=null;(function uAe(e){return 2!==e.type})(e)&&(a=function iAe(e){return e[xh]??function oAe(e){const t=lQ.pop()??Object.create(aAe);return t.lView=e,t}(e)}(t),s=function ws(e){return e&&(e.nextProducerIndex=0),hr(e)}(a));try{yE(t),function wE(e){return yr.lFrame.bindingIndex=e}(e.bindingStartIndex),null!==n&&YZ(e,t,n,2,r);const l=!(3&~i);if(l){const d=e.preOrderCheckHooks;null!==d&&XS(t,d,null)}else{const d=e.preOrderHooks;null!==d&&Om(t,d,0,null),Vb(t,0)}if(function dAe(e){for(let t=De(e);null!==t;t=He(t)){if(!(t[Wn]&Pb.HasTransplantedViews))continue;const n=t[Gc];for(let r=0;re.nextProducerIndex;)e.producerNode.pop(),e.producerLastReadVersion.pop(),e.producerIndexOfThis.pop()}}(a,s),function sAe(e){e.lView[xh]!==e&&(e.lView=null,lQ.push(e))}(a)),$S()}}function uQ(e,t){for(let n=De(e);null!==n;n=He(n))for(let r=Eo;r-1&&(ZE(t,r),Yv(n,r))}this._attachedToViewContainer=!1}$M(this._lView[Ht],this._lView)}onDestroy(t){jb(this._lView,t)}markForCheck(){iT(this._cdRefInjectingView||this._lView)}detach(){this._lView[Wn]&=-129}reattach(){HS(this._lView),this._lView[Wn]|=128}detectChanges(){this._lView[Wn]|=1024,e4(this._lView,this.notifyErrorHandler)}checkNoChanges(){}attachToViewContainerRef(){if(this._appRef)throw new Xt(902,!1);this._attachedToViewContainer=!0}detachFromAppRef(){this._appRef=null,kZ(this._lView[Ht],this._lView)}attachToAppRef(t){if(this._attachedToViewContainer)throw new Xt(902,!1);this._appRef=t,HS(this._lView)}}let qm=(()=>{class e{static#e=this.__NG_ELEMENT_ID__=mAe}return e})();const pAe=qm,hAe=class extends pAe{constructor(t,n,r){super(),this._declarationLView=t,this._declarationTContainer=n,this.elementRef=r}get ssrId(){return this._declarationTContainer.tView?.ssrId||null}createEmbeddedView(t,n){return this.createEmbeddedViewImpl(t,n)}createEmbeddedViewImpl(t,n,r){const i=tT(this._declarationLView,this._declarationTContainer,t,{embeddedViewInjector:n,dehydratedView:r});return new oT(i)}};function mAe(){return t4(ro(),_t())}function t4(e,t){return 4&e.type?new hAe(t,e,Kb(e,t)):null}let bQ=()=>null;function vC(e,t){return bQ(e,t)}class z6{}class jAe{}class vQ{}class zAe{resolveComponentFactory(t){throw function UAe(e){const t=Error(`No component factory found for ${ya(e)}.`);return t.ngComponent=e,t}(t)}}let s4=(()=>{class e{static#e=this.NULL=new zAe}return e})();class _Q{}let a4=(()=>{class e{constructor(){this.destroyNode=null}static#e=this.__NG_ELEMENT_ID__=()=>function VAe(){const e=_t(),n=Wc(ro().index,e);return(Pl(n)?n:e)[_r]}()}return e})(),HAe=(()=>{class e{static#e=this.\u0275prov=gn({token:e,providedIn:"root",factory:()=>null})}return e})();const V6={},SQ=new Set;function Wm(e){SQ.has(e)||(SQ.add(e),performance?.mark?.("mark_feature_usage",{detail:{feature:e}}))}function CQ(...e){}class To{constructor({enableLongStackTrace:t=!1,shouldCoalesceEventChangeDetection:n=!1,shouldCoalesceRunChangeDetection:r=!1}){if(this.hasPendingMacrotasks=!1,this.hasPendingMicrotasks=!1,this.isStable=!0,this.onUnstable=new rl(!1),this.onMicrotaskEmpty=new rl(!1),this.onStable=new rl(!1),this.onError=new rl(!1),typeof Zone>"u")throw new Xt(908,!1);Zone.assertZonePatched();const i=this;i._nesting=0,i._outer=i._inner=Zone.current,Zone.TaskTrackingZoneSpec&&(i._inner=i._inner.fork(new Zone.TaskTrackingZoneSpec)),t&&Zone.longStackTraceZoneSpec&&(i._inner=i._inner.fork(Zone.longStackTraceZoneSpec)),i.shouldCoalesceEventChangeDetection=!r&&n,i.shouldCoalesceRunChangeDetection=r,i.lastRequestAnimationFrameId=-1,i.nativeRequestAnimationFrame=function GAe(){const e="function"==typeof Gn.requestAnimationFrame;let t=Gn[e?"requestAnimationFrame":"setTimeout"],n=Gn[e?"cancelAnimationFrame":"clearTimeout"];if(typeof Zone<"u"&&t&&n){const r=t[Zone.__symbol__("OriginalDelegate")];r&&(t=r);const i=n[Zone.__symbol__("OriginalDelegate")];i&&(n=i)}return{nativeRequestAnimationFrame:t,nativeCancelAnimationFrame:n}}().nativeRequestAnimationFrame,function $Ae(e){const t=()=>{!function WAe(e){e.isCheckStableRunning||-1!==e.lastRequestAnimationFrameId||(e.lastRequestAnimationFrameId=e.nativeRequestAnimationFrame.call(Gn,()=>{e.fakeTopEventTask||(e.fakeTopEventTask=Zone.root.scheduleEventTask("fakeTopEventTask",()=>{e.lastRequestAnimationFrameId=-1,G6(e),e.isCheckStableRunning=!0,H6(e),e.isCheckStableRunning=!1},void 0,()=>{},()=>{})),e.fakeTopEventTask.invoke()}),G6(e))}(e)};e._inner=e._inner.fork({name:"angular",properties:{isAngularZone:!0},onInvokeTask:(n,r,i,o,s,a)=>{if(function YAe(e){return!(!Array.isArray(e)||1!==e.length)&&!0===e[0].data?.__ignore_ng_zone__}(a))return n.invokeTask(i,o,s,a);try{return wQ(e),n.invokeTask(i,o,s,a)}finally{(e.shouldCoalesceEventChangeDetection&&"eventTask"===o.type||e.shouldCoalesceRunChangeDetection)&&t(),AQ(e)}},onInvoke:(n,r,i,o,s,a,l)=>{try{return wQ(e),n.invoke(i,o,s,a,l)}finally{e.shouldCoalesceRunChangeDetection&&t(),AQ(e)}},onHasTask:(n,r,i,o)=>{n.hasTask(i,o),r===i&&("microTask"==o.change?(e._hasPendingMicrotasks=o.microTask,G6(e),H6(e)):"macroTask"==o.change&&(e.hasPendingMacrotasks=o.macroTask))},onHandleError:(n,r,i,o)=>(n.handleError(i,o),e.runOutsideAngular(()=>e.onError.emit(o)),!1)})}(i)}static isInAngularZone(){return typeof Zone<"u"&&!0===Zone.current.get("isAngularZone")}static assertInAngularZone(){if(!To.isInAngularZone())throw new Xt(909,!1)}static assertNotInAngularZone(){if(To.isInAngularZone())throw new Xt(909,!1)}run(t,n,r){return this._inner.run(t,n,r)}runTask(t,n,r,i){const o=this._inner,s=o.scheduleEventTask("NgZoneEvent: "+i,t,qAe,CQ,CQ);try{return o.runTask(s,n,r)}finally{o.cancelTask(s)}}runGuarded(t,n,r){return this._inner.runGuarded(t,n,r)}runOutsideAngular(t){return this._outer.run(t)}}const qAe={};function H6(e){if(0==e._nesting&&!e.hasPendingMicrotasks&&!e.isStable)try{e._nesting++,e.onMicrotaskEmpty.emit(null)}finally{if(e._nesting--,!e.hasPendingMicrotasks)try{e.runOutsideAngular(()=>e.onStable.emit(null))}finally{e.isStable=!0}}}function G6(e){e.hasPendingMicrotasks=!!(e._hasPendingMicrotasks||(e.shouldCoalesceEventChangeDetection||e.shouldCoalesceRunChangeDetection)&&-1!==e.lastRequestAnimationFrameId)}function wQ(e){e._nesting++,e.isStable&&(e.isStable=!1,e.onUnstable.emit(null))}function AQ(e){e._nesting--,H6(e)}var Dx=function(e){return e[e.EarlyRead=0]="EarlyRead",e[e.Write=1]="Write",e[e.MixedReadWrite=2]="MixedReadWrite",e[e.Read=3]="Read",e}(Dx||{});const EQ={destroy(){}};function TQ(e,t){!t&&function Zd(e){if(!sM())throw new Xt(-203,!1)}();const n=t?.injector??qt(Jl);if(!function n1(e){return"browser"===(e??qt(Jl)).get(Ex)}(n))return EQ;Wm("NgAfterNextRender");const r=n.get(uT),i=r.handler??=new PQ,o=t?.phase??Dx.MixedReadWrite,s=()=>{i.unregister(l),a()},a=n.get(Yb).onDestroy(s),l=Hf(n,()=>new DQ(o,()=>{s(),e()}));return i.register(l),{destroy:s}}class DQ{constructor(t,n){this.phase=t,this.callbackFn=n,this.zone=qt(To),this.errorHandler=qt(af,{optional:!0}),qt(z6,{optional:!0})?.notify(1)}invoke(){try{this.zone.runOutsideAngular(this.callbackFn)}catch(t){this.errorHandler?.handleError(t)}}}class PQ{constructor(){this.executingCallbacks=!1,this.buckets={[Dx.EarlyRead]:new Set,[Dx.Write]:new Set,[Dx.MixedReadWrite]:new Set,[Dx.Read]:new Set},this.deferredCallbacks=new Set}register(t){(this.executingCallbacks?this.deferredCallbacks:this.buckets[t.phase]).add(t)}unregister(t){this.buckets[t.phase].delete(t),this.deferredCallbacks.delete(t)}execute(){this.executingCallbacks=!0;for(const t of Object.values(this.buckets))for(const n of t)n.invoke();this.executingCallbacks=!1;for(const t of this.deferredCallbacks)this.buckets[t.phase].add(t);this.deferredCallbacks.clear()}destroy(){for(const t of Object.values(this.buckets))t.clear();this.deferredCallbacks.clear()}}let uT=(()=>{class e{constructor(){this.handler=null,this.internalCallbacks=[]}execute(){this.executeInternalCallbacks(),this.handler?.execute()}executeInternalCallbacks(){const n=[...this.internalCallbacks];this.internalCallbacks.length=0;for(const r of n)r()}ngOnDestroy(){this.handler?.destroy(),this.handler=null,this.internalCallbacks.length=0}static#e=this.\u0275prov=gn({token:e,providedIn:"root",factory:()=>new e})}return e})();function c4(e,t,n){let r=n?e.styles:null,i=n?e.classes:null,o=0;if(null!==t)for(let s=0;s0&&HZ(e,n,o.join(" "))}}(p,A,h,r),void 0!==n&&function aIe(e,t,n){const r=e.projection=[];for(let i=0;i{class e{static#e=this.__NG_ELEMENT_ID__=cIe}return e})();function cIe(){return BQ(ro(),_t())}const uIe=Ih,FQ=class extends uIe{constructor(t,n,r){super(),this._lContainer=t,this._hostTNode=n,this._hostLView=r}get element(){return Kb(this._hostTNode,this._hostLView)}get injector(){return new Ls(this._hostTNode,this._hostLView)}get parentInjector(){const t=Ql(this._hostTNode,this._hostLView);if(ZS(t)){const n=Hb(t,this._hostLView),r=$c(t);return new Ls(n[Ht].data[r+8],n)}return new Ls(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(t){const n=OQ(this._lContainer);return null!==n&&n[t]||null}get length(){return this._lContainer.length-Eo}createEmbeddedView(t,n,r){let i,o;"number"==typeof r?i=r:null!=r&&(i=r.index,o=r.injector);const s=vC(this._lContainer,t.ssrId),a=t.createEmbeddedViewImpl(n||{},o,s);return this.insertImpl(a,i,bC(this._hostTNode,s)),a}createComponent(t,n,r,i,o){const s=t&&!function Jd(e){return"function"==typeof e}(t);let a;if(s)a=n;else{const m=n||{};a=m.index,r=m.injector,i=m.projectableNodes,o=m.environmentInjector||m.ngModuleRef}const l=s?t:new pT(Yr(t)),c=r||this.parentInjector;if(!o&&null==l.ngModule){const h=(s?c:this.parentInjector).get(Na,null);h&&(o=h)}const u=Yr(l.componentType??{}),d=vC(this._lContainer,u?.id??null),p=l.create(c,i,d?.firstChild??null,o);return this.insertImpl(p.hostView,a,bC(this._hostTNode,d)),p}insert(t,n){return this.insertImpl(t,n,!0)}insertImpl(t,n,r){const i=t._lView;if(function zS(e){return Oa(e[Fs])}(i)){const a=this.indexOf(t);if(-1!==a)this.detach(a);else{const l=i[Fs],c=new FQ(l,l[tl],l[Fs]);c.detach(c.indexOf(t))}}const o=this._adjustIndex(n),s=this._lContainer;return nT(s,i,o,r),t.attachToViewContainerRef(),Ab(Y6(s),o,t),t}move(t,n){return this.insert(t,n)}indexOf(t){const n=OQ(this._lContainer);return null!==n?n.indexOf(t):-1}remove(t){const n=this._adjustIndex(t,-1),r=ZE(this._lContainer,n);r&&(Yv(Y6(this._lContainer),n),$M(r[Ht],r))}detach(t){const n=this._adjustIndex(t,-1),r=ZE(this._lContainer,n);return r&&null!=Yv(Y6(this._lContainer),n)?new oT(r):null}_adjustIndex(t,n=0){return t??this.length+n}};function OQ(e){return e[8]}function Y6(e){return e[8]||(e[8]=[])}function BQ(e,t){let n;const r=t[e.index];return Oa(r)?n=r:(n=tQ(r,t,null,e),t[e.index]=n,QM(t,n)),LQ(n,t,e,r),new FQ(n,e,t)}let LQ=function UQ(e,t,n,r){if(e[md])return;let i;i=8&n.type?mo(r):function dIe(e,t){const n=e[_r],r=n.createComment(""),i=Yl(t,e);return Tx(n,YM(n,i),r,function Iwe(e,t){return e.nextSibling(t)}(n,i),!1),r}(t,n),e[md]=i},X6=()=>!1;class K6{constructor(t){this.queryList=t,this.matches=null}clone(){return new K6(this.queryList)}setDirty(){this.queryList.setDirty()}}class Z6{constructor(t=[]){this.queries=t}createEmbeddedView(t){const n=t.queries;if(null!==n){const r=null!==t.contentQueries?t.contentQueries[0]:n.length,i=[];for(let o=0;ot.trim())}(t):t}}class Q6{constructor(t=[]){this.queries=t}elementStart(t,n){for(let r=0;r0)r.push(s[a/2]);else{const c=o[a+1],u=t[-l];for(let d=Eo;dn()),this.destroyCbs=null}onDestroy(t){this.destroyCbs.push(t)}}class o8 extends pJ{constructor(t){super(),this.moduleType=t}create(t){return new i8(this.moduleType,t,[])}}class hJ extends Px{constructor(t){super(),this.componentFactoryResolver=new RQ(this),this.instance=null;const n=new Kd([...t.providers,{provide:Px,useValue:this},{provide:s4,useValue:this.componentFactoryResolver}],t.parent||Dl(),t.debugName,new Set(["environment"]));this.injector=n,t.runEnvironmentInitializers&&n.resolveInjectorInitializers()}destroy(){this.injector.destroy()}onDestroy(t){this.injector.onDestroy(t)}}function f4(e,t,n=null){return new hJ({providers:e,parent:t,debugName:n,runEnvironmentInitializers:!0}).injector}let _C=(()=>{class e{constructor(){this.taskId=0,this.pendingTasks=new Set,this.hasPendingTasks=new Ao(!1)}get _hasPendingTasks(){return this.hasPendingTasks.value}add(){this._hasPendingTasks||this.hasPendingTasks.next(!0);const n=this.taskId++;return this.pendingTasks.add(n),n}remove(n){this.pendingTasks.delete(n),0===this.pendingTasks.size&&this._hasPendingTasks&&this.hasPendingTasks.next(!1)}ngOnDestroy(){this.pendingTasks.clear(),this._hasPendingTasks&&this.hasPendingTasks.next(!1)}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function s8(e){return null!==e&&("function"==typeof e||"object"==typeof e)}function za(e,t,n){return!Object.is(e[t],n)&&(e[t]=n,!0)}function Ym(e,t,n,r,i,o,s,a){const l=_t(),c=ai(),u=e+Ar,d=c.firstCreatePass?function YIe(e,t,n,r,i,o,s,a,l){const c=t.consts,u=yC(t,e,4,s||null,Au(c,a));T6(t,n,u,Au(c,l)),gx(t,u);const d=u.tView=E6(2,u,r,i,o,t.directiveRegistry,t.pipeRegistry,null,t.schemas,c,null);return null!==t.queries&&(t.queries.template(t,u),d.queries=t.queries.embeddedTView(u)),u}(u,c,l,t,n,r,i,o,s):c.data[u];rf(d,!1);const f=mJ(c,l,d,e);vn()&&XM(c,l,f,d),Fl(f,l);const p=tQ(f,l,f,d);return l[u]=p,QM(l,p),function jQ(e,t,n){return X6(e,t,n)}(p,d,l),kb(d)&&A6(c,l,d),null!=s&&I6(l,d,a),Ym}let mJ=function gJ(e,t,n,r){return Pc(!0),t[_r].createComment("")};function g8(e,t,n,r){const i=_t();return za(i,Iu(),t)&&(ai(),Gm(io(),i,e,t,n,r)),g8}function _4(e,t){return e<<17|t<<2}function a1(e){return e>>17&32767}function y8(e){return 2|e}function Rx(e){return(131068&e)>>2}function b8(e,t){return-131069&e|t<<2}function v8(e){return 1|e}function $J(e,t,n,r){const i=e[n+1],o=null===t;let s=r?a1(i):Rx(i),a=!1;for(;0!==s&&(!1===a||o);){const c=e[s+1];MEe(e[s],t)&&(a=!0,e[s+1]=r?v8(c):y8(c)),s=r?a1(c):Rx(c)}a&&(e[n+1]=r?y8(i):v8(i))}function MEe(e,t){return null===e||null==t||(Array.isArray(e)?e[1]:e)===t||!(!Array.isArray(e)||"string"!=typeof t)&&Tm(e,t)>=0}function R0(e,t,n){const r=_t();return za(r,Iu(),t)&&function yd(e,t,n,r,i,o,s,a){const l=Yl(t,n);let u,c=t.inputs;!a&&null!=c&&(u=c[r])?(M6(e,n,u,r,i),Rm(t)&&function zwe(e,t){const n=Wc(t,e);16&n[Wn]||(n[Wn]|=64)}(n,t.index)):3&t.type&&(r=function Uwe(e){return"class"===e?"className":"for"===e?"htmlFor":"formaction"===e?"formAction":"innerHtml"===e?"innerHTML":"readonly"===e?"readOnly":"tabindex"===e?"tabIndex":e}(r),i=null!=s?s(i,t.value||"",r):i,o.setProperty(l,r,i))}(ai(),io(),r,e,t,r[_r],n,!1),R0}function x8(e,t,n,r,i){const s=i?"class":"style";M6(e,n,t.inputs[s],s,r)}function xT(e,t,n){return Eh(e,t,n,!1),xT}function _8(e,t){return Eh(e,t,null,!0),_8}function Eh(e,t,n,r){const i=_t(),o=ai(),s=function $f(e){const t=yr.lFrame,n=t.bindingIndex;return t.bindingIndex=t.bindingIndex+e,n}(2);o.firstUpdatePass&&function tee(e,t,n,r){const i=e.data;if(null===i[n+1]){const o=i[kl()],s=function eee(e,t){return t>=e.expandoStartIndex}(e,n);(function oee(e,t){return!!(e.flags&(t?8:16))})(o,r)&&null===t&&!s&&(t=!1),t=function zEe(e,t,n,r){const i=function WS(e){const t=yr.lFrame.currentDirectiveIndex;return-1===t?null:e[t]}(e);let o=r?t.residualClasses:t.residualStyles;if(null===i)0===(r?t.classBindings:t.styleBindings)&&(n=_T(n=S8(null,e,t,n,r),t.attrs,r),o=null);else{const s=t.directiveStylingLast;if(-1===s||e[s]!==i)if(n=S8(i,e,t,n,r),null===o){let l=function VEe(e,t,n){const r=n?t.classBindings:t.styleBindings;if(0!==Rx(r))return e[a1(r)]}(e,t,r);void 0!==l&&Array.isArray(l)&&(l=S8(null,e,t,l[1],r),l=_T(l,t.attrs,r),function HEe(e,t,n,r){e[a1(n?t.classBindings:t.styleBindings)]=r}(e,t,r,l))}else o=function GEe(e,t,n){let r;const i=t.directiveEnd;for(let o=1+t.directiveStylingLast;o0)&&(c=!0)):u=n,i)if(0!==l){const f=a1(e[a+1]);e[r+1]=_4(f,a),0!==f&&(e[f+1]=b8(e[f+1],r)),e[a+1]=function TEe(e,t){return 131071&e|t<<17}(e[a+1],r)}else e[r+1]=_4(a,0),0!==a&&(e[a+1]=b8(e[a+1],r)),a=r;else e[r+1]=_4(l,0),0===a?a=r:e[l+1]=b8(e[l+1],r),l=r;c&&(e[r+1]=y8(e[r+1])),$J(e,u,r,!0),$J(e,u,r,!1),function kEe(e,t,n,r,i){const o=i?e.residualClasses:e.residualStyles;null!=o&&"string"==typeof t&&Tm(o,t)>=0&&(n[r+1]=v8(n[r+1]))}(t,u,e,r,o),s=_4(a,l),o?t.classBindings=s:t.styleBindings=s}(i,o,t,n,s,r)}}(o,e,s,r),t!==Gr&&za(i,s,t)&&function ree(e,t,n,r,i,o,s,a){if(!(3&t.type))return;const l=e.data,c=l[a+1],u=function DEe(e){return!(1&~e)}(c)?iee(l,t,n,i,Rx(c),s):void 0;S4(u)||(S4(o)||function EEe(e){return!(2&~e)}(c)&&(o=iee(l,null,n,i,a,s)),function Dwe(e,t,n,r,i){if(t)i?e.addClass(n,r):e.removeClass(n,r);else{let o=-1===r.indexOf("-")?void 0:r1.DashCase;null==i?e.removeStyle(n,r,o):("string"==typeof i&&i.endsWith("!important")&&(i=i.slice(0,-10),o|=r1.Important),e.setStyle(n,r,i,o))}}(r,s,Ob(kl(),n),i,o))}(o,o.data[kl()],i,i[_r],e,i[s+1]=function YEe(e,t){return null==e||""===e||("string"==typeof t?e+=t:"object"==typeof e&&(e=ya(t1(e)))),e}(t,n),r,s)}function S8(e,t,n,r,i){let o=null;const s=n.directiveEnd;let a=n.directiveStylingLast;for(-1===a?a=n.directiveStart:a++;a0;){const l=e[i],c=Array.isArray(l),u=c?l[1]:l,d=null===u;let f=n[i+1];f===Gr&&(f=d?xi:void 0);let p=d?Em(f,r):u===r?f:void 0;if(c&&!S4(p)&&(p=Em(l,r)),S4(p)&&(a=p,s))return a;const m=e[i+1];i=s?a1(m):Rx(m)}if(null!==t){let l=o?t.residualClasses:t.residualStyles;null!=l&&(a=Em(l,r))}return a}function S4(e){return void 0!==e}class oTe{destroy(t){}updateValue(t,n){}swap(t,n){const r=Math.min(t,n),i=Math.max(t,n),o=this.detach(i);if(i-r>1){const s=this.detach(r);this.attach(r,o),this.attach(i,s)}else this.attach(r,o)}move(t,n){this.attach(n,this.detach(t))}}function C8(e,t,n,r,i){return e===n&&Object.is(t,r)?1:Object.is(i(e,t),i(n,r))?-1:0}function w8(e,t,n,r){return!(void 0===t||!t.has(r)||(e.attach(n,t.get(r)),t.delete(r),0))}function see(e,t,n,r,i){if(w8(e,t,r,n(r,i)))e.updateValue(r,i);else{const o=e.create(r,i);e.attach(r,o)}}function aee(e,t,n,r){const i=new Set;for(let o=t;o<=n;o++)i.add(r(o,e.at(o)));return i}class lee{constructor(){this.kvMap=new Map,this._vMap=void 0}has(t){return this.kvMap.has(t)}delete(t){if(!this.has(t))return!1;const n=this.kvMap.get(t);return void 0!==this._vMap&&this._vMap.has(n)?(this.kvMap.set(t,this._vMap.get(n)),this._vMap.delete(n)):this.kvMap.delete(t),!0}get(t){return this.kvMap.get(t)}set(t,n){if(this.kvMap.has(t)){let r=this.kvMap.get(t);void 0===this._vMap&&(this._vMap=new Map);const i=this._vMap;for(;i.has(r);)r=i.get(r);i.set(r,n)}else this.kvMap.set(t,n)}forEach(t){for(let[n,r]of this.kvMap)if(t(r,n),void 0!==this._vMap){const i=this._vMap;for(;i.has(r);)r=i.get(r),t(r,n)}}}function ST(e,t,n){Wm("NgControlFlow");const r=_t(),i=Iu(),o=A8(r,Ar+e);if(za(r,i,t)){const a=hr(null);try{if(N6(o,0),-1!==t){const l=I8(r[Ht],Ar+t),c=vC(o,l.tView.ssrId);nT(o,tT(r,l,n,{dehydratedView:c}),0,bC(l,c))}}finally{hr(a)}}else{const a=sQ(o,0);void 0!==a&&(a[Fo]=n)}}class aTe{constructor(t,n,r){this.lContainer=t,this.$implicit=n,this.$index=r}get $count(){return this.lContainer.length-Eo}}function CT(e){return e}class cTe{constructor(t,n,r){this.hasEmptyBlock=t,this.trackByFn=n,this.liveCollection=r}}function wT(e,t,n,r,i,o,s,a,l,c,u,d,f){Wm("NgControlFlow");const p=void 0!==l,m=_t(),h=a?s.bind(m[Io][Fo]):s,g=new cTe(p,h);m[Ar+e]=g,Ym(e+1,t,n,r,i,o),p&&Ym(e+2,l,c,u,d,f)}class uTe extends oTe{constructor(t,n,r){super(),this.lContainer=t,this.hostLView=n,this.templateTNode=r,this.needsIndexUpdate=!1}get length(){return this.lContainer.length-Eo}at(t){return this.getLView(t)[Fo].$implicit}attach(t,n){const r=n[Hc];this.needsIndexUpdate||=t!==this.length,nT(this.lContainer,n,t,bC(this.templateTNode,r))}detach(t){return this.needsIndexUpdate||=t!==this.length-1,function dTe(e,t){return ZE(e,t)}(this.lContainer,t)}create(t,n){const r=vC(this.lContainer,this.templateTNode.tView.ssrId);return tT(this.hostLView,this.templateTNode,new aTe(this.lContainer,n,t),{dehydratedView:r})}destroy(t){$M(t[Ht],t)}updateValue(t,n){this.getLView(t)[Fo].$implicit=n}reset(){this.needsIndexUpdate=!1}updateIndexes(){if(this.needsIndexUpdate)for(let t=0;t{e.destroy(a)})}(s,e,o.trackByFn),s.updateIndexes(),o.hasEmptyBlock){const a=Iu(),l=0===s.length;if(za(r,a,l)){const c=n+2,u=A8(r,c);if(l){const d=I8(i,c),f=vC(u,d.tView.ssrId);nT(u,tT(r,d,void 0,{dehydratedView:f}),0,bC(d,f))}else N6(u,0)}}}finally{hr(t)}}function A8(e,t){return e[t]}function I8(e,t){return Bb(e,t)}function br(e,t,n,r){const i=_t(),o=ai(),s=Ar+e,a=i[_r],l=o.firstCreatePass?function pTe(e,t,n,r,i,o){const s=t.consts,l=yC(t,e,2,r,Au(s,i));return T6(t,n,l,Au(s,o)),null!==l.attrs&&c4(l,l.attrs,!1),null!==l.mergedAttrs&&c4(l,l.mergedAttrs,!0),null!==t.queries&&t.queries.elementStart(t,l),l}(s,o,i,t,n,r):o.data[s],c=cee(o,i,l,a,t,e);i[s]=c;const u=kb(l);return rf(l,!0),GZ(a,c,l),!function gT(e){return!(32&~e.flags)}(l)&&vn()&&XM(o,i,c,l),0===function DL(){return yr.lFrame.elementDepthCount}()&&Fl(c,i),function PL(){yr.lFrame.elementDepthCount++}(),u&&(A6(o,i,l),w6(o,l,i)),null!==r&&I6(i,l),br}function Sr(){let e=ro();SE()?Xl():(e=e.parent,rf(e,!1));const t=e;(function qS(e){return yr.skipHydrationRootTNode===e})(t)&&function Ub(){yr.skipHydrationRootTNode=null}(),function vM(){yr.lFrame.elementDepthCount--}();const n=ai();return n.firstCreatePass&&(gx(n,e),kS(e)&&n.queries.elementEnd(e)),null!=t.classesWithoutHost&&function Bm(e){return!!(8&e.flags)}(t)&&x8(n,t,_t(),t.classesWithoutHost,!0),null!=t.stylesWithoutHost&&function wM(e){return!!(16&e.flags)}(t)&&x8(n,t,_t(),t.stylesWithoutHost,!1),Sr}function js(e,t,n,r){return br(e,t,n,r),Sr(),js}let cee=(e,t,n,r,i,o)=>(Pc(!0),WM(r,i,function Ml(){return yr.lFrame.currentNamespace}()));function E8(e,t,n){const r=_t(),i=ai(),o=e+Ar,s=i.firstCreatePass?function gTe(e,t,n,r,i){const o=t.consts,s=Au(o,r),a=yC(t,e,8,"ng-container",s);return null!==s&&c4(a,s,!0),T6(t,n,a,Au(o,i)),null!==t.queries&&t.queries.elementStart(t,a),a}(o,i,r,t,n):i.data[o];rf(s,!0);const a=uee(i,r,s,e);return r[o]=a,vn()&&XM(i,r,a,s),Fl(a,r),kb(s)&&(A6(i,r,s),w6(i,s,r)),null!=n&&I6(r,s),E8}function T8(){let e=ro();const t=ai();return SE()?Xl():(e=e.parent,rf(e,!1)),t.firstCreatePass&&(gx(t,e),kS(e)&&t.queries.elementEnd(e)),T8}function D8(e,t,n){return E8(e,t,n),T8(),D8}let uee=(e,t,n,r)=>(Pc(!0),y6(t[_r],""));function C4(){return _t()}const jC="en-US";let mee=jC;function Fx(e,t,n,r){const i=_t(),o=ai(),s=ro();return function M8(e,t,n,r,i,o,s){const a=kb(r),c=e.firstCreatePass&&iQ(e),u=t[Fo],d=rQ(t);let f=!0;if(3&r.type||s){const h=Yl(r,t),g=s?s(h):h,y=d.length,v=s?_=>s(mo(_[r.index])):r.index;let x=null;if(!s&&a&&(x=function y3e(e,t,n,r){const i=e.cleanup;if(null!=i)for(let o=0;ol?a[l]:null}"string"==typeof s&&(o+=2)}return null}(e,t,i,r.index)),null!==x)(x.__ngLastListenerFn__||x).__ngNextListenerFn__=o,x.__ngLastListenerFn__=o,f=!1;else{o=Hee(r,t,u,o,!1);const _=n.listen(g,i,o);d.push(o,_),c&&c.push(i,v,y,y+1)}}else o=Hee(r,t,u,o,!1);const p=r.outputs;let m;if(f&&null!==p&&(m=p[i])){const h=m.length;if(h)for(let g=0;g-1?Wc(e.index,t):t);let l=Vee(t,n,r,s),c=o.__ngNextListenerFn__;for(;c;)l=Vee(t,n,c,s)&&l,c=c.__ngNextListenerFn__;return i&&!1===l&&s.preventDefault(),l}}function Pu(e=1){return function PE(e){return(yr.lFrame.contextLView=function vE(e,t){for(;e>0;)t=t[vh],e--;return t}(e,yr.lFrame.contextLView))[Fo]}(e)}function N8(e,t,n,r){!function qQ(e,t,n,r){const i=ai();if(i.firstCreatePass){const o=ro();WQ(i,new zQ(t,n,r),o.index),function xIe(e,t){const n=e.contentQueries||(e.contentQueries=[]);t!==(n.length?n[n.length-1]:-1)&&n.push(e.queries.length-1,t)}(i,e),!(2&~n)&&(i.staticContentQueries=!0)}return HQ(i,_t(),n)}(e,t,n,r)}function F8(e,t,n){!function GQ(e,t,n){const r=ai();return r.firstCreatePass&&(WQ(r,new zQ(e,t,n),-1),!(2&~t)&&(r.staticViewQueries=!0)),HQ(r,_t(),t)}(e,t,n)}function MT(e){const t=_t(),n=ai(),r=px();w0(r+1);const i=n8(n,r);if(e.dirty&&function dx(e){return!(4&~e[Wn])}(t)===!(2&~i.metadata.flags)){if(null===i.matches)e.reset([]);else{const o=$Q(t,r);e.reset(o,nC),e.notifyOnChanges()}return!0}return!1}function RT(){return function t8(e,t){return e[ef].queries[t].queryList}(_t(),px())}function Li(e,t=""){const n=_t(),r=ai(),i=e+Ar,o=r.firstCreatePass?yC(r,i,1,t,null):r.data[i],s=lte(r,n,o,t,e);n[i]=s,vn()&&XM(r,n,s,o),rf(o,!1)}let lte=(e,t,n,r,i)=>(Pc(!0),function g6(e,t){return e.createText(t)}(t[_r],r));function T4(e){return UC("",e,""),T4}function UC(e,t,n){const r=_t(),i=function DC(e,t,n,r){return za(e,Iu(),n)?t+Tr(n)+r:Gr}(r,e,t,n);return i!==Gr&&function M0(e,t,n){const r=Ob(t,e);!function PZ(e,t,n){e.setValue(t,n)}(e[_r],r,n)}(r,kl(),i),UC}function O8(e,t,n,r,i){if(e=Zn(e),Array.isArray(e))for(let o=0;o>20;if(fd(e)||!e.multi){const p=new I0(c,i,On),m=L8(l,t,i?u:u+f,d);-1===m?(Lm(oa(a,s),o,l),B8(o,e,t.length),t.push(l),a.directiveStart++,a.directiveEnd++,i&&(a.providerIndexes+=1048576),n.push(p),s.push(p)):(n[m]=p,s[m]=p)}else{const p=L8(l,t,u+f,d),m=L8(l,t,u,u+f),g=m>=0&&n[m];if(i&&!g||!i&&!(p>=0&&n[p])){Lm(oa(a,s),o,l);const y=function z3e(e,t,n,r,i){const o=new I0(e,n,On);return o.multi=[],o.index=t,o.componentProviders=0,vte(o,i,r&&!n),o}(i?U3e:j3e,n.length,i,r,c);!i&&g&&(n[m].providerFactory=y),B8(o,e,t.length,0),t.push(l),a.directiveStart++,a.directiveEnd++,i&&(a.providerIndexes+=1048576),n.push(y),s.push(y)}else B8(o,e,p>-1?p:m,vte(n[i?m:p],c,!i&&r));!i&&r&&g&&n[m].componentProviders++}}}function B8(e,t,n,r){const i=fd(t),o=function Pm(e){return!!e.useClass}(t);if(i||o){const l=(o?Zn(t.useClass):t).prototype.ngOnDestroy;if(l){const c=e.destroyHooks||(e.destroyHooks=[]);if(!i&&t.multi){const u=c.indexOf(n);-1===u?c.push(n,[r,l]):c[u+1].push(r,l)}else c.push(n,l)}}}function vte(e,t,n){return n&&e.componentProviders++,e.multi.push(t)-1}function L8(e,t,n,r){for(let i=n;i{n.providersResolver=(r,i)=>function L3e(e,t,n){const r=ai();if(r.firstCreatePass){const i=qc(e);O8(n,r.data,r.blueprint,i,!0),O8(t,r.data,r.blueprint,i,!1)}}(r,i?i(e):e,t)}}let V3e=(()=>{class e{constructor(n){this._injector=n,this.cachedInjectors=new Map}getOrCreateStandaloneInjector(n){if(!n.standalone)return null;if(!this.cachedInjectors.has(n)){const r=Xd(0,n.type),i=r.length>0?f4([r],this._injector,`Standalone[${n.type.name}]`):null;this.cachedInjectors.set(n,i)}return this.cachedInjectors.get(n)}ngOnDestroy(){try{for(const n of this.cachedInjectors.values())null!==n&&n.destroy()}finally{this.cachedInjectors.clear()}}static#e=this.\u0275prov=gn({token:e,providedIn:"environment",factory:()=>new e(Rn(Na))})}return e})();function Dh(e){Wm("NgStandalone"),e.getStandaloneInjector=t=>t.get(V3e).getOrCreateStandaloneInjector(e)}function Ste(e,t,n,r,i,o){const s=t+n;return za(e,s,i)?function $m(e,t,n){return e[t]=n}(e,s+1,o?r.call(o,i):r(i)):function FT(e,t){const n=e[t];return n===Gr?void 0:n}(e,s+1)}function Ox(e,t){const n=ai();let r;const i=e+Ar;n.firstCreatePass?(r=function eDe(e,t){if(t)for(let n=t.length-1;n>=0;n--){const r=t[n];if(e===r.name)return r}}(t,n.pipeRegistry),n.data[i]=r,r.onDestroy&&(n.destroyHooks??=[]).push(i,r.onDestroy)):r=n.data[i];const o=r.factory||(r.factory=f0(r.type)),a=Uc(On);try{const l=yx(!1),c=o();return yx(l),function w3e(e,t,n,r){n>=e.data.length&&(e.data[n]=null,e.blueprint[n]=null),t[n]=r}(n,_t(),i,c),c}finally{Uc(a)}}function Bx(e,t,n){const r=e+Ar,i=_t(),o=function S0(e,t){return e[t]}(i,r);return function OT(e,t){return e[Ht].data[t].pure}(i,r)?Ste(i,Kl(),t,o.transform,n,o):o.transform(n)}let Vte=(()=>{class e{log(n){console.log(n)}warn(n){console.warn(n)}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();const $te=new jn("");function N4(e){return!!e&&"function"==typeof e.then}function Yte(e){return!!e&&"function"==typeof e.subscribe}const Y8=new jn("");let X8=(()=>{class e{constructor(){this.initialized=!1,this.done=!1,this.donePromise=new Promise((n,r)=>{this.resolve=n,this.reject=r}),this.appInits=qt(Y8,{optional:!0})??[]}runInitializers(){if(this.initialized)return;const n=[];for(const i of this.appInits){const o=i();if(N4(o))n.push(o);else if(Yte(o)){const s=new Promise((a,l)=>{o.subscribe({complete:a,error:l})});n.push(s)}}const r=()=>{this.done=!0,this.resolve()};Promise.all(n).then(()=>{r()}).catch(i=>{this.reject(i)}),0===n.length&&r(),this.initialized=!0}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();const F4=new jn("");let l1=(()=>{class e{constructor(){this._bootstrapListeners=[],this._runningTick=!1,this._destroyed=!1,this._destroyListeners=[],this._views=[],this.internalErrorHandler=qt(Hm),this.afterRenderEffectManager=qt(uT),this.externalTestViews=new Set,this.beforeRender=new si,this.afterTick=new si,this.componentTypes=[],this.components=[],this.isStable=qt(_C).hasPendingTasks.pipe(hn(n=>!n)),this._injector=qt(Na)}get destroyed(){return this._destroyed}get injector(){return this._injector}bootstrap(n,r){const i=n instanceof vQ;if(!this._injector.get(X8).done)throw!i&&function fh(e){const t=Yr(e)||ra(e)||Tl(e);return null!==t&&t.standalone}(n),new Xt(405,!1);let s;s=i?n:this._injector.get(s4).resolveComponentFactory(n),this.componentTypes.push(s.componentType);const a=function JDe(e){return e.isBoundToModule}(s)?void 0:this._injector.get(Px),c=s.create(Jl.NULL,[],r||s.selector,a),u=c.location.nativeElement,d=c.injector.get($te,null);return d?.registerApplication(u),c.onDestroy(()=>{this.detachView(c.hostView),O4(this.components,c),d?.unregisterApplication(u)}),this._loadComponent(c),c}tick(){this._tick(!0)}_tick(n){if(this._runningTick)throw new Xt(101,!1);const r=hr(null);try{this._runningTick=!0,this.detectChangesInAttachedViews(n)}catch(i){this.internalErrorHandler(i)}finally{this.afterTick.next(),this._runningTick=!1,hr(r)}}detectChangesInAttachedViews(n){let r=0;const i=this.afterRenderEffectManager;for(;;){if(r===cQ)throw new Xt(103,!1);if(n){const o=0===r;this.beforeRender.next(o);for(let{_lView:s,notifyErrorHandler:a}of this._views)tPe(s,o,a)}if(r++,i.executeInternalCallbacks(),![...this.externalTestViews.keys(),...this._views].some(({_lView:o})=>K8(o))&&(i.execute(),![...this.externalTestViews.keys(),...this._views].some(({_lView:o})=>K8(o))))break}}attachView(n){const r=n;this._views.push(r),r.attachToAppRef(this)}detachView(n){const r=n;O4(this._views,r),r.detachFromAppRef()}_loadComponent(n){this.attachView(n.hostView),this.tick(),this.components.push(n);const r=this._injector.get(F4,[]);[...this._bootstrapListeners,...r].forEach(i=>i(n))}ngOnDestroy(){if(!this._destroyed)try{this._destroyListeners.forEach(n=>n()),this._views.slice().forEach(n=>n.destroy())}finally{this._destroyed=!0,this._views=[],this._bootstrapListeners=[],this._destroyListeners=[]}}onDestroy(n){return this._destroyListeners.push(n),()=>O4(this._destroyListeners,n)}destroy(){if(this._destroyed)throw new Xt(406,!1);const n=this._injector;n.destroy&&!n.destroyed&&n.destroy()}get viewCount(){return this._views.length}warnIfDestroyed(){}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function O4(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}function tPe(e,t,n){!t&&!K8(e)||function nPe(e,t,n){let r;n?(r=0,e[Wn]|=1024):r=64&e[Wn]?0:1,e4(e,t,r)}(e,n,t)}function K8(e){return VS(e)}class rPe{constructor(t,n){this.ngModuleFactory=t,this.componentFactories=n}}let Qte=(()=>{class e{compileModuleSync(n){return new o8(n)}compileModuleAsync(n){return Promise.resolve(this.compileModuleSync(n))}compileModuleAndAllComponentsSync(n){const r=this.compileModuleSync(n),o=lf(Gl(n).declarations).reduce((s,a)=>{const l=Yr(a);return l&&s.push(new pT(l)),s},[]);return new rPe(r,o)}compileModuleAndAllComponentsAsync(n){return Promise.resolve(this.compileModuleAndAllComponentsSync(n))}clearCache(){}clearCacheFor(n){}getModuleId(n){}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})(),sPe=(()=>{class e{constructor(){this.zone=qt(To),this.applicationRef=qt(l1)}initialize(){this._onMicrotaskEmptySubscription||(this._onMicrotaskEmptySubscription=this.zone.onMicrotaskEmpty.subscribe({next:()=>{this.zone.run(()=>{this.applicationRef.tick()})}}))}ngOnDestroy(){this._onMicrotaskEmptySubscription?.unsubscribe()}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function ene(e){return[{provide:To,useFactory:e},{provide:ld,multi:!0,useFactory:()=>{const t=qt(sPe,{optional:!0});return()=>t.initialize()}},{provide:ld,multi:!0,useFactory:()=>{const t=qt(cPe);return()=>{t.initialize()}}},{provide:Hm,useFactory:aPe}]}function aPe(){const e=qt(To),t=qt(af);return n=>e.runOutsideAngular(()=>t.handleError(n))}function lPe(e){return Vc([[],ene(()=>new To(function tne(e){return{enableLongStackTrace:!1,shouldCoalesceEventChangeDetection:e?.eventCoalescing??!1,shouldCoalesceRunChangeDetection:e?.runCoalescing??!1}}(e)))])}let cPe=(()=>{class e{constructor(){this.subscription=new Il,this.initialized=!1,this.zone=qt(To),this.pendingTasks=qt(_C)}initialize(){if(this.initialized)return;this.initialized=!0;let n=null;!this.zone.isStable&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(n=this.pendingTasks.add()),this.zone.runOutsideAngular(()=>{this.subscription.add(this.zone.onStable.subscribe(()=>{To.assertNotInAngularZone(),queueMicrotask(()=>{null!==n&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(this.pendingTasks.remove(n),n=null)})}))}),this.subscription.add(this.zone.onUnstable.subscribe(()=>{To.assertInAngularZone(),n??=this.pendingTasks.add()}))}ngOnDestroy(){this.subscription.unsubscribe()}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();const N0=new jn("",{providedIn:"root",factory:()=>qt(N0,gi.Optional|gi.SkipSelf)||function uPe(){return typeof $localize<"u"&&$localize.locale||jC}()}),Z8=new jn("");let c1=null;let L4=(()=>{class e{static#e=this.__NG_ELEMENT_ID__=gPe}return e})();function gPe(e){return function yPe(e,t,n){if(Rm(e)&&!n){const r=Wc(e.index,t);return new oT(r,r)}return 47&e.type?new oT(t[Io],t):null}(ro(),_t(),!(16&~e))}class pne{constructor(){}supports(t){return t instanceof Map||s8(t)}create(){return new APe}}class APe{constructor(){this._records=new Map,this._mapHead=null,this._appendAfter=null,this._previousMapHead=null,this._changesHead=null,this._changesTail=null,this._additionsHead=null,this._additionsTail=null,this._removalsHead=null,this._removalsTail=null}get isDirty(){return null!==this._additionsHead||null!==this._changesHead||null!==this._removalsHead}forEachItem(t){let n;for(n=this._mapHead;null!==n;n=n._next)t(n)}forEachPreviousItem(t){let n;for(n=this._previousMapHead;null!==n;n=n._nextPrevious)t(n)}forEachChangedItem(t){let n;for(n=this._changesHead;null!==n;n=n._nextChanged)t(n)}forEachAddedItem(t){let n;for(n=this._additionsHead;null!==n;n=n._nextAdded)t(n)}forEachRemovedItem(t){let n;for(n=this._removalsHead;null!==n;n=n._nextRemoved)t(n)}diff(t){if(t){if(!(t instanceof Map||s8(t)))throw new Xt(900,!1)}else t=new Map;return this.check(t)?this:null}onDestroy(){}check(t){this._reset();let n=this._mapHead;if(this._appendAfter=null,this._forEach(t,(r,i)=>{if(n&&n.key===i)this._maybeAddToChanges(n,r),this._appendAfter=n,n=n._next;else{const o=this._getOrCreateRecordForKey(i,r);n=this._insertBeforeOrAppend(n,o)}}),n){n._prev&&(n._prev._next=null),this._removalsHead=n;for(let r=n;null!==r;r=r._nextRemoved)r===this._mapHead&&(this._mapHead=null),this._records.delete(r.key),r._nextRemoved=r._next,r.previousValue=r.currentValue,r.currentValue=null,r._prev=null,r._next=null}return this._changesTail&&(this._changesTail._nextChanged=null),this._additionsTail&&(this._additionsTail._nextAdded=null),this.isDirty}_insertBeforeOrAppend(t,n){if(t){const r=t._prev;return n._next=t,n._prev=r,t._prev=n,r&&(r._next=n),t===this._mapHead&&(this._mapHead=n),this._appendAfter=t,t}return this._appendAfter?(this._appendAfter._next=n,n._prev=this._appendAfter):this._mapHead=n,this._appendAfter=n,null}_getOrCreateRecordForKey(t,n){if(this._records.has(t)){const i=this._records.get(t);this._maybeAddToChanges(i,n);const o=i._prev,s=i._next;return o&&(o._next=s),s&&(s._prev=o),i._next=null,i._prev=null,i}const r=new IPe(t);return this._records.set(t,r),r.currentValue=n,this._addToAdditions(r),r}_reset(){if(this.isDirty){let t;for(this._previousMapHead=this._mapHead,t=this._previousMapHead;null!==t;t=t._next)t._nextPrevious=t._next;for(t=this._changesHead;null!==t;t=t._nextChanged)t.previousValue=t.currentValue;for(t=this._additionsHead;null!=t;t=t._nextAdded)t.previousValue=t.currentValue;this._changesHead=this._changesTail=null,this._additionsHead=this._additionsTail=null,this._removalsHead=null}}_maybeAddToChanges(t,n){Object.is(n,t.currentValue)||(t.previousValue=t.currentValue,t.currentValue=n,this._addToChanges(t))}_addToAdditions(t){null===this._additionsHead?this._additionsHead=this._additionsTail=t:(this._additionsTail._nextAdded=t,this._additionsTail=t)}_addToChanges(t){null===this._changesHead?this._changesHead=this._changesTail=t:(this._changesTail._nextChanged=t,this._changesTail=t)}_forEach(t,n){t instanceof Map?t.forEach(n):Object.keys(t).forEach(r=>n(t[r],r))}}class IPe{constructor(t){this.key=t,this.previousValue=null,this.currentValue=null,this._nextPrevious=null,this._next=null,this._prev=null,this._nextAdded=null,this._nextRemoved=null,this._nextChanged=null}}function mne(){return new z4([new pne])}let z4=(()=>{class e{static#e=this.\u0275prov=gn({token:e,providedIn:"root",factory:mne});constructor(n){this.factories=n}static create(n,r){if(r){const i=r.factories.slice();n=n.concat(i)}return new e(n)}static extend(n){return{provide:e,useFactory:r=>e.create(n,r||mne()),deps:[[e,new fS,new $v]]}}find(n){const r=this.factories.find(i=>i.supports(n));if(r)return r;throw new Xt(901,!1)}}return e})();function HPe(e){try{const{rootComponent:t,appProviders:n,platformProviders:r}=e,i=function mPe(e=[]){if(c1)return c1;const t=function ine(e=[],t){return Jl.create({name:t,providers:[{provide:No,useValue:"platform"},{provide:Z8,useValue:new Set([()=>c1=null])},...e]})}(e);return c1=t,function Xte(){!function VI(e){hb=e}(()=>{throw new Xt(600,!1)})}(),function one(e){e.get(QK,null)?.forEach(n=>n())}(t),t}(r),o=[lPe(),...n||[]],a=new hJ({providers:o,parent:i,debugName:"",runEnvironmentInitializers:!1}).injector,l=a.get(To);return l.run(()=>{a.resolveInjectorInitializers();const c=a.get(af,null);let u;l.runOutsideAngular(()=>{u=l.onError.subscribe({next:p=>{c.handleError(p)}})});const d=()=>a.destroy(),f=i.get(Z8);return f.add(d),a.onDestroy(()=>{u.unsubscribe(),f.delete(d)}),function Kte(e,t,n){try{const r=n();return N4(r)?r.catch(i=>{throw t.runOutsideAngular(()=>e.handleError(i)),i}):r}catch(r){throw t.runOutsideAngular(()=>e.handleError(r)),r}}(c,l,()=>{const p=a.get(X8);return p.runInitializers(),p.donePromise.then(()=>{!function gee(e){"string"==typeof e&&(mee=e.toLowerCase().replace(/_/g,"-"))}(a.get(N0,jC)||jC);const h=a.get(l1);return void 0!==t&&h.bootstrap(t),h})})})}catch(t){return Promise.reject(t)}}function sj(e){return"boolean"==typeof e?e:null!=e&&"false"!==e}function Bne(e){const t=hr(null);try{return e()}finally{hr(t)}}let Lne=null;function GC(){return Lne}class fke{}const ep=new jn("");let aj=(()=>{class e{historyGo(n){throw new Error("")}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:()=>qt(hke),providedIn:"platform"})}return e})();const pke=new jn("");let hke=(()=>{class e extends aj{constructor(){super(),this._doc=qt(ep),this._location=window.location,this._history=window.history}getBaseHrefFromDOM(){return GC().getBaseHref(this._doc)}onPopState(n){const r=GC().getGlobalEventTarget(this._doc,"window");return r.addEventListener("popstate",n,!1),()=>r.removeEventListener("popstate",n)}onHashChange(n){const r=GC().getGlobalEventTarget(this._doc,"window");return r.addEventListener("hashchange",n,!1),()=>r.removeEventListener("hashchange",n)}get href(){return this._location.href}get protocol(){return this._location.protocol}get hostname(){return this._location.hostname}get port(){return this._location.port}get pathname(){return this._location.pathname}get search(){return this._location.search}get hash(){return this._location.hash}set pathname(n){this._location.pathname=n}pushState(n,r,i){this._history.pushState(n,r,i)}replaceState(n,r,i){this._history.replaceState(n,r,i)}forward(){this._history.forward()}back(){this._history.back()}historyGo(n=0){this._history.go(n)}getState(){return this._history.state}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:()=>new e,providedIn:"platform"})}return e})();function lj(e,t){if(0==e.length)return t;if(0==t.length)return e;let n=0;return e.endsWith("/")&&n++,t.startsWith("/")&&n++,2==n?e+t.substring(1):1==n?e+t:e+"/"+t}function jne(e){const t=e.match(/#|\?|$/),n=t&&t.index||e.length;return e.slice(0,n-("/"===e[n-1]?1:0))+e.slice(n)}function F0(e){return e&&"?"!==e[0]?"?"+e:e}let jx=(()=>{class e{historyGo(n){throw new Error("")}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:()=>qt(zne),providedIn:"root"})}return e})();const Une=new jn("");let zne=(()=>{class e extends jx{constructor(n,r){super(),this._platformLocation=n,this._removeListenerFns=[],this._baseHref=r??this._platformLocation.getBaseHrefFromDOM()??qt(ep).location?.origin??""}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(n){this._removeListenerFns.push(this._platformLocation.onPopState(n),this._platformLocation.onHashChange(n))}getBaseHref(){return this._baseHref}prepareExternalUrl(n){return lj(this._baseHref,n)}path(n=!1){const r=this._platformLocation.pathname+F0(this._platformLocation.search),i=this._platformLocation.hash;return i&&n?`${r}${i}`:r}pushState(n,r,i,o){const s=this.prepareExternalUrl(i+F0(o));this._platformLocation.pushState(n,r,s)}replaceState(n,r,i,o){const s=this.prepareExternalUrl(i+F0(o));this._platformLocation.replaceState(n,r,s)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}getState(){return this._platformLocation.getState()}historyGo(n=0){this._platformLocation.historyGo?.(n)}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(aj),Rn(Une,8))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})(),mke=(()=>{class e extends jx{constructor(n,r){super(),this._platformLocation=n,this._baseHref="",this._removeListenerFns=[],null!=r&&(this._baseHref=r)}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(n){this._removeListenerFns.push(this._platformLocation.onPopState(n),this._platformLocation.onHashChange(n))}getBaseHref(){return this._baseHref}path(n=!1){const r=this._platformLocation.hash??"#";return r.length>0?r.substring(1):r}prepareExternalUrl(n){const r=lj(this._baseHref,n);return r.length>0?"#"+r:r}pushState(n,r,i,o){let s=this.prepareExternalUrl(i+F0(o));0==s.length&&(s=this._platformLocation.pathname),this._platformLocation.pushState(n,r,s)}replaceState(n,r,i,o){let s=this.prepareExternalUrl(i+F0(o));0==s.length&&(s=this._platformLocation.pathname),this._platformLocation.replaceState(n,r,s)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}getState(){return this._platformLocation.getState()}historyGo(n=0){this._platformLocation.historyGo?.(n)}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(aj),Rn(Une,8))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac})}return e})(),qC=(()=>{class e{constructor(n){this._subject=new rl,this._urlChangeListeners=[],this._urlChangeSubscription=null,this._locationStrategy=n;const r=this._locationStrategy.getBaseHref();this._basePath=function bke(e){if(new RegExp("^(https?:)?//").test(e)){const[,n]=e.split(/\/\/[^\/]+/);return n}return e}(jne(Vne(r))),this._locationStrategy.onPopState(i=>{this._subject.emit({url:this.path(!0),pop:!0,state:i.state,type:i.type})})}ngOnDestroy(){this._urlChangeSubscription?.unsubscribe(),this._urlChangeListeners=[]}path(n=!1){return this.normalize(this._locationStrategy.path(n))}getState(){return this._locationStrategy.getState()}isCurrentPathEqualTo(n,r=""){return this.path()==this.normalize(n+F0(r))}normalize(n){return e.stripTrailingSlash(function yke(e,t){if(!e||!t.startsWith(e))return t;const n=t.substring(e.length);return""===n||["/",";","?","#"].includes(n[0])?n:t}(this._basePath,Vne(n)))}prepareExternalUrl(n){return n&&"/"!==n[0]&&(n="/"+n),this._locationStrategy.prepareExternalUrl(n)}go(n,r="",i=null){this._locationStrategy.pushState(i,"",n,r),this._notifyUrlChangeListeners(this.prepareExternalUrl(n+F0(r)),i)}replaceState(n,r="",i=null){this._locationStrategy.replaceState(i,"",n,r),this._notifyUrlChangeListeners(this.prepareExternalUrl(n+F0(r)),i)}forward(){this._locationStrategy.forward()}back(){this._locationStrategy.back()}historyGo(n=0){this._locationStrategy.historyGo?.(n)}onUrlChange(n){return this._urlChangeListeners.push(n),this._urlChangeSubscription??=this.subscribe(r=>{this._notifyUrlChangeListeners(r.url,r.state)}),()=>{const r=this._urlChangeListeners.indexOf(n);this._urlChangeListeners.splice(r,1),0===this._urlChangeListeners.length&&(this._urlChangeSubscription?.unsubscribe(),this._urlChangeSubscription=null)}}_notifyUrlChangeListeners(n="",r){this._urlChangeListeners.forEach(i=>i(n,r))}subscribe(n,r,i){return this._subject.subscribe({next:n,error:r,complete:i})}static#e=this.normalizeQueryParams=F0;static#t=this.joinWithSlash=lj;static#n=this.stripTrailingSlash=jne;static#r=this.\u0275fac=function(r){return new(r||e)(Rn(jx))};static#i=this.\u0275prov=gn({token:e,factory:()=>function gke(){return new qC(Rn(jx))}(),providedIn:"root"})}return e})();function Vne(e){return e.replace(/\/index.html$/,"")}let nre=(()=>{class e{constructor(n){this._viewContainerRef=n,this._viewRef=null,this.ngTemplateOutletContext=null,this.ngTemplateOutlet=null,this.ngTemplateOutletInjector=null}ngOnChanges(n){if(this._shouldRecreateView(n)){const r=this._viewContainerRef;if(this._viewRef&&r.remove(r.indexOf(this._viewRef)),!this.ngTemplateOutlet)return void(this._viewRef=null);const i=this._createContextForwardProxy();this._viewRef=r.createEmbeddedView(this.ngTemplateOutlet,i,{injector:this.ngTemplateOutletInjector??void 0})}}_shouldRecreateView(n){return!!n.ngTemplateOutlet||!!n.ngTemplateOutletInjector}_createContextForwardProxy(){return new Proxy({},{set:(n,r,i)=>!!this.ngTemplateOutletContext&&Reflect.set(this.ngTemplateOutletContext,r,i),get:(n,r,i)=>{if(this.ngTemplateOutletContext)return Reflect.get(this.ngTemplateOutletContext,r,i)}})}static#e=this.\u0275fac=function(r){return new(r||e)(On(Ih))};static#t=this.\u0275dir=Ja({type:e,selectors:[["","ngTemplateOutlet",""]],inputs:{ngTemplateOutletContext:"ngTemplateOutletContext",ngTemplateOutlet:"ngTemplateOutlet",ngTemplateOutletInjector:"ngTemplateOutletInjector"},standalone:!0,features:[Oo]})}return e})();class hMe{createSubscription(t,n){return Bne(()=>t.subscribe({next:n,error:r=>{throw r}}))}dispose(t){Bne(()=>t.unsubscribe())}}class mMe{createSubscription(t,n){return t.then(n,r=>{throw r})}dispose(t){}}const gMe=new mMe,yMe=new hMe;let iR=(()=>{class e{constructor(n){this._latestValue=null,this.markForCheckOnValueUpdate=!0,this._subscription=null,this._obj=null,this._strategy=null,this._ref=n}ngOnDestroy(){this._subscription&&this._dispose(),this._ref=null}transform(n){if(!this._obj){if(n)try{this.markForCheckOnValueUpdate=!1,this._subscribe(n)}finally{this.markForCheckOnValueUpdate=!0}return this._latestValue}return n!==this._obj?(this._dispose(),this.transform(n)):this._latestValue}_subscribe(n){this._obj=n,this._strategy=this._selectStrategy(n),this._subscription=this._strategy.createSubscription(n,r=>this._updateLatestValue(n,r))}_selectStrategy(n){if(N4(n))return gMe;if(Yte(n))return yMe;throw function kh(e,t){return new Xt(2100,!1)}()}_dispose(){this._strategy.dispose(this._subscription),this._latestValue=null,this._subscription=null,this._obj=null}_updateLatestValue(n,r){n===this._obj&&(this._latestValue=r,this.markForCheckOnValueUpdate&&this._ref?.markForCheck())}static#e=this.\u0275fac=function(r){return new(r||e)(On(L4,16))};static#t=this.\u0275pipe=Hl({name:"async",type:e,pure:!1,standalone:!0})}return e})(),_j=(()=>{class e{transform(n){return JSON.stringify(n,null,2)}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275pipe=Hl({name:"json",type:e,pure:!1,standalone:!0})}return e})(),rre=(()=>{class e{constructor(n){this.differs=n,this.keyValues=[],this.compareFn=ire}transform(n,r=ire){if(!n||!(n instanceof Map)&&"object"!=typeof n)return null;this.differ??=this.differs.find(n).create();const i=this.differ.diff(n),o=r!==this.compareFn;return i&&(this.keyValues=[],i.forEachItem(s=>{this.keyValues.push(function DMe(e,t){return{key:e,value:t}}(s.key,s.currentValue))})),(i||o)&&(this.keyValues.sort(r),this.compareFn=r),this.keyValues}static#e=this.\u0275fac=function(r){return new(r||e)(On(z4,16))};static#t=this.\u0275pipe=Hl({name:"keyvalue",type:e,pure:!1,standalone:!0})}return e})();function ire(e,t){const n=e.key,r=t.key;if(n===r)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(null===n)return 1;if(null===r)return-1;if("string"==typeof n&&"string"==typeof r)return n{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275mod=g0({type:e});static#n=this.\u0275inj=c0({})}return e})();function sre(e){return"server"===e}let BMe=(()=>{class e{static#e=this.\u0275prov=gn({token:e,providedIn:"root",factory:()=>function OMe(e){return"browser"===e}(qt(Ex))?new LMe(qt(ep),window):new UMe})}return e})();class LMe{constructor(t,n){this.document=t,this.window=n,this.offset=()=>[0,0]}setOffset(t){this.offset=Array.isArray(t)?()=>t:t}getScrollPosition(){return[this.window.scrollX,this.window.scrollY]}scrollToPosition(t){this.window.scrollTo(t[0],t[1])}scrollToAnchor(t){const n=function jMe(e,t){const n=e.getElementById(t)||e.getElementsByName(t)[0];if(n)return n;if("function"==typeof e.createTreeWalker&&e.body&&"function"==typeof e.body.attachShadow){const r=e.createTreeWalker(e.body,NodeFilter.SHOW_ELEMENT);let i=r.currentNode;for(;i;){const o=i.shadowRoot;if(o){const s=o.getElementById(t)||o.querySelector(`[name="${t}"]`);if(s)return s}i=r.nextNode()}}return null}(this.document,t);n&&(this.scrollToElement(n),n.focus())}setHistoryScrollRestoration(t){this.window.history.scrollRestoration=t}scrollToElement(t){const n=t.getBoundingClientRect(),r=n.left+this.window.pageXOffset,i=n.top+this.window.pageYOffset,o=this.offset();this.window.scrollTo(r-o[0],i-o[1])}}class UMe{setOffset(t){}getScrollPosition(){return[0,0]}scrollToPosition(t){}scrollToAnchor(t){}setHistoryScrollRestoration(t){}}class m4e extends fke{constructor(){super(...arguments),this.supportsDOMEvents=!0}}class Aj extends m4e{static makeCurrent(){!function dke(e){Lne??=e}(new Aj)}onAndCancel(t,n,r){return t.addEventListener(n,r),()=>{t.removeEventListener(n,r)}}dispatchEvent(t,n){t.dispatchEvent(n)}remove(t){t.parentNode&&t.parentNode.removeChild(t)}createElement(t,n){return(n=n||this.getDefaultDocument()).createElement(t)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(t){return t.nodeType===Node.ELEMENT_NODE}isShadowRoot(t){return t instanceof DocumentFragment}getGlobalEventTarget(t,n){return"window"===n?window:"document"===n?t:"body"===n?t.body:null}getBaseHref(t){const n=function g4e(){return GT=GT||document.querySelector("base"),GT?GT.getAttribute("href"):null}();return null==n?null:function y4e(e){return new URL(e,document.baseURI).pathname}(n)}resetBaseElement(){GT=null}getUserAgent(){return window.navigator.userAgent}getCookie(t){return function nMe(e,t){t=encodeURIComponent(t);for(const n of e.split(";")){const r=n.indexOf("="),[i,o]=-1==r?[n,""]:[n.slice(0,r),n.slice(r+1)];if(i.trim()===t)return decodeURIComponent(o)}return null}(document.cookie,t)}}let GT=null,v4e=(()=>{class e{build(){return new XMLHttpRequest}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac})}return e})();const Ij=new jn("");let mre=(()=>{class e{constructor(n,r){this._zone=r,this._eventNameToPlugin=new Map,n.forEach(i=>{i.manager=this}),this._plugins=n.slice().reverse()}addEventListener(n,r,i){return this._findPluginFor(r).addEventListener(n,r,i)}getZone(){return this._zone}_findPluginFor(n){let r=this._eventNameToPlugin.get(n);if(r)return r;if(r=this._plugins.find(o=>o.supports(n)),!r)throw new Xt(5101,!1);return this._eventNameToPlugin.set(n,r),r}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(Ij),Rn(To))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac})}return e})();class gre{constructor(t){this._doc=t}}const Ej="ng-app-id";let yre=(()=>{class e{constructor(n,r,i,o={}){this.doc=n,this.appId=r,this.nonce=i,this.platformId=o,this.styleRef=new Map,this.hostNodes=new Set,this.styleNodesInDOM=this.collectServerRenderedStyles(),this.platformIsServer=sre(o),this.resetHostNodes()}addStyles(n){for(const r of n)1===this.changeUsageCount(r,1)&&this.onStyleAdded(r)}removeStyles(n){for(const r of n)this.changeUsageCount(r,-1)<=0&&this.onStyleRemoved(r)}ngOnDestroy(){const n=this.styleNodesInDOM;n&&(n.forEach(r=>r.remove()),n.clear());for(const r of this.getAllStyles())this.onStyleRemoved(r);this.resetHostNodes()}addHost(n){this.hostNodes.add(n);for(const r of this.getAllStyles())this.addStyleToHost(n,r)}removeHost(n){this.hostNodes.delete(n)}getAllStyles(){return this.styleRef.keys()}onStyleAdded(n){for(const r of this.hostNodes)this.addStyleToHost(r,n)}onStyleRemoved(n){const r=this.styleRef;r.get(n)?.elements?.forEach(i=>i.remove()),r.delete(n)}collectServerRenderedStyles(){const n=this.doc.head?.querySelectorAll(`style[${Ej}="${this.appId}"]`);if(n?.length){const r=new Map;return n.forEach(i=>{null!=i.textContent&&r.set(i.textContent,i)}),r}return null}changeUsageCount(n,r){const i=this.styleRef;if(i.has(n)){const o=i.get(n);return o.usage+=r,o.usage}return i.set(n,{usage:r,elements:[]}),r}getStyleElement(n,r){const i=this.styleNodesInDOM,o=i?.get(r);if(o?.parentNode===n)return i.delete(r),o.removeAttribute(Ej),o;{const s=this.doc.createElement("style");return this.nonce&&s.setAttribute("nonce",this.nonce),s.textContent=r,this.platformIsServer&&s.setAttribute(Ej,this.appId),n.appendChild(s),s}}addStyleToHost(n,r){const i=this.getStyleElement(n,r),o=this.styleRef,s=o.get(r)?.elements;s?s.push(i):o.set(r,{elements:[i],usage:1})}resetHostNodes(){const n=this.hostNodes;n.clear(),n.add(this.doc.head)}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(ep),Rn($L),Rn(JK,8),Rn(Ex))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac})}return e})();const Tj={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",math:"http://www.w3.org/1998/MathML/"},Dj=/%COMP%/g,C4e=new jn("",{providedIn:"root",factory:()=>!0});function vre(e,t){return t.map(n=>n.replace(Dj,e))}let xre=(()=>{class e{constructor(n,r,i,o,s,a,l,c=null){this.eventManager=n,this.sharedStylesHost=r,this.appId=i,this.removeStylesOnCompDestroy=o,this.doc=s,this.platformId=a,this.ngZone=l,this.nonce=c,this.rendererByCompId=new Map,this.platformIsServer=sre(a),this.defaultRenderer=new Pj(n,s,l,this.platformIsServer)}createRenderer(n,r){if(!n||!r)return this.defaultRenderer;this.platformIsServer&&r.encapsulation===cd.ShadowDom&&(r={...r,encapsulation:cd.Emulated});const i=this.getOrCreateRenderer(n,r);return i instanceof Sre?i.applyToHost(n):i instanceof kj&&i.applyStyles(),i}getOrCreateRenderer(n,r){const i=this.rendererByCompId;let o=i.get(r.id);if(!o){const s=this.doc,a=this.ngZone,l=this.eventManager,c=this.sharedStylesHost,u=this.removeStylesOnCompDestroy,d=this.platformIsServer;switch(r.encapsulation){case cd.Emulated:o=new Sre(l,c,r,this.appId,u,s,a,d);break;case cd.ShadowDom:return new E4e(l,c,n,r,s,a,this.nonce,d);default:o=new kj(l,c,r,u,s,a,d)}i.set(r.id,o)}return o}ngOnDestroy(){this.rendererByCompId.clear()}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(mre),Rn(yre),Rn($L),Rn(C4e),Rn(ep),Rn(Ex),Rn(To),Rn(JK))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac})}return e})();class Pj{constructor(t,n,r,i){this.eventManager=t,this.doc=n,this.ngZone=r,this.platformIsServer=i,this.data=Object.create(null),this.throwOnSyntheticProps=!0,this.destroyNode=null}destroy(){}createElement(t,n){return n?this.doc.createElementNS(Tj[n]||n,t):this.doc.createElement(t)}createComment(t){return this.doc.createComment(t)}createText(t){return this.doc.createTextNode(t)}appendChild(t,n){(_re(t)?t.content:t).appendChild(n)}insertBefore(t,n,r){t&&(_re(t)?t.content:t).insertBefore(n,r)}removeChild(t,n){t&&t.removeChild(n)}selectRootElement(t,n){let r="string"==typeof t?this.doc.querySelector(t):t;if(!r)throw new Xt(-5104,!1);return n||(r.textContent=""),r}parentNode(t){return t.parentNode}nextSibling(t){return t.nextSibling}setAttribute(t,n,r,i){if(i){n=i+":"+n;const o=Tj[i];o?t.setAttributeNS(o,n,r):t.setAttribute(n,r)}else t.setAttribute(n,r)}removeAttribute(t,n,r){if(r){const i=Tj[r];i?t.removeAttributeNS(i,n):t.removeAttribute(`${r}:${n}`)}else t.removeAttribute(n)}addClass(t,n){t.classList.add(n)}removeClass(t,n){t.classList.remove(n)}setStyle(t,n,r,i){i&(r1.DashCase|r1.Important)?t.style.setProperty(n,r,i&r1.Important?"important":""):t.style[n]=r}removeStyle(t,n,r){r&r1.DashCase?t.style.removeProperty(n):t.style[n]=""}setProperty(t,n,r){null!=t&&(t[n]=r)}setValue(t,n){t.nodeValue=n}listen(t,n,r){if("string"==typeof t&&!(t=GC().getGlobalEventTarget(this.doc,t)))throw new Error(`Unsupported event target ${t} for event ${n}`);return this.eventManager.addEventListener(t,n,this.decoratePreventDefault(r))}decoratePreventDefault(t){return n=>{if("__ngUnwrap__"===n)return t;!1===(this.platformIsServer?this.ngZone.runGuarded(()=>t(n)):t(n))&&n.preventDefault()}}}function _re(e){return"TEMPLATE"===e.tagName&&void 0!==e.content}class E4e extends Pj{constructor(t,n,r,i,o,s,a,l){super(t,o,s,l),this.sharedStylesHost=n,this.hostEl=r,this.shadowRoot=r.attachShadow({mode:"open"}),this.sharedStylesHost.addHost(this.shadowRoot);const c=vre(i.id,i.styles);for(const u of c){const d=document.createElement("style");a&&d.setAttribute("nonce",a),d.textContent=u,this.shadowRoot.appendChild(d)}}nodeOrShadowRoot(t){return t===this.hostEl?this.shadowRoot:t}appendChild(t,n){return super.appendChild(this.nodeOrShadowRoot(t),n)}insertBefore(t,n,r){return super.insertBefore(this.nodeOrShadowRoot(t),n,r)}removeChild(t,n){return super.removeChild(this.nodeOrShadowRoot(t),n)}parentNode(t){return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(t)))}destroy(){this.sharedStylesHost.removeHost(this.shadowRoot)}}class kj extends Pj{constructor(t,n,r,i,o,s,a,l){super(t,o,s,a),this.sharedStylesHost=n,this.removeStylesOnCompDestroy=i,this.styles=l?vre(l,r.styles):r.styles}applyStyles(){this.sharedStylesHost.addStyles(this.styles)}destroy(){this.removeStylesOnCompDestroy&&this.sharedStylesHost.removeStyles(this.styles)}}class Sre extends kj{constructor(t,n,r,i,o,s,a,l){const c=i+"-"+r.id;super(t,n,r,o,s,a,l,c),this.contentAttr=function w4e(e){return"_ngcontent-%COMP%".replace(Dj,e)}(c),this.hostAttr=function A4e(e){return"_nghost-%COMP%".replace(Dj,e)}(c)}applyToHost(t){this.applyStyles(),this.setAttribute(t,this.hostAttr,"")}createElement(t,n){const r=super.createElement(t,n);return super.setAttribute(r,this.contentAttr,""),r}}let T4e=(()=>{class e extends gre{constructor(n){super(n)}supports(n){return!0}addEventListener(n,r,i){return n.addEventListener(r,i,!1),()=>this.removeEventListener(n,r,i)}removeEventListener(n,r,i){return n.removeEventListener(r,i)}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(ep))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac})}return e})();const Cre=["alt","control","meta","shift"],D4e={"\b":"Backspace","\t":"Tab","\x7f":"Delete","\x1b":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},P4e={alt:e=>e.altKey,control:e=>e.ctrlKey,meta:e=>e.metaKey,shift:e=>e.shiftKey};let k4e=(()=>{class e extends gre{constructor(n){super(n)}supports(n){return null!=e.parseEventName(n)}addEventListener(n,r,i){const o=e.parseEventName(r),s=e.eventCallback(o.fullKey,i,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>GC().onAndCancel(n,o.domEventName,s))}static parseEventName(n){const r=n.toLowerCase().split("."),i=r.shift();if(0===r.length||"keydown"!==i&&"keyup"!==i)return null;const o=e._normalizeKey(r.pop());let s="",a=r.indexOf("code");if(a>-1&&(r.splice(a,1),s="code."),Cre.forEach(c=>{const u=r.indexOf(c);u>-1&&(r.splice(u,1),s+=c+".")}),s+=o,0!=r.length||0===o.length)return null;const l={};return l.domEventName=i,l.fullKey=s,l}static matchEventFullKeyCode(n,r){let i=D4e[n.key]||n.key,o="";return r.indexOf("code.")>-1&&(i=n.code,o="code."),!(null==i||!i)&&(i=i.toLowerCase()," "===i?i="space":"."===i&&(i="dot"),Cre.forEach(s=>{s!==i&&(0,P4e[s])(n)&&(o+=s+".")}),o+=i,o===r)}static eventCallback(n,r,i){return o=>{e.matchEventFullKeyCode(o,n)&&i.runGuarded(()=>r(o))}}static _normalizeKey(n){return"esc"===n?"escape":n}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(ep))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac})}return e})();function wre(e){return{appProviders:[...L4e,...e?.providers??[]],platformProviders:O4e}}const O4e=[{provide:Ex,useValue:"browser"},{provide:QK,useValue:function R4e(){Aj.makeCurrent()},multi:!0},{provide:ep,useFactory:function F4e(){return function WL(e){Qf=e}(document),document},deps:[]}],L4e=[{provide:No,useValue:"root"},{provide:af,useFactory:function N4e(){return new af},deps:[]},{provide:Ij,useClass:T4e,multi:!0,deps:[ep,To,Ex]},{provide:Ij,useClass:k4e,multi:!0,deps:[ep]},xre,yre,mre,{provide:_Q,useExisting:xre},{provide:class zMe{},useClass:v4e,deps:[]},[]];let j4e=(()=>{class e{constructor(n){this._doc=n}getTitle(){return this._doc.title}setTitle(n){this._doc.title=n||""}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(ep))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function u1(e){return this instanceof u1?(this.v=e,this):new u1(e)}function kre(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,t=e[Symbol.asyncIterator];return t?t.call(e):(e=function Fj(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(a,l){!function i(o,s,a,l){Promise.resolve(l).then(function(c){o({value:c,done:a})},s)}(a,l,(s=e[o](s)).done,s.value)})}}}"function"==typeof SuppressedError&&SuppressedError;const Mre=e=>e&&"number"==typeof e.length&&"function"!=typeof e;function Rre(e){return Yo(e?.then)}function Nre(e){return Yo(e[K2])}function Fre(e){return Symbol.asyncIterator&&Yo(e?.[Symbol.asyncIterator])}function Ore(e){return new TypeError(`You provided ${null!==e&&"object"==typeof e?"an invalid object":`'${e}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}const Bre=function dRe(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}();function Lre(e){return Yo(e?.[Bre])}function jre(e){return function Pre(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(f){r[f]&&(i[f]=function(p){return new Promise(function(m,h){o.push([f,p,m,h])>1||a(f,p)})})}function a(f,p){try{!function l(f){f.value instanceof u1?Promise.resolve(f.value.v).then(c,u):d(o[0][2],f)}(r[f](p))}catch(m){d(o[0][3],m)}}function c(f){a("next",f)}function u(f){a("throw",f)}function d(f,p){f(p),o.shift(),o.length&&a(o[0][0],o[0][1])}}(this,arguments,function*(){const n=e.getReader();try{for(;;){const{value:r,done:i}=yield u1(n.read());if(i)return yield u1(void 0);yield yield u1(r)}}finally{n.releaseLock()}})}function Ure(e){return Yo(e?.getReader)}function vd(e){if(e instanceof Ra)return e;if(null!=e){if(Nre(e))return function fRe(e){return new Ra(t=>{const n=e[K2]();if(Yo(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}(e);if(Mre(e))return function pRe(e){return new Ra(t=>{for(let n=0;n{e.then(n=>{t.closed||(t.next(n),t.complete())},n=>t.error(n)).then(null,qI)})}(e);if(Fre(e))return zre(e);if(Lre(e))return function mRe(e){return new Ra(t=>{for(const n of e)if(t.next(n),t.closed)return;t.complete()})}(e);if(Ure(e))return function gRe(e){return zre(jre(e))}(e)}throw Ore(e)}function zre(e){return new Ra(t=>{(function yRe(e,t){var n,r,i,o;return function Tre(e,t,n,r){return new(n||(n=Promise))(function(o,s){function a(u){try{c(r.next(u))}catch(d){s(d)}}function l(u){try{c(r.throw(u))}catch(d){s(d)}}function c(u){u.done?o(u.value):function i(o){return o instanceof n?o:new n(function(s){s(o)})}(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})}(this,void 0,void 0,function*(){try{for(n=kre(e);!(r=yield n.next()).done;)if(t.next(r.value),t.closed)return}catch(s){i={error:s}}finally{try{r&&!r.done&&(o=n.return)&&(yield o.call(n))}finally{if(i)throw i.error}}t.complete()})})(e,t).catch(n=>t.error(n))})}function j0(e,t,n,r=0,i=!1){const o=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(o),!i)return o}function Vre(e,t=0){return is((n,r)=>{n.subscribe(Xo(r,i=>j0(r,e,()=>r.next(i),t),()=>j0(r,e,()=>r.complete(),t),i=>j0(r,e,()=>r.error(i),t)))})}function Hre(e,t=0){return is((n,r)=>{r.add(e.schedule(()=>n.subscribe(r),t))})}function Gre(e,t){if(!e)throw new Error("Iterable cannot be null");return new Ra(n=>{j0(n,t,()=>{const r=e[Symbol.asyncIterator]();j0(n,t,()=>{r.next().then(i=>{i.done?n.complete():n.next(i.value)})},0,!0)})})}function Is(e,t){return t?function CRe(e,t){if(null!=e){if(Nre(e))return function bRe(e,t){return vd(e).pipe(Hre(t),Vre(t))}(e,t);if(Mre(e))return function xRe(e,t){return new Ra(n=>{let r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}(e,t);if(Rre(e))return function vRe(e,t){return vd(e).pipe(Hre(t),Vre(t))}(e,t);if(Fre(e))return Gre(e,t);if(Lre(e))return function _Re(e,t){return new Ra(n=>{let r;return j0(n,t,()=>{r=e[Bre](),j0(n,t,()=>{let i,o;try{({value:i,done:o}=r.next())}catch(s){return void n.error(s)}o?n.complete():n.next(i)},0,!0)}),()=>Yo(r?.return)&&r.return()})}(e,t);if(Ure(e))return function SRe(e,t){return Gre(jre(e),t)}(e,t)}throw Ore(e)}(e,t):vd(e)}function qre(e){return e&&Yo(e.schedule)}function Oj(e){return e[e.length-1]}function Bj(e){return Yo(Oj(e))?e.pop():void 0}function $C(e){return qre(Oj(e))?e.pop():void 0}function Wre(e,t){return"number"==typeof Oj(e)?e.pop():t}function Mr(...e){return Is(e,$C(e))}const{isArray:wRe}=Array,{getPrototypeOf:ARe,prototype:IRe,keys:ERe}=Object;const{isArray:PRe}=Array;function $re(e){return hn(t=>function kRe(e,t){return PRe(t)?e(...t):e(t)}(e,t))}function Lj(...e){const t=$C(e),n=Bj(e),{args:r,keys:i}=function TRe(e){if(1===e.length){const t=e[0];if(wRe(t))return{args:t,keys:null};if(function DRe(e){return e&&"object"==typeof e&&ARe(e)===IRe}(t)){const n=ERe(t);return{args:n.map(r=>t[r]),keys:n}}}return{args:e,keys:null}}(e);if(0===r.length)return Is([],t);const o=new Ra(Yre(r,t,i?s=>function MRe(e,t){return e.reduce((n,r,i)=>(n[r]=t[i],n),{})}(i,s):ah));return n?o.pipe($re(n)):o}function Yre(e,t,n=ah){return r=>{Xre(t,()=>{const{length:i}=e,o=new Array(i);let s=i,a=i;for(let l=0;l{const c=Is(e[l],t);let u=!1;c.subscribe(Xo(r,d=>{o[l]=d,u||(u=!0,a--),a||r.next(n(o.slice()))},()=>{--s||r.complete()}))},r)},r)}}function Xre(e,t,n){e?j0(n,e,t):t()}const aR=Tv(e=>function(){e(this),this.name="EmptyError",this.message="no elements in sequence"});function Xc(e,t,n=1/0){return Yo(t)?Xc((r,i)=>hn((o,s)=>t(r,o,i,s))(vd(e(r,i))),n):("number"==typeof t&&(n=t),is((r,i)=>function RRe(e,t,n,r,i,o,s,a){const l=[];let c=0,u=0,d=!1;const f=()=>{d&&!l.length&&!c&&t.complete()},p=h=>c{o&&t.next(h),c++;let g=!1;vd(n(h,u++)).subscribe(Xo(t,y=>{i?.(y),o?p(y):t.next(y)},()=>{g=!0},void 0,()=>{if(g)try{for(c--;l.length&&cm(y)):m(y)}f()}catch(y){t.error(y)}}))};return e.subscribe(Xo(t,p,()=>{d=!0,f()})),()=>{a?.()}}(r,i,e,n)))}function Ux(e=1/0){return Xc(ah,e)}function jj(...e){return function NRe(){return Ux(1)}()(Is(e,$C(e)))}function Kre(e){return new Ra(t=>{vd(e()).subscribe(t)})}function lR(e,t){const n=Yo(e)?e:()=>e,r=i=>i.error(n());return new Ra(t?i=>t.schedule(r,0,i):r)}const Mh=new Ra(e=>e.complete());function Uj(){return is((e,t)=>{let n=null;e._refCount++;const r=Xo(t,void 0,void 0,void 0,()=>{if(!e||e._refCount<=0||0<--e._refCount)return void(n=null);const i=e._connection,o=n;n=null,i&&(!o||i===o)&&i.unsubscribe(),t.unsubscribe()});e.subscribe(r),r.closed||(n=e.connect())})}class Zre extends Ra{constructor(t,n){super(),this.source=t,this.subjectFactory=n,this._subject=null,this._refCount=0,this._connection=null,Rv(t)&&(this.lift=t.lift)}_subscribe(t){return this.getSubject().subscribe(t)}getSubject(){const t=this._subject;return(!t||t.isStopped)&&(this._subject=this.subjectFactory()),this._subject}_teardown(){this._refCount=0;const{_connection:t}=this;this._subject=this._connection=null,t?.unsubscribe()}connect(){let t=this._connection;if(!t){t=this._connection=new Il;const n=this.getSubject();t.add(this.source.subscribe(Xo(n,void 0,()=>{this._teardown(),n.complete()},r=>{this._teardown(),n.error(r)},()=>this._teardown()))),t.closed&&(this._connection=null,t=Il.EMPTY)}return t}refCount(){return Uj()(this)}}function ba(e,t){return is((n,r)=>{let i=null,o=0,s=!1;const a=()=>s&&!i&&r.complete();n.subscribe(Xo(r,l=>{i?.unsubscribe();let c=0;const u=o++;vd(e(l,u)).subscribe(i=Xo(r,d=>r.next(t?t(l,d,u,c++):d),()=>{i=null,a()}))},()=>{s=!0,a()}))})}function zx(e){return e<=0?()=>Mh:is((t,n)=>{let r=0;t.subscribe(Xo(n,i=>{++r<=e&&(n.next(i),e<=r&&n.complete())}))})}function WT(...e){const t=$C(e);return is((n,r)=>{(t?jj(e,n,t):jj(e,n)).subscribe(r)})}function xd(e,t){return is((n,r)=>{let i=0;n.subscribe(Xo(r,o=>e.call(t,o,i++)&&r.next(o)))})}function cR(e){return is((t,n)=>{let r=!1;t.subscribe(Xo(n,i=>{r=!0,n.next(i)},()=>{r||n.next(e),n.complete()}))})}function Qre(e=ORe){return is((t,n)=>{let r=!1;t.subscribe(Xo(n,i=>{r=!0,n.next(i)},()=>r?n.complete():n.error(e())))})}function ORe(){return new aR}function Vx(e,t){const n=arguments.length>=2;return r=>r.pipe(e?xd((i,o)=>e(i,o,r)):ah,zx(1),n?cR(t):Qre(()=>new aR))}function $T(e,t){return Yo(t)?Xc(e,t,1):Xc(e,1)}function Ho(e,t,n){const r=Yo(e)||t||n?{next:e,error:t,complete:n}:e;return r?is((i,o)=>{var s;null===(s=r.subscribe)||void 0===s||s.call(r);let a=!0;i.subscribe(Xo(o,l=>{var c;null===(c=r.next)||void 0===c||c.call(r,l),o.next(l)},()=>{var l;a=!1,null===(l=r.complete)||void 0===l||l.call(r),o.complete()},l=>{var c;a=!1,null===(c=r.error)||void 0===c||c.call(r,l),o.error(l)},()=>{var l,c;a&&(null===(l=r.unsubscribe)||void 0===l||l.call(r)),null===(c=r.finalize)||void 0===c||c.call(r)}))}):ah}function YC(e){return is((t,n)=>{let o,r=null,i=!1;r=t.subscribe(Xo(n,void 0,void 0,s=>{o=vd(e(s,YC(e)(t))),r?(r.unsubscribe(),r=null,o.subscribe(n)):i=!0})),i&&(r.unsubscribe(),r=null,o.subscribe(n))})}function zj(e){return e<=0?()=>Mh:is((t,n)=>{let r=[];t.subscribe(Xo(n,i=>{r.push(i),e{for(const i of r)n.next(i);n.complete()},void 0,()=>{r=null}))})}function Vj(e){return is((t,n)=>{try{t.subscribe(n)}finally{n.add(e)}})}const li="primary",YT=Symbol("RouteTitle");class VRe{constructor(t){this.params=t||{}}has(t){return Object.prototype.hasOwnProperty.call(this.params,t)}get(t){if(this.has(t)){const n=this.params[t];return Array.isArray(n)?n[0]:n}return null}getAll(t){if(this.has(t)){const n=this.params[t];return Array.isArray(n)?n:[n]}return[]}get keys(){return Object.keys(this.params)}}function XC(e){return new VRe(e)}function HRe(e,t,n){const r=n.path.split("/");if(r.length>e.length||"full"===n.pathMatch&&(t.hasChildren()||r.lengthr[o]===i)}return e===t}function eie(e){return e.length>0?e[e.length-1]:null}function d1(e){return function H4e(e){return!!e&&(e instanceof Ra||Yo(e.lift)&&Yo(e.subscribe))}(e)?e:N4(e)?Is(Promise.resolve(e)):Mr(e)}const qRe={exact:function rie(e,t,n){if(!Hx(e.segments,t.segments)||!uR(e.segments,t.segments,n)||e.numberOfChildren!==t.numberOfChildren)return!1;for(const r in t.children)if(!e.children[r]||!rie(e.children[r],t.children[r],n))return!1;return!0},subset:iie},tie={exact:function WRe(e,t){return Zm(e,t)},subset:function $Re(e,t){return Object.keys(t).length<=Object.keys(e).length&&Object.keys(t).every(n=>Jre(e[n],t[n]))},ignored:()=>!0};function nie(e,t,n){return qRe[n.paths](e.root,t.root,n.matrixParams)&&tie[n.queryParams](e.queryParams,t.queryParams)&&!("exact"===n.fragment&&e.fragment!==t.fragment)}function iie(e,t,n){return oie(e,t,t.segments,n)}function oie(e,t,n,r){if(e.segments.length>n.length){const i=e.segments.slice(0,n.length);return!(!Hx(i,n)||t.hasChildren()||!uR(i,n,r))}if(e.segments.length===n.length){if(!Hx(e.segments,n)||!uR(e.segments,n,r))return!1;for(const i in t.children)if(!e.children[i]||!iie(e.children[i],t.children[i],r))return!1;return!0}{const i=n.slice(0,e.segments.length),o=n.slice(e.segments.length);return!!(Hx(e.segments,i)&&uR(e.segments,i,r)&&e.children[li])&&oie(e.children[li],t,o,r)}}function uR(e,t,n){return t.every((r,i)=>tie[n](e[i].parameters,r.parameters))}class KC{constructor(t=new Go([],{}),n={},r=null){this.root=t,this.queryParams=n,this.fragment=r}get queryParamMap(){return this._queryParamMap??=XC(this.queryParams),this._queryParamMap}toString(){return KRe.serialize(this)}}class Go{constructor(t,n){this.segments=t,this.children=n,this.parent=null,Object.values(n).forEach(r=>r.parent=this)}hasChildren(){return this.numberOfChildren>0}get numberOfChildren(){return Object.keys(this.children).length}toString(){return dR(this)}}class XT{constructor(t,n){this.path=t,this.parameters=n}get parameterMap(){return this._parameterMap??=XC(this.parameters),this._parameterMap}toString(){return lie(this)}}function Hx(e,t){return e.length===t.length&&e.every((n,r)=>n.path===t[r].path)}let ZC=(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:()=>new Gj,providedIn:"root"})}return e})();class Gj{parse(t){const n=new a5e(t);return new KC(n.parseRootSegment(),n.parseQueryParams(),n.parseFragment())}serialize(t){const n=`/${KT(t.root,!0)}`,r=function JRe(e){const t=Object.entries(e).map(([n,r])=>Array.isArray(r)?r.map(i=>`${fR(n)}=${fR(i)}`).join("&"):`${fR(n)}=${fR(r)}`).filter(n=>n);return t.length?`?${t.join("&")}`:""}(t.queryParams);return`${n}${r}${"string"==typeof t.fragment?`#${function ZRe(e){return encodeURI(e)}(t.fragment)}`:""}`}}const KRe=new Gj;function dR(e){return e.segments.map(t=>lie(t)).join("/")}function KT(e,t){if(!e.hasChildren())return dR(e);if(t){const n=e.children[li]?KT(e.children[li],!1):"",r=[];return Object.entries(e.children).forEach(([i,o])=>{i!==li&&r.push(`${i}:${KT(o,!1)}`)}),r.length>0?`${n}(${r.join("//")})`:n}{const n=function XRe(e,t){let n=[];return Object.entries(e.children).forEach(([r,i])=>{r===li&&(n=n.concat(t(i,r)))}),Object.entries(e.children).forEach(([r,i])=>{r!==li&&(n=n.concat(t(i,r)))}),n}(e,(r,i)=>i===li?[KT(e.children[li],!1)]:[`${i}:${KT(r,!1)}`]);return 1===Object.keys(e.children).length&&null!=e.children[li]?`${dR(e)}/${n[0]}`:`${dR(e)}/(${n.join("//")})`}}function sie(e){return encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",")}function fR(e){return sie(e).replace(/%3B/gi,";")}function qj(e){return sie(e).replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/%26/gi,"&")}function pR(e){return decodeURIComponent(e)}function aie(e){return pR(e.replace(/\+/g,"%20"))}function lie(e){return`${qj(e.path)}${function QRe(e){return Object.entries(e).map(([t,n])=>`;${qj(t)}=${qj(n)}`).join("")}(e.parameters)}`}const e5e=/^[^\/()?;#]+/;function Wj(e){const t=e.match(e5e);return t?t[0]:""}const t5e=/^[^\/()?;=#]+/,r5e=/^[^=?&#]+/,o5e=/^[^&#]+/;class a5e{constructor(t){this.url=t,this.remaining=t}parseRootSegment(){return this.consumeOptional("/"),""===this.remaining||this.peekStartsWith("?")||this.peekStartsWith("#")?new Go([],{}):new Go([],this.parseChildren())}parseQueryParams(){const t={};if(this.consumeOptional("?"))do{this.parseQueryParam(t)}while(this.consumeOptional("&"));return t}parseFragment(){return this.consumeOptional("#")?decodeURIComponent(this.remaining):null}parseChildren(){if(""===this.remaining)return{};this.consumeOptional("/");const t=[];for(this.peekStartsWith("(")||t.push(this.parseSegment());this.peekStartsWith("/")&&!this.peekStartsWith("//")&&!this.peekStartsWith("/(");)this.capture("/"),t.push(this.parseSegment());let n={};this.peekStartsWith("/(")&&(this.capture("/"),n=this.parseParens(!0));let r={};return this.peekStartsWith("(")&&(r=this.parseParens(!1)),(t.length>0||Object.keys(n).length>0)&&(r[li]=new Go(t,n)),r}parseSegment(){const t=Wj(this.remaining);if(""===t&&this.peekStartsWith(";"))throw new Xt(4009,!1);return this.capture(t),new XT(pR(t),this.parseMatrixParams())}parseMatrixParams(){const t={};for(;this.consumeOptional(";");)this.parseParam(t);return t}parseParam(t){const n=function n5e(e){const t=e.match(t5e);return t?t[0]:""}(this.remaining);if(!n)return;this.capture(n);let r="";if(this.consumeOptional("=")){const i=Wj(this.remaining);i&&(r=i,this.capture(r))}t[pR(n)]=pR(r)}parseQueryParam(t){const n=function i5e(e){const t=e.match(r5e);return t?t[0]:""}(this.remaining);if(!n)return;this.capture(n);let r="";if(this.consumeOptional("=")){const s=function s5e(e){const t=e.match(o5e);return t?t[0]:""}(this.remaining);s&&(r=s,this.capture(r))}const i=aie(n),o=aie(r);if(t.hasOwnProperty(i)){let s=t[i];Array.isArray(s)||(s=[s],t[i]=s),s.push(o)}else t[i]=o}parseParens(t){const n={};for(this.capture("(");!this.consumeOptional(")")&&this.remaining.length>0;){const r=Wj(this.remaining),i=this.remaining[r.length];if("/"!==i&&")"!==i&&";"!==i)throw new Xt(4010,!1);let o;r.indexOf(":")>-1?(o=r.slice(0,r.indexOf(":")),this.capture(o),this.capture(":")):t&&(o=li);const s=this.parseChildren();n[o]=1===Object.keys(s).length?s[li]:new Go([],s),this.consumeOptional("//")}return n}peekStartsWith(t){return this.remaining.startsWith(t)}consumeOptional(t){return!!this.peekStartsWith(t)&&(this.remaining=this.remaining.substring(t.length),!0)}capture(t){if(!this.consumeOptional(t))throw new Xt(4011,!1)}}function cie(e){return e.segments.length>0?new Go([],{[li]:e}):e}function uie(e){const t={};for(const[r,i]of Object.entries(e.children)){const o=uie(i);if(r===li&&0===o.segments.length&&o.hasChildren())for(const[s,a]of Object.entries(o.children))t[s]=a;else(o.segments.length>0||o.hasChildren())&&(t[r]=o)}return function l5e(e){if(1===e.numberOfChildren&&e.children[li]){const t=e.children[li];return new Go(e.segments.concat(t.segments),t.children)}return e}(new Go(e.segments,t))}function QC(e){return e instanceof KC}function die(e){let t;const r=function n(o){const s={};for(const l of o.children){const c=n(l);s[l.outlet]=c}const a=new Go(o.url,s);return o===e&&(t=a),a}(e.root),i=cie(r);return t??i}function fie(e,t,n,r){let i=e;for(;i.parent;)i=i.parent;if(0===t.length)return $j(i,i,i,n,r);const o=function u5e(e){if("string"==typeof e[0]&&1===e.length&&"/"===e[0])return new hie(!0,0,e);let t=0,n=!1;const r=e.reduce((i,o,s)=>{if("object"==typeof o&&null!=o){if(o.outlets){const a={};return Object.entries(o.outlets).forEach(([l,c])=>{a[l]="string"==typeof c?c.split("/"):c}),[...i,{outlets:a}]}if(o.segmentPath)return[...i,o.segmentPath]}return"string"!=typeof o?[...i,o]:0===s?(o.split("/").forEach((a,l)=>{0==l&&"."===a||(0==l&&""===a?n=!0:".."===a?t++:""!=a&&i.push(a))}),i):[...i,o]},[]);return new hie(n,t,r)}(t);if(o.toRoot())return $j(i,i,new Go([],{}),n,r);const s=function d5e(e,t,n){if(e.isAbsolute)return new mR(t,!0,0);if(!n)return new mR(t,!1,NaN);if(null===n.parent)return new mR(n,!0,0);const r=hR(e.commands[0])?0:1;return function f5e(e,t,n){let r=e,i=t,o=n;for(;o>i;){if(o-=i,r=r.parent,!r)throw new Xt(4005,!1);i=r.segments.length}return new mR(r,!1,i-o)}(n,n.segments.length-1+r,e.numberOfDoubleDots)}(o,i,e),a=s.processChildren?QT(s.segmentGroup,s.index,o.commands):mie(s.segmentGroup,s.index,o.commands);return $j(i,s.segmentGroup,a,n,r)}function hR(e){return"object"==typeof e&&null!=e&&!e.outlets&&!e.segmentPath}function ZT(e){return"object"==typeof e&&null!=e&&e.outlets}function $j(e,t,n,r,i){let s,o={};r&&Object.entries(r).forEach(([l,c])=>{o[l]=Array.isArray(c)?c.map(u=>`${u}`):`${c}`}),s=e===t?n:pie(e,t,n);const a=cie(uie(s));return new KC(a,o,i)}function pie(e,t,n){const r={};return Object.entries(e.children).forEach(([i,o])=>{r[i]=o===t?n:pie(o,t,n)}),new Go(e.segments,r)}class hie{constructor(t,n,r){if(this.isAbsolute=t,this.numberOfDoubleDots=n,this.commands=r,t&&r.length>0&&hR(r[0]))throw new Xt(4003,!1);const i=r.find(ZT);if(i&&i!==eie(r))throw new Xt(4004,!1)}toRoot(){return this.isAbsolute&&1===this.commands.length&&"/"==this.commands[0]}}class mR{constructor(t,n,r){this.segmentGroup=t,this.processChildren=n,this.index=r}}function mie(e,t,n){if(e??=new Go([],{}),0===e.segments.length&&e.hasChildren())return QT(e,t,n);const r=function h5e(e,t,n){let r=0,i=t;const o={match:!1,pathIndex:0,commandIndex:0};for(;i=n.length)return o;const s=e.segments[i],a=n[r];if(ZT(a))break;const l=`${a}`,c=r0&&void 0===l)break;if(l&&c&&"object"==typeof c&&void 0===c.outlets){if(!yie(l,c,s))return o;r+=2}else{if(!yie(l,{},s))return o;r++}i++}return{match:!0,pathIndex:i,commandIndex:r}}(e,t,n),i=n.slice(r.commandIndex);if(r.match&&r.pathIndexo!==li)&&e.children[li]&&1===e.numberOfChildren&&0===e.children[li].segments.length){const o=QT(e.children[li],t,n);return new Go(e.segments,o.children)}return Object.entries(r).forEach(([o,s])=>{"string"==typeof s&&(s=[s]),null!==s&&(i[o]=mie(e.children[o],t,s))}),Object.entries(e.children).forEach(([o,s])=>{void 0===r[o]&&(i[o]=s)}),new Go(e.segments,i)}}function Yj(e,t,n){const r=e.segments.slice(0,t);let i=0;for(;i{"string"==typeof r&&(r=[r]),null!==r&&(t[n]=Yj(new Go([],{}),0,r))}),t}function gie(e){const t={};return Object.entries(e).forEach(([n,r])=>t[n]=`${r}`),t}function yie(e,t,n){return e==n.path&&Zm(t,n.parameters)}const JT="imperative";var ji=function(e){return e[e.NavigationStart=0]="NavigationStart",e[e.NavigationEnd=1]="NavigationEnd",e[e.NavigationCancel=2]="NavigationCancel",e[e.NavigationError=3]="NavigationError",e[e.RoutesRecognized=4]="RoutesRecognized",e[e.ResolveStart=5]="ResolveStart",e[e.ResolveEnd=6]="ResolveEnd",e[e.GuardsCheckStart=7]="GuardsCheckStart",e[e.GuardsCheckEnd=8]="GuardsCheckEnd",e[e.RouteConfigLoadStart=9]="RouteConfigLoadStart",e[e.RouteConfigLoadEnd=10]="RouteConfigLoadEnd",e[e.ChildActivationStart=11]="ChildActivationStart",e[e.ChildActivationEnd=12]="ChildActivationEnd",e[e.ActivationStart=13]="ActivationStart",e[e.ActivationEnd=14]="ActivationEnd",e[e.Scroll=15]="Scroll",e[e.NavigationSkipped=16]="NavigationSkipped",e}(ji||{});class Qm{constructor(t,n){this.id=t,this.url=n}}class gR extends Qm{constructor(t,n,r="imperative",i=null){super(t,n),this.type=ji.NavigationStart,this.navigationTrigger=r,this.restoredState=i}toString(){return`NavigationStart(id: ${this.id}, url: '${this.url}')`}}class U0 extends Qm{constructor(t,n,r){super(t,n),this.urlAfterRedirects=r,this.type=ji.NavigationEnd}toString(){return`NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`}}var df=function(e){return e[e.Redirect=0]="Redirect",e[e.SupersededByNewNavigation=1]="SupersededByNewNavigation",e[e.NoDataFromResolver=2]="NoDataFromResolver",e[e.GuardRejected=3]="GuardRejected",e}(df||{}),yR=function(e){return e[e.IgnoredSameUrlNavigation=0]="IgnoredSameUrlNavigation",e[e.IgnoredByUrlHandlingStrategy=1]="IgnoredByUrlHandlingStrategy",e}(yR||{});class JC extends Qm{constructor(t,n,r,i){super(t,n),this.reason=r,this.code=i,this.type=ji.NavigationCancel}toString(){return`NavigationCancel(id: ${this.id}, url: '${this.url}')`}}class ew extends Qm{constructor(t,n,r,i){super(t,n),this.reason=r,this.code=i,this.type=ji.NavigationSkipped}}class bR extends Qm{constructor(t,n,r,i){super(t,n),this.error=r,this.target=i,this.type=ji.NavigationError}toString(){return`NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`}}class bie extends Qm{constructor(t,n,r,i){super(t,n),this.urlAfterRedirects=r,this.state=i,this.type=ji.RoutesRecognized}toString(){return`RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class g5e extends Qm{constructor(t,n,r,i){super(t,n),this.urlAfterRedirects=r,this.state=i,this.type=ji.GuardsCheckStart}toString(){return`GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class y5e extends Qm{constructor(t,n,r,i,o){super(t,n),this.urlAfterRedirects=r,this.state=i,this.shouldActivate=o,this.type=ji.GuardsCheckEnd}toString(){return`GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`}}class b5e extends Qm{constructor(t,n,r,i){super(t,n),this.urlAfterRedirects=r,this.state=i,this.type=ji.ResolveStart}toString(){return`ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class v5e extends Qm{constructor(t,n,r,i){super(t,n),this.urlAfterRedirects=r,this.state=i,this.type=ji.ResolveEnd}toString(){return`ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}}class x5e{constructor(t){this.route=t,this.type=ji.RouteConfigLoadStart}toString(){return`RouteConfigLoadStart(path: ${this.route.path})`}}class _5e{constructor(t){this.route=t,this.type=ji.RouteConfigLoadEnd}toString(){return`RouteConfigLoadEnd(path: ${this.route.path})`}}class S5e{constructor(t){this.snapshot=t,this.type=ji.ChildActivationStart}toString(){return`ChildActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class C5e{constructor(t){this.snapshot=t,this.type=ji.ChildActivationEnd}toString(){return`ChildActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class w5e{constructor(t){this.snapshot=t,this.type=ji.ActivationStart}toString(){return`ActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class A5e{constructor(t){this.snapshot=t,this.type=ji.ActivationEnd}toString(){return`ActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}}class vie{constructor(t,n,r){this.routerEvent=t,this.position=n,this.anchor=r,this.type=ji.Scroll}toString(){return`Scroll(anchor: '${this.anchor}', position: '${this.position?`${this.position[0]}, ${this.position[1]}`:null}')`}}class Xj{}class Kj{constructor(t){this.url=t}}class I5e{constructor(){this.outlet=null,this.route=null,this.injector=null,this.children=new e3,this.attachRef=null}}let e3=(()=>{class e{constructor(){this.contexts=new Map}onChildOutletCreated(n,r){const i=this.getOrCreateContext(n);i.outlet=r,this.contexts.set(n,i)}onChildOutletDestroyed(n){const r=this.getContext(n);r&&(r.outlet=null,r.attachRef=null)}onOutletDeactivated(){const n=this.contexts;return this.contexts=new Map,n}onOutletReAttached(n){this.contexts=n}getOrCreateContext(n){let r=this.getContext(n);return r||(r=new I5e,this.contexts.set(n,r)),r}getContext(n){return this.contexts.get(n)||null}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();class xie{constructor(t){this._root=t}get root(){return this._root.value}parent(t){const n=this.pathFromRoot(t);return n.length>1?n[n.length-2]:null}children(t){const n=Zj(t,this._root);return n?n.children.map(r=>r.value):[]}firstChild(t){const n=Zj(t,this._root);return n&&n.children.length>0?n.children[0].value:null}siblings(t){const n=Qj(t,this._root);return n.length<2?[]:n[n.length-2].children.map(i=>i.value).filter(i=>i!==t)}pathFromRoot(t){return Qj(t,this._root).map(n=>n.value)}}function Zj(e,t){if(e===t.value)return t;for(const n of t.children){const r=Zj(e,n);if(r)return r}return null}function Qj(e,t){if(e===t.value)return[t];for(const n of t.children){const r=Qj(e,n);if(r.length)return r.unshift(t),r}return[]}class Rh{constructor(t,n){this.value=t,this.children=n}toString(){return`TreeNode(${this.value})`}}function tw(e){const t={};return e&&e.children.forEach(n=>t[n.value.outlet]=n),t}class _ie extends xie{constructor(t,n){super(t),this.snapshot=n,tU(this,t)}toString(){return this.snapshot.toString()}}function Sie(e){const t=function E5e(e){const o=new eU([],{},{},"",{},li,e,null,{});return new Cie("",new Rh(o,[]))}(e),n=new Ao([new XT("",{})]),r=new Ao({}),i=new Ao({}),o=new Ao({}),s=new Ao(""),a=new nw(n,r,o,s,i,li,e,t.root);return a.snapshot=t.root,new _ie(new Rh(a,[]),t)}class nw{constructor(t,n,r,i,o,s,a,l){this.urlSubject=t,this.paramsSubject=n,this.queryParamsSubject=r,this.fragmentSubject=i,this.dataSubject=o,this.outlet=s,this.component=a,this._futureSnapshot=l,this.title=this.dataSubject?.pipe(hn(c=>c[YT]))??Mr(void 0),this.url=t,this.params=n,this.queryParams=r,this.fragment=i,this.data=o}get routeConfig(){return this._futureSnapshot.routeConfig}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??=this.params.pipe(hn(t=>XC(t))),this._paramMap}get queryParamMap(){return this._queryParamMap??=this.queryParams.pipe(hn(t=>XC(t))),this._queryParamMap}toString(){return this.snapshot?this.snapshot.toString():`Future(${this._futureSnapshot})`}}function Jj(e,t,n="emptyOnly"){let r;const{routeConfig:i}=e;return r=null===t||"always"!==n&&""!==i?.path&&(t.component||t.routeConfig?.loadComponent)?{params:{...e.params},data:{...e.data},resolve:{...e.data,...e._resolvedData??{}}}:{params:{...t.params,...e.params},data:{...t.data,...e.data},resolve:{...e.data,...t.data,...i?.data,...e._resolvedData}},i&&Aie(i)&&(r.resolve[YT]=i.title),r}class eU{get title(){return this.data?.[YT]}constructor(t,n,r,i,o,s,a,l,c){this.url=t,this.params=n,this.queryParams=r,this.fragment=i,this.data=o,this.outlet=s,this.component=a,this.routeConfig=l,this._resolve=c}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??=XC(this.params),this._paramMap}get queryParamMap(){return this._queryParamMap??=XC(this.queryParams),this._queryParamMap}toString(){return`Route(url:'${this.url.map(r=>r.toString()).join("/")}', path:'${this.routeConfig?this.routeConfig.path:""}')`}}class Cie extends xie{constructor(t,n){super(n),this.url=t,tU(this,n)}toString(){return wie(this._root)}}function tU(e,t){t.value._routerState=e,t.children.forEach(n=>tU(e,n))}function wie(e){const t=e.children.length>0?` { ${e.children.map(wie).join(", ")} } `:"";return`${e.value}${t}`}function nU(e){if(e.snapshot){const t=e.snapshot,n=e._futureSnapshot;e.snapshot=n,Zm(t.queryParams,n.queryParams)||e.queryParamsSubject.next(n.queryParams),t.fragment!==n.fragment&&e.fragmentSubject.next(n.fragment),Zm(t.params,n.params)||e.paramsSubject.next(n.params),function GRe(e,t){if(e.length!==t.length)return!1;for(let n=0;nZm(n.parameters,t[r].parameters))}(e.url,t.url);return n&&!(!e.parent!=!t.parent)&&(!e.parent||rU(e.parent,t.parent))}function Aie(e){return"string"==typeof e.title||null===e.title}let iU=(()=>{class e{constructor(){this.activated=null,this._activatedRoute=null,this.name=li,this.activateEvents=new rl,this.deactivateEvents=new rl,this.attachEvents=new rl,this.detachEvents=new rl,this.parentContexts=qt(e3),this.location=qt(Ih),this.changeDetector=qt(L4),this.environmentInjector=qt(Na),this.inputBinder=qt(vR,{optional:!0}),this.supportsBindingToComponentInputs=!0}get activatedComponentRef(){return this.activated}ngOnChanges(n){if(n.name){const{firstChange:r,previousValue:i}=n.name;if(r)return;this.isTrackedInParentContexts(i)&&(this.deactivate(),this.parentContexts.onChildOutletDestroyed(i)),this.initializeOutletWithName()}}ngOnDestroy(){this.isTrackedInParentContexts(this.name)&&this.parentContexts.onChildOutletDestroyed(this.name),this.inputBinder?.unsubscribeFromRouteData(this)}isTrackedInParentContexts(n){return this.parentContexts.getContext(n)?.outlet===this}ngOnInit(){this.initializeOutletWithName()}initializeOutletWithName(){if(this.parentContexts.onChildOutletCreated(this.name,this),this.activated)return;const n=this.parentContexts.getContext(this.name);n?.route&&(n.attachRef?this.attach(n.attachRef,n.route):this.activateWith(n.route,n.injector))}get isActivated(){return!!this.activated}get component(){if(!this.activated)throw new Xt(4012,!1);return this.activated.instance}get activatedRoute(){if(!this.activated)throw new Xt(4012,!1);return this._activatedRoute}get activatedRouteData(){return this._activatedRoute?this._activatedRoute.snapshot.data:{}}detach(){if(!this.activated)throw new Xt(4012,!1);this.location.detach();const n=this.activated;return this.activated=null,this._activatedRoute=null,this.detachEvents.emit(n.instance),n}attach(n,r){this.activated=n,this._activatedRoute=r,this.location.insert(n.hostView),this.inputBinder?.bindActivatedRouteToOutletComponent(this),this.attachEvents.emit(n.instance)}deactivate(){if(this.activated){const n=this.component;this.activated.destroy(),this.activated=null,this._activatedRoute=null,this.deactivateEvents.emit(n)}}activateWith(n,r){if(this.isActivated)throw new Xt(4013,!1);this._activatedRoute=n;const i=this.location,s=n.snapshot.component,a=this.parentContexts.getOrCreateContext(this.name).children,l=new T5e(n,a,i.injector);this.activated=i.createComponent(s,{index:i.length,injector:l,environmentInjector:r??this.environmentInjector}),this.changeDetector.markForCheck(),this.inputBinder?.bindActivatedRouteToOutletComponent(this),this.activateEvents.emit(this.activated.instance)}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275dir=Ja({type:e,selectors:[["router-outlet"]],inputs:{name:"name"},outputs:{activateEvents:"activate",deactivateEvents:"deactivate",attachEvents:"attach",detachEvents:"detach"},exportAs:["outlet"],standalone:!0,features:[Oo]})}return e})();class T5e{constructor(t,n,r){this.route=t,this.childContexts=n,this.parent=r}get(t,n){return t===nw?this.route:t===e3?this.childContexts:this.parent.get(t,n)}}const vR=new jn("");let Iie=(()=>{class e{constructor(){this.outletDataSubscriptions=new Map}bindActivatedRouteToOutletComponent(n){this.unsubscribeFromRouteData(n),this.subscribeToRouteData(n)}unsubscribeFromRouteData(n){this.outletDataSubscriptions.get(n)?.unsubscribe(),this.outletDataSubscriptions.delete(n)}subscribeToRouteData(n){const{activatedRoute:r}=n,i=Lj([r.queryParams,r.params,r.data]).pipe(ba(([o,s,a],l)=>(a={...o,...s,...a},0===l?Mr(a):Promise.resolve(a)))).subscribe(o=>{if(!n.isActivated||!n.activatedComponentRef||n.activatedRoute!==r||null===r.component)return void this.unsubscribeFromRouteData(n);const s=function uke(e){const t=Yr(e);if(!t)return null;const n=new pT(t);return{get selector(){return n.selector},get type(){return n.componentType},get inputs(){return n.inputs},get outputs(){return n.outputs},get ngContentSelectors(){return n.ngContentSelectors},get isStandalone(){return t.standalone},get isSignal(){return t.signals}}}(r.component);if(s)for(const{templateName:a}of s.inputs)n.activatedComponentRef.setInput(a,o[a]);else this.unsubscribeFromRouteData(n)});this.outletDataSubscriptions.set(n,i)}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac})}return e})();function t3(e,t,n){if(n&&e.shouldReuseRoute(t.value,n.value.snapshot)){const r=n.value;r._futureSnapshot=t.value;const i=function P5e(e,t,n){return t.children.map(r=>{for(const i of n.children)if(e.shouldReuseRoute(r.value,i.value.snapshot))return t3(e,r,i);return t3(e,r)})}(e,t,n);return new Rh(r,i)}{if(e.shouldAttach(t.value)){const o=e.retrieve(t.value);if(null!==o){const s=o.route;return s.value._futureSnapshot=t.value,s.children=t.children.map(a=>t3(e,a)),s}}const r=function k5e(e){return new nw(new Ao(e.url),new Ao(e.params),new Ao(e.queryParams),new Ao(e.fragment),new Ao(e.data),e.outlet,e.component,e)}(t.value),i=t.children.map(o=>t3(e,o));return new Rh(r,i)}}const Eie="ngNavigationCancelingError";function Tie(e,t){const{redirectTo:n,navigationBehaviorOptions:r}=QC(t)?{redirectTo:t,navigationBehaviorOptions:void 0}:t,i=Die(!1,df.Redirect);return i.url=n,i.navigationBehaviorOptions=r,i}function Die(e,t){const n=new Error(`NavigationCancelingError: ${e||""}`);return n[Eie]=!0,n.cancellationCode=t,n}function Pie(e){return!!e&&e[Eie]}let kie=(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275cmp=$d({type:e,selectors:[["ng-component"]],standalone:!0,features:[Dh],decls:1,vars:0,template:function(r,i){1&r&&js(0,"router-outlet")},dependencies:[iU],encapsulation:2})}return e})();function oU(e){const t=e.children&&e.children.map(oU),n=t?{...e,children:t}:{...e};return!n.component&&!n.loadComponent&&(t||n.loadChildren)&&n.outlet&&n.outlet!==li&&(n.component=kie),n}function Jm(e){return e.outlet||li}function n3(e){if(!e)return null;if(e.routeConfig?._injector)return e.routeConfig._injector;for(let t=e.parent;t;t=t.parent){const n=t.routeConfig;if(n?._loadedInjector)return n._loadedInjector;if(n?._injector)return n._injector}return null}class j5e{constructor(t,n,r,i,o){this.routeReuseStrategy=t,this.futureState=n,this.currState=r,this.forwardEvent=i,this.inputBindingEnabled=o}activate(t){const n=this.futureState._root,r=this.currState?this.currState._root:null;this.deactivateChildRoutes(n,r,t),nU(this.futureState.root),this.activateChildRoutes(n,r,t)}deactivateChildRoutes(t,n,r){const i=tw(n);t.children.forEach(o=>{const s=o.value.outlet;this.deactivateRoutes(o,i[s],r),delete i[s]}),Object.values(i).forEach(o=>{this.deactivateRouteAndItsChildren(o,r)})}deactivateRoutes(t,n,r){const i=t.value,o=n?n.value:null;if(i===o)if(i.component){const s=r.getContext(i.outlet);s&&this.deactivateChildRoutes(t,n,s.children)}else this.deactivateChildRoutes(t,n,r);else o&&this.deactivateRouteAndItsChildren(n,r)}deactivateRouteAndItsChildren(t,n){t.value.component&&this.routeReuseStrategy.shouldDetach(t.value.snapshot)?this.detachAndStoreRouteSubtree(t,n):this.deactivateRouteAndOutlet(t,n)}detachAndStoreRouteSubtree(t,n){const r=n.getContext(t.value.outlet),i=r&&t.value.component?r.children:n,o=tw(t);for(const s of Object.values(o))this.deactivateRouteAndItsChildren(s,i);if(r&&r.outlet){const s=r.outlet.detach(),a=r.children.onOutletDeactivated();this.routeReuseStrategy.store(t.value.snapshot,{componentRef:s,route:t,contexts:a})}}deactivateRouteAndOutlet(t,n){const r=n.getContext(t.value.outlet),i=r&&t.value.component?r.children:n,o=tw(t);for(const s of Object.values(o))this.deactivateRouteAndItsChildren(s,i);r&&(r.outlet&&(r.outlet.deactivate(),r.children.onOutletDeactivated()),r.attachRef=null,r.route=null)}activateChildRoutes(t,n,r){const i=tw(n);t.children.forEach(o=>{this.activateRoutes(o,i[o.value.outlet],r),this.forwardEvent(new A5e(o.value.snapshot))}),t.children.length&&this.forwardEvent(new C5e(t.value.snapshot))}activateRoutes(t,n,r){const i=t.value,o=n?n.value:null;if(nU(i),i===o)if(i.component){const s=r.getOrCreateContext(i.outlet);this.activateChildRoutes(t,n,s.children)}else this.activateChildRoutes(t,n,r);else if(i.component){const s=r.getOrCreateContext(i.outlet);if(this.routeReuseStrategy.shouldAttach(i.snapshot)){const a=this.routeReuseStrategy.retrieve(i.snapshot);this.routeReuseStrategy.store(i.snapshot,null),s.children.onOutletReAttached(a.contexts),s.attachRef=a.componentRef,s.route=a.route.value,s.outlet&&s.outlet.attach(a.componentRef,a.route.value),nU(a.route.value),this.activateChildRoutes(t,null,s.children)}else{const a=n3(i.snapshot);s.attachRef=null,s.route=i,s.injector=a,s.outlet&&s.outlet.activateWith(i,s.injector),this.activateChildRoutes(t,null,s.children)}}else this.activateChildRoutes(t,null,r)}}class Mie{constructor(t){this.path=t,this.route=this.path[this.path.length-1]}}class xR{constructor(t,n){this.component=t,this.route=n}}function U5e(e,t,n){const r=e._root;return r3(r,t?t._root:null,n,[r.value])}function rw(e,t){const n=Symbol(),r=t.get(e,n);return r===n?"function"!=typeof e||function Ok(e){return null!==u0(e)}(e)?t.get(e):e:r}function r3(e,t,n,r,i={canDeactivateChecks:[],canActivateChecks:[]}){const o=tw(t);return e.children.forEach(s=>{(function V5e(e,t,n,r,i={canDeactivateChecks:[],canActivateChecks:[]}){const o=e.value,s=t?t.value:null,a=n?n.getContext(e.value.outlet):null;if(s&&o.routeConfig===s.routeConfig){const l=function H5e(e,t,n){if("function"==typeof n)return n(e,t);switch(n){case"pathParamsChange":return!Hx(e.url,t.url);case"pathParamsOrQueryParamsChange":return!Hx(e.url,t.url)||!Zm(e.queryParams,t.queryParams);case"always":return!0;case"paramsOrQueryParamsChange":return!rU(e,t)||!Zm(e.queryParams,t.queryParams);default:return!rU(e,t)}}(s,o,o.routeConfig.runGuardsAndResolvers);l?i.canActivateChecks.push(new Mie(r)):(o.data=s.data,o._resolvedData=s._resolvedData),r3(e,t,o.component?a?a.children:null:n,r,i),l&&a&&a.outlet&&a.outlet.isActivated&&i.canDeactivateChecks.push(new xR(a.outlet.component,s))}else s&&i3(t,a,i),i.canActivateChecks.push(new Mie(r)),r3(e,null,o.component?a?a.children:null:n,r,i)})(s,o[s.value.outlet],n,r.concat([s.value]),i),delete o[s.value.outlet]}),Object.entries(o).forEach(([s,a])=>i3(a,n.getContext(s),i)),i}function i3(e,t,n){const r=tw(e),i=e.value;Object.entries(r).forEach(([o,s])=>{i3(s,i.component?t?t.children.getContext(o):null:t,n)}),n.canDeactivateChecks.push(new xR(i.component&&t&&t.outlet&&t.outlet.isActivated?t.outlet.component:null,i))}function o3(e){return"function"==typeof e}function Rie(e){return e instanceof aR||"EmptyError"===e?.name}const _R=Symbol("INITIAL_VALUE");function iw(){return ba(e=>Lj(e.map(t=>t.pipe(zx(1),WT(_R)))).pipe(hn(t=>{for(const n of t)if(!0!==n){if(n===_R)return _R;if(!1===n||n instanceof KC)return n}return!0}),xd(t=>t!==_R),zx(1)))}function Nie(e){return YI(Ho(t=>{if(QC(t))throw Tie(0,t)}),hn(t=>!0===t))}class sU{constructor(t){this.segmentGroup=t||null}}class aU extends Error{constructor(t){super(),this.urlTree=t}}function ow(e){return lR(new sU(e))}class lNe{constructor(t,n){this.urlSerializer=t,this.urlTree=n}lineralizeSegments(t,n){let r=[],i=n.root;for(;;){if(r=r.concat(i.segments),0===i.numberOfChildren)return Mr(r);if(i.numberOfChildren>1||!i.children[li])return lR(new Xt(4e3,!1));i=i.children[li]}}applyRedirectCommands(t,n,r){const i=this.applyRedirectCreateUrlTree(n,this.urlSerializer.parse(n),t,r);if(n.startsWith("/"))throw new aU(i);return i}applyRedirectCreateUrlTree(t,n,r,i){const o=this.createSegmentGroup(t,n.root,r,i);return new KC(o,this.createQueryParams(n.queryParams,this.urlTree.queryParams),n.fragment)}createQueryParams(t,n){const r={};return Object.entries(t).forEach(([i,o])=>{if("string"==typeof o&&o.startsWith(":")){const a=o.substring(1);r[i]=n[a]}else r[i]=o}),r}createSegmentGroup(t,n,r,i){const o=this.createSegments(t,n.segments,r,i);let s={};return Object.entries(n.children).forEach(([a,l])=>{s[a]=this.createSegmentGroup(t,l,r,i)}),new Go(o,s)}createSegments(t,n,r,i){return n.map(o=>o.path.startsWith(":")?this.findPosParam(t,o,i):this.findOrReturn(o,r))}findPosParam(t,n,r){const i=r[n.path.substring(1)];if(!i)throw new Xt(4001,!1);return i}findOrReturn(t,n){let r=0;for(const i of n){if(i.path===t.path)return n.splice(r),i;r++}return t}}const lU={matched:!1,consumedSegments:[],remainingSegments:[],parameters:{},positionalParamSegments:{}};function cNe(e,t,n,r,i){const o=cU(e,t,n);return o.matched?(r=function R5e(e,t){return e.providers&&!e._injector&&(e._injector=f4(e.providers,t,`Route: ${e.path}`)),e._injector??t}(t,r),function oNe(e,t,n,r){const i=t.canMatch;return i&&0!==i.length?Mr(i.map(s=>{const a=rw(s,e);return d1(function X5e(e){return e&&o3(e.canMatch)}(a)?a.canMatch(t,n):Hf(e,()=>a(t,n)))})).pipe(iw(),Nie()):Mr(!0)}(r,t,n).pipe(hn(s=>!0===s?o:{...lU}))):Mr(o)}function cU(e,t,n){if("**"===t.path)return function uNe(e){return{matched:!0,parameters:e.length>0?eie(e).parameters:{},consumedSegments:e,remainingSegments:[],positionalParamSegments:{}}}(n);if(""===t.path)return"full"===t.pathMatch&&(e.hasChildren()||n.length>0)?{...lU}:{matched:!0,consumedSegments:[],remainingSegments:n,parameters:{},positionalParamSegments:{}};const i=(t.matcher||HRe)(n,e,t);if(!i)return{...lU};const o={};Object.entries(i.posParams??{}).forEach(([a,l])=>{o[a]=l.path});const s=i.consumed.length>0?{...o,...i.consumed[i.consumed.length-1].parameters}:o;return{matched:!0,consumedSegments:i.consumed,remainingSegments:n.slice(i.consumed.length),parameters:s,positionalParamSegments:i.posParams??{}}}function Fie(e,t,n,r){return n.length>0&&function pNe(e,t,n){return n.some(r=>SR(e,t,r)&&Jm(r)!==li)}(e,n,r)?{segmentGroup:new Go(t,fNe(r,new Go(n,e.children))),slicedSegments:[]}:0===n.length&&function hNe(e,t,n){return n.some(r=>SR(e,t,r))}(e,n,r)?{segmentGroup:new Go(e.segments,dNe(e,n,r,e.children)),slicedSegments:n}:{segmentGroup:new Go(e.segments,e.children),slicedSegments:n}}function dNe(e,t,n,r){const i={};for(const o of n)if(SR(e,t,o)&&!r[Jm(o)]){const s=new Go([],{});i[Jm(o)]=s}return{...r,...i}}function fNe(e,t){const n={};n[li]=t;for(const r of e)if(""===r.path&&Jm(r)!==li){const i=new Go([],{});n[Jm(r)]=i}return n}function SR(e,t,n){return(!(e.hasChildren()||t.length>0)||"full"!==n.pathMatch)&&""===n.path}class yNe{}class xNe{constructor(t,n,r,i,o,s,a){this.injector=t,this.configLoader=n,this.rootComponentType=r,this.config=i,this.urlTree=o,this.paramsInheritanceStrategy=s,this.urlSerializer=a,this.applyRedirects=new lNe(this.urlSerializer,this.urlTree),this.absoluteRedirectCount=0,this.allowRedirects=!0}noMatchError(t){return new Xt(4002,`'${t.segmentGroup}'`)}recognize(){const t=Fie(this.urlTree.root,[],[],this.config).segmentGroup;return this.match(t).pipe(hn(n=>{const r=new eU([],Object.freeze({}),Object.freeze({...this.urlTree.queryParams}),this.urlTree.fragment,{},li,this.rootComponentType,null,{}),i=new Rh(r,n),o=new Cie("",i),s=function c5e(e,t,n=null,r=null){return fie(die(e),t,n,r)}(r,[],this.urlTree.queryParams,this.urlTree.fragment);return s.queryParams=this.urlTree.queryParams,o.url=this.urlSerializer.serialize(s),this.inheritParamsAndData(o._root,null),{state:o,tree:s}}))}match(t){return this.processSegmentGroup(this.injector,this.config,t,li).pipe(YC(r=>{if(r instanceof aU)return this.urlTree=r.urlTree,this.match(r.urlTree.root);throw r instanceof sU?this.noMatchError(r):r}))}inheritParamsAndData(t,n){const r=t.value,i=Jj(r,n,this.paramsInheritanceStrategy);r.params=Object.freeze(i.params),r.data=Object.freeze(i.data),t.children.forEach(o=>this.inheritParamsAndData(o,r))}processSegmentGroup(t,n,r,i){return 0===r.segments.length&&r.hasChildren()?this.processChildren(t,n,r):this.processSegment(t,n,r,r.segments,i,!0).pipe(hn(o=>o instanceof Rh?[o]:[]))}processChildren(t,n,r){const i=[];for(const o of Object.keys(r.children))"primary"===o?i.unshift(o):i.push(o);return Is(i).pipe($T(o=>{const s=r.children[o],a=function B5e(e,t){const n=e.filter(r=>Jm(r)===t);return n.push(...e.filter(r=>Jm(r)!==t)),n}(n,o);return this.processSegmentGroup(t,a,s,o)}),function LRe(e,t){return is(function BRe(e,t,n,r,i){return(o,s)=>{let a=n,l=t,c=0;o.subscribe(Xo(s,u=>{const d=c++;l=a?e(l,u,d):(a=!0,u),r&&s.next(l)},i&&(()=>{a&&s.next(l),s.complete()})))}}(e,t,arguments.length>=2,!0))}((o,s)=>(o.push(...s),o)),cR(null),function jRe(e,t){const n=arguments.length>=2;return r=>r.pipe(e?xd((i,o)=>e(i,o,r)):ah,zj(1),n?cR(t):Qre(()=>new aR))}(),Xc(o=>{if(null===o)return ow(r);const s=Oie(o);return function _Ne(e){e.sort((t,n)=>t.value.outlet===li?-1:n.value.outlet===li?1:t.value.outlet.localeCompare(n.value.outlet))}(s),Mr(s)}))}processSegment(t,n,r,i,o,s){return Is(n).pipe($T(a=>this.processSegmentAgainstRoute(a._injector??t,n,a,r,i,o,s).pipe(YC(l=>{if(l instanceof sU)return Mr(null);throw l}))),Vx(a=>!!a),YC(a=>{if(Rie(a))return function gNe(e,t,n){return 0===t.length&&!e.children[n]}(r,i,o)?Mr(new yNe):ow(r);throw a}))}processSegmentAgainstRoute(t,n,r,i,o,s,a){return function mNe(e,t,n,r){return!!(Jm(e)===r||r!==li&&SR(t,n,e))&&cU(t,e,n).matched}(r,i,o,s)?void 0===r.redirectTo?this.matchSegmentAgainstRoute(t,i,r,o,s):this.allowRedirects&&a?this.expandSegmentAgainstRouteUsingRedirect(t,i,n,r,o,s):ow(i):ow(i)}expandSegmentAgainstRouteUsingRedirect(t,n,r,i,o,s){const{matched:a,consumedSegments:l,positionalParamSegments:c,remainingSegments:u}=cU(n,i,o);if(!a)return ow(n);i.redirectTo.startsWith("/")&&(this.absoluteRedirectCount++,this.absoluteRedirectCount>31&&(this.allowRedirects=!1));const d=this.applyRedirects.applyRedirectCommands(l,i.redirectTo,c);return this.applyRedirects.lineralizeSegments(i,d).pipe(Xc(f=>this.processSegment(t,r,n,f.concat(u),s,!1)))}matchSegmentAgainstRoute(t,n,r,i,o){const s=cNe(n,r,i,t);return"**"===r.path&&(n.children={}),s.pipe(ba(a=>a.matched?this.getChildConfig(t=r._injector??t,r,i).pipe(ba(({routes:l})=>{const c=r._loadedInjector??t,{consumedSegments:u,remainingSegments:d,parameters:f}=a,p=new eU(u,f,Object.freeze({...this.urlTree.queryParams}),this.urlTree.fragment,function CNe(e){return e.data||{}}(r),Jm(r),r.component??r._loadedComponent??null,r,function wNe(e){return e.resolve||{}}(r)),{segmentGroup:m,slicedSegments:h}=Fie(n,u,d,l);if(0===h.length&&m.hasChildren())return this.processChildren(c,l,m).pipe(hn(y=>null===y?null:new Rh(p,y)));if(0===l.length&&0===h.length)return Mr(new Rh(p,[]));const g=Jm(r)===o;return this.processSegment(c,l,m,h,g?li:o,!0).pipe(hn(y=>new Rh(p,y instanceof Rh?[y]:[])))})):ow(n)))}getChildConfig(t,n,r){return n.children?Mr({routes:n.children,injector:t}):n.loadChildren?void 0!==n._loadedRoutes?Mr({routes:n._loadedRoutes,injector:n._loadedInjector}):function iNe(e,t,n,r){const i=t.canLoad;return void 0===i||0===i.length?Mr(!0):Mr(i.map(s=>{const a=rw(s,e);return d1(function q5e(e){return e&&o3(e.canLoad)}(a)?a.canLoad(t,n):Hf(e,()=>a(t,n)))})).pipe(iw(),Nie())}(t,n,r).pipe(Xc(i=>i?this.configLoader.loadChildren(t,n).pipe(Ho(o=>{n._loadedRoutes=o.routes,n._loadedInjector=o.injector})):function aNe(e){return lR(Die(!1,df.GuardRejected))}())):Mr({routes:[],injector:t})}}function SNe(e){const t=e.value.routeConfig;return t&&""===t.path}function Oie(e){const t=[],n=new Set;for(const r of e){if(!SNe(r)){t.push(r);continue}const i=t.find(o=>r.value.routeConfig===o.value.routeConfig);void 0!==i?(i.children.push(...r.children),n.add(i)):t.push(r)}for(const r of n){const i=Oie(r.children);t.push(new Rh(r.value,i))}return t.filter(r=>!n.has(r))}function Bie(e){const t=e.children.map(n=>Bie(n)).flat();return[e,...t]}function uU(e){return ba(t=>{const n=e(t);return n?Is(n).pipe(hn(()=>t)):Mr(t)})}let Lie=(()=>{class e{buildTitle(n){let r,i=n.root;for(;void 0!==i;)r=this.getResolvedTitleForRoute(i)??r,i=i.children.find(o=>o.outlet===li);return r}getResolvedTitleForRoute(n){return n.data[YT]}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:()=>qt(PNe),providedIn:"root"})}return e})(),PNe=(()=>{class e extends Lie{constructor(n){super(),this.title=n}updateTitle(n){const r=this.buildTitle(n);void 0!==r&&this.title.setTitle(r)}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(j4e))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();const sw=new jn("",{providedIn:"root",factory:()=>({})}),aw=new jn("");let dU=(()=>{class e{constructor(){this.componentLoaders=new WeakMap,this.childrenLoaders=new WeakMap,this.compiler=qt(Qte)}loadComponent(n){if(this.componentLoaders.get(n))return this.componentLoaders.get(n);if(n._loadedComponent)return Mr(n._loadedComponent);this.onLoadStartListener&&this.onLoadStartListener(n);const r=d1(n.loadComponent()).pipe(hn(jie),Ho(o=>{this.onLoadEndListener&&this.onLoadEndListener(n),n._loadedComponent=o}),Vj(()=>{this.componentLoaders.delete(n)})),i=new Zre(r,()=>new si).pipe(Uj());return this.componentLoaders.set(n,i),i}loadChildren(n,r){if(this.childrenLoaders.get(r))return this.childrenLoaders.get(r);if(r._loadedRoutes)return Mr({routes:r._loadedRoutes,injector:r._loadedInjector});this.onLoadStartListener&&this.onLoadStartListener(r);const o=function kNe(e,t,n,r){return d1(e.loadChildren()).pipe(hn(jie),Xc(i=>i instanceof pJ||Array.isArray(i)?Mr(i):Is(t.compileModuleAsync(i))),hn(i=>{r&&r(e);let o,s,a=!1;return Array.isArray(i)?(s=i,!0):(o=i.create(n).injector,s=o.get(aw,[],{optional:!0,self:!0}).flat()),{routes:s.map(oU),injector:o}}))}(r,this.compiler,n,this.onLoadEndListener).pipe(Vj(()=>{this.childrenLoaders.delete(r)})),s=new Zre(o,()=>new si).pipe(Uj());return this.childrenLoaders.set(r,s),s}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function jie(e){return function MNe(e){return e&&"object"==typeof e&&"default"in e}(e)?e.default:e}let fU=(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:()=>qt(RNe),providedIn:"root"})}return e})(),RNe=(()=>{class e{shouldProcessUrl(n){return!0}extract(n){return n}merge(n,r){return n}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();const Uie=new jn(""),zie=new jn("");function NNe(e,t,n){const r=e.get(zie),i=e.get(ep);return e.get(To).runOutsideAngular(()=>{if(!i.startViewTransition||r.skipNextTransition)return r.skipNextTransition=!1,Promise.resolve();let o;const s=new Promise(c=>{o=c}),a=i.startViewTransition(()=>(o(),function FNe(e){return new Promise(t=>{TQ(t,{injector:e})})}(e))),{onViewTransitionCreated:l}=r;return l&&Hf(e,()=>l({transition:a,from:t,to:n})),s})}let CR=(()=>{class e{get hasRequestedNavigation(){return 0!==this.navigationId}constructor(){this.currentNavigation=null,this.currentTransition=null,this.lastSuccessfulNavigation=null,this.events=new si,this.transitionAbortSubject=new si,this.configLoader=qt(dU),this.environmentInjector=qt(Na),this.urlSerializer=qt(ZC),this.rootContexts=qt(e3),this.location=qt(qC),this.inputBindingEnabled=null!==qt(vR,{optional:!0}),this.titleStrategy=qt(Lie),this.options=qt(sw,{optional:!0})||{},this.paramsInheritanceStrategy=this.options.paramsInheritanceStrategy||"emptyOnly",this.urlHandlingStrategy=qt(fU),this.createViewTransition=qt(Uie,{optional:!0}),this.navigationId=0,this.afterPreactivation=()=>Mr(void 0),this.rootComponentType=null,this.configLoader.onLoadEndListener=i=>this.events.next(new _5e(i)),this.configLoader.onLoadStartListener=i=>this.events.next(new x5e(i))}complete(){this.transitions?.complete()}handleNavigationRequest(n){const r=++this.navigationId;this.transitions?.next({...this.transitions.value,...n,id:r})}setupNavigations(n,r,i){return this.transitions=new Ao({id:0,currentUrlTree:r,currentRawUrl:r,extractedUrl:this.urlHandlingStrategy.extract(r),urlAfterRedirects:this.urlHandlingStrategy.extract(r),rawUrl:r,extras:{},resolve:null,reject:null,promise:Promise.resolve(!0),source:JT,restoredState:null,currentSnapshot:i.snapshot,targetSnapshot:null,currentRouterState:i,targetRouterState:null,guards:{canActivateChecks:[],canDeactivateChecks:[]},guardsResult:null}),this.transitions.pipe(xd(o=>0!==o.id),hn(o=>({...o,extractedUrl:this.urlHandlingStrategy.extract(o.rawUrl)})),ba(o=>{let s=!1,a=!1;return Mr(o).pipe(ba(l=>{if(this.navigationId>o.id)return this.cancelNavigationTransition(o,"",df.SupersededByNewNavigation),Mh;this.currentTransition=o,this.currentNavigation={id:l.id,initialUrl:l.rawUrl,extractedUrl:l.extractedUrl,trigger:l.source,extras:l.extras,previousNavigation:this.lastSuccessfulNavigation?{...this.lastSuccessfulNavigation,previousNavigation:null}:null};const c=!n.navigated||this.isUpdatingInternalState()||this.isUpdatedBrowserUrl();if(!c&&"reload"!==(l.extras.onSameUrlNavigation??n.onSameUrlNavigation)){const d="";return this.events.next(new ew(l.id,this.urlSerializer.serialize(l.rawUrl),d,yR.IgnoredSameUrlNavigation)),l.resolve(null),Mh}if(this.urlHandlingStrategy.shouldProcessUrl(l.rawUrl))return Mr(l).pipe(ba(d=>{const f=this.transitions?.getValue();return this.events.next(new gR(d.id,this.urlSerializer.serialize(d.extractedUrl),d.source,d.restoredState)),f!==this.transitions?.getValue()?Mh:Promise.resolve(d)}),function ANe(e,t,n,r,i,o){return Xc(s=>function bNe(e,t,n,r,i,o,s="emptyOnly"){return new xNe(e,t,n,r,i,s,o).recognize()}(e,t,n,r,s.extractedUrl,i,o).pipe(hn(({state:a,tree:l})=>({...s,targetSnapshot:a,urlAfterRedirects:l}))))}(this.environmentInjector,this.configLoader,this.rootComponentType,n.config,this.urlSerializer,this.paramsInheritanceStrategy),Ho(d=>{o.targetSnapshot=d.targetSnapshot,o.urlAfterRedirects=d.urlAfterRedirects,this.currentNavigation={...this.currentNavigation,finalUrl:d.urlAfterRedirects};const f=new bie(d.id,this.urlSerializer.serialize(d.extractedUrl),this.urlSerializer.serialize(d.urlAfterRedirects),d.targetSnapshot);this.events.next(f)}));if(c&&this.urlHandlingStrategy.shouldProcessUrl(l.currentRawUrl)){const{id:d,extractedUrl:f,source:p,restoredState:m,extras:h}=l,g=new gR(d,this.urlSerializer.serialize(f),p,m);this.events.next(g);const y=Sie(this.rootComponentType).snapshot;return this.currentTransition=o={...l,targetSnapshot:y,urlAfterRedirects:f,extras:{...h,skipLocationChange:!1,replaceUrl:!1}},this.currentNavigation.finalUrl=f,Mr(o)}{const d="";return this.events.next(new ew(l.id,this.urlSerializer.serialize(l.extractedUrl),d,yR.IgnoredByUrlHandlingStrategy)),l.resolve(null),Mh}}),Ho(l=>{const c=new g5e(l.id,this.urlSerializer.serialize(l.extractedUrl),this.urlSerializer.serialize(l.urlAfterRedirects),l.targetSnapshot);this.events.next(c)}),hn(l=>(this.currentTransition=o={...l,guards:U5e(l.targetSnapshot,l.currentSnapshot,this.rootContexts)},o)),function K5e(e,t){return Xc(n=>{const{targetSnapshot:r,currentSnapshot:i,guards:{canActivateChecks:o,canDeactivateChecks:s}}=n;return 0===s.length&&0===o.length?Mr({...n,guardsResult:!0}):function Z5e(e,t,n,r){return Is(e).pipe(Xc(i=>function rNe(e,t,n,r,i){const o=t&&t.routeConfig?t.routeConfig.canDeactivate:null;return o&&0!==o.length?Mr(o.map(a=>{const l=n3(t)??i,c=rw(a,l);return d1(function Y5e(e){return e&&o3(e.canDeactivate)}(c)?c.canDeactivate(e,t,n,r):Hf(l,()=>c(e,t,n,r))).pipe(Vx())})).pipe(iw()):Mr(!0)}(i.component,i.route,n,t,r)),Vx(i=>!0!==i,!0))}(s,r,i,e).pipe(Xc(a=>a&&function G5e(e){return"boolean"==typeof e}(a)?function Q5e(e,t,n,r){return Is(t).pipe($T(i=>jj(function eNe(e,t){return null!==e&&t&&t(new S5e(e)),Mr(!0)}(i.route.parent,r),function J5e(e,t){return null!==e&&t&&t(new w5e(e)),Mr(!0)}(i.route,r),function nNe(e,t,n){const r=t[t.length-1],o=t.slice(0,t.length-1).reverse().map(s=>function z5e(e){const t=e.routeConfig?e.routeConfig.canActivateChild:null;return t&&0!==t.length?{node:e,guards:t}:null}(s)).filter(s=>null!==s).map(s=>Kre(()=>Mr(s.guards.map(l=>{const c=n3(s.node)??n,u=rw(l,c);return d1(function $5e(e){return e&&o3(e.canActivateChild)}(u)?u.canActivateChild(r,e):Hf(c,()=>u(r,e))).pipe(Vx())})).pipe(iw())));return Mr(o).pipe(iw())}(e,i.path,n),function tNe(e,t,n){const r=t.routeConfig?t.routeConfig.canActivate:null;if(!r||0===r.length)return Mr(!0);const i=r.map(o=>Kre(()=>{const s=n3(t)??n,a=rw(o,s);return d1(function W5e(e){return e&&o3(e.canActivate)}(a)?a.canActivate(t,e):Hf(s,()=>a(t,e))).pipe(Vx())}));return Mr(i).pipe(iw())}(e,i.route,n))),Vx(i=>!0!==i,!0))}(r,o,e,t):Mr(a)),hn(a=>({...n,guardsResult:a})))})}(this.environmentInjector,l=>this.events.next(l)),Ho(l=>{if(o.guardsResult=l.guardsResult,QC(l.guardsResult))throw Tie(0,l.guardsResult);const c=new y5e(l.id,this.urlSerializer.serialize(l.extractedUrl),this.urlSerializer.serialize(l.urlAfterRedirects),l.targetSnapshot,!!l.guardsResult);this.events.next(c)}),xd(l=>!!l.guardsResult||(this.cancelNavigationTransition(l,"",df.GuardRejected),!1)),uU(l=>{if(l.guards.canActivateChecks.length)return Mr(l).pipe(Ho(c=>{const u=new b5e(c.id,this.urlSerializer.serialize(c.extractedUrl),this.urlSerializer.serialize(c.urlAfterRedirects),c.targetSnapshot);this.events.next(u)}),ba(c=>{let u=!1;return Mr(c).pipe(function INe(e,t){return Xc(n=>{const{targetSnapshot:r,guards:{canActivateChecks:i}}=n;if(!i.length)return Mr(n);const o=new Set(i.map(l=>l.route)),s=new Set;for(const l of o)if(!s.has(l))for(const c of Bie(l))s.add(c);let a=0;return Is(s).pipe($T(l=>o.has(l)?function ENe(e,t,n,r){const i=e.routeConfig,o=e._resolve;return void 0!==i?.title&&!Aie(i)&&(o[YT]=i.title),function TNe(e,t,n,r){const i=Hj(e);if(0===i.length)return Mr({});const o={};return Is(i).pipe(Xc(s=>function DNe(e,t,n,r){const i=n3(t)??r,o=rw(e,i);return d1(o.resolve?o.resolve(t,n):Hf(i,()=>o(t,n)))}(e[s],t,n,r).pipe(Vx(),Ho(a=>{o[s]=a}))),zj(1),function URe(e){return hn(()=>e)}(o),YC(s=>Rie(s)?Mh:lR(s)))}(o,e,t,r).pipe(hn(s=>(e._resolvedData=s,e.data=Jj(e,e.parent,n).resolve,null)))}(l,r,e,t):(l.data=Jj(l,l.parent,e).resolve,Mr(void 0))),Ho(()=>a++),zj(1),Xc(l=>a===s.size?Mr(n):Mh))})}(this.paramsInheritanceStrategy,this.environmentInjector),Ho({next:()=>u=!0,complete:()=>{u||this.cancelNavigationTransition(c,"",df.NoDataFromResolver)}}))}),Ho(c=>{const u=new v5e(c.id,this.urlSerializer.serialize(c.extractedUrl),this.urlSerializer.serialize(c.urlAfterRedirects),c.targetSnapshot);this.events.next(u)}))}),uU(l=>{const c=u=>{const d=[];u.routeConfig?.loadComponent&&!u.routeConfig._loadedComponent&&d.push(this.configLoader.loadComponent(u.routeConfig).pipe(Ho(f=>{u.component=f}),hn(()=>{})));for(const f of u.children)d.push(...c(f));return d};return Lj(c(l.targetSnapshot.root)).pipe(cR(null),zx(1))}),uU(()=>this.afterPreactivation()),ba(()=>{const{currentSnapshot:l,targetSnapshot:c}=o,u=this.createViewTransition?.(this.environmentInjector,l.root,c.root);return u?Is(u).pipe(hn(()=>o)):Mr(o)}),hn(l=>{const c=function D5e(e,t,n){const r=t3(e,t._root,n?n._root:void 0);return new _ie(r,t)}(n.routeReuseStrategy,l.targetSnapshot,l.currentRouterState);return this.currentTransition=o={...l,targetRouterState:c},this.currentNavigation.targetRouterState=c,o}),Ho(()=>{this.events.next(new Xj)}),((e,t,n,r)=>hn(i=>(new j5e(t,i.targetRouterState,i.currentRouterState,n,r).activate(e),i)))(this.rootContexts,n.routeReuseStrategy,l=>this.events.next(l),this.inputBindingEnabled),zx(1),Ho({next:l=>{s=!0,this.lastSuccessfulNavigation=this.currentNavigation,this.events.next(new U0(l.id,this.urlSerializer.serialize(l.extractedUrl),this.urlSerializer.serialize(l.urlAfterRedirects))),this.titleStrategy?.updateTitle(l.targetRouterState.snapshot),l.resolve(!0)},complete:()=>{s=!0}}),function zRe(e){return is((t,n)=>{vd(e).subscribe(Xo(n,()=>n.complete(),kv)),!n.closed&&t.subscribe(n)})}(this.transitionAbortSubject.pipe(Ho(l=>{throw l}))),Vj(()=>{!s&&!a&&this.cancelNavigationTransition(o,"",df.SupersededByNewNavigation),this.currentTransition?.id===o.id&&(this.currentNavigation=null,this.currentTransition=null)}),YC(l=>{if(a=!0,Pie(l))this.events.next(new JC(o.id,this.urlSerializer.serialize(o.extractedUrl),l.message,l.cancellationCode)),function M5e(e){return Pie(e)&&QC(e.url)}(l)?this.events.next(new Kj(l.url)):o.resolve(!1);else{this.events.next(new bR(o.id,this.urlSerializer.serialize(o.extractedUrl),l,o.targetSnapshot??void 0));try{o.resolve(n.errorHandler(l))}catch(c){this.options.resolveNavigationPromiseOnError?o.resolve(!1):o.reject(c)}}return Mh}))}))}cancelNavigationTransition(n,r,i){const o=new JC(n.id,this.urlSerializer.serialize(n.extractedUrl),r,i);this.events.next(o),n.resolve(!1)}isUpdatingInternalState(){return this.currentTransition?.extractedUrl.toString()!==this.currentTransition?.currentUrlTree.toString()}isUpdatedBrowserUrl(){return this.urlHandlingStrategy.extract(this.urlSerializer.parse(this.location.path(!0))).toString()!==this.currentTransition?.extractedUrl.toString()&&!this.currentTransition?.extras.skipLocationChange}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function ONe(e){return e!==JT}let BNe=(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:()=>qt(jNe),providedIn:"root"})}return e})();class LNe{shouldDetach(t){return!1}store(t,n){}shouldAttach(t){return!1}retrieve(t){return null}shouldReuseRoute(t,n){return t.routeConfig===n.routeConfig}}let jNe=(()=>{class e extends LNe{static#e=this.\u0275fac=(()=>{let n;return function(i){return(n||(n=Wb(e)))(i||e)}})();static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})(),Vie=(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:()=>qt(UNe),providedIn:"root"})}return e})(),UNe=(()=>{class e extends Vie{constructor(){super(...arguments),this.location=qt(qC),this.urlSerializer=qt(ZC),this.options=qt(sw,{optional:!0})||{},this.canceledNavigationResolution=this.options.canceledNavigationResolution||"replace",this.urlHandlingStrategy=qt(fU),this.urlUpdateStrategy=this.options.urlUpdateStrategy||"deferred",this.currentUrlTree=new KC,this.rawUrlTree=this.currentUrlTree,this.currentPageId=0,this.lastSuccessfulId=-1,this.routerState=Sie(null),this.stateMemento=this.createStateMemento()}getCurrentUrlTree(){return this.currentUrlTree}getRawUrlTree(){return this.rawUrlTree}restoredState(){return this.location.getState()}get browserPageId(){return"computed"!==this.canceledNavigationResolution?this.currentPageId:this.restoredState()?.\u0275routerPageId??this.currentPageId}getRouterState(){return this.routerState}createStateMemento(){return{rawUrlTree:this.rawUrlTree,currentUrlTree:this.currentUrlTree,routerState:this.routerState}}registerNonRouterCurrentEntryChangeListener(n){return this.location.subscribe(r=>{"popstate"===r.type&&n(r.url,r.state)})}handleRouterEvent(n,r){if(n instanceof gR)this.stateMemento=this.createStateMemento();else if(n instanceof ew)this.rawUrlTree=r.initialUrl;else if(n instanceof bie){if("eager"===this.urlUpdateStrategy&&!r.extras.skipLocationChange){const i=this.urlHandlingStrategy.merge(r.finalUrl,r.initialUrl);this.setBrowserUrl(i,r)}}else n instanceof Xj?(this.currentUrlTree=r.finalUrl,this.rawUrlTree=this.urlHandlingStrategy.merge(r.finalUrl,r.initialUrl),this.routerState=r.targetRouterState,"deferred"===this.urlUpdateStrategy&&(r.extras.skipLocationChange||this.setBrowserUrl(this.rawUrlTree,r))):n instanceof JC&&(n.code===df.GuardRejected||n.code===df.NoDataFromResolver)?this.restoreHistory(r):n instanceof bR?this.restoreHistory(r,!0):n instanceof U0&&(this.lastSuccessfulId=n.id,this.currentPageId=this.browserPageId)}setBrowserUrl(n,r){const i=this.urlSerializer.serialize(n);if(this.location.isCurrentPathEqualTo(i)||r.extras.replaceUrl){const s={...r.extras.state,...this.generateNgRouterState(r.id,this.browserPageId)};this.location.replaceState(i,"",s)}else{const o={...r.extras.state,...this.generateNgRouterState(r.id,this.browserPageId+1)};this.location.go(i,"",o)}}restoreHistory(n,r=!1){if("computed"===this.canceledNavigationResolution){const o=this.currentPageId-this.browserPageId;0!==o?this.location.historyGo(o):this.currentUrlTree===n.finalUrl&&0===o&&(this.resetState(n),this.resetUrlToCurrentUrlTree())}else"replace"===this.canceledNavigationResolution&&(r&&this.resetState(n),this.resetUrlToCurrentUrlTree())}resetState(n){this.routerState=this.stateMemento.routerState,this.currentUrlTree=this.stateMemento.currentUrlTree,this.rawUrlTree=this.urlHandlingStrategy.merge(this.currentUrlTree,n.finalUrl??this.rawUrlTree)}resetUrlToCurrentUrlTree(){this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree),"",this.generateNgRouterState(this.lastSuccessfulId,this.currentPageId))}generateNgRouterState(n,r){return"computed"===this.canceledNavigationResolution?{navigationId:n,\u0275routerPageId:r}:{navigationId:n}}static#e=this.\u0275fac=(()=>{let n;return function(i){return(n||(n=Wb(e)))(i||e)}})();static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var s3=function(e){return e[e.COMPLETE=0]="COMPLETE",e[e.FAILED=1]="FAILED",e[e.REDIRECTING=2]="REDIRECTING",e}(s3||{});function Hie(e,t){e.events.pipe(xd(n=>n instanceof U0||n instanceof JC||n instanceof bR||n instanceof ew),hn(n=>n instanceof U0||n instanceof ew?s3.COMPLETE:n instanceof JC&&(n.code===df.Redirect||n.code===df.SupersededByNewNavigation)?s3.REDIRECTING:s3.FAILED),xd(n=>n!==s3.REDIRECTING),zx(1)).subscribe(()=>{t()})}function zNe(e){throw e}const VNe={paths:"exact",fragment:"ignored",matrixParams:"ignored",queryParams:"exact"},HNe={paths:"subset",fragment:"ignored",matrixParams:"ignored",queryParams:"subset"};let Nh=(()=>{class e{get currentUrlTree(){return this.stateManager.getCurrentUrlTree()}get rawUrlTree(){return this.stateManager.getRawUrlTree()}get events(){return this._events}get routerState(){return this.stateManager.getRouterState()}constructor(){this.disposed=!1,this.isNgZoneEnabled=!1,this.console=qt(Vte),this.stateManager=qt(Vie),this.options=qt(sw,{optional:!0})||{},this.pendingTasks=qt(_C),this.urlUpdateStrategy=this.options.urlUpdateStrategy||"deferred",this.navigationTransitions=qt(CR),this.urlSerializer=qt(ZC),this.location=qt(qC),this.urlHandlingStrategy=qt(fU),this._events=new si,this.errorHandler=this.options.errorHandler||zNe,this.navigated=!1,this.routeReuseStrategy=qt(BNe),this.onSameUrlNavigation=this.options.onSameUrlNavigation||"ignore",this.config=qt(aw,{optional:!0})?.flat()??[],this.componentInputBindingEnabled=!!qt(vR,{optional:!0}),this.eventsSubscription=new Il,this.isNgZoneEnabled=qt(To)instanceof To&&To.isInAngularZone(),this.resetConfig(this.config),this.navigationTransitions.setupNavigations(this,this.currentUrlTree,this.routerState).subscribe({error:n=>{this.console.warn(n)}}),this.subscribeToNavigationEvents()}subscribeToNavigationEvents(){const n=this.navigationTransitions.events.subscribe(r=>{try{const i=this.navigationTransitions.currentTransition,o=this.navigationTransitions.currentNavigation;if(null!==i&&null!==o)if(this.stateManager.handleRouterEvent(r,o),r instanceof JC&&r.code!==df.Redirect&&r.code!==df.SupersededByNewNavigation)this.navigated=!0;else if(r instanceof U0)this.navigated=!0;else if(r instanceof Kj){const s=this.urlHandlingStrategy.merge(r.url,i.currentRawUrl),a={info:i.extras.info,skipLocationChange:i.extras.skipLocationChange,replaceUrl:"eager"===this.urlUpdateStrategy||ONe(i.source)};this.scheduleNavigation(s,JT,null,a,{resolve:i.resolve,reject:i.reject,promise:i.promise})}(function qNe(e){return!(e instanceof Xj||e instanceof Kj)})(r)&&this._events.next(r)}catch(i){this.navigationTransitions.transitionAbortSubject.next(i)}});this.eventsSubscription.add(n)}resetRootComponentType(n){this.routerState.root.component=n,this.navigationTransitions.rootComponentType=n}initialNavigation(){this.setUpLocationChangeListener(),this.navigationTransitions.hasRequestedNavigation||this.navigateToSyncWithBrowser(this.location.path(!0),JT,this.stateManager.restoredState())}setUpLocationChangeListener(){this.nonRouterCurrentEntryChangeSubscription??=this.stateManager.registerNonRouterCurrentEntryChangeListener((n,r)=>{setTimeout(()=>{this.navigateToSyncWithBrowser(n,"popstate",r)},0)})}navigateToSyncWithBrowser(n,r,i){const o={replaceUrl:!0},s=i?.navigationId?i:null;if(i){const l={...i};delete l.navigationId,delete l.\u0275routerPageId,0!==Object.keys(l).length&&(o.state=l)}const a=this.parseUrl(n);this.scheduleNavigation(a,r,s,o)}get url(){return this.serializeUrl(this.currentUrlTree)}getCurrentNavigation(){return this.navigationTransitions.currentNavigation}get lastSuccessfulNavigation(){return this.navigationTransitions.lastSuccessfulNavigation}resetConfig(n){this.config=n.map(oU),this.navigated=!1}ngOnDestroy(){this.dispose()}dispose(){this.navigationTransitions.complete(),this.nonRouterCurrentEntryChangeSubscription&&(this.nonRouterCurrentEntryChangeSubscription.unsubscribe(),this.nonRouterCurrentEntryChangeSubscription=void 0),this.disposed=!0,this.eventsSubscription.unsubscribe()}createUrlTree(n,r={}){const{relativeTo:i,queryParams:o,fragment:s,queryParamsHandling:a,preserveFragment:l}=r,c=l?this.currentUrlTree.fragment:s;let d,u=null;switch(a){case"merge":u={...this.currentUrlTree.queryParams,...o};break;case"preserve":u=this.currentUrlTree.queryParams;break;default:u=o||null}null!==u&&(u=this.removeEmptyProps(u));try{d=die(i?i.snapshot:this.routerState.snapshot.root)}catch{("string"!=typeof n[0]||!n[0].startsWith("/"))&&(n=[]),d=this.currentUrlTree.root}return fie(d,n,u,c??null)}navigateByUrl(n,r={skipLocationChange:!1}){const i=QC(n)?n:this.parseUrl(n),o=this.urlHandlingStrategy.merge(i,this.rawUrlTree);return this.scheduleNavigation(o,JT,null,r)}navigate(n,r={skipLocationChange:!1}){return function GNe(e){for(let t=0;t(null!=o&&(r[i]=o),r),{})}scheduleNavigation(n,r,i,o,s){if(this.disposed)return Promise.resolve(!1);let a,l,c;s?(a=s.resolve,l=s.reject,c=s.promise):c=new Promise((d,f)=>{a=d,l=f});const u=this.pendingTasks.add();return Hie(this,()=>{queueMicrotask(()=>this.pendingTasks.remove(u))}),this.navigationTransitions.handleNavigationRequest({source:r,restoredState:i,currentUrlTree:this.currentUrlTree,currentRawUrl:this.currentUrlTree,rawUrl:n,extras:o,resolve:a,reject:l,promise:c,currentSnapshot:this.routerState.snapshot,currentRouterState:this.routerState}),c.catch(d=>Promise.reject(d))}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})(),wR=(()=>{class e{constructor(n,r,i,o,s,a){this.router=n,this.route=r,this.tabIndexAttribute=i,this.renderer=o,this.el=s,this.locationStrategy=a,this.href=null,this.commands=null,this.onChanges=new si,this.preserveFragment=!1,this.skipLocationChange=!1,this.replaceUrl=!1;const l=s.nativeElement.tagName?.toLowerCase();this.isAnchorElement="a"===l||"area"===l,this.isAnchorElement?this.subscription=n.events.subscribe(c=>{c instanceof U0&&this.updateHref()}):this.setTabIndexIfNotOnNativeEl("0")}setTabIndexIfNotOnNativeEl(n){null!=this.tabIndexAttribute||this.isAnchorElement||this.applyAttributeValue("tabindex",n)}ngOnChanges(n){this.isAnchorElement&&this.updateHref(),this.onChanges.next(this)}set routerLink(n){null!=n?(this.commands=Array.isArray(n)?n:[n],this.setTabIndexIfNotOnNativeEl("0")):(this.commands=null,this.setTabIndexIfNotOnNativeEl(null))}onClick(n,r,i,o,s){const a=this.urlTree;return!!(null===a||this.isAnchorElement&&(0!==n||r||i||o||s||"string"==typeof this.target&&"_self"!=this.target))||(this.router.navigateByUrl(a,{skipLocationChange:this.skipLocationChange,replaceUrl:this.replaceUrl,state:this.state,info:this.info}),!this.isAnchorElement)}ngOnDestroy(){this.subscription?.unsubscribe()}updateHref(){const n=this.urlTree;this.href=null!==n&&this.locationStrategy?this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(n)):null;const r=null===this.href?null:function _Z(e,t,n){return function iwe(e,t){return"src"===t&&("embed"===e||"frame"===e||"iframe"===e||"media"===e||"script"===e)||"href"===t&&("base"===e||"link"===e)?xZ:vZ}(t,n)(e)}(this.href,this.el.nativeElement.tagName.toLowerCase(),"href");this.applyAttributeValue("href",r)}applyAttributeValue(n,r){const i=this.renderer,o=this.el.nativeElement;null!==r?i.setAttribute(o,n,r):i.removeAttribute(o,n)}get urlTree(){return null===this.commands?null:this.router.createUrlTree(this.commands,{relativeTo:void 0!==this.relativeTo?this.relativeTo:this.route,queryParams:this.queryParams,fragment:this.fragment,queryParamsHandling:this.queryParamsHandling,preserveFragment:this.preserveFragment})}static#e=this.\u0275fac=function(r){return new(r||e)(On(Nh),On(nw),function Vm(e){return function ja(e,t){if("class"===t)return e.classes;if("style"===t)return e.styles;const n=e.attrs;if(n){const r=n.length;let i=0;for(;i{class e{constructor(n,r,i,o,s){this.router=n,this.injector=i,this.preloadingStrategy=o,this.loader=s}setUpPreloading(){this.subscription=this.router.events.pipe(xd(n=>n instanceof U0),$T(()=>this.preload())).subscribe(()=>{})}preload(){return this.processRoutes(this.injector,this.router.config)}ngOnDestroy(){this.subscription&&this.subscription.unsubscribe()}processRoutes(n,r){const i=[];for(const o of r){o.providers&&!o._injector&&(o._injector=f4(o.providers,n,`Route: ${o.path}`));const s=o._injector??n,a=o._loadedInjector??s;(o.loadChildren&&!o._loadedRoutes&&void 0===o.canLoad||o.loadComponent&&!o._loadedComponent)&&i.push(this.preloadConfig(s,o)),(o.children||o._loadedRoutes)&&i.push(this.processRoutes(a,o.children??o._loadedRoutes))}return Is(i).pipe(Ux())}preloadConfig(n,r){return this.preloadingStrategy.preload(r,()=>{let i;i=r.loadChildren&&void 0===r.canLoad?this.loader.loadChildren(n,r):Mr(null);const o=i.pipe(Xc(s=>null===s?Mr(void 0):(r._loadedRoutes=s.routes,r._loadedInjector=s.injector,this.processRoutes(s.injector??n,s.routes))));return r.loadComponent&&!r._loadedComponent?Is([o,this.loader.loadComponent(r)]).pipe(Ux()):o})}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(Nh),Rn(Qte),Rn(Na),Rn(Gie),Rn(dU))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();const pU=new jn("");let qie=(()=>{class e{constructor(n,r,i,o,s={}){this.urlSerializer=n,this.transitions=r,this.viewportScroller=i,this.zone=o,this.options=s,this.lastId=0,this.lastSource="imperative",this.restoredId=0,this.store={},s.scrollPositionRestoration||="disabled",s.anchorScrolling||="disabled"}init(){"disabled"!==this.options.scrollPositionRestoration&&this.viewportScroller.setHistoryScrollRestoration("manual"),this.routerEventsSubscription=this.createScrollEvents(),this.scrollEventsSubscription=this.consumeScrollEvents()}createScrollEvents(){return this.transitions.events.subscribe(n=>{n instanceof gR?(this.store[this.lastId]=this.viewportScroller.getScrollPosition(),this.lastSource=n.navigationTrigger,this.restoredId=n.restoredState?n.restoredState.navigationId:0):n instanceof U0?(this.lastId=n.id,this.scheduleScrollEvent(n,this.urlSerializer.parse(n.urlAfterRedirects).fragment)):n instanceof ew&&n.code===yR.IgnoredSameUrlNavigation&&(this.lastSource=void 0,this.restoredId=0,this.scheduleScrollEvent(n,this.urlSerializer.parse(n.url).fragment))})}consumeScrollEvents(){return this.transitions.events.subscribe(n=>{n instanceof vie&&(n.position?"top"===this.options.scrollPositionRestoration?this.viewportScroller.scrollToPosition([0,0]):"enabled"===this.options.scrollPositionRestoration&&this.viewportScroller.scrollToPosition(n.position):n.anchor&&"enabled"===this.options.anchorScrolling?this.viewportScroller.scrollToAnchor(n.anchor):"disabled"!==this.options.scrollPositionRestoration&&this.viewportScroller.scrollToPosition([0,0]))})}scheduleScrollEvent(n,r){this.zone.runOutsideAngular(()=>{setTimeout(()=>{this.zone.run(()=>{this.transitions.events.next(new vie(n,"popstate"===this.lastSource?this.store[this.restoredId]:null,r))})},0)})}ngOnDestroy(){this.routerEventsSubscription?.unsubscribe(),this.scrollEventsSubscription?.unsubscribe()}static#e=this.\u0275fac=function(r){!function WZ(){throw new Error("invalid")}()};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac})}return e})();function Wie(e){return e.routerState.root}function eg(e,t){return{\u0275kind:e,\u0275providers:t}}function $ie(){const e=qt(Jl);return t=>{const n=e.get(l1);if(t!==n.components[0])return;const r=e.get(Nh),i=e.get(Yie);1===e.get(hU)&&r.initialNavigation(),e.get(Xie,null,gi.Optional)?.setUpPreloading(),e.get(pU,null,gi.Optional)?.init(),r.resetRootComponentType(n.componentTypes[0]),i.closed||(i.next(),i.complete(),i.unsubscribe())}}const Yie=new jn("",{factory:()=>new si}),hU=new jn("",{providedIn:"root",factory:()=>1}),Xie=new jn("");function JNe(e){return eg(0,[{provide:Xie,useExisting:YNe},{provide:Gie,useExisting:e}])}function tFe(e){return eg(9,[{provide:Uie,useValue:NNe},{provide:zie,useValue:{skipNextTransition:!!e?.skipInitialTransition,...e}}])}const Kie=new jn("ROUTER_FORROOT_GUARD"),nFe=[qC,{provide:ZC,useClass:Gj},Nh,e3,{provide:nw,useFactory:Wie,deps:[Nh]},dU,[]];let mU=(()=>{class e{constructor(n){}static forRoot(n,r){return{ngModule:e,providers:[nFe,[],{provide:aw,multi:!0,useValue:n},{provide:Kie,useFactory:sFe,deps:[[Nh,new $v,new fS]]},{provide:sw,useValue:r||{}},r?.useHash?{provide:jx,useClass:mke}:{provide:jx,useClass:zne},{provide:pU,useFactory:()=>{const e=qt(BMe),t=qt(To),n=qt(sw),r=qt(CR),i=qt(ZC);return n.scrollOffset&&e.setOffset(n.scrollOffset),new qie(i,r,e,t,n)}},r?.preloadingStrategy?JNe(r.preloadingStrategy).\u0275providers:[],r?.initialNavigation?aFe(r):[],r?.bindToComponentInputs?eg(8,[Iie,{provide:vR,useExisting:Iie}]).\u0275providers:[],r?.enableViewTransitions?tFe().\u0275providers:[],[{provide:Zie,useFactory:$ie},{provide:F4,multi:!0,useExisting:Zie}]]}}static forChild(n){return{ngModule:e,providers:[{provide:aw,multi:!0,useValue:n}]}}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(Kie,8))};static#t=this.\u0275mod=g0({type:e});static#n=this.\u0275inj=c0({})}return e})();function sFe(e){return"guarded"}function aFe(e){return["disabled"===e.initialNavigation?eg(3,[{provide:Y8,multi:!0,useFactory:()=>{const t=qt(Nh);return()=>{t.setUpLocationChangeListener()}}},{provide:hU,useValue:2}]).\u0275providers:[],"enabledBlocking"===e.initialNavigation?eg(2,[{provide:hU,useValue:0},{provide:Y8,multi:!0,deps:[Jl],useFactory:t=>{const n=t.get(pke,Promise.resolve());return()=>n.then(()=>new Promise(r=>{const i=t.get(Nh),o=t.get(Yie);Hie(i,()=>{r(!0)}),t.get(CR).afterPreactivation=()=>(r(!0),o.closed?Mr(void 0):o),i.initialNavigation()}))}}]).\u0275providers:[]]}const Zie=new jn(""),gU={now:()=>(gU.delegate||Date).now(),delegate:void 0};class Fh extends si{constructor(t=1/0,n=1/0,r=gU){super(),this._bufferSize=t,this._windowTime=n,this._timestampProvider=r,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=n===1/0,this._bufferSize=Math.max(1,t),this._windowTime=Math.max(1,n)}next(t){const{isStopped:n,_buffer:r,_infiniteTimeWindow:i,_timestampProvider:o,_windowTime:s}=this;n||(r.push(t),!i&&r.push(o.now()+s)),this._trimBuffer(),super.next(t)}_subscribe(t){this._throwIfClosed(),this._trimBuffer();const n=this._innerSubscribe(t),{_infiniteTimeWindow:r,_buffer:i}=this,o=i.slice();for(let s=0;s{r.unsubscribe(),e()}});return vd(t(...n)).subscribe(r)}function ff(e,t,n){let r,i=!1;return e&&"object"==typeof e?({bufferSize:r=1/0,windowTime:t=1/0,refCount:i=!1,scheduler:n}=e):r=e??1/0,function uFe(e={}){const{connector:t=(()=>new si),resetOnError:n=!0,resetOnComplete:r=!0,resetOnRefCountZero:i=!0}=e;return o=>{let s,a,l,c=0,u=!1,d=!1;const f=()=>{a?.unsubscribe(),a=void 0},p=()=>{f(),s=l=void 0,u=d=!1},m=()=>{const h=s;p(),h?.unsubscribe()};return is((h,g)=>{c++,!d&&!u&&f();const y=l=l??t();g.add(()=>{c--,0===c&&!d&&!u&&(a=yU(m,i))}),y.subscribe(g),!s&&c>0&&(s=new Mv({next:v=>y.next(v),error:v=>{d=!0,f(),a=yU(p,n,v),y.error(v)},complete:()=>{u=!0,f(),a=yU(p,r),y.complete()}}),vd(h).subscribe(s))})(o)}}({connector:()=>new Fh(r,t,n),resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:i})}const{isArray:dFe}=Array;function Qie(e){return 1===e.length&&dFe(e[0])?e[0]:e}function Jie(...e){const t=Bj(e);return t?YI(Jie(...e),$re(t)):is((n,r)=>{Yre([n,...Qie(e)])(r)})}function z0(...e){return Jie(...e)}var Mc,e,ci;(e=Mc||(Mc={})).create=function t(i){return i},e.has=function n(i,o){return!!(i&o)},e.hasAll=function r(i,o){return!!o&&(i&o)===o},function(e){e.create=function t(_=512){return{current:[],offset:0,capacity:_,chunks:[]}},e.getString=function n(_){return _.chunks.length?(_.offset>0&&(_.chunks[_.chunks.length]=_.current.length===_.offset?_.current.join(""):_.current.slice(0,_.offset).join("")),_.chunks.join("")):_.current.length===_.offset?_.current.join(""):_.current.splice(0,_.offset).join("")},e.getSize=function r(_){let w=0;for(const A of _.chunks)w+=A.length;for(let A=0;A<_.offset;A++)w+=_.current[A].length;return w},e.getChunks=function i(_){return _.offset>0&&(_.chunks[_.chunks.length]=_.current.length===_.offset?_.current.join(""):_.current.slice(0,_.offset).join(""),_.offset=0),_.chunks};const o=[];function a(_,w){w>0&&u(_,o[w])}function u(_,w){_.offset===_.capacity&&(_.chunks[_.chunks.length]=_.current.join(""),_.offset=0),_.current[_.offset++]=w}!function(){let _="";for(let w=0;w<512;w++)o[w]=_,_+=" "}(),e.newline=function s(_){u(_,"\n")},e.whitespace=a,e.whitespace1=function l(_){u(_," ")},e.write=function c(_,w){w&&(_.offset===_.capacity&&(_.chunks[_.chunks.length]=_.current.join(""),_.offset=0),_.current[_.offset++]=w)},e.writeSafe=u,e.writePadLeft=function d(_,w,A){w?(a(_,A-w.length),u(_,w)):a(_,A)},e.writePadRight=function f(_,w,A){if(!w)return void a(_,A);const M=A-w.length;u(_,w),a(_,M)},e.writeInteger=function p(_,w){u(_,""+w)},e.writeIntegerAndSpace=function m(_,w){u(_,w+" ")},e.writeIntegerPadLeft=function h(_,w,A){const M=""+w;a(_,A-M.length),u(_,M)},e.writeIntegerPadRight=function g(_,w,A){const M=""+w,E=A-M.length;u(_,M),a(_,E)},e.writeFloat=function y(_,w,A){u(_,""+Math.round(A*w)/A)},e.writeFloatPadLeft=function v(_,w,A,M){const E=""+Math.round(A*w)/A;a(_,M-E.length),u(_,E)},e.writeFloatPadRight=function x(_,w,A,M){const E=""+Math.round(A*w)/A,D=M-E.length;u(_,E),a(_,D)}}(ci||(ci={}));const Bo=function(){if(typeof window<"u"&&window.performance){const e=window.performance;return()=>e.now()}return typeof process<"u"&&"undefined"!==process.hrtime&&"function"==typeof process.hrtime?()=>{const e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:Date.now?()=>Date.now():()=>+new Date}();function AR(e,t=!0){if(isNaN(e))return"n/a";const n=Math.floor(e/36e5),r=Math.floor(e/6e4%60),i=Math.floor(e/1e3%60);let o=Math.floor(e%1e3).toString();for(;o.length<3;)o="0"+o;for(;!t&&o.length>1&&"0"===o[o.length-1];)o=o.substr(0,o.length-1);return n>0?`${n}h${r}m${i}.${o}s`:r>0?`${r}m${i}.${o}s`:i>0?`${i}.${o}s`:`${e.toFixed(0)}ms`}var oo,eoe,a3;function fFe(e,t){return e-t}function Kc(e=0,t=Number.MAX_SAFE_INTEGER){let n=e;return()=>{const r=n;return n=(n+1)%t,r}}!function(e){const t=typeof btoa<"u"?btoa:s=>Buffer.from(s).toString("base64"),n=[];e.create22=function r(){let s=+new Date+Bo();for(let a=0;a<16;a++)n[a]=String.fromCharCode((s+255*Math.random())%255|0),s=Math.floor(s/255);return t(n.join("")).replace(/\+/g,"-").replace(/\//g,"_").substr(0,22)},e.createv4=function i(){let s=+new Date+Bo();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(l){const c=(s+16*Math.random())%16|0;return s=Math.floor(s/16),("x"===l?c:3&c|8).toString(16)})},e.is=function o(s){return"string"==typeof s}}(oo||(oo={})),function(e){class t{has(m){return!1}forEach(m,h){return h}constructor(){this.size=0}}class n{has(m){return m===this.idx}forEach(m,h){return m(this.idx,h),h}constructor(m){this.idx=m,this.size=1}}class r{has(m){return mm[h++]=g),function pFe(e){Array.prototype.sort.call(e,fFe)}(m),this._flat=m,this._flat}forEach(m,h){return this._forEach(m,h),h}constructor(m){this.set=m,this._flat=void 0,this.size=m.size}}function a(p){return new o(p)}function u(p,m){return new r(p,m)}e.always=function s(p){return new i(p)},e.never=new t,e.ofSet=a,e.singleton=function l(p){return new n(p)},e.ofUniqueIndices=function c(p){const m=p.length;if(0===m)return new t;if(1===m)return new n(p[0]);let h=0;for(const v of p)v>h&&(h=v);if(m===h)return new i(m);if(m/h<1/12){const v=new Set;for(const x of p)v.add(x);return new o(v)}const y=new Int8Array(h+1);for(const v of p)y[v]=1;return new r(y,p.length)},e.ofMask=u,e.hasAny=function d(p,m){for(const h of m)if(p.has(h))return!0;return!1},e.complement=function f(p,m){let h=0,g=0;if(m.forEach(y=>{p.has(y)||(h++,y>g&&(g=y))}),h/g<1/12){const y=new Set;return m.forEach(v=>{p.has(v)||y.add(v)}),a(y)}{const y=new Uint8Array(g+1);return m.forEach(v=>{p.has(v)||(y[v]=1)}),u(y,h)}}}(eoe||(eoe={})),function(e){e.create=function t(r){return{ref:r}},e.set=function n(r,i){return r.ref=i,r}}(a3||(a3={}));const hFe=Kc(0,2147483647);var f1,O;!function(e){e.create=function t(r,i){return{id:hFe(),version:0,value:r,metadata:i}},e.withValue=function n(r,i){return{id:r.id,version:r.version+1,value:i,metadata:r.metadata}}}(f1||(f1={})),function(e){function n(o,s){return a3.set(o,f1.withValue(o.ref,s))}e.create=function t(o,s){return a3.create(f1.create(o,s))},e.update=n,e.set=function r(o,s){return a3.set(o,s)},e.updateIfChanged=function i(o,s){return o.ref.value!==s?n(o,s):o}}(O||(O={}));const rp=function(){};function Ru(e,t){const n=e.length;if(n!==t.length)return!1;for(let r=0;r0&&(Vt=1/Math.sqrt(Vt),ye[0]=we[0]*Vt,ye[1]=we[1]*Vt,ye[2]=we[2]*Vt),ye}function K(ye,we){return ye[0]*we[0]+ye[1]*we[1]+ye[2]*we[2]}function Q(ye,we,Te){const je=we[0],Ft=we[1],Vt=we[2],pn=Te[0],Pr=Te[1],Jn=Te[2];return ye[0]=Ft*Jn-Vt*Pr,ye[1]=Vt*pn-je*Jn,ye[2]=je*Pr-Ft*pn,ye}e.zero=t,e.clone=function n(ye){const we=t();return we[0]=ye[0],we[1]=ye[1],we[2]=ye[2],we},e.isFinite=function r(ye){return SU(ye[0])&&SU(ye[1])&&SU(ye[2])},e.hasNaN=function i(ye){return isNaN(ye[0])||isNaN(ye[1])||isNaN(ye[2])},e.setNaN=function o(ye){return ye[0]=NaN,ye[1]=NaN,ye[2]=NaN,ye},e.fromObj=function s(ye){return u(ye.x,ye.y,ye.z)},e.toObj=function a(ye){return{x:ye[0],y:ye[1],z:ye[2]}},e.fromArray=function l(ye,we,Te){return ye[0]=we[Te+0],ye[1]=we[Te+1],ye[2]=we[Te+2],ye},e.toArray=function c(ye,we,Te){return we[Te+0]=ye[0],we[Te+1]=ye[1],we[Te+2]=ye[2],we},e.create=u,e.ofArray=function d(ye){const we=t();return we[0]=ye[0],we[1]=ye[1],we[2]=ye[2],we},e.set=function f(ye,we,Te,je){return ye[0]=we,ye[1]=Te,ye[2]=je,ye},e.copy=p,e.add=m,e.sub=h,e.mul=function g(ye,we,Te){return ye[0]=we[0]*Te[0],ye[1]=we[1]*Te[1],ye[2]=we[2]*Te[2],ye},e.div=function y(ye,we,Te){return ye[0]=we[0]/Te[0],ye[1]=we[1]/Te[1],ye[2]=we[2]/Te[2],ye},e.scale=v,e.scaleAndAdd=x,e.scaleAndSub=function _(ye,we,Te,je){return ye[0]=we[0]-Te[0]*je,ye[1]=we[1]-Te[1]*je,ye[2]=we[2]-Te[2]*je,ye},e.addScalar=function w(ye,we,Te){return ye[0]=we[0]+Te,ye[1]=we[1]+Te,ye[2]=we[2]+Te,ye},e.subScalar=function A(ye,we,Te){return ye[0]=we[0]-Te,ye[1]=we[1]-Te,ye[2]=we[2]-Te,ye},e.round=function M(ye,we){return ye[0]=Math.round(we[0]),ye[1]=Math.round(we[1]),ye[2]=Math.round(we[2]),ye},e.ceil=function E(ye,we){return ye[0]=Math.ceil(we[0]),ye[1]=Math.ceil(we[1]),ye[2]=Math.ceil(we[2]),ye},e.floor=function D(ye,we){return ye[0]=Math.floor(we[0]),ye[1]=Math.floor(we[1]),ye[2]=Math.floor(we[2]),ye},e.trunc=function T(ye,we){return ye[0]=Math.trunc(we[0]),ye[1]=Math.trunc(we[1]),ye[2]=Math.trunc(we[2]),ye},e.abs=function F(ye,we){return ye[0]=Math.abs(we[0]),ye[1]=Math.abs(we[1]),ye[2]=Math.abs(we[2]),ye},e.min=function R(ye,we,Te){return ye[0]=Math.min(we[0],Te[0]),ye[1]=Math.min(we[1],Te[1]),ye[2]=Math.min(we[2],Te[2]),ye},e.max=function N(ye,we,Te){return ye[0]=Math.max(we[0],Te[0]),ye[1]=Math.max(we[1],Te[1]),ye[2]=Math.max(we[2],Te[2]),ye},e.clamp=function j(ye,we,Te,je){return ye[0]=Math.max(Te[0],Math.min(je[0],we[0])),ye[1]=Math.max(Te[1],Math.min(je[1],we[1])),ye[2]=Math.max(Te[2],Math.min(je[2],we[2])),ye},e.distance=function W(ye,we){const Te=we[0]-ye[0],je=we[1]-ye[1],Ft=we[2]-ye[2];return Math.sqrt(Te*Te+je*je+Ft*Ft)},e.squaredDistance=function z(ye,we){const Te=we[0]-ye[0],je=we[1]-ye[1],Ft=we[2]-ye[2];return Te*Te+je*je+Ft*Ft},e.magnitude=function $(ye){const we=ye[0],Te=ye[1],je=ye[2];return Math.sqrt(we*we+Te*Te+je*je)},e.squaredMagnitude=V,e.setMagnitude=function X(ye,we,Te){return v(ye,te(ye,we),Te)},e.negate=H,e.inverse=function oe(ye,we){return ye[0]=1/we[0],ye[1]=1/we[1],ye[2]=1/we[2],ye},e.normalize=te,e.dot=K,e.cross=Q,e.lerp=function G(ye,we,Te,je){const Ft=we[0],Vt=we[1],pn=we[2];return ye[0]=Ft+je*(Te[0]-Ft),ye[1]=Vt+je*(Te[1]-Vt),ye[2]=pn+je*(Te[2]-pn),ye};const Z=t();function ue(ye,we){const Te=Math.sqrt(V(ye)*V(we));if(0===Te)return Math.PI/2;const je=K(ye,we)/Te;return Math.acos(al(je,-1,1))}e.slerp=function ee(ye,we,Te,je){const Ft=al(K(we,Te),-1,1),Vt=Math.acos(Ft)*je;return x(Z,Te,we,-Ft),te(Z,Z),m(ye,v(ye,we,Math.cos(Vt)),v(Z,Z,Math.sin(Vt)))},e.hermite=function se(ye,we,Te,je,Ft,Vt){const pn=Vt*Vt,Pr=pn*(2*Vt-3)+1,Jn=pn*(Vt-2)+Vt,bi=pn*(Vt-1),ns=pn*(3-2*Vt);return ye[0]=we[0]*Pr+Te[0]*Jn+je[0]*bi+Ft[0]*ns,ye[1]=we[1]*Pr+Te[1]*Jn+je[1]*bi+Ft[1]*ns,ye[2]=we[2]*Pr+Te[2]*Jn+je[2]*bi+Ft[2]*ns,ye},e.bezier=function xe(ye,we,Te,je,Ft,Vt){const pn=1-Vt,Pr=pn*pn,Jn=Vt*Vt,bi=Pr*pn,ns=3*Vt*Pr,_c=3*Jn*pn,Js=Jn*Vt;return ye[0]=we[0]*bi+Te[0]*ns+je[0]*_c+Ft[0]*Js,ye[1]=we[1]*bi+Te[1]*ns+je[1]*_c+Ft[1]*Js,ye[2]=we[2]*bi+Te[2]*ns+je[2]*_c+Ft[2]*Js,ye},e.quadraticBezier=function re(ye,we,Te,je,Ft){return ye[0]=_U(we[0],Te[0],je[0],Ft),ye[1]=_U(we[1],Te[1],je[1],Ft),ye[2]=_U(we[2],Te[2],je[2],Ft),ye},e.spline=function ae(ye,we,Te,je,Ft,Vt,pn){return ye[0]=TR(we[0],Te[0],je[0],Ft[0],Vt,pn),ye[1]=TR(we[1],Te[1],je[1],Ft[1],Vt,pn),ye[2]=TR(we[2],Te[2],je[2],Ft[2],Vt,pn),ye},e.random=function ge(ye,we){const Te=2*Math.random()*Math.PI,je=2*Math.random()-1,Ft=Math.sqrt(1-je*je)*we;return ye[0]=Math.cos(Te)*Ft,ye[1]=Math.sin(Te)*Ft,ye[2]=je*we,ye},e.transformMat4=function Ie(ye,we,Te){const je=we[0],Ft=we[1],Vt=we[2],pn=1/(Te[3]*je+Te[7]*Ft+Te[11]*Vt+Te[15]||1);return ye[0]=(Te[0]*je+Te[4]*Ft+Te[8]*Vt+Te[12])*pn,ye[1]=(Te[1]*je+Te[5]*Ft+Te[9]*Vt+Te[13])*pn,ye[2]=(Te[2]*je+Te[6]*Ft+Te[10]*Vt+Te[14])*pn,ye},e.transformDirection=function me(ye,we,Te){const je=we[0],Ft=we[1],Vt=we[2];return ye[0]=Te[0]*je+Te[4]*Ft+Te[8]*Vt,ye[1]=Te[1]*je+Te[5]*Ft+Te[9]*Vt,ye[2]=Te[2]*je+Te[6]*Ft+Te[10]*Vt,te(ye,ye)},e.transformMat4Offset=function Ae(ye,we,Te,je,Ft,Vt){const pn=we[0+Ft],Pr=we[1+Ft],Jn=we[2+Ft],bi=1/(Te[3+Vt]*pn+Te[7+Vt]*Pr+Te[11+Vt]*Jn+Te[15+Vt]||1);return ye[0+je]=(Te[0+Vt]*pn+Te[4+Vt]*Pr+Te[8+Vt]*Jn+Te[12+Vt])*bi,ye[1+je]=(Te[1+Vt]*pn+Te[5+Vt]*Pr+Te[9+Vt]*Jn+Te[13+Vt])*bi,ye[2+je]=(Te[2+Vt]*pn+Te[6+Vt]*Pr+Te[10+Vt]*Jn+Te[14+Vt])*bi,ye},e.transformMat3=function he(ye,we,Te){const je=we[0],Ft=we[1],Vt=we[2];return ye[0]=je*Te[0]+Ft*Te[3]+Vt*Te[6],ye[1]=je*Te[1]+Ft*Te[4]+Vt*Te[7],ye[2]=je*Te[2]+Ft*Te[5]+Vt*Te[8],ye},e.transformQuat=function ie(ye,we,Te){const je=we[0],Ft=we[1],Vt=we[2],pn=Te[0],Pr=Te[1],Jn=Te[2],bi=Te[3],ns=bi*je+Pr*Vt-Jn*Ft,_c=bi*Ft+Jn*je-pn*Vt,Js=bi*Vt+pn*Ft-Pr*je,id=-pn*je-Pr*Ft-Jn*Vt;return ye[0]=ns*bi+id*-pn+_c*-Jn-Js*-Pr,ye[1]=_c*bi+id*-Pr+Js*-pn-ns*-Jn,ye[2]=Js*bi+id*-Jn+ns*-Pr-_c*-pn,ye},e.angle=ue;const _e=t(),Fe=t(),Ze=t(),ct=t(),q=t(),ne=t(),be=t();e.dihedralAngle=function Ce(ye,we,Te,je){h(_e,ye,we),h(Fe,Te,we),h(Ze,we,Te),h(ct,je,Te),Q(q,_e,Fe),Q(ne,Ze,ct);const Ft=ue(q,ne);return Q(be,q,ne),K(Fe,be)>0?Ft:-Ft},e.directionFromSpherical=function Re(ye,we,Te,je){return e.set(ye,je*Math.cos(Te)*Math.sin(we),je*Math.sin(Te)*Math.sin(we),je*Math.cos(we))},e.exactEquals=function Be(ye,we){return ye[0]===we[0]&&ye[1]===we[1]&&ye[2]===we[2]},e.equals=function $e(ye,we){const Te=ye[0],je=ye[1],Ft=ye[2],Vt=we[0],pn=we[1],Pr=we[2];return Math.abs(Te-Vt)<=wi*Math.max(1,Math.abs(Te),Math.abs(Vt))&&Math.abs(je-pn)<=wi*Math.max(1,Math.abs(je),Math.abs(pn))&&Math.abs(Ft-Pr)<=wi*Math.max(1,Math.abs(Ft),Math.abs(Pr))};const nt=t();e.makeRotation=function ht(ye,we,Te){const je=ue(we,Te);if(Math.abs(je)<1e-4)return fe.setIdentity(ye);if(Math.abs(je-Math.PI)0?p(ye,we):H(ye,p(ye,we)),ye};const ti=t(),ut=t();e.triangleNormal=function Et(ye,we,Te,je){return h(ti,Te,we),h(ut,je,we),te(ye,Q(ye,ti,ut))},e.toString=function Nt(ye,we){return`[${ye[0].toPrecision(we)} ${ye[1].toPrecision(we)} ${ye[2].toPrecision(we)}]`},e.origin=u(0,0,0),e.unit=u(1,1,1),e.negUnit=u(-1,-1,-1),e.unitX=u(1,0,0),e.unitY=u(0,1,0),e.unitZ=u(0,0,1),e.negUnitX=u(-1,0,0),e.negUnitY=u(0,-1,0),e.negUnitZ=u(0,0,-1)}(C||(C={}));const u3=Math.PI/2,ioe=Math.PI/180;function Xr(e){return e*ioe}function pf(e){return e/ioe}function d3(e){return 0!==e&&!(e&e-1)}function ooe(e,t){return e*t}function fe(){return fe.zero()}function In(){return In.zero()}function Ue(){return Ue.zero()}function Bn(){return Bn.zero()}function DR(e){return Object.keys(e)}function Hi(e){throw new Error("unreachable")}function PR(e){return"function"==typeof e?.then}function Ai(){return Ai.zero()}var mr,ce,Kr,wU,Wx,f3;function Gx(e,t,n){for(;t9||s<0)return o*i|0;i=10*i+s|0}return o*i}function soe(e,t,n,r){return 43===t.charCodeAt(n)&&n++,e*Math.pow(10,p1(t,n,r))}function V0(e,t,n){let r=t,i=1,o=0,s=0,a=1;for(45===e.charCodeAt(r)?(i=-1,++r):43===e.charCodeAt(r)&&++r;r=0&&l<10)){if(-2===l){for(++r;r=0&&l<10))return 53===l||21===l?soe(i*(o+s/a),e,r+1,n):i*(o+s/a);s=10*s+l,a*=10,++r}return i*(o+s/a)}if(53===l||21===l)return soe(i*o,e,r+1,n);break}o=10*o+l,++r}return i*o}function loe(e,t,n,r){return{schema:n,__array:void 0,isDefined:0===r,rowCount:t,value:o=>e,valueKind:o=>r,toArray:o=>{const{array:s}=c3(t,o);for(let a=0,l=s.length;a!0}}function kR({value:e,valueKind:t,areValuesEqual:n,rowCount:r,schema:i}){return{schema:i,__array:void 0,isDefined:!0,rowCount:r,value:e,valueKind:t||(o=>0),toArray:o=>{const{array:s,start:a}=c3(r,o);for(let l=0,c=s.length;le(o)===e(s))}}function H0({array:e,schema:t,valueKind:n}){const r=e.length,i=t.T,o="str"===t.valueType?"lowercase"===t.transform?a=>{const l=e[a];return"string"==typeof l?l.toLowerCase():`${l??i}`.toLowerCase()}:"uppercase"===t.transform?a=>{const l=e[a];return"string"==typeof l?l.toUpperCase():`${l??i}`.toUpperCase()}:a=>{const l=e[a];return"string"==typeof l?l:`${l??i}`}:a=>e[a],s=bU(e);return{schema:t,__array:e,isDefined:!0,rowCount:r,value:o,valueKind:n||(a=>0),toArray:"str"===t.valueType?"lowercase"===t.transform?a=>{const{start:l,end:c}=cw(r,a),u=new(a&&typeof a.array<"u"?a.array:e.constructor)(c-l);for(let d=0,f=c-l;d{const{start:l,end:c}=cw(r,a),u=new(a&&typeof a.array<"u"?a.array:e.constructor)(c-l);for(let d=0,f=c-l;d{const{start:l,end:c}=cw(r,a),u=new(a&&typeof a.array<"u"?a.array:e.constructor)(c-l);for(let d=0,f=c-l;dER(e,a):a=>{const{start:l,end:c}=cw(r,a);if(0===l&&c===e.length)return e;const u=new(a&&typeof a.array<"u"?a.array:e.constructor)(c-l);for(let d=0,f=c-l;de[a]===e[l]}}function MR(e,t,n){return e[t]-e[n]}function qx(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function coe(e,t,n,r){const i=n+r>>1;return t(e,n,r)>0?t(e,n,i)>0?t(e,i,r)>0?i:r:n:t(e,r,i)>0?t(e,i,n)>0?i:n:r}function UFe(e,t,n){const{cmp:r,swap:i,data:o,parts:s}=e;let a=t+1,l=n;for(i(o,t,coe(o,r,t,n));r(o,l,t)>0;)--l;for(let c=t+1;c<=l;c++){const u=r(o,c,t);if(u>0){for(i(o,c,l),--l;r(o,l,t)>0;)--l;c--}else 0===u&&(i(o,c,a),a++)}for(let c=t;c=r&&t(e,s,s+1)>0;)n(e,s,s+1),s-=1}}function RR(e,t,n){const{parts:r}=e;for(;ts;)--o;for(let a=n+1;a<=o;a++){const l=e[a];if(l>s){for(qx(e,a,o),--o;e[o]>s;)--o;a--}else l===s&&(qx(e,a,i),++i)}for(let a=n;a=t&&e[o]>i;)e[o+1]=e[o],o-=1;e[o+1]=i}}function CU(e,t,n,r){for(;nbe)return!1;return!0}function u(q,ne,be,Ce){q[4*be+ne]=Ce}function h(q,ne){return q[0]=ne[0],q[1]=ne[1],q[2]=ne[2],q[3]=ne[3],q[4]=ne[4],q[5]=ne[5],q[6]=ne[6],q[7]=ne[7],q[8]=ne[8],q[9]=ne[9],q[10]=ne[10],q[11]=ne[11],q[12]=ne[12],q[13]=ne[13],q[14]=ne[14],q[15]=ne[15],q}function x(q,ne){const be=ne[0]+ne[5]+ne[10];let Ce=0;return be>0?(Ce=2*Math.sqrt(be+1),q[3]=.25*Ce,q[0]=(ne[6]-ne[9])/Ce,q[1]=(ne[8]-ne[2])/Ce,q[2]=(ne[1]-ne[4])/Ce):ne[0]>ne[5]&&ne[0]>ne[10]?(Ce=2*Math.sqrt(1+ne[0]-ne[5]-ne[10]),q[3]=(ne[6]-ne[9])/Ce,q[0]=.25*Ce,q[1]=(ne[1]+ne[4])/Ce,q[2]=(ne[8]+ne[2])/Ce):ne[5]>ne[10]?(Ce=2*Math.sqrt(1+ne[5]-ne[0]-ne[10]),q[3]=(ne[8]-ne[2])/Ce,q[0]=(ne[1]+ne[4])/Ce,q[1]=.25*Ce,q[2]=(ne[6]+ne[9])/Ce):(Ce=2*Math.sqrt(1+ne[10]-ne[0]-ne[5]),q[3]=(ne[1]-ne[4])/Ce,q[0]=(ne[8]+ne[2])/Ce,q[1]=(ne[6]+ne[9])/Ce,q[2]=.25*Ce),q}function A(q,ne){const be=ne[0],Ce=ne[1],Re=ne[2],Be=ne[3],$e=ne[4],nt=ne[5],ht=ne[6],Ge=ne[7],ft=ne[8],vt=ne[9],Pt=ne[10],St=ne[11],Mt=ne[12],Qt=ne[13],An=ne[14],Kn=ne[15],ti=be*nt-Ce*$e,ut=be*ht-Re*$e,Et=be*Ge-Be*$e,Nt=Ce*ht-Re*nt,ye=Ce*Ge-Be*nt,we=Re*Ge-Be*ht,Te=ft*Qt-vt*Mt,je=ft*An-Pt*Mt,Ft=ft*Kn-St*Mt,Vt=vt*An-Pt*Qt,pn=vt*Kn-St*Qt,Pr=Pt*Kn-St*An;let Jn=ti*Pr-ut*pn+Et*Vt+Nt*Ft-ye*je+we*Te;return!!Jn&&(Jn=1/Jn,q[0]=(nt*Pr-ht*pn+Ge*Vt)*Jn,q[1]=(Re*pn-Ce*Pr-Be*Vt)*Jn,q[2]=(Qt*we-An*ye+Kn*Nt)*Jn,q[3]=(Pt*ye-vt*we-St*Nt)*Jn,q[4]=(ht*Ft-$e*Pr-Ge*je)*Jn,q[5]=(be*Pr-Re*Ft+Be*je)*Jn,q[6]=(An*Et-Mt*we-Kn*ut)*Jn,q[7]=(ft*we-Pt*Et+St*ut)*Jn,q[8]=($e*pn-nt*Ft+Ge*Te)*Jn,q[9]=(Ce*Ft-be*pn-Be*Te)*Jn,q[10]=(Mt*ye-Qt*Et+Kn*ti)*Jn,q[11]=(vt*Et-ft*ye-St*ti)*Jn,q[12]=(nt*je-$e*Vt-ht*Te)*Jn,q[13]=(be*Vt-Ce*je+Re*Te)*Jn,q[14]=(Qt*ut-Mt*Nt-An*ti)*Jn,q[15]=(ft*Nt-vt*ut+Pt*ti)*Jn,!0)}function E(q,ne,be){const Ce=ne[0],Re=ne[1],Be=ne[2],$e=ne[3],nt=ne[4],ht=ne[5],Ge=ne[6],ft=ne[7],vt=ne[8],Pt=ne[9],St=ne[10],Mt=ne[11],Qt=ne[12],An=ne[13],Kn=ne[14],ti=ne[15];let ut=be[0],Et=be[1],Nt=be[2],ye=be[3];return q[0]=ut*Ce+Et*nt+Nt*vt+ye*Qt,q[1]=ut*Re+Et*ht+Nt*Pt+ye*An,q[2]=ut*Be+Et*Ge+Nt*St+ye*Kn,q[3]=ut*$e+Et*ft+Nt*Mt+ye*ti,ut=be[4],Et=be[5],Nt=be[6],ye=be[7],q[4]=ut*Ce+Et*nt+Nt*vt+ye*Qt,q[5]=ut*Re+Et*ht+Nt*Pt+ye*An,q[6]=ut*Be+Et*Ge+Nt*St+ye*Kn,q[7]=ut*$e+Et*ft+Nt*Mt+ye*ti,ut=be[8],Et=be[9],Nt=be[10],ye=be[11],q[8]=ut*Ce+Et*nt+Nt*vt+ye*Qt,q[9]=ut*Re+Et*ht+Nt*Pt+ye*An,q[10]=ut*Be+Et*Ge+Nt*St+ye*Kn,q[11]=ut*$e+Et*ft+Nt*Mt+ye*ti,ut=be[12],Et=be[13],Nt=be[14],ye=be[15],q[12]=ut*Ce+Et*nt+Nt*vt+ye*Qt,q[13]=ut*Re+Et*ht+Nt*Pt+ye*An,q[14]=ut*Be+Et*Ge+Nt*St+ye*Kn,q[15]=ut*$e+Et*ft+Nt*Mt+ye*ti,q}function z(q,ne,be){let Ce=be[0],Re=be[1],Be=be[2],$e=Math.sqrt(Ce*Ce+Re*Re+Be*Be);if(Math.abs($e)"u"?wi:ne)},e.hasNaN=function l(q){for(let ne=0;ne<16;ne++)if(isNaN(q[ne]))return!0;return!1},e.areEqual=c,e.setValue=u,e.getValue=function d(q,ne,be){return q[4*be+ne]},e.toArray=function f(q,ne,be){return ne[be+0]=q[0],ne[be+1]=q[1],ne[be+2]=q[2],ne[be+3]=q[3],ne[be+4]=q[4],ne[be+5]=q[5],ne[be+6]=q[6],ne[be+7]=q[7],ne[be+8]=q[8],ne[be+9]=q[9],ne[be+10]=q[10],ne[be+11]=q[11],ne[be+12]=q[12],ne[be+13]=q[13],ne[be+14]=q[14],ne[be+15]=q[15],ne},e.fromArray=function p(q,ne,be){return q[0]=ne[be+0],q[1]=ne[be+1],q[2]=ne[be+2],q[3]=ne[be+3],q[4]=ne[be+4],q[5]=ne[be+5],q[6]=ne[be+6],q[7]=ne[be+7],q[8]=ne[be+8],q[9]=ne[be+9],q[10]=ne[be+10],q[11]=ne[be+11],q[12]=ne[be+12],q[13]=ne[be+13],q[14]=ne[be+14],q[15]=ne[be+15],q},e.fromBasis=function m(q,ne,be,Ce){return i(q),u(q,0,0,ne[0]),u(q,1,0,ne[1]),u(q,2,0,ne[2]),u(q,0,1,be[0]),u(q,1,1,be[1]),u(q,2,1,be[2]),u(q,0,2,Ce[0]),u(q,1,2,Ce[1]),u(q,2,2,Ce[2]),u(q,3,3,1),q},e.copy=h,e.clone=function g(q){return h(t(),q)},e.getTranslation=function y(q,ne){return q[0]=ne[12],q[1]=ne[13],q[2]=ne[14],q},e.getScaling=function v(q,ne){const be=ne[0],Ce=ne[1],Re=ne[2],Be=ne[4],$e=ne[5],nt=ne[6],ht=ne[8],Ge=ne[9],ft=ne[10];return q[0]=Math.sqrt(be*be+Ce*Ce+Re*Re),q[1]=Math.sqrt(Be*Be+$e*$e+nt*nt),q[2]=Math.sqrt(ht*ht+Ge*Ge+ft*ft),q},e.getRotation=x,e.extractRotation=function _(q,ne){const be=1/Math.sqrt(ne[0]*ne[0]+ne[1]*ne[1]+ne[2]*ne[2]),Ce=1/Math.sqrt(ne[4]*ne[4]+ne[5]*ne[5]+ne[6]*ne[6]),Re=1/Math.sqrt(ne[8]*ne[8]+ne[9]*ne[9]+ne[10]*ne[10]);return q[0]=ne[0]*be,q[1]=ne[1]*be,q[2]=ne[2]*be,q[3]=0,q[4]=ne[4]*Ce,q[5]=ne[5]*Ce,q[6]=ne[6]*Ce,q[7]=0,q[8]=ne[8]*Re,q[9]=ne[9]*Re,q[10]=ne[10]*Re,q[11]=0,q[12]=0,q[13]=0,q[14]=0,q[15]=1,q},e.transpose=function w(q,ne){if(q===ne){const be=ne[1],Ce=ne[2],Re=ne[3],Be=ne[6],$e=ne[7],nt=ne[11];q[1]=ne[4],q[2]=ne[8],q[3]=ne[12],q[4]=be,q[6]=ne[9],q[7]=ne[13],q[8]=Ce,q[9]=Be,q[11]=ne[14],q[12]=Re,q[13]=$e,q[14]=nt}else q[0]=ne[0],q[1]=ne[4],q[2]=ne[8],q[3]=ne[12],q[4]=ne[1],q[5]=ne[5],q[6]=ne[9],q[7]=ne[13],q[8]=ne[2],q[9]=ne[6],q[10]=ne[10],q[11]=ne[14],q[12]=ne[3],q[13]=ne[7],q[14]=ne[11],q[15]=ne[15];return q},e.tryInvert=A,e.invert=function M(q,ne){return A(q,ne)||console.warn("non-invertible matrix.",ne),q},e.mul=E,e.mulOffset=function D(q,ne,be,Ce,Re,Be){const $e=ne[0+Re],nt=ne[1+Re],ht=ne[2+Re],Ge=ne[3+Re],ft=ne[4+Re],vt=ne[5+Re],Pt=ne[6+Re],St=ne[7+Re],Mt=ne[8+Re],Qt=ne[9+Re],An=ne[10+Re],Kn=ne[11+Re],ti=ne[12+Re],ut=ne[13+Re],Et=ne[14+Re],Nt=ne[15+Re];let ye=be[0+Be],we=be[1+Be],Te=be[2+Be],je=be[3+Be];return q[0+Ce]=ye*$e+we*ft+Te*Mt+je*ti,q[1+Ce]=ye*nt+we*vt+Te*Qt+je*ut,q[2+Ce]=ye*ht+we*Pt+Te*An+je*Et,q[3+Ce]=ye*Ge+we*St+Te*Kn+je*Nt,ye=be[4+Be],we=be[5+Be],Te=be[6+Be],je=be[7+Be],q[4+Ce]=ye*$e+we*ft+Te*Mt+je*ti,q[5+Ce]=ye*nt+we*vt+Te*Qt+je*ut,q[6+Ce]=ye*ht+we*Pt+Te*An+je*Et,q[7+Ce]=ye*Ge+we*St+Te*Kn+je*Nt,ye=be[8+Be],we=be[9+Be],Te=be[10+Be],je=be[11+Be],q[8+Ce]=ye*$e+we*ft+Te*Mt+je*ti,q[9+Ce]=ye*nt+we*vt+Te*Qt+je*ut,q[10+Ce]=ye*ht+we*Pt+Te*An+je*Et,q[11+Ce]=ye*Ge+we*St+Te*Kn+je*Nt,ye=be[12+Be],we=be[13+Be],Te=be[14+Be],je=be[15+Be],q[12+Ce]=ye*$e+we*ft+Te*Mt+je*ti,q[13+Ce]=ye*nt+we*vt+Te*Qt+je*ut,q[14+Ce]=ye*ht+we*Pt+Te*An+je*Et,q[15+Ce]=ye*Ge+we*St+Te*Kn+je*Nt,q},e.mul3=function T(q,ne,be,Ce){return E(q,E(q,ne,be),Ce)},e.translate=function F(q,ne,be){const Ce=be[0],Re=be[1],Be=be[2];let $e,nt,ht,Ge,ft,vt,Pt,St,Mt,Qt,An,Kn;return ne===q?(q[12]=ne[0]*Ce+ne[4]*Re+ne[8]*Be+ne[12],q[13]=ne[1]*Ce+ne[5]*Re+ne[9]*Be+ne[13],q[14]=ne[2]*Ce+ne[6]*Re+ne[10]*Be+ne[14],q[15]=ne[3]*Ce+ne[7]*Re+ne[11]*Be+ne[15]):($e=ne[0],nt=ne[1],ht=ne[2],Ge=ne[3],ft=ne[4],vt=ne[5],Pt=ne[6],St=ne[7],Mt=ne[8],Qt=ne[9],An=ne[10],Kn=ne[11],q[0]=$e,q[1]=nt,q[2]=ht,q[3]=Ge,q[4]=ft,q[5]=vt,q[6]=Pt,q[7]=St,q[8]=Mt,q[9]=Qt,q[10]=An,q[11]=Kn,q[12]=$e*Ce+ft*Re+Mt*Be+ne[12],q[13]=nt*Ce+vt*Re+Qt*Be+ne[13],q[14]=ht*Ce+Pt*Re+An*Be+ne[14],q[15]=Ge*Ce+St*Re+Kn*Be+ne[15]),q},e.fromTranslation=function R(q,ne){return q[0]=1,q[1]=0,q[2]=0,q[3]=0,q[4]=0,q[5]=1,q[6]=0,q[7]=0,q[8]=0,q[9]=0,q[10]=1,q[11]=0,q[12]=ne[0],q[13]=ne[1],q[14]=ne[2],q[15]=1,q},e.setTranslation=function N(q,ne){return q[12]=ne[0],q[13]=ne[1],q[14]=ne[2],q},e.setAxes=function j(q,ne,be,Ce){return q[0]=be[0],q[4]=be[1],q[8]=be[2],q[1]=Ce[0],q[5]=Ce[1],q[9]=Ce[2],q[2]=ne[0],q[6]=ne[1],q[10]=ne[2],q},e.rotate=function W(q,ne,be,Ce){let Re=Ce[0],Be=Ce[1],$e=Ce[2],nt=Math.sqrt(Re*Re+Be*Be+$e*$e);if(Math.abs(nt)0&&(St=1/Math.sqrt(St),ft*=St,vt*=St,Pt*=St);let Mt=ht*Pt-Ge*vt,Qt=Ge*ft-nt*Pt,An=nt*vt-ht*ft;return St=Mt*Mt+Qt*Qt+An*An,St>0&&(St=1/Math.sqrt(St),Mt*=St,Qt*=St,An*=St),q[0]=Mt,q[1]=Qt,q[2]=An,q[3]=0,q[4]=vt*An-Pt*Qt,q[5]=Pt*Mt-ft*An,q[6]=ft*Qt-vt*Mt,q[7]=0,q[8]=ft,q[9]=vt,q[10]=Pt,q[11]=0,q[12]=Re,q[13]=Be,q[14]=$e,q[15]=1,q},e.fromPermutation=function ue(q,ne){i(q);for(let be=0;be<4;be++)u(q,be,ne[be],1);return q},e.getMaxScaleOnAxis=function _e(q){return Math.sqrt(Math.max(q[0]*q[0]+q[1]*q[1]+q[2]*q[2],q[4]*q[4]+q[5]*q[5]+q[6]*q[6],q[8]*q[8]+q[9]*q[9]+q[10]*q[10]))};const Fe=[1,0,0],Ze=[0,1,0],ct=[0,0,1];e.rotX90=z(t(),Xr(90),Fe),e.rotX180=z(t(),Xr(180),Fe),e.rotY90=z(t(),Xr(90),Ze),e.rotY180=z(t(),Xr(180),Ze),e.rotY270=z(t(),Xr(270),Ze),e.rotZ90=z(t(),Xr(90),ct),e.rotZ180=z(t(),Xr(180),ct),e.rotXY90=E(t(),e.rotX90,e.rotY90),e.rotZY90=E(t(),e.rotZ90,e.rotY90),e.rotZYZ90=E(t(),e.rotZY90,e.rotZ90),e.rotZ90X180=E(t(),e.rotZ90,e.rotX180),e.rotY90Z180=E(t(),e.rotY90,e.rotZ180),e.id=n()}(fe||(fe={})),function(e){function t(){const G=[.1,0,0,0,0,0,0,0,0];return G[0]=0,G}function n(){const G=t();return G[0]=1,G[1]=0,G[2]=0,G[3]=0,G[4]=1,G[5]=0,G[6]=0,G[7]=0,G[8]=1,G}function a(G,Z){return G[0]=Z[0],G[1]=Z[1],G[2]=Z[2],G[3]=Z[4],G[4]=Z[5],G[5]=Z[6],G[6]=Z[8],G[7]=Z[9],G[8]=Z[10],G}e.zero=t,e.identity=n,e.setIdentity=function r(G){return G[0]=1,G[1]=0,G[2]=0,G[3]=0,G[4]=1,G[5]=0,G[6]=0,G[7]=0,G[8]=1,G},e.toArray=function i(G,Z,ee){return Z[ee+0]=G[0],Z[ee+1]=G[1],Z[ee+2]=G[2],Z[ee+3]=G[3],Z[ee+4]=G[4],Z[ee+5]=G[5],Z[ee+6]=G[6],Z[ee+7]=G[7],Z[ee+8]=G[8],Z},e.fromArray=function o(G,Z,ee){return G[0]=Z[ee+0],G[1]=Z[ee+1],G[2]=Z[ee+2],G[3]=Z[ee+3],G[4]=Z[ee+4],G[5]=Z[ee+5],G[6]=Z[ee+6],G[7]=Z[ee+7],G[8]=Z[ee+8],G},e.fromColumns=function s(G,Z,ee,se){return G[0]=Z[0],G[1]=Z[1],G[2]=Z[2],G[3]=ee[0],G[4]=ee[1],G[5]=ee[2],G[6]=se[0],G[7]=se[1],G[8]=se[2],G},e.fromMat4=a,e.create=function l(G,Z,ee,se,xe,re,ae,ge,Ie){const me=t();return me[0]=G,me[1]=Z,me[2]=ee,me[3]=se,me[4]=xe,me[5]=re,me[6]=ae,me[7]=ge,me[8]=Ie,me};const c=n();function p(G,Z,ee){for(let se=0;se<9;se++)if(Math.abs(G[se]-Z[se])>ee)return!1;return!0}function g(G,Z){return G[0]=Z[0],G[1]=Z[1],G[2]=Z[2],G[3]=Z[3],G[4]=Z[4],G[5]=Z[5],G[6]=Z[6],G[7]=Z[7],G[8]=Z[8],G}function y(G,Z){if(G===Z){const ee=Z[1],se=Z[2],xe=Z[5];G[1]=Z[3],G[2]=Z[6],G[3]=ee,G[5]=Z[7],G[6]=se,G[7]=xe}else G[0]=Z[0],G[1]=Z[3],G[2]=Z[6],G[3]=Z[1],G[4]=Z[4],G[5]=Z[7],G[6]=Z[2],G[7]=Z[5],G[8]=Z[8];return G}function v(G,Z){const ee=Z[0],se=Z[1],xe=Z[2],re=Z[3],ae=Z[4],ge=Z[5],Ie=Z[6],me=Z[7],Ae=Z[8],he=Ae*ae-ge*me,ie=-Ae*re+ge*Ie,ue=me*re-ae*Ie;let _e=ee*he+se*ie+xe*ue;return _e?(_e=1/_e,G[0]=he*_e,G[1]=(-Ae*se+xe*me)*_e,G[2]=(ge*se-xe*ae)*_e,G[3]=ie*_e,G[4]=(Ae*ee-xe*Ie)*_e,G[5]=(-ge*ee+xe*re)*_e,G[6]=ue*_e,G[7]=(-me*ee+se*Ie)*_e,G[8]=(ae*ee-se*re)*_e,G):(console.warn("non-invertible matrix.",Z),G)}function w(G){const xe=G[3],re=G[4],ae=G[5],ge=G[6],Ie=G[7],me=G[8];return G[0]*(me*re-ae*Ie)+G[1]*(-me*xe+ae*ge)+G[2]*(Ie*xe-re*ge)}function A(G){return G[0]+G[4]+G[8]}function M(G,Z,ee){return G[0]=Z[0]-ee[0],G[1]=Z[1]-ee[1],G[2]=Z[2]-ee[2],G[3]=Z[3]-ee[3],G[4]=Z[4]-ee[4],G[5]=Z[5]-ee[5],G[6]=Z[6]-ee[6],G[7]=Z[7]-ee[7],G[8]=Z[8]-ee[8],G}function R(G,Z,ee){return G[0]=Z[0]*ee,G[1]=Z[1]*ee,G[2]=Z[2]*ee,G[3]=Z[3]*ee,G[4]=Z[4]*ee,G[5]=Z[5]*ee,G[6]=Z[6]*ee,G[7]=Z[7]*ee,G[8]=Z[8]*ee,G}e.isIdentity=function u(G,Z){return p(G,c,typeof Z>"u"?wi:Z)},e.hasNaN=function d(G){for(let Z=0;Z<9;Z++)if(isNaN(G[Z]))return!0;return!1},e.clone=function f(G){return g(t(),G)},e.areEqual=p,e.setValue=function m(G,Z,ee,se){G[3*ee+Z]=se},e.getValue=function h(G,Z,ee){return G[3*ee+Z]},e.copy=g,e.transpose=y,e.invert=v,e.symmtricFromUpper=function x(G,Z){return G===Z?(G[3]=Z[1],G[6]=Z[2],G[7]=Z[5]):(G[0]=Z[0],G[1]=Z[1],G[2]=Z[2],G[3]=Z[1],G[4]=Z[4],G[5]=Z[5],G[6]=Z[2],G[7]=Z[5],G[8]=Z[8]),G},e.symmtricFromLower=function _(G,Z){return G===Z?(G[1]=Z[3],G[2]=Z[6],G[5]=Z[7]):(G[0]=Z[0],G[1]=Z[3],G[2]=Z[6],G[3]=Z[3],G[4]=Z[4],G[5]=Z[7],G[6]=Z[6],G[7]=Z[7],G[8]=Z[8]),G},e.determinant=w,e.trace=A,e.sub=M,e.add=function E(G,Z,ee){return G[0]=Z[0]+ee[0],G[1]=Z[1]+ee[1],G[2]=Z[2]+ee[2],G[3]=Z[3]+ee[3],G[4]=Z[4]+ee[4],G[5]=Z[5]+ee[5],G[6]=Z[6]+ee[6],G[7]=Z[7]+ee[7],G[8]=Z[8]+ee[8],G},e.mul=function D(G,Z,ee){const se=Z[0],xe=Z[1],re=Z[2],ae=Z[3],ge=Z[4],Ie=Z[5],me=Z[6],Ae=Z[7],he=Z[8],ie=ee[0],ue=ee[1],_e=ee[2],Fe=ee[3],Ze=ee[4],ct=ee[5],q=ee[6],ne=ee[7],be=ee[8];return G[0]=ie*se+ue*ae+_e*me,G[1]=ie*xe+ue*ge+_e*Ae,G[2]=ie*re+ue*Ie+_e*he,G[3]=Fe*se+Ze*ae+ct*me,G[4]=Fe*xe+Ze*ge+ct*Ae,G[5]=Fe*re+Ze*Ie+ct*he,G[6]=q*se+ne*ae+be*me,G[7]=q*xe+ne*ge+be*Ae,G[8]=q*re+ne*Ie+be*he,G},e.subScalar=function T(G,Z,ee){return G[0]=Z[0]-ee,G[1]=Z[1]-ee,G[2]=Z[2]-ee,G[3]=Z[3]-ee,G[4]=Z[4]-ee,G[5]=Z[5]-ee,G[6]=Z[6]-ee,G[7]=Z[7]-ee,G[8]=Z[8]-ee,G},e.addScalar=function F(G,Z,ee){return G[0]=Z[0]+ee,G[1]=Z[1]+ee,G[2]=Z[2]+ee,G[3]=Z[3]+ee,G[4]=Z[4]+ee,G[5]=Z[5]+ee,G[6]=Z[6]+ee,G[7]=Z[7]+ee,G[8]=Z[8]+ee,G},e.mulScalar=R;const N=Math.PI/3,j=t();e.symmetricEigenvalues=function W(G,Z){const ee=Z[1]*Z[1]+Z[2]*Z[2]+Z[5]*Z[5];if(0===ee)G[0]=Z[0],G[1]=Z[4],G[2]=Z[8];else{const se=A(Z)/3,xe=Z[0]-se,re=Z[4]-se,ae=Z[8]-se,Ie=Math.sqrt((xe*xe+re*re+ae*ae+2*ee)/6);R(j,e.Identity,se),M(j,Z,j),R(j,j,1/Ie);const me=w(j)/2,Ae=me<=-1?N:me>=1?0:Math.acos(me)/3;G[0]=se+2*Ie*Math.cos(Ae),G[2]=se+2*Ie*Math.cos(Ae+2*N),G[1]=3*se-G[0]-G[2]}return G};const z=[.1,0,0],$=[.1,0,0],V=[.1,0,0],X=[.1,0,0],H=[.1,0,0],oe=[.1,0,0];e.eigenvector=function te(G,Z,ee){C.set(z,Z[0]-ee,Z[1],Z[2]),C.set($,Z[1],Z[4]-ee,Z[5]),C.set(V,Z[2],Z[5],Z[8]-ee),C.cross(X,z,$),C.cross(H,z,V),C.cross(oe,$,V);const se=C.dot(X,X),xe=C.dot(H,H),re=C.dot(oe,oe);let ae=se,ge=0;return xe>ae&&(ae=xe,ge=1),re>ae&&(ge=2),0===ge?C.scale(G,X,1/Math.sqrt(se)):1===ge?C.scale(G,H,1/Math.sqrt(xe)):C.scale(G,oe,1/Math.sqrt(re)),G},e.directionTransform=function K(G,Z){return a(G,Z),v(G,G),y(G,G),G},e.Identity=n(),e.innerProduct=function Q(G,Z){return G[0]*Z[0]+G[1]*Z[1]+G[2]*Z[2]+G[3]*Z[3]+G[4]*Z[4]+G[5]*Z[5]+G[6]*Z[6]+G[7]*Z[7]+G[8]*Z[8]}}(In||(In={})),function(e){function t(){const E=[.1,0];return E[0]=0,E}e.zero=t,e.clone=function n(E){const D=t();return D[0]=E[0],D[1]=E[1],D},e.create=function r(E,D){const T=t();return T[0]=E,T[1]=D,T},e.hasNaN=function i(E){return isNaN(E[0])||isNaN(E[1])},e.toArray=function o(E,D,T){return D[T+0]=E[0],D[T+1]=E[1],D},e.fromArray=function s(E,D,T){return E[0]=D[T+0],E[1]=D[T+1],E},e.copy=function a(E,D){return E[0]=D[0],E[1]=D[1],E},e.set=function l(E,D,T){return E[0]=D,E[1]=T,E},e.add=function c(E,D,T){return E[0]=D[0]+T[0],E[1]=D[1]+T[1],E},e.sub=function u(E,D,T){return E[0]=D[0]-T[0],E[1]=D[1]-T[1],E},e.mul=function d(E,D,T){return E[0]=D[0]*T[0],E[1]=D[1]*T[1],E},e.div=function f(E,D,T){return E[0]=D[0]/T[0],E[1]=D[1]/T[1],E},e.scale=function p(E,D,T){return E[0]=D[0]*T,E[1]=D[1]*T,E},e.round=function m(E,D){return E[0]=Math.round(D[0]),E[1]=Math.round(D[1]),E},e.ceil=function h(E,D){return E[0]=Math.ceil(D[0]),E[1]=Math.ceil(D[1]),E},e.floor=function g(E,D){return E[0]=Math.floor(D[0]),E[1]=Math.floor(D[1]),E},e.distance=function y(E,D){const T=D[0]-E[0],F=D[1]-E[1];return Math.sqrt(T*T+F*F)},e.squaredDistance=function v(E,D){const T=D[0]-E[0],F=D[1]-E[1];return T*T+F*F},e.magnitude=function x(E){const D=E[0],T=E[1];return Math.sqrt(D*D+T*T)},e.squaredMagnitude=function _(E){const D=E[0],T=E[1];return D*D+T*T},e.inverse=function w(E,D){return E[0]=1/D[0],E[1]=1/D[1],E},e.areEqual=function A(E,D){return E[0]===D[0]&&E[1]===D[1]},e.toString=function M(E,D){return`[${E[0].toPrecision(D)} ${E[1].toPrecision(D)}}]`}}(Ue||(Ue={})),function(e){function t(){const R=[.1,0,0,0];return R[0]=0,R}function i(R,N){return R[0]=N.center[0],R[1]=N.center[1],R[2]=N.center[2],R[3]=N.radius,R}e.zero=t,e.clone=function n(R){const N=t();return N[0]=R[0],N[1]=R[1],N[2]=R[2],N[3]=R[3],N},e.create=function r(R,N,j,W){const z=t();return z[0]=R,z[1]=N,z[2]=j,z[3]=W,z},e.fromSphere=i,e.ofSphere=function o(R){return i(t(),R)},e.hasNaN=function s(R){return isNaN(R[0])||isNaN(R[1])||isNaN(R[2])||isNaN(R[3])},e.toArray=function a(R,N,j){return N[j+0]=R[0],N[j+1]=R[1],N[j+2]=R[2],N[j+3]=R[3],N},e.fromArray=function l(R,N,j){return R[0]=N[j+0],R[1]=N[j+1],R[2]=N[j+2],R[3]=N[j+3],R},e.toVec3Array=function c(R,N,j){N[j+0]=R[0],N[j+1]=R[1],N[j+2]=R[2]},e.fromVec3Array=function u(R,N,j){return R[0]=N[j+0],R[1]=N[j+1],R[2]=N[j+2],R[3]=0,R},e.copy=function d(R,N){return R[0]=N[0],R[1]=N[1],R[2]=N[2],R[3]=N[3],R},e.set=function f(R,N,j,W,z){return R[0]=N,R[1]=j,R[2]=W,R[3]=z,R},e.add=function p(R,N,j){return R[0]=N[0]+j[0],R[1]=N[1]+j[1],R[2]=N[2]+j[2],R[3]=N[3]+j[3],R},e.distance=function m(R,N){const j=N[0]-R[0],W=N[1]-R[1],z=N[2]-R[2],$=N[3]-R[3];return Math.sqrt(j*j+W*W+z*z+$*$)},e.scale=function h(R,N,j){return R[0]=N[0]*j,R[1]=N[1]*j,R[2]=N[2]*j,R[4]=N[4]*j,R},e.round=function g(R,N){return R[0]=Math.round(N[0]),R[1]=Math.round(N[1]),R[2]=Math.round(N[2]),R[3]=Math.round(N[3]),R},e.ceil=function y(R,N){return R[0]=Math.ceil(N[0]),R[1]=Math.ceil(N[1]),R[2]=Math.ceil(N[2]),R[3]=Math.ceil(N[3]),R},e.floor=function v(R,N){return R[0]=Math.floor(N[0]),R[1]=Math.floor(N[1]),R[2]=Math.floor(N[2]),R[3]=Math.floor(N[3]),R},e.squaredDistance=function x(R,N){const j=N[0]-R[0],W=N[1]-R[1],z=N[2]-R[2],$=N[3]-R[3];return j*j+W*W+z*z+$*$},e.norm=function _(R){const N=R[0],j=R[1],W=R[2],z=R[3];return Math.sqrt(N*N+j*j+W*W+z*z)},e.squaredNorm=function w(R){const N=R[0],j=R[1],W=R[2],z=R[3];return N*N+j*j+W*W+z*z},e.transformMat4=function A(R,N,j){const W=N[0],z=N[1],$=N[2],V=N[3];return R[0]=j[0]*W+j[4]*z+j[8]*$+j[12]*V,R[1]=j[1]*W+j[5]*z+j[9]*$+j[13]*V,R[2]=j[2]*W+j[6]*z+j[10]*$+j[14]*V,R[3]=j[3]*W+j[7]*z+j[11]*$+j[15]*V,R},e.dot=function M(R,N){return R[0]*N[0]+R[1]*N[1]+R[2]*N[2]+R[3]*N[3]},e.inverse=function E(R,N){return R[0]=1/N[0],R[1]=1/N[1],R[2]=1/N[2],R[3]=1/N[3],R},e.exactEquals=function D(R,N){return R[0]===N[0]&&R[1]===N[1]&&R[2]===N[2]&&R[3]===N[3]},e.equals=function T(R,N){const j=R[0],W=R[1],z=R[2],$=R[3],V=N[0],X=N[1],H=N[2],oe=N[3];return Math.abs(j-V)<=wi*Math.max(1,Math.abs(j),Math.abs(V))&&Math.abs(W-X)<=wi*Math.max(1,Math.abs(W),Math.abs(X))&&Math.abs(z-H)<=wi*Math.max(1,Math.abs(z),Math.abs(H))&&Math.abs($-oe)<=wi*Math.max(1,Math.abs($),Math.abs(oe))},e.toString=function F(R,N){return`[${R[0].toPrecision(N)} ${R[1].toPrecision(N)} ${R[2].toPrecision(N)} ${R[3].toPrecision(N)}]`}}(Bn||(Bn={})),function(e){function t(){const Q=[.1,0,0,0];return Q[0]=0,Q}function n(){const Q=t();return Q[3]=1,Q}function s(Q,G,Z){Z*=.5;const ee=Math.sin(Z);return Q[0]=ee*G[0],Q[1]=ee*G[1],Q[2]=ee*G[2],Q[3]=Math.cos(Z),Q}function p(Q,G,Z,ee){const se=G[0],xe=G[1],re=G[2],ae=G[3];let he,ie,ue,_e,Fe,ge=Z[0],Ie=Z[1],me=Z[2],Ae=Z[3];return ie=se*ge+xe*Ie+re*me+ae*Ae,ie<0&&(ie=-ie,ge=-ge,Ie=-Ie,me=-me,Ae=-Ae),1-ie>1e-6?(he=Math.acos(ie),ue=Math.sin(he),_e=Math.sin((1-ee)*he)/ue,Fe=Math.sin(ee*he)/ue):(_e=1-ee,Fe=ee),Q[0]=_e*se+Fe*ge,Q[1]=_e*xe+Fe*Ie,Q[2]=_e*re+Fe*me,Q[3]=_e*ae+Fe*Ae,Q}function y(Q,G){const Z=G[0]+G[4]+G[8];let ee;if(Z>0)ee=Math.sqrt(Z+1),Q[3]=.5*ee,ee=.5/ee,Q[0]=(G[5]-G[7])*ee,Q[1]=(G[6]-G[2])*ee,Q[2]=(G[1]-G[3])*ee;else{let se=0;G[4]>G[0]&&(se=1),G[8]>G[3*se+se]&&(se=2);const xe=(se+1)%3,re=(se+2)%3;ee=Math.sqrt(G[3*se+se]-G[3*xe+xe]-G[3*re+re]+1),Q[se]=.5*ee,ee=.5/ee,Q[3]=(G[3*xe+re]-G[3*re+xe])*ee,Q[xe]=(G[3*xe+se]+G[3*se+xe])*ee,Q[re]=(G[3*re+se]+G[3*se+re])*ee}return Q}e.zero=t,e.identity=n,e.setIdentity=function r(Q){Q[0]=0,Q[1]=0,Q[2]=0,Q[3]=1},e.hasNaN=function i(Q){return isNaN(Q[0])||isNaN(Q[1])||isNaN(Q[2])||isNaN(Q[3])},e.create=function o(Q,G,Z,ee){const se=n();return se[0]=Q,se[1]=G,se[2]=Z,se[3]=ee,se},e.setAxisAngle=s,e.getAxisAngle=function a(Q,G){const Z=2*Math.acos(G[3]),ee=Math.sin(Z/2);return 0!==ee?(Q[0]=G[0]/ee,Q[1]=G[1]/ee,Q[2]=G[2]/ee):(Q[0]=1,Q[1]=0,Q[2]=0),Z},e.multiply=function l(Q,G,Z){const ee=G[0],se=G[1],xe=G[2],re=G[3],ae=Z[0],ge=Z[1],Ie=Z[2],me=Z[3];return Q[0]=ee*me+re*ae+se*Ie-xe*ge,Q[1]=se*me+re*ge+xe*ae-ee*Ie,Q[2]=xe*me+re*Ie+ee*ge-se*ae,Q[3]=re*me-ee*ae-se*ge-xe*Ie,Q},e.rotateX=function c(Q,G,Z){Z*=.5;const ee=G[0],se=G[1],xe=G[2],re=G[3],ae=Math.sin(Z),ge=Math.cos(Z);return Q[0]=ee*ge+re*ae,Q[1]=se*ge+xe*ae,Q[2]=xe*ge-se*ae,Q[3]=re*ge-ee*ae,Q},e.rotateY=function u(Q,G,Z){Z*=.5;const ee=G[0],se=G[1],xe=G[2],re=G[3],ae=Math.sin(Z),ge=Math.cos(Z);return Q[0]=ee*ge-xe*ae,Q[1]=se*ge+re*ae,Q[2]=xe*ge+ee*ae,Q[3]=re*ge-se*ae,Q},e.rotateZ=function d(Q,G,Z){Z*=.5;const ee=G[0],se=G[1],xe=G[2],re=G[3],ae=Math.sin(Z),ge=Math.cos(Z);return Q[0]=ee*ge+se*ae,Q[1]=se*ge-ee*ae,Q[2]=xe*ge+re*ae,Q[3]=re*ge-xe*ae,Q},e.calculateW=function f(Q,G){const Z=G[0],ee=G[1],se=G[2];return Q[0]=Z,Q[1]=ee,Q[2]=se,Q[3]=Math.sqrt(Math.abs(1-Z*Z-ee*ee-se*se)),Q},e.slerp=p,e.invert=function m(Q,G){const Z=G[0],ee=G[1],se=G[2],xe=G[3],re=Z*Z+ee*ee+se*se+xe*xe,ae=re?1/re:0;return Q[0]=-Z*ae,Q[1]=-ee*ae,Q[2]=-se*ae,Q[3]=xe*ae,Q},e.conjugate=function h(Q,G){return Q[0]=-G[0],Q[1]=-G[1],Q[2]=-G[2],Q[3]=G[3],Q},e.dot=function g(Q,G){return Q[0]*G[0]+Q[1]*G[1]+Q[2]*G[2]+Q[3]*G[3]},e.fromMat3=y,e.fromEuler=function v(Q,G,Z){const[ee,se,xe]=G,re=Math.cos(ee/2),ae=Math.cos(se/2),ge=Math.cos(xe/2),Ie=Math.sin(ee/2),me=Math.sin(se/2),Ae=Math.sin(xe/2);switch(Z){case"XYZ":Q[0]=Ie*ae*ge+re*me*Ae,Q[1]=re*me*ge-Ie*ae*Ae,Q[2]=re*ae*Ae+Ie*me*ge,Q[3]=re*ae*ge-Ie*me*Ae;break;case"YXZ":Q[0]=Ie*ae*ge+re*me*Ae,Q[1]=re*me*ge-Ie*ae*Ae,Q[2]=re*ae*Ae-Ie*me*ge,Q[3]=re*ae*ge+Ie*me*Ae;break;case"ZXY":Q[0]=Ie*ae*ge-re*me*Ae,Q[1]=re*me*ge+Ie*ae*Ae,Q[2]=re*ae*Ae+Ie*me*ge,Q[3]=re*ae*ge-Ie*me*Ae;break;case"ZYX":Q[0]=Ie*ae*ge-re*me*Ae,Q[1]=re*me*ge+Ie*ae*Ae,Q[2]=re*ae*Ae-Ie*me*ge,Q[3]=re*ae*ge+Ie*me*Ae;break;case"YZX":Q[0]=Ie*ae*ge+re*me*Ae,Q[1]=re*me*ge+Ie*ae*Ae,Q[2]=re*ae*Ae-Ie*me*ge,Q[3]=re*ae*ge-Ie*me*Ae;break;case"XZY":Q[0]=Ie*ae*ge-re*me*Ae,Q[1]=re*me*ge-Ie*ae*Ae,Q[2]=re*ae*Ae+Ie*me*ge,Q[3]=re*ae*ge+Ie*me*Ae;break;default:Hi()}return Q};const x=[0,0,0];function N(Q,G){const Z=G[0],ee=G[1],se=G[2],xe=G[3];let re=Z*Z+ee*ee+se*se+xe*xe;return re>0&&(re=1/Math.sqrt(re),Q[0]=Z*re,Q[1]=ee*re,Q[2]=se*re,Q[3]=xe*re),Q}e.fromUnitVec3=function _(Q,G,Z){let ee=C.dot(G,Z)+1;return eeMath.abs(G[2])?C.set(x,-G[1],G[0],0):C.set(x,0,-G[2],G[1])):C.cross(x,G,Z),Q[0]=x[0],Q[1]=x[1],Q[2]=x[2],Q[3]=ee,N(Q,Q),Q},e.clone=function w(Q){const G=t();return G[0]=Q[0],G[1]=Q[1],G[2]=Q[2],G[3]=Q[3],G},e.toArray=function A(Q,G,Z){return G[Z+0]=Q[0],G[Z+1]=Q[1],G[Z+2]=Q[2],G[Z+3]=Q[3],G},e.fromArray=function M(Q,G,Z){return Q[0]=G[Z+0],Q[1]=G[Z+1],Q[2]=G[Z+2],Q[3]=G[Z+3],Q},e.copy=function E(Q,G){return Q[0]=G[0],Q[1]=G[1],Q[2]=G[2],Q[3]=G[3],Q},e.set=function D(Q,G,Z,ee,se){return Q[0]=G,Q[1]=Z,Q[2]=ee,Q[3]=se,Q},e.exactEquals=function T(Q,G){return Q[0]===G[0]&&Q[1]===G[1]&&Q[2]===G[2]&&Q[3]===G[3]},e.equals=function F(Q,G){const Z=Q[0],ee=Q[1],se=Q[2],xe=Q[3],re=G[0],ae=G[1],ge=G[2],Ie=G[3];return Math.abs(Z-re)<=wi*Math.max(1,Math.abs(Z),Math.abs(re))&&Math.abs(ee-ae)<=wi*Math.max(1,Math.abs(ee),Math.abs(ae))&&Math.abs(se-ge)<=wi*Math.max(1,Math.abs(se),Math.abs(ge))&&Math.abs(xe-Ie)<=wi*Math.max(1,Math.abs(xe),Math.abs(Ie))},e.add=function R(Q,G,Z){return Q[0]=G[0]+Z[0],Q[1]=G[1]+Z[1],Q[2]=G[2]+Z[2],Q[3]=G[3]+Z[3],Q},e.normalize=N;const j=[0,0,0],W=[1,0,0],z=[0,1,0];e.rotationTo=function $(Q,G,Z){const ee=C.dot(G,Z);return ee<-.999999?(C.cross(j,W,G),C.magnitude(j)<1e-6&&C.cross(j,z,G),C.normalize(j,j),s(Q,j,Math.PI),Q):ee>.999999?(Q[0]=0,Q[1]=0,Q[2]=0,Q[3]=1,Q):(C.cross(j,G,Z),Q[0]=j[0],Q[1]=j[1],Q[2]=j[2],Q[3]=1+ee,N(Q,Q))};const V=t(),X=t();e.sqlerp=function H(Q,G,Z,ee,se,xe){return p(V,G,se,xe),p(X,Z,ee,xe),p(Q,V,X,2*xe*(1-xe)),Q};const oe=[0,0,0,0,0,0,0,0,0];e.setAxes=function te(Q,G,Z,ee){return oe[0]=Z[0],oe[3]=Z[1],oe[6]=Z[2],oe[1]=ee[0],oe[4]=ee[1],oe[7]=ee[2],oe[2]=-G[0],oe[5]=-G[1],oe[8]=-G[2],N(Q,y(Q,oe))},e.toString=function K(Q,G){return`[${Q[0].toPrecision(G)} ${Q[1].toPrecision(G)} ${Q[2].toPrecision(G)} ${Q[3].toPrecision(G)}]`},e.Identity=n()}(Ai||(Ai={})),function(e){function r(w,A,M){const E=function t(w,A,M){const E=[];for(let T=0;TE[D],set:(E,D,T)=>E[D]=T,add:(E,D,T)=>E[D]+=T,dataOffset:E=>E,getCoords:(E,D)=>(D[0]=E,D)};case 2:if(0===M[0]&&1===M[1]){const E=A[0];return{get:(D,T,F)=>D[F*E+T],set:(D,T,F,R)=>D[F*E+T]=R,add:(D,T,F,R)=>D[F*E+T]+=R,dataOffset:(D,T)=>T*E+D,getCoords:(D,T)=>(T[0]=D%E,T[1]=Math.floor(D/E),T)}}if(1===M[0]&&0===M[1]){const E=A[1];return{get:(D,T,F)=>D[T*E+F],set:(D,T,F,R)=>D[T*E+F]=R,add:(D,T,F,R)=>D[T*E+F]+=R,dataOffset:(D,T)=>D*E+T,getCoords:(D,T)=>(T[0]=Math.floor(D/E),T[1]=D%E,T)}}throw new Error("bad axis order");case 3:if(0===M[0]&&1===M[1]&&2===M[2]){const E=A[0],D=A[1],T=E*D;return{get:(F,R,N,j)=>F[R+N*E+j*T],set:(F,R,N,j,W)=>F[R+N*E+j*T]=W,add:(F,R,N,j,W)=>F[R+N*E+j*T]+=W,dataOffset:(F,R,N)=>F+R*E+N*T,getCoords:(F,R)=>{const N=Math.floor(F/E);return R[0]=F%E,R[1]=N%D,R[2]=Math.floor(N/D),R}}}if(0===M[0]&&2===M[1]&&1===M[2]){const E=A[0],D=A[2],T=E*D;return{get:(F,R,N,j)=>F[R+j*E+N*T],set:(F,R,N,j,W)=>F[R+j*E+N*T]=W,add:(F,R,N,j,W)=>F[R+j*E+N*T]+=W,dataOffset:(F,R,N)=>F+N*E+R*T,getCoords:(F,R)=>{const N=Math.floor(F/E);return R[0]=F%E,R[1]=Math.floor(N/D),R[2]=N%D,R}}}if(1===M[0]&&0===M[1]&&2===M[2]){const E=A[1],D=A[0],T=E*D;return{get:(F,R,N,j)=>F[N+R*E+j*T],set:(F,R,N,j,W)=>F[N+R*E+j*T]=W,add:(F,R,N,j,W)=>F[N+R*E+j*T]+=W,dataOffset:(F,R,N)=>R+F*E+N*T,getCoords:(F,R)=>{const N=Math.floor(F/E);return R[0]=N%D,R[1]=F%E,R[2]=Math.floor(N/D),R}}}if(1===M[0]&&2===M[1]&&0===M[2]){const E=A[1],D=A[2],T=E*D;return{get:(F,R,N,j)=>F[N+j*E+R*T],set:(F,R,N,j,W)=>F[N+j*E+R*T]=W,add:(F,R,N,j,W)=>F[N+j*E+R*T]+=W,dataOffset:(F,R,N)=>R+N*E+F*T,getCoords:(F,R)=>{const N=Math.floor(F/E);return R[0]=Math.floor(N/D),R[1]=F%E,R[2]=N%D,R}}}if(2===M[0]&&0===M[1]&&1===M[2]){const E=A[2],D=A[0],T=E*D;return{get:(F,R,N,j)=>F[j+R*E+N*T],set:(F,R,N,j,W)=>F[j+R*E+N*T]=W,add:(F,R,N,j,W)=>F[j+R*E+N*T]+=W,dataOffset:(F,R,N)=>N+F*E+R*T,getCoords:(F,R)=>{const N=Math.floor(F/E);return R[0]=N%D,R[1]=Math.floor(N/D),R[2]=F%E,R}}}if(2===M[0]&&1===M[1]&&0===M[2]){const E=A[2],D=A[1],T=E*D;return{get:(F,R,N,j)=>F[j+N*E+R*T],set:(F,R,N,j,W)=>F[j+N*E+R*T]=W,add:(F,R,N,j,W)=>F[j+N*E+R*T]+=W,dataOffset:(F,R,N)=>N+R*E+F*T,getCoords:(F,R)=>{const N=Math.floor(F/E);return R[0]=Math.floor(N/D),R[1]=N%D,R[2]=F%E,R}}}throw new Error("bad axis order");default:return{get:(E,...D)=>E[h(w,D)],set:(E,...D)=>E[h(w,D)]=D[D.length-1],add:(E,...D)=>E[h(w,D)]+=D[D.length-1],dataOffset:(...E)=>h(w,E),getCoords:(E,D)=>function g(w,A,M){const{dimensions:E,axisOrderFastToSlow:D}=w,T=E.length;let F=A;for(let R=0;Rnew(E||w.defaultCtor)(M)}function h(w,A){const{accessDimensions:M,axisOrderFastToSlow:E}=w,D=M.length-1;let T=M[D]*A[E[D]];for(let F=D-1;F>=0;F--)T=(T+A[E[F]])*M[F];return T}function v(w,A){const M=[];for(let E=0;Ev(M,A)},e.convertToCanonicalAxisIndicesSlowToFast=function _(w){const A=new Int32Array(w.length);for(let M=0;Mv(M,A)}}(mr||(mr={})),function(e){let t;function r(T,F){return loe(F.T,T,F,1)}function o(T){return kR(T)}!function(T){function j(X,H=T.float){return{"@type":"tensor",T:X.create(),space:X,valueType:"tensor",baseType:H}}T.str={"@type":"str",T:"",valueType:"str"},T.ustr={"@type":"str",T:"",valueType:"str",transform:"uppercase"},T.lstr={"@type":"str",T:"",valueType:"str",transform:"lowercase"},T.int={"@type":"int",T:0,valueType:"int"},T.coord={"@type":"coord",T:0,valueType:"float"},T.float={"@type":"float",T:0,valueType:"float"},T.Str=function F(X){var H;return{"@type":"str",T:null!==(H=X?.defaultValue)&&void 0!==H?H:"",transform:X?.transform,valueType:"str"}},T.Int=function R(X=0){return{"@type":"int",T:X,valueType:"int"}},T.Float=function N(X=0){return{"@type":"float",T:X,valueType:"float"}},T.Tensor=j,T.Vector=function W(X,H=T.float){return j(mr.Vector(X,"int"===H["@type"]?Int32Array:Float64Array),H)},T.Matrix=function z(X,H,oe=T.float){return j(mr.ColumnMajorMatrix(X,H,"int"===oe["@type"]?Int32Array:Float64Array),oe)},T.Aliased=function $(X){return X},T.List=function V(X,H,oe=[]){return{"@type":"list",T:oe,separator:X,itemParse:H,valueType:"list"}}}(t=e.Schema||(e.Schema={})),e.is=function n(T){return!!T&&!!T.schema&&!!T.value},e.ValueKind={Present:0,NotPresent:1,Unknown:2},e.Undefined=r,e.ofConst=function i(T,F,R){return loe(T,F,R,0)},e.ofLambda=o,e.range=function s(T,F){return o({value:R=>R+T,rowCount:Math.max(F-T+1,0),schema:t.int})},e.ofArray=function a(T){return H0(T)},e.ofIntArray=function l(T){return H0({array:T,schema:t.int})},e.ofFloatArray=function c(T){return H0({array:T,schema:t.float})},e.ofStringArray=function u(T){return H0({array:T,schema:t.str})},e.ofStringAliasArray=function d(T){return H0({array:T,schema:t.Aliased(t.str)})},e.ofStringListArray=function f(T,F=","){return H0({array:T,schema:t.List(F,R=>R)})},e.ofIntTokens=function p(T){const{count:F,data:R,indices:N}=T;return kR({value:j=>p1(R,N[2*j],N[2*j+1])||0,rowCount:F,schema:t.int})},e.ofFloatTokens=function m(T){const{count:F,data:R,indices:N}=T;return kR({value:j=>V0(R,N[2*j],N[2*j+1])||0,rowCount:F,schema:t.float})},e.ofStringTokens=function h(T){const{count:F,data:R,indices:N}=T;return kR({value:j=>{const W=R.substring(N[2*j],N[2*j+1]);return"."===W||"?"===W?"":W},rowCount:F,schema:t.str})},e.window=function g(T,F,R){return function TFe(e,t,n){return e.isDefined?0===t&&n===e.rowCount?e:e.__array&&bU(e.__array)?function DFe(e,t,n){const r=ER(e.__array,{start:t,end:n}),i=e.valueKind;return H0({array:r,schema:e.schema,valueKind:o=>i(t+o)})}(e,t,n):function PFe(e,t,n){const r=e.value,i=e.valueKind,o=e.areValuesEqual,s=0===t?r:l=>r(l+t),a=n-t;return{schema:e.schema,__array:void 0,isDefined:e.isDefined,rowCount:a,value:s,valueKind:0===t?i:l=>i(l+t),toArray:l=>{const{array:c}=c3(a,l);for(let u=0,d=c.length;uo(l+t,c+t)}}(e,t,n):ce.Undefined(n-t,e.schema)}(T,F,R)},e.view=function y(T,F,R=!0){return function MFe(e,t,n){return 0===e.rowCount||n&&function kFe(e,t){if(e.length!==t)return!1;for(let n=0,r=e.length;ni(t[o])})}(e,t):function NFe(e,t){const n=e.value,r=e.valueKind,i=e.areValuesEqual,s=t.length;return{schema:e.schema,__array:void 0,isDefined:e.isDefined,rowCount:s,value:a=>n(t[a]),valueKind:a=>r(t[a]),toArray:a=>{const{array:l}=c3(s,a);for(let c=0,u=l.length;ci(t[a],t[l])}}(e,t)}(T,F,R)},e.createFirstIndexMap=function v(T){return function IFe(e){const t=new Map;for(let n=0,r=e.rowCount;nt.has(n)?t.get(n):-1}(T)},e.mapToArray=function _(T,F,R){return function FFe(e,t,n){const r=new n(e.rowCount);for(let i=0,o=e.rowCount;iw[T][D],valueKind:T=>typeof w[T][D]>"u"?1:0});return A},e.ofArrays=function a(_,w){var A;const M=Object.create(null),E=Object.keys(_);M._rowCount=0,M._columns=E,M._schema=_;for(const D of E)typeof w[D]<"u"?(M[D]=ce.ofArray({array:w[D],schema:_[D]}),M._rowCount=null===(A=w[D])||void 0===A?void 0:A.length):M[D]=ce.Undefined(M._rowCount,_[D]);return M},e.view=l,e.pick=function c(_,w,A){const M=[];for(let E=0,D=_._rowCount;Ew(T,F));let M=!0;for(let D=0,T=A.length;D0}has(t){return this._set.has(t)}assets(t,n){const r=this._assets.get(t);if(r)for(const i of r)i.dispose();n?this._assets.set(t,n):this._assets.delete(t)}dispose(){this._assets.forEach(t=>{for(const n of t)n.dispose()})}}const NR=Object.prototype.hasOwnProperty;function WFe(e,t){let n=!1;for(const r of Object.keys(t))if(NR.call(t,r)&&t[r]!==e[r]){n=!0;break}return n?Object.assign({},e,t):e}function FR(e,t){if(!e)return!t;if(!t)return!1;const n=Object.keys(e);if(Object.keys(t).length!==n.length)return!1;for(const r of n)if(!NR.call(e,r)||e[r]!==t[r])return!1;return!0}function op(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Array){const t=[];for(let n=0,r=e.length;nt&&(t=e[n]);return t}function OR(e){let t=1/0;for(let n=0,r=e.length;nn&&(n=e[r]);return[t,n]}function foe(e,t=1,n=0){const r=e.length;let i=0;for(let o=n;o=0||(e.push(t),0))}function $x(e,t){const n=e.indexOf(t);if(n<0)return!1;for(let r=n,i=e.length-1;rwindow.setImmediate(e,...t),clearImmediate:e=>window.clearImmediate(e)}:{setImmediate,clearImmediate}:function JFe(){const e=function(){const h=typeof window<"u"&&window,g=typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&self;return h||typeof global<"u"&&global||g}(),t={},n=typeof document<"u"?document:void 0;let i,r=1;function s(h){delete t[h]}function l(h){const g=t[h];s(h),function a(h){const g=h.callback,y=h.args;switch(y.length){case 0:g();break;case 1:g(y[0]);break;case 2:g(y[0],y[1]);break;case 3:g(y[0],y[1],y[2]);break;default:g.apply(void 0,y)}}(g)}return typeof process<"u"&&"[object process]"==={}.toString.call(process)?function c(){i=function(h){process.nextTick(function(){l(h)})}}():function u(){if(e&&e.postMessage&&!e.importScripts){let h=!0;const g=e.onmessage;return e.onmessage=function(){h=!1},e.postMessage("","*"),e.onmessage=g,h}}()?function d(){const h="setImmediate$"+Math.random()+"$",g=function(y){y.source===e&&"string"==typeof y.data&&0===y.data.indexOf(h)&&l(+y.data.slice(h.length))};window.addEventListener?window.addEventListener("message",g,!1):window.attachEvent("onmessage",g),i=function(y){window.postMessage(h+y,"*")}}():typeof MessageChannel<"u"?function f(){const h=new MessageChannel;h.port1.onmessage=function(g){l(g.data)},i=function(g){h.port2.postMessage(g)}}():n&&"onreadystatechange"in n.createElement("script")?function p(){const h=n.documentElement;i=function(g){let y=n.createElement("script");y.onreadystatechange=function(){l(g),y.onreadystatechange=null,h.removeChild(y),y=null},h.appendChild(y)}}():function m(){i=function(h){setTimeout(l,0,h)}}(),{setImmediate:function o(h,...g){return"function"!=typeof h&&(h=new Function(""+h)),t[r]={callback:h,args:g},i(r),r++},clearImmediate:s}}();function eOe(e){EU.setImmediate(e)}const m3={setImmediate:EU.setImmediate,clearImmediate:EU.clearImmediate,immediatePromise:()=>new Promise(eOe),delay:(e,t=void 0)=>new Promise(n=>setTimeout(n,e,t))};let g3=function(){try{return!0}catch{return!1}}(),$n=function(){try{const t=process.env.DEBUG;return"*"===t||"molstar"===t}catch{return!1}}(),It=!1;const y3=[],TU=typeof performance<"u"&&!!performance.mark&&performance.measure&&It;var b3;function iOe(e,t,n=250){const r=moe(e,t,n);return new zR(r,r.root)}function poe(e,t){return DU(t,e)}function hoe(e){return{taskId:e.id,taskName:e.name,message:"",startedTime:0,canAbort:!0,isIndeterminate:!0,current:0,max:0}}function moe(e,t,n){const r={abortRequested:!1,treeAborted:!1,reason:""};return{updateRateMs:n,lastNotified:Bo(),observer:t,abortToken:r,taskId:e.id,root:{progress:hoe(e),children:[]},tryAbort:sOe(r)}}function sOe(e){return t=>{e.abortRequested=!0,e.reason=t||e.reason}}function goe(e){return{progress:{...e.progress},children:e.children.map(goe)}}function yoe(e){return e.progress.canAbort&&e.children.every(yoe)}function DU(e,t){return PU.apply(this,arguments)}function PU(){return PU=le(function*(e,t){b3.markStart(e),t.node.progress.startedTime=Bo();try{const n=yield e.f(t);return b3.markEnd(e),b3.measure(e),t.info.abortToken.abortRequested&&boe(t.info),n}catch(n){throw Ke.isAbort(n)&&(t.isAborted=!0,t.node.children.length>0&&(yield new Promise(r=>{t.onChildrenFinished=r})),e.onAbort&&e.onAbort()),n}}),PU.apply(this,arguments)}function boe(e){throw e.abortToken.treeAborted||(e.abortToken.treeAborted=!0,voe(e.root),xoe(e,Bo())),Ke.Aborted(e.abortToken.reason)}function voe(e){const t=e.progress;t.isIndeterminate=!0,t.canAbort=!1,t.message="Aborting...";for(const n of e.children)voe(n)}function xoe(e,t){e.lastNotified=t;const n=function aOe(e){return{root:goe(e.root),canAbort:yoe(e.root),requestAbort:e.tryAbort}}(e);e.observer(n)}!function(e){function t(s){return`startTask${s.id}`}function n(s){return`endTask${s.id}`}e.markStart=function r(s){TU&&performance.mark(t(s))},e.markEnd=function i(s){TU&&performance.mark(n(s))},e.measure=function o(s){TU&&performance.measure(`\u2733\ufe0f ${s.name}`,t(s),n(s))}}(b3||(b3={}));class zR{checkAborted(){this.info.abortToken.abortRequested&&(this.isAborted=!0,boe(this.info))}get shouldUpdate(){return this.checkAborted(),Bo()-this.lastUpdatedTime>this.info.updateRateMs}updateProgress(t){if(this.checkAborted(),!t)return;const n=this.node.progress;"string"==typeof t?(n.message=t,n.isIndeterminate=!0):(typeof t.canAbort<"u"&&(n.canAbort=t.canAbort),typeof t.message<"u"&&(n.message=t.message),typeof t.current<"u"&&(n.current=t.current),typeof t.max<"u"&&(n.max=t.max),n.isIndeterminate=typeof n.current>"u"||typeof n.max>"u",typeof t.isIndeterminate<"u"&&(n.isIndeterminate=t.isIndeterminate))}update(t,n){if(this.lastUpdatedTime=Bo(),this.updateProgress(t),!n)return xoe(this.info,this.lastUpdatedTime),this.checkAborted(),m3.immediatePromise()}runChild(t,n){var r=this;return le(function*(){r.updateProgress(n);const i={progress:hoe(t),children:[]},o=r.node.children;o.push(i);const s=new zR(r.info,i);try{return yield DU(t,s)}catch(a){if(Ke.isAbort(a)&&r.isAborted)return;throw a}finally{const a=o.indexOf(i);if(a>=0){for(let l=a,c=o.length-1;l0;){s+=c;const d=Bo()-l;u+=d,a+=d,e.shouldUpdate&&(yield i(e,n,s),o=Math.round(u*s/a)+1,l=Bo(),u=0)}return e.shouldUpdate&&(yield i(e,n,s)),n}),kU.apply(this,arguments)}function uOe(e,t,n){return e[t].keys[p].key){u=!1;break}if(l&&u){for(let p=0;p"Aborted"+(d?": "+d:"")}},e.create=o,e.constant=function s(d,f){return o(d,function(){var p=le(function*(m){return f});return function(m){return p.apply(this,arguments)}}())},e.empty=function a(){return o("",function(){var d=le(function*(f){});return function(f){return d.apply(this,arguments)}}())},e.fail=function l(d,f){return o(d,function(){var p=le(function*(m){throw new Error(f)});return function(m){return p.apply(this,arguments)}}())},e.resolveInContext=function c(d,f){return n(d)?f?d.runInContext(f):d.run():d};const u=Kc(0,1073741823)}(Ke||(Ke={})),function(e){function t(r,i=""){const o=r.progress;if(!r.children.length)return o.isIndeterminate?`${i}${o.taskName}: ${o.message}`:`${i}${o.taskName}: [${o.current}/${o.max}] ${o.message}`;const s=i+" |_ ",a=r.children.map(l=>t(l,s));return o.isIndeterminate?`${i}${o.taskName}: ${o.message}\n${a.join("\n")}`:`${i}${o.taskName}: [${o.current}/${o.max}] ${o.message}\n${a.join("\n")}`}e.format=function n(r){return t(r.root)}}(_oe||(_oe={})),function(e){function n(f){const p=f.growBy*f.elementSize;f.currentSize=p,f.currentIndex=0,f.currentChunk=new f.ctor(p),f.allocatedSize+=p,f.chunks[f.chunks.length]=f.currentChunk}function u(f,p){const{ctor:m,chunks:h,currentIndex:g}=f;if(!h.length)return new m(0);if(1===h.length&&(p||g===f.allocatedSize))return h[0];let y=0;for(let w=0,A=h.length-1;w=f.currentSize)v.set(_,x);else for(let w=0,A=_.length;w=f.currentSize&&n(f);const y=f.currentChunk,v=f.currentIndex;return y[v]=p,y[v+1]=m,y[v+2]=h,y[v+3]=g,f.currentIndex+=4,f.elementCount++},e.add3=function i(f,p,m,h){f.currentIndex>=f.currentSize&&n(f);const g=f.currentChunk,y=f.currentIndex;return g[y]=p,g[y+1]=m,g[y+2]=h,f.currentIndex+=3,f.elementCount++},e.add2=function o(f,p,m){f.currentIndex>=f.currentSize&&n(f);const h=f.currentChunk,g=f.currentIndex;return h[g]=p,h[g+1]=m,f.currentIndex+=2,f.elementCount++},e.add=function s(f,p){return f.currentIndex>=f.currentSize&&n(f),f.currentChunk[f.currentIndex]=p,f.currentIndex+=1,f.elementCount++},e.addRepeat=function a(f,p,m){for(let h=0;h=f.currentSize&&n(f),f.currentChunk[f.currentIndex++]=m,f.elementCount++;return f.elementCount},e.addMany=function l(f,p){const{elementSize:m}=f;for(let h=0,g=p.length;h=f.currentSize&&n(f);const{currentChunk:y}=f;for(let v=0;v"u")return g;if("number"==typeof h)return g.currentChunk=new f(h*p),g.allocatedSize=h*p,g.currentSize=g.currentChunk.length,g.chunks[0]=g.currentChunk,g;const y=h;if(y.length%p!=0)throw new Error("initialChunk length must be a multiple of the element size.");return g.currentChunk=y,g.allocatedSize=y.length,g.currentSize=y.length,g.chunks[0]=y,g}}(tt||(tt={}));class fOe{createGroup(t,n){const r=this.id++,i=[t];return this.groups[r]=i,{id:r,keys:i,value:n}}add(t,n){const r=this.getHash(n);if(this.byHash.has(r)){const i=this.byHash.get(r);for(let s=0,a=i.length;s>4;return t=(3735928559^t)+(t<<5),t^=t>>11,t}function Yx(e,t){let n=23;return n=31*n+e|0,n=31*n+t|0,n^=n>>4,n=(3735928559^n)+(n<<5),n^=n>>11,n}function RU(e){let t=0;for(let n=0,r=e.length;n>>0}function NU(e,t){for(let n=0,r=e.length;n=n&&t0&&r>0&&GR(e)>=HR(t)&&HR(e)<=GR(t)}function TOe(e,t){return Xx(e)?!Xx(t)||q0(e)<=q0(t)&&h1(e)>=h1(t):0===Xx(t)}function LU(e,t){const n=q0(e);if(t<=n)return 0;const r=h1(e);return t>=r?r-n:t-n}function DOe(e,t,n){const r=q0(n),i=q0(e);if(t<=r+i)return r;const o=h1(n);return t>=o+i?o:t-i}function Eoe(e,t,n){return BU(LU(e,t),LU(e,n+1))}function POe(e,t){return Ioe(e,t)?BU(Math.max(q0(e),q0(t)),Math.min(h1(e),h1(t))):woe}function kOe(e,t){return Xx(Eoe(e,HR(t),GR(t)))}var Pe;!function(e){e.Empty=woe,e.ofSingleton=t=>Aoe(t,t),e.ofRange=Aoe,e.ofBounds=BU,e.ofLength=xOe,e.is=_Oe,e.has=wOe,e.indexOf=AOe,e.getAt=IOe,e.start=q0,e.end=h1,e.min=HR,e.max=GR,e.size=Xx,e.hashCode=SOe,e.toString=COe,e.areEqual=EOe,e.areIntersecting=Ioe,e.isSubInterval=TOe,e.findPredecessorIndex=LU,e.findPredecessorIndexInInterval=DOe,e.findRange=Eoe,e.intersectionSize=kOe,e.intersect=POe}(Pe||(Pe={}));const x3=[];function MOe(e){return[e]}function ROe(e){return e}function NOe(e){return ip(e),e}function Toe(e,t){if(t2?function mOe(e,t,n,r){let i=23;return i=31*i+e|0,i=31*i+t|0,i=31*i+n|0,i=31*i+r|0,i^=i>>4,i=(3735928559^i)+(i<<5),i^=i>>11,i}(t,e[0],e[t-1],e[t>>1]):function hOe(e,t,n){let r=23;return r=31*r+e|0,r=31*r+t|0,r=31*r+n|0,r^=r>>4,r=(3735928559^r)+(r<<5),r^=r>>11,r}(t,e[0],e[t-1]):0}function jOe(e){const t=e.length;return t>5?`[${e[0]}, ${e[1]}, ..., ${e[t-1]}], length ${t}`:`[${e.join(", ")}]`}function koe(e,t){const n=e.length;return 0===n?-1:e[0]<=t&&t<=e[n-1]?Noe(e,t,0,n):-1}function UOe(e,t,n){return Moe(e,t,Pe.start(n),Pe.end(n))}function Moe(e,t,n,r){return 0===e.length||r<=n?-1:e[n]<=t&&t<=e[r-1]?Noe(e,t,n,r):-1}function zOe(e,t){return koe(e,t)>=0}function Roe(e,t){if(e===t)return!0;let n=e.length;if(n!==t.length||e[0]!==t[0]||e[n-1]!==t[n-1])return!1;if(Doe(e))return!0;n--;for(let r=1;re[n-1]?n:Foe(e,t,0,n)}function VOe(e,t,n){const r=Pe.start(n),i=Pe.end(n),o=e[r];return t<=o?r:i>r&&t>e[i-1]?i:t-o<=11?function GOe(e,t,n,r){for(let i=n;io){for(let l=i;l<=o;l++)if(t===e[l])return l;return-1}const s=i+o>>1,a=e[s];if(ta))return s;i=s+1}}return-1}function Foe(e,t,n,r){let i=n,o=r-1;for(;io){for(let l=i;l<=o;l++)if(t<=e[l])return l;return o+1}const s=i+o>>1,a=e[s];if(ta))return s;i=s+1}}return i>o?o+1:e[i]>=t?i:i+1}function qOe(e,t){if(e===t)return!0;let{startI:n,startJ:r,endI:i,endJ:o}=Zx(e,t);for(;na))return!0;r++}}return!1}function WOe(e,t){if(e===t)return!0;const n=t.length;let{startI:r,startJ:i,endI:o,endJ:s}=Zx(e,t);if(s-ic?i++:(r++,i++,a++)}return a===n}function Ooe(e,t){if(e===t)return e;const n=e.length,r=t.length;if(0===n)return t;if(0===r)return e;if(e[0]>t[0])return Ooe(t,e);const{startI:i,startJ:o,endI:s,endJ:a}=Zx(e,t),l=zU(e,t,i,o,s,a);if(l===n&&l===r||l===r)return e;if(l===n)return t;const c=new Int32Array(n+r-l);let u=0,d=0,f=0;for(u=0;ut[d];)c[f++]=t[d++];for(;um?(c[f++]=m,d++):(c[f++]=p,u++,d++)}for(;uu?a++:(s++,a++,l++)}return l}function YOe(e,t){if(e===t)return e;const{startI:n,startJ:r,endI:i,endJ:o}=Zx(e,t),s=zU(e,t,n,r,i,o),a=e.length,l=t.length;if(!s)return x3;if(s===a&&s===l||s===l)return t;if(s===a)return e;const c=new Int32Array(s);let u=0,d=n,f=r;for(;dm||(c[u++]=p,d++),f++)}return c}function XOe(e,t){if(e===t)return x3;const n=e.length,{startI:r,startJ:i,endI:o,endJ:s}=Zx(e,t);let a=r,l=i,c=0;for(;ap?l++:(a++,l++,c++)}if(!c)return e;if(c>=n)return x3;const u=new Int32Array(n-c);let d=0;for(let f=0;fp||a++,l++)}for(;ap?a++:(s++,a++,l++)}if(!l)return x3;if(l===e.length)return OU(0,e.length-1);const u=new Int32Array(l);let d=0;for(s=n,a=r;sp||(u[d++]=s,s++),a++)}return u}const W0={startI:0,startJ:0,endI:0,endJ:0};function Zx(e,t){const n=e.length,r=t.length,i=n/r;return n>=128||r>=128||i<=.34||i>=2.99?(W0.startI=Kx(e,jU(t)),W0.startJ=Kx(t,jU(e)),W0.endI=Kx(e,UU(t)),W0.endJ=Kx(t,UU(e))):(W0.startI=0,W0.startJ=0,W0.endI=n,W0.endJ=r),W0}var rt;!function(e){e.Empty=x3,e.ofUnsortedArray=NOe,e.ofSingleton=MOe,e.ofSortedArray=ROe,e.ofRange=Toe,e.ofBounds=(t,n)=>Toe(t,n-1),e.is=FOe,e.isRange=Doe,e.has=zOe,e.indexOf=koe,e.indexOfInInterval=UOe,e.indexOfInRange=Moe,e.start=jU,e.end=UU,e.min=OOe,e.max=BOe,e.size=Poe,e.hashCode=LOe,e.toString=jOe,e.areEqual=Roe,e.areIntersecting=qOe,e.isSubset=WOe,e.union=Ooe,e.intersect=YOe,e.subtract=XOe,e.findPredecessorIndex=Kx,e.findPredecessorIndexInInterval=VOe,e.findRange=HOe,e.intersectionSize=$Oe,e.deduplicate=KOe,e.indicesOf=ZOe}(rt||(rt={}));const ng=Pe.Empty,QOe=Pe.ofSingleton,JOe=Pe.ofRange,eBe=Pe.ofBounds;function Lh(e){return e.length?rt.isRange(e)?Pe.ofRange(e[0],e[e.length-1]):e:ng}function Qx(e){return Pe.is(e)?Pe.size(e):rt.size(e)}function tBe(e,t){return Pe.is(e)?Pe.has(e,t):rt.has(e,t)}function nBe(e,t){return Pe.is(e)?Pe.indexOf(e,t):rt.indexOf(e,t)}function VU(e,t){return Pe.is(e)?Pe.getAt(e,t):e[t]}function uw(e){return Pe.is(e)?Pe.min(e):rt.min(e)}function dw(e){return Pe.is(e)?Pe.max(e):rt.max(e)}function rBe(e){return Pe.is(e)?Pe.start(e):rt.start(e)}function iBe(e){return Pe.is(e)?Pe.end(e):rt.end(e)}function oBe(e){return Pe.is(e)?Pe.hashCode(e):rt.hashCode(e)}function aBe(e,t){return Pe.is(e)?Pe.is(t)?Pe.areEqual(e,t):Boe(e,t):Pe.is(t)?Boe(t,e):rt.areEqual(e,t)}function lBe(e,t){return Pe.is(e)?Pe.is(t)?Pe.areIntersecting(e,t):Loe(t,e):Pe.is(t)?Loe(e,t):rt.areIntersecting(e,t)}function cBe(e,t){return Pe.is(e)?Pe.is(t)?Pe.isSubInterval(e,t):function bBe(e,t){const n=Pe.min(e),r=Pe.max(e);if(r-n+1==0)return!1;const i=rt.min(t),o=rt.max(t);return i>=n&&o<=r}(e,t):Pe.is(t)?function yBe(e,t){const n=Pe.min(t),r=Pe.max(t);if(r-n+1==0)return!0;const i=rt.min(e),o=rt.max(e);if(no)return!1;const s=rt.findRange(e,n,r);return Pe.size(s)===Pe.size(t)}(e,t):rt.isSubset(e,t)}function uBe(e,t){return Pe.is(e)?Pe.findPredecessorIndex(e,t):rt.findPredecessorIndex(e,t)}function dBe(e,t,n){return Pe.is(e)?Pe.findPredecessorIndexInInterval(e,t,n):rt.findPredecessorIndexInInterval(e,t,n)}function fBe(e,t,n){return Pe.is(e)?Pe.findRange(e,t,n):rt.findRange(e,t,n)}function pBe(e,t){return Pe.is(e)?Pe.is(t)?Pe.intersectionSize(e,t):Uoe(t,e):Pe.is(t)?Uoe(e,t):rt.intersectionSize(e,t)}function hBe(e,t){return Pe.is(e)?Pe.is(t)?function _Be(e,t){if(Pe.areEqual(e,t))return e;const n=Pe.size(e),r=Pe.size(t);if(!r)return e;if(!n)return t;const i=Pe.min(e),o=Pe.min(t);if(function vBe(e,t){const n=Qx(e),r=Qx(t);return 0===n&&0===r||n>0&&r>0&&dw(e)>=uw(t)&&uw(e)<=dw(t)}(e,t))return Pe.ofRange(Math.min(i,o),Math.max(Pe.max(e),Pe.max(t)));let s,a,l,c;i=dw(t):0===Qx(t)}(t,e))return t;const r=Pe.min(t),i=Pe.max(t),o=rt.findRange(e,r,i),s=Pe.start(o),a=Pe.end(o),l=new Int32Array(s+(e.length-a)+n);let c=0;for(let u=0;um||(l++,u++),d++)}if(0===l)return ng;if(l===i&&l===o)return e;const f=new Int32Array(l);for(c=0,u=0,d=s;um||(f[c++]=d,u++),d++)}return Lh(f)}var Ve,En,sp,qR,Cd,jh,nc,Tt,fw,ko;function Voe(e){const t=rt.ofSortedArray(e),n=rt.max(t),r=new Int32Array(n);for(let i=0,o=e.length-1;i=Ve.max(e)?-1:Ve.findPredecessorIndex(e,n-1);return Ve.findRange(t,Ve.getAt(e,i),Ve.getAt(e,i+1)-1)}!function(e){e.Empty=ng,e.ofSingleton=QOe,e.ofRange=JOe,e.ofBounds=eBe,e.ofSortedArray=Lh,e.has=tBe,e.indexOf=nBe,e.getAt=VU,e.min=uw,e.max=dw,e.start=rBe,e.end=iBe,e.size=Qx,e.hashCode=oBe,e.areEqual=aBe,e.areIntersecting=lBe,e.isSubset=cBe,e.union=hBe,e.intersect=mBe,e.indexedIntersect=EBe,e.subtract=gBe,e.findPredecessorIndex=uBe,e.findPredecessorIndexInInterval=dBe,e.findRange=fBe,e.intersectionSize=pBe,e.forEach=function t(a,l,c){return function ABe(e,t,n){if(Pe.is(e)){const r=Pe.min(e);for(let i=r,o=Pe.max(e);i<=o;i++)t(i,i-r,n)}else for(let r=0,i=e.length;rl.push(c)),l},e.toString=function s(a){return function sBe(e){return Pe.is(e)?Pe.toString(e):rt.toString(e)}(a)}}(Ve||(Ve={}));class MBe{move(){for(;this.hasNext;){if(this.updateValue()){this.value.index=this.segmentMin++,this.hasNext=this.segmentMax>=this.segmentMin&&Pe.size(this.setRange)>0;break}this.updateSegmentRange()}return this.value}updateValue(){const n=Ve.findPredecessorIndexInInterval(this.set,this.segments[this.segmentMin+1],this.setRange);return this.value.start=Pe.start(this.setRange),this.value.end=n,this.setRange=Pe.ofBounds(n,Pe.end(this.setRange)),n>this.value.start}updateSegmentRange(){const t=Pe.min(this.setRange),n=Pe.max(this.setRange);n=this.segmentMin)}setSegment(t){this.setRange=Pe.ofBounds(t.start,t.end),this.updateSegmentRange()}constructor(t,n,r,i){this.segments=t,this.segmentMap=n,this.set=r,this.segmentMin=0,this.segmentMax=0,this.setRange=Pe.Empty,this.value={index:0,start:0,end:0},this.hasNext=!1,this.setRange=i,this.updateSegmentRange()}}function RBe(e,t,n){const r=typeof n<"u"?Pe.ofBounds(n.start,n.end):Pe.ofBounds(0,Ve.size(t));return new MBe(e.offsets,e.index,t,r)}!function(e){e.create=Voe,e.ofOffsets=TBe,e.count=DBe,e.getSegment=PBe,e.projectValue=kBe,e.transientSegments=RBe}(En||(En={}));class FBe{remove(t){const{prev:n,next:r}=this,i=n[t],o=r[t];i>=0&&(r[i]=o,n[t]=-1),o>=0&&(n[o]=i,r[t]=-1),t===this.head&&(this.head=i<0?o:i)}has(t){return this.prev[t]>=0||this.next[t]>=0||this.head===t}constructor(t){this.head=t>0?0:-1,this.prev=new Int32Array(t),this.next=new Int32Array(t);for(let n=0;n0,this.xs=t,this.index=-1,this.lastValue=t.length>0?t[0]:void 0}}class Hoe{move(){return++this.value,this.hasNext=this.value=t}}class BBe{move(){return this.hasNext=!1,this.value}constructor(t){this.value=t,this.hasNext=!0}}class LBe{move(){const t=this.f(this.base.move());return this.hasNext=this.base.hasNext,t}constructor(t,n){this.base=t,this.f=n,this.hasNext=!1,this.hasNext=t.hasNext}}class jBe{move(){const t=this.next;return this.hasNext=this.findNext(),t}findNext(){for(;this.base.hasNext;)if(this.next=this.base.move(),this.p(this.next))return!0;return!1}constructor(t,n){this.base=t,this.p=n,this.hasNext=this.findNext()}}function Goe(e,t,n,r,i){const{b:o,offset:s}=e,a=[];for(let l=0,c=t.length;l1&&Goe(e,a,n,r-1,i)}!function(e){e.Empty=new Hoe(0,-1),e.Array=function t(a){return new OBe(a)},e.Value=function n(a){return new BBe(a)},e.Range=function r(a,l){return new Hoe(a,l)},e.map=function i(a,l){return new LBe(a,l)},e.filter=function o(a,l){return new jBe(a,l)},e.forEach=function s(a,l,c){for(;a.hasNext;)if(l(a.move(),c))return c;return c}}(qR||(qR={})),function(e){e.areEqual=function t(d,f){if(d===f)return!0;if(d.vertexCount!==f.vertexCount||d.edgeCount!==f.edgeCount)return!1;const{a:p,b:m,offset:h}=d,{a:g,b:y,offset:v}=f;for(let x=0,_=d.a.length;x<_;x++)if(p[x]!==g[x])return!1;for(let x=0,_=d.b.length;x<_;x++)if(m[x]!==y[x])return!1;for(let x=0,_=d.offset.length;x<_;x++)if(h[x]!==v[x])return!1;for(const x of Object.keys(d.edgeProps)){const _=d.edgeProps[x],w=f.edgeProps[x];if(!w)return!1;for(let A=0,M=_.length;Ap&&(m=p,h=f);const g=gf(m,h);return!this.included.has(g)&&(this.included.add(g),this.xs[this.xs.length]=m,this.ys[this.ys.length]=h,!0)}getGraph(){return a(this.vertexCount,this.xs,this.ys)}getEdgeBuiler(){return new i(this.vertexCount,this.xs,this.ys)}constructor(f){this.vertexCount=f,this.xs=[],this.ys=[],this.included=new Set}},e.fromVertexPairs=a,e.induceByVertices=function l(d,f,p){const{b:m,offset:h,vertexCount:g,edgeProps:y}=d,v=new Int32Array(g);for(let F=0,R=f.length;FF&&0!==v[m[R]]&&x++;const _=new Int32Array(f.length+1),w=new Int32Array(2*x),A=new Int32Array(2*x),M=new Int32Array(2*x);let E=0,D=0;for(let F=0;F0;){const x=y.pop(),_=p[x];for(let w=h[x],A=h[x+1];w=0&&(y.push(v.head),p[v.head]=++m,v.remove(v.head))}return{componentCount:f,componentIndex:p}},e.areVertexSetsConnected=function u(d,f,p,m){if(rt.areIntersecting(f,p))return!0;if(m<1)return!1;const h=new Set;for(let g=0,y=f.length;gn.substring(r[2*a],r[2*a+1]):"int"===o?a=>p1(n,r[2*a],r[2*a+1])||0:a=>V0(n,r[2*a],r[2*a+1])||0;return{schema:t,__array:void 0,isDefined:!0,rowCount:i,value:s,valueKind:a=>0,toArray:a=>tc(i,s,a),areValuesEqual:qoe(e)}}function qoe(e){const{data:t,indices:n}=e;return function(r,i){const o=n[2*r],s=n[2*i],a=n[2*r+1]-o;if(a!==n[2*i+1]-s)return!1;for(let l=0;lr[i]}}function rg(e,t,n){return function QBe(e,t,n){const r=Object.create(null);for(const i of Object.keys(e))r[i]=tLe(i,e[i],t,n);return wU.ofTables(t.header,e,r)}(e,t,n)}function YBe(e){switch(e.valueType){case"str":return(t,n,r)=>function XBe(e,t,n,r){return{schema:e,__array:t.__array,isDefined:t.isDefined,rowCount:t.rowCount,value:"lowercase"===e.transform?i=>n(i).toLowerCase():"uppercase"===e.transform?i=>n(i).toUpperCase():n,valueKind:t.valueKind,areValuesEqual:t.areValuesEqual,toArray:"lowercase"===e.transform?i=>Array.from(r(i)).map(o=>o.toLowerCase()):"uppercase"===e.transform?i=>Array.from(r(i)).map(o=>o.toUpperCase()):r}}(e,t,t.str,t.toStringArray);case"int":return(t,n,r)=>$oe(e,t,t.int,t.toIntArray);case"float":return(t,n,r)=>$oe(e,t,t.float,t.toFloatArray);case"list":throw new Error("Use createListColumn instead.");case"tensor":throw new Error("Use createTensorColumn instead.")}}function $oe(e,t,n,r){return{schema:e,__array:t.__array,isDefined:t.isDefined,rowCount:t.rowCount,value:n,valueKind:t.valueKind,areValuesEqual:t.areValuesEqual,toArray:r}}function KBe(e,t,n){const r=e.separator,i=e.itemParse,o=t.getField(n),s=o?l=>o.str(l).split(r).map(c=>i(c.trim())).filter(c=>!!c):l=>[];return{schema:e,__array:void 0,isDefined:!!o,rowCount:t.rowCount,value:s,valueKind:o?o.valueKind:()=>1,areValuesEqual:(l,c)=>Ru(s(l),s(c)),toArray:l=>tc(t.rowCount,s,l)}}function ZBe(e,t,n){const r=e.space,i=t.fieldNames.includes(`${n}[0]`)||t.fieldNames.includes(`${n}[0][0]`)||t.fieldNames.includes(`${n}[0][0][0]`),o=i?0:1,s=t.fieldNames.includes(`${n}_1`)||t.fieldNames.includes(`${n}_11`)||t.fieldNames.includes(`${n}_111`)?"underscore":"brackets",a=function GBe(e,t,n,r){const i=n?0:1;switch(t){case 1:return"brackets"===r?o=>`${e}[${o+i}]`:o=>`${e}_${o+i}`;case 2:return"brackets"===r?(o,s)=>`${e}[${o+i}][${s+i}]`:(o,s)=>`${e}_${o+i}${s+i}`;case 3:return"brackets"===r?(o,s,a)=>`${e}[${o+i}][${s+i}][${a+i}]`:(o,s,a)=>`${e}_${o+i}${s+i}${a+i}`;default:throw new Error("Tensors with rank > 3 or rank 0 are currently not supported.")}}(n,r.rank,i,s),l=t.getField(a(o,o,o))||ce.Undefined(t.rowCount,e),c=d=>function qBe(e,t,n,r){const i=t.create();if(1===t.rank){const o=t.dimensions[0];for(let s=0;s 3 or rank 0 are currently not supported.");{const o=t.dimensions[0],s=t.dimensions[1],a=t.dimensions[2];for(let l=0;lmr.areEqualExact(c(d),c(f)),toArray:d=>tc(t.rowCount,c,d)}}!function(e){e.create=function t(n,r){const{name:i}=n,o=new UBe;return{descriptor:n,formatRegistry:o,isApplicable:s=>o.isApplicable(s),get(s){const a=r?.asDynamic?s._dynamicPropertyData:s._staticPropertyData;if(a[i])return a[i];if(s.customProperties.has(n))return;const l=o.get(s.sourceData.kind);return l?(a[i]=l(s),s.customProperties.add(n),a[i]):void 0},set(s,a){r?.asDynamic?s._dynamicPropertyData[i]=a:s._staticPropertyData[i]=a},delete(s){r?.asDynamic?delete s._dynamicPropertyData[i]:delete s._staticPropertyData[i]}}}}(jh||(jh={})),function(e){e.Descriptor={name:"index_pair_bonds"},e.Provider=jh.create(e.Descriptor,{asDynamic:!0}),e.DefaultProps={maxDistance:-1},e.fromData=function t(r,i={}){const o={...e.DefaultProps,...i},{pairs:s,count:a}=r;return{bonds:zBe(s.indexA.toArray(),s.indexB.toArray(),{key:s.key&&s.key.toArray(),operatorA:s.operatorA&&s.operatorA.toArray(),operatorB:s.operatorB&&s.operatorB.toArray(),order:s.order&&s.order.toArray(),distance:s.distance&&s.distance.toArray(),flag:s.flag&&s.flag.toArray()},a),maxDistance:o.maxDistance}},e.getEdgeIndexForOperators=function n(r,i,o,s,a){let l,c,u,d;i0?o[s[0]].rowCount:0,name:i,fieldNames:s,getField:a=>o[a]}}e.empty=function t(i){return{rowCount:0,name:i,fieldNames:[],getField(o){}}},e.ofFields=n,e.ofTable=function r(i,o){const s={};for(const a of o._columns)s[a]=Tt.ofColumn(o[a]);return n(i,s)}}(ll||(ll={})),function(e){function n(a){const l=a.length,c=p=>{const m=a[p];return m&&"."!==m&&"?"!==m?m:""},u=p=>{const m=a[p];return p1(m,0,m.length)||0},d=p=>{const m=a[p];return V0(m,0,m.length)||0};return{__array:void 0,binaryEncoding:void 0,isDefined:!0,rowCount:l,str:c,int:u,float:d,valueKind:p=>{const m=a[p],h=m.length;if(h>1)return 0;if(0===h)return 1;const g=m.charCodeAt(0);return 46===g?1:63===g?2:0},areValuesEqual:(p,m)=>a[p]===a[m],toStringArray:p=>p?tc(l,c,p):a,toIntArray:p=>tc(l,u,p),toFloatArray:p=>tc(l,d,p)}}function o(a){const{rowCount:l,valueKind:c,areValuesEqual:u,isDefined:d}=a;let f,p,m;switch(a.schema.valueType){case"float":case"int":f=g=>""+a.value(g),p=a.value,m=a.value;break;case"str":f=a.value,p=g=>{const y=a.value(g);return p1(y,0,y.length)||0},m=g=>{const y=a.value(g);return V0(y,0,y.length)||0};break;case"list":const{separator:h}=a.schema;f=g=>a.value(g).join(h),p=g=>NaN,m=g=>NaN;break;default:throw new Error(`unsupported valueType '${a.schema.valueType}'`)}return{__array:void 0,binaryEncoding:void 0,isDefined:d,rowCount:l,str:f,int:p,float:m,valueKind:c,areValuesEqual:u,toStringArray:h=>tc(l,f,h),toIntArray:h=>tc(l,p,h),toFloatArray:h=>tc(l,m,h)}}e.ofString=function t(a){return n([a])},e.ofStrings=n,e.ofNumbers=function r(a){const l=a.length,c=p=>""+a[p],u=p=>a[p],f=p=>!p||p.array&&a instanceof p.array?a:tc(l,u,p);return{__array:void 0,binaryEncoding:void 0,isDefined:!0,rowCount:l,str:c,int:u,float:u,valueKind:p=>0,areValuesEqual:(p,m)=>a[p]===a[m],toStringArray:p=>tc(l,c,p),toIntArray:f,toFloatArray:f}},e.ofTokens=function i(a){const{data:l,indices:c,count:u}=a,d=h=>{const g=l.substring(c[2*h],c[2*h+1]);return"."===g||"?"===g?"":g},f=h=>p1(l,c[2*h],c[2*h+1])||0,p=h=>V0(l,c[2*h],c[2*h+1])||0;return{__array:void 0,binaryEncoding:void 0,isDefined:!0,rowCount:u,str:d,int:f,float:p,valueKind:h=>{const g=c[2*h],y=c[2*h+1]-g;if(y>1)return 0;if(0===y)return 1;const v=l.charCodeAt(g);return 46===v?1:63===v?2:0},areValuesEqual:qoe(a),toStringArray:h=>tc(u,d,h),toIntArray:h=>tc(u,f,h),toFloatArray:h=>tc(u,p,h)}},e.ofColumn=o,e.ofUndefined=function s(a,l){return o(ce.Undefined(a,l))}}(Tt||(Tt={})),function(e){function t(i){return i.replace(".","_").replace(/\[/,"_").replace(/(\[|\])/g,"")}e.canonical=t,e.equal=function n(i,o){return t(i)===t(o)},e.create=function r(i,o,s=!1){const a=`${i}${o?`.${o}`:""}`;return s?t(a):a}}(fw||(fw={}));class Yoe{constructor(t,n,r){this._isDefined=r;const i=Object.keys(n);this._rowCount=t.rowCount,this._columns=i,this._schema=n;const o=Object.create(null);for(const s of i)Object.defineProperty(this,s,{get:function(){if(o[s])return o[s];const a=n[s];if("list"===a.valueType)o[s]=KBe(a,t,s);else if("tensor"===a.valueType)o[s]=ZBe(a,t,s);else{const l=YBe(a),c=t.getField(s);o[s]=c?l(c,t,s):ce.Undefined(t.rowCount,a)}return o[s]},enumerable:!0,configurable:!1})}}function eLe(e,t,n,r){const i=fw.create(t,e),o=fw.canonical(i);if(o in n)return n[o];if(r&&i in r)for(const s of r[i]){const a=fw.canonical(s);if(a in n)return n[a]}}function tLe(e,t,n,r){let i=n.categories[e];if(r){const o=function JBe(e){const t=Object.create(null);for(const n of Object.keys(e.categories))for(const r of e.categories[n].fieldNames)t[fw.create(n,r,!0)]=e.categories[n].getField(r);return t}(n),s=Object.create(null),a=[];let l=0;for(const c of Object.keys(t)){const u=eLe(c,e,o,r);u&&(s[c]=u,a.push(c),l=u.rowCount)}i={rowCount:l,name:e,fieldNames:[...a],getField:c=>s[c]}}return new Yoe(i||ll.empty(e),t,!!i)}function pw(e,t,n){const r=new Float32Array(e);for(let i=0;i(t=Math.abs(t))?(t/=e,e*Math.sqrt(1+t*t)):t>0?(e/=t,t*Math.sqrt(1+e*e)):0}!function(e){function n(r,i,o){const s=function lLe(e){const t="number"==typeof e?function oLe(e){switch(e){case 1146:return 146;case 1148:return 149;case 1155:return 157;case 1160:return 163;case 1161:return 165;case 1166:return 171;case 1167:return 173;case 1003:return 237;case 1004:return 238;case 1005:return 239;case 2005:return 240;case 3005:return 241;case 4005:return 242;case 5005:return 243;case 1006:return 244;case 1007:return 245;case 1008:return 246;case 1009:return 247;case 1010:return 248;case 1011:return 249;case 1012:return 250;case 1013:return 251;case 1014:return 252;case 2014:return 253;case 3014:return 254;case 1015:return 255;case 1017:return 256;case 2017:return 257;case 1018:return 258;case 2018:return 259;case 3018:return 260;case 1020:return 261;case 1021:return 262;case 1022:return 263;case 1023:return 264;case 1059:return 265;case 1094:return 266;case 1197:return 267}let t=0;return e>146&&++t,e>148&&++t,e>155&&++t,e>160&&++t,e>161&&++t,e>166&&++t,e>167&&++t,e-1+t}(e):_3[e];return typeof t>"u"||typeof Xoe[t]>"u"?-1:t}(r);if(s<0)return console.warn(`Unknown spacegroup '${r}', returning a 'P 1' with cellsize [1, 1, 1]`),e.Zero;const a=i[0]*i[1]*i[2],l=o[0],c=o[1],u=o[2],d=i[0],f=i[1],p=i[2],m=Math.cos(c),h=(Math.cos(l)-Math.cos(c)*Math.cos(u))/Math.sin(u),g=Math.sqrt(1-m*m-h*h),y=[d,0,0],v=[Math.cos(u)*f,Math.sin(u)*f,0],x=[m*p,h*p,g*p],_=fe.ofRows([[y[0],v[0],x[0],0],[0,v[1],x[1],0],[0,0,x[2],0],[0,0,0,1]]);return{index:s,size:i,volume:a,anglesInRadians:o,toFractional:fe.invert(fe.zero(),_),fromFractional:_}}e.Zero=n("P 1",C.create(1,1,1),C.create(Math.PI/2,Math.PI/2,Math.PI/2)),e.isZero=function t(r){return!r||0===r.index&&1===r.size[0]&&1===r.size[1]&&1===r.size[1]},e.create=n}(Qc||(Qc={})),function(e){function t(g){const y=iLe[g.index].map(_=>function d(g){return fe.ofRows([qU[g[0]],qU[g[1]],qU[g[2]],[0,0,0,1]])}(rLe[_]));return{name:Xoe[g.index],num:aLe[g.index],cell:g,operators:y}}e.ZeroP1=t(Qc.Zero),e.create=t;const n=C(),r=fe();function i(g,y,v,x,_,w){return C.set(n,v,x,_),fe.fromTranslation(r,n),fe.mul(w,fe.mul(w,fe.mul(w,g.cell.fromFractional,r),g.operators[y]),g.cell.toFractional)}e.setOperatorMatrix=i,e.getSymmetryOperator=function o(g,y,v,x,_){const w=i(g,y,v,x,_,fe.zero());return ko.create(`${y+1}_${5+v}${5+x}${5+_}`,w,{hkl:C.create(v,x,_),spgrOp:y})};const s=C(),a=C(),l=C(),c=C();function p(g,y,v){const x=[];if(g>0?x.push("+X"):g<0&&x.push("-X"),y>0?x.push("+Y"):y<0&&x.push("-Y"),v>0?x.push("+Z"):v<0&&x.push("-Z"),1===x.length)return"+"===x[0].charAt(0)?x[0].substr(1):x[0];if(2===x.length){const _=x[0].charAt(0),w=x[1].charAt(0);if("+"===_)return`${x[0].substr(1)}${x[1]}`;if("+"===w)return`${x[1].substr(1)}${x[0]}`}throw new Error(`unknown rotation '${x}', ${g} ${y} ${v}`)}function m(g){switch(g){case.5:return"1/2";case 1/4:return"1/4";case 3/4:return"3/4";case 1/3:return"1/3";case 2/3:return"2/3";case 1/6:return"1/6";case 5/6:return"5/6"}return""}function h(g,y){return""===y?g:g.length>2?`${g}+${y}`:"-"===g.charAt(0)?`${y}${g}`:`${y}+${g}`}e.getSymmetryOperatorRef=function u(g,y,v,x,_,w){const A=fe.zero();C.set(n,v,x,_),C.floor(s,w),fe.copy(A,g.operators[y]),C.floor(a,C.transformMat4(a,w,A)),fe.getTranslation(c,A),C.sub(c,c,a),C.add(c,c,s),C.add(c,c,n),fe.setTranslation(A,c),fe.mul(A,g.cell.fromFractional,A),fe.mul(A,A,g.cell.toFractional),C.sub(l,a,s);const M=v-l[0],E=x-l[1],D=_-l[2];return ko.create(`${y+1}_${5+M}${5+E}${5+D}`,A,{hkl:C.create(M,E,D),spgrOp:y})},e.getOperatorXyz=function f(g){return[h(p(g[0],g[4],g[8]),m(g[12])),h(p(g[1],g[5],g[9]),m(g[13])),h(p(g[2],g[6],g[10]),m(g[14]))].join(",")}}(wd||(wd={})),function(e){e.add=function t(o,s,a){o.squaredDistances[o.count]=a,o.indices[o.count++]=s},e.reset=function n(o){o.count=0},e.create=function r(){return{count:0,indices:[],squaredDistances:[]}},e.copy=function i(o,s){for(let a=0;a>16?V:-V,e[u*t+f]=$;for(p=0;p<2;p++)for(d=0;d0?N>l&&(l=N):N>c&&(c=N),C.projectPointOnVector(m,C.fromArray(m,s,T),y.dirB,g);const j=C.dot(y.dirB,C.normalize(h,C.sub(h,m,g))),W=C.distance(m,g);j>0?W>u&&(u=W):W>d&&(d=W),C.projectPointOnVector(m,C.fromArray(m,s,T),y.dirC,g);const z=C.dot(y.dirC,C.normalize(h,C.sub(h,m,g))),$=C.distance(m,g);z>0?$>f&&(f=$):$>p&&(p=$)}const v=C.setMagnitude(C(),y.dirA,(l+c)/2),x=C.setMagnitude(C(),y.dirB,(u+d)/2),_=C.setMagnitude(C(),y.dirC,(f+p)/2),w=C.isFinite(v),A=C.isFinite(x),M=C.isFinite(_),E=C(),D=function(T,F,R){C.copy(i,g),w&&C.scaleAndAdd(i,i,y.dirA,T),A&&C.scaleAndAdd(i,i,y.dirB,F),M&&C.scaleAndAdd(i,i,y.dirC,R),C.add(E,E,i)};return D(l,u,f),D(l,u,-p),D(l,-d,-p),D(l,-d,f),D(-c,-d,-p),D(-c,-d,f),D(-c,u,f),D(-c,u,-p),C.scale(E,E,1/8),rc.create(E,v,x,_)}e.calculateBoxAxes=o}(Uh||(Uh={})),function(e){function t(R){return void 0!==R.extrema}function n(R,N){return{center:R,radius:N}}function a(R,N){return void 0!==R.extrema?(R.extrema.length=0,R.extrema.push(...N)):R.extrema=N,R}e.hasExtrema=t,e.create=n,e.zero=function r(){return{center:C(),radius:0}},e.clone=function i(R){const N=n(C.clone(R.center),R.radius);return t(R)&&(N.extrema=R.extrema.map(j=>C.clone(j))),N},e.set=function o(R,N,j){return C.copy(R.center,N),R.radius=j,R},e.copy=function s(R,N){return C.copy(R.center,N.center),R.radius=N.radius,t(N)&&a(R,N.extrema.map(j=>C.clone(j))),R},e.setExtrema=a,e.computeBounding=function l(R){const{x:N,y:j,z:W,indices:z}=R;let $=0,V=0,X=0,H=0;const oe=Ve.size(z);for(let te=0;te0&&($/=oe,V/=oe,X/=oe);for(let te=0;teH&&(H=ee)}return{center:C.create($,V,X),radius:Math.sqrt(H)}},e.transform=function c(R,N,j){return C.transformMat4(R.center,N.center,j),R.radius=N.radius*fe.getMaxScaleOnAxis(j),t(N)&&a(R,N.extrema.map(W=>C.transformMat4(C(),W,j))),R},e.translate=function u(R,N,j){return C.add(R.center,N.center,j),t(N)&&a(R,N.extrema.map(W=>C.add(C(),W,j))),R},e.toArray=function d(R,N,j){return C.toArray(R.center,N,j),N[j+3]=R.radius,N},e.fromArray=function f(R,N,j){return C.fromArray(R.center,N,j),R.radius=N[j+3],R},e.fromBox3D=function p(R,N){return C.scale(R.center,C.add(R.center,N.max,N.min),.5),R.radius=C.distance(R.center,N.max),e.setExtrema(R,[C.create(N.min[0],N.min[1],N.min[2]),C.create(N.max[0],N.max[1],N.max[2]),C.create(N.max[0],N.min[1],N.min[2]),C.create(N.min[0],N.max[1],N.max[2]),C.create(N.min[0],N.min[1],N.max[2]),C.create(N.max[0],N.min[1],N.max[2]),C.create(N.max[0],N.max[1],N.min[2]),C.create(N.min[0],N.max[1],N.min[2])]),R},e.fromAxes3D=function m(R,N){return C.copy(R.center,N.origin),R.radius=Math.max(C.magnitude(N.dirA),C.magnitude(N.dirB),C.magnitude(N.dirC)),R};const h=C();e.fromDimensionsAndTransform=function g(R,N,j){const[W,z,$]=N,V=C.create(0,0,0);C.transformMat4(V,V,j);const X=C.create(W,z,$);C.transformMat4(X,X,j);const H=C.create(W,0,0);C.transformMat4(H,H,j);const oe=C.create(0,z,$);C.transformMat4(oe,oe,j);const te=C.create(0,0,$);C.transformMat4(te,te,j);const K=C.create(W,0,$);C.transformMat4(K,K,j);const Q=C.create(W,z,0);C.transformMat4(Q,Q,j);const G=C.create(0,z,0);C.transformMat4(G,G,j),C.add(h,V,X),C.scale(h,h,.5);const Z=Math.max(C.distance(V,X),C.distance(H,oe));return e.set(R,h,Z/2),e.setExtrema(R,[V,X,H,oe,te,K,Q,G]),R};const y=C();e.addVec3=function v(R,N,j){return C.distance(N.center,j)C.clone(W)),...j.extrema.map(W=>C.clone(W))]),R};const _=C();e.expand=function w(R,N,j){var W,z;if(C.copy(R.center,N.center),R.radius=N.radius+j,N.radius<1e-12||(null!==(z=null===(W=N.extrema)||void 0===W?void 0:W.length)&&void 0!==z?z:0)<=1)return R.extrema=void 0,R;if(t(N)){const $=new Float32Array(3*N.extrema.length);for(let X=0;X{C.normalize(_,C.sub(_,X,N.center));const H=C.clone(X),oe=C.dot(_,V.dirA)<0?-1:1;C.scaleAndAdd(H,H,V.dirA,oe);const te=C.dot(_,V.dirB)<0?-1:1;C.scaleAndAdd(H,H,V.dirB,te);const K=C.dot(_,V.dirC)<0?-1:1;return C.scaleAndAdd(H,H,V.dirC,K),C.distance(R.center,H)>R.radius&&(N.extrema.length>=14&&C.normalize(_,C.sub(_,H,N.center)),C.scaleAndAdd(H,R.center,_,R.radius)),H}))}return R},e.exactEquals=function A(R,N){return R.radius===N.radius&&C.exactEquals(R.center,N.center)},e.equals=function M(R,N){const j=R.radius,W=N.radius;return Math.abs(j-W)<=wi*Math.max(1,Math.abs(j),Math.abs(W))&&C.equals(R.center,N.center)},e.includes=function E(R,N){if(t(N)){for(const j of N.extrema)if(C.distance(R.center,j)>R.radius)return!1;return!0}return C.distance(R.center,N.center)+N.radius<=R.radius},e.overlaps=function D(R,N){return C.distance(R.center,N.center)<=R.radius+N.radius},e.distance=function T(R,N){return C.distance(R.center,N.center)-R.radius+N.radius},e.distanceToVec=function F(R,N){const{center:j,radius:W}=R;return C.distance(N,j)-W}}(ke||(ke={})),function(e){function n(){return{min:C(),max:C()}}function r(D,T){return C.copy(D.min,T.min),C.copy(D.max,T.max),D}e.create=function t(D,T){return{min:D,max:T}},e.zero=n,e.copy=r,e.clone=function i(D){return r(n(),D)};const o=C();function a(D,T){for(let F=0,R=T.length;F=14?l(D,T.extrema):(C.set(o,T.radius,T.radius,T.radius),C.sub(D.min,T.center,o),C.add(D.max,T.center,o),D)},e.addVec3Array=a,e.fromVec3Array=l,e.addSphere3D=function c(D,T){return ke.hasExtrema(T)&&T.extrema.length>=14?a(D,T.extrema):(g(D,C.subScalar(o,T.center,T.radius)),g(D,C.addScalar(o,T.center,T.radius)),D)},e.intersectsSphere3D=function u(D,T){return C.clamp(o,T.center,D.min,D.max),C.squaredDistance(o,T.center)<=T.radius*T.radius},e.computeBounding=function d(D){const T=C.create(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),F=C.create(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),{x:R,y:N,z:j,indices:W}=D;for(let z=0,$=Ve.size(W);z<$;z++){const V=Ve.getAt(W,z);T[0]=Math.min(R[V],T[0]),T[1]=Math.min(N[V],T[1]),T[2]=Math.min(j[V],T[2]),F[0]=Math.max(R[V],F[0]),F[1]=Math.max(N[V],F[1]),F[2]=Math.max(j[V],F[2])}return{min:T,max:F}},e.size=f;const p=C();function h(D){return C.set(D.min,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),C.set(D.max,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),D}function g(D,T){return C.min(D.min,D.min,T),C.max(D.max,D.max,T),D}e.volume=function m(D){return f(p,D),p[0]*p[1]*p[2]},e.setEmpty=h,e.add=g,e.expand=function y(D,T,F){return C.sub(D.min,T.min,F),C.add(D.max,T.max,F),D},e.scale=function v(D,T,F){return C.scale(D.min,T.min,F),C.scale(D.max,T.max,F),D};const x=C();e.transform=function _(D,T,F){const[R,N,j]=T.min,[W,z,$]=T.max;return h(D),g(D,C.transformMat4(x,C.set(x,R,N,j),F)),g(D,C.transformMat4(x,C.set(x,R,N,$),F)),g(D,C.transformMat4(x,C.set(x,R,z,j),F)),g(D,C.transformMat4(x,C.set(x,R,z,$),F)),g(D,C.transformMat4(x,C.set(x,W,N,j),F)),g(D,C.transformMat4(x,C.set(x,W,N,$),F)),g(D,C.transformMat4(x,C.set(x,W,z,j),F)),g(D,C.transformMat4(x,C.set(x,W,z,$),F)),D},e.containsVec3=function w(D,T){return!(T[0]D.max[0]||T[1]D.max[1]||T[2]D.max[2])},e.overlaps=function A(D,T){return!(D.max[0]T.max[0]||D.max[1]T.max[1]||D.max[2]T.max[2])},e.containsSphere3D=function M(D,T){const F=T.center,R=T.radius;return!(F[0]-RD.max[0]||F[1]-RD.max[1]||F[2]-RD.max[2])},e.nearestIntersectionWithRay=function E(D,T,F,R){const[N,j,W]=T.min,[z,$,V]=T.max,[X,H,oe]=F,te=1/R[0],K=1/R[1],Q=1/R[2];let G,Z,ee,se,xe,re;return te>=0?(G=(N-X)*te,Z=(z-X)*te):(G=(z-X)*te,Z=(N-X)*te),K>=0?(ee=(j-H)*K,se=($-H)*K):(ee=($-H)*K,se=(j-H)*K),Q>=0?(xe=(W-oe)*Q,re=(V-oe)*Q):(xe=(V-oe)*Q,re=(W-oe)*Q),ee>G&&(G=ee),seG&&(G=xe),re0)throw new Error("New key is larger than old key");t.key=n;const r=t.parent;r&&this._compare(t,r)<0&&(this._cut(t,r,this._minNode),this._cascadingCut(r,this._minNode)),this._compare(t,this._minNode)<0&&(this._minNode=t)}delete(t){const n=t.parent;n&&(this._cut(t,n,this._minNode),this._cascadingCut(n,this._minNode)),this._minNode=t,this.extractMinimum()}extractMinimum(){const t=this._minNode;if(t){if(t.child){let r=t.child;do{r.parent=null,r=r.next}while(r!==t.child)}let n=null;t.next!==t&&(n=t.next),this._removeNodeFromList(t),this._nodeCount--,this._minNode=this._mergeLists(n,t.child),this._minNode&&(this._minNode=this._consolidate(this._minNode))}return t}findMinimum(){return this._minNode}insert(t,n){const r=new hLe(t,n);return this._minNode=this._mergeLists(this._minNode,r),this._nodeCount++,r}isEmpty(){return null===this._minNode}size(){return null===this._minNode?0:this._getNodeListSize(this._minNode)}union(t){this._minNode=this._mergeLists(this._minNode,t._minNode),this._nodeCount+=t._nodeCount}_defaultCompare(t,n){return t.key>n.key?1:t.key0){const s=i;i=o,o=s}this._linkHeaps(o,i),n[i.degree]=null,i.degree++,o=n[i.degree]}n[i.degree]=i}let r=null;for(let i=0;i=d.length;const xe=d[H];if(0!==xe){const re=V,ae=xe-1,ge=l[ae],me=ge+c[ae];for(let Ae=ge;AeV&&(V=Ze),hw.insert(Ze,he)}re=o))for(let ae=-G;ae<=G;ae++){const ge=T+ae;if(!(ge<0||ge>=s))for(let Ie=-Z;Ie<=Z;Ie++){const me=F+Ie;if(!(me<0||me>=a||(H=(re*s+ge)*a+me,YU.has(H)||(YU.add(H),S3.has(H))))){if(!j){const Ae=n[0]+re*y[0]-x,he=n[1]+ge*y[1]-_,ie=n[2]+me*y[2]-w;if(Ae*Ae+he*he+ie*ie-K>V){te.push(re,ge,me,H);continue}}$.push(re,ge,me,H),W++}}}}}if(j=!1,0===W){if(1===A){const se=hw.findMinimum();if(se){const{key:xe,value:re}=se;return ap.add(t,re,xe),!0}}else for(;!hw.isEmpty()&&(oe||hw.findMinimum().key<=V)&&t.count=A||R||t.count>=E)return t.count>0;if(j=!0,X=!0,te.length>0){for(let se=0,xe=te.length;se0){const p=Math.ceil(l/c),m=Math.pow(p/(o[0]*o[1]*o[2]),1/3);a=[Math.ceil(o[0]*m),Math.ceil(o[1]*m),Math.ceil(o[2]*m)],s=[o[0]/a[0],o[1]/a[1],o[2]/a[2]]}else s=o,a=[1,1,1];return function yLe(e){const{expandedBox:t,size:[n,r,i],data:{x:o,y:s,z:a,radius:l,indices:c},elementCount:u,delta:d}=e,f=n*r*i,{min:[p,m,h]}=t;let g=0,y=0;const v=new Uint32Array(f),x=new Int32Array(u);for(let E=0;Eg&&(g=l[D])}const _=new Int32Array(y);for(let E=0,D=0;E0&&(v[E]=D+1,_[D]=T,D+=1)}const w=new Uint32Array(y);for(let E=1;E0){const T=D-1;M[w[T]+A[T]]=E,A[T]+=1}}return{size:e.size,bucketArray:M,bucketCounts:_,bucketOffset:w,grid:v,delta:d,min:e.expandedBox.min,data:e.data,maxRadius:g,expandedBox:e.expandedBox,boundingBox:e.boundingBox,boundingSphere:e.boundingSphere}}({size:a,data:{x:e.x,y:e.y,z:e.z,indices:i,radius:e.radius},expandedBox:r,boundingBox:t.box,boundingSphere:t.sphere,elementCount:l,delta:s})}(t,n,r);this.ctx=function vLe(e){return{grid:e,x:.1,y:.1,z:.1,k:1,stopIf:void 0,radius:.1,isCheck:!1}}(i),this.boundary={box:i.boundingBox,sphere:i.boundingSphere},this.buckets={offset:i.bucketOffset,count:i.bucketCounts,array:i.bucketArray},this.result=ap.create()}}function Zoe(e,t){const{min:n,size:[r,i,o],bucketOffset:s,bucketCounts:a,bucketArray:l,grid:c,data:{x:u,y:d,z:f,indices:p,radius:m},delta:h,maxRadius:g}=e.grid,{radius:y,isCheck:v,x,y:_,z:w}=e,A=y+g,M=A*A;ap.reset(t);const E=Math.max(0,Math.floor((x-A-n[0])/h[0])),D=Math.max(0,Math.floor((_-A-n[1])/h[1])),T=Math.max(0,Math.floor((w-A-n[2])/h[2])),F=Math.min(r-1,Math.floor((x+A-n[0])/h[0])),R=Math.min(i-1,Math.floor((_+A-n[1])/h[1])),N=Math.min(o-1,Math.floor((w+A-n[2])/h[2]));if(E>F||D>R||T>N)return!1;for(let j=E;j<=F;j++)for(let W=D;W<=R;W++)for(let z=T;z<=N;z++){const $=c[(j*i+W)*o+z];if(0===$)continue;const V=$-1,X=s[V],oe=X+a[V];for(let te=X;te0&&Math.sqrt(ee)-m[K]>y)continue;if(v)return!0;ap.add(t,l[te],ee)}}}return t.count>0}const Qoe=C(),m1=C(),S3=new Set,YU=new Set,xLe=[.1],_Le=[.1],SLe=[.1],hw=new Koe;var dt,Ti,Oe,cl,dn,Or;!function(e){function t(p,m,h){return{kind:"element-location",structure:p,unit:m,element:h||0}}e.create=t,e.clone=function n(p){return t(p.structure,p.unit,p.element)},e.set=function r(p,m,h,g){return m&&(p.structure=m),h&&(p.unit=h),void 0!==g&&(p.element=g),p},e.copy=function i(p,m){return p.unit=m.unit,p.element=m.element,p},e.is=function o(p){return!!p&&"element-location"===p.kind},e.areEqual=function s(p,m){return p.unit===m.unit&&p.element===m.element};const a=C(),l=C();e.distance=function c(p,m){return p.unit.conformation.position(p.element,a),m.unit.conformation.position(m.element,l),C.distance(a,l)},e.position=function u(p,m){return m.unit.conformation.position(m.element,p)},e.residueIndex=function d(p){return p.unit.model.atomicHierarchy.residueAtomSegments.index[p.element]},e.chainIndex=function f(p){return p.unit.model.atomicHierarchy.chainAtomSegments.index[p.element]}}(dt||(dt={}));class wLe{add(t){const n=this.getHash(t);if(this.byHash.has(n)){const r=this.byHash.get(n);for(let i=0,o=r.length;i`${r}-${i.toLocaleLowerCase()}${o}`).replace(t,(n,r,i,o)=>`${r}-${i.toLocaleLowerCase()}${o}`)}function ise(e,t,n){if($R(n))return n.info.namespace=e,n.info.name=n.info.name||rse(t),void(n.id=`${n.info.namespace}.${n.info.name}`);const r=`${n["@namespace"]||rse(t)}`,i=e?`${e}.${r}`:r;for(const o of Object.keys(n))"object"!=typeof n[o]&&!$R(n[o])||ise(i,o,n[o])}function ose(e,t){if($R(e))t.push(e);else for(const n of Object.keys(e))"object"!=typeof e[n]&&!$R(e[n])||ose(e[n],t)}function Ga(e,t){return wn(dn.Dictionary({0:wt(e)}),e,t)}function g1(e,t){return wn(dn.List(e,{nonEmpty:!0}),e,t)}function lp(e,t,n){return wn(dn.Dictionary({0:wt(e),1:wt(e)}),t,n)}!function(e){e.create=function t(){return{keys:new Set,array:[]}},e.add=function n({keys:i,array:o},s,a){return!i.has(s)&&(i.add(s),o[o.length]=a,!0)},e.has=function r({keys:i},o){return i.has(o)}}(Ti||(Ti={})),function(e){function n(a,l,c){return{kind:"value",namespace:a,name:l,parent:c}}function o(a,l,c,u){const d=Object.create(null);for(const f of u)d[f]=!0;return{kind:"oneof",namespace:a,name:l,type:c,values:d}}e.Variable=function t(a,l,c){return{kind:"variable",name:a,type:l,isConstraint:c}},e.Value=n,e.Container=function r(a,l,c,u){return{kind:"container",namespace:a,name:l,child:c,alias:u}},e.Union=function i(a){return{kind:"union",types:a}},e.OneOf=o,e.Any={kind:"any"},e.AnyValue={kind:"any-value"},e.Num=n("","Number"),e.Str=n("","String"),e.Bool=o("","Bool",e.Str,["true","false"]),e.oneOfValues=function s({values:a}){return Object.keys(a).sort()}}(Oe||(Oe={})),function(e){function s(l){return!!l&&!!l.head&&"object"==typeof l}function a(l){return!!l&&"string"==typeof l.name}e.Symbol=function t(l){return{name:l}},e.Apply=function n(l,c){return c?{head:l,args:c}:{head:l}},e.isArgumentsArray=function r(l){return!!l&&Array.isArray(l)},e.isArgumentsMap=function i(l){return!!l&&!Array.isArray(l)},e.isLiteral=function o(l){return!s(l)&&!a(l)},e.isApply=s,e.isSymbol=a}(cl||(cl={})),function(e){function t(r){return{kind:"dictionary",map:r,"@type":0}}e.None=t({}),e.Dictionary=t,e.List=function n(r,i){const{nonEmpty:o=!1}=i||{};return{kind:"list",type:r,nonEmpty:o,"@type":0}}}(dn||(dn={})),function(e){e.AnyVar=Oe.Variable("a",Oe.Any),e.AnyValueVar=Oe.Variable("a",Oe.Any),e.ConstrainedVar=Oe.Variable("a",Oe.Any,!0),e.Regex=Oe.Value("Core","Regex"),e.Set=t=>Oe.Container("Core","Set",t||e.AnyValueVar),e.List=t=>Oe.Container("Core","List",t||e.AnyVar),e.Fn=(t,n)=>Oe.Container("Core","Fn",t||e.AnyVar,n),e.Flags=(t,n)=>Oe.Container("Core","Flags",t,n),e.BitFlags=e.Flags(Oe.Num,"BitFlags")}(Or||(Or={})),dn.Dictionary({0:wt(Oe.Num),1:wt(Oe.Num)});const ZU={"@header":"Language Primitives",type:{"@header":"Types",bool:wn(dn.Dictionary({0:wt(Oe.AnyValue)}),Oe.Bool,"Convert a value to boolean."),num:wn(dn.Dictionary({0:wt(Oe.AnyValue)}),Oe.Num,"Convert a value to number."),str:wn(dn.Dictionary({0:wt(Oe.AnyValue)}),Oe.Str,"Convert a value to string."),regex:wn(dn.Dictionary({0:wt(Oe.Str,{description:"Expression"}),1:wt(Oe.Str,{isOptional:!0,description:"Flags, e.g. 'i' for ignore case"})}),Or.Regex,"Creates a regular expression from a string using the ECMAscript syntax."),list:wn(dn.List(Or.AnyVar),Or.List()),set:wn(dn.List(Or.AnyValueVar),Or.Set()),bitflags:wn(dn.Dictionary({0:wt(Oe.Num)}),Or.BitFlags,"Interpret a number as bitflags."),compositeKey:wn(dn.List(Oe.AnyValue),Oe.AnyValue)},logic:{"@header":"Logic",not:Ga(Oe.Bool),and:g1(Oe.Bool),or:g1(Oe.Bool)},ctrl:{"@header":"Control",eval:wn(dn.Dictionary({0:wt(Or.Fn(Or.AnyVar))}),Or.AnyVar,"Evaluate a function."),fn:wn(dn.Dictionary({0:wt(Or.AnyVar)}),Or.Fn(Or.AnyVar),'Wrap an expression to a "lazy" function.'),if:wn(dn.Dictionary({0:wt(Oe.Bool,{description:"Condition"}),1:wt(Oe.Variable("a",Oe.Any),{description:"If true"}),2:wt(Oe.Variable("b",Oe.Any),{description:"If false"})}),Oe.Union([Oe.Variable("a",Oe.Any),Oe.Variable("b",Oe.Any)])),assoc:wn(dn.Dictionary({0:wt(Oe.Str,{description:"Name"}),1:wt(Oe.Variable("a",Oe.Any),{description:"Value to assign"})}),Oe.Variable("a",Oe.Any))},rel:{"@header":"Relational",eq:lp(Oe.Variable("a",Oe.AnyValue,!0),Oe.Bool),neq:lp(Oe.Variable("a",Oe.AnyValue,!0),Oe.Bool),lt:lp(Oe.Num,Oe.Bool),lte:lp(Oe.Num,Oe.Bool),gr:lp(Oe.Num,Oe.Bool),gre:lp(Oe.Num,Oe.Bool),inRange:wn(dn.Dictionary({0:wt(Oe.Num,{description:"Value to test"}),1:wt(Oe.Num,{description:"Minimum value"}),2:wt(Oe.Num,{description:"Maximum value"})}),Oe.Bool,"Check if the value of the 1st argument is >= 2nd and <= 3rd.")},math:{"@header":"Math",add:g1(Oe.Num),sub:g1(Oe.Num),mult:g1(Oe.Num),div:lp(Oe.Num,Oe.Num),pow:lp(Oe.Num,Oe.Num),mod:lp(Oe.Num,Oe.Num),min:g1(Oe.Num),max:g1(Oe.Num),cantorPairing:lp(Oe.Num,Oe.Num),sortedCantorPairing:lp(Oe.Num,Oe.Num),invertCantorPairing:wn(dn.Dictionary({0:wt(Oe.Num)}),Or.List(Oe.Num)),floor:Ga(Oe.Num),ceil:Ga(Oe.Num),roundInt:Ga(Oe.Num),trunc:Ga(Oe.Num),abs:Ga(Oe.Num),sign:Ga(Oe.Num),sqrt:Ga(Oe.Num),cbrt:Ga(Oe.Num),sin:Ga(Oe.Num),cos:Ga(Oe.Num),tan:Ga(Oe.Num),asin:Ga(Oe.Num),acos:Ga(Oe.Num),atan:Ga(Oe.Num),sinh:Ga(Oe.Num),cosh:Ga(Oe.Num),tanh:Ga(Oe.Num),exp:Ga(Oe.Num),log:Ga(Oe.Num),log10:Ga(Oe.Num),atan2:lp(Oe.Num,Oe.Num)},str:{"@header":"Strings",concat:g1(Oe.Str),match:wn(dn.Dictionary({0:wt(Or.Regex),1:wt(Oe.Str)}),Oe.Bool)},list:{"@header":"Lists",getAt:wn(dn.Dictionary({0:wt(Or.List()),1:wt(Oe.Num)}),Or.AnyVar),equal:wn(dn.Dictionary({0:wt(Or.List()),1:wt(Or.List())}),Oe.Bool)},set:{"@header":"Sets",has:wn(dn.Dictionary({0:wt(Or.Set(Or.ConstrainedVar)),1:wt(Or.ConstrainedVar)}),Oe.Bool,"Check if the the 1st argument includes the value of the 2nd."),isSubset:wn(dn.Dictionary({0:wt(Or.Set(Or.ConstrainedVar)),1:wt(Or.Set(Or.ConstrainedVar))}),Oe.Bool,"Check if the the 1st argument is a subset of the 2nd.")},flags:{"@header":"Flags",hasAny:wn(dn.Dictionary({0:wt(Or.Flags(Or.ConstrainedVar)),1:wt(Or.Flags(Or.ConstrainedVar))}),Oe.Bool,"Check if the the 1st argument has at least one of the 2nd one's flags."),hasAll:wn(dn.Dictionary({0:wt(Or.Flags(Or.ConstrainedVar)),1:wt(Or.Flags(Or.ConstrainedVar))}),Oe.Bool,"Check if the the 1st argument has all 2nd one's flags.")}};tse(ZU);const FLe=nse(ZU);var $t;function Rr(e,t){return wn(dn.Dictionary({0:wt($t.ElementReference,{isOptional:!0,defaultValue:"slot.current-atom"})}),e,t)}function mw(e,t){return wn(dn.None,e,t)}!function(){const e=Object.create(null);for(const t of FLe)e[t.id]=t}(),function(e){e.ElementSymbol=Oe.Value("Structure","ElementSymbol"),e.AtomName=Oe.Value("Structure","AtomName"),e.BondFlag=Oe.OneOf("Structure","BondFlag",Oe.Str,["covalent","metallic","ion","hydrogen","sulfide","computed","aromatic"]),e.BondFlags=Or.Flags(e.BondFlag,"BondFlags"),e.SecondaryStructureFlag=Oe.OneOf("Structure","SecondaryStructureFlag",Oe.Str,["alpha","beta","3-10","pi","sheet","strand","helix","turn","none"]),e.SecondaryStructureFlags=Or.Flags(e.SecondaryStructureFlag,"SecondaryStructureFlag"),e.RingFingerprint=Oe.Value("Structure","RingFingerprint"),e.EntityType=Oe.OneOf("Structure","EntityType",Oe.Str,["polymer","non-polymer","water","branched"]),e.EntitySubtype=Oe.OneOf("Structure","EntitySubtype",Oe.Str,["other","polypeptide(D)","polypeptide(L)","polydeoxyribonucleotide","polyribonucleotide","polydeoxyribonucleotide/polyribonucleotide hybrid","cyclic-pseudo-peptide","peptide nucleic acid","oligosaccharide"]),e.ObjectPrimitive=Oe.OneOf("Structure","ObjectPrimitive",Oe.Str,["atomistic","sphere","gaussian","other"]),e.ResidueId=Oe.Value("Structure","ResidueId"),e.ElementSet=Oe.Value("Structure","ElementSet"),e.ElementSelection=Oe.Value("Structure","ElementSelection"),e.ElementReference=Oe.Value("Structure","ElementReference"),e.ElementSelectionQuery=Or.Fn(e.ElementSelection,"ElementSelectionQuery")}($t||($t={}));const Ee={core:ZU,structureQuery:{"@header":"Structure Queries",type:{"@header":"Types",elementSymbol:wn(dn.Dictionary({0:wt(Oe.Str)}),$t.ElementSymbol,"Create element symbol representation from a string value."),atomName:wn(dn.Dictionary({0:wt(Oe.AnyValue)}),$t.AtomName,"Convert a value to an atom name."),entityType:wn(dn.Dictionary({0:wt($t.EntityType)}),$t.EntityType,`Create normalized representation of entity type: ${Oe.oneOfValues($t.EntityType).join(", ")}.`),bondFlags:wn(dn.List($t.BondFlag),$t.BondFlags,`Create bond flags representation from a list of strings. Allowed flags: ${Oe.oneOfValues($t.BondFlag).join(", ")}.`),ringFingerprint:wn(dn.List($t.ElementSymbol,{nonEmpty:!0}),$t.RingFingerprint,"Create ring fingerprint from the supplied atom element list."),secondaryStructureFlags:wn(dn.List($t.SecondaryStructureFlag),$t.SecondaryStructureFlags,`Create secondary structure flags representation from a list of strings. Allowed flags: ${Oe.oneOfValues($t.SecondaryStructureFlag).join(", ")}.`),authResidueId:wn(dn.Dictionary({0:wt(Oe.Str,{description:"auth_asym_id"}),1:wt(Oe.Num,{description:"auth_seq_id"}),2:wt(Oe.Str,{description:"pdbx_PDB_ins_code",isOptional:!0})}),$t.ResidueId,'Residue identifier based on "auth_" annotation.'),labelResidueId:wn(dn.Dictionary({0:wt(Oe.Str,{description:"label_entity_id"}),1:wt(Oe.Str,{description:"label_asym_id"}),2:wt(Oe.Num,{description:"label_seq_id"}),3:wt(Oe.Str,{description:"pdbx_PDB_ins_code",isOptional:!0})}),$t.ResidueId,'Residue identifier based on mmCIF\'s "label_" annotation.')},slot:{"@header":"Iteration Slots",element:wn(dn.None,$t.ElementReference,"A reference to the current element."),elementSetReduce:wn(dn.None,Oe.Variable("a",Oe.AnyValue,!0),"Current value of the element set reducer.")},generator:{"@header":"Generators",all:wn(dn.None,$t.ElementSelectionQuery,"The entire structure."),atomGroups:wn(dn.Dictionary({"entity-test":wt(Oe.Bool,{isOptional:!0,defaultValue:!0,description:"Test for the 1st atom of every entity"}),"chain-test":wt(Oe.Bool,{isOptional:!0,defaultValue:!0,description:"Test for the 1st atom of every chain"}),"residue-test":wt(Oe.Bool,{isOptional:!0,defaultValue:!0,description:"Test for the 1st atom every residue"}),"atom-test":wt(Oe.Bool,{isOptional:!0,defaultValue:!0}),"group-by":wt(Oe.Any,{isOptional:!0,defaultValue:"atom-key",description:"Group atoms to sets based on this property. Default: each atom has its own set"})}),$t.ElementSelectionQuery,"Return all atoms for which the tests are satisfied, grouped into sets."),bondedAtomicPairs:wn(dn.Dictionary({0:wt(Oe.Bool,{isOptional:!0,defaultValue:"true for covalent bonds",description:"Test each bond with this predicate. Each bond is visited twice with swapped atom order."})}),$t.ElementSelectionQuery,"Return all pairs of atoms for which the test is satisfied."),rings:wn(dn.Dictionary({fingerprint:wt($t.RingFingerprint,{isOptional:!0}),"only-aromatic":wt(Oe.Bool,{isOptional:!0,defaultValue:!1})}),$t.ElementSelectionQuery,"Return all rings or those with the specified fingerprint and/or only aromatic rings."),queryInSelection:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),query:wt($t.ElementSelectionQuery),"in-complement":wt(Oe.Bool,{isOptional:!0,defaultValue:!1})}),$t.ElementSelectionQuery,"Executes query only on atoms that are in the source selection."),empty:wn(dn.None,$t.ElementSelectionQuery,"Nada.")},modifier:{"@header":"Selection Modifications",queryEach:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),query:wt($t.ElementSelectionQuery)}),$t.ElementSelectionQuery,"Query every atom set in the input selection separately."),intersectBy:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),by:wt($t.ElementSelectionQuery)}),$t.ElementSelectionQuery,"Intersect each atom set from the first sequence from atoms in the second one."),exceptBy:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),by:wt($t.ElementSelectionQuery)}),$t.ElementSelectionQuery,"Remove all atoms from 'selection' that occur in 'by'."),unionBy:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),by:wt($t.ElementSelectionQuery)}),$t.ElementSelectionQuery,"For each atom set A in the orginal sequence, combine all atoms sets in the target selection that intersect with A."),union:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery)}),$t.ElementSelectionQuery,"Collects all atom sets in the sequence into a single atom set."),cluster:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),"min-distance":wt(Oe.Num,{isOptional:!0,defaultValue:0}),"max-distance":wt(Oe.Num),"min-size":wt(Oe.Num,{description:"Minimal number of sets to merge, must be at least 2",isOptional:!0,defaultValue:2}),"max-size":wt(Oe.Num,{description:"Maximal number of sets to merge, if not set, no limit",isOptional:!0})}),$t.ElementSelectionQuery,"Combines atom sets that have mutual distance in the interval [min-radius, max-radius]. Minimum/maximum size determines how many atom sets can be combined."),includeSurroundings:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),radius:wt(Oe.Num),"atom-radius":wt(Oe.Num,{isOptional:!0,defaultValue:0,description:"Value added to each atom before the distance check, for example VDW radius. Using this argument is computationally demanding."}),"as-whole-residues":wt(Oe.Bool,{isOptional:!0})}),$t.ElementSelectionQuery,"For each atom set in the selection, include all surrouding atoms/residues that are within the specified radius."),surroundingLigands:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),radius:wt(Oe.Num),"include-water":wt(Oe.Bool,{isOptional:!0,defaultValue:!0})}),$t.ElementSelectionQuery,"Find all ligands components around the source query."),includeConnected:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),"bond-test":wt(Oe.Bool,{isOptional:!0,defaultValue:"true for covalent bonds"}),"layer-count":wt(Oe.Num,{isOptional:!0,defaultValue:1,description:"Number of bonded layers to include."}),"fixed-point":wt(Oe.Bool,{isOptional:!0,defaultValue:!1,description:"Continue adding layers as long as new connections exist."}),"as-whole-residues":wt(Oe.Bool,{isOptional:!0})}),$t.ElementSelectionQuery,"Pick all atom sets that are connected to the target."),wholeResidues:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery)}),$t.ElementSelectionQuery,"Expand the selection to whole residues."),expandProperty:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),property:wt(Oe.AnyValue)}),$t.ElementSelectionQuery,"To each atom set in the selection, add all atoms that have the same property value that was already present in the set.")},filter:{"@header":"Selection Filters",pick:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),test:wt(Oe.Bool)}),$t.ElementSelectionQuery,"Pick all atom sets that satisfy the test."),first:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery)}),$t.ElementSelectionQuery,"Take the 1st atom set in the sequence."),withSameAtomProperties:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),source:wt($t.ElementSelectionQuery),property:wt(Oe.Any)}),$t.ElementSelectionQuery,"Pick all atom sets for which the set of given atom properties is a subset of the source properties."),intersectedBy:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),by:wt($t.ElementSelectionQuery)}),$t.ElementSelectionQuery,"Pick all atom sets that have non-zero intersection with the target."),within:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),target:wt($t.ElementSelectionQuery),"min-radius":wt(Oe.Num,{isOptional:!0,defaultValue:0}),"max-radius":wt(Oe.Num),"atom-radius":wt(Oe.Num,{isOptional:!0,defaultValue:0,description:"Value added to each atom before the distance check, for example VDW radius. Using this argument is computationally demanding."}),invert:wt(Oe.Bool,{isOptional:!0,defaultValue:!1,description:"If true, pick only atom sets that are further than the specified radius."})}),$t.ElementSelectionQuery,"Pick all atom sets from selection that have any atom within the radius of any atom from target."),isConnectedTo:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery),target:wt($t.ElementSelectionQuery),"bond-test":wt(Oe.Bool,{isOptional:!0,defaultValue:"true for covalent bonds"}),disjunct:wt(Oe.Bool,{isOptional:!0,defaultValue:!0,description:"If true, there must exist a bond to an atom that lies outside the given atom set to pass test."}),invert:wt(Oe.Bool,{isOptional:!0,defaultValue:!1,description:"If true, return atom sets that are not connected."})}),$t.ElementSelectionQuery,"Pick all atom sets that are connected to the target.")},combinator:{"@header":"Selection Combinators",intersect:wn(dn.List($t.ElementSelectionQuery),$t.ElementSelectionQuery,"Return all unique atom sets that appear in all of the source selections."),merge:wn(dn.List($t.ElementSelectionQuery),$t.ElementSelectionQuery,"Merges multiple selections into a single one. Only unique atom sets are kept."),distanceCluster:wn(dn.Dictionary({matrix:wt(Or.List(Or.List(Oe.Num)),{description:"Distance matrix, represented as list of rows (num[][])). Lower triangle is min distance, upper triangle is max distance."}),selections:wt(Or.List($t.ElementSelectionQuery),{description:"A list of held selections."})}),$t.ElementSelectionQuery,"Pick combinations of atom sets from the source sequences that are mutually within distances specified by a matrix.")},atomSet:{"@header":"Atom Sets",atomCount:wn(dn.None,Oe.Num),countQuery:wn(dn.Dictionary({0:wt($t.ElementSelectionQuery)}),Oe.Num,"Counts the number of occurences of a specific query inside the current atom set."),reduce:wn(dn.Dictionary({initial:wt(Oe.Variable("a",Oe.AnyValue,!0),{description:"Initial value assigned to slot.atom-set-reduce. Current atom is set to the 1st atom of the current set for this."}),value:wt(Oe.Variable("a",Oe.AnyValue,!0),{description:"Expression executed for each atom in the set"})}),Oe.Variable("a",Oe.AnyValue,!0),"Execute the value expression for each atom in the current atom set and return the result. Works the same way as Array.reduce in JavaScript (``result = value(value(...value(initial)))``)"),propertySet:wn(dn.Dictionary({0:wt(Or.ConstrainedVar)}),Or.Set(Or.ConstrainedVar),"Returns a set with all values of the given property in the current atom set.")},atomProperty:{"@header":"Atom Properties",core:{"@header":"Core Properties",elementSymbol:Rr($t.ElementSymbol),vdw:Rr(Oe.Num,"Van der Waals radius"),mass:Rr(Oe.Num,"Atomic weight"),atomicNumber:Rr(Oe.Num,"Atomic number"),x:Rr(Oe.Num,"Cartesian X coordinate"),y:Rr(Oe.Num,"Cartesian Y coordinate"),z:Rr(Oe.Num,"Cartesian Z coordinate"),atomKey:Rr(Oe.AnyValue,"Unique value for each atom. Main use case is grouping of atoms."),bondCount:wn(dn.Dictionary({0:wt($t.ElementReference,{isOptional:!0,defaultValue:"slot.current-atom"}),flags:wt($t.BondFlags,{isOptional:!0,defaultValue:"covalent"})}),Oe.Num,"Number of bonds (by default only covalent bonds are counted)."),sourceIndex:Rr(Oe.Num,"Index of the atom/element in the input file."),operatorName:Rr(Oe.Str,"Name of the symmetry operator applied to this element."),operatorKey:Rr(Oe.Num,"Key of the symmetry operator applied to this element."),modelIndex:Rr(Oe.Num,"Index of the model in the input file."),modelLabel:Rr(Oe.Str,"Label/header of the model in the input file.")},topology:{connectedComponentKey:Rr(Oe.AnyValue,"Unique value for each connected component.")},macromolecular:{"@header":"Macromolecular Properties (derived from the mmCIF format)",authResidueId:Rr($t.ResidueId,"type.auth-residue-id symbol executed on current atom's residue"),labelResidueId:Rr($t.ResidueId,"type.label-residue-id symbol executed on current atom's residue"),residueKey:Rr(Oe.AnyValue,"Unique value for each tuple ``(label_entity_id,auth_asym_id, auth_seq_id, pdbx_PDB_ins_code)``, main use case is grouping of atoms"),chainKey:Rr(Oe.AnyValue,"Unique value for each tuple ``(label_entity_id, auth_asym_id)``, main use case is grouping of atoms"),entityKey:Rr(Oe.AnyValue,"Unique value for each tuple ``label_entity_id``, main use case is grouping of atoms"),isHet:Rr(Oe.Bool,"Equivalent to atom_site.group_PDB !== ATOM"),id:Rr(Oe.Num,"_atom_site.id"),label_atom_id:Rr($t.AtomName),label_alt_id:Rr(Oe.Str),label_comp_id:Rr(Oe.Str),label_asym_id:Rr(Oe.Str),label_entity_id:Rr(Oe.Str),label_seq_id:Rr(Oe.Num),auth_atom_id:Rr($t.AtomName),auth_comp_id:Rr(Oe.Str),auth_asym_id:Rr(Oe.Str),auth_seq_id:Rr(Oe.Num),pdbx_PDB_ins_code:Rr(Oe.Str),pdbx_formal_charge:Rr(Oe.Num),occupancy:Rr(Oe.Num),B_iso_or_equiv:Rr(Oe.Num),entityType:Rr($t.EntityType,"Type of the entity as defined in mmCIF (polymer, non-polymer, branched, water)"),entitySubtype:Rr($t.EntitySubtype,"Subtype of the entity as defined in mmCIF _entity_poly.type and _pdbx_entity_branch.type (other, polypeptide(D), polypeptide(L), polydeoxyribonucleotide, polyribonucleotide, polydeoxyribonucleotide/polyribonucleotide hybrid, cyclic-pseudo-peptide, peptide nucleic acid, oligosaccharide)"),entityPrdId:Rr(Oe.Str,"The PRD ID of the entity."),entityDescription:Rr(Or.List(Oe.Str)),objectPrimitive:Rr($t.ObjectPrimitive,"Type of the primitive object used to model this segment as defined in mmCIF/IHM (atomistic, sphere, gaussian, other)"),secondaryStructureKey:Rr(Oe.AnyValue,"Unique value for each secondary structure element."),secondaryStructureFlags:Rr($t.SecondaryStructureFlags),isModified:Rr(Oe.Bool,"True if the atom belongs to modification of a standard residue."),modifiedParentName:Rr(Oe.Str,"'3-letter' code of the modifed parent residue."),isNonStandard:Rr(Oe.Bool,"True if this is a non-standard residue."),chemCompType:Rr(Oe.Str,"Type of the chemical component as defined in mmCIF.")}},bondProperty:{"@header":"Bond Properties",flags:mw($t.BondFlags),order:mw(Oe.Num),key:mw(Oe.Num),length:mw(Oe.Num),atomA:mw($t.ElementReference),atomB:mw($t.ElementReference)}},internal:{"@header":"Internal Queries",generator:{"@header":"Generators",bundleElement:wn(dn.Dictionary({groupedUnits:wt(Oe.Any),set:wt(Oe.Any),ranges:wt(Oe.Any)}),Oe.Any),bundle:wn(dn.Dictionary({elements:wt(Oe.Any)}),$t.ElementSelectionQuery,"A selection with single structure containing represented by the bundle."),current:wn(dn.None,$t.ElementSelectionQuery,"Current selection provided by the query context. Avoid using this in State Transforms.")}}};tse(Ee);const $Le=nse(Ee);var pe;function qa(){return qa.zero()}function Vh(){return Vh.zero()}function st(e){return e}function Br(e,t,n,r){return{label:e,description:n,list:r,type:t}}function YR(e,t,n){const r={};for(const i in e){let o=e[i];o=st.saturate(o,t),o=st.darken(o,-n),r[i]=o}return r}function sse(e,t=" "){return e.replace(/([a-z\xE0-\xFF])([A-Z\xC0\xDF])/g,`$1${t}$2`)}function Rc(e){return y1(sse(e))}!function(){const e=Object.create(null);for(const t of $Le)e[t.id]=t}(),function(e){e.core=Ee.core,e.struct=Ee.structureQuery,e.internal=Ee.internal,e.atomName=function t(v){return e.struct.type.atomName([v])},e.es=function n(v){return e.struct.type.elementSymbol([v])},e.list=function r(...v){return e.core.type.list(v)},e.set=function i(...v){return e.core.type.set(v)},e.re=function o(v,x){return e.core.type.regex([v,x])},e.fn=function s(v){return e.core.ctrl.fn([v])},e.evaluate=function a(v){return e.core.ctrl.eval([v])};const l=e.struct.atomProperty.core,c=e.struct.atomProperty.macromolecular,u=e.struct.atomProperty.topology;function d(v){return l[v]()}function f(v){return u[v]()}function p(v){return c[v]()}e.acp=d,e.atp=f,e.ammp=p;const m=e.struct.atomSet.propertySet;e.acpSet=function h(v){return m([d(v)])},e.atpSet=function g(v){return m([f(v)])},e.ammpSet=function y(v){return m([p(v)])}}(pe||(pe={})),function(e){function t(){const R=[.1,0,0];return R[0]=0,R}function l(R,N){const[j,W,z]=N,$=Math.sqrt(W*W+z*z);let V=(pf(Math.atan2(z,W))+360)%360;return 0===Math.round(1e4*$)&&(V=Number.NaN),R[0]=V,R[1]=$,R[2]=j,R}function u(R,N,j){return R[0]=N[0]-h*j,R[1]=N[1],R[2]=N[2],R}e.zero=t,e.create=function n(R,N,j){const W=t();return W[0]=R,W[1]=N,W[2]=j,W},e.set=function r(R,N,j,W){return R[0]=N,R[1]=j,R[2]=W,R},e.distance=function i(R,N){const j=N[0]-R[0],W=N[1]-R[1],z=N[2]-R[2];return Math.sqrt(j*j+W*W+z*z)},e.fromColor=function o(R,N){const[j,W,z]=st.toRgb(N),[$,V,X]=function F(R,N,j){return[T((.4124564*(R=D(R))+.3575761*(N=D(N))+.1804375*(j=D(j)))/g),T((.2126729*R+.7151522*N+.072175*j)/y),T((.0193339*R+.119192*N+.9503041*j)/v)]}(j,W,z),H=116*V-16;return R[0]=H<0?0:H,R[1]=500*($-V),R[2]=200*(V-X),R},e.fromHcl=function s(R,N){return Vh.toLab(R,N)},e.toColor=function a(R){let N=(R[0]+16)/116,j=isNaN(R[1])?N:N+R[1]/500,W=isNaN(R[2])?N:N-R[2]/200;N=y*E(N),j=g*E(j),W=v*E(W);const z=M(3.2404542*j-1.5371385*N-.4985314*W),$=M(-.969266*j+1.8760108*N+.041556*W),V=M(.0556434*j-.2040259*N+1.0572252*W);return st.fromRgb(Math.round(al(z,0,255)),Math.round(al($,0,255)),Math.round(al(V,0,255)))},e.toHcl=l,e.copy=function c(R,N){return R[0]=N[0],R[1]=N[1],R[2]=N[2],R},e.darken=u,e.lighten=function d(R,N,j){return u(R,N,-j)};const f=[0,0,0];function p(R,N,j){return l(f,N),Vh.toLab(R,Vh.saturate(f,f,j))}e.saturate=p,e.desaturate=function m(R,N,j){return p(R,N,-j)};const h=18,g=.95047,y=1,v=1.08883,x=.137931034,_=.206896552,w=.12841855,A=.008856452;function M(R){return 255*(R<=.00304?12.92*R:1.055*Math.pow(R,1/2.4)-.055)}function E(R){return R>_?R*R*R:w*(R-x)}function D(R){return(R/=255)<=.04045?R/12.92:Math.pow((R+.055)/1.055,2.4)}function T(R){return R>A?Math.pow(R,1/3):R/w+x}}(qa||(qa={})),function(e){function t(){const v=[.1,0,0];return v[0]=0,v}e.zero=t,e.create=function n(v,x,_){const w=t();return w[0]=v,w[1]=x,w[2]=_,w},e.set=function r(v,x,_,w){return v[0]=x,v[1]=_,v[2]=w,v},e.hasHue=function i(v){return!isNaN(v[0])};const o=[0,0,0];e.fromColor=function s(v,x){return qa.toHcl(v,qa.fromColor(o,x))},e.fromLab=function a(v,x){return qa.toHcl(v,x)};const l=[0,0,0];function u(v,x){let[_,w,A]=x;return isNaN(_)&&(_=0),_=Xr(_),v[0]=A,v[1]=Math.cos(_)*w,v[2]=Math.sin(_)*w,v}function f(v,x,_){return v[0]=x[0],v[1]=Math.max(0,x[1]+y*_),v[2]=x[2],v}e.toColor=function c(v){return qa.toColor(u(l,v))},e.toLab=u,e.copy=function d(v,x){return v[0]=x[0],v[1]=x[1],v[2]=x[2],v},e.saturate=f,e.desaturate=function p(v,x,_){return f(v,x,-_)};const m=[0,0,0];function h(v,x,_){return u(m,x),qa.toHcl(v,qa.darken(m,m,_))}e.darken=h,e.lighten=function g(v,x,_){return h(v,x,-_)};const y=18}(Vh||(Vh={})),function(e){function c(z,$,V){return z<<16|$<<8|V}function u(z,$,V){return 255*z<<16|255*$<<8|255*V}function v(z){const $=z>>16&255;return $!==(z>>8&255)||$!==(255&z)}e.toStyle=function t(z){return`rgb(${z>>16&255}, ${z>>8&255}, ${255&z})`},e.toHexStyle=function n(z){return"#"+("000000"+z.toString(16)).slice(-6)},e.toHexString=function r(z){return"0x"+("000000"+z.toString(16)).slice(-6)},e.toRgbString=function i(z){return`RGB: ${e.toRgb(z).join(", ")}`},e.toRgb=function o(z){return[z>>16&255,z>>8&255,255&z]},e.toRgbNormalized=function s(z){return[(z>>16&255)/255,(z>>8&255)/255,(255&z)/255]},e.fromHexStyle=function a(z){return parseInt(z.replace("#","0x"))},e.fromHexString=function l(z){return parseInt(z)},e.fromRgb=c,e.fromNormalizedRgb=u,e.fromArray=function d(z,$){return c(z[$],z[$+1],z[$+2])},e.fromNormalizedArray=function f(z,$){return u(z[$],z[$+1],z[$+2])},e.toArray=function p(z,$,V){return $[V]=z>>16&255,$[V+1]=z>>8&255,$[V+2]=255&z,$},e.toArrayNormalized=function m(z,$,V){return $[V]=(z>>16&255)/255,$[V+1]=(z>>8&255)/255,$[V+2]=(255&z)/255,$},e.toVec3=function h(z,$){return z[0]=$>>16&255,z[1]=$>>8&255,z[2]=255&$,z},e.toVec3Normalized=function g(z,$){return z[0]=($>>16&255)/255,z[1]=($>>8&255)/255,z[2]=(255&$)/255,z},e.interpolate=function y(z,$,V){const X=z>>16&255,H=z>>8&255,oe=255&z;return X+(($>>16&255)-X)*V<<16|H+(($>>8&255)-H)*V<<8|oe+((255&$)-oe)*V},e.hasHue=v;const x=[0,0,0];function _(z,$){return v(z)?(Vh.fromColor(x,z),Vh.toColor(Vh.saturate(x,x,$))):z}e.saturate=_,e.desaturate=function w(z,$){return _(z,-$)};const A=[0,0,0];function M(z,$){return qa.fromColor(A,z),qa.toColor(qa.darken(A,A,$))}function D(z){return z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4)}function T(z){return.2126*D((z>>16&255)/255)+.7152*D((z>>8&255)/255)+.0722*D((255&z)/255)}function R(z){return z<.04045?.0773993808*z:Math.pow(.9478672986*z+.0521327014,2.4)}function j(z){return z<.0031308?12.92*z:1.055*Math.pow(z,.41666)-.055}e.darken=M,e.lighten=function E(z,$){return M(z,-$)},e.luminance=T,e.contrast=function F(z,$){const V=T(z),X=T($);return V>X?(V+.05)/(X+.05):(X+.05)/(V+.05)},e.sRGBToLinear=function N(z){return u(R((z>>16&255)/255),R((z>>8&255)/255),R((255&z)/255))},e.linearToSRGB=function W(z){return u(j((z>>16&255)/255),j((z>>8&255)/255),j((255&z)/255))}}(st||(st={}));const XLe=e=>e.toUpperCase();function y1(e){return e.toLowerCase().replace(/^\w|\s\w/g,XLe)}function yf(e){return y1(sse(function ase(e){return e.replace(/_/g," ")}(function lse(e){return e.replace(/-/g," ")}(e))))}function zs(e,t,n,r){const i=r.length;if(i>n-t)return!1;for(let o=0;o]+>/g,"")}function w3(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Ad={"orange-red":Br("Orange-Red","sequential","Orange-Red, sequential color scheme from ColorBrewer 2.0",[16775148,16705736,16635038,16628612,16551257,15689032,14102559,11730944,8323072]),"purple-blue":Br("Purple-Blue","sequential","Purple-Blue, sequential color scheme from ColorBrewer 2.0",[16775163,15525874,13685222,10927579,7645647,3576e3,356528,285325,145496]),"blue-purple":Br("Blue-Purple","sequential","Blue-Purple, sequential color scheme from ColorBrewer 2.0",[16252157,14740724,12571622,10403034,9213638,9202609,8929693,8458108,5046347]),oranges:Br("Oranges","sequential","",[16774635,16705230,16634018,16625259,16616764,15821075,14239745,10892803,8333060]),"blue-green":Br("Blue-Green","sequential","",[16252157,15070713,13429990,10082505,6734500,4304502,2329413,27948,17435]),"yellow-orange-brown":Br("Yellow-Orange-Brown","sequential","",[16777189,16775100,16704401,16696399,16685353,15495188,13388802,10040324,6694150]),"yellow-green":Br("Yellow-Green","sequential","",[16777189,16252089,14282915,11394446,7915129,4303709,2327619,26679,17705]),reds:Br("Reds","sequential","",[16774640,16703698,16563105,16552562,16476746,15678252,13309981,10817301,6750221]),"red-purple":Br("Red-Purple","sequential","",[16775155,16638173,16565696,16424885,16214177,14496919,11403646,7995767,4784234]),greens:Br("Greens","sequential","",[16252149,15070688,13101504,10607003,7652470,4303709,2329413,27948,17435]),"yellow-green-blue":Br("Yellow-Green-Blue","sequential","",[16777177,15595697,13101492,8375739,4306628,1937856,2252456,2438292,531800]),purples:Br("Purples","sequential","",[16579581,15724021,14342891,12369372,10394312,8420794,6967715,5515151,4128893]),"green-blue":Br("Green-Blue","sequential","",[16252144,14742491,13429701,11066805,8113348,5157843,2854078,551084,540801]),greys:Br("Greys","sequential","",[16777215,15790320,14277081,12434877,9868950,7566195,5395026,2434341,0]),"yellow-orange-red":Br("Yellow-Orange-Red","sequential","",[16777164,16772512,16701814,16691788,16616764,16535082,14883356,12386342,8388646]),"purple-red":Br("Purple-Red","sequential","",[16250105,15196655,13941210,13210823,14640560,15149450,13505110,9961539,6750239]),blues:Br("Blues","sequential","",[16251903,14609399,13032431,10406625,7057110,4362950,2191797,545180,536683]),"purple-blue-green":Br("Purple-Blue-Green","sequential","",[16775163,15524592,13685222,10927579,6793679,3576e3,164234,93273,83510]),spectral:Br("Spectral","diverging","",[10355010,13975119,16018755,16625249,16703627,16777151,15136152,11263396,6734501,3311805,6180770]),"red-yellow-green":Br("Red-Yellow-Green","diverging","",[10813478,14102567,16018755,16625249,16703627,16777151,14282635,10934634,6733155,1742928,26679]),"red-blue":Br("Red-Blue","diverging","",[6750239,11671595,14049357,16033154,16636871,16250871,13755888,9618910,4428739,2188972,340065]),"pink-yellow-green":Br("Pink-Yellow-Green","diverging","",[9306450,12917629,14579630,15840986,16638191,16250871,15136208,12116358,8371265,5083681,2581529]),"purple-green":Br("Purple-Green","diverging","",[4194379,7744131,10055851,12756431,15193320,16250871,14282963,10935200,5942881,1800247,17435]),"red-yellow-blue":Br("Red-Yellow-Blue","diverging","Red-Yellow-Blue, diverging color scheme from ColorBrewer 2.0",[10813478,14102567,16018755,16625249,16703632,16777151,14742520,11262441,7646673,4552116,3225237]),"brown-white-green":Br("Brown-White-Green","diverging","",[5517317,9195786,12550445,14664317,16181443,16119285,13101797,8441281,3512207,91742,15408]),"red-grey":Br("Red-Grey","diverging","",[6750239,11671595,14049357,16033154,16636871,16777215,14737632,12237498,8882055,5066061,1710618]),"orange-purple":Br("Orange-Purple","diverging","",[8338184,11753478,14713364,16627811,16703670,16250871,14211819,11709394,8418220,5515144,2949195]),"set-2":Br("Set-2","qualitative","",[6734501,16551266,9281739,15174339,10934356,16767279,15058068,11776947]),accent:Br("Accent","qualitative","",[8374655,12496596,16629894,16777113,3697840,15729279,12540695,6710886]),"set-1":Br("Set-1","qualitative","",[14948892,3636920,5091146,9981603,16744192,16777011,10901032,16220607,10066329]),"set-3":Br("Set-3","qualitative","",[9294791,16777139,12499674,16482418,8434131,16626786,11787881,16567781,14277081,12353725,13429701,16772463]),"dark-2":Br("Dark-2","qualitative","",[1810039,14245634,7696563,15149450,6727198,15117058,10909213,6710886]),paired:Br("Paired","qualitative","",[10931939,2062516,11722634,3383340,16489113,14883356,16629615,16744192,13284054,6962586,16777113,11622696]),"pastel-2":Br("Pastel-2","qualitative","",[11789005,16633260,13358568,16042724,15136201,16773806,15852236,13421772]),"pastel-1":Br("Pastel-1","qualitative","",[16495790,11783651,13429701,14601188,16701862,16777164,15063229,16636652,15921906]),"many-distinct":Br("Many-Distinct","qualitative","",[1810039,14245634,7696563,15149450,6727198,15117058,10909213,6710886,14948892,3636920,5091146,9981603,16744192,16777011,10901032,16220607,10066329,6734501,16551266,9281739,15174339,10934356,16767279,15058068,11776947]),magma:Br("Magma","sequential","Perceptually uniform shades of black-red-white",[4329332,4853881,5378684,5903742,6363263,6888576,7413633,7938689,8463745,8988801,9513600,10038655,10563454,11088508,11613562,12138360,12728949,13254258,13714030,14239338,14699366,15094114,15489119,15753309,16017499,16216411,16350045,16483424,16551523,16619368,16621934,16689780,16692091,16694402,16696969,16633746,16636058,16638371,16575148,16577461,16514239]),inferno:Br("Inferno","sequential","Perceptually uniform shades of black-red-yellow",[4721514,5246316,5771373,6296430,6821486,7346542,7871597,8396651,8921450,9446504,9971557,10496610,10956127,11481435,12006486,12466258,12926285,13386056,13780802,14241085,14570295,14965297,15229227,15558693,15757342,15956248,16154897,16288267,16421638,16489734,16492043,16494612,16496926,16368426,16305463,16111429,15982678,15853928,15856253,16119953,16580260]),plasma:Br("Plasma","sequential","Perceptually uniform shades of blue-red-yellow",[1771148,2426257,3081365,3671193,4195228,4784799,5308834,5833124,6357158,6815911,7340200,7864744,8324007,8783782,9309348,9769377,10164126,10624154,11018902,11413393,11808141,12137352,12466307,12795519,13124730,13453685,13717361,14046573,14309992,14573668,14837344,15035483,15299159,15497299,15695438,15893834,16091974,16224833,16357693,16425017,16557877,16625457,16627245,16629289,16631334,16567845,16438820,16310052,16115494,15921190,15726625]),viridis:Br("Viridis","sequential","Perceptually uniform shades of blue-green-yellow",[4524123,4656994,4658793,4726127,4727668,4663929,4599933,4535937,4406404,4276870,4081800,3952010,3822475,3627148,3497356,3302029,3172237,3042446,2912654,2782862,2652814,2523022,2393229,2328973,2198924,2069132,2004874,2005897,2007175,2139525,2337154,2666111,3060348,3520376,4045684,4570991,5227369,5883748,6605661,7392854,8180303,8967495,9819967,10672695,11525166,12443174,13295646,14148121,15000344,15852828,16639780]),cividis:Br("Cividis","sequential","Perceptually uniform shades of blue-green-yellow, should look effectively identical to colorblind and non-colorblind users",[11367,12400,537456,1455727,2046574,2571629,3031404,3425388,3754092,4148075,4476779,4805227,5133932,5396844,5725549,5988462,6317166,6580079,6843249,7171698,7434867,7697781,7960951,8289656,8618104,8881272,9209976,9538679,9867127,10195830,10524533,10853235,11181938,11510640,11839343,12168045,12497002,12891240,13219941,13548642,13943134,14271834,14666326,14995025,15389516,15718470,16112703,16507190,16639799]),twilight:Br("Twilight","sequential","Perceptually uniform shades of white-blue-black-red-white, cyclic",[14670305,14211037,13554648,12766675,11847630,10993866,10139847,9351365,8628419,8036290,7509952,7048895,6718653,6519739,6386105,6252470,6184114,6181293,6112935,6044831,5976470,5777291,5447293,5052270,4592479,4067665,3674181,3281211,3150646,3543352,4067644,4657728,5379141,6166345,6953549,7741007,8463184,9120336,9777743,10304079,10830671,11291984,11687762,12083541,12348505,12613471,12878439,13077872,13211771,13411209,13545111,13809830,14074293,14338756,14537169,14735067,14801121]),turbo:Br("Turbo","sequential","Improved (smooth) rainbow colormap for visualization",[4866485,4872413,4354034,3770361,3120629,2667241,2475736,2611140,3073454,3928216,5109892,6487408,8126047,9829201,11531332,13167162,14605618,15780908,16693543,16753699,16748063,16741916,16146200,15026195,13644558,12198408,10818563,9833728]),rainbow:Br("Rainbow","sequential","",[3367393,3516485,16383744,15501073,12526114]),"red-white-blue":Br("Red-White-Blue","diverging","",[12526114,16777215,3367393])},QU=Object.keys(Ad).map(e=>[e,Ad[e].label,y1(Ad[e].type)]),QLe=QU.filter(e=>"diverging"===Ad[e[0]].type||"sequential"===Ad[e[0]].type),JLe=QU.filter(e=>"qualitative"===Ad[e[0]].type);function cp(e){return e in Ad?Ad[e]:(console.warn(`unknown color list named '${e}'`),Ad["red-yellow-blue"])}function v1(e){return{kind:"table-legend",table:e}}const t6e={domain:[0,1],reverse:!1,listOrName:"red-yellow-blue",minLabel:"",maxLabel:""};var up;!function(e){e.create=function t(n){const{domain:r,reverse:i,listOrName:o}={...t6e,...n},s="string"==typeof o?cp(o).list:o,a=i?s.slice().reverse():s,l=a.length-1;let c=0,u=0,d=0;function f(y,v){u=y,d=v,c=d-u||1}f(r[0],r[1]);const p=Ll(n.minLabel,u.toString()),m=Ll(n.maxLabel,d.toString());let h;if(a.every(y=>Array.isArray(y))){const y=[...a];y.sort((w,A)=>w[1]-A[1]);const v=y.map(w=>w[0]),x=rt.ofSortedArray(y.map(w=>w[1])),_=v.length-1;h=w=>{const A=al((w-u)/c,0,1),M=rt.findPredecessorIndex(x,A);if(0===M)return v[u];if(M>_)return v[_];const E=x[M-1],T=al((A-E)/(x[M]-E),0,1);return st.interpolate(v[M-1],v[M],T)}}else h=y=>{const v=Math.min(a.length-1,Math.max(0,(y-u)/c*l)),x=Math.floor(v),_=a[x],w=a[Math.ceil(v)];return st.interpolate(_,w,v-x)};return{color:h,colorToArray:(y,v,x)=>{st.toArray(h(y),v,x)},normalizedColorToArray:(y,v,x)=>{st.toArrayNormalized(h(y),v,x)},setDomain:f,get legend(){return function e6e(e,t,n){return{kind:"scale-legend",minLabel:e,maxLabel:t,colors:n}}(p,m,a)}}}}(up||(up={}));const cse=new Set(["145","147","149","289","291","293","445","475","491","510","604","045","05L","07E","07Y","08U","09X","0AT","0BD","0H0","0HX","0LP","0MK","0NZ","0TS","0UB","0V4","0WK","0XY","0YT","10M","12E","14T","15L","16F","16G","16O","17T","18D","18O","18T","1AR","1BW","1CF","1FT","1GL","1GN","1JB","1LL","1NA","1S3","1S4","1SD","1X4","20S","20X","22O","22S","23V","24S","25E","26M","26O","26Q","26R","26V","26W","26Y","27C","2DG","2DR","2F8","2FG","2FL","2FP","2GL","2GS","2H5","2HA","2M4","2M5","2M8","2OS","2SI","2WP","2WS","32O","34V","38J","3BU","3CM","3DO","3DY","3FM","3GR","3HD","3J3","3J4","3LJ","3LR","3MF","3MG","3MK","3R3","3S6","3SA","3YW","40J","42D","44S","46D","46M","46Z","48Z","49A","49S","49T","49V","4AM","4CQ","4GC","4GL","4GP","4JA","4N2","4NN","4QY","4R1","4RS","4SG","4U0","4U1","4U2","4UZ","4V5","50A","51N","56N","57S","5DI","5GF","5GO","5II","5KQ","5KS","5KT","5KV","5L2","5L3","5LS","5LT","5MM","5N6","5QP","5RP","5SA","5SP","5TH","5TJ","5TK","5TM","61J","62I","64K","66O","6BG","6C2","6DM","6GB","6GP","6GR","6K3","6KH","6KL","6KS","6KU","6KW","6LA","6LS","6LW","6MJ","6MN","6PG","6PY","6PZ","6S2","6SA","6UD","6Y6","6YR","6ZC","73E","79J","7CV","7D1","7GP","7JZ","7K2","7K3","7NU","7SA","83Y","89Y","8B7","8B9","8EX","8GA","8GG","8GP","8I4","8LM","8LR","8OQ","8PK","8S0","8YV","95Z","96O","98U","9AM","9C1","9CD","9GP","9KJ","9MR","9OK","9PG","9QG","9QZ","9S7","9SG","9SJ","9SM","9SP","9T1","9T7","9VP","9WJ","9WN","9WZ","9YW","A0K","A1Q","A2G","A5C","A6P","AAL","AAO","ABC","ABD","ABE","ABF","ABL","AC1","ACG","ACR","ACX","ADA","ADG","ADR","AF1","AFD","AFL","AFO","AFP","AFR","AGC","AGH","AGL","AGR","AH2","AH8","AHG","AHM","AHR","AIG","ALL","ALX","AMG","AMN","AMU","AMV","ANA","AOG","AOS","AQA","ARA","ARB","ARE","ARI","ARW","ASC","ASG","ASO","AXP","AXR","AY9","AZC","B0D","B16","B1H","B1N","B2G","B4G","B6D","B7G","B8D","B9D","BBK","BBV","BCD","BCW","BDF","BDG","BDP","BDR","BDZ","BEM","BFN","BFP","BG6","BG8","BGC","BGL","BGN","BGP","BGS","BHG","BM3","BM7","BMA","BMX","BND","BNG","BNX","BO1","BOG","BQY","BRI","BS7","BTG","BTU","BW3","BWG","BXF","BXP","BXX","BXY","BZD","C3B","C3G","C3X","C4B","C4W","C4X","C5X","CAP","CBF","CBI","CBK","CDR","CE5","CE6","CE8","CEG","CEX","CEY","CEZ","CGF","CJB","CKB","CKP","CNP","CR1","CR6","CRA","CT3","CTO","CTR","CTT","D0N","D1M","D5E","D6G","DAF","DAG","DAN","DDA","DDB","DDL","DEG","DEL","DFR","DFX","DG0","DGC","DGD","DGM","DGO","DGS","DGU","DIG","DJB","DJE","DK4","DKX","DKZ","DL6","DLD","DLF","DLG","DMU","DNO","DO8","DOM","DP5","DPC","DQQ","DQR","DR2","DR3","DR4","DR5","DRI","DSR","DT6","DVC","DYM","E3M","E4P","E5G","EAG","EBG","EBQ","EEN","EEQ","EGA","EJT","EMP","EMZ","EPG","EQP","EQV","ERE","ERI","ETT","EUS","F1P","F1X","F55","F58","F6P","F8X","FBP","FCA","FCB","FCT","FDP","FDQ","FFC","FFX","FIF","FIX","FK9","FKD","FMF","FMO","FNG","FNY","FRU","FSA","FSI","FSM","FSR","FSW","FU4","FUB","FUC","FUD","FUF","FUL","FUY","FVQ","FX1","FYJ","G0S","G16","G1P","G20","G28","G2F","G3F","G3I","G4D","G4S","G6D","G6P","G6S","G7P","G8Z","GAA","GAC","GAD","GAF","GAL","GAT","GBH","GC1","GC4","GC9","GCB","GCD","GCN","GCO","GCS","GCT","GCU","GCV","GCW","GDA","GDL","GE1","GE3","GFP","GIV","GL0","GL1","GL2","GL4","GL5","GL6","GL7","GL9","GLA","GLB","GLC","GLD","GLF","GLG","GLO","GLP","GLS","GLT","GLW","GM0","GMB","GMH","GMT","GMZ","GN1","GN4","GNS","GNX","GP0","GP1","GP4","GPH","GPK","GPM","GPO","GPQ","GPU","GPV","GPW","GQ1","GRF","GRX","GS1","GS4","GS9","GSA","GSD","GTE","GTH","GTK","GTM","GTR","GU0","GU1","GU2","GU3","GU4","GU5","GU6","GU8","GU9","GUF","GUL","GUP","GUZ","GXL","GXV","GYE","GYG","GYP","GYU","GYV","GZL","H1M","H1S","H2P","H3S","H53","H6Q","H6Z","HBZ","HD4","HDL","HMS","HNV","HNW","HSG","HSH","HSJ","HSQ","HSR","HSU","HSX","HSY","HSZ","HTG","HTM","HVC","I57","IAB","IDC","IDF","IDG","IDR","IDS","IDT","IDU","IDX","IDY","IEM","IN1","IPT","ISD","ISL","ISX","IVG","IXD","J5B","JFZ","JHM","JLT","JRV","JS2","JSV","JV4","JVA","JVS","JZR","K5B","K99","KBA","KBG","KD5","KDA","KDB","KDD","KDE","KDF","KDM","KDN","KDO","KDR","KFN","KG1","KGM","KHP","KME","KO1","KO2","KOT","KQC","KTU","L1L","L6N","L6S","L6T","LAG","LAH","LAI","LAK","LAO","LAT","LB2","LBS","LBT","LCN","LDY","LEC","LER","LFC","LFR","LGC","LGU","LKA","LKS","LM2","LMO","LMT","LMU","LNV","LOG","LOX","LPK","LRH","LSM","LTG","LTM","LVO","LVZ","LXB","LXC","LXZ","LZ0","M1F","M1P","M2F","M3M","M3N","M55","M6D","M6P","M7B","M7P","M8C","MA1","MA2","MA3","MA8","MAB","MAF","MAG","MAL","MAN","MAT","MAV","MAW","MBE","MBF","MBG","MCU","MDA","MDP","MFA","MFB","MFU","MG5","MGA","MGC","MGL","MGS","MJJ","MLB","MLR","MMA","MMN","MN0","MNA","MQG","MQT","MRH","MRP","MSX","MTT","MUB","MUG","MUR","MVP","MXY","MXZ","MYG","N1L","N3U","N9S","NA1","NAA","NAG","NBG","NBX","NBY","NDG","NED","NFG","NG1","NG6","NGA","NGB","NGC","NGE","NGF","NGK","NGL","NGR","NGS","NGY","NGZ","NHF","NLC","NM6","NM9","NNG","NPF","NSQ","NT1","NTF","NTO","NTP","NXD","NYT","O1G","OAK","OEL","OI7","OPM","ORP","OSU","OTG","OTN","OTU","OX2","P53","P6P","P8E","PA1","PA5","PAV","PDX","PH5","PKM","PNA","PNG","PNJ","PNW","PPC","PRP","PSG","PSJ","PSV","PTQ","PUF","PZU","QDK","QIF","QKH","QPS","QV4","R1P","R1X","R2B","R2G","R5P","RAA","RAE","RAF","RAM","RAO","RAT","RB5","RBL","RCD","RDP","REL","RER","RF5","RG1","RGG","RHA","RHC","RI2","RIB","RIP","RM4","RNS","RNT","ROB","ROR","RP3","RP5","RP6","RPA","RR7","RRJ","RRY","RST","RTG","RTV","RUB","RUG","RUU","RV7","RVG","RVM","RWI","RY7","RZM","S6P","S7P","S81","SA0","SCG","SCR","SDD","SDY","SEJ","SF6","SF9","SFJ","SFU","SG4","SG5","SG6","SG7","SGA","SGC","SGD","SGN","SGS","SHB","SHD","SHG","SI3","SIA","SID","SIO","SIZ","SLB","SLM","SLT","SMD","SN5","SNG","SOE","SOG","SOL","SOR","SR1","SSG","SSH","STW","STZ","SUC","SUP","SUS","SWE","SZZ","T68","T6D","T6P","T6T","TA6","TAG","TCB","TCG","TDG","TEU","TF0","TFU","TGA","TGK","TGR","TGY","TH1","TM5","TM6","TM9","TMR","TMX","TNX","TOA","TOC","TQY","TRE","TRV","TS8","TT7","TTV","TTZ","TU4","TUG","TUJ","TUP","TUR","TVD","TVG","TVM","TVS","TVV","TVY","TW7","TWA","TWD","TWG","TWJ","TWY","TXB","TY6","TYV","U1Y","U2A","U2D","U63","U8V","U97","U9A","U9D","U9G","U9J","U9M","UAP","UBH","UBO","UCD","UDC","UEA","V3M","V3P","V71","VDF","VG1","VJ1","VJ4","VKN","VTB","W9T","WIA","WOO","WUN","WZ1","WZ2","WZ4","X0X","X1P","X1X","X2F","X2Y","X34","X4S","X5S","X6X","X6Y","XBP","XDP","XDX","XGP","XIL","XKJ","XLF","XLS","XMM","XS2","XUL","XXM","XXR","XXX","XY6","XY9","XYB","XYF","XYL","XYP","XYS","XYT","XYZ","YDR","YIO","YJM","YKR","YO5","YX0","YX1","YYB","YYD","YYH","YYJ","YYK","YYM","YYQ","YYR","YZ0","YZT","Z0F","Z15","Z16","Z2D","Z2T","Z3K","Z3L","Z3Q","Z3U","Z4K","Z4R","Z4S","Z4U","Z4V","Z4W","Z4Y","Z57","Z5J","Z5L","Z61","Z6G","Z6H","Z6J","Z6W","Z8H","Z8T","Z9D","Z9E","Z9H","Z9K","Z9L","Z9M","Z9N","Z9W","ZB0","ZB1","ZB2","ZB3","ZCD","ZCZ","ZD0","ZDC","ZDM","ZDO","ZEE","ZEL","ZGE","ZMR","UMQ","SQD"]);var Gi=function(e){return e[e.FilledSphere=0]="FilledSphere",e[e.FilledCube=1]="FilledCube",e[e.CrossedCube=2]="CrossedCube",e[e.DividedDiamond=3]="DividedDiamond",e[e.FilledCone=4]="FilledCone",e[e.DevidedCone=5]="DevidedCone",e[e.FlatBox=6]="FlatBox",e[e.FilledStar=7]="FilledStar",e[e.FilledDiamond=8]="FilledDiamond",e[e.FlatDiamond=9]="FlatDiamond",e[e.FlatHexagon=10]="FlatHexagon",e[e.Pentagon=11]="Pentagon",e[e.DiamondPrism=12]="DiamondPrism",e[e.PentagonalPrism=13]="PentagonalPrism",e[e.HexagonalPrism=14]="HexagonalPrism",e[e.HeptagonalPrism=15]="HeptagonalPrism",e}(Gi||{});var zt=function(e){return e[e.Hexose=0]="Hexose",e[e.HexNAc=1]="HexNAc",e[e.Hexosamine=2]="Hexosamine",e[e.Hexuronate=3]="Hexuronate",e[e.Deoxyhexose=4]="Deoxyhexose",e[e.DeoxyhexNAc=5]="DeoxyhexNAc",e[e.DiDeoxyhexose=6]="DiDeoxyhexose",e[e.Pentose=7]="Pentose",e[e.Deoxynonulosonate=8]="Deoxynonulosonate",e[e.DiDeoxynonulosonate=9]="DiDeoxynonulosonate",e[e.Unknown=10]="Unknown",e[e.Assigned=11]="Assigned",e}(zt||{});const r6e={[zt.Hexose]:Gi.FilledSphere,[zt.HexNAc]:Gi.FilledCube,[zt.Hexosamine]:Gi.CrossedCube,[zt.Hexuronate]:Gi.DividedDiamond,[zt.Deoxyhexose]:Gi.FilledCone,[zt.DeoxyhexNAc]:Gi.DevidedCone,[zt.DiDeoxyhexose]:Gi.FlatBox,[zt.Pentose]:Gi.FilledStar,[zt.Deoxynonulosonate]:Gi.FilledDiamond,[zt.DiDeoxynonulosonate]:Gi.FlatDiamond,[zt.Unknown]:Gi.FlatHexagon,[zt.Assigned]:Gi.Pentagon};function i6e(e,t){return e===zt.Unknown?4===t?Gi.DiamondPrism:5===t?Gi.PentagonalPrism:6===t?Gi.HexagonalPrism:7===t?Gi.HeptagonalPrism:Gi.FlatHexagon:r6e[e]}const JU={abbr:"Unk",name:"Unknown",color:15854817,type:zt.Unknown},gw=[{abbr:"Glc",name:"Glucose",color:37052,type:zt.Hexose},{abbr:"Man",name:"Mannose",color:42577,type:zt.Hexose},{abbr:"Gal",name:"Galactose",color:16765952,type:zt.Hexose},{abbr:"Gul",name:"Gulose",color:16021792,type:zt.Hexose},{abbr:"Alt",name:"Altrose",color:16162465,type:zt.Hexose},{abbr:"All",name:"Allose",color:10830745,type:zt.Hexose},{abbr:"Tal",name:"Talose",color:9424105,type:zt.Hexose},{abbr:"Ido",name:"Idose",color:10582605,type:zt.Hexose},{abbr:"GlcNAc",name:"N-Acetyl Glucosamine",color:37052,type:zt.HexNAc},{abbr:"ManNAc",name:"N-Acetyl Mannosamine",color:42577,type:zt.HexNAc},{abbr:"GalNAc",name:"N-Acetyl Galactosamine",color:16765952,type:zt.HexNAc},{abbr:"GulNAc",name:"N-Acetyl Gulosamine",color:16021792,type:zt.HexNAc},{abbr:"AltNAc",name:"N-Acetyl Altrosamine",color:16162465,type:zt.HexNAc},{abbr:"AllNAc",name:"N-Acetyl Allosamine",color:10830745,type:zt.HexNAc},{abbr:"TalNAc",name:"N-Acetyl Talosamine",color:9424105,type:zt.HexNAc},{abbr:"IdoNAc",name:"N-Acetyl Idosamine",color:10582605,type:zt.HexNAc},{abbr:"GlcN",name:"Glucosamine",color:37052,type:zt.Hexosamine},{abbr:"ManN",name:"Mannosamine",color:42577,type:zt.Hexosamine},{abbr:"GalN",name:"Galactosamine",color:16765952,type:zt.Hexosamine},{abbr:"GulN",name:"Gulosamine",color:16021792,type:zt.Hexosamine},{abbr:"AltN",name:"Altrosamine",color:16162465,type:zt.Hexosamine},{abbr:"AllN",name:"Allosamine",color:10830745,type:zt.Hexosamine},{abbr:"TalN",name:"Talosamine",color:9424105,type:zt.Hexosamine},{abbr:"IdoN",name:"Idosamine",color:10582605,type:zt.Hexosamine},{abbr:"GlcA",name:"Glucuronic Acid",color:37052,type:zt.Hexuronate},{abbr:"ManA",name:"Mannuronic Acid",color:42577,type:zt.Hexuronate},{abbr:"GalA",name:"Galacturonic Acid",color:16765952,type:zt.Hexuronate},{abbr:"GulA",name:"Guluronic Acid",color:16021792,type:zt.Hexuronate},{abbr:"AltA",name:"Altruronic Acid",color:16162465,type:zt.Hexuronate},{abbr:"AllA",name:"Alluronic Acid",color:10830745,type:zt.Hexuronate},{abbr:"TalA",name:"Taluronic Acid",color:9424105,type:zt.Hexuronate},{abbr:"IdoA",name:"Iduronic Acid",color:10582605,type:zt.Hexuronate},{abbr:"Qui",name:"Quinovose",color:37052,type:zt.Deoxyhexose},{abbr:"Rha",name:"Rhamnose",color:42577,type:zt.Deoxyhexose},{abbr:"6dGul",name:"6-Deoxy Gulose",color:16021792,type:zt.Deoxyhexose},{abbr:"6dAlt",name:"6-Deoxy Altrose",color:16162465,type:zt.Deoxyhexose},{abbr:"6dTal",name:"6-Deoxy Talose",color:9424105,type:zt.Deoxyhexose},{abbr:"Fuc",name:"Fucose",color:15539236,type:zt.Deoxyhexose},{abbr:"QuiNAc",name:"N-Acetyl Quinovosamine",color:37052,type:zt.DeoxyhexNAc},{abbr:"RhaNAc",name:"N-Acetyl Rhamnosamine",color:42577,type:zt.DeoxyhexNAc},{abbr:"6dAltNAc",name:"N-Acetyl 6-Deoxy Altrosamine",color:16162465,type:zt.DeoxyhexNAc},{abbr:"6dTalNAc",name:"N-Acetyl 6-Deoxy Talosamine",color:9424105,type:zt.DeoxyhexNAc},{abbr:"FucNAc",name:"N-Acetyl Fucosamine",color:15539236,type:zt.DeoxyhexNAc},{abbr:"Oli",name:"Olivose",color:37052,type:zt.DiDeoxyhexose},{abbr:"Tyv",name:"Tyvelose",color:42577,type:zt.DiDeoxyhexose},{abbr:"Abe",name:"Abequose",color:16021792,type:zt.DiDeoxyhexose},{abbr:"Par",name:"Paratose",color:16162465,type:zt.DiDeoxyhexose},{abbr:"Dig",name:"Digitoxose",color:10830745,type:zt.DiDeoxyhexose},{abbr:"Col",name:"Colitose",color:9424105,type:zt.DiDeoxyhexose},{abbr:"Ara",name:"Arabinose",color:42577,type:zt.Pentose},{abbr:"Lyx",name:"Lyxose",color:16765952,type:zt.Pentose},{abbr:"Xyl",name:"Xylose",color:16021792,type:zt.Pentose},{abbr:"Rib",name:"Ribose",color:16162465,type:zt.Pentose},{abbr:"Kdn",name:"Keto-Deoxy Nonulonic Acid",color:42577,type:zt.Deoxynonulosonate},{abbr:"Neu5Ac",name:"N-Acetyl Neuraminic Acid",color:10830745,type:zt.Deoxynonulosonate},{abbr:"Neu5Gc",name:"N-Glycolyl Neuraminic Acid",color:9424105,type:zt.Deoxynonulosonate},{abbr:"Neu",name:"Neuraminic Acid",color:10582605,type:zt.Deoxynonulosonate},{abbr:"Sia",name:"Sialic acid",color:15539236,type:zt.Deoxynonulosonate},{abbr:"Pse",name:"Pseudaminic Acid",color:42577,type:zt.DiDeoxynonulosonate},{abbr:"Leg",name:"Legionaminic Acid",color:16765952,type:zt.DiDeoxynonulosonate},{abbr:"Aci",name:"Acinetaminic Acid",color:16162465,type:zt.DiDeoxynonulosonate},{abbr:"4eLeg",name:"4-Epilegionaminic Acid",color:9424105,type:zt.DiDeoxynonulosonate},{abbr:"Bac",name:"Bacillosamine",color:37052,type:zt.Unknown},{abbr:"LDmanHep",name:"L-Glycero-D-Manno Heptose",color:42577,type:zt.Unknown},{abbr:"Kdo",name:"Keto-Deoxy Octulonic Acid",color:16765952,type:zt.Unknown},{abbr:"Dha",name:"3-Deoxy Lyxo-Heptulosaric Acid",color:16021792,type:zt.Unknown},{abbr:"DDmanHep",name:"D-Glycero-D-Manno-Heptose",color:16162465,type:zt.Unknown},{abbr:"MurNAc",name:"N-Acetyl Muramic Acid",color:10830745,type:zt.Unknown},{abbr:"MurNGc",name:"N-Glycolyl Muramic Acid",color:9424105,type:zt.Unknown},{abbr:"Mur",name:"Muramic Acid",color:10582605,type:zt.Unknown},{abbr:"Api",name:"Apicose",color:42577,type:zt.Assigned},{abbr:"Fru",name:"Fructose",color:42577,type:zt.Assigned},{abbr:"Tag",name:"Tagatose",color:16765952,type:zt.Assigned},{abbr:"Sor",name:"Sorbose",color:16021792,type:zt.Assigned},{abbr:"Psi",name:"Psicose",color:16162465,type:zt.Assigned}],o6e=function(){const e=new Map;for(let t=0,n=gw.length;t{e.has(t)||e.set(t,JU)}),e}(),l6e=function(){const e=new Map;for(let t=0,n=gw.length;t{e.has(t)||e.set(t,JU)}),e}();let $0=fse;var Lo;!function(e){e.toArray=function t(p){return Array.from(p.values())},e.isSuperset=function n(p,m){if(p.size[e[0],Jx(e[1])])),p6e={0:{trace:new Set,directionFrom:new Set,directionTo:new Set,backboneStart:new Set,backboneEnd:new Set,coarseBackbone:new Set},1:{trace:new Set(["CA"]),directionFrom:new Set(["C"]),directionTo:new Set(["O","OC1","O1","OX1","OXT","OT1"]),backboneStart:new Set(["N"]),backboneEnd:new Set(["C"]),coarseBackbone:new Set(["CA","BB","CA1"])},2:{trace:new Set(["CA"]),directionFrom:new Set(["C"]),directionTo:new Set(["O"]),backboneStart:new Set(["N"]),backboneEnd:new Set(["CD"]),coarseBackbone:new Set(["CA"])},3:{trace:new Set(["CA"]),directionFrom:new Set(["C"]),directionTo:new Set(["O"]),backboneStart:new Set(["N"]),backboneEnd:new Set(["CG"]),coarseBackbone:new Set(["CA"])},4:{trace:new Set(["O3'","O3*"]),directionFrom:new Set(["C4'","C4*"]),directionTo:new Set(["C3'","C3*"]),backboneStart:new Set(["P"]),backboneEnd:new Set(["O3'","O3*"]),coarseBackbone:new Set(["P"])},5:{trace:new Set(["O3'","O3*"]),directionFrom:new Set(["C3'","C3*"]),directionTo:new Set(["C1'","C1*"]),backboneStart:new Set(["P"]),backboneEnd:new Set(["O3'","O3*"]),coarseBackbone:new Set(["P"])},6:{trace:new Set(["N4'","N4*"]),directionFrom:new Set(["N4'","N4*"]),directionTo:new Set(["C7'","C7*"]),backboneStart:new Set(["N1'","N1*"]),backboneEnd:new Set(["C'","C*"]),coarseBackbone:new Set(["P"])}},Y0=new Set(["CA","C","N","O","O1","O2","OC1","OC2","OT1","OT2","OX1","OXT","H","H1","H2","H3","HA","HN","HXT","BB"]),XR=new Set(["P","OP1","OP2","HOP2","HOP3","O2'","O3'","O4'","O5'","C1'","C2'","C3'","C4'","C5'","H1'","H2'","H2''","HO2'","H3'","H4'","H5'","H5''","HO3'","HO5'","O2*","O3*","O4*","O5*","C1*","C2*","C3*","C4*","C5*"]),gse=new Set(["d-peptide linking","d-peptide nh3 amino terminus","d-peptide cooh carboxy terminus","d-gamma-peptide, c-delta linking","d-beta-peptide, c-gamma linking"]),yse=new Set(["l-peptide linking","l-peptide nh3 amino terminus","l-peptide cooh carboxy terminus","l-gamma-peptide, c-delta linking","l-beta-peptide, c-gamma linking"]),h6e=new Set(["d-gamma-peptide, c-delta linking","l-gamma-peptide, c-delta linking"]),m6e=new Set(["d-beta-peptide, c-gamma linking","l-beta-peptide, c-gamma linking"]),g6e=new Set(["d-peptide nh3 amino terminus","d-peptide cooh carboxy terminus","l-peptide nh3 amino terminus","l-peptide cooh carboxy terminus"]),bse=new Set(["peptide linking","peptide-like"]),y6e=Lo.unionMany(gse,yse,bse),vse=new Set(["dna linking","l-dna linking","dna oh 5 prime terminus","dna oh 3 prime terminus"]),xse=new Set(["rna linking","l-rna linking","rna oh 5 prime terminus","rna oh 3 prime terminus"]),_se=Lo.unionMany(new Set(["d-saccharide, beta linking","l-saccharide, beta linking","d-saccharide, alpha linking","l-saccharide, alpha linking","l-saccharide","d-saccharide","saccharide"]),new Set(["d-saccharide 1,4 and 1,4 linking","l-saccharide 1,4 and 1,4 linking","d-saccharide 1,4 and 1,6 linking","l-saccharide 1,4 and 1,6 linking"])),b6e=new Set(["non-polymer","other"]),v6e=new Set(["ion"]),x6e=new Set(["lipid"]),KR=new Set(["SOL","WAT","HOH","H2O","W","DOD","D3O","TIP","TIP3","TIP4","SPC"]),ez=new Set(["HIS","ARG","LYS","ILE","PHE","LEU","TRP","ALA","MET","PRO","CYS","ASN","VAL","GLY","SER","GLN","TYR","ASP","GLU","THR","SEC","PYL","UNK","MSE","SEP","TPO","PTR","PCA","HYP","HSD","HSE","HSP","LSN","ASPP","GLUP","HID","HIE","HIP","LYN","ASH","GLH"]),Sse=new Set(["DAL","DAR","DSG","DAS","DCY","DGL","DGN","DHI","DIL","DLE","DLY","MED","DPN","DPR","DSN","DTH","DTR","DTY","DVA","DNE"]),A3=Lo.unionMany(ez,Sse),_6e=new Set(["NME","ACE","NH2","FOR","FMT"]),I3=new Set(["A","C","T","G","I","U","N"]),E3=new Set(["DA","DC","DT","DG","DI","DU","DN"]),tz=new Set(["APN","CPN","TPN","GPN"]),S6e=new Set(["A","G","I","DA","DG","DI","APN","GPN"]),C6e=new Set(["C","T","U","DC","DT","DU","CPN","TPN"]),ZR=Lo.unionMany(I3,E3,tz),w6e=e=>S6e.has(e.toUpperCase()),A6e=e=>C6e.has(e.toUpperCase()),yw=Lo.unionMany(A3,ZR);function x1(e,t){return t=t.toUpperCase(),tz.has(t)?8:y6e.has(e)?5:xse.has(e)?6:vse.has(e)?7:_se.has(e)?9:KR.has(t)?2:hse.has(t)?3:pse.has(t)?4:b6e.has(e)?$0.has(t)?9:A3.has(t)?5:I3.has(t)?6:E3.has(t)?7:1:0}function I6e(e,t){return 5===t?h6e.has(e)?2:m6e.has(e)?3:g6e.has(e)?0:1:6===t?4:7===t?5:8===t?6:0}function Cse(e){return e=e.toUpperCase(),A3.has(e)?"peptide linking":I3.has(e)?"rna linking":E3.has(e)?"dna linking":$0.has(e)?"saccharide":"other"}function T6e(e){return e=e.toUpperCase(),KR.has(e)?"water":yw.has(e)?"polymer":$0.has(e)?"branched":"non-polymer"}function D6e(e,t){return e=e.toUpperCase(),yse.has(t)?"polypeptide(L)":gse.has(t)?"polypeptide(D)":xse.has(t)?"polyribonucleotide":vse.has(t)?"polydeoxyribonucleotide":_se.has(t)||$0.has(e)?"oligosaccharide":tz.has(e)?"peptide nucleic acid":ez.has(e)?"polypeptide(L)":Sse.has(e)?"polypeptide(D)":I3.has(e)?"polyribonucleotide":E3.has(e)?"polydeoxyribonucleotide":v6e.has(t)||hse.has(e)?"ion":x6e.has(t)||pse.has(e)?"lipid":bse.has(t)?"peptide-like":"other"}function QR(e){return Fu(e)||wse(e)}function Fu(e){return 7===e||6===e||8===e}function wse(e){return 5===e}var pi,Lr;!function(e){e.is=Mc.has,e.create=Mc.create,e.SecondaryStructureMmcif={helx_lh_27_p:1058,helx_lh_3t_p:2082,helx_lh_al_p:4130,helx_lh_a_n:524321,helx_lh_b_n:1048609,helx_lh_ga_p:8226,helx_lh_n:33,helx_lh_om_p:16418,helx_lh_ot_n:131105,helx_lh_ot_p:546,helx_lh_p:34,helx_lh_pi_p:32802,helx_lh_pp_p:65570,helx_lh_z_n:262177,helx_n:1,helx_ot_n:1,helx_ot_p:2,helx_p:2,helx_rh_27_p:1090,helx_rh_3t_p:2114,helx_rh_al_p:4162,helx_rh_a_n:524353,helx_rh_b_n:1048641,helx_rh_ga_p:8258,helx_rh_n:65,helx_rh_om_p:16450,helx_rh_ot_n:131137,helx_rh_ot_p:578,helx_rh_p:66,helx_rh_pi_p:32834,helx_rh_pp_p:65602,helx_rh_z_n:262209,strn:4194308,turn_ot_p:33554448,turn_p:16,turn_ty1p_p:67109136,turn_ty1_p:67109008,turn_ty2p_p:134218e3,turn_ty2_p:134217872,turn_ty3p_p:268435728,turn_ty3_p:268435600,bend:8,other:0},e.SecondaryStructurePdb={1:4162,2:16450,3:32834,4:8258,5:2114,6:4130,7:16418,8:8226,9:1026,10:65538},e.SecondaryStructureStride={H:4098,G:2050,I:32770,E:8388612,B:4194308,T:16,C:536870912},e.SecondaryStructureDssp={H:4098,B:4194308,E:8388612,G:2050,I:32770,T:16,S:8}}(pi||(pi={})),function(e){function o(a){switch(a){case"covalent":return 1;case"metal-coordination":return 2;case"hydrogen-bond":return 4;case"disulfide":return 8;case"aromatic":return 16;case"computed":return 32}}e.is=Mc.has,e.create=function t(a){return Mc.create(a)},e.isCovalent=function n(a){return!!(1&a)},e.isAll=function r(a){return a===Math.pow(2,6)-1},e.Names={covalent:1,"metal-coordination":2,"hydrogen-bond":4,disulfide:8,aromatic:16,computed:32},e.isName=function i(a){return a in e.Names},e.fromName=o,e.fromNames=function s(a){let l=0;for(let c=0,u=a.length;cthis.radiusSq&&(this.radiusSq=n)}radiusSphereStep(t,n){const r=M6e(t,this.center)+n,i=r*r;i>this.radiusSq&&(this.radiusSq=i)}getSphere(t){return t||(t=ke()),C.copy(t.center,this.center),t.radius=Math.sqrt(this.radiusSq),t}getCount(){return this.count}constructor(){this.count=0,this.center=C(),this.radiusSq=0}}!function(e){const t=new e,n=C(),r=C();e.fromArrays=function i({x:a,y:l,z:c},u){t.reset();const d=a.length;for(let f=0;f{s.forEach(a=>{n+=a.edgeCount,a.connectedIndices.forEach(l=>{a.getEdges(l).forEach(c=>{const{unitA:u,unitB:d}=a,f=dp.getEdgeKey(l,u,c.indexB,d);i.set(f,r.length);const p=dp.getVertexKey(l,u),m=o.get(p);void 0===m?o.set(p,[r.length]):m.push(r.length),r.push({...c,indexA:l,unitA:u,unitB:d})})})})}),this.edgeCount=n,this.edges=r,this.edgeKeyIndex=i,this.vertexKeyIndex=o}}!function(e){class t{hasEdges(a){return this.edgeMap.has(a)}getEdges(a){return this.edgeMap.has(a)?this.edgeMap.get(a):Ase}get areUnitsOrdered(){return this.unitA0?i:t<0?n:(n+r)/1.95}const B6e=iz.H;function K0(e){return e===B6e}const L6e=new Map([["HIS|CD2|CG",2],["HIS|CE1|ND1",2],["ARG|CZ|NH2",2],["PHE|CE1|CZ",2],["PHE|CD2|CE2",2],["PHE|CD1|CG",2],["TRP|CD1|CG",2],["TRP|CD2|CE2",2],["TRP|CE3|CZ3",2],["TRP|CH2|CZ2",2],["ASN|CG|OD1",2],["GLN|CD|OE1",2],["TYR|CD1|CG",2],["TYR|CD2|CE2",2],["TYR|CE1|CZ",2],["ASP|CG|OD1",2],["GLU|CD|OE1",2],["G|C8|N7",2],["G|C4|C5",2],["G|C2|N3",2],["G|C6|O6",2],["C|C4|N3",2],["C|C5|C6",2],["C|C2|O2",2],["A|C2|N3",2],["A|C6|N1",2],["A|C4|C5",2],["A|C8|N7",2],["U|C5|C6",2],["U|C2|O2",2],["U|C4|O4",2],["DG|C8|N7",2],["DG|C4|C5",2],["DG|C2|N3",2],["DG|C6|O6",2],["DC|C4|N3",2],["DC|C5|C6",2],["DC|C2|O2",2],["DA|C2|N3",2],["DA|C6|N1",2],["DA|C4|C5",2],["DA|C8|N7",2],["DT|C5|C6",2],["DT|C2|O2",2],["DT|C4|O4",2]]);function j6e(e,t,n){return[t,n]=tn&&([e,n]=[n,e],[t,r]=[r,t]),U6e.get(`${e}|${t}|${n}|${r}`)||1}var Z0=ce.Schema;const de=Z0.str,Le=Z0.int,dr=Z0.float,oz=Z0.coord,Kt=Z0.Aliased,S1=Z0.Matrix,e5=Z0.Vector,Ii=Z0.lstr,e_=Z0.List,Nr={atom_site:{auth_asym_id:de,auth_atom_id:de,auth_comp_id:de,auth_seq_id:Le,B_iso_or_equiv:dr,Cartn_x:oz,Cartn_y:oz,Cartn_z:oz,group_PDB:Kt(de),id:Le,label_alt_id:de,label_asym_id:de,label_atom_id:de,label_comp_id:de,label_entity_id:de,label_seq_id:Le,occupancy:dr,type_symbol:de,pdbx_PDB_ins_code:de,pdbx_PDB_model_num:Le,pdbx_formal_charge:Le,pdbx_label_index:Le,pdbx_sifts_xref_db_name:de,pdbx_sifts_xref_db_acc:de,pdbx_sifts_xref_db_num:de,pdbx_sifts_xref_db_res:de,ihm_model_id:Le},atom_site_anisotrop:{id:Le,type_symbol:de,U:S1(3,3),U_esd:S1(3,3),pdbx_auth_seq_id:de,pdbx_auth_asym_id:de,pdbx_auth_atom_id:de,pdbx_auth_comp_id:de,pdbx_label_seq_id:Le,pdbx_label_alt_id:de,pdbx_label_asym_id:de,pdbx_label_atom_id:de,pdbx_label_comp_id:de,pdbx_PDB_ins_code:de},atom_sites:{entry_id:de,fract_transf_matrix:S1(3,3),fract_transf_vector:e5(3)},audit_author:{name:de,pdbx_ordinal:Le,identifier_ORCID:de},audit_conform:{dict_location:de,dict_name:de,dict_version:de},cell:{angle_alpha:dr,angle_beta:dr,angle_gamma:dr,entry_id:de,length_a:dr,length_b:dr,length_c:dr,Z_PDB:Le,pdbx_unique_axis:de},chem_comp:{formula:de,formula_weight:dr,id:de,mon_nstd_flag:Kt(Ii),name:de,type:Kt(Ii),pdbx_synonyms:e_(";",e=>e)},chem_comp_bond:{atom_id_1:de,atom_id_2:de,comp_id:de,value_order:Kt(Ii),pdbx_ordinal:Le,pdbx_stereo_config:Kt(Ii),pdbx_aromatic_flag:Kt(Ii)},citation:{book_publisher:de,country:de,id:de,journal_abbrev:de,journal_id_ASTM:de,journal_id_CSD:de,journal_id_ISSN:de,journal_volume:de,page_first:de,page_last:de,title:de,year:Le,pdbx_database_id_DOI:de,pdbx_database_id_PubMed:Le},citation_author:{citation_id:de,name:de,ordinal:Le},database_2:{database_id:Kt(Ii),database_code:de},entity:{details:de,formula_weight:dr,id:de,src_method:Kt(Ii),type:Kt(Ii),pdbx_description:e_(",",e=>e),pdbx_number_of_molecules:Le,pdbx_mutation:de,pdbx_fragment:de,pdbx_ec:e_(",",e=>e)},entity_poly:{entity_id:de,nstd_linkage:Kt(Ii),nstd_monomer:Kt(Ii),type:Kt(de),pdbx_strand_id:e_(",",e=>e),pdbx_seq_one_letter_code:de,pdbx_seq_one_letter_code_can:de,pdbx_target_identifier:de},entity_poly_seq:{entity_id:de,hetero:Kt(Ii),mon_id:de,num:Le},entry:{id:de},exptl:{entry_id:de,method:Kt(de)},software:{classification:de,date:de,description:de,name:de,type:Kt(Ii),version:de,pdbx_ordinal:Le},struct:{entry_id:de,title:de,pdbx_descriptor:de},struct_asym:{details:de,entity_id:de,id:de,pdbx_modified:de,pdbx_blank_PDB_chainid_flag:Kt(de)},struct_conf:{beg_label_asym_id:de,beg_label_comp_id:de,beg_label_seq_id:Le,beg_auth_asym_id:de,beg_auth_comp_id:de,beg_auth_seq_id:Le,conf_type_id:Kt(Ii),details:de,end_label_asym_id:de,end_label_comp_id:de,end_label_seq_id:Le,end_auth_asym_id:de,end_auth_comp_id:de,end_auth_seq_id:Le,id:de,pdbx_beg_PDB_ins_code:de,pdbx_end_PDB_ins_code:de,pdbx_PDB_helix_class:de,pdbx_PDB_helix_length:Le,pdbx_PDB_helix_id:de},struct_conn:{conn_type_id:Kt(Ii),details:de,id:de,ptnr1_label_asym_id:de,ptnr1_label_atom_id:de,ptnr1_label_comp_id:de,ptnr1_label_seq_id:Le,ptnr1_auth_asym_id:de,ptnr1_auth_comp_id:de,ptnr1_auth_seq_id:Le,ptnr1_symmetry:de,ptnr2_label_asym_id:de,ptnr2_label_atom_id:de,ptnr2_label_comp_id:de,ptnr2_label_seq_id:Le,ptnr2_auth_asym_id:de,ptnr2_auth_comp_id:de,ptnr2_auth_seq_id:Le,ptnr2_symmetry:de,pdbx_ptnr1_PDB_ins_code:de,pdbx_ptnr1_label_alt_id:de,pdbx_ptnr1_standard_comp_id:de,pdbx_ptnr2_PDB_ins_code:de,pdbx_ptnr2_label_alt_id:de,pdbx_ptnr3_PDB_ins_code:de,pdbx_ptnr3_label_alt_id:de,pdbx_ptnr3_label_asym_id:de,pdbx_ptnr3_label_atom_id:de,pdbx_ptnr3_label_comp_id:de,pdbx_ptnr3_label_seq_id:Le,pdbx_PDB_id:de,pdbx_dist_value:dr,pdbx_value_order:Kt(Ii)},struct_conn_type:{criteria:de,id:Kt(Ii),reference:de},struct_keywords:{entry_id:de,text:e_(",",e=>e),pdbx_keywords:de},struct_ncs_oper:{code:Kt(de),details:de,id:Le,matrix:S1(3,3),vector:e5(3)},struct_sheet_range:{beg_label_asym_id:de,beg_label_comp_id:de,beg_label_seq_id:Le,end_label_asym_id:de,end_label_comp_id:de,end_label_seq_id:Le,beg_auth_asym_id:de,beg_auth_comp_id:de,beg_auth_seq_id:Le,end_auth_asym_id:de,end_auth_comp_id:de,end_auth_seq_id:Le,id:de,sheet_id:de,pdbx_beg_PDB_ins_code:de,pdbx_end_PDB_ins_code:de},struct_site:{details:de,id:de,pdbx_num_residues:Le,pdbx_evidence_code:de,pdbx_auth_asym_id:de,pdbx_auth_comp_id:de,pdbx_auth_seq_id:de,pdbx_auth_ins_code:de},struct_site_gen:{details:de,id:de,label_alt_id:de,label_asym_id:de,label_atom_id:de,label_comp_id:de,label_seq_id:Le,auth_asym_id:de,auth_comp_id:de,auth_seq_id:de,site_id:de,symmetry:de,pdbx_auth_ins_code:de,pdbx_num_res:Le},symmetry:{entry_id:de,cell_setting:Kt(Ii),Int_Tables_number:Le,space_group_name_Hall:de,"space_group_name_H-M":de},pdbx_database_status:{status_code:Kt(de),status_code_sf:Kt(de),status_code_mr:Kt(de),entry_id:de,recvd_initial_deposition_date:de,SG_entry:Kt(Ii),deposit_site:Kt(de),process_site:Kt(de),status_code_cs:Kt(de),methods_development_category:Kt(de),pdb_format_compatible:Kt(Ii)},pdbx_nonpoly_scheme:{asym_id:de,entity_id:de,mon_id:de,pdb_strand_id:de,ndb_seq_num:de,pdb_seq_num:de,auth_seq_num:de,pdb_mon_id:de,auth_mon_id:de,pdb_ins_code:de},pdbx_database_related:{db_name:de,details:de,db_id:de,content_type:Kt(de)},pdbx_entity_nonpoly:{entity_id:de,comp_id:de,name:de},pdbx_chem_comp_synonyms:{name:de,comp_id:de,provenance:Kt(de)},pdbx_chem_comp_identifier:{comp_id:de,identifier:de,type:Kt(de),program:de,program_version:de},pdbx_unobs_or_zero_occ_residues:{id:Le,polymer_flag:Kt(Ii),occupancy_flag:Kt(Le),PDB_model_num:Le,auth_asym_id:de,auth_comp_id:de,auth_seq_id:de,PDB_ins_code:de,label_asym_id:de,label_comp_id:de,label_seq_id:Le},pdbx_struct_mod_residue:{id:Le,auth_asym_id:de,auth_comp_id:de,auth_seq_id:Le,PDB_ins_code:de,label_asym_id:de,label_comp_id:de,label_seq_id:Le,parent_comp_id:de,details:de},pdbx_struct_oper_list:{id:de,type:Kt(de),name:de,symmetry_operation:de,matrix:S1(3,3),vector:e5(3)},pdbx_struct_assembly:{method_details:de,oligomeric_details:de,oligomeric_count:Le,details:de,id:de},pdbx_struct_assembly_gen:{asym_id_list:e_(",",e=>e),assembly_id:de,oper_expression:de},pdbx_reference_entity_list:{prd_id:de,ref_entity_id:de,type:Kt(Ii),details:de,component_id:Le},pdbx_reference_entity_link:{link_id:Le,prd_id:de,details:de,ref_entity_id_1:de,ref_entity_id_2:de,entity_seq_num_1:Le,entity_seq_num_2:Le,comp_id_1:de,comp_id_2:de,atom_id_1:de,atom_id_2:de,value_order:Kt(Ii),component_1:Le,component_2:Le,link_class:Kt(de)},pdbx_reference_entity_poly_link:{link_id:Le,prd_id:de,ref_entity_id:de,component_id:Le,entity_seq_num_1:Le,entity_seq_num_2:Le,comp_id_1:de,comp_id_2:de,atom_id_1:de,atom_id_2:de,value_order:Kt(Ii)},pdbx_molecule:{prd_id:de,instance_id:Le,asym_id:de},pdbx_molecule_features:{prd_id:de,class:Kt(Ii),type:Kt(Ii),name:de,details:de},entity_src_nat:{entity_id:de,pdbx_organism_scientific:de,pdbx_plasmid_name:de,pdbx_src_id:Le,pdbx_beg_seq_num:Le,pdbx_end_seq_num:Le},entity_src_gen:{entity_id:de,pdbx_gene_src_gene:e_(",",e=>e),pdbx_gene_src_scientific_name:de,plasmid_name:de,pdbx_src_id:Le,pdbx_beg_seq_num:Le,pdbx_end_seq_num:Le},pdbx_entity_src_syn:{organism_scientific:de,entity_id:de,pdbx_src_id:Le,pdbx_beg_seq_num:Le,pdbx_end_seq_num:Le},pdbx_entity_branch_descriptor:{entity_id:de,descriptor:de,type:Kt(Ii),program:de,program_version:de,ordinal:Le},pdbx_entity_instance_feature:{details:de,feature_type:Kt(de),auth_asym_id:de,asym_id:de,auth_seq_num:de,seq_num:Le,comp_id:de,auth_comp_id:de,ordinal:Le},pdbx_entity_branch_list:{entity_id:de,hetero:Kt(Ii),comp_id:de,num:Le},pdbx_entity_branch_link:{link_id:Le,details:de,entity_id:de,entity_branch_list_num_1:Le,entity_branch_list_num_2:Le,comp_id_1:de,comp_id_2:de,atom_id_1:de,leaving_atom_id_1:de,atom_stereo_config_1:Kt(Ii),atom_id_2:de,leaving_atom_id_2:de,atom_stereo_config_2:Kt(Ii),value_order:Kt(Ii)},pdbx_entity_branch:{entity_id:de,type:Kt(de)},pdbx_branch_scheme:{entity_id:de,hetero:Kt(Ii),asym_id:de,mon_id:de,num:Le,pdb_asym_id:de,pdb_seq_num:de,pdb_mon_id:de,auth_asym_id:de,auth_seq_num:de,auth_mon_id:de},pdbx_chem_comp_related:{comp_id:de,related_comp_id:de,relationship_type:Kt(de),details:de},ihm_starting_model_details:{starting_model_id:de,entity_id:de,entity_description:de,asym_id:de,entity_poly_segment_id:Le,starting_model_source:Kt(de),starting_model_auth_asym_id:de,starting_model_sequence_offset:Le,dataset_list_id:Le},ihm_starting_comparative_models:{id:Le,starting_model_id:de,starting_model_auth_asym_id:de,starting_model_seq_id_begin:Le,starting_model_seq_id_end:Le,template_auth_asym_id:de,template_seq_id_begin:Le,template_seq_id_end:Le,template_sequence_identity:dr,template_sequence_identity_denominator:Kt(Le),template_dataset_list_id:Le,alignment_file_id:Le},ihm_starting_model_seq_dif:{id:Le,entity_id:de,asym_id:de,seq_id:Le,comp_id:de,starting_model_id:de,db_asym_id:de,db_seq_id:Le,db_comp_id:de,details:de},ihm_model_representation:{id:Le,name:de,details:de},ihm_model_representation_details:{id:Le,representation_id:Le,entity_poly_segment_id:Le,entity_id:de,entity_description:de,entity_asym_id:de,model_object_primitive:Kt(de),starting_model_id:de,model_mode:Kt(de),model_granularity:Kt(de),model_object_count:Le},ihm_struct_assembly_details:{id:Le,assembly_id:Le,parent_assembly_id:Le,entity_description:de,entity_id:de,asym_id:de,entity_poly_segment_id:Le},ihm_struct_assembly:{id:Le,name:de,description:de},ihm_modeling_protocol:{id:Le,num_steps:Le,protocol_name:de},ihm_modeling_protocol_details:{id:Le,protocol_id:Le,step_id:Le,struct_assembly_id:Le,dataset_group_id:Le,struct_assembly_description:de,step_name:de,step_method:de,num_models_begin:Le,num_models_end:Le,multi_scale_flag:Kt(Ii),multi_state_flag:Kt(Ii),ordered_flag:Kt(Ii),script_file_id:Le,software_id:Le},ihm_multi_state_modeling:{state_id:Le,state_group_id:Le,population_fraction:dr,population_fraction_sd:dr,state_type:de,state_name:de,experiment_type:Kt(de),details:de},ihm_modeling_post_process:{id:Le,protocol_id:Le,analysis_id:Le,step_id:Le,type:Kt(de),feature:Kt(de),num_models_begin:Le,num_models_end:Le},ihm_ensemble_info:{ensemble_id:Le,ensemble_name:de,post_process_id:Le,model_group_id:Le,ensemble_clustering_method:Kt(de),ensemble_clustering_feature:Kt(de),num_ensemble_models:Le,num_ensemble_models_deposited:Le,ensemble_precision_value:dr,ensemble_file_id:Le},ihm_model_list:{model_id:Le,model_name:de,assembly_id:Le,protocol_id:Le,representation_id:Le},ihm_model_group:{id:Le,name:de,details:de},ihm_model_group_link:{model_id:Le,group_id:Le},ihm_model_representative:{id:Le,model_group_id:Le,model_id:Le,selection_criteria:Kt(de)},ihm_dataset_list:{id:Le,data_type:Kt(de),database_hosted:Kt(Ii)},ihm_dataset_group:{id:Le,name:de,application:Kt(de),details:de},ihm_dataset_group_link:{dataset_list_id:Le,group_id:Le},ihm_related_datasets:{dataset_list_id_derived:Le,dataset_list_id_primary:Le},ihm_dataset_related_db_reference:{id:Le,dataset_list_id:Le,db_name:Kt(de),accession_code:de,version:de,details:de},ihm_external_reference_info:{reference_id:Le,reference_provider:de,reference_type:Kt(de),reference:de,refers_to:Kt(de),associated_url:de},ihm_external_files:{id:Le,reference_id:Le,file_path:de,content_type:Kt(de),file_size_bytes:dr,details:de},ihm_dataset_external_reference:{id:Le,dataset_list_id:Le,file_id:Le},ihm_localization_density_files:{id:Le,file_id:Le,ensemble_id:Le,entity_id:de,entity_poly_segment_id:Le,asym_id:de},ihm_predicted_contact_restraint:{id:Le,group_id:Le,entity_id_1:de,entity_id_2:de,asym_id_1:de,asym_id_2:de,comp_id_1:de,comp_id_2:de,seq_id_1:Le,seq_id_2:Le,rep_atom_1:Kt(de),rep_atom_2:Kt(de),distance_lower_limit:dr,distance_upper_limit:dr,probability:dr,restraint_type:Kt(de),model_granularity:Kt(de),dataset_list_id:Le,software_id:Le},ihm_cross_link_list:{id:Le,group_id:Le,entity_description_1:de,entity_description_2:de,entity_id_1:de,entity_id_2:de,comp_id_1:de,comp_id_2:de,seq_id_1:Le,seq_id_2:Le,linker_type:Kt(de),dataset_list_id:Le},ihm_cross_link_restraint:{id:Le,group_id:Le,entity_id_1:de,entity_id_2:de,asym_id_1:de,asym_id_2:de,comp_id_1:de,comp_id_2:de,seq_id_1:Le,seq_id_2:Le,atom_id_1:de,atom_id_2:de,restraint_type:Kt(de),conditional_crosslink_flag:Kt(de),model_granularity:Kt(de),distance_threshold:dr,psi:dr,sigma_1:dr,sigma_2:dr},ihm_cross_link_result_parameters:{id:Le,restraint_id:Le,model_id:Le,psi:dr,sigma_1:dr,sigma_2:dr},ihm_2dem_class_average_restraint:{id:Le,dataset_list_id:Le,number_raw_micrographs:Le,pixel_size_width:dr,pixel_size_height:dr,image_resolution:dr,image_segment_flag:Kt(Ii),number_of_projections:Le,struct_assembly_id:Le,details:de},ihm_2dem_class_average_fitting:{id:Le,restraint_id:Le,model_id:Le,cross_correlation_coefficient:dr,rot_matrix:S1(3,3),tr_vector:e5(3)},ihm_3dem_restraint:{id:Le,dataset_list_id:Le,model_id:Le,struct_assembly_id:Le,fitting_method:de,number_of_gaussians:Le,cross_correlation_coefficient:dr},ihm_sas_restraint:{id:Le,dataset_list_id:Le,model_id:Le,struct_assembly_id:Le,profile_segment_flag:Kt(Ii),fitting_atom_type:de,fitting_method:de,fitting_state:Kt(de),radius_of_gyration:dr,chi_value:dr,details:de},ihm_starting_model_coord:{ordinal_id:Le,starting_model_id:de,group_PDB:Kt(de),id:Le,type_symbol:de,entity_id:de,atom_id:de,comp_id:de,seq_id:Le,asym_id:de,Cartn_x:dr,Cartn_y:dr,Cartn_z:dr,B_iso_or_equiv:dr},ihm_sphere_obj_site:{id:Le,entity_id:de,seq_id_begin:Le,seq_id_end:Le,asym_id:de,Cartn_x:dr,Cartn_y:dr,Cartn_z:dr,object_radius:dr,rmsf:dr,model_id:Le},ihm_gaussian_obj_site:{id:Le,entity_id:de,seq_id_begin:Le,seq_id_end:Le,asym_id:de,mean_Cartn_x:dr,mean_Cartn_y:dr,mean_Cartn_z:dr,weight:dr,covariance_matrix:S1(3,3),model_id:Le},ihm_gaussian_obj_ensemble:{id:Le,entity_id:de,seq_id_begin:Le,seq_id_end:Le,asym_id:de,mean_Cartn_x:dr,mean_Cartn_y:dr,mean_Cartn_z:dr,weight:dr,covariance_matrix:S1(3,3),ensemble_id:Le},ihm_feature_list:{feature_id:Le,feature_type:Kt(de),entity_type:Kt(de)},ihm_poly_residue_feature:{ordinal_id:Le,feature_id:Le,entity_id:de,asym_id:de,comp_id_begin:de,comp_id_end:de,seq_id_begin:Le,seq_id_end:Le},ihm_derived_distance_restraint:{id:Le,group_id:Le,feature_id_1:Le,feature_id_2:Le,group_conditionality:Kt(de),random_exclusion_fraction:dr,distance_upper_limit:dr,restraint_type:Kt(de),dataset_list_id:Le},ma_model_list:{ordinal_id:Le,model_id:Le,model_group_id:Le,model_name:de,model_group_name:de,model_type:Kt(de),data_id:Le},ma_target_entity:{entity_id:de,data_id:Le,origin:Kt(de)},ma_target_entity_instance:{asym_id:de,entity_id:de,details:de},ma_target_ref_db_details:{target_entity_id:de,db_name:Kt(de),db_code:de,db_accession:de,seq_db_isoform:de,seq_db_align_begin:de,seq_db_align_end:de,ncbi_taxonomy_id:de,organism_scientific:de},ma_data:{id:Le,content_type:Kt(de),content_type_other_details:de,name:de},ma_software_group:{ordinal_id:Le,group_id:Le,software_id:Le},ma_qa_metric:{id:Le,name:de,type:Kt(de),mode:Kt(de),software_group_id:Le},ma_qa_metric_global:{ordinal_id:Le,model_id:Le,metric_id:Le,metric_value:dr},ma_qa_metric_local:{ordinal_id:Le,model_id:Le,label_asym_id:de,label_seq_id:Le,label_comp_id:de,metric_id:Le,metric_value:dr}};var ni;!function(e){let t;var o;let n;(o=t=e.IntDataType||(e.IntDataType={}))[o.Int8=1]="Int8",o[o.Int16=2]="Int16",o[o.Int32=3]="Int32",o[o.Uint8=4]="Uint8",o[o.Uint16=5]="Uint16",o[o.Uint32=6]="Uint32",function(o){o[o.Float32=32]="Float32",o[o.Float64=33]="Float64"}(n=e.FloatDataType||(e.FloatDataType={})),e.getDataType=function r(o){let s;return s=o instanceof Int8Array?e.IntDataType.Int8:o instanceof Int16Array?e.IntDataType.Int16:o instanceof Int32Array?e.IntDataType.Int32:o instanceof Uint8Array?e.IntDataType.Uint8:o instanceof Uint16Array?e.IntDataType.Uint16:o instanceof Uint32Array?e.IntDataType.Uint32:o instanceof Float32Array?e.FloatDataType.Float32:o instanceof Float64Array?e.FloatDataType.Float64:e.IntDataType.Int32,s},e.isSignedIntegerDataType=function i(o){if(o instanceof Int8Array||o instanceof Int16Array||o instanceof Int32Array)return!0;for(let s=0,a=o.length;s=0;n--)t=q6e(t,e.encoding[n]);return t}function q6e(e,t){switch(t.kind){case"ByteArray":switch(t.type){case ni.IntDataType.Uint8:return e;case ni.IntDataType.Int8:return function W6e(e){return new Int8Array(e.buffer,e.byteOffset)}(e);case ni.IntDataType.Int16:return function $6e(e){return bw(e,2,Int16Array)}(e);case ni.IntDataType.Uint16:return function Y6e(e){return bw(e,2,Uint16Array)}(e);case ni.IntDataType.Int32:return function X6e(e){return bw(e,4,Int32Array)}(e);case ni.IntDataType.Uint32:return function K6e(e){return bw(e,4,Uint32Array)}(e);case ni.FloatDataType.Float32:return function Z6e(e){return bw(e,4,Float32Array)}(e);case ni.FloatDataType.Float64:return function Q6e(e){return bw(e,8,Float64Array)}(e);default:Hi()}case"FixedPoint":return function J6e(e,t){const n=e.length,r=Pse(t.srcType,n),i=1/t.factor;for(let o=0;o=0?Math.ceil((p+1)/m):Math.ceil((p+1)/(-m-1))}function i({limit8:p,limit16:m},h,g){h.pack8+=t(g,p),h.pack16+=t(g,m),h.count+=1}function o(p,m){p.pack8+=t(m,127),p.pack16+=t(m,32767),p.count+=1}function s(p){return 4*p.count<2*p.pack16?{length:4*p.count,elem:4}:2*p.pack16g.length-y.length),h}e.getSize=d,e.classify=function f(p){if(p.length<2)return Fr.by(Fr.byteArray);switch(d(p)[0].kind){case"pack":return Fr.by(Fr.integerPacking);case"rle":return Fr.by(Fr.runLength).and(Fr.integerPacking);case"delta":return Fr.by(Fr.delta).and(Fr.integerPacking);case"delta-rle":return Fr.by(Fr.delta).and(Fr.runLength).and(Fr.integerPacking);default:Hi()}}}(P3||(P3={})),function(e){e.classify=function n(i){const{mantissaDigits:s,integerDigits:a}=function c8e(e,t,n){let r=1,i=0;for(let o=0,s=e.length;o=0){const l=a8e(e[o],t,n);l<0?r=-1:l>r&&(r=l)}const a=Math.abs(e[o]);if(a>n){const l=Math.floor(Math.log10(Math.abs(a)))+1;l>i&&(i=l)}}return{mantissaDigits:r,integerDigits:i}}(i,4,1e-6);if(s<0||s+a>10)return Fr.by(Fr.byteArray);if(0===s)return P3.classify(i);const l=function r(i){let o=1;for(let s=0;sn[e].value(t)}function f8e(e){return(t,n)=>n[e].value(t).join(n[e].schema.separator)}function pz(e,...t){return(n,r)=>r[e].schema.space.get(r[e].value(n),...t)}function k3(e){return(t,n)=>n[e].valueKind(t)}function p8e(e,t){const n=[],i=k3(e);if(1===t.rank){const o=t.dimensions[0];for(let s=0;s 3 or rank 0 are currently not supported.");{const o=t.dimensions[0],s=t.dimensions[1],a=t.dimensions[2];for(let l=0;l!!t.shouldInclude)?e.fields.filter(t=>!t.shouldInclude||e.source.some(n=>t.shouldInclude(n.data))):e.fields}function Mse(e,t){const n=e.instance(t),r=n.source.filter(s=>s.rowCount>0);return r.length?{instance:n,rowCount:r.reduce((s,a)=>s+a.rowCount,0),source:r.map(s=>({data:s.data,keys:()=>s.keys?s.keys():qR.Range(0,s.rowCount-1),rowCount:s.rowCount}))}:{instance:n,rowCount:0,source:[]}}!function(e){function t(i){return new r5([i])}function r(i){switch(i.kind){case"ByteArray":return Fr.byteArray;case"FixedPoint":return Fr.fixedPoint(i.factor);case"IntervalQuantization":return Fr.intervalQuantizaiton(i.min,i.max,i.numSteps);case"RunLength":return Fr.runLength;case"Delta":return Fr.delta;case"IntegerPacking":return Fr.integerPacking;case"StringArray":return Fr.stringArray}}e.by=t,e.fromEncoding=function n(i){let o=t(r(i[0]));for(let s=1;s=0?T/w|0:T/A|0}return M+=_.length,M}e.byteArray=s,e.fixedPoint=function l(_){return w=>function a(_,w){const A=ni.getDataType(_),M=new Int32Array(_.length);for(let E=0,D=_.length;Efunction c(_,w,A,M,E){const D=ni.getDataType(_);if(!_.length)return{encodings:[{kind:"IntervalQuantization",min:w,max:A,numSteps:M,srcType:D}],data:new Int32Array(0)};if(A=A?M-1:0|Math.round((j-w)/T)}return{encodings:[{kind:"IntervalQuantization",min:w,max:A,numSteps:M,srcType:D}],data:F}}(E,_,w,A,M)},e.runLength=function d(_){let w=ni.getDataType(_);if(void 0===w&&(_=new Int32Array(_),w=ni.IntDataType.Int32),!_.length)return{encodings:[{kind:"RunLength",srcType:w,srcSize:0}],data:new Int32Array(0)};let A=2;for(let T=1,F=_.length;T=0)for(;N>=A;)D[T]=A,++T,N-=A;else for(;N<=M;)D[T]=M,++T,N-=M;D[T]=N,++T}const F=s(D);return{encodings:[{kind:"IntegerPacking",byteCount:w.bytesPerElement,isUnsigned:!w.isSigned,srcSize:E},F.encodings[0]],data:F.data}}(_,w)},e.stringArray=function x(_){const w=Object.create(null),A=[],M=new Int32Array(_.length),E=tt.create(Int32Array,1,Math.min(1024,_.length<32?_.length+1:Math.round(_.length/8)+1));tt.add(E,0);let D=0,T=0;for(const z of _){if(null==z){M[T++]=-1;continue}let $=w[z];void 0===$&&(D+=z.length,$=A.length,A[$]=z,w[z]=$,tt.add(E,D)),M[T++]=$}const F=tt.compact(E),N=lz(F).encode(F),W=lz(M).encode(M);return{encodings:[{kind:"StringArray",dataEncoding:W.encoding,stringData:A.join(""),offsetEncoding:N.encoding,offsets:N.data}],data:W.data}}}(Fr||(Fr={})),function(e){function n(a,l,c){return{name:a,type:1,value:l,valueKind:c&&c.valueKind,defaultFormat:c?{encoder:c.encoder,typedArray:c.typedArray}:void 0,shouldInclude:c&&c.shouldInclude}}e.str=function t(a,l,c){return{name:a,type:0,value:l,valueKind:c&&c.valueKind,defaultFormat:c&&c.encoder?{encoder:c.encoder}:void 0,shouldInclude:c&&c.shouldInclude}},e.int=n,e.float=function r(a,l,c){return{name:a,type:2,value:l,valueKind:c&&c.valueKind,defaultFormat:c?{encoder:c.encoder,typedArray:c.typedArray,digitCount:typeof c.digitCount<"u"?c.digitCount:void 0}:void 0,shouldInclude:c&&c.shouldInclude}},e.index=function i(a){return n(a,(l,c,u)=>u+1,{typedArray:Int32Array,encoder:Fr.by(Fr.delta).and(Fr.runLength).and(Fr.integerPacking)})};class o{constructor(){this.fields=[]}index(l){return this.fields.push(e.index(l)),this}str(l,c,u){return this.fields.push(e.str(l,c,u)),this}int(l,c,u){return this.fields.push(e.int(l,c,u)),this}vec(l,c,u){for(let d=0;dc.split(".")[0]);return{includeCategory:c=>!o.includes(c)&&(i.length<=0||-1!==i.indexOf(c)),includeField(c,u){const d=c+"."+u;return!a.includes(d)&&(!l.includes(c)||s.includes(d))}}},e.DefaultFilter={includeCategory:r=>!0,includeField:(r,i)=>!0},e.DefaultFormatter={getFormat(r,i){}},e.ofTable=function n(r,i){return i?{fields:kse(r._schema),source:[{data:r,rowCount:i.length,keys:()=>qR.Array(i)}]}:{fields:kse(r._schema),source:[{data:r,rowCount:r._rowCount}]}}}(bf||(bf={})),function(e){function t(r,i,o){r.startDataBlock(i);for(const s of o._tableNames)r.writeCategory({name:s,instance:()=>bf.ofTable(o[s])})}e.writeDatabase=t,e.writeDatabaseCollection=function n(r,i){for(const o of Object.keys(i))t(r,o,i[o])}}(dz||(dz={}));class m8e{constructor(){this.builder=ci.create(),this.encoded=!1,this.dataBlockCreated=!1,this.filter=bf.DefaultFilter,this.formatter=bf.DefaultFormatter,this.isBinary=!1,this.binaryEncodingProvider=void 0}setFilter(t){this.filter=t||bf.DefaultFilter}isCategoryIncluded(t){return this.filter.includeCategory(t)}setFormatter(t){this.formatter=t||bf.DefaultFormatter}startDataBlock(t){this.dataBlockCreated=!0,ci.write(this.builder,`data_${(t||"").replace(/[ \n\t]/g,"").toUpperCase()}\n#\n`)}writeCategory(t,n,r){if(this.encoded)throw new Error("The writer contents have already been encoded, no more writing.");if(!this.dataBlockCreated)throw new Error("No data block created.");if(!r?.ignoreFilter&&!this.filter.includeCategory(t.name))return;const{instance:i,rowCount:o,source:s}=Mse(t,n);o&&(1===o?function g8e(e,t,n,r,i,o){const s=hz(t),a=n[0],l=a.data;let c=s.reduce((p,m)=>i.includeField(e.name,m.name)?Math.max(p,m.name.length):0,0);if(0===c)return;c+=e.name.length+6;const d=a.keys().move(),f=Nse(e.name,t.fields,o);for(let p=0;pi.includeField(e.name,d.name)),l=a.length;if(0===l)return;const c=Nse(e.name,a,o);Fse(r,"loop_");for(let d=0;d=0}(l)?(i5(e,l),!0):function C8e(e,t){if(!t)return ci.writeSafe(e,". "),!1;const n=t.charCodeAt(0);let r=!1,i=0,o=!1,s=!1;for(let a=0,l=t.length-1;a<=l;a++)switch(t.charCodeAt(a)){case 9:case 32:r=!0;break;case 10:return i5(e,t),!0;case 34:if(a&&a===l)break;if(o)return i5(e,t),!0;s=!0,r=!0,i=0;break;case 39:if(a&&a===l)break;if(s)return i5(e,t),!0;o=!0,r=!0,i=1}return!r&&(35===n||36===n||59===n||91===n||93===n||95===n)&&(r=!0),r?(ci.writeSafe(e,i?'"':"'"),ci.writeSafe(e,t),ci.writeSafe(e,i?'" ':"' ")):(ci.writeSafe(e,t),ci.writeSafe(e," ")),!1}(e,l);1===c?function v8e(e,t){ci.writeInteger(e,t),ci.whitespace1(e)}(e,l):function x8e(e,t,n){ci.writeFloat(e,t,n),ci.whitespace1(e)}(e,l,i)}return!1}function Nse(e,t,n){const r=[];for(const i of t){const o=n.getFormat(e,i.name);r[r.length]=o&&typeof o.digitCount<"u"?2===i.type?Math.pow(10,Math.max(0,Math.min(o.digitCount,15))):0:2===i.type?Math.pow(10,h8e(i)):0}return r}function Fse(e,t){ci.write(e,t),ci.newline(e)}function i5(e,t){ci.writeSafe(e,"\n;"+t),ci.writeSafe(e,"\n;\n")}function vw(e,t,n){for(let r=0,i=n.length;r>>0&127;else if(o<2048)e[t++]=o>>>6&31|192,e[t++]=o>>>0&63|128;else if(o<65536)e[t++]=o>>>12&15|224,e[t++]=o>>>6&63|128,e[t++]=o>>>0&63|128;else{if(!(o<1114112))throw new Error("bad codepoint "+o);e[t++]=o>>>18&7|240,e[t++]=o>>>12&63|128,e[t++]=o>>>6&63|128,e[t++]=o>>>0&63|128}}}const w8e=function(){const e=[];for(let t=0;t<1024;t++)e[t]=String.fromCharCode(t);return e}();function Ose(e){throw new Error(e)}const Bse=typeof TextDecoder<"u"?new TextDecoder:void 0;function mz(e,t,n){if(Bse){const r=t||n!==e.length?e.subarray(t,t+n):e;return Bse.decode(r)}return function A8e(e,t,n){const r=w8e;let i,o=0;const s=[];for(let l=t,c=t+n;l0&&(i[i.length]=s.slice(0,o).join("")),i.join("")):s.slice(0,o).join("")}(e,t,n)}function o5(e){let t=0;for(let n=0,r=e.length;n=0){if(e<128)return 1;if(e<256)return 2;if(e<65536)return 3;if(e<4294967296)return 5;throw new Error("Number too big 0x"+e.toString(16))}if(e>=-32)return 1;if(e>=-128)return 2;if(e>=-32768)return 3;if(e>=-2147483648)return 5;throw new Error("Number too small -0x"+e.toString(16).substr(1))}if("boolean"===t||null==e)return 1;if("object"===t){let n,r=0;if(Array.isArray(e)){n=e.length;for(let i=0;i=0){if(e<128)return t.setUint8(r,e),1;if(e<256)return t.setUint8(r,204),t.setUint8(r+1,e),2;if(e<65536)return t.setUint8(r,205),t.setUint16(r+1,e),3;if(e<4294967296)return t.setUint8(r,206),t.setUint32(r+1,e),5;throw new Error("Number too big 0x"+e.toString(16))}if(e>=-32)return t.setInt8(r,e),1;if(e>=-128)return t.setUint8(r,208),t.setInt8(r+1,e),2;if(e>=-32768)return t.setUint8(r,209),t.setInt16(r+1,e),3;if(e>=-2147483648)return t.setUint8(r,210),t.setInt32(r+1,e),5;throw new Error("Number too small -0x"+(-e).toString(16).substr(1))}if(null==e)return t.setUint8(r,192),1;if("boolean"===i)return t.setUint8(r,e?195:194),1;if("object"===i){let o,s=0;const a=Array.isArray(e);let l;if(a?o=e.length:(l=Object.keys(e),o=l.length),o<16?(t.setUint8(r,o|(a?144:128)),s=1):o<65536?(t.setUint8(r,a?220:222),t.setUint16(r+1,o),s=3):o<4294967296&&(t.setUint8(r,a?221:223),t.setUint32(r+1,o),s=5),a)for(let c=0;ci.properties.chemicalComponentMap.has(o.comp_id.value(s)))},e.getEntriesFromChemCompBond=function n(i){const o=new Map;function s(h){if(o.has(h))return o.get(h);const g=new r(h);return o.set(h,g),g}const{comp_id:a,atom_id_1:l,atom_id_2:c,value_order:u,pdbx_aromatic_flag:d,_rowCount:f,pdbx_ordinal:p}=i;let m=s(a.value(0));for(let h=0;h=0)return!0;return!1}e.Descriptor={name:"struct_conn",cifExport:{prefix:"",categories:[{name:"struct_conn",instance(o){const s=e.Provider.get(o.firstModel);if(!s||0===s.entries.length)return us.Category.Empty;const a=o.structures[0],l=[];for(const c of s.entries)n(a,c.partnerA.atomIndex)&&n(a,c.partnerB.atomIndex)&&(l[l.length]=c.rowIndex);return us.Category.ofTable(s.data,l)}}]}},e.Provider=jh.create(e.Descriptor),e.isExhaustive=function t(o){const s=e.Provider.get(o);return!!s&&s.data.id.rowCount/o.atomicConformation.atomId.rowCount>.95},e.getAtomIndexFromEntries=function r(o){const s=new Map;for(const a of o){const{partnerA:{atomIndex:l},partnerB:{atomIndex:c}}=a;s.has(l)?s.get(l).push(a):s.set(l,[a]),s.has(c)?s.get(c).push(a):s.set(c,[a])}return s},e.getEntriesFromStructConn=function i(o,s){const{conn_type_id:a,pdbx_dist_value:l,pdbx_value_order:c}=o,u={label_asym_id:o.ptnr1_label_asym_id,label_seq_id:o.ptnr1_label_seq_id,auth_seq_id:o.ptnr1_auth_seq_id,label_atom_id:o.ptnr1_label_atom_id,label_alt_id:o.pdbx_ptnr1_label_alt_id,ins_code:o.pdbx_ptnr1_PDB_ins_code,symmetry:o.ptnr1_symmetry},d={label_asym_id:o.ptnr2_label_asym_id,label_seq_id:o.ptnr2_label_seq_id,auth_seq_id:o.ptnr2_auth_seq_id,label_atom_id:o.ptnr2_label_atom_id,label_alt_id:o.pdbx_ptnr2_label_alt_id,ins_code:o.pdbx_ptnr2_PDB_ins_code,symmetry:o.ptnr2_symmetry},f=Array.from(s.entities.data.id.toArray()),p=(h,g)=>{if(0!==g.label_asym_id.valueKind(h))return;const y=g.label_asym_id.value(h),v=g.label_atom_id.value(h);if(!v)return;const x=g.auth_seq_id.valueKind(h)===ce.ValueKind.Present?g.auth_seq_id.value(h):g.label_seq_id.value(h),_=g.ins_code.value(h),w=g.label_alt_id.value(h);for(const A of f){const M=s.atomicHierarchy.index.findResidue(A,y,x,_);if(M<0)continue;const E=s.atomicHierarchy.index.findAtomOnResidue(M,v,w);if(!(E<0))return{residueIndex:M,atomIndex:E,symmetry:g.symmetry.value(h)}}},m=[];for(let h=0;hnc.Provider.get(o)),i=e.models.some(o=>vf.isExhaustive(o));return t.noCompute||e.isCoarseGrained&&!r&&!i||Xe.eachUnitPair(e,(o,s)=>{!function q8e(e,t,n,r){const{maxRadius:i}=n,{elements:o,residueIndex:s}=e,{x:a,y:l,z:c}=e.model.atomicConformation,{elements:u,residueIndex:d}=t,f=e.elements.length,{type_symbol:p,label_alt_id:m,label_atom_id:h,label_comp_id:g}=e.model.atomicHierarchy.atoms,{type_symbol:y,label_alt_id:v,label_atom_id:x,label_comp_id:_}=t.model.atomicHierarchy.atoms,{auth_seq_id:w}=e.model.atomicHierarchy.residues,{auth_seq_id:A}=t.model.atomicHierarchy.residues,{occupancy:M}=e.model.atomicConformation,{occupancy:E}=t.model.atomicConformation,D=M.isDefined&&E.isDefined,T=e.model===t.model&&vf.Provider.get(e.model),F=!n.forceCompute&&e.model===t.model&&nc.Provider.get(e.model),{atomSourceIndex:R}=e.model.atomicHierarchy,{invertedIndex:N}=F?Sn.getInvertedAtomSourceIndex(t.model):{invertedIndex:void 0},j=e.model===t.model&&vf.isExhaustive(e.model),W=fe.mul(G8e,t.conformation.operator.inverse,e.conformation.operator.matrix),z=!fe.isIdentity(W),{center:$,radius:V}=t.boundary.sphere,X=(V+i)*(V+i);r.startUnitPair(e.id,t.id);const H=e.conformation.operator.key,oe=t.conformation.operator.key;for(let te=0;teX)continue;if(!n.forceCompute&&F){const{maxDistance:ie}=F,{offset:ue,b:_e,edgeProps:{order:Fe,distance:Ze,flag:ct,key:q,operatorA:ne,operatorB:be}}=F.bonds,Ce=R.value(K),Re=ig(p.value(K));for(let Be=ue[Ce],$e=ue[Ce+1];Be<$e;++Be){const nt=N[_e[Be]],ht=rt.indexOf(t.elements,nt);if(ht<0)continue;const Ge=ne[Be],ft=be[Be];if(Ge>=0&&Ge!==H&&Ge!==oe||ft>=0&&ft!==oe&&ft!==H)continue;const vt=ig(p.value(nt)),Pt=Ze[Be],St=Hse(e,K,t,nt);let Mt=!1;Pt>=0?Mt=Do(St,Pt,.3):ie>=0?Mt=Sti||(r.add(te,ct,{order:ue.order,flag:ue.flags,key:ue.rowIndex}),ie=!0)}if(ie)continue}if(j)continue;const G=M.value(K),{lookup3d:Z}=t,{indices:ee,count:se,squaredDistances:xe}=Z.find(n_[0],n_[1],n_[2],i);if(0===se)continue;const re=ig(p.value(K)),ae=K0(re),ge=_1(re),Ie=m.value(K),me=D3.has(re),Ae=h.value(K),he=g.value(s[K]);for(let ie=0;iet.validUnit(o),validUnitPair:(o,s)=>t.validUnitPair(e,o,s)}),new T3(n.getMap())}(e,{...n,validUnit:t&&t.validUnit||(r=>ze.isAtomic(r)),validUnitPair:t&&t.validUnitPair||((r,i,o)=>{if(!Xe.validUnitPair(r,i,o))return!1;const a=i.model.atomicHierarchy.derived.residue.moleculeType,l=o.model.atomicHierarchy.derived.residue.moleculeType,c=!(ze.isAtomic(i)&&2===a[i.residueIndex[i.elements[0]]]||ze.isAtomic(o)&&2===l[o.residueIndex[o.elements[0]]]),u=!ze.isAtomic(i)||3!==a[i.residueIndex[i.elements[0]]],d=!ze.isAtomic(o)||3!==l[o.residueIndex[o.elements[0]]];return!(!c&&n.ignoreWater||(!u||!d)&&n.ignoreIon)||function X8e(e,t){if(e.model!==t.model||!ze.isAtomic(e)||!ze.isAtomic(t))return!1;const n=vf.Provider.get(e.model);if(!n)return!1;const r=e.elements.length=t.elements.length?e:t,{elements:o}=r,{elements:s}=i,{indexOf:a}=rt;for(let l=0,c=o.length;l=0)return!0}return!1}(i,o)})})}var fn;function Gse(e){e.count=e.endVertex-e.startVertex;const{isRingAtom:t,pred:n,color:r,depth:i,marked:o}=e;for(let s=0;s=0;y--)h[g++]=e.startVertex+a[y],r[a[y]]=1;ip(h);for(let y=0,v=e.currentRings.length;yx.length&&rt.isSubset(h,x))return!1}return e.currentRings.push(rt.ofSortedArray(h)),!0}function $se(e,t,n){const{bonds:r,startVertex:i,endVertex:o,isRingAtom:s,marked:a,queue:l,pred:c,depth:u}=e,{elements:d}=e.unit,{b:f,edgeProps:{flags:p},offset:m}=r;a[t]=n,u[t]=0,l[0]=t;let h=0,g=1;for(;h=o||!Lr.isCovalent(p[A]))continue;if(e.hasAltLoc){const T=e.altLoc.value(d[M]);if(T&&e.currentAltLoc!==T)continue}const E=M-i;if(a[E]===n){if(c[E]!==y&&c[y]!==E&&eje(e,y,E,s))return n+1;continue}const D=Math.min(u[E],v+1);D>5||(u[E]=D,a[E]=n,l[g++]=E,c[E]=y)}}return n+1}function Yse(e){const t=e.length,n=new Int32Array(2*t);for(let s=0;s{const _=y.unitMap.get(x.aUnit.id);if(!_)return;const w=y.unitMap.get(x.bUnit.id);if(!w)return;const M=rt.indexOf(_.elements,x.aUnit.elements[x.aIndex]);if(-1===M)return;const D=rt.indexOf(w.elements,x.bUnit.elements[x.bIndex]);-1!==D&&v.push(t(g.structure,_,M,g.structure,w,D))}),i(y,v)},e.toStructureElementLoci=function c(g){const y=[],v=new Map;for(const x of g.bonds){const{aIndex:_,aUnit:w,bIndex:A,bUnit:M}=x;w===M?v.has(w.id)?v.get(w.id).push(_,A):v.set(w.id,[_,A]):(v.has(w.id)?v.get(w.id).push(_):v.set(w.id,[_]),v.has(M.id)?v.get(M.id).push(A):v.set(M.id,[A]))}return v.forEach((x,_)=>{y.push({unit:g.structure.unitMap.get(_),indices:rt.deduplicate(rt.ofUnsortedArray(x))})}),Me(g.structure,y)},e.toFirstStructureElementLoci=function u(g){const{aUnit:y,aIndex:v}=g.bonds[0];return Me(g.structure,[{unit:y,indices:Ve.ofSingleton(v)}])},e.getType=function d(g,y){if(y.aUnit===y.bUnit){const v=y.aUnit.bonds,x=v.getEdgeIndex(y.aIndex,y.bIndex);return Lr.create(x<0?0:v.edgeProps.flags[x])}{const v=g.interUnitBonds.getBondFromLocation(y);return Lr.create(v?v.props.flag:0)}},e.getOrder=function f(g,y){if(y.aUnit===y.bUnit){const v=y.aUnit.bonds,x=v.getEdgeIndex(y.aIndex,y.bIndex);return x<0?0:v.edgeProps.order[x]}{const v=g.interUnitBonds.getBondFromLocation(y);return v?v.props.order:0}},e.getIntraUnitBondCount=function p(g){let y=0;for(let v=0,x=g.units.length;v{const{aUnit:w,aIndex:A,bUnit:M,bIndex:E}=g.bonds[v];w.conformation.position(w.elements[A],x),M.conformation.position(M.elements[E],_)},y)}}(fn||(fn={}));const ije=new Set;function w1(e,t){const n=p6e[e];if(void 0!==n){const r=n[t];if(void 0!==r)return r}return ije}const Kse=C.zero();function Zse(e,t){const n=e.conformation,r=new Float32Array(3*t.length),{elements:i}=e;for(let o=0,s=t.length;o=y||i.addEdge(l,y)}}}const o=Cd.connectedComponents(i.getGraph()),s=o.componentIndex,a=[];for(let l=0;l=0&&(n.has(a)?n.get(a).push(s):n.set(a,[s]))}}(function(e){function n(a){return function tje(e){const t=e.length,n=new Array(t);for(let s=0;s0)return!1;const y=Uh.calculateMomentsAxes(Zse(a,l));return C.magnitude(y.dirC)<.05},e.getAltId=function s(a,l){const{label_alt_id:c}=a.model.atomicHierarchy.atoms,{elements:u}=a;for(let d=0,f=l.length;dVe.max(w)||o(_)this.maxDist[t]&&(this.maxDist[t]=r,tae(this.extrema[2*t+1],n))}computeSphereExtrema(t,n,r){const i=this.dir[t],o=eae(i,n);o-rthis.maxDist[t]&&(this.maxDist[t]=o+r,yje(this.extrema[2*t+1],n,i,r))}includeSphere(t){if(ke.hasExtrema(t)&&t.extrema.length>1)for(const n of t.extrema)this.includePosition(n);else this.includePositionRadius(t.center,t.radius)}includePosition(t){for(let n=0;n1)for(const n of t.extrema)this.radiusPosition(n);else this.radiusPositionRadius(t.center,t.radius)}radiusPosition(t){this.centroidHelper.radiusStep(t)}radiusPositionRadius(t,n){this.centroidHelper.radiusSphereStep(t,n)}getSphere(t){return ke.setExtrema(this.centroidHelper.getSphere(t),this.extrema.slice())}getBox(t){return Gt.fromVec3Array(t||Gt(),this.extrema)}reset(){for(let t=0;t{const r=C.create(n[0],n[1],n[2]);return C.normalize(r,r)})}(t),this.dirLength=this.dir.length,this.reset()}}const c5=[[1,0,0],[0,1,0],[0,0,1]],yz=[[1,1,1],[-1,1,1],[-1,-1,1],[1,-1,1]],nae=[[1,1,0],[1,-1,0],[1,0,1],[1,0,-1],[0,1,1],[0,1,-1]],vje=[[0,1,2],[0,2,1],[1,0,2],[2,0,1],[1,2,0],[2,1,0],[0,1,-2],[0,2,-1],[1,0,-2],[2,0,-1],[1,-2,0],[2,-1,0]],xje=[[1,1,2],[2,1,1],[1,2,1],[1,-1,2],[1,1,-2],[1,-1,-2],[2,-1,1],[2,1,-1],[2,-1,-1],[1,-2,1],[1,2,-1],[1,-2,-1]],_je=[[2,2,1],[1,2,2],[2,1,2],[2,-2,1],[2,2,-1],[2,-2,-1],[1,-2,2],[1,2,-2],[1,-2,-2],[2,-1,2],[2,1,-2],[2,-1,-2]],rae=C.set,Sje=new xf("14"),Cje=new xf("98");function bz(e){const t=Gt.computeBounding(e);return{box:t,sphere:ke.fromBox3D(ke(),t)}}const u5=C();function Q0(e){const{x:t,y:n,z:r,radius:i,indices:o}=e,s=Ve.size(o);if(s>25e4)return bz(e);const a=function wje(e){return e>1e4?Sje:Cje}(s);a.reset();for(let c=0;c{const n=[];let r=0;for(let i=0;iJe.unit.operator_name(u.element),ko.DefaultName),_i.pred.inSet(u=>Je.chain.label_asym_id(u.element),o.asymIds))});n[n.length]={selector:c,operators:l,asymIds:o.asymIds},r+=l.length}return n}}(s,r))}function Dje(e){const t=[],n=[];for(let r=0;r{const s=[];o.split(",").forEach(a=>{const l=a.indexOf("-");if(l>0){const c=parseInt(a.substring(0,l)),u=parseInt(a.substr(l+1));for(let d=c;d<=u;d++)s[s.length]=d.toString()}else s[s.length]=a.trim()}),r[r.length]=s}),r}function Fje(e){if(0===e._rowCount)return;const{id:t,matrix:n,vector:r}=e,i=Nr.struct_ncs_oper.matrix.space,o=Nr.struct_ncs_oper.vector.space,s=[];for(let a=0;a{const h=l.length;l.push(rt.ofUnsortedArray([f,p,m])),c.set(v3(f,p),m),u.has(f)?u.get(f).push(h):u.set(f,[h])};for(let f=0;f=2){d(f,m[0],m[1]);for(let h=1,g=m.length;hc.get(v3(f,p)),getTripletIndices:f=>u.get(f),triplets:l}}function oae(){return{result:xw.create(),closeUnitsResult:ap.create(),unitGroupResult:ap.create()}}!function(e){e.create=function t(n,r,i){return new e(n,r,i)}}(xz||(xz={})),function(e){e.Default={assemblies:[],spacegroup:wd.ZeroP1,isNonStandardCrystalFrame:!1},e.findAssembly=function t(r,i){const o=i.toLocaleLowerCase(),s=Vs.Provider.get(r);return s?NU(s.assemblies,a=>a.id.toLowerCase()===o):void 0},e.getUnitcellLabel=function n(r){const{cell:i,name:o,num:s}=r.spacegroup,{size:a,anglesInRadians:l}=i,c=a[0].toFixed(2),u=a[1].toFixed(2),d=a[2].toFixed(2),f=pf(l[0]).toFixed(2),p=pf(l[1]).toFixed(2),m=pf(l[2]).toFixed(2),h=[];return h.push(`Unit Cell ${o} #${s}`),h.push(`${c}\xd7${u}\xd7${d} \u212b`),h.push(`\u03b1=${f}\xb0 \u03b2=${p}\xb0 \u03b3=${m}\xb0`),h.join(" | ")}}(M3||(M3={})),function(e){e.Descriptor={name:"model_symmetry"},e.Provider=jh.create(e.Descriptor),e.fromData=function t(r){const i=function Aje(e,t,n){if(!e._rowCount)return[];const r=function Tje(e){const{id:t,matrix:n,vector:r,_schema:i}=e,o=new Map,s=C();for(let a=0,l=e._rowCount;aX[H]}(V=t=e.Kinds||(e.Kinds={}))[V.Atomic=0]="Atomic",V[V.Spheres=1]="Spheres",V[V.Gaussians=2]="Gaussians",e.isAtomic=function n(V){return 0===V.kind},e.isCoarse=function r(V){return 1===V.kind||2===V.kind},e.isSpheres=function i(V){return 1===V.kind},e.isGaussians=function o(V){return 2===V.kind},e.create=function s(V,X,H,oe,te,K,Q,G,Z){switch(te){case 0:return new y(V,X,H,oe,K,G,ko.createMapping(Q,K.atomicConformation),Z??{});case 1:return E(V,X,H,oe,K,1,G,ko.createMapping(Q,K.coarseConformation.spheres,h(K)),Z??{});case 2:return E(V,X,H,oe,K,2,G,ko.createMapping(Q,K.coarseConformation.gaussians,X=>0),Z??{})}},e.SymmetryGroup=c,function(V){V.areInvariantElementsEqual=function X(oe,te){return oe.hashCode===te.hashCode&&rt.areEqual(oe.elements,te.elements)},V.getUnitSymmetryGroupsIndexMap=function H(oe){const te=sp.Mutable();for(let K=0,Q=oe.length;K=N)continue;const j=rt.indexOf(e.elements,N);if(j<0)continue;const W=f[F],z=p[F];if(W>=0&&W!==w||z>=0&&z!==w)continue;const $=ig(r.value(N)),V=c[F],X=F8e(e,M,N);let H=!1;V>=0?H=Do(X,V,.3):o>=0?H=X1&&(j=!1)}}}return Lse(w,A,E,M,D,s,R||N&&j)}(e,n)}(this),X.set(this.elements,H)),this.props.bonds=H,this.props.bonds}get rings(){return this.props.rings||(this.props.rings=l5.create(this)),this.props.rings}get resonance(){return this.props.resonance||(this.props.resonance=function Oje(e){return{delocalizedTriplets:Bje(e)}}(this)),this.props.resonance}get polymerElements(){return this.props.polymerElements||(this.props.polymerElements=function cje(e){const t=[],{elements:n,model:r}=e,{residueAtomSegments:i}=e.model.atomicHierarchy,{traceElementIndex:o}=r.atomicHierarchy.derived.residue,s=Di.transientSegments(e.model.atomicRanges.polymerRanges,n),a=En.transientSegments(i,n);for(;s.hasNext;){const l=s.move();for(a.setSegment(l);a.hasNext;){const c=a.move(),{start:u,end:d,index:f}=c;if(Ve.areIntersecting(Pe.ofRange(n[u],n[d-1]),n)){const p=o[f];t.push(-1===p?i.offsets[f]:p)}}}return rt.ofSortedArray(t)}(this)),this.props.polymerElements}get gapElements(){return this.props.gapElements||(this.props.gapElements=function dje(e){const t=[],{elements:n,model:r,residueIndex:i}=e,{residueAtomSegments:o}=e.model.atomicHierarchy,{traceElementIndex:s}=r.atomicHierarchy.derived.residue,a=Di.transientSegments(e.model.atomicRanges.gapRanges,e.elements);for(;a.hasNext;){const l=a.move(),c=i[n[l.start]],u=i[n[l.end-1]],d=s[c],f=s[u];t.push(-1===d?o.offsets[c]:d),t.push(-1===f?o.offsets[u]:f)}return rt.ofSortedArray(t)}(this)),this.props.gapElements}get nucleotideElements(){return this.props.nucleotideElements||(this.props.nucleotideElements=function pje(e){const t=[],{elements:n,model:r}=e,{chainAtomSegments:i,residueAtomSegments:o}=r.atomicHierarchy,{moleculeType:s,traceElementIndex:a}=r.atomicHierarchy.derived.residue,l=En.transientSegments(i,n),c=En.transientSegments(o,n);for(;l.hasNext;)for(c.setSegment(l.move());c.hasNext;){const{index:u}=c.move();if(Fu(s[u])){const d=a[u];t.push(-1===d?o.offsets[u]:d)}}return rt.ofSortedArray(t)}(this)),this.props.nucleotideElements}get proteinElements(){return this.props.proteinElements||(this.props.proteinElements=function hje(e){const t=[],{elements:n,model:r}=e,{chainAtomSegments:i,residueAtomSegments:o}=r.atomicHierarchy,{moleculeType:s,traceElementIndex:a}=r.atomicHierarchy.derived.residue,l=En.transientSegments(i,n),c=En.transientSegments(o,n);for(;l.hasNext;)for(c.setSegment(l.move());c.hasNext;){const{index:u}=c.move();if(wse(s[u])){const d=a[u];t.push(-1===d?o.offsets[u]:d)}}return rt.ofSortedArray(t)}(this)),this.props.proteinElements}get residueCount(){if(void 0!==this.props.residueCount)return this.props.residueCount;let X=0;const H=En.transientSegments(this.model.atomicHierarchy.residueAtomSegments,this.elements);for(;H.hasNext;)H.move(),X+=1;return this.props.residueCount=X,this.props.residueCount}getResidueIndex(X){return this.residueIndex[this.elements[X]]}constructor(X,H,oe,te,K,Q,G,Z){this.kind=0,this.objectPrimitive="atomistic",this.id=X,this.invariantId=H,this.chainGroupId=oe,this.traits=te,this.model=K,this.elements=Q,this.conformation=G,this.residueIndex=K.atomicHierarchy.residueAtomSegments.index,this.chainIndex=K.atomicHierarchy.chainAtomSegments.index,this.props=Z}}e.Atomic=y;class x{getChild(X){return X.length===this.elements.length?this:E(this.id,this.invariantId,this.chainGroupId,this.traits,this.model,this.kind,X,this.conformation,{})}applyOperator(X,H,oe=!1){const te=oe?H:ko.compose(this.conformation.operator,H);return E(X,this.invariantId,this.chainGroupId,this.traits,this.model,this.kind,this.elements,ko.createMapping(te,this.getCoarseConformation(),this.conformation.r),this.props)}remapModel(X,H,oe){const te=this.getCoarseConformation(),K=_(this.kind,X);oe||(oe={...this.props},e.isSameConformation(this,X)||(oe.boundary=void 0,oe.lookup3d=void 0,oe.principalAxes=void 0));const Q=te!==K?ko.createMapping(this.conformation.operator,K,1===this.kind?h(X):X=>0):this.conformation;return new x(this.id,this.invariantId,this.chainGroupId,this.traits,X,this.kind,this.elements,Q,oe)}get boundary(){if(this.props.boundary)return this.props.boundary;const{x:X,y:H,z:oe}=this.getCoarseConformation();return this.props.boundary=p.is(this.traits,f.FastBoundary)?bz({x:X,y:H,z:oe,indices:this.elements}):Q0({x:X,y:H,z:oe,indices:this.elements}),this.props.boundary}get lookup3d(){if(this.props.lookup3d)return this.props.lookup3d;const{x:X,y:H,z:oe}=this.getCoarseConformation();return this.props.lookup3d=zh({x:X,y:H,z:oe,indices:this.elements},this.boundary),this.props.lookup3d}get principalAxes(){return this.props.principalAxes||(this.props.principalAxes=Jse(this)),this.props.principalAxes}get polymerElements(){return this.props.polymerElements||(this.props.polymerElements=function uje(e){const t=[],{elements:n,model:r}=e,{spheres:i,gaussians:o}=r.coarseHierarchy,s=ze.isSpheres(e)?i.polymerRanges:o.polymerRanges,a=Di.transientSegments(s,n);for(;a.hasNext;){const{start:l,end:c}=a.move();for(let u=l;u(c+=l[p].elements.length)>=i,o.closeUnitsResult);if(0===u.count)return s;let d=0,f=-Number.MAX_VALUE;for(let p=0,m=u.count;p=i&&fs||l.addElement(v[y.indices[x]])}l.commitUnit()}}check(t,n,r,i){const{units:o}=this.structure,s=this.unitLookup.find(t,n,r,i);if(0===s.count)return!1;for(let a=0,l=s.count;a0&&(i[i.length]=a.getChild(c))}return Xe.create(i,{parent:e.parent||t.parent})}function Sz(e){return Lr.isCovalent(e.atomicBond.type)}function zje(){return function(t){const{inputStructure:n}=t,r=dt.create(n),i=[];for(const o of n.units){if(0!==o.kind)continue;r.unit=o;const s=o.elements;if(r.element=s[0],"polymer"!==Je.entity.type(r))continue;const a=En.transientSegments(o.model.atomicHierarchy.residueAtomSegments,s);let l=0;for(;a.hasNext;)l++,a.move();l<8||i.push(o)}return Dt.Singletons(n,Xe.create(i,{parent:n}))}}function Vje(){return function(t){const{inputStructure:n}=t,r=dt.create(n),i=[];for(const o of n.units)0===o.kind&&(r.unit=o,r.element=o.elements[0],"water"===Je.entity.type(r)&&i.push(o));return Dt.Singletons(n,Xe.create(i,{parent:n}))}}function Hje(){return function(t){const{inputStructure:n}=t,r=dt.create(n),i=[];for(const o of n.units){if(0!==o.kind)continue;r.unit=o;const s=o.elements;if(r.element=s[0],"water"!==Je.entity.type(r)){if("polymer"===Je.entity.type(r)){const a=En.transientSegments(o.model.atomicHierarchy.residueAtomSegments,s);let l=0;for(;a.hasNext;)l++,a.move();if(l>=8)continue}i.push(o)}}return Dt.Singletons(n,Xe.create(i,{parent:n}))}}function Gje(){return function(t){const{inputStructure:n}=t,r=[];for(const i of n.units)1===i.kind&&r.push(i);return Dt.Singletons(n,Xe.create(r,{parent:n}))}}function aae(e,t,n){return{groupedUnits:e,ranges:t,set:n}}function lae(e){return function(n){return Dt.Sequence(n.inputStructure,[Qr.toStructure({hash:n.inputStructure.hashCode,elements:e},n.inputStructure)])}}!function(e){function t(y,v){return{kind:"singletons",source:y,structure:v}}function n(y,v){return{kind:"sequence",source:y,structures:v}}function r(y){return t(y,Xe.Empty)}function i(y){return"singletons"===y.kind}function o(y){return i(y)?0===y.structure.units.length:0===y.structures.length}function a(y){return o(y)?Xe.Empty:i(y)?y.structure:R3(y.source,y.structures)}function u(y,v,x){return 0===v.length?r(y):x?t(y,R3(y,v)):n(y,v)}e.Singletons=t,e.Sequence=n,e.Empty=r,e.isSingleton=i,e.isEmpty=o,e.structureCount=function s(y){return i(y)?y.structure.elementCount:y.structures.length},e.unionStructure=a,e.toLociWithCurrentUnits=function l(y){const v=[],{unitMap:x}=y.source;for(const _ of a(y).units)v[v.length]=_===x.get(_.id)?{unit:_,indices:Ve.ofBounds(0,_.elements.length)}:{unit:_,indices:Ve.ofSortedArray(rt.indicesOf(x.get(_.id).elements,_.elements))};return Me(y.source,v)},e.toLociWithSourceUnits=function c(y){const v=[],{unitMap:x}=y.source;for(const _ of a(y).units){const w=x.get(_.id);v[v.length]=w===_?{unit:w,indices:Ve.ofBounds(0,w.elements.length)}:{unit:w,indices:Ve.ofSortedArray(rt.indicesOf(w.elements,_.elements))}}return Me(y.source,v)};class d{add(v){const x=v.elementCount;0!==x&&(this.structures[this.structures.length]=v,1!==x&&(this.allSingletons=!1))}getSelection(){return u(this.source,this.structures,this.allSingletons)}constructor(v){this.source=v,this.structures=[],this.allSingletons=!0}}class f{add(v){const x=v.elementCount;0===x||!this.uniqueSets.add(v)||(this.structures[this.structures.length]=v,1!==x&&(this.allSingletons=!1))}getSelection(){return u(this.structure,this.structures,this.allSingletons)}constructor(v){this.structure=v,this.structures=[],this.allSingletons=!0,this.uniqueSets=XU(Xe.hashCode,Xe.areUnitIdsAndIndicesEqual)}}e.LinearBuilder=function p(y){return new d(y)},e.UniqueBuilder=function m(y){return new f(y)},e.forEach=function h(y,v){let x=0;if(e.isSingleton(y))for(const _ of y.structure.units){const{elements:w}=_;for(let A=0,M=w.length;A2)y.push(g[w],g[A-1]);else for(let M=w;M{const h=[];m.groupedUnits.forEach(g=>h.push(rt.ofUnsortedArray(g))),h.sort((g,y)=>g[0]-y[0]),p.push({groupedUnits:h,set:m.set,ranges:m.ranges})}),{hash:u.structure.hashCode,elements:p}}function i(u,d){const f=[];for(let p=0,m=u.length;ppe.core.type.list(d))),ranges:pe.core.type.list(u.ranges),set:pe.core.type.list(u.set)})}e.Empty={hash:-1,elements:[]},e.fromSubStructure=function t(u,d){return r(Dt.toLociWithSourceUnits(Dt.Singletons(u,d)))},e.fromSelection=function n(u){return r(Dt.toLociWithSourceUnits(u))},e.fromLoci=r,e.toLoci=function o(u,d){-1!==u.hash&&u.hash!==d.hashCode&&new Error("Bundle not compatible with given structure");const f=[];for(const p of u.elements)for(const m of p.groupedUnits){const h=i(m,d);if(0===h.length)continue;let g;if(0===p.ranges.length)g=p.set;else if(0===p.set.length)if(2===p.ranges.length)g=Pe.ofRange(p.ranges[0],p.ranges[1]);else{const y=new Int32Array(Di.size(p.ranges));Di.forEach(p.ranges,(v,x)=>y[x]=v),g=rt.ofSortedArray(y)}else{const y=Di.size(p.ranges),v=new Int32Array(p.set.length+y);Di.forEach(p.ranges,(x,_)=>v[_]=x),v.set(p.set,y),g=rt.ofUnsortedArray(v)}for(const y of h)f.push({unit:y,indices:g})}return Me(d,f)},e.toStructure=function s(u,d){-1!==u.hash&&u.hash!==d.hashCode&&new Error("Bundle not compatible with given structure");const f=[];for(const p of u.elements)for(const m of p.groupedUnits){const h=i(m,d);if(0===h.length)continue;const g=h[0].elements,y=Di.size(p.ranges),v=p.set.length,x=new Int32Array(v+y);let _;if(0===y){for(let w=0,A=v;wx[A]=g[w]),_=rt.ofSortedArray(x);else if(rt.min(p.set)>Di.max(p.ranges)){Di.forEach(p.ranges,(w,A)=>x[A]=g[w]);for(let w=0,A=v;wrt.max(p.set)){for(let w=0,A=v;wx[A+v]=g[w]),_=rt.ofSortedArray(x)}else{Di.forEach(p.ranges,(w,A)=>x[A]=g[w]);for(let w=0,A=v;w0?this.currentAtomicBondStack.pop():void 0}pushCurrentStructure(){this.currentStructure&&this.currentStructureStack.push(this.currentStructure)}popCurrentStructure(){this.currentStructure=this.currentStructureStack.length?this.currentStructureStack.pop():void 0}pushInputStructure(t){this.inputStructureStack.push(this.inputStructure),this.inputStructure=t}popInputStructure(){if(0===this.inputStructureStack.length)throw new Error("Must push before pop.");this.inputStructure=this.inputStructureStack.pop()}throwIfTimedOut(){if(0!==this.timeoutMs&&Bo()-this.timeCreated>this.timeoutMs)throw new Error(`The query took too long to execute (> ${this.timeoutMs/1e3}s).`)}tryGetCurrentSelection(){if(!this.currentSelection)throw new Error("The current selection is not assigned.");return this.currentSelection}constructor(t,n){this.currentElementStack=[],this.currentAtomicBondStack=[],this.currentStructureStack=[],this.inputStructureStack=[],this.timeCreated=Bo(),this.element=dt.create(void 0),this.currentStructure=void 0,this.atomicBond=new cae,this.currentSelection=void 0,this.inputStructure=t,this.timeoutMs=n&&n.timeoutMs||0,this.currentSelection=n&&n.currentSelection}}class cae{constructor(){this.a=dt.create(void 0),this.aIndex=0,this.b=dt.create(void 0),this.bIndex=0,this.type=0,this.order=0,this.key=-1,this.testFn=Sz}setStructure(t){this.a.structure=t,this.b.structure=t}setTestFn(t){this.testFn=t||Sz}test(t,n){return!!this.testFn(t)||!!n&&(this.swap(),this.testFn(t))}swap(){const t=this.aIndex;this.aIndex=this.bIndex,this.bIndex=t;const n=this.a.unit;this.a.unit=this.b.unit,this.b.unit=n;const r=this.a.element;this.a.element=this.b.element,this.b.element=r}get length(){return dt.distance(this.a,this.b)}}!function(e){e.run=function t(n,r,i){return n(new _f(r,i))}}(Cz||(Cz={}));class wz{add(t){t.elementCount&&(1!==t.elementCount&&(this.allSingletons=!1),this.set.add(t)&&(this.structures[this.structures.length]=t))}getSelection(){return this.allSingletons?Dt.Singletons(this.source,R3(this.source,this.structures)):Dt.Sequence(this.source,this.structures)}constructor(t){this.source=t,this.set=XU(Xe.hashCode,Xe.areUnitIdsAndIndicesEqual),this.structures=[],this.allSingletons=!0}}class qje{add(t,n,r){let i=this.builderMap.get(t);i||(i=this.source.subsetBuilder(!0),this.builders[this.builders.length]=i,this.builderMap.set(t,i)),i.addToUnit(n,r)}allSingletons(){for(let t=0,n=this.builders.length;t1)return!1;return!0}singletonSelection(){const t=this.source.subsetBuilder(!0),n=dt.create(this.source);for(let r=0,i=this.builders.length;rDt.Sequence(e.inputStructure,[]),uae=e=>Dt.Singletons(e.inputStructure,e.inputStructure);function Wje(e){return Iz({...e,groupBy:t=>Je.residue.key(t.element)})}function $je(e){return Iz({...e,groupBy:t=>Je.chain.key(t.element)})}function A1(e){return!0}function Yje(e){return 0}function Iz(e){if(!e||!(e.atomTest||e.residueTest||e.chainTest||e.entityTest||e.unitTest||e.groupBy))return uae;if(e.atomTest&&!e.residueTest&&!e.chainTest&&!e.entityTest&&!e.unitTest&&!e.groupBy)return function Xje(e){return function(n){const{inputStructure:r}=n,{units:i}=r,o=n.pushCurrentElement(),s=r.subsetBuilder(!0);o.structure=r;for(const a of i){o.unit=a;const l=a.elements;s.beginUnit(a.id);for(let c=0,u=l.length;c0?Ti.create():this.currentUnit}addElement(t){Ti.add(this.currentUnit,t,t)&&this.elementCount++}commitUnit(){0===this.currentUnit.array.length||this.unitMap.has(this.parentId)||(this.ids[this.ids.length]=this.parentId,this.unitMap.set(this.parentId,this.currentUnit),this.parentId=-1)}getStructure(){if(this.isEmpty)return Xe.Empty;const t=[];ip(this.ids);const n=lg.UnitEquivalenceBuilder();for(let r=0,i=this.ids.length;r1&&ip(a);let c=s.getChild(rt.ofSortedArray(a));const u=n.add(c.id,c);c!==u&&(c=u.applyOperator(c.id,c.conformation.operator,!0)),t[t.length]=c}return Xe.create(t,{parent:this.parent})}get isEmpty(){return 0===this.elementCount}constructor(t){this.parent=t,this.ids=[],this.unitMap=sp.Mutable(),this.parentId=-1,this.currentUnit=Ti.create(),this.elementCount=0}}function kt(e){return{data:e,position:0,length:e.length,lineNumber:1,tokenStart:0,tokenEnd:0}}var ot,qi;function dae(e){for(;e.position=e.length)return void(e.tokenType=6);e.tokenStart=e.position,e.tokenEnd=e.position,e.isEscaped=!1;const n=e.data.charCodeAt(e.position);switch(n){case 35:(function sUe(e){for(;e.position=5&&95===e.data.charCodeAt(e.tokenStart+4)?function lUe(e){let t=e.data.charCodeAt(e.tokenStart);return!(68!==t&&100!==t||(t=e.data.charCodeAt(e.tokenStart+1),65!==t&&97!==t)||(t=e.data.charCodeAt(e.tokenStart+2),84!==t&&116!==t)||(t=e.data.charCodeAt(e.tokenStart+3),65!==t&&97!==t))}(e)?0:function cUe(e){let t=e.data.charCodeAt(e.tokenStart);return!(83!==t&&115!==t||(t=e.data.charCodeAt(e.tokenStart+1),65!==t&&97!==t)||(t=e.data.charCodeAt(e.tokenStart+2),86!==t&&118!==t)||(t=e.data.charCodeAt(e.tokenStart+3),69!==t&&101!==t))}(e)?1:function uUe(e){if(e.tokenEnd-e.tokenStart!=5)return!1;let t=e.data.charCodeAt(e.tokenStart);return!(76!==t&&108!==t||(t=e.data.charCodeAt(e.tokenStart+1),79!==t&&111!==t)||(t=e.data.charCodeAt(e.tokenStart+2),79!==t&&111!==t)||(t=e.data.charCodeAt(e.tokenStart+3),80!==t&&112!==t))}(e)?2:3:3}}function I1(e){for(mae(e);5===e.tokenType;)mae(e)}function p5(){return{categoryNames:[],categoryData:Object.create(null)}}function Dz(e,t){const n=Object.create(null);for(const r of e){const i=t[r];n[r]=ll(i.name,i.rowCount,i.fieldNames,i.fields)}return n}function gae(e,t,n){return GU(e.categoryNames,Dz(e.categoryNames,e.categoryData),t,n)}function mUe(e,t){return GU(e.categoryNames,Dz(e.categoryNames,e.categoryData),t)}function Pz(e,t,n,r,i){if(t in e.categoryData){const o=e.categoryData[t];o.fieldNames.push(...r),Object.assign(o.fields,i)}else e.categoryData[t]={name:t,rowCount:n,fieldNames:r,fields:i},e.categoryNames.push(t)}function gUe(e,t){const n=e.tokenStart,r=pae(e),i=hae(e,r),o=Object.create(null),s=[];let a=!0;for(;a;){if(4!==e.tokenType||!fUe(e,n,r)){a=!1;break}const l=Tz(e).substring(i.length+1);if(I1(e),3!==e.tokenType)return{hasError:!0,errorLine:e.lineNumber,errorMessage:"Expected value."};o[l]=Tt.ofTokens({data:e.data,indices:[e.tokenStart,e.tokenEnd],count:1}),s[s.length]=l,I1(e)}return Pz(t,i.substr(1),1,s,o),{hasError:!1,errorLine:0,errorMessage:""}}function yUe(e,t){const{tokenizer:n,tokens:r,fieldCount:i}=t;let o=t.tokenCount,s=0;for(;3===n.tokenType&&s0&&n.push(gae(o,i,s)),i=e.substring(r.tokenStart+5,r.tokenEnd),o=p5(),s=[],I1(r)}else if(1===u){if(r.tokenEnd-r.tokenStart==5)a.categoryNames.length>0&&(s[s.length]=mUe(a,c)),r.inSaveFrame=!1;else{if(r.inSaveFrame)return _w(r.lineNumber,"Save frames cannot be nested.");r.inSaveFrame=!0,c=e.substring(r.tokenStart+5,r.tokenEnd),a=p5()}I1(r)}else if(2===u){const d=yield vUe(r,r.inSaveFrame?a:o);if(d.hasError)return _w(d.errorLine,d.errorMessage)}else{if(4!==u)return console.log(r.tokenType,kt.getTokenString(r)),_w(r.lineNumber,"Unexpected token. Expected data_, loop_, or data name.");{const d=gUe(r,r.inSaveFrame?a:o);if(d.hasError)return _w(d.errorLine,d.errorMessage)}}}return r.inSaveFrame?_w(r.lineNumber,`Unfinished save frame (${l.header}).`):((o.categoryNames.length>0||s.length>0)&&n.push(gae(o,i,s)),function xUe(e){return qi.success(e)}(Woe(n)))}),Mz.apply(this,arguments)}function yae(e){return Ke.create("Parse CIF",function(){var t=le(function*(n){return yield function _Ue(e,t){return Mz.apply(this,arguments)}(e,n)});return function(n){return t.apply(this,arguments)}}())}function bae(e){return m5({buffer:e,offset:0,dataView:new DataView(e.buffer)})}function Rz(e,t){const n={};for(let r=0;rr.name),getField(r){const i=t[r];if(i)return n[r]||(n[r]=function SUe(e){const t=e.mask?t5(e.mask):void 0,n=t5(e.data),r=bU(n),i=r?t?c=>0===t[c]?""+n[c]:"":c=>""+n[c]:t?c=>0===t[c]?n[c]:"":c=>n[c],o=r?c=>n[c]:c=>{const u=n[c];return p1(u,0,u.length)},s=r?c=>n[c]:c=>{const u=n[c];return V0(u,0,u.length)},l=n.length;return{__array:n,binaryEncoding:e.data.encoding,isDefined:!0,rowCount:l,str:i,int:o,float:s,valueKind:t?c=>t[c]:c=>0,areValuesEqual:(c,u)=>n[c]===n[u],toStringArray:c=>tc(l,i,c),toIntArray:r?c=>ER(n,c):c=>tc(l,o,c),toFloatArray:r?c=>ER(n,c):c=>tc(l,s,c)}}(i)),n[r]}}}function vae(e){return Ke.create("Parse BinaryCIF",function(){var t=le(function*(n){const r=[0,3];try{const i=bae(e);if(!function CUe(e,t){for(let n=0;n<2;n++)if(e[n]>t[n])return!1;return!0}(r,i.version.match(/(\d)\.(\d)\.\d/).slice(1).map(s=>+s)))return qi.error(`Unsupported format version. Current ${i.version}, required ${r.join(".")}.`);const o=Woe(i.dataBlocks.map(s=>{const a=Object.create(null);for(const l of s.categories)a[l.name.substr(1)]=wUe(l);return GU(s.categories.map(l=>l.name.substr(1)),a,s.header)}));return qi.success(o)}catch(i){return qi.error(""+i)}});return function(n){return t.apply(this,arguments)}}())}!function(e){function t(_){return _.data.substring(_.tokenStart,_.tokenEnd)}function r(_){const{data:w}=_;for(;_.position<_.length;)switch(w.charCodeAt(_.position)){case 10:return _.tokenEnd=_.position,++_.position,++_.lineNumber,!0;case 13:return _.tokenEnd=_.position,++_.position,++_.lineNumber,10===w.charCodeAt(_.position)&&++_.position,!0;default:++_.position}return _.tokenEnd=_.position,_.tokenStart!==_.tokenEnd}function o(_){return _.tokenStart=_.position,r(_)}function l(_,w,A){let M=0;for(let E=0;E{const R=Math.min(w-D,T);return l(F,R,E),D+=R,R},(T,F)=>T.update({message:"Parsing...",current:F.position,max:F.length})),E})).apply(this,arguments)}function g(){return(g=le(function*(_,w,A=1e5){const M=e(_),E=ot.create(M.data,Math.max(_.length/80,2));return yield G0(w,A,M,(D,T)=>(function m(_,w,A){let M=0;for(let E=0;ED.update({message:"Parsing...",current:T.position,max:T.length})),E})).apply(this,arguments)}function x(_,w,A){const{data:M}=_;let E=w,D=A-1,T=M.charCodeAt(E);for(;(9===T||32===T)&&E<=D;)T=M.charCodeAt(++E);for(T=M.charCodeAt(D);(9===T||32===T)&&D>=E;)T=M.charCodeAt(--D);return _.tokenStart=E,_.tokenEnd=D+1,_.position=A,_}e.getTokenString=t,e.reset=function n(_){_.position=0,_.lineNumber=1,_.tokenStart=0,_.tokenEnd=0},e.eatLine=r,e.markStart=function i(_){_.tokenStart=_.position},e.markLine=o,e.readLine=function s(_){return o(_),t(_)},e.readLineTrim=function a(_){o(_);const w=_.position;return x(_,_.tokenStart,_.tokenEnd),_.position=w,t(_)},e.markLines=function c(_,w){const A=ot.create(_.data,2*w);return l(_,w,A),A},e.readLines=function u(_,w){const A=[];for(let M=0;Mc.indicesLenMinus2&&function t(s){const a=new Uint32Array(1.61*s.indices.length|0);a.set(s.indices),s.indices=a,s.indicesLenMinus2=a.length-2|0}(c),c.indices[c.offset++]=a,c.indices[c.offset++]=l,s.count++}e.add=n,e.addToken=function r(s,a){n(s,a.tokenStart,a.tokenEnd)},e.addUnchecked=function i(s,a,l){s.indices[s.offset++]=a,s.indices[s.offset++]=l,s.count++},e.create=function o(s,a){return{data:s,indicesLenMinus2:(a=Math.max(10,a))-2|0,count:0,offset:0,indices:new Uint32Array(a)}}}(ot||(ot={})),function(e){e.error=function t(o,s=-1){return new r(o,s)},e.success=function n(o,s=[]){return new i(o,s)};class r{toString(){return this.line>=0?`[Line ${this.line}] ${this.message}`:this.message}constructor(s,a){this.message=s,this.line=a,this.isError=!0}}e.Error=r;class i{constructor(s,a){this.result=s,this.warnings=a,this.isError=!1}}e.Success=i}(qi||(qi={}));var r_=ce.Schema;const so=r_.str,xae=r_.List,og=r_.lstr,Sf=r_.Aliased,N3=r_.int,Sw=r_.coord,IUe={chem_comp:{formula:so,formula_weight:r_.float,id:so,mon_nstd_parent_comp_id:xae(",",e=>e),name:so,one_letter_code:so,three_letter_code:so,type:Sf(og),pdbx_synonyms:xae(";",e=>e),pdbx_type:so,pdbx_ambiguous_flag:so,pdbx_replaced_by:so,pdbx_replaces:so,pdbx_formal_charge:N3,pdbx_model_coordinates_details:so,pdbx_model_coordinates_db_code:so,pdbx_ideal_coordinates_details:so,pdbx_ideal_coordinates_missing_flag:Sf(og),pdbx_model_coordinates_missing_flag:Sf(og),pdbx_initial_date:so,pdbx_modified_date:so,pdbx_release_status:Sf(so),pdbx_processing_site:Sf(so)},chem_comp_atom:{alt_atom_id:so,atom_id:so,charge:N3,model_Cartn_x:Sw,model_Cartn_y:Sw,model_Cartn_z:Sw,comp_id:so,type_symbol:so,pdbx_align:N3,pdbx_ordinal:N3,pdbx_model_Cartn_x_ideal:Sw,pdbx_model_Cartn_y_ideal:Sw,pdbx_model_Cartn_z_ideal:Sw,pdbx_stereo_config:Sf(og),pdbx_aromatic_flag:Sf(og),pdbx_leaving_atom_flag:Sf(og)},chem_comp_bond:{atom_id_1:so,atom_id_2:so,comp_id:so,value_order:Sf(og),pdbx_ordinal:N3,pdbx_stereo_config:Sf(og),pdbx_aromatic_flag:Sf(og)},pdbx_chem_comp_descriptor:{comp_id:so,descriptor:so,type:Sf(og),program:so,program_version:so},pdbx_chem_comp_identifier:{comp_id:so,identifier:so,type:Sf(so),program:so,program_version:so}};var F3=ce.Schema;const tr=F3.str,J0=F3.lstr,Ou=F3.Aliased,pp=F3.int,TUe={pdbx_reference_molecule:{prd_id:tr,formula_weight:F3.float,formula:tr,type:Ou(J0),type_evidence_code:tr,class:Ou(J0),class_evidence_code:tr,name:tr,represent_as:Ou(J0),chem_comp_id:tr,compound_details:tr,description:tr,representative_PDB_id_code:tr,release_status:Ou(J0),replaces:tr,replaced_by:tr},pdbx_reference_entity_list:{prd_id:tr,ref_entity_id:tr,type:Ou(J0),details:tr,component_id:pp},pdbx_reference_entity_nonpoly:{prd_id:tr,ref_entity_id:tr,name:tr,chem_comp_id:tr},pdbx_reference_entity_link:{link_id:pp,prd_id:tr,details:tr,ref_entity_id_1:tr,ref_entity_id_2:tr,entity_seq_num_1:pp,entity_seq_num_2:pp,comp_id_1:tr,comp_id_2:tr,atom_id_1:tr,atom_id_2:tr,value_order:Ou(J0),component_1:pp,component_2:pp,link_class:Ou(tr)},pdbx_reference_entity_poly_link:{link_id:pp,prd_id:tr,ref_entity_id:tr,component_id:pp,entity_seq_num_1:pp,entity_seq_num_2:pp,comp_id_1:tr,comp_id_2:tr,atom_id_1:tr,atom_id_2:tr,value_order:Ou(J0)},pdbx_reference_entity_poly:{prd_id:tr,ref_entity_id:tr,type:Ou(tr),db_code:tr,db_name:tr},pdbx_reference_entity_poly_seq:{prd_id:tr,ref_entity_id:tr,mon_id:tr,parent_mon_id:tr,num:pp,observed:Ou(J0),hetero:Ou(J0)},pdbx_reference_entity_sequence:{prd_id:tr,ref_entity_id:tr,type:Ou(tr),NRP_flag:Ou(tr),one_letter_codes:tr},pdbx_reference_entity_src_nat:{prd_id:tr,ref_entity_id:tr,ordinal:pp,organism_scientific:tr,taxid:tr,db_code:tr,db_name:tr},pdbx_prd_audit:{prd_id:tr,date:tr,processing_site:Ou(tr),action_type:Ou(tr)}};var _ae=ce.Schema;const xa=_ae.str,PUe={datablock:{id:xa,description:xa},dictionary:{title:xa,datablock_id:xa,version:xa},dictionary_history:{version:xa,update:xa,revision:xa},sub_category:{id:xa,description:xa},category_group_list:{id:xa,parent_id:xa,description:xa},item_type_list:{code:xa,primitive_code:xa,construct:xa,detail:xa},item_units_list:{code:xa,detail:xa},item_units_conversion:{from_code:xa,to_code:xa,operator:xa,factor:_ae.float}};var O3=ce.Schema;const sg=O3.str,g5=O3.int,ey=O3.float,y5=O3.Aliased,E1=O3.Vector,Sae=(y5(sg),y5(sg),y5(sg),y5(sg),E1(3),E1(3),{volume_data_3d_info:{name:sg,axis_order:E1(3,g5),origin:E1(3),dimensions:E1(3),sample_rate:g5,sample_count:E1(3,g5),spacegroup_number:g5,spacegroup_cell_size:E1(3),spacegroup_cell_angles:E1(3),mean_source:ey,mean_sampled:ey,sigma_source:ey,sigma_sampled:ey,min_source:ey,min_sampled:ey,max_source:ey,max_sampled:ey},volume_data_3d:{values:ey}});var b5=ce.Schema;const Hs=b5.float,Oz=b5.int,bo=b5.str,MUe={cell:{angle_alpha:Hs,angle_beta:Hs,angle_gamma:Hs,formula_units_z:Oz,length_a:Hs,length_b:Hs,length_c:Hs,volume:Hs},chemical:{melting_point:Hs,name_common:bo,name_systematic:bo},chemical_formula:{moiety:bo,sum:bo,weight:Hs},space_group:{crystal_system:bo,it_number:Oz,"name_h-m_full":bo},space_group_symop:{operation_xyz:bo},geom_bond:{atom_site_label_1:bo,atom_site_label_2:bo,distance:Hs,publ_flag:bo,site_symmetry_1:bo,site_symmetry_2:bo,valence:Hs},audit:{block_doi:bo},database_code:{cod:bo,csd:bo,depnum_ccdc_archive:bo,depnum_ccdc_fiz:bo,icsd:bo,mdf:bo,nbs:bo},atom_site:{adp_type:bo,calc_flag:bo,disorder_assembly:bo,disorder_group:bo,fract_x:Hs,fract_y:Hs,fract_z:Hs,label:bo,occupancy:Hs,refinement_flags:bo,site_symmetry_multiplicity:Oz,type_symbol:bo,u_iso_or_equiv:Hs},atom_site_aniso:{label:bo,u_11:Hs,u:(0,b5.Matrix)(3,3),u_12:Hs,u_13:Hs,u_22:Hs,u_23:Hs,u_33:Hs},atom_type:{description:bo,symbol:bo},atom_type_scat:{dispersion_imag:Hs,dispersion_real:Hs,source:bo}},RUe={"cell.formula_units_z":["cell_formula_units_Z"],"space_group.it_number":["space_group_IT_number","symmetry_Int_Tables_number"],"space_group.name_h-m_full":["symmetry_space_group_name_H-M"],"space_group_symop.operation_xyz":["symmetry_equiv_pos_as_xyz"],"geom_bond.atom_site_label_1":["geom_bond_atom_site_id_1"],"geom_bond.atom_site_label_2":["geom_bond_atom_site_id_2"],"geom_bond.distance":["geom_bond_dist"],"audit.block_doi":["audit_block_DOI"],"database_code.cod":["database_code_COD"],"database_code.csd":["database_code_CSD"],"database_code.depnum_ccdc_archive":["database_code_depnum_CCDC_archive"],"database_code.depnum_ccdc_fiz":["database_code_depnum_CCDC_fiz"],"database_code.icsd":["database_code_ICSD"],"database_code.mdf":["database_code_MDF"],"database_code.nbs":["database_code_NBS"],"atom_site.adp_type":["atom_site_ADP_type","atom_site_thermal_displace_type"],"atom_site.label":["atom_site_id"],"atom_site.site_symmetry_multiplicity":["atom_site_symmetry_multiplicity"],"atom_site.u_iso_or_equiv":["atom_site_U_iso_or_equiv"],"atom_site_aniso.label":["atom_site_anisotrop_id"],"atom_site_aniso.u_11":["atom_site_aniso_U_11","atom_site_anisotrop_U_11"],"atom_site_aniso.u_12":["atom_site_aniso_U_12","atom_site_anisotrop_U_12"],"atom_site_aniso.u_13":["atom_site_aniso_U_13","atom_site_anisotrop_U_13"],"atom_site_aniso.u_22":["atom_site_aniso_U_22","atom_site_anisotrop_U_22"],"atom_site_aniso.u_23":["atom_site_aniso_U_23","atom_site_anisotrop_U_23"],"atom_site_aniso.u_33":["atom_site_aniso_U_33","atom_site_anisotrop_U_33"]},Bz=ce.Schema.int,FUe={volume_data_3d_info:Sae.volume_data_3d_info,segmentation_data_table:{set_id:Bz,segment_id:Bz},segmentation_data_3d:{values:Bz}},Hh={parse:e=>"string"==typeof e?yae(e):vae(e),parseText:yae,parseBinary:vae,toDatabaseCollection:function WBe(e,t,n){const r={};for(const i of t.blocks)r[i.header]=rg(e,i,n);return r},toDatabase:rg,schema:{mmCIF:e=>rg(Nr,e),CCD:e=>rg(IUe,e),BIRD:e=>rg(TUe,e),dic:e=>rg(PUe,e),cifCore:e=>rg(MUe,e,RUe),densityServer:e=>rg(Sae,e),segmentation:e=>rg(FUe,e)}},OUe={type_symbol:ce.Schema.Aliased(Nr.atom_site.type_symbol),label_atom_id:Nr.atom_site.label_atom_id,auth_atom_id:Nr.atom_site.auth_atom_id,label_alt_id:Nr.atom_site.label_alt_id,label_comp_id:Nr.atom_site.label_comp_id,auth_comp_id:Nr.atom_site.auth_comp_id,pdbx_formal_charge:Nr.atom_site.pdbx_formal_charge},BUe={group_PDB:Nr.atom_site.group_PDB,label_seq_id:Nr.atom_site.label_seq_id,auth_seq_id:Nr.atom_site.auth_seq_id,pdbx_PDB_ins_code:Nr.atom_site.pdbx_PDB_ins_code},LUe={label_asym_id:Nr.atom_site.label_asym_id,auth_asym_id:Nr.atom_site.auth_asym_id,label_entity_id:Nr.atom_site.label_entity_id};var Lz,i_;!function(e){e.EmptyResidueKey=function t(){return{label_entity_id:"",label_asym_id:"",auth_seq_id:0,pdbx_PDB_ins_code:void 0}}}(Lz||(Lz={})),function(e){function t(i,o){return i.residueAtomSegments.index[i.chainAtomSegments.offsets[o]]}function n(i,o){return i.residueAtomSegments.index[i.chainAtomSegments.offsets[o+1]-1]+1}e.chainStartResidueIndex=t,e.chainEndResidueIndexExcl=n,e.chainResidueCount=function r(i,o){return n(i,o)-t(i,o)}}(i_||(i_={}));const v5={H:1,D:1,T:1,HE:2,LI:3,BE:4,B:5,C:6,N:7,O:8,F:9,NE:10,NA:11,MG:12,AL:13,SI:14,P:15,S:16,CL:17,AR:18,K:19,CA:20,SC:21,TI:22,V:23,CR:24,MN:25,FE:26,CO:27,NI:28,CU:29,ZN:30,GA:31,GE:32,AS:33,SE:34,BR:35,KR:36,RB:37,SR:38,Y:39,ZR:40,NB:41,MO:42,TC:43,RU:44,RH:45,PD:46,AG:47,CD:48,IN:49,SN:50,SB:51,TE:52,I:53,XE:54,CS:55,BA:56,LA:57,CE:58,PR:59,ND:60,PM:61,SM:62,EU:63,GD:64,TB:65,DY:66,HO:67,ER:68,TM:69,YB:70,LU:71,HF:72,TA:73,W:74,RE:75,OS:76,IR:77,PT:78,AU:79,HG:80,TL:81,PB:82,BI:83,PO:84,AT:85,RN:86,FR:87,RA:88,AC:89,TH:90,PA:91,U:92,NP:93,PU:94,AM:95,CM:96,BK:97,CF:98,ES:99,FM:100,MD:101,NO:102,LR:103,RF:104,DB:105,SG:106,BH:107,HS:108,MT:109},jUe={1:1.1,2:1.4,3:1.81,4:1.53,5:1.92,6:1.7,7:1.55,8:1.52,9:1.47,10:1.54,11:2.27,12:1.73,13:1.84,14:2.1,15:1.8,16:1.8,17:1.75,18:1.88,19:2.75,20:2.31,21:2.3,22:2.15,23:2.05,24:2.05,25:2.05,26:2.05,27:2,28:2,29:2,30:2.1,31:1.87,32:2.11,33:1.85,34:1.9,35:1.83,36:2.02,37:3.03,38:2.49,39:2.4,40:2.3,41:2.15,42:2.1,43:2.05,44:2.05,45:2,46:2.05,47:2.1,48:2.2,49:2.2,50:1.93,51:2.17,52:2.06,53:1.98,54:2.16,55:3.43,56:2.68,57:2.5,58:2.48,59:2.47,60:2.45,61:2.43,62:2.42,63:2.4,64:2.38,65:2.37,66:2.35,67:2.33,68:2.32,69:2.3,70:2.28,71:2.27,72:2.25,73:2.2,74:2.1,75:2.05,76:2,77:2,78:2.05,79:2.1,80:2.05,81:1.96,82:2.02,83:2.07,84:1.97,85:2.02,86:2.2,87:3.48,88:2.83,89:2,90:2.4,91:2,92:2.3,93:2,94:2,95:2,96:2,97:2,98:2,99:2,100:2,101:2,102:2,103:2,104:2,105:2,106:2,107:2,108:2,109:2},UUe={1:1.008,2:4.0026,3:6.94,4:9.0122,5:10.81,6:10.81,7:14.007,8:15.999,9:18.998,10:20.18,11:22.99,12:24.305,13:26.982,14:28.085,15:30.974,16:32.06,17:35.45,18:39.948,19:39.098,20:40.078,21:44.956,22:47.867,23:50.942,24:51.996,25:54.938,26:55.845,27:58.933,28:58.693,29:63.546,30:65.38,31:69.723,32:72.63,33:74.922,34:78.971,35:79.904,36:83.798,37:85.468,38:87.62,39:88.906,40:91.224,41:92.906,42:95.95,43:96.906,44:101.07,45:102.91,46:106.42,47:107.87,48:112.41,49:114.82,50:118.71,51:121.76,52:127.6,53:127.6,54:131.29,55:132.91,56:137.33,57:138.91,58:140.12,59:140.91,60:144.24,61:144.912,62:150.36,63:151.96,64:157.25,65:158.93,66:162.5,67:164.93,68:167.26,69:168.93,70:173.05,71:174.97,72:178.49,73:180.95,74:183.84,75:186.21,76:190.23,77:192.22,78:195.08,79:196.97,80:200.59,81:204.38,82:207.2,83:208.98,84:1.97,85:2.02,86:2.2,87:3.48,88:2.83,89:2,90:232.04,91:231.04,92:238.03,93:237.048,94:244.064,95:243.061,96:247.07,97:247.07,98:251.079,99:252.083,100:257.095,101:258.098,102:259.101,103:262.11,104:267.122,105:270.131,106:271.134,107:270.133,108:270.134,109:278.156},zUe=1.7,HUe=0;function B3(e){const t=v5[e];return void 0===t?zUe:jUe[t]}function L3(e){const t=v5[e];return void 0===t?HUe:t}function Cae(e,t,n,r){return{type:e,key:t,elements:n,getIndex:r}}var o_;function YUe(e,t,n,r,i,o){const{auth_seq_id:s,label_seq_id:a,pdbx_PDB_ins_code:l}=e.residues,{endSeqId:c,endInsCode:u,key:d,type:f}=n,p="label"===t?a:s;let m=r;for(;mc||h===c&&l.value(m)===u)break;m++}}!function(e){e.Descriptor={name:"model_secondary_structure"},e.Provider=jh.create(e.Descriptor),e.fromStruct=function t(n,r,i){const o=new Map,s=[{kind:"none"}],a=function qUe(e,t){if(e._rowCount>0){if(0!==e.beg_label_seq_id.valueKind(0)||0!==e.end_label_seq_id.valueKind(0))return"auth"}else if(t&&(0!==t.beg_label_seq_id.valueKind(0)||0!==t.end_label_seq_id.valueKind(0)))return"auth";return"label"}(n,r);(function WUe(e,t,n,r){if(!e._rowCount)return;const{beg_label_asym_id:i,beg_label_seq_id:o,beg_auth_seq_id:s,pdbx_beg_PDB_ins_code:a}=e,{end_label_seq_id:l,end_auth_seq_id:c,pdbx_end_PDB_ins_code:u}=e,{pdbx_PDB_helix_class:d,conf_type_id:f,details:p}=e,m="label"===t?o:s,h="label"===t?l:c;for(let g=0,y=e._rowCount;g0&&function XUe(e,t,n,r){const{count:i}=e.chainAtomSegments,{label_asym_id:o}=e.chains,{auth_seq_id:s,label_seq_id:a,pdbx_PDB_ins_code:l}=e.residues,c="label"===t?a:s;for(let u=0;ud)}}(o_||(o_={}));const KUe={U:Nr.atom_site_anisotrop.U,U_esd:Nr.atom_site_anisotrop.U_esd};var ag,s_;!function(e){e.Schema=KUe,e.Descriptor={name:"atom_site_anisotrop",cifExport:{prefix:"",categories:[{name:"atom_site_anisotrop",instance:r=>e.Provider.get(r.firstModel)&&Ui.is(r.firstModel.sourceData)?us.Category.ofTable(r.firstModel.sourceData.data.db.atom_site_anisotrop):us.Category.Empty}]}},e.Provider=jh.create(e.Descriptor),e.getElementToAnsiotrop=function t(r,i){const o=new Int32Array(r.rowCount);o.fill(-1);for(let a=0,l=r.rowCount;a0},e.writeMmCif=function s(a,l){a.writeCategory({name:t,instance(){const c=Kr.ofRows(e.Schema.molstar_global_model_transform_info,[{matrix:l}]);return us.Category.ofTable(c)}})}}(s_||(s_={})),ce.Schema.Str();const ZUe={...Nr.chem_comp,type:ce.Schema.Aliased(ce.Schema.str)};function QUe(e,t){const{ihm_model_group:n,ihm_model_group_link:r}=t,i=Kr.pickRow(r,o=>r.model_id.value(o)===e);if(i){const o=Kr.pickRow(n,s=>n.id.value(s)===i.group_id);if(o)return o.name}return""}function wae(e){for(let t=0,n=e.rowCount;tthis.namesMap.set(n[0],n[1]))}}const eze=[new Set(["CA"]),new Set(["C"]),new Set(["N"])],tze=[new Set(["P","O3'","O3*"]),new Set(["C4'","C4*"]),new Set(["O2'","O2*","F2'","F2*"])],nze=[new Set(["P","O3'","O3*"]),new Set(["C3'","C3*"]),new Set(["O2'","O2*","F2'","F2*"])],rze=new Set(["FMN","NCN","FNS","FMA","ATP","ADP","AMP","GTP","GDP","GMP","LIG"]),Aae=function(){const e=new Map;return[{id:"HIS",name:"HISTIDINE",type:"l-peptide linking"},{id:"ARG",name:"ARGININE",type:"l-peptide linking"},{id:"LYS",name:"LYSINE",type:"l-peptide linking"},{id:"ILE",name:"ISOLEUCINE",type:"l-peptide linking"},{id:"PHE",name:"PHENYLALANINE",type:"l-peptide linking"},{id:"LEU",name:"LEUCINE",type:"l-peptide linking"},{id:"TRP",name:"TRYPTOPHAN",type:"l-peptide linking"},{id:"ALA",name:"ALANINE",type:"l-peptide linking"},{id:"MET",name:"METHIONINE",type:"l-peptide linking"},{id:"CYS",name:"CYSTEINE",type:"l-peptide linking"},{id:"ASN",name:"ASPARAGINE",type:"l-peptide linking"},{id:"VAL",name:"VALINE",type:"l-peptide linking"},{id:"GLY",name:"GLYCINE",type:"peptide linking"},{id:"SER",name:"SERINE",type:"l-peptide linking"},{id:"GLN",name:"GLUTAMINE",type:"l-peptide linking"},{id:"TYR",name:"TYROSINE",type:"l-peptide linking"},{id:"ASP",name:"ASPARTIC ACID",type:"l-peptide linking"},{id:"GLU",name:"GLUTAMIC ACID",type:"l-peptide linking"},{id:"THR",name:"THREONINE",type:"l-peptide linking"},{id:"PRO",name:"PROLINE",type:"l-peptide linking"},{id:"SEC",name:"SELENOCYSTEINE",type:"l-peptide linking"},{id:"PYL",name:"PYRROLYSINE",type:"l-peptide linking"},{id:"MSE",name:"SELENOMETHIONINE",type:"l-peptide linking"},{id:"SEP",name:"PHOSPHOSERINE",type:"l-peptide linking"},{id:"TPO",name:"PHOSPHOTHREONINE",type:"l-peptide linking"},{id:"PTR",name:"O-PHOSPHOTYROSINE",type:"l-peptide linking"},{id:"PCA",name:"PYROGLUTAMIC ACID",type:"l-peptide linking"},{id:"A",name:"ADENOSINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"C",name:"CYTIDINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"T",name:"THYMIDINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"G",name:"GUANOSINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"I",name:"INOSINIC ACID",type:"rna linking"},{id:"U",name:"URIDINE-5'-MONOPHOSPHATE",type:"rna linking"},{id:"DA",name:"2'-DEOXYADENOSINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DC",name:"2'-DEOXYCYTIDINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DT",name:"THYMIDINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DG",name:"2'-DEOXYGUANOSINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DI",name:"2'-DEOXYINOSINE-5'-MONOPHOSPHATE",type:"dna linking"},{id:"DU",name:"2'-DEOXYURIDINE-5'-MONOPHOSPHATE",type:"dna linking"}].forEach(n=>e.set(n.id,n)),e}(),Iae=function(){const e=new Map;return[{id:"ZN2",name:"ZINC ION",type:"ion"},{id:"SOD",name:"SODIUM ION",type:"ion"},{id:"CES",name:"CESIUM ION",type:"ion"},{id:"CLA",name:"CHLORIDE ION",type:"ion"},{id:"CAL",name:"CALCIUM ION",type:"ion"},{id:"POT",name:"POTASSIUM ION",type:"ion"}].forEach(n=>e.set(n.id,n)),e}();class qh{set(t){this.comps.set(t.id,t),this.ids.push(t.id),this.names.push(t.name),this.types.push(t.type),this.mon_nstd_flags.push(yw.has(t.id)?"y":"n")}getAtomIds(t){const n=new Set,r=this.seqId.value(t);for(;tthis.namesMap.set(n[0],n[1]))}constructor(t,n){this.seqId=t,this.atomId=n,this.namesMap=new Map,this.comps=new Map,this.ids=[],this.names=[],this.types=[],this.mon_nstd_flags=[]}}var Ui,j3;function jz(e,t){const n=Ui.fromFrame(e,void 0,void 0,t),r=hp(n.data.db,!0);return Ke.create("Create mmCIF Model",i=>cg(r,n,i))}function Uz(){return Uz=le(function*(e,t,n){const r=yield Eae(e,t,{coordinateType:"ideal",cartn_x:"pdbx_model_Cartn_x_ideal",cartn_y:"pdbx_model_Cartn_y_ideal",cartn_z:"pdbx_model_Cartn_z_ideal"},n),i=yield Eae(e,t,{coordinateType:"model",cartn_x:"model_Cartn_x",cartn_y:"model_Cartn_y",cartn_z:"model_Cartn_z"},n),o=[];r&&o.push(r),i&&o.push(i);for(let s=0,a=o.length;s0||(x[x.length]=G);const _=x.length,w=ce.ofConst("A",_,ce.Schema.str),A=ce.ofConst(1,_,ce.Schema.int),M=ce.ofConst("1",_,ce.Schema.str),E=ce.ofConst(1,_,ce.Schema.float),D=ce.ofConst(1,_,ce.Schema.int),T=ce.view(p,x),F=ce.view(h,x),R=ce.view(o[l],x),N=ce.view(o[c],x),j=ce.view(o[u],x),W=ce.view(g,x),z=ce.view(y,x),$=ce.view(m,x),V=Kr.ofPartialColumns(ic.atom_site,{auth_asym_id:w,auth_atom_id:T,auth_comp_id:F,auth_seq_id:A,Cartn_x:R,Cartn_y:N,Cartn_z:j,id:W,label_asym_id:w,label_atom_id:T,label_comp_id:F,label_seq_id:A,label_entity_id:M,occupancy:E,type_symbol:z,pdbx_PDB_model_num:D,pdbx_formal_charge:$},_),X=new Gh;X.setNames([[f,`${d} (${a})`]]),X.getEntityId(f,0,"A");const H=new qh(A,y);H.setNames([[f,`${d} (${a})`]]),H.add(f,0);const oe=hp({entity:X.getEntityTable(),chem_comp:H.getChemCompTable(),atom_site:V}),te=yield cg(oe,t,r);if(!te.representative)return;const K=te.representative,Q=t_.getEntriesFromChemCompBond(s);return t_.Provider.set(K,{data:s,entries:Q}),j3.CoordinateType.set(K,a),te.representative}),zz.apply(this,arguments)}Vs.Provider.formatRegistry.add("mmCIF",function ize(e){if(Ui.is(e.sourceData))return Vs.fromData(e.sourceData.data.db)}),o_.Provider.formatRegistry.add("mmCIF",function oze(e){if(!Ui.is(e.sourceData))return;const{struct_conf:t,struct_sheet_range:n}=e.sourceData.data.db;return o_.fromStruct(t,n,e.atomicHierarchy)}),ag.Provider.formatRegistry.add("mmCIF",function sze(e){if(!Ui.is(e.sourceData))return;const{atom_site_anisotrop:t}=e.sourceData.data.db;return{data:Kr.ofColumns(ag.Schema,t),elementToAnsiotrop:ag.getElementToAnsiotrop(e.atomicConformation.atomId,t.id)}},function aze(e){return!!Ui.is(e.sourceData)&&e.sourceData.data.db.atom_site_anisotrop.U.isDefined}),t_.Provider.formatRegistry.add("mmCIF",function lze(e){if(!Ui.is(e.sourceData))return;const{chem_comp_bond:t}=e.sourceData.data.db;return 0!==t._rowCount?{data:t,entries:t_.getEntriesFromChemCompBond(t)}:void 0}),vf.Provider.formatRegistry.add("mmCIF",function cze(e){if(!Ui.is(e.sourceData))return;const{struct_conn:t}=e.sourceData.data.db;if(0===t._rowCount)return;const n=vf.getEntriesFromStructConn(t,e);return{data:t,byAtomIndex:vf.getAtomIndexFromEntries(n),entries:n}}),s_.Provider.formatRegistry.add("mmCIF",s_.fromMmCif,s_.hasData),function(e){e.is=function t(r){return"mmCIF"===r?.kind},e.fromFrame=function n(r,i,o,s){return i||(i=Hh.schema.mmCIF(r)),{kind:"mmCIF",name:i._name,data:{db:i,file:s,frame:r,source:o}}}}(Ui||(Ui={})),function(e){const t="__CcdCoordinateType__";e.CoordinateType={get:i=>i._staticPropertyData[t],set:(i,o)=>i._staticPropertyData[t]=o},e.is=function n(i){return"CCD"===i?.kind},e.fromFrame=function r(i,o){return o||(o=Hh.schema.CCD(i)),{kind:"CCD",name:o._name,data:{db:o,frame:i}}}}(j3||(j3={}));const a_=typeof process<"u"&&null!=process.versions&&null!=process.versions.node,U3=function fze(){return typeof XMLHttpRequest>"u"||a_?ln(684):XMLHttpRequest}(),Vz=function pze(){if(typeof File>"u"||a_){class e{arrayBuffer(){return this.blob.arrayBuffer()}slice(n,r,i){return this.blob.slice(n,r,i)}stream(){return this.blob.stream()}text(){return this.blob.text()}constructor(n,r,i){var o;this.blob=new Blob(n,i),this.size=this.blob.size,this.type=this.blob.type,this.name=r,this.lastModified=null!==(o=i?.lastModified)&&void 0!==o?o:0,this.webkitRelativePath=""}}return e}return File}();function ty(e,t){return e[t]|e[t+1]<<8}function l_(e,t,n){e[t]=255&n,e[t+1]=n>>8&255}function c_(e,t){return 16777216*e[t+3]+(e[t+2]<<16|e[t+1]<<8|e[t])}function ny(e,t,n){e[t]=255&n,e[t+1]=n>>8&255,e[t+2]=n>>16&255,e[t+3]=n>>24&255}function gze(e){return e.length<2?"0"+e:e}function Tae(e){const t=e.length;let n=0;for(let r=0;r>>1:n>>>=1;e[t]=n}return e}();function Dae(e,t,n){return 4294967295^function xze(e,t,n,r){for(let i=0;i>>8;return e}(4294967295,e,t,n)}const Rt=function(){const e=Uint16Array,t=Uint32Array;return{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new t(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new t(286),dhst:new t(30),ihst:new t(19),lits:new t(15e3),strt:new e(65536),prev:new e(32768)}}();function z3(e,t,n){const r=e.length,i=Rt.rev15;for(let o=0;o>1<<4|a,c=t-a;let u=e[o]<>>15-t]=l,u++}}function T1(e,t){const n=e.length,r=Rt.bl_count;for(let s=0;s<=t;s++)r[s]=0;for(let s=1;s>>r}function Sze(e,t){const{data:n,noBuf:r}=e;let{buf:i,BFINAL:o,off:s,pos:a}=e,l=0;for(;0===o&&ly&&(y=w)}a+=3*g,T1(Rt.itree,y),z3(Rt.itree,y,Rt.imap),c=Rt.lmap,u=Rt.dmap,a=wze(Rt.imap,(1<>>4;if(h>>>8){if(256===h)break;{let g=s+h-254;if(h>264){const w=Rt.ldef[h-257];g=s+(w>>>3)+D1(n,a,7&w),a+=7&w}const y=u[Wz(n,a)&f];a+=15&y;const x=Rt.ddef[y>>>4],_=(x>>>4)+qz(n,a,15&x);for(a+=15&x,r&&(i=Gz(i,s+(1<<17)));s>>3),h=n[m-4]|n[m-3]<<8;r&&(i=Gz(i,s+h)),i.set(new Uint8Array(n.buffer,n.byteOffset+m,h),s),a=m+h<<3,s+=h}}e.buf=i,e.BFINAL=o,e.off=s,e.pos=a}function Hz(){return Hz=le(function*(e,t,n){if(3===t[0]&&0===t[1])return n||new Uint8Array(0);const r=function _ze(e,t){const n=void 0===t;return void 0===t&&(t=new Uint8Array(e.length>>>2<<3)),{data:e,buf:t,noBuf:n,BFINAL:0,off:0,pos:0}}(t,n);for(;0===r.BFINAL;)e.shouldUpdate&&(yield e.update({message:"Inflating blocks...",current:r.pos,max:t.length})),Sze(r,100);return r.buf.length===r.off?r.buf:r.buf.slice(0,r.off)}),Hz.apply(this,arguments)}function Gz(e,t){const n=e.length;if(t<=n)return e;const r=new Uint8Array(Math.max(n<<1,t));return r.set(e,0),r}function wze(e,t,n,r,i,o){let s=0;for(;s>>4;if(l<=15)o[s]=l,s++;else{let c=0,u=0;16===l?(u=3+D1(r,i,2),i+=2,c=o[s-1]):17===l?(u=3+D1(r,i,3),i+=3):18===l&&(u=11+D1(r,i,7),i+=7);const d=s+u;for(;s>>1;for(;oi&&(i=a),o++}for(;o>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)}function $z(e,t,n){const r=[],i=e.length,o=t.length;for(let m=0;mn&&(function Aze(e,t,n){let r=0,i=0;const o=1<t;r++){const s=e[r].d;e[r].d=t,i+=o-(1<>>=n-t;i>0;){const s=e[r].d;s=0;r--)e[r].d===t&&i<0&&(e[r].d--,i++);0!==i&&console.log("debt left")}(a,n,p),p=n);for(let m=0;m14e3||u>26697)&&r-s>100&&(l>>16,w=65535&x,A=Fae(_,Rt.of0);Rt.lhst[257+A]++;const M=Fae(w,Rt.df0);Rt.dhst[M]++,f+=Rt.exb[A]+Rt.dxb[M],h[c]=_<<23|s-l,h[c+1]=w<<16|A<<8|M,c+=2,l=s+_}else Rt.lhst[n[s]]++;u++}}e.i=s,e.pos=a,e.cvrd=l,e.li=c,e.lc=u,e.bs=d,e.ebits=f,e.c=p,e.nc=m}!function(){for(let n=0;n<32768;n++){let r=n;r=(2863311530&r)>>>1|(1431655765&r)<<1,r=(3435973836&r)>>>2|(858993459&r)<<2,r=(4042322160&r)>>>4|(252645135&r)<<4,r=(4278255360&r)>>>8|(16711935&r)<<8,Rt.rev15[n]=(r>>>16|r<<16)>>>17}function t(n,r,i){for(;0!=r--;)n.push(0,i)}for(let n=0;n<32;n++)Rt.ldef[n]=Rt.of0[n]<<3|Rt.exb[n],Rt.ddef[n]=Rt.df0[n]<<4|Rt.dxb[n];t(Rt.fltree,144,8),t(Rt.fltree,112,9),t(Rt.fltree,24,7),t(Rt.fltree,8,8),T1(Rt.fltree,9),z3(Rt.fltree,9,Rt.flmap),V3(Rt.fltree,9),t(Rt.fdtree,32,5),T1(Rt.fdtree,5),z3(Rt.fdtree,5,Rt.fdmap),V3(Rt.fdtree,5),t(Rt.itree,19,0),t(Rt.ltree,286,0),t(Rt.dtree,30,0),t(Rt.ttree,320,0)}();const Tze=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]];function Xz(){return Xz=le(function*(e,t,n,r,i){const o=function Ize(e,t,n,r){const{lits:i,strt:o,prev:s}=Rt;return{data:e,out:t,opt:Tze[r],i:0,pos:n<<3,cvrd:0,dlen:e.length,li:0,lc:0,bs:0,ebits:0,c:0,nc:0,lits:i,strt:o,prev:s}}(t,n,r,i),{dlen:s}=o;if(0===i){let{i:m,pos:h}=o;for(;m>>3}for(s>2&&(o.nc=Kz(t,0),o.strt[o.nc]=0);o.i>>3}),Xz.apply(this,arguments)}function Pze(e,t,n,r,i,o){let s=32767&t,a=n[s],l=s-a+32768&32767;if(a===s||r!==Kz(e,t-l))return 0;let c=0,u=0;const d=Math.min(32767,t);for(;l<=d&&0!=--o&&a!==s;){if(0===c||e[t+c]===e[t+c-l]){let f=kze(e,t,l);if(f>c){if(c=f,u=l,c>=i)break;l+2p&&(p=y,a=h)}}}s=a,a=n[s],l+=s-a+32768&32767}return c<<16|u}function kze(e,t,n){if(e[t]!==e[t-n]||e[t+1]!==e[t+1-n]||e[t+2]!==e[t+2-n])return 0;const r=t,i=Math.min(e.length,t+258);for(t+=3;t4&&0===Rt.itree[1+(Rt.ordr[a-1]<<1)];)a--;return[e,t,s,r,o,a,n,i]}(),y=32+(l+3&7?8-(l+3&7):0)+(s<<3),v=r+H3(Rt.fltree,Rt.lhst)+H3(Rt.fdtree,Rt.dhst);let x=r+H3(Rt.ltree,Rt.lhst)+H3(Rt.dtree,Rt.dhst);x+=14+3*m+H3(Rt.itree,Rt.ihst)+(2*Rt.ihst[16]+3*Rt.ihst[17]+7*Rt.ihst[18]);for(let w=0;w<286;w++)Rt.lhst[w]=0;for(let w=0;w<30;w++)Rt.dhst[w]=0;for(let w=0;w<19;w++)Rt.ihst[w]=0;const _=y>>23,F=M+(8388607&D);for(;M>16,j=R>>8&255,W=255&R;u_(a,l=G3(257+j,w,a,l),T-Rt.of0[j]),_5(a,l=G3(W,A,a,l+=Rt.exb[j]),N-Rt.df0[W]),l+=Rt.dxb[W],M+=T}}l=G3(256,w,a,l)}return l}function Mae(e,t,n,r,i){let o=i>>>3;return r[o]=n,r[o+1]=n>>>8,r[o+2]=255-r[o],r[o+3]=255-r[o+1],o+=4,r.set(new Uint8Array(e.buffer,t,n),o),i+(n+4<<3)}function H3(e,t){let n=0;for(let r=0;r15&&(u_(n,r,s),r+=a)}return r}function Nae(e,t){let n=e.length;for(;2!==n&&0===e[n-1];)n-=2;for(let r=0;r>>1,138);c<11?t.push(17,c-3):t.push(18,c-11),r+=2*c-2}else if(i===a&&o===i&&s===i){let l=r+5;for(;l+2>>1,6);t.push(16,c-3),r+=2*c-2}else t.push(i,0)}return n>>>1}function Fae(e,t){let n=0;return t[16|n]<=e&&(n|=16),t[8|n]<=e&&(n|=8),t[4|n]<=e&&(n|=4),t[2|n]<=e&&(n|=2),t[1|n]<=e&&(n|=1),n}function G3(e,t,n,r){return _5(n,r,t[e<<1]),r+t[1+(e<<1)]}function u_(e,t,n){const r=t>>>3;e[r]|=n<<=7&t,e[r+1]|=n>>>8}function _5(e,t,n){const r=t>>>3;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16}function q3(e,t){return Zz.apply(this,arguments)}function Zz(){return Zz=le(function*(e,t,n=!1){const r=Object.create(null),i=new Uint8Array(t);if(19280!==ty(i,0))throw new Error('Invalid ZIP file. A valid ZIP file must start with two magic bytes \\x50\\x4b ("PK" in ASCII).');let o=i.length-4;for(;101010256!==c_(i,o);)o--;let s=o;s+=4,s+=4;const a=ty(i,s);s+=2,s+=2,s+=4;const l=c_(i,s);s+=4,s=l;for(let c=0;c>18,e[t+i+1]=128|s>>12&63,e[t+i+2]=128|s>>6&63,e[t+i+3]=128|63&s,i+=4}else e[t+i]=224|s>>12,e[t+i+1]=128|s>>6&63,e[t+i+2]=128|63&s,i+=3;else e[t+i]=192|s>>6,e[t+i+1]=128|63&s,i+=2;else e[t+i]=s,i++}return i}(e,t,n);return t+=a,0===i&&(e.set(s,t),t+=s.length),t}var mp=function(e){return e[e.None=0]="None",e[e.Gzip=1]="Gzip",e[e.Zip=2]="Zip",e}(mp||{});function ry(e,t){return function l7(e,t){if(a_)return function Vze(e,t){return Ke.create("Read File",function(){var n=le(function*(r){const i="zip"===t?mp.None:jae(e.name);let o;return yield r.update({message:"Opening file...",canAbort:!1}),o="binary"===t||"zip"===t||i!==mp.None?yield e.arrayBuffer():yield e.text(),yield r.update({message:"Processing file...",canAbort:!1}),yield Uae(r,o,t,i)});return function(r){return n.apply(this,arguments)}}())}(e,t);let n;return Ke.create("Read File",function(){var r=le(function*(i){try{n=new FileReader;const o="zip"===t?mp.None:jae(e.name);"binary"===t||"zip"===t||o!==mp.None?n.readAsArrayBuffer(e):n.readAsText(e),yield i.update({message:"Opening file...",canAbort:!0});const s=yield Lae(i,"Reading...",n);return yield i.update({message:"Processing file...",canAbort:!1}),yield Uae(i,s.result,t,o)}finally{n=void 0}});return function(i){return r.apply(this,arguments)}}(),()=>{n&&n.abort()})}(e,t)}function o7(e){return"string"==typeof e?zae(e,e,"string"):zae(e.title,e.url,e.type||"string",e.body,e.headers)}function Bae(e){return e?"Failed to download data. Possible reasons: Resource is not available, or CORS is not allowed on the server.":"Failed to open file."}function Lae(e,t,n){return new Promise((r,i)=>{if(function jze(e){if(!a_&&e instanceof FileReader)return e.readyState===FileReader.DONE;if(e instanceof U3)return e.readyState===U3.DONE;throw new Error("unknown data type")}(n)){const{error:s}=n;return void(null!=s?i(s??Bae(n instanceof U3)):r(n))}let o=!1;n.onerror=s=>{if(o)return;const{error:a}=s.target;i(a??Bae(n instanceof U3))},n.onprogress=s=>{if(e.shouldUpdate&&!o)try{e.update(s.lengthComputable?{message:t,isIndeterminate:!1,current:s.loaded,max:s.total}:{message:`${t} ${(s.loaded/1024/1024).toFixed(2)} MB`,isIndeterminate:!0})}catch(a){o=!0,i(a)}},n.onload=s=>{r(n)}})}function jae(e){return/\.gz$/i.test(e)?mp.Gzip:/\.zip$/i.test(e)?mp.Zip:mp.None}const Uze=/^(__MACOSX|.DS_Store)/;function s7(){return s7=le(function*(e,t,n){switch(n){case mp.None:return t;case mp.Gzip:return function Nze(e,t,n){return t7.apply(this,arguments)}(e,t);case mp.Zip:const r=yield q3(e,t.buffer),i=Object.keys(r).filter(o=>!Uze.test(o));if(1!==i.length)throw new Error("can only decompress zip files with a single entry");return r[i[0]]}}),s7.apply(this,arguments)}function Uae(e,t,n,r){return a7.apply(this,arguments)}function a7(){return a7=le(function*(e,t,n,r){let i=t instanceof ArrayBuffer?new Uint8Array(t):t;if(null===i)throw new Error("no data given");if(r!==mp.None){if(!(i instanceof Uint8Array))throw new Error("need Uint8Array for decompression");const o=yield function zze(e,t,n){return s7.apply(this,arguments)}(e,i,r);"string"===n?(yield e.update({message:"Decoding text..."}),i=mz(o,0,o.length)):i=o}if("binary"===n&&i instanceof Uint8Array)return i;if("zip"===n&&i instanceof Uint8Array)return yield q3(e,i.buffer);if("string"===n&&"string"==typeof i)return i;if("xml"===n&&"string"==typeof i)return(new DOMParser).parseFromString(i,"application/xml");if("json"===n&&"string"==typeof i)return JSON.parse(i);throw new Error(`could not get requested response data '${n}'`)}),a7.apply(this,arguments)}let u7,c7=(()=>{class e{static get(){return this.pool.length?this.pool.pop():new U3}static emptyFunc(){}static deposit(n){this.pool.length=200&&e.status<400){const{response:n}=e;if(c7.deposit(e),("binary"===t||"zip"===t)&&n instanceof ArrayBuffer)return new Uint8Array(n);if("string"===t&&"string"==typeof n)return n;if("xml"===t&&n instanceof XMLDocument)return n;if("json"===t&&"object"==typeof n)return n;throw new Error(`could not get requested response data '${t}'`)}throw c7.deposit(e),new Error(`Download failed with status code ${e.status}`)}(l,n)});return function(a){return s.apply(this,arguments)}}(),()=>{o&&(o.abort(),o=void 0)})}function d7(){return d7=le(function*(e,t,n,r){const i=n.length,o=new Array(n.length);yield e.update({message:"Downloading...",current:0,max:i});let s=[],a=[],l=0;for(let u=Math.min(i,r);l0;){const u=yield Promise.race(s),d=n[u.index],f=a.indexOf(u.index);if(c++,"error"===u.kind&&!d.canFail)throw new Error(`${d.url}: ${u.error}`);if(e.shouldUpdate&&(yield e.update({message:"Downloading...",current:c,max:i})),o[u.index]=u,s=s.filter(Vae,f),a=a.filter(Vae,f),l{u.release(c)}}},e.getUrl=function s(l){return"string"==typeof l?l:l.url},e.getUrlAsset=function a(l,c,u){return"string"==typeof c?l.tryFindUrl(c,u)||t(c,{body:u}):c}}(jr||(jr={}));class Yze{constructor(){this._assets=new Map}get assets(){return FU(this._assets.values())}tryFindUrl(t,n){const r=this.assets.values();for(;;){const i=r.next();if(i.done)return;const o=i.value.asset;if(jr.isUrl(o)&&o.url===t&&(o.body||"")===(n||""))return o}}set(t,n){this._assets.set(t.id,{asset:t,file:n,refCount:0})}get(t){return this._assets.get(t.id)}delete(t){return this._assets.delete(t.id)}has(t){return this._assets.has(t.id)}resolve(t,n,r=!0){var i=this;return jr.isUrl(t)?Ke.create(`Download ${t.title||t.url}`,function(){var o=le(function*(s){if(i._assets.has(t.id)){const c=i._assets.get(t.id);return c.refCount++,jr.Wrapper(yield ry(c.file,n).runInContext(s),t,i)}if(!r)return jr.Wrapper(yield o7({...t,type:n}).runInContext(s),t,i);const a=yield o7({...t,type:"binary"}).runInContext(s),l=new Vz([a],"raw-data");return i._assets.set(t.id,{asset:t,file:l,refCount:1}),jr.Wrapper(yield ry(l,n).runInContext(s),t,i)});return function(s){return o.apply(this,arguments)}}()):Ke.create(`Read ${t.name}`,function(){var o=le(function*(s){if(i._assets.has(t.id)){const a=i._assets.get(t.id);return a.refCount++,jr.Wrapper(yield ry(a.file,n).runInContext(s),t,i)}if(!(t.file instanceof Vz))throw new Error(`Cannot resolve file asset '${t.name}' (${t.id})`);return r&&i._assets.set(t.id,{asset:t,file:t.file,refCount:1}),jr.Wrapper(yield ry(t.file,n).runInContext(s),t,i)});return function(s){return o.apply(this,arguments)}}())}release(t){const n=this._assets.get(t.id);n&&(n.refCount--,n.refCount<=0&&this._assets.delete(t.id))}clear(){this._assets.clear()}dispose(){this.clear()}}!function(e){function t(he,ie){return ie&&(ie.label&&(he.label=ie.label),ie.description&&(he.description=ie.description),ie.legend&&(he.legend=ie.legend),ie.fieldLabels&&(he.fieldLabels=ie.fieldLabels),ie.isHidden&&(he.isHidden=ie.isHidden),ie.shortLabel&&(he.shortLabel=ie.shortLabel),ie.twoColumns&&(he.twoColumns=ie.twoColumns),ie.isEssential&&(he.isEssential=ie.isEssential),ie.category&&(he.category=ie.category),ie.hideIf&&(he.hideIf=ie.hideIf),ie.help&&(he.help=ie.help)),he}function i(he,ie,ue){return t({type:"select",defaultValue:Ae(he,ie),options:ie,cycle:ue?.cycle},ue)}function h(he,ie){return ie&&(typeof ie.min<"u"&&(he.min=ie.min),typeof ie.max<"u"&&(he.max=ie.max),typeof ie.step<"u"&&(he.step=ie.step)),he}function x(he,ie){const ue=t({type:"group",defaultValue:ie?.customDefault||z(he),params:he},ie);return ie?.presets&&(ue.presets=ie.presets),ie?.isExpanded&&(ue.isExpanded=ie.isExpanded),ie?.isFlat&&(ue.isFlat=ie.isFlat),ie?.pivot&&(ue.pivot=ie.pivot),ue}function E(){return z(this.element)}function D(){throw new Error("getValue not set. Fix runtime.")}function z(he){const ie={};for(const ue of Object.keys(he))he[ue].isOptional||(ie[ue]=he[ue].defaultValue);return ie}function $(he,ie,ue){return()=>he(ie,ue)}function V(he,ie,ue){if(ie)if("value-ref"===he.type){ie.getValue=ie.ref?$(he.resolveRef,ie.ref,ue):()=>{throw new Error("Unset ref in ValueRef value.")}}else if("data-ref"===he.type){ie.getValue=ie.ref?$(ue,ie.ref,ue):()=>{throw new Error("Unset ref in ValueRef value.")}}else if("group"===he.type)oe(he.params,ie,ue);else if("mapped"===he.type){const _e=ie;V(he.map(_e.name),_e.params,ue)}else if("object-list"===he.type){if(!H(he.element))return;for(const _e of ie)oe(he.element,_e,ue)}}function X(he){if("value-ref"===he.type||"data-ref"===he.type)return!0;if("group"===he.type){if(H(he.params))return!0}else if("mapped"===he.type){for(const[ie]of he.select.options)if(X(he.map(ie)))return!0}else if("object-list"===he.type)return H(he.element);return!1}function H(he){for(const ie of Object.keys(he))if(X(he[ie]))return!0;return!1}function oe(he,ie,ue){for(const _e of Object.keys(he))V(he[_e],ie?.[_e],ue)}function G(he,ie,ue){if(ie===ue)return!0;if("object"!=typeof ie||"object"!=typeof ue)return!1;for(const _e of Object.keys(he))if(!Z(he[_e],ie[_e],ue[_e]))return!1;return!0}function Z(he,ie,ue){if(ie===ue)return!0;if("group"===he.type)return G(he.params,ie,ue);if("mapped"===he.type){const _e=ie,Fe=ue;return _e.name===Fe.name&&Z(he.map(_e.name),_e.params,Fe.params)}if("multi-select"===he.type){const _e=ie,Fe=ue;if(_e.length!==Fe.length)return!1;if(_e.length<10){for(let Ze=0,ct=_e.length;Ze"u")return ue?he.defaultValue:void 0;if(!xe(he.select,_e.name))return he.defaultValue;const Fe=he.map(_e.name);return{name:_e.name,params:re(Fe,_e.params,ue)}}if("select"===he.type)return xe(he,ie)?ie:he.defaultValue;if("multi-select"===he.type){if(!Array.isArray(ie))return he.defaultValue;const _e=ie.filter(function(Fe){return xe(this,Fe)},he);return ie.length>0&&0===_e.length?he.defaultValue:_e}return"object-list"===he.type?Array.isArray(ie)?ie.map(_e=>ae(he.element,_e,ue?"all":"skip")):he.defaultValue:ie}function ae(he,ie,ue){if("object"!=typeof ie||null===ie)return ue?z(he):ie;const _e=Object.create(null);for(const Fe of Object.keys(he)){const Ze=he[Fe];void 0===ie[Fe]?"all"===ue&&(_e[Fe]=Ze.defaultValue):_e[Fe]=re(Ze,ie[Fe],"skip"!==ue)}return _e}function Ae(he,ie){for(const ue of ie)if(ue[0]===he)return he;return ie.length>0?ie[0][0]:void 0}e.Essential={isEssential:!0},e.Optional=function n(he){const ie={...he};return ie.isOptional=!0,ie},e.Value=function r(he,ie){return t({type:"value",defaultValue:he},ie)},e.Select=i,e.MultiSelect=function o(he,ie,ue){const _e=t({type:"multi-select",defaultValue:he,options:ie},ue);return ue?.emptyValue&&(_e.emptyValue=ue.emptyValue),_e},e.Boolean=function s(he,ie){return t({type:"boolean",defaultValue:he},ie)},e.Text=function a(he="",ie){return t({type:"text",defaultValue:he,multiline:ie?.multiline,placeholder:ie?.placeholder,disableInteractiveUpdates:ie?.disableInteractiveUpdates},ie)},e.Color=function l(he,ie){const ue=t({type:"color",defaultValue:he},ie);return ie?.isExpanded&&(ue.isExpanded=ie.isExpanded),ue},e.ColorList=function c(he,ie){let ue;if("string"==typeof he){const _e=cp(he);ue={kind:"qualitative"!==_e.type?"interpolate":"set",colors:_e.list}}else ue=he;return t({type:"color-list",presetKind:ie?.presetKind||"all",defaultValue:ue,offsets:!!ie?.offsets},ie)},e.Vec3=function u(he,ie,ue){return t(h({type:"vec3",defaultValue:he},ie),ue)},e.Mat4=function d(he,ie){return t({type:"mat4",defaultValue:he},ie)},e.Url=function f(he,ie){return t({type:"url",defaultValue:"string"==typeof he?jr.Url(he):jr.Url(he.url,{body:he.body})},ie)},e.File=function p(he){const ie=t({type:"file",defaultValue:null},he);return he?.accept&&(ie.accept=he.accept),ie},e.FileList=function m(he){const ie=t({type:"file-list",defaultValue:null},he);return he?.accept&&(ie.accept=he.accept),ie},e.Numeric=function g(he,ie,ue){const _e=t(h({type:"number",defaultValue:he},ie),ue);return ue?.immediateUpdate&&(_e.immediateUpdate=!0),_e},e.Interval=function y(he,ie,ue){return t(h({type:"interval",defaultValue:he},ie),ue)},e.LineGraph=function v(he,ie){const ue=t({type:"line-graph",defaultValue:he},ie);return ie?.getVolume&&(ue.getVolume=ie.getVolume),ue},e.Group=x,e.EmptyGroup=function _(he){return x({},he)},e.Mapped=function w(he,ie,ue,_e){const Fe=Ae(he,ie);return t({type:"mapped",defaultValue:{name:Fe,params:ue(Fe).defaultValue},select:i(Fe,ie,_e),map:ue},_e)},e.MappedStatic=function A(he,ie,ue){const _e=ue?.options?ue.options:Object.keys(ie).map(Ze=>[Ze,ie[Ze].label||yf(Ze)]),Fe=Ae(he,_e);return t({type:"mapped",defaultValue:{name:Fe,params:ie[Fe].defaultValue},select:i(Fe,_e,ue),map:Ze=>ie[Ze]},ue)},e.ObjectList=function M(he,ie,ue){return t({type:"object-list",element:he,getLabel:ie,ctor:E,defaultValue:ue?.defaultValue||[]},ue)},e.ValueRef=function T(he,ie,ue){var _e;return t({type:"value-ref",defaultValue:{ref:null!==(_e=ue?.defaultRef)&&void 0!==_e?_e:"",getValue:D},getOptions:he,resolveRef:ie},ue)},e.DataRef=function F(he){var ie;return t({type:"data-ref",defaultValue:{ref:null!==(ie=he?.defaultRef)&&void 0!==ie?ie:"",getValue:D}},he)},e.Converted=function R(he,ie,ue){return t({type:"converted",defaultValue:ie(ue.defaultValue),converted:ue,fromValue:he,toValue:ie},ue)},e.Conditioned=function N(he,ie,ue,_e,Fe){const Ze=Object.keys(ie).map(ct=>[ct,ct]);return t({type:"conditioned",select:i(ue(he),Ze,Fe),defaultValue:he,conditionParams:ie,conditionForValue:ue,conditionedValue:_e},Fe)},e.Script=function j(he,ie){return t({type:"script",defaultValue:he},ie)},e.For=function W(he){return 0},e.getDefaultValues=z,e.resolveRefs=oe,e.setDefaultValues=function te(he,ie){for(const ue of Object.keys(he))he[ue].isOptional||(he[ue].defaultValue=ie[ue])},e.clone=function K(he){return op(he)},e.validate=function Q(he,ie){},e.areEqual=G,e.isParamEqual=Z,e.merge=ee,e.mergeParam=se,e.normalizeParams=ae,e.objectToOptions=function ge(he,ie){const ue=[];for(const _e of Object.keys(he))if(ie){const Fe=ie(_e,he[_e]);ue.push("string"==typeof Fe?[_e,Fe]:[_e,Fe[0],Fe[1]])}else ue.push("string"==typeof he[_e]?[_e,he[_e]]:[_e,null===ie?_e:yf(_e)]);return ue},e.arrayToOptions=function Ie(he,ie){const ue=[];for(const _e of he)ue.push(ie?[_e,ie(_e)]:[_e,null===ie?_e:yf(_e)]);return ue},e.optionLabel=function me(he,ie){for(const ue of he.options)if(ue[0]===ie)return ue[1];return""}}(I||(I={}));const Kze=9,S5=-27.888,Zze=-.5,Gae=-9.9;function Qze(e,t,n,r){const i=C.distance(e,r),o=C.distance(t,r),s=C.distance(t,n),a=C.distance(e,n),u=S5/i-S5/o+(S5/s-S5/a);return u0&&(t.secondStart-e.secondEnd<6&&t.firstStart-e.firstEnd<3||t.secondStart-e.secondEnd<3)}function Wae(e){return ar.is(e,8)||ar.is(e,1)||ar.is(e,16)}const d7e={oldDefinition:I.Boolean(!0,{description:"Whether to use the old DSSP convention for the annotation of turns and helices, causes them to be two residues shorter"}),oldOrdering:I.Boolean(!0,{description:"Alpha-helices are preferred over 3-10 helices"})};function f7e(e,t){return p7.apply(this,arguments)}function p7(){return p7=le(function*(e,t){const n=function u7e(e){const{index:t}=e.model.atomicHierarchy,{proteinElements:n,residueIndex:r}=e,i=n.length,o=new Uint32Array(i),s=new Int32Array(i),a=new Int32Array(i),l=new Int32Array(i),c=new Int32Array(i);for(let u=0;uZze||(f[f.length]=E,p[p.length]=z,m[m.length]=X)}}return function e7e(e,t,n,r){const i=new Cd.DirectedEdgeBuilder(e,t,n),o=new Float32Array(i.slotCount);for(let s=0,a=i.edgeCount;s-1===w?C.setNaN(A):o.position(w,A);let u=C(),d=C(),f=C(),p=C(),m=C(),h=C();const g=C(),y=C(),v=C();if(0===l)return{phi:new Float32Array(0),psi:new Float32Array(0)};const x=new Float32Array(l-1),_=new Float32Array(l-1);c(-1,u),c(-1,d),c(-1,f),c(n[0],p),c(a[i[0]],m),c(r[0],h),c(n[1],g),c(a[i[1]],y),c(r[1],v);for(let w=0;w-1===y?C.setNaN(v):i.position(y,v),u=C(),d=C(),f=C(),p=C(),m=C(),h=C(),g=C();e:for(let y=2;y6.25)continue e}const A=o[s[y]],M=o[s[y+2]];c(o[s[y-2]],u),c(A,d),c(M,f),C.sub(h,u,d),C.sub(g,d,f);const E=pf(C.angle(h,g));E&&E>70&&(n[y]|=32)}}(p),function s7e(e){const{proteinInfo:t,hbonds:n,flags:r,bridges:i}=e,{offset:o,b:s}=n;let a,l;for(let c=0,u=t.residueIndices.length;cp||(a=c+1,l=p,a!==l&&-1!==n.getDirectedEdgeIndex(l,a+1)&&(r[a]|=2,r[l]|=2,i[i.length]=new C5(a,l,0)),a=c,l=p-1,a!==l&&-1!==n.getDirectedEdgeIndex(l-1,a)&&(r[a]|=2,r[l]|=2,i[i.length]=new C5(l,a,0)),a=c,l=p,a!==l&&-1!==n.getDirectedEdgeIndex(l,a)&&(r[a]|=2,r[l]|=2,i[i.length]=new C5(l,a,1)),a=c+1,l=p-1,a!==l&&-1!==n.getDirectedEdgeIndex(l-1,a+1)&&(r[a]|=2,r[l]|=2,i[i.length]=new C5(l,a,1)))}i.sort((c,u)=>c.partner1>u.partner1?1:c.partner1rt.indexOf(r,x))}),p7.apply(this,arguments)}function p7e(e,t,n){return"helix"===e?{kind:"helix",flags:n(t)}:"sheet"===e?{kind:"sheet",flags:n(t)}:"turn"===e||"bend"===e?{kind:"turn",flags:n(t)}:{kind:"none"}}function h7e(e){return e===pi.SecondaryStructureDssp.H||e===pi.SecondaryStructureDssp.G||e===pi.SecondaryStructureDssp.I?"helix":e===pi.SecondaryStructureDssp.B||e===pi.SecondaryStructureDssp.E?"sheet":e===pi.SecondaryStructureDssp.T?"turn":e===pi.SecondaryStructureDssp.S?"bend":"none"}function m7e(e){return ar.is(e,1)?pi.SecondaryStructureDssp.H:ar.is(e,4)?pi.SecondaryStructureDssp.E:ar.is(e,2)?pi.SecondaryStructureDssp.B:ar.is(e,8)?pi.SecondaryStructureDssp.G:ar.is(e,16)?pi.SecondaryStructureDssp.I:ar.is(e,64)?pi.SecondaryStructureDssp.T:ar.is(e,32)?pi.SecondaryStructureDssp.S:0}function g7e(e){return ar.is(e,1)?"H":ar.is(e,4)?"E":ar.is(e,2)?"B":ar.is(e,8)?"G":ar.is(e,16)?"I":ar.is(e,64)?"T":ar.is(e,32)?"S":"-"}function y7e(e){return ar.is(e,16)?pi.SecondaryStructureDssp.I:ar.is(e,1)?pi.SecondaryStructureDssp.H:ar.is(e,4)?pi.SecondaryStructureDssp.E:ar.is(e,2)?pi.SecondaryStructureDssp.B:ar.is(e,8)?pi.SecondaryStructureDssp.G:ar.is(e,64)?pi.SecondaryStructureDssp.T:ar.is(e,32)?pi.SecondaryStructureDssp.S:0}function b7e(e){return ar.is(e,16)?"I":ar.is(e,1)?"H":ar.is(e,4)?"E":ar.is(e,2)?"B":ar.is(e,8)?"G":ar.is(e,64)?"T":ar.is(e,32)?"S":"-"}var iy;function $ae(e){let t="model";if(e){t="dssp";for(let n=0,r=e.models.length;n(i in l[o]||(l[o][i]={props:{...I.getDefaultValues(r.getParams(l))},data:f1.create(void 0)}),l[o][i]),a=(l,c,u)=>{const d=s(l);l[o][i]={props:c,data:f1.withValue(d.data,u)}};return{label:r.label,descriptor:r.descriptor,isHidden:r.isHidden,getParams:l=>{const c=I.clone(r.getParams(l));return I.setDefaultValues(c,s(l).props),c},defaultParams:r.defaultParams,isApplicable:r.isApplicable,attach:(l=le(function*(c,u,d={},f){f&&u.customPropertyDescriptors.reference(r.descriptor,!0),"root"===r.type&&(u=u.root);const p=s(u.root).props,m=s(u),h=I.merge(r.defaultParams,p,d);if(m.data.value&&I.areEqual(r.defaultParams,m.props,h))return;const{value:g,assets:y}=yield r.obtain(c,u,h);u.customPropertyDescriptors.add(r.descriptor),u.customPropertyDescriptors.assets(r.descriptor,y),a(u,h,g)}),function(u,d){return l.apply(this,arguments)}),ref:(l,c)=>l.customPropertyDescriptors.reference(r.descriptor,c),get:l=>s(l).data,set:(l,c={},u)=>{"root"===r.type&&(l=l.root);const d=s(l),f=I.merge(r.defaultParams,d.props,c);I.areEqual(r.defaultParams,d.props,f)||(a(l,f,u),l.customPropertyDescriptors.assets(r.descriptor))},props:l=>s(l).props};var l}e.createProvider=t,e.createSimple=function n(r,i,o){const s={value:I.Value(o,{isHidden:!0})};return t({label:yf(r),descriptor:hf({name:r}),isHidden:!0,type:i,defaultParams:s,getParams:()=>({value:I.Value(o,{isHidden:!0})}),isApplicable:()=>!0,obtain:(a=le(function*(l,c,u){return{...I.getDefaultValues(s),...u}}),function(c,u,d){return a.apply(this,arguments)})});var a}}(iy||(iy={}));const Yae=$ae(),gp=iy.createProvider({label:"Secondary Structure",descriptor:hf({name:"molstar_computed_secondary_structure"}),type:"root",defaultParams:Yae,getParams:$ae,isApplicable:e=>!0,obtain:function(){var e=le(function*(t,n,r){const i={...I.getDefaultValues(Yae),...r};switch(i.type.name){case"dssp":return{value:yield x7e(n,i.type.params)};case"model":return{value:yield _7e(n)}}});return function(n,r,i){return e.apply(this,arguments)}}()});function x7e(e,t){return h7.apply(this,arguments)}function h7(){return h7=le(function*(e,t){const n=new Map;for(let r=0,i=e.unitSymmetryGroups.length;re.element,x:e=>e.unit.conformation.x(e.element),y:e=>e.unit.conformation.y(e.element),z:e=>e.unit.conformation.z(e.element),id:e=>ze.isAtomic(e.unit)?e.unit.model.atomicConformation.atomId.value(e.element):ds(),occupancy:e=>ze.isAtomic(e.unit)?e.unit.model.atomicConformation.occupancy.value(e.element):ds(),B_iso_or_equiv:e=>ze.isAtomic(e.unit)?e.unit.model.atomicConformation.B_iso_or_equiv.value(e.element):ds(),sourceIndex:e=>ze.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atomSourceIndex.value(e.element):e.element,type_symbol:e=>ze.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.type_symbol.value(e.element):ds(),label_atom_id:e=>ze.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.label_atom_id.value(e.element):ds(),auth_atom_id:e=>ze.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.auth_atom_id.value(e.element):ds(),label_alt_id:e=>ze.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.label_alt_id.value(e.element):ds(),label_comp_id:w5,auth_comp_id:e=>ze.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.auth_comp_id.value(e.element):ds(),pdbx_formal_charge:e=>ze.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.pdbx_formal_charge.value(e.element):ds(),vdw_radius:e=>ze.isAtomic(e.unit)?B3(e.unit.model.atomicHierarchy.atoms.type_symbol.value(e.element)):ds()};function w5(e){return ze.isAtomic(e.unit)||ds(),e.unit.model.atomicHierarchy.atoms.label_comp_id.value(e.element)}function g7(e){return ze.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.label_seq_id.value(e.unit.residueIndex[e.element]):ds()}function Xae(e){ze.isAtomic(e.unit)||ds();const t=e.unit.model.sequence.byEntityKey[Bu(e)];return t&&t.sequence.microHet.get(g7(e))||[w5(e)]}const w7e={key:e=>ze.isAtomic(e.unit)?e.unit.residueIndex[e.element]:ds(),group_PDB:e=>ze.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.group_PDB.value(e.unit.residueIndex[e.element]):ds(),label_seq_id:g7,auth_seq_id:e=>ze.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.auth_seq_id.value(e.unit.residueIndex[e.element]):ds(),pdbx_PDB_ins_code:e=>ze.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.pdbx_PDB_ins_code.value(e.unit.residueIndex[e.element]):ds(),isNonStandard:e=>ze.isAtomic(e.unit)?Xae(e).some(t=>"n"===e.unit.model.properties.chemicalComponentMap.get(t).mon_nstd_flag[0]):ds(),hasMicroheterogeneity:function C7e(e){ze.isAtomic(e.unit)||ds();const t=e.unit.model.sequence.byEntityKey[Bu(e)];return t&&t.sequence.microHet.has(g7(e))},microheterogeneityCompIds:Xae,secondary_structure_type:e=>{var t;ze.isAtomic(e.unit)||ds();const n=null===(t=gp.get(e.structure).value)||void 0===t?void 0:t.get(e.unit.invariantId);return n?n.type[n.getIndex(e.unit.residueIndex[e.element])]:536870912},secondary_structure_key:e=>{var t;ze.isAtomic(e.unit)||ds();const n=null===(t=gp.get(e.structure).value)||void 0===t?void 0:t.get(e.unit.invariantId);return n?n.key[n.getIndex(e.unit.residueIndex[e.element])]:-1},chem_comp_type:e=>ze.isAtomic(e.unit)?e.unit.model.properties.chemicalComponentMap.get(w5(e)).type:ds()},A7e={key:e=>ze.isAtomic(e.unit)?e.unit.chainIndex[e.element]:ds(),label_asym_id:e=>ze.isAtomic(e.unit)?e.unit.model.atomicHierarchy.chains.label_asym_id.value(e.unit.chainIndex[e.element]):ds(),auth_asym_id:e=>ze.isAtomic(e.unit)?e.unit.model.atomicHierarchy.chains.auth_asym_id.value(e.unit.chainIndex[e.element]):ds(),label_entity_id:e=>ze.isAtomic(e.unit)?e.unit.model.atomicHierarchy.chains.label_entity_id.value(e.unit.chainIndex[e.element]):ds()},I7e={key:W3.key,entityKey:e=>ze.isCoarse(e.unit)?e.unit.coarseElements.entityKey[e.element]:oy(),x:W3.x,y:W3.y,z:W3.z,asym_id:e=>ze.isCoarse(e.unit)?e.unit.coarseElements.asym_id.value(e.element):oy(),entity_id:e=>ze.isCoarse(e.unit)?e.unit.coarseElements.entity_id.value(e.element):oy(),seq_id_begin:e=>ze.isCoarse(e.unit)?e.unit.coarseElements.seq_id_begin.value(e.element):oy(),seq_id_end:e=>ze.isCoarse(e.unit)?e.unit.coarseElements.seq_id_end.value(e.element):oy(),sphere_radius:e=>ze.isSpheres(e.unit)?e.unit.coarseConformation.radius[e.element]:oy("spheres"),sphere_rmsf:e=>ze.isSpheres(e.unit)?e.unit.coarseConformation.rmsf[e.element]:oy("spheres"),gaussian_weight:e=>ze.isGaussians(e.unit)?e.unit.coarseConformation.weight[e.element]:oy("gaussians"),gaussian_covariance_matrix:e=>ze.isGaussians(e.unit)?e.unit.coarseConformation.covariance_matrix[e.element]:oy("gaussians")};function Bu(e){switch(e.unit.kind){case 0:return e.unit.model.atomicHierarchy.index.getEntityFromChain(e.unit.chainIndex[e.element]);case 1:return e.unit.model.coarseHierarchy.spheres.entityKey[e.element];case 2:return e.unit.model.coarseHierarchy.gaussians.entityKey[e.element]}}const E7e={key:Bu,id:e=>e.unit.model.entities.data.id.value(Bu(e)),type:e=>e.unit.model.entities.data.type.value(Bu(e)),src_method:e=>e.unit.model.entities.data.src_method.value(Bu(e)),pdbx_description:e=>e.unit.model.entities.data.pdbx_description.value(Bu(e)),formula_weight:e=>e.unit.model.entities.data.formula_weight.value(Bu(e)),pdbx_number_of_molecules:e=>e.unit.model.entities.data.pdbx_number_of_molecules.value(Bu(e)),details:e=>e.unit.model.entities.data.details.value(Bu(e)),pdbx_mutation:e=>e.unit.model.entities.data.pdbx_mutation.value(Bu(e)),pdbx_fragment:e=>e.unit.model.entities.data.pdbx_fragment.value(Bu(e)),pdbx_ec:e=>e.unit.model.entities.data.pdbx_ec.value(Bu(e)),subtype:e=>e.unit.model.entities.subtype.value(Bu(e)),prd_id:e=>{var t,n;return null!==(n=null===(t=e.unit.model.entities.prd_id)||void 0===t?void 0:t.value(Bu(e)))&&void 0!==n?n:""}},T7e=[],D7e={id:e=>e.unit.id,chainGroupId:e=>e.unit.chainGroupId,multiChain:e=>ze.Traits.is(e.unit.traits,ze.Trait.MultiChain),object_primitive:e=>e.unit.objectPrimitive,operator_name:e=>e.unit.conformation.operator.name,operator_key:e=>e.unit.conformation.operator.key,model_index:e=>e.unit.model.modelNum,model_label:e=>e.unit.model.label,model_entry_id:e=>e.unit.model.entryId,hkl:e=>e.unit.conformation.operator.hkl,spgrOp:e=>e.unit.conformation.operator.spgrOp,model_num:e=>e.unit.model.modelNum,pdbx_struct_assembly_id:e=>{var t;return(null===(t=e.unit.conformation.operator.assembly)||void 0===t?void 0:t.id)||ko.DefaultName},pdbx_struct_oper_list_ids:e=>{var t;return(null===(t=e.unit.conformation.operator.assembly)||void 0===t?void 0:t.operList)||T7e},struct_ncs_oper_id:e=>e.unit.conformation.operator.ncsId},Je={constant:{true:e=>!0,false:e=>!1,zero:e=>0},atom:W3,residue:w7e,chain:A7e,entity:E7e,unit:D7e,coarse:I7e};class $3{add(t){let n=this.index.get(t.label_asym_id);n||(n=new Map,this.index.set(t.label_asym_id,n));let r=n.get(t.label_seq_id);return r||(r=[],n.set(t.label_seq_id,r)),!this._find(t,r)&&(r.push(t),!0)}hasLabelAsymId(t){return this.index.has(t)}has(t){var n,r;const i=Kae(t);if(!this.index.has(i))return;const o=this.index.get(i),s=Zae(t);if(!o.has(s))return;const a=o.get(s),l=Qae(t),c=Jae(t),u=ele(t),d=null!==(n=tle(t))&&void 0!==n?n:"1_555";for(const f of a)if(f.label_comp_id===l&&f.label_alt_id===c&&f.ins_code===u&&(!this.checkOperator||(null!==(r=f.operator_name)&&void 0!==r?r:"1_555")===d))return f}static getLabel(t,n=!1){var r;return`${t.label_asym_id} ${t.label_comp_id} ${t.label_seq_id}:${t.ins_code}:${t.label_alt_id}${n?" "+(null!==(r=t.operator_name)&&void 0!==r?r:"1_555"):""}`}static getEntryFromLocation(t){var n;return{label_asym_id:Kae(t),label_comp_id:Qae(t),label_seq_id:Zae(t),label_alt_id:Jae(t),ins_code:ele(t),operator_name:null!==(n=tle(t))&&void 0!==n?n:"1_555"}}_find(t,n){var r,i;for(const o of n)if(o.label_comp_id===t.label_comp_id&&o.label_alt_id===t.label_alt_id&&o.ins_code===t.ins_code&&(!this.checkOperator||(null!==(r=o.operator_name)&&void 0!==r?r:"1_555")===(null!==(i=t.operator_name)&&void 0!==i?i:"1_555")))return!0;return!1}constructor(t){var n;this.index=new Map,this.checkOperator=!1,this.checkOperator=null!==(n=t?.checkOperator)&&void 0!==n&&n}}const Kae=Je.chain.label_asym_id,Zae=Je.residue.label_seq_id,Qae=Je.atom.label_comp_id,Jae=Je.atom.label_alt_id,ele=Je.residue.pdbx_PDB_ins_code,tle=Je.unit.operator_name;function Cw(e,t,n){const r=t.subsetBuilder(!0);for(const i of n.units){if(0!==i.kind){r.setUnit(i.id,i.elements);continue}const{residueAtomSegments:o}=i.model.atomicHierarchy,s=t.unitMap.get(i.id).elements,a=i.elements;r.beginUnit(i.id);const l=En.transientSegments(o,a);for(;l.hasNext;){const c=l.move().index;for(let u=o.offsets[c],d=o.offsets[c+1];u(e.element.structure=n.structure,e.element.unit=n.unit,e.element.element=n.element,t(e))}function M7e(e,t){let n=0;e.element.structure=e.inputStructure;for(const r of e.inputStructure.units){e.element.unit=r;const i=r.elements;for(let o=0,s=i.length;on&&(n=l)}}return e.throwIfTimedOut(),n}function R7e(e,t){return function(r){const i=e(r);if(t.elementRadius){const o={...t,elementRadius:t.elementRadius,elementRadiusClosure:k7e(r,t.elementRadius),sourceMaxRadius:M7e(r,t.elementRadius)};if(Dt.isSingleton(i)){const s=nle(r,r.inputStructure,i.structure,o);return Dt.Singletons(r.inputStructure,s)}{const s=new wz(r.inputStructure);for(const a of i.structures)s.add(nle(r,r.inputStructure,a,o));return s.getSelection()}}if(Dt.isSingleton(i)){const o=y7(r,r.inputStructure,i.structure,t);return Dt.Singletons(r.inputStructure,o)}{const o=new wz(r.inputStructure);for(const s of i.structures)o.add(y7(r,r.inputStructure,s,t));return o.getSelection()}}}function N7e(e,t){return function(r){const i=e(r);if(0===Dt.structureCount(i))return i;const o=Dt.UniqueBuilder(r.inputStructure),s=a=>o.add(a);return Dt.forEach(i,(a,l)=>{r.pushInputStructure(a),Dt.forEach(t(r),s),r.popInputStructure(),l%10==0&&r.throwIfTimedOut()}),o.getSelection()}}function F7e(e,t){return function(r){const i=e(r);if(0===Dt.structureCount(i))return i;const o=t(r);if(0===Dt.structureCount(o))return Dt.Empty(r.inputStructure);const s=Dt.unionStructure(o),a=Dt.UniqueBuilder(r.inputStructure);return Dt.forEach(i,(l,c)=>{const u=sae(s,l);0!==u.elementCount&&a.add(u),c%50==0&&r.throwIfTimedOut()}),a.getSelection()}}function O7e(e,t){return function(r){const i=e(r);if(0===Dt.structureCount(i))return i;const o=t(r);if(0===Dt.structureCount(o))return i;const s=Dt.unionStructure(o),a=Dt.UniqueBuilder(r.inputStructure);return Dt.forEach(i,(l,c)=>{const u=_z(l,s);0!==u.elementCount&&a.add(u),c%50==0&&r.throwIfTimedOut()}),a.getSelection()}}function B7e(e){return function(n){const r=Dt.LinearBuilder(n.inputStructure);return r.add(Dt.unionStructure(e(n))),r.getSelection()}}function L7e(e,t){return function(r){const i=e(r),o=new Map,s=[];r.pushCurrentElement(),Dt.forEach(i,(l,c)=>{r.element.structure=l;for(const u of l.units){r.element.unit=u;const d=u.elements;for(let f=0,p=d.length;f{let f=u;if(i)for(;;){const p=f.elementCount;if(f=rle(a,n,f),f.elementCount===p)break}else for(let p=0;p=0)f.addElementRange(h,v.start,v.end);else if(d.hasLabelAsymId(x))for(y.setSegment(v);y.hasNext;){const w=y.move();c.element=h[w.start],d.has(c)&&f.addElementRange(h,w.start,w.end)}}f.commitUnit(),i.throwIfTimedOut()}const p=R3(i.inputStructure,[f.getStructure(),o]);if(n){const m=new f5(i.inputStructure),h=i.inputStructure.lookup3d;for(const g of p.units){const y=g.conformation,v=g.elements;for(let x=0,_=v.length;x<_;x++){const w=v[x];h.findIntoBuilderIf(y.x(w),y.y(w),y.z(w),t,m,H7e),m.addToUnit(g.id,w)}i.throwIfTimedOut()}return Dt.Sequence(i.inputStructure,[m.getStructure()])}return Dt.Sequence(i.inputStructure,[p])}}const V7e=Je.entity.type;function H7e(e){return"water"===V7e(e)}class W7e{constructor(){this.vertices=new Map,this.edges=new Map}addVertex(t,n){this.vertices.has(n)||(this.vertices.set(n,t),this.edges.set(n,[]))}addEdge(t,n){const r=$3.getLabel(t),i=$3.getLabel(n);this.addVertex(t,r),this.addVertex(n,i),Us(this.edges.get(r),i),Us(this.edges.get(i),r)}addComponent(t,n){const r=$3.getLabel(t);if(!this.vertices.has(r))return void n.add(t);const i=new Set,o=new Set,s=[r];for(o.add(r),n.add(t);s.length>0;){const a=s.pop();i.add(a);const l=this.vertices.get(a);for(const c of this.edges.get(a)){if(i.has(c)||(s.push(c),o.has(c)))continue;o.add(c);const u=this.vertices.get(c);n.add(l.operator_name===u.operator_name?{...u,operator_name:t.operator_name}:u)}}}}var A5,I5,b7;function X7e(e,t){return n=>{const r=e(n),i=Dt.LinearBuilder(n.inputStructure);return n.pushCurrentElement(),Dt.forEach(r,(o,s)=>{n.currentStructure=o,t(n)&&i.add(o),s%100&&n.throwIfTimedOut()}),n.popCurrentStructure(),i.getSelection()}}function K7e(e){return t=>{const n=e(t),r=Dt.LinearBuilder(t.inputStructure);if("singletons"===n.kind){if(n.structure.elementCount>0){const i=n.structure.units[0],o=Xe.create([i.getChild(rt.ofSingleton(i.elements[0]))],{parent:t.inputStructure});r.add(o)}}else n.structures.length>0&&r.add(n.structures[0]);return r.getSelection()}}function E5(e,t,n){const{units:r}=e.currentStructure,i=e.pushCurrentElement();i.structure=e.currentStructure;for(const o of r){i.unit=o;const s=o.elements,a=t;if(a){for(let l=0,c=s.length;l{const i=e(r),o=function Z7e(e,t,n){const r=new Set,i=t(e);return e.pushCurrentElement(),Dt.forEach(i,(o,s)=>{e.currentStructure=o,E5(e,n,r),s%10&&e.throwIfTimedOut()}),e.popCurrentElement(),r}(r,t,n),s=Dt.LinearBuilder(r.inputStructure);return r.pushCurrentStructure(),Dt.forEach(i,(a,l)=>{r.currentStructure=a;const c=E5(r,n,new Set);Lo.isSuperset(o,c)&&s.add(a),l%10&&r.throwIfTimedOut()}),r.popCurrentStructure(),s.getSelection()}}function J7e(e,t){return n=>{const r=Dt.unionStructure(t(n)),i=Dt.LinearBuilder(n.inputStructure);return Dt.forEach(e(n),(o,s)=>{d5(r,o)&&i.add(o),s%10&&n.throwIfTimedOut()}),i.getSelection()}}function eVe(e){return t=>{const n={queryCtx:t,selection:e.query(t),target:e.target(t),maxRadius:e.maxRadius,minRadius:e.minRadius?Math.max(0,e.minRadius):0,elementRadius:e.elementRadius,invert:!!e.invert};return 0===n.minRadius&&typeof e.minRadius>"u"?function tVe({queryCtx:e,selection:t,target:n,maxRadius:r,invert:i}){const o=Dt.unionStructure(n).lookup3d,s=Dt.LinearBuilder(e.inputStructure),a=C.zero();return Dt.forEach(t,(l,c)=>{const{units:u}=l;let d=!1;for(let f=0,p=u.length;f{let u=function Y7e(e,t,n,r,i){return 0===t.elementCount||0===n.elementCount||(t.elementCount<=n.elementCount?I5.check(e,t,n,r,i):I5.check(e,n,t,r,i))}(e,s,l,r,o);i&&(u=!u),u&&a.add(l),c%10==0&&e.throwIfTimedOut()}),e.popCurrentElement(),a.getSelection()}(n):function rVe({queryCtx:e,selection:t,target:n,minRadius:r,maxRadius:i,invert:o,elementRadius:s}){const a=Dt.unionStructure(n),l=Dt.LinearBuilder(e.inputStructure);return e.pushCurrentElement(),Dt.forEach(t,(c,u)=>{let d=function $7e(e,t,n,r,i,o){return 0===t.elementCount||0===n.elementCount||(t.elementCount<=n.elementCount?A5.check(e,t,n,r,i,o):A5.check(e,n,t,r,i,o))}(e,a,c,r,i,s);o&&(d=!d),d&&l.add(c),u%10==0&&e.throwIfTimedOut()}),e.popCurrentElement(),l.getSelection()}(n)}}function oVe({query:e,target:t,disjunct:n,invert:r,bondTest:i}){return o=>{const s=t(o);if(Dt.isEmpty(s))return s;const a=e(o);if(Dt.isEmpty(a))return a;const l={queryCtx:o,input:o.inputStructure,disjunct:n,target:Dt.unionStructure(s)},c=Dt.LinearBuilder(o.inputStructure);return o.pushCurrentBond(),o.atomicBond.setTestFn(i),Dt.forEach(a,(u,d)=>{(function iVe(e,t){const{queryCtx:n,input:r,target:i,disjunct:o}=e,s=n.atomicBond,a=r.interUnitBonds;s.setStructure(r);for(const l of t.units){if(!ze.isAtomic(l))continue;const c=r.unitMap.get(l.id),{offset:u,b:d,edgeProps:{flags:f,order:p,key:m}}=c.bonds,h=a.getConnectedUnits(l.id),g=h.length,y=l.elements,v=c.elements;for(let x=0,_=y.length;x<_;x++){const w=rt.indexOf(v,y[x]);s.a.unit=c,s.b.unit=c;for(let A=u[w],M=u[w+1];A{const n=Dt.UniqueBuilder(t.inputStructure);for(let r=0;r{n.add(i),r%100&&t.throwIfTimedOut()});return n.getSelection()}}function aVe(e){return 0===e.length?Az:1===e.length?e[0]:t=>{const n=[];for(let a=0;aa.hashCode,Xe.areUnitIdsAndIndicesEqual);Dt.forEach(n[r],a=>o.add(a));const s=Dt.UniqueBuilder(t.inputStructure);for(let a=0;a{o.has(l)&&s.add(l)}),t.throwIfTimedOut());return s.getSelection()}}function lVe(e){return e.currentStructure.elementCount}function cVe(e){return t=>{const n=e(t);return Dt.structureCount(n)}}function uVe(e){return t=>E5(t,e,new Set)}!function(e){const t=C();function n(s,a,l,c,u,d,f){const{elements:p,conformation:m}=a,h=t;s.element.unit=a;let g=!1;for(let y=0,v=p.length;yf(m)===p},e.lt=function r(f,p){return m=>f(m)f(m)<=p},e.gt=function o(f,p){return m=>f(m)>p},e.gte=function s(f,p){return m=>f(m)>=p},e.inSet=function c(f,p){if(function t(f){return!!f&&!!f.has}(p))return m=>p.has(f(m));{if(0===p.length)return l;const m=new Set;for(let h=0;hm.has(f(h))}},e.and=function u(...f){switch(f.length){case 0:return a;case 1:return f[0];case 2:{const p=f[0],m=f[1];return h=>p(h)&&m(h)}case 3:{const p=f[0],m=f[1],h=f[2];return g=>p(g)&&m(g)&&h(g)}case 4:{const p=f[0],m=f[1],h=f[2],g=f[3];return y=>p(y)&&m(y)&&h(y)&&g(y)}case 5:{const p=f[0],m=f[1],h=f[2],g=f[3],y=f[4];return v=>p(v)&&m(v)&&h(v)&&g(v)&&y(v)}case 6:{const p=f[0],m=f[1],h=f[2],g=f[3],y=f[4],v=f[5];return x=>p(x)&&m(x)&&h(x)&&g(x)&&y(x)&&v(x)}default:{const p=f.length;return m=>{for(let h=0;hp(h)||m(h)}case 3:{const p=f[0],m=f[1],h=f[2];return g=>p(g)||m(g)||h(g)}case 4:{const p=f[0],m=f[1],h=f[2],g=f[3];return y=>p(y)||m(y)||h(y)||g(y)}case 5:{const p=f[0],m=f[1],h=f[2],g=f[3],y=f[4];return v=>p(v)||m(v)||h(v)||g(v)||y(v)}case 6:{const p=f[0],m=f[1],h=f[2],g=f[3],y=f[4],v=f[5];return x=>p(x)||m(x)||h(x)||g(x)||y(x)||v(x)}default:{const p=f.length;return m=>{for(let h=0;hJe.unit.operator_name(t.element),ko.DefaultName),_i.pred.inSet(t=>Je.chain.label_asym_id(t.element),e))})}function ile(e,t,n,r,i,o){const{spacegroup:s,ncsOperators:a}=e,l=[],{toFractional:c}=s.cell,u=C.transformMat4(C(),o,c),d=wd.getSymmetryOperatorRef(s,t,n,r,i,u);if(a&&a.length)for(let f=0,p=a.length;f=0&&t[1]<=0&&n[1]>=0&&t[2]<=0&&n[2]>=0&&(a[0]=wd.getSymmetryOperator(i,0,0,0,0));for(let l=0;lfunction mVe(e,t,n){return _7.apply(this,arguments)}(f,u,d))},e.buildSymmetryRange=function i(u,d,f){return Ke.create("Build Symmetry",p=>function hVe(e,t,n,r){return x7.apply(this,arguments)}(p,u,d,f))},e.buildNcs=function o(u){return Ke.create("Build NCS",d=>function pVe(e,t){return v7.apply(this,arguments)}(d,u))},e.areUnitsEquivalent=s,e.UnitEquivalenceBuilder=a,e.computeTransformGroups=function l(u){const d=a();for(const p of u.units)d.add(p.id,p);const f=[];for(const p of d.groups)f.push(ze.SymmetryGroup(p.map(m=>u.unitMap.get(m))));return f},e.areTransformGroupsEquivalent=function c(u,d){if(u.length!==d.length)return!1;for(let f=0,p=u.length;f0?[]:this.currentUnit}addElement(t){this.currentUnit[this.currentUnit.length]=t,this.elementCount++}addElementRange(t,n,r){for(let i=n;i1&&ip(l);let d=a.getChild(rt.ofSortedArray(l));const f=r.add(d.id,d);d!==f&&(d=f.applyOperator(d.id,d.conformation.operator,!0)),n[n.length]=d}return Xe.create(n,{parent:this.parent})}getStructure(){return this._getStructure(!1)}getStructureDeduplicate(){return this._getStructure(!0)}setSingletonLocation(t){const n=this.ids[0];t.unit=this.parent.unitMap.get(n),t.element=this.unitMap.get(n)[0]}get isEmpty(){return 0===this.elementCount}constructor(t,n){this.parent=t,this.isSorted=n,this.ids=[],this.unitMap=sp.Mutable(),this.parentId=-1,this.currentUnit=[],this.elementCount=0}}function ale(e,t){let n=1;for(;t--;)n*=e--;return n}class vVe{move(){if(this.hasNext){let t=0,n=0,r=this.index;for(;r;r>>>=1,t++)1&r&&(this.value[n++]=this.array[t]);this.index=function bVe(e){const t=e&-e,n=e+t;return n|((n&-n)/t>>1)-1}(this.index),this.hasNext=this.indexe?0:ale(e,t)/ale(t,t)}(t.length,n),this.maxIndex=1<0&&n<=t.length}}function lle(e,t){const n=[],r=new vVe(e,t);for(;r.hasNext;)n.push(r.move().slice());return n}const d_=[],xVe={links:d_,terminalLinks:d_,elements:d_,partialElements:d_,getElementIndices:()=>d_,getLinkIndices:()=>d_,getTerminalLinkIndices:()=>d_},ul=Jx("C"),Y3=Jx("O"),_Ve=[fp.elementFingerprint([ul,ul,ul,Y3]),fp.elementFingerprint([ul,ul,ul,ul,Y3]),fp.elementFingerprint([ul,ul,ul,ul,ul,Y3]),fp.elementFingerprint([ul,ul,ul,ul,ul,ul,Y3])];function SVe(e,t){let n=-1,r=-1,i=-1,o=-1;const{elements:s}=e,{type_symbol:a,label_atom_id:l}=e.model.atomicHierarchy.atoms,{b:c,offset:u}=e.bonds;for(let d=0,f=t.length;d0}get customPropertyDescriptors(){return this.state.customProps||(this.state.customProps=new Oh),this.state.customProps}get currentPropertyData(){return this.state.propertyData||(this.state.propertyData=Object.create(null)),this.state.propertyData}get inheritedPropertyData(){return this.parent?this.parent.currentPropertyData:this.currentPropertyData}get polymerResidueCount(){return-1===this.state.polymerResidueCount&&(this.state.polymerResidueCount=function UVe(e){const{units:t}=e;let n=0;for(let r=0,i=t.length;r0&&(n+=1);return n}(this)),this.state.polymerUnitCount}get uniqueElementCount(){return-1===this.state.uniqueElementCount&&(this.state.uniqueElementCount=function jVe(e){const{unitSymmetryGroups:t}=e;let n=0;for(let r=0,i=t.length;rSn.isCoarseGrained(t))}get isEmpty(){return 0===this.units.length}get hashCode(){return-1!==this.state.hashCode?this.state.hashCode:this.computeHash()}get transformHash(){return-1!==this.state.transformHash||(this.state.transformHash=Zc(this.units.map(t=>t.id))),this.state.transformHash}computeHash(){let t=23;for(let n=0,r=this.units.length;n500?DVe:PVe}(t.length);n.reset();for(let r=0,i=t.length;rf+p.properties.saccharideComponentMap.size,0))return xVe;const t=[],n=[],r=[],i=[],o=new Map;function s(f,p,m){return`${f}|${p}|${m}`}function a(f,p){o.has(f)?o.get(f).push(p):o.set(f,[p])}function l(f,p){C.sub(r[f].geometry.direction,r[p].geometry.center,r[f].geometry.center),C.normalize(r[f].geometry.direction,r[f].geometry.direction)}const c=C();function u(f,p,m){const g=r[f].geometry;C.sub(g.direction,m.conformation.position(m.elements[p],c),g.center),C.normalize(g.direction,g.direction)}for(let f=0,p=e.units.length;f{h.connectedIndices.forEach(g=>{h.getEdges(g).forEach(({props:y,indexB:v})=>{if(!Lr.isCovalent(y.flag))return;const x=e.unitMap.get(h.unitA),_=e.unitMap.get(h.unitB),w=d(x,g),A=d(_,v);if(w.length>0&&A.length>0){const M=w.length,E=A.length;for(let D=0,T=Math.max(M,E);Di[r.get(a.id)]+Ve.indexOf(a.elements,l)}}(this))}get model(){if(this.state.model)return this.state.model;if(this.state.representativeModel)return this.state.representativeModel;if(this.state.masterModel)return this.state.masterModel;const t=this.models;if(t.length>1)throw new Error("The structure is based on multiple models and has neither a master- nor a representative-model.");return this.state.model=t[0],this.state.model}get masterModel(){return this.state.masterModel}get representativeModel(){return this.state.representativeModel}hasElement(t){return!!this.unitMap.has(t.unit.id)&&rt.has(this.unitMap.get(t.unit.id).elements,t.element)}getModelIndex(t){return this.models.indexOf(t)}remapModel(t){const{dynamicBonds:n,interUnitBonds:r,parent:i}=this.state,o=[];for(const s of this.unitSymmetryGroups){const a=s.units[0].remapModel(t,n);o.push(a);for(let l=1,c=s.units.length;l0?re[0].id:0;for(let ue=0,_e=re.length;ue<_e;ue++){const Fe=re[ue];ge.set(Fe.id,Fe),me+=Fe.elements.length,Fe.id2e5||p(re,ue)?g(re,q,he,ct,_e):he.addUnit(0,re,_e,q,ct?ze.Trait.MultiChain:ze.Trait.None):he.addUnit(0,re,_e,q,ct?ze.Trait.MultiChain:ze.Trait.None)}const ie=re.coarseHierarchy;return ie.isDefined&&(ie.spheres.count>0&&y(he,re,re.coarseHierarchy.spheres,1),ie.gaussians.count>0&&y(he,re,re.coarseHierarchy.gaussians,2)),he.getStructure()}function p(re,ae){const ge=re.atomicHierarchy.index.getEntityFromChain(ae);return"water"===re.entities.data.type.value(ge)}function m(re,ae){const ge=re.atomicHierarchy.index.getEntityFromChain(ae);return"polymer"===re.entities.data.type.value(ge)}function h(re,ae,ge,Ie,me){const{x:Ae,y:he,z:ie}=re.atomicConformation,ue={x:Ae,y:he,z:ie,indices:ae},_e=zh(ue,Q0(ue),8192),{offset:Fe,count:Ze,array:ct}=_e.buckets,q=(Ie?ze.Trait.MultiChain:ze.Trait.None)|(Fe.length>1?ze.Trait.Partitioned:ze.Trait.None);ge.beginChainGroup();for(let ne=0,be=Fe.length;ne1?ze.Trait.Partitioned:ze.Trait.None);ge.beginChainGroup();for(let nt=0,ht=Ce.length;ntze.conformationId(ae)).join("|"))},e.areUnitIdsEqual=M,e.areUnitIdsAndIndicesEqual=function E(re,ae){if(re===ae)return!0;if(!M(re,ae))return!1;for(let ge=0,Ie=re.units.length;ge=this.structure.units.length?this.hasNext=!1:(this.current.unit=this.structure.units[this.unitIndex],this.elements=this.current.unit.elements,this.maxIdx=this.elements.length-1,0===this.maxIdx&&(this.hasNext=this.unitIndex+10,this.hasNext&&(this.elements=ae.units[0].elements,this.maxIdx=this.elements.length-1,this.current.unit=ae.units[0])}};const j=C();function W(re,ae,ge){const{elements:Ie,conformation:me}=re,Ae=j;let he=Number.MAX_VALUE;for(let ie=0,ue=Ie.length;ieae.units[0].polymerElements.length>0)}let Z;var re;e.distance=function V(re,ae){if(0===re.elementCount||0===ae.elementCount)return 0;const{units:ge}=re;let Ie=Number.MAX_VALUE;for(let me=0,Ae=ge.length;meme(ue)))return;const he=re.lookup3d,ie=C();for(const ue of re.units){if(!me(ue))continue;const _e=ue.boundary.sphere;C.transformMat4(ie,_e.center,ue.conformation.operator.matrix);const Fe=he.findUnitIndices(ie[0],ie[1],ie[2],_e.radius+Ie);for(let Ze=0;Ze=ct.id||!me(ct)||!Ae(ue,ct)||(ct.elements.length>=ue.elements.length?ae(ue,ct):ae(ct,ue))}}},e.eachAtomicHierarchyElement=function te(re,{chain:ae,residue:ge,atom:Ie}){const me=dt.create(re);for(const Ae of re.units){if(0!==Ae.kind)continue;me.unit=Ae;const{elements:he}=Ae,ie=En.transientSegments(Ae.model.atomicHierarchy.chainAtomSegments,he),ue=En.transientSegments(Ae.model.atomicHierarchy.residueAtomSegments,he);for(;ie.hasNext;){const _e=ie.move();if(ae&&(me.element=he[_e.start],ae(me)),ge||Ie)for(ue.setSegment(_e);ue.hasNext;){const Fe=ue.move();if(ge&&(me.element=he[Fe.start],ge(me)),Ie)for(let Ze=Fe.start,ct=Fe.end;Ze=Ie.largeResidueCount*ge?function G(re,ae){const ge=K(re);return ge.length>=1&&ge[0].units.length>ae.highSymmetryUnitCount}(re,Ie)?Z.Huge:Z.Gigantic:function Q(re,ae){const ge=K(re);return 1===ge.length&&ge[0].units.length>2&&ge[0].units[0].polymerElements.length0)return!1;return!0}function o(se){let xe=0;for(const{indices:re}of se.elements)xe+="number"==typeof re?qVe(re):re.length;return xe}function c(se){return r(se)?se:e(se.structure,[{unit:se.elements[0].unit,indices:Ve.ofSingleton(Ve.start(se.elements[0].indices))}])}function _(se){return se.length>3&&rt.isRange(se)?Pe.ofRange(se[0],se[se.length-1]):rt.ofSortedArray(se)}function w(se,xe){const re=[],ae=new Set;for(const ge of se.elements)if(M(ge))re[re.length]=ge;else if(0===ge.unit.kind){const Ie=ge.unit.elements,me=ge.unit.model.atomicHierarchy,{label_alt_id:Ae}=ge.unit.model.atomicHierarchy.atoms,{index:he,offsets:ie}=me.residueAtomSegments,ue=[],_e=ge.indices,Fe=Ve.size(_e);let Ze=0;for(;Ze=0){const Be=Ae.value(be);(!xe||ne||!Be||ae.has(Be))&&(ue[ue.length]=Re)}}}re[re.length]={unit:ge.unit,indices:_(ue)}}else re[re.length]=ge;return e(se.structure,re)}function A(se){switch(se.kind){case 0:return se.model.atomicHierarchy.chainAtomSegments;case 1:return se.model.coarseHierarchy.spheres.chainElementSegments;case 2:return se.model.coarseHierarchy.gaussians.chainElementSegments}}function M(se){return se.unit.elements.length===Ve.size(se.indices)}function E(se,xe,re){const{index:ae}=A(se),ge=se.elements;let Ie=0;for(let Ae=0,he=ge.length;Ae0&&(re[re.length]={unit:se,indices:_(me)})}function D(se,xe,re,ae,ge){const{index:Ie}=A(se.elements[0].unit),me=new Set;for(let Ae=xe;Ae({unit:xe,indices:Ve.ofBounds(0,xe.elements.length)})))},e.none=function a(se){return e(se,[])},e.getFirstLocation=function l(se,xe){if(r(se))return;const re=se.elements[0].unit,ae=re.elements[Ve.getAt(se.elements[0].indices,0)];return xe?(xe.structure=se.structure,xe.unit=se.elements[0].unit,xe.element=ae,xe):dt.create(se.structure,re,ae)},e.firstElement=c,e.firstResidue=function u(se){return r(se)?se:w(c(se))},e.firstChain=function d(se){return r(se)?se:T(c(se))},e.toStructure=function f(se){const xe=[];for(const re of se.elements){const{unit:ae,indices:ge}=re,Ie=new Int32Array(Ve.size(ge));Ve.forEach(ge,(me,Ae)=>Ie[Ae]=ae.elements[me]),xe.push(ae.getChild(rt.ofSortedArray(Ie)))}return Xe.create(xe,{parent:se.structure.parent})},e.forEachLocation=function p(se,xe){if(e.isEmpty(se))return;const re=dt.create(se.structure);for(const ae of se.elements){const{unit:ge,indices:Ie}=ae;re.unit=ge;const{elements:me}=ae.unit;for(let Ae=0,he=Ve.size(Ie);Ae{if(!xe.unitMap.has(ae.unit.id))return;const ge=xe.unitMap.get(ae.unit.id),Ie=Ve.indexedIntersect(ae.indices,ae.unit.elements,ge.elements);Ve.size(Ie)>0&&re.push({unit:ge,indices:Ie})}),e(xe,re)},e.union=function h(se,xe){if(se.elements.length>xe.elements.length)return h(xe,se);if(e.isEmpty(se))return xe;const re=new Map;for(const ge of se.elements)re.set(ge.unit.id,ge.indices);const ae=[];for(const ge of xe.elements)re.has(ge.unit.id)?(ae[ae.length]={unit:ge.unit,indices:Ve.union(re.get(ge.unit.id),ge.indices)},re.delete(ge.unit.id)):ae[ae.length]=ge;return re.forEach((ge,Ie)=>{ae[ae.length]={unit:se.structure.unitMap.get(Ie),indices:ge}}),e(se.structure,ae)},e.subtract=function g(se,xe){const re=new Map;for(const ge of xe.elements)re.set(ge.unit.id,ge.indices);const ae=[];for(const ge of se.elements)if(re.has(ge.unit.id)){const Ie=Ve.subtract(ge.indices,re.get(ge.unit.id));if(0===Ve.size(Ie))continue;ae[ae.length]={unit:ge.unit,indices:Ie}}else ae[ae.length]=ge;return e(se.structure,ae)},e.intersect=function y(se,xe){const re=new Map;for(const ge of se.elements)re.set(ge.unit.id,ge.indices);const ae=[];for(const ge of xe.elements){if(!re.has(ge.unit.id))continue;const Ie=Ve.intersect(re.get(ge.unit.id),ge.indices);0!==Ve.size(Ie)&&(ae[ae.length]={unit:ge.unit,indices:Ie})}return e(se.structure,ae)},e.areIntersecting=function v(se,xe){if(se.elements.length>xe.elements.length)return v(xe,se);if(e.isEmpty(se))return e.isEmpty(xe);const re=new Map;for(const ae of se.elements)re.set(ae.unit.id,ae.indices);for(const ae of xe.elements)if(re.has(ae.unit.id)&&Ve.areIntersecting(re.get(ae.unit.id),ae.indices))return!0;return!1},e.isSubset=function x(se,xe){if(e.isEmpty(se))return e.isEmpty(xe);const re=new Map;for(const ge of se.elements)re.set(ge.unit.id,ge.indices);let ae=!1;for(const ge of xe.elements)if(re.has(ge.unit.id)){if(!Ve.isSubset(re.get(ge.unit.id),ge.indices))return!1;ae=!0}return ae},e.extendToWholeResidues=w,e.extendToWholeChains=T,e.extendToWholeEntities=function R(se){const xe=[],re=dt.create(se.structure),ae=new Set,{units:ge}=se.structure;for(let Ie=0,me=se.elements.length;Ie12)Ie[Ie.length]=xe[ie],Ie[Ie.length]=xe[ue-1];else for(let _e=ie;_e{xe+=o(ge)});const re=new Float32Array(3*xe);let ae=0;return se.forEach(ge=>{te(ge,re,ae),ae+=3*o(ge)}),Uh.ofPositions(re)},e.toExpression=function Z(se){if(e.isEmpty(se))return pe.struct.generator.empty();const xe=se.structure.models,re=new Map;for(const Ae of se.elements){const{indices:he}=Ae,{elements:ie}=Ae.unit,ue=Ae.unit.conformation.operator.name;let _e;re.has(ue)?_e=re.get(ue).xs:(_e=Ti.create(),re.set(ue,{modelLabel:Ae.unit.model.label,modelIndex:Ae.unit.model.modelNum,xs:_e}));for(let Fe=0,Ze=Ve.size(he);Fe1,he.modelLabel,he.modelIndex))}const Ie=new Map;for(let Ae=0,he=ae.length;Ae{const{ranges:he,set:ie}=Ae.atom,{opName:ue}=Ae.chain,_e=pe.struct.atomProperty.core.operatorName(),Fe=pe.struct.atomProperty.core.sourceIndex(),Ze=[];ie.length>0&&(Ze[Ze.length]=pe.core.set.has([pe.core.type.set(ie),Fe]));for(let ct=0,q=he.length/2;ct1?pe.core.logic.or(Ze):Ze[0],"chain-test":ue.length>1?pe.core.set.has([pe.core.type.set(ue),_e]):pe.core.rel.eq([_e,ue[0]]),"entity-test":pe.core.logic.and([pe.core.rel.eq([pe.struct.atomProperty.core.modelLabel(),ct]),pe.core.rel.eq([pe.struct.atomProperty.core.modelIndex(),q])])}))}else me.push(pe.struct.generator.atomGroups({"atom-test":Ze.length>1?pe.core.logic.or(Ze):Ze[0],"chain-test":ue.length>1?pe.core.set.has([pe.core.type.set(ue),_e]):pe.core.rel.eq([_e,ue[0]])}))}),pe.struct.modifier.union([1===me.length?me[0]:pe.struct.combinator.merge(me.map(Ae=>pe.struct.modifier.union([Ae])))])}}(Me||(Me={})),function(e){function t(){return{elementCount:0,conformationCount:0,residueCount:0,chainCount:0,unitCount:0,structureCount:0,firstElementLoc:dt.create(void 0),firstConformationLoc:dt.create(void 0),firstResidueLoc:dt.create(void 0),firstChainLoc:dt.create(void 0),firstUnitLoc:dt.create(void 0),firstStructureLoc:dt.create(void 0)}}function n(l,c,u){const d=l.get(c)||0;l.set(c,d+u)}function r(l,c,u){const{indices:d,unit:f}=u,{elements:p}=f,m=Ve.size(d),h=new Map,g=new Map;if(m>0&&dt.set(l.firstElementLoc,c,f,p[Ve.start(d)]),m===p.length)l.unitCount+=1,1===l.unitCount&&dt.set(l.firstUnitLoc,c,f,p[Ve.start(d)]);else if(1===m){if(ze.Traits.is(f.traits,ze.Trait.MultiChain))return;l.elementCount+=1,1===l.elementCount&&dt.set(l.firstElementLoc,c,f,p[Ve.start(d)])}else if(ze.isAtomic(f)){const{index:y,offsets:v}=f.model.atomicHierarchy.residueAtomSegments,{label_alt_id:x}=f.model.atomicHierarchy.atoms;let _=0;for(;_{if(g.get(D)===E){if(""!==D&&(l.conformationCount+=1,1===l.conformationCount))for(let T=v[M],F=v[M+1];T{g[_+1]-g[_]===x&&(l.chainCount+=1,1===l.chainCount&&(v=_))}),!(v<0))for(let x=d;x(i in l[o]||(l[o][i]={props:{...I.getDefaultValues(r.getParams(l))},data:f1.create(void 0)}),l[o][i]),a=(l,c,u)=>{const d=s(l);l[o][i]={props:c,data:f1.withValue(d.data,u)}};return{label:r.label,descriptor:r.descriptor,isHidden:r.isHidden,getParams:l=>{const c=I.clone(r.getParams(l));return I.setDefaultValues(c,s(l).props),c},defaultParams:r.defaultParams,isApplicable:r.isApplicable,attach:(l=le(function*(c,u,d={},f){f&&u.customProperties.reference(r.descriptor,!0);const p=s(u),m=I.merge(r.defaultParams,p.props,d);if(p.data.value&&I.areEqual(r.defaultParams,p.props,m))return;const{value:h,assets:g}=yield r.obtain(c,u,m);u.customProperties.add(r.descriptor),u.customProperties.assets(r.descriptor,g),a(u,m,h)}),function(u,d){return l.apply(this,arguments)}),ref:(l,c)=>l.customProperties.reference(r.descriptor,c),get:l=>{var c;return null===(c=s(l))||void 0===c?void 0:c.data},set:(l,c={},u)=>{const d=s(l),f=I.merge(r.defaultParams,d.props,c);I.areEqual(r.defaultParams,d.props,f)||(a(l,f,u),l.customProperties.assets(r.descriptor))},props:l=>s(l).props};var l}e.createProvider=t,e.createSimple=function n(r,i,o){const s={value:I.Value(o,{isHidden:!0})};return t({label:yf(r),descriptor:hf({name:r}),isHidden:!0,type:i,defaultParams:s,getParams:()=>({value:I.Value(o,{isHidden:!0})}),isApplicable:()=>!0,obtain:(a=le(function*(l,c,u){return{...I.getDefaultValues(s),...u}}),function(c,u,d){return a.apply(this,arguments)})});var a}}(f_||(f_={})),function(e){var o;function t(o){if(!Ui.is(o.sourceData))return!1;const{pdbx_sifts_xref_db_name:s,pdbx_sifts_xref_db_acc:a,pdbx_sifts_xref_db_num:l,pdbx_sifts_xref_db_res:c}=o.sourceData.data.db.atom_site;return s.isDefined&&a.isDefined&&l.isDefined&&c.isDefined}function i(o){if(!Ui.is(o.sourceData))return;const{pdbx_sifts_xref_db_name:s,pdbx_sifts_xref_db_acc:a,pdbx_sifts_xref_db_num:l,pdbx_sifts_xref_db_res:c}=o.sourceData.data.db.atom_site;if(!(s.isDefined&&a.isDefined&&l.isDefined&&c.isDefined))return;const{atomSourceIndex:u}=o.atomicHierarchy,{count:d,offsets:f}=o.atomicHierarchy.residueAtomSegments,p=new Array(d),m=new Array(d),h=new Array(d),g=new Array(d);for(let y=0;y({}),isApplicable:o=>t(o),obtain:(o=le(function*(s,a){return{value:i(a)}}),function(a,l){return o.apply(this,arguments)})}),e.isAvailable=t,e.getKey=function n(o){const s=o.unit.model,a=e.Provider.get(s).value;return a?a.accession[s.atomicHierarchy.residueAtomSegments.index[o.element]]:""},e.getLabel=function r(o){const s=o.unit.model,a=e.Provider.get(s).value;if(!a)return;const l=s.atomicHierarchy.residueAtomSegments.index[o.element],c=a.dbName[l];return c?`${c} ${a.accession[l]} ${a.num[l]} ${a.residue[l]}`:void 0}}(yp||(yp={}));function X3(e,t){if(Ui.is(e.sourceData))return e.sourceData.data.db[t]}function mle(e){if(0===e.length)return[];if(1===e.length)return e[0].entityIndices;const t=Ti.create();for(const n of e)for(const r of n.entityIndices)Ti.add(t,r,r);return ip(t.array),t.array}function vp(e,t){return{name:e,instance({structures:n}){if(t&&!t(n[0]))return us.Category.Empty;const r=n[0].model;if(!Ui.is(r.sourceData))return us.Category.Empty;const i=r.sourceData.data.db[e];return i&&i._rowCount?us.Category.ofTable(i):us.Category.Empty}}}var gle=us.Category;C7("struct_asym"),C7("entity_poly"),C7("entity_poly_seq");function C7(e){return{name:e,instance:({structures:t,cache:n})=>function p9e(e,t,n){const r=X3(e[0].model,t);if(!r)return gle.Empty;const{entity_id:i}=r,o=n.uniqueEntityIds||(n.uniqueEntityIds=function i9e(e){if(0===e.length)return new Set;const t=e[0].model.entities.data.id;return new Set(mle(e).map(n=>t.value(n)))}(e)),s=ce.indicesOf(i,a=>o.has(a));return gle.ofTable(r,s)}(t,e,n)}}var w7;!function(e){e.create=function t(n){const r=Array.isArray(n)?n:[n];return{structures:r,firstModel:r[0].model,cache:Object.create(null)}}}(w7||(w7={}));function A7(e){return e.units.every(t=>t.conformation.operator.isIdentity)}function I7(e){return A7(e)&&e.units.every(t=>!t.conformation.operator.assembly&&!t.conformation.operator.suffix)}var E7;vp("entry"),vp("exptl"),vp("cell",A7),vp("symmetry",A7),vp("pdbx_struct_assembly",I7),vp("pdbx_struct_assembly_gen",I7),vp("pdbx_struct_oper_list",I7),vp("pdbx_entity_branch"),vp("pdbx_entity_branch_link"),vp("pdbx_branch_scheme"),vp("struct_conn"),vp("atom_sites"),function(e){e.AtomSitePositionsFieldNames=new Set(["id","Cartn_x","Cartn_y","Cartn_z"])}(E7||(E7={}));const v9e={molstar_atom_site_operator_mapping:{label_asym_id:ce.Schema.Str(),auth_asym_id:ce.Schema.Str(),operator_name:ce.Schema.Str(),suffix:ce.Schema.Str(),assembly_id:ce.Schema.Str(),assembly_operator_id:ce.Schema.Int(),symmetry_operator_index:ce.Schema.Int(),symmetry_hkl:ce.Schema.Vector(3),ncs_id:ce.Schema.Int()}},ble=(e,t)=>typeof t[e].operator.assembly>"u"?1:0,T7=(e,t)=>-1===t[e].operator.spgrOp?1:0;function Aw(e,t){return t?1===t.length?gf(t.charCodeAt(0),e):2===t.length?gf(t.charCodeAt(0),gf(t.charCodeAt(1),e)):`${e} ${t}`:e}function w9e(e,t,n,r){if(e.has(t)){const i=e.get(t);i.has(n)||i.set(n,r)}else{const i=new Map;e.set(t,i),i.set(n,r)}}function A9e(e){throw new Error(`Missing entity entry for entity id '${e}'.`)}us.fields().str("label_asym_id",(e,t)=>t[e].label_asym_id).str("auth_asym_id",(e,t)=>t[e].auth_asym_id).str("operator_name",(e,t)=>t[e].operator.name).str("suffix",(e,t)=>t[e].operator.suffix).str("assembly_id",(e,t)=>{var n;return(null===(n=t[e].operator.assembly)||void 0===n?void 0:n.id)||""},{valueKind:ble}).int("assembly_operator_id",(e,t)=>{var n;return(null===(n=t[e].operator.assembly)||void 0===n?void 0:n.operId)||0},{valueKind:ble}).int("symmetry_operator_index",(e,t)=>t[e].operator.spgrOp,{valueKind:T7}).vec("symmetry_hkl",[(e,t)=>t[e].operator.hkl[0],(e,t)=>t[e].operator.hkl[1],(e,t)=>t[e].operator.hkl[2]],{valueKind:T7}).int("ncs_id",(e,t)=>t[e].operator.ncsId,{valueKind:T7}).getFields();const K3=Lz.EmptyResidueKey();class E9e{getEntityFromChain(t){return this.map.chain_index_entity_index[t]}findEntity(t){const n=this.map.label_asym_id.get(t);return void 0!==n?n:-1}findChainLabel(t){const n=this.entityIndex(t.label_entity_id);if(n<0||!this.map.entity_index_label_asym_id.has(n))return-1;const r=this.map.entity_index_label_asym_id.get(n);return r&&r.has(t.label_asym_id)?r.get(t.label_asym_id):-1}findChainAuth(t){if(!this.map.auth_asym_id_auth_seq_id.has(t.auth_asym_id))return-1;const n=this.map.auth_asym_id_auth_seq_id.get(t.auth_asym_id);return n.has(t.auth_seq_id)?n.get(t.auth_seq_id):-1}findResidue(t,n,r,i){let o;1===arguments.length?o=t:(K3.label_entity_id=t,K3.label_asym_id=n,K3.auth_seq_id=r,K3.pdbx_PDB_ins_code=i,o=K3);const s=this.findChainLabel(o);if(s<0)return-1;const a=this.map.chain_index_auth_seq_id.get(s),l=Aw(o.auth_seq_id,o.pdbx_PDB_ins_code||"");return a.has(l)?a.get(l):-1}findResidueLabel(t){const n=this.findChainLabel(t);if(n<0)return-1;const r=this.map.chain_index_label_seq_id.get(n),i=Aw(t.label_seq_id,t.pdbx_PDB_ins_code||"");return r.has(i)?r.get(i):-1}findResidueAuth(t){const n=this.findChainAuth(t);if(n<0)return-1;const r=this.map.chain_index_auth_seq_id.get(n),i=Aw(t.auth_seq_id,t.pdbx_PDB_ins_code||"");return r.has(i)?r.get(i):-1}findResidueInsertion(t){const n=this.findChainLabel(t);if(n<0)return-1;const r=this.map.chain_index_label_seq_id.get(n),i=Aw(t.label_seq_id,t.pdbx_PDB_ins_code||"");if(r.has(i))return r.get(i);const o=rt.findPredecessorIndex(this.map.label_seq_id,t.label_seq_id),s=i_.chainStartResidueIndex(this.map.segments,n);if(o=a?a:o}findAtom(t){const n=this.findResidue(t);return n<0?-1:typeof t.label_alt_id>"u"?D7(this.residueOffsets[n],this.residueOffsets[n+1],this.map.label_atom_id,t.label_atom_id):P7(this.residueOffsets[n],this.residueOffsets[n+1],this.map.label_atom_id,this.map.label_alt_id,t.label_atom_id,t.label_alt_id)}findAtomAuth(t){const n=this.findResidueAuth(t);return n<0?-1:typeof t.label_alt_id>"u"?D7(this.residueOffsets[n],this.residueOffsets[n+1],this.map.auth_atom_id,t.auth_atom_id):P7(this.residueOffsets[n],this.residueOffsets[n+1],this.map.auth_atom_id,this.map.label_alt_id,t.auth_atom_id,t.label_alt_id)}findAtomOnResidue(t,n,r){return typeof r>"u"?D7(this.residueOffsets[t],this.residueOffsets[t+1],this.map.label_atom_id,n):P7(this.residueOffsets[t],this.residueOffsets[t+1],this.map.label_atom_id,this.map.label_alt_id,n,r)}findAtomsOnResidue(t,n){return function T9e(e,t,n,r){for(let i=e;i=l[c+1]&&(c+=1,u=0),s[d]=++u;i.label_seq_id=ce.ofIntArray(s)}return Kr.columnToArray(i,"label_seq_id",Int32Array),Kr.columnToArray(i,"auth_seq_id",Int32Array),{atoms:r,residues:i,chains:o,atomSourceIndex:t}}(e,t,s),l=function F9e(e,t){const n=new Map;if(!Ui.is(t))return n;const{molstar_atom_site_operator_mapping:r}=rg(v9e,t.data.frame);if(0===r._rowCount)return n;const i=new Map,o=new Map;for(let u=0;u-1,findChainKey:()=>-1,getEntityFromChain:()=>-1,count:0,entity_id:ce.Undefined(0,ce.Schema.str),asym_id:ce.Undefined(0,ce.Schema.str),seq_id_begin:ce.Undefined(0,ce.Schema.int),seq_id_end:ce.Undefined(0,ce.Schema.int),chainElementSegments:En.create([]),polymerRanges:Di.ofSortedRanges([]),gapRanges:Di.ofSortedRanges([])};var _le=function(e){return e.Empty={isDefined:!1,spheres:xle,gaussians:xle},e}(_le||{});function B9e(e,t,n){if(e.has(t))return e.get(t);const r=n.index++;return e.set(t,r),r}function L9e(e,t){if(e.has(t))return e.get(t);const n=new Map;return e.set(t,n),n}function U9e(e){throw new Error(`Missing entity entry for entity id '${e}'.`)}function Sle(e,t){const{entity_id:n,asym_id:r,seq_id_begin:i,seq_id_end:o,count:s,chainElementSegments:a}=e,l=new Map,c=new Map,u={index:0},d=new Int32Array(s),f=new Int32Array(s),p=new Int32Array(a.count);for(let y=0;y{const l=r(s);if(l<0)return-1;const c=t.get(l);return c.has(a)?c.get(a):-1},findSequenceKey:(s,a,l)=>{const c=r(s);if(c<0)return-1;const u=t.get(c);if(void 0===u)return-1;const d=u.get(a);if(void 0===d)return-1;const f=n.get(d),{elementIndices:p,seqRanges:m}=f,h=Di.firstIntersectionIndex(m,Ve.ofSingleton(l));return-1!==h?p[h]:-1}}}(t,c,l);return{chainKey:d,entityKey:f,findSequenceKey:h,findChainKey:m,getEntityFromChain:y=>p[y]}}function Cle(e,t){const n=[],r=[],i=En.transientSegments(e.chainElementSegments,Pe.ofBounds(0,e.count)),{seq_id_begin:o,seq_id_end:s}=e;for(;i.hasNext;){const{start:a,end:l}=i.move();let c=-1,u=-1;for(let d=a;d1&&(n.push(c,d-1),r.push(d-1,d),c=d),d===l-1&&n.push(c,d),u=f}}return{polymerRanges:Di.ofSortedRanges(n),gapRanges:Di.ofSortedRanges(r)}}const wle={hierarchy:_le.Empty,conformation:void 0};function G9e(e,t,n){const r=[0];for(let i=1,o=e.rowCount;i{if(!t||t.length!==r.length)return t=r,n=e.apply(void 0,r),n;for(let i=0,o=r.length;i{if(t.has(n))return t.get(n);const r=e(n);return t.set(n,r),r}}function Y9e(e){const t=new Map,n=(i,o,s)=>`${i}|${o}|${s}`,r=e.pdbx_unobs_or_zero_occ_residues;for(let i=0,o=r._rowCount;it.has(n(i,o,s)),get:(i,o,s)=>t.get(n(i,o,s)),size:t.size}}function X9e(e){const t=new Map;if(e.chem_comp._rowCount>0){const{id:n}=e.chem_comp;for(let r=0,i=n.rowCount;r{t.set(r,function E6e(e){return{formula:"",formula_weight:0,id:e,name:e,mon_nstd_flag:yw.has(e)?"y":"n",pdbx_synonyms:[],type:Cse(e)}}(r))});return t}function K9e(e){const t=new Map;if(e.pdbx_chem_comp_identifier._rowCount>0){const{comp_id:n,type:r,identifier:i}=e.pdbx_chem_comp_identifier;for(let o=0,s=n.rowCount;o0){const{id:n,type:r}=e.chem_comp;for(let i=0,o=n.rowCount;i{!t.has(i)&&n.has(i)&&t.set(i,r)})}return t}!function(e){let t;var c;(c=t=e.Kind||(e.Kind={})).Protein="protein",c.RNA="RNA",c.DNA="DNA",c.Generic="generic",e.getSequenceString=function n(c){const u=c.code.toArray();return(u instanceof Array?u:Array.from(u)).join("")},e.ofResidueNames=function o(c,u){if(0===u.rowCount)throw new Error("cannot be empty");const d=function r(c){for(let u=0,d=Math.min(c.rowCount,10);u"X";break;default:Hi()}return u&&u.size>0?f=>{const p=d(f);return"X"===p&&u.has(f)?d(u.get(f)):p}:d}(u),m=[],h=[],g=[],y=new Map;let v=0;const x=new Map;for(let w=0,A=f.rowCount;w{const T=p(D);return"X"===T?D:T});_[w]=`(${E.join("|")})`}else _[w]="X"===m[w]?h[w]:m[w]}this.length=v,this.code=ce.ofStringArray(m),this.compId=ce.ofStringArray(h),this.seqId=ce.ofIntArray(g),this.label=ce.ofStringArray(_),this.microHet=y,this.indexMap=x}}e.ofSequenceRanges=function a(c,u){return new l(t.Generic,c,u)};class l{index(u){return u-this.minSeqId}constructor(u,d,f){this.kind=u,this.seqIdStart=d,this.seqIdEnd=f,this.microHet=new Map;let p=0,m=Number.MAX_SAFE_INTEGER;for(let g=0,y=this.seqIdStart.rowCount;gg+m+1,rowCount:h,schema:ce.Schema.int}),this.compId=ce.ofConst("",h,ce.Schema.str),this.length=h,this.minSeqId=m}}}(Z3||(Z3={})),function(e){const t={byEntityKey:{},sequences:[]};function n(...a){const l=[],c={};for(let u=0,d=a.length;u{const t=new Set,{label_comp_id:n,auth_comp_id:r}=e.atom_site,i=n.isDefined?n:r;for(let o=0,s=i.rowCount;o0?yield function nHe(e,t,n,r){return O7.apply(this,arguments)}(n,e,r,t):yield function tHe(e,t,n,r){return N7.apply(this,arguments)}(n,e,r,t);for(let o=0;o0?i[i.length-1]:void 0);i.push(d),a=l}}return i}),N7.apply(this,arguments)}function F7(e,t){const n=new Map,r=e._rowCount;let i=0;for(;iz._dynamicPropertyData[c]||{index:0,size:1},set:(z,$)=>z._dynamicPropertyData[c]=$};const u="__AsymIdCount__";e.AsymIdCount={get(z){if(z._dynamicPropertyData[u])return z._dynamicPropertyData[u];const $=function QFe(e){const t=new Set,n=new Set;return e.properties.structAsymMap.forEach(({auth_id:r},i)=>{t.add(r),n.add(i)}),{auth:t.size,label:n.size}}(z);return z._dynamicPropertyData[u]=$,$}},e.AsymIdOffset=f_.createSimple("asym_id_offset","static"),e.Index=f_.createSimple("index","static"),e.MaxIndex=f_.createSimple("max_index","static"),e.getRoot=function d(z){return z.parent||z},e.areHierarchiesEqual=function f(z,$){return z.atomicHierarchy===$.atomicHierarchy&&z.coarseHierarchy===$.coarseHierarchy};const p="__CoordinatesHistory__";e.CoordinatesHistory={get:z=>z._staticPropertyData[p],set:(z,$)=>z._staticPropertyData[p]=$};const m="__CoarseGrained__";function h(z){let $=e.CoarseGrained.get(z);if(void 0===$){let V=0;const{polymerType:X}=z.atomicHierarchy.derived.residue;for(let Q=0;Qz._staticPropertyData[m],set:(z,$)=>z._staticPropertyData[m]=$},e.isCoarseGrained=h,e.hasCarbohydrate=function g(z){return z.properties.saccharideComponentMap.size>0},e.hasProtein=function y(z){const{subtype:$}=z.entities;for(let V=0,X=$.rowCount;V=0)return!0;return!1}function T(z){if(!Ui.is(z.sourceData))return!1;const{db:$}=z.sourceData.data;for(let V=0;V<$.exptl.method.rowCount;V++)if($.exptl.method.value(V).toUpperCase().indexOf("MICROSCOPY")>=0)return!0;return!1}function R(z){if(!Ui.is(z.sourceData)||!D(z))return!1;const{db:$}=z.sourceData.data,{status_code_sf:V}=$.pdbx_database_status;return V.isDefined&&"REL"===V.value(0)}function N(z){if(!Ui.is(z.sourceData))return!1;const{db:$}=z.sourceData.data,{db_name:V,content_type:X}=$.pdbx_database_related;for(let H=0,oe=$.pdbx_database_related._rowCount;H=0)return!0;return!1},e.hasXrayMap=R,e.hasEmMap=N,e.hasDensityMap=j,e.probablyHasDensityMap=function W(z){if(!Ui.is(z.sourceData))return!1;const{db:$}=z.sourceData.data;return j(z)||_(z)&&(!$.exptl.method.isDefined||D(z)&&(!$.pdbx_database_status.status_code_sf.isDefined||2===$.pdbx_database_status.status_code_sf.valueKind(0))||T(z)&&!$.pdbx_database_related.db_name.isDefined)}}(Sn||(Sn={})),function(e){e.getCifDataSource=function t(d,f,p){if(!f)return{rowCount:0};if(p&&p[f.id])return p[f.id];const m=f.getElements(d),h={data:m,rowCount:m.elements.length};return p&&(p[f.id]=h),h},e.fromAtomMap=function n(d){return new jle(d)},e.fromAtomArray=function r(d){return new jle(B7(d))};const i=d=>d.atomicHierarchy.residueAtomSegments;e.fromResidueMap=function o(d){return new M5("residue",d,i,0)},e.fromResidueArray=function s(d){return new M5("residue",B7(d),i,0)};const a=d=>d.atomicHierarchy.chainAtomSegments;e.fromChainMap=function l(d){return new M5("chain",d,a,0)},e.fromChainArray=function c(d){return new M5("chain",B7(d),a,0)},e.fromEntityMap=function u(d){return new rHe(d)}}(Lle||(Lle={}));class M5{has(t){return this.map.has(t)}get(t){return this.map.get(t)}getStructureElements(t){const n=t.models;if(1!==n.length)throw new Error("Only works on structures with a single model.");const r=new Set,i=t.unitSymmetryGroups,o=[],s=this.segmentGetter(n[0]);for(const a of i){const l=a.units[0];if(l.kind!==this.kind)continue;const c=En.transientSegments(s,l.elements);for(;c.hasNext;){const u=c.move();!this.has(u.index)||r.has(u.index)||(r.add(u.index),o[o.length]=dt.create(t,l,l.elements[u.start]))}}return o.sort((a,l)=>a.element-l.element),o}getElements(t){const n=this.segmentGetter(t.model).index,r=this.getStructureElements(t);return{elements:r,property:i=>this.get(n[r[i].element])}}constructor(t,n,r,i){this.level=t,this.map=n,this.segmentGetter=r,this.id=oo.create22(),this.kind=i}}class jle{has(t){return this.map.has(t)}get(t){return this.map.get(t)}getStructureElements(t){if(1!==t.models.length)throw new Error("Only works on structures with a single model.");const r=new Set,i=t.unitSymmetryGroups,o=[];for(const s of i){const a=s.units[0];if(a.kind!==this.kind)continue;const l=a.elements;for(let c=0,u=l.length;cs.element-a.element),o}getElements(t){const n=this.getStructureElements(t);return{elements:n,property:r=>this.get(n[r].element)}}constructor(t){this.map=t,this.id=oo.create22(),this.level="atom",this.kind=0}}class rHe{has(t){return this.map.has(t)}get(t){return this.map.get(t)}getStructureElements(t){const n=t.models;if(1!==n.length)throw new Error("Only works on structures with a single model.");const r=n[0].atomicHierarchy.index,i=new Set,o=t.unitSymmetryGroups,s=[],a=n[0].atomicHierarchy.chainAtomSegments;for(const l of o){const c=l.units[0];if(c.kind!==this.kind)continue;const u=En.transientSegments(a,c.elements);for(;u.hasNext;){const d=u.move(),f=r.getEntityFromChain(d.index);!this.has(f)||i.has(f)||(i.add(f),s[s.length]=dt.create(t,c,c.elements[d.start]))}}return s.sort((l,c)=>l.element-c.element),s}getElements(t){const n=this.getStructureElements(t),r=t.model.atomicHierarchy.chainAtomSegments.index,i=t.model.atomicHierarchy.index;return{elements:n,property:o=>this.get(i.getEntityFromChain(r[n[o].element]))}}constructor(t){this.map=t,this.id=oo.create22(),this.level="entity",this.kind=0}}!function(e){function t(a){const l=new DataView(a.buffer);return Object.assign(a.subarray(0),{readInt8:c=>l.getInt8(c),readUInt8:c=>l.getUint8(c),writeInt8:(c,u)=>l.setInt8(u,c),writeUInt8:(c,u)=>l.setUint8(u,c),readInt16LE:c=>l.getInt16(c,!0),readInt32LE:c=>l.getInt32(c,!0),readUInt16LE:c=>l.getUint16(c,!0),readUInt32LE:c=>l.getUint32(c,!0),readFloatLE:c=>l.getFloat32(c,!0),readDoubleLE:c=>l.getFloat64(c,!0),writeInt16LE:(c,u)=>l.setInt16(u,c,!0),writeInt32LE:(c,u)=>l.setInt32(u,c,!0),writeUInt16LE:(c,u)=>l.setUint16(u,c,!0),writeUInt32LE:(c,u)=>l.setUint32(u,c,!0),writeFloatLE:(c,u)=>l.setFloat32(u,c,!0),writeDoubleLE:(c,u)=>l.setFloat64(u,c,!0),readInt16BE:c=>l.getInt16(c,!1),readInt32BE:c=>l.getInt32(c,!1),readUInt16BE:c=>l.getUint16(c,!1),readUInt32BE:c=>l.getUint32(c,!1),readFloatBE:c=>l.getFloat32(c,!1),readDoubleBE:c=>l.getFloat64(c,!1),writeInt16BE:(c,u)=>l.setInt16(u,c,!1),writeInt32BE:(c,u)=>l.setInt32(u,c,!1),writeUInt16BE:(c,u)=>l.setUint16(u,c,!1),writeUInt32BE:(c,u)=>l.setUint32(u,c,!1),writeFloatBE:(c,u)=>l.setFloat32(u,c,!1),writeDoubleBE:(c,u)=>l.setFloat64(u,c,!1),copy:(c,u,d,f)=>(u=Ll(u,0),d=Ll(d,0),f=Ll(f,a.length),c.set(a.subarray(d,f),u),f-d)})}function i(a,l,c,u,d){for(let f=0,p=c;f>8&255}},e.ensureLittleEndian=function s(a,l,c,u,d){e.IsNativeEndianLittle||!c||u<=1||i(a,l,c,u,d)}}($h||($h={})),function(e){e.fromBuffer=function t(n,r){return{name:r,readBuffer:(i,o,s,a)=>{let l,c;if("number"==typeof o){s=Ll(s,o);const u=i,d=Math.min(n.length,u+s);l=d-u,c=$h.fromUint8Array(new Uint8Array(n.buffer,u,d-u))}else{s=Ll(s,o.length);const u=i,d=Math.min(n.length,u+s);o.set(n.subarray(u,d),a),l=d-u,c=o}return s!==l&&console.warn(`byteCount ${s} and bytesRead ${l} differ`),Promise.resolve({bytesRead:l,buffer:c})},writeBuffer:(i,o,s)=>(s=Ll(s,o.length),console.error(".writeBuffer not implemented for FileHandle.fromBuffer"),Promise.resolve(0)),writeBufferSync:(i,o,s)=>(s=Ll(s,o.length),console.error(".writeSync not implemented for FileHandle.fromBuffer"),0),close:rp}}}(R5||(R5={}));var dl=function(e){return e.Float32="float32",e.Int8="int8",e.Int16="int16",e.Uint16="uint16",e}(dl||{});function Ule(e){return e===dl.Float32?4:e===dl.Int16||e===dl.Uint16?2:1}function iHe(e,t,n=0,r){return e===dl.Float32?new Float32Array(t,n,r):e===dl.Int16?new Int16Array(t,n,r):e===dl.Uint16?new Uint16Array(t,n,r):new Int8Array(t,n,r)}function L7(){return L7=le(function*(e,t,n,r,i,o){return yield t.readBuffer(n,e.readBuffer,r,i),e.elementByteSize>1&&(void 0!==o&&o!==$h.IsNativeEndianLittle||!$h.IsNativeEndianLittle)&&$h.flipByteOrder(e.readBuffer,e.valuesBuffer,r,e.elementByteSize,i),e.values}),L7.apply(this,arguments)}function j7(){return j7=le(function*(e){const{buffer:n}=yield e.readBuffer(0,1024),r=String.fromCharCode(n.readUInt8(208),n.readUInt8(209),n.readUInt8(210),n.readUInt8(211));if("MAP "!==r)throw new Error('ccp4 format error, missing "MAP " string');const i=[n.readUInt8(212),n.readUInt8(213)];let o=!1;68===i[0]&&65===i[1]?o=!0:17===i[0]&&17===i[1]?o=!1:n.readInt32LE(12)<=16&&(o=!0);const s=o?c=>n.readInt32LE(4*c):c=>n.readInt32BE(4*c),a=o?c=>n.readFloatLE(4*c):c=>n.readFloatBE(4*c);return{header:{NC:s(0),NR:s(1),NS:s(2),MODE:s(3),NCSTART:s(4),NRSTART:s(5),NSSTART:s(6),NX:s(7),NY:s(8),NZ:s(9),xLength:a(10),yLength:a(11),zLength:a(12),alpha:a(13),beta:a(14),gamma:a(15),MAPC:s(16),MAPR:s(17),MAPS:s(18),AMIN:a(19),AMAX:a(20),AMEAN:a(21),ISPG:s(22),NSYMBT:s(23),LSKFLG:s(24),SKWMAT:[],SKWTRN:[],userFlag1:s(39),userFlag2:s(40),originX:a(49),originY:a(50),originZ:a(51),MAP:r,MACHST:i,ARMS:a(54)},littleEndian:o}}),j7.apply(this,arguments)}function U7(){return U7=le(function*(e,t,n,r,i,o){if(Vle(e)){const s=3*i;yield n.readBuffer(r,t.readBuffer,i,s);const a=new Int8Array(t.valuesBuffer.buffer,s),l=(e.AMAX-e.AMIN)/255,c=.5*(e.AMIN+e.AMAX+l);for(let u=0,d=i;ue.readInt16LE(2*i):i=>e.readInt16BE(2*i),r=1/n(17);return{xStart:n(0),yStart:n(1),zStart:n(2),xExtent:n(3),yExtent:n(4),zExtent:n(5),xRate:n(6),yRate:n(7),zRate:n(8),xlen:n(9)*r,ylen:n(10)*r,zlen:n(11)*r,alpha:n(12)*r,beta:n(13)*r,gamma:n(14)*r,divisor:n(15)/100,summand:n(16),sigma:void 0}}function Gle(e){const{xExtent:t,yExtent:n,zExtent:r}=e;return{xBlocks:Math.ceil(t/8),yBlocks:Math.ceil(n/8),zBlocks:Math.ceil(r/8)}}function H7(){return H7=le(function*(e){const{buffer:t}=yield e.readBuffer(0,V7),n=String.fromCharCode.apply(null,t),r=n.startsWith(":-)"),i=r||100===t.readInt16LE(36);return{header:r?pHe(n):hHe(t,i),littleEndian:i}}),H7.apply(this,arguments)}function G7(){return G7=le(function*(e,t,n,r){r||$h.flipByteOrderInPlace2(t.buffer);const{divisor:i,summand:o,xExtent:s,yExtent:a,zExtent:l}=e,{xBlocks:c,yBlocks:u,zBlocks:d}=Gle(e);let f=0;for(let p=0;pu.get(d)})}function DHe(e,t){const{elements:n,tokenizer:r}=e,{count:i,property:o}=t,s=ot.create(r.data,2*i*3),a=new Uint32Array(i+1);let l=0;for(let d=0,f=i;d{const f=a[d]+1,p=u.value(f-1);for(let m=f,h=f+p;mr.get(i)}}(r,i.map(l=>l.name),o);return qi.success(a)}),$7.apply(this,arguments)}const{readLine:N5,skipWhitespace:Wle,eatValue:$le,eatLine:MHe,markStart:Y7}=kt,F5=/\s+/,RHe=/(^\*|REMARK)*/;function FHe(e,t){return X7.apply(this,arguments)}function X7(){return X7=le(function*(e,t){const{tokenizer:n}=e,r=ot.create(n.data,2*t),i=ot.create(n.data,2*t),o=ot.create(n.data,2*t),s=ot.create(n.data,2*t),a=ot.create(n.data,2*t),l=ot.create(n.data,2*t),c=ot.create(n.data,2*t),u=ot.create(n.data,2*t),{position:d}=n,f=N5(n).trim();n.position=d;const p=7===f.split(F5).length,m=p?6:8,{length:h}=n;let g=0;return yield G0(e.runtimeCtx,1e5,void 0,y=>{const v=Math.min(t-g,y);for(let x=0;xy.update({message:"Parsing...",current:n.position,max:h})),{count:t,atomId:Pn(r)(ce.Schema.int),segmentName:p?Pn(o)(ce.Schema.str):Pn(i)(ce.Schema.str),residueId:Pn(o)(ce.Schema.int),residueName:p?Pn(o)(ce.Schema.str):Pn(s)(ce.Schema.str),atomName:Pn(a)(ce.Schema.str),atomType:Pn(l)(ce.Schema.str),charge:Pn(c)(ce.Schema.float),mass:Pn(u)(ce.Schema.float)}}),X7.apply(this,arguments)}function OHe(e,t){return K7.apply(this,arguments)}function K7(){return K7=le(function*(e,t){const{tokenizer:n}=e,r=ot.create(n.data,2*t),i=ot.create(n.data,2*t),{length:o}=n;let s=0;return yield G0(e.runtimeCtx,10,void 0,a=>{const l=Math.min(t-s,a);for(let c=0;ca.update({message:"Parsing...",current:n.position,max:o})),{count:t,atomIdA:Pn(r)(ce.Schema.int),atomIdB:Pn(i)(ce.Schema.int)}}),K7.apply(this,arguments)}function BHe(e,t){const n=[];for(let r=0;rn(i)},e.create=n,e.hasTag=function r(i,o){if(!i.tags)return!1;for(const s of i.tags)if(s===o)return!0;return!1},e.Null={id:oo.create22(),type:{name:"Null",typeClass:"Null"},data:void 0,label:"Null"}}(vo||(vo={})),function(e){e.is=function t(r){return!!(r&&r.transform&&r.parent&&r.status)},e.resolve=function n(r,i){const o="string"==typeof i?i:e.is(i)?i.transform.ref:i.ref;return r.cells.get(o)}}(Q3||(Q3={}));class Yle{get cell(){var t;return null===(t=this.state)||void 0===t?void 0:t.cells.get(this.ref)}get obj(){var t,n;return null===(n=null===(t=this.state)||void 0===t?void 0:t.cells.get(this.ref))||void 0===n?void 0:n.obj}get data(){var t;return null===(t=this.obj)||void 0===t?void 0:t.data}update(t,n){if(!this.state)throw new Error("To use update() from StateObjectSelector, 'state' must be defined.");return n||(n=this.state.build()),(n||this.state.build()).to(this).update(t),n}checkValid(){if(!this.state)throw new Error("Unassigned State.");const t=this.cell;if(!t)throw new Error("Not created at all. Did you await/then the corresponding state update?");if("ok"===t.status)return!0;throw"error"===t.status?new Error(t.errorText):t.obj===vo.Null?new Error("The object is Null."):new Error("Unresolved. Did you await/then the corresponding state update?")}get isOk(){const t=this.cell;return t&&"ok"===t.status&&t.obj!==vo.Null}constructor(t,n){this.ref=t,this.state=n}}!function(e){function n(i,o){if(o)return Q3.is(o)?o:"string"==typeof o?i.cells.get(o):o.cell}e.resolveRef=function t(i){var o;if(i)return"string"==typeof i?i:Q3.is(i)?i.transform.ref:null===(o=i.cell)||void 0===o?void 0:o.transform.ref},e.resolve=n,e.resolveAndCheck=function r(i,o){const s=n(i,o);if(s&&s.obj&&"ok"===s.status)return s}}(_a||(_a={}));var J3="delete",Es=5,xp=1<>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?Iw(e)+t:t}function Xle(){return!0}function eD(e,t,n){return(0===e&&!Zle(e)||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function Ew(e,t){return Kle(e,t,0)}function tD(e,t){return Kle(e,t,t)}function Kle(e,t,n){return void 0===e?n:Zle(e)?t===1/0?t:0|Math.max(0,t+e):void 0===t||t===e?e:0|Math.min(t,e)}function Zle(e){return e<0||0===e&&1/e==-1/0}var Qle="@@__IMMUTABLE_ITERABLE__@@";function ju(e){return!(!e||!e[Qle])}var Jle="@@__IMMUTABLE_KEYED__@@";function fs(e){return!(!e||!e[Jle])}var ece="@@__IMMUTABLE_INDEXED__@@";function Jc(e){return!(!e||!e[ece])}function nD(e){return fs(e)||Jc(e)}var aa=function(t){return ju(t)?t:zu(t)},Sp=function(e){function t(n){return fs(n)?n:R1(n)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t}(aa),p_=function(e){function t(n){return Jc(n)?n:Ip(n)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t}(aa),Tw=function(e){function t(n){return ju(n)&&!nD(n)?n:kw(n)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t}(aa);aa.Keyed=Sp,aa.Indexed=p_,aa.Set=Tw;var tce="@@__IMMUTABLE_SEQ__@@";function O5(e){return!(!e||!e[tce])}var nce="@@__IMMUTABLE_RECORD__@@";function h_(e){return!(!e||!e[nce])}function Cp(e){return ju(e)||h_(e)}var Dw="@@__IMMUTABLE_ORDERED__@@";function wp(e){return!(!e||!e[Dw])}var rD=0,Yh=1,Ap=2,eV="function"==typeof Symbol&&Symbol.iterator,rce="@@iterator",B5=eV||rce,ao=function(t){this.next=t};function Ts(e,t,n,r){var i=0===e?t:1===e?n:[t,n];return r?r.value=i:r={value:i,done:!1},r}function Uu(){return{value:void 0,done:!0}}function tV(e){return!!Array.isArray(e)||!!L5(e)}function ice(e){return e&&"function"==typeof e.next}function nV(e){var t=L5(e);return t&&t.call(e)}function L5(e){var t=e&&(eV&&e[eV]||e[rce]);if("function"==typeof t)return t}ao.prototype.toString=function(){return"[Iterator]"},ao.KEYS=rD,ao.VALUES=Yh,ao.ENTRIES=Ap,ao.prototype.inspect=ao.prototype.toSource=function(){return this.toString()},ao.prototype[B5]=function(){return this};var Pw=Object.prototype.hasOwnProperty;function rV(e){return!(!Array.isArray(e)&&"string"!=typeof e)||e&&"object"==typeof e&&Number.isInteger(e.length)&&e.length>=0&&(0===e.length?1===Object.keys(e).length:e.hasOwnProperty(e.length-1))}var zu=function(e){function t(n){return null==n?oV():Cp(n)?n.toSeq():function HHe(e){var t=aV(e);if(t)return function UHe(e){var t=L5(e);return t&&t===e.entries}(e)?t.fromEntrySeq():function zHe(e){var t=L5(e);return t&&t===e.keys}(e)?t.toSetSeq():t;if("object"==typeof e)return new iV(e);throw new TypeError("Expected Array or collection object of values, or keyed object: "+e)}(n)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.toSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq {","}")},t.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},t.prototype.__iterate=function(r,i){var o=this._cache;if(o){for(var s=o.length,a=0;a!==s;){var l=o[i?s-++a:a++];if(!1===r(l[1],l[0],this))break}return a}return this.__iterateUncached(r,i)},t.prototype.__iterator=function(r,i){var o=this._cache;if(o){var s=o.length,a=0;return new ao(function(){if(a===s)return{value:void 0,done:!0};var l=o[i?s-++a:a++];return Ts(r,l[0],l[1])})}return this.__iteratorUncached(r,i)},t}(aa),R1=function(e){function t(n){return null==n?oV().toKeyedSeq():ju(n)?fs(n)?n.toSeq():n.fromEntrySeq():h_(n)?n.toSeq():sV(n)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.toKeyedSeq=function(){return this},t}(zu),Ip=function(e){function t(n){return null==n?oV():ju(n)?fs(n)?n.entrySeq():n.toIndexedSeq():h_(n)?n.toSeq().entrySeq():sce(n)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.of=function(){return t(arguments)},t.prototype.toIndexedSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq [","]")},t}(zu),kw=function(e){function t(n){return(ju(n)&&!nD(n)?n:Ip(n)).toSetSeq()}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.of=function(){return t(arguments)},t.prototype.toSetSeq=function(){return this},t}(zu);zu.isSeq=O5,zu.Keyed=R1,zu.Set=kw,zu.Indexed=Ip,zu.prototype[tce]=!0;var m_=function(e){function t(n){this._array=n,this.size=n.length}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.get=function(r,i){return this.has(r)?this._array[M1(this,r)]:i},t.prototype.__iterate=function(r,i){for(var o=this._array,s=o.length,a=0;a!==s;){var l=i?s-++a:a++;if(!1===r(o[l],l,this))break}return a},t.prototype.__iterator=function(r,i){var o=this._array,s=o.length,a=0;return new ao(function(){if(a===s)return{value:void 0,done:!0};var l=i?s-++a:a++;return Ts(r,l,o[l])})},t}(Ip),iV=function(e){function t(n){var r=Object.keys(n).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(n):[]);this._object=n,this._keys=r,this.size=r.length}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.get=function(r,i){return void 0===i||this.has(r)?this._object[r]:i},t.prototype.has=function(r){return Pw.call(this._object,r)},t.prototype.__iterate=function(r,i){for(var o=this._object,s=this._keys,a=s.length,l=0;l!==a;){var c=s[i?a-++l:l++];if(!1===r(o[c],c,this))break}return l},t.prototype.__iterator=function(r,i){var o=this._object,s=this._keys,a=s.length,l=0;return new ao(function(){if(l===a)return{value:void 0,done:!0};var c=s[i?a-++l:l++];return Ts(r,c,o[c])})},t}(R1);iV.prototype[Dw]=!0;var oce,VHe=function(e){function t(n){this._collection=n,this.size=n.length||n.size}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.__iterateUncached=function(r,i){if(i)return this.cacheResult().__iterate(r,i);var s=nV(this._collection),a=0;if(ice(s))for(var l;!(l=s.next()).done&&!1!==r(l.value,a++,this););return a},t.prototype.__iteratorUncached=function(r,i){if(i)return this.cacheResult().__iterator(r,i);var s=nV(this._collection);if(!ice(s))return new ao(Uu);var a=0;return new ao(function(){var l=s.next();return l.done?l:Ts(r,a++,l.value)})},t}(Ip);function oV(){return oce||(oce=new m_([]))}function sV(e){var t=aV(e);if(t)return t.fromEntrySeq();if("object"==typeof e)return new iV(e);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+e)}function sce(e){var t=aV(e);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+e)}function aV(e){return rV(e)?new m_(e):tV(e)?new VHe(e):void 0}var ace="@@__IMMUTABLE_MAP__@@";function j5(e){return!(!e||!e[ace])}function lV(e){return j5(e)&&wp(e)}function cV(e){return!(!e||"function"!=typeof e.equals||"function"!=typeof e.hashCode)}function oc(e,t){if(e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if((e=e.valueOf())===(t=t.valueOf())||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!!(cV(e)&&cV(t)&&e.equals(t))}var iD="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,n){var r=65535&(t|=0),i=65535&(n|=0);return r*i+((t>>>16)*i+r*(n>>>16)<<16>>>0)|0};function U5(e){return e>>>1&1073741824|3221225471&e}var GHe=Object.prototype.valueOf;function Id(e){if(null==e)return lce(e);if("function"==typeof e.hashCode)return U5(e.hashCode(e));var t=function KHe(e){return e.valueOf!==GHe&&"function"==typeof e.valueOf?e.valueOf(e):e}(e);if(null==t)return lce(t);switch(typeof t){case"boolean":return t?1108378657:1108378656;case"number":return function qHe(e){if(e!=e||e===1/0)return 0;var t=0|e;for(t!==e&&(t^=4294967295*e);e>4294967295;)t^=e/=4294967295;return U5(t)}(t);case"string":return t.length>ZHe?function WHe(e){var t=mV[e];return void 0===t&&(t=uV(e),hV===QHe&&(hV=0,mV={}),hV++,mV[e]=t),t}(t):uV(t);case"object":case"function":return function YHe(e){var t;if(dV&&void 0!==(t=fV.get(e))||void 0!==(t=e[g_])||!uce&&(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[g_])||(t=function XHe(e){if(e&&e.nodeType>0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}(e),void 0!==t)))return t;if(t=dce(),dV)fV.set(e,t);else{if(void 0!==cce&&!1===cce(e))throw new Error("Non-extensible objects are not allowed as keys.");if(uce)Object.defineProperty(e,g_,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(void 0!==e.propertyIsEnumerable&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable)e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},e.propertyIsEnumerable[g_]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[g_]=t}}return t}(t);case"symbol":return function $He(e){var t=fce[e];return void 0!==t||(t=dce(),fce[e]=t),t}(t);default:if("function"==typeof t.toString)return uV(t.toString());throw new Error("Value type "+typeof t+" cannot be hashed.")}}function lce(e){return null===e?1108378658:1108378659}function uV(e){for(var t=0,n=0;n=0&&(c.get=function(u,d){return(u=M1(this,u))>=0&&ul)return{value:void 0,done:!0};var h=f.next();return r||u===Yh||h.done?h:Ts(u,m-1,u===rD?void 0:h.value[1],h)})},c}function vce(e,t,n,r){var i=ug(e);return i.__iterateUncached=function(o,s){var a=this;if(s)return this.cacheResult().__iterate(o,s);var l=!0,c=0;return e.__iterate(function(u,d,f){if(!l||!(l=t.call(n,u,d,f)))return c++,o(u,r?d:c-1,a)}),c},i.__iteratorUncached=function(o,s){var a=this;if(s)return this.cacheResult().__iterator(o,s);var l=e.__iterator(Ap,s),c=!0,u=0;return new ao(function(){var d,f,p;do{if((d=l.next()).done)return r||o===Yh?d:Ts(o,u++,o===rD?void 0:d.value[1],d);var m=d.value;f=m[0],p=m[1],c&&(c=t.call(n,p,f,a))}while(c);return o===Ap?d:Ts(o,f,p,d)})},i}function xce(e,t,n){var r=ug(e);return r.__iterateUncached=function(i,o){if(o)return this.cacheResult().__iterate(i,o);var s=0,a=!1;return function l(c,u){c.__iterate(function(d,f){return(!t||u0}function H5(e,t,n,r){var i=ug(e),o=new m_(n).map(function(s){return s.size});return i.size=r?o.max():o.min(),i.__iterate=function(s,a){for(var c,l=this.__iterator(Yh,a),u=0;!(c=l.next()).done&&!1!==s(c.value,u++,this););return u},i.__iteratorUncached=function(s,a){var l=n.map(function(d){return d=aa(d),nV(a?d.reverse():d)}),c=0,u=!1;return new ao(function(){var d;return u||(d=l.map(function(f){return f.next()}),u=r?d.every(function(f){return f.done}):d.some(function(f){return f.done})),u?{value:void 0,done:!0}:Ts(s,c++,t.apply(null,d.map(function(f){return f.value})))})},i}function Qo(e,t){return e===t?e:O5(e)?t:e.constructor(t)}function Sce(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function bV(e){return fs(e)?Sp:Jc(e)?p_:Tw}function ug(e){return Object.create((fs(e)?R1:Jc(e)?Ip:kw).prototype)}function vV(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):zu.prototype.cacheResult.call(this)}function Cce(e,t){return void 0===e&&void 0===t?0:void 0===e?1:void 0===t?-1:e>t?1:e0;)t[n]=arguments[n+1];if("function"!=typeof e)throw new TypeError("Invalid merger function: "+e);return Rce(this,t,e)}function Rce(e,t,n){for(var r=[],i=0;i0;)t[n]=arguments[n+1];return sD(this,t,e)}function TV(e){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];return y_(this,e,Xh(),function(r){return aD(r,t)})}function DV(e){for(var t=[],n=arguments.length-1;n-- >0;)t[n]=arguments[n+1];return y_(this,e,Xh(),function(r){return sD(r,t)})}function lD(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}function cD(){return this.__ownerID?this:this.__ensureOwner(new J7)}function uD(){return this.__ensureOwner()}function PV(){return this.__altered}var Af=function(e){function t(n){return null==n?Xh():j5(n)&&!wp(n)?n:Xh().withMutations(function(r){var i=e(n);wf(i.size),i.forEach(function(o,s){return r.set(s,o)})})}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.of=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];return Xh().withMutations(function(o){for(var s=0;s=r.length)throw new Error("Missing value for key: "+r[s]);o.set(r[s],r[s+1])}})},t.prototype.toString=function(){return this.__toString("Map {","}")},t.prototype.get=function(r,i){return this._root?this._root.get(0,void 0,r,i):i},t.prototype.set=function(r,i){return Lce(this,r,i)},t.prototype.remove=function(r){return Lce(this,r,zi)},t.prototype.deleteAll=function(r){var i=aa(r);return 0===i.size?this:this.withMutations(function(o){i.forEach(function(s){return o.remove(s)})})},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Xh()},t.prototype.sort=function(r){return Nc(Mw(this,r))},t.prototype.sortBy=function(r,i){return Nc(Mw(this,i,r))},t.prototype.map=function(r,i){var o=this;return this.withMutations(function(s){s.forEach(function(a,l){s.set(l,r.call(i,a,l,o))})})},t.prototype.__iterator=function(r,i){return new pGe(this,r,i)},t.prototype.__iterate=function(r,i){var o=this,s=0;return this._root&&this._root.iterate(function(a){return s++,r(a[1],a[0],o)},i),s},t.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?MV(this.size,this._root,r,this.__hash):0===this.size?Xh():(this.__ownerID=r,this.__altered=!1,this)},t}(Sp);Af.isMap=j5;var Ds=Af.prototype;Ds[ace]=!0,Ds[J3]=Ds.remove,Ds.removeAll=Ds.deleteAll,Ds.setIn=CV,Ds.removeIn=Ds.deleteIn=wV,Ds.update=IV,Ds.updateIn=EV,Ds.merge=Ds.concat=kce,Ds.mergeWith=Mce,Ds.mergeDeep=Nce,Ds.mergeDeepWith=Fce,Ds.mergeIn=TV,Ds.mergeDeepIn=DV,Ds.withMutations=lD,Ds.wasAltered=PV,Ds.asImmutable=uD,Ds["@@transducer/init"]=Ds.asMutable=cD,Ds["@@transducer/step"]=function(e,t){return e.set(t[0],t[1])},Ds["@@transducer/result"]=function(e){return e.asImmutable()};var dD=function(t,n){this.ownerID=t,this.entries=n};dD.prototype.get=function(t,n,r,i){for(var o=this.entries,s=0,a=o.length;s=vGe)return function hGe(e,t,n,r){e||(e=new J7);for(var i=new ly(e,Id(n),[n,r]),o=0;o>>t)&Lu),s=this.bitmap;return s&o?this.nodes[Uce(s&o-1)].get(t+Es,n,r,i):i},Rw.prototype.update=function(t,n,r,i,o,s,a){void 0===r&&(r=Id(i));var l=(0===n?r:r>>>n)&Lu,c=1<=xGe)return function gGe(e,t,n,r,i){for(var o=0,s=new Array(xp),a=0;0!==n;a++,n>>>=1)s[a]=1&n?t[o++]:void 0;return s[r]=i,new fD(e,o+1,s)}(t,p,u,l,h);if(d&&!h&&2===p.length&&jce(p[1^f]))return p[1^f];if(d&&h&&1===p.length&&jce(h))return h;var g=t&&t===this.ownerID,y=d?h?u:u^c:u|c,v=d?h?zce(p,f,h,g):function bGe(e,t,n){var r=e.length-1;if(n&&t===r)return e.pop(),e;for(var i=new Array(r),o=0,s=0;s>>t)&Lu];return s?s.get(t+Es,n,r,i):i},fD.prototype.update=function(t,n,r,i,o,s,a){void 0===r&&(r=Id(i));var l=(0===n?r:r>>>n)&Lu,u=this.nodes,d=u[l];if(o===zi&&!d)return this;var f=RV(d,t,n+Es,r,i,o,s,a);if(f===d)return this;var p=this.count;if(d){if(!f&&--p<_Ge)return function mGe(e,t,n,r){for(var i=0,o=0,s=new Array(n),a=0,l=1,c=t.length;a>>n)&Lu,s=(0===n?r:r>>>n)&Lu,l=o===s?[NV(e,t,n+Es,r,i)]:(a=new ly(t,r,i),o>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,127&(e+=e>>8)+(e>>16)}function zce(e,t,n,r){var i=r?e:dg(e);return i[t]=n,i}var vGe=xp/4,xGe=xp/2,_Ge=xp/4,Vce="@@__IMMUTABLE_LIST__@@";function FV(e){return!(!e||!e[Vce])}var cy=function(e){function t(n){var r=q5();if(null==n)return r;if(FV(n))return n;var i=e(n),o=i.size;return 0===o?r:(wf(o),o>0&&o=0&&r=e.size||t<0)return e.withMutations(function(s){t<0?O1(s,t).set(0,n):O1(s,0,t+1).set(t,n)});var r=e._tail,i=e._root,o={value:!1};return(t+=e._origin)>=mD(e._capacity)?r=OV(r,e.__ownerID,0,t,n,o):i=OV(i,e.__ownerID,e._level,t,n,o),o.value?e.__ownerID?(e._root=i,e._tail=r,e.__hash=void 0,e.__altered=!0,e):hD(e._origin,e._capacity,e._level,i,r):e}(this,r,i)},t.prototype.remove=function(r){return this.has(r)?0===r?this.shift():r===this.size-1?this.pop():this.splice(r,1):this},t.prototype.insert=function(r,i){return this.splice(r,0,i)},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=Es,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):q5()},t.prototype.push=function(){var r=arguments,i=this.size;return this.withMutations(function(o){O1(o,0,i+r.length);for(var s=0;s>>n&Lu;if(i>=this.array.length)return new F1([],t);var s,o=0===i;if(n>0){var a=this.array[i];if((s=a&&a.removeBefore(t,n-Es,r))===a&&o)return this}if(o&&!s)return this;var l=Fw(this,t);if(!o)for(var c=0;c>>n&Lu;if(i>=this.array.length)return this;if(n>0){var s=this.array[i];if((o=s&&s.removeAfter(t,n-Es,r))===s&&i===this.array.length-1)return this}var a=Fw(this,t);return a.array.splice(i+1),o&&(a.array[i]=o),a};var Gce,pD={};function Hce(e,t){var n=e._origin,r=e._capacity,i=mD(r),o=e._tail;return function s(c,u,d){return 0===u?function a(c,u){var d=u===i?o&&o.array:c&&c.array,f=u>n?0:n-u,p=r-u;return p>xp&&(p=xp),function(){if(f===p)return pD;var m=t?--p:f++;return d&&d[m]}}(c,d):function l(c,u,d){var f,p=c&&c.array,m=d>n?0:n-d>>u,h=1+(r-d>>u);return h>xp&&(h=xp),function(){for(;;){if(f){var g=f();if(g!==pD)return g;f=null}if(m===h)return pD;var y=t?--h:m++;f=s(p&&p[y],u-Es,d+(y<>>n&Lu,a=e&&s0){var c=e&&e.array[s],u=OV(c,t,n-Es,r,i,o);return u===c?e:((l=Fw(e,t)).array[s]=u,l)}return a&&e.array[s]===i?e:(o&&_p(o),l=Fw(e,t),void 0===i&&s===l.array.length-1?l.array.pop():l.array[s]=i,l)}function Fw(e,t){return t&&e&&t===e.ownerID?e:new F1(e?e.array.slice():[],t)}function qce(e,t){if(t>=mD(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&Lu],r-=Es;return n}}function O1(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new J7,i=e._origin,o=e._capacity,s=i+t,a=void 0===n?o:n<0?o+n:i+n;if(s===i&&a===o)return e;if(s>=a)return e.clear();for(var l=e._level,c=e._root,u=0;s+u<0;)c=new F1(c&&c.array.length?[void 0,c]:[],r),u+=1<<(l+=Es);u&&(s+=u,i+=u,a+=u,o+=u);for(var d=mD(o),f=mD(a);f>=1<d?new F1([],r):p;if(p&&f>d&&sEs;g-=Es){var y=d>>>g&Lu;h=h.array[y]=Fw(h.array[y],r)}h.array[d>>>Es&Lu]=p}if(a=f)s-=f,a-=f,l=Es,c=null,m=m&&m.removeBefore(r,0,s);else if(s>i||f>>l&Lu;if(v!==f>>>l&Lu)break;v&&(u+=(1<i&&(c=c.removeBefore(r,l,s-u)),c&&f>>Es<=xp&&i.size>=2*r.size?(a=(l=i.filter(function(c,u){return void 0!==c&&o!==u})).toKeyedSeq().map(function(c){return c[0]}).flip().toMap(),e.__ownerID&&(a.__ownerID=l.__ownerID=e.__ownerID)):(a=r.remove(t),l=o===i.size-1?i.pop():i.set(o,void 0))}else if(s){if(n===i.get(o)[1])return e;a=r,l=i.set(o,[t,n])}else a=r.set(t,i.size),l=i.set(i.size,[t,n]);return e.__ownerID?(e.size=a.size,e._map=a,e._list=l,e.__hash=void 0,e.__altered=!0,e):BV(a,l)}Nc.isOrderedMap=lV,Nc.prototype[Dw]=!0,Nc.prototype[J3]=Nc.prototype.remove;var Yce="@@__IMMUTABLE_STACK__@@";function W5(e){return!(!e||!e[Yce])}var $5=function(e){function t(n){return null==n?Y5():W5(n)?n:Y5().pushAll(n)}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("Stack [","]")},t.prototype.get=function(r,i){var o=this._head;for(r=M1(this,r);o&&r--;)o=o.next;return o?o.value:i},t.prototype.peek=function(){return this._head&&this._head.value},t.prototype.push=function(){var r=arguments;if(0===arguments.length)return this;for(var i=this.size+arguments.length,o=this._head,s=arguments.length-1;s>=0;s--)o={value:r[s],next:o};return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):yD(i,o)},t.prototype.pushAll=function(r){if(0===(r=e(r)).size)return this;if(0===this.size&&W5(r))return r;wf(r.size);var i=this.size,o=this._head;return r.__iterate(function(s){i++,o={value:s,next:o}},!0),this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):yD(i,o)},t.prototype.pop=function(){return this.slice(1)},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Y5()},t.prototype.slice=function(r,i){if(eD(r,i,this.size))return this;var o=Ew(r,this.size);if(tD(i,this.size)!==this.size)return e.prototype.slice.call(this,r,i);for(var a=this.size-o,l=this._head;o--;)l=l.next;return this.__ownerID?(this.size=a,this._head=l,this.__hash=void 0,this.__altered=!0,this):yD(a,l)},t.prototype.__ensureOwner=function(r){return r===this.__ownerID?this:r?yD(this.size,this._head,r,this.__hash):0===this.size?Y5():(this.__ownerID=r,this.__altered=!1,this)},t.prototype.__iterate=function(r,i){var o=this;if(i)return new m_(this.toArray()).__iterate(function(l,c){return r(l,c,o)},i);for(var s=0,a=this._head;a&&!1!==r(a.value,s++,this);)a=a.next;return s},t.prototype.__iterator=function(r,i){if(i)return new m_(this.toArray()).__iterator(r,i);var o=0,s=this._head;return new ao(function(){if(s){var a=s.value;return s=s.next,Ts(r,o++,a)}return{value:void 0,done:!0}})},t}(p_);$5.isStack=W5;var Xce,Vu=$5.prototype;function yD(e,t,n,r){var i=Object.create(Vu);return i.size=e,i._head=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function Y5(){return Xce||(Xce=yD(0))}Vu[Yce]=!0,Vu.shift=Vu.pop,Vu.unshift=Vu.push,Vu.unshiftAll=Vu.pushAll,Vu.withMutations=lD,Vu.wasAltered=PV,Vu.asImmutable=uD,Vu["@@transducer/init"]=Vu.asMutable=cD,Vu["@@transducer/step"]=function(e,t){return e.unshift(t)},Vu["@@transducer/result"]=function(e){return e.asImmutable()};var Kce="@@__IMMUTABLE_SET__@@";function X5(e){return!(!e||!e[Kce])}function LV(e){return X5(e)&&wp(e)}function jV(e,t){if(e===t)return!0;if(!ju(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||fs(e)!==fs(t)||Jc(e)!==Jc(t)||wp(e)!==wp(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!nD(e);if(wp(e)){var r=e.entries();return t.every(function(l,c){var u=r.next().value;return u&&oc(u[1],l)&&(n||oc(u[0],c))})&&r.next().done}var i=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{i=!0;var o=e;e=t,t=o}var s=!0,a=t.__iterate(function(l,c){if(n?!e.has(l):i?!oc(l,e.get(c,zi)):!oc(e.get(c,zi),l))return s=!1,!1});return s&&e.size===a}function b_(e,t){var n=function(r){e.prototype[r]=t[r]};return Object.keys(t).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(n),e}function K5(e){if(!e||"object"!=typeof e)return e;if(!ju(e)){if(!N1(e))return e;e=zu(e)}if(fs(e)){var t={};return e.__iterate(function(r,i){t[i]=K5(r)}),t}var n=[];return e.__iterate(function(r){n.push(K5(r))}),n}var bD=function(e){function t(n){return null==n?vD():X5(n)&&!wp(n)?n:vD().withMutations(function(r){var i=e(n);wf(i.size),i.forEach(function(o){return r.add(o)})})}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(r){return this(Sp(r).keySeq())},t.intersect=function(r){return(r=aa(r).toArray()).length?Fc.intersect.apply(t(r.pop()),r):vD()},t.union=function(r){return(r=aa(r).toArray()).length?Fc.union.apply(t(r.pop()),r):vD()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(r){return this._map.has(r)},t.prototype.add=function(r){return Z5(this,this._map.set(r,r))},t.prototype.remove=function(r){return Z5(this,this._map.remove(r))},t.prototype.clear=function(){return Z5(this,this._map.clear())},t.prototype.map=function(r,i){var o=this,s=!1,a=Z5(this,this._map.mapEntries(function(l){var c=l[1],u=r.call(i,c,c,o);return u!==c&&(s=!0),[u,u]},i));return s?a:this},t.prototype.union=function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];return 0===(r=r.filter(function(o){return 0!==o.size})).length?this:0!==this.size||this.__ownerID||1!==r.length?this.withMutations(function(o){for(var s=0;s=0&&i=0&&o>>-15,461845907),t=iD(t<<13|t>>>-13,5),t=iD((t=t+3864292196^e)^t>>>16,2246822507),t=U5((t=iD(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(n?t?function(o,s){r=31*r+aue(Id(o),Id(s))|0}:function(o,s){r=r+aue(Id(o),Id(s))|0}:t?function(o){r=31*r+Id(o)|0}:function(o){r=r+Id(o)|0}),r)}(this))}});var eu=aa.prototype;eu[Qle]=!0,eu[B5]=eu.values,eu.toJSON=eu.toArray,eu.__toStringMapper=oD,eu.inspect=eu.toSource=function(){return this.toString()},eu.chain=eu.flatMap,eu.contains=eu.includes,b_(Sp,{flip:function(){return Qo(this,gce(this))},mapEntries:function(t,n){var r=this,i=0;return Qo(this,this.toSeq().map(function(o,s){return t.call(n,[s,o],i++,r)}).fromEntrySeq())},mapKeys:function(t,n){var r=this;return Qo(this,this.toSeq().flip().map(function(i,o){return t.call(n,i,o,r)}).flip())}});var xD=Sp.prototype;xD[Jle]=!0,xD[B5]=eu.entries,xD.toJSON=nue,xD.__toStringMapper=function(e,t){return oD(t)+": "+oD(e)},b_(p_,{toKeyedSeq:function(){return new z5(this,!1)},filter:function(t,n){return Qo(this,bce(this,t,n,!1))},findIndex:function(t,n){var r=this.findEntry(t,n);return r?r[0]:-1},indexOf:function(t){var n=this.keyOf(t);return void 0===n?-1:n},lastIndexOf:function(t){var n=this.lastKeyOf(t);return void 0===n?-1:n},reverse:function(){return Qo(this,gV(this,!1))},slice:function(t,n){return Qo(this,yV(this,t,n,!1))},splice:function(t,n){var r=arguments.length;if(n=Math.max(n||0,0),0===r||2===r&&!n)return this;t=Ew(t,t<0?this.count():this.size);var i=this.slice(0,t);return Qo(this,1===r?i:i.concat(dg(arguments,2),this.slice(t+n)))},findLastIndex:function(t,n){var r=this.findLastEntry(t,n);return r?r[0]:-1},first:function(t){return this.get(0,t)},flatten:function(t){return Qo(this,xce(this,t,!1))},get:function(t,n){return(t=M1(this,t))<0||this.size===1/0||void 0!==this.size&&t>this.size?n:this.find(function(r,i){return i===t},void 0,n)},has:function(t){return(t=M1(this,t))>=0&&(void 0!==this.size?this.size===1/0||tt?-1:0}function aue(e,t){return e^t+2654435769+(e<<6)+(e>>2)}Bw.has=eu.includes,Bw.contains=Bw.includes,Bw.keys=Bw.values,b_(R1,xD),b_(Ip,Ow),b_(kw,Bw);var Ep=function(e){function t(n){return null==n?HV():LV(n)?n:HV().withMutations(function(r){var i=Tw(n);wf(i.size),i.forEach(function(o){return r.add(o)})})}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(r){return this(Sp(r).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t}(bD);Ep.isOrderedSet=LV;var cue,v_=Ep.prototype;function lue(e,t){var n=Object.create(v_);return n.size=e?e.size:0,n._map=e,n.__ownerID=t,n}function HV(){return cue||(cue=lue(gD()))}v_[Dw]=!0,v_.zip=Ow.zip,v_.zipWith=Ow.zipWith,v_.zipAll=Ow.zipAll,v_.__empty=HV,v_.__make=lue;var jl=function(t,n){var r;!function DGe(e){if(h_(e))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(Cp(e))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(null===e||"object"!=typeof e)throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}(t);var i=function(a){var l=this;if(a instanceof i)return a;if(!(this instanceof i))return new i(a);if(!r){r=!0;var c=Object.keys(t),u=o._indices={};o._name=n,o._keys=c,o._defaultValues=t;for(var d=0;d({action:o,params:s}),id:oo.create22(),definition:i,createDefaultParams:(s,a)=>i.params?I.getDefaultValues(i.params(s,a)):{}};return o}let r;e.create=t,e.fromTransformer=function n(i){const o=i.definition;return t({from:o.from,display:o.display,params:o.params,isApplicable:i.definition.isApplicable?(s,a,l)=>i.definition.isApplicable(s,l):void 0,run({cell:s,state:a,params:l}){const c=a.build().to(s.transform.ref).apply(i,l);return a.updateTree(c)}})},(r=e.Builder||(e.Builder={})).build=s=>function o(s){return a=>t({from:s.from instanceof Array?s.from:s.from?[s.from]:[],display:"string"==typeof s.display?{name:s.display}:s.display?s.display:{name:"Unnamed State Action"},params:"object"==typeof s.params?()=>s.params:s.params?s.params:void 0,isApplicable:s.isApplicable,..."function"==typeof a?{run:a}:a})}(s),e.build=r.build}(Hu||(Hu={})),function(e){let r;var h;e.getParamDefinition=function t(h,g,y){return h.definition.params?h.definition.params(g,y):{}},e.is=function n(h){return!!h&&"function"==typeof h.toAction&&"function"==typeof h.apply},(h=r=e.UpdateResult||(e.UpdateResult={}))[h.Unchanged=0]="Unchanged",h[h.Updated=1]="Updated",h[h.Recreate=2]="Recreate",h[h.Null=3]="Null";const i=new Map,o=new Map;function u(h,g){const{name:y}=g,v=`${h}.${y}`;if(i.has(v))throw new Error(`A transform with id '${y}' is already registered. Please pick a unique identifier for your transforms and/or register them only once. This is to ensure that transforms can be serialized and replayed.`);const x={apply:(_,w,A)=>vr.create(_,x,w,A),toAction:()=>Hu.fromTransformer(x),namespace:h,id:v,definition:g,createDefaultParams:(_,w)=>g.params?I.getDefaultValues(g.params(_,w)):{}};return i.set(v,x),function s(h){for(const g of h.definition.from)o.has(g.type)?o.get(g.type).push(h):o.set(g.type,[h])}(x),x}let p;e.getAll=function a(){return Array.from(i.values())},e.get=function l(h){const g=i.get(h);if(!g)throw new Error(`A transformer with signature '${h}' is not registered.`);return g},e.fromType=function c(h){return o.get(h)||[]},e.create=u,e.factory=function d(h){return g=>u(h,g)},e.builderFactory=function f(h){return p.build(h)},function(h){h.build=function y(v){return x=>function g(v,x){return _=>u(v,{name:x.name,from:x.from instanceof Array?x.from:[x.from],to:x.to instanceof Array?x.to:[x.to],display:"string"==typeof x.display?{name:x.display}:x.display?x.display:{name:y1(x.name.replace(/[-]/g," "))},params:"object"==typeof x.params?()=>x.params:x.params?x.params:void 0,isDecorator:x.isDecorator,..._})}(v,x)}}(p=e.Builder||(e.Builder={})),e.build=function m(h){return p.build(h)},e.ROOT=u("build-in",{name:"root",from:[],to:[],display:{name:"Root",description:"For internal use."},apply(){throw new Error("should never be applied")},update:()=>r.Unchanged})}(yt||(yt={})),function(e){function o(g,y,v,x){const _=x&&x.ref?x.ref:oo.create22();let w;return x&&x.tags&&(w="string"==typeof x.tags?[x.tags]:x.tags,0===w.length?w=void 0:w.sort()),{parent:g,transformer:y,state:x?.state||{},tags:w,ref:_,dependsOn:x&&x.dependsOn,params:v,version:oo.create22()}}function d(g,y){return!!g.tags&&g.tags.indexOf(y)>=0}function p(g){return g}e.RootRef="-=root=-",e.areStatesEqual=function t(g,y){return!!g.isHidden!=!!y.isHidden||!!g.isCollapsed!=!!y.isCollapsed||!!g.isGhost!=!!y.isGhost||!!g.isLocked!=!!y.isLocked},e.isStateChange=function n(g,y){return!!y&&(typeof y.isCollapsed<"u"&&g.isCollapsed!==y.isCollapsed||typeof y.isHidden<"u"&&g.isHidden!==y.isHidden||typeof y.isGhost<"u"&&g.isGhost!==y.isGhost||typeof y.isLocked<"u"&&g.isLocked!==y.isLocked)},e.assignState=function r(g,y){if(!y)return!1;let v=!1;for(const x of Object.keys(y)){const _=y[x];!!_!=!!g[x]&&(v=!0,g[x]=_)}return v},e.syncState=function i(g,y){if(!y)return!1;let v=!1;for(const x of Object.keys(y)){const _=y[x];!!_!=!!g[x]&&(v=!0,void 0!==_?g[x]=_:delete g[x])}for(const x of Object.keys(g)){const _=y[x];!!_!=!!g[x]&&(v=!0,void 0!==_?g[x]=_:delete g[x])}return v},e.create=o,e.withParams=function s(g,y){return{...g,params:y,version:oo.create22()}},e.withState=function a(g,y){return y?{...g,state:{...g.state,...y}}:g},e.withTags=function l(g,y){let v;return y&&(v="string"==typeof y?[y]:y,0===v.length?v=void 0:v.sort()),{...g,tags:v,version:oo.create22()}},e.withParent=function c(g,y){return{...g,parent:y,version:oo.create22()}},e.createRoot=function u(g){return o(e.RootRef,yt.ROOT,{},{ref:e.RootRef,state:g})},e.hasTag=d,e.hasTags=function f(g,y){if(!g.tags)return"string"!=typeof y&&0===y.length;if("string"==typeof y)return d(g,y);for(const v of y)if(g.tags.indexOf(v)<0)return!1;return!0},e.toJSON=function m(g){const y=g.transformer.definition.customSerialization?g.transformer.definition.customSerialization.toJSON:p;let v;for(const x of Object.keys(g.state))g.state[x]&&(v||(v={}),v[x]=!0);return{parent:g.parent,transformer:g.transformer.id,params:g.params?y(g.params):void 0,state:v,tags:g.tags,ref:g.ref,dependsOn:g.dependsOn,version:g.version}},e.fromJSON=function h(g){const y=yt.get(g.transformer);return{parent:g.parent,transformer:y,params:g.params?(y.definition.customSerialization?y.definition.customSerialization.fromJSON:p)(g.params):void 0,state:g.state||{},tags:g.tags,ref:g.ref,dependsOn:g.dependsOn,version:g.version}}}(vr||(vr={}));class FGe{get childMutations(){return this._childMutations||(this._childMutations=new Map),this._childMutations}get dependencyMutations(){return this._dependencyMutations||(this._dependencyMutations=new Map),this._dependencyMutations}changeNodes(){this.changedNodes||(this.changedNodes=!0,this.transforms=this.transforms.asMutable())}changeChildren(){this.changedChildren||(this.changedChildren=!0,this.children=this.children.asMutable())}changeDependencies(){this.changedDependencies||(this.changedDependencies=!0,this.dependencies=this.dependencies.asMutable())}get root(){return this.transforms.get(vr.RootRef)}asTransient(){return this.asImmutable().asTransient()}addChild(t,n){if(this.changeChildren(),this.childMutations.has(t))this.childMutations.get(t).add(n);else{const r=this.children.get(t).asMutable();r.add(n),this.children.set(t,r),this.childMutations.set(t,r)}}removeChild(t,n){if(this.changeChildren(),this.childMutations.has(t))this.childMutations.get(t).remove(n);else{const r=this.children.get(t).asMutable();r.remove(n),this.children.set(t,r),this.childMutations.set(t,r)}}clearRoot(){const t=vr.RootRef;if(0===this.children.get(t).size)return;this.changeChildren();const n=Ep();this.children.set(t,n),this.childMutations.set(t,n)}mutateDependency(t,n,r){let i=this.dependencyMutations.get(t);if(!i){const o=this.dependencies.get(t);if(!o&&"remove"===r)return;this.changeDependencies(),i=o?o.asMutable():Ep().asMutable(),this.dependencyMutations.set(t,i),this.dependencies.set(t,i)}"add"===r?i.add(n):i.remove(n)}changeParent(t,n){Q5(this.transforms,t);const r=this.transforms.get(t);this.removeChild(r.parent,t),this.addChild(n,t),this.changeNodes(),this.transforms.set(t,vr.withParent(r,n))}add(t){const n=t.ref;this.transforms.has(t.ref)&&this.transforms.get(t.ref).parent!==t.parent&&function LGe(e){throw new Error(`Transform '${e}' is already present in the tree.`)}(t.ref);const r=this.children.get(t.parent);if(r||function jGe(e){throw new Error(`Parent '${e}' must be present in the tree.`)}(t.parent),r.has(t.ref)||this.addChild(t.parent,t.ref),this.children.has(t.ref)||(this.changedChildren||(this.changedChildren=!0,this.children=this.children.asMutable()),this.children.set(t.ref,Ep())),this.changeNodes(),this.transforms.set(n,t),t.dependsOn)for(const i of t.dependsOn)this.mutateDependency(i,n,"add");return this}setParams(t,n){Q5(this.transforms,t);const r=this.transforms.get(t);return!FR(r.params,n)&&(this.changedNodes||(this.changedNodes=!0,this.transforms=this.transforms.asMutable()),this.transforms.set(r.ref,vr.withParams(r,n)),!0)}setTags(t,n){Q5(this.transforms,t);const r=this.transforms.get(t),i=vr.withParams(r,n);return!IU(r.tags,i.tags)&&(this.changedNodes||(this.changedNodes=!0,this.transforms=this.transforms.asMutable()),this.transforms.set(r.ref,i),!0)}assignState(t,n){Q5(this.transforms,t);const r=this.transforms.get(t);if(this._stateUpdates&&this._stateUpdates.has(t))return vr.assignState(r.state,n),r;{this._stateUpdates||(this._stateUpdates=new Set),this._stateUpdates.add(r.ref),this.changeNodes();const i=vr.withState(r,n);return this.transforms.set(t,i),i}}remove(t){const n=this.transforms.get(t);if(!n)return[];const r=la.subtreePostOrder(this,n);if(t===vr.RootRef){if(r.pop(),0===r.length)return r;this.clearRoot()}else{if(0===r.length)return r;this.removeChild(n.parent,n.ref)}this.changeNodes(),this.changeChildren();for(const o of r)this.transforms.delete(o.ref),this.children.delete(o.ref),this._childMutations&&this._childMutations.delete(o.ref);const i=[];for(const o of r){if(o.dependsOn)for(const s of o.dependsOn)this.transforms.has(s)&&this.mutateDependency(s,o.ref,"remove");if(this.dependencies.has(o.ref)){const s=this.dependencies.get(o.ref).toArray();this.changeDependencies(),this.dependencies.delete(o.ref),this._dependencyMutations&&this._dependencyMutations.delete(o.ref);for(const a of s)if(this.transforms.has(a))for(const l of this.remove(a))i[i.length]=l}}for(const o of i)r[r.length]=o;return r}asImmutable(){return this.changedNodes||this.changedChildren||this._childMutations?(this._childMutations&&this._childMutations.forEach(OGe,this.children),this._dependencyMutations&&this._dependencyMutations.forEach(BGe,this.dependencies),la.create(this.changedNodes?this.transforms.asImmutable():this.transforms,this.changedChildren?this.children.asImmutable():this.children,this.changedDependencies?this.dependencies.asImmutable():this.dependencies)):this.tree}constructor(t){this.tree=t,this.transforms=this.tree.transforms,this.children=this.tree.children,this.dependencies=this.tree.dependencies,this.changedNodes=!1,this.changedChildren=!1,this.changedDependencies=!1,this._childMutations=void 0,this._dependencyMutations=void 0,this._stateUpdates=void 0}}function OGe(e,t){this.set(t,e.asImmutable())}function BGe(e,t){0===e.size?this.delete(t):this.set(t,e.asImmutable())}function Q5(e,t){if(!e.has(t))throw new Error(`Node '${t}' is not present in the tree.`)}!function(e){class t{get root(){return this.transforms.get(vr.RootRef)}asTransient(){return new FGe(this)}constructor(_,w,A){this.transforms=_,this.children=w,this.dependencies=A}}function r(x,_,w){return new t(x,_,w)}function i(x){o(this,this.tree.transforms.get(x))}function o(x,_){const w=x.tree.children.get(_.ref);w&&w.size&&w.forEach(i,x),x.f(_,x.tree,x.state)}function s(x,_,w,A){const M={tree:x,state:w,f:A};return o(M,_),M.state}function a(x){l(this,this.tree.transforms.get(x))}function l(x,_){const w=x.f(_,x.tree,x.state);if("boolean"==typeof w&&!w)return;const A=x.tree.children.get(_.ref);A&&A.size&&A.forEach(a,x)}function c(x,_,w,A){const M={tree:x,state:w,f:A};return l(M,_),M.state}function u(x,_,w){w.push(x)}function f(x,_,w){w.push(vr.toJSON(x))}function g(x,_,w){if(_===w)return!0;const M=x.children.get(_).values();for(;;){const E=M.next();if(E.done)return!1;if(g(x,E.value,w))return!0}}e.createEmpty=function n(x){const _=x||vr.createRoot();return r(Af([[_.ref,_]]),Af([[_.ref,Ep()]]),Af())},e.create=r,e.doPostOrder=s,e.doPreOrder=c,e.subtreePostOrder=function d(x,_){return s(x,_,[],u)},e.toJSON=function p(x){const _=[];return c(x,x.root,_,f),{transforms:_}},e.fromJSON=function m(x){const _=Af().asMutable(),w=Af().asMutable(),A=Af().asMutable();for(const E of x.transforms){const D=vr.fromJSON(E);_.set(D.ref,D),w.has(D.ref)||w.set(D.ref,Ep().asMutable()),D.ref!==D.parent&&w.get(D.parent).add(D.ref)}const M=new Set;for(const E of x.transforms){const D=E.ref;if(w.set(D,w.get(D).asImmutable()),E.dependsOn)for(const T of E.dependsOn)M.add(T),A.has(T)?A.get(T).add(D):A.set(T,Ep([D]).asMutable())}return M.forEach(E=>{A.set(E,A.get(E).asImmutable())}),r(_.asImmutable(),w.asImmutable(),A.asImmutable())},e.dump=function h(x){console.log({tr:x.transforms.keySeq().toArray(),tr1:x.transforms.valueSeq().toArray().map(_=>_.ref),ch:x.children.keySeq().toArray()})},e.subtreeHasRef=function y(x,_,w){return!(!x.transforms.has(_)||!x.transforms.has(w))&&g(x,_,w)},e.getDecoratorRoot=function v(x,_){const w=x.children.get(_);if(1!==w.size)return _;const A=x.transforms.get(w.first());return A.transformer.definition.isDecorator?v(x,A.ref):_}}(la||(la={})),function(e){function t(G,Z){return n(G)(Z)}function n(G){const Z=G||c.root;let ee;return ee=function i(G){return void 0!==G.compile}(Z)?Z.compile():function r(G){return void 0!==G.transform&&void 0!==G.status}(Z)?c.byValue(Z).compile():function o(G){return"function"==typeof G}(Z)?Z:c.byRef(Z).compile(),ee}e.select=t,e.compile=n;const s={select(G){return t(this,G||this.state)}};function a(G,Z){s[G]=function(...ee){return Z.call(void 0,this,...ee)}}function l(G){return Object.create(s,{compile:{writable:!1,configurable:!1,value:G}})}let c;function u(G,Z){const ee=n(G);return l(()=>se=>{const xe=[];for(const re of ee(se))for(const ae of Z(re,se))xe.push(ae);return xe})}function d(G,Z){const ee=n(G);return l(()=>se=>{const xe=[];for(const re of ee(se)){const ae=Z(re,se);ae&&xe.push(ae)}return xe})}function f(G){const Z=n(G);return l(()=>ee=>{const se=new Set,xe=[];for(const re of Z(ee))re&&(se.has(re.transform.ref)||(se.add(re.transform.ref),xe.push(re)));return xe})}function p(G){const Z=n(G);return l(()=>ee=>{const se=Z(ee);return se.length?[se[0]]:[]})}function m(G,Z){return u(G,ee=>Z(ee)?[ee]:[])}function h(G,Z){return m(G,ee=>ee.status===Z)}function g(G,Z){return m(G,ee=>!!ee.transform.tags&&ee.transform.tags.indexOf(Z)>=0)}function y(G){return u(G,(Z,ee)=>{const se=[];return la.doPreOrder(ee.tree,ee.tree.transforms.get(Z.transform.ref),se,(xe,re,ae)=>{ae.push(xe.ref)}),se.map(xe=>ee.cells.get(xe))})}function v(G){return u(G,(Z,ee)=>{const se=[];return ee.tree.children.get(Z.transform.ref).forEach(xe=>se.push(ee.cells.get(xe))),se})}function x(G,Z){return m(G,ee=>!!ee.obj&&ee.obj.type===Z.type)}function _(G,Z){return f(d(G,(ee,se)=>R(se.tree,se.cells,ee.transform.ref,Z)))}function w(G,Z){return f(d(G,(ee,se)=>W(se.tree,se.cells,ee.transform.ref,Z)))}function A(G,Z){return f(d(G,(ee,se)=>j(se.tree,se.cells,ee.transform.ref,Z)))}function M(G,Z){return m(G,ee=>ee.transform.transformer===Z)}function E(G,Z){return f(d(G,(ee,se)=>N(se.tree,se.cells,ee.transform.ref,Z)))}function D(G,Z){return f(d(G,(ee,se)=>z(se.tree,se.cells,ee.transform.ref,Z)))}function T(G){return f(d(G,(Z,ee)=>ee.cells.get(ee.tree.transforms.get(Z.transform.ref).parent)))}function F(G,Z,ee,se,xe){let ae,re=G.transforms.get(ee);for(;;){re=G.transforms.get(re.parent);const ge=Z.get(re.ref);if(ge.obj&&se(ge)&&(ae=ge,xe)||re.ref===vr.RootRef)return ae}}function R(G,Z,ee,se){return F(G,Z,ee,se,!0)}function N(G,Z,ee,se){return F(G,Z,ee,se,!1)}function j(G,Z,ee,se){return R(G,Z,ee,Array.isArray(se)?xe=>se.indexOf(xe.transform.transformer)>=0:xe=>xe.transform.transformer===se)}function W(G,Z,ee,se){return R(G,Z,ee,$(se))}function z(G,Z,ee,se){return N(G,Z,ee,$(se))}function $(G){return Array.isArray(G)?Z=>{for(const ee of G)if(ee.type===Z.obj.type)return!0}:Z=>Z.obj.type===G.type}function X(G,Z,ee){if(G.tags)for(const se of G.tags)if(ee.tags.has(se)){ee.refs[se]=G.ref;break}return!0}function oe(G,Z,ee){return!(G.tags&&G.tags.indexOf(ee.tag)>=0&&(ee.ref=G.ref,1))}function K(G,Z,ee){if(G.tags){const se=ee.tags.size;let xe=0;for(const re of G.tags)if(ee.tags.has(re)&&(xe++,xe===se)){ee.refs.push(G);break}}else 0===ee.tags.size&&ee.refs.push(G)}(function(G){function ge(he,ie,ue){const _e=ue.cells.get(he.ref);return!_e||!_e.obj||_e.obj.type!==ue.type||(ue.roots.push(_e),!1)}function Ie(he,ie,ue){const _e=ue.cells.get(he.ref);return _e&&_e.obj&&_e.obj.type===ue.type&&ue.ret.push(_e),!0}function me(he,ie,ue){const _e=ue.cells.get(he.ref);return _e&&_e.obj&&_e.transform.transformer===ue.t&&ue.ret.push(_e),!0}function Ae(he,ie,ue){const _e=ue.cells.get(he.ref);return _e&&"error"===_e.status&&_e.transform.transformer===ue.t&&ue.ret.push(_e),!0}G.root=l(()=>he=>[he.cells.get(he.tree.root.ref)]),G.byRef=function Z(...he){return l(()=>ie=>{const ue=[];for(const _e of he){const Fe=ie.cells.get(_e);Fe&&ue.push(Fe)}return ue})},G.byValue=function ee(...he){return l(()=>ie=>he)},G.rootsOfType=function se(he,ie=vr.RootRef){return l(()=>ue=>{const _e={roots:[],cells:ue.cells,type:he.type};return la.doPreOrder(ue.tree,ue.tree.transforms.get(ie),_e,ge),_e.roots})},G.ofType=function xe(he,ie=vr.RootRef){return l(()=>ue=>{const _e={ret:[],cells:ue.cells,type:he.type};return la.doPreOrder(ue.tree,ue.tree.transforms.get(ie),_e,Ie),_e.ret})},G.ofTransformer=function re(he,ie=vr.RootRef){return l(()=>ue=>{const _e={ret:[],cells:ue.cells,t:he};return la.doPreOrder(ue.tree,ue.tree.transforms.get(ie),_e,me),_e.ret})},G.ofTransformerWithError=function ae(he,ie=vr.RootRef){return l(()=>ue=>{const _e={ret:[],cells:ue.cells,t:he};return la.doPreOrder(ue.tree,ue.tree.transforms.get(ie),_e,Ae),_e.ret})}})(c=e.Generators||(e.Generators={})),a("flatMap",u),e.flatMap=u,a("mapObject",d),e.mapObject=d,a("unique",f),e.unique=f,a("first",p),e.first=p,a("filter",m),e.filter=m,a("withStatus",h),e.withStatus=h,a("withTag",g),e.withTag=g,a("subtree",y),e.subtree=y,a("children",v),e.children=v,a("ofType",x),e.ofType=x,a("ancestor",_),e.ancestor=_,a("ancestorOfType",w),e.ancestorOfType=w,a("ancestorWithTransformer",A),e.ancestorWithTransformer=A,a("withTransformer",M),e.withTransformer=M,a("root",E),e.root=E,a("rootOfType",D),e.rootOfType=D,a("parent",T),e.parent=T,e.findAncestor=R,e.findRoot=N,e.findAncestorWithTransformer=j,e.findAncestorOfType=W,e.findRootOfType=z,e.findUniqueTagsInSubtree=function V(G,Z,ee){return la.doPreOrder(G,G.transforms.get(Z),{refs:{},tags:ee},X).refs},e.findTagInSubtree=function H(G,Z,ee){return la.doPreOrder(G,G.transforms.get(Z),{ref:void 0,tag:ee},oe).ref},e.findWithAllTags=function te(G,Z,ee){return la.doPreOrder(G,G.transforms.get(Z),{refs:[],tags:ee},K).refs},e.tryFindDecorator=function Q(G,Z,ee){if(G.transforms.get(Z).transformer===ee)return G.cells.get(Z);const xe=G.tree.children.get(Z);if(1!==xe.size)return;const re=xe.first();return G.transforms.get(re).transformer.definition.isDecorator?Q(G,re,ee):void 0}}(Qn||(Qn={})),function(e){e.create=function t(){const n=new UGe,r=()=>n.create();return r.dispose=()=>n.dispose(),r.behavior=i=>n.behavior(i),r}}(uy||(uy={}));class UGe{constructor(){this._eventList=[],this._disposed=!1}create(){const t=new si;return this._eventList.push(t),t}behavior(t){const n=new Ao(t);return this._eventList.push(n),n}dispose(){if(!this._disposed){for(const t of this._eventList)t.complete();this._disposed=!0}}}var $V=Symbol.for("immer-nothing"),_D=Symbol.for("immer-draftable"),Ji=Symbol.for("immer-state");function sc(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var x_=Object.getPrototypeOf;function B1(e){return!!e&&!!e[Ji]}function fg(e){return!!e&&(due(e)||Array.isArray(e)||!!e[_D]||!!e.constructor?.[_D]||CD(e)||wD(e))}var zGe=Object.prototype.constructor.toString();function due(e){if(!e||"object"!=typeof e)return!1;const t=x_(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===zGe}function jw(e,t){0===__(e)?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function __(e){const t=e[Ji];return t?t.type_:Array.isArray(e)?1:CD(e)?2:wD(e)?3:0}function SD(e,t){return 2===__(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function fue(e,t,n){const r=__(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function CD(e){return e instanceof Map}function wD(e){return e instanceof Set}function ac(e){return e.copy_||e.base_}function XV(e,t){if(CD(e))return new Map(e);if(wD(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&due(e))return x_(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[Ji];let r=Reflect.ownKeys(n);for(let i=0;i1&&(e.set=e.add=e.clear=e.delete=HGe),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>KV(r,!0))),e}function HGe(){sc(2)}function J5(e){return Object.isFrozen(e)}var AD,ZV={};function S_(e){const t=ZV[e];return t||sc(0),t}function eN(){return AD}function hue(e,t){t&&(S_("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function QV(e){JV(e),e.drafts_.forEach(qGe),e.drafts_=null}function JV(e){e===AD&&(AD=e.parent_)}function mue(e){return AD=function GGe(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}(AD,e)}function qGe(e){const t=e[Ji];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function gue(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Ji].modified_&&(QV(t),sc(4)),fg(e)&&(e=tN(t,e),t.parent_||nN(t,e)),t.patches_&&S_("Patches").generateReplacementPatches_(n[Ji].base_,e,t.patches_,t.inversePatches_)):e=tN(t,n,[]),QV(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==$V?e:void 0}function tN(e,t,n){if(J5(t))return t;const r=t[Ji];if(!r)return jw(t,(i,o)=>yue(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return nN(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let o=i,s=!1;3===r.type_&&(o=new Set(i),i.clear(),s=!0),jw(o,(a,l)=>yue(e,r,i,a,l,n,s)),nN(e,i,!1),n&&e.patches_&&S_("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function yue(e,t,n,r,i,o,s){if(B1(i)){const l=tN(e,i,o&&t&&3!==t.type_&&!SD(t.assigned_,r)?o.concat(r):void 0);if(fue(n,r,l),!B1(l))return;e.canAutoFreeze_=!1}else s&&n.add(i);if(fg(i)&&!J5(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;tN(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof r&&Object.prototype.propertyIsEnumerable.call(n,r)&&nN(e,i)}}function nN(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&KV(t,n)}var e9={get(e,t){if(t===Ji)return e;const n=ac(e);if(!SD(n,t))return function $Ge(e,t,n){const r=bue(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!fg(r)?r:r===t9(e.base_,t)?(n9(e),e.copy_[t]=ED(r,e)):r},has:(e,t)=>t in ac(e),ownKeys:e=>Reflect.ownKeys(ac(e)),set(e,t,n){const r=bue(ac(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=t9(ac(e),t),o=i?.[Ji];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(function VGe(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(n,i)&&(void 0!==n||SD(e.base_,t)))return!0;n9(e),dy(e)}return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==t9(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,n9(e),dy(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ac(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}},defineProperty(){sc(11)},getPrototypeOf:e=>x_(e.base_),setPrototypeOf(){sc(12)}},ID={};function t9(e,t){const n=e[Ji];return(n?ac(n):e)[t]}function bue(e,t){if(!(t in e))return;let n=x_(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=x_(n)}}function dy(e){e.modified_||(e.modified_=!0,e.parent_&&dy(e.parent_))}function n9(e){e.copy_||(e.copy_=XV(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function ED(e,t){const n=CD(e)?S_("MapSet").proxyMap_(e,t):wD(e)?S_("MapSet").proxySet_(e,t):function WGe(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:eN(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=e9;n&&(i=[r],o=ID);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}(e,t);return(t?t.scope_:eN()).drafts_.push(n),n}function vue(e){if(!fg(e)||J5(e))return e;const t=e[Ji];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=XV(e,t.scope_.immer_.useStrictShallowCopy_)}else n=XV(e,!0);return jw(n,(r,i)=>{fue(n,r,vue(i))}),t&&(t.finalized_=!1),n}jw(e9,(e,t)=>{ID[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),ID.deleteProperty=function(e,t){return ID.set.call(this,e,t,void 0)},ID.set=function(e,t,n){return e9.set.call(this,e[0],t,n,e[0])};var C_,pg,TD,If=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if("function"==typeof t&&"function"!=typeof n){const o=n;n=t;const s=this;return function(l=o,...c){return s.produce(l,u=>n.call(this,u,...c))}}let i;if("function"!=typeof n&&sc(6),void 0!==r&&"function"!=typeof r&&sc(7),fg(t)){const o=mue(this),s=ED(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?QV(o):JV(o)}return hue(o,r),gue(i,o)}if(!t||"object"!=typeof t){if(i=n(t),void 0===i&&(i=t),i===$V&&(i=void 0),this.autoFreeze_&&KV(i,!0),r){const o=[],s=[];S_("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}sc(1)},this.produceWithPatches=(t,n)=>{if("function"==typeof t)return(s,...a)=>this.produceWithPatches(s,l=>t(l,...a));let r,i;return[this.produce(t,n,(s,a)=>{r=s,i=a}),r,i]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){fg(e)||sc(8),B1(e)&&(e=function XGe(e){return B1(e)||sc(10),vue(e)}(e));const t=mue(this),n=ED(e,void 0);return n[Ji].isManual_=!0,JV(t),n}finishDraft(e,t){const n=e&&e[Ji];(!n||!n.isManual_)&&sc(9);const{scope_:r}=n;return hue(r,t),gue(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=S_("Patches").applyPatches_;return B1(e)?r(e,t):this.produce(e,i=>r(i,t))}},fy=If.produce,KGe=(If.produceWithPatches.bind(If),If.setAutoFreeze.bind(If));function xue(...e){let t;const n=[];for(const r of e)if(r)if(t||(t=new Set),"string"==typeof r){if(t.has(r))continue;t.add(r),n.push(r)}else for(const i of r)t.has(i)||(t.add(i),n.push(i));return n}If.setUseStrictShallowCopy.bind(If),If.applyPatches.bind(If),If.createDraft.bind(If),If.finishDraft.bind(If),function(e){function t(s){if(!s.state||s.state.tree===s.editInfo.sourceTree)return s.tree.asImmutable();const a=s.state.tree.asTransient();for(const l of s.actions)switch(l.kind){case"add":a.add(l.transform);break;case"update":a.setParams(l.ref,l.params);break;case"delete":a.remove(l.ref);break;case"insert":{const c=a.children.get(l.ref).toArray();a.add(l.transform);for(const u of c)a.changeParent(u,l.transform.ref);break}}return s.editInfo.sourceTree=s.tree,a.asImmutable()}e.is=function n(s){return!!s&&"function"==typeof s.getTree},e.isTo=function r(s){return!!s&&"function"==typeof s.getTree&&"string"==typeof s.ref},e.Root=class i{get editInfo(){return this.state.editInfo}get currentTree(){return this.state.tree}to(a){const l="string"==typeof a?a:Q3.is(a)?a.transform.ref:a.ref;return new o(this.state,l,this)}toRoot(){return new o(this.state,this.state.tree.root.ref,this)}delete(a){const l=_a.resolveRef(a);return l&&this.state.tree.transforms.has(l)?(this.editInfo.count++,this.state.tree.remove(l),this.state.actions.push({kind:"delete",ref:l}),this):this}getTree(){return t(this.state)}commit(a){if(!this.state.state)throw new Error("Cannot commit template tree");return this.state.state.runTask(this.state.state.updateTree(this,a))}constructor(a,l){this.state={state:l,tree:a.asTransient(),actions:[],editInfo:{applied:!1,sourceTree:a,count:0,lastUpdate:void 0}}}};class o{get editInfo(){return this.state.editInfo}get selector(){return new Yle(this.ref,this.state.state)}getApplyRoot(){return la.getDecoratorRoot(this.state.tree,this.ref)}apply(a,l,c){if(a.definition.isDecorator)return this.insert(a,l,c);const u=this.getApplyRoot(),d=a.apply(u,l,c);return this.state.tree.add(d),this.editInfo.count++,this.editInfo.lastUpdate=d.ref,this.state.actions.push({kind:"add",transform:d}),new o(this.state,d.ref,this.root)}applyOrUpdate(a,l,c,u){if(this.state.tree.transforms.has(a)){const d=this.to(a);return c&&d.update(c),d}return this.apply(l,c,{...u,ref:a})}applyOrUpdateTagged(a,l,c,u){if(l.definition.isDecorator)throw new Error("Can't use applyOrUpdateTagged on decorator transformers.");const d=this.getApplyRoot(),f=this.state.tree.children.get(d).values();for(;;){const m=f.next();if(m.done)break;const h=this.state.tree.transforms.get(m.value);if(h&&vr.hasTags(h,a)){const g=this.to(m.value);return g.updateTagged(c,xue(h.tags,a,u&&u.tags)),g}}const p=l.apply(d,c,{...u,tags:xue(a,u&&u.tags)});return this.state.tree.add(p),this.editInfo.count++,this.editInfo.lastUpdate=p.ref,this.state.actions.push({kind:"add",transform:p}),new o(this.state,p.ref,this.root)}group(a,l,c){return this.apply(a,l,c)}insert(a,l,c){const u=this.state.tree.children.get(this.ref).toArray(),d=a.apply(this.ref,l,c);this.state.tree.add(d);for(const f of u)this.state.tree.changeParent(f,d.ref);return this.editInfo.count++,this.editInfo.lastUpdate=d.ref,this.state.actions.push({kind:"insert",ref:this.ref,transform:d}),new o(this.state,d.ref,this.root)}updateTagged(a,l){(this.state.tree.setParams(this.ref,a)||this.state.tree.setTags(this.ref,l))&&(this.editInfo.count++,this.editInfo.lastUpdate=this.ref,this.state.actions.push({kind:"update",ref:this.ref,params:a}))}update(a,l){let c;if(l){const u=this.state.tree.transforms.get(this.ref);c=fy(u.params,l)}else c="function"==typeof a?fy(this.state.tree.transforms.get(this.ref).params,a):a;return this.state.tree.setParams(this.ref,c)&&(this.editInfo.count++,this.editInfo.lastUpdate=this.ref,this.state.actions.push({kind:"update",ref:this.ref,params:c})),this.root}to(a){return this.root.to(a)}toRoot(){return this.root.toRoot()}delete(a){return this.root.delete(a)}getTree(){return t(this.state)}commit(a){if(!this.state.state)throw new Error("Cannot commit template tree");return this.state.state.runTask(this.state.state.updateTree(this,a))}constructor(a,l,c){if(this.state=a,this.root=c,this.ref=l,!this.state.tree.transforms.has(l))throw new Error(`Could not find node '${l}'.`)}}e.To=o}(C_||(C_={}));class ZGe{constructor(){this.ev=uy.create(),this.actions=new Map,this.fromTypeIndex=new Map,this.events={added:this.ev(),removed:this.ev()}}add(t){const n=yt.is(t)?t.toAction():t;if(this.actions.has(n.id))return this;this.actions.set(n.id,n);for(const r of n.definition.from)this.fromTypeIndex.has(r.type)?this.fromTypeIndex.get(r.type).push(n):this.fromTypeIndex.set(r.type,[n]);return this.events.added.next(void 0),this}remove(t){const n=yt.is(t)?t.toAction().id:oo.is(t)?t:t.id,r=this.actions.get(n);if(!r)return this;this.actions.delete(n);for(const i of r.definition.from){const o=this.fromTypeIndex.get(i.type);o&&($x(o,r),0===o.length&&this.fromTypeIndex.delete(i.type))}return this.events.removed.next(void 0),this}fromCell(t,n){const r=t.obj;if(!r)return[];const i=this.fromTypeIndex.get(r.type);if(!i)return[];let o=!1;for(const a of i)if(a.definition.isApplicable){o=!0;break}if(!o)return i;const s=[];for(const a of i)a.definition.isApplicable?a.definition.isApplicable(r,t.transform,n)&&s.push(a):s.push(a);return s}dispose(){this.ev.dispose()}}!function(e){e.message=function t(o){return{type:"message",timestamp:new Date,message:o}},e.error=function n(o){return{type:"error",timestamp:new Date,message:o}},e.warning=function r(o){return{type:"warning",timestamp:new Date,message:o}},e.info=function i(o){return{type:"info",timestamp:new Date,message:o}}}(pg||(pg={})),function(e){e.Impl=class t{get current(){return this._current}set current(o){this._current=o}getAncestorOfType(o){if(!this._current)return;let s=this._current;for(;;){if(s=this.cells.get(s.transform.parent),!s.obj)return;if(s.obj.type===o.type)return s.obj;if(s.transform.ref===vr.RootRef)return}}getRootOfType(o){if(!this._current)return;let a,s=this._current;for(;;){if(!s.obj)return;if(s.obj.type===o.type&&(a=s),s.transform.ref===vr.RootRef)return a?a.obj:void 0;s=this.cells.get(s.transform.parent)}}constructor(o){this.cells=o,this._current=void 0}},e.getDecoratorChain=function n(i,o){const s=i.cells;let a=s.get(o);const l=[a];for(;a?.transform.transformer.definition.isDecorator;)a=s.get(a.transform.parent),l.push(a);return l},e.getRootOfType=function r(i,o,s){let a,l=i.cells.get(s);if(l)for(;;){if(!l.obj)return;if(l.obj.type===o.type&&(a=l),l.transform.ref===vr.RootRef)return a?a.obj:void 0;l=i.cells.get(l.transform.parent)}}}(TD||(TD={}));class QGe{constructor(){this.queue=[],this.signal=new si}get length(){return this.queue.length}enqueue(t){return this.queue.push(t),1===this.queue.length||this.waitFor(t)}handled(t){p3(this.queue,t),this.queue.length>0&&this.signal.next({v:this.queue[0],stillPresent:!0})}remove(t){const n=p3(this.queue,t);return n&&this.signal.next({v:t,stillPresent:!1}),n}waitFor(t){return new Promise(n=>{const r=this.signal.subscribe(({v:i,stillPresent:o})=>{i===t&&(r.unsubscribe(),n(o))})})}}class L1{get tree(){return this._tree}get transforms(){return this._tree.transforms}get current(){return this.behaviors.currentObject.value.ref}get root(){return this.cells.get(this._tree.root.ref)}build(){return new C_.Root(this.tree,this)}addHistory(t,n){0!==this.historyCapacity&&(this.history.unshift([t,n||"Update"]),this.history.length>this.historyCapacity&&this.history.pop(),this.events.historyUpdated.next({state:this}))}clearHistory(){0!==this.history.length&&(this.history=[],this.events.historyUpdated.next({state:this}))}get latestUndoLabel(){return this.history.length>0?this.history[0][1]:void 0}get canUndo(){return this.history.length>0}undo(){var t=this;return Ke.create("Undo",function(){var n=le(function*(r){const i=t.history.shift();if(i){t.events.historyUpdated.next({state:t}),t.undoingHistory=!0;try{yield t.updateTree(i[0],{canUndo:!1}).runInContext(r)}finally{t.undoingHistory=!1}}});return function(r){return n.apply(this,arguments)}}())}getSnapshot(){return{tree:la.toJSON(this._tree)}}setSnapshot(t){const n=la.fromJSON(t.tree);return this.updateTree(n)}setCurrent(t){this.behaviors.currentObject.next({state:this,ref:t})}updateCellState(t,n){const r=this.cells.get(t);if(!r)return;const i="function"==typeof n?n(r.state):n;vr.assignState(r.state,i)&&(r.transform=this._tree.assignState(r.transform.ref,i),this.events.cell.stateUpdated.next({state:this,ref:t,cell:r}))}dispose(){this.ev.dispose(),this.actions.dispose()}select(t){return Qn.select(t,this)}selectQ(t){return Qn.select("string"==typeof t?t:t(Qn.Generators),this)}applyAction(t,n,r=vr.RootRef){return Ke.create("Apply Action",i=>{const o=this.cells.get(r);if(!o)throw new Error(`'${r}' does not exist.`);if("ok"!==o.status)throw new Error(`Action cannot be applied to a cell with status '${o.status}'`);return l9(t.definition.run({ref:r,cell:o,a:o.obj,params:n,state:this},this.globalContext),i)})}transaction(t,n){var r=this;return Ke.create("State Transaction",function(){var i=le(function*(o){const s=r.inTransaction,a=r._tree.asImmutable();let l=!1;try{s||r.behaviors.isUpdating.next(!0),r.inTransaction=!0,r.inTransactionError=!1,yield t(o),r.inTransactionError&&(l=!0,yield r.updateTree(a).runInContext(o))}catch(c){if(l||(l=!0,yield r.updateTree(a).runInContext(o),r.events.log.next(pg.error("Error during state transaction, reverting"))),s)throw r.inTransactionError=!0,c;if(n?.rethrowErrors)throw c;console.error(c)}finally{s||(r.inTransaction=!1,r.events.changed.next({state:r,inTransaction:!1}),r.behaviors.isUpdating.next(!1),l||(n?.canUndo?r.addHistory(a,"string"==typeof n.canUndo?n.canUndo:void 0):r.clearHistory()))}});return function(o){return i.apply(this,arguments)}}())}get inUpdate(){return this._inUpdate}updateTree(t,n){var r=this;const i={tree:t,options:n};return Ke.create("Update Tree",function(){var o=le(function*(s){if(!(yield r.updateQueue.enqueue(i)))return;r._inUpdate=!0;const l=n?.canUndo?r._tree.asImmutable():void 0;let c=!1;r.inTransaction||r.behaviors.isUpdating.next(!0);try{if(C_.is(t)){if(t.editInfo.applied)throw new Error("This builder has already been applied. Create a new builder for further state updates");t.editInfo.applied=!0}r.reverted=!1;const u=n&&(n.revertIfAborted||n.revertOnError)?yield r._revertibleTreeUpdate(s,i,n):yield r._updateTree(s,i);return c=r.reverted,u.ctx.hadError&&(r.inTransactionError=!0),u.cell?new Yle(u.cell.transform.ref,r):void 0}finally{r._inUpdate=!1,r.updateQueue.handled(i),r.inTransaction||(r.behaviors.isUpdating.next(!1),n?.canUndo?c||r.addHistory(l,"string"==typeof n.canUndo?n.canUndo:void 0):r.undoingHistory||r.clearHistory())}});return function(s){return o.apply(this,arguments)}}(),()=>{this.updateQueue.remove(i)})}_revertibleTreeUpdate(t,n,r){var i=this;return le(function*(){const o=i.tree,s=yield i._updateTree(t,n);return(s.ctx.hadError||s.ctx.wasAborted)&&r.revertOnError||s.ctx.wasAborted&&r.revertIfAborted?(i.reverted=!0,yield i._updateTree(t,{tree:o,options:n.options})):s})()}_updateTree(t,n){var r=this;return le(function*(){let i=!1;const o=r.updateTreeAndCreateCtx(n.tree,t,n.options);try{return i=yield function eqe(e){return r9.apply(this,arguments)}(o),C_.isTo(n.tree)?{ctx:o,cell:r.select(n.tree.ref)[0]}:{ctx:o}}finally{r.spine.current=void 0,i&&r.events.changed.next({state:r,inTransaction:r.inTransaction})}})()}updateTreeAndCreateCtx(t,n,r){const i=(C_.is(t)?t.getTree():t).asTransient(),o=this._tree;this._tree=i;const s=this.cells,a={parent:this,editInfo:C_.is(t)?t.editInfo:void 0,errorFree:this.errorFree,taskCtx:n,oldTree:o,tree:i,cells:this.cells,spine:this.spine,results:[],options:{...JGe,...r},changed:!1,hadError:!1,wasAborted:!1,newCurrent:void 0,getCellData:l=>{var c;return null===(c=s.get(l).obj)||void 0===c?void 0:c.data}};return this.errorFree=!0,a}constructor(t,n){this.errorFree=!0,this.ev=uy.create(),this.globalContext=void 0,this.events={cell:{stateUpdated:this.ev(),created:this.ev(),removed:this.ev()},object:{updated:this.ev(),created:this.ev(),removed:this.ev()},log:this.ev(),changed:this.ev(),historyUpdated:this.ev()},this.behaviors={currentObject:this.ev.behavior({state:this,ref:vr.RootRef}),isUpdating:this.ev.behavior(!1)},this.actions=new ZGe,this.cells=new Map,this.spine=new TD.Impl(this.cells),this.tryGetCellData=o=>{var s,a;const l=null===(a=null===(s=this.cells.get(o))||void 0===s?void 0:s.obj)||void 0===a?void 0:a.data;if(void 0===l)throw new Error(`Cell '${o}' data undefined.`);return l},this.historyCapacity=5,this.history=[],this.undoingHistory=!1,this.inTransaction=!1,this.inTransactionError=!1,this._inUpdate=!1,this.reverted=!1,this.updateQueue=new QGe,this._tree=la.createEmpty(vr.createRoot(n&&n.rootState)).asTransient();const i=this._tree.root;this.runTask=n.runTask,void 0!==n?.historyCapacity&&(this.historyCapacity=n.historyCapacity),this.cells.set(i.ref,{parent:this,transform:i,sourceRef:void 0,obj:t,status:"ok",state:{...i.state},errorText:void 0,params:{definition:{},values:{}},paramsNormalizedVersion:i.version,dependencies:{dependentBy:[],dependsOn:[]},cache:{}}),this.globalContext=n&&n.globalContext}}!function(e){let n;e.create=function t(r,i){return new e(r,i)},(n=e.ObjectEvent||(e.ObjectEvent={})).isCell=function i(o,s){return!!s&&o.ref===s.transform.ref&&o.state===s.parent}}(L1||(L1={}));const JGe={doNotLogTiming:!1,doNotUpdateCurrent:!0,revertIfAborted:!1,revertOnError:!1,canUndo:!1};function r9(){return r9=le(function*(e){let n,i,r=[];if(e.editInfo&&1===e.editInfo.count&&e.editInfo.lastUpdate&&e.editInfo.sourceTree===e.oldTree)n=[],i=[e.editInfo.lastUpdate];else{n=function iqe(e){const t={newTree:e.tree,cells:e.cells,deletes:[]};return la.doPostOrder(e.oldTree,e.oldTree.root,t,rqe),t.deletes}(e);const a=e.parent.current;let l=!1;for(const c of n)if(c===a){l=!0;break}if(l){const c=_ue(e.oldTree,a,n,e.cells);e.parent.setCurrent(c)}for(let c=n.length-1;c>=0;c--){const u=e.cells.get(n[c]);u&&iN(u.transform,u.obj,u?.transform.params,u.cache,e.parent.globalContext)}for(const c of n){const u=e.cells.get(c);u&&(u.parent=void 0,cqe(u));const d=u&&u.obj;e.cells.delete(c),r.push(d)}i=function tqe(e,t){const n={roots:[],cells:e};return la.doPreOrder(t,t.root,n,nqe),n.roots}(e.cells,e.tree)}const o=function fqe(e,t){const n={ctx:e,visited:new Set,added:[]};for(const i of t)la.doPreOrder(e.tree,e.tree.transforms.get(i),n,uqe);for(const i of n.added)dqe(i,e);let r;return n.visited.forEach(i=>{const o=e.cells.get(i);for(const s of o.dependencies.dependentBy)n.visited.has(s.transform.ref)||(r||(r=Ti.create()),Ti.add(r,s.transform.ref,s))}),{added:n.added,dependent:r?r.array:void 0}}(e,i);for(const a of o.added)e.parent.events.cell.created.next({state:e.parent,ref:a.transform.ref,cell:a});for(let a=0;a0||i.length>0||e.changed}),r9.apply(this,arguments)}function nqe(e,t,n){const r=n.cells.get(e.ref);return r&&r.transform.version===e.version?!("error"===r.status||r&&r.obj===vo.Null):(n.roots.push(e.ref),!1)}function rqe(e,t,n){!n.newTree.transforms.has(e.ref)&&n.cells.has(e.ref)&&n.deletes.push(e.ref)}function oqe(e,t,n){const r=n.cells.get(e.ref);!r||!vr.syncState(r.state,e.state)||n.parent.events.cell.stateUpdated.next({state:n.parent,ref:e.ref,cell:r})}function rN(e,t,n,r){const i=e.cells.get(t),o=i.status!==n;i.status=n,i.errorText=r,o&&e.parent.events.cell.stateUpdated.next({state:e.parent,ref:t,cell:i})}function aqe(e,t,n){n.cells.get(e.ref).transform=e,rN(n,e.ref,"pending")}function cqe(e){for(const t of e.dependencies.dependsOn)$x(t.dependencies.dependentBy,e)}function uqe(e,t,{ctx:n,added:r,visited:i}){if(i.add(e.ref),n.cells.has(e.ref))return;const o={parent:n.parent,transform:e,sourceRef:void 0,status:"pending",state:{...e.state},errorText:void 0,params:void 0,paramsNormalizedVersion:"",dependencies:{dependentBy:[],dependsOn:[]},cache:void 0};n.cells.set(e.ref,o),r.push(o)}function dqe(e,t){if(e.transform.dependsOn)for(const n of e.transform.dependsOn){if(!t.tree.transforms.get(n))throw new Error("Cannot depend on a non-existent transform.");const i=t.cells.get(n);Us(e.dependencies.dependsOn,i),Us(i.dependencies.dependentBy,e)}}function _ue(e,t,n,r){return Sue(e,t,new Set(n),r)}function Sue(e,t,n,r){if(t===vr.RootRef)return t;const i=e.transforms.get(t),o=e.children.get(i.parent).values();let s,a=!1;for(;;){const l=o.next();if(l.done)break;if(n.has(l.value))continue;const c=r.get(l.value);if(!c||"error"===c.status||c.obj===vo.Null)continue;const u=e.transforms.get(l.value);if(!u.state.isGhost){if(l.value===t){a=!0,n.has(t)||(s=t);continue}if(a)return u.ref;s=u.ref}}return s||Sue(e,i.parent,n,r)}function i9(e,t,n,r){r||(e.hadError=!0,e.parent.errorFree=!1);const i=e.cells.get(t);if(n){e.wasAborted=e.wasAborted||Ke.isAbort(n);const s=""+n;rN(e,t,"error",s),r||e.parent.events.log.next({type:"error",timestamp:new Date,message:s})}else i.params=void 0;if(i.obj){const s=i.obj;i.obj=void 0,i.cache=void 0,e.parent.events.object.removed.next({state:e.parent,ref:t,obj:s})}const o=e.tree.children.get(t).values();for(;;){const s=o.next();if(s.done)return;i9(e,s.value,void 0,r)}}const pqe="Parent is null";function Cue(e,t){return o9.apply(this,arguments)}function o9(){return o9=le(function*(e,t){rN(e,t,"processing");let n=!1;try{const i=Bo(),o=yield function mqe(e,t){return s9.apply(this,arguments)}(e,t),s=Bo()-i;"none"!==o.action&&(e.changed=!0),rN(e,t,"ok"),e.results.push(o),"created"===o.action?(n=o.obj===vo.Null,!n&&!e.options.doNotLogTiming&&e.parent.events.log.next(pg.info(`Created ${o.obj.label} in ${AR(s)}.`))):("updated"===o.action||"replaced"===o.action)&&(n=o.obj===vo.Null,!n&&!e.options.doNotLogTiming&&e.parent.events.log.next(pg.info(`Updated ${o.obj.label} in ${AR(s)}.`)))}catch(i){return e.changed=!0,e.hadError||(e.newCurrent=t),i9(e,t,i,!1),void console.error(i)}const r=e.tree.children.get(t).values();for(;;){const i=r.next();if(i.done)return;n?i9(e,i.value,void 0,!0):yield Cue(e,i.value)}}),o9.apply(this,arguments)}function s9(){return s9=le(function*(e,t){var n;const{oldTree:r,tree:i}=e,o=e.cells.get(t),s=o.transform;if(o.transform.ref===vr.RootRef)return{action:"none"};const a=e.cells.get(o.transform.parent);if(a?.obj===vo.Null)return o.sourceRef=a.transform.ref,r.transforms.has(t)&&o.params?(iN(s,o.obj,o.params.values,o.cache,e.parent.globalContext),o.params=void 0,o.obj=vo.Null,{ref:t,action:"updated",obj:o.obj}):(o.params=void 0,{ref:t,action:"created",obj:vo.Null});const c=0===s.transformer.definition.from.length?a:Qn.findAncestorOfType(i,e.cells,t,s.transformer.definition.from);if(!c)throw new Error(`No suitable parent found for '${t}'`);e.spine.current=o;const u=c.obj;o.sourceRef=c.transform.ref;const d=function hqe(e,t,n,r){const i=t.transformer.definition.params,o=i?i(n,e.parent.globalContext):{};if(r.paramsNormalizedVersion!==t.version)t.params=I.normalizeParams(o,t.params,"all"),r.paramsNormalizedVersion=t.version;else{const s=I.getDefaultValues(o);t.params=t.params?function qFe(e,t){for(const n of Object.keys(t))NR.call(t,n)&&typeof e[n]>"u"&&(e[n]=t[n]);return e}(t.params,s):s}return I.resolveRefs(o,t.params,e.getCellData),{definition:o,values:t.params}}(e,s,u,o);if(!r.transforms.has(t)||!o.params){o.params=d;const f=yield Aue(e,o,s.transformer,u,d.values);return a9(f,s),o.obj=f,{ref:t,action:"created",obj:f}}{const f=o.params.values,p=o.cache,m=null===(n=o.obj)||void 0===n?void 0:n.data,h=d.values;switch(o.params=d,o.obj&&o.obj!==vo.Null?yield function gqe(e,t,n,r,i,o,s){return c9.apply(this,arguments)}(e,o,s.transformer,u,o.obj,f,h):yt.UpdateResult.Recreate){case yt.UpdateResult.Recreate:{const y=o.obj;iN(s,y,f,p,e.parent.globalContext);const v=yield Aue(e,o,s.transformer,u,h);return a9(v,s),o.obj=v,{ref:t,action:"replaced",oldObj:y,obj:v}}case yt.UpdateResult.Updated:return a9(o.obj,s),{ref:t,action:"updated",oldData:m,obj:o.obj};case yt.UpdateResult.Null:return iN(s,o.obj,f,p,e.parent.globalContext),o.obj=vo.Null,{ref:t,action:"updated",obj:o.obj};default:return{action:"none"}}}}),s9.apply(this,arguments)}function iN(e,t,n,r,i){var o,s;null===(s=(o=e.transformer.definition).dispose)||void 0===s||s.call(o,{b:t!==vo.Null?t:void 0,params:n,cache:r},i)}function a9(e,t){!e||e===vo.Null||(e.tags=t.tags)}function l9(e,t){return"function"==typeof e.runInContext?e.runInContext(t):e}function wue(e){if(0===e.dependencies.dependsOn.length)return;const t=Object.create(null);for(const n of e.dependencies.dependsOn){if(!n.obj)throw new Error("Unresolved dependency.");t[n.transform.ref]=n.obj}return t}function Aue(e,t,n,r,i){return t.cache||(t.cache=Object.create(null)),l9(n.definition.apply({a:r,params:i,cache:t.cache,spine:e.spine,dependencies:wue(t)},e.parent.globalContext),e.taskCtx)}function c9(){return c9=le(function*(e,t,n,r,i,o,s){return n.definition.update?(t.cache||(t.cache=Object.create(null)),l9(n.definition.update({a:r,oldParams:o,b:i,newParams:s,cache:t.cache,spine:e.spine,dependencies:wue(t)},e.parent.globalContext),e.taskCtx)):yt.UpdateResult.Recreate}),c9.apply(this,arguments)}var Se,nn;!function(e){function r(f){return e.Create({...f,typeClass:"Representation3D"})}e.Create=vo.factory(),e.isRepresentation3D=function t(f){return!!f&&"Representation3D"===f.type.typeClass},e.isBehavior=function n(f){return!!f&&"Behavior"===f.type.typeClass},e.CreateRepresentation3D=r,e.CreateBehavior=function i(f){return e.Create({...f,typeClass:"Behavior"})};class o extends(e.Create({name:"Root",typeClass:"Root"})){}e.Root=o;class s extends(e.Create({name:"Group",typeClass:"Group"})){}let a,l,c,u,d;e.Group=s,function(f){class p extends(e.Create({name:"String Data",typeClass:"Data"})){}f.String=p;class m extends(e.Create({name:"Binary Data",typeClass:"Data"})){}f.Binary=m;class h extends(e.Create({name:"Data Blob",typeClass:"Data"})){}f.Blob=h}(a=e.Data||(e.Data={})),function(f){class p extends(e.Create({name:"JSON Data",typeClass:"Data"})){}f.Json=p;class m extends(e.Create({name:"CIF File",typeClass:"Data"})){}f.Cif=m;class h extends(e.Create({name:"Cube File",typeClass:"Data"})){}f.Cube=h;class g extends(e.Create({name:"PSF File",typeClass:"Data"})){}f.Psf=g;class y extends(e.Create({name:"PRMTOP File",typeClass:"Data"})){}f.Prmtop=y;class v extends(e.Create({name:"TOP File",typeClass:"Data"})){}f.Top=v;class x extends(e.Create({name:"PLY File",typeClass:"Data"})){}f.Ply=x;class _ extends(e.Create({name:"CCP4/MRC/MAP File",typeClass:"Data"})){}f.Ccp4=_;class w extends(e.Create({name:"DSN6/BRIX File",typeClass:"Data"})){}f.Dsn6=w;class A extends(e.Create({name:"DX File",typeClass:"Data"})){}f.Dx=A;class M extends(e.Create({name:"Format Blob",typeClass:"Data"})){}f.Blob=M}(l=e.Format||(e.Format={})),function(f){class p extends(e.Create({name:"Coordinates",typeClass:"Object"})){}f.Coordinates=p;class m extends(e.Create({name:"Topology",typeClass:"Object"})){}f.Topology=m;class h extends(e.Create({name:"Model",typeClass:"Object"})){}f.Model=h;class g extends(e.Create({name:"Trajectory",typeClass:"Object"})){}f.Trajectory=g;class y extends(e.Create({name:"Structure",typeClass:"Object"})){}f.Structure=y,function(v){class x extends(r({name:"Structure 3D"})){}v.Representation3D=x;class _ extends(e.Create({name:"Structure 3D State",typeClass:"Object"})){}v.Representation3DState=_;class w extends(e.Create({name:"Selections",typeClass:"Object"})){}v.Selections=w}(y=f.Structure||(f.Structure={}))}(c=e.Molecule||(e.Molecule={})),function(f){class p extends(e.Create({name:"Volume",typeClass:"Object"})){}f.Data=p;class m extends(e.Create({name:"Lazy Volume",typeClass:"Object"})){}f.Lazy=m;class h extends(r({name:"Volume 3D"})){}f.Representation3D=h}(u=e.Volume||(e.Volume={})),function(f){class p extends(e.Create({name:"Shape Provider",typeClass:"Object"})){}f.Provider=p;class m extends(r({name:"Shape 3D"})){}f.Representation3D=m}(d=e.Shape||(e.Shape={}))}(Se||(Se={})),function(e){e.CreateBuiltIn=yt.factory("ms-plugin"),e.BuiltIn=yt.builderFactory("ms-plugin")}(nn||(nn={}));const Iue=.529177210859;function xqe(e,t){return Ke.create("Parse Cube",function(){var n=le(function*(r){yield r.update("Reading header...");const i=kt(e),{header:o,atoms:s}=function yqe(e){const t=kt.readLines(e,6),n=(v,x)=>{const _=+t[v].trim().split(/\s+/g)[x];return Number.isNaN(_)?0:_},r=v=>{const x=n(v+2,0),_=Iue;return[Math.abs(x),C.create(n(v+2,1)*_,n(v+2,2)*_,n(v+2,3)*_),x]},i=t[0].trim(),o=t[1].trim(),[s,a,l]=r(0),[c,u]=r(1),[d,f]=r(2),[p,m]=r(3),h=function bqe(e,t,n){const r=new Int32Array(t),i=new Float64Array(t),o=new Float32Array(t),s=new Float32Array(t),a=new Float32Array(t);for(let l=0;l=0){let v=n(2,4);0===v&&(v=1);for(let x=0;x{const c=Math.min(r,s+a);for(let u=s;ua.update({current:Math.min(c,r),max:r}))}(r,i,o);return qi.success({header:o,atoms:s,values:a,name:t})});return function(r){return n.apply(this,arguments)}}())}function Eue(e){const t={h:C()};let n=0,r=0;const i=/\s+/g;for(;;){const o=kt.readLine(e);let s;if(o.startsWith("object 1"))s=o.split(i),t.dim=C.create(parseInt(s[5]),parseInt(s[6]),parseInt(s[7]));else if(o.startsWith("origin"))s=o.split(i),t.min=C.create(parseFloat(s[1]),parseFloat(s[2]),parseFloat(s[3]));else if(o.startsWith("delta"))s=o.split(i),0===r?t.h[0]=parseFloat(s[1]):1===r?t.h[1]=parseFloat(s[2]):2===r&&(t.h[2]=parseFloat(s[3])),r+=1;else if(o.startsWith("object 3")){n+=o.length+1;break}n+=o.length+1}return{header:t,headerByteCount:n}}function u9(){return u9=le(function*(e,t,n){yield e.update("Reading header...");const r=kt(t),{header:i}=Eue(r);yield e.update("Reading values...");const o=yield function _qe(e,t,n){const r=n.dim[0]*n.dim[1]*n.dim[2],i=1e6,o=new Float64Array(r);let s=0;return G0(e,i,o,(a,l)=>{const c=Math.min(r,s+a);for(let u=s;ua.update({current:Math.min(c,r),max:r}))}(e,r,i);return qi.success({header:i,values:o,name:n})}),u9.apply(this,arguments)}function d9(){return d9=le(function*(e,t,n){yield e.update("Reading header...");const i=kt(mz(t,0,1e3)),{header:o,headerByteCount:s}=Eue(i);yield e.update("Reading values...");const a=o.dim[0]*o.dim[1]*o.dim[2],l=new DataView(t.buffer,t.byteOffset+s),c=new Float64Array(a);for(let u=0;u{e.set(qn[t],t)})}(),Object.keys({NATOM:"",NTYPES:"",NBONH:"",MBONA:"",NTHETH:"",MTHETA:"",NPHIH:"",MPHIA:"",NHPARM:"",NPARM:"",NNB:"",NRES:"",NBONA:"",NTHETA:"",NPHIA:"",NUMBND:"",NUMANG:"",NPTRA:"",NATYP:"",NPHB:"",IFPERT:"",NBPER:"",NGPER:"",NDPER:"",MBPER:"",MGPER:"",MDPER:"",IFBOX:"",NMXRS:"",IFCAP:"",NUMEXTRA:"",NCOPY:""})),{readLine:oN,markLine:Due,trim:Aqe}=kt;function Eqe(e){const{tokenizer:t}=e,n=[];for(;t.tokenEnd{n[i]=0});let r=0;for(;t.tokenEnd1e5&&t.shouldUpdate&&(o=n.position,yield t.update({current:n.position,max:n.length}));const s=oN(r.tokenizer).trim();if(s.startsWith("%VERSION"))i.version=s.substring(8).trim();else if(s.startsWith("%FLAG")){const a=s.substring(5).trim();if(!oN(r.tokenizer).trim().startsWith("%FORMAT"))throw new Error("expected %FORMAT");if("TITLE"===a)i.title=Eqe(r);else if("POINTERS"===a)i.pointers=Tqe(r);else if("ATOM_NAME"===a){const c=j1(r,i.pointers.NATOM,20,4);i.atomName=Pn(c)(ce.Schema.str)}else if("CHARGE"===a){const c=j1(r,i.pointers.NATOM,5,16);i.charge=Pn(c)(ce.Schema.float)}else if("MASS"===a){const c=j1(r,i.pointers.NATOM,5,16);i.mass=Pn(c)(ce.Schema.float)}else if("RESIDUE_LABEL"===a){const c=j1(r,i.pointers.NRES,20,4);i.residueLabel=Pn(c)(ce.Schema.str)}else if("RESIDUE_POINTER"===a){const c=j1(r,i.pointers.NRES,10,8);i.residuePointer=Pn(c)(ce.Schema.int)}else if("BONDS_INC_HYDROGEN"===a){const c=j1(r,3*i.pointers.NBONH,10,8);i.bondsIncHydrogen=Pn(c)(ce.Schema.int)}else if("BONDS_WITHOUT_HYDROGEN"===a){const c=j1(r,3*i.pointers.NBONA,10,8);i.bondsWithoutHydrogen=Pn(c)(ce.Schema.int)}else if("RADII"===a){const c=j1(r,i.pointers.NATOM,5,16);i.radii=Pn(c)(ce.Schema.float)}else for(;n.tokenEnd=t.length));){const i=t.data[t.position];if("["===i)break;if(";"!==i&&"*"!==i){for(let o=0;o<2;++o)switch(z1(t),sN(t),h9(t),o){case 0:ot.add(n,t.tokenStart,t.tokenEnd);break;case 1:ot.add(r,t.tokenStart,t.tokenEnd)}Nqe(t),sN(t)}else U1(t)}return Kr.ofColumns(Rqe,{compound:Pn(n)(ce.Schema.str),molCount:Pn(r)(ce.Schema.int)})}function m9(){return m9=le(function*(e,t){const n=kt(e),r=function Fqe(e,t){return{tokenizer:e,runtimeCtx:t}}(n,t),i=Object.create(null);let o=0;i.compounds={};let s={},a="";function l(){a&&s.atoms&&(i.compounds[a]=s,s={},a="")}for(;n.tokenEnd1e5&&t.shouldUpdate&&(o=n.position,yield t.update({current:n.position,max:n.length}));const c=p9(r.tokenizer).trim();if(c&&"*"!==c[0]&&";"!==c[0]){if(c.startsWith("#include"))throw new Error("#include statements not allowed");if(c.startsWith("[")){const u=c.match(Oqe);if(null===u)throw new Error("expected field name");const d=u[1];if("moleculetype"===d)l(),a=Lqe(r);else if("atoms"===d)s.atoms=jqe(r);else if("bonds"===d)s.bonds=Uqe(r);else if("system"===d)i.system=zqe(r);else if("molecules"===d)l(),i.molecules=Vqe(r);else for(;n.tokenEndKe.create("Download",function(){var r=le(function*(i){const o=jr.getUrlAsset(n.managers.asset,e.url),s=yield n.managers.asset.resolve(o,e.isBinary?"binary":"string").runInContext(i);return t.asset=s,e.isBinary?new Se.Data.Binary(s.data,{label:e.label?e.label:o.url}):new Se.Data.String(s.data,{label:e.label?e.label:o.url})});return function(i){return r.apply(this,arguments)}}()),dispose({cache:e}){var t;null===(t=e?.asset)||void 0===t||t.dispose()},update:({oldParams:e,newParams:t,b:n})=>e.url!==t.url||e.isBinary!==t.isBinary?yt.UpdateResult.Recreate:e.label!==t.label?(n.label=t.label||("string"==typeof t.url?t.url:t.url.url),yt.UpdateResult.Updated):yt.UpdateResult.Unchanged}),kue=nn.BuiltIn({name:"download-blob",display:{name:"Download Blob",description:"Download multiple string or binary data from the specified URLs."},from:Se.Root,to:Se.Data.Blob,params:{sources:I.ObjectList({id:I.Text("",{label:"Unique ID"}),url:I.Url("https://www.ebi.ac.uk/pdbe/static/entry/1cbs_updated.cif",{description:"Resource URL. Must be the same domain or support CORS."}),isBinary:I.Optional(I.Boolean(!1,{description:"If true, download data as binary (string otherwise)"})),canFail:I.Optional(I.Boolean(!1,{description:"Indicate whether the download can fail and not be included in the blob as a result."}))},e=>`${e.id}: ${e.url}`),maxConcurrency:I.Optional(I.Numeric(4,{min:1,max:12,step:1},{description:"The maximum number of concurrent downloads."}))}})({apply:({params:e,cache:t},n)=>Ke.create("Download Blob",function(){var r=le(function*(i){const o=[],s=yield function $ze(e,t,n,r){return d7.apply(this,arguments)}(i,n.managers.asset,e.sources,e.maxConcurrency||4),a=[];for(let l=0;lKe.create("Raw Data",le(function*(){return"string"==typeof e.data?new Se.Data.String(e.data,{label:e.label?e.label:"String"}):Array.isArray(e.data)||e.data instanceof ArrayBuffer?new Se.Data.Binary(new Uint8Array(e.data),{label:e.label?e.label:"Binary"}):e.data instanceof Uint8Array?new Se.Data.Binary(e.data,{label:e.label?e.label:"Binary"}):void Hi()})),update:({oldParams:e,newParams:t,b:n})=>e.data!==t.data?yt.UpdateResult.Recreate:e.label!==t.label?(n.label=t.label||n.label,yt.UpdateResult.Updated):yt.UpdateResult.Unchanged,customSerialization:{toJSON(e){if("string"==typeof e.data||Array.isArray(e.data))return e;if(e.data instanceof ArrayBuffer){const t=new Uint8Array(e.data),n=new Array(t.length);for(let r=0,i=t.length;re}}),Rue=nn.BuiltIn({name:"read-file",display:{name:"Read File",description:"Read string or binary data from the specified file"},from:Se.Root,to:[Se.Data.String,Se.Data.Binary],params:{file:I.File(),label:I.Optional(I.Text("")),isBinary:I.Optional(I.Boolean(!1,{description:"If true, open file as as binary (string otherwise)"}))}})({apply:({params:e,cache:t},n)=>Ke.create("Open File",function(){var r=le(function*(i){if(null===e.file)return n.log.error("No file(s) selected"),vo.Null;const o=yield n.managers.asset.resolve(e.file,e.isBinary?"binary":"string").runInContext(i);return t.asset=o,e.isBinary?new Se.Data.Binary(o.data,{label:e.label?e.label:e.file.name}):new Se.Data.String(o.data,{label:e.label?e.label:e.file.name})});return function(i){return r.apply(this,arguments)}}()),dispose({cache:e}){var t;null===(t=e?.asset)||void 0===t||t.dispose()},update({oldParams:e,newParams:t,b:n}){var r;return e.label!==t.label?(n.label=t.label||(null===(r=e.file)||void 0===r?void 0:r.name)||"",yt.UpdateResult.Updated):yt.UpdateResult.Unchanged},isSerializable:()=>({isSerializable:!1,reason:"Cannot serialize user loaded files."})}),qqe=nn.BuiltIn({name:"parse-blob",display:{name:"Parse Blob",description:"Parse multiple data enties"},from:Se.Data.Blob,to:Se.Format.Blob,params:{formats:I.ObjectList({id:I.Text("",{label:"Unique ID"}),format:I.Select("cif",[["cif","cif"]])},e=>`${e.id}: ${e.format}`)}})({apply:({a:e,params:t},n)=>Ke.create("Parse Blob",function(){var r=le(function*(i){const o=new Map;for(const a of t.formats)o.set(a.id,a.format);const s=[];for(const a of e.data){if(!o.has(a.id))continue;const l=yield("string"===a.kind?Hh.parse(a.data):Hh.parseBinary(a.data)).runInContext(i);if(l.isError)throw new Error(`${a.id}: ${l.message}`);s.push({id:a.id,kind:"cif",data:l.result})}return new Se.Format.Blob(s,{label:"Format Blob",description:`${s.length} ${1===s.length?"entry":"entries"}`})});return function(i){return r.apply(this,arguments)}}())}),Wqe=nn.BuiltIn({name:"parse-cif",display:{name:"Parse CIF",description:"Parse CIF from String or Binary data"},from:[Se.Data.String,Se.Data.Binary],to:Se.Format.Cif})({apply:({a:e})=>Ke.create("Parse CIF",function(){var t=le(function*(n){const r=yield("string"==typeof e.data?Hh.parse(e.data):Hh.parseBinary(e.data)).runInContext(n);if(r.isError)throw new Error(r.message);return 0===r.result.blocks.length?vo.Null:new Se.Format.Cif(r.result)});return function(n){return t.apply(this,arguments)}}())}),$qe=nn.BuiltIn({name:"parse-cube",display:{name:"Parse Cube",description:"Parse Cube from String data"},from:Se.Data.String,to:Se.Format.Cube})({apply:({a:e})=>Ke.create("Parse Cube",function(){var t=le(function*(n){const r=yield xqe(e.data,e.label).runInContext(n);if(r.isError)throw new Error(r.message);return new Se.Format.Cube(r.result)});return function(n){return t.apply(this,arguments)}}())}),Yqe=nn.BuiltIn({name:"parse-psf",display:{name:"Parse PSF",description:"Parse PSF from String data"},from:[Se.Data.String],to:Se.Format.Psf})({apply:({a:e})=>Ke.create("Parse PSF",function(){var t=le(function*(n){const r=yield function jHe(e){return Ke.create("Parse PSF",function(){var t=le(function*(n){return yield function LHe(e,t){return Z7.apply(this,arguments)}(e,n)});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);return new Se.Format.Psf(r.result)});return function(n){return t.apply(this,arguments)}}())}),Xqe=nn.BuiltIn({name:"parse-prmtop",display:{name:"Parse PRMTOP",description:"Parse PRMTOP from String data"},from:[Se.Data.String],to:Se.Format.Prmtop})({apply:({a:e})=>Ke.create("Parse PRMTOP",function(){var t=le(function*(n){const r=yield function Pqe(e){return Ke.create("Parse PRMTOP",function(){var t=le(function*(n){return yield function Dqe(e,t){return f9.apply(this,arguments)}(e,n)});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);return new Se.Format.Prmtop(r.result)});return function(n){return t.apply(this,arguments)}}())}),Kqe=nn.BuiltIn({name:"parse-top",display:{name:"Parse TOP",description:"Parse TOP from String data"},from:[Se.Data.String],to:Se.Format.Top})({apply:({a:e})=>Ke.create("Parse TOP",function(){var t=le(function*(n){const r=yield function Gqe(e){return Ke.create("Parse TOP",function(){var t=le(function*(n){return yield function Hqe(e,t){return m9.apply(this,arguments)}(e,n)});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);return new Se.Format.Top(r.result)});return function(n){return t.apply(this,arguments)}}())}),Zqe=nn.BuiltIn({name:"parse-ply",display:{name:"Parse PLY",description:"Parse PLY from String data"},from:[Se.Data.String],to:Se.Format.Ply})({apply:({a:e})=>Ke.create("Parse PLY",function(){var t=le(function*(n){const r=yield function kHe(e){return Ke.create("Parse PLY",function(){var t=le(function*(n){return yield function PHe(e,t){return $7.apply(this,arguments)}(e,n)});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);return new Se.Format.Ply(r.result,{label:r.result.comments[0]||"PLY Data"})});return function(n){return t.apply(this,arguments)}}())}),Qqe=nn.BuiltIn({name:"parse-ccp4",display:{name:"Parse CCP4/MRC/MAP",description:"Parse CCP4/MRC/MAP from Binary data"},from:[Se.Data.Binary],to:Se.Format.Ccp4})({apply:({a:e})=>Ke.create("Parse CCP4/MRC/MAP",function(){var t=le(function*(n){const r=yield function fHe(e,t){return function dHe(e,t){return Ke.create("Parse CCP4/MRC/MAP",function(){var n=le(function*(r){try{return qi.success(yield function uHe(e,t,n){return z7.apply(this,arguments)}(e,t,r))}catch(i){return qi.error(i)}});return function(r){return n.apply(this,arguments)}}())}(R5.fromBuffer($h.fromUint8Array(e),t),e.length)}(e.data,e.label).runInContext(n);if(r.isError)throw new Error(r.message);return new Se.Format.Ccp4(r.result)});return function(n){return t.apply(this,arguments)}}())}),Jqe=nn.BuiltIn({name:"parse-dsn6",display:{name:"Parse DSN6/BRIX",description:"Parse CCP4/BRIX from Binary data"},from:[Se.Data.Binary],to:Se.Format.Dsn6})({apply:({a:e})=>Ke.create("Parse DSN6/BRIX",function(){var t=le(function*(n){const r=yield function xHe(e,t){return function vHe(e,t){return Ke.create("Parse DSN6/BRIX",function(){var n=le(function*(r){try{return qi.success(yield function bHe(e,t,n){return q7.apply(this,arguments)}(e,t,r))}catch(i){return qi.error(i)}});return function(r){return n.apply(this,arguments)}}())}(R5.fromBuffer($h.fromUint8Array(e),t),e.length)}(e.data,e.label).runInContext(n);if(r.isError)throw new Error(r.message);return new Se.Format.Dsn6(r.result)});return function(n){return t.apply(this,arguments)}}())}),eWe=nn.BuiltIn({name:"parse-dx",display:{name:"Parse DX",description:"Parse DX from Binary/String data"},from:[Se.Data.Binary,Se.Data.String],to:Se.Format.Dx})({apply:({a:e})=>Ke.create("Parse DX",function(){var t=le(function*(n){const r=yield function wqe(e,t){return Ke.create("Parse DX",n=>"string"==typeof e?function Sqe(e,t,n){return u9.apply(this,arguments)}(n,e,t):function Cqe(e,t,n){return d9.apply(this,arguments)}(n,e,t))}(e.data,e.label).runInContext(n);if(r.isError)throw new Error(r.message);return new Se.Format.Dx(r.result)});return function(n){return t.apply(this,arguments)}}())}),tWe=nn.BuiltIn({name:"import-string",display:{name:"Import String",description:"Import given data as a string"},from:Se.Root,to:Se.Data.String,params:{data:I.Value(""),label:I.Optional(I.Text(""))}})({apply:({params:{data:e,label:t}})=>new Se.Data.String(e,{label:t||""}),update:({oldParams:e,newParams:t,b:n})=>e.data!==t.data?yt.UpdateResult.Recreate:e.label!==t.label?(n.label=t.label||"",yt.UpdateResult.Updated):yt.UpdateResult.Unchanged,isSerializable:()=>({isSerializable:!1,reason:"Cannot serialize user imported strings."})}),nWe=nn.BuiltIn({name:"import-json",display:{name:"Import JSON",description:"Import given data as a JSON"},from:Se.Root,to:Se.Format.Json,params:{data:I.Value({}),label:I.Optional(I.Text(""))}})({apply:({params:{data:e,label:t}})=>new Se.Format.Json(e,{label:t||""}),update:({oldParams:e,newParams:t,b:n})=>e.data!==t.data?yt.UpdateResult.Recreate:e.label!==t.label?(n.label=t.label||"",yt.UpdateResult.Updated):yt.UpdateResult.Unchanged,isSerializable:()=>({isSerializable:!1,reason:"Cannot serialize user imported JSON."})}),rWe=nn.BuiltIn({name:"parse-json",display:{name:"Parse JSON",description:"Parse JSON from String data"},from:[Se.Data.String],to:Se.Format.Json})({apply:({a:e})=>Ke.create("Parse JSON",function(){var t=le(function*(n){const r=yield new Response(e.data).json();return new Se.Format.Json(r)});return function(n){return t.apply(this,arguments)}}())}),iWe=nn.BuiltIn({name:"lazy-volume",display:{name:"Lazy Volume",description:"A placeholder for lazy loaded volume representation"},from:Se.Root,to:Se.Volume.Lazy,params:{url:I.Url(""),isBinary:I.Boolean(!1),format:I.Text("ccp4"),entryId:I.Value("",{isHidden:!0}),isovalues:I.ObjectList({type:I.Text("relative"),value:I.Numeric(0),color:I.Color(qn.black),alpha:I.Numeric(1,{min:0,max:1,step:.01}),volumeIndex:I.Numeric(0)},e=>`${e.type} ${e.value}`)}})({apply:({params:t})=>Ke.create("Lazy Volume",function(){var n=le(function*(r){const i=Array.isArray(t.entryId)?t.entryId.join(", "):t.entryId;return new Se.Volume.Lazy(t,{label:`${i||t.url}`,description:"Lazy Volume"})});return function(r){return n.apply(this,arguments)}}())}),oWe=nn.BuiltIn({name:"create-group",display:{name:"Group"},from:[],to:Se.Group,params:{label:I.Text("Group"),description:I.Optional(I.Text(""))}})({apply:({params:e})=>new Se.Group({},e),update:({oldParams:e,newParams:t,b:n})=>lw(e,t)?yt.UpdateResult.Unchanged:(n.label=t.label,n.description=t.description,yt.UpdateResult.Updated)});function dWe(e,t){return{tokenizer:e,header:{title:"",timeInPs:0,hasVelocities:!1,precision:{position:0,velocity:0},box:[0,0,0]},numberOfAtoms:0,runtimeCtx:t}}function fWe(e){const{tokenizer:t,header:n}=e;let r=kt.readLine(t);0===r.trim().length&&(r=kt.readLine(t));const i=r.lastIndexOf("t=");i>=0?(n.timeInPs=parseFloat(r.substring(i+2)),n.title=r.substring(0,i).trim(),n.title&&","===n.title[n.title.length-1]&&(n.title=n.title.substring(0,n.title.length-1))):n.title=r}function pWe(e){const{tokenizer:t}=e;kt.markLine(t);const n=kt.getTokenString(t);e.numberOfAtoms=parseInt(n)}function hWe(e){return g9.apply(this,arguments)}function g9(){return g9=le(function*(e){const{tokenizer:t,numberOfAtoms:n}=e,r=yield kt.readLinesAsync(t,n,e.runtimeCtx,1e5),o=t.data.substring(r.indices[0],r.indices[1]).substring(20).match(/\.\d+/g),s=6===o.length;e.header.hasVelocities=s,e.header.precision.position=o[0].length-1,e.header.precision.velocity=s?o[3].length-1:0;const l=e.header.precision.position+5,c=20+3*l,u=e.header.precision.velocity+4,d=function lWe(e){return function(t,n,r){return function cWe(e,t,n,r){const{data:i,indices:o,count:s}=e,{valueType:a}=r,l="str"===a?c=>{const u=o[2*c]+t,d=o[2*c+1];if(u>=d)return"";let f=u+n;return f>d&&(f=d),function tUe(e,t,n){let r=t,i=n-1,o=e.charCodeAt(r);for(;(9===o||32===o)&&r<=i;)o=e.charCodeAt(++r);for(o=e.charCodeAt(i);(9===o||32===o)&&i>=r;)o=e.charCodeAt(--i);return e.substring(r,i+1)}(i,u,f)}:"int"===a?c=>{const u=o[2*c]+t;return u>o[2*c+1]?0:Gx(i,u,u+n)}:c=>{const u=o[2*c]+t;return u>o[2*c+1]?0:function wFe(e,t,n){for(;t0,toArray:c=>tc(s,l,c),areValuesEqual:(c,u)=>l(c)===l(u)}}(e,t,n,r)}}(r),f=ce.Undefined(e.numberOfAtoms,ce.Schema.float);return{count:e.numberOfAtoms,residueNumber:d(0,5,ce.Schema.int),residueName:d(5,5,ce.Schema.str),atomName:d(10,5,ce.Schema.str),atomNumber:d(15,5,ce.Schema.int),x:d(20,l,ce.Schema.float),y:d(20+l,l,ce.Schema.float),z:d(20+2*l,l,ce.Schema.float),vx:s?d(c,u,ce.Schema.float):f,vy:s?d(c+u,u,ce.Schema.float):f,vz:s?d(c+2*u,u,ce.Schema.float):f}}),g9.apply(this,arguments)}function mWe(e){const{tokenizer:t}=e,n=kt.readLine(t).trim().split(/\s+/g);e.header.box=[+n[0],+n[1],+n[2]]}function y9(){return y9=le(function*(e,t){const n=kt(e);yield t.update({message:"Parsing...",current:0,max:e.length});const r=[];for(;n.position0?Math.ceil(e/r):0;return{width:r,height:i,length:r*i*t}}(e,t);return{array:r=r&&r.length>=i?r:new n(i),width:o,height:s}}const Tp=C(),wWe=new xf("14"),AWe=new xf("98");function Lue(e){return e>1e5?wWe:AWe}function py(e,t,n){const r=3*n,i=Lue(t);i.reset();for(let s=0,a=3*t;s>2),r=t-4>>2,i=4*r;let o=0;if(r<0)for(let s=0;s>16]}for(let s=i;s!1),s){if(e%n!=0)throw new Error("incompatible groupCount and stride");const a={location:Gu,location2:Gu,index:0,groupIndex:0,instanceIndex:0,isSecondary:!1};let l=a.groupIndex(l&&(a.groupIndex=u,a.instanceIndex=d,a.index=d*e+u,a.location=r(u,f?-1:d),p&&(a.location2=s(u,f?-1:d)),a.isSecondary=o(u,f?-1:d),u+=n,u===e?(++d,c=!0,d=85}return!1}(e);return{instancedArrays:t,standardDerivatives:r,elementIndexUint:n,textureFloat:i,textureFloatLinear:o,textureHalfFloat:s,textureHalfFloatLinear:a,depthTexture:l,blendMinMax:c,vertexArrayObject:u,fragDepth:d,colorBufferFloat:f,colorBufferHalfFloat:p,drawBuffers:m,drawBuffersIndexed:h,shaderTextureLod:g,sRGB:y,disjointTimerQuery:v,multiDraw:x,drawInstancedBaseVertexBaseInstance:_,multiDrawInstancedBaseVertexBaseInstance:w,parallelShaderCompile:A,fboRenderMipmap:M,provokingVertex:E,clipCullDistance:D,conservativeDepth:T,stencilTexturing:F,clipControl:R,noNonInstancedActiveAttribs:N}}var A_;!function(e){e.create=function t(i,o,s){return{array:i,width:o,height:s}},e.flipY=function n(i){const{array:o,width:s,height:a}=i,c=s*(o.length/(s*a));for(let u=0,d=a/2;u 0.0 && uBumpAmplitude > 0.0 && bumpiness > 0.0) {\n material.rgb += fbm(vModelPosition * uBumpFrequency) * uBumpAmplitude * bumpiness;\n material.rgb -= 0.5 * uBumpAmplitude * bumpiness;\n }\n #endif\n\n gl_FragColor = material;\n#else\n #ifdef bumpEnabled\n if (uBumpFrequency > 0.0 && uBumpAmplitude > 0.0 && bumpiness > 0.0) {\n normal = perturbNormal(-vViewPosition, normal, fbm(vModelPosition * uBumpFrequency), (uBumpAmplitude * bumpiness) / uBumpFrequency);\n }\n #endif\n\n vec4 color = material;\n\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n\n PhysicalMaterial physicalMaterial;\n physicalMaterial.diffuseColor = color.rgb * (1.0 - metalness);\n #ifdef enabledFragDepth\n physicalMaterial.roughness = min(max(roughness, 0.0525), 1.0);\n #else\n vec3 dxy = max(abs(dFdx(normal)), abs(dFdy(normal)));\n float geometryRoughness = max(max(dxy.x, dxy.y), dxy.z);\n physicalMaterial.roughness = min(max(roughness, 0.0525) + geometryRoughness, 1.0);\n #endif\n physicalMaterial.specularColor = mix(vec3(0.04), color.rgb, metalness);\n physicalMaterial.specularF90 = 1.0;\n\n GeometricContext geometry;\n geometry.position = -vViewPosition;\n geometry.normal = normal;\n geometry.viewDir = normalize(vViewPosition);\n\n IncidentLight directLight;\n #pragma unroll_loop_start\n for (int i = 0; i < dLightCount; ++i) {\n directLight.direction = uLightDirection[i];\n directLight.color = uLightColor[i] * PI; // * PI for punctual light\n RE_Direct_Physical(directLight, geometry, physicalMaterial, reflectedLight);\n }\n #pragma unroll_loop_end\n\n vec3 irradiance = uAmbientColor * PI; // * PI for punctual light\n RE_IndirectDiffuse_Physical(irradiance, geometry, physicalMaterial, reflectedLight);\n\n // indirect specular only metals\n vec3 radiance = uAmbientColor * metalness;\n vec3 iblIrradiance = uAmbientColor * metalness;\n vec3 clearcoatRadiance = vec3(0.0);\n RE_IndirectSpecular_Physical(radiance, iblIrradiance, clearcoatRadiance, geometry, physicalMaterial, reflectedLight);\n\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n outgoingLight = clamp(outgoingLight, 0.01, 0.99); // prevents black artifacts on specular highlight with transparent background\n\n gl_FragColor = vec4(outgoingLight, color.a);\n#endif\n\n#if defined(dXrayShaded_on)\n gl_FragColor.a *= 1.0 - pow(abs(dot(normal, vec3(0.0, 0.0, 1.0))), uXrayEdgeFalloff);\n#elif defined(dXrayShaded_inverted)\n gl_FragColor.a *= pow(abs(dot(normal, vec3(0.0, 0.0, 1.0))), uXrayEdgeFalloff);\n#endif\n\ngl_FragColor.rgb *= uExposure;\n",apply_marker_color:"\n\n#if defined(dColorMarker)\n if (marker > 0.0) {\n if ((uMarkerPriority == 1 && marker != 2.0) || (uMarkerPriority != 1 && marker == 1.0)) {\n gl_FragColor.rgb = mix(gl_FragColor.rgb, uHighlightColor, uHighlightStrength);\n gl_FragColor.a = max(gl_FragColor.a, uHighlightStrength * 0.002); // for direct-volume rendering\n } else {\n gl_FragColor.rgb = mix(gl_FragColor.rgb, uSelectColor, uSelectStrength);\n gl_FragColor.a = max(gl_FragColor.a, uSelectStrength * 0.002); // for direct-volume rendering\n }\n } else if (uMarkerAverage > 0.0) {\n gl_FragColor.rgb = mix(gl_FragColor.rgb, uDimColor, uDimStrength);\n gl_FragColor.a = max(gl_FragColor.a, uDimStrength * 0.002); // for direct-volume rendering\n }\n#endif\n",assign_clipping_varying:"\n#if dClipObjectCount != 0 && defined(dClipping)\n #if defined(dClippingType_instance)\n vClipping = readFromTexture(tClipping, aInstance, uClippingTexDim).a;\n #elif defined(dMarkerType_groupInstance)\n vClipping = readFromTexture(tClipping, aInstance * float(uGroupCount) + group, uClippingTexDim).a;\n #endif\n#endif\n",assign_color_varying:"\n#if defined(dRenderVariant_color)\n #if defined(dColorType_attribute)\n vColor.rgb = aColor;\n #elif defined(dColorType_instance)\n vColor.rgb = readFromTexture(tColor, aInstance, uColorTexDim).rgb;\n #elif defined(dColorType_group)\n #if defined(dDualColor)\n vec4 color2;\n if (aColorMode == 2.0) {\n vColor.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n } else {\n vColor.rgb = readFromTexture(tColor, group * 2.0, uColorTexDim).rgb;\n color2.rgb = readFromTexture(tColor, group * 2.0 + 1.0, uColorTexDim).rgb;\n }\n #else\n vColor.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n #endif\n #elif defined(dColorType_groupInstance)\n #if defined(dDualColor)\n vec4 color2;\n if (aColorMode == 2.0) {\n vColor.rgb = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n } else {\n vColor.rgb = readFromTexture(tColor, (aInstance * float(uGroupCount) + group) * 2.0, uColorTexDim).rgb;\n color2.rgb = readFromTexture(tColor, (aInstance * float(uGroupCount) + group) * 2.0 + 1.0, uColorTexDim).rgb;\n }\n #else\n vColor.rgb = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n #endif\n #elif defined(dColorType_vertex)\n vColor.rgb = readFromTexture(tColor, VertexID, uColorTexDim).rgb;\n #elif defined(dColorType_vertexInstance)\n vColor.rgb = readFromTexture(tColor, int(aInstance) * uVertexCount + VertexID, uColorTexDim).rgb;\n #elif defined(dColorType_volume)\n vec3 cgridPos = (uColorGridTransform.w * (position - uColorGridTransform.xyz)) / uColorGridDim;\n vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;\n #elif defined(dColorType_volumeInstance)\n vec3 cgridPos = (uColorGridTransform.w * (vModelPosition - uColorGridTransform.xyz)) / uColorGridDim;\n vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;\n #endif\n\n #ifdef dUsePalette\n vPaletteV = ((vColor.r * 256.0 * 256.0 * 255.0 + vColor.g * 256.0 * 255.0 + vColor.b * 255.0) - 1.0) / 16777215.0;\n #endif\n\n #ifdef dOverpaint\n #if defined(dOverpaintType_instance)\n vOverpaint = readFromTexture(tOverpaint, aInstance, uOverpaintTexDim);\n #elif defined(dOverpaintType_groupInstance)\n vOverpaint = readFromTexture(tOverpaint, aInstance * float(uGroupCount) + group, uOverpaintTexDim);\n #elif defined(dOverpaintType_vertexInstance)\n vOverpaint = readFromTexture(tOverpaint, int(aInstance) * uVertexCount + VertexID, uOverpaintTexDim);\n #elif defined(dOverpaintType_volumeInstance)\n vec3 ogridPos = (uOverpaintGridTransform.w * (vModelPosition - uOverpaintGridTransform.xyz)) / uOverpaintGridDim;\n vOverpaint = texture3dFrom2dLinear(tOverpaintGrid, ogridPos, uOverpaintGridDim, uOverpaintTexDim);\n #endif\n\n // pre-mix to avoid darkening due to empty overpaint\n #ifdef dColorType_uniform\n vOverpaint.rgb = mix(uColor.rgb, vOverpaint.rgb, vOverpaint.a);\n #else\n vOverpaint.rgb = mix(vColor.rgb, vOverpaint.rgb, vOverpaint.a);\n #endif\n vOverpaint *= uOverpaintStrength;\n #endif\n\n #ifdef dSubstance\n #if defined(dSubstanceType_instance)\n vSubstance = readFromTexture(tSubstance, aInstance, uSubstanceTexDim);\n #elif defined(dSubstanceType_groupInstance)\n vSubstance = readFromTexture(tSubstance, aInstance * float(uGroupCount) + group, uSubstanceTexDim);\n #elif defined(dSubstanceType_vertexInstance)\n vSubstance = readFromTexture(tSubstance, int(aInstance) * uVertexCount + VertexID, uSubstanceTexDim);\n #elif defined(dSubstanceType_volumeInstance)\n vec3 sgridPos = (uSubstanceGridTransform.w * (vModelPosition - uSubstanceGridTransform.xyz)) / uSubstanceGridDim;\n vSubstance = texture3dFrom2dLinear(tSubstanceGrid, sgridPos, uSubstanceGridDim, uSubstanceTexDim);\n #endif\n\n // pre-mix to avoid artifacts due to empty substance\n vSubstance.rgb = mix(vec3(uMetalness, uRoughness, uBumpiness), vSubstance.rgb, vSubstance.a);\n vSubstance *= uSubstanceStrength;\n #endif\n#elif defined(dRenderVariant_pick)\n #ifdef requiredDrawBuffers\n vObject = vec4(packIntToRGB(float(uObjectId)), 1.0);\n vInstance = vec4(packIntToRGB(aInstance), 1.0);\n vGroup = vec4(packIntToRGB(group), 1.0);\n #else\n if (uPickType == 1) {\n vColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n vColor = vec4(packIntToRGB(aInstance), 1.0);\n } else {\n vColor = vec4(packIntToRGB(group), 1.0);\n }\n #endif\n#endif\n\n#ifdef dTransparency\n #if defined(dTransparencyType_instance)\n vTransparency = readFromTexture(tTransparency, aInstance, uTransparencyTexDim).a;\n #elif defined(dTransparencyType_groupInstance)\n vTransparency = readFromTexture(tTransparency, aInstance * float(uGroupCount) + group, uTransparencyTexDim).a;\n #elif defined(dTransparencyType_vertexInstance)\n vTransparency = readFromTexture(tTransparency, int(aInstance) * uVertexCount + VertexID, uTransparencyTexDim).a;\n #elif defined(dTransparencyType_volumeInstance)\n vec3 tgridPos = (uTransparencyGridTransform.w * (vModelPosition - uTransparencyGridTransform.xyz)) / uTransparencyGridDim;\n vTransparency = texture3dFrom2dLinear(tTransparencyGrid, tgridPos, uTransparencyGridDim, uTransparencyTexDim).a;\n #endif\n vTransparency *= uTransparencyStrength;\n#endif\n",assign_group:"\n#ifdef dGeometryType_textureMesh\n float group = unpackRGBToInt(readFromTexture(tGroup, VertexID, uGeoTexDim).rgb);\n#else\n float group = aGroup;\n#endif\n",assign_marker_varying:"\n#if defined(dNeedsMarker)\n #if defined(dMarkerType_instance)\n vMarker = readFromTexture(tMarker, aInstance, uMarkerTexDim).a;\n #elif defined(dMarkerType_groupInstance)\n vMarker = readFromTexture(tMarker, aInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n #endif\n#endif\n",assign_material_color:"\n#if defined(dNeedsMarker)\n float marker = uMarker;\n if (uMarker == -1.0) {\n marker = floor(vMarker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n#endif\n\n#if defined(dRenderVariant_color)\n #if defined(dUsePalette)\n vec4 material = vec4(texture2D(tPalette, vec2(vPaletteV, 0.5)).rgb, uAlpha);\n #elif defined(dColorType_uniform)\n vec4 material = vec4(uColor, uAlpha);\n #elif defined(dColorType_varying)\n vec4 material = vec4(vColor.rgb, uAlpha);\n #endif\n\n // mix material with overpaint\n #if defined(dOverpaint)\n material.rgb = mix(material.rgb, vOverpaint.rgb, vOverpaint.a);\n #endif\n\n float metalness = uMetalness;\n float roughness = uRoughness;\n float bumpiness = uBumpiness;\n #ifdef dSubstance\n metalness = mix(metalness, vSubstance.r, vSubstance.a);\n roughness = mix(roughness, vSubstance.g, vSubstance.a);\n bumpiness = mix(bumpiness, vSubstance.b, vSubstance.a);\n #endif\n#elif defined(dRenderVariant_depth)\n if (fragmentDepth > getDepth(gl_FragCoord.xy / uDrawingBufferSize)) {\n discard;\n }\n\n #ifndef dXrayShaded\n #if defined(dTransparency)\n float dta = 1.0 - vTransparency;\n if (vTransparency < 0.2) dta = 1.0; // hard cutoff looks better\n\n if (uRenderMask == MaskTransparent && uAlpha * dta == 1.0) {\n discard;\n } else if (uRenderMask == MaskOpaque && uAlpha * dta < 1.0) {\n discard;\n }\n #else\n if (uRenderMask == MaskTransparent && uAlpha == 1.0) {\n discard;\n } else if (uRenderMask == MaskOpaque && uAlpha < 1.0) {\n discard;\n }\n #endif\n #else\n if (uRenderMask == MaskOpaque) {\n discard;\n }\n #endif\n\n vec4 material = packDepthToRGBA(fragmentDepth);\n#elif defined(dRenderVariant_marking)\n vec4 material;\n if(uMarkingType == 1) {\n if (marker > 0.0)\n discard;\n #ifdef enabledFragDepth\n material = packDepthToRGBA(gl_FragDepthEXT);\n #else\n material = packDepthToRGBA(gl_FragCoord.z);\n #endif\n } else {\n if (marker == 0.0)\n discard;\n float depthTest = 1.0;\n if (uMarkingDepthTest) {\n depthTest = (fragmentDepth >= getDepthPacked(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;\n }\n bool isHighlight = intMod(marker, 2.0) > 0.1;\n float viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);\n float fogFactor = smoothstep(uFogNear, uFogFar, abs(viewZ));\n if (fogFactor == 1.0)\n discard;\n material = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0 - fogFactor);\n }\n#endif\n\n// apply per-group transparency\n#if defined(dTransparency) && (defined(dRenderVariant_pick) || defined(dRenderVariant_color))\n float ta = 1.0 - vTransparency;\n if (vTransparency < 0.09) ta = 1.0; // hard cutoff looks better\n\n #if defined(dRenderVariant_pick)\n if (ta < uPickingAlphaThreshold)\n discard; // ignore so the element below can be picked\n #elif defined(dRenderVariant_color)\n material.a *= ta;\n\n #if defined(dRenderVariant_colorBlended)\n #if defined(dTransparentBackfaces_off)\n if ((uRenderMask == MaskOpaque && material.a < 1.0) ||\n (uRenderMask == MaskTransparent && material.a == 1.0) ||\n (interior && material.a < 1.0)\n ) {\n discard;\n }\n #elif defined(dTransparentBackfaces_on)\n if ((uRenderMask == MaskOpaque && material.a < 1.0) ||\n (uRenderMask == MaskTransparent && material.a == 1.0)\n ) {\n discard;\n }\n #elif defined(dTransparentBackfaces_opaque)\n if (interior) {\n material.a = 1.0;\n } else if (\n (uRenderMask == MaskOpaque && material.a < 1.0) ||\n (uRenderMask == MaskTransparent && material.a == 1.0)\n ) {\n discard;\n }\n #endif\n #endif\n #endif\n#endif\n",assign_position:"\nmat4 model = uModel * aTransform;\nmat4 modelView = uView * model;\n#ifdef dGeometryType_textureMesh\n vec3 position = readFromTexture(tPosition, VertexID, uGeoTexDim).xyz;\n#else\n vec3 position = aPosition;\n#endif\nvec4 position4 = vec4(position, 1.0);\n// for accessing tColorGrid in vert shader and for clipping in frag shader\nvModelPosition = (model * position4).xyz;\nvec4 mvPosition = modelView * position4;\nvViewPosition = mvPosition.xyz;\ngl_Position = uProjection * mvPosition;\n",assign_size:"\n#if defined(dSizeType_uniform)\n float size = uSize;\n#elif defined(dSizeType_attribute)\n float size = aSize;\n#elif defined(dSizeType_instance)\n float size = unpackRGBToInt(readFromTexture(tSize, aInstance, uSizeTexDim).rgb);\n#elif defined(dSizeType_group)\n float size = unpackRGBToInt(readFromTexture(tSize, group, uSizeTexDim).rgb);\n#elif defined(dSizeType_groupInstance)\n float size = unpackRGBToInt(readFromTexture(tSize, aInstance * float(uGroupCount) + group, uSizeTexDim).rgb);\n#endif\n\n#if defined(dSizeType_instance) || defined(dSizeType_group) || defined(dSizeType_groupInstance)\n size /= 100.0; // NOTE factor also set in TypeScript\n#endif\n\nsize *= uSizeFactor;\n",check_picking_alpha:"\nfloat viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);\nfloat fogFactor = smoothstep(uFogNear, uFogFar, abs(viewZ));\nfloat alpha = (1.0 - fogFactor) * uAlpha;\n// if not opaque enough ignore so the element below can be picked\nif (uAlpha < uPickingAlphaThreshold || alpha < 0.1) {\n #ifdef dTransparentBackfaces_opaque\n if (!interior) discard;\n #else\n discard;\n #endif\n}\n",clip_instance:"\n#if defined(dClipVariant_instance) && dClipObjectCount != 0\n vec4 mCenter = uModel * aTransform * vec4(uInvariantBoundingSphere.xyz, 1.0);\n if (clipTest(vec4(mCenter.xyz, uInvariantBoundingSphere.w)))\n // move out of [ -w, +w ] to 'discard' in vert shader\n gl_Position.z = 2.0 * gl_Position.w;\n#endif\n",clip_pixel:"\n#if defined(dClipVariant_pixel) && dClipObjectCount != 0\n if (clipTest(vec4(vModelPosition, 0.0)))\n discard;\n#endif\n",color_frag_params:"\nuniform float uMetalness;\nuniform float uRoughness;\nuniform float uBumpiness;\n#ifdef bumpEnabled\n uniform float uBumpFrequency;\n uniform float uBumpAmplitude;\n#endif\n\n#if defined(dRenderVariant_color)\n #if defined(dColorType_uniform)\n uniform vec3 uColor;\n #elif defined(dColorType_varying)\n varying vec4 vColor;\n #endif\n\n #ifdef dUsePalette\n uniform sampler2D tPalette;\n varying float vPaletteV;\n #endif\n\n #ifdef dOverpaint\n varying vec4 vOverpaint;\n #endif\n\n #ifdef dSubstance\n varying vec4 vSubstance;\n #endif\n#elif defined(dRenderVariant_pick)\n #if __VERSION__ == 100 || !defined(dVaryingGroup)\n #ifdef requiredDrawBuffers\n varying vec4 vObject;\n varying vec4 vInstance;\n varying vec4 vGroup;\n #else\n varying vec4 vColor;\n #endif\n #else\n #ifdef requiredDrawBuffers\n flat in vec4 vObject;\n flat in vec4 vInstance;\n flat in vec4 vGroup;\n #else\n flat in vec4 vColor;\n #endif\n #endif\n#endif\n\n#ifdef dTransparency\n varying float vTransparency;\n#endif\n",color_vert_params:"\nuniform float uMetalness;\nuniform float uRoughness;\nuniform float uBumpiness;\n\n#if defined(dRenderVariant_color)\n #if defined(dColorType_uniform)\n uniform vec3 uColor;\n #elif defined(dColorType_attribute)\n varying vec4 vColor;\n attribute vec3 aColor;\n #elif defined(dColorType_texture)\n varying vec4 vColor;\n uniform vec2 uColorTexDim;\n uniform sampler2D tColor;\n #elif defined(dColorType_grid)\n varying vec4 vColor;\n uniform vec2 uColorTexDim;\n uniform vec3 uColorGridDim;\n uniform vec4 uColorGridTransform;\n uniform sampler2D tColorGrid;\n #elif defined(dColorType_direct)\n varying vec4 vColor;\n #endif\n\n #ifdef dUsePalette\n varying float vPaletteV;\n #endif\n\n #ifdef dOverpaint\n #if defined(dOverpaintType_instance) || defined(dOverpaintType_groupInstance) || defined(dOverpaintType_vertexInstance)\n varying vec4 vOverpaint;\n uniform vec2 uOverpaintTexDim;\n uniform sampler2D tOverpaint;\n #elif defined(dOverpaintType_volumeInstance)\n varying vec4 vOverpaint;\n uniform vec2 uOverpaintTexDim;\n uniform vec3 uOverpaintGridDim;\n uniform vec4 uOverpaintGridTransform;\n uniform sampler2D tOverpaintGrid;\n #endif\n uniform float uOverpaintStrength;\n #endif\n\n #ifdef dSubstance\n #if defined(dSubstanceType_instance) || defined(dSubstanceType_groupInstance) || defined(dSubstanceType_vertexInstance)\n varying vec4 vSubstance;\n uniform vec2 uSubstanceTexDim;\n uniform sampler2D tSubstance;\n #elif defined(dSubstanceType_volumeInstance)\n varying vec4 vSubstance;\n uniform vec2 uSubstanceTexDim;\n uniform vec3 uSubstanceGridDim;\n uniform vec4 uSubstanceGridTransform;\n uniform sampler2D tSubstanceGrid;\n #endif\n uniform float uSubstanceStrength;\n #endif\n#elif defined(dRenderVariant_pick)\n #if __VERSION__ == 100 || !defined(dVaryingGroup)\n #ifdef requiredDrawBuffers\n varying vec4 vObject;\n varying vec4 vInstance;\n varying vec4 vGroup;\n #else\n varying vec4 vColor;\n #endif\n #else\n #ifdef requiredDrawBuffers\n flat out vec4 vObject;\n flat out vec4 vInstance;\n flat out vec4 vGroup;\n #else\n flat out vec4 vColor;\n #endif\n #endif\n#endif\n\n#ifdef dTransparency\n #if defined(dTransparencyType_instance) || defined(dTransparencyType_groupInstance) || defined(dTransparencyType_vertexInstance)\n varying float vTransparency;\n uniform vec2 uTransparencyTexDim;\n uniform sampler2D tTransparency;\n #elif defined(dTransparencyType_volumeInstance)\n varying float vTransparency;\n uniform vec2 uTransparencyTexDim;\n uniform vec3 uTransparencyGridDim;\n uniform vec4 uTransparencyGridTransform;\n uniform sampler2D tTransparencyGrid;\n #endif\n uniform float uTransparencyStrength;\n#endif\n",common_clip:"\n#if dClipObjectCount != 0\n vec3 quaternionTransform(const in vec4 q, const in vec3 v) {\n vec3 t = 2.0 * cross(q.xyz, v);\n return v + q.w * t + cross(q.xyz, t);\n }\n\n vec4 computePlane(const in vec3 normal, const in vec3 inPoint) {\n return vec4(normalize(normal), -dot(normal, inPoint));\n }\n\n float planeSD(const in vec4 plane, const in vec3 center) {\n return -dot(plane.xyz, center - plane.xyz * -plane.w);\n }\n\n float sphereSD(const in vec3 position, const in vec4 rotation, const in vec3 size, const in vec3 center) {\n return (\n length(quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position) / size) - 1.0\n ) * min(min(size.x, size.y), size.z);\n }\n\n float cubeSD(const in vec3 position, const in vec4 rotation, const in vec3 size, const in vec3 center) {\n vec3 d = abs(quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position)) - size;\n return min(max(d.x, max(d.y, d.z)), 0.0) + length(max(d, 0.0));\n }\n\n float cylinderSD(const in vec3 position, const in vec4 rotation, const in vec3 size, const in vec3 center) {\n vec3 t = quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position);\n\n vec2 d = abs(vec2(length(t.xz), t.y)) - size.xy;\n return min(max(d.x, d.y), 0.0) + length(max(d, 0.0));\n }\n\n float infiniteConeSD(const in vec3 position, const in vec4 rotation, const in vec3 size, const in vec3 center) {\n vec3 t = quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position);\n\n float q = length(t.xy);\n return dot(size.xy, vec2(q, t.z));\n }\n\n float getSignedDistance(const in vec3 center, const in int type, const in vec3 position, const in vec4 rotation, const in vec3 scale) {\n if (type == 1) {\n vec3 normal = quaternionTransform(rotation, vec3(0.0, 1.0, 0.0));\n vec4 plane = computePlane(normal, position);\n return planeSD(plane, center);\n } else if (type == 2) {\n return sphereSD(position, rotation, scale * 0.5, center);\n } else if (type == 3) {\n return cubeSD(position, rotation, scale * 0.5, center);\n } else if (type == 4) {\n return cylinderSD(position, rotation, scale * 0.5, center);\n } else if (type == 5) {\n return infiniteConeSD(position, rotation, scale * 0.5, center);\n } else {\n return 0.1;\n }\n }\n\n #if __VERSION__ == 100\n // 8-bit\n int bitwiseAnd(in int a, in int b) {\n int d = 128;\n int result = 0;\n for (int i = 0; i < 8; ++i) {\n if (d <= 0) break;\n if (a >= d && b >= d) result += d;\n if (a >= d) a -= d;\n if (b >= d) b -= d;\n d /= 2;\n }\n return result;\n }\n\n bool hasBit(const in int mask, const in int bit) {\n return bitwiseAnd(mask, bit) == 0;\n }\n #else\n bool hasBit(const in int mask, const in int bit) {\n return (mask & bit) == 0;\n }\n #endif\n\n bool clipTest(const in vec4 sphere) {\n // flag is a bit-flag for clip-objects to ignore (note, object ids start at 1 not 0)\n #if defined(dClipping)\n int flag = int(floor(vClipping * 255.0 + 0.5));\n #else\n int flag = 0;\n #endif\n\n #pragma unroll_loop_start\n for (int i = 0; i < dClipObjectCount; ++i) {\n if (flag == 0 || hasBit(flag, UNROLLED_LOOP_INDEX + 1)) {\n // TODO take sphere radius into account?\n bool test = getSignedDistance(sphere.xyz, uClipObjectType[i], uClipObjectPosition[i], uClipObjectRotation[i], uClipObjectScale[i]) <= 0.0;\n if ((!uClipObjectInvert[i] && test) || (uClipObjectInvert[i] && !test)) {\n return true;\n }\n }\n }\n #pragma unroll_loop_end\n return false;\n }\n#endif\n",common_frag_params:'\nuniform int uObjectId;\nuniform int uInstanceCount;\nuniform int uGroupCount;\n\nuniform int uPickType;\nuniform int uMarkingType;\n\nuniform vec4 uCameraPlane;\nuniform vec4 uLod;\n\n#if dClipObjectCount != 0\n uniform int uClipObjectType[dClipObjectCount];\n uniform bool uClipObjectInvert[dClipObjectCount];\n uniform vec3 uClipObjectPosition[dClipObjectCount];\n uniform vec4 uClipObjectRotation[dClipObjectCount];\n uniform vec3 uClipObjectScale[dClipObjectCount];\n\n #if defined(dClipping)\n #if __VERSION__ == 100 || defined(dClippingType_instance) || !defined(dVaryingGroup)\n varying float vClipping;\n #else\n flat in float vClipping;\n #endif\n #endif\n#endif\n\n#if defined(dColorMarker)\n uniform vec3 uHighlightColor;\n uniform vec3 uSelectColor;\n uniform vec3 uDimColor;\n uniform float uHighlightStrength;\n uniform float uSelectStrength;\n uniform float uDimStrength;\n uniform int uMarkerPriority;\n uniform float uMarkerAverage;\n#endif\n\n#if defined(dNeedsMarker)\n uniform float uMarker;\n #if __VERSION__ == 100 || defined(dMarkerType_instance) || !defined(dVaryingGroup)\n varying float vMarker;\n #else\n flat in float vMarker;\n #endif\n#endif\n\n#if defined(dRenderVariant_colorDpoit)\n #define MAX_DPOIT_DEPTH 99999.0 // NOTE constant also set in TypeScript\n uniform sampler2D tDpoitDepth;\n uniform sampler2D tDpoitFrontColor;\n#endif\n\nvarying vec3 vModelPosition;\nvarying vec3 vViewPosition;\n\nuniform vec2 uViewOffset;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uIsOrtho;\n\nuniform bool uFog;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\n\nuniform float uAlpha;\nuniform float uPickingAlphaThreshold;\nuniform bool uTransparentBackground;\n\nuniform bool uDoubleSided;\nuniform float uInteriorDarkening;\nuniform bool uInteriorColorFlag;\nuniform vec3 uInteriorColor;\nbool interior;\n\nuniform float uXrayEdgeFalloff;\nuniform float uExposure;\n\nuniform mat4 uProjection;\n\nuniform int uRenderMask;\nuniform bool uMarkingDepthTest;\n\nuniform sampler2D tDepth;\nuniform vec2 uDrawingBufferSize;\n\nfloat getDepthPacked(const in vec2 coords) {\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n}\n\nfloat getDepth(const in vec2 coords) {\n #ifdef depthTextureSupport\n return texture2D(tDepth, coords).r;\n #else\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n #endif\n}\n\nfloat calcDepth(const in vec3 pos) {\n vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;\n return 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\n\n// "Bump Mapping Unparametrized Surfaces on the GPU" Morten S. Mikkelsen\n// https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf\nvec3 perturbNormal(in vec3 position, in vec3 normal, in float height, in float scale) {\n vec3 sigmaS = dFdx(position);\n vec3 sigmaT = dFdy(position);\n\n vec3 r1 = cross(sigmaT, normal);\n vec3 r2 = cross(normal, sigmaS);\n float det = dot(sigmaS, r1);\n\n float bs = dFdx(height);\n float bt = dFdy(height);\n\n vec3 surfGrad = sign(det) * (bs * r1 + bt * r2);\n return normalize(abs(det) * normal - scale * surfGrad);\n}\n\nfloat hash(in float h) {\n return fract(sin(h) * 43758.5453123);\n}\n\nfloat noise(in vec3 x) {\n vec3 p = floor(x);\n vec3 f = fract(x);\n f = f * f * (3.0 - 2.0 * f);\n\n float n = p.x + p.y * 157.0 + 113.0 * p.z;\n return mix(\n mix(mix(hash(n + 0.0), hash(n + 1.0), f.x),\n mix(hash(n + 157.0), hash(n + 158.0), f.x), f.y),\n mix(mix(hash(n + 113.0), hash(n + 114.0), f.x),\n mix(hash(n + 270.0), hash(n + 271.0), f.x), f.y), f.z);\n}\n\nfloat fbm(in vec3 p) {\n float f = 0.0;\n f += 0.5 * noise(p);\n p *= 2.01;\n f += 0.25 * noise(p);\n p *= 2.02;\n f += 0.125 * noise(p);\n\n return f;\n}\n',common_vert_params:"\nuniform mat4 uProjection, uModel, uView;\nuniform vec3 uCameraPosition;\nuniform vec4 uCameraPlane;\n\nuniform int uObjectId;\nuniform int uVertexCount;\nuniform int uInstanceCount;\nuniform int uGroupCount;\nuniform vec4 uInvariantBoundingSphere;\nuniform vec4 uLod;\n\nuniform bool uDoubleSided;\nuniform int uPickType;\n\n#if dClipObjectCount != 0\n uniform int uClipObjectType[dClipObjectCount];\n uniform bool uClipObjectInvert[dClipObjectCount];\n uniform vec3 uClipObjectPosition[dClipObjectCount];\n uniform vec4 uClipObjectRotation[dClipObjectCount];\n uniform vec3 uClipObjectScale[dClipObjectCount];\n\n #if defined(dClipping)\n uniform vec2 uClippingTexDim;\n uniform sampler2D tClipping;\n #if __VERSION__ == 100 || defined(dClippingType_instance) || !defined(dVaryingGroup)\n varying float vClipping;\n #else\n flat out float vClipping;\n #endif\n #endif\n#endif\n\n#if defined(dNeedsMarker)\n uniform float uMarker;\n uniform vec2 uMarkerTexDim;\n uniform sampler2D tMarker;\n #if __VERSION__ == 100 || defined(dMarkerType_instance) || !defined(dVaryingGroup)\n varying float vMarker;\n #else\n flat out float vMarker;\n #endif\n#endif\n\nvarying vec3 vModelPosition;\nvarying vec3 vViewPosition;\n\n#if defined(noNonInstancedActiveAttribs)\n // int() is needed for some Safari versions\n // see https://bugs.webkit.org/show_bug.cgi?id=244152\n #define VertexID int(gl_VertexID)\n#else\n attribute float aVertex;\n #define VertexID int(aVertex)\n#endif\n\n#if defined(enabledMultiDraw)\n #define DrawID gl_DrawID\n#else\n #define DrawID uDrawId\n#endif\n",common:"\n// TODO find a better place for these convenience defines\n\n#if defined(dRenderVariant_colorBlended) || defined(dRenderVariant_colorWboit) || defined(dRenderVariant_colorDpoit)\n #define dRenderVariant_color\n#endif\n\n#if defined(dColorType_instance) || defined(dColorType_group) || defined(dColorType_groupInstance) || defined(dColorType_vertex) || defined(dColorType_vertexInstance)\n #define dColorType_texture\n#endif\n\n#if defined(dColorType_volume) || defined(dColorType_volumeInstance)\n #define dColorType_grid\n#endif\n\n#if defined(dColorType_attribute) || defined(dColorType_texture) || defined(dColorType_grid)\n #define dColorType_varying\n#endif\n\n#if (defined(dRenderVariant_color) && defined(dColorMarker)) || defined(dRenderVariant_marking)\n #define dNeedsMarker\n#endif\n\n#if defined(dXrayShaded_on) || defined(dXrayShaded_inverted)\n #define dXrayShaded\n#endif\n\n#define MaskAll 0\n#define MaskOpaque 1\n#define MaskTransparent 2\n\n//\n\n#define PI 3.14159265\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n\n#define saturate(a) clamp(a, 0.0, 1.0)\n\n#if __VERSION__ == 100\n #define round(x) floor((x) + 0.5)\n#endif\n\nfloat intDiv(const in float a, const in float b) { return float(int(a) / int(b)); }\nvec2 ivec2Div(const in vec2 a, const in vec2 b) { return vec2(ivec2(a) / ivec2(b)); }\nfloat intMod(const in float a, const in float b) { return a - b * float(int(a) / int(b)); }\nint imod(const in int a, const in int b) { return a - b * (a / b); }\n\nfloat pow2(const in float x) { return x * x; }\n\nvec3 packIntToRGB(in float value) {\n value = clamp(round(value), 0.0, 16777216.0 - 1.0) + 1.0;\n vec3 c = vec3(0.0);\n c.b = mod(value, 256.0);\n value = floor(value / 256.0);\n c.g = mod(value, 256.0);\n value = floor(value / 256.0);\n c.r = mod(value, 256.0);\n return c / 255.0;\n}\nfloat unpackRGBToInt(const in vec3 rgb) {\n return (floor(rgb.r * 255.0 + 0.5) * 256.0 * 256.0 + floor(rgb.g * 255.0 + 0.5) * 256.0 + floor(rgb.b * 255.0 + 0.5)) - 1.0;\n}\n\nvec2 packUnitIntervalToRG(const in float v) {\n vec2 enc;\n enc.xy = vec2(fract(v * 256.0), v);\n enc.y -= enc.x * (1.0 / 256.0);\n enc.xy *= 256.0 / 255.0;\n\n return enc;\n}\n\nfloat unpackRGToUnitInterval(const in vec2 enc) {\n return dot(enc, vec2(255.0 / (256.0 * 256.0), 255.0 / 256.0));\n}\n\nvec3 screenSpaceToViewSpace(const in vec3 ssPos, const in mat4 invProjection) {\n vec4 p = vec4(ssPos * 2.0 - 1.0, 1.0);\n p = invProjection * p;\n return p.xyz / p.w;\n}\n\nconst float PackUpscale = 256.0 / 255.0; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255.0 / 256.0; // 0..1 -> fraction (excluding 1)\nconst vec3 PackFactors = vec3(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.0);\nconst float ShiftRight8 = 1.0 / 256.0;\n\nvec4 packDepthToRGBA(const in float v) {\n vec4 r = vec4(fract(v * PackFactors), v);\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\n return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n return dot(v, UnpackFactors);\n}\n\nvec4 sRGBToLinear(const in vec4 c) {\n return vec4(mix(pow(c.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), c.rgb * 0.0773993808, vec3(lessThanEqual(c.rgb, vec3(0.04045)))), c.a);\n}\nvec4 linearTosRGB(const in vec4 c) {\n return vec4(mix(pow(c.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), c.rgb * 12.92, vec3(lessThanEqual(c.rgb, vec3(0.0031308)))), c.a);\n}\n\nfloat linearizeDepth(const in float depth, const in float near, const in float far) {\n return (2.0 * near) / (far + near - depth * (far - near));\n}\n\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\n return (near * far) / ((far - near) * invClipZ - far);\n}\n\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\n return linearClipZ * (near - far) - near;\n}\n\nfloat depthToViewZ(const in float isOrtho, const in float linearClipZ, const in float near, const in float far) {\n return isOrtho == 1.0 ? orthographicDepthToViewZ(linearClipZ, near, far) : perspectiveDepthToViewZ(linearClipZ, near, far);\n}\n\n#if __VERSION__ == 100\n // transpose\n\n float transpose(const in float m) {\n return m;\n }\n\n mat2 transpose2(const in mat2 m) {\n return mat2(\n m[0][0], m[1][0],\n m[0][1], m[1][1]\n );\n }\n\n mat3 transpose3(const in mat3 m) {\n return mat3(\n m[0][0], m[1][0], m[2][0],\n m[0][1], m[1][1], m[2][1],\n m[0][2], m[1][2], m[2][2]\n );\n }\n\n mat4 transpose4(const in mat4 m) {\n return mat4(\n m[0][0], m[1][0], m[2][0], m[3][0],\n m[0][1], m[1][1], m[2][1], m[3][1],\n m[0][2], m[1][2], m[2][2], m[3][2],\n m[0][3], m[1][3], m[2][3], m[3][3]\n );\n }\n\n // inverse\n\n float inverse(const in float m) {\n return 1.0 / m;\n }\n\n mat2 inverse2(const in mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n }\n\n mat3 inverse3(const in mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n }\n\n mat4 inverse4(const in mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n }\n\n #define isNaN(x) ((x) != (x))\n #define isInf(x) ((x) == (x) + 1.0)\n#else\n #define transpose2(m) transpose(m)\n #define transpose3(m) transpose(m)\n #define transpose4(m) transpose(m)\n\n #define inverse2(m) inverse(m)\n #define inverse3(m) inverse(m)\n #define inverse4(m) inverse(m)\n\n #define isNaN isnan\n #define isInf isinf\n#endif\n",fade_lod:"\nif (uLod.w == 0.0 && (uLod.x != 0.0 || uLod.y != 0.0)) {\n float d = dot(uCameraPlane.xyz, vModelPosition) + uCameraPlane.w;\n float ta = min(\n smoothstep(uLod.x, uLod.x + uLod.z, d),\n 1.0 - smoothstep(uLod.y - uLod.z, uLod.y, d)\n );\n\n #if defined(dRenderVariant_color)\n float at = 0.0;\n\n // shift by view-offset during multi-sample rendering to allow for blending\n vec2 coord = gl_FragCoord.xy + uViewOffset * 0.25;\n\n const mat4 thresholdMatrix = mat4(\n 1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,\n 13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,\n 4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,\n 16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0\n );\n int ci = int(intMod(coord.x, 4.0));\n int ri = int(intMod(coord.y, 4.0));\n #if __VERSION__ == 100\n vec4 i = vec4(float(ci * 4 + ri));\n vec4 v = thresholdMatrix[0] * vec4(equal(i, vec4(0.0, 1.0, 2.0, 3.0))) +\n thresholdMatrix[1] * vec4(equal(i, vec4(4.0, 5.0, 6.0, 7.0))) +\n thresholdMatrix[2] * vec4(equal(i, vec4(8.0, 9.0, 10.0, 11.0))) +\n thresholdMatrix[3] * vec4(equal(i, vec4(12.0, 13.0, 14.0, 15.0)));\n at = v.x + v.y + v.z + v.w;\n #else\n at = thresholdMatrix[ci][ri];\n #endif\n\n if (ta < 0.99 && (ta < 0.01 || ta < at)) {\n discard;\n }\n #else\n if (ta < uPickingAlphaThreshold) {\n discard;\n }\n #endif\n}\n",float_to_rgba:"\n // floatToRgba adapted from https://github.com/equinor/glsl-float-to-rgba\n // MIT License, Copyright (c) 2020 Equinor\n\n float shiftRight (float v, float amt) {\n v = floor(v) + 0.5;\n return floor(v / exp2(amt));\n }\n float shiftLeft (float v, float amt) {\n return floor(v * exp2(amt) + 0.5);\n }\n float maskLast (float v, float bits) {\n return mod(v, shiftLeft(1.0, bits));\n }\n float extractBits (float num, float from, float to) {\n from = floor(from + 0.5); to = floor(to + 0.5);\n return maskLast(shiftRight(num, from), to - from);\n }\n\n vec4 floatToRgba(float texelFloat, bool littleEndian) {\n if (texelFloat == 0.0) return vec4(0.0, 0.0, 0.0, 0.0);\n float sign = texelFloat > 0.0 ? 0.0 : 1.0;\n texelFloat = abs(texelFloat);\n float exponent = floor(log2(texelFloat));\n float biased_exponent = exponent + 127.0;\n float fraction = ((texelFloat / exp2(exponent)) - 1.0) * 8388608.0;\n float t = biased_exponent / 2.0;\n float last_bit_of_biased_exponent = fract(t) * 2.0;\n float remaining_bits_of_biased_exponent = floor(t);\n float byte4 = extractBits(fraction, 0.0, 8.0) / 255.0;\n float byte3 = extractBits(fraction, 8.0, 16.0) / 255.0;\n float byte2 = (last_bit_of_biased_exponent * 128.0 + extractBits(fraction, 16.0, 23.0)) / 255.0;\n float byte1 = (sign * 128.0 + remaining_bits_of_biased_exponent) / 255.0;\n return (\n littleEndian\n ? vec4(byte4, byte3, byte2, byte1)\n : vec4(byte1, byte2, byte3, byte4)\n );\n }\n",light_frag_params:"\n#if dLightCount != 0\n uniform vec3 uLightDirection[dLightCount];\n uniform vec3 uLightColor[dLightCount];\n#endif\nuniform vec3 uAmbientColor;\n\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\n\nvec3 BRDF_Lambert(const in vec3 diffuseColor) {\n return RECIPROCAL_PI * diffuseColor;\n}\n\nvec3 F_Schlick(const in vec3 f0, const in float f90, const in float dotVH) {\n // Original approximation by Christophe Schlick '94\n // float fresnel = pow( 1.0 - dotVH, 5.0 );\n // Optimized variant (presented by Epic at SIGGRAPH '13)\n // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n float fresnel = exp2((-5.55473 * dotVH - 6.98316) * dotVH);\n return f0 * (1.0 - fresnel) + (f90 * fresnel);\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat V_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {\n float a2 = pow2(alpha);\n float gv = dotNL * sqrt(a2 + (1.0 - a2) * pow2(dotNV));\n float gl = dotNV * sqrt(a2 + (1.0 - a2) * pow2(dotNL));\n return 0.5 / max(gv + gl, EPSILON);\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is \"roughness squared\" in Disney\u2019s reparameterization\nfloat D_GGX(const in float alpha, const in float dotNH) {\n float a2 = pow2(alpha);\n float denom = pow2(dotNH) * (a2 - 1.0) + 1.0; // avoid alpha = 0 with dotNH = 1\n return RECIPROCAL_PI * a2 / pow2(denom);\n}\n\n// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility\nvec3 BRDF_GGX(const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness) {\n float alpha = pow2(roughness); // UE4's roughness\n vec3 halfDir = normalize( lightDir + viewDir);\n float dotNL = saturate(dot(normal, lightDir));\n float dotNV = saturate(dot(normal, viewDir));\n float dotNH = saturate(dot(normal, halfDir));\n float dotVH = saturate(dot(viewDir, halfDir));\n vec3 F = F_Schlick(f0, f90, dotVH);\n float V = V_GGX_SmithCorrelated(alpha, dotNL, dotNV);\n float D = D_GGX(alpha, dotNH);\n return F * (V * D);\n}\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via 'environmentBRDF' from \"Physically Based Shading on Mobile\"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile\nvec2 DFGApprox(const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n float dotNV = saturate(dot(normal, viewDir));\n const vec4 c0 = vec4(-1, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\n vec2 fab = vec2(-1.04, 1.04) * a004 + r.zw;\n return fab;\n}\n\n// Fdez-Ag\xfcera's \"Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting\"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\nvoid computeMultiscattering(const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter) {\n vec2 fab = DFGApprox(normal, viewDir, roughness);\n vec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = specularColor + (1.0 - specularColor) * 0.047619; // 1/21\n vec3 Fms = FssEss * Favg / (1.0 - Ems * Favg);\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n\nvoid RE_Direct_Physical(const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directSpecular += irradiance * BRDF_GGX(directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness);\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectDiffuse_Physical(const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n // Both indirect specular and indirect diffuse light accumulate here\n vec3 singleScattering = vec3(0.0);\n vec3 multiScattering = vec3(0.0);\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n computeMultiscattering(geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering);\n vec3 diffuse = material.diffuseColor * (1.0 - ( singleScattering + multiScattering));\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n",matrix_scale:"\nfloat matrixScale(in mat4 m){\n vec4 r = m[0];\n return sqrt(r[0] * r[0] + r[1] * r[1] + r[2] * r[2]);\n}\n",normal_frag_params:"\nvarying vec3 vNormal;\n",read_from_texture:"\nvec4 readFromTexture(const in sampler2D tex, const in float i, const in vec2 dim) {\n float x = intMod(i, dim.x);\n float y = floor(intDiv(i, dim.x));\n vec2 uv = (vec2(x, y) + 0.5) / dim;\n return texture2D(tex, uv);\n}\n\nvec4 readFromTexture(const in sampler2D tex, const in int i, const in vec2 dim) {\n int x = imod(i, int(dim.x));\n int y = i / int(dim.x);\n vec2 uv = (vec2(x, y) + 0.5) / dim;\n return texture2D(tex, uv);\n}\n",rgba_to_float:'\n // rgbaToFloat adapted from https://github.com/ihmeuw/glsl-rgba-to-float\n // BSD 3-Clause License\n //\n // Copyright (c) 2019, Institute for Health Metrics and Evaluation All rights reserved.\n // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n // - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n // - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n // - Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n //\n // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n // IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n // OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n // OF THE POSSIBILITY OF SUCH DAMAGE.\n\n ivec4 floatsToBytes(vec4 inputFloats, bool littleEndian) {\n ivec4 bytes = ivec4(inputFloats * 255.0);\n return (\n littleEndian\n ? bytes.abgr\n : bytes\n );\n }\n\n // Break the four bytes down into an array of 32 bits.\n void bytesToBits(const in ivec4 bytes, out bool bits[32]) {\n for (int channelIndex = 0; channelIndex < 4; ++channelIndex) {\n float acc = float(bytes[channelIndex]);\n for (int indexInByte = 7; indexInByte >= 0; --indexInByte) {\n float powerOfTwo = exp2(float(indexInByte));\n bool bit = acc >= powerOfTwo;\n bits[channelIndex * 8 + (7 - indexInByte)] = bit;\n acc = mod(acc, powerOfTwo);\n }\n }\n }\n\n // Compute the exponent of the 32-bit float.\n float getExponent(bool bits[32]) {\n const int startIndex = 1;\n const int bitStringLength = 8;\n const int endBeforeIndex = startIndex + bitStringLength;\n float acc = 0.0;\n int pow2 = bitStringLength - 1;\n for (int bitIndex = startIndex; bitIndex < endBeforeIndex; ++bitIndex) {\n acc += float(bits[bitIndex]) * exp2(float(pow2--));\n }\n return acc;\n }\n\n // Compute the mantissa of the 32-bit float.\n float getMantissa(bool bits[32], bool subnormal) {\n const int startIndex = 9;\n const int bitStringLength = 23;\n const int endBeforeIndex = startIndex + bitStringLength;\n // Leading/implicit/hidden bit convention:\n // If the number is not subnormal (with exponent 0), we add a leading 1 digit.\n float acc = float(!subnormal) * exp2(float(bitStringLength));\n int pow2 = bitStringLength - 1;\n for (int bitIndex = startIndex; bitIndex < endBeforeIndex; ++bitIndex) {\n acc += float(bits[bitIndex]) * exp2(float(pow2--));\n }\n return acc;\n }\n\n // Parse the float from its 32 bits.\n float bitsToFloat(bool bits[32]) {\n float signBit = float(bits[0]) * -2.0 + 1.0;\n float exponent = getExponent(bits);\n bool subnormal = abs(exponent - 0.0) < 0.01;\n float mantissa = getMantissa(bits, subnormal);\n float exponentBias = 127.0;\n return signBit * mantissa * exp2(exponent - exponentBias - 23.0);\n }\n\n float rgbaToFloat(vec4 texelRGBA, bool littleEndian) {\n ivec4 rgbaBytes = floatsToBytes(texelRGBA, littleEndian);\n bool bits[32];\n bytesToBits(rgbaBytes, bits);\n return bitsToFloat(bits);\n }\n',size_vert_params:"\n#if defined(dSizeType_uniform)\n uniform float uSize;\n#elif defined(dSizeType_attribute)\n attribute float aSize;\n#elif defined(dSizeType_instance) || defined(dSizeType_group) || defined(dSizeType_groupInstance)\n uniform vec2 uSizeTexDim;\n uniform sampler2D tSize;\n#endif\n\nuniform float uSizeFactor;\n",texture3d_from_1d_trilinear:"\nvec4 texture3dFrom1dTrilinear(const in sampler2D tex, const in vec3 pos, const in vec3 gridDim, const in vec2 texDim, const in float offset) {\n float gdYZ = gridDim.z * gridDim.y;\n float gdZ = gridDim.z;\n vec3 p0 = floor(pos * gridDim);\n vec3 p1 = ceil(pos * gridDim);\n vec3 pd = (pos * gridDim - p0) / (p1 - p0);\n vec4 s000 = readFromTexture(tex, offset + p0.z + p0.y * gdZ + p0.x * gdYZ, texDim);\n vec4 s100 = readFromTexture(tex, offset + p0.z + p0.y * gdZ + p1.x * gdYZ, texDim);\n vec4 s001 = readFromTexture(tex, offset + p1.z + p0.y * gdZ + p0.x * gdYZ, texDim);\n vec4 s101 = readFromTexture(tex, offset + p1.z + p0.y * gdZ + p1.x * gdYZ, texDim);\n vec4 s010 = readFromTexture(tex, offset + p0.z + p1.y * gdZ + p0.x * gdYZ, texDim);\n vec4 s110 = readFromTexture(tex, offset + p0.z + p1.y * gdZ + p1.x * gdYZ, texDim);\n vec4 s011 = readFromTexture(tex, offset + p1.z + p1.y * gdZ + p0.x * gdYZ, texDim);\n vec4 s111 = readFromTexture(tex, offset + p1.z + p1.y * gdZ + p1.x * gdYZ, texDim);\n vec4 s00 = mix(s000, s100, pd.x);\n vec4 s01 = mix(s001, s101, pd.x);\n vec4 s10 = mix(s010, s110, pd.x);\n vec4 s11 = mix(s011, s111, pd.x);\n vec4 s0 = mix(s00, s10, pd.y);\n vec4 s1 = mix(s01, s11, pd.y);\n return mix(s0, s1, pd.z);\n}\n",texture3d_from_2d_linear:"\nvec4 texture3dFrom2dLinear(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n float zSlice0 = floor(pos.z * gridDim.z);\n float column0 = intMod(zSlice0 * gridDim.x, texDim.x) / gridDim.x;\n float row0 = floor(intDiv(zSlice0 * gridDim.x, texDim.x));\n vec2 coord0 = (vec2(column0 * gridDim.x, row0 * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;\n vec4 color0 = texture2D(tex, coord0);\n\n float zSlice1 = zSlice0 + 1.0;\n float column1 = intMod(zSlice1 * gridDim.x, texDim.x) / gridDim.x;\n float row1 = floor(intDiv(zSlice1 * gridDim.x, texDim.x));\n vec2 coord1 = (vec2(column1 * gridDim.x, row1 * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;\n vec4 color1 = texture2D(tex, coord1);\n\n float delta0 = abs((pos.z * gridDim.z) - zSlice0);\n return mix(color0, color1, delta0);\n}\n",texture3d_from_2d_nearest:"\nvec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice\n float column = intMod(zSlice * gridDim.x, texDim.x) / gridDim.x;\n float row = floor(intDiv(zSlice * gridDim.x, texDim.x));\n vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;\n return texture2D(tex, coord);\n}\n",wboit_write:"\n#if defined(dRenderVariant_colorWboit)\n if (uRenderMask == MaskOpaque) {\n if (preFogAlpha < 1.0) {\n discard;\n }\n } else if (uRenderMask == MaskTransparent) {\n if (preFogAlpha != 1.0 && fragmentDepth < getDepth(gl_FragCoord.xy / uDrawingBufferSize)) {\n #ifdef dTransparentBackfaces_off\n if (interior) discard;\n #endif\n float alpha = gl_FragColor.a;\n float wboitWeight = alpha * clamp(pow(1.0 - fragmentDepth, 2.0), 0.01, 1.0);\n gl_FragColor = vec4(gl_FragColor.rgb * alpha * wboitWeight, alpha);\n // extra alpha is to handle pre-multiplied alpha\n #ifndef dGeometryType_directVolume\n gl_FragData[1] = vec4((uTransparentBackground ? alpha : 1.0) * alpha * wboitWeight);\n #else\n gl_FragData[1] = vec4(alpha * alpha * wboitWeight);\n #endif\n } else {\n discard;\n }\n }\n#endif\n",dpoit_write:"\n#if defined(dRenderVariant_colorDpoit)\n if (uRenderMask == MaskOpaque) {\n if (preFogAlpha < 1.0) {\n discard;\n }\n } else if (uRenderMask == MaskTransparent) {\n vec2 coords = gl_FragCoord.xy / uDrawingBufferSize;\n if (preFogAlpha != 1.0 && fragmentDepth < getDepth(coords)) {\n #ifdef dTransparentBackfaces_off\n if (interior) discard;\n #endif\n\n // adapted from https://github.com/tsherif/webgl2examples\n // The MIT License, Copyright 2017 Tarek Sherif, Shuai Shao\n\n vec2 lastDepth = texture2D(tDpoitDepth, coords).rg;\n vec4 lastFrontColor = texture2D(tDpoitFrontColor, coords);\n\n vec4 fragColor = gl_FragColor;\n\n // depth value always increases\n // so we can use MAX blend equation\n gl_FragData[2].rg = vec2(-MAX_DPOIT_DEPTH);\n\n // front color always increases\n // so we can use MAX blend equation\n gl_FragColor = lastFrontColor;\n\n // back color is separately blend afterwards each pass\n gl_FragData[1] = vec4(0.0);\n\n float nearestDepth = -lastDepth.x;\n float furthestDepth = lastDepth.y;\n float alphaMultiplier = 1.0 - lastFrontColor.a;\n\n if (fragmentDepth < nearestDepth || fragmentDepth > furthestDepth) {\n // Skip this depth since it's been peeled.\n return;\n }\n\n if (fragmentDepth > nearestDepth && fragmentDepth < furthestDepth) {\n // This needs to be peeled.\n // The ones remaining after MAX blended for\n // all need-to-peel will be peeled next pass.\n gl_FragData[2].rg = vec2(-fragmentDepth, fragmentDepth);\n return;\n }\n\n // write to back and front color buffer\n if (fragmentDepth == nearestDepth) {\n gl_FragColor.rgb += fragColor.rgb * fragColor.a * alphaMultiplier;\n gl_FragColor.a = 1.0 - alphaMultiplier * (1.0 - fragColor.a);\n } else {\n gl_FragData[1] += fragColor;\n }\n\n } else {\n discard;\n }\n }\n#endif\n"},E$e=/^(?!\/\/)\s*#include\s+(\S+)/gm,T$e=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*\+\+i\s*\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g,D$e=/[ \t]*\/\/.*\n/g,P$e=/[ \t]*\/\*[\s\S]*?\*\//g,k$e=/\n{2,}/g;function Wue(e){return e.replace(E$e,(t,n)=>{const r=I$e[n];if(!r)throw new Error(`empty chunk, '${n}'`);return r}).trim().replace(D$e,"\n").replace(P$e,"\n").replace(k$e,"\n")}function R$e(e,t,n,r){let i="";for(let o=parseInt(t);o radius) discard;\n #elif defined(dPointStyle_fuzzy)\n float dist = distance(gl_PointCoord, center);\n float fuzzyAlpha = 1.0 - smoothstep(0.0, radius, dist);\n if (fuzzyAlpha < 0.0001) discard;\n #endif\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #ifdef requiredDrawBuffers\n gl_FragColor = vObject;\n gl_FragData[1] = vInstance;\n gl_FragData[2] = vGroup;\n gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n #else\n gl_FragColor = vColor;\n #endif\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n gl_FragColor = material;\n\n #if defined(dPointStyle_fuzzy)\n gl_FragColor.a *= fuzzyAlpha;\n #endif\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #endif\n}\n",{drawBuffers:"optional"},{},fN),O$e=Wi("spheres","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform mat4 uModelView;\nuniform mat4 uInvProjection;\nuniform float uIsOrtho;\n\nuniform vec2 uTexDim;\nuniform sampler2D tPositionGroup;\n\nattribute mat4 aTransform;\nattribute float aInstance;\n\nvarying float vRadius;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\n#include matrix_scale\n\n/**\n * Bounding rectangle of a clipped, perspective-projected 3D Sphere.\n * Michael Mara, Morgan McGuire. 2013\n *\n * Specialization by Arseny Kapoulkine, MIT License Copyright (c) 2018\n * https://github.com/zeux/niagara\n */\nvoid sphereProjection(const in vec3 p, const in float r, const in vec2 mapping) {\n vec3 pr = p * r;\n float pzr2 = p.z * p.z - r * r;\n\n float vx = sqrt(p.x * p.x + pzr2);\n float minx = ((vx * p.x - pr.z) / (vx * p.z + pr.x)) * uProjection[0][0];\n float maxx = ((vx * p.x + pr.z) / (vx * p.z - pr.x)) * uProjection[0][0];\n\n float vy = sqrt(p.y * p.y + pzr2);\n float miny = ((vy * p.y - pr.z) / (vy * p.z + pr.y)) * uProjection[1][1];\n float maxy = ((vy * p.y + pr.z) / (vy * p.z - pr.y)) * uProjection[1][1];\n\n gl_Position.xy = vec2(maxx + minx, maxy + miny) * -0.5;\n gl_Position.xy -= mapping * vec2(maxx - minx, maxy - miny) * 0.5;\n gl_Position.xy *= gl_Position.w;\n}\n\nvoid main(void){\n vec2 mapping = vec2(1.0, 1.0); // vertices 2 and 5\n #if __VERSION__ == 100\n int m = imod(VertexID, 6);\n #else\n int m = VertexID % 6;\n #endif\n if (m == 0) {\n mapping = vec2(-1.0, 1.0);\n } else if (m == 1 || m == 3) {\n mapping = vec2(-1.0, -1.0);\n } else if (m == 4) {\n mapping = vec2(1.0, -1.0);\n }\n\n vec4 positionGroup = readFromTexture(tPositionGroup, VertexID / 6, uTexDim);\n vec3 position = positionGroup.rgb;\n float group = positionGroup.a;\n\n #include assign_color_varying\n #include assign_marker_varying\n #include assign_clipping_varying\n #include assign_size\n\n vRadius = size * matrixScale(uModelView);\n\n vec4 position4 = vec4(position, 1.0);\n vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader\n\n float d;\n if (uLod.w != 0.0 && (uLod.x != 0.0 || uLod.y != 0.0)) {\n d = dot(uCameraPlane.xyz, vModelPosition) + uCameraPlane.w;\n float f = min(\n smoothstep(uLod.x, uLod.x + uLod.z, d),\n 1.0 - smoothstep(uLod.y - uLod.z, uLod.y, d)\n ) * uLod.w;\n vRadius *= f;\n }\n\n vec4 mvPosition = uModelView * aTransform * position4;\n\n #ifdef dApproximate\n vec4 mvCorner = vec4(mvPosition.xyz, 1.0);\n mvCorner.xy += mapping * vRadius;\n gl_Position = uProjection * mvCorner;\n #else\n if (uIsOrtho == 1.0) {\n vec4 mvCorner = vec4(mvPosition.xyz, 1.0);\n mvCorner.xy += mapping * vRadius;\n gl_Position = uProjection * mvCorner;\n } else {\n gl_Position = uProjection * vec4(mvPosition.xyz, 1.0);\n sphereProjection(mvPosition.xyz, vRadius, mapping);\n }\n #endif\n\n vec4 vPoint4 = uInvProjection * gl_Position;\n vPoint = vPoint4.xyz / vPoint4.w;\n vPointViewPosition = -mvPosition.xyz / mvPosition.w;\n\n if (gl_Position.z < -gl_Position.w) {\n mvPosition.z -= 2.0 * vRadius; // avoid clipping\n gl_Position.z = (uProjection * vec4(mvPosition.xyz, 1.0)).z;\n }\n\n if (uLod.w != 0.0 && (uLod.x != 0.0 || uLod.y != 0.0)) {\n if (d < uLod.x || d > uLod.y) {\n // move out of [ -w, +w ] to 'discard' in vert shader\n gl_Position.z = 2.0 * gl_Position.w;\n }\n }\n\n #if defined(dClipPrimitive) && !defined(dClipVariant_instance) && dClipObjectCount != 0\n if (clipTest(vec4(vModelPosition.xyz, 0.0))) {\n // move out of [ -w, +w ] to 'discard' in vert shader\n gl_Position.z = 2.0 * gl_Position.w;\n }\n #else\n #include clip_instance\n #endif\n}\n","\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\nuniform mat4 uInvView;\nuniform float uAlphaThickness;\n\nvarying float vRadius;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\n#ifdef dSolidInterior\n const bool solidInterior = true;\n#else\n const bool solidInterior = false;\n#endif\n\nbool SphereImpostor(out vec3 modelPos, out vec3 cameraPos, out vec3 cameraNormal, out bool interior, out float fragmentDepth){\n vec3 cameraSpherePos = -vPointViewPosition;\n\n vec3 rayOrigin = mix(vec3(0.0, 0.0, 0.0), vPoint, uIsOrtho);\n vec3 rayDirection = mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n vec3 cameraSphereDir = mix(cameraSpherePos, rayOrigin - cameraSpherePos, uIsOrtho);\n\n float B = dot(rayDirection, cameraSphereDir);\n float det = B * B + vRadius * vRadius - dot(cameraSphereDir, cameraSphereDir);\n\n if (det < 0.0) return false;\n\n float sqrtDet = sqrt(det);\n float posT = mix(B + sqrtDet, B - sqrtDet, uIsOrtho);\n float negT = mix(B - sqrtDet, B + sqrtDet, uIsOrtho);\n\n cameraPos = rayDirection * negT + rayOrigin;\n modelPos = (uInvView * vec4(cameraPos, 1.0)).xyz;\n fragmentDepth = calcDepth(cameraPos);\n\n bool objectClipped = false;\n\n #if !defined(dClipPrimitive) && defined(dClipVariant_pixel) && dClipObjectCount != 0\n if (clipTest(vec4(modelPos, 0.0))) {\n objectClipped = true;\n fragmentDepth = -1.0;\n }\n #endif\n\n if (fragmentDepth > 0.0) {\n cameraNormal = normalize(cameraPos - cameraSpherePos);\n interior = false;\n return true;\n } else if (uDoubleSided || solidInterior) {\n cameraPos = rayDirection * posT + rayOrigin;\n modelPos = (uInvView * vec4(cameraPos, 1.0)).xyz;\n fragmentDepth = calcDepth(cameraPos);\n cameraNormal = -normalize(cameraPos - cameraSpherePos);\n interior = true;\n if (fragmentDepth > 0.0) {\n #ifdef dSolidInterior\n if (!objectClipped) {\n fragmentDepth = 0.0 + (0.0000001 / vRadius);\n cameraNormal = -mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n }\n #endif\n return true;\n }\n }\n\n return false;\n}\n\nvoid main(void){\n vec3 cameraNormal;\n float fragmentDepth;\n\n #ifdef dApproximate\n vec3 pointDir = -vPointViewPosition - vPoint;\n if (dot(pointDir, pointDir) > vRadius * vRadius) discard;\n vec3 vViewPosition = -vPointViewPosition;\n fragmentDepth = gl_FragCoord.z;\n #if !defined(dIgnoreLight) || defined(dXrayShaded)\n pointDir.z -= cos(length(pointDir) / vRadius);\n cameraNormal = -normalize(pointDir / vRadius);\n #endif\n interior = false;\n #else\n vec3 modelPos;\n vec3 cameraPos;\n bool hit = SphereImpostor(modelPos, cameraPos, cameraNormal, interior, fragmentDepth);\n if (!hit) discard;\n\n if (fragmentDepth < 0.0) discard;\n if (fragmentDepth > 1.0) discard;\n\n gl_FragDepthEXT = fragmentDepth;\n\n vec3 vModelPosition = modelPos;\n vec3 vViewPosition = cameraPos;\n #endif\n\n #include fade_lod\n #if !defined(dClipPrimitive) && defined(dClipVariant_pixel) && dClipObjectCount != 0\n #include clip_pixel\n #endif\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #ifdef requiredDrawBuffers\n gl_FragColor = vObject;\n gl_FragData[1] = vInstance;\n gl_FragData[2] = vGroup;\n gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n #else\n gl_FragColor = vColor;\n #endif\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n vec3 normal = -cameraNormal;\n #include apply_light_color\n\n if (uRenderMask == MaskTransparent && uAlphaThickness > 0.0) {\n gl_FragColor.a *= min(1.0, vRadius / uAlphaThickness);\n }\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #endif\n}\n",{fragDepth:"required",drawBuffers:"optional"},{},DD),B$e=Wi("cylinders","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform mat4 uModelView;\n\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nattribute vec3 aMapping;\nattribute vec3 aStart;\nattribute vec3 aEnd;\nattribute float aScale;\nattribute float aCap;\nattribute float aColorMode;\n\nvarying mat4 vTransform;\nvarying vec3 vStart;\nvarying vec3 vEnd;\nvarying float vSize;\nvarying float vCap;\n\nuniform float uIsOrtho;\nuniform vec3 uCameraDir;\n\nvoid main() {\n #include assign_group\n #include assign_color_varying\n #include assign_marker_varying\n #include assign_clipping_varying\n #include assign_size\n\n mat4 modelTransform = uModel * aTransform;\n\n vTransform = aTransform;\n vStart = (modelTransform * vec4(aStart, 1.0)).xyz;\n vEnd = (modelTransform * vec4(aEnd, 1.0)).xyz;\n vSize = size * aScale;\n vCap = aCap;\n\n vModelPosition = (vStart + vEnd) * 0.5;\n vec3 camDir = -mix(normalize(vModelPosition - uCameraPosition), uCameraDir, uIsOrtho);\n vec3 dir = vEnd - vStart;\n float f = aMapping.x > 0.0 ? 1.0 : 0.0;\n // ensure cylinder 'dir' is pointing towards the camera\n if(dot(camDir, dir) < 0.0) {\n dir = -dir;\n f = 1.0 - f;\n }\n\n vec3 left = cross(camDir, dir);\n vec3 up = cross(left, dir);\n left = vSize * normalize(left);\n up = vSize * normalize(up);\n\n // move vertex in object-space from center to corner\n vModelPosition += aMapping.x * dir + aMapping.y * left + aMapping.z * up;\n\n vec4 mvPosition = uView * vec4(vModelPosition, 1.0);\n vViewPosition = mvPosition.xyz;\n gl_Position = uProjection * mvPosition;\n\n if (gl_Position.z < -gl_Position.w) {\n mvPosition.z -= 2.0 * (length(vEnd - vStart) + vSize); // avoid clipping\n gl_Position.z = (uProjection * mvPosition).z;\n }\n\n #if defined(dDualColor) && defined(dRenderVariant_color) && (defined(dColorType_group) || defined(dColorType_groupInstance))\n // dual-color mixing\n // - for aColorMode between 0 and 1 use aColorMode to interpolate\n // - for aColorMode == 2 do nothing, i.e., use vColor\n // - for aColorMode == 3 use position on cylinder axis to interpolate\n if (aColorMode <= 1.0){\n vColor.rgb = mix(vColor.rgb, color2.rgb, aColorMode);\n } else if (aColorMode == 3.0) {\n vColor.rgb = mix(vColor.rgb, color2.rgb, mix(-0.25, 1.25, f / 1.5));\n }\n #endif\n\n #include clip_instance\n}\n","\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\nuniform mat4 uView;\n\nvarying mat4 vTransform;\nvarying vec3 vStart;\nvarying vec3 vEnd;\nvarying float vSize;\nvarying float vCap;\n\nuniform vec3 uCameraDir;\nuniform vec3 uCameraPosition;\nuniform mat4 uInvView;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\n#ifdef dSolidInterior\n const bool solidInterior = true;\n#else\n const bool solidInterior = false;\n#endif\n\n// adapted from https://www.shadertoy.com/view/4lcSRn\n// The MIT License, Copyright 2016 Inigo Quilez\nbool CylinderImpostor(\n in vec3 rayOrigin, in vec3 rayDir,\n in vec3 start, in vec3 end, in float radius,\n out vec3 cameraNormal, out bool interior,\n out vec3 modelPosition, out vec3 viewPosition, out float fragmentDepth\n){\n vec3 ba = end - start;\n vec3 oc = rayOrigin - start;\n\n float baba = dot(ba, ba);\n float bard = dot(ba, rayDir);\n float baoc = dot(ba, oc);\n\n float k2 = baba - bard * bard;\n float k1 = baba * dot(oc, rayDir) - baoc * bard;\n float k0 = baba * dot(oc, oc) - baoc * baoc - radius * radius * baba;\n\n float h = k1 * k1 - k2 * k0;\n if (h < 0.0) return false;\n\n bool topCap = (vCap > 0.9 && vCap < 1.1) || vCap >= 2.9;\n bool bottomCap = (vCap > 1.9 && vCap < 2.1) || vCap >= 2.9;\n\n #ifdef dSolidInterior\n bool topInterior = !topCap;\n bool bottomInterior = !bottomCap;\n topCap = true;\n bottomCap = true;\n #else\n bool topInterior = false;\n bool bottomInterior = false;\n #endif\n\n bool clipped = false;\n bool objectClipped = false;\n\n // body outside\n h = sqrt(h);\n float t = (-k1 - h) / k2;\n float y = baoc + t * bard;\n if (y > 0.0 && y < baba) {\n interior = false;\n cameraNormal = (oc + t * rayDir - ba * y / baba) / radius;\n modelPosition = rayOrigin + t * rayDir;\n viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n fragmentDepth = calcDepth(viewPosition);\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n if (clipTest(vec4(modelPosition, 0.0))) {\n objectClipped = true;\n fragmentDepth = -1.0;\n #ifdef dSolidInterior\n topCap = !topInterior;\n bottomCap = !bottomInterior;\n #endif\n }\n #endif\n if (fragmentDepth > 0.0) return true;\n clipped = true;\n }\n\n if (!clipped) {\n if (topCap && y < 0.0) {\n // top cap\n t = -baoc / bard;\n if (abs(k1 + k2 * t) < h) {\n interior = topInterior;\n cameraNormal = -ba / baba;\n modelPosition = rayOrigin + t * rayDir;\n viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n fragmentDepth = calcDepth(viewPosition);\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n if (clipTest(vec4(modelPosition, 0.0))) {\n objectClipped = true;\n fragmentDepth = -1.0;\n #ifdef dSolidInterior\n topCap = !topInterior;\n bottomCap = !bottomInterior;\n #endif\n }\n #endif\n if (fragmentDepth > 0.0) {\n #ifdef dSolidInterior\n if (interior) cameraNormal = -rayDir;\n #endif\n return true;\n }\n }\n } else if (bottomCap && y >= 0.0) {\n // bottom cap\n t = (baba - baoc) / bard;\n if (abs(k1 + k2 * t) < h) {\n interior = bottomInterior;\n cameraNormal = ba / baba;\n modelPosition = rayOrigin + t * rayDir;\n viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n fragmentDepth = calcDepth(viewPosition);\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n if (clipTest(vec4(modelPosition, 0.0))) {\n objectClipped = true;\n fragmentDepth = -1.0;\n #ifdef dSolidInterior\n topCap = !topInterior;\n bottomCap = !bottomInterior;\n #endif\n }\n #endif\n if (fragmentDepth > 0.0) {\n #ifdef dSolidInterior\n if (interior) cameraNormal = -rayDir;\n #endif\n return true;\n }\n }\n }\n }\n\n if (uDoubleSided || solidInterior) {\n // body inside\n h = -h;\n t = (-k1 - h) / k2;\n y = baoc + t * bard;\n if (y > 0.0 && y < baba) {\n interior = true;\n cameraNormal = -(oc + t * rayDir - ba * y / baba) / radius;\n modelPosition = rayOrigin + t * rayDir;\n viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n fragmentDepth = calcDepth(viewPosition);\n if (fragmentDepth > 0.0) {\n #ifdef dSolidInterior\n if (!objectClipped) {\n fragmentDepth = 0.0 + (0.0000002 / vSize);\n cameraNormal = -rayDir;\n }\n #endif\n return true;\n }\n }\n\n if (topCap && y < 0.0) {\n // top cap\n t = -baoc / bard;\n if (abs(k1 + k2 * t) < -h) {\n interior = true;\n cameraNormal = ba / baba;\n modelPosition = rayOrigin + t * rayDir;\n viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n fragmentDepth = calcDepth(viewPosition);\n if (fragmentDepth > 0.0) {\n #ifdef dSolidInterior\n if (!objectClipped) {\n fragmentDepth = 0.0 + (0.0000002 / vSize);\n cameraNormal = -rayDir;\n }\n #endif\n return true;\n }\n }\n } else if (bottomCap && y >= 0.0) {\n // bottom cap\n t = (baba - baoc) / bard;\n if (abs(k1 + k2 * t) < -h) {\n interior = true;\n cameraNormal = -ba / baba;\n modelPosition = rayOrigin + t * rayDir;\n viewPosition = (uView * vec4(modelPosition, 1.0)).xyz;\n fragmentDepth = calcDepth(viewPosition);\n if (fragmentDepth > 0.0) {\n #ifdef dSolidInterior\n if (!objectClipped) {\n fragmentDepth = 0.0 + (0.0000002 / vSize);\n cameraNormal = -rayDir;\n }\n #endif\n return true;\n }\n }\n }\n }\n\n return false;\n}\n\nvoid main() {\n vec3 rayOrigin = vModelPosition;\n vec3 rayDir = mix(normalize(vModelPosition - uCameraPosition), uCameraDir, uIsOrtho);\n\n vec3 cameraNormal;\n vec3 modelPosition;\n vec3 viewPosition;\n float fragmentDepth;\n bool hit = CylinderImpostor(rayOrigin, rayDir, vStart, vEnd, vSize, cameraNormal, interior, modelPosition, viewPosition, fragmentDepth);\n if (!hit) discard;\n\n if (fragmentDepth < 0.0) discard;\n if (fragmentDepth > 1.0) discard;\n\n gl_FragDepthEXT = fragmentDepth;\n\n vec3 vViewPosition = viewPosition;\n vec3 vModelPosition = modelPosition;\n\n #include fade_lod\n #include clip_pixel\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #ifdef requiredDrawBuffers\n gl_FragColor = vObject;\n gl_FragData[1] = vInstance;\n gl_FragData[2] = vGroup;\n gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n #else\n gl_FragColor = vColor;\n #endif\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n mat3 normalMatrix = transpose3(inverse3(mat3(uView)));\n vec3 normal = normalize(normalMatrix * -normalize(cameraNormal));\n #include apply_light_color\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #endif\n}\n",{fragDepth:"required",drawBuffers:"optional"},{},DD),L$e=Wi("text","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform mat4 uModelView;\n\nattribute vec3 aPosition;\nattribute vec2 aMapping;\nattribute float aDepth;\nattribute vec2 aTexCoord;\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nuniform float uOffsetX;\nuniform float uOffsetY;\nuniform float uOffsetZ;\n\nuniform float uIsOrtho;\nuniform float uPixelRatio;\nuniform vec4 uViewport;\n\nvarying vec2 vTexCoord;\n\n#include matrix_scale\n\nvoid main(void){\n #include assign_group\n #include assign_color_varying\n #include assign_marker_varying\n #include assign_clipping_varying\n #include assign_size\n\n vTexCoord = aTexCoord;\n\n float scale = matrixScale(uModelView);\n\n float offsetX = uOffsetX * scale;\n float offsetY = uOffsetY * scale;\n float offsetZ = (uOffsetZ + aDepth * 0.95) * scale;\n\n vec4 position4 = vec4(aPosition, 1.0);\n vec4 mvPosition = uModelView * aTransform * position4;\n\n vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader\n\n // TODO\n // #ifdef FIXED_SIZE\n // if (ortho) {\n // scale /= pixelRatio * ((uViewport.w / 2.0) / -uCameraPosition.z) * 0.1;\n // } else {\n // scale /= pixelRatio * ((uViewport.w / 2.0) / -mvPosition.z) * 0.1;\n // }\n // #endif\n\n vec4 mvCorner = vec4(mvPosition.xyz, 1.0);\n\n if (vTexCoord.x == 10.0) { // indicates background plane\n // move a bit to the back, taking distance to camera into account to avoid z-fighting\n offsetZ -= 0.001 * distance(uCameraPosition, (uProjection * mvCorner).xyz);\n }\n\n mvCorner.xy += aMapping * size * scale;\n mvCorner.x += offsetX;\n mvCorner.y += offsetY;\n\n if (uIsOrtho == 1.0) {\n mvCorner.z += offsetZ;\n } else {\n mvCorner.xyz += normalize(-mvCorner.xyz) * offsetZ;\n }\n\n gl_Position = uProjection * mvCorner;\n\n vViewPosition = -mvCorner.xyz;\n\n #include clip_instance\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nuniform sampler2D tFont;\n\nuniform vec3 uBorderColor;\nuniform float uBorderWidth;\nuniform vec3 uBackgroundColor;\nuniform float uBackgroundOpacity;\n\nvarying vec2 vTexCoord;\n\nconst float smoothness = 32.0;\nconst float gamma = 2.2;\n\nvoid main2(){\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n\nvoid main(){\n #include fade_lod\n #include clip_pixel\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n if (vTexCoord.x > 1.0) {\n #if defined(dRenderVariant_color)\n material = vec4(uBackgroundColor, uBackgroundOpacity * material.a);\n #endif\n } else {\n // retrieve signed distance\n float sdf = texture2D(tFont, vTexCoord).a + uBorderWidth;\n\n // perform adaptive anti-aliasing of the edges\n float w = clamp(smoothness * (abs(dFdx(vTexCoord.x)) + abs(dFdy(vTexCoord.y))), 0.0, 0.5);\n float a = smoothstep(0.5 - w, 0.5 + w, sdf);\n\n // gamma correction for linear attenuation\n a = pow(a, 1.0 / gamma);\n\n if (a < 0.5) discard;\n\n #if defined(dRenderVariant_color)\n material.a *= a;\n\n // add border\n float t = 0.5 + uBorderWidth;\n if (uBorderWidth > 0.0 && sdf < t) {\n material.xyz = mix(uBorderColor, material.xyz, smoothstep(t - w, t, sdf));\n }\n #endif\n }\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #ifdef requiredDrawBuffers\n gl_FragColor = vObject;\n gl_FragData[1] = vInstance;\n gl_FragData[2] = vGroup;\n gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n #else\n gl_FragColor = vColor;\n #endif\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n gl_FragColor = material;\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #endif\n}\n",{drawBuffers:"optional"},{},fN),j$e=Wi("lines","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform float uPixelRatio;\nuniform vec4 uViewport;\n\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nattribute vec2 aMapping;\nattribute vec3 aStart;\nattribute vec3 aEnd;\n\nvoid trimSegment(const in vec4 start, inout vec4 end) {\n // trim end segment so it terminates between the camera plane and the near plane\n // conservative estimate of the near plane\n float a = uProjection[2][2]; // 3rd entry in 3rd column\n float b = uProjection[3][2]; // 3rd entry in 4th column\n float nearEstimate = -0.5 * b / a;\n float alpha = (nearEstimate - start.z) / (end.z - start.z);\n end.xyz = mix(start.xyz, end.xyz, alpha);\n}\n\nvoid main(){\n float aspect = uViewport.z / uViewport.w;\n\n #include assign_group\n #include assign_color_varying\n #include assign_marker_varying\n #include assign_clipping_varying\n #include assign_size\n\n mat4 modelView = uView * uModel * aTransform;\n\n // camera space\n vec4 start = modelView * vec4(aStart, 1.0);\n vec4 end = modelView * vec4(aEnd, 1.0);\n\n // assign position\n vec4 position4 = vec4((aMapping.y < 0.5) ? aStart : aEnd, 1.0);\n vec4 mvPosition = modelView * position4;\n vViewPosition = mvPosition.xyz;\n\n vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader\n\n // special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n // but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n // perhaps there is a more elegant solution -- WestLangley\n bool perspective = (uProjection[2][3] == -1.0); // 4th entry in the 3rd column\n if (perspective) {\n if (start.z < 0.0 && end.z >= 0.0) {\n trimSegment(start, end);\n } else if (end.z < 0.0 && start.z >= 0.0) {\n trimSegment(end, start);\n }\n }\n\n // clip space\n vec4 clipStart = uProjection * start;\n vec4 clipEnd = uProjection * end;\n\n // ndc space\n vec2 ndcStart = clipStart.xy / clipStart.w;\n vec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n // direction\n vec2 dir = ndcEnd - ndcStart;\n\n // account for clip-space aspect ratio\n dir.x *= aspect;\n dir = normalize(dir);\n\n // perpendicular to dir\n vec2 offset = vec2(dir.y, - dir.x);\n\n // undo aspect ratio adjustment\n dir.x /= aspect;\n offset.x /= aspect;\n\n // sign flip\n if (aMapping.x < 0.0) offset *= -1.0;\n\n // calculate linewidth\n float linewidth;\n #ifdef dLineSizeAttenuation\n linewidth = size * uPixelRatio * ((uViewport.w / 2.0) / -start.z) * 5.0;\n #else\n linewidth = size * uPixelRatio;\n #endif\n linewidth = max(1.0, linewidth);\n\n // adjust for linewidth\n offset *= linewidth;\n\n // adjust for clip-space to screen-space conversion\n offset /= uViewport.w;\n\n // select end\n vec4 clip = (aMapping.y < 0.5) ? clipStart : clipEnd;\n\n // back to clip space\n offset *= clip.w;\n clip.xy += offset;\n gl_Position = clip;\n\n #include clip_instance\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nvoid main(){\n #include fade_lod\n #include clip_pixel\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #ifdef requiredDrawBuffers\n gl_FragColor = vObject;\n gl_FragData[1] = vInstance;\n gl_FragData[2] = vGroup;\n gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n #else\n gl_FragColor = vColor;\n #endif\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n gl_FragColor = material;\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #endif\n}\n",{drawBuffers:"optional"},{},fN),Yue=Wi("mesh","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include common_clip\n#include texture3d_from_2d_linear\n\n#ifdef dGeometryType_textureMesh\n uniform vec2 uGeoTexDim;\n uniform sampler2D tPosition;\n uniform sampler2D tGroup;\n uniform sampler2D tNormal;\n#else\n attribute vec3 aPosition;\n attribute float aGroup;\n attribute vec3 aNormal;\n#endif\nattribute mat4 aTransform;\nattribute float aInstance;\n\nvarying vec3 vNormal;\n\nvoid main(){\n #include assign_group\n #include assign_marker_varying\n #include assign_clipping_varying\n #include assign_position\n #include assign_color_varying\n #include clip_instance\n\n #ifdef dGeometryType_textureMesh\n vec3 normal = readFromTexture(tNormal, VertexID, uGeoTexDim).xyz;\n #else\n vec3 normal = aNormal;\n #endif\n mat3 normalMatrix = transpose3(inverse3(mat3(modelView)));\n vec3 transformedNormal = normalize(normalMatrix * normalize(normal));\n #if defined(dFlipSided)\n if (!uDoubleSided) { // TODO checking uDoubleSided should not be required, ASR\n transformedNormal = -transformedNormal;\n }\n #endif\n vNormal = transformedNormal;\n}\n","\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include normal_frag_params\n#include common_clip\n\nvoid main() {\n #include fade_lod\n #include clip_pixel\n\n // Workaround for buggy gl_FrontFacing (e.g. on some integrated Intel GPUs)\n vec3 fdx = dFdx(vViewPosition);\n vec3 fdy = dFdy(vViewPosition);\n vec3 faceNormal = normalize(cross(fdx,fdy));\n bool frontFacing = dot(vNormal, faceNormal) > 0.0;\n\n #if defined(dFlipSided)\n interior = frontFacing;\n #else\n interior = !frontFacing;\n #endif\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #ifdef requiredDrawBuffers\n gl_FragColor = vObject;\n gl_FragData[1] = vInstance;\n gl_FragData[2] = vGroup;\n gl_FragData[3] = packDepthToRGBA(fragmentDepth);\n #else\n gl_FragColor = vColor;\n #endif\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #if defined(dFlatShaded)\n vec3 normal = -faceNormal;\n #else\n vec3 normal = -normalize(vNormal);\n if (uDoubleSided) normal *= float(frontFacing) * 2.0 - 1.0;\n #endif\n #include apply_light_color\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #endif\n}\n",{drawBuffers:"optional"},{},DD),U$e=Wi("direct-volume","\nprecision highp float;\n\nattribute vec3 aPosition;\nattribute mat4 aTransform;\nattribute float aInstance;\n\nuniform mat4 uModelView;\nuniform mat4 uProjection;\nuniform vec4 uInvariantBoundingSphere;\n\nvarying vec3 vOrigPos;\nvarying float vInstance;\nvarying vec4 vBoundingSphere;\nvarying mat4 vTransform;\n\nuniform vec3 uBboxSize;\nuniform vec3 uBboxMin;\nuniform vec3 uBboxMax;\nuniform vec3 uGridDim;\nuniform mat4 uTransform;\n\nuniform mat4 uUnitToCartn;\n\nvoid main() {\n vec4 unitCoord = vec4(aPosition + vec3(0.5), 1.0);\n vec4 mvPosition = uModelView * aTransform * uUnitToCartn * unitCoord;\n\n vOrigPos = (aTransform * uUnitToCartn * unitCoord).xyz;\n vInstance = aInstance;\n vBoundingSphere = vec4(\n (aTransform * vec4(uInvariantBoundingSphere.xyz, 1.0)).xyz,\n uInvariantBoundingSphere.w\n );\n vTransform = aTransform;\n\n gl_Position = uProjection * mvPosition;\n\n // move z position to near clip plane (but not too close to get precision issues)\n gl_Position.z = gl_Position.w - 0.01;\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include light_frag_params\n\n#if dClipObjectCount != 0\n uniform int uClipObjectType[dClipObjectCount];\n uniform bool uClipObjectInvert[dClipObjectCount];\n uniform vec3 uClipObjectPosition[dClipObjectCount];\n uniform vec4 uClipObjectRotation[dClipObjectCount];\n uniform vec3 uClipObjectScale[dClipObjectCount];\n#endif\n#include common_clip\n\n#include read_from_texture\n#include texture3d_from_1d_trilinear\n#include texture3d_from_2d_nearest\n#include texture3d_from_2d_linear\n\nuniform mat4 uProjection, uTransform, uModelView, uModel, uView;\nuniform vec3 uCameraDir;\n\nuniform sampler2D tDepth;\nuniform vec2 uDrawingBufferSize;\n\nvarying vec3 vOrigPos;\nvarying float vInstance;\nvarying vec4 vBoundingSphere;\nvarying mat4 vTransform;\n\nuniform mat4 uInvView;\nuniform vec3 uGridDim;\nuniform vec3 uBboxSize;\nuniform sampler2D tTransferTex;\nuniform float uTransferScale;\nuniform float uStepScale;\nuniform float uJumpLength;\n\nuniform int uObjectId;\nuniform int uVertexCount;\nuniform int uInstanceCount;\nuniform int uGroupCount;\n\n#if defined(dColorMarker)\n uniform vec3 uHighlightColor;\n uniform vec3 uSelectColor;\n uniform vec3 uDimColor;\n uniform float uHighlightStrength;\n uniform float uSelectStrength;\n uniform float uDimStrength;\n uniform int uMarkerPriority;\n uniform float uMarkerAverage;\n\n uniform float uMarker;\n uniform vec2 uMarkerTexDim;\n uniform sampler2D tMarker;\n#endif\n\nuniform float uMetalness;\nuniform float uRoughness;\n\nuniform bool uFog;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\n\nuniform float uAlpha;\nuniform bool uTransparentBackground;\nuniform float uXrayEdgeFalloff;\nuniform float uExposure;\n\nuniform int uRenderMask;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uIsOrtho;\n\nuniform vec3 uCellDim;\nuniform vec3 uCameraPosition;\nuniform mat4 uCartnToUnit;\n\n#if __VERSION__ != 100\n // for webgl1 this is given as a 'define'\n uniform int uMaxSteps;\n#endif\n\n#if defined(dGridTexType_2d)\n precision highp sampler2D;\n uniform sampler2D tGridTex;\n uniform vec3 uGridTexDim;\n#elif defined(dGridTexType_3d)\n precision highp sampler3D;\n uniform sampler3D tGridTex;\n#endif\n\n#if defined(dColorType_uniform)\n uniform vec3 uColor;\n#elif defined(dColorType_texture)\n uniform vec2 uColorTexDim;\n uniform sampler2D tColor;\n#endif\n\n#ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance) || defined(dOverpaintType_vertexInstance)\n uniform vec2 uOverpaintTexDim;\n uniform sampler2D tOverpaint;\n #endif\n#endif\n\n#ifdef dUsePalette\n uniform sampler2D tPalette;\n#endif\n\n#if defined(dGridTexType_2d)\n vec4 textureVal(vec3 pos) {\n return texture3dFrom2dLinear(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n }\n vec4 textureGroup(vec3 pos) {\n return texture3dFrom2dNearest(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n }\n#elif defined(dGridTexType_3d)\n vec4 textureVal(vec3 pos) {\n return texture(tGridTex, pos + (vec3(0.5) / uGridDim));\n }\n vec4 textureGroup(vec3 pos) {\n return texelFetch(tGridTex, ivec3(pos * uGridDim), 0);\n }\n#endif\n\nfloat calcDepth(const in vec3 pos) {\n vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;\n return 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\n\nfloat transferFunction(float value) {\n return texture2D(tTransferTex, vec2(value, 0.0)).a;\n}\n\nfloat getDepth(const in vec2 coords) {\n #ifdef depthTextureSupport\n return texture2D(tDepth, coords).r;\n #else\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n #endif\n}\n\nconst float gradOffset = 0.5;\n\nvec3 v3m4(vec3 p, mat4 m) {\n return (m * vec4(p, 1.0)).xyz;\n}\n\nfloat preFogAlphaBlended = 0.0;\n\nvec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {\n mat3 normalMatrix = transpose3(inverse3(mat3(uModelView * vTransform)));\n mat4 cartnToUnit = uCartnToUnit * inverse4(vTransform);\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n mat4 modelTransform = uModel * vTransform * uTransform;\n #endif\n mat4 modelViewTransform = uModelView * vTransform * uTransform;\n\n vec3 scaleVol = vec3(1.0) / uGridDim;\n vec3 pos = startLoc;\n vec4 cell;\n float prevValue = -1.0;\n float value = 0.0;\n vec4 src = vec4(0.0);\n vec4 dst = vec4(0.0);\n float fragmentDepth;\n\n vec3 posMin = vec3(0.0);\n vec3 posMax = vec3(1.0) - vec3(1.0) / uGridDim;\n\n vec3 unitPos;\n\n vec3 nextPos;\n float nextValue;\n\n vec4 material;\n vec4 overpaint;\n float metalness = uMetalness;\n float roughness = uRoughness;\n\n vec3 gradient = vec3(1.0);\n vec3 dx = vec3(gradOffset * scaleVol.x, 0.0, 0.0);\n vec3 dy = vec3(0.0, gradOffset * scaleVol.y, 0.0);\n vec3 dz = vec3(0.0, 0.0, gradOffset * scaleVol.z);\n\n float maxDist = min(vBoundingSphere.w * 2.0, uFar - uNear);\n float maxDistSq = maxDist * maxDist;\n\n for (int i = 0; i < uMaxSteps; ++i) {\n // break when beyond bounding-sphere or far-plane\n vec3 distVec = startLoc - pos;\n if (dot(distVec, distVec) > maxDistSq) break;\n\n unitPos = v3m4(pos, cartnToUnit);\n\n // continue when outside of grid\n if (unitPos.x > posMax.x || unitPos.y > posMax.y || unitPos.z > posMax.z ||\n unitPos.x < posMin.x || unitPos.y < posMin.y || unitPos.z < posMin.z\n ) {\n prevValue = value;\n pos += step;\n continue;\n }\n\n cell = textureVal(unitPos);\n value = cell.a; // current voxel value\n\n if (uJumpLength > 0.0 && value < 0.01) {\n nextPos = pos + rayDir * uJumpLength;\n nextValue = textureVal(v3m4(nextPos, cartnToUnit)).a;\n if (nextValue < 0.01) {\n prevValue = nextValue;\n pos = nextPos;\n continue;\n }\n }\n\n vec4 mvPosition = modelViewTransform * vec4(unitPos * uGridDim, 1.0);\n if (calcDepth(mvPosition.xyz) > getDepth(gl_FragCoord.xy / uDrawingBufferSize))\n break;\n\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n vec3 vModelPosition = v3m4(unitPos * uGridDim, modelTransform);\n if (clipTest(vec4(vModelPosition, 0.0))) {\n prevValue = value;\n pos += step;\n continue;\n }\n #endif\n\n vec3 vViewPosition = mvPosition.xyz;\n material.a = transferFunction(value);\n\n #ifdef dPackedGroup\n float group = unpackRGBToInt(textureGroup(floor(unitPos * uGridDim + 0.5) / uGridDim).rgb);\n #else\n vec3 g = floor(unitPos * uGridDim + 0.5);\n // note that we swap x and z because the texture is flipped around y\n #if defined(dAxisOrder_012)\n float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y; // 210\n #elif defined(dAxisOrder_021)\n float group = g.y + g.z * uGridDim.y + g.x * uGridDim.y * uGridDim.z; // 120\n #elif defined(dAxisOrder_102)\n float group = g.z + g.x * uGridDim.z + g.y * uGridDim.z * uGridDim.x; // 201\n #elif defined(dAxisOrder_120)\n float group = g.x + g.z * uGridDim.x + g.y * uGridDim.x * uGridDim.z; // 021\n #elif defined(dAxisOrder_201)\n float group = g.y + g.x * uGridDim.y + g.z * uGridDim.y * uGridDim.x; // 102\n #elif defined(dAxisOrder_210)\n float group = g.x + g.y * uGridDim.x + g.z * uGridDim.x * uGridDim.y; // 012\n #endif\n #endif\n\n #if defined(dColorType_direct) && defined(dUsePalette)\n material.rgb = texture2D(tPalette, vec2(value, 0.0)).rgb;\n #elif defined(dColorType_uniform)\n material.rgb = uColor;\n #elif defined(dColorType_instance)\n material.rgb = readFromTexture(tColor, vInstance, uColorTexDim).rgb;\n #elif defined(dColorType_group)\n material.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n #elif defined(dColorType_groupInstance)\n material.rgb = readFromTexture(tColor, vInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n #elif defined(dColorType_vertex)\n material.rgb = texture3dFrom1dTrilinear(tColor, unitPos, uGridDim, uColorTexDim, 0.0).rgb;\n #elif defined(dColorType_vertexInstance)\n material.rgb = texture3dFrom1dTrilinear(tColor, unitPos, uGridDim, uColorTexDim, vInstance * float(uVertexCount)).rgb;\n #endif\n\n #ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance)\n overpaint = readFromTexture(tOverpaint, vInstance * float(uGroupCount) + group, uOverpaintTexDim);\n #elif defined(dOverpaintType_vertexInstance)\n overpaint = texture3dFrom1dTrilinear(tOverpaint, unitPos, uGridDim, uOverpaintTexDim, vInstance * float(uVertexCount));\n #endif\n\n material.rgb = mix(material.rgb, overpaint.rgb, overpaint.a);\n #endif\n\n #ifdef dIgnoreLight\n gl_FragColor.rgb = material.rgb;\n #else\n if (material.a >= 0.01) {\n #ifdef dPackedGroup\n // compute gradient by central differences\n gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a;\n gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a;\n gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a;\n #else\n gradient = cell.xyz * 2.0 - 1.0;\n #endif\n vec3 normal = -normalize(normalMatrix * normalize(gradient));\n #include apply_light_color\n } else {\n gl_FragColor.rgb = material.rgb;\n }\n #endif\n\n gl_FragColor.a = material.a * uAlpha * uTransferScale;\n\n #if defined(dColorMarker)\n float marker = uMarker;\n if (uMarker == -1.0) {\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n #endif\n #include apply_marker_color\n\n preFogAlphaBlended = (1.0 - preFogAlphaBlended) * gl_FragColor.a + preFogAlphaBlended;\n fragmentDepth = calcDepth(mvPosition.xyz);\n #include apply_fog\n\n src = gl_FragColor;\n\n if (!uTransparentBackground) {\n // done in 'apply_fog' otherwise\n src.rgb *= src.a;\n }\n dst = (1.0 - dst.a) * src + dst; // standard blending\n\n // break if the color is opaque enough\n if (dst.a > 0.95)\n break;\n\n pos += step;\n }\n\n return dst;\n}\n\n// TODO: support float texture for higher precision values???\n// TODO: support clipping exclusion texture support\n\nvoid main() {\n if (gl_FrontFacing)\n discard;\n\n vec3 rayDir = mix(normalize(vOrigPos - uCameraPosition), uCameraDir, uIsOrtho);\n vec3 step = rayDir * uStepScale;\n\n float boundingSphereNear = distance(vBoundingSphere.xyz, uCameraPosition) - vBoundingSphere.w;\n float d = max(uNear, boundingSphereNear) - mix(0.0, distance(vOrigPos, uCameraPosition), uIsOrtho);\n vec3 start = mix(uCameraPosition, vOrigPos, uIsOrtho) + (d * rayDir);\n gl_FragColor = raymarch(start, step, rayDir);\n\n float fragmentDepth = calcDepth((uModelView * vec4(start, 1.0)).xyz);\n float preFogAlpha = clamp(preFogAlphaBlended, 0.0, 1.0);\n #include wboit_write\n}\n",{fragDepth:"optional",drawBuffers:"optional"},{},DD),z$e=Wi("image","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_vert_params\n\nattribute vec3 aPosition;\nattribute vec2 aUv;\nattribute mat4 aTransform;\nattribute float aInstance;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\nvoid main() {\n #include assign_position\n\n vUv = aUv;\n vInstance = aInstance;\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_frag_params\n#include common_clip\n\nuniform vec2 uImageTexDim;\nuniform sampler2D tImageTex;\nuniform sampler2D tGroupTex;\n\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\n#if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell) || defined(dInterpolation_bspline)\n #define dInterpolation_cubic\n#endif\n\n#if defined(dInterpolation_cubic)\n #if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell)\n #if defined(dInterpolation_catmulrom)\n const float B = 0.0;\n const float C = 0.5;\n #elif defined(dInterpolation_mitchell)\n const float B = 0.333;\n const float C = 0.333;\n #endif\n\n float cubicFilter(float x){\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f < 1.0) {\n return ((12.0 - 9.0 * B - 6.0 * C) * (f * f * f) +\n (-18.0 + 12.0 * B + 6.0 * C) * (f * f) +\n (6.0 - 2.0 * B)) / 6.0;\n }else if (f >= 1.0 && f < 2.0){\n return ((-B - 6.0 * C) * ( f * f * f)\n + (6.0 * B + 30.0 * C) * (f * f) +\n (-(12.0 * B) - 48.0 * C) * f +\n 8.0 * B + 24.0 * C) / 6.0;\n }else{\n return 0.0;\n }\n }\n #elif defined(dInterpolation_bspline)\n float cubicFilter(float x) {\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f >= 0.0 && f <= 1.0){\n return (2.0 / 3.0) + (0.5) * (f * f * f) - (f * f);\n } else if (f > 1.0 && f <= 2.0) {\n return 1.0 / 6.0 * pow((2.0 - f), 3.0);\n }\n return 1.0;\n }\n #endif\n\n vec4 biCubic(sampler2D tex, vec2 texCoord) {\n vec2 texelSize = 1.0 / uImageTexDim;\n texCoord -= texelSize / 2.0;\n vec4 nSum = vec4(0.0);\n float nDenom = 0.0;\n vec2 cell = fract(texCoord * uImageTexDim);\n for (float m = -1.0; m <= 2.0; ++m) {\n for (float n = -1.0; n <= 2.0; ++n) {\n vec4 vecData = texture2D(tex, texCoord + texelSize * vec2(m, n));\n float c = cubicFilter(m - cell.x) * cubicFilter(-n + cell.y);\n nSum += vecData * c;\n nDenom += c;\n }\n }\n return nSum / nDenom;\n }\n#endif\n\nvoid main() {\n #include fade_lod\n #include clip_pixel\n\n #if defined(dInterpolation_cubic)\n vec4 imageData = biCubic(tImageTex, vUv);\n #else\n vec4 imageData = texture2D(tImageTex, vUv);\n #endif\n imageData.a = clamp(imageData.a, 0.0, 1.0);\n if (imageData.a > 0.9) imageData.a = 1.0;\n\n float fragmentDepth = gl_FragCoord.z;\n\n #if defined(dRenderVariant_pick)\n if (imageData.a < 0.3)\n discard;\n #ifdef requiredDrawBuffers\n gl_FragColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n gl_FragData[1] = vec4(packIntToRGB(vInstance), 1.0);\n gl_FragData[2] = vec4(texture2D(tGroupTex, vUv).rgb, 1.0);\n gl_FragData[3] = packDepthToRGBA(gl_FragCoord.z);\n #else\n gl_FragColor = vColor;\n if (uPickType == 1) {\n gl_FragColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n gl_FragColor = vec4(packIntToRGB(vInstance), 1.0);\n } else {\n gl_FragColor = vec4(texture2D(tGroupTex, vUv).rgb, 1.0);\n }\n #endif\n #elif defined(dRenderVariant_depth)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n #elif defined(dRenderVariant_marking)\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n if (uMarkingType == 1) {\n if (marker > 0.0 || imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n } else {\n if (marker == 0.0 || imageData.a < 0.05)\n discard;\n float depthTest = 1.0;\n if (uMarkingDepthTest) {\n depthTest = (fragmentDepth >= getDepthPacked(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;\n }\n bool isHighlight = intMod(marker, 2.0) > 0.1;\n gl_FragColor = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0);\n }\n #elif defined(dRenderVariant_color)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = imageData;\n gl_FragColor.a *= uAlpha;\n\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #include dpoit_write\n #endif\n}\n",{drawBuffers:"optional"},{},fN);function Xue(e,t){var n;if(void 0===e)return"";const r=(null===(n=e.dRenderVariant)||void 0===n?void 0:n.ref.value)||"",i=[];for(const o in e){if(t?.(o,r,e))continue;const a=e[o].ref.value;void 0!==a&&("string"==typeof a?i.push(`#define ${o}_${a}`):"number"==typeof a?i.push(`#define ${o} ${a}`):"boolean"==typeof a?a&&i.push(`#define ${o}`):Hi())}return i.join("\n")+"\n"}const G$e="\n#define attribute in\n#define varying out\n#define texture2D texture\n",q$e="\n#define varying in\n#define texture2D texture\n#define textureCube texture\n#define texture2DLodEXT textureLod\n#define textureCubeLodEXT textureLod\n\n#define gl_FragColor out_FragData0\n#define gl_FragDepthEXT gl_FragDepth\n\n#define depthTextureSupport\n";function K$e(e,t){switch(t){case"b":case"b[]":return e.BOOL;case"f":case"f[]":return e.FLOAT;case"i":case"i[]":return e.INT;case"v2":case"v2[]":return e.FLOAT_VEC2;case"v3":case"v3[]":return e.FLOAT_VEC3;case"v4":case"v4[]":return e.FLOAT_VEC4;case"iv2":case"iv2[]":return e.INT_VEC2;case"iv3":case"iv3[]":return e.INT_VEC3;case"iv4":case"iv4[]":return e.INT_VEC4;case"m3":case"m3[]":return e.FLOAT_MAT3;case"m4":case"m4[]":return e.FLOAT_MAT4;default:console.error(`unknown uniform kind '${t}'`)}}function Q$e(e,t,n){e.uniform1f(t,n)}function J$e(e,t,n){e.uniform1fv(t,n)}function eYe(e,t,n){e.uniform1i(t,n)}function tYe(e,t,n){e.uniform1iv(t,n)}function nYe(e,t,n){e.uniform2fv(t,n)}function rYe(e,t,n){e.uniform3fv(t,n)}function iYe(e,t,n){e.uniform4fv(t,n)}function oYe(e,t,n){e.uniform2iv(t,n)}function sYe(e,t,n){e.uniform3iv(t,n)}function aYe(e,t,n){e.uniform4iv(t,n)}function lYe(e,t,n){e.uniformMatrix3fv(t,!1,n)}function cYe(e,t,n){e.uniformMatrix4fv(t,!1,n)}function Kue(e){switch(e){case"f":return Q$e;case"f[]":return J$e;case"i":case"t":case"b":return eYe;case"i[]":case"t[]":case"b[]":return tYe;case"v2":case"v2[]":return nYe;case"v3":case"v3[]":return rYe;case"v4":case"v4[]":return iYe;case"iv2":case"iv2[]":return oYe;case"iv3":case"iv3[]":return sYe;case"iv4":case"iv4[]":return aYe;case"m3":case"m3[]":return lYe;case"m4":case"m4[]":return cYe}}const fYe=Kc();function x9(e){const t=e.createBuffer();if(null===t)throw new Error("Could not create WebGL buffer");return t}function Zue(e,t,n,r){let i=x9(e);const o=function pYe(e,t){switch(t){case"static":return e.STATIC_DRAW;case"dynamic":return e.DYNAMIC_DRAW;case"stream":return e.STREAM_DRAW}}(e,n),s=function mYe(e,t){switch(t){case"attribute":return e.ARRAY_BUFFER;case"elements":return e.ELEMENT_ARRAY_BUFFER;case"uniform":if(Cn(e))return e.UNIFORM_BUFFER;throw new Error("WebGL2 is required for uniform buffers")}}(e,r),a=function hYe(e,t){return t instanceof Uint8Array?e.UNSIGNED_BYTE:t instanceof Int8Array?e.BYTE:t instanceof Uint16Array?e.UNSIGNED_SHORT:t instanceof Int16Array?e.SHORT:t instanceof Uint32Array?e.UNSIGNED_INT:t instanceof Int32Array?e.INT:t instanceof Float32Array?e.FLOAT:void Hi()}(e,t),l=t.BYTES_PER_ELEMENT,c=t.length;function u(f){e.bindBuffer(s,i),e.bufferData(s,f,o)}u(t);let d=!1;return{id:fYe(),_usageHint:o,_bufferType:s,_dataType:a,_bpe:l,length:c,getBuffer:()=>i,updateData:u,updateSubData:(f,p,m)=>{e.bindBuffer(s,i),m-p===f.length?e.bufferSubData(s,0,f):e.bufferSubData(s,p*l,f.subarray(p,p+m))},reset:()=>{i=x9(e),u(t)},destroy:()=>{d||(e.deleteBuffer(i),d=!0)}}}function gYe(e,t,n){if("float32"===t)switch(n){case 1:return e.FLOAT;case 2:return e.FLOAT_VEC2;case 3:return e.FLOAT_VEC3;case 4:return e.FLOAT_VEC4;case 16:return e.FLOAT_MAT4}Hi()}const xYe=Kc();function _9(e){const t=e.createProgram();if(null===t)throw new Error("Could not create WebGL program");return t}function AYe(e,t,n,r,i){const{defineValues:o,shaderCode:s,schema:a}=i;let l=_9(e);const c=xYe(),u=function X$e(e,t,n,r){const i=Xue(n,r.ignoreDefine),o=Xue(n,r.ignoreDefine),s=Cn(e)?function W$e(e,t){const n=["#version 300 es"];if(t.drawBuffers&&e.drawBuffers&&n.push("#define requiredDrawBuffers"),t.multiDraw)if(e.multiDraw)n.push("#extension GL_ANGLE_multi_draw : require"),n.push("#define enabledMultiDraw");else if("required"===t.multiDraw)throw new Error("required 'GL_ANGLE_multi_draw' extension not available");if(t.clipCullDistance)if(e.clipCullDistance)n.push("#extension GL_ANGLE_clip_cull_distance : enable"),n.push("#define enabledClipCullDistance");else if("required"===t.clipCullDistance)throw new Error("required 'GL_ANGLE_clip_cull_distance' extension not available");if(t.conservativeDepth)if(e.conservativeDepth)n.push("#extension GL_EXT_conservative_depth : enable"),n.push("#define enabledConservativeDepth");else if("required"===t.conservativeDepth)throw new Error("required 'GL_EXT_conservative_depth' extension not available");return e.noNonInstancedActiveAttribs&&n.push("#define noNonInstancedActiveAttribs"),n.push(G$e),n.join("\n")+"\n"}(t,r.extensions):function V$e(e,t){const n=[];if(t.drawBuffers)if(e.drawBuffers)n.push("#define requiredDrawBuffers");else if("required"===t.drawBuffers)throw new Error("required 'GL_EXT_draw_buffers' extension not available");if(t.multiDraw)if(e.multiDraw)n.push("#extension GL_ANGLE_multi_draw : require"),n.push("#define enabledMultiDraw");else if("required"===t.multiDraw)throw new Error("required 'GL_ANGLE_multi_draw' extension not available");return n.join("\n")+"\n"}(t,r.extensions),a=Cn(e)?function $$e(e,t,n,r){const i=["#version 300 es",`layout(location = 0) out highp ${r[0]||"vec4"} out_FragData0;`];if(n.fragDepth&&t.fragDepth&&i.push("#define enabledFragDepth"),n.drawBuffers&&t.drawBuffers){i.push("#define requiredDrawBuffers");for(let s=1,a=e.getParameter(e.MAX_DRAW_BUFFERS);s{const o=n[i];if("attribute"===o.type){const s=e.getAttribLocation(t,i);r[i]=s}else if("uniform"===o.type){let s=e.getUniformLocation(t,i);null===s&&function Z$e(e){return e.endsWith("[]")}(o.kind)&&(s=e.getUniformLocation(t,i+"[0]")),r[i]=s}else if("texture"===o.type){const s=e.getUniformLocation(t,i);r[i]=s}}),r}(e,l,a),m=function uYe(e){const t={};return Object.keys(e).forEach(n=>{const r=e[n];"uniform"===r.type?t[n]=Kue(r.kind):"texture"===r.type&&(t[n]=Kue("t"))}),t}(a),$n&&(function SYe(e,t,n){const r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i{t.currentProgramId=c,e.useProgram(l)},setUniforms:y=>{for(let v=0,x=y.length;v{const x=p[y];null!==x&&m[y](e,x,v)},bindAttributes:y=>{t.clearVertexAttribsState();for(let v=0,x=y.length;v{for(let x=0,_=y.length;x<_;++x){const[w,A]=y[x],M=p[w];-1!==M&&A.changeOffset(M,v)}},bindTextures:(y,v)=>{for(let x=0,_=y.length;x<_;++x){const[w,A]=y[x],M=p[w];null!=M&&(A.bind(x+v),m[w](e,M,x+v))}},reset:()=>{l=_9(e),h()},destroy:()=>{g||(d.destroy(),f.destroy(),e.deleteProgram(l),g=!0)}}}const IYe=Kc();function pN(e,t){const{type:n,source:r}=t,i=e.createShader("vert"===n?e.VERTEX_SHADER:e.FRAGMENT_SHADER);if(null===i)throw new Error(`Error creating ${n} shader`);if(e.shaderSource(i,r),e.compileShader(i),$n&&!1===e.getShaderParameter(i,e.COMPILE_STATUS))throw console.warn(`'${n}' shader info log '${e.getShaderInfoLog(i)}'\n${function EYe(e){const t=e.split("\n");for(let n=0;n{const o=e(i);let s=r.get(o);return s||(s=function DYe(e,t=0){return{value:e,usageCount:t}}(t(i)),r.set(o,s)),s.usageCount+=1,function PYe(e){return{free:()=>{e.usageCount-=1},value:e.value}}(s)},clear:()=>{r.forEach((i,o)=>{i.usageCount<=0&&(i.usageCount<0&&console.warn("Reference usageCount below zero."),n(i.value),r.delete(o))})},get count(){return r.size},dispose:()=>{r.forEach(i=>n(i.value)),r.clear()}}}const kYe=Kc();function Jue(e){const t=e.createRenderbuffer();if(null===t)throw new Error("Could not create WebGL renderbuffer");return t}const FYe=Kc();function ede(e){const{vertexArrayObject:t}=e;if(!t)throw new Error("VertexArrayObject not supported");const n=t.createVertexArray();if(!n)throw new Error("Could not create WebGL vertex array");return n}function tde(e){const{vertexArrayObject:t}=e;if(null===t)throw new Error("VertexArrayObject not supported");return t}function nde(e){return{...e.value,destroy:()=>{e.free()}}}function LYe(e,t,n,r){const i={attribute:new Set,elements:new Set,framebuffer:new Set,program:new Set,renderbuffer:new Set,shader:new Set,texture:new Set,cubeTexture:new Set,vertexArray:new Set};function o(c,u){return i[c].add(u),n.resourceCounts[c]+=1,{...u,destroy:()=>{u.destroy(),i[c].delete(u),n.resourceCounts[c]-=1}}}const s=Que(c=>JSON.stringify(c),c=>o("shader",function TYe(e,t){let n=pN(e,t);return{id:IYe(),attach:r=>{e.attachShader(r,n)},reset:()=>{n=pN(e,t)},destroy:()=>{e.deleteShader(n)}}}(e,c)),c=>{c.destroy()});function a(c,u){return nde(s.get({type:c,source:u}))}const l=Que(c=>{var u;const d=[c.shaderCode.id],f=(null===(u=c.defineValues.dRenderVariant)||void 0===u?void 0:u.ref.value)||"";return Object.keys(c.defineValues).forEach(p=>{var m,h;null!==(h=(m=c.shaderCode).ignoreDefine)&&void 0!==h&&h.call(m,p,f,c.defineValues)||d.push(RU(p),function BYe(e){return"boolean"==typeof e?e?1:0:"number"==typeof e?1e4*e:RU(e)}(c.defineValues[p].ref.value))}),Zc(d).toString()},c=>o("program",AYe(e,t,r,a,c)),c=>{c.destroy()});return{attribute:(c,u,d,f)=>o("attribute",function yYe(e,t,n,r,i,o,s="static"){const{instancedArrays:a}=n,l=Zue(e,r,s,"attribute"),{_bufferType:c,_dataType:u,_bpe:d}=l;return{...l,divisor:o,bind:f=>{if(e.bindBuffer(c,l.getBuffer()),16===i)for(let p=0;p<4;++p)t.enableVertexAttrib(f+p),e.vertexAttribPointer(f+p,4,u,!1,16*d,4*p*d),a.vertexAttribDivisor(f+p,o);else t.enableVertexAttrib(f),e.vertexAttribPointer(f,i,u,!1,0,0),a.vertexAttribDivisor(f,o)},changeOffset:(f,p)=>{const m=p*d*i;if(e.bindBuffer(c,l.getBuffer()),16===i)for(let h=0;h<4;++h)e.vertexAttribPointer(f+h,4,u,!1,16*d,4*h*d+m);else e.vertexAttribPointer(f,i,u,!1,0,m)}}}(e,t,r,c,u,d,f)),elements:(c,u)=>o("elements",function vYe(e,t,n="static"){const r=Zue(e,t,n,"elements");return{...r,bind:()=>{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.getBuffer())}}}(e,c,u)),framebuffer:()=>o("framebuffer",function TWe(e){let t=Hue(e),n=!1;return{id:Vue(),bind:()=>e.bindFramebuffer(e.FRAMEBUFFER,t),reset:()=>{t=Hue(e)},destroy:()=>{n||(e.deleteFramebuffer(t),n=!0)}}}(e)),program:(c,u,d)=>nde(l.get({defineValues:c,shaderCode:u,schema:d})),renderbuffer:(c,u,d,f)=>o("renderbuffer",function NYe(e,t,n,r,i){let o=Jue(e);const s=()=>e.bindRenderbuffer(e.RENDERBUFFER,o),a=function MYe(e,t){switch(t){case"depth16":return e.DEPTH_COMPONENT16;case"stencil8":return e.STENCIL_INDEX8;case"rgba4":return e.RGBA4;case"depth-stencil":return e.DEPTH_STENCIL;case"depth24":if(Cn(e))return e.DEPTH_COMPONENT24;throw new Error("WebGL2 needed for `depth24` renderbuffer format");case"depth32f":if(Cn(e))return e.DEPTH_COMPONENT32F;throw new Error("WebGL2 needed for `depth32f` renderbuffer format");case"depth24-stencil8":if(Cn(e))return e.DEPTH24_STENCIL8;throw new Error("WebGL2 needed for `depth24-stencil8` renderbuffer format");case"depth32f-stencil8":if(Cn(e))return e.DEPTH32F_STENCIL8;throw new Error("WebGL2 needed for `depth32f-stencil8` renderbuffer format")}}(e,t),l=function RYe(e,t){switch(t){case"depth":return e.DEPTH_ATTACHMENT;case"stencil":return e.STENCIL_ATTACHMENT;case"depth-stencil":return e.DEPTH_STENCIL_ATTACHMENT;case"color0":return e.COLOR_ATTACHMENT0}}(e,n);function c(){s(),e.renderbufferStorage(e.RENDERBUFFER,a,r,i)}c();let u=!1;return{id:kYe(),bind:s,attachFramebuffer:d=>{d.bind(),s(),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,o),$n&&dN(e)},detachFramebuffer:d=>{d.bind(),s(),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,null),$n&&dN(e)},setSize:(d,f)=>{r=d,i=f,c()},reset:()=>{o=Jue(e),c()},destroy:()=>{u||(e.deleteRenderbuffer(o),u=!0)}}}(e,c,u,d,f)),shader:a,texture:(c,u,d,f)=>o("texture",function OXe(e,t,n,r,i,o){const s=C9();let a=vde(e);if(n.endsWith("float32")&&"float"!==i||n.endsWith("float16")&&"fp16"!==i||n.endsWith("uint8")&&"ubyte"!==i||n.endsWith("int32")&&"int"!==i||n.endsWith("depth")&&"ushort"!==i&&"float"!==i)throw new Error(`texture kind '${n}' and type '${i}' are incompatible`);if(!t.depthTexture&&"depth"===r)throw new Error("extension 'WEBGL_depth_texture' needed for 'depth' texture format");const l=function PXe(e,t){switch(t){case"image-uint8":case"image-float32":case"image-float16":case"image-depth":return e.TEXTURE_2D}if(Cn(e))switch(t){case"image-int32":return e.TEXTURE_2D;case"volume-uint8":case"volume-float32":case"volume-float16":return e.TEXTURE_3D}throw new Error(`unknown texture kind '${t}'`)}(e,n),c=gde(e,o),u=hde(e,r,i),d=function kXe(e,t,n){if(Cn(e))switch(t){case"alpha":switch(n){case"ubyte":return e.ALPHA;case"float":return e.R32F;case"fp16":return e.R16F;case"int":return e.R32I}case"rg":switch(n){case"ubyte":return e.RG;case"float":return e.RG32F;case"fp16":return e.RG16F;case"int":return e.RG32I}case"rgb":switch(n){case"ubyte":return e.RGB;case"float":return e.RGB32F;case"fp16":return e.RGB16F;case"int":return e.RGB32I}case"rgba":switch(n){case"ubyte":return e.RGBA;case"float":return e.RGBA32F;case"fp16":return e.RGBA16F;case"int":return e.RGBA32I}case"depth":switch(n){case"ushort":return e.DEPTH_COMPONENT16;case"float":return e.DEPTH_COMPONENT32F}}return hde(e,t,n)}(e,r,i),f=function NXe(e,t,n){switch(n){case"ubyte":return e.UNSIGNED_BYTE;case"ushort":return e.UNSIGNED_SHORT;case"float":return e.FLOAT;case"fp16":if(t.textureHalfFloat)return t.textureHalfFloat.HALF_FLOAT;throw new Error('extension "texture_half_float" unavailable');case"int":if(Cn(e))return e.INT;throw new Error('texture type "int" requires webgl2')}}(e,t,i);function p(){e.bindTexture(l,a),e.texParameteri(l,e.TEXTURE_MAG_FILTER,c),e.texParameteri(l,e.TEXTURE_MIN_FILTER,c),e.texParameteri(l,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(l,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(l,null)}p();let y,m=0,h=0,g=0,v=!1,x=!1;function _(E,D,T){if(0===E||0===D||Cn(e)&&l===e.TEXTURE_3D&&0===T)throw new Error("empty textures are not allowed");if(m!==E||h!==D||g!==(T||0))if(m=E,h=D,g=T||0,e.bindTexture(l,a),l===e.TEXTURE_2D)e.texImage2D(l,0,d,m,h,0,u,f,null);else{if(!Cn(e)||l!==e.TEXTURE_3D||void 0===g)throw new Error("unknown texture target");e.texImage3D(l,0,d,m,h,g,0,u,f,null)}}function w(E,D=!1){if(0===E.width||0===E.height||!yde(E)&&Cn(e)&&bde(0,l,e)&&0===E.depth)throw new Error("empty textures are not allowed");if(e.bindTexture(l,a),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),yde(E))m=E.width,h=E.height,e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.bindTexture(e.TEXTURE_2D,a),e.texImage2D(e.TEXTURE_2D,0,d,u,f,E);else if(function FXe(e,t,n){return t===n.TEXTURE_2D}(0,l,e)){const T=E.filter?gde(e,E.filter):c;e.texParameteri(l,e.TEXTURE_MAG_FILTER,T),e.texParameteri(l,e.TEXTURE_MIN_FILTER,T),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!!E.flipY),D?e.texSubImage2D(l,0,0,0,E.width,E.height,u,f,E.array):(m=E.width,h=E.height,e.texImage2D(l,0,d,m,h,0,u,f,E.array))}else{if(!Cn(e)||!bde(0,l,e))throw new Error("unknown texture target");e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),D?e.texSubImage3D(l,0,0,0,0,E.width,E.height,E.depth,u,f,E.array):(m=E.width,h=E.height,g=E.depth,e.texImage3D(l,0,d,m,h,g,0,u,f,E.array))}e.bindTexture(l,null),y=E}function A(){if(l!==e.TEXTURE_2D)throw new Error("mipmap only supported for 2d textures");if(!(Cn(e)||d3(m)&&d3(h)))throw new Error("mipmap unsupported for non-power-of-two textures and webgl1");e.bindTexture(l,a),e.texParameteri(l,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.generateMipmap(l),e.bindTexture(l,null),v=!0}return _(1,1,Cn(e)&&l===e.TEXTURE_3D?1:0),{id:s,target:l,format:u,internalFormat:d,type:f,filter:c,getWidth:()=>m,getHeight:()=>h,getDepth:()=>g,getByteCount:()=>mde(r,i,m,h,g),define:_,load:w,mipmap:A,bind:E=>{e.activeTexture(e.TEXTURE0+E),e.bindTexture(l,a)},unbind:E=>{e.activeTexture(e.TEXTURE0+E),e.bindTexture(l,null)},attachFramebuffer:function M(E,D,T){if(E.bind(),l===e.TEXTURE_2D)e.framebufferTexture2D(e.FRAMEBUFFER,mN(e,t,D),e.TEXTURE_2D,a,0);else{if(!Cn(e)||l!==e.TEXTURE_3D)throw new Error("unknown/unsupported texture target");if(void 0===T)throw new Error("need `layer` to attach 3D texture");e.framebufferTextureLayer(e.FRAMEBUFFER,mN(e,t,D),a,0,T)}},detachFramebuffer:(E,D)=>{if(E.bind(),l===e.TEXTURE_2D)e.framebufferTexture2D(e.FRAMEBUFFER,mN(e,t,D),e.TEXTURE_2D,null,0);else{if(!Cn(e)||l!==e.TEXTURE_3D)throw new Error("unknown texture target");e.framebufferTextureLayer(e.FRAMEBUFFER,mN(e,t,D),null,0,0)}},reset:()=>{a=vde(e),p();const[E,D,T]=[m,h,g];m=0,h=0,g=0,_(E,D,T),y&&w(y),v&&A()},destroy:()=>{x||(e.deleteTexture(a),x=!0)}}}(e,r,c,u,d,f)),cubeTexture:(c,u,d)=>o("cubeTexture",function LXe(e,t,n,r){const i=e.TEXTURE_CUBE_MAP,o=e.LINEAR,s=e.RGBA,a=e.RGBA,l=e.UNSIGNED_BYTE;let c=0;const u=e.createTexture();e.bindTexture(i,u);let d=0;Nu(t,(p,m)=>{if(!p)return;const g=function BXe(e,t){switch(t){case"nx":return e.TEXTURE_CUBE_MAP_NEGATIVE_X;case"ny":return e.TEXTURE_CUBE_MAP_NEGATIVE_Y;case"nz":return e.TEXTURE_CUBE_MAP_NEGATIVE_Z;case"px":return e.TEXTURE_CUBE_MAP_POSITIVE_X;case"py":return e.TEXTURE_CUBE_MAP_POSITIVE_Y;case"pz":return e.TEXTURE_CUBE_MAP_POSITIVE_Z}}(e,m),y=new Image;p instanceof File?y.src=URL.createObjectURL(p):PR(p)?p.then(v=>{y.src=URL.createObjectURL(v)}):y.src=p,y.addEventListener("load",()=>{0===c&&(c=y.width),e.texImage2D(g,0,s,c,c,0,a,l,null),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.bindTexture(i,u),e.texImage2D(g,0,s,a,l,y),d+=1,6===d&&(f||(n?(e.texParameteri(i,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.generateMipmap(i)):e.texParameteri(i,e.TEXTURE_MIN_FILTER,o),e.texParameteri(i,e.TEXTURE_MAG_FILTER,o)),r?.(f))}),y.addEventListener("error",()=>{r?.(!0)})});let f=!1;return{id:C9(),target:i,format:a,internalFormat:s,type:l,filter:o,getWidth:()=>c,getHeight:()=>c,getDepth:()=>0,getByteCount:()=>6*mde("rgba","ubyte",c,c,0)*(n?2:1),define:()=>{},load:()=>{},mipmap:()=>{},bind:p=>{e.activeTexture(e.TEXTURE0+p),e.bindTexture(i,u)},unbind:p=>{e.activeTexture(e.TEXTURE0+p),e.bindTexture(i,null)},attachFramebuffer:()=>{},detachFramebuffer:()=>{},reset:()=>{},destroy:()=>{f||(e.deleteTexture(u),f=!0)}}}(e,c,u,d)),vertexArray:(c,u,d)=>o("vertexArray",function OYe(e,t,n,r,i){const o=FYe();let s=ede(t),a=tde(t);function l(){a.bindVertexArray(s),i&&i.bind(),n.bindAttributes(r),a.bindVertexArray(null)}l();let c=!1;return{id:o,bind:()=>{a.bindVertexArray(s)},update:l,reset:()=>{s=ede(t),a=tde(t),l()},destroy:()=>{c||(i&&(a.bindVertexArray(s),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)),a.deleteVertexArray(s),c=!0)}}}(e,r,c,u,d)),getByteCounts:()=>{let c=0;i.texture.forEach(f=>{c+=f.getByteCount()}),i.cubeTexture.forEach(f=>{c+=f.getByteCount()});let u=0;i.attribute.forEach(f=>{u+=4*f.length});let d=0;return i.elements.forEach(f=>{d+=4*f.length}),{texture:c,attribute:u,elements:d}},reset:()=>{i.attribute.forEach(c=>c.reset()),i.elements.forEach(c=>c.reset()),i.framebuffer.forEach(c=>c.reset()),i.renderbuffer.forEach(c=>c.reset()),i.shader.forEach(c=>c.reset()),i.program.forEach(c=>c.reset()),i.vertexArray.forEach(c=>c.reset()),i.texture.forEach(c=>c.reset())},destroy:()=>{i.attribute.forEach(c=>c.destroy()),i.elements.forEach(c=>c.destroy()),i.framebuffer.forEach(c=>c.destroy()),i.renderbuffer.forEach(c=>c.destroy()),i.shader.forEach(c=>c.destroy()),i.program.forEach(c=>c.destroy()),i.vertexArray.forEach(c=>c.destroy()),i.texture.forEach(c=>c.destroy()),s.clear(),l.clear()}}}const rde=Kc();class ide{add(t,n){let r=this.avgs.get(t)||n;return r=function zYe(e,t,n){return(e-=e/n)+t/n}(r,n,this.count),this.avgs.set(t,r),r}get(t){return this.avgs.get(t)}stats(){return Object.fromEntries(this.avgs.entries())}constructor(t){this.count=t,this.avgs=new Map}}function ode(e){e.map(t=>{const n=function qYe(e){const t=`${(e.gpuElapsed/1e3/1e3).toFixed(2)}`,n=`${(e.gpuAvg/1e3/1e3).toFixed(2)}`,r=`${e.cpuElapsed.toFixed(2)}`,i=`${e.cpuAvg.toFixed(2)}`;return`${e.label} ${t} ms (avg. ${n} ms) | CPU: ${r} ms (avg. ${i} ms)`}(t);t.children.length||t.calls?(console.groupCollapsed(n),t.calls&&console.log(t.calls),ode(t.children),console.groupEnd()):console.log(n)})}function sde(e,t){switch(t){case e.NO_ERROR:return"no error";case e.INVALID_ENUM:return"invalid enum";case e.INVALID_VALUE:return"invalid value";case e.INVALID_OPERATION:return"invalid operation";case e.INVALID_FRAMEBUFFER_OPERATION:return"invalid framebuffer operation";case e.OUT_OF_MEMORY:return"out of memory";case e.CONTEXT_LOST_WEBGL:return"context lost"}return"unknown error"}function ade(e){const t=e.getError();if(t!==e.NO_ERROR)throw new Error(`WebGL error: '${sde(e,t)}'`)}function hN(e){e.bindFramebuffer(e.FRAMEBUFFER,null)}const lde=new Uint8Array(4);function cde(e,t,n){e.getSyncParameter(t,e.SYNC_STATUS)===e.SIGNALED?(e.deleteSync(t),n()):m3.setImmediate(cde,e,t,n)}function ude(e,t){const n=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);n?m3.setImmediate(cde,e,n,t):(console.warn("Could not create a WebGLSync object"),e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,lde),t())}let dde=!1;function fde(e){e.bindFramebuffer(e.FRAMEBUFFER,null),e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,lde)}function S9(e,t,n,r,i,o){if($n&&dN(e),o instanceof Uint8Array)e.readPixels(t,n,r,i,e.RGBA,e.UNSIGNED_BYTE,o);else if(o instanceof Float32Array)e.readPixels(t,n,r,i,e.RGBA,e.FLOAT,o);else{if(!(o instanceof Int32Array&&Cn(e)))throw new Error("unsupported readPixels buffer type");e.readPixels(t,n,r,i,e.RGBA_INTEGER,e.INT,o)}$n&&ade(e)}function Cn(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext}const EXe="\nattribute vec4 aPosition;\n\nvoid main() {\n gl_Position = aPosition;\n}",TXe="\nprecision mediump float;\nuniform vec4 uColor;\nuniform sampler2D uTexture;\n\nvoid main() {\n gl_FragColor = texture2D(uTexture, vec2(0.5, 0.5)) * uColor;\n}",DXe=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]);function pde(e,t){const n=pN(e,{type:"vert",source:EXe}),r=pN(e,{type:"frag",source:TXe});if(!n||!r)return!1;const i=_9(e);e.attachShader(i,n),e.attachShader(i,r),e.linkProgram(i),e.useProgram(i);const o=e.getAttribLocation(i,"aPosition"),s=e.getUniformLocation(i,"uColor");if(!s)return $n&&console.log("error getting 'uColor' uniform location"),!1;const a=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,a),e.bufferData(e.ARRAY_BUFFER,DXe,e.STATIC_DRAW),e.enableVertexAttribArray(o),e.vertexAttribPointer(o,2,e.FLOAT,!1,0,0);const l=e.createTexture(),c=new Uint8Array([255,255,255,255]);e.bindTexture(e.TEXTURE_2D,l),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,c);const u=e.createTexture();e.bindTexture(e.TEXTURE_2D,u),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,t,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);const d=e.createFramebuffer();if(e.bindFramebuffer(e.FRAMEBUFFER,d),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,u,0),e.checkFramebufferStatus(e.FRAMEBUFFER)!==e.FRAMEBUFFER_COMPLETE)return $n&&console.log(`error creating framebuffer for '${t}'`),!1;e.bindTexture(e.TEXTURE_2D,l),e.uniform4fv(s,[0,10,20,1]),e.drawArrays(e.TRIANGLES,0,6),e.bindTexture(e.TEXTURE_2D,u),e.bindFramebuffer(e.FRAMEBUFFER,null),e.clearColor(1,0,0,1),e.clear(e.COLOR_BUFFER_BIT),e.uniform4fv(s,[0,.1,.05,1]),e.drawArrays(e.TRIANGLES,0,6);const p=new Uint8Array(4);if(e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,p),0!==p[0]||p[1]<248||p[2]<248||p[3]<254)return $n&&console.log(`not able to actually render to '${t}' texture`),!1;if(t===e.FLOAT){e.bindFramebuffer(e.FRAMEBUFFER,d);const m=new Float32Array(4);e.readPixels(0,0,1,1,e.RGBA,e.FLOAT,m);const h=e.getError();if(h)return $n&&console.log(`error reading float pixels: '${sde(e,h)}'`),!1}return!0}const C9=Kc();function hde(e,t,n){switch(t){case"alpha":return Cn(e)&&"float"===n?e.RED:Cn(e)&&"int"===n?e.RED_INTEGER:e.ALPHA;case"rgb":return Cn(e)&&"int"===n?e.RGB_INTEGER:e.RGB;case"rg":if(Cn(e)&&"float"===n)return e.RG;if(Cn(e)&&"int"===n)return e.RG_INTEGER;throw new Error('texture format "rg" requires webgl2 and type "float" or int"');case"rgba":return Cn(e)&&"int"===n?e.RGBA_INTEGER:e.RGBA;case"depth":return e.DEPTH_COMPONENT}}function mde(e,t,n,r,i){return function MXe(e){switch(e){case"alpha":return 1;case"rg":return 2;case"rgb":return 3;case"rgba":case"depth":return 4}}(e)*function RXe(e){switch(e){case"ubyte":return 1;case"ushort":case"fp16":return 2;case"float":case"int":return 4}}(t)*n*r*(i||1)}function gde(e,t){switch(t){case"nearest":return e.NEAREST;case"linear":return e.LINEAR}}function mN(e,t,n){switch(n){case"depth":return e.DEPTH_ATTACHMENT;case"stencil":return e.STENCIL_ATTACHMENT;case"color0":case 0:return e.COLOR_ATTACHMENT0}if(t.drawBuffers)switch(n){case"color1":case 1:return t.drawBuffers.COLOR_ATTACHMENT1;case"color2":case 2:return t.drawBuffers.COLOR_ATTACHMENT2;case"color3":case 3:return t.drawBuffers.COLOR_ATTACHMENT3;case"color4":case 4:return t.drawBuffers.COLOR_ATTACHMENT4;case"color5":case 5:return t.drawBuffers.COLOR_ATTACHMENT5;case"color6":case 6:return t.drawBuffers.COLOR_ATTACHMENT6;case"color7":case 7:return t.drawBuffers.COLOR_ATTACHMENT7}throw new Error("unknown texture attachment")}function yde(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement}function bde(e,t,n){return t===n.TEXTURE_3D}function vde(e){const t=e.createTexture();if(null===t)throw new Error("Could not create WebGL texture");return t}function xde(e,t,n){const{resources:r}=e,i=[];return Object.keys(t).forEach(o=>{const s=t[o];if("texture"===s.type){const a=n[o];if(a)if("texture"===s.kind)i[i.length]=[o,a.ref.value];else{const l=r.texture(s.kind,s.format,s.dataType,s.filter);l.load(a.ref.value),i[i.length]=[o,l]}}}),i}function _de(e,t,n){const r=new Image;r.onload=function(){n.load(r),O.update(t,n)},r.src=e}const Sde=-1;function lc(e){var t;const n=null!==(t=e?.TEXTURE_2D)&&void 0!==t?t:3553;return{id:C9(),target:n,format:Sde,internalFormat:0,type:0,filter:0,getWidth:()=>0,getHeight:()=>0,getDepth:()=>0,getByteCount:()=>0,define:()=>{},load:()=>{},mipmap:()=>{},bind:r=>{e&&(e.activeTexture(e.TEXTURE0+r),e.bindTexture(n,null))},unbind:r=>{e&&(e.activeTexture(e.TEXTURE0+r),e.bindTexture(n,null))},attachFramebuffer:()=>{throw new Error("cannot attach null-texture to a framebuffer")},detachFramebuffer:()=>{throw new Error("cannot detach null-texture from a framebuffer")},reset:()=>{},destroy:()=>{}}}function Ef(e,t,n,r){const i=function UXe(e,t,n,r){switch(n.granularity){case"uniform":return function HXe(e,t,n){return function VXe(e,t){return t?(O.update(t.uColor,st.toVec3Normalized(t.uColor.ref.value,e)),O.updateIfChanged(t.dColorType,"uniform"),t):{uColor:O.create(st.toVec3Normalized(C(),e)),tColor:O.create({array:new Uint8Array(3),width:1,height:1}),tColorGrid:O.create(lc()),tPalette:O.create({array:new Uint8Array(3),width:1,height:1}),uColorTexDim:O.create(Ue.create(1,1)),uColorGridDim:O.create(C.create(1,1,1)),uColorGridTransform:O.create(Bn.create(0,0,0,1)),dColorType:O.create("uniform"),dUsePalette:O.create(!1)}}(t(Gu,!1),n)}(0,n.color,r);case"instance":return e.nonInstanceable?Cde(e,n.color,r):function GXe(e,t,n){const{instanceCount:r}=e,i=Sa(Math.max(1,r),3,Uint8Array,n&&n.tColor.ref.value.array);for(e.reset();e.hasNext;){const{location:o,isSecondary:s,instanceIndex:a}=e.move();st.toArray(t(o,s),i.array,3*a),e.skipInstance()}return kD(i,"instance",n)}(e,n.color,r);case"group":return Cde(e,n.color,r);case"groupInstance":return function qXe(e,t,n){const{groupCount:r,instanceCount:i,hasLocation2:o}=e,a=Sa(Math.max(1,i*r*(o?2:1)),3,Uint8Array,n&&n.tColor.ref.value.array);e.reset();const l=o?6:3;for(;e.hasNext;){const{location:c,location2:u,isSecondary:d,index:f}=e.move();st.toArray(t(c,d),a.array,f*l),o&&st.toArray(t(u,d),a.array,f*l+3)}return kD(a,"groupInstance",n)}(e,n.color,r);case"vertex":return function WXe(e,t,n){const{groupCount:r,stride:i}=e,o=Sa(Math.max(1,r),3,Uint8Array,n&&n.tColor.ref.value.array);for(e.reset(),e.voidInstances();e.hasNext&&!e.isNextNewInstance;){const{location:s,isSecondary:a,groupIndex:l}=e.move(),c=t(s,a);for(let u=0;u=16*t?o.transform.ref.value:new Float32Array(16*t);a.set(e),O.update(o.transform,a),O.updateIfChanged(o.uInstanceCount,t),O.updateIfChanged(o.instanceCount,t);const l=o.aTransform.ref.value.length>=16*t?o.aTransform.ref.value:new Float32Array(16*t);O.update(o.aTransform,l);const c=o.extraTransform.ref.value.length>=16*t?o.extraTransform.ref.value:new Float32Array(16*t);O.update(o.extraTransform,yN(c,t));const u=o.aInstance.ref.value.length>=t?o.aInstance.ref.value:new Float32Array(t);O.update(o.aInstance,Sd(u,t)),O.update(o.hasReflection,s)}else o={aTransform:O.create(new Float32Array(16*t)),matrix:O.create(fe.identity()),transform:O.create(new Float32Array(e)),extraTransform:O.create(yN(new Float32Array(16*t),t)),uInstanceCount:O.create(t),instanceCount:O.create(t),aInstance:O.create(Sd(new Float32Array(t))),hasReflection:O.create(s),instanceGrid:O.create({cellSize:0,cellCount:0,cellOffsets:new Uint32Array,cellSpheres:new Float32Array,cellTransform:new Float32Array,cellInstance:new Float32Array,batchSize:0,batchCount:0,batchOffsets:new Uint32Array,batchSpheres:new Float32Array,batchCell:new Uint32Array})};return Ide(o,n,r,i),o}const I9=new Float32Array(16);function E9(e){return A9(new Float32Array(I9),1,void 0,0,0,e)}function yN(e,t){for(let n=0;n0){const u=function ZXe(e,t,n){const r=function QXe(e,t){const{instanceCount:n,instance:r,transform:i,invariantBoundingSphere:o}=e,s=new Float32Array(n),a=new Float32Array(n),l=new Float32Array(n),c=Ve.ofBounds(0,n),u=Gt.setEmpty(Gt()),{center:d,radius:f}=o,p=C.create(f,f,f),m=C();for(let N=0;Nn,props:t,description:nKe,legend:v1([["uniform",n]])}}const iKe={name:"uniform",label:"Uniform",category:xo.Misc,factory:I_,getParams:function rKe(e){return Vw},defaultValues:I.getDefaultValues(Vw),isApplicable:e=>!0},Tde={value:I.Numeric(1,{min:0,max:20,step:.1})};function T9(e,t){const n=t.value;return{factory:T9,granularity:"uniform",size:()=>n,props:t,description:"Gives everything the same, uniform size."}}const aKe={name:"uniform",label:"Uniform",category:"",factory:T9,getParams:function sKe(e){return Tde},defaultValues:I.getDefaultValues(Tde),isApplicable:e=>!0};function tu(e){return{...tu.Zero,...e}}function H1(){}!function(e){e.Zero={metalness:0,roughness:0,bumpiness:0},e.toArray=function t(i,o,s){return o[s]=255*i.metalness,o[s+1]=255*i.roughness,o[s+2]=255*i.bumpiness,o},e.toString=function n({metalness:i,roughness:o,bumpiness:s}){return`M ${i.toFixed(2)} | R ${o.toFixed(2)} | B ${s.toFixed(2)}`},e.getParam=function r(i){return I.Group({metalness:I.Numeric(0,{min:0,max:1,step:.01}),roughness:I.Numeric(1,{min:0,max:1,step:.01}),bumpiness:I.Numeric(0,{min:0,max:1,step:.01})},{...i,presets:[[{metalness:0,roughness:1,bumpiness:0},"Matte"],[{metalness:0,roughness:.2,bumpiness:0},"Plastic"],[{metalness:0,roughness:.6,bumpiness:0},"Glossy"],[{metalness:1,roughness:.6,bumpiness:0},"Metallic"]]})}}(tu||(tu={})),function(e){e.Type={none:0,plane:1,sphere:2,cube:3,cylinder:4,infiniteCone:5},e.Params={variant:I.Select("pixel",I.arrayToOptions(["instance","pixel"])),objects:I.ObjectList({type:I.Select("plane",I.objectToOptions(e.Type,l=>yf(l))),invert:I.Boolean(!1),position:I.Vec3(C()),rotation:I.Group({axis:I.Vec3(C.create(1,0,0)),angle:I.Numeric(0,{min:-180,max:180,step:1},{description:"Angle in Degrees"})},{isExpanded:!0}),scale:I.Vec3(C.create(1,1,1))},l=>yf(l.type))};const n=Ai(),r=Ai(),i=C(),o=C();e.getClip=function s(l,c){const u=l.objects.length,{type:d,invert:f,position:p,rotation:m,scale:h}=c?.objects||function t(l){return{count:0,type:new Array(l).fill(1),invert:new Array(l).fill(!1),position:new Array(3*l).fill(0),rotation:new Array(4*l).fill(0),scale:new Array(3*l).fill(1)}}(u);for(let g=0;g1.2&&(r=2)),{resolution:n,stride:r}}}var xt;function cKe(e,t,n,r){for(let i=t;itypeof s.quality<"u"&&"custom"!==s.quality},e.Params={alpha:I.Numeric(1,{min:0,max:1,step:.01},{label:"Opacity",isEssential:!0,description:"How opaque/transparent the representation is rendered."}),quality:I.Select("auto",D9,{isEssential:!0,description:"Visual/rendering quality of the representation."}),material:tu.getParam(),clip:I.Group(H1.Params),instanceGranularity:I.Boolean(!1,{description:"Use instance granularity for marker, transparency, clipping, overpaint, substance data to save memory."}),lod:I.Vec3(C(),void 0,{...e.CullingLodCategory,description:"Level of detail.",fieldLabels:{x:"Min Distance",y:"Max Distance",z:"Overlap (Shader)"}}),cellSize:I.Numeric(200,{min:0,max:5e3,step:100},{...e.CullingLodCategory,description:"Instance grid cell size."}),batchSize:I.Numeric(2e3,{min:0,max:5e4,step:500},{...e.CullingLodCategory,description:"Instance grid batch size."})},e.createSimple=function t(s=qn.grey,a=1,l){return l||(l=E9()),{transform:l,locationIterator:Vi(1,l.instanceCount.ref.value,1,()=>Gu,!1,()=>!1),theme:{color:I_(0,{value:s,lightness:0,saturation:0}),size:T9(0,{value:a})}}},e.createValues=function n(s,a){const l=H1.getClip(s.clip);return{alpha:O.create(s.alpha),uAlpha:O.create(s.alpha),uVertexCount:O.create(a.vertexCount),uGroupCount:O.create(a.groupCount),drawCount:O.create(a.drawCount),uMetalness:O.create(s.material.metalness),uRoughness:O.create(s.material.roughness),uBumpiness:O.create(s.material.bumpiness),dLightCount:O.create(1),dColorMarker:O.create(!0),dClipObjectCount:O.create(l.objects.count),dClipVariant:O.create(l.variant),uClipObjectType:O.create(l.objects.type),uClipObjectInvert:O.create(l.objects.invert),uClipObjectPosition:O.create(l.objects.position),uClipObjectRotation:O.create(l.objects.rotation),uClipObjectScale:O.create(l.objects.scale),instanceGranularity:O.create(s.instanceGranularity),uLod:O.create(Bn.create(s.lod[0],s.lod[1],s.lod[2],0))}},e.updateValues=function r(s,a){O.updateIfChanged(s.alpha,a.alpha),O.updateIfChanged(s.uMetalness,a.material.metalness),O.updateIfChanged(s.uRoughness,a.material.roughness),O.updateIfChanged(s.uBumpiness,a.material.bumpiness);const l=H1.getClip(a.clip);O.updateIfChanged(s.dClipObjectCount,l.objects.count),O.updateIfChanged(s.dClipVariant,l.variant),O.update(s.uClipObjectType,l.objects.type),O.update(s.uClipObjectInvert,l.objects.invert),O.update(s.uClipObjectPosition,l.objects.position),O.update(s.uClipObjectRotation,l.objects.rotation),O.update(s.uClipObjectScale,l.objects.scale),O.updateIfChanged(s.instanceGranularity,a.instanceGranularity),O.update(s.uLod,Bn.set(s.uLod.ref.value,a.lod[0],a.lod[1],a.lod[2],0))},e.createRenderableState=function i(s={}){const a=void 0===s.alpha||1===s.alpha;return{disposed:!1,visible:!0,alphaFactor:1,pickable:!0,colorOnly:!1,opaque:a,writeDepth:a}},e.updateRenderableState=function o(s,a){s.opaque=a.alpha*s.alphaFactor>=1,s.writeDepth=s.opaque}}(xt||(xt={}));const kde={array:new Uint8Array(4),width:1,height:1};function my(e){return e?(O.update(e.tOverpaint,kde),O.update(e.uOverpaintTexDim,Ue.create(1,1)),e):{tOverpaint:O.create(kde),uOverpaintTexDim:O.create(Ue.create(1,1)),dOverpaint:O.create(!1),tOverpaintGrid:O.create(lc()),uOverpaintGridDim:O.create(C.create(1,1,1)),uOverpaintGridTransform:O.create(Bn.create(0,0,0,1)),dOverpaintType:O.create("groupInstance"),uOverpaintStrength:O.create(1)}}function dKe(e,t,n,r){for(let i=t;i=3*R?F.normalBuffer.ref.value:new Float32Array(3*R);z===F.normalBuffer.ref.value&&z.fill(0,0,3*R),Fue(j,W,z,R,N),O.update(F.normalBuffer,z)},e.checkForDuplicateVertices=function a(F,R=3){const N=F.vertexBuffer.ref.value,j=new Map,W=(V,X)=>`${V[0].toFixed(X)}|${V[1].toFixed(X)}|${V[2].toFixed(X)}`;let z=0;const $=C();for(let V=0,X=F.vertexCount;V{const V=v3(z,$),X=j.get(V)||0;j.set(V,X+1)};for(let z=0;z{1===j&&(Coe(N,W),R.add(N[0]),R.add(N[1]))}),R}function h(F,R,N){const j=new Map,W=(z,$)=>{j.has(z)?Us(j.get(z),$):j.set(z,[$])};return R.forEach(z=>{const $=F[z];for(const V of $)R.has(V)&&1===N.get(v3(z,V))&&W(z,V)}),j}function y(F,R,N,j){var W;const{vertexBuffer:z,indexBuffer:$,normalBuffer:V,triangleCount:X}=F,H=z.ref.value,oe=$.ref.value,te=V.ref.value,K=tt.create(Uint32Array,3,1024,X);let Q=0;for(let _e=0;_eN.get(_e).length<2).map(_e=>{const Fe=N.get(_e);return C.fromArray(G,H,3*_e),C.fromArray(Z,H,3*Fe[0]),C.fromArray(ee,H,3*Fe[1]),C.sub(xe,Z,G),C.sub(re,ee,G),[_e,C.angle(xe,re)]});ie.sort(([,_e],[,Fe])=>_e-Fe);for(const[_e,Fe]of ie){if(he.has(_e)||Fe>Ae)continue;const Ze=N.get(_e);if(R[Ze[0]].includes(Ze[1])&&(null===(W=N.get(Ze[0]))||void 0===W||!W.includes(Ze[1]))||(C.fromArray(G,H,3*_e),C.fromArray(Z,H,3*Ze[0]),C.fromArray(ee,H,3*Ze[1]),C.sub(xe,Z,G),C.sub(re,ee,G),C.add(ge,xe,re),C.squaredDistance(G,Z)>=j))continue;let ct=!1;for(const q of R[_e])if(!Ze.includes(q)&&(C.fromArray(se,H,3*q),C.sub(ae,se,G),C.dot(ge,ae)<0)){ct=!0;break}ct&&(C.fromArray(Ie,te,3*_e),C.triangleNormal(me,G,Z,ee),C.dot(me,Ie)>0?tt.add3(K,_e,Ze[0],Ze[1]):tt.add3(K,Ze[1],Ze[0],_e),he.add(_e),he.add(Ze[0]),he.add(Ze[1]),Q+=1)}const ue=tt.compact(K);return F.triangleCount=Q,O.update($,ue),F}function _(F,R){const N=F.vertexCount,j=R.instanceCount.ref.value,W=V1(),z=W.position,$=F.vertexBuffer.ref.value,V=R.aTransform.ref.value;return Vi(N,j,1,(H,oe)=>(oe<0?C.fromArray(z,$,3*H):C.transformMat4Offset(z,$,V,0,3*H,16*oe),W))}function w(F,R,N,j,W){const{instanceCount:z,groupCount:$}=N,X=Ef(N,_(F,R),j.color),H=W.instanceGranularity?hs(z,"instance"):hs(z*$,"groupInstance"),oe=my(),te=gy(),K=by(),Q=yy(),G={drawCount:3*F.triangleCount,vertexCount:F.vertexCount,groupCount:$,instanceCount:z},Z=ke.clone(F.boundingSphere),ee=pl(Z,R.aTransform.ref.value,z,0);return{dGeometryType:O.create("mesh"),aPosition:F.vertexBuffer,aNormal:F.normalBuffer,aGroup:F.groupBuffer,elements:F.indexBuffer,dVaryingGroup:F.varyingGroup,boundingSphere:O.create(ee),invariantBoundingSphere:O.create(Z),uInvariantBoundingSphere:O.create(Bn.ofSphere(Z)),...X,...H,...oe,...te,...K,...Q,...R,...xt.createValues(W,G),uDoubleSided:O.create(W.doubleSided),dFlatShaded:O.create(W.flatShaded),dFlipSided:O.create(W.flipSided),dIgnoreLight:O.create(W.ignoreLight),dXrayShaded:O.create("inverted"===W.xrayShaded?"inverted":!0===W.xrayShaded?"on":"off"),dTransparentBackfaces:O.create(W.transparentBackfaces),uBumpFrequency:O.create(W.bumpFrequency),uBumpAmplitude:O.create(W.bumpAmplitude),meta:O.create(F.meta)}}function T(F,R){xt.updateRenderableState(F,R),F.opaque=F.opaque&&!R.xrayShaded,F.writeDepth=F.opaque}e.transform=function c(F,R){const N=F.vertexBuffer.ref.value;w_(R,N,0,F.vertexCount),fe.isTranslationAndUniformScaling(R)||function vWe(e,t,n,r){for(let i=0,o=3*r;i{const Q=F.vertexBuffer.ref.value;oe.set(Q),R.forEach((Z,ee)=>{if(2!==Z.length)return;C.fromArray(z,Q,3*ee),C.fromArray($,Q,3*Z[0]),C.fromArray(V,Q,3*Z[1]);const se=1/C.distance(z,$),xe=1/C.distance(z,V);C.scale($,$,se),C.scale(V,V,xe),C.add(X,$,V),C.scale(X,X,1/(se+xe)),C.sub(X,X,z),C.scale(X,X,K),C.add(X,z,X),C.toArray(X,oe,3*ee)});const G=F.vertexBuffer.ref.value;O.update(F.vertexBuffer,oe),oe=G};for(let K=0;K{C.toArray(a,n,o),C.toArray(l,n,o+3),C.toArray(c,n,o+6),C.triangleNormal(vN,a,l,c);for(let u=0;u<3;++u)C.toArray(vN,r,o+3*u),i[s+u]=o/3+u;o+=9,s+=3},addQuad:(a,l,c,u)=>{C.toArray(a,n,o),C.toArray(l,n,o+3),C.toArray(c,n,o+6),C.toArray(u,n,o+9),C.triangleNormal(vN,a,l,c);for(let f=0;f<4;++f)C.toArray(vN,r,o+3*f);const d=o/3;i[s]=d,i[s+1]=d+1,i[s+2]=d+2,i[s+3]=d+2,i[s+4]=d+3,i[s+5]=d,o+=12,s+=6},getPrimitive:()=>({vertices:n,normals:r,indices:i})}}const Gw=C(),SKe=In();function P9(e,t){const{vertices:n,normals:r}=e,i=In.directionTransform(SKe,t);for(let o=0,s=n.length;o{t.push(r(i),r(o),r(s))}}}(),{vertices:s,indices:a}=o;(function c(d){const f=C(),p=C(),m=C();for(let h=0;h0&&y(!0),a&&n>0&&y(!1),{vertices:new Float32Array(d),normals:new Float32Array(f),indices:new Uint32Array(u)};function y(v){const x=!0===v?t:n,_=!0===v?1:-1,w=p;for(let M=1;M<=i;++M)d.push(0,h*_,0),f.push(0,_,0),++p;const A=p;for(let M=0;M<=i;++M){const D=M/i*c+l,T=Math.cos(D),F=Math.sin(D);d.push(x*F,h*_,x*T),f.push(0,_,0),++p}for(let M=0;M(E<0?C.fromArray(x,_,3*M):C.transformMat4Offset(x,_,w,0,3*M,16*E),v))}function l(m,h,g,y,v){const{instanceCount:x,groupCount:_}=g,A=Ef(g,a(m,h),y.color),M=xy(g,y.size),E=v.instanceGranularity?hs(x,"instance"):hs(x*_,"groupInstance"),D=my(),T=gy(),F=by(),R=yy(),N={drawCount:m.pointCount,vertexCount:m.pointCount,groupCount:_,instanceCount:x},j=ke.clone(m.boundingSphere),W=pl(j,h.aTransform.ref.value,x,0);return{dGeometryType:O.create("points"),aPosition:m.centerBuffer,aGroup:m.groupBuffer,boundingSphere:O.create(W),invariantBoundingSphere:O.create(j),uInvariantBoundingSphere:O.create(Bn.ofSphere(j)),...A,...M,...E,...D,...T,...F,...R,...h,...xt.createValues(v,N),uSizeFactor:O.create(v.sizeFactor),dPointSizeAttenuation:O.create(v.pointSizeAttenuation),dPointStyle:O.create(v.pointStyle)}}function p(m,h){xt.updateRenderableState(m,h),m.opaque=m.opaque&&"fuzzy"!==h.pointStyle,m.writeDepth=m.opaque}e.create=t,e.createEmpty=n,e.transform=function s(m,h){const g=m.centerBuffer.ref.value;w_(h,g,0,m.pointCount),O.update(m.centerBuffer,g)},e.StyleTypes={square:"Square",circle:"Circle",fuzzy:"Fuzzy"},e.StyleTypeNames=Object.keys(e.StyleTypes),e.Params={...xt.Params,sizeFactor:I.Numeric(3,{min:0,max:10,step:.1}),pointSizeAttenuation:I.Boolean(!1),pointStyle:I.Select("square",I.objectToOptions(e.StyleTypes))},e.Utils={Params:e.Params,createEmpty:n,createValues:l,createValuesSimple:function c(m,h,g,y,v){const x=xt.createSimple(g,y,v),_={...I.getDefaultValues(e.Params),...h};return l(m,x.transform,x.locationIterator,x.theme,_)},updateValues:function u(m,h){xt.updateValues(m,h),O.updateIfChanged(m.uSizeFactor,h.sizeFactor),O.updateIfChanged(m.dPointSizeAttenuation,h.pointSizeAttenuation),O.updateIfChanged(m.dPointStyle,h.pointStyle)},updateBoundingSphere:function d(m,h){const g=ke.clone(h.boundingSphere),y=pl(g,m.aTransform.ref.value,m.instanceCount.ref.value,0);ke.equals(y,m.boundingSphere.ref.value)||O.update(m.boundingSphere,y),ke.equals(g,m.invariantBoundingSphere.ref.value)||(O.update(m.invariantBoundingSphere,g),O.update(m.uInvariantBoundingSphere,Bn.fromSphere(m.uInvariantBoundingSphere.ref.value,g)))},createRenderableState:function f(m){const h=xt.createRenderableState(m);return p(h,m),h},updateRenderableState:p,createPositionIterator:a}}(G1||(G1={}));const W9={},ofe={fontFamily:I.Select("sans-serif",[["sans-serif","Sans Serif"],["monospace","Monospace"],["serif","Serif"],["cursive","Cursive"]]),fontQuality:I.Select(3,[[0,"lower"],[1,"low"],[2,"medium"],[3,"high"],[4,"higher"]]),fontStyle:I.Select("normal",[["normal","Normal"],["italic","Italic"],["oblique","Oblique"]]),fontVariant:I.Select("normal",[["normal","Normal"],["small-caps","Small Caps"]]),fontWeight:I.Select("normal",[["normal","Normal"],["bold","Bold"]])};class QKe{constructor(t={}){this.mapped={},this.scratchW=0,this.scratchH=0,this.currentX=0,this.currentY=0,this.cutoff=.5;const n={...I.getDefaultValues(ofe),...t};this.props=n;const r=32*(n.fontQuality+1);this.buffer=r/8,this.radius=r/3,this.lineHeight=Math.round(r+2*this.buffer+this.radius),this.maxWidth=Math.round(.75*this.lineHeight),this.texture=Sa(350*this.lineHeight*this.maxWidth,1,Uint8Array),this.scratchContext=function eZe(e,t,n){if(a_)return function JKe(){throw new Error("When running in Node.js and wanting to use Canvas API, call mol-util/data-source's setCanvasModule function first and pass imported `canvas` module to it.")}().createCanvas(e,t).getContext("2d",n);{const r=document.createElement("canvas");return r.width=e,r.height=t,r.getContext("2d",n)}}(this.maxWidth,this.lineHeight,{willReadFrequently:!0}),this.scratchContext.font=`${n.fontStyle} ${n.fontVariant} ${n.fontWeight} ${r}px ${n.fontFamily}`,this.scratchContext.fillStyle="black",this.scratchContext.textBaseline="middle",this.scratchData=new Uint8Array(this.lineHeight*this.maxWidth),this.gridOuter=new Float64Array(this.lineHeight*this.maxWidth),this.gridInner=new Float64Array(this.lineHeight*this.maxWidth),this.f=new Float64Array(Math.max(this.lineHeight,this.maxWidth)),this.d=new Float64Array(Math.max(this.lineHeight,this.maxWidth)),this.z=new Float64Array(Math.max(this.lineHeight,this.maxWidth)+1),this.v=new Int16Array(Math.max(this.lineHeight,this.maxWidth)),this.middle=Math.ceil(this.lineHeight/2),this.placeholder=this.get("\ufffd")}get(t){if(void 0===this.mapped[t]){this.draw(t);const{array:n,width:r,height:i}=this.texture,o=this.scratchData;if(this.currentX+this.scratchW>r&&(this.currentX=0,this.currentY+=this.scratchH),this.currentY+this.scratchH>i)return console.warn("canvas to small"),this.placeholder;this.mapped[t]={x:this.currentX,y:this.currentY,w:this.scratchW,h:this.scratchH,nw:this.scratchW/this.lineHeight,nh:this.scratchH/this.lineHeight};for(let s=0;si&&(i=c);const u=Math.abs(e[l+1]);u>i&&(i=u);const d=Math.abs(t[s]);d>o&&(o=d)}return Math.max(o,r+r*i)}!function(e){function t(p,m,h,g,y,v,x,_,w){return w?function o(p,m,h,g,y,v,x,_,w){return w.charCount=_,O.update(w.fontTexture,p),O.update(w.centerBuffer,m),O.update(w.mappingBuffer,h),O.update(w.depthBuffer,g),O.update(w.indexBuffer,y),O.update(w.groupBuffer,v),O.update(w.tcoordBuffer,x),w}(p,m,h,g,y,v,x,_,w):function i(p,m,h,g,y,v,x,_){const w=ke();let A,M=-1,E=-1;const D={kind:"text",charCount:_,fontTexture:O.create(p),centerBuffer:O.create(m),mappingBuffer:O.create(h),depthBuffer:O.create(g),indexBuffer:O.create(y),groupBuffer:O.create(v),tcoordBuffer:O.create(x),get boundingSphere(){const T=r(D);if(T!==M){const F=py(D.centerBuffer.ref.value,4*D.charCount,4);ke.copy(w,F),M=T}return w},get groupMapping(){return D.groupBuffer.ref.version!==E&&(A=zw(D.groupBuffer.ref.value,D.charCount,4),E=D.groupBuffer.ref.version),A},setBoundingSphere(T){ke.copy(w,T),M=r(D)}};return D}(p,m,h,g,y,v,x,_)}function n(p){return t(p?p.fontTexture.ref.value:Sa(0,1,Uint8Array),p?p.centerBuffer.ref.value:new Float32Array(0),p?p.mappingBuffer.ref.value:new Float32Array(0),p?p.depthBuffer.ref.value:new Float32Array(0),p?p.indexBuffer.ref.value:new Uint32Array(0),p?p.groupBuffer.ref.value:new Float32Array(0),p?p.tcoordBuffer.ref.value:new Float32Array(0),0,p)}function r(p){return Zc([p.charCount,p.fontTexture.ref.version,p.centerBuffer.ref.version,p.mappingBuffer.ref.version,p.depthBuffer.ref.version,p.indexBuffer.ref.version,p.groupBuffer.ref.version,p.tcoordBuffer.ref.version])}function s(p,m){const h=4*p.charCount,g=m.instanceCount.ref.value,y=V1(),v=y.position,x=p.centerBuffer.ref.value,_=m.aTransform.ref.value;return Vi(h,g,4,(A,M)=>(M<0?C.fromArray(v,x,3*A):C.transformMat4Offset(v,x,_,0,3*A,16*M),y))}function a(p,m,h,g,y){const{instanceCount:v,groupCount:x}=h,w=Ef(h,s(p,m),g.color),A=xy(h,g.size),M=y.instanceGranularity?hs(v,"instance"):hs(v*x,"groupInstance"),E=my(),D=gy(),T=by(),F=yy(),R={drawCount:2*p.charCount*3,vertexCount:4*p.charCount,groupCount:x,instanceCount:v},N=sfe(p.mappingBuffer.ref.value,p.depthBuffer.ref.value,p.charCount,OD(A)),j=ke.expand(ke(),p.boundingSphere,N),W=pl(j,m.aTransform.ref.value,v,0);return{dGeometryType:O.create("text"),aPosition:p.centerBuffer,aMapping:p.mappingBuffer,aDepth:p.depthBuffer,aGroup:p.groupBuffer,elements:p.indexBuffer,boundingSphere:O.create(W),invariantBoundingSphere:O.create(j),uInvariantBoundingSphere:O.create(Bn.ofSphere(j)),...w,...A,...M,...E,...D,...T,...F,...m,aTexCoord:p.tcoordBuffer,tFont:p.fontTexture,padding:O.create(N),...xt.createValues(y,R),uSizeFactor:O.create(y.sizeFactor),uBorderWidth:O.create(al(y.borderWidth,0,.5)),uBorderColor:O.create(st.toArrayNormalized(y.borderColor,C.zero(),0)),uOffsetX:O.create(y.offsetX),uOffsetY:O.create(y.offsetY),uOffsetZ:O.create(y.offsetZ),uBackgroundColor:O.create(st.toArrayNormalized(y.backgroundColor,C.zero(),0)),uBackgroundOpacity:O.create(y.backgroundOpacity)}}function f(p,m){xt.updateRenderableState(p,m),p.pickable=!1,p.opaque=!1,p.writeDepth=!0}e.create=t,e.createEmpty=n,e.Params={...xt.Params,...ofe,sizeFactor:I.Numeric(1,{min:0,max:10,step:.1}),borderWidth:I.Numeric(0,{min:0,max:.5,step:.01}),borderColor:I.Color(qn.grey),offsetX:I.Numeric(0,{min:0,max:10,step:.1}),offsetY:I.Numeric(0,{min:0,max:10,step:.1}),offsetZ:I.Numeric(0,{min:0,max:10,step:.1}),background:I.Boolean(!1),backgroundMargin:I.Numeric(.2,{min:0,max:1,step:.01}),backgroundColor:I.Color(qn.grey),backgroundOpacity:I.Numeric(1,{min:0,max:1,step:.01}),tether:I.Boolean(!1),tetherLength:I.Numeric(1,{min:0,max:5,step:.1}),tetherBaseWidth:I.Numeric(.3,{min:0,max:1,step:.01}),attachment:I.Select("middle-center",[["bottom-left","bottom-left"],["bottom-center","bottom-center"],["bottom-right","bottom-right"],["middle-left","middle-left"],["middle-center","middle-center"],["middle-right","middle-right"],["top-left","top-left"],["top-center","top-center"],["top-right","top-right"]])},e.Utils={Params:e.Params,createEmpty:n,createValues:a,createValuesSimple:function l(p,m,h,g,y){const v=xt.createSimple(h,g,y),x={...I.getDefaultValues(e.Params),...m};return a(p,v.transform,v.locationIterator,v.theme,x)},updateValues:function c(p,m){xt.updateValues(p,m),O.updateIfChanged(p.uSizeFactor,m.sizeFactor),O.updateIfChanged(p.uBorderWidth,m.borderWidth),st.fromNormalizedArray(p.uBorderColor.ref.value,0)!==m.borderColor&&(st.toArrayNormalized(m.borderColor,p.uBorderColor.ref.value,0),O.update(p.uBorderColor,p.uBorderColor.ref.value)),O.updateIfChanged(p.uOffsetX,m.offsetX),O.updateIfChanged(p.uOffsetY,m.offsetY),O.updateIfChanged(p.uOffsetZ,m.offsetZ),st.fromNormalizedArray(p.uBackgroundColor.ref.value,0)!==m.backgroundColor&&(st.toArrayNormalized(m.backgroundColor,p.uBackgroundColor.ref.value,0),O.update(p.uBackgroundColor,p.uBackgroundColor.ref.value)),O.updateIfChanged(p.uBackgroundOpacity,m.backgroundOpacity)},updateBoundingSphere:function u(p,m){const h=sfe(p.aMapping.ref.value,p.aDepth.ref.value,m.charCount,OD(p)),g=ke.expand(ke(),m.boundingSphere,h),y=pl(g,p.aTransform.ref.value,p.instanceCount.ref.value,0);ke.equals(y,p.boundingSphere.ref.value)||O.update(p.boundingSphere,y),ke.equals(g,p.invariantBoundingSphere.ref.value)||(O.update(p.invariantBoundingSphere,g),O.update(p.uInvariantBoundingSphere,Bn.fromSphere(p.uInvariantBoundingSphere.ref.value,g))),O.update(p.padding,h)},createRenderableState:function d(p){const m=xt.createRenderableState(p);return f(m,p),m},updateRenderableState:f,createPositionIterator:s}}(Tf||(Tf={}));const qu=C(),Zh=C(),BD=C(),afe=tt.add,IN=tt.add3;var Pd,Mo;!function(e){e.create=function t(n=2048,r=1024,i){const o=tt.create(Float32Array,1,r,i?i.groupBuffer.ref.value:n),s=tt.create(Float32Array,3,r,i?i.startBuffer.ref.value:n),a=tt.create(Float32Array,3,r,i?i.endBuffer.ref.value:n),l=(d,f,p,m,h,g,y)=>{for(let v=0;v<4;++v)IN(s,d,f,p),IN(a,m,h,g),afe(o,y)},u=(d,f,p,m)=>{const h=C.distance(d,f),g=p%2!=0,y=Math.floor((p+1)/2),v=h/(p+.5);C.setMagnitude(BD,C.sub(BD,f,d),v),C.copy(qu,d);for(let x=0;x{for(let m=0;m<4;++m)IN(s,d[0],d[1],d[2]),IN(a,f[0],f[1],f[2]),afe(o,p)},addFixedCountDashes:u,addFixedLengthDashes:(d,f,p,m)=>{const h=C.distance(d,f);u(d,f,h/p,m)},addCage:(d,f,p)=>{const{vertices:m,edges:h}=f;for(let g=0,y=h.length;g{const d=o.elementCount/4,f=tt.compact(o,!0),p=tt.compact(s,!0),m=tt.compact(a,!0),h=i&&d<=i.lineCount?i.mappingBuffer.ref.value:new Float32Array(8*d),g=i&&d<=i.lineCount?i.indexBuffer.ref.value:new Uint32Array(6*d);return(!i||d>i.lineCount)&&function tZe(e,t,n){for(let r=0;rx.lineCount&&(O.update(x.mappingBuffer,p),O.update(x.indexBuffer,m)),x.lineCount=v,O.update(x.groupBuffer,h),O.update(x.startBuffer,g),O.update(x.endBuffer,y),x}(p,m,h,g,y,v,x):function o(p,m,h,g,y,v){const x=ke();let _,w=-1,A=-1;const M={kind:"lines",lineCount:v,mappingBuffer:O.create(p),indexBuffer:O.create(m),groupBuffer:O.create(h),startBuffer:O.create(g),endBuffer:O.create(y),get boundingSphere(){const E=i(M);if(E!==w){const D=py(M.startBuffer.ref.value,4*M.lineCount,4),T=py(M.endBuffer.ref.value,4*M.lineCount,4);ke.expandBySphere(x,D,T),w=E}return x},get groupMapping(){return M.groupBuffer.ref.version!==A&&(_=zw(M.groupBuffer.ref.value,M.lineCount,4),A=M.groupBuffer.ref.version),_},setBoundingSphere(E){ke.copy(x,E),w=i(M)}};return M}(p,m,h,g,y,v)}function n(p){return t(p?p.mappingBuffer.ref.value:new Float32Array(0),p?p.indexBuffer.ref.value:new Uint32Array(0),p?p.groupBuffer.ref.value:new Float32Array(0),p?p.startBuffer.ref.value:new Float32Array(0),p?p.endBuffer.ref.value:new Float32Array(0),0,p)}function i(p){return Zc([p.lineCount,p.mappingBuffer.ref.version,p.indexBuffer.ref.version,p.groupBuffer.ref.version,p.startBuffer.ref.version,p.endBuffer.ref.version])}function l(p,m){const h=4*p.lineCount,g=m.instanceCount.ref.value,y=V1(),v=y.position,x=p.startBuffer.ref.value,_=p.endBuffer.ref.value,w=m.aTransform.ref.value;return Vi(h,g,2,(M,E)=>{const D=M%4==0?x:_;return E<0?C.fromArray(v,D,3*M):C.transformMat4Offset(v,D,w,0,3*M,16*E),y})}function c(p,m,h,g,y){const{instanceCount:v,groupCount:x}=h,w=Ef(h,l(p,m),g.color),A=xy(h,g.size),M=y.instanceGranularity?hs(v,"instance"):hs(v*x,"groupInstance"),E=my(),D=gy(),T=by(),F=yy(),R={drawCount:2*p.lineCount*3,vertexCount:4*p.lineCount,groupCount:x,instanceCount:v},N=ke.clone(p.boundingSphere),j=pl(N,m.aTransform.ref.value,v,0);return{dGeometryType:O.create("lines"),aMapping:p.mappingBuffer,aGroup:p.groupBuffer,aStart:p.startBuffer,aEnd:p.endBuffer,elements:p.indexBuffer,boundingSphere:O.create(j),invariantBoundingSphere:O.create(N),uInvariantBoundingSphere:O.create(Bn.ofSphere(N)),...w,...A,...M,...E,...D,...T,...F,...m,...xt.createValues(y,R),uSizeFactor:O.create(y.sizeFactor),dLineSizeAttenuation:O.create(y.lineSizeAttenuation),uDoubleSided:O.create(!0),dFlipSided:O.create(!1)}}e.create=t,e.createEmpty=n,e.fromMesh=function r(p,m){const h=p.vertexBuffer.ref.value,g=p.indexBuffer.ref.value,y=p.groupBuffer.ref.value,v=Pd.create(3*p.triangleCount,p.triangleCount/10,m);for(let x=0,_=3*p.triangleCount;x<_;x+=3){const w=g[x],A=g[x+1],M=g[x+2],E=h[3*w],D=h[3*w+1],T=h[3*w+2],F=h[3*A],R=h[3*A+1],N=h[3*A+2],j=h[3*M],W=h[3*M+1],z=h[3*M+2];v.add(E,D,T,F,R,N,y[w]),v.add(E,D,T,j,W,z,y[w]),v.add(F,R,N,j,W,z,y[A])}return v.getLines()},e.transform=function a(p,m){const h=p.startBuffer.ref.value;w_(m,h,0,4*p.lineCount),O.update(p.startBuffer,h);const g=p.endBuffer.ref.value;w_(m,g,0,4*p.lineCount),O.update(p.endBuffer,g)},e.Params={...xt.Params,sizeFactor:I.Numeric(2,{min:0,max:10,step:.1}),lineSizeAttenuation:I.Boolean(!1)},e.Utils={Params:e.Params,createEmpty:n,createValues:c,createValuesSimple:function u(p,m,h,g,y){const v=xt.createSimple(h,g,y),x={...I.getDefaultValues(e.Params),...m};return c(p,v.transform,v.locationIterator,v.theme,x)},updateValues:function d(p,m){xt.updateValues(p,m),O.updateIfChanged(p.uSizeFactor,m.sizeFactor),O.updateIfChanged(p.dLineSizeAttenuation,m.lineSizeAttenuation)},updateBoundingSphere:function f(p,m){const h=ke.clone(m.boundingSphere),g=pl(h,p.aTransform.ref.value,p.instanceCount.ref.value,0);ke.equals(g,p.boundingSphere.ref.value)||O.update(p.boundingSphere,g),ke.equals(h,p.invariantBoundingSphere.ref.value)||(O.update(p.invariantBoundingSphere,h),O.update(p.uInvariantBoundingSphere,Bn.fromSphere(p.uInvariantBoundingSphere.ref.value,h)))},createRenderableState:xt.createRenderableState,updateRenderableState:xt.updateRenderableState,createPositionIterator:l}}(Mo||(Mo={}));const _y=C(),Sy=C(),Cy=C(),Xw=C(),$s=gg(4,!0);function lfe(e){const r=Hw(12,e?36:24);for(let i=0;i<4;++i){const o=(i+1)%4;C.set(_y,$s[3*i],$s[3*i+1],-.5),C.set(Sy,$s[3*o],$s[3*o+1],-.5),C.set(Cy,$s[3*o],$s[3*o+1],.5),C.set(Xw,$s[3*i],$s[3*i+1],.5),e?r.add(_y,Sy,Cy):r.addQuad(_y,Sy,Cy,Xw)}return C.set(_y,$s[0],$s[1],-.5),C.set(Sy,$s[3],$s[4],-.5),C.set(Cy,$s[6],$s[7],-.5),C.set(Xw,$s[9],$s[10],-.5),e?r.add(Cy,Sy,_y):r.addQuad(Xw,Cy,Sy,_y),C.set(_y,$s[0],$s[1],.5),C.set(Sy,$s[3],$s[4],.5),C.set(Cy,$s[6],$s[7],.5),C.set(Xw,$s[9],$s[10],.5),e?r.add(_y,Sy,Cy):r.addQuad(_y,Sy,Cy,Xw),r.getPrimitive()}let Y9,K9,Z9;function X9(){return Y9||(Y9=lfe(!1)),Y9}function cfe(){return Z9||(Z9=MD([.5,.5,-.5,-.5,.5,-.5,-.5,-.5,-.5,.5,-.5,-.5,.5,.5,.5,-.5,.5,.5,-.5,-.5,.5,.5,-.5,.5],[0,4,1,5,2,6,3,7,0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4])),Z9}function ufe(e){return e.map(t=>({x:t[0],alpha:t[1]}))}function dfe(e,t){const n=[{x:0,alpha:0},{x:0,alpha:0},...e,{x:1,alpha:0},{x:1,alpha:0}],i=t?t.ref.value.array:new Uint8Array(256);let s,a,l,c,u,d,o=0;const f=e.length+1;for(let m=0;m=t?l=t-1:l<0&&(l=0),o[l]++}return{min:n,max:r,binWidth:i,counts:o}}var Ca,EN,TN,mt;function pfe(e,t){return Ke.create("Create Volume",function(){var n=le(function*(r){const{volume_data_3d_info:i,volume_data_3d:o}=e,s=Qc.create(i.spacegroup_number.value(0),C.ofArray(i.spacegroup_cell_size.value(0)),C.scale(C.zero(),C.ofArray(i.spacegroup_cell_angles.value(0)),Math.PI/180)),a=i.axis_order.value(0),l=mr.convertToCanonicalAxisIndicesFastToSlow(a),c=l(i.sample_count.value(0)),u=mr.Space(c,mr.invertAxisOrder(a),Float32Array),d=mr.create(u,mr.Data1(o.values.toArray({array:Float32Array}))),f=C.ofArray(l(i.origin.value(0))),p=C.ofArray(l(i.dimensions.value(0)));return{label:t?.label,entryId:t?.entryId,grid:{transform:{kind:"spacegroup",cell:s,fractionalBox:Gt.create(f,C.add(C.zero(),f,p))},cells:d,stats:{min:i.min_sampled.value(0),max:i.max_sampled.value(0),mean:i.mean_sampled.value(0),sigma:i.sigma_sampled.value(0)}},sourceData:TN.create(e),customProperties:new Oh,_propertyData:Object.create(null)}});return function(r){return n.apply(this,arguments)}}())}!function(e){e.One={transform:{kind:"matrix",matrix:fe.identity()},cells:mr.create(mr.Space([1,1,1],[0,1,2]),mr.Data1([0])),stats:{min:0,max:0,mean:0,sigma:0}};const t=fe.zero(),n=fe.zero();e.getGridToCartesianTransform=function r(l){if("matrix"===l.transform.kind)return fe.copy(fe(),l.transform.matrix);if("spacegroup"===l.transform.kind){const{cells:{space:c}}=l,u=fe.fromScaling(t,C.div(C.zero(),Gt.size(C.zero(),l.transform.fractionalBox),C.ofArray(c.dimensions))),d=fe.fromTranslation(n,l.transform.fractionalBox.min);return fe.mul3(fe.zero(),l.transform.cell.fromFractional,d,u)}return fe.identity()},e.areEquivalent=function i(l,c){return l===c},e.isEmpty=function o(l){return 0===l.cells.data.length},e.getBoundingSphere=function s(l,c){c||(c=ke());const u=l.cells.space.dimensions,d=e.getGridToCartesianTransform(l);return ke.fromDimensionsAndTransform(c,u,d)},e.getHistogram=function a(l,c){let u=l._historams;return u||(u=l._historams={}),u[c]||(u[c]=function rZe(e,t,n){if(n)return ffe(e,t,n.min,n.max);{const[r,i]=mf(e);return ffe(e,t,r,i)}}(l.cells.data,c,{min:l.stats.min,max:l.stats.max})),u[c]}}(Ca||(Ca={})),function(e){e.is=function t(r){return"cube"===r?.kind},e.create=function n(r){return{kind:"cube",name:r.name,data:r}}}(EN||(EN={})),function(e){e.is=function t(r){return"dscif"===r?.kind},e.create=function n(r){return{kind:"dscif",name:r._name,data:r}}}(TN||(TN={})),function(e){let n;e.is=function t(y){var v,x,_,w;return(null===(w=null===(_=null===(x=null===(v=y?.grid)||void 0===v?void 0:v.cells)||void 0===x?void 0:x.space)||void 0===_?void 0:_.dimensions)||void 0===w?void 0:w.length)&&y?.sourceData&&y?.customProperties&&y?._propertyData},function(y){function M(T,F){return"absolute"===T.kind?T:{kind:"absolute",absoluteValue:y.calcAbsolute(F,T.relativeValue)}}y.areSame=function v(T,F,R){return Do(M(T,R).absoluteValue,M(F,R).absoluteValue,R.sigma/100)},y.absolute=function x(T){return{kind:"absolute",absoluteValue:T}},y.relative=function _(T){return{kind:"relative",relativeValue:T}},y.calcAbsolute=function w(T,F){return F*T.sigma+T.mean},y.calcRelative=function A(T,F){return 0===T.sigma?0:(F-T.mean)/T.sigma},y.toAbsolute=M,y.toRelative=function E(T,F){return"relative"===T.kind?T:{kind:"relative",relativeValue:y.calcRelative(F,T.absoluteValue)}},y.toString=function D(T){return"relative"===T.kind?`${T.relativeValue.toFixed(2)} \u03c3`:`${T.absoluteValue.toPrecision(4)}`}}(n=e.IsoValue||(e.IsoValue={})),e.adjustedIsoValue=function r(y,v,x){if("relative"===x)return n.relative(v);const _=n.absolute(v);if(TN.is(y.sourceData)){const w={min:y.sourceData.data.volume_data_3d_info.min_source.value(0),max:y.sourceData.data.volume_data_3d_info.max_source.value(0),mean:y.sourceData.data.volume_data_3d_info.mean_source.value(0),sigma:y.sourceData.data.volume_data_3d_info.sigma_source.value(0)};return e.IsoValue.toRelative(_,w)}return _};const i={min:-1,max:1,mean:0,sigma:.1};function o(y,v){const x=v||i,{min:_,max:w,mean:A,sigma:M}=x,E=(_-A)/M,D=(w-A)/M;let T=y;return"absolute"===y.kind?y.absoluteValue<_?T=e.IsoValue.absolute(_):y.absoluteValue>w&&(T=e.IsoValue.absolute(w)):y.relativeValueD&&(T=e.IsoValue.relative(D)),I.Conditioned(T,{absolute:I.Converted(F=>e.IsoValue.toAbsolute(F,Ca.One.stats).absoluteValue,F=>e.IsoValue.absolute(F),I.Numeric(A,{min:_,max:w,step:az(M/100,2)},{immediateUpdate:!0})),relative:I.Converted(F=>e.IsoValue.toRelative(F,Ca.One.stats).relativeValue,F=>e.IsoValue.relative(F),I.Numeric(Math.min(1,D),{min:E,max:D,step:az(Math.round((w-_)/M)/100,2)},{immediateUpdate:!0}))},F=>"absolute"===F.kind?"absolute":"relative",(F,R)=>"absolute"===R?e.IsoValue.toAbsolute(F,x):e.IsoValue.toRelative(F,x),{isEssential:!0})}let m,h,g;e.createIsoValueParam=o,e.IsoValueParam=o(e.IsoValue.relative(2)),e.One={label:"",grid:Ca.One,sourceData:{kind:"",name:"",data:{}},customProperties:new Oh,_propertyData:Object.create(null)},e.areEquivalent=function s(y,v){return Ca.areEquivalent(y.grid,v.grid)},e.isEmpty=function a(y){return Ca.isEmpty(y.grid)},e.isOrbitals=function l(y){return!!EN.is(y.sourceData)&&y.sourceData.data.header.orbitals},e.Loci=function c(y){return{kind:"volume-loci",volume:y}},e.isLoci=function u(y){return!!y&&"volume-loci"===y.kind},e.areLociEqual=function d(y,v){return y.volume===v.volume},e.isLociEmpty=function f(y){return Ca.isEmpty(y.volume.grid)},e.getBoundingSphere=function p(y,v){return Ca.getBoundingSphere(y.grid,v)},function(y){y.Loci=function v(E,D){return{kind:"isosurface-loci",volume:E,isoValue:D}},y.isLoci=function x(E){return!!E&&"isosurface-loci"===E.kind},y.areLociEqual=function _(E,D){return E.volume===D.volume&&e.IsoValue.areSame(E.isoValue,D.isoValue,E.volume.grid.stats)},y.isLociEmpty=function w(E){return 0===E.volume.grid.cells.data.length};const A=Gt();y.getBoundingSphere=function M(E,D,T){const F=e.IsoValue.toAbsolute(D,E.grid.stats).absoluteValue,R=F<0,N=[0,0,0],j=E.grid.cells.space.getCoords,W=E.grid.cells.data,[z,$,V]=E.grid.cells.space.dimensions;let X=z-1,H=$-1,oe=V-1,te=0,K=0,Q=0;for(let Z=0,ee=W.length;Z=F)&&(j(Z,N),N[0]te&&(te=N[0]),N[1]>K&&(K=N[1]),N[2]>Q&&(Q=N[2]));C.set(A.min,X-1,H-1,oe-1),C.set(A.max,te+1,K+1,Q+1);const G=Ca.getGridToCartesianTransform(E.grid);return Gt.transform(A,A,G),ke.fromBox3D(T||ke(),A)}}(m=e.Isosurface||(e.Isosurface={})),function(y){y.Loci=function v(D,T){return{kind:"cell-loci",volume:D,indices:T}},y.isLoci=function x(D){return!!D&&"cell-loci"===D.kind},y.areLociEqual=function _(D,T){return D.volume===T.volume&&Ve.areEqual(D.indices,T.indices)},y.isLociEmpty=function w(D){return 0===Ve.size(D.indices)};const A=new xf("98"),M=C();y.getBoundingSphere=function E(D,T,F){A.reset();const R=Ca.getGridToCartesianTransform(D.grid),{getCoords:N}=D.grid.cells.space;for(let W=0,z=Ve.size(T);Wy._propertyData.__segmentation__}}(mt||(mt={}));const Q9=X9();var Df,Rp,iu;function Pi(e,t,n){return{type:"attribute",kind:e,itemSize:t,divisor:n}}function Ne(e,t){return{type:"uniform",kind:e,variant:t}}function xn(e,t,n,r,i){return{type:"texture",kind:e,format:t,dataType:n,filter:r,variant:i}}function Kw(e){return{type:"elements",kind:e}}function cn(e,t){return{type:"define",kind:e,options:t}}function _o(e){return{type:"value",kind:e}}!function(e){function t(g,y,v,x,_,w,A,M,E,D){return D?function i(g,y,v,x,_,w,A,M,E,D){const T=w.getWidth(),F=w.getHeight(),R=w.getDepth();return O.update(D.gridDimension,y),O.update(D.gridTexture,w),O.update(D.gridTextureDim,C.set(D.gridTextureDim.ref.value,T,F,R)),O.update(D.gridStats,Bn.set(D.gridStats.ref.value,A.min,A.max,A.mean,A.sigma)),O.update(D.bboxMin,g.min),O.update(D.bboxMax,g.max),O.update(D.bboxSize,C.sub(D.bboxSize.ref.value,g.max,g.min)),O.update(D.transform,v),O.update(D.cellDim,_),O.update(D.unitToCartn,x),O.update(D.cartnToUnit,fe.invert(fe(),x)),O.updateIfChanged(D.packedGroup,M),O.updateIfChanged(D.axisOrder,C.fromArray(D.axisOrder.ref.value,E,0)),D}(g,y,v,x,_,w,A,M,E,D):function r(g,y,v,x,_,w,A,M,E){const D=ke();let T=-1;const F=w.getWidth(),R=w.getHeight(),N=w.getDepth(),j={kind:"direct-volume",gridDimension:O.create(y),gridTexture:O.create(w),gridTextureDim:O.create(C.create(F,R,N)),gridStats:O.create(Bn.create(A.min,A.max,A.mean,A.sigma)),bboxMin:O.create(g.min),bboxMax:O.create(g.max),bboxSize:O.create(C.sub(C(),g.max,g.min)),transform:O.create(v),cellDim:O.create(_),unitToCartn:O.create(x),cartnToUnit:O.create(fe.invert(fe(),x)),get boundingSphere(){const W=n(j);if(W!==T){const z=function oZe(e,t){return ke.fromDimensionsAndTransform(ke(),e,t)}(j.gridDimension.ref.value,j.transform.ref.value);ke.copy(D,z),T=W}return D},packedGroup:O.create(M),axisOrder:O.create(E),setBoundingSphere(W){ke.copy(D,W),T=n(j)}};return j}(g,y,v,x,_,w,A,M,E)}function n(g){return Zc([g.bboxSize.ref.version,g.gridDimension.ref.version,g.gridTexture.ref.version,g.transform.ref.version,g.gridStats.ref.version])}function o(g){return t(Gt(),C(),fe.identity(),fe.identity(),C(),lc(),Ca.One.stats,!1,C.create(0,1,2),g)}function a(g,y){return Math.ceil(C.magnitude(g)*y)}function l(g,y){return Math.min(...g)*(1/y)}function c(g){return 1/g}function u(g,y,v,x,_){const{gridTexture:w,gridTextureDim:A,gridStats:M}=g,{bboxSize:E,bboxMin:D,bboxMax:T,gridDimension:F,transform:R}=g,{instanceCount:N,groupCount:j}=v,z=Ef(v,e.Utils.createPositionIterator(g,y),x.color),$=_.instanceGranularity?hs(N,"instance"):hs(N*j,"groupInstance"),V=my(),X=gy(),H=by(),oe=yy(),[te,K,Q]=F.ref.value,G={drawCount:Q9.indices.length,vertexCount:te*K*Q,groupCount:j,instanceCount:N},Z=ke.clone(g.boundingSphere),ee=pl(Z,y.aTransform.ref.value,N,0),xe=dfe(ufe(_.controlPoints));return{dGeometryType:O.create("directVolume"),...z,...$,...V,...X,...H,...oe,...y,...xt.createValues(_,G),aPosition:O.create(Q9.vertices),elements:O.create(Q9.indices),boundingSphere:O.create(ee),invariantBoundingSphere:O.create(Z),uInvariantBoundingSphere:O.create(Bn.ofSphere(Z)),uBboxMin:D,uBboxMax:T,uBboxSize:E,uMaxSteps:O.create(a(F.ref.value,_.stepsPerCell)),uStepScale:O.create(l(g.cellDim.ref.value,_.stepsPerCell)),uJumpLength:O.create(_.jumpLength),uTransform:R,uGridDim:F,tTransferTex:xe,uTransferScale:O.create(c(_.stepsPerCell)),dGridTexType:O.create(w.ref.value.getDepth()>0?"3d":"2d"),uGridTexDim:A,tGridTex:w,uGridStats:M,uCellDim:g.cellDim,uCartnToUnit:g.cartnToUnit,uUnitToCartn:g.unitToCartn,dPackedGroup:g.packedGroup,dAxisOrder:O.create(g.axisOrder.ref.value.join("")),dIgnoreLight:O.create(_.ignoreLight),dXrayShaded:O.create("inverted"===_.xrayShaded?"inverted":!0===_.xrayShaded?"on":"off")}}e.create=t,e.createEmpty=o,e.Params={...xt.Params,ignoreLight:I.Boolean(!1,xt.ShadingCategory),xrayShaded:I.Select(!1,[[!1,"Off"],[!0,"On"],["inverted","Inverted"]],xt.ShadingCategory),controlPoints:I.LineGraph([Ue.create(.19,0),Ue.create(.2,.05),Ue.create(.25,.05),Ue.create(.26,0),Ue.create(.79,0),Ue.create(.8,.05),Ue.create(.85,.05),Ue.create(.86,0)],{isEssential:!0}),stepsPerCell:I.Numeric(3,{min:1,max:10,step:1}),jumpLength:I.Numeric(0,{min:0,max:20,step:.1})},e.Utils={Params:e.Params,createEmpty:o,createValues:u,createValuesSimple:function d(g,y,v,x,_){const w=xt.createSimple(v,x,_),A={...I.getDefaultValues(e.Params),...y};return u(g,w.transform,w.locationIterator,w.theme,A)},updateValues:function f(g,y){xt.updateValues(g,y),O.updateIfChanged(g.dIgnoreLight,y.ignoreLight),O.updateIfChanged(g.dXrayShaded,"inverted"===y.xrayShaded?"inverted":!0===y.xrayShaded?"on":"off"),dfe(ufe(y.controlPoints),g.tTransferTex),O.updateIfChanged(g.uMaxSteps,a(g.uGridDim.ref.value,y.stepsPerCell)),O.updateIfChanged(g.uStepScale,l(g.uCellDim.ref.value,y.stepsPerCell)),O.updateIfChanged(g.uTransferScale,c(y.stepsPerCell)),O.updateIfChanged(g.uJumpLength,y.jumpLength)},updateBoundingSphere:function p(g,y){const v=ke.clone(y.boundingSphere),x=pl(v,g.aTransform.ref.value,g.instanceCount.ref.value,0);ke.equals(x,g.boundingSphere.ref.value)||O.update(g.boundingSphere,x),ke.equals(v,g.invariantBoundingSphere.ref.value)||(O.update(g.invariantBoundingSphere,v),O.update(g.uInvariantBoundingSphere,Bn.fromSphere(g.uInvariantBoundingSphere.ref.value,v)))},createRenderableState:function m(g){const y=xt.createRenderableState(g);return y.opaque=!1,y.writeDepth=!1,y},updateRenderableState:function h(g,y){xt.updateRenderableState(g,y),g.opaque=!1,g.writeDepth=!1},createPositionIterator:function s(g,y){const v=g.transform.ref.value,[x,_,w]=g.gridDimension.ref.value,A=x*_*w,M=y.instanceCount.ref.value,E=V1(),D=E.position,T=y.aTransform.ref.value;return Vi(A,M,1,(R,N)=>{const j=Math.floor(R/w);return D[0]=Math.floor(j/_),D[1]=j%_,D[2]=R%w,C.transformMat4(D,D,v),N>=0&&C.transformMat4Offset(D,D,T,0,0,16*N),E})}}}(Df||(Df={})),function(e){function t(x,_,w,A){return A?function o(x,_,w,A){return A.sphereCount=w,O.update(A.centerBuffer,x),O.update(A.groupBuffer,_),A.shaderData.update(),A}(x,_,w,A):function i(x,_,w){const A=ke();let M,E=-1,D=-1;const T=O.create(Sa(1,4,Float32Array)),F=O.create(Ue.create(0,0)),R=O.create([]),N=O.create(0),j={kind:"spheres",sphereCount:w,centerBuffer:O.create(x),groupBuffer:O.create(_),get boundingSphere(){const W=r(j);if(W!==E){const z=py(j.centerBuffer.ref.value,4*j.sphereCount,4);ke.copy(A,z),E=W}return A},get groupMapping(){return j.groupBuffer.ref.version!==D&&(M=zw(j.groupBuffer.ref.value,j.sphereCount,4),D=j.groupBuffer.ref.version),M},setBoundingSphere(W){ke.copy(A,W),E=r(j)},shaderData:{positionGroup:T,texDim:F,lodLevels:R,sizeFactor:N,update(W){var z,$;const V=null!==(z=W?.lodLevels)&&void 0!==z?z:c(R.ref.value),X=null!==($=W?.sizeFactor)&&void 0!==$?$:N.ref.value,H=d(V,X),oe=Sa(j.sphereCount,4,Float32Array,T.ref.value.array),te=s(oe,j.centerBuffer.ref.value,j.groupBuffer.ref.value,j.sphereCount,H),K=te?l(V,X,te,j.sphereCount):[];O.update(T,oe),O.update(F,Ue.set(F.ref.value,oe.width,oe.height)),O.update(R,K),O.update(N,X)}}};return j}(x,_,w)}function n(x){return t(x?x.centerBuffer.ref.value:new Float32Array(0),x?x.groupBuffer.ref.value:new Float32Array(0),0,x)}function r(x){return Zc([x.sphereCount,x.centerBuffer.ref.version,x.groupBuffer.ref.version])}function s(x,_,w,A,M){const{array:E}=x;if(0===M.length){for(let F=0;F{const D=u(M,_);return[M.minDistance,M.maxDistance,M.overlap,w[w.length-1-E],Math.pow(Math.min(A,D),1/M.scaleBias),M.stride,M.scaleBias]})}function c(x){return x.map(_=>({minDistance:_[0],maxDistance:_[1],overlap:_[2],stride:_[5],scaleBias:_[6]}))}function u(x,_){return Math.max(1,Math.round(x.stride/Math.pow(_,x.scaleBias)))}function d(x,_){return x.map(w=>u(w,_)).reverse()}function f(x,_){const w=x.sphereCount,A=_.instanceCount.ref.value,M=V1(),E=M.position,D=x.centerBuffer.ref.value,T=_.aTransform.ref.value;return Vi(w,A,1,(R,N)=>(N<0?C.fromArray(E,D,3*R):C.transformMat4Offset(E,D,T,0,3*R,16*N),M))}function p(x,_,w,A,M){const{instanceCount:E,groupCount:D}=w,F=Ef(w,f(x,_),A.color),R=xy(w,A.size),N=M.instanceGranularity?hs(E,"instance"):hs(E*D,"groupInstance"),j=my(),W=gy(),z=by(),$=yy(),V={drawCount:2*x.sphereCount*3,vertexCount:6*x.sphereCount,groupCount:D,instanceCount:E},X=x.boundingSphere.radius?OD(R)*M.sizeFactor:0,H=ke.expand(ke(),x.boundingSphere,X),oe=pl(H,_.aTransform.ref.value,E,0);return x.shaderData.update({lodLevels:M.lodLevels,sizeFactor:M.sizeFactor}),{dGeometryType:O.create("spheres"),uTexDim:x.shaderData.texDim,tPositionGroup:x.shaderData.positionGroup,boundingSphere:O.create(oe),invariantBoundingSphere:O.create(H),uInvariantBoundingSphere:O.create(Bn.ofSphere(H)),...F,...R,...N,...j,...W,...z,...$,..._,padding:O.create(X),...xt.createValues(M,V),uSizeFactor:x.shaderData.sizeFactor,uDoubleSided:O.create(M.doubleSided),dIgnoreLight:O.create(M.ignoreLight),dXrayShaded:O.create("inverted"===M.xrayShaded?"inverted":!0===M.xrayShaded?"on":"off"),dTransparentBackfaces:O.create(M.transparentBackfaces),dSolidInterior:O.create(M.solidInterior),dClipPrimitive:O.create(M.clipPrimitive),dApproximate:O.create(M.approximate),uAlphaThickness:O.create(M.alphaThickness),uBumpFrequency:O.create(M.bumpFrequency),uBumpAmplitude:O.create(M.bumpAmplitude),lodLevels:x.shaderData.lodLevels,centerBuffer:x.centerBuffer,groupBuffer:x.groupBuffer}}function v(x,_){xt.updateRenderableState(x,_),x.opaque=x.opaque&&!_.xrayShaded,x.writeDepth=x.opaque}e.create=t,e.createEmpty=n,e.Params={...xt.Params,sizeFactor:I.Numeric(1,{min:0,max:10,step:.1}),doubleSided:I.Boolean(!1,xt.CustomQualityParamInfo),ignoreLight:I.Boolean(!1,xt.ShadingCategory),xrayShaded:I.Select(!1,[[!1,"Off"],[!0,"On"],["inverted","Inverted"]],xt.ShadingCategory),transparentBackfaces:I.Select("off",I.arrayToOptions(["off","on","opaque"]),xt.ShadingCategory),solidInterior:I.Boolean(!0,xt.ShadingCategory),clipPrimitive:I.Boolean(!1,{...xt.ShadingCategory,description:"Clip whole sphere instead of cutting it."}),approximate:I.Boolean(!1,{...xt.ShadingCategory,description:"Faster rendering, but has artifacts."}),alphaThickness:I.Numeric(0,{min:0,max:20,step:1},{...xt.ShadingCategory,description:"If not zero, adjusts alpha for radius."}),bumpFrequency:I.Numeric(0,{min:0,max:10,step:.1},xt.ShadingCategory),bumpAmplitude:I.Numeric(1,{min:0,max:5,step:.1},xt.ShadingCategory),lodLevels:I.ObjectList({minDistance:I.Numeric(0),maxDistance:I.Numeric(0),overlap:I.Numeric(0),stride:I.Numeric(0),scaleBias:I.Numeric(3,{min:.1,max:10,step:.1})},x=>`${x.stride}`,{...xt.CullingLodCategory,defaultValue:[]})},e.Utils={Params:e.Params,createEmpty:n,createValues:p,createValuesSimple:function m(x,_,w,A,M){const E=xt.createSimple(w,A,M),D={...I.getDefaultValues(e.Params),..._};return p(x,E.transform,E.locationIterator,E.theme,D)},updateValues:function h(x,_){xt.updateValues(x,_),O.updateIfChanged(x.uSizeFactor,_.sizeFactor),O.updateIfChanged(x.uDoubleSided,_.doubleSided),O.updateIfChanged(x.dIgnoreLight,_.ignoreLight),O.updateIfChanged(x.dXrayShaded,"inverted"===_.xrayShaded?"inverted":!0===_.xrayShaded?"on":"off"),O.updateIfChanged(x.dTransparentBackfaces,_.transparentBackfaces),O.updateIfChanged(x.dSolidInterior,_.solidInterior),O.updateIfChanged(x.dClipPrimitive,_.clipPrimitive),O.updateIfChanged(x.dApproximate,_.approximate),O.updateIfChanged(x.uAlphaThickness,_.alphaThickness),O.updateIfChanged(x.uBumpFrequency,_.bumpFrequency),O.updateIfChanged(x.uBumpAmplitude,_.bumpAmplitude);const w=c(x.lodLevels.ref.value);if(!function a(x,_){if(x.length!==_.length)return!1;for(let w=0,A=x.length;wGu);m.namedFramebuffers[i]||(m.namedFramebuffers[i]=m.resources.framebuffer());const h=m.namedFramebuffers[i],[g,y]=f.geoTextureDim.ref.value,v=new Float32Array(g*y*4);h.bind(),f.vertexTexture.ref.value.attachFramebuffer(h,0),m.readPixels(0,0,g,y,v);const x=f.vertexCount,_=p.instanceCount.ref.value,w=V1(),A=w.position,M=v,E=p.aTransform.ref.value;return Vi(x,_,1,(T,F)=>(F<0?C.fromArray(A,M,4*T):C.transformMat4Offset(A,M,E,0,4*T,16*F),w))}};const i="texture-mesh";function s(f,p,m,h,g){const{instanceCount:y,groupCount:v}=m,_=Ef(m,e.Utils.createPositionIterator(f,p),h.color),w=g.instanceGranularity?hs(y,"instance"):hs(y*v,"groupInstance"),A=my(),M=gy(),E=by(),D=yy(),T={drawCount:f.vertexCount,vertexCount:f.vertexCount,groupCount:v,instanceCount:y},F=ke.clone(f.boundingSphere),R=pl(F,p.aTransform.ref.value,y,0);return{dGeometryType:O.create("textureMesh"),uGeoTexDim:f.geoTextureDim,tPosition:f.vertexTexture,tGroup:f.groupTexture,tNormal:f.normalTexture,dVaryingGroup:f.varyingGroup,boundingSphere:O.create(R),invariantBoundingSphere:O.create(F),uInvariantBoundingSphere:O.create(Bn.ofSphere(F)),..._,...w,...A,...M,...E,...D,...p,...xt.createValues(g,T),uDoubleSided:O.create(g.doubleSided),dFlatShaded:O.create(g.flatShaded),dFlipSided:O.create(g.flipSided),dIgnoreLight:O.create(g.ignoreLight),dXrayShaded:O.create("inverted"===g.xrayShaded?"inverted":!0===g.xrayShaded?"on":"off"),dTransparentBackfaces:O.create(g.transparentBackfaces),uBumpFrequency:O.create(g.bumpFrequency),uBumpAmplitude:O.create(g.bumpAmplitude),meta:O.create(f.meta)}}function d(f,p){xt.updateRenderableState(f,p),f.opaque=f.opaque&&!p.xrayShaded,f.writeDepth=f.opaque}}(iu||(iu={}));const wy={uDrawId:Ne("i"),uModel:Ne("m4"),uView:Ne("m4"),uInvView:Ne("m4"),uModelView:Ne("m4"),uInvModelView:Ne("m4"),uProjection:Ne("m4"),uInvProjection:Ne("m4"),uModelViewProjection:Ne("m4"),uInvModelViewProjection:Ne("m4"),uIsOrtho:Ne("f"),uPixelRatio:Ne("f"),uViewport:Ne("v4"),uViewOffset:Ne("v2"),uDrawingBufferSize:Ne("v2"),uCameraPosition:Ne("v3"),uCameraDir:Ne("v3"),uCameraPlane:Ne("v4"),uNear:Ne("f"),uFar:Ne("f"),uFog:Ne("b"),uFogNear:Ne("f"),uFogFar:Ne("f"),uFogColor:Ne("v3"),uTransparentBackground:Ne("b"),uLightDirection:Ne("v3[]"),uLightColor:Ne("v3[]"),uAmbientColor:Ne("v3"),uPickingAlphaThreshold:Ne("f"),uInteriorDarkening:Ne("f"),uInteriorColorFlag:Ne("b"),uInteriorColor:Ne("v3"),uHighlightColor:Ne("v3"),uSelectColor:Ne("v3"),uDimColor:Ne("v3"),uHighlightStrength:Ne("f"),uSelectStrength:Ne("f"),uDimStrength:Ne("f"),uMarkerPriority:Ne("i"),uMarkerAverage:Ne("f"),uXrayEdgeFalloff:Ne("f"),uExposure:Ne("f"),uRenderMask:Ne("i"),uMarkingDepthTest:Ne("b"),uMarkingType:Ne("i"),uPickType:Ne("i")},Ay={tDepth:xn("texture","depth","ushort","nearest"),tDpoitDepth:xn("texture","rg","float","nearest"),tDpoitFrontColor:xn("texture","rgba","float","nearest"),tDpoitBackColor:xn("texture","rgba","float","nearest")},Iy={uObjectId:Ne("i")},lZe={uColor:Ne("v3","material"),uColorTexDim:Ne("v2"),uColorGridDim:Ne("v3"),uColorGridTransform:Ne("v4"),tColor:xn("image-uint8","rgb","ubyte","nearest"),tPalette:xn("image-uint8","rgb","ubyte","nearest"),tColorGrid:xn("texture","rgb","ubyte","linear"),dColorType:cn("string",["uniform","attribute","instance","group","groupInstance","vertex","vertexInstance","volume","volumeInstance","direct"]),dUsePalette:cn("boolean")},LD={uSize:Ne("f","material"),uSizeTexDim:Ne("v2"),tSize:xn("image-uint8","rgb","ubyte","nearest"),dSizeType:cn("string",["uniform","attribute","instance","group","groupInstance"]),uSizeFactor:Ne("f","material")},cZe={uMarker:Ne("f"),uMarkerTexDim:Ne("v2"),tMarker:xn("image-uint8","alpha","ubyte","nearest"),markerAverage:_o("number"),markerStatus:_o("number"),dMarkerType:cn("string",["instance","groupInstance"])},uZe={uOverpaintTexDim:Ne("v2"),tOverpaint:xn("image-uint8","rgba","ubyte","nearest"),dOverpaint:cn("boolean"),uOverpaintGridDim:Ne("v3"),uOverpaintGridTransform:Ne("v4"),tOverpaintGrid:xn("texture","rgba","ubyte","linear"),dOverpaintType:cn("string",["instance","groupInstance","volumeInstance"]),uOverpaintStrength:Ne("f","material")},dZe={uTransparencyTexDim:Ne("v2"),tTransparency:xn("image-uint8","alpha","ubyte","nearest"),dTransparency:cn("boolean"),transparencyAverage:_o("number"),uTransparencyGridDim:Ne("v3"),uTransparencyGridTransform:Ne("v4"),tTransparencyGrid:xn("texture","alpha","ubyte","linear"),dTransparencyType:cn("string",["instance","groupInstance","volumeInstance"]),uTransparencyStrength:Ne("f","material")},fZe={uSubstanceTexDim:Ne("v2"),tSubstance:xn("image-uint8","rgba","ubyte","nearest"),dSubstance:cn("boolean"),uSubstanceGridDim:Ne("v3"),uSubstanceGridTransform:Ne("v4"),tSubstanceGrid:xn("texture","rgba","ubyte","linear"),dSubstanceType:cn("string",["instance","groupInstance","volumeInstance"]),uSubstanceStrength:Ne("f","material")},pZe={uClippingTexDim:Ne("v2"),tClipping:xn("image-uint8","alpha","ubyte","nearest"),dClipping:cn("boolean"),dClippingType:cn("string",["instance","groupInstance"])},Ey={dGeometryType:cn("string",["cylinders","directVolume","image","lines","mesh","points","spheres","text","textureMesh"]),...lZe,...cZe,...uZe,...dZe,...fZe,...pZe,dLightCount:cn("number"),dColorMarker:cn("boolean"),dClipObjectCount:cn("number"),dClipVariant:cn("string",["instance","pixel"]),uClipObjectType:Ne("i[]","material"),uClipObjectInvert:Ne("b[]","material"),uClipObjectPosition:Ne("v3[]","material"),uClipObjectRotation:Ne("v4[]","material"),uClipObjectScale:Ne("v3[]","material"),aInstance:Pi("float32",1,1),aTransform:Pi("float32",16,1),uAlpha:Ne("f","material"),uMetalness:Ne("f","material"),uRoughness:Ne("f","material"),uBumpiness:Ne("f","material"),uVertexCount:Ne("i"),uInstanceCount:Ne("i"),uGroupCount:Ne("i"),uInvariantBoundingSphere:Ne("v4"),uLod:Ne("v4"),drawCount:_o("number"),instanceCount:_o("number"),alpha:_o("number"),matrix:_o("m4"),transform:_o("float32"),extraTransform:_o("float32"),hasReflection:_o("boolean"),instanceGranularity:_o("boolean"),boundingSphere:_o("sphere"),invariantBoundingSphere:_o("sphere"),instanceGrid:_o("instanceGrid")},hl="\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nvoid main(void) {\n vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n gl_Position = vec4(position, 0.0, 1.0);\n}\n",mZe=Kc(),yZe=Object.keys({color:"",pick:"",depth:"",marking:""}),bZe=Object.keys({compute:""});function J9(e,t,n,r,i){return n={...n,dRenderVariant:O.create(t)},void 0===i.dRenderVariant&&Object.defineProperty(i,"dRenderVariant",{value:cn("string")}),e.resources.program(n,r,i)}function eH(e,t){if("color"===e)switch(t){case"blended":return"colorBlended";case"wboit":return"colorWboit";case"dpoit":return"colorDpoit"}return e}function Ty(e,t,n,r,i,o,s){return hfe(e,t,n,r,i,o,yZe,s)}function ms(e,t,n,r,i,o=-1){return hfe(e,t,n,r,i,o,bZe,void 0)}function hfe(e,t,n,r,i,o,s,a){const l=mZe(),{stats:c,state:u,resources:d}=e,{instancedArrays:f,vertexArrayObject:p,multiDrawInstancedBaseVertexBaseInstance:m,drawInstancedBaseVertexBaseInstance:h}=e.extensions;i.uVertexCount&&!e.extensions.noNonInstancedActiveAttribs&&(i.aVertex=O.create(Sd(new Float32Array(i.uVertexCount.ref.value))),r.aVertex=Pi("float32",1,0));const{attributeValues:g,defineValues:y,textureValues:v,materialTextureValues:x,uniformValues:_,materialUniformValues:w,bufferedUniformValues:A}=function sZe(e,t){const n={},r={},i={},o={},s={},a={},l={};return Object.keys(e).forEach(c=>{const u=e[c];"attribute"===u.type&&(n[c]=t[c]),"define"===u.type&&(r[c]=t[c]),"texture"===u.type&&void 0!==t[c]&&("material"===u.variant?o[c]=t[c]:i[c]=t[c]),"uniform"===u.type&&void 0!==t[c]&&("material"===u.variant?a[c]=t[c]:"buffered"===u.variant?l[c]=t[c]:s[c]=t[c])}),{attributeValues:n,defineValues:r,textureValues:i,materialTextureValues:o,uniformValues:s,materialUniformValues:a,bufferedUniformValues:l}}(r,i),M=Object.entries(_),E=Object.entries(w),D=Object.entries(A),T=Object.entries(function dYe(e){const t={};return Object.keys(e).forEach(n=>{t[n]=O.create(op(e[n].ref.value))}),t}(A)),F=Object.entries(y),R=function aZe(e){const t={};return Object.keys(e).forEach(n=>{t[n]=e[n].ref.version}),t}(i),N=function gZe(e,t){const{gl:n}=e;switch(t){case"points":return n.POINTS;case"lines":return n.LINES;case"line-strip":return n.LINE_STRIP;case"line-loop":return n.LINE_LOOP;case"triangles":return n.TRIANGLES;case"triangle-strip":return n.TRIANGLE_STRIP;case"triangle-fan":return n.TRIANGLE_FAN}}(e,t),j={};for(const ee of s)j[ee]=J9(e,eH(ee,a),y,n,r);const W=xde(e,r,v),z=xde(e,r,x),$=function bYe(e,t,n){const r=[];return Object.keys(t).forEach(i=>{const o=t[i];"attribute"===o.type&&(r[r.length]=[i,e.resources.attribute(n[i].ref.value,o.itemSize,o.divisor)])}),r}(e,r,g),V=[];for(let ee=0,se=$.length;eej[ee],setTransparency:ee=>{if(ee!==a){a=ee;for(const se of s)j[se].destroy(),j[se]=J9(e,eH(se,a),y,n,r)}},render:(ee,se,xe)=>{if(0===te||0===K)return;const re=j[ee];if(re.id===Z&&u.currentRenderItemId===l)re.setUniforms(M),re.bindTextures(W,se);else{const ae=oe[ee];(re.id!==u.currentProgramId||re.id!==Z||-1===o||o!==u.currentMaterialId)&&(re.id!==u.currentProgramId&&re.use(),re.setUniforms(E),re.bindTextures(z,se+W.length),u.currentMaterialId=o,Z=re.id),re.setUniforms(M),re.setUniforms(T),re.bindTextures(W,se),ae?(ae.bind(),X&&X.bind()):(X&&X.bind(),re.bindAttributes($)),u.currentRenderItemId=l}if($n)try{dN(e.gl)}catch(ae){throw new Error(`Framebuffer error rendering item id ${l}: '${ae}'`)}if(xe){for(const ae of xe)if(0!==ae.count){if(re.setUniforms(ae.uniforms),m)X?m.multiDrawElementsInstancedBaseVertexBaseInstance(N,ae.counts,0,X._dataType,ae.offsets,0,ae.instanceCounts,0,ae.baseVertices,0,ae.baseInstances,0,ae.count):m.multiDrawArraysInstancedBaseInstance(N,ae.firsts,0,ae.counts,0,ae.instanceCounts,0,ae.baseInstances,0,ae.count);else if(h)if(X)for(let ge=0;ge0&&(re.uniform("uDrawId",ge),h.drawElementsInstancedBaseVertexBaseInstance(N,ae.counts[ge],X._dataType,ae.offsets[ge],ae.instanceCounts[ge],ae.baseVertices[ge],ae.baseInstances[ge]));else for(let ge=0;ge0&&(re.uniform("uDrawId",ge),h.drawArraysInstancedBaseInstance(N,ae.firsts[ge],ae.counts[ge],ae.instanceCounts[ge],ae.baseInstances[ge]));else if(X)for(let ge=0;ge0&&(re.uniform("uDrawId",ge),re.offsetAttributes(V,ae.baseInstances[ge]),f.drawElementsInstanced(N,ae.counts[ge],X._dataType,ae.offsets[ge],ae.instanceCounts[ge]));else for(let ge=0;ge0&&(re.uniform("uDrawId",ge),re.offsetAttributes(V,ae.baseInstances[ge]),f.drawArraysInstanced(N,0,ae.counts[ge],ae.instanceCounts[ge]));if(It){m?c.calls.multiDrawInstancedBase+=1:h?c.calls.drawInstancedBase+=ae.count:c.calls.drawInstanced+=ae.count;for(let ge=0;ge{if(function xZe(e){e.attributes=!1,e.defines=!1,e.elements=!1,e.textures=!1}(Q),i.aVertex){const ee=i.uVertexCount.ref.value;i.aVertex.ref.value.length=ae.ref.value.length)re.updateSubData(ae.ref.value,0,re.length);else{re.destroy();const{itemSize:ge,divisor:Ie}=r[xe];$[ee][1]=d.attribute(ae.ref.value,ge,Ie),Q.attributes=!0}R[xe]=ae.ref.version}}if(X&&i.elements.ref.version!==R.elements&&(X.length>=i.elements.ref.value.length?X.updateSubData(i.elements.ref.value,0,X.length):(X.destroy(),X=d.elements(i.elements.ref.value),Q.elements=!0),R.elements=i.elements.ref.version),Q.attributes||Q.defines||Q.elements)for(const ee of s){const se=oe[ee];se&&se.destroy(),oe[ee]=p?d.vertexArray(j[ee],$,X):null}for(let ee=0,se=W.length;ee{if(!G){for(const ee of s){j[ee].destroy();const se=oe[ee];se&&se.destroy()}W.forEach(([ee,se])=>{"texture"!==r[ee].kind&&se.destroy()}),z.forEach(([ee,se])=>{"texture"!==r[ee].kind&&se.destroy()}),$.forEach(([ee,se])=>se.destroy()),X&&X.destroy(),c.drawCount-=te,c.instanceCount-=K,c.instancedDrawCount-=K*te,G=!0}}}}function gs(){return gs.create(C.create(1,0,0),0)}function E_(){return E_.create(gs(),gs(),gs(),gs(),gs(),gs())}!function(e){function n(h,g){return C.copy(h.normal,g.normal),h.constant=g.constant,h}function l(h,g,y){return C.copy(h.normal,g),h.constant=-C.dot(h.normal,y),h}e.create=function t(h,g){return{normal:h,constant:g}},e.copy=n,e.clone=function r(h){return n(e(),h)},e.normalize=function i(h,g){const y=1/C.magnitude(g.normal);return C.scale(h.normal,g.normal,y),h.constant=g.constant*y,h},e.negate=function o(h,g){return C.negate(h.normal,g.normal),h.constant=-g.constant,h},e.toArray=function s(h,g,y){return C.toArray(h.normal,g,y),g[y+3]=h.constant,g},e.fromArray=function a(h,g,y){return C.fromArray(h.normal,g,y),h.constant=g[y+3],h},e.fromNormalAndCoplanarPoint=l,e.fromCoplanarPoints=function c(h,g,y,v){return l(h,C.triangleNormal(C(),g,y,v),g),h};const u=C();function f(h,g){return C.dot(h.normal,g)+h.constant}e.setUnnormalized=function d(h,g,y,v,x){C.set(u,g,y,v);const _=1/C.magnitude(u);return C.scale(h.normal,u,_),h.constant=x*_,h},e.distanceToPoint=f,e.distanceToSpher3D=function p(h,g){return f(h,g.center)-g.radius},e.projectPoint=function m(h,g,y){return C.scaleAndAdd(h,h,g.normal,-f(g,y))}}(gs||(gs={})),function(e){function n(c,u){for(let d=0;d<6;++d)gs.copy(c[d],u[d]);return c}e.create=function t(c,u,d,f,p,m){return[c,u,d,f,p,m]},e.copy=n,e.clone=function r(c){return n(e(),c)},e.fromProjectionMatrix=function i(c,u){const d=u[0],f=u[1],p=u[2],m=u[3],h=u[4],g=u[5],y=u[6],v=u[7],x=u[8],_=u[9],w=u[10],A=u[11],M=u[12],E=u[13],D=u[14],T=u[15];return gs.setUnnormalized(c[0],m-d,v-h,A-x,T-M),gs.setUnnormalized(c[1],m+d,v+h,A+x,T+M),gs.setUnnormalized(c[2],m+f,v+g,A+_,T+E),gs.setUnnormalized(c[3],m-f,v-g,A-_,T-E),gs.setUnnormalized(c[4],m-p,v-y,A-w,T-D),gs.setUnnormalized(c[5],m+p,v+y,A+w,T+D),c},e.intersectsSphere3D=function o(c,u){const d=u.center,f=-u.radius;for(let p=0;p<6;++p)if(gs.distanceToPoint(c[p],d)0?u.max[0]:u.min[0],s[1]=f.normal[1]>0?u.max[1]:u.min[1],s[2]=f.normal[2]>0?u.max[2]:u.min[2],gs.distanceToPoint(f,s)<0)return!1}return!0},e.containsPoint=function l(c,u){for(let d=0;d<6;++d)if(gs.distanceToPoint(c[d],u)<0)return!1;return!0}}(E_||(E_={}));const DN=gs.distanceToPoint,PN=E_.intersectsSphere3D,kN=ke.fromArray,mfe=Kc();function tH(e,t){return t&&t.instanceCounts.length>=e?t:{firsts:new Int32Array(e),counts:new Int32Array(e),offsets:new Int32Array(e),instanceCounts:new Int32Array(e),baseVertices:new Int32Array(e),baseInstances:new Uint32Array(e),count:0,uniforms:[]}}function Dy(e,t,n){const r=mfe();let i=tH(0);const o=[];let s=!1,a=-1;const l=ke(),c=()=>{var u;const d=null===(u=t.lodLevels)||void 0===u?void 0:u.ref.value;if(d&&d.length>0){const{cellCount:f}=t.instanceGrid.ref.value;o.length=d.length;for(let p=0,m=d.length;p{var m,h;if(s=!1,0===t.drawCount.ref.value||0===t.instanceCount.ref.value||!t.instanceGrid.ref.value)return;const{cellOffsets:g,cellSpheres:y,cellCount:v,batchOffsets:x,batchSpheres:_,batchCount:w,batchCell:A,batchSize:M}=t.instanceGrid.ref.value,[E,D]=t.uLod.ref.value,T=0!==E||0!==D,F=2*M,R=null===(m=t.lodLevels)||void 0===m?void 0:m.ref.value;if(R&&R.length>0){if((null===(h=t.lodLevels)||void 0===h?void 0:h.ref.version)!==a)c();else for(let N=0,j=R.length;ND))It&&(p.culled.lod+=g[A[W-1]+1]-g[A[j]]);else if(PN(d,l))if(null!==f&&f(l))It&&(p.culled.occlusion+=g[A[W-1]+1]-g[A[j]]);else for(let V=j;VD))It&&(p.culled.lod+=te);else if(PN(d,l))if(null!==f&&K-l.radiusR[Q][1])continue;const Z=o[Q],ee=Z.count;ee>0&&Z.baseInstances[ee-1]+Z.instanceCounts[ee-1]===H&&Z.counts[ee-1]===R[Q][3]?Z.instanceCounts[ee-1]+=te:(Z.counts[ee]=R[Q][3],Z.instanceCounts[ee]=te,Z.baseInstances[ee]=H,Z.count+=1)}else It&&(p.culled.frustum+=te)}else It&&(p.culled.frustum+=g[A[W-1]+1]-g[A[j]])}}else{i=tH(v,i);const{baseInstances:N,instanceCounts:j,counts:W}=i;let z=0;for(let $=0;$D){It&&(p.culled.lod+=g[A[X-1]+1]-g[A[V]]);continue}}if(!PN(d,l)){It&&(p.culled.frustum+=g[A[X-1]+1]-g[A[V]]);continue}if(null!==f&&f(l)){It&&(p.culled.occlusion+=g[A[X-1]+1]-g[A[V]]);continue}for(let oe=V;oeD)?It&&(p.culled.lod+=G):PN(d,l)?null!==f&&Z-l.radius0&&N[z-1]+j[z-1]===K?j[z-1]+=G:(W[z]=t.drawCount.ref.value,j[z]=G,N[z]=K,z+=1):It&&(p.culled.frustum+=G)}}}i.count=z,o.length=1,o[0]=i,o[0].uniforms.length=0}s=!0},uncull:()=>{s=!1},render:(u,d)=>{t.uAlpha&&t.alpha&&O.updateIfChanged(t.uAlpha,al(t.alpha.ref.value*n.alphaFactor,0,1)),e.render(u,d,s?o:void 0)},getProgram:u=>e.getProgram(u),setTransparency:u=>e.setTransparency(u),update:()=>{e.update(),c()},dispose:()=>e.destroy()}}function ys(e,t){return{id:mfe(),values:t,render:()=>e.render("compute",0),update:()=>e.update(),dispose:()=>e.destroy()}}const nH=new Float32Array([1,1,-1,1,-1,-1,-1,-1,1,-1,1,1]),ca={drawCount:_o("number"),instanceCount:_o("number"),aPosition:Pi("float32",2,0),uQuadScale:Ne("v2")},ua={drawCount:O.create(6),instanceCount:O.create(1),aPosition:O.create(nH),uQuadScale:O.create(Ue.create(1,1))},_Ze={...ca,tColor:xn("texture","rgba","ubyte","nearest"),uTexSize:Ne("v2")},SZe=Wi("copy",hl,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSize;\n\nvoid main() {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n gl_FragColor = texture2D(tColor, coords);\n}\n");function Zw(e,t){const n={...ua,tColor:O.create(t),uTexSize:O.create(Ue.create(t.getWidth(),t.getHeight()))},r={..._Ze};return ys(ms(e,"triangles",SZe,r,n),n)}const gfe=new Uint32Array([0,1,2,1,3,2]),wZe=new Float32Array([0,1,0,0,1,1,1,0]),yfe={nearest:"Nearest",catmulrom:"Catmulrom (Cubic)",mitchell:"Mitchell (Cubic)",bspline:"B-Spline (Cubic)"},AZe=Object.keys(yfe);var Py,Wu,$a;!function(e){function t(f,p,m,h){return h?function i(f,p,m,h){const g=f.width,y=f.height;return O.update(h.imageTexture,f),O.update(h.imageTextureDim,Ue.set(h.imageTextureDim.ref.value,g,y)),O.update(h.cornerBuffer,p),O.update(h.groupTexture,m),h}(f,p,m,h):function r(f,p,m){const h=ke();let g=-1;const y=f.width,v=f.height,x={kind:"image",imageTexture:O.create(f),imageTextureDim:O.create(Ue.create(y,v)),cornerBuffer:O.create(p),groupTexture:O.create(m),get boundingSphere(){const _=function n(f){return Zc([f.cornerBuffer.ref.version])}(x);if(_!==g){const w=function IZe(e){const t=C(),n=[];for(let o=0,s=e.length;or&&(r=s)}const i=ke.create(t,r);return ke.setExtrema(i,n),i}(x.cornerBuffer.ref.value);ke.copy(h,w),g=_}return h}};return x}(f,p,m)}function o(f){return t(Sa(0,4,Uint8Array),f?f.cornerBuffer.ref.value:new Float32Array(24),Sa(0,4,Uint8Array),f)}function s(f,p,m,h,g){const{instanceCount:y,groupCount:v}=m,_=Ef(m,e.Utils.createPositionIterator(f,p),h.color),w=g.instanceGranularity?hs(y,"instance"):hs(y*v,"groupInstance"),A=my(),M=gy(),E=by(),D=yy(),T={drawCount:gfe.length,vertexCount:nH.length/3,groupCount:v,instanceCount:y},F=ke.clone(f.boundingSphere),R=pl(F,p.aTransform.ref.value,y,0);return{dGeometryType:O.create("image"),..._,...w,...A,...M,...E,...D,...p,...xt.createValues(g,T),aPosition:f.cornerBuffer,aUv:O.create(wZe),elements:O.create(gfe),aGroup:O.create(Sd(new Float32Array(4))),boundingSphere:O.create(R),invariantBoundingSphere:O.create(F),uInvariantBoundingSphere:O.create(Bn.ofSphere(F)),dInterpolation:O.create(g.interpolation),uImageTexDim:f.imageTextureDim,tImageTex:f.imageTexture,tGroupTex:f.groupTexture}}e.create=t,e.createEmpty=o,e.Params={...xt.Params,interpolation:I.Select("bspline",I.objectToOptions(yfe))},e.Utils={Params:e.Params,createEmpty:o,createValues:s,createValuesSimple:function a(f,p,m,h,g){const y=xt.createSimple(m,h,g),v={...I.getDefaultValues(e.Params),...p};return s(f,y.transform,y.locationIterator,y.theme,v)},updateValues:function l(f,p){xt.updateValues(f,p),O.updateIfChanged(f.dInterpolation,p.interpolation)},updateBoundingSphere:function c(f,p){const m=ke.clone(p.boundingSphere),h=pl(m,f.aTransform.ref.value,f.instanceCount.ref.value,0);ke.equals(h,f.boundingSphere.ref.value)||O.update(f.boundingSphere,h),ke.equals(m,f.invariantBoundingSphere.ref.value)||(O.update(f.invariantBoundingSphere,m),O.update(f.uInvariantBoundingSphere,Bn.fromSphere(f.uInvariantBoundingSphere.ref.value,m)))},createRenderableState:function u(f){const p=xt.createRenderableState(f);return p.opaque=!1,p},updateRenderableState:function d(f,p){xt.updateRenderableState(f,p),f.opaque=!1},createPositionIterator:()=>Vi(1,1,1,()=>Gu)}}(Py||(Py={})),function(e){function t(m,h,g,y,v,x,_,w,A,M){return M?function o(m,h,g,y,v,x,_,w,A,M){return A>M.cylinderCount&&(O.update(M.mappingBuffer,m),O.update(M.indexBuffer,h)),M.cylinderCount=A,O.update(M.groupBuffer,g),O.update(M.startBuffer,y),O.update(M.endBuffer,v),O.update(M.scaleBuffer,x),O.update(M.capBuffer,_),O.update(M.colorModeBuffer,w),M}(m,h,g,y,v,x,_,w,A,M):function i(m,h,g,y,v,x,_,w,A){const M=ke();let E,D=-1,T=-1;const F={kind:"cylinders",cylinderCount:A,mappingBuffer:O.create(m),indexBuffer:O.create(h),groupBuffer:O.create(g),startBuffer:O.create(y),endBuffer:O.create(v),scaleBuffer:O.create(x),capBuffer:O.create(_),colorModeBuffer:O.create(w),get boundingSphere(){const R=r(F);if(R!==D){const N=py(F.startBuffer.ref.value,6*F.cylinderCount,6),j=py(F.endBuffer.ref.value,6*F.cylinderCount,6);ke.expandBySphere(M,N,j),D=R}return M},get groupMapping(){return F.groupBuffer.ref.version!==T&&(E=zw(F.groupBuffer.ref.value,F.cylinderCount,6),T=F.groupBuffer.ref.version),E},setBoundingSphere(R){ke.copy(M,R),D=r(F)}};return F}(m,h,g,y,v,x,_,w,A)}function n(m){return t(m?m.mappingBuffer.ref.value:new Float32Array(0),m?m.indexBuffer.ref.value:new Uint32Array(0),m?m.groupBuffer.ref.value:new Float32Array(0),m?m.startBuffer.ref.value:new Float32Array(0),m?m.endBuffer.ref.value:new Float32Array(0),m?m.scaleBuffer.ref.value:new Float32Array(0),m?m.capBuffer.ref.value:new Float32Array(0),m?m.colorModeBuffer.ref.value:new Float32Array(0),0,m)}function r(m){return Zc([m.cylinderCount,m.mappingBuffer.ref.version,m.indexBuffer.ref.version,m.groupBuffer.ref.version,m.startBuffer.ref.version,m.endBuffer.ref.version,m.scaleBuffer.ref.version,m.capBuffer.ref.version,m.colorModeBuffer.ref.version])}function a(m,h){const g=6*m.cylinderCount,y=h.instanceCount.ref.value,v=V1(),x=v.position,_=m.startBuffer.ref.value,w=m.endBuffer.ref.value,A=h.aTransform.ref.value;return Vi(g,y,2,(E,D)=>{const T=E%6==0?_:w;return D<0?C.fromArray(x,T,3*E):C.transformMat4Offset(x,T,A,0,3*E,16*D),v})}function l(m,h,g,y,v){const{instanceCount:x,groupCount:_}=g,A=Ef(g,a(m,h),y.color),M=xy(g,y.size),E=v.instanceGranularity?hs(x,"instance"):hs(x*_,"groupInstance"),D=my(),T=gy(),F=by(),R=yy(),N={drawCount:4*m.cylinderCount*3,vertexCount:6*m.cylinderCount,groupCount:_,instanceCount:x},j=OD(M)*v.sizeFactor,W=ke.clone(m.boundingSphere),z=pl(W,h.aTransform.ref.value,x,0);return{dGeometryType:O.create("cylinders"),aMapping:m.mappingBuffer,aGroup:m.groupBuffer,aStart:m.startBuffer,aEnd:m.endBuffer,aScale:m.scaleBuffer,aCap:m.capBuffer,aColorMode:m.colorModeBuffer,elements:m.indexBuffer,boundingSphere:O.create(z),invariantBoundingSphere:O.create(W),uInvariantBoundingSphere:O.create(Bn.ofSphere(W)),...A,...M,...E,...D,...T,...F,...R,...h,padding:O.create(j),...xt.createValues(v,N),uSizeFactor:O.create(v.sizeFactor*v.sizeAspectRatio),uDoubleSided:O.create(v.doubleSided),dIgnoreLight:O.create(v.ignoreLight),dXrayShaded:O.create("inverted"===v.xrayShaded?"inverted":!0===v.xrayShaded?"on":"off"),dTransparentBackfaces:O.create(v.transparentBackfaces),dSolidInterior:O.create(v.solidInterior),uBumpFrequency:O.create(v.bumpFrequency),uBumpAmplitude:O.create(v.bumpAmplitude),dDualColor:O.create("interpolate"===v.colorMode)}}function p(m,h){xt.updateRenderableState(m,h),m.opaque=m.opaque&&!h.xrayShaded,m.writeDepth=m.opaque}e.create=t,e.createEmpty=n,e.transform=function s(m,h){const g=m.startBuffer.ref.value;w_(h,g,0,6*m.cylinderCount),O.update(m.startBuffer,g);const y=m.endBuffer.ref.value;w_(h,y,0,6*m.cylinderCount),O.update(m.endBuffer,y)},e.Params={...xt.Params,sizeFactor:I.Numeric(1,{min:0,max:10,step:.1}),sizeAspectRatio:I.Numeric(1,{min:0,max:3,step:.01}),doubleSided:I.Boolean(!1,xt.CustomQualityParamInfo),ignoreLight:I.Boolean(!1,xt.ShadingCategory),xrayShaded:I.Select(!1,[[!1,"Off"],[!0,"On"],["inverted","Inverted"]],xt.ShadingCategory),transparentBackfaces:I.Select("off",I.arrayToOptions(["off","on","opaque"]),xt.ShadingCategory),solidInterior:I.Boolean(!0,xt.ShadingCategory),bumpFrequency:I.Numeric(0,{min:0,max:10,step:.1},xt.ShadingCategory),bumpAmplitude:I.Numeric(1,{min:0,max:5,step:.1},xt.ShadingCategory),colorMode:I.Select("default",I.arrayToOptions(["default","interpolate"]),xt.ShadingCategory)},e.Utils={Params:e.Params,createEmpty:n,createValues:l,createValuesSimple:function c(m,h,g,y,v){const x=xt.createSimple(g,y,v),_={...I.getDefaultValues(e.Params),...h};return l(m,x.transform,x.locationIterator,x.theme,_)},updateValues:function u(m,h){xt.updateValues(m,h),O.updateIfChanged(m.uSizeFactor,h.sizeFactor*h.sizeAspectRatio),O.updateIfChanged(m.uDoubleSided,h.doubleSided),O.updateIfChanged(m.dIgnoreLight,h.ignoreLight),O.updateIfChanged(m.dXrayShaded,"inverted"===h.xrayShaded?"inverted":!0===h.xrayShaded?"on":"off"),O.updateIfChanged(m.dTransparentBackfaces,h.transparentBackfaces),O.updateIfChanged(m.dSolidInterior,h.solidInterior),O.updateIfChanged(m.uBumpFrequency,h.bumpFrequency),O.updateIfChanged(m.uBumpAmplitude,h.bumpAmplitude),O.updateIfChanged(m.dDualColor,"interpolate"===h.colorMode)},updateBoundingSphere:function d(m,h){const g=ke.clone(h.boundingSphere),y=pl(g,m.aTransform.ref.value,m.instanceCount.ref.value,0);ke.equals(y,m.boundingSphere.ref.value)||O.update(m.boundingSphere,y),ke.equals(g,m.invariantBoundingSphere.ref.value)||(O.update(m.invariantBoundingSphere,g),O.update(m.uInvariantBoundingSphere,Bn.fromSphere(m.uInvariantBoundingSphere.ref.value,g)))},createRenderableState:function f(m){const h=xt.createRenderableState(m);return p(h,m),h},updateRenderableState:p,createPositionIterator:a}}(Wu||(Wu={})),function(e){function t(s){switch(s.kind){case"mesh":return 3*s.triangleCount;case"points":return s.pointCount;case"spheres":return 2*s.sphereCount*3;case"cylinders":return 4*s.cylinderCount*3;case"text":return 2*s.charCount*3;case"lines":return 2*s.lineCount*3;case"direct-volume":return 36;case"image":return 6;case"texture-mesh":return s.vertexCount}}e.getDrawCount=t,e.getVertexCount=function n(s){switch(s.kind){case"mesh":case"texture-mesh":return s.vertexCount;case"points":return s.pointCount;case"spheres":return 6*s.sphereCount;case"cylinders":return 6*s.cylinderCount;case"text":return 4*s.charCount;case"lines":return 4*s.lineCount;case"direct-volume":const[a,l,c]=s.gridDimension.ref.value;return a*l*c;case"image":return 4}},e.getGroupCount=function r(s){switch(s.kind){case"mesh":case"points":case"spheres":case"cylinders":case"text":case"lines":return 0===t(s)?0:Bh(s.groupBuffer.ref.value)+1;case"direct-volume":return 1;case"image":return Bh(s.groupTexture.ref.value.array)+1;case"texture-mesh":return s.groupCount}},e.getUtils=function i(s){switch(s.kind){case"mesh":return on.Utils;case"points":return G1.Utils;case"spheres":return Rp.Utils;case"cylinders":return Wu.Utils;case"text":return Tf.Utils;case"lines":return Mo.Utils;case"direct-volume":return Df.Utils;case"image":return Py.Utils;case"texture-mesh":return iu.Utils}},e.getGranularity=function o(s,a){return"instance"===a&&s.nonInstanceable?"group":a}}($a||($a={}));const bfe={};function oH(e,t){return{factory:oH,granularity:"groupInstance",size:n=>Bc.isLocation(n)?n.shape.getSize(n.group,n.instance):1,props:t,description:"Assigns sizes as defined by the shape object."}}const PZe={name:"shape-group",label:"Shape Group",category:"",factory:oH,getParams:function DZe(e){return bfe},defaultValues:I.getDefaultValues(bfe),isApplicable:e=>!!e.shape},kZe=st(13421772),vfe={};function sH(e,t){return{factory:sH,granularity:"groupInstance",color:n=>Bc.isLocation(n)?n.shape.getColor(n.group,n.instance):kZe,props:t,description:"Assigns colors as defined by the shape object."}}const NZe={name:"shape-group",label:"Shape Group",category:xo.Misc,factory:sH,getParams:function RZe(e){return vfe},defaultValues:I.getDefaultValues(vfe),isApplicable:e=>!!e.shape},FZe={...Ey,aPosition:Pi("float32",3,0),elements:Kw("uint32"),uBboxMin:Ne("v3"),uBboxMax:Ne("v3"),uBboxSize:Ne("v3"),uMaxSteps:Ne("i"),uStepScale:Ne("f"),uJumpLength:Ne("f"),uTransform:Ne("m4"),uGridDim:Ne("v3"),tTransferTex:xn("image-uint8","alpha","ubyte","linear"),uTransferScale:Ne("f","material"),dGridTexType:cn("string",["2d","3d"]),uGridTexDim:Ne("v3"),tGridTex:xn("texture","rgba","ubyte","linear"),uGridStats:Ne("v4"),uCellDim:Ne("v3"),uCartnToUnit:Ne("m4"),uUnitToCartn:Ne("m4"),dPackedGroup:cn("boolean"),dAxisOrder:cn("string",["012","021","102","120","201","210"]),dIgnoreLight:cn("boolean"),dXrayShaded:cn("string",["off","on","inverted"])},BZe={...Ey,aGroup:Pi("float32",1,0),aPosition:Pi("float32",3,0),aNormal:Pi("float32",3,0),elements:Kw("uint32"),dVaryingGroup:cn("boolean"),dFlatShaded:cn("boolean"),uDoubleSided:Ne("b","material"),dFlipSided:cn("boolean"),dIgnoreLight:cn("boolean"),dXrayShaded:cn("string",["off","on","inverted"]),dTransparentBackfaces:cn("string",["off","on","opaque"]),uBumpFrequency:Ne("f","material"),uBumpAmplitude:Ne("f","material"),meta:_o("unknown")},jZe={...Ey,...LD,aGroup:Pi("float32",1,0),aPosition:Pi("float32",3,0),dPointSizeAttenuation:cn("boolean"),dPointStyle:cn("string",["square","circle","fuzzy"])},zZe={...Ey,...LD,aGroup:Pi("float32",1,0),aMapping:Pi("float32",2,0),aStart:Pi("float32",3,0),aEnd:Pi("float32",3,0),elements:Kw("uint32"),dLineSizeAttenuation:cn("boolean"),uDoubleSided:Ne("b","material"),dFlipSided:cn("boolean")},HZe={...Ey,...LD,uTexDim:Ne("v2"),tPositionGroup:xn("image-float32","rgba","float","nearest"),padding:_o("number"),uDoubleSided:Ne("b","material"),dIgnoreLight:cn("boolean"),dXrayShaded:cn("string",["off","on","inverted"]),dTransparentBackfaces:cn("string",["off","on","opaque"]),dSolidInterior:cn("boolean"),dClipPrimitive:cn("boolean"),dApproximate:cn("boolean"),uAlphaThickness:Ne("f"),uBumpFrequency:Ne("f","material"),uBumpAmplitude:Ne("f","material"),lodLevels:_o("unknown"),centerBuffer:_o("float32"),groupBuffer:_o("float32")},qZe={...Ey,...LD,aGroup:Pi("float32",1,0),aPosition:Pi("float32",3,0),aMapping:Pi("float32",2,0),aDepth:Pi("float32",1,0),elements:Kw("uint32"),aTexCoord:Pi("float32",2,0),tFont:xn("image-uint8","alpha","ubyte","linear"),padding:_o("number"),uBorderWidth:Ne("f","material"),uBorderColor:Ne("v3","material"),uOffsetX:Ne("f","material"),uOffsetY:Ne("f","material"),uOffsetZ:Ne("f","material"),uBackgroundColor:Ne("v3","material"),uBackgroundOpacity:Ne("f","material")},$Ze={...Ey,uGeoTexDim:Ne("v2","buffered"),tPosition:xn("texture","rgb","float","nearest"),tGroup:xn("texture","alpha","float","nearest"),tNormal:xn("texture","rgb","float","nearest"),dVaryingGroup:cn("boolean"),dFlatShaded:cn("boolean"),uDoubleSided:Ne("b","material"),dFlipSided:cn("boolean"),dIgnoreLight:cn("boolean"),dXrayShaded:cn("string",["off","on","inverted"]),dTransparentBackfaces:cn("string",["off","on","opaque"]),uBumpFrequency:Ne("f","material"),uBumpAmplitude:Ne("f","material"),meta:_o("unknown")},XZe={...Ey,aGroup:Pi("float32",1,0),aPosition:Pi("float32",3,0),aUv:Pi("float32",2,0),elements:Kw("uint32"),uImageTexDim:Ne("v2"),tImageTex:xn("image-uint8","rgba","ubyte","nearest"),tGroupTex:xn("image-uint8","rgba","ubyte","nearest"),dInterpolation:cn("string",AZe)},ZZe={...Ey,...LD,aGroup:Pi("float32",1,0),aStart:Pi("float32",3,0),aEnd:Pi("float32",3,0),aMapping:Pi("float32",3,0),aScale:Pi("float32",1,0),aCap:Pi("float32",1,0),aColorMode:Pi("float32",1,0),elements:Kw("uint32"),padding:_o("number"),uDoubleSided:Ne("b","material"),dIgnoreLight:cn("boolean"),dXrayShaded:cn("string",["off","on","inverted"]),dTransparentBackfaces:cn("string",["off","on","opaque"]),dSolidInterior:cn("boolean"),uBumpFrequency:Ne("f","material"),uBumpAmplitude:Ne("f","material"),dDualColor:cn("boolean")},JZe=Kc(0,2147483647),ky=Kc(0,2147483647);function Jw(e,t,n,r){return{id:JZe(),type:e,values:t,state:n,materialId:r}}var zr,Bc;function xfe(e){const t=e&&e.getElement("vertex"),n=e&&e.getElement("material"),r={group:"",vRed:"",vGreen:"",vBlue:"",mRed:"",mGreen:"",mBlue:""},i=[["",""]],o=[["",""]];if(t){for(let l=0,c=t.propertyNames.length;l(f.group=m,f.instance=h,f))}function i(u,d,f,p,m){const h=m&&m.aTransform.ref.value.length>=16*u.length?m.aTransform.ref.value:new Float32Array(16*u.length);for(let g=0,y=u.length;g{for(let A=v[w],M=v[w+1];A{for(let A=v[w],M=v[w+1];A{const A=p.shape.getSize(w,_);h{const m="material"===i?p:c[p];return st.fromRgb(o.value(m),s.value(m),a.value(m))},()=>1,p=>`${u} ${l[p]}`,f)}function oQe(){let e,t,n,r,i,o;return function(){var a=le(function*(l,c,u,d){const f=c.source.getElement("vertex");if(!f)throw new Error("missing vertex element");const p=c.source.getElement("face");if(!p)throw new Error("missing face element");const m=c.source.getElement("material");let h=!1,g=!1;return(!e||e!=e)&&(h=!0),(!t||!I.isParamEqual(_fe.grouping,t.grouping,u.grouping))&&(h=!0),(!t||!I.isParamEqual(_fe.coloring,t.coloring,u.coloring))&&(g=!0),h?(i=Sfe(f,m,u),o=function iQe(e,t){const{grouping:n}=t,{rowCount:r}=e,i="vertex"===n.name?e.getProperty(n.params.group):void 0,o="vertex"===n.name?yf(n.params.group):"Vertex",s=i?i.toArray({array:Uint32Array}):Sd(new Uint32Array(r)),a=i?Bh(s):r-1,l=new Uint32Array(a+1);for(let c=0,u=s.length;c=48&&s<=57)&&i<=o;)s=t.charCodeAt(++i);for(s=t.charCodeAt(o);(32===s||s>=48&&s<=57)&&o>=i;)s=t.charCodeAt(--o);if(++o,i===o||i+1===o)return ot.add(e,i,o);if(s=t.charCodeAt(i),i+2===o){const a=t.charCodeAt(i+1);if(!((78!==s&&110!==s||65!==a&&97!==a)&&(67!==s&&99!==s||76!==a&&108!==a)&&(70!==s&&102!==s||69!==a&&101!==a)&&(83!==s&&115!==s||73!==a&&105!==a)&&(66!==s&&98!==s||82!==a&&114!==a)&&(65!==s&&97!==s||83!==a&&115!==a)))return ot.add(e,i,i+2)}if(67===s||99===s||72===s||104===s||78===s||110===s||79===s||111===s||80===s||112===s||83===s||115===s)return ot.add(e,i,i+1);ot.add(e,i,i)}!function(e){function t(i,o){return{size:i,anglesInRadians:o}}function n(){return t(C(),C())}e.create=t,e.empty=n,e.fromBasis=function r(i,o,s){const a=C.magnitude(i),l=C.magnitude(o),c=C.magnitude(s),u=Math.acos(C.dot(o,s)/(l*c)),d=Math.acos(C.dot(i,s)/(a*c)),f=Math.acos(C.dot(i,o)/(a*l));return a<=0||l<=0||c<=0||u>=Math.PI||d>=Math.PI||f>=Math.PI?n():t(C.create(a,l,c),C.create(u,d,f))}}(Ry||(Ry={}));const cQe=new Set(["NA","CL","FE","SI","BR","AS","LI"]),uQe=new Set(["C","H","N","O","P","S","F","B"]),dQe=/^[\s\d]+|[\s\d]+$/g;function eA(e,t){const n=(e=e.replace(dQe,"").toUpperCase()).length;if(0===n||1===n||cQe.has(e))return e;if(3===n&&t===e){if("SOD"===e)return"NA";if("POT"===e)return"K";if("CES"===e)return"CS";if("CAL"===e)return"CA";if("CLA"===e)return"CL"}return uQe.has(e[0])?e[0]:""}const lH="ABCDEFGHIJKLMNOPQRSTUVWXYZ",jD=k5(function fQe(e){let n=e,r=0,i=lH[n%26];for(;n>=26;)n=Math.floor(n/26),i+=lH[n%26],r+=1;return r>=5&&console.warn("getChainId overflow"),i});function pQe(e,t){const n=e.atomName,r=e.residueName,i=new Array(e.count),o=new Array(e.count),s=new Uint32Array(e.count),a=new Uint32Array(e.count),l=new Array(e.count),c=new Gh,u=new qh(e.residueNumber,e.atomName);let d="",f=0,p="",m=0,h=0,g=-1;for(let x=0,_=e.count;x<_;++x){const w=e.residueNumber.value(x);if(w!==g){const A=e.residueName.value(x),M=x1(u.add(A,x).type,A);(M!==h||w!==g+1&&!(99999===g&&0===w))&&(p=jD(f),f+=1,m=0),d=c.getEntityId(A,M,p),m+=1,g=w,h=M}i[x]=d,o[x]=p,s[x]=m,a[x]=x,l[x]=eA(e.atomName.value(x),e.residueName.value(x))}const y=ce.ofStringArray(o),v=Kr.ofPartialColumns(ic.atom_site,{auth_asym_id:y,auth_atom_id:n,auth_comp_id:r,auth_seq_id:e.residueNumber,Cartn_x:ce.ofFloatArray(ce.mapToArray(e.x,x=>10*x,Float32Array)),Cartn_y:ce.ofFloatArray(ce.mapToArray(e.y,x=>10*x,Float32Array)),Cartn_z:ce.ofFloatArray(ce.mapToArray(e.z,x=>10*x,Float32Array)),id:ce.ofIntArray(a),label_asym_id:y,label_atom_id:n,label_comp_id:r,label_seq_id:ce.ofIntArray(s),label_entity_id:ce.ofStringArray(i),occupancy:ce.ofConst(1,e.count,ce.Schema.float),type_symbol:ce.ofStringArray(l),pdbx_PDB_model_num:ce.ofConst(t,e.count,ce.Schema.int)},e.count);return hp({entity:c.getEntityTable(),chem_comp:u.getChemCompTable(),atom_site:v})}var cH;function mQe(e,t){const n=(o,s)=>(t.substr(o,s)||"").trim(),r={entry_id:Tt.ofString(e),length_a:Tt.ofString(n(6,9)),length_b:Tt.ofString(n(15,9)),length_c:Tt.ofString(n(24,9)),angle_alpha:Tt.ofString(n(33,7)),angle_beta:Tt.ofString(n(40,7)),angle_gamma:Tt.ofString(n(47,7)),Z_PDB:Tt.ofString(n(66,4)),pdbx_unique_axis:Tt.ofString("?")},i={entry_id:Tt.ofString(e),"space_group_name_H-M":Tt.ofString(n(55,11)),Int_Tables_number:Tt.ofString("?"),cell_setting:Tt.ofString("?"),space_group_name_Hall:Tt.ofString("?")};return[ll.ofFields("cell",r),ll.ofFields("symmetry",i)]}function wfe(e,t){return{id:e,details:t,groups:[]}}function gQe(e,t,n){const r=[];let i,o,s,a=1,l=1;const c=h=>e.data.substring(e.indices[2*h],e.indices[2*h+1]);for(let h=t;hh.id)),details:Tt.ofStrings(r.map(h=>h.details))},d=[];for(const h of r)for(const g of h.groups)d.push({assembly_id:h.id,oper_expression:g.operators.map(y=>y.id).join(","),asym_id_list:g.chains.join(",")});const f={assembly_id:Tt.ofStrings(d.map(h=>h.assembly_id)),oper_expression:Tt.ofStrings(d.map(h=>h.oper_expression)),asym_id_list:Tt.ofStrings(d.map(h=>h.asym_id_list))},p=[];for(const h of r)for(const g of h.groups)for(const y of g.operators){const v={id:""+y.id,type:"?",name:"?",symmetry_operation:"?"};for(let x=0;x<3;x++){for(let _=0;_<3;_++)v[`matrix[${x+1}][${_+1}]`]=""+fe.getValue(y.matrix,x,_);v[`vector[${x+1}]`]=""+fe.getValue(y.matrix,x,3)}p.push(v)}const m={id:Tt.ofStrings(p.map(h=>h.id)),type:Tt.ofStrings(p.map(h=>h.type)),name:Tt.ofStrings(p.map(h=>h.name)),symmetry_operation:Tt.ofStrings(p.map(h=>h.symmetry_operation))};for(let h=0;h<3;h++){for(let y=0;y<3;y++){const v=`matrix[${h+1}][${y+1}]`;m[v]=Tt.ofStrings(p.map(x=>x[v]))}const g=`vector[${h+1}]`;m[g]=Tt.ofStrings(p.map(y=>y[g]))}return[ll.ofFields("pdbx_struct_assembly",u),ll.ofFields("pdbx_struct_assembly_gen",f),ll.ofFields("pdbx_struct_oper_list",m)]}function yQe(e,t,n){const r=[];let i;const o=c=>e.data.substring(e.indices[2*c],e.indices[2*c+1]);for(let c=t;cc.id)),code:Tt.ofStrings(s.map(c=>c.code)),details:Tt.ofStrings(s.map(c=>c.details))};for(let c=0;c<3;c++){for(let d=0;d<3;d++){const f=`matrix[${c+1}][${d+1}]`;l[f]=Tt.ofStrings(s.map(p=>p[f]))}const u=`vector[${c+1}]`;l[u]=Tt.ofStrings(s.map(d=>d[u]))}return[ll.ofFields("struct_ncs_oper",l)]}!function(e){e.is=function t(r){return"gro"===r?.kind},e.fromGro=function n(r){return{kind:"gro",name:r.structures[0].header.title,data:r}}}(cH||(cH={}));const bQe={1:"helx_rh_al_p",2:"helx_rh_om_p",3:"helx_rh_pi_p",4:"helx_rh_ga_p",5:"helx_rh_3t_p",6:"helx_lh_al_p",7:"helx_lh_om_p",8:"helx_lh_ga_p",9:"helx_rh_27_p",10:"helx_rh_pp_p"};function xQe(e,t,n){const r=[],i=u=>e.data.substring(e.indices[2*u],e.indices[2*u+1]);for(let u=t;uu.initChainID)),s=Tt.ofStrings(r.map(u=>u.initResName)),a=Tt.ofStrings(r.map(u=>u.endChainID)),l=Tt.ofStrings(r.map(u=>u.endResName)),c={beg_label_asym_id:o,beg_label_comp_id:s,beg_label_seq_id:Tt.ofUndefined(r.length,ce.Schema.int),beg_auth_asym_id:o,beg_auth_comp_id:s,beg_auth_seq_id:Tt.ofStrings(r.map(u=>u.initSeqNum)),conf_type_id:Tt.ofStrings(r.map(u=>function vQe(e){return bQe[e]||"helx_p"}(u.helixClass))),details:Tt.ofStrings(r.map(u=>u.comment)),end_label_asym_id:a,end_label_comp_id:l,end_label_seq_id:Tt.ofUndefined(r.length,ce.Schema.int),end_auth_asym_id:a,end_auth_comp_id:l,end_auth_seq_id:Tt.ofStrings(r.map(u=>u.endSeqNum)),id:Tt.ofStrings(r.map(u=>u.serNum)),pdbx_beg_PDB_ins_code:Tt.ofStrings(r.map(u=>u.initICode)),pdbx_end_PDB_ins_code:Tt.ofStrings(r.map(u=>u.endICode)),pdbx_PDB_helix_class:Tt.ofStrings(r.map(u=>u.helixClass)),pdbx_PDB_helix_length:Tt.ofStrings(r.map(u=>u.length)),pdbx_PDB_helix_id:Tt.ofStrings(r.map(u=>u.helixID))};return ll.ofFields("struct_conf",c)}function _Qe(e,t,n){const r=[],i=f=>e.data.substring(e.indices[2*f],e.indices[2*f+1]);for(let f=t;ff.initChainID)),s=Tt.ofStrings(r.map(f=>f.initResName)),a=Tt.ofStrings(r.map(f=>f.initSeqNum)),l=Tt.ofStrings(r.map(f=>f.endChainID)),c=Tt.ofStrings(r.map(f=>f.endResName)),u=Tt.ofStrings(r.map(f=>f.endSeqNum)),d={beg_label_asym_id:o,beg_label_comp_id:s,beg_label_seq_id:a,beg_auth_asym_id:o,beg_auth_comp_id:s,beg_auth_seq_id:a,end_label_asym_id:l,end_label_comp_id:l,end_label_seq_id:u,end_auth_asym_id:l,end_auth_comp_id:c,end_auth_seq_id:u,id:Tt.ofStrings(r.map(f=>f.strand)),sheet_id:Tt.ofStrings(r.map(f=>f.sheetID)),pdbx_beg_PDB_ins_code:Tt.ofStrings(r.map(f=>f.initICode)),pdbx_end_PDB_ins_code:Tt.ofStrings(r.map(f=>f.endICode))};return ll.ofFields("struct_sheet_range",d)}const SQe={MOL_ID:"",MOLECULE:"",CHAIN:"",FRAGMENT:"",SYNONYM:"",EC:"",ENGINEERED:"",MUTATION:"",OTHER_DETAILS:""};function CQe(e,t,n){const r=l=>e.data.substring(e.indices[2*l],e.indices[2*l+1]);let i,o={chains:[],description:""};const s=[];for(let l=t;le.data.substring(e.indices[2*o],e.indices[2*o+1]),i=new Map;for(let o=t;o=66?ot.addToken(e.B_iso_or_equiv,kt.trim(n,r+60,r+66)):ot.add(e.B_iso_or_equiv,0,0),o&&ot.addToken(e.partial_charge,kt.trim(n,r+70,r+76)),a>=78&&!o?(kt.trim(n,r+76,r+78),n.tokenStart=78?(kt.trim(n,r+76,r+78),n.tokenStartot.create(e,2*t);return{index:0,group_PDB:r(),id:[],auth_atom_id:r(),label_alt_id:r(),auth_comp_id:r(),auth_asym_id:r(),auth_seq_id:r(),pdbx_PDB_ins_code:r(),Cartn_x:r(),Cartn_y:r(),Cartn_z:r(),occupancy:r(),B_iso_or_equiv:r(),type_symbol:r(),pdbx_PDB_model_num:[],label_entity_id:[],partial_charge:r()}}(n,s),u=function EQe(e,t){const r=()=>new Float32Array(t),i=()=>ot.create(e,2*t);return{index:0,count:t,id:[],type_symbol:i(),pdbx_label_atom_id:i(),pdbx_label_alt_id:i(),pdbx_label_comp_id:i(),pdbx_label_asym_id:i(),pdbx_label_seq_id:i(),pdbx_PDB_ins_code:i(),"U[1][1]":r(),"U[2][2]":r(),"U[3][3]":r(),"U[1][2]":r(),"U[1][3]":r(),"U[2][3]":r(),pdbx_auth_seq_id:i(),pdbx_auth_comp_id:i(),pdbx_auth_asym_id:i(),pdbx_auth_atom_id:i()}}(n,a),d=new Gh,f=[],p=[];let g,m=0,h="",y=!1;const v=new Set;for(let T=0,F=t.count;Te.data.substring(e.indices[2*M],e.indices[2*M+1]),s=[],a=[],l=[],c=[],u=[],d=[],f=[],p=[],m=[],h=[],g=[],y=[],v=[],x=[],_=[11,16,21,26];let w=1;for(let M=t;MN||void 0===T[N]&&(s.push(`covale${w}`),a.push("covale"),l.push(r.label_asym_id.str(D)),c.push(r.label_seq_id.int(D)),u.push(r.auth_seq_id.int(D)),d.push(r.label_atom_id.str(D)),f.push(r.label_alt_id.str(D)),p.push(r.pdbx_PDB_ins_code.str(D)),m.push(r.label_asym_id.str(N)),h.push(r.label_seq_id.int(N)),g.push(r.auth_seq_id.int(N)),y.push(r.label_atom_id.str(N)),v.push(r.label_alt_id.str(N)),x.push(r.pdbx_PDB_ins_code.str(N)),w+=1))}}const A={id:Tt.ofStrings(s),conn_type_id:Tt.ofStrings(a),ptnr1_label_asym_id:Tt.ofStrings(l),ptnr1_label_seq_id:Tt.ofNumbers(c),ptnr1_auth_seq_id:Tt.ofNumbers(u),ptnr1_label_atom_id:Tt.ofStrings(d),pdbx_ptnr1_label_alt_id:Tt.ofStrings(f),pdbx_ptnr1_PDB_ins_code:Tt.ofStrings(p),ptnr2_label_asym_id:Tt.ofStrings(m),ptnr2_label_seq_id:Tt.ofNumbers(h),ptnr2_auth_seq_id:Tt.ofNumbers(g),ptnr2_label_atom_id:Tt.ofStrings(y),pdbx_ptnr2_label_alt_id:Tt.ofStrings(v),pdbx_ptnr2_PDB_ins_code:Tt.ofStrings(x)};return ll.ofFields("struct_conn",A)}(t,g[0],g[1],E));const D={entity:ll.ofTable("entity",d.getEntityTable()),chem_comp:ll.ofTable("chem_comp",M.getChemCompTable()),atom_site:ll.ofFields("atom_site",E),atom_site_anisotrop:ll.ofFields("atom_site_anisotrop",TQe(u))};for(const T of f)D[T.name]=T;return{header:e.id||"PDB",categoryNames:Object.keys(D),categories:D}}),uH.apply(this,arguments)}var tA,dH,fH;function OQe(e){return Object.keys(e).filter(t=>!isNaN(t)).map(t=>+t).sort((t,n)=>t-n).map(t=>e[t])}function pH(e,t,n){return e&&void 0!==e[t]?e[t]:n}function bt(e,...t){return{kind:"alias",aliases:t,symbol:e}}function RN(e,t,...n){return e.info.namespace="molscript-macro",e.id=`molscript-macro.${e.info.name}`,{kind:"macro",symbol:e,translate:t,aliases:[e.info.name,...n]}}function BQe(e){return"alias"===e.kind||"macro"===e.kind}!function(e){e.Descriptor={name:"atom_partial_charge"},e.Provider=jh.create(e.Descriptor)}(tA||(tA={})),function(e){e.is=function t(r){return"pdb"===r?.kind},e.create=function n(r){return{kind:"pdb",name:r.id||"",data:r}}}(dH||(dH={})),function(e){e.is=function t(r){return"psf"===r?.kind},e.fromPsf=function n(r){return{kind:"psf",name:r.id,data:r}}}(fH||(fH={}));const LQe=[["Core symbols",bt(Ee.core.type.bool,"bool"),bt(Ee.core.type.num,"num"),bt(Ee.core.type.str,"str"),bt(Ee.core.type.regex,"regex"),bt(Ee.core.type.list,"list"),bt(Ee.core.type.set,"set"),bt(Ee.core.type.compositeKey,"composite-key"),bt(Ee.core.logic.not,"not"),bt(Ee.core.logic.and,"and"),bt(Ee.core.logic.or,"or"),bt(Ee.core.ctrl.if,"if"),bt(Ee.core.ctrl.fn,"fn"),bt(Ee.core.ctrl.eval,"eval"),bt(Ee.core.math.add,"add","+"),bt(Ee.core.math.sub,"sub","-"),bt(Ee.core.math.mult,"mult","*"),bt(Ee.core.math.div,"div","/"),bt(Ee.core.math.pow,"pow","**"),bt(Ee.core.math.mod,"mod"),bt(Ee.core.math.min,"min"),bt(Ee.core.math.max,"max"),bt(Ee.core.math.cantorPairing,"cantor-pairing"),bt(Ee.core.math.sortedCantorPairing,"sorted-cantor-pairing"),bt(Ee.core.math.invertCantorPairing,"invert-cantor-pairing"),bt(Ee.core.math.floor,"floor"),bt(Ee.core.math.ceil,"ceil"),bt(Ee.core.math.roundInt,"round"),bt(Ee.core.math.trunc,"trunc"),bt(Ee.core.math.abs,"abs"),bt(Ee.core.math.sign,"sign"),bt(Ee.core.math.sqrt,"sqrt"),bt(Ee.core.math.cbrt,"cbrt"),bt(Ee.core.math.sin,"sin"),bt(Ee.core.math.cos,"cos"),bt(Ee.core.math.tan,"tan"),bt(Ee.core.math.asin,"asin"),bt(Ee.core.math.acos,"acos"),bt(Ee.core.math.atan,"atan"),bt(Ee.core.math.sinh,"sinh"),bt(Ee.core.math.cosh,"cosh"),bt(Ee.core.math.tanh,"tanh"),bt(Ee.core.math.exp,"exp"),bt(Ee.core.math.log,"log"),bt(Ee.core.math.log10,"log10"),bt(Ee.core.math.atan2,"atan2"),bt(Ee.core.rel.eq,"eq","="),bt(Ee.core.rel.neq,"neq","!="),bt(Ee.core.rel.lt,"lt","<"),bt(Ee.core.rel.lte,"lte","<="),bt(Ee.core.rel.gr,"gr",">"),bt(Ee.core.rel.gre,"gre",">="),bt(Ee.core.rel.inRange,"in-range"),bt(Ee.core.str.concat,"concat"),bt(Ee.core.str.match,"regex.match"),bt(Ee.core.list.getAt,"list.get"),bt(Ee.core.set.has,"set.has"),bt(Ee.core.set.isSubset,"set.subset")],["Structure",["Types",bt(Ee.structureQuery.type.entityType,"ent-type"),bt(Ee.structureQuery.type.authResidueId,"auth-resid"),bt(Ee.structureQuery.type.labelResidueId,"label-resid"),bt(Ee.structureQuery.type.ringFingerprint,"ringfp"),bt(Ee.structureQuery.type.bondFlags,"bond-flags")],["Slots",bt(Ee.structureQuery.slot.elementSetReduce,"atom.set.reduce.value")],["Generators",bt(Ee.structureQuery.generator.atomGroups,"sel.atom.atom-groups"),bt(Ee.structureQuery.generator.queryInSelection,"sel.atom.query-in-selection"),bt(Ee.structureQuery.generator.rings,"sel.atom.rings"),bt(Ee.structureQuery.generator.empty,"sel.atom.empty"),bt(Ee.structureQuery.generator.all,"sel.atom.all"),bt(Ee.structureQuery.generator.bondedAtomicPairs,"sel.atom.bonded-pairs"),RN(C3("sel.atom.atoms",dn.Dictionary({0:wt(Oe.Bool,{isOptional:!0,defaultValue:!0,description:"Test applied to each atom."})}),$t.ElementSelection,"A selection of singleton atom sets."),e=>pe.struct.generator.atomGroups({"atom-test":pH(e,0,!0)})),RN(C3("sel.atom.res",dn.Dictionary({0:wt(Oe.Bool,{isOptional:!0,defaultValue:!0,description:"Test applied to the 1st atom of each residue."})}),$t.ElementSelection,"A selection of atom sets grouped by residue."),e=>pe.struct.generator.atomGroups({"residue-test":pH(e,0,!0),"group-by":pe.ammp("residueKey")})),RN(C3("sel.atom.chains",dn.Dictionary({0:wt(Oe.Bool,{isOptional:!0,defaultValue:!0,description:"Test applied to the 1st atom of each chain."})}),$t.ElementSelection,"A selection of atom sets grouped by chain."),e=>pe.struct.generator.atomGroups({"chain-test":pH(e,0,!0),"group-by":pe.ammp("chainKey")}))],["Modifiers",bt(Ee.structureQuery.modifier.queryEach,"sel.atom.query-each"),bt(Ee.structureQuery.modifier.intersectBy,"sel.atom.intersect-by"),bt(Ee.structureQuery.modifier.exceptBy,"sel.atom.except-by"),bt(Ee.structureQuery.modifier.unionBy,"sel.atom.union-by"),bt(Ee.structureQuery.modifier.union,"sel.atom.union"),bt(Ee.structureQuery.modifier.cluster,"sel.atom.cluster"),bt(Ee.structureQuery.modifier.includeSurroundings,"sel.atom.include-surroundings"),bt(Ee.structureQuery.modifier.surroundingLigands,"sel.atom.surrounding-ligands"),bt(Ee.structureQuery.modifier.includeConnected,"sel.atom.include-connected"),bt(Ee.structureQuery.modifier.expandProperty,"sel.atom.expand-property")],["Filters",bt(Ee.structureQuery.filter.pick,"sel.atom.pick"),bt(Ee.structureQuery.filter.first,"sel.atom.first"),bt(Ee.structureQuery.filter.withSameAtomProperties,"sel.atom.with-same-atom-properties"),bt(Ee.structureQuery.filter.intersectedBy,"sel.atom.intersected-by"),bt(Ee.structureQuery.filter.within,"sel.atom.within"),bt(Ee.structureQuery.filter.isConnectedTo,"sel.atom.is-connected-to")],["Combinators",bt(Ee.structureQuery.combinator.intersect,"sel.atom.intersect"),bt(Ee.structureQuery.combinator.merge,"sel.atom.merge"),bt(Ee.structureQuery.combinator.distanceCluster,"sel.atom.dist-cluster")],["Atom Set Properties",bt(Ee.structureQuery.atomSet.atomCount,"atom.set.atom-count"),bt(Ee.structureQuery.atomSet.countQuery,"atom.set.count-query"),bt(Ee.structureQuery.atomSet.reduce,"atom.set.reduce"),bt(Ee.structureQuery.atomSet.propertySet,"atom.set.property")],["Atom Properties",bt(Ee.structureQuery.atomProperty.core.elementSymbol,"atom.el"),bt(Ee.structureQuery.atomProperty.core.vdw,"atom.vdw"),bt(Ee.structureQuery.atomProperty.core.mass,"atom.mass"),bt(Ee.structureQuery.atomProperty.core.atomicNumber,"atom.atomic-number"),bt(Ee.structureQuery.atomProperty.core.x,"atom.x"),bt(Ee.structureQuery.atomProperty.core.y,"atom.y"),bt(Ee.structureQuery.atomProperty.core.z,"atom.z"),bt(Ee.structureQuery.atomProperty.core.sourceIndex,"atom.src-index"),bt(Ee.structureQuery.atomProperty.core.operatorName,"atom.op-name"),bt(Ee.structureQuery.atomProperty.core.operatorKey,"atom.op-key"),bt(Ee.structureQuery.atomProperty.core.modelIndex,"atom.model-index"),bt(Ee.structureQuery.atomProperty.core.modelLabel,"atom.model-label"),bt(Ee.structureQuery.atomProperty.core.atomKey,"atom.key"),bt(Ee.structureQuery.atomProperty.core.bondCount,"atom.bond-count"),bt(Ee.structureQuery.atomProperty.topology.connectedComponentKey,"atom.key.molecule"),bt(Ee.structureQuery.atomProperty.macromolecular.authResidueId,"atom.auth-resid"),bt(Ee.structureQuery.atomProperty.macromolecular.labelResidueId,"atom.label-resid"),bt(Ee.structureQuery.atomProperty.macromolecular.residueKey,"atom.key.res"),bt(Ee.structureQuery.atomProperty.macromolecular.chainKey,"atom.key.chain"),bt(Ee.structureQuery.atomProperty.macromolecular.entityKey,"atom.key.entity"),bt(Ee.structureQuery.atomProperty.macromolecular.isHet,"atom.is-het"),bt(Ee.structureQuery.atomProperty.macromolecular.id,"atom.id"),bt(Ee.structureQuery.atomProperty.macromolecular.label_atom_id,"atom.label_atom_id"),bt(Ee.structureQuery.atomProperty.macromolecular.label_alt_id,"atom.label_alt_id","atom.altloc"),bt(Ee.structureQuery.atomProperty.macromolecular.label_comp_id,"atom.label_comp_id"),bt(Ee.structureQuery.atomProperty.macromolecular.label_asym_id,"atom.label_asym_id"),bt(Ee.structureQuery.atomProperty.macromolecular.label_entity_id,"atom.label_entity_id"),bt(Ee.structureQuery.atomProperty.macromolecular.label_seq_id,"atom.label_seq_id"),bt(Ee.structureQuery.atomProperty.macromolecular.auth_atom_id,"atom.auth_atom_id","atom.name"),bt(Ee.structureQuery.atomProperty.macromolecular.auth_comp_id,"atom.auth_comp_id","atom.resname"),bt(Ee.structureQuery.atomProperty.macromolecular.auth_asym_id,"atom.auth_asym_id","atom.chain"),bt(Ee.structureQuery.atomProperty.macromolecular.auth_seq_id,"atom.auth_seq_id","atom.resno"),bt(Ee.structureQuery.atomProperty.macromolecular.pdbx_PDB_ins_code,"atom.pdbx_PDB_ins_code","atom.inscode"),bt(Ee.structureQuery.atomProperty.macromolecular.pdbx_formal_charge,"atom.pdbx_formal_charge"),bt(Ee.structureQuery.atomProperty.macromolecular.occupancy,"atom.occupancy"),bt(Ee.structureQuery.atomProperty.macromolecular.B_iso_or_equiv,"atom.B_iso_or_equiv","atom.bfactor"),bt(Ee.structureQuery.atomProperty.macromolecular.entityType,"atom.entity-type"),bt(Ee.structureQuery.atomProperty.macromolecular.entitySubtype,"atom.entity-subtype"),bt(Ee.structureQuery.atomProperty.macromolecular.entityPrdId,"atom.entity-prd-id"),bt(Ee.structureQuery.atomProperty.macromolecular.entityDescription,"atom.entity-description"),bt(Ee.structureQuery.atomProperty.macromolecular.objectPrimitive,"atom.object-primitive"),bt(Ee.structureQuery.atomProperty.macromolecular.chemCompType,"atom.chem-comp-type"),bt(Ee.structureQuery.atomProperty.macromolecular.secondaryStructureKey,"atom.key.sec-struct"),bt(Ee.structureQuery.atomProperty.macromolecular.isModified,"atom.is-modified"),bt(Ee.structureQuery.atomProperty.macromolecular.modifiedParentName,"atom.modified-parent")],["Bond Properties",bt(Ee.structureQuery.bondProperty.order,"bond.order"),bt(Ee.structureQuery.bondProperty.length,"bond.length"),bt(Ee.structureQuery.bondProperty.key,"bond.key"),bt(Ee.structureQuery.bondProperty.atomA,"bond.atom-a"),bt(Ee.structureQuery.bondProperty.atomB,"bond.atom-b"),RN(C3("bond.is",dn.List($t.BondFlag),Oe.Bool,`Test if the current bond has at least one (or all if partial = false) of the specified flags: ${Oe.oneOfValues($t.BondFlag).join(", ")}`),e=>pe.core.flags.hasAny([pe.struct.bondProperty.flags(),pe.struct.type.bondFlags(OQe(e))]))]]],Ife=[];!function Efe(e){for(const t of e)BQe(t)?Ife.push(t):t instanceof Array&&Efe(t)}(LQe);const NN=function(){const e=[],t=Object.create(null),n=Ti.create(),r=Ti.create();for(const i of Ife){for(const s of i.aliases){if(e.push([s,i]),t[s])throw new Error(`Alias '${s}' already in use.`);t[s]=i}const o=i.symbol.args;if("dictionary"===o.kind)for(const s of Object.keys(o.map)){isNaN(s)&&Ti.add(n,s,s);const a=o.map[s];"oneof"===a.type.kind&&Oe.oneOfValues(a.type).forEach(l=>Ti.add(r,l,l))}else"oneof"===o.type.kind&&Oe.oneOfValues(o.type).forEach(s=>Ti.add(r,s,s))}return{symbolList:e,symbolMap:t,namedArgs:n.array,constants:r.array}}(),nA=NN.symbolMap;function UD(e){if(cl.isLiteral(e))return e;if(cl.isSymbol(e)){if(!nA[e.name])return e;const s=nA[e.name];if("alias"===s.kind)return cl.Symbol(nA[e.name].symbol.id);throw s.translate([])}const t=cl.isSymbol(e.head)&&!!nA[e.head.name]&&"macro"===nA[e.head.name].kind,n=t?e.head:UD(e.head),r=n!==e.head;if(!e.args)return t?UD(e.head):r?cl.Apply(n):e;let o,i=!1;if(cl.isArgumentsArray(e.args)){o=[];for(let s=0,a=e.args.length;s12?"...'":"'";return` at line ${n.line} column ${n.column}, got ${r>0?"'...":"'"}${e.slice(r,r+12)}${o}`}(e,t)}`}(t,n);throw new Error(r)}}or(t){return Ye.alt(this,t)}trim(t){return this.wrap(t,t)}wrap(t,n){return hH(1,"string"==typeof t?Ye.string(t):t,this,"string"==typeof n?Ye.string(n):n)}thru(t){return t(this)}then(t){return hH(1,this,t)}many(){return new Ye((t,n)=>{const r=[];let i;for(;;){if(i=Np(this._(t,n),i),!i.status)return Np(ou(n,r),i);if(n===i.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");n=i.index,r.push(i.value)}})}times(t,n){const r=typeof n>"u"?t:n;return new Ye((i,o)=>{const s=[];let a,l,c;for(c=0;ct)}atMost(t){return this.times(0,t)}atLeast(t){return Ye.seq(this.times(t),this.many()).map(n=>[...n[0],...n[1]])}map(t){return new Ye((n,r)=>{const i=this._(n,r);return i.status?Np(ou(i.index,t(i.value)),i):i})}skip(t){return hH(0,this,t)}mark(){return Ye.seq(Ye.index,this,Ye.index).map(t=>({start:t[0],value:t[1],end:t[2]}))}node(t){return Ye.seq(Ye.index,this,Ye.index).map(n=>({name:t,start:n[0],value:n[1],end:n[2]}))}sepBy(t){return Ye.sepBy(this,t)}sepBy1(t){return Ye.sepBy1(this,t)}lookahead(t){return this.skip(Ye.lookahead(t))}notFollowedBy(t){return this.skip(Ye.notFollowedBy(t))}desc(t){return new Ye((n,r)=>{const i=this._(n,r);return i.status||(i.expected=[t]),i})}fallback(t){return this.or(Ye.succeed(t))}ap(t){return Ye.seq(t,this).map(([n,r])=>n(r))}chain(t){return new Ye((n,r)=>{const i=this._(n,r);return i.status?Np(t(i.value)._(n,i.index),i):i})}}function hH(e,...t){const n=t.length;return new Ye((r,i)=>{let o,s,a=i;for(let l=0;lt.furthest)return e;const n=e.furthest===t.furthest?function HQe(e,t){const n=e.length,r=t.length;if(0===n)return t;if(0===r)return e;const i=new Set,o=[];for(let s=0;s{let R;const N=new Array(D);let j=F;for(let W=0;W{let R;for(let N=0;N[F[0],...F[1]])}function a(E){const D=`'${E}'`;if(1===E.length){const T=E.charCodeAt(0);return new e((F,R)=>F.charCodeAt(R)===T?ou(R+1,E):Ny(R,D))}return new e((T,F)=>{const R=F+E.length;return T.slice(F,R)===E?ou(R,E):Ny(F,D)})}function u(E,D=0){const T=function c(E){return RegExp("^(?:"+E.source+")",function l(E){const D=""+E;return D.slice(D.lastIndexOf("/")+1)}(E))}(E),F=""+E;return new e((R,N)=>{const j=T.exec(R.slice(N));return j?0<=D&&D<=j.length?ou(N+j[0].length,j[D]):Ny(N,`invalid match group (0 to ${j.length}) in ${F}`):Ny(N,F)})}function d(E){return new e((D,T)=>ou(T,E))}function f(E){return new e((D,T)=>Ny(T,E))}function h(E){return new e((D,T)=>{const F=D.charAt(T);return T{const R=E()._;return D._=R,R(T,F)});return D}e.seqMap=function t(E,D,T){const F=[].slice.call(arguments);if(0===F.length)throw new Error("seqMap needs at least one argument");const R=F.pop();return function qQe(e){if("function"!=typeof e)throw new Error("not a function: "+e)}(R),r.apply(null,F).map(function(N){return R.apply(null,N)})},e.createLanguage=function n(E){const D={};for(const T of Object.keys(E))!function(F){D[F]=_(()=>E[F](D))}(T);return D},e.seq=r,e.alt=i,e.sepBy=function o(E,D){return s(E,D).or(d([]))},e.sepBy1=s,e.string=a,e.regexp=u,e.succeed=d,e.fail=f,e.lookahead=function p(E){if(function GQe(e){return e instanceof Ye}(E))return new e((D,T)=>{const F=E._(D,T);return F.status&&(F.index=T,F.value=null),F});if("string"==typeof E)return p(a(E));if(E instanceof RegExp)return p(u(E));throw new Error("not a string, regexp, or parser: "+E)},e.notFollowedBy=function m(E){return new e((D,T)=>{const F=E._(D,T);return F.status?Ny(T,'not "'+D.slice(T,F.index)+'"'):ou(T,null)})},e.test=h,e.oneOf=function g(E){return h(D=>E.indexOf(D)>=0)},e.noneOf=function y(E){return h(D=>E.indexOf(D)<0)},e.range=function v(E,D){return h(T=>E<=T&&T<=D).desc(E+"-"+D)},e.takeWhile=function x(E){return new e((D,T)=>{let F=T;for(;FD>=E.length?Ny(D,"any character"):ou(D+1,E.charAt(D))),e.all=new e(function(E,D){return ou(E.length,E.slice(D))}),e.eof=new e(function(E,D){return DYe.alt(i,d,o,s).trim(n)),i=Ye.takeWhile(_=>"`"!==_).trim("`").map(t.str),o=Ye.regexp(/[^()\[\]{};`,\n\r\s]+/).map(t.symb),s=Ye.regexp(/\s*;+([^\n\r]*)\n/,1).map(t.comment),a=r.many(),l=a.wrap("(",")").map(_=>t.list("(",_)),c=a.wrap("[","]").map(_=>t.list("[",_)),u=a.wrap("{","}").map(_=>t.list("{",_)),d=Ye.alt(l,c,u),f=r.many();function m(_){switch(_.kind){case"string":return _.value;case"symbol":{const w=_.value;if(w.length>1)switch(w.charAt(0)){case".":return pe.atomName(w.substr(1));case"_":return pe.struct.type.elementSymbol([w.substr(1)])}return"true"===w||"false"!==w&&(function v(_){return/-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?/.test(_)&&!isNaN(+_)}(w)?+w:cl.Symbol(w))}case"list":switch(_.bracket){case"[":return pe.core.type.list(y(_.nodes).map(m));case"{":return pe.core.type.set(y(_.nodes).map(m));case"(":{if("comment"===_.nodes[0].kind)throw new Error("Invalid expression");const w=m(_.nodes[0]);return cl.Apply(w,function h(_){if(_.length<=1)return;if(!function g(_){for(let w=1,A=_.length;w1&&":"===M.value.charAt(0))return!0}return!1}(_)){const E=[];for(let D=1,T=_.length;D1&&":"===T.value.charAt(0)){const F=T.value.substr(1);for(++E;E=D)throw new Error(`There must be a value foolowed a named arg ':${F}'.`);if("comment"===_[E].kind)throw new Error("Invalid expression");w[F]=m(_[E]),isNaN(+F)&&(A=!1)}else w[M++]=m(T)}if(A){const E=Object.keys(w).map(T=>+T).sort((T,F)=>T-F);let D=!0;for(let T=0,F=E.length;T"comment"!==A.kind):_}e.parse=function x(_){const w=function p(_){return f.tryParse(_)}(_),A=[];for(const M of w)"comment"!==M.kind&&(A[A.length]=m(M));return A}}(mH||(mH={}));const lo=pe;function su(e,t,n){const r=Ye.lazy(()=>Ye.seq(e,r).map(i=>n(...i)).or(t));return r}function FN(e,t,n){return Ye.seqMap(t,e.many(),(r,i)=>i.reduce((o,s)=>n(s,o),r))}function $u(e,t,n){return Ye.seqMap(t,Ye.seq(e,t).many(),(r,i)=>i.reduce((o,s)=>{const[a,l]=s;return n(a,o,l)},r))}function zD(e,t){return e.reduce((r,i)=>{const o=i.isUnsupported?q1(`operator '${i.name}' not supported`):i.map;return i.type(i.rule,r,o)},t)}function Fy(e,t=0){return Ye.optWhitespace.then(Ye.regexp(e,t).skip(Ye.optWhitespace))}function Pf(e,t=0){return Ye.regexp(e,t).skip(Ye.optWhitespace)}function ON(e,t=0){return Ye.optWhitespace.then(Ye.regexp(e,t))}function gH(e,t){const n=t?`${e}|${w3(t)}`:e;return Fy(RegExp(`(${n})\\s+([-+]?[0-9]*\\.?[0-9]+)\\s+OF`,"i"),2).map(parseFloat)}function q1(e){return function(){throw new Error(e)}}function yH(e){return 1===e.length?e[0]:e.length>1?lo.core.logic.and(e):void 0}function bH(e,t){if(!t||void 0===t.op||void 0===t.val)return t&&void 0!==t.flags?lo.core.flags.hasAny([e,t.flags]):t&&void 0!==t.min&&void 0!==t.max?lo.core.rel.inRange([e,t.min,t.max]):Array.isArray(t)?t.length>1?lo.core.set.has([lo.core.type.set(t),e]):lo.core.rel.eq([e,t[0]]):lo.core.rel.eq([e,t]);{const n=[e,t.val];switch(t.op){case"=":return lo.core.rel.eq(n);case"!=":return lo.core.rel.neq(n);case">":return lo.core.rel.gr(n);case"<":return lo.core.rel.lt(n);case">=":return lo.core.rel.gre(n);case"<=":return lo.core.rel.lte(n);default:throw new Error(`operator '${t.op}' not supported`)}}}function kf(e){return lo.struct.generator.queryInSelection({0:e,query:lo.struct.generator.all(),"in-complement":!0})}function _g(e,t){return e.length{const r=e[n],i=q1(`property '${n}' not supported`),o=Ye.regexp(r.regex).map(l=>(r.isUnsupported&&i(),bH(r.property,r.map(l)))),s=Ye.regexp(vH(n,r.abbr)).trim(Ye.optWhitespace),a=l=>lo.struct.generator.atomGroups({[r.level]:l});t.push(r.isNumeric?s.then(Ye.seq(Ye.regexp(/>=|<=|=|!=|>|(r.isUnsupported&&i(),bH(r.property,{op:l[0],val:l[1]}))).map(a):s.then(o).map(a))}),t}function xH(e){const t=[];return Object.keys(e).sort(_g).forEach(n=>{const r=e[n],i=r.map?r.map:q1(`keyword '${n}' not supported`),o=Ye.regexp(vH(n,r.abbr)).map(i);t.push(o)}),t}function _H(e,t){const n=[];return Object.keys(e).sort(_g).forEach(r=>{const i=e[r],o=q1(`property '${r}' not supported`),s=Ye.regexp(vH(r,i.abbr)).lookahead(t).map(()=>(i.isUnsupported&&o(),i.property));n.push(s)}),n}function SH(e,t,n,r){const i=[];for(const o in e)i.push(o),e[o].abbr&&i.push(...e[o].abbr);for(const o in t)i.push(o),t[o].abbr&&i.push(...t[o].abbr);return n.forEach(o=>{i.push(o.name),o.abbr&&i.push(...o.abbr)}),i}function Sg(e){return lo.core.type.set(e.map(lo.atomName))}function Cg(e){return lo.struct.generator.queryInSelection({0:e,query:lo.struct.generator.all()})}function VD(e,t,n){switch(e.head.name){case"structure-query.atom-property.macromolecular.label_atom_id":return lo.atomName(t);case"structure-query.atom-property.core.element-symbol":return lo.es(t);case"structure-query.atom-property.macromolecular.secondary-structure-flags":return n&&(t=[n[t.toUpperCase()]||"none"]),lo.struct.type.secondaryStructureFlags([t]);default:return t}}const KQe=["entityKey","label_entity_id","entityType"],ZQe=["chainKey","label_asym_id","label_entity_id","auth_asym_id","entityType"],QQe=["residueKey","label_comp_id","label_seq_id","auth_comp_id","auth_seq_id","pdbx_formal_charge","secondaryStructureKey","secondaryStructureFlags","isModified","modifiedParentName"];function JQe(e){if(e.head.name.startsWith("structure-query.atom-property.macromolecular.")){const t=e.head.name.substr(45);if(KQe.includes(t))return"entity-test";if(ZQe.includes(t))return"chain-test";if(QQe.includes(t))return"residue-test"}return"atom-test"}const eJe=["structure-query.atom-property.macromolecular.secondary-structure-flags"];function ri(e){return lo.struct.generator.atomGroups({"residue-test":lo.core.set.has([lo.core.type.set(e),lo.ammp("label_comp_id")])})}const da=pe,Fp=/[-+]?[0-9]*\.?[0-9]+/,HD=/[0-9]+/;function Dn(e){return e}const nJe={none:"none",turn:"turn",sheet:"beta",helix:"helix",dna:"dna",rna:"rna",carbohydrate:"carbohydrate",helix310:"3-10",helixalpha:"alpha",helixpi:"pi",0:"none",1:"turn",2:"beta",3:"helix",4:"dna",5:"rna",6:"carbohydrate",7:"3-10",8:"alpha",9:"pi"};function kfe(e){if(e.head){if(e.head.name&&"core.type.regex"===e.head.name&&(e=e.args[0].replace(/^\^|\$$/g,"")),e=nJe[e.toString().toLowerCase()]||"none",-1!==["dna","rna","carbohydrate"].indexOf(e))throw new Error("values 'dna', 'rna', 'carbohydrate' not yet supported for 'structure' property");return da.struct.type.secondaryStructureFlags([e])}}const Mfe={adpmax:{"@desc":"the maximum anisotropic displacement parameter for the selected atom","@examples":[""],isUnsupported:!0,regex:Fp,map:e=>parseFloat(e),level:"atom-test"},adpmin:{"@desc":"the minimum anisotropic displacement parameter for the selected atom","@examples":[""],isUnsupported:!0,regex:Fp,map:e=>parseFloat(e),level:"atom-test"},altloc:{"@desc":"PDB alternate location identifier","@examples":["altloc = A"],regex:/[a-zA-Z0-9]/,map:Dn,level:"atom-test",property:da.ammp("label_alt_id")},altname:{"@desc":"an alternative name given to atoms by some file readers (for example, P2N)","@examples":[""],isUnsupported:!0,regex:/[a-zA-Z0-9]/,map:Dn,level:"atom-test"},atomID:{"@desc":"special atom IDs for PDB atoms assigned by Jmol","@examples":[""],isUnsupported:!0,regex:HD,map:e=>parseInt(e),level:"atom-test"},atomIndex:{"@desc":"atom 0-based index; a unique number for each atom regardless of the number of models loaded","@examples":[""],isUnsupported:!0,regex:HD,map:e=>parseInt(e),level:"atom-test"},atomName:{"@desc":"atom name","@examples":["atomName = CA"],regex:/[a-zA-Z0-9]+/,map:e=>da.atomName(e),level:"atom-test",property:da.ammp("label_atom_id")},atomno:{"@desc":'sequential number; you can use "@" instead of "atomno=" -- for example, select @33 or Var x = @33 or @35',"@examples":[""],isUnsupported:!0,regex:HD,map:e=>parseInt(e),level:"atom-test"},atomType:{"@desc":"atom type (mol2, AMBER files) or atom name (other file types)","@examples":["atomType = OH"],regex:/[a-zA-Z0-9]+/,map:e=>da.atomName(e),level:"atom-test",property:da.ammp("label_atom_id")},atomX:{"@desc":"Cartesian X coordinate (or just X)","@examples":["x = 4.2"],abbr:["X"],isNumeric:!0,regex:Fp,map:e=>parseFloat(e),level:"atom-test",property:da.acp("x")},atomY:{"@desc":"Cartesian Y coordinate (or just Y)","@examples":["y < 42"],abbr:["Y"],isNumeric:!0,regex:Fp,map:e=>parseFloat(e),level:"atom-test",property:da.acp("y")},atomZ:{"@desc":"Cartesian Z coordinate (or just Z)","@examples":["Z > 10"],abbr:["Z"],isNumeric:!0,regex:Fp,map:e=>parseFloat(e),level:"atom-test",property:da.acp("z")},bondcount:{"@desc":"covalent bond count","@examples":["bondcount = 0"],isNumeric:!0,regex:HD,map:e=>parseInt(e),level:"atom-test",property:da.acp("bondCount")},bondingRadius:{"@desc":"radius used for auto bonding; synonymous with ionic and ionicRadius","@examples":[""],abbr:["ionic","ionicRadius"],isUnsupported:!0,regex:Fp,map:e=>parseFloat(e),level:"atom-test"},cell:{"@desc":'crystallographic unit cell, expressed either in lattice integer notation (111-999) or as a coordinate in ijk space, where {1 1 1} is the same as 555. ANDing two cells, for example select cell=555 and cell=556, selects the atoms on the common face. (Note: in the specifc case of CELL, only "=" is allowed as a comparator.)',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},configuration:{"@desc":'Only in the context {configuration=n}, this option selects the set of atoms with either no ALTLOC specified or those atoms having this index into the array of altlocs within its model. So, for example, if the model has altloc "A" and "B", select configuration=1 is equivalent to select altloc="" or altloc="A", and print {configuration=2} is equivalent to print {altloc="" or altloc="B"}. Configuration 0 is "all atoms in a model having configurations", and an invalid configuration number gives no atoms. (Note: in the specifc case of CONFIGURATION, only "=" is allowed as a comparator.)',"@examples":[""],isUnsupported:!0,regex:HD,map:e=>parseInt(e),level:"atom-test"},chain:{"@desc":'protein chain. For newer CIF files allowing multicharacter chain specifications, use quotations marks: select chain="AA". For these multicharacter desigations, case is not checked unless the CIF file has lower-case chain designations.',"@examples":["chain = A",'chain = "AA"'],regex:/[a-zA-Z0-9]+/,map:Dn,level:"chain-test",property:da.ammp("auth_asym_id")},chainNo:{"@desc":'chain number; sequentially counted from 1 for each model; chainNo == 0 means"no chain" or PDB chain identifier indicated as a blank (Jmol 14.0).',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},color:{"@desc":"the atom color","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},covalentRadius:{"@desc":"covalent bonding radius, synonymous with covalent. Not used by Jmol, but could be used, for example, in {*}.spacefill={*}.covalentRadius.all.","@examples":[""],abbr:["covalent"],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},cs:{"@desc":"chemical shift calculated using computational results that include magnetic shielding tensors.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},element:{"@desc":'element symbol. The value of this parameter depends upon the context. Used with select structure=x, x can be either the quoted element symbol, "H", "He", "Li", etc. or atomic number. In all other contexts, the value is the element symbol. When the atom is a specific isotope, the string will contain the isotope number -- "13C", for example.',"@examples":["element=Fe"],regex:/[a-zA-Z]+/,map:e=>da.es(e),level:"atom-test",property:da.acp("elementSymbol")},elemno:{"@desc":"atomic element number","@examples":["elemno=8"],regex:/[0-9\s{}-]+/,map:e=>parseInt(e),level:"atom-test",property:da.acp("atomicNumber")},eta:{"@desc":"Based on Carlos M. Duarte, Leven M. Wadley, and Anna Marie Pyle, RNA structure comparison, motif search and discovery using a reduced representation of RNA conformational space, Nucleic Acids Research, 2003, Vol. 31, No. 16 4755-4761. The parameter eta is the C4'[i-1]-P[i]-C4'[i]-P[i+1] dihedral angle; theta is the P[i]-C4'[i]-P[i+1]-C4'[i+1] dihedral angle. Both are measured on a 0-360 degree scale because they are commonly near 180 degrees. Using the commands plot PROPERTIES eta theta resno; select visible;wireframe only one can create these authors' \"RNA worm\" graph.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},theta:{"@desc":"Based on Carlos M. Duarte, Leven M. Wadley, and Anna Marie Pyle, RNA structure comparison, motif search and discovery using a reduced representation of RNA conformational space, Nucleic Acids Research, 2003, Vol. 31, No. 16 4755-4761. The parameter eta is the C4'[i-1]-P[i]-C4'[i]-P[i+1] dihedral angle; theta is the P[i]-C4'[i]-P[i+1]-C4'[i+1] dihedral angle. Both are measured on a 0-360 degree scale because they are commonly near 180 degrees. Using the commands plot PROPERTIES eta theta resno; select visible;wireframe only one can create these authors' \"RNA worm\" graph.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},file:{"@desc":"file number containing this atom","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},formalCharge:{"@desc":"formal charge","@examples":["formalCharge=1"],regex:Fp,map:e=>parseFloat(e),level:"atom-test",property:da.ammp("pdbx_formal_charge")},format:{"@desc":"format (label) of the atom.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},fXyz:{"@desc":"fractional XYZ coordinates","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},fX:{"@desc":"fractional X coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},fY:{"@desc":"fractional Y coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},fZ:{"@desc":"fractional Z coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},fuxyz:{"@desc":"fractional XYZ coordinates in the unitcell coordinate system","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},fux:{"@desc":"fractional X coordinate in the unitcell coordinate system","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},fuy:{"@desc":"fractional Y coordinate in the unitcell coordinate system","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},fuz:{"@desc":"fractional Z coordinate in the unit cell coordinate system","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},group:{"@desc":"3-letter residue code","@examples":["group = ALA"],regex:/[a-zA-Z0-9]{1,3}/,map:Dn,level:"residue-test",property:da.ammp("label_comp_id")},group1:{"@desc":"single-letter residue code (amino acids only)","@examples":["group1 = G"],regex:/[a-zA-Z]/,map:Dn,level:"residue-test",property:da.ammp("label_comp_id")},groupID:{"@desc":"group ID number: A unique ID for each amino acid or nucleic acid residue in a PDB file. 0 noGroup 1-5 ALA, ARG, ASN, ASP, CYS 6-10 GLN, GLU, GLY, HIS, ILE 11-15 LEU, LYS, MET, PHE, PRO 16-20 SER, THR, TRP, TYR, VAL 21-23 ASX, GLX, UNK 24-29 A, +A, G, +G, I, +I 30-35 C, +C, T, +T, U, +U Additional unique numbers are assigned arbitrarily by Jmol and cannot be used reproducibly.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},groupindex:{"@desc":"overall group index","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},hydrophobicity:{"@desc":"Aminoacid residue scale of hydrophobicity based on Rose, G. D., Geselowitz, A. R., Lesser, G. J., Lee, R. H., and Zehfus, M. H. (1985). Hydrophobicity of amino acid residues in globular proteins, Science, 229(4716):834-838.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},identify:{"@desc":"for a PDB/mmCIF file, a label such as [ILE]7^1:A.CD1%A/3 #47, which includes the group ([ILE]), residue number with optional insertion code (7^1), chain (:A), atom name (CD1), alternate location if present (%A), PDB model number (/3, for NMR models when one file is loaded; /file.model such as /2.3 if more than one file is loaded), and atom number (#47). For non-PDB data, the information is shorter -- for example, H15/2.1 #6, indicating atom name (H15), full file.model number (/2.1), and atom number (#6). If only a single model is loaded, %[identify] does not include the model number.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},insertion:{"@desc":"protein residue insertion code","@examples":["insertion=A"],regex:/[a-zA-Z0-9]/,map:Dn,level:"atom-test",property:da.ammp("pdbx_PDB_ins_code")},label:{"@desc":"current atom label (same as format)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},mass:{"@desc":"atomic mass -- especially useful with appended .max or .sum","@examples":["mass > 13"],regex:Fp,map:e=>parseFloat(e),level:"atom-test",property:da.acp("mass")},model:{"@desc":"model number","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},modelindex:{"@desc":"a unique number for each model, starting with 0 and spanning all models in all files","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},modO:{"@desc":"currently calculated occupancy from modulation (0 to 100; NaN if atom has no occupancy modulation)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},modXYZ:{"@desc":"currently calculated displacement modulation (for incommensurately modulated structures). Also modX, modY, modZ for individual components. For atoms without modultion, {xx}.modXYZ is -1 and {xx}.modX is NaN, and in a label %[modXYZ] and %[modX] are blank.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},molecule:{"@desc":"molecule number","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},monomer:{"@desc":"monomer number (group number) in a polymer (usually a chain), starting with 1, or 0 if not part of a biopolymer -- that is, not a connected carbohydrate, amino acid, or nucleic acid (Jmol 14.3.15)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},ms:{"@desc":"magnetic shielding calculated from file-loaded tensors.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},occupancy:{"@desc":'CIF file site occupancy. In SELECT command comparisons ("select occupancy < 90"), an integer n implies measurement on a 0-100 scale; also, in the context %[occupancy] or %q for a label, the reported number is a percentage. In all other cases, such as when %Q is used in a label or when a decimal number is used in a comparison, the scale is 0.0 - 1.0.',"@examples":["occupancy < 1"],regex:Fp,map:e=>parseFloat(e),level:"atom-test",property:da.ammp("occupancy")},partialCharge:{"@desc":"partial charge","@examples":[""],isUnsupported:!0,regex:Fp,map:e=>parseFloat(e),level:"atom-test"},phi:{"@desc":"protein group PHI angle for atom's residue","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},polymer:{"@desc":"sequential polymer number in a model, starting with 1.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},polymerLength:{"@desc":"polymer length","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},property_xx:{"@desc":"a property created using the DATA command","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},psi:{"@desc":"protein group PSI angle for the atom's residue","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},radius:{"@desc":'currently displayed radius -- In SELECT command comparisons ("select radius=n"), integer n implies Rasmol units 1/250 Angstroms; in all other cases or when a decimal number is used, the units are Angstroms.',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},resno:{"@desc":"PDB residue number, not including insertion code (see also seqcode, below)","@examples":["resno = 100"],regex:/-?[0-9]+/,map:e=>parseInt(e),level:"residue-test",property:da.ammp("auth_seq_id")},selected:{"@desc":"1.0 if atom is selected; 0.0 if not","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},sequence:{"@desc":'PDB one-character sequence code, as a string of characters, with "?" indicated where single-character codes are not available',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},seqcode:{"@desc":'PDB residue number, including insertion code (for example, 234^2; "seqcode" option added in Jmol 14.3.16)',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},seqid:{"@desc":"(mmCIF only) the value from _atom_site.label_seq_id; a pointer to _entity_poly_seq.num in the ENTITY_POLY_SEQ category specifying the sequence of monomers in a polymer. Allowance is made for the possibility of microheterogeneity in a sample by allowing a given sequence number to be correlated with more than one monomer id. (Jmol 14.2.3)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},shape:{"@desc":'hybridization geometry such as "tetrahedral"',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},site:{"@desc":"crystallographic site number","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},spacefill:{"@desc":"currently displayed radius","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},straightness:{"@desc":'quaternion-derived straightness (second derivative of the quaternion describing the orientation of the residue. This quantity will have different values depending upon the setting of quaternionFrame as "A" (alpha-carbon/phosphorus atom only), "C" (alpha-carbon/pyrimidine or purine base based), "P" (carbonyl-carbon peptide plane/phosphorus tetrahedron based), or "N" (amide-nitrogen based). The default is alpha-carbon based, which corresponds closely to the following combination of Ramachandran angles involving three consecutive residues i-1, i, and i+1: -psii-1 - phii + psii + phii+1.',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},strucno:{"@desc":"a unique number for each helix, sheet, or turn in a model, starting with 1.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},structure:{"@desc":'The value of this parameter depends upon the context. Used with select structure=x, x can be either the quoted keyword "none", "turn", "sheet", "helix", "dna", "rna", or "carbohydrate" or a respective number 0-6. In the context {*}.structure, the return value is a number; in the context label %[structure], the return is one of the six keywords.',"@examples":['structure="helix"',"structure=3"],regex:/none|turn|sheet|helix|dna|rna|carbohydrate|[0-6]/i,map:Dn,level:"residue-test",property:"structure"},substructure:{"@desc":'like structure, the value of this parameter depends upon the context. Used with select substructure=x, x can be either the quoted keyword "none", "turn", "sheet", "helix", "dna", "rna", "carbohydrate", "helix310", "helixalpha", or "helixpi", or the respective number 0-9. In the context {*}.substructure, the return value is a number; in the context label %[substructure], the return is one of the nine keywords.',"@examples":['substructure = "alphahelix"',"substructure =9"],regex:/none|turn|sheet|helix|dna|rna|carbohydrate|helix310|helixalpha|helixpi|[0-9]/i,map:Dn,level:"residue-test",property:"structure"},surfacedistance:{"@desc":"A value related to the distance of an atom to a nominal molecular surface. 0 indicates at the surface. Positive numbers are minimum distances in Angstroms from the given atom to the surface.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},symop:{"@desc":'the first symmetry operation code that generated this atom by Jmol; an integer starting with 1. See also symmetry, below. This operator is only present if the file contains space group information and the file was loaded using the {i, j, k} option so as to generate symmetry-based atoms. To select only the original atoms prior to application of symmetry, you can either use "SYMOP=n", where n is the symmetry operator corresponding to "x,y,z", or you can specify instead simply "NOT symmetry" the way you might specify "NOT hydrogen". Note that atoms in special positions will have multiple operator matches. These atoms can be selected using the keyword SPECIALPOSITION. The special form select SYMOP=nijk selects a specific translation of atoms from the given crystallographic symmetry operation. Comparators <, <=, >, >=, and != can be used and only apply to the ijk part of the designation. The ijk are relative, not absolute. Thus, symop=2555 selects for atoms that have been transformed by symop=2 but not subjected to any further translation. select symop=1555 is identical to select not symmetry. All other ijk are relative to these selections for 555. If the model was loaded using load "filename.cif" {444 666 1}, where the 1 indicates that all symmetry-generated atoms are to be packed within cell 555 and then translated to fill the other 26 specified cells, then select symop=3555 is nearly the same as select symop=3 and cell=555. (The difference being that cell=555 selects for all atoms that are on any edge of the cell, while symop=3555 does not.) However, the situation is different if instead the model was loaded using load "filename.cif" {444 666 0}, where the 0 indicates that symmetry-generated atoms are to be placed exactly where their symmetry operator would put them (x,-y,z being different then from x, 1-y, z). In that case, select symop=3555 is for all atoms that have been generated using symmetry operation 3 but have not had any additional translations applied to the x,y,z expression found in the CIF file. If, for example, symmetry operation 3 is -x,-y,-z, then load "filename.cif" {444 666 0} will place an atom originally at {1/2, 1/2, 1/2} at positions {-1/2, -1/2, -1/2} (symop=3555) and {-3/2, -3/2, -3/2} (symop=3444) and 24 other sites.',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},symmetry:{"@desc":'as "symmetry" or in a label as lower-case "o" gives list of crystallographic symmetry operators generating this atom with lattice designations,such as 3555; upper-case "%O" in a label gives a list without the lattice designations. See also symop, above.',"@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},temperature:{"@desc":"yes yes temperature factor (B-factor)","@examples":["temperature >= 20"],regex:Fp,map:e=>parseFloat(e),level:"atom-test",property:da.ammp("B_iso_or_equiv")},unitXyz:{"@desc":"unit cell XYZ coordinates","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},uX:{"@desc":"unit cell X coordinate normalized to [0,1)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},uY:{"@desc":"unit cell Y coordinate normalized to [0,1)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},uZ:{"@desc":"unit cell Z coordinate normalized to [0,1)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},valence:{"@desc":"the valence of an atom (sum of bonds, where double bond counts as 2 and triple bond counts as 3","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},vanderwaals:{"@desc":"van der Waals radius","@examples":["vanderwaals >2"],regex:Fp,map:e=>parseFloat(e),level:"atom-test",property:da.acp("vdw")},vectorScale:{"@desc":"vibration vector scale","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},volume:{"@desc":"approximate van der Waals volume for this atom. Note, {*}.volume gives an average; use {*}.volume.sum to get total volume.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},vXyz:{"@desc":"vibration vector, or individual components as %vx %vy %vz. For atoms without vibration vectors, {xx}.vXyz is -1; in a label, %[vxyz] is blank.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},vX:{"@desc":"vibration vector X coordinate; for atoms without vibration vector, {xx}.vX is NaN (same for vY and vZ)","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},vY:{"@desc":"vibration vector Y coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},vZ:{"@desc":"vibration vector Z coordinate","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"},xyz:{"@desc":"Cartesian XYZ coordinates; select xyz > 1.0 selects atoms more than one Angstrom from the origin.","@examples":[""],isUnsupported:!0,regex:/[0-9\s{}-]+/,map:Dn,level:"atom-test"}},Rfe=pe,Nfe=[{"@desc":"Selects atoms that are not included in s1.","@examples":["not ARG"],name:"not",type:su,rule:Ye.alt(Ye.regex(/NOT/i).skip(Ye.whitespace),Ye.string("!").skip(Ye.optWhitespace)),map:(e,t)=>kf(t)},{"@desc":"Selects atoms included in both s1 and s2.","@examples":["ASP and .CA"],name:"and",type:$u,rule:Fy(/AND|&/i),map:(e,t,n)=>Rfe.struct.modifier.intersectBy({0:t,by:n})},{"@desc":"Selects atoms included in either s1 or s2.","@examples":["ASP or GLU"],name:"or",type:$u,rule:Fy(/OR|\||,/i),map:(e,t,n)=>Rfe.struct.combinator.merge([t,n])}],qe=pe,qo={acidic:["ASP","GLU"],aliphatic:["ALA","GLY","ILE","LEU","VAL"],amino:["ALA","ARG","ASN","ASP","CYS","GLN","GLU","GLY","HIS","ILE","LEU","LYS","MET","PHE","PRO","SER","THR","TRP","TYR","VAL","ASX","GLX","UNK"],aromatic:["HIS","PHE","TRP","TYR"],basic:["ARG","HIS","LYS"],buried:["ALA","CYS","ILE","LEU","MET","PHE","TRP","VAL"],cg:["CYT","C","GUA","G"],cyclic:["HIS","PHE","PRO","TRP","TYR"],hydrophobic:["ALA","GLY","ILE","LEU","MET","PHE","PRO","TRP","TYR","VAL"],large:["ARG","GLU","GLN","HIS","ILE","LEU","LYS","MET","PHE","TRP","TYR"],medium:["ASN","ASP","CYS","PRO","THR","VAL"],small:["ALA","GLY","SER"],nucleic:["G","C","A","T","U","I","DG","DC","DA","DT","DU","DI","+G","+C","+A","+T","+U","+I"]},Ffe_nucleic=["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*","C2'","C1'","O4'","O2'"],Ffe_protein=["C","N","CA"];function GD(){return qe.struct.combinator.merge([qe.struct.generator.atomGroups({"residue-test":qe.core.set.has([qe.set(...qo.nucleic),qe.ammp("label_comp_id")])}),qe.struct.filter.pick({0:qe.struct.generator.atomGroups({"group-by":qe.ammp("residueKey")}),test:qe.core.logic.and([qe.core.rel.eq([qe.struct.atomSet.atomCount(),1]),qe.core.rel.eq([qe.ammp("label_atom_id"),qe.atomName("P")])])}),qe.struct.filter.pick({0:qe.struct.generator.atomGroups({"group-by":qe.ammp("residueKey")}),test:qe.core.logic.or([qe.core.set.isSubset([Sg(["C1'","C2'","O3'","C3'","C4'","C5'","O5'"]),qe.ammpSet("label_atom_id")]),qe.core.set.isSubset([Sg(["C1*","C2*","O3*","C3*","C4*","C5*","O5*"]),qe.ammpSet("label_atom_id")])])})])}const Ofe={all:{"@desc":"all atoms; same as *",abbr:["*"],map:()=>qe.struct.generator.all()},bonded:{"@desc":"covalently bonded",map:()=>qe.struct.generator.atomGroups({"atom-test":qe.core.rel.gr([qe.struct.atomProperty.core.bondCount({flags:qe.struct.type.bondFlags(["covalent","metallic","sulfide"])}),0])})},clickable:{"@desc":"actually visible -- having some visible aspect such as wireframe, spacefill, or a label showing, or the alpha-carbon or phosphorus atom in a biomolecule that is rendered with only cartoon, rocket, or other biomolecule-specific shape."},connected:{"@desc":"bonded in any way, including hydrogen bonds",map:()=>qe.struct.generator.atomGroups({"atom-test":qe.core.rel.gr([qe.struct.atomProperty.core.bondCount({flags:qe.struct.type.bondFlags()}),0])})},displayed:{"@desc":"displayed using the display or hide command; not necessarily visible"},hidden:{"@desc":"hidden using the display or hide command"},none:{"@desc":"no atoms",map:()=>qe.struct.generator.empty()},selected:{"@desc":"atoms that have been selected; defaults to all when a file is first loaded"},thisModel:{"@desc":'atoms in the current frame set, as defined by frame, model, or animation commands. If more than one model is in this set, "thisModel" refers to all of them, regardless of atom displayed/hidden status.'},visible:{"@desc":"visible in any way, including PDB residue atoms for which a cartoon or other such rendering makes their group visible, even if they themselves are not visible."},subset:{"@desc":"the currently defined subset. Note that if a subset is currently defined, then select/display all is the same as select/display subset, restrict none is the same as restrict not subset. In addition, select not subset selects nothing."},specialPosition:{"@desc":"atoms in crystal structures that are at special positions - that is, for which there is more than one operator that leads to them."},unitcell:{"@desc":"atoms within the current unitcell, which may be offset. This includes atoms on the faces and at the vertices of the unitcell."},polyhedra:{"@desc":"all central atoms for which polyhedra have been created. See also polyhera(n), below. (Jmol 14.4)"},nonmetal:{"@desc":"_H,_He,_B,_C,_N,_O,_F,_Ne,_Si,_P,_S,_Cl,_Ar,_As,_Se,_Br,_Kr,_Te,_I,_Xe,_At,_Rn",map:()=>qe.struct.generator.atomGroups({"atom-test":qe.core.set.has([qe.set(...["H","He","B","C","N","O","F","Ne","Si","P","S","Cl","Ar","As","Se","Br","Kr","Te","I","Xe","At","Rn"].map(qe.es)),qe.acp("elementSymbol")])})},metal:{"@desc":"!nonmetal",map:()=>qe.struct.generator.atomGroups({"atom-test":qe.core.logic.not([qe.core.set.has([qe.set(...["H","He","B","C","N","O","F","Ne","Si","P","S","Cl","Ar","As","Se","Br","Kr","Te","I","Xe","At","Rn"].map(qe.es)),qe.acp("elementSymbol")])])})},alkaliMetal:{"@desc":"_Li,_Na,_K,_Rb,_Cs,_Fr",map:()=>qe.struct.generator.atomGroups({"atom-test":qe.core.set.has([qe.set(...["Li","Na","K","Rb","Cs","Fr"].map(qe.es)),qe.acp("elementSymbol")])})},alkalineEarth:{"@desc":"_Be,_Mg,_Ca,_Sr,_Ba,_Ra",map:()=>qe.struct.generator.atomGroups({"atom-test":qe.core.set.has([qe.set(...["Be","Mg","Ca","Sr","Ba","Ra"].map(qe.es)),qe.acp("elementSymbol")])})},nobleGas:{"@desc":"_He,_Ne,_Ar,_Kr,_Xe,_Rn",map:()=>qe.struct.generator.atomGroups({"atom-test":qe.core.set.has([qe.set(...["He","Ne","Ar","Kr","Xe","Rn"].map(qe.es)),qe.acp("elementSymbol")])})},metalloid:{"@desc":"_B,_Si,_Ge,_As,_Sb,_Te",map:()=>qe.struct.generator.atomGroups({"atom-test":qe.core.set.has([qe.set(...["B","Si","Ge","As","Sb","Te"].map(qe.es)),qe.acp("elementSymbol")])})},transitionMetal:{"@desc":"(includes La and Ac) elemno>=21 and elemno<=30, elemno=57, elemno=89, elemno>=39 and elemno<=48, elemno>=72 and elemno<=80, elemno>=104 and elemno<=112",map:()=>qe.struct.generator.atomGroups({"atom-test":qe.core.logic.or([qe.core.rel.inRange([qe.acp("atomicNumber"),21,30]),qe.core.rel.inRange([qe.acp("atomicNumber"),39,48]),qe.core.rel.inRange([qe.acp("atomicNumber"),72,80]),qe.core.rel.inRange([qe.acp("atomicNumber"),104,112]),qe.core.set.has([qe.set(57,89),qe.acp("atomicNumber")])])})},lanthanide:{"@desc":"(does not include La) elemno>57 and elemno<=71",map:()=>qe.struct.generator.atomGroups({"atom-test":qe.core.rel.inRange([qe.acp("atomicNumber"),57,71])})},actinide:{"@desc":"(does not include Ac) elemno>89 and elemno<=103",map:()=>qe.struct.generator.atomGroups({"atom-test":qe.core.rel.inRange([qe.acp("atomicNumber"),89,103])})},isaromatic:{"@desc":"atoms connected with the AROMATIC, AROMATICSINGLE, or AROMATICDOUBLE bond types",map:()=>qe.struct.generator.atomGroups({"atom-test":qe.core.rel.gr([qe.struct.atomProperty.core.bondCount({flags:qe.struct.type.bondFlags(["aromatic"])}),0])})},carbohydrate:{"@desc":""},ions:{"@desc":'(specifically the PDB designations "PO4" and "SO4")'},ligand:{"@desc":'(originally "hetero and not solvent"; changed to "!(protein,nucleic,water,UREA)" for Jmol 12.2)'},nucleic:{"@desc":'any group that (a) has one of the following group names: G, C, A, T, U, I, DG, DC, DA, DT, DU, DI, +G, +C, +A, +T, +U, +I; or (b) can be identified as a group that is only one atom, with name "P"; or (c) has all of the following atoms (prime, \', can replace * here): C1*, C2*, C3*, O3*, C4*, C5*, and O5*.',map:()=>GD()},purine:{"@desc":"any nucleic group that (a) has one of the following group names: A, G, I, DA, DG, DI, +A, +G, or +I; or (b) also has atoms N7, C8, and N9.",map:()=>qe.struct.modifier.intersectBy({0:GD(),by:qe.struct.combinator.merge([qe.struct.generator.atomGroups({"residue-test":qe.core.set.has([qe.set("A","G","I","DA","DG","DI","+A","+G","+I"),qe.ammp("label_comp_id")])}),qe.struct.filter.pick({0:qe.struct.generator.atomGroups({"group-by":qe.ammp("residueKey")}),test:qe.core.set.isSubset([Sg(["N7","C8","N9"]),qe.ammpSet("label_atom_id")])})])})},pyrimidine:{"@desc":"any nucleic group that (a) has one of the following group names: C, T, U, DC, DT, DU, +C, +T, +U; or (b) also has atom O2.",map:()=>qe.struct.modifier.intersectBy({0:GD(),by:qe.struct.combinator.merge([qe.struct.generator.atomGroups({"residue-test":qe.core.set.has([qe.set("C","T","U","DC","DT","DU","+C","+T","+U"),qe.ammp("label_comp_id")])}),qe.struct.filter.pick({0:qe.struct.generator.atomGroups({"group-by":qe.ammp("residueKey")}),test:qe.core.logic.or([qe.core.set.has([qe.ammpSet("label_atom_id"),qe.atomName("O2*")]),qe.core.set.has([qe.ammpSet("label_atom_id"),qe.atomName("O2'")])])})])})},dna:{"@desc":"any nucleic group that (a) has one of the following group names: DG, DC, DA, DT, DU, DI, T, +G, +C, +A, +T; or (b) has neither atom O2* or O2'.",map:()=>qe.struct.modifier.intersectBy({0:GD(),by:qe.struct.combinator.merge([qe.struct.generator.atomGroups({"residue-test":qe.core.set.has([qe.set("DG","DC","DA","DT","DU","DI","T","+G","+C","+A","+T"),qe.ammp("label_comp_id")])}),qe.struct.filter.pick({0:qe.struct.generator.atomGroups({"group-by":qe.ammp("residueKey")}),test:qe.core.logic.not([qe.core.logic.or([qe.core.set.has([qe.ammpSet("label_atom_id"),qe.atomName("O2*")]),qe.core.set.has([qe.ammpSet("label_atom_id"),qe.atomName("O2'")])])])})])})},rna:{"@desc":"any nucleic group that (a) has one of the following group names: G, C, A, U, I, +U, +I; or (b) has atom O2* or O2'.",map:()=>qe.struct.modifier.intersectBy({0:GD(),by:qe.struct.combinator.merge([qe.struct.generator.atomGroups({"residue-test":qe.core.set.has([qe.set("G","C","A","U","I","+U","+I"),qe.ammp("label_comp_id")])}),qe.struct.filter.pick({0:qe.struct.generator.atomGroups({"group-by":qe.ammp("residueKey")}),test:qe.core.logic.or([qe.core.set.has([qe.ammpSet("label_atom_id"),qe.atomName("O2*")]),qe.core.set.has([qe.ammpSet("label_atom_id"),qe.atomName("O2'")])])})])})},protein:{"@desc":'defined as a group that (a) has one of the following group names: ALA, ARG, ASN, ASP, CYS, GLN, GLU, GLY, HIS, ILE, LEU, LYS, MET, PHE, PRO, SER, THR, TRP, TYR, VAL, ASX, GLX, or UNK; or (b) contains PDB atom designations [C, O, CA, and N] bonded correctly; or (c) does not contain "O" but contains [C, CA, and N] bonded correctly; or (d) has only one atom, which has name CA and does not have the group name CA (indicating a calcium atom).',map:()=>function rJe(){return qe.struct.generator.atomGroups({"residue-test":qe.core.set.has([qe.set(...qo.amino),qe.ammp("label_comp_id")])})}()},acidic:{"@desc":"ASP GLU",map:()=>ri(qo.acidic)},acyclic:{"@desc":"amino and not cyclic",map:()=>qe.struct.modifier.intersectBy({0:ri(qo.amino),by:kf(ri(qo.cyclic))})},aliphatic:{"@desc":"ALA GLY ILE LEU VAL",map:()=>ri(qo.aliphatic)},amino:{"@desc":"all twenty standard amino acids, plus ASX, GLX, UNK",map:()=>ri(qo.amino)},aromatic:{"@desc":'HIS PHE TRP TYR (see also "isaromatic" for aromatic bonds)',map:()=>ri(qo.aromatic)},basic:{"@desc":"ARG HIS LYS",map:()=>ri(qo.basic)},buried:{"@desc":"ALA CYS ILE LEU MET PHE TRP VAL",map:()=>ri(qo.buried)},charged:{"@desc":"same as acidic or basic -- ASP GLU, ARG HIS LYS",map:()=>ri(qo.acidic.concat(qo.basic))},cyclic:{"@desc":"HIS PHE PRO TRP TYR",map:()=>ri(qo.cyclic)},helix:{"@desc":"secondary structure-related.",map:()=>qe.struct.generator.atomGroups({"residue-test":qe.core.flags.hasAny([qe.struct.type.secondaryStructureFlags(["helix"]),qe.ammp("secondaryStructureFlags")])})},helixalpha:{"@desc":"secondary structure-related.",map:()=>qe.struct.generator.atomGroups({"residue-test":qe.core.flags.hasAny([qe.struct.type.secondaryStructureFlags(["alpha"]),qe.ammp("secondaryStructureFlags")])})},helix310:{"@desc":"secondary structure-related.",map:()=>qe.struct.generator.atomGroups({"residue-test":qe.core.flags.hasAny([qe.struct.type.secondaryStructureFlags(["3-10"]),qe.ammp("secondaryStructureFlags")])})},helixpi:{"@desc":"secondary structure-related.",map:()=>qe.struct.generator.atomGroups({"residue-test":qe.core.flags.hasAny([qe.struct.type.secondaryStructureFlags(["pi"]),qe.ammp("secondaryStructureFlags")])})},hetero:{"@desc":"PDB atoms designated as HETATM",map:()=>qe.struct.generator.atomGroups({"atom-test":qe.ammp("isHet")})},hydrophobic:{"@desc":"ALA GLY ILE LEU MET PHE PRO TRP TYR VAL",map:()=>ri(qo.hydrophobic)},large:{"@desc":"ARG GLU GLN HIS ILE LEU LYS MET PHE TRP TYR",map:()=>ri(qo.large)},medium:{"@desc":"ASN ASP CYS PRO THR VAL",map:()=>ri(qo.medium)},negative:{"@desc":"same as acidic -- ASP GLU",map:()=>ri(qo.acidic)},neutral:{"@desc":"amino and not (acidic or basic)",map:()=>qe.struct.modifier.intersectBy({0:ri(qo.amino),by:kf(ri(qo.acidic.concat(qo.basic)))})},polar:{"@desc":"amino and not hydrophobic",map:()=>qe.struct.modifier.intersectBy({0:ri(qo.amino),by:kf(ri(qo.hydrophobic))})},positive:{"@desc":"same as basic -- ARG HIS LYS",map:()=>ri(qo.basic)},sheet:{"@desc":"secondary structure-related",map:()=>qe.struct.generator.atomGroups({"residue-test":qe.core.flags.hasAny([qe.struct.type.secondaryStructureFlags(["sheet"]),qe.ammp("secondaryStructureFlags")])})},small:{"@desc":"ALA GLY SER",map:()=>ri(qo.small)},surface:{"@desc":"amino and not buried",map:()=>qe.struct.modifier.intersectBy({0:ri(qo.amino),by:kf(ri(qo.buried))})},turn:{"@desc":"secondary structure-related",map:()=>qe.struct.generator.atomGroups({"residue-test":qe.core.flags.hasAny([qe.struct.type.secondaryStructureFlags(["turn"]),qe.ammp("secondaryStructureFlags")])})},alpha:{"@desc":"(*.CA)",map:()=>qe.struct.generator.atomGroups({"atom-test":qe.core.rel.eq([qe.atomName("CA"),qe.ammp("label_atom_id")])})},base:{"@desc":"(nucleic bases)"},backbone:{"@desc":"(*.C, *.CA, *.N, and all nucleic other than the bases themselves)",abbr:["mainchain"],map:()=>function iJe(){return qe.struct.combinator.merge([qe.struct.modifier.intersectBy({0:qe.struct.generator.atomGroups({"residue-test":qe.core.set.has([qe.core.type.set(qo.amino),qe.ammp("label_comp_id")])}),by:qe.struct.generator.atomGroups({"atom-test":qe.core.set.has([qe.core.type.set(Ffe_protein),qe.ammp("label_atom_id")])})}),qe.struct.modifier.intersectBy({0:qe.struct.generator.atomGroups({"residue-test":qe.core.set.has([qe.core.type.set(qo.nucleic),qe.ammp("label_comp_id")])}),by:qe.struct.generator.atomGroups({"atom-test":qe.core.set.has([qe.core.type.set(Ffe_nucleic),qe.ammp("label_atom_id")])})})])}()},sidechain:{"@desc":"((protein or nucleic) and not backbone)"},spine:{"@desc":"(*.CA, *.N, *.C for proteins; *.P, *.O3', *.O5', *.C3', *.C4', *.C5 for nucleic acids)"},leadatom:{"@desc":"(*.CA, *.P, and terminal *.O5')"},solvent:{"@desc":'PDB "HOH", water, also the connected set of H-O-H in any model'}},gr=pe,oJe=[{"@desc":"value comparisons","@examples":[],name:"=",abbr:["=="],type:$u,rule:Ye.regexp(/\s*(LIKE|>=|<=|=|!=|>|<)\s*/i,1),map:(e,t,n)=>{let r;if("structure"===t?r=gr.core.flags.hasAny([gr.ammp("secondaryStructureFlags"),kfe(n)]):"structure"===n?r=gr.core.flags.hasAny([gr.ammp("secondaryStructureFlags"),kfe(t)]):void 0!==t.head?"core.type.regex"===t.head.name&&(r=gr.core.str.match([t,gr.core.type.str([n])])):void 0!==n.head?"core.type.regex"===n.head.name&&(r=gr.core.str.match([n,gr.core.type.str([t])])):"LIKE"===e.toUpperCase()&&(r=gr.core.str.match(t.head?[gr.core.type.regex([`^${n}$`,"i"]),gr.core.type.str([t])]:[gr.core.type.regex([`^${t}$`,"i"]),gr.core.type.str([n])])),!r)switch(t.head&&(n=VD(t,n)),n.head&&(t=VD(n,t)),e){case"=":r=gr.core.rel.eq([t,n]);break;case"!=":r=gr.core.rel.neq([t,n]);break;case">":r=gr.core.rel.gr([t,n]);break;case"<":r=gr.core.rel.lt([t,n]);break;case">=":r=gr.core.rel.gre([t,n]);break;case"<=":r=gr.core.rel.lte([t,n]);break;default:throw new Error(`value operator '${e}' not supported`)}return gr.struct.generator.atomGroups({"atom-test":r})}}];function sJe(e){const[t,n,r,i,o,s,a]=e[1],l={};o&&(l["chain-test"]=gr.core.rel.eq([gr.ammp("auth_asym_id"),o]));const c=[];t&&c.push(gr.core.rel.eq([gr.ammp("label_comp_id"),t])),n&&c.push(gr.core.logic.and([gr.core.rel.gre([gr.ammp("auth_seq_id"),n[0]]),gr.core.rel.lte([gr.ammp("auth_seq_id"),n[1]])])),r&&c.push(gr.core.rel.eq([gr.ammp("auth_seq_id"),r])),i&&c.push(gr.core.rel.eq([gr.ammp("pdbx_PDB_ins_code"),i])),c.length&&(l["residue-test"]=yH(c));const u=[];return s&&u.push(gr.core.rel.eq([gr.ammp("auth_atom_id"),s])),a&&u.push(gr.core.rel.eq([gr.ammp("label_alt_id"),a])),u.length&&(l["atom-test"]=yH(u)),gr.struct.generator.atomGroups(l)}const aJe=Ye.createLanguage({Integer:()=>Ye.regexp(/-?[0-9]+/).map(Number).desc("integer"),Parens:function(e){return Ye.alt(e.Parens,e.Operator,e.Expression).wrap(Ye.regexp(/\(\s*/),Ye.regexp(/\s*\)/))},Expression:function(e){return Ye.alt(e.Keywords,e.AtomExpression.map(sJe),e.Within.map(t=>gr.struct.modifier.includeSurroundings({0:t[1],radius:t[0]})),e.ValueQuery,e.Element.map(t=>gr.struct.generator.atomGroups({"atom-test":gr.core.rel.eq([gr.acp("elementSymbol"),gr.struct.type.elementSymbol(t)])})),e.Resname.map(t=>gr.struct.generator.atomGroups({"residue-test":gr.core.rel.eq([gr.ammp("label_comp_id"),t])})))},Operator:function(e){return zD(Nfe,Ye.alt(e.Parens,e.Expression))},AtomExpression:function(e){return Ye.seq(Ye.lookahead(e.AtomPrefix),Ye.seq(e.BracketedResname.or(Ye.of(null)),e.ResnoRange.or(Ye.of(null)),e.Resno.or(Ye.of(null)),e.Inscode.or(Ye.of(null)),e.Chainname.or(Ye.of(null)),e.Atomname.or(Ye.of(null)),e.Altloc.or(Ye.of(null)),e.Model.or(Ye.of(null)))).desc("expression")},AtomPrefix:()=>Ye.regexp(/[\[0-9:^%/.-]/).desc("atom-prefix"),Chainname:()=>Ye.regexp(/:([A-Za-z]{1,3})/,1).desc("chainname"),Model:()=>Ye.regexp(/\/([0-9]+)/,1).map(Number).desc("model"),Element:()=>Ye.regexp(/_([A-Za-z]{1,3})/,1).desc("element"),Atomname:()=>Ye.regexp(/\.([a-zA-Z0-9]{1,4})/,1).map(gr.atomName).desc("atomname"),Resname:()=>Ye.regexp(/[a-zA-Z0-9]{1,4}/).desc("resname"),Resno:e=>e.Integer.desc("resno"),Altloc:()=>Ye.regexp(/%([a-zA-Z0-9])/,1).desc("altloc"),Inscode:()=>Ye.regexp(/\^([a-zA-Z0-9])/,1).desc("inscode"),BracketedResname:()=>Ye.regexp(/\[([a-zA-Z0-9]{1,4})\]/,1).desc("bracketed-resname"),ResnoRange:e=>Ye.seq(e.Integer.skip(Ye.seq(Ye.optWhitespace,Ye.string("-"),Ye.optWhitespace)),e.Integer).desc("resno-range"),Within:e=>Ye.regexp(/within/i).skip(Ye.regexp(/\s*\(\s*/)).then(Ye.seq(e.Integer.skip(Ye.regexp(/\s*,\s*/)),e.Query)).skip(Ye.regexp(/\)/)),Keywords:()=>Ye.alt(...xH(Ofe)).desc("keyword"),Query:function(e){return Ye.alt(e.Operator,e.Parens,e.Expression).trim(Ye.optWhitespace)},Number:function(){return Ye.regexp(/-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?/).map(Number).desc("number")},String:function(){const e=SH(Mfe,Ofe,Nfe).sort(_g).map(w3).join("|");return Ye.alt(Ye.regexp(new RegExp(`(?!(${e}))[A-Z0-9_]+`,"i")),Ye.regexp(/'((?:[^"\\]|\\.)*)'/,1),Ye.regexp(/"((?:[^"\\]|\\.)*)"/,1).map(t=>gr.core.type.regex([`^${t}$`,"i"]))).desc("string")},Value:function(e){return Ye.alt(e.Number,e.String)},ValueParens:function(e){return Ye.alt(e.ValueParens,e.ValueOperator,e.ValueExpressions).wrap(Ye.string("("),Ye.string(")"))},ValuePropertyNames:function(){return Ye.alt(..._H(Mfe,/LIKE|>=|<=|=|!=|>|<|\)|\s/i))},ValueOperator:function(e){return zD(oJe,Ye.alt(e.ValueParens,e.ValueExpressions))},ValueExpressions:function(e){return Ye.alt(e.Value,e.ValuePropertyNames)},ValueQuery:function(e){return Ye.alt(e.ValueOperator.map(t=>{if(t.head){if(t.head.name.startsWith("structure-query.generator"))return t}else if("string"==typeof t&&t.length<=4)return gr.struct.generator.atomGroups({"residue-test":gr.core.rel.eq([gr.ammp("label_comp_id"),t])});throw new Error(`values must be part of an comparison, value '${t}'`)}))}}),cc=pe,BN=/[-+]?[0-9]*\.?[0-9]+/;function rA(e){return e.split("+").map(t=>t.replace(/^["']|["']$/g,""))}function CH(e){if(e.includes("-")&&e.includes("+")){const t=e.split("+").map(r=>r.replace(/^["']|["']$/g,"")),n=[];return t.forEach(r=>{if(r.includes("-")&&!r.startsWith("-")){const[i,o]=r.split("-").map(s=>parseInt(s));for(let s=i;s<=o;s++)n.push(s)}else if(r.includes("-")&&r.startsWith("-")&&r.match(/[0-9]+-[-0-9]+/)){const i=-parseInt(r.split("-")[1]);let o;o=r.includes("--")?-parseInt(r.split("-")[3]):parseInt(r.split("-")[2]);for(let s=i;s<=o;s++)n.push(s)}else r.includes("-")&&r.startsWith("-")&&r.match(/[0-9]+-[-0-9]+/),n.push(parseInt(r))}),n}if(e.includes("-")&&!e.includes("+")){const t=[];if(e.startsWith("-"))if(e.startsWith("-")&&e.match(/[0-9]+-[-0-9]+/)){const n=-parseInt(e.split("-")[1]);let r;r=e.includes("--")?-parseInt(e.split("-")[3]):parseInt(e.split("-")[2]);for(let i=n;i<=r;i++)t.push(i)}else e.startsWith("-")&&e.match(/[0-9]+-[-0-9]+/),t.push(parseInt(e));else{const[n,r]=e.split("-").map(i=>parseInt(i));for(let i=n;i<=r;i++)t.push(i)}return t}return!e.includes("-")&&e.includes("+")?rA(e).map(t=>parseInt(t)):[parseInt(e)]}const dJe={H:"helix",S:"beta",L:"none"},LN={symbol:{"@desc":"chemical-symbol-list: list of 1- or 2-letter chemical symbols from the periodic table","@examples":["symbol O+N"],abbr:["e."],regex:/[a-zA-Z'"+]+/,map:function uJe(e){return e.split("+").map(cc.struct.type.elementSymbol)},level:"atom-test",property:cc.acp("elementSymbol")},name:{"@desc":"atom-name-list: list of up to 4-letter codes for atoms in proteins or nucleic acids","@examples":["name CA+CB+CG+CD"],abbr:["n."],regex:/[a-zA-Z0-9'"+]+/,map:function cJe(e){return e.split("+").map(cc.atomName)},level:"atom-test",property:cc.ammp("label_atom_id")},resn:{"@desc":"residue-name-list: list of 3-letter codes for amino acids or list of up to 2-letter codes for nucleic acids","@examples":["resn ASP+GLU+ASN+GLN","resn A+G"],abbr:["resname","r."],regex:/[a-zA-Z0-9'"+]+/,map:rA,level:"residue-test",property:cc.ammp("label_comp_id")},resi:{"@desc":"residue-identifier-list list of up to 4-digit residue numbers or residue-identifier-range","@examples":["resi 1+10+100+1000","resi 1-10"],abbr:["resident","residue","resid","i."],regex:/[0-9+-]+/,map:CH,level:"residue-test",property:cc.ammp("auth_seq_id")},alt:{"@desc":"alternate-conformation-identifier-list list of single letters","@examples":["alt A+B",'alt ""','alt ""+A'],abbr:[],regex:/[a-zA-Z0-9'"+]+/,map:rA,level:"atom-test",property:cc.ammp("label_alt_id")},chain:{"@desc":"chain-identifier-list list of single letters or sometimes numbers","@examples":["chain A"],abbr:["c."],regex:/[a-zA-Z0-9'"+]+/,map:rA,level:"chain-test",property:cc.ammp("auth_asym_id")},segi:{"@desc":"segment-identifier-list list of up to 4 letter identifiers","@examples":["segi lig"],abbr:["segid","s."],regex:/[a-zA-Z0-9'"+]+/,map:rA,level:"chain-test",property:cc.ammp("label_asym_id")},flag:{"@desc":"flag-number a single integer from 0 to 31","@examples":["flag 0"],isUnsupported:!0,abbr:["f."],regex:/[0-9]+/,map:e=>parseInt(e),level:"atom-test"},numeric_type:{"@desc":"type-number a single integer","@examples":["nt. 5"],isUnsupported:!0,abbr:["nt."],regex:/[0-9]+/,map:e=>parseInt(e),level:"atom-test"},text_type:{"@desc":"type-string a list of up to 4 letter codes","@examples":["text_type HA+HC"],isUnsupported:!0,abbr:["tt."],regex:/[a-zA-Z0-9'"+]+/,map:rA,level:"atom-test"},id:{"@desc":"external-index-number a single integer","@examples":["id 23"],regex:/[0-9+-]+/,map:CH,level:"atom-test",property:cc.ammp("id")},index:{"@desc":"internal-index-number a single integer","@examples":["index 11"],regex:/[0-9+-]+/,map:CH,level:"atom-test",property:cc.ammp("id")},ss:{"@desc":"secondary-structure-type list of single letters. Helical regions should be assigned H and sheet regions S. Loop regions can either be assigned L or be blank.","@examples":["ss H+S+L",'ss S+""'],abbr:[],regex:/[a-zA-Z'"+]+/,map:function fJe(e){return{flags:cc.struct.type.secondaryStructureFlags(e.toUpperCase().split("+").map(t=>dJe[t]||"none"))}},level:"residue-test",property:cc.ammp("secondaryStructureFlags")},b:{"@desc":"comparison-operator b-factor-value a real number","@examples":["b > 10"],isNumeric:!0,abbr:[],regex:BN,map:e=>parseFloat(e),level:"atom-test",property:cc.ammp("B_iso_or_equiv")},q:{"@desc":"comparison-operator occupancy-value a real number","@examples":["q <0.50"],isNumeric:!0,abbr:[],regex:BN,map:e=>parseFloat(e),level:"atom-test",property:cc.ammp("occupancy")},formal_charge:{"@desc":"comparison-operator formal charge-value an integer","@examples":["fc. = -1"],isNumeric:!0,abbr:["fc."],regex:BN,map:e=>parseFloat(e),level:"atom-test",property:cc.ammp("pdbx_formal_charge")},partial_charge:{"@desc":"comparison-operator partial charge-value a real number","@examples":["pc. > 1"],isUnsupported:!0,isNumeric:!0,abbr:["pc."],regex:BN,map:e=>parseFloat(e),level:"atom-test"},elem:{"@desc":'str atomic element symbol string ("X" if undefined)',"@examples":["elem N"],regex:/[a-zA-Z0-9]{1,3}/,map:e=>cc.es(e),level:"atom-test",property:cc.acp("elementSymbol")}},nr=pe,Bfe=[{"@desc":"Selects atoms that are not included in s1.","@examples":["NOT resn ALA","not (resi 42 or chain A)","!resi 42 or chain A"],name:"not",type:su,rule:Ye.alt(Ye.regexp(/NOT/i).skip(Ye.whitespace),Ye.string("!").skip(Ye.optWhitespace)),map:(e,t)=>kf(t)},{"@desc":"Selects atoms included in both s1 and s2.","@examples":["chain A AND name CA"],name:"and",type:$u,rule:Fy(/AND|&/i),map:(e,t,n)=>nr.struct.modifier.intersectBy({0:t,by:n})},{"@desc":"Selects atoms included in either s1 or s2.","@examples":["chain A OR chain B"],name:"or",type:$u,rule:Fy(/OR|\|/i),map:(e,t,n)=>nr.struct.combinator.merge([t,n])},{"@desc":"Selects atoms in s1 whose identifiers name, resi, resn, chain and segi all match atoms in s2.","@examples":["chain A IN chain B"],name:"in",type:$u,rule:Fy(/IN/i),map:(e,t,n)=>nr.struct.filter.withSameAtomProperties({0:t,source:n,property:nr.core.type.compositeKey([nr.ammp("label_atom_id"),nr.ammp("label_seq_id"),nr.ammp("label_comp_id"),nr.ammp("auth_asym_id"),nr.ammp("label_asym_id")])})},{"@desc":"Selects atoms in s1 whose identifiers name and resi match atoms in s2.","@examples":["chain A LIKE chain B"],name:"like",type:$u,rule:Fy(/LIKE|l\./i),map:(e,t,n)=>nr.struct.filter.withSameAtomProperties({0:t,source:n,property:nr.core.type.compositeKey([nr.ammp("label_atom_id"),nr.ammp("label_seq_id")])})},{"@desc":"Selects all atoms whose van der Waals radii are separated from the van der Waals radii of s1 by a minimum of X Angstroms.","@examples":["solvent GAP 2"],name:"gap",type:FN,rule:ON(/GAP\s+([-+]?[0-9]*\.?[0-9]+)/i,1).map(e=>parseFloat(e)),map:(e,t)=>nr.struct.filter.within({0:nr.struct.generator.all(),target:t,"atom-radius":nr.acp("vdw"),"max-radius":e,invert:!0})},{"@desc":"Selects atoms with centers within X Angstroms of the center of any atom in s1.","@examples":["resname LIG AROUND 1"],name:"around",abbr:["a."],type:FN,rule:ON(/(AROUND|a\.)\s+([-+]?[0-9]*\.?[0-9]+)/i,2).map(e=>parseFloat(e)),map:(e,t)=>nr.struct.modifier.exceptBy({0:nr.struct.filter.within({0:nr.struct.generator.all(),target:t,"max-radius":e}),by:t})},{"@desc":"Expands s1 by all atoms within X Angstroms of the center of any atom in s1.","@examples":["chain A EXPAND 3"],name:"expand",abbr:["x."],type:FN,rule:ON(/(EXPAND|x\.)\s+([-+]?[0-9]*\.?[0-9]+)/i,2).map(e=>parseFloat(e)),map:(e,t)=>nr.struct.modifier.includeSurroundings({0:t,radius:e})},{"@desc":"Selects atoms in s1 that are within X Angstroms of any atom in s2.","@examples":["chain A WITHIN 3 OF chain B"],name:"within",abbr:["w."],type:$u,rule:gH("WITHIN","w."),map:(e,t,n)=>nr.struct.filter.within({0:t,target:n,"max-radius":e})},{"@desc":"Same as within, but excludes s2 from the selection (and thus is identical to s1 and s2 around X).","@examples":["chain A NEAR_TO 3 OF chain B"],name:"near_to",abbr:["nto."],type:$u,rule:gH("NEAR_TO","nto."),map:(e,t,n)=>nr.struct.modifier.exceptBy({0:nr.struct.filter.within({0:t,target:n,"max-radius":e}),by:n})},{"@desc":"Selects atoms in s1 that are at least X Anstroms away from s2.","@examples":["solvent BEYOND 2 OF chain A"],name:"beyond",abbr:["be."],type:$u,rule:gH("BEYOND","be."),map:(e,t,n)=>nr.struct.modifier.exceptBy({0:nr.struct.filter.within({0:t,target:n,"max-radius":e,invert:!0}),by:n})},{"@desc":"Expands selection to complete residues.","@examples":["BYRESIDUE name N"],name:"byresidue",abbr:["byresi","byres","br."],type:su,rule:Pf(/BYRESIDUE|byresi|byres|br\./i),map:(e,t)=>Cg(nr.struct.modifier.expandProperty({0:nr.struct.modifier.union({0:t}),property:nr.ammp("residueKey")}))},{"@desc":"Completely selects all alpha carbons in all residues covered by a selection.","@examples":["BYCALPHA chain A"],name:"bycalpha",abbr:["bca."],type:su,rule:Pf(/BYCALPHA|bca\./i),map:(e,t)=>nr.struct.generator.queryInSelection({0:nr.struct.modifier.expandProperty({0:nr.struct.modifier.union({0:t}),property:nr.ammp("residueKey")}),query:nr.struct.generator.atomGroups({"atom-test":nr.core.rel.eq([nr.atomName("CA"),nr.ammp("label_atom_id")])})})},{"@desc":"Expands selection to complete molecules.","@examples":["BYMOLECULE resi 20-30"],name:"bymolecule",isUnsupported:!0,abbr:["bymol","bm."],type:su,rule:Pf(/BYMOLECULE|bymol|bm\./i),map:(e,t)=>Cg(nr.struct.modifier.expandProperty({0:nr.struct.modifier.union({0:t}),property:nr.atp("connectedComponentKey")}))},{"@desc":"Expands selection to complete fragments.","@examples":["BYFRAGMENT resi 10"],name:"byfragment",abbr:["byfrag","bf."],isUnsupported:!0,type:su,rule:Pf(/BYFRAGMENT|byfrag|bf\./i),map:(e,t)=>[e,t]},{"@desc":"Expands selection to complete segments.","@examples":["BYSEGMENT resn CYS"],name:"bysegment",abbr:["bysegi","byseg","bs."],type:su,rule:Pf(/BYSEGMENT|bysegi|byseg|bs\./i),map:(e,t)=>Cg(nr.struct.modifier.expandProperty({0:nr.struct.modifier.union({0:t}),property:nr.ammp("chainKey")}))},{"@desc":"Expands selection to complete objects.","@examples":["BYOBJECT chain A"],name:"byobject",abbr:["byobj","bo."],isUnsupported:!0,type:su,rule:Pf(/BYOBJECT|byobj|bo\./i),map:(e,t)=>[e,t]},{"@desc":"Expands selection to unit cell.","@examples":["BYCELL chain A"],name:"bycell",isUnsupported:!0,type:su,rule:Pf(/BYCELL/i),map:(e,t)=>[e,t]},{"@desc":"All rings of size \u2264 7 which have at least one atom in s1.","@examples":["BYRING resn HEM"],name:"byring",type:su,rule:Pf(/BYRING/i),map:(e,t)=>Cg(nr.struct.modifier.intersectBy({0:nr.struct.filter.pick({0:nr.struct.generator.rings(),test:nr.core.logic.and([nr.core.rel.lte([nr.struct.atomSet.atomCount(),7]),nr.core.rel.gr([nr.struct.atomSet.countQuery([t]),1])])}),by:t}))},{"@desc":"Selects atoms directly bonded to s1, excludes s1.","@examples":["NEIGHBOR resn CYS"],name:"neighbor",type:su,abbr:["nbr."],rule:Pf(/NEIGHBOR|nbr\./i),map:(e,t)=>nr.struct.modifier.exceptBy({0:Cg(nr.struct.modifier.includeConnected({0:nr.struct.modifier.union({0:t}),"bond-test":!0})),by:t})},{"@desc":"Selects atoms directly bonded to s1, may include s1.","@examples":["BOUND_TO name CA"],name:"bound_to",abbr:["bto."],type:su,rule:Pf(/BOUND_TO|bto\./i),map:(e,t)=>Cg(nr.struct.modifier.includeConnected({0:nr.struct.modifier.union({0:t})}))},{"@desc":"Extends s1 by X bonds connected to atoms in s1.","@examples":["resname LIG EXTEND 3"],name:"extend",abbr:["xt."],type:FN,rule:ON(/(EXTEND|xt\.)\s+([0-9]+)/i,2).map(e=>parseInt(e)),map:(e,t)=>Cg(nr.struct.modifier.includeConnected({0:nr.struct.modifier.union({0:t}),"bond-test":!0,"layer-count":e}))}],Zt=pe,au={nucleic:["A","C","T","G","U","DA","DC","DT","DG","DU"],protein:["ALA","ARG","ASN","ASP","CYS","CYX","GLN","GLU","GLY","HIS","HID","HIE","HIP","ILE","LEU","LYS","MET","MSE","PHE","PRO","SER","THR","TRP","TYR","VAL"],solvent:["HOH","WAT","H20","TIP","SOL"]},Lfe_nucleic=["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*","C2'","C1'","O4'","O2'"],Lfe_protein=["C","N","CA","O"];function jfe(){return Zt.struct.combinator.merge([Zt.struct.modifier.intersectBy({0:Zt.struct.generator.atomGroups({"residue-test":Zt.core.set.has([Zt.core.type.set(au.protein),Zt.ammp("label_comp_id")])}),by:Zt.struct.generator.atomGroups({"atom-test":Zt.core.set.has([Zt.core.type.set(Lfe_protein),Zt.ammp("label_atom_id")])})}),Zt.struct.modifier.intersectBy({0:Zt.struct.generator.atomGroups({"residue-test":Zt.core.set.has([Zt.core.type.set(au.nucleic),Zt.ammp("label_comp_id")])}),by:Zt.struct.generator.atomGroups({"atom-test":Zt.core.set.has([Zt.core.type.set(Lfe_nucleic),Zt.ammp("label_atom_id")])})})])}const Ufe={all:{"@desc":"All atoms currently loaded into PyMOL",abbr:["*"],map:()=>Zt.struct.generator.all()},none:{"@desc":"No atoms (empty selection)",map:()=>Zt.struct.generator.empty()},hydrogens:{"@desc":"All hydrogen atoms currently loaded into PyMOL",abbr:["hydro","h."],map:()=>Zt.struct.generator.atomGroups({"atom-test":Zt.core.rel.eq([Zt.acp("elementSymbol"),Zt.es("H")])})},hetatm:{"@desc":"All atoms loaded from Protein Data Bank HETATM records",abbr:["het"],map:()=>Zt.struct.generator.atomGroups({"atom-test":Zt.core.rel.eq([Zt.ammp("isHet"),!0])})},visible:{"@desc":"All atoms in enabled objects with at least one visible representation",abbr:["v."]},polymer:{"@desc":"All atoms on the polymer (not het). Finds atoms with residue identifiers matching a known polymer, such a peptide and DNA.",abbr:["pol."],map:()=>Zt.struct.generator.atomGroups({"residue-test":Zt.core.set.has([Zt.core.type.set(au.nucleic.concat(au.protein)),Zt.ammp("label_comp_id")])})},sidechain:{"@desc":"Polymer non-backbone atoms (new in PyMOL 1.6.1)",abbr:["sc."],map:()=>Zt.struct.modifier.exceptBy({0:Zt.struct.generator.atomGroups({"residue-test":Zt.core.set.has([Zt.core.type.set(au.nucleic.concat(au.protein)),Zt.ammp("label_comp_id")])}),by:jfe()})},present:{"@desc":"All atoms with defined coordinates in the current state (used in creating movies)",abbr:["pr."]},center:{"@desc":"Pseudo-atom at the center of the scene"},origin:{"@desc":"Pseudo-atom at the origin of rotation"},enabled:{"@desc":"All enabled objects or selections from the object list."},masked:{"@desc":"All masked atoms.",abbr:["msk."]},protected:{"@desc":"All protected atoms.",abbr:["pr."]},bonded:{"@desc":"All bonded atoms",map:()=>Zt.struct.generator.atomGroups({"atom-test":Zt.core.rel.gr([Zt.struct.atomProperty.core.bondCount({flags:Zt.struct.type.bondFlags(["covalent","metallic","sulfide"])}),0])})},donors:{"@desc":"All hydrogen bond donor atoms.",abbr:["don."]},acceptors:{"@desc":"All hydrogen bond acceptor atoms.",abbr:["acc."]},fixed:{"@desc":"All fixed atoms.",abbr:["fxd."]},restrained:{"@desc":"All restrained atoms.",abbr:["rst."]},organic:{"@desc":"All atoms in non-polymer organic compounds (e.g. ligands, buffers). Finds carbon-containing molecules that do not match known polymers.",abbr:["org."],map:()=>Cg(Zt.struct.modifier.expandProperty({0:Zt.struct.modifier.union([Zt.struct.generator.queryInSelection({0:Zt.struct.generator.atomGroups({"residue-test":Zt.core.logic.not([Zt.core.set.has([Zt.core.type.set(au.nucleic.concat(au.protein)),Zt.ammp("label_comp_id")])])}),query:Zt.struct.generator.atomGroups({"atom-test":Zt.core.rel.eq([Zt.es("C"),Zt.acp("elementSymbol")])})})]),property:Zt.ammp("residueKey")}))},inorganic:{"@desc":"All non-polymer inorganic atoms/ions. Finds atoms in molecules that do not contain carbon and do not match any known solvent residues.",abbr:["ino."],map:()=>Cg(Zt.struct.modifier.expandProperty({0:Zt.struct.modifier.union([Zt.struct.filter.pick({0:Zt.struct.generator.atomGroups({"residue-test":Zt.core.logic.not([Zt.core.set.has([Zt.core.type.set(au.nucleic.concat(au.protein).concat(au.solvent)),Zt.ammp("label_comp_id")])]),"group-by":Zt.ammp("residueKey")}),test:Zt.core.logic.not([Zt.core.set.has([Zt.struct.atomSet.propertySet([Zt.acp("elementSymbol")]),Zt.es("C")])])})]),property:Zt.ammp("residueKey")}))},solvent:{"@desc":"All water molecules. The hardcoded solvent residue identifiers are currently: HOH, WAT, H20, TIP, SOL.",abbr:["sol."],map:()=>Zt.struct.generator.atomGroups({"residue-test":Zt.core.set.has([Zt.core.type.set(au.solvent),Zt.ammp("label_comp_id")])})},guide:{"@desc":"All protein CA and nucleic acid C4*/C4",map:()=>Zt.struct.combinator.merge([Zt.struct.generator.atomGroups({"atom-test":Zt.core.rel.eq([Zt.atomName("CA"),Zt.ammp("label_atom_id")]),"residue-test":Zt.core.set.has([Zt.core.type.set(au.protein),Zt.ammp("label_comp_id")])}),Zt.struct.generator.atomGroups({"atom-test":Zt.core.set.has([Sg(["C4*","C4'"]),Zt.ammp("label_atom_id")]),"residue-test":Zt.core.set.has([Zt.core.type.set(au.nucleic),Zt.ammp("label_comp_id")])})])},metals:{"@desc":"All metal atoms (new in PyMOL 1.6.1)"},backbone:{"@desc":"Polymer backbone atoms (new in PyMOL 1.6.1)",abbr:["bb."],map:()=>jfe()},"polymer.protein":{"@desc":"Protein (New in PyMOL 2.1)",abbr:["polymer.protein"],map:()=>Zt.struct.generator.atomGroups({"residue-test":Zt.core.set.has([Zt.core.type.set(au.protein),Zt.ammp("label_comp_id")])})},"polymer.nucleic":{"@desc":"Nucleic Acid (New in PyMOL 2.1)",abbr:["polymer.nucleic"],map:()=>Zt.struct.generator.atomGroups({"residue-test":Zt.core.set.has([Zt.core.type.set(au.nucleic),Zt.ammp("label_comp_id")])})}},pJe=pe,fa=function YQe(e){const t={};return Object.keys(e).sort(_g).forEach(n=>{const r=e[n],i=q1(`property '${n}' not supported`),o=Ye.regexp(r.regex).map(s=>(r.isUnsupported&&i(),bH(r.property,r.map(s))));r.isNumeric||(t[n]=o)}),t}(LN),wa=Ye.string("/");function jo(e){return e.or(Ye.of(null))}function hJe(e){const t={},n={};for(const r in e){const i=LN[r];if(!i)throw new Error(`property '${r}' not supported, value '${e[r]}'`);null!==e[r]&&(n[i.level]||(n[i.level]=[]),n[i.level].push(e[r]))}for(const r in n)t[r]=yH(n[r]);return pJe.struct.generator.atomGroups(t)}const mJe=Ye.createLanguage({Parens:function(e){return Ye.alt(e.Parens,e.Operator,e.Expression).wrap(Ye.string("("),Ye.string(")"))},Expression:function(e){return Ye.alt(e.Keywords,e.AtomSelectionMacro.map(hJe),e.NamedAtomProperties,e.Pepseq,e.Rep,e.Object)},AtomSelectionMacro:function(e){return Ye.alt(wa.then(Ye.alt(Ye.seq(jo(e.ObjectProperty).skip(wa),jo(fa.segi).skip(wa),jo(fa.chain).skip(wa),jo(fa.resi).skip(wa),jo(fa.name)).map(t=>({object:t[0],segi:t[1],chain:t[2],resi:t[3],name:t[4]})),Ye.seq(jo(e.ObjectProperty).skip(wa),jo(fa.segi).skip(wa),jo(fa.chain).skip(wa),jo(fa.resi)).map(t=>({object:t[0],segi:t[1],chain:t[2],resi:t[3]})),Ye.seq(jo(e.ObjectProperty).skip(wa),jo(fa.segi).skip(wa),jo(fa.chain)).map(t=>({object:t[0],segi:t[1],chain:t[2]})),Ye.seq(jo(e.ObjectProperty).skip(wa),jo(fa.segi)).map(t=>({object:t[0],segi:t[1]})),Ye.seq(jo(e.ObjectProperty)).map(t=>({object:t[0]})))),Ye.alt(Ye.seq(jo(e.ObjectProperty).skip(wa),jo(fa.segi).skip(wa),jo(fa.chain).skip(wa),jo(fa.resi).skip(wa),jo(fa.name)).map(t=>({object:t[0],segi:t[1],chain:t[2],resi:t[3],name:t[4]})),Ye.seq(jo(fa.segi).skip(wa),jo(fa.chain).skip(wa),jo(fa.resi).skip(wa),jo(fa.name)).map(t=>({segi:t[0],chain:t[1],resi:t[2],name:t[3]})),Ye.seq(jo(fa.chain).skip(wa),jo(fa.resi).skip(wa),jo(fa.name)).map(t=>({chain:t[0],resi:t[1],name:t[2]})),Ye.seq(jo(fa.resi).skip(wa),jo(fa.name)).map(t=>({resi:t[0],name:t[1]}))))},NamedAtomProperties:function(){return Ye.alt(...Dfe(LN))},Keywords:()=>Ye.alt(...xH(Ufe)),ObjectProperty:()=>{const e=SH(LN,Ufe,Bfe).sort(_g).map(w3).join("|");return Ye.regexp(new RegExp(`(?!(${e}))[A-Z0-9_]+`,"i"))},Object:e=>e.ObjectProperty.notFollowedBy(wa).map(t=>{throw new Error(`property 'object' not supported, value '${t}'`)}),Pepseq:()=>Ye.regexp(/(PEPSEQ|ps\.)\s+([a-z]+)/i,2).map(q1("operator 'pepseq' not supported")),Rep:()=>Ye.regexp(/REP\s+(lines|spheres|mesh|ribbon|cartoon|sticks|dots|surface|labels|extent|nonbonded|nb_spheres|slice|extent|slice|dashes|angles|dihedrals|cgo|cell|callback|everything)/i,1).map(q1("operator 'rep' not supported")),Operator:function(e){return zD(Bfe,Ye.alt(e.Parens,e.Expression,e.Operator))},Query:function(e){return Ye.alt(e.Operator,e.Parens,e.Expression).trim(Ye.optWhitespace)}}),Ys=pe,kd=/[-+]?[0-9]*\.?[0-9]+/,jN=/[+]?[0-9]+/,qD=/[-+]?[0-9]+/;function T_(e){return e}const zfe={T:"turn",E:"sheet",B:"strand",H:"alpha",G:"3-10",I:"pi",C:"none"};function wH(e){return Ys.struct.type.secondaryStructureFlags([zfe[e.toUpperCase()]||"none"])}const D_={name:{"@desc":"str atom name","@examples":["name CA"],regex:/[a-zA-Z0-9]+/,map:Ys.atomName,level:"atom-test",property:Ys.ammp("label_atom_id")},type:{"@desc":"str atom type","@examples":["type C3"],isUnsupported:!0,regex:/[a-zA-Z0-9]+/,map:T_,level:"atom-test"},index:{"@desc":"num the atom number, starting at 0","@examples":["index 10"],isNumeric:!0,regex:jN,map:e=>parseInt(e)-1,level:"atom-test",property:Ys.ammp("id")},serial:{"@desc":"num the atom number, starting at 1","@examples":["serial 11"],isNumeric:!0,regex:jN,map:e=>parseInt(e),level:"atom-test",property:Ys.ammp("id")},atomicnumber:{"@desc":"num atomic number (0 if undefined)","@examples":["atomicnumber 13"],isNumeric:!0,regex:jN,map:e=>parseInt(e),level:"atom-test",property:Ys.acp("atomicNumber")},element:{"@desc":'str atomic element symbol string ("X" if undefined)',"@examples":["element N"],regex:/[a-zA-Z0-9]{1,3}/,map:e=>Ys.es(e),level:"atom-test",property:Ys.acp("elementSymbol")},altloc:{"@desc":"str alternate location/conformation identifier","@examples":["altloc C"],regex:/[a-zA-Z0-9]+/,map:T_,level:"atom-test",property:Ys.ammp("label_alt_id")},chain:{"@desc":"str the one-character chain identifier","@examples":["chain A"],regex:/[a-zA-Z0-9]+/,map:T_,level:"residue-test",property:Ys.ammp("auth_asym_id")},residue:{"@desc":"num a set of connected atoms with the same residue number","@examples":["residue < 11","residue 11"],isNumeric:!0,regex:qD,map:e=>parseInt(e),level:"residue-test",property:Ys.ammp("auth_seq_id")},fragment:{"@desc":"num a set of connected residues","@examples":["fragment 42"],isUnsupported:!0,isNumeric:!0,regex:qD,map:e=>parseInt(e),level:"residue-test"},pfrag:{"@desc":"num a set of connected protein residues","@examples":["pfrag 42"],isUnsupported:!0,isNumeric:!0,regex:qD,map:e=>parseInt(e),level:"residue-test"},nfrag:{"@desc":"num a set of connected nucleic residues","@examples":["nfrag 42"],isUnsupported:!0,isNumeric:!0,regex:qD,map:e=>parseInt(e),level:"residue-test"},sequence:{"@desc":"str a sequence given by one letter names","@examples":["sequence PGATTACA"],isUnsupported:!0,regex:/[a-zA-Z0-9]+/,map:T_,level:"residue-test"},numbonds:{"@desc":"num number of bonds","@examples":["numbonds = 2","numbonds >= 3"],isNumeric:!0,regex:jN,map:e=>parseInt(e),level:"atom-test",property:Ys.acp("bondCount")},resname:{"@desc":"str residue name","@examples":["resname ALA"],regex:/[a-zA-Z0-9]+/,map:T_,level:"residue-test",property:Ys.ammp("auth_comp_id")},resid:{"@desc":"num residue id","@examples":["resid 42"],isNumeric:!0,regex:qD,map:e=>parseInt(e),level:"residue-test",property:Ys.ammp("auth_seq_id")},segname:{"@desc":"str segment name","@examples":["segname B"],regex:/[a-zA-Z0-9]+/,map:T_,level:"residue-test",property:Ys.ammp("label_asym_id")},x:{"@desc":"float x coordinate","@examples":["x 42"],isNumeric:!0,regex:kd,map:e=>parseFloat(e),level:"atom-test",property:Ys.acp("x")},y:{"@desc":"float y coordinate","@examples":["y > 1.7"],isNumeric:!0,regex:kd,map:e=>parseFloat(e),level:"atom-test",property:Ys.acp("y")},z:{"@desc":"float z coordinate","@examples":["z < 11","z > -21"],isNumeric:!0,regex:kd,map:e=>parseFloat(e),level:"atom-test",property:Ys.acp("z")},radius:{"@desc":"float atomic radius","@examples":["radius > 1.3"],isNumeric:!0,regex:kd,map:e=>parseFloat(e),level:"atom-test",property:Ys.acp("vdw")},mass:{"@desc":"float atomic mass","@examples":["mass > 2"],isNumeric:!0,regex:kd,map:e=>parseFloat(e),level:"atom-test",property:Ys.acp("mass")},charge:{"@desc":"float atomic charge","@examples":["charge > 0","charge 1"],isNumeric:!0,regex:kd,map:e=>parseFloat(e),level:"atom-test",property:Ys.ammp("pdbx_formal_charge")},beta:{"@desc":"float temperature factor","@examples":["beta < 20","beta > 35"],isNumeric:!0,regex:kd,map:e=>parseFloat(e),level:"atom-test",property:Ys.ammp("B_iso_or_equiv")},occupancy:{"@desc":"float occupancy","@examples":["occupancy 1","occupancy < 1"],isNumeric:!0,regex:kd,map:e=>parseFloat(e),level:"atom-test",property:Ys.ammp("occupancy")},user:{"@desc":"float time-varying user-specified value","@examples":["user < 0.1"],isUnsupported:!0,isNumeric:!0,regex:kd,map:e=>parseFloat(e),level:"atom-test"},rasmol:{"@desc":"str translates Rasmol selection string to VMD","@examples":["rasmol 'all'"],isUnsupported:!0,regex:/[^']*/,map:T_,level:"atom-test"},structure:{"@desc":"str single letter name for the secondary structure","@examples":["structure H","structure H E"],regex:/T|E|B|H|G|I|C/i,map:wH,level:"atom-test",property:Ys.ammp("secondaryStructureFlags")},phi:{"@desc":"float phi backbone conformational angles","@examples":["phi < 160"],isUnsupported:!0,isNumeric:!0,regex:kd,map:e=>parseFloat(e),level:"residue-test"},psi:{"@desc":"float psi backbone conformational angles","@examples":["psi < 160"],isUnsupported:!0,isNumeric:!0,regex:kd,map:e=>parseFloat(e),level:"residue-test"},ufx:{"@desc":"num force to apply in the x coordinate","@examples":["ufx 1"],isUnsupported:!0,isNumeric:!0,regex:kd,map:e=>parseInt(e),level:"atom-test"},ufy:{"@desc":"num force to apply in the y coordinate","@examples":["ufy 1"],isUnsupported:!0,isNumeric:!0,regex:kd,map:e=>parseInt(e),level:"atom-test"},ufz:{"@desc":"num force to apply in the z coordinate","@examples":["ufz 1"],isUnsupported:!0,isNumeric:!0,regex:kd,map:e=>parseInt(e),level:"atom-test"}},P_=pe,yJe=Object.keys(D_).sort(_g).filter(e=>!D_[e].isUnsupported).join("|"),Vfe=[{"@desc":"Selects atoms that are not included in s1.","@examples":["not protein"],name:"not",type:su,rule:Ye.regexp(/NOT/i).skip(Ye.whitespace),map:(e,t)=>kf(t)},{"@desc":"Selects atoms within a specified distance of a selection","@examples":["within 5 of name FE"],name:"within",type:su,rule:Pf(/WITHIN\s+([-+]?[0-9]*\.?[0-9]+)\s+OF/i,1).map(e=>parseFloat(e)),map:(e,t)=>P_.struct.modifier.includeSurroundings({0:t,radius:e})},{"@desc":"Exclusive within, equivalent to (within 3 of X) and not X","@examples":["exwithin 10 of resname HEM"],name:"exwithin",type:su,rule:Pf(/EXWITHIN\s+([-+]?[0-9]*\.?[0-9]+)\s+OF/i,1).map(e=>parseFloat(e)),map:(e,t)=>P_.struct.modifier.exceptBy({0:P_.struct.modifier.includeSurroundings({0:t,radius:e}),by:t})},{"@desc":"Selects atoms which have the same keyword as the atoms in a given selection","@examples":["same resid as name FE"],name:"same",type:su,rule:Pf(new RegExp(`SAME\\s+(${yJe})\\s+AS`,"i"),1).map(e=>D_[e].property),map:(e,t)=>P_.struct.filter.withSameAtomProperties({0:P_.struct.generator.all(),source:t,property:e})},{"@desc":"Selects atoms included in both s1 and s2.","@examples":["backbone and protein"],name:"and",type:$u,rule:Ye.alt(Fy(/AND/i),Ye.whitespace),map:(e,t,n)=>P_.struct.modifier.intersectBy({0:t,by:n})},{"@desc":"Selects atoms included in either s1 or s2.","@examples":["water or protein"],name:"or",type:$u,rule:Fy(/OR/i),map:(e,t,n)=>P_.struct.combinator.merge([t,n])}],Cr=pe;function Oy(){return Cr.struct.filter.pick({0:Cr.struct.generator.atomGroups({"group-by":Cr.ammp("residueKey")}),test:Cr.core.set.isSubset([Sg(["C","N","CA","O"]),Cr.ammpSet("label_atom_id")])})}function AH(){return Cr.struct.filter.pick({0:Cr.struct.generator.atomGroups({"group-by":Cr.ammp("residueKey")}),test:Cr.core.logic.and([Cr.core.set.isSubset([Sg(["P"]),Cr.ammpSet("label_atom_id")]),Cr.core.logic.or([Cr.core.set.isSubset([Sg(["O3'","C3'","C4'","C5'","O5'"]),Cr.ammpSet("label_atom_id")]),Cr.core.set.isSubset([Sg(["O3*","C3*","C4*","C5*","O5*"]),Cr.ammpSet("label_atom_id")])])])})}function Hfe(){return Cr.struct.combinator.merge([Cr.struct.generator.queryInSelection({0:Oy(),query:Cr.struct.generator.atomGroups({"atom-test":Cr.core.set.has([Sg(Gfe.protein),Cr.ammp("label_atom_id")])})}),Cr.struct.generator.queryInSelection({0:AH(),query:Cr.struct.generator.atomGroups({"atom-test":Cr.core.set.has([Sg(Gfe.nucleic),Cr.ammp("label_atom_id")])})})])}function wg(e){return Cr.struct.generator.atomGroups({"residue-test":Cr.core.flags.hasAll([Cr.ammp("secondaryStructureFlags"),Cr.struct.type.secondaryStructureFlags(e)])})}const Gfe={nucleic:["P","O3'","O5'","C5'","C4'","C3'","OP1","OP2","O3*","O5*","C5*","C4*","C3*"],protein:["C","N","CA","O"]},Aa={acidic:["ASP","GLU"],aliphatic:["ALA","GLY","ILE","LEU","VAL"],aromatic:["HIS","PHE","TRP","TYR"],at:["ADA","A","THY","T"],basic:["ARG","HIS","LYS"],buried:["ALA","LEU","VAL","ILE","PHE","CYS","MET","TRP"],cg:["CYT","C","GUA","G"],cyclic:["HIS","PHE","PRO","TRP","TYR"],hydrophobic:["ALA","LEU","VAL","ILE","PRO","PHE","MET","TRP"],medium:["VAL","THR","ASP","ASN","PRO","CYS","ASX","PCA","HYP"],neutral:["VAL","PHE","GLN","TYR","HIS","CYS","MET","TRP","ASX","GLX","PCA","HYP"],purine:["ADE","A","GUA","G"],pyrimidine:["CYT","C","THY","T","URI","U"],small:["ALA","GLY","SER"],water:["H2O","HH0","OHH","HOH","OH2","SOL","WAT","TIP","TIP2","TIP3","TIP4"]},qfe={all:{"@desc":"everything",map:()=>Cr.struct.generator.all()},none:{"@desc":"nothing",map:()=>Cr.struct.generator.empty()},protein:{"@desc":"a residue with atoms named C, N, CA, and O",map:()=>Oy()},nucleic:{"@desc":"a residue with atoms named P, O1P, O2P and either O3', C3', C4', C5', O5' or O3*, C3*, C4*, C5*, O5*. This definition assumes that the base is phosphorylated, an assumption which will be corrected in the future.",map:()=>AH()},backbone:{"@desc":"the C, N, CA, and O atoms of a protein and the equivalent atoms in a nucleic acid.",map:()=>Hfe()},sidechain:{"@desc":"non-backbone atoms and bonds",map:()=>kf(Hfe())},water:{"@desc":"all atoms with the resname H2O, HH0, OHH, HOH, OH2, SOL, WAT, TIP, TIP2, TIP3 or TIP4",abbr:["waters"],map:()=>ri(Aa.water)},at:{"@desc":"residues named ADA A THY T",map:()=>ri(Aa.at)},acidic:{"@desc":"residues named ASP GLU",map:()=>ri(Aa.acidic)},acyclic:{"@desc":'"protein and not cyclic"',map:()=>Cr.struct.modifier.intersectBy({0:Oy(),by:kf(ri(Aa.cyclic))})},aliphatic:{"@desc":"residues named ALA GLY ILE LEU VAL",map:()=>ri(Aa.aliphatic)},alpha:{"@desc":"atom's residue is an alpha helix",map:()=>wg(["alpha"])},amino:{"@desc":"a residue with atoms named C, N, CA, and O",map:()=>Oy()},aromatic:{"@desc":"residues named HIS PHE TRP TYR",map:()=>ri(Aa.aromatic)},basic:{"@desc":"residues named ARG HIS LYS",map:()=>ri(Aa.basic)},bonded:{"@desc":"atoms for which numbonds > 0",map:()=>Cg(Cr.struct.filter.pick({0:Cr.struct.modifier.includeConnected({0:Cr.struct.generator.all(),"bond-test":Cr.core.flags.hasAny([Cr.struct.bondProperty.flags(),Cr.struct.type.bondFlags(["covalent","metallic","sulfide"])])}),test:Cr.core.rel.gr([Cr.struct.atomSet.atomCount(),1])}))},buried:{"@desc":"residues named ALA LEU VAL ILE PHE CYS MET TRP",map:()=>ri(Aa.buried)},cg:{"@desc":"residues named CYT C GUA G",map:()=>ri(Aa.cg)},charged:{"@desc":'"basic or acidic"',map:()=>ri(Aa.basic.concat(Aa.acidic))},cyclic:{"@desc":"residues named HIS PHE PRO TRP TYR",map:()=>ri(Aa.cyclic)},hetero:{"@desc":'"not (protein or nucleic)"',map:()=>kf(Cr.struct.combinator.merge([Oy(),AH()]))},hydrogen:{"@desc":'name "[0-9]?H.*"',map:()=>Cr.struct.generator.atomGroups({"atom-test":Cr.core.str.match([Cr.core.type.regex(["^[0-9]?[H].*$","i"]),Cr.core.type.str([Cr.ammp("label_atom_id")])])})},large:{"@desc":'"protein and not (small or medium)"',map:()=>Cr.struct.modifier.intersectBy({0:Oy(),by:kf(ri(Aa.small.concat(Aa.medium)))})},medium:{"@desc":"residues named VAL THR ASP ASN PRO CYS ASX PCA HYP",map:()=>ri(Aa.medium)},neutral:{"@desc":"residues named VAL PHE GLN TYR HIS CYS MET TRP ASX GLX PCA HYP",map:()=>ri(Aa.neutral)},hydrophobic:{"@desc":"hydrophobic resname ALA LEU VAL ILE PRO PHE MET TRP",map:()=>ri(Aa.hydrophobic)},polar:{"@desc":'"protein and not hydrophobic"',map:()=>Cr.struct.modifier.intersectBy({0:Oy(),by:kf(ri(Aa.hydrophobic))})},purine:{"@desc":"residues named ADE A GUA G",map:()=>ri(Aa.purine)},pyrimidine:{"@desc":"residues named CYT C THY T URI U",map:()=>ri(Aa.pyrimidine)},small:{"@desc":"residues named ALA GLY SER",map:()=>ri(Aa.small)},surface:{"@desc":'"protein and not buried"',map:()=>Cr.struct.modifier.intersectBy({0:Oy(),by:kf(ri(Aa.buried))})},alpha_helix:{"@desc":"atom's residue is in an alpha helix",map:()=>wg(["alpha"])},pi_helix:{"@desc":"atom's residue is in a pi helix",map:()=>wg(["pi"])},helix_3_10:{"@desc":"atom's residue is in a 3-10 helix",map:()=>wg(["3-10"])},helix:{"@desc":"atom's residue is in an alpha or pi or 3-10 helix",map:()=>wg(["helix"])},extended_beta:{"@desc":"atom's residue is a beta sheet",map:()=>wg(["sheet"])},bridge_beta:{"@desc":"atom's residue is a beta sheet",map:()=>wg(["strand"])},sheet:{"@desc":"atom's residue is a beta sheet",map:()=>wg(["beta"])},turn:{"@desc":"atom's residue is in a turn conformation",map:()=>wg(["turn"])},coil:{"@desc":"atom's residue is in a coil conformation",map:()=>Cr.struct.modifier.intersectBy({0:Oy(),by:wg(["none"])})}},Lc=pe,bJe={sqr:{"@desc":"square of x","@examples":["sqr(2)"],map:e=>Lc.core.math.pow([e,2])},sqrt:{"@desc":"square root of x","@examples":["sqrt(2)"],map:e=>Lc.core.math.sqrt([e])},abs:{"@desc":"absolute value of x","@examples":["abs(2)"],map:e=>Lc.core.math.abs([e])},floor:{"@desc":"largest integer not greater than x","@examples":["floor(2)"],map:e=>Lc.core.math.floor([e])},ceil:{"@desc":"smallest integer not less than x","@examples":["ceil(2)"],map:e=>Lc.core.math.ceil([e])},sin:{"@desc":"sine of x","@examples":["sin(2)"],map:e=>Lc.core.math.sin([e])},cos:{"@desc":"cosine of x","@examples":["cos(2)"],map:e=>Lc.core.math.cos([e])},tan:{"@desc":"tangent of x","@examples":["tan(2)"],map:e=>Lc.core.math.tan([e])},atan:{"@desc":"arctangent of x","@examples":["atan(2)"],map:e=>Lc.core.math.atan([e])},asin:{"@desc":"arcsin of x","@examples":["asin(2)"],map:e=>Lc.core.math.asin([e])},acos:{"@desc":"arccos of x","@examples":["acos(2)"],map:e=>Lc.core.math.acos([e])},sinh:{"@desc":"hyperbolic sine of x","@examples":["sinh(2)"],map:e=>Lc.core.math.sinh([e])},cosh:{"@desc":"hyperbolic cosine of x","@examples":["cosh(2)"],map:e=>Lc.core.math.cosh([e])},tanh:{"@desc":"hyperbolic tangent of x","@examples":["tanh(2)"],map:e=>Lc.core.math.tanh([e])},exp:{"@desc":"e to the power x","@examples":["exp(2)"],map:e=>Lc.core.math.exp([e])},log:{"@desc":"natural log of x","@examples":["log(2)"],map:e=>Lc.core.math.log([e])},log10:{"@desc":"log base 10 of x","@examples":["log10(2)"],map:e=>Lc.core.math.log10([e])}},Jo=pe,vJe=[{"@desc":"multiplication, division","@examples":[],name:"mul-div",type:$u,rule:Ye.regexp(/\s*(\*|\/)\s*/,1),map:(e,t,n)=>{switch(e){case"*":return Jo.core.math.mult([t,n]);case"/":return Jo.core.math.div([t,n]);default:throw new Error(`value operator '${e}' not supported`)}}},{"@desc":"addition, substraction","@examples":[],name:"add-sub",type:$u,rule:Ye.regexp(/\s*(-|\+)\s*/,1),map:(e,t,n)=>{switch(e){case"-":return Jo.core.math.sub([t,n]);case"+":return Jo.core.math.add([t,n]);default:throw new Error(`value operator '${e}' not supported`)}}},{"@desc":"value comparisons","@examples":[],name:"comparison",type:$u,rule:Ye.alt(Ye.regexp(/\s*(=~|==|>=|<=|=|!=|>|<)\s*/,1),Ye.whitespace.result("=")),map:(e,t,n)=>{let r;if(void 0!==t.head?("structure-query.atom-property.macromolecular.secondary-structure-flags"===t.head.name&&(r=Jo.core.flags.hasAny([t,wH(n)])),"core.type.regex"===t.head.name&&(r=Jo.core.str.match([t,Jo.core.type.str([n])]))):void 0!==n.head?("structure-query.atom-property.macromolecular.secondary-structure-flags"===n.head.name&&(r=Jo.core.flags.hasAny([n,wH(t)])),"core.type.regex"===n.head.name&&(r=Jo.core.str.match([n,Jo.core.type.str([t])]))):"=~"===e&&(r=Jo.core.str.match(t.head?[Jo.core.type.regex([`^${n}$`,"i"]),Jo.core.type.str([t])]:[Jo.core.type.regex([`^${t}$`,"i"]),Jo.core.type.str([n])])),!r)switch(t.head&&(n=VD(t,n)),n.head&&(t=VD(n,t)),e){case"=":case"==":r=Jo.core.rel.eq([t,n]);break;case"!=":r=Jo.core.rel.neq([t,n]);break;case">":r=Jo.core.rel.gr([t,n]);break;case"<":r=Jo.core.rel.lt([t,n]);break;case">=":r=Jo.core.rel.gre([t,n]);break;case"<=":r=Jo.core.rel.lte([t,n]);break;default:throw new Error(`value operator '${e}' not supported`)}return Jo.struct.generator.atomGroups({"atom-test":r})}}],xJe=Ye.createLanguage({Parens:function(e){return Ye.alt(e.Parens,e.Operator,e.Expression).wrap(Ye.string("("),Ye.string(")"))},Expression:function(e){return Ye.alt(e.RangeListProperty,e.ValueQuery,e.Keywords)},NamedAtomProperties:function(){return Ye.alt(...Dfe(D_))},Keywords:()=>Ye.alt(...xH(qfe)),ValueRange:function(e){return Ye.seq(e.Value.skip(Ye.regexp(/\s+TO\s+/i)),e.Value).map(t=>({range:t}))},RangeListProperty:function(e){return Ye.seq(Ye.alt(..._H(D_,/\s/)).skip(Ye.whitespace),Ye.alt(e.ValueRange,e.Value).sepBy1(Ye.whitespace)).map(t=>{const[n,r]=t,i=[],o=[];r.forEach(c=>{c.range?o.push(Jo.core.rel.inRange([n,c.range[0],c.range[1]])):i.push(VD(n,c,zfe))});const s=function $Qe(e){return 1===e.length?e[0]:e.length>1?lo.core.logic.or(e):void 0}(o),a=function tJe(e,t){if(eJe.includes(e.head.name)){const n=t[0].head,r=[];return t.forEach(i=>r.push(...i.args[0])),lo.core.flags.hasAny([e,{head:n,args:r}])}return 1===t.length?lo.core.rel.eq([e,t[0]]):t.length>1?lo.core.set.has([lo.core.type.set(t),e]):void 0}(n,i);let l;return l=s&&a?Jo.core.logic.or([s,a]):s||a,Jo.struct.generator.atomGroups({[JQe(n)]:l})})},Operator:function(e){return zD(Vfe,Ye.alt(e.Parens,e.Expression,e.ValueQuery))},Query:function(e){return Ye.alt(e.Operator,e.Parens,e.Expression).trim(Ye.optWhitespace)},Number:function(){return Ye.regexp(/-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?/).map(Number).desc("number")},String:function(){const e=SH(D_,qfe,Vfe).sort(_g).map(w3).join("|");return Ye.alt(Ye.regexp(new RegExp(`(?!(${e}))[A-Z0-9_]+`,"i")),Ye.regexp(/'((?:[^"\\]|\\.)*)'/,1),Ye.regexp(/"((?:[^"\\]|\\.)*)"/,1).map(t=>Jo.core.type.regex([`^${t}$`,"i"]))).desc("string")},Value:function(e){return Ye.alt(e.Number,e.String)},ValueParens:function(e){return Ye.alt(e.ValueParens,e.ValueOperator,e.ValueExpressions).wrap(Ye.string("("),Ye.string(")"))},ValuePropertyNames:function(){return Ye.alt(..._H(D_,/=~|==|>=|<=|=|!=|>|<|\)|\s|\+|-|\*|\//i))},ValueOperator:function(e){return zD(vJe,Ye.alt(e.ValueParens,e.ValueExpressions))},ValueExpressions:function(e){return Ye.alt(e.ValueFunctions,e.Value,e.ValuePropertyNames)},ValueFunctions:function(e){return Ye.alt(...function XQe(e,t){const n=[],r=Ye.regexp(/\(\s*/),i=Ye.regexp(/\s*\)/);return Object.keys(e).sort(_g).forEach(o=>{const s=e[o],a=s.map?s.map:q1(`function '${o}' not supported`),l=Ye.regexp(new RegExp(o,"i")).skip(r).then(t).skip(i).map(a);n.push(l)}),n}(bJe,e.ValueOperator))},ValueQuery:function(e){return Ye.alt(e.ValueOperator.map(t=>{if(!t.head.name||!t.head.name.startsWith("structure-query.generator"))throw new Error(`values must be part of an comparison, value '${t}'`);return t}))}}),_Je={pymol:e=>mJe.Query.tryParse(e),vmd:e=>xJe.Query.tryParse(e),jmol:e=>aJe.Query.tryParse(e)},UN=new class CJe{constructor(){this.map=new Map}removeSymbol(t){this.map.delete(t.symbol.id)}addSymbol(t){this.map.has(t.symbol.id)&&console.warn(`Symbol '${t.symbol.id}' already added. Call removeSymbol/removeCustomProps re-adding the symbol.`),this.map.set(t.symbol.id,t)}addCustomProp(t){if(t.symbols)for(const n of Object.keys(t.symbols))this.addSymbol(t.symbols[n])}removeCustomProp(t){if(t.symbols)for(const n of Object.keys(t.symbols))this.removeSymbol(t.symbols[n])}getRuntime(t){return this.map.get(t)}};class wJe{constructor(t){this.table=t,this.constQueryContext=new _f(Xe.Empty)}}var Wfe,k_,WD,iA;!function(e){e.Const=function t(r){return{kind:"const",value:r}},e.Dynamic=function n(r){return{kind:"dynamic",runtime:r}}}(Wfe||(Wfe={})),function(e){e.Const=function t(r){return{isConst:!0,fn:function(o){return r}}},e.Dynamic=function n(r){return{isConst:!1,fn:r}}}(k_||(k_={})),function(e){e.forEachEval=function t(n,r,i,o){if("number"==typeof n.length)for(let s=0,a=n.length;so[i]=r,[])}),Ln(Ee.core.type.set,function(t,n){return WD.forEachEval(n,t,function(i,o,s){return s.add(i)},new Set)}),Ln(Ee.core.type.regex,function(t,n){return new RegExp(n[0](t),n[1]&&n[1](t)||"")}),Ln(Ee.core.type.bitflags,function(t,n){return+n[0](t)}),Ln(Ee.core.type.compositeKey,function(t,n){return WD.forEachEval(n,t,(r,i,o)=>o[i]=""+r,[]).join("-")}),Ln(Ee.core.logic.not,(e,t)=>!t[0](e)),Ln(Ee.core.logic.and,(e,t)=>{if("number"==typeof t.length){for(let n=0,r=t.length;n{if("number"==typeof t.length){for(let n=0,r=t.length;nt[0](e)===t[1](e)),Ln(Ee.core.rel.neq,(e,t)=>t[0](e)!==t[1](e)),Ln(Ee.core.rel.lt,(e,t)=>t[0](e)t[0](e)<=t[1](e)),Ln(Ee.core.rel.gr,(e,t)=>t[0](e)>t[1](e)),Ln(Ee.core.rel.gre,(e,t)=>t[0](e)>=t[1](e)),Ln(Ee.core.rel.inRange,(e,t)=>{const n=t[0](e);return n>=t[1](e)&&n<=t[2](e)}),Ln(Ee.core.math.add,(e,t)=>{let n=0;if("number"==typeof t.length)for(let r=0,i=t.length;r{let n=0;if("number"==typeof t.length){if(1===t.length)return-t[0](e);n=t[0](e)||0;for(let r=1,i=t.length;r{let n=1;if("number"==typeof t.length)for(let r=0,i=t.length;rt[0](e)/t[1](e)),Ln(Ee.core.math.pow,(e,t)=>Math.pow(t[0](e),t[1](e))),Ln(Ee.core.math.mod,(e,t)=>t[0](e)%t[1](e)),Ln(Ee.core.math.min,(e,t)=>{let n=Number.POSITIVE_INFINITY;if("number"==typeof t.length)for(let r=0,i=t.length;r{let n=Number.NEGATIVE_INFINITY;if("number"==typeof t.length)for(let r=0,i=t.length;rgf(t[0](e),t[1](e))),Ln(Ee.core.math.sortedCantorPairing,(e,t)=>v3(t[0](e),t[1](e))),Ln(Ee.core.math.invertCantorPairing,(e,t)=>Coe([0,0],t[0](e))),Ln(Ee.core.math.floor,(e,t)=>Math.floor(t[0](e))),Ln(Ee.core.math.ceil,(e,t)=>Math.ceil(t[0](e))),Ln(Ee.core.math.roundInt,(e,t)=>Math.round(t[0](e))),Ln(Ee.core.math.trunc,(e,t)=>Math.trunc(t[0](e))),Ln(Ee.core.math.abs,(e,t)=>Math.abs(t[0](e))),Ln(Ee.core.math.sign,(e,t)=>Math.sign(t[0](e))),Ln(Ee.core.math.sqrt,(e,t)=>Math.sqrt(t[0](e))),Ln(Ee.core.math.cbrt,(e,t)=>Math.cbrt(t[0](e))),Ln(Ee.core.math.sin,(e,t)=>Math.sin(t[0](e))),Ln(Ee.core.math.cos,(e,t)=>Math.cos(t[0](e))),Ln(Ee.core.math.tan,(e,t)=>Math.tan(t[0](e))),Ln(Ee.core.math.asin,(e,t)=>Math.asin(t[0](e))),Ln(Ee.core.math.acos,(e,t)=>Math.acos(t[0](e))),Ln(Ee.core.math.atan,(e,t)=>Math.atan(t[0](e))),Ln(Ee.core.math.sinh,(e,t)=>Math.sinh(t[0](e))),Ln(Ee.core.math.cosh,(e,t)=>Math.cosh(t[0](e))),Ln(Ee.core.math.tanh,(e,t)=>Math.tanh(t[0](e))),Ln(Ee.core.math.exp,(e,t)=>Math.exp(t[0](e))),Ln(Ee.core.math.log,(e,t)=>Math.log(t[0](e))),Ln(Ee.core.math.log10,(e,t)=>Math.log10(t[0](e))),Ln(Ee.core.math.atan2,(e,t)=>Math.atan2(t[0](e),t[1](e))),Ln(Ee.core.str.match,(e,t)=>t[0](e).test(t[1](e))),Ln(Ee.core.str.concat,(e,t)=>{const n=[];if("number"==typeof t.length)for(let r=0,i=t.length;rt[0](e)[t[1](e)]),Ln(Ee.core.list.equal,(e,t)=>IU(t[0](e),t[1](e))),Ln(Ee.core.set.has,function(t,n){return n[0](t).has(n[1](t))}),Ln(Ee.core.set.isSubset,function(t,n){return Lo.isSuperset(n[1](t),n[0](t))}),Ln(Ee.core.flags.hasAny,(e,t)=>{const n=t[1](e),r=t[0](e);return n?!!(r&n):!!r}),Ln(Ee.core.flags.hasAll,(e,t)=>{const n=t[1](e),r=t[0](e);return n?(r&n)===n:!r}),Ln(Ee.structureQuery.type.elementSymbol,(e,t)=>Jx(t[0](e))),Ln(Ee.structureQuery.type.atomName,(e,t)=>function KLe(e){return e?"string"==typeof e?e.toUpperCase():`${e}`.toUpperCase():""}(t[0](e))),Ln(Ee.structureQuery.type.bondFlags,(e,t)=>{let n=0;if("number"==typeof t.length)for(let r=0,i=t.length;rfp.elementFingerprint(function IJe(e,t){const n=[];if(!t)return n;if("number"==typeof t.length)for(let r=0,i=t.length;r{let n=0;if("number"==typeof t.length)for(let r=0,i=t.length;r_i.filters.pick(t[0],t.test)(e)),mn(Ee.structureQuery.filter.first,(e,t)=>_i.filters.first(t[0])(e)),mn(Ee.structureQuery.filter.withSameAtomProperties,(e,t)=>_i.filters.withSameAtomProperties(t[0],t.source,t.property)(e)),mn(Ee.structureQuery.filter.intersectedBy,(e,t)=>_i.filters.areIntersectedBy(t[0],t.by)(e)),mn(Ee.structureQuery.filter.within,(e,t)=>{var n,r,i;return _i.filters.within({query:t[0],target:t.target,minRadius:null===(n=t["min-radius"])||void 0===n?void 0:n.call(t,e),maxRadius:null===(r=t["max-radius"])||void 0===r?void 0:r.call(t,e),elementRadius:t["atom-radius"],invert:null===(i=t.invert)||void 0===i?void 0:i.call(t,e)})(e)}),mn(Ee.structureQuery.filter.isConnectedTo,(e,t)=>{var n,r;return _i.filters.isConnectedTo({query:t[0],target:t.target,disjunct:null===(n=t.disjunct)||void 0===n?void 0:n.call(t,e),invert:null===(r=t.invert)||void 0===r?void 0:r.call(t,e),bondTest:t["bond-test"]})(e)}),mn(Ee.structureQuery.generator.atomGroups,function(t,n){return _i.generators.atoms({entityTest:n["entity-test"],chainTest:n["chain-test"],residueTest:n["residue-test"],atomTest:n["atom-test"],groupBy:n["group-by"]})(t)}),mn(Ee.structureQuery.generator.all,function(t){return _i.generators.all(t)}),mn(Ee.structureQuery.generator.empty,function(t){return _i.generators.none(t)}),mn(Ee.structureQuery.generator.bondedAtomicPairs,function(t,n){return _i.generators.bondedAtomicPairs(n&&n[0])(t)}),mn(Ee.structureQuery.generator.rings,function(t,n){var r,i;return _i.generators.rings(null===(r=n?.fingerprint)||void 0===r?void 0:r.call(n,t),null===(i=n?.["only-aromatic"])||void 0===i?void 0:i.call(n,t))(t)}),mn(Ee.structureQuery.generator.queryInSelection,function(t,n){var r;return _i.generators.querySelection(n[0],n.query,null===(r=n["in-complement"])||void 0===r?void 0:r.call(n,t))(t)}),mn(Ee.structureQuery.modifier.includeSurroundings,function(t,n){return _i.modifiers.includeSurroundings(n[0],{radius:n.radius(t),wholeResidues:!(!n["as-whole-residues"]||!n["as-whole-residues"](t)),elementRadius:n["atom-radius"]})(t)}),mn(Ee.structureQuery.modifier.surroundingLigands,function(t,n){return _i.modifiers.surroundingLigands({query:n[0],radius:n.radius(t),includeWater:!(!n["include-water"]||!n["include-water"](t))})(t)}),mn(Ee.structureQuery.modifier.wholeResidues,function(t,n){return _i.modifiers.wholeResidues(n[0])(t)}),mn(Ee.structureQuery.modifier.union,function(t,n){return _i.modifiers.union(n[0])(t)}),mn(Ee.structureQuery.modifier.expandProperty,function(t,n){return _i.modifiers.expandProperty(n[0],n.property)(t)}),mn(Ee.structureQuery.modifier.exceptBy,function(t,n){return _i.modifiers.exceptBy(n[0],n.by)(t)}),mn(Ee.structureQuery.modifier.includeConnected,function(t,n){var r,i;return _i.modifiers.includeConnected({query:n[0],bondTest:n["bond-test"],wholeResidues:!(!n["as-whole-residues"]||!n["as-whole-residues"](t)),layerCount:n["layer-count"]&&n["layer-count"](t)||1,fixedPoint:null!==(i=null===(r=n["fixed-point"])||void 0===r?void 0:r.call(n,t))&&void 0!==i&&i})(t)}),mn(Ee.structureQuery.modifier.intersectBy,function(t,n){return _i.modifiers.intersectBy(n[0],n.by)(t)}),mn(Ee.structureQuery.combinator.merge,(e,t)=>_i.combinators.merge(t)(e)),mn(Ee.structureQuery.atomProperty.core.elementSymbol,eo(Je.atom.type_symbol)),mn(Ee.structureQuery.atomProperty.core.vdw,(e,t)=>B3(Je.atom.type_symbol(t&&t[0]&&t[0](e)||e.element))),mn(Ee.structureQuery.atomProperty.core.mass,(e,t)=>function GUe(e){const t=v5[e];return void 0===t?10.81:UUe[t]}(Je.atom.type_symbol(t&&t[0]&&t[0](e)||e.element))),mn(Ee.structureQuery.atomProperty.core.atomicNumber,(e,t)=>L3(Je.atom.type_symbol(t&&t[0]&&t[0](e)||e.element))),mn(Ee.structureQuery.atomProperty.core.x,eo(Je.atom.x)),mn(Ee.structureQuery.atomProperty.core.y,eo(Je.atom.y)),mn(Ee.structureQuery.atomProperty.core.z,eo(Je.atom.z)),mn(Ee.structureQuery.atomProperty.core.sourceIndex,eo(Je.atom.sourceIndex)),mn(Ee.structureQuery.atomProperty.core.operatorName,eo(Je.unit.operator_name)),mn(Ee.structureQuery.atomProperty.core.operatorKey,eo(Je.unit.operator_key)),mn(Ee.structureQuery.atomProperty.core.modelIndex,eo(Je.unit.model_index)),mn(Ee.structureQuery.atomProperty.core.modelLabel,eo(Je.unit.model_label)),mn(Ee.structureQuery.atomProperty.core.atomKey,(e,t)=>{const n=t&&t[0]&&t[0](e)||e.element;return gf(n.unit.id,n.element)}),mn(Ee.structureQuery.atomProperty.macromolecular.residueKey,(e,t)=>function WVe(e){return ze.isAtomic(e.unit)?e.unit.residueIndex[e.element]:-1}(t&&t[0]&&t[0](e)||e.element)),mn(Ee.structureQuery.atomProperty.macromolecular.chainKey,(e,t)=>function $Ve(e){return ze.isAtomic(e.unit)?e.unit.chainIndex[e.element]:-1}(t&&t[0]&&t[0](e)||e.element)),mn(Ee.structureQuery.atomProperty.macromolecular.entityKey,(e,t)=>function YVe(e){return Je.entity.key(e)}(t&&t[0]&&t[0](e)||e.element)),mn(Ee.structureQuery.atomProperty.macromolecular.id,eo(Je.atom.id)),mn(Ee.structureQuery.atomProperty.macromolecular.isHet,(e,t)=>"ATOM"!==Je.residue.group_PDB(t&&t[0]&&t[0](e)||e.element)),mn(Ee.structureQuery.atomProperty.macromolecular.label_atom_id,eo(Je.atom.label_atom_id)),mn(Ee.structureQuery.atomProperty.macromolecular.label_alt_id,eo(Je.atom.label_alt_id)),mn(Ee.structureQuery.atomProperty.macromolecular.label_comp_id,eo(Je.atom.label_comp_id)),mn(Ee.structureQuery.atomProperty.macromolecular.label_seq_id,eo(Je.residue.label_seq_id)),mn(Ee.structureQuery.atomProperty.macromolecular.label_asym_id,eo(Je.chain.label_asym_id)),mn(Ee.structureQuery.atomProperty.macromolecular.label_entity_id,eo(Je.entity.id)),mn(Ee.structureQuery.atomProperty.macromolecular.auth_atom_id,eo(Je.atom.auth_atom_id)),mn(Ee.structureQuery.atomProperty.macromolecular.auth_comp_id,eo(Je.atom.auth_comp_id)),mn(Ee.structureQuery.atomProperty.macromolecular.auth_seq_id,eo(Je.residue.auth_seq_id)),mn(Ee.structureQuery.atomProperty.macromolecular.auth_asym_id,eo(Je.chain.auth_asym_id)),mn(Ee.structureQuery.atomProperty.macromolecular.pdbx_PDB_ins_code,eo(Je.residue.pdbx_PDB_ins_code)),mn(Ee.structureQuery.atomProperty.macromolecular.pdbx_formal_charge,eo(Je.atom.pdbx_formal_charge)),mn(Ee.structureQuery.atomProperty.macromolecular.occupancy,eo(Je.atom.occupancy)),mn(Ee.structureQuery.atomProperty.macromolecular.B_iso_or_equiv,eo(Je.atom.B_iso_or_equiv)),mn(Ee.structureQuery.atomProperty.macromolecular.entityType,eo(Je.entity.type)),mn(Ee.structureQuery.atomProperty.macromolecular.entitySubtype,eo(Je.entity.subtype)),mn(Ee.structureQuery.atomProperty.macromolecular.entityPrdId,eo(Je.entity.prd_id)),mn(Ee.structureQuery.atomProperty.macromolecular.entityDescription,eo(Je.entity.pdbx_description)),mn(Ee.structureQuery.atomProperty.macromolecular.objectPrimitive,eo(Je.unit.object_primitive)),mn(Ee.structureQuery.atomProperty.macromolecular.isNonStandard,eo(Je.residue.isNonStandard)),mn(Ee.structureQuery.atomProperty.macromolecular.secondaryStructureKey,eo(Je.residue.secondary_structure_key)),mn(Ee.structureQuery.atomProperty.macromolecular.secondaryStructureFlags,eo(Je.residue.secondary_structure_type)),mn(Ee.structureQuery.atomProperty.macromolecular.chemCompType,eo(Je.residue.chem_comp_type)),mn(Ee.structureQuery.atomSet.atomCount,function(t,n){return _i.atomset.atomCount(t)}),mn(Ee.structureQuery.atomSet.countQuery,function(t,n){return _i.atomset.countQuery(n[0])(t)}),mn(Ee.structureQuery.atomSet.propertySet,function(t,n){return _i.atomset.propertySet(n[0])(t)}),mn(Ee.structureQuery.bondProperty.order,(e,t)=>e.atomicBond.order),mn(Ee.structureQuery.bondProperty.flags,(e,t)=>e.atomicBond.type),mn(Ee.structureQuery.bondProperty.key,(e,t)=>e.atomicBond.key),mn(Ee.structureQuery.bondProperty.atomA,(e,t)=>e.atomicBond.a),mn(Ee.structureQuery.bondProperty.atomB,(e,t)=>e.atomicBond.b),mn(Ee.structureQuery.bondProperty.length,(e,t)=>e.atomicBond.length),mn(Ee.internal.generator.bundleElement,function(t,n){return aae(n.groupedUnits(t),n.ranges(t),n.set(t))}),mn(Ee.internal.generator.bundle,function(t,n){return lae(n.elements(t))(t)}),mn(Ee.internal.generator.current,function(t,n){return t.tryGetCurrentSelection()})];function eo(e){return(t,n)=>e(n&&n[0]&&n[0](t)||t.element)}function Xfe(e,t){return e|(Lr.isName(t)?Lr.fromName(t):0)}function Kfe(e,t){switch(t.toLowerCase()){case"helix":return 2|e;case"alpha":return 4098|e;case"pi":return 32770|e;case"310":return 2050|e;case"beta":return 4|e;case"strand":return 4194308|e;case"sheet":return 8388612|e;case"turn":return 16|e;case"bend":return 8|e;case"coil":return 536870912|e;default:return e}}function pa(e,t){return{expression:e,language:t}}!function(){for(const e of AJe)UN.addSymbol(e)}(),function(e){function r(a){switch(a.language){case"mol-script":const l=function WQe(e){return mH.parse(e)}(a.expression);if(0===l.length)throw new Error("No query");return jQe(l[0]);case"pymol":case"jmol":case"vmd":return function SJe(e,t){try{return _Je[e](t)}catch(n){throw console.error(n.message),n}}(a.language,a.expression);default:Hi()}}function i(a){return M_(r(a))}e.Info={"mol-script":"Mol-Script",pymol:"PyMOL",vmd:"VMD",jmol:"Jmol"},e.is=function t(a){return!!a&&"string"==typeof a.expression&&!!a.language},e.areEqual=function n(a,l){return a.language===l.language&&a.expression===l.expression},e.toExpression=r,e.toQuery=i,e.toLoci=function o(a,l){const u=i(a)(new _f(l));return Dt.toLociWithSourceUnits(u)},e.getStructureSelection=function s(a,l,c){return M_("function"==typeof a?a(pe):a)(new _f(l,c))}}(pa||(pa={}));const oA={dynamicBonds:I.Optional(I.Boolean(!1,{description:"Ensure bonds are recalculated upon model changes. Also enables calculation of inter-unit bonds in water molecules and ions."}))};var R_,lu;!function(e){function r(p,m,h,g,y){return i.apply(this,arguments)}function i(){return(i=le(function*(p,m,h,g,y){let v;const x=Vs.Provider.get(h);!g&&x&&0!==x.assemblies.length&&(g=x.assemblies[0].id),x&&0!==x.assemblies.length?(v=M3.findAssembly(h,g||""),v||p.log.warn(`Model '${h.entryId}' has no assembly called '${g}', returning model structure.`)):p.log.warn(`Model '${h.entryId}' has no assembly, returning model structure.`);const _=Xe.ofModel(h,y);if(!v){const M={label:"Model",description:Xe.elementDescription(_)};return new Se.Molecule.Structure(_,M)}g=v.id;const w=yield lg.buildAssembly(_,g).runInContext(m),A={label:`Assembly ${g}`,description:Xe.elementDescription(w)};return new Se.Molecule.Structure(w,A)})).apply(this,arguments)}function s(){return(s=le(function*(p,m,h,g,y){const v=Xe.ofModel(m,y),x=yield lg.buildSymmetryRange(v,h,g).runInContext(p),_={label:`Symmetry [${h}] to [${g}]`,description:Xe.elementDescription(x)};return new Se.Molecule.Structure(x,_)})).apply(this,arguments)}function l(){return(l=le(function*(p,m,h,g){const y=Xe.ofModel(m,g),v=yield lg.builderSymmetryMates(y,h).runInContext(p),x={label:"Symmetry Mates",description:Xe.elementDescription(v)};return new Se.Molecule.Structure(v,x)})).apply(this,arguments)}function u(){return(u=le(function*(p,m,h,g,y){const v=Xe.ofModel(m,y),x=yield lg.buildSymmetryAssembly(v,h,g).runInContext(p),_={label:"Symmetry Assembly",description:Xe.elementDescription(x)};return new Se.Molecule.Structure(x,_)})).apply(this,arguments)}function f(){return f=le(function*(p,m,h,g){const y=g?.params,v=Vs.Provider.get(h);if(!v||!g||"model"===g.name){const x=Xe.ofModel(h,y);return new Se.Molecule.Structure(x,{label:"Model",description:Xe.elementDescription(x)})}if("auto"===g.name){if(0===v.assemblies.length){const x=Xe.ofModel(h,y);return new Se.Molecule.Structure(x,{label:"Model",description:Xe.elementDescription(x)})}return r(p,m,h,void 0,y)}return"assembly"===g.name?r(p,m,h,g.params.id,y):"symmetry"===g.name?function o(p,m,h,g,y){return s.apply(this,arguments)}(m,h,g.params.ijkMin,g.params.ijkMax,y):"symmetry-mates"===g.name?function a(p,m,h,g){return l.apply(this,arguments)}(m,h,g.params.radius,y):"symmetry-assembly"===g.name?function c(p,m,h,g,y){return u.apply(this,arguments)}(m,h,g.params.generators,v,y):void Hi()}),f.apply(this,arguments)}e.getParams=function t(p,m){const h=p&&Vs.Provider.get(p),g=h?h.assemblies.map(A=>[A.id,`${A.id}: ${yf(A.details)}`]):[],y=!h||!Qc.isZero(h.spacegroup.cell),v=[];if(h){const{operators:A}=h.spacegroup;for(let M=0,E=A.length;M{x.push([A.id,A.id===A.auth_id?A.id:`${A.id} [auth ${A.auth_id}]`])});const _={auto:I.Group(oA),model:I.Group(oA),assembly:I.Group({id:I.Optional(p?I.Select(g.length?g[0][0]:"",g,{label:"Asm Id",description:"Assembly Id"}):I.Text("",{label:"Asm Id",description:"Assembly Id (use empty for the 1st assembly)"})),...oA},{isFlat:!0}),"symmetry-mates":I.Group({radius:I.Numeric(5,{min:0,max:50,step:1}),...oA},{isFlat:!0}),symmetry:I.Group({ijkMin:I.Vec3(C.create(-1,-1,-1),{step:1},{label:"Min IJK",fieldLabels:{x:"I",y:"J",z:"K"}}),ijkMax:I.Vec3(C.create(1,1,1),{step:1},{label:"Max IJK",fieldLabels:{x:"I",y:"J",z:"K"}}),...oA},{isFlat:!0}),"symmetry-assembly":I.Group({generators:I.ObjectList({operators:I.ObjectList({index:I.Select(0,v),shift:I.Vec3(C(),{step:1},{label:"IJK",fieldLabels:{x:"I",y:"J",z:"K"}})},A=>`${A.index+1}_${A.shift.map(M=>M+5).join("")}`,{defaultValue:[]}),asymIds:I.MultiSelect([],x)},A=>`${A.asymIds.length} asym ids, ${A.operators.length} operators`,{defaultValue:[]}),...oA},{isFlat:!0})},w=[];return"auto"===m&&w.push(["auto","Auto"]),w.push(["model","Model"]),g.length>0&&w.push(["assembly","Assembly"]),y&&(w.push(["symmetry-mates","Symmetry Mates"]),w.push(["symmetry","Symmetry (indices)"]),w.push(["symmetry-assembly","Symmetry (assembly)"])),{type:I.MappedStatic(m||"model",_,{options:w})}},e.canAutoUpdate=function n(p,m){return!("symmetry-assembly"===m.name||"symmetry"===m.name&&"symmetry"===p.name)},e.create=function d(p,m,h,g){return f.apply(this,arguments)}}(R_||(R_={})),function(e){function n(a,l){const c=pa.is(l)?l:void 0,u=pa.is(l)?pa.toExpression(l):l;return{script:c,expression:u,compiled:M_(u),originalStructure:a,currentStructure:a}}function r(a,l){return a.compiled(new _f(l))}e.isUnchanged=function t(a,l,c){return a.currentStructure===c&&(pa.is(l)?!!a.script&&pa.areEqual(a.script,l):a.expression===l)},e.create=n,e.run=r,e.createAndRun=function i(a,l){const c=n(a,l);return{entry:c,selection:r(c,a)}},e.updateStructure=function o(a,l){return a.currentStructure=l,a.compiled(new _f(l))},e.updateStructureObject=function s(a,l,c){const u=Dt.unionStructure(l);a.label=`${c||"Selection"}`,a.description=Xe.elementDescription(u),a.data=u}}(lu||(lu={}));const EJe={H:"Hydrogen",HE:"Helium",LI:"Lithium",BE:"Beryllium",B:"Boron",C:"Carbon",N:"Nitrogen",O:"Oxygen",F:"Fluorine",NE:"Neon",NA:"Sodium",MG:"Magnesium",AL:"Aluminum",SI:"Silicon",P:"Phosphorus",S:"Sulfur",CL:"Chlorine",AR:"Argon",K:"Potassium",CA:"Calcium",SC:"Scandium",TI:"Titanium",V:"Vanadium",CR:"Chromium",MN:"Manganese",FE:"Iron",CO:"Cobalt",NI:"Nickel",CU:"Copper",ZN:"Zinc",GA:"Gallium",GE:"Germanium",AS:"Arsenic",SE:"Selenium",BR:"Bromine",KR:"Krypton",RB:"Rubidium",SR:"Strontium",Y:"Yttrium",ZR:"Zirconium",NB:"Niobium",MO:"Molybdenum",TC:"Technetium",RU:"Ruthenium",RH:"Rhodium",PD:"Palladium",AG:"Silver",CD:"Cadmium",IN:"Indium",SN:"Tin",SB:"Antimony",TE:"Tellurium",I:"Iodine",XE:"Xenon",CS:"Cesium",BA:"Barium",LA:"Lanthanum",CE:"Cerium",PR:"Praseodymium",ND:"Neodymium",PM:"Promethium",SM:"Samarium",EU:"Europium",GD:"Gadolinium",TB:"Terbium",DY:"Dysprosium",HO:"Holmium",ER:"Erbium",TM:"Thulium",YB:"Ytterbium",LU:"Lutetium",HF:"Hafnium",TA:"Tantalum",W:"Wolfram",RE:"Rhenium",OS:"Osmium",IR:"Iridium",PT:"Platinum",AU:"Gold",HG:"Mercury",TL:"Thallium",PB:"Lead",BI:"Bismuth",PO:"Polonium",AT:"Astatine",RN:"Radon",FR:"Francium",RA:"Radium",AC:"Actinium",TH:"Thorium",PA:"Protactinium",U:"Uranium",NP:"Neptunium",PU:"Plutonium",AM:"Americium",CM:"Curium",BK:"Berkelium",CF:"Californium",ES:"Einsteinium",FM:"Fermium",MD:"Mendelevium",NO:"Nobelium",LR:"Lawrencium",RF:"Rutherfordium",DB:"Dubnium",SG:"Seaborgium",BH:"Bohrium",HS:"Hassium",MT:"Meitnerium",DS:"Darmstadtium",RG:"Roentgenium",CN:"Copernicium",NH:"Nihonium",FL:"Flerovium",MC:"Moscovium",LV:"Livermorium",TS:"Tennessine",OG:"Oganesson"},TJe=new Set(["LI","NA","K","RB","CS","FR"]),PJe=new Set(["BE","MG","CA","SR","BA","RA"]),LJe=new Set(["ZN","GA","CD","IN","SN","HG","TI","PB","BI","PO","CN"]),zJe=new Set(["F","CL","BR","I","AT"]);function VJe(e){return zJe.has(e)}function Zfe(e){const t=L3(e);return t>=21&&t<=29||t>=39&&t<=47||t>=72&&t<=79||t>=104&&t<=108}function qJe(e){return function DJe(e){return TJe.has(e)}(e)||function kJe(e){return PJe.has(e)}(e)||function HJe(e){const t=L3(e);return t>=57&&t<=71}(e)||function GJe(e){const t=L3(e);return t>=89&&t<=103}(e)||Zfe(e)||function jJe(e){return LJe.has(e)}(e)}var yi=function(e){return e.Type="Type",e.Structure="Structure Property",e.Atom="Atom Property",e.Bond="Bond Property",e.Residue="Residue Property",e.AminoAcid="Amino Acid",e.NucleicBase="Nucleic Base",e.Manipulate="Manipulate Selection",e.Validation="Validation",e.Misc="Miscellaneous",e.Internal="Internal",e}(yi||{});function hi(e,t,n={}){var r;let i;return{label:e,expression:t,description:n.description||"",category:null!==(r=n.category)&&void 0!==r?r:yi.Misc,isHidden:!!n.isHidden,priority:n.priority||0,referencesCurrent:!!n.referencesCurrent,get query(){return i||(i=M_(t)),i},ensureCustomProperties:n.ensureCustomProperties,getSelection:(o,s,a)=>le(function*(){const l=o.managers.structure.selection.getStructure(a),c=l?Dt.Sequence(a,[l]):Dt.Empty(a);return n.ensureCustomProperties&&(yield n.ensureCustomProperties({runtime:s,assetManager:o.managers.asset},a)),i||(i=M_(t)),i(new _f(a,{currentSelection:c}))})()}}const WJe=hi("All",pe.struct.generator.all(),{category:"",priority:1e3}),$Je=hi("Current Selection",pe.internal.generator.current(),{category:"",referencesCurrent:!0}),YJe=hi("Polymer",pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":pe.core.logic.and([pe.core.rel.eq([pe.ammp("entityType"),"polymer"]),pe.core.str.match([pe.re("(polypeptide|cyclic-pseudo-peptide|peptide-like|nucleotide|peptide nucleic acid)","i"),pe.ammp("entitySubtype")])])})]),{category:yi.Type}),XJe=hi("Trace",pe.struct.modifier.union([pe.struct.combinator.merge([pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":pe.core.rel.eq([pe.ammp("entityType"),"polymer"]),"chain-test":pe.core.set.has([pe.set("sphere","gaussian"),pe.ammp("objectPrimitive")])})]),pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":pe.core.rel.eq([pe.ammp("entityType"),"polymer"]),"chain-test":pe.core.rel.eq([pe.ammp("objectPrimitive"),"atomistic"]),"atom-test":pe.core.set.has([pe.set("CA","P"),pe.ammp("label_atom_id")])})])])]),{category:yi.Structure}),sA=pe.core.logic.and([pe.core.rel.eq([pe.ammp("entityType"),"polymer"]),pe.core.str.match([pe.re("(polypeptide|cyclic-pseudo-peptide|peptide-like)","i"),pe.ammp("entitySubtype")])]),zN=pe.core.logic.and([pe.core.rel.eq([pe.ammp("entityType"),"polymer"]),pe.core.str.match([pe.re("(nucleotide|peptide nucleic acid)","i"),pe.ammp("entitySubtype")])]),N_=pe.core.str.match([pe.re("non-polymer|(amino|carboxy) terminus|peptide-like","i"),pe.ammp("chemCompType")]),KJe=hi("Backbone",pe.struct.modifier.union([pe.struct.combinator.merge([pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":sA,"chain-test":pe.core.rel.eq([pe.ammp("objectPrimitive"),"atomistic"]),"residue-test":pe.core.logic.not([N_]),"atom-test":pe.core.set.has([pe.set(...Lo.toArray(Y0)),pe.ammp("label_atom_id")])})]),pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":zN,"chain-test":pe.core.rel.eq([pe.ammp("objectPrimitive"),"atomistic"]),"residue-test":pe.core.logic.not([N_]),"atom-test":pe.core.set.has([pe.set(...Lo.toArray(XR)),pe.ammp("label_atom_id")])})])])]),{category:yi.Structure}),ZJe=hi("Sidechain",pe.struct.modifier.union([pe.struct.combinator.merge([pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":sA,"chain-test":pe.core.rel.eq([pe.ammp("objectPrimitive"),"atomistic"]),"residue-test":pe.core.logic.not([N_]),"atom-test":pe.core.logic.or([pe.core.logic.not([pe.core.set.has([pe.set(...Lo.toArray(Y0)),pe.ammp("label_atom_id")])])])})]),pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":zN,"chain-test":pe.core.rel.eq([pe.ammp("objectPrimitive"),"atomistic"]),"residue-test":pe.core.logic.not([N_]),"atom-test":pe.core.logic.or([pe.core.logic.not([pe.core.set.has([pe.set(...Lo.toArray(XR)),pe.ammp("label_atom_id")])])])})])])]),{category:yi.Structure}),QJe=hi("Sidechain with Trace",pe.struct.modifier.union([pe.struct.combinator.merge([pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":sA,"chain-test":pe.core.rel.eq([pe.ammp("objectPrimitive"),"atomistic"]),"residue-test":pe.core.logic.not([N_]),"atom-test":pe.core.logic.or([pe.core.logic.not([pe.core.set.has([pe.set(...Lo.toArray(Y0)),pe.ammp("label_atom_id")])]),pe.core.rel.eq([pe.ammp("label_atom_id"),"CA"]),pe.core.logic.and([pe.core.rel.eq([pe.ammp("auth_comp_id"),"PRO"]),pe.core.rel.eq([pe.ammp("label_atom_id"),"N"])])])})]),pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":zN,"chain-test":pe.core.rel.eq([pe.ammp("objectPrimitive"),"atomistic"]),"residue-test":pe.core.logic.not([N_]),"atom-test":pe.core.logic.or([pe.core.logic.not([pe.core.set.has([pe.set(...Lo.toArray(XR)),pe.ammp("label_atom_id")])]),pe.core.rel.eq([pe.ammp("label_atom_id"),"P"])])})])])]),{category:yi.Structure}),JJe=hi("Protein",pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":sA})]),{category:yi.Type}),eet=hi("Nucleic",pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":zN})]),{category:yi.Type}),tet=hi("Helix",pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":sA,"residue-test":pe.core.flags.hasAny([pe.ammp("secondaryStructureFlags"),pe.core.type.bitflags([2])])})]),{category:yi.Structure,ensureCustomProperties:(e,t)=>gp.attach(e,t)}),net=hi("Beta Strand/Sheet",pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":sA,"residue-test":pe.core.flags.hasAny([pe.ammp("secondaryStructureFlags"),pe.core.type.bitflags([4])])})]),{category:yi.Structure,ensureCustomProperties:(e,t)=>gp.attach(e,t)}),ret=hi("Water",pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":pe.core.rel.eq([pe.ammp("entityType"),"water"])})]),{category:yi.Type}),iet=hi("Ion",pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":pe.core.rel.eq([pe.ammp("entitySubtype"),"ion"])})]),{category:yi.Type}),oet=hi("Lipid",pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":pe.core.rel.eq([pe.ammp("entitySubtype"),"lipid"])})]),{category:yi.Type}),VN=hi("Carbohydrate",pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":pe.core.logic.or([pe.core.rel.eq([pe.ammp("entityType"),"branched"]),pe.core.logic.and([pe.core.rel.eq([pe.ammp("entityType"),"non-polymer"]),pe.core.str.match([pe.re("oligosaccharide","i"),pe.ammp("entitySubtype")])])])})]),{category:yi.Type}),Qfe=hi("Carbohydrate with Connected",pe.struct.modifier.union([pe.struct.modifier.includeConnected({0:VN.expression,"layer-count":1,"as-whole-residues":!0})]),{category:yi.Internal,isHidden:!0}),Jfe=hi("Connected to Carbohydrate",pe.struct.modifier.union([pe.struct.modifier.exceptBy({0:Qfe.expression,by:VN.expression})]),{category:yi.Internal,isHidden:!0}),EH=hi("Ligand",pe.struct.modifier.union([pe.struct.modifier.exceptBy({0:pe.struct.modifier.union([pe.struct.combinator.merge([pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":pe.core.logic.and([pe.core.logic.or([pe.core.rel.eq([pe.ammp("entityType"),"non-polymer"]),pe.core.rel.neq([pe.ammp("entityPrdId"),""])]),pe.core.logic.not([pe.core.str.match([pe.re("(oligosaccharide|lipid|ion)","i"),pe.ammp("entitySubtype")])])]),"chain-test":pe.core.rel.eq([pe.ammp("objectPrimitive"),"atomistic"]),"residue-test":pe.core.logic.not([pe.core.str.match([pe.re("saccharide","i"),pe.ammp("chemCompType")])])})]),pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":pe.core.rel.eq([pe.ammp("entityType"),"polymer"]),"chain-test":pe.core.rel.eq([pe.ammp("objectPrimitive"),"atomistic"]),"residue-test":N_})])])]),by:pe.struct.combinator.merge([pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":pe.core.rel.eq([pe.ammp("entityType"),"polymer"]),"chain-test":pe.core.rel.eq([pe.ammp("objectPrimitive"),"atomistic"]),"residue-test":pe.core.set.has([pe.set(...Lo.toArray(yw)),pe.ammp("label_comp_id")])})]),pe.struct.generator.atomGroups({"chain-test":pe.core.rel.eq([pe.ammp("objectPrimitive"),"atomistic"]),"residue-test":pe.core.set.has([pe.set(...Lo.toArray(_6e)),pe.ammp("label_comp_id")])})])})]),{category:yi.Type}),epe=hi("Ligand with Connected",pe.struct.modifier.union([pe.struct.modifier.exceptBy({0:pe.struct.modifier.union([pe.struct.modifier.includeConnected({0:EH.expression,"layer-count":1,"as-whole-residues":!0,"bond-test":pe.core.flags.hasAny([pe.struct.bondProperty.flags(),pe.core.type.bitflags([3])])})]),by:VN.expression})]),{category:yi.Internal,isHidden:!0}),tpe=hi("Connected to Ligand",pe.struct.modifier.union([pe.struct.modifier.exceptBy({0:epe.expression,by:EH.expression})]),{category:yi.Internal,isHidden:!0}),set=hi("Connected to Ligand or Carbohydrate",pe.struct.modifier.union([pe.struct.combinator.merge([Jfe.expression,tpe.expression])]),{category:yi.Internal,isHidden:!0}),aet=hi("Disulfide Bridges",pe.struct.modifier.union([pe.struct.combinator.merge([pe.struct.modifier.union([pe.struct.modifier.wholeResidues([pe.struct.filter.isConnectedTo({0:pe.struct.generator.atomGroups({"residue-test":pe.core.set.has([pe.set("CYS"),pe.ammp("auth_comp_id")]),"atom-test":pe.core.set.has([pe.set("SG"),pe.ammp("label_atom_id")])}),target:pe.struct.generator.atomGroups({"residue-test":pe.core.set.has([pe.set("CYS"),pe.ammp("auth_comp_id")]),"atom-test":pe.core.set.has([pe.set("SG"),pe.ammp("label_atom_id")])}),"bond-test":!0})])]),pe.struct.modifier.union([pe.struct.modifier.wholeResidues([pe.struct.modifier.union([pe.struct.generator.bondedAtomicPairs({0:pe.core.flags.hasAny([pe.struct.bondProperty.flags(),pe.core.type.bitflags([8])])})])])])])]),{category:yi.Bond}),cet=hi("NOS Bridges",pe.struct.modifier.union([pe.struct.modifier.wholeResidues([pe.struct.filter.isConnectedTo({0:pe.struct.generator.atomGroups({"residue-test":pe.core.set.has([pe.set("CSO","LYS"),pe.ammp("auth_comp_id")]),"atom-test":pe.core.set.has([pe.set("OD","NZ"),pe.ammp("label_atom_id")])}),target:pe.struct.generator.atomGroups({"residue-test":pe.core.set.has([pe.set("CSO","LYS"),pe.ammp("auth_comp_id")]),"atom-test":pe.core.set.has([pe.set("OD","NZ"),pe.ammp("label_atom_id")])}),"bond-test":!0})])]),{category:yi.Bond}),uet=hi("Non-standard Residues in Polymers",pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":pe.core.rel.eq([pe.ammp("entityType"),"polymer"]),"chain-test":pe.core.rel.eq([pe.ammp("objectPrimitive"),"atomistic"]),"residue-test":pe.ammp("isNonStandard")})]),{category:yi.Residue}),det=hi("Coarse Elements",pe.struct.modifier.union([pe.struct.generator.atomGroups({"chain-test":pe.core.set.has([pe.set("sphere","gaussian"),pe.ammp("objectPrimitive")])})]),{category:yi.Type}),fet=hi("Rings in Residues",pe.struct.modifier.union([pe.struct.generator.rings()]),{category:yi.Residue}),pet=hi("Aromatic Rings in Residues",pe.struct.modifier.union([pe.struct.generator.rings({"only-aromatic":!0})]),{category:yi.Residue}),het=hi("Surrounding Residues (5 \u212b) of Selection",pe.struct.modifier.union([pe.struct.modifier.exceptBy({0:pe.struct.modifier.includeSurroundings({0:pe.internal.generator.current(),radius:5,"as-whole-residues":!0}),by:pe.internal.generator.current()})]),{description:"Select residues within 5 \u212b of the current selection.",category:yi.Manipulate,referencesCurrent:!0}),met=hi("Surrounding Ligands (5 \u212b) of Selection",pe.struct.modifier.union([pe.struct.modifier.surroundingLigands({0:pe.internal.generator.current(),radius:5,"include-water":!0})]),{description:"Select ligand components within 5 \u212b of the current selection.",category:yi.Manipulate,referencesCurrent:!0}),get=hi("Surrounding Atoms (5 \u212b) of Selection",pe.struct.modifier.union([pe.struct.modifier.exceptBy({0:pe.struct.modifier.includeSurroundings({0:pe.internal.generator.current(),radius:5,"as-whole-residues":!1}),by:pe.internal.generator.current()})]),{description:"Select atoms within 5 \u212b of the current selection.",category:yi.Manipulate,referencesCurrent:!0}),yet=hi("Inverse / Complement of Selection",pe.struct.modifier.union([pe.struct.modifier.exceptBy({0:pe.struct.generator.all(),by:pe.internal.generator.current()})]),{description:"Select everything not in the current selection.",category:yi.Manipulate,referencesCurrent:!0}),bet=hi("Residues Covalently Bonded to Selection",pe.struct.modifier.union([pe.struct.modifier.includeConnected({0:pe.internal.generator.current(),"layer-count":1,"as-whole-residues":!0})]),{description:"Select residues covalently bonded to current selection.",category:yi.Manipulate,referencesCurrent:!0}),vet=hi("Covalently Bonded Component",pe.struct.modifier.union([pe.struct.modifier.includeConnected({0:pe.internal.generator.current(),"fixed-point":!0})]),{description:"Select covalently bonded component based on current selection.",category:yi.Manipulate,referencesCurrent:!0}),xet=hi("Residues with Cov. or Metallic Bond to Selection",pe.struct.modifier.union([pe.struct.modifier.includeConnected({0:pe.internal.generator.current(),"layer-count":1,"as-whole-residues":!0,"bond-test":pe.core.flags.hasAny([pe.struct.bondProperty.flags(),pe.core.type.bitflags([3])])})]),{description:"Select residues with covalent or metallic bond to current selection.",category:yi.Manipulate,referencesCurrent:!0}),_et=hi("Whole Residues of Selection",pe.struct.modifier.union([pe.struct.modifier.wholeResidues({0:pe.internal.generator.current()})]),{description:"Expand current selection to whole residues.",category:yi.Manipulate,referencesCurrent:!0}),Cet=[[["HIS"],"Histidine"],[["ARG"],"Arginine"],[["LYS"],"Lysine"],[["ILE"],"Isoleucine"],[["PHE"],"Phenylalanine"],[["LEU"],"Leucine"],[["TRP"],"Tryptophan"],[["ALA"],"Alanine"],[["MET"],"Methionine"],[["PRO"],"Proline"],[["CYS"],"Cysteine"],[["ASN"],"Asparagine"],[["VAL"],"Valine"],[["GLY"],"Glycine"],[["SER"],"Serine"],[["GLN"],"Glutamine"],[["TYR"],"Tyrosine"],[["ASP"],"Aspartic Acid"],[["GLU"],"Glutamic Acid"],[["THR"],"Threonine"],[["SEC"],"Selenocysteine"],[["PYL"],"Pyrrolysine"],[["UNK"],"Unknown"]].sort((e,t)=>e[1]t[1]?1:0),wet=[[["A","DA"],"Adenosine"],[["C","DC"],"Cytidine"],[["T","DT"],"Thymidine"],[["G","DG"],"Guanosine"],[["I","DI"],"Inosine"],[["U","DU"],"Uridine"],[["N","DN"],"Unknown"]].sort((e,t)=>e[1]t[1]?1:0);function TH([e,t],n,r=0){const i=1!==e.length||npe.has(e[0])?`${t} (${e.join(", ")})`:`[${e[0]}] ${t}`;return hi(i,pe.struct.modifier.union([pe.struct.generator.atomGroups({"residue-test":pe.core.set.has([pe.set(...e),pe.ammp("auth_comp_id")])})]),{category:n,priority:r,description:i})}const npe=Lo.unionMany(ez,I3,E3,KR);function Eet(e){const t=new Set;for(const r of e)r.uniqueElementSymbols.forEach(i=>t.add(i));const n=[];return t.forEach(r=>{n.push(function Aet([e,t],n,r){const i=`${t} (${e.join(", ")})`;return hi(i,pe.struct.modifier.union([pe.struct.generator.atomGroups({"atom-test":pe.core.set.has([pe.set(...e),pe.acp("elementSymbol")])})]),{category:n,priority:r,description:i})}([[r],EJe[r]||r],"Element Symbol",0))}),n}function Tet(e){const t=new Map,n=new Set;for(const i of e){i.uniqueResidueNames.forEach(o=>n.add(o));for(const o of i.models)i.uniqueResidueNames.forEach(s=>{const a=o.properties.chemicalComponentMap.get(s);a&&t.set(s,a.name)})}const r=[];return Lo.difference(n,npe).forEach(i=>{const o=t.get(i)||i;r.push(TH([[i],o],"Ligand/Non-standard Residue",200))}),r}function Det(e){const t=new Map,n=dt.create();for(const i of e){n.structure=i;for(const o of i.unitSymmetryGroups){n.unit=o.units[0],n.element=o.elements[0];const s=Je.entity.type(n);if("polymer"===s||"branched"===s){const a=Je.entity.pdbx_description(n);t.set(a.join(", "),a)}}}const r=[];return t.forEach((i,o)=>{r.push(function Iet([e,t],n,r){const i=`${t}`;return hi(`${t}`,pe.struct.modifier.union([pe.struct.generator.atomGroups({"entity-test":pe.core.list.equal([pe.list(...e),pe.ammp("entityDescription")])})]),{category:n,priority:r,description:i})}([i,o],"Polymer/Carbohydrate Entities",300))}),r}const Ps={all:WJe,current:$Je,polymer:YJe,trace:XJe,backbone:KJe,sidechain:ZJe,sidechainWithTrace:QJe,protein:JJe,nucleic:eet,helix:tet,beta:net,water:ret,ion:iet,lipid:oet,branched:VN,branchedPlusConnected:Qfe,branchedConnectedOnly:Jfe,ligand:EH,ligandPlusConnected:epe,ligandConnectedOnly:tpe,connectedOnly:set,disulfideBridges:aet,nosBridges:cet,nonStandardPolymer:uet,coarse:det,ring:fet,aromaticRing:pet,surroundings:het,surroundingLigands:met,surroundingAtoms:get,complement:yet,covalentlyBonded:bet,covalentlyOrMetallicBonded:xet,covalentlyBondedComponent:vet,wholeResidues:_et};class Pet{add(t){this.list.push(t),this.options.push([t,t.label,t.category]),this.version+=1}remove(t){const n=this.list.indexOf(t);-1!==n&&(this.list.splice(n,1),this.options.splice(n,1),this.version+=1)}constructor(){this.list=[],this.options=[],this.version=1,this.list.push(...Object.values(Ps),...Cet.map(t=>TH(t,yi.AminoAcid)),...wet.map(t=>TH(t,yi.NucleicBase))),this.options.push(...this.list.map(t=>[t,t.label,t.category]))}}function Net(e){switch(e){case 7:return-3;case 6:return-2;case 5:return-1;case 0:case 4:return 0;case 3:return 1;case 2:return 2;case 1:return 3;default:return console.error(`Value ${e} is outside the 0-7 range, defaulting to 0.`),0}}function rpe(e,t){const n=ot.create(e.data,2*t),r=ot.create(e.data,2*t),i=ot.create(e.data,2*t),o=ot.create(e.data,2*t),s=ot.create(e.data,2*t);for(let a=0;a0)for(let g=0;g0){const g=ce.ofIntArray(ce.mapToArray(i.atomIdxA,_=>_-1,Int32Array)),y=ce.ofIntArray(ce.mapToArray(i.atomIdxB,_=>_-1,Int32Array)),v=ce.asArrayColumn(i.order,Int32Array),x=nc.fromData({pairs:{indexA:g,indexB:y,order:v},count:r.count},{maxDistance:1/0});nc.Provider.set(h.representative,x)}return h}),DH.apply(this,arguments)}var PH,$D,RH;function kH(){return kH=le(function*(e,t,n){var r;const i=e.atom_site._rowCount,o=ce.ofConst("MOL",i,ce.Schema.str),s=ce.ofConst("A",i,ce.Schema.str),a=ce.ofConst(1,i,ce.Schema.int),l=function Uet(e){const{cell:t,space_group:n}=e,r=function jet(e){const t=e.it_number.value(0),n=e["name_h-m_full"].value(0).replace("-"," ");return e.it_number.isDefined?t:n}(n),i=Qc.create(r,C.create(t.length_a.value(0),t.length_b.value(0),t.length_c.value(0)),C.scale(C(),C.create(t.angle_alpha.value(0),t.angle_beta.value(0),t.angle_gamma.value(0)),Math.PI/180));return{spacegroup:wd.create(i),assemblies:[],isNonStandardCrystalFrame:!1,ncsOperators:[]}}(e),c=l.spacegroup.cell.fromFractional,{fract_x:u,fract_y:d,fract_z:f}=e.atom_site,p=new Float32Array(i),m=new Float32Array(i),h=new Float32Array(i),g=C();for(let F=0;F0){const F=T.representative;Vs.Provider.set(F,l);const R=e.geom_bond._rowCount;if(R>0){const N={},{label:j}=e.atom_site;for(let ee=0,se=j.rowCount;eefunction d6e(e){return mse.has(e)?mse.get(e):Jx("H")}(d)),schema:ce.Schema.Aliased(ce.Schema.str)}),s=ce.ofConst(1,n.count,ce.Schema.int),a=Kr.ofPartialColumns(ic.atom_site,{auth_asym_id:i,auth_atom_id:o,auth_comp_id:r,auth_seq_id:s,Cartn_x:ce.asArrayColumn(n.x,Float32Array),Cartn_y:ce.asArrayColumn(n.y,Float32Array),Cartn_z:ce.asArrayColumn(n.z,Float32Array),id:ce.range(0,n.count-1),label_asym_id:i,label_atom_id:o,label_comp_id:r,label_seq_id:s,label_entity_id:ce.ofConst("1",n.count,ce.Schema.str),occupancy:ce.ofConst(1,n.count,ce.Schema.float),type_symbol:o,pdbx_PDB_model_num:ce.ofConst(1,n.count,ce.Schema.int)},n.count),l=new Gh;l.setNames([["MOL","Unknown Entity"]]),l.getEntityId("MOL",0,"A");const c=new qh(s,o);c.setNames([["MOL","Unknown Molecule"]]),c.add("MOL",0);const u=hp({entity:l.getEntityTable(),chem_comp:c.getChemCompTable(),atom_site:a});return yield cg(u,RH.create(e),t)}),MH.apply(this,arguments)}!function(e){e.is=function t(r){return"mol"===r?.kind},e.create=function n(r){return{kind:"mol",name:r.title,data:r}}}(PH||(PH={})),ag.Provider.formatRegistry.add("cifCore",function Vet(e){if(!$D.is(e.sourceData))return;const{atom_site:t,atom_site_aniso:n}=e.sourceData.data.db;return{data:Kr.ofPartialColumns(ag.Schema,{U:n.u},n._rowCount),elementToAnsiotrop:ag.getElementToAnsiotropFromLabel(t.label,n.label)}},function Het(e){return!!$D.is(e.sourceData)&&e.sourceData.data.db.atom_site_aniso.u.isDefined}),function(e){e.is=function t(r){return"cifCore"===r?.kind},e.fromFrame=function n(r,i){return i||(i=Hh.schema.cifCore(r)),{kind:"cifCore",name:i.database_code.depnum_ccdc_archive.value(0)||i.database_code.depnum_ccdc_fiz.value(0)||i.database_code.icsd.value(0)||i.database_code.mdf.value(0)||i.database_code.nbs.value(0)||i.database_code.csd.value(0)||i.database_code.cod.value(0)||i._name,data:{db:i,frame:r}}}}($D||($D={})),function(e){e.is=function t(r){return"cube"===r?.kind},e.create=function n(r){return{kind:"cube",name:r.header.comment1,data:r}}}(RH||(RH={}));const{skipWhitespace:NH,eatValue:ape,markLine:Op,getTokenString:Bp,readLine:lpe}=kt;function Yet(e,t){return{tokenizer:e,molecule:{mol_name:"",num_atoms:0,num_bonds:0,num_subst:0,num_feat:0,num_sets:0,mol_type:"",charge_type:"",status_bits:"",mol_comment:""},runtimeCtx:t}}const cpe=/\s+/g;function Xet(e){const{tokenizer:t,molecule:n}=e;for(;"@MOLECULE"!==Bp(t)&&t.position"))return;n.mol_type=i,Op(t);const o=Bp(t);if(o.startsWith("@"))return;n.charge_type=o,Op(t);const s=Bp(t);if(s.startsWith("@"))return;n.status_bits=s,Op(t);const a=Bp(t);a.startsWith("@")||(n.mol_comment=a)}function Ket(e){return FH.apply(this,arguments)}function FH(){return FH=le(function*(e){const{tokenizer:t,molecule:n}=e;for(;"@ATOM"!==Bp(t)&&t.position{const D=Math.min(n.num_atoms-A,E);for(let T=0;TE.update({message:"Parsing...",current:t.position,max:w})),{count:n.num_atoms,atom_id:Pn(l)(ce.Schema.int),atom_name:Pn(c)(ce.Schema.str),x:Pn(u)(ce.Schema.float),y:Pn(d)(ce.Schema.float),z:Pn(f)(ce.Schema.float),atom_type:a>5?Pn(p)(ce.Schema.str):_,subst_id:a>6?Pn(m)(ce.Schema.int):x,subst_name:a>7?Pn(h)(ce.Schema.str):_,charge:a>8?Pn(g)(ce.Schema.float):v,status_bit:a>9?Pn(y)(ce.Schema.str):_}}),FH.apply(this,arguments)}function Zet(e){return OH.apply(this,arguments)}function OH(){return OH=le(function*(e){const{tokenizer:t,molecule:n}=e;for(;"@BOND"!==Bp(t)&&t.position{const y=Math.min(n.num_bonds-m,g);for(let v=0;vg.update({message:"Parsing...",current:t.position,max:p})),{count:n.num_bonds,bond_id:Pn(l)(ce.Schema.int),origin_atom_id:Pn(c)(ce.Schema.int),target_atom_id:Pn(u)(ce.Schema.int),bond_type:Pn(d)(ce.Schema.str),status_bits:a>4?Pn(f)(ce.Schema.str):ce.Undefined(n.num_bonds,ce.Schema.str)}}),OH.apply(this,arguments)}function Qet(e){const{tokenizer:t}=e;for(;t.positionMOLECULE"===r)return;if("@CRYSIN"===r)break;Op(t)}if(t.position>=t.data.length)return;Op(t);const n=Bp(t).trim().split(cpe);return{a:parseFloat(n[0]),b:parseFloat(n[1]),c:parseFloat(n[2]),alpha:parseFloat(n[3]),beta:parseFloat(n[4]),gamma:parseFloat(n[5]),spaceGroup:parseInt(n[6],10),setting:parseInt(n[7],10)}}function BH(){return BH=le(function*(e,t,n){const r=kt(t);e.update({message:"Parsing...",current:0,max:t.length});const i=[];for(;r.positionMOLECULE"!==Bp(r)&&r.position0){const y=ce.ofIntArray(ce.mapToArray(a.origin_atom_id,E=>E-1,Int32Array)),v=ce.ofIntArray(ce.mapToArray(a.target_atom_id,E=>E-1,Int32Array)),x=a.bond_id,_=ce.ofIntArray(ce.mapToArray(a.bond_type,E=>{switch(E){case"ar":case"am":case"un":return 1;case"du":case"nc":return 0;default:return parseInt(E)}},Int8Array)),w=ce.ofIntArray(ce.mapToArray(a.bond_type,E=>{switch(E){case"ar":case"am":return 17;case"du":case"nc":return 0;default:return 1}},Int8Array)),A=nc.fromData({pairs:{key:x,indexA:y,indexB:v,order:_,flag:w},count:s.count},{maxDistance:l?-1:1/0}),M=g.representative;if(nc.Provider.set(M,A),tA.Provider.set(M,{data:s.charge,type:o.charge_type}),l){const E=ntt(l);E&&Vs.Provider.set(M,E)}n.push(M)}}return new ay(n)}),LH.apply(this,arguments)}function ntt(e){if(1!==e.setting)return;const t=Qc.create(e.spaceGroup,C.create(e.a,e.b,e.c),C.scale(C(),C.create(e.alpha,e.beta,e.gamma),Math.PI/180));return{spacegroup:wd.create(t),assemblies:[],isNonStandardCrystalFrame:!1,ncsOperators:[]}}var jH;!function(e){e.is=function t(r){return"mol2"===r?.kind},e.create=function n(r){return{kind:"mol2",name:r.name,data:r}}}(jH||(jH={}));const aA=new Uint32Array([0,0,0,0,0,0,0,0,0,8,10,12,16,20,25,32,40,50,64,80,101,128,161,203,256,322,406,512,645,812,1024,1290,1625,2048,2580,3250,4096,5060,6501,8192,10321,13003,16384,20642,26007,32768,41285,52015,65536,82570,104031,131072,165140,208063,262144,330280,416127,524287,660561,832255,1048576,1321122,1664510,2097152,2642245,3329021,4194304,5284491,6658042,8388607,10568983,13316085,16777216]),UH=9;var Md,VH;function itt(){throw new Error("(xdrfile error) Undefined error.")}function zH(){return zH=le(function*(e,t){const n=new DataView(t.buffer,t.byteOffset),r={frames:[],boxes:[],times:[],timeOffset:0,deltaTime:0},i=r.frames,o=r.boxes,s=r.times,a=[0,0,0,0,0,0],l=[0,0,0],c=[0,0,0],u=[0,0,0],d=[.1,.1,.1],f=[.1,.1,.1];let p=0;const m=Md.buf;for(;;){let h;const g=n.getInt32(p+4);p+=12,s.push(n.getFloat32(p)),p+=4;const y=new Float32Array(9);for(let v=0;v<9;++v)y[v]=10*n.getFloat32(p),p+=4;if(o.push(y),g<=9){h={count:g/3,x:new Float32Array(g/3),y:new Float32Array(g/3),z:new Float32Array(g/3)};for(let v=0;v16777215?(c[0]=Md.sizeOfInt(l[0]),c[1]=Md.sizeOfInt(l[1]),c[2]=Md.sizeOfInt(l[2]),w=0):w=Md.sizeOfInts(3,l);let A=n.getInt32(p);p+=4;let M=A-1;M=UH>M?UH:M;let E=aA[M]/2|0,D=aA[A]/2|0;u[0]=u[1]=u[2]=aA[A];const T=4*Math.ceil(n.getInt32(p)/4);p+=4;const F=1/_;let R=0,N=0;for(d[0]=d[1]=d[2]=0;N0){d[0]=d[1]=d[2]=0;for(let z=0;zUH?aA[A-1]/2|0:0):W>0&&(E=D,D=aA[A]/2|0),u[0]=u[1]=u[2]=aA[A],(0===u[0]||0===u[1]||0===u[2])&&itt()}p+=T}for(let v=0;v=t.length)break}return s.length>=1&&(r.timeOffset=s[0]),s.length>=2&&(r.deltaTime=s[1]-s[0]),r}),zH.apply(this,arguments)}function ltt(e){let t=e.position>=e.data.length-1?0:+kt.readLine(e);isNaN(t)&&(t=0);const n=kt.readLine(e),r=new Float64Array(t),i=new Float64Array(t),o=new Float64Array(t),s=new Array(t);for(let a=0;a=d&&f<32;)f++,d<<=1;return f};const n=new Uint8Array(32);e.sizeOfInts=function r(u,d){let f=1,p=0;n[0]=1;for(let h=0;h>=8;for(;0!==y;)n[g++]=255&y,y>>=8;f=g}let m=1;for(f--;n[f]>=m;)p++,m*=2;return p+8*f};const i=new ArrayBuffer(24);e.buf=new Int32Array(i);const o=new Uint32Array(i);function s(u,d,f){let p=f;const m=(1<=8;)g=g<<8|u[d+y++],v|=g>>h<0&&(h>h&(1<>o[1]&255}e.decodeBits=s;const l=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];e.decodeInts=function c(u,d,f,p,m){let h=f,g=0;for(l[0]=0,l[1]=0,l[2]=0,l[3]=0;h>8;)l[g++]=a(u,d),h-=8;h>0&&(l[g++]=s(u,d,h));for(let y=2;y>0;y--){let v=0;const x=p[y];for(let _=g-1;_>=0;_--){v=v<<8|l[_];const w=v/x|0;l[_]=w,v-=w*x}m[y]=v}m[0]=l[0]|l[1]<<8|l[2]<<16|l[3]<<24}}(Md||(Md={})),function(e){e.is=function t(r){return"xyz"===r?.kind},e.create=function n(r){return{kind:"xyz",name:"xyz",data:r}}}(VH||(VH={}));const HH="$$$$";function vtt(e){const t=kt.readLine(e).trim(),n=kt.readLine(e).trim(),r=kt.readLine(e).trim(),i=kt.readLine(e),o=function ptt(e){return e.trim().endsWith("V3000")}(i),{atomCount:s,bondCount:a}=o?function htt(e){const t=ot.create(e.data,1),n=ot.create(e.data,1);return kt.eatLine(e),By(e),By(e),By(e),Ly(e,t),Ly(e,n),kt.eatLine(e),{atomCount:Pn(t)(ce.Schema.int).value(0),bondCount:Pn(n)(ce.Schema.int).value(0)}}(e):function btt(e){return{atomCount:+e.substr(0,3),bondCount:+e.substr(3,3)}}(i);if(Number.isNaN(s)||Number.isNaN(a)){for(;e.position ")){ot.add(t,e.tokenStart+2,e.tokenEnd),kt.markLine(e);const i=e.tokenStart;let o=e.tokenEnd,s=!1;for(;e.position ")){ot.add(n,i,o),s=!0;break}o=e.tokenEnd}s||ot.add(n,i,o)}}return{dataHeader:Pn(t)(ce.Schema.str),data:Pn(n)(ce.Schema.str)}}(e);return{molFile:{title:t,program:n,comment:r,atoms:c,bonds:u,formalCharges:d},dataItems:f}}var GH;function Stt(e){return Ke.create("Parse SDF",t=>spe(e.molFile,GH.create(e),t))}function qH(){return qH=le(function*(e){const t=new DataView(e.buffer),n={frames:[],boxes:[],times:[],timeOffset:0,deltaTime:0},r=n.frames,i=n.boxes,o=n.times;let s=0;for(;;){s+=8;const a=t.getInt32(s);s+=4,s+=a;const l=t.getInt32(s+8),c=t.getInt32(s+12),u=t.getInt32(s+16),d=t.getInt32(s+28),f=t.getInt32(s+32),p=t.getInt32(s+36),m=t.getInt32(s+40);s+=52;const h=l/9,g=3*m;if(o.push(8===h?t.getFloat64(s):t.getFloat32(s)),s+=2*h,l){const y=new Float32Array(9);if(8===h)for(let v=0;v<9;++v)y[v]=10*t.getFloat64(s),s+=8;else for(let v=0;v<9;++v)y[v]=10*t.getFloat32(s),s+=4;i.push(y)}if(s+=c,s+=u,d){const y=new Float32Array(m),v=new Float32Array(m),x=new Float32Array(m);if(8===h)for(let _=0;_>8&65280|M>>24&255}const w=new Float32Array(e.buffer,s,g);for(let A=0;A=e.byteLength)break}return o.length>=1&&(n.timeOffset=o[0]),o.length>=2&&(n.deltaTime=o[1]-o[0]),n}),qH.apply(this,arguments)}!function(e){e.is=function t(r){return"sdf"===r?.kind},e.create=function n(r){return{kind:"sdf",name:r.molFile.title,data:r}}}(GH||(GH={}));const WH=[];class Ett{constructor(t,n={}){this._mark=0,this._marks=[],this.offset=0,this.littleEndian=!0;let r=!1;void 0===t&&(t=8192),"number"==typeof t?t=new ArrayBuffer(t):r=!0;const i=n.offset?n.offset>>>0:0,o=t.byteLength-i;let s=i;t instanceof ArrayBuffer||(t.byteLength!==t.buffer.byteLength&&(s=t.byteOffset+i),t=t.buffer),this._lastWrittenByte=r?o:0,this.buffer=t,this.length=o,this.byteLength=o,this.byteOffset=s,this._data=new DataView(this.buffer,s,o)}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t){return void 0===t&&(t=1),this.offset+=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const t=this._marks.pop();if(void 0===t)throw new Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t){if(void 0===t&&(t=1),!this.available(t)){const r=2*(this.offset+t),i=new Uint8Array(r);i.set(new Uint8Array(this.buffer)),this.buffer=i.buffer,this.length=this.byteLength=r,this._data=new DataView(this.buffer)}return this}readBoolean(){return 0!==this.readUint8()}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t){void 0===t&&(t=1);const n=new Uint8Array(t);for(let r=0;rthis._lastWrittenByte&&(this._lastWrittenByte=this.offset)}}function Lp(e,t){if(e)throw new TypeError("Not a valid NetCDF v3.x file: "+t)}function upe(e){e.offset%4!=0&&e.skip(4-e.offset%4)}function $H(e){const t=e.readUint32(),n=e.readChars(t);return upe(e),n}const Xs={BYTE:1,CHAR:2,SHORT:3,INT:4,FLOAT:5,DOUBLE:6};function dpe(e){switch(Number(e)){case Xs.BYTE:return"byte";case Xs.CHAR:return"char";case Xs.SHORT:return"short";case Xs.INT:return"int";case Xs.FLOAT:return"float";case Xs.DOUBLE:return"double";default:return"undefined"}}function fpe(e){switch(Number(e)){case Xs.BYTE:case Xs.CHAR:return 1;case Xs.SHORT:return 2;case Xs.INT:case Xs.FLOAT:return 4;case Xs.DOUBLE:return 8;default:return-1}}function ppe(e){switch(String(e)){case"byte":return Xs.BYTE;case"char":return Xs.CHAR;case"short":return Xs.SHORT;case"int":return Xs.INT;case"float":return Xs.FLOAT;case"double":return Xs.DOUBLE;default:return-1}}function HN(e,t){if(1!==e){const n=new Array(e);for(let r=0;r6,"non valid type "+s);const a=e.readUint32(),l=YH(e,s,a);upe(e),t[i]={name:o,type:dpe(s),value:l}}}return t}class Btt{constructor(t){const n=new Ett(t);n.setBigEndian(),Lp("CDF"!==n.readChars(3),"should start with CDF");const r=n.readByte();Lp(r>2,"unknown version"),this.header=function Ntt(e,t){const n={recordDimension:{length:e.readUint32()}};n.version=t;const r=function Ftt(e){let t,n,r;const i=e.readUint32();if(i===lA)return Lp(e.readUint32()!==lA,"wrong empty tag for list of dimensions"),[];{Lp(10!==i,"wrong tag for list of dimensions");const o=e.readUint32();t=new Array(o);for(let s=0;s6,"non valid type "+f);const p=e.readUint32();let m=e.readUint32();2===n&&(Lp(m>0,"offsets larger than 4GB not supported"),m=e.readUint32()),u[0]===t&&(i+=p),o[a]={name:l,dimensions:u,attributes:d,type:dpe(f),size:p,offset:m,record:u[0]===t}}}return{variables:o,recordStep:i}}(e,r.recordId,t);return n.variables=i.variables,n.recordDimension.recordStep=i.recordStep,n}(n,r),this.buffer=n}get version(){return 1===this.header.version?"classic format":"64-bit offset format"}get recordDimension(){return this.header.recordDimension}get dimensions(){return this.header.dimensions}get globalAttributes(){return this.header.globalAttributes}get variables(){return this.header.variables}hasDataVariable(t){return this.header.variables&&-1!==this.header.variables.findIndex(n=>n.name===t)}getDataVariable(t){var n;let r;if(r="string"==typeof t?null===(n=this.header.variables)||void 0===n?void 0:n.find(i=>i.name===t):t,void 0===r)throw new Error("variable not found");return this.buffer.seek(r.offset),r.record?function Ptt(e,t,n){const r=ppe(t.type),i=t.size?t.size/fpe(r):1,o=n.length,s=new Array(o),a=n.recordStep;for(let l=0;l=1&&(n.timeOffset=n.time[0]),n.time.length>=2&&(n.deltaTime=n.time[1]-n.time[0])),n}),XH.apply(this,arguments)}var KH,ZH;!function(e){e.is=function t(r){return"prmtop"===r?.kind},e.fromPrmtop=function n(r){return{kind:"prmtop",name:r.title.join(" ")||"PRMTOP",data:r}}}(KH||(KH={})),function(e){e.is=function t(r){return"top"===r?.kind},e.fromTop=function n(r){return{kind:"top",name:r.system||"TOP",data:r}}}(ZH||(ZH={}));const Wtt=nn.BuiltIn({name:"coordinates-from-dcd",display:{name:"Parse DCD",description:"Parse DCD binary data."},from:[Se.Data.Binary],to:Se.Molecule.Coordinates})({apply:({a:e})=>Ke.create("Parse DCD",function(){var t=le(function*(n){const r=yield function aWe(e){return Ke.create("Parse DCD",function(){var t=le(function*(n){try{const r=function sWe(e){const t=new DataView(e.buffer),n=Object.create(null),r=[];let i=0;const o=new Int32Array(e.buffer,0,23),s=o[0]!==t.getInt32(0);if(84!==o[0]){const h=e.byteLength;for(let g=0;g28672){const t=[];for(let n=0;n0)throw new Error("dcd format with fixed atoms unsupported, aborting");const p=n.NATOM,m=4*p;for(let h=0,g=n.NSET;h=1?(r.ISTART-1)*i.value:0,i.unit),s=[];for(let a=0,l=e.frames.length;a=-1&&d[1]<=1&&d[3]>=-1&&d[3]<=1&&d[4]>=-1&&d[4]<=1?Ry.create(C.create(d[0],d[2],d[5]),C.create(Xr(90-90*Math.asin(d[1])/u3),Xr(90-90*Math.asin(d[3])/u3),Xr(90-90*Math.asin(d[4])/u3))):d[0]<0||d[1]<0||d[2]<0||d[3]<0||d[4]<0||d[5]<0||d[3]>180||d[4]>180||d[5]>180?Ry.fromBasis(C.create(d[0],d[1],d[3]),C.create(d[1],d[2],d[4]),C.create(d[3],d[4],d[5])):Ry.create(C.create(d[0],d[2],d[5]),C.create(Xr(Do(d[1],0,wi)?90:d[1]),Xr(Do(d[3],0,wi)?90:d[3]),Xr(Do(d[4],0,wi)?90:d[4])))}s.push(u)}return Wx.create(s,i,o)});return function(n){return t.apply(this,arguments)}}())}(r.result).runInContext(n);return new Se.Molecule.Coordinates(i,{label:e.label,description:"Coordinates"})});return function(n){return t.apply(this,arguments)}}())}),$tt=nn.BuiltIn({name:"coordinates-from-xtc",display:{name:"Parse XTC",description:"Parse XTC binary data."},from:[Se.Data.Binary],to:Se.Molecule.Coordinates})({apply:({a:e})=>Ke.create("Parse XTC",function(){var t=le(function*(n){const r=yield function stt(e){return Ke.create("Parse XTC",function(){var t=le(function*(n){try{n.update({canAbort:!0,message:"Parsing trajectory..."});const r=yield function ott(e,t){return zH.apply(this,arguments)}(n,e);return qi.success(r)}catch(r){return qi.error(""+r)}});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);const i=yield function att(e){return Ke.create("Parse XTC",function(){var t=le(function*(n){yield n.update("Converting to coordinates");const r=_d(e.deltaTime,"step"),i=_d(e.timeOffset,r.unit),o=[];for(let s=0,a=e.frames.length;sKe.create("Parse TRR",function(){var t=le(function*(n){const r=yield function wtt(e){return Ke.create("Parse TRR",function(){var t=le(function*(n){try{n.update({canAbort:!0,message:"Parsing trajectory..."});const r=yield function Ctt(e){return qH.apply(this,arguments)}(e);return qi.success(r)}catch(r){return qi.error(""+r)}});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);const i=yield function Att(e){return Ke.create("Parse TRR",function(){var t=le(function*(n){yield n.update("Converting to coordinates");const r=_d(e.deltaTime,"step"),i=_d(e.timeOffset,r.unit),o=[];for(let s=0,a=e.frames.length;sKe.create("Parse NCTRAJ",function(){var t=le(function*(n){const r=yield function jtt(e){return Ke.create("Parse NCTRAJ",function(){var t=le(function*(n){try{n.update({canAbort:!0,message:"Parsing trajectory..."});const r=yield function Ltt(e){return XH.apply(this,arguments)}(e);return qi.success(r)}catch(r){return qi.error(""+r)}});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);const i=yield function Utt(e){return Ke.create("Parse NCTRAJ",function(){var t=le(function*(n){yield n.update("Converting to coordinates");const r=_d(e.deltaTime,"step"),i=_d(e.timeOffset,r.unit),o=[];for(let s=0,a=e.coordinates.length;sKe.create("Create Topology",function(){var t=le(function*(n){const r=yield function FQe(e){return Ke.create("Parse PSF",function(){var t=le(function*(n){const r=fH.fromPsf(e),i=function NQe(e){const t=new Array(e.count),n=new Array(e.count),r=new Uint32Array(e.count),i=new Uint32Array(e.count),o=new Array(e.count),s=new Gh,a=new qh(e.residueId,e.atomName);let l="",c=0,u="",d=0,f=e.segmentName.value(0),p=!1,m=0,h=-1;for(let y=0,v=e.count;yo.value(l)-1,rowCount:o.rowCount,schema:o.schema}),indexB:ce.ofLambda({value:l=>s.value(l)-1,rowCount:s.rowCount,schema:s.schema}),order:ce.ofConst(1,e.bonds.count,ce.Schema.int)};return f3.create(e.id,i,a,r)});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);return new Se.Molecule.Topology(r,{label:r.label||e.label,description:"Topology"})});return function(n){return t.apply(this,arguments)}}())}),Ztt=nn.BuiltIn({name:"topology-from-prmtop",display:{name:"PRMTOP Topology",description:"Create topology from PRMTOP."},from:[Se.Format.Prmtop],to:Se.Molecule.Topology})({apply:({a:e})=>Ke.create("Create Topology",function(){var t=le(function*(n){const r=yield function Vtt(e){return Ke.create("Parse PRMTOP",function(){var t=le(function*(n){const r=KH.fromPrmtop(e),i=function ztt(e){const{pointers:t,residuePointer:n,residueLabel:r,atomName:i}=e,o=t.NATOM,s=t.NRES,a=new Uint32Array(o),l=[],c=(N,j,W)=>{const z=r.value(N);for(let $=j,V=W;$ddKe.create("Create Topology",function(){var t=le(function*(n){const r=yield function qtt(e){return Ke.create("Parse TOP",function(){var t=le(function*(n){const r=ZH.fromTop(e),i=function Htt(e){const{molecules:t,compounds:n}=e,r={};let i=0;for(let N=0,j=t._rowCount;NKe.create("Create trajectory from model/topology and coordinates",function(){var n=le(function*(r){const i=t[e.coordinatesRef].data,o=yield function Jtt(e,t,n){return QH.apply(this,arguments)}(r,t[e.modelRef],i);return new Se.Molecule.Trajectory(o,{label:"Trajectory",description:`${o.frameCount} model${1===o.frameCount?"":"s"}`})});return function(r){return n.apply(this,arguments)}}())}),ent=nn.BuiltIn({name:"trajectory-from-blob",display:{name:"Parse Blob",description:"Parse format blob into a single trajectory."},from:Se.Format.Blob,to:Se.Molecule.Trajectory})({apply:({a:e})=>Ke.create("Parse Format Blob",function(){var t=le(function*(n){const r=[];for(const o of e.data){if("cif"!==o.kind)continue;const s=o.data.blocks[0],a=yield jz(s).runInContext(n);if(0===a.frameCount)throw new Error("No models found.");for(let l=0;l!0===r.loadAllBlocks})),blockIndex:I.Optional(I.Numeric(0,{min:0,step:1},{description:"Zero-based index of the block to parse. Only applies when Block Header parameter is not specified.",hideIf:r=>!0===r.loadAllBlocks||r.blockHeader}))};const{blocks:t}=e.data,n=t.map(r=>[r.header,r.header]);return n.push(["","[Use Block Index]"]),{loadAllBlocks:I.Optional(I.Boolean(!1,{description:"If True, ignore Block Header and Block Index parameters and parse all data blocks into a single trajectory."})),blockHeader:I.Optional(I.Select(t[0]&&t[0].header,n,{description:"Header of the block to parse. If not specifed, Block Index parameter applies.",hideIf:r=>!0===r.loadAllBlocks})),blockIndex:I.Optional(I.Numeric(0,{min:0,step:1,max:t.length-1},{description:"Zero-based index of the block to parse. Only applies when Block Header parameter is not specified.",hideIf:r=>!0===r.loadAllBlocks||r.blockHeader}))}}})({isApplicable:e=>e.data.blocks.length>0,apply:({a:e,params:t})=>Ke.create("Parse mmCIF",function(){var n=le(function*(r){var i;let o;if(t.loadAllBlocks){const a=[];for(const l of e.data.blocks){r.shouldUpdate&&(yield r.update(`Parsing ${l.header}...`));const c=yield jz(l).runInContext(r);for(let u=0;uu.header===a);if(!l)throw new Error(`Data block '${[a]}' not found.`);o=!l.categoryNames.includes("chem_comp_atom")||l.categoryNames.includes("atom_site")||l.categoryNames.includes("ihm_sphere_obj_site")||l.categoryNames.includes("ihm_gaussian_obj_site")?yield jz(l,e.data).runInContext(r):yield function uze(e){const t=j3.fromFrame(e);return Ke.create("Create CCD Models",n=>function dze(e,t,n){return Uz.apply(this,arguments)}(t.data.db,j3.fromFrame(e),n))}(l).runInContext(r)}if(0===o.frameCount)throw new Error("No models found.");const s=jy(o);return new Se.Molecule.Trajectory(o,s)});return function(r){return n.apply(this,arguments)}}())}),nnt=nn.BuiltIn({name:"trajectory-from-pdb",display:{name:"Parse PDB",description:"Parse PDB string and create trajectory."},from:[Se.Data.String],to:Se.Molecule.Trajectory,params:{isPdbqt:I.Boolean(!1)}})({apply:({a:e,params:t})=>Ke.create("Parse PDB",function(){var n=le(function*(r){const i=yield function bWe(e,t,n=!1){return Ke.create("Parse PDB",function(){var r=le(function*(i){return qi.success({lines:yield kt.readAllLinesAsync(e,i),id:t,isPdbqt:n})});return function(i){return r.apply(this,arguments)}}())}(e.data,e.label,t.isPdbqt).runInContext(r);if(i.isError)throw new Error(i.message);const o=yield function RQe(e){return Ke.create("Parse PDB",function(){var t=le(function*(n){var r;yield n.update("Converting to mmCIF");const i=yield function MQe(e){return uH.apply(this,arguments)}(e),o=Ui.fromFrame(i,void 0,dH.create(e)),s=hp(o.data.db,!0),a=yield cg(s,o,n),l=null===(r=i.categories.atom_site)||void 0===r?void 0:r.getField("partial_charge");if(l&&1===a.frameCount){const c=a.representative,u=c.atomicHierarchy.atomSourceIndex,f=ce.isIdentity(u)?void 0:u.toArray({array:Int32Array}),p=l.toFloatArray(),m=ce.ofFloatArray(f?ce.mapToArray(u,h=>p[h],Float32Array):p);tA.Provider.set(c,{data:m,type:"GASTEIGER"})}return a});return function(n){return t.apply(this,arguments)}}())}(i.result).runInContext(r),s=jy(o);return new Se.Molecule.Trajectory(o,s)});return function(r){return n.apply(this,arguments)}}())}),rnt=nn.BuiltIn({name:"trajectory-from-gro",display:{name:"Parse GRO",description:"Parse GRO string and create trajectory."},from:[Se.Data.String],to:Se.Molecule.Trajectory})({apply:({a:e})=>Ke.create("Parse GRO",function(){var t=le(function*(n){const r=yield function yWe(e){return Ke.create("Parse GRO",function(){var t=le(function*(n){return yield function gWe(e,t){return y9.apply(this,arguments)}(e,n)});return function(n){return t.apply(this,arguments)}}())}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);const i=yield function hQe(e){return Ke.create("Parse GRO",function(){var t=le(function*(n){const r=cH.fromGro(e),i=[];for(let o=0,s=e.structures.length;oKe.create("Parse XYZ",function(){var t=le(function*(n){const r=yield function utt(e){return Ke.create("Parse Mol",le(function*(){return function ctt(e){const t=kt(e),n=[];for(;;){const i=ltt(t);if(0===i.count)break;n.push(i)}return qi.success({molecules:n})}(e)}))}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);const i=yield function ftt(e){return Ke.create("Parse XYZ",t=>function dtt(e,t){const{molecules:n}=e;let r=0;for(const x of n)r+=x.count;const i=new Array(r),o=new Int32Array(r),s=new Float32Array(r),a=new Float32Array(r),l=new Float32Array(r),c=new Int32Array(r);let u=0;for(let x=0;xKe.create("Parse MOL",function(){var t=le(function*(n){const r=yield function Bet(e){return Ke.create("Parse Mol",le(function*(){return function Oet(e){const t=kt(e),n=kt.readLine(t).trim(),r=kt.readLine(t).trim(),i=kt.readLine(t).trim(),o=kt.readLine(t),s=+o.substr(0,3),a=+o.substr(3,3),l=rpe(t,s),c=ipe(t,a),u=ope(t);return qi.success({title:n,program:r,comment:i,atoms:l,bonds:c,formalCharges:u})}(e)}))}(e.data).runInContext(n);if(r.isError)throw new Error(r.message);const i=yield function Let(e){return Ke.create("Parse MOL",t=>spe(e,void 0,t))}(r.result).runInContext(n),o=jy(i);return new Se.Molecule.Trajectory(i,o)});return function(n){return t.apply(this,arguments)}}())}),snt=nn.BuiltIn({name:"trajectory-from-sdf",display:{name:"Parse SDF",description:"Parse SDF string and create trajectory."},from:[Se.Data.String],to:Se.Molecule.Trajectory})({apply:({a:e})=>Ke.create("Parse SDF",function(){var t=le(function*(n){const r=yield function _tt(e){return Ke.create("Parse Sdf",le(function*(){return function xtt(e){const t=kt(e),n=[];for(;t.positionKe.create("Parse MOL2",function(){var t=le(function*(n){const r=yield function ett(e,t){return Ke.create("Parse MOL2",function(){var n=le(function*(r){return yield function Jet(e,t,n){return BH.apply(this,arguments)}(r,e,t)});return function(r){return n.apply(this,arguments)}}())}(e.data,e.label).runInContext(n);if(r.isError)throw new Error(r.message);const i=yield function rtt(e){return Ke.create("Parse MOL2",t=>function ttt(e,t){return LH.apply(this,arguments)}(e,t))}(r.result).runInContext(n),o=jy(i);return new Se.Molecule.Trajectory(i,o)});return function(n){return t.apply(this,arguments)}}())}),lnt=nn.BuiltIn({name:"trajectory-from-cube",display:{name:"Parse Cube",description:"Parse Cube file to create a trajectory."},from:Se.Format.Cube,to:Se.Molecule.Trajectory})({apply:({a:e})=>Ke.create("Parse MOL",function(){var t=le(function*(n){const r=yield function Wet(e){return Ke.create("Parse Cube",t=>function qet(e,t){return MH.apply(this,arguments)}(e,t))}(e.data).runInContext(n),i=jy(r);return new Se.Molecule.Trajectory(r,i)});return function(n){return t.apply(this,arguments)}}())}),cnt=nn.BuiltIn({name:"trajectory-from-cif-core",display:{name:"Parse CIF Core",description:"Identify and create all separate models in the specified CIF data block"},from:Se.Format.Cif,to:Se.Molecule.Trajectory,params(e){if(!e)return{blockHeader:I.Optional(I.Text(void 0,{description:"Header of the block to parse. If none is specifed, the 1st data block in the file is used."}))};const{blocks:t}=e.data;return{blockHeader:I.Optional(I.Select(t[0]&&t[0].header,t.map(n=>[n.header,n.header]),{description:"Header of the block to parse"}))}}})({apply:({a:e,params:t})=>Ke.create("Parse CIF Core",function(){var n=le(function*(r){const i=t.blockHeader||e.data.blocks[0].header,o=e.data.blocks.find(l=>l.header===i);if(!o)throw new Error(`Data block '${[i]}' not found.`);const s=yield function Get(e){const t=$D.fromFrame(e);return Ke.create("Parse CIF Core",n=>function zet(e,t,n){return kH.apply(this,arguments)}(t.data.db,t,n))}(o).runInContext(r);if(0===s.frameCount)throw new Error("No models found.");const a=jy(s);return new Se.Molecule.Trajectory(s,a)});return function(r){return n.apply(this,arguments)}}())}),unt=e=>e+1,dnt=e=>e-1,mpe=nn.BuiltIn({name:"model-from-trajectory",display:{name:"Molecular Model",description:"Create a molecular model from specified index in a trajectory."},from:Se.Molecule.Trajectory,to:Se.Molecule.Model,params:e=>e?{modelIndex:I.Converted(unt,dnt,I.Numeric(1,{min:1,max:e.data.frameCount,step:1},{description:"Model Index",immediateUpdate:!0}))}:{modelIndex:I.Numeric(0,{},{description:"Zero-based index of the model",immediateUpdate:!0})}})({isApplicable:e=>e.data.frameCount>0,apply:({a:e,params:t})=>Ke.create("Model from Trajectory",function(){var n=le(function*(r){let i=t.modelIndex%e.data.frameCount;i<0&&(i+=e.data.frameCount);const o=yield Ke.resolveInContext(e.data.getFrameAtIndex(i),r);return new Se.Molecule.Model(o,{label:`Model ${i+1}`,description:1===e.data.frameCount?void 0:`of ${e.data.frameCount}`})});return function(r){return n.apply(this,arguments)}}()),interpolate:(e,t,n)=>({modelIndex:n>=1?t.modelIndex:e.modelIndex+Math.floor((t.modelIndex-e.modelIndex+1)*n)}),dispose({b:e}){e?.data.customProperties.dispose()}}),fnt=nn.BuiltIn({name:"structure-from-trajectory",display:{name:"Structure from Trajectory",description:"Create a molecular structure from a trajectory."},from:Se.Molecule.Trajectory,to:Se.Molecule.Structure})({apply:({a:e})=>Ke.create("Build Structure",function(){var t=le(function*(n){const r=yield Xe.ofTrajectory(e.data,n),i={label:"Ensemble",description:Xe.elementDescription(r)};return new Se.Molecule.Structure(r,i)});return function(n){return t.apply(this,arguments)}}()),dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),pnt=nn.BuiltIn({name:"structure-from-model",display:{name:"Structure",description:"Create a molecular structure (model, assembly, or symmetry) from the specified model."},from:Se.Molecule.Model,to:Se.Molecule.Structure,params:e=>R_.getParams(e&&e.data)})({canAutoUpdate:({oldParams:e,newParams:t})=>R_.canAutoUpdate(e.type,t.type),apply:({a:e,params:t},n)=>Ke.create("Build Structure",function(){var r=le(function*(i){return R_.create(n,i,e.data,t&&t.type)});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,oldParams:n,newParams:r})=>tg(n,r)?t.data.model===e.data?yt.UpdateResult.Unchanged:Sn.areHierarchiesEqual(e.data,t.data.model)?(t.data=t.data.remapModel(e.data),yt.UpdateResult.Updated):yt.UpdateResult.Recreate:yt.UpdateResult.Recreate,dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),gpe=C(),ype=fe(),bpe=fe(),hnt=nn.BuiltIn({name:"transform-structure-conformation",display:{name:"Transform Conformation"},isDecorator:!0,from:Se.Molecule.Structure,to:Se.Molecule.Structure,params:{transform:I.MappedStatic("components",{components:I.Group({axis:I.Vec3(C.create(1,0,0)),angle:I.Numeric(0,{min:-180,max:180,step:.1}),translation:I.Vec3(C.create(0,0,0))},{isFlat:!0}),matrix:I.Group({data:I.Mat4(fe.identity()),transpose:I.Boolean(!1)},{isFlat:!0})},{label:"Kind"})}})({canAutoUpdate:({newParams:e})=>"matrix"!==e.transform.name,apply({a:e,params:t}){const n=fe();if("components"===t.transform.name){const{axis:i,angle:o,translation:s}=t.transform.params,a=e.data.boundary.sphere.center;fe.fromTranslation(ype,C.negate(gpe,a)),fe.fromTranslation(bpe,C.add(gpe,a,s));const l=fe.fromRotation(fe(),Math.PI/180*o,C.normalize(C(),i));fe.mul3(n,bpe,l,ype)}else"matrix"===t.transform.name&&(fe.copy(n,t.transform.params.data),t.transform.params.transpose&&fe.transpose(n,n));const r=Xe.transform(e.data,n);return new Se.Molecule.Structure(r,{label:e.label,description:`${e.description} [Transformed]`})},dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),mnt=nn.BuiltIn({name:"structure-selection-from-expression",display:{name:"Selection",description:"Create a molecular structure from the specified expression."},from:Se.Molecule.Structure,to:Se.Molecule.Structure,params:()=>({expression:I.Value(pe.struct.generator.all,{isHidden:!0}),label:I.Optional(I.Text("",{isHidden:!0}))})})({apply({a:e,params:t,cache:n}){const{selection:r,entry:i}=lu.createAndRun(e.data,t.expression);if(n.entry=i,Dt.isEmpty(r))return vo.Null;const o=Dt.unionStructure(r),s={label:`${t.label||"Selection"}`,description:Xe.elementDescription(o)};return new Se.Molecule.Structure(o,s)},update:({a:e,b:t,oldParams:n,newParams:r,cache:i})=>{if(n.expression!==r.expression)return yt.UpdateResult.Recreate;const o=i.entry;if(o.currentStructure===e.data)return yt.UpdateResult.Unchanged;const s=lu.updateStructure(o,e.data);return Dt.isEmpty(s)?yt.UpdateResult.Null:(lu.updateStructureObject(t,s,r.label),yt.UpdateResult.Updated)},dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),gnt=nn.BuiltIn({name:"structure-multi-selection-from-expression",display:{name:"Multi-structure Measurement Selection",description:"Create selection object from multiple structures."},from:Se.Root,to:Se.Molecule.Structure.Selections,params:()=>({selections:I.ObjectList({key:I.Text(void 0,{description:"A unique key."}),ref:I.Text(),groupId:I.Optional(I.Text()),expression:I.Value(pe.struct.generator.empty)},e=>e.ref,{isHidden:!0}),isTransitive:I.Optional(I.Boolean(!1,{isHidden:!0,description:"Remap the selections from the original structure if structurally equivalent."})),label:I.Optional(I.Text("",{isHidden:!0}))})})({apply({params:e,cache:t,dependencies:n}){const r=new Map,i=[];let o=0;for(const a of e.selections){const{selection:l,entry:c}=lu.createAndRun(n[a.ref].data,a.expression);r.set(a.key,c);const u=Dt.toLociWithSourceUnits(l);i.push({key:a.key,loci:u,groupId:a.groupId}),o+=Me.size(u)}return t.entries=r,new Se.Molecule.Structure.Selections(i,{label:`${e.label||"Multi-selection"}`,description:`${e.selections.length} source(s), ${o} element(s) total`})},update:({b:e,oldParams:t,newParams:n,cache:r,dependencies:i})=>{if(!!t.isTransitive!=!!n.isTransitive)return yt.UpdateResult.Recreate;const o=r.entries,s=new Map,a=new Map;for(const d of e.data)a.set(d.key,d);let l=!1,c=0;const u=[];for(const d of n.selections){const f=i[d.ref].data;let p=!1;if(o.has(d.key)){const m=o.get(d.key);if(lu.isUnchanged(m,d.expression,f)&&a.has(d.key)){const h=a.get(d.key);h.groupId!==d.groupId&&(h.groupId=d.groupId,l=!0),s.set(d.key,m),u.push(h),c+=Me.size(h.loci);continue}if(m.expression!==d.expression)p=!0;else{let h=!1;if(n.isTransitive)if(Xe.areUnitIdsAndIndicesEqual(m.originalStructure,f)){const g=lu.run(m,m.originalStructure);m.currentStructure=f,s.set(d.key,m);const y=Me.remap(Dt.toLociWithSourceUnits(g),f);u.push({key:d.key,loci:y,groupId:d.groupId}),c+=Me.size(y),l=!0}else h=!0;else h=!0;if(h){l=!0;const g=lu.updateStructure(m,f);s.set(d.key,m);const y=Dt.toLociWithSourceUnits(g);u.push({key:d.key,loci:y,groupId:d.groupId}),c+=Me.size(y)}}}else p=!0;if(p){l=!0;const{selection:m,entry:h}=lu.createAndRun(f,d.expression);s.set(d.key,h);const g=Dt.toLociWithSourceUnits(m);u.push({key:d.key,loci:g}),c+=Me.size(g)}}return l?(r.entries=s,e.data=u,e.label=`${n.label||"Multi-selection"}`,e.description=`${u.length} source(s), ${c} element(s) total`,yt.UpdateResult.Updated):yt.UpdateResult.Unchanged}}),ynt=nn.BuiltIn({name:"structure-selection-from-script",display:{name:"Selection",description:"Create a molecular structure from the specified script."},from:Se.Molecule.Structure,to:Se.Molecule.Structure,params:()=>({script:I.Script({language:"mol-script",expression:"(sel.atom.atom-groups :residue-test (= atom.resname ALA))"}),label:I.Optional(I.Text(""))})})({apply({a:e,params:t,cache:n}){const{selection:r,entry:i}=lu.createAndRun(e.data,t.script);n.entry=i;const o=Dt.unionStructure(r),s={label:`${t.label||"Selection"}`,description:Xe.elementDescription(o)};return new Se.Molecule.Structure(o,s)},update:({a:e,b:t,oldParams:n,newParams:r,cache:i})=>{if(!pa.areEqual(n.script,r.script))return yt.UpdateResult.Recreate;const o=i.entry;if(o.currentStructure===e.data)return yt.UpdateResult.Unchanged;const s=lu.updateStructure(o,e.data);return lu.updateStructureObject(t,s,r.label),yt.UpdateResult.Updated},dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),bnt=nn.BuiltIn({name:"structure-selection-from-bundle",display:{name:"Selection",description:"Create a molecular structure from the specified structure-element bundle."},from:Se.Molecule.Structure,to:Se.Molecule.Structure,params:()=>({bundle:I.Value(Qr.Empty,{isHidden:!0}),label:I.Optional(I.Text("",{isHidden:!0}))})})({apply({a:e,params:t,cache:n}){if(t.bundle.hash!==e.data.hashCode)return vo.Null;n.source=e.data;const r=Qr.toStructure(t.bundle,e.data);if(0===r.elementCount)return vo.Null;const i={label:`${t.label||"Selection"}`,description:Xe.elementDescription(r)};return new Se.Molecule.Structure(r,i)},update:({a:e,b:t,oldParams:n,newParams:r,cache:i})=>{if(!Qr.areEqual(n.bundle,r.bundle))return yt.UpdateResult.Recreate;if(r.bundle.hash!==e.data.hashCode)return yt.UpdateResult.Null;if(i.source===e.data)return yt.UpdateResult.Unchanged;i.source=e.data;const o=Qr.toStructure(r.bundle,e.data);return 0===o.elementCount?yt.UpdateResult.Null:(t.label=`${r.label||"Selection"}`,t.description=Xe.elementDescription(o),t.data=o,yt.UpdateResult.Updated)},dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),vpe={polymer:"polymer",protein:"protein",nucleic:"nucleic",water:"water",branched:"branched",ligand:"ligand","non-standard":"non-standard",coarse:"coarse","atomic-sequence":"atomic-sequence","atomic-het":"atomic-het",spheres:"spheres"},vnt=I.objectToOptions(vpe),xnt=nn.BuiltIn({name:"structure-complex-element",display:{name:"Complex Element",description:"Create a molecular structure from the specified model."},from:Se.Molecule.Structure,to:Se.Molecule.Structure,params:{type:I.Select("atomic-sequence",vnt,{isHidden:!0})}})({apply({a:e,params:t}){let n,r;switch(t.type){case"polymer":n=Ps.polymer.query,r="Polymer";break;case"protein":n=Ps.protein.query,r="Protein";break;case"nucleic":n=Ps.nucleic.query,r="Nucleic";break;case"water":n=_i.internal.water(),r="Water";break;case"branched":n=Ps.branchedPlusConnected.query,r="Branched";break;case"ligand":n=Ps.ligandPlusConnected.query,r="Ligand";break;case"non-standard":n=Ps.nonStandardPolymer.query,r="Non-standard";break;case"coarse":n=Ps.coarse.query,r="Coarse";break;case"atomic-sequence":n=_i.internal.atomicSequence(),r="Sequence";break;case"atomic-het":n=_i.internal.atomicHet(),r="HET Groups/Ligands";break;case"spheres":n=_i.internal.spheres(),r="Coarse Spheres";break;default:Hi()}const i=n(new _f(e.data)),o=Dt.unionStructure(i);return 0===o.elementCount?vo.Null:new Se.Molecule.Structure(o,{label:r,description:Xe.elementDescription(o)})},dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),_nt=nn.BuiltIn({name:"structure-component",display:{name:"Component",description:"A molecular structure component."},from:Se.Molecule.Structure,to:Se.Molecule.Structure,params:()=>({type:I.MappedStatic("static",{static:I.Text("polymer"),expression:I.Value(pe.struct.generator.all),bundle:I.Value(Qr.Empty),script:I.Script({language:"mol-script",expression:"(sel.atom.all)"})},{isHidden:!0}),nullIfEmpty:I.Optional(I.Boolean(!0,{isHidden:!0})),label:I.Text("",{isHidden:!0})})})({apply:({a:e,params:t,cache:n})=>function Met(e,t,n){n.source=e;let i,r=Xe.Empty;switch(t.type.name){case"static":{let s;switch(t.type.params){case"all":s=Ps.all.query,i="All";break;case"polymer":s=Ps.polymer.query,i="Polymer";break;case"protein":s=Ps.protein.query,i="Protein";break;case"nucleic":s=Ps.nucleic.query,i="Nucleic";break;case"water":s=_i.internal.water(),i="Water";break;case"ion":s=Ps.ion.query,i="Ion";break;case"lipid":s=Ps.lipid.query,i="Lipid";break;case"branched":s=Ps.branchedPlusConnected.query,i="Branched";break;case"ligand":s=Ps.ligandPlusConnected.query,i="Ligand";break;case"non-standard":s=Ps.nonStandardPolymer.query,i="Non-standard";break;case"coarse":s=Ps.coarse.query,i="Coarse";break;default:Hi()}const a=s(new _f(e));r=Dt.unionStructure(a);break}case"script":case"expression":{const{selection:s,entry:a}=lu.createAndRun(e,t.type.params);n.entry=a,r=Dt.unionStructure(s);break}case"bundle":if(t.type.params.hash!==e.hashCode)break;r=Qr.toStructure(t.type.params,e)}if(t.nullIfEmpty&&0===r.elementCount)return vo.Null;const o={label:`${t.label||i||"Component"}`,description:Xe.elementDescription(r)};return new Se.Molecule.Structure(r,o)}(e.data,t,n),update:({a:e,b:t,oldParams:n,newParams:r,cache:i})=>function Ret(e,t,n,r,i){if(n.type.name!==r.type.name)return yt.UpdateResult.Recreate;let o=!1;switch(r.type.name){case"static":return n.type.params===r.type.params&&Xe.areEquivalent(e,i.source)?t.data.model===e.model?yt.UpdateResult.Unchanged:Sn.areHierarchiesEqual(e.model,t.data.model)?(t.data=t.data.remapModel(e.model),yt.UpdateResult.Updated):yt.UpdateResult.Recreate:yt.UpdateResult.Recreate;case"script":if(!pa.areEqual(n.type.params,r.type.params))return yt.UpdateResult.Recreate;case"expression":{if(n.type.params!==r.type.params)return yt.UpdateResult.Recreate;if(e===i.source)break;const a=lu.updateStructure(i.entry,e);i.source=e,t.data=Dt.unionStructure(a),lu.updateStructureObject(t,a,r.label),o=!0;break}case"bundle":if(e===i.source&&Qr.areEqual(n.type.params,r.type.params))break;i.source=e,r.type.params.hash!==e.hashCode?(o=0!==t.data.elementCount,t.data=0===t.data.elementCount?t.data:Xe.Empty):(o=!0,t.data=Qr.toStructure(r.type.params,e))}if(o){if(r.nullIfEmpty&&0===t.data.elementCount)return yt.UpdateResult.Null;t.description=Xe.elementDescription(t.data)}return n.label!==r.label&&(o=!0,t.label=`${r.label||t.label}`),o?yt.UpdateResult.Updated:yt.UpdateResult.Unchanged}(e.data,t,n,r,i),dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}}),xpe=nn.BuiltIn({name:"custom-model-properties",display:{name:"Custom Model Properties"},isDecorator:!0,from:Se.Molecule.Model,to:Se.Molecule.Model,params:(e,t)=>t.customModelProperties.getParams(e?.data)})({apply:({a:e,params:t},n)=>Ke.create("Custom Props",function(){var r=le(function*(i){return yield _pe(e.data,n,i,t),new Se.Molecule.Model(e.data,{label:e.label,description:e.description})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,oldParams:n,newParams:r},i)=>Ke.create("Custom Props",function(){var o=le(function*(s){t.data=e.data,t.label=e.label,t.description=e.description;for(const a of n.autoAttach){const l=i.customModelProperties.get(a);l&&e.data.customProperties.reference(l.descriptor,!1)}return yield _pe(e.data,i,s,r),yt.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}()),dispose({b:e}){e?.data.customProperties.dispose()}});function _pe(e,t,n,r){return eG.apply(this,arguments)}function eG(){return eG=le(function*(e,t,n,r){const i={runtime:n,assetManager:t.managers.asset},{autoAttach:o,properties:s}=r;for(const a of Object.keys(s)){const l=t.customModelProperties.get(a),c=s[a];if(o.includes(a)||l.isHidden)try{yield l.attach(i,e,c,!0)}catch(u){t.log.warn(`Error attaching model prop '${a}': ${u}`)}else l.set(e,c)}}),eG.apply(this,arguments)}const Spe=nn.BuiltIn({name:"custom-structure-properties",display:{name:"Custom Structure Properties"},isDecorator:!0,from:Se.Molecule.Structure,to:Se.Molecule.Structure,params:(e,t)=>t.customStructureProperties.getParams(e?.data.root)})({apply:({a:e,params:t},n)=>Ke.create("Custom Props",function(){var r=le(function*(i){return yield Cpe(e.data.root,n,i,t),new Se.Molecule.Structure(e.data,{label:e.label,description:e.description})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,oldParams:n,newParams:r},i)=>e.data!==t.data?yt.UpdateResult.Recreate:Ke.create("Custom Props",function(){var o=le(function*(s){t.data=e.data,t.label=e.label,t.description=e.description;for(const a of n.autoAttach){const l=i.customStructureProperties.get(a);l&&e.data.customPropertyDescriptors.reference(l.descriptor,!1)}return yield Cpe(e.data.root,i,s,r),yt.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}()),dispose({b:e}){e?.data.customPropertyDescriptors.dispose()}});function Cpe(e,t,n,r){return tG.apply(this,arguments)}function tG(){return tG=le(function*(e,t,n,r){const i={runtime:n,assetManager:t.managers.asset},{autoAttach:o,properties:s}=r;for(const a of Object.keys(s)){const l=t.customStructureProperties.get(a),c=s[a];if(o.includes(a)||l.isHidden)try{yield l.attach(i,e,c,!0)}catch(u){t.log.warn(`Error attaching structure prop '${a}': ${u}`)}else l.set(e,c)}}),tG.apply(this,arguments)}const Snt=nn.BuiltIn({name:"shape-from-ply",display:{name:"Shape from PLY",description:"Create Shape from PLY data"},from:Se.Format.Ply,to:Se.Shape.Provider,params:e=>({transforms:I.Optional(I.Value([],{isHidden:!0})),label:I.Optional(I.Text("",{isHidden:!0}))})})({apply:({a:e,params:t})=>Ke.create("Create shape from PLY",function(){var n=le(function*(r){const i=yield function sQe(e,t){return Ke.create("Shape Provider",function(){var n=le(function*(r){return{label:"Mesh",data:{source:e,transforms:t?.transforms},params:xfe(e),getShape:oQe(),geometryUtils:on.Utils}});return function(r){return n.apply(this,arguments)}}())}(e.data,t).runInContext(r);return new Se.Shape.Provider(i,{label:t.label||"Shape"})});return function(r){return n.apply(this,arguments)}}())});var nG,rG,iG,oG;!function(e){e.is=function t(r){return"ccp4"===r?.kind},e.create=function n(r){return{kind:"ccp4",name:r.name,data:r}}}(nG||(nG={})),function(e){e.is=function t(r){return"dsn6"===r?.kind},e.create=function n(r){return{kind:"dsn6",name:r.name,data:r}}}(rG||(rG={})),function(e){e.is=function t(r){return"dx"===r?.kind},e.create=function n(r){return{kind:"dx",name:r.name,data:r}}}(iG||(iG={})),function(e){e.is=function t(r){return"segcif"===r?.kind},e.create=function n(r){return{kind:"segcif",name:r._name,data:r}}}(oG||(oG={}));const Dnt=nn.BuiltIn({name:"volume-from-ccp4",display:{name:"Volume from CCP4/MRC/MAP",description:"Create Volume from CCP4/MRC/MAP data"},from:Se.Format.Ccp4,to:Se.Volume.Data,params:e=>({voxelSize:I.Vec3(C.create(1,1,1)),offset:I.Vec3(C.create(0,0,0)),entryId:I.Text("")})})({apply:({a:e,params:t})=>Ke.create("Create volume from CCP4/MRC/MAP",function(){var n=le(function*(r){const i=yield function Ant(e,t){return Ke.create("Create Volume",function(){var n=le(function*(r){const{header:i,values:o}=e,s=C.create(i.xLength,i.yLength,i.zLength);t&&t.voxelSize&&C.mul(s,s,t.voxelSize);const a=C.create(Xr(i.alpha),Xr(i.beta),Xr(i.gamma)),c=Qc.create((i.ISPG>65536?0:i.ISPG)||"P 1",s,a),u=C.create(i.MAPC-1,i.MAPR-1,i.MAPS-1),d=mr.convertToCanonicalAxisIndicesFastToSlow(u),f=[i.NX,i.NY,i.NZ],p=d([i.NC,i.NR,i.NS]),m=function Cnt(e){return 0===e.originX&&0===e.originY&&0===e.originZ?C.create(e.NCSTART,e.NRSTART,e.NSSTART):C.create(e.originX/(e.xLength/e.NX),e.originY/(e.yLength/e.NY),e.originZ/(e.zLength/e.NZ))}(i);t?.offset&&C.add(m,m,t.offset);const h=d(m),g=C.create(h[0]/f[0],h[1]/f[1],h[2]/f[2]),y=C.create(p[0]/f[0],p[1]/f[1],p[2]/f[2]),v=mr.Space(p,mr.invertAxisOrder(u),function wnt(e){const t=Hle(e);switch(t){case dl.Float32:return Float32Array;case dl.Int8:return Int8Array;case dl.Int16:return Int16Array;case dl.Uint16:return Uint16Array}throw Error(`${t} is not a supported value format.`)}(i)),x=mr.create(v,mr.Data1(o)),_=0===i.AMIN&&0===i.AMAX&&0===i.AMEAN&&0===i.ARMS;return{label:t?.label,entryId:t?.entryId,grid:{transform:{kind:"spacegroup",cell:c,fractionalBox:Gt.create(g,C.add(C.zero(),g,y))},cells:x,stats:{min:isNaN(i.AMIN)||_?OR(o):i.AMIN,max:isNaN(i.AMAX)||_?Bh(o):i.AMAX,mean:isNaN(i.AMEAN)||_?BR(o):i.AMEAN,sigma:isNaN(i.ARMS)||0===i.ARMS?LR(o):i.ARMS}},sourceData:nG.create(e),customProperties:new Oh,_propertyData:Object.create(null)}});return function(r){return n.apply(this,arguments)}}())}(e.data,{...t,label:e.data.name||e.label}).runInContext(r);return new Se.Volume.Data(i,{label:i.label||"Volume",description:`Volume ${e.data.header.NX}\xd7${e.data.header.NX}\xd7${e.data.header.NX}`})});return function(r){return n.apply(this,arguments)}}()),dispose({b:e}){e?.data.customProperties.dispose()}}),Pnt=nn.BuiltIn({name:"volume-from-dsn6",display:{name:"Volume from DSN6/BRIX",description:"Create Volume from DSN6/BRIX data"},from:Se.Format.Dsn6,to:Se.Volume.Data,params:e=>({voxelSize:I.Vec3(C.create(1,1,1)),entryId:I.Text("")})})({apply:({a:e,params:t})=>Ke.create("Create volume from DSN6/BRIX",function(){var n=le(function*(r){const i=yield function Int(e,t){return Ke.create("Create Volume",function(){var n=le(function*(r){const{header:i,values:o}=e,s=C.create(i.xlen,i.ylen,i.zlen);t&&t.voxelSize&&C.mul(s,s,t.voxelSize);const a=C.create(Xr(i.alpha),Xr(i.beta),Xr(i.gamma)),l=Qc.create("P 1",s,a),c=[i.xRate,i.yRate,i.zRate],u=[i.xExtent,i.yExtent,i.zExtent],d=[i.xStart,i.yStart,i.zStart],f=C.create(d[0]/c[0],d[1]/c[1],d[2]/c[2]),p=C.create(u[0]/c[0],u[1]/c[1],u[2]/c[2]),m=mr.Space(u,[0,1,2],Float32Array),h=mr.create(m,mr.Data1(o));return{label:t?.label,entryId:t?.entryId,grid:{transform:{kind:"spacegroup",cell:l,fractionalBox:Gt.create(f,C.add(C.zero(),f,p))},cells:h,stats:{min:OR(o),max:Bh(o),mean:BR(o),sigma:void 0!==i.sigma?i.sigma:LR(o)}},sourceData:rG.create(e),customProperties:new Oh,_propertyData:Object.create(null)}});return function(r){return n.apply(this,arguments)}}())}(e.data,{...t,label:e.data.name||e.label}).runInContext(r);return new Se.Volume.Data(i,{label:i.label||"Volume",description:`Volume ${e.data.header.xExtent}\xd7${e.data.header.yExtent}\xd7${e.data.header.zExtent}`})});return function(r){return n.apply(this,arguments)}}()),dispose({b:e}){e?.data.customProperties.dispose()}}),knt=nn.BuiltIn({name:"volume-from-cube",display:{name:"Volume from Cube",description:"Create Volume from Cube data"},from:Se.Format.Cube,to:Se.Volume.Data,params:e=>({dataIndex:e?I.Select(0,e.data.header.dataSetIds.map((n,r)=>[r,`${n}`])):I.Numeric(0),entryId:I.Text("")})})({apply:({a:e,params:t})=>Ke.create("Create volume from Cube",function(){var n=le(function*(r){const i=yield function iZe(e,t){return Ke.create("Create Volume",le(function*(){const{header:n,values:r}=e,i=mr.Space(n.dim,[0,1,2],Float64Array);let o;if(0===n.dataSetIds.length)o=r;else{const[c,u,d]=n.dim,f=(t?.dataIndex||0)+1;let p=0,m=0;o=new Float64Array(c*u*d);for(let h=0;hKe.create("Parse DX",function(){var t=le(function*(n){const r=yield function Ent(e,t){return Ke.create("Create Volume",le(function*(){const{header:n,values:r}=e,i=mr.Space(n.dim,[0,1,2],Float64Array),o=mr.create(i,mr.Data1(r)),s=fe.fromTranslation(fe(),n.min),a=fe.fromScaling(fe(),n.h);return fe.mul(s,s,a),{label:t?.label,entryId:t?.entryId,grid:{transform:{kind:"matrix",matrix:s},cells:o,stats:{min:OR(r),max:Bh(r),mean:BR(r),sigma:LR(r)}},sourceData:iG.create(e),customProperties:new Oh,_propertyData:Object.create(null)}}))}(e.data,{label:e.data.name||e.label}).runInContext(n);return new Se.Volume.Data(r,{label:r.label||"Volume",description:`Volume ${e.data.header.dim[0]}\xd7${e.data.header.dim[1]}\xd7${e.data.header.dim[2]}`})});return function(n){return t.apply(this,arguments)}}()),dispose({b:e}){e?.data.customProperties.dispose()}}),Rnt=nn.BuiltIn({name:"volume-from-density-server-cif",display:{name:"Volume from density-server CIF",description:"Identify and create all separate models in the specified CIF data block"},from:Se.Format.Cif,to:Se.Volume.Data,params(e){if(!e)return{blockHeader:I.Optional(I.Text(void 0,{description:"Header of the block to parse. If none is specifed, the 1st data block in the file is used."})),entryId:I.Text("")};const t=e.data.blocks.slice(1);return{blockHeader:I.Optional(I.Select(t[0]&&t[0].header,t.map(n=>[n.header,n.header]),{description:"Header of the block to parse"})),entryId:I.Text("")}}})({isApplicable:e=>e.data.blocks.length>0,apply:({a:e,params:t})=>Ke.create("Parse density-server CIF",function(){var n=le(function*(r){var i;const o=t.blockHeader||e.data.blocks[1].header,s=e.data.blocks.find(p=>p.header===o);if(!s)throw new Error(`Data block '${[o]}' not found.`);const a=Hh.schema.densityServer(s),l=yield pfe(a,{entryId:t.entryId}).runInContext(r),[c,u,d]=l.grid.cells.space.dimensions,f={label:null!==(i=t.entryId)&&void 0!==i?i:a.volume_data_3d_info.name.value(0),description:`Volume ${c}\xd7${u}\xd7${d}`};return new Se.Volume.Data(l,f)});return function(r){return n.apply(this,arguments)}}()),dispose({b:e}){e?.data.customProperties.dispose()}}),Nnt=nn.BuiltIn({name:"volume-from-segmentation-cif",display:{name:"Volume from Segmentation CIF"},from:Se.Format.Cif,to:Se.Volume.Data,params(e){const t=e?.data.blocks.slice(1);return{blockHeader:I.Optional(t?I.Select(t[0]&&t[0].header,t.map(r=>[r.header,r.header]),{description:"Header of the block to parse"}):I.Text(void 0,{description:"Header of the block to parse. If none is specifed, the 1st data block in the file is used."})),segmentLabels:I.ObjectList({id:I.Numeric(-1),label:I.Text("")},r=>`${r.id} = ${r.label}`,{description:"Mapping of segment IDs to segment labels"}),ownerId:I.Text("",{isHidden:!0,description:"Reference to the object which manages this volume"})}}})({isApplicable:e=>e.data.blocks.length>0,apply:({a:e,params:t})=>Ke.create("Parse segmentation CIF",function(){var n=le(function*(r){const i=t.blockHeader||e.data.blocks[1].header,o=e.data.blocks.find(p=>p.header===i);if(!o)throw new Error(`Data block '${[i]}' not found.`);const s=Hh.schema.segmentation(o),a={};for(const p of t.segmentLabels)a[p.id]=p.label;const l=yield function Tnt(e,t){return Ke.create("Create Segmentation Volume",function(){var n=le(function*(r){var i;const{volume_data_3d_info:o,segmentation_data_3d:s}=e,a=Qc.create(o.spacegroup_number.value(0),C.ofArray(o.spacegroup_cell_size.value(0)),C.scale(C(),C.ofArray(o.spacegroup_cell_angles.value(0)),Math.PI/180)),l=o.axis_order.value(0),c=mr.convertToCanonicalAxisIndicesFastToSlow(l),u=c(o.sample_count.value(0)),d=mr.Space(u,mr.invertAxisOrder(l),Float32Array),f=mr.create(d,mr.Data1(s.values.toArray({array:Float32Array}))),p=C.ofArray(c(o.origin.value(0))),m=C.ofArray(c(o.dimensions.value(0))),h={label:t?.label,entryId:void 0,grid:{transform:{kind:"spacegroup",cell:a,fractionalBox:Gt.create(p,C.add(C(),p,m))},cells:f,stats:{min:0,max:1,mean:0,sigma:1}},sourceData:oG.create(e),customProperties:new Oh,_propertyData:{ownerId:t?.ownerId}};mt.PickingGranularity.set(h,"object");const g=new Map,y=new Map,{segment_id:v,set_id:x}=e.segmentation_data_table;for(let W=0,z=v.rowCount;W{W.forEach($=>{g.has($)||g.set($,new Set),g.get($).add(z)})});const _=[0,0,0],w=f.space.getCoords,A=f.data,[M,E,D]=h.grid.cells.space.dimensions,T=M-1,F=E-1,R=D-1,N={};y.forEach((W,z)=>{N[z]=[T,F,R,-1,-1,-1]});for(let W=0,z=A.length;WV[3]&&(V[3]=_[0]),_[1]>V[4]&&(V[4]=_[1]),_[2]>V[5]&&(V[5]=_[2])}const j={};return g.forEach((W,z)=>{j[z]=Gt.create(C.create(T,F,R),C.create(-1,-1,-1))}),Nu(N,(W,z)=>{y.get(parseInt(z)).forEach($=>{const V=j[$];W[0]V.max[0]&&(V.max[0]=W[3]),W[4]>V.max[1]&&(V.max[1]=W[4]),W[5]>V.max[2]&&(V.max[2]=W[5])})}),mt.Segmentation.set(h,{segments:g,sets:y,bounds:j,labels:null!==(i=t?.segmentLabels)&&void 0!==i?i:{}}),h});return function(r){return n.apply(this,arguments)}}())}(s,{segmentLabels:a,ownerId:t.ownerId}).runInContext(r),[c,u,d]=l.grid.cells.space.dimensions,f={label:s.volume_data_3d_info.name.value(0),description:`Segmentation ${c}\xd7${u}\xd7${d}`};return new Se.Volume.Data(l,f)});return function(r){return n.apply(this,arguments)}}()),dispose({b:e}){e?.data.customProperties.dispose()}}),Fnt=nn.BuiltIn({name:"assign-color-volume",display:{name:"Assign Color Volume",description:"Assigns another volume to be available for coloring."},from:Se.Volume.Data,to:Se.Volume.Data,isDecorator:!0,params(e,t){if(!e)return{ref:I.Text()};const n=t.state.data.select(Qn.Generators.root.subtree().ofType(Se.Volume.Data).filter(r=>{var i;return!(!r.obj||null!==(i=r.obj)&&void 0!==i&&i.data.colorVolume||r.obj===e)}));return 0===n.length?{ref:I.Text("",{isHidden:!0})}:{ref:I.Select(n[0].transform.ref,n.map(r=>[r.transform.ref,r.obj.label]))}}})({apply:({a:e,params:t,dependencies:n})=>Ke.create("Assign Color Volume",function(){var r=le(function*(i){if(!n||!n[t.ref])throw new Error("Dependency not available.");const s={...e.data,colorVolume:n[t.ref].data};return new Se.Volume.Data(s,{label:e.label,description:"Volume + Colors"})});return function(i){return r.apply(this,arguments)}}())}),GN=st(13421772),wpe={},Lnt={name:"carbohydrate-symbol",label:"Carbohydrate Symbol",category:xo.Residue,factory:function Ape(e,t){let n;if(e.structure){const{elements:r,getElementIndices:i}=e.structure.carbohydrates,o=(s,a)=>{if(!ze.isAtomic(s))return GN;const l=i(s,a);return l.length>0?r[l[0]].component.color:GN};n=(s,a)=>a?15854817:dt.is(s)?o(s.unit,s.element):fn.isLocation(s)?o(s.aUnit,s.aUnit.elements[s.aIndex]):GN}else n=()=>GN;return{factory:Ape,granularity:"group",color:n,props:t,description:"Assigns colors according to the Symbol Nomenclature for Glycans (SNFG).",legend:v1(s6e)}},getParams:function Bnt(e){return wpe},defaultValues:I.getDefaultValues(wpe),isApplicable:e=>!!e.structure&&e.structure.models.some(t=>Sn.hasCarbohydrate(t))},Ipe={hue:I.Interval([1,360],{min:0,max:360,step:1}),chroma:I.Interval([40,70],{min:0,max:100,step:1}),luminance:I.Interval([15,85],{min:0,max:100,step:1}),sort:I.Select("contrast",I.arrayToOptions(["none","contrast"]),{description:"no sorting leaves colors approximately ordered by hue"}),clusteringStepCount:I.Numeric(50,{min:10,max:200,step:1},{isHidden:!0}),minSampleCount:I.Numeric(800,{min:100,max:5e3,step:100},{isHidden:!0}),sampleCountFactor:I.Numeric(5,{min:1,max:100,step:1},{isHidden:!0})},cA=2,F_=[0,0,0],O_=[0,0,0];function jnt(e,t){return qa.toHcl(F_,e),qa.fromColor(O_,qa.toColor(e)),F_[0]>=t.hue[0]&&F_[0]<=t.hue[1]&&F_[1]>=t.chroma[0]&&F_[1]<=t.chroma[1]&&F_[2]>=t.luminance[0]&&F_[2]<=t.luminance[1]&&O_[0]>=e[0]-cA&&O_[0]<=e[0]+cA&&O_[1]>=e[1]-cA&&O_[1]<=e[1]+cA&&O_[2]>=e[2]-cA&&O_[2]<=e[2]+cA}function Epe(e,t){let n=1/0,r=0;for(let i=0;i`${e+1}`,minLabel:"Start",maxLabel:"End"};function Yu(e,t,n={}){var r;let i,o;if("colors"===t.palette.name&&"interpolate"===t.palette.params.list.kind){const{list:s}=t.palette.params,a=[0,e-1],{minLabel:l,maxLabel:c}={...Dpe,...n};let u=s.colors;0===u.length&&(u=cp(Tpe.colorList).list);const d=up.create({listOrName:u,domain:a,minLabel:l,maxLabel:c});o=d.legend,i=d.color}else{let s;"colors"===t.palette.name?(s=t.palette.params.list.colors.map(u=>Array.isArray(u)?u[0]:u),0===s.length&&(s=cp("dark-2").list.map(u=>Array.isArray(u)?u[0]:u))):(e=Math.min(e,t.palette.params.maxCount),s=function Vnt(e,t={}){const n={...I.getDefaultValues(Ipe),...t};if(e<=0)return[];const r=function znt(e,t){const n=new Map,r=Math.ceil(Math.cbrt(e)),i=Vh(),o=Math.max((t.hue[1]-t.hue[0])/r,1),s=Math.max((t.chroma[1]-t.chroma[0])/r,1),a=Math.max((t.luminance[1]-t.luminance[0])/r,1);for(let l=t.hue[0]+o/2;l<=t.hue[1];l+=o)for(let c=t.chroma[0]+s/2;c<=t.chroma[1];c+=s)for(let u=t.luminance[0]+a/2;u<=t.luminance[1];u+=a){const d=qa.fromHcl(qa(),Vh.set(i,l,c,u));jnt(d,t)&&n.set(qa.toColor(d),d)}return Array.from(n.values())}(Math.max(n.minSampleCount,e*n.sampleCountFactor),n);if(r.length=e));l+=s);for(let l=1;l<=n.clusteringStepCount;++l){const c=op(o),u=op(r);for(let f=0;f0;){const r=n[n.length-1];let i=0,o=Number.NEGATIVE_INFINITY;for(let s=0;so&&(o=a,i=s)}n.push(t.splice(i,1)[0])}return n}(i):i).map(l=>qa.toColor(l))}(e,t.palette.params));const a=null!==(r=n.valueLabel)&&void 0!==r?r:Dpe.valueLabel,l=s.length,c=[];for(let u=0;us[u%l]}return{color:i,legend:o}}const Ppe=st(16448250),Gnt="Gives every chain a color based on its `asym_id` value.",YD={asymId:I.Select("auth",I.arrayToOptions(["auth","label"])),...cu({type:"colors",colorList:"many-distinct"})};function kpe(e,t){const n=function Wnt(e,t){switch(e.kind){case 0:return"auth"===t?Je.chain.auth_asym_id:Je.chain.label_asym_id;case 1:case 2:return Je.coarse.asym_id}}(e.unit,t)(e);return e.structure.root.models.length>1?Mpe(e.unit.model,n):n}function Mpe(e,t){return`${t}|${(Sn.Index.get(e).value||0)+1}`}function XD(e,t){let n,r;if(e.structure){const i=dt.create(e.structure.root),o=function $nt(e,t){const n=new Map;for(const r of e.models){const i=Sn.AsymIdOffset.get(r).value,o=("auth"===t?i?.auth:i?.label)||0;let s=0;r.properties.structAsymMap.forEach(({auth_id:a},l)=>{const c="auth"===t?a:l,u=e.models.length>1?Mpe(r,c):c;n.has(u)||(n.set(u,s+o),++s)})}return n}(e.structure.root,t.asymId),s=Array.from(o.keys()),l=Yu(o.size,t,{valueLabel:c=>s[c]});r=l.legend,n=c=>{let u;if(dt.is(c)){const d=kpe(c,t.asymId);u=o.get(d)}else if(fn.isLocation(c)){i.unit=c.aUnit,i.element=c.aUnit.elements[c.aIndex];const d=kpe(i,t.asymId);u=o.get(d)}return void 0===u?Ppe:l.color(u)}}else n=()=>Ppe;return{factory:XD,granularity:"group",color:n,props:t,description:Gnt,legend:r}}const Rpe={name:"chain-id",label:"Chain Id",category:xo.Chain,factory:XD,getParams:function qnt(e){var t;const n=I.clone(YD);return!(null===(t=e.structure)||void 0===t)&&t.models.some(r=>r.coarseHierarchy.isDefined)&&(n.asymId.defaultValue="label"),n},defaultValues:I.getDefaultValues(YD),isApplicable:e=>!!e.structure},Npe=st(13421772),Fpe={...cu({type:"colors",colorList:"red-yellow-blue"})},Knt={name:"element-index",label:"Element Index",category:xo.Atom,factory:function Ope(e,t){let n,r;if(e.structure){const{units:i}=e.structure.root,o=i.length,s=new Map,a=new Map;let l=0;for(let u=0;u{if(dt.is(u)){const d=a.get(u.unit.id),f=Ve.findPredecessorIndex(i[d].elements,u.element);return c.color(s.get(d)+f)}if(fn.isLocation(u)){const d=a.get(u.aUnit.id),f=Ve.findPredecessorIndex(i[d].elements,u.aUnit.elements[u.aIndex]);return c.color(s.get(d)+f)}return Npe}}else n=()=>Npe;return{factory:Ope,granularity:"groupInstance",preferSmoothing:!0,color:n,props:t,description:"Gives every element (atom or coarse sphere/gaussian) a unique color based on the position (index) of the element in the list of elements in the structure.",legend:r}},getParams:function Xnt(e){return Fpe},defaultValues:I.getDefaultValues(Fpe),isApplicable:e=>!!e.structure};function qN(e){const t={};return Nu(e,(n,r)=>{t[r]=I.Color(e[r])}),t}const Bpe=st(13421772),Qnt="Assigns a color based on the operator name of a transformed chain.",sG={...cu({type:"colors",colorList:"many-distinct"})};function aG(e,t){let n,r;if(e.structure){const i=function ert(e){const t=new Map;for(let n=0,r=e.units.length;no[l]});r=a.legend,n=l=>{let c;return dt.is(l)?c=i.get(l.unit.conformation.operator.name):fn.isLocation(l)&&(c=i.get(l.aUnit.conformation.operator.name)),void 0===c?Bpe:a.color(c)}}else n=()=>Bpe;return{factory:aG,granularity:"instance",color:n,props:t,description:Qnt,legend:r}}const lG={name:"operator-name",label:"Operator Name",category:xo.Symmetry,factory:aG,getParams:function Jnt(e){return I.clone(sG)},defaultValues:I.getDefaultValues(sG),isApplicable:e=>!!e.structure},Lpe=st(16448250),nrt="Gives every chain a color based on its `label_entity_id` value.",KD={...cu({type:"colors",colorList:"many-distinct"})};function ZD(e,t){return`${e}|${t}`}function jpe(e){switch(e.unit.kind){case 0:return Je.chain.label_entity_id(e);case 1:case 2:return Je.coarse.entity_id(e)}}function QD(e,t){let n,r;if(e.structure){const i=dt.create(e.structure.root),o=function irt(e){const t=new Map;for(let n=0,r=e.models.length;ns[c]});r=l.legend,n=c=>{let u;if(dt.is(c)){const p=ZD(jpe(c),c.structure.models.indexOf(c.unit.model));u=o.get(p)}else if(fn.isLocation(c)){i.unit=c.aUnit,i.element=c.aUnit.elements[c.aIndex];const p=ZD(jpe(i),i.structure.models.indexOf(i.unit.model));u=o.get(p)}return void 0===u?Lpe:l.color(u)}}else n=()=>Lpe;return{factory:QD,granularity:"group",color:n,props:t,description:nrt,legend:r}}const ort={name:"entity-id",label:"Entity Id",category:xo.Chain,factory:QD,getParams:function rrt(e){return I.clone(KD)},defaultValues:I.getDefaultValues(KD),isApplicable:e=>!!e.structure},cG="dark-2",WN=st(16448250),srt="Gives ranges of a polymer chain a color based on the entity source it originates from (e.g. gene, plasmid, organism).",JD={...cu({type:"colors",colorList:cG})};function Upe(e,t){return`${e}|${t}`}function lrt(e,t,n,r,i,o){return`${e}|${t}|${n}|${o||i||r}`}function uG(e,t,n,r,i,o,s,a){const{entity_id:l,pdbx_src_id:c,pdbx_beg_seq_num:u,pdbx_end_seq_num:d}=i;for(let f=0,p=i._rowCount;f{const r=n.split("|"),i=r[2];return`${function u8e(e){e=e.trim();const t=parseInt(e,10);return!isNaN(t)&&t.toString()===e}(r[3])?"Unnamed "+ ++t:r[3]}${i?` (${i})`:""}`})}(a),u=Yu(a.size,t,{valueLabel:f=>l[f]});r=u.legend;const d=f=>{const h=Upe(o.indexOf(f.unit.model),Je.entity.id(f)),g=s.get(h);if(g){const y=g[Je.residue.label_seq_id(f)-1]-1;return-1===y?WN:u.color(y)}return WN};n=f=>dt.is(f)?d(f):fn.isLocation(f)?(i.unit=f.aUnit,i.element=f.aUnit.elements[f.aIndex],d(i)):WN}else n=()=>WN;return{factory:eP,granularity:"group",color:n,props:t,description:srt,legend:r}}const urt={name:"entity-source",label:"Entity Source",category:xo.Chain,factory:eP,getParams:function art(e){const t=I.clone(JD);return e.structure&&zpe(e.structure.root.models).srcKeySerialMap.size>Ad[cG].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params={...t.palette.defaultValue.params,list:{kind:"interpolate",colors:cp(cG).list}}),t},defaultValues:I.getDefaultValues(JD),isApplicable:e=>!!e.structure},Vpe=st(13421772),drt="Gives every model a unique color based on its index.",tP={...cu({type:"colors",colorList:"many-distinct"})};function nP(e,t){var n;let r,i;if(e.structure){const s=Yu((null!==(n=Sn.MaxIndex.get(e.structure.models[0]).value)&&void 0!==n?n:-1)+1,t);i=s.legend,r=a=>dt.is(a)?s.color(Sn.Index.get(a.unit.model).value||0):fn.isLocation(a)?s.color(Sn.Index.get(a.aUnit.model).value||0):Vpe}else r=()=>Vpe;return{factory:nP,granularity:"instance",color:r,props:t,description:drt,legend:i}}const prt={name:"model-index",label:"Model Index",category:xo.Chain,factory:nP,getParams:function frt(e){return I.clone(tP)},defaultValues:I.getDefaultValues(tP),isApplicable:e=>!!e.structure&&e.structure.elementCount>0},Hpe=st(13421772),hrt="Gives every structure a unique color based on its index.",rP={...cu({type:"colors",colorList:"many-distinct"})};function iP(e,t){var n;let r,i;if(e.structure){const s=Yu((null!==(n=Xe.MaxIndex.get(e.structure).value)&&void 0!==n?n:-1)+1,t);i=s.legend,r=a=>dt.is(a)?s.color(Xe.Index.get(a.structure).value||0):fn.isLocation(a)?s.color(Xe.Index.get(a.aStructure).value||0):Hpe}else r=()=>Hpe;return{factory:iP,granularity:"instance",color:r,props:t,description:hrt,legend:i}}const grt={name:"structure-index",label:"Structure Index",category:xo.Chain,factory:iP,getParams:function mrt(e){return I.clone(rP)},defaultValues:I.getDefaultValues(rP),isApplicable:e=>!!e.structure&&e.structure.elementCount>0},dG="dark-2",Gpe=st(13421772),yrt="Gives every chain instance (single chain or collection of single elements) a unique color based on the position (index) of the chain in the list of chains in the structure.",fG={...cu({type:"colors",colorList:dG})};function pG(e,t){let n,r;if(e.structure){const{units:i}=e.structure.root,o=Yu(i.length,t);r=o.legend;const s=new Map;for(let a=0,l=i.length;adt.is(a)?s.get(a.unit.id):fn.isLocation(a)?s.get(a.aUnit.id):Gpe}else n=()=>Gpe;return{factory:pG,granularity:"instance",color:n,props:t,description:yrt,legend:r}}const vrt={name:"unit-index",label:"Chain Instance",category:xo.Chain,factory:pG,getParams:function brt(e){const t=I.clone(fG);return e.structure&&e.structure.root.units.length>Ad[dG].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params={...t.palette.defaultValue.params,list:{kind:"interpolate",colors:cp(dG).list}}),t},defaultValues:I.getDefaultValues(fG),isApplicable:e=>!!e.structure},qpe={H:16777215,D:16777152,T:16777120,HE:14286847,LI:13402367,BE:12779264,B:16758197,C:9474192,N:3166456,O:16715021,F:9494608,NE:11789301,NA:11230450,MG:9109248,AL:12560038,SI:1578e4,P:16744448,S:16777008,CL:2093087,AR:8442339,K:9388244,CA:4062976,SC:15132390,TI:12567239,V:10921643,CR:9083335,MN:10255047,FE:14706227,CO:15765664,NI:5296208,CU:13140019,ZN:8224944,GA:12750735,GE:6721423,AS:12419299,SE:16752896,BR:10889513,KR:6076625,RB:7351984,SR:65280,Y:9764863,ZR:9756896,NB:7586505,MO:5551541,TC:3907230,RU:2396047,RH:687500,PD:27013,AG:12632256,CD:16767375,IN:10909043,SN:6717568,SB:10380213,TE:13924864,I:9699476,XE:9699476,CS:5707663,BA:51456,LA:7394559,CE:16777159,PR:14286791,ND:13107143,PM:10747847,SM:9437127,EU:6422471,GD:4587463,TB:3211207,DY:2097095,HO:65436,ER:58997,TM:54354,YB:48952,LU:43812,HF:5096191,TA:5089023,W:2200790,RE:2522539,OS:2516630,IR:1528967,PT:13684960,AU:16765219,HG:12105936,TL:10900557,PB:5724513,BI:10375093,PO:11230208,AT:7688005,RN:4358806,FR:4325478,RA:32e3,AC:7384058,TH:47871,PA:41471,U:36863,NP:33023,PU:27647,AM:5528818,CM:7888099,BK:9064419,CF:10565332,ES:11739092,FM:11739066,MD:11734438,NO:12389767,LR:13041766,RF:13369433,DB:13697103,SG:14221381,BH:14680120,HS:15073326,MT:15400998,DS:16777215,RG:16777215,CN:16777215,UUT:16777215,FL:16777215,UUP:16777215,LV:16777215,UUH:16777215},Wpe=st(16777215),hG={carbonColor:I.MappedStatic("chain-id",{"chain-id":I.Group(YD),"unit-index":I.Group(fG,{label:"Chain Instance"}),"entity-id":I.Group(KD),"entity-source":I.Group(JD),"operator-name":I.Group(sG),"model-index":I.Group(tP),"structure-index":I.Group(rP),uniform:I.Group(Vw),"element-symbol":I.EmptyGroup()},{description:"Use chain-id coloring for carbon atoms."}),saturation:I.Numeric(0,{min:-6,max:6,step:.1}),lightness:I.Numeric(.2,{min:-6,max:6,step:.1}),colors:I.MappedStatic("default",{default:I.EmptyGroup(),custom:I.Group(qN(qpe))})};function mG(e,t){var n;const r=YR("default"===t.colors.name?qpe:t.colors.params,t.saturation,t.lightness),i=null===(n=function Crt(e,t){switch(t.name){case"chain-id":return XD(e,t.params);case"unit-index":return pG(e,t.params);case"entity-id":return QD(e,t.params);case"entity-source":return eP(e,t.params);case"operator-name":return aG(e,t.params);case"model-index":return nP(e,t.params);case"structure-index":return iP(e,t.params);case"uniform":return I_(0,t.params);case"element-symbol":return;default:Hi()}}(e,t.carbonColor))||void 0===n?void 0:n.color;function o(l,c){return i&&"C"===l?i(c,!1):function Srt(e,t){const n=e[t];return void 0===n?Wpe:n}(r,l)}return{factory:mG,granularity:"operator-name"===t.carbonColor.name||"unit-index"===t.carbonColor.name?"groupInstance":"group",preferSmoothing:!0,color:function s(l){if(dt.is(l)){if(ze.isAtomic(l.unit)){const{type_symbol:c}=l.unit.model.atomicHierarchy.atoms;return o(c.value(l.element),l)}}else if(fn.isLocation(l)&&ze.isAtomic(l.aUnit)){const{type_symbol:c}=l.aUnit.model.atomicHierarchy.atoms;return o(c.value(l.aUnit.elements[l.aIndex]),l)}return Wpe},props:t,description:"Assigns a color to every atom according to its chemical element.",legend:v1(Object.keys(r).map(l=>[l,r[l]]))}}const wrt={name:"element-symbol",label:"Element Symbol",category:xo.Atom,factory:mG,getParams:function _rt(e){return I.clone(hG)},defaultValues:I.getDefaultValues(hG),isApplicable:e=>!!e.structure},$pe={water:3697840,ion:15729279,protein:12496596,RNA:16629894,DNA:12540695,PNA:4367514,saccharide:8374655},gG=st(16777113),$N={saturation:I.Numeric(0,{min:-6,max:6,step:.1}),lightness:I.Numeric(0,{min:-6,max:6,step:.1}),colors:I.MappedStatic("default",{default:I.EmptyGroup(),custom:I.Group(qN($pe))})};function Ype(e,t,n){switch(gz(t,n)){case 2:return e.water;case 3:return e.ion;case 5:return e.protein;case 6:return e.RNA;case 7:return e.DNA;case 8:return e.PNA;case 9:return e.saccharide}return gG}function YN(e,t){const n=YR("default"===t.colors.name?$pe:t.colors.params,t.saturation,t.lightness);return{factory:YN,granularity:"group",color:function r(i){return dt.is(i)?Ype(n,i.unit,i.element):fn.isLocation(i)?Ype(n,i.aUnit,i.aUnit.elements[i.aIndex]):gG},props:t,description:"Assigns a color based on the molecule type of a residue.",legend:v1(Object.keys(n).map(i=>[i,n[i]]).concat([["Other/unknown",gG]]))}}const Ert={name:"molecule-type",label:"Molecule Type",category:xo.Residue,factory:YN,getParams:function Irt(e){return $N},defaultValues:I.getDefaultValues($N),isApplicable:e=>!!e.structure},yG="dark-2",Xpe=st(16448250),Kpe={...cu({type:"colors",colorList:yG})};function Zpe(e){switch(e.kind){case 0:return Je.chain.label_asym_id;case 1:case 2:return Je.coarse.asym_id}}function Qpe(e){const t=new Map;for(let n=0,r=e.unitSymmetryGroups.length;ns[c]});r=l.legend,n=c=>{let u;if(dt.is(c)){const d=Zpe(c.unit);u=o.get(d(c))}else if(fn.isLocation(c)){const d=Zpe(c.aUnit);i.unit=c.aUnit,i.element=c.aUnit.elements[c.aIndex],u=o.get(d(i))}return void 0===u?Xpe:l.color(u)}}else n=()=>Xpe;return{factory:Jpe,granularity:"group",color:n,props:t,description:"Gives every polymer chain a color based on its `asym_id` value.",legend:r}},getParams:function Drt(e){const t=I.clone(Kpe);return e.structure&&Qpe(e.structure.root).size>Ad[yG].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params={...t.palette.defaultValue.params,list:{kind:"interpolate",colors:cp(yG).list}}),t},defaultValues:I.getDefaultValues(Kpe),isApplicable:e=>!!e.structure},bG="dark-2",ehe=st(13421772),the={...cu({type:"colors",colorList:bG})};function nhe(e){let t=0;const{units:n}=e;for(let r=0,i=n.length;r0&&++t;return t}const Rrt={name:"polymer-index",label:"Polymer Chain Instance",category:xo.Chain,factory:function rhe(e,t){let n,r;if(e.structure){const i=Yu(nhe(e.structure.root),t);r=i.legend;const{units:o}=e.structure.root,s=new Map;for(let a=0,l=0,c=o.length;a0&&(s.set(o[a].id,i.color(l)),++l);n=a=>{let l;return dt.is(a)?l=s.get(a.unit.id):fn.isLocation(a)&&(l=s.get(a.aUnit.id)),void 0!==l?l:ehe}}else n=()=>ehe;return{factory:rhe,granularity:"instance",color:n,props:t,description:"Gives every polymer chain instance a unique color based on the position (index) of the polymer in the list of polymers in the structure.",legend:r}},getParams:function Mrt(e){const t=I.clone(the);return e.structure&&nhe(e.structure.root)>Ad[bG].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params={...t.palette.defaultValue.params,list:{kind:"interpolate",colors:cp(bG).list}}),t},defaultValues:I.getDefaultValues(the),isApplicable:e=>!!e.structure},ihe={ALA:9240460,ARG:124,ASN:16743536,ASP:10485826,CYS:16777072,GLN:16731212,GLU:6684672,GLY:15658734,HIS:7368959,ILE:19456,LEU:4546117,LYS:4671416,MET:12099650,PHE:5459026,PRO:5395026,SER:16740418,THR:12078080,TRP:5195264,TYR:9203788,VAL:16747775,A:14423100,G:3329330,I:10145074,C:16766720,T:4286945,U:4251856,DA:14423100,DG:3329330,DI:10145074,DC:16766720,DT:4286945,DU:4251856,APN:14423100,GPN:3329330,CPN:16766720,TPN:4286945},vG=st(16711935),xG={saturation:I.Numeric(0,{min:-6,max:6,step:.1}),lightness:I.Numeric(1,{min:-6,max:6,step:.1}),colors:I.MappedStatic("default",{default:I.EmptyGroup(),custom:I.Group(qN(ihe))})};function ohe(e,t){return e.model.atomicHierarchy.atoms.label_comp_id.value(t)}function she(e,t){const n=e.coarseElements.seq_id_begin.value(t);if(n===e.coarseElements.seq_id_end.value(t))return e.model.sequence.byEntityKey[e.coarseElements.entityKey[t]].sequence.compId.value(n-1)}function XN(e,t){const n=e[t];return void 0===n?vG:n}function _G(e,t){const n=YR("default"===t.colors.name?ihe:t.colors.params,t.saturation,t.lightness);return{factory:_G,granularity:"group",preferSmoothing:!0,color:function r(i){if(dt.is(i)){if(ze.isAtomic(i.unit)){const o=ohe(i.unit,i.element);return XN(n,o)}{const o=she(i.unit,i.element);if(o)return XN(n,o)}}else if(fn.isLocation(i)){if(ze.isAtomic(i.aUnit)){const o=ohe(i.aUnit,i.aUnit.elements[i.aIndex]);return XN(n,o)}{const o=she(i.aUnit,i.aUnit.elements[i.aIndex]);if(o)return XN(n,o)}}return vG},props:t,description:"Assigns a color to every residue according to its name.",legend:v1(Object.keys(n).map(i=>[i,n[i]]).concat([["Unknown",vG]]))}}const Ort={name:"residue-name",label:"Residue Name",category:xo.Residue,factory:_G,getParams:function Frt(e){return xG},defaultValues:I.getDefaultValues(xG),isApplicable:e=>!!e.structure},ahe={alphaHelix:16711808,threeTenHelix:10485888,piHelix:6291584,betaTurn:6324479,betaStrand:16762880,coil:16777215,bend:6740169,turn:45670,dna:11403518,rna:16580962,carbohydrate:10921722},SG=st(8421504),CG={saturation:I.Numeric(-1,{min:-6,max:6,step:.1}),lightness:I.Numeric(0,{min:-6,max:6,step:.1}),colors:I.MappedStatic("default",{default:I.EmptyGroup(),custom:I.Group(qN(ahe))})};function lhe(e,t,n,r){let i=pi.create(0);if(r&&ze.isAtomic(t)){const o=r.get(t.invariantId);o&&(i=o.type[o.getIndex(t.residueIndex[n])])}if(pi.is(i,2))return pi.is(i,2048)?e.threeTenHelix:pi.is(i,32768)?e.piHelix:e.alphaHelix;if(pi.is(i,4))return e.betaStrand;if(pi.is(i,8))return e.bend;if(pi.is(i,16))return e.turn;{const o=gz(t,n);if(7===o)return e.dna;if(6===o)return e.rna;if(9===o)return e.carbohydrate;if(5===o)return e.coil}return SG}function wG(e,t){const n=e.structure&&gp.get(e.structure),r=n?Yx(n.id,n.version):-1,i=YR("default"===t.colors.name?ahe:t.colors.params,t.saturation,t.lightness);return{factory:wG,granularity:"group",preferSmoothing:!0,color:function o(s){return dt.is(s)?lhe(i,s.unit,s.element,n?.value):fn.isLocation(s)?lhe(i,s.aUnit,s.aUnit.elements[s.aIndex],n?.value):SG},props:t,contextHash:r,description:"Assigns a color based on the type of secondary structure and basic molecule type.",legend:v1(Object.keys(i).map(s=>[s,i[s]]).concat([["Other",SG]]))}}const jrt={name:"secondary-structure",label:"Secondary Structure",category:xo.Residue,factory:wG,getParams:function Lrt(e){return CG},defaultValues:I.getDefaultValues(CG),isApplicable:e=>!!e.structure,ensureCustomProperties:{attach:(e,t)=>t.structure?gp.attach(e,t.structure,void 0,!0):Promise.resolve(),detach:e=>e.structure&&gp.ref(e.structure,!1)}},Urt=st(13421772),che={list:I.ColorList("turbo",{presetKind:"scale"})};function uhe(e,t){const{model:n}=e;switch(e.kind){case 0:return n.atomicHierarchy.residues.label_seq_id.value(n.atomicHierarchy.residueAtomSegments.index[t]);case 1:return Math.round((n.coarseHierarchy.spheres.seq_id_begin.value(t)+n.coarseHierarchy.spheres.seq_id_end.value(t))/2);case 2:return Math.round((n.coarseHierarchy.gaussians.seq_id_begin.value(t)+n.coarseHierarchy.gaussians.seq_id_end.value(t))/2)}}function dhe(e,t){const{model:n}=e;let r="";switch(e.kind){case 0:r=n.atomicHierarchy.chains.label_entity_id.value(n.atomicHierarchy.chainAtomSegments.index[t]);break;case 1:r=n.coarseHierarchy.spheres.entity_id.value(t);break;case 2:r=n.coarseHierarchy.gaussians.entity_id.value(t)}if(""===r)return 0;const i=n.entities.getEntityIndex(r);if(-1===i)return 0;const o=n.sequence.byEntityKey[i];return void 0===o?0:o.sequence.length}const Hrt={name:"sequence-id",label:"Sequence Id",category:xo.Residue,factory:function fhe(e,t){const n=up.create({listOrName:t.list.colors,minLabel:"Start",maxLabel:"End"});return{factory:fhe,granularity:"group",preferSmoothing:!0,color:i=>{if(dt.is(i)){const{unit:o,element:s}=i,a=uhe(o,s);if(a>0){const l=dhe(o,s);if(l)return n.setDomain(0,l-1),n.color(a)}}else if(fn.isLocation(i)){const{aUnit:o,aIndex:s}=i,a=uhe(o,o.elements[s]);if(a>0){const l=dhe(o,o.elements[s]);if(l)return n.setDomain(0,l-1),n.color(a)}}return Urt},props:t,description:"Gives every polymer residue a color based on its `seq_id` value.",legend:n?n.legend:void 0}},getParams:function Vrt(e){return che},defaultValues:I.getDefaultValues(che),isApplicable:e=>!!e.structure},Grt=st(16777113),phe={domain:I.Interval([0,100]),list:I.ColorList("red-white-blue",{presetKind:"scale"})};function hhe(e,t){return ze.isAtomic(e)?e.model.atomicConformation.B_iso_or_equiv.value(t):ze.isSpheres(e)?e.model.coarseConformation.spheres.rmsf[t]:0}const $rt={name:"uncertainty",label:"Uncertainty/Disorder",category:xo.Atom,factory:function mhe(e,t){const n=up.create({reverse:!0,domain:t.domain,listOrName:t.list.colors});return{factory:mhe,granularity:"group",preferSmoothing:!0,color:function r(i){return dt.is(i)?n.color(hhe(i.unit,i.element)):fn.isLocation(i)?n.color(hhe(i.aUnit,i.aUnit.elements[i.aIndex])):Grt},props:t,description:"Assigns a color based on the uncertainty or disorder of an element's position, e.g. B-factor or RMSF, depending on the data availability and experimental technique.",legend:n?n.legend:void 0}},getParams:function Wrt(e){return phe},defaultValues:I.getDefaultValues(phe),isApplicable:e=>!!e.structure&&e.structure.models.some(t=>t.atomicConformation.B_iso_or_equiv.isDefined||t.coarseHierarchy.isDefined)},Yrt=st(15658734),ghe={style:I.MappedStatic("entity-id",{uniform:I.Group(Vw),"chain-id":I.Group(YD),"entity-id":I.Group(KD),"entity-source":I.Group(JD),"molecule-type":I.Group($N),"model-index":I.Group(tP),"structure-index":I.Group(rP)}),carbonLightness:I.Numeric(.8,{min:-6,max:6,step:.1})},Qrt={name:"illustrative",label:"Illustrative",category:xo.Misc,factory:function yhe(e,t){const{color:n,legend:r}=function Zrt(e,t){switch(t.name){case"uniform":return I_(0,t.params);case"chain-id":return XD(e,t.params);case"entity-id":return QD(e,t.params);case"entity-source":return eP(e,t.params);case"molecule-type":return YN(0,t.params);case"model-index":return nP(e,t.params);case"structure-index":return iP(e,t.params);default:Hi()}}(e,t.style);function i(s,a){const l=n(s,!1);return"C"===a?st.lighten(l,t.carbonLightness):l}return{factory:yhe,granularity:"group",preferSmoothing:!0,color:function o(s){if(dt.is(s)&&ze.isAtomic(s.unit)){const a=s.unit.model.atomicHierarchy.atoms.type_symbol.value(s.element);return i(s,a)}if(fn.isLocation(s)&&ze.isAtomic(s.aUnit)){const l=s.aUnit.model.atomicHierarchy.atoms.type_symbol.value(s.aUnit.elements[s.aIndex]);return i(s,l)}return Yrt},props:t,description:"Assigns an illustrative color that gives every chain a color based on the chosen style but with lighter carbons (inspired by David Goodsell's Molecule of the Month style).",legend:r}},getParams:function Krt(e){return I.clone(ghe)},defaultValues:I.getDefaultValues(ghe),isApplicable:e=>!!e.structure},bhe={list:I.ColorList("red-yellow-green",{presetKind:"scale"}),scale:I.Select("DGwif",[["DGwif","DG water-membrane"],["DGwoct","DG water-octanol"],["Oct-IF","DG difference"]])},tit={DGwif:0,DGwoct:1,"Oct-IF":2};function vhe(e,t){return e.model.atomicHierarchy.atoms.label_comp_id.value(t)}function xhe(e,t){const n=e.coarseElements.seq_id_begin.value(t);if(n===e.coarseElements.seq_id_end.value(t))return e.model.sequence.byEntityKey[e.coarseElements.entityKey[t]].sequence.compId.value(n-1)}const rit={name:"hydrophobicity",label:"Hydrophobicity",category:xo.Residue,factory:function _he(e,t){const n=tit[t.scale];let r=1/0,i=-1/0;for(const a in nz){const l=nz[a][n];r=Math.min(r,l),i=Math.max(i,l)}const o=up.create({listOrName:t.list.colors,domain:[i,r],minLabel:"Hydrophilic",maxLabel:"Hydrophobic"});return{factory:_he,granularity:"group",preferSmoothing:!0,color:function s(a){let l;return dt.is(a)?l=ze.isAtomic(a.unit)?vhe(a.unit,a.element):xhe(a.unit,a.element):fn.isLocation(a)&&(l=ze.isAtomic(a.aUnit)?vhe(a.aUnit,a.aUnit.elements[a.aIndex]):xhe(a.aUnit,a.aUnit.elements[a.aIndex])),o.color(l?function nit(e,t){const n=nz[e];return void 0===n?0:n[t]}(l,n):0)},props:t,description:'Assigns a color to every amino acid according to the "Experimentally determined hydrophobicity scale for proteins at membrane interfaces" by Wimely and White (doi:10.1038/nsb1096-842).',legend:o?o.legend:void 0}},getParams:function eit(e){return bhe},defaultValues:I.getDefaultValues(bhe),isApplicable:e=>!!e.structure},She=st(13421772),Che={...cu({type:"colors",colorList:"purples"})},sit={name:"trajectory-index",label:"Trajectory Index",category:xo.Chain,factory:function whe(e,t){var n,r;let i,o;if(e.structure){const{models:s}=e.structure.root;let a=0;for(const u of s)a=Math.max(a,(null===(n=Sn.TrajectoryInfo.get(u))||void 0===n?void 0:n.size)||0);const l=Yu(a,t);o=l.legend;const c=new Map;for(let u=0,d=s.length;udt.is(u)?c.get(Sn.TrajectoryInfo.get(u.unit.model).index):fn.isLocation(u)?c.get(Sn.TrajectoryInfo.get(u.aUnit.model).index):She}else i=()=>She;return{factory:whe,granularity:"instance",color:i,props:t,description:"Gives every model (frame) a unique color based on the index in its trajectory.",legend:o}},getParams:function oit(e){return I.clone(Che)},defaultValues:I.getDefaultValues(Che),isApplicable:e=>!!e.structure&&e.structure.elementCount>0&&Sn.TrajectoryInfo.get(e.structure.models[0]).size>1},ait=st(13421772),Ahe={domain:I.Interval([0,1]),list:I.ColorList("purples",{presetKind:"scale"})};function Ihe(e,t){return ze.isAtomic(e)?e.model.atomicConformation.occupancy.value(t):0}const uit={name:"occupancy",label:"Occupancy",category:xo.Atom,factory:function Ehe(e,t){const n=up.create({reverse:!1,domain:t.domain,listOrName:t.list.colors});return{factory:Ehe,granularity:"group",preferSmoothing:!0,color:function r(i){return dt.is(i)?n.color(Ihe(i.unit,i.element)):fn.isLocation(i)?n.color(Ihe(i.aUnit,i.aUnit.elements[i.aIndex])):ait},props:t,description:"Assigns a color based on the occupancy of an atom.",legend:n?n.legend:void 0}},getParams:function cit(e){return Ahe},defaultValues:I.getDefaultValues(Ahe),isApplicable:e=>!!e.structure&&e.structure.models.some(t=>t.atomicConformation.occupancy.isDefined)},AG="dark-2",The=st(13421772),Dhe={...cu({type:"colors",colorList:AG})},oP=1e4;function IG(e){return e.map(t=>`${t+oP}`.padStart(5,"0")).join("")}function EG(e){const t=function l8e(e,t){return Math.abs(e)t+5).join("")}function Phe(e){const t=new Map,n=new Set;for(let s=0,a=e.units.length;st.set(s,t.size)),{min:EG(r[0]),max:EG(r[r.length-1]),map:t}}const pit={name:"operator-hkl",label:"Operator HKL",category:xo.Symmetry,factory:function khe(e,t){let n,r;if(e.structure){const{min:i,max:o,map:s}=Phe(e.structure.root),a=[];s.forEach((u,d)=>{const f=u%s.size,p=TG(EG(d));void 0===a[f]?a[f]=p:a[f]+=`, ${p}`});const l={minLabel:TG(i),maxLabel:TG(o),valueLabel:u=>a[u]},c=Yu(s.size,t,l);r=c.legend,n=u=>{let d;if(dt.is(u)){const f=IG(u.unit.conformation.operator.hkl);d=s.get(f)}else if(fn.isLocation(u)){const f=IG(u.aUnit.conformation.operator.hkl);d=s.get(f)}return void 0===d?The:c.color(d)}}else n=()=>The;return{factory:khe,granularity:"instance",color:n,props:t,description:"Assigns a color based on the operator HKL value of a transformed chain.",legend:r}},getParams:function fit(e){const t=I.clone(Dhe);return e.structure&&Phe(e.structure.root).map.size>Ad[AG].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params={...t.palette.defaultValue.params,list:{kind:"interpolate",colors:cp(AG).list}}),t},defaultValues:I.getDefaultValues(Dhe),isApplicable:e=>!!e.structure},DG=st(16777113),Mhe={domain:I.Interval([-1,1]),list:I.ColorList("red-white-blue",{presetKind:"scale"})};function Rhe(e,t){var n;return null===(n=tA.Provider.get(e.model))||void 0===n?void 0:n.data.value(t)}const git={name:"partial-charge",label:"Partial Charge",category:xo.Atom,factory:function Nhe(e,t){const n=up.create({domain:t.domain,listOrName:t.list.colors});return{factory:Nhe,granularity:"group",preferSmoothing:!0,color:function r(i){if(dt.is(i)){const o=Rhe(i.unit,i.element);return void 0!==o?n.color(o):DG}if(fn.isLocation(i)){const o=Rhe(i.aUnit,i.aUnit.elements[i.aIndex]);return void 0!==o?n.color(o):DG}return DG},props:t,description:"Assigns a color based on the partial charge of an atom.",legend:n?n.legend:void 0}},getParams:function mit(e){return Mhe},defaultValues:I.getDefaultValues(Mhe),isApplicable:e=>!!e.structure&&e.structure.models.some(t=>void 0!==tA.Provider.get(t))},Fhe=st(16448250),Ohe={...cu({type:"colors",colorList:"many-distinct"})},_it={name:"atom-id",label:"Atom Id",category:xo.Atom,factory:function Bhe(e,t){let n,r;if(e.structure){const i=dt.create(e.structure.root),o=function xit(e){const t=new Map;for(const n of e.models){const{label_atom_id:r}=n.atomicHierarchy.atoms;for(let i=0,o=r.rowCount;is[c]});r=l.legend,n=c=>{let u;if(dt.is(c)){const d=Je.atom.label_atom_id(c);u=o.get(d)}else if(fn.isLocation(c)){i.unit=c.aUnit,i.element=c.aUnit.elements[c.aIndex];const d=Je.atom.label_atom_id(i);u=o.get(d)}return void 0===u?Fhe:l.color(u)}}else n=()=>Fhe;return{factory:Bhe,granularity:"group",preferSmoothing:!0,color:n,props:t,description:"Gives every atom a color based on its `label_atom_id` value.",legend:r}},getParams:function vit(e){return I.clone(Ohe)},defaultValues:I.getDefaultValues(Ohe),isApplicable:e=>!!e.structure},Lhe={colorList:I.ColorList({kind:"interpolate",colors:[[qn.white,0],[qn.red,.25],[qn.white,.5],[qn.blue,.75],[qn.white,1]]},{offsets:!0,isEssential:!0})},wit={name:"volume-value",label:"Volume Value",category:xo.Misc,factory:function jhe(e,t){const n=up.create({domain:[0,1],listOrName:t.colorList.colors}),r=[];for(let o=0;o<256;++o)r[o]=n.color(o/255);return{factory:jhe,granularity:"direct",props:t,description:"Assign color based on the given value of a volume cell.",legend:n.legend,palette:{colors:r,filter:"linear"}}},getParams:function Cit(e){return Lhe},defaultValues:I.getDefaultValues(Lhe),isApplicable:e=>!!e.volume&&!mt.Segmentation.get(e.volume)},Uhe=st(13421772),zhe={...cu({type:"colors",colorList:"many-distinct"})},Eit={name:"volume-segment",label:"Volume Segment",category:xo.Misc,factory:function Vhe(e,t){let n,r;const i=e.volume&&mt.Segmentation.get(e.volume);if(i){const o=i.segments.size,s=Array.from(i.segments.keys()),a=Yu(o,t);r=a.legend,n=l=>mt.Segment.isLocation(l)?a.color(s.indexOf(l.segment)):Uhe}else n=()=>Uhe;return{factory:Vhe,granularity:"instance",color:n,props:t,description:"Gives every volume segment a unique color.",legend:r}},getParams:function Iit(e){return I.clone(zhe)},defaultValues:I.getDefaultValues(zhe),isApplicable:e=>!!e.volume&&!!mt.Segmentation.get(e.volume)},Hhe={volume:I.ValueRef(e=>e.state.data.selectQ(n=>n.root.subtree().filter(r=>{var i;return mt.is(null===(i=r.obj)||void 0===i?void 0:i.data)})).map(n=>{var r,i;return[n.transform.ref,null!==(i=null===(r=n.obj)||void 0===r?void 0:r.label)&&void 0!==i?i:""]}),(e,t)=>t(e)),coloring:I.MappedStatic("absolute-value",{"absolute-value":I.Group({domain:I.MappedStatic("auto",{custom:I.Interval([-1,1]),auto:I.Group({symmetric:I.Boolean(!1,{description:"If true the automatic range is determined as [-|max|, |max|]."})})}),list:I.ColorList("red-white-blue",{presetKind:"scale"})}),"relative-value":I.Group({domain:I.MappedStatic("auto",{custom:I.Interval([-1,1]),auto:I.Group({symmetric:I.Boolean(!1,{description:"If true the automatic range is determined as [-|max|, |max|]."})})}),list:I.ColorList("red-white-blue",{presetKind:"scale"})})}),defaultColor:I.Color(st(13421772))},Dit={name:"external-volume",label:"External Volume",category:xo.Misc,factory:function Ghe(e,t){let n,r;try{n=t.volume.getValue()}catch{}if(n){const i=t.coloring.params,{stats:o}=n.grid,s="custom"===i.domain.name?i.domain.params:[o.min,o.max],a="relative-value"===t.coloring.name;if("auto"===i.domain.name&&a&&(s[0]=(s[0]-o.mean)/o.sigma,s[1]=(s[1]-o.mean)/o.sigma),"auto"===t.coloring.params.domain.name&&t.coloring.params.domain.params.symmetric){const y=Math.max(Math.abs(s[0]),Math.abs(s[1]));s[0]=-y,s[1]=y}const l=up.create({domain:s,listOrName:i.list.colors}),c=Ca.getGridToCartesianTransform(n.grid);fe.invert(c,c);const u=C(),{dimensions:d,get:f}=n.grid.cells.space,p=n.grid.cells.data,[m,h,g]=d;r=y=>{if(!function IWe(e){return!!e&&"position-location"===e.kind}(y))return t.defaultColor;C.copy(u,y.position),C.transformMat4(u,u,c);const v=Math.floor(u[0]),x=Math.floor(u[1]),_=Math.floor(u[2]);if(v<0||v>=m||x<0||x>=h||_<0||_>=g)return t.defaultColor;const w=u[0]-v,A=u[1]-x,M=u[2]-_,E=Math.min(v+1,m-1),D=Math.min(x+1,h-1),T=Math.min(_+1,g-1);let F=f(p,v,x,_),R=f(p,E,x,_),N=f(p,v,D,_),j=f(p,E,D,_);const W=Po(Po(F,R,w),Po(N,j,w),A);F=f(p,v,x,T),R=f(p,E,x,T),N=f(p,v,D,T),j=f(p,E,D,T);const z=Po(Po(F,R,w),Po(N,j,w),A);let $=Po(W,z,M);return a&&($=($-o.mean)/o.sigma),l.color($)}}else r=()=>t.defaultColor;return{factory:Ghe,granularity:"vertex",preferSmoothing:!0,color:r,props:t,description:"Assigns a color based volume value at a given vertex."}},getParams:()=>Hhe,defaultValues:I.getDefaultValues(Hhe),isApplicable:e=>!0},qhe={mainchain:I.MappedStatic("molecule-type",{uniform:I.Group(Vw),"chain-id":I.Group(YD),"entity-id":I.Group(KD),"entity-source":I.Group(JD),"molecule-type":I.Group($N),"model-index":I.Group(tP),"structure-index":I.Group(rP),"secondary-structure":I.Group(CG)}),sidechain:I.MappedStatic("residue-name",{uniform:I.Group(Vw),"residue-name":I.Group(xG),"element-symbol":I.Group(hG)})},Nit={name:"cartoon",label:"Cartoon",category:xo.Misc,factory:function Whe(e,t){var n,r;const i=function Mit(e,t){switch(t.name){case"uniform":return I_(0,t.params);case"chain-id":return XD(e,t.params);case"entity-id":return QD(e,t.params);case"entity-source":return eP(e,t.params);case"molecule-type":return YN(0,t.params);case"model-index":return nP(e,t.params);case"structure-index":return iP(e,t.params);case"secondary-structure":return wG(e,t.params);default:Hi()}}(e,t.mainchain),o=function Rit(e,t){switch(t.name){case"uniform":return I_(0,t.params);case"residue-name":return _G(0,t.params);case"element-symbol":return mG(e,t.params);default:Hi()}}(e,t.sidechain);let a=i.legend;return"table-legend"===(null===(n=i.legend)||void 0===n?void 0:n.kind)&&"table-legend"===(null===(r=o.legend)||void 0===r?void 0:r.kind)&&(a={kind:"table-legend",table:[...i.legend.table,...o.legend.table]}),{factory:Whe,granularity:"group",preferSmoothing:!1,color:function s(l,c){return c?i.color(l,!1):o.color(l,!1)},props:t,description:"Uses separate themes for coloring mainchain and sidechain visuals.",legend:a}},getParams:function kit(e){return I.clone(qhe)},defaultValues:I.getDefaultValues(qhe),isApplicable:e=>!!e.structure};var Rd;!function(e){e.Category=xo,e.PaletteScale=16777215,e.EmptyFactory=()=>e.Empty;const t=st(13421772);e.Empty={factory:e.EmptyFactory,granularity:"uniform",color:()=>t,props:{}},e.areEqual=function n(i,o){return i.contextHash===o.contextHash&&i.factory===o.factory&&tg(i.props,o.props)},e.EmptyProvider={name:"",label:"",category:"",factory:e.EmptyFactory,getParams:()=>({}),defaultValues:{},isApplicable:()=>!0},e.createRegistry=function r(){return new Jhe(e.BuiltIn,e.EmptyProvider)},e.BuiltIn={"atom-id":_it,"carbohydrate-symbol":Lnt,cartoon:Nit,"chain-id":Rpe,"element-index":Knt,"element-symbol":wrt,"entity-id":ort,"entity-source":urt,hydrophobicity:rit,illustrative:Qrt,"model-index":prt,"molecule-type":Ert,occupancy:uit,"operator-hkl":pit,"operator-name":lG,"partial-charge":git,"polymer-id":Prt,"polymer-index":Rrt,"residue-name":Ort,"secondary-structure":jrt,"sequence-id":Hrt,"shape-group":NZe,"structure-index":grt,"trajectory-index":sit,uncertainty:$rt,"unit-index":vrt,uniform:iKe,"volume-segment":Eit,"volume-value":wit,"external-volume":Dit}}(Rd||(Rd={}));const $he={scale:I.Numeric(1,{min:.1,max:5,step:.1})};function PG(e,t){return ze.isAtomic(e)?B3(e.model.atomicHierarchy.atoms.type_symbol.value(t)):ze.isSpheres(e)?e.model.coarseConformation.spheres.radius[t]:0}const Lit={name:"physical",label:"Physical",category:"",factory:function Yhe(e,t){const n=void 0===t.scale?1:t.scale;return{factory:Yhe,granularity:"group",size:function r(i){let o;return o=dt.is(i)?n*PG(i.unit,i.element):fn.isLocation(i)?n*Math.min(PG(i.aUnit,i.aUnit.elements[i.aIndex]),PG(i.bUnit,i.bUnit.elements[i.bIndex])):1*n,o},props:t,description:"Assigns a physical size, i.e. vdW radius for atoms or given radius for coarse spheres."}},getParams:function Bit(e){return $he},defaultValues:I.getDefaultValues($he),isApplicable:e=>!!e.structure},Xhe={bfactorFactor:I.Numeric(.1,{min:0,max:1,step:.01}),rmsfFactor:I.Numeric(.05,{min:0,max:1,step:.01}),baseSize:I.Numeric(.2,{min:0,max:2,step:.1})};function Khe(e,t,n){return ze.isAtomic(e)?e.model.atomicConformation.B_iso_or_equiv.value(t)*n.bfactorFactor:ze.isSpheres(e)?e.model.coarseConformation.spheres.rmsf[t]*n.rmsfFactor:0}const zit={name:"uncertainty",label:"Uncertainty/Disorder",category:"",factory:function Zhe(e,t){return{factory:Zhe,granularity:"group",size:function n(r){let i=t.baseSize;return dt.is(r)?i+=Khe(r.unit,r.element,t):fn.isLocation(r)&&(i+=Khe(r.aUnit,r.aUnit.elements[r.aIndex],t)),i},props:t,description:"Assigns a size reflecting the uncertainty or disorder of an element's position, e.g. B-factor or RMSF, depending on the data availability and experimental technique."}},getParams:function Uit(e){return Xhe},defaultValues:I.getDefaultValues(Xhe),isApplicable:e=>!!e.structure&&e.structure.models.some(t=>t.atomicConformation.B_iso_or_equiv.isDefined||t.coarseHierarchy.isDefined)};var Ya,Ia;function Qhe(e){return e.map(t=>[t.name,t.provider.label,t.provider.category])}!function(e){e.EmptyFactory=()=>e.Empty,e.Empty={factory:e.EmptyFactory,granularity:"uniform",size:()=>1,props:{}},e.areEqual=function t(r,i){return r.contextHash===i.contextHash&&r.factory===i.factory&&tg(r.props,i.props)},e.EmptyProvider={name:"",label:"",category:"",factory:e.EmptyFactory,getParams:()=>({}),defaultValues:{},isApplicable:()=>!0},e.createRegistry=function n(){return new Jhe(e.BuiltIn,e.EmptyProvider)},e.BuiltIn={physical:Lit,"shape-group":PZe,uncertainty:zit,uniform:aKe}}(Ya||(Ya={})),function(e){function n(){return{color:Rd.Empty,size:Ya.Empty}}function i(){return(i=le(function*(s,a,l,c){var u,d;yield null===(u=a.colorThemeRegistry.get(c.colorTheme.name).ensureCustomProperties)||void 0===u?void 0:u.attach(s,l),yield null===(d=a.sizeThemeRegistry.get(c.sizeTheme.name).ensureCustomProperties)||void 0===d?void 0:d.attach(s,l)})).apply(this,arguments)}e.create=function t(s,a,l,c){c=c||n();const u=l.colorTheme,d=l.sizeTheme;return c.color=s.colorThemeRegistry.create(u.name,a,u.params),c.size=s.sizeThemeRegistry.create(d.name,a,d.params),c},e.createEmpty=n,e.ensureDependencies=function r(s,a,l,c){return i.apply(this,arguments)},e.releaseDependencies=function o(s,a,l){var c,u;null===(c=s.colorThemeRegistry.get(l.colorTheme.name).ensureCustomProperties)||void 0===c||c.detach(a),null===(u=s.sizeThemeRegistry.get(l.sizeTheme.name).ensureCustomProperties)||void 0===u||u.detach(a)}}(Ia||(Ia={}));class Jhe{get default(){return this._list[0]}get list(){return this._list}get types(){return Qhe(this._list)}constructor(t,n){this.emptyProvider=n,this._list=[],this._map=new Map,this._name=new Map,Nu(t,(r,i)=>{if(r.name!==i)throw new Error(`Fix build in themes to have matching names. ${r.name} ${i}`);this.add(r)})}sort(){this._list.sort((t,n)=>t.provider.category===n.provider.category?t.provider.labeln.provider.label?1:0:t.provider.categoryr.name===t.name),1);const n=this._map.get(t.name);n&&(this._map.delete(t.name),this._name.delete(n))}has(t){return this._map.has(t.name)}get(t){return this._map.get(t)||this.emptyProvider}getName(t){if(!this._name.has(t))throw new Error(`'${t.label}' is not a registered theme provider.`);return this._name.get(t)}create(t,n,r={}){const i=this.get(t);return i.factory(n,{...I.getDefaultValues(i.getParams(n)),...r})}getApplicableList(t){return this._list.filter(n=>n.provider.isApplicable(t))}getApplicableTypes(t){return Qhe(this.getApplicableList(t))}clear(){this._list.length=0,this._map.clear(),this._name.clear()}}var uc,un=function(e){return e[e.None=0]="None",e[e.Highlight=1]="Highlight",e[e.RemoveHighlight=2]="RemoveHighlight",e[e.Select=4]="Select",e[e.Deselect=8]="Deselect",e[e.Toggle=16]="Toggle",e[e.Clear=32]="Clear",e}(un||{});function sP(e,t,n){switch(n){case un.Highlight:e[t]|=1;break;case un.RemoveHighlight:e[t]&=-2;break;case un.Select:e[t]|=2;break;case un.Deselect:e[t]&=-3;break;case un.Toggle:e[t]^=2;break;case un.Clear:e[t]=0}}function Qh(e,t,n){if(n===un.None)return!1;if(Pe.is(t)){const r=Pe.start(t),i=Pe.end(t),o=r+3>>2,s=o+(i-4*o>>2);if(s<=o){for(let f=r;f>2),l=r,c=Math.min(4*o,i),u=Math.max(r,4*s),d=i;switch(n){case un.Highlight:for(let f=o;fa(y)).filter(y=>!!y);t.reset();for(const y of g)t.includePositionRadius(y.center,y.radius);t.finishedIncludeStep();for(const y of g)t.radiusPositionRadius(y.center,y.radius);return t.getSphere()},e.areEqual=function r(h,g){return!!(Xu(h)&&Xu(g)||uu(h)&&uu(g))||(aP(h)&&aP(g)?function qit(e,t){if(!l3(e.data,t.data)||e.tag!==t.tag||e.elements.length!==t.elements.length)return!1;for(let n=0,r=e.elements.length;nh,residue:h=>Me.is(h)?Me.extendToWholeResidues(h,!0):h,chain:h=>Me.is(h)?Me.extendToWholeChains(h):h,entity:h=>Me.is(h)?Me.extendToWholeEntities(h):h,model:h=>Me.is(h)?Me.extendToWholeModels(h):h,operator:h=>Me.is(h)?Me.extendToWholeOperators(h):h,structure:h=>Me.is(h)?Xe.toStructureElementLoci(h.structure):Bc.isLoci(h)?zr.Loci(h.shape):mt.Cell.isLoci(h)?mt.Loci(h.volume):h,elementInstances:h=>Me.is(h)?Me.extendToAllInstances(h):h,residueInstances:h=>Me.is(h)?Me.extendToAllInstances(Me.extendToWholeResidues(h,!0)):h,chainInstances:h=>Me.is(h)?Me.extendToAllInstances(Me.extendToWholeChains(h)):h};function p(h,g){return d[g](h)}e.GranularityOptions=I.objectToOptions(d,h=>{switch(h){case"element":return"Atom/Coarse Element";case"elementInstances":return["Atom/Coarse Element Instances","With Symmetry"];case"structure":return"Structure/Shape";default:return h.indexOf("Instances")?[yf(h),"With Symmetry"]:yf(h)}}),e.simpleGranularity=function f(h){return h.replace("Instances","")},e.applyGranularity=p,e.normalize=function m(h,g,y=!1){return("element"!==g||y)&&fn.isLoci(h)&&(h=fn.toStructureElementLoci(h)),Xe.isLoci(h)&&(h=Xe.toStructureElementLoci(h.structure)),Me.is(h)&&(h=Me.remap(h,h.structure.root)),g&&(h=p(h,g)),h}}(Yn||(Yn={})),function(e){function n(c){return 0===c.layers.length}e.Empty={kind:"empty-loci",layers:[]},e.areEqual=function t(c,u){if(0===c.layers.length&&0===u.layers.length)return!0;if(c.layers.length!==u.layers.length)return!1;for(let d=0,f=c.layers.length;d{const g=-1===h,y=g?st(0):h;p.push({loci:m,color:y,clear:g})}),{kind:"element-loci",layers:p}}return c},e.filter=function o(c,u){if(n(c))return c;if("element-loci"===c.kind){const{structure:d}=c.layers[0].loci,f=[];for(const p of c.layers){let{loci:m,color:h,clear:g}=p;const y=Me.remap(m,u);m=Me.remap(y,d),Me.isEmpty(m)||f.push({loci:m,color:h,clear:g})}return{kind:"element-loci",layers:f}}return c},e.ofScript=function s(c,u){const d=[];for(let f=0,p=c.length;f{p.push({loci:m,value:h})}),{kind:"element-loci",layers:p}}return c},e.filter=function o(c,u){if(n(c))return c;if("element-loci"===c.kind){const{structure:d}=c.layers[0].loci,f=[];for(const p of c.layers){let{loci:m,value:h}=p;const g=Me.remap(m,u);m=Me.remap(g,d),Me.isEmpty(m)||f.push({loci:m,value:h})}return{kind:"element-loci",layers:f}}return c},e.ofScript=function s(c,u){const d=[];for(let f=0,p=c.length;fn.lowestElementCount?"lowest":r>n.lowerElementCount?"lower":r>n.lowElementCount?"low":r>n.mediumElementCount?"medium":r>n.highElementCount?"high":"higher"}function kG(e,t){let n=Ll(e.quality,"auto"),r=Ll(e.detail,1),i=Ll(e.radialSegments,12),o=Ll(e.linearSegments,8),s=Ll(e.resolution,2),a=Ll(e.probePositions,12),l=Ll(e.doubleSided,!0),c=0;if("auto"===n)if(t instanceof Xe)n=eme(t.root),c=function Yit(e){if(1===e.root.models.length){const t=Vs.Provider.get(e.root.model);if(t&&"P 1"===t.spacegroup.name&&!Qc.isZero(t.spacegroup.cell))return t.spacegroup.cell.volume}return Gt.volume(e.root.boundary.box)}(t);else if(mt.is(t)){const[u,d,f]=t.grid.cells.space.dimensions;c=u*d*f,n=c<1e7?"medium":"low"}switch(n){case"highest":r=3,i=36,o=18,s=.1,a=72,l=!0;break;case"higher":r=3,i=28,o=14,s=.3,a=48,l=!0;break;case"high":r=2,i=20,o=10,s=.5,a=36,l=!0;break;case"medium":r=1,i=12,o=8,s=.8,a=24,l=!0;break;case"low":r=0,i=8,o=3,s=1.3,a=24,l=!1;break;case"lower":r=0,i=4,o=2,s=3,a=12,l=!1;break;case"lowest":r=0,i=2,o=1,s=8,a=12,l=!1}return s=Math.max(s,c/5e8),s=Math.min(s,20),"off"===e.transparentBackfaces&&(void 0!==e.alpha&&e.alpha<1||e.xrayShaded)&&(l=!1),{detail:r,radialSegments:i,linearSegments:o,resolution:s,probePositions:a,doubleSided:l}}const QN=C.set,tme=C.normalize,nme=C.sub,rme=C.addScalar,JN=C.scale,ime=C.toArray;function eF(e,t,n,r){let i=!1;if(mt.isLoci(e)){if(!mt.areEquivalent(e.volume,t))return!1;r(Pe.ofLength(t.grid.cells.data.length))&&(i=!0)}else if(mt.Isosurface.isLoci(e)){if(!mt.areEquivalent(e.volume,t))return!1;if(n?.isoValue){if(!mt.IsoValue.areSame(e.isoValue,n.isoValue,t.grid.stats))return!1;r(Pe.ofLength(t.grid.cells.data.length))&&(i=!0)}else{const{stats:o,cells:{data:s}}=t.grid,a=o.sigma,l=mt.IsoValue.toAbsolute(e.isoValue,o).absoluteValue;for(let c=0,u=s.length;c{r(Pe.ofSingleton(o))&&(i=!0)})}else if(mt.Segment.isLoci(e)){if(!mt.areEquivalent(e.volume,t))return!1;if(n?.segments){if(!rt.areIntersecting(e.segments,n.segments))return!1;r(Pe.ofLength(t.grid.cells.data.length))&&(i=!0)}else{const o=mt.Segmentation.get(t);if(o){const s=new Set;for(let c=0,u=e.segments.length;c2)continue;const be=2-ne,Ce=j(ue,Fe,ct);for(let Re=0;Rec)throw new Error("outputStride + itemOffset must NOT be larger than colorStride");const f=e.colorType.endsWith("Instance"),p=f?e.instanceCount:1,m=Sa(Math.max(1,p*t),d,Uint8Array),{array:h}=m,[g,y]=o,v=s[0],x=C.fromArray(C(),a,0),_=a[3];function w(T,F,R){const N=Math.floor(R*g%v/g),j=Math.floor(R*g/v);return c*(j*y*v+F*v+(N*g+T))}const A=C(),M=C(),E=C(),D=C();for(let T=0;Ts.drawCount.ref.value||i!==s.stride.ref.value)&&O.update(s.aSample,sme(a,i)),O.updateIfChanged(s.drawCount,a),O.updateIfChanged(s.instanceCount,t.instanceCount),O.updateIfChanged(s.stride,i),O.updateIfChanged(s.uGroupCount,t.groupCount),O.update(s.aTransform,t.transformBuffer),O.update(s.aInstance,t.instanceBuffer),O.update(s.uGeoTexDim,Ue.set(s.uGeoTexDim.ref.value,t.positionTexture.getWidth(),t.positionTexture.getHeight())),O.update(s.tPosition,t.positionTexture),O.update(s.tGroup,t.groupTexture),O.update(s.uColorTexDim,Ue.set(s.uColorTexDim.ref.value,t.colorData.getWidth(),t.colorData.getHeight())),O.update(s.tColor,t.colorData),O.updateIfChanged(s.dColorType,t.colorType),O.updateIfChanged(s.uCurrentSlice,0),O.updateIfChanged(s.uCurrentX,0),O.updateIfChanged(s.uCurrentY,0),O.update(s.uBboxMin,n.min),O.update(s.uBboxSize,o),O.updateIfChanged(s.uResolution,r),e.namedComputeRenderables[Mf].update()}else e.namedComputeRenderables[Mf]=function uot(e,t,n,r,i){const o=C.sub(C(),n.max,n.min),s=Math.round(t.vertexCount/i),a={drawCount:O.create(s),instanceCount:O.create(t.instanceCount),stride:O.create(i),uGroupCount:O.create(t.groupCount),aTransform:O.create(t.transformBuffer),aInstance:O.create(t.instanceBuffer),aSample:O.create(sme(s,i)),uGeoTexDim:O.create(Ue.create(t.positionTexture.getWidth(),t.positionTexture.getHeight())),tPosition:O.create(t.positionTexture),tGroup:O.create(t.groupTexture),uColorTexDim:O.create(Ue.create(t.colorData.getWidth(),t.colorData.getHeight())),tColor:O.create(t.colorData),dColorType:O.create(t.colorType),uCurrentSlice:O.create(0),uCurrentX:O.create(0),uCurrentY:O.create(0),uBboxMin:O.create(n.min),uBboxSize:O.create(o),uResolution:O.create(r)},l={...lot};return ys(ms(e,"points",Wi("accumulate",aot,sot,{drawBuffers:"required"}),l,a),a)}(e,t,n,r,i);return e.namedComputeRenderables[Mf]}(r,e,m,t,n);l.currentRenderItemId=-1,D.bind(),o.drawBuffers([o.COLOR_ATTACHMENT0,o.COLOR_ATTACHMENT1]);const{uCurrentSlice:N,uCurrentX:j,uCurrentY:W}=R.values;It&&r.timer.mark("ColorAccumulate.render"),function dot(e){const{gl:t,state:n}=e;n.disable(t.CULL_FACE),n.enable(t.BLEND),n.disable(t.DEPTH_TEST),n.enable(t.SCISSOR_TEST),n.depthMask(!1),n.clearColor(0,0,0,0),n.blendFunc(t.ONE,t.ONE),n.blendEquation(t.FUNC_ADD)}(r),l.viewport(0,0,A,M),l.scissor(0,0,A,M),s.clear(s.COLOR_BUFFER_BIT),O.update(W,0);let z=0,$=0,V=0;for(let te=0;te=E&&(z-=E,$+=_,V=0,O.update(W,$)),O.update(j,V),O.update(N,te),l.viewport(V,$,x,_),l.scissor(V,$,x,_),R.render(),++z,V+=x;T.detachFramebuffer(D,0),F.detachFramebuffer(D,1),o.drawBuffers([s.COLOR_ATTACHMENT0,s.NONE]),It&&r.timer.markEnd("ColorAccumulate.render"),It&&r.timer.mark("ColorNormalize.render"),(!i||function jXe(e){return e.format===Sde}(i))&&(i=a.texture("image-uint8","rgba","ubyte","linear")),i.define(A,M);const X=function pot(e,t,n){if(e.namedComputeRenderables[cP]){const r=e.namedComputeRenderables[cP].values;O.update(r.tColor,t),O.update(r.tCount,n),O.update(r.uTexSize,Ue.set(r.uTexSize.ref.value,t.getWidth(),t.getHeight())),e.namedComputeRenderables[cP].update()}else e.namedComputeRenderables[cP]=function hot(e,t,n){const r={...ua,tColor:O.create(t),tCount:O.create(n),uTexSize:O.create(Ue.create(t.getWidth(),t.getHeight()))},i={...fot};return ys(ms(e,"triangles",Wi("normalize",hl,oot),i,r),r)}(e,t,n);return e.namedComputeRenderables[cP]}(r,T,F);l.currentRenderItemId=-1,function mot(e){const{gl:t,state:n}=e;n.disable(t.CULL_FACE),n.enable(t.BLEND),n.disable(t.DEPTH_TEST),n.enable(t.SCISSOR_TEST),n.depthMask(!1),n.clearColor(0,0,0,0),n.blendFunc(t.ONE,t.ONE),n.blendEquation(t.FUNC_ADD)}(r),i.attachFramebuffer(D,0),l.viewport(0,0,A,M),l.scissor(0,0,A,M),s.clear(s.COLOR_BUFFER_BIT),X.render(),It&&r.timer.markEnd("ColorNormalize.render");const H=Bn.create(v[0],v[1],v[2],h),oe=d?"volumeInstance":"volume";return It&&r.timer.markEnd("calcTextureMeshColorSmoothing"),{texture:i,gridDim:y,gridTexDim:Ue.create(A,M),gridTransform:H,type:oe}}const MG="color-smoothing-rgb",uA="color-smoothing-rgba",RG="color-smoothing-alpha";function ame(e,t,n,r,i){if(!function yot(e){return"group"===e||"groupInstance"===e}(e.dColorType.ref.value))return;n*=3,r.namedTextures[MG]||(r.namedTextures[MG]=r.resources.texture("image-uint8","rgb","ubyte","nearest"));const o=r.namedTextures[MG];o.load(e.tColor.ref.value);const s=rF({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionTexture:e.tPosition.ref.value,groupTexture:e.tGroup.ref.value,colorData:o,colorType:e.dColorType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value},t,n,r,i);O.updateIfChanged(e.dColorType,s.type),O.update(e.tColorGrid,s.texture),O.update(e.uColorTexDim,s.gridTexDim),O.update(e.uColorGridDim,s.gridDim),O.update(e.uColorGridTransform,s.gridTransform)}var pr,lme;function co(e,t){return{kind:e,layers:t}}function fc(e,t){return{kind:e,layers:t}}!function(e){e.setVisibility=function t(f,p){f&&(f.state.visible=p)},e.setAlphaFactor=function n(f,p){f&&(f.state.alphaFactor=p)},e.setPickable=function r(f,p){f&&(f.state.pickable=p)},e.setColorOnly=function i(f,p){f&&(f.state.colorOnly=p)},e.mark=function o(f,p,m,h,g){if(!f||uu(p))return!1;const{tMarker:y,uMarker:v,markerAverage:x,markerStatus:_,uGroupCount:w,instanceCount:A,instanceGranularity:M}=f.values,E=M.ref.value?A.ref.value:w.ref.value*A.ref.value,{array:D}=y.ref.value,T=_.ref.value;if(!Xu(p)){let j=0;if(h(p,W=>(j+=Pe.size(W),!0),!0),0===j)return!1;j===E&&(p=KN)}let F=!1,R=-1,N=-1;if(Xu(p)){const j=function Hit(e,t){let n=-1,r=-1;switch(e){case un.Highlight:0===t||1===t?(n=1,r=1):2===t||3===t?(n=1,r=3):n=1;break;case un.RemoveHighlight:0===t||1===t?(n=0,r=0):(2===t||3===t)&&(n=1,r=2);break;case un.Select:1===t||3===t?(n=1,r=3):0===t||2===t?(n=1,r=2):n=1;break;case un.Deselect:1===t||3===t?(n=1,r=1):(0===t||2===t)&&(n=0,r=0);break;case un.Toggle:1===t?(n=1,r=3):2===t?(n=0,r=0):3===t?(n=1,r=1):0===t&&(n=1,r=2);break;case un.Clear:n=0,r=0}return{average:n,status:r}}(m,T);-1!==j.status?(F=T!==j.status,F&&function Vit(e,t,n){e.fill(t,0,n)}(D,j.status,E)):F=Qh(D,Pe.ofLength(E),m),R=j.average,N=j.status}else F=h(p,j=>Qh(D,j,m),!0),F&&(R=function Git(e,t){switch(e){case un.Highlight:return.5;case un.RemoveHighlight:return 0===t?0:2===t||3===t?.5:-1;case un.Select:return.5;case un.Deselect:return 1===t||3===t?.5:0===t?0:-1;case un.Toggle:return-1===t?-1:.5;case un.Clear:return-1===t?-1:0===t?0:.5;case un.None:return-1;default:Hi()}}(m,T),g&&-1!==g.status&&-1===R&&uc.isReverse(g.action,m)&&Yn.areEqual(p,g.loci)&&(N=g.status,R=0===N?0:.5));return F&&(-1===R&&(R=jue(D,E),0===R&&(N=0)),g&&(g.action=m,g.loci=p,g.status=T),O.updateIfChanged(v,N),-1===N&&O.update(y,y.ref.value),O.updateIfChanged(x,R),O.updateIfChanged(_,N)),F},e.setOverpaint=function s(f,p,m,h,g){if(!f)return;const{tOverpaint:y,dOverpaintType:v,dOverpaint:x,uGroupCount:_,instanceCount:w,instanceGranularity:A}=f.values,M=A.ref.value?w.ref.value:_.ref.value*w.ref.value,E=A.ref.value?"instance":"groupInstance";!function uKe(e,t,n){const r=Sa(Math.max(1,e),4,Uint8Array,n&&n.tOverpaint.ref.value.array);n?(O.update(n.tOverpaint,r),O.update(n.uOverpaintTexDim,Ue.create(r.width,r.height)),O.updateIfChanged(n.dOverpaint,e>0),O.updateIfChanged(n.dOverpaintType,t)):(O.create(r),O.create(Ue.create(r.width,r.height)),O.create(e>0),O.create(lc()),O.create(C.create(1,1,1)),O.create(Bn.create(0,0,0,1)),O.create(t),O.create(1))}(p.layers.length?M:0,E,f.values);const{array:D}=y.ref.value;h&&Pde(D,0,M);for(let T=0,F=p.layers.length;T{const $=Pe.start(z),V=Pe.end(z);return j?Pde(D,$,V):cKe(D,$,V,N)},!1)}if(O.update(y,y.ref.value),O.updateIfChanged(v,E),O.updateIfChanged(x,p.layers.length>0),0!==p.layers.length&&"instance"!==E&&g&&hy(g.props)){const{geometry:T,props:F,webgl:R}=g;if("mesh"===T.kind){const{resolution:N,overpaintTexture:j}=T.meta,W=Dp(F.smoothColors,!0,N);W&&(function eot(e,t,n,r,i){if(!function Jit(e){return"groupInstance"===e}(e.dOverpaintType.ref.value))return;const o=tF({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionBuffer:e.aPosition.ref.value,groupBuffer:e.aGroup.ref.value,colorData:e.tOverpaint.ref.value,colorType:e.dOverpaintType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value,itemSize:4},t,n,r,i);"volume"===o.kind?(O.updateIfChanged(e.dOverpaintType,o.type),O.update(e.tOverpaintGrid,o.texture),O.update(e.uOverpaintTexDim,o.gridTexDim),O.update(e.uOverpaintGridDim,o.gridDim),O.update(e.uOverpaintGridTransform,o.gridTransform)):"vertex"===o.kind&&(O.updateIfChanged(e.dOverpaintType,o.type),O.update(e.tOverpaint,o.texture),O.update(e.uOverpaintTexDim,o.texDim))}(f.values,W.resolution,W.stride,R,j),T.meta.overpaintTexture=f.values.tOverpaintGrid.ref.value)}else if(R&&"texture-mesh"===T.kind){const{resolution:N,overpaintTexture:j}=T.meta,W=Dp(F.smoothColors,!0,N);W&&(function vot(e,t,n,r,i){if(!function bot(e){return"groupInstance"===e}(e.dOverpaintType.ref.value))return;n*=3,r.namedTextures[uA]||(r.namedTextures[uA]=r.resources.texture("image-uint8","rgba","ubyte","nearest"));const o=r.namedTextures[uA];o.load(e.tOverpaint.ref.value);const s=rF({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionTexture:e.tPosition.ref.value,groupTexture:e.tGroup.ref.value,colorData:o,colorType:e.dOverpaintType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value},t,n,r,i);O.updateIfChanged(e.dOverpaintType,s.type),O.update(e.tOverpaintGrid,s.texture),O.update(e.uOverpaintTexDim,s.gridTexDim),O.update(e.uOverpaintGridDim,s.gridDim),O.update(e.uOverpaintGridTransform,s.gridTransform)}(f.values,W.resolution,W.stride,R,j),T.meta.overpaintTexture=f.values.tOverpaintGrid.ref.value)}}},e.setTransparency=function a(f,p,m,h,g){if(!f)return;const{tTransparency:y,dTransparencyType:v,transparencyAverage:x,dTransparency:_,uGroupCount:w,instanceCount:A,instanceGranularity:M}=f.values,E=M.ref.value?A.ref.value:w.ref.value*A.ref.value,D=M.ref.value?"instance":"groupInstance";!function pKe(e,t,n){const r=Sa(Math.max(1,e),1,Uint8Array,n&&n.tTransparency.ref.value.array);n?(O.update(n.tTransparency,r),O.update(n.uTransparencyTexDim,Ue.create(r.width,r.height)),O.updateIfChanged(n.dTransparency,e>0),O.updateIfChanged(n.transparencyAverage,Mde(r.array,e)),O.updateIfChanged(n.dTransparencyType,t)):(O.create(r),O.create(Ue.create(r.width,r.height)),O.create(e>0),O.create(0),O.create(lc()),O.create(C.create(1,1,1)),O.create(Bn.create(0,0,0,1)),O.create(t),O.create(1))}(p.layers.length?E:0,D,f.values);const{array:T}=y.ref.value;h&&function fKe(e,t,n){e.fill(0,t,n)}(T,0,E);for(let F=0,R=p.layers.length;F{const $=Pe.start(z),V=Pe.end(z);return dKe(T,$,V,j)},!1)}if(O.update(y,y.ref.value),O.updateIfChanged(x,Mde(T,E)),O.updateIfChanged(v,D),O.updateIfChanged(_,p.layers.length>0),0!==p.layers.length&&"instance"!==D&&g&&hy(g.props)){const{geometry:F,props:R,webgl:N}=g;if("mesh"===F.kind){const{resolution:j,transparencyTexture:W}=F.meta,z=Dp(R.smoothColors,!0,j);z&&(function not(e,t,n,r,i){if(!function tot(e){return"groupInstance"===e}(e.dTransparencyType.ref.value))return;const o=tF({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionBuffer:e.aPosition.ref.value,groupBuffer:e.aGroup.ref.value,colorData:e.tTransparency.ref.value,colorType:e.dTransparencyType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value,itemSize:1},t,n,r,i);"volume"===o.kind?(O.updateIfChanged(e.dTransparencyType,o.type),O.update(e.tTransparencyGrid,o.texture),O.update(e.uTransparencyTexDim,o.gridTexDim),O.update(e.uTransparencyGridDim,o.gridDim),O.update(e.uTransparencyGridTransform,o.gridTransform)):"vertex"===o.kind&&(O.updateIfChanged(e.dTransparencyType,o.type),O.update(e.tTransparency,o.texture),O.update(e.uTransparencyTexDim,o.texDim))}(f.values,z.resolution,z.stride,N,W),F.meta.transparencyTexture=f.values.tTransparencyGrid.ref.value)}else if(N&&"texture-mesh"===F.kind){const{resolution:j,transparencyTexture:W}=F.meta,z=Dp(R.smoothColors,!0,j);z&&(function _ot(e,t,n,r,i){if(!function xot(e){return"groupInstance"===e}(e.dTransparencyType.ref.value))return;n*=3,r.namedTextures[RG]||(r.namedTextures[RG]=r.resources.texture("image-uint8","alpha","ubyte","nearest"));const o=r.namedTextures[RG];o.load(e.tTransparency.ref.value);const s=rF({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionTexture:e.tPosition.ref.value,groupTexture:e.tGroup.ref.value,colorData:o,colorType:e.dTransparencyType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value},t,n,r,i);O.updateIfChanged(e.dTransparencyType,s.type),O.update(e.tTransparencyGrid,s.texture),O.update(e.uTransparencyTexDim,s.gridTexDim),O.update(e.uTransparencyGridDim,s.gridDim),O.update(e.uTransparencyGridTransform,s.gridTransform)}(f.values,z.resolution,z.stride,N,W),F.meta.transparencyTexture=f.values.tTransparencyGrid.ref.value)}}},e.setSubstance=function l(f,p,m,h,g){if(!f)return;const{tSubstance:y,dSubstanceType:v,dSubstance:x,uGroupCount:_,instanceCount:w,instanceGranularity:A}=f.values,M=A.ref.value?w.ref.value:_.ref.value*w.ref.value,E=A.ref.value?"instance":"groupInstance";!function bKe(e,t,n){const r=Sa(Math.max(1,e),4,Uint8Array,n&&n.tSubstance.ref.value.array);n?(O.update(n.tSubstance,r),O.update(n.uSubstanceTexDim,Ue.create(r.width,r.height)),O.updateIfChanged(n.dSubstance,e>0),O.updateIfChanged(n.dSubstanceType,t)):(O.create(r),O.create(Ue.create(r.width,r.height)),O.create(e>0),O.create(lc()),O.create(C.create(1,1,1)),O.create(Bn.create(0,0,0,1)),O.create(t),O.create(1))}(p.layers.length?M:0,E,f.values);const{array:D}=y.ref.value;h&&Fde(D,0,M);for(let T=0,F=p.layers.length;T{const $=Pe.start(z),V=Pe.end(z);return j?Fde(D,$,V):yKe(D,$,V,N)},!1)}if(O.update(y,y.ref.value),O.updateIfChanged(v,E),O.updateIfChanged(x,p.layers.length>0),0!==p.layers.length&&"instance"!==E&&g&&hy(g.props)){const{geometry:T,props:F,webgl:R}=g;if("mesh"===T.kind){const{resolution:N,substanceTexture:j}=T.meta,W=Dp(F.smoothColors,!0,N);W&&(function iot(e,t,n,r,i){if(!function rot(e){return"groupInstance"===e}(e.dSubstanceType.ref.value))return;const o=tF({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionBuffer:e.aPosition.ref.value,groupBuffer:e.aGroup.ref.value,colorData:e.tSubstance.ref.value,colorType:e.dSubstanceType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value,itemSize:4},t,n,r,i);"volume"===o.kind?(O.updateIfChanged(e.dSubstanceType,o.type),O.update(e.tSubstanceGrid,o.texture),O.update(e.uSubstanceTexDim,o.gridTexDim),O.update(e.uSubstanceGridDim,o.gridDim),O.update(e.uSubstanceGridTransform,o.gridTransform)):"vertex"===o.kind&&(O.updateIfChanged(e.dSubstanceType,o.type),O.update(e.tSubstance,o.texture),O.update(e.uSubstanceTexDim,o.texDim))}(f.values,W.resolution,W.stride,R,j),T.meta.substanceTexture=f.values.tSubstanceGrid.ref.value)}else if(R&&"texture-mesh"===T.kind){const{resolution:N,substanceTexture:j}=T.meta,W=Dp(F.smoothColors,!0,N);W&&(function Cot(e,t,n,r,i){if(!function Sot(e){return"groupInstance"===e}(e.dSubstanceType.ref.value))return;n*=3,r.namedTextures[uA]||(r.namedTextures[uA]=r.resources.texture("image-uint8","rgba","ubyte","nearest"));const o=r.namedTextures[uA];o.load(e.tSubstance.ref.value);const s=rF({vertexCount:e.uVertexCount.ref.value,instanceCount:e.uInstanceCount.ref.value,groupCount:e.uGroupCount.ref.value,transformBuffer:e.aTransform.ref.value,instanceBuffer:e.aInstance.ref.value,positionTexture:e.tPosition.ref.value,groupTexture:e.tGroup.ref.value,colorData:o,colorType:e.dSubstanceType.ref.value,boundingSphere:e.boundingSphere.ref.value,invariantBoundingSphere:e.invariantBoundingSphere.ref.value},t,n,r,i);O.updateIfChanged(e.dSubstanceType,s.type),O.update(e.tSubstanceGrid,s.texture),O.update(e.uSubstanceTexDim,s.gridTexDim),O.update(e.uSubstanceGridDim,s.gridDim),O.update(e.uSubstanceGridTransform,s.gridTransform)}(f.values,W.resolution,W.stride,R,j),T.meta.substanceTexture=f.values.tSubstanceGrid.ref.value)}}},e.setClipping=function c(f,p,m,h){if(!f)return;const{tClipping:g,dClippingType:y,dClipping:v,uGroupCount:x,instanceCount:_,instanceGranularity:w}=f.values,A=w.ref.value?_.ref.value:x.ref.value*_.ref.value,{layers:M}=p,E=w.ref.value?"instance":"groupInstance";!function gKe(e,t,n){const r=Sa(Math.max(1,e),1,Uint8Array,n&&n.tClipping.ref.value.array);n?(O.update(n.tClipping,r),O.update(n.uClippingTexDim,Ue.create(r.width,r.height)),O.updateIfChanged(n.dClipping,e>0),O.updateIfChanged(n.dClippingType,t)):(O.create(r),O.create(Ue.create(r.width,r.height)),O.create(e>0),O.create(t))}(M.length?A:0,E,f.values);const{array:D}=g.ref.value;h&&function mKe(e,t,n){e.fill(0,t,n)}(D,0,A);for(let T=0,F=p.layers.length;T{const z=Pe.start(W),$=Pe.end(W);return hKe(D,z,$,N)},!1)}O.update(g,g.ref.value),O.updateIfChanged(y,E),O.updateIfChanged(v,p.layers.length>0)},e.setThemeStrength=function u(f,p){f&&(O.updateIfChanged(f.values.uOverpaintStrength,p.overpaint),O.updateIfChanged(f.values.uTransparencyStrength,p.transparency),O.updateIfChanged(f.values.uSubstanceStrength,p.substance))},e.setTransform=function d(f,p,m){if(!f||!p&&!m)return;const{values:h}=f;p&&(fe.copy(h.matrix.ref.value,p),O.update(h.matrix,h.matrix.ref.value)),m?(h.extraTransform.ref.value.set(m),O.update(h.extraTransform,h.extraTransform.ref.value)):null===m&&(yN(h.extraTransform.ref.value,h.instanceCount.ref.value),O.update(h.extraTransform,h.extraTransform.ref.value)),Ide(h,h.invariantBoundingSphere.ref.value,h.instanceGrid.ref.value.cellSize,h.instanceGrid.ref.value.batchSize);const g=pl(h.invariantBoundingSphere.ref.value,h.transform.ref.value,h.instanceCount.ref.value,0);O.update(h.boundingSphere,g)}}(pr||(pr={})),function(e){let t;function r(u){return 0===u.layers.length}e.Empty={kind:"empty-loci",layers:[]},function(u){let d;var y;function m(y){switch(y){case"one":return d.One;case"two":return d.Two;case"three":return d.Three;case"four":return d.Four;case"five":return d.Five;case"six":return d.Six}}u.is=Mc.has,(y=d=u.Flag||(u.Flag={}))[y.None=0]="None",y[y.One=1]="One",y[y.Two=2]="Two",y[y.Three=4]="Three",y[y.Four=8]="Four",y[y.Five=16]="Five",y[y.Six=32]="Six",u.create=function f(y){return Mc.create(y)},u.Names={one:d.One,two:d.Two,three:d.Three,four:d.Four,five:d.Five,six:d.Six},u.isName=function p(y){return y in u.Names},u.fromName=m,u.fromNames=function h(y){let v=d.None;for(let x=0,_=y.length;x<_;++x)v|=m(y[x]);return v},u.toNames=function g(y){const v=[];return u.is(y,d.One)&&v.push("one"),u.is(y,d.Two)&&v.push("two"),u.is(y,d.Three)&&v.push("three"),u.is(y,d.Four)&&v.push("four"),u.is(y,d.Five)&&v.push("five"),u.is(y,d.Six)&&v.push("six"),v}}(t=e.Groups||(e.Groups={})),e.areEqual=function n(u,d){if(u.layers.length!==d.layers.length)return!1;for(let f=0,p=u.layers.length;f{m.push({loci:h,groups:g})}),{kind:"element-loci",layers:m}}return u},e.filter=function s(u,d){if(r(u))return u;if("element-loci"===u.kind){const{structure:f}=u.layers[0].loci,p=[];for(const m of u.layers){let{loci:h,groups:g}=m;const y=Me.remap(h,d);h=Me.remap(y,f),Me.isEmpty(h)||p.push({loci:h,groups:g})}return{kind:"element-loci",layers:p}}return u},e.ofScript=function a(u,d){const f=[];for(let p=0,m=u.length;p{m.push({loci:h,material:g,clear:!1})}),{kind:"element-loci",layers:m}}return c},e.filter=function o(c,u){if(n(c))return c;if("element-loci"===c.kind){const{structure:d}=c.layers[0].loci,f=[];for(const p of c.layers){let{loci:m,material:h,clear:g}=p;const y=Me.remap(m,u);m=Me.remap(y,d),Me.isEmpty(m)||f.push({loci:m,material:h,clear:g})}return{kind:"element-loci",layers:f}}return c},e.ofScript=function s(c,u){const d=[];for(let f=0,p=c.length;fXn.Empty,getParams:()=>({}),defaultValues:{},defaultColorTheme:Rd.EmptyProvider,defaultSizeTheme:Ya.EmptyProvider,isApplicable:()=>!0};function cme(e){return e.map(t=>[t.name,t.provider.label])}class ume{get default(){return this._list[0]}get types(){return cme(this._list)}constructor(){this._list=[],this._map=new Map,this._name=new Map}add(t){if(this._map.has(t.name))throw new Error(`${t.name} already registered.`);this._list.push({name:t.name,provider:t}),this._map.set(t.name,t),this._name.set(t,t.name)}getName(t){if(!this._name.has(t))throw new Error(`'${t.label}' is not a registered represenatation provider.`);return this._name.get(t)}remove(t){const n=t.name;this._list.splice(this._list.findIndex(i=>i.name===n),1);const r=this._map.get(n);r&&(this._map.delete(n),this._name.delete(r))}get(t){return this._map.get(t)||wot}get list(){return this._list}getApplicableList(t){return this._list.filter(n=>n.provider.isApplicable(t))}getApplicableTypes(t){return cme(this.getApplicableList(t))}clear(){this._list.length=0,this._map.clear(),this._name.clear()}}var Xn;function Xa(e,t,n={}){let r=0;const i=new si,o=Xn.createState(),s=ky(),a=[];let l,c,u=-1;const d=Ia.createEmpty();let m,h,f=I.getDefaultValues(t.Params);n.modifyState&&Xn.updateState(o,n.modifyState(o));const g=Ag.create();function _(w,A){return Xu(w)||zr.isLoci(w)&&w.shape===c?A(Pe.ofBounds(0,f.instanceGranularity?c.transforms.length:c.groupCount*c.transforms.length)):f.instanceGranularity?function x(w,A,M){let E=!1;if(!Bc.isLoci(w)||Bc.isLociEmpty(w)||w.shape!==A)return!1;for(const D of w.groups)M(Pe.ofSingleton(D.instance))&&(E=!0);return E}(w,c,A):function Aot(e,t,n){if(!Bc.isLoci(e)||e.shape!==t)return!1;let r=!1;const{groupCount:i}=t,{groups:o}=e;for(const{ids:s,instance:a}of o)if(Pe.is(s)){const l=a*i+Pe.start(s),c=a*i+Pe.end(s);n(Pe.ofBounds(l,c))&&(r=!0)}else for(let l=0,c=s.length;l[zr.Loci(c)],eachLocation:w=>{for(m.reset();m.hasNext;){const{location:A,isSecondary:M}=m.move();w(A,M)}},mark(w,A){if(!uc.is(o.markerActions,A))return!1;if(Bc.isLoci(w)||zr.isLoci(w)){if(w.shape!==c)return!1}else if(!Xu(w))return!1;return pr.mark(l,w,A,_)},setState(w){n.modifyState&&(w=n.modifyState(w)),l&&(void 0!==w.visible&&pr.setVisibility(l,w.visible),void 0!==w.alphaFactor&&pr.setAlphaFactor(l,w.alphaFactor),void 0!==w.pickable&&pr.setPickable(l,w.pickable),void 0!==w.colorOnly&&pr.setColorOnly(l,w.colorOnly),void 0!==w.overpaint&&pr.setOverpaint(l,w.overpaint,_,!0),void 0!==w.transparency&&pr.setTransparency(l,w.transparency,_,!0),void 0!==w.substance&&pr.setSubstance(l,w.substance,_,!0),void 0!==w.transform&&pr.setTransform(l,w.transform)),Xn.updateState(o,w)},setTheme(w){$n&&console.warn("The `ShapeRepresentation` theme is fixed to `ShapeGroupColorTheme` and `ShapeGroupSizeTheme`. Colors are taken from `Shape.getColor` and sizes from `Shape.getSize`")},destroy(){a.length=0,l&&(l.state.disposed=!0,l=void 0)}}}!function(e){let t;var a;function n(){return{visible:!0,alphaFactor:1,pickable:!0,colorOnly:!1,syncManually:!1,transform:fe.identity(),overpaint:Ea.Empty,transparency:dc.Empty,substance:fc.Empty,clipping:co.Empty,themeStrength:{overpaint:1,transparency:1,substance:1},markerActions:uc.All}}function r(a,l){void 0!==l.visible&&(a.visible=l.visible),void 0!==l.alphaFactor&&(a.alphaFactor=l.alphaFactor),void 0!==l.pickable&&(a.pickable=l.pickable),void 0!==l.colorOnly&&(a.colorOnly=l.colorOnly),void 0!==l.overpaint&&(a.overpaint=l.overpaint),void 0!==l.transparency&&(a.transparency=l.transparency),void 0!==l.substance&&(a.substance=l.substance),void 0!==l.clipping&&(a.clipping=l.clipping),void 0!==l.themeStrength&&(a.themeStrength=l.themeStrength),void 0!==l.syncManually&&(a.syncManually=l.syncManually),void 0!==l.transform&&fe.copy(a.transform,l.transform),void 0!==l.markerActions&&(a.markerActions=l.markerActions)}(a=t=e.Loci||(e.Loci={})).areEqual=function l(u,d){return u.repr===d.repr&&Yn.areEqual(u.loci,d.loci)},a.isEmpty=function c(u){return Yn.isEmpty(u.loci)},a.Empty={loci:qr},e.createState=n,e.updateState=r,e.StateBuilder={create:n,update:r},e.Empty={label:"",groupCount:0,renderObjects:[],geometryVersion:-1,props:{},params:{},updated:new si,state:n(),theme:Ia.createEmpty(),createOrUpdate:()=>Ke.constant("",void 0),setState:()=>{},setTheme:()=>{},getLoci:()=>qr,getAllLoci:()=>[],eachLocation:()=>{},mark:()=>!1,destroy:()=>{}};class i{constructor(){this.curr=new Set,this.next=new Set,this._version=-1}get version(){return this._version}add(l,c){this.next.add(gf(l,c))}snapshot(){Lo.areEqual(this.curr,this.next)||(this._version+=1),[this.curr,this.next]=[this.next,this.curr],this.next.clear()}}e.GeometryState=i,e.createMulti=function o(a,l,c,u,d){let f=0;const p=new si,m=new i,h=u.create();let y,v,x,g=Ia.createEmpty();const _={},w=Object.keys(d).map((A,M)=>{_[M]=A;const E=d[A](l,c);return E.setState(h),E});return{label:a,updated:p,get groupCount(){let A=0;if(v){const{visuals:M}=v;for(let E=0,D=w.length;E{M&&M!==x&&(y=c(l,M),x=M,v||(v=I.getDefaultValues(y)));const E=kG(Object.assign({},v,A),x);Object.assign(v,A,E);const{visuals:D}=v;return Ke.create(`Creating or updating '${a}' representation`,function(){var T=le(function*(F){for(let R=0,N=w.length;R{const{visuals:M}=v;for(let E=0,D=w.length;E{const A=[],{visuals:M}=v;for(let E=0,D=w.length;E{const{visuals:M}=v;for(let E=0,D=w.length;E{let E=!1;for(let D=0,T=w.length;D{u.update(h,A);for(let M=0,E=w.length;M{g=A;for(let M=0,E=w.length;M{const y=kG(Object.assign({},h,g));return Object.assign(h,g,y),Ke.create(`Updating '${a}' representation`,function(){var v=le(function*(x){d.add(0,l.id),d.snapshot(),u.next(c++)});return function(x){return v.apply(this,arguments)}}())},get state(){return f},get theme(){return p},getLoci:()=>qr,getAllLoci:()=>[],eachLocation:()=>{},mark:(g,y)=>!1,setState:g=>{void 0!==g.visible&&pr.setVisibility(l,g.visible),void 0!==g.alphaFactor&&pr.setAlphaFactor(l,g.alphaFactor),void 0!==g.pickable&&pr.setPickable(l,g.pickable),void 0!==g.colorOnly&&pr.setColorOnly(l,g.colorOnly),void 0!==g.themeStrength&&pr.setThemeStrength(l,g.themeStrength),void 0!==g.transform&&pr.setTransform(l,g.transform),e.updateState(f,g)},setTheme:()=>{},destroy(){}}}}(Xn||(Xn={}));const dme=fe();class dA{constructor(t){this.structure=t,this.groupUnitTransforms=[],this.unitOffsetMap=sp.Mutable(),this.groupIndexMap=sp.Mutable(),this._isIdentity=void 0,this.version=0,this.unitTransforms=new Float32Array(16*t.units.length),this.size=t.units.length,this.reset();let n=0;for(let r=0,i=t.unitSymmetryGroups.length;rXa(Not,on.Utils)},_me={...kot};function Not(e,t,n,r){const i=function Rot(e,t,n){const r=Ct.createState(256,128,n),{fromFractional:i}=e.symmetry.spacegroup.cell;C.copy(Jh,e.ref),"center"===t.attachment?(C.trunc(Jh,Jh),C.subScalar(Jh,Jh,.5)):C.floor(Jh,Jh),fe.fromTranslation(xme,Jh);const o=zde(Ude(Tot),xme),s=Math.cbrt(e.symmetry.spacegroup.cell.volume)/300*t.cellScale;r.currentGroup=1,Ct.addCage(r,i,o,s,2,20);const a=ke.fromDimensionsAndTransform(ke(),C.unit,i);C.transformMat4(Jh,Jh,i),ke.translate(a,a,Jh),ke.expand(a,a,s);const l=Ct.getMesh(r);return l.setBoundingSphere(a),l}(t,n,r&&r.geometry),o=M3.getUnitcellLabel(t.symmetry);return zr.create(o,t,i,()=>n.cellColor,()=>1,()=>o)}function Sme(e,t,n){const r=C();return"model"===n.ref&&C.transformMat4(r,Sn.getCenter(e),t.spacegroup.cell.toFractional),{symmetry:t,ref:r}}const jp=new Uint16Array([0,1,2,1,3,2]),B_=tt.add3,pc=tt.add2,Cme=tt.add;var Ig;!function(e){e.create=function t(n={},r=2048,i=1024,o){r*=2,i*=2;const s=tt.create(Float32Array,3,i,o?o.centerBuffer.ref.value:r),a=tt.create(Float32Array,2,i,o?o.mappingBuffer.ref.value:r),l=tt.create(Float32Array,1,i,o?o.depthBuffer.ref.value:r),c=tt.create(Uint32Array,3,i,o?o.indexBuffer.ref.value:r),u=tt.create(Float32Array,1,i,o?o.groupBuffer.ref.value:r),d=tt.create(Float32Array,2,i,o?o.tcoordBuffer.ref.value:r),f={...I.getDefaultValues(Tf.Params),...n},{attachment:p,background:m,backgroundMargin:h,tether:g,tetherLength:y,tetherBaseWidth:v}=f,x=function ZKe(e){const t=JSON.stringify(e);return void 0===W9[t]&&(W9[t]=new QKe(e)),W9[t]}(f),_=.4*h,w=x.buffer/x.lineHeight,A=(M,E,D,T,F)=>{B_(s,M,E,D),Cme(l,T),Cme(u,F)};return{add:(M,E,D,T,F,R,N)=>{let j=0;const W=M.length;for(let Q=0;Q{const M=x.texture,E=tt.compact(s,!0),D=tt.compact(a,!0),T=tt.compact(l,!0),F=tt.compact(c,!0),R=tt.compact(u,!0),N=tt.compact(d,!0);return Tf.create(M,E,D,T,F,R,N,c.elementCount/2,o)}}}}(Ig||(Ig={}));const pA={granularity:"element",condensed:!1,reverse:!1,countsOnly:!1,hidePrefix:!1,htmlStyling:!0};function L_(e,t={}){var n;switch(e.kind){case"structure-loci":return e.structure.models.map(d=>d.entry).filter(d=>!!d).join(", ");case"element-loci":return dP(Wh.ofLoci(e),t);case"bond-loci":const r=e.bonds[0];return r?NG(r,t):"";case"shape-loci":return e.shape.name;case"group-loci":const i=e.groups[0];return i?e.shape.getLabel(Ve.start(i.ids),i.instance):"";case"every-loci":return"Everything";case"empty-loci":return"Nothing";case"data-loci":return e.getLabel();case"volume-loci":return e.volume.label||"Volume";case"isosurface-loci":return[`${e.volume.label||"Volume"}`,`Isosurface at ${mt.IsoValue.toString(e.isoValue)}`].join(" | ");case"cell-loci":const o=Ve.size(e.indices),s=Ve.start(e.indices),a=mt.IsoValue.absolute(e.volume.grid.cells.data[s]),l=mt.IsoValue.toRelative(a,e.volume.grid.stats),c=[`${e.volume.label||"Volume"}`,1===o?`Cell #${s}`:`${o} Cells`];return 1===o&&c.push(`${mt.IsoValue.toString(a)} (${mt.IsoValue.toString(l)})`),c.join(" | ");case"segment-loci":const u=null===(n=mt.Segmentation.get(e.volume))||void 0===n?void 0:n.labels;if(u&&1===e.segments.length){const d=u[e.segments[0]];if(d)return d}return[`${e.volume.label||"Volume"}`,1===e.segments.length?`Segment ${e.segments[0]}`:`${e.segments.length} Segments`].join(" | ")}}function hA(e,t){return 1===e?`1 ${t}`:`${e} ${t}s`}function uP(e,t,n,r,i,o){return`${em(t,{granularity:n,hidePrefix:r,reverse:i,condensed:o})} [+ ${hA(e-1,`other ${y1(n)}`)}]`}function dP(e,t={}){const n={...pA,...t},r=function Bot(e,t=!1,n=!1,r=!1,i=!1){const{structureCount:o,chainCount:s,residueCount:a,conformationCount:l,elementCount:c}=e;if(!t&&1===c&&0===a&&0===s)return em(e.firstElementLoc,{hidePrefix:n,condensed:r,granularity:"element",reverse:i});if(!t&&0===c&&1===a&&0===s)return em(e.firstResidueLoc,{hidePrefix:n,condensed:r,granularity:"residue",reverse:i});if(t||0!==c||0!==a||1!==s){if(t){const u=[];return o>0&&u.push(hA(o,"Structure")),s>0&&u.push(hA(s,"Chain")),a>0&&u.push(hA(a,"Residue")),l>0&&u.push(hA(l,"Conformation")),c>0&&u.push(hA(c,"Element")),u.join(" + ")}{const u=[];return o>0&&u.push(1===o?em(e.firstStructureLoc,{hidePrefix:n,condensed:r,granularity:"structure",reverse:i}):uP(o,e.firstStructureLoc,"structure",n,i,r)),s>0&&(u.push(1===s?em(e.firstChainLoc,{condensed:r,granularity:"chain",hidePrefix:n,reverse:i}):uP(s,e.firstChainLoc,"chain",n,i,r)),n=!0),a>0&&(u.push(1===a?em(e.firstResidueLoc,{condensed:r,granularity:"residue",hidePrefix:n,reverse:i}):uP(a,e.firstResidueLoc,"residue",n,i,r)),n=!0),l>0&&(u.push(1===l?em(e.firstConformationLoc,{condensed:r,granularity:"conformation",hidePrefix:n,reverse:i}):uP(l,e.firstConformationLoc,"conformation",n,i,r)),n=!0),c>0&&u.push(1===c?em(e.firstElementLoc,{condensed:r,granularity:"element",hidePrefix:n,reverse:i}):uP(c,e.firstElementLoc,"element",n,i,r)),u.join(" + ")}}{const{unit:u}=e.firstChainLoc,d=ze.isAtomic(u)&&1===function Oot(e){const{elements:t,model:n}=e,{chainAtomSegments:r,residueAtomSegments:i}=n.atomicHierarchy;return i.index[r.offsets[r.index[t[t.length-1]]+1]-1]-i.index[r.offsets[r.index[t[0]]]]+1}(u)||ze.Traits.is(u.traits,ze.Trait.MultiChain)?"residue":"chain";return em(e.firstChainLoc,{hidePrefix:n,condensed:r,granularity:d,reverse:i})}}(e,n.countsOnly,n.hidePrefix,n.condensed,n.reverse);return n.htmlStyling?r:b1(r)}function fP(e,t={}){const n=Wh.create();for(const r of e)Wh.add(n,n,Wh.ofLoci(r));return dP(n,t)}function NG(e,t={}){return sF({loci:[Me(e.aStructure,[{unit:e.aUnit,indices:Ve.ofSingleton(e.aIndex)}]),Me(e.bStructure,[{unit:e.bUnit,indices:Ve.ofSingleton(e.bIndex)}])]},t)}function sF(e,t={}){const n={...pA,...t},r=function Lot(e,t){const{granularity:n,hidePrefix:r,reverse:i,condensed:o}=t;let s=!0;for(const a of e.loci)if(!Me.is(a)||1!==Me.size(a)){s=!1;break}if(s){const l=e.loci.map(u=>{const{unit:d,indices:f}=u.elements[0];return dt.create(u.structure,d,d.elements[Ve.start(f)])}).map(u=>wme(u,n,r,i||o));if(o)return l.map(u=>u[0].replace(/\[.*\]/g,"").trim()).filter(u=>!!u).join(" \u2014 ");let c=0;for(let u=0,d=Math.min(...l.map(f=>f.length))-1;u0){const u=[l[0].join(" | ")];for(let d=1,f=l.length;d!!p).join(" | "));return u.join(" \u2014 ")}return l.map(u=>u.filter(d=>!!d).join(" | ")).filter(u=>!!u).join("
")}return e.loci.map(l=>L_(l,t)).filter(l=>!!l).join(o?" \u2014 ":"
")}(e,n);return n.htmlStyling?r:b1(r)}function em(e,t={}){var n,r;const i={...pA,...t},o=wme(e,i.granularity,i.hidePrefix,i.reverse||i.condensed),s=i.condensed?null!==(r=null===(n=o[0])||void 0===n?void 0:n.replace(/\[.*\]/g,"").trim())&&void 0!==r?r:"":o.filter(a=>!!a).join(" | ");return i.htmlStyling?s:b1(s)}function wme(e,t="element",n=!1,r=!1){const i=[];if(!n){let o=e.unit.model.entry;o.length>30&&(o=o.substr(0,27)+"\u2026"),i.push(`${o}`),"structure"!==t&&(i.push(`Model ${e.unit.model.modelNum}`),i.push(`Instance ${e.unit.conformation.operator.name}`))}return ze.isAtomic(e.unit)?i.push(...function jot(e,t,n=!1){const r=dt.residueIndex(e),i=Je.chain.label_asym_id(e),o=Je.chain.auth_asym_id(e),s=0===e.unit.model.atomicHierarchy.residues.label_seq_id.valueKind(r),a=Je.residue.label_seq_id(e),l=Je.residue.auth_seq_id(e),c=Je.residue.pdbx_PDB_ins_code(e),u=Je.atom.label_comp_id(e),d=Je.atom.label_atom_id(e),f=Je.atom.label_alt_id(e),p=Je.atom.occupancy(e),m=Je.residue.microheterogeneityCompIds(e),h="residue"===t&&m.length>1?`(${m.join("|")})`:u,g=[];switch(t){case"element":g.push(`${d}${f?`%${f}`:""}`);case"conformation":"conformation"===t&&f&&g.push(`Conformation ${f}`);case"residue":const y=a!==l&&s?a:l;g.push(`${h} ${y}${y!==l?` [auth ${l}]`:""}${c||""}`);case"chain":i===o?g.push(`${i}`):"chain"===t&&ze.Traits.is(e.unit.traits,ze.Trait.MultiChain)?g.push(`[auth ${o}]`):g.push(`${i} [auth ${o}]`)}return g.length>0&&1!==p&&!n&&(g[0]=`${g[0]} [occupancy ${Math.round(100*p)/100}]`),g.reverse()}(e,t,r)):ze.isCoarse(e.unit)?i.push(...function Uot(e,t){const n=Je.coarse.asym_id(e),r=Je.coarse.seq_id_begin(e),i=Je.coarse.seq_id_end(e),o=[];switch(t){case"element":case"conformation":case"residue":if(r===i){const s=Je.coarse.entityKey(e),l=e.unit.model.sequence.byEntityKey[s].sequence.compId.value(r-1);o.push(`${l} ${r}`)}else o.push(`${r}-${i}`);case"chain":o.push(`${n}`)}return o.reverse()}(e,t)):i.push("Unknown"),r?i.reverse():i}function aF(e,t={}){const n={...pA,measureOnly:!1,unitLabel:"\u212b",...t},[r,i]=e.loci.map(a=>Yn.getCenter(a)),o=`${C.distance(r,i).toFixed(2)} ${n.unitLabel}`;if(n.measureOnly)return o;const s=sF(e,n);return n.condensed?`${o} | ${s}`:`Distance ${o}
${s}`}function lF(e,t={}){const n={...pA,measureOnly:!1,...t},[r,i,o]=e.loci.map(u=>Yn.getCenter(u)),s=C.sub(C(),r,i),a=C.sub(C(),o,i),l=`${pf(C.angle(s,a)).toFixed(2)}\xb0`;if(n.measureOnly)return l;const c=sF(e,n);return n.condensed?`${l} | ${c}`:`Angle ${l}
${c}`}function cF(e,t={}){const n={...pA,measureOnly:!1,...t},[r,i,o,s]=e.loci.map(c=>Yn.getCenter(c)),a=`${pf(C.dihedralAngle(r,i,o,s)).toFixed(2)}\xb0`;if(n.measureOnly)return a;const l=sF(e,n);return n.condensed?`${a} | ${l}`:`Dihedral ${a}
${l}`}const Ame={customText:I.Text("",{label:"Text",description:"Override the label with custom value.",isEssential:!0}),textColor:I.Color(qn.black,{isEssential:!0}),textSize:I.Numeric(.5,{min:.1,max:10,step:.1},{isEssential:!0})},uF={...Tf.Params,...Ame,borderWidth:I.Numeric(.2,{min:0,max:.5,step:.01})},Ime={unitLabel:I.Text("\u212b",{isEssential:!0})},zot={...Mo.Params,...Ime,lineSizeAttenuation:I.Boolean(!0),linesColor:I.Color(qn.lightgreen,{isEssential:!0}),linesSize:I.Numeric(.075,{min:.01,max:5,step:.01}),dashLength:I.Numeric(.2,{min:.01,max:.2,step:.01})},Vot={...uF,...Ime},Eme={lines:(e,t)=>Xa(qot,Mo.Utils,{modifyState:n=>({...n,markerActions:uc.Highlighting})}),text:(e,t)=>Xa($ot,Tf.Utils,{modifyState:n=>({...n,markerActions:un.None})})},Tme={...zot,...Vot,visuals:I.MultiSelect(["lines","text"],I.objectToOptions(Eme))};function Dme(e,t){const{sphereA:n,sphereB:r,center:i}=t,[o,s]=e.loci;return Yn.getBoundingSphere(o,n),Yn.getBoundingSphere(s,r),C.add(i,n.center,r.center),C.scale(i,i,.5),t.distance=C.distance(n.center,r.center),t}const pP=function Hot(){return{sphereA:ke(),sphereB:ke(),center:C(),distance:0}}();function Pme(e,t){return 1===e.pairs.length?`Distance ${aF(e.pairs[0],{unitLabel:t,measureOnly:!0})}`:`${e.pairs.length} Distances`}function qot(e,t,n,r){const i=function Got(e,t,n){const r=Pd.create(128,64,n);for(let i=0,o=e.pairs.length;in.linesColor,()=>n.linesSize,a=>aF(t.pairs[a],n))}function $ot(e,t,n,r){const i=function Wot(e,t,n){const r=Ig.create(t,128,64,n);for(let i=0,o=e.pairs.length;in.textColor,()=>n.textSize,a=>aF(t.pairs[a],n))}function kme(e){return{pairs:[{loci:[e[0].loci,e[1].loci]}]}}function Mme(e){return{triples:[{loci:[e[0].loci,e[1].loci,e[2].loci]}]}}function Rme(e){return{quads:[{loci:[e[0].loci,e[1].loci,e[2].loci,e[3].loci]}]}}function Nme(e){return{infos:[{loci:e[0].loci}]}}function Fme(e){return{locis:e.map(t=>t.loci)}}function Ome(e){return{locis:e.map(t=>t.loci)}}const Xot={...uF},Bme={text:(e,t)=>Xa(Jot,Tf.Utils)},Lme={...Xot,scaleByRadius:I.Boolean(!0),visuals:I.MultiSelect(["text"],I.objectToOptions(Bme)),snapshotKey:I.Text("",{isEssential:!0,disableInteractiveUpdates:!0,description:"Activate the snapshot with the provided key when clicking on the label"}),tooltip:I.Text("",{isEssential:!0,multiline:!0,disableInteractiveUpdates:!0,placeholder:"Tooltip",description:"Tooltip text to be displayed when hovering over the label"})},Kot=ke();function FG(e,t=!1){return e.label||L_(e.loci,{hidePrefix:!0,htmlStyling:!1,condensed:t})}function Jot(e,t,n,r){var i,o;const s=function Qot(e,t,n){const r=Ig.create(t,128,64,n),i=t.customText.trim();for(let o=0,s=e.infos.length;ol:c?d=>c:d=>FG(t.infos[d]),zr.create(a,t,s,()=>n.textColor,()=>n.textSize,u)}const j_=C(),tst=fe.identity(),U_=new Float32Array(18),nst=new Uint8Array([0,1,2,3,4,5]);C.zero(),C.zero();const $1=C(),ist=C(),ost=C(),sst=C(),ast=fe.identity(),jme=new Float32Array(24),lst=new Uint8Array([0,1,0,3,0,6,1,2,1,7,2,3,2,4,3,5,4,5,4,7,5,6,6,7]),ust=fe.identity(),Ume=C();function OG(e,t,n,r,i,o){Ct.addPrimitive(e,function dst(e,t,n,r,i){return C.add(Ume,t,n),fe.targetTo(e,t,Ume,r),fe.setTranslation(e,t),fe.scale(e,e,i)}(ust,t,n,r,i),Gde(o))}const BG={color:I.Color(qn.orange),scaleFactor:I.Numeric(1,{min:.1,max:10,step:.1}),radiusScale:I.Numeric(2,{min:.1,max:10,step:.1})},fst={...on.Params,...BG},pst={...on.Params,...BG},hst={...on.Params,...BG},zme={axes:(e,t)=>Xa(yst,on.Utils),box:(e,t)=>Xa(xst,on.Utils),ellipsoid:(e,t)=>Xa(Cst,on.Utils)},Vme={...fst,...pst,...hst,visuals:I.MultiSelect(["box"],I.objectToOptions(zme))};function yst(e,t,n,r){const i=function gst(e,t,n){const r=Ct.createState(256,128,n),i=Me.getPrincipalAxesMany(e.locis);return rc.scale(i.momentsAxes,i.momentsAxes,t.scaleFactor),r.currentGroup=0,function rst(e,t,n,r,i){const{origin:o,dirA:s,dirB:a,dirC:l}=t;C.add(j_,o,s),C.toArray(C.add(j_,o,s),U_,0),C.toArray(C.sub(j_,o,s),U_,3),C.toArray(C.add(j_,o,a),U_,6),C.toArray(C.sub(j_,o,a),U_,9),C.toArray(C.add(j_,o,l),U_,12),C.toArray(C.sub(j_,o,l),U_,15);const c=MD(U_,nst),u=rc.volume(t),d=Math.cbrt(u)/300*n;Ct.addCage(e,tst,c,d,r,i)}(r,i.momentsAxes,t.radiusScale,2,20),Ct.getMesh(r)}(t,n,r&&r.geometry),o=function mst(e){return`Principal Axes of ${fP(e,{countsOnly:!0})}`}(t.locis);return zr.create(o,t,i,()=>n.color,()=>1,()=>o)}function xst(e,t,n,r){const i=function vst(e,t,n){const r=Ct.createState(256,128,n),i=Me.getPrincipalAxesMany(e.locis);return rc.scale(i.boxAxes,i.boxAxes,t.scaleFactor),r.currentGroup=0,function cst(e,t,n,r,i){const{origin:o,dirA:s,dirB:a,dirC:l}=t,c=C.negate(ist,s),u=C.negate(ost,a),d=C.negate(sst,l);let f=0;const p=function(y,v,x){C.copy($1,o),C.add($1,$1,y),C.add($1,$1,v),C.add($1,$1,x),C.toArray($1,jme,f),f+=3};p(s,a,l),p(s,a,d),p(s,u,d),p(s,u,l),p(c,u,d),p(c,u,l),p(c,a,l),p(c,a,d);const m=MD(jme,lst),h=rc.volume(t),g=Math.cbrt(h)/300*n;Ct.addCage(e,ast,m,g,r,i)}(r,i.boxAxes,t.radiusScale,2,20),Ct.getMesh(r)}(t,n,r&&r.geometry),o=function bst(e){return`Oriented Box of ${fP(e,{countsOnly:!0})}`}(t.locis);return zr.create(o,t,i,()=>n.color,()=>1,()=>o)}function Cst(e,t,n,r){const i=function Sst(e,t,n){const r=Ct.createState(256,128,n),o=Me.getPrincipalAxesMany(e.locis).boxAxes,{origin:s,dirA:a,dirB:l}=o,c=rc.size(C(),o);C.scale(c,c,.5*t.scaleFactor);const u=C.create(c[2],c[1],c[0]);return r.currentGroup=0,OG(r,s,a,l,u,2),Ct.getMesh(r)}(t,n,r&&r.geometry),o=function _st(e){return`Oriented Ellipsoid of ${fP(e,{countsOnly:!0})}`}(t.locis);return zr.create(o,t,i,()=>n.color,()=>1,()=>o)}const Ast={radius:1,segments:36,thetaStart:0,thetaLength:2*Math.PI};function Hme(e){const{radius:t,segments:n,thetaStart:r,thetaLength:i}={...Ast,...e},o=i===2*Math.PI,s=o?n+1:n+2,a=new Float32Array(3*s),l=new Float32Array(3*s),c=new Uint32Array(3*n);a[0]=0,a[1]=0,a[2]=0,l[0]=0,l[1]=1,l[2]=0;for(let u=0,d=3;uXa(kst,Mo.Utils,{modifyState:n=>({...n,pickable:!1})}),arc:(e,t)=>Xa(Rst,Mo.Utils,{modifyState:n=>({...n,pickable:!1})}),sector:(e,t)=>Xa(Fst,on.Utils,{modifyProps:n=>({...n,alpha:n.sectorOpacity}),modifyState:n=>({...n,markerActions:uc.Highlighting})}),text:(e,t)=>Xa(Bst,Tf.Utils,{modifyState:n=>({...n,markerActions:un.None})})},$me={...Ist,...Est,...Tst,...uF,visuals:I.MultiSelect(["vectors","sector","text"],I.objectToOptions(Wme))},Y1=C(),hP=fe();function dF(e,t,n){const{sphereA:r,sphereB:i,sphereC:o}=t,{arcDirA:s,arcDirC:a,arcNormal:l}=t,[c,u,d]=e.loci;Yn.getBoundingSphere(c,r),Yn.getBoundingSphere(u,i),Yn.getBoundingSphere(d,o),C.sub(s,r.center,i.center),C.sub(a,o.center,i.center),C.cross(l,s,a);const p=Math.min(C.magnitude(s),C.magnitude(a))*n;return t.radius=p,t.angle=C.angle(s,a),t}function Yme(e,t){const{radius:n,angle:r}=e,i=t?ooe(r,n)/t:32;return fe.targetTo(hP,e.sphereB.center,e.sphereA.center,e.arcNormal),fe.setTranslation(hP,e.sphereB.center),fe.mul(hP,hP,fe.rotY180),P9(Hme({radius:n,thetaLength:r,segments:i}),hP)}const hc=function Dst(){return{sphereA:ke(),sphereB:ke(),sphereC:ke(),arcDirA:C(),arcDirC:C(),arcNormal:C(),radius:0,angle:0}}();function fF(e){return 1===e.triples.length?`Angle ${lF(e.triples[0],{measureOnly:!0})}`:`${e.triples.length} Angles`}function kst(e,t,n,r){const i=function Pst(e,t,n){const r=Pd.create(128,64,n);for(let i=0,o=e.triples.length;in.color,()=>n.linesSize,()=>"")}function Rst(e,t,n,r){const i=function Mst(e,t,n){const r=Pd.create(128,64,n);for(let i=0,o=e.triples.length;in.color,()=>n.linesSize,()=>"")}function Fst(e,t,n,r){const i=function Nst(e,t,n){const r=Ct.createState(128,64,n);for(let i=0,o=e.triples.length;in.color,()=>1,a=>lF(t.triples[a]))}function Bst(e,t,n,r){const i=function Ost(e,t,n){const r=Ig.create(t,128,64,n);for(let i=0,o=e.triples.length;in.textColor,()=>n.textSize,a=>lF(t.triples[a]))}const Xme={color:I.Color(qn.lightgreen),arcScale:I.Numeric(.7,{min:.01,max:1,step:.01})},pF={...Mo.Params,...Xme,lineSizeAttenuation:I.Boolean(!0),linesSize:I.Numeric(.04,{min:.01,max:5,step:.01}),dashLength:I.Numeric(.04,{min:.01,max:.2,step:.01})},jst={...pF},Ust={...pF},zst={...pF},Vst={...pF},Hst={...on.Params,...Xme,ignoreLight:I.Boolean(!0),sectorOpacity:I.Numeric(.75,{min:0,max:1,step:.01})},Kme={vectors:(e,t)=>Xa(Wst,Mo.Utils,{modifyState:n=>({...n,pickable:!1})}),extenders:(e,t)=>Xa(Qst,Mo.Utils,{modifyState:n=>({...n,pickable:!1})}),connector:(e,t)=>Xa(Yst,Mo.Utils,{modifyState:n=>({...n,pickable:!1})}),arms:(e,t)=>Xa(Kst,Mo.Utils,{modifyState:n=>({...n,pickable:!1})}),arc:(e,t)=>Xa(eat,Mo.Utils,{modifyState:n=>({...n,pickable:!1})}),sector:(e,t)=>Xa(nat,on.Utils,{modifyProps:n=>({...n,alpha:n.sectorOpacity}),modifyState:n=>({...n,markerActions:uc.Highlighting})}),text:(e,t)=>Xa(iat,Tf.Utils,{modifyState:n=>({...n,markerActions:un.None})})},Zme={...jst,...Ust,...zst,...Vst,...Hst,...uF,visuals:I.MultiSelect(["extenders","arms","sector","text"],I.objectToOptions(Kme))},du=C(),mP=fe();function z_(e,t,n){const{sphereA:r,sphereB:i,sphereC:o,sphereD:s,dirBA:a,dirCD:l,projA:c,projD:u}=t,{arcPointA:d,arcPointD:f,arcDirA:p,arcDirD:m,arcCenter:h,arcNormal:g}=t,[y,v,x,_]=e.loci;Yn.getBoundingSphere(y,r),Yn.getBoundingSphere(v,i),Yn.getBoundingSphere(x,o),Yn.getBoundingSphere(_,s),C.add(h,i.center,o.center),C.scale(h,h,.5),C.sub(a,r.center,i.center),C.sub(l,s.center,o.center),C.add(d,h,a),C.add(f,h,l),C.sub(g,o.center,i.center),C.orthogonalize(p,g,a),C.orthogonalize(m,g,l),C.projectPointOnVector(c,d,p,h),C.projectPointOnVector(u,f,m,h);const A=Math.min(C.distance(c,h),C.distance(u,h))*n;C.setMagnitude(p,p,A),C.setMagnitude(m,m,A),C.add(d,h,p),C.add(f,h,m),t.radius=A,t.angle=C.dihedralAngle(r.center,i.center,o.center,s.center),C.matchDirection(du,g,C.sub(du,d,r.center));const M=C.angle(a,du),E=A/Math.cos(M-u3);C.add(c,i.center,C.setMagnitude(du,a,E)),C.matchDirection(du,g,C.sub(du,f,s.center));const D=C.angle(l,du),T=A/Math.cos(D-u3);return C.add(u,o.center,C.setMagnitude(du,l,T)),t}function Qme(e,t){const{radius:n,angle:r}=e,i=t?ooe(r,n)/t:32;return fe.targetTo(mP,e.arcCenter,r<0?e.arcPointD:e.arcPointA,e.arcNormal),fe.setTranslation(mP,e.arcCenter),fe.mul(mP,mP,fe.rotY180),P9(Hme({radius:n,thetaLength:Math.abs(r),segments:i}),mP)}const uo=function Gst(){return{sphereA:ke(),sphereB:ke(),sphereC:ke(),sphereD:ke(),dirBA:C(),dirCD:C(),projA:C(),projD:C(),arcPointA:C(),arcPointD:C(),arcDirA:C(),arcDirD:C(),arcCenter:C(),arcNormal:C(),radius:0,angle:0}}();function V_(e){return 1===e.quads.length?`Dihedral ${cF(e.quads[0],{measureOnly:!0})}`:`${e.quads.length} Dihedrals`}function Wst(e,t,n,r){const i=function qst(e,t,n){const r=Pd.create(128,64,n);for(let i=0,o=e.quads.length;in.color,()=>n.linesSize,()=>"")}function Yst(e,t,n,r){const i=function $st(e,t,n){const r=Pd.create(128,64,n);for(let i=0,o=e.quads.length;in.color,()=>n.linesSize,()=>"")}function Kst(e,t,n,r){const i=function Xst(e,t,n){const r=Pd.create(128,64,n);for(let i=0,o=e.quads.length;in.color,()=>n.linesSize,()=>"")}function Qst(e,t,n,r){const i=function Zst(e,t,n){const r=Pd.create(128,64,n);for(let i=0,o=e.quads.length;in.color,()=>n.linesSize,()=>"")}function eat(e,t,n,r){const i=function Jst(e,t,n){const r=Pd.create(128,64,n);for(let i=0,o=e.quads.length;in.color,()=>n.linesSize,()=>"")}function nat(e,t,n,r){const i=function tat(e,t,n){const r=Ct.createState(128,64,n);for(let i=0,o=e.quads.length;in.color,()=>1,a=>cF(t.quads[a]))}function iat(e,t,n,r){const i=function rat(e,t,n){const r=Ig.create(t,128,64,n);for(let i=0,o=e.quads.length;in.textColor,()=>n.textSize,a=>cF(t.quads[a]))}const sat=nn.BuiltIn({name:"box-shape-3d",display:"Box Shape",from:Se.Root,to:Se.Shape.Provider,params:{bottomLeft:I.Vec3(C()),topRight:I.Vec3(C.create(1,1,1)),radius:I.Numeric(.15,{min:.01,max:4,step:.01}),color:I.Color(qn.red)}})({canAutoUpdate:()=>!0,apply:({params:e})=>Ke.create("Shape Representation",function(){var t=le(function*(n){return new Se.Shape.Provider({label:"Box",data:e,params:on.Params,getShape:(r,i)=>{const o=LG(Gt.create(e.bottomLeft,e.topRight),e.radius);return zr.create("Box",i,o,()=>i.color,()=>1,()=>"Box")},geometryUtils:on.Utils},{label:"Box"})});return function(n){return t.apply(this,arguments)}}())});function LG(e,t,n){const r=C.sub(C(),e.max,e.min),i=fe.fromTranslation(fe(),C.create(.5,.5,.5)),o=fe.fromScaling(fe(),r),s=fe.fromTranslation(fe(),e.min),a=fe.mul3(fe(),s,o,i),l=Ct.createState(256,128,n);l.currentGroup=1,Ct.addCage(l,a,cfe(),t,2,20);const c=Ct.getMesh(l),u=C.scaleAndAdd(C(),e.min,r,.5),d=C.distance(e.min,u);return c.setBoundingSphere(ke.create(u,d)),c}const Jme={vertices:new Float32Array([-.5,.5,0,.5,.5,0,-.5,-.5,0,.5,-.5,0]),normals:new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1]),indices:new Uint32Array([0,2,1,1,2,3])};new Uint32Array([0,1,2,3,3,1,2,0]);const cat={...on.Params,color:I.Color(qn.orange),scaleFactor:I.Numeric(1,{min:.1,max:10,step:.1})},ege={plane:(e,t)=>Xa(fat,on.Utils)},tge={...cat,visuals:I.MultiSelect(["plane"],I.objectToOptions(ege))},X1=fe(),jG=C();function fat(e,t,n,r){const i=function dat(e,t,n){const r=Ct.createState(256,128,n),o=Me.getPrincipalAxesMany(e.locis).boxAxes,s=function lat(){return Jme}();return C.add(jG,o.origin,o.dirC),fe.targetTo(X1,jG,o.origin,o.dirB),fe.scale(X1,X1,rc.size(jG,o)),fe.scaleUniformly(X1,X1,t.scaleFactor),fe.setTranslation(X1,o.origin),r.currentGroup=0,Ct.addPrimitive(r,X1,s),Ct.addPrimitiveFlipped(r,X1,s),Ct.getMesh(r)}(t,n,r&&r.geometry),o=function uat(e){return`Best Fit Plane of ${fP(e,{countsOnly:!0})}`}(t.locis);return zr.create(o,t,i,()=>n.color,()=>1,()=>o)}const hF=nn.BuiltIn({name:"structure-representation-3d",display:"3D Representation",from:Se.Molecule.Structure,to:Se.Molecule.Structure.Representation3D,params:(e,t)=>{const{registry:n,themes:r}=t.representation.structure,i=n.get(n.default.name);if(!e){const a={help:l=>{const{name:c,params:u}=l,f=r.colorThemeRegistry.get(c).factory({},u);return{description:f.description,legend:f.legend}}};return{type:I.Mapped(n.default.name,n.types,l=>I.Group(n.get(l).getParams(r,Xe.Empty))),colorTheme:I.Mapped(i.defaultColorTheme.name,r.colorThemeRegistry.types,l=>I.Group(r.colorThemeRegistry.get(l).getParams({structure:Xe.Empty})),a),sizeTheme:I.Mapped(i.defaultSizeTheme.name,r.sizeThemeRegistry.types,l=>I.Group(r.sizeThemeRegistry.get(l).getParams({structure:Xe.Empty})))}}const o={structure:e.data},s={help:a=>{const{name:l,params:c}=a,d=r.colorThemeRegistry.get(l).factory(o,c);return{description:d.description,legend:d.legend}}};return{type:I.Mapped(n.default.name,n.getApplicableTypes(e.data),a=>I.Group(n.get(a).getParams(r,e.data))),colorTheme:I.Mapped(i.defaultColorTheme.name,r.colorThemeRegistry.getApplicableTypes(o),a=>I.Group(r.colorThemeRegistry.get(a).getParams(o)),s),sizeTheme:I.Mapped(i.defaultSizeTheme.name,r.sizeThemeRegistry.getApplicableTypes(o),a=>I.Group(r.sizeThemeRegistry.get(a).getParams(o)))}}})({canAutoUpdate:({a:e,oldParams:t,newParams:n})=>e.data.elementCount<1e4||t.type.name===n.type.name&&"custom"!==n.type.params.quality,apply:({a:e,params:t},r)=>Ke.create("Structure Representation",function(){var i=le(function*(o){var s,a;const l={runtime:o,assetManager:r.managers.asset},c=r.representation.structure.registry.get(t.type.name),u=(null===(s=c.getData)||void 0===s?void 0:s.call(c,e.data,t.type.params))||e.data;c.ensureCustomProperties&&(yield c.ensureCustomProperties.attach(l,u));const d=c.factory({webgl:null===(a=r.canvas3d)||void 0===a?void 0:a.webgl,...r.representation.structure.themes},c.getParams);yield Ia.ensureDependencies(l,r.representation.structure.themes,{structure:u},t),d.setTheme(Ia.create(r.representation.structure.themes,{structure:u},t));const f=t.type.params||{};return yield d.createOrUpdate(f,u).runInContext(o),new Se.Molecule.Structure.Representation3D({repr:d,sourceData:e.data},{label:c.label})});return function(o){return i.apply(this,arguments)}}()),update:({a:e,b:t,oldParams:n,newParams:r},o)=>Ke.create("Structure Representation",function(){var s=le(function*(a){var l,c;if(r.type.name!==n.type.name)return yt.UpdateResult.Recreate;const u=o.representation.structure.registry.get(r.type.name);if(null!==(l=u.mustRecreate)&&void 0!==l&&l.call(u,n.type.params,r.type.params))return yt.UpdateResult.Recreate;const d=(null===(c=u.getData)||void 0===c?void 0:c.call(u,e.data,r.type.params))||e.data,f={runtime:a,assetManager:o.managers.asset};u.ensureCustomProperties&&(yield u.ensureCustomProperties.attach(f,d)),Ia.releaseDependencies(o.representation.structure.themes,{structure:t.data.sourceData},n),yield Ia.ensureDependencies(f,o.representation.structure.themes,{structure:d},r),t.data.repr.setTheme(Ia.create(o.representation.structure.themes,{structure:d},r));const p={...t.data.repr.props,...r.type.params};return yield t.data.repr.createOrUpdate(p,d).runInContext(a),t.data.sourceData=e.data,yt.UpdateResult.Updated});return function(a){return s.apply(this,arguments)}}()),dispose({b:e,params:t},n){if(!e||!t)return;const r=e.data.sourceData,i=n.representation.structure.registry.get(t.type.name);i.ensureCustomProperties&&i.ensureCustomProperties.detach(r),Ia.releaseDependencies(n.representation.structure.themes,{structure:r},t)},interpolate(e,t,n){if("uniform"!==e.colorTheme.name||"uniform"!==t.colorTheme.name)return n<=.5?e:t;const o=st.interpolate(e.colorTheme.params.value,t.colorTheme.params.value,n);return{type:n<=.5?e.type:t.type,colorTheme:{name:"uniform",params:{value:o}},sizeTheme:n<=.5?e.sizeTheme:t.sizeTheme}}}),hat=nn.BuiltIn({name:"unwind-structure-assembly-representation-3d",display:"Unwind Assembly 3D Representation",from:Se.Molecule.Structure.Representation3D,to:Se.Molecule.Structure.Representation3DState,params:{t:I.Numeric(0,{min:0,max:1,step:.01})}})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=new dA(n);return pme(n,r,t.t),new Se.Molecule.Structure.Representation3DState({state:{unitTransforms:r},initialState:{unitTransforms:new dA(n)},info:n,repr:e.data.repr},{label:`Unwind T = ${t.t.toFixed(2)}`})},update({a:e,b:t,newParams:n,oldParams:r}){const i=t.data.info;return e.data.sourceData!==i||e.data.repr!==t.data.repr?yt.UpdateResult.Recreate:r.t===n.t?yt.UpdateResult.Unchanged:(pme(i,t.data.state.unitTransforms,n.t),t.label=`Unwind T = ${n.t.toFixed(2)}`,t.data.repr=e.data.repr,yt.UpdateResult.Updated)}}),mat=nn.BuiltIn({name:"explode-structure-representation-3d",display:"Explode 3D Representation",from:Se.Molecule.Structure.Representation3D,to:Se.Molecule.Structure.Representation3DState,params:{t:I.Numeric(0,{min:0,max:1,step:.01})}})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=new dA(n);return mme(n,r,t.t,n.root.boundary.sphere),new Se.Molecule.Structure.Representation3DState({state:{unitTransforms:r},initialState:{unitTransforms:new dA(n)},info:n,repr:e.data.repr},{label:`Explode T = ${t.t.toFixed(2)}`})},update({a:e,b:t,newParams:n,oldParams:r}){const i=e.data.sourceData;return t.data.info!==i||e.data.repr!==t.data.repr?yt.UpdateResult.Recreate:r.t===n.t?yt.UpdateResult.Unchanged:(mme(i,t.data.state.unitTransforms,n.t,i.root.boundary.sphere),t.label=`Explode T = ${n.t.toFixed(2)}`,t.data.repr=e.data.repr,yt.UpdateResult.Updated)}}),gat=nn.BuiltIn({name:"spin-structure-representation-3d",display:"Spin 3D Representation",from:Se.Molecule.Structure.Representation3D,to:Se.Molecule.Structure.Representation3DState,params:{t:I.Numeric(0,{min:0,max:1,step:.01}),...Iot}})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=new dA(n),{axis:i,origin:o}=gme(n.root,t);return vme(n,r,t.t,i,o),new Se.Molecule.Structure.Representation3DState({state:{unitTransforms:r},initialState:{unitTransforms:new dA(n)},info:n,repr:e.data.repr},{label:`Spin T = ${t.t.toFixed(2)}`})},update({a:e,b:t,newParams:n,oldParams:r}){const i=e.data.sourceData;if(t.data.info!==i||e.data.repr!==t.data.repr)return yt.UpdateResult.Recreate;if(r.t===n.t&&r.axis===n.axis&&r.origin===n.origin)return yt.UpdateResult.Unchanged;const o=t.data.state.unitTransforms,{axis:s,origin:a}=gme(i.root,n);return vme(i,o,n.t,s,a),t.label=`Spin T = ${n.t.toFixed(2)}`,t.data.repr=e.data.repr,yt.UpdateResult.Updated}}),yat=nn.BuiltIn({name:"overpaint-structure-representation-3d-from-script",display:"Overpaint 3D Representation",from:Se.Molecule.Structure.Representation3D,to:Se.Molecule.Structure.Representation3DState,params:()=>({layers:I.ObjectList({script:I.Script(pa("(sel.atom.all)","mol-script")),color:I.Color(qn.blueviolet),clear:I.Boolean(!1)},e=>`${e.clear?"Clear":st.toRgbString(e.color)}`,{defaultValue:[{script:pa("(sel.atom.all)","mol-script"),color:qn.blueviolet,clear:!1}]})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=e.data.repr.geometryVersion,i=Ea.ofScript(t.layers,n);return new Se.Molecule.Structure.Representation3DState({state:{overpaint:i},initialState:{overpaint:Ea.Empty},info:{structure:n,geometryVersion:r},repr:e.data.repr},{label:`Overpaint (${i.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info,o=e.data.sourceData;if(o!==i.structure||e.data.repr!==t.data.repr)return yt.UpdateResult.Recreate;const s=e.data.repr.geometryVersion;if(s!==i.geometryVersion&&hy(e.data.repr.props))return yt.UpdateResult.Recreate;const a=t.data.state.overpaint,l=Ea.ofScript(n.layers,o);return Ea.areEqual(a,l)?yt.UpdateResult.Unchanged:(i.geometryVersion=s,t.data.state.overpaint=l,t.data.repr=e.data.repr,t.label=`Overpaint (${l.layers.length} Layers)`,yt.UpdateResult.Updated)}}),bat=nn.BuiltIn({name:"overpaint-structure-representation-3d-from-bundle",display:"Overpaint 3D Representation",from:Se.Molecule.Structure.Representation3D,to:Se.Molecule.Structure.Representation3DState,params:()=>({layers:I.ObjectList({bundle:I.Value(Qr.Empty),color:I.Color(qn.blueviolet),clear:I.Boolean(!1)},e=>`${e.clear?"Clear":st.toRgbString(e.color)}`,{defaultValue:[{bundle:Qr.Empty,color:qn.blueviolet,clear:!1}],isHidden:!0})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=e.data.repr.geometryVersion,i=Ea.ofBundle(t.layers,n);return new Se.Molecule.Structure.Representation3DState({state:{overpaint:i},initialState:{overpaint:Ea.Empty},info:{structure:n,geometryVersion:r},repr:e.data.repr},{label:`Overpaint (${i.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info,o=e.data.sourceData;if(o!==i.structure||e.data.repr!==t.data.repr)return yt.UpdateResult.Recreate;const s=e.data.repr.geometryVersion;if(s!==i.geometryVersion&&hy(e.data.repr.props))return yt.UpdateResult.Recreate;const a=t.data.state.overpaint,l=Ea.ofBundle(n.layers,o);return Ea.areEqual(a,l)?yt.UpdateResult.Unchanged:(i.geometryVersion=s,t.data.state.overpaint=l,t.data.repr=e.data.repr,t.label=`Overpaint (${l.layers.length} Layers)`,yt.UpdateResult.Updated)}}),vat=nn.BuiltIn({name:"transparency-structure-representation-3d-from-script",display:"Transparency 3D Representation",from:Se.Molecule.Structure.Representation3D,to:Se.Molecule.Structure.Representation3DState,params:()=>({layers:I.ObjectList({script:I.Script(pa("(sel.atom.all)","mol-script")),value:I.Numeric(.5,{min:0,max:1,step:.01},{label:"Transparency"})},e=>`Transparency (${e.value})`,{defaultValue:[{script:pa("(sel.atom.all)","mol-script"),value:.5}]})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=e.data.repr.geometryVersion,i=dc.ofScript(t.layers,n);return new Se.Molecule.Structure.Representation3DState({state:{transparency:i},initialState:{transparency:dc.Empty},info:{structure:n,geometryVersion:r},repr:e.data.repr},{label:`Transparency (${i.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info,o=e.data.sourceData;if(o!==i.structure||e.data.repr!==t.data.repr)return yt.UpdateResult.Recreate;const s=e.data.repr.geometryVersion;if(s!==i.geometryVersion&&hy(e.data.repr.props))return yt.UpdateResult.Recreate;const a=t.data.state.transparency,l=dc.ofScript(n.layers,o);return dc.areEqual(a,l)?yt.UpdateResult.Unchanged:(i.geometryVersion=s,t.data.state.transparency=l,t.data.repr=e.data.repr,t.label=`Transparency (${l.layers.length} Layers)`,yt.UpdateResult.Updated)}}),xat=nn.BuiltIn({name:"transparency-structure-representation-3d-from-bundle",display:"Transparency 3D Representation",from:Se.Molecule.Structure.Representation3D,to:Se.Molecule.Structure.Representation3DState,params:()=>({layers:I.ObjectList({bundle:I.Value(Qr.Empty),value:I.Numeric(.5,{min:0,max:1,step:.01},{label:"Transparency"})},e=>`Transparency (${e.value})`,{defaultValue:[{bundle:Qr.Empty,value:.5}],isHidden:!0})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=e.data.repr.geometryVersion,i=dc.ofBundle(t.layers,n);return new Se.Molecule.Structure.Representation3DState({state:{transparency:i},initialState:{transparency:dc.Empty},info:{structure:n,geometryVersion:r},repr:e.data.repr},{label:`Transparency (${i.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info,o=e.data.sourceData;if(o!==i.structure||e.data.repr!==t.data.repr)return yt.UpdateResult.Recreate;const s=e.data.repr.geometryVersion;if(s!==i.geometryVersion&&hy(e.data.repr.props))return yt.UpdateResult.Recreate;const a=t.data.state.transparency,l=dc.ofBundle(n.layers,o);return dc.areEqual(a,l)?yt.UpdateResult.Unchanged:(i.geometryVersion=s,t.data.state.transparency=l,t.data.repr=e.data.repr,t.label=`Transparency (${l.layers.length} Layers)`,yt.UpdateResult.Updated)}}),_at=nn.BuiltIn({name:"substance-structure-representation-3d-from-script",display:"Substance 3D Representation",from:Se.Molecule.Structure.Representation3D,to:Se.Molecule.Structure.Representation3DState,params:()=>({layers:I.ObjectList({script:I.Script(pa("(sel.atom.all)","mol-script")),material:tu.getParam(),clear:I.Boolean(!1)},e=>`${e.clear?"Clear":tu.toString(e.material)}`,{defaultValue:[{script:pa("(sel.atom.all)","mol-script"),material:tu({roughness:1}),clear:!1}]})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=e.data.repr.geometryVersion,i=fc.ofScript(t.layers,n);return new Se.Molecule.Structure.Representation3DState({state:{substance:i},initialState:{substance:fc.Empty},info:{structure:n,geometryVersion:r},repr:e.data.repr},{label:`Substance (${i.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info,o=e.data.sourceData;if(o!==i.structure||e.data.repr!==t.data.repr)return yt.UpdateResult.Recreate;const s=e.data.repr.geometryVersion;if(s!==i.geometryVersion&&hy(e.data.repr.props))return yt.UpdateResult.Recreate;const a=t.data.state.substance,l=fc.ofScript(n.layers,o);return fc.areEqual(a,l)?yt.UpdateResult.Unchanged:(i.geometryVersion=s,t.data.state.substance=l,t.data.repr=e.data.repr,t.label=`Substance (${l.layers.length} Layers)`,yt.UpdateResult.Updated)}}),Sat=nn.BuiltIn({name:"substance-structure-representation-3d-from-bundle",display:"Substance 3D Representation",from:Se.Molecule.Structure.Representation3D,to:Se.Molecule.Structure.Representation3DState,params:()=>({layers:I.ObjectList({bundle:I.Value(Qr.Empty),material:tu.getParam(),clear:I.Boolean(!1)},e=>`${e.clear?"Clear":tu.toString(e.material)}`,{defaultValue:[{bundle:Qr.Empty,material:tu({roughness:1}),clear:!1}],isHidden:!0})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=e.data.repr.geometryVersion,i=fc.ofBundle(t.layers,n);return new Se.Molecule.Structure.Representation3DState({state:{substance:i},initialState:{substance:fc.Empty},info:{structure:n,geometryVersion:r},repr:e.data.repr},{label:`Substance (${i.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info,o=e.data.sourceData;if(o!==i.structure||e.data.repr!==t.data.repr)return yt.UpdateResult.Recreate;const s=e.data.repr.geometryVersion;if(s!==i.geometryVersion&&hy(e.data.repr.props))return yt.UpdateResult.Recreate;const a=t.data.state.substance,l=fc.ofBundle(n.layers,o);return fc.areEqual(a,l)?yt.UpdateResult.Unchanged:(i.geometryVersion=s,t.data.state.substance=l,t.data.repr=e.data.repr,t.label=`Substance (${l.layers.length} Layers)`,yt.UpdateResult.Updated)}}),Cat=nn.BuiltIn({name:"clipping-structure-representation-3d-from-script",display:"Clipping 3D Representation",from:Se.Molecule.Structure.Representation3D,to:Se.Molecule.Structure.Representation3DState,params:()=>({layers:I.ObjectList({script:I.Script(pa("(sel.atom.all)","mol-script")),groups:I.Converted(e=>co.Groups.toNames(e),e=>co.Groups.fromNames(e),I.MultiSelect(DR(co.Groups.Names),I.objectToOptions(co.Groups.Names)))},e=>`${co.Groups.toNames(e.groups).length} group(s)`,{defaultValue:[{script:pa("(sel.atom.all)","mol-script"),groups:co.Groups.Flag.None}]})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=co.ofScript(t.layers,n);return new Se.Molecule.Structure.Representation3DState({state:{clipping:r},initialState:{clipping:co.Empty},info:n,repr:e.data.repr},{label:`Clipping (${r.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info;if(e.data.sourceData!==i||e.data.repr!==t.data.repr)return yt.UpdateResult.Recreate;const o=t.data.state.clipping,s=co.ofScript(n.layers,i);return co.areEqual(o,s)?yt.UpdateResult.Unchanged:(t.data.state.clipping=s,t.data.repr=e.data.repr,t.label=`Clipping (${s.layers.length} Layers)`,yt.UpdateResult.Updated)}}),wat=nn.BuiltIn({name:"clipping-structure-representation-3d-from-bundle",display:"Clipping 3D Representation",from:Se.Molecule.Structure.Representation3D,to:Se.Molecule.Structure.Representation3DState,params:()=>({layers:I.ObjectList({bundle:I.Value(Qr.Empty),groups:I.Converted(e=>co.Groups.toNames(e),e=>co.Groups.fromNames(e),I.MultiSelect(DR(co.Groups.Names),I.objectToOptions(co.Groups.Names)))},e=>`${co.Groups.toNames(e.groups).length} group(s)`,{defaultValue:[{bundle:Qr.Empty,groups:co.Groups.Flag.None}],isHidden:!0})})})({canAutoUpdate:()=>!0,apply({a:e,params:t}){const n=e.data.sourceData,r=co.ofBundle(t.layers,n);return new Se.Molecule.Structure.Representation3DState({state:{clipping:r},initialState:{clipping:co.Empty},info:n,repr:e.data.repr},{label:`Clipping (${r.layers.length} Layers)`})},update({a:e,b:t,newParams:n}){const i=t.data.info;if(e.data.sourceData!==i||e.data.repr!==t.data.repr)return yt.UpdateResult.Recreate;const o=t.data.state.clipping,s=co.ofBundle(n.layers,i);return co.areEqual(o,s)?yt.UpdateResult.Unchanged:(t.data.state.clipping=s,t.data.repr=e.data.repr,t.label=`Clipping (${s.layers.length} Layers)`,yt.UpdateResult.Updated)}}),Aat=nn.BuiltIn({name:"theme-strength-representation-3d",display:"Theme Strength 3D Representation",from:Se.Molecule.Structure.Representation3D,to:Se.Molecule.Structure.Representation3DState,params:()=>({overpaintStrength:I.Numeric(1,{min:0,max:1,step:.01}),transparencyStrength:I.Numeric(1,{min:0,max:1,step:.01}),substanceStrength:I.Numeric(1,{min:0,max:1,step:.01})})})({canAutoUpdate:()=>!0,apply:({a:e,params:t})=>new Se.Molecule.Structure.Representation3DState({state:{themeStrength:{overpaint:t.overpaintStrength,transparency:t.transparencyStrength,substance:t.substanceStrength}},initialState:{themeStrength:{overpaint:1,transparency:1,substance:1}},info:{},repr:e.data.repr},{label:"Theme Strength",description:`${t.overpaintStrength.toFixed(2)}, ${t.transparencyStrength.toFixed(2)}, ${t.substanceStrength.toFixed(2)}`}),update({a:e,b:t,newParams:n}){var i,o,s;return n.overpaintStrength===(null===(i=t.data.state.themeStrength)||void 0===i?void 0:i.overpaint)&&n.transparencyStrength===(null===(o=t.data.state.themeStrength)||void 0===o?void 0:o.transparency)&&n.substanceStrength===(null===(s=t.data.state.themeStrength)||void 0===s?void 0:s.substance)?yt.UpdateResult.Unchanged:(t.data.state.themeStrength={overpaint:n.overpaintStrength,transparency:n.transparencyStrength,substance:n.substanceStrength},t.data.repr=e.data.repr,t.label="Theme Strength",t.description=`${n.overpaintStrength.toFixed(2)}, ${n.transparencyStrength.toFixed(2)}, ${n.substanceStrength.toFixed(2)}`,yt.UpdateResult.Updated)},interpolate:(e,t,n)=>({overpaintStrength:Po(e.overpaintStrength,t.overpaintStrength,n),transparencyStrength:Po(e.transparencyStrength,t.transparencyStrength,n),substanceStrength:Po(e.substanceStrength,t.substanceStrength,n)})});var Eg;!function(e){e.getDefaultParams=function t(i,o,s,a,l,c,u,d){const f=i.representation.volume.registry.get(o),p=i.representation.volume.themes.colorThemeRegistry.get(l||f.defaultColorTheme.name),m=i.representation.volume.themes.sizeThemeRegistry.get(u||f.defaultSizeTheme.name),h=I.getDefaultValues(f.getParams(i.representation.volume.themes,s));return{type:{name:o,params:a?{...h,...a}:h},colorTheme:{name:p.name,params:c?{...p.defaultValues,...c}:p.defaultValues},sizeTheme:{name:m.name,params:d?{...m.defaultValues,...d}:m.defaultValues}}},e.getDefaultParamsStatic=function n(i,o,s,a,l,c,u){const d=i.representation.volume.registry.get(o),f=i.representation.volume.themes.colorThemeRegistry.get(a||d.defaultColorTheme.name),p=i.representation.volume.themes.sizeThemeRegistry.get(c||d.defaultSizeTheme.name);return{type:{name:o,params:s?{...d.defaultValues,...s}:d.defaultValues},colorTheme:{name:d.defaultColorTheme.name,params:l?{...f.defaultValues,...l}:f.defaultValues},sizeTheme:{name:d.defaultSizeTheme.name,params:u?{...p.defaultValues,...u}:p.defaultValues}}},e.getDescription=function r(i){var o,s,a,l;return i.isoValue?mt.IsoValue.toString(i.isoValue):null!==(s=null===(o=i.renderMode)||void 0===o?void 0:o.params)&&void 0!==s&&s.isoValue?mt.IsoValue.toString(null===(l=null===(a=i.renderMode)||void 0===a?void 0:a.params)||void 0===l?void 0:l.isoValue):void 0}}(Eg||(Eg={}));const Iat=nn.BuiltIn({name:"volume-representation-3d",display:"3D Representation",from:Se.Volume.Data,to:Se.Volume.Representation3D,params:(e,t)=>{const{registry:n,themes:r}=t.representation.volume,i=n.get(n.default.name);if(!e)return{type:I.Mapped(n.default.name,n.types,s=>I.Group(n.get(s).getParams(r,mt.One))),colorTheme:I.Mapped(i.defaultColorTheme.name,r.colorThemeRegistry.types,s=>I.Group(r.colorThemeRegistry.get(s).getParams({volume:mt.One}))),sizeTheme:I.Mapped(i.defaultSizeTheme.name,r.sizeThemeRegistry.types,s=>I.Group(r.sizeThemeRegistry.get(s).getParams({volume:mt.One})))};const o={volume:e.data};return{type:I.Mapped(n.default.name,n.types,s=>I.Group(n.get(s).getParams(r,e.data))),colorTheme:I.Mapped(i.defaultColorTheme.name,r.colorThemeRegistry.getApplicableTypes(o),s=>I.Group(r.colorThemeRegistry.get(s).getParams(o))),sizeTheme:I.Mapped(i.defaultSizeTheme.name,r.sizeThemeRegistry.getApplicableTypes(o),s=>I.Group(r.sizeThemeRegistry.get(s).getParams(o)))}}})({canAutoUpdate:({oldParams:e,newParams:t})=>e.type.name===t.type.name,apply:({a:e,params:t},n)=>Ke.create("Volume Representation",function(){var r=le(function*(i){var o;const s={runtime:i,assetManager:n.managers.asset},a=n.representation.volume.registry.get(t.type.name);a.ensureCustomProperties&&(yield a.ensureCustomProperties.attach(s,e.data));const l=a.factory({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.volume.themes},a.getParams);l.setTheme(Ia.create(n.representation.volume.themes,{volume:e.data},t));const c=t.type.params||{};return yield l.createOrUpdate(c,e.data).runInContext(i),new Se.Volume.Representation3D({repr:l,sourceData:e.data},{label:a.label,description:Eg.getDescription(c)})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,oldParams:n,newParams:r},i)=>Ke.create("Volume Representation",function(){var o=le(function*(s){var a;if(r.type.name!==n.type.name)return null===(a=i.representation.volume.registry.get(n.type.name).ensureCustomProperties)||void 0===a||a.detach(e.data),yt.UpdateResult.Recreate;const l={...t.data.repr.props,...r.type.params};return t.data.repr.setTheme(Ia.create(i.representation.volume.themes,{volume:e.data},r)),yield t.data.repr.createOrUpdate(l,e.data).runInContext(s),t.data.sourceData=e.data,t.description=Eg.getDescription(l),yt.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),Eat=nn.BuiltIn({name:"shape-representation-3d",display:"3D Representation",from:Se.Shape.Provider,to:Se.Shape.Representation3D,params:(e,t)=>e?e.data.params:xt.Params})({canAutoUpdate:()=>!0,apply:({a:e,params:t},n)=>Ke.create("Shape Representation",function(){var r=le(function*(i){const o={...I.getDefaultValues(e.data.params),...t},s=Xa(e.data.getShape,e.data.geometryUtils);return yield s.createOrUpdate(o,e.data.data).runInContext(i),new Se.Shape.Representation3D({repr:s,sourceData:e.data},{label:e.data.label})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Ke.create("Shape Representation",function(){var o=le(function*(s){const a={...t.data.repr.props,...r};return yield t.data.repr.createOrUpdate(a,e.data.data).runInContext(s),t.data.sourceData=e.data,yt.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),Tat=nn.BuiltIn({name:"model-unitcell-3d",display:"Model Unit Cell",from:Se.Molecule.Model,to:Se.Shape.Representation3D,params:()=>({..._me})})({isApplicable:e=>!!Vs.Provider.get(e.data),canAutoUpdate:({})=>!0,apply:({a:e,params:t},n)=>Ke.create("Model Unit Cell",function(){var r=le(function*(i){var o;const s=Vs.Provider.get(e.data);if(!s)return vo.Null;const a=Sme(e.data,s,t),l=function Fot(e,t){return Xn.createMulti("Unit Cell",e,t,Xn.StateBuilder,Mot)}({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.structure.themes},()=>_me);return yield l.createOrUpdate(t,a).runInContext(i),new Se.Shape.Representation3D({repr:l,sourceData:a},{label:"Unit Cell",description:s.spacegroup.name})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:n})=>Ke.create("Model Unit Cell",function(){var r=le(function*(i){const o=Vs.Provider.get(e.data);if(!o)return yt.UpdateResult.Null;const s={...t.data.repr.props,...n},a=Sme(e.data,o,s);return yield t.data.repr.createOrUpdate(s,a).runInContext(i),t.data.sourceData=a,yt.UpdateResult.Updated});return function(i){return r.apply(this,arguments)}}())}),Dat=nn.BuiltIn({name:"structure-bounding-box-3d",display:"Bounding Box",from:Se.Molecule.Structure,to:Se.Shape.Representation3D,params:{radius:I.Numeric(.05,{min:.01,max:4,step:.01},{isEssential:!0}),color:I.Color(qn.red,{isEssential:!0}),...on.Params}})({canAutoUpdate:()=>!0,apply:({a:e,params:t},n)=>Ke.create("Bounding Box",function(){var r=le(function*(i){const o=Xa((s,a,l,c)=>{const u=LG(a.box,a.radius,c?.geometry);return zr.create("Bouding Box",a,u,()=>a.color,()=>1,()=>"Bounding Box")},on.Utils);return yield o.createOrUpdate(t,{box:e.data.boundary.box,radius:t.radius,color:t.color}).runInContext(i),new Se.Shape.Representation3D({repr:o,sourceData:e.data},{label:"Bounding Box"})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Ke.create("Bounding Box",function(){var o=le(function*(s){return yield t.data.repr.createOrUpdate(r,{box:e.data.boundary.box,radius:r.radius,color:r.color}).runInContext(s),t.data.sourceData=e.data,yt.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),Pat=nn.BuiltIn({name:"structure-selections-distance-3d",display:"3D Distance",from:Se.Molecule.Structure.Selections,to:Se.Shape.Representation3D,params:()=>({...Tme})})({canAutoUpdate:({})=>!0,apply:({a:e,params:t},n)=>Ke.create("Structure Distance",function(){var r=le(function*(i){var o;const s=kme(e.data),a=function Yot(e,t){return Xn.createMulti("Distance",e,t,Xn.StateBuilder,Eme)}({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.structure.themes},()=>Tme);return yield a.createOrUpdate(t,s).runInContext(i),new Se.Shape.Representation3D({repr:a,sourceData:s},{label:"Distance"})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Ke.create("Structure Distance",function(){var o=le(function*(s){const a={...t.data.repr.props,...r},l=kme(e.data);return yield t.data.repr.createOrUpdate(a,l).runInContext(s),t.data.sourceData=l,yt.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),kat=nn.BuiltIn({name:"structure-selections-angle-3d",display:"3D Angle",from:Se.Molecule.Structure.Selections,to:Se.Shape.Representation3D,params:()=>({...$me})})({canAutoUpdate:({})=>!0,apply:({a:e,params:t},n)=>Ke.create("Structure Angle",function(){var r=le(function*(i){var o;const s=Mme(e.data),a=function Lst(e,t){return Xn.createMulti("Angle",e,t,Xn.StateBuilder,Wme)}({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.structure.themes},()=>$me);return yield a.createOrUpdate(t,s).runInContext(i),new Se.Shape.Representation3D({repr:a,sourceData:s},{label:"Angle"})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Ke.create("Structure Angle",function(){var o=le(function*(s){const a={...t.data.repr.props,...r},l=Mme(e.data);return yield t.data.repr.createOrUpdate(a,l).runInContext(s),t.data.sourceData=l,yt.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),Mat=nn.BuiltIn({name:"structure-selections-dihedral-3d",display:"3D Dihedral",from:Se.Molecule.Structure.Selections,to:Se.Shape.Representation3D,params:()=>({...Zme})})({canAutoUpdate:({})=>!0,apply:({a:e,params:t},n)=>Ke.create("Structure Dihedral",function(){var r=le(function*(i){var o;const s=Rme(e.data),a=function oat(e,t){return Xn.createMulti("Dihedral",e,t,Xn.StateBuilder,Kme)}({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.structure.themes},()=>Zme);return yield a.createOrUpdate(t,s).runInContext(i),new Se.Shape.Representation3D({repr:a,sourceData:s},{label:"Dihedral"})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Ke.create("Structure Dihedral",function(){var o=le(function*(s){const a={...t.data.repr.props,...r},l=Rme(e.data);return yield t.data.repr.createOrUpdate(a,l).runInContext(s),t.data.sourceData=l,yt.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),Rat=nn.BuiltIn({name:"structure-selections-label-3d",display:"3D Label",from:Se.Molecule.Structure.Selections,to:Se.Shape.Representation3D,params:()=>({...Lme})})({canAutoUpdate:({})=>!0,apply:({a:e,params:t},n)=>Ke.create("Structure Label",function(){var r=le(function*(i){var o,s,a;const l=Nme(e.data),c=function est(e,t){return Xn.createMulti("Label",e,t,Xn.StateBuilder,Bme)}({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.structure.themes},()=>Lme);yield c.createOrUpdate(t,l).runInContext(i);const u=!!(null!==(s=t.snapshotKey)&&void 0!==s&&s.trim()||null!==(a=t.tooltip)&&void 0!==a&&a.trim());return c.setState({pickable:u,markerActions:u?uc.Highlighting:un.None}),new Se.Shape.Representation3D({repr:c,sourceData:l},{label:"Label"})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Ke.create("Structure Label",function(){var o=le(function*(s){var a,l;const c={...t.data.repr.props,...r},u=Nme(e.data);yield t.data.repr.createOrUpdate(c,u).runInContext(s),t.data.sourceData=u;const d=!!(null!==(a=r.snapshotKey)&&void 0!==a&&a.trim()||null!==(l=r.tooltip)&&void 0!==l&&l.trim());return t.data.repr.setState({pickable:d,markerActions:d?uc.Highlighting:un.None}),yt.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),Nat=nn.BuiltIn({name:"structure-selections-orientation-3d",display:"3D Orientation",from:Se.Molecule.Structure.Selections,to:Se.Shape.Representation3D,params:()=>({...Vme})})({canAutoUpdate:({})=>!0,apply:({a:e,params:t},n)=>Ke.create("Structure Orientation",function(){var r=le(function*(i){var o;const s=Fme(e.data),a=function wst(e,t){const n=Xn.createMulti("Orientation",e,t,Xn.StateBuilder,zme);return n.setState({markerActions:uc.Highlighting}),n}({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.structure.themes},()=>Vme);return yield a.createOrUpdate(t,s).runInContext(i),new Se.Shape.Representation3D({repr:a,sourceData:s},{label:"Orientation"})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Ke.create("Structure Orientation",function(){var o=le(function*(s){const a={...t.data.repr.props,...r},l=Fme(e.data);return yield t.data.repr.createOrUpdate(a,l).runInContext(s),t.data.sourceData=l,yt.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),Fat=nn.BuiltIn({name:"structure-selections-plane-3d",display:"3D Plane",from:Se.Molecule.Structure.Selections,to:Se.Shape.Representation3D,params:()=>({...tge})})({canAutoUpdate:({})=>!0,apply:({a:e,params:t},n)=>Ke.create("Structure Plane",function(){var r=le(function*(i){var o;const s=Ome(e.data),a=function pat(e,t){const n=Xn.createMulti("Plane",e,t,Xn.StateBuilder,ege);return n.setState({markerActions:uc.Highlighting}),n}({webgl:null===(o=n.canvas3d)||void 0===o?void 0:o.webgl,...n.representation.structure.themes},()=>tge);return yield a.createOrUpdate(t,s).runInContext(i),new Se.Shape.Representation3D({repr:a,sourceData:s},{label:"Plane"})});return function(i){return r.apply(this,arguments)}}()),update:({a:e,b:t,newParams:r},i)=>Ke.create("Structure Plane",function(){var o=le(function*(s){const a={...t.data.repr.props,...r},l=Ome(e.data);return yield t.data.repr.createOrUpdate(a,l).runInContext(s),t.data.sourceData=l,yt.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())}),at={Data:Ci,Misc:rr,Model:or,Volume:kr,Representation:Rs,Shape:lr};function gP(e){let t;return e=e.replace(/^#/,""),[t,e]=[e.slice(6,8),e.slice(0,6)],[st.fromHexStyle("#"+e),1-+("0x"+(t||"ff"))/255]}const Bat=yt.builderFactory("interactions")({name:"interactions",from:Se.Root,to:Se.Shape.Provider,params:{data:I.Value(void 0,{isHidden:!1})}})({apply:({params:e})=>new Se.Shape.Provider({label:"",data:e.data,params:on.Params,geometryUtils:on.Utils,getShape:(t,n)=>function Oat(e){const t=Ct.createState(512,512);for(let n=0;ne[n].color,()=>1,n=>e[n].label)}(n)},{label:""})}),UG=new Map([["ALA","A"],["ARG","R"],["ASN","N"],["ASP","D"],["CYS","C"],["GLN","Q"],["GLU","E"],["GLY","G"],["HIS","H"],["ILE","I"],["LEU","L"],["LYS","K"],["MET","M"],["PHE","F"],["PRO","P"],["SER","S"],["THR","T"],["TRP","W"],["TYR","Y"],["VAL","V"]]);new Map(Array.from(UG.entries()).map(([e,t])=>[t,e]));class zG extends(Se.Create({name:"Volume Streaming",typeClass:"Object"})){}var nge;function mF(e,t){return`${e}${"/"===e[e.length-1]||"/"===t[0]?"":"/"}${t}`}!function(e){let t;var n;(n=t=e.ValueType||(e.ValueType={})).Float32="float32",n.Int8="int8"}(nge||(nge={}));const Lat={get preferWebGl1(){if(typeof navigator>"u"||typeof window>"u")return!1;if(["Version/15.1 Safari","Version/15.2 Safari","Version/15.3 Safari"].some(i=>navigator.userAgent.indexOf(i)>0))return!0;const t=/iPad|iPhone|iPod/.test(navigator.userAgent),n=navigator.userAgent.includes("Macintosh"),r=navigator.maxTouchPoints>=4;return!window.MSStream&&(t||n&&r)}};class jat{toString(){return this.key}valueOf(){return this.key}constructor(t,n){this.key=t,this.defaultValue=n}}function Ro(e,t){return new jat(e,t)}const ei={item:Ro,General:{IsBusyTimeoutMs:Ro("plugin-config.is-busy-timeout",750),DisableAntialiasing:Ro("plugin-config.disable-antialiasing",!1),DisablePreserveDrawingBuffer:Ro("plugin-config.disable-preserve-drawing-buffer",!1),PixelScale:Ro("plugin-config.pixel-scale",1),PickScale:Ro("plugin-config.pick-scale",.25),Transparency:Ro("plugin-config.transparency","wboit"),PreferWebGl1:Ro("plugin-config.prefer-webgl1",Lat.preferWebGl1),AllowMajorPerformanceCaveat:Ro("plugin-config.allow-major-performance-caveat",!1),PowerPreference:Ro("plugin-config.power-preference","high-performance")},State:{DefaultServer:Ro("plugin-state.server","https://webchem.ncbr.muni.cz/molstar-state"),CurrentServer:Ro("plugin-state.server","https://webchem.ncbr.muni.cz/molstar-state"),HistoryCapacity:Ro("history-capacity.server",5)},VolumeStreaming:{Enabled:Ro("volume-streaming.enabled",!0),DefaultServer:Ro("volume-streaming.server","https://ds.litemol.org"),CanStream:Ro("volume-streaming.can-stream",(e,t)=>1===e.models.length&&Sn.probablyHasDensityMap(e.models[0])),EmdbHeaderServer:Ro("volume-streaming.emdb-header-server","https://files.wwpdb.org/pub/emdb/structures")},Viewport:{ShowExpand:Ro("viewer.show-expand-button",!0),ShowControls:Ro("viewer.show-controls-button",!0),ShowSettings:Ro("viewer.show-settings-button",!0),ShowSelectionMode:Ro("viewer.show-selection-model-button",!0),ShowAnimation:Ro("viewer.show-animation-button",!0),ShowTrajectoryControls:Ro("viewer.show-trajectory-controls",!0)},Download:{DefaultPdbProvider:Ro("download.default-pdb-provider","pdbe"),DefaultEmdbProvider:Ro("download.default-emdb-provider","pdbe")},Structure:{SizeThresholds:Ro("structure.size-thresholds",Xe.DefaultSizeThresholds),DefaultRepresentationPreset:Ro("structure.default-representation-preset","auto"),DefaultRepresentationPresetParams:Ro("structure.default-representation-preset-params",{}),SaccharideCompIdMapType:Ro("structure.saccharide-comp-id-map-type","default")},Background:{Styles:Ro("background.styles",[])}};class Uat{get(t){return this._config.has(t)?this._config.get(t):t.defaultValue}set(t,n){this._config.set(t,n)}delete(t){this._config.delete(t)}constructor(t){this._config=new Map,t&&t.forEach(([n,r])=>this._config.set(n,r))}}function rge(e,t,n,r){return VG.apply(this,arguments)}function VG(){return VG=le(function*(e,t,n,r){switch(e){case"emdb":return ige(t,n,r);case"pdbe":return function qat(e,t,n){return GG.apply(this,arguments)}(t,n,r)}}),VG.apply(this,arguments)}function ige(e,t,n){return HG.apply(this,arguments)}function HG(){return HG=le(function*(e,t,n){const r=e.config.get(ei.VolumeStreaming.EmdbHeaderServer),s=(yield e.fetch({url:`${r}/${n.toUpperCase()}/header/${n.toLowerCase()}.xml`,type:"xml"}).runInContext(t)).getElementsByTagName("map")[0].getElementsByTagName("contour");let a=s[0];for(let c=1;cc.primary))||void 0===o?void 0:o.level)&&void 0!==s?s:l[0].level:function Wat(e,t,n){return qG.apply(this,arguments)}(e,t,n)}),GG.apply(this,arguments)}function qG(){return qG=le(function*(e,t,n){var r,i,o;n=n.toUpperCase();const s=yield e.fetch({url:`https://www.ebi.ac.uk/pdbe/api/emdb/entry/map/${n}`,type:"json"}).runInContext(t),a=s?.[n];let l;return void 0!==(null===(o=null===(i=null===(r=a?.[0])||void 0===r?void 0:r.map)||void 0===i?void 0:i.contour_level)||void 0===o?void 0:o.value)&&(l=+a[0].map.contour_level.value),l}),qG.apply(this,arguments)}function $at(e,t,n){return WG.apply(this,arguments)}function WG(){return WG=le(function*(e,t,n){var r;const i=yield e.fetch({url:`https://www.ebi.ac.uk/pdbe/api/pdb/entry/summary/${n}`,type:"json"}).runInContext(t),o=i?.[n],s=[];if(null===(r=o?.[0])||void 0===r||!r.related_structures)throw new Error(`No related EMDB entry found for '${n}'.`);{const a=o[0].related_structures.filter(l=>"EMDB"===l.resource&&"associated EM volume"===l.relationship);if(!a.length)throw new Error(`No related EMDB entry found for '${n}'.`);s.push(...a.map(l=>l.accession))}return s}),WG.apply(this,arguments)}var ii,yP;function So(){const e=(t,n)=>t.commands.dispatch(e,n||{});return e.subscribe=(t,n)=>t.commands.subscribe(e,n),e.id=oo.create22(),e}!function(e){class t extends(Se.Create({name:"Root",typeClass:"Root"})){}e.Root=t;class n extends(Se.Create({name:"Category",typeClass:"Object"})){}e.Category=n;class r extends(Se.CreateBehavior({name:"Behavior"})){}e.Behavior=r,e.Categories={common:"Common",representation:"Representation",interaction:"Interaction","custom-props":"Custom Properties",misc:"Miscellaneous"},e.CreateCategory=nn.BuiltIn({name:"create-behavior-category",display:{name:"Behavior Category"},from:t,to:n,params:{label:I.Text("",{isHidden:!0})}})({apply:({params:u})=>new n({},{label:u.label})});const i=new Map;e.getCategoryId=function o(u){return i.get(u.id)},e.create=function s(u){const d=nn.CreateBuiltIn({name:u.name,display:u.display,from:[t],to:[r],params:u.params,apply({params:f},p){const m=u.label?u.label(f):{label:u.display.name,description:u.display.description};return new r(new u.ctor(p,f),m)},update:({b:f,newParams:p})=>Ke.create("Update Behavior",le(function*(){return f.data.update&&(yield f.data.update(p))?yt.UpdateResult.Updated:yt.UpdateResult.Unchanged})),canAutoUpdate:u.canAutoUpdate});return i.set(d.id,u.category),d},e.simpleCommandHandler=function a(u,d){return class{register(){this.sub=u.subscribe(this.ctx,f=>d(f,this.ctx))}dispose(){this.sub&&this.sub.unsubscribe(),this.sub=void 0}constructor(f){this.ctx=f,this.sub=void 0}}},e.Handler=class l{subscribeCommand(d,f){this.subs.push(d.subscribe(this.ctx,f))}subscribeObservable(d,f){this.subs.push(d.subscribe(f))}track(d){this.subs.push(d)}dispose(){for(const d of this.subs)d.unsubscribe();this.subs=[]}update(d){return!lw(d,this.params)&&(this.params=d,!0)}constructor(d,f){this.ctx=d,this.params=f,this.subs=[]}},e.WithSubscribers=class c{subscribeCommand(d,f){this.subs.push(d.subscribe(this.plugin,f))}subscribeObservable(d,f){const p=d.subscribe(f);return this.subs.push(p),{unsubscribe:()=>{const m=this.subs.indexOf(p);m>=0&&(this.subs.splice(m,1),p.unsubscribe())}}}dispose(){for(const d of this.subs)d.unsubscribe();this.subs=[]}constructor(d,f){this.plugin=d,this.params=f,this.subs=[]}}}(ii||(ii={})),function(e){e.create=function n(s){return{entries:KU(),capacity:Math.max(1,s)}},e.get=function r(s,a){for(let l=s.entries.first;l;l=l.next)if(l.value.key===a)return s.entries.remove(l),s.entries.addLast(l.value),l.value.data},e.set=function i(s,a,l){let c;if(s.entries.count>=s.capacity){const u=s.entries.first;c=u.value.data,s.entries.remove(u)}return s.entries.addLast(function t(s,a){return{key:s,data:a}}(a,l)),c},e.remove=function o(s,a){for(let l=s.entries.first;l;l=l.next)if(l.value.key===a){s.entries.remove(l);break}}}(yP||(yP={}));class Yat{constructor(){this.subs=new Map,this.disposing=!1}subscribe(t,n){let r=this.subs.get(t.id);return r||(r=[],this.subs.set(t.id,r)),r.push(n),{unsubscribe:()=>{const i=this.subs.get(t.id);if(!i)return;const o=i.indexOf(n);if(!(o<0)){for(let s=o+1;s{this.disposing?i("disposed"):this.subs.get(t.id)?this.resolve({cmd:t,params:n,resolve:r,reject:i}):r()})}dispose(){this.subs.clear()}resolve(t){var n=this;return le(function*(){const r=n.subs.get(t.cmd.id);if(r)try{for(const i of r)yield i(t.params);t.resolve()}catch(i){t.reject(i)}else t.resolve()})()}}const jt={State:{SetCurrentObject:So(),ApplyAction:So(),Update:So(),RemoveObject:So(),ToggleExpanded:So(),ToggleVisibility:So(),Snapshots:{Add:So(),Replace:So(),Move:So(),Remove:So(),Apply:So(),Clear:So(),Upload:So(),Fetch:So(),DownloadToFile:So(),OpenFile:So(),OpenUrl:So()}},Interactivity:{Object:{Highlight:So()},Structure:{Highlight:So(),Select:So()},ClearHighlights:So()},Layout:{Update:So()},Toast:{Show:So(),Hide:So()},Camera:{Reset:So(),SetSnapshot:So(),Focus:So(),OrientAxes:So(),ResetAxes:So()},Canvas3D:{SetSettings:So(),ResetSettings:So()}};class Xat extends Il{constructor(t,n){super()}schedule(t,n=0){return this}}const gF={setInterval(e,t,...n){const{delegate:r}=gF;return r?.setInterval?r.setInterval(e,t,...n):setInterval(e,t,...n)},clearInterval(e){const{delegate:t}=gF;return(t?.clearInterval||clearInterval)(e)},delegate:void 0};class bP{constructor(t,n=bP.now){this.schedulerActionCtor=t,this.now=n}schedule(t,n=0,r){return new this.schedulerActionCtor(this,t).schedule(r,n)}}bP.now=gU.now;const yF=new class Zat extends bP{constructor(t,n=bP.now){super(t,n),this.actions=[],this._active=!1}flush(t){const{actions:n}=this;if(this._active)return void n.push(t);let r;this._active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=n.shift());if(this._active=!1,r){for(;t=n.shift();)t.unsubscribe();throw r}}}(class Kat extends Xat{constructor(t,n){super(t,n),this.scheduler=t,this.work=n,this.pending=!1}schedule(t,n=0){var r;if(this.closed)return this;this.state=t;const i=this.id,o=this.scheduler;return null!=i&&(this.id=this.recycleAsyncId(o,i,n)),this.pending=!0,this.delay=n,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,n),this}requestAsyncId(t,n,r=0){return gF.setInterval(t.flush.bind(t,this),r)}recycleAsyncId(t,n,r=0){if(null!=r&&this.delay===r&&!1===this.pending)return n;null!=n&&gF.clearInterval(n)}execute(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;const r=this._execute(t,n);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(t,n){let i,r=!1;try{this.work(t)}catch(o){r=!0,i=o||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),i}unsubscribe(){if(!this.closed){const{id:t,scheduler:n}=this,{actions:r}=n;this.work=this.state=this.scheduler=null,this.pending=!1,mb(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,super.unsubscribe()}}}),Qat=yF;function oge(e=0,t,n=Qat){let r=-1;return null!=t&&(qre(t)?n=t:r=t),new Ra(i=>{let o=function elt(e){return e instanceof Date&&!isNaN(e)}(e)?+e-n.now():e;o<0&&(o=0);let s=0;return n.schedule(function(){i.closed||(i.next(s++),0<=r?this.schedule(void 0,r):i.complete())},o)})}function mA(e,t=yF,n){const r=oge(e,t);return function Jat(e,t){return is((n,r)=>{const{leading:i=!0,trailing:o=!1}=t??{};let s=!1,a=null,l=null,c=!1;const u=()=>{l?.unsubscribe(),l=null,o&&(p(),c&&r.complete())},d=()=>{l=null,c&&r.complete()},f=m=>l=vd(e(m)).subscribe(Xo(r,u,d)),p=()=>{if(s){s=!1;const m=a;a=null,r.next(m),!c&&f(m)}};n.subscribe(Xo(r,m=>{s=!0,a=m,(!l||l.closed)&&(i?p():f(m))},()=>{c=!0,(!(o&&s&&l)||l.closed)&&r.complete()}))})}(()=>r,n)}function sge(e,t=ah){return e=e??tlt,is((n,r)=>{let i,o=!0;n.subscribe(Xo(r,s=>{const a=t(s);(o||!e(i,a))&&(o=!1,i=a,r.next(s))}))})}function tlt(e,t){return e===t}class nlt{constructor(t=!1){this.isRunning=!1,this.queue=[],this.counter=0,this.log=t}enqueue(t){this.log&&console.log("SingleAsyncQueue enqueue",this.counter),this.queue[0]={id:this.counter,func:t},this.counter++,this.run()}run(){var t=this;return le(function*(){if(t.isRunning)return;const n=t.queue.pop();if(n){t.isRunning=!0;try{t.log&&console.log("SingleAsyncQueue run",n.id),yield n.func(),t.log&&console.log("SingleAsyncQueue complete",n.id)}finally{t.isRunning=!1,t.run()}}})()}}class fu extends(Se.CreateBehavior({name:"Volume Streaming"})){}function K1(e,t,n){return{i:e,j:t,k:n}}function Up(e,t){return{a:e,b:t}}!function(e){function t(l,c,u,d,f={}){var p,m,h,g;return I.Group({isoValue:mt.createIsoValueParam(null!==(p=f.isoValue)&&void 0!==p?p:u,d),color:I.Color(null!==(m=f.color)&&void 0!==m?m:c),wireframe:I.Boolean(null!==(h=f.wireframe)&&void 0!==h&&h),opacity:I.Numeric(null!==(g=f.opacity)&&void 0!==g?g:.3,{min:0,max:1,step:.01})},{label:l,isExpanded:!0})}e.RootTag="volume-streaming-info";const n={byteOffset:0,rate:1,sampleCount:[1,1,1],valuesInfo:[{mean:0,min:-1,max:1,sigma:.1},{mean:0,min:-1,max:1,sigma:.1}]};function i(l){const{entryData:c,defaultView:u,structure:d,channelParams:f={}}=l,p=c||{kind:"em",header:{sampling:[n],availablePrecisions:[{precision:0,maxVoxels:0}]},emDefaultContourLevel:mt.IsoValue.relative(0)},m=d&&d.boundary.box||Gt();return{view:I.MappedStatic(u||("em"===p.kind?"auto":"selection-box"),{off:I.Group({}),box:I.Group({bottomLeft:I.Vec3(m.min),topRight:I.Vec3(m.max)},{description:"Static box defined by cartesian coords.",isFlat:!0}),"selection-box":I.Group({radius:I.Numeric(5,{min:0,max:50,step:.5},{description:"Radius in \u212b within which the volume is shown."}),bottomLeft:I.Vec3(C.create(0,0,0),{},{isHidden:!0}),topRight:I.Vec3(C.create(0,0,0),{},{isHidden:!0})},{description:"Box around focused element.",isFlat:!0}),"camera-target":I.Group({radius:I.Numeric(.5,{min:0,max:1,step:.05},{description:"Radius within which the volume is shown (relative to the field of view)."}),dynamicDetailLevel:o(p.header.availablePrecisions,0,{label:"Dynamic Detail"}),bottomLeft:I.Vec3(C.create(0,0,0),{},{isHidden:!0}),topRight:I.Vec3(C.create(0,0,0),{},{isHidden:!0})},{description:"Box around camera target.",isFlat:!0}),cell:I.Group({}),auto:I.Group({radius:I.Numeric(5,{min:0,max:50,step:.5},{description:"Radius in \u212b within which the volume is shown."}),selectionDetailLevel:o(p.header.availablePrecisions,6,{label:"Selection Detail"}),isSelection:I.Boolean(!1,{isHidden:!0}),bottomLeft:I.Vec3(m.min,{},{isHidden:!0}),topRight:I.Vec3(m.max,{},{isHidden:!0})},{description:"Box around focused element.",isFlat:!0})},{options:e.ViewTypeOptions,description:'Controls what of the volume is displayed. "Off" hides the volume alltogether. "Bounded box" shows the volume inside the given box. "Around Interaction" shows the volume around the focused element/atom. "Whole Structure" shows the volume for the whole structure.'}),detailLevel:o(p.header.availablePrecisions,3),channels:I.Group("em"===p.kind?{em:t("EM",st(6524815),p.emDefaultContourLevel||mt.IsoValue.relative(1),p.header.sampling[0].valuesInfo[0],f.em)}:{"2fo-fc":t("2Fo-Fc",st(3367602),mt.IsoValue.relative(1.5),p.header.sampling[0].valuesInfo[0],f["2fo-fc"]),"fo-fc(+ve)":t("Fo-Fc(+ve)",st(3390259),mt.IsoValue.relative(3),p.header.sampling[0].valuesInfo[1],f["fo-fc(+ve)"]),"fo-fc(-ve)":t("Fo-Fc(-ve)",st(12268339),mt.IsoValue.relative(-3),p.header.sampling[0].valuesInfo[1],f["fo-fc(-ve)"])},{isFlat:!0})}}function o(l,c,u){return I.Select(Math.min(c,l.length-1),l.map((d,f)=>[f,`${f+1} [ ${0|Math.pow(d.maxVoxels,1/3)}^3 cells ]`]),{description:"Determines the maximum number of voxels. Depending on the size of the volume options are in the range from 1 (0.52M voxels) to 7 (25.17M voxels).",...u})}function s(l){return{entry:{name:l.entry.name,params:{detailLevel:l.entry.params.detailLevel,channels:l.entry.params.channels,view:{name:l.entry.params.view.name,params:{...l.entry.params.view.params}}}}}}e.createParams=function r(l={}){const{data:c,defaultView:u,channelParams:d}=l,f=new Map;c&&c.entries.forEach(h=>f.set(h.dataId,h));const p=c?c.entries.map(h=>[h.dataId,h.dataId]):[];return{entry:I.Mapped(c?c.entries[0].dataId:"",p,h=>I.Group(i({entryData:f.get(h),defaultView:u,structure:c&&c.structure,channelParams:d})))}},e.createEntryParams=i,e.copyParams=s,e.ViewTypeOptions=[["off","Off"],["box","Bounded Box"],["selection-box","Around Focus"],["camera-target","Around Camera"],["cell","Whole Structure"],["auto","Auto"]],e.ChannelTypeOptions=[["em","em"],["2fo-fc","2fo-fc"],["fo-fc(+ve)","fo-fc(+ve)"],["fo-fc(-ve)","fo-fc(-ve)"]],e.Behavior=class a extends ii.WithSubscribers{get info(){return this.infoMap.get(this.params.entry.name)}queryData(c){var u=this;return le(function*(){let d=mF(u.data.serverUrl,`${u.info.kind}/${u.info.dataId.toLowerCase()}`);if(c){const{min:v,max:x}=c;d+=`/box/${v.map(_=>Math.round(1e3*_)/1e3).join(",")}/${x.map(_=>Math.round(1e3*_)/1e3).join(",")}`}else d+="/cell";let f=u.params.entry.params.detailLevel;"auto"===u.params.entry.params.view.name&&u.params.entry.params.view.params.isSelection&&(f=u.params.entry.params.view.params.selectionDetailLevel),"camera-target"===u.params.entry.params.view.name&&c&&(f=u.decideDetail(c,u.params.entry.params.view.params.dynamicDetailLevel)),d+=`?detail=${f}`;const p=yP.get(u.cache,d);if(p)return p.data;const m=jr.getUrlAsset(u.plugin.managers.asset,d),h=yield u.plugin.runTask(u.plugin.managers.asset.resolve(m,"binary")),g=yield u.parseCif(h.data);if(!g)return;const y=yP.set(u.cache,d,{data:g,asset:h});return y&&y.asset.dispose(),g})()}parseCif(c){var u=this;return le(function*(){const d=yield u.plugin.runTask(Hh.parseBinary(c));if(d.isError)return void u.plugin.log.error("VolumeStreaming, parsing CIF: "+d.toString());if(d.result.blocks.length<2)return void u.plugin.log.error("VolumeStreaming: Invalid data.");const f={};for(let p=1;p{!Se.Molecule.Structure.is(u.obj)||!Me.is(this.lastLoci)||this.lastLoci.structure===u.obj.data&&(this.lastLoci=qr)}),this.subscribeObservable(this.plugin.state.events.object.updated,u=>{!Se.Molecule.Structure.is(u.oldObj)||!Me.is(this.lastLoci)||this.lastLoci.structure===u.oldObj.data&&(this.lastLoci=qr)}),this.subscribeObservable(this.plugin.managers.structure.focus.behaviors.current,u=>{if(!this.plugin.state.data.tree.children.has(this.ref))return;const d=u?u.loci:qr;switch(this.params.entry.params.view.name){case"auto":this.updateAuto(d);break;case"selection-box":this.updateSelectionBox(d);break;default:this.lastLoci=d}})}unregister(){let c=this.cache.entries.first;for(;c;)c.value.data.asset.dispose(),c=c.next}isCameraTargetSame(c,u){if(!c||!u)return!1;const d=C.equals(c.target,u.target),f=C.squaredDistance(c.target,c.position),p=C.squaredDistance(u.target,u.position),m=Math.abs(f-p)/f<.001;return d&&m}cameraTargetDistance(c){return C.distance(c.target,c.position)}getBoxFromLoci(c){var u,d,f;if(Yn.isEmpty(c)||uu(c))return Gt();const p=this.plugin.helpers.substructureParent.get(c.structure,!0);if(!p)return Gt();const m=this.getStructureRoot();if(!m||(null===(u=m.obj)||void 0===u?void 0:u.data)!==(null===(d=p.obj)||void 0===d?void 0:d.data))return Gt();const h=s_.get(null===(f=m.obj)||void 0===f?void 0:f.data.models[0]);h&&fe.invert(this._invTransform,h);const g=Me.extendToWholeResidues(c),y=Me.getBoundary(g,h&&!Number.isNaN(this._invTransform[0])?this._invTransform:void 0).box;return 1===Me.size(g)&&Gt.expand(y,y,C.create(1,1,1)),y}updateAuto(c){var u=this;this.updateQueue.enqueue(le(function*(){u.lastLoci=c,uu(c)?yield u.updateParams("x-ray"===u.info.kind?u.data.structure.boundary.box:void 0,!1):yield u.updateParams(u.getBoxFromLoci(c),!0)}))}updateSelectionBox(c){var u=this;this.updateQueue.enqueue(le(function*(){u.lastLoci=Yn.areEqual(u.lastLoci,c)?qr:c;const d=u.getBoxFromLoci(u.lastLoci);yield u.updateParams(d)}))}updateCameraTarget(c){var u=this;this.updateQueue.enqueue(le(function*(){var d,f,p;const m=null===(d=u.plugin.canvas3d)||void 0===d?void 0:d.props.camera.manualReset;try{m||null===(f=u.plugin.canvas3d)||void 0===f||f.setProps({camera:{manualReset:!0}});const h=u.boxFromCameraTarget(c,!0);yield u.updateParams(h)}finally{m||null===(p=u.plugin.canvas3d)||void 0===p||p.setProps({camera:{manualReset:m}})}}))}boxFromCameraTarget(c,u){var d;const f=c.target,p=this.cameraTargetDistance(c);let h=Math.tan(.5*c.fov)*p;const g=null===(d=this.plugin.canvas3d)||void 0===d?void 0:d.camera.viewport;let v,x,_;if(g&&g.width>g.height&&(h*=g.width/g.height),h*="camera-target"===this.params.entry.params.view.name?this.params.entry.params.view.params.radius:.5,u){const w=C.zero();Gt.size(w,this.data.structure.boundary.box),v=Math.min(h,.5*w[0]),x=Math.min(h,.5*w[1]),_=Math.min(h,.5*w[2])}else v=x=_=h;return Gt.create(C.create(f[0]-v,f[1]-x,f[2]-_),C.create(f[0]+v,f[1]+x,f[2]+_))}decideDetail(c,u){const d="x-ray"===this.info.kind?Gt.volume(this.data.structure.boundary.box):this.info.header.spacegroup.size.reduce((g,y)=>g*y,1);let p=Gt.volume(c)/d;const m=this.info.header.availablePrecisions.length-1;let h=u;for(;p<=.5&&hu.updateCameraTarget(g))),f=u.boxFromCameraTarget(u.plugin.canvas3d.camera.getSnapshot(),!0);break;case"cell":f="x-ray"===u.info.kind?u.data.structure.boundary.box:void 0;break;case"auto":if(f=c.entry.params.view.params.isSelection||"x-ray"===u.info.kind?Gt.create(C.clone(c.entry.params.view.params.bottomLeft),C.clone(c.entry.params.view.params.topRight)):void 0,f&&(p=Gt.volume(f)<1e-4,c.entry.params.view.params.isSelection)){const g=c.entry.params.view.params.radius;Gt.expand(f,f,C.create(g,g,g))}}const m=p?{}:yield u.queryData(f);if(!m)return!1;const h=c.entry.params.channels;return"x-ray"===u.info.kind?(u.channels["2fo-fc"]=u.createChannel(m["2FO-FC"]||mt.One,h["2fo-fc"],u.info.header.sampling[0].valuesInfo[0]),u.channels["fo-fc(+ve)"]=u.createChannel(m["FO-FC"]||mt.One,h["fo-fc(+ve)"],u.info.header.sampling[0].valuesInfo[1]),u.channels["fo-fc(-ve)"]=u.createChannel(m["FO-FC"]||mt.One,h["fo-fc(-ve)"],u.info.header.sampling[0].valuesInfo[1])):u.channels.em=u.createChannel(m.EM||mt.One,h.em,u.info.header.sampling[0].valuesInfo[0]),!0})()}createChannel(c,u,d){return{data:c,color:u.color,wireframe:u.wireframe,opacity:u.opacity,isoValue:"relative"===u.isoValue.kind?u.isoValue:mt.IsoValue.toRelative(u.isoValue,d)}}getDescription(){return"selection-box"===this.params.entry.params.view.name?"Selection":"camera-target"===this.params.entry.params.view.name?"Camera":"box"===this.params.entry.params.view.name?"Static Box":"cell"===this.params.entry.params.view.name?"Cell":""}constructor(c,u){super(c,{}),this.plugin=c,this.data=u,this.cache=yP.create(25),this.params={},this.lastLoci=qr,this.ref="",this.cameraTargetObservable=this.plugin.canvas3d.didDraw.pipe(mA(500,void 0,{leading:!0,trailing:!0}),hn(()=>{var d;return null===(d=this.plugin.canvas3d)||void 0===d?void 0:d.camera.getSnapshot()}),sge((d,f)=>this.isCameraTargetSame(d,f)),xd(d=>void 0!==d)),this.cameraTargetSubscription=void 0,this.channels={},this._invTransform=fe(),this.infoMap=new Map,this.data.entries.forEach(d=>this.infoMap.set(d.dataId,d)),this.updateQueue=new nlt}}}(fu||(fu={}));const Ks=[K1(0,0,0),K1(1,0,0),K1(1,1,0),K1(0,1,0),K1(0,0,1),K1(1,0,1),K1(1,1,1),K1(0,1,1)],rlt=[Up(Ks[0],Ks[1]),Up(Ks[1],Ks[2]),Up(Ks[2],Ks[3]),Up(Ks[3],Ks[0]),Up(Ks[4],Ks[5]),Up(Ks[5],Ks[6]),Up(Ks[6],Ks[7]),Up(Ks[7],Ks[4]),Up(Ks[0],Ks[4]),Up(Ks[1],Ks[5]),Up(Ks[2],Ks[6]),Up(Ks[3],Ks[7])],ilt=[{i:0,j:0,k:0,e:0},{i:1,j:0,k:0,e:1},{i:0,j:1,k:0,e:0},{i:0,j:0,k:0,e:1},{i:0,j:0,k:1,e:0},{i:1,j:0,k:1,e:1},{i:0,j:1,k:1,e:0},{i:0,j:0,k:1,e:1},{i:0,j:0,k:0,e:2},{i:1,j:0,k:0,e:2},{i:1,j:1,k:0,e:2},{i:0,j:1,k:0,e:2}],olt=[0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0],gA=[[],[0,8,3],[0,1,9],[1,8,3,9,8,1],[1,2,10],[0,8,3,1,2,10],[9,2,10,0,2,9],[2,8,3,2,10,8,10,9,8],[3,11,2],[0,11,2,8,11,0],[1,9,0,2,3,11],[1,11,2,1,9,11,9,8,11],[3,10,1,11,10,3],[0,10,1,0,8,10,8,11,10],[3,9,0,3,11,9,11,10,9],[9,8,10,10,8,11],[4,7,8],[4,3,0,7,3,4],[0,1,9,8,4,7],[4,1,9,4,7,1,7,3,1],[1,2,10,8,4,7],[3,4,7,3,0,4,1,2,10],[9,2,10,9,0,2,8,4,7],[2,10,9,2,9,7,2,7,3,7,9,4],[8,4,7,3,11,2],[11,4,7,11,2,4,2,0,4],[9,0,1,8,4,7,2,3,11],[4,7,11,9,4,11,9,11,2,9,2,1],[3,10,1,3,11,10,7,8,4],[1,11,10,1,4,11,1,0,4,7,11,4],[4,7,8,9,0,11,9,11,10,11,0,3],[4,7,11,4,11,9,9,11,10],[9,5,4],[9,5,4,0,8,3],[0,5,4,1,5,0],[8,5,4,8,3,5,3,1,5],[1,2,10,9,5,4],[3,0,8,1,2,10,4,9,5],[5,2,10,5,4,2,4,0,2],[2,10,5,3,2,5,3,5,4,3,4,8],[9,5,4,2,3,11],[0,11,2,0,8,11,4,9,5],[0,5,4,0,1,5,2,3,11],[2,1,5,2,5,8,2,8,11,4,8,5],[10,3,11,10,1,3,9,5,4],[4,9,5,0,8,1,8,10,1,8,11,10],[5,4,0,5,0,11,5,11,10,11,0,3],[5,4,8,5,8,10,10,8,11],[9,7,8,5,7,9],[9,3,0,9,5,3,5,7,3],[0,7,8,0,1,7,1,5,7],[1,5,3,3,5,7],[9,7,8,9,5,7,10,1,2],[10,1,2,9,5,0,5,3,0,5,7,3],[8,0,2,8,2,5,8,5,7,10,5,2],[2,10,5,2,5,3,3,5,7],[7,9,5,7,8,9,3,11,2],[9,5,7,9,7,2,9,2,0,2,7,11],[2,3,11,0,1,8,1,7,8,1,5,7],[11,2,1,11,1,7,7,1,5],[9,5,8,8,5,7,10,1,3,10,3,11],[5,7,0,5,0,9,7,11,0,1,0,10,11,10,0],[11,10,0,11,0,3,10,5,0,8,0,7,5,7,0],[11,10,5,7,11,5],[10,6,5],[0,8,3,5,10,6],[9,0,1,5,10,6],[1,8,3,1,9,8,5,10,6],[1,6,5,2,6,1],[1,6,5,1,2,6,3,0,8],[9,6,5,9,0,6,0,2,6],[5,9,8,5,8,2,5,2,6,3,2,8],[2,3,11,10,6,5],[11,0,8,11,2,0,10,6,5],[0,1,9,2,3,11,5,10,6],[5,10,6,1,9,2,9,11,2,9,8,11],[6,3,11,6,5,3,5,1,3],[0,8,11,0,11,5,0,5,1,5,11,6],[3,11,6,0,3,6,0,6,5,0,5,9],[6,5,9,6,9,11,11,9,8],[5,10,6,4,7,8],[4,3,0,4,7,3,6,5,10],[1,9,0,5,10,6,8,4,7],[10,6,5,1,9,7,1,7,3,7,9,4],[6,1,2,6,5,1,4,7,8],[1,2,5,5,2,6,3,0,4,3,4,7],[8,4,7,9,0,5,0,6,5,0,2,6],[7,3,9,7,9,4,3,2,9,5,9,6,2,6,9],[3,11,2,7,8,4,10,6,5],[5,10,6,4,7,2,4,2,0,2,7,11],[0,1,9,4,7,8,2,3,11,5,10,6],[9,2,1,9,11,2,9,4,11,7,11,4,5,10,6],[8,4,7,3,11,5,3,5,1,5,11,6],[5,1,11,5,11,6,1,0,11,7,11,4,0,4,11],[0,5,9,0,6,5,0,3,6,11,6,3,8,4,7],[6,5,9,6,9,11,4,7,9,7,11,9],[10,4,9,6,4,10],[4,10,6,4,9,10,0,8,3],[10,0,1,10,6,0,6,4,0],[8,3,1,8,1,6,8,6,4,6,1,10],[1,4,9,1,2,4,2,6,4],[3,0,8,1,2,9,2,4,9,2,6,4],[0,2,4,4,2,6],[8,3,2,8,2,4,4,2,6],[10,4,9,10,6,4,11,2,3],[0,8,2,2,8,11,4,9,10,4,10,6],[3,11,2,0,1,6,0,6,4,6,1,10],[6,4,1,6,1,10,4,8,1,2,1,11,8,11,1],[9,6,4,9,3,6,9,1,3,11,6,3],[8,11,1,8,1,0,11,6,1,9,1,4,6,4,1],[3,11,6,3,6,0,0,6,4],[6,4,8,11,6,8],[7,10,6,7,8,10,8,9,10],[0,7,3,0,10,7,0,9,10,6,7,10],[10,6,7,1,10,7,1,7,8,1,8,0],[10,6,7,10,7,1,1,7,3],[1,2,6,1,6,8,1,8,9,8,6,7],[2,6,9,2,9,1,6,7,9,0,9,3,7,3,9],[7,8,0,7,0,6,6,0,2],[7,3,2,6,7,2],[2,3,11,10,6,8,10,8,9,8,6,7],[2,0,7,2,7,11,0,9,7,6,7,10,9,10,7],[1,8,0,1,7,8,1,10,7,6,7,10,2,3,11],[11,2,1,11,1,7,10,6,1,6,7,1],[8,9,6,8,6,7,9,1,6,11,6,3,1,3,6],[0,9,1,11,6,7],[7,8,0,7,0,6,3,11,0,11,6,0],[7,11,6],[7,6,11],[3,0,8,11,7,6],[0,1,9,11,7,6],[8,1,9,8,3,1,11,7,6],[10,1,2,6,11,7],[1,2,10,3,0,8,6,11,7],[2,9,0,2,10,9,6,11,7],[6,11,7,2,10,3,10,8,3,10,9,8],[7,2,3,6,2,7],[7,0,8,7,6,0,6,2,0],[2,7,6,2,3,7,0,1,9],[1,6,2,1,8,6,1,9,8,8,7,6],[10,7,6,10,1,7,1,3,7],[10,7,6,1,7,10,1,8,7,1,0,8],[0,3,7,0,7,10,0,10,9,6,10,7],[7,6,10,7,10,8,8,10,9],[6,8,4,11,8,6],[3,6,11,3,0,6,0,4,6],[8,6,11,8,4,6,9,0,1],[9,4,6,9,6,3,9,3,1,11,3,6],[6,8,4,6,11,8,2,10,1],[1,2,10,3,0,11,0,6,11,0,4,6],[4,11,8,4,6,11,0,2,9,2,10,9],[10,9,3,10,3,2,9,4,3,11,3,6,4,6,3],[8,2,3,8,4,2,4,6,2],[0,4,2,4,6,2],[1,9,0,2,3,4,2,4,6,4,3,8],[1,9,4,1,4,2,2,4,6],[8,1,3,8,6,1,8,4,6,6,10,1],[10,1,0,10,0,6,6,0,4],[4,6,3,4,3,8,6,10,3,0,3,9,10,9,3],[10,9,4,6,10,4],[4,9,5,7,6,11],[0,8,3,4,9,5,11,7,6],[5,0,1,5,4,0,7,6,11],[11,7,6,8,3,4,3,5,4,3,1,5],[9,5,4,10,1,2,7,6,11],[6,11,7,1,2,10,0,8,3,4,9,5],[7,6,11,5,4,10,4,2,10,4,0,2],[3,4,8,3,5,4,3,2,5,10,5,2,11,7,6],[7,2,3,7,6,2,5,4,9],[9,5,4,0,8,6,0,6,2,6,8,7],[3,6,2,3,7,6,1,5,0,5,4,0],[6,2,8,6,8,7,2,1,8,4,8,5,1,5,8],[9,5,4,10,1,6,1,7,6,1,3,7],[1,6,10,1,7,6,1,0,7,8,7,0,9,5,4],[4,0,10,4,10,5,0,3,10,6,10,7,3,7,10],[7,6,10,7,10,8,5,4,10,4,8,10],[6,9,5,6,11,9,11,8,9],[3,6,11,0,6,3,0,5,6,0,9,5],[0,11,8,0,5,11,0,1,5,5,6,11],[6,11,3,6,3,5,5,3,1],[1,2,10,9,5,11,9,11,8,11,5,6],[0,11,3,0,6,11,0,9,6,5,6,9,1,2,10],[11,8,5,11,5,6,8,0,5,10,5,2,0,2,5],[6,11,3,6,3,5,2,10,3,10,5,3],[5,8,9,5,2,8,5,6,2,3,8,2],[9,5,6,9,6,0,0,6,2],[1,5,8,1,8,0,5,6,8,3,8,2,6,2,8],[1,5,6,2,1,6],[1,3,6,1,6,10,3,8,6,5,6,9,8,9,6],[10,1,0,10,0,6,9,5,0,5,6,0],[0,3,8,5,6,10],[10,5,6],[11,5,10,7,5,11],[11,5,10,11,7,5,8,3,0],[5,11,7,5,10,11,1,9,0],[10,7,5,10,11,7,9,8,1,8,3,1],[11,1,2,11,7,1,7,5,1],[0,8,3,1,2,7,1,7,5,7,2,11],[9,7,5,9,2,7,9,0,2,2,11,7],[7,5,2,7,2,11,5,9,2,3,2,8,9,8,2],[2,5,10,2,3,5,3,7,5],[8,2,0,8,5,2,8,7,5,10,2,5],[9,0,1,5,10,3,5,3,7,3,10,2],[9,8,2,9,2,1,8,7,2,10,2,5,7,5,2],[1,3,5,3,7,5],[0,8,7,0,7,1,1,7,5],[9,0,3,9,3,5,5,3,7],[9,8,7,5,9,7],[5,8,4,5,10,8,10,11,8],[5,0,4,5,11,0,5,10,11,11,3,0],[0,1,9,8,4,10,8,10,11,10,4,5],[10,11,4,10,4,5,11,3,4,9,4,1,3,1,4],[2,5,1,2,8,5,2,11,8,4,5,8],[0,4,11,0,11,3,4,5,11,2,11,1,5,1,11],[0,2,5,0,5,9,2,11,5,4,5,8,11,8,5],[9,4,5,2,11,3],[2,5,10,3,5,2,3,4,5,3,8,4],[5,10,2,5,2,4,4,2,0],[3,10,2,3,5,10,3,8,5,4,5,8,0,1,9],[5,10,2,5,2,4,1,9,2,9,4,2],[8,4,5,8,5,3,3,5,1],[0,4,5,1,0,5],[8,4,5,8,5,3,9,0,5,0,3,5],[9,4,5],[4,11,7,4,9,11,9,10,11],[0,8,3,4,9,7,9,11,7,9,10,11],[1,10,11,1,11,4,1,4,0,7,4,11],[3,1,4,3,4,8,1,10,4,7,4,11,10,11,4],[4,11,7,9,11,4,9,2,11,9,1,2],[9,7,4,9,11,7,9,1,11,2,11,1,0,8,3],[11,7,4,11,4,2,2,4,0],[11,7,4,11,4,2,8,3,4,3,2,4],[2,9,10,2,7,9,2,3,7,7,4,9],[9,10,7,9,7,4,10,2,7,8,7,0,2,0,7],[3,7,10,3,10,2,7,4,10,1,10,0,4,0,10],[1,10,2,8,7,4],[4,9,1,4,1,7,7,1,3],[4,9,1,4,1,7,0,8,1,8,7,1],[4,0,3,7,4,3],[4,8,7],[9,10,8,10,11,8],[3,0,9,3,9,11,11,9,10],[0,1,10,0,10,8,8,10,11],[3,1,10,11,3,10],[1,2,11,1,11,9,9,11,8],[3,0,9,3,9,11,1,2,9,2,11,9],[0,2,11,8,0,11],[3,2,11],[2,3,8,2,8,10,10,8,9],[9,10,2,0,9,2],[2,3,8,2,8,10,0,1,8,1,10,8],[1,10,2],[1,3,8,9,1,8],[0,9,1],[0,3,8],[]],$G=[[0,4,4,4,2,0,0,0,2,2,0,0],[4,0,4,4,0,8,0,0,0,8,8,0],[4,4,0,4,0,0,8,0,0,0,8,8],[4,4,4,0,0,0,0,1,1,0,0,1],[2,0,0,0,0,8,8,8,2,2,0,0],[0,8,0,0,8,0,8,8,0,8,8,0],[0,0,8,0,8,8,0,8,0,0,8,8],[0,0,0,1,8,8,8,0,1,0,0,1],[2,0,0,1,2,0,0,1,0,2,0,1],[2,8,0,0,2,8,0,0,2,0,8,0],[0,8,8,0,0,8,8,0,0,8,0,8],[0,0,8,1,0,0,8,1,1,0,8,0]];function age(e){return{...e,bottomLeft:Ll(e.bottomLeft,[0,0,0]),topRight:Ll(e.topRight,e.scalarField.space.dimensions)}}function lge(e){return{dX:e.topRight[0]-e.bottomLeft[0],dY:e.topRight[1]-e.bottomLeft[1],dZ:e.topRight[2]-e.bottomLeft[2]}}function yA(e,t){return Ke.create("Marching Cubes Mesh",function(){var n=le(function*(r){const i=age(e),{dX:o,dY:s,dZ:a}=lge(i),c=function slt(e,t){const n=Math.min(65536,4*e),r=tt.create(Float32Array,3,e,t&&t.vertexBuffer.ref.value),i=tt.create(Float32Array,3,e,t&&t.normalBuffer.ref.value),o=tt.create(Float32Array,1,e,t&&t.groupBuffer.ref.value),s=tt.create(Uint32Array,3,n,t&&t.indexBuffer.ref.value);let a=0,l=0;return{addVertex:(c,u,d)=>(++a,tt.add3(r,c,u,d)),addNormal:(c,u,d)=>{tt.add3(i,c,u,d)},addGroup:c=>{tt.add(o,c)},addTriangle:(c,u,d,f)=>{const p=c[u],m=c[d],h=c[f];p>=0&&m>=0&&h>=0&&(++l,tt.add3(s,p,m,h))},get:()=>{const c=tt.compact(r,!0),u=tt.compact(i,!0),d=tt.compact(s,!0),f=tt.compact(o,!0);return on.create(c,d,u,f,a,l,t)}}}(Math.min(262144,Math.max(o*s*a/32,1024)),t);return yield new cge(r,c,i).run(),c.get()});return function(r){return n.apply(this,arguments)}}())}function YG(e,t){return Ke.create("Marching Cubes Lines",function(){var n=le(function*(r){const i=age(e),{dX:o,dY:s,dZ:a}=lge(i),c=function alt(e,t){const n=tt.create(Float32Array,3,e),r=tt.create(Float32Array,1,e),i=tt.create(Float32Array,2,e);let o=0;return{addVertex:(s,a,l)=>tt.add3(n,s,a,l),addNormal:()=>rp,addGroup:s=>{tt.add(r,s)},addTriangle:(s,a,l,c,u)=>{s[a]>=0&&s[l]>=0&&s[c]>=0&&($G[a][l]&u&&(++o,tt.add2(i,s[a],s[l])),$G[l][c]&u&&(++o,tt.add2(i,s[l],s[c])),$G[a][c]&u&&(++o,tt.add2(i,s[a],s[c])))},get:()=>{const s=tt.compact(n,!0),a=tt.compact(i,!0),l=tt.compact(r,!0),c=Pd.create(o,o/10,t);for(let u=0;u0)return i-1;const o=this.scalarField,s=this.scalarFieldGet,a=rlt[t],l=a.a,c=a.b,u=l.i+this.i,d=l.j+this.j,f=l.k+this.k,p=c.i+this.i,m=c.j+this.j,h=c.k+this.k,g=s(o,u,d,f),y=s(o,p,m,h),v=(this.isoLevel-g)/(g-y);if(this.idField){const N=this.idFieldGet(this.idField,u,d,f),j=this.idFieldGet(this.idField,p,m,h);let W=v<.5?N:j;if(-1===W&&(W=v<.5?j:N),-2===W)return-1;this.builder.addGroup(W)}else this.builder.addGroup(0);const x=this.builder.addVertex(u+v*(u-p),d+v*(d-m),f+v*(f-h));this.verticesOnEdges[r]=x+1;const _=s(o,Math.max(0,u-1),d,f)-s(o,Math.min(this.nX-1,u+1),d,f),w=s(o,u,Math.max(0,d-1),f)-s(o,u,Math.min(this.nY-1,d+1),f),A=s(o,u,d,Math.max(0,f-1))-s(o,u,d,Math.min(this.nZ,f+1)),T=_+v*(_-(s(o,Math.max(0,p-1),m,h)-s(o,Math.min(this.nX-1,p+1),m,h))),F=w+v*(w-(s(o,p,Math.max(0,m-1),h)-s(o,p,Math.min(this.nY-1,m+1),h))),R=A+v*(A-(s(o,p,m,Math.max(0,h-1))-s(o,p,m,Math.min(this.nZ-1,h+1))));return this.isoLevel>=0?this.builder.addNormal(T,F,R):this.builder.addNormal(-T,-F,-R),x}constructor(t,n){this.builder=t,this.vertList=[0,0,0,0,0,0,0,0,0,0,0,0],this.i=0,this.j=0,this.k=0;const r=n.scalarField.space.dimensions;this.nX=r[0],this.nY=r[1],this.nZ=r[2],this.isoLevel=n.isoLevel,this.scalarFieldGet=n.scalarField.space.get,this.scalarField=n.scalarField.data,n.idField&&(this.idField=n.idField.data,this.idFieldGet=n.idField.space.get),this.verticesOnEdges=new Int32Array(3*this.nX*this.nY*2)}get(t,n,r){return this.scalarFieldGet(this.scalarField,t,n,r)}processCell(t,n,r,i){let o=0;if(this.get(t,n,r)0&&(this.vertList[0]=this.interpolate(0)),(2&s)>0&&(this.vertList[1]=this.interpolate(1)),(4&s)>0&&(this.vertList[2]=this.interpolate(2)),(8&s)>0&&(this.vertList[3]=this.interpolate(3)),(16&s)>0&&(this.vertList[4]=this.interpolate(4)),(32&s)>0&&(this.vertList[5]=this.interpolate(5)),(64&s)>0&&(this.vertList[6]=this.interpolate(6)),(128&s)>0&&(this.vertList[7]=this.interpolate(7)),(256&s)>0&&(this.vertList[8]=this.interpolate(8)),(512&s)>0&&(this.vertList[9]=this.interpolate(9)),(1024&s)>0&&(this.vertList[10]=this.interpolate(10)),(2048&s)>0&&(this.vertList[11]=this.interpolate(11));const a=gA[o];for(let l=0;l=0?this.builder.addTriangle(this.vertList,c,u,d,i):this.builder.addTriangle(this.vertList,d,u,c,i)}}}function H_(e,t){const{defaultProps:n,createGeometry:r,createLocationIterator:i,getLoci:o,eachLocation:s,setUpdateState:a,mustRecreate:l,dispose:c}=e,{updateValues:u,updateBoundingSphere:d,updateRenderableState:f,createPositionIterator:p}=e.geometryUtils,m=Ag.create();let h,g,y,v,x,A,M,E,T,F,_=Object.assign({},n),w=Ia.createEmpty(),D=-1;function N(z){if(m.createNew){if(T=i(v,x),!z)throw new Error("expected geometry to be given");h=function clt(e,t,n,r,i,o){const{createValues:s,createRenderableState:a}=$a.getUtils(t),c=s(t,E9(),n,r,i),u=a(i);return Jw(t.kind,c,u,o)}(0,z,T,y,g,t),F=p(z,h.values)}else{if(!h)throw new Error("expected renderObject to be available");if(m.updateTransform){T=i(v,x);const{instanceCount:$,groupCount:V}=T;g.instanceGranularity?hs($,"instance",h.values):hs($*V,"groupInstance",h.values)}else T.reset();if(m.createGeometry){if(!z)throw new Error("expected geometry to be given");O.updateIfChanged(h.values.drawCount,$a.getDrawCount(z)),O.updateIfChanged(h.values.uVertexCount,$a.getVertexCount(z)),O.updateIfChanged(h.values.uGroupCount,$a.getGroupCount(z))}(m.updateTransform||m.createGeometry)&&(d(h.values,z||E),F=p(z||E,h.values)),m.updateSize&&"uSize"in h.values&&xy(T,y.size,h.values),m.updateColor&&Ef(T,F,y.color,h.values),u(h.values,g),f(h.state,g)}_=g,w=y,A=v,M=x,z&&(E=z,D+=1)}function W(z,$){return Xu(z)?$(Pe.ofBounds(0,_.instanceGranularity?T.instanceCount:T.groupCount*T.instanceCount)):_.instanceGranularity?function j(z,$,V,X){let H=!1;if(mt.Cell.isLoci(z)){if(mt.Cell.isLociEmpty(z)||!mt.areEquivalent(z.volume,$))return!1;X(Pe.ofSingleton(0))&&(H=!0)}else if(mt.Segment.isLoci(z)){if(mt.Segment.isLociEmpty(z)||!mt.areEquivalent(z.volume,$)||!rt.has(z.segments,V))return!1;X(Pe.ofSingleton(0))&&(H=!0)}return H}(z,A,M,$):s(z,A,M,_,$)}return{get groupCount(){return T?T.count:0},get renderObject(){return h},get geometryVersion(){return D},createOrUpdate:(z,$,V={},X)=>le(function*(){if(function R(z,$,V,X){if(!V&&!A)throw new Error("missing volume");g=Object.assign({},_,$),y=z,v=V,x=X,Ag.reset(m),h?(!mt.areEquivalent(v,A)||x!==M)&&(m.createNew=!0):m.createNew=!0,m.createNew?m.createGeometry=!0:(a(m,V,g,_,y,w),Rd.areEqual(z.color,w.color)||(m.updateColor=!0),m.createGeometry&&(m.updateColor=!0),g.instanceGranularity!==_.instanceGranularity&&(m.updateTransform=!0))}($,V,X?.volume||A,X?.key||M),m.createGeometry){const H=r(z,v,x,y,g,E);return PR(H)?H.then(N):N(H)}N()})(),getLoci:z=>h?o(z,A,M,_,h.id):qr,eachLocation(z){for(T.reset();T.hasNext;){const{location:$,isSecondary:V}=T.move();z($,V)}},mark:(z,$)=>pr.mark(h,z,$,W),setVisibility(z){pr.setVisibility(h,z)},setAlphaFactor(z){pr.setAlphaFactor(h,z)},setPickable(z){pr.setPickable(h,z)},setColorOnly(z){pr.setColorOnly(h,z)},setTransform(z,$){pr.setTransform(h,z,$)},setOverpaint:z=>pr.setOverpaint(h,z,W,!0),setTransparency:z=>pr.setTransparency(h,z,W,!0),setSubstance:z=>pr.setSubstance(h,z,W,!0),setClipping:z=>pr.setClipping(h,z,W,!0),setThemeStrength(z){pr.setThemeStrength(h,z)},destroy(){c?.(E),h&&(h.state.disposed=!0,h=void 0)},mustRecreate:l}}function vP(e,t,n,r,i,o=(()=>[-1])){let s=0;const{webgl:a}=t,l=new si,c=new Xn.GeometryState,u=ky(),d=[],f=Xn.createState(),p=new Map;let m,h,g,y,v=Ia.createEmpty();function x(F,R){return _.apply(this,arguments)}function _(){return(_=le(function*(F,R){var N;let j=p.get(R);return j?!(null===(N=j.mustRecreate)||void 0===N)&&N.call(j,{volume:m,key:R},y,a)&&(j.destroy(),j=r(u,m,R,y,a),p.set(R,j)):(j=r(u,m,R,y,a),p.set(R,j)),j.createOrUpdate({webgl:a,runtime:F},v,y,{volume:m,key:R})})).apply(this,arguments)}return{label:e,get groupCount(){let F=0;return p.forEach(R=>{R.renderObject&&(F+=R.groupCount)}),F},get props(){return y},get params(){return g},get state(){return f},get theme(){return v},get geometryVersion(){return c.version},renderObjects:d,updated:l,createOrUpdate:function w(F={},R){R&&R!==m&&(g=n(t,R),m=R,y||(y=I.getDefaultValues(g)));const N=kG(Object.assign({},y,F),m);return Object.assign(y,F,N),h=o(y),Ke.create("Creating or updating VolumeRepresentation",function(){var j=le(function*(W){const z=new Set(p.keys());for(let $=0,V=h.length;${var V;null===(V=p.get($))||void 0===V||V.destroy(),p.delete($)}),d.length=0,p.forEach($=>{$.renderObject&&(d.push($.renderObject),c.add($.renderObject.id,$.geometryVersion))}),c.snapshot(),l.next(s++)});return function(W){return j.apply(this,arguments)}}())},setState:function E(F){const{visible:R,alphaFactor:N,pickable:j,overpaint:W,transparency:z,substance:$,clipping:V,transform:X,themeStrength:H,syncManually:oe,markerActions:te}=F,K={};void 0!==R&&(K.visible=R),void 0!==N&&(K.alphaFactor=N),void 0!==j&&(K.pickable=j),void 0!==W&&(K.overpaint=W),void 0!==z&&(K.transparency=z),void 0!==$&&(K.substance=$),void 0!==V&&(K.clipping=V),void 0!==H&&(K.themeStrength=H),void 0!==X&&!fe.areEqual(X,f.transform,wi)&&(K.transform=X),void 0!==oe&&(K.syncManually=oe),void 0!==te&&(K.markerActions=te),p.forEach(Q=>function M(F,R){void 0!==R.visible&&F&&F.setVisibility(R.visible),void 0!==R.alphaFactor&&F&&F.setAlphaFactor(R.alphaFactor),void 0!==R.pickable&&F&&F.setPickable(R.pickable),void 0!==R.overpaint&&F&&F.setOverpaint(R.overpaint),void 0!==R.transparency&&F&&F.setTransparency(R.transparency),void 0!==R.substance&&F&&F.setSubstance(R.substance),void 0!==R.clipping&&F&&F.setClipping(R.clipping),void 0!==R.transform&&F&&F.setTransform(R.transform),void 0!==R.themeStrength&&F&&F.setThemeStrength(R.themeStrength)}(Q,K)),Xn.updateState(f,F)},setTheme:function D(F){v=F},getLoci:F=>{let R=qr;return p.forEach(N=>{const j=N.getLoci(F);uu(j)||(R=j)}),R},getAllLoci:()=>[i(m,y)],eachLocation:F=>{p.forEach(R=>{R.eachLocation(F)})},mark:function A(F,R){let N=!1;return p.forEach(j=>{N=j.mark(F,R)||N}),N},destroy:function T(){p.forEach(F=>F.destroy()),p.clear()}}}const ult="\nprecision highp float;\nprecision highp int;\n\n#if __VERSION__ == 100\n precision highp sampler2D;\n uniform sampler2D tTexture;\n#else\n precision highp isampler2D;\n uniform isampler2D tTexture;\n#endif\n\nvoid main(void) {\n #if __VERSION__ == 100\n gl_FragColor = texture2D(tTexture, vec2(0.5));\n #else\n gl_FragColor = ivec4(texture2D(tTexture, vec2(0.5)).r);\n #endif\n}\n",dlt={...ca,tTexture:xn("texture","rgba","float","nearest")},zp="histopyramid-sum";const bF=new Uint8Array(4),uge=new Int32Array(4),glt="\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tInputLevel;\n\n// previous level used to evaluate the new level\n#if __VERSION__ == 100\n uniform sampler2D tPreviousLevel;\n#else\n precision highp isampler2D;\n uniform isampler2D tPreviousLevel;\n#endif\n\n// inverted size of the previous level texture.\nuniform float uSize;\nuniform float uTexSize;\nuniform bool uFirst;\n\n#include common\n\nvoid main(void) {\n float k = 0.5 * uSize;\n vec2 position = floor((gl_FragCoord.xy / uTexSize) / uSize) * uSize;\n\n #if __VERSION__ == 100\n float a, b, c, d;\n\n if (uFirst) {\n a = texture2D(tInputLevel, position).r * 255.0;\n b = texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0;\n c = texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0;\n d = texture2D(tInputLevel, position + vec2(k, k)).r * 255.0;\n } else {\n a = unpackRGBToInt(texture2D(tPreviousLevel, position).rgb);\n b = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(k, 0.0)).rgb);\n c = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(0.0, k)).rgb);\n d = unpackRGBToInt(texture2D(tPreviousLevel, position + vec2(k, k)).rgb);\n }\n gl_FragColor = vec4(packIntToRGB(a + b + c + d), 1.0);\n #else\n int a, b, c, d;\n\n if (uFirst) {\n a = int(texture2D(tInputLevel, position).r * 255.0);\n b = int(texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0);\n c = int(texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0);\n d = int(texture2D(tInputLevel, position + vec2(k, k)).r * 255.0);\n } else {\n a = texture2D(tPreviousLevel, position).r;\n b = texture2D(tPreviousLevel, position + vec2(k, 0.0)).r;\n c = texture2D(tPreviousLevel, position + vec2(0.0, k)).r;\n d = texture2D(tPreviousLevel, position + vec2(k, k)).r;\n }\n gl_FragColor = ivec4(a + b + c + d);\n #endif\n}\n",ylt={...ca,tInputLevel:xn("texture","rgba","float","nearest"),tPreviousLevel:xn("texture","rgba","float","nearest"),uSize:Ne("f"),uTexSize:Ne("f"),uFirst:Ne("b")},Z1="histogram-pyramid";function xlt(e,t){const n=Math.pow(2,t),r=`level${t}`,i=e.isWebGL2?vF(r,e,"image-int32","alpha","int","nearest"):vF(r,e,"image-uint8","rgba","ubyte","nearest");i.define(n,n);let o=function Slt(e,t){return t.namedFramebuffers[`${Z1}-${e}`]}(r,e);return o||(o=dge(r,e),i.attachFramebuffer(o,0)),{texture:i,framebuffer:o}}function dge(e,t){const n=`${Z1}-${e}`;return t.namedFramebuffers[n]||(t.namedFramebuffers[n]=t.resources.framebuffer()),t.namedFramebuffers[n]}function vF(e,t,n,r,i,o){const s=`${Z1}-${e}`;return t.namedTextures[s]||(t.namedTextures[s]=t.resources.texture(n,r,i,o)),t.namedTextures[s]}function Clt(e,t,n,r){It&&e.timer.mark("createHistogramPyramid");const{gl:i,state:o}=e,s=t.getWidth();if(s!==t.getHeight()||!d3(s))throw new Error("inputTexture must be of square power-of-two size");const l=Math.ceil(Math.log(s)/Math.log(2)),c=Math.pow(2,l),u=Math.pow(2,l),d=Math.pow(2,l-1),f=e.isWebGL2?vF("pyramid",e,"image-int32","alpha","int","nearest"):vF("pyramid",e,"image-uint8","rgba","ubyte","nearest");f.define(u,d);const p=dge("pyramid",e);f.attachFramebuffer(p,0),o.viewport(0,0,u,d),Cn(i)?i.clearBufferiv(i.COLOR,0,[0,0,0,0]):i.clear(i.COLOR_BUFFER_BIT);const m=[];for(let x=0;x0&&(O.update(h.values.tPreviousLevel,m[l-x].texture),h.update()),o.currentRenderItemId=-1,o.viewport(0,0,A,A),o.scissor(0,0,A,A),Cn(i)?i.clearBufferiv(i.COLOR,0,[0,0,0,0]):i.clear(i.COLOR_BUFFER_BIT),o.scissor(0,0,r[0],r[1]),h.render(),f.bind(0),i.copyTexSubImage2D(i.TEXTURE_2D,0,g,0,0,0,A,A),f.unbind(0),g+=A}i.finish(),It&&e.timer.markEnd("createHistogramPyramid");const y=Math.max(1,function mlt(e,t){It&&e.timer.mark("getHistopyramidSum");const{gl:n,state:r,resources:i}=e,o=function flt(e,t){return e.namedComputeRenderables[zp]?(O.update(e.namedComputeRenderables[zp].values.tTexture,t),e.namedComputeRenderables[zp].update()):e.namedComputeRenderables[zp]=function plt(e,t){const n={...ua,tTexture:O.create(t)},r={...dlt};return ys(ms(e,"triangles",Wi("sum",hl,ult,{},{0:"ivec4"}),r,n),n)}(e,t),e.namedComputeRenderables[zp]}(e,t);e.state.currentRenderItemId=-1,e.namedFramebuffers[zp]||(e.namedFramebuffers[zp]=i.framebuffer());const s=e.namedFramebuffers[zp];return e.namedTextures[zp]||(e.namedTextures[zp]=Cn(n)?i.texture("image-int32","rgba","int","nearest"):i.texture("image-uint8","rgba","ubyte","nearest"),e.namedTextures[zp].define(1,1)),e.namedTextures[zp].attachFramebuffer(s,0),function hlt(e){const{gl:t,state:n}=e;n.disable(t.CULL_FACE),n.disable(t.BLEND),n.disable(t.DEPTH_TEST),n.disable(t.SCISSOR_TEST),n.depthMask(!1),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0)}(e),r.viewport(0,0,1,1),o.render(),n.finish(),e.readPixels(0,0,1,1,Cn(n)?uge:bF),e.unbindFramebuffer(),It&&e.timer.markEnd("getHistopyramidSum"),Cn(n)?uge[0]:H9(bF[0],bF[1],bF[2])}(e,m[0].texture));return{pyramidTex:f,count:y,height:Math.ceil(y/Math.pow(2,l)),levels:l,scale:n}}let xP,_P;function wlt(){if(void 0!==xP)return xP;xP=Sa(256,1,Uint8Array);const{array:e}=xP;for(let t=0,n=gA.length;tVi(t.grid.cells.data.length,1,1,()=>Gu),getLoci:KG,eachLocation:ZG,setUpdateState:(t,n,r,i)=>{mt.IsoValue.areSame(r.isoValue,i.isoValue,n.grid.stats)||(t.createGeometry=!0)},geometryUtils:iu.Utils,mustRecreate:(t,n,r)=>!n.tryUseGpu||!r||!XG(t.volume,r),dispose:t=>{t.vertexTexture.ref.value.destroy(),t.groupTexture.ref.value.destroy(),t.normalTexture.ref.value.destroy(),t.doubleBuffer.destroy()}},e)}(e):function zlt(e){return H_({defaultProps:I.getDefaultValues(JG),createGeometry:Ult,createLocationIterator:t=>Vi(t.grid.cells.data.length,1,1,()=>Gu),getLoci:KG,eachLocation:ZG,setUpdateState:(t,n,r,i)=>{mt.IsoValue.areSame(r.isoValue,i.isoValue,n.grid.stats)||(t.createGeometry=!0)},geometryUtils:on.Utils,mustRecreate:(t,n,r)=>n.tryUseGpu&&!!r&&XG(t.volume,r)},e)}(e)}function pge(e,t){return mt.Isosurface.Loci(e,t.isoValue)}function KG(e,t,n,r,i){const{objectId:o,groupId:s}=e;if(i===o){const a=mt.PickingGranularity.get(t);return"volume"===a?mt.Loci(t):"object"===a?mt.Isosurface.Loci(t,r.isoValue):mt.Cell.Loci(t,Pe.ofSingleton(s))}return qr}function ZG(e,t,n,r,i){return eF(e,t,{isoValue:r.isoValue},i)}function Ult(e,t,n,r,i,o){return QG.apply(this,arguments)}function QG(){return QG=le(function*(e,t,n,r,i,o){e.runtime.update({message:"Marching cubes..."});const s=Sd(new Int32Array(t.grid.cells.data.length)),a=yield yA({isoLevel:mt.IsoValue.toAbsolute(i.isoValue,t.grid.stats).absoluteValue,scalarField:t.grid.cells,idField:mr.create(t.grid.cells.space,mr.Data1(s))},o).runAsChild(e.runtime),l=Ca.getGridToCartesianTransform(t.grid);return on.transform(a,l),e.webgl&&!e.webgl.isWebGL2?(on.uniformTriangleGroup(a,!1),O.updateIfChanged(a.varyingGroup,!1)):O.updateIfChanged(a.varyingGroup,!0),a.setBoundingSphere(mt.Isosurface.getBoundingSphere(t,i.isoValue)),a}),QG.apply(this,arguments)}const JG={...on.Params,...iu.Params,...fge,quality:{...on.Params.quality,isEssential:!1},tryUseGpu:I.Boolean(!0)};var eq;function Vlt(e,t,n,r,i,o){return tq.apply(this,arguments)}function tq(){return tq=le(function*(e,t,n,r,i,o){if(!e.webgl)throw new Error("webgl context required to create volume isosurface texture-mesh");if(t.grid.cells.data.length<=1)return iu.createEmpty(o);const{max:s,min:a}=t.grid.stats,l=s-a,c=mt.IsoValue.toAbsolute(i.isoValue,t.grid.stats).absoluteValue,u=(c-a)/l,{texture:d,gridDimension:f,gridTexDim:p,gridTexScale:m,transform:h}=eq.get(t,e.webgl),g=t.grid.cells.space.axisOrderSlowToFast,y=o?.doubleBuffer.get(),v=xF(e.webgl,d,f,p,m,h,u,c<0,!1,g,!0,y?.vertex,y?.group,y?.normal),x=t.grid.cells.data.length,_=mt.getBoundingSphere(t),w=iu.create(v.vertexCount,x,v.vertexTexture,v.groupTexture,v.normalTexture,_,o);return w.meta.webgl=e.webgl,w}),tq.apply(this,arguments)}function Glt(e,t,n,r,i,o){return nq.apply(this,arguments)}function nq(){return nq=le(function*(e,t,n,r,i,o){e.runtime.update({message:"Marching cubes..."});const s=Sd(new Int32Array(t.grid.cells.data.length)),a=yield YG({isoLevel:mt.IsoValue.toAbsolute(i.isoValue,t.grid.stats).absoluteValue,scalarField:t.grid.cells,idField:mr.create(t.grid.cells.space,mr.Data1(s))},o).runAsChild(e.runtime),l=Ca.getGridToCartesianTransform(t.grid);return Mo.transform(a,l),a.setBoundingSphere(mt.Isosurface.getBoundingSphere(t,i.isoValue)),a}),nq.apply(this,arguments)}!function(e){const t="volume-isosurface-texture";e.descriptor=hf({name:t}),e.get=function n(r,i){const{resources:o}=i,s=Ca.getGridToCartesianTransform(r.grid),a=C.clone(r.grid.cells.space.dimensions),{width:l,height:c,powerOfTwoSize:u}=W1(a,SP),d=C.create(l,c,0),f=Ue.create(l/u,c/u);if(u>i.maxTextureSize/2)throw new Error("volume too large for gpu isosurface extraction");if(!r._propertyData[t]){r._propertyData[t]=o.texture("image-uint8","alpha","ubyte","linear");const p=r._propertyData[t];p.define(u,u),p.load(ome(r,"data",SP),!0),r.customProperties.add(e.descriptor),r.customProperties.assets(e.descriptor,[{dispose:()=>p.destroy()}])}return a[0]+=SP,a[1]+=SP,{texture:r._propertyData[t],transform:s,gridDimension:a,gridTexDim:d,gridTexScale:f}}}(eq||(eq={}));const hge={...Mo.Params,...fge,quality:{...Mo.Params.quality,isEssential:!1},sizeFactor:I.Numeric(3,{min:0,max:10,step:.1})};function qlt(e){return H_({defaultProps:I.getDefaultValues(hge),createGeometry:Glt,createLocationIterator:t=>Vi(t.grid.cells.data.length,1,1,()=>Gu),getLoci:KG,eachLocation:ZG,setUpdateState:(t,n,r,i)=>{mt.IsoValue.areSame(r.isoValue,i.isoValue,n.grid.stats)||(t.createGeometry=!0)},geometryUtils:Mo.Utils},e)}const mge={solid:(e,t)=>vP("Isosurface mesh",e,t,jlt,pge),wireframe:(e,t)=>vP("Isosurface wireframe",e,t,qlt,pge)},gge={...JG,...hge,visuals:I.MultiSelect(["solid"],I.objectToOptions(mge)),bumpFrequency:I.Numeric(1,{min:0,max:10,step:.1},xt.ShadingCategory)},Ylt={name:"isosurface",label:"Isosurface",description:"Displays a triangulated isosurface of volumetric data.",factory:function $lt(e,t){return Xn.createMulti("Isosurface",e,t,Xn.StateBuilder,mge)},getParams:function Wlt(e,t){const n=I.clone(gge);return n.isoValue=mt.createIsoValueParam(mt.IsoValue.relative(2),t.grid.stats),n},defaultValues:I.getDefaultValues(gge),defaultColorTheme:{name:"uniform"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>!mt.isEmpty(e)&&!mt.Segmentation.get(e)};function Xlt(e,t,n,r,i,o){return rq.apply(this,arguments)}function rq(){return rq=le(function*(e,t,n,r,i,o){const{dimension:{name:s},isoValue:a}=i,{space:l,data:c}=t.grid.cells,{min:u,max:d}=t.grid.stats,f=mt.IsoValue.toAbsolute(a,t.grid.stats).absoluteValue,p="color"in r.color?r.color.color(Gu,!1):st(16777215),[m,h,g]=st.toRgbNormalized(p),{width:y,height:v,x,y:_,z:w,x0:A,y0:M,z0:E,nx:D,ny:T,nz:F}=iq(t.grid,i),R=new Float32Array("x"===s?[x,0,0,x,_,0,x,0,w,x,_,w]:"y"===s?[0,_,0,x,_,0,0,_,w,x,_,w]:[0,0,w,0,_,w,x,0,w,x,_,w]),N=new Uint8Array(y*v*4),j=function Klt(e,t){const{space:n}=e.cells,{width:r,height:i,x0:o,y0:s,z0:a,nx:l,ny:c,nz:u}=iq(e,t),d=new Uint8Array(r*i*4);let f=0;for(let p=s;p=f?255:0,W+=4}const z={width:y,height:v,array:N,flipY:!0},$={width:y,height:v,array:j,flipY:!0};return w_(Ca.getGridToCartesianTransform(t.grid),R,0,4),Py.create(z,R,$,o)}),rq.apply(this,arguments)}function iq(e,t){const{dimension:{name:n,params:r}}=t,{space:i}=e.cells;let o,s,a,l,c,u=0,d=0,f=0,[p,m,h]=i.dimensions;return"x"===n?(a=r,l=m-1,c=h-1,o=h,s=m,u=a,p=u+1):"y"===n?(a=p-1,l=r,c=h-1,o=h,s=p,d=l,m=d+1):(a=p-1,l=m-1,c=r,o=p,s=m,f=c,h=f+1),{width:o,height:s,x:a,y:l,z:c,x0:u,y0:d,z0:f,nx:p,ny:m,nz:h}}function yge(e,t){const n=function Zlt(e,t){const{space:n}=e.cells,{width:r,height:i,x0:o,y0:s,z0:a,nx:l,ny:c,nz:u}=iq(e,t),d=new Uint32Array(r*i);let f=0;for(let p=s;pVi(t.grid.cells.data.length,1,1,()=>Gu),getLoci:Qlt,eachLocation:Jlt,setUpdateState:(t,n,r,i,o,s)=>{t.createGeometry=r.dimension.name!==i.dimension.name||r.dimension.params!==i.dimension.params||!mt.IsoValue.areSame(r.isoValue,i.isoValue,n.grid.stats)||!Rd.areEqual(o.color,s.color)},geometryUtils:{...Py.Utils,createRenderableState:t=>{const n=Py.Utils.createRenderableState(t);return bge(n,t),n},updateRenderableState:bge}},e)}function bge(e,t){Py.Utils.updateRenderableState(e,t),e.opaque=!1,e.writeDepth=!0}const rct={name:"slice",label:"Slice",description:"Slice of volume rendered as image with interpolation.",factory:function nct(e,t){return vP("Slice",e,t,tct,yge)},getParams:function ect(e,t){const n=I.clone(oq),r=t.grid.cells.space.dimensions;return n.dimension=I.MappedStatic("x",{x:I.Numeric(0,{min:0,max:r[0]-1,step:1}),y:I.Numeric(0,{min:0,max:r[1]-1,step:1}),z:I.Numeric(0,{min:0,max:r[2]-1,step:1})},{isEssential:!0}),n.isoValue=mt.createIsoValueParam(mt.IsoValue.absolute(t.grid.stats.min),t.grid.stats),n},defaultValues:I.getDefaultValues(oq),defaultColorTheme:{name:"uniform"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>!mt.isEmpty(e)&&!mt.Segmentation.get(e)};function vge(e,t){const n=Gt();return Gt.add(n,e),Gt.transform(n,n,t),n}function xge(e){if("matrix"===e.transform.kind)return{unitToCartn:fe.mul(fe(),e.transform.matrix,fe.fromScaling(fe(),e.cells.space.dimensions)),cellDim:fe.getScaling(C(),e.transform.matrix)};const t=e.transform.fractionalBox,n=Gt.size(C(),t);return{unitToCartn:fe.mul3(fe(),e.transform.cell.fromFractional,fe.fromTranslation(fe(),t.min),fe.fromScaling(fe(),n)),cellDim:C.div(C(),e.transform.cell.size,e.cells.space.dimensions)}}function sct(e,t,n,r,i,o){return sq.apply(this,arguments)}function sq(){return sq=le(function*(e,t,n,r,i,o){const{webgl:a}=e;if(void 0===a)throw new Error("DirectVolumeVisual requires `webgl` in props");return a.isWebGL2?function oct(e,t,n,r){const i=n.grid.cells.space.dimensions;if(Math.max(...i)>t.max3dTextureSize/2)throw new Error("volume too large for direct-volume rendering");const o=function Xit(e){const{cells:{space:t,data:n},stats:{max:r,min:i}}=e.grid,[o,s,a]=t.dimensions,{dataOffset:l}=t,c=new Uint8Array(o*s*a*4),u={array:c,width:o,height:s,depth:a},d=r-i,f=C(),p=C(),m=o-1,h=s-1,g=a-1;let y=0;for(let v=0;vt.maxTextureSize/2)throw new Error("volume too large for direct-volume rendering");const a=ome(n,"normals"),l=Ca.getGridToCartesianTransform(n.grid),c=vge(i,l),u=r?r.gridTexture.ref.value:t.resources.texture("image-uint8","rgba","ubyte","linear");u.load(a);const{unitToCartn:d,cellDim:f}=xge(n.grid);return Df.create(c,i,l,d,f,u,n.grid.stats,!1,n.grid.cells.space.axisOrderSlowToFast,r)}(0,a,t,o)}),sq.apply(this,arguments)}function act(e,t){return mt.Loci(e)}function lct(e,t,n,r,i){const{objectId:o,groupId:s}=e;return i===o?mt.Cell.Loci(t,Pe.ofSingleton(s)):qr}function cct(e,t,n,r,i){return eF(e,t,void 0,i)}const aq={...Df.Params,quality:{...Df.Params.quality,isEssential:!1}};function dct(e){return H_({defaultProps:I.getDefaultValues(aq),createGeometry:sct,createLocationIterator:t=>Vi(t.grid.cells.data.length,1,1,()=>Gu),getLoci:lct,eachLocation:cct,setUpdateState:(t,n,r,i)=>{},geometryUtils:Df.Utils,dispose:t=>{t.gridTexture.ref.value.destroy()}},e)}const pct={name:"direct-volume",label:"Direct Volume",description:"Direct rendering of volumetric data.",factory:function fct(e,t){return vP("Direct Volume",e,t,dct,act)},getParams:function uct(e,t){const n=I.clone(aq);return n.controlPoints.getVolume=()=>t,n},defaultValues:I.getDefaultValues(aq),defaultColorTheme:{name:"volume-value"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>!mt.isEmpty(e)&&!mt.Segmentation.get(e)},hct={segments:I.Converted(e=>e.map(t=>`${t}`),e=>e.map(t=>parseInt(t)),I.MultiSelect(["0"],I.arrayToOptions(["0"]),{isEssential:!0}))},CP=1;function lq(e,t){if(e.grid.cells.data.length{const r=mt.Segment.Location(t,n);return Vi(t.grid.cells.data.length,1,1,()=>r)},getLoci:Sge,eachLocation:Cge,setUpdateState:(t,n,r,i)=>{},geometryUtils:iu.Utils,mustRecreate:(t,n,r)=>!n.tryUseGpu||!r||!lq(t.volume,r),dispose:t=>{t.vertexTexture.ref.value.destroy(),t.groupTexture.ref.value.destroy(),t.normalTexture.ref.value.destroy(),t.doubleBuffer.destroy()}},e)}(e):function _ct(e){return H_({defaultProps:I.getDefaultValues(uq),createGeometry:xct,createLocationIterator:(t,n)=>{const r=mt.Segment.Location(t,n);return Vi(t.grid.cells.data.length,1,1,()=>r)},getLoci:Sge,eachLocation:Cge,setUpdateState:(t,n,r,i)=>{},geometryUtils:on.Utils,mustRecreate:(t,n,r)=>n.tryUseGpu&&!!r&&lq(t.volume,r)},e)}(e)}function bct(e,t){return mt.Segment.Loci(e,t.segments)}function Sge(e,t,n,r,i){const{objectId:o,groupId:s}=e;if(i===o){const a=mt.PickingGranularity.get(t);return"volume"===a?mt.Loci(t):"object"===a?mt.Segment.Loci(t,[n]):mt.Cell.Loci(t,Pe.ofSingleton(s))}return qr}function Cge(e,t,n,r,i){return eF(e,t,{segments:rt.ofSingleton(n)},i)}function xct(e,t,n,r,i,o){return cq.apply(this,arguments)}function cq(){return cq=le(function*(e,t,n,r,i,o){const s=mt.Segmentation.get(t);if(!s)throw new Error("missing volume segmentation");e.runtime.update({message:"Marching cubes..."});const a=Gt.clone(s.bounds[n]);Gt.expand(a,a,C.create(2,2,2));const c=function vct(e,t,n){const r=n.data,i=n.space.dataOffset,o=Gt.size(C(),t),[s,a,l]=o,c=s-1,u=a-1,d=l-1,[f,p,m]=t.min,[h,g,y]=t.max,v=[...n.space.axisOrderSlowToFast],x=mr.Space(o,v,Uint8Array),_=mr.create(x,x.create()),w=_.data,A=x.set;for(let M=0;Mn.maxTextureSize/2)throw new Error("volume too large for gpu segment extraction");n.namedTextures[dq]||(n.namedTextures[dq]=i.texture("image-uint8","alpha","ubyte","linear"));const p=n.namedTextures[dq];p.define(u,u);const m=Array.from(r.segments.get(t).values());return p.load(function Kit(e,t,n,r=0){const i=e.grid.cells.data,o=Gt.size(C(),n),s=e.grid.cells.space.dataOffset,{width:a,height:l}=W1(o,r),u=new Uint8Array(a*l*1),d={array:u,width:a,height:l},[f,p,m]=o,h=f-1,g=p-1,y=m-1,v=f+r,x=p+r,[_,w,A]=n.min,[M,E,D]=n.max;for(let T=0;TvP("Segment mesh",e,t,yct,bct,Act)},Age={...uq,visuals:I.MultiSelect(["segment"],I.objectToOptions(wge)),bumpFrequency:I.Numeric(1,{min:0,max:10,step:.1},xt.ShadingCategory)},Tct={name:"segment",label:"Segment",description:"Displays a triangulated segment of volumetric data.",factory:function Ect(e,t){return Xn.createMulti("Segment",e,t,Xn.StateBuilder,wge)},getParams:function Ict(e,t){const n=I.clone(Age),r=mt.Segmentation.get(t);if(r){const i=Array.from(r.segments.keys());n.segments=I.Converted(o=>o.map(s=>`${s}`),o=>o.map(s=>parseInt(s)),I.MultiSelect(i.map(o=>`${o}`),I.arrayToOptions(i.map(o=>`${o}`)),{isEssential:!0}))}return n},defaultValues:I.getDefaultValues(Age),defaultColorTheme:{name:"volume-segment"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>!mt.isEmpty(e)&&!!mt.Segmentation.get(e)};class bA extends ume{constructor(){super(),Nu(bA.BuiltIn,(t,n)=>{if(t.name!==n)throw new Error(`Fix BuiltInVolumeRepresentations to have matching names. ${t.name} ${n}`);this.add(t)})}}function Ige(e,t,n,r){e.push({source:"em"===t?{name:"em",params:{isoValue:mt.IsoValue.absolute(r||0)}}:{name:"x-ray",params:{}},dataId:n})}!function(e){e.BuiltIn={isosurface:Ylt,slice:rct,"direct-volume":pct,segment:Tct}}(bA||(bA={}));const pq=Hu.build({display:{name:"Volume Streaming"},from:Se.Molecule.Structure,params(e,t){const n=function zat(e,t="x-ray"){if(!e)return t;const n=e.models[0];return Ui.is(n.sourceData)?Sn.hasEmMap(n)?"em":Sn.hasXrayMap(n)?"x-ray":Sn.isFromEm(n)?"em":Sn.isFromXray(n)?"x-ray":t:t}(e&&e.data),r=function Gat(e,t){if(!t||!t.models.length)return[];const n=t.models[0];switch(e){case"em":return function Vat(e){const t=[];if(!Ui.is(e.sourceData))return[e.entryId];const{db_id:n,db_name:r,content_type:i}=e.sourceData.data.db.pdbx_database_related;if(!r.isDefined)return[e.entryId];for(let o=0,s=r.rowCount;oi,{defaultValue:r.map(i=>({id:i}))}),defaultView:I.Select("em"===n?"auto":"selection-box",fu.ViewTypeOptions),options:I.Group({serverUrl:I.Text(t.config.get(ei.VolumeStreaming.DefaultServer)||"https://ds.litemol.org"),behaviorRef:I.Text("",{isHidden:!0}),emContourProvider:I.Select("emdb",[["emdb","EMDB"],["pdbe","PDBe"]],{isHidden:!0}),channelParams:I.Value({},{isHidden:!0})})}},isApplicable:(e,t,n)=>{const r=n.config.get(ei.VolumeStreaming.CanStream);return r?r(e.data,n):1===e.data.models.length&&Sn.probablyHasDensityMap(e.data.models[0])}})(({ref:e,state:t,params:n},r)=>Ke.create("Volume Streaming",function(){var i=le(function*(o){const s=[];for(let f=0,p=n.entries.length;f0&&(yield r.managers.structure.hierarchy.remove(c?.toArray()));const u=l.cell.obj,d=t.build().to(a.ref).apply(hq,I.getDefaultValues(fu.createParams({data:u.data,defaultView:n.defaultView,channelParams:n.options.channelParams})),{ref:n.options.behaviorRef?n.options.behaviorRef:void 0});"em"===n.method?d.apply(_F,{channel:"em"},{state:{isGhost:!0},tags:"em"}):(d.apply(_F,{channel:"2fo-fc"},{state:{isGhost:!0},tags:"2fo-fc"}),d.apply(_F,{channel:"fo-fc(+ve)"},{state:{isGhost:!0},tags:"fo-fc(+ve)"}),d.apply(_F,{channel:"fo-fc(-ve)"},{state:{isGhost:!0},tags:"fo-fc(-ve)"})),yield t.updateTree(d).runInContext(o)});return function(o){return i.apply(this,arguments)}}())),Dct=Hu.build({display:{name:"Boxify Volume Streaming",description:"Make the current box permanent."},from:fu,isApplicable:e=>"selection-box"===e.data.params.entry.params.view.name})(({a:e,ref:t,state:n},r)=>{const i=e.data.params;if("selection-box"!==i.entry.params.view.name)return;const o=Gt.create(C.clone(i.entry.params.view.params.bottomLeft),C.clone(i.entry.params.view.params.topRight)),s=i.entry.params.view.params.radius;Gt.expand(o,o,C.create(s,s,s));const a={...i,entry:{name:i.entry.name,params:{...i.entry.params,view:{name:"box",params:{bottomLeft:o.min,topRight:o.max}}}}};return n.updateTree(n.build().to(t).update(a))}),Pct={dataId:I.Text(""),source:I.MappedStatic("x-ray",{em:I.Group({isoValue:mt.createIsoValueParam(mt.IsoValue.relative(1))}),"x-ray":I.Group({})})},kct=nn.BuiltIn({name:"create-volume-streaming-info",display:{name:"Volume Streaming Info"},from:Se.Molecule.Structure,to:zG,params:e=>({serverUrl:I.Text("https://ds.litemol.org"),entries:I.ObjectList(Pct,({dataId:t})=>t,{defaultValue:[{dataId:"",source:{name:"x-ray",params:{}}}]})})})({apply:({a:e,params:t},n)=>Ke.create("",function(){var r=le(function*(i){const o=[];for(let a=0,l=t.entries.length;aa.dataId).join(", ")}`})});return function(i){return r.apply(this,arguments)}}())}),hq=nn.BuiltIn({name:"create-volume-streaming-behavior",display:{name:"Volume Streaming Behavior"},from:zG,to:fu,params:e=>fu.createParams({data:e&&e.data})})({canAutoUpdate:({oldParams:e,newParams:t})=>e.entry.params.view===t.entry.params.view||"selection-box"===t.entry.params.view.name||"camera-target"===t.entry.params.view.name||"off"===t.entry.params.view.name,apply:({a:e,params:t},n)=>Ke.create("Volume streaming",function(){var r=le(function*(i){const o=new fu.Behavior(n,e.data);return yield o.update(t),new fu(o,{label:"Volume Streaming",description:o.getDescription()})});return function(i){return r.apply(this,arguments)}}()),update:({b:t,oldParams:n,newParams:r})=>Ke.create("Update Volume Streaming",function(){var i=le(function*(o){if(n.entry.name!==r.entry.name&&"em"in r.entry.params.channels){const{emDefaultContourLevel:a}=t.data.infoMap.get(r.entry.name);a&&(r.entry.params.channels.em.isoValue=a)}const s=(yield t.data.update(r))?yt.UpdateResult.Updated:yt.UpdateResult.Unchanged;return t.description=t.data.getDescription(),s});return function(o){return i.apply(this,arguments)}}())}),_F=nn.BuiltIn({name:"create-volume-streaming-visual",display:{name:"Volume Streaming Visual"},from:fu,to:Se.Volume.Representation3D,params:{channel:I.Select("em",fu.ChannelTypeOptions,{isHidden:!0})}})({apply:({a:e,params:t,spine:n},r)=>Ke.create("Volume Representation",function(){var i=le(function*(o){var s,a;const l=e.data.channels[t.channel];if(!l)return vo.Null;const c=Ege(e.data,t.channel),u=bA.BuiltIn.isosurface,d=c.type.params||{},f=u.factory({webgl:null===(s=r.canvas3d)||void 0===s?void 0:s.webgl,...r.representation.volume.themes},u.getParams);f.setTheme(Ia.create(r.representation.volume.themes,{volume:l.data},c));const p=null===(a=n.getAncestorOfType(Se.Molecule.Structure))||void 0===a?void 0:a.data,m=0===p?.models.length?void 0:s_.get(p?.models[0]);return yield f.createOrUpdate(d,l.data).runInContext(o),m&&f.setState({transform:m}),new Se.Volume.Representation3D({repr:f,sourceData:l.data},{label:`${Math.round(100*l.isoValue.relativeValue)/100} \u03c3 [${t.channel}]`})});return function(o){return i.apply(this,arguments)}}()),update:({a:e,b:t,newParams:n},i)=>Ke.create("Volume Representation",function(){var o=le(function*(s){const a=e.data.channels[n.channel];if(!a)return yt.UpdateResult.Unchanged;const l=t.data.repr.state.visible,c=Ege(e.data,n.channel),u={...t.data.repr.props,...c.type.params};return t.data.repr.setTheme(Ia.create(i.representation.volume.themes,{volume:a.data},c)),yield t.data.repr.createOrUpdate(u,a.data).runInContext(s),t.data.repr.setState({visible:l}),t.data.sourceData=a.data,yt.UpdateResult.Updated});return function(s){return o.apply(this,arguments)}}())});function Ege(e,t){const n=e.channels[t];return Eg.getDefaultParamsStatic(e.plugin,"isosurface",{isoValue:n.isoValue,alpha:n.opacity,visuals:n.wireframe?["wireframe"]:["solid"]},"uniform",{value:n.color})}var Uy;!function(e){e.create=function t(r){return r},e.getDuration=function n(r,i){var o,s;if(i.customDurationMs)return i.customDurationMs;const a=null===(s=(o=i.definition).getDuration)||void 0===s?void 0:s.call(o,i.params,r);return"fixed"===a?.kind?a.durationMs:void 0}}(Uy||(Uy={}));const Mct=Uy.create({name:"built-in.animate-assembly-unwind",display:{name:"Unwind Assembly"},isExportable:!0,params:e=>{const t=[["all","All"]],n=e.state.data.select(Qn.Generators.rootsOfType(Se.Molecule.Structure));for(const r of n)t.push([r.transform.ref,r.obj.data.models[0].label]);return{durationInMs:I.Numeric(3e3,{min:100,max:1e4,step:100}),playOnce:I.Boolean(!1),target:I.Select(t[0][0],t)}},canApply:e=>({canApply:e.state.data.select(Qn.Generators.ofType(Se.Molecule.Structure.Representation3D,vr.RootRef)).length>0}),getDuration:e=>({kind:"fixed",durationMs:e.durationInMs}),initialState:()=>({t:0}),setup(e,t,n){const r=n.state.data,o=r.select(Qn.Generators.ofType(Se.Molecule.Structure.Representation3D,e.target&&"all"!==e.target?e.target:vr.RootRef)),s=r.build();let a=!1;for(const l of o)r.select(Qn.Generators.ofTransformer(at.Representation.UnwindStructureAssemblyRepresentation3D,l.transform.ref)).length>0||(a=!0,s.to(l).apply(at.Representation.UnwindStructureAssemblyRepresentation3D,{t:0},{tags:"animate-assembly-unwind"}));if(a)return s.commit({doNotUpdateCurrent:!0})},teardown(e,t,n){const r=n.state.data,i=r.select(Qn.Generators.ofType(Se.Molecule.Structure.Representation3DState).withTag("animate-assembly-unwind"));if(0===i.length)return;const o=r.build();for(const s of i)o.delete(s.transform.ref);return o.commit()},apply:(e,t,n)=>le(function*(){const r=n.plugin.state.data,o=r.select(Qn.Generators.ofTransformer(at.Representation.UnwindStructureAssemblyRepresentation3D,n.params.target&&"all"!==n.params.target?n.params.target:vr.RootRef));if(0===o.length)return{kind:"finished"};const s=r.build();let l=e.t+(t.current-t.lastApplied)/n.params.durationInMs,c=!1;n.params.playOnce&&l>=1?(c=!0,l=1):l%=1;for(const u of o)s.to(u).update({t:l});return yield jt.State.Update(n.plugin,{state:r,tree:s,options:{doNotLogTiming:!0}}),c?{kind:"finished"}:{kind:"next",state:{t:l}}})()}),SF=C(),Tge=C(),Dge=Ai(),Rct=Uy.create({name:"built-in.animate-camera-spin",display:{name:"Camera Spin",description:"Spin the 3D scene around the x-axis in view space"},isExportable:!0,params:()=>({durationInMs:I.Numeric(4e3,{min:100,max:2e4,step:100}),speed:I.Numeric(1,{min:1,max:10,step:1},{description:"How many times to spin in the specified duration."}),direction:I.Select("cw",[["cw","Clockwise"],["ccw","Counter Clockwise"]],{cycle:!0})}),initialState:(e,t)=>{var n;return{snapshot:null===(n=t.canvas3d)||void 0===n?void 0:n.camera.getSnapshot()}},getDuration:e=>({kind:"fixed",durationMs:e.durationInMs}),teardown:(e,t,n)=>{var r;null===(r=n.canvas3d)||void 0===r||r.requestCameraReset({snapshot:t.snapshot,durationMs:0})},apply:(e,t,n)=>le(function*(){var r,i;if(0===t.current)return{kind:"next",state:e};const o=e.snapshot;if(o.radiusMax<1e-4)return{kind:"finished"};const s=t.animation?(null===(r=t.animation)||void 0===r?void 0:r.currentFrame)/(t.animation.frameCount+1):al(t.current/n.params.durationInMs,0,1),a=2*Math.PI*s*n.params.speed*("ccw"===n.params.direction?-1:1);C.sub(SF,o.position,o.target),C.normalize(Tge,o.up),Ai.setAxisAngle(Dge,Tge,a),C.transformQuat(SF,SF,Dge);const l=C.add(C(),o.target,SF);return null===(i=n.plugin.canvas3d)||void 0===i||i.requestCameraReset({snapshot:{...o,position:l},durationMs:0}),s>=.99999?{kind:"finished"}:{kind:"next",state:e}})()}),Nct=Uy.create({name:"built-in.animate-model-index",display:{name:"Animate Trajectory"},isExportable:!0,params:()=>({mode:I.MappedStatic("loop",{palindrome:I.Group({}),loop:I.Group({direction:I.Select("forward",[["forward","Forward"],["backward","Backward"]])}),once:I.Group({direction:I.Select("forward",[["forward","Forward"],["backward","Backward"]])},{isFlat:!0})},{options:[["palindrome","Palindrome"],["loop","Loop"],["once","Once"]]}),duration:I.MappedStatic("fixed",{fixed:I.Group({durationInS:I.Numeric(5,{min:1,max:120,step:.1},{description:"Duration in seconds"})},{isFlat:!0}),computed:I.Group({targetFps:I.Numeric(30,{min:5,max:250,step:1},{label:"Target FPS"})},{isFlat:!0}),sequential:I.Group({maxFps:I.Numeric(30,{min:5,max:60,step:1})},{isFlat:!0})})}),canApply(e){const t=e.state.data,n=t.select(Qn.Generators.ofTransformer(at.Model.ModelFromTrajectory));for(const r of n){const i=Qn.findAncestorOfType(t.tree,t.cells,r.transform.ref,Se.Molecule.Trajectory);if(i&&i.obj&&i.obj.data.frameCount>1)return{canApply:!0}}return{canApply:!1,reason:"No trajectory to animate"}},getDuration:(e,t)=>{var n;if("fixed"===(null===(n=e.duration)||void 0===n?void 0:n.name))return{kind:"fixed",durationMs:1e3*e.duration.params.durationInS};if("computed"===e.duration.name){const r=t.state.data,i=r.select(Qn.Generators.ofTransformer(at.Model.ModelFromTrajectory));let o=0;for(const s of i){const a=Qn.findAncestorOfType(r.tree,r.cells,s.transform.ref,Se.Molecule.Trajectory);a&&a.obj&&(o=Math.max(Math.ceil(1e3*a.obj.data.frameCount/e.duration.params.targetFps),o))}return{kind:"fixed",durationMs:o}}return{kind:"unknown"}},initialState:()=>({}),apply:(e,t,n)=>le(function*(){if("sequential"===n.params.duration.name&&t.current>0&&t.current-t.lastApplied<1e3/n.params.duration.params.maxFps)return{kind:"skip"};const r=n.plugin.state.data,i=r.select(Qn.Generators.ofTransformer(at.Model.ModelFromTrajectory));if(0===i.length)return{kind:"finished"};const o=r.build(),s=n.params,a=e.palindromeDirections||{};let l=!1,c=!0;for(const u of i){const d=Qn.findAncestorOfType(r.tree,r.cells,u.transform.ref,Se.Molecule.Trajectory);if(!d||!d.obj)continue;const f=d.obj;f.data.frameCount<=1||o.to(u).update(p=>{const m=f.data.frameCount;if(1===m)return p;if(c=!1,"sequential"===s.duration.name){let h=1;if("once"===s.mode.name){if(h="backward"===s.mode.params.direction?-1:1,-1===h&&0===p.modelIndex||1===h&&p.modelIndex===m-1)return l=!0,p}else"palindrome"===s.mode.name&&(h=0===p.modelIndex?1:p.modelIndex===m-1?-1:a[u.transform.ref]||1);a[u.transform.ref]=h;let g=(p.modelIndex+h)%m;return g<0&&(g+=m),l=l||-1===h&&0===g||1===h&&g===m-1,{modelIndex:g}}{const h="fixed"===s.duration.name?1e3*s.duration.params.durationInS:Math.ceil(1e3*f.data.frameCount/s.duration.params.targetFps);if("once"===s.mode.name&&t.current>=h)return l=!0,{modelIndex:f.data.frameCount-1};let g=t.current%h/h;return"loop"===s.mode.name&&"backward"===s.mode.params.direction&&(g=1-g),"palindrome"===s.mode.name&&(g*=2,g>1&&(g=2-g)),{modelIndex:Math.min(Math.floor(f.data.frameCount*g),f.data.frameCount-1)}}})}return c||(yield jt.State.Update(n.plugin,{state:r,tree:o,options:{doNotLogTiming:!0}})),c||"once"===s.mode.name&&l?{kind:"finished"}:"palindrome"===s.mode.name?{kind:"next",state:{palindromeDirections:a}}:{kind:"next",state:{}}})()});function Pge(e,t){return mq.apply(this,arguments)}function mq(){return mq=le(function*(e,t,n=!1){var r;t.snapshot.data&&(yield e.runTask(e.state.data.setSnapshot(t.snapshot.data))),t.snapshot.camera&&(null===(r=e.canvas3d)||void 0===r||r.requestCameraReset({snapshot:t.snapshot.camera.current,durationMs:n||"instant"===t.snapshot.camera.transitionStyle?0:t.snapshot.camera.transitionDurationInMs}))}),mq.apply(this,arguments)}const Fct=Uy.create({name:"built-in.animate-state-snapshots",display:{name:"State Snapshots"},isExportable:!0,params:()=>({}),canApply(e){const t=e.managers.snapshot.state.entries;return t.size<2?{canApply:!1,reason:"At least 2 states required."}:t.some(n=>!!n?.snapshot.startAnimation)?{canApply:!1,reason:"Nested animations not supported."}:{canApply:e.managers.snapshot.state.entries.size>1}},setup(e,t,n){const r=n.managers.snapshot.state.entries.get(0);Pge(n,r,!0)},getDuration:(e,t)=>({kind:"fixed",durationMs:t.managers.snapshot.state.entries.toArray().reduce((n,r)=>{var i;return n+(null!==(i=r.snapshot.durationInMs)&&void 0!==i?i:0)},0)}),initialState:(e,t)=>{const n=t.managers.snapshot.state.entries.toArray();return{totalDuration:n.reduce((r,i)=>{var o;return r+(null!==(o=i.snapshot.durationInMs)&&void 0!==o?o:0)},0),snapshots:n,currentIndex:0}},apply:(e,t,n)=>le(function*(){var r;if(t.current>=e.totalDuration)return{kind:"finished"};let i=0,o=0;for(const s of e.snapshots){if(i+=null!==(r=s.snapshot.durationInMs)&&void 0!==r?r:0,t.current=e.snapshots.length?{kind:"finished"}:o===e.currentIndex?{kind:"skip"}:(Pge(n.plugin,e.snapshots[o]),{kind:"next",state:{...e,currentIndex:o}})})()});class wP{constructor(){this.subs=void 0}subscribe(t,n){typeof this.subs>"u"&&(this.subs=[]);let r=t.subscribe(n);return this.subs.push(r),{unsubscribe:()=>{r&&this.subs&&$x(this.subs,r)&&(r.unsubscribe(),r=void 0)}}}get ev(){return this._ev||(this._ev=uy.create())}dispose(){if(this._ev&&this._ev.dispose(),this.subs){for(const t of this.subs)t.unsubscribe();this.subs=void 0}}}class zy extends wP{updateState(...t){const n=this.state,r=function doe(e,t){let n=e;for(let r=0;r{const o=s=>{s?r(s):i("no blob returned")};HTMLCanvasElement.prototype.toBlob?e.toBlob(o,t,n):function jct(e,t,n,r){const i=atob(e.toDataURL(n,r).split(",")[1]),o=i.length,s=o>>2,a=new Uint8Array(o),l=new Uint32Array(a.buffer,0,s);let c=0;for(let d=0;d{class e extends zy{getIndex(n){return this.state.entries.indexOf(n)}getEntry(n){if(n)return this.entryMap.get(n)}remove(n){const r=this.entryMap.get(n);r&&(r?.image&&this.plugin.managers.asset.delete(r.image),this.entryMap.delete(n),this.updateState({current:this.state.current===n?void 0:this.state.current,entries:this.state.entries.delete(this.getIndex(r))}),this.events.changed.next(void 0))}add(n){this.entryMap.set(n.snapshot.id,n),this.updateState({current:n.snapshot.id,entries:this.state.entries.push(n)}),this.events.changed.next(void 0)}replace(n,r,i){var o,s,a;const l=this.getEntry(n);if(!l)return;this.defaultSnapshotId=void 0,l?.image&&this.plugin.managers.asset.delete(l.image);const c=this.getIndex(l),u=e.Entry(r,{key:null!==(o=i?.key)&&void 0!==o?o:l.key,name:null!==(s=i?.name)&&void 0!==s?s:l.name,description:null!==(a=i?.description)&&void 0!==a?a:l.description,image:i?.image});this.entryMap.set(r.id,u),this.updateState({current:u.snapshot.id,entries:this.state.entries.set(c,u)}),this.events.changed.next(void 0)}move(n,r){const i=this.state.entries.size;if(i<2)return;const o=this.getEntry(n);if(!o)return;const s=this.getIndex(o);let a=(s+r)%i;a<0&&(a+=i);const l=this.state.entries.get(a),c=this.state.entries.asMutable();c.set(a,o),c.set(s,l),this.updateState({current:o.snapshot.id,entries:c.asImmutable()}),this.events.changed.next(void 0)}update(n,r){var i,o,s;const a=this.getIndex(n);if(a<0)return;const l=this.state.entries.set(a,{...n,key:(null===(i=r.key)||void 0===i?void 0:i.trim())||void 0,name:(null===(o=r.name)||void 0===o?void 0:o.trim())||void 0,description:(null===(s=r.description)||void 0===s?void 0:s.trim())||void 0});this.updateState({entries:l}),this.entryMap.set(n.snapshot.id,this.state.entries.get(a)),this.events.changed.next(void 0)}clear(){0!==this.state.entries.size&&(this.entryMap.forEach(n=>{n?.image&&this.plugin.managers.asset.delete(n.image)}),this.entryMap.clear(),this.updateState({current:void 0,entries:cy()}),this.events.changed.next(void 0))}applyKey(n){const r=this.state.entries.find(i=>i.key===n);r&&(this.updateState({current:r.snapshot.id}),this.events.changed.next(void 0),this.plugin.state.setSnapshot(r.snapshot))}setCurrent(n){const r=this.getEntry(n);return r&&(this.updateState({current:n}),this.events.changed.next(void 0)),r&&r.snapshot}getNextId(n,r){const i=this.state.entries.size;if(!n){if(0===i)return;return this.state.entries.get(-1===r?i-1:0).snapshot.id}const o=this.getEntry(n);if(!o)return;let s=this.getIndex(o);return s<0?void 0:(s=(s+r)%i,s<0&&(s+=i),this.state.entries.get(s).snapshot.id)}setStateSnapshot(n){var r=this;return le(function*(){r.clear();const i=cy().asMutable();for(const l of n.entries)r.entryMap.set(l.snapshot.id,l),i.push(l);const o=n.current?n.current:n.entries.length>0?n.entries[0].snapshot.id:void 0;if(r.updateState({current:o,entries:i.asImmutable(),isPlaying:!1,nextSnapshotDelayInMs:n.playback?n.playback.nextSnapshotDelayInMs:e.DefaultNextSnapshotDelayInMs}),r.events.changed.next(void 0),!o)return;const s=r.getEntry(o),a=s&&s.snapshot;return a?(yield r.plugin.state.setSnapshot(a),n.playback&&n.playback.isPlaying&&r.play(!0),a):void 0})()}syncCurrent(n){var r=this;return le(function*(){var i,o;const s=0===r.state.entries.size,a=1===r.state.entries.size&&r.state.current&&r.state.current===r.defaultSnapshotId;if(!s&&!a)return;const l=r.plugin.state.getSnapshot(n?.params),c=(null!==(o=null===(i=n?.params)||void 0===i?void 0:i.image)&&void 0!==o?o:r.plugin.state.snapshotParams.value.image)?yield e.getCanvasImageAsset(r.plugin,`${l.id}-image.png`):void 0;if(s)r.add(e.Entry(l,{name:n?.name,description:n?.description,image:c}));else if(a){const u=r.getEntry(r.state.current);u?.image&&r.plugin.managers.asset.delete(u.image),r.replace(r.state.current,l,{image:c})}r.defaultSnapshotId=l.id})()}getStateSnapshot(n){var r=this;return le(function*(){return yield r.syncCurrent(n),{timestamp:+new Date,version:"4.0.1",name:n&&n.name,description:n&&n.description,current:r.state.current,playback:{isPlaying:!(!n||!n.playOnLoad),nextSnapshotDelayInMs:r.state.nextSnapshotDelayInMs},entries:r.state.entries.valueSeq().toArray()}})()}serialize(n){var r=this;return le(function*(){const i=JSON.stringify(yield r.getStateSnapshot({params:n?.params}),null,2);if(!n?.type||"json"===n.type||"molj"===n.type)return new Blob([i],{type:"application/json;charset=utf-8"});{const o=new Uint8Array(o5(i));vw(o,0,i);const s={"state.json":o},a=[];for(const{asset:c,file:u}of r.plugin.managers.asset.assets)a.push([c.id,c]),s[`assets/${c.id}`]=new Uint8Array(yield u.arrayBuffer());if(a.length>0){const c=JSON.stringify(a,null,2),u=new Uint8Array(o5(c));vw(u,0,c),s["assets.json"]=u}const l=yield r.plugin.runTask(function Oze(e,t=!1){return Ke.create("Zip",n=>function Bze(e,t){return i7.apply(this,arguments)}(n,e,t))}(s));return new Blob([l],{type:"application/zip"})}})()}open(n){var r=this;return le(function*(){try{const i=n.name.toLowerCase();if(i.endsWith("json")||i.endsWith("molj")){const o=yield r.plugin.runTask(ry(n,"string")),s=JSON.parse(o);e.isStateSnapshot(s)?yield r.setStateSnapshot(s):e.isStateSnapshot(s.data)?yield r.setStateSnapshot(s.data):yield r.plugin.state.setSnapshot(s)}else{const o=yield r.plugin.runTask(ry(n,"zip")),s=Object.create(null);Nu(o,(u,d)=>{if("state.json"===d||"assets.json"===d)return;const f=d.substring(d.indexOf("/")+1);s[f]=u});const a=new File([o["state.json"]],"state.json"),l=yield r.plugin.runTask(ry(a,"string"));if(o["assets.json"]){const u=new File([o["assets.json"]],"assets.json"),d=JSON.parse(yield r.plugin.runTask(ry(u,"string")));for(const[f,p]of d)r.plugin.managers.asset.set(p,new File([s[f]],p.name))}const c=JSON.parse(l);yield r.setStateSnapshot(c)}r.events.opened.next(void 0)}catch(i){console.error(i),r.plugin.log.error("Error reading state")}})()}play(n=!1){if(this.updateState({isPlaying:!0}),n){const r=this.getEntry(this.state.current);if(!r)return void this.next();this.events.changed.next(void 0);const i=r.snapshot;this.timeoutHandle=setTimeout(this.next,typeof i.durationInMs<"u"?i.durationInMs:this.state.nextSnapshotDelayInMs)}else this.next()}stop(){this.updateState({isPlaying:!1}),typeof this.timeoutHandle<"u"&&clearTimeout(this.timeoutHandle),this.timeoutHandle=void 0,this.events.changed.next(void 0)}togglePlay(){this.state.isPlaying?(this.stop(),this.plugin.managers.animation.stop()):this.play()}dispose(){super.dispose(),this.entryMap.clear()}constructor(n){var r;super({current:void 0,entries:cy(),isPlaying:!1,nextSnapshotDelayInMs:e.DefaultNextSnapshotDelayInMs}),r=this,this.plugin=n,this.entryMap=new Map,this.defaultSnapshotId=void 0,this.events={changed:this.ev(),opened:this.ev()},this.timeoutHandle=void 0,this.next=le(function*(){r.timeoutHandle=void 0;const i=r.getNextId(r.state.current,1);if(!i||i===r.state.current)return void r.stop();const o=r.setCurrent(i);yield r.plugin.state.setSnapshot(o),r.state.isPlaying&&(r.timeoutHandle=setTimeout(r.next,typeof o.durationInMs<"u"?o.durationInMs:r.state.nextSnapshotDelayInMs))})}}return e.DefaultNextSnapshotDelayInMs=1500,e})();function kge(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{const n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(n)}}function Mge(e,t="download"){if(e)if("download"in HTMLAnchorElement.prototype){const n=document.createElement("a");n.download=t,n.rel="noopener","string"==typeof e?(n.href=e,kge(n)):(n.href=URL.createObjectURL(e),setTimeout(()=>URL.revokeObjectURL(n.href),4e4),setTimeout(()=>kge(n)))}else if(typeof navigator<"u"&&navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(e,t);else{const n=window.navigator.userAgent,r=/Safari/i.test(n),i=/CriOS\/[\d]+/.test(n),o=s=>{!function zct(e){window.open(e,"_blank")||(window.location.href=e)}(i?s:s.replace(/^data:[^;]*;/,"data:attachment/file;"))};if((r||i)&&FileReader)if(e instanceof Blob){const s=new FileReader;s.onloadend=()=>o(s.result),s.readAsDataURL(e)}else o(e);else{const s=URL.createObjectURL("string"==typeof e?new Blob([e]):e);location.href=s,setTimeout(()=>URL.revokeObjectURL(s),4e4)}}}function Vct(e){Rge(e),Nge(e),Fge(e),Oge(e),Bge(e),Lge(e),jge(e),Uge(e),zge(e),Vge(e)}function Rge(e){e.state.events.object.created.subscribe(t=>{Se.isBehavior(t.obj)&&t.obj.data.register(t.ref)}),e.state.events.object.removed.subscribe(t=>{var n,r,i,o;Se.isBehavior(t.obj)&&(null===(r=(n=t.obj.data).unregister)||void 0===r||r.call(n),null===(o=(i=t.obj.data).dispose)||void 0===o||o.call(i))}),e.state.events.object.updated.subscribe(t=>{var n,r,i,o;"recreate"===t.action&&(t.oldObj&&Se.isBehavior(t.oldObj)&&(null===(r=(n=t.oldObj.data).unregister)||void 0===r||r.call(n),null===(o=(i=t.oldObj.data).dispose)||void 0===o||o.call(i)),t.obj&&Se.isBehavior(t.obj)&&t.obj.data.register(t.ref))})}function Nge(e){jt.State.SetCurrentObject.subscribe(e,({state:t,ref:n})=>t.setCurrent(n))}function Fge(e){jt.State.Update.subscribe(e,({state:t,tree:n,options:r})=>e.runTask(t.updateTree(n,r)))}function Oge(e){jt.State.ApplyAction.subscribe(e,({state:t,action:n,ref:r})=>e.runTask(t.applyAction(n.action,n.params,r)))}function Bge(e){function t(n,r){const i=n.build().delete(r);return e.runTask(n.updateTree(i))}jt.State.RemoveObject.subscribe(e,({state:n,ref:r,removeParentGhosts:i})=>{if(!i)return t(n,r);{const o=n.tree;let s=o.transforms.get(r);if(s.parent===r)return t(n,r);for(;;){const a=o.children.get(s.parent);if(s.parent===s.ref||a.size>1)return t(n,s.ref);const l=o.transforms.get(s.parent);if(!l.state.isGhost)return t(n,s.ref);s=l}}})}function Lge(e){jt.State.ToggleExpanded.subscribe(e,({state:t,ref:n})=>t.updateCellState(n,({isCollapsed:r})=>({isCollapsed:!r})))}function jge(e){jt.State.ToggleVisibility.subscribe(e,({state:t,ref:n})=>G_(t,n,!t.cells.get(n).state.isHidden))}function G_(e,t,n){la.doPreOrder(e.tree,e.transforms.get(t),{state:e,value:n},Hct)}function Hct(e,t,n){n.state.updateCellState(e.ref,{isHidden:n.value})}function Uge(e){jt.Interactivity.Object.Highlight.subscribe(e,({state:t,ref:n})=>{if(!e.canvas3d||e.isBusy)return;e.managers.interactivity.lociHighlights.clearHighlights();const r="string"==typeof n?[n]:n;for(const i of r){const o=t.cells.get(i);if(o)if(Se.Molecule.Structure.is(o.obj))e.managers.interactivity.lociHighlights.highlight({loci:Xe.Loci(o.obj.data)},!1);else if(o&&Se.isRepresentation3D(o.obj)){const{repr:s}=o.obj.data;for(const a of s.getAllLoci())e.managers.interactivity.lociHighlights.highlight({loci:a,repr:s},!1)}else if(Se.Molecule.Structure.Selections.is(o.obj))for(const s of o.obj.data)e.managers.interactivity.lociHighlights.highlight({loci:s.loci},!1)}})}function zge(e){jt.Interactivity.ClearHighlights.subscribe(e,()=>{e.managers.interactivity.lociHighlights.clearHighlights()})}function Vge(e){e.config.set(ei.State.CurrentServer,e.config.get(ei.State.DefaultServer)),jt.State.Snapshots.Clear.subscribe(e,()=>{e.managers.snapshot.clear()}),jt.State.Snapshots.Remove.subscribe(e,({id:t})=>{e.managers.snapshot.remove(t)}),jt.State.Snapshots.Add.subscribe(e,function(){var t=le(function*({key:n,name:r,description:i,params:o}){var s;const a=e.state.getSnapshot(o),l=(null!==(s=o?.image)&&void 0!==s?s:e.state.snapshotParams.value.image)?yield vA.getCanvasImageAsset(e,`${a.id}-image.png`):void 0,c=vA.Entry(a,{key:n,name:r,description:i,image:l});e.managers.snapshot.add(c)});return function(n){return t.apply(this,arguments)}}()),jt.State.Snapshots.Replace.subscribe(e,function(){var t=le(function*({id:n,params:r}){var i;const o=e.state.getSnapshot(r),s=(null!==(i=r?.image)&&void 0!==i?i:e.state.snapshotParams.value.image)?yield vA.getCanvasImageAsset(e,`${o.id}-image.png`):void 0;e.managers.snapshot.replace(n,e.state.getSnapshot(r),{image:s})});return function(n){return t.apply(this,arguments)}}()),jt.State.Snapshots.Move.subscribe(e,({id:t,dir:n})=>{e.managers.snapshot.move(t,n)}),jt.State.Snapshots.Apply.subscribe(e,({id:t})=>{const n=e.managers.snapshot.setCurrent(t);if(n)return e.state.setSnapshot(n)}),jt.State.Snapshots.Upload.subscribe(e,function(){var t=le(function*({name:n,description:r,playOnLoad:i,serverUrl:o}){return fetch(mF(o,`set?name=${encodeURIComponent(n||"")}&description=${encodeURIComponent(r||"")}`),{method:"POST",mode:"cors",referrer:"no-referrer",headers:{"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify(yield e.managers.snapshot.getStateSnapshot({name:n,description:r,playOnLoad:i}))})});return function(n){return t.apply(this,arguments)}}()),jt.State.Snapshots.Fetch.subscribe(e,function(){var t=le(function*({url:n}){const r=yield e.runTask(e.fetch({url:n,type:"json"}));yield e.managers.snapshot.setStateSnapshot(r.data)});return function(n){return t.apply(this,arguments)}}()),jt.State.Snapshots.DownloadToFile.subscribe(e,function(){var t=le(function*({name:n,type:r,params:i}){const o=`mol-star_state_${n||function Uct(){const e=new Date;return e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate()+"-"+e.getHours()+"-"+e.getMinutes()+"-"+e.getSeconds()}()}.${"json"===r?"molj":"molx"}`;Mge(yield e.managers.snapshot.serialize({type:r,params:i}),`${o}`)});return function(n){return t.apply(this,arguments)}}()),jt.State.Snapshots.OpenFile.subscribe(e,({file:t})=>e.managers.snapshot.open(t)),jt.State.Snapshots.OpenUrl.subscribe(e,function(){var t=le(function*({url:n,type:r}){const i=yield e.runTask(e.fetch({url:n,type:"binary"}));return e.managers.snapshot.open(new File([i],`state.${r}`))});return function(n){return t.apply(this,arguments)}}())}function Gct(e){Hge(e),Gge(e),qge(e)}function Hge(e){const t=e.state.data.events;t.object.created.subscribe(n=>{var r;Se.isRepresentation3D(n.obj)&&(vq(n.state.cells.get(n.ref),n.obj.data.repr),n.obj.data.repr.setState({syncManually:!0}),null===(r=e.canvas3d)||void 0===r||r.add(n.obj.data.repr))}),t.object.updated.subscribe(n=>{var r,i;n.oldObj&&Se.isRepresentation3D(n.oldObj)&&(null===(r=e.canvas3d)||void 0===r||r.remove(n.oldObj.data.repr),n.oldObj.data.repr.destroy()),Se.isRepresentation3D(n.obj)&&(vq(n.state.cells.get(n.ref),n.obj.data.repr),"recreate"===n.action&&n.obj.data.repr.setState({syncManually:!0}),null===(i=e.canvas3d)||void 0===i||i.add(n.obj.data.repr))}),t.object.removed.subscribe(n=>{var r;Se.isRepresentation3D(n.obj)&&(null===(r=e.canvas3d)||void 0===r||r.remove(n.obj.data.repr),n.obj.data.repr.destroy())})}function Gge(e){const t=e.state.data.events;t.object.created.subscribe(n=>{var r;if(!Se.Molecule.Structure.Representation3DState.is(n.obj))return;const i=n.obj.data;i.repr.setState(i.state),null===(r=e.canvas3d)||void 0===r||r.update(i.repr)}),t.object.updated.subscribe(n=>{var r;if(!Se.Molecule.Structure.Representation3DState.is(n.obj))return;const i=n.obj.data;i.repr.setState(i.state),null===(r=e.canvas3d)||void 0===r||r.update(i.repr)}),t.object.removed.subscribe(n=>{var r;if(!Se.Molecule.Structure.Representation3DState.is(n.obj))return;const i=n.obj.data;i.repr.setState(i.initialState),null===(r=e.canvas3d)||void 0===r||r.update(i.repr)})}function qge(e){e.state.data.events.cell.stateUpdated.subscribe(t=>{var n;const r=t.state.cells.get(t.ref);Se.isRepresentation3D(r.obj)&&vq(r,r.obj.data.repr)&&(null===(n=e.canvas3d)||void 0===n||n.syncVisibility())})}function vq(e,t){return t.state.visible===!!e.state.isHidden&&(t.setState({visible:!e.state.isHidden}),!0)}function qct(e){Wge(e),Yge(e),$ge(e),Xge(e),Kge(e)}function Wge(e){jt.Camera.Reset.subscribe(e,t=>{e.managers.camera.reset(t?.snapshot,t?.durationMs)})}function $ge(e){jt.Camera.SetSnapshot.subscribe(e,({snapshot:t,durationMs:n})=>{e.managers.camera.setSnapshot(t,n)})}function Yge(e){jt.Camera.Focus.subscribe(e,({center:t,radius:n,durationMs:r})=>{e.managers.camera.focusSphere({center:t,radius:n},{durationMs:r}),e.events.canvas3d.settingsUpdated.next(void 0)})}function Xge(e){jt.Camera.OrientAxes.subscribe(e,({structures:t,durationMs:n})=>{e.managers.camera.orientAxes(t,n)})}function Kge(e){jt.Camera.ResetAxes.subscribe(e,({durationMs:t})=>{e.managers.camera.resetAxes(t)})}function Da(){return Da.zero()}!function(e){function i(){return(i=le(function*(o,s){if(!o.helpers.viewportScreenshot)return;const a=o.helpers.viewportScreenshot.getPreview(512);if(!a)return;const l=yield yq(a.canvas,"png"),c=new File([l],s),u={kind:"file",id:oo.create22(),name:s};return o.managers.asset.set(u,c),u})).apply(this,arguments)}e.Entry=function t(o,s){return{timestamp:+new Date,snapshot:o,...s}},e.isStateSnapshot=function n(o){return!!o&&!!o.timestamp&&!!o.entries},e.getCanvasImageAsset=function r(o,s){return i.apply(this,arguments)}}(vA||(vA={})),function(e){e.zero=function t(){return{x:0,y:0,width:0,height:0}},e.create=function n(l,c,u,d){return{x:l,y:c,width:u,height:d}},e.clone=function r(l){return{...l}},e.copy=function i(l,c){return Object.assign(l,c)},e.set=function o(l,c,u,d,f){return l.x=c,l.y=u,l.width=d,l.height=f,l},e.toVec4=function s(l,c){return l[0]=c.x,l[1]=c.y,l[2]=c.width,l[3]=c.height,l},e.equals=function a(l,c){return l.x===c.x&&l.y===c.y&&l.width===c.width&&l.height===c.height}}(Da||(Da={}));const Tg=Bn();function CF(e,t,n,r){const{x:i,y:o,width:s,height:a}=n,c=t[1]-o,u=t[2];return e[0]=2*(t[0]-i)/s-1,e[1]=2*c/a-1,e[2]=2*u-1,C.transformMat4(e,e,r)}function q_(e){if("object"==typeof e){if("buttons"in e)return e.buttons;if("which"in e){const t=e.which;if(2===t)return 4;if(3===t)return 2;if(t>0)return 1<=0)return 1<!0,pixelScale:1};var Rf,es;!function(e){function t(o,s){return o.shift===s.shift&&o.alt===s.alt&&o.control===s.control&&o.meta===s.meta}function i(o={}){return{shift:!!o.shift,alt:!!o.alt,control:!!o.control,meta:!!o.meta}}e.None=i(),e.areEqual=t,e.areNone=function n(o){return t(o,e.None)},e.size=function r(o){if(!o)return 0;let s=0;return o.shift&&s++,o.alt&&s++,o.control&&s++,o.meta&&s++,s},e.create=i}(Rf||(Rf={})),function(e){let t;var n;e.has=Mc.has,e.create=Mc.create,(n=t=e.Flag||(e.Flag={}))[n.None=0]="None",n[n.Primary=1]="Primary",n[n.Secondary=2]="Secondary",n[n.Auxilary=4]="Auxilary",n[n.Forth=8]="Forth",n[n.Five=16]="Five"}(es||(es={}));const Qge={key:"",code:"",modifiers:Rf.None,x:-1,y:-1,pageX:-1,pageY:-1,preventDefault:rp};var W_=function(e){return e[e.Stopped=0]="Stopped",e[e.Started=1]="Started",e[e.Moving=2]="Moving",e}(W_||{});function Jge(){return{drag:new si,interactionEnd:new si,click:new si,move:new si,wheel:new si,pinch:new si,gesture:new si,resize:new si,leave:new si,enter:new si,modifiers:new si,key:new si,keyUp:new si,keyDown:new si,lock:new si}}const $ct=["Backspace","Delete"];var xq;!function(e){e.create=function t(r={}){const{noScroll:i,noContextMenu:o}={...Zge,...r};return{noScroll:i,noContextMenu:o,pointerLock:!1,width:0,height:0,pixelRatio:1,...Jge(),setPixelScale:rp,requestPointerLock:rp,exitPointerLock:rp,dispose:rp}},e.fromElement=function n(r,i={}){let{noScroll:o,noContextMenu:a,noPinchZoom:l,noTextSelect:c,mask:u,pixelScale:d,preventGestures:f}={...Zge,...i},p=r.clientWidth*T(),m=r.clientHeight*T(),h=!1,g=Da(),y=0,v=0;const x=Ue(),_=Ue(),w=Ue(),A=Ue(),M=Ue(),E={shift:!1,alt:!1,control:!1,meta:!1},D={x:-1,y:-1,pageX:-1,pageY:-1};function T(){return window.devicePixelRatio*d}function F(){return{...E}}function R(Qe){return Qe.target===document.body||Qe.target===r}let X,N=W_.Stopped,j=!1,W=es.create(es.Flag.None),z=es.Flag.None,$=!1,V=!1;typeof window.ResizeObserver<"u"&&(X=new window.ResizeObserver(pn));const H=Jge(),{drag:oe,interactionEnd:te,wheel:K,pinch:Q,gesture:G,click:Z,move:ee,leave:se,enter:xe,resize:re,modifiers:ae,key:ge,keyUp:Ie,keyDown:me,lock:Ae}=H;function ue(){h=r.ownerDocument.pointerLockElement===r,vm(h),Ae.next(h)}function _e(){console.error("Unable to use Pointer Lock API"),h=!1,vm(h),Ae.next(h)}function Fe(Qe){u(Qe.clientX,Qe.clientY)&&a&&Qe.preventDefault()}function Ze(Qe){E.alt=Qe.altKey,E.shift=Qe.shiftKey,E.control=Qe.ctrlKey,E.meta=Qe.metaKey}function ct(){(W||E.shift||E.alt||E.meta||E.control)&&(W=0,E.shift=E.alt=E.control=E.meta=!1)}function q(Qe){let Mn=!1;!E.alt&&Qe.altKey&&(Mn=!0,E.alt=!0),!E.shift&&Qe.shiftKey&&(Mn=!0,E.shift=!0),!E.control&&Qe.ctrlKey&&(Mn=!0,E.control=!0),!E.meta&&Qe.metaKey&&(Mn=!0,E.meta=!0),Mn&&$&&ae.next(F()),R(Qe)&&$&&me.next({key:Qe.key,code:Qe.code,modifiers:F(),...D,preventDefault:()=>Qe.preventDefault()})}function ne(Qe){let Mn=!1;E.alt&&!Qe.altKey&&(Mn=!0,E.alt=!1),E.shift&&!Qe.shiftKey&&(Mn=!0,E.shift=!1),E.control&&!Qe.ctrlKey&&(Mn=!0,E.control=!1),E.meta&&!Qe.metaKey&&(Mn=!0,E.meta=!1),Mn&&$&&ae.next(F()),$ct.includes(Qe.key)&&be(Qe),R(Qe)&&$&&Ie.next({key:Qe.key,code:Qe.code,modifiers:F(),...D,preventDefault:()=>Qe.preventDefault()})}function be(Qe){!R(Qe)||!$||ge.next({key:Qe.key,code:Qe.code,modifiers:F(),...D,preventDefault:()=>Qe.preventDefault()})}function Ce(Qe){const Mn=Qe.touches[0],gt=Qe.touches[1];return{clientX:(Mn.clientX+gt.clientX)/2,clientY:(Mn.clientY+gt.clientY)/2,pageX:(Mn.pageX+gt.pageX)/2,pageY:(Mn.pageY+gt.pageY)/2,target:Qe.target}}function Re(Qe){const Mn=Qe.touches[0].pageX-Qe.touches[1].pageX,gt=Qe.touches[0].pageY-Qe.touches[1].pageY;return Math.sqrt(Mn*Mn+gt*gt)}!function he(){r.addEventListener("contextmenu",Fe,!1),r.addEventListener("wheel",Et,!1),r.addEventListener("mousedown",St,!1),window.addEventListener("mousemove",Mt,!1),window.addEventListener("mouseup",Qt,!1),r.addEventListener("touchstart",ft,!1),r.addEventListener("touchmove",Pt,!1),r.addEventListener("touchend",vt,!1),r.addEventListener("gesturechange",Ft,!1),r.addEventListener("gesturestart",Te,!1),r.addEventListener("gestureend",Vt,!1),window.addEventListener("blur",ct),window.addEventListener("keyup",ne,!1),window.addEventListener("keydown",q,!1),window.addEventListener("keypress",be,!1),document.addEventListener("pointerlockchange",ue,!1),document.addEventListener("pointerlockerror",_e,!1),null!=X?X.observe(r.parentElement):window.addEventListener("resize",pn,!1)}();let $e,Be=-1;const nt=Ue(),ht=Ue();function ft(Qe){if(Qe.preventDefault(),$e=void 0,Be=-1,1===Qe.touches.length)Be=0,Ue.set(nt,Qe.touches[0].pageX,Qe.touches[0].pageY),$e=Qe.touches[0],W=z=es.Flag.Primary,Kn(Qe.touches[0]);else if(2===Qe.touches.length){W=es.Flag.Secondary&es.Flag.Auxilary,z=es.Flag.Secondary,Kn(Ce(Qe));const Mn=Re(Qe);y=Mn,Q.next({distance:Mn,fraction:1,fractionDelta:0,delta:0,isStart:!0,buttons:W,button:z,modifiers:F()})}else 3===Qe.touches.length&&(W=z=es.Flag.Forth,Kn(Ce(Qe)))}function vt(Qe){if(An(),$e&&Be<=4){const Mn=$e;if(!u(Mn.clientX,Mn.clientY))return;bi(ht,Mn);const{pageX:gt,pageY:Jt}=ns(Mn),[_n,Xi]=ht;Z.next({x:_n,y:Xi,pageX:gt,pageY:Jt,buttons:W,button:z,modifiers:F()})}$e=void 0}function Pt(Qe){if(z=es.Flag.None,l&&(Qe.preventDefault(),Qe.stopPropagation(),Qe.originalEvent&&(Qe.originalEvent.preventDefault(),Qe.originalEvent.stopPropagation())),$e=void 0,1===Qe.touches.length)W=es.Flag.Primary,$e=Qe.touches[0],function Ge(Qe){Be<0||(Ue.set(ht,Qe.touches[0].pageX,Qe.touches[0].pageY),Be+=Ue.distance(nt,ht),Ue.copy(nt,ht))}(Qe),ut(Qe.touches[0]);else if(2===Qe.touches.length){const Mn=Re(Qe),gt=y-Mn;if(Math.abs(gt)<4)W=es.Flag.Secondary,ut(Ce(Qe));else{W=es.Flag.Auxilary,Ze(Qe);const Jt=y/Mn;Q.next({delta:gt,fraction:Jt,fractionDelta:v-Jt,distance:Mn,isStart:!1,buttons:W,button:z,modifiers:F()}),v=Jt}y=Mn}else 3===Qe.touches.length&&(W=es.Flag.Forth,ut(Ce(Qe)))}function St(Qe){Ze(Qe),W=q_(Qe),z=xA(Qe),Kn(Qe)}function Mt(Qe){Ze(Qe),W=q_(Qe),z=es.Flag.None,ut(Qe)}function Qt(Qe){Ze(Qe),W=q_(Qe),z=xA(Qe),function ti(Qe){if(N=W_.Stopped,u(Qe.clientX,Qe.clientY)){if(bi(w,Qe),!V&&Ue.distance(w,x)<4){const{pageX:Mn,pageY:gt}=ns(Qe),[Jt,_n]=w;Z.next({x:Jt,y:_n,pageX:Mn,pageY:gt,buttons:W,button:z,modifiers:F()})}V=!1}}(Qe),An()}function An(){te.next(void 0)}function Kn(Qe){u(Qe.clientX,Qe.clientY)&&(bi(_,Qe),Ue.copy(x,_),Pr(_)&&(N=W_.Started))}function ut(Qe){var Mn;bi(w,Qe);const{pageX:gt,pageY:Jt}=ns(Qe),[_n,Xi]=w,{movementX:Sc,movementY:vu}=Qe,od=Pr(w)&&u(Qe.clientX,Qe.clientY);if($&&!od?se.next(void 0):!$&&od&&xe.next(void 0),$=od,D.x=_n,D.y=Xi,D.pageX=gt,D.pageY=Jt,ee.next({x:_n,y:Xi,pageX:gt,pageY:Jt,movementX:Sc,movementY:vu,buttons:W,button:z,modifiers:F(),inside:od,onElement:Qe.target===r}),N===W_.Stopped||(c&&(null===(Mn=Qe.preventDefault)||void 0===Mn||Mn.call(Qe)),Ue.div(A,Ue.sub(A,w,_),function Jn(Qe){return Qe[0]=r.clientWidth,Qe[1]=r.clientHeight,Qe}(M)),Ue.magnitude(A)=4&&(V=!0);const[wv,Av]=A;oe.next({x:_n,y:Xi,dx:wv,dy:Av,pageX:gt,pageY:Jt,buttons:W,button:z,modifiers:F(),isStart:sd}),Ue.copy(_,w),N=W_.Moving}function Et(Qe){if(!u(Qe.clientX,Qe.clientY))return;bi(w,Qe);const{pageX:Mn,pageY:gt}=ns(Qe),[Jt,_n]=w;o&&Qe.preventDefault();const Xi=function Yct(e){let i=0,o=0,s=0,a=0,l=0;return"detail"in e&&(o=e.detail),"wheelDelta"in e&&(o=-e.wheelDelta/120),"wheelDeltaY"in e&&(o=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(i=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(i=o,o=0),s=10*i,a=10*o,"deltaY"in e&&(a=e.deltaY),"deltaX"in e&&(s=e.deltaX),"deltaZ"in e&&(l=e.deltaZ),(s||a||l)&&e.deltaMode&&(1===e.deltaMode?(s*=40,a*=40,l*=40):(s*=800,a*=800,l*=800)),s&&!i&&(i=s<1?-1:1),a&&!o&&(o=a<1?-1:1),{spinX:i,spinY:o,dx:s,dy:a,dz:l}}(Qe);W=z=es.Flag.Auxilary,(Xi.dx||Xi.dy||Xi.dz)&&K.next({x:Jt,y:_n,pageX:Mn,pageY:gt,...Xi,buttons:W,button:z,modifiers:F()})}function Nt(Qe){var Mn,gt;f&&(Qe.preventDefault(),null===(Mn=Qe.stopImmediatePropagation)||void 0===Mn||Mn.call(Qe),null===(gt=Qe.stopPropagation)||void 0===gt||gt.call(Qe))}let ye=0,we=0;function Te(Qe){Nt(Qe),ye=Qe.scale,we=Qe.rotation,G.next({scale:Qe.scale,rotation:Qe.rotation,deltaRotation:0,deltaScale:0,isStart:!0})}function je(Qe,Mn){G.next({scale:Qe.scale,rotation:Qe.rotation,deltaRotation:we-Qe.rotation,deltaScale:ye-Qe.scale,isEnd:Mn}),we=Qe.rotation,ye=Qe.scale}function Ft(Qe){Nt(Qe),je(Qe)}function Vt(Qe){Nt(Qe),je(Qe,!0)}function pn(){re.next({})}function Pr(Qe){if(r instanceof Window||r instanceof Document||r===document.body)return!0;{const Mn=r.getBoundingClientRect();return Qe[0]>=0&&Qe[1]>=0&&Qe[0]{d=Qe,p=r.clientWidth*T(),m=r.clientHeight*T()},requestPointerLock:Qe=>{g=Qe,h||r.requestPointerLock()},exitPointerLock:()=>{h&&r.ownerDocument.exitPointerLock()},dispose:function ie(){j||(j=!0,r.removeEventListener("contextmenu",Fe,!1),r.removeEventListener("wheel",Et,!1),r.removeEventListener("mousedown",St,!1),window.removeEventListener("mousemove",Mt,!1),window.removeEventListener("mouseup",Qt,!1),r.removeEventListener("touchstart",ft,!1),r.removeEventListener("touchmove",Pt,!1),r.removeEventListener("touchend",vt,!1),r.removeEventListener("gesturechange",Ft,!1),r.removeEventListener("gesturestart",Te,!1),r.removeEventListener("gestureend",Vt,!1),window.removeEventListener("blur",ct),window.removeEventListener("keyup",ne,!1),window.removeEventListener("keydown",q,!1),window.removeEventListener("keypress",be,!1),document.removeEventListener("pointerlockchange",ue,!1),document.removeEventListener("pointerlockerror",_e,!1),Js.remove(),null!=X?(X.unobserve(r.parentElement),X.disconnect()):window.removeEventListener("resize",pn,!1))}}}}(xq||(xq={}));var $_=function(e){return e[e.None=0]="None",e[e.Object=1]="Object",e[e.Instance=2]="Instance",e[e.Group=3]="Group",e}($_||{}),AF=function(e){return e[e.None=0]="None",e[e.Depth=1]="Depth",e[e.Mask=2]="Mask",e}(AF||{});const _q={backgroundColor:I.Color(st(0),{description:"Background color of the 3D canvas"}),pickingAlphaThreshold:I.Numeric(.5,{min:0,max:1,step:.01},{description:"The minimum opacity value needed for an object to be pickable."}),interiorDarkening:I.Numeric(.5,{min:0,max:1,step:.01}),interiorColorFlag:I.Boolean(!0,{label:"Use Interior Color"}),interiorColor:I.Color(st.fromNormalizedRgb(.3,.3,.3)),colorMarker:I.Boolean(!0,{description:"Enable color marker"}),highlightColor:I.Color(st.fromNormalizedRgb(1,.4,.6)),selectColor:I.Color(st.fromNormalizedRgb(.2,1,.1)),dimColor:I.Color(st.fromNormalizedRgb(1,1,1)),highlightStrength:I.Numeric(.3,{min:0,max:1,step:.1}),selectStrength:I.Numeric(.3,{min:0,max:1,step:.1}),dimStrength:I.Numeric(0,{min:0,max:1,step:.1}),markerPriority:I.Select(1,[[1,"Highlight"],[2,"Select"]]),xrayEdgeFalloff:I.Numeric(1,{min:0,max:3,step:.1}),exposure:I.Numeric(1,{min:0,max:3,step:.01}),light:I.ObjectList({inclination:I.Numeric(150,{min:0,max:180,step:1}),azimuth:I.Numeric(320,{min:0,max:360,step:1}),color:I.Color(st.fromNormalizedRgb(1,1,1)),intensity:I.Numeric(.6,{min:0,max:5,step:.01})},e=>st.toHexString(e.color),{defaultValue:[{inclination:150,azimuth:320,color:st.fromNormalizedRgb(1,1,1),intensity:.6}]}),ambientColor:I.Color(st.fromNormalizedRgb(1,1,1)),ambientIntensity:I.Numeric(.4,{min:0,max:2,step:.01})},e0e=C(),Sq=C();function t0e(e,t){const n=e.length,{direction:r,color:i}=t||{direction:new Array(3*n).fill(0),color:new Array(3*n).fill(0)};for(let o=0;o{var ie,ue,_e;if(me.state.disposed||!me.state.visible||!me.state.pickable&&"pick"===Ae||!E_.intersectsSphere3D(F,me.values.boundingSphere.ref.value))return;const[Fe,Ze]=me.values.uLod.ref.value;if(0!==Fe||0!==Ze){const{center:ne,radius:be}=me.values.boundingSphere.ref.value,Ce=gs.distanceToPoint(D,ne);if(Ce+beZe)return}me.values.instanceGrid.ref.value.cellSize>1||me.values.lodLevels?me.cull(D,F,p,n.stats):me.uncull();let ct=!1;me.values.dLightCount.ref.value!==l.count&&(O.update(me.values.dLightCount,l.count),ct=!0),me.values.dColorMarker.ref.value!==a.colorMarker&&(O.update(me.values.dColorMarker,a.colorMarker),ct=!0),ct&&me.update();const q=me.getProgram(Ae);if(o.currentProgramId!==q.id&&(W=!0,q.use()),W&&(q.setUniforms(j),q.bindTextures(h,0),W=!1),"directVolume"===me.values.dGeometryType.ref.value){if("color"!==Ae)return;o.disable(i.CULL_FACE),o.frontFace(i.CCW),3===he&&(o.disable(i.DEPTH_TEST),o.depthMask(!1))}else 1===he?(o.enable(i.CULL_FACE),null!==(ie=me.values.dFlipSided)&&void 0!==ie&&ie.ref.value?(o.frontFace(i.CW),o.cullFace(i.FRONT)):(o.frontFace(i.CCW),o.cullFace(i.BACK))):2===he?(o.enable(i.CULL_FACE),null!==(ue=me.values.dFlipSided)&&void 0!==ue&&ue.ref.value?(o.frontFace(i.CW),o.cullFace(i.BACK)):(o.frontFace(i.CCW),o.cullFace(i.FRONT))):(me.values.uDoubleSided?me.values.uDoubleSided.ref.value||me.values.hasReflection.ref.value?o.disable(i.CULL_FACE):o.enable(i.CULL_FACE):o.disable(i.CULL_FACE),null!==(_e=me.values.dFlipSided)&&void 0!==_e&&_e.ref.value?(o.frontFace(i.CW),o.cullFace(i.FRONT)):(o.frontFace(i.CCW),o.cullFace(i.BACK)));me.render(Ae,h.length)},V=(me,Ae,he,ie,ue)=>{UR(h,"tDepth",he||m),O.update(N.uModel,me.view),O.update(N.uModelView,fe.mul(v,Ae.view,me.view)),O.update(N.uInvModelView,fe.invert(x,v)),O.update(N.uModelViewProjection,fe.mul(w,v,Ae.projection)),O.update(N.uInvModelViewProjection,fe.invert(A,w)),O.updateIfChanged(N.uRenderMask,ie),O.updateIfChanged(N.uMarkingDepthTest,ue),o.enable(i.SCISSOR_TEST),o.colorMask(!0,!0,!0,!0);const{x:_e,y:Fe,width:Ze,height:ct}=c;o.viewport(_e,Fe,Ze,ct),o.scissor(_e,Fe,Ze,ct),W=!0,o.currentRenderItemId=-1},Z=(me,Ae,he)=>{var ie,ue;It&&n.timer.mark("Renderer.renderBlendedOpaque"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),V(me,Ae,he,1,!1);const{renderables:_e}=me;for(let Fe=0,Ze=_e.length;Fe{var ie,ue;It&&n.timer.mark("Renderer.renderBlendedTransparent"),o.enable(i.DEPTH_TEST),V(me,Ae,he,2,!1);const{renderables:_e}=me;f?o.blendFunc(i.ONE,i.ONE_MINUS_SRC_ALPHA):o.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA),o.enable(i.BLEND),o.depthMask(!0);for(let Fe=0,Ze=_e.length;Fe0)&&(null!==(ie=ct.values.uDoubleSided)&&void 0!==ie&&ie.ref.value?("opaque"!==(null===(ue=ct.values.dTransparentBackfaces)||void 0===ue?void 0:ue.ref.value)&&z(ct,"color",2),z(ct,"color",1)):z(ct,"color",0))}It&&n.timer.markEnd("Renderer.renderBlendedTransparent")};return{clear:(me,Ae)=>{o.enable(i.SCISSOR_TEST),o.enable(i.DEPTH_TEST),o.colorMask(!0,!0,!0,!0),o.depthMask(!0),f&&!Ae?o.clearColor(0,0,0,0):me?o.clearColor(d[0],d[1],d[2],1):o.clearColor(1,1,1,1),i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT)},clearDepth:(me=!1)=>{o.enable(i.SCISSOR_TEST),me?(o.colorMask(!0,!0,!0,!0),o.clearColor(1,1,1,1),i.clear(i.COLOR_BUFFER_BIT|i.DEPTH_BUFFER_BIT)):(o.enable(i.DEPTH_TEST),o.depthMask(!0),i.clear(i.DEPTH_BUFFER_BIT))},update:(me,Ae)=>{O.update(N.uView,me.view),O.update(N.uInvView,fe.invert(y,me.view)),O.update(N.uProjection,me.projection),O.update(N.uInvProjection,fe.invert(_,me.projection)),O.updateIfChanged(N.uIsOrtho,"orthographic"===me.state.mode?1:0),O.update(N.uViewOffset,me.viewOffset.enabled?Ue.set(T,16*me.viewOffset.offsetX,16*me.viewOffset.offsetY):Ue.set(T,0,0)),O.update(N.uCameraPosition,C.copy(E,me.state.position)),O.update(N.uCameraDir,C.normalize(M,C.sub(M,me.state.target,me.state.position))),O.updateIfChanged(N.uFar,me.far),O.updateIfChanged(N.uNear,me.near),O.updateIfChanged(N.uFog,me.state.fog>0),O.updateIfChanged(N.uFogFar,me.fogFar),O.updateIfChanged(N.uFogNear,me.fogNear),O.updateIfChanged(N.uTransparentBackground,f),E_.fromProjectionMatrix(F,me.projectionView),gs.copy(D,F[5]),D.constant-=gs.distanceToPoint(D,E),O.update(N.uCameraPlane,gs.toArray(D,N.uCameraPlane.ref.value,0)),O.updateIfChanged(N.uMarkerAverage,Ae.markerAverage)},renderPick:(me,Ae,he,ie,ue)=>{It&&n.timer.mark("Renderer.renderPick"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),V(me,Ae,ie,0,!1),O.updateIfChanged(N.uPickType,ue);const{renderables:_e}=me;for(let Fe=0,Ze=_e.length;Fe{It&&n.timer.mark("Renderer.renderDepth"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),V(me,Ae,he,0,!1);const{renderables:ie}=me;for(let ue=0,_e=ie.length;ue<_e;++ue)z(ie[ue],"depth",0);It&&n.timer.markEnd("Renderer.renderDepth")},renderDepthOpaque:(me,Ae,he)=>{var ie,ue;It&&n.timer.mark("Renderer.renderDepthOpaque"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),V(me,Ae,he,1,!1);const{renderables:_e}=me;for(let Fe=0,Ze=_e.length;Fe{var ie,ue;It&&n.timer.mark("Renderer.renderDepthTransparent"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),V(me,Ae,he,2,!1);const{renderables:_e}=me;for(let Fe=0,Ze=_e.length;Fe0||q)&&z(ct,"depth",0)}It&&n.timer.markEnd("Renderer.renderDepthTransparent")},renderMarkingDepth:(me,Ae,he)=>{It&&n.timer.mark("Renderer.renderMarkingDepth"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),V(me,Ae,he,0,!1),O.updateIfChanged(N.uMarkingType,AF.Depth);const{renderables:ie}=me;for(let ue=0,_e=ie.length;ue<_e;++ue){const Fe=ie[ue];0!==al(Fe.values.alpha.ref.value*Fe.state.alphaFactor,0,1)&&1!==Fe.values.markerAverage.ref.value&&z(ie[ue],"marking",0)}It&&n.timer.markEnd("Renderer.renderMarkingDepth")},renderMarkingMask:(me,Ae,he)=>{It&&n.timer.mark("Renderer.renderMarkingMask"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),V(me,Ae,he,0,!!he),O.updateIfChanged(N.uMarkingType,AF.Mask);const{renderables:ie}=me;for(let ue=0,_e=ie.length;ue<_e;++ue)ie[ue].values.markerAverage.ref.value>0&&z(ie[ue],"marking",0);It&&n.timer.markEnd("Renderer.renderMarkingMask")},renderBlended:(me,Ae)=>{me.hasOpaque&&Z(me,Ae,null),me.opacityAverage<1&&ee(me,Ae,null)},renderBlendedOpaque:Z,renderBlendedTransparent:ee,renderBlendedVolume:(me,Ae,he)=>{It&&n.timer.mark("Renderer.renderBlendedVolume"),o.blendFunc(i.ONE,i.ONE_MINUS_SRC_ALPHA),o.enable(i.BLEND),V(me,Ae,he,2,!1);const{renderables:ie}=me;for(let ue=0,_e=ie.length;ue<_e;++ue){const Fe=ie[ue];"directVolume"===Fe.values.dGeometryType.ref.value&&z(Fe,"color",3)}It&&n.timer.markEnd("Renderer.renderBlendedVolume")},renderWboitOpaque:(me,Ae,he)=>{var ie,ue,_e,Fe;It&&n.timer.mark("Renderer.renderWboitOpaque"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),V(me,Ae,he,1,!1);const{renderables:Ze}=me;for(let ct=0,q=Ze.length;ct{var ie,ue,_e;It&&n.timer.mark("Renderer.renderWboitTransparent"),V(me,Ae,he,2,!1);const{renderables:Fe}=me;for(let Ze=0,ct=Fe.length;Ze0||"directVolume"===q.values.dGeometryType.ref.value||"fuzzy"===(null===(_e=q.values.dPointStyle)||void 0===_e?void 0:_e.ref.value)||"text"===q.values.dGeometryType.ref.value||be)&&z(q,"color",0)}It&&n.timer.markEnd("Renderer.renderWboitTransparent")},renderDpoitOpaque:(me,Ae,he)=>{var ie,ue,_e,Fe;It&&n.timer.mark("Renderer.renderDpoitOpaque"),o.disable(i.BLEND),o.enable(i.DEPTH_TEST),o.depthMask(!0),V(me,Ae,he,1,!1);const{renderables:Ze}=me;for(let ct=0,q=Ze.length;ct{var ue,_e,Fe;It&&n.timer.mark("Renderer.renderDpoitTransparent"),o.enable(i.BLEND),UR(h,"tDpoitDepth",ie.depth),UR(h,"tDpoitFrontColor",ie.frontColor),UR(h,"tDpoitBackColor",ie.backColor),V(me,Ae,he,2,!1);const{renderables:Ze}=me;for(let ct=0,q=Ze.length;ct0||"fuzzy"===(null===(Fe=ne.values.dPointStyle)||void 0===Fe?void 0:Fe.ref.value)||"text"===ne.values.dGeometryType.ref.value||Ce)&&z(ne,"color",0)}It&&n.timer.markEnd("Renderer.renderDpoitTransparent")},renderDpoitVolume:(me,Ae,he)=>{It&&n.timer.mark("Renderer.renderDpoitVolume"),o.blendFunc(i.ONE,i.ONE_MINUS_SRC_ALPHA),o.enable(i.BLEND),V(me,Ae,he,2,!1);const{renderables:ie}=me;for(let ue=0,_e=ie.length;ue<_e;++ue){const Fe=ie[ue];"directVolume"===Fe.values.dGeometryType.ref.value&&z(Fe,"color",0)}It&&n.timer.markEnd("Renderer.renderDpoitVolume")},setProps:me=>{void 0!==me.backgroundColor&&me.backgroundColor!==a.backgroundColor&&(a.backgroundColor=me.backgroundColor,st.toVec3Normalized(d,a.backgroundColor),O.update(N.uFogColor,C.copy(N.uFogColor.ref.value,d))),void 0!==me.pickingAlphaThreshold&&me.pickingAlphaThreshold!==a.pickingAlphaThreshold&&(a.pickingAlphaThreshold=me.pickingAlphaThreshold,O.update(N.uPickingAlphaThreshold,a.pickingAlphaThreshold)),void 0!==me.interiorDarkening&&me.interiorDarkening!==a.interiorDarkening&&(a.interiorDarkening=me.interiorDarkening,O.update(N.uInteriorDarkening,a.interiorDarkening)),void 0!==me.interiorColorFlag&&me.interiorColorFlag!==a.interiorColorFlag&&(a.interiorColorFlag=me.interiorColorFlag,O.update(N.uInteriorColorFlag,a.interiorColorFlag)),void 0!==me.interiorColor&&me.interiorColor!==a.interiorColor&&(a.interiorColor=me.interiorColor,O.update(N.uInteriorColor,st.toVec3Normalized(N.uInteriorColor.ref.value,a.interiorColor))),void 0!==me.colorMarker&&me.colorMarker!==a.colorMarker&&(a.colorMarker=me.colorMarker),void 0!==me.highlightColor&&me.highlightColor!==a.highlightColor&&(a.highlightColor=me.highlightColor,O.update(N.uHighlightColor,st.toVec3Normalized(N.uHighlightColor.ref.value,a.highlightColor))),void 0!==me.selectColor&&me.selectColor!==a.selectColor&&(a.selectColor=me.selectColor,O.update(N.uSelectColor,st.toVec3Normalized(N.uSelectColor.ref.value,a.selectColor))),void 0!==me.dimColor&&me.dimColor!==a.dimColor&&(a.dimColor=me.dimColor,O.update(N.uDimColor,st.toVec3Normalized(N.uDimColor.ref.value,a.dimColor))),void 0!==me.highlightStrength&&me.highlightStrength!==a.highlightStrength&&(a.highlightStrength=me.highlightStrength,O.update(N.uHighlightStrength,a.highlightStrength)),void 0!==me.selectStrength&&me.selectStrength!==a.selectStrength&&(a.selectStrength=me.selectStrength,O.update(N.uSelectStrength,a.selectStrength)),void 0!==me.dimStrength&&me.dimStrength!==a.dimStrength&&(a.dimStrength=me.dimStrength,O.update(N.uDimStrength,a.dimStrength)),void 0!==me.markerPriority&&me.markerPriority!==a.markerPriority&&(a.markerPriority=me.markerPriority,O.update(N.uMarkerPriority,a.markerPriority)),void 0!==me.xrayEdgeFalloff&&me.xrayEdgeFalloff!==a.xrayEdgeFalloff&&(a.xrayEdgeFalloff=me.xrayEdgeFalloff,O.update(N.uXrayEdgeFalloff,a.xrayEdgeFalloff)),void 0!==me.exposure&&me.exposure!==a.exposure&&(a.exposure=me.exposure,O.update(N.uExposure,a.exposure)),void 0!==me.light&&!tg(me.light,a.light)&&(a.light=me.light,Object.assign(l,t0e(me.light,l)),O.update(N.uLightDirection,l.direction),O.update(N.uLightColor,l.color)),void 0!==me.ambientColor&&me.ambientColor!==a.ambientColor&&(a.ambientColor=me.ambientColor,C.scale(R,st.toArrayNormalized(a.ambientColor,R,0),a.ambientIntensity),O.update(N.uAmbientColor,R)),void 0!==me.ambientIntensity&&me.ambientIntensity!==a.ambientIntensity&&(a.ambientIntensity=me.ambientIntensity,C.scale(R,st.toArrayNormalized(a.ambientColor,R,0),a.ambientIntensity),O.update(N.uAmbientColor,R))},setViewport:(me,Ae,he,ie)=>{o.viewport(me,Ae,he,ie),o.scissor(me,Ae,he,ie),(me!==c.x||Ae!==c.y||he!==c.width||ie!==c.height)&&(Da.set(c,me,Ae,he,ie),O.update(N.uViewport,Bn.set(N.uViewport.ref.value,me,Ae,he,ie)))},setTransparentBackground:me=>{f=me},setDrawingBufferSize:(me,Ae)=>{(me!==u[0]||Ae!==u[1])&&O.update(N.uDrawingBufferSize,Ue.set(u,me,Ae))},setPixelRatio:me=>{O.update(N.uPixelRatio,me)},setOcclusionTest:me=>{p=me},props:a,get stats(){return{programCount:n.stats.resourceCounts.program,shaderCount:n.stats.resourceCounts.shader,attributeCount:n.stats.resourceCounts.attribute,elementsCount:n.stats.resourceCounts.elements,framebufferCount:n.stats.resourceCounts.framebuffer,renderbufferCount:n.stats.resourceCounts.renderbuffer,textureCount:n.stats.resourceCounts.texture,vertexArrayCount:n.stats.resourceCounts.vertexArray,drawCount:s.drawCount,instanceCount:s.instanceCount,instancedDrawCount:s.instancedDrawCount}},get light(){return l},dispose:()=>{}}}}(Cq||(Cq={})),function(e){function s(u){return u.triggers.map(l.format).join(" or ")}function l(u,d){return l.create(u,d)}var u;e.create=function t(u,d="",f=""){return{triggers:u,action:d,description:f}},e.isBinding=function n(u){return!!u&&Array.isArray(u.triggers)&&"string"==typeof u.action},e.Empty={triggers:[],action:"",description:""},e.isEmpty=function r(u){return 0===u.triggers.length||u.triggers.every(d=>void 0===d.buttons&&void 0===d.modifiers&&!d.code)},e.match=function i(u,d,f){return u.triggers.some(p=>l.match(p,d,f))},e.matchKey=function o(u,d,f,p){return u.triggers.some(m=>l.matchKey(m,d,f,p))},e.formatTriggers=s,e.format=function a(u,d=""){return function ZLe(e,t){const n=Object.keys(t),r=Object.values(t);return new Function(...n,`return \`${e}\`;`)(...r)}(u.description||yf(d),{triggers:""+s(u)+""})},e.Trigger=l,e.TriggerKey=function c(u,d){return l.create(void 0,d,u)},(u=l=e.Trigger||(e.Trigger={})).create=function d(h,g,y){return{buttons:h,modifiers:g,code:y}},u.Empty={},u.match=function f(h,g,y){const{buttons:v,modifiers:x}=h;return void 0!==v&&(v===g||es.has(v,g))&&(!x||Rf.areEqual(x,y))},u.matchKey=function p(h,g,y,v){const{modifiers:x,code:_}=h;return void 0!==_&&(_===g||1===_.length&&4===g.length&&g.startsWith("Key")&&!!v&&1===v.length&&v.toUpperCase()===_.toUpperCase())&&(!x||Rf.areEqual(x,y))},u.format=function m(h){const g=[],y=function Xct(e,t){const n=[];return void 0!==e||t?0===e?n.push("mouse hover"):void 0!==e&&(J1.has(e,J1.Flag.Primary)&&n.push("left mouse button"),J1.has(e,J1.Flag.Secondary)&&n.push("right mouse button"),J1.has(e,J1.Flag.Auxilary)&&n.push("wheel/middle mouse button"),J1.has(e,J1.Flag.Forth)&&n.push("three fingers")):n.push("any mouse button"),n.join(" + ")}(h.buttons,h.code);y&&g.push(y);const v=function Zct(e){return e?.startsWith("Key")&&(e=e.substring(3)),e&&Rc(e).toLowerCase()}(h.code);v&&g.push(v);const x=function Kct(e,t){const n=[];return e?(e.alt&&n.push("alt key"),e.control&&n.push("control key"),e.meta&&n.push("meta/command key"),e.shift&&n.push("shift key"),t&&0===n.length&&n.push("no key")):t&&n.push("any key"),n.join(" + ")}(h.modifiers);return x&&g.push(x),g.join(" + ")}}(Ut||(Ut={}));const J1=es,ev=es,Nf=Rf,tv=Ut.Trigger,Nd=Ut.TriggerKey,n0e={dragRotate:Ut([tv(ev.Flag.Primary,Nf.create())],"Rotate","Drag using ${triggers}"),dragRotateZ:Ut([tv(ev.Flag.Primary,Nf.create({shift:!0,control:!0}))],"Rotate around z-axis (roll)","Drag using ${triggers}"),dragPan:Ut([tv(ev.Flag.Secondary,Nf.create()),tv(ev.Flag.Primary,Nf.create({control:!0}))],"Pan","Drag using ${triggers}"),dragZoom:Ut.Empty,dragFocus:Ut([tv(ev.Flag.Forth,Nf.create())],"Focus","Drag using ${triggers}"),dragFocusZoom:Ut([tv(ev.Flag.Auxilary,Nf.create())],"Focus and zoom","Drag using ${triggers}"),scrollZoom:Ut([tv(ev.Flag.Auxilary,Nf.create())],"Zoom","Scroll using ${triggers}"),scrollFocus:Ut([tv(ev.Flag.Auxilary,Nf.create({shift:!0}))],"Clip","Scroll using ${triggers}"),scrollFocusZoom:Ut.Empty,keyMoveForward:Ut([Nd("KeyW")],"Move forward","Press ${triggers}"),keyMoveBack:Ut([Nd("KeyS")],"Move back","Press ${triggers}"),keyMoveLeft:Ut([Nd("KeyA")],"Move left","Press ${triggers}"),keyMoveRight:Ut([Nd("KeyD")],"Move right","Press ${triggers}"),keyMoveUp:Ut([Nd("KeyR")],"Move up","Press ${triggers}"),keyMoveDown:Ut([Nd("KeyF")],"Move down","Press ${triggers}"),keyRollLeft:Ut([Nd("KeyQ")],"Roll left","Press ${triggers}"),keyRollRight:Ut([Nd("KeyE")],"Roll right","Press ${triggers}"),keyPitchUp:Ut([Nd("ArrowUp",Nf.create({shift:!0}))],"Pitch up","Press ${triggers}"),keyPitchDown:Ut([Nd("ArrowDown",Nf.create({shift:!0}))],"Pitch down","Press ${triggers}"),keyYawLeft:Ut([Nd("ArrowLeft",Nf.create({shift:!0}))],"Yaw left","Press ${triggers}"),keyYawRight:Ut([Nd("ArrowRight",Nf.create({shift:!0}))],"Yaw right","Press ${triggers}"),boostMove:Ut([Nd("ShiftLeft")],"Boost move","Press ${triggers}"),enablePointerLock:Ut([Nd("Space",Nf.create({control:!0}))],"Enable pointer lock","Press ${triggers}")},r0e={noScroll:I.Boolean(!0,{isHidden:!0}),rotateSpeed:I.Numeric(5,{min:1,max:10,step:1}),zoomSpeed:I.Numeric(7,{min:1,max:15,step:1}),panSpeed:I.Numeric(1,{min:.1,max:5,step:.1}),moveSpeed:I.Numeric(.75,{min:.1,max:3,step:.1}),boostMoveFactor:I.Numeric(5,{min:.1,max:10,step:.1}),flyMode:I.Boolean(!1),animate:I.MappedStatic("off",{off:I.EmptyGroup(),spin:I.Group({speed:I.Numeric(1,{min:-20,max:20,step:1})},{description:"Spin the 3D scene around the x-axis in view space"}),rock:I.Group({speed:I.Numeric(.3,{min:-5,max:5,step:.1}),angle:I.Numeric(10,{min:0,max:90,step:1},{description:"How many degrees to rotate in each direction."})},{description:"Rock the 3D scene around the x-axis in view space"})}),staticMoving:I.Boolean(!0,{isHidden:!0}),dynamicDampingFactor:I.Numeric(.2,{},{isHidden:!0}),minDistance:I.Numeric(.01,{},{isHidden:!0}),maxDistance:I.Numeric(1e150,{},{isHidden:!0}),gestureScaleFactor:I.Numeric(1,{},{isHidden:!0}),maxWheelDelta:I.Numeric(.02,{},{isHidden:!0}),bindings:I.Value(n0e,{isHidden:!0}),autoAdjustMinMaxDistance:I.MappedStatic("on",{off:I.EmptyGroup(),on:I.Group({minDistanceFactor:I.Numeric(0),minDistancePadding:I.Numeric(5),maxDistanceFactor:I.Numeric(10),maxDistanceMin:I.Numeric(20)})},{isHidden:!0})};var wq,IF;!function(e){e.create=function t(n,r,i,o={}){const s={...I.getDefaultValues(r0e),...o,bindings:{...n0e,...o.bindings}},a=s.bindings,l=Da.clone(r.viewport);let c=!1;const u=n.drag.subscribe(function ti({x:gt,y:Jt,pageX:_n,pageY:Xi,buttons:Sc,modifiers:vu,isStart:od}){const sd=Mt(gt,Jt);if(od&&sd||!od&&!_)return;_=!0,Qe();const wv=Ut.match(a.dragRotate,Sc,vu),Av=Ut.match(a.dragRotateZ,Sc,vu),NI=Ut.match(a.dragPan,Sc,vu),FI=Ut.match(a.dragZoom,Sc,vu),OI=Ut.match(a.dragFocus,Sc,vu),V2=Ut.match(a.dragFocusZoom,Sc,vu);se(_n,Xi),function Z(gt,Jt){Ue.set(G,(gt-l.x)/l.width,(Jt-l.y)/l.height)}(_n,Xi);const BI=n.pixelRatio,LI=(gt*BI-l.width/2-l.x)/l.width,jI=-(n.height-Jt*BI-l.height/2-l.y)/l.height;if(od&&(wv&&(Ue.copy(E,ee),Ue.copy(M,E)),Av&&(Ue.set(R,LI,jI),Ue.copy(F,R)),(FI||V2)&&(Ue.copy(z,G),Ue.copy($,z)),OI&&(Ue.copy(V,G),Ue.copy(X,V)),NI&&(Ue.copy(H,G),Ue.copy(oe,H))),wv&&Ue.copy(E,ee),Av&&Ue.set(R,LI,jI),(FI||V2)&&Ue.copy($,G),OI&&Ue.copy(X,G),V2){const H2=C.distance(r.state.position,r.state.target);r.setState({radius:H2/5})}NI&&Ue.copy(oe,G)}),d=n.interactionEnd.subscribe(function ut(){_=!1}),f=n.wheel.subscribe(function Et({x:gt,y:Jt,spinX:_n,spinY:Xi,dz:Sc,buttons:vu,modifiers:od}){if(Mt(gt,Jt))return;let sd=function SFe(...e){let t=0,n=0;for(let r=0,i=e.length;rn&&(t=o,n=s)}return t}(.075*_n,.075*Xi,1e-4*Sc);sd<-s.maxWheelDelta?sd=-s.maxWheelDelta:sd>s.maxWheelDelta&&(sd=s.maxWheelDelta),Ut.match(a.scrollZoom,vu,od)&&($[1]+=sd),Ut.match(a.scrollFocus,vu,od)&&(X[1]+=sd)}),p=n.pinch.subscribe(function Nt({fractionDelta:gt,buttons:Jt,modifiers:_n}){Ut.match(a.scrollZoom,Jt,_n)&&(_=!0,$[1]+=s.gestureScaleFactor*gt)}),m=n.gesture.subscribe(function ye({deltaScale:gt}){_=!0,$[1]+=s.gestureScaleFactor*gt}),h=n.keyDown.subscribe(function Te({modifiers:gt,code:Jt,key:_n,x:Xi,y:Sc}){Mt(Xi,Sc)||(Ut.matchKey(a.keyMoveForward,Jt,gt,_n)?Ge.moveForward=1:Ut.matchKey(a.keyMoveBack,Jt,gt,_n)?Ge.moveBack=1:Ut.matchKey(a.keyMoveLeft,Jt,gt,_n)?Ge.moveLeft=1:Ut.matchKey(a.keyMoveRight,Jt,gt,_n)?Ge.moveRight=1:Ut.matchKey(a.keyMoveUp,Jt,gt,_n)?Ge.moveUp=1:Ut.matchKey(a.keyMoveDown,Jt,gt,_n)?Ge.moveDown=1:Ut.matchKey(a.keyRollLeft,Jt,gt,_n)?Ge.rollLeft=1:Ut.matchKey(a.keyRollRight,Jt,gt,_n)?Ge.rollRight=1:Ut.matchKey(a.keyPitchUp,Jt,gt,_n)?Ge.pitchUp=1:Ut.matchKey(a.keyPitchDown,Jt,gt,_n)?Ge.pitchDown=1:Ut.matchKey(a.keyYawLeft,Jt,gt,_n)?Ge.yawLeft=1:Ut.matchKey(a.keyYawRight,Jt,gt,_n)&&(Ge.yawRight=1),Ut.matchKey(a.boostMove,Jt,gt,_n)&&(Ge.boostMove=1),Ut.matchKey(a.enablePointerLock,Jt,gt,_n)&&n.requestPointerLock(l))}),g=n.keyUp.subscribe(function je({modifiers:gt,code:Jt,key:_n,x:Xi,y:Sc}){var vu,od,sd,wv,Av,NI,FI,OI,V2,BI,LI,jI;if(Mt(Xi,Sc))return;let H2=!1;Jt.startsWith("Alt")?(H2=!0,gt.alt=!0):Jt.startsWith("Shift")?(H2=!0,gt.shift=!0):Jt.startsWith("Control")?(H2=!0,gt.control=!0):Jt.startsWith("Meta")&&(H2=!0,gt.meta=!0);const Gd=[];H2?(Ge.moveForward&&Gd.push((null===(vu=a.keyMoveForward.triggers[0])||void 0===vu?void 0:vu.code)||""),Ge.moveBack&&Gd.push((null===(od=a.keyMoveBack.triggers[0])||void 0===od?void 0:od.code)||""),Ge.moveLeft&&Gd.push((null===(sd=a.keyMoveLeft.triggers[0])||void 0===sd?void 0:sd.code)||""),Ge.moveRight&&Gd.push((null===(wv=a.keyMoveRight.triggers[0])||void 0===wv?void 0:wv.code)||""),Ge.moveUp&&Gd.push((null===(Av=a.keyMoveUp.triggers[0])||void 0===Av?void 0:Av.code)||""),Ge.moveDown&&Gd.push((null===(NI=a.keyMoveDown.triggers[0])||void 0===NI?void 0:NI.code)||""),Ge.rollLeft&&Gd.push((null===(FI=a.keyRollLeft.triggers[0])||void 0===FI?void 0:FI.code)||""),Ge.rollRight&&Gd.push((null===(OI=a.keyRollRight.triggers[0])||void 0===OI?void 0:OI.code)||""),Ge.pitchUp&&Gd.push((null===(V2=a.keyPitchUp.triggers[0])||void 0===V2?void 0:V2.code)||""),Ge.pitchDown&&Gd.push((null===(BI=a.keyPitchDown.triggers[0])||void 0===BI?void 0:BI.code)||""),Ge.yawLeft&&Gd.push((null===(LI=a.keyYawLeft.triggers[0])||void 0===LI?void 0:LI.code)||""),Ge.yawRight&&Gd.push((null===(jI=a.keyYawRight.triggers[0])||void 0===jI?void 0:jI.code)||"")):Gd.push(Jt);for(const rh of Gd)Ut.matchKey(a.keyMoveForward,rh,gt,_n)?Ge.moveForward=0:Ut.matchKey(a.keyMoveBack,rh,gt,_n)?Ge.moveBack=0:Ut.matchKey(a.keyMoveLeft,rh,gt,_n)?Ge.moveLeft=0:Ut.matchKey(a.keyMoveRight,rh,gt,_n)?Ge.moveRight=0:Ut.matchKey(a.keyMoveUp,rh,gt,_n)?Ge.moveUp=0:Ut.matchKey(a.keyMoveDown,rh,gt,_n)?Ge.moveDown=0:Ut.matchKey(a.keyRollLeft,rh,gt,_n)?Ge.rollLeft=0:Ut.matchKey(a.keyRollRight,rh,gt,_n)?Ge.rollRight=0:Ut.matchKey(a.keyPitchUp,rh,gt,_n)?Ge.pitchUp=0:Ut.matchKey(a.keyPitchDown,rh,gt,_n)?Ge.pitchDown=0:Ut.matchKey(a.keyYawLeft,rh,gt,_n)?Ge.yawLeft=0:Ut.matchKey(a.keyYawRight,rh,gt,_n)&&(Ge.yawRight=0);Ut.matchKey(a.boostMove,Jt,gt,_n)&&(Ge.boostMove=0)}),y=n.move.subscribe(function we({movementX:gt,movementY:Jt}){if(!n.pointerLock||void 0===gt||void 0===Jt)return;const _n=.5*l.width-l.x,Xi=.5*l.height-l.y;Ue.copy(M,se(_n,Xi)),Ue.copy(E,se(gt+_n,Jt+Xi))}),v=n.lock.subscribe(function pn(gt){gt?Ft():Vt()}),x=n.leave.subscribe(function Jn(){!function Pr(){Ge.moveForward=0,Ge.moveBack=0,Ge.moveLeft=0,Ge.moveRight=0,Ge.moveUp=0,Ge.moveDown=0,Ge.rollLeft=0,Ge.rollRight=0,Ge.pitchUp=0,Ge.pitchDown=0,Ge.yawLeft=0,Ge.yawRight=0,Ge.boostMove=0}()});let _=!1;const w=C(),A=C(),M=Ue(),E=Ue(),D=C();let T=0;const F=Ue(),R=Ue();let N=0,j=0,W=0;const z=Ue(),$=Ue(),V=Ue(),X=Ue(),H=Ue(),oe=Ue(),te=C.clone(r.target),K=C.clone(r.position),Q=C.clone(r.up),G=Ue(),ee=Ue();function se(gt,Jt){return Ue.set(ee,(gt-.5*l.width-l.x)/(.5*l.width),(l.height+2*(l.y-Jt))/l.width)}function xe(){return s.rotateSpeed*n.pixelRatio*(n.width/n.height)}const re=C(),ae=Ai(),ge=C(),Ie=C(),me=C(),Ae=C(),ie=Ai(),ue=C(),Fe=Ai(),Ze=C(),q=Ai(),ne=C(),Be=Ue(),$e=C(),nt=C(),Ge={moveUp:0,moveDown:0,moveLeft:0,moveRight:0,moveForward:0,moveBack:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0,boostMove:0},ft=C(),vt=C();function St(){const gt=Math.min(Math.max(1e3*r.state.radiusMax,.01),s.maxDistance);C.squaredMagnitude(A)>gt*gt&&(C.setMagnitude(A,A,gt),C.add(r.position,r.target,A),Ue.copy(z,$),Ue.copy(V,X)),C.squaredMagnitude(A)l.x+l.width||n.height-Jt>l.y+l.height||gt0&&("spin"===s.animate.name?function _c(gt){if("spin"!==s.animate.name||0===s.animate.params.speed||_)return;const Jt=s.animate.params.speed/1e3;ns[0]=60*Math.min(Math.abs(gt),125)/1e3*Jt,Ue.add(E,M,ns)}(Jt):"rock"===s.animate.name&&function vm(gt){if("rock"!==s.animate.name||0===s.animate.params.speed||_)return;const Jt=gt/1e3*s.animate.params.speed,_n=Xr(s.animate.params.angle)/xe(),Xi=Math.sin(Js*Math.PI*2)*_n,Sc=Math.sin((Js+Jt)*Math.PI*2)*_n;id[0]=Sc-Xi,Ue.add(E,M,id),Js+=Jt,Js>=1&&(Js=0)}(Jt)),C.sub(A,r.position,r.target),function he(){const gt=E[0]-M[0],Jt=E[1]-M[1];C.set(Ae,gt,Jt,0);const _n=C.magnitude(Ae)*xe();_n?(C.sub(A,r.position,r.target),C.normalize(ge,A),C.normalize(Ie,r.up),C.normalize(me,C.cross(me,Ie,ge)),C.setMagnitude(Ie,Ie,Jt),C.setMagnitude(me,me,gt),C.add(Ae,Ie,me),C.normalize(re,C.cross(re,Ae,A)),Ai.setAxisAngle(ae,re,_n),C.transformQuat(A,A,ae),C.transformQuat(r.up,r.up,ae),C.copy(D,re),T=_n):!s.staticMoving&&T&&(T*=Math.sqrt(1-s.dynamicDampingFactor),C.sub(A,r.position,r.target),Ai.setAxisAngle(ae,D,T),C.transformQuat(A,A,ae),C.transformQuat(r.up,r.up,ae)),Ue.copy(M,E)}(),function _e(){const gt=(Ge.rollRight-Ge.rollLeft)/45,Jt=(R[0]-F[0])*-Math.sign(R[1]),_n=(R[1]-F[1])*-Math.sign(R[0]),Xi=-s.rotateSpeed*(-Jt+_n)+gt;Xi?(C.normalize(ue,A),Ai.setAxisAngle(ie,ue,Xi),C.transformQuat(r.up,r.up,ie),N=Xi):!s.staticMoving&&N&&(N*=Math.sqrt(1-s.dynamicDampingFactor),C.normalize(ue,A),Ai.setAxisAngle(ie,ue,N),C.transformQuat(r.up,r.up,ie)),Ue.copy(F,R)}(),function ct(){const Jt=(Ge.pitchUp-Ge.pitchDown)/(s.flyMode?360:90)*-s.rotateSpeed;Jt?(C.cross(Ze,A,r.up),C.normalize(Ze,Ze),Ai.setAxisAngle(Fe,Ze,Jt),C.transformQuat(A,A,Fe),C.transformQuat(r.up,r.up,Fe),j=Jt):!s.staticMoving&&j&&(j*=Math.sqrt(1-s.dynamicDampingFactor),C.cross(Ze,A,r.up),C.normalize(Ze,Ze),Ai.setAxisAngle(Fe,Ze,j),C.transformQuat(A,A,Fe),C.transformQuat(r.up,r.up,Fe))}(),function be(){const Jt=(Ge.yawRight-Ge.yawLeft)/(s.flyMode?360:90)*-s.rotateSpeed;Jt?(C.normalize(ne,r.up),Ai.setAxisAngle(q,ne,Jt),C.transformQuat(A,A,q),C.transformQuat(r.up,r.up,q),W=Jt):!s.staticMoving&&W&&(W*=Math.sqrt(1-s.dynamicDampingFactor),C.normalize(ne,r.up),Ai.setAxisAngle(q,ne,W),C.transformQuat(A,A,q),C.transformQuat(r.up,r.up,q))}(),function Ce(){const gt=1+($[1]-z[1])*s.zoomSpeed;1!==gt&>>0&&C.scale(A,A,gt),s.staticMoving?Ue.copy(z,$):z[1]+=($[1]-z[1])*s.dynamicDampingFactor}(),function Re(){const gt=(X[1]-V[1])*s.zoomSpeed;if(0!==gt){const Jt=Math.max(1,r.state.radius+r.state.radius*gt);r.setState({radius:Jt})}s.staticMoving?Ue.copy(V,X):V[1]+=(X[1]-V[1])*s.dynamicDampingFactor}(),function ht(){if(Ue.sub(Be,Ue.copy(Be,oe),H),Ue.squaredMagnitude(Be)){const gt=n.pixelRatio*s.panSpeed;Be[0]*=1/r.zoom*r.viewport.width*gt,Be[1]*=1/r.zoom*r.viewport.height*gt,C.cross(nt,C.copy(nt,A),r.up),C.setMagnitude(nt,nt,Be[0]),C.setMagnitude($e,r.up,Be[1]),C.add(nt,nt,$e),C.add(r.position,r.position,nt),C.add(r.target,r.target,nt),s.staticMoving?Ue.copy(H,oe):(Ue.sub(Be,oe,H),Ue.scale(Be,Be,s.dynamicDampingFactor),Ue.add(H,H,Be))}}(),C.add(r.position,r.target,A),St(),Qt>0&&function Pt(gt){C.sub(vt,r.position,r.target);const Jt=Math.max(r.state.minNear,s.minDistance);C.setMagnitude(vt,vt,Jt);const _n=.06*gt*s.moveSpeed*(1===Ge.boostMove?s.boostMoveFactor:1);if(1===Ge.moveForward&&(C.normalize(ft,vt),C.scaleAndSub(r.position,r.position,ft,_n),(s.flyMode||n.pointerLock)&&C.sub(r.target,r.position,vt)),1===Ge.moveBack&&(C.normalize(ft,vt),C.scaleAndAdd(r.position,r.position,ft,_n),(s.flyMode||n.pointerLock)&&C.sub(r.target,r.position,vt)),1===Ge.moveLeft&&(C.cross(ft,vt,r.up),C.normalize(ft,ft),s.flyMode||n.pointerLock?(C.scaleAndAdd(r.position,r.position,ft,_n),C.sub(r.target,r.position,vt)):(C.scaleAndSub(r.position,r.position,ft,_n),C.sub(r.target,r.position,A))),1===Ge.moveRight&&(C.cross(ft,vt,r.up),C.normalize(ft,ft),s.flyMode||n.pointerLock?(C.scaleAndSub(r.position,r.position,ft,_n),C.sub(r.target,r.position,vt)):(C.scaleAndAdd(r.position,r.position,ft,_n),C.sub(r.target,r.position,A))),1===Ge.moveUp&&(C.normalize(ft,r.up),s.flyMode||n.pointerLock?(C.scaleAndAdd(r.position,r.position,ft,_n),C.sub(r.target,r.position,vt)):(C.scaleAndSub(r.position,r.position,ft,_n),C.sub(r.target,r.position,A))),1===Ge.moveDown&&(C.normalize(ft,r.up),s.flyMode||n.pointerLock?(C.scaleAndSub(r.position,r.position,ft,_n),C.sub(r.target,r.position,vt)):(C.scaleAndAdd(r.position,r.position,ft,_n),C.sub(r.target,r.position,A))),s.flyMode||n.pointerLock){const Xi=C.distance(r.position,i.boundingSphereVisible.center);r.setState({minFar:Xi+i.boundingSphereVisible.radius})}}(Math.min(Jt,250)),C.sub(A,r.position,r.target),St(),C.squaredDistance(w,r.position)>wi&&C.copy(w,r.position),Qt=gt}function Ft(){C.sub(vt,r.position,r.target);const gt=Math.max(r.state.minNear,s.minDistance);C.setMagnitude(vt,vt,gt),C.sub(r.target,r.position,vt);const Jt=C.distance(r.position,i.boundingSphereVisible.center);r.setState({minFar:Jt+i.boundingSphereVisible.radius})}function Vt(){const{center:gt,radius:Jt}=i.boundingSphereVisible;if(C.distance(r.position,gt)>Jt){const Xi=r.getFocus(gt,Jt);r.setState({...Xi,minFar:0})}else r.setState({minFar:0,radius:i.boundingSphereVisible.radius})}const ns=Ue.create(.005,0);let Js=0;const id=Ue.create(.005,0);function Qe(){Js=0}return{viewport:l,get isAnimating(){return"off"!==s.animate.name},get isMoving(){return 1===Ge.moveForward||1===Ge.moveBack||1===Ge.moveLeft||1===Ge.moveRight||1===Ge.moveUp||1===Ge.moveDown||1===Ge.rollLeft||1===Ge.rollRight||1===Ge.pitchUp||1===Ge.pitchDown||1===Ge.yawLeft||1===Ge.yawRight},get props(){return s},setProps:gt=>{var Jt;"rock"===(null===(Jt=gt.animate)||void 0===Jt?void 0:Jt.name)&&"rock"!==s.animate.name&&Qe(),void 0!==gt.flyMode&>.flyMode!==s.flyMode&&(gt.flyMode?Ft():Vt()),Object.assign(s,gt),Object.assign(a,gt.bindings)},start:function Mn(gt){Qt=-1,An(gt)},update:An,reset:function Kn(){C.copy(r.target,te),C.copy(r.position,K),C.copy(r.up,Q),C.sub(A,r.position,r.target),C.copy(w,r.position)},dispose:function bi(){c||(c=!0,u.unsubscribe(),f.unsubscribe(),p.unsubscribe(),m.unsubscribe(),d.unsubscribe(),h.unsubscribe(),g.unsubscribe(),y.unsubscribe(),v.unsubscribe(),x.unsubscribe())}}}}(wq||(wq={})),function(e){e.create=function t(){return{view:fe.identity(),position:C.create(0,0,0),direction:C.create(0,0,-1),up:C.create(0,1,0)}};const n=C.zero();e.update=function r(i){C.add(n,i.position,i.direction),fe.lookAt(i.view,i.position,n,i.up)}}(IF||(IF={}));class Qct{constructor(){this.removeList=KU(),this.removeMap=new Map,this.addList=KU(),this.addMap=new Map}get isEmpty(){return 0===this.removeList.count&&0===this.addList.count}get size(){return this.removeMap.size+this.addMap.size}add(t){if(this.removeMap.has(t)){const r=this.removeMap.get(t);this.removeMap.delete(t),this.removeList.remove(r)}if(this.addMap.has(t))return;const n=this.addList.addLast(t);this.addMap.set(t,n)}remove(t){if(this.addMap.has(t)){const r=this.addMap.get(t);this.addMap.delete(t),this.addList.remove(r)}if(this.removeMap.has(t))return;const n=this.removeList.addLast(t);this.removeMap.set(t,n)}tryGetRemove(){const t=this.removeList.removeFirst();return t&&this.removeMap.delete(t),t}tryGetAdd(){const t=this.addList.removeFirst();return t&&this.addMap.delete(t),t}}const AP=new xf("98");function i0e(e,t,n){AP.reset();for(let r=0,i=e.length;r{r=V;for(let X=0,H=o.length;XF.add(V),remove:V=>F.remove(V),commit:(V=Number.MAX_VALUE)=>function T(V){const X=Bo();let H=0;for(;;){const oe=F.tryGetRemove();if(!oe)break;if(E(oe),++H%100==0&&Bo()-X>V)return!1}for(;;){const oe=F.tryGetAdd();if(!oe)break;if(M(oe),++H%100==0&&Bo()-X>V)return!1}return o.sort(Jct),f=!0,p=!0,m=!0,!0}(V),get commitQueueSize(){return F.size},get needsCommit(){return!F.isEmpty},has:V=>i.has(V),clear:()=>{for(let V=0,X=o.length;V{i.forEach(V)},get count(){return o.length},get boundingSphere(){return u&&(i0e(o,s,!1),u=!1),s},get boundingSphereVisible(){return d&&(i0e(o,a,!0),d=!1),a},get markerAverage(){return f&&(h=function W(){if(0===l.length)return 0;let V=0,X=0;for(let H=0,oe=l.length;H0?X/V:0}(),f=!1),h},get opacityAverage(){return p&&(g=function z(){var V,X;if(0===l.length)return 0;let H=0,oe=0;for(let te=0,K=l.length;te0?oe/H:0}(),p=!1),g},get hasOpaque(){return m&&(y=function $(){var V;if(0===l.length)return!1;for(let X=0,H=l.length;X0)&&Si.copySnapshot(this._source,this.camera.state),this.inTransition||Si.copySnapshot(this._target,this.camera.state),Si.copySnapshot(this._target,t),this._target.radius>this._target.radiusMax&&(this._target.radius=this._target.radiusMax),this._target.radius<.01&&(this._target.radius=.01),this._target.radiusMax<.01&&(this._target.radiusMax=.01),!this.inTransition&&n<=0||typeof t.mode<"u"&&t.mode!==this.camera.state.mode?this.finish(this._target):(this.inTransition=!0,this.func=r||SA.defaultTransition,(!this.inTransition||n>0)&&(this.start=this.t,this.durationMs=n))}tick(t){this.t=t,this.update()}finish(t){Si.copySnapshot(this.camera.state,t),this.inTransition=!1}update(){if(!this.inTransition)return;const t=Math.min((this.t-this.start)/this.durationMs,1);1!==t?(this.func(this._current,t,this._source,this._target),Si.copySnapshot(this.camera.state,this._current)):this.finish(this._target)}constructor(t){this.camera=t,this.t=0,this.func=SA.defaultTransition,this.start=0,this.inTransition=!1,this.durationMs=0,this._source=Si.createDefaultSnapshot(),this._target=Si.createDefaultSnapshot(),this._current=Si.createDefaultSnapshot()}}!function(e){const t=Ai.identity();e.defaultTransition=function n(r,i,o,s){Si.copySnapshot(r,s),Ai.slerp(t,Ai.Identity,Ai.rotationTo(t,o.up,s.up),i),C.transformQuat(r.up,o.up,t),C.lerp(r.target,o.target,s.target,i),C.lerp(r.position,o.position,s.position,i),r.radius=Po(o.radius,s.radius,i),r.radiusMax=Po(o.radiusMax,s.radiusMax,i),r.fov=Po(o.fov,s.fov,i),r.fog=Po(o.fog,s.fog,i)}}(SA||(SA={}));const o0e=C(),s0e=C(),EF=Bn();class Si{get position(){return this.state.position}set position(t){C.copy(this.state.position,t)}get up(){return this.state.up}set up(t){C.copy(this.state.up,t)}get target(){return this.state.target}set target(t){C.copy(this.state.target,t)}update(){const t=this.state;if(0===t.radiusMax)return!1;const n=2*Math.tan(t.fov/2)*C.distance(t.position,t.target);switch(this.zoom=this.viewport.height/n,function nut(e){let{radius:t,radiusMax:n,fog:i,clipFar:o,minNear:s,minFar:a}=e.state;t<.01&&(t=.01);const l=Math.max(o?t:n,a),c=C.distance(e.position,e.target);let u=c-t,d=c+l;u=Math.max(Math.min(n,s),u),d=Math.max(s,d),u===d&&(d=u+.01);const p=c-l*(-(50-i)/50),m=d;e.near=u,e.far=d,e.fogNear=p,e.fogFar=m}(this),this.state.mode){case"orthographic":!function eut(e){const{viewport:t,zoom:n,near:r,far:i,viewOffset:o}=e,s=-t.width/2,a=t.width/2,l=t.height/2,c=-t.height/2,u=(a-s)/(2*n),d=(l-c)/(2*n),f=(a+s)/2,p=(l+c)/2;let m=f-u,h=f+u,g=p+d,y=p-d;if(o.enabled){const v=n/(o.width/o.fullWidth),x=n/(o.height/o.fullHeight),_=(a-s)/o.width,w=(l-c)/o.height;m+=_*(o.offsetX/v),h=m+_*(o.width/v),g-=w*(o.offsetY/x),y=g-w*(o.height/x)}fe.ortho(e.projection,m,h,g,y,r,i),fe.lookAt(e.view,e.position,e.target,e.up)}(this);break;case"perspective":!function tut(e){const t=e.viewport.width/e.viewport.height,{near:n,far:r,viewOffset:i}=e;let o=n*Math.tan(.5*e.state.fov),s=2*o,a=t*s,l=-.5*a;i.enabled&&(l+=i.offsetX*a/i.fullWidth,o-=i.offsetY*s/i.fullHeight,a*=i.width/i.fullWidth,s*=i.height/i.fullHeight),fe.perspective(e.projection,l,l+a,o,o-s,n,r),fe.lookAt(e.view,e.position,e.target,e.up)}(this);break;default:Hi()}const r=!fe.areEqual(this.projection,this.prevProjection,wi)||!fe.areEqual(this.view,this.prevView,wi);if(r){if(fe.mul(this.projectionView,this.projection,this.view),!fe.tryInvert(this.inverseProjectionView,this.projectionView))return fe.copy(this.view,this.prevView),fe.copy(this.projection,this.prevProjection),fe.mul(this.projectionView,this.projection,this.view),!1;fe.copy(this.prevView,this.view),fe.copy(this.prevProjection,this.projection)}return r}setState(t,n){this.transition.apply(t,n),this.stateChanged.next(t)}getSnapshot(){return Si.copySnapshot(Si.createDefaultSnapshot(),this.state)}getTargetDistance(t){return Si.targetDistance(t,this.state.mode,this.state.fov,this.viewport.width,this.viewport.height)}getFocus(t,n,r,i,o){var s,a;const l=Math.max(n,.01),c=this.getTargetDistance(l);C.sub(this.deltaDirection,null!==(s=o?.target)&&void 0!==s?s:this.target,null!==(a=o?.position)&&void 0!==a?a:this.position),i&&C.matchDirection(this.deltaDirection,i,this.deltaDirection),C.setMagnitude(this.deltaDirection,this.deltaDirection,c),C.sub(this.newPosition,t,this.deltaDirection);const u=Si.copySnapshot(Si.createDefaultSnapshot(),this.state);return u.target=C.clone(t),u.radius=l,u.position=C.clone(this.newPosition),r&&C.matchDirection(u.up,r,u.up),u}getCenter(t,n){C.sub(this.deltaDirection,this.target,this.position),C.sub(this.newPosition,t,this.deltaDirection);const r=Si.copySnapshot(Si.createDefaultSnapshot(),this.state);return r.target=C.clone(t),r.position=C.clone(this.newPosition),n&&(r.radius=Math.max(n,.01)),r}getInvariantFocus(t,n,r,i){const o=Math.max(n,.01),s=this.getTargetDistance(o);C.copy(this.deltaDirection,i),C.setMagnitude(this.deltaDirection,this.deltaDirection,s),C.sub(this.newPosition,t,this.deltaDirection);const a=Si.copySnapshot(Si.createDefaultSnapshot(),this.state);return a.target=C.clone(t),a.radius=o,a.position=C.clone(this.newPosition),C.copy(a.up,r),a}focus(t,n,r,i,o){n>0&&this.setState(this.getFocus(t,n,i,o),r)}center(t,n){this.setState(this.getCenter(t),n)}project(t,n){return function Wct(e,t,n,r){const{x:i,y:o,width:s,height:a}=n;Bn.set(Tg,t[0],t[1],t[2],1),Bn.transformMat4(Tg,Tg,r);const l=Tg[3];return 0!==l&&(Tg[0]/=l,Tg[1]/=l,Tg[2]/=l),e[0]=(Tg[0]+1)*s*.5+i,e[1]=(Tg[1]+1)*a*.5+o,e[2]=.5*(Tg[2]+1),e[3]=0===l?0:1/l,e}(t,n,this.viewport,this.projectionView)}unproject(t,n){return CF(t,n,this.viewport,this.inverseProjectionView)}getPixelSize(t){return this.project(EF,t),this.unproject(o0e,EF),EF[0]+=1,this.unproject(s0e,EF),C.distance(o0e,s0e)}constructor(t,n=Da.create(0,0,128,128)){this.view=fe.identity(),this.projection=fe.identity(),this.projectionView=fe.identity(),this.inverseProjectionView=fe.identity(),this.state=Si.createDefaultSnapshot(),this.viewOffset=Si.ViewOffset(),this.near=1,this.far=1e4,this.fogNear=5e3,this.fogFar=1e4,this.zoom=1,this.transition=new SA(this),this.stateChanged=new Ao(this.state),this.prevProjection=fe.identity(),this.prevView=fe.identity(),this.deltaDirection=C(),this.newPosition=C(),this.viewport=n,Si.copySnapshot(this.state,t)}}!function(e){e.ViewOffset=function t(){return{enabled:!1,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}},e.setViewOffset=function n(l,c,u,d,f,p,m){l.fullWidth=c,l.fullHeight=u,l.offsetX=d,l.offsetY=f,l.width=p,l.height=m},e.copyViewOffset=function r(l,c){l.enabled=c.enabled,l.fullWidth=c.fullWidth,l.fullHeight=c.fullHeight,l.offsetX=c.offsetX,l.offsetY=c.offsetY,l.width=c.width,l.height=c.height},e.targetDistance=function i(l,c,u,d,f){const p=Math.max(l,.01),h=f{const o=this.objectsData.get(i),s=TF(this.scene,r.values.boundingSphere.ref.value,o,qn.tomato,aut);s&&this.objectsData.set(i,s);const a=this.instancesData.get(i),l=TF(this.scene,r.values.invariantBoundingSphere.ref.value,a,qn.skyblue,lut,{aTransform:i.values.aTransform,matrix:i.values.matrix,transform:i.values.transform,extraTransform:i.values.extraTransform,uInstanceCount:i.values.uInstanceCount,instanceCount:i.values.instanceCount,aInstance:i.values.aInstance,hasReflection:i.values.hasReflection,instanceGrid:i.values.instanceGrid});l&&this.instancesData.set(i,l)}),this.objectsData.forEach((r,i)=>{this.parent.has(i)||(this.scene.remove(r.renderObject),this.objectsData.delete(i))}),this.instancesData.forEach((r,i)=>{this.parent.has(i)||(this.scene.remove(r.renderObject),this.instancesData.delete(i))}),this.scene.update(void 0,!1),this.scene.commit()}syncVisibility(){this.sceneData&&(this.sceneData.renderObject.state.visible=this._props.sceneBoundingSpheres),this.visibleSceneData&&(this.visibleSceneData.renderObject.state.visible=this._props.visibleSceneBoundingSpheres),this.parent.forEach((t,n)=>{const r=this.objectsData.get(n);r&&(r.renderObject.state.visible=n.state.visible&&this._props.objectBoundingSpheres);const i=this.instancesData.get(n);i&&(i.renderObject.state.visible=n.state.visible&&this._props.instanceBoundingSpheres)})}clear(){this.sceneData=void 0,this.objectsData.clear(),this.scene.clear()}get isEnabled(){return this._props.sceneBoundingSpheres||this._props.visibleSceneBoundingSpheres||this._props.objectBoundingSpheres||this._props.instanceBoundingSpheres}get props(){return this._props}setProps(t){Object.assign(this._props,t),this.isEnabled&&this.update()}}function TF(e,t,n,r,i,o){if(!n||!ke.equals(n.boundingSphere,t)){const s=function iut(e,t){const r=qw(2),i=Ct.createState(r,r/2,t);if(e.radius&&(Jr(i,e.center,e.radius,2),ke.hasExtrema(e)))for(const o of e.extrema)Jr(i,o,1,0);return Ct.getMesh(i)}(t,n&&n.mesh),a=n?n.renderObject:function cut(e,t,n,r){return Jw("mesh",on.Utils.createValuesSimple(e,{alpha:.1,doubleSided:!1,cellSize:0,batchSize:0},t,1,r),{disposed:!1,visible:!0,alphaFactor:1,pickable:!1,colorOnly:!1,opaque:!1,writeDepth:!1},n)}(s,r,i,o);return n?O.updateIfChanged(a.values.drawCount,$a.getDrawCount(s)):e.add(a),{boundingSphere:ke.clone(t),renderObject:a,mesh:s}}}const out=ky(),sut=ky(),aut=ky(),lut=ky();var Y_=function(e){return e[e.Move=0]="Move",e[e.Click=1]="Click",e[e.Drag=2]="Drag",e}(Y_||{});const Iq=C(),Eq=C(),a0e=C(),l0e={maxFps:I.Numeric(30,{min:10,max:60,step:10}),preferAtomPixelPadding:I.Numeric(3,{min:0,max:20,step:1},{description:"Number of extra pixels at which to prefer atoms over bonds."})};class uut{setProps(t){Object.assign(this.props,t)}identify(t,n){const r=this.startX!==this.endX||this.startY!==this.endY||this.input.pointerLock&&!this.controls.isMoving;if(t===Y_.Drag)return void(r&&!this.outsideViewport(this.startX,this.startY)&&(this.events.drag.next({current:this.prevLoci,buttons:this.buttons,button:this.button,modifiers:this.modifiers,pageStart:Ue.create(this.startX,this.startY),pageEnd:Ue.create(this.endX,this.endY)}),this.startX=this.endX,this.startY=this.endY));if(r){const o=this.canvasIdentify(this.endX,this.endY);this.id=o?.id,this.position=o?.position,this.startX=this.endX,this.startY=this.endY}if(t===Y_.Click){const o=this.getLoci(this.id,this.position);return this.events.click.next({current:o,buttons:this.buttons,button:this.button,modifiers:this.modifiers,page:Ue.create(this.endX,this.endY),position:this.position}),void(this.prevLoci=o)}if(!this.inside||this.currentIdentifyT!==n||!r||this.outsideViewport(this.endX,this.endY))return;const i=this.getLoci(this.id,this.position);this.events.hover.next({current:i,buttons:this.buttons,button:this.button,modifiers:this.modifiers,page:Ue.create(this.endX,this.endY),position:this.position}),this.prevLoci=i}tick(t){this.inside&&t-this.prevT>1e3/this.props.maxFps&&(this.prevT=t,this.currentIdentifyT=t,this.identify(this.isInteracting?Y_.Drag:Y_.Move,t))}leave(){this.inside=!1,Xn.Loci.isEmpty(this.prevLoci)||(this.prevLoci=Xn.Loci.Empty,this.events.hover.next({current:this.prevLoci,buttons:this.buttons,button:this.button,modifiers:this.modifiers}))}move(t,n,r,i,o){this.inside=!0,this.buttons=r,this.button=i,this.modifiers=o,this.endX=t,this.endY=n}click(t,n,r,i,o){this.endX=t,this.endY=n,this.buttons=r,this.button=i,this.modifiers=o,this.identify(Y_.Click,0)}drag(t,n,r,i,o){this.endX=t,this.endY=n,this.buttons=r,this.button=i,this.modifiers=o,this.identify(Y_.Drag,0)}modify(t){Rf.areEqual(t,this.modifiers)||(this.modifiers=t,this.events.hover.next({current:this.prevLoci,buttons:this.buttons,button:this.button,modifiers:this.modifiers,page:Ue.create(this.endX,this.endY),position:this.position}))}outsideViewport(t,n){const{input:r,camera:{viewport:i}}=this;return n*=r.pixelRatio,(t*=r.pixelRatio)>i.x+i.width||r.height-n>i.y+i.height||t{this.isInteracting=!0,this.drag(a,l,c,u,d)}),r.move.subscribe(({x:a,y:l,inside:c,buttons:u,button:d,modifiers:f,onElement:p})=>{if(c&&!this.isInteracting){if(!p)return void this.leave();this.move(a,l,u,d,f)}}),r.leave.subscribe(()=>{this.leave()}),r.click.subscribe(({x:a,y:l,buttons:c,button:u,modifiers:d})=>{this.outsideViewport(a,l)||this.click(a,l,c,u,d)}),r.interactionEnd.subscribe(()=>{this.isInteracting=!1}),r.modifiers.subscribe(a=>{this.modify(a)})}}const gut={edgeThresholdMin:I.Numeric(.0312,{min:.0312,max:.0833,step:1e-4},{description:"Trims the algorithm from processing darks."}),edgeThresholdMax:I.Numeric(.063,{min:.063,max:.333,step:.001},{description:"The minimum amount of local contrast required to apply algorithm."}),iterations:I.Numeric(12,{min:0,max:16,step:1},{description:"Number of edge exploration steps."}),subpixelQuality:I.Numeric(.3,{min:0,max:1,step:.01},{description:"Choose the amount of sub-pixel aliasing removal."})};class yut{constructor(t,n){this.webgl=t,this.renderable=function xut(e,t){const n=t.getWidth(),r=t.getHeight(),i={...ua,tColor:O.create(t),uTexSizeInv:O.create(Ue.create(1/n,1/r)),dEdgeThresholdMin:O.create(.0312),dEdgeThresholdMax:O.create(.125),dIterations:O.create(12),dSubpixelQuality:O.create(.3)},o={...but};return ys(ms(e,"triangles",vut,o,i),i)}(t,n)}updateState(t){const{gl:n,state:r}=this.webgl;r.enable(n.SCISSOR_TEST),r.disable(n.BLEND),r.disable(n.DEPTH_TEST),r.depthMask(!1);const{x:i,y:o,width:s,height:a}=t;r.viewport(i,o,s,a),r.scissor(i,o,s,a),r.clearColor(0,0,0,1),n.clear(n.COLOR_BUFFER_BIT)}setSize(t,n){O.update(this.renderable.values.uTexSizeInv,Ue.set(this.renderable.values.uTexSizeInv.ref.value,1/t,1/n))}update(t,n){const{values:r}=this.renderable,{edgeThresholdMin:i,edgeThresholdMax:o,iterations:s,subpixelQuality:a}=n;let l=!1;r.tColor.ref.value!==t&&(O.update(this.renderable.values.tColor,t),l=!0),r.dEdgeThresholdMin.ref.value!==i&&(l=!0),O.updateIfChanged(r.dEdgeThresholdMin,i),r.dEdgeThresholdMax.ref.value!==o&&(l=!0),O.updateIfChanged(r.dEdgeThresholdMax,o),r.dIterations.ref.value!==s&&(l=!0),O.updateIfChanged(r.dIterations,s),r.dSubpixelQuality.ref.value!==a&&(l=!0),O.updateIfChanged(r.dSubpixelQuality,a),l&&this.renderable.update()}render(t,n){It&&this.webgl.timer.mark("FxaaPass.render"),n?n.bind():this.webgl.unbindFramebuffer(),this.updateState(t),this.renderable.render(),It&&this.webgl.timer.markEnd("FxaaPass.render")}}const but={...ca,tColor:xn("texture","rgba","ubyte","linear"),uTexSizeInv:Ne("v2"),dEdgeThresholdMin:cn("number"),dEdgeThresholdMax:cn("number"),dIterations:cn("number"),dSubpixelQuality:cn("number")},vut=Wi("fxaa",hl,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\n// adapted from https://github.com/kosua20/Rendu\n// MIT License Copyright (c) 2017 Simon Rodriguez\n\n#define QUALITY(q) ((q) < 5 ? 1.0 : ((q) > 5 ? ((q) < 10 ? 2.0 : ((q) < 11 ? 4.0 : 8.0)) : 1.5))\n\nfloat rgb2luma(vec3 rgb){\n return sqrt(dot(rgb, vec3(0.299, 0.587, 0.114)));\n}\n\nfloat sampleLuma(vec2 uv) {\n return rgb2luma(texture2D(tColor, uv).rgb);\n}\n\nfloat sampleLuma(vec2 uv, float uOffset, float vOffset) {\n uv += uTexSizeInv * vec2(uOffset, vOffset);\n return sampleLuma(uv);\n}\n\nvoid main(void) {\n vec2 coords = gl_FragCoord.xy * uTexSizeInv;\n vec2 inverseScreenSize = uTexSizeInv;\n\n vec4 colorCenter = texture2D(tColor, coords);\n\n // Luma at the current fragment\n float lumaCenter = rgb2luma(colorCenter.rgb);\n\n // Luma at the four direct neighbours of the current fragment.\n float lumaDown = sampleLuma(coords, 0.0, -1.0);\n float lumaUp = sampleLuma(coords, 0.0, 1.0);\n float lumaLeft = sampleLuma(coords, -1.0, 0.0);\n float lumaRight = sampleLuma(coords, 1.0, 0.0);\n\n // Find the maximum and minimum luma around the current fragment.\n float lumaMin = min(lumaCenter, min(min(lumaDown, lumaUp), min(lumaLeft, lumaRight)));\n float lumaMax = max(lumaCenter, max(max(lumaDown, lumaUp), max(lumaLeft, lumaRight)));\n\n // Compute the delta.\n float lumaRange = lumaMax - lumaMin;\n\n // If the luma variation is lower that a threshold (or if we are in a really dark area),\n // we are not on an edge, don't perform any AA.\n if (lumaRange < max(dEdgeThresholdMin, lumaMax * dEdgeThresholdMax)) {\n gl_FragColor = colorCenter;\n return;\n }\n\n // Query the 4 remaining corners lumas.\n float lumaDownLeft = sampleLuma(coords, -1.0, -1.0);\n float lumaUpRight = sampleLuma(coords, 1.0, 1.0);\n float lumaUpLeft = sampleLuma(coords, -1.0, 1.0);\n float lumaDownRight = sampleLuma(coords, 1.0, -1.0);\n\n // Combine the four edges lumas (using intermediary variables for future computations\n // with the same values).\n float lumaDownUp = lumaDown + lumaUp;\n float lumaLeftRight = lumaLeft + lumaRight;\n\n // Same for corners\n float lumaLeftCorners = lumaDownLeft + lumaUpLeft;\n float lumaDownCorners = lumaDownLeft + lumaDownRight;\n float lumaRightCorners = lumaDownRight + lumaUpRight;\n float lumaUpCorners = lumaUpRight + lumaUpLeft;\n\n // Compute an estimation of the gradient along the horizontal and vertical axis.\n float edgeHorizontal = abs(-2.0 * lumaLeft + lumaLeftCorners) + abs(-2.0 * lumaCenter + lumaDownUp) * 2.0 + abs(-2.0 * lumaRight + lumaRightCorners);\n float edgeVertical = abs(-2.0 * lumaUp + lumaUpCorners) + abs(-2.0 * lumaCenter + lumaLeftRight) * 2.0 + abs(-2.0 * lumaDown + lumaDownCorners);\n\n // Is the local edge horizontal or vertical ?\n bool isHorizontal = (edgeHorizontal >= edgeVertical);\n\n // Choose the step size (one pixel) accordingly.\n float stepLength = isHorizontal ? inverseScreenSize.y : inverseScreenSize.x;\n\n // Select the two neighboring texels lumas in the opposite direction to the local edge.\n float luma1 = isHorizontal ? lumaDown : lumaLeft;\n float luma2 = isHorizontal ? lumaUp : lumaRight;\n // Compute gradients in this direction.\n float gradient1 = luma1 - lumaCenter;\n float gradient2 = luma2 - lumaCenter;\n\n // Which direction is the steepest ?\n bool is1Steepest = abs(gradient1) >= abs(gradient2);\n\n // Gradient in the corresponding direction, normalized.\n float gradientScaled = 0.25 * max(abs(gradient1), abs(gradient2));\n\n // Average luma in the correct direction.\n float lumaLocalAverage = 0.0;\n if(is1Steepest){\n // Switch the direction\n stepLength = -stepLength;\n lumaLocalAverage = 0.5 * (luma1 + lumaCenter);\n } else {\n lumaLocalAverage = 0.5 * (luma2 + lumaCenter);\n }\n\n // Shift UV in the correct direction by half a pixel.\n vec2 currentUv = coords;\n if(isHorizontal){\n currentUv.y += stepLength * 0.5;\n } else {\n currentUv.x += stepLength * 0.5;\n }\n\n // Compute offset (for each iteration step) in the right direction.\n vec2 offset = isHorizontal ? vec2(inverseScreenSize.x, 0.0) : vec2(0.0, inverseScreenSize.y);\n // Compute UVs to explore on each side of the edge, orthogonally.\n // The QUALITY allows us to step faster.\n vec2 uv1 = currentUv - offset * QUALITY(0);\n vec2 uv2 = currentUv + offset * QUALITY(0);\n\n // Read the lumas at both current extremities of the exploration segment,\n // and compute the delta wrt to the local average luma.\n float lumaEnd1 = sampleLuma(uv1);\n float lumaEnd2 = sampleLuma(uv2);\n lumaEnd1 -= lumaLocalAverage;\n lumaEnd2 -= lumaLocalAverage;\n\n // If the luma deltas at the current extremities is larger than the local gradient,\n // we have reached the side of the edge.\n bool reached1 = abs(lumaEnd1) >= gradientScaled;\n bool reached2 = abs(lumaEnd2) >= gradientScaled;\n bool reachedBoth = reached1 && reached2;\n\n // If the side is not reached, we continue to explore in this direction.\n if(!reached1){\n uv1 -= offset * QUALITY(1);\n }\n if(!reached2){\n uv2 += offset * QUALITY(1);\n }\n\n // If both sides have not been reached, continue to explore.\n if(!reachedBoth){\n for(int i = 2; i < dIterations; i++){\n // If needed, read luma in 1st direction, compute delta.\n if(!reached1){\n lumaEnd1 = sampleLuma(uv1);\n lumaEnd1 = lumaEnd1 - lumaLocalAverage;\n }\n // If needed, read luma in opposite direction, compute delta.\n if(!reached2){\n lumaEnd2 = sampleLuma(uv2);\n lumaEnd2 = lumaEnd2 - lumaLocalAverage;\n }\n // If the luma deltas at the current extremities is larger than the local gradient,\n // we have reached the side of the edge.\n reached1 = abs(lumaEnd1) >= gradientScaled;\n reached2 = abs(lumaEnd2) >= gradientScaled;\n reachedBoth = reached1 && reached2;\n\n // If the side is not reached, we continue to explore in this direction,\n // with a variable quality.\n if(!reached1){\n uv1 -= offset * QUALITY(i);\n }\n if(!reached2){\n uv2 += offset * QUALITY(i);\n }\n\n // If both sides have been reached, stop the exploration.\n if(reachedBoth){\n break;\n }\n }\n }\n\n // Compute the distances to each side edge of the edge (!).\n float distance1 = isHorizontal ? (coords.x - uv1.x) : (coords.y - uv1.y);\n float distance2 = isHorizontal ? (uv2.x - coords.x) : (uv2.y - coords.y);\n\n // In which direction is the side of the edge closer ?\n bool isDirection1 = distance1 < distance2;\n float distanceFinal = min(distance1, distance2);\n\n // Thickness of the edge.\n float edgeThickness = (distance1 + distance2);\n\n // Is the luma at center smaller than the local average ?\n bool isLumaCenterSmaller = lumaCenter < lumaLocalAverage;\n\n // If the luma at center is smaller than at its neighbour,\n // the delta luma at each end should be positive (same variation).\n bool correctVariation1 = (lumaEnd1 < 0.0) != isLumaCenterSmaller;\n bool correctVariation2 = (lumaEnd2 < 0.0) != isLumaCenterSmaller;\n\n // Only keep the result in the direction of the closer side of the edge.\n bool correctVariation = isDirection1 ? correctVariation1 : correctVariation2;\n\n // UV offset: read in the direction of the closest side of the edge.\n float pixelOffset = - distanceFinal / edgeThickness + 0.5;\n\n // If the luma variation is incorrect, do not offset.\n float finalOffset = correctVariation ? pixelOffset : 0.0;\n\n // Sub-pixel shifting\n // Full weighted average of the luma over the 3x3 neighborhood.\n float lumaAverage = (1.0 / 12.0) * (2.0 * (lumaDownUp + lumaLeftRight) + lumaLeftCorners + lumaRightCorners);\n // Ratio of the delta between the global average and the center luma,\n // over the luma range in the 3x3 neighborhood.\n float subPixelOffset1 = clamp(abs(lumaAverage - lumaCenter) / lumaRange, 0.0, 1.0);\n float subPixelOffset2 = (-2.0 * subPixelOffset1 + 3.0) * subPixelOffset1 * subPixelOffset1;\n // Compute a sub-pixel offset based on this delta.\n float subPixelOffsetFinal = subPixelOffset2 * subPixelOffset2 * float(dSubpixelQuality);\n\n // Pick the biggest of the two offsets.\n finalOffset = max(finalOffset, subPixelOffsetFinal);\n\n // Compute the final UV coordinates.\n vec2 finalUv = coords;\n if(isHorizontal){\n finalUv.y += finalOffset * stepLength;\n } else {\n finalUv.x += finalOffset * stepLength;\n }\n\n // Read the color at the new UV coordinates, and use it.\n gl_FragColor = texture2D(tColor, finalUv);\n}\n"),Eut={edgeThreshold:I.Numeric(.1,{min:.05,max:.15,step:.01}),maxSearchSteps:I.Numeric(16,{min:0,max:32,step:1})};class Tut{get supported(){return this._supported}constructor(t,n){if(this.webgl=t,this._supported=!1,typeof HTMLImageElement>"u")return void($n&&console.log('Missing "HTMLImageElement" required for "SMAA"'));const r=n.getWidth(),i=n.getHeight();this.edgesTarget=t.createRenderTarget(r,i,!1,"uint8","linear"),this.weightsTarget=t.createRenderTarget(r,i,!1,"uint8","linear"),this.edgesRenderable=function kut(e,t){const n=t.getWidth(),r=t.getHeight(),i={...ua,tColor:O.create(t),uTexSizeInv:O.create(Ue.create(1/n,1/r)),uViewport:O.create(Bn()),dEdgeThreshold:O.create(.1)},o={...Dut};return ys(ms(e,"triangles",Put,o,i),i)}(t,n),this.weightsRenderable=function Nut(e,t){const n=t.getWidth(),r=t.getHeight(),i=e.resources.texture("image-uint8","rgb","ubyte","linear"),o=e.resources.texture("image-uint8","rgba","ubyte","nearest"),s={...ua,tEdges:O.create(t),tArea:O.create(i),tSearch:O.create(o),uTexSizeInv:O.create(Ue.create(1/n,1/r)),uViewport:O.create(Bn()),dMaxSearchSteps:O.create(16)};_de("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAIAAACOVPcQAACBeklEQVR42u39W4xlWXrnh/3WWvuciIzMrKxrV8/0rWbY0+SQFKcb4owIkSIFCjY9AC1BT/LYBozRi+EX+cV+8IMsYAaCwRcBwjzMiw2jAWtgwC8WR5Q8mDFHZLNHTarZGrLJJllt1W2qKrsumZWZcTvn7L3W54e1vrXX3vuciLPPORFR1XE2EomorB0nVuz//r71re/y/1eMvb4Cb3N11xV/PP/2v4UBAwJG/7H8urx6/25/Gf8O5hypMQ0EEEQwAqLfoN/Z+97f/SW+/NvcgQk4sGBJK6H7N4PFVL+K+e0N11yNfkKvwUdwdlUAXPHHL38oa15f/i/46Ih6SuMSPmLAYAwyRKn7dfMGH97jaMFBYCJUgotIC2YAdu+LyW9vvubxAP8kAL8H/koAuOKP3+q6+xGnd5kdYCeECnGIJViwGJMAkQKfDvB3WZxjLKGh8VSCCzhwEWBpMc5/kBbjawT4HnwJfhr+pPBIu7uu+OOTo9vsmtQcniMBGkKFd4jDWMSCRUpLjJYNJkM+IRzQ+PQvIeAMTrBS2LEiaiR9b/5PuT6Ap/AcfAFO4Y3dA3DFH7/VS+M8k4baEAQfMI4QfbVDDGIRg7GKaIY52qAjTAgTvGBAPGIIghOCYAUrGFNgzA7Q3QhgCwfwAnwe5vDejgG44o/fbm1C5ZlYQvQDARPAIQGxCWBM+wWl37ZQESb4gImexGMDouhGLx1Cst0Saa4b4AqO4Hk4gxo+3DHAV/nx27p3JziPM2pVgoiia5MdEzCGULprIN7gEEeQ5IQxEBBBQnxhsDb5auGmAAYcHMA9eAAz8PBol8/xij9+C4Djlim4gJjWcwZBhCBgMIIYxGAVIkH3ZtcBuLdtRFMWsPGoY9rN+HoBji9VBYdwD2ZQg4cnO7OSq/z4rU5KKdwVbFAjNojCQzTlCLPFSxtamwh2jMUcEgg2Wm/6XgErIBhBckQtGN3CzbVacERgCnfgLswhnvqf7QyAq/z4rRZm1YglYE3affGITaZsdIe2FmMIpnOCap25I6jt2kCwCW0D1uAD9sZctNGXcQIHCkINDQgc78aCr+zjtw3BU/ijdpw3zhCwcaONwBvdeS2YZKkJNJsMPf2JKEvC28RXxxI0ASJyzQCjCEQrO4Q7sFArEzjZhaFc4cdv+/JFdKULM4px0DfUBI2hIsy06BqLhGTQEVdbfAIZXYMPesq6VoCHICzUyjwInO4Y411//LYLs6TDa9wvg2CC2rElgAnpTBziThxaL22MYhzfkghz6GAs2VHbbdM91VZu1MEEpupMMwKyVTb5ij9+u4VJG/5EgEMMmFF01cFai3isRbKbzb+YaU/MQbAm2XSMoUPAmvZzbuKYRIFApbtlrfFuUGd6vq2hXNnH78ZLh/iFhsQG3T4D1ib7k5CC6vY0DCbtrohgLEIClXiGtl10zc0CnEGIhhatLBva7NP58Tvw0qE8yWhARLQ8h4+AhQSP+I4F5xoU+VilGRJs6wnS7ruti/4KvAY/CfdgqjsMy4pf8fodQO8/gnuX3f/3xi3om1/h7THr+co3x93PP9+FBUfbNUjcjEmhcrkT+8K7ml7V10Jo05mpIEFy1NmCJWx9SIKKt+EjAL4Ez8EBVOB6havuT/rByPvHXK+9zUcfcbb254+9fydJknYnRr1oGfdaiAgpxu1Rx/Rek8KISftx3L+DfsLWAANn8Hvw0/AFeAGO9DFV3c6D+CcWbL8Dj9e7f+T1k8AZv/d7+PXWM/Z+VvdCrIvuAKO09RpEEQJM0Ci6+B4xhTWr4cZNOvhktabw0ta0rSJmqz3Yw5/AKXwenod7cAhTmBSPKf6JBdvH8IP17h95pXqw50/+BFnj88fev4NchyaK47OPhhtI8RFSvAfDSNh0Ck0p2gLxGkib5NJj/JWCr90EWQJvwBzO4AHcgztwAFN1evHPUVGwfXON+0debT1YeGON9Yy9/63X+OguiwmhIhQhD7l4sMqlG3D86Suc3qWZ4rWjI1X7u0Ytw6x3rIMeIOPDprfe2XzNgyj6PahhBjO4C3e6puDgXrdg+/5l948vF3bqwZetZ+z9Rx9zdIY5pInPK4Nk0t+l52xdK2B45Qd87nM8fsD5EfUhIcJcERw4RdqqH7Yde5V7m1vhNmtedkz6EDzUMF/2jJYWbC+4fzzA/Y+/8PPH3j9dcBAPIRP8JLXd5BpAu03aziOL3VVHZzz3CXWDPWd+SH2AnxIqQoTZpo9Ckc6HIrFbAbzNmlcg8Ag8NFDDAhbJvTBZXbC94P7t68EXfv6o+21gUtPETU7bbkLxvNKRFG2+KXzvtObonPP4rBvsgmaKj404DlshFole1Glfh02fE7bYR7dZ82oTewIBGn1Md6CG6YUF26X376oevOLzx95vhUmgblI6LBZwTCDY7vMq0op5WVXgsObOXJ+1x3qaBl9j1FeLxbhU9w1F+Wiba6s1X/TBz1LnUfuYDi4r2C69f1f14BWfP+p+W2GFKuC9phcELMYRRLur9DEZTUdEH+iEqWdaM7X4WOoPGI+ZYD2+wcQ+y+ioHUZ9dTDbArzxmi/bJI9BND0Ynd6lBdve/butBw8+f/T9D3ABa3AG8W3VPX4hBin+bj8dMMmSpp5pg7fJ6xrBFE2WQQEWnV8Qg3FbAWzYfM1rREEnmvkN2o1+acG2d/9u68GDzx91v3mAjb1zkpqT21OipPKO0b9TO5W0nTdOmAQm0TObts3aBKgwARtoPDiCT0gHgwnbArzxmtcLc08HgF1asN0C4Ms/fvD5I+7PhfqyXE/b7RbbrGyRQRT9ARZcwAUmgdoz0ehJ9Fn7QAhUjhDAQSw0bV3T3WbNa59jzmiP6GsWbGXDX2ytjy8+f9T97fiBPq9YeLdBmyuizZHaqXITnXiMUEEVcJ7K4j3BFPurtB4bixW8wTpweL8DC95szWMOqucFYGsWbGU7p3TxxxefP+r+oTVktxY0v5hbq3KiOKYnY8ddJVSBxuMMVffNbxwIOERShst73HZ78DZrHpmJmH3K6sGz0fe3UUj0eyRrSCGTTc+rjVNoGzNSv05srAxUBh8IhqChiQgVNIIBH3AVPnrsnXQZbLTm8ammv8eVXn/vWpaTem5IXRlt+U/LA21zhSb9cye6jcOfCnOwhIAYXAMVTUNV0QhVha9xjgA27ODJbLbmitt3tRN80lqG6N/khgot4ZVlOyO4WNg3OIMzhIZQpUEHieg2im6F91hB3I2tubql6BYNN9Hj5S7G0G2tahslBWKDnOiIvuAEDzakDQKDNFQT6gbn8E2y4BBubM230YIpBnDbMa+y3dx0n1S0BtuG62lCCXwcY0F72T1VRR3t2ONcsmDjbmzNt9RFs2LO2hQNyb022JisaI8rAWuw4HI3FuAIhZdOGIcdjLJvvObqlpqvWTJnnQbyi/1M9O8UxWhBs//H42I0q1Yb/XPGONzcmm+ri172mHKvZBpHkJaNJz6v9jxqiklDj3U4CA2ugpAaYMWqNXsdXbmJNd9egCnJEsphXNM+MnK3m0FCJ5S1kmJpa3DgPVbnQnPGWIDspW9ozbcO4K/9LkfaQO2KHuqlfFXSbdNzcEcwoqNEFE9zcIXu9/6n/ym/BC/C3aJLzEKPuYVlbFnfhZ8kcWxV3dbv4bKl28566wD+8C53aw49lTABp9PWbsB+knfc/Li3eVizf5vv/xmvnPKg5ihwKEwlrcHqucuVcVOxEv8aH37E3ZqpZypUulrHEtIWKUr+txHg+ojZDGlwnqmkGlzcVi1dLiNSJiHjfbRNOPwKpx9TVdTn3K05DBx4psIk4Ei8aCkJahRgffk4YnEXe07T4H2RR1u27E6wfQsBDofUgjFUFnwC2AiVtA+05J2zpiDK2Oa0c5fmAecN1iJzmpqFZxqYBCYhFTCsUNEmUnIcZ6aEA5rQVhEywG6w7HSW02XfOoBlQmjwulOFQAg66SvJblrTEX1YtJ3uG15T/BH1OfOQeuR8g/c0gdpT5fx2SKbs9EfHTKdM8A1GaJRHLVIwhcGyydZsbifAFVKl5EMKNU2Hryo+06BeTgqnxzYjThVySDikbtJPieco75lYfKAJOMEZBTjoITuWHXXZVhcUDIS2hpiXHV9Ku4u44bN5OYLDOkJo8w+xJSMbhBRHEdEs9JZUCkQrPMAvaHyLkxgkEHxiNkx/x2YB0mGsQ8EUWj/stW5YLhtS5SMu+/YBbNPDCkGTUybN8krRLBGPlZkVOA0j+a1+rkyQKWGaPHPLZOkJhioQYnVZ2hS3zVxMtgC46KuRwbJNd9nV2PHgb36F194ecf/Yeu2vAFe5nm/bRBFrnY4BauE8ERmZRFUn0k8hbftiVYSKMEme2dJCJSCGYAlNqh87bXOPdUkGy24P6d1ll21MBqqx48Fvv8ZHH8HZFY7j/uAq1xMJUFqCSUlJPmNbIiNsmwuMs/q9CMtsZsFO6SprzCS1Z7QL8xCQClEelpjTduDMsmWD8S1PT152BtvmIGvUeDA/yRn83u/x0/4qxoPHjx+PXY9pqX9bgMvh/Nz9kpP4pOe1/fYf3axUiMdHLlPpZCNjgtNFAhcHEDxTumNONhHrBduW+vOyY++70WWnPXj98eA4kOt/mj/5E05l9+O4o8ePx67HFqyC+qSSnyselqjZGaVK2TadbFLPWAQ4NBhHqDCCV7OTpo34AlSSylPtIdd2AJZlyzYQrDJ5lcWGNceD80CunPLGGzsfD+7wRb95NevJI5docQ3tgCyr5bGnyaPRlmwNsFELViOOx9loebGNq2moDOKpHLVP5al2cymWHbkfzGXL7kfRl44H9wZy33tvt+PB/Xnf93e+nh5ZlU18wCiRUa9m7kib9LYuOk+hudQNbxwm0AQqbfloimaB2lM5fChex+ylMwuTbfmXQtmWlenZljbdXTLuOxjI/fDDHY4Hjx8/Hrse0zXfPFxbUN1kKqSCCSk50m0Ajtx3ub9XHBKHXESb8iO6E+qGytF4nO0OG3SXzbJlhxBnKtKyl0NwybjvYCD30aMdjgePHz8eu56SVTBbgxJMliQ3Oauwg0QHxXE2Ez/EIReLdQj42Gzb4CLS0YJD9xUx7bsi0vJi5mUbW1QzL0h0PFk17rtiIPfJk52MB48fPx67npJJwyrBa2RCCQRTbGZSPCxTPOiND4G2pYyOQ4h4jINIJh5wFU1NFZt+IsZ59LSnDqBjZ2awbOku+yInunLcd8VA7rNnOxkPHj9+PGY9B0MWJJNozOJmlglvDMXDEozdhQWbgs/U6oBanGzLrdSNNnZFjOkmbi5bNt1lX7JLLhn3vXAg9/h4y/Hg8ePHI9dzQMEkWCgdRfYykYKnkP7D4rIujsujaKPBsB54vE2TS00ccvFY/Tth7JXeq1hz+qgVy04sAJawTsvOknHfCwdyT062HA8eP348Zj0vdoXF4pilKa2BROed+9fyw9rWRXeTFXESMOanvDZfJuJaSXouQdMdDJZtekZcLLvEeK04d8m474UDuaenW44Hjx8/Xns9YYqZpszGWB3AN/4VHw+k7WSFtJ3Qicuqb/NlVmgXWsxh570xg2UwxUw3WfO6B5nOuO8aA7lnZxuPB48fPx6znm1i4bsfcbaptF3zNT78eFPtwi1OaCNOqp1x3zUGcs/PN++AGD1+fMXrSVm2baTtPhPahbPhA71wIHd2bXzRa69nG+3CraTtPivahV/55tXWg8fyRY/9AdsY8VbSdp8V7cKrrgdfM//z6ILQFtJ2nxHtwmuoB4/kf74+gLeRtvvMaBdeSz34+vifx0YG20jbfTa0C6+tHrwe//NmOG0L8EbSdp8R7cLrrQe/996O+ai3ujQOskpTNULa7jOjXXj99eCd8lHvoFiwsbTdZ0a78PrrwTvlo966pLuRtB2fFe3Cm6oHP9kNH/W2FryxtN1nTLvwRurBO+Kj3pWXHidtx2dFu/Bm68Fb81HvykuPlrb7LGkX3mw9eGs+6h1Y8MbSdjegXcguQLjmevDpTQLMxtJ2N6NdyBZu9AbrwVvwUW+LbteULUpCdqm0HTelXbhNPe8G68Gb8lFvVfYfSNuxvrTdTWoXbozAzdaDZzfkorOj1oxVxlIMlpSIlpLrt8D4hrQL17z+c3h6hU/wv4Q/utps4+bm+6P/hIcf0JwQ5oQGPBL0eKPTYEXTW+eL/2DKn73J9BTXYANG57hz1cEMviVf/4tf5b/6C5pTQkMIWoAq7hTpOJjtAM4pxKu5vg5vXeUrtI09/Mo/5H+4z+Mp5xULh7cEm2QbRP2tFIKR7WM3fPf/jZ3SWCqLM2l4NxID5zB72HQXv3jj/8mLR5xXNA5v8EbFQEz7PpRfl1+MB/hlAN65qgDn3wTgH13hK7T59bmP+NIx1SHHU84nLOITt3iVz8mNO+lPrjGAnBFqmioNn1mTyk1ta47R6d4MrX7tjrnjYUpdUbv2rVr6YpVfsGG58AG8Ah9eyUN8CX4WfgV+G8LVWPDGb+Zd4cU584CtqSbMKxauxTg+dyn/LkVgA+IR8KHtejeFKRtTmLLpxN6mYVLjYxwXf5x2VofiZcp/lwKk4wGOpYDnoIZPdg/AAbwMfx0+ge9dgZvYjuqKe4HnGnykYo5TvJbG0Vj12JagRhwKa44H95ShkZa5RyLGGdfYvG7aw1TsF6iapPAS29mNS3NmsTQZCmgTzFwgL3upCTgtBTRwvGMAKrgLn4evwin8+afJRcff+8izUGUM63GOOuAs3tJkw7J4kyoNreqrpO6cYLQeFUd7TTpr5YOTLc9RUUogUOVJQ1GYJaFLAW0oTmKyYS46ZooP4S4EON3xQ5zC8/CX4CnM4c1PE8ApexpoYuzqlP3d4S3OJP8ZDK7cKWNaTlqmgDiiHwl1YsE41w1zT4iRTm3DBqxvOUsbMKKDa/EHxagtnta072ejc3DOIh5ojvh8l3tk1JF/AV6FU6jh3U8HwEazLgdCLYSQ+MYiAI2ltomkzttUb0gGHdSUUgsIYjTzLG3mObX4FBRaYtpDVNZrih9TgTeYOBxsEnN1gOCTM8Bsw/ieMc75w9kuAT6A+/AiHGvN/+Gn4KRkiuzpNNDYhDGFndWRpE6SVfm8U5bxnSgVV2jrg6JCKmneqey8VMFgq2+AM/i4L4RUbfSi27lNXZ7R7W9RTcq/q9fk4Xw3AMQd4I5ifAZz8FcVtm9SAom/dyN4lczJQW/kC42ZrHgcCoIf1oVMKkVItmMBi9cOeNHGLqOZk+QqQmrbc5YmYgxELUUN35z2iohstgfLIFmcMV7s4CFmI74L9+EFmGsi+tGnAOD4Yk9gIpo01Y4cA43BWGygMdr4YZekG3OBIUXXNukvJS8tqa06e+lSDCtnqqMFu6hWHXCF+WaYt64m9QBmNxi7Ioy7D+fa1yHw+FMAcPt7SysFLtoG4PXAk7JOA3aAxBRqUiAdU9Yp5lK3HLSRFtOim0sa8euEt08xvKjYjzeJ2GU7YawexrnKI9tmobInjFXCewpwriY9+RR4aaezFhMhGCppKwom0ChrgFlKzyPKkGlTW1YQrE9HJqu8hKGgMc6hVi5QRq0PZxNfrYNgE64utmRv6KKHRpxf6VDUaOvNP5jCEx5q185My/7RKz69UQu2im5k4/eownpxZxNLwiZ1AZTO2ZjWjkU9uaB2HFn6Q3u0JcsSx/qV9hTEApRzeBLDJQXxYmTnq7bdLa3+uqFrxLJ5w1TehnNHx5ECvCh2g2c3hHH5YsfdaSKddztfjQ6imKFGSyFwlLzxEGPp6r5IevVjk1AMx3wMqi1NxDVjLBiPs9tbsCkIY5we5/ML22zrCScFxnNtzsr9Wcc3CnD+pYO+4VXXiDE0oc/vQQ/fDK3oPESJMYXNmJa/DuloJZkcTpcYE8lIH8Dz8DJMiynNC86Mb2lNaaqP/+L7f2fcE/yP7/Lde8xfgSOdMxvOixZf/9p3+M4hT1+F+zApxg9XfUvYjc8qX2lfOOpK2gNRtB4flpFu9FTKCp2XJRgXnX6olp1zyYjTKJSkGmLE2NjUr1bxFM4AeAAHBUFIeSLqXR+NvH/M9fOnfHzOD2vCSyQJKzfgsCh+yi/Mmc35F2fUrw7miW33W9hBD1vpuUojFphIyvg7aTeoymDkIkeW3XLHmguMzbIAJejN6B5MDrhipE2y6SoFRO/AK/AcHHZHNIfiWrEe/C6cr3f/yOvrQKB+zMM55/GQdLDsR+ifr5Fiuu+/y+M78LzOE5dsNuXC3PYvYWd8NXvphLSkJIasrlD2/HOqQ+RjcRdjKTGWYhhVUm4yxlyiGPuMsZR7sMCHUBeTuNWA7if+ifXgc/hovftHXs/DV+Fvwe+f8shzMiMcweFgBly3//vwJfg5AN4450fn1Hd1Rm1aBLu22Dy3y3H2+OqMemkbGZ4jozcDjJf6596xOLpC0eMTHbKnxLxH27uZ/bMTGs2jOaMOY4m87CfQwF0dw53oa1k80JRuz/XgS+8fX3N9Af4qPIMfzKgCp4H5TDGe9GGeFPzSsZz80SlPTxXjgwJmC45njzgt2vbQ4b4OAdUK4/vWhO8d8v6EE8fMUsfakXbPpFJeLs2ubM/qdm/la3WP91uWhxXHjoWhyRUq2iJ/+5mA73zwIIo+LoZ/SgvIRjAd1IMvvn98PfgOvAJfhhm8scAKVWDuaRaK8aQ9f7vuPDH6Bj47ZXau7rqYJ66mTDwEDU6lLbCjCK0qTXyl5mnDoeNRxanj3FJbaksTk0faXxHxLrssgPkWB9LnA/MFleXcJozzjwsUvUG0X/QCve51qkMDXp9mtcyOy3rwBfdvVJK7D6/ACSzg3RoruIq5UDeESfEmVclDxnniU82vxMLtceD0hGZWzBNPMM/jSPne2OVatiTKUpY5vY7gc0LdUAWeWM5tH+O2I66AOWw9xT2BuyRVLGdoDHUsVRXOo/c+ZdRXvFfnxWyIV4upFLCl9eAL7h8Zv0QH8Ry8pA2cHzQpGesctVA37ZtklBTgHjyvdSeKY/RZw/kJMk0Y25cSNRWSigQtlULPTw+kzuJPeYEkXjQRpoGZobYsLF79pyd1dMRHInbgFTZqNLhDqiIsTNpoex2WLcy0/X6rHcdMMQvFSd5dWA++4P7xv89deACnmr36uGlL69bRCL6BSZsS6c0TU2TKK5gtWCzgAOOwQcurqk9j8whvziZSMLcq5hbuwBEsYjopUBkqw1yYBGpLA97SRElEmx5MCInBY5vgLk94iKqSWmhIGmkJ4Bi9m4L645J68LyY4wsFYBfUg5feP/6gWWm58IEmKQM89hq7KsZNaKtP5TxxrUZZVkNmMJtjbKrGxLNEbHPJxhqy7lAmbC32ZqeF6lTaknRWcYaFpfLUBh/rwaQycCCJmW15Kstv6jRHyJFry2C1ahkkIW0LO75s61+owxK1y3XqweX9m5YLM2DPFeOjn/iiqCKJ+yKXF8t5Yl/kNsqaSCryxPq5xWTFIaP8KSW0RYxqupaUf0RcTNSSdJZGcKYdYA6kdtrtmyBckfKXwqk0pHpUHlwWaffjNRBYFPUDWa8e3Lt/o0R0CdisKDM89cX0pvRHEfM8ca4t0s2Xx4kgo91MPQJ/0c9MQYq0co8MBh7bz1fio0UUHLR4aAIOvOmoYO6kwlEVODSSTliWtOtH6sPkrtctF9ZtJ9GIerBskvhdVS5cFNv9s1BU0AbdUgdK4FG+dRnjFmDTzniRMdZO1QhzMK355vigbdkpz9P6qjUGE5J2qAcXmwJ20cZUiAD0z+pGMx6xkzJkmEf40Hr4qZfVg2XzF9YOyoV5BjzVkUJngKf8lgNYwKECEHrCNDrWZzMlflS3yBhr/InyoUgBc/lKT4pxVrrC6g1YwcceK3BmNxZcAtz3j5EIpqguh9H6wc011YN75cKDLpFDxuwkrPQmUwW4KTbj9mZTwBwLq4aQMUZbHm1rylJ46dzR0dua2n3RYCWZsiHROeywyJGR7mXKlpryyCiouY56sFkBWEnkEB/raeh/Sw4162KeuAxMQpEkzy5alMY5wamMsWKKrtW2WpEWNnReZWONKWjrdsKZarpFjqCslq773PLmEhM448Pc3+FKr1+94vv/rfw4tEcu+lKTBe4kZSdijBrykwv9vbCMPcLQTygBjzVckSLPRVGslqdunwJ4oegtFOYb4SwxNgWLCmD7T9kVjTv5YDgpo0XBmN34Z/rEHp0sgyz7lngsrm4lvMm2Mr1zNOJYJ5cuxuQxwMGJq/TP5emlb8fsQBZviK4t8hFL+zbhtlpwaRSxQRWfeETjuauPsdGxsBVdO7nmP4xvzSoT29pRl7kGqz+k26B3Oy0YNV+SXbbQas1ctC/GarskRdFpKczVAF1ZXnLcpaMuzVe6lZ2g/1ndcvOVgRG3sdUAY1bKD6achijMPdMxV4muKVorSpiDHituH7rSTs7n/4y5DhRXo4FVBN4vO/zbAcxhENzGbHCzU/98Mcx5e7a31kWjw9FCe/zNeYyQjZsWb1uc7U33pN4Mji6hCLhivqfa9Ss6xLg031AgfesA/l99m9fgvnaF9JoE6bYKmkGNK3aPbHB96w3+DnxFm4hs0drLsk7U8kf/N/CvwQNtllna0rjq61sH8L80HAuvwH1tvBy2ChqWSCaYTaGN19sTvlfzFD6n+iKTbvtayfrfe9ueWh6GJFoxLdr7V72a5ZpvHcCPDzma0wTO4EgbLyedxstO81n57LYBOBzyfsOhUKsW1J1BB5vr/tz8RyqOFylQP9Tvst2JALsC5lsH8PyQ40DV4ANzYa4dedNiKNR1s+x2wwbR7q4/4cTxqEk4LWDebfisuo36JXLiWFjOtLrlNWh3K1rRS4xvHcDNlFnNmWBBAl5SWaL3oPOfnvbr5pdjVnEaeBJSYjuLEkyLLsWhKccadmOphZkOPgVdalj2QpSmfOsADhMWE2ZBu4+EEJI4wKTAuCoC4xwQbWXBltpxbjkXJtKxxabo9e7tyhlgb6gNlSbUpMh+l/FaqzVwewGu8BW1Zx7pTpQDJUjb8tsUTW6+GDXbMn3mLbXlXJiGdggxFAoUrtPS3wE4Nk02UZG2OOzlk7fRs7i95QCLo3E0jtrjnM7SR3uS1p4qtS2nJ5OwtQVHgOvArLBFijZUV9QtSl8dAY5d0E0hM0w3HS2DpIeB6m/A1+HfhJcGUq4sOxH+x3f5+VO+Ds9rYNI7zPXOYWPrtf8bYMx6fuOAX5jzNR0PdsuON+X1f7EERxMJJoU6GkTEWBvVolVlb5lh3tKCg6Wx1IbaMDdJ+9sUCc5KC46hKGCk3IVOS4TCqdBNfUs7Kd4iXf2RjnT/LLysJy3XDcHLh/vde3x8DoGvwgsa67vBk91G5Pe/HbOe7xwym0NXbtiuuDkGO2IJDh9oQvJ4cY4vdoqLDuoH9Zl2F/ofsekn8lkuhIlhQcffUtSjytFyp++p6NiE7Rqx/lodgKVoceEp/CP4FfjrquZaTtj2AvH5K/ywpn7M34K/SsoYDAdIN448I1/0/wveW289T1/lX5xBzc8N5IaHr0XMOQdHsIkDuJFifj20pBm5jzwUv9e2FhwRsvhAbalCIuIw3bhJihY3p6nTFFIZgiSYjfTf3aXuOjmeGn4bPoGvwl+CFzTRczBIuHBEeImHc37/lGfwZR0cXzVDOvaKfNHvwe+suZ771K/y/XcBlsoN996JpBhoE2toYxOznNEOS5TJc6Id5GEXLjrWo+LEWGNpPDU4WAwsIRROu+1vM+0oW37z/MBN9kqHnSArwPfgFJ7Cq/Ai3Ie7g7ncmI09v8sjzw9mzOAEXoIHxURueaAce5V80f/DOuuZwHM8vsMb5wBzOFWM7wymTXPAEvm4vcFpZ2ut0VZRjkiP2MlmLd6DIpbGSiHOjdnUHN90hRYmhTnmvhzp1iKDNj+b7t5hi79lWGwQ+HN9RsfFMy0FXbEwhfuczKgCbyxYwBmcFhhvo/7a44v+i3XWcwDP86PzpGQYdWh7csP5dBvZ1jNzdxC8pBGuxqSW5vw40nBpj5JhMwvOzN0RWqERHMr4Lv1kWX84xLR830G3j6yqZ1a8UstTlW+qJPOZ+sZ7xZPKTJLhiNOAFd6tk+jrTH31ncLOxid8+nzRb128HhUcru/y0Wn6iT254YPC6FtVSIMoW2sk727AhvTtrWKZTvgsmckfXYZWeNRXx/3YQ2OUxLDrbHtN11IwrgXT6c8dATDwLniYwxzO4RzuQqTKSC5gAofMZ1QBK3zQ4JWobFbcvJm87FK+6JXrKahLn54m3p+McXzzYtP8VF/QpJuh1OwieElEoI1pRxPS09FBrkq2tWCU59+HdhNtTIqKm8EBrw2RTOEDpG3IKo2Y7mFdLm3ZeVjYwVw11o/oznceMve4CgMfNym/utA/d/ILMR7gpXzRy9eDsgLcgbs8O2Va1L0zzIdwGGemTBuwROHeoMShkUc7P+ISY3KH5ZZeWqO8mFTxQYeXTNuzvvK5FGPdQfuu00DwYFY9dyhctEt+OJDdnucfpmyhzUJzfsJjr29l8S0bXBfwRS9ZT26tmMIdZucch5ZboMz3Nio3nIOsYHCGoDT4kUA9MiXEp9Xsui1S8th/kbWIrMBxDGLodWUQIWcvnXy+9M23xPiSMOiRPqM+YMXkUN3gXFrZJwXGzUaMpJfyRS9ZT0lPe8TpScuRlbMHeUmlaKDoNuy62iWNTWNFYjoxFzuJs8oR+RhRx7O4SVNSXpa0ZJQ0K1LAHDQ+D9IepkMXpcsq5EVCvClBUIzDhDoyKwDw1Lc59GbTeORivugw1IcuaEOaGWdNm+Ps5fQ7/tm0DjMegq3yM3vb5j12qUId5UZD2oxDSEWOZMSqFl/W+5oynWDa/aI04tJRQ2eTXusg86SQVu/nwSYwpW6wLjlqIzwLuxGIvoAvul0PS+ZNz0/akp/pniO/8JDnGyaCkzbhl6YcqmK/69prxPqtpx2+Km9al9sjL+rwMgHw4jE/C8/HQ3m1vBuL1fldbzd8mOueVJ92syqdEY4KJjSCde3mcRw2TA6szxedn+zwhZMps0XrqEsiUjnC1hw0TELC2Ek7uAAdzcheXv1BYLagspxpzSAoZZUsIzIq35MnFQ9DOrlNB30jq3L4pkhccKUAA8/ocvN1Rzx9QyOtERs4CVsJRK/DF71kPYrxYsGsm6RMh4cps5g1DOmM54Ly1ii0Hd3Y/BMk8VWFgBVmhqrkJCPBHAolwZaWzLR9Vb7bcWdX9NyUYE+uB2BKfuaeBUcjDljbYVY4DdtsVWvzRZdWnyUzDpjNl1Du3aloAjVJTNDpcIOVVhrHFF66lLfJL1zJr9PQ2nFJSBaKoDe+sAvLufZVHVzYh7W0h/c6AAZ+7Tvj6q9j68G/cTCS/3n1vLKHZwNi+P+pS0WkZNMBMUl+LDLuiE4omZy71r3UFMwNJV+VJ/GC5ixVUkBStsT4gGKh0Gm4Oy3qvq7Lbmq24nPdDuDR9deR11XzP4vFu3TYzfnIyiSVmgizUYGqkIXNdKTY9pgb9D2Ix5t0+NHkVzCdU03suWkkVZAoCONCn0T35gAeW38de43mf97sMOpSvj4aa1KYUm58USI7Wxxes03bAZdRzk6UtbzMaCQ6IxO0dy7X+XsjoD16hpsBeGz9dfzHj+R/Hp8nCxZRqkEDTaCKCSywjiaoMJ1TITE9eg7Jqnq8HL6gDwiZb0u0V0Rr/rmvqjxKuaLCX7ZWXTvAY+uvm3z8CP7nzVpngqrJpZKwWnCUjIviYVlirlGOzPLI3SMVyp/elvBUjjDkNhrtufFFErQ8pmdSlbK16toBHlt/HV8uHMX/vEGALkV3RJREiSlopxwdMXOZPLZ+ix+kAHpMKIk8UtE1ygtquttwxNhphrIZ1IBzjGF3IIGxGcBj6q8bHJBG8T9vdsoWrTFEuebEZuVxhhClH6P5Zo89OG9fwHNjtNQTpD0TG9PJLEYqvEY6Rlxy+ZZGfL0Aj62/bnQCXp//eeM4KzfQVJbgMQbUjlMFIm6TpcfWlZje7NBSV6IsEVmumWIbjiloUzQX9OzYdo8L1wjw2PrrpimONfmfNyzKklrgnEkSzT5QWYQW40YShyzqsRmMXbvVxKtGuYyMKaU1ugenLDm5Ily4iT14fP11Mx+xJv+zZ3MvnfdFqxU3a1W/FTB4m3Qfsyc1XUcdVhDeUDZXSFHHLQj/Y5jtC7ZqM0CXGwB4bP11i3LhOvzPGygYtiUBiwQV/4wFO0majijGsafHyRLu0yG6q35cL1rOpVxr2s5cM2jJYMCdc10Aj6q/blRpWJ//+dmm5psMl0KA2+AFRx9jMe2WbC4jQxnikd4DU8TwUjRVacgdlhmr3bpddzuJ9zXqr2xnxJfzP29RexdtjDVZqzkqa6PyvcojGrfkXiJ8SEtml/nYskicv0ivlxbqjemwUjMw5evdg8fUX9nOiC/lf94Q2i7MURk9nW1MSj5j8eAyV6y5CN2S6qbnw3vdA1Iwq+XOSCl663udN3IzLnrt+us25cI1+Z83SXQUldqQq0b5XOT17bGpLd6ssN1VMPf8c+jG8L3NeCnMdF+Ra3fRa9dft39/LuZ/3vwHoHrqGmQFafmiQw6eyzMxS05K4bL9uA+SKUQzCnSDkqOGokXyJvbgJ/BHI+qvY69//4rl20NsmK2ou2dTsyIALv/91/8n3P2Aao71WFGi8KKv1fRC5+J67Q/507/E/SOshqN5TsmYIjVt+kcjAx98iz/4SaojbIV1rexE7/C29HcYD/DX4a0rBOF5VTu7omsb11L/AWcVlcVZHSsqGuXLLp9ha8I//w3Mv+T4Ew7nTBsmgapoCrNFObIcN4pf/Ob/mrvHTGqqgAupL8qWjWPS9m/31jAe4DjA+4+uCoQoT/zOzlrNd3qd4SdphFxsUvYwGWbTWtISc3wNOWH+kHBMfc6kpmpwPgHWwqaSUG2ZWWheYOGQGaHB+eQ/kn6b3pOgLV+ODSn94wDvr8Bvb70/LLuiPPEr8OGVWfDmr45PZyccEmsVXZGe1pRNX9SU5+AVQkNTIVPCHF/jGmyDC9j4R9LfWcQvfiETmgMMUCMN1uNCakkweZsowdYobiMSlnKA93u7NzTXlSfe+SVbfnPQXmg9LpYAQxpwEtONyEyaueWM4FPjjyjG3uOaFmBTWDNgBXGEiQpsaWhnAqIijB07Dlsy3fUGeP989xbWkyf+FF2SNEtT1E0f4DYYVlxFlbaSMPIRMk/3iMU5pME2SIWJvjckciebkQuIRRyhUvkHg/iUljG5kzVog5hV7vIlCuBrmlhvgPfNHQM8lCf+FEGsYbMIBC0qC9a0uuy2wLXVbLBaP5kjHokCRxapkQyzI4QEcwgYHRZBp+XEFTqXFuNVzMtjXLJgX4gAid24Hjwc4N3dtVSe+NNiwTrzH4WVUOlDobUqr1FuAgYllc8pmzoVrELRHSIW8ViPxNy4xwjBpyR55I6J220qQTZYR4guvUICJiSpr9gFFle4RcF/OMB7BRiX8sSfhpNSO3lvEZCQfLUVTKT78Ek1LRLhWN+yLyTnp8qWUZ46b6vxdRGXfHVqx3eI75YaLa4iNNiK4NOW7wPW6lhbSOF9/M9qw8e/aoB3d156qTzxp8pXx5BKAsYSTOIIiPkp68GmTq7sZtvyzBQaRLNxIZ+paozHWoLFeExIhRBrWitHCAHrCF7/thhD8JhYz84wg93QRV88wLuLY8zF8sQ36qF1J455bOlgnELfshKVxYOXKVuKx0jaj22sczTQqPqtV/XDgpswmGTWWMSDw3ssyUunLLrVPGjYRsH5ggHeHSWiV8kT33ycFSfMgkoOK8apCye0J6VW6GOYvffgU9RWsukEi2kUV2nl4dOYUzRik9p7bcA4ggdJ53LxKcEe17B1R8eqAd7dOepV8sTXf5lhejoL85hUdhDdknPtKHFhljOT+bdq0hxbm35p2nc8+Ja1Iw+tJykgp0EWuAAZYwMVwac5KzYMslhvgHdHRrxKnvhTYcfKsxTxtTETkjHO7rr3zjoV25lAQHrqpV7bTiy2aXMmUhTBnKS91jhtR3GEoF0oLnWhWNnYgtcc4N0FxlcgT7yz3TgNIKkscx9jtV1ZKpWW+Ub1tc1eOv5ucdgpx+FJy9pgbLE7xDyXb/f+hLHVGeitHOi6A7ybo3sF8sS7w7cgdk0nJaOn3hLj3uyD0Zp5pazFIUXUpuTTU18d1EPkDoX8SkmWTnVIozEdbTcZjoqxhNHf1JrSS/AcvHjZ/SMHhL/7i5z+POsTUh/8BvNfYMTA8n+yU/MlTZxSJDRStqvEuLQKWwDctMTQogUDyQRoTQG5Kc6oQRE1yV1jCA7ri7jdZyK0sYTRjCR0Hnnd+y7nHxNgTULqw+8wj0mQKxpYvhjm9uSUxg+TTy7s2GtLUGcywhXSKZN275GsqlclX90J6bRI1aouxmgL7Q0Nen5ziM80SqMIo8cSOo+8XplT/5DHNWsSUr/6lLN/QQ3rDyzLruEW5enpf7KqZoShEduuSFOV7DLX7Ye+GmXb6/hnNNqKsVXuMDFpb9Y9eH3C6NGEzuOuI3gpMH/I6e+zDiH1fXi15t3vA1czsLws0TGEtmPEJdiiFPwlwKbgLHAFk4P6ZyPdymYYHGE0dutsChQBl2JcBFlrEkY/N5bQeXQ18gjunuMfMfsBlxJSx3niO485fwO4fGD5T/+3fPQqkneWVdwnw/3bMPkW9Wbqg+iC765Zk+xcT98ibKZc2EdgHcLoF8cSOo/Oc8fS+OyEULF4g4sJqXVcmfMfsc7A8v1/yfGXmL9I6Fn5pRwZhsPv0TxFNlAfZCvG+Oohi82UC5f/2IsJo0cTOm9YrDoKhFPEUr/LBYTUNht9zelHXDqwfPCIw4owp3mOcIQcLttWXFe3VZ/j5H3cIc0G6oPbCR+6Y2xF2EC5cGUm6wKC5tGEzhsWqw5hNidUiKX5gFWE1GXh4/Qplw4sVzOmx9QxU78g3EF6wnZlEN4FzJ1QPSLEZz1KfXC7vd8ssGdIbNUYpVx4UapyFUHzJoTOo1McSkeNn1M5MDQfs4qQuhhX5vQZFw8suwWTcyYTgioISk2YdmkhehG4PkE7w51inyAGGaU+uCXADabGzJR1fn3lwkty0asIo8cROm9Vy1g0yDxxtPvHDAmpu+PKnM8Ix1wwsGw91YJqhteaWgjYBmmQiebmSpwKKzE19hx7jkzSWOm66oPbzZ8Yj6kxVSpYjVAuvLzYMCRo3oTQecOOjjgi3NQ4l9K5/hOGhNTdcWVOTrlgYNkEXINbpCkBRyqhp+LdRB3g0OU6rMfW2HPCFFMV9nSp+uB2woepdbLBuJQyaw/ZFysXrlXwHxI0b0LovEkiOpXGA1Ijagf+KUNC6rKNa9bQnLFqYNkEnMc1uJrg2u64ELPBHpkgWbmwKpJoDhMwNbbGzAp7Yg31wS2T5rGtzit59PrKhesWG550CZpHEzpv2NGRaxlNjbMqpmEIzygJqQfjypycs2pg2cS2RY9r8HUqkqdEgKTWtWTKoRvOBPDYBltja2SO0RGjy9UHtxwRjA11ujbKF+ti5cIR9eCnxUg6owidtyoU5tK4NLji5Q3HCtiyF2IqLGYsHViOXTXOYxucDqG0HyttqYAKqYo3KTY1ekyDXRAm2AWh9JmsVh/ccg9WJ2E8YjG201sPq5ULxxX8n3XLXuMInbft2mk80rRGjCGctJ8/GFdmEQ9Ug4FlE1ll1Y7jtiraqm5Fe04VV8lvSVBL8hiPrfFVd8+7QH3Qbu2ipTVi8cvSGivc9cj8yvH11YMHdNSERtuOslM97feYFOPKzGcsI4zW0YGAbTAOaxCnxdfiYUmVWslxiIblCeAYr9VYR1gM7GmoPrilunSxxeT3DN/2eBQ9H11+nk1adn6VK71+5+Jfct4/el10/7KBZfNryUunWSCPxPECk1rdOv1WVSrQmpC+Tl46YD3ikQYcpunSQgzVB2VHFhxHVGKDgMEY5GLlQnP7FMDzw7IacAWnO6sBr12u+XanW2AO0wQ8pknnFhsL7KYIqhkEPmEXFkwaN5KQphbkUmG72wgw7WSm9RiL9QT925hkjiVIIhphFS9HKI6/8QAjlpXqg9W2C0apyaVDwKQwrwLY3j6ADR13ZyUNByQXHQu6RY09Hu6zMqXRaNZGS/KEJs0cJEe9VH1QdvBSJv9h09eiRmy0V2uJcqHcShcdvbSNg5fxkenkVprXM9rDVnX24/y9MVtncvbKY706anNl3ASll9a43UiacVquXGhvq4s2FP62NGKfQLIQYu9q1WmdMfmUrDGt8eDS0cXozH/fjmUH6Jruvm50hBDSaEU/2Ru2LEN/dl006TSc/g7tfJERxGMsgDUEr104pfWH9lQaN+M4KWQjwZbVc2rZVNHsyHal23wZtIs2JJqtIc/WLXXRFCpJkfE9jvWlfFbsNQ9pP5ZBS0zKh4R0aMFj1IjTcTnvi0Zz2rt7NdvQb2mgbju1plsH8MmbnEk7KbK0b+wC2iy3aX3szW8xeZvDwET6hWZYwqTXSSG+wMETKum0Dq/q+x62gt2ua2ppAo309TRk9TPazfV3qL9H8z7uhGqGqxNVg/FKx0HBl9OVUORn8Q8Jx9gFttGQUDr3tzcXX9xGgN0EpzN9mdZ3GATtPhL+CjxFDmkeEU6x56kqZRusLzALXVqkCN7zMEcqwjmywDQ6OhyUe0Xao1Qpyncrg6wKp9XfWDsaZplElvQ/b3sdweeghorwBDlHzgk1JmMc/wiERICVy2VJFdMjFuLQSp3S0W3+sngt2njwNgLssFGVQdJ0tu0KH4ky1LW4yrbkuaA6Iy9oz/qEMMXMMDWyIHhsAyFZc2peV9hc7kiKvfULxCl9iddfRK1f8kk9qvbdOoBtOg7ZkOZ5MsGrSHsokgLXUp9y88smniwWyuFSIRVmjplga3yD8Uij5QS1ZiM4U3Qw5QlSm2bXjFe6jzzBFtpg+/YBbLAWG7OPynNjlCw65fukGNdkJRf7yM1fOxVzbxOJVocFoYIaGwH22mIQkrvu1E2nGuebxIgW9U9TSiukPGU+Lt++c3DJPKhyhEEbXCQLUpae2exiKy6tMPe9mDRBFCEMTWrtwxN8qvuGnt6MoihKWS5NSyBhbH8StXoAz8PLOrRgLtOT/+4vcu+7vDLnqNvztOq7fmd8sMmY9Xzn1zj8Dq8+XVdu2Nv0IIySgEdQo3xVHps3Q5i3fLFsV4aiqzAiBhbgMDEd1uh8qZZ+lwhjkgokkOIv4xNJmyncdfUUzgB4oFMBtiu71Xumpz/P+cfUP+SlwFExwWW62r7b+LSPxqxn/gvMZ5z9C16t15UbNlq+jbGJtco7p8wbYlL4alSyfWdeuu0j7JA3JFNuVAwtst7F7FhWBbPFNKIUORndWtLraFLmMu7KFVDDOzqkeaiN33YAW/r76wR4XDN/yN1z7hejPau06EddkS/6XThfcz1fI/4K736fO48vlxt2PXJYFaeUkFS8U15XE3428xdtn2kc8GQlf1vkIaNRRnOMvLTWrZbElEHeLWi1o0dlKPAh1MVgbbVquPJ5+Cr8LU5/H/+I2QlHIU2ClXM9G8v7Rr7oc/hozfUUgsPnb3D+I+7WF8kNO92GY0SNvuxiE+2Bt8prVJTkzE64sfOstxuwfxUUoyk8VjcTlsqe2qITSFoSj6Epd4KsT6BZOWmtgE3hBfir8IzZDwgV4ZTZvD8VvPHERo8v+vL1DASHTz/i9OlKueHDjK5Rnx/JB1Vb1ioXdBra16dmt7dgik10yA/FwJSVY6XjA3oy4SqM2frqDPPSRMex9qs3XQtoWxMj7/Er8GWYsXgjaVz4OYumP2+9kbxvny/6kvWsEBw+fcb5bInc8APdhpOSs01tEqIkoiZjbAqKMruLbJYddHuHFRIyJcbdEdbl2sVLaySygunutBg96Y2/JjKRCdyHV+AEFtTvIpbKIXOamknYSiB6KV/0JetZITgcjjk5ZdaskBtWO86UF0ap6ozGXJk2WNiRUlCPFir66lzdm/SLSuK7EUdPz8f1z29Skq6F1fXg8+5UVR6bszncP4Tn4KUkkdJ8UFCY1zR1i8RmL/qQL3rlei4THG7OODlnKko4oI01kd3CaM08Ia18kC3GNoVaO9iDh+hWxSyTXFABXoau7Q6q9OxYg/OVEMw6jdbtSrJ9cBcewGmaZmg+bvkUnUUaGr+ZfnMH45Ivevl61hMcXsxYLFTu1hTm2zViCp7u0o5l+2PSUh9bDj6FgYypufBDhqK2+oXkiuHFHR3zfj+9PtA8oR0xnqX8qn+sx3bFODSbbF0X8EUvWQ8jBIcjo5bRmLOljDNtcqNtOe756h3l0VhKa9hDd2l1eqmsnh0MNMT/Cqnx6BInumhLT8luljzQ53RiJeA/0dxe5NK0o2fA1+GLXr6eNQWHNUOJssQaTRlGpLHKL9fD+IrQzTOMZS9fNQD4AnRNVxvTdjC+fJdcDDWQcyB00B0t9BDwTxXgaAfzDZ/DBXzRnfWMFRwuNqocOmX6OKNkY63h5n/fFcB28McVHqnXZVI27K0i4rDLNE9lDKV/rT+udVbD8dFFu2GGZ8mOt0kAXcoX3ZkIWVtw+MNf5NjR2FbivROHmhV1/pj2egv/fMGIOWTIWrV3Av8N9imV9IWml36H6cUjqEWNv9aNc+veb2sH46PRaHSuMBxvtW+twxctq0z+QsHhux8Q7rCY4Ct8lqsx7c6Sy0dl5T89rIeEuZKoVctIk1hNpfavER6yyH1Vvm3MbsUHy4ab4hWr/OZPcsRBphnaV65/ZcdYPNNwsjN/djlf9NqCw9U5ExCPcdhKxUgLSmfROpLp4WSUr8ojdwbncbvCf+a/YzRaEc6QOvXcGO256TXc5Lab9POvB+AWY7PigWYjzhifbovuunzRawsO24ZqQQAqguBtmpmPB7ysXJfyDDaV/aPGillgz1MdQg4u5MYaEtBNNHFjkRlSpd65lp4hd2AVPTfbV7FGpyIOfmNc/XVsPfg7vzaS/3nkvLL593ANLvMuRMGpQIhiF7kUEW9QDpAUbTWYBcbp4WpacHHY1aacqQyjGZS9HI3yCBT9kUZJhVOD+zUDvEH9ddR11fzPcTDQ5TlgB0KwqdXSavk9BC0pKp0WmcuowSw07VXmXC5guzSa4p0UvRw2lbDiYUx0ExJJRzWzi6Gm8cnEkfXXsdcG/M/jAJa0+bmCgdmQ9CYlNlSYZOKixmRsgiFxkrmW4l3KdFKv1DM8tk6WxPYJZhUUzcd8Kdtgrw/gkfXXDT7+avmfVak32qhtkg6NVdUS5wgkru1YzIkSduTW1FDwVWV3JQVJVuieTc0y4iDpFwc7/BvSalvKdQM8sv662cevz/+8sQVnjVAT0W2wLllw1JiMhJRxgDjCjLQsOzSFSgZqx7lAW1JW0e03yAD3asC+GD3NbQhbe+mN5GXH1F83KDOM4n/e5JIuH4NpdQARrFPBVptUNcjj4cVMcFSRTE2NpR1LEYbYMmfWpXgP9KejaPsLUhuvLCsVXznAG9dfx9SR1ud/3hZdCLHb1GMdPqRJgqDmm76mHbvOXDtiO2QPUcKo/TWkQ0i2JFXpBoo7vij1i1Lp3ADAo+qvG3V0rM//vFnnTE4hxd5Ka/Cor5YEdsLVJyKtDgVoHgtW11pWSjolPNMnrlrVj9Fv2Qn60twMwKPqr+N/wvr8z5tZcDsDrv06tkqyzESM85Ycv6XBWA2birlNCXrI6VbD2lx2L0vQO0QVTVVLH4SE67fgsfVXv8n7sz7/85Z7cMtbE6f088wSaR4kCkCm10s6pKbJhfqiUNGLq+0gLWC6eUAZFPnLjwqtKd8EwGvWX59t7iPW4X/eAN1svgRVSY990YZg06BD1ohLMtyFTI4pKTJsS9xREq9EOaPWiO2gpms7397x6nQJkbh+Fz2q/rqRROX6/M8bJrqlVW4l6JEptKeUFuMYUbtCQ7CIttpGc6MY93x1r1vgAnRXvY5cvwWPqb9uWQm+lP95QxdNMeWhOq1x0Db55C7GcUv2ZUuN6n8iKzsvOxibC//Yfs9Na8r2Rlz02vXXDT57FP/zJi66/EJSmsJKa8QxnoqW3VLQ+jZVUtJwJ8PNX1NQCwfNgdhhHD9on7PdRdrdGPF28rJr1F+3LBdeyv+8yYfLoMYet1vX4upNAjVvwOUWnlNXJXlkzk5Il6kqeoiL0C07qno+/CYBXq/+utlnsz7/Mzvy0tmI4zm4ag23PRN3t/CWryoUVJGm+5+K8RJ0V8Hc88/XHUX/HfiAq7t+BH+x6v8t438enWmdJwFA6ZINriLGKv/95f8lT9/FnyA1NMVEvQyaXuu+gz36f/DD73E4pwqpLcvm/o0Vle78n//+L/NPvoefp1pTJye6e4A/D082FERa5/opeH9zpvh13cNm19/4v/LDe5xMWTi8I0Ta0qKlK27AS/v3/r+/x/2GO9K2c7kVMonDpq7//jc5PKCxeNPpFVzaRr01wF8C4Pu76hXuX18H4LduTr79guuFD3n5BHfI+ZRFhY8w29TYhbbLi/bvBdqKE4fUgg1pBKnV3FEaCWOWyA+m3WpORZr/j+9TKJtW8yBTF2/ZEODI9/QavHkVdGFp/Pjn4Q+u5hXapsP5sOH+OXXA1LiKuqJxiMNbhTkbdJTCy4llEt6NnqRT4dhg1V3nbdrm6dYMecA1yTOL4PWTE9L5VzPFlLBCvlG58AhehnN4uHsAYinyJ+AZ/NkVvELbfOBUuOO5syBIEtiqHU1k9XeISX5bsimrkUUhnGDxourN8SgUsCZVtKyGbyGzHXdjOhsAvOAswSRyIBddRdEZWP6GZhNK/yjwew9ehBo+3jEADu7Ay2n8mDc+TS7awUHg0OMzR0LABhqLD4hJEh/BEGyBdGlSJoXYXtr+3HS4ijzVpgi0paWXtdruGTknXBz+11qT1Q2inxaTzQCO46P3lfLpyS4fou2PH/PupwZgCxNhGlj4IvUuWEsTkqMWm6i4xCSMc9N1RDQoCVcuGItJ/MRWefais+3synowi/dESgJjkilnWnBTGvRWmaw8oR15257t7CHmCf8HOn7cwI8+NQBXMBEmAa8PMRemrNCEhLGEhDQKcGZWS319BX9PFBEwGTbRBhLbDcaV3drFcDqk5kCTd2JF1Wp0HraqBx8U0wwBTnbpCadwBA/gTH/CDrcCs93LV8E0YlmmcyQRQnjBa8JESmGUfIjK/7fkaDJpmD2QptFNVJU1bbtIAjjWQizepOKptRjbzR9Kag6xZmMLLjHOtcLT3Tx9o/0EcTT1XN3E45u24AiwEypDJXihKjQxjLprEwcmRKclaDNZCVqr/V8mYWyFADbusiY5hvgFoU2vio49RgJLn5OsReRFN6tabeetiiy0V7KFHT3HyZLx491u95sn4K1QQSPKM9hNT0wMVvAWbzDSVdrKw4zRjZMyJIHkfq1VAVCDl/bUhNKlGq0zGr05+YAceXVPCttVk0oqjVwMPt+BBefx4yPtGVkUsqY3CHDPiCM5ngupUwCdbkpd8kbPrCWHhkmtIKLEetF2499eS1jZlIPGYnlcPXeM2KD9vLS0bW3ktYNqUllpKLn5ZrsxlIzxvDu5eHxzGLctkZLEY4PgSOg2IUVVcUONzUDBEpRaMoXNmUc0tFZrTZquiLyKxrSm3DvIW9Fil+AkhXu5PhEPx9mUNwqypDvZWdKlhIJQY7vn2OsnmBeOWnYZ0m1iwbbw1U60by5om47iHRV6fOgzjMf/DAZrlP40Z7syxpLK0lJ0gqaAK1c2KQKu7tabTXkLFz0sCftuwX++MyNeNn68k5Buq23YQhUh0SNTJa1ioQ0p4nUG2y0XilF1JqODqdImloPS4Bp111DEWT0jJjVv95uX9BBV7eB3bUWcu0acSVM23YZdd8R8UbQUxJ9wdu3oMuhdt929ME+mh6JXJ8di2RxbTi6TbrDquqV4aUKR2iwT6aZbyOwEXN3DUsWr8Hn4EhwNyHuXHh7/pdaUjtR7vnDh/d8c9xD/s5f501eQ1+CuDiCvGhk1AN/4Tf74RfxPwD3toLarR0zNtsnPzmS64KIRk861dMWCU8ArasG9T9H0ZBpsDGnjtAOM2+/LuIb2iIUGXNgl5ZmKD/Tw8TlaAuihaFP5yrw18v4x1898zIdP+DDAX1bM3GAMvPgRP/cJn3zCW013nrhHkrITyvYuwOUkcHuKlRSW5C6rzIdY4ppnF7J8aAJbQepgbJYBjCY9usGXDKQxq7RZfh9eg5d1UHMVATRaD/4BHK93/1iAgYZ/+jqPn8Dn4UExmWrpa3+ZOK6MvM3bjwfzxNWA2dhs8+51XHSPJiaAhGSpWevEs5xHLXcEGFXYiCONySH3fPWq93JIsBiSWvWyc3CAN+EcXoT7rCSANloPPoa31rt/5PUA/gp8Q/jDD3hyrjzlR8VkanfOvB1XPubt17vzxAfdSVbD1pzAnfgyF3ycadOTOTXhpEUoLC1HZyNGW3dtmjeXgr2r56JNmRwdNNWaQVBddd6rh4MhviEB9EFRD/7RGvePvCbwAL4Mx/D6M541hHO4D3e7g6PafdcZVw689z7NGTwo5om7A8sPhccT6qKcl9NJl9aM/9kX+e59Hh1yPqGuCCZxuITcsmNaJ5F7d0q6J3H48TO1/+M57085q2icdu2U+W36Ldllz9Agiv4YGljoEN908EzvDOrBF98/vtJwCC/BF2AG75xxEmjmMIcjxbjoaxqOK3/4hPOZzhMPBpYPG44CM0dTVm1LjLtUWWVz1Bcf8tEx0zs8O2A2YVHRxKYOiy/aOVoAaMu0i7ubu43njjmd4ibMHU1sIDHaQNKrZND/FZYdk54oCXetjq7E7IVl9eAL7t+oHnwXXtLx44czzoRFHBztYVwtH1d+NOMkupZ5MTM+gUmq90X+Bh9zjRlmaQ+m7YMqUL/veemcecAtOJ0yq1JnVlN27di2E0+Klp1tAJ4KRw1eMI7aJjsO3R8kPSI3fUFXnIOfdQe86sIIVtWDL7h//Ok6vj8vwDk08NEcI8zz7OhBy+WwalzZeZ4+0XniRfst9pAJqQHDGLzVQ2pheZnnv1OWhwO43/AgcvAEXEVVpa4db9sGvNK8wjaENHkfFQ4Ci5i7dqnQlPoLQrHXZDvO3BIXZbJOBrOaEbML6sFL798I4FhKihjHMsPjBUZYCMFr6nvaArxqXPn4lCa+cHfSa2cP27g3Z3ziYTRrcbQNGLQmGF3F3cBdzzzX7AILx0IB9rbwn9kx2G1FW3Inic+ZLIsVvKR8Zwfj0l1fkqo8LWY1M3IX14OX3r9RKTIO+d9XzAI8qRPGPn/4NC2n6o4rN8XJ82TOIvuVA8zLKUHRFgBCetlDZlqR1gLKjS39xoE7Bt8UvA6BxuEDjU3tFsEijgA+615tmZkXKqiEENrh41iLDDZNq4pKTWR3LZfnos81LOuNa15cD956vLMsJd1rqYp51gDUQqMYm2XsxnUhD2jg1DM7SeuJxxgrmpfISSXVIJIS5qJJSvJPEQ49DQTVIbYWJ9QWa/E2+c/oPK1drmC7WSfJRNKBO5Yjvcp7Gc3dmmI/Xh1kDTEuiSnWqQf37h+fTMhGnDf6dsS8SQfQWlqqwXXGlc/PEZ/SC5mtzIV0nAshlQdM/LvUtYutrEZ/Y+EAFtq1k28zQhOwLr1AIeANzhF8t9qzTdZf2qRKO6MWE9ohBYwibbOmrFtNmg3mcS+tB28xv2uKd/agYCvOP+GkSc+0lr7RXzyufL7QbkUpjLjEWFLqOIkAGu2B0tNlO9Eau2W1qcOUvVRgKzypKIQZ5KI3q0MLzqTNRYqiZOqmtqloIRlmkBHVpHmRYV6/HixbO6UC47KOFJnoMrVyr7wYz+SlW6GUaghYbY1I6kkxA2W1fSJokUdSh2LQ1GAimRGm0MT+uu57H5l7QgOWxERpO9moLRPgTtquWCfFlGlIjQaRly9odmzMOWY+IBO5tB4sW/0+VWGUh32qYk79EidWKrjWuiLpiVNGFWFRJVktyeXWmbgBBzVl8anPuXyNJlBJOlKLTgAbi/EYHVHxWiDaVR06GnHQNpJcWcK2jJtiCfG2sEHLzuI66sGrMK47nPIInPnu799935aOK2cvmvubrE38ZzZjrELCmXM2hM7UcpXD2oC3+ECVp7xtIuxptJ0jUr3sBmBS47TVxlvJ1Sqb/E0uLdvLj0lLr29ypdd/eMX3f6lrxGlKwKQxEGvw0qHbkbwrF3uHKwVENbIV2wZ13kNEF6zD+x24aLNMfDTCbDPnEikZFyTNttxWBXDaBuM8KtI2rmaMdUY7cXcUPstqTGvBGSrFWIpNMfbdea990bvAOC1YX0qbc6smDS1mPxSJoW4fwEXvjMmhlijDRq6qale6aJEuFGoppYDoBELQzLBuh/mZNx7jkinv0EtnUp50lO9hbNK57lZaMAWuWR5Yo9/kYwcYI0t4gWM47Umnl3YmpeBPqSyNp3K7s2DSAS/39KRuEN2bS4xvowV3dFRMx/VFcp2Yp8w2nTO9hCXtHG1kF1L4KlrJr2wKfyq77R7MKpFKzWlY9UkhYxyHWW6nBWPaudvEAl3CGcNpSXPZ6R9BbBtIl6cHL3gIBi+42CYXqCx1gfGWe7Ap0h3luyXdt1MKy4YUT9xSF01G16YEdWsouW9mgDHd3veyA97H+Ya47ZmEbqMY72oPztCGvK0onL44AvgC49saZKkWRz4veWljE1FHjbRJaWv6ZKKtl875h4CziFCZhG5rx7tefsl0aRT1bMHZjm8dwL/6u7wCRysaQblQoG5yAQN5zpatMNY/+yf8z+GLcH/Qn0iX2W2oEfXP4GvwQHuIL9AYGnaO3zqAX6946nkgqZNnUhx43DIdQtMFeOPrgy/y3Yd85HlJWwjLFkU3kFwq28xPnuPhMWeS+tDLV9Otllq7pQCf3uXJDN9wFDiUTgefHaiYbdfi3b3u8+iY6TnzhgehI1LTe8lcd7s1wJSzKbahCRxKKztTLXstGAiu3a6rPuQs5pk9TWAan5f0BZmGf7Ylxzzk/A7PAs4QPPPAHeFQ2hbFHszlgZuKZsJcUmbDC40sEU403cEjczstOEypa+YxevL4QBC8oRYqWdK6b7sK25tfE+oDZgtOQ2Jg8T41HGcBE6fTWHn4JtHcu9S7uYgU5KSCkl/mcnq+5/YBXOEr6lCUCwOTOM1taOI8mSxx1NsCXBEmLKbMAg5MkwbLmpBaFOPrNSlO2HnLiEqW3tHEwd8AeiQLmn+2gxjC3k6AxREqvKcJbTEzlpLiw4rNZK6oJdidbMMGX9FULKr0AkW+2qDEPBNNm5QAt2Ik2nftNWHetubosHLo2nG4vQA7GkcVCgVCgaDixHqo9UUn1A6OshapaNR/LPRYFV8siT1cCtJE0k/3WtaNSuUZYKPnsVIW0xXWnMUxq5+En4Kvw/MqQmVXnAXj9Z+9zM98zM/Agy7F/qqj2Nh67b8HjFnPP3iBn/tkpdzwEJX/whIcQUXOaikeliCRGUk7tiwF0rItwMEhjkZ309hikFoRAmLTpEXWuHS6y+am/KB/fM50aLEhGnSMwkpxzOov4H0AvgovwJ1iGzDLtJn/9BU+fAINfwUe6FHSLhu83viV/+/HrOePX+STT2B9uWGbrMHHLldRBlhS/CJQmcRxJFqZica01XixAZsYiH1uolZxLrR/SgxVIJjkpQP4PE9sE59LKLr7kltSBogS5tyszzH8Fvw8/AS8rNOg0xUS9fIaHwb+6et8Q/gyvKRjf5OusOzGx8evA/BP4IP11uN/grca5O0lcsPLJ5YjwI4QkJBOHa0WdMZYGxPbh2W2nR9v3WxEWqgp/G3+6VZbRLSAAZ3BhdhAaUL33VUSw9yjEsvbaQ9u4A/gGXwZXoEHOuU1GSj2chf+Mo+f8IcfcAxfIKVmyunRbYQVnoevwgfw3TXXcw++xNuP4fhyueEUNttEduRVaDttddoP0eSxLe2LENk6itYxlrxBNBYrNNKSQmeaLcm9c8UsaB5WyO6675yyQIAWSDpBVoA/gxmcwEvwoDv0m58UE7gHn+fJOa8/Ywan8EKRfjsopF83eCglX/Sfr7OeaRoQfvt1CGvIDccH5BCvw1sWIzRGC/66t0VTcLZQZtm6PlAasbOJ9iwWtUo7biktTSIPxnR24jxP1ZKaqq+2RcXM9OrBAm/AAs7hDJ5bNmGb+KIfwCs8a3jnjBrOFeMjHSCdbKr+2uOLfnOd9eiA8Hvvwwq54VbP2OqwkB48Ytc4YEOiH2vTXqodabfWEOzso4qxdbqD5L6tbtNPECqbhnA708DZH4QOJUXqScmUlks7Ot6FBuZw3n2mEbaUX7kDzxHOOQk8nKWMzAzu6ZZ8sOFw4RK+6PcuXo9tB4SbMz58ApfKDXf3szjNIIbGpD5TKTRxGkEMLjLl+K3wlWXBsCUxIDU+jbOiysESqAy1MGUJpXgwbTWzNOVEziIXZrJ+VIztl1PUBxTSo0dwn2bOmfDRPD3TRTGlfbCJvO9KvuhL1hMHhB9wPuPRLGHcdOWG2xc0U+5bQtAJT0nRTewXL1pgk2+rZAdeWmz3jxAqfNQQdzTlbF8uJ5ecEIWvTkevAHpwz7w78QujlD/Lr491bD8/1vhM2yrUQRrWXNQY4fGilfctMWYjL72UL/qS9eiA8EmN88nbNdour+PBbbAjOjIa4iBhfFg6rxeKdEGcL6p3EWR1Qq2Qkhs2DrnkRnmN9tG2EAqmgPw6hoL7Oza7B+3SCrR9tRftko+Lsf2F/mkTndN2LmzuMcKTuj/mX2+4Va3ki16+nnJY+S7MefpkidxwnV+4wkXH8TKnX0tsYzYp29DOOoSW1nf7nTh2akYiWmcJOuTidSaqESrTYpwjJJNVGQr+rLI7WsqerHW6Kp/oM2pKuV7T1QY9gjqlZp41/WfKpl56FV/0kvXQFRyeQ83xaTu5E8p5dNP3dUF34ihyI3GSpeCsywSh22ZJdWto9winhqifb7VRvgktxp13vyjrS0EjvrRfZ62uyqddSWaWYlwTPAtJZ2oZ3j/Sgi/mi+6vpzesfAcWNA0n8xVyw90GVFGuZjTXEQy+6GfLGLMLL523f5E0OmxVjDoOuRiH91RKU+vtoCtH7TgmvBLvtFXWLW15H9GTdVw8ow4IlRLeHECN9ym1e9K0I+Cbnhgv4Yu+aD2HaQJ80XDqOzSGAV4+4yCqBxrsJAX6ZTIoX36QnvzhhzzMfFW2dZVLOJfo0zbce5OvwXMFaZ81mOnlTVXpDZsQNuoYWveketKb5+6JOOsgX+NTm7H49fUTlx+WLuWL7qxnOFh4BxpmJx0p2gDzA/BUARuS6phR+pUsY7MMboAHx5xNsSVfVZcYSwqCKrqon7zM+8ecCkeS4nm3rINuaWvVNnMRI1IRpxTqx8PZUZ0Br/UEduo3B3hNvmgZfs9gQPj8vIOxd2kndir3awvJ6BLvoUuOfFWNYB0LR1OQJoUySKb9IlOBx74q1+ADC2G6rOdmFdJcD8BkfualA+BdjOOzP9uUhGUEX/TwhZsUduwRr8wNuXKurCixLBgpQI0mDbJr9dIqUuV+92ngkJZ7xduCk2yZKbfWrH1VBiTg9VdzsgRjW3CVXCvAwDd+c1z9dWw9+B+8MJL/eY15ZQ/HqvTwVdsZn5WQsgRRnMaWaecu3jFvMBEmgg+FJFZsnSl0zjB9OqPYaBD7qmoVyImFvzi41usesV0julaAR9dfR15Xzv9sEruRDyk1nb+QaLU67T885GTls6YgcY+UiMa25M/pwGrbCfzkvR3e0jjtuaFtnwuagHTSb5y7boBH119HXhvwP487jJLsLJ4XnUkHX5sLbS61dpiAXRoZSCrFJ+EjpeU3puVfitngYNo6PJrAigKktmwjyQdZpfq30mmtulaAx9Zfx15Xzv+cyeuiBFUs9zq8Kq+XB9a4PVvph3GV4E3y8HENJrN55H1X2p8VyqSKwVusJDKzXOZzplWdzBUFK9e+B4+uv468xvI/b5xtSAkBHQaPvtqWzllVvEOxPbuiE6+j2pvjcKsbvI7txnRErgfH7LdXqjq0IokKzga14GzQ23SSbCQvO6r+Or7SMIr/efOkkqSdMnj9mBx2DRsiY29Uj6+qK9ZrssCKaptR6HKURdwUYeUWA2kPzVKQO8ku2nU3Anhs/XWkBx3F/7wJtCTTTIKftthue1ty9xvNYLY/zo5KSbIuKbXpbEdSyeRyYdAIwKY2neyoc3+k1XUaufYga3T9daMUx/r8z1s10ITknIO0kuoMt+TB8jK0lpayqqjsJ2qtXAYwBU932zinimgmd6mTRDnQfr88q36NAI+tv24E8Pr8zxtasBqx0+xHH9HhlrwsxxNUfKOHQaZBITNf0uccj8GXiVmXAuPEAKSdN/4GLHhs/XWj92dN/uetNuBMnVR+XWDc25JLjo5Mg5IZIq226tmCsip2zZliL213YrTlL2hcFjpCduyim3M7/eB16q/blQsv5X/esDRbtJeabLIosWy3ycavwLhtxdWzbMmHiBTiVjJo6lCLjXZsi7p9PEPnsq6X6wd4bP11i0rD5fzPm/0A6brrIsllenZs0lCJlU4abakR59enZKrKe3BZihbTxlyZ2zl1+g0wvgmA166/bhwDrcn/7Ddz0eWZuJvfSESug6NzZsox3Z04FIxz0mUjMwVOOVTq1CQ0AhdbBGVdjG/CgsfUX7esJl3K/7ytWHRv683praW/8iDOCqWLLhpljDY1ZpzK75QiaZoOTpLKl60auHS/97oBXrv+umU9+FL+5+NtLFgjqVLCdbmj7pY5zPCPLOHNCwXGOcLquOhi8CmCWvbcuO73XmMUPab+ug3A6/A/78Bwe0bcS2+tgHn4J5pyS2WbOck0F51Vq3LcjhLvZ67p1ABbaL2H67bg78BfjKi/jr3+T/ABV3ilLmNXTI2SpvxWBtt6/Z//D0z/FXaGbSBgylzlsEGp+5//xrd4/ae4d8DUUjlslfIYS3t06HZpvfQtvv0N7AHWqtjP2pW08QD/FLy//da38vo8PNlKHf5y37Dxdfe/oj4kVIgFq3koLReSR76W/bx//n9k8jonZxzWTANVwEniDsg87sOSd/z7//PvMp3jQiptGVWFX2caezzAXwfgtzYUvbr0iozs32c3Uge7varH+CNE6cvEYmzbPZ9hMaYDdjK4V2iecf6EcEbdUDVUARda2KzO/JtCuDbNQB/iTeL0EG1JSO1jbXS+nLxtPMDPw1fh5+EPrgSEKE/8Gry5A73ui87AmxwdatyMEBCPNOCSKUeRZ2P6Myb5MRvgCHmA9ywsMifU+AYXcB6Xa5GibUC5TSyerxyh0j6QgLVpdyhfArRTTLqQjwe4HOD9s92D4Ap54odXAPBWLAwB02igG5Kkc+piN4lvODIFGAZgT+EO4Si1s7fjSR7vcQETUkRm9O+MXyo9OYhfe4xt9STQ2pcZRLayCV90b4D3jR0DYAfyxJ+eywg2IL7NTMXna7S/RpQ63JhWEM8U41ZyQGjwsVS0QBrEKLu8xwZsbi4wLcCT+OGidPIOCe1PiSc9Qt+go+vYqB7cG+B9d8cAD+WJPz0Am2gxXgU9IneOqDpAAXOsOltVuMzpdakJXrdPCzXiNVUpCeOos5cxnpQT39G+XVLhs1osQVvJKPZyNq8HDwd4d7pNDuWJPxVX7MSzqUDU6gfadKiNlUFTzLeFHHDlzO4kpa7aiKhBPGKwOqxsBAmYkOIpipyXcQSPlRTf+Tii0U3EJGaZsDER2qoB3h2hu0qe+NNwUooYU8y5mILbJe6OuX+2FTKy7bieTDAemaQyQ0CPthljSWO+xmFDIYiESjM5xKd6Ik5lvLq5GrQ3aCMLvmCA9wowLuWJb9xF59hVVP6O0CrBi3ZjZSNOvRy+I6klNVRJYRBaEzdN+imiUXQ8iVF8fsp+W4JXw7WISW7fDh7lptWkCwZ4d7QTXyBPfJMYK7SijjFppGnlIVJBJBYj7eUwtiP1IBXGI1XCsjNpbjENVpSAJ2hq2LTywEly3hUYazt31J8w2+aiLx3g3fohXixPfOMYm6zCGs9LVo9MoW3MCJE7R5u/WsOIjrqBoHUO0bJE9vxBpbhsd3+Nb4/vtPCZ4oZYCitNeYuC/8UDvDvy0qvkiW/cgqNqRyzqSZa/s0mqNGjtKOoTm14zZpUauiQgVfqtQiZjq7Q27JNaSK5ExRcrGCXO1FJYh6jR6CFqK7bZdQZ4t8g0rSlPfP1RdBtqaa9diqtzJkQ9duSryi2brQXbxDwbRUpFMBHjRj8+Nt7GDKgvph9okW7LX47gu0SpGnnFQ1S1lYldOsC7hYteR574ZuKs7Ei1lBsfdz7IZoxzzCVmmVqaSySzQbBVAWDek+N4jh9E/4VqZrJjPwiv9BC1XcvOWgO8275CVyBPvAtTVlDJfZkaZGU7NpqBogAj/xEHkeAuJihWYCxGN6e8+9JtSegFXF1TrhhLGP1fak3pebgPz192/8gB4d/6WT7+GdYnpH7hH/DJzzFiYPn/vjW0SgNpTNuPIZoAEZv8tlGw4+RLxy+ZjnKa5NdFoC7UaW0aduoYse6+bXg1DLg6UfRYwmhGEjqPvF75U558SANrElK/+MdpXvmqBpaXOa/MTZaa1DOcSiLaw9j0NNNst3c+63c7EKTpkvKHzu6bPbP0RkuHAVcbRY8ijP46MIbQeeT1mhA+5PV/inyDdQipf8LTvMXbwvoDy7IruDNVZKTfV4CTSRUYdybUCnGU7KUTDxLgCknqUm5aAW6/1p6eMsOYsphLzsHrE0Y/P5bQedx1F/4yPHnMB3/IOoTU9+BL8PhtjuFKBpZXnYNJxTuv+2XqolKR2UQgHhS5novuxVySJhBNRF3SoKK1XZbbXjVwWNyOjlqWJjrWJIy+P5bQedyldNScP+HZ61xKSK3jyrz+NiHG1hcOLL/+P+PDF2gOkekKGiNWKgJ+8Z/x8Iv4DdQHzcpZyF4v19I27w9/yPGDFQvmEpKtqv/TLiWMfn4sofMm9eAH8Ao0zzh7h4sJqYtxZd5/D7hkYPneDzl5idlzNHcIB0jVlQ+8ULzw/nc5/ojzl2juE0apD7LRnJxe04dMz2iOCFNtGFpTuXA5AhcTRo8mdN4kz30nVjEC4YTZQy4gpC7GlTlrePKhGsKKgeXpCYeO0MAd/GH7yKQUlXPLOasOH3FnSphjHuDvEu4gB8g66oNbtr6eMbFIA4fIBJkgayoXriw2XEDQPJrQeROAlY6aeYOcMf+IVYTU3XFlZufMHinGywaW3YLpObVBAsbjF4QJMsVUSayjk4voPsHJOQfPWDhCgDnmDl6XIRerD24HsGtw86RMHOLvVSHrKBdeVE26gKB5NKHzaIwLOmrqBWJYZDLhASG16c0Tn+CdRhWDgWXnqRZUTnPIHuMJTfLVpkoYy5CzylHVTGZMTwkGAo2HBlkQplrJX6U+uF1wZz2uwS1SQ12IqWaPuO4baZaEFBdukksJmkcTOm+YJSvoqPFzxFA/YUhIvWxcmSdPWTWwbAKVp6rxTtPFUZfKIwpzm4IoMfaYQLWgmlG5FME2gdBgm+J7J+rtS/XBbaVLsR7bpPQnpMFlo2doWaVceHk9+MkyguZNCJ1He+kuHTWyQAzNM5YSUg/GlTk9ZunAsg1qELVOhUSAK0LABIJHLKbqaEbHZLL1VA3VgqoiOKXYiS+HRyaEKgsfIqX64HYWbLRXy/qWoylIV9gudL1OWBNgBgTNmxA6b4txDT4gi3Ri7xFSLxtXpmmYnzAcWDZgY8d503LFogz5sbonDgkKcxGsWsE1OI+rcQtlgBBCSOKD1mtqYpIU8cTvBmAT0yZe+zUzeY92fYjTtGipXLhuR0ePoHk0ofNWBX+lo8Z7pAZDk8mEw5L7dVyZZoE/pTewbI6SNbiAL5xeygW4xPRuLCGbhcO4RIeTMFYHEJkYyEO9HmJfXMDEj/LaH781wHHZEtqSQ/69UnGpzH7LKIAZEDSPJnTesJTUa+rwTepI9dLJEawYV+ZkRn9g+QirD8vF8Mq0jFQ29js6kCS3E1+jZIhgPNanHdHFqFvPJLHqFwQqbIA4jhDxcNsOCCQLDomaL/dr5lyJaJU6FxPFjO3JOh3kVMcROo8u+C+jo05GjMF3P3/FuDLn5x2M04xXULPwaS6hBYki+MrMdZJSgPHlcB7nCR5bJ9Kr5ACUn9jk5kivdd8tk95SOGrtqu9lr2IhK65ZtEl7ZKrp7DrqwZfRUSN1el7+7NJxZbywOC8neNKTch5vsTEMNsoCCqHBCqIPRjIPkm0BjvFODGtto99rCl+d3wmHkW0FPdpZtC7MMcVtGFQjJLX5bdQ2+x9ypdc313uj8xlsrfuLgWXz1cRhZvJYX0iNVBRcVcmCXZs6aEf3RQF2WI/TcCbKmGU3IOoDJGDdDub0+hYckt6PlGu2BcxmhbTdj/klhccLGJMcqRjMJP1jW2ETqLSWJ/29MAoORluJ+6LPffBZbi5gqi5h6catQpmOT7/OFf5UorRpLzCqcMltBLhwd1are3kztrSzXO0LUbXRQcdLh/RdSZ+swRm819REDrtqzC4es6Gw4JCKlSnjYVpo0xeq33PrADbFLL3RuCmObVmPN+24kfa+AojDuM4umKe2QwCf6EN906HwjujaitDs5o0s1y+k3lgbT2W2i7FJdnwbLXhJUBq/9liTctSmFC/0OqUinb0QddTWamtjbHRFuWJJ6NpqZ8vO3fZJ37Db+2GkaPYLGHs7XTTdiFQJ68SkVJFVmY6McR5UycflNCsccHFaV9FNbR4NttLxw4pQ7wJd066Z0ohVbzihaxHVExd/ay04oxUKWt+AsdiQ9OUyZ2krzN19IZIwafSTFgIBnMV73ADj7V/K8u1MaY2sJp2HWm0f41tqwajEvdHWOJs510MaAqN4aoSiPCXtN2KSi46dUxHdaMquar82O1x5jqhDGvqmoE9LfxcY3zqA7/x3HA67r9ZG4O6Cuxu12/+TP+eLP+I+HErqDDCDVmBDO4larujNe7x8om2rMug0MX0rL1+IWwdwfR+p1TNTyNmVJ85ljWzbWuGv8/C7HD/izjkHNZNYlhZcUOKVzKFUxsxxN/kax+8zPWPSFKw80rJr9Tizyj3o1gEsdwgWGoxPezDdZ1TSENE1dLdNvuKL+I84nxKesZgxXVA1VA1OcL49dFlpFV5yJMhzyCmNQ+a4BqusPJ2bB+xo8V9u3x48VVIEPS/mc3DvAbXyoYr6VgDfh5do5hhHOCXMqBZUPhWYbWZECwVJljLgMUWOCB4MUuMaxGNUQDVI50TQ+S3kFgIcu2qKkNSHVoM0SHsgoZxP2d5HH8B9woOk4x5bPkKtAHucZsdykjxuIpbUrSILgrT8G7G5oCW+K0990o7E3T6AdW4TilH5kDjds+H64kS0mz24grtwlzDHBJqI8YJQExotPvoC4JBq0lEjjQkyBZ8oH2LnRsQ4Hu1QsgDTJbO8fQDnllitkxuVskoiKbRF9VwzMDvxHAdwB7mD9yCplhHFEyUWHx3WtwCbSMMTCUCcEmSGlg4gTXkHpZXWQ7kpznK3EmCHiXInqndkQjunG5kxTKEeGye7jWz9cyMR2mGiFQ15ENRBTbCp+Gh86vAyASdgmJq2MC6hoADQ3GosP0QHbnMHjyBQvQqfhy/BUbeHd5WY/G/9LK/8Ka8Jd7UFeNWEZvzPb458Dn8DGLOe3/wGL/4xP+HXlRt+M1PE2iLhR8t+lfgxsuh7AfO2AOf+owWhSZRYQbd622hbpKWKuU+XuvNzP0OseRDa+mObgDHJUSc/pKx31QdKffQ5OIJpt8GWjlgTwMc/w5MPCR/yl1XC2a2Yut54SvOtMev55Of45BOat9aWG27p2ZVORRvnEk1hqWMVUmqa7S2YtvlIpspuF1pt0syuZS2NV14mUidCSfzQzg+KqvIYCMljIx2YK2AO34fX4GWdu5xcIAb8MzTw+j/lyWM+Dw/gjs4GD6ehNgA48kX/AI7XXM/XAN4WHr+9ntywqoCakCqmKP0rmQrJJEErG2Upg1JObr01lKQy4jskWalKYfJ/EDLMpjNSHFEUAde2fltaDgmrNaWQ9+AAb8I5vKjz3L1n1LriB/BXkG/wwR9y/oRX4LlioHA4LzP2inzRx/DWmutRweFjeP3tNeSGlaE1Fde0OS11yOpmbIp2u/jF1n2RRZviJM0yBT3IZl2HWImKjQOxIyeU325b/qWyU9Moj1o07tS0G7qJDoGHg5m8yeCxMoEH8GU45tnrNM84D2l297DQ9t1YP7jki/7RmutRweEA77/HWXOh3HCxkRgldDQkAjNTMl2Iloc1qN5JfJeeTlyTRzxURTdn1Ixv2uKjs12AbdEWlBtmVdk2k7FFwj07PCZ9XAwW3dG+8xKzNFr4EnwBZpy9Qzhh3jDXebBpYcpuo4fQ44u+fD1dweEnHzI7v0xuuOALRUV8rXpFyfSTQYkhd7IHm07jpyhlkCmI0ALYqPTpUxXS+z4jgDj1Pflvmz5ecuItpIBxyTHpSTGWd9g1ApfD/bvwUhL4nT1EzqgX7cxfCcNmb3mPL/qi9SwTHJ49oj5ZLjccbTG3pRmlYi6JCG0mQrAt1+i2UXTZ2dv9IlQpN5naMYtviaXlTrFpoMsl3bOAFEa8sqPj2WCMrx3Yjx99qFwO59Aw/wgx+HlqNz8oZvA3exRDvuhL1jMQHPaOJ0+XyA3fp1OfM3qObEVdhxjvynxNMXQV4+GJyvOEFqeQBaIbbO7i63rpxCltdZShPFxkjM2FPVkn3TG+Rp9pO3l2RzFegGfxGDHIAh8SteR0C4HopXzRF61nheDw6TFN05Ebvq8M3VKKpGjjO6r7nhudTEGMtYM92HTDaR1FDMXJ1eThsbKfywyoWwrzRSXkc51flG3vIid62h29bIcFbTGhfV+faaB+ohj7dPN0C2e2lC96+XouFByen9AsunLDJZ9z7NExiUc0OuoYW6UZkIyx2YUR2z6/TiRjyKMx5GbbjLHvHuf7YmtKghf34LJfx63Yg8vrvN2zC7lY0x0tvKezo4HmGYDU+Gab6dFL+KI761lDcNifcjLrrr9LWZJctG1FfU1uwhoQE22ObjdfkSzY63CbU5hzs21WeTddH2BaL11Gi7lVdlxP1nkxqhnKhVY6knS3EPgVGg1JpN5cP/hivujOelhXcPj8HC/LyI6MkteVjlolBdMmF3a3DbsuAYhL44dxzthWSN065xxUd55Lmf0wRbOYOqH09/o9WbO2VtFdaMb4qBgtFJoT1SqoN8wPXMoXLb3p1PUEhxfnnLzGzBI0Ku7FxrKsNJj/8bn/H8fPIVOd3rfrklUB/DOeO+nkghgSPzrlPxluCMtOnDL4Yml6dK1r3vsgMxgtPOrMFUZbEUbTdIzii5beq72G4PD0DKnwjmBULUVFmy8t+k7fZ3pKc0Q4UC6jpVRqS9Umv8bxw35flZVOU1X7qkjnhZlsMbk24qQ6Hz7QcuL6sDC0iHHki96Uh2UdvmgZnjIvExy2TeJdMDZNSbdZyAHe/Yd1xsQhHiKzjh7GxQ4yqMPaywPkjMamvqrYpmO7Knad+ZQC5msCuAPWUoxrxVhrGv7a+KLXFhyONdTMrZ7ke23qiO40ZJUyzgYyX5XyL0mV7NiUzEs9mjtbMN0dERqwyAJpigad0B3/zRV7s4PIfXSu6YV/MK7+OrYe/JvfGMn/PHJe2fyUdtnFrKRNpXV0Y2559aWPt/G4BlvjTMtXlVIWCnNyA3YQBDmYIodFz41PvXPSa6rq9lWZawZ4dP115HXV/M/tnFkkrBOdzg6aP4pID+MZnTJ1SuuB6iZlyiox4HT2y3YBtkUKWooacBQUDTpjwaDt5poBHl1/HXltwP887lKKXxNUEyPqpGTyA699UqY/lt9yGdlUKra0fFWS+36iylVWrAyd7Uw0CZM0z7xKTOduznLIjG2Hx8cDPLb+OvK6Bv7n1DYci4CxUuRxrjBc0bb4vD3rN5Zz36ntLb83eVJIB8LiIzCmn6SMPjlX+yNlTjvIGjs+QzHPf60Aj62/jrzG8j9vYMFtm1VoRWCJdmw7z9N0t+c8cxZpPeK4aTRicS25QhrVtUp7U578chk4q04Wx4YoQSjFryUlpcQ1AbxZ/XVMknIU//OGl7Q6z9Zpxi0+3yFhSkjUDpnCIUhLWVX23KQ+L9vKvFKI0ZWFQgkDLvBoylrHNVmaw10zwCPrr5tlodfnf94EWnQ0lFRWy8pW9LbkLsyUVDc2NSTHGDtnD1uMtchjbCeb1mpxFP0YbcClhzdLu6lfO8Bj6q+bdT2sz/+8SZCV7VIxtt0DUn9L7r4cLYWDSXnseEpOGFuty0qbOVlS7NNzs5FOGJUqQpl2Q64/yBpZf90sxbE+//PGdZ02HSipCbmD6NItmQ4Lk5XUrGpDMkhbMm2ZVheNYV+VbUWTcv99+2NyX1VoafSuC+AN6q9bFIMv5X/eagNWXZxEa9JjlMwNWb00akGUkSoepp1/yRuuqHGbUn3UdBSTxBU6SEVklzWRUkPndVvw2PrrpjvxOvzPmwHc0hpmq82npi7GRro8dXp0KXnUQmhZbRL7NEVp1uuZmO45vuzKsHrktS3GLWXODVjw+vXXLYx4Hf7njRPd0i3aoAGX6W29GnaV5YdyDj9TFkakje7GHYzDoObfddHtOSpoi2SmzJHrB3hM/XUDDEbxP2/oosszcRlehWXUvzHv4TpBVktHqwenFo8uLVmy4DKLa5d3RtLrmrM3aMFr1183E4sewf+85VWeg1c5ag276NZrM9IJVNcmLEvDNaV62aq+14IAOGFsBt973Ra8Xv11YzXwNfmft7Jg2oS+XOyoC8/cwzi66Dhmgk38kUmP1CUiYWOX1bpD2zWXt2FCp7uq8703APAa9dfNdscR/M/bZLIyouVxqJfeWvG9Je+JVckHQ9+CI9NWxz+blX/KYYvO5n2tAP/vrlZ7+8/h9y+9qeB/Hnt967e5mevX10rALDWK//FaAT5MXdBXdP0C/BAes792c40H+AiAp1e1oH8HgH94g/Lttx1gp63op1eyoM/Bvw5/G/7xFbqJPcCXnmBiwDPb/YKO4FX4OjyCb289db2/Noqicw4i7N6TVtoz8tNwDH+8x/i6Ae7lmaQVENzJFb3Di/BFeAwz+Is9SjeQySpPqbLFlNmyz47z5a/AF+AYFvDmHqibSXTEzoT4Gc3OALaqAP4KPFUJ6n+1x+rGAM6Zd78bgJ0a8QN4GU614vxwD9e1Amy6CcskNrczLx1JIp6HE5UZD/DBHrFr2oNlgG4Odv226BodoryjGJ9q2T/AR3vQrsOCS0ctXZi3ruLlhpFDJYl4HmYtjQCP9rhdn4suySLKDt6wLcC52h8xPlcjju1fn+yhuw4LZsAGUuo2b4Fx2UwQu77uqRHXGtg92aN3tQCbFexc0uk93vhTXbct6y7MulLycoUljx8ngDMBg1tvJjAazpEmOtxlzclvj1vQf1Tx7QlPDpGpqgtdSKz/d9/hdy1vTfFHSmC9dGDZbLiezz7Ac801HirGZsWjydfZyPvHXL/Y8Mjzg8BxTZiuwKz4Eb8sBE9zznszmjvFwHKPIWUnwhqfVRcd4Ck0K6ate48m1oOfrX3/yOtvAsJ8zsPAM89sjnddmuLuDPjX9Bu/L7x7xpMzFk6nWtyQfPg278Gn4Aekz2ZgOmU9eJ37R14vwE/BL8G3aibCiWMWWDQ0ZtkPMnlcGeAu/Ag+8ZyecU5BPuy2ILD+sQqyZhAKmn7XZd+jIMTN9eBL7x95xVLSX4On8EcNlXDqmBlqS13jG4LpmGbkF/0CnOi3H8ETOIXzmnmtb0a16Tzxj1sUvQCBiXZGDtmB3KAefPH94xcUa/6vwRn80GOFyjEXFpba4A1e8KQfFF+259tx5XS4egYn8fQsLGrqGrHbztr+uByTahWuL1NUGbDpsnrwBfePPwHHIf9X4RnM4Z2ABWdxUBlqQ2PwhuDxoS0vvqB1JzS0P4h2nA/QgTrsJFn+Y3AOjs9JFC07CGWX1oNX3T/yHOzgDjwPn1PM3g9Jk9lZrMEpxnlPmBbjyo2+KFXRU52TJM/2ALcY57RUzjObbjqxVw++4P6RAOf58pcVsw9Daje3htriYrpDOonre3CudSe6bfkTEgHBHuDiyu5MCsc7BHhYDx7ePxLjqigXZsw+ijMHFhuwBmtoTPtOxOrTvYJDnC75dnUbhfwu/ZW9AgYd+peL68HD+0emKquiXHhWjJg/UrkJYzuiaL3E9aI/ytrCvAd4GcYZMCkSQxfUg3v3j8c4e90j5ZTPdvmJJGHnOCI2nHS8081X013pHuBlV1gB2MX1YNmWLHqqGN/TWmG0y6clJWthxNUl48q38Bi8vtMKyzzpFdSDhxZ5WBA5ZLt8Jv3895DduBlgbPYAj8C4B8hO68FDkoh5lydC4FiWvBOVqjYdqjiLv92t8yPDjrDaiHdUD15qkSURSGmXJwOMSxWAXYwr3zaAufJ66l+94vv3AO+vPcD7aw/w/toDvL/2AO+vPcD7aw/wHuD9tQd4f+0B3l97gPfXHuD9tQd4f+0B3l97gG8LwP8G/AL8O/A5OCq0Ys2KIdv/qOIXG/4mvFAMF16gZD+2Xvu/B8as5+8bfllWyg0zaNO5bfXj6vfhhwD86/Aq3NfRS9t9WPnhfnvCIw/CT8GLcFTMnpntdF/z9V+PWc/vWoIH+FL3Znv57PitcdGP4R/C34avw5fgRVUInCwbsn1yyA8C8zm/BH8NXoXnVE6wVPjdeCI38kX/3+Ct9dbz1pTmHFRu+Hm4O9Ch3clr99negxfwj+ER/DR8EV6B5+DuQOnTgUw5rnkY+FbNU3gNXh0o/JYTuWOvyBf9FvzX663HH/HejO8LwAl8Hl5YLTd8q7sqA3wbjuExfAFegQdwfyDoSkWY8swzEf6o4Qyewefg+cHNbqMQruSL/u/WWc+E5g7vnnEXgDmcDeSGb/F4cBcCgT+GGRzDU3hZYburAt9TEtHgbM6JoxJ+6NMzzTcf6c2bycv2+KK/f+l6LBzw5IwfqZJhA3M472pWT/ajKxnjv4AFnMEpnBTPND6s2J7qHbPAqcMK74T2mZ4VGB9uJA465It+/eL1WKhYOD7xHOkr1ajK7d0C4+ke4Hy9qXZwpgLr+Znm/uNFw8xQOSy8H9IzjUrd9+BIfenYaylf9FsXr8fBAadnPIEDna8IBcwlxnuA0/Wv6GAWPd7dDIKjMdSWueAsBj4M7TOd06qBbwDwKr7oleuxMOEcTuEZTHWvDYUO7aHqAe0Bbq+HEFRzOz7WVoTDQkVds7A4sIIxfCQdCefFRoIOF/NFL1mPab/nvOakSL/Q1aFtNpUb/nFOVX6gzyg/1nISyDfUhsokIzaBR9Kxm80s5mK+6P56il1jXic7nhQxsxSm3OwBHl4fFdLqi64nDQZvqE2at7cWAp/IVvrN6/BFL1mPhYrGMBfOi4PyjuSGf6wBBh7p/FZTghCNWGgMzlBbrNJoPJX2mW5mwZfyRffXo7OFi5pZcS4qZUrlViptrXtw+GQoyhDPS+ANjcGBNRiLCQDPZPMHuiZfdFpPSTcQwwKYdRNqpkjm7AFeeT0pJzALgo7g8YYGrMHS0iocy+YTm2vyRUvvpXCIpQ5pe666TJrcygnScUf/p0NDs/iAI/nqDHC8TmQT8x3NF91l76oDdQGwu61Z6E0ABv7uO1dbf/37Zlv+Zw/Pbh8f1s4Avur6657/+YYBvur6657/+YYBvur6657/+YYBvur6657/+aYBvuL6657/+VMA8FXWX/f8zzcN8BXXX/f8zzcNMFdbf93zP38KLPiK6697/uebtuArrr/u+Z9vGmCusP6653/+1FjwVdZf9/zPN7oHX339dc//fNMu+irrr3v+50+Bi+Zq6697/uebA/jz8Pudf9ht/fWv517J/XUzAP8C/BAeX9WCDrUpZ3/dEMBxgPcfbtTVvsYV5Yn32u03B3Ac4P3b8I+vxNBKeeL9dRMAlwO83959qGO78sT769oB7g3w/vGVYFzKE++v6wV4OMD7F7tckFkmT7y/rhHgpQO8b+4Y46XyxPvrugBeNcB7BRiX8sT767oAvmCA9woAHsoT76+rBJjLBnh3txOvkifeX1dswZcO8G6N7sXyxPvr6i340gHe3TnqVfLE++uKAb50gHcXLnrX8sR7gNdPRqwzwLu7Y/FO5Yn3AK9jXCMGeHdgxDuVJ75VAI8ljP7PAb3/RfjcZfePHBB+79dpfpH1CanN30d+mT1h9GqAxxJGM5LQeeQ1+Tb+EQJrElLb38VHQ94TRq900aMIo8cSOo+8Dp8QfsB8zpqE1NO3OI9Zrj1h9EV78PqE0WMJnUdeU6E+Jjyk/hbrEFIfeWbvId8H9oTRFwdZaxJGvziW0Hn0gqYB/wyZ0PwRlxJST+BOw9m77Amj14ii1yGM/txYQudN0qDzGe4EqfA/5GJCagsHcPaEPWH0esekSwmjRxM6b5JEcZ4ww50ilvAOFxBSx4yLW+A/YU8YvfY5+ALC6NGEzhtmyZoFZoarwBLeZxUhtY4rc3bKnjB6TKJjFUHzJoTOozF2YBpsjcyxDgzhQ1YRUse8+J4wenwmaylB82hC5w0zoRXUNXaRBmSMQUqiWSWkLsaVqc/ZE0aPTFUuJWgeTei8SfLZQeMxNaZSIzbII4aE1Nmr13P2hNHjc9E9guYNCZ032YlNwESMLcZiLQHkE4aE1BFg0yAR4z1h9AiAGRA0jyZ03tyIxWMajMPWBIsxYJCnlITU5ShiHYdZ94TR4wCmSxg9jtB5KyPGYzymAYexWEMwAPIsAdYdV6aObmNPGD0aYLoEzaMJnTc0Ygs+YDw0GAtqxBjkuP38bMRWCHn73xNGjz75P73WenCEJnhwyVe3AEe8TtKdJcYhBl97wuhNAObK66lvD/9J9NS75v17wuitAN5fe4D31x7g/bUHeH/tAd5fe4D3AO+vPcD7aw/w/toDvL/2AO+vPcD7aw/w/toDvAd4f/24ABzZ8o+KLsSLS+Pv/TqTb3P4hKlQrTGh+fbIBT0Axqznnb+L/V2mb3HkN5Mb/nEHeK7d4IcDld6lmDW/iH9E+AH1MdOw/Jlu2T1xNmY98sv4wHnD7D3uNHu54WUuOsBTbQuvBsPT/UfzNxGYzwkP8c+Yz3C+r/i6DcyRL/rZ+utRwWH5PmfvcvYEt9jLDS/bg0/B64DWKrQM8AL8FPwS9beQCe6EMKNZYJol37jBMy35otdaz0Bw2H/C2Smc7+WGB0HWDELBmOByA3r5QONo4V+DpzR/hFS4U8wMW1PXNB4TOqYz9urxRV++ntWCw/U59Ty9ebdWbrgfRS9AYKKN63ZokZVygr8GZ/gfIhZXIXPsAlNjPOLBby5c1eOLvmQ9lwkOy5x6QV1j5TYqpS05JtUgUHUp5toHGsVfn4NX4RnMCe+AxTpwmApTYxqMxwfCeJGjpXzRF61nbcHhUBPqWze9svwcHJ+S6NPscKrEjug78Dx8Lj3T8D4YxGIdxmJcwhi34fzZUr7olevZCw5vkOhoClq5zBPZAnygD/Tl9EzDh6kl3VhsHYcDEb+hCtJSvuiV69kLDm+WycrOTArHmB5/VYyP6jOVjwgGawk2zQOaTcc1L+aLXrKeveDwZqlKrw8U9Y1p66uK8dEzdYwBeUQAY7DbyYNezBfdWQ97weEtAKYQg2xJIkuveAT3dYeLGH+ShrWNwZgN0b2YL7qznr3g8JYAo5bQBziPjx7BPZ0d9RCQp4UZbnFdzBddor4XHN4KYMrB2qHFRIzzcLAHQZ5the5ovui94PCWAPefaYnxIdzRwdHCbuR4B+tbiy96Lzi8E4D7z7S0mEPd+eqO3cT53Z0Y8SV80XvB4Z0ADJi/f7X113f+7p7/+UYBvur6657/+YYBvur6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+VMA8FXWX/f8z58OgK+y/rrnf75RgLna+uue//lTA/CV1V/3/M837aKvvv6653++UQvmauuve/7nTwfAV1N/3fM/fzr24Cuuv+75nz8FFnxl9dc9//MOr/8/glixwRuUfM4AAAAASUVORK5CYII=",s.tArea,i),_de("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAhCAAAAABIXyLAAAAAOElEQVRIx2NgGAWjYBSMglEwEICREYRgFBZBqDCSLA2MGPUIVQETE9iNUAqLR5gIeoQKRgwXjwAAGn4AtaFeYLEAAAAASUVORK5CYII=",s.tSearch,o);const a={...Mut};return ys(ms(e,"triangles",Rut,a,s),s)}(t,this.edgesTarget.texture),this.blendRenderable=function But(e,t,n){const r=t.getWidth(),i=t.getHeight(),o={...ua,tColor:O.create(t),tWeights:O.create(n),uTexSizeInv:O.create(Ue.create(1/r,1/i)),uViewport:O.create(Bn())},s={...Fut};return ys(ms(e,"triangles",Out,s,o),o)}(t,n,this.weightsTarget.texture),this._supported=!0}updateState(t){const{gl:n,state:r}=this.webgl;r.enable(n.SCISSOR_TEST),r.disable(n.BLEND),r.disable(n.DEPTH_TEST),r.depthMask(!1);const{x:i,y:o,width:s,height:a}=t;r.viewport(i,o,s,a),r.scissor(i,o,s,a),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,1),n.clear(n.COLOR_BUFFER_BIT),O.update(this.edgesRenderable.values.uViewport,Da.toVec4(this.edgesRenderable.values.uViewport.ref.value,t)),O.update(this.weightsRenderable.values.uViewport,Da.toVec4(this.weightsRenderable.values.uViewport.ref.value,t)),O.update(this.blendRenderable.values.uViewport,Da.toVec4(this.blendRenderable.values.uViewport.ref.value,t))}setSize(t,n){const r=this.edgesTarget.getWidth(),i=this.edgesTarget.getHeight();(t!==r||n!==i)&&(this.edgesTarget.setSize(t,n),this.weightsTarget.setSize(t,n),O.update(this.edgesRenderable.values.uTexSizeInv,Ue.set(this.edgesRenderable.values.uTexSizeInv.ref.value,1/t,1/n)),O.update(this.weightsRenderable.values.uTexSizeInv,Ue.set(this.weightsRenderable.values.uTexSizeInv.ref.value,1/t,1/n)),O.update(this.blendRenderable.values.uTexSizeInv,Ue.set(this.blendRenderable.values.uTexSizeInv.ref.value,1/t,1/n)))}update(t,n){let r=!1;this.edgesRenderable.values.tColor.ref.value!==t&&(O.update(this.edgesRenderable.values.tColor,t),r=!0),this.edgesRenderable.values.dEdgeThreshold.ref.value!==n.edgeThreshold&&(O.update(this.edgesRenderable.values.dEdgeThreshold,n.edgeThreshold),r=!0),r&&this.edgesRenderable.update(),this.weightsRenderable.values.dMaxSearchSteps.ref.value!==n.maxSearchSteps&&(O.update(this.weightsRenderable.values.dMaxSearchSteps,n.maxSearchSteps),this.weightsRenderable.update()),this.blendRenderable.values.tColor.ref.value!==t&&(O.update(this.blendRenderable.values.tColor,t),this.blendRenderable.update())}render(t,n){It&&this.webgl.timer.mark("SmaaPass.render"),this.edgesTarget.bind(),this.updateState(t),this.edgesRenderable.render(),this.weightsTarget.bind(),this.updateState(t),this.weightsRenderable.render(),n?n.bind():this.webgl.unbindFramebuffer(),this.updateState(t),this.blendRenderable.render(),It&&this.webgl.timer.markEnd("SmaaPass.render")}}const Dut={...ca,tColor:xn("texture","rgba","ubyte","linear"),uTexSizeInv:Ne("v2"),uViewport:Ne("v4"),dEdgeThreshold:cn("number")},Put=Wi("smaa-edges","\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nuniform vec2 uTexSizeInv;\nuniform vec4 uViewport;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\n\nvoid SMAAEdgeDetectionVS(vec2 texCoord) {\n vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-1.0, 0.0, 0.0, 1.0); // WebGL port note: Changed sign in W component\n vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(1.0, 0.0, 0.0, -1.0); // WebGL port note: Changed sign in W component\n vOffset[2] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-2.0, 0.0, 0.0, 2.0); // WebGL port note: Changed sign in W component\n}\n\nvoid main() {\n vec2 scale = uViewport.zw * uTexSizeInv;\n vec2 shift = uViewport.xy * uTexSizeInv;\n vUv = (aPosition + 1.0) * 0.5 * scale + shift;\n SMAAEdgeDetectionVS(vUv);\n vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n gl_Position = vec4(position, 0.0, 1.0);\n}\n","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\n\nvec4 SMAAColorEdgeDetectionPS(vec2 texcoord, vec4 offset[3], sampler2D colorTex) {\n vec2 threshold = vec2(dEdgeThreshold, dEdgeThreshold);\n\n // Calculate color deltas:\n vec4 delta;\n vec3 C = texture2D(colorTex, texcoord).rgb;\n\n vec3 Cleft = texture2D(colorTex, offset[0].xy).rgb;\n vec3 t = abs(C - Cleft);\n delta.x = max(max(t.r, t.g), t.b);\n\n vec3 Ctop = texture2D(colorTex, offset[0].zw).rgb;\n t = abs(C - Ctop);\n delta.y = max(max(t.r, t.g), t.b);\n\n // We do the usual threshold:\n vec2 edges = step(threshold, delta.xy);\n\n // Then discard if there is no edge:\n if (dot(edges, vec2(1.0, 1.0 )) == 0.0)\n discard;\n\n // Calculate right and bottom deltas:\n vec3 Cright = texture2D(colorTex, offset[1].xy).rgb;\n t = abs( C - Cright );\n delta.z = max(max(t.r, t.g), t.b);\n\n vec3 Cbottom = texture2D(colorTex, offset[1].zw).rgb;\n t = abs(C - Cbottom);\n delta.w = max(max(t.r, t.g), t.b);\n\n // Calculate the maximum delta in the direct neighborhood:\n float maxDelta = max(max(max(delta.x, delta.y), delta.z), delta.w );\n\n // Calculate left-left and top-top deltas:\n vec3 Cleftleft = texture2D(colorTex, offset[2].xy).rgb;\n t = abs( C - Cleftleft );\n delta.z = max(max(t.r, t.g), t.b);\n\n vec3 Ctoptop = texture2D(colorTex, offset[2].zw).rgb;\n t = abs(C - Ctoptop);\n delta.w = max(max(t.r, t.g), t.b);\n\n // Calculate the final maximum delta:\n maxDelta = max(max(maxDelta, delta.z), delta.w);\n\n // Local contrast adaptation in action:\n edges.xy *= step(0.5 * maxDelta, delta.xy);\n\n return vec4(edges, 0.0, 0.0);\n}\n\nvoid main() {\n gl_FragColor = SMAAColorEdgeDetectionPS(vUv, vOffset, tColor);\n}\n"),Mut={...ca,tEdges:xn("texture","rgba","ubyte","linear"),tArea:xn("texture","rgb","ubyte","linear"),tSearch:xn("texture","rgba","ubyte","nearest"),uTexSizeInv:Ne("v2"),uViewport:Ne("v4"),dMaxSearchSteps:cn("number")},Rut=Wi("smaa-weights","\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nuniform vec2 uTexSizeInv;\nuniform vec4 uViewport;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\nvarying vec2 vPixCoord;\n\nvoid SMAABlendingWeightCalculationVS(vec2 texCoord) {\n vPixCoord = texCoord / uTexSizeInv;\n\n // We will use these offsets for the searches later on (see @PSEUDO_GATHER4):\n vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-0.25, 0.125, 1.25, 0.125); // WebGL port note: Changed sign in Y and W components\n vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-0.125, 0.25, -0.125, -1.25); // WebGL port note: Changed sign in Y and W components\n\n // And these for the searches, they indicate the ends of the loops:\n vOffset[2] = vec4(vOffset[0].xz, vOffset[1].yw) + vec4(-2.0, 2.0, -2.0, 2.0) * uTexSizeInv.xxyy * float(dMaxSearchSteps);\n}\n\nvoid main() {\n vec2 scale = uViewport.zw * uTexSizeInv;\n vec2 shift = uViewport.xy * uTexSizeInv;\n vUv = (aPosition + 1.0) * 0.5 * scale + shift;\n SMAABlendingWeightCalculationVS(vUv);\n vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n gl_Position = vec4(position, 0.0, 1.0);\n}\n","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#define SMAASampleLevelZeroOffset(tex, coord, offset) texture2D(tex, coord + float(offset) * uTexSizeInv, 0.0)\n\n#define SMAA_AREATEX_MAX_DISTANCE 16\n#define SMAA_AREATEX_PIXEL_SIZE (1.0 / vec2(160.0, 560.0))\n#define SMAA_AREATEX_SUBTEX_SIZE (1.0 / 7.0)\n\nuniform sampler2D tEdges;\nuniform sampler2D tArea;\nuniform sampler2D tSearch;\nuniform vec2 uTexSizeInv;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\nvarying vec2 vPixCoord;\n\n#if __VERSION__ == 100\n vec2 round(vec2 x) {\n return sign(x) * floor(abs(x) + 0.5);\n }\n#endif\n\nfloat SMAASearchLength(sampler2D searchTex, vec2 e, float bias, float scale) {\n // Not required if searchTex accesses are set to point:\n // float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0);\n // e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE +\n // e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;\n e.r = bias + e.r * scale;\n return 255.0 * texture2D(searchTex, e, 0.0).r;\n}\n\nfloat SMAASearchXLeft(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n /**\n * @PSEUDO_GATHER4\n * This texCoord has been offset by (-0.25, -0.125) in the vertex shader to\n * sample between edge, thus fetching four edges in a row.\n * Sampling with different offsets in each direction allows to disambiguate\n * which edges are active from the four fetched ones.\n */\n vec2 e = vec2(0.0, 1.0);\n\n for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n e = texture2D( edgesTex, texCoord, 0.0).rg;\n texCoord -= vec2(2.0, 0.0) * uTexSizeInv;\n if (!(texCoord.x > end && e.g > 0.8281 && e.r == 0.0)) break;\n }\n\n // We correct the previous (-0.25, -0.125) offset we applied:\n texCoord.x += 0.25 * uTexSizeInv.x;\n\n // The searches are bias by 1, so adjust the coords accordingly:\n texCoord.x += uTexSizeInv.x;\n\n // Disambiguate the length added by the last step:\n texCoord.x += 2.0 * uTexSizeInv.x; // Undo last step\n texCoord.x -= uTexSizeInv.x * SMAASearchLength(searchTex, e, 0.0, 0.5);\n\n return texCoord.x;\n}\n\nfloat SMAASearchXRight(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n vec2 e = vec2( 0.0, 1.0 );\n\n for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n e = texture2D(edgesTex, texCoord, 0.0).rg;\n texCoord += vec2(2.0, 0.0) * uTexSizeInv;\n if (!(texCoord.x < end && e.g > 0.8281 && e.r == 0.0)) break;\n }\n\n texCoord.x -= 0.25 * uTexSizeInv.x;\n texCoord.x -= uTexSizeInv.x;\n texCoord.x -= 2.0 * uTexSizeInv.x;\n texCoord.x += uTexSizeInv.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );\n\n return texCoord.x;\n}\n\nfloat SMAASearchYUp(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n vec2 e = vec2( 1.0, 0.0 );\n\n for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n e = texture2D(edgesTex, texCoord, 0.0).rg;\n texCoord += vec2(0.0, 2.0) * uTexSizeInv; // WebGL port note: Changed sign\n if (!(texCoord.y > end && e.r > 0.8281 && e.g == 0.0)) break;\n }\n\n texCoord.y -= 0.25 * uTexSizeInv.y; // WebGL port note: Changed sign\n texCoord.y -= uTexSizeInv.y; // WebGL port note: Changed sign\n texCoord.y -= 2.0 * uTexSizeInv.y; // WebGL port note: Changed sign\n texCoord.y += uTexSizeInv.y * SMAASearchLength(searchTex, e.gr, 0.0, 0.5); // WebGL port note: Changed sign\n\n return texCoord.y;\n}\n\nfloat SMAASearchYDown(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n vec2 e = vec2( 1.0, 0.0 );\n\n for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n e = texture2D(edgesTex, texCoord, 0.0).rg;\n texCoord -= vec2( 0.0, 2.0 ) * uTexSizeInv; // WebGL port note: Changed sign\n if (!(texCoord.y < end && e.r > 0.8281 && e.g == 0.0)) break;\n }\n\n texCoord.y += 0.25 * uTexSizeInv.y; // WebGL port note: Changed sign\n texCoord.y += uTexSizeInv.y; // WebGL port note: Changed sign\n texCoord.y += 2.0 * uTexSizeInv.y; // WebGL port note: Changed sign\n texCoord.y -= uTexSizeInv.y * SMAASearchLength(searchTex, e.gr, 0.5, 0.5); // WebGL port note: Changed sign\n\n return texCoord.y;\n}\n\nvec2 SMAAArea(sampler2D areaTex, vec2 dist, float e1, float e2, float offset) {\n // Rounding prevents precision errors of bilinear filtering:\n vec2 texCoord = float(SMAA_AREATEX_MAX_DISTANCE) * round(4.0 * vec2(e1, e2)) + dist;\n\n // We do a scale and bias for mapping to texel space:\n texCoord = SMAA_AREATEX_PIXEL_SIZE * texCoord + (0.5 * SMAA_AREATEX_PIXEL_SIZE);\n\n // Move to proper place, according to the subpixel offset:\n texCoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;\n\n return texture2D(areaTex, texCoord, 0.0).rg;\n}\n\nvec4 SMAABlendingWeightCalculationPS(vec2 texCoord, vec2 pixCoord, vec4 offset[3], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices) {\n vec4 weights = vec4(0.0, 0.0, 0.0, 0.0);\n\n vec2 e = texture2D(edgesTex, texCoord).rg;\n\n if (e.g > 0.0) { // Edge at north\n vec2 d;\n\n // Find the distance to the left:\n vec2 coords;\n coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x );\n coords.y = offset[1].y; // offset[1].y = texCoord.y - 0.25 * uTexSizeInv.y (@CROSSING_OFFSET)\n d.x = coords.x;\n\n // Now fetch the left crossing edges, two at a time using bilinear\n // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to\n // discern what value each edge has:\n float e1 = texture2D(edgesTex, coords, 0.0).r;\n\n // Find the distance to the right:\n coords.x = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y);\n d.y = coords.x;\n\n // We want the distances to be in pixel units (doing this here allow to\n // better interleave arithmetic and memory accesses):\n d = d / uTexSizeInv.x - pixCoord.x;\n\n // SMAAArea below needs a sqrt, as the areas texture is compressed\n // quadratically:\n vec2 sqrt_d = sqrt(abs(d));\n\n // Fetch the right crossing edges:\n coords.y -= 1.0 * uTexSizeInv.y; // WebGL port note: Added\n float e2 = SMAASampleLevelZeroOffset(edgesTex, coords, ivec2(1, 0)).r;\n\n // Ok, we know how this pattern looks like, now it is time for getting\n // the actual area:\n weights.rg = SMAAArea(areaTex, sqrt_d, e1, e2, float(subsampleIndices.y));\n }\n\n if (e.r > 0.0) { // Edge at west\n vec2 d;\n\n // Find the distance to the top:\n vec2 coords;\n\n coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z );\n coords.x = offset[0].x; // offset[1].x = texCoord.x - 0.25 * uTexSizeInv.x;\n d.x = coords.y;\n\n // Fetch the top crossing edges:\n float e1 = texture2D(edgesTex, coords, 0.0).g;\n\n // Find the distance to the bottom:\n coords.y = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w);\n d.y = coords.y;\n\n // We want the distances to be in pixel units:\n d = d / uTexSizeInv.y - pixCoord.y;\n\n // SMAAArea below needs a sqrt, as the areas texture is compressed\n // quadratically:\n vec2 sqrt_d = sqrt(abs(d));\n\n // Fetch the bottom crossing edges:\n coords.y -= 1.0 * uTexSizeInv.y; // WebGL port note: Added\n float e2 = SMAASampleLevelZeroOffset(edgesTex, coords, ivec2(0, 1)).g;\n\n // Get the area for this direction:\n weights.ba = SMAAArea(areaTex, sqrt_d, e1, e2, float(subsampleIndices.x));\n }\n\n return weights;\n}\n\nvoid main() {\n gl_FragColor = SMAABlendingWeightCalculationPS(vUv, vPixCoord, vOffset, tEdges, tArea, tSearch, ivec4(0.0));\n}\n"),Fut={...ca,tColor:xn("texture","rgba","ubyte","linear"),tWeights:xn("texture","rgba","ubyte","linear"),uTexSizeInv:Ne("v2"),uViewport:Ne("v4")},Out=Wi("smaa-blend","\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nuniform vec2 uTexSizeInv;\nuniform vec4 uViewport;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[2];\n\nvoid SMAANeighborhoodBlendingVS(vec2 texCoord) {\n vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-1.0, 0.0, 0.0, 1.0); // WebGL port note: Changed sign in W component\n vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(1.0, 0.0, 0.0, -1.0); // WebGL port note: Changed sign in W component\n}\n\nvoid main() {\n vec2 scale = uViewport.zw * uTexSizeInv;\n vec2 shift = uViewport.xy * uTexSizeInv;\n vUv = (aPosition + 1.0) * 0.5 * scale + shift;\n SMAANeighborhoodBlendingVS(vUv);\n vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n gl_Position = vec4(position, 0.0, 1.0);\n}\n","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tWeights;\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[2];\n\nvec4 SMAANeighborhoodBlendingPS(vec2 texCoord, vec4 offset[2], sampler2D colorTex, sampler2D blendTex) {\n // Fetch the blending weights for current pixel:\n vec4 a;\n a.xz = texture2D(blendTex, texCoord).xz;\n a.y = texture2D(blendTex, offset[1].zw).g;\n a.w = texture2D(blendTex, offset[1].xy).a;\n\n // Is there any blending weight with a value greater than 0.0?\n if (dot(a, vec4(1.0, 1.0, 1.0, 1.0)) < 1e-5) {\n return texture2D(colorTex, texCoord, 0.0);\n } else {\n // Up to 4 lines can be crossing a pixel (one through each edge). We\n // favor blending by choosing the line with the maximum weight for each\n // direction:\n vec2 offset;\n offset.x = a.a > a.b ? a.a : -a.b; // left vs. right\n offset.y = a.g > a.r ? -a.g : a.r; // top vs. bottom // WebGL port note: Changed signs\n\n // Then we go in the direction that has the maximum weight:\n if (abs(offset.x) > abs(offset.y)) { // horizontal vs. vertical\n offset.y = 0.0;\n } else {\n offset.x = 0.0;\n }\n\n // Fetch the opposite color and lerp by hand:\n vec4 C = texture2D(colorTex, texCoord, 0.0);\n texCoord += sign(offset) * uTexSizeInv;\n vec4 Cop = texture2D(colorTex, texCoord, 0.0);\n float s = abs(offset.x) > abs(offset.y) ? abs(offset.x) : abs(offset.y);\n\n // WebGL port note: Added gamma correction\n C.xyz = pow(C.xyz, vec3(2.2));\n Cop.xyz = pow(Cop.xyz, vec3(2.2));\n vec4 mixed = mix(C, Cop, s);\n mixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));\n\n return mixed;\n }\n}\n\nvoid main() {\n gl_FragColor = SMAANeighborhoodBlendingPS(vUv, vOffset, tColor, tWeights);\n}\n"),c0e={opacity:I.Numeric(1,{min:0,max:1,step:.01}),saturation:I.Numeric(0,{min:-1,max:1,step:.01}),lightness:I.Numeric(0,{min:-1,max:1,step:.01})},Vut={faces:I.MappedStatic("urls",{urls:I.Group({nx:I.Text("",{label:"Negative X / Left"}),ny:I.Text("",{label:"Negative Y / Bottom"}),nz:I.Text("",{label:"Negative Z / Back"}),px:I.Text("",{label:"Positive X / Right"}),py:I.Text("",{label:"Positive Y / Top"}),pz:I.Text("",{label:"Positive Z / Front"})},{isExpanded:!0,label:"URLs"}),files:I.Group({nx:I.File({label:"Negative X / Left",accept:"image/*"}),ny:I.File({label:"Negative Y / Bottom",accept:"image/*"}),nz:I.File({label:"Negative Z / Back",accept:"image/*"}),px:I.File({label:"Positive X / Right",accept:"image/*"}),py:I.File({label:"Positive Y / Top",accept:"image/*"}),pz:I.File({label:"Positive Z / Front",accept:"image/*"})},{isExpanded:!0,label:"Files"})}),blur:I.Numeric(0,{min:0,max:1,step:.01},{description:'Note, this only works in WebGL2 or when "EXT_shader_texture_lod" is available.'}),...c0e},Hut={source:I.MappedStatic("url",{url:I.Text(""),file:I.File({accept:"image/*"})}),blur:I.Numeric(0,{min:0,max:1,step:.01},{description:'Note, this only works in WebGL2 or with power-of-two images and when "EXT_shader_texture_lod" is available.'}),...c0e,coverage:I.Select("viewport",I.arrayToOptions(["viewport","canvas"]))},Gut={topColor:I.Color(st(14540253)),bottomColor:I.Color(st(15658734)),ratio:I.Numeric(.5,{min:0,max:1,step:.01}),coverage:I.Select("viewport",I.arrayToOptions(["viewport","canvas"]))},qut={centerColor:I.Color(st(14540253)),edgeColor:I.Color(st(15658734)),ratio:I.Numeric(.5,{min:0,max:1,step:.01}),coverage:I.Select("viewport",I.arrayToOptions(["viewport","canvas"]))},Wut={variant:I.MappedStatic("off",{off:I.EmptyGroup(),skybox:I.Group(Vut,{isExpanded:!0}),image:I.Group(Hut,{isExpanded:!0}),horizontalGradient:I.Group(Gut,{isExpanded:!0}),radialGradient:I.Group(qut,{isExpanded:!0})},{label:"Environment"})};class $ut{constructor(t,n,r,i){this.webgl=t,this.assetManager=n,this.camera=new Si,this.target=C(),this.position=C(),this.dir=C(),this.renderable=function ndt(e,t,n){const r={drawCount:O.create(6),instanceCount:O.create(1),aPosition:O.create(nH),tSkybox:O.create(lc()),tImage:O.create(lc()),uImageScale:O.create(Ue()),uImageOffset:O.create(Ue()),uTexSize:O.create(Ue.create(t,n)),uViewport:O.create(Bn()),uViewportAdjusted:O.create(!0),uViewDirectionProjectionInverse:O.create(fe()),uGradientColorA:O.create(C()),uGradientColorB:O.create(C()),uGradientRatio:O.create(.5),uBlur:O.create(0),uOpacity:O.create(1),uSaturation:O.create(0),uLightness:O.create(0),dVariant:O.create("skybox")},i={...edt};return ys(ms(e,"triangles",tdt,i,r),r)}(t,r,i)}setSize(t,n){const[r,i]=this.renderable.values.uTexSize.ref.value;(t!==r||n!==i)&&O.update(this.renderable.values.uTexSize,Ue.set(this.renderable.values.uTexSize.ref.value,t,n))}clearSkybox(){void 0!==this.skybox&&(this.skybox.texture.destroy(),this.skybox.assets.forEach(t=>this.assetManager.release(t)),this.skybox=void 0)}updateSkybox(t,n,r){var i;const o=null===(i=this.skybox)||void 0===i?void 0:i.props.faces,s=n.faces.params;if(!(s.nx&&s.ny&&s.nz&&s.px&&s.py&&s.pz))return this.clearSkybox(),void r?.(!1);if(this.skybox&&o&&function Kut(e,t){return d0e(e)===d0e(t)}(n.faces,this.skybox.props.faces))r?.(!1);else{this.clearSkybox();const{texture:c,assets:u}=function Zut(e,t,n,r){const i=function Yut(e,t){return"urls"===t.name?{nx:jr.getUrlAsset(e,t.params.nx),ny:jr.getUrlAsset(e,t.params.ny),nz:jr.getUrlAsset(e,t.params.nz),px:jr.getUrlAsset(e,t.params.px),py:jr.getUrlAsset(e,t.params.py),pz:jr.getUrlAsset(e,t.params.pz)}:{nx:t.params.nx,ny:t.params.ny,nz:t.params.nz,px:t.params.px,py:t.params.py,pz:t.params.pz}}(t,n),o=function Xut(e,t){const n=r=>e.resolve(r,"binary").run().then(i=>new Blob([i.data]));return{nx:n(t.nx),ny:n(t.ny),nz:n(t.nz),px:n(t.px),py:n(t.py),pz:n(t.pz)}}(t,i),s=[i.nx,i.ny,i.nz,i.px,i.py,i.pz];return typeof HTMLImageElement>"u"?(console.error('Missing "HTMLImageElement" required for background skybox'),r?.(!0),{texture:lc(),assets:s}):{texture:e.resources.cubeTexture(o,!0,r),assets:s}}(this.webgl,this.assetManager,n.faces,d=>{this.skybox&&(this.skybox.loaded=!d),r?.(!0)});this.skybox={texture:c,props:{...n},assets:u,loaded:!1},O.update(this.renderable.values.tSkybox,c),this.renderable.update()}if(!this.skybox)return;let a=t;"orthographic"===t.state.mode&&(this.camera.setState({...t.state,mode:"perspective"}),this.camera.update(),a=this.camera);const l=this.renderable.values.uViewDirectionProjectionInverse.ref.value;C.sub(this.dir,a.state.position,a.state.target),C.setMagnitude(this.dir,this.dir,.1),C.copy(this.position,this.dir),fe.lookAt(l,this.position,this.target,a.state.up),fe.mul(l,a.projection,l),fe.invert(l,l),O.update(this.renderable.values.uViewDirectionProjectionInverse,l),O.updateIfChanged(this.renderable.values.uBlur,n.blur),O.updateIfChanged(this.renderable.values.uOpacity,n.opacity),O.updateIfChanged(this.renderable.values.uSaturation,n.saturation),O.updateIfChanged(this.renderable.values.uLightness,n.lightness),O.updateIfChanged(this.renderable.values.dVariant,"skybox"),this.renderable.update()}clearImage(){void 0!==this.image&&(this.image.texture.destroy(),this.assetManager.release(this.image.asset),this.image=void 0)}updateImage(t,n){if(!t.source.params)return this.clearImage(),void n?.(!1);if(this.image&&this.image.props.source.params&&function Qut(e,t){return p0e(e)===p0e(t)}(t.source,this.image.props.source))n?.(!1);else{this.clearImage();const{texture:r,asset:i}=function Jut(e,t,n,r){const i="url"===n.name?jr.getUrlAsset(t,n.params):n.params;if(typeof HTMLImageElement>"u")return console.error('Missing "HTMLImageElement" required for background image'),r?.(!0),{texture:lc(),asset:i};const o=e.resources.texture("image-uint8","rgba","ubyte","linear"),s=new Image;return s.onload=()=>{o.load(s),(e.isWebGL2||d3(s.width)&&d3(s.height))&&o.mipmap(),r?.()},s.onerror=()=>{r?.(!0)},t.resolve(i,"binary").run().then(a=>{const l=new Blob([a.data]);s.src=URL.createObjectURL(l)}),{texture:o,asset:i}}(this.webgl,this.assetManager,t.source,o=>{this.image&&(this.image.loaded=!o),n?.(!0)});this.image={texture:r,props:{...t},asset:i,loaded:!1},O.update(this.renderable.values.tImage,r),this.renderable.update()}this.image&&(O.updateIfChanged(this.renderable.values.uBlur,t.blur),O.updateIfChanged(this.renderable.values.uOpacity,t.opacity),O.updateIfChanged(this.renderable.values.uSaturation,t.saturation),O.updateIfChanged(this.renderable.values.uLightness,t.lightness),O.updateIfChanged(this.renderable.values.uViewportAdjusted,"viewport"===t.coverage),O.updateIfChanged(this.renderable.values.dVariant,"image"),this.renderable.update())}updateImageScaling(){var t,n;const r=this.renderable.values,[i,o]=r.uTexSize.ref.value,s=(null===(t=this.image)||void 0===t?void 0:t.texture.getWidth())||0,a=(null===(n=this.image)||void 0===n?void 0:n.texture.getHeight())||0,l=i/o;O.update(r.uImageScale,ll?Ue.set(r.uImageOffset.ref.value,(1-l/f)/2,0):Ue.set(r.uImageOffset.ref.value,0,(1-f/l)/2))}updateGradient(t,n,r,i,o){O.update(this.renderable.values.uGradientColorA,st.toVec3Normalized(this.renderable.values.uGradientColorA.ref.value,t)),O.update(this.renderable.values.uGradientColorB,st.toVec3Normalized(this.renderable.values.uGradientColorB.ref.value,n)),O.updateIfChanged(this.renderable.values.uGradientRatio,r),O.updateIfChanged(this.renderable.values.uViewportAdjusted,o),O.updateIfChanged(this.renderable.values.dVariant,i),this.renderable.update()}update(t,n,r){if("off"===n.variant.name)return this.clearSkybox(),this.clearImage(),void r?.(!1);"skybox"===n.variant.name?(this.clearImage(),this.updateSkybox(t,n.variant.params,r)):"image"===n.variant.name?(this.clearSkybox(),this.updateImage(n.variant.params,r)):"horizontalGradient"===n.variant.name?(this.clearSkybox(),this.clearImage(),this.updateGradient(n.variant.params.topColor,n.variant.params.bottomColor,n.variant.params.ratio,n.variant.name,"viewport"===n.variant.params.coverage),r?.(!1)):"radialGradient"===n.variant.name&&(this.clearSkybox(),this.clearImage(),this.updateGradient(n.variant.params.centerColor,n.variant.params.edgeColor,n.variant.params.ratio,n.variant.name,"viewport"===n.variant.params.coverage),r?.(!1));const{x:i,y:o,width:s,height:a}=t.viewport;O.update(this.renderable.values.uViewport,Bn.set(this.renderable.values.uViewport.ref.value,i,o,s,a))}isEnabled(t){return!!(this.skybox&&this.skybox.loaded||this.image&&this.image.loaded||"horizontalGradient"===t.variant.name||"radialGradient"===t.variant.name)}isReady(){return!!(this.skybox&&this.skybox.loaded||this.image&&this.image.loaded||"horizontalGradient"===this.renderable.values.dVariant.ref.value||"radialGradient"===this.renderable.values.dVariant.ref.value)}render(){this.isReady()&&("image"===this.renderable.values.dVariant.ref.value&&this.updateImageScaling(),It&&this.webgl.timer.mark("BackgroundPass.render"),this.renderable.render(),It&&this.webgl.timer.markEnd("BackgroundPass.render"))}dispose(){this.clearSkybox(),this.clearImage()}}const u0e="background-skybox";function d0e(e){var t,n,r,i,o,s;return"urls"===e.name?`${u0e}_${e.params.nx}|${e.params.ny}|${e.params.nz}|${e.params.px}|${e.params.py}|${e.params.pz}`:`${u0e}_${null===(t=e.params.nx)||void 0===t?void 0:t.id}|${null===(n=e.params.ny)||void 0===n?void 0:n.id}|${null===(r=e.params.nz)||void 0===r?void 0:r.id}|${null===(i=e.params.px)||void 0===i?void 0:i.id}|${null===(o=e.params.py)||void 0===o?void 0:o.id}|${null===(s=e.params.pz)||void 0===s?void 0:s.id}`}const f0e="background-image";function p0e(e){var t;return"url"===e.name?`${f0e}_${e.params}`:`${f0e}_${null===(t=e.params)||void 0===t?void 0:t.id}`}const edt={drawCount:_o("number"),instanceCount:_o("number"),aPosition:Pi("float32",2,0),tSkybox:xn("texture","rgba","ubyte","linear"),tImage:xn("texture","rgba","ubyte","linear"),uImageScale:Ne("v2"),uImageOffset:Ne("v2"),uTexSize:Ne("v2"),uViewport:Ne("v4"),uViewportAdjusted:Ne("b"),uViewDirectionProjectionInverse:Ne("m4"),uGradientColorA:Ne("v3"),uGradientColorB:Ne("v3"),uGradientRatio:Ne("f"),uBlur:Ne("f"),uOpacity:Ne("f"),uSaturation:Ne("f"),uLightness:Ne("f"),dVariant:cn("string",["skybox","image","verticalGradient","horizontalGradient","radialGradient"])},tdt=Wi("background","\nprecision mediump float;\n\nattribute vec2 aPosition;\n\nvarying vec4 vPosition;\n\nvoid main() {\n vPosition = vec4(aPosition, 1.0, 1.0);\n gl_Position = vec4(aPosition, 1.0, 1.0);\n}\n","\nprecision mediump float;\nprecision mediump samplerCube;\nprecision mediump sampler2D;\n\n#if defined(dVariant_skybox)\n uniform samplerCube tSkybox;\n uniform mat4 uViewDirectionProjectionInverse;\n uniform float uBlur;\n uniform float uOpacity;\n uniform float uSaturation;\n uniform float uLightness;\n#elif defined(dVariant_image)\n uniform sampler2D tImage;\n uniform vec2 uImageScale;\n uniform vec2 uImageOffset;\n uniform float uBlur;\n uniform float uOpacity;\n uniform float uSaturation;\n uniform float uLightness;\n#elif defined(dVariant_horizontalGradient) || defined(dVariant_radialGradient)\n uniform vec3 uGradientColorA;\n uniform vec3 uGradientColorB;\n uniform float uGradientRatio;\n#endif\n\nuniform vec2 uTexSize;\nuniform vec4 uViewport;\nuniform bool uViewportAdjusted;\nvarying vec4 vPosition;\n\n// TODO: add as general pp option to remove banding?\n// Iestyn's RGB dither from http://alex.vlachos.com/graphics/Alex_Vlachos_Advanced_VR_Rendering_GDC2015.pdf\nvec3 ScreenSpaceDither(vec2 vScreenPos) {\n vec3 vDither = vec3(dot(vec2(171.0, 231.0), vScreenPos.xy));\n vDither.rgb = fract(vDither.rgb / vec3(103.0, 71.0, 97.0));\n return vDither.rgb / 255.0;\n}\n\nvec3 saturateColor(vec3 c, float amount) {\n // https://www.w3.org/TR/WCAG21/#dfn-relative-luminance\n const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n vec3 intensity = vec3(dot(c, W));\n return mix(intensity, c, 1.0 + amount);\n}\n\nvec3 lightenColor(vec3 c, float amount) {\n return c + amount;\n}\n\nvoid main() {\n #if defined(dVariant_skybox)\n vec4 t = uViewDirectionProjectionInverse * vPosition;\n #ifdef enabledShaderTextureLod\n gl_FragColor = textureCubeLodEXT(tSkybox, normalize(t.xyz / t.w), uBlur * 8.0);\n #else\n gl_FragColor = textureCube(tSkybox, normalize(t.xyz / t.w));\n #endif\n gl_FragColor.a = uOpacity;\n gl_FragColor.rgb = lightenColor(saturateColor(gl_FragColor.rgb, uSaturation), uLightness);\n #elif defined(dVariant_image)\n vec2 coords;\n if (uViewportAdjusted) {\n coords = ((gl_FragCoord.xy - uViewport.xy) * (uTexSize / uViewport.zw) / uImageScale) + uImageOffset;\n } else {\n coords = (gl_FragCoord.xy / uImageScale) + uImageOffset;\n }\n #ifdef enabledShaderTextureLod\n gl_FragColor = texture2DLodEXT(tImage, vec2(coords.x, 1.0 - coords.y), uBlur * 8.0);\n #else\n gl_FragColor = texture2D(tImage, vec2(coords.x, 1.0 - coords.y));\n #endif\n gl_FragColor.a = uOpacity;\n gl_FragColor.rgb = lightenColor(saturateColor(gl_FragColor.rgb, uSaturation), uLightness);\n #elif defined(dVariant_horizontalGradient)\n float d;\n if (uViewportAdjusted) {\n d = ((gl_FragCoord.y - uViewport.y) * (uTexSize.y / uViewport.w) / uTexSize.y) + 1.0 - (uGradientRatio * 2.0);\n } else {\n d = (gl_FragCoord.y / uTexSize.y) + 1.0 - (uGradientRatio * 2.0);\n }\n gl_FragColor = vec4(mix(uGradientColorB, uGradientColorA, clamp(d, 0.0, 1.0)), 1.0);\n gl_FragColor.rgb += ScreenSpaceDither(gl_FragCoord.xy);\n #elif defined(dVariant_radialGradient)\n float d;\n if (uViewportAdjusted) {\n d = distance(vec2(0.5), (gl_FragCoord.xy - uViewport.xy) * (uTexSize / uViewport.zw) / uTexSize) + uGradientRatio - 0.5;\n } else {\n d = distance(vec2(0.5), gl_FragCoord.xy / uTexSize) + uGradientRatio - 0.5;\n }\n gl_FragColor = vec4(mix(uGradientColorB, uGradientColorA, 1.0 - clamp(d, 0.0, 1.0)), 1.0);\n gl_FragColor.rgb += ScreenSpaceDither(gl_FragCoord.xy);\n #endif\n}\n",{shaderTextureLod:"optional"}),odt={sharpness:I.Numeric(.5,{min:0,max:1,step:.05}),denoise:I.Boolean(!0)};class sdt{constructor(t,n){this.webgl=t,this.renderable=function cdt(e,t){const n=t.getWidth(),r=t.getHeight(),i={...ua,tColor:O.create(t),uTexSizeInv:O.create(Ue.create(1/n,1/r)),uSharpness:O.create(.5),dDenoise:O.create(!0)},o={...adt};return ys(ms(e,"triangles",ldt,o,i),i)}(t,n)}updateState(t){const{gl:n,state:r}=this.webgl;r.enable(n.SCISSOR_TEST),r.disable(n.BLEND),r.disable(n.DEPTH_TEST),r.depthMask(!1);const{x:i,y:o,width:s,height:a}=t;r.viewport(i,o,s,a),r.scissor(i,o,s,a),r.clearColor(0,0,0,1),n.clear(n.COLOR_BUFFER_BIT)}setSize(t,n){O.update(this.renderable.values.uTexSizeInv,Ue.set(this.renderable.values.uTexSizeInv.ref.value,1/t,1/n))}update(t,n){const{values:r}=this.renderable,{sharpness:i,denoise:o}=n;let s=!1;r.tColor.ref.value!==t&&(O.update(this.renderable.values.tColor,t),s=!0),O.updateIfChanged(r.uSharpness,2-2*Math.pow(i,.25)),r.dDenoise.ref.value!==o&&(s=!0),O.updateIfChanged(r.dDenoise,o),s&&this.renderable.update()}render(t,n){It&&this.webgl.timer.mark("CasPass.render"),n?n.bind():this.webgl.unbindFramebuffer(),this.updateState(t),this.renderable.render(),It&&this.webgl.timer.markEnd("CasPass.render")}}const adt={...ca,tColor:xn("texture","rgba","ubyte","linear"),uTexSizeInv:Ne("v2"),uSharpness:Ne("f"),dDenoise:cn("boolean")},ldt=Wi("cas",hl,"\nprecision mediump float;\nprecision mediump sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\nuniform float uSharpness;\n\n// adapted from https://www.shadertoy.com/view/stXSWB\n\n/*\n* FidelityFX Super Resolution scales up a low resolution\n* image, while adding fine detail.\n*\n* MIT Open License\n*\n* https://gpuopen.com/fsr\n*\n* Left: FSR processed\n* Right: Original texture, bilinear interpolation\n*\n* Mouse at top: Sharpness 0 stops (maximum)\n* Mouse at bottom: Sharpness 2 stops (minimum)\n*\n* It works in two passes-\n* EASU upsamples the image with a clamped Lanczos kernel.\n* RCAS sharpens the image at the target resolution.\n*\n* I needed to make a few changes to improve readability and\n* WebGL compatibility in an algorithm I don't fully understand.\n* Expect bugs.\n*\n* Shader not currently running for WebGL1 targets (eg. mobile Safari)\n*\n* There is kind of no point to using FSR in Shadertoy, as it renders buffers\n* at full target resolution. But this might be useful for WebGL based demos\n* running smaller-than-target render buffers.\n*\n* For sharpening with a full resolution render buffer,\n* FidelityFX CAS is a better option.\n* https://www.shadertoy.com/view/ftsXzM\n*\n* For readability and compatibility, these optimisations have been removed:\n* * Fast approximate inverse and inversesqrt\n* * textureGather fetches (not WebGL compatible)\n* * Multiplying by reciprocal instead of division\n*\n* Apologies to AMD for the numerous slowdowns and errors I have introduced.\n*\n*/\n\n/***** RCAS *****/\n#define FSR_RCAS_LIMIT (0.25-(1.0/16.0))\n\n// Input callback prototypes that need to be implemented by calling shader\nvec4 FsrRcasLoadF(vec2 p);\n//------------------------------------------------------------------------------------------------------------------------------\nvoid FsrRcasCon(\n out float con,\n // The scale is {0.0 := maximum, to N>0, where N is the number of stops (halving) of the reduction of sharpness}.\n float sharpness\n) {\n // Transform from stops to linear value.\n con = exp2(-sharpness);\n}\n\nvec3 FsrRcasF(\n vec2 ip, // Integer pixel position in output.\n float con\n) {\n // Constant generated by RcasSetup().\n // Algorithm uses minimal 3x3 pixel neighborhood.\n // b\n // d e f\n // h\n vec2 sp = vec2(ip);\n vec3 b = FsrRcasLoadF(sp + vec2( 0,-1)).rgb;\n vec3 d = FsrRcasLoadF(sp + vec2(-1, 0)).rgb;\n vec3 e = FsrRcasLoadF(sp).rgb;\n vec3 f = FsrRcasLoadF(sp + vec2( 1, 0)).rgb;\n vec3 h = FsrRcasLoadF(sp + vec2( 0, 1)).rgb;\n\n // Luma times 2.\n float bL = b.g + .5 * (b.b + b.r);\n float dL = d.g + .5 * (d.b + d.r);\n float eL = e.g + .5 * (e.b + e.r);\n float fL = f.g + .5 * (f.b + f.r);\n float hL = h.g + .5 * (h.b + h.r);\n\n // Noise detection.\n #ifdef dDenoise\n float nz = .25 * (bL + dL + fL + hL) - eL;\n nz=clamp(\n abs(nz)\n /(\n max(max(bL,dL),max(eL,max(fL,hL)))\n -min(min(bL,dL),min(eL,min(fL,hL)))\n ),\n 0., 1.\n );\n nz=1.-.5*nz;\n #endif\n\n // Min and max of ring.\n vec3 mn4 = min(b, min(f, h));\n vec3 mx4 = max(b, max(f, h));\n\n // Immediate constants for peak range.\n vec2 peakC = vec2(1., -4.);\n\n // Limiters, these need to be high precision RCPs.\n vec3 hitMin = mn4 / (4. * mx4);\n vec3 hitMax = (peakC.x - mx4) / (4.* mn4 + peakC.y);\n vec3 lobeRGB = max(-hitMin, hitMax);\n float lobe = max(\n -FSR_RCAS_LIMIT,\n min(max(lobeRGB.r, max(lobeRGB.g, lobeRGB.b)), 0.)\n )*con;\n\n // Apply noise removal.\n #ifdef dDenoise\n lobe *= nz;\n #endif\n\n // Resolve, which needs the medium precision rcp approximation to avoid visible tonality changes.\n return (lobe * (b + d + h + f) + e) / (4. * lobe + 1.);\n}\n\n\nvec4 FsrRcasLoadF(vec2 p) {\n return texture2D(tColor, p * uTexSizeInv);\n}\n\nvoid main() {\n // Set up constants\n float con;\n FsrRcasCon(con, uSharpness);\n\n // Perform RCAS pass\n vec3 col = FsrRcasF(gl_FragCoord.xy, con);\n\n gl_FragColor = vec4(col, FsrRcasLoadF(gl_FragCoord.xy).a);\n}\n"),udt={...ca,tDepthOpaque:xn("texture","rgba","ubyte","nearest"),tDepthTransparent:xn("texture","rgba","ubyte","nearest"),uTexSize:Ne("v2"),dOrthographic:cn("number"),uNear:Ne("f"),uFar:Ne("f"),uInvProjection:Ne("m4"),uOutlineThreshold:Ne("f"),dTransparentOutline:cn("boolean")},fdt={...ca,tDepth:xn("texture","rgba","ubyte","nearest"),uTexSize:Ne("v2"),uProjection:Ne("m4"),uInvProjection:Ne("m4"),uBounds:Ne("v4"),dOrthographic:cn("number"),uNear:Ne("f"),uFar:Ne("f"),dSteps:cn("number"),uMaxDistance:Ne("f"),uTolerance:Ne("f"),uBias:Ne("f"),uLightDirection:Ne("v3[]"),uLightColor:Ne("v3[]"),dLightCount:cn("number")},hdt={...ca,tDepth:xn("texture","rgba","ubyte","nearest"),tDepthHalf:xn("texture","rgba","ubyte","nearest"),tDepthQuarter:xn("texture","rgba","ubyte","nearest"),uSamples:Ne("v3[]"),dNSamples:cn("number"),uProjection:Ne("m4"),uInvProjection:Ne("m4"),uBounds:Ne("v4"),uTexSize:Ne("v2"),uRadius:Ne("f"),uBias:Ne("f"),dMultiScale:cn("boolean"),dLevels:cn("number"),uLevelRadius:Ne("f[]"),uLevelBias:Ne("f[]"),uNearThreshold:Ne("f"),uFarThreshold:Ne("f")},gdt={...ca,tSsaoDepth:xn("texture","rgba","ubyte","nearest"),uTexSize:Ne("v2"),uKernel:Ne("f[]"),dOcclusionKernelSize:cn("number"),uBlurDirectionX:Ne("f"),uBlurDirectionY:Ne("f"),uInvProjection:Ne("m4"),uNear:Ne("f"),uFar:Ne("f"),uBounds:Ne("v4"),dOrthographic:cn("number")};function h0e(e,t,n){const r={...ua,tSsaoDepth:O.create(t),uTexSize:O.create(Ue.create(t.getWidth(),t.getHeight())),uKernel:O.create(m0e(15)),dOcclusionKernelSize:O.create(15),uBlurDirectionX:O.create("horizontal"===n?1:0),uBlurDirectionY:O.create("vertical"===n?1:0),uInvProjection:O.create(fe.identity()),uNear:O.create(0),uFar:O.create(1e4),uBounds:O.create(Bn()),dOrthographic:O.create(0)},i={...gdt};return ys(ms(e,"triangles",Wi("ssao_blur",hl,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tSsaoDepth;\nuniform vec2 uTexSize;\nuniform vec4 uBounds;\n\nuniform float uKernel[dOcclusionKernelSize];\n\nuniform float uBlurDirectionX;\nuniform float uBlurDirectionY;\n\nuniform mat4 uInvProjection;\nuniform float uNear;\nuniform float uFar;\n\n#include common\n\nfloat getViewZ(const in float depth) {\n #if dOrthographic == 1\n return orthographicDepthToViewZ(depth, uNear, uFar);\n #else\n return perspectiveDepthToViewZ(depth, uNear, uFar);\n #endif\n}\n\nbool isBackground(const in float depth) {\n return depth == 1.0;\n}\n\nbool outsideBounds(const in vec2 p) {\n return p.x < uBounds.x || p.y < uBounds.y || p.x > uBounds.z || p.y > uBounds.w;\n}\n\nfloat getPixelSize(const in vec2 coords, const in float depth) {\n vec3 viewPos0 = screenSpaceToViewSpace(vec3(coords, depth), uInvProjection);\n vec3 viewPos1 = screenSpaceToViewSpace(vec3(coords + vec2(1.0, 0.0) / uTexSize, depth), uInvProjection);\n return distance(viewPos0, viewPos1);\n}\n\nvoid main(void) {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n\n vec2 packedDepth = texture2D(tSsaoDepth, coords).zw;\n\n if (outsideBounds(coords)) {\n gl_FragColor = vec4(packUnitIntervalToRG(1.0), packedDepth);\n return;\n }\n\n float selfDepth = unpackRGToUnitInterval(packedDepth);\n // if background and if second pass\n if (isBackground(selfDepth) && uBlurDirectionY != 0.0) {\n gl_FragColor = vec4(packUnitIntervalToRG(1.0), packedDepth);\n return;\n }\n\n float selfViewZ = getViewZ(selfDepth);\n float pixelSize = getPixelSize(coords, selfDepth);\n float maxDiffViewZ = pixelSize * 10.0;\n\n vec2 offset = vec2(uBlurDirectionX, uBlurDirectionY) / uTexSize;\n\n float sum = 0.0;\n float kernelSum = 0.0;\n // only if kernelSize is odd\n for (int i = -dOcclusionKernelSize / 2; i <= dOcclusionKernelSize / 2; i++) {\n if (abs(float(i)) > 1.0 && abs(float(i)) * pixelSize > 0.8) continue;\n\n vec2 sampleCoords = coords + float(i) * offset;\n if (outsideBounds(sampleCoords)) {\n continue;\n }\n\n vec4 sampleSsaoDepth = texture2D(tSsaoDepth, sampleCoords);\n\n float sampleDepth = unpackRGToUnitInterval(sampleSsaoDepth.zw);\n if (isBackground(sampleDepth)) {\n continue;\n }\n\n if (abs(float(i)) > 1.0) {\n float sampleViewZ = getViewZ(sampleDepth);\n if (abs(selfViewZ - sampleViewZ) > maxDiffViewZ) {\n continue;\n }\n }\n\n float kernel = uKernel[int(abs(float(i)))]; // abs is not defined for int in webgl1\n float sampleValue = unpackRGToUnitInterval(sampleSsaoDepth.xy);\n\n sum += kernel * sampleValue;\n kernelSum += kernel;\n }\n\n gl_FragColor = vec4(packUnitIntervalToRG(sum / kernelSum), packedDepth);\n}\n"),i,r),r)}function m0e(e){const t=e/3,n=Math.floor((e+1)/2),r=[];for(let i=0;i`${e.radius}, ${e.bias}`,{defaultValue:[{radius:2,bias:1},{radius:5,bias:1},{radius:8,bias:1},{radius:11,bias:1}]}),nearThreshold:I.Numeric(10,{min:0,max:50,step:1}),farThreshold:I.Numeric(1500,{min:0,max:1e4,step:100})}),off:I.Group({})},{cycle:!0}),radius:I.Numeric(5,{min:0,max:20,step:.1},{description:"Final occlusion radius is 2^x",hideIf:e=>"on"===e?.multiScale.name}),bias:I.Numeric(.8,{min:0,max:3,step:.1}),blurKernelSize:I.Numeric(15,{min:1,max:25,step:2}),resolutionScale:I.Numeric(1,{min:.1,max:1,step:.05},{description:"Adjust resolution of occlusion calculation"}),color:I.Color(st(0))}),off:I.Group({})},{cycle:!0,description:"Darken occluded crevices with the ambient occlusion effect"}),shadow:I.MappedStatic("off",{on:I.Group({steps:I.Numeric(1,{min:1,max:64,step:1}),bias:I.Numeric(.6,{min:0,max:1,step:.01}),maxDistance:I.Numeric(3,{min:0,max:256,step:1}),tolerance:I.Numeric(1,{min:0,max:10,step:.1})}),off:I.Group({})},{cycle:!0,description:"Simplistic shadows"}),outline:I.MappedStatic("off",{on:I.Group({scale:I.Numeric(1,{min:1,max:5,step:1}),threshold:I.Numeric(.33,{min:.01,max:1,step:.01}),color:I.Color(st(0)),includeTransparent:I.Boolean(!0,{description:"Whether to show outline for transparent objects"})}),off:I.Group({})},{cycle:!0,description:"Draw outline around 3D objects"}),antialiasing:I.MappedStatic("smaa",{fxaa:I.Group(gut),smaa:I.Group(Eut),off:I.Group({})},{options:[["fxaa","FXAA"],["smaa","SMAA"],["off","Off"]],description:"Smooth pixel edges"}),sharpening:I.MappedStatic("off",{on:I.Group(odt),off:I.Group({})},{cycle:!0,description:"Contrast Adaptive Sharpening"}),background:I.Group(Wut,{isFlat:!0})};class Zu{static isEnabled(t){return"on"===t.occlusion.name||"on"===t.shadow.name||"on"===t.outline.name||"off"!==t.background.variant.name}static isTransparentOutlineEnabled(t){return"on"===t.outline.name&&t.outline.params.includeTransparent}calcSsaoScale(t){return Math.min(1,1/this.webgl.pixelRatio)*t}constructor(t,n,r){this.webgl=t,this.drawPass=r,this.bgColor=C(),this.occlusionOffset=[0,0],this.transparentBackground=!1;const{colorTarget:i,depthTextureTransparent:o,depthTextureOpaque:s}=r,a=i.getWidth(),l=i.getHeight();this.nSamples=1,this.blurKernelSize=1,this.ssaoScale=this.calcSsaoScale(1),this.levels=[],this.target=t.createRenderTarget(a,l,!1,"uint8","linear"),this.outlinesTarget=t.createRenderTarget(a,l,!1),this.outlinesRenderable=function ddt(e,t,n,r){const i=t.getWidth(),o=t.getHeight(),s={...ua,tDepthOpaque:O.create(t),tDepthTransparent:O.create(n),uTexSize:O.create(Ue.create(i,o)),dOrthographic:O.create(0),uNear:O.create(1),uFar:O.create(1e4),uInvProjection:O.create(fe.identity()),uOutlineThreshold:O.create(.33),dTransparentOutline:O.create(r)},a={...udt};return ys(ms(e,"triangles",Wi("outlines",hl,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tDepthOpaque;\nuniform sampler2D tDepthTransparent;\nuniform vec2 uTexSize;\n\nuniform float uNear;\nuniform float uFar;\nuniform mat4 uInvProjection;\n\nuniform float uOutlineThreshold;\n\n#include common\n\nfloat getViewZ(const in float depth) {\n #if dOrthographic == 1\n return orthographicDepthToViewZ(depth, uNear, uFar);\n #else\n return perspectiveDepthToViewZ(depth, uNear, uFar);\n #endif\n}\n\nfloat getDepthOpaque(const in vec2 coords) {\n #ifdef depthTextureSupport\n return texture2D(tDepthOpaque, coords).r;\n #else\n return unpackRGBAToDepth(texture2D(tDepthOpaque, coords));\n #endif\n}\n\nfloat getDepthTransparent(const in vec2 coords) {\n #ifdef dTransparentOutline\n return unpackRGBAToDepth(texture2D(tDepthTransparent, coords));\n #else\n return 1.0;\n #endif\n}\n\nbool isBackground(const in float depth) {\n return depth == 1.0;\n}\n\nfloat getPixelSize(const in vec2 coords, const in float depth) {\n vec3 viewPos0 = screenSpaceToViewSpace(vec3(coords, depth), uInvProjection);\n vec3 viewPos1 = screenSpaceToViewSpace(vec3(coords + vec2(1.0, 0.0) / uTexSize, depth), uInvProjection);\n return distance(viewPos0, viewPos1);\n}\n\nvoid main(void) {\n float backgroundViewZ = 2.0 * uFar;\n\n vec2 coords = gl_FragCoord.xy / uTexSize;\n vec2 invTexSize = 1.0 / uTexSize;\n\n float selfDepthOpaque = getDepthOpaque(coords);\n float selfViewZOpaque = isBackground(selfDepthOpaque) ? backgroundViewZ : getViewZ(selfDepthOpaque);\n float pixelSizeOpaque = getPixelSize(coords, selfDepthOpaque) * uOutlineThreshold;\n\n float selfDepthTransparent = getDepthTransparent(coords);\n float selfViewZTransparent = isBackground(selfDepthTransparent) ? backgroundViewZ : getViewZ(selfDepthTransparent);\n float pixelSizeTransparent = getPixelSize(coords, selfDepthTransparent) * uOutlineThreshold;\n\n float outline = 1.0;\n float bestDepth = 1.0;\n float transparentFlag = 0.0;\n\n for (int y = -1; y <= 1; y++) {\n for (int x = -1; x <= 1; x++) {\n vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;\n\n float sampleDepthOpaque = getDepthOpaque(sampleCoords);\n float sampleDepthTransparent = getDepthTransparent(sampleCoords);\n\n float sampleViewZOpaque = isBackground(sampleDepthOpaque) ? backgroundViewZ : getViewZ(sampleDepthOpaque);\n if (abs(selfViewZOpaque - sampleViewZOpaque) > pixelSizeOpaque && selfDepthOpaque > sampleDepthOpaque && sampleDepthOpaque <= bestDepth) {\n outline = 0.0;\n bestDepth = sampleDepthOpaque;\n }\n\n if (sampleDepthTransparent < sampleDepthOpaque) {\n float sampleViewZTransparent = isBackground(sampleDepthTransparent) ? backgroundViewZ : getViewZ(sampleDepthTransparent);\n if (abs(selfViewZTransparent - sampleViewZTransparent) > pixelSizeTransparent && selfDepthTransparent > sampleDepthTransparent && sampleDepthTransparent <= bestDepth) {\n outline = 0.0;\n bestDepth = sampleDepthTransparent;\n transparentFlag = 1.0;\n }\n }\n }\n }\n\n gl_FragColor = vec4(outline, packUnitIntervalToRG(bestDepth), transparentFlag);\n}\n"),a,s),s)}(t,s,o,!0),this.shadowsTarget=t.createRenderTarget(a,l,!1),this.shadowsRenderable=function pdt(e,t){const n=t.getWidth(),r=t.getHeight(),i={...ua,tDepth:O.create(t),uTexSize:O.create(Ue.create(n,r)),uProjection:O.create(fe.identity()),uInvProjection:O.create(fe.identity()),uBounds:O.create(Bn()),dOrthographic:O.create(0),uNear:O.create(1),uFar:O.create(1e4),dSteps:O.create(1),uMaxDistance:O.create(3),uTolerance:O.create(1),uBias:O.create(.6),uLightDirection:O.create([]),uLightColor:O.create([]),dLightCount:O.create(0)},o={...fdt};return ys(ms(e,"triangles",Wi("shadows",hl,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n\nuniform sampler2D tDepth;\nuniform vec2 uTexSize;\nuniform vec4 uBounds;\n\nuniform float uNear;\nuniform float uFar;\n\n#if dLightCount != 0\n uniform vec3 uLightDirection[dLightCount];\n uniform vec3 uLightColor[dLightCount];\n#endif\n\nuniform mat4 uProjection;\nuniform mat4 uInvProjection;\n\nuniform float uMaxDistance;\nuniform float uTolerance;\nuniform float uBias;\n\nbool isBackground(const in float depth) {\n return depth == 1.0;\n}\n\nbool outsideBounds(const in vec2 p) {\n return p.x < uBounds.x || p.y < uBounds.y || p.x > uBounds.z || p.y > uBounds.w;\n}\n\nfloat getViewZ(const in float depth) {\n #if dOrthographic == 1\n return orthographicDepthToViewZ(depth, uNear, uFar);\n #else\n return perspectiveDepthToViewZ(depth, uNear, uFar);\n #endif\n}\n\nfloat getDepth(const in vec2 coords) {\n #ifdef depthTextureSupport\n return texture2D(tDepth, coords).r;\n #else\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n #endif\n}\n\nfloat screenFade(const in vec2 coords) {\n vec2 c = (coords - uBounds.xy) / (uBounds.zw - uBounds.xy);\n vec2 fade = max(12.0 * abs(c - 0.5) - 5.0, vec2(0.0));\n return saturate(1.0 - dot(fade, fade));\n}\n\n// based on https://panoskarabelas.com/posts/screen_space_shadows/\nfloat screenSpaceShadow(const in vec3 position, const in vec3 lightDirection, const in float stepLength) {\n // Ray position and direction (in view-space)\n vec3 rayPos = position;\n vec3 rayDir = -lightDirection;\n\n // Compute ray step\n vec3 rayStep = rayDir * stepLength;\n\n // Ray march towards the light\n float occlusion = 0.0;\n vec4 rayCoords = vec4(0.0);\n for (int i = 0; i < dSteps; ++i) {\n // Step the ray\n rayPos += rayStep;\n\n rayCoords = uProjection * vec4(rayPos, 1.0);\n rayCoords.xyz = (rayCoords.xyz / rayCoords.w) * 0.5 + 0.5;\n\n if (outsideBounds(rayCoords.xy))\n return 1.0;\n\n // Compute the difference between the ray's and the camera's depth\n float depth = getDepth(rayCoords.xy);\n float viewZ = getViewZ(depth);\n float zDelta = rayPos.z - viewZ;\n\n if (zDelta < uTolerance) {\n occlusion = 1.0;\n\n // Fade out as we approach the edges of the screen\n occlusion *= screenFade(rayCoords.xy);\n\n break;\n }\n }\n\n return 1.0 - (uBias * occlusion);\n}\n\nvoid main(void) {\n vec2 invTexSize = 1.0 / uTexSize;\n vec2 selfCoords = gl_FragCoord.xy * invTexSize;\n\n float selfDepth = getDepth(selfCoords);\n\n if (isBackground(selfDepth)) {\n gl_FragColor = vec4(0.0);\n return;\n }\n\n vec3 selfViewPos = screenSpaceToViewSpace(vec3(selfCoords, selfDepth), uInvProjection);\n float stepLength = uMaxDistance / float(dSteps);\n\n float o = 1.0;\n #if dLightCount != 0\n float sh[dLightCount];\n #pragma unroll_loop_start\n for (int i = 0; i < dLightCount; ++i) {\n sh[i] = screenSpaceShadow(selfViewPos, uLightDirection[i], stepLength);\n o = min(o, sh[i]);\n }\n #pragma unroll_loop_end\n #endif\n\n gl_FragColor = vec4(o);\n}\n"),o,i),i)}(t,s),this.ssaoFramebuffer=t.resources.framebuffer(),this.ssaoBlurFirstPassFramebuffer=t.resources.framebuffer(),this.ssaoBlurSecondPassFramebuffer=t.resources.framebuffer();const c=Math.floor(a*this.ssaoScale),u=Math.floor(l*this.ssaoScale),d=Math.max(1,Math.floor(.5*c)),f=Math.max(1,Math.floor(.5*u)),p=Math.max(1,Math.floor(.25*c)),m=Math.max(1,Math.floor(.25*u));this.downsampledDepthTarget=r.packedDepth?t.createRenderTarget(c,u,!1,"uint8","linear","rgba"):t.createRenderTarget(c,u,!1,"float32","linear",t.isWebGL2?"alpha":"rgba"),this.downsampleDepthRenderable=Zw(t,s);const h=1===this.ssaoScale?s:this.downsampledDepthTarget.texture;this.depthHalfTarget=r.packedDepth?t.createRenderTarget(d,f,!1,"uint8","linear","rgba"):t.createRenderTarget(d,f,!1,"float32","linear",t.isWebGL2?"alpha":"rgba"),this.depthHalfRenderable=Zw(t,h),this.depthQuarterTarget=r.packedDepth?t.createRenderTarget(p,m,!1,"uint8","linear","rgba"):t.createRenderTarget(p,m,!1,"float32","linear",t.isWebGL2?"alpha":"rgba"),this.depthQuarterRenderable=Zw(t,this.depthHalfTarget.texture),this.ssaoDepthTexture=t.resources.texture("image-uint8","rgba","ubyte","linear"),this.ssaoDepthTexture.define(c,u),this.ssaoDepthTexture.attachFramebuffer(this.ssaoFramebuffer,"color0"),this.ssaoDepthBlurProxyTexture=t.resources.texture("image-uint8","rgba","ubyte","linear"),this.ssaoDepthBlurProxyTexture.define(c,u),this.ssaoDepthBlurProxyTexture.attachFramebuffer(this.ssaoBlurFirstPassFramebuffer,"color0"),this.ssaoDepthTexture.attachFramebuffer(this.ssaoBlurSecondPassFramebuffer,"color0"),this.ssaoRenderable=function mdt(e,t,n,r){const i={...ua,tDepth:O.create(t),tDepthHalf:O.create(n),tDepthQuarter:O.create(r),uSamples:O.create(g0e(32)),dNSamples:O.create(32),uProjection:O.create(fe.identity()),uInvProjection:O.create(fe.identity()),uBounds:O.create(Bn()),uTexSize:O.create(Ue.create(e.gl.drawingBufferWidth,e.gl.drawingBufferHeight)),uRadius:O.create(Math.pow(2,5)),uBias:O.create(.8),dMultiScale:O.create(!1),dLevels:O.create(3),uLevelRadius:O.create([Math.pow(2,2),Math.pow(2,5),Math.pow(2,8)]),uLevelBias:O.create([.8,.8,.8]),uNearThreshold:O.create(10),uFarThreshold:O.create(1500)},o={...hdt};return ys(ms(e,"triangles",Wi("ssao",hl,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n\nuniform sampler2D tDepth;\nuniform sampler2D tDepthHalf;\nuniform sampler2D tDepthQuarter;\nuniform vec2 uTexSize;\nuniform vec4 uBounds;\n\nuniform vec3 uSamples[dNSamples];\n\nuniform mat4 uProjection;\nuniform mat4 uInvProjection;\n\n#ifdef dMultiScale\n uniform float uLevelRadius[dLevels];\n uniform float uLevelBias[dLevels];\n uniform float uNearThreshold;\n uniform float uFarThreshold;\n#else\n uniform float uRadius;\n#endif\nuniform float uBias;\n\nfloat smootherstep(float edge0, float edge1, float x) {\n x = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n return x * x * x * (x * (x * 6.0 - 15.0) + 10.0);\n}\n\nfloat noise(const in vec2 coords) {\n float a = 12.9898;\n float b = 78.233;\n float c = 43758.5453;\n float dt = dot(coords, vec2(a,b));\n float sn = mod(dt, PI);\n return abs(fract(sin(sn) * c)); // is abs necessary?\n}\n\nvec2 getNoiseVec2(const in vec2 coords) {\n return vec2(noise(coords), noise(coords + vec2(PI, 2.71828)));\n}\n\nbool isBackground(const in float depth) {\n return depth == 1.0;\n}\n\nfloat getDepth(const in vec2 coords) {\n vec2 c = vec2(clamp(coords.x, uBounds.x, uBounds.z), clamp(coords.y, uBounds.y, uBounds.w));\n #ifdef depthTextureSupport\n return texture2D(tDepth, c).r;\n #else\n return unpackRGBAToDepth(texture2D(tDepth, c));\n #endif\n}\n\n#define dQuarterThreshold 0.1\n#define dHalfThreshold 0.05\n\nfloat getMappedDepth(const in vec2 coords, const in vec2 selfCoords) {\n vec2 c = vec2(clamp(coords.x, uBounds.x, uBounds.z), clamp(coords.y, uBounds.y, uBounds.w));\n float d = distance(coords, selfCoords);\n #ifdef depthTextureSupport\n if (d > dQuarterThreshold) {\n return texture2D(tDepthQuarter, c).r;\n } else if (d > dHalfThreshold) {\n return texture2D(tDepthHalf, c).r;\n } else {\n return texture2D(tDepth, c).r;\n }\n #else\n if (d > dQuarterThreshold) {\n return unpackRGBAToDepth(texture2D(tDepthQuarter, c));\n } else if (d > dHalfThreshold) {\n return unpackRGBAToDepth(texture2D(tDepthHalf, c));\n } else {\n return unpackRGBAToDepth(texture2D(tDepth, c));\n }\n #endif\n}\n\nvec3 normalFromDepth(const in float depth, const in float depth1, const in float depth2, vec2 offset1, vec2 offset2) {\n vec3 p1 = vec3(offset1, depth1 - depth);\n vec3 p2 = vec3(offset2, depth2 - depth);\n\n vec3 normal = cross(p1, p2);\n normal.z = -normal.z;\n\n return normalize(normal);\n}\n\nfloat getPixelSize(const in vec2 coords, const in float depth) {\n vec3 viewPos0 = screenSpaceToViewSpace(vec3(coords, depth), uInvProjection);\n vec3 viewPos1 = screenSpaceToViewSpace(vec3(coords + vec2(1.0, 0.0) / uTexSize, depth), uInvProjection);\n return distance(viewPos0, viewPos1);\n}\n\n// StarCraft II Ambient Occlusion by [Filion and McNaughton 2008]\nvoid main(void) {\n vec2 invTexSize = 1.0 / uTexSize;\n vec2 selfCoords = gl_FragCoord.xy * invTexSize;\n\n float selfDepth = getDepth(selfCoords);\n vec2 selfPackedDepth = packUnitIntervalToRG(selfDepth);\n\n if (isBackground(selfDepth)) {\n gl_FragColor = vec4(packUnitIntervalToRG(1.0), selfPackedDepth);\n return;\n }\n\n vec2 offset1 = vec2(0.0, invTexSize.y);\n vec2 offset2 = vec2(invTexSize.x, 0.0);\n\n float selfDepth1 = getDepth(selfCoords + offset1);\n float selfDepth2 = getDepth(selfCoords + offset2);\n\n vec3 selfViewNormal = normalFromDepth(selfDepth, selfDepth1, selfDepth2, offset1, offset2);\n vec3 selfViewPos = screenSpaceToViewSpace(vec3(selfCoords, selfDepth), uInvProjection);\n\n vec3 randomVec = normalize(vec3(getNoiseVec2(selfCoords) * 2.0 - 1.0, 0.0));\n vec3 tangent = normalize(randomVec - selfViewNormal * dot(randomVec, selfViewNormal));\n vec3 bitangent = cross(selfViewNormal, tangent);\n mat3 TBN = mat3(tangent, bitangent, selfViewNormal);\n\n float occlusion = 0.0;\n #ifdef dMultiScale\n float pixelSize = getPixelSize(selfCoords, selfDepth);\n\n for(int l = 0; l < dLevels; l++) {\n // TODO: smooth transition\n if (pixelSize * uNearThreshold > uLevelRadius[l]) continue;\n if (pixelSize * uFarThreshold < uLevelRadius[l]) continue;\n\n float levelOcclusion = 0.0;\n for(int i = 0; i < dNSamples; i++) {\n vec3 sampleViewPos = TBN * uSamples[i];\n sampleViewPos = selfViewPos + sampleViewPos * uLevelRadius[l];\n\n vec4 offset = vec4(sampleViewPos, 1.0);\n offset = uProjection * offset;\n offset.xyz = (offset.xyz / offset.w) * 0.5 + 0.5;\n\n float sampleDepth = getMappedDepth(offset.xy, selfCoords);\n float sampleViewZ = screenSpaceToViewSpace(vec3(offset.xy, sampleDepth), uInvProjection).z;\n\n levelOcclusion += step(sampleViewPos.z + 0.025, sampleViewZ) * smootherstep(0.0, 1.0, uLevelRadius[l] / abs(selfViewPos.z - sampleViewZ)) * uLevelBias[l];\n }\n occlusion = max(occlusion, levelOcclusion);\n }\n #else\n for(int i = 0; i < dNSamples; i++) {\n vec3 sampleViewPos = TBN * uSamples[i];\n sampleViewPos = selfViewPos + sampleViewPos * uRadius;\n\n vec4 offset = vec4(sampleViewPos, 1.0);\n offset = uProjection * offset;\n offset.xyz = (offset.xyz / offset.w) * 0.5 + 0.5;\n\n float sampleDepth = getMappedDepth(offset.xy, selfCoords);\n float sampleViewZ = screenSpaceToViewSpace(vec3(offset.xy, sampleDepth), uInvProjection).z;\n\n occlusion += step(sampleViewPos.z + 0.025, sampleViewZ) * smootherstep(0.0, 1.0, uRadius / abs(selfViewPos.z - sampleViewZ));\n }\n #endif\n occlusion = 1.0 - (uBias * occlusion / float(dNSamples));\n\n vec2 packedOcclusion = packUnitIntervalToRG(clamp(occlusion, 0.01, 1.0));\n\n gl_FragColor = vec4(packedOcclusion, selfPackedDepth);\n}\n"),o,i),i)}(t,h,this.depthHalfTarget.texture,this.depthQuarterTarget.texture),this.ssaoBlurFirstPassRenderable=h0e(t,this.ssaoDepthTexture,"horizontal"),this.ssaoBlurSecondPassRenderable=h0e(t,this.ssaoDepthBlurProxyTexture,"vertical"),this.renderable=function bdt(e,t,n,r,i,o,s,a){const l={...ua,tSsaoDepth:O.create(s),tColor:O.create(t),tDepthOpaque:O.create(n),tDepthTransparent:O.create(r),tShadows:O.create(i),tOutlines:O.create(o),uTexSize:O.create(Ue.create(t.getWidth(),t.getHeight())),dOrthographic:O.create(0),uNear:O.create(1),uFar:O.create(1e4),uFogNear:O.create(1e4),uFogFar:O.create(1e4),uFogColor:O.create(C.create(1,1,1)),uOutlineColor:O.create(C.create(0,0,0)),uOcclusionColor:O.create(C.create(0,0,0)),uTransparentBackground:O.create(!1),dOcclusionEnable:O.create(!0),uOcclusionOffset:O.create(Ue.create(0,0)),dShadowEnable:O.create(!1),dOutlineEnable:O.create(!1),dOutlineScale:O.create(1),dTransparentOutline:O.create(a)},c={...ydt};return ys(ms(e,"triangles",Wi("postprocessing",hl,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tSsaoDepth;\nuniform sampler2D tColor;\nuniform sampler2D tDepthOpaque;\nuniform sampler2D tDepthTransparent;\nuniform sampler2D tShadows;\nuniform sampler2D tOutlines;\nuniform vec2 uTexSize;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\nuniform vec3 uOutlineColor;\nuniform vec3 uOcclusionColor;\nuniform bool uTransparentBackground;\nuniform vec2 uOcclusionOffset;\n\n#include common\n\nfloat getViewZ(const in float depth) {\n #if dOrthographic == 1\n return orthographicDepthToViewZ(depth, uNear, uFar);\n #else\n return perspectiveDepthToViewZ(depth, uNear, uFar);\n #endif\n}\n\nfloat getDepthOpaque(const in vec2 coords) {\n #ifdef depthTextureSupport\n return texture2D(tDepthOpaque, coords).r;\n #else\n return unpackRGBAToDepth(texture2D(tDepthOpaque, coords));\n #endif\n}\n\nfloat getDepthTransparent(const in vec2 coords) {\n #ifdef dTransparentOutline\n return unpackRGBAToDepth(texture2D(tDepthTransparent, coords));\n #else\n return 1.0;\n #endif\n}\n\nbool isBackground(const in float depth) {\n return depth == 1.0;\n}\n\nfloat getOutline(const in vec2 coords, const in float opaqueDepth, out float closestTexel) {\n float backgroundViewZ = 2.0 * uFar;\n vec2 invTexSize = 1.0 / uTexSize;\n\n float transparentDepth = getDepthTransparent(coords);\n float opaqueSelfViewZ = isBackground(opaqueDepth) ? backgroundViewZ : getViewZ(opaqueDepth);\n float transparentSelfViewZ = isBackground(transparentDepth) ? backgroundViewZ : getViewZ(transparentDepth);\n float selfDepth = min(opaqueDepth, transparentDepth);\n\n float outline = 1.0;\n closestTexel = 1.0;\n for (int y = -dOutlineScale; y <= dOutlineScale; y++) {\n for (int x = -dOutlineScale; x <= dOutlineScale; x++) {\n if (x * x + y * y > dOutlineScale * dOutlineScale) {\n continue;\n }\n\n vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;\n\n vec4 sampleOutlineCombined = texture2D(tOutlines, sampleCoords);\n float sampleOutline = sampleOutlineCombined.r;\n float sampleOutlineDepth = unpackRGToUnitInterval(sampleOutlineCombined.gb);\n float sampleOutlineViewZ = isBackground(sampleOutlineDepth) ? backgroundViewZ : getViewZ(sampleOutlineDepth);\n\n float selfViewZ = sampleOutlineCombined.a == 0.0 ? opaqueSelfViewZ : transparentSelfViewZ;\n if (sampleOutline == 0.0 && sampleOutlineDepth < closestTexel) {\n outline = 0.0;\n closestTexel = sampleOutlineDepth;\n }\n }\n }\n return closestTexel < opaqueDepth ? outline : 1.0;\n}\n\nfloat getSsao(vec2 coords) {\n float rawSsao = unpackRGToUnitInterval(texture2D(tSsaoDepth, coords).xy);\n if (rawSsao > 0.999) {\n return 1.0;\n } else if (rawSsao > 0.001) {\n return rawSsao;\n }\n // treat values close to 0.0 as errors and return no occlusion\n return 1.0;\n}\n\nvoid main(void) {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n vec4 color = texture2D(tColor, coords);\n\n float viewDist;\n float fogFactor;\n float opaqueDepth = getDepthOpaque(coords);\n\n #ifdef dOcclusionEnable\n if (!isBackground(opaqueDepth)) {\n viewDist = abs(getViewZ(opaqueDepth));\n fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n float occlusionFactor = getSsao(coords + uOcclusionOffset);\n if (!uTransparentBackground) {\n color.rgb = mix(mix(uOcclusionColor, uFogColor, fogFactor), color.rgb, occlusionFactor);\n } else {\n color.rgb = mix(uOcclusionColor * (1.0 - fogFactor), color.rgb, occlusionFactor);\n }\n }\n #endif\n\n #ifdef dShadowEnable\n if (!isBackground(opaqueDepth)) {\n viewDist = abs(getViewZ(opaqueDepth));\n fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n vec4 shadow = texture2D(tShadows, coords);\n if (!uTransparentBackground) {\n color.rgb = mix(mix(vec3(0), uFogColor, fogFactor), color.rgb, shadow.a);\n } else {\n color.rgb = mix(vec3(0) * (1.0 - fogFactor), color.rgb, shadow.a);\n }\n }\n #endif\n\n // outline needs to be handled after occlusion and shadow to keep them clean\n #ifdef dOutlineEnable\n float closestTexel;\n float outline = getOutline(coords, opaqueDepth, closestTexel);\n if (outline == 0.0) {\n viewDist = abs(getViewZ(closestTexel));\n fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n if (!uTransparentBackground) {\n color.rgb = mix(uOutlineColor, uFogColor, fogFactor);\n } else {\n color.a = 1.0 - fogFactor;\n color.rgb = mix(uOutlineColor, color.rgb, fogFactor);\n }\n }\n #endif\n\n gl_FragColor = color;\n}\n"),c,l),l)}(t,i.texture,s,o,this.shadowsTarget.texture,this.outlinesTarget.texture,this.ssaoDepthTexture,!0),this.background=new $ut(t,n,a,l)}setSize(t,n){const[r,i]=this.renderable.values.uTexSize.ref.value,o=this.calcSsaoScale(1);if(t!==r||n!==i||this.ssaoScale!==o){this.ssaoScale=o,this.target.setSize(t,n),this.outlinesTarget.setSize(t,n),this.shadowsTarget.setSize(t,n);const s=Math.floor(t*this.ssaoScale),a=Math.floor(n*this.ssaoScale);this.downsampledDepthTarget.setSize(s,a),this.ssaoDepthTexture.define(s,a),this.ssaoDepthBlurProxyTexture.define(s,a);const l=Math.max(1,Math.floor(.5*s)),c=Math.max(1,Math.floor(.5*a));this.depthHalfTarget.setSize(l,c);const u=Math.max(1,Math.floor(.25*s)),d=Math.max(1,Math.floor(.25*a));this.depthQuarterTarget.setSize(u,d),O.update(this.renderable.values.uTexSize,Ue.set(this.renderable.values.uTexSize.ref.value,t,n)),O.update(this.outlinesRenderable.values.uTexSize,Ue.set(this.outlinesRenderable.values.uTexSize.ref.value,t,n)),O.update(this.shadowsRenderable.values.uTexSize,Ue.set(this.shadowsRenderable.values.uTexSize.ref.value,t,n)),O.update(this.downsampleDepthRenderable.values.uTexSize,Ue.set(this.downsampleDepthRenderable.values.uTexSize.ref.value,s,a)),O.update(this.depthHalfRenderable.values.uTexSize,Ue.set(this.depthHalfRenderable.values.uTexSize.ref.value,l,c)),O.update(this.depthQuarterRenderable.values.uTexSize,Ue.set(this.depthQuarterRenderable.values.uTexSize.ref.value,u,d)),O.update(this.ssaoRenderable.values.uTexSize,Ue.set(this.ssaoRenderable.values.uTexSize.ref.value,s,a)),O.update(this.ssaoBlurFirstPassRenderable.values.uTexSize,Ue.set(this.ssaoBlurFirstPassRenderable.values.uTexSize.ref.value,s,a)),O.update(this.ssaoBlurSecondPassRenderable.values.uTexSize,Ue.set(this.ssaoBlurSecondPassRenderable.values.uTexSize.ref.value,s,a));const f=1===this.ssaoScale?this.drawPass.depthTextureOpaque:this.downsampledDepthTarget.texture;O.update(this.depthHalfRenderable.values.tColor,f),O.update(this.ssaoRenderable.values.tDepth,f),this.depthHalfRenderable.update(),this.ssaoRenderable.update(),this.background.setSize(t,n)}}updateState(t,n,r,i,o){var s;let a=!1,l=!1,c=!1,u=!1,d=!1,f=!1;const p="orthographic"===t.state.mode?1:0,m="on"===i.outline.name,h="on"===i.shadow.name,g="on"===i.occlusion.name,y=fe.identity();fe.invert(y,t.projection);const[v,x]=this.renderable.values.uTexSize.ref.value,_=t.viewport;if("on"===i.occlusion.name){O.update(this.ssaoRenderable.values.uProjection,t.projection),O.update(this.ssaoRenderable.values.uInvProjection,y);const M=this.ssaoRenderable.values.uBounds,E=this.ssaoScale;Bn.set(M.ref.value,Math.floor(_.x*E)/(v*E),Math.floor(_.y*E)/(x*E),Math.ceil((_.x+_.width)*E)/(v*E),Math.ceil((_.y+_.height)*E)/(x*E)),O.update(M,M.ref.value),O.update(this.ssaoBlurFirstPassRenderable.values.uBounds,M.ref.value),O.update(this.ssaoBlurSecondPassRenderable.values.uBounds,M.ref.value),O.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.uNear,t.near),O.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.uNear,t.near),O.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.uFar,t.far),O.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.uFar,t.far),O.update(this.ssaoBlurFirstPassRenderable.values.uInvProjection,y),O.update(this.ssaoBlurSecondPassRenderable.values.uInvProjection,y),this.ssaoBlurFirstPassRenderable.values.dOrthographic.ref.value!==p&&(u=!0,O.update(this.ssaoBlurFirstPassRenderable.values.dOrthographic,p),O.update(this.ssaoBlurSecondPassRenderable.values.dOrthographic,p)),this.nSamples!==i.occlusion.params.samples&&(c=!0,this.nSamples=i.occlusion.params.samples,O.update(this.ssaoRenderable.values.uSamples,g0e(this.nSamples)),O.updateIfChanged(this.ssaoRenderable.values.dNSamples,this.nSamples));const D="on"===i.occlusion.params.multiScale.name;if(this.ssaoRenderable.values.dMultiScale.ref.value!==D&&(c=!0,O.update(this.ssaoRenderable.values.dMultiScale,D)),"on"===i.occlusion.params.multiScale.name){const F=i.occlusion.params.multiScale.params;if(!tg(this.levels,F.levels)){c=!0,this.levels=F.levels;const R=function vdt(e,t){const n=e.length,{radius:r,bias:i}=t||{radius:new Array(3*n).fill(0),bias:new Array(3*n).fill(0)};e=e.slice().sort((o,s)=>o.radius-s.radius);for(let o=0;o=p.length)return-2;const{x:m,y:h,width:g,height:y}=o.viewport,v=1/p.length;if(-1===t)c.render(n,r,!1),O.update(s.values.uWeight,1),O.update(s.values.tColor,c.getColorTarget(r.postprocessing).texture),s.update(),l.bind(),f.disable(d.BLEND),f.disable(d.DEPTH_TEST),f.depthMask(!1),f.viewport(m,h,g,y),f.scissor(m,h,g,y),s.render(),t+=1;else{o.viewOffset.enabled=!0,O.update(s.values.tColor,c.getColorTarget(r.postprocessing).texture),O.update(s.values.uWeight,v),s.update();const _=Math.pow(2,Math.max(0,r.multiSample.sampleLevel-2));for(let w=0;w<_;++w){const A=p[t];if(Si.setViewOffset(o.viewOffset,g,y,A[0],A[1],g,y),o.update(),0===t?c.postprocessing.setOcclusionOffset(0,0):c.postprocessing.setOcclusionOffset(A[0]/g,A[1]/y),c.render(n,r,!1),a.bind(),f.enable(d.BLEND),f.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),f.blendFuncSeparate(d.ONE,d.ONE,d.ONE,d.ONE),f.disable(d.DEPTH_TEST),f.depthMask(!1),f.viewport(m,h,g,y),f.scissor(m,h,g,y),0===t&&(f.clearColor(0,0,0,0),d.clear(d.COLOR_BUFFER_BIT)),s.render(),(t+=1)>=p.length)break}}c.postprocessing.setOcclusionOffset(0,0),this.bindOutputTarget(i),f.viewport(m,h,g,y),f.scissor(m,h,g,y);const x=t*v;return x>0&&(O.update(s.values.uWeight,1),O.update(s.values.tColor,a.texture),s.update(),f.disable(d.BLEND),s.render()),x<1&&(O.update(s.values.uWeight,1-x),O.update(s.values.tColor,l.texture),s.update(),0===x?f.disable(d.BLEND):f.enable(d.BLEND),s.render()),o.viewOffset.enabled=!1,o.update(),It&&u.timer.markEnd("MultiSamplePass.renderTemporalMultiSample"),t>=p.length?-2:t}}const Pq=[[[0,0]],[[0,0],[-4,-4]],[[0,0],[6,-2],[-6,2],[2,6]],[[0,0],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[0,0],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[0,0],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];Pq.forEach(e=>{e.forEach(t=>{t[0]*=.0625,t[1]*=.0625})});class b0e{update(t,n){return t&&(this.sampleIndex=-1),"temporal"===n.mode&&-2!==this.sampleIndex}render(t,n,r,i){return this.sampleIndex=this.multiSamplePass.render(this.sampleIndex,t,n,r,!!i),this.sampleIndex<0}constructor(t){this.multiSamplePass=t,this.sampleIndex=-2}}const v0e={eyeSeparation:I.Numeric(.062,{min:.02,max:.1,step:.001},{description:"Distance between left and right camera."}),focus:I.Numeric(10,{min:1,max:20,step:.1},{description:"Apparent object distance."})},wdt=I.getDefaultValues(v0e);class CA{get viewport(){return this.parent.viewport}get viewOffset(){return this.parent.viewOffset}constructor(t,n={}){this.parent=t,this.left=new x0e,this.right=new x0e,this.props={...wdt,...n}}setProps(t){Object.assign(this.props,t)}update(){this.parent.update(),function Adt(e,t,n,r){Da.copy(n.viewport,e.viewport),fe.copy(n.view,e.view),fe.copy(n.projection,e.projection),Si.copySnapshot(n.state,e.state),Si.copyViewOffset(n.viewOffset,e.viewOffset),n.far=e.far,n.near=e.near,n.fogFar=e.fogFar,n.fogNear=e.fogNear,Da.copy(r.viewport,e.viewport),fe.copy(r.view,e.view),fe.copy(r.projection,e.projection),Si.copySnapshot(r.state,e.state),Si.copyViewOffset(r.viewOffset,e.viewOffset),r.far=e.far,r.near=e.near,r.fogFar=e.fogFar,r.fogNear=e.fogNear;const i=Math.floor(e.viewport.width/2),o=i/e.viewport.height;n.viewport.width=i,r.viewport.x+=i,r.viewport.width-=i;const s=t.eyeSeparation/2,a=s*e.near/t.focus,l=e.near*Math.tan(.5*e.state.fov);let c,u;_0e[12]=-s,S0e[12]=s,c=-l*o+a,u=l*o+a,n.projection[0]=2*e.near/(u-c),n.projection[8]=(u+c)/(u-c),fe.mul(n.view,n.view,_0e),fe.mul(n.projectionView,n.projection,n.view),fe.invert(n.inverseProjectionView,n.projectionView),c=-l*o-a,u=l*o-a,r.projection[0]=2*e.near/(u-c),r.projection[8]=(u+c)/(u-c),fe.mul(r.view,r.view,S0e),fe.mul(r.projectionView,r.projection,r.view),fe.invert(r.inverseProjectionView,r.projectionView)}(this.parent,this.props,this.left,this.right)}}!function(e){e.is=function t(n){return"left"in n&&"right"in n}}(CA||(CA={}));class x0e{constructor(){this.viewport=Da.create(0,0,0,0),this.view=fe(),this.projection=fe(),this.projectionView=fe(),this.inverseProjectionView=fe(),this.state=Si.createDefaultSnapshot(),this.viewOffset=Si.ViewOffset(),this.far=0,this.near=0,this.fogFar=0,this.fogNear=0}}const _0e=fe.identity(),S0e=fe.identity(),kq=Math.pow(2,24)-2;class Idt{constructor(t,n,r){this.webgl=t,this.drawPass=n,this.pickScale=r;const i=r/t.pixelRatio;this.pickWidth=Math.ceil(n.colorTarget.getWidth()*i),this.pickHeight=Math.ceil(n.colorTarget.getHeight()*i);const{resources:o,extensions:{drawBuffers:s},gl:a}=t;s?(this.objectPickTexture=o.texture("image-uint8","rgba","ubyte","nearest"),this.objectPickTexture.define(this.pickWidth,this.pickHeight),this.instancePickTexture=o.texture("image-uint8","rgba","ubyte","nearest"),this.instancePickTexture.define(this.pickWidth,this.pickHeight),this.groupPickTexture=o.texture("image-uint8","rgba","ubyte","nearest"),this.groupPickTexture.define(this.pickWidth,this.pickHeight),this.depthPickTexture=o.texture("image-uint8","rgba","ubyte","nearest"),this.depthPickTexture.define(this.pickWidth,this.pickHeight),this.framebuffer=o.framebuffer(),this.objectPickFramebuffer=o.framebuffer(),this.instancePickFramebuffer=o.framebuffer(),this.groupPickFramebuffer=o.framebuffer(),this.depthPickFramebuffer=o.framebuffer(),this.framebuffer.bind(),s.drawBuffers([s.COLOR_ATTACHMENT0,s.COLOR_ATTACHMENT1,s.COLOR_ATTACHMENT2,s.COLOR_ATTACHMENT3]),this.objectPickTexture.attachFramebuffer(this.framebuffer,"color0"),this.instancePickTexture.attachFramebuffer(this.framebuffer,"color1"),this.groupPickTexture.attachFramebuffer(this.framebuffer,"color2"),this.depthPickTexture.attachFramebuffer(this.framebuffer,"color3"),this.depthRenderbuffer=Cn(a)?o.renderbuffer("depth32f","depth",this.pickWidth,this.pickHeight):o.renderbuffer("depth16","depth",this.pickWidth,this.pickHeight),this.depthRenderbuffer.attachFramebuffer(this.framebuffer),this.objectPickTexture.attachFramebuffer(this.objectPickFramebuffer,"color0"),this.instancePickTexture.attachFramebuffer(this.instancePickFramebuffer,"color0"),this.groupPickTexture.attachFramebuffer(this.groupPickFramebuffer,"color0"),this.depthPickTexture.attachFramebuffer(this.depthPickFramebuffer,"color0")):(this.objectPickTarget=t.createRenderTarget(this.pickWidth,this.pickHeight),this.instancePickTarget=t.createRenderTarget(this.pickWidth,this.pickHeight),this.groupPickTarget=t.createRenderTarget(this.pickWidth,this.pickHeight),this.depthPickTarget=t.createRenderTarget(this.pickWidth,this.pickHeight))}get pickRatio(){return this.pickScale/this.webgl.pixelRatio}setPickScale(t){this.pickScale=t,this.syncSize()}bindObject(){this.webgl.extensions.drawBuffers?this.objectPickFramebuffer.bind():this.objectPickTarget.bind()}bindInstance(){this.webgl.extensions.drawBuffers?this.instancePickFramebuffer.bind():this.instancePickTarget.bind()}bindGroup(){this.webgl.extensions.drawBuffers?this.groupPickFramebuffer.bind():this.groupPickTarget.bind()}bindDepth(){this.webgl.extensions.drawBuffers?this.depthPickFramebuffer.bind():this.depthPickTarget.bind()}get drawingBufferHeight(){return this.drawPass.colorTarget.getHeight()}syncSize(){const t=this.pickScale/this.webgl.pixelRatio,n=Math.ceil(this.drawPass.colorTarget.getWidth()*t),r=Math.ceil(this.drawPass.colorTarget.getHeight()*t);(n!==this.pickWidth||r!==this.pickHeight)&&(this.pickWidth=n,this.pickHeight=r,this.webgl.extensions.drawBuffers?(this.objectPickTexture.define(this.pickWidth,this.pickHeight),this.instancePickTexture.define(this.pickWidth,this.pickHeight),this.groupPickTexture.define(this.pickWidth,this.pickHeight),this.depthPickTexture.define(this.pickWidth,this.pickHeight),this.depthRenderbuffer.setSize(this.pickWidth,this.pickHeight)):(this.objectPickTarget.setSize(this.pickWidth,this.pickHeight),this.instancePickTarget.setSize(this.pickWidth,this.pickHeight),this.groupPickTarget.setSize(this.pickWidth,this.pickHeight),this.depthPickTarget.setSize(this.pickWidth,this.pickHeight)))}renderVariant(t,n,r,i,o,s){t.clear(!1),t.update(n,r),t.renderPick(r.primitives,n,o,null,s),i.handle.isEnabled&&t.renderPick(i.handle.scene,n,o,null,s),i.camera.isEnabled&&(i.camera.update(n),t.update(i.camera.camera,i.camera.scene),t.renderPick(i.camera.scene,i.camera.camera,o,null,s))}render(t,n,r,i){this.webgl.extensions.drawBuffers?(this.framebuffer.bind(),this.renderVariant(t,n,r,i,"pick",$_.None)):(this.objectPickTarget.bind(),this.renderVariant(t,n,r,i,"pick",$_.Object),this.instancePickTarget.bind(),this.renderVariant(t,n,r,i,"pick",$_.Instance),this.groupPickTarget.bind(),this.renderVariant(t,n,r,i,"pick",$_.Group),this.depthPickTarget.bind(),this.renderVariant(t,n,r,i,"depth",$_.None))}}class Edt{setupBuffers(){const t=this.pickWidth*this.pickHeight*4;(!this.objectBuffer||this.objectBuffer.length!==t)&&(this.objectBuffer=new Uint8Array(t),this.instanceBuffer=new Uint8Array(t),this.groupBuffer=new Uint8Array(t),this.depthBuffer=new Uint8Array(t))}setViewport(t,n,r,i){Da.set(this.viewport,t,n,r,i),this.pickRatio=this.pickPass.pickRatio,this.pickX=Math.ceil(t*this.pickRatio),this.pickY=Math.ceil(n*this.pickRatio);const o=Math.floor(r*this.pickRatio),s=Math.floor(i*this.pickRatio);(o!==this.pickWidth||s!==this.pickHeight)&&(this.pickWidth=o,this.pickHeight=s,this.halfPickWidth=Math.floor(this.pickWidth/2),this.setupBuffers()),this.spiral=function CFe(e){let t=0,n=0;const r=[0,-1],i=2*e+1,o=i/2,s=[];for(let a=Math.pow(i,2);a>0;--a)-o0&&t===1-n)&&([r[0],r[1]]=[-r[1],r[0]]),t+=r[0],n+=r[1];return s}(Math.round(this.pickRatio*this.pickPadding))}syncBuffers(){It&&this.webgl.timer.mark("PickHelper.syncBuffers");const{pickX:t,pickY:n,pickWidth:r,pickHeight:i}=this;this.pickPass.bindObject(),this.webgl.readPixels(t,n,r,i,this.objectBuffer),this.pickPass.bindInstance(),this.webgl.readPixels(t,n,r,i,this.instanceBuffer),this.pickPass.bindGroup(),this.webgl.readPixels(t,n,r,i,this.groupBuffer),this.pickPass.bindDepth(),this.webgl.readPixels(t,n,r,i,this.depthBuffer),It&&this.webgl.timer.markEnd("PickHelper.syncBuffers")}getBufferIdx(t,n){return 4*(n*this.pickWidth+t)}getDepth(t,n){const r=this.getBufferIdx(t,n),i=this.depthBuffer;return function HKe(e,t,n,r){return Bn.set(nfe,e/255,t/255,n/255,r/255),Bn.dot(nfe,VKe)}(i[r],i[r+1],i[r+2],i[r+3])}getId(t,n,r){const i=this.getBufferIdx(t,n);return H9(r[i],r[i+1],r[i+2])}render(t){It&&this.webgl.timer.mark("PickHelper.render",!0);const{pickX:n,pickY:r,pickWidth:i,pickHeight:o,halfPickWidth:s}=this,{renderer:a,scene:l,helper:c}=this;a.setTransparentBackground(!1),a.setDrawingBufferSize(i,o),a.setPixelRatio(this.pickRatio),CA.is(t)?(a.setViewport(n,r,s,o),this.pickPass.render(a,t.left,l,c),a.setViewport(n+s,r,i-s,o),this.pickPass.render(a,t.right,l,c)):(a.setViewport(n,r,i,o),this.pickPass.render(a,t,l,c)),this.dirty=!1,It&&this.webgl.timer.markEnd("PickHelper.render")}identifyInternal(t,n,r){const{webgl:i,pickRatio:o}=this;if(i.isContextLost)return;t*=i.pixelRatio,n=this.pickPass.drawingBufferHeight-(n*=i.pixelRatio);const{viewport:s}=this;if(ts.x+s.width||n>s.y+s.height)return;this.dirty&&(It&&this.webgl.timer.mark("PickHelper.identify"),this.render(r),this.syncBuffers(),It&&this.webgl.timer.markEnd("PickHelper.identify"));const a=t-s.x,l=n-s.y,c=Math.floor(a*o),u=Math.floor(l*o),d=this.getId(c,u,this.objectBuffer);if(-1===d||d===kq)return;const f=this.getId(c,u,this.instanceBuffer);if(-1===f||f===kq)return;const p=this.getId(c,u,this.groupBuffer);if(-1===p||p===kq)return;const m=this.getDepth(c,u),h=C.create(t,n,m);if(CA.is(r)){const g=Math.floor(s.width/2);t>s.x+g?(h[0]=s.x+2*(a-g),CF(h,h,s,r.right.inverseProjectionView)):(h[0]=s.x+2*a,CF(h,h,s,r.left.inverseProjectionView))}else CF(h,h,s,r.inverseProjectionView);return{id:{objectId:d,instanceId:f,groupId:p},position:h}}identify(t,n,r){for(const i of this.spiral){const o=this.identifyInternal(t+i[0],n+i[1],r);if(o)return o}}constructor(t,n,r,i,o,s,a=1){this.webgl=t,this.renderer=n,this.scene=r,this.helper=i,this.pickPass=o,this.pickPadding=a,this.dirty=!0,this.viewport=Da(),this.setViewport(s.x,s.y,s.width,s.height)}}const Ddt={...ca,tWboitA:xn("texture","rgba","float","nearest"),tWboitB:xn("texture","rgba","float","nearest"),uTexSize:Ne("v2")},Pdt=Wi("evaluate-wboit",hl,"\nprecision highp float;\n\nuniform sampler2D tWboitA;\nuniform sampler2D tWboitB;\nuniform vec2 uTexSize;\n\nvoid main() {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n\n vec4 accum = texture2D(tWboitA, coords);\n float r = 1.0 - accum.a;\n\n accum.a = texture2D(tWboitB, coords).r;\n // divisor needs to allow very small values for nice fading\n gl_FragColor = vec4(accum.rgb / clamp(accum.a, 0.00000001, 50000.0), r);\n}\n");class Mq{get supported(){return this._supported}bind(){const{state:t,gl:n}=this.webgl;this.framebuffer.bind(),t.clearColor(0,0,0,1),n.clear(n.COLOR_BUFFER_BIT),t.disable(n.DEPTH_TEST),t.blendFuncSeparate(n.ONE,n.ONE,n.ZERO,n.ONE_MINUS_SRC_ALPHA),t.enable(n.BLEND)}render(){It&&this.webgl.timer.mark("WboitPass.render");const{state:t,gl:n}=this.webgl;t.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),t.enable(n.BLEND),this.renderable.update(),this.renderable.render(),It&&this.webgl.timer.markEnd("WboitPass.render")}setSize(t,n){const[r,i]=this.renderable.values.uTexSize.ref.value;(t!==r||n!==i)&&(this.textureA.define(t,n),this.textureB.define(t,n),this.depthRenderbuffer.setSize(t,n),O.update(this.renderable.values.uTexSize,Ue.set(this.renderable.values.uTexSize.ref.value,t,n)))}reset(){this._supported&&this._init()}_init(){const{extensions:{drawBuffers:t}}=this.webgl;this.framebuffer.bind(),t.drawBuffers([t.COLOR_ATTACHMENT0,t.COLOR_ATTACHMENT1]),this.textureA.attachFramebuffer(this.framebuffer,"color0"),this.textureB.attachFramebuffer(this.framebuffer,"color1"),this.depthRenderbuffer.attachFramebuffer(this.framebuffer)}static isSupported(t){const{extensions:{drawBuffers:n,textureFloat:r,colorBufferFloat:i,depthTexture:o}}=t;if(r&&i&&o&&n)return!0;if($n){const s=[];r||s.push("textureFloat"),i||s.push("colorBufferFloat"),o||s.push("depthTexture"),n||s.push("drawBuffers"),console.log(`Missing "${s.join('", "')}" extensions required for "wboit"`)}return!1}constructor(t,n,r){if(this.webgl=t,this._supported=!1,!Mq.isSupported(t))return;const{resources:i,gl:o}=t;this.textureA=i.texture("image-float32","rgba","float","nearest"),this.textureA.define(n,r),this.textureB=i.texture("image-float32","rgba","float","nearest"),this.textureB.define(n,r),this.depthRenderbuffer=Cn(o)?i.renderbuffer("depth32f","depth",n,r):i.renderbuffer("depth16","depth",n,r),this.renderable=function kdt(e,t,n){const r={...ua,tWboitA:O.create(t),tWboitB:O.create(n),uTexSize:O.create(Ue.create(t.getWidth(),t.getHeight()))},i={...Ddt};return ys(ms(e,"triangles",Pdt,i,r),r)}(t,this.textureA,this.textureB),this.framebuffer=i.framebuffer(),this._supported=!0,this._init()}}const Ndt={...ca,tDpoitBackColor:xn("texture","rgba","float","nearest"),uTexSize:Ne("v2")},Fdt=Wi("blend-back-dpoit",hl,"\n precision highp float;\n\n uniform sampler2D tDpoitBackColor;\n uniform vec2 uTexSize;\n\n void main() {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n gl_FragColor = texture2D(tDpoitBackColor, coords);\n if (gl_FragColor.a == 0.0) {\n discard;\n }\n }\n"),Bdt={...ca,tDpoitFrontColor:xn("texture","rgba","float","nearest"),uTexSize:Ne("v2")},Ldt=Wi("evaluate-dpoit",hl,"\nprecision highp float;\n\nuniform sampler2D tDpoitFrontColor;\nuniform vec2 uTexSize;\n\nvoid main() {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n gl_FragColor = texture2D(tDpoitFrontColor, coords);\n}\n");class Rq{get supported(){return this._supported}bind(){const{state:t,gl:n,extensions:{blendMinMax:r}}=this.webgl;return this.passCount=0,this.depthFramebuffers[0].bind(),t.clearColor(this.DEPTH_CLEAR_VALUE,this.DEPTH_CLEAR_VALUE,0,0),n.clear(n.COLOR_BUFFER_BIT),this.depthFramebuffers[1].bind(),t.clearColor(-this.MIN_DEPTH,this.MAX_DEPTH,0,0),n.clear(n.COLOR_BUFFER_BIT),this.colorFramebuffers[0].bind(),t.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),this.colorFramebuffers[1].bind(),t.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),this.depthFramebuffers[0].bind(),t.blendEquation(r.MAX),t.depthMask(!1),{depth:this.depthTextures[1],frontColor:this.colorFrontTextures[1],backColor:this.colorBackTextures[1]}}bindDualDepthPeeling(){const{state:t,gl:n,extensions:{blendMinMax:r}}=this.webgl;return this.readId=this.passCount%2,this.writeId=1-this.readId,this.passCount+=1,this.depthFramebuffers[this.writeId].bind(),t.clearColor(this.DEPTH_CLEAR_VALUE,this.DEPTH_CLEAR_VALUE,0,0),n.clear(n.COLOR_BUFFER_BIT),this.colorFramebuffers[this.writeId].bind(),t.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),this.depthFramebuffers[this.writeId].bind(),t.blendEquation(r.MAX),t.depthMask(!1),{depth:this.depthTextures[this.readId],frontColor:this.colorFrontTextures[this.readId],backColor:this.colorBackTextures[this.readId]}}renderBlendBack(){It&&this.webgl.timer.mark("DpoitPass.renderBlendBack");const{state:t,gl:n}=this.webgl;t.blendEquation(n.FUNC_ADD),t.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA),O.update(this.blendBackRenderable.values.tDpoitBackColor,this.colorBackTextures[this.writeId]),this.blendBackRenderable.update(),this.blendBackRenderable.render(),It&&this.webgl.timer.markEnd("DpoitPass.renderBlendBack")}render(){It&&this.webgl.timer.mark("DpoitPass.render");const{state:t,gl:n}=this.webgl;t.blendFunc(n.ONE,n.ONE_MINUS_SRC_ALPHA),O.update(this.renderable.values.tDpoitFrontColor,this.colorFrontTextures[this.writeId]),this.renderable.update(),this.renderable.render(),It&&this.webgl.timer.markEnd("DpoitPass.render")}setSize(t,n){const[r,i]=this.renderable.values.uTexSize.ref.value;if(t!==r||n!==i){for(let o=0;o<2;o++)this.depthTextures[o].define(t,n),this.colorFrontTextures[o].define(t,n),this.colorBackTextures[o].define(t,n);O.update(this.renderable.values.uTexSize,Ue.set(this.renderable.values.uTexSize.ref.value,t,n)),O.update(this.blendBackRenderable.values.uTexSize,Ue.set(this.blendBackRenderable.values.uTexSize.ref.value,t,n))}}reset(){this._supported&&this._init()}_init(){const{extensions:{drawBuffers:t}}=this.webgl;for(let n=0;n<2;n++)this.depthFramebuffers[n].bind(),t.drawBuffers([t.COLOR_ATTACHMENT0,t.COLOR_ATTACHMENT1,t.COLOR_ATTACHMENT2]),this.colorFrontTextures[n].attachFramebuffer(this.depthFramebuffers[n],"color0"),this.colorBackTextures[n].attachFramebuffer(this.depthFramebuffers[n],"color1"),this.depthTextures[n].attachFramebuffer(this.depthFramebuffers[n],"color2"),this.colorFramebuffers[n].bind(),t.drawBuffers([t.COLOR_ATTACHMENT0,t.COLOR_ATTACHMENT1]),this.colorFrontTextures[n].attachFramebuffer(this.colorFramebuffers[n],"color0"),this.colorBackTextures[n].attachFramebuffer(this.colorFramebuffers[n],"color1")}static isSupported(t){const{extensions:{drawBuffers:n,textureFloat:r,colorBufferFloat:i,blendMinMax:o}}=t;if(r&&i&&n&&o)return!0;if($n){const s=[];r||s.push("textureFloat"),i||s.push("colorBufferFloat"),n||s.push("drawBuffers"),o||s.push("blendMinMax"),console.log(`Missing "${s.join('", "')}" extensions required for "dpoit"`)}return!1}constructor(t,n,r){if(this.webgl=t,this.DEPTH_CLEAR_VALUE=-99999,this.MAX_DEPTH=1,this.MIN_DEPTH=0,this.passCount=0,this._supported=!1,!Rq.isSupported(t))return;const{resources:i,extensions:{colorBufferHalfFloat:o,textureHalfFloat:s}}=t;Cn(t.gl)?(this.depthTextures=[i.texture("image-float32","rg","float","nearest"),i.texture("image-float32","rg","float","nearest")],this.colorFrontTextures=o&&s?[i.texture("image-float16","rgba","fp16","nearest"),i.texture("image-float16","rgba","fp16","nearest")]:[i.texture("image-float32","rgba","float","nearest"),i.texture("image-float32","rgba","float","nearest")],this.colorBackTextures=o&&s?[i.texture("image-float16","rgba","fp16","nearest"),i.texture("image-float16","rgba","fp16","nearest")]:[i.texture("image-float32","rgba","float","nearest"),i.texture("image-float32","rgba","float","nearest")]):(this.depthTextures=[i.texture("image-float32","rgba","float","nearest"),i.texture("image-float32","rgba","float","nearest")],this.colorFrontTextures=[i.texture("image-float32","rgba","float","nearest"),i.texture("image-float32","rgba","float","nearest")],this.colorBackTextures=[i.texture("image-float32","rgba","float","nearest"),i.texture("image-float32","rgba","float","nearest")]),this.depthTextures[0].define(n,r),this.depthTextures[1].define(n,r),this.colorFrontTextures[0].define(n,r),this.colorFrontTextures[1].define(n,r),this.colorBackTextures[0].define(n,r),this.colorBackTextures[1].define(n,r),this.depthFramebuffers=[i.framebuffer(),i.framebuffer()],this.colorFramebuffers=[i.framebuffer(),i.framebuffer()],this.blendBackRenderable=function Odt(e,t){const n={...ua,tDpoitBackColor:O.create(t),uTexSize:O.create(Ue.create(t.getWidth(),t.getHeight()))},r={...Ndt};return ys(ms(e,"triangles",Fdt,r,n),n)}(t,this.colorBackTextures[0]),this.renderable=function jdt(e,t){const n={...ua,tDpoitFrontColor:O.create(t),uTexSize:O.create(Ue.create(t.getWidth(),t.getHeight()))},r={...Bdt};return ys(ms(e,"triangles",Ldt,r,n),n)}(t,this.colorFrontTextures[0]),this._supported=!0,this._init()}}const C0e={enabled:I.Boolean(!0),highlightEdgeColor:I.Color(st.darken(st.fromNormalizedRgb(1,.4,.6),1)),selectEdgeColor:I.Color(st.darken(st.fromNormalizedRgb(.2,1,.1),1)),edgeScale:I.Numeric(1,{min:1,max:3,step:1},{description:"Thickness of the edge."}),highlightEdgeStrength:I.Numeric(1,{min:0,max:1,step:.1}),selectEdgeStrength:I.Numeric(1,{min:0,max:1,step:.1}),ghostEdgeStrength:I.Numeric(.3,{min:0,max:1,step:.1},{description:"Opacity of the hidden edges that are covered by other geometry. When set to 1, one less geometry render pass is done."}),innerEdgeFactor:I.Numeric(1.5,{min:0,max:3,step:.1},{description:"Factor to multiply the inner edge color with - for added contrast."})};class w0e{static isEnabled(t){return t.enabled}constructor(t,n,r){this.webgl=t,this.depthTarget=t.createRenderTarget(n,r),this.maskTarget=t.createRenderTarget(n,r),this.edgesTarget=t.createRenderTarget(n,r),this.edge=function Gdt(e,t){const n=t.getWidth(),r=t.getHeight(),i={...ua,tMaskTexture:O.create(t),uTexSizeInv:O.create(Ue.create(1/n,1/r)),dEdgeScale:O.create(1)},o={...Vdt};return ys(ms(e,"triangles",Hdt,o,i),i)}(t,this.maskTarget.texture),this.overlay=function $dt(e,t){const n=t.getWidth(),r=t.getHeight(),i={...ua,tEdgeTexture:O.create(t),uTexSizeInv:O.create(Ue.create(1/n,1/r)),uHighlightEdgeColor:O.create(C()),uSelectEdgeColor:O.create(C()),uHighlightEdgeStrength:O.create(1),uSelectEdgeStrength:O.create(1),uGhostEdgeStrength:O.create(0),uInnerEdgeFactor:O.create(0)},o={...qdt};return ys(ms(e,"triangles",Wdt,o,i),i)}(t,this.edgesTarget.texture)}setEdgeState(t){const{gl:n,state:r}=this.webgl;r.enable(n.SCISSOR_TEST),r.enable(n.BLEND),r.blendFunc(n.ONE,n.ONE),r.blendEquation(n.FUNC_ADD),r.disable(n.DEPTH_TEST),r.depthMask(!1);const{x:i,y:o,width:s,height:a}=t;r.viewport(i,o,s,a),r.scissor(i,o,s,a),r.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT)}setOverlayState(t){const{gl:n,state:r}=this.webgl;r.enable(n.SCISSOR_TEST),r.enable(n.BLEND),r.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),r.blendEquation(n.FUNC_ADD),r.disable(n.DEPTH_TEST),r.depthMask(!1);const{x:i,y:o,width:s,height:a}=t;r.viewport(i,o,s,a),r.scissor(i,o,s,a)}setSize(t,n){const r=this.depthTarget.getWidth(),i=this.depthTarget.getHeight();(t!==r||n!==i)&&(this.depthTarget.setSize(t,n),this.maskTarget.setSize(t,n),this.edgesTarget.setSize(t,n),O.update(this.edge.values.uTexSizeInv,Ue.set(this.edge.values.uTexSizeInv.ref.value,1/t,1/n)),O.update(this.overlay.values.uTexSizeInv,Ue.set(this.overlay.values.uTexSizeInv.ref.value,1/t,1/n)))}update(t){const{highlightEdgeColor:n,selectEdgeColor:r,edgeScale:i,innerEdgeFactor:o,ghostEdgeStrength:s,highlightEdgeStrength:a,selectEdgeStrength:l}=t,{values:c}=this.edge,u=Math.max(1,Math.round(i*this.webgl.pixelRatio));c.dEdgeScale.ref.value!==u&&(O.update(c.dEdgeScale,u),this.edge.update());const{values:d}=this.overlay;O.update(d.uHighlightEdgeColor,st.toVec3Normalized(d.uHighlightEdgeColor.ref.value,n)),O.update(d.uSelectEdgeColor,st.toVec3Normalized(d.uSelectEdgeColor.ref.value,r)),O.updateIfChanged(d.uInnerEdgeFactor,o),O.updateIfChanged(d.uGhostEdgeStrength,s),O.updateIfChanged(d.uHighlightEdgeStrength,a),O.updateIfChanged(d.uSelectEdgeStrength,l)}render(t,n){It&&this.webgl.timer.mark("MarkingPass.render"),this.edgesTarget.bind(),this.setEdgeState(t),this.edge.render(),n?n.bind():this.webgl.unbindFramebuffer(),this.setOverlayState(t),this.overlay.render(),It&&this.webgl.timer.markEnd("MarkingPass.render")}}const Vdt={...ca,tMaskTexture:xn("texture","rgba","ubyte","linear"),uTexSizeInv:Ne("v2"),dEdgeScale:cn("number")},Hdt=Wi("edge",hl,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform sampler2D tMaskTexture;\nuniform vec2 uTexSizeInv;\n\nvoid main() {\n vec2 coords = gl_FragCoord.xy * uTexSizeInv;\n vec4 offset = vec4(float(dEdgeScale), 0.0, 0.0, float(dEdgeScale)) * vec4(uTexSizeInv, uTexSizeInv);\n vec4 c0 = texture2D(tMaskTexture, coords);\n vec4 c1 = texture2D(tMaskTexture, coords + offset.xy);\n vec4 c2 = texture2D(tMaskTexture, coords - offset.xy);\n vec4 c3 = texture2D(tMaskTexture, coords + offset.yw);\n vec4 c4 = texture2D(tMaskTexture, coords - offset.yw);\n float diff1 = (c1.r - c2.r) * 0.5;\n float diff2 = (c3.r - c4.r) * 0.5;\n float d = length(vec2(diff1, diff2));\n if (d <= 0.0)\n discard;\n float a1 = min(c1.g, c2.g);\n float a2 = min(c3.g, c4.g);\n float visibility = min(a1, a2) > 0.001 ? 1.0 : 0.0;\n float mask = c0.r;\n float marker = min(c1.b, min(c2.b, min(c3.b, c4.b)));\n float fogAlpha = min(c1.a, min(c2.a, min(c3.a, c4.a)));\n gl_FragColor = vec4(visibility, mask, marker, fogAlpha);\n}\n"),qdt={...ca,tEdgeTexture:xn("texture","rgba","ubyte","linear"),uTexSizeInv:Ne("v2"),uHighlightEdgeColor:Ne("v3"),uSelectEdgeColor:Ne("v3"),uHighlightEdgeStrength:Ne("f"),uSelectEdgeStrength:Ne("f"),uGhostEdgeStrength:Ne("f"),uInnerEdgeFactor:Ne("f")},Wdt=Wi("overlay",hl,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform vec2 uTexSizeInv;\nuniform sampler2D tEdgeTexture;\nuniform vec3 uHighlightEdgeColor;\nuniform vec3 uSelectEdgeColor;\nuniform float uHighlightEdgeStrength;\nuniform float uSelectEdgeStrength;\nuniform float uGhostEdgeStrength;\nuniform float uInnerEdgeFactor;\n\nvoid main() {\n vec2 coords = gl_FragCoord.xy * uTexSizeInv;\n vec4 edgeValue = texture2D(tEdgeTexture, coords);\n if (edgeValue.a > 0.0) {\n vec3 edgeColor = edgeValue.b == 1.0 ? uHighlightEdgeColor : uSelectEdgeColor;\n gl_FragColor.rgb = edgeValue.g > 0.0 ? edgeColor : edgeColor * uInnerEdgeFactor;\n gl_FragColor.a = (edgeValue.r == 1.0 ? uGhostEdgeStrength : 1.0) * edgeValue.a;\n float edgeStrength = edgeValue.b == 1.0 ? uHighlightEdgeStrength : uSelectEdgeStrength;\n gl_FragColor.a *= edgeStrength;\n } else {\n gl_FragColor = vec4(0.0);\n }\n}\n");class A0e{setTransparency(t){this.transparencyMode="wboit"===t?this.wboit.supported?"wboit":"blended":"dpoit"===t&&this.dpoit.supported?"dpoit":"blended",this.depthTextureOpaque.detachFramebuffer(this.postprocessing.target.framebuffer,"depth")}get transparency(){return this.transparencyMode}constructor(t,n,r,i,o){this.webgl=t,this.transparencyMode="blended";const{extensions:s,resources:a,isWebGL2:l}=t;this.drawTarget=function UYe(e){return{id:rde(),texture:lc(e),framebuffer:{id:Vue(),bind:()=>{},reset:()=>{},destroy:()=>{}},depthRenderbuffer:null,getWidth:()=>0,getHeight:()=>0,bind:()=>{e.bindFramebuffer(e.FRAMEBUFFER,null)},setSize:()=>{},reset:()=>{},destroy:()=>{}}}(t.gl),this.colorTarget=t.createRenderTarget(r,i,!0,"uint8","linear"),this.packedDepth=!s.depthTexture,this.depthTargetTransparent=t.createRenderTarget(r,i),this.depthTextureTransparent=this.depthTargetTransparent.texture,this.depthTargetOpaque=this.packedDepth?t.createRenderTarget(r,i):null,this.depthTextureOpaque=this.depthTargetOpaque?this.depthTargetOpaque.texture:a.texture("image-depth","depth",l?"float":"ushort","nearest"),this.packedDepth||this.depthTextureOpaque.define(r,i),this.wboit=new Mq(t,r,i),this.dpoit=new Rq(t,r,i),this.marking=new w0e(t,r,i),this.postprocessing=new Zu(t,n,this),this.antialiasing=new Dq(t,this),this.copyFboTarget=Zw(t,this.colorTarget.texture),this.copyFboPostprocessing=Zw(t,this.postprocessing.target.texture),this.setTransparency(o)}reset(){this.wboit.reset(),this.dpoit.reset()}setSize(t,n){const r=this.colorTarget.getWidth(),i=this.colorTarget.getHeight();(t!==r||n!==i)&&(this.colorTarget.setSize(t,n),this.depthTargetTransparent.setSize(t,n),this.depthTargetOpaque?this.depthTargetOpaque.setSize(t,n):this.depthTextureOpaque.define(t,n),O.update(this.copyFboTarget.values.uTexSize,Ue.set(this.copyFboTarget.values.uTexSize.ref.value,t,n)),O.update(this.copyFboPostprocessing.values.uTexSize,Ue.set(this.copyFboPostprocessing.values.uTexSize.ref.value,t,n))),this.wboit.supported&&this.wboit.setSize(t,n),this.dpoit.supported&&this.dpoit.setSize(t,n),this.marking.setSize(t,n),this.postprocessing.setSize(t,n),this.antialiasing.setSize(t,n)}_renderDpoit(t,n,r,i,o,s){if(!this.dpoit.supported)throw new Error("expected dpoit to be supported");if(this.depthTextureOpaque.attachFramebuffer(this.colorTarget.framebuffer,"depth"),t.clear(!0),r.hasOpaque&&t.renderDpoitOpaque(r.primitives,n,null),Zu.isEnabled(s)&&(Zu.isTransparentOutlineEnabled(s)&&(this.depthTargetTransparent.bind(),t.clearDepth(!0),r.opacityAverage<1&&t.renderDepthTransparent(r.primitives,n,this.depthTextureOpaque)),this.postprocessing.render(n,!1,o,t.props.backgroundColor,s,t.light)),this.depthTextureOpaque.detachFramebuffer(this.colorTarget.framebuffer,"depth"),r.opacityAverage<1){const a=Zu.isEnabled(s)?this.postprocessing.target:this.colorTarget,l=this.dpoit.bind();t.renderDpoitTransparent(r.primitives,n,this.depthTextureOpaque,l);for(let c=0;c0&&t.renderDpoitVolume(r.volumes,n,this.depthTextureOpaque)}_renderWboit(t,n,r,i,o){if(!this.wboit.supported)throw new Error("expected wboit to be supported");this.depthTextureOpaque.attachFramebuffer(this.colorTarget.framebuffer,"depth"),t.clear(!0),r.hasOpaque&&t.renderWboitOpaque(r.primitives,n,null),Zu.isEnabled(o)&&(Zu.isTransparentOutlineEnabled(o)&&(this.depthTargetTransparent.bind(),t.clearDepth(!0),r.opacityAverage<1&&t.renderDepthTransparent(r.primitives,n,this.depthTextureOpaque)),this.postprocessing.render(n,!1,i,t.props.backgroundColor,o,t.light)),(r.opacityAverage<1||r.volumes.renderables.length>0)&&(this.wboit.bind(),r.opacityAverage<1&&t.renderWboitTransparent(r.primitives,n,this.depthTextureOpaque),r.volumes.renderables.length>0&&t.renderWboitTransparent(r.volumes,n,this.depthTextureOpaque),Zu.isEnabled(o)?this.postprocessing.target.bind():this.colorTarget.bind(),this.wboit.render())}_renderBlended(t,n,r,i,o,s){var a,l,c,u;if(i?this.drawTarget.bind():this.packedDepth?this.colorTarget.bind():this.depthTextureOpaque.attachFramebuffer(this.colorTarget.framebuffer,"depth"),t.clear(!0),r.hasOpaque&&t.renderBlendedOpaque(r.primitives,n,null),!i&&(this.depthTargetOpaque&&(this.depthTargetOpaque.bind(),t.clearDepth(!0),t.renderDepthOpaque(r.primitives,n,null),this.colorTarget.bind()),Zu.isEnabled(s)&&(this.packedDepth?null===(a=this.colorTarget.depthRenderbuffer)||void 0===a||a.detachFramebuffer(this.postprocessing.target.framebuffer):this.depthTextureOpaque.detachFramebuffer(this.postprocessing.target.framebuffer,"depth"),Zu.isTransparentOutlineEnabled(s)&&(this.depthTargetTransparent.bind(),t.clearDepth(!0),r.opacityAverage<1&&t.renderDepthTransparent(r.primitives,n,this.depthTextureOpaque)),this.postprocessing.render(n,!1,o,t.props.backgroundColor,s,t.light),this.packedDepth?null===(l=this.colorTarget.depthRenderbuffer)||void 0===l||l.attachFramebuffer(this.postprocessing.target.framebuffer):this.depthTextureOpaque.attachFramebuffer(this.postprocessing.target.framebuffer,"depth")),r.volumes.renderables.length>0)){const d=Zu.isEnabled(s)?this.postprocessing.target:this.colorTarget;this.packedDepth?null===(c=this.colorTarget.depthRenderbuffer)||void 0===c||c.detachFramebuffer(d.framebuffer):this.depthTextureOpaque.detachFramebuffer(d.framebuffer,"depth"),d.bind(),t.renderBlendedVolume(r.volumes,n,this.depthTextureOpaque),this.packedDepth?null===(u=this.colorTarget.depthRenderbuffer)||void 0===u||u.attachFramebuffer(d.framebuffer):this.depthTextureOpaque.attachFramebuffer(d.framebuffer,"depth"),d.bind()}r.opacityAverage<1&&t.renderBlendedTransparent(r.primitives,n,null)}_render(t,n,r,i,o,s,a){const l=r.volumes.renderables.length>0,c=Zu.isEnabled(a.postprocessing),u=Dq.isEnabled(a.postprocessing),d=w0e.isEnabled(a.marking),{x:f,y:p,width:m,height:h}=n.viewport;t.setViewport(f,p,m,h),t.update(n,r),s&&!u&&o&&(this.drawTarget.bind(),t.clear(!1));let g=!1;"wboit"===this.transparencyMode&&this.wboit.supported?(this._renderWboit(t,n,r,s,a.postprocessing),g=!0):"dpoit"===this.transparencyMode&&this.dpoit.supported?(this._renderDpoit(t,n,r,a.dpoitIterations,s,a.postprocessing),g=!0):this._renderBlended(t,n,r,!l&&!c&&!u&&o,s,a.postprocessing);const y=c?this.postprocessing.target:!o||l||g?this.colorTarget:this.drawTarget;if(d&&r.markerAverage>0){const v=a.marking.ghostEdgeStrength<1;v&&1!==r.markerAverage&&(this.marking.depthTarget.bind(),t.clear(!1,!0),t.renderMarkingDepth(r.primitives,n,null)),this.marking.maskTarget.bind(),t.clear(!1,!0),t.renderMarkingMask(r.primitives,n,v?this.marking.depthTarget.texture:null),this.marking.update(a.marking),this.marking.render(n.viewport,y)}else y.bind();i.debug.isEnabled&&(i.debug.syncVisibility(),t.renderBlended(i.debug.scene,n)),i.handle.isEnabled&&t.renderBlended(i.handle.scene,n),i.camera.isEnabled&&(i.camera.update(n),t.update(i.camera.camera,i.camera.scene),t.renderBlended(i.camera.scene,i.camera.camera)),u?this.antialiasing.render(n,o,a.postprocessing):o&&(this.drawTarget.bind(),this.webgl.state.disable(this.webgl.gl.DEPTH_TEST),c?this.copyFboPostprocessing.render():(l||g)&&this.copyFboTarget.render()),this.webgl.gl.flush()}render(t,n,r){It&&this.webgl.timer.mark("DrawPass.render");const{renderer:i,camera:o,scene:s,helper:a}=t;this.postprocessing.setTransparentBackground(n.transparentBackground);const l=n.transparentBackground||this.postprocessing.background.isEnabled(n.postprocessing.background);i.setTransparentBackground(l),i.setDrawingBufferSize(this.colorTarget.getWidth(),this.colorTarget.getHeight()),i.setPixelRatio(this.webgl.pixelRatio),CA.is(o)?(It&&this.webgl.timer.mark("StereoCamera.left"),this._render(i,o.left,s,a,r,l,n),It&&this.webgl.timer.markEnd("StereoCamera.left"),It&&this.webgl.timer.mark("StereoCamera.right"),this._render(i,o.right,s,a,r,l,n),It&&this.webgl.timer.markEnd("StereoCamera.right")):this._render(i,o,s,a,r,l,n),It&&this.webgl.timer.markEnd("DrawPass.render")}getColorTarget(t){return Dq.isEnabled(t)?this.antialiasing.target:Zu.isEnabled(t)?this.postprocessing.target:this.colorTarget}}const Ydt={alpha:I.Numeric(.51,{min:0,max:1,step:.01},{isEssential:!0,label:"Opacity"}),colorX:I.Color(qn.red,{isEssential:!0}),colorY:I.Color(qn.green,{isEssential:!0}),colorZ:I.Color(qn.blue,{isEssential:!0}),scale:I.Numeric(.33,{min:.1,max:2,step:.1},{isEssential:!0}),location:I.Select("bottom-left",I.arrayToOptions(["bottom-left","bottom-right","top-left","top-right"])),locationOffsetX:I.Numeric(0),locationOffsetY:I.Numeric(0),originColor:I.Color(qn.grey),radiusScale:I.Numeric(.075,{min:.01,max:.3,step:.001}),showPlanes:I.Boolean(!0),planeColorXY:I.Color(qn.grey,{label:"Plane Color XY"}),planeColorXZ:I.Color(qn.grey,{label:"Plane Color XZ"}),planeColorYZ:I.Color(qn.grey,{label:"Plane Color YZ"}),showLabels:I.Boolean(!1),labelX:I.Text("X"),labelY:I.Text("Y"),labelZ:I.Text("Z"),labelColorX:I.Color(qn.grey),labelColorY:I.Color(qn.grey),labelColorZ:I.Color(qn.grey),labelOpacity:I.Numeric(1,{min:0,max:1,step:.01}),labelScale:I.Numeric(.25,{min:.1,max:1,step:.01})},kF={axes:I.MappedStatic("on",{on:I.Group(Ydt),off:I.Group({})},{cycle:!0,description:"Show camera orientation axes"})};class I0e{constructor(t,n={}){this.webgl=t,this.props={axes:{name:"off",params:{}}},this.pixelRatio=1,this.eachGroup=(r,i)=>{if(!Nq(r))return!1;let o=!1;if(this.meshRenderObject){const s=this.meshRenderObject.values.uGroupCount.ref.value;for(const{groupId:a,instanceId:l}of r.elements)i(Pe.ofSingleton(l*s+a))&&(o=!0)}if(this.textRenderObject){const s=this.textRenderObject.values.uGroupCount.ref.value;for(const{groupId:a,instanceId:l}of r.elements)i(Pe.ofSingleton(l*s+a))&&(o=!0)}return o},this.scene=_A.create(t,"blended"),this.camera=new Si,C.set(this.camera.up,0,1,0),C.set(this.camera.target,0,0,0),this.setProps(n)}setProps(t){this.props=fy(this.props,n=>{if(void 0!==t.axes&&(n.axes.name=t.axes.name,"on"===t.axes.name)){this.scene.clear(),this.pixelRatio=this.webgl.pixelRatio;const r={...t.axes.params,scale:t.axes.params.scale*this.pixelRatio,labelScale:t.axes.params.labelScale*this.pixelRatio};this.meshRenderObject=function eft(e){const t=function Jdt(e,t){const n=100*e.scale,r=function Qdt(e,t){const n=Ct.createState(512,256,t),r=100*e.scale,i=e.radiusScale*r,o=e.showLabels?100*e.labelScale/3:0,s=C.scale(C(),C.unitX,r-o),a=C.scale(C(),C.unitY,r-o),l=C.scale(C(),C.unitZ,r-o),c={radiusTop:i,radiusBottom:i,radialSegments:32};if(n.currentGroup=Ei.Origin,Jr(n,C.origin,i,2),n.currentGroup=Ei.X,Jr(n,s,i,2),Ur(n,C.origin,s,1,c),n.currentGroup=Ei.Y,Jr(n,a,i,2),Ur(n,C.origin,a,1,c),n.currentGroup=Ei.Z,Jr(n,l,i,2),Ur(n,C.origin,l,1,c),e.showPlanes){C.scale(s,s,.5),C.scale(a,a,.5),C.scale(l,l,.5),n.currentGroup=Ei.XY,Ct.addTriangle(n,C.origin,s,a),Ct.addTriangle(n,C.origin,a,s);const u=C.add(C(),s,a);Ct.addTriangle(n,u,s,a),Ct.addTriangle(n,u,a,s),n.currentGroup=Ei.XZ,Ct.addTriangle(n,C.origin,s,l),Ct.addTriangle(n,C.origin,l,s);const d=C.add(C(),s,l);Ct.addTriangle(n,d,s,l),Ct.addTriangle(n,d,l,s),n.currentGroup=Ei.YZ,Ct.addTriangle(n,C.origin,a,l),Ct.addTriangle(n,C.origin,l,a);const f=C.add(C(),a,l);Ct.addTriangle(n,f,a,l),Ct.addTriangle(n,f,l,a)}return Ct.getMesh(n)}(e,t?.geometry);r.setBoundingSphere(ke.create(C.create(n/2,n/2,n/2),n+n/4));return zr.create("axes-mesh",{},r,o=>{switch(o){case Ei.X:return e.colorX;case Ei.Y:return e.colorY;case Ei.Z:return e.colorZ;case Ei.XY:return e.planeColorXY;case Ei.XZ:return e.planeColorXZ;case Ei.YZ:return e.planeColorYZ;case Ei.Origin:return e.originColor;default:return qn.grey}},()=>1,()=>"")}(e);return zr.createRenderObject(t,{...I.getDefaultValues(on.Params),...e,ignoreLight:!0,cellSize:0})}(r),this.scene.add(this.meshRenderObject),t.axes.params.showLabels?(this.textRenderObject=function rft(e){const t=function nft(e,t){const n=100*e.scale,r=function tft(e,t){const n=Ig.create(e,8,8,t),r=100*e.scale,i=C.scale(C(),C.unitX,r),o=C.scale(C(),C.unitY,r),s=C.scale(C(),C.unitZ,r),a=100*e.labelScale;return n.add(e.labelX,i[0],i[1],i[2],0,a,Ei.X),n.add(e.labelY,o[0],o[1],o[2],0,a,Ei.Y),n.add(e.labelZ,s[0],s[1],s[2],0,a,Ei.Z),n.getText()}(e,t?.geometry);r.setBoundingSphere(ke.create(C.create(n/2,n/2,n/2),n));return zr.create("axes-text",{},r,o=>{switch(o){case Ei.X:return e.labelColorX;case Ei.Y:return e.labelColorY;case Ei.Z:return e.labelColorZ;default:return qn.grey}},()=>1,()=>"")}(e);return zr.createRenderObject(t,{...I.getDefaultValues(Tf.Params),...e,alpha:e.labelOpacity,cellSize:0})}(r),this.scene.add(this.textRenderObject)):this.textRenderObject=void 0,this.scene.commit(),C.set(this.camera.position,0,0,200*r.scale),fe.lookAt(this.camera.view,this.camera.position,this.camera.target,this.camera.up),n.axes.params={...t.axes.params}}})}get isEnabled(){return"on"===this.props.axes.name}getLoci(t){const{objectId:n,groupId:r,instanceId:i}=t;return(this.meshRenderObject&&n===this.meshRenderObject.id||this.textRenderObject&&n===this.textRenderObject.id)&&r!==Ei.None?function Kdt(e,t,n){return ZN("camera-axes",e,[{groupId:t,instanceId:n}],void 0,()=>function Xdt(e,t){const n=t.props.axes,r="on"===n.name?n.params.labelX:"X",i="on"===n.name?n.params.labelY:"Y",o="on"===n.name?n.params.labelZ:"Z";switch(e){case Ei.X:return`${r} Axis`;case Ei.Y:return`${i} Axis`;case Ei.Z:return`${o} Axis`;case Ei.XY:return`${r}${i} Plane`;case Ei.XZ:return`${r}${o} Plane`;case Ei.YZ:return`${i}${o} Plane`;case Ei.Origin:return"Origin";default:return"Axes"}}(t,e))}(this,r,i):qr}mark(t,n){return!(!uc.is(uc.Highlighting,n)||!(Xu(t)||Nq(t)&&t.data===this))&&(pr.mark(this.meshRenderObject,t,n,this.eachGroup)||pr.mark(this.textRenderObject,t,n,this.eachGroup))}update(t){if(!this.meshRenderObject||"off"===this.props.axes.name)return;this.pixelRatio!==this.webgl.pixelRatio&&this.setProps(this.props),function Zdt(e,t,n){const{near:r,far:i}=e,o=-t.width/2,s=t.width/2,a=t.height/2,l=-t.height/2,c=(s-o)/2,u=(a-l)/2,d=(s+o)/2,f=(a+l)/2;let p=d-c,m=d+c,h=f+u,g=f-u;if(n.enabled){const y=(s-o)/n.width,v=(a-l)/n.height;p+=y*n.offsetX,m=p+y*n.width,h-=v*n.offsetY,g=h-v*n.height}fe.ortho(e.projection,p,m,h,g,r,i)}(this.camera,t.viewport,t.viewOffset),fe.extractRotation(this.scene.view,t.view);const n=this.textRenderObject?this.textRenderObject.values.boundingSphere.ref.value.radius:this.meshRenderObject.values.boundingSphere.ref.value.radius,r=this.props.axes.params.location,i=this.props.axes.params.locationOffsetX*this.pixelRatio,o=this.props.axes.params.locationOffsetY*this.pixelRatio;"bottom-left"===r?fe.setTranslation(this.scene.view,C.create(-t.viewport.width/2+n+i,-t.viewport.height/2+n+o,0)):"bottom-right"===r?fe.setTranslation(this.scene.view,C.create(t.viewport.width/2-n-i,-t.viewport.height/2+n+o,0)):"top-left"===r?fe.setTranslation(this.scene.view,C.create(-t.viewport.width/2+n+i,t.viewport.height/2-n-o,0)):"top-right"===r?fe.setTranslation(this.scene.view,C.create(t.viewport.width/2-n-i,t.viewport.height/2-n-o,0)):Hi()}}var Ei=function(e){return e[e.None=0]="None",e[e.X=1]="X",e[e.Y=2]="Y",e[e.Z=3]="Z",e[e.XY=4]="XY",e[e.XZ=5]="XZ",e[e.YZ=6]="YZ",e[e.Origin=7]="Origin",e}(Ei||{});function Nq(e){return"data-loci"===e.kind&&"camera-axes"===e.tag}const ift={transparentBackground:I.Boolean(!1),dpoitIterations:I.Numeric(2,{min:1,max:10,step:1}),multiSample:I.Group(y0e),postprocessing:I.Group(Tq),marking:I.Group(C0e),cameraHelper:I.Group(kF)};class oft{get colorTarget(){return this._colorTarget}get width(){return this._width}get height(){return this._height}constructor(t,n,r,i,o,s,a,l){this.webgl=t,this.renderer=r,this.scene=i,this.camera=o,this._width=0,this._height=0,this._camera=new Si,this.props={...I.getDefaultValues(ift),...l},this.drawPass=new A0e(t,n,128,128,a),this.multiSamplePass=new PF(t,this.drawPass),this.multiSampleHelper=new b0e(this.multiSamplePass),this.helper={camera:new I0e(t,this.props.cameraHelper),debug:s.debug,handle:s.handle},this.setSize(1024,768)}updateBackground(){return new Promise(t=>{this.drawPass.postprocessing.background.update(this.camera,this.props.postprocessing.background,()=>{t()})})}setSize(t,n){t===this._width&&n===this._height||(this._width=t,this._height=n,this.drawPass.setSize(t,n),this.multiSamplePass.syncSize())}setProps(t={}){Object.assign(this.props,t),t.cameraHelper&&this.helper.camera.setProps(t.cameraHelper)}render(){Si.copySnapshot(this._camera.state,this.camera.state),Da.set(this._camera.viewport,0,0,this._width,this._height),this._camera.update();const t={renderer:this.renderer,camera:this._camera,scene:this.scene,helper:this.helper};PF.isEnabled(this.props.multiSample)?(this.multiSampleHelper.render(t,this.props,!1),this._colorTarget=this.multiSamplePass.colorTarget):(this.drawPass.render(t,this.props,!1),this._colorTarget=this.drawPass.getColorTarget(this.props.postprocessing))}getImageData(t,n,r){var i,o;this.setSize(t,n),this.render(),this.colorTarget.bind();const s=null!==(i=r?.width)&&void 0!==i?i:t,a=null!==(o=r?.height)&&void 0!==o?o:n,l=new Uint8Array(s*a*4);r?this.webgl.readPixels(r.x,n-r.y-r.height,s,a,l):this.webgl.readPixels(0,0,s,a,l);const c=A_.create(l,s,a);return A_.flipY(c),A_.divideByAlpha(c),new ImageData(new Uint8ClampedArray(l),s,a)}}const sft={...on.Params,alpha:{...on.Params.alpha,defaultValue:1},ignoreLight:{...on.Params.ignoreLight,defaultValue:!0},colorX:I.Color(qn.red,{isEssential:!0}),colorY:I.Color(qn.green,{isEssential:!0}),colorZ:I.Color(qn.blue,{isEssential:!0}),scale:I.Numeric(.33,{min:.1,max:2,step:.1},{isEssential:!0})},E0e={handle:I.MappedStatic("off",{on:I.Group(sft),off:I.Group({})},{cycle:!0,description:"Show handle tool"})};class aft{getBoundingSphere(t,n){return this.renderObject&&(ke.copy(t,this.renderObject.values.invariantBoundingSphere.ref.value),fe.fromArray(this._transform,this.renderObject.values.aTransform.ref.value,16*n),ke.transform(t,t,this._transform)),t}setProps(t){this.props=fy(this.props,n=>{if(void 0!==t.handle&&(n.handle.name=t.handle.name,"on"===t.handle.name)){this.scene.clear(),this.pixelRatio=this.webgl.pixelRatio;const r={...t.handle.params,scale:t.handle.params.scale*this.webgl.pixelRatio,cellSize:0};this.renderObject=function dft(e){const t=function uft(e,t){const n=10*e.scale,r=function lft(e,t){const n=Ct.createState(512,256,t),r=.05*e,i=C.scale(C(),C.unitX,e),o=C.scale(C(),C.unitY,e),s=C.scale(C(),C.unitZ,e),a={radiusTop:r,radiusBottom:r,radialSegments:32};return n.currentGroup=X_.TranslateScreenXY,Jr(n,C.origin,3*r,2),n.currentGroup=X_.TranslateObjectX,Jr(n,i,r,2),Ur(n,C.origin,i,1,a),n.currentGroup=X_.TranslateObjectY,Jr(n,o,r,2),Ur(n,C.origin,o,1,a),n.currentGroup=X_.TranslateObjectZ,Jr(n,s,r,2),Ur(n,C.origin,s,1,a),Ct.getMesh(n)}(n,t?.geometry);r.setBoundingSphere(ke.create(C.create(n/2,n/2,n/2),n+n/4));return zr.create("handle",{},r,o=>{switch(o){case X_.TranslateObjectX:return e.colorX;case X_.TranslateObjectY:return e.colorY;case X_.TranslateObjectZ:return e.colorZ;default:return qn.grey}},()=>1,()=>"")}(e);return zr.createRenderObject(t,e)}(r),this.scene.add(this.renderObject),this.scene.commit(),n.handle.params={...t.handle.params}}})}get isEnabled(){return"on"===this.props.handle.name}update(t,n,r){this.renderObject&&(this.pixelRatio!==this.webgl.pixelRatio&&this.setProps(this.props),fe.setTranslation(this.renderObject.values.aTransform.ref.value,n),fe.fromMat3(this.renderObject.values.aTransform.ref.value,r),O.update(this.renderObject.values.aTransform,this.renderObject.values.aTransform.ref.value),this.scene.update([this.renderObject],!0))}getLoci(t){const{objectId:n,groupId:r,instanceId:i}=t;return this.renderObject&&n===this.renderObject.id?function cft(e,t,n){return ZN("handle",e,[{groupId:t,instanceId:n}],r=>e.getBoundingSphere(r,n),()=>`Handle Helper | Group Id ${t} | Instance Id ${n}`)}(this,r,i):qr}mark(t,n){return!(!uc.is(uc.Highlighting,n)||!(Xu(t)||T0e(t)&&t.data===this))&&pr.mark(this.renderObject,t,n,this.eachGroup)}constructor(t,n={}){this.webgl=t,this.props={handle:{name:"off",params:{}}},this.pixelRatio=1,this._transform=fe(),this.eachGroup=(r,i)=>{if(!this.renderObject||!T0e(r))return!1;let o=!1;const s=this.renderObject.values.uGroupCount.ref.value,{elements:a}=r;for(const{groupId:l,instanceId:c}of a)i(Pe.ofSingleton(c*s+l))&&(o=!0);return o},this.scene=_A.create(t,"blended"),this.setProps(n)}}const X_={None:0,TranslateScreenXY:1,TranslateObjectX:3,TranslateObjectY:4,TranslateObjectZ:5};function T0e(e){return"data-loci"===e.kind&&"handle"===e.tag}const fft={debug:I.Group(Aq),camera:I.Group({helper:I.Group(kF)}),handle:I.Group(E0e)},pft=I.getDefaultValues(fft);class hft{constructor(t,n,r={}){const i={...pft,...r};this.debug=new rut(t,n,i.debug),this.camera=new I0e(t,i.camera.helper),this.handle=new aft(t,i.handle)}}class mft{constructor(t,n,r={}){this.webgl=t;const{gl:i}=t;this.draw=new A0e(t,n,i.drawingBufferWidth,i.drawingBufferHeight,r.transparency||"blended"),this.pick=new Idt(t,this.draw,r.pickScale||.25),this.multiSample=new PF(t,this.draw)}setPickScale(t){this.pick.setPickScale(t)}setTransparency(t){this.draw.setTransparency(t)}updateSize(){const{gl:t}=this.webgl,n=Math.max(t.drawingBufferWidth,2),r=Math.max(t.drawingBufferHeight,2);this.draw.setSize(n,r),this.pick.syncSize(),this.multiSample.syncSize()}}const yft={...ca,tPreviousLevel:xn("texture","alpha","float","nearest"),uInvSize:Ne("v2"),uOffset:Ne("v2")},bft=Wi("hi-z",hl,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform sampler2D tPreviousLevel;\nuniform vec2 uInvSize;\nuniform vec2 uOffset;\n\nvoid main(void) {\n vec2 position = gl_FragCoord.xy * uInvSize + uOffset;\n\n float x = texture(tPreviousLevel, position).r;\n float y = textureOffset(tPreviousLevel, position, ivec2(-1, 0)).r;\n float z = textureOffset(tPreviousLevel, position, ivec2(-1, -1)).r;\n float w = textureOffset(tPreviousLevel, position, ivec2(0, -1)).r;\n\n gl_FragColor = vec4(max(max(x, y), max(z, w)));\n}\n"),D0e=new ArrayBuffer(4);new Int32Array(D0e),new Float32Array(D0e);const P0e=new ArrayBuffer(4),Cft=new Int32Array(P0e),wft=new Float32Array(P0e);function wA(e){return function Aft(e){return Cft[0]=(1<<23)*((e<-126?-126:e)+126.94269504),wft[0]}(1.44269504*e)}const k0e=new ArrayBuffer(8);new Int32Array(k0e),new Float32Array(k0e);const R0e=new ArrayBuffer(4),Ift=new Int32Array(R0e),Eft=new Float32Array(R0e);Math,Math,Math,Math,Math,Math,Math,Math,Math;const O0e=new ArrayBuffer(16);new Int32Array(O0e),new Float32Array(O0e);const B0e=new ArrayBuffer(8);new Int32Array(B0e),new Float32Array(B0e);const j0e=new ArrayBuffer(4);new Int32Array(j0e),new Float32Array(j0e),Math;const Uft=C.transformMat4,z0e=Bn.set,zft=function Bq(e){return Eft[0]=e,1.1920928955078125e-7*Ift[0]-126.94269504};function FF(e,t,n,r){return-1===r[11]?function Vft(e,t,n){return t*n/((n-t)*e-n)}(e,t,n):function Hft(e,t,n){return e*(t-n)-t}(e,t,n)}const V0e={enabled:I.Boolean(!1,{description:"Hierarchical Z-buffer occlusion culling. Only available for WebGL2."}),maxFrameLag:I.Numeric(10,{min:1,max:30,step:1},{description:"Maximum number of frames to wait for Z-buffer data."}),minLevel:I.Numeric(3,{min:1,max:10,step:1})};class $ft{clear(){if(!this.supported)return;const{gl:t}=this.webgl;Cn(t)&&(null!==this.sync&&(t.deleteSync(this.sync),this.sync=null),this.frameLag=0,this.ready=!1,this.debug&&(this.debug.rect.style.display="none",this.debug.container.style.display="none"))}render(t){if(!this.supported||!this.props.enabled)return;const{gl:n,state:r}=this.webgl;if(!Cn(n)||null!==this.sync)return;this.nextNear=t.near,this.nextFar=t.far,fe.copy(this.nextView,t.view),fe.copy(this.nextProjection,t.projection),It&&this.webgl.timer.mark("hi-Z"),r.disable(n.CULL_FACE),r.disable(n.BLEND),r.disable(n.DEPTH_TEST),r.disable(n.SCISSOR_TEST),r.depthMask(!1),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0);const i=this.renderable.values,o=Math.pow(2,Math.ceil(Math.log(Math.max(n.drawingBufferWidth,n.drawingBufferHeight))/Math.log(2))-1);for(let l=0,c=this.levelData.length;l0?(O.update(i.uInvSize,u.invSize),O.update(i.uOffset,Ue.set(i.uOffset.ref.value,0,0)),O.update(i.tPreviousLevel,this.levelData[l-1].texture)):(O.update(i.uInvSize,Ue.set(i.uInvSize.ref.value,1/o,1/o)),O.update(i.uOffset,Ue.set(i.uOffset.ref.value,this.viewport.x/n.drawingBufferWidth,this.viewport.y/n.drawingBufferHeight)),O.update(i.tPreviousLevel,this.drawPass.depthTextureOpaque)),r.currentRenderItemId=-1,r.viewport(0,0,u.size[0],u.size[1]),n.clear(n.COLOR_BUFFER_BIT),this.renderable.update(),this.renderable.render(),l>=this.props.minLevel&&(this.tex.bind(0),n.copyTexSubImage2D(n.TEXTURE_2D,0,u.offset,0,0,0,u.size[0],u.size[1]),this.tex.unbind(0))}this.tex.attachFramebuffer(this.fb,0);const s=this.tex.getWidth(),a=this.tex.getHeight();n.bindBuffer(n.PIXEL_PACK_BUFFER,this.buf),n.bufferData(n.PIXEL_PACK_BUFFER,this.buffer.byteLength,n.STREAM_READ),n.readPixels(0,0,s,a,n.RED,n.FLOAT,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null),this.sync=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0),n.flush(),It&&this.webgl.timer.markEnd("hi-Z")}tick(){if(!this.supported||!this.props.enabled||null===this.sync)return;const{gl:t}=this.webgl;if(!Cn(t))return;const n=t.clientWaitSync(this.sync,0,0);n===t.WAIT_FAILED||this.frameLag>=this.props.maxFrameLag?(t.deleteSync(this.sync),this.sync=null,this.frameLag=0,this.ready=!1):n===t.TIMEOUT_EXPIRED?this.frameLag+=1:(t.bindBuffer(t.PIXEL_PACK_BUFFER,this.buf),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this.buffer),t.bindBuffer(t.PIXEL_PACK_BUFFER,null),t.deleteSync(this.sync),this.sync=null,this.frameLag=0,this.ready=!0,this.near=this.nextNear,this.far=this.nextFar,fe.copy(this.view,this.nextView),fe.copy(this.projection,this.nextProjection))}transform(t){const{view:n,vp:r}=this;return Uft(r,t.center,n),{vp:r,r:1.2*t.radius+1.52}}project(t,n){const{projection:r,aabb:i,viewport:o}=this;!function Wft(e,t,n,r){return-1===r[11]?function Gft(e,t,n,r){const i=t[0]*n,o=t[1]*n,s=t[2]*n,a=t[2]*t[2]-n*n,l=Math.sqrt(t[0]*t[0]+a),c=(l*t[0]-s)/(l*t[2]+i)*r[0],u=(l*t[0]+s)/(l*t[2]-i)*r[0],d=Math.sqrt(t[1]*t[1]+a);return z0e(e,-.5*u+.5,(d*t[1]-s)/(d*t[2]+o)*r[5]*.5+.5,-.5*c+.5,(d*t[1]+s)/(d*t[2]-o)*r[5]*.5+.5)}(e,t,n,r):function qft(e,t,n,r){const i=r[0],o=r[5];return z0e(e,(t[0]-n)*i*.5+.5,(t[1]+n)*o*-.5+.5,(t[0]+n)*i*.5+.5,(t[1]-n)*o*-.5+.5)}(e,t,n,r)}(i,t,n,r);const s=i[2]-i[0],a=i[3]-i[1],l=Math.max(s*o.width,a*o.height);return{aabb:i,w:s,h:a,pr:l,lod:Math.ceil(zft(l/2))}}setViewport(t,n,r,i){if(!this.supported)return;r=Math.max(r,2),i=Math.max(i,2),Da.set(this.viewport,t,n,r,i);const o=Math.ceil(Math.log(Math.max(r,i))/Math.log(2));if(o===this.levelData.length)return;const{minLevel:s}=this.props;this.buffer=new Float32Array(Math.pow(2,o-s)*Math.pow(2,o-1-s)),this.tex.define(Math.pow(2,o-s),Math.pow(2,o-1-s));for(const l of this.levelData)l.framebuffer.destroy(),l.texture.destroy();this.levelData.length=0;for(let l=0;l=s&&(this.levelData[l].offset=a,a+=u.size[0])}this.clear()}setProps(t){if(this.supported)if(this.props.minLevel!==t.minLevel){Object.assign(this.props,t);const{x:n,y:r,width:i,height:o}=this.viewport;this.setViewport(n,r,i,o)}else Object.assign(this.props,t),this.props.enabled||this.clear()}initDebug(t){if(!t.parentElement)return;const n=document.createElement("div");Object.assign(n.style,{display:"block",position:"absolute",pointerEvents:"none"}),t.parentElement.appendChild(n);const r=document.createElement("canvas"),i=r.getContext("2d");if(!i)throw new Error("Could not create canvas 2d context");Object.assign(r.style,{width:"100%",height:"100%",imageRendering:"pixelated",position:"relative",pointerEvents:"none"}),n.appendChild(r);const o=document.createElement("div");Object.assign(o.style,{display:"none",position:"absolute",pointerEvents:"none"}),t.parentElement.appendChild(o),this.debug={container:n,canvas:r,ctx:i,rect:o}}canDebug(t){return this.supported&&this.props.enabled&&this.ready&&!!this.debug}showRect(t,n){if(!this.canDebug(this.debug))return;const{gl:{drawingBufferHeight:r},pixelRatio:i}=this.webgl,{viewport:{x:o,y:s,width:a,height:l}}=this,c=(t[0]*a+o)/i,u=(t[1]*l-s)/i;Object.assign(this.debug.rect.style,{border:n?"solid red":"solid green",display:"block",left:`${c}px`,top:`${u+(r-l)/i}px`,width:(t[2]*a+o)/i-c+"px",height:(t[3]*l-s)/i-u+"px"})}showBuffer(t){if(!this.canDebug(this.debug))return;if(t>=this.levelData.length||t{if(!this.supported||!this.props.enabled||!this.ready)return!1;const{vp:u,r:d}=this.transform(c),{near:f,far:p,projection:m}=this,h=u[2]+d;if(-h=this.levelData.length||x=E||R+1>=E)return!1;const j=(E-R-1)*N+F+_;if(h>FF(this.buffer[j],f,p,m)||h>FF(this.buffer[j+1],f,p,m))return!1;const W=(E-R+1-1)*N+F+_;return!(h>FF(this.buffer[W],f,p,m)||h>FF(this.buffer[W+1],f,p,m))};const{gl:o,extensions:s}=t;if(!Cn(o)||!s.colorBufferFloat)return $n&&console.log('Missing webgl2 and/or colorBufferFloat support required for "Hi-Z"'),void(this.supported=!1);this.fb=t.resources.framebuffer(),this.tex=t.resources.texture("image-float32","alpha","float","nearest"),this.tex.attachFramebuffer(this.fb,0);const a=o.getParameter(o.IMPLEMENTATION_COLOR_READ_FORMAT),l=o.getParameter(o.IMPLEMENTATION_COLOR_READ_TYPE);if(a!==o.RED||l!==o.FLOAT)return $n&&console.log('Missing red/float reading support required for "Hi-Z"'),void(this.supported=!1);this.supported=!0,this.props={...I.getDefaultValues(V0e),...i},this.buf=x9(o),this.renderable=function vft(e,t){const n={...ua,tPreviousLevel:O.create(t),uInvSize:O.create(Ue()),uOffset:O.create(Ue())},r={...yft};return ys(ms(e,"triangles",bft,r,n),n)}(t,this.drawPass.depthTextureOpaque),$n&&r&&this.initDebug(r)}}const Fd={camera:I.Group({mode:I.Select("perspective",I.arrayToOptions(["perspective","orthographic"]),{label:"Camera"}),helper:I.Group(kF,{isFlat:!0}),stereo:I.MappedStatic("off",{on:I.Group(v0e),off:I.Group({})},{cycle:!0,hideIf:e=>"perspective"!==e?.mode}),fov:I.Numeric(45,{min:10,max:130,step:1},{label:"Field of View"}),manualReset:I.Boolean(!1,{isHidden:!0})},{pivot:"mode"}),cameraFog:I.MappedStatic("on",{on:I.Group({intensity:I.Numeric(15,{min:1,max:100,step:1})}),off:I.Group({})},{cycle:!0,description:"Show fog in the distance"}),cameraClipping:I.Group({radius:I.Numeric(100,{min:0,max:99,step:1},{label:"Clipping",description:"How much of the scene to show."}),far:I.Boolean(!0,{description:"Hide scene in the distance"}),minNear:I.Numeric(5,{min:.1,max:100,step:.1},{description:"Note, may cause performance issues rendering impostors when set too small and cause issues with outline rendering when too close to 0."})},{pivot:"radius"}),viewport:I.MappedStatic("canvas",{canvas:I.Group({}),"static-frame":I.Group({x:I.Numeric(0),y:I.Numeric(0),width:I.Numeric(128),height:I.Numeric(128)}),"relative-frame":I.Group({x:I.Numeric(.33,{min:0,max:1,step:.01}),y:I.Numeric(.33,{min:0,max:1,step:.01}),width:I.Numeric(.5,{min:.01,max:1,step:.01}),height:I.Numeric(.5,{min:.01,max:1,step:.01})})}),cameraResetDurationMs:I.Numeric(250,{min:0,max:1e3,step:1},{description:"The time it takes to reset the camera."}),sceneRadiusFactor:I.Numeric(1,{min:1,max:10,step:.1}),transparentBackground:I.Boolean(!1),dpoitIterations:I.Numeric(2,{min:1,max:10,step:1}),pickPadding:I.Numeric(3,{min:0,max:10,step:1},{description:"extra pixels to around target to check in case target is empty"}),multiSample:I.Group(y0e),postprocessing:I.Group(Tq),marking:I.Group(C0e),hiZ:I.Group(V0e),renderer:I.Group(_q),trackball:I.Group(r0e),interaction:I.Group(l0e),debug:I.Group(Aq),handle:I.Group(E0e)},Uq=I.getDefaultValues(Fd);var K_;!function(e){e.DefaultAttribs={powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,antialias:!0,preserveDrawingBuffer:!0,preferWebGl1:!1,handleResize:()=>{}},e.Params={pixelScale:I.Numeric(1,{min:.1,max:2,step:.05}),pickScale:I.Numeric(.25,{min:.1,max:1,step:.05}),transparency:I.Select("wboit",[["blended","Blended"],["wboit","Weighted, Blended"],["dpoit","Depth Peeling"]])},e.DefaultProps=I.getDefaultValues(e.Params),e.fromCanvas=function t(n,r,i={},o={}){const s={...e.DefaultAttribs,...i},a={...e.DefaultProps,...o},{powerPreference:l,failIfMajorPerformanceCaveat:c,antialias:u,preserveDrawingBuffer:d,preferWebGl1:f}=s,p=function WYe(e,t){function n(i){try{return e.getContext(i,t)}catch{return null}}const r=(t?.preferWebGl1?null:n("webgl2"))||n("webgl")||n("experimental-webgl");return $n&&console.log(`isWebgl2: ${Cn(r)}`),r}(n,{powerPreference:l,failIfMajorPerformanceCaveat:c,antialias:u,preserveDrawingBuffer:d,alpha:!0,depth:!0,premultipliedAlpha:!0,preferWebGl1:f});if(null===p)throw new Error("Could not create a WebGL rendering context");const{pixelScale:m,pickScale:h,transparency:g}=a,y=xq.fromElement(n,{pixelScale:m,preventGestures:!0}),v=function ZYe(e,t={}){const n=Gue(e),r=function PWe(e,t){let n={},r=e.getParameter(e.FRONT_FACE),i=e.getParameter(e.CULL_FACE_MODE),o=e.getParameter(e.DEPTH_WRITEMASK),s=e.getParameter(e.DEPTH_CLEAR_VALUE),a=e.getParameter(e.DEPTH_FUNC),l=e.getParameter(e.COLOR_WRITEMASK),c=e.getParameter(e.COLOR_CLEAR_VALUE),u=e.getParameter(e.BLEND_SRC_RGB),d=e.getParameter(e.BLEND_DST_RGB),f=e.getParameter(e.BLEND_SRC_ALPHA),p=e.getParameter(e.BLEND_DST_ALPHA),m=e.getParameter(e.BLEND_COLOR),h=e.getParameter(e.BLEND_EQUATION_RGB),g=e.getParameter(e.BLEND_EQUATION_ALPHA),y=e.getParameter(e.STENCIL_FUNC),v=e.getParameter(e.STENCIL_VALUE_MASK),x=e.getParameter(e.STENCIL_REF),_=e.getParameter(e.STENCIL_BACK_FUNC),w=e.getParameter(e.STENCIL_BACK_VALUE_MASK),A=e.getParameter(e.STENCIL_BACK_REF),M=e.getParameter(e.STENCIL_WRITEMASK),E=e.getParameter(e.STENCIL_BACK_WRITEMASK),D=e.getParameter(e.STENCIL_FAIL),T=e.getParameter(e.STENCIL_PASS_DEPTH_PASS),F=e.getParameter(e.STENCIL_PASS_DEPTH_FAIL),R=e.getParameter(e.STENCIL_BACK_FAIL),N=e.getParameter(e.STENCIL_BACK_PASS_DEPTH_PASS),j=e.getParameter(e.STENCIL_BACK_PASS_DEPTH_FAIL),W=e.getParameter(e.MAX_VERTEX_ATTRIBS);const z=[];let $=e.getParameter(e.VIEWPORT),V=e.getParameter(e.SCISSOR_BOX),X=t.clipControl?e.getParameter(t.clipControl.CLIP_ORIGIN):-1,H=t.clipControl?e.getParameter(t.clipControl.CLIP_DEPTH_MODE):-1;const oe=()=>{for(let te=0;te{!0!==n[te]&&(e.enable(te),n[te]=!0)},disable:te=>{!1!==n[te]&&(e.disable(te),n[te]=!1)},frontFace:te=>{te!==r&&(e.frontFace(te),r=te)},cullFace:te=>{te!==i&&(e.cullFace(te),i=te)},depthMask:te=>{te!==o&&(e.depthMask(te),o=te)},clearDepth:te=>{te!==s&&(e.clearDepth(te),s=te)},depthFunc:te=>{te!==a&&(e.depthFunc(te),a=te)},colorMask:(te,K,Q,G)=>{(te!==l[0]||K!==l[1]||Q!==l[2]||G!==l[3])&&(e.colorMask(te,K,Q,G),l[0]=te,l[1]=K,l[2]=Q,l[3]=G)},clearColor:(te,K,Q,G)=>{(te!==c[0]||K!==c[1]||Q!==c[2]||G!==c[3])&&(e.clearColor(te,K,Q,G),c[0]=te,c[1]=K,c[2]=Q,c[3]=G)},blendFunc:(te,K)=>{(te!==u||K!==d||te!==f||K!==p)&&(e.blendFunc(te,K),u=te,d=K,f=te,p=K)},blendFuncSeparate:(te,K,Q,G)=>{(te!==u||K!==d||Q!==f||G!==p)&&(e.blendFuncSeparate(te,K,Q,G),u=te,d=K,f=Q,p=G)},blendEquation:te=>{(te!==h||te!==g)&&(e.blendEquation(te),h=te,g=te)},blendEquationSeparate:(te,K)=>{(te!==h||K!==g)&&(e.blendEquationSeparate(te,K),h=te,g=K)},blendColor:(te,K,Q,G)=>{(te!==m[0]||K!==m[1]||Q!==m[2]||G!==m[3])&&(e.blendColor(te,K,Q,G),m[0]=te,m[1]=K,m[2]=Q,m[3]=G)},stencilFunc:(te,K,Q)=>{(te!==y||K!==x||Q!==v||te!==_||K!==A||Q!==w)&&(e.stencilFunc(te,K,Q),y=te,x=K,v=Q,_=te,A=K,w=Q)},stencilFuncSeparate:(te,K,Q,G)=>{te===e.FRONT?(K!==y||Q!==x||G!==v)&&(e.stencilFuncSeparate(te,K,Q,G),y=K,x=Q,v=G):te===e.BACK?(K!==_||Q!==A||G!==w)&&(e.stencilFuncSeparate(te,K,Q,G),_=K,A=Q,w=G):te===e.FRONT_AND_BACK&&(K!==y||Q!==x||G!==v||K!==_||Q!==A||G!==w)&&(e.stencilFuncSeparate(te,K,Q,G),y=K,x=Q,v=G,_=K,A=Q,w=G)},stencilMask:te=>{(te!==M||te!==E)&&(e.stencilMask(te),M=te,E=te)},stencilMaskSeparate:(te,K)=>{te===e.FRONT?K!==M&&(e.stencilMaskSeparate(te,K),M=K):te===e.BACK?K!==E&&(e.stencilMaskSeparate(te,K),E=K):te===e.FRONT_AND_BACK&&(K!==M||K!==E)&&(e.stencilMaskSeparate(te,K),M=K,E=K)},stencilOp:(te,K,Q)=>{(te!==D||K!==F||Q!==T||te!==R||K!==j||Q!==N)&&(e.stencilOp(te,K,Q),D=te,F=K,T=Q,R=te,j=K,N=Q)},stencilOpSeparate:(te,K,Q,G)=>{te===e.FRONT?(K!==D||Q!==F||G!==T)&&(e.stencilOpSeparate(te,K,Q,G),D=K,F=Q,T=G):te===e.BACK?(K!==R||Q!==j||G!==N)&&(e.stencilOpSeparate(te,K,Q,G),R=K,j=Q,N=G):te===e.FRONT_AND_BACK&&(K!==D||Q!==F||G!==T||K!==R||Q!==j||G!==N)&&(e.stencilOpSeparate(te,K,Q,G),D=K,F=Q,T=G,R=K,j=Q,N=G)},enableVertexAttrib:te=>{e.enableVertexAttribArray(te),z[te]=1},clearVertexAttribsState:oe,disableUnusedVertexAttribs:()=>{for(let te=0;te{(te!==$[0]||K!==$[1]||Q!==$[2]||G!==$[3])&&(e.viewport(te,K,Q,G),$[0]=te,$[1]=K,$[2]=Q,$[3]=G)},scissor:(te,K,Q,G)=>{(te!==V[0]||K!==V[1]||Q!==V[2]||G!==V[3])&&(e.scissor(te,K,Q,G),V[0]=te,V[1]=K,V[2]=Q,V[3]=G)},clipControl:t.clipControl?(te,K)=>{(te!==X||K!==H)&&(t.clipControl.clipControl(te,K),X=te,H=K)}:void 0,reset:()=>{n={},r=e.getParameter(e.FRONT_FACE),i=e.getParameter(e.CULL_FACE_MODE),o=e.getParameter(e.DEPTH_WRITEMASK),s=e.getParameter(e.DEPTH_CLEAR_VALUE),a=e.getParameter(e.DEPTH_FUNC),l=e.getParameter(e.COLOR_WRITEMASK),c=e.getParameter(e.COLOR_CLEAR_VALUE),u=e.getParameter(e.BLEND_SRC_RGB),d=e.getParameter(e.BLEND_DST_RGB),f=e.getParameter(e.BLEND_SRC_ALPHA),p=e.getParameter(e.BLEND_DST_ALPHA),m=e.getParameter(e.BLEND_COLOR),h=e.getParameter(e.BLEND_EQUATION_RGB),g=e.getParameter(e.BLEND_EQUATION_ALPHA),y=e.getParameter(e.STENCIL_FUNC),v=e.getParameter(e.STENCIL_VALUE_MASK),x=e.getParameter(e.STENCIL_REF),_=e.getParameter(e.STENCIL_BACK_FUNC),w=e.getParameter(e.STENCIL_BACK_VALUE_MASK),A=e.getParameter(e.STENCIL_BACK_REF),M=e.getParameter(e.STENCIL_WRITEMASK),E=e.getParameter(e.STENCIL_BACK_WRITEMASK),D=e.getParameter(e.STENCIL_FAIL),T=e.getParameter(e.STENCIL_PASS_DEPTH_PASS),F=e.getParameter(e.STENCIL_PASS_DEPTH_FAIL),R=e.getParameter(e.STENCIL_BACK_FAIL),N=e.getParameter(e.STENCIL_BACK_PASS_DEPTH_PASS),j=e.getParameter(e.STENCIL_BACK_PASS_DEPTH_FAIL),W=e.getParameter(e.MAX_VERTEX_ATTRIBS),z.length=0;for(let te=0;te{o&&(a.forEach((y,v)=>{o.deleteQuery(v)}),l.clear(),f=[],p=null)},g=()=>{if(!o)return;const y=function HYe(e){return e.disjointTimerQuery?e.disjointTimerQuery.createQuery():null}(t);y&&(o.beginQuery(o.TIME_ELAPSED,y),l.forEach((v,x)=>{v.queries.push(y)}),a.set(y,{refCount:l.size}),p=y)};return{resolve:()=>{const y=[];if(!o||!f.length)return y;a.forEach((x,_)=>{if(void 0!==x.timeElapsed)return;const w=o.getQueryParameter(_,o.QUERY_RESULT_AVAILABLE),A=e.getParameter(o.GPU_DISJOINT);if(w&&!A){const M=o.getQueryParameter(_,o.QUERY_RESULT);x.timeElapsed=M}(w||A)&&o.deleteQuery(_)});const v=[];for(const x of f)if(x.queries.every(_=>{var w;return void 0!==(null===(w=a.get(_))||void 0===w?void 0:w.timeElapsed)})){let _=0;for(const w of x.queries){const A=a.get(w);_+=A.timeElapsed,A.refCount-=1}if(x.timeElapsed=_,x.root){const w=[],A=(E,D)=>{for(const T of E){const F=T.timeElapsed,R=T.cpu.end-T.cpu.start,N={label:T.label,gpuElapsed:F,gpuAvg:u.add(T.label,F),cpuElapsed:R,cpuAvg:d.add(T.label,R),children:[],calls:T.calls};D.push(N),A(T.children,N.children)}};A(x.children,w);const M=x.cpu.end-x.cpu.start;y.push({label:x.label,gpuElapsed:_,gpuAvg:u.add(x.label,_),cpuElapsed:M,cpuAvg:d.add(x.label,M),children:w,calls:x.calls})}}else v.push(x);return f=v,a.forEach((x,_)=>{0===x.refCount&&a.delete(_)}),y},mark:(y,v=!1)=>{if(!o)return;if(l.has(y))throw new Error(`Timer mark for '${y}' already exists`);null!==p&&o.endQuery(o.TIME_ELAPSED);const x={label:y,queries:[],children:[],root:null===p,cpu:{start:Bo(),end:-1},captureStats:v};if(l.set(y,x),c.length&&c[c.length-1].children.push(x),c.push(x),v){if(m)throw new Error("Already capturing stats");(function VYe(e){e.calls.drawInstanced=0,e.calls.drawInstancedBase=0,e.calls.multiDrawInstancedBase=0,e.calls.counts=0,e.culled.lod=0,e.culled.frustum=0,e.culled.occlusion=0})(n),m=!0}g()},markEnd:y=>{var v;if(!o)return;const x=l.get(y);if(!x)throw new Error(`Timer mark for '${y}' does not exist`);if((null===(v=c.pop())||void 0===v?void 0:v.label)!==y)throw new Error(`Timer mark for '${y}' has pending nested mark`);o.endQuery(o.TIME_ELAPSED),l.delete(y),x.cpu.end=Bo(),x.captureStats&&(x.calls={...n.calls},m=!1),f.push(x),l.size>0?g():p=null},stats:()=>({gpu:u.stats(),cpu:d.stats()}),formatedStats:()=>{const y={},v=u.stats(),x=d.stats();for(const _ of Object.keys(v)){const w=`${(v[_]/1e3/1e3).toFixed(2)}`,A=`${x[_].toFixed(2)}`;y[_]=`${w} ms | CPU: ${A} ms`}return y},clear:h,destroy:()=>{h()}}}(e,n,i),a={maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),max3dTextureSize:Cn(e)?e.getParameter(e.MAX_3D_TEXTURE_SIZE):0,maxRenderbufferSize:e.getParameter(e.MAX_RENDERBUFFER_SIZE),maxDrawBuffers:n.drawBuffers?e.getParameter(n.drawBuffers.MAX_DRAW_BUFFERS):0,maxTextureImageUnits:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)};if(a.maxVertexTextureImageUnits<8)throw new Error('Need "MAX_VERTEX_TEXTURE_IMAGE_UNITS" >= 8');const l=n.provokingVertex;l?.provokingVertex(l.FIRST_VERTEX_CONVENTION);let c=!1;const u=new Ao(0);let f,d=t.pixelScale||1;if(Cn(e)){const m=e.createBuffer();let h,g,y=!1;const v=()=>{e.bindBuffer(e.PIXEL_PACK_BUFFER,m),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,h),e.bindBuffer(e.PIXEL_PACK_BUFFER,null),y=!1,g(),g=void 0,h=void 0};f=(x,_,w,A,M)=>new Promise((E,D)=>{y?D("Can not call multiple readPixelsAsync at the same time"):(y=!0,e.bindBuffer(e.PIXEL_PACK_BUFFER,m),e.bufferData(e.PIXEL_PACK_BUFFER,w*A*4,e.STREAM_READ),e.readPixels(x,_,w,A,e.RGBA,e.UNSIGNED_BYTE,0),e.bindBuffer(e.PIXEL_PACK_BUFFER,null),g=E,h=M,ude(e,v))})}else f=function(){var m=le(function*(h,g,y,v,x){S9(e,h,g,y,v,x)});return function(g,y,v,x,_){return m.apply(this,arguments)}}();const p=new Set;return{gl:e,isWebGL2:Cn(e),get pixelRatio(){return(typeof window<"u"&&window.devicePixelRatio||1)*(d||1)},extensions:n,state:r,stats:i,resources:o,timer:s,get maxTextureSize(){return a.maxTextureSize},get max3dTextureSize(){return a.max3dTextureSize},get maxRenderbufferSize(){return a.maxRenderbufferSize},get maxDrawBuffers(){return a.maxDrawBuffers},get maxTextureImageUnits(){return a.maxTextureImageUnits},namedComputeRenderables:Object.create(null),namedFramebuffers:Object.create(null),namedTextures:Object.create(null),get isContextLost(){return c||e.isContextLost()},contextRestored:u,setContextLost:()=>{c=!0},handleContextRestored:m=>{Object.assign(n,Gue(e)),r.reset(),r.currentMaterialId=-1,r.currentProgramId=-1,r.currentRenderItemId=-1,o.reset(),p.forEach(h=>h.reset()),m?.(),c=!1,u.next(Bo())},setPixelScale:m=>{d=m},createRenderTarget:(m,h,g,y,v,x)=>{const _=function jYe(e,t,n,r,i=!0,o="uint8",s="nearest",a="rgba"){if("alpha"===a&&!Cn(e))throw new Error("cannot render to alpha format in webgl1");const l=t.framebuffer(),c="fp16"===o?t.texture("image-float16",a,"fp16",s):"float32"===o?t.texture("image-float32",a,"float",s):t.texture("image-uint8",a,"ubyte",s),u=i?Cn(e)?t.renderbuffer("depth32f","depth",n,r):t.renderbuffer("depth16","depth",n,r):null;function d(){c.define(n,r),c.attachFramebuffer(l,"color0"),u&&u.attachFramebuffer(l)}d();let f=!1;return{id:rde(),texture:c,framebuffer:l,depthRenderbuffer:u,getWidth:()=>n,getHeight:()=>r,bind:()=>{l.bind()},setSize:(p,m)=>{n===p&&r===m||(c.define(n=p,r=m),u&&u.setSize(n,r))},reset:()=>{d()},destroy:()=>{f||(c.destroy(),l.destroy(),u&&u.destroy(),f=!0)}}}(e,o,m,h,g,y,v,x);return p.add(_),{..._,destroy:()=>{_.destroy(),p.delete(_)}}},unbindFramebuffer:()=>hN(e),readPixels:(m,h,g,y,v)=>{S9(e,m,h,g,y,v)},readPixelsAsync:f,waitForGpuCommandsComplete:()=>function YYe(e){return new Promise(t=>{Cn(e)?ude(e,t):(dde||(console.info("Sync object not supported in WebGL"),dde=!0),fde(e),t())})}(e),waitForGpuCommandsCompleteSync:()=>fde(e),getDrawingBufferPixelData:()=>function XYe(e,t){const n=e.drawingBufferWidth,r=e.drawingBufferHeight,i=new Uint8Array(n*r*4);return hN(e),t.viewport(0,0,n,r),S9(e,0,0,n,r,i),A_.flipY(A_.create(i,n,r))}(e,r),clear:(m,h,g,y)=>{hN(e),r.enable(e.SCISSOR_TEST),r.depthMask(!0),r.colorMask(!0,!0,!0,!0),r.clearColor(m,h,g,y),r.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),r.scissor(0,0,e.drawingBufferWidth,e.drawingBufferHeight),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)},destroy:m=>{var h,g;o.destroy(),function $Ye(e){const t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);for(let i=0;i{v.isContextLost||!D.shiftKey||!D.ctrlKey||!D.altKey||($n&&console.log("lose context"),E.loseContext(),setTimeout(()=>{v.isContextLost&&($n&&console.log("restore context"),E.restoreContext())},1e3))},!1)}const _=new Ao(0),w=E=>{v.setContextLost(),E.preventDefault(),$n&&console.log("context lost"),_.next(Bo())},A=()=>{v.isContextLost&&(v.handleContextRestored(()=>{x.draw.reset()}),$n&&console.log("context restored"))};n.addEventListener("webglcontextlost",w,!1),n.addEventListener("webglcontextrestored",A,!1);const M=new Ao(void 0);return{canvas:n,webgl:v,input:y,passes:x,attribs:s,get props(){return{...a}},contextLost:_,contextRestored:v.contextRestored,assetManager:r,changed:M,setProps:E=>{if(!E)return;let D=!1;void 0!==E.pixelScale&&E.pixelScale!==a.pixelScale&&(a.pixelScale=E.pixelScale,y.setPixelScale(E.pixelScale),v.setPixelScale(E.pixelScale),s.handleResize(),D=!0),void 0!==E.pickScale&&E.pickScale!==a.pickScale&&(a.pickScale=E.pickScale,x.setPickScale(E.pickScale),D=!0),void 0!==E.transparency&&E.transparency!==a.transparency&&(a.transparency=E.transparency,x.setTransparency(E.transparency),D=!0),D&&M.next(void 0)},dispose:E=>{y.dispose(),n.removeEventListener("webglcontextlost",w,!1),n.removeEventListener("webglcontextrestored",A,!1),v.destroy(E)}}}}(K_||(K_={}));const Yft=typeof window<"u"?window.requestAnimationFrame:e=>setImmediate(()=>e(Date.now())),H0e=typeof window<"u"?window.cancelAnimationFrame:e=>clearImmediate(e);var zq;function Xft(e){G0e(e)}function G0e(e){jt.Canvas3D.ResetSettings.subscribe(e,()=>{var t;null===(t=e.canvas3d)||void 0===t||t.setProps(Uq),e.events.canvas3d.settingsUpdated.next(void 0)}),jt.Canvas3D.SetSettings.subscribe(e,t=>{var n;e.canvas3d&&(null===(n=e.canvas3d)||void 0===n||n.setProps(t.settings),e.events.canvas3d.settingsUpdated.next(void 0))})}!function(e){e.create=function t(n,r={}){var i;const{webgl:o,input:s,passes:a,assetManager:l,canvas:c}=n,u={...op(Uq),...op(r)},d=new Map,f=new Map,p=new Ao(0);let m=Bo();const h=new Ao(0),g=new Ao(0),y=new Ao(0),{gl:v,contextRestored:x}=o;let _=0,w=0,A=128,M=128,E=!1,D=0;Kn();const T=_A.create(o,n.props.transparency);function F(){return T.boundingSphere.radius*u.sceneRadiusFactor}const R=new Si({position:C.create(0,0,100),mode:u.camera.mode,fog:"on"===u.cameraFog.name?u.cameraFog.params.intensity:0,clipFar:u.cameraClipping.far,minNear:u.cameraClipping.minNear,fov:Xr(u.camera.fov)},{x:_,y:w,width:A,height:M}),N=new CA(R,u.camera.stereo.params),j=wq.create(s,R,T,u.trackball),W=new hft(o,T,u),z=new $ft(o,a.draw,c,u.hiZ),$=Cq.create(o,u.renderer);$.setOcclusionTest(z.isOccluded);const V=new Edt(o,$,T,W,a.pick,{x:_,y:w,width:A,height:M},u.pickPadding),X=new uut(ct,Z,s,R,j,u.interaction),H=new b0e(a.multiSample);a.draw.postprocessing.background.update(R,u.postprocessing.background,ut=>{ut&&Ae()});let te,K,oe=!1,Q=!1,G=!0;function Z(ut){let Et=qr,Nt=Xn.Empty;if(ut){const ye=W.camera.getLoci(ut);if(ye!==qr)return{loci:ye,repr:Nt};Et=W.handle.getLoci(ut),d.forEach((we,Te)=>{const je=Te.getLoci(ut);uu(je)||(uu(Et)||console.warn("found another loci, this should not happen"),Et=je,Nt=Te)})}return{loci:Et,repr:Nt}}let ee=[];function re(ut,Et){const{repr:Nt,loci:ye}=ut;let we=!1;return Nt?we=Nt.mark(ye,Et)||we:d.forEach((Te,je)=>{we=je.mark(ye,Et)||we}),we=W.handle.mark(ye,Et)||we,we=W.camera.mark(ye,Et)||we,we}let ge=!1,Ie=!1;function me(ut){Ie||function ae(ut){if(o.isContextLost)return!1;let Et=!1;if(Q&&(Qt(!1),Q=!1,Et=!0),_>v.drawingBufferWidth||_+A<0||w>v.drawingBufferHeight||w+M<0)return!1;const Nt=function xe(){let ut=!1;for(const[Et,Nt]of ee)ut=re(Et,Nt)||ut;return ee=[],ut&&(T.update(void 0,!0),W.handle.scene.update(void 0,!0),W.camera.scene.update(void 0,!0)),ut}()&&($.props.colorMarker||u.marking.enabled);let ye=!1;j.update(D);const we=R.update(),Te=ut||we||Et||E;E=!1;const je=H.update(Nt||Te,u.multiSample);if(Te||je||Nt){let Ft=R;"on"===u.camera.stereo.name&&(N.update(),Ft=N),It&&o.timer.mark("Canvas3D.render",!0);const Vt={renderer:$,camera:Ft,scene:T,helper:W};PF.isEnabled(u.multiSample)?H.render(Vt,u,!0,u.multiSample.reduceFlicker&&!we&&Nt&&!j.isAnimating):a.draw.render(Vt,u,!0),z.render(R),It&&o.timer.markEnd("Canvas3D.render"),V.dirty=V.dirty||Te,ye=!0}return ye}(!!ut?.force)&&G&&h.next(Bo()-m)}function Ae(){E=!0}let he=0;function ie(ut,Et){D=ut,q(Et?.isSynchronous),R.transition.tick(D),z.tick(),!Et?.manualDraw&&(me(),!R.transition.inTransition&&!o.isContextLost&&X.tick(D))}function ue(){ie(Bo()),he=Yft(ue)}function ct(ut,Et){return o.isContextLost?void 0:V.identify(ut,Et,"on"===u.camera.stereo.name?N:R)}function q(ut=!1){(function $e(ut){return!T.needsCommit||(ke.copy(be,T.boundingSphereVisible),z.clear(),T.commit(ut?void 0:Be)?(y.next(0),W.debug.isEnabled&&W.debug.update(),!u.camera.manualReset&&(0===p.value||function Re(){if(0===R.state.radiusMax)return!0;if(R.transition.inTransition||K)return!1;let ut=!0,Et=!0;ke.set(Ce,R.state.target,R.state.radius);for(const Nt of T.renderables){if(!Nt.state.visible)continue;const ye=Nt.values.boundingSphere.ref.value;if(!ye.radius)continue;Et=!1;const we=C.distance(Ce.center,ye.center);if((we>Ce.radius||we>ye.radius||ye.radius>R.state.radiusMax)&&!ke.includes(be,ye))return!0;ke.overlaps(Ce,ye)&&(ut=!1)}return ut||!Et&&Ce.radius<=.1}())&&(oe=!0),0===be.radius&&(te=0),u.camera.manualReset||R.setState({radiusMax:F()},0),p.next(d.size),$n&&nt(),!0):(y.next(T.commitQueueSize),!1))})(ut)&&(function ne(){if(!oe)return;const ut=T.boundingSphereVisible,{center:Et,radius:Nt}=ut,ye=j.props.autoAdjustMinMaxDistance;if("on"===ye.name){const we=ye.params.minDistanceFactor*Nt+ye.params.minDistancePadding,Te=Math.max(ye.params.maxDistanceFactor*Nt,ye.params.maxDistanceMin);j.setProps({minDistance:we,maxDistance:Te})}if(Nt>0){const we=void 0===te?u.cameraResetDurationMs:te,Te=R.getFocus(Et,Nt),je="function"==typeof K?K(T,R):K,Ft=je?{...Te,...je}:Te;R.setState({...Ft,radiusMax:F()},we)}te=void 0,K=void 0,oe=!1}(),ge&&(W.debug.isEnabled&&W.debug.update(),me({force:!0}),ge=!1),g.next(Bo()))}const be=ke(),Ce=ke(),Be=250;function nt(){const ut=T.renderables.map(we=>({drawCount:we.values.drawCount.ref.value,instanceCount:we.values.instanceCount.ref.value,materialId:we.materialId,renderItemId:we.id}));console.groupCollapsed(`${ut.length} RenderItems`),ut.length<50?console.table(ut):console.log(ut),console.log(JSON.stringify(o.stats,void 0,4));const{texture:Et,attribute:Nt,elements:ye}=o.resources.getByteCounts();console.log(JSON.stringify({texture:`${(Et/1024/1024).toFixed(3)} MiB`,attribute:`${(Nt/1024/1024).toFixed(3)} MiB`,elements:`${(ye/1024/1024).toFixed(3)} MiB`},void 0,4)),console.log(JSON.stringify(o.timer.formatedStats(),void 0,4)),console.groupEnd()}function Pt(){const ut=T.boundingSphere.radius>0?100-Math.round(R.transition.target.radius/F()*100):0;return{camera:{mode:R.state.mode,helper:{...W.camera.props},stereo:{...u.camera.stereo},fov:Math.round(pf(R.state.fov)),manualReset:!!u.camera.manualReset},cameraFog:R.state.fog>0?{name:"on",params:{intensity:R.state.fog}}:{name:"off",params:{}},cameraClipping:{far:R.state.clipFar,radius:ut,minNear:R.state.minNear},cameraResetDurationMs:u.cameraResetDurationMs,sceneRadiusFactor:u.sceneRadiusFactor,transparentBackground:u.transparentBackground,dpoitIterations:u.dpoitIterations,pickPadding:u.pickPadding,viewport:u.viewport,postprocessing:{...u.postprocessing},marking:{...u.marking},multiSample:{...u.multiSample},hiZ:{...z.props},renderer:{...$.props},trackball:{...j.props},interaction:{...X.props},debug:{...W.debug.props},handle:{...W.handle.props}}}const St=x.subscribe(()=>{V.dirty=!0,me({force:!0}),me({force:!0})}),Mt=new Ao(0);function Qt(ut=!0){a.updateSize(),Kn(),ti(),ut&&Ae(),Mt.next(+new Date)}!function tOe(e){y3.includes(e)||y3.push(e)}(nt);const An=null===(i=n.changed)||void 0===i?void 0:i.subscribe(()=>{T.setTransparency(n.props.transparency),Ae()});if($n&&c){let ut;const Et=Nt=>{const ye=Nt&&Yn.getBoundingSphere(Yn.normalize(Nt,"residue"));z.debugOcclusion(ye)};s.click.subscribe(Nt=>{if(!Nt.modifiers.control||2!==Nt.button)return;const ye=ct(Nt.x,Nt.y);if(!ye)return ut=void 0,void Et(ut);ut=Z(ye.id).loci,Et(ut)}),h.subscribe(()=>{setTimeout(()=>{Et(ut)},100)})}return{webgl:o,add:function ht(ut){!function ft(ut){f.has(ut)||f.set(ut,ut.updated.subscribe(Et=>{ut.state.syncManually||ht(ut)}))}(ut);const Et=d.get(ut),Nt=new Set;ut.renderObjects.forEach(ye=>Nt.add(ye)),Et?Lo.areEqual(Nt,Et)||(Nt.forEach(ye=>{Et.has(ye)||T.add(ye)}),Et.forEach(ye=>{Nt.has(ye)||T.remove(ye)})):ut.renderObjects.forEach(ye=>T.add(ye)),d.set(ut,Nt),T.update(ut.renderObjects,!1),ge=!0,$n&&nt()},remove:function Ge(ut){!function vt(ut){const Et=f.get(ut);Et&&(Et.unsubscribe(),f.delete(ut))}(ut);const Et=d.get(ut);Et&&(Et.forEach(Nt=>T.remove(Nt)),d.delete(ut),ge=!0,$n&&nt())},commit:q,update:(ut,Et)=>{if(ut){if(!d.has(ut))return;T.update(ut.renderObjects,!!Et)}else T.update(void 0,!!Et);ge=!0},clear:()=>{f.forEach(ut=>ut.unsubscribe()),f.clear(),d.clear(),T.clear(),W.debug.clear(),Ae(),p.next(d.size)},syncVisibility:()=>{0===R.state.radiusMax&&(oe=!0,te=0),T.syncVisibility()&&W.debug.isEnabled&&W.debug.update(),Ae()},requestDraw:Ae,tick:ie,animate:function Fe(){Ie=!1,j.start(Bo()),0===he&&ue()},resetTime:function _e(ut){m=ut,j.start(ut)},pause:function Ze(ut=!1){Ie=ut,H0e(he),he=0},resume:()=>{Ie=!1},identify:ct,mark:function se(ut,Et){ee.push([ut,Et])},getLoci:Z,handleResize:Qt,requestResize:()=>{Q=!0},requestCameraReset:ut=>{te=ut?.durationMs,K=ut?.snapshot,oe=!0},camera:R,boundingSphere:T.boundingSphere,boundingSphereVisible:T.boundingSphereVisible,get notifyDidDraw(){return G},set notifyDidDraw(ut){G=ut},didDraw:h,commited:g,commitQueueSize:y,reprCount:p,resized:Mt,setProps:(ut,Et=!1)=>{var Nt,ye,we,Te;const je="function"==typeof ut?fy(Pt(),ut):ut;void 0!==je.sceneRadiusFactor&&(u.sceneRadiusFactor=je.sceneRadiusFactor,R.setState({radiusMax:F()},0));const Ft=Object.create(null);je.camera&&void 0!==je.camera.mode&&je.camera.mode!==R.state.mode&&(Ft.mode=je.camera.mode);const Vt=Math.round(pf(R.state.fov));if(je.camera&&void 0!==je.camera.fov&&je.camera.fov!==Vt&&(Ft.fov=Xr(je.camera.fov)),void 0!==je.cameraFog&&je.cameraFog.params){const pn="on"===je.cameraFog.name?je.cameraFog.params.intensity:0;pn!==R.state.fog&&(Ft.fog=pn)}if(void 0!==je.cameraClipping&&(void 0!==je.cameraClipping.far&&je.cameraClipping.far!==R.state.clipFar&&(Ft.clipFar=je.cameraClipping.far),void 0!==je.cameraClipping.minNear&&je.cameraClipping.minNear!==R.state.minNear&&(Ft.minNear=je.cameraClipping.minNear),void 0!==je.cameraClipping.radius)){const pn=F()/100*(100-je.cameraClipping.radius);pn>0&&pn!==Ft.radius&&(Ft.radius=Math.max(pn,.01))}Object.keys(Ft).length>0&&R.setState(Ft),!(null===(Nt=je.camera)||void 0===Nt)&&Nt.helper&&W.camera.setProps(je.camera.helper),void 0!==(null===(ye=je.camera)||void 0===ye?void 0:ye.manualReset)&&(u.camera.manualReset=je.camera.manualReset),void 0!==(null===(we=je.camera)||void 0===we?void 0:we.stereo)&&(Object.assign(u.camera.stereo,je.camera.stereo),N.setProps(u.camera.stereo.params)),void 0!==je.cameraResetDurationMs&&(u.cameraResetDurationMs=je.cameraResetDurationMs),void 0!==je.transparentBackground&&(u.transparentBackground=je.transparentBackground),void 0!==je.dpoitIterations&&(u.dpoitIterations=je.dpoitIterations),void 0!==je.pickPadding&&(u.pickPadding=je.pickPadding),void 0!==je.viewport&&(u.viewport===je.viewport||u.viewport.name===je.viewport.name&&l3(u.viewport.params,je.viewport.params)||(u.viewport=je.viewport,Kn(),ti())),!(null===(Te=je.postprocessing)||void 0===Te)&&Te.background&&(Object.assign(u.postprocessing.background,je.postprocessing.background),a.draw.postprocessing.background.update(R,u.postprocessing.background,pn=>{pn&&!Et&&Ae()})),je.postprocessing&&Object.assign(u.postprocessing,je.postprocessing),je.marking&&Object.assign(u.marking,je.marking),je.multiSample&&Object.assign(u.multiSample,je.multiSample),je.hiZ&&z.setProps(je.hiZ),je.renderer&&$.setProps(je.renderer),je.trackball&&j.setProps(je.trackball),je.interaction&&X.setProps(je.interaction),je.debug&&W.debug.setProps(je.debug),je.handle&&W.handle.setProps(je.handle),"orthographic"===Ft.mode&&(u.camera.stereo.name="off"),Et||Ae()},getImagePass:(ut={})=>new oft(o,l,$,T,R,W,a.draw.transparency,ut),getRenderObjects(){const ut=[];return T.forEach((Et,Nt)=>ut.push(Nt)),ut},get props(){return Pt()},get input(){return s},get stats(){return $.stats},get interaction(){return X.events},dispose:()=>{St.unsubscribe(),An?.unsubscribe(),H0e(he),ee=[],T.clear(),W.debug.clear(),j.dispose(),$.dispose(),X.dispose(),z.dispose(),function nOe(e){const t=y3.indexOf(e);-1!==t&&y3.splice(t,1)}(nt)}};function Kn(){const ut=_,Et=w,Nt=A,ye=M;"canvas"===u.viewport.name?(_=0,w=0,A=v.drawingBufferWidth,M=v.drawingBufferHeight):"static-frame"===u.viewport.name?(_=u.viewport.params.x*o.pixelRatio,M=u.viewport.params.height*o.pixelRatio,w=v.drawingBufferHeight-M-u.viewport.params.y*o.pixelRatio,A=u.viewport.params.width*o.pixelRatio):"relative-frame"===u.viewport.name&&(_=Math.round(u.viewport.params.x*v.drawingBufferWidth),M=Math.round(u.viewport.params.height*v.drawingBufferHeight),w=Math.round(v.drawingBufferHeight-M-u.viewport.params.y*v.drawingBufferHeight),A=Math.round(u.viewport.params.width*v.drawingBufferWidth)),(ut!==_||Et!==w||Nt!==A||ye!==M)&&(E=!0)}function ti(){V.setViewport(_,w,A,M),$.setViewport(_,w,A,M),Da.set(R.viewport,_,w,A,M),Da.set(j.viewport,_,w,A,M),z.setViewport(_,w,A,M)}}}(zq||(zq={}));const Z_=es,rv=Rf,Q_=Ut.Trigger,Kft={hoverHighlightOnly:Ut([Q_(Z_.Flag.None)],"Highlight","Hover element using ${triggers}"),hoverHighlightOnlyExtend:Ut([Q_(Z_.Flag.None,rv.create({shift:!0}))],"Extend highlight","From selected to hovered element along polymer using ${triggers}")},Zft={bindings:I.Value(Kft,{isHidden:!0}),ignore:I.Value([],{isHidden:!0}),preferAtoms:I.Boolean(!1,{description:"Always prefer atoms over bonds"}),mark:I.Boolean(!0)},Qft=ii.create({name:"representation-highlight-loci",category:"interaction",ctor:class extends ii.Handler{constructor(){super(...arguments),this.lociMarkProvider=(e,t)=>{!this.ctx.canvas3d||!this.params.mark||this.ctx.canvas3d.mark(e,t)}}getLoci(e){return this.params.preferAtoms&&fn.isLoci(e)&&2===e.bonds.length?fn.toFirstStructureElementLoci(e):e}register(){this.subscribeObservable(this.ctx.behaviors.interaction.hover,({current:e,buttons:t,modifiers:n})=>{if(!this.ctx.canvas3d||this.ctx.isBusy)return;const r=this.getLoci(e.loci);if(this.params.ignore.includes(r.kind))return void this.ctx.managers.interactivity.lociHighlights.highlightOnly({repr:e.repr,loci:qr});let i=!1;Ut.match(this.params.bindings.hoverHighlightOnly,t,n)&&(this.ctx.managers.interactivity.lociHighlights.highlightOnly({loci:r}),i=!0),Ut.match(this.params.bindings.hoverHighlightOnlyExtend,t,n)&&(this.ctx.managers.interactivity.lociHighlights.highlightOnlyExtend({loci:r}),i=!0),i||this.ctx.managers.interactivity.lociHighlights.highlightOnly({repr:e.repr,loci:qr})}),this.ctx.managers.interactivity.lociHighlights.addProvider(this.lociMarkProvider)}unregister(){this.ctx.managers.interactivity.lociHighlights.removeProvider(this.lociMarkProvider)}},params:()=>Zft,display:{name:"Highlight Loci on Canvas"}}),q0e={clickSelect:Ut.Empty,clickToggleExtend:Ut([Q_(Z_.Flag.Primary,rv.create({shift:!0}))],"Toggle extended selection","Click on element using ${triggers} to extend selection along polymer"),clickSelectOnly:Ut.Empty,clickToggle:Ut([Q_(Z_.Flag.Primary,rv.create())],"Toggle selection","Click on element using ${triggers}"),clickDeselect:Ut.Empty,clickDeselectAllOnEmpty:Ut([Q_(Z_.Flag.Primary,rv.create())],"Deselect all","Click on nothing using ${triggers}")},Jft={bindings:I.Value(q0e,{isHidden:!0}),ignore:I.Value([],{isHidden:!0}),preferAtoms:I.Boolean(!1,{description:"Always prefer atoms over bonds"}),mark:I.Boolean(!0)},W0e=ii.create({name:"representation-select-loci",category:"interaction",ctor:class extends ii.Handler{getLoci(e){return this.params.preferAtoms&&fn.isLoci(e)&&2===e.bonds.length?fn.toFirstStructureElementLoci(e):e}applySelectMark(e,t){const n=this.ctx.state.data.cells.get(e);if(n&&Se.isRepresentation3D(n.obj)){this.spine.current=n;const r=this.spine.getRootOfType(Se.Molecule.Structure);if(r){t&&this.lociMarkProvider({loci:Xe.Loci(r.data)},un.Deselect);const i=this.ctx.managers.structure.selection.getLoci(r.data);this.lociMarkProvider({loci:i},un.Select)}}}register(){const t=r=>!Yn.isEmpty(r),n=[["clickSelect",r=>this.ctx.managers.interactivity.lociSelects.select(r),t],["clickToggle",r=>this.ctx.managers.interactivity.lociSelects.toggle(r),t],["clickToggleExtend",r=>this.ctx.managers.interactivity.lociSelects.toggleExtend(r),t],["clickSelectOnly",r=>this.ctx.managers.interactivity.lociSelects.selectOnly(r),t],["clickDeselect",r=>this.ctx.managers.interactivity.lociSelects.deselect(r),t],["clickDeselectAllOnEmpty",()=>this.ctx.managers.interactivity.lociSelects.deselectAll(),r=>Yn.isEmpty(r)]];n.sort((r,i)=>{const o=this.params.bindings[r[0]],s=this.params.bindings[i[0]],a=0===o.triggers.length?0:Bh(o.triggers.map(c=>rv.size(c.modifiers)));return(0===s.triggers.length?0:Bh(s.triggers.map(c=>rv.size(c.modifiers))))-a}),this.subscribeObservable(this.ctx.behaviors.interaction.click,({current:r,button:i,modifiers:o})=>{if(!this.ctx.canvas3d||this.ctx.isBusy||!this.ctx.selectionMode)return;const s=this.getLoci(r.loci);if(!this.params.ignore.includes(s.kind))for(const[a,l,c]of n)if(Ut.match(this.params.bindings[a],i,o)&&(!c||c(s))){l({repr:r.repr,loci:s});break}}),this.ctx.managers.interactivity.lociSelects.addProvider(this.lociMarkProvider),this.subscribeObservable(this.ctx.state.events.object.created,({ref:r})=>this.applySelectMark(r)),this.subscribeObservable(this.ctx.state.events.object.updated,({ref:r,obj:i,oldObj:o,oldData:s,action:a})=>{const l=this.ctx.state.data.cells.get(r);if(l&&Se.Molecule.Structure.is(l.obj)){const c=i.data,u="recreate"===a?o?.data:"in-place"===a?s:void 0;if(u&&Xe.areEquivalent(c,u)&&Xe.areHierarchiesEqual(c,u))return;const d=this.ctx.state.data.select(Qn.children(r).ofType(Se.Molecule.Structure.Representation3D));for(const f of d)this.applySelectMark(f.transform.ref,!0)}})}unregister(){this.ctx.managers.interactivity.lociSelects.removeProvider(this.lociMarkProvider)}constructor(e,t){super(e,t),this.lociMarkProvider=(n,r)=>{!this.ctx.canvas3d||!this.params.mark||this.ctx.canvas3d.mark({loci:n.loci},r)},this.spine=new TD.Impl(e.state.data.cells)}},params:()=>Jft,display:{name:"Select Loci on Canvas"}}),ept=ii.create({name:"default-loci-label-provider",category:"interaction",ctor:class{register(){this.ctx.managers.lociLabels.addProvider(this.f)}unregister(){this.ctx.managers.lociLabels.removeProvider(this.f)}constructor(e){this.ctx=e,this.f={label:t=>{const n=[];if(Me.is(t)){const r=new Set;for(const{unit:i}of t.elements){const o=dt.create(t.structure,i,i.elements[0]),s=Je.entity.pdbx_description(o).join(", ");r.add(s)}1===r.size&&r.forEach(i=>n.push(i))}return n.push(L_(t)),n.filter(r=>!!r).join("
")},group:t=>t.toString().replace(/Model [0-9]+/g,"Models"),priority:100}}},display:{name:"Provide Default Loci Label"}}),$0e={clickFocus:Ut([Q_(Z_.Flag.Primary,rv.create())],"Representation Focus","Click element using ${triggers}"),clickFocusAdd:Ut([Q_(Z_.Flag.Primary,rv.create({shift:!0}))],"Representation Focus Add","Click element using ${triggers}"),clickFocusSelectMode:Ut([],"Representation Focus","Click element using ${triggers}"),clickFocusAddSelectMode:Ut([],"Representation Focus Add","Click element using ${triggers}")},tpt={bindings:I.Value($0e,{isHidden:!0})},OF=ii.create({name:"representation-focus-loci",category:"interaction",ctor:class extends ii.Handler{register(){this.subscribeObservable(this.ctx.behaviors.interaction.click,({current:e,button:t,modifiers:n})=>{var r,i,o,s,a;const{clickFocus:l,clickFocusAdd:c,clickFocusSelectMode:u,clickFocusAddSelectMode:d}=this.params.bindings,p=Ut.match(this.ctx.selectionMode?u:l,t,n),m=null!==(s=null===(o=null===(i=null===(r=e.repr)||void 0===r?void 0:r.props)||void 0===i?void 0:i.snapshotKey)||void 0===o?void 0:o.trim())&&void 0!==s?s:"";if(!this.ctx.selectionMode&&p&&m)return void this.ctx.managers.snapshot.applyKey(m);const{granularity:h}=this.ctx.managers.interactivity.props;if("residue"!==h&&"element"!==h)return;const y=Ut.match(this.ctx.selectionMode?d:c,t,n);if(!p&&!y)return;const v=Yn.normalize(e.loci,"residue"),x=this.ctx.managers.structure.focus.current;if(x&&Yn.areEqual(x.loci,v))this.ctx.managers.structure.focus.clear();else if(p)this.ctx.managers.structure.focus.setFromLoci(v);else{this.ctx.managers.structure.focus.addFromLoci(v);const _=null===(a=this.ctx.managers.structure.focus.current)||void 0===a?void 0:a.loci;_&&this.ctx.managers.camera.focusLoci(_)}})}},params:()=>tpt,display:{name:"Representation Focus Loci on Canvas"}}),Dg=es,nm=Rf,Pg=Ut.Trigger,BF=Ut.TriggerKey,Vq=Ut([Pg(Dg.Flag.Primary,nm.create()),Pg(Dg.Flag.Secondary,nm.create()),Pg(Dg.Flag.Primary,nm.create({control:!0}))],"Reset camera focus","Click on nothing using ${triggers}"),Hq=Ut([Pg(Dg.Flag.Secondary,nm.create()),Pg(Dg.Flag.Primary,nm.create({control:!0}))],"Reset camera focus","Click on nothing using ${triggers}"),Y0e={clickCenterFocus:Ut([Pg(Dg.Flag.Primary,nm.create()),Pg(Dg.Flag.Secondary,nm.create()),Pg(Dg.Flag.Primary,nm.create({control:!0}))],"Camera center and focus","Click element using ${triggers}"),clickCenterFocusSelectMode:Ut([Pg(Dg.Flag.Secondary,nm.create()),Pg(Dg.Flag.Primary,nm.create({control:!0}))],"Camera center and focus","Click element using ${triggers}"),clickResetCameraOnEmpty:Vq,clickResetCameraOnEmptySelectMode:Hq},npt={minRadius:I.Numeric(8,{min:1,max:50,step:1}),extraRadius:I.Numeric(4,{min:1,max:50,step:1},{description:"Value added to the bounding-sphere radius of the Loci"}),durationMs:I.Numeric(250,{min:0,max:1e3,step:1},{description:"Camera transition duration"}),bindings:I.Value(Y0e,{isHidden:!0})},rpt=ii.create({name:"camera-focus-loci",category:"interaction",ctor:class extends ii.Handler{register(){this.subscribeObservable(this.ctx.behaviors.interaction.click,({current:e,button:t,modifiers:n})=>{var r,i;if(!this.ctx.canvas3d)return;const o=this.ctx.selectionMode?this.params.bindings.clickCenterFocusSelectMode:this.params.bindings.clickCenterFocus,s=this.ctx.selectionMode?null!==(r=this.params.bindings.clickResetCameraOnEmptySelectMode)&&void 0!==r?r:Hq:null!==(i=this.params.bindings.clickResetCameraOnEmpty)&&void 0!==i?i:Vq;if(Yn.isEmpty(e.loci)&&Ut.match(s,t,n))jt.Camera.Reset(this.ctx,{});else if(Ut.match(o,t,n)){const a=Yn.normalize(e.loci,this.ctx.managers.interactivity.props.granularity);this.ctx.managers.camera.focusLoci(a,this.params)}})}},params:()=>npt,display:{name:"Camera Focus Loci on Canvas"}}),ipt=ii.create({name:"camera-axis-helper",category:"interaction",ctor:class extends ii.Handler{register(){let e=Ei.None,t=0;this.subscribeObservable(this.ctx.behaviors.interaction.click,({current:n})=>{if(!this.ctx.canvas3d||!Nq(n.loci))return;const r=n.loci.elements[0].groupId;if(r===Ei.None)return e=Ei.None,void(t=0);const{camera:i}=this.ctx.canvas3d;let o,s;if(r>=Ei.X&&r<=Ei.Z){e=Ei.None,t=0;const a=C.sub(C(),i.target,i.position),l=C.cross(C(),a,i.up);s=C(),s[r-1]=1,o=C.cross(C(),s,l),0===C.magnitude(o)&&(o=a)}else e===r?t=(t+1)%2:(e=r,t=0),r===Ei.XY?(s=t?C.unitX:C.unitY,o=C.negUnitZ):r===Ei.XZ?(s=t?C.unitX:C.unitZ,o=C.negUnitY):(s=t?C.unitY:C.unitZ,o=C.negUnitX);this.ctx.canvas3d.requestCameraReset({snapshot:(a,l)=>l.getInvariantFocus(a.boundingSphereVisible.center,a.boundingSphereVisible.radius,s,o)})})}},params:()=>({}),display:{name:"Camera Axis Helper"}}),X0e={keySpinAnimation:Ut([BF("I")],"Spin Animation","Press ${triggers}"),keyRockAnimation:Ut([BF("O")],"Rock Animation","Press ${triggers}"),keyToggleFlyMode:Ut([BF("Space",nm.create({shift:!0}))],"Toggle Fly Mode","Press ${triggers}"),keyResetView:Ut([BF("T")],"Reset View","Press ${triggers}")},opt={bindings:I.Value(X0e,{isHidden:!0})},spt=ii.create({name:"camera-controls",category:"interaction",ctor:class extends ii.Handler{register(){this.subscribeObservable(this.ctx.behaviors.interaction.key,({code:e,key:t,modifiers:n})=>{var r;if(!this.ctx.canvas3d)return;const i={...X0e,...this.params.bindings},o=this.ctx.canvas3d.props.trackball;if(Ut.matchKey(i.keySpinAnimation,e,n,t)){const s="spin"!==o.animate.name?"spin":"off";this.ctx.canvas3d.setProps("off"===s?{trackball:{animate:{name:s,params:{}}}}:{trackball:{animate:{name:s,params:{speed:1}}}})}if(Ut.matchKey(i.keyRockAnimation,e,n,t)){const s="rock"!==o.animate.name?"rock":"off";this.ctx.canvas3d.setProps("off"===s?{trackball:{animate:{name:s,params:{}}}}:{trackball:{animate:{name:s,params:{speed:.3,angle:10}}}})}if(Ut.matchKey(i.keyToggleFlyMode,e,n,t)){const s=!o.flyMode;this.ctx.canvas3d.setProps({trackball:{flyMode:s}}),null!==(r=this.ctx.canvas3dContext)&&void 0!==r&&r.canvas&&(this.ctx.canvas3dContext.canvas.style.cursor=s?"crosshair":"unset")}Ut.matchKey(i.keyResetView,e,n,t)&&jt.Camera.Reset(this.ctx,{})})}},params:()=>opt,display:{name:"Camera Controls on Canvas"}}),apt=ii.create({name:"structure-info-prop",category:"custom-props",display:{name:"Structure Info"},ctor:class extends ii.Handler{get maxModelIndex(){var e,t;let n=-1;const r=this.ctx.state.data.select(Qn.Generators.rootsOfType(Se.Molecule.Model));for(const i of r){const o=(null===(e=i.obj)||void 0===e?void 0:e.data)&&Sn.Index.get(null===(t=i.obj)||void 0===t?void 0:t.data).value;void 0!==o&&o>n&&(n=o)}return n}get maxStructureIndex(){var e,t;let n=-1;const r=this.ctx.state.data.select(Qn.Generators.rootsOfType(Se.Molecule.Structure));for(const i of r){const o=(null===(e=i.obj)||void 0===e?void 0:e.data)&&Xe.Index.get(null===(t=i.obj)||void 0===t?void 0:t.data).value;void 0!==o&&o>n&&(n=o)}return n}get asymIdOffset(){var e;let t=0,n=0;const r=this.ctx.state.data.select(Qn.Generators.rootsOfType(Se.Molecule.Model));for(const i of r){const o=null===(e=i.obj)||void 0===e?void 0:e.data;if(o){const s=Sn.AsymIdCount.get(o),a=Sn.AsymIdOffset.get(o).value;void 0!==s&&void 0!==a&&(t=Math.max(t,a.auth+s.auth),n=Math.max(n,a.label+s.label))}}return{auth:t,label:n}}setModelMaxIndex(){var e;const t=this.maxModelIndex,n=this.ctx.state.data.select(Qn.Generators.rootsOfType(Se.Molecule.Model));for(const r of n){const i=null===(e=r.obj)||void 0===e?void 0:e.data;i&&Sn.MaxIndex.get(i).value!==t&&Sn.MaxIndex.set(i,{value:t},t)}}setStructureMaxIndex(){var e;const t=this.maxModelIndex,n=this.ctx.state.data.select(Qn.Generators.rootsOfType(Se.Molecule.Structure));for(const r of n){const i=null===(e=r.obj)||void 0===e?void 0:e.data;i&&Xe.MaxIndex.get(i).value!==t&&Xe.MaxIndex.set(i,{value:t},t)}}handleModel(e,t){if(void 0===Sn.Index.get(e).value){const r=(t&&Sn.Index.get(t).value)??this.maxModelIndex+1;Sn.Index.set(e,{value:r},r)}if(void 0===Sn.AsymIdOffset.get(e).value){const r=(t&&Sn.AsymIdOffset.get(t).value)??{...this.asymIdOffset};Sn.AsymIdOffset.set(e,{value:r},r)}}handleStructure(e,t){if(void 0!==e.parent||void 0!==Xe.Index.get(e).value)return;const r=(t&&Xe.Index.get(t).value)??this.maxStructureIndex+1;Xe.Index.set(e,{value:r},r)}handle(e,t,n){Se.Molecule.Structure.is(t)?!this.ctx.state.data.tree.transforms.get(e).transformer.definition.isDecorator&&void 0===t.data.parent&&this.handleStructure(t.data,n?.data):Se.Molecule.Model.is(t)&&(this.ctx.state.data.tree.transforms.get(e).transformer.definition.isDecorator||this.handleModel(t.data,n?.data))}register(){this.ctx.customModelProperties.register(Sn.AsymIdOffset,!0),this.ctx.customModelProperties.register(Sn.Index,!0),this.ctx.customModelProperties.register(Sn.MaxIndex,!0),this.ctx.customStructureProperties.register(Xe.Index,!0),this.ctx.customStructureProperties.register(Xe.MaxIndex,!0),this.subscribeObservable(this.ctx.state.data.events.object.created,e=>{this.handle(e.ref,e.obj),this.setModelMaxIndex(),this.setStructureMaxIndex()}),this.subscribeObservable(this.ctx.state.data.events.object.updated,e=>{this.handle(e.ref,e.obj,e.oldObj)})}unregister(){this.ctx.customModelProperties.unregister(Sn.AsymIdOffset.descriptor.name),this.ctx.customModelProperties.unregister(Sn.Index.descriptor.name),this.ctx.customModelProperties.unregister(Sn.MaxIndex.descriptor.name),this.ctx.customStructureProperties.unregister(Xe.Index.descriptor.name),this.ctx.customStructureProperties.unregister(Xe.MaxIndex.descriptor.name)}}}),iv=[-1,1.76,1.87,1.65,1.5,1.4,1.85,1.8,1.6,1.4],K0e={ALA:121,ARG:265,ASN:187,ASP:187,CYS:148,GLU:214,GLN:214,GLY:97,HIS:216,ILE:195,LEU:191,LYS:230,MET:203,PHE:228,PRO:154,SER:143,THR:163,TRP:264,TYR:255,VAL:165};function upt(e,t,n){switch(t){case"O":return 5;case"S":return 6;case"N":return"NZ"===e?4:3;case"C":switch(e){case"C":case"CE1":case"CE2":case"CE3":case"CH2":case"CZ":case"CZ2":case"CZ3":return 1;case"CA":case"CB":case"CE":case"CG1":case"CG2":return 2;default:switch(n){case"PHE":case"TRP":case"TYR":case"HIS":case"ASP":case"ASN":return 1;case"PRO":case"LYS":case"ARG":case"MET":case"ILE":case"LEU":return 2;case"GLU":case"GLN":return"CD"===e?1:2}}}return Gq(t)}function dpt(e,t,n){switch(t){case"C":return 7;case"N":return 8;case"P":return 9;case"O":return 5}return Gq(t)}function Gq(e){const t=B3(e);let n=iv.indexOf(t);return-1===n&&(n=iv.length,iv[n]=t),n}function qq(){return qq=le(function*(e,t){const{atomRadiusType:n}=t;for(let r=0;r$[0]-V[0]);let z=0;e:for(let $=0;$te)continue e}++z}s[o[v]]+=l*z*N*N}}const Q0e={numberOfSpherePoints:I.Numeric(92,{min:12,max:360,step:1},{description:"Number of sphere points to sample per atom: 92 (original paper), 960 (BioJava), 3000 (EPPIC) - see Shrake A, Rupley JA: Environment and exposure to solvent of protein atoms. Lysozyme and insulin. J Mol Biol 1973."}),probeSize:I.Numeric(1.4,{min:.1,max:4,step:.01},{description:"Corresponds to the size of a water molecule: 1.4 (original paper), 1.5 (occassionally used)"}),nonPolymer:I.Boolean(!1,{description:"Include non-polymer atoms as occluders."}),traceOnly:I.Boolean(!1,{description:"Compute only using alpha-carbons, if true increase probeSize accordingly (e.g., 4 A). Considers only canonical amino acids."})};var IA;!function(e){function r(){return r=le(function*(u,d,f){const p=function i(u,d){const{elementCount:f,atomicResidueCount:p}=u,{probeSize:m,nonPolymer:h,traceOnly:g,numberOfSpherePoints:y}=d;return{structure:u,probeSize:m,nonPolymer:h,traceOnly:g,spherePoints:o(y),scalingConstant:4*Math.PI/y,maxLookupRadius:2*d.probeSize+2*iv[2],atomRadiusType:new Int8Array(f),serialResidueIndex:new Int32Array(f),area:new Float32Array(p)}}(d,f);(function cpt(e){const{key:t}=Je.residue,{type_symbol:n,label_atom_id:r,label_comp_id:i}=Je.atom,{structure:o,atomRadiusType:s,serialResidueIndex:a}=e,l=dt.create(o);let c=0,u=0,d=-1;l.structure=o;for(let f=0,p=0,m=o.units.length;f{if(!ze.isAtomic(e.element.unit))return!1;const t=Vp.get(e.element.structure).value;return!!t&&1===IA.getFlag(e.element,t)}),isAccessible:iA.Dynamic(ese("computed","accessible-surface-area.is-accessible",Oe.Bool),e=>{if(!ze.isAtomic(e.element.unit))return!1;const t=Vp.get(e.element.structure).value;return!!t&&2===IA.getFlag(e.element,t)})},Vp=iy.createProvider({label:"Accessible Surface Area",descriptor:hf({name:"molstar_accessible_surface_area",symbols:$q}),type:"root",defaultParams:Wq,getParams:e=>Wq,isApplicable:e=>!0,obtain:function(){var e=le(function*(t,n,r){const i={...I.getDefaultValues(Wq),...r};return{value:yield IA.compute(n,i).runInContext(t.runtime)}});return function(n,r,i){return e.apply(this,arguments)}}()}),Yq=st(16448250),J0e={list:I.ColorList("rainbow",{presetKind:"scale"})},tye={name:"accessible-surface-area",label:"Accessible Surface Area",category:Rd.Category.Residue,factory:function eye(e,t){let n;const r=up.create({listOrName:t.list.colors,minLabel:"buried",maxLabel:"exposed",domain:[0,1]}),i=e.structure&&Vp.get(e.structure),o=i?Yx(i.id,i.version):-1;if(i?.value&&e.structure){const s=dt.create(e.structure),a=i.value,l=c=>{const u=IA.getNormalizedValue(c,a);return-1===u?Yq:r.color(u)};n=c=>dt.is(c)&&ze.isAtomic(c.unit)?l(c):fn.isLocation(c)?(s.unit=c.aUnit,s.element=c.aUnit.elements[c.aIndex],l(s)):Yq}else n=()=>Yq;return{factory:eye,granularity:"group",preferSmoothing:!0,color:n,props:t,contextHash:o,description:"Assigns a color based on the relative accessible surface area of a residue.",legend:r?r.legend:void 0}},getParams:function mpt(e){return J0e},defaultValues:I.getDefaultValues(J0e),isApplicable:e=>!!e.structure,ensureCustomProperties:{attach:(e,t)=>t.structure?Vp.attach(e,t.structure,void 0,!0):Promise.resolve(),detach:e=>e.structure&&Vp.ref(e.structure,!1)}},gpt=ii.create({name:"computed-accessible-surface-area-prop",category:"custom-props",display:{name:"Accessible Surface Area"},ctor:class extends ii.Handler{constructor(){super(...arguments),this.provider=Vp,this.labelProvider={label:e=>{if(this.params.showTooltip)return function ypt(e){if("element-loci"===e.kind){if(0===e.elements.length)return;const t=Vp.get(e.structure).value;if(!t||e.structure.customPropertyDescriptors.hasReference(Vp.descriptor))return;const{getSerialIndex:n}=e.structure.root.serialMapping,{area:r,serialResidueIndex:i}=t,o=new Set;let s=0;for(const{indices:l,unit:c}of e.elements){const{elements:u}=c;Ve.forEach(l,d=>{const f=i[n(c,u[d])];-1!==f&&!o.has(f)&&(s+=r[f],o.add(f))})}return 0===o.size?void 0:`Accessible Surface Area (${o.size} ${o.size>1?"Residues sum":"Residue"}): ${s.toFixed(2)} \u212b2`}if("structure-loci"===e.kind){const t=Vp.get(e.structure).value;return!t||e.structure.customPropertyDescriptors.hasReference(Vp.descriptor)?void 0:`Accessible Surface Area (Whole Structure): ${foe(t.area).toFixed(2)} \u212b2`}}(e)}}}update(e){const t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t}register(){UN.addCustomProp(this.provider.descriptor),this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach),this.ctx.representation.structure.themes.colorThemeRegistry.add(tye),this.ctx.managers.lociLabels.addProvider(this.labelProvider),this.ctx.query.structure.registry.add(nye),this.ctx.query.structure.registry.add(rye)}unregister(){UN.removeCustomProp(this.provider.descriptor),this.ctx.customStructureProperties.unregister(this.provider.descriptor.name),this.ctx.representation.structure.themes.colorThemeRegistry.remove(tye),this.ctx.managers.lociLabels.removeProvider(this.labelProvider),this.ctx.query.structure.registry.remove(nye),this.ctx.query.structure.registry.remove(rye)}},params:()=>({autoAttach:I.Boolean(!1),showTooltip:I.Boolean(!0)})}),nye=hi("Buried Protein Residues",pe.struct.modifier.union([pe.struct.modifier.wholeResidues([pe.struct.modifier.union([pe.struct.generator.atomGroups({"chain-test":pe.core.rel.eq([pe.ammp("objectPrimitive"),"atomistic"]),"residue-test":$q.isBuried.symbol()})])])]),{description:"Select buried protein residues.",category:yi.Residue,ensureCustomProperties:(e,t)=>Vp.attach(e,t)}),rye=hi("Accessible Protein Residues",pe.struct.modifier.union([pe.struct.modifier.wholeResidues([pe.struct.modifier.union([pe.struct.generator.atomGroups({"chain-test":pe.core.rel.eq([pe.ammp("objectPrimitive"),"atomistic"]),"residue-test":$q.isAccessible.symbol()})])])]),{description:"Select accessible protein residues.",category:yi.Residue,ensureCustomProperties:(e,t)=>Vp.attach(e,t)});function ui(e,t){return e.model.atomicHierarchy.atoms.type_symbol.value(e.elements[t])}function iye(e,t){return e.model.atomicHierarchy.atoms.pdbx_formal_charge.value(e.elements[t])}function TP(e,t){return e.model.atomicHierarchy.atoms.label_atom_id.value(e.elements[t])}function LF(e,t){return e.model.atomicHierarchy.atoms.label_alt_id.value(e.elements[t])}function Xq(e,t){return e.model.atomicHierarchy.atoms.label_comp_id.value(e.elements[t])}function kg(e,t,n){return function bpt(e,t,n){let r=0;const i=e.interUnitBonds.getEdgeIndices(n,t.id);for(let o=0,s=i.length;o{ui(o,s)===r&&(i+=1)}),i}function Kq(e,t,n){const{offset:r,b:i,edgeProps:{flags:o}}=e.bonds;for(let s=r[t],a=r[t+1];s{"H"!==ui(s,a)&&(s.conformation.position(s.elements[a],TA),C.sub(UF,TA,J_),o.push(C.angle(jF,UF)))}),o}function sye(e,t,n,r,i){t.conformation.position(t.elements[n],J_),r.conformation.position(r.elements[i],zF),C.sub(jF,zF,J_);const o=[C(),C()];let a,l,s=0;if(Ju(e,t,n,(c,u)=>{s>1||"H"!==ui(c,u)&&(a=c,l=u,c.conformation.position(c.elements[u],TA),C.sub(o[s++],TA,J_))}),1===s&&a&&l&&Ju(e,a,l,(c,u)=>{s>1||c===t&&u===n||"H"!==ui(c,u)&&(c.conformation.position(c.elements[u],TA),C.sub(o[s++],TA,J_))}),2===s)return C.cross(UF,o[0],o[1]),Math.abs(Math.PI/2-C.angle(UF,jF))}const Zq=new fn.ElementBondIterator,Qq=new fn.ElementBondIterator,DA=new fn.ElementBondIterator,Jq=new fn.ElementBondIterator;function Ept(e,t,n,r){const i=Qu(e,t,n,"H"),o=ui(t,n);let s=iye(t,n);const a="always"===r.assignCharge||"auto"===r.assignCharge&&0===s,l="always"===r.assignH||"auto"===r.assignH&&0===i,c=kg(e,t,n),u=function Ipt(e,t,n){let r=0;const{offset:i,edgeProps:{flags:o,order:s}}=t.bonds;for(let a=i[n],l=i[n+1];a{const l=e.interUnitBonds.edges[a];Lr.isCovalent(l.props.flag)&&(r+=l.props.order)}),r}(e,t,n),d=function Apt(e,t,n){const r=ui(t,n),i="O"===r||"N"===r;if(i&&4===kg(e,t,n))return!1;for(Zq.setElement(e,t,n);Zq.hasNext;){const o=Zq.move();if(o.order>1)return!0;if(i){const s=ui(o.otherUnit,o.otherIndex);for(Qq.setElement(e,o.otherUnit,o.otherIndex);Qq.hasNext;){const a=Qq.move();if(a.order>1){if(("P"===s||"S"===s)&&"O"===ui(a.otherUnit,a.otherIndex))continue;return!0}}}}return!1}(e,t,n),f=u-c>0;let p=0,m=Wo.Unknown;switch(o){case"H":a&&(0===c?(s=1,m=Wo.Spherical):1===c&&(s=0,m=Wo.Terminal));break;case"C":a&&(s=0),l&&(p=Math.max(0,4-u-Math.abs(s))),m=EA(c+p+Math.max(0,-s));break;case"N":if(a)if(l)if(d&&u<4)s=c-i==1&&u-i==2?1:0;else for(DA.setElement(e,t,n);DA.hasNext;){const h=DA.move(),g=ui(h.otherUnit,h.otherIndex);if("S"===g||qJe(g)){s=0;break}s=1}else s=u-3;l&&(p=Math.max(0,3-u+s)),m=EA(d&&!f?c+p-s:c+p+1-s);break;case"O":if(a&&(l||(s=u-2),1===u)){DA.setElement(e,t,n);e:for(;DA.hasNext;){const h=DA.move();for(Jq.setElement(e,h.otherUnit,h.otherIndex);Jq.hasNext;){const g=Jq.move();if((g.otherUnit!==t||g.otherIndex!==n)&&"O"===ui(g.otherUnit,g.otherIndex)&&2===g.order){s=-1;break e}}}}l&&(p=Math.max(0,2-u+s)),m=EA(d&&!f?c+p-s+1:c+p-s+2);break;case"S":a&&(l||(s=u<=3&&0===Qu(e,t,n,"O")?u-2:0)),l&&u<2&&(p=Math.max(0,2-u+s)),u<=3&&(m=EA(c+p-s+2));break;case"F":case"CL":case"BR":case"I":case"AT":a&&(s=u-1);break;case"LI":case"NA":case"K":case"RB":case"CS":case"FR":a&&(s=1-u);break;case"BE":case"MG":case"CA":case"SR":case"BA":case"RA":a&&(s=2-u);break;default:$n&&console.warn("Requested charge, protonation for an unhandled element",o)}return[s,p,p+i,m]}function Tpt(e,t,n){const r=t.elements.length,i=new Int8Array(r),o=new Int8Array(r),s=new Int8Array(r),a=new Int8Array(r),l=!!e.parent;let c;if(l){const u=e.root.unitMap.get(t.id);if(c=rt.indicesOf(u.elements,t.elements),c.length!==t.elements.length)throw new Error("expected to find an index for every element");t=u,e=e.root}for(let u=0;utW,isApplicable:e=>!0,obtain:function(){var e=le(function*(t,n,r){const i={...I.getDefaultValues(tW),...r};return{value:yield Dpt(t.runtime,n,i)}});return function(n,r,i){return e.apply(this,arguments)}}()});var $o,nW,rW;!function(e){function n(d,f){const p=new Int32Array(f+1),m=new Int32Array(f),h=new Int32Array(f),{members:g,count:y,offsets:v}=d;for(let w=0,A=v[y];wi(f,h)}},e.createSubset=i,e.Info=function o(d,f,p){const m=DP.get(d).value;if(!m||!m.has(f.id))throw new Error("valence model required");return{unit:f,types:p.types,feature:-1,x:p.x,y:p.y,z:p.z,members:p.members,offsets:p.offsets,idealGeometry:m.get(f.id).idealGeometry}},e.position=function s(d,f){return C.set(d,f.x[f.feature],f.y[f.feature],f.z[f.feature]),C.transformMat4(d,d,f.unit.conformation.operator.matrix),d};const a=C(),l=C();e.distance=function c(d,f){const m=f.members[f.offsets[f.feature]];return d.unit.conformation.position(d.unit.elements[d.members[d.offsets[d.feature]]],a),f.unit.conformation.position(f.unit.elements[m],l),C.distance(a,l)},e.Provider=function u(d,f){return{types:new Set(d),add:f}}}($o||($o={})),function(e){e.create=function t(n=2048,r=1024,i){const o=tt.create(Float32Array,1,r,i?i.x:n),s=tt.create(Float32Array,1,r,i?i.y:n),a=tt.create(Float32Array,1,r,i?i.z:n),l=tt.create(Uint8Array,1,r,i?i.types:n),c=tt.create(Uint8Array,1,r,i?i.groups:n),u=tt.create(Uint32Array,1,r,i?i.offsets:n),d=tt.create(Uint32Array,1,r,i?i.members:n),f={x:0,y:0,z:0,offset:0,count:0};return{startState:()=>{f.x=0,f.y=0,f.z=0,f.offset=d.elementCount,f.count=0},pushMember:(p,m,h,g)=>{tt.add(d,g),f.x+=p,f.y+=m,f.z+=h,f.count+=1},finishState:(p,m)=>{const{count:h}=f;0!==h&&(tt.add(l,p),tt.add(c,m),tt.add(o,f.x/h),tt.add(s,f.y/h),tt.add(a,f.z/h),tt.add(u,f.offset))},add:(p,m,h,g,y,v)=>{tt.add(l,p),tt.add(c,m),tt.add(o,h),tt.add(s,g),tt.add(a,y),tt.add(u,d.elementCount),tt.add(d,v)},getFeatures:p=>{tt.add(u,d.elementCount);const m=tt.compact(o,!0),h=tt.compact(s,!0),g=tt.compact(a,!0);return $o.create(p,{x:m,y:h,z:g,count:o.elementCount,types:tt.compact(l,!0),groups:tt.compact(c,!0),offsets:tt.compact(u,!0),members:tt.compact(d,!0)})}}}}(nW||(nW={})),function(e){e.createElementsIndex=function t(n,r,i){const o=new Int32Array(i+1),s=new Int32Array(i),a=new Int32Array(i),{members:l,offsets:c}=r;for(let f=0,p=2*n.edgeCount;fh)){for(let g=c[m],y=c[m+1];gh)){for(let g=c[m],y=c[m+1];gd||(d=rW.createElementsIndex(u,n,r))})}}}}(iW||(iW={})),function(e){e.create=function t(){const n=new dp.Builder;return{startUnitPair(r,i){n.startUnitPair(r.id,i.id)},finishUnitPair(){n.finishUnitPair()},add(r,i,o){n.add(r,i,{type:o,flag:Mg.None})},getContacts:r=>new Ppt(n.getMap(),r)}}}(oW||(oW={}));const Npt={lineOfSightDistFactor:I.Numeric(1,{min:0,max:3,step:.1})},Fpt=3;function cye(e,t,n){const r=t.members[t.offsets[t.feature]],i=n.members[n.offsets[n.feature]];if(r===i&&t.unit===n.unit)return!1;const o=LF(t.unit,r),s=LF(n.unit,i);return!(o&&s&&o!==s||t.unit===n.unit&&t.unit.model.atomicHierarchy.residueAtomSegments.count>1&&t.unit.residueIndex[t.unit.elements[r]]===n.unit.residueIndex[n.unit.elements[i]]||function Spt(e,t,n,r,i){return t===r?function xpt(e,t,n){const{offset:r,b:i,edgeProps:{flags:o}}=e.bonds;for(let s=r[t],a=r[t+1];s{qpt.includes(ui(d,f))&&(u=!0)}),u&&n.add(7,ki.None,i[r[a]],o[r[a]],s[r[a]],a)}}}),eht={name:"halogen-bonds",params:zpt,createTester:e=>{const t=function Kpt(e){return{angleMax:Xr(e.angleMax)}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([6,7]),getType:(n,r,i)=>function Zpt(e,t,n,r){const i=t.types[t.feature];if(!function $pt(e,t){return 7===e&&6===t||6===e&&7===t}(i,n.types[n.feature]))return;const[s,a]=6===i?[t,n]:[n,t],l=s.members[s.offsets[s.feature]],c=a.members[a.offsets[a.feature]],u=VF(e,s.unit,l,a.unit,c);if(1!==u.length||Ypt-u[0]>r.angleMax)return;const d=VF(e,a.unit,c,s.unit,l);return 0===d.length||d.some(f=>Xpt-f>r.angleMax)?void 0:Er.HalogenBond}(n,r,i,t)}}},pye={distanceMax:I.Numeric(3.5,{min:1,max:5,step:.1}),backbone:I.Boolean(!0,{description:"Include backbone-to-backbone hydrogen bonds"}),accAngleDevMax:I.Numeric(45,{min:0,max:180,step:1},{description:"Max deviation from ideal acceptor angle"}),donAngleDevMax:I.Numeric(45,{min:0,max:180,step:1},{description:"Max deviation from ideal donor angle"}),accOutOfPlaneAngleMax:I.Numeric(90,{min:0,max:180,step:1}),donOutOfPlaneAngleMax:I.Numeric(45,{min:0,max:180,step:1})},tht={...pye,water:I.Boolean(!1,{description:"Include water-to-water hydrogen bonds"}),sulfurDistanceMax:I.Numeric(4.1,{min:1,max:5,step:.1})},nht={...pye};function lW(e,t){const n=DP.get(e).value;if(!n)throw Error("expected valence model to be available");const r=n.get(t.id);if(!r)throw Error("expected valence model for unit to be available");return r}function oht(e,t){const{elementAromaticRingIndices:n,all:r}=e.rings,i=n.get(t);if(void 0===i)return!1;for(let o=0,s=i.length;oMath.abs(a-u)>r.maxDonAngleDev))return;if(t.idealGeometry[i]===Wo.Trigonal){const u=sye(e,t.unit,i,n.unit,o);if(void 0!==u&&u>r.maxDonOutOfPlaneAngle)return}const l=VF(e,n.unit,o,t.unit,i),c=oye.get(n.idealGeometry[o])||bye;if(!l.some(u=>c-u>r.maxAccAngleDev)){if(n.idealGeometry[o]===Wo.Trigonal){const u=sye(e,n.unit,o,t.unit,i);if(void 0!==u&&u>r.maxAccOutOfPlaneAngle)return}return!0}}const mht=$o.Provider([4],function rht(e,t,n){const{totalH:r}=lW(e,t),{elements:i}=t,{x:o,y:s,z:a}=t.model.atomicConformation;for(let l=0,c=i.length;l0&&("N"===u||"O"===u||"S"===u))&&n.add(4,ki.None,o[i[l]],s[i[l]],a[i[l]],l)}}),ght=$o.Provider([9],function iht(e,t,n){const{totalH:r}=lW(e,t),{elements:i}=t,{x:o,y:s,z:a}=t.model.atomicConformation;for(let l=0,c=i.length;l0&&(Qu(e,t,l,"N")>0||Qu(e,t,l,"O")>0||oht(t,l))&&n.add(9,ki.None,o[i[l]],s[i[l]],a[i[l]],l)}),yht=$o.Provider([5],function sht(e,t,n){const{charge:r,implicitH:i,idealGeometry:o}=lW(e,t),{elements:s}=t,{x:a,y:l,z:c}=t.model.atomicConformation,u=d=>{n.add(5,ki.None,a[s[d]],l[s[d]],c[s[d]],d)};for(let d=0,f=s.length;d{const t=Math.max(e.distanceMax,e.sulfurDistanceMax),n=function fht(e){return{...yye(e),includeWater:e.water,maxSulfurDistSq:e.sulfurDistanceMax*e.sulfurDistanceMax,maxDistSq:e.distanceMax*e.distanceMax}}(e);return{maxDistance:t,requiredFeatures:new Set([4,5]),getType:(r,i,o,s)=>function pht(e,t,n,r,i){const s=n.types[n.feature];if(!function uht(e,t){return 5===e&&4===t||4===e&&5===t}(t.types[t.feature],s))return;const[a,l]=5===s?[t,n]:[n,t],c=a.members[a.offsets[a.feature]],u=l.members[l.offsets[l.feature]];return r>("S"===ui(a.unit,c)||"S"===ui(l.unit,u)?i.maxSulfurDistSq:i.maxDistSq)||!i.includeWater&&function cht(e,t,n,r){return hye(e,t)&&hye(n,r)}(a.unit,c,l.unit,u)||!vye(e,a,l,i)?void 0:Er.HydrogenBond}(r,i,o,s,n)}}},vht={name:"weak-hydrogen-bonds",params:nht,createTester:e=>{const t=yye(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([9,5]),getType:(n,r,i,o)=>function hht(e,t,n,r,i){const s=n.types[n.feature];if(!function dht(e,t){return 9===e&&5===t||5===e&&9===t}(t.types[t.feature],s))return;const[a,l]=5===s?[t,n]:[n,t];return vye(e,a,l,i)?Er.WeakHydrogenBond:void 0}(n,r,i,0,t)}}};function _ht(e,t,n){return"S"===ui(t,n)&&3===Qu(e,t,n,"O")}function Sht(e,t,n){return"S"===ui(t,n)&&4===Qu(e,t,n,"O")}function _ye(e,t,n){return"P"===ui(t,n)&&Qu(e,t,n,"O")===kg(e,t,n)}function wht(e,t,n){let r=0;return"C"===ui(t,n)&&2===Qu(e,t,n,"O")&&1===Qu(e,t,n,"C")&&Ju(e,t,n,(i,o)=>{"O"===ui(i,o)&&kg(e,i,o)-Qu(e,i,o,"H")==1&&(r+=1)}),2===r}function Aht(e,t,n){let r=0;return"C"===ui(t,n)&&3===kg(e,t,n)&&3===Qu(e,t,n,"N")&&Ju(e,t,n,(i,o)=>{kg(e,i,o)-Qu(e,i,o,"H")==1&&(r+=1)}),2===r}function Iht(e,t,n){let r=0;return"C"===ui(t,n)&&3===kg(e,t,n)&&2===Qu(e,t,n,"N")&&1===Qu(e,t,n,"C")&&Ju(e,t,n,(i,o)=>{kg(e,i,o)-Qu(e,i,o,"H")==1&&(r+=1)}),2===r}const Eht=new Set(["N","O","S","F","CL","BR","I"]);const Pht={distanceMax:I.Numeric(5,{min:0,max:8,step:.1})},kht={distanceMax:I.Numeric(5.5,{min:1,max:8,step:.1}),offsetMax:I.Numeric(2,{min:0,max:4,step:.1}),angleDevMax:I.Numeric(30,{min:0,max:180,step:1})},Mht={distanceMax:I.Numeric(6,{min:1,max:8,step:.1}),offsetMax:I.Numeric(2,{min:0,max:4,step:.1})},Rht=["ARG","HIS","LYS"],Nht=["GLU","ASP"];function Sye(e,t){const n=DP.get(e).value;if(!n)throw Error("expected valence model to be available");const r=n.get(t.id);if(!r)throw Error("expected valence model for unit to be available");return r}const Cye=C(),wye=C(),HF=C(),PA=C(),GF=C(),qF=C();function cW(e,t){const{unit:n,feature:r,offsets:i,members:o}=t,{elements:s}=n,a=i[r];return t.unit.conformation.position(s[o[a]],HF),t.unit.conformation.position(s[o[a+1]],PA),t.unit.conformation.position(s[o[a+2]],GF),C.triangleNormal(e,HF,PA,GF)}const uW=function(e,t,n){return $o.position(HF,e),$o.position(PA,t),C.sub(GF,HF,PA),C.projectOnPlane(qF,GF,n),C.add(qF,qF,PA),C.distance(qF,PA)},qht=Xr(180),Aye=Xr(90),PP=C(),dW=C();const Xht=$o.Provider([2],function Oht(e,t,n){const{charge:r}=Sye(e,t),{elements:i}=t,{x:o,y:s,z:a}=t.model.atomicConformation,l=new Set,{label_comp_id:c}=t.model.atomicHierarchy.atoms,u=En.transientSegments(t.model.atomicHierarchy.residueAtomSegments,i);for(;u.hasNext;){const{index:d,start:f,end:p}=u.move(),m=c.value(t.model.atomicHierarchy.residueAtomSegments.offsets[d]);if(Nht.includes(m)){n.startState();for(let h=f;h{"O"===ui(t,y)&&n.pushMember(o[i[y]],s[i[y]],a[i[y]],y)}),n.finishState(2,ki.Phosphate));else if(!yw.has(m)){for(let h=f;h{"O"===ui(t,v)&&(l.add(v),n.pushMember(o[i[v]],s[i[v]],a[i[v]],v))}),n.finishState(2,g))}for(let h=f;h{"N"===ui(t,v)&&(l.add(v),n.pushMember(o[i[v]],s[i[v]],a[i[v]],v))}),n.finishState(1,g))}for(let h=f;h0&&!l.has(h)&&n.add(1,ki.None,o[i[h]],s[i[h]],a[i[h]],h)}}}),Zht=$o.Provider([3],function Bht(e,t,n){const{elements:r}=t,{x:i,y:o,z:s}=t.model.atomicConformation;for(const a of t.rings.aromaticRings){const l=t.rings.all[a];n.startState();for(let c=0,u=l.length;c{const t=function Vht(e){return{distanceMaxSq:e.distanceMax*e.distanceMax}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([2,1]),getType:(n,r,i,o)=>function Wht(e,t,n,r,i){if(function Lht(e,t){return 2===e&&1===t||1===e&&2===t}(t.types[t.feature],n.types[n.feature])&&function zht(e,t,n){const{feature:r,offsets:i,members:o}=e,{feature:s,offsets:a,members:l}=t;for(let c=i[r],u=i[r+1];c{const t=function Hht(e){return{offsetMax:e.offsetMax,angleDevMax:Xr(e.angleDevMax)}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([3]),getType:(n,r,i,o)=>function $ht(e,t,n,r,i){if(function jht(e,t){return 3===e&&3===t}(t.types[t.feature],n.types[n.feature])){cW(PP,t),cW(dW,n);const a=C.angle(PP,dW);if(Math.min(uW(t,n,dW),uW(n,t,PP))<=i.offsetMax){if(a<=i.angleDevMax||a>=qht-i.angleDevMax)return Er.PiStacking;if(a<=i.angleDevMax+Aye&&a>=Aye-i.angleDevMax)return Er.PiStacking}}}(0,r,i,0,t)}}},emt={name:"cation-pi",params:Mht,createTester:e=>{const t=function Ght(e){return{offsetMax:e.offsetMax}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([3,1]),getType:(n,r,i,o)=>function Yht(e,t,n,r,i){const o=t.types[t.feature];if(function Uht(e,t){return 3===e&&1===t||1===e&&3===t}(o,n.types[n.feature])){const[a,l]=3===o?[t,n]:[n,t];if(cW(PP,a),uW(l,a,PP)<=i.offsetMax)return Er.CationPi}}(0,r,i,0,t)}}},tmt={distanceMax:I.Numeric(4,{min:1,max:5,step:.1})},omt=$o.Provider([8],function nmt(e,t,n){const{elements:r}=t,{x:i,y:o,z:s}=t.model.atomicConformation;for(let a=0,l=r.length;a{const p=ui(d,f);"C"!==p&&"H"!==p&&(u=!1)})):"F"===c&&(u=!0),u&&n.add(8,ki.None,i[r[a]],o[r[a]],s[r[a]],a)}}),smt={name:"hydrophobic",params:tmt,createTester:e=>({maxDistance:e.distanceMax,requiredFeatures:new Set([8]),getType:(t,n,r,i)=>function imt(e,t,n,r){if(!function rmt(e,t){return 8===e&&8===t}(t.types[t.feature],n.types[n.feature]))return;const a=n.members[n.offsets[n.feature]];return"F"!==ui(t.unit,t.members[t.offsets[t.feature]])||"F"!==ui(n.unit,a)?Er.Hydrophobic:void 0}(0,n,r)})},amt={distanceMax:I.Numeric(3,{min:1,max:5,step:.1})},lmt=["LI","NA","K","RB","CS","MG","CA","SR","BA","AL","GA","IN","TL","SC","SN","PB","BI","SB","HG"];function Iye(e){return!Y0.has(e)}function umt(e){return Y0.has(e)}function dmt(e){return XR.has(e)}function Eye(e,t){return 12===e?11===t||12===t:13===e?10===t:void 0}const hmt=$o.Provider([13,12],function cmt(e,t,n){const{elements:r}=t,{x:i,y:o,z:s}=t.model.atomicConformation;for(let a=0,l=r.length;a({maxDistance:e.distanceMax,requiredFeatures:new Set([13,12,10,11]),getType:(t,n,r,i)=>function pmt(e,t,n,r){const i=t.types[t.feature],o=n.types[n.feature];if(Eye(i,o)||Eye(o,i))return Er.MetalCoordination}(0,n,r)})};function bmt(e,t){const{contacts:n}=t,r=function(c,u,d,f,p){const[m,h]=f.get(d)||[1/0,-1];cn.edges[c].props.flag=Mg.Filtered;let a,l;return{isApplicable:c=>c===Er.Hydrophobic,handleInterContact:(c,u,d)=>{i(c,u,d,o,s)},startUnit:(c,u,d)=>{a=new Map,l=f=>u.edgeProps.flag[f]=Mg.Filtered},handleIntraContact:(c,u,d)=>{i(c,u,d,a,l)}}}function vmt(e,t){const{contacts:n}=t,r=(i,o)=>{const s=9===i.types[i.feature]?o:i,a=s.members[s.offsets[s.feature]],{edgeProps:{type:l},elementsIndex:{offsets:c,indices:u}}=t.unitsContacts.get(s.unit.id);for(let f=c[a],p=c[a+1];fi===Er.WeakHydrogenBond,handleInterContact:(i,o,s)=>{r(o,s)&&(n.edges[i].props.flag=Mg.Filtered)},startUnit:()=>{},handleIntraContact:(i,o,s)=>{if(r(o,s)){const{flag:a}=t.unitsContacts.get(o.unit.id).edgeProps;a[i]=Mg.Filtered}}}}function fW(e,t,n,r,i){const{offsets:o,feature:s}=n,{offsets:a,feature:l}=r;for(let c=o[s],u=o[s+1];cr===Er.Ionic,handleInterContact:(r,i,o)=>{fW([Er.HydrogenBond,Er.WeakHydrogenBond],r,i,o,n)},startUnit:()=>{},handleIntraContact:(r,i,o)=>{pW([Er.HydrogenBond,Er.WeakHydrogenBond],r,i,o,t.unitsContacts.get(i.unit.id))}}}function _mt(e,t){const{contacts:n}=t;return{isApplicable:r=>r===Er.Hydrophobic||r===Er.CationPi,handleInterContact:(r,i,o)=>{fW([Er.PiStacking],r,i,o,n)},startUnit:()=>{},handleIntraContact:(r,i,o)=>{pW([Er.PiStacking],r,i,o,t.unitsContacts.get(i.unit.id))}}}function Smt(e,t){const{contacts:n}=t;return{isApplicable:r=>r===Er.Ionic,handleInterContact:(r,i,o)=>{fW([Er.MetalCoordination],r,i,o,n)},startUnit:()=>{},handleIntraContact:(r,i,o)=>{pW([Er.MetalCoordination],r,i,o,t.unitsContacts.get(i.unit.id))}}}var Vy;!function(e){function i(u,d){const{unitA:f,indexA:p,unitB:m,indexB:h}=d,{contacts:g,unitsContacts:y}=u;if(f===m){const v=y.get(f.id),x=v.getDirectedEdgeIndex(p,h);return lye(v.edgeProps.type[x])}{const v=g.getEdgeIndex(p,f.id,h,m.id);return lye(g.edges[v].props.type)}}function l(u,d,f){const{unitsFeatures:p}=u;return X0.fromPairProvider(d.length,(m,h,g)=>{const y=d[m];$o.setPosition(h,y.unitA,y.indexA,p.get(y.unitA.id)),$o.setPosition(g,y.unitB,y.indexB,p.get(y.unitB.id))},f)}function c(u,d,f){const p=f[0];if(void 0===p)return"";const{unitA:m,indexA:h,unitB:g,indexB:y}=p,{unitsFeatures:v}=d,{members:x,offsets:_}=v.get(m.id),{members:w,offsets:A}=v.get(g.id),M={granularity:"element"};return(_[h+1]-_[h]>1||A[y+1]-A[y]>1)&&(M.granularity="residue"),[i(d,p),NG(fn.Location(u,m,x[_[h]],u,g,w[A[y]]),M)].join("
")}e.Location=function t(u,d,f,p,m,h){return zue("interactions",{structure:d,interactions:u},{unitA:f,indexA:p,unitB:m,indexB:h})},e.isLocation=function n(u){return!!u&&"data-location"===u.kind&&"interactions"===u.tag},e.areLocationsEqual=function r(u,d){return u.data.structure===d.data.structure&&u.data.interactions===d.data.interactions&&u.element.indexA===d.element.indexA&&u.element.indexB===d.element.indexB&&u.element.unitA===d.element.unitA&&u.element.unitB===d.element.unitB},e.locationLabel=function o(u){return i(u.data.interactions,u.element)},e.Loci=function s(u,d,f){return ZN("interactions",{structure:u,interactions:d},f,p=>l(d,f,p),()=>c(u,d,f))},e.isLoci=function a(u){return!!u&&"data-loci"===u.kind&&"interactions"===u.tag},e.getBoundingSphere=l,e.getLabel=c}(Vy||(Vy={}));const Cmt=[mht,ght,yht,Xht,Kht,Zht,Qpt,Jpt,omt,hmt,mmt],WF={ionic:Qht,"pi-stacking":Jht,"cation-pi":emt,"halogen-bonds":eht,"hydrogen-bonds":bht,"weak-hydrogen-bonds":vht,hydrophobic:smt,"metal-coordination":gmt},Amt=function wmt(e=[]){const t=Object.create(null);return Object.keys(WF).forEach(n=>{t[n]=I.MappedStatic(e.includes(n)?"on":"off",{on:I.Group(WF[n].params),off:I.Group({})},{cycle:!0})}),t}(["cation-pi","pi-stacking","hydrogen-bonds","halogen-bonds","metal-coordination"]),Tye={providers:I.Group(Amt,{isFlat:!0}),contacts:I.Group(Npt,{label:"Advanced Options"})};function Imt(e,t,n){return hW.apply(this,arguments)}function hW(){return hW=le(function*(e,t,n){const r={...I.getDefaultValues(Tye),...n};yield DP.attach(e,t);const i=[];DR(WF).forEach(d=>{const{name:f,params:p}=r.providers[d];"on"===f&&i.push(WF[d].createTester(p))});const o=new Set;i.forEach(d=>Lo.add(o,d.requiredFeatures));const s=Cmt.filter(d=>Lo.areIntersecting(o,d.types)),a=sp.Mutable(),l=sp.Mutable();for(let d=0,f=t.unitSymmetryGroups.length;d{const a=t.get(o.id),l=t.get(s.id);!function Upt(e,t,n,r,i,o,s,a){const{count:l,x:c,y:u,z:d}=n,{lookup3d:f}=i,p=fe.mul(jpt,r.conformation.operator.inverse,t.conformation.operator.matrix),m=!fe.isIdentity(p),h=C(),g=Math.max(...s.map(M=>M.maxDistance)),{center:y,radius:v}=f.boundary.sphere,x=(v+g)*(v+g),_=a.lineOfSightDistFactor,w=$o.Info(e,t,n),A=$o.Info(e,r,i);o.startUnitPair(t,r);for(let M=0;Mx)continue;const{indices:E,count:D,squaredDistances:T}=f.find(h[0],h[1],h[2],g);if(0!==D){w.feature=M;for(let F=0;Fo.maxDistance)),validUnit:o=>ze.isAtomic(o),validUnitPair:(o,s)=>Xe.validUnitPair(e,o,s)}),i.getContacts(t)}(t,a,i,r.contacts),u={unitsFeatures:a,unitsContacts:l,contacts:c};return function ymt(e,t){const{contacts:n,unitsContacts:r,unitsFeatures:i}=t,o=[bmt(0,t),vmt(0,t),xmt(0,t),_mt(0,t),Smt(0,t)];for(let a=0,l=n.edgeCount;amW,isApplicable:e=>!e.isCoarseGrained,obtain:function(){var e=le(function*(t,n,r){const i={...I.getDefaultValues(mW),...r};return{value:yield Imt(t,n,i)}});return function(n,r,i){return e.apply(this,arguments)}}()}),gW=st(13421772),pu_HydrogenBond=2851770,pu_Hydrophobic=8421504,pu_HalogenBond=4259775,pu_Ionic=15779860,pu_MetalCoordination=9191577,pu_CationPi=16744448,pu_PiStacking=9220966,pu_WeakHydrogenBond=12967404,kmt=[["Hydrogen Bond",pu_HydrogenBond],["Hydrophobic",pu_Hydrophobic],["Halogen Bond",pu_HalogenBond],["Ionic",pu_Ionic],["Metal Coordination",pu_MetalCoordination],["Cation Pi",pu_CationPi],["Pi Stacking",pu_PiStacking],["Weak HydrogenBond",pu_WeakHydrogenBond]];function Dye(e){switch(e){case Er.HydrogenBond:return pu_HydrogenBond;case Er.Hydrophobic:return pu_Hydrophobic;case Er.HalogenBond:return pu_HalogenBond;case Er.Ionic:return pu_Ionic;case Er.MetalCoordination:return pu_MetalCoordination;case Er.CationPi:return pu_CationPi;case Er.PiStacking:return pu_PiStacking;case Er.WeakHydrogenBond:return pu_WeakHydrogenBond;case Er.Unknown:return gW}}const Pye={},yW={name:"interaction-type",label:"Interaction Type",category:Rd.Category.Misc,factory:function kye(e,t){let n;const r=e.structure?ks.get(e.structure):void 0,i=r?Yx(r.id,r.version):-1;return n=r&&r.value?o=>{if(Vy.isLocation(o)){const{unitsContacts:s,contacts:a}=o.data.interactions,{unitA:l,unitB:c,indexA:u,indexB:d}=o.element;if(l===c){const f=s.get(l.id),p=f.getDirectedEdgeIndex(u,d);return Dye(f.edgeProps.type[p])}{const f=a.getEdgeIndex(u,l.id,d,c.id);return Dye(a.edges[f].props.type)}}return gW}:()=>gW,{factory:kye,granularity:"group",color:n,props:t,contextHash:i,description:"Assigns colors according the interaction type of a link.",legend:v1(kmt)}},getParams:function Mmt(e){return Pye},defaultValues:I.getDefaultValues(Pye),isApplicable:e=>!!e.structure,ensureCustomProperties:{attach:(e,t)=>t.structure?ks.attach(e,t.structure,void 0,!0):Promise.resolve(),detach:e=>e.structure&&ks.ref(e.structure,!1)}};function Ff(e,t,n,r){let i=0;const{webgl:o}=t,s=new si,a=new Xn.GeometryState,l=ky(),c=[],u=gl.create();let d,f,p,m,h=Ia.createEmpty();function w(E){if(gl.update(u,E),void 0!==E.visible&&d&&d.setVisibility(E.visible&&(null===u.unitTransforms||u.unitTransforms.isIdentity)),void 0!==E.alphaFactor&&d&&d.setAlphaFactor(E.alphaFactor),void 0!==E.pickable&&d&&d.setPickable(E.pickable),void 0!==E.overpaint&&d){const D=Ea.remap(E.overpaint,f);d.setOverpaint(D,o)}if(void 0!==E.transparency&&d){const D=dc.remap(E.transparency,f);d.setTransparency(D,o)}if(void 0!==E.substance&&d){const D=fc.remap(E.substance,f);d.setSubstance(D,o)}if(void 0!==E.clipping&&d){const D=co.remap(E.clipping,f);d.setClipping(D)}void 0!==E.themeStrength&&d&&d.setThemeStrength(E.themeStrength),void 0!==E.transform&&d&&d.setTransform(E.transform),void 0!==E.unitTransforms&&d&&d.setVisibility(u.visible&&(null===E.unitTransforms||E.unitTransforms.isIdentity))}return{label:e,get groupCount(){return d?d.groupCount:0},get props(){return m},get params(){return p},get state(){return u},get theme(){return h},get geometryVersion(){return a.version},renderObjects:c,updated:s,createOrUpdate:function g(E={},D){return D&&D!==f&&(p=n(t,D),f=D,m||(m=I.getDefaultValues(p))),m=Object.assign({},m,E),Ke.create("Creating or updating ComplexRepresentation",function(){var T=le(function*(F){var R;let N=!1;d?null!==(R=d.mustRecreate)&&void 0!==R&&R.call(d,f,m,o)&&(d.destroy(),d=r(l,f,m,o),N=!0):(d=r(l,f,m,o),N=!0);const j=d.createOrUpdate({webgl:o,runtime:F},h,m,D);j&&(yield j),N&&w(u),c.length=0,d&&d.renderObject&&(c.push(d.renderObject),a.add(d.renderObject.id,d.geometryVersion)),a.snapshot(),i+=1,s.next(i)});return function(F){return T.apply(this,arguments)}}())},setState:w,setTheme:function A(E){h=E},getLoci:function y(E){return d?d.getLoci(E):qr},getAllLoci:function v(){var E;return[Xe.Loci(null!==(E=f.child)&&void 0!==E?E:f)]},eachLocation:function x(E){d?.eachLocation(E)},mark:function _(E,D){if(!f||!uc.is(u.markerActions,D))return!1;if(Xe.isLoci(E)||Me.is(E)||fn.isLoci(E)){if(!Xe.areRootsEquivalent(E.structure,f))return!1;E=Yn.remap(E,f),(Xe.isLoci(E)||Me.is(E)&&Me.isWholeStructure(E))&&(E=KN)}else if(!Xu(E)&&!aP(E))return!1;return!Yn.isEmpty(E)&&!!d&&d.mark(E,D)},destroy:function M(){d&&d.destroy()}}}const Rmt=fe.toArray;function Mye(e,t,n){const{elements:r,model:i}=t;if(-1!==Ve.indexOf(r,n)){const{index:o,offsets:s}=i.atomicHierarchy.residueAtomSegments,a=o[n],l=[];for(let u=s[a],d=s[a+1];us.unitMap.has(d.id)):e.group.units,l=a.length,c=16*l,u=o&&o.aTransform.ref.value.length>=c?o.aTransform.ref.value:new Float32Array(c);for(let d=0;dl-a);const i=Math.floor(Math.cbrt(n)*Math.cbrt(n)),o=r[0]*r[1];return{area:o,areaCells:Math.ceil(o/(t*t)),maxAreaCells:i}}function sv(e,t,n=Nye){const{area:r,areaCells:i,maxAreaCells:o}=Fye(e,t.resolution,n),s=i>o?Math.sqrt(r/o):t.resolution;return{...t,resolution:s}}const $F={ignoreHydrogens:I.Boolean(!1,{description:"Whether or not to include hydrogen atoms in the surface calculation."}),ignoreHydrogensVariant:I.Select("all",I.arrayToOptions(["all","non-polar"])),traceOnly:I.Boolean(!1,{description:"Whether or not to only use trace atoms in the surface calculation."}),includeParent:I.Boolean(!1,{description:"Include elements of the parent structure in surface calculation to get a surface patch of the current structure."})},jmt=(I.getDefaultValues($F),C());function Oye(e,t,n,r){return C.squaredDistance(C.set(jmt,e,t,n),r)}function YF(e,t,n,r){const{ignoreHydrogens:i,ignoreHydrogensVariant:o,traceOnly:s,includeParent:a}=r,l=a?e.root.unitMap.get(t.id):t,c=a&&l!==t,{x:u,y:d,z:f}=function Lmt(e){switch(e.kind){case 0:return e.model.atomicConformation;case 1:return e.model.coarseConformation.spheres;case 2:return e.model.coarseConformation.gaussians}}(l),{elements:p}=l,{center:m,radius:h}=t.boundary.sphere,y=(h+11)*(h+11);let v,x;if(i||s||c){const E=[],D=[];for(let T=0,F=p.length;Ty||(E.push(R),D.push(T))}v=rt.ofSortedArray(E),x=D}else v=p,x=Sd(new Int32Array(v.length));a&&l!==t&&function Umt(e,t,n){let r=0;const i=t.length;for(let o=0,s=n.length;o(A.element=E,n.size(A))}}function XF(e,t,n){const{ignoreHydrogens:r,ignoreHydrogensVariant:i,traceOnly:o,includeParent:s}=n,a=s&&!!e.parent,l=dt.create(e.root),{center:c,radius:u}=e.boundary.sphere,f=(u+11)*(u+11);let p,m,h,g,y,v;if(r||o||a){const{getSerialIndex:A}=e.serialMapping,M=a?e.root.units:e.units,E=[],D=[],T=[],F=[],R=[];for(let N=0,j=M.length;Nf||(E.push(te),D.push(K),T.push(Q),l.element=oe,F.push(t.size(l)),a?-1===(V?rt.indexOf(V.elements,oe):-1)?R.push(-2):R.push(A(V,oe)):R.push(A(W,oe)))}}p=E,m=D,h=T,g=F,y=R,v=Ve.ofRange(0,y.length)}else{const{elementCount:A}=e,M=new Float32Array(A),E=new Float32Array(A),D=new Float32Array(A),T=new Float32Array(A);for(let F=0,R=0,N=e.units.length;Fg[A]}}const Bye=v5.H;function rm(e,t,n,r){if(ze.isCoarse(t)||t.model.atomicHierarchy.derived.atom.atomicNumber[n]!==Bye)return!1;if("all"===r)return!0;const i=function Dht(e,t,n){let r=!1;return Ju(e,t,n,(i,o)=>{(function Tht(e){return Eht.has(e)})(ui(i,o))&&(r=!0)}),r}(e,t,rt.indexOf(t.elements,n));return!!(i&&"polar"===r||!i&&"non-polar"===r)}function zmt(e,t){return e[t]===Bye}function bW(e,t){if(ze.isCoarse(e))return!0;const n=e.model.atomicHierarchy.atoms.label_atom_id.value(t);return"CA"===n||"BB"===n||"P"===n}function MP(e){return I.MultiSelect(e,Omt,{description:"For which kinds of units/chains to show the representation visuals."})}const ed={unitKinds:MP(["atomic","spheres"]),includeParent:I.Boolean(!1,{isHidden:!0})},Lye={...on.Params},jye={...Rp.Params},Uye={...Wu.Params},Vmt={...G1.Params},zye={...Mo.Params},Vye={...Tf.Params},Hye={...Df.Params},Gye={...iu.Params};function e2(e,t){const{defaultProps:n,createGeometry:r,createLocationIterator:i,getLoci:o,eachLocation:s,setUpdateState:a,mustRecreate:l,processValues:c,dispose:u}=e,{updateValues:d,updateBoundingSphere:f,updateRenderableState:p,createPositionIterator:m}=e.geometryUtils,h=Ag.create(),g={loci:qr,action:un.None,status:-1};let y,v,x,_,M,E,T,F,w=Object.assign({},n),A=Ia.createEmpty(),D=-1;function N(V){if(h.createNew){if(T=i(_,v),!V)throw new Error("expected geometry to be given");y=function Hmt(e,t,n,r,i,o){const{createValues:s,createRenderableState:a}=$a.getUtils(t),c=s(t,E9(),n,r,i),u=a(i);return Jw(t.kind,c,u,o)}(0,V,T,x,v,t),F=m(V,y.values)}else{if(!y)throw new Error("expected renderObject to be available");if(h.updateTransform){T=i(_,v);const{instanceCount:X,groupCount:H}=T;v.instanceGranularity?hs(X,"instance",y.values):hs(X*H,"groupInstance",y.values)}if(h.createGeometry){if(!V)throw new Error("expected geometry to be given");O.updateIfChanged(y.values.drawCount,$a.getDrawCount(V)),O.updateIfChanged(y.values.uVertexCount,$a.getVertexCount(V)),O.updateIfChanged(y.values.uGroupCount,$a.getGroupCount(V))}(h.updateTransform||h.createGeometry)&&(f(y.values,V||E),F=m(E,y.values)),h.updateSize&&"uSize"in y.values&&xy(T,x.size,y.values),h.updateColor&&Ef(T,F,x.color,y.values),d(y.values,v),p(y.state,v)}w=v,A=x,M=_,V&&(E=V,D+=1)}function z(V,X,H){return function j(V){return!!(Xu(V)||Xe.isLoci(V)&&Xe.areRootsEquivalent(V.structure,M)||Me.is(V)&&Xe.areRootsEquivalent(V.structure,M)&&Me.isWholeStructure(V))}(V)?X(Pe.ofBounds(0,w.instanceGranularity?T.instanceCount:T.groupCount*T.instanceCount)):w.instanceGranularity?function W(V,X,H){let oe=!1;return!(!Me.is(V)&&!fn.isLoci(V)||!Xe.areEquivalent(V.structure,X))&&(H(Pe.ofSingleton(0))&&(oe=!0),oe)}(V,M,X):s(V,M,X,H)}function $(V){y&&c?.(y.values,E,w,A,V.webgl)}return{get groupCount(){return T?T.count:0},get renderObject(){return T&&T.count?y:void 0},get geometryVersion(){return D},createOrUpdate(V,X,H={},oe){if(function R(V,X,H){if(!H&&!M)throw new Error("missing structure");if(v=Object.assign({},w,X),x=V,_=H,Ag.reset(h),!y||!M)return h.createNew=!0,void(h.createGeometry=!0);a(h,v,w,x,A,_,M),Xe.areEquivalent(_,M)||(h.createGeometry=!0),Xe.areHierarchiesEqual(_,M)||(h.updateTransform=!0,h.createGeometry=!0),Rd.areEqual(V.color,A.color)||(h.updateColor=!0),tg(v.unitKinds,w.unitKinds)||(h.createGeometry=!0),M.child!==_.child&&(h.createGeometry=!0),v.instanceGranularity!==w.instanceGranularity&&(h.updateTransform=!0),h.updateSize&&!("uSize"in y.values)&&(h.createGeometry=!0),h.createGeometry&&(h.updateColor=!0,h.updateSize=!0)}(X,H,oe||M),h.createGeometry){const te=r(V,_,x,v,E);if(PR(te))return te.then(K=>{N(K),$(V)});N(te)}else N();$(V)},getLoci:V=>y?o(V,M,y.id):qr,eachLocation(V){for(T.reset();T.hasNext;){const{location:X,isSecondary:H}=T.move();V(X,H)}},mark:(V,X)=>pr.mark(y,V,X,z,g),setVisibility(V){pr.setVisibility(y,V)},setAlphaFactor(V){pr.setAlphaFactor(y,V)},setPickable(V){pr.setPickable(y,V)},setColorOnly(V){pr.setColorOnly(y,V)},setTransform(V,X){pr.setTransform(y,V,X)},setOverpaint(V,X){pr.setOverpaint(y,V,z,!0,{geometry:E,props:w,webgl:X})},setTransparency(V,X){pr.setTransparency(y,V,z,!0,{geometry:E,props:w,webgl:X})},setSubstance(V,X){pr.setSubstance(y,V,z,!0,{geometry:E,props:w,webgl:X})},setClipping(V){pr.setClipping(y,V,z,!0)},setThemeStrength(V){pr.setThemeStrength(y,V)},destroy(){u?.(E),y&&(y.state.disposed=!0,y=void 0)},mustRecreate:l}}const kA={...Lye,...ed};function Hy(e,t){return e2({...e,setUpdateState:(n,r,i,o,s,a,l)=>{e.setUpdateState(n,r,i,o,s,a,l),Ya.areEqual(o.size,s.size)||(n.createGeometry=!0)},geometryUtils:on.Utils},t)}const Gmt={...jye,...ed},Wmt={...Uye,...ed},Ymt={...zye,...ed},Kmt={...Vye,...ed},Qmt={...Hye,...ed},egt={...Gye,...ed};function Uo(e,t,n,r){let i=0;const{webgl:o}=t,s=new si,a=ky(),l=[],c=new Xn.GeometryState,u=gl.create();let f,p,m,h,d=new Map,g=Ia.createEmpty();function A(T,F,R){const{visible:N,alphaFactor:j,pickable:W,overpaint:z,transparency:$,substance:V,clipping:X,themeStrength:H,transform:oe,unitTransforms:te}=R;void 0!==N&&T.setVisibility(N),void 0!==j&&T.setAlphaFactor(j),void 0!==W&&T.setPickable(W),void 0!==z&&T.setOverpaint(z,o),void 0!==$&&T.setTransparency($,o),void 0!==V&&T.setSubstance(V,o),void 0!==X&&T.setClipping(X),void 0!==H&&T.setThemeStrength(H),void 0!==oe&&(oe!==u.transform||!fe.areEqual(oe,u.transform,wi))&&T.setTransform(oe),void 0!==te&&(te?T.setTransform(void 0,te.getSymmetryGroupTransforms(F)):te!==u.unitTransforms&&T.setTransform(void 0,null))}return{label:e,get groupCount(){let T=0;return d.forEach(({visual:F})=>{F.renderObject&&(T+=F.groupCount)}),T},get geometryVersion(){return c.version},get props(){return h},get params(){return m},get state(){return u},get theme(){return g},renderObjects:l,updated:s,createOrUpdate:function y(T={},F){return F&&F!==f&&(m=n(t,F),h||(h=I.getDefaultValues(m))),h=Object.assign({},h,T),Ke.create("Creating or updating UnitsRepresentation",function(){var R=le(function*(N){var j,W,z;if(!f&&!F)throw new Error("missing structure");if(F&&!f){p=F.unitSymmetryGroups;for(let $=0;$$.push(V));for(let V=0,X=$.length;V{V.destroy()})}l.length=0,d.forEach(({visual:$})=>{$.renderObject&&(l.push($.renderObject),c.add($.renderObject.id,$.geometryVersion))}),c.snapshot(),F&&(f=F),s.next(i++)});return function(N){return R.apply(this,arguments)}}())},setState:function M(T){const{visible:F,alphaFactor:R,pickable:N,overpaint:j,transparency:W,substance:z,clipping:$,themeStrength:V,transform:X,unitTransforms:H,syncManually:oe,markerActions:te}=T,K={};void 0!==F&&(K.visible=F),void 0!==R&&(K.alphaFactor=R),void 0!==N&&(K.pickable=N),void 0!==j&&f&&(K.overpaint=Ea.remap(j,f)),void 0!==W&&f&&(K.transparency=dc.remap(W,f)),void 0!==z&&f&&(K.substance=fc.remap(z,f)),void 0!==$&&f&&(K.clipping=co.remap($,f)),void 0!==V&&(K.themeStrength=V),void 0!==X&&!fe.areEqual(X,u.transform,wi)&&(K.transform=X),(H!==u.unitTransforms||H?.version!==u.unitTransformsVersion)&&(K.unitTransforms=H,u.unitTransformsVersion=H?H?.version:-1),void 0!==oe&&(K.syncManually=oe),void 0!==te&&(K.markerActions=te),d.forEach(({visual:Q,group:G})=>A(Q,G,K)),gl.update(u,K)},setTheme:function E(T){g=T},getLoci:function v(T){let F=qr;return d.forEach(({visual:R})=>{const N=R.getLoci(T);uu(N)||(F=N)}),F},getAllLoci:function _(){var T;return[Xe.Loci(null!==(T=f.child)&&void 0!==T?T:f)]},eachLocation:function x(T){d.forEach(({visual:F})=>{F.eachLocation(T)})},mark:function w(T,F){if(!f||!uc.is(u.markerActions,F))return!1;if(Xe.isLoci(T)||Me.is(T)||fn.isLoci(T)){if(!Xe.areRootsEquivalent(T.structure,f))return!1;T=Yn.remap(T,f),(Xe.isLoci(T)||Me.is(T)&&Me.isWholeStructure(T))&&(T=KN)}else if(!Xu(T)&&!aP(T))return!1;if(Yn.isEmpty(T))return!1;let R=!1;return d.forEach(({visual:N})=>{R=N.mark(T,F)||R}),R},destroy:function D(){d.forEach(({visual:T})=>T.destroy()),d.clear()}}}function av(e,t){const{defaultProps:n,createGeometry:r,createLocationIterator:i,getLoci:o,eachLocation:s,setUpdateState:a,mustRecreate:l,processValues:c,dispose:u}=e,{createEmpty:d,updateValues:f,updateBoundingSphere:p,updateRenderableState:m,createPositionIterator:h}=e.geometryUtils,g=Ag.create(),y={loci:qr,action:un.None,status:-1};let v,w,A,M,E,D,F,R,x=Object.assign({},n),_=Ia.createEmpty(),T=-1;function j(H){if(g.createNew){if(F=i(w,x),!H)throw new Error("expected geometry to be given");v=function ngt(e,t,n,r,i,o){const{createValues:s,createRenderableState:a}=$a.getUtils(t),c=s(t,Rye(e,i.includeParent,t.boundingSphere,i.cellSize,i.batchSize),n,r,i),u=a(i);return Jw(t.kind,c,u,o)}(w,H,F,_,x,t),R=h(H,v.values)}else{if(!v)throw new Error("expected renderObject to be available");if(g.updateTransform){F=i(w,x);const{instanceCount:oe,groupCount:te}=F;x.instanceGranularity?hs(oe,"instance",v.values):hs(oe*te,"groupInstance",v.values)}if(g.updateMatrix&&(Rye(w,x.includeParent,v.values.invariantBoundingSphere.ref.value,x.cellSize,x.batchSize,v.values),"lodLevels"in v.values&&O.update(v.values.lodLevels,v.values.lodLevels.ref.value)),g.createGeometry){if(!H)throw new Error("expected geometry to be given");O.updateIfChanged(v.values.drawCount,$a.getDrawCount(H)),O.updateIfChanged(v.values.uVertexCount,$a.getVertexCount(H)),O.updateIfChanged(v.values.uGroupCount,$a.getGroupCount(H))}(g.updateTransform||g.createGeometry)&&(p(v.values,H||D),R=h(H||D,v.values)),g.updateSize&&"uSize"in v.values&&xy(F,_.size,v.values),g.updateColor&&Ef(F,R,_.color,v.values),f(v.values,x),m(v.state,x)}A=x,M=_,E=w,H&&(D=H,T+=1)}function V(H,oe,te){return function z(H){return!!(Xu(H)||Xe.isLoci(H)&&Xe.areRootsEquivalent(H.structure,E.structure)||Me.is(H)&&Xe.areRootsEquivalent(H.structure,E.structure)&&Me.isWholeStructure(H))}(H)?oe(Pe.ofBounds(0,A.instanceGranularity?F.instanceCount:F.groupCount*F.instanceCount)):A.instanceGranularity?function $(H,oe,te){let K=!1;if(fn.isLoci(H)){const{structure:Q,group:G}=oe;if(!Xe.areEquivalent(H.structure,Q))return!1;for(const Z of H.bonds){if(Z.aUnit!==Z.bUnit)continue;const ee=G.unitIndexMap.get(Z.aUnit.id);void 0!==ee&&te(Pe.ofSingleton(ee))&&(K=!0)}}else if(Me.is(H)){const{structure:Q,group:G}=oe;if(!Xe.areEquivalent(H.structure,Q))return!1;for(const Z of H.elements){const ee=G.unitIndexMap.get(Z.unit.id);void 0!==ee&&te(Pe.ofSingleton(ee))&&(K=!0)}}return K}(H,E,oe):s(H,E,oe,te)}function X(H){v&&c?.(v.values,D,A,M,H.webgl)}return{get groupCount(){return F?F.count:0},get renderObject(){return F&&F.count?v:void 0},get geometryVersion(){return T},createOrUpdate(H,oe,te,K){if(function N(H,oe,te){if(!te&&!E)throw new Error("missing structureGroup");if(x=oe,_=H,w=te,Ag.reset(g),!v||!E)return g.createNew=!0,void(g.createGeometry=!0);a(g,x,A,_,M,w,E),Xe.areHierarchiesEqual(E.structure,w.structure)||(g.updateTransform=!0,g.updateColor=!0,g.updateSize=!0),Rd.areEqual(_.color,M.color)||(g.updateColor=!0),E.structure.child!==w.structure.child&&(g.createGeometry=!0),(x.instanceGranularity!==A.instanceGranularity||x.cellSize!==A.cellSize||x.batchSize!==A.batchSize)&&(g.updateTransform=!0),tg(x.unitKinds,A.unitKinds)||(g.createGeometry=!0),w.group.transformHash!==E.group.transformHash&&(w.group.units.length!==E.group.units.length||g.updateColor?g.updateTransform=!0:g.updateMatrix=!0);const K=w.group.units[0],Q=E.group.units[0];ze.areOperatorsEqual(K,Q)||(g.updateTransform=!0),ze.areConformationsEqual(K,Q)||(g.createGeometry=!0),g.updateTransform&&(g.updateMatrix=!0),g.updateSize&&!("uSize"in v.values)&&(g.createGeometry=!0),(g.createGeometry||g.updateTransform)&&(E.structure.hashCode!==w.structure.hashCode&&(g.updateColor=!0,g.updateSize=!0),(_.color.granularity.startsWith("vertex")||v.values.dColorType.ref.value.startsWith("vertex")||_.color.granularity.startsWith("volume")||v.values.dColorType.ref.value.startsWith("volume"))&&(g.updateColor=!0))}(oe,te,K||E),g.createGeometry){const Q=function W(H,oe,te,K,Q,G){return function Bmt(e,t){for(let n=0,r=e.length;n{j(G),X(H)});j(Q)}else j();X(H)},getLoci:H=>v?o(H,E,v.id):qr,eachLocation(H){for(F.reset();F.hasNext;){const{location:oe,isSecondary:te}=F.move();H(oe,te)}},mark(H,oe){let te=!0;if(Me.is(H)){te=!1;const{invariantId:K}=E.group.units[0];for(const Q of H.elements)if(Q.unit.invariantId===K){te=!0;break}}return!!te&&pr.mark(v,H,oe,V,y)},setVisibility(H){pr.setVisibility(v,H)},setAlphaFactor(H){pr.setAlphaFactor(v,H)},setPickable(H){pr.setPickable(v,H)},setColorOnly(H){pr.setColorOnly(v,H)},setTransform(H,oe){pr.setTransform(v,H,oe)},setOverpaint(H,oe){pr.setOverpaint(v,H,V,!0,{geometry:D,props:A,webgl:oe})},setTransparency(H,oe){pr.setTransparency(v,H,V,!0,{geometry:D,props:A,webgl:oe})},setSubstance(H,oe){pr.setSubstance(v,H,V,!0,{geometry:D,props:A,webgl:oe})},setClipping(H){pr.setClipping(v,H,V,!0)},setThemeStrength(H){pr.setThemeStrength(v,H)},destroy(){u?.(D),v&&(v.state.disposed=!0,v=void 0)},mustRecreate:l}}const ml={...Lye,...ed};function mc(e,t){return av({...e,setUpdateState:(n,r,i,o,s,a,l)=>{e.setUpdateState(n,r,i,o,s,a,l),Ya.areEqual(o.size,s.size)||(n.createGeometry=!0)},geometryUtils:on.Utils},t)}const vW={...jye,...ed};function xW(e,t){return av({...e,setUpdateState:(n,r,i,o,s,a,l)=>{e.setUpdateState(n,r,i,o,s,a,l),Ya.areEqual(o.size,s.size)||(n.updateSize=!0)},geometryUtils:Rp.Utils},t)}const _W={...Uye,...ed};function SW(e,t){return av({...e,setUpdateState:(n,r,i,o,s,a,l)=>{e.setUpdateState(n,r,i,o,s,a,l),Ya.areEqual(o.size,s.size)||(n.updateSize=!0)},geometryUtils:Wu.Utils},t)}const rgt={...Vmt,...ed},KF={...zye,...ed};function ZF(e,t){return av({...e,setUpdateState:(n,r,i,o,s,a,l)=>{e.setUpdateState(n,r,i,o,s,a,l),Ya.areEqual(o.size,s.size)||(n.updateSize=!0)},geometryUtils:Mo.Utils},t)}const ogt={...Hye,...ed},agt={...Gye,...ed},gl={create:()=>({...Xn.createState(),unitTransforms:null,unitTransformsVersion:-1}),update:(e,t)=>{Xn.updateState(e,t),void 0!==t.unitTransforms&&(e.unitTransforms=t.unitTransforms)}},Gy=C(),MA=C(),RP=C(),QF=tt.add,qye=tt.add3;var NP;!function(e){e.create=function t(n=2048,r=1024,i){const o=tt.create(Float32Array,1,r,i?i.groupBuffer.ref.value:n),s=tt.create(Float32Array,3,r,i?i.startBuffer.ref.value:n),a=tt.create(Float32Array,3,r,i?i.endBuffer.ref.value:n),l=tt.create(Float32Array,1,r,i?i.scaleBuffer.ref.value:n),c=tt.create(Float32Array,1,r,i?i.capBuffer.ref.value:n),u=tt.create(Float32Array,1,r,i?i.colorModeBuffer.ref.value:n),d=(p,m,h,g,y,v,x,_,w,A,M)=>{for(let E=0;E<6;++E)qye(s,p,m,h),qye(a,g,y,v),QF(o,M),QF(l,x),QF(c,(_?1:0)+(w?2:0)),QF(u,A)},f=(p,m,h,g,y,v,x,_,w)=>{const A=C.distance(p,m),M=h%2!=0,E=Math.floor((h+1)/2),D=A/(h+.5);let T=2;C.setMagnitude(RP,C.sub(RP,m,p),D),C.copy(Gy,p);for(let F=0;F{const w=C.distance(p,m);f(p,m,w/h,g,y,v,!0,x,_)},getCylinders:()=>{const p=o.elementCount/6,m=tt.compact(o,!0),h=tt.compact(s,!0),g=tt.compact(a,!0),y=tt.compact(l,!0),v=tt.compact(c,!0),x=tt.compact(u,!0),_=i&&p<=i.cylinderCount?i.mappingBuffer.ref.value:new Float32Array(18*p),w=i&&p<=i.cylinderCount?i.indexBuffer.ref.value:new Uint32Array(12*p);return(!i||p>i.cylinderCount)&&function cgt(e,t,n){for(let r=0;r0,X=l(z),H=a?a(z):0,oe=w&&!!u&&u(z),[te,K]=V?[oe,m]:[m,oe];if(M.currentGroup=z,0===H)N.radiusTop=N.radiusBottom=X,N.topCap=te,N.bottomCap=K,Ur(M,E,D,.5,N);else if(1===H)N.radiusTop=N.radiusBottom=X*x,N.topCap=N.bottomCap=_,Yw(M,E,D,.5,v,oe,N);else if(2===H||3===H||4===H||5===H||7===H||8===H){const Q=2===H||3===H?2:4===H||5===H?3:1.5,G=X*(d/(.5*Q)),Z=(X-G)*f;if(CW(T,E,D,o?o(z):null),N.topCap=te,N.bottomCap=K,7===H||8===H){N.radiusTop=N.radiusBottom=X,Ur(M,E,D,.5,N);const ee=X+h*X+h*X*g;gc($i,ha($i,D,E),.5*X),ts(E,E,$i),ha(D,D,$i),N.radiusTop=N.radiusBottom=X*h,N.topCap=N.bottomCap=_,gc(T,T,ee),ha(E,E,T),ha(D,D,T),Yw(M,E,D,.5,y,oe,N),8===H&&(gc(T,T,2*ee),ts(E,E,T),ts(D,D,T),Yw(M,E,D,.5,y,oe,N))}else if(3===H||5===H){const ee=X+G+d*X*f;gc(T,T,ee),N.radiusTop=N.radiusBottom=X,Ur(M,E,D,.5,N),im($i,$i,f*d*.2),ts(E,E,$i),ha(D,D,$i),N.radiusTop=N.radiusBottom=G,N.topCap=V?oe:_,N.bottomCap=V?_:oe,gc(T,T,ee),ha(E,E,T),ha(D,D,T),Ur(M,E,D,.5,N),3===Q&&(gc(T,T,2*ee),ts(E,E,T),ts(D,D,T),Ur(M,E,D,.5,N))}else gc(T,T,Z),N.radiusTop=N.radiusBottom=G,3===Q&&Ur(M,E,D,.5,N),UKe(M,E,D,.5,T,N)}else 6===H&&(im($i,$i,.475),ts(E,E,$i),ha(D,D,$i),N.radiusTop=N.radiusBottom=X,N.topCap=te,N.bottomCap=K,Ur(M,E,D,.5,N))}const j=r?ke.clone(r.boundingSphere):void 0,W=Ct.getMesh(M);return 0===R?{mesh:W}:(C.scale(F,F,1/R),j&&C.distance(F,j.center)/j.radius<.1?{mesh:W,boundingSphere:j}:{mesh:W})}function $ye(e,t,n,r){const{linkCount:i,referencePosition:o,position:s,style:a,radius:l,ignore:c,stub:u}=t;if(!i)return{cylinders:Wu.createEmpty(r)};const{linkScale:d,linkSpacing:f,linkCap:p,aromaticScale:m,aromaticSpacing:h,aromaticDashCount:g,dashCount:y,dashScale:v,dashCap:x,stubCap:_,colorMode:w}=n,A="interpolate"===w,M=!0===A?3:2,E=2*i,D=NP.create(E,E/4,r),T=C(),F=C(),R=C(),N=C(),j=C();let W=0;for(let V=0,X=i;V{const oe=w[H];if(M&&"all"===E||oe!==Er.HydrogenBond&&oe!==Er.WeakHydrogenBond)C.set(V,f[v[H]],p[v[H]],m[v[H]]),C.set(X,f[x[H]],p[x[H]],m[x[H]]);else{const te=h[g[v[H]]],K=h[g[x[H]]];F.invariantPosition(T[te],N),F.invariantPosition(T[K],j);let Q=C.distance(N,j),G=Q;C.copy(V,N),C.copy(X,j),Kq(t,te,(Z,ee)=>{if(rm(n,t,T[ee],"polar")){F.invariantPosition(T[ee],R);const se=C.distance(R,j);se{if(rm(n,t,T[ee],"polar")){F.invariantPosition(T[ee],R);const se=C.distance(R,N);se1,radius:V=>{l.element=T[h[g[v[V]]]];const X=r.size.size(l);l.element=T[h[g[x[V]]]];const H=r.size.size(l);return Math.min(X,H)*A},ignore:V=>{if(_[V]===Mg.Filtered)return!0;if(a)if("stub"===D){const X=v[V];for(let H=g[X],oe=g[X+1];H0){const V=ke.expand(ke(),(a??t).boundary.sphere,1*A);z.setBoundingSphere(V)}return z})).apply(this,arguments)}const Kye={...ml,...t2,...Xye};function pgt(e){return mc({defaultProps:I.getDefaultValues(Kye),createGeometry:fgt,createLocationIterator:ggt,getLoci:hgt,eachLocation:mgt,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.dashCount!==r.dashCount||n.dashScale!==r.dashScale||n.dashCap!==r.dashCap||n.radialSegments!==r.radialSegments||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.parentDisplay!==r.parentDisplay;const l=ks.get(s.structure).version;t.info.interactionsHash!==l&&(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.info.interactionsHash=l)}},e)}function hgt(e,t,n){const{objectId:r,instanceId:i,groupId:o}=e;if(n===r){const{structure:s,group:a}=t,l=s.unitMap.get(a.units[i].id),c=ks.get(s).value,{a:u,b:d}=c.unitsContacts.get(l.id);return Vy.Loci(s,c,[{unitA:l,indexA:u[o],unitB:l,indexB:d[o]},{unitA:l,indexA:d[o],unitB:l,indexB:u[o]}])}return qr}const AW=new Set;function mgt(e,t,n,r){let i=!1;if(Vy.isLoci(e)){const{structure:o,group:s}=t;if(!Xe.areEquivalent(e.data.structure,o))return!1;const a=ks.get(o).value;if(e.data.interactions!==a)return!1;const c=a.unitsContacts.get(s.units[0].id),u=2*c.edgeCount;for(const d of e.elements){if(d.unitA!==d.unitB)continue;const f=s.unitIndexMap.get(d.unitA.id);if(void 0!==f){const p=c.getDirectedEdgeIndex(d.indexA,d.indexB);-1!==p&&n(Pe.ofSingleton(f*u+p))&&(i=!0)}}}else if(Me.is(e)){const{structure:o,group:s}=t;if(!Xe.areEquivalent(e.structure,o))return!1;const a=ks.get(o).value;if(!a)return!1;const l=s.units[0],c=a.unitsContacts.get(l.id),u=a.unitsFeatures.get(l.id),d=2*c.edgeCount,{offset:f}=c,{offsets:p,indices:m}=u.elementsIndex,{members:h,offsets:g}=u;for(const y of e.elements){const v=s.unitIndexMap.get(y.unit.id);void 0!==v&&(Ve.forEach(y.indices,x=>{for(let _=p[x],w=p[x+1];_{if(r){const _=c.a[x];for(let A=g[_],M=g[_+1];A{const p=n.units[f];return c.unitA=p,c.indexA=o.a[d],c.unitB=p,c.indexB=o.b[d],l})}function ygt(e,t,n,r,i){if(!t.hasAtomic)return on.createEmpty(i);const o=dt.create(t),s=ks.get(t).value,{contacts:a,unitsFeatures:l}=s,{edgeCount:c,edges:u}=a,{sizeFactor:d,ignoreHydrogens:f,ignoreHydrogensVariant:p,parentDisplay:m}=r;if(!c)return on.createEmpty(i);const{child:h}=t,g=C(),y=C(),v=C(),x={linkCount:c,position:(A,M,E)=>{const{unitA:D,indexA:T,unitB:F,indexB:R,props:{type:N}}=u[E],j=l.get(D),W=l.get(F),z=t.unitMap.get(D),$=t.unitMap.get(F);if(f&&"all"===p||N!==Er.HydrogenBond&&N!==Er.WeakHydrogenBond)C.set(A,j.x[T],j.y[T],j.z[T]),C.transformMat4(A,A,z.conformation.operator.matrix),C.set(M,W.x[R],W.y[R],W.z[R]),C.transformMat4(M,M,$.conformation.operator.matrix);else{const V=j.members[j.offsets[T]],X=W.members[W.offsets[R]];z.conformation.position(z.elements[V],y),$.conformation.position($.elements[X],v);let H=C.distance(y,v),oe=H;C.copy(A,y),C.copy(M,v),Ju(t,z,V,(te,K)=>{const Q=te.elements[K];if(rm(t,te,Q,"polar")){te.conformation.position(Q,g);const G=C.distance(g,v);G{const Q=te.elements[K];if(rm(t,te,Q,"polar")){te.conformation.position(Q,g);const G=C.distance(g,y);G1,radius:A=>{const M=u[A],E=l.get(M.unitA);o.unit=t.unitMap.get(M.unitA),o.element=o.unit.elements[E.members[E.offsets[M.indexA]]];const D=n.size.size(o),T=l.get(M.unitB);o.unit=t.unitMap.get(M.unitB),o.element=o.unit.elements[T.members[T.offsets[M.indexB]]];const F=n.size.size(o);return Math.min(D,F)*d},ignore:A=>{if(u[A].props.flag===Mg.Filtered)return!0;if(h){const M=u[A];if("stub"===m){const E=h.unitMap.get(M.unitA);if(!E)return!0;const D=t.unitMap.get(M.unitA),{offsets:T,members:F}=l.get(M.unitA);for(let R=T[M.indexA],N=T[M.indexA+1];R0){const{child:A}=t,M=ke.expand(ke(),(A??t).boundary.sphere,1*d);_.setBoundingSphere(M)}return _}const Zye={...kA,...t2,...Xye};function bgt(e){return Hy({defaultProps:I.getDefaultValues(Zye),createGeometry:ygt,createLocationIterator:_gt,getLoci:vgt,eachLocation:xgt,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.dashCount!==r.dashCount||n.dashScale!==r.dashScale||n.dashCap!==r.dashCap||n.radialSegments!==r.radialSegments||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.parentDisplay!==r.parentDisplay;const l=ks.get(s).version;t.info.interactionsHash!==l&&(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.info.interactionsHash=l)}},e)}function vgt(e,t,n){const{objectId:r,groupId:i}=e;if(n===r){const o=ks.get(t).value,s=o.contacts.edges[i],a=t.unitMap.get(s.unitA),l=t.unitMap.get(s.unitB);return Vy.Loci(t,o,[{unitA:a,indexA:s.indexA,unitB:l,indexB:s.indexB},{unitA:l,indexA:s.indexB,unitB:a,indexB:s.indexA}])}return qr}const JF=new Map,IW=new Set;function xgt(e,t,n,r){let i=!1;if(Vy.isLoci(e)){if(!Xe.areEquivalent(e.data.structure,t))return!1;const o=ks.get(t).value;if(e.data.interactions!==o)return!1;const{contacts:s}=o;for(const a of e.elements){const l=s.getEdgeIndex(a.indexA,a.unitA.id,a.indexB,a.unitB.id);-1!==l&&n(Pe.ofSingleton(l))&&(i=!0)}}else if(Me.is(e)){if(!Xe.areEquivalent(e.structure,t)||r&&1===e.elements.length)return!1;const o=ks.get(t).value;if(!o)return!1;const{contacts:s,unitsFeatures:a}=o;for(const l of e.elements)JF.set(l.unit.id,l.indices);for(const l of e.elements){const{unit:c}=l;ze.isAtomic(c)&&Ve.forEach(l.indices,u=>{for(const d of s.getContactIndicesForElement(u,c))IW.add(d)})}IW.forEach(l=>{if(r){const{indexA:c,unitA:u,indexB:d,unitB:f}=s.edges[l],p=JF.get(u),m=JF.get(f);if(!p||!m)return;const{offsets:h,members:g}=a.get(u);for(let x=h[c],_=h[c+1];x<_;++x)if(!Ve.has(p,g[x]))return;const{offsets:y,members:v}=a.get(f);for(let x=y[d],_=y[d+1];x<_;++x)if(!Ve.has(m,v[x]))return}n(Pe.ofSingleton(l))&&(i=!0)}),JF.clear(),IW.clear()}return i}function _gt(e){const t=ks.get(e).value,{contacts:n}=t,r=n.edgeCount,o=Vy.Location(t,e),{element:s}=o;return Vi(r,1,1,l=>{const c=n.edges[l];return s.unitA=e.unitMap.get(c.unitA),s.indexA=c.indexA,s.unitB=e.unitMap.get(c.unitB),s.indexB=c.indexB,o},!0)}const Qye={"intra-unit":(e,t)=>Uo("Intra-unit interactions cylinder",e,t,pgt),"inter-unit":(e,t)=>Ff("Inter-unit interactions cylinder",e,t,bgt)},Jye={...Kye,...Zye,unitKinds:MP(["atomic"]),sizeFactor:I.Numeric(.2,{min:.01,max:1,step:.01}),visuals:I.MultiSelect(["intra-unit","inter-unit"],I.objectToOptions(Qye))},eO={name:"interactions",label:"Non-covalent Interactions",description:"Displays non-covalent interactions as dashed cylinders.",factory:function Cgt(e,t){return Xn.createMulti("Interactions",e,t,gl,Qye)},getParams:function Sgt(e,t){return I.clone(Jye)},defaultValues:I.getDefaultValues(Jye),defaultColorTheme:{name:"interaction-type"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.elementCount>0&&ks.isApplicable(e),ensureCustomProperties:{attach:(e,t)=>ks.attach(e,t,void 0,!0),detach:e=>ks.ref(e,!1)},getData:(e,t)=>t.includeParent?e.asParent():e,mustRecreate:(e,t)=>e.includeParent!==t.includeParent},wgt=ii.create({name:"computed-interactions-prop",category:"custom-props",display:{name:"Interactions"},ctor:class extends ii.Handler{constructor(){super(...arguments),this.provider=ks,this.labelProvider={label:e=>{if(this.params.showTooltip&&"element-loci"===e.kind){if(0===e.elements.length)return;const t=[],n=this.getStructures(e.structure);for(const r of n){const i=this.provider.get(r).value;if(!i)continue;const o=Me.remap(e,r);if(1!==o.elements.length)continue;const s=o.elements[0];if(1!==Ve.size(s.indices))continue;const a=i.unitsFeatures.get(s.unit.id);if(!a)continue;const l=[],c=[],u=[],d=Ve.start(s.indices),{types:f,groups:p,elementsIndex:{indices:m,offsets:h}}=a;for(let g=h[d],y=h[d+1];gTypes ${l.join(", ")}`),c.length&&u.push(`Groups ${c.join(", ")}`),u.length&&t.push(`Interaction Feature: ${u.join(" | ")}`)}return t.length?t.join("
"):void 0}}}}getStructures(e){const t=[],n=this.ctx.helpers.substructureParent.get(e);if(n){const i=this.ctx.state.data.select(Qn.Generators.ofType(Se.Molecule.Structure,n.transform.ref));for(const o of i)o.obj&&Us(t,o.obj.data)}return t}update(e){const t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t}register(){this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach),this.ctx.representation.structure.themes.colorThemeRegistry.add(yW),this.ctx.managers.lociLabels.addProvider(this.labelProvider),this.ctx.representation.structure.registry.add(eO)}unregister(){this.ctx.customStructureProperties.unregister(this.provider.descriptor.name),this.ctx.representation.structure.themes.colorThemeRegistry.remove(yW),this.ctx.managers.lociLabels.removeProvider(this.labelProvider),this.ctx.representation.structure.registry.remove(eO)}},params:()=>({autoAttach:I.Boolean(!1),showTooltip:I.Boolean(!0)})}),Agt=ii.create({name:"computed-secondary-structure-prop",category:"custom-props",display:{name:"Secondary Structure"},ctor:class extends ii.Handler{constructor(){super(...arguments),this.provider=gp}update(e){const t=this.params.autoAttach!==e.autoAttach;return this.params.autoAttach=e.autoAttach,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t}register(){this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach)}unregister(){this.ctx.customStructureProperties.unregister(this.provider.descriptor.name)}},params:()=>({autoAttach:I.Boolean(!1)})}),Igt=ii.create({name:"computed-valence-model-prop",category:"custom-props",display:{name:"Valence Model"},ctor:class extends ii.Handler{constructor(){super(...arguments),this.provider=DP,this.labelProvider={label:e=>{if(this.params.showTooltip&&"element-loci"===e.kind){if(0===e.elements.length)return;const t=[],n=this.getStructures(e.structure);for(const r of n){const i=this.provider.get(r).value;if(!i)continue;const o=Me.remap(e,r);if(1!==o.elements.length)continue;const s=o.elements[0];if(1!==Ve.size(s.indices))continue;const a=i.get(s.unit.id);if(!a)continue;const l=Ve.start(s.indices),d=a.implicitH[l],f=a.totalH[l];t.push(`Valence Model: Charge ${a.charge[l]} | Ideal Geometry ${wpt(a.idealGeometry[l])} | Implicit H ${d} | Total H ${f}`)}return t.length?t.join("
"):void 0}}}}getStructures(e){const t=[],n=this.ctx.helpers.substructureParent.get(e);if(n){const i=this.ctx.state.data.select(Qn.Generators.ofType(Se.Molecule.Structure,n.transform.ref));for(const o of i)o.obj&&Us(t,o.obj.data)}return t}update(e){const t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t}register(){this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach),this.ctx.managers.lociLabels.addProvider(this.labelProvider)}unregister(){this.ctx.customStructureProperties.unregister(this.provider.descriptor.name),this.ctx.managers.lociLabels.removeProvider(this.labelProvider)}},params:()=>({autoAttach:I.Boolean(!1),showTooltip:I.Boolean(!0)})}),EW=st(16448250),FP=new Map,ebe={...cu({type:"colors",colorList:"set-1"})},nbe={name:"sifts-mapping",label:"SIFTS Mapping",category:Rd.Category.Residue,factory:function tbe(e,t){let n;if(e.structure){for(const a of e.structure.models){const l=yp.Provider.get(a).value;if(l)for(const c of l.accession)!c||FP.has(c)||FP.set(c,FP.size)}const r=dt.create(e.structure),i=Yu(FP.size+1,t,{valueLabel:a=>`${a}`}),o=new Map,s=a=>{const l=yp.getKey(a);if(!l)return EW;if(o.has(l))return o.get(l);const c=i.color(FP.get(l));return o.set(l,c),c};n=a=>dt.is(a)&&ze.isAtomic(a.unit)?s(a):fn.isLocation(a)?(r.unit=a.aUnit,r.element=a.aUnit.elements[a.aIndex],s(r)):EW}else n=()=>EW;return{factory:tbe,granularity:"group",preferSmoothing:!0,color:n,props:t,description:"Assigns a color based on SIFTS mapping."}},getParams:function Tgt(e){return ebe},defaultValues:I.getDefaultValues(ebe),isApplicable:e=>{var t;return!(null===(t=e.structure)||void 0===t||!t.models.some(n=>yp.Provider.isApplicable(n)))},ensureCustomProperties:{attach:function(){var e=le(function*(t,n){if(n.structure)for(const r of n.structure.models)yield yp.Provider.attach(t,r,void 0,!0)});return function(n,r){return e.apply(this,arguments)}}(),detach:e=>{if(e.structure)for(const t of e.structure.models)yp.Provider.ref(t,!1)}}},Dgt=ii.create({name:"sifts-mapping-prop",category:"custom-props",display:{name:"SIFTS Mapping"},ctor:class extends ii.Handler{constructor(){super(...arguments),this.provider=yp.Provider,this.labelProvider={label:e=>{if(this.params.showTooltip)return function Pgt(e){if("element-loci"===e.kind){if(0===e.elements.length)return;const t=e.elements[0],n=t.unit,r=dt.create(e.structure,n,n.elements[Ve.getAt(t.indices,0)]);return yp.getLabel(r)}}(e)}}}update(e){const t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t}register(){this.ctx.customModelProperties.register(this.provider,this.params.autoAttach),this.ctx.representation.structure.themes.colorThemeRegistry.add(nbe),this.ctx.managers.lociLabels.addProvider(this.labelProvider)}unregister(){this.ctx.customModelProperties.unregister(this.provider.descriptor.name),this.ctx.representation.structure.themes.colorThemeRegistry.remove(nbe),this.ctx.managers.lociLabels.removeProvider(this.labelProvider)}},params:()=>({autoAttach:I.Boolean(!0),showTooltip:I.Boolean(!0)})});var qy;!function(e){e.Descriptor={name:"ihm_cross_link_restraint"},e.Provider=jh.create(e.Descriptor),e.fromTable=function t(n,r){const i={entity_id:n.entity_id_1,asym_id:n.asym_id_1,seq_id:n.seq_id_1,atom_id:n.atom_id_1},o={entity_id:n.entity_id_2,asym_id:n.asym_id_2,seq_id:n.seq_id_2,atom_id:n.atom_id_2};function s(p,m,h){const g=p.get(m);g?g.push(h):p.set(m,[h])}function a(p,m){const h=m.entity_id.value(p),g=m.asym_id.value(p),y=m.seq_id.value(p);if("by-atom"===n.model_granularity.value(p)){const v=r.atomicHierarchy.index.findAtom({auth_seq_id:y,label_asym_id:g,label_atom_id:m.atom_id.value(p),label_entity_id:h});v>=0&&s(c,v,p)}else if(r.coarseHierarchy.isDefined){const v=r.coarseHierarchy.spheres.findSequenceKey(h,g,y);if(v>=0)s(u,v,p);else{const x=r.coarseHierarchy.gaussians.findSequenceKey(h,g,y);x>=0&&s(d,x,p)}}}const c=new Map,u=new Map,d=new Map,f=[];for(let p=0;p{const g=function l(p){switch(p){case 0:return c;case 1:return u;case 2:return d}}(m).get(p);return void 0!==g?g:f},data:n}}}(qy||(qy={}));const kgt=[];function rbe(e,t,n,r){return`${e}|${t.id}|${n}|${r.id}`}class ibe{getPairIndices(t,n,r,i){const o=rbe(t,n,r,i);return this.pairKeyIndices.get(o)||kgt}getPairs(t,n,r,i){return this.getPairIndices(t,n,r,i).map(s=>this.pairs[s])}constructor(t){this.pairs=t;const n=new Map;this.pairs.forEach((r,i)=>{const o=rbe(r.indexA,r.unitA,r.indexB,r.unitB),s=n.get(o);s?s.push(i):n.set(o,[i])}),this.count=t.length,this.pairKeyIndices=n}}const Wy=iy.createProvider({label:"Cross Link Restraint",descriptor:hf({name:"integrative-cross-link-restraint"}),type:"local",defaultParams:{},getParams:e=>({}),isApplicable:e=>e.models.some(t=>!!qy.Provider.get(t)),obtain:function(){var e=le(function*(t,n,r){return{value:Ngt(n)}});return function(n,r,i){return e.apply(this,arguments)}}()});var om;function obe(e,t,n){const{elements:r}=t,i=r.length,o=t.kind;for(let s=0;se.set(l,s))}function Mgt(e,t,n){if(t.model!==n.model||"mmCIF"!==t.model.sourceData.kind)return;const r=qy.Provider.get(t.model);if(!r)return;const i=new Map,o=new Map;obe(i,t,r),obe(o,n,r),i.forEach((s,a)=>{const l=o.get(a);void 0!==l&&e.push(tO(t,s,n,l,r,a),tO(n,l,t,s,r,a))})}function Rgt(e,t){if("mmCIF"!==t.model.sourceData.kind)return;const n=qy.Provider.get(t.model);if(!n)return;const{elements:r}=t,i=r.length,o=t.kind,s=new Map;for(let a=0;a{const u=s.get(c);u?u.push(a):s.set(c,[a])});s.forEach((a,l)=>{if(a.length<2)return;const[c,u]=a;e.push(tO(t,c,t,u,n,l),tO(t,u,t,c,n,l))})}function tO(e,t,n,r,i,o){return{unitA:e,indexA:t,unitB:n,indexB:r,restraintType:i.data.restraint_type.value(o),distanceThreshold:i.data.distance_threshold.value(o),psi:i.data.psi.value(o),sigma1:i.data.sigma_1.value(o),sigma2:i.data.sigma_2.value(o)}}function Ngt(e){const t=[];if(!e.models.some(r=>qy.Provider.get(r)))return new ibe(t);const n=e.units.length;for(let r=0;r{const m=o.pairs[p],h=m.unitA,g=m.unitB;h.conformation.position(h.elements[m.indexA],d),g.conformation.position(g.elements[m.indexB],f)},radius:d=>{const f=o.pairs[d];return a.unit=f.unitA,a.element=f.unitA.elements[f.indexA],n.size.size(a)*s}},{mesh:c,boundingSphere:u}=n2(0,l,r,i);if(u)c.setBoundingSphere(u);else if(c.triangleCount>0){const d=ke.expand(ke(),t.boundary.sphere,1*s);c.setBoundingSphere(d)}return c}!function(e){let t;(t=e.Tag||(e.Tag={})).CrossLinkRestraint="cross-link-restraint",e.isApplicable=function n(h){return h.models.some(g=>!!qy.Provider.get(g))};const r=C(),i=C();function o(h){return h.unitA.conformation.position(h.unitA.elements[h.indexA],r),h.unitB.conformation.position(h.unitB.elements[h.indexB],i),C.distance(r,i)}function c(h,g){const y=h.pairs[g];return`Cross Link Restraint | Type: ${y.restraintType} | Threshold: ${y.distanceThreshold} \u212b | Psi: ${y.psi} | Sigma 1: ${y.sigma1} | Sigma 2: ${y.sigma2} | Distance: ${o(y).toFixed(2)} \u212b`}function p(h,g,y){return X0.fromPairProvider(g.length,(v,x,_)=>{const w=h.pairs[g[v]];w.unitA.conformation.position(w.unitA.elements[w.indexA],x),w.unitB.conformation.position(w.unitB.elements[w.indexB],_)},y)}function m(h,g,y){const v=y[0];if(void 0===v)return"";const x=g.pairs[v];return[c(g,v),NG(fn.Location(h,x.unitA,x.indexA,h,x.unitB,x.indexB))].join("
")}e.distance=o,e.Location=function s(h,g,y){return zue("cross-link-restraints",{structure:g,crossLinkRestraints:h},y)},e.isLocation=function a(h){return!!h&&"data-location"===h.kind&&"cross-link-restraints"===h.tag},e.areLocationsEqual=function l(h,g){return h.data.structure===g.data.structure&&h.data.crossLinkRestraints===g.data.crossLinkRestraints&&h.element===g.element},e.locationLabel=function u(h){return c(h.data.crossLinkRestraints,h.element)},e.Loci=function d(h,g,y){return ZN("cross-link-restraints",{structure:h,crossLinkRestraints:g},y,v=>p(g,y,v),()=>m(h,g,y))},e.isLoci=function f(h){return!!h&&"data-loci"===h.kind&&"interactions"===h.tag},e.getBoundingSphere=p,e.getLabel=m}(om||(om={}));const sbe={...kA,...t2,sizeFactor:I.Numeric(.5,{min:0,max:10,step:.1})};function Ogt(e){return Hy({defaultProps:I.getDefaultValues(sbe),createGeometry:Fgt,createLocationIterator:Bgt,getLoci:Lgt,eachLocation:jgt,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.radialSegments!==r.radialSegments||n.linkCap!==r.linkCap}},e)}function Bgt(e){const t=Wy.get(e).value,{pairs:n}=t,r=n.length,o=om.Location(t,e);return Vi(r,1,1,a=>(o.element=a,o),!0)}function Lgt(e,t,n){const{objectId:r,groupId:i}=e;if(n===r){const o=Wy.get(t).value;if(o.pairs[i])return om.Loci(t,o,[i])}return qr}function jgt(e,t,n){let r=!1;if(om.isLoci(e)){if(!Xe.areEquivalent(e.data.structure,t))return!1;const i=Wy.get(t).value;if(e.data.crossLinkRestraints!==i)return!1;for(const o of e.elements)n(Pe.ofSingleton(o))&&(r=!0)}return r}const Ugt={"cross-link-restraint":(e,t)=>Ff("Cross-link restraint",e,t,Ogt)},abe={...sbe},lbe={name:om.Tag.CrossLinkRestraint,label:"Cross Link Restraint",description:"Displays cross-link restraints.",factory:function Vgt(e,t){return Xn.createMulti("CrossLinkRestraint",e,t,gl,Ugt)},getParams:function zgt(e,t){return I.clone(abe)},defaultValues:I.getDefaultValues(abe),defaultColorTheme:{name:om.Tag.CrossLinkRestraint},defaultSizeTheme:{name:"uniform"},isApplicable:e=>om.isApplicable(e),ensureCustomProperties:{attach:(e,t)=>Wy.attach(e,t,void 0,!0),detach:e=>Wy.ref(e,!1)}},cbe=st(13421772),ube={domain:I.Interval([.5,1.5],{step:.01}),list:I.ColorList("red-grey",{presetKind:"scale"})},fbe={name:"cross-link",label:"Cross Link",category:Rd.Category.Misc,factory:function dbe(e,t){let n,r;const i=e.structure&&Wy.get(e.structure).value;if(i){r=up.create({domain:t.domain,listOrName:t.list.colors});const o=r.color;n=s=>{if(om.isLocation(s)){const a=i.pairs[s.element];if(a)return o(om.distance(a)/a.distanceThreshold)}return cbe}}else n=()=>cbe;return{factory:dbe,granularity:"group",color:n,props:t,description:"Colors cross-links by the deviation of the observed distance versus the modeled distance (e.g. modeled / `ihm_cross_link_restraint.distance_threshold`).",legend:r?r.legend:void 0}},getParams:function Ggt(e){return ube},defaultValues:I.getDefaultValues(ube),isApplicable:e=>!!e.structure&&om.isApplicable(e.structure),ensureCustomProperties:{attach:(e,t)=>t.structure?Wy.attach(e,t.structure,void 0,!0):Promise.resolve(),detach:e=>e.structure&&Wy.ref(e.structure,!1)}},qgt=ii.create({name:"integrative-cross-link-restraint",category:"custom-props",display:{name:"Cross Link Restraint"},ctor:class extends ii.Handler{constructor(){super(...arguments),this.provider=qy.Provider}register(){this.provider.formatRegistry.add("mmCIF",Wgt),this.ctx.representation.structure.themes.colorThemeRegistry.add(fbe),this.ctx.representation.structure.registry.add(lbe)}unregister(){this.provider.formatRegistry.remove("mmCIF"),this.ctx.representation.structure.themes.colorThemeRegistry.remove(fbe),this.ctx.representation.structure.registry.remove(lbe)}}});function Wgt(e){if(!Ui.is(e.sourceData))return;const{ihm_cross_link_restraint:t}=e.sourceData.data.db;return 0!==t._rowCount?qy.fromTable(t,e):void 0}const nO={State:zo,Representation:xr,Camera:ea,Misc:ta},Od={Representation:vi,Camera:to,CustomProps:Ul};function rO(e,t,n={}){return"string"==typeof n.type||"string"==typeof n.color||"string"==typeof n.size?function Ygt(e,t,n){const r=n.type&&e.representation.structure.registry.get(n.type)||e.representation.structure.registry.default.provider,i=n.color&&e.representation.structure.themes.colorThemeRegistry.get(n.color)||e.representation.structure.themes.colorThemeRegistry.get(r.defaultColorTheme.name),o=n.size&&e.representation.structure.themes.sizeThemeRegistry.get(n.size)||e.representation.structure.themes.sizeThemeRegistry.get(r.defaultSizeTheme.name);return hbe(e,t,{type:r,typeParams:n.typeParams,color:i,colorParams:n.colorParams,size:o,sizeParams:n.sizeParams})}(e,t||Xe.Empty,n):hbe(e,t||Xe.Empty,n)}function TW(e,t,n,r,i){const{registry:o,themes:s}=e.representation.structure,a=o.get(n||o.default.name),l=s.colorThemeRegistry.get(r||a.defaultColorTheme.name),c=I.getDefaultValues(l.getParams({structure:t||Xe.Empty}));return l.name===a.defaultColorTheme.name&&Object.assign(c,a.defaultColorTheme.props),{name:l.name,params:Object.assign(c,i)}}function pbe(e,t,n,r,i){const{registry:o,themes:s}=e.representation.structure,a=o.get(n||o.default.name),l=s.sizeThemeRegistry.get(r||a.defaultSizeTheme.name),c=I.getDefaultValues(l.getParams({structure:t||Xe.Empty}));return l.name===a.defaultSizeTheme.name&&Object.assign(c,a.defaultSizeTheme.props),{name:l.name,params:Object.assign(c,i)}}function hbe(e,t,n={}){const{themes:r}=e.representation.structure,i={structure:t},o=n.type||e.representation.structure.registry.default.provider,s=I.getDefaultValues(o.getParams(r,t)),a=Object.assign(s,n.typeParams),l=n.color||r.colorThemeRegistry.get(o.defaultColorTheme.name),c=I.getDefaultValues(l.getParams(i));l.name===o.defaultColorTheme.name&&Object.assign(c,o.defaultColorTheme.props);const u=Object.assign(c,n.colorParams),d=n.size||r.sizeThemeRegistry.get(o.defaultSizeTheme.name),f=I.getDefaultValues(d.getParams(i));d.name===o.defaultSizeTheme.name&&Object.assign(f,o.defaultSizeTheme.props);const p=Object.assign(f,n.sizeParams);return{type:{name:o.name,params:a},colorTheme:{name:l.name,params:u},sizeTheme:{name:d.name,params:p}}}const mbe=["target","surroundings","interactions"];var Co=function(e){return e.TargetSel="structure-focus-target-sel",e.TargetRepr="structure-focus-target-repr",e.SurrSel="structure-focus-surr-sel",e.SurrRepr="structure-focus-surr-repr",e.SurrNciRepr="structure-focus-surr-nci-repr",e}(Co||{});const Kgt=new Set([Co.TargetSel,Co.TargetRepr,Co.SurrSel,Co.SurrRepr,Co.SurrNciRepr]),iO=ii.create({name:"create-structure-focus-representation",display:{name:"Structure Focus Representation"},category:"interaction",ctor:class Zgt extends ii.WithSubscribers{constructor(){super(...arguments),this.currentSource=void 0}get surrLabel(){return`[Focus] Surroundings (${this.params.expandRadius} \xc5)`}getReprParams(t){return{...t,type:{name:t.type.name,params:{...t.type.params,ignoreHydrogens:this.params.ignoreHydrogens,ignoreHydrogensVariant:this.params.ignoreHydrogensVariant,ignoreLight:this.params.ignoreLight,material:this.params.material,clip:this.params.clip}}}}ensureShape(t){var n;const r=this.plugin.state.data,i=r.tree,o=r.build(),s=Qn.findUniqueTagsInSubtree(i,t.transform.ref,Kgt);s[Co.TargetSel]||(s[Co.TargetSel]=o.to(t).apply(at.Model.StructureSelectionFromBundle,{bundle:Qr.Empty,label:"[Focus] Target"},{tags:Co.TargetSel}).ref),s[Co.SurrSel]||(s[Co.SurrSel]=o.to(t).apply(at.Model.StructureSelectionFromExpression,{expression:pe.struct.generator.empty(),label:this.surrLabel},{tags:Co.SurrSel}).ref);const a=this.params.components;return a.indexOf("target")>=0&&!s[Co.TargetRepr]&&(s[Co.TargetRepr]=o.to(s[Co.TargetSel]).apply(at.Representation.StructureRepresentation3D,this.getReprParams(this.params.targetParams),{tags:Co.TargetRepr}).ref),a.indexOf("surroundings")>=0&&!s[Co.SurrRepr]&&(s[Co.SurrRepr]=o.to(s[Co.SurrSel]).apply(at.Representation.StructureRepresentation3D,this.getReprParams(this.params.surroundingsParams),{tags:Co.SurrRepr}).ref),a.indexOf("interactions")>=0&&!s[Co.SurrNciRepr]&&t.obj&&eO.isApplicable(null===(n=t.obj)||void 0===n?void 0:n.data)&&(s[Co.SurrNciRepr]=o.to(s[Co.SurrSel]).apply(at.Representation.StructureRepresentation3D,this.getReprParams(this.params.nciParams),{tags:Co.SurrNciRepr}).ref),{state:r,builder:o,refs:s}}clear(t){const n=this.plugin.state.data;this.currentSource=void 0;const r=n.select(Qn.Generators.byRef(t).subtree().withTag(Co.TargetSel)),i=n.select(Qn.Generators.byRef(t).subtree().withTag(Co.SurrSel));if(0===r.length&&0===i.length)return;const o=n.build(),s=Qr.Empty;for(const l of r)o.to(l).update(at.Model.StructureSelectionFromBundle,c=>({...c,bundle:s}));const a=pe.struct.generator.empty();for(const l of i)o.to(l).update(at.Model.StructureSelectionFromExpression,c=>({...c,expression:a}));return jt.State.Update(this.plugin,{state:n,tree:o,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}})}focus(t){var n=this;return le(function*(){const r=n.plugin.helpers.substructureParent.get(t.structure);if(!r||!r.obj)return;n.currentSource=t;const i=Me.remap(t,r.obj.data),o=Me.extendToWholeResidues(i),s=Qr.fromLoci(o),a=Qr.toExpression(s);let l=pe.struct.modifier.includeSurroundings({0:a,radius:n.params.expandRadius,"as-whole-residues":!0});n.params.excludeTargetFromSurroundings&&(l=pe.struct.modifier.exceptBy({0:l,by:a}));const{state:c,builder:u,refs:d}=n.ensureShape(r);u.to(d[Co.TargetSel]).update(at.Model.StructureSelectionFromBundle,f=>({...f,bundle:s})),u.to(d[Co.SurrSel]).update(at.Model.StructureSelectionFromExpression,f=>({...f,expression:l,label:n.surrLabel})),yield jt.State.Update(n.plugin,{state:c,tree:u,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}})})()}register(t){this.subscribeObservable(this.plugin.managers.structure.focus.behaviors.current,n=>{n?this.focus(n.loci):this.clear(vr.RootRef)})}update(t){var n=this;return le(function*(){const r=n.params;if(n.params=t,r.excludeTargetFromSurroundings!==t.excludeTargetFromSurroundings)return n.currentSource&&n.focus(n.currentSource),!0;const i=n.plugin.state.data,o=i.build(),s=Qn.Generators.root.subtree(),a=n.params.components;let l=a.indexOf("target")>=0;for(const c of i.select(s.withTag(Co.TargetRepr)))l?o.to(c).update(n.getReprParams(n.params.targetParams)):o.delete(c.transform.ref);l=a.indexOf("surroundings")>=0;for(const c of i.select(s.withTag(Co.SurrRepr)))l?o.to(c).update(n.getReprParams(n.params.surroundingsParams)):o.delete(c.transform.ref);l=a.indexOf("interactions")>=0;for(const c of i.select(s.withTag(Co.SurrNciRepr)))l?o.to(c).update(n.getReprParams(n.params.nciParams)):o.delete(c.transform.ref);return yield jt.State.Update(n.plugin,{state:i,tree:o,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}}),t.expandRadius!==r.expandRadius&&n.currentSource&&n.focus(n.currentSource),!0})()}},params:(e,t)=>(e=>{const t=at.Representation.StructureRepresentation3D.definition.params(void 0,e);return{expandRadius:I.Numeric(5,{min:1,max:10,step:1}),targetParams:I.Group(t,{label:"Target",customDefault:rO(e,void 0,{type:"ball-and-stick",size:"physical",typeParams:{sizeFactor:.22,sizeAspectRatio:.73,adjustCylinderLength:!0,xrayShaded:!0,aromaticBonds:!1,multipleBonds:"off",excludeTypes:["hydrogen-bond","metal-coordination"]}})}),surroundingsParams:I.Group(t,{label:"Surroundings",customDefault:rO(e,void 0,{type:"ball-and-stick",size:"physical",typeParams:{sizeFactor:.16,excludeTypes:["hydrogen-bond","metal-coordination"]}})}),nciParams:I.Group(t,{label:"Non-covalent Int.",customDefault:rO(e,void 0,{type:eO,color:yW,size:Ya.BuiltIn.uniform})}),components:I.MultiSelect(mbe,I.arrayToOptions(mbe)),excludeTargetFromSurroundings:I.Boolean(!1,{label:"Exclude Target",description:'Exclude the focus "target" from the surroudings component.'}),ignoreHydrogens:I.Boolean(!1),ignoreHydrogensVariant:I.Select("all",I.arrayToOptions(["all","non-polar"])),ignoreLight:I.Boolean(!1),material:tu.getParam(),clip:I.Group(H1.Params)}})(t)});function jc(e){return e}!function(e){function t(o){return"chain-id"===o?{name:o,params:Rpe.defaultValues}:"operator-name"===o?{name:o,params:lG.defaultValues}:{name:o,params:{}}}e.CommonParams={ignoreHydrogens:I.Optional(I.Boolean(!1)),ignoreHydrogensVariant:I.Optional(I.Select("all",I.arrayToOptions(["all","non-polar"]))),ignoreLight:I.Optional(I.Boolean(!1)),quality:I.Optional(I.Select("auto",D9)),theme:I.Optional(I.Group({globalName:I.Optional(I.Text("")),globalColorParams:I.Optional(I.Value({},{isHidden:!0})),carbonColor:I.Optional(I.Select("chain-id",I.arrayToOptions(["chain-id","operator-name","element-symbol"]))),symmetryColor:I.Optional(I.Text("")),symmetryColorParams:I.Optional(I.Value({},{isHidden:!0})),focus:I.Optional(I.Group({name:I.Optional(I.Text("")),params:I.Optional(I.Value({}))}))}))},e.reprBuilder=function r(o,s,a){var l,c,u,d,f,p,m,h,g,y,v,x,_,w;const A=o.state.data.build(),M=o.builders.structure.representation,E=o.managers.structure.component.state.options.hydrogens,D={quality:o.managers.structure.component.state.options.visualQuality,ignoreHydrogens:"all"!==E,ignoreHydrogensVariant:"only-polar"===E?"non-polar":"all",ignoreLight:o.managers.structure.component.state.options.ignoreLight};s.quality&&"auto"!==s.quality&&(D.quality=s.quality),void 0!==s.ignoreHydrogens&&(D.ignoreHydrogens=!!s.ignoreHydrogens),void 0!==s.ignoreHydrogensVariant&&(D.ignoreHydrogensVariant=s.ignoreHydrogensVariant),void 0!==s.ignoreLight&&(D.ignoreLight=!!s.ignoreLight);const T=null!==(l=s.theme)&&void 0!==l&&l.globalName?null===(c=s.theme)||void 0===c?void 0:c.globalName:void 0,F=void 0!==(null===(u=s.theme)||void 0===u?void 0:u.carbonColor)?{carbonColor:t(null===(d=s.theme)||void 0===d?void 0:d.carbonColor),...null===(f=s.theme)||void 0===f?void 0:f.globalColorParams}:{...null===(p=s.theme)||void 0===p?void 0:p.globalColorParams},R=a&&null!==(m=s.theme)&&void 0!==m&&m.symmetryColor&&function n(o){return o.units.some(s=>!s.conformation.operator.assembly&&s.conformation.operator.spgrOp>=0)}(a)?null===(h=s.theme)||void 0===h?void 0:h.symmetryColor:T;return{update:A,builder:M,color:T,symmetryColor:R,symmetryColorParams:null!==(g=s.theme)&&void 0!==g&&g.symmetryColorParams?{...null===(y=s.theme)||void 0===y?void 0:y.globalColorParams,...null===(v=s.theme)||void 0===v?void 0:v.symmetryColorParams}:{...null===(x=s.theme)||void 0===x?void 0:x.globalColorParams},globalColorParams:null!==(_=s.theme)&&void 0!==_&&_.globalColorParams?{...null===(w=s.theme)||void 0===w?void 0:w.globalColorParams}:void 0,typeParams:D,ballAndStickColor:F}},e.updateFocusRepr=function i(o,s,a,l){if(o.state.hasBehavior(iO))return o.state.updateBehavior(iO,c=>{const u=TW(o,s,"ball-and-stick",a||"element-symbol",l);c.surroundingsParams.colorTheme=u,c.targetParams.colorTheme=u})}}(jc||(jc={}));const cv=jc.CommonParams,r2=jc.reprBuilder,i2=jc.updateFocusRepr,Qgt=jc({id:"preset-structure-representation-auto",display:{name:"Automatic",description:"Show representations based on the size of the structure. Smaller structures are shown with more detail than larger ones, ranging from atomistic display to coarse surfaces."},params:()=>cv,apply(e,t,n){var r,i;const o=null===(i=null===(r=_a.resolveAndCheck(n.state.data,e))||void 0===r?void 0:r.obj)||void 0===i?void 0:i.data;if(!o)return{};const s=n.config.get(ei.Structure.SizeThresholds)||Xe.DefaultSizeThresholds,a=Xe.getSize(o,s),l=o.polymerResidueCount/o.polymerGapCount;switch(a){case Xe.Size.Gigantic:case Xe.Size.Huge:return ybe.apply(e,t,n);case Xe.Size.Large:return bbe.apply(e,t,n);case Xe.Size.Medium:if(l>3)return gbe.apply(e,t,n);case Xe.Size.Small:return vbe.apply(e,{...t,showCarbohydrateSymbol:!0},n);default:Hi()}}}),Jgt=jc({id:"preset-structure-representation-empty",display:{name:"Empty",description:"Removes all existing representations."},apply:(e,t,n)=>le(function*(){return{}})()}),OP="Basic",gbe=jc({id:"preset-structure-representation-polymer-and-ligand",display:{name:"Polymer & Ligand",group:OP,description:"Shows polymers as Cartoon, ligands as Ball & Stick, carbohydrates as 3D-SNFG and water molecules semi-transparent."},params:()=>cv,apply:(e,t,n)=>le(function*(){var r,i,o,s,a,l,c,u,d,f;const p=_a.resolveAndCheck(n.state.data,e);if(!p)return{};const m={polymer:yield td(n,p,"polymer"),ligand:yield td(n,p,"ligand"),nonStandard:yield td(n,p,"non-standard"),branched:yield td(n,p,"branched",{label:"Carbohydrate"}),water:yield td(n,p,"water"),ion:yield td(n,p,"ion"),lipid:yield td(n,p,"lipid"),coarse:yield td(n,p,"coarse")},h=p.obj.data,g={sizeFactor:h.isCoarseGrained?.8:.2},y=((null===(o=null===(i=null===(r=m.water)||void 0===r?void 0:r.obj)||void 0===i?void 0:i.data)||void 0===o?void 0:o.elementCount)||0)>5e4?"line":"ball-and-stick",v=((null===(l=null===(a=null===(s=m.lipid)||void 0===s?void 0:s.obj)||void 0===a?void 0:a.data)||void 0===l?void 0:l.elementCount)||0)>2e4?"line":"ball-and-stick",{update:x,builder:_,typeParams:w,color:A,symmetryColor:M,symmetryColorParams:E,globalColorParams:D,ballAndStickColor:T}=r2(n,t,h),F={polymer:_.buildRepresentation(x,m.polymer,{type:"cartoon",typeParams:{...w,...g},color:M,colorParams:E},{tag:"polymer"}),ligand:_.buildRepresentation(x,m.ligand,{type:"ball-and-stick",typeParams:w,color:A,colorParams:T},{tag:"ligand"}),nonStandard:_.buildRepresentation(x,m.nonStandard,{type:"ball-and-stick",typeParams:w,color:A,colorParams:T},{tag:"non-standard"}),branchedBallAndStick:_.buildRepresentation(x,m.branched,{type:"ball-and-stick",typeParams:{...w,alpha:.3},color:A,colorParams:T},{tag:"branched-ball-and-stick"}),branchedSnfg3d:_.buildRepresentation(x,m.branched,{type:"carbohydrate",typeParams:w,color:A,colorParams:D},{tag:"branched-snfg-3d"}),water:_.buildRepresentation(x,m.water,{type:y,typeParams:{...w,alpha:.6,visuals:"line"===y?["intra-bond","element-point"]:void 0},color:A,colorParams:{carbonColor:{name:"element-symbol",params:{}},...D}},{tag:"water"}),ion:_.buildRepresentation(x,m.ion,{type:"ball-and-stick",typeParams:w,color:A,colorParams:{carbonColor:{name:"element-symbol",params:{}},...D}},{tag:"ion"}),lipid:_.buildRepresentation(x,m.lipid,{type:v,typeParams:{...w,alpha:.6,visuals:"line"===v?["intra-bond"]:void 0},color:A,colorParams:{carbonColor:{name:"element-symbol",params:{}},...D}},{tag:"lipid"}),coarse:_.buildRepresentation(x,m.coarse,{type:"spacefill",typeParams:w,color:A||"chain-id",colorParams:D},{tag:"coarse"})};return yield x.commit({revertOnError:!1}),yield i2(n,h,null===(u=null===(c=t.theme)||void 0===c?void 0:c.focus)||void 0===u?void 0:u.name,null===(f=null===(d=t.theme)||void 0===d?void 0:d.focus)||void 0===f?void 0:f.params),{components:m,representations:F}})()}),e0t=jc({id:"preset-structure-representation-protein-and-nucleic",display:{name:"Protein & Nucleic",group:OP,description:"Shows proteins as Cartoon and RNA/DNA as Gaussian Surface."},params:()=>cv,apply:(e,t,n)=>le(function*(){var r,i,o,s;const a=_a.resolveAndCheck(n.state.data,e);if(!a)return{};const l={protein:yield xbe(n,a,"protein"),nucleic:yield xbe(n,a,"nucleic")},c=a.obj.data,u={sizeFactor:c.isCoarseGrained?.8:.2},d={radiusOffset:c.isCoarseGrained?2:0,smoothness:c.isCoarseGrained?1:1.5},{update:f,builder:p,typeParams:m,symmetryColor:h,symmetryColorParams:g}=r2(n,t,c),y={protein:p.buildRepresentation(f,l.protein,{type:"cartoon",typeParams:{...m,...u},color:h,colorParams:g},{tag:"protein"}),nucleic:p.buildRepresentation(f,l.nucleic,{type:"gaussian-surface",typeParams:{...m,...d},color:h,colorParams:g},{tag:"nucleic"})};return yield f.commit({revertOnError:!0}),yield i2(n,c,null===(i=null===(r=t.theme)||void 0===r?void 0:r.focus)||void 0===i?void 0:i.name,null===(s=null===(o=t.theme)||void 0===o?void 0:o.focus)||void 0===s?void 0:s.params),{components:l,representations:y}})()}),ybe=jc({id:"preset-structure-representation-coarse-surface",display:{name:"Coarse Surface",group:OP,description:"Shows polymers and lipids as coarse Gaussian Surface."},params:()=>cv,apply:(e,t,n)=>le(function*(){var r,i,o,s;const a=_a.resolveAndCheck(n.state.data,e);if(!a)return{};const l={polymer:yield td(n,a,"polymer"),lipid:yield td(n,a,"lipid")},c=a.obj.data,u=n.config.get(ei.Structure.SizeThresholds)||Xe.DefaultSizeThresholds,d=Xe.getSize(c,u),f=Object.create(null);d===Xe.Size.Gigantic?Object.assign(f,{traceOnly:!c.isCoarseGrained,radiusOffset:2,smoothness:1,visuals:["structure-gaussian-surface-mesh"]}):d===Xe.Size.Huge?Object.assign(f,{radiusOffset:c.isCoarseGrained?2:0,smoothness:1}):c.isCoarseGrained&&Object.assign(f,{radiusOffset:2,smoothness:1});const{update:p,builder:m,typeParams:h,symmetryColor:g,symmetryColorParams:y}=r2(n,t,c),v={polymer:m.buildRepresentation(p,l.polymer,{type:"gaussian-surface",typeParams:{...h,...f},color:g,colorParams:y},{tag:"polymer"}),lipid:m.buildRepresentation(p,l.lipid,{type:"gaussian-surface",typeParams:{...h,...f},color:g,colorParams:y},{tag:"lipid"})};return yield p.commit({revertOnError:!0}),yield i2(n,c,null===(i=null===(r=t.theme)||void 0===r?void 0:r.focus)||void 0===i?void 0:i.name,null===(s=null===(o=t.theme)||void 0===o?void 0:o.focus)||void 0===s?void 0:s.params),{components:l,representations:v}})()}),bbe=jc({id:"preset-structure-representation-polymer-cartoon",display:{name:"Polymer Cartoon",group:OP,description:"Shows polymers as Cartoon."},params:()=>cv,apply:(e,t,n)=>le(function*(){var r,i,o,s;const a=_a.resolveAndCheck(n.state.data,e);if(!a)return{};const l={polymer:yield td(n,a,"polymer")},c=a.obj.data,u={sizeFactor:c.isCoarseGrained?.8:.2},{update:d,builder:f,typeParams:p,symmetryColor:m,symmetryColorParams:h}=r2(n,t,c),g={polymer:f.buildRepresentation(d,l.polymer,{type:"cartoon",typeParams:{...p,...u},color:m,colorParams:h},{tag:"polymer"})};return yield d.commit({revertOnError:!0}),yield i2(n,c,null===(i=null===(r=t.theme)||void 0===r?void 0:r.focus)||void 0===i?void 0:i.name,null===(s=null===(o=t.theme)||void 0===o?void 0:o.focus)||void 0===s?void 0:s.params),{components:l,representations:g}})()}),vbe=jc({id:"preset-structure-representation-atomic-detail",display:{name:"Atomic Detail",group:OP,description:"Shows everything in atomic detail with Ball & Stick."},params:()=>({...cv,showCarbohydrateSymbol:I.Boolean(!1)}),apply:(e,t,n)=>le(function*(){var r,i,o,s,a,l;const c=_a.resolveAndCheck(n.state.data,e);if(!c)return{};const u={all:yield td(n,c,"all"),branched:void 0},d=c.obj.data,f=d.elementCount>1e5,p=d.atomicResidueCount&&d.elementCount>1e3&&d.atomicResidueCount/d.elementCount<3,m=d.models[0],h=!!nc.Provider.get(m)||vf.isExhaustive(m);let g="ball-and-stick";d.isCoarseGrained?g=d.elementCount>1e6?"point":"spacefill":p&&!h?g="spacefill":f&&(g="line");const y=t.showCarbohydrateSymbol&&!f&&!p;y&&Object.assign(u,{branched:yield td(n,c,"branched",{label:"Carbohydrate"})});const{update:v,builder:x,typeParams:_,color:w,ballAndStickColor:A,globalColorParams:M}=r2(n,t,d),E=p&&!h?{carbonColor:{name:"element-symbol",params:{}},...M}:A,D={all:x.buildRepresentation(v,u.all,{type:g,typeParams:_,color:w,colorParams:E},{tag:"all"})};return y&&Object.assign(D,{snfg3d:x.buildRepresentation(v,u.branched,{type:"carbohydrate",typeParams:{..._,alpha:.4,visuals:["carbohydrate-symbol"]},color:w,colorParams:M},{tag:"snfg-3d"})}),yield v.commit({revertOnError:!0}),yield i2(n,d,null!==(o=null===(i=null===(r=t.theme)||void 0===r?void 0:r.focus)||void 0===i?void 0:i.name)&&void 0!==o?o:w,null!==(l=null===(a=null===(s=t.theme)||void 0===s?void 0:s.focus)||void 0===a?void 0:a.params)&&void 0!==l?l:E),{components:u,representations:D}})()}),t0t=jc({id:"preset-structure-representation-illustrative",display:{name:"Illustrative",group:"Miscellaneous",description:"..."},params:()=>({...cv,showCarbohydrateSymbol:I.Boolean(!1)}),apply:(e,t,n)=>le(function*(){var r,i,o,s,a;const l=_a.resolveAndCheck(n.state.data,e);if(!l)return{};const c={all:yield td(n,l,"all"),branched:void 0},u=l.obj.data,{update:d,builder:f,typeParams:p,color:m}=r2(n,t,u),h={all:f.buildRepresentation(d,c.all,{type:"spacefill",typeParams:{...p,ignoreLight:!0},color:"illustrative"},{tag:"all"})};return yield d.commit({revertOnError:!0}),yield i2(n,u,null!==(o=null===(i=null===(r=t.theme)||void 0===r?void 0:r.focus)||void 0===i?void 0:i.name)&&void 0!==o?o:m,null===(a=null===(s=t.theme)||void 0===s?void 0:s.focus)||void 0===a?void 0:a.params),{components:c,representations:h}})()}),n0t=jc({id:"preset-structure-representation-auto-lod",display:{name:"Automatic Detail",group:"Miscellaneous",description:"Shows more (or less) detailed representations automatically based on camera distance."},params:()=>cv,apply:(e,t,n)=>le(function*(){var r,i,o,s;const a=_a.resolveAndCheck(n.state.data,e);if(!a)return{};const l={all:yield td(n,a,"all")},c=a.obj.data,u={sizeFactor:c.isCoarseGrained?.8:.2},{update:d,builder:f,typeParams:p,color:m,symmetryColor:h,symmetryColorParams:g,ballAndStickColor:y}=r2(n,t,c),v={gaussianSurface:f.buildRepresentation(d,l.all,{type:"gaussian-surface",typeParams:{...p,lod:C.create(30,1e7,100)},color:h,colorParams:g},{tag:"gaussian-surface"}),cartoon:f.buildRepresentation(d,l.all,{type:"cartoon",typeParams:{...p,...u,lod:C.create(-20,300,100)},color:h,colorParams:g},{tag:"cartoon"}),ballAndStick:f.buildRepresentation(d,l.all,{type:"ball-and-stick",typeParams:{...p,lod:C.create(-20,40,20)},color:m,colorParams:y},{tag:"ball-and-stick"})};return yield d.commit({revertOnError:!1}),yield i2(n,c,null===(i=null===(r=t.theme)||void 0===r?void 0:r.focus)||void 0===i?void 0:i.name,null===(s=null===(o=t.theme)||void 0===o?void 0:o.focus)||void 0===s?void 0:s.params),{components:l,representations:v}})()});function td(e,t,n,r){return e.builders.structure.tryCreateComponentStatic(t,n,r)}function xbe(e,t,n,r){return e.builders.structure.tryCreateComponentFromSelection(t,Ps[n],`selection-${n}`,r)}const Gp={empty:Jgt,auto:Qgt,"atomic-detail":vbe,"polymer-cartoon":bbe,"polymer-and-ligand":gbe,"protein-and-nucleic":e0t,"coarse-surface":ybe,illustrative:t0t,"auto-lod":n0t};function oO(e,t){if("bcif"===e.ext)try{const{encoder:n}=bae(t);if(n.startsWith("VolumeServer"))return"dscif";if(n.startsWith("volseg-volume-server"))return"segcif"}catch(n){console.error(n)}else if("cif"===e.ext){const n=t;if(n.startsWith("data_SERVER\n#\n_density_server_result"))return"dscif";if(n.startsWith("data_SERVER\n#\ndata_SEGMENTATION_DATA"))return"segcif";if(n.includes("atom_site_fract_x")||n.includes("atom_site.fract_x"))return"coreCif"}return-1}const sm="Trajectory";function $y(e,t){return e.builders.structure.hierarchy.applyPreset(t.trajectory,"default")}const r0t={label:"mmCIF",description:"mmCIF",category:sm,stringExtensions:["cif","mmcif","mcif"],binaryExtensions:["bcif"],isApplicable:(e,t)=>"mmcif"===e.ext||"mcif"===e.ext||("cif"===e.ext||"bcif"===e.ext)&&-1===oO(e,t),parse:function(){var e=le(function*(t,n,r){var i,o;const a=t.state.data.build().to(n).apply(at.Data.ParseCif,void 0,{state:{isGhost:!0}}),l=yield a.apply(at.Model.TrajectoryFromMmCif,void 0,{tags:r?.trajectoryTags}).commit({revertOnError:!0});return((null===(o=null===(i=a.selector.cell)||void 0===i?void 0:i.obj)||void 0===o?void 0:o.data.blocks.length)||0)>1&&t.state.data.updateCellState(a.ref,{isGhost:!1}),{trajectory:l}});return function(n,r,i){return e.apply(this,arguments)}}(),visuals:$y},i0t={label:"cifCore",description:"CIF Core",category:sm,stringExtensions:["cif"],isApplicable:(e,t)=>"cif"===e.ext&&"coreCif"===oO(e,t),parse:function(){var e=le(function*(t,n,r){var i,o;const a=t.state.data.build().to(n).apply(at.Data.ParseCif,void 0,{state:{isGhost:!0}}),l=yield a.apply(at.Model.TrajectoryFromCifCore,void 0,{tags:r?.trajectoryTags}).commit({revertOnError:!0});return((null===(o=null===(i=a.selector.cell)||void 0===i?void 0:i.obj)||void 0===o?void 0:o.data.blocks.length)||0)>1&&t.state.data.updateCellState(a.ref,{isGhost:!1}),{trajectory:l}});return function(n,r,i){return e.apply(this,arguments)}}(),visuals:$y};function o2(e,t){return function(){var n=le(function*(r,i,o){return{trajectory:yield r.state.data.build().to(i).apply(e,t,{tags:o?.trajectoryTags}).commit({revertOnError:!0})}});return function(r,i,o){return n.apply(this,arguments)}}()}const o0t={label:"PDB",description:"PDB",category:sm,stringExtensions:["pdb","ent"],parse:o2(at.Model.TrajectoryFromPDB),visuals:$y},s0t={label:"PDBQT",description:"PDBQT",category:sm,stringExtensions:["pdbqt"],parse:o2(at.Model.TrajectoryFromPDB,{isPdbqt:!0}),visuals:$y},a0t={label:"XYZ",description:"XYZ",category:sm,stringExtensions:["xyz"],parse:o2(at.Model.TrajectoryFromXYZ),visuals:$y},_be=[["mmcif",r0t],["cifCore",i0t],["pdb",o0t],["pdbqt",s0t],["gro",{label:"GRO",description:"GRO",category:sm,stringExtensions:["gro"],binaryExtensions:[],parse:o2(at.Model.TrajectoryFromGRO),visuals:$y}],["xyz",a0t],["mol",{label:"MOL",description:"MOL",category:sm,stringExtensions:["mol"],parse:o2(at.Model.TrajectoryFromMOL),visuals:$y}],["sdf",{label:"SDF",description:"SDF",category:sm,stringExtensions:["sdf","sd"],parse:o2(at.Model.TrajectoryFromSDF),visuals:$y}],["mol2",{label:"MOL2",description:"MOL2",category:sm,stringExtensions:["mol2"],parse:o2(at.Model.TrajectoryFromMOL2),visuals:$y}]],f0t=["gz","zip"];function RA(e){let t=e,n="";const r=t.lastIndexOf("?"),i=-1!==r?t.substring(r):"";t=t.substring(0,-1===r?t.length:r);const o=t.replace(/^.*[\\/]/,"");let s=o.substring(0,o.lastIndexOf("."));const a=o.split(".");let l=a.length>1?(a.pop()||"").toLowerCase():"";const c=t.match(/^(.+):\/\/(.+)$/);c&&(n=c[1].toLowerCase(),t=c[2]||"");const u=t.substring(0,t.lastIndexOf("/")+1);return f0t.includes(l)&&(l=(t.substr(0,t.length-l.length-1).split(".").pop()||"").toLowerCase(),s=s.substr(0,s.length-l.length-1)),{path:t,name:o,ext:l,base:s,dir:u,protocol:n,query:i}}const BP="Topology",p0t={label:"PSF",description:"PSF",category:BP,stringExtensions:["psf"],parse:function(){var e=le(function*(t,n){const r=t.state.data.build().to(n).apply(at.Data.ParsePsf,{},{state:{isGhost:!0}}),i=r.apply(at.Model.TopologyFromPsf);return yield r.commit(),{format:r.selector,topology:i.selector}});return function(n,r){return e.apply(this,arguments)}}()},h0t={label:"PRMTOP",description:"PRMTOP",category:BP,stringExtensions:["prmtop","parm7"],parse:function(){var e=le(function*(t,n){const r=t.state.data.build().to(n).apply(at.Data.ParsePrmtop,{},{state:{isGhost:!0}}),i=r.apply(at.Model.TopologyFromPrmtop);return yield r.commit(),{format:r.selector,topology:i.selector}});return function(n,r){return e.apply(this,arguments)}}()},m0t={label:"TOP",description:"TOP",category:BP,stringExtensions:["top"],parse:function(){var e=le(function*(t,n){const r=t.state.data.build().to(n).apply(at.Data.ParseTop,{},{state:{isGhost:!0}}),i=r.apply(at.Model.TopologyFromTop);return yield r.commit(),{format:r.selector,topology:i.selector}});return function(n,r){return e.apply(this,arguments)}}()},g0t=[["psf",p0t],["prmtop",h0t],["top",m0t]],NA="Coordinates",y0t={label:"DCD",description:"DCD",category:NA,binaryExtensions:["dcd"],parse:(e,t)=>e.state.data.build().to(t).apply(at.Model.CoordinatesFromDcd).commit()},b0t={label:"XTC",description:"XTC",category:NA,binaryExtensions:["xtc"],parse:(e,t)=>e.state.data.build().to(t).apply(at.Model.CoordinatesFromXtc).commit()},v0t={label:"TRR",description:"TRR",category:NA,binaryExtensions:["trr"],parse:(e,t)=>e.state.data.build().to(t).apply(at.Model.CoordinatesFromTrr).commit()},x0t={label:"NCTRAJ",description:"NCTRAJ",category:NA,binaryExtensions:["nc","nctraj"],parse:(e,t)=>e.state.data.build().to(t).apply(at.Model.CoordinatesFromNctraj).commit()},_0t=[["dcd",y0t],["xtc",b0t],["trr",v0t],["nctraj",x0t]],Sbe={rcsb:I.Group({encoding:I.Select("bcif",I.arrayToOptions(["cif","bcif"]))},{label:"RCSB PDB",isFlat:!0}),pdbe:I.Group({variant:I.Select("updated-bcif",[["updated-bcif","Updated (bcif)"],["updated","Updated"],["archival","Archival"]])},{label:"PDBe",isFlat:!0}),pdbj:I.EmptyGroup({label:"PDBj"})},C0t=Hu.build({from:Se.Root,display:{name:"Download Structure",description:"Load a structure from the provided source and create its representation."},params:(e,t)=>{const n=(e=>{const t=e.config.get(ei.Structure.DefaultRepresentationPreset)||Gp.auto.id;return I.Group({type:R_.getParams(void 0,"auto").type,representation:I.Select(t,e.builders.structure.representation.getPresets().map(n=>[n.id,n.display.name,n.display.group]),{description:"Which representation preset to use."}),representationParams:I.Group(jc.CommonParams,{isHidden:!0}),asTrajectory:I.Optional(I.Boolean(!1,{description:"Load all entries into a single trajectory."}))},{isExpanded:!1})})(t),r=t.config.get(ei.Download.DefaultPdbProvider)||"pdbe";return{source:I.MappedStatic("pdb",{pdb:I.Group({provider:I.Group({id:I.Text("1tqn",{label:"PDB Id(s)",description:"One or more comma/space separated PDB ids."}),server:I.MappedStatic(r,Sbe)},{pivot:"id"}),options:n},{isFlat:!0,label:"PDB"}),"pdb-dev":I.Group({provider:I.Group({id:I.Text("PDBDEV_00000001",{label:"PDB-Dev Id(s)",description:"One or more comma/space separated ids."}),encoding:I.Select("bcif",I.arrayToOptions(["cif","bcif"]))},{pivot:"id"}),options:n},{isFlat:!0,label:"PDB-Dev"}),swissmodel:I.Group({id:I.Text("Q9Y2I8",{label:"UniProtKB AC(s)",description:"One or more comma/space separated ACs."}),options:n},{isFlat:!0,label:"SWISS-MODEL",description:"Loads the best homology model or experimental structure"}),alphafolddb:I.Group({id:I.Text("Q8W3K0",{label:"UniProtKB AC(s)",description:"One or more comma/space separated ACs."}),options:n},{isFlat:!0,label:"AlphaFold DB",description:"Loads the predicted model if available"}),modelarchive:I.Group({id:I.Text("ma-bak-cepc-0003",{label:"Accession Code(s)",description:"One or more comma/space separated ACs."}),options:n},{isFlat:!0,label:"Model Archive"}),pubchem:I.Group({id:I.Text("2244,2245",{label:"PubChem ID",description:"One or more comma/space separated IDs."}),options:n},{isFlat:!0,label:"PubChem",description:"Loads 3D conformer from PubChem."}),url:I.Group({url:I.Url(""),format:I.Select("mmcif",I.arrayToOptions(_be.map(i=>i[0]),i=>i)),isBinary:I.Boolean(!1),label:I.Optional(I.Text("")),options:n},{isFlat:!0,label:"URL"})})}}})(({params:e,state:t},n)=>Ke.create("Download Structure",function(){var r=le(function*(i){n.behaviors.layout.leftPanelTabName.next("data");const o=e.source;let s,a=!1,l="mmcif";switch(o.name){case"url":s=[{url:o.params.url,isBinary:o.params.isBinary,label:o.params.label||void 0}],l=o.params.format;break;case"pdb":s=yield"pdbe"===o.params.provider.server.name?function w0t(e){return PW.apply(this,arguments)}(o):"pdbj"===o.params.provider.server.name?function A0t(e){return kW.apply(this,arguments)}(o):"rcsb"===o.params.provider.server.name?function I0t(e){return MW.apply(this,arguments)}(o):Hi(),a=!!o.params.options.asTrajectory;break;case"pdb-dev":s=yield am(o.params.provider.id,f=>{const p=f.toUpperCase().startsWith("PDBDEV_")?f:`PDBDEV_${f.padStart(8,"0")}`;return"bcif"===o.params.provider.encoding?`https://pdb-dev.wwpdb.org/bcif/${p.toUpperCase()}.bcif`:`https://pdb-dev.wwpdb.org/cif/${p.toUpperCase()}.cif`},f=>f.toUpperCase().startsWith("PDBDEV_")?f:`PDBDEV_${f.padStart(8,"0")}`,"bcif"===o.params.provider.encoding),a=!!o.params.options.asTrajectory;break;case"swissmodel":s=yield am(o.params.id,f=>`https://swissmodel.expasy.org/repository/uniprot/${f.toUpperCase()}.pdb`,f=>`SWISS-MODEL: ${f}`,!1),a=!!o.params.options.asTrajectory,l="pdb";break;case"alphafolddb":s=yield am(o.params.id,function(){var f=le(function*(p){const m=`https://www.alphafold.ebi.ac.uk/api/prediction/${p.toUpperCase()}`,h=yield n.runTask(n.fetch({url:m,type:"json"}));if(Array.isArray(h)&&h.length>0)return h[0].cifUrl;throw new Error(`No AlphaFold DB entry for '${p}'`)});return function(p){return f.apply(this,arguments)}}(),f=>`AlphaFold DB: ${f}`,!1),a=!!o.params.options.asTrajectory,l="mmcif";break;case"modelarchive":s=yield am(o.params.id,f=>`https://www.modelarchive.org/doi/10.5452/${f.toLowerCase()}.cif`,f=>`Model Archive: ${f}`,!1),a=!!o.params.options.asTrajectory,l="mmcif";break;case"pubchem":s=yield am(o.params.id,f=>`https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/CID/${f.trim()}/record/SDF/?record_type=3d`,f=>`PubChem: ${f}`,!1),a=!!o.params.options.asTrajectory,l="mol";break;default:Hi()}const c=e.source.params.options.representation||n.config.get(ei.Structure.DefaultRepresentationPreset)||Gp.auto.id,u=c!==Gp.empty.id,d="auto"===o.params.options.type.name?void 0:o.params.options.type;yield t.transaction(le(function*(){var f;if(s.length>0&&a){const p=yield n.builders.data.downloadBlob({sources:s.map((h,g)=>({id:""+g,url:h.url,isBinary:h.isBinary})),maxConcurrency:6},{state:{isGhost:!0}}),m=yield n.builders.structure.parseTrajectory(p,{formats:s.map((h,g)=>({id:""+g,format:"cif"}))});yield n.builders.structure.hierarchy.applyPreset(m,"default",{structure:d,showUnitcell:u,representationPreset:c,representationPresetParams:e.source.params.options.representationParams})}else for(const p of s){const m=yield n.builders.data.download(p,{state:{isGhost:!0}}),h="auto"===l?n.dataFormats.auto(RA(jr.getUrl(p.url)),null===(f=m.cell)||void 0===f?void 0:f.obj):n.dataFormats.get(l);if(!h)throw new Error("unknown file format");const g=yield n.builders.structure.parseTrajectory(m,h);yield n.builders.structure.hierarchy.applyPreset(g,"default",{structure:d,showUnitcell:u,representationPreset:c,representationPresetParams:e.source.params.options.representationParams})}})).runInContext(i)});return function(i){return r.apply(this,arguments)}}()));function am(e,t,n,r){return DW.apply(this,arguments)}function DW(){return DW=le(function*(e,t,n,r){const i=e.split(/[,\s]/).map(s=>s.trim()).filter(s=>!!s&&(s.length>=4||/^[1-9][0-9]*$/.test(s))),o=[];for(const s of i)o.push({url:jr.Url(yield t(s)),isBinary:r,label:n(s)});return o}),DW.apply(this,arguments)}function PW(){return PW=le(function*(e){if("pdb"!==e.name||"pdbe"!==e.params.provider.server.name)throw new Error("expected pdbe");return"updated"===e.params.provider.server.params.variant?am(e.params.provider.id,t=>`https://www.ebi.ac.uk/pdbe/static/entry/${t.toLowerCase()}_updated.cif`,t=>`PDBe: ${t} (updated cif)`,!1):"updated-bcif"===e.params.provider.server.params.variant?am(e.params.provider.id,t=>`https://www.ebi.ac.uk/pdbe/entry-files/download/${t.toLowerCase()}.bcif`,t=>`PDBe: ${t} (updated cif)`,!0):am(e.params.provider.id,t=>`https://www.ebi.ac.uk/pdbe/static/entry/${t.toLowerCase()}.cif`,t=>`PDBe: ${t} (cif)`,!1)}),PW.apply(this,arguments)}function kW(){return kW=le(function*(e){if("pdb"!==e.name||"pdbj"!==e.params.provider.server.name)throw new Error("expected pdbj");return am(e.params.provider.id,t=>`https://data.pdbjbk1.pdbj.org/pub/pdb/data/structures/divided/mmCIF/${t.toLowerCase().substring(1,3)}/${t.toLowerCase()}.cif`,t=>`PDBj: ${t} (cif)`,!1)}),kW.apply(this,arguments)}function MW(){return MW=le(function*(e){if("pdb"!==e.name||"rcsb"!==e.params.provider.server.name)throw new Error("expected rcsb");return"cif"===e.params.provider.server.params.encoding?am(e.params.provider.id,t=>`https://files.rcsb.org/download/${t.toUpperCase()}.cif`,t=>`RCSB PDB: ${t} (cif)`,!1):am(e.params.provider.id,t=>`https://models.rcsb.org/${t.toUpperCase()}.bcif`,t=>`RCSB PDB: ${t} (bcif)`,!0)}),MW.apply(this,arguments)}const sO=Hu.build({display:{name:"Update Trajectory"},params:{action:I.Select("advance",I.arrayToOptions(["advance","reset"])),by:I.Optional(I.Numeric(1,{min:-1,max:1,step:1}))}})(({params:e,state:t})=>{const n=t.selectQ(i=>i.ofTransformer(at.Model.ModelFromTrajectory)),r=t.build();if("reset"===e.action)for(const i of n)r.to(i).update({modelIndex:0});else for(const i of n){const o=Qn.findAncestorOfType(t.tree,t.cells,i.transform.ref,Se.Molecule.Trajectory);if(!o||!o.obj)continue;const s=o.obj;r.to(i).update(a=>{let l=(a.modelIndex+e.by)%s.data.frameCount;return l<0&&(l+=s.data.frameCount),{modelIndex:l}})}return t.updateTree(r)}),E0t=Hu.build({display:{name:"Custom Model Properties",description:"Enable parameters for custom properties of the model."},from:Se.Molecule.Model,params:(e,t)=>t.customModelProperties.getParams(e?.data),isApplicable:(e,t,n)=>t.transformer!==xpe})(({ref:e,params:t},n)=>n.builders.structure.insertModelProperties(e,t)),T0t=Hu.build({display:{name:"Custom Structure Properties",description:"Enable parameters for custom properties of the structure."},from:Se.Molecule.Structure,params:(e,t)=>t.customStructureProperties.getParams(e?.data),isApplicable:(e,t,n)=>t.transformer!==Spe})(({ref:e,params:t},n)=>n.builders.structure.insertStructureProperties(e,t)),D0t=Hu.build({display:{name:"Add Trajectory",description:"Add trajectory from existing model/topology and coordinates."},from:Se.Root,params(e,t){const n=t.state.data,i=[...n.selectQ(a=>a.rootsOfType(Se.Molecule.Model)),...n.selectQ(a=>a.rootsOfType(Se.Molecule.Topology))].map(a=>[a.transform.ref,a.obj.label]),s=n.selectQ(a=>a.rootsOfType(Se.Molecule.Coordinates)).map(a=>[a.transform.ref,a.obj.label]);return{model:I.Select(i.length?i[0][0]:"",i),coordinates:I.Select(s.length?s[0][0]:"",s)}}})(({params:e,state:t},n)=>Ke.create("Add Trajectory",r=>t.transaction(le(function*(){const i=[e.model,e.coordinates],o=t.build().toRoot().apply(JH,{modelRef:e.model,coordinatesRef:e.coordinates},{dependsOn:i}).apply(at.Model.ModelFromTrajectory,{modelIndex:0});yield t.updateTree(o).runInContext(r);const s=yield n.builders.structure.createStructure(o.selector);yield n.builders.structure.representation.applyPreset(s,"auto")})).runInContext(r))),P0t=Hu.build({display:{name:"Load Trajectory",description:"Load trajectory of model/topology and coordinates from URL or file."},from:Se.Root,params(e,t){const{options:n}=t.dataFormats,r=n.filter(a=>a[2]===sm||a[2]===BP),i=n.filter(a=>a[2]===NA),o=[],s=[];for(const{provider:a}of t.dataFormats.list)a.category===sm||a.category===BP?(a.binaryExtensions&&o.push(...a.binaryExtensions),a.stringExtensions&&o.push(...a.stringExtensions)):a.category===NA&&(a.binaryExtensions&&s.push(...a.binaryExtensions),a.stringExtensions&&s.push(...a.stringExtensions));return{source:I.MappedStatic("file",{url:I.Group({model:I.Group({url:I.Url(""),format:I.Select(r[0][0],r),isBinary:I.Boolean(!1)},{isExpanded:!0}),coordinates:I.Group({url:I.Url(""),format:I.Select(i[0][0],i)},{isExpanded:!0})},{isFlat:!0}),file:I.Group({model:I.File({accept:o.map(a=>`.${a}`).join(","),label:"Model"}),coordinates:I.File({accept:s.map(a=>`.${a}`).join(","),label:"Coordinates"})},{isFlat:!0})},{options:[["url","URL"],["file","File"]]})}}})(({params:e,state:t},n)=>Ke.create("Load Trajectory",r=>t.transaction(le(function*(){const i=e.source;if("file"===i.name&&(null===i.params.model||null===i.params.coordinates))return void n.log.error("No file(s) selected");if(!("url"!==i.name||i.params.model&&i.params.coordinates))return void n.log.error("No URL(s) given");const o=function(){var a=le(function*(l,c,u){const d=yield n.builders.data.download({url:l,isBinary:u}),f=n.dataFormats.get(c);if(f)return f.parse(n,d);n.log.warn(`LoadTrajectory: could not find data provider for '${c}'`)});return function(c,u,d){return a.apply(this,arguments)}}(),s=function(){var a=le(function*(l){var c,u,d;if(!l)throw new Error("No file selected");const f=RA(null!==(u=null===(c=l.file)||void 0===c?void 0:c.name)&&void 0!==u?u:""),p=n.dataFormats.binaryExtensions.has(f.ext),{data:m}=yield n.builders.data.readFile({file:l,isBinary:p}),h=n.dataFormats.auto(f,null===(d=m.cell)||void 0===d?void 0:d.obj);return h?h.parse(n,m):(n.log.warn(`LoadTrajectory: could not find data provider for '${f.ext}'`),void(yield n.state.data.build().delete(m).commit()))});return function(c){return a.apply(this,arguments)}}();try{const a="url"===i.name?yield o(i.params.model.url,i.params.model.format,i.params.model.isBinary):yield s(i.params.model);let l;l="trajectory"in a?yield t.build().to(a.trajectory).apply(mpe,{modelIndex:0}).commit():a.topology;const c="url"===i.name?yield o(i.params.coordinates.url,i.params.coordinates.format,!0):yield s(i.params.coordinates),u=[l.ref,c.ref],d=t.build().toRoot().apply(JH,{modelRef:l.ref,coordinatesRef:c.ref},{dependsOn:u}).apply(at.Model.ModelFromTrajectory,{modelIndex:0});yield t.updateTree(d).runInContext(r);const f=yield n.builders.structure.createStructure(d.selector);yield n.builders.structure.representation.applyPreset(f,"auto")}catch(a){console.error(a),n.log.error("Error loading trajectory")}})).runInContext(r))),k0t=Hu.build({from:Se.Root,display:{name:"Download Density",description:"Load a density from the provided source and create its default visual."},params:(e,t)=>{const{options:n}=t.dataFormats;return{source:I.MappedStatic("pdb-xray",{"pdb-xray":I.Group({provider:I.Group({id:I.Text("1tqn",{label:"Id"}),server:I.Select("rcsb",[["pdbe","PDBe"],["rcsb","RCSB PDB"]])},{pivot:"id"}),type:I.Select("2fofc",[["2fofc","2Fo-Fc"],["fofc","Fo-Fc"]])},{isFlat:!0}),"pdb-xray-ds":I.Group({provider:I.Group({id:I.Text("1tqn",{label:"Id"}),server:I.Select("pdbe",[["pdbe","PDBe"],["rcsb","RCSB PDB"]])},{pivot:"id"}),detail:I.Numeric(3,{min:0,max:6,step:1},{label:"Detail"})},{isFlat:!0}),"pdb-emd-ds":I.Group({provider:I.Group({id:I.Text("emd-8004",{label:"Id"}),server:I.Select("pdbe",[["pdbe","PDBe"],["rcsb","RCSB PDB"]])},{pivot:"id"}),detail:I.Numeric(3,{min:0,max:6,step:1},{label:"Detail"})},{isFlat:!0}),url:I.Group({url:I.Url(""),isBinary:I.Boolean(!1),format:I.Select("auto",n)},{isFlat:!0})},{options:[["pdb-xray","PDB X-ray maps"],["pdb-emd-ds","PDB EMD Density Server"],["pdb-xray-ds","PDB X-ray Density Server"],["url","URL"]]})}}})(({params:e},t)=>Ke.create("Download Density",function(){var n=le(function*(r){var i,o;const s=e.source;let a,l;switch(s.name){case"url":a=s.params;break;case"pdb-xray":a="pdbe"===s.params.provider.server?{url:jr.Url("2fofc"===s.params.type?`https://www.ebi.ac.uk/pdbe/coordinates/files/${s.params.provider.id.toLowerCase()}.ccp4`:`https://www.ebi.ac.uk/pdbe/coordinates/files/${s.params.provider.id.toLowerCase()}_diff.ccp4`),isBinary:!0,label:`PDBe X-ray map: ${s.params.provider.id}`}:{url:jr.Url("2fofc"===s.params.type?`https://edmaps.rcsb.org/maps/${s.params.provider.id.toLowerCase()}_2fofc.dsn6`:`https://edmaps.rcsb.org/maps/${s.params.provider.id.toLowerCase()}_fofc.dsn6`),isBinary:!0,label:`RCSB X-ray map: ${s.params.provider.id}`};break;case"pdb-emd-ds":a="pdbe"===s.params.provider.server?{url:jr.Url(`https://www.ebi.ac.uk/pdbe/densities/emd/${s.params.provider.id.toLowerCase()}/cell?detail=${s.params.detail}`),isBinary:!0,label:`PDBe EMD Density Server: ${s.params.provider.id}`}:{url:jr.Url(`https://maps.rcsb.org/em/${s.params.provider.id.toLowerCase()}/cell?detail=${s.params.detail}`),isBinary:!0,label:`RCSB PDB EMD Density Server: ${s.params.provider.id}`};break;case"pdb-xray-ds":a="pdbe"===s.params.provider.server?{url:jr.Url(`https://www.ebi.ac.uk/pdbe/densities/x-ray/${s.params.provider.id.toLowerCase()}/cell?detail=${s.params.detail}`),isBinary:!0,label:`PDBe X-ray Density Server: ${s.params.provider.id}`}:{url:jr.Url(`https://maps.rcsb.org/x-ray/${s.params.provider.id.toLowerCase()}/cell?detail=${s.params.detail}`),isBinary:!0,label:`RCSB PDB X-ray Density Server: ${s.params.provider.id}`};break;default:Hi()}const c=yield t.builders.data.download(a);let u;switch(s.name){case"url":a=s.params,l="auto"===s.params.format?t.dataFormats.auto(RA(jr.getUrl(a.url)),null===(i=c.cell)||void 0===i?void 0:i.obj):t.dataFormats.get(s.params.format);break;case"pdb-xray":u=s.params.provider.id,l=t.dataFormats.get("pdbe"===s.params.provider.server?"ccp4":"dsn6");break;case"pdb-emd-ds":case"pdb-xray-ds":u=s.params.provider.id,l=t.dataFormats.get("dscif");break;default:Hi()}if(!l)return void t.log.warn("DownloadDensity: Format provider not found.");const d=yield l.parse(t,c,{entryId:u});yield null===(o=l.visuals)||void 0===o?void 0:o.call(l,t,d)});return function(r){return n.apply(this,arguments)}}())),Cbe=Hu.build({display:{name:"Assign Volume Colors",description:"Assigns another volume to be available for coloring."},from:Se.Volume.Data,isApplicable:e=>!e.data.colorVolume,params(e,t){const n=t.state.data.select(Qn.Generators.root.subtree().ofType(Se.Volume.Data).filter(r=>{var i;return!(!r.obj||null!==(i=r.obj)&&void 0!==i&&i.data.colorVolume||r.obj===e)}));return 0===n.length?{ref:I.Text("",{isHidden:!0,label:"Volume"})}:{ref:I.Select(n[0].transform.ref,n.map(r=>[r.transform.ref,r.obj.label]),{label:"Volume"})}}})(({ref:e,params:t},r)=>r.build().to(e).apply(at.Volume.AssignColorVolume,{ref:t.ref},{dependsOn:[t.ref]}).commit());function aO(e,t,n,r){return RW.apply(this,arguments)}function RW(){return RW=le(function*(e,t,n,r){var i,o,s,a;const l=RA(null!==(o=null===(i=e.file)||void 0===i?void 0:i.name)&&void 0!==o?o:""),c=t.dataFormats.binaryExtensions.has(l.ext),{data:u}=yield t.builders.data.readFile({file:e,isBinary:c}),d="auto"===n?t.dataFormats.auto(l,null===(s=u.cell)||void 0===s?void 0:s.obj):t.dataFormats.get(n);if(!d)return t.log.warn(`OpenFiles: could not find data provider for '${l.ext}'`),void(yield t.state.data.build().delete(u).commit());const f=yield d.parse(t,u);r&&(yield null===(a=d.visuals)||void 0===a?void 0:a.call(d,t,f))}),RW.apply(this,arguments)}const NW=Hu.build({display:{name:"Open Files",description:"Load one or more files and optionally create default visuals"},from:Se.Root,params:(e,t)=>{const{extensions:n,options:r}=t.dataFormats;return{files:I.FileList({accept:Array.from(n.values()).map(i=>`.${i}`).join(",")+",.gz,.zip",multiple:!0}),format:I.MappedStatic("auto",{auto:I.EmptyGroup(),specific:I.Select(r[0][0],r)}),visuals:I.Boolean(!0,{description:"Add default visuals"})}}})(({params:e,state:t},n)=>Ke.create("Open Files",function(){var r=le(function*(i){n.behaviors.layout.leftPanelTabName.next("data"),yield t.transaction(le(function*(){if(null!==e.files)for(const o of e.files)try{if(o.file&&o.name.toLowerCase().endsWith(".zip")){const s=yield q3(i,yield o.file.arrayBuffer());for(const[a,l]of Object.entries(s)){if(!(l instanceof Uint8Array)||0===l.length)continue;const c=jr.File(new File([l],a));yield aO(c,n,"auto",e.visuals)}}else{const s="auto"===e.format.name?"auto":e.format.params;yield aO(o,n,s,e.visuals)}}catch(s){console.error(s),n.log.error(`Error opening file '${o.name}'`)}else n.log.error("No file(s) selected")})).runInContext(i)});return function(i){return r.apply(this,arguments)}}())),M0t=Hu.build({display:{name:"Download File",description:"Load one or more file from an URL"},from:Se.Root,params:(e,t)=>{const n=[...t.dataFormats.options,["zip","Zip"],["gzip","Gzip"]];return{url:I.Url(""),format:I.Select(n[0][0],n),isBinary:I.Boolean(!1),visuals:I.Boolean(!0,{description:"Add default visuals"})}}})(({params:e,state:t},n)=>Ke.create("Open Files",function(){var r=le(function*(i){n.behaviors.layout.leftPanelTabName.next("data"),yield t.transaction(le(function*(){var o,s,a;try{if("zip"===e.format||"gzip"===e.format){const l=yield n.builders.data.download({url:e.url,isBinary:!0});if("zip"===e.format){const c=yield q3(i,(null===(o=l.obj)||void 0===o?void 0:o.data).buffer);for(const[u,d]of Object.entries(c)){if(!(d instanceof Uint8Array)||0===d.length)continue;const f=jr.File(new File([d],u));yield aO(f,n,"auto",e.visuals)}}else{const u=RA(jr.getUrl(e.url)).name;yield aO(jr.File(new File([null===(s=l.obj)||void 0===s?void 0:s.data],u)),n,"auto",e.visuals)}}else{const l=n.dataFormats.get(e.format);if(!l)return void n.log.warn(`DownloadFile: could not find data provider for '${e.format}'`);const c=yield n.builders.data.download({url:e.url,isBinary:e.isBinary}),u=yield l.parse(n,c);e.visuals&&(yield null===(a=l.visuals)||void 0===a?void 0:a.call(l,n,u))}}catch(l){console.error(l),n.log.error(`Error downloading '${"string"==typeof e.url?e.url:e.url.url}'`)}})).runInContext(i)});return function(i){return r.apply(this,arguments)}}())),s2={Structure:Cc,Volume:wc,DataFormat:Ss},R0t=Uy.create({name:"built-in.animate-state-interpolation",display:{name:"Animate State (experimental)"},params:()=>({transtionDurationInMs:I.Numeric(2e3,{min:100,max:3e4,step:10})}),canApply:e=>({canApply:e.managers.snapshot.state.entries.size>1}),initialState:()=>({}),apply:(e,t,n)=>le(function*(){const r=n.plugin.managers.snapshot.state.entries;if(r.size<2)return{kind:"finished"};const i=t.current%n.params.transtionDurationInMs/n.params.transtionDurationInMs,o=Math.floor(t.current/n.params.transtionDurationInMs)%r.size;let s=Math.ceil(t.current/n.params.transtionDurationInMs);s===o&&s++,s%=r.size;const a=r.get(o).snapshot,l=r.get(s).snapshot;if(!a.data||!l.data)return{kind:"skip"};const c=a.data.tree.transforms,u=l.data.tree.transforms,d=n.plugin.state.data,f=d.build();for(const p of c)for(const m of u){if(m.ref!==p.ref||m.version===p.version)continue;const h=vr.fromJSON(p),g=vr.fromJSON(m),y=d.cells.get(p.ref);if(!y)continue;let v;v=h.transformer.definition.interpolate?h.transformer.definition.interpolate(h.params,g.params,i,n.plugin):i<=.5?h.params:g.params,l3(y,v)||f.to(p.ref).update(v)}return yield jt.State.Update(n.plugin,{state:d,tree:f,options:{doNotLogTiming:!0}}),{kind:"next",state:{}}})()}),N0t=Uy.create({name:"built-in.animate-structure-spin",display:{name:"Spin Structure"},isExportable:!0,params:()=>({durationInMs:I.Numeric(3e3,{min:100,max:1e4,step:100})}),initialState:()=>({t:0}),getDuration:e=>({kind:"fixed",durationMs:e.durationInMs}),setup:(e,t,n)=>le(function*(){const r=n.state.data,i=r.select(Qn.Generators.ofType(Se.Molecule.Structure.Representation3D)),o=r.build();let s=!1;for(const a of i)r.select(Qn.Generators.ofTransformer(at.Representation.SpinStructureRepresentation3D,a.transform.ref)).length>0||(s=!0,o.to(a.transform.ref).apply(at.Representation.SpinStructureRepresentation3D,{t:0},{tags:"animate-structure-spin"}));if(s)return o.commit({doNotUpdateCurrent:!0})})(),teardown(e,t,n){const r=n.state.data,i=r.select(Qn.Generators.ofType(Se.Molecule.Structure.Representation3DState).withTag("animate-structure-spin"));if(0===i.length)return;const o=r.build();for(const s of i)o.delete(s.transform.ref);return o.commit()},apply:(e,t,n)=>le(function*(){var r;const i=n.plugin.state.data,o=i.select(Qn.Generators.ofTransformer(at.Representation.SpinStructureRepresentation3D));if(0===o.length)return{kind:"finished"};const s=i.build(),l=(e.t+(t.current-t.lastApplied)/n.params.durationInMs)%1;for(const c of o)s.to(c).update({...null===(r=c.params)||void 0===r?void 0:r.values,t:l});return yield jt.State.Update(n.plugin,{state:i,tree:s,options:{doNotLogTiming:!0}}),{kind:"next",state:{t:l}}})()}),lO=C(),wbe=C(),Abe=Ai(),F0t=Uy.create({name:"built-in.animate-camera-rock",display:{name:"Camera Rock",description:"Rock the 3D scene around the x-axis in view space"},isExportable:!0,params:()=>({durationInMs:I.Numeric(4e3,{min:100,max:2e4,step:100}),speed:I.Numeric(1,{min:1,max:10,step:1},{description:"How many times to rock from side to side."}),angle:I.Numeric(10,{min:0,max:180,step:1},{description:"How many degrees to rotate in each direction."})}),initialState:(e,t)=>({snapshot:t.canvas3d.camera.getSnapshot()}),getDuration:e=>({kind:"fixed",durationMs:e.durationInMs}),teardown:(e,t,n)=>{var r;null===(r=n.canvas3d)||void 0===r||r.requestCameraReset({snapshot:t.snapshot,durationMs:0})},apply:(e,t,n)=>le(function*(){var r,i;if(0===t.current)return{kind:"next",state:e};const o=e.snapshot;if(o.radiusMax<1e-4)return{kind:"finished"};const s=t.animation?(null===(r=t.animation)||void 0===r?void 0:r.currentFrame)/(t.animation.frameCount+1):al(t.current/n.params.durationInMs,0,1),a=Math.sin(s*n.params.speed*Math.PI*2)*Xr(n.params.angle);C.sub(lO,o.position,o.target),C.normalize(wbe,o.up),Ai.setAxisAngle(Abe,wbe,a),C.transformQuat(lO,lO,Abe);const l=C.add(C(),o.target,lO);return null===(i=n.plugin.canvas3d)||void 0===i||i.requestCameraReset({snapshot:{...o,position:l},durationMs:0}),s>=.99999?{kind:"finished"}:{kind:"next",state:e}})()});var Vn;!function(e){e.Action=function t(r,i){return{action:r,customControl:i&&i.customControl,autoUpdate:i&&i.autoUpdate}},e.Behavior=function n(r,i={}){return{transformer:r,defaultParams:i}}}(Vn||(Vn={}));var L=ln(619),Yt=ln(395);function Mi(e){return e.svg?(0,L.jsx)("span",{className:"msp-icon msp-material-icon"+(e.inline?" msp-icon-inline":""),title:e.title,style:e.style,children:(0,L.jsx)(e.svg,{})}):null}const cO=(0,L.jsx)("circle",{r:"6px",id:"circle-left",cy:"12px",cx:"8px",strokeWidth:"1px"}),uO=(0,L.jsx)("circle",{r:"6px",id:"circle-right",cy:"12px",cx:"16px",strokeWidth:"1px"}),B0t=(0,L.jsxs)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:[(0,L.jsxs)("defs",{children:[cO,uO]}),(0,L.jsxs)("g",{children:[(0,L.jsx)("use",{href:"#circle-left",className:"msp-shape-filled"}),(0,L.jsx)("use",{href:"#circle-right",className:"msp-shape-filled"}),(0,L.jsx)("use",{href:"#circle-left",className:"msp-shape-empty"})]})]});function FW(){return B0t}const L0t=(0,L.jsxs)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:[(0,L.jsxs)("defs",{children:[cO,uO,(0,L.jsxs)("mask",{id:"mask-left",children:[(0,L.jsx)("use",{href:"#circle-left",fill:"white",stroke:"white"}),(0,L.jsx)("use",{href:"#circle-right",fill:"black",strokeWidth:"0px",stroke:"white"})]})]}),(0,L.jsxs)("g",{children:[(0,L.jsx)("use",{href:"#circle-left",className:"msp-shape-filled",mask:"url(#mask-left)"}),(0,L.jsx)("use",{href:"#circle-right",className:"msp-shape-empty"})]})]});function OW(){return L0t}const j0t=(0,L.jsxs)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:[(0,L.jsxs)("defs",{children:[cO,uO,(0,L.jsx)("clipPath",{id:"clip-left",children:(0,L.jsx)("use",{href:"#circle-right"})})]}),(0,L.jsxs)("g",{children:[(0,L.jsx)("use",{href:"#circle-left",className:"msp-shape-filled",clipPath:"url(#clip-left)"}),(0,L.jsx)("use",{href:"#circle-left",className:"msp-shape-empty"}),(0,L.jsx)("use",{href:"#circle-right",className:"msp-shape-empty"})]})]});function BW(){return j0t}const U0t=(0,L.jsxs)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:[(0,L.jsxs)("defs",{children:[cO,uO]}),(0,L.jsxs)("g",{children:[(0,L.jsx)("use",{href:"#circle-left",className:"msp-shape-empty"}),(0,L.jsx)("use",{href:"#circle-right",className:"msp-shape-filled"})]})]});function dO(){return U0t}const z0t=(0,L.jsx)("svg",{width:"17px",height:"17px",viewBox:"0 0 299.463 299.463",strokeWidth:"6px",children:(0,L.jsx)("g",{children:(0,L.jsx)("path",{d:"M256.851,173.832v-48.201c22.916-4.918,34.151-30.668,22.556-50.771c-11.547-20.004-39.486-23.251-55.242-5.844 l-41.746-24.106C189.618,22.603,172.861,0,149.734,0c-23.132,0-39.881,22.609-32.685,44.911L75.305,69.016 C59.522,51.586,31.597,54.88,20.061,74.863c-11.63,20.163-0.298,45.862,22.557,50.769v48.2 c-22.821,4.898-34.195,30.591-22.556,50.771c11.529,19.972,39.454,23.285,55.242,5.845l41.746,24.106 c-7.199,22.308,9.559,44.911,32.685,44.911c23.132,0,39.88-22.609,32.685-44.911l41.745-24.106 c15.817,17.469,43.73,14.099,55.242-5.844c0,0,0-0.001,0.001-0.002c4.587-7.953,5.805-17.213,3.431-26.076 C279.392,185.657,269.129,176.461,256.851,173.832z M249.62,72.088c20.568,0,27.428,27.191,10.008,37.239 c-0.003,0.002-0.006,0.003-0.009,0.005c-10.04,5.81-22.85,1.762-27.877-8.475C225.206,87.548,234.938,72.088,249.62,72.088z M149.734,14.4c11.005,0,19.958,8.954,19.958,19.959c0,11.127-9.077,19.958-19.958,19.958c-10.95,0-19.958-8.9-19.958-19.958 C129.776,23.354,138.729,14.4,149.734,14.4z M39.84,109.328c-17.451-10.067-10.534-37.24,10.01-37.24 c15.311,0,24.922,16.653,17.251,29.942C61.681,111.397,49.517,114.925,39.84,109.328z M59.802,224.702 c-9.535,5.503-21.768,2.229-27.268-7.298c-7.639-13.242,1.887-29.945,17.236-29.945c0.013,0,0.027,0,0.04,0 C70.07,187.48,77.49,214.469,59.802,224.702z M149.734,285.062c-11.005,0-19.958-8.954-19.958-19.958 c0-11.127,9.077-19.958,19.958-19.958c10.954,0,19.958,8.903,19.958,19.958C169.693,276.109,160.74,285.062,149.734,285.062z M216.953,217.982l-41.727,24.095c-13.778-15.22-37.459-14.94-50.983,0l-41.728-24.096c6.196-19.289-5.541-39.835-25.498-44.149 V125.63c19.752-4.268,31.762-24.65,25.498-44.149l41.727-24.095c13.629,15.055,37.32,15.093,50.983,0l41.728,24.096 c-6.196,19.29,5.534,39.835,25.498,44.149v48.202C222.61,178.123,210.721,198.581,216.953,217.982z M266.935,217.404 c-5.501,9.528-17.732,12.802-27.261,7.302c-17.682-10.23-10.301-37.247,10.032-37.247 C264.984,187.459,274.602,204.112,266.935,217.404z"})})});function V0t(){return z0t}const H0t=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",strokeWidth:"0.1px",children:(0,L.jsx)("path",{d:"M21,16.5C21,16.88 20.79,17.21 20.47,17.38L12.57,21.82C12.41,21.94 12.21,22 12,22C11.79,22 11.59,21.94 11.43,21.82L3.53,17.38C3.21,17.21 3,16.88 3,16.5V7.5C3,7.12 3.21,6.79 3.53,6.62L11.43,2.18C11.59,2.06 11.79,2 12,2C12.21,2 12.41,2.06 12.57,2.18L20.47,6.62C20.79,6.79 21,7.12 21,7.5V16.5M12,4.15L6.04,7.5L12,10.85L17.96,7.5L12,4.15M5,15.91L11,19.29V12.58L5,9.21V15.91M19,15.91V9.21L13,12.58V19.29L19,15.91Z"})});function LW(){return H0t}(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",strokeWidth:"0.1px",children:(0,L.jsx)("path",{d:"M17,22V20H20V17H22V20.5C22,20.89 21.84,21.24 21.54,21.54C21.24,21.84 20.89,22 20.5,22H17M7,22H3.5C3.11,22 2.76,21.84 2.46,21.54C2.16,21.24 2,20.89 2,20.5V17H4V20H7V22M17,2H20.5C20.89,2 21.24,2.16 21.54,2.46C21.84,2.76 22,3.11 22,3.5V7H20V4H17V2M7,2V4H4V7H2V3.5C2,3.11 2.16,2.76 2.46,2.46C2.76,2.16 3.11,2 3.5,2H7M13,17.25L17,14.95V10.36L13,12.66V17.25M12,10.92L16,8.63L12,6.28L8,8.63L12,10.92M7,14.95L11,17.25V12.66L7,10.36V14.95M18.23,7.59C18.73,7.91 19,8.34 19,8.91V15.23C19,15.8 18.73,16.23 18.23,16.55L12.75,19.73C12.25,20.05 11.75,20.05 11.25,19.73L5.77,16.55C5.27,16.23 5,15.8 5,15.23V8.91C5,8.34 5.27,7.91 5.77,7.59L11.25,4.41C11.5,4.28 11.75,4.22 12,4.22C12.25,4.22 12.5,4.28 12.75,4.41L18.23,7.59Z"})}),(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",strokeWidth:"0.1px",children:(0,L.jsx)("path",{d:"M16,4L9,8.04V15.96L16,20L23,15.96V8.04M16,6.31L19.8,8.5L16,10.69L12.21,8.5M0,7V9H7V7M11,10.11L15,12.42V17.11L11,14.81M21,10.11V14.81L17,17.11V12.42M2,11V13H7V11M4,15V17H7V15"})});const W0t=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M10.07,14.27C10.57,14.03 11.16,14.25 11.4,14.75L13.7,19.74L15.5,18.89L13.19,13.91C12.95,13.41 13.17,12.81 13.67,12.58L13.95,12.5L16.25,12.05L8,5.12V15.9L9.82,14.43L10.07,14.27M13.64,21.97C13.14,22.21 12.54,22 12.31,21.5L10.13,16.76L7.62,18.78C7.45,18.92 7.24,19 7,19A1,1 0 0,1 6,18V3A1,1 0 0,1 7,2C7.24,2 7.47,2.09 7.64,2.23L7.65,2.22L19.14,11.86C19.57,12.22 19.62,12.85 19.27,13.27C19.12,13.45 18.91,13.57 18.7,13.61L15.54,14.23L17.74,18.96C18,19.46 17.76,20.05 17.26,20.28L13.64,21.97Z"})});(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",strokeWidth:"0.1px",children:(0,L.jsx)("path",{fill:"currentColor",d:"M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z"})}),(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",strokeWidth:"0.1px",children:(0,L.jsx)("path",{fill:"currentColor",d:"M20,11H23V13H20V11M1,11H4V13H1V11M13,1V4H11V1H13M4.92,3.5L7.05,5.64L5.63,7.05L3.5,4.93L4.92,3.5M16.95,5.63L19.07,3.5L20.5,4.93L18.37,7.05L16.95,5.63M12,6A6,6 0 0,1 18,12C18,14.22 16.79,16.16 15,17.2V19A1,1 0 0,1 14,20H10A1,1 0 0,1 9,19V17.2C7.21,16.16 6,14.22 6,12A6,6 0 0,1 12,6M14,21V22A1,1 0 0,1 13,23H11A1,1 0 0,1 10,22V21H14M11,18H13V15.87C14.73,15.43 16,13.86 16,12A4,4 0 0,0 12,8A4,4 0 0,0 8,12C8,13.86 9.27,15.43 11,15.87V18Z"})});const K0t=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{fill:"currentColor",d:"M7.5,5.6L5,7L6.4,4.5L5,2L7.5,3.4L10,2L8.6,4.5L10,7L7.5,5.6M19.5,15.4L22,14L20.6,16.5L22,19L19.5,17.6L17,19L18.4,16.5L17,14L19.5,15.4M22,2L20.6,4.5L22,7L19.5,5.6L17,7L18.4,4.5L17,2L19.5,3.4L22,2M13.34,12.78L15.78,10.34L13.66,8.22L11.22,10.66L13.34,12.78M14.37,7.29L16.71,9.63C17.1,10 17.1,10.65 16.71,11.04L5.04,22.71C4.65,23.1 4,23.1 3.63,22.71L1.29,20.37C0.9,20 0.9,19.35 1.29,18.96L12.96,7.29C13.35,6.9 14,6.9 14.37,7.29Z"})});function Z0t(){return K0t}const Q0t=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",strokeWidth:"0.1px",children:(0,L.jsx)("path",{d:"M3 17.25V21H6.75L17.81 9.93L14.06 6.18L3 17.25M22.61 18.36L18.36 22.61L13.16 17.41L14.93 15.64L15.93 16.64L18.4 14.16L19.82 15.58L18.36 17L19.42 18L20.84 16.6L22.61 18.36M6.61 10.83L1.39 5.64L5.64 1.39L7.4 3.16L4.93 5.64L6 6.7L8.46 4.22L9.88 5.64L8.46 7.05L9.46 8.05L6.61 10.83M20.71 7C21.1 6.61 21.1 6 20.71 5.59L18.37 3.29C18 2.9 17.35 2.9 16.96 3.29L15.12 5.12L18.87 8.87L20.71 7Z"})});function J0t(){return Q0t}const eyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3h7zM7 9H4V5h3v4zm10 6h3v4h-3v-4zm0-10h3v4h-3V5z"})});function Ibe(){return eyt}const tyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"})});function FA(){return tyt}const nyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"})});function fO(){return nyt}const ryt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M7 10l5 5 5-5z"})});function Yy(){return ryt}const iyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M10 17l5-5-5-5v10z"})});function Xy(){return iyt}const oyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"})});function pO(){return oyt}const syt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6zm6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26z"})});function ayt(){return syt}const lyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M6 13c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-8c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm-3 .5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM6 5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm15 5.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM14 7c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0-3.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zm-11 10c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm7 7c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm0-17c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM10 7c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0 5.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm8 .5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-8c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm3 8.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM14 17c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 3.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm-4-12c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0 8.5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm4-4.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-4c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5z"})});function Ebe(){return lyt}const cyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M15 7v12.97l-4.21-1.81-.79-.34-.79.34L5 19.97V7h10m4-6H8.99C7.89 1 7 1.9 7 3h10c1.1 0 2 .9 2 2v13l2 1V3c0-1.1-.9-2-2-2zm-4 4H5c-1.1 0-2 .9-2 2v16l7-3 7 3V7c0-1.1-.9-2-2-2z"})});function OA(){return cyt}const uyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M7 14c-1.66 0-3 1.34-3 3 0 1.31-1.16 2-2 2 .92 1.22 2.49 2 4 2 2.21 0 4-1.79 4-4 0-1.66-1.34-3-3-3zm13.71-9.37l-1.34-1.34a.9959.9959 0 00-1.41 0L9 12.25 11.75 15l8.96-8.96c.39-.39.39-1.02 0-1.41z"})});function jW(){return uyt}const dyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M22.61 18.99l-9.08-9.08c.93-2.34.45-5.1-1.44-7C9.79.61 6.21.4 3.66 2.26L7.5 6.11 6.08 7.52 2.25 3.69C.39 6.23.6 9.82 2.9 12.11c1.86 1.86 4.57 2.35 6.89 1.48l9.11 9.11c.39.39 1.02.39 1.41 0l2.3-2.3c.4-.38.4-1.01 0-1.41zm-3 1.6l-9.46-9.46c-.61.45-1.29.72-2 .82-1.36.2-2.79-.21-3.83-1.25C3.37 9.76 2.93 8.5 3 7.26l3.09 3.09 4.24-4.24-3.09-3.09c1.24-.07 2.49.37 3.44 1.31 1.08 1.08 1.49 2.57 1.24 3.96-.12.71-.42 1.37-.88 1.96l9.45 9.45-.88.89z"})});function fyt(){return dyt}const pyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z"})});function hyt(){return pyt}const myt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M14.25 2.26l-.08-.04-.01.02C13.46 2.09 12.74 2 12 2 6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10c0-4.75-3.31-8.72-7.75-9.74zM19.41 9h-7.99l2.71-4.7c2.4.66 4.35 2.42 5.28 4.7zM13.1 4.08L10.27 9l-1.15 2L6.4 6.3C7.84 4.88 9.82 4 12 4c.37 0 .74.03 1.1.08zM5.7 7.09L8.54 12l1.15 2H4.26C4.1 13.36 4 12.69 4 12c0-1.85.64-3.55 1.7-4.91zM4.59 15h7.98l-2.71 4.7c-2.4-.67-4.34-2.42-5.27-4.7zm6.31 4.91L14.89 13l2.72 4.7C16.16 19.12 14.18 20 12 20c-.38 0-.74-.04-1.1-.09zm7.4-3l-4-6.91h5.43c.17.64.27 1.31.27 2 0 1.85-.64 3.55-1.7 4.91z"})});function gyt(){return myt}const yyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M9.4 10.5l4.77-8.26C13.47 2.09 12.75 2 12 2c-2.4 0-4.6.85-6.32 2.25l3.66 6.35.06-.1zM21.54 9c-.92-2.92-3.15-5.26-6-6.34L11.88 9h9.66zm.26 1h-7.49l.29.5 4.76 8.25C21 16.97 22 14.61 22 12c0-.69-.07-1.35-.2-2zM8.54 12l-3.9-6.75C3.01 7.03 2 9.39 2 12c0 .69.07 1.35.2 2h7.49l-1.15-2zm-6.08 3c.92 2.92 3.15 5.26 6 6.34L12.12 15H2.46zm11.27 0l-3.9 6.76c.7.15 1.42.24 2.17.24 2.4 0 4.6-.85 6.32-2.25l-3.66-6.35-.93 1.6z"})});function byt(){return yyt}const vyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"})});function UW(){return vyt}const xyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"})});function Tbe(){return xyt}const _yt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm-7 7H3v4c0 1.1.9 2 2 2h4v-2H5v-4zM5 5h4V3H5c-1.1 0-2 .9-2 2v4h2V5zm14-2h-4v2h4v4h2V5c0-1.1-.9-2-2-2zm0 16h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4z"})});function Syt(){return _yt}const Cyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})});function a2(){return Cyt}const wyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})});function Dbe(){return wyt}const Ayt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})});function Rg(){return Ayt}const Iyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"})});function Eyt(){return Iyt}const Tyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"})});function Dyt(){return Tyt}const Pyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4H8c-1.1 0-1.99.9-1.99 2L6 21c0 1.1.89 2 1.99 2H19c1.1 0 2-.9 2-2V11l-6-6zM8 21V7h6v5h5v9H8z"})});function kyt(){return Pyt}const Myt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M17 15h2V7c0-1.1-.9-2-2-2H9v2h8v8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2H7z"})});function Ryt(){return Myt}const Nyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2zm2 10H3v4c0 1.1.9 2 2 2h4v-2H5v-4zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2z"})});function Fyt(){return Nyt}const Oyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-5.04-6.71l-2.75 3.54-1.96-2.36L6.5 17h11l-3.54-4.71z"})});function Byt(){return Oyt}const Lyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"})});function qp(){return Lyt}(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"})});const Uyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})});function Pbe(){return Uyt}(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11z"})});const Vyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",strokeWidth:"0.1px",children:(0,L.jsx)("path",{d:"M3 13h2v-2H3v2zm0 4h2v-2H3v2zm2 4v-2H3c0 1.1.89 2 2 2zM3 9h2V7H3v2zm12 12h2v-2h-2v2zm4-18H9c-1.11 0-2 .9-2 2v10c0 1.1.89 2 2 2h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 12H9V5h10v10zm-8 6h2v-2h-2v2zm-4 0h2v-2H7v2z"})}),Gyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"})});function qyt(){return Gyt}const Wyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"})});function zW(){return Wyt}const $yt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M11 18h2v-2h-2v2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4z"})});function Ng(){return $yt}const Yyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M12 5.69l5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3L2 12h3v8h6v-6h2v6h6v-8h3L12 3z"})});function VW(){return Yyt}(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"})});const Kyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M19.5 9.5c-1.03 0-1.9.62-2.29 1.5h-2.92c-.39-.88-1.26-1.5-2.29-1.5s-1.9.62-2.29 1.5H6.79c-.39-.88-1.26-1.5-2.29-1.5C3.12 9.5 2 10.62 2 12s1.12 2.5 2.5 2.5c1.03 0 1.9-.62 2.29-1.5h2.92c.39.88 1.26 1.5 2.29 1.5s1.9-.62 2.29-1.5h2.92c.39.88 1.26 1.5 2.29 1.5 1.38 0 2.5-1.12 2.5-2.5s-1.12-2.5-2.5-2.5z"})}),Qyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})});function l2(){return Qyt}const Jyt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})});function kbe(){return Jyt}const ebt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})});function Mbe(){return ebt}const tbt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h4v-2H5V8h14v10h-4v2h4c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm-7 6l-4 4h3v6h2v-6h3l-4-4z"})});function nbt(){return tbt}const rbt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M8 5v14l11-7z"})});function Rbe(){return rbt}const ibt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"})});function HW(){return ibt}const obt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M19 13H5v-2h14v2z"})});function GW(){return obt}const sbt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"})});function qW(){return sbt}const abt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",strokeWidth:"0.1px",children:(0,L.jsx)("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm2 16H5V5h11.17L19 7.83V19zm-7-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3zM6 6h9v4H6z"})});function Nbe(){return abt}const lbt=(0,L.jsxs)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:[(0,L.jsx)("circle",{cx:"7",cy:"14",r:"3"}),(0,L.jsx)("circle",{cx:"11",cy:"6",r:"3"}),(0,L.jsx)("circle",{cx:"16.6",cy:"17.6",r:"3"})]});(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"})});const dbt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M6 6h2v12H6zm3.5 6l8.5 6V6z"})});function fbt(){return dbt}const pbt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M6 6h12v12H6z"})});function Fbe(){return pbt}const hbt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M4 6h16v2H4zm2-4h12v2H6zm14 8H4c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm0 10H4v-8h16v8zm-10-7.27v6.53L16 16z"})});function mbt(){return hbt}const gbt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M6.99 11L3 15l3.99 4v-3H14v-2H6.99v-3zM21 9l-3.99-4v3H10v2h7.01v3L21 9z"})});function ybt(){return gbt}const bbt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"})});function uv(){return bbt}const vbt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5-.59 1.22-1.42 2.27-2.41 3.12l1.41 1.41c1.39-1.23 2.49-2.77 3.18-4.53C21.27 7.11 17 4 12 4c-1.27 0-2.49.2-3.64.57l1.65 1.65C10.66 6.09 11.32 6 12 6zm-1.07 1.14L13 9.21c.57.25 1.03.71 1.28 1.28l2.07 2.07c.08-.34.14-.7.14-1.07C16.5 9.01 14.48 7 12 7c-.37 0-.72.05-1.07.14zM2.01 3.87l2.68 2.68C3.06 7.83 1.77 9.53 1 11.5 2.73 15.89 7 19 12 19c1.52 0 2.98-.29 4.32-.82l3.42 3.42 1.41-1.41L3.42 2.45 2.01 3.87zm7.5 7.5l2.61 2.61c-.04.01-.08.02-.12.02-1.38 0-2.5-1.12-2.5-2.5 0-.05.01-.08.01-.13zm-3.4-3.4l1.75 1.75c-.23.55-.36 1.15-.36 1.78 0 2.48 2.02 4.5 4.5 4.5.63 0 1.23-.13 1.77-.36l.98.98c-.88.24-1.8.38-2.75.38-3.79 0-7.17-2.13-8.82-5.5.7-1.43 1.72-2.61 2.93-3.53z"})});function c2(){return vbt}const xbt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5C19.17 14.87 15.79 17 12 17s-7.17-2.13-8.82-5.5C4.83 8.13 8.21 6 12 6m0-2C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4zm0 5c1.38 0 2.5 1.12 2.5 2.5S13.38 14 12 14s-2.5-1.12-2.5-2.5S10.62 9 12 9m0-2c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7z"})});function u2(){return xbt}const _bt=(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"})});function Obe(){return _bt}(0,L.jsx)("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",children:(0,L.jsx)("path",{d:"M 9.64 7.64 c 0.23 -0.5 0.36 -1.05 0.36 -1.64 c 0 -2.21 -1.79 -4 -4 -4 S 2 3.79 2 6 s 1.79 4 4 4 c 0.59 0 1.14 -0.13 1.64 -0.36 L 10 12 l -2.36 2.36 C 7.14 14.13 6.59 14 6 14 c -2.21 0 -4 1.79 -4 4 s 1.79 4 4 4 s 4 -1.79 4 -4 c 0 -0.59 -0.13 -1.14 -0.36 -1.64 L 12 14 l 7 7 h 3 v -1 L 9.64 7.64 Z M 6 8 c -1.1 0 -2 -0.89 -2 -2 s 0.9 -2 2 -2 s 2 0.89 2 2 s -0.9 2 -2 2 Z m 0 12 c -1.1 0 -2 -0.89 -2 -2 s 0.9 -2 2 -2 s 2 0.89 2 2 s -0.9 2 -2 2 Z m 6 -7.5 c -0.28 0 -0.5 -0.22 -0.5 -0.5 s 0.22 -0.5 0.5 -0.5 s 0.5 0.22 0.5 0.5 s -0.22 0.5 -0.5 0.5 Z M 19 3 l -6 6 l 2 2 l 7 -7 V 3 Z"})});const Cbt=function $0t(){return W0t},wbt=function cbt(){return lbt},Bbe=function Zyt(){return Kyt},Abt=function Hyt(){return Vyt};class Fg extends Yt.Component{constructor(){super(...arguments),this.state={isExpanded:!!this.props.initialExpanded},this.headerClicked=()=>{this.props.onHeaderClick?this.props.onHeaderClick():this.setState({isExpanded:!this.state.isExpanded})}}render(){let t=this.props.hideOffset?"msp-control-group-children":"msp-control-group-children msp-control-offset";return this.props.childrenClassName&&(t+=" "+this.props.childrenClassName),(0,L.jsxs)("div",{className:"msp-control-group-wrapper",style:{position:"relative",marginTop:this.props.noTopMargin?0:void 0},children:[(0,L.jsx)("div",{className:"msp-control-group-header",style:{marginLeft:this.props.headerLeftMargin},title:this.props.title,children:(0,L.jsxs)(ir,{onClick:this.headerClicked,children:[!this.props.hideExpander&&(0,L.jsx)(Mi,{svg:this.state.isExpanded?Xy:Yy}),this.props.topRightIcon&&(0,L.jsx)(Mi,{svg:this.props.topRightIcon,style:{position:"absolute",right:"2px",top:0}}),(0,L.jsx)("b",{children:this.props.header})]})}),this.state.isExpanded&&(0,L.jsx)("div",{className:t,style:{display:this.state.isExpanded?"block":"none",maxHeight:this.props.maxHeight,overflow:"hidden",overflowY:"auto"},children:this.props.children})]})}}function Lbe(e){return e}class Ky extends Yt.PureComponent{constructor(){super(...arguments),this.input=Yt.createRef(),this.delayHandle=void 0,this.pendingValue=void 0,this.state={originalValue:"",value:""},this.onBlur=()=>{this.setState({value:""+this.state.originalValue}),this.props.onBlur&&this.props.onBlur()},this.raiseOnChange=()=>{void 0!==this.pendingValue&&(this.props.onChange(this.pendingValue),this.pendingValue=void 0)},this.onChange=t=>{const n=t.target.value;if(this.props.isValid&&!this.props.isValid(n)||this.props.numeric&&Number.isNaN(+n))return this.clearTimeout(),void this.setState({value:n});if(this.props.numeric)this.setState({value:n},()=>this.triggerChanged(n,+n));else{const i=(this.props.toValue||Lbe)(n),o=(this.props.fromValue||Lbe)(i);this.setState({value:o},()=>this.triggerChanged(o,i))}},this.onKeyUp=t=>{(27===t.charCode||27===t.keyCode||"Escape"===t.key)&&this.props.blurOnEscape&&this.input.current&&this.input.current.blur()},this.onKeyPress=t=>{(13===t.keyCode||13===t.charCode||"Enter"===t.key)&&(this.isPending&&(this.clearTimeout(),this.raiseOnChange()),this.props.blurOnEnter&&this.input.current&&this.input.current.blur(),this.props.onEnter&&this.props.onEnter()),t.stopPropagation()}}get isPending(){return typeof this.delayHandle<"u"}clearTimeout(){this.isPending&&(clearTimeout(this.delayHandle),this.delayHandle=void 0)}triggerChanged(t,n){this.clearTimeout(),t!==this.state.originalValue&&(this.props.delayMs?(this.pendingValue=n,this.delayHandle=setTimeout(this.raiseOnChange,this.props.delayMs)):this.props.onChange(n))}static getDerivedStateFromProps(t,n){const r=t.fromValue?t.fromValue(t.value):t.value;return r===n.originalValue?null:{originalValue:r,value:r}}render(){return(0,L.jsx)("input",{type:"text",className:this.props.className,style:this.props.style,ref:this.input,onBlur:this.onBlur,value:this.state.value,placeholder:this.props.placeholder,onChange:this.onChange,onKeyPress:this.props.onEnter||this.props.blurOnEnter||this.props.blurOnEscape?this.onKeyPress:void 0,onKeyDown:this.props.blurOnEscape?this.onKeyUp:void 0,disabled:!!this.props.isDisabled})}}class Ibt extends Yt.Component{constructor(){super(...arguments),this.state={isExpanded:!1},this.toggleExpanded=()=>this.setState({isExpanded:!this.state.isExpanded})}render(){const{label:t,pivot:n,controls:r}=this.props;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Bd,{label:(0,L.jsxs)(L.Fragment,{children:[t,(0,L.jsx)("button",{className:"msp-btn-link msp-btn-icon msp-control-group-expander",onClick:this.toggleExpanded,title:(this.state.isExpanded?"Less":"More")+" options",style:{background:"transparent",textAlign:"left",padding:"0"},children:(0,L.jsx)(Mi,{svg:this.state.isExpanded?GW:FA,style:{display:"inline-block"}})})]}),control:n,children:this.props.colorStripe&&(0,L.jsx)("div",{className:"msp-expandable-group-color-stripe",style:{backgroundColor:st.toStyle(this.props.colorStripe)}})}),this.state.isExpanded&&(0,L.jsx)("div",{className:"msp-control-offset",children:r})]})}}function Zy(e){return(0,L.jsxs)("div",{className:"msp-section-header"+(e.accent?" msp-transform-header-brand-"+e.accent:""),children:[e.icon&&(0,L.jsx)(Mi,{svg:e.icon}),e.title," ",(0,L.jsx)("small",{children:e.desc})]})}function ir(e){let n,t="msp-btn";return e.inline||(t+=" msp-btn-block"),e.noOverflow&&(t+=" msp-no-overflow"),e.flex&&(t+=" msp-flex-item"),("on"===e.commit||e.commit)&&(t+=" msp-btn-commit msp-btn-commit-on"),"off"===e.commit&&(t+=" msp-btn-commit msp-btn-commit-off"),e.children||(t+=" msp-btn-childless"),e.className&&(t+=" "+e.className),e.flex&&("number"==typeof e.flex?n={flex:`0 0 ${e.flex}px`,padding:0,maxWidth:`${e.flex}px`}:"string"==typeof e.flex&&(n={flex:`0 0 ${e.flex}`,padding:0,maxWidth:e.flex})),e.style&&(n?Object.assign(n,e.style):n=e.style),(0,L.jsxs)("button",{onClick:e.onClick,title:e.title,disabled:e.disabled,style:n,className:t,"data-id":e["data-id"],"data-color":e["data-color"],onContextMenu:e.onContextMenu,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,children:[e.icon&&(0,L.jsx)(Mi,{svg:e.icon}),e.children]})}function kn(e){let n,t=`msp-btn msp-btn-icon${e.small?"-small":""}${e.className?" "+e.className:""}`;return typeof e.toggleState<"u"&&(t+=" msp-btn-link-toggle-"+(e.toggleState?"on":"off")),e.transparent&&(t+=" msp-transparent-bg"),e.flex&&(n="boolean"==typeof e.flex?{flex:"0 0 32px",padding:0}:"number"==typeof e.flex?{flex:`0 0 ${e.flex}px`,padding:0,maxWidth:`${e.flex}px`}:{flex:`0 0 ${e.flex}`,padding:0,maxWidth:e.flex}),e.style&&(n?Object.assign(n,e.style):n=e.style),(0,L.jsxs)("button",{className:t,onClick:e.onClick,title:e.title,disabled:e.disabled,"data-id":e["data-id"],style:n,children:[e.svg&&(0,L.jsx)(Mi,{svg:e.svg}),e.extraContent]})}class yl extends Yt.PureComponent{constructor(){super(...arguments),this.onClick=t=>{t.currentTarget.blur(),this.props.toggle()}}render(){const t=this.props,n=t.label;return(0,L.jsx)(ir,{icon:this.props.icon,onClick:this.onClick,title:this.props.title,inline:this.props.inline,disabled:t.disabled,style:t.style,className:t.isSelected?`${t.className||""} msp-control-current`:t.className,children:n&&this.props.isSelected?(0,L.jsx)("b",{children:n}):n})}}class lm extends Yt.PureComponent{constructor(){super(...arguments),this.state={isExpanded:!!this.props.initiallyExpanded},this.toggleExpanded=()=>this.setState({isExpanded:!this.state.isExpanded})}render(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("div",{className:"msp-control-group-header",style:{marginTop:void 0!==this.props.marginTop?this.props.marginTop:"1px",marginLeft:this.props.headerLeftMargin},children:(0,L.jsxs)("button",{className:"msp-btn msp-form-control msp-btn-block",onClick:this.toggleExpanded,style:this.props.headerStyle,children:[(0,L.jsx)(Mi,{svg:this.state.isExpanded?Yy:Xy}),this.props.header]})}),this.state.isExpanded&&(this.props.noOffset?this.props.children:(0,L.jsx)("div",{className:this.props.accent?"msp-accent-offset":"msp-control-offset",children:this.props.children}))]})}}function Bd(e){let t="msp-control-row";return e.className&&(t+=" "+e.className),(0,L.jsxs)("div",{className:t,children:[(0,L.jsx)("span",{className:"msp-control-row-label",title:e.title,children:e.label}),(0,L.jsx)("div",{className:"msp-control-row-ctrl",children:e.control}),e.children]})}const cm=Yt.createContext(void 0);let Vr=(()=>{class e extends Yt.Component{subscribe(n,r){typeof this.subs>"u"&&(this.subs=[]),this.subs.push(n.subscribe(r))}componentWillUnmount(){if(this.subs){for(const n of this.subs)n.unsubscribe();this.subs=void 0}}constructor(n,r){super(n),this.subs=void 0,this.plugin=r,this.init&&this.init()}}return e.contextType=cm,e})(),bl=(()=>{class e extends Yt.PureComponent{subscribe(n,r){typeof this.subs>"u"&&(this.subs=[]),this.subs.push(n.subscribe(r))}componentWillUnmount(){if(this.subs){for(const n of this.subs)n.unsubscribe();this.subs=void 0}}constructor(n,r){super(n,r),this.subs=void 0,this.plugin=r,this.init&&this.init()}}return e.contextType=cm,e})();class d2 extends Vr{componentDidUpdate(t){void 0!==this.props.initiallyCollapsed&&t.initiallyCollapsed!==this.props.initiallyCollapsed&&this.setState({isCollapsed:this.props.initiallyCollapsed})}render(){var t;return this.state.isHidden?null:(0,L.jsxs)("div",{className:this.state.isCollapsed?"msp-transform-wrapper msp-transform-wrapper-collapsed":"msp-transform-wrapper",children:[(0,L.jsx)("div",{className:"msp-transform-header",children:(0,L.jsxs)(ir,{icon:this.state.brand?void 0:this.state.isCollapsed?Xy:Yy,noOverflow:!0,onClick:this.toggleCollapsed,className:this.state.brand?`msp-transform-header-brand msp-transform-header-brand-${this.state.brand.accent}`:void 0,title:"Click to "+(this.state.isCollapsed?"expand":"collapse"),children:[(0,L.jsx)(Mi,{svg:null===(t=this.state.brand)||void 0===t?void 0:t.svg,inline:!0}),this.state.header,(0,L.jsx)("small",{style:{margin:"0 6px"},children:this.state.isCollapsed?"":this.state.description})]})}),!this.state.isCollapsed&&this.renderControls()]})}constructor(t,n){super(t,n),this.toggleCollapsed=()=>{this.setState({isCollapsed:!this.state.isCollapsed})};const r=this.defaultState();void 0!==t.initiallyCollapsed&&(r.isCollapsed=t.initiallyCollapsed),void 0!==t.header&&(r.header=t.header),this.state=r}}class Hn extends Yt.PureComponent{constructor(){super(...arguments),this.hide=()=>this.props.onSelect(void 0)}render(){const t=this.props,n=(0,L.jsx)(LP,{items:t.items,onSelect:t.onSelect,current:t.current,multiselect:this.props.multiselect,noOffset:this.props.noOffset,noAccent:this.props.noAccent});return(0,L.jsxs)("div",{className:"msp-action-menu-options"+(t.header?"":" msp-action-menu-options-no-header"),children:[t.header&&(0,L.jsx)(Fg,{header:t.header,title:t.title,initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.hide,topRightIcon:Rg,children:n}),!t.header&&n]})}}!function(e){function r(c,u){const{label:d,value:f,category:p,selected:m,icon:h,addOn:g,description:y}=u||{};let v;const x=[];for(let _=0;_c[0],label:c=>c[1],category:c=>c[2]};e.createItemsFromSelectOptions=function o(c,u){return r(c,u?{...i,...u}:i)},e.hasSelectedItem=function s(c){if(Qy(c))return!1;if(BA(c))return!!c.selected;for(const u of c)if(s(u))return!0;return!1},e.findItem=function a(c,u){if(!Qy(c)){if(BA(c))return c.value===u?c:void 0;for(const d of c){const f=a(d,u);if(f)return f}}},e.getFirstItem=function l(c){if(!Qy(c)){if(BA(c))return c;for(const u of c){const d=l(u);if(d)return d}}}}(Hn||(Hn={}));class LP extends Yt.PureComponent{constructor(){super(...arguments),this.state=LP.createState(this.props),this.toggleExpanded=t=>{this.setState({isExpanded:!this.state.isExpanded}),t.currentTarget.blur()},this.selectAll=()=>{const t=$W(this.props.items,[]).filter(n=>!n.selected);this.props.onSelect(t)},this.selectNone=()=>{const t=$W(this.props.items,[]).filter(n=>!!n.selected);this.props.onSelect(t)}}static createState(t,n){const r=WW(t.items)&&Qy(t.items[0])?t.items[0]:void 0,i=!r?.isIndependent&&(t.multiselect?Hn.hasSelectedItem(t.items):!!t.current&&!!Hn.findItem(t.items,t.current.value)||Hn.hasSelectedItem(t.items));return{header:r,hasCurrent:i,isExpanded:i||(n??!!r?.initiallyExpanded)}}componentDidUpdate(t){if(this.props.items!==t.items||this.props.current!==t.current){const n=WW(this.props.items)&&WW(t.items)&&Qy(this.props.items[0])&&Qy(t.items[0])&&this.props.items[0].label===t.items[0].label?this.state.isExpanded:void 0;this.setState(LP.createState(this.props,n))}}get multiselectHeader(){const{header:t,hasCurrent:n}=this.state;return(0,L.jsxs)("div",{className:"msp-flex-row msp-control-group-header",children:[(0,L.jsx)(ir,{icon:this.state.isExpanded?Yy:Xy,flex:!0,noOverflow:!0,onClick:this.toggleExpanded,title:`Click to ${this.state.isExpanded?"collapse":"expand"}.${t?.description?` ${t?.description}`:""}`,children:n?(0,L.jsx)("b",{children:t?.label}):t?.label}),(0,L.jsx)(ir,{icon:a2,flex:!0,onClick:this.selectAll,style:{flex:"0 0 50px",textAlign:"right"},children:"All"}),(0,L.jsx)(ir,{icon:Rg,flex:!0,onClick:this.selectNone,style:{flex:"0 0 50px",textAlign:"right"},children:"None"})]})}get basicHeader(){const{header:t,hasCurrent:n}=this.state;return(0,L.jsx)("div",{className:"msp-control-group-header",style:{marginTop:"1px"},children:(0,L.jsx)(ir,{noOverflow:!0,icon:this.state.isExpanded?Yy:Xy,onClick:this.toggleExpanded,title:`Click to ${this.state.isExpanded?"collapse":"expand"}. ${t?.description?t?.description:""}`,children:n?(0,L.jsx)("b",{children:t?.label}):t?.label})})}render(){const{items:t,onSelect:n,current:r}=this.props;if(Qy(t))return null;if(BA(t))return(0,L.jsx)(jbe,{item:t,onSelect:n,current:r,multiselect:this.props.multiselect});const{header:i}=this.state;return(0,L.jsxs)(L.Fragment,{children:[i&&(this.props.multiselect&&this.state.isExpanded?this.multiselectHeader:this.basicHeader),(0,L.jsx)("div",{className:this.props.noOffset?void 0:this.props.noAccent?"msp-control-offset":"msp-accent-offset",children:(!i||this.state.isExpanded)&&t.map((o,s)=>Qy(o)?null:BA(o)?(0,L.jsx)(jbe,{item:o,onSelect:n,current:r,multiselect:this.props.multiselect},s):(0,L.jsx)(LP,{items:o,onSelect:n,current:r,multiselect:this.props.multiselect,noAccent:!0},s))})]})}}const jbe=({item:e,onSelect:t,current:n,multiselect:r})=>(0,L.jsxs)(ir,{icon:e.icon,noOverflow:!0,className:"msp-action-menu-button",onClick:s=>t(r?[e]:e,s),disabled:e.disabled,style:e.addOn?{position:"relative"}:void 0,title:e.description,children:[n===e||e.selected?(0,L.jsx)("b",{children:e.label}):e.label,e.addOn]});function WW(e){return!!e&&Array.isArray(e)}function BA(e){return e&&"item"===e.kind}function Qy(e){return e&&"header"===e.kind}function $W(e,t){if(Qy(e))return t;if(BA(e))return t.push(e),t;for(const n of e)$W(n,t);return t}const YW=[["black",0],["gray",8421504],["white",16777215],["red",13840661],["orange",14840576],["yellow",16565248],["green",6863872],["cyan",1484197],["blue",40160],["purple",8086783],["magenta",16394495],["violet",8200583]];class Ube extends Yt.PureComponent{constructor(){super(...arguments),this.state={isExpanded:!!this.props.param.isExpanded||!!this.props.hideNameRow,lightness:0},this.toggleExpanded=t=>{this.setState({isExpanded:!this.state.isExpanded}),t.currentTarget.blur()},this.onClickSwatch=t=>{const n=st.fromHexString(t.currentTarget.getAttribute("data-color")||"0");n!==this.props.value&&(this.props.param.isExpanded||this.setState({isExpanded:!1}),this.update(n))},this.onR=t=>{const[,n,r]=st.toRgb(this.props.value),i=st.fromRgb(t,n,r);i!==this.props.value&&this.update(i)},this.onG=t=>{const[n,,r]=st.toRgb(this.props.value),i=st.fromRgb(n,t,r);i!==this.props.value&&this.update(i)},this.onB=t=>{const[n,r]=st.toRgb(this.props.value),i=st.fromRgb(n,r,t);i!==this.props.value&&this.update(i)},this.onRGB=t=>{const n=st.fromHexStyle(t.currentTarget.value||"0");n!==this.props.value&&this.update(n)},this.onLighten=()=>{this.update(st.lighten(this.props.value,.1))},this.onDarken=()=>{this.update(st.darken(this.props.value,.1))}}update(t){this.props.onChange({param:this.props.param,name:this.props.name,value:t})}swatch(){return(0,L.jsx)("div",{className:"msp-combined-color-swatch",children:YW.map(t=>(0,L.jsx)(ir,{inline:!0,"data-color":t[1],onClick:this.onClickSwatch,style:{background:st.toStyle(t[1])}},t[1]))})}render(){const t=this.props.param.label||Rc(this.props.name),[n,r,i]=st.toRgb(this.props.value),o=(0,L.jsxs)(L.Fragment,{children:[this.swatch(),(0,L.jsx)(Bd,{label:"RGB",className:"msp-control-label-short",control:(0,L.jsxs)("div",{style:{display:"flex",textAlignLast:"center",left:"80px"},children:[(0,L.jsx)(Ky,{onChange:this.onR,numeric:!0,value:n,delayMs:250,style:{order:1,flex:"1 1 auto",minWidth:0},className:"msp-form-control",onEnter:this.props.onEnter,blurOnEnter:!0,blurOnEscape:!0}),(0,L.jsx)(Ky,{onChange:this.onG,numeric:!0,value:r,delayMs:250,style:{order:2,flex:"1 1 auto",minWidth:0},className:"msp-form-control",onEnter:this.props.onEnter,blurOnEnter:!0,blurOnEscape:!0}),(0,L.jsx)(Ky,{onChange:this.onB,numeric:!0,value:i,delayMs:250,style:{order:3,flex:"1 1 auto",minWidth:0},className:"msp-form-control",onEnter:this.props.onEnter,blurOnEnter:!0,blurOnEscape:!0}),(0,L.jsx)("input",{onInput:this.onRGB,type:"color",value:st.toHexStyle(this.props.value),style:{order:4,flex:"1 1 auto",minWidth:"32px",width:"32px",height:"32px",padding:"0 2px 0 2px",background:"none",border:"none",cursor:"pointer"}})]})}),(0,L.jsxs)("div",{style:{display:"flex",textAlignLast:"center"},children:[(0,L.jsx)(ir,{onClick:this.onLighten,style:{order:1,flex:"1 1 auto",minWidth:0},className:"msp-form-control",children:"Lighten"}),(0,L.jsx)(ir,{onClick:this.onDarken,style:{order:1,flex:"1 1 auto",minWidth:0},className:"msp-form-control",children:"Darken"})]})]});return this.props.hideNameRow?o:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Bd,{title:this.props.param.description,label:t,control:(0,L.jsx)(ir,{onClick:this.toggleExpanded,inline:!0,className:"msp-combined-color-button",style:{background:st.toStyle(this.props.value)}})}),this.state.isExpanded&&(0,L.jsx)("div",{className:"msp-control-offset",children:o})]})}}!function(){const e=new Map;for(const t of YW)e.set(t[1],t[0])}();class kbt extends Yt.PureComponent{render(){const{legend:t}=this.props,n=t.colors.map(r=>Array.isArray(r)?`${st.toStyle(r[0])} ${100*r[1]}%`:st.toStyle(r)).join(", ");return(0,L.jsx)("div",{className:"msp-scale-legend",children:(0,L.jsxs)("div",{style:{background:`linear-gradient(to right, ${n})`},children:[(0,L.jsx)("span",{style:{float:"left"},children:t.minLabel}),(0,L.jsx)("span",{style:{float:"right"},children:t.maxLabel})]})})}}class Mbt extends Yt.PureComponent{render(){const{legend:t}=this.props;return(0,L.jsx)("div",{className:"msp-table-legend",children:t.table.map((n,r)=>{const[i,o]=n;return(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{className:"msp-table-legend-color",style:{backgroundColor:st.toStyle(o)}}),(0,L.jsx)("div",{className:"msp-table-legend-text",children:i})]},r)})})}}class Rbt extends Yt.Component{constructor(t){super(t),this.state={show:!1},this.handleHover=this.handleHover.bind(this),this.handleHoverOff=this.handleHoverOff.bind(this),this.deletePoint=this.deletePoint.bind(this)}handleHover(){this.setState({show:!0});const t=Ue.create(this.props.nX,this.props.nY);this.props.onmouseover(t)}handleHoverOff(){this.setState({show:!1}),this.props.onmouseover(void 0)}deletePoint(){this.props.delete(this.props.id)}render(){return[(0,L.jsx)("circle",{r:"10",id:`${this.props.id}`,cx:this.props.x,cy:this.props.y,onClick:this.props.onclick,onDoubleClick:this.props.delete(this.props.id),onMouseEnter:this.handleHover,onMouseLeave:this.handleHoverOff,onMouseDown:this.props.onmousedown,fill:"black"},`${this.props.id}circle`)]}}class Nbt extends Yt.Component{constructor(t){super(t),this.handleKeyDown=n=>{},this.handleKeyUp=n=>{},this.handleClick=n=>r=>{},this.handleMouseDown=n=>r=>{if(0===n||n===this.state.points.length-1||this.state.canSelectMultiple)return;const i=this.normalizePoint(Ue.create(this.state.points[n][0],this.state.points[n][1]));this.ghostPoints.push(document.createElementNS(this.namespace,"circle")),this.ghostPoints[0].setAttribute("r","10"),this.ghostPoints[0].setAttribute("fill","orange"),this.ghostPoints[0].setAttribute("cx",`${i[0]}`),this.ghostPoints[0].setAttribute("cy",`${i[1]}`),this.ghostPoints[0].setAttribute("style","display: none"),this.gElement.appendChild(this.ghostPoints[0]),this.updatedX=i[0],this.updatedY=i[1],this.selected=[n]},this.deletePoint=n=>r=>{if(0===n||n===this.state.points.length-1)return;const i=this.state.points.filter((o,s)=>s!==n);i.sort((o,s)=>o[0]===s[0]?0===o[0]?o[1]-s[1]:1===o[1]?s[1]-o[1]:o[1]-s[1]:o[0]-s[0]),this.setState({points:i}),this.change(i),r.stopPropagation()},this.myRef=Yt.createRef(),this.state={points:[Ue.create(0,0),Ue.create(1,0)],copyPoint:void 0,canSelectMultiple:!1},this.height=400,this.width=600,this.padding=70,this.selected=void 0,this.ghostPoints=[],this.namespace="http://www.w3.org/2000/svg";for(const n of this.props.data)this.state.points.push(n);this.state.points.sort((n,r)=>n[0]===r[0]?0===n[0]?n[1]-r[1]:1===n[1]?r[1]-n[1]:n[1]-r[1]:n[0]-r[0]),this.handleDrag=this.handleDrag.bind(this),this.handleMultipleDrag=this.handleMultipleDrag.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.refCallBack=this.refCallBack.bind(this),this.handlePointUpdate=this.handlePointUpdate.bind(this),this.change=this.change.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleLeave=this.handleLeave.bind(this),this.handleEnter=this.handleEnter.bind(this)}render(){const t=this.renderPoints(),n=this.renderLines(),r=this.renderHistogram();return[(0,L.jsx)("div",{children:(0,L.jsxs)("svg",{className:"msp-canvas",ref:this.refCallBack,viewBox:`0 0 ${this.width+this.padding} ${this.height+this.padding}`,onMouseMove:this.handleDrag,onMouseUp:this.handlePointUpdate,onMouseLeave:this.handleLeave,onMouseEnter:this.handleEnter,tabIndex:0,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onDoubleClick:this.handleDoubleClick,children:[(0,L.jsxs)("g",{stroke:"black",fill:"black",children:[r,n,t]}),(0,L.jsx)("g",{className:"ghost-points",stroke:"black",fill:"black"})]})},"LineGraph"),(0,L.jsx)("div",{id:"modal-root"},"modal")]}componentDidMount(){this.gElement=document.getElementsByClassName("ghost-points")[0]}change(t){const n=t.slice();n.shift(),n.pop(),this.props.onChange(n)}handleDrag(t){if(void 0===this.selected)return;const n=this.myRef.createSVGPoint();let r;const i=this.padding/2;n.x=t.clientX,n.y=t.clientY;const o=n.matrixTransform(this.myRef.getScreenCTM().inverse());r=Ue.create(o.x,o.y),r=(o.xthis.width+i)&&(o.y>this.height+i||o.ythis.width+i?Ue.create(this.width+i,o.y):Ue.create(o.x,o.y>this.height+i?this.height+i:o.ys!==n[0]);i.push(r),i.sort((o,s)=>o[0]===s[0]?0===o[0]?o[1]-s[1]:1===o[1]?s[1]-o[1]:o[1]-s[1]:o[0]-s[0]),this.setState({points:i}),this.change(i),this.gElement.innerHTML="",this.ghostPoints=[],document.removeEventListener("mousemove",this.handleDrag,!0),document.removeEventListener("mouseup",this.handlePointUpdate,!0)}handleDoubleClick(t){const n=this.myRef.createSVGPoint();n.x=t.clientX,n.y=t.clientY;const r=n.matrixTransform(this.myRef.getScreenCTM().inverse()),i=this.state.points,o=this.padding/2;if(r.xthis.width+o||r.y>this.height+o||r.ya[0]===l[0]?0===a[0]?a[1]-l[1]:1===a[1]?l[1]-a[1]:a[1]-l[1]:a[0]-l[0]),this.setState({points:i}),this.change(i)}handleLeave(){void 0!==this.selected&&(document.addEventListener("mousemove",this.handleDrag,!0),document.addEventListener("mouseup",this.handlePointUpdate,!0))}handleEnter(){document.removeEventListener("mousemove",this.handleDrag,!0),document.removeEventListener("mouseup",this.handlePointUpdate,!0)}normalizePoint(t){const n=this.padding/2;return Ue.create(t[0]*(this.width+n-n)+n,this.height+this.padding-(t[1]*(this.height+n-n)+n))}unNormalizePoint(t){const n=this.padding/2;return Ue.create((t[0]-n)/(this.width+n-n),(this.height+this.padding-t[1]-n)/(this.height+n-n))}refCallBack(t){t&&(this.myRef=t)}renderHistogram(){if(!this.props.volume)return null;const t=Ca.getHistogram(this.props.volume.grid,40),n=[],r=t.counts.length,i=this.width/r,o=this.padding/2,s=Bh(t.counts)||1;for(let a=0;a{this.setState({isChanging:!0})},this.end=t=>{this.setState({isChanging:!1}),this.props.onChange(t)},this.updateCurrent=t=>{var n,r;this.setState({current:t}),null===(r=(n=this.props).onChangeImmediate)||void 0===r||r.call(n,t)},this.updateManually=t=>{this.setState({isChanging:!0});let n=t;1===this.props.step&&(n=Math.round(n)),nthis.props.max&&(n=this.props.max),this.setState({current:n,isChanging:!0})},this.onManualBlur=()=>{this.setState({isChanging:!1}),this.props.onChange(this.state.current)}}static getDerivedStateFromProps(t,n){return n.isChanging||t.value===n.current?null:{current:t.value}}render(){let t=this.props.step;return void 0===t&&(t=1),(0,L.jsxs)("div",{className:"msp-slider",children:[(0,L.jsx)("div",{children:(0,L.jsx)(ZW,{min:this.props.min,max:this.props.max,step:t,value:this.state.current,disabled:this.props.disabled,onBeforeChange:this.begin,onChange:this.updateCurrent,onAfterChange:this.end})}),(0,L.jsx)("div",{children:(0,L.jsx)(Ky,{numeric:!0,delayMs:50,value:this.state.current,blurOnEnter:!0,onBlur:this.onManualBlur,isDisabled:this.props.disabled,onChange:this.updateManually})})]})}}class Fbt extends Yt.Component{constructor(){super(...arguments),this.state={isChanging:!1,current:[0,1]},this.begin=()=>{this.setState({isChanging:!0})},this.end=t=>{this.setState({isChanging:!1}),this.props.onChange(t)},this.updateCurrent=t=>{this.setState({current:t})},this.updateMax=t=>{let n=t;1===this.props.step&&(n=Math.round(n)),nthis.props.max&&(n=this.props.max),this.props.onChange([this.state.current[0],n])},this.updateMin=t=>{let n=t;1===this.props.step&&(n=Math.round(n)),nthis.state.current[1]?n=this.state.current[1]:n>this.props.max&&(n=this.props.max),this.props.onChange([n,this.state.current[1]])}}static getDerivedStateFromProps(t,n){return n.isChanging||t.value[0]===n.current[0]&&t.value[1]===n.current[1]?null:{current:t.value}}render(){let t=this.props.step;return void 0===t&&(t=1),(0,L.jsxs)("div",{className:"msp-slider2",children:[(0,L.jsx)("div",{children:(0,L.jsx)(Ky,{numeric:!0,delayMs:50,value:this.state.current[0],onEnter:this.props.onEnter,blurOnEnter:!0,isDisabled:this.props.disabled,onChange:this.updateMin})}),(0,L.jsx)("div",{children:(0,L.jsx)(ZW,{min:this.props.min,max:this.props.max,step:t,value:this.state.current,disabled:this.props.disabled,onBeforeChange:this.begin,onChange:this.updateCurrent,onAfterChange:this.end,range:!0,allowCross:!0})}),(0,L.jsx)("div",{children:(0,L.jsx)(Ky,{numeric:!0,delayMs:50,value:this.state.current[1],onEnter:this.props.onEnter,blurOnEnter:!0,isDisabled:this.props.disabled,onChange:this.updateMax})})]})}}function XW(e){const t=[],n={}.hasOwnProperty;for(let r=0;r1||"touchend"===e.type.toLowerCase()&&e.touches.length>0}function Hbe(e,t){return e?t.touches[0].clientY:t.touches[0].pageX}function Gbe(e,t){return e?t.clientY:t.pageX}function qbe(e,t){const n=t.getBoundingClientRect();return e?n.top+.5*n.height:n.left+.5*n.width}function KW(e){e.stopPropagation(),e.preventDefault()}class ZW extends Yt.Component{constructor(t){super(t),this.sliderElement=Yt.createRef(),this.handleElements=[],this.dragOffset=0,this.startPosition=0,this.startValue=0,this._getPointsCache=void 0,this.onMouseDown=u=>{if(0!==u.button)return;let d=Gbe(this.props.vertical,u);if(this.isEventFromHandle(u)){const f=qbe(this.props.vertical,u.target);this.dragOffset=d-f,d=f}else this.dragOffset=0;this.onStart(d),this.addDocumentEvents("mouse"),KW(u)},this.onTouchMove=u=>{if(Vbe(u))return void this.end("touch");const d=Hbe(this.props.vertical,u);this.onMove(u,d-this.dragOffset)},this.onTouchStart=u=>{if(Vbe(u))return;let d=Hbe(this.props.vertical,u);if(this.isEventFromHandle(u)){const f=qbe(this.props.vertical,u.target);this.dragOffset=d-f,d=f}else this.dragOffset=0;this.onStart(d),this.addDocumentEvents("touch"),KW(u)},this.eventHandlers={touchmove:u=>this.onTouchMove(u),touchend:u=>this.end("touch"),mousemove:u=>this.onMouseMove(u),mouseup:u=>this.end("mouse")},this.calcOffset=u=>{const{min:d,max:f}=this.props;return(u-d)/(f-d)*100};const{range:n,min:r,max:i}=t,o=n?Array.apply(null,Array(+n+1)).map(()=>r):r,a=void 0!==t.value?t.value:"defaultValue"in t?t.defaultValue:o,l=(n?a:[r,a]).map(u=>this.trimAlignValue(u));let c;c=n&&l[0]===l[l.length-1]&&l[0]===i?0:l.length-1,this.state={handle:null,recent:c,bounds:l}}componentDidUpdate(t){if(!("value"in this.props||"min"in this.props||"max"in this.props))return;const{bounds:n}=this.state;if(t.range){const i=(this.props.value||n).map(o=>this.trimAlignValue(o,this.props));if(i.every((o,s)=>o===n[s]))return;this.setState({bounds:i}),n.some(o=>this.isValueOutOfBounds(o,this.props))&&this.props.onChange(i)}else{const i=this.trimAlignValue(void 0!==this.props.value?this.props.value:n[1],this.props);if(i===n[1]&&n[0]===t.min)return;this.setState({bounds:[t.min,i]}),this.isValueOutOfBounds(n[1],this.props)&&this.props.onChange(i)}}onChange(t){const n=this.props;"value"in n?void 0!==t.handle&&this.setState({handle:t.handle}):this.setState(t);const i={...this.state,...t};n.onChange(n.range?i.bounds:i.bounds[1])}onMouseMove(t){const n=Gbe(this.props.vertical,t);this.onMove(t,n-this.dragOffset)}onMove(t,n){KW(t);const r=this.props,i=this.state;let o=n-this.startPosition;o=this.props.vertical?-o:o;const s=o/this.getSliderLength()*(r.max-r.min),a=this.trimAlignValue(this.startValue+s);if(a===i.bounds[i.handle])return;const c=[...i.bounds];c[i.handle]=a;let u=i.handle;r.pushable?this.pushSurroundingHandles(c,u,i.bounds[u]):r.allowCross&&(c.sort((d,f)=>d-f),u=c.indexOf(a)),this.onChange({handle:u,bounds:c})}onStart(t){this.props.onBeforeChange(this.getValue());const r=this.calcValueByPos(t);this.startValue=r,this.startPosition=t;const i=this.state,{bounds:o}=i;let s=1;if(this.props.range){let c=0;for(let d=1;do[d]&&(c=d);Math.abs(o[c+1]-r)l-c),this._getPointsCache={marks:t,step:n,points:a}}return this._getPointsCache.points}getPrecision(t){const n=t.toString();let r=0;return n.indexOf(".")>=0&&(r=n.length-n.indexOf(".")-1),r}getSliderLength(){const t=this.sliderElement.current;return t?this.props.vertical?t.clientHeight:t.clientWidth:0}getSliderStart(){const n=this.sliderElement.current.getBoundingClientRect();return this.props.vertical?n.top:n.left}getValue(){const{bounds:t}=this.state;return this.props.range?t:t[1]}addDocumentEvents(t){"touch"===t?(document.addEventListener("touchmove",this.eventHandlers.touchmove),document.addEventListener("touchend",this.eventHandlers.touchend)):"mouse"===t&&(document.addEventListener("mousemove",this.eventHandlers.mousemove),document.addEventListener("mouseup",this.eventHandlers.mouseup))}calcValue(t){const{vertical:n,min:r,max:i}=this.props,o=Math.abs(t/this.getSliderLength());return n?(1-o)*(i-r)+r:o*(i-r)+r}calcValueByPos(t){const n=t-this.getSliderStart();return this.trimAlignValue(this.calcValue(n))}end(t){this.removeEvents(t),this.props.onAfterChange(this.getValue()),this.setState({handle:null})}isEventFromHandle(t){for(const n of this.handleElements)if(n.current===t.target)return!0;return!1}isValueOutOfBounds(t,n){return tn.max}pushHandle(t,n,r,i){const o=t[n];let s=t[n];for(;r*(s-o)=i.length||s<0)return!1;const a=n+r,l=i[s],{pushable:c}=this.props;return!!this.pushHandle(t,a,r,+c-r*(t[a]-l))&&(t[n]=l,!0)}pushSurroundingHandles(t,n,r){const{pushable:i}=this.props,o=t[n];let s=0;if(t[n+1]-o<+i?s=1:o-t[n-1]<+i&&(s=-1),0===s)return;const a=n+s;this.pushHandle(t,a,s,+i-s*(t[a]-o))||(t[n]=r)}removeEvents(t){"touch"===t?(document.removeEventListener("touchmove",this.eventHandlers.touchmove),document.removeEventListener("touchend",this.eventHandlers.touchend)):"mouse"===t&&(document.removeEventListener("mousemove",this.eventHandlers.mousemove),document.removeEventListener("mouseup",this.eventHandlers.mouseup))}trimAlignValue(t,n){const{handle:r,bounds:i}=this.state||{},{marks:o,step:s,min:a,max:l,allowCross:c}={...this.props,...n||{}};let u=t;u<=a&&(u=a),u>=l&&(u=l),!c&&null!=r&&r>0&&u<=i[r-1]&&(u=i[r-1]),!c&&null!=r&&r=i[r+1]&&(u=i[r+1]);const d=Object.keys(o).map(parseFloat);if(null!==s){const m=Math.round((u-a)/s)*s+a;d.push(m)}const f=d.map(m=>Math.abs(u-m)),p=d[f.indexOf(Math.min.apply(Math,f))];return null!==s?parseFloat(p.toFixed(this.getPrecision(s))):p}render(){const{handle:t,bounds:n}=this.state,{className:r,prefixCls:i,disabled:o,vertical:s,range:a,step:l,marks:c,tipFormatter:u}=this.props,d=this.props.handle,f=n.map(this.calcOffset),p=`${i}-handle`,m=n.map((x,_)=>XW({[p]:!0,[`${p}-${_+1}`]:!0,[`${p}-lower`]:0===_,[`${p}-upper`]:_===n.length-1})),g={prefixCls:i,noTip:null===l||null===u,tipFormatter:u,vertical:s};if(this.handleElements.length!==n.length){this.handleElements=[];for(let x=0;xYt.cloneElement(d,{...g,className:m[_],value:x,offset:f[_],dragging:t===_,index:_,key:_,ref:this.handleElements[_]}));a||y.shift();const v=XW({[i]:!0,[`${i}-with-marks`]:Object.keys(c).length,[`${i}-disabled`]:o,[`${i}-vertical`]:this.props.vertical,[r]:!!r});return(0,L.jsxs)("div",{ref:this.sliderElement,className:v,onTouchStart:o?rp:this.onTouchStart,onMouseDown:o?rp:this.onMouseDown,children:[(0,L.jsx)("div",{className:`${i}-rail`}),y]})}}ZW.defaultProps={prefixCls:"msp-slider-base",className:"",min:0,max:100,step:1,marks:{},handle:(0,L.jsx)(class Obt extends Yt.Component{render(){const{className:t,tipFormatter:n,vertical:r,offset:i,value:o,index:s}=this.props;return(0,L.jsx)("div",{className:t,style:r?{bottom:`${i}%`}:{left:`${i}%`},title:n(o,s)})}},{className:"",vertical:!1,offset:0,tipFormatter:e=>e,value:0,index:0}),onBeforeChange:rp,onChange:rp,onAfterChange:rp,tipFormatter:(e,t)=>e,disabled:!1,range:!1,vertical:!1,allowCross:!0,pushable:!1};class vs extends Yt.PureComponent{constructor(){super(...arguments),this.onChange=t=>{var n,r;if(null===(r=(n=this.props).onChange)||void 0===r||r.call(n,t,this.props.values),this.props.onChangeValues){const i={...this.props.values,[t.name]:t.value};this.props.onChangeValues(i,this.props.values)}},this.paramGroups=sy(t=>function Lbt(e){function t(s,a,l){const c=jP(a);if(c)if(a.category){l.map||(l.map=new Map);let u=l.map.get(a.category);u||(u=[],l.map.set(a.category,u),l.params.push(u)),u.push([s,a,c])}else l.params[0].push([s,a,c])}function n(s,a){const l=s[0],c=a[0];return l&&l[1].category?c&&c[1].category&&l[1].category{const r={...n,[t.name]:t.value},i=this.props.mapping.update(r,this.plugin);this.props.mapping.apply(i,this.plugin)}}componentDidMount(){this.subscribe(this.plugin.state.data.behaviors.isUpdating,t=>{this.setState({isDisabled:t})})}render(){const t=this.props.mapping.getTarget(this.plugin),n=this.props.mapping.getValues(t,this.plugin),r=this.props.mapping.params(this.plugin);return(0,L.jsx)(vs,{params:r,values:n,onChange:this.setSettings,isDisabled:this.state.isDisabled})}}function jP(e){switch(e.type){case"value":case"data-ref":return;case"boolean":return QW;case"number":return typeof e.min<"u"&&typeof e.max<"u"?zbt:Ubt;case"converted":return a1t;case"conditioned":return s1t;case"multi-select":return r1t;case"color":return Ube;case"color-list":return e.offsets?Zbt:Kbt;case"vec3":return Qbt;case"mat4":return Jbt;case"url":return e1t;case"file":return t1t;case"file-list":return n1t;case"select":return mO;case"value-ref":return Hbt;case"text":return Ybe;case"interval":return typeof e.min<"u"&&typeof e.max<"u"?qbt:Gbt;case"group":return Kbe;case"mapped":return i1t;case"line-graph":return jbt;case"script":return l1t;case"object-list":return e$;default:return void console.warn(`${e} has no associated UI component`)}}class Wbe extends Yt.PureComponent{render(){const{legend:t,description:n}=this.props,r=t&&function Pbt(e){switch(e.kind){case"scale-legend":return kbt;case"table-legend":return Mbt;default:return void console.warn(`${e} has no associated UI component`)}}(t);return(0,L.jsx)("div",{className:"msp-help-text",children:(0,L.jsxs)("div",{children:[(0,L.jsxs)("div",{className:"msp-help-description",children:[(0,L.jsx)(Mi,{svg:Ng,inline:!0}),n]}),r&&(0,L.jsx)("div",{className:"msp-help-legend",children:(0,L.jsx)(r,{legend:t})})]})})}}function f2(e){const{props:t,state:n,control:r,toggleHelp:i,addOn:o}=e,s=[];t.param.shortLabel&&s.push("msp-control-label-short"),t.param.twoColumns&&s.push("msp-control-col-2"),t.param.multiline&&s.push("msp-control-twoline");const a=s.join(" "),l=t.param.label||Rc(t.name),c=t.param.help?t.param.help(t.value):{description:t.param.description,legend:t.param.legend},u=c.description||c.legend,d=l+(u?". Click for help.":"");return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Bd,{className:a,title:d,label:(0,L.jsxs)(L.Fragment,{children:[l,u&&(0,L.jsx)($be,{show:n.showHelp,toggle:i,title:d})]}),control:r}),u&&n.showHelp&&(0,L.jsx)("div",{className:"msp-control-offset",children:(0,L.jsx)(Wbe,{legend:c.legend,description:c.description})}),o]})}function $be({show:e,toggle:t,title:n}){return(0,L.jsx)("button",{className:"msp-help msp-btn-link msp-btn-icon msp-control-group-expander",onClick:t,title:n||(e?"Hide":"Show")+" help",style:{background:"transparent",textAlign:"left",padding:"0"},children:(0,L.jsx)(Mi,{svg:Ng})})}class LA extends Yt.PureComponent{constructor(){super(...arguments),this.state={showHelp:!1},this.toggleHelp=()=>this.setState({showHelp:!this.state.showHelp})}update(t){this.props.onChange({param:this.props.param,name:this.props.name,value:t})}renderAddOn(){return null}render(){return f2({props:this.props,state:this.state,control:this.renderControl(),toggleHelp:this.toggleHelp,addOn:this.renderAddOn()})}}class QW extends LA{constructor(){super(...arguments),this.onClick=t=>{this.update(!this.props.value),t.currentTarget.blur()}}renderControl(){return(0,L.jsxs)("button",{onClick:this.onClick,disabled:this.props.isDisabled,children:[(0,L.jsx)(Mi,{svg:this.props.value?a2:Dbe}),this.props.value?"On":"Off"]})}}class jbt extends Yt.PureComponent{constructor(){super(...arguments),this.state={isExpanded:!1,isOverPoint:!1,message:`${this.props.param.defaultValue.length} points`},this.onHover=t=>{this.setState({isOverPoint:!this.state.isOverPoint}),this.setState(t?{message:this.pointToLabel(t)}:{message:`${this.props.value.length} points`})},this.onDrag=t=>{this.setState({message:this.pointToLabel(t)})},this.onChange=t=>{this.props.onChange({name:this.props.name,param:this.props.param,value:t})},this.toggleExpanded=t=>{this.setState({isExpanded:!this.state.isExpanded}),t.currentTarget.blur()}}pointToLabel(t){var n,r;if(!t)return"";const i=null===(r=(n=this.props.param).getVolume)||void 0===r?void 0:r.call(n);if(i){const{min:o,max:s,mean:a,sigma:l}=i.grid.stats,c=o+(s-o)*t[0],u=(c-a)/l;return`(${c.toFixed(2)} | ${u.toFixed(2)}\u03c3, ${t[1].toFixed(2)})`}return`(${t[0].toFixed(2)}, ${t[1].toFixed(2)})`}render(){var t,n;const r=this.props.param.label||Rc(this.props.name);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Bd,{label:r,control:(0,L.jsx)("button",{onClick:this.toggleExpanded,disabled:this.props.isDisabled,children:`${this.state.message}`})}),(0,L.jsx)("div",{className:"msp-control-offset",style:{display:this.state.isExpanded?"block":"none",marginTop:1},children:(0,L.jsx)(Nbt,{data:this.props.value,volume:null===(n=(t=this.props.param).getVolume)||void 0===n?void 0:n.call(t),onChange:this.onChange,onHover:this.onHover,onDrag:this.onDrag})})]})}}class Ubt extends Yt.PureComponent{constructor(){super(...arguments),this.state={value:"0"},this.update=t=>{const n=n5(this.props.param.step||.01);t=parseFloat(t.toFixed(n)),this.props.onChange({param:this.props.param,name:this.props.name,value:t})}}render(){const t=this.props.param.label||Rc(this.props.name),n=this.props.param.label||Rc(this.props.name),r=n5(this.props.param.step||.01);return(0,L.jsx)(Bd,{title:this.props.param.description,label:n,control:(0,L.jsx)(Ky,{numeric:!0,value:parseFloat(this.props.value.toFixed(r)),onEnter:this.props.onEnter,placeholder:t,isDisabled:this.props.isDisabled,onChange:this.update})})}}class zbt extends LA{constructor(){super(...arguments),this.onChange=t=>{this.update(t)}}renderControl(){return(0,L.jsx)(zbe,{value:typeof this.props.value>"u"?this.props.param.defaultValue:this.props.value,min:this.props.param.min,max:this.props.param.max,step:this.props.param.step,onChange:this.onChange,onChangeImmediate:this.props.param.immediateUpdate?this.onChange:void 0,disabled:this.props.isDisabled,onEnter:this.props.onEnter})}}class Ybe extends LA{constructor(){super(...arguments),this.updateValue=t=>{t!==this.props.value&&this.update(t)}}renderControl(){const t=this.props.param.placeholder||this.props.param.label||Rc(this.props.name);return(0,L.jsx)(Vbt,{props:this.props,placeholder:t,update:this.updateValue})}}function Vbt({props:e,placeholder:t,update:n}){const[r,i]=Yt.useState(e.value);return Yt.useEffect(()=>i(e.value),[e.value]),e.param.multiline?(0,L.jsx)("div",{className:"msp-control-text-area-wrapper",children:(0,L.jsx)("textarea",{value:e.param.disableInteractiveUpdates?r||"":e.value,placeholder:t,onChange:o=>{e.param.disableInteractiveUpdates?i(o.target.value):n(o.target.value)},onBlur:o=>{e.param.disableInteractiveUpdates&&n(o.target.value)},onKeyDown:o=>{"Enter"===o.key&&(o.shiftKey||o.ctrlKey||o.metaKey)&&o.currentTarget.blur()},disabled:e.isDisabled})}):(0,L.jsx)("input",{type:"text",value:e.param.disableInteractiveUpdates?r||"":e.value,placeholder:t,onChange:o=>{e.param.disableInteractiveUpdates?i(o.target.value):n(o.target.value)},onBlur:o=>{e.param.disableInteractiveUpdates&&n(o.target.value)},disabled:e.isDisabled,onKeyDown:o=>{"Enter"===o.key&&(e.onEnter?(o.stopPropagation(),e.onEnter()):"Enter"===o.key&&(o.shiftKey||o.ctrlKey||o.metaKey)?o.currentTarget.blur():e.param.disableInteractiveUpdates&&n(r))}})}class jA extends Yt.PureComponent{constructor(){super(...arguments),this.onChange=t=>{this.update("number"==typeof this.props.param.defaultValue?parseInt(t.target.value,10):t.target.value)}}update(t){this.props.onChange({param:this.props.param,name:this.props.name,value:t})}render(){const t=void 0!==this.props.value&&!this.props.param.options.some(n=>n[0]===this.props.value);return(0,L.jsxs)("select",{className:"msp-form-control",title:this.props.title,value:void 0!==this.props.value?this.props.value:this.props.param.defaultValue,onChange:this.onChange,disabled:this.props.isDisabled,children:[t&&(0,L.jsx)("option",{value:this.props.value,children:`[Invalid] ${this.props.value}`},this.props.value),this.props.param.options.map(([n,r])=>(0,L.jsx)("option",{value:n,children:r},n))]})}}class mO extends Yt.PureComponent{constructor(){super(...arguments),this.state={showHelp:!1,showOptions:!1},this.onSelect=t=>{t&&t.value!==this.props.value?this.setState({showOptions:!1},()=>{this.props.onChange({param:this.props.param,name:this.props.name,value:t.value})}):this.setState({showOptions:!1})},this.toggle=()=>this.setState({showOptions:!this.state.showOptions}),this.cycle=()=>{const{options:t}=this.props.param,n=t.findIndex(i=>i[0]===this.props.value);this.props.onChange({param:this.props.param,name:this.props.name,value:t[n===t.length-1?0:n+1][0]})},this.items=sy(t=>Hn.createItemsFromSelectOptions(t.options)),this.toggleHelp=()=>this.setState({showHelp:!this.state.showHelp})}renderControl(){var t;const n=this.items(this.props.param),r=void 0!==this.props.value?Hn.findItem(n,this.props.value):void 0,i=r?r.label:typeof this.props.value>"u"?`${(null===(t=Hn.getFirstItem(n))||void 0===t?void 0:t.label)||""} [Default]`:`[Invalid] ${this.props.value}`;return(0,L.jsx)(yl,{disabled:this.props.isDisabled,style:{textAlign:this.props.param.cycle?"center":"left",overflow:"hidden",textOverflow:"ellipsis"},label:i,title:i,icon:this.props.param.cycle?"on"===this.props.value?a2:"off"===this.props.value?Dbe:void 0:void 0,toggle:this.props.param.cycle?this.cycle:this.toggle,isSelected:this.state.showOptions})}renderAddOn(){if(!this.state.showOptions)return null;const t=this.items(this.props.param),n=Hn.findItem(t,this.props.value);return(0,L.jsx)(Hn,{items:t,current:n,onSelect:this.onSelect})}render(){return f2({props:this.props,state:this.state,control:this.renderControl(),toggleHelp:this.toggleHelp,addOn:this.renderAddOn()})}}let Hbt=(()=>{class e extends Yt.PureComponent{constructor(){super(...arguments),this.state={showHelp:!1,showOptions:!1},this.onSelect=n=>{n&&n.value!==this.props.value?this.setState({showOptions:!1},()=>{this.props.onChange({param:this.props.param,name:this.props.name,value:{ref:n.value}})}):this.setState({showOptions:!1})},this.toggle=()=>this.setState({showOptions:!this.state.showOptions}),this.toggleHelp=()=>this.setState({showHelp:!this.state.showHelp})}get items(){return Hn.createItemsFromSelectOptions(this.props.param.getOptions(this.context))}renderControl(){var n;const i=this.props.value.ref?Hn.findItem(this.items,this.props.value.ref):void 0,o=i?i.label:`[Ref] ${null!==(n=this.props.value.ref)&&void 0!==n?n:""}`;return(0,L.jsx)(yl,{disabled:this.props.isDisabled,style:{textAlign:"left",overflow:"hidden",textOverflow:"ellipsis"},label:o,title:o,toggle:this.toggle,isSelected:this.state.showOptions})}renderAddOn(){if(!this.state.showOptions)return null;const n=this.items,r=Hn.findItem(n,this.props.value.ref);return(0,L.jsx)(Hn,{items:n,current:r,onSelect:this.onSelect})}render(){return f2({props:this.props,state:this.state,control:this.renderControl(),toggleHelp:this.toggleHelp,addOn:this.renderAddOn()})}}return e.contextType=cm,e})();class Gbt extends Yt.PureComponent{constructor(){super(...arguments),this.state={isExpanded:!1},this.components={0:I.Numeric(0,{step:this.props.param.step},{label:"Min"}),1:I.Numeric(0,{step:this.props.param.step},{label:"Max"})},this.componentChange=({name:t,value:n})=>{const r=[...this.props.value];r[+t]=n,this.change(r)},this.toggleExpanded=t=>{this.setState({isExpanded:!this.state.isExpanded}),t.currentTarget.blur()}}change(t){this.props.onChange({name:this.props.name,param:this.props.param,value:t})}render(){const t=this.props.value,n=this.props.param.label||Rc(this.props.name),r=n5(this.props.param.step||.01),i=`[${t[0].toFixed(r)}, ${t[1].toFixed(r)}]`;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Bd,{label:n,control:(0,L.jsx)("button",{onClick:this.toggleExpanded,disabled:this.props.isDisabled,children:i})}),this.state.isExpanded&&(0,L.jsx)("div",{className:"msp-control-offset",children:(0,L.jsx)(vs,{params:this.components,values:t,onChange:this.componentChange,onEnter:this.props.onEnter})})]})}}class qbt extends LA{constructor(){super(...arguments),this.onChange=t=>{this.update(t)}}renderControl(){return(0,L.jsx)(Fbt,{value:this.props.value,min:this.props.param.min,max:this.props.param.max,step:this.props.param.step,onChange:this.onChange,disabled:this.props.isDisabled,onEnter:this.props.onEnter})}}function UP(e,t=!1){return Array.isArray(e)?t?`${st.toStyle(e[0])} ${(100*e[1]).toFixed(2)}%`:st.toStyle(e[0]):st.toStyle(e)}const Wbt=k5(e=>`linear-gradient(to right, ${e.map(n=>UP(n,!0)).join(", ")})`),$bt=k5(e=>{const t=e.length,n=[`${UP(e[0])} ${1/t*100}%`];for(let r=1,i=t-1;r{const n=cp(t[0]);return(0,L.jsx)("div",{style:JW({kind:"qualitative"!==n.type?"interpolate":"set",colors:n.list})})};return{ColorPresets:{all:Hn.createItemsFromSelectOptions(QU,{addOn:e}),scale:Hn.createItemsFromSelectOptions(QLe,{addOn:e}),set:Hn.createItemsFromSelectOptions(JLe,{addOn:e})},ColorsParam:I.ObjectList({color:I.Color(0)},({color:t})=>st.toHexString(t).toUpperCase()),OffsetColorsParam:I.ObjectList({color:I.Color(0),offset:I.Numeric(0,{min:0,max:1,step:.01})},({color:t,offset:n})=>`${st.toHexString(t).toUpperCase()} [${n.toFixed(2)}]`),IsInterpolatedParam:I.Boolean(!1,{label:"Interpolated"})}}(),gO)}class Kbt extends Yt.PureComponent{constructor(){super(...arguments),this.state={showHelp:!1,show:void 0},this.toggleEdit=()=>this.setState({show:"edit"===this.state.show?void 0:"edit"}),this.togglePresets=()=>this.setState({show:"presets"===this.state.show?void 0:"presets"}),this.selectPreset=t=>{if(!t)return;this.setState({show:void 0});const n=cp(t.value);this.update({kind:"qualitative"!==n.type?"interpolate":"set",colors:n.list})},this.colorsChanged=({value:t})=>{this.update({kind:this.props.value.kind,colors:t.map(n=>n.color)})},this.isInterpolatedChanged=({value:t})=>{this.update({kind:t?"interpolate":"set",colors:this.props.value.colors})},this.toggleHelp=()=>this.setState({showHelp:!this.state.showHelp})}update(t){this.props.onChange({param:this.props.param,name:this.props.name,value:t})}renderControl(){const{value:t}=this.props;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("button",{onClick:this.toggleEdit,style:{position:"relative",paddingRight:"33px"},children:[1===t.colors.length?"1 color":`${t.colors.length} colors`,(0,L.jsx)("div",{style:JW(t,"33px")})]}),(0,L.jsx)(kn,{svg:OA,onClick:this.togglePresets,toggleState:"presets"===this.state.show,title:"Color Presets",style:{padding:0,position:"absolute",right:0,top:0,width:"32px"}})]})}renderColors(){if(!this.state.show)return null;const{ColorPresets:t,ColorsParam:n,IsInterpolatedParam:r}=Xbe();if("presets"===this.state.show)return(0,L.jsx)(Hn,{items:t[this.props.param.presetKind],onSelect:this.selectPreset});const o=this.props.value.colors.map(s=>({color:s}));return(0,L.jsxs)("div",{className:"msp-control-offset",children:[(0,L.jsx)(e$,{name:"colors",param:n,value:o,onChange:this.colorsChanged,isDisabled:this.props.isDisabled,onEnter:this.props.onEnter}),(0,L.jsx)(QW,{name:"isInterpolated",param:r,value:"interpolate"===this.props.value.kind,onChange:this.isInterpolatedChanged,isDisabled:this.props.isDisabled,onEnter:this.props.onEnter})]})}render(){return f2({props:this.props,state:this.state,control:this.renderControl(),toggleHelp:this.toggleHelp,addOn:this.renderColors()})}}class Zbt extends Yt.PureComponent{constructor(){super(...arguments),this.state={showHelp:!1,show:void 0},this.toggleEdit=()=>this.setState({show:"edit"===this.state.show?void 0:"edit"}),this.togglePresets=()=>this.setState({show:"presets"===this.state.show?void 0:"presets"}),this.selectPreset=t=>{if(!t)return;this.setState({show:void 0});const n=cp(t.value);this.update({kind:"qualitative"!==n.type?"interpolate":"set",colors:n.list})},this.colorsChanged=({value:t})=>{const n=t.map(r=>[r.color,r.offset]);n.sort((r,i)=>r[1]-i[1]),this.update({kind:this.props.value.kind,colors:n})},this.isInterpolatedChanged=({value:t})=>{this.update({kind:t?"interpolate":"set",colors:this.props.value.colors})},this.toggleHelp=()=>this.setState({showHelp:!this.state.showHelp})}update(t){this.props.onChange({param:this.props.param,name:this.props.name,value:t})}renderControl(){const{value:t}=this.props;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("button",{onClick:this.toggleEdit,style:{position:"relative",paddingRight:"33px"},children:[1===t.colors.length?"1 color":`${t.colors.length} colors`,(0,L.jsx)("div",{style:JW(t,"33px")})]}),(0,L.jsx)(kn,{svg:OA,onClick:this.togglePresets,toggleState:"presets"===this.state.show,title:"Color Presets",style:{padding:0,position:"absolute",right:0,top:0,width:"32px"}})]})}renderColors(){if(!this.state.show)return null;const{ColorPresets:t,OffsetColorsParam:n,IsInterpolatedParam:r}=Xbe();if("presets"===this.state.show)return(0,L.jsx)(Hn,{items:t[this.props.param.presetKind],onSelect:this.selectPreset});const o=this.props.value.colors,s=o.map((a,l)=>Array.isArray(a)?{color:a[0],offset:a[1]}:{color:a,offset:l/o.length});return s.sort((a,l)=>a.offset-l.offset),(0,L.jsxs)("div",{className:"msp-control-offset",children:[(0,L.jsx)(e$,{name:"colors",param:n,value:s,onChange:this.colorsChanged,isDisabled:this.props.isDisabled,onEnter:this.props.onEnter}),(0,L.jsx)(QW,{name:"isInterpolated",param:r,value:"interpolate"===this.props.value.kind,onChange:this.isInterpolatedChanged,isDisabled:this.props.isDisabled,onEnter:this.props.onEnter})]})}render(){return f2({props:this.props,state:this.state,control:this.renderControl(),toggleHelp:this.toggleHelp,addOn:this.renderColors()})}}class Qbt extends Yt.PureComponent{constructor(){super(...arguments),this.state={isExpanded:!1},this.components={0:I.Numeric(0,{step:this.props.param.step},{label:this.props.param.fieldLabels&&this.props.param.fieldLabels.x||"X"}),1:I.Numeric(0,{step:this.props.param.step},{label:this.props.param.fieldLabels&&this.props.param.fieldLabels.y||"Y"}),2:I.Numeric(0,{step:this.props.param.step},{label:this.props.param.fieldLabels&&this.props.param.fieldLabels.z||"Z"})},this.componentChange=({name:t,value:n})=>{const r=C.copy(C.zero(),this.props.value);r[+t]=n,this.change(r)},this.toggleExpanded=t=>{this.setState({isExpanded:!this.state.isExpanded}),t.currentTarget.blur()}}change(t){this.props.onChange({name:this.props.name,param:this.props.param,value:t})}render(){const t=this.props.value,n=this.props.param.label||Rc(this.props.name),r=n5(this.props.param.step||.01),i=`[${t[0].toFixed(r)}, ${t[1].toFixed(r)}, ${t[2].toFixed(r)}]`;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Bd,{label:n,control:(0,L.jsx)("button",{onClick:this.toggleExpanded,disabled:this.props.isDisabled,children:i})}),this.state.isExpanded&&(0,L.jsx)("div",{className:"msp-control-offset",children:(0,L.jsx)(vs,{params:this.components,values:t,onChange:this.componentChange,onEnter:this.props.onEnter})})]})}}class Jbt extends Yt.PureComponent{constructor(){super(...arguments),this.state={isExpanded:!1},this.components={json:I.Text(JSON.stringify(fe()),{description:"JSON array with 4x4 matrix in a column major (j * 4 + i indexing) format"})},this.componentChange=({name:t,value:n})=>{const r=fe.copy(fe(),this.props.value);"json"===t?fe.copy(r,JSON.parse(n)):r[+t]=n,this.change(r)},this.toggleExpanded=t=>{this.setState({isExpanded:!this.state.isExpanded}),t.currentTarget.blur()}}change(t){this.props.onChange({name:this.props.name,param:this.props.param,value:t})}changeValue(t){return n=>{const r=fe.copy(fe(),this.props.value);r[t]=n,this.change(r)}}get grid(){const t=this.props.value,n=[];for(let r=0;r<4;r++){const i=[];for(let o=0;o<4;o++)i.push((0,L.jsx)(Ky,{numeric:!0,delayMs:50,value:fe.getValue(t,r,o),onChange:this.changeValue(4*o+r),className:"msp-form-control",blurOnEnter:!0,isDisabled:this.props.isDisabled},o));n.push((0,L.jsx)("div",{className:"msp-flex-row",children:i},r))}return(0,L.jsx)("div",{className:"msp-parameter-matrix",children:n})}render(){const t={json:JSON.stringify(this.props.value)},n=this.props.param.label||Rc(this.props.name);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Bd,{label:n,control:(0,L.jsx)("button",{onClick:this.toggleExpanded,disabled:this.props.isDisabled,children:"4\xd74 Matrix"})}),this.state.isExpanded&&(0,L.jsxs)("div",{className:"msp-control-offset",children:[this.grid,(0,L.jsx)(vs,{params:this.components,values:t,onChange:this.componentChange,onEnter:this.props.onEnter})]})]})}}class e1t extends LA{constructor(){super(...arguments),this.onChange=t=>{const n=t.target.value;n!==jr.getUrl(this.props.value||"")&&this.update(jr.Url(n))},this.onKeyPress=t=>{(13===t.keyCode||13===t.charCode||"Enter"===t.key)&&this.props.onEnter&&this.props.onEnter(),t.stopPropagation()}}renderControl(){const t=this.props.param.label||Rc(this.props.name);return(0,L.jsx)("input",{type:"text",value:jr.getUrl(this.props.value||""),placeholder:t,onChange:this.onChange,onKeyPress:this.props.onEnter?this.onKeyPress:void 0,disabled:this.props.isDisabled})}}class t1t extends Yt.PureComponent{constructor(){super(...arguments),this.state={showHelp:!1},this.onChangeFile=t=>{this.change(t.target.files[0])},this.toggleHelp=()=>this.setState({showHelp:!this.state.showHelp})}change(t){this.props.onChange({name:this.props.name,param:this.props.param,value:jr.File(t)})}renderControl(){const t=this.props.value;return(0,L.jsxs)("div",{className:"msp-btn msp-btn-block msp-btn-action msp-loader-msp-btn-file",style:{marginTop:"1px"},children:[t?t.name:"Select a file..."," ",(0,L.jsx)("input",{disabled:this.props.isDisabled,onChange:this.onChangeFile,type:"file",multiple:!1,accept:this.props.param.accept})]})}render(){return this.props.param.label?f2({props:this.props,state:this.state,control:this.renderControl(),toggleHelp:this.toggleHelp,addOn:null}):this.renderControl()}}class n1t extends Yt.PureComponent{constructor(){super(...arguments),this.state={showHelp:!1},this.onChangeFileList=t=>{this.change(t.target.files)},this.toggleHelp=()=>this.setState({showHelp:!this.state.showHelp})}change(t){const n=[];if(t)for(let r=0,i=t.length;r{this.setState({isExpanded:!this.state.isExpanded}),t.currentTarget.blur()}}change(t){this.props.onChange({name:this.props.name,param:this.props.param,value:t})}toggle(t){return n=>{this.props.value.indexOf(t)<0?this.change(this.props.value.concat(t)):this.change(this.props.value.filter(r=>r!==t)),n.currentTarget.blur()}}render(){const t=this.props.value,n=this.props.param.emptyValue,r=this.props.param.label||Rc(this.props.name);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Bd,{label:r,control:(0,L.jsx)("button",{onClick:this.toggleExpanded,disabled:this.props.isDisabled,children:0===t.length&&n?n:`${t.length} of ${this.props.param.options.length}`})}),this.state.isExpanded&&(0,L.jsx)("div",{className:"msp-control-offset",children:this.props.param.options.map(([i,o])=>{const s=t.indexOf(i)>=0;return(0,L.jsx)(ir,{onClick:this.toggle(i),disabled:this.props.isDisabled,style:{marginTop:"1px"},children:(0,L.jsx)("span",{style:{float:s?"left":"right"},children:s?`\u2713 ${o}`:`${o} \u2717`})},i)})})]})}}class Kbe extends Yt.PureComponent{constructor(){super(...arguments),this.state={isExpanded:!!this.props.param.isExpanded,showPresets:!1,showHelp:!1},this.onChangeParam=t=>{this.change({...this.props.value,[t.name]:t.value})},this.toggleExpanded=()=>this.setState({isExpanded:!this.state.isExpanded}),this.toggleShowPresets=()=>this.setState({showPresets:!this.state.showPresets}),this.presetItems=sy(t=>{var n;return Hn.createItemsFromSelectOptions(null!==(n=t.presets)&&void 0!==n?n:[])}),this.onSelectPreset=t=>{this.setState({showPresets:!1}),this.change(t?.value)}}change(t){this.props.onChange({name:this.props.name,param:this.props.param,value:t})}pivotedPresets(){if(!this.props.param.presets)return null;const t=this.props.param.label||Rc(this.props.name);return(0,L.jsxs)("div",{className:"msp-control-group-wrapper",children:[(0,L.jsx)("div",{className:"msp-control-group-header",children:(0,L.jsxs)("button",{className:"msp-btn msp-form-control msp-btn-block",onClick:this.toggleShowPresets,children:[(0,L.jsx)(Mi,{svg:OA}),t," Presets"]})}),this.state.showPresets&&(0,L.jsx)(Hn,{items:this.presetItems(this.props.param),onSelect:this.onSelectPreset})]})}presets(){return this.props.param.presets?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("div",{className:"msp-control-group-presets-wrapper",children:(0,L.jsx)("div",{className:"msp-control-group-header",children:(0,L.jsxs)("button",{className:"msp-btn msp-form-control msp-btn-block",onClick:this.toggleShowPresets,children:[(0,L.jsx)(Mi,{svg:OA}),"Presets"]})})}),this.state.showPresets&&(0,L.jsx)(Hn,{items:this.presetItems(this.props.param),onSelect:this.onSelectPreset})]}):null}pivoted(){const t=this.props.param.pivot,n=this.props.param.params,r=n[t],i=jP(r),o=(0,L.jsx)(i,{name:t,param:r,value:this.props.value[t],onChange:this.onChangeParam,onEnter:this.props.onEnter,isDisabled:this.props.isDisabled});if(!this.state.isExpanded)return(0,L.jsxs)("div",{className:"msp-mapped-parameter-group",children:[o,(0,L.jsx)(kn,{svg:l2,onClick:this.toggleExpanded,toggleState:this.state.isExpanded,title:"More Options"})]});const s=Object.create(null);for(const a of Object.keys(n))a!==t&&(s[a]=n[a]);return(0,L.jsxs)("div",{className:"msp-mapped-parameter-group",children:[o,(0,L.jsx)(kn,{svg:l2,onClick:this.toggleExpanded,toggleState:this.state.isExpanded,title:"More Options"}),(0,L.jsxs)("div",{className:"msp-control-offset",children:[this.pivotedPresets(),(0,L.jsx)(vs,{params:s,onEnter:this.props.onEnter,values:this.props.value,onChange:this.onChangeParam,isDisabled:this.props.isDisabled})]})]})}render(){const t=this.props.param.params;if(0===Object.keys(t).length)return null;if(this.props.param.pivot)return this.pivoted();const n=this.props.param.label||Rc(this.props.name),r=(0,L.jsx)(vs,{params:t,onChange:this.onChangeParam,values:this.props.value,onEnter:this.props.onEnter,isDisabled:this.props.isDisabled});return this.props.inMapped?(0,L.jsx)("div",{className:"msp-control-offset",children:r}):this.props.param.isFlat?r:(0,L.jsxs)("div",{className:"msp-control-group-wrapper",style:{position:"relative"},children:[(0,L.jsx)("div",{className:"msp-control-group-header",children:(0,L.jsxs)("button",{className:"msp-btn msp-form-control msp-btn-block",onClick:this.toggleExpanded,children:[(0,L.jsx)(Mi,{svg:this.state.isExpanded?Yy:Xy}),n]})}),this.presets(),this.state.isExpanded&&(0,L.jsx)("div",{className:"msp-control-offset",children:r})]})}}class i1t extends Yt.PureComponent{constructor(){super(...arguments),this.state={isExpanded:!1},this.valuesCache={},this.onChangeName=t=>{this.change({name:t.value,params:this.getValues(t.value)})},this.onChangeParam=t=>{this.setValues(this.props.value.name,t.value),this.change({name:this.props.value.name,params:t.value})},this.toggleExpanded=()=>this.setState({isExpanded:!this.state.isExpanded})}setValues(t,n){this.valuesCache[t]=n}getValues(t){return t in this.valuesCache?this.valuesCache[t]:this.props.param.map(t).defaultValue}change(t){this.props.onChange({name:this.props.name,param:this.props.param,value:t})}areParamsEmpty(t){for(const n of Object.keys(t))if(!t[n].isHidden)return!1;return!0}render(){const t=this.props.value||this.props.param.defaultValue,n=this.props.param.map(t.name),r=this.props.param.label||Rc(this.props.name),i=jP(n),o=this.props.param.help,s=o?{...this.props.param.select,help:l=>o({name:l,params:this.getValues(l)})}:this.props.param.select,a=(0,L.jsx)(mO,{param:s,isDisabled:this.props.isDisabled,onChange:this.onChangeName,onEnter:this.props.onEnter,name:r,value:t.name});return i?"group"!==n.type||n.isFlat?(0,L.jsxs)(L.Fragment,{children:[a,(0,L.jsx)(i,{param:n,value:t.params,name:t.name,onChange:this.onChangeParam,onEnter:this.props.onEnter,isDisabled:this.props.isDisabled})]}):this.areParamsEmpty(n.params)?a:(0,L.jsxs)("div",{className:"msp-mapped-parameter-group",children:[a,(0,L.jsx)(kn,{svg:l2,onClick:this.toggleExpanded,toggleState:this.state.isExpanded,title:`${r} Properties`}),this.state.isExpanded&&(0,L.jsx)(Kbe,{inMapped:!0,param:n,value:t.params,name:t.name,onChange:this.onChangeParam,onEnter:this.props.onEnter,isDisabled:this.props.isDisabled})]}):a}}class Zbe extends Yt.PureComponent{constructor(){super(...arguments),this.state={current:this.props.value},this.onChangeParam=t=>{this.setState({current:{...this.state.current,[t.name]:t.value}})},this.apply=()=>{this.props.apply(this.state.current)}}componentDidUpdate(t){(this.props.params!==t.params||this.props.value!==t.value)&&this.setState({current:this.props.value})}render(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(vs,{params:this.props.params,onChange:this.onChangeParam,values:this.state.current,onEnter:this.apply,isDisabled:this.props.isDisabled}),(0,L.jsx)("button",{className:"msp-btn msp-btn-block msp-form-control msp-control-top-offset",onClick:this.apply,disabled:this.props.isDisabled,children:this.props.isUpdate?"Update":"Add"})]})}}class o1t extends Yt.PureComponent{constructor(){super(...arguments),this.state={isExpanded:!1},this.update=t=>{this.props.actions.update(t,this.props.index)},this.moveUp=()=>{this.props.actions.move(this.props.index,-1)},this.moveDown=()=>{this.props.actions.move(this.props.index,1)},this.remove=()=>{this.setState({isExpanded:!1}),this.props.actions.remove(this.props.index)},this.toggleExpanded=t=>{this.setState({isExpanded:!this.state.isExpanded}),t.currentTarget.blur()}}render(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"msp-param-object-list-item",children:[(0,L.jsxs)("button",{className:"msp-btn msp-btn-block msp-form-control",onClick:this.toggleExpanded,children:[(0,L.jsx)("span",{children:`${this.props.index+1}: `}),this.props.param.getLabel(this.props.value)]}),(0,L.jsxs)("div",{children:[(0,L.jsx)(kn,{svg:fO,title:"Move Up",onClick:this.moveUp,small:!0}),(0,L.jsx)(kn,{svg:pO,title:"Move Down",onClick:this.moveDown,small:!0}),(0,L.jsx)(kn,{svg:qp,title:"Remove",onClick:this.remove,small:!0})]})]}),this.state.isExpanded&&(0,L.jsx)("div",{className:"msp-control-offset",children:(0,L.jsx)(Zbe,{params:this.props.param.element,apply:this.update,value:this.props.value,isUpdate:!0,isDisabled:this.props.isDisabled})})]})}}class e$ extends Yt.PureComponent{constructor(){super(...arguments),this.state={isExpanded:!1},this.add=t=>{this.change([...this.props.value,t])},this.actions={update:(t,n)=>{const r=this.props.value.slice(0);r[n]=t,this.change(r)},move:(t,n)=>{let r=this.props.value;if(1===r.length)return;let i=(t+n)%r.length;i<0&&(i+=r.length),r=r.slice(0);const o=r[t];r[t]=r[i],r[i]=o,this.change(r)},remove:t=>{const n=this.props.value,r=[];for(let i=0;i{this.setState({isExpanded:!this.state.isExpanded}),t.currentTarget.blur()}}change(t){this.props.onChange({name:this.props.name,param:this.props.param,value:t})}render(){const t=this.props.value,n=this.props.param.label||Rc(this.props.name);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Bd,{label:n,control:(0,L.jsx)("button",{onClick:this.toggleExpanded,disabled:this.props.isDisabled,children:`${t.length} item${1!==t.length?"s":""}`})}),this.state.isExpanded&&(0,L.jsxs)("div",{className:"msp-control-offset",children:[this.props.value.map((i,o)=>(0,L.jsx)(o1t,{param:this.props.param,value:i,index:o,actions:this.actions,isDisabled:this.props.isDisabled},o)),(0,L.jsx)(Fg,{header:"New Item",children:(0,L.jsx)(Zbe,{params:this.props.param.element,apply:this.add,value:this.props.param.ctor(),isDisabled:this.props.isDisabled})})]})]})}}class s1t extends Yt.PureComponent{constructor(){super(...arguments),this.onChangeCondition=t=>{this.change(this.props.param.conditionedValue(this.props.value,t.value))},this.onChangeParam=t=>{this.change(t.value)}}change(t){this.props.onChange({name:this.props.name,param:this.props.param,value:t})}render(){const t=this.props.value,n=this.props.param.conditionForValue(t),r=this.props.param.conditionParams[n],i=this.props.param.label||Rc(this.props.name),o=jP(r),s=(0,L.jsx)(mO,{param:this.props.param.select,isDisabled:this.props.isDisabled,onChange:this.onChangeCondition,onEnter:this.props.onEnter,name:`${i} Kind`,value:n});return o?(0,L.jsxs)(L.Fragment,{children:[s,(0,L.jsx)(o,{param:r,value:t,name:i,onChange:this.onChangeParam,onEnter:this.props.onEnter,isDisabled:this.props.isDisabled})]}):s}}class a1t extends Yt.PureComponent{constructor(){super(...arguments),this.onChange=t=>{this.props.onChange({name:this.props.name,param:this.props.param,value:this.props.param.toValue(t.value)})}}render(){const t=this.props.param.fromValue(this.props.value),n=jP(this.props.param.converted);return n?(0,L.jsx)(n,{param:this.props.param.converted,value:t,name:this.props.name,onChange:this.onChange,onEnter:this.props.onEnter,isDisabled:this.props.isDisabled}):null}}class l1t extends Yt.PureComponent{constructor(){super(...arguments),this.onChange=({name:t,value:n})=>{n!==this.props.value[t]&&this.props.onChange({param:this.props.param,name:this.props.name,value:{...this.props.value,[t]:n}})}}render(){const t={defaultValue:this.props.value.language,options:I.objectToOptions(pa.Info),type:"select"},n=(0,L.jsx)(mO,{param:t,isDisabled:this.props.isDisabled,onChange:this.onChange,onEnter:this.props.onEnter,name:"language",value:this.props.value.language}),i=(0,L.jsx)(Ybe,{param:{defaultValue:this.props.value.language,type:"text"},isDisabled:this.props.isDisabled,onChange:this.onChange,name:"expression",value:this.props.value.expression});return(0,L.jsxs)(L.Fragment,{children:[n,"mol-script"!==this.props.value.language&&(0,L.jsxs)("div",{className:"msp-help-text",style:{padding:"10px"},children:[(0,L.jsx)(Mi,{svg:Obe})," Support for PyMOL, VMD, and Jmol selections is an experimental feature and may not always work as intended."]}),i]})}}const c1t={color:I.Color(qn.black,{description:"Display color of the volume."}),wireframe:I.Boolean(!1,{description:"Control display of the volume as a wireframe."}),opacity:I.Numeric(.3,{min:0,max:1,step:.01},{description:"Opacity of the volume."})},u1t=new Map([["em",[-5,5]],["2fo-fc",[0,3]],["fo-fc(+ve)",[1,5]],["fo-fc(-ve)",[-5,-1]]]);class yO extends Vr{constructor(){super(...arguments),this.ref=Qn.findTagInSubtree(this.plugin.state.data.tree,this.props.bCell.transform.ref,this.props.name),this.getVisible=()=>{const n=this.ref;return!!n&&!this.plugin.state.data.cells.get(n).state.isHidden},this.toggleVisible=()=>{const t=this.plugin.state.data,n=this.ref;n&&G_(t,n,!t.cells.get(n).state.isHidden)}}componentDidUpdate(){this.ref=Qn.findTagInSubtree(this.plugin.state.data.tree,this.props.bCell.transform.ref,this.props.name)}componentDidMount(){this.subscribe(this.plugin.state.data.events.cell.stateUpdated,t=>{this.ref===t.ref&&this.forceUpdate()})}render(){const t=this.props,{isRelative:n,stats:r}=t,i=t.channels[t.name],{min:o,max:s,mean:a,sigma:l}=r,c=Math.round(100*("relative"===i.isoValue.kind?i.isoValue.relativeValue:i.isoValue.absoluteValue))/100;let u=(o-a)/l,d=(s-a)/l;if(!this.props.isUnbounded){const y=u1t.get(this.props.name);"em"===this.props.name?(u=Math.max(y[0],u),d=Math.min(y[1],d)):(u=y[0],d=y[1])}const f=a+l*u,p=a+l*d,m=az(n?Math.round((p-f)/l)/100:l/100,2);return(0,L.jsx)(Ibt,{label:t.label+(t.isRelative?" \u03c3":""),colorStripe:i.color,pivot:(0,L.jsxs)("div",{className:"msp-volume-channel-inline-controls",children:[(0,L.jsx)(zbe,{value:c,min:n?u:f,max:n?d:p,step:m,onChange:y=>t.changeIso(t.name,y,n),onChangeImmediate:y=>t.changeIso(t.name,y,n),disabled:t.params.isDisabled,onEnter:t.params.events.onEnter}),(0,L.jsx)(kn,{svg:this.getVisible()?u2:c2,onClick:this.toggleVisible,toggleState:!1,disabled:t.params.isDisabled})]}),controls:(0,L.jsx)(vs,{onChange:({name:y,value:v})=>t.changeParams(t.name,y,v),params:c1t,values:i,onEnter:t.params.events.onEnter,isDisabled:t.params.isDisabled})})}}class d1t extends Vr{constructor(){super(...arguments),this.changeIso=(t,n,r)=>{const i=this.props.params;this.newParams({...i,entry:{name:i.entry.name,params:{...i.entry.params,channels:{...i.entry.params.channels,[t]:{...i.entry.params.channels[t],isoValue:r?mt.IsoValue.relative(n):mt.IsoValue.absolute(n)}}}}})},this.changeParams=(t,n,r)=>{const i=this.props.params;this.newParams({...i,entry:{name:i.entry.name,params:{...i.entry.params,channels:{...i.entry.params.channels,[t]:{...i.entry.params.channels[t],[n]:r}}}}})},this.changeOption=({name:t,value:n})=>{const r=this.props.params;if("entry"===t)this.newParams({...r,entry:{name:n,params:r.entry.params}});else{const i=this.props.b.data,o="em"===i.info.kind,s=n.params.isRelative,a=i.info.header.sampling[0],l=r.entry.params.channels,u={...r.entry.params.view.name===n.name?r.entry.params.view.params:this.props.info.params.entry.map(r.entry.name).params.view.map(n.name).defaultValue};"selection-box"===n.name?u.radius=n.params.radius:"camera-target"===n.name?(u.radius=n.params.radius,u.dynamicDetailLevel=n.params.dynamicDetailLevel):"box"===n.name?(u.bottomLeft=n.params.bottomLeft,u.topRight=n.params.topRight):"auto"===n.name&&(u.radius=n.params.radius,u.selectionDetailLevel=n.params.selectionDetailLevel),u.isUnbounded=!!n.params.isUnbounded,this.newParams({...r,entry:{name:r.entry.name,params:{...r.entry.params,view:{name:n.name,params:u},detailLevel:n.params.detailLevel,channels:o?{em:this.convert(l.em,a.valuesInfo[0],s)}:{"2fo-fc":this.convert(l["2fo-fc"],a.valuesInfo[0],s),"fo-fc(+ve)":this.convert(l["fo-fc(+ve)"],a.valuesInfo[1],s),"fo-fc(-ve)":this.convert(l["fo-fc(-ve)"],a.valuesInfo[1],s)}}}})}}}areInitial(t){return I.areEqual(this.props.info.params,t,this.props.info.initialValues)}newParams(t){this.props.events.onChange(t,this.areInitial(t))}convert(t,n,r){return{...t,isoValue:r?mt.IsoValue.toRelative(t.isoValue,n):mt.IsoValue.toAbsolute(t.isoValue,n)}}render(){if(!this.props.b)return null;const t=this.props.b.data,n="em"===t.info.kind,r=n?"em":"2fo-fc",i=this.props.params,o=this.props.info.params.entry.map(i.entry.name),s=o.params.detailLevel,a={...s,label:"Dynamic Detail",defaultValue:o.params.view.map("camera-target").params.dynamicDetailLevel.defaultValue},l={...s,label:"Selection Detail",defaultValue:o.params.view.map("auto").params.selectionDetailLevel.defaultValue},c=t.info.header.sampling[0],u="relative"===i.entry.params.channels[r].isoValue.kind,d=I.Boolean(u,{description:"Use normalized or absolute isocontour scale.",label:"Normalized"}),f=!!i.entry.params.view.params.isUnbounded,p=I.Boolean(f,{description:"Show full/limited range of iso-values for more fine-grained control.",label:"Unbounded"}),m="off"===i.entry.params.view.name,h={entry:I.Select(i.entry.name,t.data.entries.map(y=>[y.dataId,y.dataId]),{isHidden:m,description:"Which entry with volume data to display."}),view:I.MappedStatic(i.entry.params.view.name,{off:I.Group({isRelative:I.Boolean(u,{isHidden:!0}),isUnbounded:I.Boolean(f,{isHidden:!0})},{description:"Display off."}),box:I.Group({bottomLeft:I.Vec3(C.zero()),topRight:I.Vec3(C.zero()),detailLevel:s,isRelative:d,isUnbounded:p},{description:"Static box defined by cartesian coords."}),"selection-box":I.Group({radius:I.Numeric(5,{min:0,max:50,step:.5},{description:"Radius in \u212b within which the volume is shown."}),detailLevel:s,isRelative:d,isUnbounded:p},{description:"Box around focused element."}),"camera-target":I.Group({radius:I.Numeric(.5,{min:0,max:1,step:.05},{description:"Radius within which the volume is shown (relative to the field of view)."}),detailLevel:{...s,isHidden:!0},dynamicDetailLevel:a,isRelative:d,isUnbounded:p},{description:"Box around camera target."}),cell:I.Group({detailLevel:s,isRelative:d,isUnbounded:p},{description:"Box around the structure's bounding box."}),auto:I.Group({radius:I.Numeric(5,{min:0,max:50,step:.5},{description:"Radius in \u212b within which the volume is shown."}),detailLevel:s,selectionDetailLevel:l,isRelative:d,isUnbounded:p},{description:"Box around focused element."})},{options:fu.ViewTypeOptions,description:'Controls what of the volume is displayed. "Off" hides the volume alltogether. "Bounded box" shows the volume inside the given box. "Around Focus" shows the volume around the element/atom last interacted with. "Around Camera" shows the volume around the point the camera is targeting. "Whole Structure" shows the volume for the whole structure.'})},g={entry:i.entry.name,view:{name:i.entry.params.view.name,params:{detailLevel:i.entry.params.detailLevel,radius:i.entry.params.view.params.radius,bottomLeft:i.entry.params.view.params.bottomLeft,topRight:i.entry.params.view.params.topRight,selectionDetailLevel:i.entry.params.view.params.selectionDetailLevel,dynamicDetailLevel:i.entry.params.view.params.dynamicDetailLevel,isRelative:u,isUnbounded:f}}};return m?(0,L.jsx)(vs,{onChange:this.changeOption,params:h,values:g,onEnter:this.props.events.onEnter,isDisabled:this.props.isDisabled}):(0,L.jsxs)(L.Fragment,{children:[!n&&(0,L.jsx)(yO,{label:"2Fo-Fc",name:"2fo-fc",bCell:this.props.bCell,channels:i.entry.params.channels,changeIso:this.changeIso,changeParams:this.changeParams,isRelative:u,params:this.props,stats:c.valuesInfo[0],isUnbounded:f}),!n&&(0,L.jsx)(yO,{label:"Fo-Fc(+ve)",name:"fo-fc(+ve)",bCell:this.props.bCell,channels:i.entry.params.channels,changeIso:this.changeIso,changeParams:this.changeParams,isRelative:u,params:this.props,stats:c.valuesInfo[1],isUnbounded:f}),!n&&(0,L.jsx)(yO,{label:"Fo-Fc(-ve)",name:"fo-fc(-ve)",bCell:this.props.bCell,channels:i.entry.params.channels,changeIso:this.changeIso,changeParams:this.changeParams,isRelative:u,params:this.props,stats:c.valuesInfo[1],isUnbounded:f}),n&&(0,L.jsx)(yO,{label:"EM",name:"em",bCell:this.props.bCell,channels:i.entry.params.channels,changeIso:this.changeIso,changeParams:this.changeParams,isRelative:u,params:this.props,stats:c.valuesInfo[0],isUnbounded:f}),(0,L.jsx)(vs,{onChange:this.changeOption,params:h,values:g,onEnter:this.props.events.onEnter,isDisabled:this.props.isDisabled})]})}}function Jy(...e){const t=$C(e),n=Wre(e,1/0),r=e;return r.length?1===r.length?vd(r[0]):Ux(n)(Is(r,t)):Mh}function Qbe(e,t=yF){return is((n,r)=>{let i=null,o=null,s=null;const a=()=>{if(i){i.unsubscribe(),i=null;const c=o;o=null,r.next(c)}};function l(){const c=s+e,u=t.now();if(u{o=c,s=t.now(),i||(i=t.schedule(l,e),r.add(i))},()=>{a(),r.complete()},void 0,()=>{o=i=null}))})}var bO;!function(e){e.Registry=class t{constructor(){this.providers=Nc().asMutable(),this.defaultAutoAttachValues=new Map}getParams(r){const i={},o=[],s=[];if(r){const a=this.providers.values();for(;;){const l=a.next();if(l.done)break;const c=l.value;c.isApplicable(r)&&(c.isHidden||(o.push([c.descriptor.name,c.label]),this.defaultAutoAttachValues.get(c.descriptor.name)&&s.push(c.descriptor.name)),i[c.descriptor.name]=I.Group({...c.getParams(r)},{label:c.label,isHidden:c.isHidden}))}}return{autoAttach:I.MultiSelect(s,o),properties:I.Group(i,{isFlat:!0})}}setDefaultAutoAttach(r,i){this.defaultAutoAttachValues.set(r,i)}get(r){if(!this.providers.get(r))throw new Error(`Custom property '${r}' is not registered.`);return this.providers.get(r)}register(r,i){this.providers.set(r.descriptor.name,r),this.defaultAutoAttachValues.set(r.descriptor.name,i)}unregister(r){this.providers.delete(r),this.defaultAutoAttachValues.delete(r)}}}(bO||(bO={}));class p1t{get dataState(){return this.plugin.state.data}rawData(t,n){return this.dataState.build().toRoot().apply(Mue,t,n).commit({revertOnError:!0})}download(t,n){return this.dataState.build().toRoot().apply(Pue,t,n).commit({revertOnError:!0})}downloadBlob(t,n){return this.dataState.build().toRoot().apply(kue,t,n).commit({revertOnError:!0})}readFile(t,n){var r=this;return le(function*(){var i,o,s;return{data:yield r.dataState.build().toRoot().apply(Rue,t,n).commit({revertOnError:!0}),fileInfo:RA(null!==(s=null===(o=null===(i=t.file)||void 0===i?void 0:i.file)||void 0===o?void 0:o.name)&&void 0!==s?s:"")}})()}constructor(t){this.plugin=t}}class h1t{get dataState(){return this.plugin.state.data}resolveProvider(t){var n;return"string"==typeof t?null!==(n=Gp[t])&&void 0!==n?n:NU(this._providers,r=>r.id===t):t}hasPreset(t){for(const n of this._providers)if(!n.isApplicable||n.isApplicable(t,this.plugin))return!0;return!1}get providers(){return this._providers}getPresets(t){if(!t)return this.providers;const n=[];for(const r of this._providers)r.isApplicable&&!r.isApplicable(t,this.plugin)||n.push(r);return n}getPresetSelect(t){const n=[];for(const r of this._providers)t&&r.isApplicable&&!r.isApplicable(t,this.plugin)||n.push([r.id,r.display.name,r.display.group]);return I.Select("auto",n)}getPresetsWithOptions(t){const n=[],r=Object.create(null);for(const i of this._providers)i.isApplicable&&!i.isApplicable(t,this.plugin)||(n.push([i.id,i.display.name]),r[i.id]=i.params?I.Group(i.params(t,this.plugin)):I.EmptyGroup());return 0===n.length?I.MappedStatic("",{"":I.EmptyGroup()}):I.MappedStatic(n[0][0],r,{options:n})}registerPreset(t){if(this.providerMap.has(t.id))throw new Error(`Representation provider with id '${t.id}' already registered.`);this._providers.push(t),this.providerMap.set(t.id,t)}unregisterPreset(t){this.providerMap.delete(t.id),p3(this._providers,t)}applyPreset(t,n,r){var i;const o=this.resolveProvider(n);if(!o)return;const a=_a.resolveAndCheck(this.plugin.state.data,t);if(!a)return void(g3||console.warn("Applying structure repr. provider to bad cell."));const l=(null===(i=o.params)||void 0===i?void 0:i.call(o,a.obj,this.plugin))||{};let c=r||(o.params?I.getDefaultValues(l):{});const u=this.plugin.config.get(ei.Structure.DefaultRepresentationPresetParams);c=I.merge(l,u,c);const d=Ke.create(`${o.display.name}`,()=>o.apply(a,c,this.plugin));return this.plugin.runTask(d)}addRepresentation(t,n,r){var i=this;return le(function*(){const o=i.dataState.build(),s=i.buildRepresentation(o,t,n,r);if(s)return yield o.commit(),s})()}buildRepresentation(t,n,r,i){var o,s;if(!n)return;const a=null===(s=null===(o=_a.resolveAndCheck(this.dataState,n))||void 0===o?void 0:o.obj)||void 0===s?void 0:s.data;if(!a)return;const l=rO(this.plugin,a,r);return i?.tag?t.to(n).applyOrUpdateTagged(i.tag,hF,l,{state:i?.initialState}).selector:t.to(n).apply(hF,l,{state:i?.initialState}).selector}constructor(t){this.plugin=t,this._providers=[],this.providerMap=new Map,this.defaultProvider=Gp.auto,Nu(Gp,n=>this.registerPreset(n))}}function dv(e){return e}!function(e){e.CommonParams=(t,n)=>({modelProperties:I.Optional(I.Group(yt.getParamDefinition(at.Model.CustomModelProperties,void 0,n))),structureProperties:I.Optional(I.Group(yt.getParamDefinition(at.Model.CustomStructureProperties,void 0,n))),representationPreset:I.Optional(I.Text("auto"))})}(dv||(dv={}));const vO=dv.CommonParams,Jbe=dv({id:"preset-trajectory-default",display:{name:"Default (Assembly)",group:"Preset",description:"Shows the first assembly or, if that is unavailable, the first model."},isApplicable:e=>!0,params:(e,t)=>({model:I.Optional(I.Group(yt.getParamDefinition(at.Model.ModelFromTrajectory,e,t))),showUnitcell:I.Optional(I.Boolean(!1)),structure:I.Optional(R_.getParams(void 0,"assembly").type),representationPresetParams:I.Optional(I.Group(jc.CommonParams)),...vO(e,t)}),apply:(e,t,n)=>le(function*(){const r=n.builders.structure,i=yield r.createModel(e,t.model),o=yield r.insertModelProperties(i,t.modelProperties),s=yield r.createStructure(o||i,t.structure),a=yield r.insertStructureProperties(s,t.structureProperties),l=void 0===t.showUnitcell||t.showUnitcell?yield r.tryCreateUnitcell(o,void 0,{isHidden:!0}):void 0,c=t.representationPreset||n.config.get(ei.Structure.DefaultRepresentationPreset)||Gp.auto.id;return{model:i,modelProperties:o,unitcell:l,structure:s,structureProperties:a,representation:yield n.builders.structure.representation.applyPreset(a,c,t.representationPresetParams)}})()}),m1t=dv({id:"preset-trajectory-all-models",display:{name:"All Models",group:"Preset",description:"Shows all models; colored by trajectory-index."},isApplicable:e=>e.data.frameCount>1,params:(e,t)=>({useDefaultIfSingleModel:I.Optional(I.Boolean(!1)),representationPresetParams:I.Optional(I.Group(jc.CommonParams)),...vO(e,t)}),apply:(e,t,n)=>le(function*(){var r,i;const o=null===(i=null===(r=_a.resolveAndCheck(n.state.data,e))||void 0===r?void 0:r.obj)||void 0===i?void 0:i.data;if(!o)return{};if(1===o.frameCount&&t.useDefaultIfSingleModel)return Jbe.apply(e,t,n);const s=n.builders.structure,a=[],l=[];for(let c=0;c({model:I.Optional(I.Group(yt.getParamDefinition(at.Model.ModelFromTrajectory,e,t))),...vO(e,t)});function t1e(e,t,n,r){return t$.apply(this,arguments)}function t$(){return t$=le(function*(e,t,n,r){const i=r.builders.structure,o=yield i.createModel(t,n.model),s=yield i.insertModelProperties(o,n.modelProperties),a=yield i.createStructure(s||o,{name:"symmetry",params:e}),l=yield i.insertStructureProperties(a,n.structureProperties),c=yield i.tryCreateUnitcell(s,void 0,{isHidden:!1}),u=n.representationPreset||r.config.get(ei.Structure.DefaultRepresentationPreset)||Gp.auto.id;return{model:o,modelProperties:s,unitcell:c,structure:a,structureProperties:l,representation:yield r.builders.structure.representation.applyPreset(l,u,{theme:{globalName:e.theme}})}}),t$.apply(this,arguments)}const g1t=dv({id:"preset-trajectory-unitcell",display:{name:"Unit Cell",group:"Preset",description:"Shows the fully populated unit cell."},isApplicable:e=>Sn.hasCrystalSymmetry(e.data.representative),params:e1e,apply:(e,t,n)=>le(function*(){return yield t1e({ijkMin:C.create(0,0,0),ijkMax:C.create(0,0,0)},e,t,n)})()}),y1t=dv({id:"preset-trajectory-supercell",display:{name:"Super Cell",group:"Preset",description:"Shows the super cell, i.e. the central unit cell and all adjacent unit cells."},isApplicable:e=>Sn.hasCrystalSymmetry(e.data.representative),params:e1e,apply:(e,t,n)=>le(function*(){return yield t1e({ijkMin:C.create(-1,-1,-1),ijkMax:C.create(1,1,1),theme:"operator-hkl"},e,t,n)})()}),b1t=dv({id:"preset-trajectory-crystal-contacts",display:{name:"Crystal Contacts",group:"Preset",description:"Showsasymetric unit and chains from neighbours within 5 \u212b, i.e., symmetry mates."},isApplicable:e=>Sn.hasCrystalSymmetry(e.data.representative),params:(e,t)=>({model:I.Optional(I.Group(yt.getParamDefinition(at.Model.ModelFromTrajectory,e,t))),...vO(e,t)}),apply:(e,t,n)=>le(function*(){const r=n.builders.structure,i=yield r.createModel(e,t.model),o=yield r.insertModelProperties(i,t.modelProperties),s=yield r.createStructure(o||i,{name:"symmetry-mates",params:{radius:5}}),a=yield r.insertStructureProperties(s,t.structureProperties),l=yield r.tryCreateUnitcell(o,void 0,{isHidden:!0}),c=t.representationPreset||n.config.get(ei.Structure.DefaultRepresentationPreset)||Gp.auto.id;return{model:i,modelProperties:o,unitcell:l,structure:s,structureProperties:a,representation:yield n.builders.structure.representation.applyPreset(a,c,{theme:{globalName:"operator-name",carbonColor:"operator-name",focus:{name:"element-symbol",params:{carbonColor:{name:"operator-name",params:lG.defaultValues}}}}})}})()}),n$={default:Jbe,"all-models":m1t,unitcell:g1t,supercell:y1t,crystalContacts:b1t};class v1t{resolveProvider(t){var n;return"string"==typeof t?null!==(n=n$[t])&&void 0!==n?n:NU(this._providers,r=>r.id===t):t}hasPreset(t){for(const n of this._providers)if(!n.isApplicable||n.isApplicable(t,this.plugin))return!0;return!1}get providers(){return this._providers}getPresets(t){if(!t)return this.providers;const n=[];for(const r of this._providers)r.isApplicable&&!r.isApplicable(t,this.plugin)||n.push(r);return n}getPresetSelect(t){const n=[];for(const r of this._providers)t&&r.isApplicable&&!r.isApplicable(t,this.plugin)||n.push([r.id,r.display.name]);return I.Select("auto",n)}getPresetsWithOptions(t){const n=[],r=Object.create(null);for(const i of this._providers)i.isApplicable&&!i.isApplicable(t,this.plugin)||(n.push([i.id,i.display.name]),r[i.id]=i.params?I.Group(i.params(t,this.plugin)):I.EmptyGroup());return 0===n.length?I.MappedStatic("",{"":I.EmptyGroup()}):I.MappedStatic(n[0][0],r,{options:n})}registerPreset(t){if(this.providerMap.has(t.id))throw new Error(`Hierarchy provider with id '${t.id}' already registered.`);this._providers.push(t),this.providerMap.set(t.id,t)}unregisterPreset(t){this.providerMap.delete(t.id),p3(this._providers,t)}applyPreset(t,n,r){const i=this.resolveProvider(n);if(!i)return;const s=_a.resolveAndCheck(this.plugin.state.data,t);if(!s)return void(g3||console.warn("Applying hierarchy preset provider to bad cell."));const a=r||(i.params?I.getDefaultValues(i.params(s.obj,this.plugin)):{}),l=Ke.create(`${i.display.name}`,()=>i.apply(s,a,this.plugin));return this.plugin.runTask(l)}constructor(t){this.plugin=t,this._providers=[],this.providerMap=new Map,this.defaultProvider=n$.default,Nu(n$,n=>this.registerPreset(n))}}class x1t{get dataState(){return this.plugin.state.data}parseTrajectoryData(t,n){var r=this;return le(function*(){const i="string"==typeof n?r.plugin.dataFormats.get(n):n;if(!i)throw new Error(`'${n}' is not a supported data format.`);const{trajectory:o}=yield i.parse(r.plugin,t);return o})()}parseTrajectoryBlob(t,n){return this.dataState.build().to(t).apply(at.Data.ParseBlob,n,{state:{isGhost:!0}}).apply(at.Model.TrajectoryFromBlob,void 0).commit({revertOnError:!0})}parseTrajectory(t,n){const r=_a.resolveAndCheck(this.dataState,t);if(!r)throw new Error("Invalid data cell.");return Se.Data.Blob.is(r.obj)?this.parseTrajectoryBlob(t,n):this.parseTrajectoryData(t,n)}createModel(t,n,r){return this.dataState.build().to(t).apply(at.Model.ModelFromTrajectory,n||{modelIndex:0},{state:r}).commit({revertOnError:!0})}insertModelProperties(t,n,r){return this.dataState.build().to(t).apply(at.Model.CustomModelProperties,n,{state:r}).commit({revertOnError:!0})}tryCreateUnitcell(t,n,r){var i,o,s;const a=this.dataState,l=null===(o=null===(i=_a.resolveAndCheck(a,t))||void 0===i?void 0:i.obj)||void 0===o?void 0:o.data;if(!l)return;const c=null===(s=Vs.Provider.get(l))||void 0===s?void 0:s.spacegroup.cell;return Qc.isZero(c)?void 0:a.build().to(t).apply(at.Representation.ModelUnitcell3D,n,{state:r}).commit({revertOnError:!0})}createStructure(t,n,r,i){var o;const s=this.dataState;if(!n){const l=_a.resolveAndCheck(s,t);if(l){const c=Vs.Provider.get(null===(o=l.obj)||void 0===o?void 0:o.data);(!c||0===c?.assemblies.length)&&(n={name:"model",params:{}})}}return s.build().to(t).apply(at.Model.StructureFromModel,{type:n||{name:"assembly",params:{}}},{state:r,tags:i}).commit({revertOnError:!0})}insertStructureProperties(t,n){return this.dataState.build().to(t).apply(at.Model.CustomStructureProperties,n).commit({revertOnError:!0})}isComponentTransform(t){return t.transform.transformer===at.Model.StructureComponent}tryCreateComponent(t,n,r,i){var o=this;return le(function*(){var s,a;const l=o.dataState,c=l.build().to(t),u=`structure-component-${r}`,d=c.applyOrUpdateTagged(u,at.Model.StructureComponent,n,{tags:i?[...i,u]:[u]});yield d.commit();const f=d.selector;if(f.isOk&&0!==(null===(a=null===(s=f.cell)||void 0===s?void 0:s.obj)||void 0===a?void 0:a.data.elementCount))return f;yield l.build().delete(f.ref).commit()})()}tryCreateComponentFromExpression(t,n,r,i){return this.tryCreateComponent(t,{type:{name:"expression",params:n},nullIfEmpty:!0,label:(i?.label||"").trim()},r,i?.tags)}tryCreateComponentStatic(t,n,r){return this.tryCreateComponent(t,{type:{name:"static",params:n},nullIfEmpty:!0,label:(r?.label||"").trim()},`static-${n}`,r?.tags)}tryCreateComponentFromSelection(t,n,r,i){var o=this;return this.plugin.runTask(Ke.create("Query Component",function(){var s=le(function*(a){var l,c;let{label:u,tags:d}=i||{};u=(u||"").trim();const f=null===(c=null===(l=_a.resolveAndCheck(o.dataState,t))||void 0===l?void 0:l.obj)||void 0===c?void 0:c.data;if(!f)return;const p=n.referencesCurrent?{type:{name:"bundle",params:Qr.fromSelection(yield n.getSelection(o.plugin,a,f))},nullIfEmpty:!0,label:u||n.label}:{type:{name:"expression",params:n.expression},nullIfEmpty:!0,label:u||n.label};return n.ensureCustomProperties&&(yield n.ensureCustomProperties({runtime:a,assetManager:o.plugin.managers.asset},f)),o.tryCreateComponent(t,p,r,d)});return function(a){return s.apply(this,arguments)}}()))}constructor(t){this.plugin=t,this.hierarchy=new v1t(this.plugin),this.representation=new h1t(this.plugin)}}function UA(e,t,n={}){return"string"==typeof n.type||"string"==typeof n.color||"string"==typeof n.size?function _1t(e,t,n){const r=n.type&&e.representation.volume.registry.get(n.type)||e.representation.volume.registry.default.provider,i=n.color&&e.representation.volume.themes.colorThemeRegistry.get(n.color)||e.representation.volume.themes.colorThemeRegistry.get(r.defaultColorTheme.name),o=n.size&&e.representation.volume.themes.sizeThemeRegistry.get(n.size)||e.representation.volume.themes.sizeThemeRegistry.get(r.defaultSizeTheme.name);return n1e(e,t,{type:r,typeParams:n.typeParams,color:i,colorParams:n.colorParams,size:o,sizeParams:n.sizeParams})}(e,t||mt.One,n):n1e(e,t||mt.One,n)}function n1e(e,t,n={}){const{themes:r}=e.representation.volume,i={volume:t},o=n.type||e.representation.volume.registry.default.provider,s=I.getDefaultValues(o.getParams(r,t)),a=Object.assign(s,n.typeParams),l=n.color||r.colorThemeRegistry.get(o.defaultColorTheme.name),c=I.getDefaultValues(l.getParams(i));l.name===o.defaultColorTheme.name&&Object.assign(c,o.defaultColorTheme.props);const u=Object.assign(c,n.colorParams),d=n.size||r.sizeThemeRegistry.get(o.defaultSizeTheme.name),f=I.getDefaultValues(d.getParams(i));d.name===o.defaultSizeTheme.name&&Object.assign(f,o.defaultSizeTheme.props);const p=Object.assign(f,n.sizeParams);return{type:{name:o.name,params:a},colorTheme:{name:l.name,params:u},sizeTheme:{name:d.name,params:p}}}var r$,xO;!function(e){e.create=function t(n){const{name:r}=n;return{descriptor:n,get:i=>i._propertyData[r],set(i,o){i.customProperties.add(n),i._propertyData[r]=o}}}}(r$||(r$={})),function(e){e.Descriptor={name:"recommended_iso_value"},e.Provider=r$.create(e.Descriptor)}(xO||(xO={}));const zA="Volume";function zP(e,t){return i$.apply(this,arguments)}function i$(){return i$=le(function*(e,t){if(!t)return;const{entryId:n}=t;return n&&n.toLowerCase().startsWith("emd")?e.runTask(Ke.create("Try Set Recommended IsoValue",function(){var r=le(function*(i){try{const o=yield ige(e,i,n);xO.Provider.set(t,mt.IsoValue.absolute(o))}catch(o){console.warn(o)}});return function(i){return r.apply(this,arguments)}}())):void 0}),i$.apply(this,arguments)}function r1e(e){const t=xO.Provider.get(e);if(t)return"relative"===t.kind?t:mt.adjustedIsoValue(e,t.absoluteValue,"absolute")}function o$(e,t){return s$.apply(this,arguments)}function s$(){return s$=le(function*(e,t){const n={},r=t.volume.data&&r1e(t.volume.data);return r&&(n.isoValue=r),[yield e.build().to(t.volume).apply(at.Representation.VolumeRepresentation3D,UA(e,t.volume.data,{type:"isosurface",typeParams:n})).commit()]}),s$.apply(this,arguments)}const S1t={label:"CCP4/MRC/MAP",description:"CCP4/MRC/MAP",category:zA,binaryExtensions:["ccp4","mrc","map"],parse:function(){var e=le(function*(t,n,r){const i=t.build().to(n).apply(at.Data.ParseCcp4,{},{state:{isGhost:!0}}),o=i.apply(at.Volume.VolumeFromCcp4,{entryId:r?.entryId});return yield i.commit({revertOnError:!0}),yield zP(t,o.selector.data),{format:i.selector,volume:o.selector}});return function(n,r,i){return e.apply(this,arguments)}}(),visuals:o$},C1t={label:"DSN6/BRIX",description:"DSN6/BRIX",category:zA,binaryExtensions:["dsn6","brix"],parse:function(){var e=le(function*(t,n,r){const i=t.build().to(n).apply(at.Data.ParseDsn6,{},{state:{isGhost:!0}}),o=i.apply(at.Volume.VolumeFromDsn6,{entryId:r?.entryId});return yield i.commit({revertOnError:!0}),yield zP(t,o.selector.data),{format:i.selector,volume:o.selector}});return function(n,r,i){return e.apply(this,arguments)}}(),visuals:o$},w1t={label:"DX",description:"DX",category:zA,stringExtensions:["dx"],binaryExtensions:["dxbin"],parse:function(){var e=le(function*(t,n,r){const o=t.build().to(n).apply(at.Data.ParseDx,{},{state:{isGhost:!0}}).apply(at.Volume.VolumeFromDx,{entryId:r?.entryId});return yield o.commit({revertOnError:!0}),yield zP(t,o.selector.data),{volume:o.selector}});return function(n,r,i){return e.apply(this,arguments)}}(),visuals:o$},A1t={label:"Cube",description:"Cube",category:zA,stringExtensions:["cub","cube"],parse:function(){var e=le(function*(t,n,r){const i=t.build().to(n).apply(at.Data.ParseCube,{},{state:{isGhost:!0}}),o=i.apply(at.Volume.VolumeFromCube,{entryId:r?.entryId}),s=i.apply(at.Model.TrajectoryFromCube,void 0,{state:{isGhost:!0}}).apply(at.Model.ModelFromTrajectory).apply(at.Model.StructureFromModel);return yield i.commit({revertOnError:!0}),yield zP(t,o.selector.data),{format:i.selector,volume:o.selector,structure:s.selector}});return function(n,r,i){return e.apply(this,arguments)}}(),visuals:function(){var e=le(function*(t,n){var r,i;const o=t.build(),s=[],a=null===(i=null===(r=n.volume.cell)||void 0===r?void 0:r.obj)||void 0===i?void 0:i.data;if(a&&mt.isOrbitals(a)){const u=o.to(n.volume).apply(at.Representation.VolumeRepresentation3D,UA(t,a,{type:"isosurface",typeParams:{isoValue:mt.IsoValue.relative(1),alpha:.4},color:"uniform",colorParams:{value:qn.blue}})),d=o.to(n.volume).apply(at.Representation.VolumeRepresentation3D,UA(t,a,{type:"isosurface",typeParams:{isoValue:mt.IsoValue.relative(-1),alpha:.4},color:"uniform",colorParams:{value:qn.red}}));s.push(u.selector,d.selector)}else{const u=o.to(n.volume).apply(at.Representation.VolumeRepresentation3D,UA(t,a,{type:"isosurface",typeParams:{isoValue:mt.IsoValue.relative(2),alpha:.4},color:"uniform",colorParams:{value:qn.grey}}));s.push(u.selector)}const l=yield t.builders.structure.representation.applyPreset(n.structure,"auto");yield o.commit();const c=[];return Nu(l?.representations,u=>{u&&c.push(u)}),[...s,...c]});return function(n,r){return e.apply(this,arguments)}}()},I1t={label:"DensityServer CIF",description:"DensityServer CIF",category:zA,stringExtensions:["cif"],binaryExtensions:["bcif"],isApplicable:(e,t)=>"dscif"===oO(e,t),parse:function(){var e=le(function*(t,n,r){var i;const o=yield t.build().to(n).apply(at.Data.ParseCif).commit(),s=t.build().to(o),a=o.obj.data.blocks;if(0===a.length)throw new Error("no data blocks");const l=[];let c=0;for(const u of a){if("SERVER"===u.header.toUpperCase())continue;const d=Array.isArray(r?.entryId)?r?.entryId[c]:r?.entryId;(null===(i=u.categories.volume_data_3d_info)||void 0===i?void 0:i.rowCount)>0&&(l.push(s.apply(at.Volume.VolumeFromDensityServerCif,{blockHeader:u.header,entryId:d}).selector),c++)}yield s.commit();for(const u of l)yield zP(t,u.data);return{volumes:l}});return function(n,r,i){return e.apply(this,arguments)}}(),visuals:function(){var e=le(function*(t,n){const{volumes:r}=n,i=t.build(),o=[];if(r.length>0){const s=r[0].data&&r1e(r[0].data)||mt.IsoValue.relative(1.5);o[0]=i.to(r[0]).apply(at.Representation.VolumeRepresentation3D,Eg.getDefaultParamsStatic(t,"isosurface",{isoValue:s,alpha:1},"uniform",{value:qn.teal})).selector}if(r.length>1){const s=Eg.getDefaultParamsStatic(t,"isosurface",{isoValue:mt.IsoValue.relative(3),alpha:.3},"uniform",{value:qn.green}),a=Eg.getDefaultParamsStatic(t,"isosurface",{isoValue:mt.IsoValue.relative(-3),alpha:.3},"uniform",{value:qn.red});o[o.length]=i.to(r[1]).apply(at.Representation.VolumeRepresentation3D,s).selector,o[o.length]=i.to(r[1]).apply(at.Representation.VolumeRepresentation3D,a).selector}return yield i.commit(),o});return function(n,r){return e.apply(this,arguments)}}()},E1t={label:"Segmentation CIF",description:"Segmentation CIF",category:zA,stringExtensions:["cif"],binaryExtensions:["bcif"],isApplicable:(e,t)=>"segcif"===oO(e,t),parse:function(){var e=le(function*(t,n){var r;const i=yield t.build().to(n).apply(at.Data.ParseCif).commit(),o=t.build().to(i),s=i.obj.data.blocks;if(0===s.length)throw new Error("no data blocks");const a=[];for(const l of s)"SERVER"!==l.header.toUpperCase()&&(null===(r=l.categories.volume_data_3d_info)||void 0===r?void 0:r.rowCount)>0&&a.push(o.apply(at.Volume.VolumeFromSegmentationCif,{blockHeader:l.header}).selector);return yield o.commit(),{volumes:a}});return function(n,r){return e.apply(this,arguments)}}(),visuals:function(){var e=le(function*(t,n){const{volumes:r}=n,i=t.build(),o=[];return r.length>0&&mt.Segmentation.get(r[0].data)&&(o[o.length]=i.to(r[0]).apply(at.Representation.VolumeRepresentation3D,Eg.getDefaultParams(t,"segment",r[0].data,{alpha:1,instanceGranularity:!0},"volume-segment",{})).selector),yield i.commit(),o});return function(n,r){return e.apply(this,arguments)}}()},T1t=[["ccp4",S1t],["dsn6",C1t],["cube",A1t],["dx",w1t],["dscif",I1t],["segcif",E1t]],D1t=[["ply",{label:"PLY",description:"PLY",category:"Shape",stringExtensions:["ply"],parse:function(){var e=le(function*(t,n){const r=t.state.data.build().to(n).apply(at.Data.ParsePly,{},{state:{isGhost:!0}}),i=r.apply(at.Model.ShapeFromPly);return yield r.commit(),{format:r.selector,shape:i.selector}});return function(n,r){return e.apply(this,arguments)}}(),visuals:(e,t)=>e.state.data.build().to(t.shape).apply(at.Representation.ShapeRepresentation3D).commit()}]];class P1t{get types(){return this._list.map(t=>[t.name,t.provider.label])}get extensions(){if(this._extensions)return this._extensions;const t=new Set;return this._list.forEach(({provider:n})=>{var r,i;null===(r=n.stringExtensions)||void 0===r||r.forEach(o=>t.add(o)),null===(i=n.binaryExtensions)||void 0===i||i.forEach(o=>t.add(o))}),this._extensions=t,t}get binaryExtensions(){if(this._binaryExtensions)return this._binaryExtensions;const t=new Set;return this._list.forEach(({provider:n})=>{var r;return null===(r=n.binaryExtensions)||void 0===r?void 0:r.forEach(i=>t.add(i))}),this._binaryExtensions=t,t}get options(){if(this._options)return this._options;const t=[];return this._list.forEach(({name:n,provider:r})=>t.push([n,r.label,r.category||""])),this._options=t,t}constructor(){this._list=[],this._map=new Map,this._extensions=void 0,this._binaryExtensions=void 0,this._options=void 0;for(const[t,n]of T1t)this.add(t,n);for(const[t,n]of g0t)this.add(t,n);for(const[t,n]of _0t)this.add(t,n);for(const[t,n]of D1t)this.add(t,n);for(const[t,n]of _be)this.add(t,n)}_clear(){this._extensions=void 0,this._binaryExtensions=void 0,this._options=void 0}add(t,n){this._clear(),this._list.push({name:t,provider:n}),this._map.set(t,n)}remove(t){this._clear(),this._list.splice(this._list.findIndex(n=>n.name===t),1),this._map.delete(t)}auto(t,n){var r,i;for(let o=0,s=this.list.length;o[t.name,t.display.name]),{label:"Animation"})}),this._params}updateParams(t){if(this.isEmpty)return;this.updateState({params:{...this.state.params,...t}});const n=this.map.get(this.state.params.current),r=n.params(this.context);this._current={anim:n,params:r,paramValues:I.getDefaultValues(r),state:{},startedTime:-1,lastTime:0},this.triggerUpdate()}updateCurrentParams(t){this.isEmpty||(this._current.paramValues={...this._current.paramValues,...t},this.triggerUpdate())}register(t){this.map.has(t.name)?this.context.log.error(`Animation '${t.name}' is already registered.`):(this._params=void 0,this.map.set(t.name,t),this._animations.push(t),1===this._animations.length?this.updateParams({current:t.name}):this.triggerUpdate())}play(t,n){var r=this;return le(function*(){yield r.stop(),r.map.has(t.name)||r.register(t),r.updateParams({current:t.name}),r.updateCurrentParams(n),yield r.start()})()}tick(t,n,r){var i=this;return le(function*(){i.currentTime=t,!i.isStopped&&(n||r?yield i.applyFrame(r):i.applyAsync())})()}start(){var t=this;return le(function*(){t.updateState({animationState:"playing"}),t.context.behaviors.state.isAnimating.value||t.context.behaviors.state.isAnimating.next(!0),t.triggerUpdate();const n=t._current.anim;let r=t._current.anim.initialState(t._current.paramValues,t.context);if(n.setup){const i=yield n.setup(t._current.paramValues,r,t.context);i&&(r=i)}t._current.lastTime=0,t._current.startedTime=-1,t._current.state=r,t.isStopped=!1})()}stop(){var t=this;return le(function*(){if(t.isStopped=!0,"stopped"!==t.state.animationState){const n=t._current.anim;n.teardown&&(yield n.teardown(t._current.paramValues,t._current.state,t.context)),t.updateState({animationState:"stopped"}),t.triggerUpdate()}t.context.behaviors.state.isAnimating.value&&t.context.behaviors.state.isAnimating.next(!1)})()}get isAnimating(){return"playing"===this.state.animationState}applyAsync(){var t=this;return le(function*(){if(!t.isApplying){t.isApplying=!0;try{yield t.applyFrame()}finally{t.isApplying=!1}}})()}applyFrame(t){var n=this;return le(function*(){const r=n.currentTime;n._current.startedTime<0&&(n._current.startedTime=r);const i=yield n._current.anim.apply(n._current.state,{lastApplied:n._current.lastTime,current:r-n._current.startedTime,animation:t},{params:n._current.paramValues,plugin:n.context});"finished"===i.kind?n.stop():"next"===i.kind&&(n._current.state=i.state,n._current.lastTime=r-n._current.startedTime),n.triggerApply()})()}getSnapshot(){return this.current?{state:this.state,current:{paramValues:this._current.paramValues,state:this._current.anim.stateSerialization?this._current.anim.stateSerialization.toJSON(this._current.state):this._current.state}}:{state:this.state}}setSnapshot(t){this.isEmpty||(this.updateState({animationState:t.state.animationState}),this.updateParams(t.state.params),t.current&&(this.current.paramValues=t.current.paramValues,this.current.state=this._current.anim.stateSerialization?this._current.anim.stateSerialization.fromJSON(t.current.state):t.current.state,this.triggerUpdate(),"playing"===this.state.animationState&&this.resume()))}resume(){var t=this;return le(function*(){t._current.lastTime=0,t._current.startedTime=-1;const n=t._current.anim;t.context.behaviors.state.isAnimating.value||t.context.behaviors.state.isAnimating.next(!0),n.setup&&(yield n.setup(t._current.paramValues,t._current.state,t.context)),t.isStopped=!1})()}constructor(t){super({params:{current:""},animationState:"stopped"}),this.context=t,this.map=new Map,this._animations=[],this.currentTime=0,this._params=void 0,this.events={updated:this.ev(),applied:this.ev()},this.isStopped=!0,this.isApplying=!1}}function i1e(e,t,n){const r=n[0],i=n[1],o=n[2];return(r*e[0]+i*e[1]+o*e[2]+(-r*t[0]-i*t[1]-o*t[2]))/Math.sqrt(r*r+i*i+o*o)}const Og={identity:In.create(1,0,0,0,1,0,0,0,1),rotX90:In.create(1,0,0,0,0,1,0,-1,0),rotY90:In.create(0,0,-1,0,1,0,1,0,0),rotZ90:In.create(0,1,0,-1,0,0,0,0,1),rotX270:In.create(1,0,0,0,0,-1,0,1,0),rotY270:In.create(0,0,1,0,1,0,-1,0,0),rotZ270:In.create(0,-1,0,1,0,0,0,0,1),rotX180:In.create(1,0,0,0,-1,0,0,0,-1),rotY180:In.create(-1,0,0,0,1,0,0,0,-1),rotZ180:In.create(-1,0,0,0,-1,0,0,0,1)};function a$(e,t){const{onlyTrace:n,skipHydrogens:r,skipWater:i}=t,{x:o,y:s,z:a,type_symbol:l,label_comp_id:c}=Je.atom,u=[];for(const d of e){const f=dt.create(d);for(const p of d.units){f.unit=p;const m=n?p.polymerElements:p.elements;for(let h=0;hi,n)}focusLoci(t,n){let r;if(Array.isArray(t)&&t.length>1){const i=[];for(const o of t){const s=Yn.getBoundingSphere(this.transformedLoci(o));s&&i.push(s)}if(0===i.length)return;this.boundaryHelper.reset();for(const o of i)this.boundaryHelper.includeSphere(o);this.boundaryHelper.finishedIncludeStep();for(const o of i)this.boundaryHelper.radiusSphere(o);r=this.boundaryHelper.getSphere()}else if(Array.isArray(t)){if(0===t.length)return;r=Yn.getBoundingSphere(this.transformedLoci(t[0]))}else r=Yn.getBoundingSphere(this.transformedLoci(t));r&&this.focusSphere(r,n)}focusSpheres(t,n,r){const i=[];for(const o of t){const s=n(o);s&&i.push(s)}if(0!==i.length){if(1===i.length)return this.focusSphere(i[0],r);this.boundaryHelper.reset();for(const o of i)this.boundaryHelper.includeSphere(o);this.boundaryHelper.finishedIncludeStep();for(const o of i)this.boundaryHelper.radiusSphere(o);this.focusSphere(this.boundaryHelper.getSphere(),r)}}focusSphere(t,n){var r;const{canvas3d:i}=this.plugin;if(!i)return;const{extraRadius:o,minRadius:s,durationMs:a}={...q1t,...n},l=Math.max(t.radius+o,s);if(n?.principalAxes){const c=function F1t(e,t,n){if(!e.canvas3d)return;const{origin:r,dirA:i,dirB:o,dirC:s}=n.principalAxes.boxAxes,a=C.clone(i),l=C.clone(s);if(n.positionToFlip){const{aroundX:u,aroundY:d}=function R1t(e,t,n,r){const i=i1e(e,t,r);return{aroundX:i1e(e,t,n)<0,aroundY:i<0}}(n.positionToFlip,r,a,o);u&&(C.negate(l,l),C.negate(a,a)),d&&C.negate(l,l)}const c=C.scale(C(),r,-100);return C.dot(c,a)<=0&&C.negate(l,l),C.dot(C.unitY,l)<=0&&C.negate(a,a),e.canvas3d.camera.getFocus(r,t,a,l,Si.createDefaultSnapshot())}(this.plugin,l,n);null===(r=this.plugin.canvas3d)||void 0===r||r.requestCameraReset({durationMs:a,snapshot:c})}else{const c=i.camera.getFocus(t.center,l);i.requestCameraReset({durationMs:a,snapshot:c})}}orientAxes(t,n){if(!this.plugin.canvas3d)return;t||(t=this.plugin.state.data.selectQ(a=>a.ofType(Se.Molecule.Structure)).filter(a=>a.obj&&!a.transform.transformer.definition.isDecorator&&!a.obj.data.parent).map(a=>{var l;return null===(l=a.obj)||void 0===l?void 0:l.data}).filter(a=>!!a));const{rotation:r}=function B1t(e,t){const n=function j1t(e,t){let n;return n=a$(e,{onlyTrace:!0}),n.length>=3*t||(n=a$(e,{skipHydrogens:!0,skipWater:!0}),n.length>=3*t)||(n=a$(e,{})),n}(e,3);return function L1t(e,t){if(0===e.length)return console.warn("Skipping PCA, no atoms"),{rotation:Og.identity,origin:C.zero()};const n=Uh.calculateMomentsAxes(e),r=Uh.calculateNormalizedAxes(n),i=function H1t(e,t,n){const r=In();return In.setValue(r,0,0,e[0]),In.setValue(r,0,1,e[1]),In.setValue(r,0,2,e[2]),In.setValue(r,1,0,t[0]),In.setValue(r,1,1,t[1]),In.setValue(r,1,2,t[2]),In.setValue(r,2,0,n[0]),In.setValue(r,2,1,n[1]),In.setValue(r,2,2,n[2]),r}(r.dirA,r.dirB,r.dirC);!function G1t(e){In.determinant(e)<0&&(In.setValue(e,2,0,-In.getValue(e,2,0)),In.setValue(e,2,1,-In.getValue(e,2,1)),In.setValue(e,2,2,-In.getValue(e,2,2)))}(i);const o=t?function U1t(e,t){let n=Og.identity,r=0;const i=In();for(const o of[Og.identity,Og.rotX180,Og.rotY180,Og.rotZ180]){const s=In.innerProduct(In.mul(i,o,e),t);s>r&&(n=o,r=s)}return n}(i,t):function z1t(e,t,n){const r=C.create(In.getValue(t,0,0),In.getValue(t,0,1),In.getValue(t,0,2)),i=C.create(In.getValue(t,1,0),In.getValue(t,1,1),In.getValue(t,1,2)),o=C.create(In.getValue(t,2,0),In.getValue(t,2,1),In.getValue(t,2,2)),s=Math.floor(e.length/3),a=C();let l=0,c=0,u=0;for(let p=0;ps!==o)}normalizedLoci(o,s,a=!1){const{loci:l,repr:c}=o;return{loci:Yn.normalize(l,s?this.props.granularity:void 0,a),repr:c}}mark(o,s,a=!1){if(!Yn.isEmpty(o.loci))for(const l of this.providers)l(o,s,a)}dispose(){this.providers.length=0,this.sel.dispose()}constructor(o,s={}){this.ctx=o,this.providers=[],this.props=I.getDefaultValues(e.Params),this.sel=o.managers.structure.selection,this.setProps(s)}}e.LociMarkManager=t,e.LociHighlightManager=class n extends t{constructor(){super(...arguments),this.prev=[],this.clearHighlights=(o=!1)=>{for(const s of this.prev)this.mark(s,un.RemoveHighlight,o);this.prev.length=0}}isHighlighted(o){for(const s of this.prev)if(Xn.Loci.areEqual(s,o))return!0;return!1}addHighlight(o){this.mark(o,un.Highlight),this.prev.push(o)}highlight(o,s=!0){const a=this.normalizedLoci(o,s);this.isHighlighted(a)||this.addHighlight(a)}highlightOnly(o,s=!0){const a=this.normalizedLoci(o,s);this.isHighlighted(a)||(Yn.isEmpty(a.loci)?this.clearHighlights():(this.clearHighlights(!0),this.addHighlight(a)))}highlightOnlyExtend(o,s=!0){const a=this.normalizedLoci(o,s);if(Me.is(a.loci)){const l={loci:this.sel.tryGetRange(a.loci)||a.loci,repr:a.repr};this.isHighlighted(l)||(Yn.isEmpty(l.loci)?this.clearHighlights():(this.clearHighlights(!0),this.addHighlight(l)))}}dispose(){super.dispose(),this.prev.length=0}},e.LociSelectManager=class r extends t{toggle(o,s=!0){if(Yn.isEmpty(o.loci))return;const a=this.normalizedLoci(o,s,!0);Me.is(a.loci)?this.toggleSel(a):super.mark(a,un.Toggle)}toggleExtend(o,s=!0){if(Yn.isEmpty(o.loci))return;const a=this.normalizedLoci(o,s,!0);if(Me.is(a.loci)){const l=this.sel.tryGetRange(a.loci)||a.loci;this.toggleSel({loci:l,repr:a.repr})}}select(o,s=!0){const a=this.normalizedLoci(o,s,!0);Me.is(a.loci)&&this.sel.modify("add",a.loci),this.mark(a,un.Select)}selectJoin(o,s=!0){const a=this.normalizedLoci(o,s,!0);Me.is(a.loci)&&this.sel.modify("intersect",a.loci),this.mark(a,un.Select)}selectOnly(o,s=!0){const a=this.normalizedLoci(o,s,!0);Me.is(a.loci)&&(this.mark({loci:Xe.Loci(a.loci.structure),repr:a.repr},un.Deselect),this.sel.modify("set",a.loci)),this.mark(a,un.Select)}deselect(o,s=!0){const a=this.normalizedLoci(o,s,!0);Me.is(a.loci)&&this.sel.modify("remove",a.loci),this.mark(a,un.Deselect)}deselectAll(){this.sel.clear(),this.mark({loci:KN},un.Deselect)}deselectAllOnEmpty(o){uu(o.loci)&&this.deselectAll()}mark(o,s){const{loci:a}=o;if(!Yn.isEmpty(a))if(Me.is(a)){const l=this.sel.getLoci(a.structure);super.mark({loci:Xe.Loci(a.structure)},un.Deselect,!Yn.isEmpty(l)),super.mark({loci:l},un.Select)}else super.mark(o,s)}toggleSel(o){this.sel.has(o.loci)?(this.sel.modify("remove",o.loci),this.mark(o,un.Deselect)):(this.sel.modify("add",o.loci),this.mark(o,un.Select))}}}(eb||(eb={}));class $1t{clearProviders(){this.providers=[],this.isDirty=!0,this.showLabels()}addProvider(t){this.providers.push(t),this.providers.sort((n,r)=>(r.priority||0)-(n.priority||0)),this.isDirty=!0,this.showLabels()}removeProvider(t){this.providers=this.providers.filter(n=>n!==t),this.isDirty=!0,this.showLabels()}mark(t,n){const r=this.locis.findIndex(i=>Xn.Loci.areEqual(t,i));-1===r&&n===un.Highlight?(this.locis.push(t),this.isDirty=!0):-1!==r&&n===un.RemoveHighlight&&(h3(this.locis,r),this.isDirty=!0)}showLabels(){this.ctx.behaviors.labels.highlight.next({labels:this.getLabels()})}getLabels(){if(this.isDirty){this.groupedLabels.clear(),this.labels.length=0;for(const t of this.providers)for(const n of this.locis){if(Yn.isEmpty(n.loci))continue;const r=t.label(n.loci,n.repr);if(r){const i=t.group?t.group(r):r.toString(),o=this.groupedLabels.get(i);o?o.push(r):this.groupedLabels.set(i,[r])}}this.labels.length=0,this.groupedLabels.forEach((t,n)=>{const r=t.length,i=r>1&&t[0]!==t[1]?n:t[0];this.labels.push(1===r?i:`${i} || \xd7 ${r}`)}),this.isDirty=!1}return this.labels}constructor(t){this.ctx=t,this.providers=[],this.locis=[],this.isDirty=!1,this.labels=[],this.groupedLabels=new Map,t.managers.interactivity.lociHighlights.addProvider((n,r,i)=>{0!==this.providers.length&&(this.mark(n,r),i||this.showLabels())})}}const s1e="overpaint-controls";function a1e(e,t,n,r,i){return l$.apply(this,arguments)}function l$(){return l$=le(function*(e,t,n,r,i){yield function l1e(e,t,n){return u$.apply(this,arguments)}(e,t,function(){var o=le(function*(s,a,l){if(i&&i.length>0&&!i.includes(a.params.values.type.name))return;const c=a.obj.data.sourceData,u=yield r(c.root);if(Yn.isEmpty(u)||uu(u))return;const d={bundle:Qr.fromLoci(u),color:-1===n?st(0):n,clear:-1===n};if(l){const p=c1e([...l.params.values.layers,d],c);s.to(l).update(Ea.toBundle(p))}else{const f=c1e([d],c);s.to(a.transform.ref).apply(at.Representation.OverpaintStructureRepresentation3DFromBundle,Ea.toBundle(f),{tags:s1e})}});return function(s,a,l){return o.apply(this,arguments)}}())}),l$.apply(this,arguments)}function u$(){return u$=le(function*(e,t,n){const r=e.state.data,i=r.build();for(const o of t)for(const s of o.representations){const a=r.select(Qn.Generators.ofTransformer(at.Representation.OverpaintStructureRepresentation3DFromBundle,s.cell.transform.ref).withTag(s1e));yield n(i,s.cell,a[0])}return i.commit({doNotUpdateCurrent:!0})}),u$.apply(this,arguments)}function c1e(e,t){const n=Ea.ofBundle(e,t.root),r=Ea.merge(n);return Ea.filter(r,t)}const u1e="clipping-controls";function Y1t(e,t,n,r,i){return d$.apply(this,arguments)}function d$(){return d$=le(function*(e,t,n,r,i){yield function X1t(e,t,n){return f$.apply(this,arguments)}(e,t,function(){var o=le(function*(s,a,l){if(i&&i.length>0&&!i.includes(a.params.values.type.name))return;const c=a.obj.data.sourceData,u=yield r(c.root);if(Yn.isEmpty(u)||uu(u))return;const d={bundle:Qr.fromLoci(u),groups:n};if(l){const p=d1e([...l.params.values.layers,d],c);s.to(l).update(co.toBundle(p))}else{const f=d1e([d],c);s.to(a.transform.ref).apply(at.Representation.ClippingStructureRepresentation3DFromBundle,co.toBundle(f),{tags:u1e})}});return function(s,a,l){return o.apply(this,arguments)}}())}),d$.apply(this,arguments)}function f$(){return f$=le(function*(e,t,n){const r=e.state.data,i=r.build();for(const o of t)for(const s of o.representations){const a=r.select(Qn.Generators.ofTransformer(at.Representation.ClippingStructureRepresentation3DFromBundle,s.cell.transform.ref).withTag(u1e));yield n(i,s.cell,a[0])}return i.commit({doNotUpdateCurrent:!0})}),f$.apply(this,arguments)}function d1e(e,t){const n=co.ofBundle(e,t.root),r=co.merge(n);return co.filter(r,t)}const f1e="transparency-controls";function K1t(e,t,n,r,i){return p$.apply(this,arguments)}function p$(){return p$=le(function*(e,t,n,r,i){yield function p1e(e,t,n){return m$.apply(this,arguments)}(e,t,function(){var o=le(function*(s,a,l){if(i&&i.length>0&&!i.includes(a.params.values.type.name))return;const c=a.obj.data.sourceData,u=yield r(c.root);if(Yn.isEmpty(u)||uu(u))return;const d={bundle:Qr.fromLoci(u),value:n};if(l){const p=h1e([...l.params.values.layers,d],c);s.to(l).update(dc.toBundle(p))}else{const f=h1e([d],c);s.to(a.transform.ref).apply(at.Representation.TransparencyStructureRepresentation3DFromBundle,dc.toBundle(f),{tags:f1e})}});return function(s,a,l){return o.apply(this,arguments)}}())}),p$.apply(this,arguments)}function m$(){return m$=le(function*(e,t,n){const r=e.state.data,i=r.build();for(const o of t)for(const s of o.representations){const a=r.select(Qn.Generators.ofTransformer(at.Representation.TransparencyStructureRepresentation3DFromBundle,s.cell.transform.ref).withTag(f1e));yield n(i,s.cell,a[0])}return i.commit({doNotUpdateCurrent:!0})}),m$.apply(this,arguments)}function h1e(e,t){const n=dc.ofBundle(e,t.root),r=dc.merge(n);return dc.filter(r,t)}const m1e="substance-controls";function g1e(e,t,n,r,i){return g$.apply(this,arguments)}function g$(){return g$=le(function*(e,t,n,r,i){yield function y1e(e,t,n){return b$.apply(this,arguments)}(e,t,function(){var o=le(function*(s,a,l){if(i&&i.length>0&&!i.includes(a.params.values.type.name))return;const c=a.obj.data.sourceData,u=yield r(c.root);if(Yn.isEmpty(u)||uu(u))return;const d={bundle:Qr.fromLoci(u),material:n??tu(),clear:!n};if(l){const p=b1e([...l.params.values.layers,d],c);s.to(l).update(fc.toBundle(p))}else{const f=b1e([d],c);s.to(a.transform.ref).apply(at.Representation.SubstanceStructureRepresentation3DFromBundle,fc.toBundle(f),{tags:m1e})}});return function(s,a,l){return o.apply(this,arguments)}}())}),g$.apply(this,arguments)}function b$(){return b$=le(function*(e,t,n){const r=e.state.data,i=r.build();for(const o of t)for(const s of o.representations){const a=r.select(Qn.Generators.ofTransformer(at.Representation.SubstanceStructureRepresentation3DFromBundle,s.cell.transform.ref).withTag(m1e));yield n(i,s.cell,a[0])}return i.commit({doNotUpdateCurrent:!0})}),b$.apply(this,arguments)}function b1e(e,t){const n=fc.ofBundle(e,t.root),r=fc.merge(n);return fc.filter(r,t)}class Bg extends zy{get currentStructures(){return this.plugin.managers.structure.hierarchy.selection.structures}get pivotStructure(){return this.currentStructures[0]}_setSnapshotState(t){this.updateState({options:t}),this.events.optionsUpdated.next(void 0)}setOptions(t){var n=this;return le(function*(){const r=t.interactions!==n.state.options.interactions;n.updateState({options:t}),n.events.optionsUpdated.next(void 0);const i=n.dataState.build();for(const o of n.currentStructures)for(const s of o.components)n.updateReprParams(i,s);return n.plugin.dataTransaction(le(function*(){yield i.commit(),yield n.plugin.state.updateBehavior(iO,o=>{o.ignoreHydrogens="all"!==t.hydrogens,o.ignoreHydrogensVariant="only-polar"===t.hydrogens?"non-polar":"all",o.ignoreLight=t.ignoreLight,o.material=t.materialStyle,o.clip=t.clipObjects}),r&&(yield n.updateInterationProps())}))})()}updateReprParams(t,n){const{hydrogens:r,visualQuality:i,ignoreLight:o,materialStyle:s,clipObjects:a}=this.state.options,l="all"!==r,c="only-polar"===r?"non-polar":"all";for(const u of n.representations){if(u.cell.transform.transformer!==hF)continue;const d=u.cell.transform.params;(!!d.type.params.ignoreHydrogens!==l||d.type.params.ignoreHydrogensVariant!==c||d.type.params.quality!==i||d.type.params.ignoreLight!==o||!l3(d.type.params.material,s)||!I.areEqual(H1.Params,d.type.params.clip,a))&&t.to(u.cell).update(f=>{f.type.params.ignoreHydrogens=l,f.type.params.ignoreHydrogensVariant=c,f.type.params.quality=i,f.type.params.ignoreLight=o,f.type.params.material=s,f.type.params.clip=a})}}updateInterationProps(){var t=this;return le(function*(){var n,r,i;for(const o of t.currentStructures){const s=ks.getParams(null===(n=o.cell.obj)||void 0===n?void 0:n.data);if(o.properties){const a=null===(r=o.properties.cell.transform.params)||void 0===r?void 0:r.properties[ks.descriptor.name];if(I.areEqual(s,a,t.state.options.interactions))continue;yield t.dataState.build().to(o.properties.cell).update(l=>{l.properties[ks.descriptor.name]=t.state.options.interactions}).commit()}else{const a=t.plugin.customStructureProperties.getParams(null===(i=o.cell.obj)||void 0===i?void 0:i.data),l=I.getDefaultValues(a);if(I.areEqual(s,l.properties[ks.descriptor.name],t.state.options.interactions))continue;l.properties[ks.descriptor.name]=t.state.options.interactions,yield t.plugin.builders.structure.insertStructureProperties(o.cell,l)}}})()}applyPreset(t,n,r){var i=this;return this.plugin.dataTransaction(le(function*(){for(const o of t){const s=yield i.plugin.builders.structure.representation.applyPreset(o.cell,n,r);yield i.syncPreset(o,s)}}),{canUndo:"Preset"})}syncPreset(t,n){if(!n||!n.components)return this.clearComponents([t]);const r=new Set;if(Nu(n.components,a=>{a&&r.add(a.ref)}),n.representations&&Nu(n.representations,a=>{a&&r.add(a.ref)}),0===r.size)return this.clearComponents([t]);let i=!1;const o=this.dataState.build(),s=a=>{r.has(a.cell.transform.ref)||(i=!0,o.delete(a.cell))};for(const a of t.components){s(a);for(const l of a.representations)s(l);if(a.genericRepresentations)for(const l of a.genericRepresentations)s(l)}if(t.genericRepresentations)for(const a of t.genericRepresentations)s(a);return i?o.commit():void 0}clear(t){return this.clearComponents(t)}selectThis(t){var n;const r=this.plugin.managers.structure.selection;r.clear();for(const i of t){const o=Xe.toSubStructureElementLoci(i.structure.cell.obj.data,null===(n=i.cell.obj)||void 0===n?void 0:n.data);r.fromLoci("set",o)}}canBeModified(t){return this.plugin.builders.structure.isComponentTransform(t.cell)}modifyByCurrentSelection(t,n){var r=this;return this.plugin.runTask(Ke.create("Modify Component",function(){var i=le(function*(o){const s=r.dataState.build();for(const a of t){if(!r.canBeModified(a))continue;const l=r.plugin.managers.structure.selection.getStructure(a.structure.cell.obj.data);!l||0===l.elementCount||r.modifyComponent(s,a,l,n)}yield r.dataState.updateTree(s,{canUndo:"Modify Selection"}).runInContext(o)});return function(o){return i.apply(this,arguments)}}()))}toggleVisibility(t,n){if(0!==t.length)if(n){const r=t[0].representations.indexOf(n),i=!n.cell.state.isHidden;for(const o of t){const s=o.representations[r];s&&G_(this.dataState,s.cell.transform.ref,i)}}else{const r=!t[0].cell.state.isHidden;for(const i of t)G_(this.dataState,i.cell.transform.ref,r)}}removeRepresentations(t,n){if(0===t.length)return;const r=[];if(n){const i=t[0].representations.indexOf(n);if(i<0)return;for(const o of t)o.representations[i]&&r.push(o.representations[i])}else for(const i of t)for(const o of i.representations)r.push(o);return this.plugin.managers.structure.hierarchy.remove(r,!0)}updateRepresentations(t,n,r){if(0===t.length)return Promise.resolve();const i=t[0].representations.indexOf(n);if(i<0)return Promise.resolve();const o=this.dataState.build();for(const s of t){const a=s.representations[i];a&&a.cell.transform.transformer===n.cell.transform.transformer&&o.to(a.cell).update(r)}return o.commit({canUndo:"Update Representation"})}updateRepresentationsTheme(t,n){var r,i,o,s;if(0===t.length)return;const a=this.dataState.build();for(const l of t)for(const c of l.representations){const u=c.cell.transform.params,d="function"==typeof n?n(l,c):n,f="default"===d.color?TW(this.plugin,null===(r=l.structure.cell.obj)||void 0===r?void 0:r.data,u?.type.name):d.color?TW(this.plugin,null===(i=l.structure.cell.obj)||void 0===i?void 0:i.data,u?.type.name,d.color,d.colorParams):void 0,p="default"===d.size?pbe(this.plugin,null===(o=l.structure.cell.obj)||void 0===o?void 0:o.data,u?.type.name):d.color?pbe(this.plugin,null===(s=l.structure.cell.obj)||void 0===s?void 0:s.data,u?.type.name,d.size,d.sizeParams):void 0;(f||p)&&a.to(c.cell).update(m=>{f&&(m.colorTheme=f),p&&(m.sizeTheme=p)})}return a.commit({canUndo:"Update Theme"})}addRepresentation(t,n){var r=this;if(0===t.length)return;const{hydrogens:i,visualQuality:o,ignoreLight:s,materialStyle:a,clipObjects:l}=this.state.options,d={ignoreHydrogens:"all"!==i,ignoreHydrogensVariant:"only-polar"===i?"non-polar":"all",quality:o,ignoreLight:s,material:a,clip:l};return this.plugin.dataTransaction(le(function*(){for(const f of t)yield r.plugin.builders.structure.representation.addRepresentation(f.cell,{type:r.plugin.representation.structure.registry.get(n),typeParams:d})}),{canUndo:"Add Representation"})}tryFindComponent(t,n){var r=this;if(0!==t.components.length)return this.plugin.runTask(Ke.create("Find Component",function(){var i=le(function*(o){var s,a;const l=null===(s=t.cell.obj)||void 0===s?void 0:s.data;if(!l)return;const c=Dt.unionStructure(yield n.getSelection(r.plugin,o,l));for(const u of t.components){const d=null===(a=u.cell.obj)||void 0===a?void 0:a.data;if(d&&u.cell.parent&&Uje(c,d))return u.cell}});return function(o){return i.apply(this,arguments)}}()))}add(t,n){var r=this;return le(function*(){return r.plugin.dataTransaction(le(function*(){const i=n||r.currentStructures;if(0===i.length)return;const{hydrogens:o,visualQuality:s,ignoreLight:a,materialStyle:l,clipObjects:c}=r.state.options,f={ignoreHydrogens:"all"!==o,ignoreHydrogensVariant:"only-polar"===o?"non-polar":"all",quality:s,ignoreLight:a,material:l,clip:c},p=oo.create22();for(const m of i){let h;t.options.checkExisting&&(h=yield r.tryFindComponent(m,t.selection)),h||(h=yield r.plugin.builders.structure.tryCreateComponentFromSelection(m.cell,t.selection,p,{label:t.options.label||(t.selection===Ps.current?"Custom Selection":"")})),"none"!==t.representation&&h&&(yield r.plugin.builders.structure.representation.addRepresentation(h,{type:r.plugin.representation.structure.registry.get(t.representation),typeParams:f}))}}),{canUndo:"Add Selection"})})()}applyTheme(t,n){var r=this;return le(function*(){return r.plugin.dataTransaction(function(){var i=le(function*(o){const s=n||r.currentStructures;if(0===s.length)return;const a=function(){var l=le(function*(c){return Dt.toLociWithSourceUnits(yield t.selection.getSelection(r.plugin,o,c))});return function(u){return l.apply(this,arguments)}}();for(const l of s)if("color"===t.action.name){const c=t.action.params;yield a1e(r.plugin,l.components,c.color,a,t.representations)}else if("resetColor"===t.action.name)yield a1e(r.plugin,l.components,-1,a,t.representations);else if("transparency"===t.action.name){const c=t.action.params;yield K1t(r.plugin,l.components,c.value,a,t.representations)}else if("material"===t.action.name){const c=t.action.params;yield g1e(r.plugin,l.components,c.material,a,t.representations)}else if("resetMaterial"===t.action.name)yield g1e(r.plugin,l.components,void 0,a,t.representations);else if("clipping"===t.action.name){const c=t.action.params;yield Y1t(r.plugin,l.components,co.Groups.fromNames(c.excludeGroups),a,t.representations)}});return function(o){return i.apply(this,arguments)}}(),{canUndo:"Apply Theme"})})()}modifyComponent(t,n,r,i){var o,s,a;const l=null===(o=n.cell.obj)||void 0===o?void 0:o.data;if(!l||("subtract"===i||"intersect"===i)&&!d5(l,r))return;const c=null===(s=n.structure.cell.obj)||void 0===s?void 0:s.data,u="union"===i?R3(c,[l,r]):"intersect"===i?sae(l,r):_z(l,r);if(0===u.elementCount)t.delete(n.cell.transform.ref);else{const f={type:{name:"bundle",params:Qr.fromSubStructure(c,u)},nullIfEmpty:!0,label:null===(a=n.cell.obj)||void 0===a?void 0:a.label};t.to(n.cell).update(f)}}updateLabel(t,n){var r,i;const o={type:null===(r=t.cell.params)||void 0===r?void 0:r.values.type,nullIfEmpty:null===(i=t.cell.params)||void 0===i?void 0:i.values.nullIfEmpty,label:n};this.dataState.build().to(t.cell).update(o).commit()}get dataState(){return this.plugin.state.data}clearComponents(t){const n=this.dataState.build();for(const r of t)for(const i of r.components)n.delete(i.cell.transform.ref);return n.commit({canUndo:"Clear Selections"})}constructor(t){super({options:I.getDefaultValues(Bg.OptionsParams)}),this.plugin=t,this.events={optionsUpdated:this.ev()}}}!function(e){function r(o,s){var a,l;return null!==(a=s?.cell.obj)&&void 0!==a&&a.data?o.representation.structure.registry.getApplicableTypes(null===(l=s.cell.obj)||void 0===l?void 0:l.data):o.representation.structure.registry.types}function i(o,s,a,l){const c=[...a,...r(o,s)];return I.Select(c[0][0],c,{label:l})}e.OptionsParams={hydrogens:I.Select("all",[["all","Show All"],["hide-all","Hide All"],["only-polar","Only Polar"]],{description:"Determine display of hydrogen atoms in representations"}),visualQuality:I.Select("auto",D9,{description:"Control the visual/rendering quality of representations"}),ignoreLight:I.Boolean(!1,{description:"Ignore light for stylized rendering of representations"}),materialStyle:tu.getParam(),clipObjects:I.Group(H1.Params),interactions:I.Group(ks.defaultParams,{label:"Non-covalent Interactions"})},e.getAddParams=function t(o,s){const{options:a}=o.query.structure.registry;return s={pivot:o.managers.structure.component.pivotStructure,allowNone:!0,hideSelection:!1,checkExisting:!1,...s},{selection:I.Select(a[1][0],a,{isHidden:s?.hideSelection}),representation:i(o,s?.pivot,s?.allowNone?[["none","< Create Later >"]]:[]),options:I.Group({label:I.Text(""),checkExisting:I.Boolean(!!s?.checkExisting,{help:()=>({description:"Checks if a selection with the specifield elements already exists to avoid creating duplicate components."})})})}},e.getThemeParams=function n(o,s){const{options:a}=o.query.structure.registry;return{selection:I.Select(a[1][0],a,{isHidden:!1}),action:I.MappedStatic("color",{color:I.Group({color:I.Color(qn.blue,{isExpanded:!0})},{isFlat:!0}),resetColor:I.EmptyGroup({label:"Reset Color"}),transparency:I.Group({value:I.Numeric(.5,{min:0,max:1,step:.01})},{isFlat:!0}),material:I.Group({material:tu.getParam({isFlat:!0})},{isFlat:!0}),resetMaterial:I.EmptyGroup({label:"Reset Material"}),clipping:I.Group({excludeGroups:I.MultiSelect([],I.objectToOptions(co.Groups.Names))},{isFlat:!0})}),representations:I.MultiSelect([],r(o,s),{emptyValue:"All"})}},e.getRepresentationTypes=r}(Bg||(Bg={}));class Q1t extends zy{get current(){return this.state.current}get history(){return this.state.history}tryAddHistory(t){if(Me.isEmpty(t.loci))return;let r,n=0;for(const i of this.state.history){if(Me.areEqual(i.loci,t.loci)){r=i;break}n++}if(r)return h3(this.state.history,n),this.state.history.unshift(t),void this.events.historyUpdated.next(void 0);this.state.history.unshift(t),this.state.history.length>8&&this.state.history.pop(),this.events.historyUpdated.next(void 0)}set(t){this.tryAddHistory(t),(!this.state.current||!Me.areEqual(this.state.current.loci,t.loci))&&(this.state.current=t,this.behaviors.current.next(t))}setFromLoci(t){const n=Yn.normalize(t);Me.is(n)&&!Me.isEmpty(n)?this.set({loci:n,label:L_(n,{reverse:!0,hidePrefix:!0,htmlStyling:!1})}):this.clear()}addFromLoci(t){const n=this.state.current&&Me.is(t)&&t.structure===this.state.current.loci.structure?Me.union(t,this.state.current.loci):t;this.setFromLoci(n)}clear(){this.state.current&&(this.state.current=void 0,this.behaviors.current.next(void 0))}getSnapshot(){if(!this.current)return{};const t=this.plugin.helpers.substructureParent.get(this.current.loci.structure),n=t?.transform.ref;return n?{current:{label:this.current.label,ref:n,bundle:Qr.fromLoci(this.current.loci),category:this.current.category}}:{}}setSnapshot(t){var n,r;if(!t.current)return void this.clear();const{label:i,ref:o,bundle:s,category:a}=t.current,l=null===(r=null===(n=this.plugin.state.data.select(Qn.Generators.byRef(o))[0])||void 0===n?void 0:n.obj)||void 0===r?void 0:r.data;if(!l)return;const c=Qr.toLoci(s,l);this.set({label:i,loci:c,category:a})}constructor(t){super({history:[]}),this.plugin=t,this.events={historyUpdated:this.ev()},this.behaviors={current:this.ev.behavior(void 0)},t.state.data.events.object.removed.subscribe(({obj:r})=>{var i;if(!Se.Molecule.Structure.is(r))return;(null===(i=this.current)||void 0===i?void 0:i.loci.structure)===r.data&&this.clear();const o=[];for(const s of this.history)s.loci.structure===r.data&&o.push(s);o.length!==this.history.length&&(this.history.length=0,this.history.push(...o),this.events.historyUpdated.next(void 0))});const n=ke();t.state.data.events.object.updated.subscribe(({oldData:r,obj:i,action:o})=>{var s;if(Se.Molecule.Structure.is(i)&&r!==i.data&&"in-place"===o){const a=this.state.current;if(a&&a.loci.structure===r){const c=Me.remap(a.loci,i.data);this.state.current={...a,loci:c},this.behaviors.current.next(this.state.current),Yn.getBoundingSphere(c,n);const u=null===(s=this.plugin.canvas3d)||void 0===s?void 0:s.camera,d=u.getTargetDistance(n.radius+4);(C.distance(u.target,n.center)>n.radius||d>u.viewport.height/u.zoom)&&this.plugin.managers.camera.focusSphere(n,{durationMs:0})}}})}}function v$(){return{trajectories:[],models:[],structures:[],refs:new Map}}function evt(e){return{kind:"trajectory",cell:e,version:e.transform.version,models:[]}}function v1e(e,t){return{kind:"model",cell:e,version:e.transform.version,trajectory:t,structures:[]}}function tvt(e,t){return{kind:"model-properties",cell:e,version:e.transform.version,model:t}}function nvt(e,t){return{kind:"model-unitcell",cell:e,version:e.transform.version,model:t}}function x1e(e,t){return{kind:"structure",cell:e,version:e.transform.version,model:t,components:[]}}function rvt(e,t){return{kind:"structure-properties",cell:e,version:e.transform.version,structure:t}}function ivt(e,t){return{kind:"structure-transform",cell:e,version:e.transform.version,structure:t}}function ovt(e,t){return{kind:"structure-volume-streaming",cell:e,version:e.transform.version,structure:t}}function svt(e){return e.transform.tags?[...e.transform.tags].sort().join():e.transform.ref}function avt(e,t){return{kind:"structure-component",cell:e,version:e.transform.version,structure:t,key:svt(e),representations:[]}}function lvt(e,t){return{kind:"structure-representation",cell:e,version:e.transform.version,component:t}}function cvt(e,t){return{kind:"generic-representation",cell:e,version:e.transform.version,parent:t}}function VA(e,t,n,r,...i){const o=r(...i);n.push(o),e.hierarchy.refs.set(t.transform.ref,o);const s=e.oldHierarchy.refs.get(t.transform.ref);return s?s.version!==t.transform.version&&(e.changed=!0):(e.added.add(o.cell.transform.ref),e.changed=!0),o}function p2(e,t,n,...r){const i=n(...r);e.hierarchy.refs.set(t.transform.ref,i);const o=e.oldHierarchy.refs.get(t.transform.ref);return o?o.version!==t.transform.version&&(e.changed=!0):(e.added.add(i.cell.transform.ref),e.changed=!0),i}function _1e(e){return t=>e.is(t.obj)}function S1e(e,t){return(n,r)=>!t(r)&&e.is(n.obj)}function _O(e){return t=>t.transform.transformer===e}function h2(){}const dvt=[[_1e(Se.Molecule.Trajectory),(e,t)=>{e.currentTrajectory=VA(e,t,e.hierarchy.trajectories,evt,t)},e=>e.currentTrajectory=void 0],[S1e(Se.Molecule.Model,e=>e.currentModel),(e,t)=>{e.currentModel=e.currentTrajectory?VA(e,t,e.currentTrajectory.models,v1e,t,e.currentTrajectory):p2(e,t,v1e,t),e.hierarchy.models.push(e.currentModel)},e=>e.currentModel=void 0],[_O(at.Model.CustomModelProperties),(e,t)=>{if(!e.currentModel)return!1;e.currentModel.properties=p2(e,t,tvt,t,e.currentModel)},h2],[_O(at.Representation.ModelUnitcell3D),(e,t)=>{if(!e.currentModel)return!1;e.currentModel.unitcell=p2(e,t,nvt,t,e.currentModel)},h2],[S1e(Se.Molecule.Structure,e=>e.currentStructure),(e,t)=>{e.currentStructure=e.currentModel?VA(e,t,e.currentModel.structures,x1e,t,e.currentModel):p2(e,t,x1e,t),e.hierarchy.structures.push(e.currentStructure)},e=>e.currentStructure=void 0],[_O(at.Model.CustomStructureProperties),(e,t)=>{if(!e.currentStructure)return!1;e.currentStructure.properties=p2(e,t,rvt,t,e.currentStructure)},h2],[_O(at.Model.TransformStructureConformation),(e,t)=>{if(!e.currentStructure)return!1;e.currentStructure.transform=p2(e,t,ivt,t,e.currentStructure)},h2],[_1e(fu),(e,t)=>(e.currentStructure&&(e.currentStructure.volumeStreaming=p2(e,t,ovt,t,e.currentStructure)),!1),h2],[(e,t)=>!(t.currentComponent||!t.currentStructure||e.transform.transformer.definition.isDecorator)&&Se.Molecule.Structure.is(e.obj),(e,t)=>{e.currentStructure&&(e.currentComponent=VA(e,t,e.currentStructure.components,avt,t,e.currentStructure))},e=>e.currentComponent=void 0],[(e,t)=>!e.state.isGhost&&!!t.currentComponent&&Se.Molecule.Structure.Representation3D.is(e.obj),(e,t)=>(e.currentComponent&&VA(e,t,e.currentComponent.representations,lvt,t,e.currentComponent),!1),h2],[e=>!e.state.isGhost&&Se.isRepresentation3D(e.obj),(e,t)=>{const n=e.currentComponent||e.currentStructure||e.currentModel;n&&(n.genericRepresentations||(n.genericRepresentations=[]),VA(e,t,n.genericRepresentations,cvt,t,n))},h2]];function C1e(e){if(!e||!e?.parent||!e.parent.cells.has(e.transform.ref))return!1;const{obj:t}=e;return!(!t||t===vo.Null||"ok"!==e.status&&"error"!==e.status)}function fvt(e){const{cell:t}=e;C1e(t)||(this.changed=!0)}function pvt(e){w1e(this,this.tree.transforms.get(e))}function w1e(e,t){const{state:n}=e,r=n.state.cells.get(t.ref);if(!C1e(r))return;let i,o=!1;for(const[a,l,c]of dvt)if(a(r,n)){if(!1===l(n,r)){o=!0;break}i=c;break}if(o)return;const s=e.tree.children.get(t.ref);s&&s.size&&s.forEach(pvt,e),i&&i(n)}class m2 extends wP{get dataState(){return this.plugin.state.data}get currentComponentGroups(){return this._currentComponentGroups||(this._currentComponentGroups=m2.getComponentGroups(this.selection.structures)),this._currentComponentGroups}get seletionSet(){if(this._currentSelectionSet)return this._currentSelectionSet;this._currentSelectionSet=new Set;for(const t of this.selection.trajectories)this._currentSelectionSet.add(t.cell.transform.ref);for(const t of this.selection.models)this._currentSelectionSet.add(t.cell.transform.ref);for(const t of this.selection.structures)this._currentSelectionSet.add(t.cell.transform.ref);return this._currentSelectionSet}get current(){return this.sync(!1),this.state.hierarchy}get selection(){return this.sync(!1),this.state.selection}getStructuresWithSelection(){const t=this.plugin.managers.structure.hierarchy.current.structures,n=[];for(const r of t)this.plugin.managers.structure.selection.structureHasSelection(r)&&n.push(r);return n}findStructure(t){if(!t)return;const n=this.plugin.helpers.substructureParent.get(t);if(!n)return;const r=this.plugin.state.data.selectQ(i=>i.byValue(n).rootOfType(Se.Molecule.Structure))[0];return r?this.behaviors.selection.value.structures.find(i=>i.cell===r):void 0}syncCurrent(t,n){const r=this.seletionSet,i=[];for(const o of t){const s=o.cell.transform.ref;(r.has(s)||n.has(s))&&i.push(o)}return 0===i.length?t.length>0?[t[0]]:[]:i}sync(t){if(!t&&this.dataState.inUpdate)return;if(this.state.syncedTree===this.dataState.tree)return void(t&&!this.state.notified&&(this.state.notified=!0,this.behaviors.selection.next({hierarchy:this.state.hierarchy,...this.state.selection})));this.state.syncedTree=this.dataState.tree;const n=function J1t(e,t){const n=function uvt(e,t){return{state:e,oldHierarchy:t,hierarchy:v$(),changed:!1,added:new Set}}(e,t||v$());return function hvt(e,t){w1e({tree:e,state:t},e.root)}(e.tree,n),t&&t.refs.forEach(fvt,n),{hierarchy:n.hierarchy,added:n.added,changed:n.changed}}(this.plugin.state.data,this.current);if(!n.changed)return;const{hierarchy:r}=n,i=this.syncCurrent(r.trajectories,n.added),o=this.syncCurrent(r.models,n.added),s=this.syncCurrent(r.structures,n.added);this._currentComponentGroups=void 0,this._currentSelectionSet=void 0,this.state.hierarchy=r,this.state.selection.trajectories=i,this.state.selection.models=o,this.state.selection.structures=s,t?(this.state.notified=!0,this.behaviors.selection.next({hierarchy:r,trajectories:i,models:o,structures:s})):this.state.notified=!1}updateCurrent(t,n){const r=this.current,i="add"===n?Lo.union(this.seletionSet,new Set(t.map(l=>l.cell.transform.ref))):Lo.difference(this.seletionSet,new Set(t.map(l=>l.cell.transform.ref))),o=[],s=[],a=[];for(const l of r.trajectories)i.has(l.cell.transform.ref)&&o.push(l);for(const l of r.models)i.has(l.cell.transform.ref)&&s.push(l);for(const l of r.structures)i.has(l.cell.transform.ref)&&a.push(l);this._currentComponentGroups=void 0,this._currentSelectionSet=void 0,this.state.selection.trajectories=o,this.state.selection.models=s,this.state.selection.structures=a,this.behaviors.selection.next({hierarchy:r,trajectories:o,models:s,structures:a})}remove(t,n){if(0===t.length)return;const r=this.plugin.state.data.build();for(const i of t)r.delete("string"==typeof i?i:i.cell.transform.ref);return r.commit({canUndo:!!n&&"Remove"})}toggleVisibility(t,n){if(0===t.length)return;const r=void 0!==n?"show"!==n:!t[0].cell.state.isHidden;for(const i of t)G_(this.dataState,i.cell.transform.ref,r)}applyPreset(t,n,r){var i=this;return this.plugin.dataTransaction(le(function*(){for(const o of t)o.models.length>0&&(yield i.clearTrajectory(o)),yield i.plugin.builders.structure.hierarchy.applyPreset(o.cell,n,r)}))}updateStructure(t,n){var r=this;return le(function*(){yield r.plugin.dataTransaction(le(function*(){const i=la.getDecoratorRoot(r.dataState.tree,t.cell.transform.ref),o=r.dataState.tree.children.get(i).toArray();yield r.remove(o,!1),yield r.plugin.state.updateTransform(r.plugin.state.data,t.cell.transform.ref,n,"Structure Type"),yield r.plugin.builders.structure.representation.applyPreset(t.cell.transform.ref,"auto")}),{canUndo:"Structure Type"}),jt.Camera.Reset(r.plugin)})()}clearTrajectory(t){const n=this.dataState.build();for(const r of t.models)n.delete(r.cell);return n.commit()}constructor(t){super(),this.plugin=t,this.state={syncedTree:this.dataState.tree,notified:!1,hierarchy:v$(),selection:{trajectories:[],models:[],structures:[]}},this.behaviors={selection:this.ev.behavior({hierarchy:this.current,trajectories:this.selection.trajectories,models:this.selection.models,structures:this.selection.structures})},this._currentComponentGroups=void 0,this._currentSelectionSet=void 0,this.subscribe(t.state.data.events.changed,n=>{n.inTransaction||t.behaviors.state.isAnimating.value||this.sync(!0)}),this.subscribe(t.behaviors.state.isAnimating,n=>{!n&&!t.behaviors.state.isUpdating.value&&this.sync(!0)})}}!function(e){e.getComponentGroups=function t(r){if(!r.length)return[];if(1===r.length)return r[0].components.map(s=>[s]);const i=[],o=new Map;for(const s of r)for(const a of s.components){const l=a.key;if(!l)continue;let c=o.get(l);c||(c=[],o.set(l,c),i.push(c)),c.push(a)}return i},e.getSelectedStructuresDescription=function n(r){var i,o,s,a,l,c,u,d,f;const{structures:p}=r.managers.structure.hierarchy.selection;if(0===p.length)return"";if(1===p.length){const y=p[0],v=null===(i=y.cell.obj)||void 0===i?void 0:i.data;if(!v)return(null===(o=y.cell.obj)||void 0===o?void 0:o.label)||"Structure";const x=v.models[0]||v.representativeModel||v.masterModel;if(!x)return(null===(s=y.cell.obj)||void 0===s?void 0:s.label)||"Structure";const _=x.entryId;return null!==(l=null===(a=y.model)||void 0===a?void 0:a.trajectory)&&void 0!==l&&l.models&&1===y.model.trajectory.models.length?_:y.model?`${null===(c=y.model.cell.obj)||void 0===c?void 0:c.label} | ${_}`:_}const m=p[0],h=null===(u=m?.model)||void 0===u?void 0:u.trajectory;let g=!0;for(const y of p)if((null===(d=y?.model)||void 0===d?void 0:d.trajectory)!==h){g=!1;break}return g&&h?`${null===(f=h.cell.obj)||void 0===f?void 0:f.label} | ${p.length} structures`:`${p.length} structures`}}(m2||(m2={}));const x$="measurement-group",SO="measurement-order-label",A1e={distanceUnitLabel:I.Text("\u212b",{isEssential:!0}),textColor:Ame.textColor},mvt=I.getDefaultValues(A1e);class gvt extends zy{stateUpdated(){this.behaviors.state.next(this.state)}getGroup(){const n=Qn.findTagInSubtree(this.plugin.state.data.tree,vr.RootRef,x$),r=this.plugin.state.data.build();return n?r.to(n):r.toRoot().group(at.Misc.CreateGroup,{label:"Measurements"},{tags:x$})}setOptions(t){var n=this;return le(function*(){n.updateState({options:t})&&n.stateUpdated();const r=n.plugin.state.data.build();for(const i of n.state.distances)r.to(i).update(o=>{o.unitLabel=t.distanceUnitLabel,o.textColor=t.textColor});for(const i of n.state.labels)r.to(i).update(o=>{o.textColor=t.textColor});for(const i of n.state.angles)r.to(i).update(o=>{o.textColor=t.textColor});for(const i of n.state.dihedrals)r.to(i).update(o=>{o.textColor=t.textColor});0!==r.editInfo.count&&(yield jt.State.Update(n.plugin,{state:n.plugin.state.data,tree:r,options:{doNotLogTiming:!0}}))})()}addDistance(t,n,r){var i=this;return le(function*(){const o=i.plugin.helpers.substructureParent.get(t.structure),s=i.plugin.helpers.substructureParent.get(n.structure);if(!o||!s)return;const a=[o.transform.ref];Us(a,s.transform.ref);const l=i.getGroup();l.apply(at.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",groupId:"a",ref:o.transform.ref,expression:Me.toExpression(t)},{key:"b",groupId:"b",ref:s.transform.ref,expression:Me.toExpression(n)}],isTransitive:!0,label:"Distance"},{dependsOn:a,tags:r?.selectionTags}).apply(at.Representation.StructureSelectionsDistance3D,{customText:r?.customText||"",unitLabel:i.state.options.distanceUnitLabel,textColor:i.state.options.textColor,...r?.lineParams,...r?.labelParams,...r?.visualParams},{tags:r?.reprTags});const c=i.plugin.state.data;yield jt.State.Update(i.plugin,{state:c,tree:l,options:{doNotLogTiming:!0}})})()}addAngle(t,n,r,i){var o=this;return le(function*(){const s=o.plugin.helpers.substructureParent.get(t.structure),a=o.plugin.helpers.substructureParent.get(n.structure),l=o.plugin.helpers.substructureParent.get(r.structure);if(!s||!a||!l)return;const c=[s.transform.ref];Us(c,a.transform.ref),Us(c,l.transform.ref);const u=o.getGroup();u.apply(at.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",ref:s.transform.ref,expression:Me.toExpression(t)},{key:"b",ref:a.transform.ref,expression:Me.toExpression(n)},{key:"c",ref:l.transform.ref,expression:Me.toExpression(r)}],isTransitive:!0,label:"Angle"},{dependsOn:c,tags:i?.selectionTags}).apply(at.Representation.StructureSelectionsAngle3D,{customText:i?.customText||"",textColor:o.state.options.textColor,...i?.lineParams,...i?.labelParams,...i?.visualParams},{tags:i?.reprTags});const d=o.plugin.state.data;yield jt.State.Update(o.plugin,{state:d,tree:u,options:{doNotLogTiming:!0}})})()}addDihedral(t,n,r,i,o){var s=this;return le(function*(){const a=s.plugin.helpers.substructureParent.get(t.structure),l=s.plugin.helpers.substructureParent.get(n.structure),c=s.plugin.helpers.substructureParent.get(r.structure),u=s.plugin.helpers.substructureParent.get(i.structure);if(!(a&&l&&c&&u))return;const d=[a.transform.ref];Us(d,l.transform.ref),Us(d,c.transform.ref),Us(d,u.transform.ref);const f=s.getGroup();f.apply(at.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",ref:a.transform.ref,expression:Me.toExpression(t)},{key:"b",ref:l.transform.ref,expression:Me.toExpression(n)},{key:"c",ref:c.transform.ref,expression:Me.toExpression(r)},{key:"d",ref:u.transform.ref,expression:Me.toExpression(i)}],isTransitive:!0,label:"Dihedral"},{dependsOn:d,tags:o?.selectionTags}).apply(at.Representation.StructureSelectionsDihedral3D,{customText:o?.customText||"",textColor:s.state.options.textColor,...o?.lineParams,...o?.labelParams,...o?.visualParams},{tags:o?.reprTags});const p=s.plugin.state.data;yield jt.State.Update(s.plugin,{state:p,tree:f,options:{doNotLogTiming:!0}})})()}addLabel(t,n){var r=this;return le(function*(){const i=r.plugin.helpers.substructureParent.get(t.structure);if(!i)return;const o=[i.transform.ref],s=r.getGroup();s.apply(at.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",ref:i.transform.ref,expression:Me.toExpression(t)}],isTransitive:!0,label:"Label"},{dependsOn:o,tags:n?.selectionTags}).apply(at.Representation.StructureSelectionsLabel3D,{textColor:r.state.options.textColor,...n?.labelParams,...n?.visualParams},{tags:n?.reprTags});const a=r.plugin.state.data;yield jt.State.Update(r.plugin,{state:a,tree:s,options:{doNotLogTiming:!0}})})()}addOrientation(t){var n=this;return le(function*(){const r=[],i=[];for(let a=0,l=t.length;a{n.inTransaction||t.behaviors.state.isAnimating.value||this.sync()}),t.behaviors.state.isAnimating.subscribe(n=>{!n&&!t.behaviors.state.isUpdating.value&&this.sync()})}}const VP=new xf("98");class bvt extends zy{get entries(){return this.state.entries}get additionsHistory(){return this.state.additionsHistory}get stats(){return this.state.stats||(this.state.stats=this.calcStats()),this.state.stats}getEntry(t){const n=this.plugin.helpers.substructureParent.get(t,!0);if(!n)return;const r=n.transform.ref;if(!this.entries.has(r)){const i=new _$(Me(t,[]));return this.entries.set(r,i),i}return this.entries.get(r)}calcStats(){let t=0,n=0;const r=Wh.create();this.entries.forEach(o=>{const{elements:s}=o.selection;if(s.length){t+=1;for(let a=0,l=s.length;a24&&this.additionsHistory.pop(),this.events.additionsHistoryUpdated.next(void 0)}clearHistory(){0!==this.state.additionsHistory.length&&(this.state.additionsHistory=[],this.events.additionsHistoryUpdated.next(void 0))}clearHistoryForStructure(t){const n=[];for(const r of this.state.additionsHistory)r.loci.structure.root===t.root&&n.push(r);for(const r of n)this.modifyHistory(r,"remove");0!==n.length&&this.events.additionsHistoryUpdated.next(void 0)}onRemove(t,n){var r;this.entries.has(t)&&(this.entries.delete(t),n?.data&&this.clearHistoryForStructure(n.data),(null===(r=this.referenceLoci)||void 0===r?void 0:r.structure)===n?.data&&(this.referenceLoci=void 0),this.state.stats=void 0,this.events.changed.next(void 0))}onUpdate(t,n,r){var i,o,s,a;if(n===r||n?.data===r.data)return;const l=this.plugin.helpers.substructureParent.get(r.data,!0);if(!l||t!==l.transform.ref||!this.entries.has(t))return;const c=null===(o=null===(i=this.plugin.helpers.substructureParent.get(r.data))||void 0===i?void 0:i.obj)||void 0===o?void 0:o.data;if(c)if(!n?.data||Xe.areUnitIdsAndIndicesEqual(n.data,r.data)){this.entries.set(t,function xvt(e,t){return new _$(Me.remap(e.selection,t))}(this.entries.get(t),c)),(null===(s=this.referenceLoci)||void 0===s?void 0:s.structure.root)===c.root&&(this.referenceLoci=Me.remap(this.referenceLoci,c));let u=!1;for(const d of this.state.additionsHistory)d.loci.structure.root===c.root&&(d.loci=Me.remap(d.loci,c),u=!0);u&&this.events.additionsHistoryUpdated.next(void 0)}else this.entries.set(t,new _$(Me(c,[]))),(null===(a=this.referenceLoci)||void 0===a?void 0:a.structure.root)===c.root&&(this.referenceLoci=void 0),this.clearHistoryForStructure(c),this.state.stats=void 0,this.events.changed.next(void 0)}clear(){const t=this.entries.keys(),n=[];for(;;){const r=t.next();if(r.done)break;const i=this.entries.get(r.value);Me.isEmpty(i.selection)||n.push(i.selection),i.selection=Me(i.selection.structure,[])}return this.referenceLoci=void 0,this.state.stats=void 0,this.events.changed.next(void 0),this.events.loci.clear.next(void 0),this.clearHistory(),n}getLoci(t){const n=this.getEntry(t);return n?n.selection:qr}getStructure(t){const n=this.getEntry(t);if(n)return n.structure}structureHasSelection(t){var n,r;const i=null===(r=null===(n=t.cell)||void 0===n?void 0:n.obj)||void 0===r?void 0:r.data;if(!i)return!1;const o=this.getEntry(i);return!!o&&!Me.isEmpty(o.selection)}has(t){if(Me.is(t)){const n=this.getEntry(t.structure);if(n)return Me.isSubset(n.selection,t)}return!1}tryGetRange(t){if(!Me.is(t)||1!==t.elements.length||!this.getEntry(t.structure))return;const r=t.elements[0];if(!r)return;const i=this.referenceLoci;if(!i||!Me.is(i)||i.structure!==t.structure)return;let o;for(const s of i.elements)if(r.unit===s.unit){o=s;break}return o&&r.unit===o.unit?function _vt(e,t,n){const r=Math.min(Ve.min(t.indices),Ve.min(n.indices)),i=Math.max(Ve.max(t.indices),Ve.max(n.indices));return Me(e,[{unit:t.unit,indices:Ve.ofRange(r,i)}])}(t.structure,o,r):void 0}elementCount(){let t=0;return this.entries.forEach(n=>{t+=Me.size(n.selection)}),t}getBoundary(){const t=C.create(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),n=C.create(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);VP.reset();const r=[];this.entries.forEach(i=>{const o=i.selection;Me.isEmpty(o)||r.push(Me.getBoundary(o))});for(let i=0,o=r.length;in.selection))}modify(t,n){let r=!1;switch(t){case"add":r=this.add(n);break;case"remove":r=this.remove(n);break;case"intersect":r=this.intersect(n);break;case"set":r=this.set(n)}r&&(this.state.stats=void 0,this.events.changed.next(void 0))}get applicableStructures(){return this.plugin.managers.structure.hierarchy.selection.structures.filter(t=>!!t.cell.obj).map(t=>t.cell.obj.data)}triggerInteraction(t,n,r=!0){switch(t){case"add":this.plugin.managers.interactivity.lociSelects.select({loci:n},r);break;case"remove":this.plugin.managers.interactivity.lociSelects.deselect({loci:n},r);break;case"intersect":this.plugin.managers.interactivity.lociSelects.selectJoin({loci:n},r);break;case"set":this.plugin.managers.interactivity.lociSelects.selectOnly({loci:n},r)}}fromLoci(t,n,r=!0){this.triggerInteraction(t,n,r)}fromCompiledQuery(t,n,r=!0){for(const i of this.applicableStructures){const o=n(new _f(i));this.triggerInteraction(t,Dt.toLociWithSourceUnits(o),r)}}fromSelectionQuery(t,n,r=!0){var i=this;this.plugin.runTask(Ke.create("Structure Selection",function(){var o=le(function*(s){for(const a of i.applicableStructures){const l=yield n.getSelection(i.plugin,s,a);i.triggerInteraction(t,Dt.toLociWithSourceUnits(l),r)}});return function(s){return o.apply(this,arguments)}}()))}fromSelections(t){var n;const r=_a.resolveAndCheck(this.plugin.state.data,t);if(r&&r.obj){if(!Se.Molecule.Structure.Selections.is(r.obj))return void console.warn("fromSelections applied to wrong object type.",r.obj);this.clear();for(const i of null===(n=r.obj)||void 0===n?void 0:n.data)this.fromLoci("set",i.loci)}}getSnapshot(){const t=[];return this.entries.forEach((n,r)=>{t.push({ref:r,bundle:Qr.fromLoci(n.selection)})}),{entries:t}}setSnapshot(t){var n,r;this.entries.clear();for(const{ref:i,bundle:o}of t.entries){const s=null===(r=null===(n=this.plugin.state.data.select(Qn.Generators.byRef(i))[0])||void 0===n?void 0:n.obj)||void 0===r?void 0:r.data;if(!s)continue;const a=Qr.toLoci(o,s);this.fromLoci("set",a,!1)}}constructor(t){super({entries:new Map,additionsHistory:[],stats:{structureCount:0,elementCount:0,label:"Nothing Selected"}}),this.plugin=t,this.events={changed:this.ev(),additionsHistoryUpdated:this.ev(),loci:{add:this.ev(),remove:this.ev(),clear:this.ev()}},t.helpers.substructureParent.events.removed.subscribe(n=>this.onRemove(n.ref,n.obj)),t.helpers.substructureParent.events.updated.subscribe(n=>this.onUpdate(n.ref,n.oldObj,n.obj))}}class _${get selection(){return this._selection}set selection(t){this._selection=t,this._structure=void 0}get structure(){return this._structure||(this._structure=Yn.isEmpty(this._selection)?void 0:Me.toStructure(this._selection)),this._structure}constructor(t){this._structure=void 0,this._selection=t}}function S$(){return{volumes:[],lazyVolumes:[],refs:new Map}}function Cvt(e){return{kind:"volume",cell:e,version:e.transform.version,representations:[]}}function wvt(e){return{kind:"lazy-volume",cell:e,version:e.transform.version}}function Avt(e,t){return{kind:"volume-representation",cell:e,version:e.transform.version,volume:t}}function C$(e,t,n,r,...i){const o=r(...i);n.push(o),e.hierarchy.refs.set(t.transform.ref,o);const s=e.oldHierarchy.refs.get(t.transform.ref);return s?s.version!==t.transform.version&&(e.changed=!0):(e.added.add(o.cell.transform.ref),e.changed=!0),o}function I1e(){}const Tvt=[[function Evt(e,t){return(n,r)=>!t(r)&&e.is(n.obj)}(Se.Volume.Data,e=>e.currentVolume),(e,t)=>{e.currentVolume=C$(e,t,e.hierarchy.volumes,Cvt,t)},e=>e.currentVolume=void 0],[e=>Se.Volume.Lazy.is(e.obj),(e,t)=>{C$(e,t,e.hierarchy.lazyVolumes,wvt,t)},I1e],[(e,t)=>!e.state.isGhost&&!!t.currentVolume&&Se.Volume.Representation3D.is(e.obj),(e,t)=>(e.currentVolume&&C$(e,t,e.currentVolume.representations,Avt,t,e.currentVolume),!1),I1e]];function E1e(e){if(!e||!e?.parent||!e.parent.cells.has(e.transform.ref))return!1;const{obj:t}=e;return!(!t||t===vo.Null||"ok"!==e.status&&"error"!==e.status)}function Dvt(e){const{cell:t}=e;E1e(t)||(this.changed=!0)}function Pvt(e){T1e(this,this.tree.transforms.get(e))}function T1e(e,t){const{state:n}=e,r=n.state.cells.get(t.ref);if(!E1e(r))return;let i,o=!1;for(const[a,l,c]of Tvt)if(a(r,n)){if(!1===l(n,r)){o=!0;break}i=c;break}if(o)return;const s=e.tree.children.get(t.ref);s&&s.size&&s.forEach(Pvt,e),i&&i(n)}class CO extends wP{get dataState(){return this.plugin.state.data}get current(){return this.sync(!1),this.state.hierarchy}get selection(){return this.sync(!1),this.state.selection}sync(t){if(!t&&this.dataState.inUpdate)return;if(this.state.syncedTree===this.dataState.tree)return void(t&&!this.state.notified&&(this.state.notified=!0,this.behaviors.selection.next({hierarchy:this.state.hierarchy,volume:this.state.selection})));this.state.syncedTree=this.dataState.tree;const n=function Svt(e,t){const n=function Ivt(e,t){return{state:e,oldHierarchy:t,hierarchy:S$(),changed:!1,added:new Set}}(e,t||S$());return function kvt(e,t){T1e({tree:e,state:t},e.root)}(e.tree,n),t&&t.refs.forEach(Dvt,n),{hierarchy:n.hierarchy,added:n.added,changed:n.changed}}(this.plugin.state.data,this.current);if(!n.changed)return;const{hierarchy:r}=n;this.state.hierarchy=r,this.state.selection=this.state.selection&&r.refs.has(this.state.selection.cell.transform.ref)?r.refs.get(this.state.selection.cell.transform.ref):r.volumes[0],t?(this.state.notified=!0,this.behaviors.selection.next({hierarchy:r,volume:this.state.selection})):this.state.notified=!1}setCurrent(t){this.state.selection=t||this.state.hierarchy.volumes[0],this.behaviors.selection.next({hierarchy:this.state.hierarchy,volume:t||this.state.hierarchy.volumes[0]})}remove(t,n){if(0===t.length)return;const r=this.plugin.state.data.build();for(const i of t)r.delete("string"==typeof i?i:i.cell.transform.ref);return r.commit({canUndo:!!n&&"Remove"})}toggleVisibility(t,n){if(0===t.length)return;const r=void 0!==n?"show"!==n:!t[0].cell.state.isHidden;for(const i of t)G_(this.dataState,i.cell.transform.ref,r)}addRepresentation(t,n){var r;return this.dataState.build().to(t.cell).apply(at.Representation.VolumeRepresentation3D,UA(this.plugin,null===(r=t.cell.obj)||void 0===r?void 0:r.data,{type:n})).commit({canUndo:"Add Representation"})}constructor(t){super(),this.plugin=t,this.state={syncedTree:this.dataState.tree,notified:!1,hierarchy:S$(),selection:void 0},this.behaviors={selection:this.ev.behavior({hierarchy:this.current,volume:this.selection})},this.subscribe(t.state.data.events.changed,n=>{n.inTransaction||t.behaviors.state.isAnimating.value||this.sync(!0)}),this.subscribe(t.behaviors.state.isAnimating,n=>{!n&&!t.behaviors.state.isUpdating.value&&this.sync(!0)})}}!function(e){e.getRepresentationTypes=function t(n,r){var i,o;return null!==(i=r?.cell.obj)&&void 0!==i&&i.data?n.representation.volume.registry.getApplicableTypes(null===(o=r.cell.obj)||void 0===o?void 0:o.data):n.representation.volume.registry.types}}(CO||(CO={}));const w$=[["full","Full"],["hidden","Hidden"]],Rvt={isExpanded:I.Boolean(!1),showControls:I.Boolean(!0),regionState:I.Group({left:I.Select("full",[["full","Full"],["collapsed","Collapsed"],["hidden","Hidden"]]),top:I.Select("full",w$),right:I.Select("full",w$),bottom:I.Select("full",w$)}),controlsDisplay:I.Value("outside",{isHidden:!0})};class Nvt extends zy{updateProps(t){const n=!!this.state.isExpanded;this.updateState(t),this.root&&"boolean"==typeof t.isExpanded&&t.isExpanded!==n&&this.handleExpand(),this.events.updated.next(void 0)}setProps(t){this.updateState(t)}setRoot(t){this.root=t,this.state.isExpanded&&this.handleExpand()}getScrollElement(){return document.scrollingElement?document.scrollingElement:document.documentElement?document.documentElement:document.body}handleExpand(){try{const t=document.getElementsByTagName("body")[0],n=document.getElementsByTagName("head")[0];if(!t||!n||!this.root)return;if(this.state.isExpanded){const r=n.children,i=[];let o=!1;for(let u=0;uthis.updateProps(n.state)),typeof document<"u"&&(this.expandedViewport=document.createElement("meta"),this.expandedViewport.name="viewport",this.expandedViewport.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0")}}const A$={includeTypes:I.MultiSelect(DR(Lr.Names),I.objectToOptions(Lr.Names)),excludeTypes:I.MultiSelect([],I.objectToOptions(Lr.Names)),ignoreHydrogens:I.Boolean(!1),ignoreHydrogensVariant:I.Select("all",I.arrayToOptions(["all","non-polar"])),aromaticBonds:I.Boolean(!0,{description:"Display aromatic bonds with dashes"}),multipleBonds:I.Select("symmetric",I.arrayToOptions(["off","symmetric","offset"]))},I$=(I.getDefaultValues(A$),{...t2,...A$,adjustCylinderLength:I.Boolean(!1,{description:"Shorten cylinders to reduce overlap with spheres. Useful for for transparent bonds. Not working well with aromatic bonds."})}),E$=(I.getDefaultValues(I$),{...Wye,...A$});function wO(e,t,n){return!Lr.is(e,n)||Lr.is(t,n)}function D1e(e,t,n){const r=t.elements,i=t.bonds,{a:o,b:s,edgeProps:a}=i,{flags:l}=a,{ignoreHydrogens:c,ignoreHydrogensVariant:u,includeTypes:d,excludeTypes:f}=n,p=Lr.fromNames(d),m=Lr.fromNames(f),h=Lr.isAll(p)&&0===m,{child:g}=e,y=g?.unitMap.get(t.id);if(g&&!y)throw new Error("expected childUnit to exist if child exists");if(!h||c||g)return v=>{const x=o[v],_=s[v];return!!(y&&!rt.has(y.elements,r[x])||!h&&wO(p,m,l[v]))||!!c&&!(!rm(e,t,r[x],u)&&!rm(e,t,r[_],u))}}function P1e(e,t){const n=e.interUnitBonds,{edges:r}=n,{ignoreHydrogens:i,ignoreHydrogensVariant:o,includeTypes:s,excludeTypes:a}=t,l=Lr.fromNames(s),c=Lr.fromNames(a),u=Lr.isAll(l)&&0===c,{child:d}=e;if(!u||i||d)return f=>{if(d){const p=r[f],m=d.unitMap.get(p.unitA);if(!m)return!0;const g=e.unitMap.get(p.unitA).elements[p.indexA];if(!rt.has(m.elements,g))return!0}if(i){const p=r[f],m=e.unitMap.get(p.unitA),h=e.unitMap.get(p.unitB);if(rm(e,m,m.elements[p.indexA],o)||rm(e,h,h.elements[p.indexB],o))return!0}return!(u||!wO(l,c,r[f].props.flag))}}var fv;function T$(e,t,n){const{objectId:r,instanceId:i,groupId:o}=e;if(n===r){const{structure:s,group:a}=t,l=a.units[i];if(ze.isAtomic(l)){const{target:c}=s,u=l.bonds.a[o],d=l.bonds.b[o];return fn.Loci(c,[fn.Location(c,l,u,c,l,d),fn.Location(c,l,d,c,l,u)])}}return qr}function D$(e,t,n,r){let i=!1;if(fn.isLoci(e)){const{structure:o,group:s}=t;if(!Xe.areEquivalent(e.structure,o))return!1;const a=s.units[0];if(!ze.isAtomic(a))return!1;const l=2*a.bonds.edgeCount;for(const c of e.bonds){if(c.aUnit!==c.bUnit)continue;const u=s.unitIndexMap.get(c.aUnit.id);if(void 0!==u){const d=a.bonds.getDirectedEdgeIndex(c.aIndex,c.bIndex);-1!==d&&n(Pe.ofSingleton(u*l+d))&&(i=!0)}}}else if(Me.is(e)){const{structure:o,group:s}=t;if(!Xe.areEquivalent(e.structure,o))return!1;const a=s.units[0];if(!ze.isAtomic(a))return!1;const l=2*a.bonds.edgeCount;for(const c of e.elements){const u=s.unitIndexMap.get(c.unit.id);if(void 0!==u){const{offset:d,b:f}=a.bonds;Ve.forEach(c.indices,p=>{for(let m=d[p],h=d[p+1];m{const m=o.units[p];return u.aUnit=m,u.bUnit=m,u.aIndex=m.bonds.a[f],u.bIndex=m.bonds.b[f],u};if(i?.includeLocation2){const f=fn.Location(s,void 0,void 0,s,void 0,void 0);return Vi(l,c,1,d,!1,()=>!1,(m,h)=>{const g=o.units[h];return f.aUnit=g,f.bUnit=g,f.aIndex=g.bonds.b[m],f.bIndex=g.bonds.a[m],f})}return Vi(l,c,1,d)},e.fromStructure=function n(r,i){const o=r.interUnitBonds.edgeCount,a=fn.Location(r,void 0,void 0,r,void 0,void 0),l=c=>{const u=r.interUnitBonds.edges[c];return a.aUnit=r.unitMap.get(u.unitA),a.aIndex=u.indexA,a.bUnit=r.unitMap.get(u.unitB),a.bIndex=u.indexB,a};if(i?.includeLocation2){const c=fn.Location(r,void 0,void 0,r,void 0,void 0);return Vi(o,1,1,l,!0,()=>!1,d=>{const f=r.interUnitBonds.edges[d];return c.aUnit=r.unitMap.get(f.unitB),c.aIndex=f.indexB,c.bUnit=r.unitMap.get(f.unitA),c.bIndex=f.indexA,c})}return Vi(o,1,1,l,!0)}}(fv||(fv={}));const k$=new Map;function M$(e,t,n,r){let i=!1;if(fn.isLoci(e)){if(!Xe.areEquivalent(e.structure,t))return!1;for(const o of e.bonds){const s=t.interUnitBonds.getBondIndexFromLocation(o);-1!==s&&n(Pe.ofSingleton(s))&&(i=!0)}}else if(Me.is(e)){if(!Xe.areEquivalent(e.structure,t)||r&&1===e.elements.length)return!1;for(const o of e.elements)k$.set(o.unit.id,o.indices);for(const o of e.elements){const{unit:s}=o;ze.isAtomic(s)&&t.interUnitBonds.getConnectedUnits(s.id).forEach(a=>{const l=k$.get(a.unitB);(!r||l)&&Ve.forEach(o.indices,c=>{a.connectedIndices.includes(c)&&a.getEdges(c).forEach(u=>{if(!r||l&&Ve.has(l,u.indexB)){const d=t.interUnitBonds.getEdgeIndex(c,s.id,u.indexB,a.unitB);n(Pe.ofSingleton(d))&&(i=!0)}})})})}k$.clear()}return i}const R$=Lr.is;function k1e(e,t,n,r){const i=e.elements,o=e.bonds,{edgeCount:s,a,b:l,edgeProps:c,offset:u}=o,{order:d,flags:f}=c,{sizeFactor:p,sizeAspectRatio:m,adjustCylinderLength:h,aromaticBonds:g,includeTypes:y,excludeTypes:v,multipleBonds:x}=r,_="off"===x,w="symmetric"===x,E=wO(Lr.fromNames(y),Lr.fromNames(v),32),D=C(),T=C(),F=e.conformation;let R;const N=dt.create(t,e),j=fn.Location(t,e,void 0,t,e,void 0),{child:W}=t;if(r.includeParent&&W){const te=W.unitMap.get(e.id);if(!te)throw new Error("expected childUnit to exist");R=K=>{const G=i[l[K]];return rt.has(te.elements,i[a[K]])&&!rt.has(te.elements,G)}}const{elementRingIndices:X,elementAromaticRingIndices:H}=e.rings,oe=g?e.resonance.delocalizedTriplets:void 0;return{linkCount:2*s,referencePosition:te=>{let K=a[te],Q=l[te];const G=oe?.getThirdElement(K,Q);if(void 0!==G)return F.invariantPosition(i[G],D);K>Q&&([K,Q]=[Q,K]),u[K+1]-u[K]==1&&([K,Q]=[Q,K]);const Z=H.get(K)||X.get(K);let ee=0;for(let se=u[K],xe=u[K+1];seee&&(ee=ge,F.invariantPosition(i[re],D))}}}return ee>0?D:null},position:(te,K,Q)=>{if(F.invariantPosition(i[a[Q]],te),F.invariantPosition(i[l[Q]],K),h){const G=(te=>(N.element=i[a[te]],n.size.size(N)*p))(Q),Z=(te=>(N.element=i[l[te]],n.size.size(N)*p))(Q),ee=Math.min(G,Z)*m,se=Math.sqrt(Math.max(0,G*G-ee*ee))-.05,xe=Math.sqrt(Math.max(0,Z*Z-ee*ee))-.05;if(se<=.01&&xe<=.01)return;C.normalize(T,C.sub(T,K,te)),C.scaleAndAdd(te,te,T,se),C.scaleAndAdd(K,K,T,-xe)}},style:te=>{const K=d[te],Q=f[te];if(R$(Q,2)||R$(Q,4))return 1;if(3===K)return _?0:w?4:5;if(g){const Z=l[te],ee=H.get(a[te]),se=H.get(Z),xe=ee&&se?jR(ee,se):0;if(R$(Q,16)||xe&&!E)return 2===xe?8:7}return 2!==K||_?0:w?2:3},radius:te=>(te=>(j.aIndex=a[te],j.bIndex=l[te],n.size.size(j)*p))(te)*m,ignore:D1e(t,e,r),stub:R}}function Fvt(e,t,n,r,i,o){if(!ze.isAtomic(t)||!t.bonds.edgeCount)return Wu.createEmpty(o);const{child:s}=n,a=s?.unitMap.get(t.id);if(s&&!a)return Wu.createEmpty(o);const l=k1e(t,n,r,i),{cylinders:c,boundingSphere:u}=$ye(0,l,i,o);if(u)c.setBoundingSphere(u);else if(c.cylinderCount>0){const d=ke.expand(ke(),(a??t).boundary.sphere,1*i.sizeFactor);c.setBoundingSphere(d)}return c}function Ovt(e,t,n,r,i,o){if(!ze.isAtomic(t)||!t.bonds.edgeCount)return on.createEmpty(o);const{child:s}=n,a=s?.unitMap.get(t.id);if(s&&!a)return on.createEmpty(o);const l=k1e(t,n,r,i),{mesh:c,boundingSphere:u}=n2(0,l,i,o);if(u)c.setBoundingSphere(u);else if(c.triangleCount>0){const d=ke.expand(ke(),(a??t).boundary.sphere,1*i.sizeFactor);c.setBoundingSphere(d)}return c}const AO={...ml,..._W,...I$,sizeFactor:I.Numeric(.3,{min:0,max:10,step:.01}),sizeAspectRatio:I.Numeric(2/3,{min:0,max:3,step:.01}),tryUseImpostor:I.Boolean(!0),includeParent:I.Boolean(!1)};function M1e(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth?function Bvt(e){return SW({defaultProps:I.getDefaultValues(AO),createGeometry:Fvt,createLocationIterator:(t,n)=>fv.fromGroup(t,{includeLocation2:"interpolate"===n.colorMode}),getLoci:T$,eachLocation:D$,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.sizeAspectRatio!==r.sizeAspectRatio||n.linkScale!==r.linkScale||n.linkSpacing!==r.linkSpacing||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.linkCap!==r.linkCap||n.aromaticScale!==r.aromaticScale||n.aromaticSpacing!==r.aromaticSpacing||n.aromaticDashCount!==r.aromaticDashCount||n.dashCount!==r.dashCount||n.dashScale!==r.dashScale||n.dashCap!==r.dashCap||n.stubCap!==r.stubCap||!Ru(n.includeTypes,r.includeTypes)||!Ru(n.excludeTypes,r.excludeTypes)||n.adjustCylinderLength!==r.adjustCylinderLength||n.aromaticBonds!==r.aromaticBonds||n.multipleBonds!==r.multipleBonds,n.colorMode!==r.colorMode&&(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0);const l=s.group.units[0],c=a.group.units[0];ze.isAtomic(l)&&ze.isAtomic(c)&&(Cd.areEqual(l.bonds,c.bonds)||(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.updateSize=!0))},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function Lvt(e){return mc({defaultProps:I.getDefaultValues(AO),createGeometry:Ovt,createLocationIterator:t=>fv.fromGroup(t),getLoci:T$,eachLocation:D$,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.sizeAspectRatio!==r.sizeAspectRatio||n.radialSegments!==r.radialSegments||n.linkScale!==r.linkScale||n.linkSpacing!==r.linkSpacing||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.linkCap!==r.linkCap||n.aromaticScale!==r.aromaticScale||n.aromaticSpacing!==r.aromaticSpacing||n.aromaticDashCount!==r.aromaticDashCount||n.dashCount!==r.dashCount||n.dashScale!==r.dashScale||n.dashCap!==r.dashCap||n.stubCap!==r.stubCap||!Ru(n.includeTypes,r.includeTypes)||!Ru(n.excludeTypes,r.excludeTypes)||n.adjustCylinderLength!==r.adjustCylinderLength||n.aromaticBonds!==r.aromaticBonds||n.multipleBonds!==r.multipleBonds;const l=s.group.units[0],c=a.group.units[0];ze.isAtomic(l)&&ze.isAtomic(c)&&(Cd.areEqual(l.bonds,c.bonds)||(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.updateSize=!0))},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}const N$=new fn.ElementBondIterator;function R1e(e,t,n,r){for(N$.setElement(t,n,r);N$.hasNext;){const i=N$.move();return i.otherUnit.conformation.position(i.otherUnit.elements[i.otherIndex],e),e}return null}const N1e=C();function F1e(e,t,n){const r=dt.create(e),i=fn.Location(e,void 0,void 0,e,void 0,void 0),o=e.interUnitBonds,{edgeCount:s,edges:a}=o,{sizeFactor:l,sizeAspectRatio:c,adjustCylinderLength:u,aromaticBonds:d,multipleBonds:f}=n,p="off"===f,m="symmetric"===f,h=C();let g;const{child:y}=e;return n.includeParent&&y&&(g=w=>{const A=a[w],M=y.unitMap.get(A.unitA),E=y.unitMap.get(A.unitB),T=e.unitMap.get(A.unitA).elements[A.indexA],R=e.unitMap.get(A.unitB).elements[A.indexB];return M&&rt.has(M.elements,T)&&(!E||!rt.has(E.elements,R))}),{linkCount:s,referencePosition:w=>{const A=a[w];let M,E,D,T;if(A.unitAA.unitB))throw new Error("same units in createInterUnitBondCylinderMesh");M=e.unitMap.get(A.unitB),E=e.unitMap.get(A.unitA),D=A.indexB,T=A.indexA}return R1e(N1e,e,M,D)||R1e(N1e,e,E,T)},position:(w,A,M)=>{const E=a[M],D=e.unitMap.get(E.unitA),T=e.unitMap.get(E.unitB);if(D.conformation.position(D.elements[E.indexA],w),T.conformation.position(T.elements[E.indexB],A),u){const F=(w=>{const A=a[w];return r.unit=e.unitMap.get(A.unitA),r.element=r.unit.elements[A.indexA],t.size.size(r)*l})(M),R=(w=>{const A=a[w];return r.unit=e.unitMap.get(A.unitB),r.element=r.unit.elements[A.indexB],t.size.size(r)*l})(M),N=Math.min(F,R)*c,j=Math.sqrt(Math.max(0,F*F-N*N))-.05,W=Math.sqrt(Math.max(0,R*R-N*N))-.05;if(j<=.01&&W<=.01)return;C.normalize(h,C.sub(h,A,w)),C.scaleAndAdd(w,w,h,j),C.scaleAndAdd(A,A,h,-W)}},style:w=>{const A=a[w].props.order,M=Mc.create(a[w].props.flag);return Lr.is(M,2)||Lr.is(M,4)?1:3===A?p?0:m?4:5:d&&Lr.is(M,16)?7:2!==A||p?0:m?2:3},radius:w=>(w=>{const A=a[w];return i.aUnit=e.unitMap.get(A.unitA),i.aIndex=A.indexA,i.bUnit=e.unitMap.get(A.unitB),i.bIndex=A.indexB,t.size.size(i)*l})(w)*c,ignore:P1e(e,n),stub:g}}function jvt(e,t,n,r,i){if(!t.interUnitBonds.edgeCount)return Wu.createEmpty(i);const o=F1e(t,n,r),{cylinders:s,boundingSphere:a}=$ye(0,o,r,i);if(a)s.setBoundingSphere(a);else if(s.cylinderCount>0){const{child:l}=t,c=ke.expand(ke(),(l??t).boundary.sphere,1*r.sizeFactor);s.setBoundingSphere(c)}return s}function Uvt(e,t,n,r,i){if(!t.interUnitBonds.edgeCount)return on.createEmpty(i);const o=F1e(t,n,r),{mesh:s,boundingSphere:a}=n2(0,o,r,i);if(a)s.setBoundingSphere(a);else if(s.triangleCount>0){const{child:l}=t,c=ke.expand(ke(),(l??t).boundary.sphere,1*r.sizeFactor);s.setBoundingSphere(c)}return s}const IO={...kA,...Wmt,...I$,sizeFactor:I.Numeric(.3,{min:0,max:10,step:.01}),sizeAspectRatio:I.Numeric(2/3,{min:0,max:3,step:.01}),tryUseImpostor:I.Boolean(!0),includeParent:I.Boolean(!1)};function O1e(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth?function zvt(e){return function $mt(e,t){return e2({...e,setUpdateState:(n,r,i,o,s,a,l)=>{e.setUpdateState(n,r,i,o,s,a,l),Ya.areEqual(o.size,s.size)||(n.updateSize=!0)},geometryUtils:Wu.Utils},t)}({defaultProps:I.getDefaultValues(IO),createGeometry:jvt,createLocationIterator:(t,n)=>fv.fromStructure(t,{includeLocation2:"interpolate"===n.colorMode}),getLoci:P$,eachLocation:M$,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.sizeAspectRatio!==r.sizeAspectRatio||n.linkScale!==r.linkScale||n.linkSpacing!==r.linkSpacing||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.linkCap!==r.linkCap||n.aromaticScale!==r.aromaticScale||n.aromaticSpacing!==r.aromaticSpacing||n.aromaticDashCount!==r.aromaticDashCount||n.dashCount!==r.dashCount||n.dashScale!==r.dashScale||n.dashCap!==r.dashCap||n.stubCap!==r.stubCap||!Ru(n.includeTypes,r.includeTypes)||!Ru(n.excludeTypes,r.excludeTypes)||n.adjustCylinderLength!==r.adjustCylinderLength||n.multipleBonds!==r.multipleBonds,n.colorMode!==r.colorMode&&(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0),s.interUnitBonds!==a.interUnitBonds&&(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.updateSize=!0)},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function Vvt(e){return Hy({defaultProps:I.getDefaultValues(IO),createGeometry:Uvt,createLocationIterator:t=>fv.fromStructure(t),getLoci:P$,eachLocation:M$,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.sizeAspectRatio!==r.sizeAspectRatio||n.radialSegments!==r.radialSegments||n.linkScale!==r.linkScale||n.linkSpacing!==r.linkSpacing||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.linkCap!==r.linkCap||n.aromaticScale!==r.aromaticScale||n.aromaticSpacing!==r.aromaticSpacing||n.aromaticDashCount!==r.aromaticDashCount||n.dashCount!==r.dashCount||n.dashScale!==r.dashScale||n.dashCap!==r.dashCap||n.stubCap!==r.stubCap||!Ru(n.includeTypes,r.includeTypes)||!Ru(n.excludeTypes,r.excludeTypes)||n.adjustCylinderLength!==r.adjustCylinderLength||n.multipleBonds!==r.multipleBonds,s.interUnitBonds!==a.interUnitBonds&&(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.updateSize=!0)},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}const Hvt=tt.add3,Gvt=tt.add;var HA;!function(e){e.create=function t(n=2048,r=1024,i){const o=tt.create(Float32Array,3,r,i?i.centerBuffer.ref.value:n),s=tt.create(Float32Array,1,r,i?i.groupBuffer.ref.value:n);return{add:(a,l,c,u)=>{Hvt(o,a,l,c),Gvt(s,u)},getSpheres:()=>{const a=tt.compact(o,!0),l=tt.compact(s,!0);return Rp.create(a,l,o.elementCount,i)}}}}(HA||(HA={}));const GA=C.add;function g2(e,t,n){const{ignoreHydrogens:r,ignoreHydrogensVariant:i,traceOnly:o}=n,s=ze.isCoarse(t),{child:a}=e,l=a?.unitMap.get(t.id);if(a&&!l)throw new Error("expected childUnit to exist if child exists");if(a||r||o)return c=>!!l&&!rt.has(l.elements,c)||!s&&r&&rm(e,t,c,i)||o&&!bW(t,c)}function qvt(e,t,n,r,i,o){const{child:s}=n,a=s?.unitMap.get(t.id);if(s&&!a)return on.createEmpty(o);const{detail:l,sizeFactor:c,stride:u}=i,{elements:d,conformation:f}=t,p=d.length,m=p*qw(l),h=Ct.createState(m,m/2,o),g=C(),y=g2(n,t,i),v=dt.create(n,t),x=r.size.size,_=C();let w=0,A=0;for(let T=0;Tw&&(w=F),h.currentGroup=T,Jr(h,g,F*c,l)}const M=o?ke.clone(o.boundingSphere):void 0,E=Ct.getMesh(h);if(0===A)return E;let D;return C.scale(_,_,1/A),D=M&&C.distance(_,M.center)/M.radius<.1?M:ke.expand(ke(),(a??t).boundary.sphere,w*c+.05),E.setBoundingSphere(D),E}function Wvt(e,t,n,r,i,o){const{child:s}=n,a=s?.unitMap.get(t.id);if(s&&!a)return Rp.createEmpty(o);const{sizeFactor:l,stride:c}=i,{elements:u,conformation:d}=t,f=u.length,p=HA.create(f,f/2,o),m=C(),h=g2(n,t,i),g=dt.create(n,t),y=r.size.size,v=C();let x=0,_=0;if(c&&c>1||h||"uniform"!==r.size.granularity)for(let E=0;Ex&&(x=D)}else{for(let E=0;Eh&&(h=j),f.currentGroup=c(_,N),Jr(f,D,j*a,s)}}const y=i?ke.clone(i.boundingSphere):void 0,v=Ct.getMesh(f);if(0===g)return v;let x;return C.scale(m,m,1/g),x=y&&C.distance(m,y.center)/y.radius<1?y:ke.expand(ke(),(o??t).boundary.sphere,h*a+.05),v.setBoundingSphere(x),v}function Yvt(e,t,n,r,i){const{child:o}=t,{sizeFactor:s,stride:a}=r,{getSerialIndex:l}=t.serialMapping,c=t.elementCount,u=HA.create(c,c/2,i),d=n.size.size,f=C();let p=0,m=0;for(const v of t.units){const x=o?.unitMap.get(v.id);if(o&&!x)return Rp.createEmpty(i);const{elements:_,conformation:w}=v,A=_.length,M=C(),E=g2(t,v,r),D=dt.create(t,v);if(a&&a>1||E||"uniform"!==n.size.granularity)for(let T=0;Tp&&(p=R)}else{for(let T=0;T{const f=i.units[d];return l.unit=f,l.element=f.elements[u],l})},e.fromStructure=function n(r){const{units:i,elementCount:o}=r,s=o,{unitIndices:l,elementIndices:c}=r.serialMapping,u=dt.create(r);return Vi(s,1,1,f=>(u.unit=i[l[f]],u.element=c[f],u),!0)}}(vl||(vl={}));const B1e={sizeFactor:I.Numeric(1,{min:0,max:10,step:.1}),detail:I.Numeric(0,{min:0,max:3,step:1},xt.CustomQualityParamInfo),ignoreHydrogens:I.Boolean(!1),ignoreHydrogensVariant:I.Select("all",I.arrayToOptions(["all","non-polar"])),traceOnly:I.Boolean(!1),tryUseImpostor:I.Boolean(!0),stride:I.Numeric(1,{min:1,max:100,step:1})},EO={...ml,...vW,...B1e};function L1e(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth&&r.extensions.textureFloat?function Xvt(e){return xW({defaultProps:I.getDefaultValues(EO),createGeometry:Wvt,createLocationIterator:vl.fromGroup,getLoci:dm,eachLocation:um,setUpdateState:(t,n,r)=>{t.createGeometry=n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.traceOnly!==r.traceOnly||n.stride!==r.stride},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function Kvt(e){return mc({defaultProps:I.getDefaultValues(EO),createGeometry:qvt,createLocationIterator:vl.fromGroup,getLoci:dm,eachLocation:um,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.traceOnly!==r.traceOnly||n.stride!==r.stride},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}const j1e={...kA,...Gmt,...B1e};function Zvt(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth&&r.extensions.textureFloat?function Qvt(e){return function qmt(e,t){return e2({...e,setUpdateState:(n,r,i,o,s,a,l)=>{e.setUpdateState(n,r,i,o,s,a,l),Ya.areEqual(o.size,s.size)||(n.updateSize=!0)},geometryUtils:Rp.Utils},t)}({defaultProps:I.getDefaultValues(j1e),createGeometry:Yvt,createLocationIterator:vl.fromStructure,getLoci:b2,eachLocation:y2,setUpdateState:(t,n,r)=>{t.createGeometry=n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.traceOnly!==r.traceOnly||n.stride!==r.stride},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function Jvt(e){return Hy({defaultProps:I.getDefaultValues(j1e),createGeometry:$vt,createLocationIterator:vl.fromStructure,getLoci:b2,eachLocation:y2,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.traceOnly!==r.traceOnly||n.stride!==r.stride},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}const U1e={"element-sphere":(e,t)=>Uo("Element sphere",e,t,L1e),"intra-bond":(e,t)=>Uo("Intra-unit bond cylinder",e,t,M1e),"inter-bond":(e,t)=>Ff("Inter-unit bond cylinder",e,t,O1e)},F$={...EO,traceOnly:I.Boolean(!1,{isHidden:!0}),...AO,...IO,includeParent:I.Boolean(!1),unitKinds:MP(["atomic"]),sizeFactor:I.Numeric(.15,{min:.01,max:10,step:.01}),sizeAspectRatio:I.Numeric(2/3,{min:.01,max:3,step:.01}),visuals:I.MultiSelect(["element-sphere","intra-bond","inter-bond"],I.objectToOptions(U1e)),bumpFrequency:I.Numeric(0,{min:0,max:10,step:.1},xt.ShadingCategory)},nxt={name:"ball-and-stick",label:"Ball & Stick",description:"Displays atoms as spheres and bonds as cylinders.",factory:function txt(e,t){return Xn.createMulti("Ball & Stick",e,t,gl,U1e)},getParams:function ext(e,t){if(Xe.getSize(t)>=Xe.Size.Huge){const r=I.clone(F$);return r.visuals.defaultValue=["element-sphere","intra-bond"],r}return F$},defaultValues:I.getDefaultValues(F$),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"physical"},isApplicable:e=>e.elementCount>0,getData:(e,t)=>t.includeParent?e.asParent():e,mustRecreate:(e,t)=>e.includeParent!==t.includeParent};function rxt(e,t,n,r,i){const{links:o,elements:s}=t.carbohydrates,{linkSizeFactor:a}=r,l=dt.create(t),c={linkCount:o.length,position:(f,p,m)=>{const h=o[m];C.copy(f,s[h.carbohydrateIndexA].geometry.center),C.copy(p,s[h.carbohydrateIndexB].geometry.center)},radius:f=>{const m=s[o[f].carbohydrateIndexA],h=m.unit.rings.all[m.ringIndex];return l.unit=m.unit,l.element=m.unit.elements[h[0]],n.size.size(l)*a}},{mesh:u,boundingSphere:d}=n2(0,c,r,i);if(d)u.setBoundingSphere(d);else if(u.triangleCount>0){const f=ke.expand(ke(),t.boundary.sphere,1*a);u.setBoundingSphere(f)}return u}const z1e={...ml,...t2,linkSizeFactor:I.Numeric(.3,{min:0,max:3,step:.01})};function ixt(e){return Hy({defaultProps:I.getDefaultValues(z1e),createGeometry:rxt,createLocationIterator:oxt,getLoci:sxt,eachLocation:axt,setUpdateState:(t,n,r)=>{t.createGeometry=n.linkSizeFactor!==r.linkSizeFactor||n.radialSegments!==r.radialSegments||n.linkCap!==r.linkCap}},e)}function oxt(e){const{elements:t,links:n}=e.carbohydrates,r=n.length,o=dt.create(e);return Vi(r,1,1,a=>{const c=t[n[a].carbohydrateIndexA],u=c.unit.rings.all[c.ringIndex];return o.unit=c.unit,o.element=c.unit.elements[u[0]],o},!0)}function sxt(e,t,n){const{objectId:r,groupId:i}=e;if(n===r){const{links:o,elements:s}=t.carbohydrates,a=o[i],l=s[a.carbohydrateIndexA],c=s[a.carbohydrateIndexB];return Me.union(kP(t,l.unit,l.residueIndex,l.altId),kP(t,c.unit,c.residueIndex,c.altId))}return qr}const O$=new Set;function axt(e,t,n){let r=!1;if(!Me.is(e)||!Xe.areEquivalent(e.structure,t))return!1;const{getLinkIndices:i}=t.carbohydrates;for(const{unit:o,indices:s}of e.elements)ze.isAtomic(o)&&(O$.clear(),Ve.forEach(s,a=>{const l=i(o,o.elements[a]);for(let c=0,u=l.length;c{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail}},e)}function Pxt(e){const t=e.carbohydrates.elements,n=2*t.length,i=dt.create(e);return Vi(n,1,1,function o(a,l){const c=t[Math.floor(a/2)],u=c.unit.rings.all[c.ringIndex];return i.unit=c.unit,i.element=c.unit.elements[u[0]],i},!0,function s(a,l){return a%2==1})}function kxt(e,t,n){const{objectId:r,groupId:i}=e;if(n===r){const o=t.carbohydrates.elements[Math.floor(i/2)];return kP(t,o.unit,o.residueIndex,o.altId)}return qr}const Y$=new Set;function Mxt(e,t,n){const{getElementIndices:r}=t.carbohydrates;let i=!1;if(!Me.is(e)||!Xe.areEquivalent(e.structure,t))return!1;for(const{unit:o,indices:s}of e.elements)ze.isAtomic(o)&&(Y$.clear(),Ve.forEach(s,a=>{const l=r(o,o.elements[a]);for(let c=0,u=l.length;c{const h=o[m];h.fromCarbohydrate?(C.copy(f,s[h.carbohydrateIndex].geometry.center),h.elementUnit.conformation.position(h.elementUnit.elements[h.elementIndex],p)):(h.elementUnit.conformation.position(h.elementUnit.elements[h.elementIndex],f),C.copy(p,s[h.carbohydrateIndex].geometry.center))},radius:f=>{const p=o[f];if(p.fromCarbohydrate){const m=s[p.carbohydrateIndex],h=m.unit.rings.all[m.ringIndex];l.unit=m.unit,l.element=m.unit.elements[h[0]]}else l.unit=p.elementUnit,l.element=p.elementUnit.elements[p.elementIndex];return n.size.size(l)*a},style:f=>{const p=o[f],h=ig(p.elementUnit.model.atomicHierarchy.atoms.type_symbol.value(p.elementUnit.elements[p.elementIndex]));return D3.has(h)?1:0}},{mesh:u,boundingSphere:d}=n2(0,c,r,i);if(d)u.setBoundingSphere(d);else if(u.triangleCount>0){const f=ke.expand(ke(),t.boundary.sphere,1*a);u.setBoundingSphere(f)}return u}const Z1e={...ml,...t2,terminalLinkSizeFactor:I.Numeric(.2,{min:0,max:3,step:.01})};function Nxt(e){return Hy({defaultProps:I.getDefaultValues(Z1e),createGeometry:Rxt,createLocationIterator:Fxt,getLoci:Oxt,eachLocation:Bxt,setUpdateState:(t,n,r)=>{t.createGeometry=n.terminalLinkSizeFactor!==r.terminalLinkSizeFactor||n.radialSegments!==r.radialSegments||n.linkCap!==r.linkCap}},e)}function Fxt(e){const{elements:t,terminalLinks:n}=e.carbohydrates,r=n.length,o=dt.create(e);return Vi(r,1,1,a=>{const l=n[a];if(l.fromCarbohydrate){const c=t[l.carbohydrateIndex],u=c.unit.rings.all[c.ringIndex];o.unit=c.unit,o.element=c.unit.elements[u[0]]}else o.unit=l.elementUnit,o.element=l.elementUnit.elements[l.elementIndex];return o},!0)}function Oxt(e,t,n){const{objectId:r,groupId:i}=e;if(n===r){const{terminalLinks:o,elements:s}=t.carbohydrates,a=o[i],l=s[a.carbohydrateIndex];return Me.union(kP(t,l.unit,l.residueIndex,l.altId),function Nmt(e,t,n){const{elements:r,model:i}=t,{label_alt_id:o}=i.atomicHierarchy.atoms,s=o.value(n);if(-1!==Ve.indexOf(r,n)){const{index:a}=i.atomicHierarchy.residueAtomSegments;return kP(e,t,a[n],s)}return Me(e,[])}(t,a.elementUnit,a.elementUnit.elements[a.elementIndex]))}return qr}const X$=new Set;function Bxt(e,t,n){let r=!1;if(!Me.is(e)||!Xe.areEquivalent(e.structure,t))return!1;const{getTerminalLinkIndices:i}=t.carbohydrates;for(const{unit:o,indices:s}of e.elements)ze.isAtomic(o)&&(X$.clear(),Ve.forEach(s,a=>{const l=i(o,o.elements[a]);for(let c=0,u=l.length;cFf("Carbohydrate symbol mesh",e,t,Dxt),"carbohydrate-link":(e,t)=>Ff("Carbohydrate link cylinder",e,t,ixt),"carbohydrate-terminal-link":(e,t)=>Ff("Carbohydrate terminal link cylinder",e,t,Nxt)},J1e={...K1e,...z1e,...Z1e,visuals:I.MultiSelect(["carbohydrate-symbol","carbohydrate-link","carbohydrate-terminal-link"],I.objectToOptions(Q1e)),bumpFrequency:I.Numeric(0,{min:0,max:10,step:.1},xt.ShadingCategory)},Uxt={name:"carbohydrate",label:"Carbohydrate",description:"Displays carbohydrate symbols (3D SNFG).",factory:function jxt(e,t){return Xn.createMulti("Carbohydrate",e,t,gl,Q1e)},getParams:function Lxt(e,t){return J1e},defaultValues:I.getDefaultValues(J1e),defaultColorTheme:{name:"carbohydrate-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.models.some(t=>Sn.hasCarbohydrate(t))};function eve(e,t){switch(e.kind){case 0:return function zxt(e,t){const n=e.model.atomicRanges.cyclicPolymerMap,r=Di.transientSegments(qP(e),e.elements),i=En.transientSegments(e.model.atomicHierarchy.residueAtomSegments,e.elements),o=e.model.atomicHierarchy.derived.residue.traceElementIndex,{moleculeType:s}=e.model.atomicHierarchy.derived.residue;let a=-1,l=-1,c=!0,u=-1,d=0;for(;r.hasNext;){for(c=!0,u=d,i.setSegment(r.move());i.hasNext;){if(c){const p=i.move().index;if(++d,!i.hasNext)continue;c=!1,l=p}a=l,l=i.move().index,t(o[a],o[l],d-1,d,s[a]),++d}n.has(l)&&(a=l,l=n.get(a),t(o[a],o[l],d-1,u,s[a]))}}(e,t);case 1:case 2:return function Vxt(e,t){const n=Di.transientSegments(qP(e),e.elements),{elements:r}=e;let i=!0,o=0;for(;n.hasNext;){i=!0;const s=n.move();for(let c=s.start,u=s.end;cu)continue;i=!1}t(r[c-1],r[c],o-1,o,0),++o}}}(e,t)}}function tve(e,t){switch(e.kind){case 0:return function Hxt(e,t){const n=Di.transientSegments(qP(e),e.elements),r=En.transientSegments(e.model.atomicHierarchy.residueAtomSegments,e.elements),i=e.model.atomicHierarchy.derived.residue.traceElementIndex;let o=0;for(;n.hasNext;)for(r.setSegment(n.move());r.hasNext;)t(i[r.move().index],o),++o}(e,t);case 1:case 2:return function Gxt(e,t){const n=Di.transientSegments(qP(e),e.elements),{elements:r}=e;let i=0;for(;n.hasNext;){const o=n.move();for(let l=o.start,c=o.end;l({}),isApplicable:e=>!0,obtain:function(){var e=le(function*(t,n){return{value:Yxt(n)}});return function(n,r){return e.apply(this,arguments)}}()});function fm(e){return pi.is(e,2)}function Z$(e,t,n={}){switch(e.kind){case 0:return new Kxt(e,t,n);case 1:case 2:return new Zxt(e,t)}}const PO=pi.create(536870912);function rve(e,t){return{center:dt.create(e,t),centerPrev:dt.create(e,t),centerNext:dt.create(e,t),first:!1,last:!1,initial:!1,final:!1,secStrucFirst:!1,secStrucLast:!1,secStrucType:PO,moleculeType:0,coarseBackboneFirst:!1,coarseBackboneLast:!1,isCoarseBackbone:!1,p0:C(),p1:C(),p2:C(),p3:C(),p4:C(),d12:C(),d23:C()}}const Un=C(),kO=C(),MO=C();class Kxt{atomicPos(t,n){-1!==n&&(t[0]=this.atomicConformation.x[n],t[1]=this.atomicConformation.y[n],t[2]=this.atomicConformation.z[n])}pos(t,n,r){const i=this.traceElementIndex[n];this.helixOrientationCenters&&fm(r)?C.fromArray(t,this.helixOrientationCenters,3*n):this.atomicPos(t,i)}updateResidueSegmentRange(t){const{index:n}=this.residueAtomSegments;this.residueSegmentMin=n[this.polymerRanges[2*t.index]],this.residueSegmentMax=n[this.polymerRanges[2*t.index+1]]}getResidueIndex(t){if(tthis.residueSegmentMax){const n=this.cyclicPolymerMap.get(this.residueSegmentMax);t=void 0!==n?n+(t-this.residueSegmentMax-1):this.residueSegmentMax}return t}getSecStruc(t){if(this.secondaryStructure){const{type:n,getIndex:r}=this.secondaryStructure,i=n[r(t)];return fm(i)?2:i}return PO}setControlPoint(t,n,r,i,o){(function Xxt(e){return pi.is(e,4)})(o)||this.helixOrientationCenters&&fm(o)?C.scale(t,C.add(t,n,C.add(t,i,C.add(t,r,r))),1/4):C.copy(t,r)}setFromToVector(t,n,r){this.value.isCoarseBackbone||this.helixOrientationCenters&&fm(r)?C.set(t,1,0,0):(this.atomicPos(kO,this.directionFromElementIndex[n]),this.atomicPos(MO,this.directionToElementIndex[n]),C.sub(t,MO,kO))}setDirection(t,n,r,i){C.matchDirection(kO,n,r),C.matchDirection(MO,i,r),C.scale(t,C.add(t,kO,C.add(t,MO,C.add(t,r,r))),1/4)}move(){const{residueIt:t,polymerIt:n,value:r}=this;if(0===this.state)for(;n.hasNext;)if(this.polymerSegment=n.move(),t.setSegment(this.polymerSegment),this.updateResidueSegmentRange(this.polymerSegment),t.hasNext){this.state=1;const i=this.residueAtomSegments.index[this.unit.elements[this.polymerSegment.start]],o=this.getResidueIndex(i-1);this.currSecStrucType=i===o?PO:this.getSecStruc(o),this.nextSecStrucType=this.getSecStruc(i),this.currCoarseBackbone=-1===this.directionFromElementIndex[o]||-1===this.directionToElementIndex[o],this.nextCoarseBackbone=-1===this.directionFromElementIndex[i]||-1===this.directionToElementIndex[i];break}if(1===this.state){const{index:i}=t.move(),o=this.getResidueIndex(i-3),s=this.getResidueIndex(i-2),a=this.getResidueIndex(i-1),l=this.getResidueIndex(i+1),c=this.getResidueIndex(i+2),u=this.getResidueIndex(i+3);this.prevSecStrucType=this.getSecStruc(a),this.currSecStrucType=this.getSecStruc(i),this.nextSecStrucType=i===l?PO:this.getSecStruc(l),this.prevCoarseBackbone=this.currCoarseBackbone,this.currCoarseBackbone=this.nextCoarseBackbone,this.nextCoarseBackbone=-1===this.directionFromElementIndex[l]||-1===this.directionToElementIndex[l],r.secStrucType=this.currSecStrucType,r.secStrucFirst=this.prevSecStrucType!==this.currSecStrucType,r.secStrucLast=this.currSecStrucType!==this.nextSecStrucType,r.isCoarseBackbone=this.currCoarseBackbone,r.coarseBackboneFirst=this.prevCoarseBackbone!==this.currCoarseBackbone,r.coarseBackboneLast=this.currCoarseBackbone!==this.nextCoarseBackbone,r.first=i===this.residueSegmentMin,r.last=i===this.residueSegmentMax,r.moleculeType=this.moleculeType[i],r.initial=i===a,r.final=i===l,r.centerPrev.element=this.traceElementIndex[a],r.center.element=this.traceElementIndex[i],r.centerNext.element=this.traceElementIndex[l];const d=this.getSecStruc(o),f=this.getSecStruc(s),p=this.getSecStruc(a),m=this.getSecStruc(i),h=this.getSecStruc(l),g=this.getSecStruc(c),y=this.getSecStruc(u);this.pos(this.p0,o,d),this.pos(this.p1,s,f),this.pos(this.p2,a,p),this.pos(this.p3,i,m),this.pos(this.p4,l,h),this.pos(this.p5,c,g),this.pos(this.p6,u,y);const v=fm(d),x=fm(f),_=fm(p),w=fm(m),A=fm(h),M=fm(g),E=fm(y);this.helixOrientationCenters&&(w!==_?w?(C.copy(this.p0,this.p3),C.copy(this.p1,this.p3),C.copy(this.p2,this.p3)):_&&(C.scale(Un,C.sub(Un,this.p2,this.p3),2),C.add(this.p2,this.p3,Un),C.add(this.p1,this.p2,Un),C.add(this.p0,this.p1,Un)):w!==x?w?(C.copy(this.p0,this.p2),C.copy(this.p1,this.p2)):x&&(C.scale(Un,C.sub(Un,this.p1,this.p2),2),C.add(this.p1,this.p2,Un),C.add(this.p0,this.p1,Un)):w!==v&&(w?C.copy(this.p0,this.p1):v&&(C.scale(Un,C.sub(Un,this.p0,this.p1),2),C.add(this.p0,this.p1,Un))),w!==A?w?(C.copy(this.p4,this.p3),C.copy(this.p5,this.p3),C.copy(this.p6,this.p3)):A&&(C.scale(Un,C.sub(Un,this.p4,this.p3),2),C.add(this.p4,this.p3,Un),C.add(this.p5,this.p4,Un),C.add(this.p6,this.p5,Un)):w!==M?w?(C.copy(this.p5,this.p4),C.copy(this.p6,this.p4)):M&&(C.scale(Un,C.sub(Un,this.p5,this.p4),2),C.add(this.p5,this.p4,Un),C.add(this.p6,this.p5,Un)):w!==E&&(w?C.copy(this.p6,this.p5):E&&(C.scale(Un,C.sub(Un,this.p6,this.p5),2),C.add(this.p6,this.p5,Un)))),this.setFromToVector(this.d01,a,p),this.setFromToVector(this.d12,i,m),this.setFromToVector(this.d23,l,h),this.setFromToVector(this.d34,c,g);const D=w&&this.helixOrientationCenters,T=1.5;i===a||m!==p&&D?(C.setMagnitude(Un,C.sub(Un,this.p3,this.p4),T),C.add(this.p2,this.p3,Un),C.add(this.p1,this.p2,Un),C.add(this.p0,this.p1,Un)):a===s||m!==f&&D?(C.setMagnitude(Un,C.sub(Un,this.p2,this.p3),T),C.add(this.p1,this.p2,Un),C.add(this.p0,this.p1,Un)):(s===o||m!==d&&D)&&(C.setMagnitude(Un,C.sub(Un,this.p1,this.p2),T),C.add(this.p0,this.p1,Un)),i===l||m!==h&&D?(C.setMagnitude(Un,C.sub(Un,this.p3,this.p2),T),C.add(this.p4,this.p3,Un),C.add(this.p5,this.p4,Un),C.add(this.p6,this.p5,Un)):l===c||m!==g&&D?(C.setMagnitude(Un,C.sub(Un,this.p4,this.p3),T),C.add(this.p5,this.p4,Un),C.add(this.p6,this.p5,Un)):(c===u||m!==y&&D)&&(C.setMagnitude(Un,C.sub(Un,this.p5,this.p4),T),C.add(this.p6,this.p5,Un)),this.setControlPoint(r.p0,this.p0,this.p1,this.p2,f),this.setControlPoint(r.p1,this.p1,this.p2,this.p3,p),this.setControlPoint(r.p2,this.p2,this.p3,this.p4,m),this.setControlPoint(r.p3,this.p3,this.p4,this.p5,h),this.setControlPoint(r.p4,this.p4,this.p5,this.p6,g),this.setDirection(r.d12,this.d01,this.d12,this.d23),this.setDirection(r.d23,this.d12,this.d23,this.d34),t.hasNext||(this.state=0)}return this.hasNext=t.hasNext||n.hasNext,this.value}constructor(t,n,r={}){var i;if(this.unit=t,this.state=0,this.p0=C(),this.p1=C(),this.p2=C(),this.p3=C(),this.p4=C(),this.p5=C(),this.p6=C(),this.d01=C(),this.d12=C(),this.d23=C(),this.d34=C(),this.hasNext=!1,this.atomicConformation=t.model.atomicConformation,this.residueAtomSegments=t.model.atomicHierarchy.residueAtomSegments,this.polymerRanges=t.model.atomicRanges.polymerRanges,this.traceElementIndex=t.model.atomicHierarchy.derived.residue.traceElementIndex,this.directionFromElementIndex=t.model.atomicHierarchy.derived.residue.directionFromElementIndex,this.directionToElementIndex=t.model.atomicHierarchy.derived.residue.directionToElementIndex,this.moleculeType=t.model.atomicHierarchy.derived.residue.moleculeType,this.cyclicPolymerMap=t.model.atomicRanges.cyclicPolymerMap,this.polymerIt=Di.transientSegments(this.polymerRanges,t.elements),this.residueIt=En.transientSegments(this.residueAtomSegments,t.elements),this.value=rve(n,t),this.hasNext=this.residueIt.hasNext&&this.polymerIt.hasNext,r.ignoreSecondaryStructure||(this.secondaryStructure=null===(i=gp.get(n).value)||void 0===i?void 0:i.get(t.invariantId)),r.useHelixOrientation){const o=K$.get(t.model).value;if(!o)throw new Error("missing helix-orientation");this.helixOrientationCenters=o.centers}}}class Zxt{getElementIndex(t){return Math.min(Math.max(this.polymerSegment.start,t),this.polymerSegment.end-1)}pos(t,n){const r=this.unit.elements[n];t[0]=this.conformation.x[r],t[1]=this.conformation.y[r],t[2]=this.conformation.z[r]}move(){if(0===this.state)for(;this.polymerIt.hasNext;)if(this.polymerSegment=this.polymerIt.move(),this.elementIndex=this.polymerSegment.start,this.elementIndex=this.polymerSegment.end&&(this.state=0)}return this.hasNext=this.elementIndex+1=0)){a=c;break}}if(s<0)return!1;let l=s;for(let c=o;c>a;c--){const u=n[c];if(u<0)continue;const d=Ve.indexOf(t,u);if(d>=0){l=d;break}}return r(Pe.ofRange(e+s,e+l))}function pve(e,t,n,r,i){let o=!1;const{elements:s}=i.unit,{traceElementIndex:a}=i.unit.model.atomicHierarchy.derived.residue,{index:l}=i.unit.model.atomicHierarchy.residueAtomSegments,c=n(i.unit);if(Pe.is(i.indices))o=0===Pe.start(i.indices)&&Pe.end(i.indices)===i.unit.elements.length?r(Pe.ofBounds(e,e+t))||o:fve(e,c,a,r,l[s[Pe.min(i.indices)]],l[s[Pe.max(i.indices)]])||o;else{const{indices:u}=i;for(let d=0,f=u.length;d1)break;m=g,h++}d=h-1,o=fve(e,c,a,r,p,m)||o}}return o}function s_t(e){return e.polymerElements}function _2(e,t,n){let r=!1;if(!Me.is(e))return!1;const{structure:i,group:o}=t;if(!Xe.areEquivalent(e.structure,i))return!1;const s=o.units[0].polymerElements.length;for(const a of e.elements){if(!o.unitIndexMap.has(a.unit.id))continue;const l=o.unitIndexMap.get(a.unit.id)*s;if(ze.isAtomic(a.unit))r=pve(l,s,s_t,n,a)||r;else if(Pe.is(a.indices)){const c=l+Pe.start(a.indices),u=l+Pe.end(a.indices);r=n(Pe.ofBounds(c,u))||r}else for(let c=0,u=a.indices.length;c{const u=Ve.indexOf(a.unit.gapElements,a.unit.elements[c]);-1!==u&&n(Pe.ofSingleton(l*s+u))&&(r=!0)})}}return r}function S2(e,t,n){const{objectId:r,instanceId:i,groupId:o}=e;if(n===r){const{structure:s,group:a}=t,l=a.units[i];if(ze.isAtomic(l))return Mye(s,l,l.nucleotideElements[o])}return qr}function c_t(e){return e.nucleotideElements}function C2(e,t,n){let r=!1;if(!Me.is(e))return!1;const{structure:i,group:o}=t;if(!Xe.areEquivalent(e.structure,i))return!1;const s=o.units[0];if(!ze.isAtomic(s))return!1;const{nucleotideElements:a}=s,l=a.length;for(const c of e.elements){if(!ze.isAtomic(c.unit)||!o.unitIndexMap.has(c.unit.id))continue;const u=o.unitIndexMap.get(c.unit.id)*l;ze.isAtomic(c.unit)&&(r=pve(u,l,c_t,n,c)||r)}return r}!function(e){e.fromGroup=function t(n,r){const{group:i,structure:o}=n,s=i.units[0].polymerElements,a=s.length,l=i.units.length,c=dt.create(o),d=!!r?.asSecondary;return Vi(a,l,1,(p,m)=>(c.unit=i.units[m],c.element=s[p],c),!1,function f(p,m){return d})}}(nb||(nb={})),function(e){e.fromGroup=function t(n){const{group:r,structure:i}=n,o=r.units[0].gapElements,s=o.length,a=r.units.length,l=dt.create(i);return Vi(s,a,1,(u,d)=>(l.unit=r.units[d],l.element=o[u],l))}}(aY||(aY={})),function(e){e.fromGroup=function t(n){const{group:r,structure:i}=n,o=r.units[0],s=ze.isAtomic(o)?o.nucleotideElements:[],a=s.length,l=r.units.length,c=dt.create(i);return Vi(a,l,1,(d,f)=>(c.unit=r.units[f],c.element=s[d],c))}}(rb||(rb={}));const u_t=C(),d_t=C();function w2(e,t){const{model:n,conformation:r}=e,{residueAtomSegments:i,atoms:o,index:s}=n.atomicHierarchy,{label_comp_id:a}=o,l=a.value(i.offsets[t]);let c=w6e(l),u=A6e(l);if(!c&&!u){const d=s.findAtomOnResidue(t,"C4"),f=s.findAtomOnResidue(t,"N9");-1!==d&&-1!==f&&C.distance(r.invariantPosition(d,u_t),r.invariantPosition(f,d_t))<1.6?c=!0:u=!0}return{isPurine:c,isPyrimidine:u}}function I2(e,t,n){const r=t.model.atomicHierarchy.index,{traceElementIndex:i}=t.model.atomicHierarchy.derived.residue;return e.trace=i[n],e.N1=r.findAtomOnResidue(n,"N1"),e.C2=r.findAtomOnResidue(n,"C2"),e.N3=r.findAtomOnResidue(n,"N3"),e.C4=r.findAtomOnResidue(n,"C4"),e.C5=r.findAtomOnResidue(n,"C5"),-1===e.C5&&(e.C5=r.findAtomOnResidue(n,"N5")),e.C6=r.findAtomOnResidue(n,"C6"),e.N7=r.findAtomOnResidue(n,"N7"),-1===e.N7&&(e.N7=r.findAtomOnResidue(n,"C7")),e.C8=r.findAtomOnResidue(n,"C8"),e.N9=r.findAtomOnResidue(n,"N9"),e}function YA(e){return-1!==e.trace&&-1!==e.N1&&-1!==e.C2&&-1!==e.N3&&-1!==e.C4&&-1!==e.C5&&-1!==e.C6&&-1!==e.N7&&-1!==e.C8&&-1!==e.N9}function E2(e,t,n){const r=t.model.atomicHierarchy.index,{traceElementIndex:i}=t.model.atomicHierarchy.derived.residue;return e.trace=i[n],e.N1=r.findAtomOnResidue(n,"N1"),-1===e.N1&&(e.N1=r.findAtomOnResidue(n,"C1")),e.C2=r.findAtomOnResidue(n,"C2"),e.N3=r.findAtomOnResidue(n,"N3"),e.C4=r.findAtomOnResidue(n,"C4"),e.C5=r.findAtomOnResidue(n,"C5"),e.C6=r.findAtomOnResidue(n,"C6"),e}function XA(e){return-1!==e.trace&&-1!==e.N1&&-1!==e.C2&&-1!==e.N3&&-1!==e.C4&&-1!==e.C5&&-1!==e.C6}function WP(e,t,n){const r=t.model.atomicHierarchy.index,{traceElementIndex:i}=t.model.atomicHierarchy.derived.residue;return e.trace=i[n],e.C1_1=r.findAtomOnResidue(n,"C1'"),e.C2_1=r.findAtomOnResidue(n,"C2'"),e.C3_1=r.findAtomOnResidue(n,"C3'"),e.C4_1=r.findAtomOnResidue(n,"C4'"),e.O4_1=r.findAtomOnResidue(n,"O4'"),e}function $P(e){return-1!==e.trace&&-1!==e.C1_1&&-1!==e.C2_1&&-1!==e.C3_1&&-1!==e.C4_1&&-1!==e.O4_1}const BO=C(),lY=C(),hve=C(),mve=C(),gve=C(),yve=C(),LO=C(),cY=C(),uY=C(),bve=C(),YP=fe.identity(),f_t=C(),vve=X9(),xve={sizeFactor:I.Numeric(.2,{min:0,max:10,step:.01}),thicknessFactor:I.Numeric(1,{min:0,max:2,step:.01}),radialSegments:I.Numeric(16,{min:2,max:56,step:2},xt.CustomQualityParamInfo)};function p_t(e,t,n,r,i,o){if(!ze.isAtomic(t))return on.createEmpty(o);const s=t.nucleotideElements.length;if(!s)return on.createEmpty(o);const{sizeFactor:a,thicknessFactor:l,radialSegments:c}=i,u=s*(vve.vertices.length/3+2*c),d=Ct.createState(u,u/4,o),{elements:f,model:p,conformation:m}=t,{chainAtomSegments:h,residueAtomSegments:g}=p.atomicHierarchy,{moleculeType:y}=p.atomicHierarchy.derived.residue,v=En.transientSegments(h,f),x=En.transientSegments(g,f),_=1*a,A=l*a*2,M={radiusTop:_,radiusBottom:_,radialSegments:c,bottomCap:!0};let E=0;for(;v.hasNext;)for(x.setSegment(v.move());x.hasNext;){const{index:F}=x.move();if(Fu(y[F])){const R={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};let N=-1,j=-1,W=-1,z=-1,$=-1,V=4.5;const{isPurine:X,isPyrimidine:H}=w2(t,F);X?(V=4.5,I2(R,t,F),N=R.N1,j=R.C4,W=R.C6,z=R.C2,$=R.N9):H&&(V=3,E2(R,t,F),N=R.N3,j=R.C6,W=R.C4,z=R.C2,$=R.N1),-1!==$&&-1!==R.trace&&(m.invariantPosition($,gve),m.invariantPosition(R.trace,yve),d.currentGroup=E,Ur(d,gve,yve,1,M),-1!==N&&-1!==j&&-1!==W&&-1!==z&&(m.invariantPosition(N,BO),m.invariantPosition(j,lY),m.invariantPosition(W,hve),m.invariantPosition(z,mve),C.normalize(LO,C.sub(LO,lY,BO)),C.normalize(cY,C.sub(cY,mve,hve)),C.normalize(uY,C.cross(uY,LO,cY)),fe.targetTo(YP,BO,lY,uY),C.scaleAndAdd(bve,BO,LO,V/2-.2),fe.scale(YP,YP,C.set(f_t,4.5,A,V)),fe.setTranslation(YP,bve),Ct.addPrimitive(d,YP,vve))),++E}}const D=Ct.getMesh(d),T=ke.expand(ke(),t.boundary.sphere,_);return D.setBoundingSphere(T),D}I.getDefaultValues(xve);const _ve={...ml,...xve};function h_t(e){return mc({defaultProps:I.getDefaultValues(_ve),createGeometry:p_t,createLocationIterator:rb.fromGroup,getLoci:S2,eachLocation:C2,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.thicknessFactor!==r.thicknessFactor||n.radialSegments!==r.radialSegments}},e)}const jO=C(),gv=C(),UO=C(),zO=C(),KA=C(),ZA=C(),VO=C(),Sve=C(),Cve=C(),HO=C(),yv=C(),wve={sizeFactor:I.Numeric(.2,{min:0,max:10,step:.01}),thicknessFactor:I.Numeric(1,{min:0,max:2,step:.01}),radialSegments:I.Numeric(16,{min:2,max:56,step:2},xt.CustomQualityParamInfo),detail:I.Numeric(0,{min:0,max:3,step:1},xt.CustomQualityParamInfo)},GO=(I.getDefaultValues(wve),new Float32Array(54)),m_t=new Uint32Array([0,1,2,3,4,5,6,7,16,17,14,15,12,13,8,9,10,11,0,1]),g_t=new Uint32Array([8,12,14,16,6,4,2,0,10]),y_t=new Uint32Array([9,11,1,3,5,7,17,15,13]),qO=new Float32Array(36),b_t=new Uint32Array([0,1,2,3,4,5,6,7,8,9,10,11,0,1]),v_t=new Uint32Array([0,10,8,6,4,2]),x_t=new Uint32Array([1,3,5,7,9,11]),Ave=C();function Ive(e,t,...n){for(let r=0,i=n.length;r{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.thicknessFactor!==r.thicknessFactor||n.radialSegments!==r.radialSegments}},e)}const QA=C(),WO=C(),$O=C(),JA=C(),eI=C(),YO=C(),Tve=C(),Dve=C(),Pve=C(),XO=C(),dY=C(),KO=C(),ZO=C(),fY=C(),tI=C(),yc=C(),nI=C(),kve={sizeFactor:I.Numeric(.2,{min:0,max:10,step:.01}),thicknessFactor:I.Numeric(1,{min:0,max:2,step:.01})},QO=(I.getDefaultValues(kve),new Float32Array(54)),C_t=new Uint32Array([0,1,2,3,4,5,6,7,16,17,14,15,12,13,8,9,10,11,0,1]),w_t=new Uint32Array([8,12,14,16,6,4,2,0,10]),A_t=new Uint32Array([9,11,1,3,5,7,17,15,13]),JO=new Float32Array(36),I_t=new Uint32Array([2,3,4,5,6,7,8,9,10,11,2,3]),E_t=new Uint32Array([0,10,8,6,4,2,10]),T_t=new Uint32Array([1,3,5,7,9,11,3]),eB=new Float32Array(36),D_t=new Uint32Array([0,1,2,3,4,5,6,7,8,9,10,11,0,1]),P_t=new Uint32Array([0,10,8,6,4,2]),k_t=new Uint32Array([1,3,5,7,9,11]),Mve=C();function pY(e,t,...n){for(let r=0,i=n.length;r{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.thicknessFactor!==r.thicknessFactor}},e)}const bc=C(),fo=C(),xl=C(),_l=C(),Zs=C(),Qs=C(),Sl=C(),Lg=C(),jg=C(),Pa=C(),ka=C(),Ug=C(),Ld=C(),zg=C(),Vg=C(),hY={...ml,..._W,sizeFactor:I.Numeric(.3,{min:0,max:10,step:.01}),radialSegments:I.Numeric(16,{min:2,max:56,step:2},xt.CustomQualityParamInfo),tryUseImpostor:I.Boolean(!0)};function N_t(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth?function O_t(e){return SW({defaultProps:I.getDefaultValues(hY),createGeometry:F_t,createLocationIterator:rb.fromGroup,getLoci:S2,eachLocation:C2,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function L_t(e){return mc({defaultProps:I.getDefaultValues(hY),createGeometry:B_t,createLocationIterator:rb.fromGroup,getLoci:S2,eachLocation:C2,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.radialSegments!==r.radialSegments},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}function F_t(e,t,n,r,i,o){if(!ze.isAtomic(t))return Wu.createEmpty(o);const s=t.nucleotideElements.length;if(!s)return Wu.createEmpty(o);const a=15*s,l=NP.create(a,a/4,o),{elements:c,model:u,conformation:d}=t,{chainAtomSegments:f,residueAtomSegments:p}=u.atomicHierarchy,{moleculeType:m}=u.atomicHierarchy.derived.residue,h=En.transientSegments(f,c),g=En.transientSegments(p,c);let y=0;for(;h.hasNext;)for(g.setSegment(h.move());g.hasNext;){const{index:w}=g.move();if(Fu(m[w])){const A={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};WP(A,t,w),$P(A)&&(d.invariantPosition(A.C1_1,ka),d.invariantPosition(A.C2_1,Ug),d.invariantPosition(A.C3_1,Ld),d.invariantPosition(A.C4_1,zg),d.invariantPosition(A.O4_1,Vg),d.invariantPosition(A.trace,bc),l.add(Ld[0],Ld[1],Ld[2],bc[0],bc[1],bc[2],1,!0,!0,2,y),l.add(Ld[0],Ld[1],Ld[2],zg[0],zg[1],zg[2],1,!0,!0,2,y),l.add(zg[0],zg[1],zg[2],Vg[0],Vg[1],Vg[2],1,!0,!0,2,y),l.add(Vg[0],Vg[1],Vg[2],ka[0],ka[1],ka[2],1,!0,!0,2,y),l.add(ka[0],ka[1],ka[2],Ug[0],Ug[1],Ug[2],1,!0,!0,2,y),l.add(Ug[0],Ug[1],Ug[2],Ld[0],Ld[1],Ld[2],1,!0,!0,2,y));const{isPurine:M,isPyrimidine:E}=w2(t,w);M?(I2(A,t,w),-1!==A.C1_1&&-1!==A.N9?(d.invariantPosition(A.C1_1,ka),d.invariantPosition(A.N9,Pa),l.add(Pa[0],Pa[1],Pa[2],ka[0],ka[1],ka[2],1,!0,!0,2,y)):-1!==A.N9&&-1!==A.trace&&(d.invariantPosition(A.N9,Pa),d.invariantPosition(A.trace,bc),l.add(Pa[0],Pa[1],Pa[2],bc[0],bc[1],bc[2],1,!0,!0,2,y)),YA(A)&&(d.invariantPosition(A.N1,fo),d.invariantPosition(A.C2,xl),d.invariantPosition(A.N3,_l),d.invariantPosition(A.C4,Zs),d.invariantPosition(A.C5,Qs),d.invariantPosition(A.C6,Sl),d.invariantPosition(A.N7,Lg),d.invariantPosition(A.C8,jg),d.invariantPosition(A.N9,Pa),l.add(Pa[0],Pa[1],Pa[2],jg[0],jg[1],jg[2],1,!0,!0,2,y),l.add(jg[0],jg[1],jg[2],Lg[0],Lg[1],Lg[2],1,!0,!0,2,y),l.add(Lg[0],Lg[1],Lg[2],Qs[0],Qs[1],Qs[2],1,!0,!0,2,y),l.add(Qs[0],Qs[1],Qs[2],Sl[0],Sl[1],Sl[2],1,!0,!0,2,y),l.add(Sl[0],Sl[1],Sl[2],fo[0],fo[1],fo[2],1,!0,!0,2,y),l.add(fo[0],fo[1],fo[2],xl[0],xl[1],xl[2],1,!0,!0,2,y),l.add(xl[0],xl[1],xl[2],_l[0],_l[1],_l[2],1,!0,!0,2,y),l.add(_l[0],_l[1],_l[2],Zs[0],Zs[1],Zs[2],1,!0,!0,2,y),l.add(Zs[0],Zs[1],Zs[2],Qs[0],Qs[1],Qs[2],1,!0,!0,2,y),l.add(Zs[0],Zs[1],Zs[2],Pa[0],Pa[1],Pa[2],1,!0,!0,2,y))):E&&(E2(A,t,w),-1!==A.C1_1&&-1!==A.N1?(d.invariantPosition(A.N1,fo),d.invariantPosition(A.C1_1,ka),l.add(fo[0],fo[1],fo[2],ka[0],ka[1],ka[2],1,!0,!0,2,y)):-1!==A.N1&&-1!==A.trace&&(d.invariantPosition(A.N1,fo),d.invariantPosition(A.trace,bc),l.add(fo[0],fo[1],fo[2],bc[0],bc[1],bc[2],1,!0,!0,2,y)),XA(A)&&(d.invariantPosition(A.N1,fo),d.invariantPosition(A.C2,xl),d.invariantPosition(A.N3,_l),d.invariantPosition(A.C4,Zs),d.invariantPosition(A.C5,Qs),d.invariantPosition(A.C6,Sl),l.add(fo[0],fo[1],fo[2],Sl[0],Sl[1],Sl[2],1,!0,!0,2,y),l.add(Sl[0],Sl[1],Sl[2],Qs[0],Qs[1],Qs[2],1,!0,!0,2,y),l.add(Qs[0],Qs[1],Qs[2],Zs[0],Zs[1],Zs[2],1,!0,!0,2,y),l.add(Zs[0],Zs[1],Zs[2],_l[0],_l[1],_l[2],1,!0,!0,2,y),l.add(_l[0],_l[1],_l[2],xl[0],xl[1],xl[2],1,!0,!0,2,y),l.add(xl[0],xl[1],xl[2],fo[0],fo[1],fo[2],1,!0,!0,2,y))),++y}}const x=l.getCylinders(),_=ke.expand(ke(),t.boundary.sphere,1*i.sizeFactor);return x.setBoundingSphere(_),x}function B_t(e,t,n,r,i,o){if(!ze.isAtomic(t))return on.createEmpty(o);const s=t.nucleotideElements.length;if(!s)return on.createEmpty(o);const{sizeFactor:a,radialSegments:l}=i,c=s*(15*l),u=Ct.createState(c,c/4,o),{elements:d,model:f,conformation:p}=t,{chainAtomSegments:m,residueAtomSegments:h}=f.atomicHierarchy,{moleculeType:g}=f.atomicHierarchy.derived.residue,y=En.transientSegments(m,d),v=En.transientSegments(h,d),x={radiusTop:1*a,radiusBottom:1*a,radialSegments:l};let _=0;for(;y.hasNext;)for(v.setSegment(y.move());v.hasNext;){const{index:M}=v.move();if(Fu(g[M])){const E={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};u.currentGroup=_,WP(E,t,M),$P(E)&&(p.invariantPosition(E.C1_1,ka),p.invariantPosition(E.C2_1,Ug),p.invariantPosition(E.C3_1,Ld),p.invariantPosition(E.C4_1,zg),p.invariantPosition(E.O4_1,Vg),p.invariantPosition(E.trace,bc),Ur(u,Ld,bc,1,x),Ur(u,Ld,zg,1,x),Ur(u,zg,Vg,1,x),Ur(u,Vg,ka,1,x),Ur(u,ka,Ug,1,x),Ur(u,Ug,Ld,1,x));const{isPurine:D,isPyrimidine:T}=w2(t,M);D?(I2(E,t,M),-1!==E.C1_1&&-1!==E.N9?(p.invariantPosition(E.C1_1,ka),p.invariantPosition(E.N9,Pa),Ur(u,Pa,ka,1,x)):-1!==E.N9&&-1!==E.trace&&(p.invariantPosition(E.N9,Pa),p.invariantPosition(E.trace,bc),Ur(u,Pa,bc,1,x)),YA(E)&&(p.invariantPosition(E.N1,fo),p.invariantPosition(E.C2,xl),p.invariantPosition(E.N3,_l),p.invariantPosition(E.C4,Zs),p.invariantPosition(E.C5,Qs),p.invariantPosition(E.C6,Sl),p.invariantPosition(E.N7,Lg),p.invariantPosition(E.C8,jg),p.invariantPosition(E.N9,Pa),Ur(u,Pa,jg,1,x),Ur(u,jg,Lg,1,x),Ur(u,Lg,Qs,1,x),Ur(u,Qs,Sl,1,x),Ur(u,Sl,fo,1,x),Ur(u,fo,xl,1,x),Ur(u,xl,_l,1,x),Ur(u,_l,Zs,1,x),Ur(u,Zs,Qs,1,x),Ur(u,Zs,Pa,1,x))):T&&(E2(E,t,M),-1!==E.C1_1&&-1!==E.N1?(p.invariantPosition(E.N1,fo),p.invariantPosition(E.C1_1,ka),Ur(u,fo,ka,1,x)):-1!==E.N1&&-1!==E.trace&&(p.invariantPosition(E.N1,fo),p.invariantPosition(E.trace,bc),Ur(u,fo,bc,1,x)),XA(E)&&(p.invariantPosition(E.N1,fo),p.invariantPosition(E.C2,xl),p.invariantPosition(E.N3,_l),p.invariantPosition(E.C4,Zs),p.invariantPosition(E.C5,Qs),p.invariantPosition(E.C6,Sl),Ur(u,fo,Sl,1,x),Ur(u,Sl,Qs,1,x),Ur(u,Qs,Zs,1,x),Ur(u,Zs,_l,1,x),Ur(u,_l,xl,1,x),Ur(u,xl,fo,1,x))),++_}}const w=Ct.getMesh(u),A=ke.expand(ke(),t.boundary.sphere,1*i.sizeFactor);return w.setBoundingSphere(A),w}const rI=C(),Wp=C(),$p=C(),Yp=C(),Xp=C(),Of=C(),Kp=C(),iI=C(),oI=C(),sI=C(),aI=C(),lI=C(),cI=C(),uI=C(),dI=C(),mY={...ml,...vW,sizeFactor:I.Numeric(.3,{min:0,max:10,step:.01}),detail:I.Numeric(0,{min:0,max:3,step:1},xt.CustomQualityParamInfo),tryUseImpostor:I.Boolean(!0)};function j_t(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth?function z_t(e){return xW({defaultProps:I.getDefaultValues(mY),createGeometry:U_t,createLocationIterator:rb.fromGroup,getLoci:S2,eachLocation:C2,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function H_t(e){return mc({defaultProps:I.getDefaultValues(mY),createGeometry:V_t,createLocationIterator:rb.fromGroup,getLoci:S2,eachLocation:C2,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}function U_t(e,t,n,r,i,o){if(!ze.isAtomic(t))return Rp.createEmpty(o);const s=t.nucleotideElements.length;if(!s)return Rp.createEmpty(o);const a=15*s,l=HA.create(a,a/4,o),{elements:c,model:u,conformation:d}=t,{chainAtomSegments:f,residueAtomSegments:p}=u.atomicHierarchy,{moleculeType:m}=u.atomicHierarchy.derived.residue,h=En.transientSegments(f,c),g=En.transientSegments(p,c);let y=0;for(;h.hasNext;)for(g.setSegment(h.move());g.hasNext;){const{index:_}=g.move();if(Fu(m[_])){const w={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};WP(w,t,_),$P(w)&&(d.invariantPosition(w.C1_1,aI),d.invariantPosition(w.C2_1,lI),d.invariantPosition(w.C3_1,cI),d.invariantPosition(w.C4_1,uI),d.invariantPosition(w.O4_1,dI),d.invariantPosition(w.trace,rI),l.add(rI[0],rI[1],rI[2],y),l.add(cI[0],cI[1],cI[2],y),l.add(uI[0],uI[1],uI[2],y),l.add(dI[0],dI[1],dI[2],y),l.add(aI[0],aI[1],aI[2],y),l.add(lI[0],lI[1],lI[2],y));const{isPurine:A,isPyrimidine:M}=w2(t,_);A?(I2(w,t,_),YA(w)&&(d.invariantPosition(w.N1,Wp),d.invariantPosition(w.C2,$p),d.invariantPosition(w.N3,Yp),d.invariantPosition(w.C4,Xp),d.invariantPosition(w.C5,Of),d.invariantPosition(w.C6,Kp),d.invariantPosition(w.N7,iI),d.invariantPosition(w.C8,oI),d.invariantPosition(w.N9,sI),l.add(sI[0],sI[1],sI[2],y),l.add(oI[0],oI[1],oI[2],y),l.add(iI[0],iI[1],iI[2],y),l.add(Of[0],Of[1],Of[2],y),l.add(Kp[0],Kp[1],Kp[2],y),l.add(Wp[0],Wp[1],Wp[2],y),l.add($p[0],$p[1],$p[2],y),l.add(Yp[0],Yp[1],Yp[2],y),l.add(Xp[0],Xp[1],Xp[2],y))):M&&(E2(w,t,_),XA(w)&&(d.invariantPosition(w.N1,Wp),d.invariantPosition(w.C2,$p),d.invariantPosition(w.N3,Yp),d.invariantPosition(w.C4,Xp),d.invariantPosition(w.C5,Of),d.invariantPosition(w.C6,Kp),l.add(Wp[0],Wp[1],Wp[2],y),l.add(Kp[0],Kp[1],Kp[2],y),l.add(Of[0],Of[1],Of[2],y),l.add(Xp[0],Xp[1],Xp[2],y),l.add(Yp[0],Yp[1],Yp[2],y),l.add($p[0],$p[1],$p[2],y))),++y}}const v=l.getSpheres(),x=ke.expand(ke(),t.boundary.sphere,1*i.sizeFactor);return v.setBoundingSphere(x),v}function V_t(e,t,n,r,i,o){if(!ze.isAtomic(t))return on.createEmpty(o);const s=t.nucleotideElements.length;if(!s)return on.createEmpty(o);const{sizeFactor:a,detail:l}=i,c=s*qw(l),u=Ct.createState(c,c/2,o),{elements:d,model:f,conformation:p}=t,{chainAtomSegments:m,residueAtomSegments:h}=f.atomicHierarchy,{moleculeType:g}=f.atomicHierarchy.derived.residue,y=En.transientSegments(m,d),v=En.transientSegments(h,d),x=1*a;let _=0;for(;y.hasNext;)for(v.setSegment(y.move());v.hasNext;){const{index:M}=v.move();if(Fu(g[M])){const E={trace:-1,N1:-1,C2:-1,N3:-1,C4:-1,C5:-1,C6:-1,N7:-1,C8:-1,N9:-1,C1_1:-1,C2_1:-1,C3_1:-1,C4_1:-1,O4_1:-1};u.currentGroup=_,WP(E,t,M),$P(E)&&(p.invariantPosition(E.C1_1,aI),p.invariantPosition(E.C2_1,lI),p.invariantPosition(E.C3_1,cI),p.invariantPosition(E.C4_1,uI),p.invariantPosition(E.O4_1,dI),p.invariantPosition(E.trace,rI),Jr(u,rI,x,l),Jr(u,uI,x,l),Jr(u,dI,x,l),Jr(u,aI,x,l),Jr(u,lI,x,l),Jr(u,cI,x,l));const{isPurine:D,isPyrimidine:T}=w2(t,M);D?(I2(E,t,M),YA(E)&&(p.invariantPosition(E.N1,Wp),p.invariantPosition(E.C2,$p),p.invariantPosition(E.N3,Yp),p.invariantPosition(E.C4,Xp),p.invariantPosition(E.C5,Of),p.invariantPosition(E.C6,Kp),p.invariantPosition(E.N7,iI),p.invariantPosition(E.C8,oI),p.invariantPosition(E.N9,sI),Jr(u,oI,x,l),Jr(u,iI,x,l),Jr(u,Of,x,l),Jr(u,Kp,x,l),Jr(u,Wp,x,l),Jr(u,$p,x,l),Jr(u,Yp,x,l),Jr(u,Xp,x,l),Jr(u,Of,x,l),Jr(u,sI,x,l))):T&&(E2(E,t,M),XA(E)&&(p.invariantPosition(E.N1,Wp),p.invariantPosition(E.C2,$p),p.invariantPosition(E.N3,Yp),p.invariantPosition(E.C4,Xp),p.invariantPosition(E.C5,Of),p.invariantPosition(E.C6,Kp),Jr(u,Kp,x,l),Jr(u,Of,x,l),Jr(u,Xp,x,l),Jr(u,Yp,x,l),Jr(u,$p,x,l),Jr(u,Wp,x,l))),++_}}const w=Ct.getMesh(u),A=ke.expand(ke(),t.boundary.sphere,1*i.sizeFactor);return w.setBoundingSphere(A),w}const T2=C.zero(),fI=C.zero(),D2=C.zero(),Nve=C.zero(),Ka=gg(3,!1);let gY;const P2=fe.identity(),W_t=C.zero(),Fve=C.zero(),Ove=C.zero(),bY=C.zero(),$_t=4,Y_t=4,X_t=6,K_t=function q_t(){return gY||(gY=function G_t(){const e=Hw(8);for(let t=0;t<3;++t){const n=(t+1)%3;C.set(T2,Ka[3*t],Ka[3*t+1],-.5),C.set(fI,Ka[3*n],Ka[3*n+1],-.5),C.set(D2,Ka[3*n],Ka[3*n+1],.5),C.set(Nve,Ka[3*t],Ka[3*t+1],.5),e.add(T2,fI,D2),e.add(D2,Nve,T2)}return C.set(T2,Ka[0],Ka[1],-.5),C.set(fI,Ka[3],Ka[4],-.5),C.set(D2,Ka[6],Ka[7],-.5),e.add(D2,fI,T2),C.set(T2,Ka[0],Ka[1],.5),C.set(fI,Ka[3],Ka[4],.5),C.set(D2,Ka[6],Ka[7],.5),e.add(T2,fI,D2),e.getPrimitive()}()),gY}(),Bve={sizeFactor:I.Numeric(.2,{min:0,max:10,step:.01})};function Z_t(e,t,n,r,i,o){const s=t.polymerElements.length;if(!s)return on.createEmpty(o);const{sizeFactor:a}=i,l=24*s,c=Ct.createState(l,l/10,o),d=eY(1),{normalVectors:f,binormalVectors:p}=d;let m=0;const h=Z$(t,n);for(;h.hasNext;){const v=h.move();c.currentGroup=m;const x=Fu(v.moleculeType),_=pi.is(v.secStrucType,4);if(tY(d,v,x||_?.5:.9,x?.3:.5),_&&!v.secStrucLast||!_){const M=r.size.size(v.center)*a,E=$_t*M,D=Y_t*M,T=X_t*M,F=x?p:f;C.fromArray(Fve,F,0),C.fromArray(Ove,F,3),C.normalize(bY,C.add(bY,Fve,Ove)),fe.targetTo(P2,v.p3,v.p1,bY),fe.mul(P2,P2,fe.rotY90Z180),fe.scale(P2,P2,C.set(W_t,T,D,E)),fe.setTranslation(P2,v.p2),Ct.addPrimitive(c,P2,K_t)}++m}const g=Ct.getMesh(c),y=ke.expand(ke(),t.boundary.sphere,1*i.sizeFactor);return g.setBoundingSphere(y),g}I.getDefaultValues(Bve);const Lve={...ml,...Bve};function Q_t(e){return mc({defaultProps:I.getDefaultValues(Lve),createGeometry:Z_t,createLocationIterator:t=>nb.fromGroup(t),getLoci:x2,eachLocation:_2,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor}},e)}const vY=10,jve={sizeFactor:I.Numeric(.2,{min:0,max:10,step:.01}),radialSegments:I.Numeric(16,{min:2,max:56,step:2},xt.CustomQualityParamInfo)};function J_t(e,t,n,r,i,o){const s=t.gapElements.length;if(!s)return on.createEmpty(o);const{sizeFactor:a,radialSegments:l}=i,c=vY*l*2*s*2,u=Ct.createState(c,c/10,o),d=C(),f=C(),p={radiusTop:1,radiusBottom:1,topCap:!0,bottomCap:!0,radialSegments:l};let m=0;const h=function qxt(e,t){switch(t.kind){case 0:return new Wxt(e,t);case 1:case 2:return new $xt(e,t)}}(n,t);for(;h.hasNext;){const{centerA:v,centerB:x}=h.move();v.element===x.element||(t.conformation.invariantPosition(v.element,d),t.conformation.invariantPosition(x.element,f),p.radiusTop=p.radiusBottom=r.size.size(v)*a,u.currentGroup=m,Yw(u,d,f,.5,vY,!1,p),p.radiusTop=p.radiusBottom=r.size.size(x)*a,u.currentGroup=m+1,Yw(u,f,d,.5,vY,!1,p)),m+=2}const g=Ct.getMesh(u),y=ke.expand(ke(),t.boundary.sphere,1*i.sizeFactor);return g.setBoundingSphere(y),g}I.getDefaultValues(jve);const tB={...ml,...jve};function xY(e){return mc({defaultProps:I.getDefaultValues(tB),createGeometry:J_t,createLocationIterator:aY.fromGroup,getLoci:a_t,eachLocation:l_t,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.radialSegments!==r.radialSegments}},e)}const oi=C(),Ri=C(),e2t=C(),Bf=C(),Hg=C(),nB=C(),rB=C(),XP=C(),hm=C(),Gg=C(),_Y=C(),bv=C(),vv=C(),xv=C(),_v=C(),Zp=C.fromArray,pI=C.scale,Qp=C.add,ib=C.sub,t2t=C.magnitude,Uve=C.negate,SY=C.copy,zve=C.cross,n2t=C.set,Yi=tt.add3,r2t=tt.add;function iB(e,t,n,r,i,o,s,a,l){const{vertices:c,normals:u,indices:d}=t,f=c.elementCount;if(Zp(oi,r,e),pI(rB,oi,s),pI(nB,oi,a),Zp(Ri,i,e),pI(Bf,Ri,o),zve(Gg,Ri,oi),Zp(hm,n,e),Qp(bv,Qp(bv,hm,Bf),nB),ib(vv,Qp(vv,hm,Bf),rB),ib(xv,ib(xv,hm,Bf),rB),Qp(_v,ib(_v,hm,Bf),nB),s0?(Zp(oi,t,0),Zp(Ri,t,3*i),g=a/t2t(ib(e2t,Ri,oi))):n2t(XP,0,0,0);for(let v=0;v<=i;++v){const x=o[v],w=0===a?s[v]:a*(1-v/i),A=3*v;Zp(Hg,n,A),pI(Hg,Hg,w),Zp(Bf,r,A),pI(Bf,Bf,x),a>0&&(Zp(oi,n,A),Zp(Ri,r,A),pI(XP,zve(XP,oi,Ri),g)),Zp(hm,t,A),Zp(Gg,n,A),Zp(_Y,r,A),Qp(oi,Qp(oi,hm,Bf),Hg),Qp(Ri,Gg,XP),Yi(d,oi[0],oi[1],oi[2]),Yi(f,Ri[0],Ri[1],Ri[2]),Qp(oi,ib(oi,hm,Bf),Hg),Yi(d,oi[0],oi[1],oi[2]),Yi(f,Ri[0],Ri[1],Ri[2]),Uve(Ri,_Y),Yi(d,oi[0],oi[1],oi[2]),Yi(f,Ri[0],Ri[1],Ri[2]),ib(oi,ib(oi,hm,Bf),Hg),Yi(d,oi[0],oi[1],oi[2]),Yi(f,Ri[0],Ri[1],Ri[2]),Qp(Ri,Uve(Ri,Gg),XP),Yi(d,oi[0],oi[1],oi[2]),Yi(f,Ri[0],Ri[1],Ri[2]),ib(oi,Qp(oi,hm,Bf),Hg),Yi(d,oi[0],oi[1],oi[2]),Yi(f,Ri[0],Ri[1],Ri[2]),SY(Ri,_Y),Yi(d,oi[0],oi[1],oi[2]),Yi(f,Ri[0],Ri[1],Ri[2]),Qp(oi,Qp(oi,hm,Bf),Hg),Yi(d,oi[0],oi[1],oi[2]),Yi(f,Ri[0],Ri[1],Ri[2])}for(let v=0;v0){const v=o[0],x=s[0];iB(0,e,t,n,r,v,a,-x,!1),iB(0,e,t,n,r,v,-a,x,!1)}if(c&&0===a){const x=s[i];iB(3*i,e,t,n,r,o[i],x,x,!0)}for(let v=0,x=8*(i+1)+(l?4:a>0?8:0)+(c&&0===a?4:0);vD;for(let R=0;R=_?T-D:-T+D:R>=x&&R<_?-T+D:T-D;CY(Za,Za,vc,N),R===x||R===x-1?sB(ma,vc,hu,0,1):R===_||R===_-1?sB(ma,vc,hu,0,-1):sB(ma,vc,hu,y[R],v[R])}else hI(Za,vc,hu,nd,T*y[R],D*v[R]),sB(ma,vc,hu,D*y[R],T*v[R]);i2t(ma,ma),mu(f,Za[0],Za[1],Za[2]),mu(p,ma[0],ma[1],ma[2])}}const w=Math.round(o/2);for(let M=0;MD;F&&(T-=D),g=f.elementCount;for(let R=0;R=_?T:-T)):hI(Za,vc,hu,nd,T*y[R],D*v[R]),mu(f,Za[0],Za[1],Za[2]),mu(p,ma[0],ma[1],ma[2]),mu(m,g+(R+1)%o,g+R,E)}if(c){const M=3*i,E=f.elementCount;ob(vc,n,M),ob(hu,r,M),ob(nd,t,M),Vve(ma,vc,hu),mu(f,nd[0],nd[1],nd[2]),mu(p,ma[0],ma[1],ma[2]);const D=s[i];let T=a[i];const F="rounded"===u&&T>D;F&&(T-=D),g=f.elementCount;for(let R=0;R=_?T:-T)):hI(Za,vc,hu,nd,T*y[R],D*v[R]),mu(f,Za[0],Za[1],Za[2]),mu(p,ma[0],ma[1],ma[2]),mu(m,g+R,g+(R+1)%o,E)}tt.addRepeat(h,(i+1)*o+(l?o+1:0)+(c?o+1:0),d)}const sb=C.fromArray,l2t=C.magnitude,IY=C.sub,Hve=C.add,EY=C.scale,c2t=C.negate,u2t=C.copy,d2t=C.cross,Jp=tt.add3,f2t=tt.add,Cl=C(),xc=C(),p2t=C(),TY=C(),k2=C(),Gve=C(),KP=C(),h2t=C(),DY=C();function aB(e,t,n,r,i,o,s,a){const{currentGroup:l,vertices:c,normals:u,indices:d,groups:f}=e,p=c.elementCount;let m=0;a>0&&(sb(Cl,t,0),sb(xc,t,3*i),m=a/l2t(IY(p2t,xc,Cl)));for(let g=0;g<=i;++g){const y=o[g],x=0===a?s[g]:a*(1-g/i),_=3*g;sb(k2,n,_),EY(k2,k2,x),sb(TY,r,_),EY(TY,TY,y),a>0&&(sb(Cl,n,_),sb(xc,r,_),EY(Gve,d2t(Gve,Cl,xc),m)),sb(KP,t,_),sb(h2t,n,_),sb(DY,r,_),Hve(Cl,KP,k2),c2t(xc,DY),Jp(c,Cl[0],Cl[1],Cl[2]),Jp(u,xc[0],xc[1],xc[2]),IY(Cl,KP,k2),Jp(c,Cl[0],Cl[1],Cl[2]),Jp(u,xc[0],xc[1],xc[2]),Hve(Cl,KP,k2),u2t(xc,DY),Jp(c,Cl[0],Cl[1],Cl[2]),Jp(u,xc[0],xc[1],xc[2]),IY(Cl,KP,k2),Jp(c,Cl[0],Cl[1],Cl[2]),Jp(u,xc[0],xc[1],xc[2])}for(let g=0;gnb.fromGroup(t,{asSecondary:!0}),getLoci:x2,eachLocation:_2,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.tubularHelices!==r.tubularHelices||n.detail!==r.detail||n.linearSegments!==r.linearSegments||n.radialSegments!==r.radialSegments||n.aspectRatio!==r.aspectRatio||n.arrowFactor!==r.arrowFactor||n.helixProfile!==r.helixProfile||n.nucleicProfile!==r.nucleicProfile;const l=gp.get(s.structure).version;t.info.secondaryStructureHash!==l&&(void 0!==t.info.secondaryStructureHash&&(t.createGeometry=!0),t.info.secondaryStructureHash=l)}},e)}const $ve={"polymer-trace":(e,t)=>Uo("Polymer trace mesh",e,t,g2t),"polymer-gap":(e,t)=>Uo("Polymer gap cylinder",e,t,xY),"nucleotide-block":(e,t)=>Uo("Nucleotide block mesh",e,t,h_t),"nucleotide-ring":(e,t)=>Uo("Nucleotide ring mesh",e,t,S_t),"nucleotide-atomic-ring-fill":(e,t)=>Uo("Nucleotide atomic ring fill",e,t,R_t),"nucleotide-atomic-bond":(e,t)=>Uo("Nucleotide atomic bond",e,t,N_t),"nucleotide-atomic-element":(e,t)=>Uo("Nucleotide atomic element",e,t,j_t),"direction-wedge":(e,t)=>Uo("Polymer direction wedge",e,t,Q_t)},Yve={...Wve,...tB,..._ve,...Eve,...hY,...mY,...Rve,...Lve,sizeFactor:I.Numeric(.2,{min:0,max:10,step:.01}),visuals:I.MultiSelect(["polymer-trace","polymer-gap","nucleotide-ring","nucleotide-atomic-ring-fill","nucleotide-atomic-bond","nucleotide-atomic-element"],I.objectToOptions($ve)),bumpFrequency:I.Numeric(2,{min:0,max:10,step:.1},xt.ShadingCategory),colorMode:I.Select("default",I.arrayToOptions(["default","interpolate"]),{...xt.ShadingCategory,isHidden:!0})},v2t={name:"cartoon",label:"Cartoon",description:"Displays ribbons, planks, tubes smoothly following the trace atoms of polymers.",factory:function b2t(e,t){return Xn.createMulti("Cartoon",e,t,gl,$ve)},getParams:function y2t(e,t){const n=I.clone(Yve);let r=!1,i=!1;return t.units.forEach(o=>{!r&&ze.isAtomic(o)&&o.nucleotideElements.length&&(r=!0),!i&&o.gapElements.length&&(i=!0)}),n.visuals.defaultValue=["polymer-trace"],r&&n.visuals.defaultValue.push("nucleotide-ring"),i&&n.visuals.defaultValue.push("polymer-gap"),n},defaultValues:I.getDefaultValues(Yve),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.polymerResidueCount>0,ensureCustomProperties:{attach:function(){var e=le(function*(t,n){yield gp.attach(t,n,void 0,!0);for(const r of n.models)yield K$.attach(t,r,void 0,!0)});return function(n,r){return e.apply(this,arguments)}}(),detach:e=>{gp.ref(e,!1);for(const t of e.models)K$.ref(t,!1)}}},Xve={...ml,sizeFactor:I.Numeric(1,{min:0,max:10,step:.1}),detail:I.Numeric(0,{min:0,max:3,step:1},xt.CustomQualityParamInfo),ignoreHydrogens:I.Boolean(!1)};function x2t(e){return mc({defaultProps:I.getDefaultValues(Xve),createGeometry:_2t,createLocationIterator:vl.fromGroup,getLoci:dm,eachLocation:um,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail||n.ignoreHydrogens!==r.ignoreHydrogens}},e)}function _2t(e,t,n,r,i,o){const{child:s}=n,a=s?.unitMap.get(t.id);if(s&&!a)return on.createEmpty(o);const{detail:l,sizeFactor:c,ignoreHydrogens:u}=i,{elements:d,model:f}=t,{atomicNumber:p}=t.model.atomicHierarchy.derived.atom,m=d.length,h=m*qw(l),g=Ct.createState(h,h/2,o),y=ag.Provider.get(f);if(!y)return on.createEmpty(o);const v=C(),x=In(),_=C(),w=C(),A=C(),{elementToAnsiotrop:M,data:E}=y,{U:D}=E,T=E._schema.U.space,F=t.conformation,R=dt.create(n);R.unit=t;for(let W=0;WUo("Ellipsoid Mesh",e,t,x2t),"intra-bond":(e,t)=>Uo("Intra-unit bond cylinder",e,t,M1e),"inter-bond":(e,t)=>Ff("Inter-unit bond cylinder",e,t,O1e)},Zve={...Xve,...AO,...IO,includeParent:I.Boolean(!1),adjustCylinderLength:I.Boolean(!1,{isHidden:!0}),unitKinds:MP(["atomic"]),sizeFactor:I.Numeric(1,{min:.01,max:10,step:.01}),sizeAspectRatio:I.Numeric(.1,{min:.01,max:3,step:.01}),linkCap:I.Boolean(!0),visuals:I.MultiSelect(["ellipsoid-mesh","intra-bond","inter-bond"],I.objectToOptions(Kve)),bumpFrequency:I.Numeric(0,{min:0,max:10,step:.1},xt.ShadingCategory)},w2t={name:"ellipsoid",label:"Ellipsoid",description:"Displays anisotropic displacement ellipsoids of atomic elements plus bonds as cylinders.",factory:function C2t(e,t){return Xn.createMulti("Ellipsoid",e,t,gl,Kve)},getParams:function S2t(e,t){return Zve},defaultValues:I.getDefaultValues(Zve),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.elementCount>0&&e.models.some(t=>ag.Provider.isApplicable(t)),getData:(e,t)=>t.includeParent?e.asParent():e,mustRecreate:(e,t)=>e.includeParent!==t.includeParent},A2t="\nprecision highp float;\n\nattribute vec3 aPosition;\nattribute float aRadius;\n\nvarying vec3 vPosition;\nvarying float vRadiusSqInv;\n\n#if defined(dCalcType_groupId)\n attribute float aGroup;\n varying float vGroup;\n#endif\n\nuniform vec3 uBboxSize;\nuniform vec3 uBboxMin;\nuniform float uResolution;\n\nvoid main() {\n vRadiusSqInv = 1.0 / (aRadius * aRadius);\n #if defined(dCalcType_groupId)\n vGroup = aGroup;\n #endif\n gl_PointSize = ceil(((aRadius * 3.0) / uResolution) + uResolution);\n vPosition = (aPosition - uBboxMin) / uResolution;\n gl_Position = vec4(((aPosition - uBboxMin) / uBboxSize) * 2.0 - 1.0, 1.0);\n}\n",I2t="\nprecision highp float;\n\nvarying vec3 vPosition;\nvarying float vRadiusSqInv;\n#if defined(dCalcType_groupId)\n #if defined(dGridTexType_2d)\n precision highp sampler2D;\n uniform sampler2D tMinDistanceTex;\n uniform vec3 uGridTexDim;\n #elif defined(dGridTexType_3d)\n precision highp sampler3D;\n uniform sampler3D tMinDistanceTex;\n #endif\n varying float vGroup;\n#endif\n\n#include common\n\nuniform vec3 uGridDim;\nuniform vec2 uGridTexScale;\nuniform float uCurrentSlice;\nuniform float uCurrentX;\nuniform float uCurrentY;\nuniform float uAlpha;\nuniform float uResolution;\nuniform float uRadiusFactorInv;\n\nvoid main() {\n vec2 v = gl_FragCoord.xy - vec2(uCurrentX, uCurrentY) - 0.5;\n vec3 fragPos = vec3(v.x, v.y, uCurrentSlice);\n float dist = distance(fragPos, vPosition) * uResolution;\n\n #if defined(dCalcType_density)\n float density = exp(-uAlpha * ((dist * dist) * vRadiusSqInv));\n gl_FragColor.a = density * uRadiusFactorInv;\n #elif defined(dCalcType_minDistance)\n gl_FragColor.a = 1.0 - dist * uRadiusFactorInv;\n #elif defined(dCalcType_groupId)\n #if defined(dGridTexType_2d)\n float minDistance = 1.0 - texture2D(tMinDistanceTex, (gl_FragCoord.xy) / (uGridTexDim.xy / uGridTexScale)).a;\n #elif defined(dGridTexType_3d)\n float minDistance = 1.0 - texelFetch(tMinDistanceTex, ivec3(gl_FragCoord.xy, uCurrentSlice), 0).a;\n #endif\n if (dist * uRadiusFactorInv > minDistance + uResolution * 0.05)\n discard;\n gl_FragColor.rgb = packIntToRGB(vGroup);\n #endif\n}\n",E2t={drawCount:_o("number"),instanceCount:_o("number"),aRadius:Pi("float32",1,0),aPosition:Pi("float32",3,0),aGroup:Pi("float32",1,0),uCurrentSlice:Ne("f"),uCurrentX:Ne("f"),uCurrentY:Ne("f"),uBboxMin:Ne("v3","material"),uBboxSize:Ne("v3","material"),uGridDim:Ne("v3","material"),uGridTexDim:Ne("v3","material"),uGridTexScale:Ne("v2","material"),uAlpha:Ne("f","material"),uResolution:Ne("f","material"),uRadiusFactorInv:Ne("f","material"),tMinDistanceTex:xn("texture","rgba","float","nearest","material"),dGridTexType:cn("string",["2d","3d"]),dCalcType:cn("string",["density","minDistance","groupId"])},qg="gaussian-density";function PY(e){return e.namedFramebuffers[qg]||(e.namedFramebuffers[qg]=e.resources.framebuffer()),e.namedFramebuffers[qg]}function kY(e,t,n,r,i,o){const s=`${qg}-${e}`;return t.namedTextures[s]||(t.namedTextures[s]=t.resources.texture(n,r,i,o)),t.namedTextures[s]}function Qve(e,t,n,r,i,o){return e.isWebGL2?function T2t(e,t,n,r,i,o){It&&e.timer.mark("GaussianDensityTexture3d");const s=function D2t(e,t,n,r,i,o){const{gl:s,resources:a,state:l,extensions:{colorBufferFloat:c,textureFloat:u,colorBufferHalfFloat:d,textureHalfFloat:f}}=e,{smoothness:p,resolution:m}=i,{drawCount:h,positions:g,radii:y,groups:v,scale:x,expandedBox:_,dim:w,maxRadius:A}=nxe(t,n,r,i),[M,E,D]=w,T=kY("min-dist-3d",e,"volume-uint8","rgba","ubyte","nearest");T.define(M,E,D);const F=Ue.create(1,1),R=2*A,N=rxe(e,h,g,y,v,T,_,w,w,F,p,m,R),{uCurrentSlice:j}=N.values,W=PY(e);function z($,V){l.currentRenderItemId=-1;for(let X=0;X=j&&(re-=j,ae+=T,ge=0,O.update(G,ae)),O.update(Q,ge),O.update(K,Ie),c.viewport(ge,ae,D,T),c.scissor(ge,ae,D,T),te.render(),++re,ge+=D;a.flush()}return Z.bind(),ixe(e),s||(s=f&&p?l.texture("image-float16","rgba","fp16","linear"):u&&d?l.texture("image-float32","rgba","float","linear"):l.texture("image-uint8","rgba","ubyte","linear")),s.define(X,H),sxe(e,te),ee(s,!0),m&&(oxe(e,te),ee(oe,!0),axe(e,te),ee(s,!1)),{texture:s,scale:w,bbox:A,gridDim:M,gridTexDim:z,gridTexScale:$,radiusFactor:V,resolution:g,maxRadius:E}}(e,t,n,r,i,o,s);return It&&e.timer.markEnd("GaussianDensityTexture2d"),Jve(a)}function Jve({texture:e,scale:t,bbox:n,gridDim:r,gridTexDim:i,gridTexScale:o,radiusFactor:s,resolution:a,maxRadius:l}){return{transform:exe(t,n),texture:e,bbox:n,gridDim:r,gridTexDim:i,gridTexScale:o,radiusFactor:s,resolution:a,maxRadius:l}}function exe(e,t){const n=fe.identity();return fe.fromScaling(n,e),fe.setTranslation(n,t.min),n}function nxe(e,t,n,r){const{resolution:i,radiusOffset:o}=r,s=1/i,{indices:a,x:l,y:c,z:u,id:d}=e,f=Ve.size(a),p=new Float32Array(3*f),m=new Float32Array(f),h=new Float32Array(f);let g=0;for(let A=0;A0?"3d":"2d"),O.updateIfChanged(m.dCalcType,"density"),e.namedComputeRenderables[qg].update()}else e.namedComputeRenderables[qg]=function P2t(e,t,n,r,i,o,s,a,l,c,u,d,f){const p=C.sub(C(),s.max,s.min),m={drawCount:O.create(t),instanceCount:O.create(1),aRadius:O.create(r),aPosition:O.create(n),aGroup:O.create(i),uCurrentSlice:O.create(0),uCurrentX:O.create(0),uCurrentY:O.create(0),uBboxMin:O.create(s.min),uBboxSize:O.create(p),uGridDim:O.create(a),uGridTexDim:O.create(l),uGridTexScale:O.create(c),uAlpha:O.create(u),uResolution:O.create(d),uRadiusFactorInv:O.create(1/f),tMinDistanceTex:O.create(o),dGridTexType:O.create(o.getDepth()>0?"3d":"2d"),dCalcType:O.create("density")},h={...E2t};return ys(ms(e,"points",Wi(qg,A2t,I2t),h,m),m)}(e,t,n,r,i,o,s,a,l,c,u,d,f);return e.namedComputeRenderables[qg]}function ixe(e){const{gl:t,state:n}=e;n.disable(t.CULL_FACE),n.enable(t.BLEND),n.disable(t.DEPTH_TEST),n.enable(t.SCISSOR_TEST),n.depthMask(!1),n.clearColor(0,0,0,0)}function oxe(e,t){const{gl:n,state:r}=e;if(O.update(t.values.dCalcType,"minDistance"),t.update(),r.colorMask(!1,!1,!1,!0),r.blendFunc(n.ONE,n.ONE),!e.extensions.blendMinMax)throw new Error("GPU gaussian surface calculation requires EXT_blend_minmax");r.blendEquation(e.extensions.blendMinMax.MAX)}function sxe(e,t){const{gl:n,state:r}=e;O.update(t.values.dCalcType,"density"),t.update(),r.colorMask(!1,!1,!1,!0),r.blendFunc(n.ONE,n.ONE),r.blendEquation(n.FUNC_ADD)}function axe(e,t){const{gl:n,state:r}=e;O.update(t.values.dCalcType,"groupId"),t.update(),r.colorMask(!0,!0,!0,!1),r.blendFunc(n.ONE,n.ZERO),r.blendEquation(n.FUNC_ADD)}function lxe(e,t,n,r,i){return RY.apply(this,arguments)}function RY(){return RY=le(function*(e,t,n,r,i){const{resolution:o,radiusOffset:s,smoothness:a}=i,l=1/o,{indices:c,x:u,y:d,z:f,id:p}=t,m=Ve.size(c),h=new Float32Array(m);let g=0;for(let ee=0;eeH[Kn]&&(H[Kn]=An,D[Kn]=p?p[xe]:xe)}}}}}}function G(){return(G=le(function*(){for(let ee=0;ee1)return!1;const r=n.maxTextureSize/3,{areaCells:i,maxAreaCells:o}=Fye(e.boundary.box,t.resolution,r*r);return i{e.setUpdateState(n,r,i,o,s,a,l),Ya.areEqual(o.size,s.size)||(n.createGeometry=!0)},geometryUtils:iu.Utils},t)}({defaultProps:I.getDefaultValues(NY),createGeometry:G2t,createLocationIterator:vl.fromGroup,getLoci:dm,eachLocation:um,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.radiusOffset!==r.radiusOffset&&(t.createGeometry=!0),n.smoothness!==r.smoothness&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0),n.smoothColors.name!==r.smoothColors.name?t.updateColor=!0:"on"===n.smoothColors.name&&"on"===r.smoothColors.name&&(n.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(t.updateColor=!0),n.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(t.updateColor=!0))},mustRecreate:(t,n,r)=>!n.tryUseGpu||!r||!mI(t.structure,n,r),processValues:(t,n,r,i,o)=>{const{resolution:s,colorTexture:a}=n.meta,l=Dp(r.smoothColors,i.color.preferSmoothing,s);l&&o&&(ame(t,l.resolution,l.stride,o,a),n.meta.colorTexture=t.tColorGrid.ref.value)},dispose:t=>{var n;t.vertexTexture.ref.value.destroy(),t.groupTexture.ref.value.destroy(),t.normalTexture.ref.value.destroy(),t.doubleBuffer.destroy(),null===(n=t.meta.colorTexture)||void 0===n||n.destroy()}},e)}(e):function z2t(e){return mc({defaultProps:I.getDefaultValues(NY),createGeometry:U2t,createLocationIterator:vl.fromGroup,getLoci:dm,eachLocation:um,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.radiusOffset!==r.radiusOffset&&(t.createGeometry=!0),n.smoothness!==r.smoothness&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0),n.smoothColors.name!==r.smoothColors.name?t.updateColor=!0:"on"===n.smoothColors.name&&"on"===r.smoothColors.name&&(n.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(t.updateColor=!0),n.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(t.updateColor=!0))},mustRecreate:(t,n,r)=>n.tryUseGpu&&!!r&&mI(t.structure,n,r),processValues:(t,n,r,i,o)=>{const{resolution:s,colorTexture:a}=n.meta,l=Dp(r.smoothColors,i.color.preferSmoothing,s);l&&(nF(t,l.resolution,l.stride,o,a),n.meta.colorTexture=t.tColorGrid.ref.value)},dispose:t=>{var n;null===(n=t.meta.colorTexture)||void 0===n||n.destroy()}},e)}(e)}function j2t(e,t,n,r){return n.tryUseGpu&&r&&pxe(r)&&mI(t,n,r)?function $2t(e){return function tgt(e,t){return e2({...e,setUpdateState:(n,r,i,o,s,a,l)=>{e.setUpdateState(n,r,i,o,s,a,l),Ya.areEqual(o.size,s.size)||(n.createGeometry=!0)},geometryUtils:iu.Utils},t)}({defaultProps:I.getDefaultValues(fxe),createGeometry:W2t,createLocationIterator:vl.fromStructure,getLoci:b2,eachLocation:y2,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.radiusOffset!==r.radiusOffset&&(t.createGeometry=!0),n.smoothness!==r.smoothness&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0),n.smoothColors.name!==r.smoothColors.name?t.updateColor=!0:"on"===n.smoothColors.name&&"on"===r.smoothColors.name&&(n.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(t.updateColor=!0),n.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(t.updateColor=!0))},mustRecreate:(t,n,r)=>!n.tryUseGpu||!r||!mI(t,n,r),processValues:(t,n,r,i,o)=>{const{resolution:s,colorTexture:a}=n.meta,l=Dp(r.smoothColors,i.color.preferSmoothing,s);l&&o&&(ame(t,l.resolution,l.stride,o,a),n.meta.colorTexture=t.tColorGrid.ref.value)},dispose:t=>{var n;t.vertexTexture.ref.value.destroy(),t.groupTexture.ref.value.destroy(),t.normalTexture.ref.value.destroy(),t.doubleBuffer.destroy(),null===(n=t.meta.colorTexture)||void 0===n||n.destroy()}},e)}(e):function H2t(e){return Hy({defaultProps:I.getDefaultValues(fxe),createGeometry:V2t,createLocationIterator:vl.fromStructure,getLoci:b2,eachLocation:y2,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.radiusOffset!==r.radiusOffset&&(t.createGeometry=!0),n.smoothness!==r.smoothness&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.smoothColors.name!==r.smoothColors.name?t.updateColor=!0:"on"===n.smoothColors.name&&"on"===r.smoothColors.name&&(n.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(t.updateColor=!0),n.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(t.updateColor=!0))},mustRecreate:(t,n,r)=>n.tryUseGpu&&!!r&&mI(t,n,r),processValues:(t,n,r,i,o)=>{const{resolution:s,colorTexture:a}=n.meta,l=Dp(r.smoothColors,i.color.preferSmoothing,s);l&&(nF(t,l.resolution,l.stride,o,a),n.meta.colorTexture=t.tColorGrid.ref.value)},dispose:t=>{var n;null===(n=t.meta.colorTexture)||void 0===n||n.destroy()}},e)}(e)}function U2t(e,t,n,r,i,o){return FY.apply(this,arguments)}function FY(){return FY=le(function*(e,t,n,r,i,o){const{smoothness:s}=i,{transform:a,field:l,idField:c,radiusFactor:u,resolution:d,maxRadius:f}=yield uxe(n,t,r.size,i).runInContext(e.runtime),p={isoLevel:Math.exp(-s)/u,scalarField:l,idField:c},m=yield yA(p,o).runAsChild(e.runtime);m.meta.resolution=d,on.transform(m,a),e.webgl&&!e.webgl.isWebGL2?(on.uniformTriangleGroup(m),O.updateIfChanged(m.varyingGroup,!1)):O.updateIfChanged(m.varyingGroup,!0);const h=ke.expand(ke(),t.boundary.sphere,f);return m.setBoundingSphere(h),m}),FY.apply(this,arguments)}function V2t(e,t,n,r,i){return OY.apply(this,arguments)}function OY(){return OY=le(function*(e,t,n,r,i){const{smoothness:o}=r,{transform:s,field:a,idField:l,radiusFactor:c,resolution:u,maxRadius:d}=yield function F2t(e,t,n){const{position:r,boundary:i,radius:o}=XF(e,t,n),s=sv(i.box,n);return Ke.create("Gaussian Density",function(){var a=le(function*(l){return yield lxe(l,r,i.box,o,s)});return function(l){return a.apply(this,arguments)}}())}(t,n.size,r).runInContext(e.runtime),f={isoLevel:Math.exp(-o)/c,scalarField:a,idField:l},p=yield yA(f,i).runAsChild(e.runtime);p.meta.resolution=u,on.transform(p,s),e.webgl&&!e.webgl.isWebGL2?(on.uniformTriangleGroup(p),O.updateIfChanged(p.varyingGroup,!1)):O.updateIfChanged(p.varyingGroup,!0);const m=ke.expand(ke(),t.boundary.sphere,d);return p.setBoundingSphere(m),p}),OY.apply(this,arguments)}const gI="gaussian-surface";function G2t(e,t,n,r,i,o){return BY.apply(this,arguments)}function BY(){return BY=le(function*(e,t,n,r,i,o){if(!e.webgl)throw new Error("webgl context required to create gaussian surface texture-mesh");It&&e.webgl.timer.mark("createGaussianSurfaceTextureMesh");const{namedTextures:s,resources:a,extensions:{colorBufferFloat:l,textureFloat:c,colorBufferHalfFloat:u,textureHalfFloat:d}}=e.webgl;s[gI]||(s[gI]=u&&d?a.texture("image-float16","rgba","fp16","linear"):l&&c?a.texture("image-float32","rgba","float","linear"):a.texture("image-uint8","rgba","ubyte","linear"));const f=yield function N2t(e,t,n,r,i,o,s){const{position:a,boundary:l,radius:c}=YF(e,t,n,i),u=sv(l.box,i,cxe(o,e));return Ke.create("Gaussian Density",function(){var d=le(function*(f){return MY(o,a,l.box,c,r,u,s)});return function(f){return d.apply(this,arguments)}}())}(n,t,r.size,!0,i,e.webgl,s[gI]).runInContext(e.runtime),p=Math.exp(-i.smoothness)/f.radiusFactor,m=C.create(0,1,2),h=o?.doubleBuffer.get(),g=xF(e.webgl,f.texture,f.gridDim,f.gridTexDim,f.gridTexScale,f.transform,p,!1,!0,m,!0,h?.vertex,h?.group,h?.normal);It&&e.webgl.timer.markEnd("createGaussianSurfaceTextureMesh");const y=t.elements.length,v=ke.expand(ke(),t.boundary.sphere,f.maxRadius),x=iu.create(g.vertexCount,y,g.vertexTexture,g.groupTexture,g.normalTexture,v,o);return x.meta.resolution=f.resolution,x.meta.webgl=e.webgl,x}),BY.apply(this,arguments)}function W2t(e,t,n,r,i){return LY.apply(this,arguments)}function LY(){return LY=le(function*(e,t,n,r,i){if(!e.webgl)throw new Error("webgl context required to create structure gaussian surface texture-mesh");It&&e.webgl.timer.mark("createStructureGaussianSurfaceTextureMesh");const{namedTextures:o,resources:s,extensions:{colorBufferFloat:a,textureFloat:l,colorBufferHalfFloat:c,textureHalfFloat:u}}=e.webgl;o[gI]||(o[gI]=c&&u?s.texture("image-float16","rgba","fp16","linear"):a&&l?s.texture("image-float32","rgba","float","linear"):s.texture("image-uint8","rgba","ubyte","linear"));const d=yield function B2t(e,t,n,r,i,o){const{box:s}=e.lookup3d.boundary,{position:a,boundary:l,radius:c}=XF(e,t,r),u=sv(l.box,r);return Ke.create("Gaussian Density",function(){var d=le(function*(f){return MY(i,a,s,c,n,u,o)});return function(f){return d.apply(this,arguments)}}())}(t,n.size,!0,r,e.webgl,o[gI]).runInContext(e.runtime),f=Math.exp(-r.smoothness)/d.radiusFactor,p=C.create(0,1,2),m=i?.doubleBuffer.get(),h=xF(e.webgl,d.texture,d.gridDim,d.gridTexDim,d.gridTexScale,d.transform,f,!1,!0,p,!0,m?.vertex,m?.group,m?.normal);It&&e.webgl.timer.markEnd("createStructureGaussianSurfaceTextureMesh");const g=t.elementCount,y=ke.expand(ke(),t.boundary.sphere,d.maxRadius),v=iu.create(h.vertexCount,g,h.vertexTexture,h.groupTexture,h.normalTexture,y,i);return v.meta.resolution=d.resolution,v.meta.webgl=e.webgl,v}),LY.apply(this,arguments)}function Y2t(e,t,n,r,i,o){return jY.apply(this,arguments)}function jY(){return jY=le(function*(e,t,n,r,i,o){const{smoothness:s}=i,{transform:a,field:l,idField:c,maxRadius:u}=yield uxe(n,t,r.size,i).runInContext(e.runtime),d={isoLevel:Math.exp(-s),scalarField:l,idField:c},f=yield YG(d,o).runAsChild(e.runtime);Mo.transform(f,a);const p=ke.expand(ke(),t.boundary.sphere,u);return f.setBoundingSphere(p),f}),jY.apply(this,arguments)}const hxe={...KF,...ZP,sizeFactor:I.Numeric(3,{min:0,max:10,step:.1}),lineSizeAttenuation:I.Boolean(!1),ignoreHydrogens:I.Boolean(!1),ignoreHydrogensVariant:I.Select("all",I.arrayToOptions(["all","non-polar"])),includeParent:I.Boolean(!1,{isHidden:!0})};function X2t(e){return ZF({defaultProps:I.getDefaultValues(hxe),createGeometry:Y2t,createLocationIterator:vl.fromGroup,getLoci:dm,eachLocation:um,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.radiusOffset!==r.radiusOffset&&(t.createGeometry=!0),n.smoothness!==r.smoothness&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0)}},e)}const mxe={"gaussian-surface-mesh":(e,t)=>Uo("Gaussian surface mesh",e,t,L2t),"structure-gaussian-surface-mesh":(e,t)=>Ff("Structure-Gaussian surface mesh",e,t,j2t),"gaussian-surface-wireframe":(e,t)=>Uo("Gaussian surface wireframe",e,t,X2t)},gxe={...NY,...hxe,visuals:I.MultiSelect(["gaussian-surface-mesh"],I.objectToOptions(mxe)),bumpFrequency:I.Numeric(1,{min:0,max:10,step:.1},xt.ShadingCategory)},Q2t={name:"gaussian-surface",label:"Gaussian Surface",description:"Displays a gaussian molecular surface.",factory:function Z2t(e,t){return Xn.createMulti("Gaussian Surface",e,t,gl,mxe)},getParams:function K2t(e,t){return gxe},defaultValues:I.getDefaultValues(gxe),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"physical"},isApplicable:e=>e.elementCount>0},yxe={...Kmt,background:I.Boolean(!1),backgroundMargin:I.Numeric(0,{min:0,max:1,step:.01}),backgroundColor:I.Color(qn.black),backgroundOpacity:I.Numeric(.5,{min:0,max:1,step:.01}),borderWidth:I.Numeric(.25,{min:0,max:.5,step:.01}),level:I.Select("residue",[["chain","Chain"],["residue","Residue"],["element","Element"]],{isEssential:!0}),ignoreHydrogens:I.Boolean(!1),ignoreHydrogensVariant:I.Select("all",I.arrayToOptions(["all","non-polar"])),chainScale:I.Numeric(10,{min:0,max:20,step:.1}),residueScale:I.Numeric(1,{min:0,max:20,step:.1}),elementScale:I.Numeric(.5,{min:0,max:20,step:.1})};function J2t(e){return function Zmt(e,t){return e2({...e,setUpdateState:(n,r,i,o,s,a,l)=>{e.setUpdateState(n,r,i,o,s,a,l),Ya.areEqual(o.size,s.size)||(n.updateSize=!0),r.background!==i.background&&(n.createGeometry=!0),r.backgroundMargin!==i.backgroundMargin&&(n.createGeometry=!0),r.tether!==i.tether&&(n.createGeometry=!0),r.tetherLength!==i.tetherLength&&(n.createGeometry=!0),r.tetherBaseWidth!==i.tetherBaseWidth&&(n.createGeometry=!0),r.attachment!==i.attachment&&(n.createGeometry=!0),r.fontFamily!==i.fontFamily&&(n.createGeometry=!0),r.fontQuality!==i.fontQuality&&(n.createGeometry=!0),r.fontStyle!==i.fontStyle&&(n.createGeometry=!0),r.fontVariant!==i.fontVariant&&(n.createGeometry=!0),r.fontWeight!==i.fontWeight&&(n.createGeometry=!0)},geometryUtils:Tf.Utils},t)}({defaultProps:I.getDefaultValues(yxe),createGeometry:eSt,createLocationIterator:vl.fromStructure,getLoci:b2,eachLocation:y2,setUpdateState:(t,n,r)=>{t.createGeometry=n.level!==r.level||"chain"===n.level&&n.chainScale!==r.chainScale||"residue"===n.level&&n.residueScale!==r.residueScale||"element"===n.level&&n.elementScale!==r.elementScale||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant}},e)}function eSt(e,t,n,r,i){switch(r.level){case"chain":return function tSt(e,t,n,r,i){const o=dt.create(t),{units:s,serialMapping:a}=t,{auth_asym_id:l,label_asym_id:c}=Je.chain,{cumulativeUnitElementCount:u}=a,d=s.length,{chainScale:f}=r,p=Ig.create(r,d,d/2,i);for(let m=0,h=s.length;mFf("Label text",e,t,J2t)},vxe={...yxe,visuals:I.MultiSelect(["label-text"],I.objectToOptions(bxe))},sSt={name:"label",label:"Label",description:"Displays labels.",factory:function oSt(e,t){const n=Xn.createMulti("Label",e,t,gl,bxe);return n.setState({pickable:!1,markerActions:un.None}),n},getParams:function iSt(e,t){return vxe},defaultValues:I.getDefaultValues(vxe),defaultColorTheme:{name:"uniform"},defaultSizeTheme:{name:"physical"},isApplicable:e=>e.elementCount>0},UY={probeRadius:I.Numeric(1.4,{min:0,max:10,step:.1},{description:"Radius of the probe tracing the molecular surface."}),resolution:I.Numeric(.5,{min:.01,max:20,step:.01},{description:"Grid resolution/cell spacing.",...xt.CustomQualityParamInfo}),probePositions:I.Numeric(36,{min:12,max:90,step:1},{description:"Number of positions tested for probe target intersection.",...xt.CustomQualityParamInfo})};function zY(){return zY=le(function*(e,t,n,r,i,o){let s=-1;function a(ne,be,Ce,Re,Be){if(-1!==s){const $e=s;if($e!==Re&&$e!==Be&&l($e,ne,be,Ce))return $e;s=-1}for(let $e=0,nt=F.count;$e0&&Qe{n.resolution!==r.resolution&&(t.createGeometry=!0),n.probeRadius!==r.probeRadius&&(t.createGeometry=!0),n.probePositions!==r.probePositions&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0),n.smoothColors.name!==r.smoothColors.name?t.updateColor=!0:"on"===n.smoothColors.name&&"on"===r.smoothColors.name&&(n.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(t.updateColor=!0),n.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(t.updateColor=!0))},processValues:(t,n,r,i,o)=>{const{resolution:s,colorTexture:a}=n.meta,l=Dp(r.smoothColors,i.color.preferSmoothing,s);l&&(nF(t,l.resolution,l.stride,o,a),n.meta.colorTexture=t.tColorGrid.ref.value)},dispose:t=>{var n;null===(n=t.meta.colorTexture)||void 0===n||n.destroy()}},e)}function mSt(e,t,n,r,i){return qY.apply(this,arguments)}function qY(){return qY=le(function*(e,t,n,r,i){const{transform:o,field:s,idField:a,resolution:l,maxRadius:c}=yield function fSt(e,t,n){const{position:r,boundary:i,maxRadius:o}=function dSt(e,t,n){const{probeRadius:r}=n,{position:i,boundary:o,radius:s}=XF(e,t,n),{indices:a}=i,l=Ve.size(a),c=new Float32Array(Ve.end(a));let u=0;for(let d=0;d{n.resolution!==r.resolution&&(t.createGeometry=!0),n.probeRadius!==r.probeRadius&&(t.createGeometry=!0),n.probePositions!==r.probePositions&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0),n.smoothColors.name!==r.smoothColors.name?t.updateColor=!0:"on"===n.smoothColors.name&&"on"===r.smoothColors.name&&(n.smoothColors.params.resolutionFactor!==r.smoothColors.params.resolutionFactor&&(t.updateColor=!0),n.smoothColors.params.sampleStride!==r.smoothColors.params.sampleStride&&(t.updateColor=!0))},processValues:(t,n,r,i,o)=>{const{resolution:s,colorTexture:a}=n.meta,l=Dp(r.smoothColors,i.color.preferSmoothing,s);l&&(nF(t,l.resolution,l.stride,o,a),n.meta.colorTexture=t.tColorGrid.ref.value)},dispose:t=>{var n;null===(n=t.meta.colorTexture)||void 0===n||n.destroy()}},e)}const Sxe={...KF,...UY,...$F,sizeFactor:I.Numeric(1.5,{min:0,max:10,step:.1})};function ySt(e,t,n,r,i,o){return WY.apply(this,arguments)}function WY(){return WY=le(function*(e,t,n,r,i,o){const{transform:s,field:a,idField:l,maxRadius:c}=yield xxe(n,t,r.size,i).runInContext(e.runtime),u={isoLevel:i.probeRadius,scalarField:a,idField:l},d=yield YG(u,o).runAsChild(e.runtime);Mo.transform(d,s);const f=ke.expand(ke(),t.boundary.sphere,c);return d.setBoundingSphere(f),d}),WY.apply(this,arguments)}function bSt(e){return ZF({defaultProps:I.getDefaultValues(Sxe),createGeometry:ySt,createLocationIterator:vl.fromGroup,getLoci:dm,eachLocation:um,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.probeRadius!==r.probeRadius&&(t.createGeometry=!0),n.probePositions!==r.probePositions&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0)}},e)}const Cxe={"molecular-surface-mesh":(e,t)=>Uo("Molecular surface mesh",e,t,hSt),"structure-molecular-surface-mesh":(e,t)=>Ff("Structure Molecular surface mesh",e,t,gSt),"molecular-surface-wireframe":(e,t)=>Uo("Molecular surface wireframe",e,t,bSt)},wxe={...HY,...Sxe,visuals:I.MultiSelect(["molecular-surface-mesh"],I.objectToOptions(Cxe)),bumpFrequency:I.Numeric(1,{min:0,max:10,step:.1},xt.ShadingCategory)},_St={name:"molecular-surface",label:"Molecular Surface",description:"Displays a molecular surface.",factory:function xSt(e,t){return Xn.createMulti("Molecular Surface",e,t,gl,Cxe)},getParams:function vSt(e,t){return wxe},defaultValues:I.getDefaultValues(wxe),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"physical"},isApplicable:e=>e.elementCount>0},Axe={...ml,sizeFactor:I.Numeric(1,{min:0,max:2,step:.1}),detail:I.Numeric(0,{min:0,max:3,step:1},xt.CustomQualityParamInfo)};function SSt(e){return mc({defaultProps:I.getDefaultValues(Axe),createGeometry:wSt,createLocationIterator:ASt,getLoci:ISt,eachLocation:ESt,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail}},e)}function wSt(e,t,n,r,i,o){if(!function CSt(e){if(ze.Traits.is(e.traits,ze.Trait.MultiChain)||ze.Traits.is(e.traits,ze.Trait.Partitioned))return!1;if(ze.isCoarse(e))return!0;if(0===e.elements.length)return!1;const n=e.model.atomicHierarchy.derived.residue.moleculeType[e.residueIndex[e.elements[0]]];return!(3===n||2===n)}(t))return on.createEmpty(o);const{detail:s,sizeFactor:a}=i,c=Ct.createState(256,128,o),u=t.principalAxes.boxAxes,{origin:d,dirA:f,dirB:p}=u,m=rc.size(C(),u);C.scale(m,m,a/2);const h=C.create(m[2],m[1],m[0]);c.currentGroup=0,OG(c,d,f,p,h,s+1);const g=Ct.getMesh(c),y=ke.expand(ke(),t.boundary.sphere,1*i.sizeFactor);return g.setBoundingSphere(y),g}function ASt(e){const{group:t,structure:n}=e,i=t.units.length,o=dt.create(n);return Vi(1,i,1,(a,l)=>{const c=t.units[l];return o.unit=c,o.element=c.elements[a],o})}function ISt(e,t,n){const{objectId:r,instanceId:i}=e;if(n===r){const{structure:o,group:s}=t,a=s.units[i];return Me(o,[{unit:a,indices:Ve.ofBounds(0,a.elements.length)}])}return qr}function ESt(e,t,n){let r=!1;if(!Me.is(e))return!1;const{structure:i,group:o}=t;if(!Xe.areEquivalent(e.structure,i))return!1;const s=o.elements.length;for(const a of e.elements){const l=o.unitIndexMap.get(a.unit.id);void 0!==l&&Ve.size(a.indices)===s&&n(Pe.ofSingleton(l))&&(r=!0)}return r}const Ixe={"orientation-ellipsoid-mesh":(e,t)=>Uo("Orientation ellipsoid mesh",e,t,SSt)},Exe={...Axe,visuals:I.MultiSelect(["orientation-ellipsoid-mesh"],I.objectToOptions(Ixe)),bumpFrequency:I.Numeric(1,{min:0,max:10,step:.1},xt.ShadingCategory)},PSt={name:"orientation",label:"Orientation",description:"Displays orientation ellipsoids for polymer chains.",factory:function DSt(e,t){return Xn.createMulti("Orientation",e,t,gl,Ixe)},getParams:function TSt(e,t){return Exe},defaultValues:I.getDefaultValues(Exe),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.elementCount>0},kSt=tt.add3,MSt=tt.add;var $Y;!function(e){e.create=function t(n=2048,r=1024,i){const o=tt.create(Float32Array,3,r,i?i.centerBuffer.ref.value:n),s=tt.create(Float32Array,1,r,i?i.groupBuffer.ref.value:n);return{add:(a,l,c,u)=>{kSt(o,a,l,c),MSt(s,u)},getPoints:()=>{const a=tt.compact(o,!0),l=tt.compact(s,!0);return G1.create(a,l,o.elementCount,i)}}}}($Y||($Y={}));const Txe=C.add,YY={...rgt,pointSizeAttenuation:I.Boolean(!1),ignoreHydrogens:I.Boolean(!1),ignoreHydrogensVariant:I.Select("all",I.arrayToOptions(["all","non-polar"])),traceOnly:I.Boolean(!1),stride:I.Numeric(1,{min:1,max:100,step:1})};function RSt(e,t,n,r,i,o){const{child:s}=n;if(s&&!s.unitMap.get(t.id))return G1.createEmpty(o);const a=t.elements,l=a.length,c=$Y.create(l,l/10,o),u=C(),d=t.conformation,f=g2(n,t,i),p=C();let m=0;if(f)for(let v=0;v{e.setUpdateState(n,r,i,o,s,a,l),Ya.areEqual(o.size,s.size)||(n.updateSize=!0)},geometryUtils:G1.Utils},t)}({defaultProps:I.getDefaultValues(YY),createGeometry:RSt,createLocationIterator:vl.fromGroup,getLoci:dm,eachLocation:um,setUpdateState:(t,n,r)=>{t.createGeometry=n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.traceOnly!==r.traceOnly||n.stride!==r.stride}},e)}const NSt={"element-point":(e,t)=>Uo("Points",e,t,Dxe)},Pxe={...YY},BSt={name:"point",label:"Point",description:"Displays elements (atoms, coarse spheres) as points.",factory:function OSt(e,t){return Xn.createMulti("Point",e,t,gl,NSt)},getParams:function FSt(e,t){return Pxe},defaultValues:I.getDefaultValues(Pxe),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.elementCount>0},kxe={sizeFactor:I.Numeric(.2,{min:0,max:10,step:.01}),detail:I.Numeric(0,{min:0,max:3,step:1},xt.CustomQualityParamInfo),linearSegments:I.Numeric(8,{min:1,max:48,step:1},xt.CustomQualityParamInfo),radialSegments:I.Numeric(16,{min:2,max:56,step:2},xt.CustomQualityParamInfo)},Ud=(I.getDefaultValues(kxe),C());function LSt(e,t,n,r,i,o){const s=t.polymerElements.length;if(!s)return on.createEmpty(o);const{sizeFactor:a,detail:l,linearSegments:c,radialSegments:u}=i,d=c*u*s+(u+1)*s*2,f=Ct.createState(d,d/10,o),p=eY(c),{curvePoints:m,normalVectors:h,binormalVectors:g,widthValues:y,heightValues:v}=p;let x=0;const _=Z$(t,n,{ignoreSecondaryStructure:!0});for(;_.hasNext;){const M=_.move();f.currentGroup=x;const D=Fu(M.moleculeType)?FO:NO;tY(p,M,uve,D);const T=M.coarseBackboneFirst||M.first,F=M.coarseBackboneLast||M.last,R=r.size.size(M.centerPrev)*a,N=r.size.size(M.center)*a,j=r.size.size(M.centerNext)*a;sY(p,R,N,j,R,N,j,D);let W=c;if(M.initial){W=Math.max(Math.round(c*D),1);const z=c-W;m.copyWithin(0,3*z),g.copyWithin(0,3*z),h.copyWithin(0,3*z),y.copyWithin(0,3*z),v.copyWithin(0,3*z),C.fromArray(Ud,m,3),C.normalize(Ud,C.sub(Ud,M.p2,Ud)),C.scaleAndAdd(Ud,M.p2,Ud,N*OO),C.toArray(Ud,m,0)}else M.final&&(W=Math.max(Math.round(c*(1-D)),1),C.fromArray(Ud,m,3*W-3),C.normalize(Ud,C.sub(Ud,M.p2,Ud)),C.scaleAndAdd(Ud,M.p2,Ud,N*OO),C.toArray(Ud,m,3*W));!0===M.initial&&!0===M.final?Jr(f,M.p2,2*N,l):2===u?aB(f,m,h,g,W,y,v,0):4===u?oB(f,m,h,g,W,y,v,0,T,F):AY(f,m,h,g,W,u,y,v,T,F,"elliptical"),++x}const w=Ct.getMesh(f),A=ke.expand(ke(),t.boundary.sphere,1*i.sizeFactor);return w.setBoundingSphere(A),w}const Mxe={...ml,...kxe};function jSt(e){return mc({defaultProps:I.getDefaultValues(Mxe),createGeometry:LSt,createLocationIterator:t=>nb.fromGroup(t,{asSecondary:!0}),getLoci:x2,eachLocation:_2,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail||n.linearSegments!==r.linearSegments||n.radialSegments!==r.radialSegments}},e)}const Rxe={"polymer-tube":(e,t)=>Uo("Polymer tube mesh",e,t,jSt),"polymer-gap":(e,t)=>Uo("Polymer gap cylinder",e,t,xY)},Nxe={...Mxe,...tB,sizeFactor:I.Numeric(.2,{min:0,max:10,step:.01}),visuals:I.MultiSelect(["polymer-tube","polymer-gap"],I.objectToOptions(Rxe)),bumpFrequency:I.Numeric(2,{min:0,max:10,step:.1},xt.ShadingCategory)},VSt={name:"putty",label:"Putty",description:"Displays a tube smoothly following the trace atoms of polymers.",factory:function zSt(e,t){return Xn.createMulti("Putty",e,t,gl,Rxe)},getParams:function USt(e,t){const n=I.clone(Nxe);let r=!1,i=!1;return t.units.forEach(o=>{!r&&ze.isAtomic(o)&&o.nucleotideElements.length&&(r=!0),!i&&o.gapElements.length&&(i=!0)}),n.visuals.defaultValue=["polymer-tube"],i&&n.visuals.defaultValue.push("polymer-gap"),n},defaultValues:I.getDefaultValues(Nxe),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uncertainty"},isApplicable:e=>e.polymerResidueCount>0},Fxe={"element-sphere":(e,t)=>Uo("Sphere mesh/impostor",e,t,L1e),"structure-element-sphere":(e,t)=>Ff("Structure sphere mesh/impostor",e,t,Zvt)},XY={...EO,bumpFrequency:I.Numeric(1,{min:0,max:10,step:.1},xt.ShadingCategory),visuals:I.MultiSelect(["element-sphere"],I.objectToOptions(Fxe))};let lB;const qSt={name:"spacefill",label:"Spacefill",description:"Displays atomic/coarse elements as spheres.",factory:function GSt(e,t){return Xn.createMulti("Spacefill",e,t,gl,Fxe)},getParams:function HSt(e,t){return t.isCoarseGrained?(lB||(lB=I.clone(XY),lB.sizeFactor.defaultValue=2),lB):XY},defaultValues:I.getDefaultValues(XY),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"physical"},isApplicable:e=>e.elementCount>0},KY=Lr.is;function WSt(e,t,n,r,i,o){if(!ze.isAtomic(t))return Mo.createEmpty(o);const{child:s}=n,a=s?.unitMap.get(t.id);if(s&&!a)return Mo.createEmpty(o);const l=dt.create(n,t),c=t.elements,u=t.bonds,{edgeCount:d,a:f,b:p,edgeProps:m,offset:h}=u;if(!d)return Mo.createEmpty(o);const{order:g,flags:y}=m,{sizeFactor:v,aromaticBonds:x,includeTypes:_,excludeTypes:w,multipleBonds:A}=i,M="off"===A,E="symmetric"===A,F=wO(Lr.fromNames(_),Lr.fromNames(w),32),R=C(),N=t.conformation,{elementRingIndices:j,elementAromaticRingIndices:W}=t.rings,z=x?t.resonance.delocalizedTriplets:void 0,$={linkCount:2*d,referencePosition:H=>{let oe=f[H],te=p[H];const K=z?.getThirdElement(oe,te);if(void 0!==K)return N.invariantPosition(c[K],R);oe>te&&([oe,te]=[te,oe]),h[oe+1]-h[oe]==1&&([oe,te]=[te,oe]);const Q=W.get(oe)||j.get(oe);let G=0;for(let Z=h[oe],ee=h[oe+1];ZG&&(G=re,N.invariantPosition(c[se],R))}}}return G>0?R:null},position:(H,oe,te)=>{N.invariantPosition(c[f[te]],H),N.invariantPosition(c[p[te]],oe)},style:H=>{const oe=g[H],te=y[H];if(KY(te,2)||KY(te,4))return 1;if(3===oe)return M?0:E?4:5;if(x){const Q=p[H],G=W.get(f[H]),Z=W.get(Q),ee=G&&Z?jR(G,Z):0;if(KY(te,16)||ee&&!F)return 2===ee?8:7}return 2!==oe||M?0:E?2:3},radius:H=>{l.element=c[f[H]];const oe=r.size.size(l);l.element=c[p[H]];const te=r.size.size(l);return Math.min(oe,te)*v},ignore:D1e(n,t,i)},{lines:V,boundingSphere:X}=Yye(0,$,i,o);if(X)V.setBoundingSphere(X);else if(V.lineCount>0){const H=ke.expand(ke(),(a??t).boundary.sphere,1*v);V.setBoundingSphere(H)}return V}const Oxe={...KF,...E$,includeParent:I.Boolean(!1)};function $St(e){return ZF({defaultProps:I.getDefaultValues(Oxe),createGeometry:WSt,createLocationIterator:t=>fv.fromGroup(t),getLoci:T$,eachLocation:D$,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.linkScale!==r.linkScale||n.linkSpacing!==r.linkSpacing||n.aromaticDashCount!==r.aromaticDashCount||n.dashCount!==r.dashCount||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||!Ru(n.includeTypes,r.includeTypes)||!Ru(n.excludeTypes,r.excludeTypes)||n.aromaticBonds!==r.aromaticBonds||n.multipleBonds!==r.multipleBonds;const l=s.group.units[0],c=a.group.units[0];ze.isAtomic(l)&&ze.isAtomic(c)&&(Cd.areEqual(l.bonds,c.bonds)||(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.updateSize=!0))}},e)}const ZY=new fn.ElementBondIterator;function Bxe(e,t,n,r){for(ZY.setElement(t,n,r);ZY.hasNext;){const i=ZY.move();return i.otherUnit.conformation.position(i.otherUnit.elements[i.otherIndex],e),e}return null}function YSt(e,t,n,r,i){const o=t.interUnitBonds,{edgeCount:s,edges:a}=o;if(!s)return Mo.createEmpty(i);const{sizeFactor:l,aromaticBonds:c,multipleBonds:u}=r,d="off"===u,f="symmetric"===u,p=C(),m=dt.create(),h={linkCount:s,referencePosition:v=>{const x=a[v];let _,w,A,M;if(x.unitAx.unitB))throw new Error("same units in createInterUnitBondLines");_=t.unitMap.get(x.unitB),w=t.unitMap.get(x.unitA),A=x.indexB,M=x.indexA}return Bxe(p,t,_,A)||Bxe(p,t,w,M)},position:(v,x,_)=>{const w=a[_],A=t.unitMap.get(w.unitA),M=t.unitMap.get(w.unitB);A.conformation.position(A.elements[w.indexA],v),M.conformation.position(M.elements[w.indexB],x)},style:v=>{const x=a[v].props.order,_=Mc.create(a[v].props.flag);return Lr.is(_,2)||Lr.is(_,4)?1:3===x?d?0:f?4:5:c&&Lr.is(_,16)?7:2!==x||d?0:f?2:3},radius:v=>{const x=a[v];m.structure=t,m.unit=t.unitMap.get(x.unitA),m.element=m.unit.elements[x.indexA];const _=n.size.size(m);m.unit=t.unitMap.get(x.unitB),m.element=m.unit.elements[x.indexB];const w=n.size.size(m);return Math.min(_,w)*l},ignore:P1e(t,r)},{lines:g,boundingSphere:y}=Yye(0,h,r,i);if(y)g.setBoundingSphere(y);else if(g.lineCount>0){const{child:v}=t,x=ke.expand(ke(),(v??t).boundary.sphere,1*l);g.setBoundingSphere(x)}return g}const Lxe={...Ymt,...E$,includeParent:I.Boolean(!1)};function XSt(e){return function Xmt(e,t){return e2({...e,setUpdateState:(n,r,i,o,s,a,l)=>{e.setUpdateState(n,r,i,o,s,a,l),Ya.areEqual(o.size,s.size)||(n.updateSize=!0)},geometryUtils:Mo.Utils},t)}({defaultProps:I.getDefaultValues(Lxe),createGeometry:YSt,createLocationIterator:t=>fv.fromStructure(t),getLoci:P$,eachLocation:M$,setUpdateState:(t,n,r,i,o,s,a)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.linkScale!==r.linkScale||n.linkSpacing!==r.linkSpacing||n.aromaticDashCount!==r.aromaticDashCount||n.dashCount!==r.dashCount||n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||!Ru(n.includeTypes,r.includeTypes)||!Ru(n.excludeTypes,r.excludeTypes)||n.multipleBonds!==r.multipleBonds,s.interUnitBonds!==a.interUnitBonds&&(t.createGeometry=!0,t.updateTransform=!0,t.updateColor=!0,t.updateSize=!0)}},e)}const yI=C.scaleAndAdd,jxe=C.unitX,Uxe=C.unitY,zxe=C.unitZ,Vxe={...KF,lineSizeAttenuation:I.Boolean(!1),ignoreHydrogens:I.Boolean(!1),ignoreHydrogensVariant:I.Select("all",I.arrayToOptions(["all","non-polar"])),traceOnly:I.Boolean(!1),crosses:I.Select("lone",I.arrayToOptions(["lone","all"])),crossSize:I.Numeric(.35,{min:0,max:2,step:.01})};function KSt(e,t,n,r,i,o){const{child:s}=n;if(s&&!s.unitMap.get(t.id))return Mo.createEmpty(o);const a=t.elements,l=a.length,c=Pd.create(l,l/10,o),u=C(),d=C(),f=C(),p=t.conformation,m=g2(n,t,i),h=i.crossSize/2,g="lone"===i.crosses;for(let x=0;x{t.createGeometry=n.ignoreHydrogens!==r.ignoreHydrogens||n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant||n.traceOnly!==r.traceOnly||n.crosses!==r.crosses||n.crossSize!==r.crossSize}},e)}const Hxe={"intra-bond":(e,t)=>Uo("Intra-unit bond line",e,t,$St),"inter-bond":(e,t)=>Ff("Inter-unit bond line",e,t,XSt),"element-point":(e,t)=>Uo("Points",e,t,Dxe),"element-cross":(e,t)=>Uo("Crosses",e,t,ZSt)},QY={...Oxe,...Lxe,...YY,...Vxe,pointStyle:I.Select("circle",I.objectToOptions(G1.StyleTypes)),multipleBonds:I.Select("offset",I.arrayToOptions(["off","symmetric","offset"])),includeParent:I.Boolean(!1),sizeFactor:I.Numeric(2,{min:.01,max:10,step:.01}),unitKinds:MP(["atomic"]),visuals:I.MultiSelect(["intra-bond","inter-bond","element-point","element-cross"],I.objectToOptions(Hxe))},eCt={name:"line",label:"Line",description:"Displays bonds as lines and atoms as points or croses.",factory:function JSt(e,t){return Xn.createMulti("Line",e,t,gl,Hxe)},getParams:function QSt(e,t){if(Xe.getSize(t)>=Xe.Size.Huge){const r=I.clone(QY);return r.visuals.defaultValue=["intra-bond","element-point","element-cross"],r}return QY},defaultValues:I.getDefaultValues(QY),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.elementCount>0,getData:(e,t)=>t.includeParent?e.asParent():e,mustRecreate:(e,t)=>e.includeParent!==t.includeParent};function tCt(e,t,n,r,i){return JY.apply(this,arguments)}function JY(){return JY=le(function*(e,t,n,r,i){const{runtime:o,webgl:s}=e;if(!s||!s.extensions.blendMinMax)throw new Error("GaussianDensityVolume requires `webgl` and `blendMinMax` extension");const a=i?i.gridTexture.ref.value:void 0,l=yield function O2t(e,t,n,r,i){const{position:o,boundary:s,radius:a}=XF(e,t,n),l=sv(s.box,n);return Ke.create("Gaussian Density",function(){var c=le(function*(u){return Qve(r,o,s.box,a,l,i)});return function(u){return c.apply(this,arguments)}}())}(t,n.size,r,s,a).runInContext(o),{transform:c,texture:u,bbox:d,gridDim:f}=l,m=fe.mul(fe(),c,fe.fromScaling(fe(),f)),h=fe.getScaling(C(),c),g=C.create(0,1,2),y=Df.create(d,f,c,m,h,u,{min:0,max:1,mean:.04,sigma:.01},!0,g,i),v=ke.expand(ke(),t.boundary.sphere,l.maxRadius);return y.setBoundingSphere(v),y}),JY.apply(this,arguments)}const Gxe={...Qmt,...ZP,ignoreHydrogens:I.Boolean(!1),ignoreHydrogensVariant:I.Select("all",I.arrayToOptions(["all","non-polar"])),includeParent:I.Boolean(!1,{isHidden:!0})};function nCt(e){return function Jmt(e,t){return e2({...e,setUpdateState:(n,r,i,o,s,a,l)=>{e.setUpdateState(n,r,i,o,s,a,l),Ya.areEqual(o.size,s.size)||(n.createGeometry=!0)},geometryUtils:Df.Utils},t)}({defaultProps:I.getDefaultValues(Gxe),createGeometry:tCt,createLocationIterator:vl.fromStructure,getLoci:b2,eachLocation:y2,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.radiusOffset!==r.radiusOffset&&(t.createGeometry=!0),n.smoothness!==r.smoothness&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0)},dispose:t=>{t.gridTexture.ref.value.destroy()}},e)}function rCt(e,t,n,r,i,o){return eX.apply(this,arguments)}function eX(){return eX=le(function*(e,t,n,r,i,o){const{runtime:s,webgl:a}=e;if(!a)throw new Error("GaussianDensityVolume requires `webgl`");const l=o?o.gridTexture.ref.value:void 0,c=yield function R2t(e,t,n,r,i,o){const{position:s,boundary:a,radius:l}=YF(e,t,n,r),c=sv(a.box,r,cxe(i,e));return Ke.create("Gaussian Density",function(){var u=le(function*(d){return Qve(i,s,a.box,l,c,o)});return function(d){return u.apply(this,arguments)}}())}(n,t,r.size,i,a,l).runInContext(s),{transform:u,texture:d,bbox:f,gridDim:p}=c,h=fe.mul(fe(),u,fe.fromScaling(fe(),p)),g=fe.getScaling(C(),u),y=C.create(0,1,2),v=Df.create(f,p,u,h,g,d,{min:0,max:1,mean:.04,sigma:.01},!0,y,o),x=ke.expand(ke(),t.boundary.sphere,c.maxRadius);return v.setBoundingSphere(x),v}),eX.apply(this,arguments)}const iCt={...ogt,...ZP,ignoreHydrogens:I.Boolean(!1),ignoreHydrogensVariant:I.Select("all",I.arrayToOptions(["all","non-polar"])),includeParent:I.Boolean(!1,{isHidden:!0})};function oCt(e){return function sgt(e,t){return av({...e,setUpdateState:(n,r,i,o,s,a,l)=>{e.setUpdateState(n,r,i,o,s,a,l),Ya.areEqual(o.size,s.size)||(n.createGeometry=!0)},geometryUtils:Df.Utils},t)}({defaultProps:I.getDefaultValues(iCt),createGeometry:rCt,createLocationIterator:vl.fromGroup,getLoci:dm,eachLocation:um,setUpdateState:(t,n,r)=>{n.resolution!==r.resolution&&(t.createGeometry=!0),n.radiusOffset!==r.radiusOffset&&(t.createGeometry=!0),n.smoothness!==r.smoothness&&(t.createGeometry=!0),n.ignoreHydrogens!==r.ignoreHydrogens&&(t.createGeometry=!0),n.ignoreHydrogensVariant!==r.ignoreHydrogensVariant&&(t.createGeometry=!0),n.traceOnly!==r.traceOnly&&(t.createGeometry=!0),n.includeParent!==r.includeParent&&(t.createGeometry=!0)},dispose:t=>{t.gridTexture.ref.value.destroy()}},e)}const qxe={"gaussian-volume":(e,t)=>Ff("Gaussian volume",e,t,nCt),"units-gaussian-volume":(e,t)=>Uo("Units-Gaussian volume",e,t,oCt)},Wxe={...Gxe,jumpLength:I.Numeric(4,{min:0,max:20,step:.1}),visuals:I.MultiSelect(["gaussian-volume"],I.objectToOptions(qxe))},lCt={name:"gaussian-volume",label:"Gaussian Volume",description:"Displays a gaussian molecular density using direct volume rendering.",factory:function aCt(e,t){return Xn.createMulti("Gaussian Volume",e,t,gl,qxe)},getParams:function sCt(e,t){return Wxe},defaultValues:I.getDefaultValues(Wxe),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"physical"},isApplicable:e=>e.elementCount>0},cCt=C.scale,uCt=C.add,dCt=C.sub,tX={...ml,..._W,sizeFactor:I.Numeric(.3,{min:0,max:10,step:.01}),radialSegments:I.Numeric(16,{min:2,max:56,step:2},xt.CustomQualityParamInfo),tryUseImpostor:I.Boolean(!0)};function fCt(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth?function hCt(e){return SW({defaultProps:I.getDefaultValues(tX),createGeometry:pCt,createLocationIterator:t=>nb.fromGroup(t),getLoci:x2,eachLocation:_2,setUpdateState:(t,n,r)=>{},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function gCt(e){return mc({defaultProps:I.getDefaultValues(tX),createGeometry:mCt,createLocationIterator:t=>nb.fromGroup(t),getLoci:x2,eachLocation:_2,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.radialSegments!==r.radialSegments},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}function pCt(e,t,n,r,i,o){const s=t.polymerElements.length;if(!s)return Wu.createEmpty(o);const a=2*s,l=NP.create(a,a/4,o),c=t.conformation,u=C(),d=C(),f=C();eve(t,function(g,y,v,x,_){c.invariantPosition(g,u),c.invariantPosition(y,d);const A=Fu(_)?FO:NO;uCt(f,u,cCt(f,dCt(f,d,u),A)),l.add(u[0],u[1],u[2],f[0],f[1],f[2],1,!1,!1,2,v),l.add(f[0],f[1],f[2],d[0],d[1],d[2],1,!1,!1,2,x)});const m=l.getCylinders(),h=ke.expand(ke(),t.boundary.sphere,1*i.sizeFactor);return m.setBoundingSphere(h),m}function mCt(e,t,n,r,i,o){const s=t.polymerElements.length;if(!s)return on.createEmpty(o);const{radialSegments:a,sizeFactor:l}=i,c=2*a*s*2,u=Ct.createState(c,c/10,o),d=t.conformation,f=C(),p=C(),m={radiusTop:1,radiusBottom:1,radialSegments:a},h=dt.create(n,t),g=dt.create(n,t);eve(t,function(_,w,A,M,E){h.element=_,g.element=w,d.invariantPosition(h.element,f),d.invariantPosition(g.element,p);const T=Fu(E)?FO:NO;m.radiusTop=m.radiusBottom=r.size.size(h)*l,u.currentGroup=A,Ur(u,f,p,T,m),m.radiusTop=m.radiusBottom=r.size.size(g)*l,u.currentGroup=M,Ur(u,p,f,1-T,m)});const v=Ct.getMesh(u),x=ke.expand(ke(),t.boundary.sphere,1*i.sizeFactor);return v.setBoundingSphere(x),v}const nX={...ml,...vW,sizeFactor:I.Numeric(.3,{min:0,max:10,step:.01}),detail:I.Numeric(0,{min:0,max:3,step:1},xt.CustomQualityParamInfo),tryUseImpostor:I.Boolean(!0)};function yCt(e,t,n,r){return n.tryUseImpostor&&r&&r.extensions.fragDepth&&r.extensions.textureFloat?function vCt(e){return xW({defaultProps:I.getDefaultValues(nX),createGeometry:bCt,createLocationIterator:t=>nb.fromGroup(t),getLoci:x2,eachLocation:_2,setUpdateState:(t,n,r)=>{},mustRecreate:(t,n,r)=>!n.tryUseImpostor||!r},e)}(e):function _Ct(e){return mc({defaultProps:I.getDefaultValues(nX),createGeometry:xCt,createLocationIterator:t=>nb.fromGroup(t),getLoci:x2,eachLocation:_2,setUpdateState:(t,n,r)=>{t.createGeometry=n.sizeFactor!==r.sizeFactor||n.detail!==r.detail},mustRecreate:(t,n,r)=>n.tryUseImpostor&&!!r},e)}(e)}function bCt(e,t,n,r,i,o){const s=t.polymerElements.length;if(!s)return Rp.createEmpty(o);const a=HA.create(s,s/2,o),l=t.conformation,c=C();tve(t,(p,m)=>{l.invariantPosition(p,c),a.add(c[0],c[1],c[2],m)});const d=a.getSpheres(),f=ke.expand(ke(),t.boundary.sphere,1*i.sizeFactor);return d.setBoundingSphere(f),d}function xCt(e,t,n,r,i,o){const s=t.polymerElements.length;if(!s)return on.createEmpty(o);const{detail:a,sizeFactor:l}=i,c=s*qw(a),u=Ct.createState(c,c/2,o),d=t.conformation,f=C(),p=dt.create(n,t);tve(t,(y,v)=>{p.element=y,d.invariantPosition(p.element,f),u.currentGroup=v,Jr(u,f,r.size.size(p)*l,a)});const h=Ct.getMesh(u),g=ke.expand(ke(),t.boundary.sphere,1*i.sizeFactor);return h.setBoundingSphere(g),h}const $xe={"polymer-backbone-cylinder":(e,t)=>Uo("Polymer backbone cylinder",e,t,fCt),"polymer-backbone-sphere":(e,t)=>Uo("Polymer backbone sphere",e,t,yCt),"polymer-gap":(e,t)=>Uo("Polymer gap cylinder",e,t,xY)},Yxe={...nX,...tX,...tB,sizeAspectRatio:I.Numeric(1,{min:.1,max:3,step:.1}),visuals:I.MultiSelect(["polymer-backbone-cylinder","polymer-backbone-sphere","polymer-gap"],I.objectToOptions($xe)),bumpFrequency:I.Numeric(0,{min:0,max:10,step:.1},xt.ShadingCategory),colorMode:I.Select("default",I.arrayToOptions(["default","interpolate"]),{...xt.ShadingCategory,isHidden:!0})},wCt={name:"backbone",label:"Backbone",description:"Displays polymer backbone with cylinders and spheres.",factory:function CCt(e,t){return Xn.createMulti("Backbone",e,t,gl,$xe)},getParams:function SCt(e,t){const n=I.clone(Yxe);let r=!1;return t.units.forEach(i=>{!r&&i.gapElements.length&&(r=!0)}),n.visuals.defaultValue=["polymer-backbone-cylinder","polymer-backbone-sphere"],r&&n.visuals.defaultValue.push("polymer-gap"),n},defaultValues:I.getDefaultValues(Yxe),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uniform"},isApplicable:e=>e.polymerResidueCount>0};class JP extends ume{constructor(){super(),Nu(JP.BuiltIn,(t,n)=>{if(t.name!==n)throw new Error(`Fix BuiltInStructureRepresentations to have matching names. ${t.name} ${n}`);this.add(t)})}}!function(e){e.BuiltIn={cartoon:v2t,backbone:wCt,"ball-and-stick":nxt,carbohydrate:Uxt,ellipsoid:w2t,"gaussian-surface":Q2t,"gaussian-volume":lCt,label:sSt,line:eCt,"molecular-surface":_St,orientation:PSt,point:BSt,putty:VSt,spacefill:qSt}}(JP||(JP={}));class ACt{get isAnimating(){return this._isAnimating}tick(t,n){var r=this;return le(function*(){var i,o;if(yield r.plugin.managers.animation.tick(t,n?.isSynchronous,n?.animation),null===(i=r.plugin.canvas3d)||void 0===i||i.tick(t,n),It){const s=null===(o=r.plugin.canvas3d)||void 0===o?void 0:o.webgl.timer.resolve();if(s)for(const a of s)ode([a])}})()}resetTime(t=Bo()){var n;null===(n=this.plugin.canvas3d)||void 0===n||n.resetTime(t)}start(t){var n;null===(n=this.plugin.canvas3d)||void 0===n||n.resume(),this._isAnimating=!0,this.resetTime(),t?.immediate?this.frame():this.currentFrame=requestAnimationFrame(this.frame)}stop(t){var n;this._isAnimating=!1,void 0!==this.currentFrame&&(cancelAnimationFrame(this.currentFrame),this.currentFrame=void 0),t?.noDraw&&(null===(n=this.plugin.canvas3d)||void 0===n||n.pause(t?.noDraw))}constructor(t){this.plugin=t,this.currentFrame=void 0,this._isAnimating=!1,this.frame=()=>{this.tick(Bo()),this._isAnimating&&(this.currentFrame=requestAnimationFrame(this.frame))}}}class M2 extends wP{get animation(){return this.plugin.managers.animation}getSnapshot(t){var n,r,i;const o={...this.snapshotParams.value,...t};return{id:oo.create22(),data:o.data?this.data.getSnapshot():void 0,behaviour:o.behavior?this.behaviors.getSnapshot():void 0,animation:o.animation?this.animation.getSnapshot():void 0,startAnimation:o.startAnimation?!!o.startAnimation:void 0,camera:o.camera?{current:this.plugin.canvas3d.camera.getSnapshot(),transitionStyle:o.cameraTransition.name,transitionDurationInMs:"animate"===(null===(n=o?.cameraTransition)||void 0===n?void 0:n.name)?o.cameraTransition.params.durationInMs:void 0}:void 0,canvas3dContext:o.canvas3dContext?{props:null===(r=this.plugin.canvas3dContext)||void 0===r?void 0:r.props}:void 0,canvas3d:o.canvas3d?{props:null===(i=this.plugin.canvas3d)||void 0===i?void 0:i.props}:void 0,interactivity:o.interactivity?{props:this.plugin.managers.interactivity.props}:void 0,structureFocus:this.plugin.managers.structure.focus.getSnapshot(),structureSelection:o.structureSelection?this.plugin.managers.structure.selection.getSnapshot():void 0,structureComponentManager:o.componentManager?{options:this.plugin.managers.structure.component.state.options}:void 0,durationInMs:o?.durationInMs}}setSnapshot(t){var n=this;return le(function*(){var r,i,o,s,a;if(yield n.animation.stop(),!(null===(r=t.structureComponentManager)||void 0===r)&&r.options&&n.plugin.managers.structure.component._setSnapshotState(null===(i=t.structureComponentManager)||void 0===i?void 0:i.options),t.behaviour&&(yield n.plugin.runTask(n.behaviors.setSnapshot(t.behaviour))),t.data&&(yield n.plugin.runTask(n.data.setSnapshot(t.data))),null!==(o=t.canvas3d)&&void 0!==o&&o.props){const l=I.normalizeParams(Fd,t.canvas3d.props,"children");yield jt.Canvas3D.SetSettings(n.plugin,{settings:l})}if(null!==(s=t.canvas3dContext)&&void 0!==s&&s.props){const l=I.normalizeParams(K_.Params,t.canvas3dContext.props,"children");null===(a=n.plugin.canvas3dContext)||void 0===a||a.setProps(l)}t.interactivity&&t.interactivity.props&&n.plugin.managers.interactivity.setProps(t.interactivity.props),t.structureFocus&&n.plugin.managers.structure.focus.setSnapshot(t.structureFocus),t.structureSelection&&n.plugin.managers.structure.selection.setSnapshot(t.structureSelection),t.animation&&n.animation.setSnapshot(t.animation),t.camera&&jt.Camera.Reset(n.plugin,{snapshot:t.camera.current,durationMs:"animate"===t.camera.transitionStyle?t.camera.transitionDurationInMs:void 0}),t.startAnimation&&n.animation.start()})()}updateTransform(t,n,r,i){const o=t.build().to(n).update(r);return jt.State.Update(this.plugin,{state:t,tree:o,options:{canUndo:i}})}hasBehavior(t){return this.behaviors.tree.transforms.has(t.id)}updateBehavior(t,n){const r=this.behaviors.build();if(this.behaviors.tree.transforms.has(t.id))r.to(t.id).update(n);else{const i=t.createDefaultParams(void 0,this.plugin);r.to(ii.getCategoryId(t)).apply(t,fy(i,n),{ref:t.id})}return this.plugin.runTask(this.behaviors.updateTree(r))}dispose(){this.behaviors.cells.forEach(t=>{var n,r,i,o;ii.Behavior.is(t.obj)&&(null===(r=(n=t.obj.data).unregister)||void 0===r||r.call(n),null===(o=(i=t.obj.data).dispose)||void 0===o||o.call(i))}),super.dispose(),this.data.dispose(),this.behaviors.dispose(),this.animation.dispose()}constructor(t){super(),this.plugin=t,this.data=L1.create(new Se.Root({}),{runTask:this.plugin.runTask,globalContext:this.plugin,historyCapacity:this.plugin.config.get(ei.State.HistoryCapacity)}),this.behaviors=L1.create(new ii.Root({}),{runTask:this.plugin.runTask,globalContext:this.plugin,rootState:{isLocked:!0}}),this.events={cell:{stateUpdated:Jy(this.data.events.cell.stateUpdated,this.behaviors.events.cell.stateUpdated),created:Jy(this.data.events.cell.created,this.behaviors.events.cell.created),removed:Jy(this.data.events.cell.removed,this.behaviors.events.cell.removed)},object:{created:Jy(this.data.events.object.created,this.behaviors.events.object.created),removed:Jy(this.data.events.object.removed,this.behaviors.events.object.removed),updated:Jy(this.data.events.object.updated,this.behaviors.events.object.updated)}},this.snapshotParams=this.ev.behavior(M2.DefaultSnapshotParams),this.setSnapshotParams=n=>{this.snapshotParams.next({...M2.DefaultSnapshotParams,...n})}}}!function(e){e.SnapshotParams={durationInMs:I.Numeric(1500,{min:100,max:15e3,step:100},{label:"Duration in ms"}),data:I.Boolean(!0),behavior:I.Boolean(!1),structureSelection:I.Boolean(!1),componentManager:I.Boolean(!0),animation:I.Boolean(!0),startAnimation:I.Boolean(!1),canvas3d:I.Boolean(!0),canvas3dContext:I.Boolean(!0),interactivity:I.Boolean(!0),camera:I.Boolean(!0),cameraTransition:I.MappedStatic("animate",{animate:I.Group({durationInMs:I.Numeric(250,{min:100,max:5e3,step:500},{label:"Duration in ms"})}),instant:I.Group({})},{options:[["animate","Animate"],["instant","Instant"]]}),image:I.Boolean(!1)},e.DefaultSnapshotParams=I.getDefaultValues(e.SnapshotParams)}(M2||(M2={}));class ICt{getDecorator(t){const n=this.plugin.state.data.tree,r=n.children.get(t);if(1!==r.size)return t;const i=r.first();return n.transforms.get(i).transformer.definition.isDecorator?this.getDecorator(i):t}get(t,n=!1){const r=this.root.get(t);if(r)return this.plugin.state.data.cells.get(n?r.ref:this.getDecorator(r.ref))}addMapping(t,n,r){if(!Se.Molecule.Structure.is(r))return!1;if(this.tracked.set(n,r.data),this.root.has(r.data))this.root.get(r.data).count++;else{const i=t.select(Qn.Generators.byRef(n).rootOfType([Se.Molecule.Structure]))[0];this.root.set(r.data,i?{ref:i.transform.ref,count:1}:{ref:n,count:1})}return!0}removeMapping(t){if(!this.tracked.has(t))return!1;const n=this.tracked.get(t);this.tracked.delete(t);const r=this.root.get(n);return r.count>1?r.count--:this.root.delete(n),!0}updateMapping(t,n,r,i){return!!Se.Molecule.Structure.is(i)&&(this.removeMapping(n),this.addMapping(t,n,i),!0)}dispose(){this.ev.dispose()}constructor(t){this.plugin=t,this.ev=uy.create(),this.events={updated:this.ev(),removed:this.ev()},this.root=new Map,this.tracked=new Map,t.state.data.events.object.created.subscribe(n=>{this.addMapping(n.state,n.ref,n.obj)}),t.state.data.events.object.removed.subscribe(n=>{this.removeMapping(n.ref)&&this.events.removed.next({ref:n.ref,obj:n.obj})}),t.state.data.events.object.updated.subscribe(n=>{this.updateMapping(n.state,n.ref,n.oldObj,n.obj)&&this.events.updated.next({ref:n.ref,oldObj:n.oldObj,obj:n.obj})})}}class rX{constructor(){this.ev=uy.create(),this.id=0,this.runningTasks=new Set,this.abortRequests=new Map,this.options=new Map,this.currentContext=[],this.events={progress:this.ev(),finished:this.ev()}}tryGetAbortTaskId(t){if(this.abortRequests.has(t.progress.taskId))return t.progress.taskId;for(const n of t.children){const r=this.tryGetAbortTaskId(n);if(void 0!==r)return r}}track(t,n){return r=>{var i;if(r.canAbort&&r.requestAbort){const s=this.tryGetAbortTaskId(r.root);void 0!==s&&r.requestAbort(this.abortRequests.get(s))}const o=Bo()-r.root.progress.startedTime;this.events.progress.next({id:t,useOverlay:null===(i=this.options.get(n))||void 0===i?void 0:i.useOverlay,level:o<250?"none":"background",progress:r})}}run(t,n){var r=this;return le(function*(){const i=r.id++;let o;n?.createNewContext||0===r.currentContext.length?o={ctx:iOe(t,r.track(i,t.id),100),refCount:1}:(o=r.currentContext[r.currentContext.length-1],o.refCount++);try{return r.options.set(t.id,{useOverlay:!!n?.useOverlay}),r.runningTasks.add(t.id),yield poe(o.ctx,t)}finally{r.options.delete(t.id),r.runningTasks.delete(t.id),r.events.finished.next({id:i}),r.abortRequests.delete(t.id),o.refCount--,0===o.refCount&&p3(r.currentContext,o)}})()}requestAbortAll(t){this.runningTasks.forEach(n=>this.abortRequests.set(n,t))}requestAbort(t,n){this.abortRequests.set("number"==typeof t?t:t.root.progress.taskId,n)}dispose(){this.ev.dispose()}}!function(e){function t(r){return new Promise(i=>setTimeout(i,r))}e.testTask=function n(r){return Ke.create("Test",function(){var i=le(function*(o){let s=0;for(;s!!n&&n.key===t)}show(t){let r,n=this.state.entries;const i=++this.serialId;let o;t.key&&(r=this.findByKey(t.key))?(void 0!==r.timeout&&clearTimeout(r.timeout),o=r.serialNumber,n=n.remove(r.id)):o=++this.serialNumber,r={id:i,serialNumber:o,key:t.key,title:t.title,message:t.message,timeout:this.timeout(i,t.timeoutMs),hide:()=>this.hideId(i)},this.updateState({entries:n.set(i,r)})&&this.events.changed.next(void 0)}timeout(t,n){if(void 0!==n)return n<0&&(n=500),setTimeout(()=>{const r=this.state.entries.get(t);r.timeout=void 0,this.hide(r)},n)}hideId(t){this.hide(this.state.entries.get(t))}hide(t){t&&(void 0!==t.timeout&&clearTimeout(t.timeout),t.hide=void 0,this.updateState({entries:this.state.entries.delete(t.id)})&&this.events.changed.next(void 0))}constructor(t){super({entries:Nc()}),this.events={changed:this.ev()},this.serialNumber=0,this.serialId=0,jt.Toast.Show.subscribe(t,n=>this.show(n)),jt.Toast.Hide.subscribe(t,n=>this.hide(this.findByKey(n.key)))}}class TCt extends wP{createParams(){const t=Math.min(this.plugin.canvas3d?this.plugin.canvas3d.webgl.maxRenderbufferSize:4096,4096);return{resolution:I.MappedStatic("viewport",{viewport:I.Group({}),hd:I.Group({}),"full-hd":I.Group({}),"ultra-hd":I.Group({}),custom:I.Group({width:I.Numeric(1920,{min:128,max:t,step:1}),height:I.Numeric(1080,{min:128,max:t,step:1})},{isFlat:!0})},{options:[["viewport","Viewport"],["hd","HD (1280 x 720)"],["full-hd","Full HD (1920 x 1080)"],["ultra-hd","Ultra HD (3840 x 2160)"],["custom","Custom"]]}),transparent:I.Boolean(!1),axes:kF.axes}}get params(){return this._params?this._params:this._params=this.createParams()}get values(){return this.behaviors.values.value}get cropParams(){return this.behaviors.cropParams.value}get relativeCrop(){return this.behaviors.relativeCrop.value}getCanvasSize(){var t,n;return{width:(null===(t=this.plugin.canvas3d)||void 0===t?void 0:t.webgl.gl.drawingBufferWidth)||0,height:(null===(n=this.plugin.canvas3d)||void 0===n?void 0:n.webgl.gl.drawingBufferHeight)||0}}getSize(){const t=this.values;switch(t.resolution.name){case"viewport":return this.getCanvasSize();case"hd":return{width:1280,height:720};case"full-hd":return{width:1920,height:1080};case"ultra-hd":return{width:3840,height:2160};default:return{width:t.resolution.params.width,height:t.resolution.params.height}}}createPass(t){const n=this.plugin.canvas3d,{colorBufferFloat:r,textureFloat:i}=n.webgl.extensions,o=n.props.postprocessing.occlusion;return n.getImagePass({transparentBackground:this.values.transparent,cameraHelper:{axes:this.values.axes},multiSample:{...n.props.multiSample,mode:t?"on":"off",sampleLevel:r&&i?4:2},postprocessing:{...n.props.postprocessing,occlusion:"on"===o.name?{name:"on",params:{...o.params,samples:128,resolutionScale:n.webgl.pixelRatio}}:o},marking:{...n.props.marking}})}get previewPass(){return this._previewPass||(this._previewPass=this.createPass(!1))}get imagePass(){if(this._imagePass){const t=this.plugin.canvas3d,n=t.props.postprocessing.occlusion;return this._imagePass.setProps({cameraHelper:{axes:this.values.axes},transparentBackground:this.values.transparent,postprocessing:{...t.props.postprocessing,occlusion:"on"===n.name?{name:"on",params:{...n.params,samples:128,resolutionScale:t.webgl.pixelRatio}}:n},marking:{...t.props.marking}}),this._imagePass}return this._imagePass=this.createPass(!0)}getFilename(t=".png"){const n=this.plugin.state.data.select(Qn.Generators.rootsOfType(Se.Molecule.Model)).map(o=>o.obj.data),r=new Set;return n.forEach(o=>r.add(o.entryId.toUpperCase())),`${Lo.toArray(r).join("-")||"molstar-image"}${t}`}resetCrop(){this.behaviors.relativeCrop.next({x:0,y:0,width:1,height:1})}toggleAutocrop(){this.cropParams.auto?(this.behaviors.cropParams.next({...this.cropParams,auto:!1}),this.resetCrop()):this.behaviors.cropParams.next({...this.cropParams,auto:!0})}get isFullFrame(){const t=this.relativeCrop;return Do(t.x,0,1e-5)&&Do(t.y,0,1e-5)&&Do(t.width,1,1e-5)&&Do(t.height,1,1e-5)}autocrop(t=this.cropParams.relativePadding){const{data:n,width:r,height:i}=this.previewData.image,o=this.previewData.transparent,s=o?this.previewData.background:4278190080|this.previewData.background;let a=r,l=0,c=i,u=0;for(let m=0;ml&&(l=g),mu&&(u=m)}}if(a>l){const m=a;a=l,l=m}if(c>u){const m=c;c=u,u=m}const d=l-a+1,f=u-c+1;a-=t*d,l+=t*d,c-=t*f,u+=t*f;const p={x:Math.max(0,a/r),y:Math.max(0,c/i),width:Math.min(1,(l-a+1)/r),height:Math.min(1,(u-c+1)/i)};this.behaviors.relativeCrop.next(p)}getPreview(t=320){const{width:n,height:r}=this.getSize();if(n<=0||r<=0)return;const i=n/r;let o=0,s=0;i>1?(o=t,s=Math.round(t/i)):(s=t,o=Math.round(t*i));const a=this.plugin.canvas3d.props;this.previewPass.setProps({cameraHelper:{axes:this.values.axes},transparentBackground:this.values.transparent,postprocessing:a.postprocessing,marking:a.marking});const l=this.previewPass.getImageData(o,s),c=this.previewCanvas;c.width=l.width,c.height=l.height,this.previewData.image=l,this.previewData.background=a.renderer.backgroundColor,this.previewData.transparent=this.values.transparent;const u=c.getContext("2d");if(!u)throw new Error("Could not create canvas 2d context");return u.putImageData(l,0,0),this.cropParams.auto&&this.autocrop(),this.events.previewed.next(void 0),{canvas:c,width:o,height:s}}getSizeAndViewport(){const{width:t,height:n}=this.getSize(),r=this.relativeCrop,i={x:Math.floor(r.x*t),y:Math.floor(r.y*n),width:Math.ceil(r.width*t),height:Math.ceil(r.height*n)};return i.width+i.x>t&&(i.width=t-i.x),i.height+i.y>n&&(i.height=n-i.y),{width:t,height:n,viewport:i}}draw(t){var n=this;return le(function*(){const{width:r,height:i,viewport:o}=n.getSizeAndViewport();if(r<=0||i<=0)return;yield t.update("Rendering image...");const s=n.imagePass;yield s.updateBackground();const a=s.getImageData(r,i,o);yield t.update("Encoding image...");const l=n.canvas;l.width=a.width,l.height=a.height;const c=l.getContext("2d");if(!c)throw new Error("Could not create canvas 2d context");c.putImageData(a,0,0)})()}copyToClipboardTask(){var t=this;const n=navigator.clipboard;if(n?.write)return Ke.create("Copy Image",function(){var r=le(function*(i){yield t.draw(i),yield i.update("Converting image...");const o=yield yq(t.canvas,"png"),s=new ClipboardItem({"image/png":o});yield n.write([s]),t.plugin.log.message("Image copied to clipboard.")});return function(i){return r.apply(this,arguments)}}());this.plugin.log.error("clipboard.write not supported!")}getImageDataUri(){var t=this;return this.plugin.runTask(Ke.create("Generate Image",function(){var n=le(function*(r){return yield t.draw(r),yield r.update("Converting image..."),t.canvas.toDataURL("png")});return function(r){return n.apply(this,arguments)}}()))}copyToClipboard(){const t=this.copyToClipboardTask();if(t)return this.plugin.runTask(t)}downloadTask(t){var n=this;return Ke.create("Download Image",function(){var r=le(function*(i){yield n.draw(i),yield i.update("Downloading image..."),Mge(yield yq(n.canvas,"png"),t??n.getFilename())});return function(i){return r.apply(this,arguments)}}())}download(t){this.plugin.runTask(this.downloadTask(t))}constructor(t){super(),this.plugin=t,this._params=void 0,this.behaviors={values:this.ev.behavior({transparent:this.params.transparent.defaultValue,axes:{name:"off",params:{}},resolution:this.params.resolution.defaultValue}),cropParams:this.ev.behavior({auto:!0,relativePadding:.1}),relativeCrop:this.ev.behavior({x:0,y:0,width:1,height:1})},this.events={previewed:this.ev()},this.canvas=document.createElement("canvas"),this.previewCanvas=document.createElement("canvas"),this.previewData={image:{data:new Uint8ClampedArray(1),width:1,height:0},background:st(0),transparent:!1}}}class DCt{addHandler(t,n){const r=this.handlers.findIndex(i=>i[0]===t);r<0?this.handlers.push([t,n]):this.handlers[r][1]=n}removeHandler(t){const n=this.handlers.findIndex(r=>r[0]===t);n>=0&&this.handlers.splice(n,1)}handle(t){var n=this;return le(function*(){for(let r=n.handlers.length-1;r>=0;r--){const i=n.handlers[r][1];if(yield i(t,n.plugin))return}!function PCt(e,t){const n=t.filter(r=>{const i=r.name.toLowerCase();return i.endsWith(".molx")||i.endsWith(".molj")});n.length>0?jt.State.Snapshots.OpenFile(e,{file:n[0]}):e.runTask(e.state.data.applyAction(NW,{files:t.map(r=>jr.File(r)),format:{name:"auto",params:{}},visuals:!0}))}(n.plugin,t)})()}dispose(){this.handlers.length=0}constructor(t){this.plugin=t,this.handlers=[]}}class kCt{get isInitialized(){return this._isInitialized}build(){return this.state.data.build()}initContainer(t){var n;if(this.canvasContainer)return!0;const r=document.createElement("div");Object.assign(r.style,{position:"absolute",left:0,top:0,right:0,bottom:0,"-webkit-user-select":"none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none","touch-action":"manipulation"});let i=null===(n=t?.canvas3dContext)||void 0===n?void 0:n.canvas;return i||(i=document.createElement("canvas"),t?.checkeredCanvasBackground&&Object.assign(i.style,{"background-image":"linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%, lightgrey), linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%, lightgrey)","background-size":"60px 60px","background-position":"0 0, 30px 30px"}),r.appendChild(i)),!!this.initViewer(i,r,t?.canvas3dContext)&&(this.canvasContainer=r,!0)}mount(t,n){var r;if(this.disposed)throw new Error("Cannot mount a disposed context");return!!this.initContainer(n)&&(this.canvasContainer.parentElement!==t&&(null===(r=this.canvasContainer.parentElement)||void 0===r||r.removeChild(this.canvasContainer)),t.appendChild(this.canvasContainer),this.handleResize(),!0)}unmount(){var t,n;null===(n=null===(t=this.canvasContainer)||void 0===t?void 0:t.parentElement)||void 0===n||n.removeChild(this.canvasContainer)}initViewer(t,n,r){var i,o,s,a,l,c;try{this.layout.setRoot(n),this.spec.layout&&this.spec.layout.initial&&this.layout.setProps(this.spec.layout.initial),r||(r=K_.fromCanvas(t,this.managers.asset,{antialias:!(null!==(i=this.config.get(ei.General.DisableAntialiasing))&&void 0!==i&&i),preserveDrawingBuffer:!(null!==(o=this.config.get(ei.General.DisablePreserveDrawingBuffer))&&void 0!==o&&o),preferWebGl1:this.config.get(ei.General.PreferWebGl1)||!1,failIfMajorPerformanceCaveat:!(null!==(s=this.config.get(ei.General.AllowMajorPerformanceCaveat))&&void 0!==s&&s),powerPreference:this.config.get(ei.General.PowerPreference)||"high-performance",handleResize:this.handleResize},{pixelScale:this.config.get(ei.General.PixelScale)||1,pickScale:this.config.get(ei.General.PickScale)||.25,transparency:this.config.get(ei.General.Transparency)||"wboit"})),this.canvas3dContext=r,this.canvas3d=zq.create(this.canvas3dContext),this.canvas3dInit.next(!0);let u=this.spec.canvas3d;const d=st(16579577);return u?(void 0===(null===(l=u.renderer)||void 0===l?void 0:l.backgroundColor)&&(u=fy(u,f=>{f.renderer?f.renderer.backgroundColor=d:f.renderer={backgroundColor:d}})),null===(c=this.canvas3d)||void 0===c||c.setProps(u)):null===(a=this.canvas3d)||void 0===a||a.setProps({renderer:{backgroundColor:d}}),this.animationLoop.start(),this.helpers.viewportScreenshot=new TCt(this),this.subs.push(this.canvas3d.interaction.click.subscribe(f=>this.behaviors.interaction.click.next(f))),this.subs.push(this.canvas3d.interaction.drag.subscribe(f=>this.behaviors.interaction.drag.next(f))),this.subs.push(this.canvas3d.interaction.hover.subscribe(f=>this.behaviors.interaction.hover.next(f))),this.subs.push(this.canvas3d.input.resize.pipe(Qbe(50),mA(100,void 0,{leading:!1,trailing:!0})).subscribe(()=>this.handleResize())),this.subs.push(this.canvas3d.input.keyDown.subscribe(f=>this.behaviors.interaction.key.next(f))),this.subs.push(this.canvas3d.input.keyUp.subscribe(f=>this.behaviors.interaction.keyReleased.next(f))),this.subs.push(this.layout.events.updated.subscribe(()=>requestAnimationFrame(()=>this.handleResize()))),this.handleResize(),m3.setImmediate(()=>this.initCanvas3dPromiseCallbacks[0]()),!0}catch(u){return this.log.error(""+u),console.error(u),m3.setImmediate(()=>this.initCanvas3dPromiseCallbacks[1](u)),!1}}get isBusy(){return this.behaviors.state.isAnimating.value||this.behaviors.state.isUpdating.value}get selectionMode(){return this.behaviors.interaction.selectionMode.value}set selectionMode(t){this.behaviors.interaction.selectionMode.next(t)}dataTransaction(t,n){return this.runTask(this.state.data.transaction(t,n))}clear(t=!1){var n;return t&&(null===(n=this.canvas3d)||void 0===n||n.setProps(Uq)),jt.State.RemoveObject(this,{state:this.state.data,ref:vr.RootRef})}dispose(t){var n,r;if(!this.disposed){for(const i of this.subs)i.unsubscribe();this.subs=[],this.animationLoop.stop(),this.commands.dispose(),null===(n=this.canvas3d)||void 0===n||n.dispose(),null===(r=this.canvas3dContext)||void 0===r||r.dispose(t),this.ev.dispose(),this.state.dispose(),this.helpers.substructureParent.dispose(),Nu(this.managers,i=>{var o;return null===(o=i?.dispose)||void 0===o?void 0:o.call(i)}),Nu(this.managers.structure,i=>{var o;return null===(o=i?.dispose)||void 0===o?void 0:o.call(i)}),Nu(this.managers.volume,i=>{var o;return null===(o=i?.dispose)||void 0===o?void 0:o.call(i)}),this.unmount(),this.canvasContainer=void 0,this.customState={},this.disposed=!0}}initBehaviorEvents(){this.subs.push(Jy(this.state.data.behaviors.isUpdating,this.state.behaviors.behaviors.isUpdating).subscribe(s=>{this.behaviors.state.isUpdating.value!==s&&this.behaviors.state.isUpdating.next(s)}));const t=this.config.get(ei.General.IsBusyTimeoutMs)||750,n=this.behaviors.state.isBusy;let r;const i=()=>{n.value||n.next(!0)},o=()=>{void 0!==r&&clearTimeout(r),r=void 0};this.subs.push(Jy(this.behaviors.state.isUpdating,this.behaviors.state.isAnimating).subscribe(s=>{this.behaviors.state.isUpdating.value||this.behaviors.state.isAnimating.value?n.value||(o(),r=setTimeout(i,t)):(o(),n.next(!1))})),this.subs.push(this.behaviors.interaction.selectionMode.subscribe(s=>{var a;s||null===(a=this.managers.interactivity)||void 0===a||a.lociSelects.deselectAll()}))}initBuiltInBehavior(){nO.State.registerDefault(this),nO.Representation.registerDefault(this),nO.Camera.registerDefault(this),nO.Misc.registerDefault(this),this.subs.push(Jy(this.state.data.events.log,this.state.behaviors.events.log).subscribe(t=>this.events.log.next(t)))}initBehaviors(){var t=this;return le(function*(){let n=t.state.behaviors.build();for(const r of Object.keys(ii.Categories))n.toRoot().apply(ii.CreateCategory,{label:ii.Categories[r]},{ref:r,state:{isLocked:!0}});for(const r of t.spec.behaviors)"custom-props"===ii.getCategoryId(r.transformer)&&n.to(ii.getCategoryId(r.transformer)).apply(r.transformer,r.defaultParams,{ref:r.transformer.id});yield t.runTask(t.state.behaviors.updateTree(n,{doNotUpdateCurrent:!0,doNotLogTiming:!0})),n=t.state.behaviors.build();for(const r of t.spec.behaviors)"custom-props"!==ii.getCategoryId(r.transformer)&&n.to(ii.getCategoryId(r.transformer)).apply(r.transformer,r.defaultParams,{ref:r.transformer.id});yield t.runTask(t.state.behaviors.updateTree(n,{doNotUpdateCurrent:!0,doNotLogTiming:!0}))})()}initCustomFormats(){if(this.spec.customFormats)for(const t of this.spec.customFormats)this.dataFormats.add(t[0],t[1])}initAnimations(){if(this.spec.animations)for(const t of this.spec.animations)this.managers.animation.register(t)}initDataActions(){if(this.spec.actions)for(const t of this.spec.actions)this.state.data.actions.add(t.action)}init(){var t=this;return le(function*(){try{t.subs.push(t.events.log.subscribe(n=>t.log.entries=t.log.entries.push(n))),t.initCustomFormats(),t.initBehaviorEvents(),t.initBuiltInBehavior(),t.managers.interactivity=new eb(t),t.managers.lociLabels=new $1t(t),t.builders.structure=new x1t(t),t.initAnimations(),t.initDataActions(),yield t.initBehaviors(),t.log.message(`Mol* Plugin 4.0.1 [${Oct.toLocaleString()}]`),g3||t.log.message("Development mode enabled"),$n&&t.log.message("Debug mode enabled"),t._isInitialized=!0,t.initializedPromiseCallbacks[0]()}catch(n){throw t.initializedPromiseCallbacks[1](n),n}})()}constructor(t){var n;this.spec=t,this.runTask=(r,i)=>this.managers.task.run(r,i),this.resolveTask=r=>{if(r)return Ke.is(r)?this.runTask(r):r},this.subs=[],this.initCanvas3dPromiseCallbacks=[()=>{},()=>{}],this._isInitialized=!1,this.initializedPromiseCallbacks=[()=>{},()=>{}],this.disposed=!1,this.canvasContainer=void 0,this.ev=uy.create(),this.config=new Uat(this.spec.config),this.state=new M2(this),this.commands=new Yat,this.canvas3dInit=this.ev.behavior(!1),this.behaviors={state:{isAnimating:this.ev.behavior(!1),isUpdating:this.ev.behavior(!1),isBusy:this.ev.behavior(!1)},interaction:{hover:this.ev.behavior({current:Xn.Loci.Empty,modifiers:Rf.None,buttons:0,button:0}),click:this.ev.behavior({current:Xn.Loci.Empty,modifiers:Rf.None,buttons:0,button:0}),drag:this.ev.behavior({current:Xn.Loci.Empty,modifiers:Rf.None,buttons:0,button:0,pageStart:Ue(),pageEnd:Ue()}),key:this.ev.behavior(Qge),keyReleased:this.ev.behavior(Qge),selectionMode:this.ev.behavior(!1)},labels:{highlight:this.ev.behavior({labels:[]})},layout:{leftPanelTabName:this.ev.behavior("root")},canvas3d:{initialized:this.canvas3dInit.pipe(xd(r=>!!r),zx(1))}},this.canvas3dInitialized=new Promise((r,i)=>{this.initCanvas3dPromiseCallbacks=[r,i]}),this.initialized=new Promise((r,i)=>{this.initializedPromiseCallbacks=[r,i]}),this.layout=new Nvt(this),this.animationLoop=new ACt(this),this.representation={structure:{registry:new JP,themes:{colorThemeRegistry:Rd.createRegistry(),sizeThemeRegistry:Ya.createRegistry()}},volume:{registry:new bA,themes:{colorThemeRegistry:Rd.createRegistry(),sizeThemeRegistry:Ya.createRegistry()}}},this.query={structure:{registry:new Pet}},this.dataFormats=new P1t,this.builders={data:new p1t(this),structure:void 0},this.helpers={substructureParent:new ICt(this),viewportScreenshot:void 0},this.managers={structure:{hierarchy:new m2(this),component:new Bg(this),measurement:new gvt(this),selection:new bvt(this),focus:new Q1t(this)},volume:{hierarchy:new CO(this)},interactivity:void 0,camera:new W1t(this),animation:new k1t(this),snapshot:new vA(this),lociLabels:void 0,toast:new ECt(this),asset:new Yze,task:new rX,dragAndDrop:new DCt(this)},this.events={log:this.ev(),task:this.managers.task.events,canvas3d:{settingsUpdated:this.ev()}},this.customModelProperties=new bO.Registry,this.customStructureProperties=new bO.Registry,this.customStructureControls=new Map,this.customImportControls=new Map,this.genericRepresentationControls=new Map,this.customState=Object.create(null),this.handleResize=()=>{var r,i;const o=null===(r=this.canvas3dContext)||void 0===r?void 0:r.canvas,s=this.layout.root;s&&o&&(function Lct(e,t,n=1){let r=window.innerWidth,i=window.innerHeight;t!==document.body&&(r=t.offsetWidth,i=t.offsetHeight),function Bct(e,t,n,r=1){e.width=Math.round(window.devicePixelRatio*r*t),e.height=Math.round(window.devicePixelRatio*r*n),Object.assign(e.style,{width:`${t}px`,height:`${n}px`})}(e,r,i,n)}(o,s,this.canvas3dContext.props.pixelScale),null===(i=this.canvas3d)||void 0===i||i.requestResize())},this.log={entries:cy(),entry:r=>this.events.log.next(r),error:r=>this.events.log.next(pg.error(r)),message:r=>this.events.log.next(pg.message(r)),info:r=>this.events.log.next(pg.info(r)),warn:r=>this.events.log.next(pg.warning(r))},this.fetch=o7,KGe(!1),function c6e(e){$0="default"===e?fse:l6e}(null!==(n=this.config.get(ei.Structure.SaccharideCompIdMapType))&&void 0!==n?n:"default")}}class MCt extends kCt{initCustomParamEditors(){if(this.spec.customParamEditors)for(const[t,n]of this.spec.customParamEditors)this.customParamEditors.set(t.id,n)}dispose(t){super.dispose(t),this.layout.dispose()}constructor(t){super(t),this.spec=t,this.customParamEditors=new Map,this.initCustomParamEditors()}}let bI=(()=>{class e{constructor(){this.plugin=new MCt({actions:[Vn.Action(s2.Structure.DownloadStructure),Vn.Action(s2.Volume.DownloadDensity),Vn.Action(s2.DataFormat.DownloadFile),Vn.Action(s2.DataFormat.OpenFiles),Vn.Action(s2.Structure.LoadTrajectory),Vn.Action(s2.Structure.EnableModelCustomProps),Vn.Action(s2.Structure.EnableStructureCustomProps),Vn.Action(pq),Vn.Action(Dct),Vn.Action(hq),Vn.Action(at.Data.Download),Vn.Action(at.Data.ParseCif),Vn.Action(at.Data.ParseCcp4),Vn.Action(at.Data.ParseDsn6),Vn.Action(at.Model.TrajectoryFromMmCif),Vn.Action(at.Model.TrajectoryFromCifCore),Vn.Action(at.Model.TrajectoryFromPDB),Vn.Action(at.Model.TransformStructureConformation),Vn.Action(at.Model.StructureFromModel),Vn.Action(at.Model.StructureFromTrajectory),Vn.Action(at.Model.ModelFromTrajectory),Vn.Action(at.Model.StructureSelectionFromScript),Vn.Action(at.Representation.StructureRepresentation3D),Vn.Action(at.Representation.StructureSelectionsDistance3D),Vn.Action(at.Representation.StructureSelectionsAngle3D),Vn.Action(at.Representation.StructureSelectionsDihedral3D),Vn.Action(at.Representation.StructureSelectionsLabel3D),Vn.Action(at.Representation.StructureSelectionsOrientation3D),Vn.Action(at.Representation.ModelUnitcell3D),Vn.Action(at.Representation.StructureBoundingBox3D),Vn.Action(at.Representation.ExplodeStructureRepresentation3D),Vn.Action(at.Representation.SpinStructureRepresentation3D),Vn.Action(at.Representation.UnwindStructureAssemblyRepresentation3D),Vn.Action(at.Representation.OverpaintStructureRepresentation3DFromScript),Vn.Action(at.Representation.TransparencyStructureRepresentation3DFromScript),Vn.Action(at.Representation.ClippingStructureRepresentation3DFromScript),Vn.Action(at.Representation.SubstanceStructureRepresentation3DFromScript),Vn.Action(at.Representation.ThemeStrengthRepresentation3D),Vn.Action(Cbe),Vn.Action(at.Volume.VolumeFromCcp4),Vn.Action(at.Volume.VolumeFromDsn6),Vn.Action(at.Volume.VolumeFromCube),Vn.Action(at.Volume.VolumeFromDx),Vn.Action(at.Representation.VolumeRepresentation3D)],behaviors:[Vn.Behavior(Od.Representation.HighlightLoci),Vn.Behavior(Od.Representation.SelectLoci),Vn.Behavior(Od.Representation.DefaultLociLabelProvider),Vn.Behavior(Od.Representation.FocusLoci),Vn.Behavior(Od.Camera.FocusLoci),Vn.Behavior(Od.Camera.CameraAxisHelper),Vn.Behavior(Od.Camera.CameraControls),Vn.Behavior(iO),Vn.Behavior(Od.CustomProps.StructureInfo),Vn.Behavior(Od.CustomProps.AccessibleSurfaceArea),Vn.Behavior(Od.CustomProps.BestDatabaseSequenceMapping),Vn.Behavior(Od.CustomProps.Interactions),Vn.Behavior(Od.CustomProps.SecondaryStructure),Vn.Behavior(Od.CustomProps.ValenceModel),Vn.Behavior(Od.CustomProps.CrossLinkRestraint)],animations:[Nct,Rct,F0t,Fct,Mct,N0t,R0t],customParamEditors:[[hq,d1t]],config:[[ei.VolumeStreaming.Enabled,!1]]}),this.plugin$=Is(this.plugin.init()).pipe(hn(()=>this.plugin),ff(1))}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})(),vI=(()=>{class e{set source(n){this.source$.next(n)}constructor(n){var r=this;this.pluginService=n,this.source$=new Ao(null),this.structure$=this.pluginService.plugin$.pipe(ba(i=>this.source$.pipe(xd(o=>null!=o),hn(o=>({plugin:i,source:o})))),ba(({source:i})=>Is(le(function*(){return"local"===i.type?{data:yield r.parseLocalSource(i),source:i}:{data:yield r.parseRemoteSource(i),source:i}})())),ba(({data:i,source:o})=>Is(le(function*(){const s=r.pluginService.plugin,a=yield s.builders.structure.parseTrajectory(i,o.format),l=yield s.builders.structure.createModel(a,{modelIndex:0});return s.builders.structure.createStructure(l,{name:"model",params:{}})})())),Ho(i=>{let o=0;this.residues=[];const s=this.r2i=new Map,a=this.i2r=new Map;Xe.eachAtomicHierarchyElement(i.cell?.obj?.data,{residue:l=>{const c=Je.residue.auth_seq_id(l),u=Je.residue.pdbx_PDB_ins_code(l),d=Je.chain.auth_asym_id(l),f=Je.atom.auth_comp_id(l),p=(d+c+u).trim();s.set(p,o),a.set(o,p),this.residues.push({pdbInsCode:u,authSeqId:c,authAsymId:d,authCompId3:UG.has(f)?f:"XXX",authCompId1:UG.get(f)||"X"}),o++}})}),ff(1))}parseRemoteSource(n){var r=this;return le(function*(){const i=jr.Url(n.link);return r.pluginService.plugin.builders.data.download({url:i,label:n.label,isBinary:n.binary})})()}parseLocalSource(n){var r=this;return le(function*(){const i=n.binary,o=n.label,s=r.pluginService.plugin;if("string"==typeof n.data)return s.builders.data.rawData({data:n.data,label:o});let a;a=n.data instanceof File?jr.File(n.data):jr.File(new File([n.data],`${o}.${"mmcif"===n.format?"cif":"ent"}`));const{data:l}=yield s.builders.data.readFile({file:a,label:o,isBinary:i});return l})()}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(bI))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})(),cB=(()=>{class e{constructor(){this.settings$=new Fh}set settings(n){this.settings$.next(this._settings=n)}get settings(){return this._settings}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();const BCt=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,LCt=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Xxe={};function Kxe(e,t){return((t||Xxe).jsx?LCt:BCt).test(e)}const jCt=/[ \t\n\f\r]/g;function Zxe(e){return""===e.replace(jCt,"")}class ek{constructor(t,n,r){this.property=t,this.normal=n,r&&(this.space=r)}}function Qxe(e,t){const n={},r={};let i=-1;for(;++i"xlink:"+t.slice(5).toLowerCase(),properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),n_e=_I({space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase(),properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function r_e(e,t){return t in e?e[t]:t}function i_e(e,t){return r_e(e,t.toLowerCase())}const o_e=_I({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:i_e,properties:{xmlns:null,xmlnsXLink:null}}),s_e=_I({transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase(),properties:{ariaActiveDescendant:null,ariaAtomic:wl,ariaAutoComplete:null,ariaBusy:wl,ariaChecked:wl,ariaColCount:en,ariaColIndex:en,ariaColSpan:en,ariaControls:xs,ariaCurrent:null,ariaDescribedBy:xs,ariaDetails:null,ariaDisabled:wl,ariaDropEffect:xs,ariaErrorMessage:null,ariaExpanded:wl,ariaFlowTo:xs,ariaGrabbed:wl,ariaHasPopup:null,ariaHidden:wl,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xs,ariaLevel:en,ariaLive:null,ariaModal:wl,ariaMultiLine:wl,ariaMultiSelectable:wl,ariaOrientation:null,ariaOwns:xs,ariaPlaceholder:null,ariaPosInSet:en,ariaPressed:wl,ariaReadOnly:wl,ariaRelevant:null,ariaRequired:wl,ariaRoleDescription:xs,ariaRowCount:en,ariaRowIndex:en,ariaRowSpan:en,ariaSelected:wl,ariaSetSize:en,ariaSort:null,ariaValueMax:en,ariaValueMin:en,ariaValueNow:en,ariaValueText:null,role:null}}),HCt=_I({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:i_e,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xI,acceptCharset:xs,accessKey:xs,action:null,allow:null,allowFullScreen:di,allowPaymentRequest:di,allowUserMedia:di,alt:null,as:null,async:di,autoCapitalize:null,autoComplete:xs,autoFocus:di,autoPlay:di,blocking:xs,capture:null,charSet:null,checked:di,cite:null,className:xs,cols:en,colSpan:null,content:null,contentEditable:wl,controls:di,controlsList:xs,coords:en|xI,crossOrigin:null,data:null,dateTime:null,decoding:null,default:di,defer:di,dir:null,dirName:null,disabled:di,download:Jxe,draggable:wl,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:di,formTarget:null,headers:xs,height:en,hidden:di,high:en,href:null,hrefLang:null,htmlFor:xs,httpEquiv:xs,id:null,imageSizes:null,imageSrcSet:null,inert:di,inputMode:null,integrity:null,is:null,isMap:di,itemId:null,itemProp:xs,itemRef:xs,itemScope:di,itemType:xs,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:di,low:en,manifest:null,max:null,maxLength:en,media:null,method:null,min:null,minLength:en,multiple:di,muted:di,name:null,nonce:null,noModule:di,noValidate:di,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:di,optimum:en,pattern:null,ping:xs,placeholder:null,playsInline:di,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:di,referrerPolicy:null,rel:xs,required:di,reversed:di,rows:en,rowSpan:en,sandbox:xs,scope:null,scoped:di,seamless:di,selected:di,shadowRootDelegatesFocus:di,shadowRootMode:null,shape:null,size:en,sizes:null,slot:null,span:en,spellCheck:wl,src:null,srcDoc:null,srcLang:null,srcSet:null,start:en,step:null,style:null,tabIndex:en,target:null,title:null,translate:null,type:null,typeMustMatch:di,useMap:null,value:wl,width:en,wrap:null,align:null,aLink:null,archive:xs,axis:null,background:null,bgColor:null,border:en,borderColor:null,bottomMargin:en,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:di,declare:di,event:null,face:null,frame:null,frameBorder:null,hSpace:en,leftMargin:en,link:null,longDesc:null,lowSrc:null,marginHeight:en,marginWidth:en,noResize:di,noHref:di,noShade:di,noWrap:di,object:null,profile:null,prompt:null,rev:null,rightMargin:en,rules:null,scheme:null,scrolling:wl,standby:null,summary:null,text:null,topMargin:en,valueType:null,version:null,vAlign:null,vLink:null,vSpace:en,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:di,disableRemotePlayback:di,prefix:null,property:null,results:en,security:null,unselectable:null}}),GCt=_I({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:r_e,properties:{about:Lf,accentHeight:en,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:en,amplitude:en,arabicForm:null,ascent:en,attributeName:null,attributeType:null,azimuth:en,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:en,by:null,calcMode:null,capHeight:en,className:xs,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:en,diffuseConstant:en,direction:null,display:null,dur:null,divisor:en,dominantBaseline:null,download:di,dx:null,dy:null,edgeMode:null,editable:null,elevation:en,enableBackground:null,end:null,event:null,exponent:en,externalResourcesRequired:null,fill:null,fillOpacity:en,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:xI,g2:xI,glyphName:xI,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:en,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:en,horizOriginX:en,horizOriginY:en,id:null,ideographic:en,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:en,k:en,k1:en,k2:en,k3:en,k4:en,kernelMatrix:Lf,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:en,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:en,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:en,overlineThickness:en,paintOrder:null,panose1:null,path:null,pathLength:en,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xs,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:en,pointsAtY:en,pointsAtZ:en,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Lf,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Lf,rev:Lf,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Lf,requiredFeatures:Lf,requiredFonts:Lf,requiredFormats:Lf,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:en,specularExponent:en,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:en,strikethroughThickness:en,string:null,stroke:null,strokeDashArray:Lf,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:en,strokeOpacity:en,strokeWidth:null,style:null,surfaceScale:en,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Lf,tabIndex:en,tableValues:null,target:null,targetX:en,targetY:en,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Lf,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:en,underlineThickness:en,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:en,values:null,vAlphabetic:en,vMathematical:en,vectorEffect:null,vHanging:en,vIdeographic:en,version:null,vertAdvY:en,vertOriginX:en,vertOriginY:en,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:en,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),qCt=Qxe([n_e,t_e,o_e,s_e,HCt],"html"),aX=Qxe([n_e,t_e,o_e,s_e,GCt],"svg"),WCt=/^data[-\w.:]+$/i,a_e=/-[a-z]/g,$Ct=/[A-Z]/g;function XCt(e){return"-"+e.toLowerCase()}function KCt(e){return e.charAt(1).toUpperCase()}const ZCt={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};var l_e=ln(390);const JCt=l_e.default||l_e,c_e=u_e("end"),lX=u_e("start");function u_e(e){return function t(n){const r=n&&n.position&&n.position[e]||{};if("number"==typeof r.line&&r.line>0&&"number"==typeof r.column&&r.column>0)return{line:r.line,column:r.column,offset:"number"==typeof r.offset&&r.offset>-1?r.offset:void 0}}}function tk(e){return e&&"object"==typeof e?"position"in e||"type"in e?d_e(e.position):"start"in e||"end"in e?d_e(e):"line"in e||"column"in e?cX(e):"":""}function cX(e){return f_e(e&&e.line)+":"+f_e(e&&e.column)}function d_e(e){return cX(e&&e.start)+"-"+cX(e&&e.end)}function f_e(e){return e&&"number"==typeof e?e:1}class gu extends Error{constructor(t,n,r){super(),"string"==typeof n&&(r=n,n=void 0);let i="",o={},s=!1;if(n&&(o="line"in n&&"column"in n||"start"in n&&"end"in n?{place:n}:"type"in n?{ancestors:[n],place:n.position}:{...n}),"string"==typeof t?i=t:!o.cause&&t&&(s=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&"string"==typeof r){const l=r.indexOf(":");-1===l?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.message=i,this.line=a?a.line:void 0,this.name=tk(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&"string"==typeof o.cause.stack?o.cause.stack:""}}gu.prototype.file="",gu.prototype.name="",gu.prototype.reason="",gu.prototype.message="",gu.prototype.stack="",gu.prototype.column=void 0,gu.prototype.line=void 0,gu.prototype.ancestors=void 0,gu.prototype.cause=void 0,gu.prototype.fatal=void 0,gu.prototype.place=void 0,gu.prototype.ruleId=void 0,gu.prototype.source=void 0;const uX={}.hasOwnProperty,twt=new Map,nwt=/[A-Z]/g,rwt=/-([a-z])/g,iwt=new Set(["table","tbody","thead","tfoot","tr"]),owt=new Set(["td","th"]),p_e="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function h_e(e,t,n){return"element"===t.type?function awt(e,t,n){const r=e.schema;let i=r;"svg"===t.tagName.toLowerCase()&&"html"===r.space&&(i=aX,e.schema=i),e.ancestors.push(t);const o=g_e(e,t.tagName,!1),s=function mwt(e,t){const n={};let r,i;for(i in t.properties)if("children"!==i&&uX.call(t.properties,i)){const o=ywt(e,i,t.properties[i]);if(o){const[s,a]=o;e.tableCellAlignToStyle&&"align"===s&&"string"==typeof a&&owt.has(t.tagName)?r=a:n[s]=a}}return r&&((n.style||(n.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r),n}(e,t);let a=fX(e,t);return iwt.has(t.tagName)&&(a=a.filter(function(l){return"string"!=typeof l||!function UCt(e){return"object"==typeof e?"text"===e.type&&Zxe(e.value):Zxe(e)}(l)})),m_e(e,s,o,t),dX(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}(e,t,n):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function lwt(e,t){if(t.data&&t.data.estree&&e.evaluater){return e.evaluater.evaluateExpression(t.data.estree.body[0].expression)}nk(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?function uwt(e,t,n){const r=e.schema;let i=r;"svg"===t.name&&"html"===r.space&&(i=aX,e.schema=i),e.ancestors.push(t);const o=null===t.name?e.Fragment:g_e(e,t.name,!0),s=function gwt(e,t){const n={};for(const r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){Object.assign(n,e.evaluater.evaluateExpression(r.data.estree.body[0].expression.properties[0].argument))}else nk(e,t.position);else{const i=r.name;let o;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){o=e.evaluater.evaluateExpression(r.value.data.estree.body[0].expression)}else nk(e,t.position);else o=null===r.value||r.value;n[i]=o}return n}(e,t),a=fX(e,t);return m_e(e,s,o,t),dX(s,a),e.ancestors.pop(),e.schema=r,e.create(t,o,s,n)}(e,t,n):"mdxjsEsm"===t.type?function cwt(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);nk(e,t.position)}(e,t):"root"===t.type?function dwt(e,t,n){const r={};return dX(r,fX(e,t)),e.create(t,e.Fragment,r,n)}(e,t,n):"text"===t.type?function fwt(e,t){return t.value}(0,t):void 0}function m_e(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function dX(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function fX(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:twt;for(;++r4&&"data"===n.slice(0,4)&&WCt.test(t)){if("-"===t.charAt(4)){const o=t.slice(5).replace(a_e,KCt);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!a_e.test(o)){let s=o.replace($Ct,XCt);"-"!==s.charAt(0)&&(s="-"+s),t="data"+s}}i=sX}return new i(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?function RCt(e,t){const n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}(n):function QCt(e){return e.join(" ").trim()}(n)),"style"===r.property){let i="object"==typeof n?n:function bwt(e,t){const n={};try{JCt(t,function r(i,o){let s=i;"--"!==s.slice(0,2)&&("-ms-"===s.slice(0,4)&&(s="ms-"+s.slice(4)),s=s.replace(rwt,_wt)),n[s]=o})}catch(i){if(!e.ignoreInvalidStyle){const s=new gu("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=p_e+"#cannot-parse-style-attribute",s}}return n}(e,String(n));return"css"===e.stylePropertyNameCase&&(i=function vwt(e){const t={};let n;for(n in e)uX.call(e,n)&&(t[xwt(n)]=e[n]);return t}(i)),["style",i]}return["react"===e.elementAttributeNameCase&&r.space?ZCt[r.property]||r.property:r.attribute,n]}}function g_e(e,t,n){let r;if(n)if(t.includes(".")){const i=t.split(".");let s,o=-1;for(;++oi?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);o0?(Wg(e,e.length,0,t),e):t}function v_e(e){const t={};let r,i,o,s,a,l,c,n=-1;for(;++n-1&&e.test(String.fromCharCode(n))}}function _s(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return function s(l){return wo(l)?(e.enter(n),a(l)):t(l)};function a(l){return wo(l)&&o++s))return;const M=t.events.length;let D,T,E=M;for(;E--;)if("exit"===t.events[E][0]&&"chunkFlow"===t.events[E][1].type){if(D){T=t.events[E][1].end;break}D=!0}for(y(r),A=M;Ax;){const w=n[_];t.containerState=w[1],w[0].exit.call(t,e)}n.length=x}function v(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}},x_e={tokenize:function zwt(e,t,n){return _s(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},uB={tokenize:function Vwt(e,t,n){return function r(o){return wo(o)?_s(e,i,"linePrefix")(o):i(o)};function i(o){return null===o||Dr(o)?t(o):n(o)}},partial:!0},Hwt={tokenize:function Wwt(e,t){let n;return function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)};function i(a){return null===a?o(a):Dr(a)?e.check(Gwt,s,o)(a):(e.consume(a),i)}function o(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function s(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}},resolve:function qwt(e){return v_e(e),e}},Gwt={tokenize:function $wt(e,t,n){const r=this;return function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),_s(e,o,"linePrefix")};function o(s){if(null===s||Dr(s))return n(s);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}},partial:!0},Ywt={tokenize:function Xwt(e){const t=this,n=e.attempt(uB,function r(o){if(null!==o)return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n;e.consume(o)},e.attempt(this.parser.constructs.flowInitial,i,_s(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Hwt,i)),"linePrefix")));return n;function i(o){if(null!==o)return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(o)}}},Kwt={resolveAll:S_e()},Zwt=__e("string"),Qwt=__e("text");function __e(e){return{tokenize:function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,s,a);return s;function s(u){return c(u)?o(u):a(u)}function a(u){if(null!==u)return n.enter("data"),n.consume(u),l;n.consume(u)}function l(u){return c(u)?(n.exit("data"),o(u)):(n.consume(u),l)}function c(u){if(null===u)return!0;const d=i[u];let f=-1;if(d)for(;++f=3&&(null===c||Dr(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),wo(c)?_s(e,a,"whitespace")(c):a(c))}}},Vd={name:"list",tokenize:function sAt(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,s=0;return function a(p){const m=r.containerState.type||(42===p||43===p||45===p?"listUnordered":"listOrdered");if("listUnordered"===m?!r.containerState.marker||p===r.containerState.marker:gX(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),"listUnordered"===m)return e.enter("listItemPrefix"),42===p||45===p?e.check(dB,n,c)(p):c(p);if(!r.interrupt||49===p)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)};function l(p){return gX(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:41===p||46===p)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(uB,r.interrupt?n:u,e.attempt(iAt,f,d))}function u(p){return r.containerState.initialBlankLine=!0,o++,f(p)}function d(p){return wo(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}},continuation:{tokenize:function aAt(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(uB,function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,_s(e,t,"listItemIndent",r.containerState.size+1)(a)},function o(a){return r.containerState.furtherBlankLines||!wo(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(oAt,t,s)(a))});function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,_s(e,e.attempt(Vd,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function cAt(e){e.exit(this.containerState.type)}},iAt={tokenize:function uAt(e,t,n){const r=this;return _s(e,function i(o){const s=r.events[r.events.length-1];return!wo(o)&&s&&"listItemPrefixWhitespace"===s[1].type?t(o):n(o)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)},partial:!0},oAt={tokenize:function lAt(e,t,n){const r=this;return _s(e,function i(o){const s=r.events[r.events.length-1];return s&&"listItemIndent"===s[1].type&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(o):n(o)},"listItemIndent",r.containerState.size+1)},partial:!0},C_e={name:"blockQuote",tokenize:function dAt(e,t,n){const r=this;return function i(s){if(62===s){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),o}return n(s)};function o(s){return wo(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}},continuation:{tokenize:function fAt(e,t,n){const r=this;return function i(s){return wo(s)?_s(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):o(s)};function o(s){return e.attempt(C_e,t,n)(s)}}},exit:function pAt(e){e.exit("blockQuote")}};function w_e(e,t,n,r,i,o,s,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return function d(y){return 60===y?(e.enter(r),e.enter(i),e.enter(o),e.consume(y),e.exit(o),f):null===y||32===y||41===y||mX(y)?n(y):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),h(y))};function f(y){return 62===y?(e.enter(o),e.consume(y),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return 62===y?(e.exit("chunkString"),e.exit(a),f(y)):null===y||60===y||Dr(y)?n(y):(e.consume(y),92===y?m:p)}function m(y){return 60===y||62===y||92===y?(e.consume(y),p):p(y)}function h(y){return u||null!==y&&41!==y&&!zd(y)?u999||null===p||91===p||93===p&&!l||94===p&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):93===p?(e.exit(o),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):Dr(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return null===p||91===p||93===p||Dr(p)||a++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!wo(p)),92===p?f:d)}function f(p){return 91===p||92===p||93===p?(e.consume(p),a++,d):d(p)}}function I_e(e,t,n,r,i,o){let s;return function a(f){return 34===f||39===f||40===f?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),s=40===f?41:f,l):n(f)};function l(f){return f===s?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(o),c(f))}function c(f){return f===s?(e.exit(o),l(s)):null===f?n(f):Dr(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),_s(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===s||null===f||Dr(f)?(e.exit("chunkString"),c(f)):(e.consume(f),92===f?d:u)}function d(f){return f===s||92===f?(e.consume(f),u):u(f)}}function rk(e,t){let n;return function r(i){return Dr(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):wo(i)?_s(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}function SI(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const hAt={name:"definition",tokenize:function gAt(e,t,n){const r=this;let i;return function o(p){return e.enter("definition"),function s(p){return A_e.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}(p)};function a(p){return i=SI(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===p?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return zd(p)?rk(e,c)(p):c(p)}function c(p){return w_e(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(mAt,d,d)(p)}function d(p){return wo(p)?_s(e,f,"whitespace")(p):f(p)}function f(p){return null===p||Dr(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}},mAt={tokenize:function yAt(e,t,n){return function r(a){return zd(a)?rk(e,i)(a):n(a)};function i(a){return I_e(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return wo(a)?_s(e,s,"whitespace")(a):s(a)}function s(a){return null===a||Dr(a)?t(a):n(a)}},partial:!0},bX={name:"codeIndented",tokenize:function vAt(e,t,n){const r=this;return function i(c){return e.enter("codeIndented"),_s(e,o,"linePrefix",5)(c)};function o(c){const u=r.events[r.events.length-1];return u&&"linePrefix"===u[1].type&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):n(c)}function s(c){return null===c?l(c):Dr(c)?e.attempt(bAt,s,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return null===c||Dr(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}},bAt={tokenize:function xAt(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):Dr(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):_s(e,o,"linePrefix",5)(s)}function o(s){const a=r.events[r.events.length-1];return a&&"linePrefix"===a[1].type&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):Dr(s)?i(s):n(s)}},partial:!0},_At={name:"headingAtx",tokenize:function CAt(e,t,n){let r=0;return function i(u){return e.enter("atxHeading"),function o(u){return e.enter("atxHeadingSequence"),s(u)}(u)};function s(u){return 35===u&&r++<6?(e.consume(u),s):null===u||zd(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return 35===u?(e.enter("atxHeadingSequence"),l(u)):null===u||Dr(u)?(e.exit("atxHeading"),t(u)):wo(u)?_s(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return 35===u?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return null===u||35===u||zd(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}},resolve:function SAt(e,t){let i,o,n=e.length-2,r=3;return"whitespace"===e[r][1].type&&(r+=2),n-2>r&&"whitespace"===e[n][1].type&&(n-=2),"atxHeadingSequence"===e[n][1].type&&(r===n-1||n-4>r&&"whitespace"===e[n-2][1].type)&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Wg(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}},E_e={name:"setextUnderline",tokenize:function AAt(e,t,n){const r=this;let i;return function o(c){let d,u=r.events.length;for(;u--;)if("lineEnding"!==r.events[u][1].type&&"linePrefix"!==r.events[u][1].type&&"content"!==r.events[u][1].type){d="paragraph"===r.events[u][1].type;break}return r.parser.lazy[r.now().line]||!r.interrupt&&!d?n(c):(e.enter("setextHeadingLine"),i=c,function s(c){return e.enter("setextHeadingLineSequence"),a(c)}(c))};function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),wo(c)?_s(e,l,"lineSuffix")(c):l(c))}function l(c){return null===c||Dr(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}},resolveTo:function wAt(e,t){let r,i,o,n=e.length;for(;n--;)if("enter"===e[n][0]){if("content"===e[n][1].type){r=n;break}"paragraph"===e[n][1].type&&(i=n)}else"content"===e[n][1].type&&e.splice(n,1),!o&&"definition"===e[n][1].type&&(o=n);const s={type:"setextHeading",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",s,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[o][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}},IAt=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],T_e=["pre","script","style","textarea"],EAt={name:"htmlFlow",tokenize:function kAt(e,t,n){const r=this;let i,o,s,a,l;return function c(K){return function u(K){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(K),d}(K)};function d(K){return 33===K?(e.consume(K),f):47===K?(e.consume(K),o=!0,h):63===K?(e.consume(K),i=3,r.interrupt?t:H):$g(K)?(e.consume(K),s=String.fromCharCode(K),g):n(K)}function f(K){return 45===K?(e.consume(K),i=2,p):91===K?(e.consume(K),i=5,a=0,m):$g(K)?(e.consume(K),i=4,r.interrupt?t:H):n(K)}function p(K){return 45===K?(e.consume(K),r.interrupt?t:H):n(K)}function m(K){return K==="CDATA[".charCodeAt(a++)?(e.consume(K),6===a?r.interrupt?t:R:m):n(K)}function h(K){return $g(K)?(e.consume(K),s=String.fromCharCode(K),g):n(K)}function g(K){if(null===K||47===K||62===K||zd(K)){const Q=47===K,G=s.toLowerCase();return Q||o||!T_e.includes(G)?IAt.includes(s.toLowerCase())?(i=6,Q?(e.consume(K),y):r.interrupt?t(K):R(K)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(K):o?v(K):x(K)):(i=1,r.interrupt?t(K):R(K))}return 45===K||jf(K)?(e.consume(K),s+=String.fromCharCode(K),g):n(K)}function y(K){return 62===K?(e.consume(K),r.interrupt?t:R):n(K)}function v(K){return wo(K)?(e.consume(K),v):T(K)}function x(K){return 47===K?(e.consume(K),T):58===K||95===K||$g(K)?(e.consume(K),_):wo(K)?(e.consume(K),x):T(K)}function _(K){return 45===K||46===K||58===K||95===K||jf(K)?(e.consume(K),_):w(K)}function w(K){return 61===K?(e.consume(K),A):wo(K)?(e.consume(K),w):x(K)}function A(K){return null===K||60===K||61===K||62===K||96===K?n(K):34===K||39===K?(e.consume(K),l=K,M):wo(K)?(e.consume(K),A):E(K)}function M(K){return K===l?(e.consume(K),l=null,D):null===K||Dr(K)?n(K):(e.consume(K),M)}function E(K){return null===K||34===K||39===K||47===K||60===K||61===K||62===K||96===K||zd(K)?w(K):(e.consume(K),E)}function D(K){return 47===K||62===K||wo(K)?x(K):n(K)}function T(K){return 62===K?(e.consume(K),F):n(K)}function F(K){return null===K||Dr(K)?R(K):wo(K)?(e.consume(K),F):n(K)}function R(K){return 45===K&&2===i?(e.consume(K),z):60===K&&1===i?(e.consume(K),$):62===K&&4===i?(e.consume(K),oe):63===K&&3===i?(e.consume(K),H):93===K&&5===i?(e.consume(K),X):!Dr(K)||6!==i&&7!==i?null===K||Dr(K)?(e.exit("htmlFlowData"),N(K)):(e.consume(K),R):(e.exit("htmlFlowData"),e.check(TAt,te,N)(K))}function N(K){return e.check(DAt,j,te)(K)}function j(K){return e.enter("lineEnding"),e.consume(K),e.exit("lineEnding"),W}function W(K){return null===K||Dr(K)?N(K):(e.enter("htmlFlowData"),R(K))}function z(K){return 45===K?(e.consume(K),H):R(K)}function $(K){return 47===K?(e.consume(K),s="",V):R(K)}function V(K){if(62===K){const Q=s.toLowerCase();return T_e.includes(Q)?(e.consume(K),oe):R(K)}return $g(K)&&s.length<8?(e.consume(K),s+=String.fromCharCode(K),V):R(K)}function X(K){return 93===K?(e.consume(K),H):R(K)}function H(K){return 62===K?(e.consume(K),oe):45===K&&2===i?(e.consume(K),H):R(K)}function oe(K){return null===K||Dr(K)?(e.exit("htmlFlowData"),te(K)):(e.consume(K),oe)}function te(K){return e.exit("htmlFlow"),t(K)}},resolveTo:function PAt(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},concrete:!0},TAt={tokenize:function RAt(e,t,n){return function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(uB,t,n)}},partial:!0},DAt={tokenize:function MAt(e,t,n){const r=this;return function i(s){return Dr(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):n(s)};function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}},partial:!0},D_e={tokenize:function FAt(e,t,n){const r=this;return function i(s){return null===s?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o)};function o(s){return r.parser.lazy[r.now().line]?n(s):t(s)}},partial:!0},P_e={name:"codeFenced",tokenize:function NAt(e,t,n){const r=this,i={tokenize:function w(A,M,E){let D=0;return function T(W){return A.enter("lineEnding"),A.consume(W),A.exit("lineEnding"),F};function F(W){return A.enter("codeFencedFence"),wo(W)?_s(A,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):R(W)}function R(W){return W===a?(A.enter("codeFencedFenceSequence"),N(W)):E(W)}function N(W){return W===a?(D++,A.consume(W),N):D>=s?(A.exit("codeFencedFenceSequence"),wo(W)?_s(A,j,"whitespace")(W):j(W)):E(W)}function j(W){return null===W||Dr(W)?(A.exit("codeFencedFence"),M(W)):E(W)}},partial:!0};let a,o=0,s=0;return function l(A){return function c(A){const M=r.events[r.events.length-1];return o=M&&"linePrefix"===M[1].type?M[2].sliceSerialize(M[1],!0).length:0,a=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(A)}(A)};function u(A){return A===a?(s++,e.consume(A),u):s<3?n(A):(e.exit("codeFencedFenceSequence"),wo(A)?_s(e,d,"whitespace")(A):d(A))}function d(A){return null===A||Dr(A)?(e.exit("codeFencedFence"),r.interrupt?t(A):e.check(D_e,h,_)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(A))}function f(A){return null===A||Dr(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(A)):wo(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_s(e,p,"whitespace")(A)):96===A&&A===a?n(A):(e.consume(A),f)}function p(A){return null===A||Dr(A)?d(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(A))}function m(A){return null===A||Dr(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(A)):96===A&&A===a?n(A):(e.consume(A),m)}function h(A){return e.attempt(i,_,g)(A)}function g(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),y}function y(A){return o>0&&wo(A)?_s(e,v,"linePrefix",o+1)(A):v(A)}function v(A){return null===A||Dr(A)?e.check(D_e,h,_)(A):(e.enter("codeFlowValue"),x(A))}function x(A){return null===A||Dr(A)?(e.exit("codeFlowValue"),v(A)):(e.consume(A),x)}function _(A){return e.exit("codeFenced"),t(A)}},concrete:!0},k_e=document.createElement("i");function vX(e){const t="&"+e+";";k_e.innerHTML=t;const n=k_e.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}const M_e={name:"characterReference",tokenize:function OAt(e,t,n){const r=this;let o,s,i=0;return function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l};function l(d){return 35===d?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),o=31,s=jf,u(d))}function c(d){return 88===d||120===d?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,s=Rwt,u):(e.enter("characterReferenceValue"),o=7,s=gX,u(d))}function u(d){if(59===d&&i){const f=e.exit("characterReferenceValue");return s!==jf||vX(r.sliceSerialize(f))?(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(d)}return s(d)&&i++1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d=Object.assign({},e[r][1].end),f=Object.assign({},e[n][1].start);F_e(d,-l),F_e(f,l),s={type:l>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},e[r][1].end)},a={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:f},o={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},i={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},a.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},a.end),c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=nh(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=nh(c,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",o,t]]),c=nh(c,yX(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=nh(c,[["exit",o,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=nh(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,Wg(e,r-1,n-r+3,c),n=r+c.length-u-2;break}for(n=-1;++n-1){const a=s[0];"string"==typeof a?s[0]=a.slice(r):s.shift()}o>0&&s.push(e[i].slice(0,o))}return s}(s,N)}function g(){const{line:N,column:j,offset:W,_index:z,_bufferIndex:$}=r;return{line:N,column:j,offset:W,_index:z,_bufferIndex:$}}function x(N){l=void 0,f=N,d=d(N)}function E(N,j){j.restore()}function D(N,j){return function W(z,$,V){let X,H,oe,te;return Array.isArray(z)?Q(z):"tokenize"in z?Q([z]):function K(se){return function xe(re){const ae=null!==re&&se[re],ge=null!==re&&se.null;return Q([...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(ge)?ge:ge?[ge]:[]])(re)}}(z);function Q(se){return X=se,H=0,0===se.length?V:G(se[H])}function G(se){return function xe(re){return te=function F(){const N=g(),j=u.previous,W=u.currentConstruct,z=u.events.length,$=Array.from(a);return{restore:function V(){r=N,u.previous=j,u.currentConstruct=W,u.events.length=z,a=$,R()},from:z}}(),oe=se,se.partial||(u.currentConstruct=se),se.name&&u.parser.constructs.disable.null.includes(se.name)?ee():se.tokenize.call(j?Object.assign(Object.create(u),j):u,c,Z,ee)(re)}}function Z(se){return l=!0,N(oe,te),$}function ee(se){return l=!0,te.restore(),++H13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"\ufffd":String.fromCodePoint(n)}const _It=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function CIt(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const i=n.charCodeAt(1),o=120===i||88===i;return B_e(n.slice(o?2:1),o?16:10)}return vX(n)||e}const L_e={}.hasOwnProperty;function wIt(e,t,n){return"string"!=typeof t&&(n=t,t=void 0),function AIt(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(ue),autolinkProtocol:D,autolinkEmail:D,atxHeading:o(me),blockQuote:o(function xe(){return{type:"blockquote",children:[]}}),characterEscape:D,characterReference:D,codeFenced:o(re),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:o(re,s),codeText:o(function ae(){return{type:"inlineCode",value:""}},s),codeTextData:D,data:D,codeFlowValue:D,definition:o(function ge(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:o(function Ie(){return{type:"emphasis",children:[]}}),hardBreakEscape:o(Ae),hardBreakTrailing:o(Ae),htmlFlow:o(he,s),htmlFlowData:D,htmlText:o(he,s),htmlTextData:D,image:o(function ie(){return{type:"image",title:null,url:"",alt:null}}),label:s,link:o(ue),listItem:o(function Fe(be){return{type:"listItem",spread:be._spread,checked:null,children:[]}}),listItemValue:function f(be){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(be),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:o(_e,function d(){this.data.expectingFirstListItemValue=!0}),listUnordered:o(_e),paragraph:o(function Ze(){return{type:"paragraph",children:[]}}),reference:function K(){this.data.referenceType="collapsed"},referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:o(me),strong:o(function ct(){return{type:"strong",children:[]}}),thematicBreak:o(function ne(){return{type:"thematicBreak"}})},exit:{atxHeading:l(),atxHeadingSequence:function w(be){const Ce=this.stack[this.stack.length-1];if(!Ce.depth){const Re=this.sliceSerialize(be).length;Ce.depth=Re}},autolink:l(),autolinkEmail:function se(be){T.call(this,be),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(be)},autolinkProtocol:function ee(be){T.call(this,be),this.stack[this.stack.length-1].url=this.sliceSerialize(be)},blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:G,characterReferenceMarkerNumeric:G,characterReferenceValue:function Z(be){const Ce=this.sliceSerialize(be),Re=this.data.characterReferenceType;let Be;Re?(Be=B_e(Ce,"characterReferenceMarkerNumeric"===Re?10:16),this.data.characterReferenceType=void 0):Be=vX(Ce);const $e=this.stack.pop();$e.value+=Be,$e.position.end=Cv(be.end)},codeFenced:l(function g(){const be=this.resume();this.stack[this.stack.length-1].value=be.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function p(){const be=this.resume();this.stack[this.stack.length-1].lang=be},codeFencedFenceMeta:function m(){const be=this.resume();this.stack[this.stack.length-1].meta=be},codeFlowValue:T,codeIndented:l(function y(){const be=this.resume();this.stack[this.stack.length-1].value=be.replace(/(\r?\n|\r)$/g,"")}),codeText:l(function W(){const be=this.resume();this.stack[this.stack.length-1].value=be}),codeTextData:T,data:T,definition:l(),definitionDestinationString:function _(){const be=this.resume();this.stack[this.stack.length-1].url=be},definitionLabelString:function v(be){const Ce=this.resume(),Re=this.stack[this.stack.length-1];Re.label=Ce,Re.identifier=SI(this.sliceSerialize(be)).toLowerCase()},definitionTitleString:function x(){const be=this.resume();this.stack[this.stack.length-1].title=be},emphasis:l(),hardBreakEscape:l(R),hardBreakTrailing:l(R),htmlFlow:l(function N(){const be=this.resume();this.stack[this.stack.length-1].value=be}),htmlFlowData:T,htmlText:l(function j(){const be=this.resume();this.stack[this.stack.length-1].value=be}),htmlTextData:T,image:l(function $(){const be=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";be.type+="Reference",be.referenceType=Ce,delete be.url,delete be.title}else delete be.identifier,delete be.label;this.data.referenceType=void 0}),label:function X(){const be=this.stack[this.stack.length-1],Ce=this.resume(),Re=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===Re.type?Re.children=be.children:Re.alt=Ce},labelText:function V(be){const Ce=this.sliceSerialize(be),Re=this.stack[this.stack.length-2];Re.label=function SIt(e){return e.replace(_It,CIt)}(Ce),Re.identifier=SI(Ce).toLowerCase()},lineEnding:function F(be){const Ce=this.stack[this.stack.length-1];if(this.data.atHardBreak)return Ce.children[Ce.children.length-1].position.end=Cv(be.end),void(this.data.atHardBreak=void 0);!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Ce.type)&&(D.call(this,be),T.call(this,be))},link:l(function z(){const be=this.stack[this.stack.length-1];if(this.data.inReference){const Ce=this.data.referenceType||"shortcut";be.type+="Reference",be.referenceType=Ce,delete be.url,delete be.title}else delete be.identifier,delete be.label;this.data.referenceType=void 0}),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:function Q(be){const Ce=this.resume(),Re=this.stack[this.stack.length-1];Re.label=Ce,Re.identifier=SI(this.sliceSerialize(be)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function H(){const be=this.resume();this.stack[this.stack.length-1].url=be},resourceTitleString:function oe(){const be=this.resume();this.stack[this.stack.length-1].title=be},resource:function te(){this.data.inReference=void 0},setextHeading:l(function E(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function M(be){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(be).codePointAt(0)?1:2},setextHeadingText:function A(){this.data.setextHeadingSlurpLineEnding=!0},strong:l(),thematicBreak:l()}};j_e(t,(e||{}).mdastExtensions||[]);const n={};return function r(be){let Ce={type:"root",children:[]};const Re={stack:[Ce],tokenStack:[],config:t,enter:a,exit:c,buffer:s,resume:u,data:n},Be=[];let $e=-1;for(;++$e0){const nt=Re.tokenStack[Re.tokenStack.length-1];(nt[1]||U_e).call(Re,void 0,nt[0])}for(Ce.position={start:Cv(be.length>0?be[0][1].start:{line:1,column:1,offset:0}),end:Cv(be.length>0?be[be.length-2][1].end:{line:1,column:1,offset:0})},$e=-1;++$e((e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,s]=t[i];switch(o){case 0:case-1:return n(s,i);case 1:{const a=n([],i);for(const l of s)a.push(r(l));return a}case 2:{const a=n({},i);for(const[l,c]of s)a[r(l)]=r(c);return a}case 3:return n(new Date(s),i);case 4:{const{source:a,flags:l}=s;return n(new RegExp(a,l),i)}case 5:{const a=n(new Map,i);for(const[l,c]of s)a.set(r(l),r(c));return a}case 6:{const a=n(new Set,i);for(const l of s)a.add(r(l));return a}case 7:{const{name:a,message:l}=s;return n(new G_e[a](l),i)}case 8:return n(BigInt(s),i);case"BigInt":return n(Object(BigInt(s)),i)}return n(new G_e[o](s),i)};return r})(new Map,e)(0),{toString:DIt}={},{keys:PIt}=Object,ik=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const n=DIt.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},mB=([e,t])=>0===e&&("function"===t||"symbol"===t),W_e=(e,{json:t,lossy:n}={})=>{const r=[];return((e,t,n,r)=>{const i=(s,a)=>{const l=r.push(s)-1;return n.set(a,l),l},o=s=>{if(n.has(s))return n.get(s);let[a,l]=ik(s);switch(a){case 0:{let u=s;switch(l){case"bigint":a=8,u=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return i([-1],s)}return i([a,u],s)}case 1:{if(l)return i([l,[...s]],s);const u=[],d=i([a,u],s);for(const f of s)u.push(o(f));return d}case 2:{if(l)switch(l){case"BigInt":return i([l,s.toString()],s);case"Boolean":case"Number":case"String":return i([l,s.valueOf()],s)}if(t&&"toJSON"in s)return o(s.toJSON());const u=[],d=i([a,u],s);for(const f of PIt(s))(e||!mB(ik(s[f])))&&u.push([o(f),o(s[f])]);return d}case 3:return i([a,s.toISOString()],s);case 4:{const{source:u,flags:d}=s;return i([a,{source:u,flags:d}],s)}case 5:{const u=[],d=i([a,u],s);for(const[f,p]of s)(e||!mB(ik(f))&&!mB(ik(p)))&&u.push([o(f),o(p)]);return d}case 6:{const u=[],d=i([a,u],s);for(const f of s)(e||!mB(ik(f)))&&u.push(o(f));return d}}const{message:c}=s;return i([a,{name:l,message:c}],s)};return o})(!(t||n),!!t,new Map,r)(e),r},gB="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?q_e(W_e(e,t)):structuredClone(e):(e,t)=>q_e(W_e(e,t));function N2(e){const t=[];let n=-1,r=0,i=0;for(;++n55295&&o<57344){const a=e.charCodeAt(n+1);o<56320&&a>56319&&a<57344?(s=String.fromCharCode(o,a),i=1):s="\ufffd"}else s=String.fromCharCode(o);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+i+1,s=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function MIt(e,t){const n=[{type:"text",value:"\u21a9"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function RIt(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}const EX=function(e){if(null==e)return jIt;if("function"==typeof e)return yB(e);if("object"==typeof e)return Array.isArray(e)?function OIt(e){const t=[];let n=-1;for(;++n":"")+")"})}return f;function f(){let m,h,g,p=Y_e;if((!t||o(l,c,u[u.length-1]||void 0))&&(p=function HIt(e){return Array.isArray(e)?e:"number"==typeof e?[UIt,e]:null==e?Y_e:[e]}(n(l,u)),p[0]===X_e))return p;if("children"in l&&l.children){const y=l;if(y.children&&p[0]!==zIt)for(h=(r?y.children.length:-1)+s,g=u.concat(y);h>-1&&h1}const J_e=9,e2e=32;function fEt(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(t2e(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(t2e(t.slice(i),i>0,!1)),o.join("")}function t2e(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===J_e||o===e2e;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===J_e||o===e2e;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}const mEt={blockquote:function GIt(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function qIt(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function WIt(e,t){const n=t.value?t.value+"\n":"",r={};t.lang&&(r.className=["language-"+t.lang]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i},delete:function $It(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function YIt(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function XIt(e,t){const n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=N2(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let s,a=e.footnoteCounts.get(r);void 0===a?(a=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=o+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function KIt(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function ZIt(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function QIt(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Z_e(e,t);const i={src:N2(r.url||""),alt:t.alt};null!=r.title&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)},image:function JIt(e,t){const n={src:N2(t.url)};null!=t.alt&&(n.alt=t.alt),null!=t.title&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function eEt(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function tEt(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Z_e(e,t);const i={href:N2(r.url||"")};null!=r.title&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)},link:function nEt(e,t){const n={href:N2(t.url)};null!=t.title&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function rEt(e,t,n){const r=e.all(t),i=n?function iEt(e){let t=!1;if("list"===e.type){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=lX(t.children[1]),l=c_e(t.children[t.children.length-1]);a&&l&&(s.position={start:a,end:l}),i.push(s)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)},tableCell:function dEt(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function uEt(e,t,n){const r=n?n.children:void 0,o=0===(r?r.indexOf(t):1)?"th":"td",s=n&&"table"===n.type?n.align:void 0,a=s?s.length:t.children.length;let l=-1;const c=[];for(;++l0&&n.push({type:"text",value:"\n"}),n}function n2e(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function r2e(e,t){const n=yEt(e,t),r=n.one(e,void 0),i=function NIt(e){const t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||MIt,r=e.options.footnoteBackLabel||RIt,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",s=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l0&&m.push({type:"text",value:" "});let v="string"==typeof n?n:n(l,p);"string"==typeof v&&(v={type:"text",value:v}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const g=u[u.length-1];if(g&&"element"===g.type&&"p"===g.tagName){const v=g.children[g.children.length-1];v&&"text"===v.type?v.value+=" ":g.children.push({type:"text",value:" "}),g.children.push(...m)}else u.push(...m);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(u,!0)};e.patch(c,y),a.push(y)}if(0!==a.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...gB(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:"\n"}]}}(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:"\n"},i),o}function SEt(e,t){return e&&"run"in e?function(){var n=le(function*(r,i){const o=r2e(r,{file:i,...t});yield e.run(o,i)});return function(r,i){return n.apply(this,arguments)}}():function(n,r){return r2e(n,{file:r,...t||e})}}function i2e(e){if(e)throw e}var DX=ln(216);function PX(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}const Yg_basename=function AEt(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');ok(e);let o,n=0,r=-1,i=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;i--;)if(47===e.codePointAt(i)){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,a=t.length-1;for(;i--;)if(47===e.codePointAt(i)){if(o){n=i+1;break}}else s<0&&(o=!0,s=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)},Yg_dirname=function IEt(e){if(ok(e),0===e.length)return".";let r,t=-1,n=e.length;for(;--n;)if(47===e.codePointAt(n)){if(r){t=n;break}}else r||(r=!0);return t<0?47===e.codePointAt(0)?"/":".":1===t&&47===e.codePointAt(0)?"//":e.slice(0,t)},Yg_extname=function EEt(e){ok(e);let s,t=e.length,n=-1,r=0,i=-1,o=0;for(;t--;){const a=e.codePointAt(t);if(47!==a)n<0&&(s=!0,n=t+1),46===a?i<0?i=t:1!==o&&(o=1):i>-1&&(o=-1);else if(s){r=t+1;break}}return i<0||n<0||0===o||1===o&&i===n-1&&i===r+1?"":e.slice(i,n)},Yg_join=function TEt(...e){let n,t=-1;for(;++t2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=s,o=0;continue}}else if(n.length>0){n="",r=0,i=s,o=0;continue}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,o=0}else 46===a&&o>-1?o++:o=-1}return n}(e,!t);return 0===n.length&&!t&&(n="."),n.length>0&&47===e.codePointAt(e.length-1)&&(n+="/"),t?"/"+n:n}(n)},Yg_sep="/";function ok(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const kEt_cwd=function MEt(){return"/"};function kX(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}const MX=["history","path","basename","stem","extname","dirname"];class o2e{constructor(t){let n;n=t?kX(t)?{path:t}:"string"==typeof t||function FEt(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(t)?{value:t}:t:{},this.cwd=kEt_cwd(),this.data={},this.history=[],this.messages=[];let i,r=-1;for(;++rs.length;let l;a&&s.push(i);try{l=e.apply(this,s)}catch(c){if(a&&n)throw c;return i(c)}a||(l&&l.then&&"function"==typeof l.then?l.then(o,i):l instanceof Error?i(l):o(l))};function i(s,...a){n||(n=!0,t(s,...a))}function o(s){i(null,s)}}(u,a)(...c):s(null,...c)}}(null,...i)},use:function r(i){if("function"!=typeof i)throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}};return t}()}copy(){const t=new FX;let n=-1;for(;++n0){let[p,...m]=u;const h=r[f][1];PX(h)&&PX(p)&&(p=DX(!0,h,p)),r[f]=[c,p,...m]}}}}const LEt=(new FX).freeze();function OX(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function BX(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function LX(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function a2e(e){if(!PX(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function l2e(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function vB(e){return function jEt(e){return!!(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new o2e(e)}const c2e=[],u2e={allowDangerousHtml:!0},HEt=/^(https?|ircs?|mailto|xmpp)$/i,GEt=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function d2e(e){const t=e.allowedElements,n=e.allowElement,r=e.children||"",i=e.className,o=e.components,s=e.disallowedElements,a=e.rehypePlugins||c2e,l=e.remarkPlugins||c2e,c=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...u2e}:u2e,u=e.skipHtml,d=e.unwrapDisallowed,f=e.urlTransform||qEt,p=LEt().use(EIt).use(l).use(SEt,c).use(a),m=new o2e;"string"==typeof r&&(m.value=r);for(const v of GEt)Object.hasOwn(e,v.from);const h=p.parse(m);let g=p.runSync(h,m);return i&&(g={type:"element",tagName:"div",properties:{className:i},children:"root"===g.type?g.children:[g]}),K_e(g,function y(v,x,_){if("raw"===v.type&&_&&"number"==typeof x)return u?_.children.splice(x,1):_.children[x]={type:"text",value:v.value},x;if("element"===v.type){let w;for(w in pX)if(Object.hasOwn(pX,w)&&Object.hasOwn(v.properties,w)){const A=v.properties[w],M=pX[w];(null===M||M.includes(v.tagName))&&(v.properties[w]=f(String(A||""),w,v))}}if("element"===v.type){let w=t?!t.includes(v.tagName):!!s&&s.includes(v.tagName);if(!w&&n&&"number"==typeof x&&(w=!n(v,x,_)),w&&_&&"number"==typeof x)return d&&v.children?_.children.splice(x,1,...v.children):_.children.splice(x,1),x}}),function swt(e,t){if(!t||void 0===t.Fragment)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if("function"!=typeof t.jsxDEV)throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=function hwt(e,t){return function n(r,i,o,s){const a=Array.isArray(o.children),l=lX(r);return t(i,o,s,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}(n,t.jsxDEV)}else{if("function"!=typeof t.jsx)throw new TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw new TypeError("Expected `jsxs` in production options");r=function pwt(e,t,n){return function r(i,o,s,a){const c=Array.isArray(s.children)?n:t;return a?c(o,s,a):c(o,s)}}(0,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?aX:qCt,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},o=h_e(i,e,void 0);return o&&"string"!=typeof o?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}(g,{Fragment:L.Fragment,components:o,ignoreInvalidStyle:!0,jsx:L.jsx,jsxs:L.jsxs,passKeys:!0,passNode:!0})}function qEt(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t<0||i>-1&&t>i||n>-1&&t>n||r>-1&&t>r||HEt.test(e.slice(0,t))?e:""}class WEt extends Vr{constructor(){super(...arguments),this.updateParams=t=>{this.plugin.managers.animation.updateParams({[t.name]:t.value})},this.updateCurrentParams=t=>{this.plugin.managers.animation.updateCurrentParams({[t.name]:t.value})},this.startOrStop=()=>{const t=this.plugin.managers.animation;"playing"===t.state.animationState?t.stop():(this.props.onStart&&this.props.onStart(),t.start())}}componentDidMount(){this.subscribe(this.plugin.managers.animation.events.updated,()=>this.forceUpdate())}render(){var t,n;const r=this.plugin.managers.animation;if(r.isEmpty)return null;const i="playing"===r.state.animationState,o=null===(n=(t=r.current.anim).canApply)||void 0===n?void 0:n.call(t,this.plugin);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(vs,{params:r.getParams(),values:r.state.params,onChange:this.updateParams,isDisabled:i}),(0,L.jsx)(vs,{params:r.current.params,values:r.current.paramValues,onChange:this.updateCurrentParams,isDisabled:i}),(0,L.jsx)("div",{className:"msp-flex-row",children:(0,L.jsx)(ir,{icon:"playing"!==r.state.animationState?void 0:Rbe,onClick:this.startOrStop,disabled:void 0!==o&&!1===o.canApply,children:"playing"===r.state.animationState?"Stop":void 0===o||o.canApply?"Start":o.reason||"Start"})})]})}}function f2e(e){return xd((t,n)=>e<=n)}class F2 extends bl{constructor(){super(...arguments),this.onChange=({name:t,value:n})=>{const r={...this.props.params,[t]:n};this.props.events.onChange(r,this.areInitial(r),this.validate(r))}}validate(t){}areInitial(t){return I.areEqual(this.props.info.params,t,this.props.info.initialValues)}render(){return(0,L.jsx)(vs,{params:this.props.info.params,values:this.props.params,onChange:this.onChange,onEnter:this.props.events.onEnter,isDisabled:this.props.isDisabled})}}!function(e){function t(i){const o=Object.keys(i);for(const s of o)if(!i[s].isHidden)return!1;return!0}e.infoFromAction=function n(i,o,s,a){const l=o.cells.get(a).obj,c=s.definition.params?s.definition.params(l,i):{};return{initialValues:I.getDefaultValues(c),params:c,isEmpty:t(c)}},e.infoFromTransform=function r(i,o,s){const a=o.cells.get(s.ref),l=a.params&&a.params.definition||{};return{initialValues:a.params&&a.params.values||{},params:l,isEmpty:t(l)}}}(F2||(F2={}));class p2e extends bl{constructor(){var t;super(...arguments),t=this,this.busy=new Ao(!1),this.onEnter=()=>{this.state.error||this.apply()},this.autoApplyHandle=void 0,this.events={onEnter:this.onEnter,onChange:(n,r,i)=>{this.clearAutoApply(),this.setState({params:n,isInitial:r,error:i&&i[0]},()=>{!r&&!this.state.error&&this.canAutoApply(n)&&(this.clearAutoApply(),this.autoApplyHandle=setTimeout(this.apply,50))})}},this.apply=le(function*(){var n,r;t.clearAutoApply(),t.setState({busy:!0});try{yield t.applyAction()}catch(i){console.error(i)}finally{null===(r=(n=t.props).onApply)||void 0===r||r.call(n),t.busy.next(!1)}}),this.refresh=()=>{this.setState({params:this.getInfo().initialValues,isInitial:!0,error:void 0})},this.setDefault=()=>{const n=this.getInfo(),r=I.getDefaultValues(n.params);this.setState({params:r,isInitial:I.areEqual(n.params,r,n.initialValues),error:void 0})},this.toggleExpanded=()=>{this.setState({isCollapsed:!this.state.isCollapsed})}}clearAutoApply(){void 0!==this.autoApplyHandle&&(clearTimeout(this.autoApplyHandle),this.autoApplyHandle=void 0)}componentDidMount(){this.subscribe(this.plugin.behaviors.state.isBusy,t=>{this.busy.value!==t&&this.busy.next(t)}),this.subscribe(this.busy.pipe(f2e(1)),t=>{this.setState({busy:t})})}renderApply(){const t=this.canApply();return!this.props.autoHideApply||t&&!this.canAutoApply(this.state.params)?(0,L.jsxs)("div",{className:"msp-transform-apply-wrap",children:[(0,L.jsx)(kn,{svg:HW,className:"msp-transform-default-params",onClick:this.setDefault,disabled:this.state.busy,title:"Set default params"}),(0,L.jsx)("div",{className:"msp-transform-apply-wider",children:(0,L.jsx)(ir,{icon:t?a2:void 0,className:"msp-btn-commit msp-btn-commit-"+(t?"on":"off"),onClick:this.apply,disabled:!t,children:this.props.applyLabel||this.applyText()})})]}):null}renderDefault(){const t=this.getInfo(),n=t.isEmpty&&this.isUpdate(),r=this.getHeader(),i=this.getTransformerId(),o=this.plugin.customParamEditors.has(i)?this.plugin.customParamEditors.get(i):F2,s=this.state.isCollapsed?"msp-transform-wrapper msp-transform-wrapper-collapsed":"msp-transform-wrapper";let a=null;if(!n&&!this.state.isCollapsed){const{a:c,b:u,bCell:d}=this.getSourceAndTarget(),f=this.renderApply();a=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(o,{info:t,a:c,b:u,bCell:d,events:this.events,params:this.state.params,isDisabled:this.state.busy}),f]})}const l=(0,L.jsxs)("div",{className:s,style:{marginBottom:this.props.noMargin?0:void 0},children:["none"!==r&&!this.props.wrapInExpander&&(0,L.jsx)("div",{className:"msp-transform-header",children:(0,L.jsxs)(ir,{onClick:this.toggleExpanded,title:r.description,children:[!n&&(0,L.jsx)(Mi,{svg:this.state.isCollapsed?Xy:Yy}),r.name]})}),a]});return n||!this.props.wrapInExpander?l:(0,L.jsx)(lm,{header:this.isUpdate()?`Update ${"none"===r?"":r.name}`:`Apply ${"none"===r?"":r.name}`,headerLeftMargin:this.props.expanderHeaderLeftMargin,children:l})}renderSimple(){var t,n,r;const i=this.getInfo(),o=this.canApply(),s=(0,L.jsxs)("div",{className:"msp-flex-row",children:[(0,L.jsx)(ir,{icon:null===(t=this.props.simpleApply)||void 0===t?void 0:t.icon,title:null===(n=this.props.simpleApply)||void 0===n?void 0:n.title,disabled:this.state.busy||!o,onClick:this.apply,className:"msp-btn-apply-simple",children:null===(r=this.props.simpleApply)||void 0===r?void 0:r.header}),!i.isEmpty&&(0,L.jsx)(yl,{icon:uv,label:"",title:"Options",toggle:this.toggleExpanded,isSelected:!this.state.isCollapsed,disabled:this.state.busy,style:{flex:"0 0 40px",padding:0}})]});if(this.state.isCollapsed)return s;const a=this.getTransformerId(),l=this.plugin.customParamEditors.has(a)?this.plugin.customParamEditors.get(a):F2,{a:c,b:u,bCell:d}=this.getSourceAndTarget();return(0,L.jsxs)(L.Fragment,{children:[s,(0,L.jsx)(l,{info:i,a:c,b:u,bCell:d,events:this.events,params:this.state.params,isDisabled:this.state.busy})]})}render(){return this.props.simpleApply?this.renderSimple():this.renderDefault()}}class ab extends p2e{constructor(){super(...arguments),this._getInfo=sy(t=>F2.infoFromTransform(this.plugin,this.props.state,t)),this.state={error:void 0,isInitial:!0,params:this.getInfo().initialValues,busy:!1,isCollapsed:this.props.initiallyCollapsed}}applyAction(){return this.props.customUpdate?this.props.customUpdate(this.state.params):this.plugin.state.updateTransform(this.props.state,this.props.transform.ref,this.state.params)}getInfo(){return this._getInfo(this.props.transform)}getTransformerId(){return this.props.transform.transformer.id}getHeader(){return this.props.customHeader||this.props.transform.transformer.definition.display}canApply(){const{state:t}=this.props,n=t.cells.get(this.props.transform.ref);if(!n)return!1;if("error"===n.status){const r=t.cells.get(this.props.transform.parent);return!!r&&"ok"===r.status}return!this.state.error&&!this.state.busy&&!this.state.isInitial}applyText(){return this.canApply()?"Update":"Nothing to Update"}isUpdate(){return!0}getSourceAndTarget(){const t=this.props.state.cells.get(this.props.transform.ref);return{a:this.props.state.cells.get(this.props.transform.parent).obj,b:t?.obj,bCell:t}}canAutoApply(t){const n=this.props.transform.transformer.definition.canAutoUpdate;if(!n)return!1;const{state:r}=this.props,i=r.cells.get(this.props.transform.ref);return!(!i||!i.sourceRef||"ok"!==i.status)&&n({a:r.cells.get(i.sourceRef).obj,b:i.obj,oldParams:this.getInfo().initialValues,newParams:t},this.plugin)}componentDidMount(){super.componentDidMount(),this.props.toggleCollapsed&&this.subscribe(this.props.toggleCollapsed,()=>this.setState({isCollapsed:!this.state.isCollapsed})),this.subscribe(this.plugin.state.events.object.updated,({ref:t,state:n})=>{this.props.transform.ref!==t||this.props.state!==n||this.state.params!==this.props.transform.params&&(this._getInfo=sy(r=>F2.infoFromTransform(this.plugin,this.props.state,r)),this.setState({params:this.props.transform.params,isInitial:!0}))})}componentDidUpdate(t){var n;if(this.props.transform!==t.transform){const r=this.props.state.cells.get(this.props.transform.ref);this.setState({params:(null===(n=r.params)||void 0===n?void 0:n.values)||{},isInitial:!0,error:void 0,simpleOnly:this.state.simpleOnly})}}}class $Et extends bl{get current(){return this.plugin.managers.structure.hierarchy.behaviors.selection}componentDidMount(){this.subscribe(this.current,()=>this.forceUpdate())}get unitcell(){var t;const{selection:n}=this.plugin.managers.structure.hierarchy;if(0===n.structures.length)return null;const r=[];for(const i of n.structures){const o=i.model;o?.unitcell&&null!==(t=o.unitcell)&&void 0!==t&&t.cell.obj&&r.push(o.unitcell)}return 0===r.length?null:(0,L.jsx)(h2e,{refs:r,labelMultiple:"Unit Cells"})}get customControls(){const t=[];return this.plugin.genericRepresentationControls.forEach((n,r)=>{const[i,o]=n(this.plugin.managers.structure.hierarchy.selection);i.length>0&&t.push((0,L.jsx)("div",{children:(0,L.jsx)(h2e,{refs:i,labelMultiple:o})},r))}),t.length>0?t:null}render(){return(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)("div",{style:{marginTop:"6px"},children:[this.unitcell,this.customControls]})})}}class h2e extends bl{constructor(){super(...arguments),this.state={showOptions:!1},this.toggleVisibility=t=>{t.preventDefault(),this.plugin.managers.structure.hierarchy.toggleVisibility(this.props.refs),t.currentTarget.blur()},this.highlight=t=>{t.preventDefault(),this.pivot.cell.parent&&jt.Interactivity.Object.Highlight(this.plugin,{state:this.pivot.cell.parent,ref:this.props.refs.map(n=>n.cell.transform.ref)})},this.clearHighlight=t=>{t.preventDefault(),jt.Interactivity.ClearHighlights(this.plugin)},this.focus=t=>{var n;t.preventDefault();let r=!0;for(const o of this.props.refs)if(!o.cell.state.isHidden){r=!1;break}r&&this.plugin.managers.structure.hierarchy.toggleVisibility(this.props.refs,"show");const i=[];for(const o of this.props.refs){if(o.cell.state.isHidden)continue;const s=null===(n=o.cell.obj)||void 0===n?void 0:n.data.repr.getLoci();s&&i.push(s)}this.plugin.managers.camera.focusLoci(i)},this.toggleOptions=()=>this.setState({showOptions:!this.state.showOptions})}componentDidMount(){this.subscribe(this.plugin.state.events.cell.stateUpdated,t=>{var n;L1.ObjectEvent.isCell(t,null===(n=this.pivot)||void 0===n?void 0:n.cell)&&this.forceUpdate()})}get pivot(){return this.props.refs[0]}render(){const{refs:t,labelMultiple:n}=this.props;if(0===t.length)return null;const r=t[0];let i,o;if(1===t.length){const{obj:s}=r.cell;if(!s)return null;i=s?.label,o=s?.description}else i=`${t.length} ${n||"Objects"}`;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"msp-flex-row",children:[(0,L.jsxs)("button",{className:"msp-form-control msp-control-button-label",title:`${i}. Click to focus.`,onClick:this.focus,onMouseEnter:this.highlight,onMouseLeave:this.clearHighlight,style:{textAlign:"left"},children:[i," ",(0,L.jsx)("small",{children:o})]}),(0,L.jsx)(kn,{svg:r.cell.state.isHidden?c2:u2,toggleState:!1,className:"msp-form-control",onClick:this.toggleVisibility,title:r.cell.state.isHidden?"Show":"Hide",small:!0,flex:!0}),1===t.length&&(0,L.jsx)(kn,{svg:l2,className:"msp-form-control",onClick:this.toggleOptions,title:"Options",toggleState:this.state.showOptions,flex:!0})]}),1===t.length&&this.state.showOptions&&r.cell.parent&&(0,L.jsx)(L.Fragment,{children:(0,L.jsx)("div",{className:"msp-control-offset",children:(0,L.jsx)(ab,{state:r.cell.parent,transform:r.cell.transform,customHeader:"none",autoHideApply:!0})})})]})}}class YEt extends d2{defaultState(){return{header:"Components",isCollapsed:!1,isDisabled:!1,brand:{accent:"blue",svg:LW}}}componentDidMount(){this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,t=>this.setState({description:m2.getSelectedStructuresDescription(this.plugin)}))}renderControls(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(XEt,{}),(0,L.jsx)(ZEt,{}),(0,L.jsx)($Et,{})]})}}class XEt extends bl{constructor(){super(...arguments),this.state={isEmpty:!0,isBusy:!1,canUndo:!1},this.togglePreset=this.toggleAction("preset"),this.toggleAdd=this.toggleAction("add"),this.toggleOptions=this.toggleAction("options"),this.hideAction=()=>this.setState({action:void 0}),this.applyPreset=t=>{if(this.hideAction(),!t)return;const n=this.plugin.managers.structure,{structures:r}=n.hierarchy.selection;null===t.value?n.component.clear(r):n.component.applyPreset(r,t.value)},this.undo=()=>{const t=this.plugin.state.data.undo();t&&this.plugin.runTask(t)}}get isDisabled(){return this.state.isBusy||this.state.isEmpty}componentDidMount(){this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,t=>this.setState({action:"options"!==this.state.action||0===t.structures.length?void 0:"options",isEmpty:0===t.structures.length})),this.subscribe(this.plugin.behaviors.state.isBusy,t=>{this.setState({isBusy:t,action:"options"!==this.state.action?void 0:"options"})}),this.subscribe(this.plugin.state.data.events.historyUpdated,({state:t})=>{this.setState({canUndo:t.canUndo})})}toggleAction(t){return()=>this.setState({action:this.state.action===t?void 0:t})}get presetControls(){return(0,L.jsx)(Hn,{items:this.presetActions,onSelect:this.applyPreset})}get presetActions(){const t=this.plugin.managers.structure.component.pivotStructure,n=this.plugin.builders.structure.representation.getPresets(t?.cell.obj);return Hn.createItems(n,{label:r=>r.display.name,category:r=>r.display.group,description:r=>r.display.description})}render(){const t=this.state.canUndo?`Undo ${this.plugin.state.data.latestUndoLabel}`:"Some mistakes of the past can be undone.";return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"msp-flex-row",children:[(0,L.jsx)(yl,{icon:OA,label:"Preset",title:"Apply a representation preset for the current structure(s).",toggle:this.togglePreset,isSelected:"preset"===this.state.action,disabled:this.isDisabled}),(0,L.jsx)(yl,{icon:FA,label:"Add",title:"Add a new representation component for a selection.",toggle:this.toggleAdd,isSelected:"add"===this.state.action,disabled:this.isDisabled}),(0,L.jsx)(yl,{icon:uv,label:"",title:"Options that are applied to all applicable representations.",style:{flex:"0 0 40px",padding:0},toggle:this.toggleOptions,isSelected:"options"===this.state.action,disabled:this.isDisabled}),(0,L.jsx)(kn,{svg:qW,className:"msp-flex-item",flex:"40px",onClick:this.undo,disabled:!this.state.canUndo||this.isDisabled,title:t})]}),"preset"===this.state.action&&this.presetControls,"add"===this.state.action&&(0,L.jsx)("div",{className:"msp-control-offset",children:(0,L.jsx)(m2e,{onApply:this.hideAction})}),"options"===this.state.action&&(0,L.jsx)("div",{className:"msp-control-offset",children:(0,L.jsx)(KEt,{isDisabled:this.isDisabled})})]})}}class m2e extends bl{constructor(){super(...arguments),this.state=this.createState(),this.apply=()=>{const t=this.props.forSelection?this.currentStructures:this.selectedStructures;this.props.onApply(),this.plugin.managers.structure.component.add(this.state.values,t)},this.paramsChanged=t=>this.setState({values:t})}createState(){const t=Bg.getAddParams(this.plugin);return{params:t,values:I.getDefaultValues(t)}}get selectedStructures(){return this.plugin.managers.structure.component.currentStructures}get currentStructures(){return this.plugin.managers.structure.hierarchy.current.structures}render(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(vs,{params:this.state.params,values:this.state.values,onChangeValues:this.paramsChanged}),(0,L.jsx)(ir,{icon:FA,title:"Use Selection and optional Representation to create a new Component.",className:"msp-btn-commit msp-btn-commit-on",onClick:this.apply,style:{marginTop:"1px"},children:"Create Component"})]})}}class KEt extends bl{constructor(){super(...arguments),this.update=t=>this.plugin.managers.structure.component.setOptions(t)}componentDidMount(){this.subscribe(this.plugin.managers.structure.component.events.optionsUpdated,()=>this.forceUpdate())}render(){return(0,L.jsx)(vs,{params:Bg.OptionsParams,values:this.plugin.managers.structure.component.state.options,onChangeValues:this.update,isDisabled:this.props.isDisabled})}}class ZEt extends bl{componentDidMount(){this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,()=>{this.forceUpdate()})}render(){const t=this.plugin.managers.structure.hierarchy.currentComponentGroups;return 0===t.length?null:(0,L.jsx)("div",{style:{marginTop:"6px"},children:t.map(n=>(0,L.jsx)(QEt,{group:n},n[0].cell.transform.ref))})}}class QEt extends bl{constructor(){super(...arguments),this.state={action:void 0},this.toggleVisible=t=>{t.preventDefault(),t.currentTarget.blur(),this.plugin.managers.structure.component.toggleVisibility(this.props.group)},this.selectAction=t=>{t&&(0,t?.value)()},this.remove=()=>this.plugin.managers.structure.hierarchy.remove(this.props.group,!0),this.toggleAction=()=>this.setState({action:"action"===this.state.action?void 0:"action"}),this.toggleLabel=()=>this.setState({action:"label"===this.state.action?void 0:"label"}),this.highlight=t=>{t.preventDefault(),this.props.group[0].cell.parent&&jt.Interactivity.Object.Highlight(this.plugin,{state:this.props.group[0].cell.parent,ref:this.props.group.map(n=>n.cell.transform.ref)})},this.clearHighlight=t=>{t.preventDefault(),jt.Interactivity.ClearHighlights(this.plugin)},this.focus=()=>{let t=!0;for(const n of this.props.group)if(!n.cell.state.isHidden){t=!1;break}t&&this.plugin.managers.structure.hierarchy.toggleVisibility(this.props.group,"show"),this.plugin.managers.camera.focusSpheres(this.props.group,n=>{var r;if(!n.cell.state.isHidden)return null===(r=n.cell.obj)||void 0===r?void 0:r.data.boundary.sphere})},this.updateLabel=t=>{this.plugin.managers.structure.component.updateLabel(this.pivot,t)}}get pivot(){return this.props.group[0]}componentDidMount(){this.subscribe(this.plugin.state.events.cell.stateUpdated,t=>{L1.ObjectEvent.isCell(t,this.pivot.cell)&&this.forceUpdate()})}get colorByActions(){var t,n;const r=this.plugin.managers.structure.component,o=null===(t=this.pivot.representations[0].cell.transform.params)||void 0===t?void 0:t.colorTheme.name,s=function $gt(e,t){const{themes:n}=e.representation.structure;return t?n.colorThemeRegistry.getApplicableTypes({structure:t}):n.colorThemeRegistry.types}(this.plugin,null===(n=this.pivot.cell.obj)||void 0===n?void 0:n.data);return Hn.createItemsFromSelectOptions(s,{value:a=>()=>r.updateRepresentationsTheme(this.props.group,{color:a[0]}),selected:a=>a[0]===o})}get actions(){const t=this.plugin.managers.structure.component,n=[[Hn.Header("Add Representation"),...Bg.getRepresentationTypes(this.plugin,this.props.group[0]).map(r=>Hn.Item(r[1],()=>t.addRepresentation(this.props.group,r[0])))]];return this.pivot.representations.length>0&&n.push([Hn.Header("Set Coloring",{isIndependent:!0}),...this.colorByActions]),t.canBeModified(this.props.group[0])&&n.push([Hn.Header("Modify by Selection"),Hn.Item("Include",()=>t.modifyByCurrentSelection(this.props.group,"union"),{icon:FW}),Hn.Item("Subtract",()=>t.modifyByCurrentSelection(this.props.group,"subtract"),{icon:OW}),Hn.Item("Intersect",()=>t.modifyByCurrentSelection(this.props.group,"intersect"),{icon:BW})]),n.push(Hn.Item("Select This",()=>t.selectThis(this.props.group),{icon:dO})),t.canBeModified(this.props.group[0])&&n.push(Hn.Item("Edit Label",this.toggleLabel)),n}get reprLabel(){var t;const n=this.pivot;return 0===n.representations.length?"No repr.":1===n.representations.length?null===(t=n.representations[0].cell.obj)||void 0===t?void 0:t.label:`${n.representations.length} reprs`}render(){var t;const n=this.pivot,r=n.cell,i=null===(t=r.obj)||void 0===t?void 0:t.label;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"msp-flex-row",children:[(0,L.jsxs)(ir,{noOverflow:!0,className:"msp-control-button-label",title:`${i}. Click to focus.`,onClick:this.focus,onMouseEnter:this.highlight,onMouseLeave:this.clearHighlight,style:{textAlign:"left"},children:[i,(0,L.jsx)("small",{className:"msp-25-lower-contrast-text",style:{float:"right"},children:this.reprLabel})]}),(0,L.jsx)(kn,{svg:r.state.isHidden?c2:u2,toggleState:!1,onClick:this.toggleVisible,title:(r.state.isHidden?"Show":"Hide")+" component",small:!0,className:"msp-form-control",flex:!0}),(0,L.jsx)(kn,{svg:qp,toggleState:!1,onClick:this.remove,title:"Remove",small:!0,className:"msp-form-control",flex:!0}),(0,L.jsx)(kn,{svg:l2,onClick:this.toggleAction,title:"Actions",toggleState:"action"===this.state.action,className:"msp-form-control",flex:!0})]}),"label"===this.state.action&&(0,L.jsx)("div",{className:"msp-control-offset",style:{marginBottom:"6px"},children:(0,L.jsx)(Bd,{label:"Label",control:(0,L.jsxs)("div",{style:{display:"flex",textAlignLast:"center"},children:[(0,L.jsx)(Ky,{onChange:this.updateLabel,value:i,style:{flex:"1 1 auto",minWidth:0},className:"msp-form-control",blurOnEnter:!0,blurOnEscape:!0}),(0,L.jsx)(kn,{svg:a2,onClick:this.toggleLabel,className:"msp-form-control msp-control-button-label",flex:!0})]})})}),"action"===this.state.action&&(0,L.jsxs)("div",{className:"msp-accent-offset",children:[(0,L.jsx)("div",{style:{marginBottom:"6px"},children:(0,L.jsx)(Hn,{items:this.actions,onSelect:this.selectAction,noOffset:!0})}),(0,L.jsx)("div",{style:{marginBottom:"6px"},children:n.representations.map(s=>(0,L.jsx)(JEt,{group:this.props.group,representation:s},s.cell.transform.ref))})]})]})}}class JEt extends bl{constructor(){super(...arguments),this.remove=()=>this.plugin.managers.structure.component.removeRepresentations(this.props.group,this.props.representation),this.toggleVisible=t=>{t.preventDefault(),t.currentTarget.blur(),this.plugin.managers.structure.component.toggleVisibility(this.props.group,this.props.representation)},this.update=t=>this.plugin.managers.structure.component.updateRepresentations(this.props.group,this.props.representation,t)}componentDidMount(){this.subscribe(this.plugin.state.events.cell.stateUpdated,t=>{L1.ObjectEvent.isCell(t,this.props.representation.cell)&&this.forceUpdate()})}render(){var t;const n=this.props.representation.cell;return(0,L.jsxs)("div",{className:"msp-representation-entry",children:[n.parent&&(0,L.jsx)(lm,{header:`${(null===(t=n.obj)||void 0===t?void 0:t.label)||""} Representation`,noOffset:!0,children:(0,L.jsx)(ab,{state:n.parent,transform:n.transform,customHeader:"none",customUpdate:this.update,noMargin:!0})}),(0,L.jsx)(kn,{svg:qp,onClick:this.remove,title:"Remove",small:!0,className:"msp-default-bg",toggleState:!1,style:{position:"absolute",top:0,right:"32px",lineHeight:"24px",height:"24px",textAlign:"right",width:"44px",paddingRight:"6px",background:"none"}}),(0,L.jsx)(kn,{svg:this.props.representation.cell.state.isHidden?c2:u2,toggleState:!1,onClick:this.toggleVisible,title:"Toggle Visibility",small:!0,className:"msp-default-bg",style:{position:"absolute",top:0,right:0,lineHeight:"24px",height:"24px",textAlign:"right",width:"32px",paddingRight:"6px",background:"none"}})]})}}function sTt(e,t){if("atom-id"===t){const n=function oTt(e){return e.split(",").map(t=>t.trim().split(/\s+|[-]/g).filter(n=>!!n)).filter(t=>1===t.length||2===t.length).map(t=>1===t.length?[+t[0],+t[0]]:[+t[0],+t[1]])}(e);return function tTt(e){const t=Ti.create();for(const[r,i]of e)for(let o=r;o<=i;o++)Ti.add(t,o,o);return M_(pe.struct.generator.atomGroups({"atom-test":pe.core.set.has([pe.set(...t.array),pe.ammp("id")])}))}(n)}return function eTt(e,t){var n;const r=[],i="auth"===t?"auth_asym_id":"label_asym_id",o="auth"===t?"auth_seq_id":"label_seq_id";for(const a of e)if("range"===a.kind)r.push(pe.struct.generator.atomGroups({"chain-test":pe.core.rel.eq([pe.ammp(i),a.asym_id]),"residue-test":pe.core.rel.inRange([pe.ammp(o),a.seq_id_beg,a.seq_id_end])}));else{const l=(null!==(n=a.ins_code)&&void 0!==n?n:"").trim();r.push(pe.struct.generator.atomGroups({"chain-test":pe.core.rel.eq([pe.ammp(i),a.asym_id]),"residue-test":pe.core.logic.and([pe.core.rel.eq([pe.ammp(o),a.seq_id]),pe.core.rel.eq([pe.ammp("pdbx_PDB_ins_code"),l])])}))}return M_(pe.struct.combinator.merge(r))}(function iTt(e){return e.split(",").map(t=>t.trim().split(/\s+|[-]/g).filter(n=>!!n)).map(t=>function nTt(e,t,n){if(e&&0!==t.length&&!Number.isNaN(+t[0]))return Number.isNaN(n)?{kind:"single",asym_id:e,seq_id:+t[0],ins_code:t[1]}:{kind:"range",asym_id:e,seq_id_beg:+t[0],seq_id_end:n}}(t[0],function rTt(e){return e?e.split(":"):[]}(t[1]),+t[2])).filter(t=>!!t)}(e),t)}class jX extends Yt.PureComponent{getBindingComponents(){const t=function aTt(e){return Object.keys(e).map(t=>[t,e[t]]).filter(t=>Ut.isBinding(t[1]))}(this.props.bindings);return(0,L.jsx)(L.Fragment,{children:t.map(n=>{const[r,i]=n;return Ut.isEmpty(i)?null:(0,L.jsxs)("div",{style:{marginBottom:"6px"},children:[(0,L.jsx)("b",{children:i.action}),(0,L.jsx)("br",{}),(0,L.jsx)("span",{dangerouslySetInnerHTML:{__html:Ut.format(i,r)}})]},r)})})}render(){return(0,L.jsx)(Xg,{children:this.getBindingComponents()})}}class Xg extends Yt.PureComponent{render(){return(0,L.jsx)("div",{className:"msp-help-text",children:(0,L.jsx)("div",{children:this.props.children})})}}class Kg extends Yt.PureComponent{constructor(){super(...arguments),this.state={header:this.props.header,isExpanded:!!this.props.initiallyExpanded},this.toggleExpanded=()=>this.setState({isExpanded:!this.state.isExpanded})}render(){return(0,L.jsxs)("div",{className:"msp-control-group-wrapper",children:[(0,L.jsx)("div",{className:"msp-control-group-header",children:(0,L.jsxs)(ir,{onClick:this.toggleExpanded,children:[(0,L.jsx)(Mi,{svg:this.state.isExpanded?Yy:Xy}),this.props.header]})}),this.state.isExpanded&&(0,L.jsx)("div",{className:"msp-control-offset",style:{display:this.state.isExpanded?"block":"none"},children:this.props.children})]})}}function UX(e){return(0,L.jsx)("div",{className:"msp-simple-help-section",children:e.header})}class zX extends Vr{constructor(){super(...arguments),this.getInteractionBindings=sy(t=>{let n;return t.forEach(r=>{var i;const o=null===(i=r.params)||void 0===i?void 0:i.values;o?.bindings&&Object.keys(o.bindings).length>0&&(n||(n={}),Object.assign(n,o.bindings))}),n})}componentDidMount(){this.subscribe(this.plugin.events.canvas3d.settingsUpdated,()=>this.forceUpdate())}render(){const t=this.getInteractionBindings(this.plugin.state.behaviors.cells);return(0,L.jsxs)(L.Fragment,{children:[!this.props.selectOnly&&this.plugin.canvas3d&&(0,L.jsx)(Kg,{header:"Moving in 3D",children:(0,L.jsx)(jX,{bindings:this.plugin.canvas3d.props.trackball.bindings})},"trackball"),!!t&&(0,L.jsx)(Kg,{header:"Mouse & Key Controls",children:(0,L.jsx)(jX,{bindings:t})},"interactions")]})}}class lTt extends Vr{componentDidMount(){this.subscribe(this.plugin.events.canvas3d.settingsUpdated,()=>this.forceUpdate())}formatTriggers(t){return t.triggers.map(n=>Ut.Trigger.format(n)).join(" or ")}getTriggerFor(t,n){const i=this.plugin.state.behaviors.select(Qn.Generators.ofTransformer(t)),o=1===i.length?i[0].params:void 0,s=o?o.values.bindings:{};return this.formatTriggers(n in s?s[n]:Ut.Empty)}render(){const t=this.getTriggerFor(W0e,"clickSelectToggle"),n=this.getTriggerFor(OF,"clickFocus");return(0,L.jsxs)("div",{children:[(0,L.jsx)(UX,{header:"Interface Controls"}),(0,L.jsxs)(Kg,{header:"Inline Help",children:[(0,L.jsx)(Xg,{children:"Many user interface elements show a little questionmark icon when hovered over. Clicking the icon toggles the display of an inline help text."}),(0,L.jsx)(Xg,{children:"Tooltips may provide additional information on a user interface element and are shown when hovering over it with the mouse."})]}),(0,L.jsx)(Kg,{header:"Selections",children:(0,L.jsxs)(Xg,{children:["The viewer allows changing colors and representations for selections of atoms, residues or chains. Selections can be created by",(0,L.jsxs)("ul",{style:{paddingLeft:"20px"},children:[(0,L.jsxs)("li",{children:["picking elements on the 3D canvas or the sequence view using the mouse, e.g. toggle selection using ",t," (for more see help section on ",(0,L.jsx)("i",{children:"Mouse Controls"}),")"]}),(0,L.jsxs)("li",{children:["using the ",(0,L.jsx)("i",{children:"Add"}),", ",(0,L.jsx)("i",{children:"Remove"})," and ",(0,L.jsx)("i",{children:"Only"})," dropdown buttons in the ",(0,L.jsx)("i",{children:"Manage Selection"})," panel which allow modifing the current selection by predefined sets"]})]})]})}),(0,L.jsx)(Kg,{header:"Coloring",children:(0,L.jsxs)(Xg,{children:["There are two ways to color structures. Every representation (e.g. cartoon or spacefill) has a color theme which can be changed using the dropdown for each representation in the ",(0,L.jsx)("i",{children:"Structure Settings"})," panel. Additionally any selection atoms, residues or chains can by given a custom color. For that, first select the parts of the structure to be colored (see help section on ",(0,L.jsx)("i",{children:"Selections"}),") and, second, choose a color from the color dropdown botton in the ",(0,L.jsx)("i",{children:"Selection"})," row of the ",(0,L.jsx)("i",{children:"Change Representation"})," panel. The theme color can be seen as a base color that is overpainted by the custom color. Custom colors can be removed for a selection with the 'Clear' option in the color dropdown."]})}),(0,L.jsx)(Kg,{header:"Representations",children:(0,L.jsxs)(Xg,{children:["Structures can be shown with many different representations (e.g. cartoon or spacefill). The ",(0,L.jsx)("i",{children:"Change Representation"})," panel offers a collection of predefined styles which can be applied using the ",(0,L.jsx)("i",{children:"Preset"})," dropdown button. Additionally any selection atoms, residues or chains can by shown with a custom representation. For that, first select the parts of the structure to be mofified (see help section on ",(0,L.jsx)("i",{children:"Selections"}),") and, second, choose a representation to hide or show from the ",(0,L.jsx)("i",{children:"Show"})," and ",(0,L.jsx)("i",{children:"Hide"})," dropdown bottons in the ",(0,L.jsx)("i",{children:"Selection"})," row of the ",(0,L.jsx)("i",{children:"Change Representation"})," panel. The ",(0,L.jsx)("i",{children:"Everything"})," row applies the action to the whole structure instead of the current selection."]})}),(0,L.jsx)(Kg,{header:"Surroundings",children:(0,L.jsxs)(Xg,{children:["To show the surroundings of a residue or ligand, click it in the 3D scene or in the sequence widget using ",n,"."]})}),(0,L.jsx)(UX,{header:"How-to Guides"}),(0,L.jsx)(Kg,{header:"Create an Image",children:(0,L.jsxs)(Xg,{children:[(0,L.jsxs)("p",{children:["Use the ",(0,L.jsx)(Mi,{svg:byt})," icon in the viewport to bring up the screenshot controls."]}),(0,L.jsxs)("p",{children:["To adjust the size of the image, use the ",(0,L.jsx)("i",{children:"Resolution"})," dropdown."]})]})}),(0,L.jsx)(UX,{header:"Mouse Controls"}),(0,L.jsx)(zX,{})]})}}class VX extends bl{constructor(){super(...arguments),this._toggleSelMode=()=>{this.plugin.selectionMode=!this.plugin.selectionMode}}componentDidMount(){this.subscribe(this.plugin.events.canvas3d.settingsUpdated,()=>this.forceUpdate()),this.subscribe(this.plugin.layout.events.updated,()=>this.forceUpdate()),this.subscribe(this.plugin.behaviors.interaction.selectionMode,()=>this.forceUpdate())}render(){return(0,L.jsx)(kn,{svg:Cbt,onClick:this._toggleSelMode,title:"Toggle Selection Mode",style:this.props.inline?{background:"transparent",width:"auto",height:"auto",lineHeight:"unset"}:{background:"transparent"},toggleState:this.plugin.selectionMode})}}const cTt={granularity:eb.Params.granularity},wI=new Map([["add","Add/Union Selection"],["remove","Remove/Subtract Selection"],["intersect","Intersect Selection"],["set","Set Selection"]]);class uTt extends Vr{constructor(){super(...arguments),this.state={action:void 0,helper:void 0,isEmpty:!0,isBusy:!1,canUndo:!1},this.set=(t,n)=>{this.plugin.managers.structure.selection.fromSelectionQuery(t,n,!1)},this.selectQuery=(t,n)=>{if(!t||!this.state.action)return void this.setState({action:void 0});const r=this.state.action;n?.shiftKey?this.set(r,t.value):this.setState({action:void 0},()=>{this.set(r,t.value)})},this.selectHelper=(t,n)=>{console.log(t),this.setState(t&&this.state.action?{helper:t.value.kind}:{action:void 0,helper:void 0})},this.queriesItems=[],this.queriesVersion=-1,this.helpersItems=void 0,this.toggleAdd=this.showAction("add"),this.toggleRemove=this.showAction("remove"),this.toggleIntersect=this.showAction("intersect"),this.toggleSet=this.showAction("set"),this.toggleTheme=this.showAction("theme"),this.toggleAddComponent=this.showAction("add-component"),this.toggleHelp=this.showAction("help"),this.setGranuality=({value:t})=>{this.plugin.managers.interactivity.setProps({granularity:t})},this.turnOff=()=>this.plugin.selectionMode=!1,this.undo=()=>{const t=this.plugin.state.data.undo();t&&this.plugin.runTask(t)},this.subtract=()=>{const t=this.plugin.managers.structure.hierarchy.getStructuresWithSelection(),n=[];for(const r of t)n.push(...r.components);0!==n.length&&this.plugin.managers.structure.component.modifyByCurrentSelection(n,"subtract")}}componentDidMount(){this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,t=>{const n=0===t.hierarchy.structures.length;this.state.isEmpty!==n&&this.setState({isEmpty:n}),this.queriesVersion=-1,this.forceUpdate()}),this.subscribe(this.plugin.behaviors.state.isBusy,t=>{this.setState({isBusy:t,action:void 0})}),this.subscribe(this.plugin.managers.interactivity.events.propsUpdated,()=>{this.forceUpdate()}),this.subscribe(this.plugin.state.data.events.historyUpdated,({state:t})=>{this.setState({canUndo:t.canUndo})})}get isDisabled(){return this.state.isBusy||this.state.isEmpty}get structures(){var t;const n=[];for(const r of this.plugin.managers.structure.hierarchy.selection.structures){const i=null===(t=r.cell.obj)||void 0===t?void 0:t.data;i&&n.push(i)}return n}get queries(){const{registry:t}=this.plugin.query.structure;if(t.version!==this.queriesVersion){const n=this.structures,r=[...t.list,...Det(n),...Tet(n),...Eet(n)].sort((i,o)=>o.priority-i.priority);this.queriesItems=Hn.createItems(r,{filter:i=>i!==Ps.current&&!i.isHidden,label:i=>i.label,category:i=>i.category,description:i=>i.description}),this.queriesVersion=t.version}return this.queriesItems}get helpers(){return this.helpersItems||(this.helpersItems=Hn.createItems([{kind:"residue-list",category:"Helpers",label:"Atom/Residue Identifier List",description:"Create a selection from a list of atom/residue ranges."}],{label:n=>n.label,category:n=>n.category,description:n=>n.description})),this.helpersItems}showAction(t){return()=>this.setState({action:this.state.action===t?void 0:t,helper:void 0})}render(){const t=this.plugin.managers.interactivity.props.granularity,n=this.state.canUndo?`Undo ${this.plugin.state.data.latestUndoLabel}`:"Some mistakes of the past can be undone.";let r;if(this.state.action&&!this.state.helper)r=(0,L.jsxs)(L.Fragment,{children:[this.state.action&&"theme"!==this.state.action&&"add-component"!==this.state.action&&"help"!==this.state.action&&(0,L.jsxs)("div",{className:"msp-selection-viewport-controls-actions",children:[(0,L.jsx)(Hn,{header:wI.get(this.state.action),title:"Click to close.",items:this.queries,onSelect:this.selectQuery,noOffset:!0}),(0,L.jsx)(Hn,{items:this.helpers,onSelect:this.selectHelper,noOffset:!0})]}),"theme"===this.state.action&&(0,L.jsx)("div",{className:"msp-selection-viewport-controls-actions",children:(0,L.jsx)(Fg,{header:"Theme",title:"Click to close.",initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.toggleTheme,topRightIcon:Rg,children:(0,L.jsx)(fTt,{onApply:this.toggleTheme})})}),"add-component"===this.state.action&&(0,L.jsx)("div",{className:"msp-selection-viewport-controls-actions",children:(0,L.jsx)(Fg,{header:"Add Component",title:"Click to close.",initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.toggleAddComponent,topRightIcon:Rg,children:(0,L.jsx)(m2e,{onApply:this.toggleAddComponent,forSelection:!0})})}),"help"===this.state.action&&(0,L.jsx)("div",{className:"msp-selection-viewport-controls-actions",children:(0,L.jsxs)(Fg,{header:"Help",title:"Click to close.",initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.toggleHelp,topRightIcon:Rg,maxHeight:"300px",children:[(0,L.jsx)(Kg,{header:"Selection Operations",children:(0,L.jsxs)(Xg,{children:["Use ",(0,L.jsx)(Mi,{svg:FW,inline:!0})," ",(0,L.jsx)(Mi,{svg:OW,inline:!0})," ",(0,L.jsx)(Mi,{svg:BW,inline:!0})," ",(0,L.jsx)(Mi,{svg:dO,inline:!0})," to modify the selection."]})}),(0,L.jsx)(Kg,{header:"Representation Operations",children:(0,L.jsxs)(Xg,{children:["Use ",(0,L.jsx)(Mi,{svg:jW,inline:!0})," ",(0,L.jsx)(Mi,{svg:LW,inline:!0})," ",(0,L.jsx)(Mi,{svg:GW,inline:!0})," ",(0,L.jsx)(Mi,{svg:qW,inline:!0})," to color, create components, remove from components, or undo actions."]})}),(0,L.jsx)(zX,{selectOnly:!0})]})})]});else if(wI.has(this.state.action)&&"residue-list"===this.state.helper){const i=()=>this.setState({action:void 0,helper:void 0});r=(0,L.jsx)("div",{className:"msp-selection-viewport-controls-actions",children:(0,L.jsx)(Fg,{header:"Atom/Residue Identifier List",title:"Click to close.",initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:i,topRightIcon:Rg,children:(0,L.jsx)(hTt,{modifier:this.state.action,plugin:this.plugin,close:i})})})}return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"msp-flex-row",style:{background:"none"},children:[(0,L.jsx)(jA,{title:"Picking Level for selecting and highlighting",param:cTt.granularity,name:"granularity",value:t,onChange:this.setGranuality,isDisabled:this.isDisabled}),(0,L.jsx)(yl,{icon:FW,title:`${wI.get("add")}. Hold shift key to keep menu open.`,toggle:this.toggleAdd,isSelected:"add"===this.state.action,disabled:this.isDisabled}),(0,L.jsx)(yl,{icon:OW,title:`${wI.get("remove")}. Hold shift key to keep menu open.`,toggle:this.toggleRemove,isSelected:"remove"===this.state.action,disabled:this.isDisabled}),(0,L.jsx)(yl,{icon:BW,title:`${wI.get("intersect")}. Hold shift key to keep menu open.`,toggle:this.toggleIntersect,isSelected:"intersect"===this.state.action,disabled:this.isDisabled}),(0,L.jsx)(yl,{icon:dO,title:`${wI.get("set")}. Hold shift key to keep menu open.`,toggle:this.toggleSet,isSelected:"set"===this.state.action,disabled:this.isDisabled}),(0,L.jsx)(yl,{icon:jW,title:"Apply Theme to Selection",toggle:this.toggleTheme,isSelected:"theme"===this.state.action,disabled:this.isDisabled,style:{marginLeft:"10px"}}),(0,L.jsx)(yl,{icon:LW,title:"Create Component of Selection with Representation",toggle:this.toggleAddComponent,isSelected:"add-component"===this.state.action,disabled:this.isDisabled}),(0,L.jsx)(kn,{svg:GW,title:"Remove/subtract Selection from all Components",onClick:this.subtract,disabled:this.isDisabled}),(0,L.jsx)(kn,{svg:qW,onClick:this.undo,disabled:!this.state.canUndo||this.isDisabled,title:n}),(0,L.jsx)(yl,{icon:Ng,title:"Show/hide help",toggle:this.toggleHelp,style:{marginLeft:"10px"},isSelected:"help"===this.state.action}),this.plugin.config.get(ei.Viewport.ShowSelectionMode)&&(0,L.jsx)(kn,{svg:UW,title:"Turn selection mode off",onClick:this.turnOff})]}),r]})}}class dTt extends Vr{constructor(){super(...arguments),this.state={isEmpty:!0,isBusy:!1},this.clear=()=>this.plugin.managers.interactivity.lociSelects.deselectAll(),this.focus=()=>{if(0===this.plugin.managers.structure.selection.stats.elementCount)return;const{sphere:t}=this.plugin.managers.structure.selection.getBoundary();this.plugin.managers.camera.focusSphere(t)},this.highlight=t=>{this.plugin.managers.interactivity.lociHighlights.clearHighlights(),this.plugin.managers.structure.selection.entries.forEach(n=>{this.plugin.managers.interactivity.lociHighlights.highlight({loci:n.selection},!1)})},this.clearHighlight=()=>{this.plugin.managers.interactivity.lociHighlights.clearHighlights()}}componentDidMount(){this.subscribe(this.plugin.managers.structure.selection.events.changed,()=>{this.forceUpdate()}),this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,t=>{const n=0===t.structures.length;this.state.isEmpty!==n&&this.setState({isEmpty:n})}),this.subscribe(this.plugin.behaviors.state.isBusy,t=>{this.setState({isBusy:t})})}get isDisabled(){return this.state.isBusy||this.state.isEmpty}get stats(){const t=this.plugin.managers.structure.selection.stats;return 0===t.structureCount||0===t.elementCount?"Nothing Selected":`${b1(t.label)} Selected`}render(){const t=this.plugin.managers.structure.selection.stats,n=0===t.structureCount||0===t.elementCount;return n&&this.props.hideOnEmpty?null:(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)("div",{className:"msp-flex-row",children:[(0,L.jsx)(ir,{noOverflow:!0,onClick:this.focus,title:"Click to Focus Selection",disabled:n,onMouseEnter:this.highlight,onMouseLeave:this.clearHighlight,style:{textAlignLast:n?void 0:"left"},children:this.stats}),!n&&(0,L.jsx)(kn,{svg:UW,onClick:this.clear,title:"Clear",className:"msp-form-control",flex:!0})]})})}}class fTt extends bl{constructor(){super(...arguments),this._params=sy(t=>Bg.getThemeParams(this.plugin,t)),this.state={values:I.getDefaultValues(this.params)},this.apply=()=>{var t,n;this.plugin.managers.structure.component.applyTheme(this.state.values,this.plugin.managers.structure.hierarchy.current.structures),null===(n=(t=this.props).onApply)||void 0===n||n.call(t)},this.paramsChanged=t=>this.setState({values:t})}get params(){return this._params(this.plugin.managers.structure.component.pivotStructure)}render(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(vs,{params:this.params,values:this.state.values,onChangeValues:this.paramsChanged}),(0,L.jsx)(ir,{icon:jW,className:"msp-btn-commit msp-btn-commit-on",onClick:this.apply,style:{marginTop:"1px"},children:"Apply Theme"})]})}}const g2e={idType:I.Select("auth",I.arrayToOptions(["auth","label","atom-id"])),identifiers:I.Text("",{description:"A comma separated list of atom identifiers (e.g. 10, 15-25) or residue ranges in given chain (e.g. A 10-15, B 25, C 30:i)"})},pTt=I.getDefaultValues(g2e);function hTt({modifier:e,plugin:t,close:n}){const[r,i]=Yt.useState(pTt),o=()=>{if(0!==r.identifiers.trim().length)try{n();const s=sTt(r.identifiers,r.idType);t.managers.structure.selection.fromCompiledQuery(e,s,!1)}catch(s){console.error(s),t.log.error("Failed to create selection")}};return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(vs,{params:g2e,values:r,onChangeValues:i,onEnter:o}),(0,L.jsxs)(ir,{className:"msp-btn-commit msp-btn-commit-on",disabled:0===r.identifiers.trim().length,onClick:o,style:{marginTop:"1px"},children:[y1(e)," Selection"]})]})}class mTt extends d2{defaultState(){return{isCollapsed:!1,header:"Measurements",brand:{accent:"gray",svg:J0t}}}renderControls(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(yTt,{}),(0,L.jsx)(gTt,{})]})}}class gTt extends bl{componentDidMount(){this.subscribe(this.plugin.managers.structure.measurement.behaviors.state,()=>{this.forceUpdate()})}renderGroup(t,n){const r=[];for(const i of t)i.obj&&r.push((0,L.jsx)(vTt,{cell:i},i.obj.id));return r.length?(0,L.jsx)(lm,{header:n,initiallyExpanded:!0,children:r}):null}render(){const t=this.plugin.managers.structure.measurement.state;return(0,L.jsxs)("div",{style:{marginTop:"6px"},children:[this.renderGroup(t.labels,"Labels"),this.renderGroup(t.distances,"Distances"),this.renderGroup(t.angles,"Angles"),this.renderGroup(t.dihedrals,"Dihedrals"),this.renderGroup(t.orientations,"Orientations"),this.renderGroup(t.planes,"Planes")]})}}class yTt extends bl{constructor(){super(...arguments),this.state={isBusy:!1,action:void 0},this.measureDistance=()=>{const t=this.plugin.managers.structure.selection.additionsHistory;this.plugin.managers.structure.measurement.addDistance(t[0].loci,t[1].loci)},this.measureAngle=()=>{const t=this.plugin.managers.structure.selection.additionsHistory;this.plugin.managers.structure.measurement.addAngle(t[0].loci,t[1].loci,t[2].loci)},this.measureDihedral=()=>{const t=this.plugin.managers.structure.selection.additionsHistory;this.plugin.managers.structure.measurement.addDihedral(t[0].loci,t[1].loci,t[2].loci,t[3].loci)},this.addLabel=()=>{this.plugin.managers.structure.measurement.addLabel(this.plugin.managers.structure.selection.additionsHistory[0].loci)},this.addOrientation=()=>{const t=[];this.plugin.managers.structure.selection.entries.forEach(n=>{t.push(n.selection)}),this.plugin.managers.structure.measurement.addOrientation(t)},this.addPlane=()=>{const t=[];this.plugin.managers.structure.selection.entries.forEach(n=>{t.push(n.selection)}),this.plugin.managers.structure.measurement.addPlane(t)},this.selectAction=t=>{this.toggleAdd(),t&&(0,t?.value)()},this.toggleAdd=()=>this.setState({action:"add"===this.state.action?void 0:"add"}),this.toggleOptions=()=>this.setState({action:"options"===this.state.action?void 0:"options"})}componentDidMount(){this.subscribe(this.selection.events.additionsHistoryUpdated,()=>{this.forceUpdate(),this.updateOrderLabels()}),this.subscribe(this.plugin.behaviors.state.isBusy,t=>{this.setState({isBusy:t})})}componentWillUnmount(){this.clearOrderLabels(),super.componentWillUnmount()}componentDidUpdate(t,n){this.state.action!==n.action&&this.updateOrderLabels()}clearOrderLabels(){this.plugin.managers.structure.measurement.addOrderLabels([])}updateOrderLabels(){if("add"!==this.state.action)return void this.clearOrderLabels();const t=[],n=this.selection.additionsHistory;for(let r=0;rthis.highlight(t.loci),onMouseLeave:()=>this.plugin.managers.interactivity.lociHighlights.clearHighlights(),children:[(0,L.jsxs)(ir,{noOverflow:!0,title:"Click to focus. Hover to highlight.",onClick:()=>this.focusLoci(t.loci),style:{width:"auto",textAlign:"left"},children:[n,". ",(0,L.jsx)("span",{dangerouslySetInnerHTML:{__html:t.label}})]}),r.length>1&&(0,L.jsx)(kn,{svg:pO,small:!0,className:"msp-form-control",onClick:()=>this.moveHistory(t,"up"),flex:"20px",title:"Move up"}),r.length>1&&(0,L.jsx)(kn,{svg:fO,small:!0,className:"msp-form-control",onClick:()=>this.moveHistory(t,"down"),flex:"20px",title:"Move down"}),(0,L.jsx)(kn,{svg:qp,small:!0,className:"msp-form-control",onClick:()=>this.plugin.managers.structure.selection.modifyHistory(t,"remove"),flex:!0,title:"Remove"})]},t.id)}add(){const t=this.plugin.managers.structure.selection.additionsHistory,n=[];for(let o=0,s=Math.min(t.length,4);o0&&(0,L.jsx)("div",{className:"msp-control-offset",children:n}),0===n.length&&(0,L.jsx)("div",{className:"msp-control-offset msp-help-text",children:(0,L.jsxs)("div",{className:"msp-help-description",children:[(0,L.jsx)(Mi,{svg:Ng,inline:!0}),"Add one or more selections",i]})})]})}render(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"msp-flex-row",children:[(0,L.jsx)(yl,{icon:FA,label:"Add",toggle:this.toggleAdd,isSelected:"add"===this.state.action,disabled:this.state.isBusy,className:"msp-btn-apply-simple"}),(0,L.jsx)(yl,{icon:uv,label:"",title:"Options",toggle:this.toggleOptions,isSelected:"options"===this.state.action,disabled:this.state.isBusy,style:{flex:"0 0 40px",padding:0}})]}),"add"===this.state.action&&this.add(),"options"===this.state.action&&(0,L.jsx)(bTt,{})]})}}class bTt extends bl{constructor(){super(...arguments),this.state={isDisabled:!1},this.changed=t=>{this.plugin.managers.structure.measurement.setOptions(t)}}componentDidMount(){this.subscribe(this.plugin.managers.structure.measurement.behaviors.state,()=>{this.forceUpdate()}),this.subscribe(this.plugin.behaviors.state.isBusy,t=>{this.setState({isDisabled:t})})}render(){return(0,L.jsx)("div",{className:"msp-control-offset",children:(0,L.jsx)(vs,{params:A1e,values:this.plugin.managers.structure.measurement.state.options,onChangeValues:this.changed,isDisabled:this.state.isDisabled})})}}class vTt extends bl{constructor(){super(...arguments),this.state={showUpdate:!1},this.delete=()=>{jt.State.RemoveObject(this.plugin,{state:this.props.cell.parent,ref:this.props.cell.transform.parent,removeParentGhosts:!0})},this.toggleVisibility=t=>{t.preventDefault(),jt.State.ToggleVisibility(this.plugin,{state:this.props.cell.parent,ref:this.props.cell.transform.parent}),t.currentTarget.blur()},this.highlight=()=>{var t;if(!this.selections)return;this.plugin.managers.interactivity.lociHighlights.clearHighlights();for(const i of this.lociArray)this.plugin.managers.interactivity.lociHighlights.highlight({loci:i},!1);const r=null===(t=this.props.cell.obj)||void 0===t?void 0:t.data.repr.getAllLoci();if(r)for(const i of r)this.plugin.managers.interactivity.lociHighlights.highlight({loci:i},!1)},this.clearHighlight=()=>{this.plugin.managers.interactivity.lociHighlights.clearHighlights()},this.toggleUpdate=()=>this.setState({showUpdate:!this.state.showUpdate}),this.focus=()=>{if(!this.selections)return;const n=Yn.getBundleBoundingSphere({loci:this.lociArray});n&&this.plugin.managers.camera.focusSphere(n)},this.selectAction=t=>{t&&(this.setState({showUpdate:!1}),(0,t?.value)())}}componentDidMount(){this.subscribe(this.plugin.state.events.cell.stateUpdated,t=>{this.forceUpdate()})}get selections(){var t;return null===(t=this.props.cell.obj)||void 0===t?void 0:t.data.sourceData}get lociArray(){const t=this.selections;return t?t.infos?[t.infos[0].loci]:t.pairs?t.pairs[0].loci:t.triples?t.triples[0].loci:t.quads?t.quads[0].loci:t.locis?t.locis:[]:[]}get label(){const t=this.selections;return t?t.infos?L_(t.infos[0].loci,{condensed:!0}):t.pairs?aF(t.pairs[0],{condensed:!0,unitLabel:this.plugin.managers.structure.measurement.state.options.distanceUnitLabel}):t.triples?lF(t.triples[0],{condensed:!0}):t.quads?cF(t.quads[0],{condensed:!0}):t.locis?fP(t.locis,{countsOnly:!0}):"":""}get actions(){return[Hn.Item("Select This",()=>this.plugin.managers.structure.selection.fromSelections(this.props.cell.sourceRef),{icon:dO})]}render(){const{cell:t}=this.props,{obj:n}=t;return n?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"msp-flex-row",onMouseEnter:this.highlight,onMouseLeave:this.clearHighlight,children:[(0,L.jsx)("button",{className:"msp-form-control msp-control-button-label msp-no-overflow",title:"Click to focus. Hover to highlight.",onClick:this.focus,style:{width:"auto",textAlign:"left"},children:(0,L.jsx)("span",{dangerouslySetInnerHTML:{__html:this.label}})}),(0,L.jsx)(kn,{svg:t.state.isHidden?c2:u2,toggleState:!1,small:!0,className:"msp-form-control",onClick:this.toggleVisibility,flex:!0,title:t.state.isHidden?"Show":"Hide"}),(0,L.jsx)(kn,{svg:qp,small:!0,className:"msp-form-control",onClick:this.delete,flex:!0,title:"Delete",toggleState:!1}),(0,L.jsx)(kn,{svg:l2,className:"msp-form-control",onClick:this.toggleUpdate,flex:!0,title:"Actions",toggleState:this.state.showUpdate})]},n.id),this.state.showUpdate&&t.parent&&(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)("div",{className:"msp-accent-offset",children:[(0,L.jsx)(Hn,{items:this.actions,onSelect:this.selectAction,noOffset:!0}),(0,L.jsx)(lm,{header:"Options",noOffset:!0,children:(0,L.jsx)(ab,{state:t.parent,transform:t.transform,customHeader:"none",autoHideApply:!0})})]})})]}):null}}function HX(e,t,n,r){const i=rt.indexOf(t.unit.elements,t.element),o=Me(t.structure,[{unit:t.unit,indices:Ve.ofSingleton(i)}]),s="residue"===r?Me.extendToWholeResidues(o):Me.extendToWholeChains(o),a=Je.entity.pdbx_description(t).join(", ");for(const l of n.units){const c=Me(s.structure,[{unit:l,indices:s.elements[0].indices}]);let u=L_(c,{reverse:!0,hidePrefix:!0,htmlStyling:!1,granularity:r});u||(u=L_(c,{hidePrefix:!1,htmlStyling:!1})),n.units.length>1&&(u+=` | ${c.elements[0].unit.conformation.operator.name}`);const d={label:u,category:a,loci:c};e.has(a)?e.get(a).push(d):e.set(a,[d])}}function xTt(e){const t=new Map,n=dt.create(e);for(const i of e.unitSymmetryGroups){if(!ze.isAtomic(i.units[0]))continue;n.unit=i.units[0],n.element=i.elements[0];const o=ze.Traits.is(n.unit.traits,ze.Trait.MultiChain),s=Je.entity.type(n),a="non-polymer"===s,l="branched"===s;if(Je.entity.prd_id(n))HX(t,n,i,"chain");else if(a&&!o)HX(t,n,i,"residue");else if(l||a&&o){const u=n.unit,{index:d}=u.model.atomicHierarchy.residueAtomSegments;let f=-1;for(let p=0,m=u.elements.length;p{1===i.length?r.push({label:`${o}: ${i[0].label}`,loci:i[0].loci}):i.length<2e3&&r.push(...i)}),r}class _Tt extends Vr{constructor(){super(...arguments),this.state={isBusy:!1,showAction:!1},this.getSelectionItems=sy(t=>{var n;const r=[];for(const i of t){const o=null===(n=i.cell.obj)||void 0===n?void 0:n.data;if(o){const s=xTt(o);s.length>0&&r.push([Hn.Header(o.label,{description:o.label}),...Hn.createItems(s,{label:a=>a.label,category:a=>a.category,description:a=>a.label})])}}return r}),this.selectAction=(t,n)=>{if(!t||!this.state.showAction)return void this.setState({showAction:!1});const r=t.value;n?.shiftKey?this.plugin.managers.structure.focus.addFromLoci(r.loci):this.plugin.managers.structure.focus.set(r),this.focusCamera()},this.toggleAction=()=>this.setState({showAction:!this.state.showAction}),this.focusCamera=()=>{const{current:t}=this.plugin.managers.structure.focus;t&&this.plugin.managers.camera.focusLoci(t.loci)},this.clear=()=>{this.plugin.managers.structure.focus.clear(),this.plugin.managers.camera.reset()},this.highlightCurrent=()=>{const{current:t}=this.plugin.managers.structure.focus;t&&this.plugin.managers.interactivity.lociHighlights.highlightOnly({loci:t.loci},!1)},this.clearHighlights=()=>{this.plugin.managers.interactivity.lociHighlights.clearHighlights()}}componentDidMount(){this.subscribe(this.plugin.managers.structure.focus.behaviors.current,t=>{this.getSelectionItems([]),this.forceUpdate()}),this.subscribe(this.plugin.managers.structure.focus.events.historyUpdated,t=>{this.forceUpdate()}),this.subscribe(this.plugin.behaviors.state.isBusy,t=>{this.setState({isBusy:t,showAction:!1})})}get isDisabled(){return this.state.isBusy||0===this.plugin.managers.structure.hierarchy.selection.structures.length}get actionItems(){const t=[],{history:n}=this.plugin.managers.structure.focus;n.length>0&&t.push([Hn.Header("History",{description:"Previously focused on items."}),...Hn.createItems(n,{label:o=>o.label,description:o=>o.category&&o.label!==o.category?`${o.category} | ${o.label}`:o.label})]);const r=this.getSelectionItems(this.plugin.managers.structure.hierarchy.selection.structures);1===r.length&&(r[0][0].initiallyExpanded=!0);const i=[];return r.length>0&&i.push(...r),t.length>0&&i.push(...t),i}getToggleBindingLabel(){var t;const n=this.plugin.state.behaviors.transforms.get(OF.id);if(!n)return"";const r=null===(t=n.params)||void 0===t?void 0:t.bindings.clickFocus;return!r||Ut.isEmpty(r)?"":Ut.formatTriggers(r)}render(){const{current:t}=this.plugin.managers.structure.focus,n=t?.label||"Nothing Focused";let r="Click to Center Camera";if(!t){r="Select focus using the menu";const i=this.getToggleBindingLabel();i&&(r+=`\nor use '${i}' on element`)}return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"msp-flex-row",children:[(0,L.jsx)(ir,{noOverflow:!0,onClick:this.focusCamera,title:r,onMouseEnter:this.highlightCurrent,onMouseLeave:this.clearHighlights,disabled:this.isDisabled||!t,style:{textAlignLast:t?"left":void 0},children:n}),t&&(0,L.jsx)(kn,{svg:UW,onClick:this.clear,title:"Clear",className:"msp-form-control",flex:!0,disabled:this.isDisabled}),(0,L.jsx)(yl,{icon:Syt,title:"Select a focus target to center on an show its surroundings. Hold shift to focus on multiple targets.",toggle:this.toggleAction,isSelected:this.state.showAction,disabled:this.isDisabled,style:{flex:"0 0 40px",padding:0}})]}),this.state.showAction&&(0,L.jsx)(Hn,{items:this.actionItems,onSelect:this.selectAction})]})}}class STt extends d2{constructor(){super(...arguments),this.item=t=>{var n,r,i,o,s,a,l,c,u;const d=this.plugin.managers.structure.hierarchy.seletionSet;let f;switch(t.kind){case"model":{const m=null===(n=t.cell.obj)||void 0===n?void 0:n.data;m&&Sn.TrajectoryInfo.get(m).size>1&&(f=`${null===(r=t.cell.obj)||void 0===r?void 0:r.data.entryId} | Model ${Sn.TrajectoryInfo.get(m).index+1} of ${Sn.TrajectoryInfo.get(m).size}`),f=`${null===(i=t.cell.obj)||void 0===i?void 0:i.data.entryId} | ${null===(o=t.cell.obj)||void 0===o?void 0:o.label}`;break}case"structure":{const m=null===(s=t.cell.obj)||void 0===s?void 0:s.data.models[0];if(m&&Sn.TrajectoryInfo.get(m).size>1){f=`${m.entryId} | ${null===(a=t.cell.obj)||void 0===a?void 0:a.label} (Model ${Sn.TrajectoryInfo.get(m).index+1} of ${Sn.TrajectoryInfo.get(m).size})`;break}if(m){f=`${m.entryId} | ${null===(l=t.cell.obj)||void 0===l?void 0:l.label}`;break}f=`${null===(c=t.cell.obj)||void 0===c?void 0:c.label}`;break}default:f=null===(u=t.cell.obj)||void 0===u?void 0:u.label}return{kind:"item",label:f||t.kind,selected:d.has(t.cell.transform.ref),value:[t]}},this.getTrajectoryItems=t=>{var n;return 0===t.models.length?this.item(t):[Hn.Header(null===(n=t.cell.obj)||void 0===n?void 0:n.label),...t.models.map(this.getModelItems)]},this.getModelItems=t=>{var n,r,i;if(0===t.structures.length)return this.item(t);if(1===t.structures.length){const s=t.structures[0];return{label:`${null===(n=t.cell.obj)||void 0===n?void 0:n.label} | ${null===(r=s.cell.obj)||void 0===r?void 0:r.label}`,selected:this.plugin.managers.structure.hierarchy.seletionSet.has(s.cell.transform.ref),value:[t,s]}}return[Hn.Header(null===(i=t.cell.obj)||void 0===i?void 0:i.label),...t.structures.map(this.item)]},this.selectHierarchy=t=>{if(!t||0===t.length)return;const n=[];for(const r of t)for(const i of r.value)n.push(i);this.plugin.managers.structure.hierarchy.updateCurrent(n,t[0].selected?"remove":"add")},this.toggleHierarchy=()=>this.setState({show:"hierarchy"!==this.state.show?"hierarchy":void 0}),this.togglePreset=()=>this.setState({show:"presets"!==this.state.show?"presets":void 0}),this.applyPreset=t=>{if(this.setState({show:void 0}),!t)return;const n=this.plugin.managers.structure,{trajectories:r}=n.hierarchy.selection;n.hierarchy.applyPreset(r,t.value)},this.updateModelQueueParams=void 0,this.isUpdatingModel=!1,this.updateStructureModel=t=>{this.updateModelQueueParams=t,this._updateStructureModel()},this.updateStructure=t=>{const{selection:n}=this.plugin.managers.structure.hierarchy;return this.plugin.managers.structure.hierarchy.updateStructure(n.structures[0],t)}}defaultState(){return{header:"Structure",isCollapsed:!1,isBusy:!1,brand:{accent:"purple",svg:V0t}}}componentDidMount(){this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,()=>this.forceUpdate()),this.subscribe(this.plugin.behaviors.state.isBusy,t=>{this.setState({isBusy:t})})}get hierarchyItems(){const t=this.plugin.managers.structure.hierarchy,{current:n}=t,r=[];return n.trajectories.length>1&&r.push([Hn.Header("Trajectories"),...n.trajectories.map(this.item)]),(n.models.length>1||n.trajectories.length>1)&&r.push([Hn.Header("Models"),...n.models.map(this.item)]),1===n.trajectories.length&&1===n.models.length?r.push(...n.structures.map(this.item)):n.structures.length>0&&r.push([Hn.Header("Structures"),...n.structures.map(this.item)]),r}get isEmpty(){const{structures:t,models:n,trajectories:r}=this.plugin.managers.structure.hierarchy.current;return 0===r.length&&0===n.length&&0===t.length}get label(){var t,n,r,i,o,s,a,l,c,u,d,f,p,m;const{structures:h,models:g,trajectories:y}=this.plugin.managers.structure.hierarchy.selection;if(1===h.length){const v=h[0];return null!==(n=null===(t=v.model)||void 0===t?void 0:t.trajectory)&&void 0!==n&&n.models&&1===v.model.trajectory.models.length?null===(r=v.cell.obj)||void 0===r?void 0:r.data.label:v.model?`${null===(i=v.model.cell.obj)||void 0===i?void 0:i.label} | ${null===(o=v.cell.obj)||void 0===o?void 0:o.data.label}`:null===(s=v.cell.obj)||void 0===s?void 0:s.data.label}if(h.length>1){const v=h[0],x=null===(a=v?.model)||void 0===a?void 0:a.trajectory;let _=!0;for(const w of h)if((null===(l=w?.model)||void 0===l?void 0:l.trajectory)!==x){_=!1;break}return _&&x?`${null===(c=x.cell.obj)||void 0===c?void 0:c.label} | ${h.length} structures`:`${h.length} structures`}if(g.length>0){const v=g[0].trajectory;if(1===g.length){const _=null===(u=g[0].cell.obj)||void 0===u?void 0:u.data;return _&&Sn.TrajectoryInfo.get(_).size>1?`${null===(d=v?.cell.obj)||void 0===d?void 0:d.label} | Model ${Sn.TrajectoryInfo.get(_).index+1} of ${Sn.TrajectoryInfo.get(_).size}`:`${null===(f=v?.cell.obj)||void 0===f?void 0:f.label} | Model`}let x=!0;for(const _ of g)if(_.trajectory!==v){x=!1;break}return x?`${null===(p=v?.cell.obj)||void 0===p?void 0:p.label} | ${g.length} models`:`${g.length} models`}return y.length>0?1===y.length?`${null===(m=y[0].cell.obj)||void 0===m?void 0:m.label} trajectory`:`${y.length} trajectories`:0===y.length&&0===g.length&&0===h.length?"Nothing Loaded":"Nothing Selected"}get presetActions(){const t=[],{trajectories:n}=this.plugin.managers.structure.hierarchy.selection;if(0===n.length)return t;let r=this.plugin.builders.structure.hierarchy.getPresets(n[0].cell.obj);if(n.length>1){const i=new Set(r);for(let o=1;oi.has(o))}for(const i of r)t.push(Hn.Item(i.display.name,i,{description:i.display.description}));return t}_updateStructureModel(){var t=this;return le(function*(){if(!t.updateModelQueueParams||t.isUpdatingModel)return;const n=t.updateModelQueueParams;t.updateModelQueueParams=void 0;try{t.isUpdatingModel=!0;const{selection:r}=t.plugin.managers.structure.hierarchy,i=r.structures[0].model;yield t.plugin.state.updateTransform(t.plugin.state.data,i.cell.transform.ref,n,"Model Index")}finally{t.isUpdatingModel=!1,t._updateStructureModel()}})()}get modelIndex(){var t,n;const{selection:r}=this.plugin.managers.structure.hierarchy;if(1!==r.structures.length)return null;const i=r.structures[0].model;if(!i||i.cell.transform.transformer!==at.Model.ModelFromTrajectory||!i.cell.obj||Sn.TrajectoryInfo.get(i.cell.obj.data).size<=1)return null;const o=null===(t=i.cell.params)||void 0===t?void 0:t.definition;return o?(0,L.jsx)(vs,{params:o,values:null===(n=i.cell.params)||void 0===n?void 0:n.values,onChangeValues:this.updateStructureModel,isDisabled:this.state.isBusy}):null}get structureType(){var t;const{selection:n}=this.plugin.managers.structure.hierarchy;if(1!==n.structures.length)return null;const r=n.structures[0];return(null===(t=r.cell.params)||void 0===t?void 0:t.definition)&&r.cell.parent?(0,L.jsx)(ab,{state:r.cell.parent,transform:r.cell.transform,customHeader:"none",customUpdate:this.updateStructure,noMargin:!0,autoHideApply:!0}):null}get transform(){const{selection:t}=this.plugin.managers.structure.hierarchy;if(1!==t.structures.length)return null;const n=t.structures[0];if(!n.cell.parent)return null;const r=Qn.tryFindDecorator(this.plugin.state.data,n.cell.transform.ref,at.Model.TransformStructureConformation);return r?(0,L.jsx)(lm,{header:"Conformation Transform",children:(0,L.jsx)(ab,{state:r.parent,transform:r.transform,customHeader:"none",noMargin:!0,autoHideApply:!0})}):void 0}renderControls(){const t=this.state.isBusy||this.isEmpty,n=this.presetActions,r=this.label;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"msp-flex-row",style:{marginTop:"1px"},children:[(0,L.jsx)(ir,{noOverflow:!0,flex:!0,onClick:this.toggleHierarchy,disabled:t,title:r,children:r}),n.length>0&&(0,L.jsx)(kn,{svg:OA,className:"msp-form-control",flex:"40px",onClick:this.togglePreset,title:"Apply a structure presets to the current hierarchy.",toggleState:"presets"===this.state.show,disabled:t})]}),"hierarchy"===this.state.show&&(0,L.jsx)(Hn,{items:this.hierarchyItems,onSelect:this.selectHierarchy,multiselect:!0}),"presets"===this.state.show&&(0,L.jsx)(Hn,{items:n,onSelect:this.applyPreset}),this.modelIndex,this.structureType,this.transform,(0,L.jsxs)("div",{style:{marginTop:"6px"},children:[(0,L.jsx)(_Tt,{}),(0,L.jsx)(dTt,{hideOnEmpty:!0})]})]})}}class GX extends p2e{constructor(){super(...arguments),this._getInfo=sy((t,n,r)=>F2.infoFromAction(this.plugin,this.props.state,this.props.action,this.props.nodeRef)),this.state={plugin:this.plugin,ref:this.props.nodeRef,version:this.props.state.transforms.get(this.props.nodeRef).version,error:void 0,isInitial:!0,params:this.getInfo().initialValues,busy:!1,isCollapsed:this.props.initiallyCollapsed}}applyAction(){return jt.State.ApplyAction(this.plugin,{state:this.props.state,action:this.props.action.create(this.state.params),ref:this.props.nodeRef})}getInfo(){var t;return this._getInfo(this.props.nodeRef,this.props.state.transforms.get(this.props.nodeRef).version,null===(t=this.state)||void 0===t?void 0:t.isCollapsed)}getTransformerId(){return this.props.state.transforms.get(this.props.nodeRef).transformer.id}getHeader(){return this.props.hideHeader?"none":this.props.action.definition.display}canApply(){return!this.state.error&&!this.state.busy}canAutoApply(){return!1}applyText(){return"Apply"}isUpdate(){return!1}getSourceAndTarget(){return{a:this.props.state.cells.get(this.props.nodeRef).obj}}static getDerivedStateFromProps(t,n){const r=t.state.transforms.get(t.nodeRef).version;if(t.nodeRef===n.ref&&r===n.version)return null;const i=t.state.cells.get(t.nodeRef).obj,o=t.action.definition.params?I.getDefaultValues(t.action.definition.params(i,n.plugin)):{};return{plugin:n.plugin,ref:t.nodeRef,version:r,params:o,isInitial:!0,error:void 0}}}class CTt extends d2{defaultState(){return{header:"Volume Streaming",isCollapsed:!1,isBusy:!1,isHidden:!0,brand:{accent:"cyan",svg:Ebe}}}componentDidMount(){this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,()=>{this.setState({isHidden:!this.canEnable(),description:m2.getSelectedStructuresDescription(this.plugin)})}),this.subscribe(this.plugin.state.events.cell.stateUpdated,t=>{vr.hasTag(t.cell.transform,fu.RootTag)&&this.forceUpdate()}),this.subscribe(this.plugin.behaviors.state.isBusy,t=>{this.setState({isBusy:t})})}get pivot(){return this.plugin.managers.structure.hierarchy.selection.structures[0]}canEnable(){var t,n;const{selection:r}=this.plugin.managers.structure.hierarchy;if(1!==r.structures.length)return!1;const i=this.pivot.cell;return!!i.obj&&!(null===(n=(t=pq.definition).isApplicable)||void 0===n||!n.call(t,i.obj,i.transform,this.plugin))}renderEnable(){var t,n;const r=this.pivot;if(!r.cell.parent)return null;const i=Qn.findTagInSubtree(r.cell.parent.tree,this.pivot.cell.transform.ref,fu.RootTag),o=i&&r.cell.parent.cells.get(i),s=o&&"error"===o.status?{header:o.errorText&&null!==(t=o.errorText)&&void 0!==t&&t.includes("404")?"No Density Data Available":"Error Enabling",icon:Pbe,title:o.errorText}:o&&0===(null===(n=o.obj)||void 0===n?void 0:n.data.entries.length)?{header:"Error Enabling",icon:Pbe,title:"No Entry for Streaming Found"}:{header:"Enable",icon:a2,title:"Enable"};return(0,L.jsx)(GX,{state:r.cell.parent,action:pq,initiallyCollapsed:!0,nodeRef:r.cell.transform.ref,simpleApply:s})}renderParams(){var t,n,r,i,o;const s=this.pivot;if(!s.cell.parent)return null;const a="selection-box"===(null===(n=null===(t=s.volumeStreaming)||void 0===t?void 0:t.cell.transform.params)||void 0===n?void 0:n.entry.params.view.name)&&(null===(o=null===(i=null===(r=this.plugin.state.behaviors.cells.get(OF.id))||void 0===r?void 0:r.params)||void 0===i?void 0:i.values)||void 0===o?void 0:o.bindings);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(ab,{state:s.cell.parent,transform:s.volumeStreaming.cell.transform,customHeader:"none",noMargin:!0}),a&&(0,L.jsx)(lm,{header:"Controls Help",children:(0,L.jsx)(jX,{bindings:a})})]})}renderControls(){const t=this.pivot;return t?t.volumeStreaming?this.renderParams():this.renderEnable():null}}class wTt extends d2{constructor(){super(...arguments),this.item=t=>{var n;const i=(null===(n=t.cell.obj)||void 0===n?void 0:n.label)||"Volume";return{kind:"item",label:("lazy-volume"===t.kind?"Load ":"")+(i||t.kind),selected:this.plugin.managers.volume.hierarchy.selection===t,value:t}},this.selectCurrent=t=>{if(this.toggleHierarchy(),!t)return;const n=t.value;"volume"===n.kind?this.plugin.managers.volume.hierarchy.setCurrent(n):this.lazyLoad(n.cell)},this.selectAdd=t=>{t&&(this.setState({show:void 0}),t.value())},this.toggleHierarchy=()=>this.setState({show:"hierarchy"!==this.state.show?"hierarchy":void 0}),this.toggleAddRepr=()=>this.setState({show:"add-repr"!==this.state.show?"add-repr":void 0})}defaultState(){return{header:"Volume",isCollapsed:!1,isBusy:!1,isHidden:!0,brand:{accent:"purple",svg:Ebe}}}componentDidMount(){this.subscribe(this.plugin.managers.volume.hierarchy.behaviors.selection,t=>{this.setState({isHidden:0===t.hierarchy.volumes.length&&0===t.hierarchy.lazyVolumes.length})}),this.subscribe(this.plugin.behaviors.state.isBusy,t=>{this.setState({isBusy:t})})}get hierarchyItems(){const t=this.plugin.managers.volume.hierarchy,{current:n}=t,r=[];for(const i of n.volumes)r.push(this.item(i));for(const i of n.lazyVolumes)r.push(this.item(i));return r}get addActions(){const t=this.plugin.managers.volume.hierarchy,n=t.selection;return[...CO.getRepresentationTypes(this.plugin,n).map(i=>Hn.Item(i[1],()=>t.addRepresentation(n,i[0])))]}get isEmpty(){const{volumes:t,lazyVolumes:n}=this.plugin.managers.volume.hierarchy.current;return 0===t.length&&0===n.length}get label(){var t;if(this.state.loadingLabel)return`Loading ${this.state.loadingLabel}...`;const n=this.plugin.managers.volume.hierarchy.selection;return n?(null===(t=n?.cell.obj)||void 0===t?void 0:t.label)||"Volume":"Nothing Selected"}lazyLoad(t){var n=this;return le(function*(){const{url:r,isBinary:i,format:o,entryId:s,isovalues:a}=t.obj.data;n.setState({isBusy:!0,loadingLabel:t.obj.label});try{const l=n.plugin;yield l.dataTransaction(le(function*(){var c,u,d,f;const p=yield l.builders.data.download({url:r,isBinary:i},{state:{isGhost:!0}}),m=yield l.dataFormats.get(o).parse(l,p,{entryId:s}),h=m.volume||m.volumes[0];if(!h?.isOk)throw new Error("Failed to parse any volume.");const g=l.build();for(const y of a)g.to(null!==(d=null===(c=m.volumes)||void 0===c?void 0:c[null!==(u=y.volumeIndex)&&void 0!==u?u:0])&&void 0!==d?d:m.volume).apply(at.Representation.VolumeRepresentation3D,UA(n.plugin,h.data,{type:"isosurface",typeParams:{alpha:null!==(f=y.alpha)&&void 0!==f?f:1,isoValue:"absolute"===y.type?{kind:"absolute",absoluteValue:y.value}:{kind:"relative",relativeValue:y.value}},color:"uniform",colorParams:{value:y.color}}));yield g.commit(),yield l.build().delete(t).commit()}))}finally{n.setState({isBusy:!1,loadingLabel:void 0})}})()}renderControls(){const t=this.state.isBusy||this.isEmpty,n=this.label,r=this.plugin.managers.volume.hierarchy.selection;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"msp-flex-row",style:{marginTop:"1px"},children:[(0,L.jsx)(ir,{noOverflow:!0,flex:!0,onClick:this.toggleHierarchy,disabled:t,title:n,children:n}),!this.isEmpty&&r&&(0,L.jsx)(kn,{svg:FA,onClick:this.toggleAddRepr,title:"Apply a structure presets to the current hierarchy.",toggleState:"add-repr"===this.state.show,disabled:t})]}),"hierarchy"===this.state.show&&(0,L.jsx)(Hn,{items:this.hierarchyItems,onSelect:this.selectCurrent}),"add-repr"===this.state.show&&(0,L.jsx)(Hn,{items:this.addActions,onSelect:this.selectAdd}),r&&r.representations.length>0&&(0,L.jsx)("div",{style:{marginTop:"6px"},children:r.representations.map(i=>(0,L.jsx)(ATt,{representation:i},i.cell.transform.ref))})]})}}class ATt extends bl{constructor(){super(...arguments),this.state={action:void 0},this.remove=()=>this.plugin.managers.volume.hierarchy.remove([this.props.representation],!0),this.toggleVisible=t=>{t.preventDefault(),t.currentTarget.blur(),this.plugin.managers.volume.hierarchy.toggleVisibility([this.props.representation])},this.toggleColor=()=>{this.setState({action:"select-color"===this.state.action?void 0:"select-color"})},this.toggleUpdate=()=>this.setState({action:"update"===this.state.action?void 0:"update"}),this.highlight=t=>{t.preventDefault(),this.props.representation.cell.parent&&jt.Interactivity.Object.Highlight(this.plugin,{state:this.props.representation.cell.parent,ref:this.props.representation.cell.transform.ref})},this.clearHighlight=t=>{t.preventDefault(),jt.Interactivity.ClearHighlights(this.plugin)},this.focus=()=>{var t;const n=this.props.representation,r=null===(t=n.cell.obj)||void 0===t?void 0:t.data.repr.getAllLoci();n.cell.state.isHidden&&this.plugin.managers.volume.hierarchy.toggleVisibility([this.props.representation],"show"),r&&this.plugin.managers.camera.focusLoci(r,{extraRadius:1})},this.updateColor=({value:t})=>{const n=this.props.representation.cell.transform;return this.plugin.build().to(n.ref).update({...n.params,colorTheme:{name:"uniform",params:{value:t}}}).commit()}}componentDidMount(){this.subscribe(this.plugin.state.events.cell.stateUpdated,t=>{L1.ObjectEvent.isCell(t,this.props.representation.cell)&&this.forceUpdate()})}get color(){var t,n;const r=this.props.representation.cell;if("uniform"===(null===(t=r.transform.params)||void 0===t?void 0:t.colorTheme.name))return null===(n=r.transform.params)||void 0===n?void 0:n.colorTheme.params.value}render(){var t,n,r;const i=this.props.representation.cell,o=this.color;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"msp-flex-row",children:[void 0!==o&&(0,L.jsx)(ir,{style:{backgroundColor:st.toStyle(o),minWidth:32,width:32},onClick:this.toggleColor}),(0,L.jsxs)(ir,{noOverflow:!0,className:"msp-control-button-label",title:`${null===(t=i.obj)||void 0===t?void 0:t.label}. Click to focus.`,onClick:this.focus,onMouseEnter:this.highlight,onMouseLeave:this.clearHighlight,style:{textAlign:"left"},children:[null===(n=i.obj)||void 0===n?void 0:n.label,(0,L.jsx)("small",{className:"msp-25-lower-contrast-text",style:{float:"right"},children:null===(r=i.obj)||void 0===r?void 0:r.description})]}),(0,L.jsx)(kn,{svg:i.state.isHidden?c2:u2,toggleState:!1,onClick:this.toggleVisible,title:(i.state.isHidden?"Show":"Hide")+" component",small:!0,className:"msp-form-control",flex:!0}),(0,L.jsx)(kn,{svg:qp,onClick:this.remove,title:"Remove",small:!0}),(0,L.jsx)(kn,{svg:l2,onClick:this.toggleUpdate,title:"Actions",toggleState:"update"===this.state.action})]}),"update"===this.state.action&&!!i.parent&&(0,L.jsx)("div",{style:{marginBottom:"6px"},className:"msp-accent-offset",children:(0,L.jsx)(ab,{state:i.parent,transform:i.transform,customHeader:"none",noMargin:!0})}),"select-color"===this.state.action&&void 0!==o&&(0,L.jsx)("div",{style:{marginBottom:"6px",marginTop:1},className:"msp-accent-offset",children:(0,L.jsx)(Fg,{header:"Select Color",initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.toggleColor,topRightIcon:Rg,noTopMargin:!0,childrenClassName:"msp-viewport-controls-panel-controls",children:(0,L.jsx)(Ube,{param:ITt,value:this.color,onChange:this.updateColor,name:"color",hideNameRow:!0})})})]})}}const ITt=I.Color(st(1184274));var xB,lb;function y2e(e,t){if(Math.abs(e)>Math.abs(t)){const n=t/e;return Math.abs(e)*Math.sqrt(1+n*n)}if(0!==t){const n=e/t;return Math.abs(t)*Math.sqrt(1+n*n)}return 0}!function(e){e.createCache=function t(r){return{size:r,matrix:Zr.create(r,r),eigenValues:new Float64Array(r),D:new Float64Array(r),E:new Float64Array(r)}},e.compute=function n(r){!function ETt(e,t,n,r,i){for(let s=0;s0;i--){let o=0,s=0;for(let a=0;a0&&(l=-l),n[i]=o*l,s-=a*l,t[i-1]=a-l;for(let u=0;ul){let u=0;do{u+=1;let d=t[l],f=(t[l+1]-d)/(2*n[l]),p=y2e(f,1);f<0&&(p=-p),t[l]=n[l]/(f+p),t[l+1]=n[l]*(f+p);const m=t[l+1];let h=d-t[l];for(let A=l+2;A=l;A--){v=y,y=g,w=_,d=g*n[A],h=g*f,p=y2e(f,n[A]),n[A+1]=_*p,_=n[A]/p,g=f/p,f=g*t[A]-_*d,t[A+1]=h+_*(g*d+_*t[A]);for(let M=0;M=1e3)throw new Error("SVD: Not converging.")}while(Math.abs(n[l])>a*s)}t[l]=t[l]+o,n[l]=0}for(let l=0;l"u"&&(i={bTransform:fe.zero(),rmsd:0}),function RTt(e){const t=function kTt(e){const t=e.evdCache.matrix;Zr.makeZero(t);const n=e.a.x,r=e.a.y,i=e.a.z,o=e.b.x,s=e.b.y,a=e.b.z,l=e.centerA,c=e.centerB;let u=0;for(let d=0,f=e.a.x.length;d{n=0;const s={};o.forEach(a=>s[e[n++]]=a),i[e[r++]]=s}),i}const LTt={blosum62:b2e("ARNDCQEGHILKMFPSTWYVBZX",[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1]]),blosum62x:b2e("ACDEFGHIKLMNPQRSTVWY",[[4,0,-2,-1,-2,0,-2,-1,-1,-1,-1,-2,-1,-1,-1,1,0,0,-3,-2],[0,9,-3,-4,-2,-3,-3,-1,-3,-1,-1,-3,-3,-3,-3,-1,-1,-1,-2,-2],[-2,-3,6,2,-3,-1,-1,-3,-1,-4,-3,1,-1,0,-2,0,-1,-3,-4,-3],[-1,-4,2,5,-3,-2,0,-3,1,-3,-2,0,-1,2,0,0,-1,-2,-3,-2],[-2,-2,-3,-3,6,-3,-1,0,-3,0,0,-3,-4,-3,-3,-2,-2,-1,1,3],[0,-3,-1,-2,-3,6,-2,-4,-2,-4,-3,0,-2,-2,-2,0,-2,-3,-2,-3],[-2,-3,-1,0,-1,-2,8,-3,-1,-3,-2,1,-2,0,0,-1,-2,-3,-2,2],[-1,-1,-3,-3,0,-4,-3,4,-3,2,1,-3,-3,-3,-3,-2,-1,3,-3,-1],[-1,-3,-1,1,-3,-2,-1,-3,5,-2,-1,0,-1,1,2,0,-1,-2,-3,-2],[-1,-1,-4,-3,0,-4,-3,2,-2,4,2,-3,-3,-2,-2,-2,-1,1,-2,-1],[-1,-1,-3,-2,0,-3,-2,1,-1,2,5,-2,-2,0,-1,-1,-1,1,-1,-1],[-2,-3,1,0,-3,0,1,-3,0,-3,-2,6,-2,0,0,1,0,-3,-4,-2],[-1,-3,-1,-1,-4,-2,-2,-3,-1,-3,-2,-2,7,-1,-2,-1,-1,-2,-4,-3],[-1,-3,0,2,-3,-2,0,-3,1,-2,0,0,-1,5,1,0,-1,-2,-2,-1],[-1,-3,-2,0,-3,-2,0,-3,2,-2,-1,0,-2,1,5,-1,-1,-3,-3,-2],[1,-1,0,0,-2,0,-1,-2,0,-2,-1,1,-1,0,-1,4,1,-2,-3,-2],[0,-1,-1,-1,-2,-2,-2,-1,-1,-1,-1,0,-1,-1,-1,1,5,0,-2,-2],[0,-1,-3,-2,-1,-3,-3,3,-2,1,1,-3,-2,-2,-3,-2,0,4,-3,-1],[-3,-2,-4,-3,1,-2,-2,-3,-3,-2,-1,-4,-4,-2,-3,-3,-2,-3,11,2],[-2,-2,-3,-2,3,-3,2,-1,-2,-1,-1,-2,-3,-1,-2,-2,-2,-1,2,7]])},jTt={gapPenalty:-11,gapExtensionPenalty:-1,substMatrix:"default"};class zTt{constructor(t,n,r){this.seqA=t,this.seqB=n,this.S=[],this.V=[],this.H=[],this.gapPenalty=r.gapPenalty,this.gapExtensionPenalty=r.gapExtensionPenalty,this.substMatrix="default"===r.substMatrix?void 0:LTt[r.substMatrix],this.n=this.seqA.length,this.m=this.seqB.length}initMatrices(){const{n:t,m:n,gapPenalty:r,S:i,V:o,H:s}=this;for(let a=0;a<=t;++a){i[a]=[],o[a]=[],s[a]=[];for(let l=0;l<=n;++l)i[a][l]=0,o[a][l]=0,s[a][l]=0}for(let a=0;a<=t;++a)i[a][0]=r,s[a][0]=-1/0;for(let a=0;a<=n;++a)i[0][a]=r,o[0][a]=-1/0;i[0][0]=0}makeScoreFn(){const{seqA:t,seqB:n,substMatrix:r}=this;return r?function(o,s){var a,l;return null!==(l=null===(a=r[t[o]])||void 0===a?void 0:a[n[s]])&&void 0!==l?l:-4}:function(o,s){return t[o]===n[s]?5:-3}}calculate(){this.initMatrices();const t=this.makeScoreFn(),{V:n,H:r,S:i,n:o,m:s,gapExtensionPenalty:a,gapPenalty:l}=this;let c,u,d,f,p;for(let m=1;m<=o;++m){u=i[m-1],c=n[m-1],d=n[m],f=r[m],p=i[m];for(let h=1;h<=s;++h)d[h]=Math.max(u[h]+l,c[h]+a),f[h]=Math.max(p[h-1]+l,f[h-1]+a),p[h]=Math.max(u[h-1]+t(m-1,h-1),d[h],f[h])}}trace(){const t=this.makeScoreFn(),{V:n,H:r,S:i,seqA:o,seqB:s,gapExtensionPenalty:a,gapPenalty:l}=this;let d,f,c=this.n,u=this.m,p="",m="";for(i[c][u]>=n[c][u]?(d="S",f=i[c][u]):n[c][u]>=r[c][u]?(d="V",f=n[c][u]):(d="H",f=r[c][u]);c>0&&u>0;)"S"===d?i[c][u]===i[c-1][u-1]+t(c-1,u-1)?(p=o[c-1]+p,m=s[u-1]+m,--c,--u,d="S"):i[c][u]===n[c][u]?d="V":i[c][u]===r[c][u]?d="H":(--c,--u):"V"===d?n[c][u]===n[c-1][u]+a?(p=o[c-1]+p,m="-"+m,--c,d="V"):n[c][u]===i[c-1][u]+l?(p=o[c-1]+p,m="-"+m,--c,d="S"):--c:"H"===d&&(r[c][u]===r[c][u-1]+a?(p="-"+p,m=s[u-1]+m,--u,d="H"):r[c][u]===i[c][u-1]+l?(p="-"+p,m=s[u-1]+m,--u,d="S"):--u);for(;c>0;)p=o[c-1]+p,m="-"+m,--c;for(;u>0;)p="-"+p,m=s[u-1]+m,--u;return{aliA:p,aliB:m,score:f}}}var qX;function v2e(e){return e.model.sequence.byEntityKey[function VTt(e){switch(e.kind){case 0:return e.model.atomicHierarchy.index.getEntityFromChain(e.chainIndex[e.elements[0]]);case 1:return e.model.coarseHierarchy.spheres.entityKey[e.elements[0]];case 2:return e.model.coarseHierarchy.gaussians.entityKey[e.elements[0]]}}(e)].sequence}function x2e(e){const t=[];if(e.length<=0)return t;const n=function qTt(e){if(0===e.length)return 0;let t=Me.size(e[0]);for(let n=1;n=t)break}if(r>=t)break}return n}function $Tt(e,t,n,r){const i=lb.Positions.empty(r),o=lb.Positions.empty(r);let s=0;for(const{pivots:a}of e){const l=a[t],c=a[n];if(!l||!c)continue;const u=Math.min(l[2]-l[1],c[2]-c[1]);for(let d=0;d=0?x:_,!i(o,v,_,w))continue;const A=`${u[v]}-${d[v]}-${f[v]}`;if(t.has(A)){const M=t.get(A);M.pivots[n]||(M.pivots[n]=[s,_,w])}else t.set(A,{key:A,pivots:{[n]:[s,_,w]}})}}}}class ZTt extends d2{defaultState(){return{isCollapsed:!1,header:"Superposition",brand:{accent:"gray",svg:Abt},isHidden:!0}}componentDidMount(){this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,t=>{this.setState({isHidden:t.structures.length<2})})}renderControls(){return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(e3t,{})})}}const _2e={alignSequences:I.Boolean(!0,{isEssential:!0,description:"For Chain-based 3D superposition, perform a sequence alignment and use the aligned residue pairs to guide the 3D superposition."}),traceOnly:I.Boolean(!0,{description:"For Chain- and Uniprot-based 3D superposition, base superposition only on CA (and equivalent) atoms."})},QTt=I.getDefaultValues(_2e);class e3t extends bl{constructor(){var t;super(...arguments),t=this,this.state={isBusy:!1,canUseDb:!1,action:void 0,options:QTt},this.superposeChains=le(function*(){var n,r,i;const{query:o}=t.state.options.traceOnly?Ps.trace:Ps.polymer,s=t.chainEntries,a=s.map(f=>{const p=Me.toStructure(f.loci),m=Dt.toLociWithSourceUnits(o(new _f(p)));return Me.remap(m,t.getRootStructure(f.loci.structure))}),l=t.plugin.managers.structure.hierarchy.findStructure(null===(n=a[0])||void 0===n?void 0:n.structure),c=null===(i=null===(r=l?.transform)||void 0===r?void 0:r.cell.obj)||void 0===i?void 0:i.data.coordinateSystem,u=t.state.options.alignSequences?function GTt(e){const t=[];if(e.length<=0)return t;const n=Me.getFirstLocation(e[0]),i=Je.entity.subtype(n).match(HTt)?"blosum62":"default";for(let o=1;oMe.remap(d.loci,t.getRootStructure(d.loci.structure))),a=x2e(s),l=t.plugin.managers.structure.hierarchy.findStructure(null===(n=s[0])||void 0===n?void 0:n.structure),c=null===(i=null===(r=l?.transform)||void 0===r?void 0:r.cell.obj)||void 0===i?void 0:i.data.coordinateSystem,u=o[0];for(let d=1,f=s.length;d{var h;return null===(h=m.cell.obj)||void 0===h?void 0:h.data}),{entries:l,failedPairs:c,zeroOverlapPairs:u}=function WTt(e,t){var n,r;const i=new Map;for(let u=0;u`[${m.map(([h,g])=>`(${a[h].models[0].entryId}, ${a[g].models[0].entryId})`).join(", ")}]`;u.length&&t.plugin.log.warn(`Superposition: No UNIPROT mapping overlap between structures ${p(u)}.`),c.length&&t.plugin.log.error(`Superposition: Failed to superpose structures ${p(c)}.`),l.length&&(t.plugin.log.info(`Superposed ${l.length+1} structures with avg. RMSD ${f.toFixed(2)} \xc5.`),yield t.cameraReset())}),this.toggleByChains=()=>this.setState({action:"byChains"===this.state.action?void 0:"byChains"}),this.toggleByAtoms=()=>this.setState({action:"byAtoms"===this.state.action?void 0:"byAtoms"}),this.toggleOptions=()=>this.setState({action:"options"===this.state.action?void 0:"options"}),this.setOptions=n=>{this.setState({options:n})}}componentDidMount(){this.subscribe(this.selection.events.changed,()=>{this.forceUpdate()}),this.subscribe(this.selection.events.additionsHistoryUpdated,()=>{this.forceUpdate()}),this.subscribe(this.plugin.behaviors.state.isBusy,t=>{this.setState({isBusy:t})}),this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,t=>{this.setState({canUseDb:t.structures.every(n=>{var r;return!(null===(r=n.cell.obj)||void 0===r||!r.data)&&n.cell.obj.data.models.some(i=>yp.Provider.isApplicable(i))})})})}get selection(){return this.plugin.managers.structure.selection}transform(t,n,r){var i=this;return le(function*(){const o=_a.resolveAndCheck(i.plugin.state.data,t);if(!o)return;const s=i.plugin.state.data.selectQ(u=>u.byRef(o.transform.ref).subtree().withTransformer(at.Model.TransformStructureConformation))[0],l={transform:{name:"matrix",params:{data:r&&!fe.isIdentity(r.matrix)?fe.mul(fe(),r.matrix,n):n,transpose:!1}}},c=s?i.plugin.state.data.build().to(s).update(l):i.plugin.state.data.build().to(t).insert(at.Model.TransformStructureConformation,l,{tags:"SuperpositionTransform"});yield i.plugin.runTask(i.plugin.state.data.updateTree(c))})()}getRootStructure(t){var n;const r=this.plugin.helpers.substructureParent.get(t);return null===(n=this.plugin.state.data.selectQ(i=>i.byValue(r).rootOfType(Se.Molecule.Structure))[0].obj)||void 0===n?void 0:n.data}cameraReset(){var t=this;return le(function*(){yield new Promise(n=>requestAnimationFrame(n)),jt.Camera.Reset(t.plugin)})()}highlight(t){this.plugin.managers.interactivity.lociHighlights.highlightOnly({loci:t},!1)}moveHistory(t,n){this.plugin.managers.structure.selection.modifyHistory(t,n,void 0,!0)}focusLoci(t){this.plugin.managers.camera.focusLoci(t)}lociEntry(t,n){return(0,L.jsx)("div",{className:"msp-flex-row",children:(0,L.jsx)(ir,{noOverflow:!0,title:"Click to focus. Hover to highlight.",onClick:()=>this.focusLoci(t.loci),style:{width:"auto",textAlign:"left"},onMouseEnter:()=>this.highlight(t.loci),onMouseLeave:()=>this.plugin.managers.interactivity.lociHighlights.clearHighlights(),children:(0,L.jsx)("span",{dangerouslySetInnerHTML:{__html:t.label}})})},n)}historyEntry(t,n){const r=this.plugin.managers.structure.selection.additionsHistory;return(0,L.jsxs)("div",{className:"msp-flex-row",children:[(0,L.jsxs)(ir,{noOverflow:!0,title:"Click to focus. Hover to highlight.",onClick:()=>this.focusLoci(t.loci),style:{width:"auto",textAlign:"left"},onMouseEnter:()=>this.highlight(t.loci),onMouseLeave:()=>this.plugin.managers.interactivity.lociHighlights.clearHighlights(),children:[n,". ",(0,L.jsx)("span",{dangerouslySetInnerHTML:{__html:t.label}})]}),r.length>1&&(0,L.jsx)(kn,{svg:pO,small:!0,className:"msp-form-control",onClick:()=>this.moveHistory(t,"up"),flex:"20px",title:"Move up"}),r.length>1&&(0,L.jsx)(kn,{svg:fO,small:!0,className:"msp-form-control",onClick:()=>this.moveHistory(t,"down"),flex:"20px",title:"Move down"}),(0,L.jsx)(kn,{svg:qp,small:!0,className:"msp-form-control",onClick:()=>this.plugin.managers.structure.selection.modifyHistory(t,"remove"),flex:!0,title:"Remove"})]},t.id)}atomsLociEntry(t,n){return(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{className:"msp-control-group-header",children:(0,L.jsx)("div",{className:"msp-no-overflow",title:t.label,children:t.label})}),(0,L.jsx)("div",{className:"msp-control-offset",children:t.atoms.map((r,i)=>this.historyEntry(r,i))})]},n)}get chainEntries(){const t=dt.create(),n=[];return this.plugin.managers.structure.selection.entries.forEach(({selection:r},i)=>{const o=_a.resolveAndCheck(this.plugin.state.data,i);if(!o||Me.isEmpty(r))return;const s=Me.getFirstLocation(r,t);if(r.elements.length>1||"polymer"!==Je.entity.type(s))return;const l=dP(Wh.ofLoci(r),{countsOnly:!0}),c=em(s,{reverse:!0,granularity:"chain"}).split("|");n.push({loci:r,label:`${l} | ${c[0]} | ${c[c.length-1]}`,cell:o})}),n}get atomEntries(){const t=new Map,n=this.plugin.managers.structure.selection.additionsHistory;for(let i=0,o=n.length;i{const s=this.plugin.helpers.substructureParent.get(o),a=[];for(let u=0,d=i.length;u0&&(0,L.jsx)("div",{className:"msp-control-offset",children:t.map((n,r)=>this.lociEntry(n,r))}),t.length<2&&(0,L.jsx)("div",{className:"msp-control-offset msp-help-text",children:(0,L.jsxs)("div",{className:"msp-help-description",children:[(0,L.jsx)(Mi,{svg:Ng,inline:!0}),"Add 2 or more selections",this.toggleHint()," from separate structures. Selections must be limited to single polymer chains or residues therein."]})}),t.length>1&&(0,L.jsx)(ir,{title:"Superpose structures by selected chains.",className:"msp-btn-commit msp-btn-commit-on",onClick:this.superposeChains,style:{marginTop:"1px"},children:"Superpose"})]})}addByAtoms(){const t=this.atomEntries;return(0,L.jsxs)(L.Fragment,{children:[t.length>0&&(0,L.jsx)("div",{className:"msp-control-offset",children:t.map((n,r)=>this.atomsLociEntry(n,r))}),t.length<2&&(0,L.jsx)("div",{className:"msp-control-offset msp-help-text",children:(0,L.jsxs)("div",{className:"msp-help-description",children:[(0,L.jsx)(Mi,{svg:Ng,inline:!0}),"Add 1 or more selections",this.toggleHint()," from separate structures. Selections must be limited to single atoms."]})}),t.length>1&&(0,L.jsx)(ir,{title:"Superpose structures by selected atoms.",className:"msp-btn-commit msp-btn-commit-on",onClick:this.superposeAtoms,style:{marginTop:"1px"},children:"Superpose"})]})}superposeByDbMapping(){return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(ir,{icon:Bbe,title:"Superpose structures using intersection of residues from SIFTS UNIPROT mapping.",className:"msp-btn msp-btn-block",onClick:this.superposeDb,style:{marginTop:"1px"},disabled:this.state.isBusy,children:"Uniprot"})})}render(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"msp-flex-row",children:[(0,L.jsx)(yl,{icon:Bbe,label:"Chains",toggle:this.toggleByChains,isSelected:"byChains"===this.state.action,disabled:this.state.isBusy}),(0,L.jsx)(yl,{icon:wbt,label:"Atoms",toggle:this.toggleByAtoms,isSelected:"byAtoms"===this.state.action,disabled:this.state.isBusy}),this.state.canUseDb&&this.superposeByDbMapping(),(0,L.jsx)(yl,{icon:uv,label:"",title:"Options",toggle:this.toggleOptions,isSelected:"options"===this.state.action,disabled:this.state.isBusy,style:{flex:"0 0 40px",padding:0}})]}),"byChains"===this.state.action&&this.addByChains(),"byAtoms"===this.state.action&&this.addByAtoms(),"options"===this.state.action&&(0,L.jsx)("div",{className:"msp-control-offset",children:(0,L.jsx)(vs,{params:_2e,values:this.state.options,onChangeValues:this.setOptions,isDisabled:this.state.isBusy})})]})}}class t3t extends d2{defaultState(){return{isCollapsed:!1,header:"Quick Styles",brand:{accent:"gray",svg:Z0t}}}renderControls(){return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(n3t,{})})}}class n3t extends bl{default(){var t=this;return le(function*(){const{structures:n}=t.plugin.managers.structure.hierarchy.selection,r=t.plugin.config.get(ei.Structure.DefaultRepresentationPreset)||Gp.auto.id,i=t.plugin.builders.structure.representation.resolveProvider(r);if(yield t.plugin.managers.structure.component.applyPreset(n,i),t.plugin.managers.structure.component.setOptions(I.getDefaultValues(Bg.OptionsParams)),t.plugin.canvas3d){const o=I.getDefaultValues(Tq);t.plugin.canvas3d.setProps({postprocessing:{outline:o.outline,occlusion:o.occlusion}})}})()}illustrative(){var t=this;return le(function*(){const{structures:n}=t.plugin.managers.structure.hierarchy.selection;yield t.plugin.managers.structure.component.applyPreset(n,Gp.illustrative),t.plugin.canvas3d&&t.plugin.canvas3d.setProps({postprocessing:{outline:{name:"on",params:{scale:1,color:st(0),threshold:.25,includeTransparent:!0}},occlusion:{name:"on",params:{multiScale:{name:"off",params:{}},radius:5,bias:.8,blurKernelSize:15,samples:32,resolutionScale:1,color:st(0)}},shadow:{name:"off",params:{}}}})})()}stylized(){var t=this;return le(function*(){if(t.plugin.managers.structure.component.setOptions({...t.plugin.managers.structure.component.state.options,ignoreLight:!0}),t.plugin.canvas3d){const n=t.plugin.canvas3d.props.postprocessing;t.plugin.canvas3d.setProps({postprocessing:{outline:{name:"on",params:"on"===n.outline.name?n.outline.params:{scale:1,color:st(0),threshold:.33,includeTransparent:!0}},occlusion:{name:"on",params:"on"===n.occlusion.name?n.occlusion.params:{multiScale:{name:"off",params:{}},radius:5,bias:.8,blurKernelSize:15,samples:32,resolutionScale:1,color:st(0)}},shadow:{name:"off",params:{}}}})}})()}render(){return(0,L.jsxs)("div",{className:"msp-flex-row",children:[(0,L.jsx)(ir,{noOverflow:!0,title:"Applies default representation preset. Set outline and occlusion effects to defaults.",onClick:()=>this.default(),style:{width:"auto"},children:"Default"}),(0,L.jsx)(ir,{noOverflow:!0,title:"Applies no representation preset. Enables outline and occlusion effects. Enables ignore-light representation parameter.",onClick:()=>this.stylized(),style:{width:"auto"},children:"Stylized"}),(0,L.jsx)(ir,{noOverflow:!0,title:"Applies illustrative representation preset. Enables outline and occlusion effects. Enables ignore-light parameter.",onClick:()=>this.illustrative(),style:{width:"auto"},children:"Illustrative"})]})}}class r3t extends Vr{constructor(){super(...arguments),this.state={show:!1,label:""},this.update=()=>{const t=this.plugin.state.data,n=t.selectQ(s=>s.ofTransformer(at.Model.ModelFromTrajectory));if(0===n.length)return void this.setState({show:!1});let r="",i=0;const o=new Set;for(const s of n){if(!s.sourceRef)continue;const a=t.cells.get(s.sourceRef).obj;if(a&&a.data.frameCount>1){if(o.has(s.sourceRef))return void this.setState({show:!1});o.add(s.sourceRef),i++,r||(r=`Model ${s.transform.params.modelIndex+1} / ${a.data.frameCount}`)}}i>1&&(r=""),this.setState({show:i>0,label:r})},this.reset=()=>jt.State.ApplyAction(this.plugin,{state:this.plugin.state.data,action:sO.create({action:"reset"})}),this.prev=()=>jt.State.ApplyAction(this.plugin,{state:this.plugin.state.data,action:sO.create({action:"advance",by:-1})}),this.next=()=>jt.State.ApplyAction(this.plugin,{state:this.plugin.state.data,action:sO.create({action:"advance",by:1})})}componentDidMount(){this.subscribe(this.plugin.state.data.events.changed,this.update),this.subscribe(this.plugin.behaviors.state.isAnimating,this.update)}render(){const t=this.plugin.behaviors.state.isAnimating.value;return!this.state.show||t&&!this.state.label||!this.plugin.config.get(ei.Viewport.ShowTrajectoryControls)?null:(0,L.jsxs)("div",{className:"msp-traj-controls",children:[!t&&(0,L.jsx)(kn,{svg:fbt,title:"First Model",onClick:this.reset,disabled:t}),!t&&(0,L.jsx)(kn,{svg:kbe,title:"Previous Model",onClick:this.prev,disabled:t}),!t&&(0,L.jsx)(kn,{svg:Mbe,title:"Next Model",onClick:this.next,disabled:t}),!!this.state.label&&(0,L.jsx)("span",{children:this.state.label})]})}}class i3t extends Vr{constructor(){super(...arguments),this.state={isBusy:!1,show:!0},this.keyUp=t=>{if(!t.ctrlKey||this.state.isBusy||t.target!==document.body)return;const n=this.plugin.managers.snapshot;if(37===t.keyCode||"ArrowLeft"===t.key)n.state.isPlaying&&n.stop(),this.prev();else if(38===t.keyCode||"ArrowUp"===t.key){if(n.state.isPlaying&&n.stop(),0===n.state.entries.size)return;const r=n.state.entries.get(0);this.update(r.snapshot.id)}else if(39===t.keyCode||"ArrowRight"===t.key)n.state.isPlaying&&n.stop(),this.next();else if(40===t.keyCode||"ArrowDown"===t.key){if(n.state.isPlaying&&n.stop(),0===n.state.entries.size)return;const r=n.state.entries.get(n.state.entries.size-1);this.update(r.snapshot.id)}},this.change=t=>{"none"!==t.target.value&&this.update(t.target.value)},this.prev=()=>{const t=this.plugin.managers.snapshot,n=t.getNextId(t.state.current,-1);n&&this.update(n)},this.next=()=>{const t=this.plugin.managers.snapshot,n=t.getNextId(t.state.current,1);n&&this.update(n)},this.togglePlay=()=>{this.plugin.managers.snapshot.togglePlay()}}componentDidMount(){this.subscribe(this.plugin.managers.snapshot.events.changed,()=>this.forceUpdate()),this.subscribe(this.plugin.behaviors.state.isBusy,t=>this.setState({isBusy:t})),this.subscribe(this.plugin.behaviors.state.isAnimating,t=>this.setState({isBusy:t})),window.addEventListener("keyup",this.keyUp,!1)}componentWillUnmount(){super.componentWillUnmount(),window.removeEventListener("keyup",this.keyUp,!1)}update(t){var n=this;return le(function*(){n.setState({isBusy:!0}),yield jt.State.Snapshots.Apply(n.plugin,{id:t}),n.setState({isBusy:!1})})()}render(){const t=this.plugin.managers.snapshot,n=t.state.entries.size;if(n<2||!this.state.show)return null;const r=t.state.current,i=t.state.isPlaying;return(0,L.jsxs)("div",{className:"msp-state-snapshot-viewport-controls",children:[(0,L.jsxs)("select",{className:"msp-form-control",value:r||"none",onChange:this.change,disabled:this.state.isBusy||i,children:[!r&&(0,L.jsx)("option",{value:"none"},"none"),t.state.entries.valueSeq().map((o,s)=>(0,L.jsxs)("option",{value:o.snapshot.id,children:[`[${s+1}/${n}]`," ",o.name||new Date(o.timestamp).toLocaleString()]},o.snapshot.id))]}),(0,L.jsx)(kn,{svg:i?Fbe:Rbe,title:i?"Pause":"Cycle States",onClick:this.togglePlay,disabled:!i&&this.state.isBusy}),!i&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(kn,{svg:kbe,title:"Previous State",onClick:this.prev,disabled:this.state.isBusy||i}),(0,L.jsx)(kn,{svg:Mbe,title:"Next State",onClick:this.next,disabled:this.state.isBusy||i})]})]})}}function o3t(){var e;const t=Yt.useContext(cm),[n,r]=Yt.useState(0);Yt.useEffect(()=>{const s=t.managers.snapshot.events.changed.subscribe(()=>r(a=>a+1));return()=>s.unsubscribe()},[t]);const i=t.managers.snapshot.state.current;if(!i)return null;const o=t.managers.snapshot.getEntry(i);return null!==(e=o?.description)&&void 0!==e&&e.trim()?(0,L.jsx)("div",{className:"msp-snapshot-description-wrapper",children:(0,L.jsx)(d2e,{skipHtml:!0,components:{a:s3t},children:o.description})}):null}function s3t({href:e,children:t,element:n}){const r=Yt.useContext(cm);return e&&"#"===e[0]?(0,L.jsx)("a",{href:"#",onClick:i=>{i.preventDefault(),r.managers.snapshot.applyKey(e.substring(1))},children:t}):n}class a3t extends Vr{constructor(){super(...arguments),this.state={isEmpty:!0,isExpanded:!1,isBusy:!1,isAnimating:!1,isPlaying:!1},this.toggleExpanded=()=>this.setState({isExpanded:!this.state.isExpanded}),this.stop=()=>{this.plugin.managers.animation.stop(),this.plugin.managers.snapshot.stop()}}componentDidMount(){this.subscribe(this.plugin.managers.snapshot.events.changed,()=>{this.setState(this.plugin.managers.snapshot.state.isPlaying?{isPlaying:!0,isExpanded:!1}:{isPlaying:!1})}),this.subscribe(this.plugin.behaviors.state.isBusy,t=>{this.setState(t?{isBusy:!0,isExpanded:!1,isEmpty:this.plugin.state.data.tree.transforms.size<2}:{isBusy:!1,isEmpty:this.plugin.state.data.tree.transforms.size<2})}),this.subscribe(this.plugin.behaviors.state.isAnimating,t=>{this.setState(t?{isAnimating:!0,isExpanded:!1}:{isAnimating:!1})})}render(){const t=this.plugin.managers.snapshot.state.isPlaying;if(t||this.state.isEmpty||this.plugin.managers.animation.isEmpty||!this.plugin.config.get(ei.Viewport.ShowAnimation))return null;const n=this.state.isAnimating;return(0,L.jsxs)("div",{className:"msp-animation-viewport-controls",children:[(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{className:"msp-semi-transparent-background"}),(0,L.jsx)(kn,{svg:n||t?Fbe:mbt,transparent:!0,title:n?"Stop":"Select Animation",onClick:n||t?this.stop:this.toggleExpanded,toggleState:this.state.isExpanded,disabled:!n&&!t&&(this.state.isBusy||this.state.isPlaying||this.state.isEmpty)})]}),this.state.isExpanded&&!this.state.isBusy&&(0,L.jsx)("div",{className:"msp-animation-viewport-controls-select",children:(0,L.jsx)(WEt,{onStart:this.toggleExpanded})})]})}}class l3t extends Vr{componentDidMount(){this.subscribe(this.plugin.behaviors.interaction.selectionMode,()=>this.forceUpdate())}render(){return this.plugin.selectionMode?(0,L.jsx)("div",{className:"msp-selection-viewport-controls",children:(0,L.jsx)(uTt,{})}):null}}class c3t extends Vr{constructor(){super(...arguments),this.state={labels:[]}}componentDidMount(){this.subscribe(this.plugin.behaviors.labels.highlight,t=>this.setState({labels:t.labels}))}render(){return 0===this.state.labels.length?null:(0,L.jsx)("div",{className:"msp-highlight-info",children:this.state.labels.map((t,n)=>t.indexOf("\n")>0?(0,L.jsx)("div",{className:"msp-highlight-markdown-row",children:(0,L.jsx)(d2e,{skipHtml:!0,children:t})},""+n):(0,L.jsx)("div",{className:"msp-highlight-simple-row",dangerouslySetInnerHTML:{__html:t}},""+n))})}}class u3t extends Vr{componentDidMount(){this.subscribe(this.plugin.state.behaviors.events.changed,()=>this.forceUpdate())}render(){const t=[];return this.plugin.customStructureControls.forEach((n,r)=>{t.push((0,L.jsx)(n,{initiallyCollapsed:this.props.initiallyCollapsed},r))}),t.length>0?(0,L.jsx)(L.Fragment,{children:t}):null}}class d3t extends Vr{render(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"msp-section-header",children:[(0,L.jsx)(Mi,{svg:hyt}),"Structure Tools"]}),(0,L.jsx)(STt,{}),(0,L.jsx)(mTt,{}),(0,L.jsx)(ZTt,{}),(0,L.jsx)(t3t,{}),(0,L.jsx)(YEt,{}),this.plugin.config.get(ei.VolumeStreaming.Enabled)&&(0,L.jsx)(CTt,{}),(0,L.jsx)(wTt,{}),(0,L.jsx)(u3t,{})]})}}class f3t extends Vr{get current(){return this.props.state.behaviors.currentObject.value}componentDidMount(){this.subscribe(this.plugin.state.events.object.updated,({ref:t,state:n})=>{const r=this.current;r.ref!==t||r.state!==n||this.forceUpdate()}),this.subscribe(this.plugin.state.data.actions.events.added,()=>this.forceUpdate()),this.subscribe(this.plugin.state.data.actions.events.removed,()=>this.forceUpdate())}render(){const{state:t,nodeRef:n}=this.props,r=t.cells.get(n),i=t.actions.fromCell(r,this.plugin);if(0===i.length)return null;const o=r.transform.transformer.definition,s=r.obj?r.obj.label:o.display&&o.display.name||o.name;return(0,L.jsxs)("div",{className:"msp-state-actions",children:[!this.props.hideHeader&&(0,L.jsxs)("div",{className:"msp-section-header",children:[(0,L.jsx)(Mi,{svg:Dyt})," ",`Actions (${s})`]}),i.map((a,l)=>(0,L.jsx)(GX,{state:t,action:a,nodeRef:n,initiallyCollapsed:0===l?!this.props.alwaysExpandFirst&&this.props.initiallyCollapsed:this.props.initiallyCollapsed},`${a.id}`))]})}}class p3t extends Vr{render(){var t;return(0,L.jsxs)("div",{children:[(0,L.jsx)(Zy,{icon:Nbe,title:"Plugin State"}),(0,L.jsx)("div",{style:{marginBottom:"10px"},children:(0,L.jsx)(lm,{header:"Save Options",initiallyExpanded:!1,children:(0,L.jsx)(C2e,{})})}),(0,L.jsx)(_B,{}),(0,L.jsx)(m3t,{}),(0,L.jsx)(Zy,{title:"Save as File",accent:"blue"}),(0,L.jsx)(S2e,{}),"none"!==(null===(t=this.plugin.spec.components)||void 0===t?void 0:t.remoteState)&&(0,L.jsx)(I2e,{})]})}}class S2e extends Vr{constructor(){super(...arguments),this.downloadToFileJson=()=>{var t,n;null===(n=(t=this.props).onAction)||void 0===n||n.call(t),jt.State.Snapshots.DownloadToFile(this.plugin,{type:"json"})},this.downloadToFileZip=()=>{var t,n;null===(n=(t=this.props).onAction)||void 0===n||n.call(t),jt.State.Snapshots.DownloadToFile(this.plugin,{type:"zip"})},this.open=t=>{var n,r;t.target.files&&t.target.files[0]?(null===(r=(n=this.props).onAction)||void 0===r||r.call(n),jt.State.Snapshots.OpenFile(this.plugin,{file:t.target.files[0]})):this.plugin.log.error("No state file selected")}}render(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"msp-flex-row",children:[(0,L.jsx)(ir,{icon:zW,onClick:this.downloadToFileJson,title:"Save the state description. Input data are loaded using the provided sources. Does not work if local files are used as input.",children:"State"}),(0,L.jsx)(ir,{icon:zW,onClick:this.downloadToFileZip,title:"Save the state including the input data.",children:"Session"}),(0,L.jsxs)("div",{className:"msp-btn msp-btn-block msp-btn-action msp-loader-msp-btn-file",children:[(0,L.jsx)(Mi,{svg:nbt,inline:!0})," Open ",(0,L.jsx)("input",{onChange:this.open,type:"file",multiple:!1,accept:".molx,.molj"})]})]}),(0,L.jsxs)("div",{className:"msp-help-text",style:{padding:"10px"},children:[(0,L.jsx)(Mi,{svg:Obe})," This is an experimental feature and stored states/sessions might not be openable in a future version."]})]})}}class C2e extends Vr{componentDidMount(){this.subscribe(this.plugin.state.snapshotParams,()=>this.forceUpdate())}render(){return(0,L.jsx)(vs,{params:M2.SnapshotParams,values:this.plugin.state.snapshotParams.value,onChangeValues:this.plugin.state.setSnapshotParams})}}class _B extends Vr{constructor(){super(...arguments),this.state={params:I.getDefaultValues(_B.Params)},this.add=()=>{jt.State.Snapshots.Add(this.plugin,{name:this.state.params.name,description:this.state.params.description})},this.updateParams=t=>this.setState({params:t}),this.clear=()=>{jt.State.Snapshots.Clear(this.plugin,{})}}shouldComponentUpdate(t,n){return!lw(this.props,t)||!lw(this.state,n)}render(){return(0,L.jsx)("div",{children:(0,L.jsx)(h3t,{parent:this})})}}function w2e(e,t,n){return!!t&&e.managers.snapshot.state.entries.some(r=>(!n||r.snapshot.id!==n)&&r.key===t)}function h3t({parent:e}){const[t,n]=Yt.useState({key:"",name:"",description:""}),r=()=>{jt.State.Snapshots.Add(e.plugin,{key:t.key,name:t.name,description:t.description}),n({key:"",name:"",description:""})},i=w2e(e.plugin,t.key);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(A2e,{state:t,setState:n,apply:r}),(0,L.jsxs)("div",{className:"msp-flex-row",children:[(0,L.jsx)(kn,{onClick:e.clear,svg:qp,title:"Remove All"}),(0,L.jsx)(ir,{onClick:r,icon:i?void 0:FA,style:{textAlign:"right"},commit:i?"off":"on",disabled:i,children:i?"Key must be unique":"Add"})]})]})}_B.Params={name:I.Text(),description:I.Text()};class m3t extends Vr{constructor(){super(...arguments),this.state={editingId:void 0},this.edit=t=>{const n=t.currentTarget.getAttribute("data-id");n&&this.setState({editingId:n===this.state.editingId?void 0:n})},this.doneEdit=()=>this.setState({editingId:void 0}),this.apply=t=>{const n=t.currentTarget.getAttribute("data-id");n&&jt.State.Snapshots.Apply(this.plugin,{id:n})},this.remove=t=>{const n=t.currentTarget.getAttribute("data-id");n&&jt.State.Snapshots.Remove(this.plugin,{id:n})},this.moveUp=t=>{const n=t.currentTarget.getAttribute("data-id");n&&jt.State.Snapshots.Move(this.plugin,{id:n,dir:-1})},this.moveDown=t=>{const n=t.currentTarget.getAttribute("data-id");n&&jt.State.Snapshots.Move(this.plugin,{id:n,dir:1})},this.replace=t=>{const n=t.currentTarget.getAttribute("data-id");n&&jt.State.Snapshots.Replace(this.plugin,{id:n})}}componentDidMount(){this.subscribe(this.plugin.managers.snapshot.events.changed,()=>this.forceUpdate())}render(){const t=this.plugin.managers.snapshot.state.current,n=[];return this.plugin.managers.snapshot.state.entries.forEach(r=>{var i;n.push((0,L.jsxs)("li",{className:"msp-flex-row",children:[(0,L.jsxs)(ir,{"data-id":r.snapshot.id,onClick:this.apply,className:"msp-no-overflow",children:[(0,L.jsxs)("span",{style:{fontWeight:r.snapshot.id===t?"bold":void 0},children:[!!r.key&&`[${r.key}] `,r.name||new Date(r.timestamp).toLocaleString()]})," ",(0,L.jsx)("small",{children:`${r.snapshot.durationInMs?AR(r.snapshot.durationInMs,!1):""}`})]}),(0,L.jsx)(kn,{svg:uv,"data-id":r.snapshot.id,title:"Edit",onClick:this.edit,flex:"28px"}),(0,L.jsx)(kn,{svg:pO,"data-id":r.snapshot.id,title:"Move Up",onClick:this.moveUp,flex:"20px"}),(0,L.jsx)(kn,{svg:fO,"data-id":r.snapshot.id,title:"Move Down",onClick:this.moveDown,flex:"20px"}),(0,L.jsx)(kn,{svg:ybt,"data-id":r.snapshot.id,title:"Replace",onClick:this.replace,flex:"20px"}),(0,L.jsx)(kn,{svg:qp,"data-id":r.snapshot.id,title:"Remove",onClick:this.remove,flex:"20px"})]},r.snapshot.id)),this.state.editingId===r.snapshot.id&&n.push((0,L.jsx)(g3t,{entry:r,plugin:this.plugin,done:this.doneEdit},`${r.snapshot.id}-edit`));const o=r.image&&(null===(i=this.plugin.managers.asset.get(r.image))||void 0===i?void 0:i.file);o&&n.push((0,L.jsx)("li",{className:"msp-state-image-row",children:(0,L.jsx)(ir,{"data-id":r.snapshot.id,onClick:this.apply,children:(0,L.jsx)("img",{draggable:!1,src:URL.createObjectURL(o)})})},`${r.snapshot.id}-image`))}),(0,L.jsx)(L.Fragment,{children:(0,L.jsx)("ul",{style:{listStyle:"none",marginTop:"10px"},className:"msp-state-list",children:n})})}}function A2e({state:e,setState:t,apply:n}){const r=Yt.useRef(),i=Yt.useRef(),[o,s]=Yt.useState(!1);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Bd,{label:"Name",control:(0,L.jsx)("input",{type:"text",value:e.name,placeholder:"Name",onChange:a=>t({...e,name:a.target.value}),onKeyUp:a=>{var l;"Enter"===a.key&&(null===(l=r.current)||void 0===l||l.focus())}})}),(0,L.jsx)(Bd,{label:(0,L.jsxs)(L.Fragment,{children:["Key",(0,L.jsx)($be,{show:o,toggle:()=>s(a=>!a)})]}),control:(0,L.jsx)("input",{type:"text",ref:r,value:e.key,placeholder:"Key (optional)",onChange:a=>t({...e,key:a.target.value}),onKeyUp:a=>{var l;"Enter"===a.key&&(null===(l=i.current)||void 0===l||l.focus())}})}),o&&(0,L.jsx)("div",{className:"msp-control-offset",children:(0,L.jsx)(Wbe,{description:"Optional snapshot key used to activate snapshots from descriptions, labels, etc."})}),(0,L.jsx)("div",{className:"msp-flex-row msp-text-area-wrapper",style:{marginBottom:1},children:(0,L.jsx)("textarea",{ref:i,placeholder:"Markdown Description\n\n- Use [title](#key) to link to a snapshot",className:"msp-form-control",value:e.description,onChange:a=>t({...e,description:a.target.value}),onKeyUp:a=>{"Enter"===a.key&&a.ctrlKey&&n(e)}})})]})}function g3t({entry:e,plugin:t,done:n}){var r,i,o;const[s,a]=Yt.useState({key:null!==(r=e.key)&&void 0!==r?r:"",name:null!==(i=e.name)&&void 0!==i?i:"",description:null!==(o=e.description)&&void 0!==o?o:""}),l=()=>{t.managers.snapshot.update(e,s),n()},c=w2e(t,s.key,e.snapshot.id);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(A2e,{state:s,setState:a,apply:l}),(0,L.jsx)("div",{className:"msp-flex-row",style:{marginBottom:1},children:(0,L.jsx)(ir,{onClick:l,icon:c?void 0:a2,style:{textAlign:"right"},commit:c?"off":"on",disabled:c,children:c?"Key must be unique":"Apply"})})]})}class I2e extends Vr{constructor(){var t;super(...arguments),t=this,this.Params={name:I.Text(),options:I.Group({description:I.Text(),playOnLoad:I.Boolean(!1),serverUrl:I.Text(this.plugin.config.get(ei.State.CurrentServer))})},this.state={params:I.getDefaultValues(this.Params),entries:Nc(),isBusy:!1},this.ListOnlyParams={options:I.Group({serverUrl:I.Text(this.plugin.config.get(ei.State.CurrentServer))},{isFlat:!0})},this._mounted=!1,this.refresh=le(function*(){try{t.setState({isBusy:!0}),t.plugin.config.set(ei.State.CurrentServer,t.state.params.options.serverUrl);const n=(yield t.plugin.runTask(t.plugin.fetch({url:t.serverUrl("list"),type:"json"})))||[];n.sort((i,o)=>i.isSticky===o.isSticky?i.timestamp-o.timestamp:i.isSticky?-1:1);const r=Nc().asMutable();for(const i of n)r.set(i.id,{...i,url:t.serverUrl(`get/${i.id}`),removeUrl:t.serverUrl(`remove/${i.id}`)});t._mounted&&t.setState({entries:r.asImmutable(),isBusy:!1})}catch(n){console.error(n),t.plugin.log.error("Error fetching remote snapshots"),t._mounted&&t.setState({entries:Nc(),isBusy:!1})}}),this.upload=le(function*(){t.setState({isBusy:!0}),t.plugin.config.set(ei.State.CurrentServer,t.state.params.options.serverUrl),yield jt.State.Snapshots.Upload(t.plugin,{name:t.state.params.name,description:t.state.params.options.description,playOnLoad:t.state.params.options.playOnLoad,serverUrl:t.state.params.options.serverUrl}),t.plugin.log.message("Snapshot uploaded."),t._mounted&&(t.setState({isBusy:!1}),t.refresh())}),this.fetch=function(){var n=le(function*(r){const i=r.currentTarget.getAttribute("data-id");if(!i)return;const o=t.state.entries.get(i);if(o){t.setState({isBusy:!0});try{yield jt.State.Snapshots.Fetch(t.plugin,{url:o.url})}finally{t._mounted&&t.setState({isBusy:!1})}}});return function(r){return n.apply(this,arguments)}}(),this.remove=function(){var n=le(function*(r){const i=r.currentTarget.getAttribute("data-id");if(!i)return;const o=t.state.entries.get(i);if(o){t.setState({entries:t.state.entries.remove(i)});try{yield fetch(o.removeUrl)}catch(s){console.error(s)}}});return function(r){return n.apply(this,arguments)}}()}componentDidMount(){this.refresh(),this._mounted=!0}componentWillUnmount(){super.componentWillUnmount(),this._mounted=!1}serverUrl(t){return t?mF(this.state.params.options.serverUrl,t):this.state.params.options.serverUrl}render(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Zy,{title:"Remote States",accent:"blue"}),!this.props.listOnly&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(vs,{params:this.Params,values:this.state.params,onEnter:this.upload,onChange:t=>{this.setState({params:{...this.state.params,[t.name]:t.value}})},isDisabled:this.state.isBusy}),(0,L.jsxs)("div",{className:"msp-flex-row",children:[(0,L.jsx)(kn,{onClick:this.refresh,disabled:this.state.isBusy,svg:HW}),(0,L.jsx)(ir,{icon:Eyt,onClick:this.upload,disabled:this.state.isBusy,commit:!0,children:"Upload"})]})]}),(0,L.jsx)(y3t,{entries:this.state.entries,isBusy:this.state.isBusy,serverUrl:this.state.params.options.serverUrl,fetch:this.fetch,remove:this.props.listOnly?void 0:this.remove}),this.props.listOnly&&(0,L.jsxs)("div",{style:{marginTop:"10px"},children:[(0,L.jsx)(vs,{params:this.ListOnlyParams,values:this.state.params,onEnter:this.upload,onChange:t=>{this.setState({params:{...this.state.params,[t.name]:t.value}})},isDisabled:this.state.isBusy}),(0,L.jsx)("div",{className:"msp-flex-row",children:(0,L.jsx)(ir,{onClick:this.refresh,disabled:this.state.isBusy,icon:HW,children:"Refresh"})})]})]})}}class y3t extends bl{constructor(){var t;super(...arguments),t=this,this.open=function(){var n=le(function*(r){const i=r.currentTarget.getAttribute("data-id");if(!i)return;const o=t.props.entries.get(i);if(!o)return;r.preventDefault();let s=`${window.location}`;const a=s.indexOf("?");a>0&&(s=s.substr(0,a)),window.open(`${s}?snapshot-url=${encodeURIComponent(o.url)}`,"_blank")});return function(r){return n.apply(this,arguments)}}()}render(){return(0,L.jsx)("ul",{style:{listStyle:"none",marginTop:"10px"},className:"msp-state-list",children:this.props.entries.valueSeq().map(t=>(0,L.jsxs)("li",{className:"msp-flex-row",children:[(0,L.jsxs)(ir,{"data-id":t.id,onClick:this.props.fetch,disabled:this.props.isBusy,onContextMenu:this.open,title:"Click to download, right-click to open in a new tab.",children:[t.name||new Date(t.timestamp).toLocaleString()," ",(0,L.jsx)("small",{children:t.description})]}),!t.isSticky&&this.props.remove&&(0,L.jsx)(kn,{svg:qp,"data-id":t.id,title:"Remove",onClick:this.props.remove,disabled:this.props.isBusy,small:!0})]},t.id))})}}class E2e extends Vr{constructor(){super(...arguments),this.state={showActions:!0}}componentDidMount(){this.subscribe(this.plugin.state.events.cell.created,t=>{t.cell.transform.parent===vr.RootRef&&this.forceUpdate()}),this.subscribe(this.plugin.state.events.cell.removed,t=>{t.parent===vr.RootRef&&this.forceUpdate()})}static getDerivedStateFromProps(t,n){const o=0===t.state.tree.children.get(t.state.tree.root.ref).size;return n.showActions===o?null:{showActions:o}}render(){const t=this.props.state.tree.root.ref;return this.state.showActions?(0,L.jsxs)("div",{style:{margin:"10px",cursor:"default"},children:[(0,L.jsx)("p",{children:"Nothing to see here yet."}),(0,L.jsxs)("p",{children:["Structures and Volumes can be loaded from the ",(0,L.jsx)(Mi,{svg:VW})," tab."]})]}):(0,L.jsx)(mm,{cell:this.props.state.cells.get(t),depth:0})}}class mm extends Vr{constructor(){super(...arguments),this.state={isCollapsed:!!this.props.cell.state.isCollapsed,isNull:mm.isNull(this.props.cell),showLabel:mm.showLabel(this.props.cell)}}is(t){return t.ref===this.ref&&t.state===this.props.cell.parent}get ref(){return this.props.cell.transform.ref}componentDidMount(){this.subscribe(this.plugin.state.events.cell.stateUpdated,t=>{this.props.cell===t.cell&&this.is(t)&&t.state.cells.has(this.ref)&&(this.state.isCollapsed!==!!t.cell.state.isCollapsed||this.state.isNull!==mm.isNull(t.cell)||this.state.showLabel!==mm.showLabel(t.cell))&&this.forceUpdate()}),this.subscribe(this.plugin.state.events.cell.created,t=>{this.props.cell.parent===t.state&&this.ref===t.cell.transform.parent&&this.forceUpdate()}),this.subscribe(this.plugin.state.events.cell.removed,t=>{this.props.cell.parent===t.state&&this.ref===t.parent&&this.forceUpdate()})}static getDerivedStateFromProps(t,n){const r=mm.isNull(t.cell),i=mm.showLabel(t.cell);return!!t.cell.state.isCollapsed===n.isCollapsed&&n.isNull===r&&n.showLabel===i?null:{isCollapsed:!!t.cell.state.isCollapsed,isNull:r,showLabel:i}}static hasDecorator(t){var n;const r=t.parent.tree.children.get(t.transform.ref);return 1===r.size&&!(null===(n=t.parent)||void 0===n||!n.tree.transforms.get(r.first()).transformer.definition.isDecorator)}static isNull(t){return!t||!t.parent||t.obj===vo.Null||!t.parent.tree.transforms.has(t.transform.ref)}static showLabel(t){return t.transform.ref!==vr.RootRef&&("ok"!==t.status||!t.state.isGhost&&!mm.hasDecorator(t))}render(){if(this.state.isNull)return null;const t=this.props.cell,n=t.parent.tree.children.get(this.ref);if(!this.state.showLabel)return 0===n.size?null:(0,L.jsx)(L.Fragment,{children:n.map(i=>(0,L.jsx)(mm,{cell:t.parent.cells.get(i),depth:this.props.depth},i))});const r=this.props.depth+1;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(b3t,{cell:t,depth:this.props.depth}),0===n.size?void 0:(0,L.jsx)("div",{style:{display:this.state.isCollapsed?"none":"block"},children:n.map(i=>(0,L.jsx)(mm,{cell:t.parent.cells.get(i),depth:r},i))})]})}}class b3t extends Vr{constructor(){super(...arguments),this.state={isCurrent:this.props.cell.parent.current===this.ref,isCollapsed:!!this.props.cell.state.isCollapsed,action:void 0,currentAction:void 0},this.setCurrent=t=>{t?.preventDefault(),t?.currentTarget.blur(),jt.State.SetCurrentObject(this.plugin,{state:this.props.cell.parent,ref:this.ref})},this.setCurrentRoot=t=>{t?.preventDefault(),t?.currentTarget.blur(),jt.State.SetCurrentObject(this.plugin,{state:this.props.cell.parent,ref:vr.RootRef})},this.remove=t=>{t?.preventDefault(),jt.State.RemoveObject(this.plugin,{state:this.props.cell.parent,ref:this.ref,removeParentGhosts:!0})},this.toggleVisible=t=>{t.preventDefault(),jt.State.ToggleVisibility(this.plugin,{state:this.props.cell.parent,ref:this.ref}),t.currentTarget.blur()},this.toggleExpanded=t=>{t.preventDefault(),jt.State.ToggleExpanded(this.plugin,{state:this.props.cell.parent,ref:this.ref}),t.currentTarget.blur()},this.highlight=t=>{t.preventDefault(),jt.Interactivity.Object.Highlight(this.plugin,{state:this.props.cell.parent,ref:this.ref}),t.currentTarget.blur()},this.clearHighlight=t=>{t.preventDefault(),jt.Interactivity.ClearHighlights(this.plugin),t.currentTarget.blur()},this.hideApply=()=>{this.setCurrentRoot()},this.selectAction=t=>{t&&(0,t?.value)()}}is(t){return t.ref===this.ref&&t.state===this.props.cell.parent}get ref(){return this.props.cell.transform.ref}componentDidMount(){this.subscribe(this.plugin.state.events.cell.stateUpdated.pipe(xd(t=>this.is(t)),Qbe(33)),t=>{this.forceUpdate()}),this.subscribe(this.props.cell.parent.behaviors.currentObject,t=>{this.is(t)?t.state.transforms.has(this.ref)&&this._setCurrent(this.props.cell.parent.current===this.ref,!!this.props.cell.state.isCollapsed):this.state.isCurrent&&t.state.transforms.has(this.ref)&&this._setCurrent(this.props.cell.parent.current===this.ref,this.state.isCollapsed)})}_setCurrent(t,n){this.setState(t?{isCurrent:t,action:"options",currentAction:void 0,isCollapsed:n}:{isCurrent:t,action:void 0,currentAction:void 0,isCollapsed:n})}static getDerivedStateFromProps(t,n){const r=t.cell.parent.current===t.cell.transform.ref,i=!!t.cell.state.isCollapsed;return n.isCollapsed===i&&n.isCurrent===r?null:{isCurrent:r,isCollapsed:i,action:void 0,currentAction:void 0}}get actions(){const t=this.props.cell,n=[...t.parent.actions.fromCell(t,this.plugin)];if(0!==n.length)return n.sort((r,i)=>r.definition.display.nameHn.Item(r.definition.display.name,()=>this.setState({action:"apply",currentAction:r})))]}updates(t){const n=this.props.cell,r=TD.getDecoratorChain(n.parent,n.transform.ref),i=[];for(let o=r.length-1;o>=0;o--){const s=r[o];i.push((0,L.jsx)(ab,{state:n.parent,transform:s.transform,noMargin:!0,wrapInExpander:!0,expanderHeaderLeftMargin:t},`${s.transform.transformer.id}-${o}`))}return(0,L.jsx)("div",{className:"msp-tree-updates-wrapper",children:i})}render(){const t=this.props.cell,n=t.transform;if(!t)return null;const r=this.is(t.parent.behaviors.currentObject.value),i="error"!==t.status&&"ok"!==t.status;let o;if("error"!==t.status&&t.obj){const p=t.obj;o=(0,L.jsxs)(ir,{className:`msp-btn-tree-label msp-type-class-${p.type.typeClass}`,noOverflow:!0,disabled:i,title:`${p.label} ${p.description?p.description:""}`,onClick:this.state.isCurrent?this.setCurrentRoot:this.setCurrent,children:[(0,L.jsx)("span",{children:p.label})," ",p.description?(0,L.jsx)("small",{children:p.description}):void 0]})}else{const p="error"===t.status?t.errorText:n.transformer.definition.display.name;o=(0,L.jsxs)(ir,{className:"msp-btn-tree-label msp-no-hover-outline",noOverflow:!0,title:p,onClick:this.state.isCurrent?this.setCurrentRoot:this.setCurrent,disabled:i,children:["error"===t.status&&(0,L.jsxs)("b",{children:["[",t.status,"]"]})," ",(0,L.jsx)("span",{children:p})]})}const s=t.parent.tree.children.get(this.ref),a=t.state,l=(0,L.jsx)(kn,{svg:a.isCollapsed?Xy:Yy,flex:"20px",disabled:i,onClick:this.toggleExpanded,transparent:!0,className:"msp-no-hover-outline",style:{visibility:s.size>0?"visible":"hidden"}}),c=t.state.isLocked?void 0:(0,L.jsx)(kn,{svg:qp,onClick:this.remove,disabled:i,small:!0,toggleState:!1}),u=(0,L.jsx)(kn,{svg:a.isHidden?c2:u2,toggleState:!1,disabled:i,small:!0,onClick:this.toggleVisible}),f=(0,L.jsxs)("div",{className:"msp-flex-row msp-tree-row"+(r?" msp-tree-row-current":""),onMouseEnter:this.highlight,onMouseLeave:this.clearHighlight,style:{marginLeft:8*this.props.depth+"px"},children:[l,o,c,u]});if(!r)return f;if("apply"===this.state.action&&this.state.currentAction)return(0,L.jsxs)("div",{style:{marginBottom:"1px"},children:[f,(0,L.jsx)(Fg,{header:`Apply ${this.state.currentAction.definition.display.name}`,initialExpanded:!0,hideExpander:!0,hideOffset:!1,onHeaderClick:this.hideApply,topRightIcon:Rg,headerLeftMargin:8*this.props.depth+21+"px",children:(0,L.jsx)(GX,{onApply:this.hideApply,state:this.props.cell.parent,action:this.state.currentAction,nodeRef:this.props.cell.transform.ref,hideHeader:!0,noMargin:!0})})]});if("options"===this.state.action){const p=this.actions,m=this.updates(8*this.props.depth+21+"px");return(0,L.jsxs)("div",{style:{marginBottom:"1px"},children:[f,m,p&&(0,L.jsx)("div",{style:{marginLeft:8*this.props.depth+21+"px",marginTop:"-1px"},children:(0,L.jsx)(Hn,{items:p,onSelect:this.selectAction})})]})}return f}}class v3t extends Vr{componentDidMount(){this.subscribe(this.plugin.state.behaviors.events.changed,()=>this.forceUpdate())}render(){const t=[];return this.plugin.customImportControls.forEach((n,r)=>{t.push((0,L.jsx)(n,{initiallyCollapsed:this.props.initiallyCollapsed},r))}),t.length>0?(0,L.jsx)(L.Fragment,{children:t}):null}}class x3t extends Vr{constructor(){var t;super(...arguments),this.state={tab:this.plugin.behaviors.layout.leftPanelTabName.value},this.set=n=>{if(this.state.tab===n)return this.setState({tab:"none"},()=>this.plugin.behaviors.layout.leftPanelTabName.next("none")),void jt.Layout.Update(this.plugin,{state:{regionState:{...this.plugin.layout.state.regionState,left:"collapsed"}}});this.setState({tab:n},()=>this.plugin.behaviors.layout.leftPanelTabName.next(n)),"full"!==this.plugin.layout.state.regionState.left&&jt.Layout.Update(this.plugin,{state:{regionState:{...this.plugin.layout.state.regionState,left:"full"}}})},this.tabs={none:(0,L.jsx)(L.Fragment,{}),root:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Zy,{icon:VW,title:"Home"}),(0,L.jsx)(f3t,{state:this.plugin.state.data,nodeRef:vr.RootRef,hideHeader:!0,initiallyCollapsed:!0,alwaysExpandFirst:!0}),(0,L.jsx)(v3t,{}),"none"!==(null===(t=this.plugin.spec.components)||void 0===t?void 0:t.remoteState)&&(0,L.jsx)(I2e,{listOnly:!0})]}),data:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Zy,{icon:Ibe,title:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(C3t,{})," State Tree"]})}),(0,L.jsx)(E2e,{state:this.plugin.state.data})]}),states:(0,L.jsx)(p3t,{}),settings:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Zy,{icon:uv,title:"Plugin Settings"}),(0,L.jsx)(S3t,{})]}),help:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Zy,{icon:Ng,title:"Help"}),(0,L.jsx)(lTt,{})]})}}componentDidMount(){this.subscribe(this.plugin.behaviors.layout.leftPanelTabName,t=>{this.state.tab!==t&&this.setState({tab:t}),"none"===t&&"collapsed"!==this.plugin.layout.state.regionState.left&&jt.Layout.Update(this.plugin,{state:{regionState:{...this.plugin.layout.state.regionState,left:"collapsed"}}})}),this.subscribe(this.plugin.state.data.events.changed,({state:t})=>{"data"===this.state.tab&&1===t.cells.size&&this.set("root")})}render(){const t=this.state.tab;return(0,L.jsxs)("div",{className:"msp-left-panel-controls",children:[(0,L.jsxs)("div",{className:"msp-left-panel-controls-buttons",children:[(0,L.jsx)(kn,{svg:VW,toggleState:"root"===t,transparent:!0,onClick:()=>this.set("root"),title:"Home"}),(0,L.jsx)(_3t,{set:this.set}),(0,L.jsx)(kn,{svg:Nbe,toggleState:"states"===t,transparent:!0,onClick:()=>this.set("states"),title:"Plugin State"}),(0,L.jsx)(kn,{svg:Ng,toggleState:"help"===t,transparent:!0,onClick:()=>this.set("help"),title:"Help"}),(0,L.jsx)("div",{className:"msp-left-panel-controls-buttons-bottom",children:(0,L.jsx)(kn,{svg:uv,toggleState:"settings"===t,transparent:!0,onClick:()=>this.set("settings"),title:"Settings"})})]}),(0,L.jsx)("div",{className:"msp-scrollable-container",children:this.tabs[t]})]})}}class _3t extends Vr{constructor(){super(...arguments),this.state={changed:!1}}get tab(){return this.plugin.behaviors.layout.leftPanelTabName.value}componentDidMount(){this.subscribe(this.plugin.behaviors.layout.leftPanelTabName,t=>{"data"===this.tab?this.setState({changed:!1}):this.forceUpdate()}),this.subscribe(this.plugin.state.data.events.changed,t=>{"data"!==this.tab&&this.setState({changed:!0})})}render(){return(0,L.jsx)(kn,{svg:Ibe,toggleState:"data"===this.tab,transparent:!0,onClick:()=>this.props.set("data"),title:"State Tree",style:{position:"relative"},extraContent:this.state.changed?(0,L.jsx)("div",{className:"msp-left-panel-controls-button-data-dirty"}):void 0})}}class S3t extends Vr{constructor(){super(...arguments),this.setSettings=t=>{jt.Canvas3D.SetSettings(this.plugin,{settings:{[t.name]:t.value}})},this.setCanvas3DContextProps=t=>{var n;null===(n=this.plugin.canvas3dContext)||void 0===n||n.setProps({[t.name]:t.value}),this.plugin.events.canvas3d.settingsUpdated.next(void 0)}}componentDidMount(){this.subscribe(this.plugin.events.canvas3d.settingsUpdated,()=>this.forceUpdate()),this.subscribe(this.plugin.layout.events.updated,()=>this.forceUpdate()),this.plugin.canvas3d&&this.subscribe(this.plugin.canvas3d.camera.stateChanged.pipe(mA(500,void 0,{leading:!0,trailing:!0})),t=>{(void 0!==t.radiusMax||void 0!==t.radius)&&this.forceUpdate()})}render(){return(0,L.jsxs)(L.Fragment,{children:[this.plugin.canvas3d&&this.plugin.canvas3dContext&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Zy,{title:"Viewport"}),(0,L.jsx)(vs,{params:Fd,values:this.plugin.canvas3d.props,onChange:this.setSettings}),(0,L.jsx)(vs,{params:K_.Params,values:this.plugin.canvas3dContext.props,onChange:this.setCanvas3DContextProps})]}),(0,L.jsx)(Zy,{title:"Behavior"}),(0,L.jsx)(E2e,{state:this.plugin.state.behaviors})]})}}class C3t extends Vr{constructor(){super(...arguments),this.remove=t=>{t.preventDefault(),jt.State.RemoveObject(this.plugin,{state:this.plugin.state.data,ref:vr.RootRef})}}componentDidMount(){this.subscribe(this.plugin.state.events.cell.created,t=>{t.cell.transform.parent===vr.RootRef&&this.forceUpdate()}),this.subscribe(this.plugin.state.events.cell.removed,t=>{t.parent===vr.RootRef&&this.forceUpdate()})}render(){return 0===this.plugin.state.data.tree.children.get(vr.RootRef).size?null:(0,L.jsx)(kn,{svg:qp,onClick:this.remove,title:"Remove All",style:{display:"inline-block"},small:!0,className:"msp-no-hover-outline",transparent:!0})}}class w3t extends Vr{constructor(){super(...arguments),this.parentDiv=Yt.createRef(),this.lastMouseOverSeqIdx=-1,this.highlightQueue=new si,this.lociHighlightProvider=(t,n)=>{this.props.sequenceWrapper.markResidue(t.loci,n)&&this.updateMarker()},this.lociSelectionProvider=(t,n)=>{this.props.sequenceWrapper.markResidue(t.loci,n)&&this.updateMarker()},this.contextMenu=t=>{t.preventDefault()},this.mouseDownLoci=void 0,this.mouseDown=t=>{t.stopPropagation();const n=this.getSeqIdx(t),r=this.getLoci(n),i=q_(t.nativeEvent),o=xA(t.nativeEvent),s=wF(t.nativeEvent);this.click(r,i,o,s),this.mouseDownLoci=r},this.mouseUp=t=>{if(t.stopPropagation(),void 0===this.mouseDownLoci)return;const n=this.getSeqIdx(t),r=this.getLoci(n);if(r&&!Me.areEqual(this.mouseDownLoci,r)){const i=q_(t.nativeEvent),o=xA(t.nativeEvent),s=wF(t.nativeEvent),a=this.mouseDownLoci.elements[0],l=r.elements[0],c=Math.min(Ve.min(a.indices),Ve.min(l.indices)),u=Math.max(Ve.max(a.indices),Ve.max(l.indices)),d=Me(r.structure,[{unit:a.unit,indices:Ve.ofRange(c,u)}]);this.click(Me.subtract(d,this.mouseDownLoci),i,o,s)}this.mouseDownLoci=void 0},this.location=dt.create(void 0),this.mouseMove=t=>{t.stopPropagation();const n=q_(t.nativeEvent),r=xA(t.nativeEvent),i=wF(t.nativeEvent),o=t.target;if(!o||!o.getAttribute){if(-1===this.lastMouseOverSeqIdx)return;return this.lastMouseOverSeqIdx=-1,void this.highlightQueue.next({seqIdx:-1,buttons:n,button:r,modifiers:i})}const s=o.hasAttribute("data-seqid")?+o.getAttribute("data-seqid"):-1;if(this.lastMouseOverSeqIdx!==s)if(this.lastMouseOverSeqIdx=s,void 0!==this.mouseDownLoci){const a=this.getLoci(s);this.hover(a,es.Flag.None,es.Flag.None,{...i,shift:!0})}else this.highlightQueue.next({seqIdx:s,buttons:n,button:r,modifiers:i})},this.mouseLeave=t=>{if(t.stopPropagation(),this.mouseDownLoci=void 0,-1===this.lastMouseOverSeqIdx)return;this.lastMouseOverSeqIdx=-1;const n=q_(t.nativeEvent),r=xA(t.nativeEvent),i=wF(t.nativeEvent);this.highlightQueue.next({seqIdx:-1,buttons:n,button:r,modifiers:i})}}get sequenceNumberPeriod(){return void 0!==this.props.sequenceNumberPeriod?this.props.sequenceNumberPeriod:this.props.sequenceWrapper.length>10?10:this.getSequenceNumber(this.props.sequenceWrapper.length-1).length>1?5:1}componentDidMount(){this.plugin.managers.interactivity.lociHighlights.addProvider(this.lociHighlightProvider),this.plugin.managers.interactivity.lociSelects.addProvider(this.lociSelectionProvider),this.subscribe(this.highlightQueue.pipe(mA(3*16.666,void 0,{leading:!0,trailing:!0})),t=>{const n=this.getLoci(t.seqIdx<0?void 0:t.seqIdx);this.hover(n,t.buttons,t.button,t.modifiers)})}componentWillUnmount(){super.componentWillUnmount(),this.plugin.managers.interactivity.lociHighlights.removeProvider(this.lociHighlightProvider),this.plugin.managers.interactivity.lociSelects.removeProvider(this.lociSelectionProvider)}getLoci(t){if(void 0!==t){const n=this.props.sequenceWrapper.getLoci(t);if(!Me.isEmpty(n))return n}}getSeqIdx(t){let n;const r=t.target;return r&&r.getAttribute&&(n=r.hasAttribute("data-seqid")?+r.getAttribute("data-seqid"):void 0),n}hover(t,n,r,i){const o={current:Xn.Loci.Empty,buttons:n,button:r,modifiers:i};void 0!==t&&!Me.isEmpty(t)&&(o.current={loci:t}),this.plugin.behaviors.interaction.hover.next(o)}click(t,n,r,i){const o={current:Xn.Loci.Empty,buttons:n,button:r,modifiers:i};void 0!==t&&!Me.isEmpty(t)&&(o.current={loci:t}),this.plugin.behaviors.interaction.click.next(o)}getBackgroundColor(t){return typeof t>"u"&&console.error("unexpected marker value"),0===t?"":t%2==0?"rgb(51, 255, 25)":"rgb(255, 102, 153)"}getResidueClass(t,n){return n.length>1?this.props.sequenceWrapper.residueClass(t)+(0===t?" msp-sequence-residue-long-begin":" msp-sequence-residue-long"):this.props.sequenceWrapper.residueClass(t)}residue(t,n,r){return(0,L.jsx)("span",{"data-seqid":t,style:{backgroundColor:this.getBackgroundColor(r)},className:this.getResidueClass(t,n),children:`\u200b${n}\u200b`},t)}getSequenceNumberClass(t,n,r){const i=["msp-sequence-number"];return n.startsWith("-")?i.push(r.length>1&&t>0?"msp-sequence-number-long-negative":"msp-sequence-number-negative"):r.length>1&&t>0&&i.push("msp-sequence-number-long"),i.join(" ")}getSequenceNumber(t){let n="";const r=this.props.sequenceWrapper.getLoci(t),i=Me.getFirstLocation(r,this.location);return i&&(ze.isAtomic(i.unit)?n=`${Je.residue.auth_seq_id(i)}${Je.residue.pdbx_PDB_ins_code(i)||""}`:ze.isCoarse(i.unit)&&(n=`${t+1}`)),n}padSeqNum(t){return t.length<5?t+new Array(5-t.length+1).join("\xa0"):t}getSequenceNumberSpan(t,n){const r=this.getSequenceNumber(t);return(0,L.jsx)("span",{className:this.getSequenceNumberClass(t,r,n),children:this.padSeqNum(r)},`marker-${t}`)}updateMarker(){if(!this.parentDiv.current)return;const t=this.parentDiv.current.children,{markerArray:n}=this.props.sequenceWrapper,r=!this.props.hideSequenceNumbers,i=this.sequenceNumberPeriod;let o=0;for(let s=0,a=n.length;sthis.sequence.index(s);if(Me.is(t)){if(!Xe.areRootsEquivalent(t.structure,i))return!1;t=Me.remap(t,i);for(const s of t.elements)this.unitMap.has(s.unit.id)&&(r=ze.isAtomic(s.unit)?E3t(s,n,this.markerArray,o)||r:T3t(s,n,this.markerArray,o)||r)}else if(Xe.isLoci(t)){if(!Xe.areRootsEquivalent(t.structure,i))return!1;Qh(this.markerArray,this.observed,n)&&(r=!0)}return r}getLoci(t){const n=function I3t(e,t,n){return _i.generators.atoms({unitTest:r=>Je.unit.chainGroupId(r.element)===e&&Je.unit.operator_name(r.element)===t,residueTest:r=>0===r.element.unit.kind?Je.residue.label_seq_id(r.element)===n:Je.coarse.seq_id_begin(r.element)<=n&&Je.coarse.seq_id_end(r.element)>=n})}(this.data.units[0].chainGroupId,this.data.units[0].conformation.operator.name,this.seqId(t));return Dt.toLociWithSourceUnits(Cz.run(n,this.data.structure))}constructor(t){const n=dt.create(t.structure,t.units[0],t.units[0].elements[0]),r=t.units[0].model.sequence.byEntityKey[Je.entity.key(n)],i=r.sequence.length;super(t,new Uint8Array(i),i),this.unitMap=new Map;for(const a of t.units)this.unitMap.set(a.id,a);this.sequence=r.sequence,this.missing=t.units[0].model.properties.missingResidues,this.modelNum=t.units[0].model.modelNum,this.asymId=ze.isAtomic(t.units[0])?Je.chain.label_asym_id(n):Je.coarse.asym_id(n);const s=[];for(let a=0;as[o[l]],l=>{const c=a.value(l);sP(n,r(c),t)}),!0}function T3t(e,t,n,r){const{model:i,elements:o}=e.unit,s=ze.isSpheres(e.unit)?i.coarseHierarchy.spheres.seq_id_begin:i.coarseHierarchy.gaussians.seq_id_begin,a=ze.isSpheres(e.unit)?i.coarseHierarchy.spheres.seq_id_end:i.coarseHierarchy.gaussians.seq_id_end;return Ve.forEach(e.indices,l=>{const c=o[l];for(let u=r(s.value(c)),d=r(a.value(c));u<=d;u++)sP(n,u,t)}),!0}class D3t extends SB{residueLabel(t){return this.sequence[t]}residueColor(t){return qn.black}residueClass(t){return"msp-sequence-present"}mark(t,n){let r=!1;const{structure:i}=this.data;if(Me.is(t)){if(!Xe.areRootsEquivalent(t.structure,i))return!1;t=Me.remap(t,i);for(const o of t.elements){const s=this.unitMap.get(o.unit.id);if(s){const{index:a}=o.unit.model.atomicHierarchy.residueAtomSegments;Ve.forEach(o.indices,l=>{const c=this.sequenceIndices.get(a[s.elements[l]]);void 0!==c&&Qh(this.markerArray,Pe.ofSingleton(c),n)&&(r=!0)})}}}else if(Xe.isLoci(t)){if(!Xe.areRootsEquivalent(t.structure,i))return!1;Qh(this.markerArray,Pe.ofBounds(0,this.length),n)&&(r=!0)}return r}getLoci(t){const n=[],r=this.residueIndices.get(t);if(void 0!==r){const i=this.seqToUnit.get(t),{offsets:o}=i.model.atomicHierarchy.residueAtomSegments,s=rt.findPredecessorIndex(i.elements,o[r]),a=rt.findPredecessorIndex(i.elements,o[r+1]);n.push({unit:i,indices:Pe.ofBounds(s,a)})}return Me(this.data.structure,n)}constructor(t){const n=[],r=new Map,i=new Map,o=new Map;for(let l=0,c=t.units.length;l0&&i.push(`${n} residues`),i.push(`${r} elements`),super(t,new Uint8Array(1),1),this.label=`Whole Chain (${i.join(", ")})`,this.unitIndices=s,this.loci=Me(this.data.structure,a)}}class P3t extends SB{residueLabel(t){return"X"}residueColor(t){return qn.black}residueClass(t){return"msp-sequence-present"}mark(t,n){let r=!1;const{structure:i,units:o}=this.data;if(Me.is(t)){if(!Xe.areRootsEquivalent(t.structure,i))return!1;t=Me.remap(t,i);for(const s of t.elements){const a=this.unitIndices.get(s.unit.id);a&&Ve.isSubset(a,s.indices)&&Qh(this.markerArray,s.indices,n)&&(r=!0)}}else if(Xe.isLoci(t)){if(!Xe.areRootsEquivalent(t.structure,i))return!1;for(let s=0,a=o.length;s0){const u={structure:n,units:c},d=c[0];let f;if(d.polymerElements.length){const p=dt.create(n,d,d.elements[0]),m=d.model.sequence.byEntityKey[Je.entity.key(p)];if(m&&m.sequence.length<=5e3)f=new A3t(u);else{const h=c.reduce((g,y)=>g+y.polymerElements.length,0);f=ze.isAtomic(d)||h>5e3?new WX(u):new P3t(u)}}else ze.isAtomic(d)?f=c.reduce((m,h)=>m+h.residueCount,0)>5e3?new WX(u):new D3t(u):(console.warn("should not happen, expecting coarse units to be polymeric"),f=new WX(u));return f.markResidue(t.getLoci(n),un.Select),f}return"No sequence available"}function CB(e,t=!1){const n=[],r=dt.create(e),i=new Set;for(const o of e.units){dt.set(r,e,o,o.elements[0]);const s=Je.entity.id(r),a=e.getModelIndex(o.model),l=`${a}|${s}`;if(i.has(l)||t&&"polymer"!==Je.entity.type(r))continue;let c=Je.entity.pdbx_description(r).join(", ");if(e.models.length&&(e.representativeModel?c+=` (Model ${e.models[a].modelNum})`:c.startsWith("Polymer ")&&(c+=` (${e.models[a].entry})`)),n.push([l,`${s}: ${c}`]),i.add(l),n.length>1e3)return[["","Too many entities"]]}return 0===n.length&&n.push(["","No entities"]),n}function ak(e,t){const n=[],r=dt.create(e),i=new Set,[o,s]=XX(t);for(const a of e.units){if(dt.set(r,e,a,a.elements[0]),e.getModelIndex(a.model)!==o||Je.entity.id(r)!==s)continue;const l=a.chainGroupId;if(i.has(l))continue;const c=em(r,{granularity:"chain",hidePrefix:!0,htmlStyling:!1});if(n.push([l,c]),i.add(l),n.length>1e3)return[[-1,"Too many chains"]]}return 0===n.length&&n.push([-1,"No chains"]),n}function AI(e,t,n){const r=[],i=dt.create(e),o=new Set,[s,a]=XX(t);for(const l of e.units){if(dt.set(i,e,l,l.elements[0]),e.getModelIndex(l.model)!==s||Je.entity.id(i)!==a||l.chainGroupId!==n)continue;const c=D2e(i);if(!o.has(c)&&(r.push([c,l.conformation.operator.name]),o.add(c),r.length>1e3))return[["","Too many operators"]]}return 0===r.length&&r.push(["","No operators"]),r}function k2e(e){var t;const n=[],r=[],i=e.select(Qn.Generators.rootsOfType(Se.Molecule.Structure));for(const o of i)null!==(t=o.obj)&&void 0!==t&&t.data&&(r.push(o.obj.data),n.push([o.transform.ref,o.obj.data.label]));return 0===n.length&&n.push(["","No structure"]),{options:n,all:r}}const M2e=I.Select("single",[["single","Chain"],["polymers","Polymers"],["all","Everything"]]);class M3t extends Vr{constructor(){super(...arguments),this.state={structureOptions:{options:[],all:[]},structure:Xe.Empty,structureRef:"",modelEntityId:"",chainGroupId:-1,operatorKey:"",mode:"single"},this.setParamProps=t=>{const n={...this.state};switch(t.name){case"mode":if(n.mode=t.value,this.state.mode===n.mode)return;if("all"===n.mode||"polymers"===n.mode)break;case"structure":"structure"===t.name&&(n.structureRef=t.value),n.structure=this.getStructure(n.structureRef),n.modelEntityId=CB(n.structure)[0][0],n.chainGroupId=ak(n.structure,n.modelEntityId)[0][0],n.operatorKey=AI(n.structure,n.modelEntityId,n.chainGroupId)[0][0];break;case"entity":n.modelEntityId=t.value,n.chainGroupId=ak(n.structure,n.modelEntityId)[0][0],n.operatorKey=AI(n.structure,n.modelEntityId,n.chainGroupId)[0][0];break;case"chain":n.chainGroupId=t.value,n.operatorKey=AI(n.structure,n.modelEntityId,n.chainGroupId)[0][0];break;case"operator":n.operatorKey=t.value}this.setState(n)}}componentDidMount(){this.plugin.state.data.select(Qn.Generators.rootsOfType(Se.Molecule.Structure)).length>0&&this.setState(this.getInitialState()),this.subscribe(this.plugin.state.events.object.updated,({ref:t,obj:n})=>{t===this.state.structureRef&&n&&n.type===Se.Molecule.Structure.type&&n.data!==this.state.structure&&this.sync()}),this.subscribe(this.plugin.state.events.object.created,({obj:t})=>{t&&t.type===Se.Molecule.Structure.type&&this.sync()}),this.subscribe(this.plugin.state.events.object.removed,({obj:t})=>{t&&t.type===Se.Molecule.Structure.type&&t.data===this.state.structure&&this.sync()})}sync(){IU(k2e(this.plugin.state.data).all,this.state.structureOptions.all)||this.setState(this.getInitialState())}getStructure(t){const r=this.plugin.state.data.select(t)[0];return t&&r&&r.obj?r.obj.data:Xe.Empty}getSequenceWrapper(t){return{wrapper:P2e(this.state,this.plugin.managers.structure.selection),label:`${I.optionLabel(t.chain,this.state.chainGroupId)} | ${I.optionLabel(t.entity,this.state.modelEntityId)}`}}getSequenceWrappers(t){if("single"===this.state.mode)return[this.getSequenceWrapper(t)];const n=this.getStructure(this.state.structureRef),r=[];for(const[i,o]of CB(n,"polymers"===this.state.mode))for(const[s,a]of ak(n,i))for(const[l]of AI(n,i,s))if(r.push({wrapper:P2e({structure:n,modelEntityId:i,chainGroupId:s,operatorKey:l},this.plugin.managers.structure.selection),label:`${a} | ${o}`}),r.length>30)return[];return r}getInitialState(){var t;const n=k2e(this.plugin.state.data),r=n.options[0][0],i=this.getStructure(r);let o=CB(i)[0][0],s=ak(i,o)[0][0],a=AI(i,o,s)[0][0];return this.state.structure&&this.state.structure===i&&(o=this.state.modelEntityId,s=this.state.chainGroupId,a=this.state.operatorKey),{structureOptions:n,structure:i,structureRef:r,modelEntityId:o,chainGroupId:s,operatorKey:a,mode:null!==(t=this.props.defaultMode)&&void 0!==t?t:"single"}}get params(){const{structureOptions:t,structure:n,modelEntityId:r,chainGroupId:i}=this.state,o=CB(n),s=ak(n,r),a=AI(n,r,i);return{structure:I.Select(t.options[0][0],t.options,{shortLabel:!0}),entity:I.Select(o[0][0],o,{shortLabel:!0}),chain:I.Select(s[0][0],s,{shortLabel:!0,twoColumns:!0,label:"Chain"}),operator:I.Select(a[0][0],a,{shortLabel:!0,twoColumns:!0}),mode:M2e}}get values(){return{structure:this.state.structureRef,entity:this.state.modelEntityId,chain:this.state.chainGroupId,operator:this.state.operatorKey,mode:this.state.mode}}render(){if(this.getStructure(this.state.structureRef)===Xe.Empty)return(0,L.jsx)("div",{className:"msp-sequence",children:(0,L.jsxs)("div",{className:"msp-sequence-select",children:[(0,L.jsx)(Mi,{svg:Ng,style:{cursor:"help",position:"absolute",right:0,top:0},title:"Shows a sequence of one or more chains. Use the controls to alter selection."}),(0,L.jsx)("span",{children:"Sequence"}),(0,L.jsx)("span",{style:{fontWeight:"normal"},children:"No structure available"})]})});const t=this.params,n=this.values,r=this.getSequenceWrappers(t);return(0,L.jsxs)("div",{className:"msp-sequence",children:[(0,L.jsxs)("div",{className:"msp-sequence-select",children:[(0,L.jsx)(Mi,{svg:Ng,style:{cursor:"help",position:"absolute",right:0,top:0},title:"This shows a single sequence. Use the controls to show a different sequence."}),(0,L.jsx)("span",{children:"Sequence of"}),(0,L.jsx)(jA,{title:`[Structure] ${I.optionLabel(t.structure,n.structure)}`,param:t.structure,name:"structure",value:n.structure,onChange:this.setParamProps}),(0,L.jsx)(jA,{title:"[Mode]",param:M2e,name:"mode",value:n.mode,onChange:this.setParamProps}),"single"===n.mode&&(0,L.jsx)(jA,{title:`[Entity] ${I.optionLabel(t.entity,n.entity)}`,param:t.entity,name:"entity",value:n.entity,onChange:this.setParamProps}),"single"===n.mode&&(0,L.jsx)(jA,{title:`[Chain] ${I.optionLabel(t.chain,n.chain)}`,param:t.chain,name:"chain",value:n.chain,onChange:this.setParamProps}),t.operator.options.length>1&&(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(jA,{title:`[Instance] ${I.optionLabel(t.operator,n.operator)}`,param:t.operator,name:"operator",value:n.operator,onChange:this.setParamProps})})]}),(0,L.jsx)(R3t,{children:r.map((i,o)=>{const s="string"==typeof i.wrapper?(0,L.jsx)("div",{className:"msp-sequence-wrapper",children:i.wrapper},o):(0,L.jsx)(w3t,{sequenceWrapper:i.wrapper},o);return"single"===n.mode?s:(0,L.jsxs)(Yt.Fragment,{children:[(0,L.jsx)("div",{className:"msp-sequence-chain-label",children:i.label}),s]},o)})})]})}}function R3t({children:e}){return(0,L.jsx)("div",{className:"msp-sequence-wrapper-non-empty",children:e})}const O3t=Yt.useSyncExternalStore?function F3t(e){return Yt.useSyncExternalStore(Yt.useCallback(t=>{const n=e?.pipe(f2e(1)).subscribe(t);return()=>n?.unsubscribe()},[e]),Yt.useCallback(()=>e?.value,[e]))}:function N3t(e){const[,t]=Yt.useState({}),n=Yt.useRef();return n.current=e?.value,Yt.useEffect(()=>{if(!e)return;const r=e.subscribe(i=>{n.current!==i&&t({})});return()=>r.unsubscribe()},[e]),e?.value};function cb(e){return O3t(e)}function B3t(){const e=(0,Yt.useContext)(cm),[t,n]=(0,Yt.useState)(Nc());return(0,Yt.useEffect)(()=>{const r=e.events.task.progress.subscribe(o=>{var s;const a=!(null===(s=e.spec.components)||void 0===s||!s.hideTaskOverlay);"background"===o.level&&(a||!o.useOverlay)&&n(l=>l.set(o.id,o))}),i=e.events.task.finished.subscribe(({id:o})=>{n(s=>s.delete(o))});return()=>{r.unsubscribe(),i.unsubscribe()}},[e]),(0,L.jsxs)("div",{className:"msp-background-tasks",children:[t.valueSeq().map(r=>(0,L.jsx)(R2e,{event:r},r.id)),(0,L.jsx)(L3t,{})]})}function L3t(){var e;const n=cb(null===(e=(0,Yt.useContext)(cm).canvas3d)||void 0===e?void 0:e.commitQueueSize);return n?(0,L.jsx)("div",{className:"msp-task-state",children:(0,L.jsx)("div",{children:(0,L.jsxs)("div",{children:["Commiting renderables... ",n," remaining"]})})}):null}class R2e extends Vr{constructor(){super(...arguments),this.abort=()=>{this.plugin.managers.task.requestAbort(this.props.event.progress.root.progress.taskId,"User Request")}}render(){const t=this.props.event.progress.root,n=N2e(this.props.event.progress.root)-1,r=t.progress.isIndeterminate?void 0:(0,L.jsxs)(L.Fragment,{children:["[",t.progress.current,"/",t.progress.max,"]"]}),i=n>0?(0,L.jsxs)(L.Fragment,{children:["[",n," subtask(s)]"]}):void 0;return(0,L.jsx)("div",{className:"msp-task-state",children:(0,L.jsxs)("div",{children:[t.progress.canAbort&&(0,L.jsx)(kn,{svg:Tbe,onClick:this.abort,title:"Abort"}),(0,L.jsxs)("div",{children:[t.progress.message," ",r," ",i]})]})})}}function N2e(e){if(0===e.children.length)return 1;let t=0;for(const n of e.children)t+=N2e(n);return t}function j3t(){const e=(0,Yt.useContext)(cm),[t,n]=(0,Yt.useState)(Nc());return(0,Yt.useEffect)(()=>{const r=e.events.task.progress.subscribe(o=>{o.useOverlay&&n(s=>s.set(o.id,o))}),i=e.events.task.finished.subscribe(({id:o})=>{n(s=>s.delete(o))});return()=>{r.unsubscribe(),i.unsubscribe()}},[e]),0===t.size?null:(0,L.jsx)("div",{className:"msp-overlay-tasks",children:t.valueSeq().map(r=>(0,L.jsx)(R2e,{event:r},r.id))})}class U3t extends Vr{constructor(){super(...arguments),this.hide=()=>{(this.props.entry.hide||function(){}).call(null)}}render(){const t=this.props.entry,n=(0,L.jsx)("div","string"==typeof t.message?{dangerouslySetInnerHTML:{__html:t.message}}:{children:(0,L.jsx)(t.message,{})});return(0,L.jsxs)("div",{className:"msp-toast-entry",children:[(0,L.jsx)("div",{className:"msp-toast-title",onClick:()=>this.hide(),children:t.title}),(0,L.jsx)("div",{className:"msp-toast-message",children:n}),(0,L.jsx)("div",{className:"msp-toast-clear"}),(0,L.jsx)("div",{className:"msp-toast-hide",children:(0,L.jsx)(kn,{svg:Tbe,onClick:this.hide,title:"Hide",className:"msp-no-hover-outline"})})]})}}class z3t extends Vr{componentDidMount(){this.subscribe(this.plugin.managers.toast.events.changed,()=>this.forceUpdate())}render(){const t=this.plugin.managers.toast.state;if(!t.entries.count())return null;const n=[];return t.entries.forEach((r,i)=>n.push(r)),n.sort(function(r,i){return r.serialNumber-i.serialNumber}),(0,L.jsx)("div",{className:"msp-toast-container",children:n.map(r=>(0,L.jsx)(U3t,{entry:r},r.serialNumber))})}}class V3t extends Vr{constructor(){super(...arguments),this.container=Yt.createRef(),this.state={noWebGl:!1,showLogo:!0},this.handleLogo=()=>{var t;this.setState({showLogo:!(null!==(t=this.plugin.canvas3d)&&void 0!==t&&t.reprCount.value)})}}componentDidMount(){this.container.current&&this.plugin.mount(this.container.current,{checkeredCanvasBackground:!0})?(this.handleLogo(),this.subscribe(this.plugin.canvas3d.reprCount,this.handleLogo)):this.setState({noWebGl:!0})}componentWillUnmount(){super.componentWillUnmount(),this.plugin.unmount()}renderMissing(){return this.props.noWebGl?(0,L.jsx)(this.props.noWebGl,{}):(0,L.jsx)("div",{className:"msp-no-webgl",children:(0,L.jsxs)("div",{children:[(0,L.jsx)("p",{children:(0,L.jsx)("b",{children:"WebGL does not seem to be available."})}),(0,L.jsx)("p",{children:"This can be caused by an outdated browser, graphics card driver issue, or bad weather. Sometimes, just restarting the browser helps. Also, make sure hardware acceleration is enabled in your browser."}),(0,L.jsxs)("p",{children:["For a list of supported browsers, refer to ",(0,L.jsx)("a",{href:"http://caniuse.com/#feat=webgl",target:"_blank",children:"http://caniuse.com/#feat=webgl"}),"."]})]})})}render(){if(this.state.noWebGl)return this.renderMissing();const t=this.props.logo;return(0,L.jsx)("div",{className:this.props.parentClassName||"msp-viewport",style:this.props.parentStyle,ref:this.container,children:this.state.showLogo&&t&&(0,L.jsx)(t,{})})}}const G3t=Yt.memo(e=>{const{plugin:t,cropFrameColor:n}=e,r=t.helpers.viewportScreenshot,[i,o]=(0,Yt.useState)(null),s=(0,Yt.useRef)(null),a=(0,Yt.useRef)(e);return(0,Yt.useEffect)(()=>{a.current=e},Object.values(e)),(0,Yt.useEffect)(()=>{i!==s.current&&o(s.current)}),(0,Yt.useEffect)(()=>{var l;let c=!1;const u=[];function d(g,y){g&&u.push(g.subscribe(y))}function f(){const g=a.current;!g.suspend&&s.current&&F2e(r,s.current,g.customBackground,g.borderColor,g.borderWidth),s.current||(c=!0)}const p=setInterval(()=>{c&&(c=!1,f())},125);let m;d(t.events.canvas3d.settingsUpdated,()=>c=!0),d(null===(l=t.canvas3d)||void 0===l?void 0:l.didDraw,()=>c=!0),d(t.state.data.behaviors.isUpdating,g=>{g||(c=!0)}),d(r?.behaviors.values,()=>c=!0),d(r?.behaviors.cropParams,()=>c=!0),typeof ResizeObserver<"u"&&(m=new ResizeObserver(()=>c=!0));const h=s.current;return m?.observe(h),f(),()=>{clearInterval(p),u.forEach(g=>g.unsubscribe()),m?.unobserve(h)}},[r]),(0,Yt.useLayoutEffect)(()=>{s.current&&F2e(r,s.current,e.customBackground,e.borderColor,e.borderWidth)},[...Object.values(e)]),(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)("div",{style:{position:"relative",width:"100%",height:"100%"},children:[(0,L.jsx)("canvas",{ref:s,onContextMenu:l=>{l.preventDefault(),l.stopPropagation()},style:{display:"block",width:"100%",height:"100%"}}),(0,L.jsx)(q3t,{plugin:t,canvas:i,color:n})]})})},(e,t)=>FR(e,t));function F2e(e,t,n,r,i){if(!e)return;const{canvas:o,width:s,height:a}=e.getPreview(),l=t.getContext("2d");if(!l)return;const c=t.clientWidth,u=t.clientHeight;t.width=c,t.height=u,l.clearRect(0,0,c,u);const d=B2e(s,a,c,u);if(n)l.fillStyle=n,l.fillRect(d.x,d.y,d.width,d.height);else if(e.values.transparent)for(let p=0;pd.width?d.width-p:13,m+13>d.height?d.height-m:13);if(l.drawImage(o,d.x,d.y,d.width,d.height),r&&i){const f=i;l.rect(d.x,d.y,d.width,d.height),l.rect(d.x+f,d.y+f,d.width-2*f,d.height-2*f),l.fillStyle=r,l.fill("evenodd")}}function q3t({plugin:e,canvas:t,color:n="rgba(255, 87, 45, 0.75)"}){var r;const i=e.helpers.viewportScreenshot,o=cb(i?.behaviors.values),s=cb(i?.behaviors.cropParams),a=cb(i?.behaviors.relativeCrop),l=(0,Yt.useRef)({x:0,y:0,width:0,height:0});cb("viewport"===o?.resolution.name?null===(r=e.canvas3d)||void 0===r?void 0:r.resized:void 0);const[c,u]=Yt.useState(""),[d,f]=(0,Yt.useState)([0,0]),[p,m]=(0,Yt.useState)([0,0]);if(!i||!t||!a)return null;const{width:h,height:g}=i.getSizeAndViewport(),y=B2e(h,g,t.clientWidth,t.clientHeight),v={x:y.x+Math.floor(y.width*a.x),y:y.y+Math.floor(y.height*a.y),width:Math.ceil(y.width*a.width),height:Math.ceil(y.height*a.height)},x=O2e(v),_=O2e(y);if("move"===c?(x.l+=p[0]-d[0],x.r+=p[0]-d[0],x.t+=p[1]-d[1],x.b+=p[1]-d[1]):c&&(c.indexOf("left")>=0?x.l+=p[0]-d[0]:c.indexOf("right")>=0&&(x.r+=p[0]-d[0]),c.indexOf("top")>=0?x.t+=p[1]-d[1]:c.indexOf("bottom")>=0&&(x.b+=p[1]-d[1])),x.l>x.r){const $=x.l;x.l=x.r,x.r=$}if(x.t>x.b){const $=x.t;x.t=x.b,x.b=$}x.l=Math.min(_.r-40,Math.max(_.l,x.l)),x.r=Math.max(_.l+40,Math.min(_.r,x.r)),x.t=Math.min(_.b-40,Math.max(_.t,x.t)),x.b=Math.max(_.t+40,Math.min(_.b,x.b)),v.x=x.l,v.y=x.t,v.width=x.r-x.l+1,v.height=x.b-x.t+1,l.current=v;const A=$=>{$.preventDefault(),m([$.pageX,$.pageY])},M=$=>{$.preventDefault();const V=$.touches[0];m([V.pageX,V.pageY])},E=$=>{$.preventDefault(),u($.currentTarget.getAttribute("data-drag"));const V=$.touches[0],X=[V.pageX,V.pageY];f(X),m(X),window.addEventListener("touchend",F),window.addEventListener("touchmove",M)},D=$=>{$.preventDefault(),u($.currentTarget.getAttribute("data-drag"));const V=[$.pageX,$.pageY];f(V),m(V),window.addEventListener("mouseup",T),window.addEventListener("mousemove",A)},T=()=>{window.removeEventListener("mouseup",T),window.removeEventListener("mousemove",A),R()},F=()=>{window.removeEventListener("touchend",F),window.removeEventListener("touchmove",M),R()};function R(){const $=l.current;s?.auto&&i?.behaviors.cropParams.next({...s,auto:!1}),i?.behaviors.relativeCrop.next({x:($.x-y.x)/y.width,y:($.y-y.y)/y.height,width:$.width/y.width,height:$.height/y.height}),u("");const V=[0,0];f(V),m(V)}const N=$=>{$.preventDefault(),$.stopPropagation()},z="transparent";return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("div",{"data-drag":"move",style:{position:"absolute",left:v.x,top:v.y,width:v.width,height:v.height,border:`3px solid ${n}`,cursor:"move"},onMouseDown:D,onTouchStart:E,draggable:!1,onContextMenu:N}),(0,L.jsx)("div",{"data-drag":"left",style:{position:"absolute",left:v.x-4,top:v.y+4,width:16,height:v.height-4,background:z,cursor:"w-resize"},onMouseDown:D,onTouchStart:E,draggable:!1,onContextMenu:N}),(0,L.jsx)("div",{"data-drag":"right",style:{position:"absolute",left:x.r-8,top:v.y,width:16,height:v.height-4,background:z,cursor:"w-resize"},onMouseDown:D,onTouchStart:E,draggable:!1,onContextMenu:N}),(0,L.jsx)("div",{"data-drag":"top",style:{position:"absolute",left:v.x-4,top:v.y-4,width:v.width+8,height:16,background:z,cursor:"n-resize"},onMouseDown:D,onTouchStart:E,draggable:!1,onContextMenu:N}),(0,L.jsx)("div",{"data-drag":"bottom",style:{position:"absolute",left:v.x-4,top:x.b-8,width:v.width+8,height:16,background:z,cursor:"n-resize"},onMouseDown:D,onTouchStart:E,draggable:!1,onContextMenu:N}),(0,L.jsx)("div",{"data-drag":"top, left",style:{position:"absolute",left:x.l-4,top:x.t-4,width:16,height:16,background:z,cursor:"nw-resize"},onMouseDown:D,onTouchStart:E,draggable:!1,onContextMenu:N}),(0,L.jsx)("div",{"data-drag":"bottom, right",style:{position:"absolute",left:x.r-8,top:x.b-8,width:16,height:16,background:z,cursor:"nw-resize"},onMouseDown:D,onTouchStart:E,draggable:!1,onContextMenu:N}),(0,L.jsx)("div",{"data-drag":"top, right",style:{position:"absolute",left:x.r-8,top:x.t-4,width:16,height:16,background:z,cursor:"ne-resize"},onMouseDown:D,onTouchStart:E,draggable:!1,onContextMenu:N}),(0,L.jsx)("div",{"data-drag":"bottom, left",style:{position:"absolute",left:x.l-4,top:x.b-8,width:16,height:16,background:z,cursor:"ne-resize"},onMouseDown:D,onTouchStart:E,draggable:!1,onContextMenu:N})]})}function O2e(e){return{l:e.x,t:e.y,r:e.x+e.width-1,b:e.y+e.height-1}}function B2e(e,t,n,r){const i=e/t;if(i<=n/r){const s=r*i;return{x:Math.round((n-s)/2),y:0,width:Math.round(s),height:r}}{const s=n/i;return{x:0,y:Math.round((r-s)/2),width:n,height:Math.round(s)}}}class W3t extends Vr{constructor(){var t;super(...arguments),t=this,this.state={showPreview:!0,isDisabled:!1},this.download=()=>{var n;null===(n=this.plugin.helpers.viewportScreenshot)||void 0===n||n.download(),this.props.close()},this.copy=le(function*(){var n;try{yield null===(n=t.plugin.helpers.viewportScreenshot)||void 0===n?void 0:n.copyToClipboard(),jt.Toast.Show(t.plugin,{message:"Copied to clipboard.",title:"Screenshot",timeoutMs:1500})}catch{return t.copyImg()}}),this.copyImg=le(function*(){var n;const r=yield null===(n=t.plugin.helpers.viewportScreenshot)||void 0===n?void 0:n.getImageDataUri();t.setState({imageData:r})}),this.open=n=>{!n.target.files||!n.target.files[0]||jt.State.Snapshots.OpenFile(this.plugin,{file:n.target.files[0]})}}componentDidMount(){this.subscribe(this.plugin.state.data.behaviors.isUpdating,t=>{this.setState({isDisabled:t})})}componentWillUnmount(){super.componentWillUnmount(),this.setState({imageData:void 0})}render(){var t;const n=!(null===(t=navigator.clipboard)||void 0===t||!t.write);return(0,L.jsxs)("div",{children:[this.state.showPreview&&(0,L.jsxs)("div",{className:"msp-image-preview",children:[(0,L.jsx)(G3t,{plugin:this.plugin}),(0,L.jsx)(Y3t,{plugin:this.plugin})]}),(0,L.jsxs)("div",{className:"msp-flex-row",children:[!this.state.imageData&&(0,L.jsx)(ir,{icon:kyt,onClick:n?this.copy:this.copyImg,disabled:this.state.isDisabled,children:"Copy"}),this.state.imageData&&(0,L.jsx)(ir,{onClick:()=>this.setState({imageData:void 0}),disabled:this.state.isDisabled,children:"Clear"}),(0,L.jsx)(ir,{icon:zW,onClick:this.download,disabled:this.state.isDisabled,children:"Download"})]}),this.state.imageData&&(0,L.jsxs)("div",{className:"msp-row msp-copy-image-wrapper",children:[(0,L.jsx)("div",{children:"Right click below + Copy Image"}),(0,L.jsx)("img",{src:this.state.imageData,style:{width:"100%",height:32,display:"block"}})]}),(0,L.jsx)($3t,{plugin:this.plugin,isDisabled:this.state.isDisabled}),(0,L.jsxs)(lm,{header:"State",children:[(0,L.jsx)(S2e,{onAction:this.props.close}),(0,L.jsx)(lm,{header:"Save Options",initiallyExpanded:!1,noOffset:!0,children:(0,L.jsx)(C2e,{})})]})]})}}function $3t({plugin:e,isDisabled:t}){const n=e.helpers.viewportScreenshot,r=cb(n?.behaviors.values);return n?(0,L.jsx)(vs,{params:n.params,values:r,onChangeValues:i=>n.behaviors.values.next(i),isDisabled:t}):null}function Y3t({plugin:e}){const t=e.helpers.viewportScreenshot,n=cb(t?.behaviors.cropParams);return cb(t?.behaviors.relativeCrop),t&&n?(0,L.jsxs)("div",{style:{width:"100%",height:"24px",marginTop:"8px"},children:[(0,L.jsx)(yl,{icon:Byt,title:"Auto-crop",inline:!0,isSelected:n.auto,style:{background:"transparent",float:"left",width:"auto",height:"24px",lineHeight:"24px"},toggle:()=>t.toggleAutocrop(),label:"Auto-crop "+(n.auto?"On":"Off")}),!n.auto&&(0,L.jsx)(ir,{icon:Ryt,title:"Crop",style:{background:"transparent",float:"right",height:"24px",lineHeight:"24px",width:"24px",padding:"0"},onClick:()=>t.autocrop()}),!n.auto&&!t.isFullFrame&&(0,L.jsx)(ir,{icon:Fyt,title:"Reset Crop",style:{background:"transparent",float:"right",height:"24px",lineHeight:"24px",width:"24px",padding:"0"},onClick:()=>t.resetCrop()})]}):null}class K3t extends Vr{componentDidMount(){this.plugin.canvas3d&&(this.subscribe(this.plugin.events.canvas3d.settingsUpdated,()=>this.forceUpdate()),this.subscribe(this.plugin.canvas3d.camera.stateChanged.pipe(mA(500,void 0,{leading:!0,trailing:!0})),t=>{(void 0!==t.radiusMax||void 0!==t.radius)&&this.forceUpdate()}))}render(){return this.plugin.canvas3d?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Bbt,{mapping:Q3t}),(0,L.jsx)(zX,{})]}):null}}const lk={sequence:"Sequence",log:"Log",left:"Left Panel",right:"Right Panel"},Z3t={animate:Fd.trackball.params.animate,camera:Fd.camera,background:I.Group({color:I.Color(st(16579577),{label:"Background",description:"Custom background color"}),transparent:I.Boolean(!1),style:Fd.postprocessing.params.background},{pivot:"color"}),lighting:I.Group({occlusion:Fd.postprocessing.params.occlusion,shadow:Fd.postprocessing.params.shadow,outline:Fd.postprocessing.params.outline,fog:Fd.cameraFog},{isFlat:!0}),clipping:I.Group({...Fd.cameraClipping.params},{pivot:"radius"}),layout:I.MultiSelect([],I.objectToOptions(lk)),advanced:I.Group({multiSample:Fd.multiSample,hiZ:Fd.hiZ,sharpening:Fd.postprocessing.params.sharpening,pixelScale:K_.Params.pixelScale,transparency:K_.Params.transparency})},Q3t=function X3t(e){return({values:t,update:n,apply:r})=>({params:"function"==typeof e.params?e.params:i=>e.params,getTarget:e.target,getValues:t,update(i,o){const s=e.target(o);return fy(s,a=>n(i,a,o))},apply:r||(()=>{})})}({params:e=>{var t;const n=I.clone(Z3t),r=null===(t=e.spec.components)||void 0===t?void 0:t.controls;if(r){const o=[];"none"!==r.top&&o.push(["sequence",lk.sequence]),"none"!==r.bottom&&o.push(["log",lk.log]),"none"!==r.left&&o.push(["left",lk.left]),"none"!==r.right&&o.push(["right",lk.right]),n.layout.options=o}const i=e.config.get(ei.Background.Styles)||[];return i.length>0&&Object.assign(n.background.params.style,{presets:op(i),isFlat:!1}),n},target(e){var t,n,r;const i=null===(t=e.spec.components)||void 0===t?void 0:t.controls,o=e.layout.state.regionState,s=[];"hidden"!==o.top&&(!i||"none"!==i.top)&&s.push("sequence"),"hidden"!==o.bottom&&(!i||"none"!==i.bottom)&&s.push("log"),"hidden"!==o.left&&(!i||"none"!==i.left)&&s.push("left"),"hidden"!==o.right&&(!i||"none"!==i.right)&&s.push("right");const{pixelScale:a,transparency:l}=null===(n=e.canvas3dContext)||void 0===n?void 0:n.props;return{canvas:null===(r=e.canvas3d)||void 0===r?void 0:r.props,layout:s,pixelScale:a,transparency:l}}})({values(e,t){const{canvas:n}=e;return{layout:e.layout,animate:n.trackball.animate,camera:n.camera,background:{color:n.renderer.backgroundColor,transparent:n.transparentBackground,style:n.postprocessing.background},lighting:{occlusion:n.postprocessing.occlusion,shadow:n.postprocessing.shadow,outline:n.postprocessing.outline,fog:n.cameraFog},clipping:{...n.cameraClipping},advanced:{multiSample:n.multiSample,hiZ:n.hiZ,sharpening:n.postprocessing.sharpening,pixelScale:e.pixelScale,transparency:e.transparency}}},update(e,t){const n=t.canvas;n.trackball.animate=e.animate,n.camera=e.camera,n.transparentBackground=e.background.transparent,n.renderer.backgroundColor=e.background.color,n.postprocessing.occlusion=e.lighting.occlusion,n.postprocessing.shadow=e.lighting.shadow,n.postprocessing.outline=e.lighting.outline,n.postprocessing.background=e.background.style,n.cameraFog=e.lighting.fog,n.cameraClipping={radius:e.clipping.radius,far:e.clipping.far,minNear:e.clipping.minNear},n.multiSample=e.advanced.multiSample,n.hiZ=e.advanced.hiZ,n.postprocessing.sharpening=e.advanced.sharpening,t.layout=e.layout,t.pixelScale=e.advanced.pixelScale,t.transparency=e.advanced.transparency},apply:(e,t)=>le(function*(){var n;yield jt.Canvas3D.SetSettings(t,{settings:e.canvas});const r=e.layout.indexOf("left")<0,i=fy(t.layout.state,o=>{o.regionState.top=e.layout.indexOf("sequence")>=0?"full":"hidden",o.regionState.bottom=e.layout.indexOf("log")>=0?"full":"hidden",o.regionState.left=r?"hidden":"none"===t.behaviors.layout.leftPanelTabName.value?"collapsed":"full",o.regionState.right=e.layout.indexOf("right")>=0?"full":"hidden"});yield jt.Layout.Update(t,{state:i}),r&&jt.State.SetCurrentObject(t,{state:t.state.data,ref:vr.RootRef}),null===(n=t.canvas3dContext)||void 0===n||n.setProps({pixelScale:e.pixelScale,transparency:e.transparency})})()});class J3t extends Vr{constructor(){super(...arguments),this.allCollapsedState={isSettingsExpanded:!1,isScreenshotExpanded:!1},this.state={...this.allCollapsedState,isCameraResetEnabled:!0},this.resetCamera=()=>{jt.Camera.Reset(this.plugin,{})},this.toggleSettingsExpanded=this.toggle("isSettingsExpanded"),this.toggleScreenshotExpanded=this.toggle("isScreenshotExpanded"),this.toggleControls=()=>{jt.Layout.Update(this.plugin,{state:{showControls:!this.plugin.layout.state.showControls}})},this.toggleExpanded=()=>{jt.Layout.Update(this.plugin,{state:{isExpanded:!this.plugin.layout.state.isExpanded}})},this.setSettings=t=>{jt.Canvas3D.SetSettings(this.plugin,{settings:{[t.name]:t.value}})},this.setLayout=t=>{jt.Layout.Update(this.plugin,{state:{[t.name]:t.value}})},this.screenshot=()=>{var t;null===(t=this.plugin.helpers.viewportScreenshot)||void 0===t||t.download()},this.enableCameraReset=t=>{this.setState(n=>({...n,isCameraResetEnabled:t}))}}toggle(t){return n=>{this.setState(r=>({...r,...this.allCollapsedState,[t]:!this.state[t]})),n?.currentTarget.blur()}}componentDidMount(){this.subscribe(this.plugin.events.canvas3d.settingsUpdated,()=>this.forceUpdate()),this.subscribe(this.plugin.layout.events.updated,()=>this.forceUpdate()),this.plugin.canvas3d&&this.subscribe(this.plugin.canvas3d.camera.stateChanged.pipe(mA(500,void 0,{leading:!0,trailing:!0})),t=>this.enableCameraReset(0!==t.radius&&0!==t.radiusMax))}icon(t,n,r,i=!0){return(0,L.jsx)(kn,{svg:t,toggleState:i,onClick:n,title:r,style:{background:"transparent"}})}render(){return(0,L.jsxs)("div",{className:"msp-viewport-controls",children:[(0,L.jsxs)("div",{className:"msp-viewport-controls-buttons",children:[(0,L.jsxs)("div",{className:"msp-hover-box-wrapper",children:[(0,L.jsx)("div",{className:"msp-semi-transparent-background"}),this.icon(ayt,this.resetCamera,"Reset Zoom"),(0,L.jsx)("div",{className:"msp-hover-box-body",children:(0,L.jsxs)("div",{className:"msp-flex-column",children:[(0,L.jsx)("div",{className:"msp-flex-row",children:(0,L.jsx)(ir,{onClick:()=>this.resetCamera(),disabled:!this.state.isCameraResetEnabled,title:"Set camera zoom to fit the visible scene into view",children:"Reset Zoom"})}),(0,L.jsx)("div",{className:"msp-flex-row",children:(0,L.jsx)(ir,{onClick:()=>jt.Camera.OrientAxes(this.plugin),disabled:!this.state.isCameraResetEnabled,title:"Align principal component axes of the loaded structures to the screen axes (\u201clay flat\u201d)",children:"Orient Axes"})}),(0,L.jsx)("div",{className:"msp-flex-row",children:(0,L.jsx)(ir,{onClick:()=>jt.Camera.ResetAxes(this.plugin),disabled:!this.state.isCameraResetEnabled,title:"Align Cartesian axes to the screen axes",children:"Reset Axes"})})]})}),(0,L.jsx)("div",{className:"msp-hover-box-spacer"})]}),(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{className:"msp-semi-transparent-background"}),this.icon(gyt,this.toggleScreenshotExpanded,"Screenshot / State Snapshot",this.state.isScreenshotExpanded)]}),(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{className:"msp-semi-transparent-background"}),this.plugin.config.get(ei.Viewport.ShowControls)&&this.icon(fyt,this.toggleControls,"Toggle Controls Panel",this.plugin.layout.state.showControls),this.plugin.config.get(ei.Viewport.ShowExpand)&&this.icon(qyt,this.toggleExpanded,"Toggle Expanded Viewport",this.plugin.layout.state.isExpanded),this.plugin.config.get(ei.Viewport.ShowSettings)&&this.icon(uv,this.toggleSettingsExpanded,"Settings / Controls Info",this.state.isSettingsExpanded)]}),this.plugin.config.get(ei.Viewport.ShowSelectionMode)&&(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{className:"msp-semi-transparent-background"}),(0,L.jsx)(VX,{})]})]}),this.state.isScreenshotExpanded&&(0,L.jsx)("div",{className:"msp-viewport-controls-panel",children:(0,L.jsx)(Fg,{header:"Screenshot / State",title:"Click to close.",initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.toggleScreenshotExpanded,topRightIcon:Rg,noTopMargin:!0,childrenClassName:"msp-viewport-controls-panel-controls",children:(0,L.jsx)(W3t,{close:this.toggleScreenshotExpanded})})}),this.state.isSettingsExpanded&&(0,L.jsx)("div",{className:"msp-viewport-controls-panel",children:(0,L.jsx)(Fg,{header:"Settings / Controls Info",title:"Click to close.",initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.toggleSettingsExpanded,topRightIcon:Rg,noTopMargin:!0,childrenClassName:"msp-viewport-controls-panel-controls",children:(0,L.jsx)(K3t,{})})})]})}}const eDt=()=>(0,L.jsx)("a",{className:"msp-logo",href:"https://molstar.org",target:"_blank"}),tDt=()=>(0,L.jsx)(V3t,{logo:eDt});function nDt({plugin:e}){return e.isInitialized?(0,L.jsx)(cm.Provider,{value:e,children:(0,L.jsx)(L2e,{})}):(0,L.jsx)(rDt,{plugin:e})}function rDt({plugin:e}){const[t,n]=Yt.useState({kind:"pending"});return Yt.useEffect(()=>{n({kind:"pending"});let r=!0;return e.initialized.then(()=>{r&&n({kind:"initialized"})}).catch(i=>{r&&n({kind:"error",message:`${i}`})}),()=>{r=!1}},[e]),"pending"===t.kind?null:"error"===t.kind?(0,L.jsx)("div",{className:"msp-plugin",children:(0,L.jsxs)("div",{className:"msp-plugin-init-error",children:["Initialization error: ",t.message]})}):(0,L.jsx)(cm.Provider,{value:e,children:(0,L.jsx)(L2e,{})})}class L2e extends Vr{constructor(){super(...arguments),this.onDrop=t=>{t.preventDefault();const n=[];if(t.dataTransfer.items)for(let i=0;i{const o=i.name.toLowerCase();return o.endsWith(".molx")||o.endsWith(".molj")});r.length>0?jt.State.Snapshots.OpenFile(this.plugin,{file:r[0]}):this.plugin.runTask(this.plugin.state.data.applyAction(NW,{files:n.map(i=>jr.File(i)),format:{name:"auto",params:{}},visuals:!0}))},this.onDragOver=t=>{t.preventDefault()},this.showDragOverlay=new Ao(!1),this.onDragEnter=t=>{let n=!1;if(t.dataTransfer.items&&t.dataTransfer.items.length>0){for(let r=0;rthis.forceUpdate())}region(t,n){return(0,L.jsx)("div",{className:`msp-layout-region msp-layout-${t}`,children:(0,L.jsx)("div",{className:"msp-layout-static",children:n?(0,L.jsx)(n,{}):null})})}get layoutVisibilityClassName(){var t,n;const r=this.plugin.layout.state,i=null!==(n=null===(t=this.plugin.spec.components)||void 0===t?void 0:t.controls)&&void 0!==n?n:{},o=[];return("none"===i.top||!r.showControls||"hidden"===r.regionState.top)&&o.push("msp-layout-hide-top"),"none"!==i.left&&r.showControls&&"hidden"!==r.regionState.left?"collapsed"===r.regionState.left&&o.push("msp-layout-collapse-left"):o.push("msp-layout-hide-left"),("none"===i.right||!r.showControls||"hidden"===r.regionState.right)&&o.push("msp-layout-hide-right"),("none"===i.bottom||!r.showControls||"hidden"===r.regionState.bottom)&&o.push("msp-layout-hide-bottom"),o.join(" ")}get layoutClassName(){const t=this.plugin.layout.state,n=["msp-plugin-content"];return t.isExpanded?n.push("msp-layout-expanded"):n.push("msp-layout-standard",`msp-layout-standard-${t.controlsDisplay}`),n.join(" ")}render(){var t,n,r,i,o,s,a;const l=this.plugin.layout.state,c=(null===(t=this.plugin.spec.components)||void 0===t?void 0:t.controls)||{},u=(null===(r=null===(n=this.plugin.spec.components)||void 0===n?void 0:n.viewport)||void 0===r?void 0:r.view)||aDt,d=(null===(o=null===(i=this.plugin.spec.components)||void 0===i?void 0:i.sequenceViewer)||void 0===o?void 0:o.view)||M3t;return(0,L.jsx)("div",{className:"msp-plugin",children:(0,L.jsxs)("div",{className:this.layoutClassName,onDragEnter:this.onDragEnter,children:[(0,L.jsxs)("div",{className:this.layoutVisibilityClassName,children:[this.region("main",u),l.showControls&&"none"!==c.top&&this.region("top",c.top||d),l.showControls&&"none"!==c.left&&this.region("left",c.left||x3t),l.showControls&&"none"!==c.right&&this.region("right",c.right||sDt),l.showControls&&"none"!==c.bottom&&this.region("bottom",c.bottom||lDt)]}),!(null!==(s=this.plugin.spec.components)&&void 0!==s&&s.hideTaskOverlay)&&(0,L.jsx)(j3t,{}),!(null!==(a=this.plugin.spec.components)&&void 0!==a&&a.disableDragOverlay)&&(0,L.jsx)(oDt,{plugin:this.plugin,showDragOverlay:this.showDragOverlay})]})})}}function oDt({plugin:e,showDragOverlay:t}){const n=cb(t),r=i=>{i.dataTransfer.dropEffect="copy",i.preventDefault(),i.stopPropagation()};return(0,L.jsx)("div",{className:"msp-drag-drop-overlay",style:{display:n?"flex":"none"},onDragEnter:r,onDragOver:r,onDragLeave:()=>t.next(!1),onDrop:i=>function iDt(e,t,n){e.preventDefault(),e.stopPropagation(),n.next(!1);const r=[];if(e.dataTransfer.items)for(let i=0;ithis.setState({entries:this.plugin.log.entries}))}componentDidUpdate(){this.scrollToBottom()}scrollToBottom(){const t=this.wrapper.current;t&&(t.scrollTop=t.scrollHeight-t.clientHeight-1)}render(){const n=this.state.entries,r=n.size,i=[];for(let o=Math.max(0,r-10),s=0;o{class e{set container(n){this.initialize$.next(n)}constructor(n,r){this.settingsService=n,this.pluginService=r,this.initialize$=new Fh(1);const i=this.pluginService.plugin$,o=this.settingsService.settings$;this.initialized$=this.initialize$.pipe(hn(s=>{const a=s.nativeElement;return{div:a,canvas:a.firstElementChild}}),z0(i),hn(([{div:s},a])=>((0,cDt.render)((0,Yt.createElement)(nDt,{plugin:a}),s),a)),ff(1),z0(o),hn(([s,a])=>{if(s.canvas3d){const[l,c]=gP(a["background-color"]);s.canvas3d.setProps({renderer:{backgroundColor:l,pickingAlphaThreshold:c}})}return s}))}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(cB),Rn(bI))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();function ZX(e,t){return function uDt(e,t){const n=pa.getStructureSelection(e,t);return Dt.toLociWithSourceUnits(n)}(pe.struct.generator.atomGroups({"residue-test":pe.core.set.has([pe.set(...e),pe.core.str.concat([pe.ammp("auth_asym_id"),pe.ammp("auth_seq_id"),pe.ammp("pdbx_PDB_ins_code")])])}),t)}let j2e=(()=>{class e{set loci(n){this.loci$.next(n)}set interactions(n){this.interactions$.next(n)}constructor(n,r,i,o){var s=this;this.structureService=n,this.settingsService=r,this.pluginService=i,this.canvasService=o,this.loci$=new Fh(1),this.interactions$=new Fh(1);const a=this.structureService.source$.pipe(xd(u=>null!=u));this.structure$=this.structureService.structure$.pipe(function cFe(...e){const t=Bj(e);return is((n,r)=>{const i=e.length,o=new Array(i);let s=e.map(()=>!1),a=!1;for(let l=0;l{o[l]=c,!a&&!s[l]&&(s[l]=!0,(a=s.every(ah))&&(s=null))},kv));n.subscribe(Xo(r,l=>{if(a){const c=[l,...o];r.next(t?t(...c):c)}}))})}(a),ba(([u,d])=>Is(le(function*(){const f=s.pluginService.plugin,p=yield f.builders.structure.tryCreateComponentStatic(u,"polymer",{label:d.label}),[m]=gP(s.settingsService.settings["backbone-color"]);return yield f.builders.structure.representation.addRepresentation(p,{type:"cartoon",color:"uniform",colorParams:{value:m}}),u.cell.obj.data})())),ff(1));const l=this.getLociRepresentation(),c=this.getInteractionsRepresentation();this.representation$=this.structure$.pipe(z0(this.canvasService.initialized$),z0(l),z0(c),hn(()=>{}),ff(1)),this._representation=this.representation$.subscribe()}ngOnDestroy(){this._representation.unsubscribe()}getLociRepresentation(){return this.structure$.pipe(z0(this.loci$),hn(([n,r])=>({structure:n,loci:r})),hn(({structure:n,loci:r})=>{const i=[...this.structureService.i2r.values()];return{structure:n,loci:r.map(s=>{if(s.start){s={...s,end:s.end||s.start};const a=this.structureService.r2i.get(s.chain+s.start),l=this.structureService.r2i.get(s.chain+s.end);return{...s,ids:i.slice(a,l+1)}}return{...s,ids:i.filter(a=>a.startsWith(s.chain))}})}}),ba(({structure:n,loci:r})=>{const i=[];for(const{ids:l,color:c}of r){const u=ZX(l,n),d=Qr.fromLoci(u),[f]=gP(c||this.settingsService.settings["backbone-color"]);i.push({bundle:d,color:f,clear:!1})}const o=this.pluginService.plugin,s=o.state.data.build(),a=function dDt(e,t){const n=Ea.ofBundle(e,t.root),r=Ea.merge(n);return Ea.filter(r,t)}(i,n);for(const l of o.managers.structure.hierarchy.current.structures)for(const c of l.components)for(const u of c.representations){s.to(u.cell.transform.ref).apply(at.Representation.OverpaintStructureRepresentation3DFromBundle,Ea.toBundle(a));const d=ZX([...this.structureService.i2r.values()],n),f=Qr.fromLoci(d),[p,m]=gP(this.settingsService.settings["backbone-color"]);s.to(u.cell.transform.ref).apply(at.Representation.TransparencyStructureRepresentation3DFromBundle,{layers:[{bundle:f,value:m}]})}return Is(s.commit({doNotUpdateCurrent:!0}))}))}getInteractionsRepresentation(){let n;return this.structure$.pipe(z0(this.interactions$),hn(([r,i])=>({structure:r,interactions:i})),hn(({structure:r,interactions:i})=>{const o=i.reduce((s,{from:a,to:l})=>[...s,a,l],[]);return Xe.eachAtomicHierarchyElement(r,{atom:s=>{const a=C.create(Je.atom.x(s),Je.atom.y(s),Je.atom.z(s));for(const l of o)l.coordinates||(l["atom.id"]===Je.atom.id(s)||l["chain.id"]===Je.chain.auth_asym_id(s)&&l["residue.id"]===Je.residue.auth_seq_id(s)+Je.residue.pdbx_PDB_ins_code(s)&&l["atom.name"]===Je.atom.auth_atom_id(s))&&(l.coordinates=a)}}),{structure:r,interactions:i=i.filter(({from:s,to:a})=>s.coordinates&&a.coordinates)}}),ba(({interactions:r})=>{const o=this.pluginService.plugin.state.data.build(),s=r.map(({from:l,to:c,color:u,label:d,size:f})=>({from:l.coordinates,to:c.coordinates,color:gP(u||this.settingsService.settings["interaction-color"]).at(0),size:f||this.settingsService.settings["interaction-size"],label:d}));return n&&o.delete(n),n=o.toRoot().apply(Bat,{data:s}).apply(at.Representation.ShapeRepresentation3D).ref,Is(o.commit({doNotUpdateCurrent:!0}))}),ff(1))}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(vI),Rn(cB),Rn(bI),Rn(KX))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();let U2e=(()=>{class e{set highlights(n){this.input$.next(n)}constructor(n,r){this.structureService=n,this.pluginService=r,this.input$=new Fh(1);const i=this.pluginService.plugin,o=i.behaviors.interaction.hover,s=this.structureService.structure$.pipe(z0(this.input$),hn(([l,c])=>({structure:l,highlights:c})),hn(({structure:l,highlights:c})=>{if(c){const u=[...this.structureService.i2r.values()],d=this.structureService.r2i.get(c.chain+c.start),f=this.structureService.r2i.get(c.chain+c.end);return{structure:l,highlights:{...c,ids:u.slice(d,f+1)}}}return{structure:l,highlights:{start:"",end:"",chain:"",ids:[]}}}),hn(({structure:l,highlights:c})=>{if(c.ids.length>0){const u=ZX(c.ids,l);i.managers.interactivity.lociHighlights.highlightOnly({loci:u})}}));this.output$=o.pipe(hn(l=>{if(l&&"element-loci"===l.current.loci.kind&&Me.is(l.current.loci)){const c=Me.getFirstLocation(l.current.loci);if(c){const u=Je.chain.auth_asym_id(c),p=Je.residue.auth_seq_id(c)+Je.residue.pdbx_PDB_ins_code(c);return{start:p,end:p+"",chain:u}}}}),ff(1));const a=s.pipe(function pDt(...e){return function fDt(...e){const t=$C(e),n=Wre(e,1/0);return e=Qie(e),is((r,i)=>{Ux(n)(Is([r,...e],t)).subscribe(i)})}(...e)}(this.output$),hn(()=>{}));this._highlights=a.subscribe()}ngOnDestroy(){this._highlights.unsubscribe()}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(vI),Rn(bI))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();const hDt=["container"];let mDt=(()=>{class e{set container(n){this.canvasService.container=n}set source(n){this.structureService.source=n}set loci(n){this.representationService.loci=n}set interactions(n){this.representationService.interactions=n}set settings(n){this.settingsService.settings=n}set highlights(n){this.highlightService.highlights=n}constructor(n,r,i,o,s,a){this.representationService=n,this.highlightService=r,this.structureService=i,this.settingsService=o,this.pluginService=s,this.canvasService=a,this.highlights$=this.highlightService.output$}static#e=this.\u0275fac=function(r){return new(r||e)(On(j2e),On(U2e),On(vI),On(cB),On(bI),On(KX))};static#t=this.\u0275cmp=$d({type:e,selectors:[["ngx-structure-viewer"]],viewQuery:function(r,i){if(1&r&&F8(hDt,5),2&r){let o;MT(o=RT())&&(i.container=o.first)}},inputs:{source:"source",loci:"loci",interactions:"interactions",settings:"settings",highlights:"highlights"},outputs:{highlights$:"highlights"},standalone:!0,features:[NT([j2e,U2e,vI,cB,bI,KX]),Dh],decls:4,vars:0,consts:[["container",""],["canvas",""],[1,"ngx-structure-viewer-container"],[1,"ngx-structure-viewer-canvas"]],template:function(r,i){1&r&&(br(0,"div",2,0),js(2,"canvas",3,1),Sr())},dependencies:[L0],styles:[".msp-plugin{font-family:Helvetica Neue,Segoe UI,Helvetica,Source Sans Pro,Arial,sans-serif;font-size:14px;line-height:1.42857143;position:absolute;inset:0;background:#111318}.msp-plugin *{box-sizing:border-box}.msp-plugin [hidden],.msp-plugin template{display:none}.msp-plugin a{background-color:transparent}.msp-plugin a:active,.msp-plugin a:hover{outline:0}.msp-plugin abbr[title]{border-bottom:1px dotted}.msp-plugin b,.msp-plugin strong{font-weight:700}.msp-plugin small{font-size:80%}.msp-plugin img{border:0}.msp-plugin svg:not(:root){overflow:hidden}.msp-plugin button,.msp-plugin input,.msp-plugin optgroup,.msp-plugin select,.msp-plugin textarea{color:inherit;font:inherit;margin:0}.msp-plugin button{overflow:visible}.msp-plugin button,.msp-plugin select{text-transform:none}.msp-plugin button,.msp-plugin html input[type=button],.msp-plugin input[type=reset],.msp-plugin input[type=submit]{-webkit-appearance:button;cursor:pointer}.msp-plugin button[disabled],.msp-plugin html input[disabled]{cursor:default}.msp-plugin button::-moz-focus-inner,.msp-plugin input::-moz-focus-inner{border:0;padding:0}.msp-plugin input{line-height:normal}.msp-plugin input[type=checkbox],.msp-plugin input[type=radio]{box-sizing:border-box;padding:0}.msp-plugin input[type=number]::-webkit-inner-spin-button,.msp-plugin input[type=number]::-webkit-outer-spin-button{height:auto}.msp-plugin textarea{overflow:auto}.msp-plugin .msp-layout-expanded,.msp-plugin .msp-layout-standard{inset:0}.msp-plugin .msp-layout-standard{border:1px solid #313645}.msp-plugin .msp-layout-region{overflow:hidden}.msp-plugin .msp-layout-static,.msp-plugin .msp-layout-scrollable{position:absolute}.msp-plugin .msp-scrollable{overflow-y:auto}.msp-plugin .msp-scrollable-container{position:absolute;inset:0;overflow-y:auto}.msp-plugin .msp-layout-static{overflow:hidden}.msp-plugin .msp-layout-top .msp-layout-static,.msp-plugin .msp-layout-main .msp-layout-static,.msp-plugin .msp-layout-bottom .msp-layout-static,.msp-plugin .msp-layout-right .msp-layout-static{inset:0}.msp-plugin .msp-layout-right .msp-layout-scrollable{inset:43px 0 0}.msp-plugin .msp-layout-left .msp-layout-static{inset:0}.msp-plugin .msp-layout-standard-outside{position:absolute}.msp-plugin .msp-layout-standard-outside .msp-layout-main{position:absolute;inset:0}.msp-plugin .msp-layout-standard-outside .msp-layout-top{position:absolute;right:0;height:97px;top:-97px;width:50%;border-left:1px solid #313645;border-bottom:1px solid #313645}.msp-plugin .msp-layout-standard-outside .msp-layout-bottom{position:absolute;left:0;right:0;height:97px;top:-97px;width:50%;border-bottom:1px solid #313645}.msp-plugin .msp-layout-standard-outside .msp-layout-right{position:absolute;width:50%;right:0;bottom:-295px;height:295px;border-left:1px solid #313645;border-top:1px solid #313645}.msp-plugin .msp-layout-standard-outside .msp-layout-left{position:absolute;width:50%;left:0;bottom:-295px;height:295px;border-top:1px solid #313645}.msp-plugin .msp-layout-standard-outside .msp-layout-hide-right .msp-layout-right{display:none}.msp-plugin .msp-layout-standard-outside .msp-layout-hide-right .msp-layout-left{width:100%}.msp-plugin .msp-layout-standard-outside .msp-layout-hide-left .msp-layout-left{display:none}.msp-plugin .msp-layout-standard-outside .msp-layout-hide-left .msp-layout-right{width:100%;border-left:none}.msp-plugin .msp-layout-standard-outside .msp-layout-collapse-left .msp-layout-left{width:32px}.msp-plugin .msp-layout-standard-outside .msp-layout-collapse-left .msp-layout-right{left:32px;width:auto}.msp-plugin .msp-layout-standard-outside .msp-layout-hide-top .msp-layout-top{display:none}.msp-plugin .msp-layout-standard-outside .msp-layout-hide-top .msp-layout-bottom{width:100%;border-left:none}.msp-plugin .msp-layout-standard-outside .msp-layout-hide-bottom .msp-layout-bottom{display:none}.msp-plugin .msp-layout-standard-outside .msp-layout-hide-bottom .msp-layout-top{width:100%;border-left:none}.msp-plugin .msp-layout-standard-landscape{position:absolute}.msp-plugin .msp-layout-standard-landscape .msp-layout-main{position:absolute;inset:100px 300px 70px 330px}.msp-plugin .msp-layout-standard-landscape .msp-layout-top{position:absolute;left:330px;right:300px;height:100px;top:0;border-bottom:1px solid #313645}.msp-plugin .msp-layout-standard-landscape .msp-layout-bottom{position:absolute;left:330px;right:300px;height:70px;bottom:0;border-top:1px solid #313645}.msp-plugin .msp-layout-standard-landscape .msp-layout-right{position:absolute;width:300px;right:0;bottom:0;top:0;border-left:1px solid #313645}.msp-plugin .msp-layout-standard-landscape .msp-layout-left{position:absolute;width:330px;left:0;bottom:0;top:0;border-right:1px solid #313645}.msp-plugin .msp-layout-standard-landscape .msp-layout-hide-right .msp-layout-right{display:none}.msp-plugin .msp-layout-standard-landscape .msp-layout-hide-right .msp-layout-main,.msp-plugin .msp-layout-standard-landscape .msp-layout-hide-right .msp-layout-top,.msp-plugin .msp-layout-standard-landscape .msp-layout-hide-right .msp-layout-bottom{right:0}.msp-plugin .msp-layout-standard-landscape .msp-layout-hide-left .msp-layout-left{display:none}.msp-plugin .msp-layout-standard-landscape .msp-layout-hide-left .msp-layout-main,.msp-plugin .msp-layout-standard-landscape .msp-layout-hide-left .msp-layout-top,.msp-plugin .msp-layout-standard-landscape .msp-layout-hide-left .msp-layout-bottom{left:0}.msp-plugin .msp-layout-standard-landscape .msp-layout-collapse-left .msp-layout-left{width:32px}.msp-plugin .msp-layout-standard-landscape .msp-layout-collapse-left .msp-layout-main,.msp-plugin .msp-layout-standard-landscape .msp-layout-collapse-left .msp-layout-top,.msp-plugin .msp-layout-standard-landscape .msp-layout-collapse-left .msp-layout-bottom{left:32px}.msp-plugin .msp-layout-standard-landscape .msp-layout-hide-bottom .msp-layout-bottom{display:none}.msp-plugin .msp-layout-standard-landscape .msp-layout-hide-bottom .msp-layout-main{bottom:0}.msp-plugin .msp-layout-standard-landscape .msp-layout-hide-top .msp-layout-top{display:none}.msp-plugin .msp-layout-standard-landscape .msp-layout-hide-top .msp-layout-main{top:0}.msp-plugin .msp-layout-standard-portrait{position:absolute}.msp-plugin .msp-layout-standard-portrait .msp-layout-main{position:absolute;inset:97px 0 361px}.msp-plugin .msp-layout-standard-portrait .msp-layout-top{position:absolute;right:0;height:97px;top:0;width:50%;border-left:1px solid #313645;border-bottom:1px solid #313645}.msp-plugin .msp-layout-standard-portrait .msp-layout-bottom{position:absolute;left:0;right:0;height:97px;width:50%;border-bottom:1px solid #313645}.msp-plugin .msp-layout-standard-portrait .msp-layout-right{position:absolute;width:50%;right:0;bottom:0;height:361px;border-left:1px solid #313645;border-top:1px solid #313645}.msp-plugin .msp-layout-standard-portrait .msp-layout-left{position:absolute;width:50%;left:0;bottom:0;height:361px;border-top:1px solid #313645}.msp-plugin .msp-layout-standard-portrait .msp-layout-hide-right .msp-layout-right{display:none}.msp-plugin .msp-layout-standard-portrait .msp-layout-hide-right .msp-layout-left{width:100%}.msp-plugin .msp-layout-standard-portrait .msp-layout-hide-left .msp-layout-left{display:none}.msp-plugin .msp-layout-standard-portrait .msp-layout-hide-left .msp-layout-right{width:100%;border-left:none}.msp-plugin .msp-layout-standard-portrait .msp-layout-hide-right.msp-layout-hide-left .msp-layout-main{bottom:0}.msp-plugin .msp-layout-standard-portrait .msp-layout-collapse-left .msp-layout-left{width:32px}.msp-plugin .msp-layout-standard-portrait .msp-layout-collapse-left .msp-layout-right{left:32px;width:auto}.msp-plugin .msp-layout-standard-portrait .msp-layout-hide-top .msp-layout-top{display:none}.msp-plugin .msp-layout-standard-portrait .msp-layout-hide-top .msp-layout-bottom{width:100%;border-left:none}.msp-plugin .msp-layout-standard-portrait .msp-layout-hide-bottom .msp-layout-bottom{display:none}.msp-plugin .msp-layout-standard-portrait .msp-layout-hide-bottom .msp-layout-top{width:100%;border-left:none}.msp-plugin .msp-layout-standard-portrait .msp-layout-hide-top.msp-layout-hide-bottom .msp-layout-main{top:0}.msp-plugin .msp-layout-standard-reactive{position:absolute}@media (orientation: landscape),(min-width: 1000px){.msp-plugin .msp-layout-standard-reactive .msp-layout-main{position:absolute;inset:100px 300px 70px 330px}.msp-plugin .msp-layout-standard-reactive .msp-layout-top{position:absolute;left:330px;right:300px;height:100px;top:0;border-bottom:1px solid #313645}.msp-plugin .msp-layout-standard-reactive .msp-layout-bottom{position:absolute;left:330px;right:300px;height:70px;bottom:0;border-top:1px solid #313645}.msp-plugin .msp-layout-standard-reactive .msp-layout-right{position:absolute;width:300px;right:0;bottom:0;top:0;border-left:1px solid #313645}.msp-plugin .msp-layout-standard-reactive .msp-layout-left{position:absolute;width:330px;left:0;bottom:0;top:0;border-right:1px solid #313645}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-right .msp-layout-right{display:none}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-right .msp-layout-main,.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-right .msp-layout-top,.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-right .msp-layout-bottom{right:0}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-left .msp-layout-left{display:none}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-left .msp-layout-main,.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-left .msp-layout-top,.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-left .msp-layout-bottom{left:0}.msp-plugin .msp-layout-standard-reactive .msp-layout-collapse-left .msp-layout-left{width:32px}.msp-plugin .msp-layout-standard-reactive .msp-layout-collapse-left .msp-layout-main,.msp-plugin .msp-layout-standard-reactive .msp-layout-collapse-left .msp-layout-top,.msp-plugin .msp-layout-standard-reactive .msp-layout-collapse-left .msp-layout-bottom{left:32px}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-bottom .msp-layout-bottom{display:none}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-bottom .msp-layout-main{bottom:0}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-top .msp-layout-top{display:none}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-top .msp-layout-main{top:0}}@media (orientation: portrait) and (max-width: 1000px){.msp-plugin .msp-layout-standard-reactive .msp-layout-main{position:absolute;inset:97px 0 361px}.msp-plugin .msp-layout-standard-reactive .msp-layout-top{position:absolute;right:0;height:97px;top:0;width:50%;border-left:1px solid #313645;border-bottom:1px solid #313645}.msp-plugin .msp-layout-standard-reactive .msp-layout-bottom{position:absolute;left:0;right:0;height:97px;width:50%;border-bottom:1px solid #313645}.msp-plugin .msp-layout-standard-reactive .msp-layout-right{position:absolute;width:50%;right:0;bottom:0;height:361px;border-left:1px solid #313645;border-top:1px solid #313645}.msp-plugin .msp-layout-standard-reactive .msp-layout-left{position:absolute;width:50%;left:0;bottom:0;height:361px;border-top:1px solid #313645}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-right .msp-layout-right{display:none}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-right .msp-layout-left{width:100%}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-left .msp-layout-left{display:none}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-left .msp-layout-right{width:100%;border-left:none}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-right.msp-layout-hide-left .msp-layout-main{bottom:0}.msp-plugin .msp-layout-standard-reactive .msp-layout-collapse-left .msp-layout-left{width:32px}.msp-plugin .msp-layout-standard-reactive .msp-layout-collapse-left .msp-layout-right{left:32px;width:auto}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-top .msp-layout-top{display:none}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-top .msp-layout-bottom{width:100%;border-left:none}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-bottom .msp-layout-bottom{display:none}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-bottom .msp-layout-top{width:100%;border-left:none}.msp-plugin .msp-layout-standard-reactive .msp-layout-hide-top.msp-layout-hide-bottom .msp-layout-main{top:0}}.msp-plugin .msp-layout-expanded{position:fixed}@media (orientation: landscape){.msp-plugin .msp-layout-expanded .msp-layout-main{position:absolute;inset:100px 300px 70px 330px}.msp-plugin .msp-layout-expanded .msp-layout-top{position:absolute;left:330px;right:300px;height:100px;top:0;border-bottom:1px solid #313645}.msp-plugin .msp-layout-expanded .msp-layout-bottom{position:absolute;left:330px;right:300px;height:70px;bottom:0;border-top:1px solid #313645}.msp-plugin .msp-layout-expanded .msp-layout-right{position:absolute;width:300px;right:0;bottom:0;top:0;border-left:1px solid #313645}.msp-plugin .msp-layout-expanded .msp-layout-left{position:absolute;width:330px;left:0;bottom:0;top:0;border-right:1px solid #313645}.msp-plugin .msp-layout-expanded .msp-layout-hide-right .msp-layout-right{display:none}.msp-plugin .msp-layout-expanded .msp-layout-hide-right .msp-layout-main,.msp-plugin .msp-layout-expanded .msp-layout-hide-right .msp-layout-top,.msp-plugin .msp-layout-expanded .msp-layout-hide-right .msp-layout-bottom{right:0}.msp-plugin .msp-layout-expanded .msp-layout-hide-left .msp-layout-left{display:none}.msp-plugin .msp-layout-expanded .msp-layout-hide-left .msp-layout-main,.msp-plugin .msp-layout-expanded .msp-layout-hide-left .msp-layout-top,.msp-plugin .msp-layout-expanded .msp-layout-hide-left .msp-layout-bottom{left:0}.msp-plugin .msp-layout-expanded .msp-layout-collapse-left .msp-layout-left{width:32px}.msp-plugin .msp-layout-expanded .msp-layout-collapse-left .msp-layout-main,.msp-plugin .msp-layout-expanded .msp-layout-collapse-left .msp-layout-top,.msp-plugin .msp-layout-expanded .msp-layout-collapse-left .msp-layout-bottom{left:32px}.msp-plugin .msp-layout-expanded .msp-layout-hide-bottom .msp-layout-bottom{display:none}.msp-plugin .msp-layout-expanded .msp-layout-hide-bottom .msp-layout-main{bottom:0}.msp-plugin .msp-layout-expanded .msp-layout-hide-top .msp-layout-top{display:none}.msp-plugin .msp-layout-expanded .msp-layout-hide-top .msp-layout-main{top:0}}@media (orientation: portrait){.msp-plugin .msp-layout-expanded .msp-layout-main{position:absolute;inset:97px 0 361px}.msp-plugin .msp-layout-expanded .msp-layout-top{position:absolute;right:0;height:97px;top:0;width:50%;border-left:1px solid #313645;border-bottom:1px solid #313645}.msp-plugin .msp-layout-expanded .msp-layout-bottom{position:absolute;left:0;right:0;height:97px;width:50%;border-bottom:1px solid #313645}.msp-plugin .msp-layout-expanded .msp-layout-right{position:absolute;width:50%;right:0;bottom:0;height:361px;border-left:1px solid #313645;border-top:1px solid #313645}.msp-plugin .msp-layout-expanded .msp-layout-left{position:absolute;width:50%;left:0;bottom:0;height:361px;border-top:1px solid #313645}.msp-plugin .msp-layout-expanded .msp-layout-hide-right .msp-layout-right{display:none}.msp-plugin .msp-layout-expanded .msp-layout-hide-right .msp-layout-left{width:100%}.msp-plugin .msp-layout-expanded .msp-layout-hide-left .msp-layout-left{display:none}.msp-plugin .msp-layout-expanded .msp-layout-hide-left .msp-layout-right{width:100%;border-left:none}.msp-plugin .msp-layout-expanded .msp-layout-hide-right.msp-layout-hide-left .msp-layout-main{bottom:0}.msp-plugin .msp-layout-expanded .msp-layout-collapse-left .msp-layout-left{width:32px}.msp-plugin .msp-layout-expanded .msp-layout-collapse-left .msp-layout-right{left:32px;width:auto}.msp-plugin .msp-layout-expanded .msp-layout-hide-top .msp-layout-top{display:none}.msp-plugin .msp-layout-expanded .msp-layout-hide-top .msp-layout-bottom{width:100%;border-left:none}.msp-plugin .msp-layout-expanded .msp-layout-hide-bottom .msp-layout-bottom{display:none}.msp-plugin .msp-layout-expanded .msp-layout-hide-bottom .msp-layout-top{width:100%;border-left:none}.msp-plugin .msp-layout-expanded .msp-layout-hide-top.msp-layout-hide-bottom .msp-layout-main{top:0}}.msp-plugin ::-webkit-scrollbar{width:10px;height:10px}.msp-plugin ::-webkit-scrollbar-track{border-radius:0;background-color:#16191f}.msp-plugin ::-webkit-scrollbar-thumb{border-radius:0;background-color:#0e0f14}.msp-plugin .msp-form-control,.msp-plugin .msp-control-row select,.msp-plugin .msp-control-row button,.msp-plugin .msp-control-row input[type=text],.msp-plugin .msp-btn{display:block;width:100%;background:#0c0d11;border:none;padding:0 10px;line-height:30px;height:32px;appearance:none;box-shadow:none;background-image:none}.msp-plugin .msp-form-control::-moz-placeholder,.msp-plugin .msp-control-row select::-moz-placeholder,.msp-plugin .msp-control-row button::-moz-placeholder,.msp-plugin .msp-control-row input[type=text]::-moz-placeholder,.msp-plugin .msp-btn::-moz-placeholder{color:#637ca0;opacity:1}.msp-plugin .msp-form-control:-ms-input-placeholder,.msp-plugin .msp-control-row select:-ms-input-placeholder,.msp-plugin .msp-control-row button:-ms-input-placeholder,.msp-plugin .msp-control-row input[type=text]:-ms-input-placeholder,.msp-plugin .msp-btn:-ms-input-placeholder{color:#637ca0}.msp-plugin .msp-form-control::-webkit-input-placeholder,.msp-plugin .msp-control-row select::-webkit-input-placeholder,.msp-plugin .msp-control-row button::-webkit-input-placeholder,.msp-plugin .msp-control-row input[type=text]::-webkit-input-placeholder,.msp-plugin .msp-btn::-webkit-input-placeholder{color:#637ca0}.msp-plugin .msp-form-control:hover,.msp-plugin .msp-control-row select:hover,.msp-plugin .msp-control-row button:hover,.msp-plugin .msp-control-row input[type=text]:hover,.msp-plugin .msp-btn:hover{color:#51a2fb;background-color:#16191f;border:none;outline-offset:-1px!important;outline:1px solid #363c4c!important}.msp-plugin .msp-form-control:active,.msp-plugin .msp-control-row select:active,.msp-plugin .msp-control-row button:active,.msp-plugin .msp-control-row input[type=text]:active,.msp-plugin .msp-btn:active,.msp-plugin .msp-form-control:focus,.msp-plugin .msp-control-row select:focus,.msp-plugin .msp-control-row button:focus,.msp-plugin .msp-control-row input[type=text]:focus,.msp-plugin .msp-btn:focus{color:#ccd4e0;background-color:#0c0d11;border:none;outline-offset:0;outline:none}.msp-plugin .msp-form-control[disabled],.msp-plugin .msp-control-row select[disabled],.msp-plugin .msp-control-row button[disabled],.msp-plugin .msp-control-row input[disabled][type=text],.msp-plugin [disabled].msp-btn,.msp-plugin .msp-form-control[readonly],.msp-plugin .msp-control-row select[readonly],.msp-plugin .msp-control-row button[readonly],.msp-plugin .msp-control-row input[readonly][type=text],.msp-plugin [readonly].msp-btn,fieldset[disabled] .msp-plugin .msp-form-control,fieldset[disabled] .msp-plugin .msp-control-row select,fieldset[disabled] .msp-plugin .msp-control-row button,fieldset[disabled] .msp-plugin .msp-control-row input[type=text],fieldset[disabled] .msp-plugin .msp-btn{background:#111318;opacity:.35}.msp-plugin .msp-btn,.msp-plugin .msp-control-row button{display:inline-block;margin-bottom:0;text-align:center;touch-action:manipulation;cursor:pointer;background-image:none;white-space:nowrap;-webkit-user-select:none;user-select:none;padding:0 10px;line-height:32px;border:none;box-sizing:border-box}.msp-plugin .msp-btn[disabled],.msp-plugin .msp-control-row button[disabled]{background:#111318;opacity:.35}.msp-plugin .msp-btn-block,.msp-plugin .msp-control-row button{display:block;width:100%}.msp-plugin .msp-btn,.msp-plugin .msp-control-row button,.msp-plugin .msp-btn:active,.msp-plugin .msp-btn-link:focus,.msp-plugin .msp-btn:hover{outline:none}.msp-plugin .msp-material-icon svg{display:inline-flex;vertical-align:middle;font-size:1.2em;margin-bottom:3px;fill:currentColor;width:1em;height:1em;flex-shrink:0;-webkit-user-select:none;user-select:none}.msp-plugin .msp-btn-block>.msp-material-icon,.msp-plugin .msp-control-row button>.msp-material-icon{margin-left:0;margin-right:.4em}.msp-plugin .msp-btn-childless>.msp-material-icon{margin-left:0;margin-right:0}.msp-plugin .msp-btn-icon{border:none;height:32px;width:32px;line-height:32px;padding:0;text-align:center}.msp-plugin .msp-btn-icon:hover{color:#51a2fb;background-color:#16191f;border:none;outline-offset:-1px!important;outline:1px solid #363c4c!important}.msp-plugin .msp-btn-icon[disabled],.msp-plugin .msp-btn-icon[disabled]:hover,.msp-plugin .msp-btn-icon[disabled]:active{color:#637ca0}.msp-plugin .msp-btn-icon-small{border:none;height:32px;width:20px;line-height:32px;padding:0;text-align:center}.msp-plugin .msp-btn-icon-small:hover{color:#51a2fb;background-color:#16191f;border:none;outline-offset:-1px!important;outline:1px solid #363c4c!important}.msp-plugin .msp-btn-icon-small[disabled],.msp-plugin .msp-btn-icon-small[disabled]:hover,.msp-plugin .msp-btn-icon-small[disabled]:active{color:#637ca0}.msp-plugin .msp-btn-link{font-weight:400;border-radius:0}.msp-plugin .msp-btn-link,.msp-plugin .msp-btn-link:active,.msp-plugin .msp-btn-link.active,.msp-plugin .msp-btn-link[disabled],fieldset[disabled] .msp-plugin .msp-btn-link{background-color:transparent;box-shadow:none}.msp-plugin .msp-btn-link,.msp-plugin .msp-btn-link:hover,.msp-plugin .msp-btn-link:focus,.msp-plugin .msp-btn-link:active{border-color:transparent}.msp-plugin .msp-btn-link:hover,.msp-plugin .msp-btn-link:focus{text-decoration:none;background-color:transparent}.msp-plugin .msp-btn-link[disabled]:hover,.msp-plugin .msp-btn-link[disabled]:focus,fieldset[disabled] .msp-plugin .msp-btn-link:hover,fieldset[disabled] .msp-plugin .msp-btn-link:focus{text-decoration:none}.msp-plugin .msp-btn-link .msp-icon{font-size:100%}.msp-plugin .msp-btn-link,.msp-plugin .msp-btn-link:active,.msp-plugin .msp-btn-link:focus{color:#ccd4e0;text-decoration:none}.msp-plugin .msp-btn-link:hover{color:#51a2fb;text-decoration:none}.msp-plugin .msp-btn-link-toggle-on{color:#ccd4e0}.msp-plugin .msp-btn-link-toggle-off,.msp-plugin .msp-btn-link-toggle-off:active,.msp-plugin .msp-btn-link-toggle-off:focus{color:#637ca0!important}.msp-plugin .msp-btn-link-toggle-off:hover,.msp-plugin .msp-btn-link-toggle-on:hover{color:#51a2fb!important}.msp-plugin .msp-btn-action,.msp-plugin .msp-btn-action:active,.msp-plugin .msp-btn-action:focus{color:#ccd4e0;background:#0c0d11}.msp-plugin .msp-btn-action:hover{color:#51a2fb;background:#060709}.msp-plugin .msp-btn-action[disabled],.msp-plugin .msp-btn-action[disabled]:hover,.msp-plugin .msp-btn-action[disabled]:active,.msp-plugin .msp-btn-action[disabled]:focus{color:#c9d1de}.msp-plugin .msp-btn-commit-on,.msp-plugin .msp-btn-commit-on:active,.msp-plugin .msp-btn-commit-on:focus{color:#68befd;background:#0d0e12}.msp-plugin .msp-btn-commit-on:hover{color:#51a2fb;background:#07080b}.msp-plugin .msp-btn-commit-on[disabled],.msp-plugin .msp-btn-commit-on[disabled]:hover,.msp-plugin .msp-btn-commit-on[disabled]:active,.msp-plugin .msp-btn-commit-on[disabled]:focus{color:#63bcfd}.msp-plugin .msp-btn-commit-off,.msp-plugin .msp-btn-commit-off:active,.msp-plugin .msp-btn-commit-off:focus{color:#ccd4e0;background:#090a0c}.msp-plugin .msp-btn-commit-off:hover{color:#51a2fb;background:#030405}.msp-plugin .msp-btn-commit-off[disabled],.msp-plugin .msp-btn-commit-off[disabled]:hover,.msp-plugin .msp-btn-commit-off[disabled]:active,.msp-plugin .msp-btn-commit-off[disabled]:focus{color:#c9d1de}.msp-plugin .msp-btn-remove:hover{color:#f2f4f7}.msp-plugin .msp-btn-commit-on:hover{color:#0393fc}.msp-plugin .msp-btn-action{height:32px;line-height:32px}.msp-plugin input[type=file]{display:block}.msp-plugin input[type=range]{display:block;width:100%}.msp-plugin select[multiple],.msp-plugin select[size],.msp-plugin textarea.msp-form-control,.msp-plugin textarea.msp-btn{height:auto}.msp-plugin .msp-control-top-offset{margin-top:1px}.msp-plugin .msp-btn-commit{text-align:right;padding:0 10px 0 0;line-height:32px;border:none;overflow:hidden;font-weight:700}.msp-plugin .msp-btn-commit .msp-icon{display:block-inline;line-height:32px;width:32px;text-align:center}.msp-plugin select.msp-form-control,.msp-plugin .msp-control-row select,.msp-plugin select.msp-btn{background:none;background-color:#0c0d11;background-size:8px 12px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAUCAMAAACzvE1FAAAADFBMVEUzMzMzMzMzMzMzMzMKAG/3AAAAA3RSTlMAf4C/aSLHAAAAPElEQVR42q3NMQ4AIAgEQTn//2cLdRKppSGzBYwzVXvznNWs8C58CiussPJj8h6NwgorrKRdTvuV9v16Afn0AYFOB7aYAAAAAElFTkSuQmCC);background-repeat:no-repeat;background-position:right 10px center;padding-right:24px}.msp-plugin select.msp-form-control:-moz-focusring,.msp-plugin .msp-control-row select:-moz-focusring,.msp-plugin select.msp-btn:-moz-focusring{color:transparent;text-shadow:0 0 0 #ccd4e0}.msp-plugin .msp-default-bg{background:#111318}.msp-plugin .msp-transparent-bg{background:transparent}.msp-plugin .msp-no-hover-outline:hover{color:#51a2fb;background-color:inherit;border:none;outline-offset:0!important;outline:none!important}.msp-plugin .msp-icon-inline{margin-right:8px}.msp-plugin .msp-control-row{position:relative;height:32px;background:#111318;margin-top:1px}.msp-plugin .msp-control-row>span.msp-control-row-label,.msp-plugin .msp-control-row>button.msp-control-button-label{line-height:32px;display:block;width:120px;text-align:right;padding:0 10px;color:#9cacc3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;position:relative;-webkit-user-select:none;-o-user-select:none;user-select:none;cursor:default}.msp-plugin .msp-control-row>button.msp-control-button-label{background:#111318;cursor:pointer}.msp-plugin .msp-control-row .msp-control-current{background:#111318}.msp-plugin .msp-control-row>div.msp-control-row-ctrl{position:absolute;inset:0 0 0 120px}.msp-plugin .msp-control-row>div{background:#0c0d11}.msp-plugin .msp-control-row>.msp-flex-row,.msp-plugin .msp-control-row>.msp-state-image-row{background:#111318}.msp-plugin .msp-control-label-short>span{width:80px!important}.msp-plugin .msp-control-label-short>div:nth-child(2){left:80px!important}.msp-plugin .msp-control-col-2{float:left;width:50%}.msp-plugin .msp-control-twoline{height:64px!important}.msp-plugin .msp-control-group{position:relative}.msp-plugin .msp-toggle-button .msp-icon{display:inline-block;margin-right:6px}.msp-plugin .msp-toggle-button>div>button:hover{border-color:#16191f!important;border:none;outline-offset:-1px!important;outline:1px solid #363c4c!important}.msp-plugin .msp-slider>div:first-child{position:absolute;inset:0 62px 0 18px;display:flex}.msp-plugin .msp-slider>div:last-child{position:absolute;height:32px;line-height:32px;text-align:center;right:0;width:50px;top:0;bottom:0}.msp-plugin .msp-slider input[type=text]{padding-right:6px;padding-left:4px;font-size:80%;text-align:right}.msp-plugin .msp-slider2>div:first-child{position:absolute;height:32px;line-height:32px;text-align:center;left:0;width:25px;top:0;bottom:0;font-size:80%}.msp-plugin .msp-slider2>div:nth-child(2){position:absolute;inset:0 37px 0 35px;display:flex}.msp-plugin .msp-slider2>div:last-child{position:absolute;height:32px;line-height:32px;text-align:center;right:0;width:25px;top:0;bottom:0;font-size:80%}.msp-plugin .msp-slider2 input[type=text]{padding-right:4px;padding-left:4px;font-size:80%;text-align:center}.msp-plugin .msp-toggle-color-picker button{border:10px solid #0c0d11!important;margin:0;text-align:center;padding-right:10px;padding-left:10px}.msp-plugin .msp-toggle-color-picker button:hover{border-color:#16191f!important;border:none;outline-offset:-1px!important;outline:1px solid #363c4c!important}.msp-plugin .msp-toggle-color-picker .msp-color-picker{position:absolute;z-index:100000;background:#111318;border-top:1px solid #111318;padding-bottom:5px;width:100%}.msp-plugin .msp-toggle-color-picker-above .msp-color-picker{top:-85px;height:85px}.msp-plugin .msp-toggle-color-picker-below .msp-color-picker{top:32px;height:80px}.msp-plugin .msp-control-offset{padding-left:10px}.msp-plugin .msp-accent-offset{padding-left:1px;margin-left:8px;border-left:2px solid #d67118}.msp-plugin .msp-control-group-wrapper{margin-bottom:0;margin-top:1px}.msp-plugin .msp-control-group-header{background:#111318}.msp-plugin .msp-control-group-header>button,.msp-plugin .msp-control-group-header div{padding-left:4px;text-align:left;height:24px!important;line-height:24px!important;font-size:85%!important;background:#111318!important;color:#9cacc3}.msp-plugin .msp-control-group-header .msp-icon{height:24px!important;line-height:24px!important}.msp-plugin .msp-control-group-header>span{padding-left:5px;line-height:21.3333333333px;font-size:70%;background:#111318;color:#9cacc3}.msp-plugin .msp-control-current{background:#111318}.msp-plugin .msp-control-group-footer{background:#1c1f27;height:5px;font-size:1px;margin-top:1px}.msp-plugin .msp-control-group-expander{display:block;position:absolute;line-height:32px;padding:0;left:0;top:0;width:120px;text-align:left;background:transparent}.msp-plugin .msp-control-group-expander .msp-icon{line-height:29px;width:31px;text-align:center;font-size:100%}.msp-plugin .msp-plugin-layout_controls{position:absolute;left:10px;top:10px}.msp-plugin .msp-plugin-layout_controls>button:first-child{margin-right:6px}.msp-plugin .msp-empty-control{display:none}.msp-plugin .msp-control .msp-btn-block,.msp-plugin .msp-control .msp-control-row button,.msp-plugin .msp-control-row .msp-control button{margin-bottom:0;margin-top:0}.msp-plugin .msp-row-text{height:32px;position:relative;background:#111318;margin-top:1px}.msp-plugin .msp-row-text>div{line-height:32px;text-align:center;color:#9cacc3}.msp-plugin .msp-help span{display:none}.msp-plugin .msp-help:hover span{display:inline-block;background:linear-gradient(#111318,#111318cc)}.msp-plugin .msp-help-text{position:relative;background:#111318;margin-top:1px}.msp-plugin .msp-help-text>div{padding:5px 10px;text-align:left;color:#9cacc3}.msp-plugin .msp-help-description{font-style:italic}.msp-plugin .msp-help-legend{padding-top:10px}.msp-plugin .msp-scale-legend>div{width:100%;height:30px}.msp-plugin .msp-scale-legend>div>span{padding:5px;color:#fff;font-weight:700;background-color:#0003}.msp-plugin .msp-table-legend>div{margin-right:5px;display:inline-flex}.msp-plugin .msp-table-legend>div .msp-table-legend-color{width:30px;height:20px}.msp-plugin .msp-table-legend>div .msp-table-legend-text{margin:0 5px}.msp-plugin .msp-image-preview{position:relative;background:#111318;margin-top:1px;padding:10px}.msp-plugin .msp-image-preview canvas{-webkit-user-select:none;user-select:none}.msp-plugin .msp-image-preview>span{margin-top:6px;display:block;text-align:center;font-size:80%;line-height:15px}.msp-plugin .msp-copy-image-wrapper{position:relative}.msp-plugin .msp-copy-image-wrapper div{font-weight:700;padding:3px;margin:1px 0;width:100%;background:#0c0d11;text-align:center}.msp-plugin .msp-copy-image-wrapper img{margin-top:1px}.msp-plugin .msp-control-text-area-wrapper,.msp-plugin .msp-text-area-wrapper{position:relative}.msp-plugin .msp-control-text-area-wrapper textarea,.msp-plugin .msp-text-area-wrapper textarea{border:none;width:100%;height:100%;background:#0c0d11;padding:5px 10px;resize:none;font-size:12px;line-height:16px}.msp-plugin .msp-control-text-area-wrapper{height:64px!important}.msp-plugin .msp-text-area-wrapper{height:96px!important}.msp-plugin .msp-slider-base{position:relative;height:14px;padding:5px 0;width:100%;border-radius:6px;align-self:center;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.msp-plugin .msp-slider-base *{box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.msp-plugin .msp-slider-base-rail{position:absolute;width:100%;background-color:#1f222b;height:4px;border-radius:2px}.msp-plugin .msp-slider-base-track{position:absolute;left:0;height:4px;border-radius:6px;background-color:tint(#ccd4e0,60%)}.msp-plugin .msp-slider-base-handle{position:absolute;margin-left:-11px;margin-top:-9px;width:22px;height:22px;cursor:pointer;border-radius:50%;background-color:#ccd4e0;border:4px solid #1f222b}.msp-plugin .msp-slider-base-handle:hover{background-color:#51a2fb}.msp-plugin .msp-slider-base-mark{position:absolute;top:18px;left:0;width:100%;font-size:12px}.msp-plugin .msp-slider-base-mark-text{position:absolute;display:inline-block;vertical-align:middle;text-align:center;cursor:pointer;color:#999}.msp-plugin .msp-slider-base-mark-text-active{color:#666}.msp-plugin .msp-slider-base-step{position:absolute;width:100%;height:4px;background:transparent}.msp-plugin .msp-slider-base-dot{position:absolute;bottom:-2px;margin-left:-4px;width:8px;height:8px;border:2px solid #e9e9e9;background-color:#fff;cursor:pointer;border-radius:50%;vertical-align:middle}.msp-plugin .msp-slider-base-dot:first-child{margin-left:-4px}.msp-plugin .msp-slider-base-dot:last-child{margin-left:-4px}.msp-plugin .msp-slider-base-dot-active{border-color:tint(#ccd4e0,50%)}.msp-plugin .msp-slider-base-disabled{background:#111318;opacity:.35}.msp-plugin .msp-slider-base-disabled .msp-slider-base-handle,.msp-plugin .msp-slider-base-disabled .msp-slider-base-dot{cursor:not-allowed}.msp-plugin .msp-slider-base-disabled .msp-slider-base-mark-text,.msp-plugin .msp-slider-base-disabled .msp-slider-base-dot{cursor:not-allowed!important}.msp-plugin .msp-description{padding:10px;font-size:85%;background:#111318;text-align:center;-webkit-user-select:none;-o-user-select:none;user-select:none;font-weight:light;cursor:default}.msp-plugin .msp-description:not(:first-child){border-top:1px solid #1f222b}.msp-plugin .msp-color-picker input{color:#000!important}.msp-plugin .msp-no-webgl{position:absolute;width:100%;height:100%;left:0;top:0;display:table;text-align:center;background:#111318}.msp-plugin .msp-no-webgl>div{display:table-cell;vertical-align:middle;text-align:center;width:100%;height:100%}.msp-plugin .msp-no-webgl>div b{font-size:120%}.msp-plugin .msp-loader-msp-btn-file{position:relative;overflow:hidden}.msp-plugin .msp-loader-msp-btn-file input[type=file]{position:absolute;top:0;right:0;min-width:100%;min-height:100%;font-size:100px;text-align:right;filter:alpha(opacity=0);opacity:0;outline:none;background:#fff;cursor:inherit;display:block}.msp-plugin .msp-controls-section{margin-bottom:10px}.msp-plugin .msp-combined-color-button{border:4px solid #0c0d11!important;margin:0;text-align:center;padding-right:10px;padding-left:10px}.msp-plugin .msp-combined-color-button:hover{border-color:#16191f!important;border:none;outline-offset:-1px!important;outline:1px solid #363c4c!important}.msp-plugin .msp-combined-color-swatch{width:100%;display:grid;grid-gap:1px;grid-template-columns:repeat(6,auto)}.msp-plugin .msp-combined-color-swatch .msp-btn:hover,.msp-plugin .msp-combined-color-swatch .msp-control-row button:hover,.msp-plugin .msp-control-row .msp-combined-color-swatch button:hover{outline-offset:-1px!important;outline:1px solid #363c4c!important}.msp-plugin .msp-action-select{position:relative}.msp-plugin .msp-action-select select{padding-left:42px}.msp-plugin .msp-action-select option:first-child{color:#9cacc3}.msp-plugin .msp-action-select>.msp-icon{display:block;top:0;left:10px;position:absolute;line-height:32px}.msp-plugin .msp-simple-help-section{height:28px;line-height:28px;margin-top:5px;margin-bottom:5px;padding:0 10px;font-weight:500;background:#111318;color:#ccd4e0}.msp-plugin .msp-left-panel-controls-buttons{position:absolute;width:32px;top:0;bottom:0;padding-top:10px;background:#111318}.msp-plugin .msp-left-panel-controls-buttons-bottom{position:absolute;bottom:0}.msp-plugin .msp-left-panel-controls-button-data-dirty{position:absolute;width:6px;height:6px;background:#d67118;border-radius:3px;right:6px;bottom:6px}.msp-plugin .msp-left-panel-controls .msp-scrollable-container{left:33px}.msp-plugin .msp-mapped-parameter-group{position:relative}.msp-plugin .msp-mapped-parameter-group>.msp-control-row:first-child>div:nth-child(2){right:33px}.msp-plugin .msp-mapped-parameter-group>button:first-child{right:33px}.msp-plugin .msp-mapped-parameter-group>.msp-btn-icon{position:absolute;right:0;width:32px;top:0;padding:0}.msp-plugin .msp-shape-filled{fill:#ccd4e0;stroke:#ccd4e0}.msp-plugin .msp-shape-empty{fill:none;stroke:#ccd4e0}.msp-plugin .msp-no-overflow{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.msp-plugin .msp-25-lower-contrast-text{color:#7d91b0}.msp-plugin .msp-expandable-group-color-stripe{position:absolute;left:0;top:30px;width:120px;height:2px}.msp-plugin .msp-section-header{height:32px;line-height:32px;margin-top:10px;margin-bottom:10px;text-align:right;padding:0 10px;font-weight:700;background:#111318;overflow:hidden;cursor:default}.msp-plugin .msp-section-header>.msp-icon{display:block;float:left}.msp-plugin .msp-section-header>small{font-weight:400}.msp-plugin .msp-current-header{height:32px;line-height:32px;margin-bottom:10px;text-align:center;font-weight:700;background:#111318}.msp-plugin .msp-flex-row,.msp-plugin .msp-state-image-row{margin-top:1px;background:#111318;display:flex;flex-direction:row;width:inherit;height:32px}.msp-plugin .msp-flex-row>.msp-flex-item,.msp-plugin .msp-state-image-row>.msp-flex-item{margin:0 1px 0 0;flex:1 1 auto;overflow:hidden}.msp-plugin .msp-flex-row>.msp-flex-item:last-child,.msp-plugin .msp-state-image-row>.msp-flex-item:last-child{margin-right:0}.msp-plugin .msp-flex-row>select,.msp-plugin .msp-state-image-row>select,.msp-plugin .msp-flex-row>button,.msp-plugin .msp-state-image-row>button{margin:0 1px 0 0;flex:1 1 auto;height:32px;overflow:hidden}.msp-plugin .msp-flex-row .msp-btn-icon,.msp-plugin .msp-state-image-row .msp-btn-icon,.msp-plugin .msp-flex-row .msp-btn-icon-small,.msp-plugin .msp-state-image-row .msp-btn-icon-small{flex:0 0 32px;max-width:32px}.msp-plugin .msp-flex-row>select,.msp-plugin .msp-state-image-row>select{background:none}.msp-plugin .msp-flex-row>select>option[value=_],.msp-plugin .msp-state-image-row>select>option[value=_]{display:none}.msp-plugin .msp-flex-row>select:last-child,.msp-plugin .msp-state-image-row>select:last-child,.msp-plugin .msp-flex-row>button:last-child,.msp-plugin .msp-state-image-row>button:last-child{margin-right:0}.msp-plugin .msp-flex-row>button.msp-control-button-label,.msp-plugin .msp-state-image-row>button.msp-control-button-label{background:#111318}.msp-plugin .msp-state-list{list-style:none}.msp-plugin .msp-state-list>li{position:relative;overflow:hidden}.msp-plugin .msp-state-list>li>button:first-child{text-align:left;border-left:10px solid #2a2f3c!important}.msp-plugin .msp-state-list>li>div{position:absolute;right:0;top:0}.msp-plugin .msp-state-image-row{height:96px;margin-top:0}.msp-plugin .msp-state-image-row>button{height:96px;padding:0}.msp-plugin .msp-state-image-row>button>img{min-height:96px;width:inherit;transform:translateY(-50%);top:50%;position:relative}.msp-plugin .msp-tree-row{position:relative;margin-top:0;margin-bottom:1px;background:transparent}.msp-plugin .msp-tree-row-current .msp-btn-tree-label{border-radius:0!important}.msp-plugin .msp-tree-row-current .msp-btn-tree-label>span{font-weight:700}.msp-plugin .msp-tree-row .msp-btn-tree-label{text-align:left;border-radius:0 0 0 8px;border-left-width:4px;border-left-style:solid}.msp-plugin .msp-tree-row .msp-btn-tree-label>small{color:#8d9fb9}.msp-plugin .msp-tree-updates-wrapper .msp-control-group-header:last-child{margin-bottom:1px}.msp-plugin .msp-viewport-top-left-controls{position:absolute;left:10px;top:10px}.msp-plugin .msp-viewport-top-left-controls .msp-traj-controls{line-height:32px;float:left;margin-right:10px;background-color:#0c0d11}.msp-plugin .msp-viewport-top-left-controls .msp-traj-controls>span{color:#ccd4e0;margin-left:10px;margin-right:10px;font-size:85%;display:inline-block}.msp-plugin .msp-viewport-top-left-controls .msp-state-snapshot-viewport-controls{line-height:32px;float:left;margin-right:10px}.msp-plugin .msp-viewport-top-left-controls .msp-state-snapshot-viewport-controls>button{background-color:#0c0d11}.msp-plugin .msp-viewport-top-left-controls .msp-state-snapshot-viewport-controls>select{display:inline-block;width:200px;margin-right:10px}.msp-plugin .msp-viewport-top-left-controls .msp-animation-viewport-controls{line-height:32px;float:left;margin-right:10px;position:relative}.msp-plugin .msp-viewport-top-left-controls .msp-animation-viewport-controls>div:first-child{position:relative;display:inline-block}.msp-plugin .msp-viewport-top-left-controls .msp-animation-viewport-controls>div:first-child>button{position:relative}.msp-plugin .msp-viewport-top-left-controls .msp-animation-viewport-controls .msp-animation-viewport-controls-select{width:290px;position:absolute;left:0;margin-top:10px;background:#1f222b}.msp-plugin .msp-viewport-top-left-controls .msp-animation-viewport-controls .msp-animation-viewport-controls-select .msp-control-row:first-child{margin-top:0}.msp-plugin .msp-selection-viewport-controls{position:relative;margin:10px auto 0;width:430px}.msp-plugin .msp-selection-viewport-controls-actions{position:absolute;width:100%;top:32px;background:#1f222b}.msp-plugin .msp-selection-viewport-controls>.msp-flex-row .msp-btn,.msp-plugin .msp-selection-viewport-controls>.msp-state-image-row .msp-btn,.msp-plugin .msp-selection-viewport-controls>.msp-flex-row .msp-control-row button,.msp-plugin .msp-control-row .msp-selection-viewport-controls>.msp-flex-row button,.msp-plugin .msp-selection-viewport-controls>.msp-state-image-row .msp-control-row button,.msp-plugin .msp-control-row .msp-selection-viewport-controls>.msp-state-image-row button{padding:0 5px}.msp-plugin .msp-selection-viewport-controls select.msp-form-control,.msp-plugin .msp-selection-viewport-controls select.msp-btn,.msp-plugin .msp-selection-viewport-controls .msp-control-row select,.msp-plugin .msp-control-row .msp-selection-viewport-controls select{padding:0 5px;text-align:center;background:#0c0d11;flex:0 0 80px;text-overflow:ellipsis}.msp-plugin .msp-param-object-list-item{margin-top:1px;position:relative}.msp-plugin .msp-param-object-list-item>button{text-align:left}.msp-plugin .msp-param-object-list-item>button>span{font-weight:700}.msp-plugin .msp-param-object-list-item>div{position:absolute;right:0;top:0}.msp-plugin .msp-state-actions .msp-transform-wrapper:last-child{margin-bottom:10px}.msp-plugin .msp-button-row{display:flex;flex-direction:row;height:32px;width:inherit}.msp-plugin .msp-button-row>button{margin:0 1px 0 0;flex:1 1 auto;height:32px;text-align-last:center;background:none;padding:0 10px;overflow:hidden}.msp-plugin .msp-action-menu-options-no-header,.msp-plugin .msp-action-menu-options .msp-control-group-children{max-height:300px;overflow:hidden;overflow-y:auto}.msp-plugin .msp-action-menu-options .msp-control-row,.msp-plugin .msp-action-menu-options button,.msp-plugin .msp-action-menu-options .msp-icon,.msp-plugin .msp-action-menu-options .msp-flex-row,.msp-plugin .msp-action-menu-options .msp-state-image-row{height:24px;line-height:24px}.msp-plugin .msp-action-menu-options button{text-align:left}.msp-plugin .msp-action-menu-options .msp-action-menu-button{margin-top:1px;display:flex}.msp-plugin .msp-action-menu-options .msp-action-menu-button .msp-icon{margin-right:6px}.msp-plugin .msp-representation-entry{position:relative}.msp-plugin .msp-representation-entry>.msp-control-group-header>.msp-btn,.msp-plugin .msp-control-row .msp-representation-entry>.msp-control-group-header>button{font-weight:700}.msp-plugin .msp-representation-entry>.msp-control-group-header>.msp-icon,.msp-plugin .msp-representation-entry>.msp-control-group-header>.msp-btn-link{line-height:24px;height:24px}.msp-plugin .msp-control-group-presets-wrapper{position:absolute;right:0;top:0}.msp-plugin .msp-control-group-presets-wrapper .msp-control-group-header{background:transparent}.msp-plugin .msp-control-group-presets-wrapper button{background:transparent!important}.msp-plugin .msp-parameter-matrix input{flex:1 1 auto;min-width:0}.msp-plugin .msp-btn-apply-simple{text-align:left}.msp-plugin .msp-btn-apply-simple .msp-icon{margin-right:10px}.msp-plugin .msp-type-class-Root{border-left-color:#111318}.msp-plugin .msp-type-class-Group{border-left-color:#d67118}.msp-plugin .msp-type-class-Data{border-left-color:#6d8082}.msp-plugin .msp-type-class-Object{border-left-color:#25a25a}.msp-plugin .msp-type-class-Representation3D{border-left-color:#258cd1}.msp-plugin .msp-type-class-Behavior{border-left-color:#804399}.msp-plugin .msp-accent-color-cyan{color:#6d8082}.msp-plugin .msp-accent-bg-cyan{background:#6d8082}.msp-plugin .msp-transform-header-brand-cyan{border-bottom:1px solid #6d8082}.msp-plugin .msp-transform-header-brand-cyan:active,.msp-plugin .msp-transform-header-brand-cyan:focus{border-bottom:1px solid #6d8082}.msp-plugin .msp-accent-color-red{color:#bf2718}.msp-plugin .msp-accent-bg-red{background:#bf2718}.msp-plugin .msp-transform-header-brand-red{border-bottom:1px solid #bf2718}.msp-plugin .msp-transform-header-brand-red:active,.msp-plugin .msp-transform-header-brand-red:focus{border-bottom:1px solid #bf2718}.msp-plugin .msp-accent-color-gray{color:#22303d}.msp-plugin .msp-accent-bg-gray{background:#22303d}.msp-plugin .msp-transform-header-brand-gray{border-bottom:1px solid #22303d}.msp-plugin .msp-transform-header-brand-gray:active,.msp-plugin .msp-transform-header-brand-gray:focus{border-bottom:1px solid #22303d}.msp-plugin .msp-accent-color-green{color:#25a25a}.msp-plugin .msp-accent-bg-green{background:#25a25a}.msp-plugin .msp-transform-header-brand-green{border-bottom:1px solid #25a25a}.msp-plugin .msp-transform-header-brand-green:active,.msp-plugin .msp-transform-header-brand-green:focus{border-bottom:1px solid #25a25a}.msp-plugin .msp-accent-color-purple{color:#804399}.msp-plugin .msp-accent-bg-purple{background:#804399}.msp-plugin .msp-transform-header-brand-purple{border-bottom:1px solid #804399}.msp-plugin .msp-transform-header-brand-purple:active,.msp-plugin .msp-transform-header-brand-purple:focus{border-bottom:1px solid #804399}.msp-plugin .msp-accent-color-blue{color:#258cd1}.msp-plugin .msp-accent-bg-blue{background:#258cd1}.msp-plugin .msp-transform-header-brand-blue{border-bottom:1px solid #258cd1}.msp-plugin .msp-transform-header-brand-blue:active,.msp-plugin .msp-transform-header-brand-blue:focus{border-bottom:1px solid #258cd1}.msp-plugin .msp-accent-color-orange{color:#d67118}.msp-plugin .msp-accent-bg-orange{background:#d67118}.msp-plugin .msp-transform-header-brand-orange{border-bottom:1px solid #d67118}.msp-plugin .msp-transform-header-brand-orange:active,.msp-plugin .msp-transform-header-brand-orange:focus{border-bottom:1px solid #d67118}.msp-plugin .msp-volume-channel-inline-controls>:first-child{position:absolute;left:0;top:0;height:32px;right:32px}.msp-plugin .msp-volume-channel-inline-controls .msp-slider>div:first-child{right:42px}.msp-plugin .msp-volume-channel-inline-controls .msp-slider>div:last-child{width:30px}.msp-plugin .msp-volume-channel-inline-controls>button{position:absolute;right:0;width:32px;top:0;padding:0}.msp-plugin .msp-volume-channel-inline-controls>button .msp-material-icon{margin-right:0}.msp-plugin .msp-list-unstyled{padding-left:0;list-style:none}.msp-plugin .msp-drag-drop-overlay{border:12px dashed #ccd4e0;background:#0000005c;display:flex;align-items:center;justify-content:center;position:absolute;inset:0;font-size:48px;font-weight:700}.msp-plugin .msp-task-state{line-height:32px}.msp-plugin .msp-task-state>span{-webkit-user-select:none;-o-user-select:none;user-select:none;cursor:default}.msp-plugin .msp-overlay-tasks{position:absolute;display:flex;inset:0;height:100%;width:100%;z-index:1000;justify-content:center;align-items:center;background:#00000040}.msp-plugin .msp-overlay-tasks .msp-task-state>div{height:32px;margin-top:1px;position:relative;width:100%;background:#111318}.msp-plugin .msp-overlay-tasks .msp-task-state>div>div{height:32px;line-height:32px;display:inline-block;padding:0 10px;-webkit-user-select:none;-o-user-select:none;user-select:none;cursor:default;white-space:nowrap;background:#111318;position:absolute}.msp-plugin .msp-overlay-tasks .msp-task-state>div>button{display:inline-block;margin-top:-3px}.msp-plugin .msp-background-tasks{position:absolute;left:0;bottom:0;z-index:1000}.msp-plugin .msp-background-tasks .msp-task-state>div{height:32px;margin-top:1px;position:relative;width:100%;background:#111318}.msp-plugin .msp-background-tasks .msp-task-state>div>div{height:32px;line-height:32px;display:inline-block;padding:0 10px;-webkit-user-select:none;-o-user-select:none;user-select:none;cursor:default;white-space:nowrap;background:#111318;position:absolute}.msp-plugin .msp-background-tasks .msp-task-state>div>button{display:inline-block;margin-top:-3px}.msp-plugin .msp-viewport{position:absolute;inset:0;background:#111318}.msp-plugin .msp-viewport .msp-btn-link{background:#0003}.msp-plugin .msp-viewport-expanded{position:fixed;z-index:1000}.msp-plugin .msp-viewport-host3d{position:absolute;inset:0;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-touch-callout:none;touch-action:manipulation}.msp-plugin .msp-viewport-host3d>canvas{background-color:#111318;background-image:linear-gradient(45deg,lightgrey 25%,transparent 25%,transparent 75%,lightgrey 75%,lightgrey),linear-gradient(45deg,lightgrey 25%,transparent 25%,transparent 75%,lightgrey 75%,lightgrey);background-size:60px 60px;background-position:0 0,30px 30px}.msp-plugin .msp-viewport-controls{position:absolute;right:10px;top:10px;width:32px}.msp-plugin .msp-viewport-controls-buttons{text-align:right;position:relative}.msp-plugin .msp-viewport-controls-buttons>div{position:relative;margin-bottom:4px}.msp-plugin .msp-viewport-controls-buttons button{padding:0;text-align:center;width:32px;position:relative}.msp-plugin .msp-viewport-controls-buttons .msp-btn-link-toggle-off{color:#637ca0}.msp-plugin .msp-viewport-controls-buttons .msp-btn-link:hover{color:#51a2fb}.msp-plugin .msp-semi-transparent-background{background:#111318;opacity:.5;position:absolute;top:0;left:0;width:100%;height:100%}.msp-plugin .msp-hover-box-wrapper{position:relative}.msp-plugin .msp-hover-box-wrapper .msp-hover-box-body{visibility:hidden;position:absolute;right:36px;top:0;width:100px;background-color:#111318}.msp-plugin .msp-hover-box-wrapper .msp-hover-box-spacer{visibility:hidden;position:absolute;right:32px;top:0;width:4px;height:32px}.msp-plugin .msp-hover-box-wrapper:hover .msp-hover-box-body,.msp-plugin .msp-hover-box-wrapper:hover .msp-hover-box-spacer{visibility:visible}.msp-plugin .msp-viewport-controls-panel{width:290px;top:0;right:36px;position:absolute;background:#1f222b}.msp-plugin .msp-viewport-controls-panel .msp-control-group-wrapper:first-child{padding-top:0}.msp-plugin .msp-viewport-controls-panel .msp-viewport-controls-panel-controls{overflow-y:auto;max-height:400px}.msp-plugin .msp-highlight-toast-wrapper{position:absolute;right:10px;bottom:10px;max-width:95%;z-index:10000}.msp-plugin .msp-highlight-info{color:#51a2fb;padding:3px 10px;background:#111318;opacity:90%;max-width:400px;-webkit-user-select:none;-o-user-select:none;user-select:none;cursor:default}.msp-plugin .msp-highlight-markdown-row{padding-left:10px}.msp-plugin .msp-highlight-simple-row{text-align:right}.msp-plugin .msp-highlight-info-hr{margin-inline:0px;margin-block:3px;border:none;height:1px;background-color:#51a2fb}.msp-plugin .msp-highlight-info-additional{font-size:85%;display:inline-block;color:#056ee1}.msp-plugin .msp-snapshot-description-wrapper{background:#11131880;position:absolute;left:0;top:42px;padding:6.6px 10px;max-height:224px;overflow:hidden;overflow-y:auto;max-width:400px}.msp-plugin .msp-snapshot-description-wrapper a{text-decoration:underline;cursor:pointer;color:#ccd4e0}.msp-plugin .msp-snapshot-description-wrapper ul,.msp-plugin .msp-snapshot-description-wrapper ol{padding-left:14px}.msp-plugin .msp-log-wrap{position:absolute;inset:0;overflow:hidden}.msp-plugin .msp-log{position:absolute;inset:0 -20px 0 0;overflow-y:scroll;overflow-x:hidden;font-size:90%;background:#1f222b}.msp-plugin .msp-log{font-size:90%;color:#bcc7d6}.msp-plugin .msp-log ul{padding:0;margin:0}.msp-plugin .msp-log li{clear:both;margin:0;background:#111318;position:relative}.msp-plugin .msp-log li:not(:last-child){border-bottom:1px solid #313645}.msp-plugin .msp-log .msp-log-entry{margin-left:110px;background:#14171c;padding:3px 25px 3px 10px}.msp-plugin .msp-log .msp-log-timestamp{padding:3px 10px;float:left;text-align:right;width:110px;color:#8d9fb9;font-size:100%}.msp-plugin .msp-log .msp-log-timestamp small{font-size:100%}.msp-plugin .msp-log .label{margin-top:-3px;font-size:7pt}.msp-plugin .msp-log-entry-badge{position:absolute;left:0;top:0;bottom:0;width:6px}.msp-plugin .msp-log-entry-message{background:#0cca5d}.msp-plugin .msp-log-entry-info{background:#5e3673}.msp-plugin .msp-log-entry-error{background:#fd354b}.msp-plugin .msp-log-entry-warning{background:#fcc937}.msp-plugin .msp-sequence{position:absolute;inset:0;background:#111318}.msp-plugin .msp-sequence-select{position:relative;height:24px;width:100%;margin-bottom:1px;background:#1f222b;text-align:left}.msp-plugin .msp-sequence-select>span{display:inline-block;line-height:24px;padding:0 10px;font-size:85%;font-weight:700;cursor:default}.msp-plugin .msp-sequence-select>select{display:inline-block;max-width:120px;width:auto;text-overflow:ellipsis;font-size:85%;height:24px;line-height:24px;background-size:6px 8px;background-color:#1f222b}.msp-plugin .msp-sequence-wrapper{word-break:break-word;padding:10px 10px 3px;-webkit-user-select:none;user-select:none}.msp-plugin .msp-sequence-wrapper-non-empty{font-size:85%;line-height:180%;font-family:Courier New,monospace;background:#0c0d11;width:100%;overflow-y:auto;overflow-x:hidden;position:absolute;inset:25px 0 0}.msp-plugin .msp-sequence-chain-label{margin-left:10px;margin-top:10px;-webkit-user-select:none;user-select:none;color:#51a2fb;font-size:90%;line-height:90%;padding-left:.2em}.msp-plugin .msp-sequence-wrapper span{cursor:pointer}.msp-plugin .msp-sequence-wrapper .msp-sequence-residue-long{margin:0 .2em}.msp-plugin .msp-sequence-wrapper .msp-sequence-residue-long-begin{margin:0 .2em 0 0}.msp-plugin .msp-sequence-wrapper .msp-sequence-label{color:#51a2fb;font-size:90%;line-height:90%;padding-bottom:1em;padding-left:.2em}.msp-plugin .msp-sequence-wrapper .msp-sequence-number{color:#51a2fb;word-break:keep-all;cursor:default;position:relative;top:-1.1em;left:3.1em;padding:0;margin-left:-3em;font-size:80%}.msp-plugin .msp-sequence-wrapper .msp-sequence-number-long{left:3.3em}.msp-plugin .msp-sequence-wrapper .msp-sequence-number-long-negative{left:2.7em}.msp-plugin .msp-sequence-wrapper .msp-sequence-number-negative{left:2.5em}.msp-plugin .msp-sequence-wrapper .msp-sequence-present{color:#ccd4e0}.msp-plugin .msp-sequence-wrapper .msp-sequence-missing{color:#637ca0}.msp-plugin .msp-transformer .msp-entity-badge{position:absolute;top:0;right:0;height:32px;line-height:32px;width:32px}.msp-plugin .msp-layout-right,.msp-plugin .msp-layout-left{background:#1f222b}.msp-plugin .msp-transformer-wrapper{position:relative}.msp-plugin .msp-transformer-wrapper .msp-entity-badge{left:0;top:0}.msp-plugin .msp-transformer-wrapper:first-child .msp-panel-description-content{top:33px}.msp-plugin .msp-transformer-wrapper:not(:first-child) .msp-panel-description-content{bottom:33px}.msp-plugin .msp-transform-wrapper{margin-bottom:10px}.msp-plugin .msp-transform-wrapper-collapsed,.msp-plugin .msp-transform-update-wrapper,.msp-plugin .msp-transform-update-wrapper-collapsed{margin-bottom:1px}.msp-plugin .msp-transform-update-wrapper>.msp-transform-header>button,.msp-plugin .msp-transform-update-wrapper-collapsed>.msp-transform-header>button{text-align:left;padding-left:32px;line-height:24px;background:#16191f}.msp-plugin .msp-transform-wrapper>.msp-transform-header>button{text-align:left;background:#111318;font-weight:700;padding-right:5px}.msp-plugin .msp-transform-header{position:relative}.msp-plugin .msp-transform-header>button>small{font-weight:400;float:right}.msp-plugin .msp-transform-header>button>span:first-child{margin-right:10px}.msp-plugin .msp-transform-header>button:hover{color:#9cacc3}.msp-plugin .msp-transform-header-brand{margin-bottom:-1px}.msp-plugin .msp-transform-header-brand svg{fill:#ccd4e0;stroke:#ccd4e0}.msp-plugin .msp-transform-default-params{background:#111318;position:absolute;left:0;top:0;width:32px;padding:0}.msp-plugin .msp-transform-default-params:hover{background:#000}.msp-plugin .msp-transform-apply-wrap{position:relative;margin-top:1px;width:100%;height:32px}.msp-plugin .msp-transform-refresh{width:87px;margin-left:33px;background:#111318;text-align:right}.msp-plugin .msp-transform-apply{display:block;position:absolute;left:120px;right:0;top:0}.msp-plugin .msp-transform-apply-wider{margin-left:33px}.msp-plugin .msp-data-beh{margin:10px 0!important}.msp-plugin .msp-toast-container{position:relative;z-index:1001}.msp-plugin .msp-toast-container .msp-toast-entry{color:#ccd4e0;background:#1f222b;position:relative;float:right;min-height:32px;margin-top:10px;border:1px solid #313645;display:table}.msp-plugin .msp-toast-container .msp-toast-entry .msp-toast-title{height:100%;line-height:32px;padding:0 10px;background:#111318;font-weight:700;display:table-cell;-webkit-user-select:none;-o-user-select:none;user-select:none;font-weight:light;cursor:pointer}.msp-plugin .msp-toast-container .msp-toast-entry .msp-toast-message{padding:3px 42px 3px 10px;display:table-cell}.msp-plugin .msp-toast-container .msp-toast-entry .msp-toast-message a{text-decoration:none;color:#68befd;font-weight:700}.msp-plugin .msp-toast-container .msp-toast-entry .msp-toast-message a:hover{text-decoration:underline;color:#0393fc}.msp-plugin .msp-toast-container .msp-toast-entry .msp-toast-message a:active,.msp-plugin .msp-toast-container .msp-toast-entry .msp-toast-message a:focus{color:#68befd;outline-offset:0;outline:none}.msp-plugin .msp-toast-container .msp-toast-entry .msp-toast-hide{position:absolute;width:42px;right:0;top:0;bottom:0}.msp-plugin .msp-toast-container .msp-toast-entry .msp-toast-hide .msp-btn-icon{background:transparent;position:absolute;inset:1px 0 0;width:100%;text-align:right;padding-right:5px}.msp-plugin .msp-help-row{position:relative;height:32px;background:#111318;margin-top:1px;display:table;width:100%}.msp-plugin .msp-help-row>span{width:120px;text-align:right;padding:3px 10px;color:#9cacc3;display:table-cell;font-weight:700;-webkit-user-select:none;-o-user-select:none;user-select:none;cursor:default}.msp-plugin .msp-help-row>div{background:#0c0d11;position:relative;padding:3px 10px;display:table-cell}.msp-plugin .msp-canvas{width:100%;height:100%;background-color:#f3f2ee}.msp-plugin .msp-canvas text{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.msp-plugin .msp-canvas circle{stroke:#000;stroke-width:10;stroke-opacity:.3}.msp-plugin .msp-canvas circle:hover{fill:#ae5d04;stroke:#000;stroke-width:10px}.msp-plugin .msp-canvas .info{fill:#fff;stroke:#000;stroke-width:3}.msp-plugin .msp-canvas .show{visibility:visible}.msp-plugin .msp-canvas .hide{visibility:hidden}.msp-plugin .msp-canvas .delete-button rect{fill:#ed4337;stroke:#000}.msp-plugin .msp-canvas .delete-button text{stroke:#fff;fill:#fff}.msp-plugin .msp-canvas .delete-button:hover{stroke:#000;stroke-width:3;fill:#ff6961}.msp-plugin .msp-canvas .infoCircle:hover{fill:#4c66b2}.msp-plugin .msp-canvas:focus{outline:none}.msp-plugin .msp-logo{display:block;position:absolute;bottom:10px;right:10px;height:32px;width:100px;background-repeat:no-repeat;background-position:bottom right;background-size:auto;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFcAAAAgCAYAAABn7+QVAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACHDwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKL2lDQ1BJQ0MgUHJvZmlsZQAASMedlndUVNcWh8+9d3qhzTACUobeu8AA0nuTXkVhmBlgKAMOMzSxIaICEUVEmiJIUMSA0VAkVkSxEBRUsAckCCgxGEVULG9G1ouurLz38vL746xv7bP3ufvsvc9aFwCSpy+XlwZLAZDKE/CDPJzpEZFRdOwAgAEeYIApAExWRrpfsHsIEMnLzYWeIXICXwQB8HpYvAJw09AzgE4H/5+kWel8geiYABGbszkZLBEXiDglS5Auts+KmBqXLGYYJWa+KEERy4k5YZENPvsssqOY2ak8tojFOaezU9li7hXxtkwhR8SIr4gLM7mcLBHfErFGijCVK+I34thUDjMDABRJbBdwWIkiNhExiR8S5CLi5QDgSAlfcdxXLOBkC8SXcklLz+FzExIFdB2WLt3U2ppB9+RkpXAEAsMAJiuZyWfTXdJS05m8HAAW7/xZMuLa0kVFtjS1trQ0NDMy/apQ/3Xzb0rc20V6Gfi5ZxCt/4vtr/zSGgBgzIlqs/OLLa4KgM4tAMjd+2LTOACApKhvHde/ug9NPC+JAkG6jbFxVlaWEZfDMhIX9A/9T4e/oa++ZyQ+7o/y0F058UxhioAurhsrLSVNyKdnpDNZHLrhn4f4Hwf+dR4GQZx4Dp/DE0WEiaaMy0sQtZvH5gq4aTw6l/efmvgPw/6kxbkWidL4EVBjjIDUdSpAfu0HKAoRINH7xV3/o2+++DAgfnnhKpOLc//vN/1nwaXiJYOb8DnOJSiEzhLyMxf3xM8SoAEBSAIqkAfKQB3oAENgBqyALXAEbsAb+IMQEAlWAxZIBKmAD7JAHtgECkEx2An2gGpQBxpBM2gFx0EnOAXOg0vgGrgBboP7YBRMgGdgFrwGCxAEYSEyRIHkIRVIE9KHzCAGZA+5Qb5QEBQJxUIJEA8SQnnQZqgYKoOqoXqoGfoeOgmdh65Ag9BdaAyahn6H3sEITIKpsBKsBRvDDNgJ9oFD4FVwArwGzoUL4B1wJdwAH4U74PPwNfg2PAo/g+cQgBARGqKKGCIMxAXxR6KQeISPrEeKkAqkAWlFupE+5CYyiswgb1EYFAVFRxmibFGeqFAUC7UGtR5VgqpGHUZ1oHpRN1FjqFnURzQZrYjWR9ugvdAR6AR0FroQXYFuQrejL6JvoyfQrzEYDA2jjbHCeGIiMUmYtZgSzD5MG+YcZhAzjpnDYrHyWH2sHdYfy8QKsIXYKuxR7FnsEHYC+wZHxKngzHDuuCgcD5ePq8AdwZ3BDeEmcQt4Kbwm3gbvj2fjc/Cl+EZ8N/46fgK/QJAmaBPsCCGEJMImQiWhlXCR8IDwkkgkqhGtiYFELnEjsZJ4jHiZOEZ8S5Ih6ZFcSNEkIWkH6RDpHOku6SWZTNYiO5KjyALyDnIz+QL5EfmNBEXCSMJLgi2xQaJGokNiSOK5JF5SU9JJcrVkrmSF5AnJ65IzUngpLSkXKabUeqkaqZNSI1Jz0hRpU2l/6VTpEukj0lekp2SwMloybjJsmQKZgzIXZMYpCEWd4kJhUTZTGikXKRNUDFWb6kVNohZTv6MOUGdlZWSXyYbJZsvWyJ6WHaUhNC2aFy2FVko7ThumvVuitMRpCWfJ9iWtS4aWzMstlXOU48gVybXJ3ZZ7J0+Xd5NPlt8l3yn/UAGloKcQqJClsF/hosLMUupS26WspUVLjy+9pwgr6ikGKa5VPKjYrzinpKzkoZSuVKV0QWlGmabsqJykXK58RnlahaJir8JVKVc5q/KULkt3oqfQK+m99FlVRVVPVaFqveqA6oKatlqoWr5am9pDdYI6Qz1evVy9R31WQ0XDTyNPo0XjniZek6GZqLlXs09zXktbK1xrq1an1pS2nLaXdq52i/YDHbKOg84anQadW7oYXYZusu4+3Rt6sJ6FXqJejd51fVjfUp+rv09/0ABtYG3AM2gwGDEkGToZZhq2GI4Z0Yx8jfKNOo2eG2sYRxnvMu4z/mhiYZJi0mhy31TG1Ns037Tb9HczPTOWWY3ZLXOyubv5BvMu8xfL9Jdxlu1fdseCYuFnsdWix+KDpZUl37LVctpKwyrWqtZqhEFlBDBKGJet0dbO1husT1m/tbG0Edgct/nN1tA22faI7dRy7eWc5Y3Lx+3U7Jh29Xaj9nT7WPsD9qMOqg5MhwaHx47qjmzHJsdJJ12nJKejTs+dTZz5zu3O8y42Lutczrkirh6uRa4DbjJuoW7Vbo/c1dwT3FvcZz0sPNZ6nPNEe/p47vIc8VLyYnk1e816W3mv8+71IfkE+1T7PPbV8+X7dvvBft5+u/0erNBcwVvR6Q/8vfx3+z8M0A5YE/BjICYwILAm8EmQaVBeUF8wJTgm+Ejw6xDnkNKQ+6E6ocLQnjDJsOiw5rD5cNfwsvDRCOOIdRHXIhUiuZFdUdiosKimqLmVbiv3rJyItogujB5epb0qe9WV1QqrU1afjpGMYcaciEXHhsceiX3P9Gc2MOfivOJq42ZZLqy9rGdsR3Y5e5pjxynjTMbbxZfFTyXYJexOmE50SKxInOG6cKu5L5I8k+qS5pP9kw8lf0oJT2lLxaXGpp7kyfCSeb1pymnZaYPp+umF6aNrbNbsWTPL9+E3ZUAZqzK6BFTRz1S/UEe4RTiWaZ9Zk/kmKyzrRLZ0Ni+7P0cvZ3vOZK577rdrUWtZa3vyVPM25Y2tc1pXvx5aH7e+Z4P6hoINExs9Nh7eRNiUvOmnfJP8svxXm8M3dxcoFWwsGN/isaWlUKKQXziy1XZr3TbUNu62ge3m26u2fyxiF10tNimuKH5fwiq5+o3pN5XffNoRv2Og1LJ0/07MTt7O4V0Ouw6XSZfllo3v9tvdUU4vLyp/tSdmz5WKZRV1ewl7hXtHK30ru6o0qnZWva9OrL5d41zTVqtYu712fh9739B+x/2tdUp1xXXvDnAP3Kn3qO9o0GqoOIg5mHnwSWNYY9+3jG+bmxSaips+HOIdGj0cdLi32aq5+YjikdIWuEXYMn00+uiN71y/62o1bK1vo7UVHwPHhMeefh/7/fBxn+M9JxgnWn/Q/KG2ndJe1AF15HTMdiZ2jnZFdg2e9D7Z023b3f6j0Y+HTqmeqjkte7r0DOFMwZlPZ3PPzp1LPzdzPuH8eE9Mz/0LERdu9Qb2Dlz0uXj5kvulC31OfWcv210+dcXmysmrjKud1yyvdfRb9Lf/ZPFT+4DlQMd1q+tdN6xvdA8uHzwz5DB0/qbrzUu3vG5du73i9uBw6PCdkeiR0TvsO1N3U+6+uJd5b+H+xgfoB0UPpR5WPFJ81PCz7s9to5ajp8dcx/ofBz++P84af/ZLxi/vJwqekJ9UTKpMNk+ZTZ2adp++8XTl04ln6c8WZgp/lf619rnO8x9+c/ytfzZiduIF/8Wn30teyr889GrZq565gLlHr1NfL8wXvZF/c/gt423fu/B3kwtZ77HvKz/ofuj+6PPxwafUT5/+BQOY8/xvJtwPAAAACXBIWXMAAC4iAAAuIgGq4t2SAAANMElEQVRoQ92aB1xURx7H/69sY5eOFBELCipESsSC0RCMJRZMrICHGiMmGjWaqDk7YEsuGok5TS6xi56KGtsFG6jBiAYLKhqVc8GGBZG+fd97N+/twNJWFksS7/v5DG/nN/OG/fze/838Z4CA/wMCE9d9W8oQ3mUMBSojBTqWAuBQAweHIC56lanXHw8xJixM6qhQNcX1KuQykluyKzMPVxvF5XUh3hIpgFSiQz8AJBItSKU6sCsX55P9byLxxRKwYl3W5O6dg5o62IMRmcpyBBz87wNYcyH3R4iL+gh3+8MhHaTqYJKUKO2dPYTigIqza1MlLZLnzh3arQ/uZzVn14YOIGRyJWXrqgR5U6VI1kRJS92VBEEry+wrAnC3F04XL3cY4OMF7/p6weC2zSDQzQG3/IlM7dspdPmU0VxtLqYf5haM6HYOBYLVUwcXByQy92JxXioexUzFhT5cySn3TrjrC4WP3EsPHuPfZGJVZg4HCdt/wF0aT8LWUHT/jTpl4fZU3KNBSHytQ0D33uDR0qfjoqg3hmOpQU65d4u2cW4X6NCyJ1ZeIeKSFRC3p1q4kzYdmzr6Zk98p6rsj+rhi0KoFe5gIm53M/ypDhbNJQgC3kbTFUGSi+LiwmgsWyQ5zk9McESCZ8gEVHvF1kneWJI5CJT2SHWDbUQ0vNbEvqr4OClwCyZ+RzSQ+psomqOwUgOL5vL4BIdCi/aBvtJb3AdYsoirs0usnWfH1vbNOmPlFWHmWlve2DFB3t0nhvh0qm2wRRZuG+ksFyUlDe4qcbYRJ0H8v6NxSxVPNZcnPPJDIAlY8PWnXWVYqsPhZb3lDAfzW3T50xbmZ+MfyFhbRcr7yNj1EZ1gdb+O8DFvMKk7it4+ywYjY11k0s1po8KpmA4tITUmnHaWS5HBKJKr0aC5zXw6QJvgNzyhXDIZS3UgCN3UJq3fdLd188PKs3H8+Bjpvn2x/jv2TwnbsOezt3/YPavTss3TXXHzi4U3Vic/+H5gq+7rkLEkmgb5yWwVb3CnNiFAcD+aOtaGaMobmzrqLaoyIwlC11RkNB/JvPGCiGjQXJ43h8QCSRGzEqeG1Xmah77u48QCPdM7NBYrjSPveJg069i7H2UcjUpndWSZrZ3bFRfHlic8nL1TnezcM2Vyh0dLtsbnzdu8JHHW5qVt8G3Pj9qOT4RYluOE/UYllQZPCvFxMik1cbGRSKsbWwlKUPhxhDGxZJ25Ls28oX2X3k60HmZiqQqDTj+rqX8fB7lTC6xYT2569zA9Jb5m7xz8r3aB03uE9fpOFP7WYujZ/TPo22MSDOs1FT4ePBfG9ZvQsod/12kUJf190prli4YnJ6Mt2HOSMKICGLL/5su3Tn6wPxMYZE4lvMH/RAZP6NjaJGBsJSJIi3mrTg6d9bAYem05YSxS6WJgQdR2LFtnLk9oxFigRaKpq2aEuWMJDizu6UlQosltuo3FivU8zgyOkEhkRzz941u2CogDxyYhgMzDrWb4rMXN0Q36vN4TZr43XuTt0WyeoiR/MwqV509JqgzOSx+77zcw8nGM4UMx2r+5qYJpqpByHVztcc3E+QdFXJWx8dE78MgCDaZYldi5eIB/jwj577/+NB9VJ/GajmHj2nYZKpPZNW5aVJ9v2ULDwlaXdsvFYlvzpo1l9PD4yXUoKStAY3MgFjuAexNvcFA4C+32NgqY3HcofHFg18ioH1adRSHyjdBgCQJaQ/y2SFyzAIMKuSkp+1YAepIOGwZ1Bgo9UGu4gCK2z9ZfoEit3yMI1X8XxZwh+B2al2/7jOnfbsKqGaNeB7RYgmsAmvJi2LHkbwaC0baXyElKKpVe7f/JVlpsY4978Abp0PxsvqcSVVZfMGoud3Z44+HZ8vOeG2m3GWOkntNwK8CTgky4eiWJK9fqflUZJRe0jFirZmgvDSPu29or2PmdzhEgpkVC3/ziIpiRvL1ETUua74+NLed3aEnRg4IC3F2Edp6DNx/AmqxcXLMeFK0w3M8L1yxToTfCtCNZUKTRY8VMZv4TyC/VxFiM3OM7N0BudiaMW/g9VgBkto7QIWyYKDstaSEYGdo3dEQNY/n5/EbKJHBq2QPcOozBWk24K00UGgM3QuI2GisA5cVXIOdyYqHeKBo0cEDSaSwLLNu8TJ5968o6LQORI3oMETRPRycI9GrhkHH7Di/UjQpEvzYeQnlZKMQ0rB1Y/25+xO4M2Fl61/KcazTo4W5ONuRcOIUVEx3CI0Fqax8lljsO9w2tuTMuyksHVcHvwKHX2xIcU9aFsgmQEbR5MX50aztQYJzWu19NY3lmjp6pekIrxmbfvv6woLQQqwCBzZujn0SYqfbX5KkLGprVL51IXgMcW5VdgFgqh4DwkaR/WAxBi837Co5j4Hbmj3wucglL9cJy4ENKzRkVf5+q9Bqnpol9WKpDYuR0DfoKabcL8rGCotfBEQ0GLy41ewk81VyWIfYV3lNmXj2NNizVaNvtPfBBc2B1Hl07BKqi2xkkyf0HSxYg0D7eFn9G5rJ69EAYfXj4zgos1QtaYoq16G2qRCYWA0dw5oFqcb9cAyfvPG50ufq4FI/wdPg5t777+VKoNh1ZPzVbIAiWIwl69qm9G9Lad+kJFF5QKFosXCthjXrI/W0jsCw5G62+Tz0D5p8mU3sxrp7FWwClZKYcHWMawvKqvuf6PZh86HwBusW6VY0g/FzlEru0mHAsPB05mnN3X7sHKzNz+K91Df2o+VQIorDBVGz2lpPHvhobdvRy+v7ewT2HYrUmdy/tBU3po5Ren55MP7e+a6MP2F8aHLHXqr9ExO8Y46oQr08bFS6cflkD/1gT+wYLH1aeydGCSD8Q5ox5Ymo1YdUmgqTI2ZkpWziDToMVM0adCpRntrAERc/B0qvFImSsrWAsWdvYx/j1rkRtYNBGo+bbk9gnGKZ19Q0GgzgVlm4yJeQYq8ydsfb4eW158a6LaTuxYkaZuQN0mrLtb39y/KkL2V+Shdved7URrz9Wj7Fn7xfBuAOZuGbiTqkKRu09Y8HgtkFg5A3+qcpgq8zloUT0vItpyUZthXlq0amKQfnbTgNw5AIsvTos3o2SYGL10vAA0r8eY/mdV4nWgBUz26/eqWMwz7JeQeDrbIcM1idgyXpzp6xOyzHoVBuyUrdiBeD6ySQw6DVr+n9+XImlBmE5ggHOiGs8wleg0G7e8urEQwBNEuavywjpYY2BGse8oQ9QHjgM7bK0/ApfiWDslhOGEq1+NZZqwnH526/cOVbdYP7K13OelKcBY/O5ICKsNpeHFJMJ1zL2aVQlBaAqfgDKswdUKIFYhJutAqVqDznDI1xDdbRVFkkc6YzDQ9piqX448HNSmE+jitVq/mkU4OqzERd9sEJnGNJ/W7pgcGalsTp9FDLRdF5QGwJ0wNpEoAhOi0GGao0M8Fe+DkzpIEgYpMY9G2fuxMRj+axBvyrryEbITtsIjNGwcuDnvzzEzVahJ+gsVnURfTK/Vg6uYUDSNH8gVG/0Ltqy6E2FVNajjYf5WFNZ8AhQcvb88zxvsIEZzBvcV4hYYyQsiP4Jt9YPbyAycgcytM2qn4G/moz9qMpYnkaZK0CIv8y9cKQk72JqkYqAZVi1GmlAxXVGX3DdWHYGKwDurSLBxrb1yLRDo/ftTxkflpQyxW5lyhTJ97vm+azYNneWiCJ+HtxtICnCeTZ/wH0m9yaQHHNAEJ6X+ZGHeINLtLpIiIusP2JrwxspJyLyyzVL+WttY3kabe74xCNFBMd+xXDcl2MTfinBcqPggP5Kfe+bqimTomTwWkg8tPaNjLC3bX5CxtKljjqxViGzyfFrFfTFB/3GK3w9zTvd49eyobCsNGPvlCl1ziKeGWQwxI2sYWx2QamwsFWWcQfO4hbM9EgNLIiaK1zrofGRy8PQ34o1mmf+Hyz5/nub9Kprh4qVS4WzBR6SFEOLVv3hze7zYOiAFTDqveUQ03829O0yDJrYm8+Lr9+/AztOn1SxHPNy/xoqklxEi9qAo7kPq0rGvcIBaOIah3s0yDOZO/rro6rIxDP1Pi1rIBKABb3tiIqCw0fzL38GmvKbuMUyOoMODmf9Ct8d3l3CsfpByR9Pu4KbXg5zhjxBUZlSp8yPPoF7NIhwWG5jb5/h16kbltBrShLw+K4SCvOVCYt2no7HslWg7e9iW5fWcxVNvIGmGVMRGYEoO4zmykLhsBx3heTk4VSgW+lENSObQ8n9POSOHUEi90L97dHOlQKtXg9FFSVwu+A+XLmbx5Tp2F1qhvr7d7Ezb+MhBPjD8tdbNA+SSGSgYwmUGpFwo7AczuYX/an/iEdM6B3qKqbZAbguIKJQEZEosYSLi3efzsKyVZxd3/V1Cc0FisQMGsMAUqkBXfXoqgXChjlgF/LAfCiLOXfuQ5G2tDRcY5CGaRhxO41R4qJlRJSaEZVrjOLbapY6Z9BASkJswn18Sw2CVqx/t5ghncoZElQsBTqm8u+X3A0UaRm48gcD8D/XZskfp8IFSwAAAABJRU5ErkJggg==)}.msp-plugin .msp-plugin-content{color:#ccd4e0}.msp-plugin .msp-plugin-init-error{white-space:pre;margin:10px}\n",".ngx-structure-viewer-container{position:relative;height:100%;width:100%}.ngx-structure-viewer-canvas{position:absolute;height:100%;width:100%;left:0;top:0}\n"],encapsulation:2})}return e})();function yDt(e,t){if(1&e&&(br(0,"div",6)(1,"div",7),js(2,"div",8),br(3,"code",9)(4,"pre",10),Li(5),Ox(6,"json"),Sr()()()()),2&e){const n=t.$implicit;Yc(2),xT("background-color",n.color),Yc(3),T4(Bx(6,3,n))}}function bDt(e,t){if(1&e&&(br(0,"div",0)(1,"div",1)(2,"div",2),js(3,"ngx-structure-viewer",3),Sr()(),br(4,"div",4)(5,"h2"),Li(6,"Color chain"),Sr(),br(7,"div",5),wT(8,yDt,7,5,"div",6,CT),Sr()()()),2&e){const n=t,r=Pu();Yc(3),R0("settings",r.settings)("source",r.source)("loci",n),Yc(5),AT(n)}}let vDt=(()=>{class e{constructor(){this.settings={"background-color":"#2b3035ff","backbone-color":"#6ea8fecc","interaction-color":"#ff0000ff","interaction-size":1},this.source={type:"remote",format:"mmcif",label:"8VAP",binary:!1,link:"assets/8vap.cif"};const n=[{chain:"A",color:"#6f42c1"},{chain:"B",color:"#0d6efd"},{chain:"C",color:"#dc3545"},{chain:"D",color:"#ffc107"},{chain:"E",color:"#28a745"},{chain:"F",color:"#17a2b8"},{chain:"G",color:"#fd7e14"}];this.chains$=function gDt(e=0,t=yF){return e<0&&(e=0),oge(e,e,t)}(3e3).pipe(hn(()=>n.map(r=>r.color)),hn(r=>r.sort(()=>Math.random()-.5)),hn(r=>r.map((i,o)=>({...n[o],color:i}))),WT(n),ff(1))}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275cmp=$d({type:e,selectors:[["app-section-chains"]],standalone:!0,features:[Dh],decls:2,vars:3,consts:[[1,"row","mb-3"],[1,"col-9"],[1,"rounded","squared","overflow-hidden","shadow-sm"],[3,"settings","source","loci"],[1,"col-3","pt-0","p-3"],[1,"d-flex","flex-column","gap-2"],[1,"flex-1"],[1,"d-flex","flex-row","gap-2"],[1,"d-block","flex-shrink-0","p-2"],[1,"bg-body-tertiary","flex-grow-1","p-3"],[1,"m-0"]],template:function(r,i){if(1&r&&(Ym(0,bDt,10,3,"div",0),Ox(1,"async")),2&r){let o;ST(0,(o=Bx(1,1,i.chains$))?0:-1,o)}},dependencies:[mDt,L0,iR,_j],changeDetection:0})}return e})(),xDt=(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275cmp=$d({type:e,selectors:[["page-structure-viewer"]],standalone:!0,features:[Dh],decls:10,vars:0,consts:[[1,"container","pt-3"],[1,"mb-3"]],template:function(r,i){1&r&&(br(0,"div",0)(1,"div",1)(2,"h1"),Li(3,"Structure viewer"),Sr(),br(4,"p"),Li(5," The "),br(6,"b"),Li(7,"ngx-structure-viewer"),Sr(),Li(8," is a Mol* wrapper for Angular. It is a viewer for molecular structures and can be used to visualize and interact with 3D molecular structures. It works out of the box with the latest releases of Angular and automatized the most common features of Mol*. "),Sr()(),js(9,"app-section-chains"),Sr())},dependencies:[vDt,mU,L0],styles:[".progress-bar[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_progress 10s linear infinite;width:0}@keyframes _ngcontent-%COMP%_progress{0%{width:0}to{width:100%}}"]})}return e})();const z2e={A:{background:"#FFBF00",color:"#000000"},R:{background:"#FF0000",color:"#FFFFFF"},N:{background:"#00FFFF",color:"#000000"},D:{background:"#0000FF",color:"#FFFFFF"},C:{background:"#FFFF00",color:"#000000"},Q:{background:"#00FF00",color:"#000000"},E:{background:"#FF00FF",color:"#FFFFFF"},G:{background:"#808080",color:"#FFFFFF"},H:{background:"#008000",color:"#FFFFFF"},I:{background:"#FFA500",color:"#000000"},L:{background:"#FFA500",color:"#000000"},K:{background:"#FF0000",color:"#FFFFFF"},M:{background:"#FFA500",color:"#000000"},F:{background:"#FFA500",color:"#000000"},P:{background:"#800080",color:"#FFFFFF"},S:{background:"#00FF00",color:"#000000"},T:{background:"#00FF00",color:"#000000"},W:{background:"#FFA500",color:"#000000"},Y:{background:"#FFA500",color:"#000000"},V:{background:"#FFA500",color:"#000000"},B:{background:"#FFA500",color:"#000000"},Z:{background:"#FFA500",color:"#000000"},X:{background:"#FFA500",color:"#000000"},"-":{background:"#FFFFFF",color:"#000000"}};let QX=(()=>{class e{constructor(){this.selected$=new Ao(void 0)}set selected(n){this.selected$.next(n)}get selected(){return this.selected$.value}onMouseDown(n,r){this.selected=this.selected?void 0:{start:r,end:r,type:"range"}}onMouseEnter(n,r){1===n.buttons&&this.selected&&(this.selected={...this.selected,end:r})}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})(),V2e=(()=>{class e{set positions(n){this.input$.next(n)}get positions(){return this.input$.value}constructor(n){this.selectionService=n,this.input$=new Ao([])}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(QX))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();function _Dt(e,t){if(1&e){const n=C4();br(0,"div",4),Fx("mouseenter",function(i){const o=Sh(n).$index,s=Pu();return qf(s.onMouseEnter(i,s.index[o]))})("mousedown",function(i){const o=Sh(n).$index,s=Pu();return qf(s.onMouseDown(i,s.index[o]))})("mouseup",function(i){return Sh(n),qf(Pu().onMouseUp(i))}),Li(1),Sr()}if(2&e){const n=t.$implicit,r=t.$index,i=Pu();xT("background",null==n?null:n.background)("color",null==n?null:n.color),R0("id","index-residue-"+r),Yc(),UC(" ",i.index[r]," ")}}function SDt(e,t){if(1&e){const n=C4();br(0,"div",5),Fx("mouseenter",function(i){const o=Sh(n).$index,s=Pu();return qf(s.onMouseEnter(i,s.index[o]))})("mousedown",function(i){const o=Sh(n).$index,s=Pu();return qf(s.onMouseDown(i,s.index[o]))})("mouseup",function(i){return Sh(n),qf(Pu().onMouseUp(i))}),Li(1),Sr()}if(2&e){const n=t.$implicit,r=t.$index,i=Pu();xT("background",i.colors[n].background||i.colors["-"].background)("color",i.colors[n].color||i.colors["-"].color),R0("id","sequence-residue-"+r),Yc(),UC(" ",n," ")}}let CDt=(()=>{class e{set positions(n){this.positionsService.positions=n}get positions(){return this.positionsService.positions}constructor(n,r){this.positionsService=n,this.selectionService=r,this.selected$=this.selectionService.selected$,this.positions$=this.selectionService.selected$.pipe(hn(i=>({...i,background:"#FFFFFF",color:"#000000"})),WT(void 0),z0(this.positionsService.input$),hn(([i,o])=>{o=[...o];const s=new Map(this.index.map((c,u)=>[c,u])),a=i?.start,l=i?.end;if(null!=a&&null!=l){let c=s.get(a),u=s.get(l);c>u&&([c,u]=[u,c]),o.splice(c,u-c+1,...Array(u-c+1).fill(i))}return o}),ff(1))}ngOnChanges(n){if(n){if(n.sequence||n.index){if("string"==typeof this.sequence){if(!this.description&&">"===this.sequence[0]){const[s,...a]=this.sequence.split("\n");this.description=s,this.sequence=a.join("\n")}this.sequence=this.sequence.replace(/[\n\r\s\t]+/g,"").split("")}this.index||(this.index=Array.from({length:this.sequence.length},(s,a)=>a+1))}this.colors||(this.colors=z2e);const r=new Map(this.index.map((s,a)=>[s,a])),i=new Array(this.index.length).fill(void 0),o=(this.loci||[]).map(({start:s,end:a,type:l,background:c,color:u})=>{const d=r.get(s),f=void 0!==a?r.get(a):s,p={start:d,end:f,type:l,background:c,color:u};for(let m=d;m<=f;m++)i[m]=p;return p});o.sort((s,a)=>s.start-a.start||(s.end||0)-(a.end||0)),this.loci=o,this.positions=i}}onMouseUp(n){}onMouseDown(n,r){this.selectionService.onMouseDown(n,r)}onMouseEnter(n,r){this.selectionService.onMouseEnter(n,r)}static#e=this.\u0275fac=function(r){return new(r||e)(On(V2e),On(QX))};static#t=this.\u0275cmp=$d({type:e,selectors:[["ngx-sequence-viewer"]],inputs:{loci:"loci",index:"index",sequence:"sequence",colors:"colors",description:"description"},outputs:{selected$:"selected"},standalone:!0,features:[NT([V2e,QX]),Oo,Dh],decls:7,vars:2,consts:[[1,"index"],[1,"index-residue",3,"id","background","color"],[1,"sequence"],[1,"sequence-residue",3,"id","background","color"],[1,"index-residue",3,"mouseenter","mousedown","mouseup","id"],[1,"sequence-residue",3,"mouseenter","mousedown","mouseup","id"]],template:function(r,i){1&r&&(br(0,"div",0),wT(1,_Dt,2,6,"div",1,CT),Ox(3,"async"),Sr(),br(4,"div",2),wT(5,SDt,2,6,"div",3,CT),Sr()),2&r&&(Yc(),AT(Bx(3,0,i.positions$)),Yc(4),AT(i.sequence))},dependencies:[L0,iR],styles:["[_nghost-%COMP%]{cursor:default;-webkit-user-select:none;user-select:none}[_nghost-%COMP%] .sequence[_ngcontent-%COMP%], [_nghost-%COMP%] .index[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-start;align-items:stretch}[_nghost-%COMP%] .sequence[_ngcontent-%COMP%] > div[_ngcontent-%COMP%], [_nghost-%COMP%] .index[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{flex:0 0 auto;display:block;height:1rem;width:1rem;text-align:center;font-size:inherit;line-height:1rem}[_nghost-%COMP%] .sequence[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{text-align:center;vertical-align:center}[_nghost-%COMP%] .index[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{height:auto;text-align:left;transform:rotate(-180deg);writing-mode:vertical-rl;white-space:nowrap;padding-bottom:.25rem;padding-top:.25rem}"]})}return e})();function wDt(e,t){if(1&e&&js(0,"ngx-sequence-viewer",6),2&e){const n=Pu();R0("sequence",n.sequence)("index",n.index)("loci",n.loci)("colors",n.colors)}}let ADt=(()=>{class e{constructor(n,r){this.structureService=n,this.location=r,this.loci=[{start:"12",end:"43",type:"range",background:"#007A78",color:"#FFC745"},{start:"57",end:"58",type:"range",background:"#BDE673",color:"#000000"}],this.colors=z2e,this.structure$=this.structureService.structure$,this._structure=this.structure$.subscribe(()=>{this.sequence=this.structureService.residues.map(({authCompId1:o})=>o),this.index=this.structureService.residues.map(({authSeqId:o,pdbInsCode:s})=>o+s)});const i=this.location.prepareExternalUrl("assets/8vap.A.cif");this.source=this.structureService.source={type:"remote",label:"8VAP",binary:!1,format:"mmcif",link:i}}ngOnDestroy(){this._structure.unsubscribe()}static#e=this.\u0275fac=function(r){return new(r||e)(On(vI),On(qC))};static#t=this.\u0275cmp=$d({type:e,selectors:[["app-page-sequence-viewer"]],standalone:!0,features:[NT([vI]),Dh],decls:17,vars:6,consts:[[1,"container","pt-3"],[1,"row"],[1,"col-7"],[1,"col-5"],[1,"rounded","bg-body-tertiary","p-3"],["id","sequence-viewer-structure",1,"d-block","rounded","border","w-100","h-auto",2,"overflow-x","auto","overflow-y","hidden"],[3,"sequence","index","loci","colors"]],template:function(r,i){1&r&&(br(0,"div",0)(1,"h1"),Li(2,"Sequence viewer"),Sr(),br(3,"div")(4,"h2"),Li(5,"Visualize structure"),Sr(),br(6,"div",1)(7,"div",2),Li(8," In this example, the sequence underlying the PDB structure `1BRR`, chain `A` is shown. The colouring scheme chosen is based on the structural characteristics of the amino acids. "),Sr(),br(9,"div",3)(10,"code")(11,"pre",4),Li(12),Ox(13,"json"),Sr()()()(),br(14,"div",5),Ym(15,wDt,1,4,"ngx-sequence-viewer",6),Ox(16,"async"),Sr()()()),2&r&&(Yc(12),T4(Bx(13,2,i.source)),Yc(3),ST(15,Bx(16,4,i.structure$)?15:-1))},dependencies:[L0,iR,_j,CDt]})}return e})(),H2e=(()=>{class e{constructor(n){this.templateRef=n}static#e=this.\u0275fac=function(r){return new(r||e)(On(qm))};static#t=this.\u0275dir=Ja({type:e,selectors:[["","ngx-features-viewer-label",""]],standalone:!0})}return e})();function IDt(e){return e}function EDt(e){return"translate("+e+",0)"}function TDt(e){return"translate(0,"+e+")"}function DDt(e){return t=>+e(t)}function PDt(e,t){return t=Math.max(0,e.bandwidth()-2*t)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function kDt(){return!this.__axis}function IB(e,t){var n=[],r=null,i=null,o=6,s=6,a=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:.5,c=1===e||4===e?-1:1,u=4===e||2===e?"x":"y",d=1===e||3===e?EDt:TDt;function f(p){var m=r??(t.ticks?t.ticks.apply(t,n):t.domain()),h=i??(t.tickFormat?t.tickFormat.apply(t,n):IDt),g=Math.max(o,0)+a,y=t.range(),v=+y[0]+l,x=+y[y.length-1]+l,_=(t.bandwidth?PDt:DDt)(t.copy(),l),w=p.selection?p.selection():p,A=w.selectAll(".domain").data([null]),M=w.selectAll(".tick").data(m,t).order(),E=M.exit(),D=M.enter().append("g").attr("class","tick"),T=M.select("line"),F=M.select("text");A=A.merge(A.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),M=M.merge(D),T=T.merge(D.append("line").attr("stroke","currentColor").attr(u+"2",c*o)),F=F.merge(D.append("text").attr("fill","currentColor").attr(u,c*g).attr("dy",1===e?"0em":3===e?"0.71em":"0.32em")),p!==w&&(A=A.transition(p),M=M.transition(p),T=T.transition(p),F=F.transition(p),E=E.transition(p).attr("opacity",1e-6).attr("transform",function(R){return isFinite(R=_(R))?d(R+l):this.getAttribute("transform")}),D.attr("opacity",1e-6).attr("transform",function(R){var N=this.parentNode.__axis;return d((N&&isFinite(N=N(R))?N:_(R))+l)})),E.remove(),A.attr("d",4===e||2===e?s?"M"+c*s+","+v+"H"+l+"V"+x+"H"+c*s:"M"+l+","+v+"V"+x:s?"M"+v+","+c*s+"V"+l+"H"+x+"V"+c*s:"M"+v+","+l+"H"+x),M.attr("opacity",1).attr("transform",function(R){return d(_(R)+l)}),T.attr(u+"2",c*o),F.attr(u,c*g).text(h),w.filter(kDt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===e?"start":4===e?"end":"middle"),w.each(function(){this.__axis=_})}return f.scale=function(p){return arguments.length?(t=p,f):t},f.ticks=function(){return n=Array.from(arguments),f},f.tickArguments=function(p){return arguments.length?(n=null==p?[]:Array.from(p),f):n.slice()},f.tickValues=function(p){return arguments.length?(r=null==p?null:Array.from(p),f):r&&r.slice()},f.tickFormat=function(p){return arguments.length?(i=p,f):i},f.tickSize=function(p){return arguments.length?(o=s=+p,f):o},f.tickSizeInner=function(p){return arguments.length?(o=+p,f):o},f.tickSizeOuter=function(p){return arguments.length?(s=+p,f):s},f.tickPadding=function(p){return arguments.length?(a=+p,f):a},f.offset=function(p){return arguments.length?(l=+p,f):l},f}function RDt(){}function eK(e){return null==e?RDt:function(){return this.querySelector(e)}}function ODt(){return[]}function q2e(e){return null==e?ODt:function(){return this.querySelectorAll(e)}}function W2e(e){return function(){return this.matches(e)}}function $2e(e){return function(t){return t.matches(e)}}var jDt=Array.prototype.find;function zDt(){return this.firstElementChild}var HDt=Array.prototype.filter;function GDt(){return Array.from(this.children)}function Y2e(e){return new Array(e.length)}function EB(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function KDt(e,t,n,r,i,o){for(var a,s=0,l=t.length,c=o.length;st?1:e>=t?0:NaN}EB.prototype={constructor:EB,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};var tK="http://www.w3.org/1999/xhtml";const X2e={svg:"http://www.w3.org/2000/svg",xhtml:tK,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function TB(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),X2e.hasOwnProperty(t)?{space:X2e[t],local:e}:e}function pPt(e){return function(){this.removeAttribute(e)}}function hPt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function mPt(e,t){return function(){this.setAttribute(e,t)}}function gPt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function yPt(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function bPt(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function K2e(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function xPt(e){return function(){this.style.removeProperty(e)}}function _Pt(e,t,n){return function(){this.style.setProperty(e,t,n)}}function SPt(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function II(e,t){return e.style.getPropertyValue(t)||K2e(e).getComputedStyle(e,null).getPropertyValue(t)}function wPt(e){return function(){delete this[e]}}function APt(e,t){return function(){this[e]=t}}function IPt(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function Z2e(e){return e.trim().split(/^|\s+/)}function nK(e){return e.classList||new Q2e(e)}function Q2e(e){this._node=e,this._names=Z2e(e.getAttribute("class")||"")}function J2e(e,t){for(var n=nK(e),r=-1,i=t.length;++r=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var nSe=[null];function Uf(e,t){this._groups=e,this._parents=t}function rSe(){return new Uf([[document.documentElement]],nSe)}Uf.prototype=rSe.prototype={constructor:Uf,select:function NDt(e){"function"!=typeof e&&(e=eK(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=x&&(x=v+1);!(w=g[x])&&++x=0;)(s=r[i])&&(o&&4^s.compareDocumentPosition(o)&&o.parentNode.insertBefore(s,o),o=s);return this},sort:function oPt(e){function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}e||(e=sPt);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==t?xPt:"function"==typeof t?SPt:_Pt)(e,t,n??"")):II(this.node(),e)},property:function EPt(e,t){return arguments.length>1?this.each((null==t?wPt:"function"==typeof t?IPt:APt)(e,t)):this.node()[e]},classed:function kPt(e,t){var n=Z2e(e+"");if(arguments.length<2){for(var r=nK(this.node()),i=-1,o=n.length;++i=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}(e+""),o=r.length;if(!(arguments.length<2)){for(a=t?ikt:rkt,i=0;i{}};function iSe(){for(var r,e=0,t=arguments.length,n={};e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}(e+"",n),o=-1,s=r.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++o0)for(var i,o,n=new Array(i),r=0;r=0&&e._call.call(void 0,t),e=e._next;--EI}()}finally{EI=0,function ykt(){for(var e,n,t=PB,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:PB=n);pk=e,oK(r)}(),O2=0}}function gkt(){var e=hk.now(),t=e-kB;t>aSe&&(MB-=t,kB=e)}function oK(e){EI||(dk&&(dk=clearTimeout(dk)),e-O2>24?(e<1/0&&(dk=setTimeout(uSe,e-hk.now()-MB)),fk&&(fk=clearInterval(fk))):(fk||(kB=hk.now(),fk=setInterval(gkt,aSe)),EI=1,lSe(uSe)))}function dSe(e,t,n){var r=new RB;return r.restart(i=>{r.stop(),e(i+t)},t=null==t?0:+t,n),r}RB.prototype=cSe.prototype={constructor:RB,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?iK():+n)+(null==t?0:+t),!this._next&&pk!==this&&(pk?pk._next=this:PB=this,pk=this),this._call=e,this._time=n,oK()},stop:function(){this._call&&(this._call=null,this._time=1/0,oK())}};var bkt=sSe("start","end","cancel","interrupt"),vkt=[],fSe=0,sK=2,NB=3,aK=5,FB=6;function OB(e,t,n,r,i,o){var s=e.__transition;if(s){if(n in s)return}else e.__transition={};!function xkt(e,t,n){var i,r=e.__transition;function s(c){var u,d,f,p;if(1!==n.state)return l();for(u in r)if((p=r[u]).name===n.name){if(p.state===NB)return dSe(s);4===p.state?(p.state=FB,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[u]):+ufSe)throw new Error("too late; already scheduled");return n}function Zg(e,t){var n=gm(e,t);if(n.state>NB)throw new Error("too late; already running");return n}function gm(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function BB(e,t){var r,i,s,n=e.__transition,o=!0;if(n){for(s in t=null==t?null:t+"",n)(r=n[s]).name===t?(i=r.state>sK&&r.state180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:ym(c,u)})):u&&d.push(i(d)+"rotate("+u+r)}(c.rotate,u.rotate,d,f),function a(c,u,d,f){c!==u?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:ym(c,u)}):u&&d.push(i(d)+"skewX("+u+r)}(c.skewX,u.skewX,d,f),function l(c,u,d,f,p,m){if(c!==d||u!==f){var h=p.push(i(p)+"scale(",null,",",null,")");m.push({i:h-4,x:ym(c,d)},{i:h-2,x:ym(u,f)})}else(1!==d||1!==f)&&p.push(i(p)+"scale("+d+","+f+")")}(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(p){for(var g,m=-1,h=f.length;++m>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?UB(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?UB(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Pkt.exec(e))?new Hd(t[1],t[2],t[3],1):(t=kkt.exec(e))?new Hd(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Mkt.exec(e))?UB(t[1],t[2],t[3],t[4]):(t=Rkt.exec(e))?UB(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Nkt.exec(e))?ASe(t[1],t[2]/100,t[3]/100,1):(t=Fkt.exec(e))?ASe(t[1],t[2]/100,t[3]/100,t[4]):vSe.hasOwnProperty(e)?SSe(vSe[e]):"transparent"===e?new Hd(NaN,NaN,NaN,0):null}function SSe(e){return new Hd(e>>16&255,e>>8&255,255&e,1)}function UB(e,t,n,r){return r<=0&&(e=t=n=NaN),new Hd(e,t,n,r)}function zB(e,t,n,r){return 1===arguments.length?function Lkt(e){return e instanceof mk||(e=B2(e)),e?new Hd((e=e.rgb()).r,e.g,e.b,e.opacity):new Hd}(e):new Hd(e,t,n,r??1)}function Hd(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function CSe(){return`#${j2(this.r)}${j2(this.g)}${j2(this.b)}`}function wSe(){const e=VB(this.opacity);return`${1===e?"rgb(":"rgba("}${L2(this.r)}, ${L2(this.g)}, ${L2(this.b)}${1===e?")":`, ${e})`}`}function VB(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function L2(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function j2(e){return((e=L2(e))<16?"0":"")+e.toString(16)}function ASe(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new bm(e,t,n,r)}function ISe(e){if(e instanceof bm)return new bm(e.h,e.s,e.l,e.opacity);if(e instanceof mk||(e=B2(e)),!e)return new bm;if(e instanceof bm)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,l=(o+i)/2;return a?(s=t===o?(n-r)/a+6*(n0&&l<1?0:s,new bm(s,a,l,e.opacity)}function bm(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function ESe(e){return(e=(e||0)%360)<0?e+360:e}function HB(e){return Math.max(0,Math.min(1,e||0))}function fK(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function TSe(e,t,n,r,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*n+(1+3*e+3*o-3*s)*r+s*i)/6}dK(mk,B2,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:xSe,formatHex:xSe,formatHex8:function Okt(){return this.rgb().formatHex8()},formatHsl:function Bkt(){return ISe(this).formatHsl()},formatRgb:_Se,toString:_Se}),dK(Hd,zB,bSe(mk,{brighter(e){return e=null==e?jB:Math.pow(jB,e),new Hd(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Hd(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Hd(L2(this.r),L2(this.g),L2(this.b),VB(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:CSe,formatHex:CSe,formatHex8:function jkt(){return`#${j2(this.r)}${j2(this.g)}${j2(this.b)}${j2(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:wSe,toString:wSe})),dK(bm,function Ukt(e,t,n,r){return 1===arguments.length?ISe(e):new bm(e,t,n,r??1)},bSe(mk,{brighter(e){return e=null==e?jB:Math.pow(jB,e),new bm(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new bm(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Hd(fK(e>=240?e-240:e+120,i,r),fK(e,i,r),fK(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new bm(ESe(this.h),HB(this.s),HB(this.l),VB(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=VB(this.opacity);return`${1===e?"hsl(":"hsla("}${ESe(this.h)}, ${100*HB(this.s)}%, ${100*HB(this.l)}%${1===e?")":`, ${e})`}`}}));const pK=e=>()=>e;function PSe(e,t){var n=t-e;return n?function DSe(e,t){return function(n){return e+n*t}}(e,n):pK(isNaN(e)?t:e)}const GB=function e(t){var n=function Gkt(e){return 1==(e=+e)?PSe:function(t,n){return n-t?function Hkt(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):pK(isNaN(t)?n:t)}}(t);function r(i,o){var s=n((i=zB(i)).r,(o=zB(o)).r),a=n(i.g,o.g),l=n(i.b,o.b),c=PSe(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=l(u),i.opacity=c(u),i+""}}return r.gamma=e,r}(1);function kSe(e){return function(t){var s,a,n=t.length,r=new Array(n),i=new Array(n),o=new Array(n);for(s=0;s=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1];return TSe((n-r/t)*t,r>0?e[r-1]:2*i-o,i,o,rn&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:ym(r,i)})),n=mK.lastIndex;return n=0&&(t=t.slice(0,n)),!t||"start"===t})}(t)?lK:Zg;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}(n,e,t))},attr:function Jkt(e,t){var n=TB(e),r="transform"===n?Akt:RSe;return this.attrTween(e,"function"==typeof t?(n.local?Qkt:Zkt)(n,r,uK(this,"attr."+e,t)):null==t?(n.local?Ykt:$kt)(n):(n.local?Kkt:Xkt)(n,r,t))},attrTween:function iMt(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var r=TB(e);return this.tween(n,(r.local?nMt:rMt)(r,t))},style:function PMt(e,t,n){var r="transform"==(e+="")?wkt:RSe;return null==t?this.styleTween(e,function IMt(e,t){var n,r,i;return function(){var o=II(this,e),s=(this.style.removeProperty(e),II(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}(e,r)).on("end.style."+e,NSe(e)):"function"==typeof t?this.styleTween(e,function TMt(e,t,n){var r,i,o;return function(){var s=II(this,e),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(e),l=a=II(this,e)),s===l?null:s===r&&l===i?o:(i=l,o=t(r=s,a))}}(e,r,uK(this,"style."+e,t))).each(function DMt(e,t){var n,r,i,a,o="style."+t,s="end."+o;return function(){var l=Zg(this,e),c=l.on,u=null==l.value[o]?a||(a=NSe(t)):void 0;(c!==n||i!==u)&&(r=(n=c).copy()).on(s,i=u),l.on=r}}(this._id,e)):this.styleTween(e,function EMt(e,t,n){var r,o,i=n+"";return function(){var s=II(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}(e,r,t),n).on("end.style."+e,null)},styleTween:function RMt(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw new Error;return this.tween(r,function MMt(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&function kMt(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}(e,s,n)),r}return o._value=t,o}(e,t,n??""))},text:function OMt(e){return this.tween("text","function"==typeof e?function FMt(e){return function(){var t=e(this);this.textContent=t??""}}(uK(this,"text",e)):function NMt(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function jMt(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function LMt(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&function BMt(e){return function(t){this.textContent=e.call(this,t)}}(i)),t}return r._value=e,r}(e))},remove:function _Mt(){return this.on("end.remove",function xMt(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function Tkt(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s,r=gm(this.node(),n).tween,i=0,o=r.length;i1?r[0]+r.slice(2):r,+e.slice(n+1)]}function kI(e){return(e=$B(Math.abs(e)))?e[1]:NaN}["w","e"].map(bk),["n","s"].map(bk),["n","w","e","s","nw","ne","sw","se"].map(bk);var zSe,i4t=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function YB(e){if(!(t=i4t.exec(e)))throw new Error("invalid format: "+e);var t;return new xK({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function xK(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function VSe(e,t){var n=$B(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}YB.prototype=xK.prototype,xK.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const HSe={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function t4t(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>VSe(100*e,t),r:VSe,s:function s4t(e,t){var n=$B(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(zSe=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+$B(e,Math.max(0,t+o-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function GSe(e){return e}var XB,_K,$Se,qSe=Array.prototype.map,WSe=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"];!function l4t(e){XB=function a4t(e){var t=void 0===e.grouping||void 0===e.thousands?GSe:function n4t(e,t){return function(n,r){for(var i=n.length,o=[],s=0,a=e[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),o.push(n.substring(i-=a,i+a)),!((l+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}(qSe.call(e.grouping,Number),e.thousands+""),n=void 0===e.currency?"":e.currency[0]+"",r=void 0===e.currency?"":e.currency[1]+"",i=void 0===e.decimal?".":e.decimal+"",o=void 0===e.numerals?GSe:function r4t(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}(qSe.call(e.numerals,String)),s=void 0===e.percent?"%":e.percent+"",a=void 0===e.minus?"\u2212":e.minus+"",l=void 0===e.nan?"NaN":e.nan+"";function c(d){var f=(d=YB(d)).fill,p=d.align,m=d.sign,h=d.symbol,g=d.zero,y=d.width,v=d.comma,x=d.precision,_=d.trim,w=d.type;"n"===w?(v=!0,w="g"):HSe[w]||(void 0===x&&(x=12),_=!0,w="g"),(g||"0"===f&&"="===p)&&(g=!0,f="0",p="=");var A="$"===h?n:"#"===h&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",M="$"===h?r:/[%p]/.test(w)?s:"",E=HSe[w],D=/[defgprs%]/.test(w);function T(F){var j,W,z,R=A,N=M;if("c"===w)N=E(F)+N,F="";else{var $=(F=+F)<0||1/F<0;if(F=isNaN(F)?l:E(Math.abs(F),x),_&&(F=function o4t(e){e:for(var i,t=e.length,n=1,r=-1;n0&&(r=0)}return r>0?e.slice(0,r)+e.slice(i+1):e}(F)),$&&0==+F&&"+"!==m&&($=!1),R=($?"("===m?m:a:"-"===m||"("===m?"":m)+R,N=("s"===w?WSe[8+zSe/3]:"")+N+($&&"("===m?")":""),D)for(j=-1,W=F.length;++j(z=F.charCodeAt(j))||z>57){N=(46===z?i+F.slice(j+1):F.slice(j))+N,F=F.slice(0,j);break}}v&&!g&&(F=t(F,1/0));var V=R.length+F.length+N.length,X=V>1)+R+F+N+X.slice(V);break;default:F=X+R+F+N}return o(F)}return x=void 0===x?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x)),T.toString=function(){return d+""},T}return{format:c,formatPrefix:function u(d,f){var p=c(((d=YB(d)).type="f",d)),m=3*Math.max(-8,Math.min(8,Math.floor(kI(f)/3))),h=Math.pow(10,-m),g=WSe[8+m/3];return function(y){return p(h*y)+g}}}}(e),_K=XB.format,$Se=XB.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});const c4t=Math.sqrt(50),u4t=Math.sqrt(10),d4t=Math.sqrt(2);function KB(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=c4t?10:o>=u4t?5:o>=d4t?2:1;let a,l,c;return i<0?(c=Math.pow(10,-i)/s,a=Math.round(e*c),l=Math.round(t*c),a/ct&&--l,c=-c):(c=Math.pow(10,i)*s,a=Math.round(e/c),l=Math.round(t/c),a*ct&&--l),lt?1:e>=t?0:NaN}function h4t(e,t){return null==e||null==t?NaN:te?1:t>=e?0:NaN}function YSe(e){let t,n,r;function i(a,l,c=0,u=a.length){if(c>>1;n(a[d],l)<0?c=d+1:u=d}while(cZB(e(a),l),r=(a,l)=>e(a)-l):(t=e===ZB||e===h4t?e:m4t,n=e,r=e),{left:i,center:function s(a,l,c=0,u=a.length){const d=i(a,l,c,u-1);return d>c&&r(a[d-1],l)>-r(a[d],l)?d-1:d},right:function o(a,l,c=0,u=a.length){if(c>>1;n(a[d],l)<=0?c=d+1:u=d}while(c0))return[];if((e=+e)==(t=+t))return[e];const r=t=i))return[];const a=o-i+1,l=new Array(a);if(r)if(s<0)for(let c=0;c0;){if((c=SK(s,a,n))===l)return r[i]=s,r[o]=a,t(r);if(c>0)s=Math.floor(s/c)*c,a=Math.ceil(a/c)*c;else{if(!(c<0))break;s=Math.ceil(s*c)/c,a=Math.floor(a*c)/c}l=c}return e},e}function JSe(){var e=function k4t(){return function P4t(){var r,i,o,a,l,c,e=ZSe,t=ZSe,n=CK,s=MI;function u(){var f=Math.min(e.length,t.length);return s!==MI&&(s=function I4t(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}(e[0],e[f-1])),a=f>2?T4t:E4t,l=c=null,d}function d(f){return null==f||isNaN(f=+f)?o:(l||(l=a(e.map(r),t,n)))(r(s(f)))}return d.invert=function(f){return s(i((c||(c=a(t,e.map(r),ym)))(f)))},d.domain=function(f){return arguments.length?(e=Array.from(f,A4t),u()):e.slice()},d.range=function(f){return arguments.length?(t=Array.from(f),u()):t.slice()},d.rangeRound=function(f){return t=Array.from(f),n=C4t,u()},d.clamp=function(f){return arguments.length?(s=!!f||MI,u()):s!==MI},d.interpolate=function(f){return arguments.length?(n=f,u()):n},d.unknown=function(f){return arguments.length?(o=f,d):o},function(f,p){return r=f,i=p,u()}}()(MI,MI)}();return e.copy=function(){return function D4t(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}(e,JSe())},QSe.apply(e,arguments),O4t(e)}class eCe extends Map{constructor(t,n=rCe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(AK(this,t))}has(t){return super.has(AK(this,t))}set(t,n){return super.set(function tCe({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}(this,t),n)}delete(t){return super.delete(function nCe({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}(this,t))}}function AK({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function rCe(e){return null!==e&&"object"==typeof e?e.valueOf():e}Set;const iCe=Symbol("implicit");function oCe(){var e=new eCe,t=[],n=[],r=iCe;function i(o){let s=e.get(o);if(void 0===s){if(r!==iCe)return r;e.set(o,s=t.push(o)-1)}return n[s%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new eCe;for(const s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return oCe(t,n).unknown(r)},QSe.apply(i,arguments),i}function rd(e){return"string"==typeof e?new Uf([[document.querySelector(e)]],[document.documentElement]):new Uf([[e]],nSe)}function RI(e){return function(){return e}}function sCe(e){this._context=e}function j4t(e){return new sCe(e)}sCe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};const IK=Math.PI,EK=2*IK,U2=1e-6,U4t=EK-U2;function aCe(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return aCe;const n=10**t;return function(r){this._+=r[0];for(let i=1,o=r.length;iU2)if(Math.abs(d*l-c*u)>U2&&o){let p=r-s,m=i-a,h=l*l+c*c,g=p*p+m*m,y=Math.sqrt(h),v=Math.sqrt(f),x=o*Math.tan((IK-Math.acos((h+f-g)/(2*y*v)))/2),_=x/v,w=x/y;Math.abs(_-1)>U2&&this._append`L${t+_*u},${n+_*d}`,this._append`A${o},${o},0,0,${+(d*p>u*m)},${this._x1=t+w*l},${this._y1=n+w*c}`}else this._append`L${this._x1=t},${this._y1=n}`}arc(t,n,r,i,o,s){if(t=+t,n=+n,s=!!s,(r=+r)<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),l=r*Math.sin(i),c=t+a,u=n+l,d=1^s,f=s?i-o:o-i;null===this._x1?this._append`M${c},${u}`:(Math.abs(this._x1-c)>U2||Math.abs(this._y1-u)>U2)&&this._append`L${c},${u}`,r&&(f<0&&(f=f%EK+EK),f>U4t?this._append`A${r},${r},0,1,${d},${t-a},${n-l}A${r},${r},0,1,${d},${this._x1=c},${this._y1=u}`:f>U2&&this._append`A${r},${r},0,${+(f>=IK)},${d},${this._x1=t+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function G4t(e){return e[0]}function q4t(e){return e[1]}function lCe(e){return e<0?-1:1}function cCe(e,t,n){var r=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),a=(o*i+s*r)/(r+i);return(lCe(o)+lCe(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function uCe(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function TK(e,t,n){var r=e._x0,o=e._x1,s=e._y1,a=(o-r)/3;e._context.bezierCurveTo(r+a,e._y0+a*t,o-a,s-a*n,o,s)}function JB(e){this._context=e}function fCe(e){this._context=e}function $4t(e){return new JB(e)}JB.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:TK(this,this._t0,uCe(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,TK(this,uCe(this,n=cCe(this,e,t)),n);break;default:TK(this,this._t0,n=cCe(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(function dCe(e){this._context=new fCe(e)}.prototype=Object.create(JB.prototype)).point=function(e,t){JB.prototype.point.call(this,t,e)},fCe.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,o){this._context.bezierCurveTo(t,e,r,n,o,i)}};const DK={capture:!0,passive:!1};function PK(e){e.preventDefault(),e.stopImmediatePropagation()}function pCe(e){return((e=Math.exp(e))+1/e)/2}const J4t=function e(t,n,r){function i(o,s){var g,y,a=o[0],l=o[1],c=o[2],f=s[2],p=s[0]-a,m=s[1]-l,h=p*p+m*m;if(h<1e-12)y=Math.log(f/c)/t,g=function(M){return[a+M*p,l+M*m,c*Math.exp(t*M*y)]};else{var v=Math.sqrt(h),x=(f*f-c*c+r*h)/(2*c*n*v),_=(f*f-c*c-r*h)/(2*f*n*v),w=Math.log(Math.sqrt(x*x+1)-x),A=Math.log(Math.sqrt(_*_+1)-_);y=(A-w)/t,g=function(M){var E=M*y,D=pCe(w),T=c/(n*v)*(D*function Q4t(e){return((e=Math.exp(2*e))-1)/(e+1)}(t*E+w)-function Z4t(e){return((e=Math.exp(e))-1/e)/2}(w));return[a+T*p,l+T*m,c*D/pCe(t*E+w)]}}return g.duration=1e3*y*t/Math.SQRT2,g}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s;return e(s,a,a*a)},i}(Math.SQRT2,2,4);function z2(e,t){if(e=function eRt(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const eL=e=>()=>e;function tRt(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function pb(e,t,n){this.k=e,this.x=t,this.y=n}pb.prototype={constructor:pb,scale:function(e){return 1===e?this:new pb(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new pb(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var kK=new pb(1,0,0);function MK(e){e.stopImmediatePropagation()}function vk(e){e.preventDefault(),e.stopImmediatePropagation()}function rRt(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function iRt(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function hCe(){return this.__zoom||kK}function oRt(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function sRt(){return navigator.maxTouchPoints||"ontouchstart"in this}function aRt(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}let xk=(()=>{class e{get div(){return this.root.nativeElement}get width(){return this.div.offsetWidth}get margin(){const{"margin-top":n,"margin-right":r,"margin-bottom":i,"margin-left":o}=this.settings;return{top:n,right:r,bottom:i,left:o}}constructor(){this.initialize$=new Fh(1),this.initialized$=this.initialize$.pipe(Ho(n=>this.root=n),hn(()=>{const n=function B4t(e){return rd(rK(e).call(document.documentElement))}("svg"),r=n.node();if(!r)throw new Error("Could not create SVG node");return this.div.append(r),n}),Ho(n=>this.svg=n),Ho(n=>{this.clip=n.append("defs").append("clipPath").attr("id","clip").append("rect");const r=n.append("g").attr("class","focus");this.draw=r.append("g").attr("class","features").attr("clip-path","url(#clip)"),this.zoom=function lRt(){var u,d,f,e=rRt,t=iRt,n=aRt,r=oRt,i=sRt,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=J4t,c=sSe("start","zoom","end"),p=500,m=150,h=0,g=10;function y(j){j.property("__zoom",hCe).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",T).filter(i).on("touchstart.zoom",F).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(j,W){return(W=Math.max(o[0],Math.min(o[1],W)))===j.k?j:new pb(W,j.x,j.y)}function x(j,W,z){var $=W[0]-z[0]*j.k,V=W[1]-z[1]*j.k;return $===j.x&&V===j.y?j:new pb(j.k,$,V)}function _(j){return[(+j[0][0]+ +j[1][0])/2,(+j[0][1]+ +j[1][1])/2]}function w(j,W,z,$){j.on("start.zoom",function(){A(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event($).end()}).tween("zoom",function(){var V=this,X=arguments,H=A(V,X).event($),oe=t.apply(V,X),te=null==z?_(oe):"function"==typeof z?z.apply(V,X):z,K=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),Q=V.__zoom,G="function"==typeof W?W.apply(V,X):W,Z=l(Q.invert(te).concat(K/Q.k),G.invert(te).concat(K/G.k));return function(ee){if(1===ee)ee=G;else{var se=Z(ee),xe=K/se[2];ee=new pb(xe,te[0]-se[0]*xe,te[1]-se[1]*xe)}H.zoom(null,ee)}})}function A(j,W,z){return!z&&j.__zooming||new M(j,W)}function M(j,W){this.that=j,this.args=W,this.active=0,this.sourceEvent=null,this.extent=t.apply(j,W),this.taps=0}function E(j,...W){if(e.apply(this,arguments)){var z=A(this,W).event(j),$=this.__zoom,V=Math.max(o[0],Math.min(o[1],$.k*Math.pow(2,r.apply(this,arguments)))),X=z2(j);if(z.wheel)(z.mouse[0][0]!==X[0]||z.mouse[0][1]!==X[1])&&(z.mouse[1]=$.invert(z.mouse[0]=X)),clearTimeout(z.wheel);else{if($.k===V)return;z.mouse=[X,$.invert(X)],BB(this),z.start()}vk(j),z.wheel=setTimeout(function H(){z.wheel=null,z.end()},m),z.zoom("mouse",n(x(v($,V),z.mouse[0],z.mouse[1]),z.extent,s))}}function D(j,...W){if(!f&&e.apply(this,arguments)){var z=j.currentTarget,$=A(this,W,!0).event(j),V=rd(j.view).on("mousemove.zoom",function te(Q){if(vk(Q),!$.moved){var G=Q.clientX-H,Z=Q.clientY-oe;$.moved=G*G+Z*Z>h}$.event(Q).zoom("mouse",n(x($.that.__zoom,$.mouse[0]=z2(Q,z),$.mouse[1]),$.extent,s))},!0).on("mouseup.zoom",function K(Q){V.on("mousemove.zoom mouseup.zoom",null),function X4t(e,t){var n=e.document.documentElement,r=rd(e).on("dragstart.drag",null);t&&(r.on("click.drag",PK,DK),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(Q.view,$.moved),vk(Q),$.event(Q).end()},!0),X=z2(j,z),H=j.clientX,oe=j.clientY;(function Y4t(e){var t=e.document.documentElement,n=rd(e).on("dragstart.drag",PK,DK);"onselectstart"in t?n.on("selectstart.drag",PK,DK):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")})(j.view),MK(j),$.mouse=[X,this.__zoom.invert(X)],BB(this),$.start()}}function T(j,...W){if(e.apply(this,arguments)){var z=this.__zoom,$=z2(j.changedTouches?j.changedTouches[0]:j,this),V=z.invert($),H=n(x(v(z,z.k*(j.shiftKey?.5:2)),$,V),t.apply(this,W),s);vk(j),a>0?rd(this).transition().duration(a).call(w,H,$,j):rd(this).call(y.transform,H,$,j)}}function F(j,...W){if(e.apply(this,arguments)){var X,H,oe,te,z=j.touches,$=z.length,V=A(this,W,j.changedTouches.length===$).event(j);for(MK(j),H=0;H<$;++H)te=[te=z2(oe=z[H],this),this.__zoom.invert(te),oe.identifier],V.touch0?!V.touch1&&V.touch0[2]!==te[2]&&(V.touch1=te,V.taps=0):(V.touch0=te,X=!0,V.taps=1+!!u);u&&(u=clearTimeout(u)),X&&(V.taps<2&&(d=te[0],u=setTimeout(function(){u=null},p)),BB(this),V.start())}}function R(j,...W){if(this.__zooming){var X,H,oe,te,z=A(this,W).event(j),$=j.changedTouches,V=$.length;for(vk(j),X=0;X{const r=n.append("g").attr("class","x axis"),i=n.append("g").attr("class","y axis");this.axes={x:r,y:i}}),Ho(()=>this.scale={x:JSe(),y:oCe()}),ff(1))}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})(),RK=(()=>{class e{constructor(){this._traces=new Map,this._parent=new Map,this._children=new Map}set hierarchy(n){this.setHierarchy(n)}get traces(){return this._traces}get features(){const n=this.traces,r=new Map;for(const i of n.values())for(const[o,s]of Object.entries(i.values))r.set(`trace-${i.id}-feature-${o}`,s);return r}setHierarchy(n){let r=0,i=[...n];for(;i.length>0;){const[o]=i.splice(0,1),s=o.nested||[],a=new Array;for(const u of[o,...s]){const d="trace"===u.type?u:{type:"trace",values:[u],label:u.label,id:void 0,expanded:void 0};d.values=d.values.sort((f,p)=>"continuous"!==f.type?-1:"continuous"!==p.type?1:0),d.id=void 0!==d.id?d.id:r++,d.expanded=!1!==d.expanded,this._traces.set(d.id,d),a.push(d)}const l=a[0],c=a.slice(1);c.forEach(u=>this._parent.set(u,l.id)),this._children.set(l,c.map(u=>u.id)),i=[...a.slice(1),...i]}}getTrace(n){return this.traces.get(n)}getParent(n){const r=this._parent.get(n);return r&&this._traces.get(r)}getBranch(n){const r=[],i=[n];for(;i.length>0;){const o=i.pop();r.push(o);const s=this.getChildren(o);i.push(...s)}return r}getChildren(n){return(this._children.get(n)||[]).map(i=>this._traces.get(i))}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();function mCe(e,t,n){e.attr("height",t.height).attr("width",t.width).attr("y",n.top).attr("x",n.left)}let gCe=(()=>{class e{get svg(){return this.initializeService.svg}get div(){return this.initializeService.div}get height(){return this.div.offsetHeight}get width(){return this.div.offsetWidth}get margin(){return this.initializeService.margin}get scale(){return this.initializeService.scale}get axes(){return this.initializeService.axes}constructor(n){this.initializeService=n,this.resize$=new Fh(1);const r=this.resize$.pipe(hn(()=>({width:this.width,height:this.height})),sge((i,o)=>i.width===o.width),hn(()=>{}),WT(void 0));this.resized$=r.pipe(hn(()=>this.updateRoot()),hn(()=>this.updateDraw()),hn(()=>this.updateAxes()),hn(()=>this.updateRangeX()),hn(()=>this.updateRangeY()))}updateRoot(){const{y:n}=this.scale,i=n.range().at(-1)+this.margin.bottom,o=this.width;this.svg.attr("height",i).attr("width",o)}updateDraw(){const n={width:0,height:0};n.height=this.height-this.margin.top-this.margin.bottom,n.width=this.width-this.margin.left-this.margin.right,mCe(this.initializeService.clip,n,this.margin),mCe(this.initializeService.events,n,this.margin)}updateAxes(){const{x:n,y:r}=this.axes;n.attr("transform",`translate(0, ${this.height-this.margin.top})`),r.attr("transform",`translate(${this.margin.left}, 0)`)}updateRangeX(){const n=this.scale.x,r=this.width,{left:i,right:o}=this.margin;n.range([i,r-o])}updateRangeY(){}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(xk))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})(),yCe=(()=>{class e{constructor(n){this.initService=n,this.zoom$=new Fh(1);const i=this.initService.initialized$.pipe(hn(()=>this._scale={x:this.initService.scale.x.copy(),y:this.initService.scale.y.copy()}),ff(1)).pipe(ba(()=>this.zoom$),hn(o=>{const{x:s}=this._scale,{x:a}=this.initService.scale,l=o.transform.rescaleX(s),[c,u]=l.domain();return a.domain([c,u]),this.initService.scale}),WT(this.initService.scale));this.zoomed$=i.pipe(hn(()=>{const o=this.initService.axes,s=this.initService.scale,a=s.x.ticks().filter(c=>Number.isInteger(c)).slice(1,-1),l=function MDt(e){return IB(3,e)}(s.x).tickValues(a).tickFormat(_K(".0f"));o.x.call(l)}))}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(xk))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();const bCe={H:"blue",K:"blue",R:"blue",D:"red",E:"red",S:"green",T:"green",N:"green",Q:"green",A:"white",V:"white",L:"white",I:"white",M:"white",F:"magenta",W:"magenta",Y:"magenta",P:"brown",G:"brown",C:"yellow",B:"grey",Z:"grey",X:"grey","-":"grey"},NK=(parseFloat(getComputedStyle(document.documentElement).fontSize),e=>e.id),FK=(e,t)=>t;let vCe=(()=>{class e{constructor(n,r){this.initializeService=n,this.featuresService=r,this.traces$=new Fh(1),this.sequence$=new Fh(1),this["char.width"]=0,this.draw$=this.sequence$.pipe(Ho(i=>{this.initializeService.scale.x.domain([0,i.length+1])}),hn(i=>this.createSequence(i)),Ho(()=>{const o=this.initializeService.settings["content-size"]/3;this.tooltip=rd(this.initializeService.div).append("div").attr("class","tooltip").style("position","absolute").style("display","none").style("opacity",1).style("color","black").style("padding",".25rem").style("background-color","white").style("border","solid").style("border-width","1px").style("border-radius",o+"px")}),ff(1),ba(()=>this.traces$),Ho(i=>this.updateScale(i)),Ho(i=>this.createLabels(i)),Ho(i=>this.createGrid(i)),Ho(i=>this.createTraces(i)),ff(1)),this.drawn$=this.draw$.pipe(hn(()=>this.updateSequence()),hn(()=>this.updateGrid()),hn(()=>this.updateLabels()),hn(()=>this.updateTraces()))}updateScale(n){const r=this.initializeService.scale.y,i=["sequence",...n.map(({id:s})=>s+"")],o=i.reduce((s,a,l)=>{if(0===l&&"sequence"===a){const d=this.initializeService.settings["margin-top"];return[d,d+this.initializeService.settings["line-height"]]}const c=this.featuresService.getTrace(+a);if(c){const u=s.at(-1);let d=c["line-height"]||this.initializeService.settings["line-height"];return"dodge"===c.position&&(d=c.values.reduce((f,p)=>f+(p["line-height"]||this.initializeService.settings["line-height"]),0)),[...s,u+d]}throw new Error("Trace not found")},[]);r.domain(i).range(o)}createSequence(n){const i=this.initializeService.draw.selectAll("g.sequence").data([n]).join("g").attr("class","sequence");this["group.residues"]=i.selectAll("g.residue").data(n).join("g").attr("id",(s,a)=>`residue-${a+1}`).attr("class","residue"),this["group.residues"].append("rect").attr("class","color").attr("fill",s=>(s=>bCe[s]||bCe.X)(s)).attr("fill-opacity",.1);let o=0;this["group.residues"].append("text").attr("class","name").text(s=>""+s).each(function(){o=Math.max(o,this.getBBox().width)}),this["char.width"]=o}updateSequence(){const n=this.initializeService.margin,{x:r,y:i}=this.initializeService.scale,{"line-height":o}=this.initializeService.settings,s=r(1)-r(0),a=this["char.width"],{"group.residues":l}=this;l.select("rect.color").attr("x",(c,u)=>r(u+.5)).attr("y",n.top).attr("width",()=>s).attr("height","100%"),l.select("text.name").attr("x",(c,u)=>r(u+1)).attr("y",i("sequence")+o/2).attr("width",()=>s).attr("height",o).attr("dominant-baseline","central").style("text-anchor","middle").attr("fill",this.initializeService.settings["text-color"]).attr("opacity",()=>a>s?0:1)}createLabels(n){const{y:r}=this.initializeService.scale,i=this.initializeService.settings,{left:o}=this.initializeService.margin,s=this.initializeService.svg.selectAll("g.labels").data([n],FK).join("g").attr("class","labels");this["group.labels"]=s.selectAll("g.label").data([{id:"sequence",label:"Sequence",expanded:!0},...n],NK).join(a=>{const l=a.append("g").attr("id",c=>"label-"+c.id).attr("class","label");return l.each(c=>{const u=""+c.id,d=this.initializeService.div.querySelector("div#label-"+u);d&&(d.style.position="absolute",d.style.left="0px",d.style.overflow="hidden",d.style.top=r(u)+"px",d.style.height=(c["line-height"]||i["line-height"])+"px",d.style.width=o+"px")}),l},a=>a,a=>(a.each(l=>{const u=this.initializeService.div.querySelector("div#label-"+l.id);u&&(u.style.display="none")}),a)),this["group.labels"].each(a=>{const l=""+a.id,c=this.initializeService.div.querySelector("div#label-"+l);c&&(c.style.position="absolute",c.style.overflow="hidden",c.style.left="0px",c.style.top=r(l)+"px",c.style.display="block",c.style.height=(a["line-height"]||i["line-height"])+"px",c.style.width=o+"px")}),this["group.labels"].selectAll("rect").data(a=>[a],FK).join("rect").attr("height",a=>a["line-height"]||i["line-height"]).attr("width",()=>o).attr("fill","none")}updateLabels(){const n=this.initializeService.scale.y,r=this.initializeService.settings;this["group.labels"].select("rect").attr("y",i=>n(String(i.id))).attr("x",0),this["group.labels"].select("text").attr("y",i=>n(String(i.id))+(i["line-height"]||r["line-height"])/2).attr("x",0).attr("dominant-baseline","central").attr("fill",i=>i["text-color"]||r["text-color"])}createGrid(n){const r=this.initializeService.svg.selectAll("g.grid").data([n],FK).join("g").attr("class","grid").lower();this["group.grid"]=r.selectAll("rect.grid-line").data(n,NK).join("rect").attr("id",i=>"grid-"+i.id).attr("class","grid-line")}updateGrid(){const n=this.initializeService.scale.y,r=this.initializeService.width,i=this.initializeService.margin,o=this.initializeService.settings;this["group.grid"].attr("x",i.left).attr("y",s=>{const a=s.values[s.values.length-1],l=n(""+s.id),c=a["line-height"]||s["line-height"]||o["line-height"];return"continuous"!==a.type?l+c/2-.5:l+c/2-(a["content-size"]||s["content-size"]||o["content-size"])/2}).attr("width",r-i.left-i.right).attr("height",s=>{const a=s.values[s.values.length-1];return"continuous"===a.type?a["content-size"]||s["content-size"]||o["content-size"]:1}).attr("fill",this.initializeService.settings["grid-color"])}createTraces(n){const r=this.initializeService.settings,i=this.tooltip;this["group.traces"]=this.initializeService.draw.selectAll("g.trace").data(n,NK).join("g").attr("id",o=>"trace-"+o.id).attr("class","trace"),this["group.traces"].each(function(o){const a=rd(this).selectAll("g.feature").data(o.values);a.enter().append("g").attr("class",l=>"feature "+l.type).attr("id",(l,c)=>`trace-${o.id}-feature-${c}`).each(function(l,c){"loci"===l.type&&l.values.forEach((u,d)=>{const f=(l["content-size"]||o["content-size"]||r["content-size"])/3,p=rd(this).append("rect").attr("stroke",l["trace-color"]||o["trace-color"]||r["trace-color"]).attr("stroke-opacity",1).attr("stroke-width",1).attr("fill",l["trace-color"]||o["trace-color"]||r["trace-color"]).attr("fill-opacity",.5).attr("rx",f).attr("ry",f);p.data([u]),p.on("mouseover",m=>function cRt(e,t,n,r,i,o){t.style("display","block"),t.style("opacity",1)}(0,i)),p.on("mousemove",m=>function uRt(e,t,n,r,i,o){"loci"===r.type&&t.html(`Trace: ${n.id}
Feature: ${r.index}
Index: ${i}
Value: ${o.start!==o.end?o.start+"-"+o.end:o.start}`),"continuous"===r.type&&t.html(`Trace: ${n.id}
Feature: ${r.index}
Index: ${i}
Value: ${o}`),t.style("left",e.offsetX+10+"px").style("top",e.offsetY+10+"px")}(m,i,o,{...l,index:c},d,u)),p.on("mouseleave",m=>function dRt(e,t,n,r,i,o){t.style("opacity",0),t.style("display","none")}(0,i))}),"continuous"===l.type&&rd(this).append("path").attr("stroke",l["trace-color"]||o["trace-color"]||r["trace-color"]).attr("stroke-opacity",1).attr("stroke-width",2).attr("fill","none").data([l.values])}),a.exit().remove()})}updateTraces(){const n=this.initializeService.scale,r=this.initializeService.settings;this["group.traces"].each(function(i){rd(this).selectAll("g.feature").each(function(a){const l=n.y(""+i.id),c=a["line-height"]||i["line-height"]||r["line-height"],u=a["line-height"]||i["content-size"]||r["content-size"];if("loci"===a.type){const d=n.x(1)-n.x(0);rd(this).selectAll("rect").attr("x",f=>n.x(f.start-.5)).attr("y",l+c/2-u/2).attr("height",u).attr("width",f=>d*(f.end-f.start+1))}if("continuous"===a.type){const d=a.values,f=void 0!==a.min?a.min:Math.min(...a.values),p=void 0!==a.max?a.max:Math.max(...a.values),m=d.map((g,y)=>[y+1,1-(g-f)/(p-f)]),h=function W4t(e,t){var n=RI(!0),r=null,i=j4t,o=null,s=function H4t(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(null==n)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new QB(t)}(a);function a(l){var c,d,p,u=(l=function L4t(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}(l)).length,f=!1;for(null==r&&(o=i(p=s())),c=0;c<=u;++c)!(cn.x(g)).y(([,g])=>l+c/2-(u-2)/2+(u-2)*g);rd(this).select("path").attr("d",h(m))}})})}onLabelClick(n){n.expanded=!1===n.expanded;const r=Array.from(this.featuresService.traces.values()),i=[];for(const s of r){const{expanded:a}={expanded:!0,...s};if(!0!==a){const l=this.featuresService.getBranch(s).slice(1);i.push(...l)}}const o=r.filter(s=>!i.includes(s));this.traces$.next(o),console.log("Trace",n)}static#e=this.\u0275fac=function(r){return new(r||e)(Rn(xk),Rn(RK))};static#t=this.\u0275prov=gn({token:e,factory:e.\u0275fac,providedIn:"platform"})}return e})();const fRt=["root"],pRt=e=>({trace:e});function hRt(e,t){if(1&e){const n=C4();br(0,"div",3),Fx("click",function(){const i=Sh(n).$implicit;return qf(Pu(2).drawService.onLabelClick(i.value))})("keyup",function(){const i=Sh(n).$implicit;return qf(Pu(2).drawService.onLabelClick(i.value))}),D8(1,4),Sr()}if(2&e){const n=t.$implicit,r=Pu(2);R0("id","label-"+n.key),Yc(),R0("ngTemplateOutlet",r.label.templateRef)("ngTemplateOutletContext",function _te(e,t,n,r){return Ste(_t(),Kl(),e,t,n,r)}(3,pRt,n.value))}}function mRt(e,t){1&e&&(wT(0,hRt,2,5,"div",2,CT),Ox(2,"keyvalue")),2&e&&AT(Bx(2,0,Pu().featuresService.traces))}let gRt=(()=>{class e{set settings(n){this.initService.settings=n}set features(n){this.featuresService.hierarchy=n;const r=Array.from(this.featuresService.traces.values());this.traces$.next(r)}constructor(n,r,i,o,s){this.featuresService=n,this.initService=r,this.resizeService=i,this.zoomService=o,this.drawService=s,this.traces$=this.drawService.traces$,this.sequence$=this.drawService.sequence$,this.update$=this.initService.initialized$.pipe(ba(()=>this.drawService.draw$),ba(()=>this.resizeService.resized$),Ho(()=>{const{left:a,right:l,bottom:c}=this.resizeService.margin,u=this.resizeService.height,d=this.resizeService.width,f=this.sequence.length+1;this.initService.zoom.translateExtent([[a,0],[d-l,u-c]]).scaleExtent([1,f/5]).extent([[a,0],[d-l,u-c]]).on("zoom",p=>{this.zoomService.zoom$.next(p)})}),ba(()=>this.zoomService.zoomed$),ba(()=>this.drawService.drawn$)),this._update=this.update$.subscribe()}ngOnChanges(n){n&&n.sequence&&this.sequence$.next(this.sequence)}ngAfterViewInit(){this.initService.initialize$.next(this._root)}ngOnDestroy(){this._update.unsubscribe()}onResize(n){this.resizeService.resize$.next(n)}static#e=this.\u0275fac=function(r){return new(r||e)(On(RK),On(xk),On(gCe),On(yCe),On(vCe))};static#t=this.\u0275cmp=$d({type:e,selectors:[["ngx-features-viewer"]],contentQueries:function(r,i,o){if(1&r&&N8(o,H2e,5),2&r){let s;MT(s=RT())&&(i.label=s.first)}},viewQuery:function(r,i){if(1&r&&F8(fRt,5),2&r){let o;MT(o=RT())&&(i._root=o.first)}},hostBindings:function(r,i){1&r&&Fx("resize",function(s){return i.onResize(s)},0,AZ)},inputs:{settings:"settings",features:"features",sequence:"sequence"},standalone:!0,features:[NT([xk,RK,gCe,vCe,yCe]),Oo,Dh],decls:3,vars:1,consts:[["root",""],[2,"position","relative","display","block","width","100%","height","100%"],["tabindex","0",3,"id"],["tabindex","0",3,"click","keyup","id"],[3,"ngTemplateOutlet","ngTemplateOutletContext"]],template:function(r,i){1&r&&(br(0,"div",1,0),Ym(2,mRt,3,2),Sr()),2&r&&(Yc(2),ST(2,i.label?2:-1))},dependencies:[L0,nre,rre],styles:['@charset "UTF-8";.labels #label-sequence .parent div{cursor:default}.labels #label-sequence .parent div i{display:none}.labels .label .children-0>i{visibility:hidden}.labels .label i:before{transition:transform .4s}.labels .label.active i:before{transform:roate(0deg)}.labels .label:not(.active) i:before{transform:rotate(-90deg)}.labels .label div{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;align-items:center;box-sizing:border-box;height:100%;width:100%;cursor:pointer}.labels .label div span{text-wrap:wrap;line-break:anywhere;flex-shrink:1;flex-grow:1}.labels .label div i{flex-shrink:0;flex-grow:0}.labels div.depth-0{width:100%;padding:0 .25rem 0 .75rem}.labels div.depth-1{width:100%;padding:0 .25rem 0 1.5rem}.labels div.depth-2{width:100%;padding:0 .25rem 0 2.25rem}.labels div.depth-3{width:100%;padding:0 .25rem 0 3rem}.labels div.depth-4{width:100%;padding:0 .25rem 0 3.75rem}.labels div.depth-5{width:100%;padding:0 .25rem 0 4.5rem}/*!\n * Bootstrap Icons v1.11.3 (https://icons.getbootstrap.com/)\n * Copyright 2019-2024 The Bootstrap Authors\n * Licensed under MIT (https://github.com/twbs/icons/blob/main/LICENSE)\n */@font-face{font-display:block;font-family:bootstrap-icons;src:url(bootstrap-icons.bfa90bda92a84a6a.woff2) format("woff2"),url(bootstrap-icons.70a9dee9e5ab72aa.woff) format("woff")}.bi:before,[class^=bi-]:before,[class*=" bi-"]:before{display:inline-block;font-family:bootstrap-icons!important;font-style:normal;font-weight:400!important;font-variant:normal;text-transform:none;line-height:1;vertical-align:-.125em;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.bi-123:before{content:"\\f67f"}.bi-alarm-fill:before{content:"\\f101"}.bi-alarm:before{content:"\\f102"}.bi-align-bottom:before{content:"\\f103"}.bi-align-center:before{content:"\\f104"}.bi-align-end:before{content:"\\f105"}.bi-align-middle:before{content:"\\f106"}.bi-align-start:before{content:"\\f107"}.bi-align-top:before{content:"\\f108"}.bi-alt:before{content:"\\f109"}.bi-app-indicator:before{content:"\\f10a"}.bi-app:before{content:"\\f10b"}.bi-archive-fill:before{content:"\\f10c"}.bi-archive:before{content:"\\f10d"}.bi-arrow-90deg-down:before{content:"\\f10e"}.bi-arrow-90deg-left:before{content:"\\f10f"}.bi-arrow-90deg-right:before{content:"\\f110"}.bi-arrow-90deg-up:before{content:"\\f111"}.bi-arrow-bar-down:before{content:"\\f112"}.bi-arrow-bar-left:before{content:"\\f113"}.bi-arrow-bar-right:before{content:"\\f114"}.bi-arrow-bar-up:before{content:"\\f115"}.bi-arrow-clockwise:before{content:"\\f116"}.bi-arrow-counterclockwise:before{content:"\\f117"}.bi-arrow-down-circle-fill:before{content:"\\f118"}.bi-arrow-down-circle:before{content:"\\f119"}.bi-arrow-down-left-circle-fill:before{content:"\\f11a"}.bi-arrow-down-left-circle:before{content:"\\f11b"}.bi-arrow-down-left-square-fill:before{content:"\\f11c"}.bi-arrow-down-left-square:before{content:"\\f11d"}.bi-arrow-down-left:before{content:"\\f11e"}.bi-arrow-down-right-circle-fill:before{content:"\\f11f"}.bi-arrow-down-right-circle:before{content:"\\f120"}.bi-arrow-down-right-square-fill:before{content:"\\f121"}.bi-arrow-down-right-square:before{content:"\\f122"}.bi-arrow-down-right:before{content:"\\f123"}.bi-arrow-down-short:before{content:"\\f124"}.bi-arrow-down-square-fill:before{content:"\\f125"}.bi-arrow-down-square:before{content:"\\f126"}.bi-arrow-down-up:before{content:"\\f127"}.bi-arrow-down:before{content:"\\f128"}.bi-arrow-left-circle-fill:before{content:"\\f129"}.bi-arrow-left-circle:before{content:"\\f12a"}.bi-arrow-left-right:before{content:"\\f12b"}.bi-arrow-left-short:before{content:"\\f12c"}.bi-arrow-left-square-fill:before{content:"\\f12d"}.bi-arrow-left-square:before{content:"\\f12e"}.bi-arrow-left:before{content:"\\f12f"}.bi-arrow-repeat:before{content:"\\f130"}.bi-arrow-return-left:before{content:"\\f131"}.bi-arrow-return-right:before{content:"\\f132"}.bi-arrow-right-circle-fill:before{content:"\\f133"}.bi-arrow-right-circle:before{content:"\\f134"}.bi-arrow-right-short:before{content:"\\f135"}.bi-arrow-right-square-fill:before{content:"\\f136"}.bi-arrow-right-square:before{content:"\\f137"}.bi-arrow-right:before{content:"\\f138"}.bi-arrow-up-circle-fill:before{content:"\\f139"}.bi-arrow-up-circle:before{content:"\\f13a"}.bi-arrow-up-left-circle-fill:before{content:"\\f13b"}.bi-arrow-up-left-circle:before{content:"\\f13c"}.bi-arrow-up-left-square-fill:before{content:"\\f13d"}.bi-arrow-up-left-square:before{content:"\\f13e"}.bi-arrow-up-left:before{content:"\\f13f"}.bi-arrow-up-right-circle-fill:before{content:"\\f140"}.bi-arrow-up-right-circle:before{content:"\\f141"}.bi-arrow-up-right-square-fill:before{content:"\\f142"}.bi-arrow-up-right-square:before{content:"\\f143"}.bi-arrow-up-right:before{content:"\\f144"}.bi-arrow-up-short:before{content:"\\f145"}.bi-arrow-up-square-fill:before{content:"\\f146"}.bi-arrow-up-square:before{content:"\\f147"}.bi-arrow-up:before{content:"\\f148"}.bi-arrows-angle-contract:before{content:"\\f149"}.bi-arrows-angle-expand:before{content:"\\f14a"}.bi-arrows-collapse:before{content:"\\f14b"}.bi-arrows-expand:before{content:"\\f14c"}.bi-arrows-fullscreen:before{content:"\\f14d"}.bi-arrows-move:before{content:"\\f14e"}.bi-aspect-ratio-fill:before{content:"\\f14f"}.bi-aspect-ratio:before{content:"\\f150"}.bi-asterisk:before{content:"\\f151"}.bi-at:before{content:"\\f152"}.bi-award-fill:before{content:"\\f153"}.bi-award:before{content:"\\f154"}.bi-back:before{content:"\\f155"}.bi-backspace-fill:before{content:"\\f156"}.bi-backspace-reverse-fill:before{content:"\\f157"}.bi-backspace-reverse:before{content:"\\f158"}.bi-backspace:before{content:"\\f159"}.bi-badge-3d-fill:before{content:"\\f15a"}.bi-badge-3d:before{content:"\\f15b"}.bi-badge-4k-fill:before{content:"\\f15c"}.bi-badge-4k:before{content:"\\f15d"}.bi-badge-8k-fill:before{content:"\\f15e"}.bi-badge-8k:before{content:"\\f15f"}.bi-badge-ad-fill:before{content:"\\f160"}.bi-badge-ad:before{content:"\\f161"}.bi-badge-ar-fill:before{content:"\\f162"}.bi-badge-ar:before{content:"\\f163"}.bi-badge-cc-fill:before{content:"\\f164"}.bi-badge-cc:before{content:"\\f165"}.bi-badge-hd-fill:before{content:"\\f166"}.bi-badge-hd:before{content:"\\f167"}.bi-badge-tm-fill:before{content:"\\f168"}.bi-badge-tm:before{content:"\\f169"}.bi-badge-vo-fill:before{content:"\\f16a"}.bi-badge-vo:before{content:"\\f16b"}.bi-badge-vr-fill:before{content:"\\f16c"}.bi-badge-vr:before{content:"\\f16d"}.bi-badge-wc-fill:before{content:"\\f16e"}.bi-badge-wc:before{content:"\\f16f"}.bi-bag-check-fill:before{content:"\\f170"}.bi-bag-check:before{content:"\\f171"}.bi-bag-dash-fill:before{content:"\\f172"}.bi-bag-dash:before{content:"\\f173"}.bi-bag-fill:before{content:"\\f174"}.bi-bag-plus-fill:before{content:"\\f175"}.bi-bag-plus:before{content:"\\f176"}.bi-bag-x-fill:before{content:"\\f177"}.bi-bag-x:before{content:"\\f178"}.bi-bag:before{content:"\\f179"}.bi-bar-chart-fill:before{content:"\\f17a"}.bi-bar-chart-line-fill:before{content:"\\f17b"}.bi-bar-chart-line:before{content:"\\f17c"}.bi-bar-chart-steps:before{content:"\\f17d"}.bi-bar-chart:before{content:"\\f17e"}.bi-basket-fill:before{content:"\\f17f"}.bi-basket:before{content:"\\f180"}.bi-basket2-fill:before{content:"\\f181"}.bi-basket2:before{content:"\\f182"}.bi-basket3-fill:before{content:"\\f183"}.bi-basket3:before{content:"\\f184"}.bi-battery-charging:before{content:"\\f185"}.bi-battery-full:before{content:"\\f186"}.bi-battery-half:before{content:"\\f187"}.bi-battery:before{content:"\\f188"}.bi-bell-fill:before{content:"\\f189"}.bi-bell:before{content:"\\f18a"}.bi-bezier:before{content:"\\f18b"}.bi-bezier2:before{content:"\\f18c"}.bi-bicycle:before{content:"\\f18d"}.bi-binoculars-fill:before{content:"\\f18e"}.bi-binoculars:before{content:"\\f18f"}.bi-blockquote-left:before{content:"\\f190"}.bi-blockquote-right:before{content:"\\f191"}.bi-book-fill:before{content:"\\f192"}.bi-book-half:before{content:"\\f193"}.bi-book:before{content:"\\f194"}.bi-bookmark-check-fill:before{content:"\\f195"}.bi-bookmark-check:before{content:"\\f196"}.bi-bookmark-dash-fill:before{content:"\\f197"}.bi-bookmark-dash:before{content:"\\f198"}.bi-bookmark-fill:before{content:"\\f199"}.bi-bookmark-heart-fill:before{content:"\\f19a"}.bi-bookmark-heart:before{content:"\\f19b"}.bi-bookmark-plus-fill:before{content:"\\f19c"}.bi-bookmark-plus:before{content:"\\f19d"}.bi-bookmark-star-fill:before{content:"\\f19e"}.bi-bookmark-star:before{content:"\\f19f"}.bi-bookmark-x-fill:before{content:"\\f1a0"}.bi-bookmark-x:before{content:"\\f1a1"}.bi-bookmark:before{content:"\\f1a2"}.bi-bookmarks-fill:before{content:"\\f1a3"}.bi-bookmarks:before{content:"\\f1a4"}.bi-bookshelf:before{content:"\\f1a5"}.bi-bootstrap-fill:before{content:"\\f1a6"}.bi-bootstrap-reboot:before{content:"\\f1a7"}.bi-bootstrap:before{content:"\\f1a8"}.bi-border-all:before{content:"\\f1a9"}.bi-border-bottom:before{content:"\\f1aa"}.bi-border-center:before{content:"\\f1ab"}.bi-border-inner:before{content:"\\f1ac"}.bi-border-left:before{content:"\\f1ad"}.bi-border-middle:before{content:"\\f1ae"}.bi-border-outer:before{content:"\\f1af"}.bi-border-right:before{content:"\\f1b0"}.bi-border-style:before{content:"\\f1b1"}.bi-border-top:before{content:"\\f1b2"}.bi-border-width:before{content:"\\f1b3"}.bi-border:before{content:"\\f1b4"}.bi-bounding-box-circles:before{content:"\\f1b5"}.bi-bounding-box:before{content:"\\f1b6"}.bi-box-arrow-down-left:before{content:"\\f1b7"}.bi-box-arrow-down-right:before{content:"\\f1b8"}.bi-box-arrow-down:before{content:"\\f1b9"}.bi-box-arrow-in-down-left:before{content:"\\f1ba"}.bi-box-arrow-in-down-right:before{content:"\\f1bb"}.bi-box-arrow-in-down:before{content:"\\f1bc"}.bi-box-arrow-in-left:before{content:"\\f1bd"}.bi-box-arrow-in-right:before{content:"\\f1be"}.bi-box-arrow-in-up-left:before{content:"\\f1bf"}.bi-box-arrow-in-up-right:before{content:"\\f1c0"}.bi-box-arrow-in-up:before{content:"\\f1c1"}.bi-box-arrow-left:before{content:"\\f1c2"}.bi-box-arrow-right:before{content:"\\f1c3"}.bi-box-arrow-up-left:before{content:"\\f1c4"}.bi-box-arrow-up-right:before{content:"\\f1c5"}.bi-box-arrow-up:before{content:"\\f1c6"}.bi-box-seam:before{content:"\\f1c7"}.bi-box:before{content:"\\f1c8"}.bi-braces:before{content:"\\f1c9"}.bi-bricks:before{content:"\\f1ca"}.bi-briefcase-fill:before{content:"\\f1cb"}.bi-briefcase:before{content:"\\f1cc"}.bi-brightness-alt-high-fill:before{content:"\\f1cd"}.bi-brightness-alt-high:before{content:"\\f1ce"}.bi-brightness-alt-low-fill:before{content:"\\f1cf"}.bi-brightness-alt-low:before{content:"\\f1d0"}.bi-brightness-high-fill:before{content:"\\f1d1"}.bi-brightness-high:before{content:"\\f1d2"}.bi-brightness-low-fill:before{content:"\\f1d3"}.bi-brightness-low:before{content:"\\f1d4"}.bi-broadcast-pin:before{content:"\\f1d5"}.bi-broadcast:before{content:"\\f1d6"}.bi-brush-fill:before{content:"\\f1d7"}.bi-brush:before{content:"\\f1d8"}.bi-bucket-fill:before{content:"\\f1d9"}.bi-bucket:before{content:"\\f1da"}.bi-bug-fill:before{content:"\\f1db"}.bi-bug:before{content:"\\f1dc"}.bi-building:before{content:"\\f1dd"}.bi-bullseye:before{content:"\\f1de"}.bi-calculator-fill:before{content:"\\f1df"}.bi-calculator:before{content:"\\f1e0"}.bi-calendar-check-fill:before{content:"\\f1e1"}.bi-calendar-check:before{content:"\\f1e2"}.bi-calendar-date-fill:before{content:"\\f1e3"}.bi-calendar-date:before{content:"\\f1e4"}.bi-calendar-day-fill:before{content:"\\f1e5"}.bi-calendar-day:before{content:"\\f1e6"}.bi-calendar-event-fill:before{content:"\\f1e7"}.bi-calendar-event:before{content:"\\f1e8"}.bi-calendar-fill:before{content:"\\f1e9"}.bi-calendar-minus-fill:before{content:"\\f1ea"}.bi-calendar-minus:before{content:"\\f1eb"}.bi-calendar-month-fill:before{content:"\\f1ec"}.bi-calendar-month:before{content:"\\f1ed"}.bi-calendar-plus-fill:before{content:"\\f1ee"}.bi-calendar-plus:before{content:"\\f1ef"}.bi-calendar-range-fill:before{content:"\\f1f0"}.bi-calendar-range:before{content:"\\f1f1"}.bi-calendar-week-fill:before{content:"\\f1f2"}.bi-calendar-week:before{content:"\\f1f3"}.bi-calendar-x-fill:before{content:"\\f1f4"}.bi-calendar-x:before{content:"\\f1f5"}.bi-calendar:before{content:"\\f1f6"}.bi-calendar2-check-fill:before{content:"\\f1f7"}.bi-calendar2-check:before{content:"\\f1f8"}.bi-calendar2-date-fill:before{content:"\\f1f9"}.bi-calendar2-date:before{content:"\\f1fa"}.bi-calendar2-day-fill:before{content:"\\f1fb"}.bi-calendar2-day:before{content:"\\f1fc"}.bi-calendar2-event-fill:before{content:"\\f1fd"}.bi-calendar2-event:before{content:"\\f1fe"}.bi-calendar2-fill:before{content:"\\f1ff"}.bi-calendar2-minus-fill:before{content:"\\f200"}.bi-calendar2-minus:before{content:"\\f201"}.bi-calendar2-month-fill:before{content:"\\f202"}.bi-calendar2-month:before{content:"\\f203"}.bi-calendar2-plus-fill:before{content:"\\f204"}.bi-calendar2-plus:before{content:"\\f205"}.bi-calendar2-range-fill:before{content:"\\f206"}.bi-calendar2-range:before{content:"\\f207"}.bi-calendar2-week-fill:before{content:"\\f208"}.bi-calendar2-week:before{content:"\\f209"}.bi-calendar2-x-fill:before{content:"\\f20a"}.bi-calendar2-x:before{content:"\\f20b"}.bi-calendar2:before{content:"\\f20c"}.bi-calendar3-event-fill:before{content:"\\f20d"}.bi-calendar3-event:before{content:"\\f20e"}.bi-calendar3-fill:before{content:"\\f20f"}.bi-calendar3-range-fill:before{content:"\\f210"}.bi-calendar3-range:before{content:"\\f211"}.bi-calendar3-week-fill:before{content:"\\f212"}.bi-calendar3-week:before{content:"\\f213"}.bi-calendar3:before{content:"\\f214"}.bi-calendar4-event:before{content:"\\f215"}.bi-calendar4-range:before{content:"\\f216"}.bi-calendar4-week:before{content:"\\f217"}.bi-calendar4:before{content:"\\f218"}.bi-camera-fill:before{content:"\\f219"}.bi-camera-reels-fill:before{content:"\\f21a"}.bi-camera-reels:before{content:"\\f21b"}.bi-camera-video-fill:before{content:"\\f21c"}.bi-camera-video-off-fill:before{content:"\\f21d"}.bi-camera-video-off:before{content:"\\f21e"}.bi-camera-video:before{content:"\\f21f"}.bi-camera:before{content:"\\f220"}.bi-camera2:before{content:"\\f221"}.bi-capslock-fill:before{content:"\\f222"}.bi-capslock:before{content:"\\f223"}.bi-card-checklist:before{content:"\\f224"}.bi-card-heading:before{content:"\\f225"}.bi-card-image:before{content:"\\f226"}.bi-card-list:before{content:"\\f227"}.bi-card-text:before{content:"\\f228"}.bi-caret-down-fill:before{content:"\\f229"}.bi-caret-down-square-fill:before{content:"\\f22a"}.bi-caret-down-square:before{content:"\\f22b"}.bi-caret-down:before{content:"\\f22c"}.bi-caret-left-fill:before{content:"\\f22d"}.bi-caret-left-square-fill:before{content:"\\f22e"}.bi-caret-left-square:before{content:"\\f22f"}.bi-caret-left:before{content:"\\f230"}.bi-caret-right-fill:before{content:"\\f231"}.bi-caret-right-square-fill:before{content:"\\f232"}.bi-caret-right-square:before{content:"\\f233"}.bi-caret-right:before{content:"\\f234"}.bi-caret-up-fill:before{content:"\\f235"}.bi-caret-up-square-fill:before{content:"\\f236"}.bi-caret-up-square:before{content:"\\f237"}.bi-caret-up:before{content:"\\f238"}.bi-cart-check-fill:before{content:"\\f239"}.bi-cart-check:before{content:"\\f23a"}.bi-cart-dash-fill:before{content:"\\f23b"}.bi-cart-dash:before{content:"\\f23c"}.bi-cart-fill:before{content:"\\f23d"}.bi-cart-plus-fill:before{content:"\\f23e"}.bi-cart-plus:before{content:"\\f23f"}.bi-cart-x-fill:before{content:"\\f240"}.bi-cart-x:before{content:"\\f241"}.bi-cart:before{content:"\\f242"}.bi-cart2:before{content:"\\f243"}.bi-cart3:before{content:"\\f244"}.bi-cart4:before{content:"\\f245"}.bi-cash-stack:before{content:"\\f246"}.bi-cash:before{content:"\\f247"}.bi-cast:before{content:"\\f248"}.bi-chat-dots-fill:before{content:"\\f249"}.bi-chat-dots:before{content:"\\f24a"}.bi-chat-fill:before{content:"\\f24b"}.bi-chat-left-dots-fill:before{content:"\\f24c"}.bi-chat-left-dots:before{content:"\\f24d"}.bi-chat-left-fill:before{content:"\\f24e"}.bi-chat-left-quote-fill:before{content:"\\f24f"}.bi-chat-left-quote:before{content:"\\f250"}.bi-chat-left-text-fill:before{content:"\\f251"}.bi-chat-left-text:before{content:"\\f252"}.bi-chat-left:before{content:"\\f253"}.bi-chat-quote-fill:before{content:"\\f254"}.bi-chat-quote:before{content:"\\f255"}.bi-chat-right-dots-fill:before{content:"\\f256"}.bi-chat-right-dots:before{content:"\\f257"}.bi-chat-right-fill:before{content:"\\f258"}.bi-chat-right-quote-fill:before{content:"\\f259"}.bi-chat-right-quote:before{content:"\\f25a"}.bi-chat-right-text-fill:before{content:"\\f25b"}.bi-chat-right-text:before{content:"\\f25c"}.bi-chat-right:before{content:"\\f25d"}.bi-chat-square-dots-fill:before{content:"\\f25e"}.bi-chat-square-dots:before{content:"\\f25f"}.bi-chat-square-fill:before{content:"\\f260"}.bi-chat-square-quote-fill:before{content:"\\f261"}.bi-chat-square-quote:before{content:"\\f262"}.bi-chat-square-text-fill:before{content:"\\f263"}.bi-chat-square-text:before{content:"\\f264"}.bi-chat-square:before{content:"\\f265"}.bi-chat-text-fill:before{content:"\\f266"}.bi-chat-text:before{content:"\\f267"}.bi-chat:before{content:"\\f268"}.bi-check-all:before{content:"\\f269"}.bi-check-circle-fill:before{content:"\\f26a"}.bi-check-circle:before{content:"\\f26b"}.bi-check-square-fill:before{content:"\\f26c"}.bi-check-square:before{content:"\\f26d"}.bi-check:before{content:"\\f26e"}.bi-check2-all:before{content:"\\f26f"}.bi-check2-circle:before{content:"\\f270"}.bi-check2-square:before{content:"\\f271"}.bi-check2:before{content:"\\f272"}.bi-chevron-bar-contract:before{content:"\\f273"}.bi-chevron-bar-down:before{content:"\\f274"}.bi-chevron-bar-expand:before{content:"\\f275"}.bi-chevron-bar-left:before{content:"\\f276"}.bi-chevron-bar-right:before{content:"\\f277"}.bi-chevron-bar-up:before{content:"\\f278"}.bi-chevron-compact-down:before{content:"\\f279"}.bi-chevron-compact-left:before{content:"\\f27a"}.bi-chevron-compact-right:before{content:"\\f27b"}.bi-chevron-compact-up:before{content:"\\f27c"}.bi-chevron-contract:before{content:"\\f27d"}.bi-chevron-double-down:before{content:"\\f27e"}.bi-chevron-double-left:before{content:"\\f27f"}.bi-chevron-double-right:before{content:"\\f280"}.bi-chevron-double-up:before{content:"\\f281"}.bi-chevron-down:before{content:"\\f282"}.bi-chevron-expand:before{content:"\\f283"}.bi-chevron-left:before{content:"\\f284"}.bi-chevron-right:before{content:"\\f285"}.bi-chevron-up:before{content:"\\f286"}.bi-circle-fill:before{content:"\\f287"}.bi-circle-half:before{content:"\\f288"}.bi-circle-square:before{content:"\\f289"}.bi-circle:before{content:"\\f28a"}.bi-clipboard-check:before{content:"\\f28b"}.bi-clipboard-data:before{content:"\\f28c"}.bi-clipboard-minus:before{content:"\\f28d"}.bi-clipboard-plus:before{content:"\\f28e"}.bi-clipboard-x:before{content:"\\f28f"}.bi-clipboard:before{content:"\\f290"}.bi-clock-fill:before{content:"\\f291"}.bi-clock-history:before{content:"\\f292"}.bi-clock:before{content:"\\f293"}.bi-cloud-arrow-down-fill:before{content:"\\f294"}.bi-cloud-arrow-down:before{content:"\\f295"}.bi-cloud-arrow-up-fill:before{content:"\\f296"}.bi-cloud-arrow-up:before{content:"\\f297"}.bi-cloud-check-fill:before{content:"\\f298"}.bi-cloud-check:before{content:"\\f299"}.bi-cloud-download-fill:before{content:"\\f29a"}.bi-cloud-download:before{content:"\\f29b"}.bi-cloud-drizzle-fill:before{content:"\\f29c"}.bi-cloud-drizzle:before{content:"\\f29d"}.bi-cloud-fill:before{content:"\\f29e"}.bi-cloud-fog-fill:before{content:"\\f29f"}.bi-cloud-fog:before{content:"\\f2a0"}.bi-cloud-fog2-fill:before{content:"\\f2a1"}.bi-cloud-fog2:before{content:"\\f2a2"}.bi-cloud-hail-fill:before{content:"\\f2a3"}.bi-cloud-hail:before{content:"\\f2a4"}.bi-cloud-haze-fill:before{content:"\\f2a6"}.bi-cloud-haze:before{content:"\\f2a7"}.bi-cloud-haze2-fill:before{content:"\\f2a8"}.bi-cloud-lightning-fill:before{content:"\\f2a9"}.bi-cloud-lightning-rain-fill:before{content:"\\f2aa"}.bi-cloud-lightning-rain:before{content:"\\f2ab"}.bi-cloud-lightning:before{content:"\\f2ac"}.bi-cloud-minus-fill:before{content:"\\f2ad"}.bi-cloud-minus:before{content:"\\f2ae"}.bi-cloud-moon-fill:before{content:"\\f2af"}.bi-cloud-moon:before{content:"\\f2b0"}.bi-cloud-plus-fill:before{content:"\\f2b1"}.bi-cloud-plus:before{content:"\\f2b2"}.bi-cloud-rain-fill:before{content:"\\f2b3"}.bi-cloud-rain-heavy-fill:before{content:"\\f2b4"}.bi-cloud-rain-heavy:before{content:"\\f2b5"}.bi-cloud-rain:before{content:"\\f2b6"}.bi-cloud-slash-fill:before{content:"\\f2b7"}.bi-cloud-slash:before{content:"\\f2b8"}.bi-cloud-sleet-fill:before{content:"\\f2b9"}.bi-cloud-sleet:before{content:"\\f2ba"}.bi-cloud-snow-fill:before{content:"\\f2bb"}.bi-cloud-snow:before{content:"\\f2bc"}.bi-cloud-sun-fill:before{content:"\\f2bd"}.bi-cloud-sun:before{content:"\\f2be"}.bi-cloud-upload-fill:before{content:"\\f2bf"}.bi-cloud-upload:before{content:"\\f2c0"}.bi-cloud:before{content:"\\f2c1"}.bi-clouds-fill:before{content:"\\f2c2"}.bi-clouds:before{content:"\\f2c3"}.bi-cloudy-fill:before{content:"\\f2c4"}.bi-cloudy:before{content:"\\f2c5"}.bi-code-slash:before{content:"\\f2c6"}.bi-code-square:before{content:"\\f2c7"}.bi-code:before{content:"\\f2c8"}.bi-collection-fill:before{content:"\\f2c9"}.bi-collection-play-fill:before{content:"\\f2ca"}.bi-collection-play:before{content:"\\f2cb"}.bi-collection:before{content:"\\f2cc"}.bi-columns-gap:before{content:"\\f2cd"}.bi-columns:before{content:"\\f2ce"}.bi-command:before{content:"\\f2cf"}.bi-compass-fill:before{content:"\\f2d0"}.bi-compass:before{content:"\\f2d1"}.bi-cone-striped:before{content:"\\f2d2"}.bi-cone:before{content:"\\f2d3"}.bi-controller:before{content:"\\f2d4"}.bi-cpu-fill:before{content:"\\f2d5"}.bi-cpu:before{content:"\\f2d6"}.bi-credit-card-2-back-fill:before{content:"\\f2d7"}.bi-credit-card-2-back:before{content:"\\f2d8"}.bi-credit-card-2-front-fill:before{content:"\\f2d9"}.bi-credit-card-2-front:before{content:"\\f2da"}.bi-credit-card-fill:before{content:"\\f2db"}.bi-credit-card:before{content:"\\f2dc"}.bi-crop:before{content:"\\f2dd"}.bi-cup-fill:before{content:"\\f2de"}.bi-cup-straw:before{content:"\\f2df"}.bi-cup:before{content:"\\f2e0"}.bi-cursor-fill:before{content:"\\f2e1"}.bi-cursor-text:before{content:"\\f2e2"}.bi-cursor:before{content:"\\f2e3"}.bi-dash-circle-dotted:before{content:"\\f2e4"}.bi-dash-circle-fill:before{content:"\\f2e5"}.bi-dash-circle:before{content:"\\f2e6"}.bi-dash-square-dotted:before{content:"\\f2e7"}.bi-dash-square-fill:before{content:"\\f2e8"}.bi-dash-square:before{content:"\\f2e9"}.bi-dash:before{content:"\\f2ea"}.bi-diagram-2-fill:before{content:"\\f2eb"}.bi-diagram-2:before{content:"\\f2ec"}.bi-diagram-3-fill:before{content:"\\f2ed"}.bi-diagram-3:before{content:"\\f2ee"}.bi-diamond-fill:before{content:"\\f2ef"}.bi-diamond-half:before{content:"\\f2f0"}.bi-diamond:before{content:"\\f2f1"}.bi-dice-1-fill:before{content:"\\f2f2"}.bi-dice-1:before{content:"\\f2f3"}.bi-dice-2-fill:before{content:"\\f2f4"}.bi-dice-2:before{content:"\\f2f5"}.bi-dice-3-fill:before{content:"\\f2f6"}.bi-dice-3:before{content:"\\f2f7"}.bi-dice-4-fill:before{content:"\\f2f8"}.bi-dice-4:before{content:"\\f2f9"}.bi-dice-5-fill:before{content:"\\f2fa"}.bi-dice-5:before{content:"\\f2fb"}.bi-dice-6-fill:before{content:"\\f2fc"}.bi-dice-6:before{content:"\\f2fd"}.bi-disc-fill:before{content:"\\f2fe"}.bi-disc:before{content:"\\f2ff"}.bi-discord:before{content:"\\f300"}.bi-display-fill:before{content:"\\f301"}.bi-display:before{content:"\\f302"}.bi-distribute-horizontal:before{content:"\\f303"}.bi-distribute-vertical:before{content:"\\f304"}.bi-door-closed-fill:before{content:"\\f305"}.bi-door-closed:before{content:"\\f306"}.bi-door-open-fill:before{content:"\\f307"}.bi-door-open:before{content:"\\f308"}.bi-dot:before{content:"\\f309"}.bi-download:before{content:"\\f30a"}.bi-droplet-fill:before{content:"\\f30b"}.bi-droplet-half:before{content:"\\f30c"}.bi-droplet:before{content:"\\f30d"}.bi-earbuds:before{content:"\\f30e"}.bi-easel-fill:before{content:"\\f30f"}.bi-easel:before{content:"\\f310"}.bi-egg-fill:before{content:"\\f311"}.bi-egg-fried:before{content:"\\f312"}.bi-egg:before{content:"\\f313"}.bi-eject-fill:before{content:"\\f314"}.bi-eject:before{content:"\\f315"}.bi-emoji-angry-fill:before{content:"\\f316"}.bi-emoji-angry:before{content:"\\f317"}.bi-emoji-dizzy-fill:before{content:"\\f318"}.bi-emoji-dizzy:before{content:"\\f319"}.bi-emoji-expressionless-fill:before{content:"\\f31a"}.bi-emoji-expressionless:before{content:"\\f31b"}.bi-emoji-frown-fill:before{content:"\\f31c"}.bi-emoji-frown:before{content:"\\f31d"}.bi-emoji-heart-eyes-fill:before{content:"\\f31e"}.bi-emoji-heart-eyes:before{content:"\\f31f"}.bi-emoji-laughing-fill:before{content:"\\f320"}.bi-emoji-laughing:before{content:"\\f321"}.bi-emoji-neutral-fill:before{content:"\\f322"}.bi-emoji-neutral:before{content:"\\f323"}.bi-emoji-smile-fill:before{content:"\\f324"}.bi-emoji-smile-upside-down-fill:before{content:"\\f325"}.bi-emoji-smile-upside-down:before{content:"\\f326"}.bi-emoji-smile:before{content:"\\f327"}.bi-emoji-sunglasses-fill:before{content:"\\f328"}.bi-emoji-sunglasses:before{content:"\\f329"}.bi-emoji-wink-fill:before{content:"\\f32a"}.bi-emoji-wink:before{content:"\\f32b"}.bi-envelope-fill:before{content:"\\f32c"}.bi-envelope-open-fill:before{content:"\\f32d"}.bi-envelope-open:before{content:"\\f32e"}.bi-envelope:before{content:"\\f32f"}.bi-eraser-fill:before{content:"\\f330"}.bi-eraser:before{content:"\\f331"}.bi-exclamation-circle-fill:before{content:"\\f332"}.bi-exclamation-circle:before{content:"\\f333"}.bi-exclamation-diamond-fill:before{content:"\\f334"}.bi-exclamation-diamond:before{content:"\\f335"}.bi-exclamation-octagon-fill:before{content:"\\f336"}.bi-exclamation-octagon:before{content:"\\f337"}.bi-exclamation-square-fill:before{content:"\\f338"}.bi-exclamation-square:before{content:"\\f339"}.bi-exclamation-triangle-fill:before{content:"\\f33a"}.bi-exclamation-triangle:before{content:"\\f33b"}.bi-exclamation:before{content:"\\f33c"}.bi-exclude:before{content:"\\f33d"}.bi-eye-fill:before{content:"\\f33e"}.bi-eye-slash-fill:before{content:"\\f33f"}.bi-eye-slash:before{content:"\\f340"}.bi-eye:before{content:"\\f341"}.bi-eyedropper:before{content:"\\f342"}.bi-eyeglasses:before{content:"\\f343"}.bi-facebook:before{content:"\\f344"}.bi-file-arrow-down-fill:before{content:"\\f345"}.bi-file-arrow-down:before{content:"\\f346"}.bi-file-arrow-up-fill:before{content:"\\f347"}.bi-file-arrow-up:before{content:"\\f348"}.bi-file-bar-graph-fill:before{content:"\\f349"}.bi-file-bar-graph:before{content:"\\f34a"}.bi-file-binary-fill:before{content:"\\f34b"}.bi-file-binary:before{content:"\\f34c"}.bi-file-break-fill:before{content:"\\f34d"}.bi-file-break:before{content:"\\f34e"}.bi-file-check-fill:before{content:"\\f34f"}.bi-file-check:before{content:"\\f350"}.bi-file-code-fill:before{content:"\\f351"}.bi-file-code:before{content:"\\f352"}.bi-file-diff-fill:before{content:"\\f353"}.bi-file-diff:before{content:"\\f354"}.bi-file-earmark-arrow-down-fill:before{content:"\\f355"}.bi-file-earmark-arrow-down:before{content:"\\f356"}.bi-file-earmark-arrow-up-fill:before{content:"\\f357"}.bi-file-earmark-arrow-up:before{content:"\\f358"}.bi-file-earmark-bar-graph-fill:before{content:"\\f359"}.bi-file-earmark-bar-graph:before{content:"\\f35a"}.bi-file-earmark-binary-fill:before{content:"\\f35b"}.bi-file-earmark-binary:before{content:"\\f35c"}.bi-file-earmark-break-fill:before{content:"\\f35d"}.bi-file-earmark-break:before{content:"\\f35e"}.bi-file-earmark-check-fill:before{content:"\\f35f"}.bi-file-earmark-check:before{content:"\\f360"}.bi-file-earmark-code-fill:before{content:"\\f361"}.bi-file-earmark-code:before{content:"\\f362"}.bi-file-earmark-diff-fill:before{content:"\\f363"}.bi-file-earmark-diff:before{content:"\\f364"}.bi-file-earmark-easel-fill:before{content:"\\f365"}.bi-file-earmark-easel:before{content:"\\f366"}.bi-file-earmark-excel-fill:before{content:"\\f367"}.bi-file-earmark-excel:before{content:"\\f368"}.bi-file-earmark-fill:before{content:"\\f369"}.bi-file-earmark-font-fill:before{content:"\\f36a"}.bi-file-earmark-font:before{content:"\\f36b"}.bi-file-earmark-image-fill:before{content:"\\f36c"}.bi-file-earmark-image:before{content:"\\f36d"}.bi-file-earmark-lock-fill:before{content:"\\f36e"}.bi-file-earmark-lock:before{content:"\\f36f"}.bi-file-earmark-lock2-fill:before{content:"\\f370"}.bi-file-earmark-lock2:before{content:"\\f371"}.bi-file-earmark-medical-fill:before{content:"\\f372"}.bi-file-earmark-medical:before{content:"\\f373"}.bi-file-earmark-minus-fill:before{content:"\\f374"}.bi-file-earmark-minus:before{content:"\\f375"}.bi-file-earmark-music-fill:before{content:"\\f376"}.bi-file-earmark-music:before{content:"\\f377"}.bi-file-earmark-person-fill:before{content:"\\f378"}.bi-file-earmark-person:before{content:"\\f379"}.bi-file-earmark-play-fill:before{content:"\\f37a"}.bi-file-earmark-play:before{content:"\\f37b"}.bi-file-earmark-plus-fill:before{content:"\\f37c"}.bi-file-earmark-plus:before{content:"\\f37d"}.bi-file-earmark-post-fill:before{content:"\\f37e"}.bi-file-earmark-post:before{content:"\\f37f"}.bi-file-earmark-ppt-fill:before{content:"\\f380"}.bi-file-earmark-ppt:before{content:"\\f381"}.bi-file-earmark-richtext-fill:before{content:"\\f382"}.bi-file-earmark-richtext:before{content:"\\f383"}.bi-file-earmark-ruled-fill:before{content:"\\f384"}.bi-file-earmark-ruled:before{content:"\\f385"}.bi-file-earmark-slides-fill:before{content:"\\f386"}.bi-file-earmark-slides:before{content:"\\f387"}.bi-file-earmark-spreadsheet-fill:before{content:"\\f388"}.bi-file-earmark-spreadsheet:before{content:"\\f389"}.bi-file-earmark-text-fill:before{content:"\\f38a"}.bi-file-earmark-text:before{content:"\\f38b"}.bi-file-earmark-word-fill:before{content:"\\f38c"}.bi-file-earmark-word:before{content:"\\f38d"}.bi-file-earmark-x-fill:before{content:"\\f38e"}.bi-file-earmark-x:before{content:"\\f38f"}.bi-file-earmark-zip-fill:before{content:"\\f390"}.bi-file-earmark-zip:before{content:"\\f391"}.bi-file-earmark:before{content:"\\f392"}.bi-file-easel-fill:before{content:"\\f393"}.bi-file-easel:before{content:"\\f394"}.bi-file-excel-fill:before{content:"\\f395"}.bi-file-excel:before{content:"\\f396"}.bi-file-fill:before{content:"\\f397"}.bi-file-font-fill:before{content:"\\f398"}.bi-file-font:before{content:"\\f399"}.bi-file-image-fill:before{content:"\\f39a"}.bi-file-image:before{content:"\\f39b"}.bi-file-lock-fill:before{content:"\\f39c"}.bi-file-lock:before{content:"\\f39d"}.bi-file-lock2-fill:before{content:"\\f39e"}.bi-file-lock2:before{content:"\\f39f"}.bi-file-medical-fill:before{content:"\\f3a0"}.bi-file-medical:before{content:"\\f3a1"}.bi-file-minus-fill:before{content:"\\f3a2"}.bi-file-minus:before{content:"\\f3a3"}.bi-file-music-fill:before{content:"\\f3a4"}.bi-file-music:before{content:"\\f3a5"}.bi-file-person-fill:before{content:"\\f3a6"}.bi-file-person:before{content:"\\f3a7"}.bi-file-play-fill:before{content:"\\f3a8"}.bi-file-play:before{content:"\\f3a9"}.bi-file-plus-fill:before{content:"\\f3aa"}.bi-file-plus:before{content:"\\f3ab"}.bi-file-post-fill:before{content:"\\f3ac"}.bi-file-post:before{content:"\\f3ad"}.bi-file-ppt-fill:before{content:"\\f3ae"}.bi-file-ppt:before{content:"\\f3af"}.bi-file-richtext-fill:before{content:"\\f3b0"}.bi-file-richtext:before{content:"\\f3b1"}.bi-file-ruled-fill:before{content:"\\f3b2"}.bi-file-ruled:before{content:"\\f3b3"}.bi-file-slides-fill:before{content:"\\f3b4"}.bi-file-slides:before{content:"\\f3b5"}.bi-file-spreadsheet-fill:before{content:"\\f3b6"}.bi-file-spreadsheet:before{content:"\\f3b7"}.bi-file-text-fill:before{content:"\\f3b8"}.bi-file-text:before{content:"\\f3b9"}.bi-file-word-fill:before{content:"\\f3ba"}.bi-file-word:before{content:"\\f3bb"}.bi-file-x-fill:before{content:"\\f3bc"}.bi-file-x:before{content:"\\f3bd"}.bi-file-zip-fill:before{content:"\\f3be"}.bi-file-zip:before{content:"\\f3bf"}.bi-file:before{content:"\\f3c0"}.bi-files-alt:before{content:"\\f3c1"}.bi-files:before{content:"\\f3c2"}.bi-film:before{content:"\\f3c3"}.bi-filter-circle-fill:before{content:"\\f3c4"}.bi-filter-circle:before{content:"\\f3c5"}.bi-filter-left:before{content:"\\f3c6"}.bi-filter-right:before{content:"\\f3c7"}.bi-filter-square-fill:before{content:"\\f3c8"}.bi-filter-square:before{content:"\\f3c9"}.bi-filter:before{content:"\\f3ca"}.bi-flag-fill:before{content:"\\f3cb"}.bi-flag:before{content:"\\f3cc"}.bi-flower1:before{content:"\\f3cd"}.bi-flower2:before{content:"\\f3ce"}.bi-flower3:before{content:"\\f3cf"}.bi-folder-check:before{content:"\\f3d0"}.bi-folder-fill:before{content:"\\f3d1"}.bi-folder-minus:before{content:"\\f3d2"}.bi-folder-plus:before{content:"\\f3d3"}.bi-folder-symlink-fill:before{content:"\\f3d4"}.bi-folder-symlink:before{content:"\\f3d5"}.bi-folder-x:before{content:"\\f3d6"}.bi-folder:before{content:"\\f3d7"}.bi-folder2-open:before{content:"\\f3d8"}.bi-folder2:before{content:"\\f3d9"}.bi-fonts:before{content:"\\f3da"}.bi-forward-fill:before{content:"\\f3db"}.bi-forward:before{content:"\\f3dc"}.bi-front:before{content:"\\f3dd"}.bi-fullscreen-exit:before{content:"\\f3de"}.bi-fullscreen:before{content:"\\f3df"}.bi-funnel-fill:before{content:"\\f3e0"}.bi-funnel:before{content:"\\f3e1"}.bi-gear-fill:before{content:"\\f3e2"}.bi-gear-wide-connected:before{content:"\\f3e3"}.bi-gear-wide:before{content:"\\f3e4"}.bi-gear:before{content:"\\f3e5"}.bi-gem:before{content:"\\f3e6"}.bi-geo-alt-fill:before{content:"\\f3e7"}.bi-geo-alt:before{content:"\\f3e8"}.bi-geo-fill:before{content:"\\f3e9"}.bi-geo:before{content:"\\f3ea"}.bi-gift-fill:before{content:"\\f3eb"}.bi-gift:before{content:"\\f3ec"}.bi-github:before{content:"\\f3ed"}.bi-globe:before{content:"\\f3ee"}.bi-globe2:before{content:"\\f3ef"}.bi-google:before{content:"\\f3f0"}.bi-graph-down:before{content:"\\f3f1"}.bi-graph-up:before{content:"\\f3f2"}.bi-grid-1x2-fill:before{content:"\\f3f3"}.bi-grid-1x2:before{content:"\\f3f4"}.bi-grid-3x2-gap-fill:before{content:"\\f3f5"}.bi-grid-3x2-gap:before{content:"\\f3f6"}.bi-grid-3x2:before{content:"\\f3f7"}.bi-grid-3x3-gap-fill:before{content:"\\f3f8"}.bi-grid-3x3-gap:before{content:"\\f3f9"}.bi-grid-3x3:before{content:"\\f3fa"}.bi-grid-fill:before{content:"\\f3fb"}.bi-grid:before{content:"\\f3fc"}.bi-grip-horizontal:before{content:"\\f3fd"}.bi-grip-vertical:before{content:"\\f3fe"}.bi-hammer:before{content:"\\f3ff"}.bi-hand-index-fill:before{content:"\\f400"}.bi-hand-index-thumb-fill:before{content:"\\f401"}.bi-hand-index-thumb:before{content:"\\f402"}.bi-hand-index:before{content:"\\f403"}.bi-hand-thumbs-down-fill:before{content:"\\f404"}.bi-hand-thumbs-down:before{content:"\\f405"}.bi-hand-thumbs-up-fill:before{content:"\\f406"}.bi-hand-thumbs-up:before{content:"\\f407"}.bi-handbag-fill:before{content:"\\f408"}.bi-handbag:before{content:"\\f409"}.bi-hash:before{content:"\\f40a"}.bi-hdd-fill:before{content:"\\f40b"}.bi-hdd-network-fill:before{content:"\\f40c"}.bi-hdd-network:before{content:"\\f40d"}.bi-hdd-rack-fill:before{content:"\\f40e"}.bi-hdd-rack:before{content:"\\f40f"}.bi-hdd-stack-fill:before{content:"\\f410"}.bi-hdd-stack:before{content:"\\f411"}.bi-hdd:before{content:"\\f412"}.bi-headphones:before{content:"\\f413"}.bi-headset:before{content:"\\f414"}.bi-heart-fill:before{content:"\\f415"}.bi-heart-half:before{content:"\\f416"}.bi-heart:before{content:"\\f417"}.bi-heptagon-fill:before{content:"\\f418"}.bi-heptagon-half:before{content:"\\f419"}.bi-heptagon:before{content:"\\f41a"}.bi-hexagon-fill:before{content:"\\f41b"}.bi-hexagon-half:before{content:"\\f41c"}.bi-hexagon:before{content:"\\f41d"}.bi-hourglass-bottom:before{content:"\\f41e"}.bi-hourglass-split:before{content:"\\f41f"}.bi-hourglass-top:before{content:"\\f420"}.bi-hourglass:before{content:"\\f421"}.bi-house-door-fill:before{content:"\\f422"}.bi-house-door:before{content:"\\f423"}.bi-house-fill:before{content:"\\f424"}.bi-house:before{content:"\\f425"}.bi-hr:before{content:"\\f426"}.bi-hurricane:before{content:"\\f427"}.bi-image-alt:before{content:"\\f428"}.bi-image-fill:before{content:"\\f429"}.bi-image:before{content:"\\f42a"}.bi-images:before{content:"\\f42b"}.bi-inbox-fill:before{content:"\\f42c"}.bi-inbox:before{content:"\\f42d"}.bi-inboxes-fill:before{content:"\\f42e"}.bi-inboxes:before{content:"\\f42f"}.bi-info-circle-fill:before{content:"\\f430"}.bi-info-circle:before{content:"\\f431"}.bi-info-square-fill:before{content:"\\f432"}.bi-info-square:before{content:"\\f433"}.bi-info:before{content:"\\f434"}.bi-input-cursor-text:before{content:"\\f435"}.bi-input-cursor:before{content:"\\f436"}.bi-instagram:before{content:"\\f437"}.bi-intersect:before{content:"\\f438"}.bi-journal-album:before{content:"\\f439"}.bi-journal-arrow-down:before{content:"\\f43a"}.bi-journal-arrow-up:before{content:"\\f43b"}.bi-journal-bookmark-fill:before{content:"\\f43c"}.bi-journal-bookmark:before{content:"\\f43d"}.bi-journal-check:before{content:"\\f43e"}.bi-journal-code:before{content:"\\f43f"}.bi-journal-medical:before{content:"\\f440"}.bi-journal-minus:before{content:"\\f441"}.bi-journal-plus:before{content:"\\f442"}.bi-journal-richtext:before{content:"\\f443"}.bi-journal-text:before{content:"\\f444"}.bi-journal-x:before{content:"\\f445"}.bi-journal:before{content:"\\f446"}.bi-journals:before{content:"\\f447"}.bi-joystick:before{content:"\\f448"}.bi-justify-left:before{content:"\\f449"}.bi-justify-right:before{content:"\\f44a"}.bi-justify:before{content:"\\f44b"}.bi-kanban-fill:before{content:"\\f44c"}.bi-kanban:before{content:"\\f44d"}.bi-key-fill:before{content:"\\f44e"}.bi-key:before{content:"\\f44f"}.bi-keyboard-fill:before{content:"\\f450"}.bi-keyboard:before{content:"\\f451"}.bi-ladder:before{content:"\\f452"}.bi-lamp-fill:before{content:"\\f453"}.bi-lamp:before{content:"\\f454"}.bi-laptop-fill:before{content:"\\f455"}.bi-laptop:before{content:"\\f456"}.bi-layer-backward:before{content:"\\f457"}.bi-layer-forward:before{content:"\\f458"}.bi-layers-fill:before{content:"\\f459"}.bi-layers-half:before{content:"\\f45a"}.bi-layers:before{content:"\\f45b"}.bi-layout-sidebar-inset-reverse:before{content:"\\f45c"}.bi-layout-sidebar-inset:before{content:"\\f45d"}.bi-layout-sidebar-reverse:before{content:"\\f45e"}.bi-layout-sidebar:before{content:"\\f45f"}.bi-layout-split:before{content:"\\f460"}.bi-layout-text-sidebar-reverse:before{content:"\\f461"}.bi-layout-text-sidebar:before{content:"\\f462"}.bi-layout-text-window-reverse:before{content:"\\f463"}.bi-layout-text-window:before{content:"\\f464"}.bi-layout-three-columns:before{content:"\\f465"}.bi-layout-wtf:before{content:"\\f466"}.bi-life-preserver:before{content:"\\f467"}.bi-lightbulb-fill:before{content:"\\f468"}.bi-lightbulb-off-fill:before{content:"\\f469"}.bi-lightbulb-off:before{content:"\\f46a"}.bi-lightbulb:before{content:"\\f46b"}.bi-lightning-charge-fill:before{content:"\\f46c"}.bi-lightning-charge:before{content:"\\f46d"}.bi-lightning-fill:before{content:"\\f46e"}.bi-lightning:before{content:"\\f46f"}.bi-link-45deg:before{content:"\\f470"}.bi-link:before{content:"\\f471"}.bi-linkedin:before{content:"\\f472"}.bi-list-check:before{content:"\\f473"}.bi-list-nested:before{content:"\\f474"}.bi-list-ol:before{content:"\\f475"}.bi-list-stars:before{content:"\\f476"}.bi-list-task:before{content:"\\f477"}.bi-list-ul:before{content:"\\f478"}.bi-list:before{content:"\\f479"}.bi-lock-fill:before{content:"\\f47a"}.bi-lock:before{content:"\\f47b"}.bi-mailbox:before{content:"\\f47c"}.bi-mailbox2:before{content:"\\f47d"}.bi-map-fill:before{content:"\\f47e"}.bi-map:before{content:"\\f47f"}.bi-markdown-fill:before{content:"\\f480"}.bi-markdown:before{content:"\\f481"}.bi-mask:before{content:"\\f482"}.bi-megaphone-fill:before{content:"\\f483"}.bi-megaphone:before{content:"\\f484"}.bi-menu-app-fill:before{content:"\\f485"}.bi-menu-app:before{content:"\\f486"}.bi-menu-button-fill:before{content:"\\f487"}.bi-menu-button-wide-fill:before{content:"\\f488"}.bi-menu-button-wide:before{content:"\\f489"}.bi-menu-button:before{content:"\\f48a"}.bi-menu-down:before{content:"\\f48b"}.bi-menu-up:before{content:"\\f48c"}.bi-mic-fill:before{content:"\\f48d"}.bi-mic-mute-fill:before{content:"\\f48e"}.bi-mic-mute:before{content:"\\f48f"}.bi-mic:before{content:"\\f490"}.bi-minecart-loaded:before{content:"\\f491"}.bi-minecart:before{content:"\\f492"}.bi-moisture:before{content:"\\f493"}.bi-moon-fill:before{content:"\\f494"}.bi-moon-stars-fill:before{content:"\\f495"}.bi-moon-stars:before{content:"\\f496"}.bi-moon:before{content:"\\f497"}.bi-mouse-fill:before{content:"\\f498"}.bi-mouse:before{content:"\\f499"}.bi-mouse2-fill:before{content:"\\f49a"}.bi-mouse2:before{content:"\\f49b"}.bi-mouse3-fill:before{content:"\\f49c"}.bi-mouse3:before{content:"\\f49d"}.bi-music-note-beamed:before{content:"\\f49e"}.bi-music-note-list:before{content:"\\f49f"}.bi-music-note:before{content:"\\f4a0"}.bi-music-player-fill:before{content:"\\f4a1"}.bi-music-player:before{content:"\\f4a2"}.bi-newspaper:before{content:"\\f4a3"}.bi-node-minus-fill:before{content:"\\f4a4"}.bi-node-minus:before{content:"\\f4a5"}.bi-node-plus-fill:before{content:"\\f4a6"}.bi-node-plus:before{content:"\\f4a7"}.bi-nut-fill:before{content:"\\f4a8"}.bi-nut:before{content:"\\f4a9"}.bi-octagon-fill:before{content:"\\f4aa"}.bi-octagon-half:before{content:"\\f4ab"}.bi-octagon:before{content:"\\f4ac"}.bi-option:before{content:"\\f4ad"}.bi-outlet:before{content:"\\f4ae"}.bi-paint-bucket:before{content:"\\f4af"}.bi-palette-fill:before{content:"\\f4b0"}.bi-palette:before{content:"\\f4b1"}.bi-palette2:before{content:"\\f4b2"}.bi-paperclip:before{content:"\\f4b3"}.bi-paragraph:before{content:"\\f4b4"}.bi-patch-check-fill:before{content:"\\f4b5"}.bi-patch-check:before{content:"\\f4b6"}.bi-patch-exclamation-fill:before{content:"\\f4b7"}.bi-patch-exclamation:before{content:"\\f4b8"}.bi-patch-minus-fill:before{content:"\\f4b9"}.bi-patch-minus:before{content:"\\f4ba"}.bi-patch-plus-fill:before{content:"\\f4bb"}.bi-patch-plus:before{content:"\\f4bc"}.bi-patch-question-fill:before{content:"\\f4bd"}.bi-patch-question:before{content:"\\f4be"}.bi-pause-btn-fill:before{content:"\\f4bf"}.bi-pause-btn:before{content:"\\f4c0"}.bi-pause-circle-fill:before{content:"\\f4c1"}.bi-pause-circle:before{content:"\\f4c2"}.bi-pause-fill:before{content:"\\f4c3"}.bi-pause:before{content:"\\f4c4"}.bi-peace-fill:before{content:"\\f4c5"}.bi-peace:before{content:"\\f4c6"}.bi-pen-fill:before{content:"\\f4c7"}.bi-pen:before{content:"\\f4c8"}.bi-pencil-fill:before{content:"\\f4c9"}.bi-pencil-square:before{content:"\\f4ca"}.bi-pencil:before{content:"\\f4cb"}.bi-pentagon-fill:before{content:"\\f4cc"}.bi-pentagon-half:before{content:"\\f4cd"}.bi-pentagon:before{content:"\\f4ce"}.bi-people-fill:before{content:"\\f4cf"}.bi-people:before{content:"\\f4d0"}.bi-percent:before{content:"\\f4d1"}.bi-person-badge-fill:before{content:"\\f4d2"}.bi-person-badge:before{content:"\\f4d3"}.bi-person-bounding-box:before{content:"\\f4d4"}.bi-person-check-fill:before{content:"\\f4d5"}.bi-person-check:before{content:"\\f4d6"}.bi-person-circle:before{content:"\\f4d7"}.bi-person-dash-fill:before{content:"\\f4d8"}.bi-person-dash:before{content:"\\f4d9"}.bi-person-fill:before{content:"\\f4da"}.bi-person-lines-fill:before{content:"\\f4db"}.bi-person-plus-fill:before{content:"\\f4dc"}.bi-person-plus:before{content:"\\f4dd"}.bi-person-square:before{content:"\\f4de"}.bi-person-x-fill:before{content:"\\f4df"}.bi-person-x:before{content:"\\f4e0"}.bi-person:before{content:"\\f4e1"}.bi-phone-fill:before{content:"\\f4e2"}.bi-phone-landscape-fill:before{content:"\\f4e3"}.bi-phone-landscape:before{content:"\\f4e4"}.bi-phone-vibrate-fill:before{content:"\\f4e5"}.bi-phone-vibrate:before{content:"\\f4e6"}.bi-phone:before{content:"\\f4e7"}.bi-pie-chart-fill:before{content:"\\f4e8"}.bi-pie-chart:before{content:"\\f4e9"}.bi-pin-angle-fill:before{content:"\\f4ea"}.bi-pin-angle:before{content:"\\f4eb"}.bi-pin-fill:before{content:"\\f4ec"}.bi-pin:before{content:"\\f4ed"}.bi-pip-fill:before{content:"\\f4ee"}.bi-pip:before{content:"\\f4ef"}.bi-play-btn-fill:before{content:"\\f4f0"}.bi-play-btn:before{content:"\\f4f1"}.bi-play-circle-fill:before{content:"\\f4f2"}.bi-play-circle:before{content:"\\f4f3"}.bi-play-fill:before{content:"\\f4f4"}.bi-play:before{content:"\\f4f5"}.bi-plug-fill:before{content:"\\f4f6"}.bi-plug:before{content:"\\f4f7"}.bi-plus-circle-dotted:before{content:"\\f4f8"}.bi-plus-circle-fill:before{content:"\\f4f9"}.bi-plus-circle:before{content:"\\f4fa"}.bi-plus-square-dotted:before{content:"\\f4fb"}.bi-plus-square-fill:before{content:"\\f4fc"}.bi-plus-square:before{content:"\\f4fd"}.bi-plus:before{content:"\\f4fe"}.bi-power:before{content:"\\f4ff"}.bi-printer-fill:before{content:"\\f500"}.bi-printer:before{content:"\\f501"}.bi-puzzle-fill:before{content:"\\f502"}.bi-puzzle:before{content:"\\f503"}.bi-question-circle-fill:before{content:"\\f504"}.bi-question-circle:before{content:"\\f505"}.bi-question-diamond-fill:before{content:"\\f506"}.bi-question-diamond:before{content:"\\f507"}.bi-question-octagon-fill:before{content:"\\f508"}.bi-question-octagon:before{content:"\\f509"}.bi-question-square-fill:before{content:"\\f50a"}.bi-question-square:before{content:"\\f50b"}.bi-question:before{content:"\\f50c"}.bi-rainbow:before{content:"\\f50d"}.bi-receipt-cutoff:before{content:"\\f50e"}.bi-receipt:before{content:"\\f50f"}.bi-reception-0:before{content:"\\f510"}.bi-reception-1:before{content:"\\f511"}.bi-reception-2:before{content:"\\f512"}.bi-reception-3:before{content:"\\f513"}.bi-reception-4:before{content:"\\f514"}.bi-record-btn-fill:before{content:"\\f515"}.bi-record-btn:before{content:"\\f516"}.bi-record-circle-fill:before{content:"\\f517"}.bi-record-circle:before{content:"\\f518"}.bi-record-fill:before{content:"\\f519"}.bi-record:before{content:"\\f51a"}.bi-record2-fill:before{content:"\\f51b"}.bi-record2:before{content:"\\f51c"}.bi-reply-all-fill:before{content:"\\f51d"}.bi-reply-all:before{content:"\\f51e"}.bi-reply-fill:before{content:"\\f51f"}.bi-reply:before{content:"\\f520"}.bi-rss-fill:before{content:"\\f521"}.bi-rss:before{content:"\\f522"}.bi-rulers:before{content:"\\f523"}.bi-save-fill:before{content:"\\f524"}.bi-save:before{content:"\\f525"}.bi-save2-fill:before{content:"\\f526"}.bi-save2:before{content:"\\f527"}.bi-scissors:before{content:"\\f528"}.bi-screwdriver:before{content:"\\f529"}.bi-search:before{content:"\\f52a"}.bi-segmented-nav:before{content:"\\f52b"}.bi-server:before{content:"\\f52c"}.bi-share-fill:before{content:"\\f52d"}.bi-share:before{content:"\\f52e"}.bi-shield-check:before{content:"\\f52f"}.bi-shield-exclamation:before{content:"\\f530"}.bi-shield-fill-check:before{content:"\\f531"}.bi-shield-fill-exclamation:before{content:"\\f532"}.bi-shield-fill-minus:before{content:"\\f533"}.bi-shield-fill-plus:before{content:"\\f534"}.bi-shield-fill-x:before{content:"\\f535"}.bi-shield-fill:before{content:"\\f536"}.bi-shield-lock-fill:before{content:"\\f537"}.bi-shield-lock:before{content:"\\f538"}.bi-shield-minus:before{content:"\\f539"}.bi-shield-plus:before{content:"\\f53a"}.bi-shield-shaded:before{content:"\\f53b"}.bi-shield-slash-fill:before{content:"\\f53c"}.bi-shield-slash:before{content:"\\f53d"}.bi-shield-x:before{content:"\\f53e"}.bi-shield:before{content:"\\f53f"}.bi-shift-fill:before{content:"\\f540"}.bi-shift:before{content:"\\f541"}.bi-shop-window:before{content:"\\f542"}.bi-shop:before{content:"\\f543"}.bi-shuffle:before{content:"\\f544"}.bi-signpost-2-fill:before{content:"\\f545"}.bi-signpost-2:before{content:"\\f546"}.bi-signpost-fill:before{content:"\\f547"}.bi-signpost-split-fill:before{content:"\\f548"}.bi-signpost-split:before{content:"\\f549"}.bi-signpost:before{content:"\\f54a"}.bi-sim-fill:before{content:"\\f54b"}.bi-sim:before{content:"\\f54c"}.bi-skip-backward-btn-fill:before{content:"\\f54d"}.bi-skip-backward-btn:before{content:"\\f54e"}.bi-skip-backward-circle-fill:before{content:"\\f54f"}.bi-skip-backward-circle:before{content:"\\f550"}.bi-skip-backward-fill:before{content:"\\f551"}.bi-skip-backward:before{content:"\\f552"}.bi-skip-end-btn-fill:before{content:"\\f553"}.bi-skip-end-btn:before{content:"\\f554"}.bi-skip-end-circle-fill:before{content:"\\f555"}.bi-skip-end-circle:before{content:"\\f556"}.bi-skip-end-fill:before{content:"\\f557"}.bi-skip-end:before{content:"\\f558"}.bi-skip-forward-btn-fill:before{content:"\\f559"}.bi-skip-forward-btn:before{content:"\\f55a"}.bi-skip-forward-circle-fill:before{content:"\\f55b"}.bi-skip-forward-circle:before{content:"\\f55c"}.bi-skip-forward-fill:before{content:"\\f55d"}.bi-skip-forward:before{content:"\\f55e"}.bi-skip-start-btn-fill:before{content:"\\f55f"}.bi-skip-start-btn:before{content:"\\f560"}.bi-skip-start-circle-fill:before{content:"\\f561"}.bi-skip-start-circle:before{content:"\\f562"}.bi-skip-start-fill:before{content:"\\f563"}.bi-skip-start:before{content:"\\f564"}.bi-slack:before{content:"\\f565"}.bi-slash-circle-fill:before{content:"\\f566"}.bi-slash-circle:before{content:"\\f567"}.bi-slash-square-fill:before{content:"\\f568"}.bi-slash-square:before{content:"\\f569"}.bi-slash:before{content:"\\f56a"}.bi-sliders:before{content:"\\f56b"}.bi-smartwatch:before{content:"\\f56c"}.bi-snow:before{content:"\\f56d"}.bi-snow2:before{content:"\\f56e"}.bi-snow3:before{content:"\\f56f"}.bi-sort-alpha-down-alt:before{content:"\\f570"}.bi-sort-alpha-down:before{content:"\\f571"}.bi-sort-alpha-up-alt:before{content:"\\f572"}.bi-sort-alpha-up:before{content:"\\f573"}.bi-sort-down-alt:before{content:"\\f574"}.bi-sort-down:before{content:"\\f575"}.bi-sort-numeric-down-alt:before{content:"\\f576"}.bi-sort-numeric-down:before{content:"\\f577"}.bi-sort-numeric-up-alt:before{content:"\\f578"}.bi-sort-numeric-up:before{content:"\\f579"}.bi-sort-up-alt:before{content:"\\f57a"}.bi-sort-up:before{content:"\\f57b"}.bi-soundwave:before{content:"\\f57c"}.bi-speaker-fill:before{content:"\\f57d"}.bi-speaker:before{content:"\\f57e"}.bi-speedometer:before{content:"\\f57f"}.bi-speedometer2:before{content:"\\f580"}.bi-spellcheck:before{content:"\\f581"}.bi-square-fill:before{content:"\\f582"}.bi-square-half:before{content:"\\f583"}.bi-square:before{content:"\\f584"}.bi-stack:before{content:"\\f585"}.bi-star-fill:before{content:"\\f586"}.bi-star-half:before{content:"\\f587"}.bi-star:before{content:"\\f588"}.bi-stars:before{content:"\\f589"}.bi-stickies-fill:before{content:"\\f58a"}.bi-stickies:before{content:"\\f58b"}.bi-sticky-fill:before{content:"\\f58c"}.bi-sticky:before{content:"\\f58d"}.bi-stop-btn-fill:before{content:"\\f58e"}.bi-stop-btn:before{content:"\\f58f"}.bi-stop-circle-fill:before{content:"\\f590"}.bi-stop-circle:before{content:"\\f591"}.bi-stop-fill:before{content:"\\f592"}.bi-stop:before{content:"\\f593"}.bi-stoplights-fill:before{content:"\\f594"}.bi-stoplights:before{content:"\\f595"}.bi-stopwatch-fill:before{content:"\\f596"}.bi-stopwatch:before{content:"\\f597"}.bi-subtract:before{content:"\\f598"}.bi-suit-club-fill:before{content:"\\f599"}.bi-suit-club:before{content:"\\f59a"}.bi-suit-diamond-fill:before{content:"\\f59b"}.bi-suit-diamond:before{content:"\\f59c"}.bi-suit-heart-fill:before{content:"\\f59d"}.bi-suit-heart:before{content:"\\f59e"}.bi-suit-spade-fill:before{content:"\\f59f"}.bi-suit-spade:before{content:"\\f5a0"}.bi-sun-fill:before{content:"\\f5a1"}.bi-sun:before{content:"\\f5a2"}.bi-sunglasses:before{content:"\\f5a3"}.bi-sunrise-fill:before{content:"\\f5a4"}.bi-sunrise:before{content:"\\f5a5"}.bi-sunset-fill:before{content:"\\f5a6"}.bi-sunset:before{content:"\\f5a7"}.bi-symmetry-horizontal:before{content:"\\f5a8"}.bi-symmetry-vertical:before{content:"\\f5a9"}.bi-table:before{content:"\\f5aa"}.bi-tablet-fill:before{content:"\\f5ab"}.bi-tablet-landscape-fill:before{content:"\\f5ac"}.bi-tablet-landscape:before{content:"\\f5ad"}.bi-tablet:before{content:"\\f5ae"}.bi-tag-fill:before{content:"\\f5af"}.bi-tag:before{content:"\\f5b0"}.bi-tags-fill:before{content:"\\f5b1"}.bi-tags:before{content:"\\f5b2"}.bi-telegram:before{content:"\\f5b3"}.bi-telephone-fill:before{content:"\\f5b4"}.bi-telephone-forward-fill:before{content:"\\f5b5"}.bi-telephone-forward:before{content:"\\f5b6"}.bi-telephone-inbound-fill:before{content:"\\f5b7"}.bi-telephone-inbound:before{content:"\\f5b8"}.bi-telephone-minus-fill:before{content:"\\f5b9"}.bi-telephone-minus:before{content:"\\f5ba"}.bi-telephone-outbound-fill:before{content:"\\f5bb"}.bi-telephone-outbound:before{content:"\\f5bc"}.bi-telephone-plus-fill:before{content:"\\f5bd"}.bi-telephone-plus:before{content:"\\f5be"}.bi-telephone-x-fill:before{content:"\\f5bf"}.bi-telephone-x:before{content:"\\f5c0"}.bi-telephone:before{content:"\\f5c1"}.bi-terminal-fill:before{content:"\\f5c2"}.bi-terminal:before{content:"\\f5c3"}.bi-text-center:before{content:"\\f5c4"}.bi-text-indent-left:before{content:"\\f5c5"}.bi-text-indent-right:before{content:"\\f5c6"}.bi-text-left:before{content:"\\f5c7"}.bi-text-paragraph:before{content:"\\f5c8"}.bi-text-right:before{content:"\\f5c9"}.bi-textarea-resize:before{content:"\\f5ca"}.bi-textarea-t:before{content:"\\f5cb"}.bi-textarea:before{content:"\\f5cc"}.bi-thermometer-half:before{content:"\\f5cd"}.bi-thermometer-high:before{content:"\\f5ce"}.bi-thermometer-low:before{content:"\\f5cf"}.bi-thermometer-snow:before{content:"\\f5d0"}.bi-thermometer-sun:before{content:"\\f5d1"}.bi-thermometer:before{content:"\\f5d2"}.bi-three-dots-vertical:before{content:"\\f5d3"}.bi-three-dots:before{content:"\\f5d4"}.bi-toggle-off:before{content:"\\f5d5"}.bi-toggle-on:before{content:"\\f5d6"}.bi-toggle2-off:before{content:"\\f5d7"}.bi-toggle2-on:before{content:"\\f5d8"}.bi-toggles:before{content:"\\f5d9"}.bi-toggles2:before{content:"\\f5da"}.bi-tools:before{content:"\\f5db"}.bi-tornado:before{content:"\\f5dc"}.bi-trash-fill:before{content:"\\f5dd"}.bi-trash:before{content:"\\f5de"}.bi-trash2-fill:before{content:"\\f5df"}.bi-trash2:before{content:"\\f5e0"}.bi-tree-fill:before{content:"\\f5e1"}.bi-tree:before{content:"\\f5e2"}.bi-triangle-fill:before{content:"\\f5e3"}.bi-triangle-half:before{content:"\\f5e4"}.bi-triangle:before{content:"\\f5e5"}.bi-trophy-fill:before{content:"\\f5e6"}.bi-trophy:before{content:"\\f5e7"}.bi-tropical-storm:before{content:"\\f5e8"}.bi-truck-flatbed:before{content:"\\f5e9"}.bi-truck:before{content:"\\f5ea"}.bi-tsunami:before{content:"\\f5eb"}.bi-tv-fill:before{content:"\\f5ec"}.bi-tv:before{content:"\\f5ed"}.bi-twitch:before{content:"\\f5ee"}.bi-twitter:before{content:"\\f5ef"}.bi-type-bold:before{content:"\\f5f0"}.bi-type-h1:before{content:"\\f5f1"}.bi-type-h2:before{content:"\\f5f2"}.bi-type-h3:before{content:"\\f5f3"}.bi-type-italic:before{content:"\\f5f4"}.bi-type-strikethrough:before{content:"\\f5f5"}.bi-type-underline:before{content:"\\f5f6"}.bi-type:before{content:"\\f5f7"}.bi-ui-checks-grid:before{content:"\\f5f8"}.bi-ui-checks:before{content:"\\f5f9"}.bi-ui-radios-grid:before{content:"\\f5fa"}.bi-ui-radios:before{content:"\\f5fb"}.bi-umbrella-fill:before{content:"\\f5fc"}.bi-umbrella:before{content:"\\f5fd"}.bi-union:before{content:"\\f5fe"}.bi-unlock-fill:before{content:"\\f5ff"}.bi-unlock:before{content:"\\f600"}.bi-upc-scan:before{content:"\\f601"}.bi-upc:before{content:"\\f602"}.bi-upload:before{content:"\\f603"}.bi-vector-pen:before{content:"\\f604"}.bi-view-list:before{content:"\\f605"}.bi-view-stacked:before{content:"\\f606"}.bi-vinyl-fill:before{content:"\\f607"}.bi-vinyl:before{content:"\\f608"}.bi-voicemail:before{content:"\\f609"}.bi-volume-down-fill:before{content:"\\f60a"}.bi-volume-down:before{content:"\\f60b"}.bi-volume-mute-fill:before{content:"\\f60c"}.bi-volume-mute:before{content:"\\f60d"}.bi-volume-off-fill:before{content:"\\f60e"}.bi-volume-off:before{content:"\\f60f"}.bi-volume-up-fill:before{content:"\\f610"}.bi-volume-up:before{content:"\\f611"}.bi-vr:before{content:"\\f612"}.bi-wallet-fill:before{content:"\\f613"}.bi-wallet:before{content:"\\f614"}.bi-wallet2:before{content:"\\f615"}.bi-watch:before{content:"\\f616"}.bi-water:before{content:"\\f617"}.bi-whatsapp:before{content:"\\f618"}.bi-wifi-1:before{content:"\\f619"}.bi-wifi-2:before{content:"\\f61a"}.bi-wifi-off:before{content:"\\f61b"}.bi-wifi:before{content:"\\f61c"}.bi-wind:before{content:"\\f61d"}.bi-window-dock:before{content:"\\f61e"}.bi-window-sidebar:before{content:"\\f61f"}.bi-window:before{content:"\\f620"}.bi-wrench:before{content:"\\f621"}.bi-x-circle-fill:before{content:"\\f622"}.bi-x-circle:before{content:"\\f623"}.bi-x-diamond-fill:before{content:"\\f624"}.bi-x-diamond:before{content:"\\f625"}.bi-x-octagon-fill:before{content:"\\f626"}.bi-x-octagon:before{content:"\\f627"}.bi-x-square-fill:before{content:"\\f628"}.bi-x-square:before{content:"\\f629"}.bi-x:before{content:"\\f62a"}.bi-youtube:before{content:"\\f62b"}.bi-zoom-in:before{content:"\\f62c"}.bi-zoom-out:before{content:"\\f62d"}.bi-bank:before{content:"\\f62e"}.bi-bank2:before{content:"\\f62f"}.bi-bell-slash-fill:before{content:"\\f630"}.bi-bell-slash:before{content:"\\f631"}.bi-cash-coin:before{content:"\\f632"}.bi-check-lg:before{content:"\\f633"}.bi-coin:before{content:"\\f634"}.bi-currency-bitcoin:before{content:"\\f635"}.bi-currency-dollar:before{content:"\\f636"}.bi-currency-euro:before{content:"\\f637"}.bi-currency-exchange:before{content:"\\f638"}.bi-currency-pound:before{content:"\\f639"}.bi-currency-yen:before{content:"\\f63a"}.bi-dash-lg:before{content:"\\f63b"}.bi-exclamation-lg:before{content:"\\f63c"}.bi-file-earmark-pdf-fill:before{content:"\\f63d"}.bi-file-earmark-pdf:before{content:"\\f63e"}.bi-file-pdf-fill:before{content:"\\f63f"}.bi-file-pdf:before{content:"\\f640"}.bi-gender-ambiguous:before{content:"\\f641"}.bi-gender-female:before{content:"\\f642"}.bi-gender-male:before{content:"\\f643"}.bi-gender-trans:before{content:"\\f644"}.bi-headset-vr:before{content:"\\f645"}.bi-info-lg:before{content:"\\f646"}.bi-mastodon:before{content:"\\f647"}.bi-messenger:before{content:"\\f648"}.bi-piggy-bank-fill:before{content:"\\f649"}.bi-piggy-bank:before{content:"\\f64a"}.bi-pin-map-fill:before{content:"\\f64b"}.bi-pin-map:before{content:"\\f64c"}.bi-plus-lg:before{content:"\\f64d"}.bi-question-lg:before{content:"\\f64e"}.bi-recycle:before{content:"\\f64f"}.bi-reddit:before{content:"\\f650"}.bi-safe-fill:before{content:"\\f651"}.bi-safe2-fill:before{content:"\\f652"}.bi-safe2:before{content:"\\f653"}.bi-sd-card-fill:before{content:"\\f654"}.bi-sd-card:before{content:"\\f655"}.bi-skype:before{content:"\\f656"}.bi-slash-lg:before{content:"\\f657"}.bi-translate:before{content:"\\f658"}.bi-x-lg:before{content:"\\f659"}.bi-safe:before{content:"\\f65a"}.bi-apple:before{content:"\\f65b"}.bi-microsoft:before{content:"\\f65d"}.bi-windows:before{content:"\\f65e"}.bi-behance:before{content:"\\f65c"}.bi-dribbble:before{content:"\\f65f"}.bi-line:before{content:"\\f660"}.bi-medium:before{content:"\\f661"}.bi-paypal:before{content:"\\f662"}.bi-pinterest:before{content:"\\f663"}.bi-signal:before{content:"\\f664"}.bi-snapchat:before{content:"\\f665"}.bi-spotify:before{content:"\\f666"}.bi-stack-overflow:before{content:"\\f667"}.bi-strava:before{content:"\\f668"}.bi-wordpress:before{content:"\\f669"}.bi-vimeo:before{content:"\\f66a"}.bi-activity:before{content:"\\f66b"}.bi-easel2-fill:before{content:"\\f66c"}.bi-easel2:before{content:"\\f66d"}.bi-easel3-fill:before{content:"\\f66e"}.bi-easel3:before{content:"\\f66f"}.bi-fan:before{content:"\\f670"}.bi-fingerprint:before{content:"\\f671"}.bi-graph-down-arrow:before{content:"\\f672"}.bi-graph-up-arrow:before{content:"\\f673"}.bi-hypnotize:before{content:"\\f674"}.bi-magic:before{content:"\\f675"}.bi-person-rolodex:before{content:"\\f676"}.bi-person-video:before{content:"\\f677"}.bi-person-video2:before{content:"\\f678"}.bi-person-video3:before{content:"\\f679"}.bi-person-workspace:before{content:"\\f67a"}.bi-radioactive:before{content:"\\f67b"}.bi-webcam-fill:before{content:"\\f67c"}.bi-webcam:before{content:"\\f67d"}.bi-yin-yang:before{content:"\\f67e"}.bi-bandaid-fill:before{content:"\\f680"}.bi-bandaid:before{content:"\\f681"}.bi-bluetooth:before{content:"\\f682"}.bi-body-text:before{content:"\\f683"}.bi-boombox:before{content:"\\f684"}.bi-boxes:before{content:"\\f685"}.bi-dpad-fill:before{content:"\\f686"}.bi-dpad:before{content:"\\f687"}.bi-ear-fill:before{content:"\\f688"}.bi-ear:before{content:"\\f689"}.bi-envelope-check-fill:before{content:"\\f68b"}.bi-envelope-check:before{content:"\\f68c"}.bi-envelope-dash-fill:before{content:"\\f68e"}.bi-envelope-dash:before{content:"\\f68f"}.bi-envelope-exclamation-fill:before{content:"\\f691"}.bi-envelope-exclamation:before{content:"\\f692"}.bi-envelope-plus-fill:before{content:"\\f693"}.bi-envelope-plus:before{content:"\\f694"}.bi-envelope-slash-fill:before{content:"\\f696"}.bi-envelope-slash:before{content:"\\f697"}.bi-envelope-x-fill:before{content:"\\f699"}.bi-envelope-x:before{content:"\\f69a"}.bi-explicit-fill:before{content:"\\f69b"}.bi-explicit:before{content:"\\f69c"}.bi-git:before{content:"\\f69d"}.bi-infinity:before{content:"\\f69e"}.bi-list-columns-reverse:before{content:"\\f69f"}.bi-list-columns:before{content:"\\f6a0"}.bi-meta:before{content:"\\f6a1"}.bi-nintendo-switch:before{content:"\\f6a4"}.bi-pc-display-horizontal:before{content:"\\f6a5"}.bi-pc-display:before{content:"\\f6a6"}.bi-pc-horizontal:before{content:"\\f6a7"}.bi-pc:before{content:"\\f6a8"}.bi-playstation:before{content:"\\f6a9"}.bi-plus-slash-minus:before{content:"\\f6aa"}.bi-projector-fill:before{content:"\\f6ab"}.bi-projector:before{content:"\\f6ac"}.bi-qr-code-scan:before{content:"\\f6ad"}.bi-qr-code:before{content:"\\f6ae"}.bi-quora:before{content:"\\f6af"}.bi-quote:before{content:"\\f6b0"}.bi-robot:before{content:"\\f6b1"}.bi-send-check-fill:before{content:"\\f6b2"}.bi-send-check:before{content:"\\f6b3"}.bi-send-dash-fill:before{content:"\\f6b4"}.bi-send-dash:before{content:"\\f6b5"}.bi-send-exclamation-fill:before{content:"\\f6b7"}.bi-send-exclamation:before{content:"\\f6b8"}.bi-send-fill:before{content:"\\f6b9"}.bi-send-plus-fill:before{content:"\\f6ba"}.bi-send-plus:before{content:"\\f6bb"}.bi-send-slash-fill:before{content:"\\f6bc"}.bi-send-slash:before{content:"\\f6bd"}.bi-send-x-fill:before{content:"\\f6be"}.bi-send-x:before{content:"\\f6bf"}.bi-send:before{content:"\\f6c0"}.bi-steam:before{content:"\\f6c1"}.bi-terminal-dash:before{content:"\\f6c3"}.bi-terminal-plus:before{content:"\\f6c4"}.bi-terminal-split:before{content:"\\f6c5"}.bi-ticket-detailed-fill:before{content:"\\f6c6"}.bi-ticket-detailed:before{content:"\\f6c7"}.bi-ticket-fill:before{content:"\\f6c8"}.bi-ticket-perforated-fill:before{content:"\\f6c9"}.bi-ticket-perforated:before{content:"\\f6ca"}.bi-ticket:before{content:"\\f6cb"}.bi-tiktok:before{content:"\\f6cc"}.bi-window-dash:before{content:"\\f6cd"}.bi-window-desktop:before{content:"\\f6ce"}.bi-window-fullscreen:before{content:"\\f6cf"}.bi-window-plus:before{content:"\\f6d0"}.bi-window-split:before{content:"\\f6d1"}.bi-window-stack:before{content:"\\f6d2"}.bi-window-x:before{content:"\\f6d3"}.bi-xbox:before{content:"\\f6d4"}.bi-ethernet:before{content:"\\f6d5"}.bi-hdmi-fill:before{content:"\\f6d6"}.bi-hdmi:before{content:"\\f6d7"}.bi-usb-c-fill:before{content:"\\f6d8"}.bi-usb-c:before{content:"\\f6d9"}.bi-usb-fill:before{content:"\\f6da"}.bi-usb-plug-fill:before{content:"\\f6db"}.bi-usb-plug:before{content:"\\f6dc"}.bi-usb-symbol:before{content:"\\f6dd"}.bi-usb:before{content:"\\f6de"}.bi-boombox-fill:before{content:"\\f6df"}.bi-displayport:before{content:"\\f6e1"}.bi-gpu-card:before{content:"\\f6e2"}.bi-memory:before{content:"\\f6e3"}.bi-modem-fill:before{content:"\\f6e4"}.bi-modem:before{content:"\\f6e5"}.bi-motherboard-fill:before{content:"\\f6e6"}.bi-motherboard:before{content:"\\f6e7"}.bi-optical-audio-fill:before{content:"\\f6e8"}.bi-optical-audio:before{content:"\\f6e9"}.bi-pci-card:before{content:"\\f6ea"}.bi-router-fill:before{content:"\\f6eb"}.bi-router:before{content:"\\f6ec"}.bi-thunderbolt-fill:before{content:"\\f6ef"}.bi-thunderbolt:before{content:"\\f6f0"}.bi-usb-drive-fill:before{content:"\\f6f1"}.bi-usb-drive:before{content:"\\f6f2"}.bi-usb-micro-fill:before{content:"\\f6f3"}.bi-usb-micro:before{content:"\\f6f4"}.bi-usb-mini-fill:before{content:"\\f6f5"}.bi-usb-mini:before{content:"\\f6f6"}.bi-cloud-haze2:before{content:"\\f6f7"}.bi-device-hdd-fill:before{content:"\\f6f8"}.bi-device-hdd:before{content:"\\f6f9"}.bi-device-ssd-fill:before{content:"\\f6fa"}.bi-device-ssd:before{content:"\\f6fb"}.bi-displayport-fill:before{content:"\\f6fc"}.bi-mortarboard-fill:before{content:"\\f6fd"}.bi-mortarboard:before{content:"\\f6fe"}.bi-terminal-x:before{content:"\\f6ff"}.bi-arrow-through-heart-fill:before{content:"\\f700"}.bi-arrow-through-heart:before{content:"\\f701"}.bi-badge-sd-fill:before{content:"\\f702"}.bi-badge-sd:before{content:"\\f703"}.bi-bag-heart-fill:before{content:"\\f704"}.bi-bag-heart:before{content:"\\f705"}.bi-balloon-fill:before{content:"\\f706"}.bi-balloon-heart-fill:before{content:"\\f707"}.bi-balloon-heart:before{content:"\\f708"}.bi-balloon:before{content:"\\f709"}.bi-box2-fill:before{content:"\\f70a"}.bi-box2-heart-fill:before{content:"\\f70b"}.bi-box2-heart:before{content:"\\f70c"}.bi-box2:before{content:"\\f70d"}.bi-braces-asterisk:before{content:"\\f70e"}.bi-calendar-heart-fill:before{content:"\\f70f"}.bi-calendar-heart:before{content:"\\f710"}.bi-calendar2-heart-fill:before{content:"\\f711"}.bi-calendar2-heart:before{content:"\\f712"}.bi-chat-heart-fill:before{content:"\\f713"}.bi-chat-heart:before{content:"\\f714"}.bi-chat-left-heart-fill:before{content:"\\f715"}.bi-chat-left-heart:before{content:"\\f716"}.bi-chat-right-heart-fill:before{content:"\\f717"}.bi-chat-right-heart:before{content:"\\f718"}.bi-chat-square-heart-fill:before{content:"\\f719"}.bi-chat-square-heart:before{content:"\\f71a"}.bi-clipboard-check-fill:before{content:"\\f71b"}.bi-clipboard-data-fill:before{content:"\\f71c"}.bi-clipboard-fill:before{content:"\\f71d"}.bi-clipboard-heart-fill:before{content:"\\f71e"}.bi-clipboard-heart:before{content:"\\f71f"}.bi-clipboard-minus-fill:before{content:"\\f720"}.bi-clipboard-plus-fill:before{content:"\\f721"}.bi-clipboard-pulse:before{content:"\\f722"}.bi-clipboard-x-fill:before{content:"\\f723"}.bi-clipboard2-check-fill:before{content:"\\f724"}.bi-clipboard2-check:before{content:"\\f725"}.bi-clipboard2-data-fill:before{content:"\\f726"}.bi-clipboard2-data:before{content:"\\f727"}.bi-clipboard2-fill:before{content:"\\f728"}.bi-clipboard2-heart-fill:before{content:"\\f729"}.bi-clipboard2-heart:before{content:"\\f72a"}.bi-clipboard2-minus-fill:before{content:"\\f72b"}.bi-clipboard2-minus:before{content:"\\f72c"}.bi-clipboard2-plus-fill:before{content:"\\f72d"}.bi-clipboard2-plus:before{content:"\\f72e"}.bi-clipboard2-pulse-fill:before{content:"\\f72f"}.bi-clipboard2-pulse:before{content:"\\f730"}.bi-clipboard2-x-fill:before{content:"\\f731"}.bi-clipboard2-x:before{content:"\\f732"}.bi-clipboard2:before{content:"\\f733"}.bi-emoji-kiss-fill:before{content:"\\f734"}.bi-emoji-kiss:before{content:"\\f735"}.bi-envelope-heart-fill:before{content:"\\f736"}.bi-envelope-heart:before{content:"\\f737"}.bi-envelope-open-heart-fill:before{content:"\\f738"}.bi-envelope-open-heart:before{content:"\\f739"}.bi-envelope-paper-fill:before{content:"\\f73a"}.bi-envelope-paper-heart-fill:before{content:"\\f73b"}.bi-envelope-paper-heart:before{content:"\\f73c"}.bi-envelope-paper:before{content:"\\f73d"}.bi-filetype-aac:before{content:"\\f73e"}.bi-filetype-ai:before{content:"\\f73f"}.bi-filetype-bmp:before{content:"\\f740"}.bi-filetype-cs:before{content:"\\f741"}.bi-filetype-css:before{content:"\\f742"}.bi-filetype-csv:before{content:"\\f743"}.bi-filetype-doc:before{content:"\\f744"}.bi-filetype-docx:before{content:"\\f745"}.bi-filetype-exe:before{content:"\\f746"}.bi-filetype-gif:before{content:"\\f747"}.bi-filetype-heic:before{content:"\\f748"}.bi-filetype-html:before{content:"\\f749"}.bi-filetype-java:before{content:"\\f74a"}.bi-filetype-jpg:before{content:"\\f74b"}.bi-filetype-js:before{content:"\\f74c"}.bi-filetype-jsx:before{content:"\\f74d"}.bi-filetype-key:before{content:"\\f74e"}.bi-filetype-m4p:before{content:"\\f74f"}.bi-filetype-md:before{content:"\\f750"}.bi-filetype-mdx:before{content:"\\f751"}.bi-filetype-mov:before{content:"\\f752"}.bi-filetype-mp3:before{content:"\\f753"}.bi-filetype-mp4:before{content:"\\f754"}.bi-filetype-otf:before{content:"\\f755"}.bi-filetype-pdf:before{content:"\\f756"}.bi-filetype-php:before{content:"\\f757"}.bi-filetype-png:before{content:"\\f758"}.bi-filetype-ppt:before{content:"\\f75a"}.bi-filetype-psd:before{content:"\\f75b"}.bi-filetype-py:before{content:"\\f75c"}.bi-filetype-raw:before{content:"\\f75d"}.bi-filetype-rb:before{content:"\\f75e"}.bi-filetype-sass:before{content:"\\f75f"}.bi-filetype-scss:before{content:"\\f760"}.bi-filetype-sh:before{content:"\\f761"}.bi-filetype-svg:before{content:"\\f762"}.bi-filetype-tiff:before{content:"\\f763"}.bi-filetype-tsx:before{content:"\\f764"}.bi-filetype-ttf:before{content:"\\f765"}.bi-filetype-txt:before{content:"\\f766"}.bi-filetype-wav:before{content:"\\f767"}.bi-filetype-woff:before{content:"\\f768"}.bi-filetype-xls:before{content:"\\f76a"}.bi-filetype-xml:before{content:"\\f76b"}.bi-filetype-yml:before{content:"\\f76c"}.bi-heart-arrow:before{content:"\\f76d"}.bi-heart-pulse-fill:before{content:"\\f76e"}.bi-heart-pulse:before{content:"\\f76f"}.bi-heartbreak-fill:before{content:"\\f770"}.bi-heartbreak:before{content:"\\f771"}.bi-hearts:before{content:"\\f772"}.bi-hospital-fill:before{content:"\\f773"}.bi-hospital:before{content:"\\f774"}.bi-house-heart-fill:before{content:"\\f775"}.bi-house-heart:before{content:"\\f776"}.bi-incognito:before{content:"\\f777"}.bi-magnet-fill:before{content:"\\f778"}.bi-magnet:before{content:"\\f779"}.bi-person-heart:before{content:"\\f77a"}.bi-person-hearts:before{content:"\\f77b"}.bi-phone-flip:before{content:"\\f77c"}.bi-plugin:before{content:"\\f77d"}.bi-postage-fill:before{content:"\\f77e"}.bi-postage-heart-fill:before{content:"\\f77f"}.bi-postage-heart:before{content:"\\f780"}.bi-postage:before{content:"\\f781"}.bi-postcard-fill:before{content:"\\f782"}.bi-postcard-heart-fill:before{content:"\\f783"}.bi-postcard-heart:before{content:"\\f784"}.bi-postcard:before{content:"\\f785"}.bi-search-heart-fill:before{content:"\\f786"}.bi-search-heart:before{content:"\\f787"}.bi-sliders2-vertical:before{content:"\\f788"}.bi-sliders2:before{content:"\\f789"}.bi-trash3-fill:before{content:"\\f78a"}.bi-trash3:before{content:"\\f78b"}.bi-valentine:before{content:"\\f78c"}.bi-valentine2:before{content:"\\f78d"}.bi-wrench-adjustable-circle-fill:before{content:"\\f78e"}.bi-wrench-adjustable-circle:before{content:"\\f78f"}.bi-wrench-adjustable:before{content:"\\f790"}.bi-filetype-json:before{content:"\\f791"}.bi-filetype-pptx:before{content:"\\f792"}.bi-filetype-xlsx:before{content:"\\f793"}.bi-1-circle-fill:before{content:"\\f796"}.bi-1-circle:before{content:"\\f797"}.bi-1-square-fill:before{content:"\\f798"}.bi-1-square:before{content:"\\f799"}.bi-2-circle-fill:before{content:"\\f79c"}.bi-2-circle:before{content:"\\f79d"}.bi-2-square-fill:before{content:"\\f79e"}.bi-2-square:before{content:"\\f79f"}.bi-3-circle-fill:before{content:"\\f7a2"}.bi-3-circle:before{content:"\\f7a3"}.bi-3-square-fill:before{content:"\\f7a4"}.bi-3-square:before{content:"\\f7a5"}.bi-4-circle-fill:before{content:"\\f7a8"}.bi-4-circle:before{content:"\\f7a9"}.bi-4-square-fill:before{content:"\\f7aa"}.bi-4-square:before{content:"\\f7ab"}.bi-5-circle-fill:before{content:"\\f7ae"}.bi-5-circle:before{content:"\\f7af"}.bi-5-square-fill:before{content:"\\f7b0"}.bi-5-square:before{content:"\\f7b1"}.bi-6-circle-fill:before{content:"\\f7b4"}.bi-6-circle:before{content:"\\f7b5"}.bi-6-square-fill:before{content:"\\f7b6"}.bi-6-square:before{content:"\\f7b7"}.bi-7-circle-fill:before{content:"\\f7ba"}.bi-7-circle:before{content:"\\f7bb"}.bi-7-square-fill:before{content:"\\f7bc"}.bi-7-square:before{content:"\\f7bd"}.bi-8-circle-fill:before{content:"\\f7c0"}.bi-8-circle:before{content:"\\f7c1"}.bi-8-square-fill:before{content:"\\f7c2"}.bi-8-square:before{content:"\\f7c3"}.bi-9-circle-fill:before{content:"\\f7c6"}.bi-9-circle:before{content:"\\f7c7"}.bi-9-square-fill:before{content:"\\f7c8"}.bi-9-square:before{content:"\\f7c9"}.bi-airplane-engines-fill:before{content:"\\f7ca"}.bi-airplane-engines:before{content:"\\f7cb"}.bi-airplane-fill:before{content:"\\f7cc"}.bi-airplane:before{content:"\\f7cd"}.bi-alexa:before{content:"\\f7ce"}.bi-alipay:before{content:"\\f7cf"}.bi-android:before{content:"\\f7d0"}.bi-android2:before{content:"\\f7d1"}.bi-box-fill:before{content:"\\f7d2"}.bi-box-seam-fill:before{content:"\\f7d3"}.bi-browser-chrome:before{content:"\\f7d4"}.bi-browser-edge:before{content:"\\f7d5"}.bi-browser-firefox:before{content:"\\f7d6"}.bi-browser-safari:before{content:"\\f7d7"}.bi-c-circle-fill:before{content:"\\f7da"}.bi-c-circle:before{content:"\\f7db"}.bi-c-square-fill:before{content:"\\f7dc"}.bi-c-square:before{content:"\\f7dd"}.bi-capsule-pill:before{content:"\\f7de"}.bi-capsule:before{content:"\\f7df"}.bi-car-front-fill:before{content:"\\f7e0"}.bi-car-front:before{content:"\\f7e1"}.bi-cassette-fill:before{content:"\\f7e2"}.bi-cassette:before{content:"\\f7e3"}.bi-cc-circle-fill:before{content:"\\f7e6"}.bi-cc-circle:before{content:"\\f7e7"}.bi-cc-square-fill:before{content:"\\f7e8"}.bi-cc-square:before{content:"\\f7e9"}.bi-cup-hot-fill:before{content:"\\f7ea"}.bi-cup-hot:before{content:"\\f7eb"}.bi-currency-rupee:before{content:"\\f7ec"}.bi-dropbox:before{content:"\\f7ed"}.bi-escape:before{content:"\\f7ee"}.bi-fast-forward-btn-fill:before{content:"\\f7ef"}.bi-fast-forward-btn:before{content:"\\f7f0"}.bi-fast-forward-circle-fill:before{content:"\\f7f1"}.bi-fast-forward-circle:before{content:"\\f7f2"}.bi-fast-forward-fill:before{content:"\\f7f3"}.bi-fast-forward:before{content:"\\f7f4"}.bi-filetype-sql:before{content:"\\f7f5"}.bi-fire:before{content:"\\f7f6"}.bi-google-play:before{content:"\\f7f7"}.bi-h-circle-fill:before{content:"\\f7fa"}.bi-h-circle:before{content:"\\f7fb"}.bi-h-square-fill:before{content:"\\f7fc"}.bi-h-square:before{content:"\\f7fd"}.bi-indent:before{content:"\\f7fe"}.bi-lungs-fill:before{content:"\\f7ff"}.bi-lungs:before{content:"\\f800"}.bi-microsoft-teams:before{content:"\\f801"}.bi-p-circle-fill:before{content:"\\f804"}.bi-p-circle:before{content:"\\f805"}.bi-p-square-fill:before{content:"\\f806"}.bi-p-square:before{content:"\\f807"}.bi-pass-fill:before{content:"\\f808"}.bi-pass:before{content:"\\f809"}.bi-prescription:before{content:"\\f80a"}.bi-prescription2:before{content:"\\f80b"}.bi-r-circle-fill:before{content:"\\f80e"}.bi-r-circle:before{content:"\\f80f"}.bi-r-square-fill:before{content:"\\f810"}.bi-r-square:before{content:"\\f811"}.bi-repeat-1:before{content:"\\f812"}.bi-repeat:before{content:"\\f813"}.bi-rewind-btn-fill:before{content:"\\f814"}.bi-rewind-btn:before{content:"\\f815"}.bi-rewind-circle-fill:before{content:"\\f816"}.bi-rewind-circle:before{content:"\\f817"}.bi-rewind-fill:before{content:"\\f818"}.bi-rewind:before{content:"\\f819"}.bi-train-freight-front-fill:before{content:"\\f81a"}.bi-train-freight-front:before{content:"\\f81b"}.bi-train-front-fill:before{content:"\\f81c"}.bi-train-front:before{content:"\\f81d"}.bi-train-lightrail-front-fill:before{content:"\\f81e"}.bi-train-lightrail-front:before{content:"\\f81f"}.bi-truck-front-fill:before{content:"\\f820"}.bi-truck-front:before{content:"\\f821"}.bi-ubuntu:before{content:"\\f822"}.bi-unindent:before{content:"\\f823"}.bi-unity:before{content:"\\f824"}.bi-universal-access-circle:before{content:"\\f825"}.bi-universal-access:before{content:"\\f826"}.bi-virus:before{content:"\\f827"}.bi-virus2:before{content:"\\f828"}.bi-wechat:before{content:"\\f829"}.bi-yelp:before{content:"\\f82a"}.bi-sign-stop-fill:before{content:"\\f82b"}.bi-sign-stop-lights-fill:before{content:"\\f82c"}.bi-sign-stop-lights:before{content:"\\f82d"}.bi-sign-stop:before{content:"\\f82e"}.bi-sign-turn-left-fill:before{content:"\\f82f"}.bi-sign-turn-left:before{content:"\\f830"}.bi-sign-turn-right-fill:before{content:"\\f831"}.bi-sign-turn-right:before{content:"\\f832"}.bi-sign-turn-slight-left-fill:before{content:"\\f833"}.bi-sign-turn-slight-left:before{content:"\\f834"}.bi-sign-turn-slight-right-fill:before{content:"\\f835"}.bi-sign-turn-slight-right:before{content:"\\f836"}.bi-sign-yield-fill:before{content:"\\f837"}.bi-sign-yield:before{content:"\\f838"}.bi-ev-station-fill:before{content:"\\f839"}.bi-ev-station:before{content:"\\f83a"}.bi-fuel-pump-diesel-fill:before{content:"\\f83b"}.bi-fuel-pump-diesel:before{content:"\\f83c"}.bi-fuel-pump-fill:before{content:"\\f83d"}.bi-fuel-pump:before{content:"\\f83e"}.bi-0-circle-fill:before{content:"\\f83f"}.bi-0-circle:before{content:"\\f840"}.bi-0-square-fill:before{content:"\\f841"}.bi-0-square:before{content:"\\f842"}.bi-rocket-fill:before{content:"\\f843"}.bi-rocket-takeoff-fill:before{content:"\\f844"}.bi-rocket-takeoff:before{content:"\\f845"}.bi-rocket:before{content:"\\f846"}.bi-stripe:before{content:"\\f847"}.bi-subscript:before{content:"\\f848"}.bi-superscript:before{content:"\\f849"}.bi-trello:before{content:"\\f84a"}.bi-envelope-at-fill:before{content:"\\f84b"}.bi-envelope-at:before{content:"\\f84c"}.bi-regex:before{content:"\\f84d"}.bi-text-wrap:before{content:"\\f84e"}.bi-sign-dead-end-fill:before{content:"\\f84f"}.bi-sign-dead-end:before{content:"\\f850"}.bi-sign-do-not-enter-fill:before{content:"\\f851"}.bi-sign-do-not-enter:before{content:"\\f852"}.bi-sign-intersection-fill:before{content:"\\f853"}.bi-sign-intersection-side-fill:before{content:"\\f854"}.bi-sign-intersection-side:before{content:"\\f855"}.bi-sign-intersection-t-fill:before{content:"\\f856"}.bi-sign-intersection-t:before{content:"\\f857"}.bi-sign-intersection-y-fill:before{content:"\\f858"}.bi-sign-intersection-y:before{content:"\\f859"}.bi-sign-intersection:before{content:"\\f85a"}.bi-sign-merge-left-fill:before{content:"\\f85b"}.bi-sign-merge-left:before{content:"\\f85c"}.bi-sign-merge-right-fill:before{content:"\\f85d"}.bi-sign-merge-right:before{content:"\\f85e"}.bi-sign-no-left-turn-fill:before{content:"\\f85f"}.bi-sign-no-left-turn:before{content:"\\f860"}.bi-sign-no-parking-fill:before{content:"\\f861"}.bi-sign-no-parking:before{content:"\\f862"}.bi-sign-no-right-turn-fill:before{content:"\\f863"}.bi-sign-no-right-turn:before{content:"\\f864"}.bi-sign-railroad-fill:before{content:"\\f865"}.bi-sign-railroad:before{content:"\\f866"}.bi-building-add:before{content:"\\f867"}.bi-building-check:before{content:"\\f868"}.bi-building-dash:before{content:"\\f869"}.bi-building-down:before{content:"\\f86a"}.bi-building-exclamation:before{content:"\\f86b"}.bi-building-fill-add:before{content:"\\f86c"}.bi-building-fill-check:before{content:"\\f86d"}.bi-building-fill-dash:before{content:"\\f86e"}.bi-building-fill-down:before{content:"\\f86f"}.bi-building-fill-exclamation:before{content:"\\f870"}.bi-building-fill-gear:before{content:"\\f871"}.bi-building-fill-lock:before{content:"\\f872"}.bi-building-fill-slash:before{content:"\\f873"}.bi-building-fill-up:before{content:"\\f874"}.bi-building-fill-x:before{content:"\\f875"}.bi-building-fill:before{content:"\\f876"}.bi-building-gear:before{content:"\\f877"}.bi-building-lock:before{content:"\\f878"}.bi-building-slash:before{content:"\\f879"}.bi-building-up:before{content:"\\f87a"}.bi-building-x:before{content:"\\f87b"}.bi-buildings-fill:before{content:"\\f87c"}.bi-buildings:before{content:"\\f87d"}.bi-bus-front-fill:before{content:"\\f87e"}.bi-bus-front:before{content:"\\f87f"}.bi-ev-front-fill:before{content:"\\f880"}.bi-ev-front:before{content:"\\f881"}.bi-globe-americas:before{content:"\\f882"}.bi-globe-asia-australia:before{content:"\\f883"}.bi-globe-central-south-asia:before{content:"\\f884"}.bi-globe-europe-africa:before{content:"\\f885"}.bi-house-add-fill:before{content:"\\f886"}.bi-house-add:before{content:"\\f887"}.bi-house-check-fill:before{content:"\\f888"}.bi-house-check:before{content:"\\f889"}.bi-house-dash-fill:before{content:"\\f88a"}.bi-house-dash:before{content:"\\f88b"}.bi-house-down-fill:before{content:"\\f88c"}.bi-house-down:before{content:"\\f88d"}.bi-house-exclamation-fill:before{content:"\\f88e"}.bi-house-exclamation:before{content:"\\f88f"}.bi-house-gear-fill:before{content:"\\f890"}.bi-house-gear:before{content:"\\f891"}.bi-house-lock-fill:before{content:"\\f892"}.bi-house-lock:before{content:"\\f893"}.bi-house-slash-fill:before{content:"\\f894"}.bi-house-slash:before{content:"\\f895"}.bi-house-up-fill:before{content:"\\f896"}.bi-house-up:before{content:"\\f897"}.bi-house-x-fill:before{content:"\\f898"}.bi-house-x:before{content:"\\f899"}.bi-person-add:before{content:"\\f89a"}.bi-person-down:before{content:"\\f89b"}.bi-person-exclamation:before{content:"\\f89c"}.bi-person-fill-add:before{content:"\\f89d"}.bi-person-fill-check:before{content:"\\f89e"}.bi-person-fill-dash:before{content:"\\f89f"}.bi-person-fill-down:before{content:"\\f8a0"}.bi-person-fill-exclamation:before{content:"\\f8a1"}.bi-person-fill-gear:before{content:"\\f8a2"}.bi-person-fill-lock:before{content:"\\f8a3"}.bi-person-fill-slash:before{content:"\\f8a4"}.bi-person-fill-up:before{content:"\\f8a5"}.bi-person-fill-x:before{content:"\\f8a6"}.bi-person-gear:before{content:"\\f8a7"}.bi-person-lock:before{content:"\\f8a8"}.bi-person-slash:before{content:"\\f8a9"}.bi-person-up:before{content:"\\f8aa"}.bi-scooter:before{content:"\\f8ab"}.bi-taxi-front-fill:before{content:"\\f8ac"}.bi-taxi-front:before{content:"\\f8ad"}.bi-amd:before{content:"\\f8ae"}.bi-database-add:before{content:"\\f8af"}.bi-database-check:before{content:"\\f8b0"}.bi-database-dash:before{content:"\\f8b1"}.bi-database-down:before{content:"\\f8b2"}.bi-database-exclamation:before{content:"\\f8b3"}.bi-database-fill-add:before{content:"\\f8b4"}.bi-database-fill-check:before{content:"\\f8b5"}.bi-database-fill-dash:before{content:"\\f8b6"}.bi-database-fill-down:before{content:"\\f8b7"}.bi-database-fill-exclamation:before{content:"\\f8b8"}.bi-database-fill-gear:before{content:"\\f8b9"}.bi-database-fill-lock:before{content:"\\f8ba"}.bi-database-fill-slash:before{content:"\\f8bb"}.bi-database-fill-up:before{content:"\\f8bc"}.bi-database-fill-x:before{content:"\\f8bd"}.bi-database-fill:before{content:"\\f8be"}.bi-database-gear:before{content:"\\f8bf"}.bi-database-lock:before{content:"\\f8c0"}.bi-database-slash:before{content:"\\f8c1"}.bi-database-up:before{content:"\\f8c2"}.bi-database-x:before{content:"\\f8c3"}.bi-database:before{content:"\\f8c4"}.bi-houses-fill:before{content:"\\f8c5"}.bi-houses:before{content:"\\f8c6"}.bi-nvidia:before{content:"\\f8c7"}.bi-person-vcard-fill:before{content:"\\f8c8"}.bi-person-vcard:before{content:"\\f8c9"}.bi-sina-weibo:before{content:"\\f8ca"}.bi-tencent-qq:before{content:"\\f8cb"}.bi-wikipedia:before{content:"\\f8cc"}.bi-alphabet-uppercase:before{content:"\\f2a5"}.bi-alphabet:before{content:"\\f68a"}.bi-amazon:before{content:"\\f68d"}.bi-arrows-collapse-vertical:before{content:"\\f690"}.bi-arrows-expand-vertical:before{content:"\\f695"}.bi-arrows-vertical:before{content:"\\f698"}.bi-arrows:before{content:"\\f6a2"}.bi-ban-fill:before{content:"\\f6a3"}.bi-ban:before{content:"\\f6b6"}.bi-bing:before{content:"\\f6c2"}.bi-cake:before{content:"\\f6e0"}.bi-cake2:before{content:"\\f6ed"}.bi-cookie:before{content:"\\f6ee"}.bi-copy:before{content:"\\f759"}.bi-crosshair:before{content:"\\f769"}.bi-crosshair2:before{content:"\\f794"}.bi-emoji-astonished-fill:before{content:"\\f795"}.bi-emoji-astonished:before{content:"\\f79a"}.bi-emoji-grimace-fill:before{content:"\\f79b"}.bi-emoji-grimace:before{content:"\\f7a0"}.bi-emoji-grin-fill:before{content:"\\f7a1"}.bi-emoji-grin:before{content:"\\f7a6"}.bi-emoji-surprise-fill:before{content:"\\f7a7"}.bi-emoji-surprise:before{content:"\\f7ac"}.bi-emoji-tear-fill:before{content:"\\f7ad"}.bi-emoji-tear:before{content:"\\f7b2"}.bi-envelope-arrow-down-fill:before{content:"\\f7b3"}.bi-envelope-arrow-down:before{content:"\\f7b8"}.bi-envelope-arrow-up-fill:before{content:"\\f7b9"}.bi-envelope-arrow-up:before{content:"\\f7be"}.bi-feather:before{content:"\\f7bf"}.bi-feather2:before{content:"\\f7c4"}.bi-floppy-fill:before{content:"\\f7c5"}.bi-floppy:before{content:"\\f7d8"}.bi-floppy2-fill:before{content:"\\f7d9"}.bi-floppy2:before{content:"\\f7e4"}.bi-gitlab:before{content:"\\f7e5"}.bi-highlighter:before{content:"\\f7f8"}.bi-marker-tip:before{content:"\\f802"}.bi-nvme-fill:before{content:"\\f803"}.bi-nvme:before{content:"\\f80c"}.bi-opencollective:before{content:"\\f80d"}.bi-pci-card-network:before{content:"\\f8cd"}.bi-pci-card-sound:before{content:"\\f8ce"}.bi-radar:before{content:"\\f8cf"}.bi-send-arrow-down-fill:before{content:"\\f8d0"}.bi-send-arrow-down:before{content:"\\f8d1"}.bi-send-arrow-up-fill:before{content:"\\f8d2"}.bi-send-arrow-up:before{content:"\\f8d3"}.bi-sim-slash-fill:before{content:"\\f8d4"}.bi-sim-slash:before{content:"\\f8d5"}.bi-sourceforge:before{content:"\\f8d6"}.bi-substack:before{content:"\\f8d7"}.bi-threads-fill:before{content:"\\f8d8"}.bi-threads:before{content:"\\f8d9"}.bi-transparency:before{content:"\\f8da"}.bi-twitter-x:before{content:"\\f8db"}.bi-type-h4:before{content:"\\f8dc"}.bi-type-h5:before{content:"\\f8dd"}.bi-type-h6:before{content:"\\f8de"}.bi-backpack-fill:before{content:"\\f8df"}.bi-backpack:before{content:"\\f8e0"}.bi-backpack2-fill:before{content:"\\f8e1"}.bi-backpack2:before{content:"\\f8e2"}.bi-backpack3-fill:before{content:"\\f8e3"}.bi-backpack3:before{content:"\\f8e4"}.bi-backpack4-fill:before{content:"\\f8e5"}.bi-backpack4:before{content:"\\f8e6"}.bi-brilliance:before{content:"\\f8e7"}.bi-cake-fill:before{content:"\\f8e8"}.bi-cake2-fill:before{content:"\\f8e9"}.bi-duffle-fill:before{content:"\\f8ea"}.bi-duffle:before{content:"\\f8eb"}.bi-exposure:before{content:"\\f8ec"}.bi-gender-neuter:before{content:"\\f8ed"}.bi-highlights:before{content:"\\f8ee"}.bi-luggage-fill:before{content:"\\f8ef"}.bi-luggage:before{content:"\\f8f0"}.bi-mailbox-flag:before{content:"\\f8f1"}.bi-mailbox2-flag:before{content:"\\f8f2"}.bi-noise-reduction:before{content:"\\f8f3"}.bi-passport-fill:before{content:"\\f8f4"}.bi-passport:before{content:"\\f8f5"}.bi-person-arms-up:before{content:"\\f8f6"}.bi-person-raised-hand:before{content:"\\f8f7"}.bi-person-standing-dress:before{content:"\\f8f8"}.bi-person-standing:before{content:"\\f8f9"}.bi-person-walking:before{content:"\\f8fa"}.bi-person-wheelchair:before{content:"\\f8fb"}.bi-shadows:before{content:"\\f8fc"}.bi-suitcase-fill:before{content:"\\f8fd"}.bi-suitcase-lg-fill:before{content:"\\f8fe"}.bi-suitcase-lg:before{content:"\\f8ff"}.bi-suitcase:before{content:"\\f900"}.bi-suitcase2-fill:before{content:"\\f901"}.bi-suitcase2:before{content:"\\f902"}.bi-vignette:before{content:"\\f903"}foreignObject.loci{box-sizing:border-box;border-radius:.375rem;position:relative;display:block}foreignObject.loci div.foreground{position:relative;display:flex;height:100%;width:100%;justify-content:center;align-items:center;box-sizing:inherit;border-radius:inherit;border-width:1px;border-style:solid;opacity:1}foreignObject.loci div.background{position:absolute;left:0;top:0;display:block;height:100%;width:100%;opacity:.3}foreignObject.pins div.foreground{position:relative;display:flex;height:100%;width:100%;justify-content:center;align-items:flex-end;box-sizing:border-box}foreignObject.dssp div.foreground{position:relative;display:flex;height:100%;width:100%;justify-content:center;align-items:flex-end;box-sizing:border-box}foreignObject.dssp i[class^=dssp]{position:relative;visibility:hidden;display:flex;height:100%;width:100%}foreignObject.dssp i.dssp-helix{visibility:visible;background-color:inherit;-webkit-mask-image:url(dssp-helix.74d0a47e4d7ed27e.svg);mask-image:url(dssp-helix.74d0a47e4d7ed27e.svg);-webkit-mask-position:0 center;mask-position:0 center;-webkit-mask-size:auto 100%;mask-size:auto 100%}foreignObject.dssp i.dssp-strand{display:flex;visibility:hidden}foreignObject.dssp i.dssp-strand:before{visibility:visible;background-color:inherit;-webkit-mask-image:url(dssp-strand-tail.783864b28823e2c7.svg);mask-image:url(dssp-strand-tail.783864b28823e2c7.svg);-webkit-mask-position:0 center;mask-position:0 center;-webkit-mask-size:auto 100%;mask-size:auto 100%;flex-shrink:1;flex-grow:1;content:""}foreignObject.dssp i.dssp-strand:after{visibility:visible;background-color:inherit;-webkit-mask-image:url(dssp-strand-head.85a295955fb4c220.svg);mask-image:url(dssp-strand-head.85a295955fb4c220.svg);-webkit-mask-position:0 center;mask-position:0 center;-webkit-mask-size:auto 100%;mask-size:auto 100%;flex-shrink:0;flex-grow:0;content:"";width:31px}.axis-grid line{stroke-opacity:.3;stroke:gray}.axis-grid line:nth-child(1){stroke-dasharray:2}.y.axis .tick text{display:none}\n'],encapsulation:2,changeDetection:0})}return e})();function yRt(e,t){1&e&&js(0,"i",10)}function bRt(e,t){1&e&&js(0,"i",11)}function vRt(e,t){if(1&e&&(br(0,"div"),Li(1),Ym(2,yRt,1,0,"i",10)(3,bRt,1,0),Sr()),2&e){const n=t.trace;_8("text-muted",!n.expanded),Yc(),UC(" ",n.label,"\xa0 "),Yc(),ST(2,n.expanded?2:3)}}const _Rt={providers:[function XNe(e,...t){return Vc([{provide:aw,multi:!0,useValue:e},[],{provide:nw,useFactory:Wie,deps:[Nh]},{provide:F4,multi:!0,useFactory:$ie},t.map(n=>n.\u0275providers)])}([{path:"structure",component:xDt},{path:"sequence",component:ADt},{path:"feature",component:(()=>{class e{constructor(){this.settings={"line-height":24,"content-size":16,"background-color":"transparent","trace-color":"cyan","grid-color":"rgba(222, 226, 230, 0.5)","text-color":"white","margin-top":24,"margin-right":24,"margin-bottom":24,"margin-left":128},this.sequence=Array.from("MEEPQSDPSVEPPLSQETFSDLWKLLPENNVLSPLPSQAMDDLMLSPDDIEQWFTEDPGPDEAPRMPEAAPPVAPAPAAPTPAAPAPAPSWPLSSSVPSQKTYQGSYGFRLGFLHSGTAKSVTCTYSPALNKMFCQLAKTCPVQLWVDSTPPPGTRVRAMAIYKQSQHMTEVVRRCPHHERCSDSDGLAPPQHLIRVEGNLRVEYLDDRNTFRHSVVVPYEPPEVGSDCTTIHYNYMCNSSCMGGMNRRPILTIITLEDSSGNLLGRNSFEVRVCACPGRDRRTEEENLRKKGEPHHELPPGSTKRALPNNTSSSPQPKKKPLDGEYFTLQIRGRERFEMFRELNEALELKDAQAGKEPGGSRAHSSHLKSKKGQSTSRHKKLMFKTEGPDSD".slice(0,100)),this.features=[{label:"Feature #1",type:"continuous",values:Array.from({length:70},()=>Math.floor(100*Math.random())+1)},{label:"Feature #2",type:"loci","trace-color":"red",values:[{start:1,end:50},{start:30,end:60}]},{label:"Feature #3",type:"trace",position:"overlap",values:[{type:"loci",values:[{start:1,end:10}],"trace-color":"blue"},{type:"loci",values:[{start:20,end:40}],"trace-color":"red"},{type:"loci",values:[{start:60,end:100}],"trace-color":"yellow"},{type:"continuous",values:Array.from({length:70},()=>Math.floor(100*Math.random())+1),"trace-color":"yellow"}],"background-color":"transparent"},{label:"Feature #4",type:"loci",values:[{start:27,end:56},{start:61,end:72}],nested:[{label:"Feature #5",type:"trace",values:[{type:"loci",values:[{start:1,end:5},{start:6,end:10}]},{type:"loci",values:[{start:10,end:27}]}]},{label:"Feature #6",type:"continuous",values:Array.from({length:70},()=>Math.floor(100*Math.random())+1)}]},{label:"Feature #7",type:"loci",values:[{start:81,end:81},{start:82,end:82}],nested:[{label:"Feature #8",type:"trace",values:[{type:"loci",values:[{start:81,end:81}]},{type:"loci",values:[{start:82,end:82}]}]},{label:"Feature #9",type:"continuous","trace-color":"greenyellow",values:Array.from({length:70},()=>Math.floor(100*Math.random())+1)}]}]}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275cmp=$d({type:e,selectors:[["page-features-viewer"]],standalone:!0,features:[Dh],decls:25,vars:3,consts:[[1,"container","pt-3"],[1,"mb-3"],[1,"d-flex","flex-row","gap-3","mb-3"],[2,"display","block","width","1rem","height","1rem","background","black","font-size","1rem","line-height","1rem"],[2,"display","block","width","1rem","height","auto","background","black","color","white","font-size","1rem","line-height",".5rem"],[2,"display","block","width","auto","height","1rem","background","black","color","white","font-size","1rem","line-height","1rem"],[1,"d-block","mb-3"],[2,"display","block","height","auto","width","100%"],[3,"sequence","features","settings"],[3,"ngx-features-viewer-label"],[1,"bi","bi-caret-down-fill"],[1,"bi","bi-caret-right"]],template:function(r,i){1&r&&(br(0,"div",0)(1,"div",1)(2,"h1"),Li(3,"Feature viewer"),Sr(),br(4,"p"),Li(5," The feature viewer allows you to represent features on a reference seqeunce... "),Sr()(),br(6,"div",2),js(7,"div",3),br(8,"div",4),Li(9," W"),Sr(),br(10,"div",5),Li(11," W"),Sr()(),br(12,"div",6)(13,"p"),Li(14," Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras congue velit in sem sodales pretium. Vivamus sit amet enim malesuada, efficitur quam quis, semper metus. Aenean commodo tellus eu viverra lacinia. Nam sed lectus non tellus suscipit pellentesque. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse lacus diam, laoreet eget nisl et, dictum dictum elit. Vivamus sit amet fringilla elit, vitae pulvinar nisl. Donec mattis magna lacus, id congue risus aliquet a. "),Sr(),br(15,"p"),Li(16," Cras nec malesuada risus. Integer a tincidunt ante. Vivamus eu mauris placerat, dictum diam vitae, laoreet eros. Integer porttitor neque vel lectus ullamcorper commodo. Aliquam erat volutpat. Morbi convallis fermentum mauris, quis aliquet tellus posuere non. Nunc aliquet mattis tellus et ultrices. "),Sr()(),br(17,"div",7)(18,"ngx-features-viewer",8),Ym(19,vRt,4,4,"ng-template",9),Sr()(),br(20,"div")(21,"p"),Li(22," Morbi convallis ipsum sit amet felis faucibus mollis. Duis nec viverra nisl, nec maximus nisl. Proin non malesuada massa, sit amet auctor elit. Sed condimentum, urna id commodo semper, nisi lorem lobortis velit, eu auctor ante magna eu nibh. Aliquam mattis pulvinar sapien vitae rhoncus. Sed lacinia ex a ultrices finibus. Phasellus eu erat eu sapien laoreet dapibus ac vitae mauris. "),Sr(),br(23,"p"),Li(24," Vestibulum elementum sem vel lorem suscipit varius. Mauris malesuada porta sapien blandit facilisis. Aliquam pretium erat nec lorem molestie, et feugiat turpis semper. Donec tempus posuere nibh, maximus hendrerit odio eleifend vitae. Praesent consequat felis leo, at ullamcorper nisl dictum sed. Morbi erat dui, sollicitudin id interdum convallis, elementum laoreet lorem. Duis leo massa, commodo id tempor sed, semper ut dui. Proin faucibus feugiat sapien, et cursus nunc. Duis eu mattis ipsum, ac facilisis quam. Donec a sapien non lectus iaculis luctus. Nulla lobortis turpis id nisi consectetur aliquet. Aliquam dignissim aliquam erat, at egestas nulla ullamcorper a. Duis porta interdum venenatis. Praesent a lorem at velit egestas efficitur eu et lectus. Suspendisse potenti. Duis imperdiet aliquam hendrerit. "),Sr()()()),2&r&&(Yc(18),R0("sequence",i.sequence)("features",i.features)("settings",i.settings))},dependencies:[H2e,gRt,L0],changeDetection:0})}return e})()},{path:"",component:(()=>{class e{static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275cmp=$d({type:e,selectors:[["page-home"]],standalone:!0,features:[Dh],decls:48,vars:0,consts:[[1,"container","pt-3"],[1,"row"],[1,"col-12"],[1,"mb-3"],[1,"row","align-items-stretch","mb-3"],[1,"col-4"],["routerLink","/structure",1,"product-card","rounded","bg-body-tertiary","p-3","mb-3"],[1,"bi","bi-boxes","me-3"],["src","assets/structure-viewer.png","alt","Structure viewer",1,"w-100","h-auto","mb-3"],[1,"text-justify","mb-3"],[1,"text-center","mt-auto"],[1,"badge","rounded-pill","text-bg-warning"],[1,"bi","bi-chevron-right"],[1,"col-4","product"],["routerLink","/feature",1,"product-card","rounded","bg-body-tertiary","p-3","mb-3"],[1,"bi","bi-sliders"],["routerLink","/sequence",1,"product-card","rounded","bg-body-tertiary","p-3","mb-3"],[1,"bi","bi-body-text"],[1,"rounded","bg-body-tertiary","shadow-sm","p-3","mb-3"],[1,"bi","bi-share-fill"]],template:function(r,i){1&r&&(br(0,"div",0)(1,"div",1)(2,"div",2)(3,"h1",3),Li(4,"Products"),Sr()()(),br(5,"div",4)(6,"div",5)(7,"div",6)(8,"h2"),js(9,"i",7),Li(10," Structure viewer "),Sr(),js(11,"img",8),br(12,"p",9),Li(13," Visualize and interact with 3D molecular structures. Provides Mol* functionalities out-of-the-box for Angular developers. "),Sr(),br(14,"div",10)(15,"span",11),Li(16," Try it out "),js(17,"i",12),Sr()()()(),br(18,"div",13)(19,"div",14)(20,"h2"),js(21,"i",15),Li(22," Feature viewer "),Sr(),br(23,"p",3),Li(24," The feature viewer is a powerful tool designed for visualizing features of biological sequences, such as proteins, DNA, or RNA. It provides a comprehensive set of functionalities to explore and analyze these sequences. With the feature viewer, users can easily identify and visualize various features, including structural elements, functional domains, mutations, and more. It offers a user-friendly interface with intuitive gestures and actions, allowing users to zoom in and out, pan across the sequence, highlight specific regions, and perform interactive selections. Whether you are a biologist, bioinformatician, or researcher, the feature viewer is an indispensable tool for gaining insights into the intricate details of biological sequences. "),Sr(),br(25,"div",10)(26,"span",11),Li(27," Try it out "),js(28,"i",12),Sr()()()(),br(29,"div",5)(30,"div",16)(31,"h2"),js(32,"i",17),Li(33," Sequence viewer "),Sr(),br(34,"p",3),Li(35," The sequence viewer is a specialized tool designed for visualizing multiple sequence alignments and other features across protein sequences. It provides a comprehensive view of the similarities and differences between multiple protein sequences, allowing users to easily identify conserved regions, mutations, and other important features. The sequence viewer supports various display options, enabling users to customize the view according to their needs. It also allows for interactive exploration, with features such as zooming and panning, highlighting specific regions, and hovering over specific points for more detailed information. This makes the sequence viewer an essential tool for bioinformaticians and researchers studying protein sequences and their relationships. "),Sr(),br(36,"div",10)(37,"span",11),Li(38," Try it out "),js(39,"i",12),Sr()()()()(),br(40,"div",1)(41,"div",2)(42,"div",18)(43,"h2"),js(44,"i",19),Li(45," Enhanced interactivity"),Sr(),br(46,"p"),Li(47," Our components are designed starting from the same, generic data structures. This is meant to easily wire up various compoents in the same page. Hence, implementing interactivity out-of-the-box "),Sr()()()()())},dependencies:[L0,mU,wR],styles:[".product-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:nowrap;height:100%;width:100%;cursor:pointer;box-shadow:0 .125rem .25rem #00000013}.product-card[_ngcontent-%COMP%]:hover{box-shadow:0 .5rem 1rem #00000026}"]})}return e})()},{path:"**",redirectTo:""}])]};(function M4e(e,t){return HPe({rootComponent:e,...wre(t)})})((()=>{class e{constructor(){this.title="ngx-bio-tools",this.sequence="MLPGLALLLLAAWTARALEVPTDGNAGLLAEPQIAMFCGRLNMHMNVQNGKWDSDPSGTKTCIDTKEGILQYCQEVYPELQITNVVEANQPVTIQNWCKRGRKQCKTHPHFVIPYRCLVGEFVSDALLVPDKCKFLHQERMDVCETHLHWHTVAKETCSEKSTNLHDYGMLLPCGIDKFRGVEFVCCPLAEESDNVDSADAEEDDSDVWWGGADTDYADGSEDKVVEVAEEEEVAEVEEEEADDDEDDEDGDEVEEEAEEPYEEATERTTSIATTTTTTTESVEEVVREVCSEQAETGPCRAMISRWYFDVTEGKCAPFFYGGCGGNRNNFDTEEYCMAVCGSAMSQSLLKTTQEPLARDPVKLPTTAASTPDAVDKYLETPGDENEHAHFQKAKERLEAKHRERMSQVMREWEEAERQAKNLPKADKKAVIQHFQEKVESLEQEAANERQQLVETHMARVEAMLNDRRRLALENYITALQAVPPRPRHVFNMLKKYVRAEQKDRQHTLKHFEHVRMVDPKKAAQIRSQVMTHLRVIYERMNQSLSLLYNVPAVAEEIQDEVDELLQKEQNYSDDVLANMISEPRISYGNDALMPSLTETKTTVELLPVNGEFSLDDLQPWHSFGADSVPANTENEVEPVDARPAADRGLTTRPGSGLTNIKTEEISEVKMDAEFRHDSGYEVHHQKLVFFAEDVGSNKGAIIGLMVGGVVIATVIVITLVMLKKKQYTSIHHGVVEVDAAVTPEERHLSKMQQNGYENPTYKFFEQMQN".split(""),this.features=[{id:0,type:"continuous",color:"blue",values:this.sequence.map(()=>Math.random()),parent:void 0,height:128},{id:1,type:"loci",color:"red",values:[{start:1,end:3},{start:5,end:6}],parent:void 0,height:96},{id:2,type:"pins",color:"green",values:[{start:5},{start:100,color:"blue"},{start:400,color:"red"}],parent:1},{id:3,type:"loci",color:"orange",values:[{start:10,end:20},{start:30,end:70}],parent:1},{id:4,type:"loci",color:"purple",values:[{start:100,end:300}],parent:void 0},{id:5,type:"dssp",color:"black",values:[{start:30,end:90,code:"H",color:"orange"},{start:120,end:300,code:"E",color:"purple"}],parent:void 0}]}static#e=this.\u0275fac=function(r){return new(r||e)};static#t=this.\u0275cmp=$d({type:e,selectors:[["app-root"]],standalone:!0,features:[Dh],decls:17,vars:0,consts:[[1,"navbar"],[1,"container-fluid"],["href","#",1,"navbar-brand"],["src","assets/ngx-biocomp-up-white.svg","alt","ngx-biocomp-up","height","32",1,"d-inline-block","align-text-top"],[1,"container-fluid","bg-dark","pt-2","pb-2"],[1,"row"],[1,"col-3","d-flex","justify-content-start"],["src","assets/biocomp.svg","alt","BioComputing UP","height","36"],[1,"col-6","d-flex","align-items-center","justify-content-center"],["href","https://github.com/damiclem",1,"text-light","small"],[1,"bi","bi-github"],[1,"col-3","d-flex","justify-content-end"],["src","assets/unipd.svg","alt","University of Padua","height","36"]],template:function(r,i){1&r&&(br(0,"header")(1,"nav",0)(2,"div",1)(3,"a",2),js(4,"img",3),Sr()()()(),br(5,"main"),js(6,"router-outlet"),Sr(),br(7,"footer",4)(8,"div",5)(9,"div",6),js(10,"img",7),Sr(),br(11,"div",8)(12,"a",9),Li(13," Developed by Damiano Clementel "),js(14,"i",10),Sr()(),br(15,"div",11),js(16,"img",12),Sr()()())},dependencies:[L0,mU,iU],styles:["[_nghost-%COMP%]{height:inherit;display:inherit;flex-direction:inherit}"]})}return e})(),_Rt).catch(e=>console.error(e))},216:ga=>{"use strict";var an=Object.prototype.hasOwnProperty,ln=Object.prototype.toString,Wr=Object.defineProperty,Ms=Object.getOwnPropertyDescriptor,Ki=function(rr){return"function"==typeof Array.isArray?Array.isArray(rr):"[object Array]"===ln.call(rr)},At=function(rr){if(!rr||"[object Object]"!==ln.call(rr))return!1;var lr,or=an.call(rr,"constructor"),kr=rr.constructor&&rr.constructor.prototype&&an.call(rr.constructor.prototype,"isPrototypeOf");if(rr.constructor&&!or&&!kr)return!1;for(lr in rr);return typeof lr>"u"||an.call(rr,lr)},Ma=function(rr,or){Wr&&"__proto__"===or.name?Wr(rr,or.name,{enumerable:!0,configurable:!0,value:or.newValue,writable:!0}):rr[or.name]=or.newValue},rs=function(rr,or){if("__proto__"===or){if(!an.call(rr,or))return;if(Ms)return Ms(rr,or).value}return rr[or]};ga.exports=function Ci(){var rr,or,kr,lr,Rs,zo,xr=arguments[0],ea=1,ta=arguments.length,vi=!1;for("boolean"==typeof xr&&(vi=xr,xr=arguments[1]||{},ea=2),(null==xr||"object"!=typeof xr&&"function"!=typeof xr)&&(xr={});ea{var an=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,ln=/\n/g,Wr=/^\s*/,Ms=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Ki=/^:\s*/,At=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Ma=/^[;\s]*/,rs=/^\s+|\s+$/g;function zo(xr){return xr?xr.replace(rs,""):""}ga.exports=function(xr,ea){if("string"!=typeof xr)throw new TypeError("First argument must be a string");if(!xr)return[];ea=ea||{};var ta=1,vi=1;function to($r){var fr=$r.match(ln);fr&&(ta+=fr.length);var no=$r.lastIndexOf("\n");vi=~no?$r.length-no:vi+$r.length}function Ul(){var $r={line:ta,column:vi};return function(fr){return fr.position=new Cc($r),Al(),fr}}function Cc($r){this.start=$r,this.end={line:ta,column:vi},this.source=ea.source}Cc.prototype.content=xr;var wc=[];function Ss($r){var fr=new Error(ea.source+":"+ta+":"+vi+": "+$r);if(fr.reason=$r,fr.filename=ea.source,fr.line=ta,fr.column=vi,fr.source=xr,!ea.silent)throw fr;wc.push(fr)}function Cs($r){var fr=$r.exec(xr);if(fr){var no=fr[0];return to(no),xr=xr.slice(no.length),fr}}function Al(){Cs(Wr)}function Ac($r){var fr;for($r=$r||[];fr=le();)!1!==fr&&$r.push(fr);return $r}function le(){var $r=Ul();if("/"==xr.charAt(0)&&"*"==xr.charAt(1)){for(var fr=2;""!=xr.charAt(fr)&&("*"!=xr.charAt(fr)||"/"!=xr.charAt(fr+1));)++fr;if(""===xr.charAt((fr+=2)-1))return Ss("End of comment missing");var no=xr.slice(2,fr-2);return vi+=2,to(no),xr=xr.slice(fr),vi+=2,$r({type:"comment",comment:no})}}function zf(){var $r=Ul(),fr=Cs(Ms);if(fr){if(le(),!Cs(Ki))return Ss("property missing ':'");var no=Cs(At),hr=$r({type:"declaration",property:zo(fr[0].replace(an,"")),value:no?zo(no[0].replace(an,"")):""});return Cs(Ma),hr}}return Al(),function Zi(){var fr,$r=[];for(Ac($r);fr=zf();)!1!==fr&&($r.push(fr),Ac($r));return $r}()}},578:(ga,an,ln)=>{"use strict";var Ms=ln(395),Ki=ln(605);function At(b){for(var S="https://reactjs.org/docs/error-decoder.html?invariant="+b,k=1;k"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),kr=Object.prototype.hasOwnProperty,lr=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Rs={},zo={};function vi(b,S,k,U,Y,J,ve){this.acceptsBooleans=2===S||3===S||4===S,this.attributeName=U,this.attributeNamespace=Y,this.mustUseProperty=k,this.propertyName=b,this.type=S,this.sanitizeURL=J,this.removeEmptyString=ve}var to={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(b){to[b]=new vi(b,0,!1,b,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(b){var S=b[0];to[S]=new vi(S,1,!1,b[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(b){to[b]=new vi(b,2,!1,b.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(b){to[b]=new vi(b,2,!1,b,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(b){to[b]=new vi(b,3,!1,b.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(b){to[b]=new vi(b,3,!0,b,null,!1,!1)}),["capture","download"].forEach(function(b){to[b]=new vi(b,4,!1,b,null,!1,!1)}),["cols","rows","size","span"].forEach(function(b){to[b]=new vi(b,6,!1,b,null,!1,!1)}),["rowSpan","start"].forEach(function(b){to[b]=new vi(b,5,!1,b.toLowerCase(),null,!1,!1)});var Ul=/[\-:]([a-z])/g;function Cc(b){return b[1].toUpperCase()}function wc(b,S,k,U){var Y=to.hasOwnProperty(S)?to[S]:null;(null!==Y?0!==Y.type:U||!(2"u"||function ea(b,S,k,U){if(null!==k&&0===k.type)return!1;switch(typeof S){case"function":case"symbol":return!0;case"boolean":return!U&&(null!==k?!k.acceptsBooleans:"data-"!==(b=b.toLowerCase().slice(0,5))&&"aria-"!==b);default:return!1}}(b,S,k,U))return!0;if(U)return!1;if(null!==k)switch(k.type){case 3:return!S;case 4:return!1===S;case 5:return isNaN(S);case 6:return isNaN(S)||1>S}return!1}(S,k,Y,U)&&(k=null),U||null===Y?function xr(b){return!!kr.call(zo,b)||!kr.call(Rs,b)&&(lr.test(b)?zo[b]=!0:(Rs[b]=!0,!1))}(S)&&(null===k?b.removeAttribute(S):b.setAttribute(S,""+k)):Y.mustUseProperty?b[Y.propertyName]=null===k?3!==Y.type&&"":k:(S=Y.attributeName,U=Y.attributeNamespace,null===k?b.removeAttribute(S):(k=3===(Y=Y.type)||4===Y&&!0===k?"":""+k,U?b.setAttributeNS(U,S,k):b.setAttribute(S,k))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(b){var S=b.replace(Ul,Cc);to[S]=new vi(S,1,!1,b,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(b){var S=b.replace(Ul,Cc);to[S]=new vi(S,1,!1,b,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(b){var S=b.replace(Ul,Cc);to[S]=new vi(S,1,!1,b,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(b){to[b]=new vi(b,1,!1,b.toLowerCase(),null,!1,!1)}),to.xlinkHref=new vi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(b){to[b]=new vi(b,1,!1,b.toLowerCase(),null,!0,!0)});var Ss=Ms.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Cs=Symbol.for("react.element"),Al=Symbol.for("react.portal"),Ac=Symbol.for("react.fragment"),le=Symbol.for("react.strict_mode"),zf=Symbol.for("react.profiler"),Zi=Symbol.for("react.provider"),$r=Symbol.for("react.context"),fr=Symbol.for("react.forward_ref"),no=Symbol.for("react.suspense"),hr=Symbol.for("react.suspense_list"),sn=Symbol.for("react.memo"),er=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var Hr=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var et=Symbol.iterator;function Lt(b){return null===b||"object"!=typeof b?null:"function"==typeof(b=et&&b[et]||b["@@iterator"])?b:null}var fi,zn=Object.assign;function mi(b){if(void 0===fi)try{throw Error()}catch(k){var S=k.stack.trim().match(/\n( *(at )?)/);fi=S&&S[1]||""}return"\n"+fi+b}var Ni=!1;function po(b,S){if(!b||Ni)return"";Ni=!0;var k=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(S)if(S=function(){throw Error()},Object.defineProperty(S.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(S,[])}catch(pt){var U=pt}Reflect.construct(b,[],S)}else{try{S.call()}catch(pt){U=pt}b.call(S.prototype)}else{try{throw Error()}catch(pt){U=pt}b()}}catch(pt){if(pt&&U&&"string"==typeof pt.stack){for(var Y=pt.stack.split("\n"),J=U.stack.split("\n"),ve=Y.length-1,De=J.length-1;1<=ve&&0<=De&&Y[ve]!==J[De];)De--;for(;1<=ve&&0<=De;ve--,De--)if(Y[ve]!==J[De]){if(1!==ve||1!==De)do{if(ve--,0>--De||Y[ve]!==J[De]){var He="\n"+Y[ve].replace(" at new "," at ");return b.displayName&&He.includes("")&&(He=He.replace("",b.displayName)),He}}while(1<=ve&&0<=De);break}}}finally{Ni=!1,Error.prepareStackTrace=k}return(b=b?b.displayName||b.name:"")?mi(b):""}function ws(b){switch(b.tag){case 5:return mi(b.type);case 16:return mi("Lazy");case 13:return mi("Suspense");case 19:return mi("SuspenseList");case 0:case 2:case 15:return po(b.type,!1);case 11:return po(b.type.render,!1);case 1:return po(b.type,!0);default:return""}}function Vo(b){if(null==b)return null;if("function"==typeof b)return b.displayName||b.name||null;if("string"==typeof b)return b;switch(b){case Ac:return"Fragment";case Al:return"Portal";case zf:return"Profiler";case le:return"StrictMode";case no:return"Suspense";case hr:return"SuspenseList"}if("object"==typeof b)switch(b.$$typeof){case $r:return(b.displayName||"Context")+".Consumer";case Zi:return(b._context.displayName||"Context")+".Provider";case fr:var S=b.render;return(b=b.displayName)||(b=""!==(b=S.displayName||S.name||"")?"ForwardRef("+b+")":"ForwardRef"),b;case sn:return null!==(S=b.displayName||null)?S:Vo(b.type)||"Memo";case er:S=b._payload,b=b._init;try{return Vo(b(S))}catch{}}return null}function Ic(b){var S=b.type;switch(b.tag){case 24:return"Cache";case 9:return(S.displayName||"Context")+".Consumer";case 10:return(S._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return b=(b=S.render).displayName||b.name||"",S.displayName||(""!==b?"ForwardRef("+b+")":"ForwardRef");case 7:return"Fragment";case 5:return S;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Vo(S);case 8:return S===le?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof S)return S.displayName||S.name||null;if("string"==typeof S)return S}return null}function ih(b){switch(typeof b){case"boolean":case"number":case"string":case"undefined":case"object":return b;default:return""}}function UI(b){var S=b.type;return(b=b.nodeName)&&"input"===b.toLowerCase()&&("checkbox"===S||"radio"===S)}function xm(b){b._valueTracker||(b._valueTracker=function G2(b){var S=UI(b)?"checked":"value",k=Object.getOwnPropertyDescriptor(b.constructor.prototype,S),U=""+b[S];if(!b.hasOwnProperty(S)&&typeof k<"u"&&"function"==typeof k.get&&"function"==typeof k.set){var Y=k.get,J=k.set;return Object.defineProperty(b,S,{configurable:!0,get:function(){return Y.call(this)},set:function(ve){U=""+ve,J.call(this,ve)}}),Object.defineProperty(b,S,{enumerable:k.enumerable}),{getValue:function(){return U},setValue:function(ve){U=""+ve},stopTracking:function(){b._valueTracker=null,delete b[S]}}}}(b))}function Jg(b){if(!b)return!1;var S=b._valueTracker;if(!S)return!0;var k=S.getValue(),U="";return b&&(U=UI(b)?b.checked?"true":"false":b.value),(b=U)!==k&&(S.setValue(b),!0)}function Iv(b){if(typeof(b=b||(typeof document<"u"?document:void 0))>"u")return null;try{return b.activeElement||b.body}catch{return b.body}}function _k(b,S){return zn({},S,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:S.checked??b._wrapperState.initialChecked})}function tL(b,S){var k=null==S.defaultValue?"":S.defaultValue,U=null!=S.checked?S.checked:S.defaultChecked;k=ih(null!=S.value?S.value:k),b._wrapperState={initialChecked:U,initialValue:k,controlled:"checkbox"===S.type||"radio"===S.type?null!=S.checked:null!=S.value}}function nL(b,S){null!=(S=S.checked)&&wc(b,"checked",S,!1)}function zI(b,S){nL(b,S);var k=ih(S.value),U=S.type;if(null!=k)"number"===U?(0===k&&""===b.value||b.value!=k)&&(b.value=""+k):b.value!==""+k&&(b.value=""+k);else if("submit"===U||"reset"===U)return void b.removeAttribute("value");S.hasOwnProperty("value")?Ck(b,S.type,k):S.hasOwnProperty("defaultValue")&&Ck(b,S.type,ih(S.defaultValue)),null==S.checked&&null!=S.defaultChecked&&(b.defaultChecked=!!S.defaultChecked)}function Sk(b,S,k){if(S.hasOwnProperty("value")||S.hasOwnProperty("defaultValue")){var U=S.type;if(("submit"===U||"reset"===U)&&null==S.value)return;S=""+b._wrapperState.initialValue,k||S===b.value||(b.value=S),b.defaultValue=S}""!==(k=b.name)&&(b.name=""),b.defaultChecked=!!b._wrapperState.initialChecked,""!==k&&(b.name=k)}function Ck(b,S,k){("number"!==S||Iv(b.ownerDocument)!==b)&&(null==k?b.defaultValue=""+b._wrapperState.initialValue:b.defaultValue!==""+k&&(b.defaultValue=""+k))}var hb=Array.isArray;function e0(b,S,k,U){if(b=b.options,S){S={};for(var Y=0;Y"+S.valueOf().toString()+"",S=GI.firstChild;b.firstChild;)b.removeChild(b.firstChild);for(;S.firstChild;)b.appendChild(S.firstChild)}},typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(S,k,U,Y){MSApp.execUnsafeLocalFunction(function(){return b(S,k)})}:b);function Ev(b,S){if(S){var k=b.firstChild;if(k&&k===b.lastChild&&3===k.nodeType)return void(k.nodeValue=S)}b.textContent=S}var W2={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ak=["Webkit","ms","Moz","O"];function Ik(b,S,k){return null==S||"boolean"==typeof S||""===S?"":k||"number"!=typeof S||0===S||W2.hasOwnProperty(b)&&W2[b]?(""+S).trim():S+"px"}function sL(b,S){for(var k in b=b.style,S)if(S.hasOwnProperty(k)){var U=0===k.indexOf("--"),Y=Ik(k,S[k],U);"float"===k&&(k="cssFloat"),U?b.setProperty(k,Y):b[k]=Y}}Object.keys(W2).forEach(function(b){Ak.forEach(function(S){S=S+b.charAt(0).toUpperCase()+b.substring(1),W2[S]=W2[b]})});var Yo=zn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Tv(b,S){if(S){if(Yo[b]&&(null!=S.children||null!=S.dangerouslySetInnerHTML))throw Error(At(137,b));if(null!=S.dangerouslySetInnerHTML){if(null!=S.children)throw Error(At(60));if("object"!=typeof S.dangerouslySetInnerHTML||!("__html"in S.dangerouslySetInnerHTML))throw Error(At(61))}if(null!=S.style&&"object"!=typeof S.style)throw Error(At(62))}}function Dv(b,S){if(-1===b.indexOf("-"))return"string"==typeof S.is;switch(b){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mb=null;function Il(b){return(b=b.target||b.srcElement||window).correspondingUseElement&&(b=b.correspondingUseElement),3===b.nodeType?b.parentNode:b}var $2=null,t0=null,n0=null;function _m(b){if(b=ex(b)){if("function"!=typeof $2)throw Error(At(280));var S=b.stateNode;S&&(S=tx(S),$2(b.stateNode,b.type,S))}}function Pv(b){t0?n0?n0.push(b):n0=[b]:t0=b}function qI(){if(t0){var b=t0,S=n0;if(n0=t0=null,_m(b),S)for(b=0;b>>=0)?32:31-(Xt(b)/yb|0)|0},Xt=Math.log,yb=Math.LN2,Nv=64,ZI=4194304;function eS(b){switch(b&-b){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&b;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&b;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return b}}function Fv(b,S){var k=b.pendingLanes;if(0===k)return 0;var U=0,Y=b.suspendedLanes,J=b.pingedLanes,ve=268435455&k;if(0!==ve){var De=ve&~Y;0!==De?U=eS(De):0!=(J&=ve)&&(U=eS(J))}else 0!=(ve=k&~Y)?U=eS(ve):0!==J&&(U=eS(J));if(0===U)return 0;if(0!==S&&S!==U&&!(S&Y)&&((Y=U&-U)>=(J=S&-S)||16===Y&&4194240&J))return S;if(4&U&&(U|=16&k),0!==(S=b.entangledLanes))for(b=b.entanglements,S&=U;0k;k++)S.push(b);return S}function a0(b,S,k){b.pendingLanes|=S,536870912!==S&&(b.suspendedLanes=0,b.pingedLanes=0),(b=b.eventTimes)[S=31-ad(S)]=k}function Pk(b,S){var k=b.entangledLanes|=S;for(b=b.entanglements;k;){var U=31-ad(k),Y=1<=cS),qv=" ",Hk=!1;function Gk(b,S){switch(b){case"keyup":return-1!==zk.indexOf(S.keyCode);case"keydown":return 229!==S.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qk(b){return"object"==typeof(b=b.detail)&&"data"in b?b.data:null}var d0=!1,Im={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Wk(b){var S=b&&b.nodeName&&b.nodeName.toLowerCase();return"input"===S?!!Im[b.type]:"textarea"===S}function Rn(b,S,k,U){Pv(U),0<(S=CS(S,"onChange")).length&&(k=new lS("onChange","change",null,k,U),b.push({event:k,listeners:S}))}var Cb=null,qt=null;function dS(b){dd(b,0)}function wb(b){if(Jg(Dm(b)))return b}function Wv(b,S){if("change"===b)return S}var $k=!1;if(or){var aE;if(or){var lE="oninput"in document;if(!lE){var Yk=document.createElement("div");Yk.setAttribute("oninput","return;"),lE="function"==typeof Yk.oninput}aE=lE}else aE=!1;$k=aE&&(!document.documentMode||9=S)return{node:k,offset:S-b};b=U}e:{for(;k;){if(k.nextSibling){k=k.nextSibling;break e}k=k.parentNode}k=void 0}k=Yv(k)}}function pS(b,S){return!(!b||!S)&&(b===S||(!b||3!==b.nodeType)&&(S&&3===S.nodeType?pS(b,S.parentNode):"contains"in b?b.contains(S):!!b.compareDocumentPosition&&!!(16&b.compareDocumentPosition(S))))}function _L(){for(var b=window,S=Iv();S instanceof b.HTMLIFrameElement;){try{var k="string"==typeof S.contentWindow.location.href}catch{k=!1}if(!k)break;S=Iv((b=S.contentWindow).document)}return S}function hS(b){var S=b&&b.nodeName&&b.nodeName.toLowerCase();return S&&("input"===S&&("text"===b.type||"search"===b.type||"tel"===b.type||"url"===b.type||"password"===b.type)||"textarea"===S||"true"===b.contentEditable)}function WK(b){var S=_L(),k=b.focusedElem,U=b.selectionRange;if(S!==k&&k&&k.ownerDocument&&pS(k.ownerDocument.documentElement,k)){if(null!==U&&hS(k))if(S=U.start,void 0===(b=U.end)&&(b=S),"selectionStart"in k)k.selectionStart=S,k.selectionEnd=Math.min(b,k.value.length);else if((b=(S=k.ownerDocument||document)&&S.defaultView||window).getSelection){b=b.getSelection();var Y=k.textContent.length,J=Math.min(U.start,Y);U=void 0===U.end?J:Math.min(U.end,Y),!b.extend&&J>U&&(Y=U,U=J,J=Y),Y=Xv(k,J);var ve=Xv(k,U);Y&&ve&&(1!==b.rangeCount||b.anchorNode!==Y.node||b.anchorOffset!==Y.offset||b.focusNode!==ve.node||b.focusOffset!==ve.offset)&&((S=S.createRange()).setStart(Y.node,Y.offset),b.removeAllRanges(),J>U?(b.addRange(S),b.extend(ve.node,ve.offset)):(S.setEnd(ve.node,ve.offset),b.addRange(S)))}for(S=[],b=k;b=b.parentNode;)1===b.nodeType&&S.push({element:b,left:b.scrollLeft,top:b.scrollTop});for("function"==typeof k.focus&&k.focus(),k=0;k=document.documentMode,Em=null,Tm=null,mS=null,gS=!1;function Wd(b,S,k){var U=k.window===k?k.document:9===k.nodeType?k:k.ownerDocument;gS||null==Em||Em!==Iv(U)||(U="selectionStart"in(U=Em)&&hS(U)?{start:U.selectionStart,end:U.selectionEnd}:{anchorNode:(U=(U.ownerDocument&&U.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:U.anchorOffset,focusNode:U.focusNode,focusOffset:U.focusOffset},mS&&Ab(mS,U)||(mS=U,0<(U=CS(Tm,"onSelect")).length&&(S=new lS("onSelect","select",null,S,k),b.push({event:S,listeners:U}),S.target=Em)))}function xi(b,S){var k={};return k[b.toLowerCase()]=S.toLowerCase(),k["Webkit"+b]="webkit"+S,k["Moz"+b]="moz"+S,k}var ld={animationend:xi("Animation","AnimationEnd"),animationiteration:xi("Animation","AnimationIteration"),animationstart:xi("Animation","AnimationStart"),transitionend:xi("Transition","TransitionEnd")},yS={},bS={};function p0(b){if(yS[b])return yS[b];if(!ld[b])return b;var k,S=ld[b];for(k in S)if(S.hasOwnProperty(k)&&k in bS)return yS[b]=S[k];return b}or&&(bS=document.createElement("div").style,"AnimationEvent"in window||(delete ld.animationend.animation,delete ld.animationiteration.animation,delete ld.animationstart.animation),"TransitionEvent"in window||delete ld.transitionend.transition);var Kv=p0("animationend"),cd=p0("animationiteration"),ud=p0("animationstart"),Kk=p0("transitionend"),vS=new Map,cE="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function dh(b,S){vS.set(b,S),Ci(S,[b])}for(var h0=0;h0fd||(b.current=ES[fd],ES[fd]=null,fd--)}function ho(b,S){fd++,ES[fd]=b.current,b.current=S}var km={},el=Pm(km),Dl=Pm(!1),Na=km;function Kd(b,S){var k=b.type.contextTypes;if(!k)return km;var U=b.stateNode;if(U&&U.__reactInternalMemoizedUnmaskedChildContext===S)return U.__reactInternalMemoizedMaskedChildContext;var J,Y={};for(J in k)Y[J]=S[J];return U&&((b=b.stateNode).__reactInternalMemoizedUnmaskedChildContext=S,b.__reactInternalMemoizedMaskedChildContext=Y),Y}function ql(b){return null!=b.childContextTypes}function TS(){No(Dl),No(el)}function iM(b,S,k){if(el.current!==km)throw Error(At(168));ho(el,S),ho(Dl,k)}function dE(b,S,k){var U=b.stateNode;if(S=S.childContextTypes,"function"!=typeof U.getChildContext)return k;for(var Y in U=U.getChildContext())if(!(Y in S))throw Error(At(108,Ic(b)||"Unknown",Y));return zn({},k,U)}function hh(b){return b=(b=b.stateNode)&&b.__reactInternalMemoizedMergedChildContext||km,Na=el.current,ho(el,b),ho(Dl,Dl.current),!0}function oM(b,S,k){var U=b.stateNode;if(!U)throw Error(At(169));k?(b=dE(b,S,Na),U.__reactInternalMemoizedMergedChildContext=b,No(Dl),No(el),ho(el,b)):No(Dl),ho(Dl,k)}var mh=null,DS=!1,nx=!1;function Hf(b){null===mh?mh=[b]:mh.push(b)}function Zd(){if(!nx&&null!==mh){nx=!0;var b=0,S=Gn;try{var k=mh;for(Gn=1;b>=ve,Y-=ve,gh=1<<32-ad(S)+Y|k<Ir?(il=ur,ur=null):il=ur.sibling;var Bi=Bt(it,ur,lt[Ir],tn);if(null===Bi){null===ur&&(ur=il);break}b&&ur&&null===Bi.alternate&&S(it,ur),We=J(Bi,We,Ir),null===cr?Fn=Bi:cr.sibling=Bi,cr=Bi,ur=il}if(Ir===lt.length)return k(it,ur),wr&&y0(it,Ir),Fn;if(null===ur){for(;IrIr?(il=ur,ur=null):il=ur.sibling;var Qf=Bt(it,ur,Bi.value,tn);if(null===Qf){null===ur&&(ur=il);break}b&&ur&&null===Qf.alternate&&S(it,ur),We=J(Qf,We,Ir),null===cr?Fn=Qf:cr.sibling=Qf,cr=Qf,ur=il}if(Bi.done)return k(it,ur),wr&&y0(it,Ir),Fn;if(null===ur){for(;!Bi.done;Ir++,Bi=lt.next())null!==(Bi=Wt(it,Bi.value,tn))&&(We=J(Bi,We,Ir),null===cr?Fn=Bi:cr.sibling=Bi,cr=Bi);return wr&&y0(it,Ir),Fn}for(ur=U(it,ur);!Bi.done;Ir++,Bi=lt.next())null!==(Bi=yn(ur,it,Ir,Bi.value,tn))&&(b&&null!==Bi.alternate&&ur.delete(null===Bi.key?Ir:Bi.key),We=J(Bi,We,Ir),null===cr?Fn=Bi:cr.sibling=Bi,cr=Bi);return b&&ur.forEach(function(WL){return S(it,WL)}),wr&&y0(it,Ir),Fn}(it,We,lt,tn);RS(it,lt)}return"string"==typeof lt&&""!==lt||"number"==typeof lt?(lt=""+lt,null!==We&&6===We.tag?(k(it,We.sibling),(We=Y(We,lt)).return=it,it=We):(k(it,We),(We=P0(lt,it.mode,tn)).return=it,it=We),ve(it)):k(it,We)}}var sx=AL(!0),IL=AL(!1),FS={},_h=Pm(FS),OS=Pm(FS),BS=Pm(FS);function Rb(b){if(b===FS)throw Error(At(174));return b}function uM(b,S){switch(ho(BS,S),ho(OS,b),ho(_h,FS),b=S.nodeType){case 9:case 11:S=(S=S.documentElement)?S.namespaceURI:HI(null,"");break;default:S=HI(S=(b=8===b?S.parentNode:S).namespaceURI||null,b=b.tagName)}No(_h),ho(_h,S)}function ax(){No(_h),No(OS),No(BS)}function EL(b){Rb(BS.current);var S=Rb(_h.current),k=HI(S,b.type);S!==k&&(ho(OS,b),ho(_h,k))}function dM(b){OS.current===b&&(No(_h),No(OS))}var os=Pm(0);function lx(b){for(var S=b;null!==S;){if(13===S.tag){var k=S.memoizedState;if(null!==k&&(null===(k=k.dehydrated)||"$?"===k.data||"$!"===k.data))return S}else if(19===S.tag&&void 0!==S.memoizedProps.revealOrder){if(128&S.flags)return S}else if(null!==S.child){S.child.return=S,S=S.child;continue}if(S===b)break;for(;null===S.sibling;){if(null===S.return||S.return===b)return null;S=S.return}S.sibling.return=S.return,S=S.sibling}return null}var fM=[];function pM(){for(var b=0;bk?k:4,b(!0);var U=hM.transition;hM.transition={};try{b(!1),S()}finally{Gn=k,hM.transition=U}}function TL(){return wu().memoizedState}function DL(b,S,k){var U=wh(b);k={lane:U,action:k,hasEagerState:!1,eagerState:null,next:null},vM(b)?xE(S,k):null!==(k=Ar(b,S,k,U))&&(Tu(k,b,U,kc()),C0(k,S,U))}function PL(b,S,k){var U=wh(b),Y={lane:U,action:k,hasEagerState:!1,eagerState:null,next:null};if(vM(b))xE(S,Y);else{var J=b.alternate;if(0===b.lanes&&(null===J||0===J.lanes)&&null!==(J=S.lastRenderedReducer))try{var ve=S.lastRenderedState,De=J(ve,k);if(Y.hasEagerState=!0,Y.eagerState=De,Vl(De,ve)){var He=S.interleaved;return null===He?(Y.next=Y,xh(S)):(Y.next=He.next,He.next=Y),void(S.interleaved=Y)}}catch{}null!==(k=Ar(b,S,Y,U))&&(Tu(k,b,U,Y=kc()),C0(k,S,U))}}function vM(b){var S=b.alternate;return b===ss||null!==S&&S===ss}function xE(b,S){cx=LS=!0;var k=b.pending;null===k?S.next=S:(S.next=k.next,k.next=S),b.pending=S}function C0(b,S,k){if(4194240&k){var U=S.lanes;S.lanes=k|=U&=b.pendingLanes,Pk(b,k)}}var qS={readContext:Fa,useCallback:$l,useContext:$l,useEffect:$l,useImperativeHandle:$l,useInsertionEffect:$l,useLayoutEffect:$l,useMemo:$l,useReducer:$l,useRef:$l,useState:$l,useDebugValue:$l,useDeferredValue:$l,useTransition:$l,useMutableSource:$l,useSyncExternalStore:$l,useId:$l,unstable_isNewReconciler:!1},kL={readContext:Fa,useCallback:function(b,S){return nf().memoizedState=[b,void 0===S?null:S],b},useContext:Fa,useEffect:yE,useImperativeHandle:function(b,S,k){return k=null!=k?k.concat([b]):null,zS(4194308,4,HS.bind(null,S,b),k)},useLayoutEffect:function(b,S){return zS(4194308,4,b,S)},useInsertionEffect:function(b,S){return zS(4,2,b,S)},useMemo:function(b,S){var k=nf();return S=void 0===S?null:S,b=b(),k.memoizedState=[b,S],b},useReducer:function(b,S,k){var U=nf();return S=void 0!==k?k(S):S,U.memoizedState=U.baseState=S,U.queue=b={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:b,lastRenderedState:S},b=b.dispatch=DL.bind(null,ss,b),[U.memoizedState,b]},useRef:function(b){return nf().memoizedState={current:b}},useState:Wc,useDebugValue:jb,useDeferredValue:function(b){return nf().memoizedState=b},useTransition:function(){var b=Wc(!1),S=b[0];return b=bM.bind(null,b[1]),nf().memoizedState=b,[S,b]},useMutableSource:function(){},useSyncExternalStore:function(b,S,k){var U=ss,Y=nf();if(wr){if(void 0===k)throw Error(At(407));k=k()}else{if(k=S(),null===oa)throw Error(At(349));30&_0||Ob(U,S,k)}Y.memoizedState=k;var J={value:k,getSnapshot:S};return Y.queue=J,yE(yM.bind(null,U,J,b),[b]),U.flags|=2048,dx(9,Yl.bind(null,U,J,k,S),void 0,null),k},useId:function(){var b=nf(),S=oa.identifierPrefix;if(wr){var k=yh;S=":"+S+"R"+(k=(gh&~(1<<32-ad(gh)-1)).toString(32)+k),0<(k=Nb++)&&(S+="H"+k.toString(32)),S+=":"}else S=":"+S+"r"+(k=mM++).toString(32)+":";return b.memoizedState=S},unstable_isNewReconciler:!1},ML={readContext:Fa,useCallback:GS,useContext:Fa,useEffect:bE,useImperativeHandle:Lb,useInsertionEffect:vE,useLayoutEffect:VS,useMemo:Nm,useReducer:gE,useRef:US,useState:function(){return gE(Fb)},useDebugValue:jb,useDeferredValue:function(b){return yr(wu(),Oo.memoizedState,b)},useTransition:function(){return[gE(Fb)[0],wu().memoizedState]},useMutableSource:mo,useSyncExternalStore:jS,useId:TL,unstable_isNewReconciler:!1},RL={readContext:Fa,useCallback:GS,useContext:Fa,useEffect:bE,useImperativeHandle:Lb,useInsertionEffect:vE,useLayoutEffect:VS,useMemo:Nm,useReducer:gM,useRef:US,useState:function(){return gM(Fb)},useDebugValue:jb,useDeferredValue:function(b){var S=wu();return null===Oo?S.memoizedState=b:yr(S,Oo.memoizedState,b)},useTransition:function(){return[gM(Fb)[0],wu().memoizedState]},useMutableSource:mo,useSyncExternalStore:jS,useId:TL,unstable_isNewReconciler:!1};function Ub(b,S){try{var k="",U=S;do{k+=ws(U),U=U.return}while(U);var Y=k}catch(J){Y="\nError generating stack: "+J.message+"\n"+J.stack}return{value:b,source:S,stack:Y,digest:null}}function _t(b,S,k){return{value:b,source:null,stack:k??null,digest:S??null}}function ai(b,S){try{console.error(S.value)}catch(k){setTimeout(function(){throw k})}}var Sh="function"==typeof WeakMap?WeakMap:Map;function qf(b,S,k){(k=Gc(-1,k)).tag=3,k.payload={element:null};var U=S.value;return k.callback=function(){_x||(_x=!0,Um=U),ai(0,S)},k}function ro(b,S,k){(k=Gc(-1,k)).tag=3;var U=b.type.getDerivedStateFromError;if("function"==typeof U){var Y=S.value;k.payload=function(){return U(Y)},k.callback=function(){ai(0,S)}}var J=b.stateNode;return null!==J&&"function"==typeof J.componentDidCatch&&(k.callback=function(){ai(0,S),"function"!=typeof U&&(null===Eu?Eu=new Set([this]):Eu.add(this));var ve=S.stack;this.componentDidCatch(S.value,{componentStack:null!==ve?ve:""})}),k}function _E(b,S,k){var U=b.pingCache;if(null===U){U=b.pingCache=new Sh;var Y=new Set;U.set(S,Y)}else void 0===(Y=U.get(S))&&U.set(S,Y=new Set);Y.has(k)||(Y.add(k),b=XK.bind(null,b,S,k),S.then(b,b))}function zb(b){do{var S;if((S=13===b.tag)&&(S=null===(S=b.memoizedState)||null!==S.dehydrated),S)return b;b=b.return}while(null!==b);return null}function rf(b,S,k,U,Y){return 1&b.mode?(b.flags|=65536,b.lanes=Y,b):(b===S?b.flags|=65536:(b.flags|=128,k.flags|=131072,k.flags&=-52805,1===k.tag&&(null===k.alternate?k.tag=17:((S=Gc(-1,1)).tag=2,Eo(k,S,1))),k.lanes|=1),b)}var SE=Ss.ReactCurrentOwner,Xl=!1;function Dc(b,S,k,U){S.child=null===b?IL(S,null,k,U):sx(S,b.child,k,U)}function NL(b,S,k,U,Y){k=k.render;var J=S.ref;return x0(S,Y),U=mE(b,S,k,U,J,Y),k=gd(),null===b||Xl?(wr&&k&&fE(S),S.flags|=1,Dc(b,S,U,Y),S.child):(S.updateQueue=b.updateQueue,S.flags&=-2053,b.lanes&=~Y,Yf(b,S,Y))}function CE(b,S,k,U,Y){if(null===b){var J=k.type;return"function"!=typeof J||nC(J)||void 0!==J.defaultProps||null!==k.compare||void 0!==k.defaultProps?((b=rl(k.type,null,U,S,S.mode,Y)).ref=S.ref,b.return=S,S.child=b):(S.tag=15,S.type=J,Kl(b,S,J,U,Y))}return J=b.child,b.lanes&Y||!(k=null!==(k=k.compare)?k:Ab)(J.memoizedProps,U)||b.ref!==S.ref?(S.flags|=1,(b=Zf(J,U)).ref=S.ref,b.return=S,S.child=b):Yf(b,S,Y)}function Kl(b,S,k,U,Y){if(null!==b){var J=b.memoizedProps;if(Ab(J,U)&&b.ref===S.ref){if(Xl=!1,S.pendingProps=U=J,!(b.lanes&Y))return S.lanes=b.lanes,Yf(b,S,Y);131072&b.flags&&(Xl=!0)}}return Iu(b,S,k,U,Y)}function Wf(b,S,k){var U=S.pendingProps,Y=U.children,J=null!==b?b.memoizedState:null;if("hidden"===U.mode)if(1&S.mode){if(!(1073741824&k))return b=null!==J?J.baseLanes|k:k,S.lanes=S.childLanes=1073741824,S.memoizedState={baseLanes:b,cachePool:null,transitions:null},S.updateQueue=null,ho(Lm,Ql),Ql|=b,null;S.memoizedState={baseLanes:0,cachePool:null,transitions:null},U=null!==J?J.baseLanes:k,ho(Lm,Ql),Ql|=U}else S.memoizedState={baseLanes:0,cachePool:null,transitions:null},ho(Lm,Ql),Ql|=k;else null!==J?(U=J.baseLanes|k,S.memoizedState=null):U=k,ho(Lm,Ql),Ql|=U;return Dc(b,S,Y,k),S.child}function wE(b,S){var k=S.ref;(null===b&&null!==k||null!==b&&b.ref!==k)&&(S.flags|=512,S.flags|=2097152)}function Iu(b,S,k,U,Y){var J=ql(k)?Na:el.current;return J=Kd(S,J),x0(S,Y),k=mE(b,S,k,U,J,Y),U=gd(),null===b||Xl?(wr&&U&&fE(S),S.flags|=1,Dc(b,S,k,Y),S.child):(S.updateQueue=b.updateQueue,S.flags&=-2053,b.lanes&=~Y,Yf(b,S,Y))}function $f(b,S,k,U,Y){if(ql(k)){var J=!0;hh(S)}else J=!1;if(x0(S,Y),null===S.stateNode)mx(b,S),lM(S,k,U),ox(S,k,U,Y),U=!0;else if(null===b){var ve=S.stateNode,De=S.memoizedProps;ve.props=De;var He=ve.context,pt=k.contextType;pt="object"==typeof pt&&null!==pt?Fa(pt):Kd(S,pt=ql(k)?Na:el.current);var Ot=k.getDerivedStateFromProps,Wt="function"==typeof Ot||"function"==typeof ve.getSnapshotBeforeUpdate;Wt||"function"!=typeof ve.UNSAFE_componentWillReceiveProps&&"function"!=typeof ve.componentWillReceiveProps||(De!==U||He!==pt)&&cM(S,ve,U,pt),hd=!1;var Bt=S.memoizedState;ve.state=Bt,Oa(S,U,ve,Y),He=S.memoizedState,De!==U||Bt!==He||Dl.current||hd?("function"==typeof Ot&&(kb(S,k,Ot,U),He=S.memoizedState),(De=hd||MS(S,k,De,U,Bt,He,pt))?(Wt||"function"!=typeof ve.UNSAFE_componentWillMount&&"function"!=typeof ve.componentWillMount||("function"==typeof ve.componentWillMount&&ve.componentWillMount(),"function"==typeof ve.UNSAFE_componentWillMount&&ve.UNSAFE_componentWillMount()),"function"==typeof ve.componentDidMount&&(S.flags|=4194308)):("function"==typeof ve.componentDidMount&&(S.flags|=4194308),S.memoizedProps=U,S.memoizedState=He),ve.props=U,ve.state=He,ve.context=pt,U=De):("function"==typeof ve.componentDidMount&&(S.flags|=4194308),U=!1)}else{ve=S.stateNode,ix(b,S),De=S.memoizedProps,pt=S.type===S.elementType?De:Tc(S.type,De),ve.props=pt,Wt=S.pendingProps,Bt=ve.context,He="object"==typeof(He=k.contextType)&&null!==He?Fa(He):Kd(S,He=ql(k)?Na:el.current);var yn=k.getDerivedStateFromProps;(Ot="function"==typeof yn||"function"==typeof ve.getSnapshotBeforeUpdate)||"function"!=typeof ve.UNSAFE_componentWillReceiveProps&&"function"!=typeof ve.componentWillReceiveProps||(De!==Wt||Bt!==He)&&cM(S,ve,U,He),hd=!1,ve.state=Bt=S.memoizedState,Oa(S,U,ve,Y);var Tn=S.memoizedState;De!==Wt||Bt!==Tn||Dl.current||hd?("function"==typeof yn&&(kb(S,k,yn,U),Tn=S.memoizedState),(pt=hd||MS(S,k,pt,U,Bt,Tn,He)||!1)?(Ot||"function"!=typeof ve.UNSAFE_componentWillUpdate&&"function"!=typeof ve.componentWillUpdate||("function"==typeof ve.componentWillUpdate&&ve.componentWillUpdate(U,Tn,He),"function"==typeof ve.UNSAFE_componentWillUpdate&&ve.UNSAFE_componentWillUpdate(U,Tn,He)),"function"==typeof ve.componentDidUpdate&&(S.flags|=4),"function"==typeof ve.getSnapshotBeforeUpdate&&(S.flags|=1024)):("function"!=typeof ve.componentDidUpdate||De===b.memoizedProps&&Bt===b.memoizedState||(S.flags|=4),"function"!=typeof ve.getSnapshotBeforeUpdate||De===b.memoizedProps&&Bt===b.memoizedState||(S.flags|=1024),S.memoizedProps=U,S.memoizedState=Tn),ve.props=U,ve.state=Tn,ve.context=He,U=pt):("function"!=typeof ve.componentDidUpdate||De===b.memoizedProps&&Bt===b.memoizedState||(S.flags|=4),"function"!=typeof ve.getSnapshotBeforeUpdate||De===b.memoizedProps&&Bt===b.memoizedState||(S.flags|=1024),U=!1)}return AE(b,S,k,U,J,Y)}function AE(b,S,k,U,Y,J){wE(b,S);var ve=!!(128&S.flags);if(!U&&!ve)return Y&&oM(S,k,!1),Yf(b,S,J);U=S.stateNode,SE.current=S;var De=ve&&"function"!=typeof k.getDerivedStateFromError?null:U.render();return S.flags|=1,null!==b&&ve?(S.child=sx(S,b.child,null,J),S.child=sx(S,null,De,J)):Dc(b,S,De,J),S.memoizedState=U.state,Y&&oM(S,k,!0),S.child}function IE(b){var S=b.stateNode;S.pendingContext?iM(0,S.pendingContext,S.pendingContext!==S.context):S.context&&iM(0,S.context,!1),uM(b,S.containerInfo)}function xM(b,S,k,U,Y){return Os(),Cu(Y),S.flags|=256,Dc(b,S,k,U),S.child}var $S,PE,kl,Fm,EE={dehydrated:null,treeContext:null,retryLane:0};function fx(b){return{baseLanes:b,cachePool:null,transitions:null}}function WS(b,S,k){var De,U=S.pendingProps,Y=os.current,J=!1,ve=!!(128&S.flags);if((De=ve)||(De=(null===b||null!==b.memoizedState)&&!!(2&Y)),De?(J=!0,S.flags&=-129):(null===b||null!==b.memoizedState)&&(Y|=1),ho(os,1&Y),null===b)return tl(S),null!==(b=S.memoizedState)&&null!==(b=b.dehydrated)?(S.lanes=1&S.mode?"$!"===b.data?8:1073741824:1,null):(ve=U.children,b=U.fallback,J?(J=S.child,ve={mode:"hidden",children:ve},1&(U=S.mode)||null===J?J=Zb(ve,U,0,null):(J.childLanes=0,J.pendingProps=ve),b=D0(b,U,k,null),J.return=S,b.return=S,J.sibling=b,S.child=J,S.child.memoizedState=fx(k),S.memoizedState=EE,b):px(S,ve));if(null!==(Y=b.memoizedState)&&null!==(De=Y.dehydrated))return function FL(b,S,k,U,Y,J,ve){if(k)return 256&S.flags?(S.flags&=-257,w0(b,S,ve,U=_t(Error(At(422))))):null!==S.memoizedState?(S.child=b.child,S.flags|=128,null):(J=U.fallback,U=Zb({mode:"visible",children:U.children},Y=S.mode,0,null),(J=D0(J,Y,ve,null)).flags|=2,U.return=S,J.return=S,U.sibling=J,S.child=U,1&S.mode&&sx(S,b.child,null,ve),S.child.memoizedState=fx(ve),S.memoizedState=EE,J);if(!(1&S.mode))return w0(b,S,ve,null);if("$!"===Y.data){if(U=Y.nextSibling&&Y.nextSibling.dataset)var De=U.dgst;return U=De,w0(b,S,ve,U=_t(J=Error(At(419)),U,void 0))}if(De=!!(ve&b.childLanes),Xl||De){if(null!==(U=oa)){switch(ve&-ve){case 4:Y=2;break;case 16:Y=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:Y=32;break;case 536870912:Y=268435456;break;default:Y=0}0!==(Y=Y&(U.suspendedLanes|ve)?0:Y)&&Y!==J.retryLane&&(J.retryLane=Y,tf(b,Y),Tu(U,b,Y,-1))}return Jl(),w0(b,S,ve,U=_t(Error(At(421))))}return"$?"===Y.data?(S.flags|=128,S.child=b.child,S=KK.bind(null,b),Y._reactRetry=S,null):(b=J.treeContext,Wl=Yd(Y.nextSibling),Ec=S,wr=!0,Ht=null,null!==b&&(_u[pd++]=gh,_u[pd++]=yh,_u[pd++]=Jd,gh=b.id,yh=b.overflow,Jd=S),(S=px(S,U.children)).flags|=4096,S)}(b,S,ve,U,De,Y,k);if(J){J=U.fallback,De=(Y=b.child).sibling;var He={mode:"hidden",children:U.children};return 1&(ve=S.mode)||S.child===Y?(U=Zf(Y,He)).subtreeFlags=14680064&Y.subtreeFlags:((U=S.child).childLanes=0,U.pendingProps=He,S.deletions=null),null!==De?J=Zf(De,J):(J=D0(J,ve,k,null)).flags|=2,J.return=S,U.return=S,U.sibling=J,S.child=U,U=J,J=S.child,ve=null===(ve=b.child.memoizedState)?fx(k):{baseLanes:ve.baseLanes|k,cachePool:null,transitions:ve.transitions},J.memoizedState=ve,J.childLanes=b.childLanes&~k,S.memoizedState=EE,U}return b=(J=b.child).sibling,U=Zf(J,{mode:"visible",children:U.children}),!(1&S.mode)&&(U.lanes=k),U.return=S,U.sibling=null,null!==b&&(null===(k=S.deletions)?(S.deletions=[b],S.flags|=16):k.push(b)),S.child=U,S.memoizedState=null,U}function px(b,S){return(S=Zb({mode:"visible",children:S},b.mode,0,null)).return=b,b.child=S}function w0(b,S,k,U){return null!==U&&Cu(U),sx(S,b.child,null,k),(b=px(S,S.pendingProps.children)).flags|=2,S.memoizedState=null,b}function TE(b,S,k){b.lanes|=S;var U=b.alternate;null!==U&&(U.lanes|=S),v0(b.return,S,k)}function hx(b,S,k,U,Y){var J=b.memoizedState;null===J?b.memoizedState={isBackwards:S,rendering:null,renderingStartTime:0,last:U,tail:k,tailMode:Y}:(J.isBackwards=S,J.rendering=null,J.renderingStartTime=0,J.last=U,J.tail=k,J.tailMode=Y)}function DE(b,S,k){var U=S.pendingProps,Y=U.revealOrder,J=U.tail;if(Dc(b,S,U.children,k),2&(U=os.current))U=1&U|2,S.flags|=128;else{if(null!==b&&128&b.flags)e:for(b=S.child;null!==b;){if(13===b.tag)null!==b.memoizedState&&TE(b,k,S);else if(19===b.tag)TE(b,k,S);else if(null!==b.child){b.child.return=b,b=b.child;continue}if(b===S)break e;for(;null===b.sibling;){if(null===b.return||b.return===S)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}U&=1}if(ho(os,U),1&S.mode)switch(Y){case"forwards":for(k=S.child,Y=null;null!==k;)null!==(b=k.alternate)&&null===lx(b)&&(Y=k),k=k.sibling;null===(k=Y)?(Y=S.child,S.child=null):(Y=k.sibling,k.sibling=null),hx(S,!1,Y,k,J);break;case"backwards":for(k=null,Y=S.child,S.child=null;null!==Y;){if(null!==(b=Y.alternate)&&null===lx(b)){S.child=Y;break}b=Y.sibling,Y.sibling=k,k=Y,Y=b}hx(S,!0,k,null,J);break;case"together":hx(S,!1,null,null,void 0);break;default:S.memoizedState=null}else S.memoizedState=null;return S.child}function mx(b,S){!(1&S.mode)&&null!==b&&(b.alternate=null,S.alternate=null,S.flags|=2)}function Yf(b,S,k){if(null!==b&&(S.dependencies=b.dependencies),jm|=S.lanes,!(k&S.childLanes))return null;if(null!==b&&S.child!==b.child)throw Error(At(153));if(null!==S.child){for(k=Zf(b=S.child,b.pendingProps),S.child=k,k.return=S;null!==b.sibling;)(k=k.sibling=Zf(b=b.sibling,b.pendingProps)).return=S;k.sibling=null}return S.child}function io(b,S){if(!wr)switch(b.tailMode){case"hidden":S=b.tail;for(var k=null;null!==S;)null!==S.alternate&&(k=S),S=S.sibling;null===k?b.tail=null:k.sibling=null;break;case"collapsed":k=b.tail;for(var U=null;null!==k;)null!==k.alternate&&(U=k),k=k.sibling;null===U?S||null===b.tail?b.tail=null:b.tail.sibling=null:U.sibling=null}}function Zl(b){var S=null!==b.alternate&&b.alternate.child===b.child,k=0,U=0;if(S)for(var Y=b.child;null!==Y;)k|=Y.lanes|Y.childLanes,U|=14680064&Y.subtreeFlags,U|=14680064&Y.flags,Y.return=b,Y=Y.sibling;else for(Y=b.child;null!==Y;)k|=Y.lanes|Y.childLanes,U|=Y.subtreeFlags,U|=Y.flags,Y.return=b,Y=Y.sibling;return b.subtreeFlags|=U,b.childLanes=k,S}function OL(b,S,k){var U=S.pendingProps;switch(pE(S),S.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Zl(S),null;case 1:case 17:return ql(S.type)&&TS(),Zl(S),null;case 3:return U=S.stateNode,ax(),No(Dl),No(el),pM(),U.pendingContext&&(U.context=U.pendingContext,U.pendingContext=null),(null===b||null===b.child)&&(bh(S)?S.flags|=4:null===b||b.memoizedState.isDehydrated&&!(256&S.flags)||(S.flags|=1024,null!==Ht&&(LE(Ht),Ht=null))),PE(b,S),Zl(S),null;case 5:dM(S);var Y=Rb(BS.current);if(k=S.type,null!==b&&null!=S.stateNode)kl(b,S,k,U,Y),b.ref!==S.ref&&(S.flags|=512,S.flags|=2097152);else{if(!U){if(null===S.stateNode)throw Error(At(166));return Zl(S),null}if(b=Rb(_h.current),bh(S)){k=S.type;var J=S.memoizedProps;switch((U=S.stateNode)[Vc]=S,U[Jv]=J,b=!!(1&S.mode),k){case"dialog":Ko("cancel",U),Ko("close",U);break;case"iframe":case"object":case"embed":Ko("load",U);break;case"video":case"audio":for(Y=0;Y<\/script>",b=b.removeChild(b.firstChild)):"string"==typeof U.is?b=ve.createElement(k,{is:U.is}):(b=ve.createElement(k),"select"===k&&(ve=b,U.multiple?ve.multiple=!0:U.size&&(ve.size=U.size))):b=ve.createElementNS(b,k),b[Vc]=S,b[Jv]=U,$S(b,S,!1,!1),S.stateNode=b;e:{switch(ve=Dv(k,U),k){case"dialog":Ko("cancel",b),Ko("close",b),Y=U;break;case"iframe":case"object":case"embed":Ko("load",b),Y=U;break;case"video":case"audio":for(Y=0;Yqb&&(S.flags|=128,U=!0,io(J,!1),S.lanes=4194304)}else{if(!U)if(null!==(b=lx(ve))){if(S.flags|=128,U=!0,null!==(k=b.updateQueue)&&(S.updateQueue=k,S.flags|=4),io(J,!0),null===J.tail&&"hidden"===J.tailMode&&!ve.alternate&&!wr)return Zl(S),null}else 2*na()-J.renderingStartTime>qb&&1073741824!==k&&(S.flags|=128,U=!0,io(J,!1),S.lanes=4194304);J.isBackwards?(ve.sibling=S.child,S.child=ve):(null!==(k=J.last)?k.sibling=ve:S.child=ve,J.last=ve)}return null!==J.tail?(J.rendering=S=J.tail,J.tail=S.sibling,J.renderingStartTime=na(),S.sibling=null,k=os.current,ho(os,U?1&k|2:1&k),S):(Zl(S),null);case 22:case 23:return jE(),U=null!==S.memoizedState,null!==b&&null!==b.memoizedState!==U&&(S.flags|=8192),U&&1&S.mode?1073741824&Ql&&(Zl(S),6&S.subtreeFlags&&(S.flags|=8192)):Zl(S),null;case 24:case 25:return null}throw Error(At(156,S.tag))}function BL(b,S){switch(pE(S),S.tag){case 1:return ql(S.type)&&TS(),65536&(b=S.flags)?(S.flags=-65537&b|128,S):null;case 3:return ax(),No(Dl),No(el),pM(),65536&(b=S.flags)&&!(128&b)?(S.flags=-65537&b|128,S):null;case 5:return dM(S),null;case 13:if(No(os),null!==(b=S.memoizedState)&&null!==b.dehydrated){if(null===S.alternate)throw Error(At(340));Os()}return 65536&(b=S.flags)?(S.flags=-65537&b|128,S):null;case 19:return No(os),null;case 4:return ax(),null;case 10:return ef(S.type._context),null;case 22:case 23:return jE(),null;default:return null}}$S=function(b,S){for(var k=S.child;null!==k;){if(5===k.tag||6===k.tag)b.appendChild(k.stateNode);else if(4!==k.tag&&null!==k.child){k.child.return=k,k=k.child;continue}if(k===S)break;for(;null===k.sibling;){if(null===k.return||k.return===S)return;k=k.return}k.sibling.return=k.return,k=k.sibling}},PE=function(){},kl=function(b,S,k,U){var Y=b.memoizedProps;if(Y!==U){b=S.stateNode,Rb(_h.current);var ve,J=null;switch(k){case"input":Y=_k(b,Y),U=_k(b,U),J=[];break;case"select":Y=zn({},Y,{value:void 0}),U=zn({},U,{value:void 0}),J=[];break;case"textarea":Y=VI(b,Y),U=VI(b,U),J=[];break;default:"function"!=typeof Y.onClick&&"function"==typeof U.onClick&&(b.onclick=Qv)}for(pt in Tv(k,U),k=null,Y)if(!U.hasOwnProperty(pt)&&Y.hasOwnProperty(pt)&&null!=Y[pt])if("style"===pt){var De=Y[pt];for(ve in De)De.hasOwnProperty(ve)&&(k||(k={}),k[ve]="")}else"dangerouslySetInnerHTML"!==pt&&"children"!==pt&&"suppressContentEditableWarning"!==pt&&"suppressHydrationWarning"!==pt&&"autoFocus"!==pt&&(rs.hasOwnProperty(pt)?J||(J=[]):(J=J||[]).push(pt,null));for(pt in U){var He=U[pt];if(De=Y?.[pt],U.hasOwnProperty(pt)&&He!==De&&(null!=He||null!=De))if("style"===pt)if(De){for(ve in De)!De.hasOwnProperty(ve)||He&&He.hasOwnProperty(ve)||(k||(k={}),k[ve]="");for(ve in He)He.hasOwnProperty(ve)&&De[ve]!==He[ve]&&(k||(k={}),k[ve]=He[ve])}else k||(J||(J=[]),J.push(pt,k)),k=He;else"dangerouslySetInnerHTML"===pt?(De=De?De.__html:void 0,null!=(He=He?He.__html:void 0)&&De!==He&&(J=J||[]).push(pt,He)):"children"===pt?"string"!=typeof He&&"number"!=typeof He||(J=J||[]).push(pt,""+He):"suppressContentEditableWarning"!==pt&&"suppressHydrationWarning"!==pt&&(rs.hasOwnProperty(pt)?(null!=He&&"onScroll"===pt&&Ko("scroll",b),J||De===He||(J=[])):(J=J||[]).push(pt,He))}k&&(J=J||[]).push("style",k);var pt=J;(S.updateQueue=pt)&&(S.flags|=4)}},Fm=function(b,S,k,U){k!==U&&(S.flags|=4)};var YS=!1,Ml=!1,SM="function"==typeof WeakSet?WeakSet:Set,vn=null;function Pc(b,S){var k=b.ref;if(null!==k)if("function"==typeof k)try{k(null)}catch(U){As(b,S,U)}else k.current=null}function kE(b,S,k){try{k()}catch(U){As(b,S,U)}}var gx=!1;function Om(b,S,k){var U=S.updateQueue;if(null!==(U=null!==U?U.lastEffect:null)){var Y=U=U.next;do{if((Y.tag&b)===b){var J=Y.destroy;Y.destroy=void 0,void 0!==J&&kE(S,k,J)}Y=Y.next}while(Y!==U)}}function Vb(b,S){if(null!==(S=null!==(S=S.updateQueue)?S.lastEffect:null)){var k=S=S.next;do{(k.tag&b)===b&&(k.destroy=(0,k.create)()),k=k.next}while(k!==S)}}function KS(b){var S=b.ref;null!==S&&(b=b.stateNode,"function"==typeof S?S(b):S.current=b)}function ME(b){var S=b.alternate;null!==S&&(b.alternate=null,ME(S)),b.child=null,b.deletions=null,b.sibling=null,5===b.tag&&null!==(S=b.stateNode)&&(delete S[Vc],delete S[Jv],delete S[AS],delete S[IS],delete S[$K]),b.stateNode=null,b.return=null,b.dependencies=null,b.memoizedProps=null,b.memoizedState=null,b.pendingProps=null,b.stateNode=null,b.updateQueue=null}function CM(b){return 5===b.tag||3===b.tag||4===b.tag}function A0(b){e:for(;;){for(;null===b.sibling;){if(null===b.return||CM(b.return))return null;b=b.return}for(b.sibling.return=b.return,b=b.sibling;5!==b.tag&&6!==b.tag&&18!==b.tag;){if(2&b.flags||null===b.child||4===b.tag)continue e;b.child.return=b,b=b.child}if(!(2&b.flags))return b.stateNode}}function I0(b,S,k){var U=b.tag;if(5===U||6===U)b=b.stateNode,S?8===k.nodeType?k.parentNode.insertBefore(b,S):k.insertBefore(b,S):(8===k.nodeType?(S=k.parentNode).insertBefore(b,k):(S=k).appendChild(b),null!=(k=k._reactRootContainer)||null!==S.onclick||(S.onclick=Qv));else if(4!==U&&null!==(b=b.child))for(I0(b,S,k),b=b.sibling;null!==b;)I0(b,S,k),b=b.sibling}function RE(b,S,k){var U=b.tag;if(5===U||6===U)b=b.stateNode,S?k.insertBefore(b,S):k.appendChild(b);else if(4!==U&&null!==(b=b.child))for(RE(b,S,k),b=b.sibling;null!==b;)RE(b,S,k),b=b.sibling}var La=null,sf=!1;function Bm(b,S,k){for(k=k.child;null!==k;)wM(b,S,k),k=k.sibling}function wM(b,S,k){if(hn&&"function"==typeof hn.onCommitFiberUnmount)try{hn.onCommitFiberUnmount(Q2,k)}catch{}switch(k.tag){case 5:Ml||Pc(k,S);case 6:var U=La,Y=sf;La=null,Bm(b,S,k),sf=Y,null!==(La=U)&&(sf?(k=k.stateNode,8===(b=La).nodeType?b.parentNode.removeChild(k):b.removeChild(k)):La.removeChild(k.stateNode));break;case 18:null!==La&&(sf?(k=k.stateNode,8===(b=La).nodeType?wS(b.parentNode,k):1===b.nodeType&&wS(b,k),sS(b)):wS(La,k.stateNode));break;case 4:U=La,Y=sf,La=k.stateNode.containerInfo,sf=!0,Bm(b,S,k),La=U,sf=Y;break;case 0:case 11:case 14:case 15:if(!Ml&&null!==(U=k.updateQueue)&&null!==(U=U.lastEffect)){Y=U=U.next;do{var J=Y,ve=J.destroy;J=J.tag,void 0!==ve&&(2&J||4&J)&&kE(k,S,ve),Y=Y.next}while(Y!==U)}Bm(b,S,k);break;case 1:if(!Ml&&(Pc(k,S),"function"==typeof(U=k.stateNode).componentWillUnmount))try{U.props=k.memoizedProps,U.state=k.memoizedState,U.componentWillUnmount()}catch(De){As(k,S,De)}Bm(b,S,k);break;case 21:Bm(b,S,k);break;case 22:1&k.mode?(Ml=(U=Ml)||null!==k.memoizedState,Bm(b,S,k),Ml=U):Bm(b,S,k);break;default:Bm(b,S,k)}}function LL(b){var S=b.updateQueue;if(null!==S){b.updateQueue=null;var k=b.stateNode;null===k&&(k=b.stateNode=new SM),S.forEach(function(U){var Y=ZK.bind(null,b,U);k.has(U)||(k.add(U),U.then(Y,Y))})}}function Xf(b,S){var k=S.deletions;if(null!==k)for(var U=0;UY&&(Y=ve),U&=~J}if(U=Y,10<(U=(120>(U=na()-U)?120:480>U?480:1080>U?1080:1920>U?1920:3e3>U?3e3:4320>U?4320:1960*AM(U/1960))-U)){b.timeoutHandle=ra(Hm.bind(null,b,Rl,Kf),U);break}Hm(b,Rl,Kf);break;default:throw Error(At(329))}}}return Nl(b,na()),b.callbackNode===k?OE.bind(null,b):null}function BE(b,S){var k=xx;return b.current.memoizedState.isDehydrated&&($b(b,S).flags|=256),2!==(b=VE(b,S))&&(S=Rl,Rl=k,null!==S&&LE(S)),b}function LE(b){null===Rl?Rl=b:Rl.push.apply(Rl,b)}function Ah(b,S){for(S&=~JS,b.suspendedLanes|=S&=~vx,b.pingedLanes&=~S,b=b.expirationTimes;0b?16:b,null===zm)var U=!1;else{if(b=zm,zm=null,Wb=0,6&Oi)throw Error(At(331));var Y=Oi;for(Oi|=4,vn=b.current;null!==vn;){var J=vn,ve=J.child;if(16&vn.flags){var De=J.deletions;if(null!==De){for(var He=0;Hena()-Ch?$b(b,0):JS|=k),Nl(b,S)}function VL(b,S){0===S&&(1&b.mode?(S=ZI,!(130023424&(ZI<<=1))&&(ZI=4194304)):S=1);var k=kc();null!==(b=tf(b,S))&&(a0(b,S,k),Nl(b,k))}function KK(b){var S=b.memoizedState,k=0;null!==S&&(k=S.retryLane),VL(b,k)}function ZK(b,S){var k=0;switch(b.tag){case 13:var U=b.stateNode,Y=b.memoizedState;null!==Y&&(k=Y.retryLane);break;case 19:U=b.stateNode;break;default:throw Error(At(314))}null!==U&&U.delete(S),VL(b,k)}function DM(b,S){return Ra(b,S)}function Kb(b,S,k,U){this.tag=b,this.key=k,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=S,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=U,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ua(b,S,k,U){return new Kb(b,S,k,U)}function nC(b){return!(!(b=b.prototype)||!b.isReactComponent)}function Zf(b,S){var k=b.alternate;return null===k?((k=Ua(b.tag,S,b.key,b.mode)).elementType=b.elementType,k.type=b.type,k.stateNode=b.stateNode,k.alternate=b,b.alternate=k):(k.pendingProps=S,k.type=b.type,k.flags=0,k.subtreeFlags=0,k.deletions=null),k.flags=14680064&b.flags,k.childLanes=b.childLanes,k.lanes=b.lanes,k.child=b.child,k.memoizedProps=b.memoizedProps,k.memoizedState=b.memoizedState,k.updateQueue=b.updateQueue,k.dependencies=null===(S=b.dependencies)?null:{lanes:S.lanes,firstContext:S.firstContext},k.sibling=b.sibling,k.index=b.index,k.ref=b.ref,k}function rl(b,S,k,U,Y,J){var ve=2;if(U=b,"function"==typeof b)nC(b)&&(ve=1);else if("string"==typeof b)ve=5;else e:switch(b){case Ac:return D0(k.children,Y,J,S);case le:ve=8,Y|=8;break;case zf:return(b=Ua(12,k,S,2|Y)).elementType=zf,b.lanes=J,b;case no:return(b=Ua(13,k,S,Y)).elementType=no,b.lanes=J,b;case hr:return(b=Ua(19,k,S,Y)).elementType=hr,b.lanes=J,b;case Hr:return Zb(k,Y,J,S);default:if("object"==typeof b&&null!==b)switch(b.$$typeof){case Zi:ve=10;break e;case $r:ve=9;break e;case fr:ve=11;break e;case sn:ve=14;break e;case er:ve=16,U=null;break e}throw Error(At(130,null==b?b:typeof b,""))}return(S=Ua(ve,k,S,Y)).elementType=b,S.type=U,S.lanes=J,S}function D0(b,S,k,U){return(b=Ua(7,b,U,S)).lanes=k,b}function Zb(b,S,k,U){return(b=Ua(22,b,U,S)).elementType=Hr,b.lanes=k,b.stateNode={isHidden:!1},b}function P0(b,S,k){return(b=Ua(6,b,null,S)).lanes=k,b}function HE(b,S,k){return(S=Ua(4,null!==b.children?b.children:[],b.key,S)).lanes=k,S.stateNode={containerInfo:b.containerInfo,pendingChildren:null,implementation:b.implementation},S}function PM(b,S,k,U,Y){this.tag=S,this.containerInfo=b,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=tS(0),this.expirationTimes=tS(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tS(0),this.identifierPrefix=U,this.onRecoverableError=Y,this.mutableSourceEagerHydrationData=null}function rC(b,S,k,U,Y,J,ve,De,He){return b=new PM(b,S,k,De,He),1===S?(S=1,!0===J&&(S|=8)):S=0,J=Ua(3,null,null,S),b.current=J,J.stateNode=b,J.memoizedState={element:U,isDehydrated:k,cache:null,transitions:null,pendingSuspenseBoundaries:null},md(J),b}function Cx(b){if(!b)return km;e:{if(sh(b=b._reactInternals)!==b||1!==b.tag)throw Error(At(170));var S=b;do{switch(S.tag){case 3:S=S.stateNode.context;break e;case 1:if(ql(S.type)){S=S.stateNode.__reactInternalMemoizedMergedChildContext;break e}}S=S.return}while(null!==S);throw Error(At(171))}if(1===b.tag){var k=b.type;if(ql(k))return dE(b,k,S)}return S}function sC(b,S,k,U){var Y=S.current,J=kc(),ve=wh(Y);return k=Cx(k),null===S.context?S.context=k:S.pendingContext=k,(S=Gc(J,ve)).payload={element:b},null!==(U=void 0===U?null:U)&&(S.callback=U),null!==(b=Eo(Y,S,ve))&&(Tu(b,Y,ve,J),Pb(b,Y,ve)),ve}function aC(b){return(b=b.current).child?b.child.stateNode:null}function kM(b,S){if(null!==(b=b.memoizedState)&&null!==b.dehydrated){var k=b.retryLane;b.retryLane=0!==k&&k{"use strict";(function Wr(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||"function"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Wr)}catch(Ms){console.error(Ms)}})(),ga.exports=ln(578)},209:(ga,an,ln)=>{"use strict";var Wr=ln(395),Ms=Symbol.for("react.element"),Ki=Symbol.for("react.fragment"),At=Object.prototype.hasOwnProperty,Ma=Wr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,rs={key:!0,ref:!0,__self:!0,__source:!0};function Ci(rr,or,kr){var lr,Rs={},zo=null,xr=null;for(lr in void 0!==kr&&(zo=""+kr),void 0!==or.key&&(zo=""+or.key),void 0!==or.ref&&(xr=or.ref),or)At.call(or,lr)&&!rs.hasOwnProperty(lr)&&(Rs[lr]=or[lr]);if(rr&&rr.defaultProps)for(lr in or=rr.defaultProps)void 0===Rs[lr]&&(Rs[lr]=or[lr]);return{$$typeof:Ms,type:rr,key:zo,ref:xr,props:Rs,_owner:Ma.current}}an.Fragment=Ki,an.jsx=Ci,an.jsxs=Ci},330:(ga,an)=>{"use strict";var ln=Symbol.for("react.element"),Wr=Symbol.for("react.portal"),Ms=Symbol.for("react.fragment"),Ki=Symbol.for("react.strict_mode"),At=Symbol.for("react.profiler"),Ma=Symbol.for("react.provider"),rs=Symbol.for("react.context"),Ci=Symbol.for("react.forward_ref"),rr=Symbol.for("react.suspense"),or=Symbol.for("react.memo"),kr=Symbol.for("react.lazy"),lr=Symbol.iterator,zo={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},xr=Object.assign,ea={};function ta(et,Lt,zn){this.props=et,this.context=Lt,this.refs=ea,this.updater=zn||zo}function vi(){}function to(et,Lt,zn){this.props=et,this.context=Lt,this.refs=ea,this.updater=zn||zo}ta.prototype.isReactComponent={},ta.prototype.setState=function(et,Lt){if("object"!=typeof et&&"function"!=typeof et&&null!=et)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,et,Lt,"setState")},ta.prototype.forceUpdate=function(et){this.updater.enqueueForceUpdate(this,et,"forceUpdate")},vi.prototype=ta.prototype;var Ul=to.prototype=new vi;Ul.constructor=to,xr(Ul,ta.prototype),Ul.isPureReactComponent=!0;var Cc=Array.isArray,wc=Object.prototype.hasOwnProperty,Ss={current:null},Cs={key:!0,ref:!0,__self:!0,__source:!0};function Al(et,Lt,zn){var fi,mi={},Ni=null,po=null;if(null!=Lt)for(fi in void 0!==Lt.ref&&(po=Lt.ref),void 0!==Lt.key&&(Ni=""+Lt.key),Lt)wc.call(Lt,fi)&&!Cs.hasOwnProperty(fi)&&(mi[fi]=Lt[fi]);var ws=arguments.length-2;if(1===ws)mi.children=zn;else if(1{"use strict";ga.exports=ln(330)},619:(ga,an,ln)=>{"use strict";ga.exports=ln(209)},290:(ga,an)=>{"use strict";function ln(sn,er){var Hr=sn.length;sn.push(er);e:for(;0>>1,Lt=sn[et];if(!(0>>1;etKi(mi,Hr))NiKi(po,mi)?(sn[et]=po,sn[Ni]=Hr,et=Ni):(sn[et]=mi,sn[fi]=Hr,et=fi);else{if(!(NiKi(po,Hr)))break e;sn[et]=po,sn[Ni]=Hr,et=Ni}}}return er}function Ki(sn,er){var Hr=sn.sortIndex-er.sortIndex;return 0!==Hr?Hr:sn.id-er.id}if("object"==typeof performance&&"function"==typeof performance.now){var At=performance;an.unstable_now=function(){return At.now()}}else{var Ma=Date,rs=Ma.now();an.unstable_now=function(){return Ma.now()-rs}}var Ci=[],rr=[],or=1,kr=null,lr=3,Rs=!1,zo=!1,xr=!1,ea="function"==typeof setTimeout?setTimeout:null,ta="function"==typeof clearTimeout?clearTimeout:null,vi=typeof setImmediate<"u"?setImmediate:null;function to(sn){for(var er=Wr(rr);null!==er;){if(null===er.callback)Ms(rr);else{if(!(er.startTime<=sn))break;Ms(rr),er.sortIndex=er.expirationTime,ln(Ci,er)}er=Wr(rr)}}function Ul(sn){if(xr=!1,to(sn),!zo)if(null!==Wr(Ci))zo=!0,no(Cc);else{var er=Wr(rr);null!==er&&hr(Ul,er.startTime-sn)}}function Cc(sn,er){zo=!1,xr&&(xr=!1,ta(Cs),Cs=-1),Rs=!0;var Hr=lr;try{for(to(er),kr=Wr(Ci);null!==kr&&(!(kr.expirationTime>er)||sn&&!le());){var et=kr.callback;if("function"==typeof et){kr.callback=null,lr=kr.priorityLevel;var Lt=et(kr.expirationTime<=er);er=an.unstable_now(),"function"==typeof Lt?kr.callback=Lt:kr===Wr(Ci)&&Ms(Ci),to(er)}else Ms(Ci);kr=Wr(Ci)}if(null!==kr)var zn=!0;else{var fi=Wr(rr);null!==fi&&hr(Ul,fi.startTime-er),zn=!1}return zn}finally{kr=null,lr=Hr,Rs=!1}}typeof navigator<"u"&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var Zi,wc=!1,Ss=null,Cs=-1,Al=5,Ac=-1;function le(){return!(an.unstable_now()-Acsn||125et?(sn.sortIndex=Hr,ln(rr,sn),null===Wr(Ci)&&sn===Wr(rr)&&(xr?(ta(Cs),Cs=-1):xr=!0,hr(Ul,Hr-et))):(sn.sortIndex=Lt,ln(Ci,sn),zo||Rs||(zo=!0,no(Cc))),sn},an.unstable_shouldYield=le,an.unstable_wrapCallback=function(sn){var er=lr;return function(){var Hr=lr;lr=er;try{return sn.apply(this,arguments)}finally{lr=Hr}}}},605:(ga,an,ln)=>{"use strict";ga.exports=ln(290)},390:function(ga,an,ln){"use strict";var Wr=this&&this.__importDefault||function(At){return At&&At.__esModule?At:{default:At}};Object.defineProperty(an,"__esModule",{value:!0});var Ms=Wr(ln(763));an.default=function Ki(At,Ma){var rs=null;if(!At||"string"!=typeof At)return rs;var Ci=(0,Ms.default)(At),rr="function"==typeof Ma;return Ci.forEach(function(or){if("declaration"===or.type){var kr=or.property,lr=or.value;rr?Ma(kr,lr,or):lr&&((rs=rs||{})[kr]=lr)}}),rs}},684:ga=>{ga.exports=XMLHttpRequest}},ga=>{ga(ga.s=273)}]); \ No newline at end of file diff --git a/docs/runtime.9c29158757c399f8.js b/docs/runtime.9c29158757c399f8.js deleted file mode 100644 index 5e21282..0000000 --- a/docs/runtime.9c29158757c399f8.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{"use strict";var e,v={},i={};function a(e){var n=i[e];if(void 0!==n)return n.exports;var r=i[e]={exports:{}};return v[e](r,r.exports,a),r.exports}a.m=v,e=[],a.O=(n,r,u,l)=>{if(!r){var c=1/0;for(o=0;o=l)&&Object.keys(a.O).every(h=>a.O[h](r[f]))?r.splice(f--,1):(s=!1,l0&&e[o-1][2]>l;o--)e[o]=e[o-1];e[o]=[r,u,l]},a.d=(e,n)=>{for(var r in n)a.o(n,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},a.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),a.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={121:0};a.O.j=u=>0===e[u];var n=(u,l)=>{var f,t,[o,c,s]=l,d=0;if(o.some(_=>0!==e[_])){for(f in c)a.o(c,f)&&(a.m[f]=c[f]);if(s)var b=s(a)}for(u&&u(l);d{"use strict";var e,v={},i={};function a(e){var n=i[e];if(void 0!==n)return n.exports;var r=i[e]={exports:{}};return v[e].call(r.exports,r,r.exports,a),r.exports}a.m=v,e=[],a.O=(n,r,t,l)=>{if(!r){var c=1/0;for(o=0;o=l)&&Object.keys(a.O).every(p=>a.O[p](r[f]))?r.splice(f--,1):(s=!1,l0&&e[o-1][2]>l;o--)e[o]=e[o-1];e[o]=[r,t,l]},a.d=(e,n)=>{for(var r in n)a.o(n,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},a.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),a.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={121:0};a.O.j=t=>0===e[t];var n=(t,l)=>{var f,u,[o,c,s]=l,d=0;if(o.some(_=>0!==e[_])){for(f in c)a.o(c,f)&&(a.m[f]=c[f]);if(s)var b=s(a)}for(t&&t(l);d