JSON Viewer

格式化显示 JSON 使数据看起来更加漂亮。支持 JSON 主题色切换。支持 JSON 脑图,清晰明了的查看 JSON 层级。支持通过 JSON Crack 查看 JSON。支持手动输入 JSON,HTTP 请求获取 JSON

当前为 2024-11-12 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name JSON Viewer
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.0
  5. // @author Feny
  6. // @description 格式化显示 JSON 使数据看起来更加漂亮。支持 JSON 主题色切换。支持 JSON 脑图,清晰明了的查看 JSON 层级。支持通过 JSON Crack 查看 JSON。支持手动输入 JSON,HTTP 请求获取 JSON
  7. // @license MIT
  8. // @icon data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAeAB4AAD/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAEAAAAAAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAgACADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD9wvjF8bLX4ZrHZx+XNqlwnmKjH5YUyRvb6kEAd8H058d1b47XV5Ir3eoN++bagaXYrN6KOBn2FfPPx5/aEutX8a+KNWhIubhruZLSNj8u1WMcIOP4QoXOOwNS/wDBM79lDTfjh8YNe+IXj63TxRdeHfKjsE1KMTxtdSbmMmxvlAiVV2IBsUybgAyKR9ZTy6lhsM69Xovm2+iPmKmOqYjEKjT6v5WXU9e8beKrjxZpp/s/xFrfhjWIwWs9X0q42z2kmPlZo2zDcxjqYZ0eNv7obDDf/YL/AG8L745eJNc+G3xCttP0n4qeEWZZ2sVZNP8AENsu0rd2ysS0ZKPG7RMSQsisCcukWd+3x4RtfhpqGk+JNPjS0g1mV7a8iT5UM4XesgHYsofdjglQepJPxwPE1x4V/au8LePtNkeK40ma0lmdDgyorvHMhPo9uxjP+y1bUcHRxmGbS1adn1TXT0/4fcipiqmExCi3pfVdGn19f+GLni/w7ceGf2wPFXga+Vo5rW/vDbI3WWI/v4HA/wBqBg3tk+lfWX7AXia1+F/iDV9B1CRbWHXjFLayyHannpuUxk+rqy4zxlMdWAPQft7fsL33x91nQfiD4DutP0r4oeDXVrT7cWWx1y3UsTZ3LKCyAh5FEigkLLIpHzBk5vwj4JuvE2kLJfeHdY8N6lGAl5pepwBZrOT+JRIuYp0ByBNCzxPg4bIICqYyljMKot62Sa6prr6P/gBDC1MLiHJLS90+jT6ev/Dnmn/BVP8Aaw0nxv4/8P8Aw18KXK69qmk3MlxqEdiRMwuivlpbrtPLopkMnZNy5IIYLyPwa/Z8vvEmv+HtHu4/Ovr+5iS6KDcqAtukwe6om7nuEJxX0XoH7PK/bJG0vRoY5rr/AFslvbLGZf8AfcAf+PGvafgv8CbX4byNqFyI5tWmXYCoytsh6qvqx7t+A4yWiWYUsLhlRpbr72318kVHA1MTiHVqbP7kl0P/2Q==
  9. // @homepage https://github.com/xFeny/monkey-jsonviewer
  10. // @match *://*/*
  11. // @require https://unpkg.com/jsmind@0.8.5/es6/jsmind.js
  12. // @require data:application/javascript,%3Bwindow.jsmind%3DjsMind%3B
  13. // @require https://unpkg.com/dom-to-image@2
  14. // @require data:application/javascript,%3Bwindow.domtoimage%3Ddomtoimage%3B
  15. // @require https://unpkg.com/beautifier@0.1.7
  16. // @require data:application/javascript,%3Bwindow.beautifier%3Djs_beautify%3Bwindow.js_beautify%3Djs_beautify%3Bwindow.css_beautify%3Dcss_beautify%3B
  17. // @require https://unpkg.com/@highlightjs/cdn-assets@11.10.0/highlight.min.js
  18. // @require data:application/javascript,%3Bwindow.hljs%3Dhljs%3B
  19. // @require https://unpkg.com/systemjs@6.15.1/dist/system.min.js
  20. // @require https://unpkg.com/systemjs@6.15.1/dist/extras/named-register.min.js
  21. // @require data:application/javascript,%3B(typeof%20System!%3D'undefined')%26%26(System%3Dnew%20System.constructor())%3B
  22. // @grant GM_addStyle
  23. // @grant GM_getValue
  24. // @grant GM_openInTab
  25. // @grant GM_registerMenuCommand
  26. // @grant GM_setClipboard
  27. // @grant GM_setValue
  28. // @grant unsafeWindow
  29. // ==/UserScript==
  30.  
  31. (e=>{window.addEventListener("message",r=>{const{data:n}=r;if(!n?.addStyle)return;if(typeof GM_addStyle=="function"){GM_addStyle(e);return}const o=document.createElement("style");o.textContent=e,document.head.append(o)})})(` @charset "UTF-8";.monkey-jsonviewer body,.monkey-jsonviewer ul{margin:0;padding:0}.monkey-jsonviewer li::marker{content:""}.monkey-jsonviewer input:focus,.monkey-jsonviewer select:focus,.monkey-jsonviewer textarea:focus{outline:0}.monkey-jsonviewer a:hover{text-decoration:underline}.monkey-jsonviewer .jsonp{color:#93983a}.monkey-jsonviewer #jsoncrackEmbed{border:0;width:100%;height:100%}.monkey-jsonviewer .tippy-box[data-theme~=layer]{color:#fff;padding:5px;font-size:12px;line-height:20px;background-color:#2e59a7}.monkey-jsonviewer .tippy-box[data-theme~=layer] .tippy-arrow{color:#2e59a7}.monkey-jsonviewer .tippy-box[data-theme~=imagebox]{background-color:#d9d9d9}.monkey-jsonviewer .tippy-box[data-theme~=imagebox] .tippy-arrow{color:#d9d9d9}@media screen and (max-width: 640px){.monkey-jsonviewer .rightbox{right:0!important}.monkey-jsonviewer .rightbox .tools{display:none!important}}@media screen and (max-width: 400px){.monkey-jsonviewer .searchbox{display:none!important}}.monkey-jsonviewer .json-viewer-layout{top:0;left:0;z-index:10;width:100vw;height:100vh;display:flex;position:fixed;flex-direction:column}.monkey-jsonviewer .json-viewer-layout .panel{display:flex;line-height:28px;-webkit-user-select:none;user-select:none;flex-direction:column;background-color:#ececec}.monkey-jsonviewer .json-viewer-layout .tabs,.monkey-jsonviewer .json-viewer-layout .toolbar{display:flex;border-bottom:1px solid #ccc}.monkey-jsonviewer .json-viewer-layout .tabs>div,.monkey-jsonviewer .json-viewer-layout .toolbar>div{cursor:pointer;padding:0 10px;font-size:12px;transition:background-color .2s ease}.monkey-jsonviewer .json-viewer-layout .tabs>div:hover,.monkey-jsonviewer .json-viewer-layout .toolbar>div:hover{background-color:#d4d4d4}.monkey-jsonviewer .json-viewer-layout .tabs-item{border-top:3px solid #ececec}.monkey-jsonviewer .json-viewer-layout .tabs-item:hover{border-top-color:#c3c3c6}.monkey-jsonviewer .json-viewer-layout .tabs-item.active{color:#0060df;border-top-color:#0060df;background-color:#f1f1f1}.monkey-jsonviewer .json-viewer-layout .toolbar{line-height:23px}.monkey-jsonviewer .json-viewer-layout .toolbar .searchbox{padding:0;display:flex;flex-grow:1}.monkey-jsonviewer .json-viewer-layout .toolbar .searchbox:hover{background-color:transparent}.monkey-jsonviewer .json-viewer-layout .toolbar .searchbox input{flex-grow:1;border:none;outline:none;font-size:12px;padding-left:23px;border-left:1.5px solid #ccc;background-size:14px;background-repeat:no-repeat;background-position:7px center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAipJREFUWEftljuIE1EUhv8zpJB0FqugItiIdmKnnQ+wjPhq3EILRYt1JTDnDvhgUJG55zY+ELO7hRZupYWCCIK6nXYiNoqlrIUKaxes5siFBGKYSSbJTnaLTDMwl/Ofj8Pc/z+ENX5ojftjfQFYay8AuEFEU2VMRlV/A7hujGm09f+bgIj8APCtjOYdmjuZeWsewCMAZwBcYub7qwkiIjMA7gF4zMxnMwHiOK5Wq9UXAA6r6kljzLPVgLDWniCipwDeNJvNWhzHzUwA/zFJku1BEHiIPUS0PwzDD6NAOOf2qep7AJ/SNK1FUfS9Uy/zFojIXgAeYhsRbQ7D8NcwEM65Tar6E8AygBozf+zWyb2GSZIcCYLgORH9DcNw45AAf1R1Q5qmR6Moep2l0dMHrLWniegJgK/MvHsQCBH5AmCXqk4bYxbzavsakYjMArgD4B0zHyoCISJvARwEcJmZ7/aq6Qvgi0XkJoCrqrpgjDnfS9BaO09E5wDcYuZr/YALAbQgHgLwTpnrER13vcHMF/s19+eFAVoQS/7NzAeyxJ1zS6qaez7wT9hdICITgMkEJhOYTMCq6jEimmXmV90+UboRtdzQ7wZ+aW1UKpUr9Xp9pQ0yFoCuXFhW1agdt2MD8BDOOb83zgPYAWAxCILbqvqg1CzIChMRmQPgI3qFiD773Z+ZTxVJwoHTME9URI4TUV1VtwCYYeaXYwUo2mzkOB6l0dA7YRlNOzX/ATTlNjBwsoHnAAAAAElFTkSuQmCC)}.monkey-jsonviewer .json-viewer-layout .toolbar .searchbox .clear{flex:0 0 auto;align-self:center;margin:0 4px;padding:0;border:0;width:16px;height:16px;background-color:transparent;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAANZJREFUOE+t0zFKg0EQhuEndbpgIVZ26eIJFK1SeQcPYKuWmlJIb6lHkJRpFFKnE2zTpBAknaUgA/+Q5SfBwGaaZWfne3dmdraj0job9Ae4wwAn+MUcn3jCotS0Aad4RW9LYj+4xkuel4ArPO9Y0RlmEZuAY3ygi/cGct6Clf4V+vhOwCNuG0EEXuAB941v1OzfkOAxbhIwwWVxYwoCEhZrCQzfFMMELHHUSjkhCchsMuwLh3sDVJfwXxOj/ihpaxOrnzEaUzVI2dmqUU5I1Wfa8Susw/4A1fw8ES1B6icAAAAASUVORK5CYII=)}.monkey-jsonviewer .json-viewer-layout .rightbox{right:200px;display:flex;font-size:12px;position:absolute}.monkey-jsonviewer .json-viewer-layout .rightbox>div{padding:0 5px;margin-top:2px}.monkey-jsonviewer .json-viewer-layout .rightbox>div span{cursor:pointer;display:inline;padding:5px 10px;border-radius:3px;transition:background-color .2s ease}.monkey-jsonviewer .json-viewer-layout .rightbox>div span:hover{background-color:#ccc}.monkey-jsonviewer .json-viewer-layout .rightbox>div span:after{content:"";width:0;height:0;right:-5px;position:relative;border-style:solid;display:inline-block;vertical-align:middle;border-width:7px 5px 0 5px;border-color:#999 transparent transparent transparent;transform:rotate(0);transition:transform .3s ease}.monkey-jsonviewer .json-viewer-layout .rightbox>div span.active:after{transform:rotate(180deg)}.monkey-jsonviewer .json-viewer-layout .rightbox>div ul{color:#333;cursor:pointer;text-align:center;border-radius:3px}.monkey-jsonviewer .json-viewer-layout .rightbox>div ul li{font-size:12px;padding:5px 20px;background-color:#dfdfdf;transition:background-color .2s ease}.monkey-jsonviewer .json-viewer-layout .rightbox>div ul li:hover{border-radius:3px;background-color:#ccc}.monkey-jsonviewer .json-viewer-layout .rightbox>div ul li.active:before{left:15px;content:"\u221A";display:inline;position:absolute}.monkey-jsonviewer .json-viewer-layout .rightbox>div .tippy-box{background-color:#dfdfdf!important}.monkey-jsonviewer .json-viewer-layout .rightbox>div .tippy-box .tippy-content{padding:5px}.monkey-jsonviewer .json-viewer-layout .rightbox>div .tippy-box .tippy-arrow{color:#dfdfdf!important}.monkey-jsonviewer .json-viewer-layout .container{flex-grow:1;overflow:auto;line-height:1.4;font-size:13.5px;font-family:monospace}.monkey-jsonviewer .json-viewer-layout .container>div{display:none}.monkey-jsonviewer .json-viewer-layout .container>div.active{display:block}.monkey-jsonviewer .json-viewer-layout .container #formatBox{padding:5px 8px}.monkey-jsonviewer .json-viewer-layout .container #rawTextBox{font-size:13px;padding:5px 8px}.monkey-jsonviewer .json-viewer-layout .container #rawTextBox pre{margin:0;padding:0;white-space:pre-wrap;overflow-wrap:break-word}.monkey-jsonviewer .json-viewer-layout #mindBox{width:100vw;height:calc(100vh - 57px)}.monkey-jsonviewer .json-viewer-layout #mindBox jmnode{display:flex;align-items:center;padding:0 7px 0 22px;color:#475872!important;box-shadow:none!important;background-color:transparent!important}.monkey-jsonviewer .json-viewer-layout #mindBox jmnode.root{padding:0;color:transparent!important}.monkey-jsonviewer .json-viewer-layout #mindBox jmnode:before{content:"";top:50%!important;margin-top:1px;position:absolute;border-radius:50%;transform:translateY(-50%);background-color:#8149bf80}.monkey-jsonviewer .json-viewer-layout #mindBox jmnode.root:before{left:50%;width:18px;height:18px;transform:translate(-18px,-50%)}.monkey-jsonviewer .json-viewer-layout #mindBox jmnode:hover{text-shadow:0px 0px 1px currentColor}.monkey-jsonviewer .json-viewer-layout #mindBox jmnode:not(.root):before{left:0;width:15px;height:15px}.monkey-jsonviewer .json-viewer-layout #mindBox jmexpander{margin-top:1px;line-height:9px}.monkey-jsonviewer .json-viewer-layout #mindBox .datatype{opacity:.6;font-size:12px;margin-top:2px;padding-left:5px}.monkey-jsonviewer .httpRequest{padding:30px 20px;width:700px}.monkey-jsonviewer .httpRequest>div{display:flex;height:35px;margin-bottom:20px}.monkey-jsonviewer .httpRequest input,.monkey-jsonviewer .httpRequest select{border-radius:0;padding-left:10px;border:1px solid #ccc}.monkey-jsonviewer .httpRequest input{flex-grow:1}.monkey-jsonviewer .httpRequest input[name=url],.monkey-jsonviewer .httpRequest input:first-child,.monkey-jsonviewer .httpRequest select{border-right:none}.monkey-jsonviewer .httpRequest button{cursor:pointer;padding:0 15px;border:1px solid #ccc}.monkey-jsonviewer .httpRequest button:active{background-color:#cfcfcf}.monkey-jsonviewer .dark-theme .json-viewer-layout li,.monkey-jsonviewer .dark-theme .json-viewer-layout pre,.monkey-jsonviewer .dark-theme .json-viewer-layout td:first-child,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout li,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout pre,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout td:first-child{color:#ccc}.monkey-jsonviewer .dark-theme .json-viewer-layout .panel,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .panel{color:#c4c4c4;background-color:#333}.monkey-jsonviewer .dark-theme .json-viewer-layout .panel>div,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .panel>div{border-bottom-color:#464646}.monkey-jsonviewer .dark-theme .json-viewer-layout .panel .tabs-item:hover,.monkey-jsonviewer .dark-theme .json-viewer-layout .panel .toolbar-item:hover,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .panel .tabs-item:hover,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .panel .toolbar-item:hover{background-color:#464646}.monkey-jsonviewer .dark-theme .json-viewer-layout .panel .tabs-item,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .panel .tabs-item{border-top-color:#333}.monkey-jsonviewer .dark-theme .json-viewer-layout .panel .tabs-item:hover,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .panel .tabs-item:hover{border-top-color:#c3c3c6}.monkey-jsonviewer .dark-theme .json-viewer-layout .panel .tabs-item.active,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .panel .tabs-item.active{color:#c4c4c4;border-top-color:#64b7ff;background-color:#464646}.monkey-jsonviewer .dark-theme .json-viewer-layout .searchbox input,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .searchbox input{color:#ccc;background-color:#464646;border-left-color:#333}.monkey-jsonviewer .dark-theme .json-viewer-layout .searchbox .clear,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .searchbox .clear{filter:invert(.8)}.monkey-jsonviewer .dark-theme .json-viewer-layout .rightbox>div span:hover,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .rightbox>div span:hover{background-color:#464646}.monkey-jsonviewer .dark-theme .json-viewer-layout .rightbox .tippy-box,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .rightbox .tippy-box{background-color:#4e4e4e!important}.monkey-jsonviewer .dark-theme .json-viewer-layout .rightbox .tippy-box .tippy-arrow,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .rightbox .tippy-box .tippy-arrow{color:#4e4e4e!important}.monkey-jsonviewer .dark-theme .json-viewer-layout .rightbox .tippy-box li,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .rightbox .tippy-box li{background-color:#4e4e4e!important}.monkey-jsonviewer .dark-theme .json-viewer-layout .rightbox .tippy-box li:hover,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .rightbox .tippy-box li:hover{background-color:#464646!important}.monkey-jsonviewer .dark-theme .json-viewer-layout .jsonp,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout .jsonp{color:#f1d700}.monkey-jsonviewer .dark-theme .json-viewer-layout jmnode,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout jmnode{filter:brightness(2)}.monkey-jsonviewer .dark-theme .json-viewer-layout jmexpander,.monkey-jsonviewer .dark-plus-theme .json-viewer-layout jmexpander{background-color:#dfdfdf}.js-mind-child-node{width:300px;height:300px;margin:10px;overflow-y:scroll;position:relative;padding:5px 20px;background-color:#f8f9fa}.js-mind-child-node div{color:#475872;line-height:25px}.js-mind-copy{top:5px;right:10px;width:20px;height:20px;cursor:pointer;position:absolute;background-size:20px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAYRJREFUWEftlzFOw0AQRefbF+EMVJFA1kzcUNGRW8ABkFBASBQgUZAiLSUiHb29W1DTQUFFzxFQvGglO8JW1uuElQIGl8545/n/0eQbtOELG+5PNYA8z28AHIaAMsZMhsPhke+sBYDW+mE+nz9FUaR9D3X5vSgKjuN4m5n32+oXAEopQ0QiIkEAlFJMREpEWm3uP0BD/ndjzAzArFLaq0Appdf2pnWVBdbWLw9vEdEYwJSZL+39VoA8z3cAPHq7Ez3HcTxKkuSlqnXNQJZlp1EU7YnIwAvQobGzxAXQvO+1YF2I/gBYz7qokKZprS6YAhsH6PL2y2qCKfC3AbTWB8aY+y4qABgx88y3iFbeA99dxc1/w5UBurz9/xD2Q4EqEzZX6rozYDfoskzYNoS7RHRORDbLhbhstjwRkVqecAI4fFREdBYqqNoevw7gCsAHMx+H8MSe4YxkDgsGAC6KorgD8BoAogql18w8qWVC1+GlZ+NAw/lWztRt1e9nfZwGkHjlIz4Bw1VmMCtaHCkAAAAASUVORK5CYII=)}.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}.monkey-js-css-beautify body{padding-top:20px;padding-left:5px}.monkey-js-css-beautify body .beautify_checkbox{top:0;left:0;z-index:999;width:100vw;display:flex;position:fixed;padding:5px 10px;-webkit-user-select:none;user-select:none;align-items:center;background-color:#f3f3f3;border-bottom:1px solid #ccc}.monkey-js-css-beautify body .beautify_checkbox label{font-size:13px}.monkey-js-css-beautify body .beautify_checkbox input[type=checkbox]{top:1.5px;width:14px;height:14px;margin-right:5px;position:relative}.format-container{flex-grow:1}pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{background:#fff;color:#000}.xml .hljs-meta{color:silver}.hljs-comment,.hljs-quote{color:#007400}.hljs-attribute,.hljs-keyword,.hljs-literal,.hljs-name,.hljs-selector-tag,.hljs-tag{color:#aa0d91}.hljs-template-variable,.hljs-variable{color:#3f6e74}.hljs-code,.hljs-meta .hljs-string,.hljs-string{color:#c41a16}.hljs-link,.hljs-regexp{color:#0e0eff}.hljs-bullet,.hljs-number,.hljs-symbol,.hljs-title{color:#1c00cf}.hljs-meta,.hljs-section{color:#643820}.hljs-built_in,.hljs-class .hljs-title,.hljs-params,.hljs-title.class_,.hljs-type{color:#5c2699}.hljs-attr{color:#836c28}.hljs-subst{color:#000}.hljs-formula{background-color:#eee;font-style:italic}.hljs-addition{background-color:#baeeba}.hljs-deletion{background-color:#ffc8bd}.hljs-selector-class,.hljs-selector-id{color:#9b703f}.hljs-doctag,.hljs-strong{font-weight:700}.hljs-emphasis{font-style:italic}div.json-formater-item{border-left:.5px dotted #d9d9d9}.json-formater-copy{width:13px;height:13px;cursor:pointer;margin-left:.15em;display:inline-block;background-size:13px;vertical-align:text-bottom;background-repeat:no-repeat;transition:background-image ease .3s;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAYRJREFUWEftlzFOw0AQRefbF+EMVJFA1kzcUNGRW8ABkFBASBQgUZAiLSUiHb29W1DTQUFFzxFQvGglO8JW1uuElQIGl8545/n/0eQbtOELG+5PNYA8z28AHIaAMsZMhsPhke+sBYDW+mE+nz9FUaR9D3X5vSgKjuN4m5n32+oXAEopQ0QiIkEAlFJMREpEWm3uP0BD/ndjzAzArFLaq0Appdf2pnWVBdbWLw9vEdEYwJSZL+39VoA8z3cAPHq7Ez3HcTxKkuSlqnXNQJZlp1EU7YnIwAvQobGzxAXQvO+1YF2I/gBYz7qokKZprS6YAhsH6PL2y2qCKfC3AbTWB8aY+y4qABgx88y3iFbeA99dxc1/w5UBurz9/xD2Q4EqEzZX6rozYDfoskzYNoS7RHRORDbLhbhstjwRkVqecAI4fFREdBYqqNoevw7gCsAHMx+H8MSe4YxkDgsGAC6KorgD8BoAogql18w8qWVC1+GlZ+NAw/lWztRt1e9nfZwGkHjlIz4Bw1VmMCtaHCkAAAAASUVORK5CYII=)}.json-formater-copy.success{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAhZJREFUWEftlU1IFGEYx//Pu2R0kLrYwUMg7M5EHjwklNUOLoInxYMg7W6HTkEIgkLMLF6CsllDokN4Vfy4SnSqk+7sRghBFBT7IWKHQATFSxCLM09sabjjO/thLnuZ9zjPx//3/t9n3pfQ5EVN1ocP4DvgO9AwB/RMsJNYjAF4wEwz01rukeyXbwjAZEbttpmXAKhHokQ8bN4prLghzhwgkVHCzLQE8JUyMeblpFa411AAIxXshxCLAC6fFOKbZriw3jAA3VKHiLgk3uoS+UWMqKnlX9c8AwkreA0i0GM7vFu0i2svI1v7ld4M3VLuEmEBwLnjeQTsMyiaDOfeetVLZ8BIhz4CdP2w6CuxM2JqG99kTYz3oftwaE4S23Zsij3vza1Wgj8BYKSDvYBwF0khdEt9SMSzEoHvJETUvJ39UO219XBA2QHQ5iougzAsZRyEFxKBHAJONHlr41M18VLc6wgmAXoqafAHgoUYAuOZJP6Z2Il5HVfNQ1hK1NPKKAGvZBAAOiXf1wGOJcOFzVp2/u+CqpRsZNQ4/t5oVRalAkWOT/Xlf1TLrPseSKRDAw7TIhEuyS3kd2gJxM0b2d16xT1nwN1IT4U0IWiegY6yGPObg4sXYjNdX36eRrxmgMOZ6CLQE4AHGdgTjOXzdvvE48jawWnF6wI4EkmsKlfNSD77P6LHa8/8NawXzAfwHfAdaLoDvwHyYK0h/tY7mwAAAABJRU5ErkJggg==)}.json-formater-arrow{width:0;opacity:.2;display:inline-block}.json-formater-arrow:hover{opacity:.35}.json-formater-arrow:before{width:0;height:0;left:-13px;content:"";cursor:pointer;position:relative;border-style:solid;display:inline-block;vertical-align:middle;transform:rotate(90deg);border-width:5px 0 5px 8px;transition:transform .3s ease;border-color:transparent transparent transparent currentColor}.json-formater-closed .json-formater-arrow:before{transform:rotate(0)}.json-formater-placeholder{color:#ccc;cursor:pointer;font-size:12px;-webkit-user-select:none;user-select:none;margin-left:.3em}.json-formater-placeholder span{margin:0 .5em}.json-formater-placeholder span:hover{text-decoration:underline}.json-color{width:.7em;height:.7em;margin-right:.3em;display:inline-block;vertical-align:middle;border:1px solid #ccc}.json-key{cursor:pointer}.json-comma{margin-left:.15em;font-family:Courier New,monospace}.json-colon{margin:0 .3em 0 .15em}.json-object-bracket{color:#6d9331;font-weight:700}.json-array-bracket{color:#8e9331;font-weight:700}.default-theme{background-color:#fefefe}.default-theme .json-key{color:#910f93}.default-theme .json-string,.default-theme .json-string a{color:#2e7c16}.default-theme .json-bigint,.default-theme .json-number{color:#164ff1}.default-theme .json-boolean{color:#c41a16}.default-theme .json-null{color:#228fec}.light-theme{background-color:#fefefe}.light-theme .json-key{color:#0040cf}.light-theme .json-string,.light-theme .json-string a{color:#a31515}.light-theme .json-bigint,.light-theme .json-number{color:#0b7500}.light-theme .json-boolean{color:#00f}.light-theme .json-null{color:#05f}.dark-theme div.json-formater-item,.dark-plus-theme div.json-formater-item{border-left-color:#3a3d40}.dark-theme .json-colon,.dark-theme .json-comma,.dark-plus-theme .json-colon,.dark-plus-theme .json-comma{color:#ccc}.dark-theme .json-formater-arrow,.dark-plus-theme .json-formater-arrow{color:#fff;opacity:.35}.dark-theme .json-formater-arrow:hover,.dark-plus-theme .json-formater-arrow:hover{opacity:.5}.dark-theme{background-color:#252526}.dark-theme .json-object-bracket{color:#ce70d6}.dark-theme .json-array-bracket{color:#f1d700}.dark-theme .json-key{color:#9cdcfe}.dark-theme .json-string,.dark-theme .json-string a{color:#ce9178}.dark-theme .json-bigint,.dark-theme .json-number{color:#b5cea8}.dark-theme .json-boolean{color:#358cd6}.dark-theme .json-null{color:#569cd6}.dark-plus-theme{background-color:#1e1f22}.dark-plus-theme .json-object-bracket{color:#bb9667}.dark-plus-theme .json-array-bracket{color:#bbbda3}.dark-plus-theme .json-key{color:#c77dbb}.dark-plus-theme .json-string,.dark-plus-theme .json-string a{color:#6aab73}.dark-plus-theme .json-bigint,.dark-plus-theme .json-number{color:#28aab4}.dark-plus-theme .json-boolean{color:#ce8951}.dark-plus-theme .json-null{color:#c78d61}/**
  32. * @license BSD
  33. * @copyright 2014-2023 hizzgdev@163.com
  34. *
  35. * Project Home:
  36. * https://github.com/hizzgdev/jsmind/
  37. */.jsmind-inner{position:relative;overflow:auto;width:100%;height:100%;outline:none}.jsmind-inner{moz-user-select:-moz-none;-moz-user-select:none;-o-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.jsmind-inner canvas{position:absolute}svg.jsmind{position:absolute;z-index:1}canvas.jsmind{position:absolute;z-index:1}jmnodes{position:absolute;z-index:2;background-color:#0000}jmnode{position:absolute;cursor:default;max-width:400px}jmexpander{position:absolute;width:11px;height:11px;display:block;overflow:hidden;line-height:12px;font-size:10px;text-align:center;border-radius:6px;border-width:1px;border-style:solid;cursor:pointer}.jmnode-overflow-wrap jmnodes{min-width:420px}.jmnode-overflow-hidden jmnode{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}jmnode{padding:10px;background-color:#fff;color:#333;border-radius:5px;box-shadow:1px 1px 1px #666;font:16px/1.125 Verdana,Arial,Helvetica,sans-serif}jmnode:hover{box-shadow:2px 2px 8px #000;background-color:#ebebeb;color:#333}jmnode.selected{background-color:#11f;color:#fff;box-shadow:2px 2px 8px #000}jmnode.root{font-size:24px}jmexpander{border-color:gray}jmexpander:hover{border-color:#000}@media screen and (max-device-width: 1024px){jmnode{padding:5px;border-radius:3px;font-size:14px}jmnode.root{font-size:21px}}jmnodes.theme-primary jmnode{background-color:#428bca;color:#fff;border-color:#357ebd}jmnodes.theme-primary jmnode:hover{background-color:#3276b1;border-color:#285e8e}jmnodes.theme-primary jmnode.selected{background-color:#f1c40f;color:#fff}jmnodes.theme-warning jmnode{background-color:#f0ad4e;border-color:#eea236;color:#fff}jmnodes.theme-warning jmnode:hover{background-color:#ed9c28;border-color:#d58512}jmnodes.theme-warning jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-danger jmnode{background-color:#d9534f;border-color:#d43f3a;color:#fff}jmnodes.theme-danger jmnode:hover{background-color:#d2322d;border-color:#ac2925}jmnodes.theme-danger jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-success jmnode{background-color:#5cb85c;border-color:#4cae4c;color:#fff}jmnodes.theme-success jmnode:hover{background-color:#47a447;border-color:#398439}jmnodes.theme-success jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-info jmnode{background-color:#5dc0de;border-color:#46b8da;color:#fff}jmnodes.theme-info jmnode:hover{background-color:#39b3d7;border-color:#269abc}jmnodes.theme-info jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-greensea jmnode{background-color:#1abc9c;color:#fff}jmnodes.theme-greensea jmnode:hover{background-color:#16a085}jmnodes.theme-greensea jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-nephrite jmnode{background-color:#2ecc71;color:#fff}jmnodes.theme-nephrite jmnode:hover{background-color:#27ae60}jmnodes.theme-nephrite jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-belizehole jmnode{background-color:#3498db;color:#fff}jmnodes.theme-belizehole jmnode:hover{background-color:#2980b9}jmnodes.theme-belizehole jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-wisteria jmnode{background-color:#9b59b6;color:#fff}jmnodes.theme-wisteria jmnode:hover{background-color:#8e44ad}jmnodes.theme-wisteria jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-asphalt jmnode{background-color:#34495e;color:#fff}jmnodes.theme-asphalt jmnode:hover{background-color:#2c3e50}jmnodes.theme-asphalt jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-orange jmnode{background-color:#f1c40f;color:#fff}jmnodes.theme-orange jmnode:hover{background-color:#f39c12}jmnodes.theme-orange jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-pumpkin jmnode{background-color:#e67e22;color:#fff}jmnodes.theme-pumpkin jmnode:hover{background-color:#d35400}jmnodes.theme-pumpkin jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-pomegranate jmnode{background-color:#e74c3c;color:#fff}jmnodes.theme-pomegranate jmnode:hover{background-color:#c0392b}jmnodes.theme-pomegranate jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-clouds jmnode{background-color:#ecf0f1;color:#333}jmnodes.theme-clouds jmnode:hover{background-color:#bdc3c7}jmnodes.theme-clouds jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-asbestos jmnode{background-color:#95a5a6;color:#fff}jmnodes.theme-asbestos jmnode:hover{background-color:#7f8c8d}jmnodes.theme-asbestos jmnode.selected{background-color:#11f;color:#fff}.scroll-top{width:48px;height:48px;z-index:999;position:fixed;right:30px;bottom:30px;display:none;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA39JREFUaEPtmV2ITVEUx39rJjT5KPKC5DPKK6UGZZ7Eq0whNUiKFPfcKW9mnmjm7ssLaSLygEx5xItMESnKC4V8FV4IJUkyS+fMHZ07zjl3733PvT6a+3S6Z629/r+99sfa+wgpPw1YDtxLe9/k/1eI4X5STMkSokXWNlloYjgpMZSmIxPgbxBfS8M4QK0eavT78Qw0uodrtd+wDGjAMqBcEVAQw6NaYnzeNwRAi2xBOQlMrYj6jLJTygz6iMzyyR1Ai+xCGUgMqnTmDZErgBYoIJjMXhY2S4mLeWUiNwAt0INwyEqY0iNleq1saxjlAqAB64BrToKEHVLijJNPgnHdALqPaUziOsoKRzGfaKFD+nng6FdlXj+Ay9AZq1Q5L2W2/jEA3c8sWqOSe3aCiK/A3cr/K4G2FKEbxXDZF6KuDKROXKWXFvqlxJdQmBaZzDDdKZP8thhW/RmAgKfA4qrgSq+U6UkSlAostEuJOz4Q3hnQgPXAld+CCh1pB5DogKTcSBAalhpHmw1wGtgxJuhbMczJEqIBbxLmzFUxbGg2gCYE9AVADF6jwctJDzKd73xI7DG/IQQTmCFH+OiaBT+AAyykhWcpBZv7JA4bGmaRHOV5cwBqX7mc5Qe9coyX0TK6n/m0RnVSV4bA1KuTLCi/DBTYhHCpRm+Fe8Bo/b8JmJxp71lqOwNowB7guGuqLe33iuGEpW1k5gTgVDK7qIjbZmyESU1aA1TOuA99dTn5CQulxAsbH3uAeqpOGyXVNrvEcMrGzR4gIGnjsonhYzMkhg4bx3EAm17ysGlIBh4DSzzE+LgMiGG3jaPLEApv2Q7YNFq3jcOmZg9gt/u6aH8PzEx0aGWu9PHapjFrgKimCaIDTHiQqf4pNxHW2AT8ZaMEiZdgSreUKdm25QRQgRi7nIZzI7xZcPmeNkAL5xjmVpVQx1049HUGiCAKFBH6K8GjFUP3MIW2CGJpjd4bFEPnmM54grA761tYWpteAJXgy1A6w6p09Opcu1nED7ZlAcQP/BqwGZjORAblMO9sh03czhsgLZgW6EL4JoYL0b0RTArPBfFnH6G5ZyAVYKTkGBlWQVR2bxDDgvjzvwQQXqGsDQ/sGkTXKdHzOECsB3LtjdjKMjqE/qMMjJwn5olh+98+hM6gvAqXy0aN+4Yuo/HG/weAPmC1GNrzHDbxtn4Coc0pQNdM3UAAAAAASUVORK5CYII=)} `);
  38.  
  39. System.addImportMap({ imports: {"highlight.js":"user:highlight.js","beautifier":"user:beautifier","jsmind":"user:jsmind","dom-to-image":"user:dom-to-image"} });
  40. System.set("user:highlight.js", (()=>{const _=hljs;('default' in _)||(_.default=_);return _})());
  41. System.set("user:beautifier", (()=>{const _=beautifier;('default' in _)||(_.default=_);return _})());
  42. System.set("user:jsmind", (()=>{const _=jsmind;('default' in _)||(_.default=_);return _})());
  43. System.set("user:dom-to-image", (()=>{const _=domtoimage;('default' in _)||(_.default=_);return _})());
  44.  
  45. System.register("./__entry.js", ['./__monkey.entry-BOyf9HZs.js'], (function (exports, module) {
  46. 'use strict';
  47. return {
  48. setters: [null],
  49. execute: (function () {
  50.  
  51.  
  52.  
  53. })
  54. };
  55. }));
  56.  
  57. System.register("./__monkey.entry-BOyf9HZs.js", [], (function (exports, module) {
  58. 'use strict';
  59. return {
  60. execute: (function () {
  61.  
  62. const scriptRel = function detectScriptRel() {
  63. const relList = typeof document !== "undefined" && document.createElement("link").relList;
  64. return relList && relList.supports && relList.supports("modulepreload") ? "modulepreload" : "preload";
  65. }();
  66. const assetsURL = function(dep) {
  67. return "/" + dep;
  68. };
  69. const seen = {};
  70. const __vitePreload = function preload(baseModule, deps, importerUrl) {
  71. let promise = Promise.resolve();
  72. if (deps && deps.length > 0) {
  73. document.getElementsByTagName("link");
  74. const cspNonceMeta = document.querySelector(
  75. "meta[property=csp-nonce]"
  76. );
  77. const cspNonce = (cspNonceMeta == null ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta == null ? void 0 : cspNonceMeta.getAttribute("nonce"));
  78. promise = Promise.allSettled(
  79. deps.map((dep) => {
  80. dep = assetsURL(dep);
  81. if (dep in seen) return;
  82. seen[dep] = true;
  83. const isCss = dep.endsWith(".css");
  84. const cssSelector = isCss ? '[rel="stylesheet"]' : "";
  85. if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) {
  86. return;
  87. }
  88. const link = document.createElement("link");
  89. link.rel = isCss ? "stylesheet" : scriptRel;
  90. if (!isCss) {
  91. link.as = "script";
  92. }
  93. link.crossOrigin = "";
  94. link.href = dep;
  95. if (cspNonce) {
  96. link.setAttribute("nonce", cspNonce);
  97. }
  98. document.head.appendChild(link);
  99. if (isCss) {
  100. return new Promise((res, rej) => {
  101. link.addEventListener("load", res);
  102. link.addEventListener(
  103. "error",
  104. () => rej(new Error(`Unable to preload CSS for ${dep}`))
  105. );
  106. });
  107. }
  108. })
  109. );
  110. }
  111. function handlePreloadError(err) {
  112. const e = new Event("vite:preloadError", {
  113. cancelable: true
  114. });
  115. e.payload = err;
  116. window.dispatchEvent(e);
  117. if (!e.defaultPrevented) {
  118. throw err;
  119. }
  120. }
  121. return promise.then((res) => {
  122. for (const item of res || []) {
  123. if (item.status !== "rejected") continue;
  124. handlePreloadError(item.reason);
  125. }
  126. return baseModule().catch(handlePreloadError);
  127. });
  128. };
  129. var commonjsGlobal = exports("d", typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {});
  130. function getDefaultExportFromCjs(x) {
  131. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
  132. }
  133. var jsonBigint = { exports: {} };
  134. var stringify = { exports: {} };
  135. var bignumber = { exports: {} };
  136. (function(module) {
  137. (function(globalObject) {
  138. var BigNumber2, isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE = 1e14, LOG_BASE = 14, MAX_SAFE_INTEGER = 9007199254740991, POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], SQRT_BASE = 1e7, MAX = 1e9;
  139. function clone(configObject) {
  140. var div, convertBase, parseNumeric, P = BigNumber3.prototype = { constructor: BigNumber3, toString: null, valueOf: null }, ONE = new BigNumber3(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
  141. prefix: "",
  142. groupSize: 3,
  143. secondaryGroupSize: 0,
  144. groupSeparator: ",",
  145. decimalSeparator: ".",
  146. fractionGroupSize: 0,
  147. fractionGroupSeparator: " ",
  148. // non-breaking space
  149. suffix: ""
  150. }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
  151. function BigNumber3(v, b) {
  152. var alphabet, c, caseChanged, e, i, isNum, len, str, x = this;
  153. if (!(x instanceof BigNumber3)) return new BigNumber3(v, b);
  154. if (b == null) {
  155. if (v && v._isBigNumber === true) {
  156. x.s = v.s;
  157. if (!v.c || v.e > MAX_EXP) {
  158. x.c = x.e = null;
  159. } else if (v.e < MIN_EXP) {
  160. x.c = [x.e = 0];
  161. } else {
  162. x.e = v.e;
  163. x.c = v.c.slice();
  164. }
  165. return;
  166. }
  167. if ((isNum = typeof v == "number") && v * 0 == 0) {
  168. x.s = 1 / v < 0 ? (v = -v, -1) : 1;
  169. if (v === ~~v) {
  170. for (e = 0, i = v; i >= 10; i /= 10, e++) ;
  171. if (e > MAX_EXP) {
  172. x.c = x.e = null;
  173. } else {
  174. x.e = e;
  175. x.c = [v];
  176. }
  177. return;
  178. }
  179. str = String(v);
  180. } else {
  181. if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);
  182. x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
  183. }
  184. if ((e = str.indexOf(".")) > -1) str = str.replace(".", "");
  185. if ((i = str.search(/e/i)) > 0) {
  186. if (e < 0) e = i;
  187. e += +str.slice(i + 1);
  188. str = str.substring(0, i);
  189. } else if (e < 0) {
  190. e = str.length;
  191. }
  192. } else {
  193. intCheck(b, 2, ALPHABET.length, "Base");
  194. if (b == 10 && alphabetHasNormalDecimalDigits) {
  195. x = new BigNumber3(v);
  196. return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);
  197. }
  198. str = String(v);
  199. if (isNum = typeof v == "number") {
  200. if (v * 0 != 0) return parseNumeric(x, str, isNum, b);
  201. x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;
  202. if (BigNumber3.DEBUG && str.replace(/^0\.0*|\./, "").length > 15) {
  203. throw Error(tooManyDigits + v);
  204. }
  205. } else {
  206. x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
  207. }
  208. alphabet = ALPHABET.slice(0, b);
  209. e = i = 0;
  210. for (len = str.length; i < len; i++) {
  211. if (alphabet.indexOf(c = str.charAt(i)) < 0) {
  212. if (c == ".") {
  213. if (i > e) {
  214. e = len;
  215. continue;
  216. }
  217. } else if (!caseChanged) {
  218. if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) {
  219. caseChanged = true;
  220. i = -1;
  221. e = 0;
  222. continue;
  223. }
  224. }
  225. return parseNumeric(x, String(v), isNum, b);
  226. }
  227. }
  228. isNum = false;
  229. str = convertBase(str, b, 10, x.s);
  230. if ((e = str.indexOf(".")) > -1) str = str.replace(".", "");
  231. else e = str.length;
  232. }
  233. for (i = 0; str.charCodeAt(i) === 48; i++) ;
  234. for (len = str.length; str.charCodeAt(--len) === 48; ) ;
  235. if (str = str.slice(i, ++len)) {
  236. len -= i;
  237. if (isNum && BigNumber3.DEBUG && len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {
  238. throw Error(tooManyDigits + x.s * v);
  239. }
  240. if ((e = e - i - 1) > MAX_EXP) {
  241. x.c = x.e = null;
  242. } else if (e < MIN_EXP) {
  243. x.c = [x.e = 0];
  244. } else {
  245. x.e = e;
  246. x.c = [];
  247. i = (e + 1) % LOG_BASE;
  248. if (e < 0) i += LOG_BASE;
  249. if (i < len) {
  250. if (i) x.c.push(+str.slice(0, i));
  251. for (len -= LOG_BASE; i < len; ) {
  252. x.c.push(+str.slice(i, i += LOG_BASE));
  253. }
  254. i = LOG_BASE - (str = str.slice(i)).length;
  255. } else {
  256. i -= len;
  257. }
  258. for (; i--; str += "0") ;
  259. x.c.push(+str);
  260. }
  261. } else {
  262. x.c = [x.e = 0];
  263. }
  264. }
  265. BigNumber3.clone = clone;
  266. BigNumber3.ROUND_UP = 0;
  267. BigNumber3.ROUND_DOWN = 1;
  268. BigNumber3.ROUND_CEIL = 2;
  269. BigNumber3.ROUND_FLOOR = 3;
  270. BigNumber3.ROUND_HALF_UP = 4;
  271. BigNumber3.ROUND_HALF_DOWN = 5;
  272. BigNumber3.ROUND_HALF_EVEN = 6;
  273. BigNumber3.ROUND_HALF_CEIL = 7;
  274. BigNumber3.ROUND_HALF_FLOOR = 8;
  275. BigNumber3.EUCLID = 9;
  276. BigNumber3.config = BigNumber3.set = function(obj) {
  277. var p, v;
  278. if (obj != null) {
  279. if (typeof obj == "object") {
  280. if (obj.hasOwnProperty(p = "DECIMAL_PLACES")) {
  281. v = obj[p];
  282. intCheck(v, 0, MAX, p);
  283. DECIMAL_PLACES = v;
  284. }
  285. if (obj.hasOwnProperty(p = "ROUNDING_MODE")) {
  286. v = obj[p];
  287. intCheck(v, 0, 8, p);
  288. ROUNDING_MODE = v;
  289. }
  290. if (obj.hasOwnProperty(p = "EXPONENTIAL_AT")) {
  291. v = obj[p];
  292. if (v && v.pop) {
  293. intCheck(v[0], -MAX, 0, p);
  294. intCheck(v[1], 0, MAX, p);
  295. TO_EXP_NEG = v[0];
  296. TO_EXP_POS = v[1];
  297. } else {
  298. intCheck(v, -MAX, MAX, p);
  299. TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);
  300. }
  301. }
  302. if (obj.hasOwnProperty(p = "RANGE")) {
  303. v = obj[p];
  304. if (v && v.pop) {
  305. intCheck(v[0], -MAX, -1, p);
  306. intCheck(v[1], 1, MAX, p);
  307. MIN_EXP = v[0];
  308. MAX_EXP = v[1];
  309. } else {
  310. intCheck(v, -MAX, MAX, p);
  311. if (v) {
  312. MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);
  313. } else {
  314. throw Error(bignumberError + p + " cannot be zero: " + v);
  315. }
  316. }
  317. }
  318. if (obj.hasOwnProperty(p = "CRYPTO")) {
  319. v = obj[p];
  320. if (v === !!v) {
  321. if (v) {
  322. if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
  323. CRYPTO = v;
  324. } else {
  325. CRYPTO = !v;
  326. throw Error(bignumberError + "crypto unavailable");
  327. }
  328. } else {
  329. CRYPTO = v;
  330. }
  331. } else {
  332. throw Error(bignumberError + p + " not true or false: " + v);
  333. }
  334. }
  335. if (obj.hasOwnProperty(p = "MODULO_MODE")) {
  336. v = obj[p];
  337. intCheck(v, 0, 9, p);
  338. MODULO_MODE = v;
  339. }
  340. if (obj.hasOwnProperty(p = "POW_PRECISION")) {
  341. v = obj[p];
  342. intCheck(v, 0, MAX, p);
  343. POW_PRECISION = v;
  344. }
  345. if (obj.hasOwnProperty(p = "FORMAT")) {
  346. v = obj[p];
  347. if (typeof v == "object") FORMAT = v;
  348. else throw Error(bignumberError + p + " not an object: " + v);
  349. }
  350. if (obj.hasOwnProperty(p = "ALPHABET")) {
  351. v = obj[p];
  352. if (typeof v == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(v)) {
  353. alphabetHasNormalDecimalDigits = v.slice(0, 10) == "0123456789";
  354. ALPHABET = v;
  355. } else {
  356. throw Error(bignumberError + p + " invalid: " + v);
  357. }
  358. }
  359. } else {
  360. throw Error(bignumberError + "Object expected: " + obj);
  361. }
  362. }
  363. return {
  364. DECIMAL_PLACES,
  365. ROUNDING_MODE,
  366. EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
  367. RANGE: [MIN_EXP, MAX_EXP],
  368. CRYPTO,
  369. MODULO_MODE,
  370. POW_PRECISION,
  371. FORMAT,
  372. ALPHABET
  373. };
  374. };
  375. BigNumber3.isBigNumber = function(v) {
  376. if (!v || v._isBigNumber !== true) return false;
  377. if (!BigNumber3.DEBUG) return true;
  378. var i, n, c = v.c, e = v.e, s = v.s;
  379. out: if ({}.toString.call(c) == "[object Array]") {
  380. if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {
  381. if (c[0] === 0) {
  382. if (e === 0 && c.length === 1) return true;
  383. break out;
  384. }
  385. i = (e + 1) % LOG_BASE;
  386. if (i < 1) i += LOG_BASE;
  387. if (String(c[0]).length == i) {
  388. for (i = 0; i < c.length; i++) {
  389. n = c[i];
  390. if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;
  391. }
  392. if (n !== 0) return true;
  393. }
  394. }
  395. } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {
  396. return true;
  397. }
  398. throw Error(bignumberError + "Invalid BigNumber: " + v);
  399. };
  400. BigNumber3.maximum = BigNumber3.max = function() {
  401. return maxOrMin(arguments, -1);
  402. };
  403. BigNumber3.minimum = BigNumber3.min = function() {
  404. return maxOrMin(arguments, 1);
  405. };
  406. BigNumber3.random = function() {
  407. var pow2_53 = 9007199254740992;
  408. var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() {
  409. return mathfloor(Math.random() * pow2_53);
  410. } : function() {
  411. return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
  412. };
  413. return function(dp) {
  414. var a, b, e, k, v, i = 0, c = [], rand = new BigNumber3(ONE);
  415. if (dp == null) dp = DECIMAL_PLACES;
  416. else intCheck(dp, 0, MAX);
  417. k = mathceil(dp / LOG_BASE);
  418. if (CRYPTO) {
  419. if (crypto.getRandomValues) {
  420. a = crypto.getRandomValues(new Uint32Array(k *= 2));
  421. for (; i < k; ) {
  422. v = a[i] * 131072 + (a[i + 1] >>> 11);
  423. if (v >= 9e15) {
  424. b = crypto.getRandomValues(new Uint32Array(2));
  425. a[i] = b[0];
  426. a[i + 1] = b[1];
  427. } else {
  428. c.push(v % 1e14);
  429. i += 2;
  430. }
  431. }
  432. i = k / 2;
  433. } else if (crypto.randomBytes) {
  434. a = crypto.randomBytes(k *= 7);
  435. for (; i < k; ) {
  436. v = (a[i] & 31) * 281474976710656 + a[i + 1] * 1099511627776 + a[i + 2] * 4294967296 + a[i + 3] * 16777216 + (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];
  437. if (v >= 9e15) {
  438. crypto.randomBytes(7).copy(a, i);
  439. } else {
  440. c.push(v % 1e14);
  441. i += 7;
  442. }
  443. }
  444. i = k / 7;
  445. } else {
  446. CRYPTO = false;
  447. throw Error(bignumberError + "crypto unavailable");
  448. }
  449. }
  450. if (!CRYPTO) {
  451. for (; i < k; ) {
  452. v = random53bitInt();
  453. if (v < 9e15) c[i++] = v % 1e14;
  454. }
  455. }
  456. k = c[--i];
  457. dp %= LOG_BASE;
  458. if (k && dp) {
  459. v = POWS_TEN[LOG_BASE - dp];
  460. c[i] = mathfloor(k / v) * v;
  461. }
  462. for (; c[i] === 0; c.pop(), i--) ;
  463. if (i < 0) {
  464. c = [e = 0];
  465. } else {
  466. for (e = -1; c[0] === 0; c.splice(0, 1), e -= LOG_BASE) ;
  467. for (i = 1, v = c[0]; v >= 10; v /= 10, i++) ;
  468. if (i < LOG_BASE) e -= LOG_BASE - i;
  469. }
  470. rand.e = e;
  471. rand.c = c;
  472. return rand;
  473. };
  474. }();
  475. BigNumber3.sum = function() {
  476. var i = 1, args = arguments, sum = new BigNumber3(args[0]);
  477. for (; i < args.length; ) sum = sum.plus(args[i++]);
  478. return sum;
  479. };
  480. convertBase = /* @__PURE__ */ function() {
  481. var decimal = "0123456789";
  482. function toBaseOut(str, baseIn, baseOut, alphabet) {
  483. var j, arr = [0], arrL, i = 0, len = str.length;
  484. for (; i < len; ) {
  485. for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) ;
  486. arr[0] += alphabet.indexOf(str.charAt(i++));
  487. for (j = 0; j < arr.length; j++) {
  488. if (arr[j] > baseOut - 1) {
  489. if (arr[j + 1] == null) arr[j + 1] = 0;
  490. arr[j + 1] += arr[j] / baseOut | 0;
  491. arr[j] %= baseOut;
  492. }
  493. }
  494. }
  495. return arr.reverse();
  496. }
  497. return function(str, baseIn, baseOut, sign, callerIsToString) {
  498. var alphabet, d, e, k, r, x, xc, y, i = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
  499. if (i >= 0) {
  500. k = POW_PRECISION;
  501. POW_PRECISION = 0;
  502. str = str.replace(".", "");
  503. y = new BigNumber3(baseIn);
  504. x = y.pow(str.length - i);
  505. POW_PRECISION = k;
  506. y.c = toBaseOut(
  507. toFixedPoint(coeffToString(x.c), x.e, "0"),
  508. 10,
  509. baseOut,
  510. decimal
  511. );
  512. y.e = y.c.length;
  513. }
  514. xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET));
  515. e = k = xc.length;
  516. for (; xc[--k] == 0; xc.pop()) ;
  517. if (!xc[0]) return alphabet.charAt(0);
  518. if (i < 0) {
  519. --e;
  520. } else {
  521. x.c = xc;
  522. x.e = e;
  523. x.s = sign;
  524. x = div(x, y, dp, rm, baseOut);
  525. xc = x.c;
  526. r = x.r;
  527. e = x.e;
  528. }
  529. d = e + dp + 1;
  530. i = xc[d];
  531. k = baseOut / 2;
  532. r = r || d < 0 || xc[d + 1] != null;
  533. r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));
  534. if (d < 1 || !xc[0]) {
  535. str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
  536. } else {
  537. xc.length = d;
  538. if (r) {
  539. for (--baseOut; ++xc[--d] > baseOut; ) {
  540. xc[d] = 0;
  541. if (!d) {
  542. ++e;
  543. xc = [1].concat(xc);
  544. }
  545. }
  546. }
  547. for (k = xc.length; !xc[--k]; ) ;
  548. for (i = 0, str = ""; i <= k; str += alphabet.charAt(xc[i++])) ;
  549. str = toFixedPoint(str, e, alphabet.charAt(0));
  550. }
  551. return str;
  552. };
  553. }();
  554. div = /* @__PURE__ */ function() {
  555. function multiply(x, k, base) {
  556. var m, temp, xlo, xhi, carry = 0, i = x.length, klo = k % SQRT_BASE, khi = k / SQRT_BASE | 0;
  557. for (x = x.slice(); i--; ) {
  558. xlo = x[i] % SQRT_BASE;
  559. xhi = x[i] / SQRT_BASE | 0;
  560. m = khi * xlo + xhi * klo;
  561. temp = klo * xlo + m % SQRT_BASE * SQRT_BASE + carry;
  562. carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;
  563. x[i] = temp % base;
  564. }
  565. if (carry) x = [carry].concat(x);
  566. return x;
  567. }
  568. function compare2(a, b, aL, bL) {
  569. var i, cmp;
  570. if (aL != bL) {
  571. cmp = aL > bL ? 1 : -1;
  572. } else {
  573. for (i = cmp = 0; i < aL; i++) {
  574. if (a[i] != b[i]) {
  575. cmp = a[i] > b[i] ? 1 : -1;
  576. break;
  577. }
  578. }
  579. }
  580. return cmp;
  581. }
  582. function subtract(a, b, aL, base) {
  583. var i = 0;
  584. for (; aL--; ) {
  585. a[aL] -= i;
  586. i = a[aL] < b[aL] ? 1 : 0;
  587. a[aL] = i * base + a[aL] - b[aL];
  588. }
  589. for (; !a[0] && a.length > 1; a.splice(0, 1)) ;
  590. }
  591. return function(x, y, dp, rm, base) {
  592. var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s = x.s == y.s ? 1 : -1, xc = x.c, yc = y.c;
  593. if (!xc || !xc[0] || !yc || !yc[0]) {
  594. return new BigNumber3(
  595. // Return NaN if either NaN, or both Infinity or 0.
  596. !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : (
  597. // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
  598. xc && xc[0] == 0 || !yc ? s * 0 : s / 0
  599. )
  600. );
  601. }
  602. q = new BigNumber3(s);
  603. qc = q.c = [];
  604. e = x.e - y.e;
  605. s = dp + e + 1;
  606. if (!base) {
  607. base = BASE;
  608. e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);
  609. s = s / LOG_BASE | 0;
  610. }
  611. for (i = 0; yc[i] == (xc[i] || 0); i++) ;
  612. if (yc[i] > (xc[i] || 0)) e--;
  613. if (s < 0) {
  614. qc.push(1);
  615. more = true;
  616. } else {
  617. xL = xc.length;
  618. yL = yc.length;
  619. i = 0;
  620. s += 2;
  621. n = mathfloor(base / (yc[0] + 1));
  622. if (n > 1) {
  623. yc = multiply(yc, n, base);
  624. xc = multiply(xc, n, base);
  625. yL = yc.length;
  626. xL = xc.length;
  627. }
  628. xi = yL;
  629. rem = xc.slice(0, yL);
  630. remL = rem.length;
  631. for (; remL < yL; rem[remL++] = 0) ;
  632. yz = yc.slice();
  633. yz = [0].concat(yz);
  634. yc0 = yc[0];
  635. if (yc[1] >= base / 2) yc0++;
  636. do {
  637. n = 0;
  638. cmp = compare2(yc, rem, yL, remL);
  639. if (cmp < 0) {
  640. rem0 = rem[0];
  641. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  642. n = mathfloor(rem0 / yc0);
  643. if (n > 1) {
  644. if (n >= base) n = base - 1;
  645. prod = multiply(yc, n, base);
  646. prodL = prod.length;
  647. remL = rem.length;
  648. while (compare2(prod, rem, prodL, remL) == 1) {
  649. n--;
  650. subtract(prod, yL < prodL ? yz : yc, prodL, base);
  651. prodL = prod.length;
  652. cmp = 1;
  653. }
  654. } else {
  655. if (n == 0) {
  656. cmp = n = 1;
  657. }
  658. prod = yc.slice();
  659. prodL = prod.length;
  660. }
  661. if (prodL < remL) prod = [0].concat(prod);
  662. subtract(rem, prod, remL, base);
  663. remL = rem.length;
  664. if (cmp == -1) {
  665. while (compare2(yc, rem, yL, remL) < 1) {
  666. n++;
  667. subtract(rem, yL < remL ? yz : yc, remL, base);
  668. remL = rem.length;
  669. }
  670. }
  671. } else if (cmp === 0) {
  672. n++;
  673. rem = [0];
  674. }
  675. qc[i++] = n;
  676. if (rem[0]) {
  677. rem[remL++] = xc[xi] || 0;
  678. } else {
  679. rem = [xc[xi]];
  680. remL = 1;
  681. }
  682. } while ((xi++ < xL || rem[0] != null) && s--);
  683. more = rem[0] != null;
  684. if (!qc[0]) qc.splice(0, 1);
  685. }
  686. if (base == BASE) {
  687. for (i = 1, s = qc[0]; s >= 10; s /= 10, i++) ;
  688. round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);
  689. } else {
  690. q.e = e;
  691. q.r = +more;
  692. }
  693. return q;
  694. };
  695. }();
  696. function format(n, i, rm, id) {
  697. var c0, e, ne, len, str;
  698. if (rm == null) rm = ROUNDING_MODE;
  699. else intCheck(rm, 0, 8);
  700. if (!n.c) return n.toString();
  701. c0 = n.c[0];
  702. ne = n.e;
  703. if (i == null) {
  704. str = coeffToString(n.c);
  705. str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ? toExponential(str, ne) : toFixedPoint(str, ne, "0");
  706. } else {
  707. n = round(new BigNumber3(n), i, rm);
  708. e = n.e;
  709. str = coeffToString(n.c);
  710. len = str.length;
  711. if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {
  712. for (; len < i; str += "0", len++) ;
  713. str = toExponential(str, e);
  714. } else {
  715. i -= ne;
  716. str = toFixedPoint(str, e, "0");
  717. if (e + 1 > len) {
  718. if (--i > 0) for (str += "."; i--; str += "0") ;
  719. } else {
  720. i += e - len;
  721. if (i > 0) {
  722. if (e + 1 == len) str += ".";
  723. for (; i--; str += "0") ;
  724. }
  725. }
  726. }
  727. }
  728. return n.s < 0 && c0 ? "-" + str : str;
  729. }
  730. function maxOrMin(args, n) {
  731. var k, y, i = 1, x = new BigNumber3(args[0]);
  732. for (; i < args.length; i++) {
  733. y = new BigNumber3(args[i]);
  734. if (!y.s || (k = compare(x, y)) === n || k === 0 && x.s === n) {
  735. x = y;
  736. }
  737. }
  738. return x;
  739. }
  740. function normalise(n, c, e) {
  741. var i = 1, j = c.length;
  742. for (; !c[--j]; c.pop()) ;
  743. for (j = c[0]; j >= 10; j /= 10, i++) ;
  744. if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {
  745. n.c = n.e = null;
  746. } else if (e < MIN_EXP) {
  747. n.c = [n.e = 0];
  748. } else {
  749. n.e = e;
  750. n.c = c;
  751. }
  752. return n;
  753. }
  754. parseNumeric = /* @__PURE__ */ function() {
  755. var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, dotAfter = /^([^.]+)\.$/, dotBefore = /^\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
  756. return function(x, str, isNum, b) {
  757. var base, s = isNum ? str : str.replace(whitespaceOrPlus, "");
  758. if (isInfinityOrNaN.test(s)) {
  759. x.s = isNaN(s) ? null : s < 0 ? -1 : 1;
  760. } else {
  761. if (!isNum) {
  762. s = s.replace(basePrefix, function(m, p1, p2) {
  763. base = (p2 = p2.toLowerCase()) == "x" ? 16 : p2 == "b" ? 2 : 8;
  764. return !b || b == base ? p1 : m;
  765. });
  766. if (b) {
  767. base = b;
  768. s = s.replace(dotAfter, "$1").replace(dotBefore, "0.$1");
  769. }
  770. if (str != s) return new BigNumber3(s, base);
  771. }
  772. if (BigNumber3.DEBUG) {
  773. throw Error(bignumberError + "Not a" + (b ? " base " + b : "") + " number: " + str);
  774. }
  775. x.s = null;
  776. }
  777. x.c = x.e = null;
  778. };
  779. }();
  780. function round(x, sd, rm, r) {
  781. var d, i, j, k, n, ni, rd, xc = x.c, pows10 = POWS_TEN;
  782. if (xc) {
  783. out: {
  784. for (d = 1, k = xc[0]; k >= 10; k /= 10, d++) ;
  785. i = sd - d;
  786. if (i < 0) {
  787. i += LOG_BASE;
  788. j = sd;
  789. n = xc[ni = 0];
  790. rd = mathfloor(n / pows10[d - j - 1] % 10);
  791. } else {
  792. ni = mathceil((i + 1) / LOG_BASE);
  793. if (ni >= xc.length) {
  794. if (r) {
  795. for (; xc.length <= ni; xc.push(0)) ;
  796. n = rd = 0;
  797. d = 1;
  798. i %= LOG_BASE;
  799. j = i - LOG_BASE + 1;
  800. } else {
  801. break out;
  802. }
  803. } else {
  804. n = k = xc[ni];
  805. for (d = 1; k >= 10; k /= 10, d++) ;
  806. i %= LOG_BASE;
  807. j = i - LOG_BASE + d;
  808. rd = j < 0 ? 0 : mathfloor(n / pows10[d - j - 1] % 10);
  809. }
  810. }
  811. r = r || sd < 0 || // Are there any non-zero digits after the rounding digit?
  812. // The expression n % pows10[d - j - 1] returns all digits of n to the right
  813. // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
  814. xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);
  815. r = rm < 4 ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && // Check whether the digit to the left of the rounding digit is odd.
  816. (i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
  817. if (sd < 1 || !xc[0]) {
  818. xc.length = 0;
  819. if (r) {
  820. sd -= x.e + 1;
  821. xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
  822. x.e = -sd || 0;
  823. } else {
  824. xc[0] = x.e = 0;
  825. }
  826. return x;
  827. }
  828. if (i == 0) {
  829. xc.length = ni;
  830. k = 1;
  831. ni--;
  832. } else {
  833. xc.length = ni + 1;
  834. k = pows10[LOG_BASE - i];
  835. xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;
  836. }
  837. if (r) {
  838. for (; ; ) {
  839. if (ni == 0) {
  840. for (i = 1, j = xc[0]; j >= 10; j /= 10, i++) ;
  841. j = xc[0] += k;
  842. for (k = 1; j >= 10; j /= 10, k++) ;
  843. if (i != k) {
  844. x.e++;
  845. if (xc[0] == BASE) xc[0] = 1;
  846. }
  847. break;
  848. } else {
  849. xc[ni] += k;
  850. if (xc[ni] != BASE) break;
  851. xc[ni--] = 0;
  852. k = 1;
  853. }
  854. }
  855. }
  856. for (i = xc.length; xc[--i] === 0; xc.pop()) ;
  857. }
  858. if (x.e > MAX_EXP) {
  859. x.c = x.e = null;
  860. } else if (x.e < MIN_EXP) {
  861. x.c = [x.e = 0];
  862. }
  863. }
  864. return x;
  865. }
  866. function valueOf(n) {
  867. var str, e = n.e;
  868. if (e === null) return n.toString();
  869. str = coeffToString(n.c);
  870. str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(str, e) : toFixedPoint(str, e, "0");
  871. return n.s < 0 ? "-" + str : str;
  872. }
  873. P.absoluteValue = P.abs = function() {
  874. var x = new BigNumber3(this);
  875. if (x.s < 0) x.s = 1;
  876. return x;
  877. };
  878. P.comparedTo = function(y, b) {
  879. return compare(this, new BigNumber3(y, b));
  880. };
  881. P.decimalPlaces = P.dp = function(dp, rm) {
  882. var c, n, v, x = this;
  883. if (dp != null) {
  884. intCheck(dp, 0, MAX);
  885. if (rm == null) rm = ROUNDING_MODE;
  886. else intCheck(rm, 0, 8);
  887. return round(new BigNumber3(x), dp + x.e + 1, rm);
  888. }
  889. if (!(c = x.c)) return null;
  890. n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
  891. if (v = c[v]) for (; v % 10 == 0; v /= 10, n--) ;
  892. if (n < 0) n = 0;
  893. return n;
  894. };
  895. P.dividedBy = P.div = function(y, b) {
  896. return div(this, new BigNumber3(y, b), DECIMAL_PLACES, ROUNDING_MODE);
  897. };
  898. P.dividedToIntegerBy = P.idiv = function(y, b) {
  899. return div(this, new BigNumber3(y, b), 0, 1);
  900. };
  901. P.exponentiatedBy = P.pow = function(n, m) {
  902. var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, x = this;
  903. n = new BigNumber3(n);
  904. if (n.c && !n.isInteger()) {
  905. throw Error(bignumberError + "Exponent not an integer: " + valueOf(n));
  906. }
  907. if (m != null) m = new BigNumber3(m);
  908. nIsBig = n.e > 14;
  909. if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {
  910. y = new BigNumber3(Math.pow(+valueOf(x), nIsBig ? n.s * (2 - isOdd(n)) : +valueOf(n)));
  911. return m ? y.mod(m) : y;
  912. }
  913. nIsNeg = n.s < 0;
  914. if (m) {
  915. if (m.c ? !m.c[0] : !m.s) return new BigNumber3(NaN);
  916. isModExp = !nIsNeg && x.isInteger() && m.isInteger();
  917. if (isModExp) x = x.mod(m);
  918. } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {
  919. k = x.s < 0 && isOdd(n) ? -0 : 0;
  920. if (x.e > -1) k = 1 / k;
  921. return new BigNumber3(nIsNeg ? 1 / k : k);
  922. } else if (POW_PRECISION) {
  923. k = mathceil(POW_PRECISION / LOG_BASE + 2);
  924. }
  925. if (nIsBig) {
  926. half = new BigNumber3(0.5);
  927. if (nIsNeg) n.s = 1;
  928. nIsOdd = isOdd(n);
  929. } else {
  930. i = Math.abs(+valueOf(n));
  931. nIsOdd = i % 2;
  932. }
  933. y = new BigNumber3(ONE);
  934. for (; ; ) {
  935. if (nIsOdd) {
  936. y = y.times(x);
  937. if (!y.c) break;
  938. if (k) {
  939. if (y.c.length > k) y.c.length = k;
  940. } else if (isModExp) {
  941. y = y.mod(m);
  942. }
  943. }
  944. if (i) {
  945. i = mathfloor(i / 2);
  946. if (i === 0) break;
  947. nIsOdd = i % 2;
  948. } else {
  949. n = n.times(half);
  950. round(n, n.e + 1, 1);
  951. if (n.e > 14) {
  952. nIsOdd = isOdd(n);
  953. } else {
  954. i = +valueOf(n);
  955. if (i === 0) break;
  956. nIsOdd = i % 2;
  957. }
  958. }
  959. x = x.times(x);
  960. if (k) {
  961. if (x.c && x.c.length > k) x.c.length = k;
  962. } else if (isModExp) {
  963. x = x.mod(m);
  964. }
  965. }
  966. if (isModExp) return y;
  967. if (nIsNeg) y = ONE.div(y);
  968. return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;
  969. };
  970. P.integerValue = function(rm) {
  971. var n = new BigNumber3(this);
  972. if (rm == null) rm = ROUNDING_MODE;
  973. else intCheck(rm, 0, 8);
  974. return round(n, n.e + 1, rm);
  975. };
  976. P.isEqualTo = P.eq = function(y, b) {
  977. return compare(this, new BigNumber3(y, b)) === 0;
  978. };
  979. P.isFinite = function() {
  980. return !!this.c;
  981. };
  982. P.isGreaterThan = P.gt = function(y, b) {
  983. return compare(this, new BigNumber3(y, b)) > 0;
  984. };
  985. P.isGreaterThanOrEqualTo = P.gte = function(y, b) {
  986. return (b = compare(this, new BigNumber3(y, b))) === 1 || b === 0;
  987. };
  988. P.isInteger = function() {
  989. return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
  990. };
  991. P.isLessThan = P.lt = function(y, b) {
  992. return compare(this, new BigNumber3(y, b)) < 0;
  993. };
  994. P.isLessThanOrEqualTo = P.lte = function(y, b) {
  995. return (b = compare(this, new BigNumber3(y, b))) === -1 || b === 0;
  996. };
  997. P.isNaN = function() {
  998. return !this.s;
  999. };
  1000. P.isNegative = function() {
  1001. return this.s < 0;
  1002. };
  1003. P.isPositive = function() {
  1004. return this.s > 0;
  1005. };
  1006. P.isZero = function() {
  1007. return !!this.c && this.c[0] == 0;
  1008. };
  1009. P.minus = function(y, b) {
  1010. var i, j, t, xLTy, x = this, a = x.s;
  1011. y = new BigNumber3(y, b);
  1012. b = y.s;
  1013. if (!a || !b) return new BigNumber3(NaN);
  1014. if (a != b) {
  1015. y.s = -b;
  1016. return x.plus(y);
  1017. }
  1018. var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c;
  1019. if (!xe || !ye) {
  1020. if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber3(yc ? x : NaN);
  1021. if (!xc[0] || !yc[0]) {
  1022. return yc[0] ? (y.s = -b, y) : new BigNumber3(xc[0] ? x : (
  1023. // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
  1024. ROUNDING_MODE == 3 ? -0 : 0
  1025. ));
  1026. }
  1027. }
  1028. xe = bitFloor(xe);
  1029. ye = bitFloor(ye);
  1030. xc = xc.slice();
  1031. if (a = xe - ye) {
  1032. if (xLTy = a < 0) {
  1033. a = -a;
  1034. t = xc;
  1035. } else {
  1036. ye = xe;
  1037. t = yc;
  1038. }
  1039. t.reverse();
  1040. for (b = a; b--; t.push(0)) ;
  1041. t.reverse();
  1042. } else {
  1043. j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;
  1044. for (a = b = 0; b < j; b++) {
  1045. if (xc[b] != yc[b]) {
  1046. xLTy = xc[b] < yc[b];
  1047. break;
  1048. }
  1049. }
  1050. }
  1051. if (xLTy) {
  1052. t = xc;
  1053. xc = yc;
  1054. yc = t;
  1055. y.s = -y.s;
  1056. }
  1057. b = (j = yc.length) - (i = xc.length);
  1058. if (b > 0) for (; b--; xc[i++] = 0) ;
  1059. b = BASE - 1;
  1060. for (; j > a; ) {
  1061. if (xc[--j] < yc[j]) {
  1062. for (i = j; i && !xc[--i]; xc[i] = b) ;
  1063. --xc[i];
  1064. xc[j] += BASE;
  1065. }
  1066. xc[j] -= yc[j];
  1067. }
  1068. for (; xc[0] == 0; xc.splice(0, 1), --ye) ;
  1069. if (!xc[0]) {
  1070. y.s = ROUNDING_MODE == 3 ? -1 : 1;
  1071. y.c = [y.e = 0];
  1072. return y;
  1073. }
  1074. return normalise(y, xc, ye);
  1075. };
  1076. P.modulo = P.mod = function(y, b) {
  1077. var q, s, x = this;
  1078. y = new BigNumber3(y, b);
  1079. if (!x.c || !y.s || y.c && !y.c[0]) {
  1080. return new BigNumber3(NaN);
  1081. } else if (!y.c || x.c && !x.c[0]) {
  1082. return new BigNumber3(x);
  1083. }
  1084. if (MODULO_MODE == 9) {
  1085. s = y.s;
  1086. y.s = 1;
  1087. q = div(x, y, 0, 3);
  1088. y.s = s;
  1089. q.s *= s;
  1090. } else {
  1091. q = div(x, y, 0, MODULO_MODE);
  1092. }
  1093. y = x.minus(q.times(y));
  1094. if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;
  1095. return y;
  1096. };
  1097. P.multipliedBy = P.times = function(y, b) {
  1098. var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x = this, xc = x.c, yc = (y = new BigNumber3(y, b)).c;
  1099. if (!xc || !yc || !xc[0] || !yc[0]) {
  1100. if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
  1101. y.c = y.e = y.s = null;
  1102. } else {
  1103. y.s *= x.s;
  1104. if (!xc || !yc) {
  1105. y.c = y.e = null;
  1106. } else {
  1107. y.c = [0];
  1108. y.e = 0;
  1109. }
  1110. }
  1111. return y;
  1112. }
  1113. e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);
  1114. y.s *= x.s;
  1115. xcL = xc.length;
  1116. ycL = yc.length;
  1117. if (xcL < ycL) {
  1118. zc = xc;
  1119. xc = yc;
  1120. yc = zc;
  1121. i = xcL;
  1122. xcL = ycL;
  1123. ycL = i;
  1124. }
  1125. for (i = xcL + ycL, zc = []; i--; zc.push(0)) ;
  1126. base = BASE;
  1127. sqrtBase = SQRT_BASE;
  1128. for (i = ycL; --i >= 0; ) {
  1129. c = 0;
  1130. ylo = yc[i] % sqrtBase;
  1131. yhi = yc[i] / sqrtBase | 0;
  1132. for (k = xcL, j = i + k; j > i; ) {
  1133. xlo = xc[--k] % sqrtBase;
  1134. xhi = xc[k] / sqrtBase | 0;
  1135. m = yhi * xlo + xhi * ylo;
  1136. xlo = ylo * xlo + m % sqrtBase * sqrtBase + zc[j] + c;
  1137. c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;
  1138. zc[j--] = xlo % base;
  1139. }
  1140. zc[j] = c;
  1141. }
  1142. if (c) {
  1143. ++e;
  1144. } else {
  1145. zc.splice(0, 1);
  1146. }
  1147. return normalise(y, zc, e);
  1148. };
  1149. P.negated = function() {
  1150. var x = new BigNumber3(this);
  1151. x.s = -x.s || null;
  1152. return x;
  1153. };
  1154. P.plus = function(y, b) {
  1155. var t, x = this, a = x.s;
  1156. y = new BigNumber3(y, b);
  1157. b = y.s;
  1158. if (!a || !b) return new BigNumber3(NaN);
  1159. if (a != b) {
  1160. y.s = -b;
  1161. return x.minus(y);
  1162. }
  1163. var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c;
  1164. if (!xe || !ye) {
  1165. if (!xc || !yc) return new BigNumber3(a / 0);
  1166. if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber3(xc[0] ? x : a * 0);
  1167. }
  1168. xe = bitFloor(xe);
  1169. ye = bitFloor(ye);
  1170. xc = xc.slice();
  1171. if (a = xe - ye) {
  1172. if (a > 0) {
  1173. ye = xe;
  1174. t = yc;
  1175. } else {
  1176. a = -a;
  1177. t = xc;
  1178. }
  1179. t.reverse();
  1180. for (; a--; t.push(0)) ;
  1181. t.reverse();
  1182. }
  1183. a = xc.length;
  1184. b = yc.length;
  1185. if (a - b < 0) {
  1186. t = yc;
  1187. yc = xc;
  1188. xc = t;
  1189. b = a;
  1190. }
  1191. for (a = 0; b; ) {
  1192. a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;
  1193. xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;
  1194. }
  1195. if (a) {
  1196. xc = [a].concat(xc);
  1197. ++ye;
  1198. }
  1199. return normalise(y, xc, ye);
  1200. };
  1201. P.precision = P.sd = function(sd, rm) {
  1202. var c, n, v, x = this;
  1203. if (sd != null && sd !== !!sd) {
  1204. intCheck(sd, 1, MAX);
  1205. if (rm == null) rm = ROUNDING_MODE;
  1206. else intCheck(rm, 0, 8);
  1207. return round(new BigNumber3(x), sd, rm);
  1208. }
  1209. if (!(c = x.c)) return null;
  1210. v = c.length - 1;
  1211. n = v * LOG_BASE + 1;
  1212. if (v = c[v]) {
  1213. for (; v % 10 == 0; v /= 10, n--) ;
  1214. for (v = c[0]; v >= 10; v /= 10, n++) ;
  1215. }
  1216. if (sd && x.e + 1 > n) n = x.e + 1;
  1217. return n;
  1218. };
  1219. P.shiftedBy = function(k) {
  1220. intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
  1221. return this.times("1e" + k);
  1222. };
  1223. P.squareRoot = P.sqrt = function() {
  1224. var m, n, r, rep, t, x = this, c = x.c, s = x.s, e = x.e, dp = DECIMAL_PLACES + 4, half = new BigNumber3("0.5");
  1225. if (s !== 1 || !c || !c[0]) {
  1226. return new BigNumber3(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);
  1227. }
  1228. s = Math.sqrt(+valueOf(x));
  1229. if (s == 0 || s == 1 / 0) {
  1230. n = coeffToString(c);
  1231. if ((n.length + e) % 2 == 0) n += "0";
  1232. s = Math.sqrt(+n);
  1233. e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);
  1234. if (s == 1 / 0) {
  1235. n = "5e" + e;
  1236. } else {
  1237. n = s.toExponential();
  1238. n = n.slice(0, n.indexOf("e") + 1) + e;
  1239. }
  1240. r = new BigNumber3(n);
  1241. } else {
  1242. r = new BigNumber3(s + "");
  1243. }
  1244. if (r.c[0]) {
  1245. e = r.e;
  1246. s = e + dp;
  1247. if (s < 3) s = 0;
  1248. for (; ; ) {
  1249. t = r;
  1250. r = half.times(t.plus(div(x, t, dp, 1)));
  1251. if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {
  1252. if (r.e < e) --s;
  1253. n = n.slice(s - 3, s + 1);
  1254. if (n == "9999" || !rep && n == "4999") {
  1255. if (!rep) {
  1256. round(t, t.e + DECIMAL_PLACES + 2, 0);
  1257. if (t.times(t).eq(x)) {
  1258. r = t;
  1259. break;
  1260. }
  1261. }
  1262. dp += 4;
  1263. s += 4;
  1264. rep = 1;
  1265. } else {
  1266. if (!+n || !+n.slice(1) && n.charAt(0) == "5") {
  1267. round(r, r.e + DECIMAL_PLACES + 2, 1);
  1268. m = !r.times(r).eq(x);
  1269. }
  1270. break;
  1271. }
  1272. }
  1273. }
  1274. }
  1275. return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);
  1276. };
  1277. P.toExponential = function(dp, rm) {
  1278. if (dp != null) {
  1279. intCheck(dp, 0, MAX);
  1280. dp++;
  1281. }
  1282. return format(this, dp, rm, 1);
  1283. };
  1284. P.toFixed = function(dp, rm) {
  1285. if (dp != null) {
  1286. intCheck(dp, 0, MAX);
  1287. dp = dp + this.e + 1;
  1288. }
  1289. return format(this, dp, rm);
  1290. };
  1291. P.toFormat = function(dp, rm, format2) {
  1292. var str, x = this;
  1293. if (format2 == null) {
  1294. if (dp != null && rm && typeof rm == "object") {
  1295. format2 = rm;
  1296. rm = null;
  1297. } else if (dp && typeof dp == "object") {
  1298. format2 = dp;
  1299. dp = rm = null;
  1300. } else {
  1301. format2 = FORMAT;
  1302. }
  1303. } else if (typeof format2 != "object") {
  1304. throw Error(bignumberError + "Argument not an object: " + format2);
  1305. }
  1306. str = x.toFixed(dp, rm);
  1307. if (x.c) {
  1308. var i, arr = str.split("."), g1 = +format2.groupSize, g2 = +format2.secondaryGroupSize, groupSeparator = format2.groupSeparator || "", intPart = arr[0], fractionPart = arr[1], isNeg = x.s < 0, intDigits = isNeg ? intPart.slice(1) : intPart, len = intDigits.length;
  1309. if (g2) {
  1310. i = g1;
  1311. g1 = g2;
  1312. g2 = i;
  1313. len -= i;
  1314. }
  1315. if (g1 > 0 && len > 0) {
  1316. i = len % g1 || g1;
  1317. intPart = intDigits.substr(0, i);
  1318. for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);
  1319. if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);
  1320. if (isNeg) intPart = "-" + intPart;
  1321. }
  1322. str = fractionPart ? intPart + (format2.decimalSeparator || "") + ((g2 = +format2.fractionGroupSize) ? fractionPart.replace(
  1323. new RegExp("\\d{" + g2 + "}\\B", "g"),
  1324. "$&" + (format2.fractionGroupSeparator || "")
  1325. ) : fractionPart) : intPart;
  1326. }
  1327. return (format2.prefix || "") + str + (format2.suffix || "");
  1328. };
  1329. P.toFraction = function(md) {
  1330. var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, x = this, xc = x.c;
  1331. if (md != null) {
  1332. n = new BigNumber3(md);
  1333. if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {
  1334. throw Error(bignumberError + "Argument " + (n.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n));
  1335. }
  1336. }
  1337. if (!xc) return new BigNumber3(x);
  1338. d = new BigNumber3(ONE);
  1339. n1 = d0 = new BigNumber3(ONE);
  1340. d1 = n0 = new BigNumber3(ONE);
  1341. s = coeffToString(xc);
  1342. e = d.e = s.length - x.e - 1;
  1343. d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];
  1344. md = !md || n.comparedTo(d) > 0 ? e > 0 ? d : n1 : n;
  1345. exp = MAX_EXP;
  1346. MAX_EXP = 1 / 0;
  1347. n = new BigNumber3(s);
  1348. n0.c[0] = 0;
  1349. for (; ; ) {
  1350. q = div(n, d, 0, 1);
  1351. d2 = d0.plus(q.times(d1));
  1352. if (d2.comparedTo(md) == 1) break;
  1353. d0 = d1;
  1354. d1 = d2;
  1355. n1 = n0.plus(q.times(d2 = n1));
  1356. n0 = d2;
  1357. d = n.minus(q.times(d2 = d));
  1358. n = d2;
  1359. }
  1360. d2 = div(md.minus(d0), d1, 0, 1);
  1361. n0 = n0.plus(d2.times(n1));
  1362. d0 = d0.plus(d2.times(d1));
  1363. n0.s = n1.s = x.s;
  1364. e = e * 2;
  1365. r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(
  1366. div(n0, d0, e, ROUNDING_MODE).minus(x).abs()
  1367. ) < 1 ? [n1, d1] : [n0, d0];
  1368. MAX_EXP = exp;
  1369. return r;
  1370. };
  1371. P.toNumber = function() {
  1372. return +valueOf(this);
  1373. };
  1374. P.toPrecision = function(sd, rm) {
  1375. if (sd != null) intCheck(sd, 1, MAX);
  1376. return format(this, sd, rm, 2);
  1377. };
  1378. P.toString = function(b) {
  1379. var str, n = this, s = n.s, e = n.e;
  1380. if (e === null) {
  1381. if (s) {
  1382. str = "Infinity";
  1383. if (s < 0) str = "-" + str;
  1384. } else {
  1385. str = "NaN";
  1386. }
  1387. } else {
  1388. if (b == null) {
  1389. str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(coeffToString(n.c), e) : toFixedPoint(coeffToString(n.c), e, "0");
  1390. } else if (b === 10 && alphabetHasNormalDecimalDigits) {
  1391. n = round(new BigNumber3(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);
  1392. str = toFixedPoint(coeffToString(n.c), n.e, "0");
  1393. } else {
  1394. intCheck(b, 2, ALPHABET.length, "Base");
  1395. str = convertBase(toFixedPoint(coeffToString(n.c), e, "0"), 10, b, s, true);
  1396. }
  1397. if (s < 0 && n.c[0]) str = "-" + str;
  1398. }
  1399. return str;
  1400. };
  1401. P.valueOf = P.toJSON = function() {
  1402. return valueOf(this);
  1403. };
  1404. P._isBigNumber = true;
  1405. if (configObject != null) BigNumber3.set(configObject);
  1406. return BigNumber3;
  1407. }
  1408. function bitFloor(n) {
  1409. var i = n | 0;
  1410. return n > 0 || n === i ? i : i - 1;
  1411. }
  1412. function coeffToString(a) {
  1413. var s, z, i = 1, j = a.length, r = a[0] + "";
  1414. for (; i < j; ) {
  1415. s = a[i++] + "";
  1416. z = LOG_BASE - s.length;
  1417. for (; z--; s = "0" + s) ;
  1418. r += s;
  1419. }
  1420. for (j = r.length; r.charCodeAt(--j) === 48; ) ;
  1421. return r.slice(0, j + 1 || 1);
  1422. }
  1423. function compare(x, y) {
  1424. var a, b, xc = x.c, yc = y.c, i = x.s, j = y.s, k = x.e, l = y.e;
  1425. if (!i || !j) return null;
  1426. a = xc && !xc[0];
  1427. b = yc && !yc[0];
  1428. if (a || b) return a ? b ? 0 : -j : i;
  1429. if (i != j) return i;
  1430. a = i < 0;
  1431. b = k == l;
  1432. if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1;
  1433. if (!b) return k > l ^ a ? 1 : -1;
  1434. j = (k = xc.length) < (l = yc.length) ? k : l;
  1435. for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;
  1436. return k == l ? 0 : k > l ^ a ? 1 : -1;
  1437. }
  1438. function intCheck(n, min, max, name) {
  1439. if (n < min || n > max || n !== mathfloor(n)) {
  1440. throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min || n > max ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
  1441. }
  1442. }
  1443. function isOdd(n) {
  1444. var k = n.c.length - 1;
  1445. return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0;
  1446. }
  1447. function toExponential(str, e) {
  1448. return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e < 0 ? "e" : "e+") + e;
  1449. }
  1450. function toFixedPoint(str, e, z) {
  1451. var len, zs;
  1452. if (e < 0) {
  1453. for (zs = z + "."; ++e; zs += z) ;
  1454. str = zs + str;
  1455. } else {
  1456. len = str.length;
  1457. if (++e > len) {
  1458. for (zs = z, e -= len; --e; zs += z) ;
  1459. str += zs;
  1460. } else if (e < len) {
  1461. str = str.slice(0, e) + "." + str.slice(e);
  1462. }
  1463. }
  1464. return str;
  1465. }
  1466. BigNumber2 = clone();
  1467. BigNumber2["default"] = BigNumber2.BigNumber = BigNumber2;
  1468. if (module.exports) {
  1469. module.exports = BigNumber2;
  1470. } else {
  1471. if (!globalObject) {
  1472. globalObject = typeof self != "undefined" && self ? self : window;
  1473. }
  1474. globalObject.BigNumber = BigNumber2;
  1475. }
  1476. })(commonjsGlobal);
  1477. })(bignumber);
  1478. var bignumberExports = bignumber.exports;
  1479. (function(module) {
  1480. var BigNumber2 = bignumberExports;
  1481. var JSON2 = module.exports;
  1482. (function() {
  1483. var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = {
  1484. // table of character substitutions
  1485. "\b": "\\b",
  1486. " ": "\\t",
  1487. "\n": "\\n",
  1488. "\f": "\\f",
  1489. "\r": "\\r",
  1490. '"': '\\"',
  1491. "\\": "\\\\"
  1492. }, rep;
  1493. function quote(string) {
  1494. escapable.lastIndex = 0;
  1495. return escapable.test(string) ? '"' + string.replace(escapable, function(a) {
  1496. var c = meta[a];
  1497. return typeof c === "string" ? c : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
  1498. }) + '"' : '"' + string + '"';
  1499. }
  1500. function str(key, holder) {
  1501. var i, k, v, length, mind = gap, partial, value = holder[key], isBigNumber = value != null && (value instanceof BigNumber2 || BigNumber2.isBigNumber(value));
  1502. if (value && typeof value === "object" && typeof value.toJSON === "function") {
  1503. value = value.toJSON(key);
  1504. }
  1505. if (typeof rep === "function") {
  1506. value = rep.call(holder, key, value);
  1507. }
  1508. switch (typeof value) {
  1509. case "string":
  1510. if (isBigNumber) {
  1511. return value;
  1512. } else {
  1513. return quote(value);
  1514. }
  1515. case "number":
  1516. return isFinite(value) ? String(value) : "null";
  1517. case "boolean":
  1518. case "null":
  1519. case "bigint":
  1520. return String(value);
  1521. case "object":
  1522. if (!value) {
  1523. return "null";
  1524. }
  1525. gap += indent;
  1526. partial = [];
  1527. if (Object.prototype.toString.apply(value) === "[object Array]") {
  1528. length = value.length;
  1529. for (i = 0; i < length; i += 1) {
  1530. partial[i] = str(i, value) || "null";
  1531. }
  1532. v = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]";
  1533. gap = mind;
  1534. return v;
  1535. }
  1536. if (rep && typeof rep === "object") {
  1537. length = rep.length;
  1538. for (i = 0; i < length; i += 1) {
  1539. if (typeof rep[i] === "string") {
  1540. k = rep[i];
  1541. v = str(k, value);
  1542. if (v) {
  1543. partial.push(quote(k) + (gap ? ": " : ":") + v);
  1544. }
  1545. }
  1546. }
  1547. } else {
  1548. Object.keys(value).forEach(function(k2) {
  1549. var v2 = str(k2, value);
  1550. if (v2) {
  1551. partial.push(quote(k2) + (gap ? ": " : ":") + v2);
  1552. }
  1553. });
  1554. }
  1555. v = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}";
  1556. gap = mind;
  1557. return v;
  1558. }
  1559. }
  1560. if (typeof JSON2.stringify !== "function") {
  1561. JSON2.stringify = function(value, replacer, space) {
  1562. var i;
  1563. gap = "";
  1564. indent = "";
  1565. if (typeof space === "number") {
  1566. for (i = 0; i < space; i += 1) {
  1567. indent += " ";
  1568. }
  1569. } else if (typeof space === "string") {
  1570. indent = space;
  1571. }
  1572. rep = replacer;
  1573. if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) {
  1574. throw new Error("JSON.stringify");
  1575. }
  1576. return str("", { "": value });
  1577. };
  1578. }
  1579. })();
  1580. })(stringify);
  1581. var stringifyExports = stringify.exports;
  1582. var BigNumber = null;
  1583. const suspectProtoRx = /(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/;
  1584. const suspectConstructorRx = /(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;
  1585. var json_parse$1 = function(options) {
  1586. var _options = {
  1587. strict: false,
  1588. // not being strict means do not generate syntax errors for "duplicate key"
  1589. storeAsString: false,
  1590. // toggles whether the values should be stored as BigNumber (default) or a string
  1591. alwaysParseAsBig: false,
  1592. // toggles whether all numbers should be Big
  1593. useNativeBigInt: false,
  1594. // toggles whether to use native BigInt instead of bignumber.js
  1595. protoAction: "error",
  1596. constructorAction: "error"
  1597. };
  1598. if (options !== void 0 && options !== null) {
  1599. if (options.strict === true) {
  1600. _options.strict = true;
  1601. }
  1602. if (options.storeAsString === true) {
  1603. _options.storeAsString = true;
  1604. }
  1605. _options.alwaysParseAsBig = options.alwaysParseAsBig === true ? options.alwaysParseAsBig : false;
  1606. _options.useNativeBigInt = options.useNativeBigInt === true ? options.useNativeBigInt : false;
  1607. if (typeof options.constructorAction !== "undefined") {
  1608. if (options.constructorAction === "error" || options.constructorAction === "ignore" || options.constructorAction === "preserve") {
  1609. _options.constructorAction = options.constructorAction;
  1610. } else {
  1611. throw new Error(
  1612. `Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${options.constructorAction}`
  1613. );
  1614. }
  1615. }
  1616. if (typeof options.protoAction !== "undefined") {
  1617. if (options.protoAction === "error" || options.protoAction === "ignore" || options.protoAction === "preserve") {
  1618. _options.protoAction = options.protoAction;
  1619. } else {
  1620. throw new Error(
  1621. `Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${options.protoAction}`
  1622. );
  1623. }
  1624. }
  1625. }
  1626. var at, ch, escapee = {
  1627. '"': '"',
  1628. "\\": "\\",
  1629. "/": "/",
  1630. b: "\b",
  1631. f: "\f",
  1632. n: "\n",
  1633. r: "\r",
  1634. t: " "
  1635. }, text, error = function(m) {
  1636. throw {
  1637. name: "SyntaxError",
  1638. message: m,
  1639. at,
  1640. text
  1641. };
  1642. }, next = function(c) {
  1643. if (c && c !== ch) {
  1644. error("Expected '" + c + "' instead of '" + ch + "'");
  1645. }
  1646. ch = text.charAt(at);
  1647. at += 1;
  1648. return ch;
  1649. }, number = function() {
  1650. var number2, string2 = "";
  1651. if (ch === "-") {
  1652. string2 = "-";
  1653. next("-");
  1654. }
  1655. while (ch >= "0" && ch <= "9") {
  1656. string2 += ch;
  1657. next();
  1658. }
  1659. if (ch === ".") {
  1660. string2 += ".";
  1661. while (next() && ch >= "0" && ch <= "9") {
  1662. string2 += ch;
  1663. }
  1664. }
  1665. if (ch === "e" || ch === "E") {
  1666. string2 += ch;
  1667. next();
  1668. if (ch === "-" || ch === "+") {
  1669. string2 += ch;
  1670. next();
  1671. }
  1672. while (ch >= "0" && ch <= "9") {
  1673. string2 += ch;
  1674. next();
  1675. }
  1676. }
  1677. number2 = +string2;
  1678. if (!isFinite(number2)) {
  1679. error("Bad number");
  1680. } else {
  1681. if (BigNumber == null) BigNumber = bignumberExports;
  1682. if (string2.length > 15)
  1683. return _options.storeAsString ? string2 : _options.useNativeBigInt ? BigInt(string2) : new BigNumber(string2);
  1684. else
  1685. return !_options.alwaysParseAsBig ? number2 : _options.useNativeBigInt ? BigInt(number2) : new BigNumber(number2);
  1686. }
  1687. }, string = function() {
  1688. var hex, i, string2 = "", uffff;
  1689. if (ch === '"') {
  1690. var startAt = at;
  1691. while (next()) {
  1692. if (ch === '"') {
  1693. if (at - 1 > startAt) string2 += text.substring(startAt, at - 1);
  1694. next();
  1695. return string2;
  1696. }
  1697. if (ch === "\\") {
  1698. if (at - 1 > startAt) string2 += text.substring(startAt, at - 1);
  1699. next();
  1700. if (ch === "u") {
  1701. uffff = 0;
  1702. for (i = 0; i < 4; i += 1) {
  1703. hex = parseInt(next(), 16);
  1704. if (!isFinite(hex)) {
  1705. break;
  1706. }
  1707. uffff = uffff * 16 + hex;
  1708. }
  1709. string2 += String.fromCharCode(uffff);
  1710. } else if (typeof escapee[ch] === "string") {
  1711. string2 += escapee[ch];
  1712. } else {
  1713. break;
  1714. }
  1715. startAt = at;
  1716. }
  1717. }
  1718. }
  1719. error("Bad string");
  1720. }, white = function() {
  1721. while (ch && ch <= " ") {
  1722. next();
  1723. }
  1724. }, word = function() {
  1725. switch (ch) {
  1726. case "t":
  1727. next("t");
  1728. next("r");
  1729. next("u");
  1730. next("e");
  1731. return true;
  1732. case "f":
  1733. next("f");
  1734. next("a");
  1735. next("l");
  1736. next("s");
  1737. next("e");
  1738. return false;
  1739. case "n":
  1740. next("n");
  1741. next("u");
  1742. next("l");
  1743. next("l");
  1744. return null;
  1745. }
  1746. error("Unexpected '" + ch + "'");
  1747. }, value, array = function() {
  1748. var array2 = [];
  1749. if (ch === "[") {
  1750. next("[");
  1751. white();
  1752. if (ch === "]") {
  1753. next("]");
  1754. return array2;
  1755. }
  1756. while (ch) {
  1757. array2.push(value());
  1758. white();
  1759. if (ch === "]") {
  1760. next("]");
  1761. return array2;
  1762. }
  1763. next(",");
  1764. white();
  1765. }
  1766. }
  1767. error("Bad array");
  1768. }, object = function() {
  1769. var key, object2 = /* @__PURE__ */ Object.create(null);
  1770. if (ch === "{") {
  1771. next("{");
  1772. white();
  1773. if (ch === "}") {
  1774. next("}");
  1775. return object2;
  1776. }
  1777. while (ch) {
  1778. key = string();
  1779. white();
  1780. next(":");
  1781. if (_options.strict === true && Object.hasOwnProperty.call(object2, key)) {
  1782. error('Duplicate key "' + key + '"');
  1783. }
  1784. if (suspectProtoRx.test(key) === true) {
  1785. if (_options.protoAction === "error") {
  1786. error("Object contains forbidden prototype property");
  1787. } else if (_options.protoAction === "ignore") {
  1788. value();
  1789. } else {
  1790. object2[key] = value();
  1791. }
  1792. } else if (suspectConstructorRx.test(key) === true) {
  1793. if (_options.constructorAction === "error") {
  1794. error("Object contains forbidden constructor property");
  1795. } else if (_options.constructorAction === "ignore") {
  1796. value();
  1797. } else {
  1798. object2[key] = value();
  1799. }
  1800. } else {
  1801. object2[key] = value();
  1802. }
  1803. white();
  1804. if (ch === "}") {
  1805. next("}");
  1806. return object2;
  1807. }
  1808. next(",");
  1809. white();
  1810. }
  1811. }
  1812. error("Bad object");
  1813. };
  1814. value = function() {
  1815. white();
  1816. switch (ch) {
  1817. case "{":
  1818. return object();
  1819. case "[":
  1820. return array();
  1821. case '"':
  1822. return string();
  1823. case "-":
  1824. return number();
  1825. default:
  1826. return ch >= "0" && ch <= "9" ? number() : word();
  1827. }
  1828. };
  1829. return function(source, reviver) {
  1830. var result;
  1831. text = source + "";
  1832. at = 0;
  1833. ch = " ";
  1834. result = value();
  1835. white();
  1836. if (ch) {
  1837. error("Syntax error");
  1838. }
  1839. return typeof reviver === "function" ? function walk(holder, key) {
  1840. var v, value2 = holder[key];
  1841. if (value2 && typeof value2 === "object") {
  1842. Object.keys(value2).forEach(function(k) {
  1843. v = walk(value2, k);
  1844. if (v !== void 0) {
  1845. value2[k] = v;
  1846. } else {
  1847. delete value2[k];
  1848. }
  1849. });
  1850. }
  1851. return reviver.call(holder, key, value2);
  1852. }({ "": result }, "") : result;
  1853. };
  1854. };
  1855. var parse = json_parse$1;
  1856. var json_stringify = stringifyExports.stringify;
  1857. var json_parse = parse;
  1858. jsonBigint.exports = function(options) {
  1859. return {
  1860. parse: json_parse(options),
  1861. stringify: json_stringify
  1862. };
  1863. };
  1864. jsonBigint.exports.parse = json_parse();
  1865. jsonBigint.exports.stringify = json_stringify;
  1866. var jsonBigintExports = jsonBigint.exports;
  1867. const JSONbig = /* @__PURE__ */ getDefaultExportFromCjs(jsonBigintExports);
  1868. var _GM_addStyle = /* @__PURE__ */ (() => typeof GM_addStyle != "undefined" ? GM_addStyle : void 0)();
  1869. var _GM_getValue = exports("b", /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)());
  1870. var _GM_openInTab = /* @__PURE__ */ (() => typeof GM_openInTab != "undefined" ? GM_openInTab : void 0)();
  1871. var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
  1872. var _GM_setClipboard = exports("c", /* @__PURE__ */ (() => typeof GM_setClipboard != "undefined" ? GM_setClipboard : void 0)());
  1873. var _GM_setValue = exports("_", /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)());
  1874. var _unsafeWindow = exports("a", /* @__PURE__ */ (() => typeof unsafeWindow != "undefined" ? unsafeWindow : void 0)());
  1875. const JSON = JSONbig({ useNativeBigInt: true });
  1876. NodeList.prototype.filter = Array.prototype.filter;
  1877. NodeList.prototype.some = Array.prototype.some;
  1878. NodeList.prototype.map = Array.prototype.map;
  1879. const Utils = exports("U", {
  1880. isImg: function(str) {
  1881. const regexp = /\.(ico|bmp|gif|jpg|jpeg|png|svg|webp|GIF|JPG|PNG|WEBP|SVG)([\w#!:.?+=&%@!\-\/])?/i;
  1882. return regexp.test(str);
  1883. },
  1884. isJSON: function(str) {
  1885. try {
  1886. JSON.parse(str);
  1887. return true;
  1888. } catch (e) {
  1889. console.log("is not json");
  1890. return false;
  1891. }
  1892. },
  1893. parse: function(text, reviver) {
  1894. return JSON.parse(text, reviver);
  1895. },
  1896. stringify: function(value, replacer, space) {
  1897. return JSON.stringify(value, replacer, space);
  1898. },
  1899. getType: function(v) {
  1900. return Object.prototype.toString.call(v).match(/\s(.+)]/)[1].toLowerCase();
  1901. },
  1902. getPrototype: function(val) {
  1903. return Object.prototype.toString.call(val).match(/\s(.+)]/)[1];
  1904. },
  1905. findMaxKeysObject: function(arr) {
  1906. let maxKeysCount = 0;
  1907. let maxKeysObject;
  1908. for (const obj of arr) {
  1909. const keysCount = Object.keys(obj).length;
  1910. if (keysCount > maxKeysCount) {
  1911. maxKeysCount = keysCount;
  1912. maxKeysObject = obj;
  1913. }
  1914. }
  1915. return maxKeysObject;
  1916. },
  1917. randomColor: (opacity) => {
  1918. const red = Math.floor(Math.random() * 256);
  1919. const green = Math.floor(Math.random() * 256);
  1920. const blue = Math.floor(Math.random() * 256);
  1921. return `rgba(${red}, ${green}, ${blue}, ${opacity})`;
  1922. },
  1923. downloadText: function(content, filename) {
  1924. const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
  1925. const url = URL.createObjectURL(blob);
  1926. const link = document.createElement("a");
  1927. link.href = url;
  1928. link.download = filename;
  1929. link.click();
  1930. URL.revokeObjectURL(url);
  1931. },
  1932. matchJsonp: function(rawText) {
  1933. const tokens = rawText.match(/^([^\s(]*)\s*\(([\s\S]*)\)\s*;?$/);
  1934. if (tokens && tokens[1] && tokens[2]) {
  1935. return {
  1936. rawText: tokens[2],
  1937. jsonpFun: tokens[1]
  1938. };
  1939. }
  1940. return {
  1941. rawText,
  1942. jsonpFun: null
  1943. };
  1944. },
  1945. debounce: function(fn, delay = 300) {
  1946. let timer;
  1947. return function() {
  1948. if (timer) clearTimeout(timer);
  1949. timer = setTimeout(() => fn.apply(this, arguments), delay);
  1950. };
  1951. },
  1952. setClipboard: function(text) {
  1953. if (_GM_setClipboard) {
  1954. _GM_setClipboard(text);
  1955. } else if (navigator.clipboard) {
  1956. navigator.clipboard.writeText(text);
  1957. } else {
  1958. let textArea = document.createElement("textarea");
  1959. textArea.value = text;
  1960. textArea.style.position = "absolute";
  1961. textArea.style.opacity = 0;
  1962. textArea.style.left = "-999999px";
  1963. textArea.style.top = "-999999px";
  1964. document.body.appendChild(textArea);
  1965. textArea.focus();
  1966. textArea.select();
  1967. document.execCommand("copy");
  1968. textArea.remove();
  1969. }
  1970. },
  1971. addEvent: function(eventType, selector, callback) {
  1972. const types = eventType.split(" ");
  1973. types.forEach((type) => {
  1974. function handler(event) {
  1975. let target = event.target;
  1976. if (!target.matches) return;
  1977. while (!target.matches(selector)) {
  1978. target = target.parentNode;
  1979. if (!target || !target.matches) return;
  1980. }
  1981. Object.defineProperty(event, "currentTarget", {
  1982. configurable: true,
  1983. get: function() {
  1984. return target;
  1985. }
  1986. });
  1987. const returnValue = callback.call(target, event);
  1988. if (returnValue === false) {
  1989. event.preventDefault();
  1990. event.stopPropagation();
  1991. }
  1992. event.stopImmediatePropagation();
  1993. }
  1994. document.addEventListener(type, handler, true);
  1995. });
  1996. },
  1997. isVisible: function(ele) {
  1998. const style = getComputedStyle(ele);
  1999. const display = style.display;
  2000. const visibility = style.visibility;
  2001. const hasWidth = ele.offsetWidth > 0;
  2002. const hasHeight = ele.offsetHeight > 0;
  2003. return !Object.is(display, "none") && !Object.is(visibility, "hidden") && hasWidth && hasHeight;
  2004. },
  2005. createElement: function(name, attrs) {
  2006. const element = document.createElement(name);
  2007. if (attrs) this.attr(element, attrs);
  2008. return element;
  2009. },
  2010. attr: function(ele, attrs, value) {
  2011. if (!ele) return;
  2012. if (typeof attrs === "object") {
  2013. for (const name in attrs) {
  2014. if (Object.prototype.hasOwnProperty.call(attrs, name)) {
  2015. ele.setAttribute(name, attrs[name]);
  2016. }
  2017. }
  2018. return;
  2019. }
  2020. if (value === void 0) return ele.getAttribute(attrs);
  2021. if (!value) return ele.removeAttribute(attrs);
  2022. ele.setAttribute(attrs, value);
  2023. },
  2024. query: function(selector, context) {
  2025. const ctx = context || document;
  2026. if (selector instanceof HTMLElement) return selector;
  2027. return ctx.querySelector(selector);
  2028. },
  2029. queryAll: function(selector, context) {
  2030. const ctx = context || document;
  2031. if (selector instanceof HTMLElement) {
  2032. return new NodeList(selector);
  2033. }
  2034. if (selector instanceof NodeList) {
  2035. return selector;
  2036. }
  2037. return ctx.querySelectorAll(selector);
  2038. },
  2039. addClass(ele, className) {
  2040. if (!ele) return;
  2041. if (ele instanceof HTMLElement) {
  2042. return ele.classList.add(className);
  2043. }
  2044. if (ele instanceof NodeList || ele instanceof Array) {
  2045. ele.forEach((el) => this.addClass(el, className));
  2046. }
  2047. },
  2048. removeClass(ele, className) {
  2049. if (!ele) return;
  2050. if (ele instanceof HTMLElement) {
  2051. const classList = ele.classList;
  2052. if (className === void 0) {
  2053. while (classList.length > 0) {
  2054. classList.remove(classList.item(0));
  2055. }
  2056. return;
  2057. }
  2058. return classList.remove(className);
  2059. }
  2060. if (ele instanceof NodeList || ele instanceof Array) {
  2061. ele.forEach((el) => this.removeClass(el, className));
  2062. }
  2063. },
  2064. toggleClass: function(ele, className) {
  2065. if (!ele) return;
  2066. this.hasClass(ele, className) ? this.removeClass(ele, className) : this.addClass(ele, className);
  2067. },
  2068. hasClass(ele, className) {
  2069. if (!ele) return false;
  2070. if (ele instanceof HTMLElement) {
  2071. return ele.classList.contains(className);
  2072. }
  2073. if (ele instanceof NodeList) {
  2074. return ele.some((el) => this.hasClass(el, className));
  2075. }
  2076. },
  2077. show: function(ele) {
  2078. const style = ele.style;
  2079. if (style.display !== "none") return;
  2080. style.display = "block";
  2081. const defaultDisplay = ele.defaultDisplay;
  2082. if (defaultDisplay && defaultDisplay !== "none") {
  2083. style.display = defaultDisplay;
  2084. }
  2085. },
  2086. hide: function(ele) {
  2087. if (!ele.defaultDisplay) {
  2088. const display = getComputedStyle(ele).display;
  2089. ele.defaultDisplay = display;
  2090. }
  2091. ele.style.display = "none";
  2092. }
  2093. });
  2094. const URL$1 = exports("e", {
  2095. JSON_CRACK_WIDGET: "https://jsoncrack.feny.ink/widget",
  2096. EXAMPLE_JSON: "https://fetch-api.feny.ink/example.json",
  2097. ONLINE_REQUEST: "https://fetch-api.feny.ink/httpRequest",
  2098. LAYUI_JS: "https://unpkg.com/layui@2.7.6/dist/layui.js"
  2099. });
  2100. const layout = `
  2101. <template data-for="viewFormater">
  2102. <div class="toolbar-item btn" id="saveJson">保存</div>
  2103. <div class="toolbar-item btn" id="copyJson">复制</div>
  2104. <div class="toolbar-item btn" id="collapseAll">全部折叠</div>
  2105. <div class="toolbar-item btn" id="expandAll">全部展开</div>
  2106. <div class="searchbox">
  2107. <input type="text" placeholder="JSON 过滤"/>
  2108. <button class="clear" hidden></button>
  2109. </div>
  2110. </template>
  2111. <template data-for="viewMind">
  2112. <div class="toolbar-item btn" id="saveJson">保存</div>
  2113. <div class="toolbar-item btn" id="collapseAll">全部折叠</div>
  2114. <div class="toolbar-item btn" id="expandAll">全部展开</div>
  2115. <div class="toolbar-item btn" id="jsoncrack">JSON Crack</div>
  2116. </template>
  2117. <template data-for="viewRawText">
  2118. <div class="toolbar-item btn" id="saveJson">保存</div>
  2119. <div class="toolbar-item btn" id="copyJson">复制</div>
  2120. <div class="toolbar-item btn" id="beautify">美化输出</div>
  2121. </template>
  2122. <div class="json-viewer-layout">
  2123. <div class="panel">
  2124. <div class="tabs">
  2125. <div class="tabs-item btn active" id="viewFormater">JSON 格式化</div>
  2126. <div class="tabs-item btn" id="viewMind">JSON 脑图</div>
  2127. <div class="tabs-item btn" id="viewRawText">原始数据</div>
  2128. </div>
  2129. <div class="toolbar">
  2130. <div class="toolbar-item btn" id="saveJson">保存</div>
  2131. <div class="toolbar-item btn" id="copyJson">复制</div>
  2132. <div class="toolbar-item btn" id="collapseAll">全部折叠</div>
  2133. <div class="toolbar-item btn" id="expandAll">全部展开</div>
  2134. <div class="searchbox">
  2135. <input type="text" placeholder="JSON 过滤"/>
  2136. <button class="clear" hidden></button>
  2137. </div>
  2138. </div>
  2139. <div class="rightbox">
  2140. <div class="style">
  2141. <span>风格</span>
  2142. <template data-type="style">
  2143. <ul>
  2144. <li data-type="style" data-value="default">默认</li>
  2145. <li data-type="style" data-value="table">表格</li>
  2146. </ul>
  2147. </template>
  2148. </div>
  2149. <div class="theme">
  2150. <span>主题</span>
  2151. <template data-type="theme">
  2152. <ul>
  2153. <li data-type="theme" data-value="default">默认</li>
  2154. <li data-type="theme" data-value="light">浅色</li>
  2155. <li data-type="theme" data-value="dark">暗黑</li>
  2156. <li data-type="theme" data-value="dark-plus">暗黑+</li>
  2157. </ul>
  2158. </template>
  2159. </div>
  2160. <div class="tools">
  2161. <span>工具</span>
  2162. <template data-type="tools">
  2163. <ul>
  2164. <li data-type="tools" data-value="inputJson">JSON 输入</li>
  2165. <li data-type="tools" data-value="fetchApi">HTTP 请求</li>
  2166. </ul>
  2167. </template>
  2168. </div>
  2169. </div>
  2170. </div>
  2171. <div class="container">
  2172. <div class="active" data-for="viewFormater" id="formatBox"></div>
  2173. <div data-for="viewMind" id="mindBox"></div>
  2174. <div data-for="viewRawText" id="rawTextBox">
  2175. <pre></pre>
  2176. </div>
  2177. </div>
  2178. </div>`;
  2179. const { EXAMPLE_JSON, LAYUI_JS } = URL$1;
  2180. (function() {
  2181. const openInTab = () => _GM_openInTab(EXAMPLE_JSON);
  2182. _GM_registerMenuCommand("测试JSON( Alt + j )", openInTab);
  2183. window.addEventListener("keydown", function(event) {
  2184. const { key, altKey } = event;
  2185. if (altKey && key.toLowerCase() === "j") openInTab();
  2186. });
  2187. const innerText = document.body.innerText;
  2188. const { rawText, jsonpFun } = Utils.matchJsonp(innerText);
  2189. _unsafeWindow.RAW_TEXT = rawText;
  2190. _unsafeWindow.GLOBAL_JSONP_FUN = jsonpFun;
  2191. if (!Utils.isJSON(_unsafeWindow.RAW_TEXT)) {
  2192. __vitePreload(() => module.import('./index-DkZtaPvN-Be9la_OH.js'), void 0 );
  2193. return;
  2194. }
  2195. Utils.hide(Utils.query("pre"));
  2196. Utils.addClass(Utils.query("html"), "monkey-jsonviewer");
  2197. window.postMessage({ addStyle: true });
  2198. setTimeout(() => {
  2199. const meta = Utils.createElement("meta", {
  2200. name: "viewport",
  2201. content: "width=device-width, initial-scale=1.0"
  2202. });
  2203. document.head.appendChild(meta);
  2204. const script = Utils.createElement("script", {
  2205. src: LAYUI_JS,
  2206. type: "text/javascript"
  2207. });
  2208. document.head.appendChild(script);
  2209. _GM_addStyle(`
  2210. jmnode.root::before{background-color: ${Utils.randomColor(0.5)}}
  2211. jmnode:not(.root)::before{background-color: ${Utils.randomColor(0.5)}}
  2212. `);
  2213. document.body.insertAdjacentHTML("afterbegin", layout);
  2214. _unsafeWindow.GLOBAL_JSON = Utils.parse(_unsafeWindow.RAW_TEXT);
  2215. __vitePreload(() => module.import('./index-BaGRGkVb-D2geKy17.js'), void 0 );
  2216. __vitePreload(() => module.import('./index-Btt8fXSQ-DuZkUtAR.js'), void 0 );
  2217. __vitePreload(() => module.import('./index-DH4sstV0-D5_y4vAd.js'), void 0 );
  2218. });
  2219. })();
  2220.  
  2221. })
  2222. };
  2223. }));
  2224.  
  2225. System.register("./index-DkZtaPvN-Be9la_OH.js", ['highlight.js', 'beautifier', './__monkey.entry-BOyf9HZs.js'], (function (exports, module) {
  2226. 'use strict';
  2227. var hljs, css_beautify, js_beautify, Utils;
  2228. return {
  2229. setters: [module => {
  2230. hljs = module.default;
  2231. }, module => {
  2232. css_beautify = module.css_beautify;
  2233. js_beautify = module.js_beautify;
  2234. }, module => {
  2235. Utils = module.U;
  2236. }],
  2237. execute: (function () {
  2238.  
  2239. const layout = `
  2240. <div class="beautify_checkbox">
  2241. <input type="checkbox" id="beautify"/>
  2242. <label for="beautify">美化输出</label>
  2243. </div>`;
  2244. (function() {
  2245. const docType = [
  2246. "application/x-javascript",
  2247. "application/javascript",
  2248. "text/javascript",
  2249. "text/css"
  2250. ];
  2251. const contentType = document.contentType;
  2252. if (!docType.includes(contentType)) return;
  2253. const preElement = Utils.query("pre");
  2254. if (!preElement) return;
  2255. window.postMessage({ addStyle: true });
  2256. Utils.addClass(Utils.query("html"), "monkey-js-css-beautify");
  2257. setTimeout(() => {
  2258. const rawText = preElement.innerText;
  2259. document.body.insertAdjacentHTML("afterbegin", layout);
  2260. const checkbox = Utils.query(".beautify_checkbox input");
  2261. checkbox.addEventListener("click", function() {
  2262. if (this.checked) {
  2263. beautifyCode(contentType, preElement, rawText);
  2264. } else {
  2265. preElement.innerText = rawText;
  2266. }
  2267. });
  2268. });
  2269. })();
  2270. function beautifyCode(contentType, element, rawText) {
  2271. const language = contentType.substring(contentType.indexOf("/") + 1);
  2272. if (!["css", "javascript", "x-javascript"].includes(language)) {
  2273. return;
  2274. }
  2275. let beautifyCode2;
  2276. if ("css" === language) {
  2277. const cssBeautify = css_beautify ? css_beautify : window.css_beautify;
  2278. beautifyCode2 = cssBeautify(rawText);
  2279. beautifyCode2 = hljs.highlight(beautifyCode2, {
  2280. language
  2281. }).value;
  2282. } else {
  2283. const jsBeautify = js_beautify ? js_beautify : window.js_beautify;
  2284. beautifyCode2 = jsBeautify(rawText);
  2285. beautifyCode2 = hljs.highlight(beautifyCode2, {
  2286. language: "javascript"
  2287. }).value;
  2288. }
  2289. element.innerHTML = `<code>${beautifyCode2}</code>`;
  2290. }
  2291.  
  2292. })
  2293. };
  2294. }));
  2295.  
  2296. System.register("./index-BaGRGkVb-D2geKy17.js", ['./__monkey.entry-BOyf9HZs.js', './tippy.esm-Ot9MORvr-DNGa7Opj.js'], (function (exports, module) {
  2297. 'use strict';
  2298. var _GM_setValue, Utils, _unsafeWindow, _GM_getValue, _GM_setClipboard, tippy;
  2299. return {
  2300. setters: [module => {
  2301. _GM_setValue = module._;
  2302. Utils = module.U;
  2303. _unsafeWindow = module.a;
  2304. _GM_getValue = module.b;
  2305. _GM_setClipboard = module.c;
  2306. }, module => {
  2307. tippy = module.t;
  2308. }],
  2309. execute: (function () {
  2310.  
  2311. var __defProp = Object.defineProperty;
  2312. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  2313. var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
  2314. class JsonFormat {
  2315. constructor(options) {
  2316. __publicField(this, "DEFAULTS", {
  2317. json: null,
  2318. style: "table",
  2319. theme: "default",
  2320. container: null,
  2321. expander: null,
  2322. onExpand: null,
  2323. collapser: null,
  2324. onCollapse: null
  2325. });
  2326. this.options = Object.assign(this.DEFAULTS, options);
  2327. if (!options.container) throw new Error("Container is required");
  2328. if (!options.json) throw new Error("json is required");
  2329. this.render();
  2330. this.bindEvent();
  2331. this.setTheme(this.options.theme);
  2332. }
  2333. render() {
  2334. }
  2335. setTheme(theme) {
  2336. const classList = document.body.classList;
  2337. classList.forEach((clas) => {
  2338. if (clas.includes("theme")) classList.remove(clas);
  2339. });
  2340. classList.add(`${theme}-theme`);
  2341. }
  2342. bindEvent() {
  2343. const { expander, collapser, onExpand, onCollapse } = this.options;
  2344. if (expander) this.addEvent(`click`, expander, () => this.expandAll());
  2345. if (collapser) this.addEvent(`click`, collapser, () => this.collapseAll());
  2346. this.addEvent("click", ".json-formater-copy", (e) => {
  2347. const target = e.currentTarget;
  2348. const className = "success";
  2349. if (!target.json || Utils.hasClass(target, className)) return;
  2350. Utils.setClipboard(Utils.stringify(target.json, null, 2));
  2351. Utils.addClass(target, className);
  2352. setTimeout(() => Utils.removeClass(target, className), 1500);
  2353. });
  2354. this.addEvent("click", ".json-formater-placeholder", (e) => {
  2355. const node = this.closest(e.currentTarget, ".json-formater-item");
  2356. this.show(node);
  2357. });
  2358. this.addEvent("click", ".json-formater-arrow", (e) => {
  2359. const node = this.closest(e.currentTarget, ".json-formater-item");
  2360. if (Utils.hasClass(node, "json-formater-opened")) {
  2361. this.hide(node);
  2362. if (onCollapse) onCollapse(node, this);
  2363. } else {
  2364. this.show(node);
  2365. if (onExpand) onExpand(node, this);
  2366. }
  2367. });
  2368. }
  2369. expandAll() {
  2370. this.nodes().forEach((node) => this.show(node));
  2371. }
  2372. collapseAll() {
  2373. this.nodes().forEach((node) => this.hide(node));
  2374. }
  2375. show(node) {
  2376. Utils.removeClass(node, "json-formater-closed");
  2377. Utils.addClass(node, "json-formater-opened");
  2378. this.showDescs(node);
  2379. this.onShow(node);
  2380. }
  2381. showDescs(node) {
  2382. const type = this.options.style;
  2383. let children = this.findChildren(node);
  2384. children.forEach((child) => {
  2385. child.style.display = null;
  2386. if (type === "table" && Utils.hasClass(child, "json-formater-opened")) {
  2387. this.showDescs(child);
  2388. }
  2389. });
  2390. }
  2391. onShow(node) {
  2392. }
  2393. hide(node) {
  2394. Utils.removeClass(node, "json-formater-opened");
  2395. Utils.addClass(node, "json-formater-closed");
  2396. this.hideDescs(node);
  2397. this.onHide(node);
  2398. }
  2399. hideDescs(node) {
  2400. const children = this.findChildren(node);
  2401. children.forEach((child) => {
  2402. child.style.display = "none";
  2403. if (this.options.style === "table") this.hideDescs(child);
  2404. });
  2405. }
  2406. onHide(node) {
  2407. }
  2408. findChildren(node) {
  2409. const pid = node.dataset.nodeId;
  2410. return Utils.queryAll(`*[data-node-pid="${pid}"]`, this.$container);
  2411. }
  2412. findByID(id) {
  2413. return Utils.query(`*[data-node-id="${id}"]`, this.$container);
  2414. }
  2415. openByID(id) {
  2416. this.show(this.findByID(id));
  2417. }
  2418. closeByID(id) {
  2419. this.hide(this.findByID(id));
  2420. }
  2421. nodes() {
  2422. return Utils.queryAll("*[data-node-id]", this.$container);
  2423. }
  2424. createElement(name, attrs) {
  2425. return Utils.createElement(name, attrs);
  2426. }
  2427. addEvent(type, selector, fn) {
  2428. Utils.queryAll(selector).forEach((el) => el.addEventListener(type, fn));
  2429. }
  2430. closest(element, selector) {
  2431. while (element) {
  2432. if (element.matches(selector)) return element;
  2433. element = element.parentElement;
  2434. }
  2435. return null;
  2436. }
  2437. JSONPath(path, key) {
  2438. if (this.isNumber(key)) return `${path}[${key}]`;
  2439. if (key.includes(".")) return `${path}["${key}"]`;
  2440. return path + "." + key;
  2441. }
  2442. isNumber(str) {
  2443. return /^\d+$/.test(str);
  2444. }
  2445. getType(value) {
  2446. return Object.prototype.toString.call(value).match(/\s(.+)]/)[1].toLowerCase();
  2447. }
  2448. isIterate(value) {
  2449. const type = this.getType(value);
  2450. return ["array", "object"].includes(type);
  2451. }
  2452. canIterate(value) {
  2453. if (!this.isIterate(value)) return false;
  2454. return Object.keys(value).length > 0;
  2455. }
  2456. isUrl(str) {
  2457. const regexp = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
  2458. return regexp.test(str);
  2459. }
  2460. escape(str) {
  2461. return str.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
  2462. }
  2463. isColor(colorString) {
  2464. const hexCodeRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
  2465. const rgbRegex = /^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/;
  2466. const rgbaRegex = /^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(0|1|0\.\d+)\s*\)$/;
  2467. return hexCodeRegex.test(colorString) || rgbRegex.test(colorString) || rgbaRegex.test(colorString);
  2468. }
  2469. random() {
  2470. let randomString = "";
  2471. const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  2472. for (let i = 0; i < 10; i++) {
  2473. const randomIndex = Math.floor(Math.random() * characters.length);
  2474. randomString += characters.charAt(randomIndex);
  2475. }
  2476. return randomString;
  2477. }
  2478. }
  2479. class JsonViewer extends JsonFormat {
  2480. constructor(options) {
  2481. options.style = "viewer";
  2482. super(options);
  2483. }
  2484. render() {
  2485. const { json, container } = this.options;
  2486. this.$container = Utils.query(container);
  2487. this.$container.innerHTML = "";
  2488. this.$box = this.createElement("div", {
  2489. class: "json-view-formater"
  2490. });
  2491. this.createNode(this.$box, json, "Root", "Root");
  2492. this.$container.appendChild(this.$box);
  2493. }
  2494. createNode(box, json, JSONPath, pid) {
  2495. const type = this.getType(json);
  2496. const isIterate = this.isIterate(json);
  2497. const canIterate = this.canIterate(json);
  2498. if (canIterate) {
  2499. this.createObjectNode(box, type, json, JSONPath, pid);
  2500. } else if (isIterate) {
  2501. const bracket = this.createBracket(type);
  2502. box.appendChild(bracket);
  2503. } else {
  2504. const valueNode = this.creatValueNode(type, json);
  2505. box.appendChild(valueNode);
  2506. }
  2507. }
  2508. createObjectNode(box, type, json, path, pid) {
  2509. const startBracket = this.createStartBracket(type);
  2510. box.appendChild(startBracket);
  2511. this.creatPlaceholderNode(box, json);
  2512. let length = Object.keys(json).length;
  2513. for (var key in json) {
  2514. if (Object.prototype.hasOwnProperty.call(json, key)) {
  2515. const value = json[key];
  2516. const id = this.random();
  2517. const canComma = --length > 0;
  2518. const JSONPath = this.JSONPath(path, key);
  2519. const node = this.createElement("div", {
  2520. JSONPath,
  2521. "data-node-id": id,
  2522. "data-node-pid": pid,
  2523. style: `padding-left: 20px`,
  2524. "data-type": this.getType(value),
  2525. class: `json-formater-item ${this.isIterate(value) ? "json-formater-opened" : ""}`
  2526. });
  2527. this.createKeyNode(node, key, value);
  2528. this.createNode(node, value, JSONPath, id);
  2529. if (canComma) {
  2530. const comma = this.createElement("span", {
  2531. class: "json-comma"
  2532. });
  2533. comma.textContent = ",";
  2534. node.appendChild(comma);
  2535. }
  2536. box.appendChild(node);
  2537. }
  2538. }
  2539. const endBracket = this.createEndBracket(type);
  2540. box.appendChild(endBracket);
  2541. }
  2542. createStartBracket(type) {
  2543. const span = this.createElement("span", {
  2544. class: `json-${type}-bracket`
  2545. });
  2546. span.textContent = type === "array" ? "[" : "{";
  2547. return span;
  2548. }
  2549. createEndBracket(type) {
  2550. const span = this.createElement("span", {
  2551. class: `json-${type}-bracket`
  2552. });
  2553. span.textContent = type === "array" ? "]" : "}";
  2554. return span;
  2555. }
  2556. createBracket(type) {
  2557. const node = this.createElement("span", {
  2558. class: `json-${type}-bracket`
  2559. });
  2560. node.textContent = type === "array" ? "[]" : "{}";
  2561. return node;
  2562. }
  2563. createKeyNode(node, key, value) {
  2564. if (this.canIterate(value)) {
  2565. const arrow = this.createElement("span", {
  2566. class: "json-formater-arrow"
  2567. });
  2568. node.appendChild(arrow);
  2569. }
  2570. if (!this.isNumber(key)) {
  2571. const span = this.createElement("span", {
  2572. class: "json-key"
  2573. });
  2574. span.textContent = `"${key}"`;
  2575. node.appendChild(span);
  2576. const colon = this.createElement("span", {
  2577. class: "json-colon"
  2578. });
  2579. colon.textContent = ":";
  2580. node.appendChild(colon);
  2581. }
  2582. }
  2583. creatValueNode(type, value) {
  2584. const node = this.createElement("span", {
  2585. class: `json-${type}`
  2586. });
  2587. node.textContent = `${value}`;
  2588. if (type === "string") {
  2589. value = this.escape(value);
  2590. node.textContent = `"${value}"`;
  2591. }
  2592. if (this.isUrl(value)) {
  2593. node.textContent = "";
  2594. const a = this.createElement("a", {
  2595. target: "_blank",
  2596. href: value
  2597. });
  2598. a.textContent = `"${value}"`;
  2599. node.appendChild(a);
  2600. }
  2601. if (this.isColor(value)) {
  2602. const span = this.createElement("span", {
  2603. class: "json-color",
  2604. style: `background-color: ${value}`
  2605. });
  2606. node.prepend(span);
  2607. }
  2608. return node;
  2609. }
  2610. creatPlaceholderNode(node, json) {
  2611. const nodeId = node.dataset.nodeId;
  2612. if (nodeId && nodeId !== "Root" && this.canIterate(json)) {
  2613. const copy = this.createElement("span", {
  2614. title: "复制",
  2615. class: "json-formater-copy"
  2616. });
  2617. copy.json = json;
  2618. node.appendChild(copy);
  2619. const span = this.createElement("span", {
  2620. class: "json-formater-placeholder"
  2621. });
  2622. node.appendChild(span);
  2623. }
  2624. }
  2625. onShow(node) {
  2626. const nodeId = node.dataset.nodeId;
  2627. const selector = `*[data-node-id=${nodeId}] > .json-formater-placeholder`;
  2628. const desc = Utils.query(selector, node);
  2629. if (!desc) return;
  2630. desc.innerHTML = null;
  2631. }
  2632. onHide(node) {
  2633. const id = node.dataset.nodeId;
  2634. const selector = `*[data-node-id="${id}"] > .json-formater-placeholder`;
  2635. const desc = Utils.query(selector, node);
  2636. if (!desc) return;
  2637. if (desc.innerHTML) return;
  2638. const type = node.dataset.type;
  2639. const length = this.findChildren(node).length;
  2640. const span = this.createElement("span");
  2641. span.textContent = `${length}${length > 1 ? " items" : " item"}`;
  2642. if (type === "object") {
  2643. span.textContent = `${length}${length > 1 ? " keys" : " key"}`;
  2644. }
  2645. desc.appendChild(span);
  2646. }
  2647. nodes() {
  2648. const arrows = Utils.queryAll(".json-formater-arrow", this.$container);
  2649. return arrows.map((ele) => this.closest(ele, ".json-formater-item"));
  2650. }
  2651. }
  2652. const cssText = `
  2653. .json-tree-table {
  2654. border-collapse: collapse;
  2655. width: -webkit-fill-available;
  2656. }
  2657.  
  2658. .json-tree-table tr.selected * {
  2659. color: #fff !important;
  2660. background-color: #3875d7;
  2661. }
  2662.  
  2663. .json-tree-table tr:hover {
  2664. background-color: #f0f9fe;
  2665. }
  2666.  
  2667. .json-tree-table tr td:first-child {
  2668. width: 120px;
  2669. }
  2670.  
  2671. .dark-theme .json-tree-table tr:hover,
  2672. .dark-plus-theme .json-tree-table tr:hover {
  2673. background-color: #353b48;
  2674. }
  2675. `;
  2676. class JsonToTable extends JsonFormat {
  2677. constructor(options) {
  2678. super(options);
  2679. }
  2680. render() {
  2681. const { json, container } = this.options;
  2682. this.$container = Utils.query(container);
  2683. this.$container.innerHTML = "";
  2684. const style = this.createElement("style");
  2685. style.textContent = cssText;
  2686. document.head.appendChild(style);
  2687. this.$table = this.createElement("table", {
  2688. class: "json-tree-table"
  2689. });
  2690. this.createNode(json, 1, "Root", "Root");
  2691. this.$container.appendChild(this.$table);
  2692. }
  2693. createNode(json, depth, path, pid) {
  2694. for (const key in json) {
  2695. if (Object.prototype.hasOwnProperty.call(json, key)) {
  2696. let value = json[key];
  2697. const type = this.getType(value);
  2698. const JSONPath = this.JSONPath(path, key);
  2699. const args = { key, value, type, depth, JSONPath, pid };
  2700. const item = this.createItem(args);
  2701. this.$table.appendChild(item);
  2702. if (this.canIterate(value)) {
  2703. const nodeId = item.dataset.nodeId;
  2704. this.createNode(value, depth + 1, JSONPath, nodeId);
  2705. }
  2706. }
  2707. }
  2708. }
  2709. createItem(args) {
  2710. const { key, value, type, depth, JSONPath, pid } = args;
  2711. const id = this.random();
  2712. const isIterate = this.isIterate(value);
  2713. const canIterate = this.canIterate(value);
  2714. const node = this.createElement("tr", {
  2715. "data-type": type,
  2716. "data-node-id": id,
  2717. "data-node-pid": pid,
  2718. class: "json-formater-item json-formater-opened"
  2719. });
  2720. const leftNode = this.createLeftNode(key, value, depth, JSONPath);
  2721. node.appendChild(leftNode);
  2722. if (!isIterate) {
  2723. const rightNode = this.createRightNode(type, value);
  2724. node.appendChild(rightNode);
  2725. }
  2726. if (isIterate && !canIterate) {
  2727. const rightNode = this.createEmptyRightNode(type);
  2728. node.appendChild(rightNode);
  2729. }
  2730. return node;
  2731. }
  2732. createLeftNode(key, value, depth, JSONPath) {
  2733. const node = this.createElement("td", {
  2734. JSONPath,
  2735. colspan: this.canIterate(value) ? 2 : 0,
  2736. style: `padding-left: ${depth * 20}px`
  2737. });
  2738. const b = this.createElement("span", {
  2739. class: "json-key"
  2740. });
  2741. b.textContent = `${key}`;
  2742. node.appendChild(b);
  2743. const colon = this.createElement("span", {
  2744. class: "json-colon"
  2745. });
  2746. colon.textContent = ":";
  2747. node.appendChild(colon);
  2748. if (this.canIterate(value)) {
  2749. const icon = this.createElement("span", {
  2750. class: "json-formater-arrow"
  2751. });
  2752. node.prepend(icon);
  2753. const copy = this.createElement("span", {
  2754. title: "复制",
  2755. class: "json-formater-copy"
  2756. });
  2757. copy.json = value;
  2758. node.appendChild(copy);
  2759. const span = this.createElement("span", {
  2760. class: "json-formater-placeholder"
  2761. });
  2762. node.appendChild(span);
  2763. }
  2764. return node;
  2765. }
  2766. createRightNode(type, value) {
  2767. const node = this.createElement("td", {
  2768. class: `json-${type}`
  2769. });
  2770. node.textContent = `${value}`;
  2771. if (type === "string") {
  2772. value = this.escape(value);
  2773. node.textContent = `"${value}"`;
  2774. }
  2775. if (this.isUrl(value)) {
  2776. node.textContent = "";
  2777. const a = this.createElement("a", {
  2778. target: "_blank",
  2779. href: value
  2780. });
  2781. a.textContent = `"${value}"`;
  2782. node.appendChild(a);
  2783. }
  2784. if (this.isColor(value)) {
  2785. const span = this.createElement("span", {
  2786. class: "json-color",
  2787. style: `background-color: ${value}`
  2788. });
  2789. node.prepend(span);
  2790. }
  2791. return node;
  2792. }
  2793. createEmptyRightNode(type) {
  2794. const node = this.createElement("td", {
  2795. class: `json-${type}-bracket`
  2796. });
  2797. node.textContent = type === "array" ? "[]" : "{}";
  2798. return node;
  2799. }
  2800. bindEvent() {
  2801. super.bindEvent();
  2802. this.addEvent("mousedown", "table tr", function(event) {
  2803. const { tagName, className } = event.target;
  2804. if (event.ctrlKey || tagName === "A" || tagName === "SPAN" && className !== "json-key") {
  2805. return;
  2806. }
  2807. const filter = Utils.queryAll(".selected").filter((ele) => ele !== this);
  2808. Utils.removeClass(filter, "selected");
  2809. Utils.toggleClass(this, "selected");
  2810. });
  2811. }
  2812. onShow(node) {
  2813. const desc = Utils.query(".json-formater-placeholder", node);
  2814. if (!desc) return;
  2815. desc.innerHTML = null;
  2816. }
  2817. onHide(node) {
  2818. const type = node.dataset.type;
  2819. const desc = Utils.query(".json-formater-placeholder", node);
  2820. if (!desc) return;
  2821. if (desc.innerHTML) return;
  2822. const length = this.findChildren(node).length;
  2823. let textNode = document.createTextNode(type === "object" ? "{" : "[");
  2824. desc.appendChild(textNode);
  2825. const span = this.createElement("span");
  2826. span.textContent = `${length}${length > 1 ? " items" : " item"}`;
  2827. if (type === "object") {
  2828. span.textContent = `${length}${length > 1 ? " keys" : " key"}`;
  2829. }
  2830. desc.appendChild(span);
  2831. textNode = document.createTextNode(type === "object" ? "}" : "]");
  2832. desc.appendChild(textNode);
  2833. }
  2834. }
  2835. class FormaterFactory {
  2836. static getInstance(options) {
  2837. return options.style && options.style === "table" ? new JsonToTable(options) : new JsonViewer(options);
  2838. }
  2839. }
  2840. const evnet = {
  2841. urlHover: function() {
  2842. Utils.addEvent("mouseenter", "a[href]", function() {
  2843. const href = Utils.attr(this, "href");
  2844. if (!Utils.isImg(href)) return;
  2845. tippy(this, {
  2846. duration: 800,
  2847. content: `<img style="max-width: 500px;" src="${href}" />`,
  2848. allowHTML: true,
  2849. theme: "imagebox"
  2850. }).show();
  2851. });
  2852. return this;
  2853. },
  2854. tipsJsonPath: function() {
  2855. Utils.addEvent("mouseenter", ".json-key", (event) => {
  2856. const target = event.target;
  2857. const jsonPath = this.getJsonPath(target);
  2858. const content = `<i>ctrlclick 复制</i><br/><b>路径:</b>${jsonPath}`;
  2859. tippy(target, {
  2860. content,
  2861. duration: 800,
  2862. allowHTML: true,
  2863. theme: "layer"
  2864. }).show();
  2865. });
  2866. return this;
  2867. },
  2868. copyJsonPath: function() {
  2869. Utils.addEvent("click", ".json-key", (event) => {
  2870. if (!event.ctrlKey) return;
  2871. const jsonPath = this.getJsonPath(event.target);
  2872. _GM_setClipboard(jsonPath);
  2873. layer.msg("复制成功", { time: 1500 });
  2874. });
  2875. return this;
  2876. },
  2877. getJsonPath: function(ele) {
  2878. return Utils.attr(ele.parentElement, "JSONPath");
  2879. },
  2880. init: function() {
  2881. this.urlHover().tipsJsonPath().copyJsonPath();
  2882. }
  2883. };
  2884. const format = exports("default", {
  2885. changeStyle: function(style) {
  2886. _GM_setValue("style", style);
  2887. this.setStyle();
  2888. return this;
  2889. },
  2890. setStyle: function() {
  2891. const input = Utils.query(".searchbox input");
  2892. if (input) input.value = "";
  2893. const clear = Utils.query(".searchbox .clear");
  2894. Utils.attr(clear, "hidden", true);
  2895. this.render(_unsafeWindow.GLOBAL_JSON);
  2896. return this;
  2897. },
  2898. render: function(json) {
  2899. const container = Utils.query("#formatBox");
  2900. const style = _GM_getValue("style") || "default";
  2901. const theme = _GM_getValue("theme") || "default";
  2902. const options = { json, style, theme, container };
  2903. _unsafeWindow.JSON_FORMATER = FormaterFactory.getInstance(options);
  2904. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  2905. const start = Utils.createElement("div", {
  2906. class: "jsonp"
  2907. });
  2908. start.textContent = `${_unsafeWindow.GLOBAL_JSONP_FUN}(`;
  2909. container.prepend(start);
  2910. const end = start.cloneNode(true);
  2911. end.textContent = ")";
  2912. container.append(end);
  2913. }
  2914. return this;
  2915. },
  2916. filter: function(json, text) {
  2917. text = text.toLowerCase();
  2918. function match(json2, text2) {
  2919. const newJson = Array.isArray(json2) ? new Array() : new Object();
  2920. for (const key in json2) {
  2921. if (Object.prototype.hasOwnProperty.call(json2, key)) {
  2922. const value = json2[key];
  2923. const type = Utils.getType(value);
  2924. const _key = key.toLowerCase();
  2925. const _value = Utils.stringify(value).toLowerCase();
  2926. if (!_key.includes(text2) && !_value.includes(text2)) {
  2927. continue;
  2928. }
  2929. if (["array", "object"].includes(type)) {
  2930. const result = match(value, text2);
  2931. const _result = Utils.stringify(result).toLowerCase();
  2932. if (_key.includes(text2) || _result.includes(text2)) {
  2933. newJson[key] = result;
  2934. }
  2935. } else {
  2936. newJson[key] = value;
  2937. }
  2938. }
  2939. }
  2940. return newJson;
  2941. }
  2942. return match(json, text);
  2943. },
  2944. input: function() {
  2945. const that = this;
  2946. const debounceInput = Utils.debounce(function() {
  2947. const value = this.value;
  2948. _unsafeWindow.FILTER_VALUE = value;
  2949. const clear = Utils.query(".searchbox .clear");
  2950. Utils.attr(clear, "hidden", !value);
  2951. const newJson = that.filter(_unsafeWindow.GLOBAL_JSON, value);
  2952. that.render(newJson);
  2953. }, 400);
  2954. Utils.addEvent("input", ".searchbox input", debounceInput);
  2955. return that;
  2956. },
  2957. clear: function() {
  2958. Utils.addEvent("click", ".searchbox .clear", () => {
  2959. this.setStyle();
  2960. _unsafeWindow.FILTER_VALUE = "";
  2961. });
  2962. return this;
  2963. },
  2964. init: function() {
  2965. this.setStyle().input().clear();
  2966. evnet.init();
  2967. }
  2968. });
  2969. format.init();
  2970. window.addEventListener("message", function(event) {
  2971. const { data } = event;
  2972. if (!data) return;
  2973. if (data.reload) return format.setStyle();
  2974. const { type, value } = data;
  2975. if (type === "style") format.changeStyle(value);
  2976. });
  2977.  
  2978. })
  2979. };
  2980. }));
  2981.  
  2982. System.register("./index-Btt8fXSQ-DuZkUtAR.js", ['./tippy.esm-Ot9MORvr-DNGa7Opj.js', 'jsmind', './__monkey.entry-BOyf9HZs.js', 'dom-to-image'], (function (exports, module) {
  2983. 'use strict';
  2984. var tippy, require$$0, commonjsGlobal, Utils, _unsafeWindow, _GM_setClipboard, _GM_getValue, URL$1, _GM_setValue, require$$1;
  2985. return {
  2986. setters: [module => {
  2987. tippy = module.t;
  2988. }, module => {
  2989. require$$0 = module.default;
  2990. }, module => {
  2991. commonjsGlobal = module.d;
  2992. Utils = module.U;
  2993. _unsafeWindow = module.a;
  2994. _GM_setClipboard = module.c;
  2995. _GM_getValue = module.b;
  2996. URL$1 = module.e;
  2997. _GM_setValue = module._;
  2998. }, module => {
  2999. require$$1 = module.default;
  3000. }],
  3001. execute: (function () {
  3002.  
  3003. /**
  3004. * @license BSD-3-Clause
  3005. * @copyright 2014-2023 hizzgdev@163.com
  3006. *
  3007. * Project Home:
  3008. * https://github.com/hizzgdev/jsmind/
  3009. */
  3010. (function(module, exports) {
  3011. !function(e, t) {
  3012. t(require$$0, require$$1);
  3013. }(commonjsGlobal, function(e, t) {
  3014. function i(e2) {
  3015. return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
  3016. }
  3017. var n = i(e), o = i(t);
  3018. if (!n.default) throw new Error("jsMind is not defined");
  3019. if (!o.default) throw new Error("dom-to-image is required");
  3020. const r = n.default.$, s = { filename: null, watermark: { left: r.w.location, right: "https://github.com/hizzgdev/jsmind" }, background: "transparent" };
  3021. class a {
  3022. constructor(e2, t2) {
  3023. var i2 = {};
  3024. n.default.util.json.merge(i2, s), n.default.util.json.merge(i2, t2), this.version = "0.2.0", this.jm = e2, this.options = i2, this.dpr = e2.view.device_pixel_ratio;
  3025. }
  3026. shoot() {
  3027. let e2 = this.create_canvas(), t2 = e2.getContext("2d");
  3028. t2.scale(this.dpr, this.dpr), Promise.resolve(t2).then(() => this.draw_background(t2)).then(() => this.draw_lines(t2)).then(() => this.draw_nodes(t2)).then(() => this.draw_watermark(e2, t2)).then(() => this.download(e2)).then(() => this.clear(e2));
  3029. }
  3030. create_canvas() {
  3031. let e2 = r.c("canvas");
  3032. const t2 = this.jm.view.size.w, i2 = this.jm.view.size.h;
  3033. return e2.width = t2 * this.dpr, e2.height = i2 * this.dpr, e2.style.width = t2 + "px", e2.style.height = i2 + "px", e2.style.visibility = "hidden", this.jm.view.e_panel.appendChild(e2), e2;
  3034. }
  3035. clear(e2) {
  3036. e2.parentNode.removeChild(e2);
  3037. }
  3038. draw_background(e2) {
  3039. return new Promise((function(t2, i2) {
  3040. const n2 = this.options.background;
  3041. n2 && "transparent" !== n2 && (e2.fillStyle = this.options.background, e2.fillRect(0, 0, this.jm.view.size.w, this.jm.view.size.h)), t2(e2);
  3042. }).bind(this));
  3043. }
  3044. draw_lines(e2) {
  3045. return new Promise((function(t2, i2) {
  3046. this.jm.view.graph.copy_to(e2, function() {
  3047. t2(e2);
  3048. });
  3049. }).bind(this));
  3050. }
  3051. draw_nodes(e2) {
  3052. return o.default.toSvg(this.jm.view.e_nodes, { style: { zoom: 1 } }).then(this.load_image).then(function(t2) {
  3053. return e2.drawImage(t2, 0, 0), e2;
  3054. });
  3055. }
  3056. draw_watermark(e2, t2) {
  3057. return t2.textBaseline = "bottom", t2.fillStyle = "#000", t2.font = "11px Verdana,Arial,Helvetica,sans-serif", this.options.watermark.left && (t2.textAlign = "left", t2.fillText(this.options.watermark.left, 5.5, e2.height - 2.5)), this.options.watermark.right && (t2.textAlign = "right", t2.fillText(this.options.watermark.right, e2.width - 5.5, e2.height - 2.5)), t2;
  3058. }
  3059. load_image(e2) {
  3060. return new Promise(function(t2, i2) {
  3061. let n2 = new Image();
  3062. n2.onload = function() {
  3063. t2(n2);
  3064. }, n2.onerror = i2, n2.src = e2;
  3065. });
  3066. }
  3067. download(e2) {
  3068. var t2 = (this.options.filename || this.jm.mind.name) + ".png";
  3069. if (navigator.msSaveBlob && e2.msToBlob) {
  3070. var i2 = e2.msToBlob();
  3071. navigator.msSaveBlob(i2, t2);
  3072. } else {
  3073. var n2 = e2.toDataURL(), o2 = r.c("a");
  3074. if ("download" in o2) {
  3075. o2.style.visibility = "hidden", o2.href = n2, o2.download = t2, r.d.body.appendChild(o2);
  3076. var s2 = r.d.createEvent("MouseEvents");
  3077. s2.initEvent("click", true, true), o2.dispatchEvent(s2), r.d.body.removeChild(o2);
  3078. } else location.href = n2;
  3079. }
  3080. }
  3081. }
  3082. let d = new n.default.plugin("screenshot", function(e2, t2) {
  3083. var i2 = new a(e2, t2);
  3084. e2.screenshot = i2, e2.shoot = function() {
  3085. i2.shoot();
  3086. };
  3087. });
  3088. n.default.register_plugin(d);
  3089. });
  3090. })();
  3091. const jsonMind = {
  3092. isFirst: true,
  3093. transform: function(json) {
  3094. const children = [];
  3095. if (typeof json === "object") {
  3096. for (const key in json) {
  3097. let val = json[key];
  3098. const isArray = Array.isArray(val);
  3099. const type = Utils.getPrototype(val);
  3100. if (isArray && val.length > 0) val = Utils.findMaxKeysObject(val);
  3101. const keys = Utils.getType(val) === "object" ? Object.keys(val) : null;
  3102. children.push({
  3103. keys,
  3104. isArray,
  3105. chain: key,
  3106. id: key + "_" + Math.random(),
  3107. topic: `${key}<span class="datatype">${type}</span>`,
  3108. children: this.transform(val)
  3109. });
  3110. }
  3111. }
  3112. return children;
  3113. },
  3114. getChain: function(node) {
  3115. let chain = node.data.chain;
  3116. if (!node.parent) return chain;
  3117. const parent = node.parent;
  3118. const parentChain = this.getChain(parent);
  3119. if (parent.data.isArray) return `${parentChain}[i].${chain}`;
  3120. if (chain.includes(".")) return `${parentChain}["${chain}"]`;
  3121. return `${parentChain}.${chain}`;
  3122. },
  3123. show: function(json) {
  3124. let isArray = Array.isArray(json);
  3125. if (isArray) {
  3126. if (typeof json[0] !== "object") {
  3127. layer.msg("无法生成脑图", { time: 1e3 });
  3128. return this;
  3129. }
  3130. json = Utils.findMaxKeysObject(json);
  3131. }
  3132. if (!this.isFirst) return this;
  3133. _unsafeWindow.GLOBAL_JSMIND.show({
  3134. meta: {
  3135. version: "1.0",
  3136. name: "JSON脑图",
  3137. author: "1220301855@qq.com"
  3138. },
  3139. format: "node_tree",
  3140. /* 数据内容 */
  3141. data: {
  3142. isArray,
  3143. id: "root",
  3144. chain: "Root",
  3145. topic: "Root",
  3146. direction: "left",
  3147. keys: Object.keys(json),
  3148. children: this.transform(json)
  3149. }
  3150. });
  3151. this.isFirst = false;
  3152. return this;
  3153. },
  3154. event: function() {
  3155. const that = this;
  3156. Utils.addEvent("click mouseover", "jmnode", handler);
  3157. function handler(event) {
  3158. const nodeid = Utils.attr(this, "nodeid");
  3159. const node = _unsafeWindow.GLOBAL_JSMIND.get_node(nodeid);
  3160. const chain = that.getChain(node);
  3161. if (event.type === "click") {
  3162. if (event.ctrlKey) {
  3163. _GM_setClipboard(chain);
  3164. layer.msg("复制成功", { time: 1500 });
  3165. return;
  3166. }
  3167. const keys = node.data.keys;
  3168. if (!keys || keys.length === 0) return;
  3169. that.popup(chain, keys);
  3170. } else {
  3171. const content = `<i>ctrlclick 复制</i><br/><b>路径:</b>${chain}`;
  3172. tippy(this, {
  3173. content,
  3174. duration: 800,
  3175. allowHTML: true,
  3176. theme: "layer"
  3177. }).show();
  3178. }
  3179. }
  3180. return this;
  3181. },
  3182. popup(chain, keys) {
  3183. layer.open({
  3184. type: 1,
  3185. move: false,
  3186. shadeClose: true,
  3187. title: " 节点",
  3188. content: function() {
  3189. const chain2 = Utils.createElement("div");
  3190. const chainCon = Utils.createElement("div");
  3191. chain2.appendChild(chainCon);
  3192. const copy = Utils.createElement("div", {
  3193. title: "复制",
  3194. class: "js-mind-copy"
  3195. });
  3196. const content = Utils.createElement("div", {
  3197. class: "js-mind-child-node"
  3198. });
  3199. content.appendChild(copy);
  3200. keys.forEach((i) => {
  3201. const child = Utils.createElement("div");
  3202. child.textContent = i;
  3203. content.appendChild(child);
  3204. });
  3205. return content.outerHTML;
  3206. }(),
  3207. success: function(layero) {
  3208. layero.on("click", ".js-mind-copy", function() {
  3209. _GM_setClipboard(chain + "\n\n" + keys.join("\n"));
  3210. layer.msg("复制成功", { time: 1500 });
  3211. });
  3212. }
  3213. });
  3214. },
  3215. init: function(json) {
  3216. if (_unsafeWindow.GLOBAL_JSMIND) return;
  3217. _unsafeWindow.GLOBAL_JSMIND = new require$$0({
  3218. mode: "side",
  3219. editable: false,
  3220. container: "mindBox",
  3221. view: {
  3222. hmargin: 50,
  3223. vmargin: 50,
  3224. engine: "svg",
  3225. draggable: true,
  3226. support_html: false,
  3227. line_color: "#C4C9D0"
  3228. },
  3229. layout: {
  3230. vspace: 5,
  3231. hspace: 130
  3232. }
  3233. });
  3234. this.show(json).event();
  3235. }
  3236. };
  3237. const $mindBox = Utils.query("#mindBox");
  3238. const $formatBox = Utils.query("#formatBox");
  3239. const $rawTextBox = Utils.query("#rawTextBox");
  3240. const $rawTextPre = Utils.query("pre", $rawTextBox);
  3241. const tabs = {
  3242. firstFormat: true,
  3243. isBeautify: false,
  3244. _setRawText: function() {
  3245. let rawText = _unsafeWindow.RAW_TEXT;
  3246. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  3247. rawText = `${_unsafeWindow.GLOBAL_JSONP_FUN}(${rawText})`;
  3248. }
  3249. $rawTextPre.textContent = rawText;
  3250. },
  3251. saveJson: function() {
  3252. if (Utils.isVisible($mindBox)) return _unsafeWindow.GLOBAL_JSMIND.shoot();
  3253. const content = $rawTextPre.textContent || _unsafeWindow.RAW_TEXT;
  3254. const filename = (/* @__PURE__ */ new Date()).getTime() + ".json";
  3255. Utils.downloadText(content, filename);
  3256. },
  3257. copyJson: function() {
  3258. const content = $rawTextPre.textContent || _unsafeWindow.RAW_TEXT;
  3259. _GM_setClipboard(content);
  3260. layer.msg("复制成功", { time: 1500 });
  3261. },
  3262. collapseAll: function() {
  3263. var _a, _b;
  3264. Utils.isVisible($formatBox) ? (_b = (_a = _unsafeWindow) == null ? void 0 : _a.JSON_FORMATER) == null ? void 0 : _b.collapseAll() : _unsafeWindow.GLOBAL_JSMIND.collapse_all();
  3265. },
  3266. expandAll: function() {
  3267. var _a, _b, _c, _d, _e, _f, _g, _h;
  3268. if (Utils.isVisible($formatBox)) {
  3269. (_b = (_a = _unsafeWindow) == null ? void 0 : _a.JSON_FORMATER) == null ? void 0 : _b.expandAll();
  3270. return;
  3271. }
  3272. (_d = (_c = _unsafeWindow) == null ? void 0 : _c.GLOBAL_JSMIND) == null ? void 0 : _d.expand_all();
  3273. (_h = (_e = _unsafeWindow) == null ? void 0 : _e.GLOBAL_JSMIND) == null ? void 0 : _h.scroll_node_to_center(
  3274. (_g = (_f = _unsafeWindow) == null ? void 0 : _f.GLOBAL_JSMIND) == null ? void 0 : _g.get_root()
  3275. );
  3276. },
  3277. viewFormater: function() {
  3278. const value = _unsafeWindow.FILTER_VALUE || "";
  3279. Utils.query(".searchbox input").value = value;
  3280. const clear = Utils.query(".searchbox .clear");
  3281. Utils.attr(clear, "hidden", !value);
  3282. },
  3283. viewMind: function() {
  3284. var _a, _b, _c, _d;
  3285. jsonMind.init(_unsafeWindow.GLOBAL_JSON);
  3286. (_d = (_a = _unsafeWindow) == null ? void 0 : _a.GLOBAL_JSMIND) == null ? void 0 : _d.scroll_node_to_center(
  3287. (_c = (_b = _unsafeWindow) == null ? void 0 : _b.GLOBAL_JSMIND) == null ? void 0 : _c.get_root()
  3288. );
  3289. },
  3290. viewRawText: function() {
  3291. if (!this.firstFormat) return;
  3292. this.firstFormat = false;
  3293. this._setRawText();
  3294. },
  3295. beautify: function() {
  3296. this.isBeautify = !this.isBeautify;
  3297. if (!this.isBeautify) return this._setRawText();
  3298. let str = Utils.stringify(_unsafeWindow.GLOBAL_JSON, null, 2);
  3299. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  3300. str = `${_unsafeWindow.GLOBAL_JSONP_FUN}(${str})`;
  3301. }
  3302. $rawTextPre.textContent = str;
  3303. },
  3304. jsoncrack: function() {
  3305. const theme2 = (_GM_getValue("theme") || "light").replace(/-.*/, "");
  3306. layer.closeAll();
  3307. layer.open({
  3308. type: 1,
  3309. move: false,
  3310. title: false,
  3311. area: ["100vw", "100vh"],
  3312. content: `<iframe id="jsoncrackEmbed" src="${URL$1.JSON_CRACK_WIDGET}"></iframe>`,
  3313. success: function() {
  3314. const jsonCrackEmbed = Utils.query("#jsoncrackEmbed");
  3315. window == null ? void 0 : window.addEventListener("message", () => {
  3316. var _a;
  3317. const msg = {
  3318. options: { theme: theme2 },
  3319. json: _unsafeWindow.RAW_TEXT
  3320. };
  3321. (_a = jsonCrackEmbed == null ? void 0 : jsonCrackEmbed.contentWindow) == null ? void 0 : _a.postMessage(msg, "*");
  3322. });
  3323. }
  3324. });
  3325. },
  3326. init: function() {
  3327. Utils.addEvent("click", ".btn", (e) => {
  3328. const target = e.target;
  3329. const id = target.id;
  3330. if (Utils.hasClass(target, "tabs-item")) {
  3331. const clas = "active";
  3332. Utils.removeClass(Utils.queryAll(".tabs-item"), clas);
  3333. Utils.addClass(target, clas);
  3334. Utils.removeClass(Utils.queryAll("div[data-for]"), clas);
  3335. Utils.addClass(Utils.query(`div[data-for="${id}"]`), clas);
  3336. const template = Utils.query(`template[data-for='${id}']`);
  3337. Utils.query(".toolbar").innerHTML = template.innerHTML;
  3338. }
  3339. this[id](target);
  3340. });
  3341. }
  3342. };
  3343. window.addEventListener("message", function(event) {
  3344. const { data } = event;
  3345. if (!(data == null ? void 0 : data.reload)) return;
  3346. $mindBox.innerHTML = "";
  3347. jsonMind.isFirst = true;
  3348. tabs.isBeautify = false;
  3349. tabs.firstFormat = true;
  3350. _unsafeWindow.GLOBAL_JSMIND = void 0;
  3351. if (Utils.isVisible($rawTextBox)) return tabs.viewRawText();
  3352. if (Utils.isVisible($mindBox)) return jsonMind.init(_unsafeWindow.GLOBAL_JSON);
  3353. });
  3354. const theme = {
  3355. changeTheme(theme2) {
  3356. _GM_setValue("theme", theme2);
  3357. this.setTheme();
  3358. },
  3359. setTheme() {
  3360. const theme2 = _GM_getValue("theme") || "default";
  3361. _unsafeWindow.JSON_FORMATER.setTheme(theme2);
  3362. }
  3363. };
  3364. const http_form = `
  3365. <form class="httpRequest">
  3366. <div class="requestbox">
  3367. <select name="method">
  3368. <option value="POST">POST</option>
  3369. <option value="GET">GET</option>
  3370. <option value="PUT">PUT</option>
  3371. <option value="DELETE">DELETE</option>
  3372. </select>
  3373. <input name="url" placeholder="请求地址" />
  3374. <select name="contentType">
  3375. <option value="application/x-www-form-urlencoded;charset=UTF-8">urlencoded</option>
  3376. <option value="application/json;charset=UTF-8">application/json</option>
  3377. </select>
  3378. <button type="submit">发送</button>
  3379. </div>
  3380. <div class="textarea">
  3381. <input name="headers" placeholder='请求头 {"token": "test"}' />
  3382. <input name="params" placeholder='请求参数 {"id": "test", ""name": "test"}' />
  3383. </div>
  3384. </form>`;
  3385. const tools = {
  3386. inputJson: function() {
  3387. const that = this;
  3388. layer.prompt(
  3389. {
  3390. move: false,
  3391. formType: 2,
  3392. btn: ["确认"],
  3393. shadeClose: true,
  3394. title: "JSON 输入",
  3395. maxlength: 1e6,
  3396. area: ["400px", "300px"]
  3397. },
  3398. function(text) {
  3399. if (!text) return layer.msg("内容不能为空", { time: 1500 });
  3400. const { rawText, jsonpFun } = Utils.matchJsonp(text);
  3401. try {
  3402. const json = Utils.parse(rawText);
  3403. that.reload(json, rawText, jsonpFun);
  3404. } catch (e) {
  3405. layer.msg("JSON格式不正确", { time: 1500 });
  3406. console.log("格式化异常: ", e);
  3407. }
  3408. }
  3409. );
  3410. return this;
  3411. },
  3412. fetchApi: function() {
  3413. const that = this;
  3414. layer.open({
  3415. type: 1,
  3416. closeBtn: 0,
  3417. shadeClose: true,
  3418. title: "HTTP 请求",
  3419. content: http_form,
  3420. success: function() {
  3421. const form = Utils.query("form");
  3422. form.addEventListener("submit", function(event) {
  3423. handler(event, form);
  3424. });
  3425. }
  3426. });
  3427. function handler(event, formEl) {
  3428. event.preventDefault();
  3429. const formData = new FormData(formEl);
  3430. const form = {};
  3431. for (const [name, value] of formData) {
  3432. form[name] = value;
  3433. }
  3434. if (form.url === "") return layer.msg("请求URL不能为空");
  3435. let headers = form.headers;
  3436. let params = form.params;
  3437. try {
  3438. if (headers) headers = JSON.parse(headers);
  3439. } catch (e) {
  3440. return layer.msg("请求头格式不合法");
  3441. }
  3442. try {
  3443. if (params) params = JSON.parse(params);
  3444. } catch (e) {
  3445. return layer.msg("请求参数格式不合法");
  3446. }
  3447. layer.load(0, { shade: false });
  3448. fetch(URL$1.ONLINE_REQUEST, {
  3449. method: "POST",
  3450. headers: {
  3451. "Content-Type": "application/json"
  3452. },
  3453. body: Utils.stringify(form)
  3454. }).then(async (response) => {
  3455. const result = await response.json();
  3456. if (typeof result === "string") {
  3457. try {
  3458. const { rawText, jsonpFun } = Utils.matchJsonp(result);
  3459. const json = Utils.parse(rawText);
  3460. that.reload(json, rawText, jsonpFun);
  3461. } catch (e) {
  3462. layer.closeAll();
  3463. console.log("HTTP 请求异常:", e);
  3464. }
  3465. } else {
  3466. that.reload(result, Utils.stringify(result), null);
  3467. }
  3468. }).catch((e) => {
  3469. layer.closeAll();
  3470. console.log("HTTP 请求异常:", e);
  3471. });
  3472. }
  3473. return this;
  3474. },
  3475. reload: function(json, rawText, jsonpFun) {
  3476. _unsafeWindow.GLOBAL_JSON = json;
  3477. _unsafeWindow.RAW_TEXT = rawText;
  3478. _unsafeWindow.GLOBAL_JSONP_FUN = jsonpFun;
  3479. window.postMessage({ reload: true });
  3480. layer.closeAll();
  3481. }
  3482. };
  3483. const active = "active";
  3484. const handleBar = {
  3485. currentTippy: null,
  3486. handle: function() {
  3487. const that = this;
  3488. const tagName = "span";
  3489. [".style", ".theme", ".tools"].forEach((selector) => {
  3490. tippy(selector, {
  3491. duration: 500,
  3492. allowHTML: true,
  3493. interactive: true,
  3494. trigger: "click",
  3495. appendTo: Utils.query(selector).parentNode,
  3496. onTrigger: function(instance) {
  3497. that.currentTippy = instance;
  3498. const target = instance.reference;
  3499. Utils.addClass(Utils.query(tagName, target), active);
  3500. const template = Utils.query("template", target);
  3501. const ul = template.content.cloneNode(true);
  3502. const type = template.dataset.type;
  3503. const value = _GM_getValue(type) || "default";
  3504. const current = Utils.query(`li[data-value=${value}]`, ul);
  3505. Utils.addClass(current, active);
  3506. const tempDiv = Utils.createElement("div");
  3507. while (ul.firstChild) tempDiv.appendChild(ul.firstChild);
  3508. instance.setContent(tempDiv.innerHTML);
  3509. },
  3510. onHide: function(instance) {
  3511. const target = instance.reference;
  3512. Utils.removeClass(Utils.query(tagName, target));
  3513. }
  3514. });
  3515. });
  3516. return this;
  3517. },
  3518. checked: function() {
  3519. const selector = ".rightbox li";
  3520. Utils.addEvent("click", selector, (event) => {
  3521. const target = event.target;
  3522. if (Utils.hasClass(target, active)) return;
  3523. const type = target.dataset.type;
  3524. const value = target.dataset.value;
  3525. window.postMessage({ type, value });
  3526. if (Object.is(type, "tools")) return this.currentTippy.hide();
  3527. Utils.removeClass(Utils.queryAll(selector));
  3528. Utils.addClass(target, active);
  3529. });
  3530. return this;
  3531. },
  3532. init: function() {
  3533. this.handle().checked();
  3534. }
  3535. };
  3536. tabs.init();
  3537. theme.setTheme();
  3538. handleBar.init();
  3539. window.addEventListener("message", function(event) {
  3540. const { data } = event;
  3541. if (!data) return;
  3542. const { type, value } = data;
  3543. if (!type) return;
  3544. if (type === "tools") return tools[value]();
  3545. if (type === "theme") return theme.changeTheme(value);
  3546. });
  3547.  
  3548. })
  3549. };
  3550. }));
  3551.  
  3552. System.register("./tippy.esm-Ot9MORvr-DNGa7Opj.js", [], (function (exports, module) {
  3553. 'use strict';
  3554. return {
  3555. execute: (function () {
  3556.  
  3557. exports("t", tippy);
  3558.  
  3559. var top = "top";
  3560. var bottom = "bottom";
  3561. var right = "right";
  3562. var left = "left";
  3563. var auto = "auto";
  3564. var basePlacements = [top, bottom, right, left];
  3565. var start = "start";
  3566. var end = "end";
  3567. var clippingParents = "clippingParents";
  3568. var viewport = "viewport";
  3569. var popper = "popper";
  3570. var reference = "reference";
  3571. var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
  3572. return acc.concat([placement + "-" + start, placement + "-" + end]);
  3573. }, []);
  3574. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  3575. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  3576. }, []);
  3577. var beforeRead = "beforeRead";
  3578. var read = "read";
  3579. var afterRead = "afterRead";
  3580. var beforeMain = "beforeMain";
  3581. var main = "main";
  3582. var afterMain = "afterMain";
  3583. var beforeWrite = "beforeWrite";
  3584. var write = "write";
  3585. var afterWrite = "afterWrite";
  3586. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  3587. function getNodeName(element) {
  3588. return element ? (element.nodeName || "").toLowerCase() : null;
  3589. }
  3590. function getWindow(node) {
  3591. if (node == null) {
  3592. return window;
  3593. }
  3594. if (node.toString() !== "[object Window]") {
  3595. var ownerDocument = node.ownerDocument;
  3596. return ownerDocument ? ownerDocument.defaultView || window : window;
  3597. }
  3598. return node;
  3599. }
  3600. function isElement$1(node) {
  3601. var OwnElement = getWindow(node).Element;
  3602. return node instanceof OwnElement || node instanceof Element;
  3603. }
  3604. function isHTMLElement(node) {
  3605. var OwnElement = getWindow(node).HTMLElement;
  3606. return node instanceof OwnElement || node instanceof HTMLElement;
  3607. }
  3608. function isShadowRoot(node) {
  3609. if (typeof ShadowRoot === "undefined") {
  3610. return false;
  3611. }
  3612. var OwnElement = getWindow(node).ShadowRoot;
  3613. return node instanceof OwnElement || node instanceof ShadowRoot;
  3614. }
  3615. function applyStyles(_ref) {
  3616. var state = _ref.state;
  3617. Object.keys(state.elements).forEach(function(name) {
  3618. var style = state.styles[name] || {};
  3619. var attributes = state.attributes[name] || {};
  3620. var element = state.elements[name];
  3621. if (!isHTMLElement(element) || !getNodeName(element)) {
  3622. return;
  3623. }
  3624. Object.assign(element.style, style);
  3625. Object.keys(attributes).forEach(function(name2) {
  3626. var value = attributes[name2];
  3627. if (value === false) {
  3628. element.removeAttribute(name2);
  3629. } else {
  3630. element.setAttribute(name2, value === true ? "" : value);
  3631. }
  3632. });
  3633. });
  3634. }
  3635. function effect$2(_ref2) {
  3636. var state = _ref2.state;
  3637. var initialStyles = {
  3638. popper: {
  3639. position: state.options.strategy,
  3640. left: "0",
  3641. top: "0",
  3642. margin: "0"
  3643. },
  3644. arrow: {
  3645. position: "absolute"
  3646. },
  3647. reference: {}
  3648. };
  3649. Object.assign(state.elements.popper.style, initialStyles.popper);
  3650. state.styles = initialStyles;
  3651. if (state.elements.arrow) {
  3652. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  3653. }
  3654. return function() {
  3655. Object.keys(state.elements).forEach(function(name) {
  3656. var element = state.elements[name];
  3657. var attributes = state.attributes[name] || {};
  3658. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
  3659. var style = styleProperties.reduce(function(style2, property) {
  3660. style2[property] = "";
  3661. return style2;
  3662. }, {});
  3663. if (!isHTMLElement(element) || !getNodeName(element)) {
  3664. return;
  3665. }
  3666. Object.assign(element.style, style);
  3667. Object.keys(attributes).forEach(function(attribute) {
  3668. element.removeAttribute(attribute);
  3669. });
  3670. });
  3671. };
  3672. }
  3673. const applyStyles$1 = {
  3674. name: "applyStyles",
  3675. enabled: true,
  3676. phase: "write",
  3677. fn: applyStyles,
  3678. effect: effect$2,
  3679. requires: ["computeStyles"]
  3680. };
  3681. function getBasePlacement$1(placement) {
  3682. return placement.split("-")[0];
  3683. }
  3684. var max = Math.max;
  3685. var min = Math.min;
  3686. var round = Math.round;
  3687. function getUAString() {
  3688. var uaData = navigator.userAgentData;
  3689. if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
  3690. return uaData.brands.map(function(item) {
  3691. return item.brand + "/" + item.version;
  3692. }).join(" ");
  3693. }
  3694. return navigator.userAgent;
  3695. }
  3696. function isLayoutViewport() {
  3697. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  3698. }
  3699. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  3700. if (includeScale === void 0) {
  3701. includeScale = false;
  3702. }
  3703. if (isFixedStrategy === void 0) {
  3704. isFixedStrategy = false;
  3705. }
  3706. var clientRect = element.getBoundingClientRect();
  3707. var scaleX = 1;
  3708. var scaleY = 1;
  3709. if (includeScale && isHTMLElement(element)) {
  3710. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  3711. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  3712. }
  3713. var _ref = isElement$1(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
  3714. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  3715. var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  3716. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  3717. var width = clientRect.width / scaleX;
  3718. var height = clientRect.height / scaleY;
  3719. return {
  3720. width,
  3721. height,
  3722. top: y,
  3723. right: x + width,
  3724. bottom: y + height,
  3725. left: x,
  3726. x,
  3727. y
  3728. };
  3729. }
  3730. function getLayoutRect(element) {
  3731. var clientRect = getBoundingClientRect(element);
  3732. var width = element.offsetWidth;
  3733. var height = element.offsetHeight;
  3734. if (Math.abs(clientRect.width - width) <= 1) {
  3735. width = clientRect.width;
  3736. }
  3737. if (Math.abs(clientRect.height - height) <= 1) {
  3738. height = clientRect.height;
  3739. }
  3740. return {
  3741. x: element.offsetLeft,
  3742. y: element.offsetTop,
  3743. width,
  3744. height
  3745. };
  3746. }
  3747. function contains(parent, child) {
  3748. var rootNode = child.getRootNode && child.getRootNode();
  3749. if (parent.contains(child)) {
  3750. return true;
  3751. } else if (rootNode && isShadowRoot(rootNode)) {
  3752. var next = child;
  3753. do {
  3754. if (next && parent.isSameNode(next)) {
  3755. return true;
  3756. }
  3757. next = next.parentNode || next.host;
  3758. } while (next);
  3759. }
  3760. return false;
  3761. }
  3762. function getComputedStyle(element) {
  3763. return getWindow(element).getComputedStyle(element);
  3764. }
  3765. function isTableElement(element) {
  3766. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  3767. }
  3768. function getDocumentElement(element) {
  3769. return ((isElement$1(element) ? element.ownerDocument : (
  3770. // $FlowFixMe[prop-missing]
  3771. element.document
  3772. )) || window.document).documentElement;
  3773. }
  3774. function getParentNode(element) {
  3775. if (getNodeName(element) === "html") {
  3776. return element;
  3777. }
  3778. return (
  3779. // this is a quicker (but less type safe) way to save quite some bytes from the bundle
  3780. // $FlowFixMe[incompatible-return]
  3781. // $FlowFixMe[prop-missing]
  3782. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  3783. element.parentNode || // DOM Element detected
  3784. (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  3785. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  3786. getDocumentElement(element)
  3787. );
  3788. }
  3789. function getTrueOffsetParent(element) {
  3790. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  3791. getComputedStyle(element).position === "fixed") {
  3792. return null;
  3793. }
  3794. return element.offsetParent;
  3795. }
  3796. function getContainingBlock(element) {
  3797. var isFirefox = /firefox/i.test(getUAString());
  3798. var isIE = /Trident/i.test(getUAString());
  3799. if (isIE && isHTMLElement(element)) {
  3800. var elementCss = getComputedStyle(element);
  3801. if (elementCss.position === "fixed") {
  3802. return null;
  3803. }
  3804. }
  3805. var currentNode = getParentNode(element);
  3806. if (isShadowRoot(currentNode)) {
  3807. currentNode = currentNode.host;
  3808. }
  3809. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  3810. var css = getComputedStyle(currentNode);
  3811. if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
  3812. return currentNode;
  3813. } else {
  3814. currentNode = currentNode.parentNode;
  3815. }
  3816. }
  3817. return null;
  3818. }
  3819. function getOffsetParent(element) {
  3820. var window2 = getWindow(element);
  3821. var offsetParent = getTrueOffsetParent(element);
  3822. while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
  3823. offsetParent = getTrueOffsetParent(offsetParent);
  3824. }
  3825. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
  3826. return window2;
  3827. }
  3828. return offsetParent || getContainingBlock(element) || window2;
  3829. }
  3830. function getMainAxisFromPlacement(placement) {
  3831. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  3832. }
  3833. function within(min$1, value, max$1) {
  3834. return max(min$1, min(value, max$1));
  3835. }
  3836. function withinMaxClamp(min2, value, max2) {
  3837. var v = within(min2, value, max2);
  3838. return v > max2 ? max2 : v;
  3839. }
  3840. function getFreshSideObject() {
  3841. return {
  3842. top: 0,
  3843. right: 0,
  3844. bottom: 0,
  3845. left: 0
  3846. };
  3847. }
  3848. function mergePaddingObject(paddingObject) {
  3849. return Object.assign({}, getFreshSideObject(), paddingObject);
  3850. }
  3851. function expandToHashMap(value, keys) {
  3852. return keys.reduce(function(hashMap, key) {
  3853. hashMap[key] = value;
  3854. return hashMap;
  3855. }, {});
  3856. }
  3857. var toPaddingObject = function toPaddingObject2(padding, state) {
  3858. padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
  3859. placement: state.placement
  3860. })) : padding;
  3861. return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  3862. };
  3863. function arrow(_ref) {
  3864. var _state$modifiersData$;
  3865. var state = _ref.state, name = _ref.name, options = _ref.options;
  3866. var arrowElement = state.elements.arrow;
  3867. var popperOffsets2 = state.modifiersData.popperOffsets;
  3868. var basePlacement = getBasePlacement$1(state.placement);
  3869. var axis = getMainAxisFromPlacement(basePlacement);
  3870. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  3871. var len = isVertical ? "height" : "width";
  3872. if (!arrowElement || !popperOffsets2) {
  3873. return;
  3874. }
  3875. var paddingObject = toPaddingObject(options.padding, state);
  3876. var arrowRect = getLayoutRect(arrowElement);
  3877. var minProp = axis === "y" ? top : left;
  3878. var maxProp = axis === "y" ? bottom : right;
  3879. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
  3880. var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
  3881. var arrowOffsetParent = getOffsetParent(arrowElement);
  3882. var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  3883. var centerToReference = endDiff / 2 - startDiff / 2;
  3884. var min2 = paddingObject[minProp];
  3885. var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
  3886. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  3887. var offset2 = within(min2, center, max2);
  3888. var axisProp = axis;
  3889. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
  3890. }
  3891. function effect$1(_ref2) {
  3892. var state = _ref2.state, options = _ref2.options;
  3893. var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
  3894. if (arrowElement == null) {
  3895. return;
  3896. }
  3897. if (typeof arrowElement === "string") {
  3898. arrowElement = state.elements.popper.querySelector(arrowElement);
  3899. if (!arrowElement) {
  3900. return;
  3901. }
  3902. }
  3903. if (!contains(state.elements.popper, arrowElement)) {
  3904. return;
  3905. }
  3906. state.elements.arrow = arrowElement;
  3907. }
  3908. const arrow$1 = {
  3909. name: "arrow",
  3910. enabled: true,
  3911. phase: "main",
  3912. fn: arrow,
  3913. effect: effect$1,
  3914. requires: ["popperOffsets"],
  3915. requiresIfExists: ["preventOverflow"]
  3916. };
  3917. function getVariation(placement) {
  3918. return placement.split("-")[1];
  3919. }
  3920. var unsetSides = {
  3921. top: "auto",
  3922. right: "auto",
  3923. bottom: "auto",
  3924. left: "auto"
  3925. };
  3926. function roundOffsetsByDPR(_ref, win) {
  3927. var x = _ref.x, y = _ref.y;
  3928. var dpr = win.devicePixelRatio || 1;
  3929. return {
  3930. x: round(x * dpr) / dpr || 0,
  3931. y: round(y * dpr) / dpr || 0
  3932. };
  3933. }
  3934. function mapToStyles(_ref2) {
  3935. var _Object$assign2;
  3936. var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
  3937. var _offsets$x = offsets.x, x = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
  3938. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  3939. x,
  3940. y
  3941. }) : {
  3942. x,
  3943. y
  3944. };
  3945. x = _ref3.x;
  3946. y = _ref3.y;
  3947. var hasX = offsets.hasOwnProperty("x");
  3948. var hasY = offsets.hasOwnProperty("y");
  3949. var sideX = left;
  3950. var sideY = top;
  3951. var win = window;
  3952. if (adaptive) {
  3953. var offsetParent = getOffsetParent(popper2);
  3954. var heightProp = "clientHeight";
  3955. var widthProp = "clientWidth";
  3956. if (offsetParent === getWindow(popper2)) {
  3957. offsetParent = getDocumentElement(popper2);
  3958. if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
  3959. heightProp = "scrollHeight";
  3960. widthProp = "scrollWidth";
  3961. }
  3962. }
  3963. offsetParent = offsetParent;
  3964. if (placement === top || (placement === left || placement === right) && variation === end) {
  3965. sideY = bottom;
  3966. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
  3967. // $FlowFixMe[prop-missing]
  3968. offsetParent[heightProp]
  3969. );
  3970. y -= offsetY - popperRect.height;
  3971. y *= gpuAcceleration ? 1 : -1;
  3972. }
  3973. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  3974. sideX = right;
  3975. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
  3976. // $FlowFixMe[prop-missing]
  3977. offsetParent[widthProp]
  3978. );
  3979. x -= offsetX - popperRect.width;
  3980. x *= gpuAcceleration ? 1 : -1;
  3981. }
  3982. }
  3983. var commonStyles = Object.assign({
  3984. position
  3985. }, adaptive && unsetSides);
  3986. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  3987. x,
  3988. y
  3989. }, getWindow(popper2)) : {
  3990. x,
  3991. y
  3992. };
  3993. x = _ref4.x;
  3994. y = _ref4.y;
  3995. if (gpuAcceleration) {
  3996. var _Object$assign;
  3997. return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
  3998. }
  3999. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  4000. }
  4001. function computeStyles(_ref5) {
  4002. var state = _ref5.state, options = _ref5.options;
  4003. var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  4004. var commonStyles = {
  4005. placement: getBasePlacement$1(state.placement),
  4006. variation: getVariation(state.placement),
  4007. popper: state.elements.popper,
  4008. popperRect: state.rects.popper,
  4009. gpuAcceleration,
  4010. isFixed: state.options.strategy === "fixed"
  4011. };
  4012. if (state.modifiersData.popperOffsets != null) {
  4013. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  4014. offsets: state.modifiersData.popperOffsets,
  4015. position: state.options.strategy,
  4016. adaptive,
  4017. roundOffsets
  4018. })));
  4019. }
  4020. if (state.modifiersData.arrow != null) {
  4021. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  4022. offsets: state.modifiersData.arrow,
  4023. position: "absolute",
  4024. adaptive: false,
  4025. roundOffsets
  4026. })));
  4027. }
  4028. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  4029. "data-popper-placement": state.placement
  4030. });
  4031. }
  4032. const computeStyles$1 = {
  4033. name: "computeStyles",
  4034. enabled: true,
  4035. phase: "beforeWrite",
  4036. fn: computeStyles,
  4037. data: {}
  4038. };
  4039. var passive = {
  4040. passive: true
  4041. };
  4042. function effect(_ref) {
  4043. var state = _ref.state, instance = _ref.instance, options = _ref.options;
  4044. var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
  4045. var window2 = getWindow(state.elements.popper);
  4046. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  4047. if (scroll) {
  4048. scrollParents.forEach(function(scrollParent) {
  4049. scrollParent.addEventListener("scroll", instance.update, passive);
  4050. });
  4051. }
  4052. if (resize) {
  4053. window2.addEventListener("resize", instance.update, passive);
  4054. }
  4055. return function() {
  4056. if (scroll) {
  4057. scrollParents.forEach(function(scrollParent) {
  4058. scrollParent.removeEventListener("scroll", instance.update, passive);
  4059. });
  4060. }
  4061. if (resize) {
  4062. window2.removeEventListener("resize", instance.update, passive);
  4063. }
  4064. };
  4065. }
  4066. const eventListeners = {
  4067. name: "eventListeners",
  4068. enabled: true,
  4069. phase: "write",
  4070. fn: function fn() {
  4071. },
  4072. effect,
  4073. data: {}
  4074. };
  4075. var hash$1 = {
  4076. left: "right",
  4077. right: "left",
  4078. bottom: "top",
  4079. top: "bottom"
  4080. };
  4081. function getOppositePlacement(placement) {
  4082. return placement.replace(/left|right|bottom|top/g, function(matched) {
  4083. return hash$1[matched];
  4084. });
  4085. }
  4086. var hash = {
  4087. start: "end",
  4088. end: "start"
  4089. };
  4090. function getOppositeVariationPlacement(placement) {
  4091. return placement.replace(/start|end/g, function(matched) {
  4092. return hash[matched];
  4093. });
  4094. }
  4095. function getWindowScroll(node) {
  4096. var win = getWindow(node);
  4097. var scrollLeft = win.pageXOffset;
  4098. var scrollTop = win.pageYOffset;
  4099. return {
  4100. scrollLeft,
  4101. scrollTop
  4102. };
  4103. }
  4104. function getWindowScrollBarX(element) {
  4105. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  4106. }
  4107. function getViewportRect(element, strategy) {
  4108. var win = getWindow(element);
  4109. var html = getDocumentElement(element);
  4110. var visualViewport = win.visualViewport;
  4111. var width = html.clientWidth;
  4112. var height = html.clientHeight;
  4113. var x = 0;
  4114. var y = 0;
  4115. if (visualViewport) {
  4116. width = visualViewport.width;
  4117. height = visualViewport.height;
  4118. var layoutViewport = isLayoutViewport();
  4119. if (layoutViewport || !layoutViewport && strategy === "fixed") {
  4120. x = visualViewport.offsetLeft;
  4121. y = visualViewport.offsetTop;
  4122. }
  4123. }
  4124. return {
  4125. width,
  4126. height,
  4127. x: x + getWindowScrollBarX(element),
  4128. y
  4129. };
  4130. }
  4131. function getDocumentRect(element) {
  4132. var _element$ownerDocumen;
  4133. var html = getDocumentElement(element);
  4134. var winScroll = getWindowScroll(element);
  4135. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  4136. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  4137. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  4138. var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
  4139. var y = -winScroll.scrollTop;
  4140. if (getComputedStyle(body || html).direction === "rtl") {
  4141. x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  4142. }
  4143. return {
  4144. width,
  4145. height,
  4146. x,
  4147. y
  4148. };
  4149. }
  4150. function isScrollParent(element) {
  4151. var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  4152. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  4153. }
  4154. function getScrollParent(node) {
  4155. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  4156. return node.ownerDocument.body;
  4157. }
  4158. if (isHTMLElement(node) && isScrollParent(node)) {
  4159. return node;
  4160. }
  4161. return getScrollParent(getParentNode(node));
  4162. }
  4163. function listScrollParents(element, list) {
  4164. var _element$ownerDocumen;
  4165. if (list === void 0) {
  4166. list = [];
  4167. }
  4168. var scrollParent = getScrollParent(element);
  4169. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  4170. var win = getWindow(scrollParent);
  4171. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  4172. var updatedList = list.concat(target);
  4173. return isBody ? updatedList : (
  4174. // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  4175. updatedList.concat(listScrollParents(getParentNode(target)))
  4176. );
  4177. }
  4178. function rectToClientRect(rect) {
  4179. return Object.assign({}, rect, {
  4180. left: rect.x,
  4181. top: rect.y,
  4182. right: rect.x + rect.width,
  4183. bottom: rect.y + rect.height
  4184. });
  4185. }
  4186. function getInnerBoundingClientRect(element, strategy) {
  4187. var rect = getBoundingClientRect(element, false, strategy === "fixed");
  4188. rect.top = rect.top + element.clientTop;
  4189. rect.left = rect.left + element.clientLeft;
  4190. rect.bottom = rect.top + element.clientHeight;
  4191. rect.right = rect.left + element.clientWidth;
  4192. rect.width = element.clientWidth;
  4193. rect.height = element.clientHeight;
  4194. rect.x = rect.left;
  4195. rect.y = rect.top;
  4196. return rect;
  4197. }
  4198. function getClientRectFromMixedType(element, clippingParent, strategy) {
  4199. return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  4200. }
  4201. function getClippingParents(element) {
  4202. var clippingParents2 = listScrollParents(getParentNode(element));
  4203. var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle(element).position) >= 0;
  4204. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  4205. if (!isElement$1(clipperElement)) {
  4206. return [];
  4207. }
  4208. return clippingParents2.filter(function(clippingParent) {
  4209. return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
  4210. });
  4211. }
  4212. function getClippingRect(element, boundary, rootBoundary, strategy) {
  4213. var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
  4214. var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
  4215. var firstClippingParent = clippingParents2[0];
  4216. var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
  4217. var rect = getClientRectFromMixedType(element, clippingParent, strategy);
  4218. accRect.top = max(rect.top, accRect.top);
  4219. accRect.right = min(rect.right, accRect.right);
  4220. accRect.bottom = min(rect.bottom, accRect.bottom);
  4221. accRect.left = max(rect.left, accRect.left);
  4222. return accRect;
  4223. }, getClientRectFromMixedType(element, firstClippingParent, strategy));
  4224. clippingRect.width = clippingRect.right - clippingRect.left;
  4225. clippingRect.height = clippingRect.bottom - clippingRect.top;
  4226. clippingRect.x = clippingRect.left;
  4227. clippingRect.y = clippingRect.top;
  4228. return clippingRect;
  4229. }
  4230. function computeOffsets(_ref) {
  4231. var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
  4232. var basePlacement = placement ? getBasePlacement$1(placement) : null;
  4233. var variation = placement ? getVariation(placement) : null;
  4234. var commonX = reference2.x + reference2.width / 2 - element.width / 2;
  4235. var commonY = reference2.y + reference2.height / 2 - element.height / 2;
  4236. var offsets;
  4237. switch (basePlacement) {
  4238. case top:
  4239. offsets = {
  4240. x: commonX,
  4241. y: reference2.y - element.height
  4242. };
  4243. break;
  4244. case bottom:
  4245. offsets = {
  4246. x: commonX,
  4247. y: reference2.y + reference2.height
  4248. };
  4249. break;
  4250. case right:
  4251. offsets = {
  4252. x: reference2.x + reference2.width,
  4253. y: commonY
  4254. };
  4255. break;
  4256. case left:
  4257. offsets = {
  4258. x: reference2.x - element.width,
  4259. y: commonY
  4260. };
  4261. break;
  4262. default:
  4263. offsets = {
  4264. x: reference2.x,
  4265. y: reference2.y
  4266. };
  4267. }
  4268. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  4269. if (mainAxis != null) {
  4270. var len = mainAxis === "y" ? "height" : "width";
  4271. switch (variation) {
  4272. case start:
  4273. offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
  4274. break;
  4275. case end:
  4276. offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
  4277. break;
  4278. }
  4279. }
  4280. return offsets;
  4281. }
  4282. function detectOverflow(state, options) {
  4283. if (options === void 0) {
  4284. options = {};
  4285. }
  4286. var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$strategy = _options.strategy, strategy = _options$strategy === void 0 ? state.strategy : _options$strategy, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
  4287. var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  4288. var altContext = elementContext === popper ? reference : popper;
  4289. var popperRect = state.rects.popper;
  4290. var element = state.elements[altBoundary ? altContext : elementContext];
  4291. var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
  4292. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  4293. var popperOffsets2 = computeOffsets({
  4294. reference: referenceClientRect,
  4295. element: popperRect,
  4296. strategy: "absolute",
  4297. placement
  4298. });
  4299. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
  4300. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
  4301. var overflowOffsets = {
  4302. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  4303. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  4304. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  4305. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  4306. };
  4307. var offsetData = state.modifiersData.offset;
  4308. if (elementContext === popper && offsetData) {
  4309. var offset2 = offsetData[placement];
  4310. Object.keys(overflowOffsets).forEach(function(key) {
  4311. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  4312. var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
  4313. overflowOffsets[key] += offset2[axis] * multiply;
  4314. });
  4315. }
  4316. return overflowOffsets;
  4317. }
  4318. function computeAutoPlacement(state, options) {
  4319. if (options === void 0) {
  4320. options = {};
  4321. }
  4322. var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
  4323. var variation = getVariation(placement);
  4324. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
  4325. return getVariation(placement2) === variation;
  4326. }) : basePlacements;
  4327. var allowedPlacements = placements$1.filter(function(placement2) {
  4328. return allowedAutoPlacements.indexOf(placement2) >= 0;
  4329. });
  4330. if (allowedPlacements.length === 0) {
  4331. allowedPlacements = placements$1;
  4332. }
  4333. var overflows = allowedPlacements.reduce(function(acc, placement2) {
  4334. acc[placement2] = detectOverflow(state, {
  4335. placement: placement2,
  4336. boundary,
  4337. rootBoundary,
  4338. padding
  4339. })[getBasePlacement$1(placement2)];
  4340. return acc;
  4341. }, {});
  4342. return Object.keys(overflows).sort(function(a, b) {
  4343. return overflows[a] - overflows[b];
  4344. });
  4345. }
  4346. function getExpandedFallbackPlacements(placement) {
  4347. if (getBasePlacement$1(placement) === auto) {
  4348. return [];
  4349. }
  4350. var oppositePlacement = getOppositePlacement(placement);
  4351. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  4352. }
  4353. function flip(_ref) {
  4354. var state = _ref.state, options = _ref.options, name = _ref.name;
  4355. if (state.modifiersData[name]._skip) {
  4356. return;
  4357. }
  4358. var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
  4359. var preferredPlacement = state.options.placement;
  4360. var basePlacement = getBasePlacement$1(preferredPlacement);
  4361. var isBasePlacement = basePlacement === preferredPlacement;
  4362. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  4363. var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
  4364. return acc.concat(getBasePlacement$1(placement2) === auto ? computeAutoPlacement(state, {
  4365. placement: placement2,
  4366. boundary,
  4367. rootBoundary,
  4368. padding,
  4369. flipVariations,
  4370. allowedAutoPlacements
  4371. }) : placement2);
  4372. }, []);
  4373. var referenceRect = state.rects.reference;
  4374. var popperRect = state.rects.popper;
  4375. var checksMap = /* @__PURE__ */ new Map();
  4376. var makeFallbackChecks = true;
  4377. var firstFittingPlacement = placements2[0];
  4378. for (var i = 0; i < placements2.length; i++) {
  4379. var placement = placements2[i];
  4380. var _basePlacement = getBasePlacement$1(placement);
  4381. var isStartVariation = getVariation(placement) === start;
  4382. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  4383. var len = isVertical ? "width" : "height";
  4384. var overflow = detectOverflow(state, {
  4385. placement,
  4386. boundary,
  4387. rootBoundary,
  4388. altBoundary,
  4389. padding
  4390. });
  4391. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  4392. if (referenceRect[len] > popperRect[len]) {
  4393. mainVariationSide = getOppositePlacement(mainVariationSide);
  4394. }
  4395. var altVariationSide = getOppositePlacement(mainVariationSide);
  4396. var checks = [];
  4397. if (checkMainAxis) {
  4398. checks.push(overflow[_basePlacement] <= 0);
  4399. }
  4400. if (checkAltAxis) {
  4401. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  4402. }
  4403. if (checks.every(function(check) {
  4404. return check;
  4405. })) {
  4406. firstFittingPlacement = placement;
  4407. makeFallbackChecks = false;
  4408. break;
  4409. }
  4410. checksMap.set(placement, checks);
  4411. }
  4412. if (makeFallbackChecks) {
  4413. var numberOfChecks = flipVariations ? 3 : 1;
  4414. var _loop = function _loop2(_i2) {
  4415. var fittingPlacement = placements2.find(function(placement2) {
  4416. var checks2 = checksMap.get(placement2);
  4417. if (checks2) {
  4418. return checks2.slice(0, _i2).every(function(check) {
  4419. return check;
  4420. });
  4421. }
  4422. });
  4423. if (fittingPlacement) {
  4424. firstFittingPlacement = fittingPlacement;
  4425. return "break";
  4426. }
  4427. };
  4428. for (var _i = numberOfChecks; _i > 0; _i--) {
  4429. var _ret = _loop(_i);
  4430. if (_ret === "break") break;
  4431. }
  4432. }
  4433. if (state.placement !== firstFittingPlacement) {
  4434. state.modifiersData[name]._skip = true;
  4435. state.placement = firstFittingPlacement;
  4436. state.reset = true;
  4437. }
  4438. }
  4439. const flip$1 = {
  4440. name: "flip",
  4441. enabled: true,
  4442. phase: "main",
  4443. fn: flip,
  4444. requiresIfExists: ["offset"],
  4445. data: {
  4446. _skip: false
  4447. }
  4448. };
  4449. function getSideOffsets(overflow, rect, preventedOffsets) {
  4450. if (preventedOffsets === void 0) {
  4451. preventedOffsets = {
  4452. x: 0,
  4453. y: 0
  4454. };
  4455. }
  4456. return {
  4457. top: overflow.top - rect.height - preventedOffsets.y,
  4458. right: overflow.right - rect.width + preventedOffsets.x,
  4459. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  4460. left: overflow.left - rect.width - preventedOffsets.x
  4461. };
  4462. }
  4463. function isAnySideFullyClipped(overflow) {
  4464. return [top, right, bottom, left].some(function(side) {
  4465. return overflow[side] >= 0;
  4466. });
  4467. }
  4468. function hide(_ref) {
  4469. var state = _ref.state, name = _ref.name;
  4470. var referenceRect = state.rects.reference;
  4471. var popperRect = state.rects.popper;
  4472. var preventedOffsets = state.modifiersData.preventOverflow;
  4473. var referenceOverflow = detectOverflow(state, {
  4474. elementContext: "reference"
  4475. });
  4476. var popperAltOverflow = detectOverflow(state, {
  4477. altBoundary: true
  4478. });
  4479. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  4480. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  4481. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  4482. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  4483. state.modifiersData[name] = {
  4484. referenceClippingOffsets,
  4485. popperEscapeOffsets,
  4486. isReferenceHidden,
  4487. hasPopperEscaped
  4488. };
  4489. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  4490. "data-popper-reference-hidden": isReferenceHidden,
  4491. "data-popper-escaped": hasPopperEscaped
  4492. });
  4493. }
  4494. const hide$1 = {
  4495. name: "hide",
  4496. enabled: true,
  4497. phase: "main",
  4498. requiresIfExists: ["preventOverflow"],
  4499. fn: hide
  4500. };
  4501. function distanceAndSkiddingToXY(placement, rects, offset2) {
  4502. var basePlacement = getBasePlacement$1(placement);
  4503. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  4504. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  4505. placement
  4506. })) : offset2, skidding = _ref[0], distance = _ref[1];
  4507. skidding = skidding || 0;
  4508. distance = (distance || 0) * invertDistance;
  4509. return [left, right].indexOf(basePlacement) >= 0 ? {
  4510. x: distance,
  4511. y: skidding
  4512. } : {
  4513. x: skidding,
  4514. y: distance
  4515. };
  4516. }
  4517. function offset(_ref2) {
  4518. var state = _ref2.state, options = _ref2.options, name = _ref2.name;
  4519. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  4520. var data = placements.reduce(function(acc, placement) {
  4521. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  4522. return acc;
  4523. }, {});
  4524. var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
  4525. if (state.modifiersData.popperOffsets != null) {
  4526. state.modifiersData.popperOffsets.x += x;
  4527. state.modifiersData.popperOffsets.y += y;
  4528. }
  4529. state.modifiersData[name] = data;
  4530. }
  4531. const offset$1 = {
  4532. name: "offset",
  4533. enabled: true,
  4534. phase: "main",
  4535. requires: ["popperOffsets"],
  4536. fn: offset
  4537. };
  4538. function popperOffsets(_ref) {
  4539. var state = _ref.state, name = _ref.name;
  4540. state.modifiersData[name] = computeOffsets({
  4541. reference: state.rects.reference,
  4542. element: state.rects.popper,
  4543. strategy: "absolute",
  4544. placement: state.placement
  4545. });
  4546. }
  4547. const popperOffsets$1 = {
  4548. name: "popperOffsets",
  4549. enabled: true,
  4550. phase: "read",
  4551. fn: popperOffsets,
  4552. data: {}
  4553. };
  4554. function getAltAxis(axis) {
  4555. return axis === "x" ? "y" : "x";
  4556. }
  4557. function preventOverflow(_ref) {
  4558. var state = _ref.state, options = _ref.options, name = _ref.name;
  4559. var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
  4560. var overflow = detectOverflow(state, {
  4561. boundary,
  4562. rootBoundary,
  4563. padding,
  4564. altBoundary
  4565. });
  4566. var basePlacement = getBasePlacement$1(state.placement);
  4567. var variation = getVariation(state.placement);
  4568. var isBasePlacement = !variation;
  4569. var mainAxis = getMainAxisFromPlacement(basePlacement);
  4570. var altAxis = getAltAxis(mainAxis);
  4571. var popperOffsets2 = state.modifiersData.popperOffsets;
  4572. var referenceRect = state.rects.reference;
  4573. var popperRect = state.rects.popper;
  4574. var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
  4575. placement: state.placement
  4576. })) : tetherOffset;
  4577. var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
  4578. mainAxis: tetherOffsetValue,
  4579. altAxis: tetherOffsetValue
  4580. } : Object.assign({
  4581. mainAxis: 0,
  4582. altAxis: 0
  4583. }, tetherOffsetValue);
  4584. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  4585. var data = {
  4586. x: 0,
  4587. y: 0
  4588. };
  4589. if (!popperOffsets2) {
  4590. return;
  4591. }
  4592. if (checkMainAxis) {
  4593. var _offsetModifierState$;
  4594. var mainSide = mainAxis === "y" ? top : left;
  4595. var altSide = mainAxis === "y" ? bottom : right;
  4596. var len = mainAxis === "y" ? "height" : "width";
  4597. var offset2 = popperOffsets2[mainAxis];
  4598. var min$1 = offset2 + overflow[mainSide];
  4599. var max$1 = offset2 - overflow[altSide];
  4600. var additive = tether ? -popperRect[len] / 2 : 0;
  4601. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  4602. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
  4603. var arrowElement = state.elements.arrow;
  4604. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  4605. width: 0,
  4606. height: 0
  4607. };
  4608. var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
  4609. var arrowPaddingMin = arrowPaddingObject[mainSide];
  4610. var arrowPaddingMax = arrowPaddingObject[altSide];
  4611. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  4612. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  4613. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  4614. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  4615. var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  4616. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  4617. var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
  4618. var tetherMax = offset2 + maxOffset - offsetModifierValue;
  4619. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
  4620. popperOffsets2[mainAxis] = preventedOffset;
  4621. data[mainAxis] = preventedOffset - offset2;
  4622. }
  4623. if (checkAltAxis) {
  4624. var _offsetModifierState$2;
  4625. var _mainSide = mainAxis === "x" ? top : left;
  4626. var _altSide = mainAxis === "x" ? bottom : right;
  4627. var _offset = popperOffsets2[altAxis];
  4628. var _len = altAxis === "y" ? "height" : "width";
  4629. var _min = _offset + overflow[_mainSide];
  4630. var _max = _offset - overflow[_altSide];
  4631. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  4632. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  4633. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  4634. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  4635. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  4636. popperOffsets2[altAxis] = _preventedOffset;
  4637. data[altAxis] = _preventedOffset - _offset;
  4638. }
  4639. state.modifiersData[name] = data;
  4640. }
  4641. const preventOverflow$1 = {
  4642. name: "preventOverflow",
  4643. enabled: true,
  4644. phase: "main",
  4645. fn: preventOverflow,
  4646. requiresIfExists: ["offset"]
  4647. };
  4648. function getHTMLElementScroll(element) {
  4649. return {
  4650. scrollLeft: element.scrollLeft,
  4651. scrollTop: element.scrollTop
  4652. };
  4653. }
  4654. function getNodeScroll(node) {
  4655. if (node === getWindow(node) || !isHTMLElement(node)) {
  4656. return getWindowScroll(node);
  4657. } else {
  4658. return getHTMLElementScroll(node);
  4659. }
  4660. }
  4661. function isElementScaled(element) {
  4662. var rect = element.getBoundingClientRect();
  4663. var scaleX = round(rect.width) / element.offsetWidth || 1;
  4664. var scaleY = round(rect.height) / element.offsetHeight || 1;
  4665. return scaleX !== 1 || scaleY !== 1;
  4666. }
  4667. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  4668. if (isFixed === void 0) {
  4669. isFixed = false;
  4670. }
  4671. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  4672. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  4673. var documentElement = getDocumentElement(offsetParent);
  4674. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  4675. var scroll = {
  4676. scrollLeft: 0,
  4677. scrollTop: 0
  4678. };
  4679. var offsets = {
  4680. x: 0,
  4681. y: 0
  4682. };
  4683. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  4684. if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
  4685. isScrollParent(documentElement)) {
  4686. scroll = getNodeScroll(offsetParent);
  4687. }
  4688. if (isHTMLElement(offsetParent)) {
  4689. offsets = getBoundingClientRect(offsetParent, true);
  4690. offsets.x += offsetParent.clientLeft;
  4691. offsets.y += offsetParent.clientTop;
  4692. } else if (documentElement) {
  4693. offsets.x = getWindowScrollBarX(documentElement);
  4694. }
  4695. }
  4696. return {
  4697. x: rect.left + scroll.scrollLeft - offsets.x,
  4698. y: rect.top + scroll.scrollTop - offsets.y,
  4699. width: rect.width,
  4700. height: rect.height
  4701. };
  4702. }
  4703. function order(modifiers) {
  4704. var map = /* @__PURE__ */ new Map();
  4705. var visited = /* @__PURE__ */ new Set();
  4706. var result = [];
  4707. modifiers.forEach(function(modifier) {
  4708. map.set(modifier.name, modifier);
  4709. });
  4710. function sort(modifier) {
  4711. visited.add(modifier.name);
  4712. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  4713. requires.forEach(function(dep) {
  4714. if (!visited.has(dep)) {
  4715. var depModifier = map.get(dep);
  4716. if (depModifier) {
  4717. sort(depModifier);
  4718. }
  4719. }
  4720. });
  4721. result.push(modifier);
  4722. }
  4723. modifiers.forEach(function(modifier) {
  4724. if (!visited.has(modifier.name)) {
  4725. sort(modifier);
  4726. }
  4727. });
  4728. return result;
  4729. }
  4730. function orderModifiers(modifiers) {
  4731. var orderedModifiers = order(modifiers);
  4732. return modifierPhases.reduce(function(acc, phase) {
  4733. return acc.concat(orderedModifiers.filter(function(modifier) {
  4734. return modifier.phase === phase;
  4735. }));
  4736. }, []);
  4737. }
  4738. function debounce$1(fn2) {
  4739. var pending;
  4740. return function() {
  4741. if (!pending) {
  4742. pending = new Promise(function(resolve) {
  4743. Promise.resolve().then(function() {
  4744. pending = void 0;
  4745. resolve(fn2());
  4746. });
  4747. });
  4748. }
  4749. return pending;
  4750. };
  4751. }
  4752. function mergeByName(modifiers) {
  4753. var merged = modifiers.reduce(function(merged2, current) {
  4754. var existing = merged2[current.name];
  4755. merged2[current.name] = existing ? Object.assign({}, existing, current, {
  4756. options: Object.assign({}, existing.options, current.options),
  4757. data: Object.assign({}, existing.data, current.data)
  4758. }) : current;
  4759. return merged2;
  4760. }, {});
  4761. return Object.keys(merged).map(function(key) {
  4762. return merged[key];
  4763. });
  4764. }
  4765. var DEFAULT_OPTIONS = {
  4766. placement: "bottom",
  4767. modifiers: [],
  4768. strategy: "absolute"
  4769. };
  4770. function areValidElements() {
  4771. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  4772. args[_key] = arguments[_key];
  4773. }
  4774. return !args.some(function(element) {
  4775. return !(element && typeof element.getBoundingClientRect === "function");
  4776. });
  4777. }
  4778. function popperGenerator(generatorOptions) {
  4779. if (generatorOptions === void 0) {
  4780. generatorOptions = {};
  4781. }
  4782. var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  4783. return function createPopper2(reference2, popper2, options) {
  4784. if (options === void 0) {
  4785. options = defaultOptions;
  4786. }
  4787. var state = {
  4788. placement: "bottom",
  4789. orderedModifiers: [],
  4790. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  4791. modifiersData: {},
  4792. elements: {
  4793. reference: reference2,
  4794. popper: popper2
  4795. },
  4796. attributes: {},
  4797. styles: {}
  4798. };
  4799. var effectCleanupFns = [];
  4800. var isDestroyed = false;
  4801. var instance = {
  4802. state,
  4803. setOptions: function setOptions(setOptionsAction) {
  4804. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  4805. cleanupModifierEffects();
  4806. state.options = Object.assign({}, defaultOptions, state.options, options2);
  4807. state.scrollParents = {
  4808. reference: isElement$1(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
  4809. popper: listScrollParents(popper2)
  4810. };
  4811. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  4812. state.orderedModifiers = orderedModifiers.filter(function(m) {
  4813. return m.enabled;
  4814. });
  4815. runModifierEffects();
  4816. return instance.update();
  4817. },
  4818. // Sync update – it will always be executed, even if not necessary. This
  4819. // is useful for low frequency updates where sync behavior simplifies the
  4820. // logic.
  4821. // For high frequency updates (e.g. `resize` and `scroll` events), always
  4822. // prefer the async Popper#update method
  4823. forceUpdate: function forceUpdate() {
  4824. if (isDestroyed) {
  4825. return;
  4826. }
  4827. var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
  4828. if (!areValidElements(reference3, popper3)) {
  4829. return;
  4830. }
  4831. state.rects = {
  4832. reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
  4833. popper: getLayoutRect(popper3)
  4834. };
  4835. state.reset = false;
  4836. state.placement = state.options.placement;
  4837. state.orderedModifiers.forEach(function(modifier) {
  4838. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  4839. });
  4840. for (var index = 0; index < state.orderedModifiers.length; index++) {
  4841. if (state.reset === true) {
  4842. state.reset = false;
  4843. index = -1;
  4844. continue;
  4845. }
  4846. var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
  4847. if (typeof fn2 === "function") {
  4848. state = fn2({
  4849. state,
  4850. options: _options,
  4851. name,
  4852. instance
  4853. }) || state;
  4854. }
  4855. }
  4856. },
  4857. // Async and optimistically optimized update – it will not be executed if
  4858. // not necessary (debounced to run at most once-per-tick)
  4859. update: debounce$1(function() {
  4860. return new Promise(function(resolve) {
  4861. instance.forceUpdate();
  4862. resolve(state);
  4863. });
  4864. }),
  4865. destroy: function destroy() {
  4866. cleanupModifierEffects();
  4867. isDestroyed = true;
  4868. }
  4869. };
  4870. if (!areValidElements(reference2, popper2)) {
  4871. return instance;
  4872. }
  4873. instance.setOptions(options).then(function(state2) {
  4874. if (!isDestroyed && options.onFirstUpdate) {
  4875. options.onFirstUpdate(state2);
  4876. }
  4877. });
  4878. function runModifierEffects() {
  4879. state.orderedModifiers.forEach(function(_ref) {
  4880. var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect3 = _ref.effect;
  4881. if (typeof effect3 === "function") {
  4882. var cleanupFn = effect3({
  4883. state,
  4884. name,
  4885. instance,
  4886. options: options2
  4887. });
  4888. var noopFn = function noopFn2() {
  4889. };
  4890. effectCleanupFns.push(cleanupFn || noopFn);
  4891. }
  4892. });
  4893. }
  4894. function cleanupModifierEffects() {
  4895. effectCleanupFns.forEach(function(fn2) {
  4896. return fn2();
  4897. });
  4898. effectCleanupFns = [];
  4899. }
  4900. return instance;
  4901. };
  4902. }
  4903. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  4904. var createPopper = /* @__PURE__ */ popperGenerator({
  4905. defaultModifiers
  4906. });
  4907. var BOX_CLASS = "tippy-box";
  4908. var CONTENT_CLASS = "tippy-content";
  4909. var BACKDROP_CLASS = "tippy-backdrop";
  4910. var ARROW_CLASS = "tippy-arrow";
  4911. var SVG_ARROW_CLASS = "tippy-svg-arrow";
  4912. var TOUCH_OPTIONS = {
  4913. passive: true,
  4914. capture: true
  4915. };
  4916. var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO2() {
  4917. return document.body;
  4918. };
  4919. function getValueAtIndexOrReturn(value, index, defaultValue) {
  4920. if (Array.isArray(value)) {
  4921. var v = value[index];
  4922. return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;
  4923. }
  4924. return value;
  4925. }
  4926. function isType(value, type) {
  4927. var str = {}.toString.call(value);
  4928. return str.indexOf("[object") === 0 && str.indexOf(type + "]") > -1;
  4929. }
  4930. function invokeWithArgsOrReturn(value, args) {
  4931. return typeof value === "function" ? value.apply(void 0, args) : value;
  4932. }
  4933. function debounce(fn5, ms) {
  4934. if (ms === 0) {
  4935. return fn5;
  4936. }
  4937. var timeout;
  4938. return function(arg) {
  4939. clearTimeout(timeout);
  4940. timeout = setTimeout(function() {
  4941. fn5(arg);
  4942. }, ms);
  4943. };
  4944. }
  4945. function splitBySpaces(value) {
  4946. return value.split(/\s+/).filter(Boolean);
  4947. }
  4948. function normalizeToArray(value) {
  4949. return [].concat(value);
  4950. }
  4951. function pushIfUnique(arr, value) {
  4952. if (arr.indexOf(value) === -1) {
  4953. arr.push(value);
  4954. }
  4955. }
  4956. function unique(arr) {
  4957. return arr.filter(function(item, index) {
  4958. return arr.indexOf(item) === index;
  4959. });
  4960. }
  4961. function getBasePlacement(placement) {
  4962. return placement.split("-")[0];
  4963. }
  4964. function arrayFrom(value) {
  4965. return [].slice.call(value);
  4966. }
  4967. function removeUndefinedProps(obj) {
  4968. return Object.keys(obj).reduce(function(acc, key) {
  4969. if (obj[key] !== void 0) {
  4970. acc[key] = obj[key];
  4971. }
  4972. return acc;
  4973. }, {});
  4974. }
  4975. function div() {
  4976. return document.createElement("div");
  4977. }
  4978. function isElement(value) {
  4979. return ["Element", "Fragment"].some(function(type) {
  4980. return isType(value, type);
  4981. });
  4982. }
  4983. function isNodeList(value) {
  4984. return isType(value, "NodeList");
  4985. }
  4986. function isMouseEvent(value) {
  4987. return isType(value, "MouseEvent");
  4988. }
  4989. function isReferenceElement(value) {
  4990. return !!(value && value._tippy && value._tippy.reference === value);
  4991. }
  4992. function getArrayOfElements(value) {
  4993. if (isElement(value)) {
  4994. return [value];
  4995. }
  4996. if (isNodeList(value)) {
  4997. return arrayFrom(value);
  4998. }
  4999. if (Array.isArray(value)) {
  5000. return value;
  5001. }
  5002. return arrayFrom(document.querySelectorAll(value));
  5003. }
  5004. function setTransitionDuration(els, value) {
  5005. els.forEach(function(el) {
  5006. if (el) {
  5007. el.style.transitionDuration = value + "ms";
  5008. }
  5009. });
  5010. }
  5011. function setVisibilityState(els, state) {
  5012. els.forEach(function(el) {
  5013. if (el) {
  5014. el.setAttribute("data-state", state);
  5015. }
  5016. });
  5017. }
  5018. function getOwnerDocument(elementOrElements) {
  5019. var _element$ownerDocumen;
  5020. var _normalizeToArray = normalizeToArray(elementOrElements), element = _normalizeToArray[0];
  5021. return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
  5022. }
  5023. function isCursorOutsideInteractiveBorder(popperTreeData, event) {
  5024. var clientX = event.clientX, clientY = event.clientY;
  5025. return popperTreeData.every(function(_ref) {
  5026. var popperRect = _ref.popperRect, popperState = _ref.popperState, props = _ref.props;
  5027. var interactiveBorder = props.interactiveBorder;
  5028. var basePlacement = getBasePlacement(popperState.placement);
  5029. var offsetData = popperState.modifiersData.offset;
  5030. if (!offsetData) {
  5031. return true;
  5032. }
  5033. var topDistance = basePlacement === "bottom" ? offsetData.top.y : 0;
  5034. var bottomDistance = basePlacement === "top" ? offsetData.bottom.y : 0;
  5035. var leftDistance = basePlacement === "right" ? offsetData.left.x : 0;
  5036. var rightDistance = basePlacement === "left" ? offsetData.right.x : 0;
  5037. var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder;
  5038. var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder;
  5039. var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder;
  5040. var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder;
  5041. return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
  5042. });
  5043. }
  5044. function updateTransitionEndListener(box, action, listener) {
  5045. var method = action + "EventListener";
  5046. ["transitionend", "webkitTransitionEnd"].forEach(function(event) {
  5047. box[method](event, listener);
  5048. });
  5049. }
  5050. function actualContains(parent, child) {
  5051. var target = child;
  5052. while (target) {
  5053. var _target$getRootNode;
  5054. if (parent.contains(target)) {
  5055. return true;
  5056. }
  5057. target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
  5058. }
  5059. return false;
  5060. }
  5061. var currentInput = {
  5062. isTouch: false
  5063. };
  5064. var lastMouseMoveTime = 0;
  5065. function onDocumentTouchStart() {
  5066. if (currentInput.isTouch) {
  5067. return;
  5068. }
  5069. currentInput.isTouch = true;
  5070. if (window.performance) {
  5071. document.addEventListener("mousemove", onDocumentMouseMove);
  5072. }
  5073. }
  5074. function onDocumentMouseMove() {
  5075. var now = performance.now();
  5076. if (now - lastMouseMoveTime < 20) {
  5077. currentInput.isTouch = false;
  5078. document.removeEventListener("mousemove", onDocumentMouseMove);
  5079. }
  5080. lastMouseMoveTime = now;
  5081. }
  5082. function onWindowBlur() {
  5083. var activeElement = document.activeElement;
  5084. if (isReferenceElement(activeElement)) {
  5085. var instance = activeElement._tippy;
  5086. if (activeElement.blur && !instance.state.isVisible) {
  5087. activeElement.blur();
  5088. }
  5089. }
  5090. }
  5091. function bindGlobalEventListeners() {
  5092. document.addEventListener("touchstart", onDocumentTouchStart, TOUCH_OPTIONS);
  5093. window.addEventListener("blur", onWindowBlur);
  5094. }
  5095. var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
  5096. var isIE11 = isBrowser ? (
  5097. // @ts-ignore
  5098. !!window.msCrypto
  5099. ) : false;
  5100. var pluginProps = {
  5101. animateFill: false,
  5102. followCursor: false,
  5103. inlinePositioning: false,
  5104. sticky: false
  5105. };
  5106. var renderProps = {
  5107. allowHTML: false,
  5108. animation: "fade",
  5109. arrow: true,
  5110. content: "",
  5111. inertia: false,
  5112. maxWidth: 350,
  5113. role: "tooltip",
  5114. theme: "",
  5115. zIndex: 9999
  5116. };
  5117. var defaultProps = Object.assign({
  5118. appendTo: TIPPY_DEFAULT_APPEND_TO,
  5119. aria: {
  5120. content: "auto",
  5121. expanded: "auto"
  5122. },
  5123. delay: 0,
  5124. duration: [300, 250],
  5125. getReferenceClientRect: null,
  5126. hideOnClick: true,
  5127. ignoreAttributes: false,
  5128. interactive: false,
  5129. interactiveBorder: 2,
  5130. interactiveDebounce: 0,
  5131. moveTransition: "",
  5132. offset: [0, 10],
  5133. onAfterUpdate: function onAfterUpdate() {
  5134. },
  5135. onBeforeUpdate: function onBeforeUpdate() {
  5136. },
  5137. onCreate: function onCreate() {
  5138. },
  5139. onDestroy: function onDestroy() {
  5140. },
  5141. onHidden: function onHidden() {
  5142. },
  5143. onHide: function onHide() {
  5144. },
  5145. onMount: function onMount() {
  5146. },
  5147. onShow: function onShow() {
  5148. },
  5149. onShown: function onShown() {
  5150. },
  5151. onTrigger: function onTrigger() {
  5152. },
  5153. onUntrigger: function onUntrigger() {
  5154. },
  5155. onClickOutside: function onClickOutside() {
  5156. },
  5157. placement: "top",
  5158. plugins: [],
  5159. popperOptions: {},
  5160. render: null,
  5161. showOnCreate: false,
  5162. touch: true,
  5163. trigger: "mouseenter focus",
  5164. triggerTarget: null
  5165. }, pluginProps, renderProps);
  5166. var defaultKeys = Object.keys(defaultProps);
  5167. var setDefaultProps = function setDefaultProps2(partialProps) {
  5168. var keys = Object.keys(partialProps);
  5169. keys.forEach(function(key) {
  5170. defaultProps[key] = partialProps[key];
  5171. });
  5172. };
  5173. function getExtendedPassedProps(passedProps) {
  5174. var plugins = passedProps.plugins || [];
  5175. var pluginProps2 = plugins.reduce(function(acc, plugin) {
  5176. var name = plugin.name, defaultValue = plugin.defaultValue;
  5177. if (name) {
  5178. var _name;
  5179. acc[name] = passedProps[name] !== void 0 ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
  5180. }
  5181. return acc;
  5182. }, {});
  5183. return Object.assign({}, passedProps, pluginProps2);
  5184. }
  5185. function getDataAttributeProps(reference2, plugins) {
  5186. var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
  5187. plugins
  5188. }))) : defaultKeys;
  5189. var props = propKeys.reduce(function(acc, key) {
  5190. var valueAsString = (reference2.getAttribute("data-tippy-" + key) || "").trim();
  5191. if (!valueAsString) {
  5192. return acc;
  5193. }
  5194. if (key === "content") {
  5195. acc[key] = valueAsString;
  5196. } else {
  5197. try {
  5198. acc[key] = JSON.parse(valueAsString);
  5199. } catch (e) {
  5200. acc[key] = valueAsString;
  5201. }
  5202. }
  5203. return acc;
  5204. }, {});
  5205. return props;
  5206. }
  5207. function evaluateProps(reference2, props) {
  5208. var out = Object.assign({}, props, {
  5209. content: invokeWithArgsOrReturn(props.content, [reference2])
  5210. }, props.ignoreAttributes ? {} : getDataAttributeProps(reference2, props.plugins));
  5211. out.aria = Object.assign({}, defaultProps.aria, out.aria);
  5212. out.aria = {
  5213. expanded: out.aria.expanded === "auto" ? props.interactive : out.aria.expanded,
  5214. content: out.aria.content === "auto" ? props.interactive ? null : "describedby" : out.aria.content
  5215. };
  5216. return out;
  5217. }
  5218. var innerHTML = function innerHTML2() {
  5219. return "innerHTML";
  5220. };
  5221. function dangerouslySetInnerHTML(element, html) {
  5222. element[innerHTML()] = html;
  5223. }
  5224. function createArrowElement(value) {
  5225. var arrow2 = div();
  5226. if (value === true) {
  5227. arrow2.className = ARROW_CLASS;
  5228. } else {
  5229. arrow2.className = SVG_ARROW_CLASS;
  5230. if (isElement(value)) {
  5231. arrow2.appendChild(value);
  5232. } else {
  5233. dangerouslySetInnerHTML(arrow2, value);
  5234. }
  5235. }
  5236. return arrow2;
  5237. }
  5238. function setContent(content, props) {
  5239. if (isElement(props.content)) {
  5240. dangerouslySetInnerHTML(content, "");
  5241. content.appendChild(props.content);
  5242. } else if (typeof props.content !== "function") {
  5243. if (props.allowHTML) {
  5244. dangerouslySetInnerHTML(content, props.content);
  5245. } else {
  5246. content.textContent = props.content;
  5247. }
  5248. }
  5249. }
  5250. function getChildren(popper2) {
  5251. var box = popper2.firstElementChild;
  5252. var boxChildren = arrayFrom(box.children);
  5253. return {
  5254. box,
  5255. content: boxChildren.find(function(node) {
  5256. return node.classList.contains(CONTENT_CLASS);
  5257. }),
  5258. arrow: boxChildren.find(function(node) {
  5259. return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS);
  5260. }),
  5261. backdrop: boxChildren.find(function(node) {
  5262. return node.classList.contains(BACKDROP_CLASS);
  5263. })
  5264. };
  5265. }
  5266. function render(instance) {
  5267. var popper2 = div();
  5268. var box = div();
  5269. box.className = BOX_CLASS;
  5270. box.setAttribute("data-state", "hidden");
  5271. box.setAttribute("tabindex", "-1");
  5272. var content = div();
  5273. content.className = CONTENT_CLASS;
  5274. content.setAttribute("data-state", "hidden");
  5275. setContent(content, instance.props);
  5276. popper2.appendChild(box);
  5277. box.appendChild(content);
  5278. onUpdate(instance.props, instance.props);
  5279. function onUpdate(prevProps, nextProps) {
  5280. var _getChildren = getChildren(popper2), box2 = _getChildren.box, content2 = _getChildren.content, arrow2 = _getChildren.arrow;
  5281. if (nextProps.theme) {
  5282. box2.setAttribute("data-theme", nextProps.theme);
  5283. } else {
  5284. box2.removeAttribute("data-theme");
  5285. }
  5286. if (typeof nextProps.animation === "string") {
  5287. box2.setAttribute("data-animation", nextProps.animation);
  5288. } else {
  5289. box2.removeAttribute("data-animation");
  5290. }
  5291. if (nextProps.inertia) {
  5292. box2.setAttribute("data-inertia", "");
  5293. } else {
  5294. box2.removeAttribute("data-inertia");
  5295. }
  5296. box2.style.maxWidth = typeof nextProps.maxWidth === "number" ? nextProps.maxWidth + "px" : nextProps.maxWidth;
  5297. if (nextProps.role) {
  5298. box2.setAttribute("role", nextProps.role);
  5299. } else {
  5300. box2.removeAttribute("role");
  5301. }
  5302. if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) {
  5303. setContent(content2, instance.props);
  5304. }
  5305. if (nextProps.arrow) {
  5306. if (!arrow2) {
  5307. box2.appendChild(createArrowElement(nextProps.arrow));
  5308. } else if (prevProps.arrow !== nextProps.arrow) {
  5309. box2.removeChild(arrow2);
  5310. box2.appendChild(createArrowElement(nextProps.arrow));
  5311. }
  5312. } else if (arrow2) {
  5313. box2.removeChild(arrow2);
  5314. }
  5315. }
  5316. return {
  5317. popper: popper2,
  5318. onUpdate
  5319. };
  5320. }
  5321. render.$$tippy = true;
  5322. var idCounter = 1;
  5323. var mouseMoveListeners = [];
  5324. var mountedInstances = [];
  5325. function createTippy(reference2, passedProps) {
  5326. var props = evaluateProps(reference2, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps))));
  5327. var showTimeout;
  5328. var hideTimeout;
  5329. var scheduleHideAnimationFrame;
  5330. var isVisibleFromClick = false;
  5331. var didHideDueToDocumentMouseDown = false;
  5332. var didTouchMove = false;
  5333. var ignoreOnFirstUpdate = false;
  5334. var lastTriggerEvent;
  5335. var currentTransitionEndListener;
  5336. var onFirstUpdate;
  5337. var listeners = [];
  5338. var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
  5339. var currentTarget;
  5340. var id = idCounter++;
  5341. var popperInstance = null;
  5342. var plugins = unique(props.plugins);
  5343. var state = {
  5344. // Is the instance currently enabled?
  5345. isEnabled: true,
  5346. // Is the tippy currently showing and not transitioning out?
  5347. isVisible: false,
  5348. // Has the instance been destroyed?
  5349. isDestroyed: false,
  5350. // Is the tippy currently mounted to the DOM?
  5351. isMounted: false,
  5352. // Has the tippy finished transitioning in?
  5353. isShown: false
  5354. };
  5355. var instance = {
  5356. // properties
  5357. id,
  5358. reference: reference2,
  5359. popper: div(),
  5360. popperInstance,
  5361. props,
  5362. state,
  5363. plugins,
  5364. // methods
  5365. clearDelayTimeouts,
  5366. setProps,
  5367. setContent: setContent2,
  5368. show,
  5369. hide: hide2,
  5370. hideWithInteractivity,
  5371. enable,
  5372. disable,
  5373. unmount,
  5374. destroy
  5375. };
  5376. if (!props.render) {
  5377. return instance;
  5378. }
  5379. var _props$render = props.render(instance), popper2 = _props$render.popper, onUpdate = _props$render.onUpdate;
  5380. popper2.setAttribute("data-tippy-root", "");
  5381. popper2.id = "tippy-" + instance.id;
  5382. instance.popper = popper2;
  5383. reference2._tippy = instance;
  5384. popper2._tippy = instance;
  5385. var pluginsHooks = plugins.map(function(plugin) {
  5386. return plugin.fn(instance);
  5387. });
  5388. var hasAriaExpanded = reference2.hasAttribute("aria-expanded");
  5389. addListeners();
  5390. handleAriaExpandedAttribute();
  5391. handleStyles();
  5392. invokeHook("onCreate", [instance]);
  5393. if (props.showOnCreate) {
  5394. scheduleShow();
  5395. }
  5396. popper2.addEventListener("mouseenter", function() {
  5397. if (instance.props.interactive && instance.state.isVisible) {
  5398. instance.clearDelayTimeouts();
  5399. }
  5400. });
  5401. popper2.addEventListener("mouseleave", function() {
  5402. if (instance.props.interactive && instance.props.trigger.indexOf("mouseenter") >= 0) {
  5403. getDocument().addEventListener("mousemove", debouncedOnMouseMove);
  5404. }
  5405. });
  5406. return instance;
  5407. function getNormalizedTouchSettings() {
  5408. var touch = instance.props.touch;
  5409. return Array.isArray(touch) ? touch : [touch, 0];
  5410. }
  5411. function getIsCustomTouchBehavior() {
  5412. return getNormalizedTouchSettings()[0] === "hold";
  5413. }
  5414. function getIsDefaultRenderFn() {
  5415. var _instance$props$rende;
  5416. return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
  5417. }
  5418. function getCurrentTarget() {
  5419. return currentTarget || reference2;
  5420. }
  5421. function getDocument() {
  5422. var parent = getCurrentTarget().parentNode;
  5423. return parent ? getOwnerDocument(parent) : document;
  5424. }
  5425. function getDefaultTemplateChildren() {
  5426. return getChildren(popper2);
  5427. }
  5428. function getDelay(isShow) {
  5429. if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === "focus") {
  5430. return 0;
  5431. }
  5432. return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
  5433. }
  5434. function handleStyles(fromHide) {
  5435. if (fromHide === void 0) {
  5436. fromHide = false;
  5437. }
  5438. popper2.style.pointerEvents = instance.props.interactive && !fromHide ? "" : "none";
  5439. popper2.style.zIndex = "" + instance.props.zIndex;
  5440. }
  5441. function invokeHook(hook, args, shouldInvokePropsHook) {
  5442. if (shouldInvokePropsHook === void 0) {
  5443. shouldInvokePropsHook = true;
  5444. }
  5445. pluginsHooks.forEach(function(pluginHooks) {
  5446. if (pluginHooks[hook]) {
  5447. pluginHooks[hook].apply(pluginHooks, args);
  5448. }
  5449. });
  5450. if (shouldInvokePropsHook) {
  5451. var _instance$props;
  5452. (_instance$props = instance.props)[hook].apply(_instance$props, args);
  5453. }
  5454. }
  5455. function handleAriaContentAttribute() {
  5456. var aria = instance.props.aria;
  5457. if (!aria.content) {
  5458. return;
  5459. }
  5460. var attr = "aria-" + aria.content;
  5461. var id2 = popper2.id;
  5462. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  5463. nodes.forEach(function(node) {
  5464. var currentValue = node.getAttribute(attr);
  5465. if (instance.state.isVisible) {
  5466. node.setAttribute(attr, currentValue ? currentValue + " " + id2 : id2);
  5467. } else {
  5468. var nextValue = currentValue && currentValue.replace(id2, "").trim();
  5469. if (nextValue) {
  5470. node.setAttribute(attr, nextValue);
  5471. } else {
  5472. node.removeAttribute(attr);
  5473. }
  5474. }
  5475. });
  5476. }
  5477. function handleAriaExpandedAttribute() {
  5478. if (hasAriaExpanded || !instance.props.aria.expanded) {
  5479. return;
  5480. }
  5481. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  5482. nodes.forEach(function(node) {
  5483. if (instance.props.interactive) {
  5484. node.setAttribute("aria-expanded", instance.state.isVisible && node === getCurrentTarget() ? "true" : "false");
  5485. } else {
  5486. node.removeAttribute("aria-expanded");
  5487. }
  5488. });
  5489. }
  5490. function cleanupInteractiveMouseListeners() {
  5491. getDocument().removeEventListener("mousemove", debouncedOnMouseMove);
  5492. mouseMoveListeners = mouseMoveListeners.filter(function(listener) {
  5493. return listener !== debouncedOnMouseMove;
  5494. });
  5495. }
  5496. function onDocumentPress(event) {
  5497. if (currentInput.isTouch) {
  5498. if (didTouchMove || event.type === "mousedown") {
  5499. return;
  5500. }
  5501. }
  5502. var actualTarget = event.composedPath && event.composedPath()[0] || event.target;
  5503. if (instance.props.interactive && actualContains(popper2, actualTarget)) {
  5504. return;
  5505. }
  5506. if (normalizeToArray(instance.props.triggerTarget || reference2).some(function(el) {
  5507. return actualContains(el, actualTarget);
  5508. })) {
  5509. if (currentInput.isTouch) {
  5510. return;
  5511. }
  5512. if (instance.state.isVisible && instance.props.trigger.indexOf("click") >= 0) {
  5513. return;
  5514. }
  5515. } else {
  5516. invokeHook("onClickOutside", [instance, event]);
  5517. }
  5518. if (instance.props.hideOnClick === true) {
  5519. instance.clearDelayTimeouts();
  5520. instance.hide();
  5521. didHideDueToDocumentMouseDown = true;
  5522. setTimeout(function() {
  5523. didHideDueToDocumentMouseDown = false;
  5524. });
  5525. if (!instance.state.isMounted) {
  5526. removeDocumentPress();
  5527. }
  5528. }
  5529. }
  5530. function onTouchMove() {
  5531. didTouchMove = true;
  5532. }
  5533. function onTouchStart() {
  5534. didTouchMove = false;
  5535. }
  5536. function addDocumentPress() {
  5537. var doc = getDocument();
  5538. doc.addEventListener("mousedown", onDocumentPress, true);
  5539. doc.addEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
  5540. doc.addEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
  5541. doc.addEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
  5542. }
  5543. function removeDocumentPress() {
  5544. var doc = getDocument();
  5545. doc.removeEventListener("mousedown", onDocumentPress, true);
  5546. doc.removeEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
  5547. doc.removeEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
  5548. doc.removeEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
  5549. }
  5550. function onTransitionedOut(duration, callback) {
  5551. onTransitionEnd(duration, function() {
  5552. if (!instance.state.isVisible && popper2.parentNode && popper2.parentNode.contains(popper2)) {
  5553. callback();
  5554. }
  5555. });
  5556. }
  5557. function onTransitionedIn(duration, callback) {
  5558. onTransitionEnd(duration, callback);
  5559. }
  5560. function onTransitionEnd(duration, callback) {
  5561. var box = getDefaultTemplateChildren().box;
  5562. function listener(event) {
  5563. if (event.target === box) {
  5564. updateTransitionEndListener(box, "remove", listener);
  5565. callback();
  5566. }
  5567. }
  5568. if (duration === 0) {
  5569. return callback();
  5570. }
  5571. updateTransitionEndListener(box, "remove", currentTransitionEndListener);
  5572. updateTransitionEndListener(box, "add", listener);
  5573. currentTransitionEndListener = listener;
  5574. }
  5575. function on(eventType, handler, options) {
  5576. if (options === void 0) {
  5577. options = false;
  5578. }
  5579. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  5580. nodes.forEach(function(node) {
  5581. node.addEventListener(eventType, handler, options);
  5582. listeners.push({
  5583. node,
  5584. eventType,
  5585. handler,
  5586. options
  5587. });
  5588. });
  5589. }
  5590. function addListeners() {
  5591. if (getIsCustomTouchBehavior()) {
  5592. on("touchstart", onTrigger2, {
  5593. passive: true
  5594. });
  5595. on("touchend", onMouseLeave, {
  5596. passive: true
  5597. });
  5598. }
  5599. splitBySpaces(instance.props.trigger).forEach(function(eventType) {
  5600. if (eventType === "manual") {
  5601. return;
  5602. }
  5603. on(eventType, onTrigger2);
  5604. switch (eventType) {
  5605. case "mouseenter":
  5606. on("mouseleave", onMouseLeave);
  5607. break;
  5608. case "focus":
  5609. on(isIE11 ? "focusout" : "blur", onBlurOrFocusOut);
  5610. break;
  5611. case "focusin":
  5612. on("focusout", onBlurOrFocusOut);
  5613. break;
  5614. }
  5615. });
  5616. }
  5617. function removeListeners() {
  5618. listeners.forEach(function(_ref) {
  5619. var node = _ref.node, eventType = _ref.eventType, handler = _ref.handler, options = _ref.options;
  5620. node.removeEventListener(eventType, handler, options);
  5621. });
  5622. listeners = [];
  5623. }
  5624. function onTrigger2(event) {
  5625. var _lastTriggerEvent;
  5626. var shouldScheduleClickHide = false;
  5627. if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
  5628. return;
  5629. }
  5630. var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === "focus";
  5631. lastTriggerEvent = event;
  5632. currentTarget = event.currentTarget;
  5633. handleAriaExpandedAttribute();
  5634. if (!instance.state.isVisible && isMouseEvent(event)) {
  5635. mouseMoveListeners.forEach(function(listener) {
  5636. return listener(event);
  5637. });
  5638. }
  5639. if (event.type === "click" && (instance.props.trigger.indexOf("mouseenter") < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
  5640. shouldScheduleClickHide = true;
  5641. } else {
  5642. scheduleShow(event);
  5643. }
  5644. if (event.type === "click") {
  5645. isVisibleFromClick = !shouldScheduleClickHide;
  5646. }
  5647. if (shouldScheduleClickHide && !wasFocused) {
  5648. scheduleHide(event);
  5649. }
  5650. }
  5651. function onMouseMove(event) {
  5652. var target = event.target;
  5653. var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper2.contains(target);
  5654. if (event.type === "mousemove" && isCursorOverReferenceOrPopper) {
  5655. return;
  5656. }
  5657. var popperTreeData = getNestedPopperTree().concat(popper2).map(function(popper22) {
  5658. var _instance$popperInsta;
  5659. var instance2 = popper22._tippy;
  5660. var state2 = (_instance$popperInsta = instance2.popperInstance) == null ? void 0 : _instance$popperInsta.state;
  5661. if (state2) {
  5662. return {
  5663. popperRect: popper22.getBoundingClientRect(),
  5664. popperState: state2,
  5665. props
  5666. };
  5667. }
  5668. return null;
  5669. }).filter(Boolean);
  5670. if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
  5671. cleanupInteractiveMouseListeners();
  5672. scheduleHide(event);
  5673. }
  5674. }
  5675. function onMouseLeave(event) {
  5676. var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf("click") >= 0 && isVisibleFromClick;
  5677. if (shouldBail) {
  5678. return;
  5679. }
  5680. if (instance.props.interactive) {
  5681. instance.hideWithInteractivity(event);
  5682. return;
  5683. }
  5684. scheduleHide(event);
  5685. }
  5686. function onBlurOrFocusOut(event) {
  5687. if (instance.props.trigger.indexOf("focusin") < 0 && event.target !== getCurrentTarget()) {
  5688. return;
  5689. }
  5690. if (instance.props.interactive && event.relatedTarget && popper2.contains(event.relatedTarget)) {
  5691. return;
  5692. }
  5693. scheduleHide(event);
  5694. }
  5695. function isEventListenerStopped(event) {
  5696. return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf("touch") >= 0 : false;
  5697. }
  5698. function createPopperInstance() {
  5699. destroyPopperInstance();
  5700. var _instance$props2 = instance.props, popperOptions = _instance$props2.popperOptions, placement = _instance$props2.placement, offset2 = _instance$props2.offset, getReferenceClientRect = _instance$props2.getReferenceClientRect, moveTransition = _instance$props2.moveTransition;
  5701. var arrow2 = getIsDefaultRenderFn() ? getChildren(popper2).arrow : null;
  5702. var computedReference = getReferenceClientRect ? {
  5703. getBoundingClientRect: getReferenceClientRect,
  5704. contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
  5705. } : reference2;
  5706. var tippyModifier = {
  5707. name: "$$tippy",
  5708. enabled: true,
  5709. phase: "beforeWrite",
  5710. requires: ["computeStyles"],
  5711. fn: function fn5(_ref2) {
  5712. var state2 = _ref2.state;
  5713. if (getIsDefaultRenderFn()) {
  5714. var _getDefaultTemplateCh = getDefaultTemplateChildren(), box = _getDefaultTemplateCh.box;
  5715. ["placement", "reference-hidden", "escaped"].forEach(function(attr) {
  5716. if (attr === "placement") {
  5717. box.setAttribute("data-placement", state2.placement);
  5718. } else {
  5719. if (state2.attributes.popper["data-popper-" + attr]) {
  5720. box.setAttribute("data-" + attr, "");
  5721. } else {
  5722. box.removeAttribute("data-" + attr);
  5723. }
  5724. }
  5725. });
  5726. state2.attributes.popper = {};
  5727. }
  5728. }
  5729. };
  5730. var modifiers = [{
  5731. name: "offset",
  5732. options: {
  5733. offset: offset2
  5734. }
  5735. }, {
  5736. name: "preventOverflow",
  5737. options: {
  5738. padding: {
  5739. top: 2,
  5740. bottom: 2,
  5741. left: 5,
  5742. right: 5
  5743. }
  5744. }
  5745. }, {
  5746. name: "flip",
  5747. options: {
  5748. padding: 5
  5749. }
  5750. }, {
  5751. name: "computeStyles",
  5752. options: {
  5753. adaptive: !moveTransition
  5754. }
  5755. }, tippyModifier];
  5756. if (getIsDefaultRenderFn() && arrow2) {
  5757. modifiers.push({
  5758. name: "arrow",
  5759. options: {
  5760. element: arrow2,
  5761. padding: 3
  5762. }
  5763. });
  5764. }
  5765. modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
  5766. instance.popperInstance = createPopper(computedReference, popper2, Object.assign({}, popperOptions, {
  5767. placement,
  5768. onFirstUpdate,
  5769. modifiers
  5770. }));
  5771. }
  5772. function destroyPopperInstance() {
  5773. if (instance.popperInstance) {
  5774. instance.popperInstance.destroy();
  5775. instance.popperInstance = null;
  5776. }
  5777. }
  5778. function mount() {
  5779. var appendTo = instance.props.appendTo;
  5780. var parentNode;
  5781. var node = getCurrentTarget();
  5782. if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === "parent") {
  5783. parentNode = node.parentNode;
  5784. } else {
  5785. parentNode = invokeWithArgsOrReturn(appendTo, [node]);
  5786. }
  5787. if (!parentNode.contains(popper2)) {
  5788. parentNode.appendChild(popper2);
  5789. }
  5790. instance.state.isMounted = true;
  5791. createPopperInstance();
  5792. }
  5793. function getNestedPopperTree() {
  5794. return arrayFrom(popper2.querySelectorAll("[data-tippy-root]"));
  5795. }
  5796. function scheduleShow(event) {
  5797. instance.clearDelayTimeouts();
  5798. if (event) {
  5799. invokeHook("onTrigger", [instance, event]);
  5800. }
  5801. addDocumentPress();
  5802. var delay = getDelay(true);
  5803. var _getNormalizedTouchSe = getNormalizedTouchSettings(), touchValue = _getNormalizedTouchSe[0], touchDelay = _getNormalizedTouchSe[1];
  5804. if (currentInput.isTouch && touchValue === "hold" && touchDelay) {
  5805. delay = touchDelay;
  5806. }
  5807. if (delay) {
  5808. showTimeout = setTimeout(function() {
  5809. instance.show();
  5810. }, delay);
  5811. } else {
  5812. instance.show();
  5813. }
  5814. }
  5815. function scheduleHide(event) {
  5816. instance.clearDelayTimeouts();
  5817. invokeHook("onUntrigger", [instance, event]);
  5818. if (!instance.state.isVisible) {
  5819. removeDocumentPress();
  5820. return;
  5821. }
  5822. if (instance.props.trigger.indexOf("mouseenter") >= 0 && instance.props.trigger.indexOf("click") >= 0 && ["mouseleave", "mousemove"].indexOf(event.type) >= 0 && isVisibleFromClick) {
  5823. return;
  5824. }
  5825. var delay = getDelay(false);
  5826. if (delay) {
  5827. hideTimeout = setTimeout(function() {
  5828. if (instance.state.isVisible) {
  5829. instance.hide();
  5830. }
  5831. }, delay);
  5832. } else {
  5833. scheduleHideAnimationFrame = requestAnimationFrame(function() {
  5834. instance.hide();
  5835. });
  5836. }
  5837. }
  5838. function enable() {
  5839. instance.state.isEnabled = true;
  5840. }
  5841. function disable() {
  5842. instance.hide();
  5843. instance.state.isEnabled = false;
  5844. }
  5845. function clearDelayTimeouts() {
  5846. clearTimeout(showTimeout);
  5847. clearTimeout(hideTimeout);
  5848. cancelAnimationFrame(scheduleHideAnimationFrame);
  5849. }
  5850. function setProps(partialProps) {
  5851. if (instance.state.isDestroyed) {
  5852. return;
  5853. }
  5854. invokeHook("onBeforeUpdate", [instance, partialProps]);
  5855. removeListeners();
  5856. var prevProps = instance.props;
  5857. var nextProps = evaluateProps(reference2, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
  5858. ignoreAttributes: true
  5859. }));
  5860. instance.props = nextProps;
  5861. addListeners();
  5862. if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
  5863. cleanupInteractiveMouseListeners();
  5864. debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
  5865. }
  5866. if (prevProps.triggerTarget && !nextProps.triggerTarget) {
  5867. normalizeToArray(prevProps.triggerTarget).forEach(function(node) {
  5868. node.removeAttribute("aria-expanded");
  5869. });
  5870. } else if (nextProps.triggerTarget) {
  5871. reference2.removeAttribute("aria-expanded");
  5872. }
  5873. handleAriaExpandedAttribute();
  5874. handleStyles();
  5875. if (onUpdate) {
  5876. onUpdate(prevProps, nextProps);
  5877. }
  5878. if (instance.popperInstance) {
  5879. createPopperInstance();
  5880. getNestedPopperTree().forEach(function(nestedPopper) {
  5881. requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
  5882. });
  5883. }
  5884. invokeHook("onAfterUpdate", [instance, partialProps]);
  5885. }
  5886. function setContent2(content) {
  5887. instance.setProps({
  5888. content
  5889. });
  5890. }
  5891. function show() {
  5892. var isAlreadyVisible = instance.state.isVisible;
  5893. var isDestroyed = instance.state.isDestroyed;
  5894. var isDisabled = !instance.state.isEnabled;
  5895. var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
  5896. var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
  5897. if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
  5898. return;
  5899. }
  5900. if (getCurrentTarget().hasAttribute("disabled")) {
  5901. return;
  5902. }
  5903. invokeHook("onShow", [instance], false);
  5904. if (instance.props.onShow(instance) === false) {
  5905. return;
  5906. }
  5907. instance.state.isVisible = true;
  5908. if (getIsDefaultRenderFn()) {
  5909. popper2.style.visibility = "visible";
  5910. }
  5911. handleStyles();
  5912. addDocumentPress();
  5913. if (!instance.state.isMounted) {
  5914. popper2.style.transition = "none";
  5915. }
  5916. if (getIsDefaultRenderFn()) {
  5917. var _getDefaultTemplateCh2 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh2.box, content = _getDefaultTemplateCh2.content;
  5918. setTransitionDuration([box, content], 0);
  5919. }
  5920. onFirstUpdate = function onFirstUpdate2() {
  5921. var _instance$popperInsta2;
  5922. if (!instance.state.isVisible || ignoreOnFirstUpdate) {
  5923. return;
  5924. }
  5925. ignoreOnFirstUpdate = true;
  5926. void popper2.offsetHeight;
  5927. popper2.style.transition = instance.props.moveTransition;
  5928. if (getIsDefaultRenderFn() && instance.props.animation) {
  5929. var _getDefaultTemplateCh3 = getDefaultTemplateChildren(), _box = _getDefaultTemplateCh3.box, _content = _getDefaultTemplateCh3.content;
  5930. setTransitionDuration([_box, _content], duration);
  5931. setVisibilityState([_box, _content], "visible");
  5932. }
  5933. handleAriaContentAttribute();
  5934. handleAriaExpandedAttribute();
  5935. pushIfUnique(mountedInstances, instance);
  5936. (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
  5937. invokeHook("onMount", [instance]);
  5938. if (instance.props.animation && getIsDefaultRenderFn()) {
  5939. onTransitionedIn(duration, function() {
  5940. instance.state.isShown = true;
  5941. invokeHook("onShown", [instance]);
  5942. });
  5943. }
  5944. };
  5945. mount();
  5946. }
  5947. function hide2() {
  5948. var isAlreadyHidden = !instance.state.isVisible;
  5949. var isDestroyed = instance.state.isDestroyed;
  5950. var isDisabled = !instance.state.isEnabled;
  5951. var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
  5952. if (isAlreadyHidden || isDestroyed || isDisabled) {
  5953. return;
  5954. }
  5955. invokeHook("onHide", [instance], false);
  5956. if (instance.props.onHide(instance) === false) {
  5957. return;
  5958. }
  5959. instance.state.isVisible = false;
  5960. instance.state.isShown = false;
  5961. ignoreOnFirstUpdate = false;
  5962. isVisibleFromClick = false;
  5963. if (getIsDefaultRenderFn()) {
  5964. popper2.style.visibility = "hidden";
  5965. }
  5966. cleanupInteractiveMouseListeners();
  5967. removeDocumentPress();
  5968. handleStyles(true);
  5969. if (getIsDefaultRenderFn()) {
  5970. var _getDefaultTemplateCh4 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh4.box, content = _getDefaultTemplateCh4.content;
  5971. if (instance.props.animation) {
  5972. setTransitionDuration([box, content], duration);
  5973. setVisibilityState([box, content], "hidden");
  5974. }
  5975. }
  5976. handleAriaContentAttribute();
  5977. handleAriaExpandedAttribute();
  5978. if (instance.props.animation) {
  5979. if (getIsDefaultRenderFn()) {
  5980. onTransitionedOut(duration, instance.unmount);
  5981. }
  5982. } else {
  5983. instance.unmount();
  5984. }
  5985. }
  5986. function hideWithInteractivity(event) {
  5987. getDocument().addEventListener("mousemove", debouncedOnMouseMove);
  5988. pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
  5989. debouncedOnMouseMove(event);
  5990. }
  5991. function unmount() {
  5992. if (instance.state.isVisible) {
  5993. instance.hide();
  5994. }
  5995. if (!instance.state.isMounted) {
  5996. return;
  5997. }
  5998. destroyPopperInstance();
  5999. getNestedPopperTree().forEach(function(nestedPopper) {
  6000. nestedPopper._tippy.unmount();
  6001. });
  6002. if (popper2.parentNode) {
  6003. popper2.parentNode.removeChild(popper2);
  6004. }
  6005. mountedInstances = mountedInstances.filter(function(i) {
  6006. return i !== instance;
  6007. });
  6008. instance.state.isMounted = false;
  6009. invokeHook("onHidden", [instance]);
  6010. }
  6011. function destroy() {
  6012. if (instance.state.isDestroyed) {
  6013. return;
  6014. }
  6015. instance.clearDelayTimeouts();
  6016. instance.unmount();
  6017. removeListeners();
  6018. delete reference2._tippy;
  6019. instance.state.isDestroyed = true;
  6020. invokeHook("onDestroy", [instance]);
  6021. }
  6022. }
  6023. function tippy(targets, optionalProps) {
  6024. if (optionalProps === void 0) {
  6025. optionalProps = {};
  6026. }
  6027. var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
  6028. bindGlobalEventListeners();
  6029. var passedProps = Object.assign({}, optionalProps, {
  6030. plugins
  6031. });
  6032. var elements = getArrayOfElements(targets);
  6033. var instances = elements.reduce(function(acc, reference2) {
  6034. var instance = reference2 && createTippy(reference2, passedProps);
  6035. if (instance) {
  6036. acc.push(instance);
  6037. }
  6038. return acc;
  6039. }, []);
  6040. return isElement(targets) ? instances[0] : instances;
  6041. }
  6042. tippy.defaultProps = defaultProps;
  6043. tippy.setDefaultProps = setDefaultProps;
  6044. tippy.currentInput = currentInput;
  6045. Object.assign({}, applyStyles$1, {
  6046. effect: function effect2(_ref) {
  6047. var state = _ref.state;
  6048. var initialStyles = {
  6049. popper: {
  6050. position: state.options.strategy,
  6051. left: "0",
  6052. top: "0",
  6053. margin: "0"
  6054. },
  6055. arrow: {
  6056. position: "absolute"
  6057. },
  6058. reference: {}
  6059. };
  6060. Object.assign(state.elements.popper.style, initialStyles.popper);
  6061. state.styles = initialStyles;
  6062. if (state.elements.arrow) {
  6063. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  6064. }
  6065. }
  6066. });
  6067. tippy.setDefaultProps({
  6068. render
  6069. });
  6070.  
  6071. })
  6072. };
  6073. }));
  6074.  
  6075. System.register("./index-DH4sstV0-D5_y4vAd.js", ['./__monkey.entry-BOyf9HZs.js'], (function (exports, module) {
  6076. 'use strict';
  6077. var Utils;
  6078. return {
  6079. setters: [module => {
  6080. Utils = module.U;
  6081. }],
  6082. execute: (function () {
  6083.  
  6084. const scroll = Utils.createElement("div", {
  6085. class: "scroll-top"
  6086. });
  6087. document.body.appendChild(scroll);
  6088. const $container = Utils.query(".container");
  6089. $container.addEventListener("scroll", function() {
  6090. this.scrollTop > 500 ? Utils.show(scroll) : Utils.hide(scroll);
  6091. });
  6092. scroll.addEventListener("click", function() {
  6093. $container.scrollTop = 0;
  6094. });
  6095.  
  6096. })
  6097. };
  6098. }));
  6099.  
  6100. System.import("./__entry.js", "./");