JSON Viewer

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

当前为 2025-01-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name JSON Viewer
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.4
  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.6.0/src/dom-to-image.js
  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. // @grant GM_addStyle
  20. // @grant GM_getValue
  21. // @grant GM_openInTab
  22. // @grant GM_registerMenuCommand
  23. // @grant GM_setClipboard
  24. // @grant GM_setValue
  25. // @grant unsafeWindow
  26. // ==/UserScript==
  27.  
  28. (e=>{window.addEventListener("message",r=>{const{data:n}=r;if(!n?.addStyle)return;if(typeof GM_addStyle=="function")return GM_addStyle(e);const o=document.createElement("style");o.textContent=e,document.head.append(o)})})(` @charset "UTF-8";.monkey-jsonviewer body,.monkey-jsonviewer iframe,.monkey-jsonviewer ul{margin:0;padding:0}.monkey-jsonviewer iframe{border:0}.monkey-jsonviewer input:focus,.monkey-jsonviewer select:focus,.monkey-jsonviewer textarea:focus{outline:0}.monkey-jsonviewer .jsonp{color:#657b83}.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;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;list-style-type:none;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{height:100%;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:"";margin-top:1px;position:absolute;border-radius:50%;top:50%!important;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 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;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{display:none;cursor:pointer;font-size:12px;color:#859900;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-comma{margin-left:.15em;font-family:Courier New,monospace}.json-colon{margin:0 .3em 0 .15em}.default-theme{background-color:#fefefe}.default-theme .json-object-bracket{color:#6d9331;font-weight:700}.default-theme .json-array-bracket{color:#8e9331;font-weight:700}.default-theme .json-key{color:#910f93;cursor:pointer}.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-object-bracket{color:#6d9331;font-weight:700}.light-theme .json-array-bracket{color:#8e9331;font-weight:700}.light-theme .json-key{color:#0040cf;cursor:pointer}.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{background-color:#252526}.dark-theme .json-object-bracket{color:#ce70d6;font-weight:700}.dark-theme .json-array-bracket{color:#f1d700;font-weight:700}.dark-theme .json-key{color:#9cdcfe;cursor:pointer}.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;font-weight:700}.dark-plus-theme .json-array-bracket{color:#bbbda3;font-weight:700}.dark-plus-theme .json-key{color:#c77dbb;cursor:pointer}.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}.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}.json-tree-table{border-collapse:collapse;width:-webkit-fill-available}.json-tree-table tr.selected *{color:#fff!important;background-color:#3875d7}.json-tree-table tr:hover{background-color:#f0f9fe}.json-tree-table tr td:first-child{width:120px}.dark-theme .json-tree-table tr:hover,.dark-plus-theme .json-tree-table tr:hover{background-color:#353b48}/**
  29. * @license BSD
  30. * @copyright 2014-2023 hizzgdev@163.com
  31. *
  32. * Project Home:
  33. * https://github.com/hizzgdev/jsmind/
  34. */.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{right:15px;width:45px;height:45px;z-index:999;bottom:30px;display:none;font-size:12px;cursor:pointer;position:fixed;border-radius:50%;background-size:30px;background-color:#fff;background-position:center;background-repeat:no-repeat;box-shadow:0 0 5px #3eaf7c4d;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHN0eWxlPSJmaWxsOiMzZWFmN2MiIGNsYXNzPSJpY29uIGJhY2stdG8tdG9wLWljb24iIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiIGZpbGw9ImN1cnJlbnRDb2xvciIgYXJpYS1sYWJlbD0iYmFjay10by10b3AgaWNvbiI+PHBhdGggZD0iTTUxMiA4NDMuMmMtMzYuMiAwLTY2LjQtMTMuNi04NS44LTIxLjgtMTAuOC00LjYtMjIuNiAzLjYtMjEuOCAxNS4ybDcgMTAyYy40IDYuMiA3LjYgOS40IDEyLjYgNS42bDI5LTIyYzMuNi0yLjggOS0xLjggMTEuNCAybDQxIDY0LjJjMyA0LjggMTAuMiA0LjggMTMuMiAwbDQxLTY0LjJjMi40LTMuOCA3LjgtNC44IDExLjQtMmwyOSAyMmM1IDMuOCAxMi4yLjYgMTIuNi01LjZsNy0xMDJjLjgtMTEuNi0xMS0yMC0yMS44LTE1LjItMTkuNiA4LjItNDkuNiAyMS44LTg1LjggMjEuOHoiPjwvcGF0aD48cGF0aCBkPSJtNzk1LjQgNTg2LjItOTYtOTguMkM2OTkuNCAxNzIgNTEzIDMyIDUxMyAzMlMzMjQuOCAxNzIgMzI0LjggNDg4bC05NiA5OC4yYy0zLjYgMy42LTUuMiA5LTQuNCAxNC4yTDI2MS4yIDgyNGMxLjggMTEuNCAxNC4yIDE3IDIzLjYgMTAuOEw0MTkgNzQ0czQxLjQgNDAgOTQuMiA0MGM1Mi44IDAgOTIuMi00MCA5Mi4yLTQwbDEzNC4yIDkwLjhjOS4yIDYuMiAyMS42LjYgMjMuNi0xMC44bDM3LTIyMy44Yy40LTUuMi0xLjItMTAuNC00LjgtMTR6TTUxMyAzODRjLTM0IDAtNjEuNC0yOC42LTYxLjQtNjRzMjcuNi02NCA2MS40LTY0YzM0IDAgNjEuNCAyOC42IDYxLjQgNjRTNTQ3IDM4NCA1MTMgMzg0eiI+PC9wYXRoPjwvc3ZnPg==)}.scroll-top:hover{background-color:#f9f9f9}.dark-theme .scroll-top,.dark-plus-theme .scroll-top{background-color:#464646;box-shadow:0 0 5px #505050}.tippy-box[data-theme~=scroll]{font-size:12px} `);
  35.  
  36. !function(){function e(e,t){return(t||"")+" (SystemJS Error#"+e+" https://github.com/systemjs/systemjs/blob/main/docs/errors.md#"+e+")"}function t(e,t){if(-1!==e.indexOf("\\")&&(e=e.replace(j,"/")),"/"===e[0]&&"/"===e[1])return t.slice(0,t.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){var n,r=t.slice(0,t.indexOf(":")+1);if(n="/"===t[r.length+1]?"file:"!==r?(n=t.slice(r.length+2)).slice(n.indexOf("/")+1):t.slice(8):t.slice(r.length+("/"===t[r.length])),"/"===e[0])return t.slice(0,t.length-n.length-1)+e;for(var i=n.slice(0,n.lastIndexOf("/")+1)+e,o=[],s=-1,u=0;u<i.length;u++)-1!==s?"/"===i[u]&&(o.push(i.slice(s,u+1)),s=-1):"."===i[u]?"."!==i[u+1]||"/"!==i[u+2]&&u+2!==i.length?"/"===i[u+1]||u+1===i.length?u+=1:s=u:(o.pop(),u+=2):s=u;return-1!==s&&o.push(i.slice(s)),t.slice(0,t.length-n.length)+o.join("")}}function n(e,n){return t(e,n)||(-1!==e.indexOf(":")?e:t("./"+e,n))}function r(e,n,r,i,o){for(var s in e){var a=t(s,r)||s,f=e[s];if("string"==typeof f){var l=c(i,t(f,r)||f,o);l?n[a]=l:u("W1",s,f,"bare specifier did not resolve")}}}function i(e,t,i){var o;for(o in e.imports&&r(e.imports,i.imports,t,i,null),e.scopes||{}){var s=n(o,t);r(e.scopes[o],i.scopes[s]||(i.scopes[s]={}),t,i,s)}for(o in e.depcache||{})i.depcache[n(o,t)]=e.depcache[o];for(o in e.integrity||{})i.integrity[n(o,t)]=e.integrity[o]}function o(e,t){if(t[e])return e;var n=e.length;do{var r=e.slice(0,n+1);if(r in t)return r}while(-1!==(n=e.lastIndexOf("/",n-1)))}function s(e,t){var n=o(e,t);if(n){var r=t[n];if(null===r)return;if(!(e.length>n.length&&"/"!==r[r.length-1]))return r+e.slice(n.length);u("W2",n,r,"should have a trailing '/'")}}function u(t,n,r,i){console.warn(e(t,"Package target "+i+", resolving target '"+r+"' for "+n))}function c(e,t,n){for(var r=e.scopes,i=n&&o(n,r);i;){var u=s(t,r[i]);if(u)return u;i=o(i.slice(0,i.lastIndexOf("/")),r)}return s(t,e.imports)||-1!==t.indexOf(":")&&t}function a(){this[M]={}}function f(e){return e.id}function l(e,t,n,r){if(e.onload(n,t.id,t.d&&t.d.map(f),!!r),n)throw n}function d(t,n,r,i){var o=t[M][n];if(o)return o;var s=[],u=Object.create(null);P&&Object.defineProperty(u,P,{value:"Module"});var c=Promise.resolve().then((function(){return t.instantiate(n,r,i)})).then((function(r){if(!r)throw Error(e(2,"Module "+n+" did not instantiate"));var i=r[1]((function(e,t){o.h=!0;var n=!1;if("string"==typeof e)e in u&&u[e]===t||(u[e]=t,n=!0);else{for(var r in e)t=e[r],r in u&&u[r]===t||(u[r]=t,n=!0);e&&e.__esModule&&(u.__esModule=e.__esModule)}if(n)for(var i=0;i<s.length;i++){var c=s[i];c&&c(u)}return t}),2===r[1].length?{import:function(e,r){return t.import(e,n,r)},meta:t.createContext(n)}:void 0);return o.e=i.execute||function(){},[r[0],i.setters||[],r[2]||[]]}),(function(e){throw o.e=null,o.er=e,l(t,o,e,!0),e})),a=c.then((function(e){return Promise.all(e[0].map((function(r,i){var o=e[1][i],s=e[2][i];return Promise.resolve(t.resolve(r,n)).then((function(e){var r=d(t,e,n,s);return Promise.resolve(r.I).then((function(){return o&&(r.i.push(o),!r.h&&r.I||o(r.n)),r}))}))}))).then((function(e){o.d=e}))}));return o=t[M][n]={id:n,i:s,n:u,m:i,I:c,L:a,h:!1,d:void 0,e:void 0,er:void 0,E:void 0,C:void 0,p:void 0}}function h(e,t,n,r){if(!r[t.id])return r[t.id]=!0,Promise.resolve(t.L).then((function(){return t.p&&null!==t.p.e||(t.p=n),Promise.all(t.d.map((function(t){return h(e,t,n,r)})))})).catch((function(n){if(t.er)throw n;throw t.e=null,l(e,t,n,!1),n}))}function p(e,t){return t.C=h(e,t,t,{}).then((function(){return v(e,t,{})})).then((function(){return t.n}))}function v(e,t,n){function r(){try{var n=o.call(L);if(n)return n=n.then((function(){t.C=t.n,t.E=null,l(e,t,null,!0)}),(function(n){throw t.er=n,t.E=null,l(e,t,n,!0),n})),t.E=n;t.C=t.n,t.L=t.I=void 0}catch(r){throw t.er=r,r}finally{l(e,t,t.er,!0)}}if(!n[t.id]){if(n[t.id]=!0,!t.e){if(t.er)throw t.er;return t.E?t.E:void 0}var i,o=t.e;return t.e=null,t.d.forEach((function(r){try{var o=v(e,r,n);o&&(i=i||[]).push(o)}catch(s){throw t.er=s,l(e,t,s,!1),s}})),i?Promise.all(i).then(r):r()}}function m(){[].forEach.call(document.querySelectorAll("script"),(function(t){if(!t.sp)if("systemjs-module"===t.type){if(t.sp=!0,!t.src)return;System.import("import:"===t.src.slice(0,7)?t.src.slice(7):n(t.src,g)).catch((function(e){if(e.message.indexOf("https://github.com/systemjs/systemjs/blob/main/docs/errors.md#3")>-1){var n=document.createEvent("Event");n.initEvent("error",!1,!1),t.dispatchEvent(n)}return Promise.reject(e)}))}else if("systemjs-importmap"===t.type){t.sp=!0;var r=t.src?(System.fetch||fetch)(t.src,{integrity:t.integrity,priority:t.fetchPriority,passThrough:!0}).then((function(e){if(!e.ok)throw Error("Invalid status code: "+e.status);return e.text()})).catch((function(n){return n.message=e("W4","Error fetching systemjs-import map "+t.src)+"\n"+n.message,console.warn(n),"function"==typeof t.onerror&&t.onerror(),"{}"})):t.innerHTML;W=W.then((function(){return r})).then((function(n){!function(t,n,r){var o={};try{o=JSON.parse(n)}catch(s){console.warn(Error(e("W5","systemjs-importmap contains invalid JSON")+"\n\n"+n+"\n"))}i(o,r,t)}(N,n,t.src||g)}))}}))}var g,y="undefined"!=typeof Symbol,b="undefined"!=typeof self,S="undefined"!=typeof document,w=b?self:global;if(S){var O=document.querySelector("base[href]");O&&(g=O.href)}if(!g&&"undefined"!=typeof location){var E=(g=location.href.split("#")[0].split("?")[0]).lastIndexOf("/");-1!==E&&(g=g.slice(0,E+1))}var x,j=/\\/g,P=y&&Symbol.toStringTag,M=y?Symbol():"@",I=a.prototype;I.import=function(e,t,n){var r=this;return t&&"object"==typeof t&&(n=t,t=void 0),Promise.resolve(r.prepareImport()).then((function(){return r.resolve(e,t,n)})).then((function(e){var t=d(r,e,void 0,n);return t.C||p(r,t)}))},I.createContext=function(e){var t=this;return{url:e,resolve:function(n,r){return Promise.resolve(t.resolve(n,r||e))}}},I.onload=function(){},I.register=function(e,t,n){x=[e,t,n]},I.getRegister=function(){var e=x;return x=void 0,e};var L=Object.freeze(Object.create(null));w.System=new a;var C,R,W=Promise.resolve(),N={imports:{},scopes:{},depcache:{},integrity:{}},T=S;if(I.prepareImport=function(e){return(T||e)&&(m(),T=!1),W},I.getImportMap=function(){return JSON.parse(JSON.stringify(N))},S&&(m(),window.addEventListener("DOMContentLoaded",m)),I.addImportMap=function(e,t){i(e,t||g,N)},S){window.addEventListener("error",(function(e){J=e.filename,_=e.error}));var A=location.origin}I.createScript=function(e){var t=document.createElement("script");t.async=!0,e.indexOf(A+"/")&&(t.crossOrigin="anonymous");var n=N.integrity[e];return n&&(t.integrity=n),t.src=e,t};var J,_,k={},U=I.register;I.register=function(e,t){if(S&&"loading"===document.readyState&&"string"!=typeof e){var n=document.querySelectorAll("script[src]"),r=n[n.length-1];if(r){C=e;var i=this;R=setTimeout((function(){k[r.src]=[e,t],i.import(r.src)}))}}else C=void 0;return U.call(this,e,t)},I.instantiate=function(t,n){var r=k[t];if(r)return delete k[t],r;var i=this;return Promise.resolve(I.createScript(t)).then((function(r){return new Promise((function(o,s){r.addEventListener("error",(function(){s(Error(e(3,"Error loading "+t+(n?" from "+n:""))))})),r.addEventListener("load",(function(){if(document.head.removeChild(r),J===t)s(_);else{var e=i.getRegister(t);e&&e[0]===C&&clearTimeout(R),o(e)}})),document.head.appendChild(r)}))}))},I.shouldFetch=function(){return!1},"undefined"!=typeof fetch&&(I.fetch=fetch);var $=I.instantiate,B=/^(text|application)\/(x-)?javascript(;|$)/;I.instantiate=function(t,n,r){var i=this;return this.shouldFetch(t,n,r)?this.fetch(t,{credentials:"same-origin",integrity:N.integrity[t],meta:r}).then((function(r){if(!r.ok)throw Error(e(7,r.status+" "+r.statusText+", loading "+t+(n?" from "+n:"")));var o=r.headers.get("content-type");if(!o||!B.test(o))throw Error(e(4,'Unknown Content-Type "'+o+'", loading '+t+(n?" from "+n:"")));return r.text().then((function(e){return e.indexOf("//# sourceURL=")<0&&(e+="\n//# sourceURL="+t),(0,eval)(e),i.getRegister(t)}))})):$.apply(this,arguments)},I.resolve=function(n,r){return c(N,t(n,r=r||g)||n,r)||function(t,n){throw Error(e(8,"Unable to resolve bare specifier '"+t+(n?"' from "+n:"'")))}(n,r)};var F=I.instantiate;I.instantiate=function(e,t,n){var r=N.depcache[e];if(r)for(var i=0;i<r.length;i++)d(this,this.resolve(r[i],e),e);return F.call(this,e,t,n)},b&&"function"==typeof importScripts&&(I.instantiate=function(e){var t=this;return Promise.resolve().then((function(){return importScripts(e),t.getRegister(e)}))}),function(e){function t(t){return!e.hasOwnProperty(t)||!isNaN(t)&&t<e.length||a&&e[t]&&"undefined"!=typeof window&&e[t].parent===window}var n,r,i,o=e.System.constructor.prototype,s=o.import;o.import=function(o,u,c){return function(){for(var o in n=r=void 0,e)t(o)||(n?r||(r=o):n=o,i=o)}(),s.call(this,o,u,c)};var u=[[],function(){return{}}],c=o.getRegister;o.getRegister=function(){var o=c.call(this);if(o)return o;var s,a=function(o){var s,u,c=0;for(var a in e)if(!t(a)){if(0===c&&a!==n||1===c&&a!==r)return a;s?(i=a,u=o&&u||a):s=a===i,c++}return u}(this.firstGlobalProp);if(!a)return u;try{s=e[a]}catch(f){return u}return[[],function(e){return{execute:function(){e(s),e({default:s,__useDefault:!0})}}}]};var a="undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("Trident")}("undefined"!=typeof self?self:global),function(e){var t=e.System.constructor.prototype,r=/^[^#?]+\.(css|html|json|wasm)([?#].*)?$/,i=t.shouldFetch.bind(t);t.shouldFetch=function(e){return i(e)||r.test(e)};var o=/^application\/json(;|$)/,s=/^text\/css(;|$)/,u=/^application\/wasm(;|$)/,c=t.fetch;t.fetch=function(t,r){return c(t,r).then((function(i){if(r.passThrough)return i;if(!i.ok)return i;var c=i.headers.get("content-type");return o.test(c)?i.json().then((function(e){return new Response(new Blob(['System.register([],function(e){return{execute:function(){e("default",'+JSON.stringify(e)+")}}})"],{type:"application/javascript"}))})):s.test(c)?i.text().then((function(e){return e=e.replace(/url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g,(function(e,r,i,o){return["url(",r,n(i||o,t),r,")"].join("")})),new Response(new Blob(["System.register([],function(e){return{execute:function(){var s=new CSSStyleSheet();s.replaceSync("+JSON.stringify(e)+');e("default",s)}}})'],{type:"application/javascript"}))})):u.test(c)?(WebAssembly.compileStreaming?WebAssembly.compileStreaming(i):i.arrayBuffer().then(WebAssembly.compile)).then((function(n){e.System.wasmModules||(e.System.wasmModules=Object.create(null)),e.System.wasmModules[t]=n;var r=[],i=[];return WebAssembly.Module.imports&&WebAssembly.Module.imports(n).forEach((function(e){var t=JSON.stringify(e.module);-1===r.indexOf(t)&&(r.push(t),i.push("function(m){i["+t+"]=m}"))})),new Response(new Blob(["System.register(["+r.join(",")+"],function(e){var i={};return{setters:["+i.join(",")+"],execute:function(){return WebAssembly.instantiate(System.wasmModules["+JSON.stringify(t)+"],i).then(function(m){e(m.exports)})}}})"],{type:"application/javascript"}))})):i}))}}("undefined"!=typeof self?self:global);var q="undefined"!=typeof Symbol&&Symbol.toStringTag;I.get=function(e){var t=this[M][e];if(t&&null===t.e&&!t.E)return t.er?null:t.n},I.set=function(t,n){try{new URL(t)}catch(s){console.warn(Error(e("W3",'"'+t+'" is not a valid URL to set in the module registry')))}var r;q&&"Module"===n[q]?r=n:(r=Object.assign(Object.create(null),n),q&&Object.defineProperty(r,q,{value:"Module"}));var i=Promise.resolve(r),o=this[M][t]||(this[M][t]={id:t,i:[],h:!1,d:[],e:null,er:void 0,E:void 0});return!o.e&&!o.E&&(Object.assign(o,{n:r,I:void 0,L:void 0,C:i}),r)},I.has=function(e){return!!this[M][e]},I.delete=function(e){var t=this[M],n=t[e];if(!n||n.p&&null!==n.p.e||n.E)return!1;var r=n.i;return n.d&&n.d.forEach((function(e){var t=e.i.indexOf(n);-1!==t&&e.i.splice(t,1)})),delete t[e],function(){var n=t[e];if(!n||!r||null!==n.e||n.E)return!1;r.forEach((function(e){n.i.push(e),e(n.n)})),r=null}};var D="undefined"!=typeof Symbol&&Symbol.iterator;I.entries=function(){var e,t,n=this,r=Object.keys(n[M]),i=0,o={next:function(){for(;void 0!==(t=r[i++])&&void 0===(e=n.get(t)););return{done:void 0===t,value:void 0!==t&&[t,e]}}};return o[D]=function(){return this},o}}();
  37. !function(t){function e(t){t.registerRegistry=Object.create(null),t.namedRegisterAliases=Object.create(null)}var r=t.System;e(r);var i,s,n=r.constructor.prototype,l=r.constructor,a=function(){l.call(this),e(this)};a.prototype=n,r.constructor=a;var o=n.register;n.register=function(t,e,r,n){if("string"!=typeof t)return o.apply(this,arguments);var l=[e,r,n];return this.registerRegistry[t]=l,i||(i=l,s=t),Promise.resolve().then((function(){i=null,s=null})),o.apply(this,[e,r,n])};var u=n.resolve;n.resolve=function(t,e){try{return u.call(this,t,e)}catch(r){if(t in this.registerRegistry)return this.namedRegisterAliases[t]||t;throw r}};var c=n.instantiate;n.instantiate=function(t,e,r){var i=this.registerRegistry[t];return i?(this.registerRegistry[t]=null,i):c.call(this,t,e,r)};var g=n.getRegister;n.getRegister=function(t){var e=g.call(this,t);s&&t&&(this.namedRegisterAliases[s]=t);var r=i||e;return i=null,s=null,r}}("undefined"!=typeof self?self:global);
  38. ;(typeof System!='undefined')&&(System=new System.constructor());
  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-BchYAXNu.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-BchYAXNu.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?.nonce || 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_getValue = exports("b", /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)());
  1869. var _GM_openInTab = /* @__PURE__ */ (() => typeof GM_openInTab != "undefined" ? GM_openInTab : void 0)();
  1870. var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
  1871. var _GM_setClipboard = exports("c", /* @__PURE__ */ (() => typeof GM_setClipboard != "undefined" ? GM_setClipboard : void 0)());
  1872. var _GM_setValue = exports("_", /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)());
  1873. var _unsafeWindow = exports("a", /* @__PURE__ */ (() => typeof unsafeWindow != "undefined" ? unsafeWindow : void 0)());
  1874. const JSON = JSONbig({ useNativeBigInt: true });
  1875. NodeList.prototype.filter = Array.prototype.filter;
  1876. NodeList.prototype.some = Array.prototype.some;
  1877. NodeList.prototype.map = Array.prototype.map;
  1878. function getDefaultDisplay(ele) {
  1879. let temp, display = ele.defaultDisplay;
  1880. const doc = ele.ownerDocument, nodeName = ele.nodeName;
  1881. if (display) return display;
  1882. temp = doc.body.appendChild(doc.createElement(nodeName));
  1883. display = getComputedStyle(temp).display;
  1884. temp.parentNode.removeChild(temp);
  1885. if (display === "none") display = "block";
  1886. ele.defaultDisplay = display;
  1887. return display;
  1888. }
  1889. const Utils = exports("U", {
  1890. isImg(str) {
  1891. const regexp = /\.(ico|bmp|gif|jpg|jpeg|png|svg|webp|GIF|JPG|PNG|WEBP|SVG)([\w#!:.?+=&%@!\-\/])?/i;
  1892. return regexp.test(str);
  1893. },
  1894. isJSON(str) {
  1895. try {
  1896. JSON.parse(str);
  1897. return true;
  1898. } catch (e) {
  1899. return false;
  1900. }
  1901. },
  1902. parse(text, reviver) {
  1903. return JSON.parse(text, reviver);
  1904. },
  1905. stringify(value, replacer, space) {
  1906. return JSON.stringify(value, replacer, space);
  1907. },
  1908. isObject(o) {
  1909. return Object.is(typeof o, "object");
  1910. },
  1911. getType(o) {
  1912. return this.getPropType(o).toLowerCase();
  1913. },
  1914. getPropType(o) {
  1915. return Object.prototype.toString.call(o).match(/\s(.+)]/)[1];
  1916. },
  1917. findMaxKeysObject(arr) {
  1918. let maxKeysCount = 0;
  1919. let maxKeysObject;
  1920. for (const obj of arr) {
  1921. const keysCount = Object.keys(obj).length;
  1922. if (keysCount > maxKeysCount) {
  1923. maxKeysCount = keysCount;
  1924. maxKeysObject = obj;
  1925. }
  1926. }
  1927. return maxKeysObject;
  1928. },
  1929. downloadText(content, filename) {
  1930. const blob = new Blob([content], { type: "application/json;charset=utf-8" });
  1931. const url = URL.createObjectURL(blob);
  1932. this.createElement("a", { href: url, download: filename }).click();
  1933. URL.revokeObjectURL(url);
  1934. },
  1935. matchJsonp(rawText) {
  1936. const tokens = rawText.match(/^([^\s(]*)\s*\(([\s\S]*)\)\s*;?$/);
  1937. if (tokens && tokens[1] && tokens[2]) {
  1938. return { rawText: tokens[2], jsonpFun: tokens[1] };
  1939. }
  1940. return { rawText, jsonpFun: null };
  1941. },
  1942. debounce(fn, delay = 300) {
  1943. let timer;
  1944. return function() {
  1945. if (timer) clearTimeout(timer);
  1946. timer = setTimeout(() => fn.apply(this, arguments), delay);
  1947. };
  1948. },
  1949. setClipboard(text) {
  1950. if (_GM_setClipboard) {
  1951. _GM_setClipboard(text);
  1952. } else if (navigator.clipboard) {
  1953. navigator.clipboard.writeText(text);
  1954. } else {
  1955. let textArea = document.createElement("textarea");
  1956. textArea.value = text;
  1957. textArea.style.position = "absolute";
  1958. textArea.style.opacity = 0;
  1959. textArea.style.left = "-999999px";
  1960. textArea.style.top = "-999999px";
  1961. document.body.appendChild(textArea);
  1962. textArea.focus();
  1963. textArea.select();
  1964. document.execCommand("copy");
  1965. textArea.remove();
  1966. }
  1967. },
  1968. addEvent(eventType, selector, callback) {
  1969. const types = eventType.split(" ");
  1970. types.forEach((type) => {
  1971. function handler(event) {
  1972. let target = event.target;
  1973. if (!target.matches) return;
  1974. while (!target.matches(selector)) {
  1975. target = target.parentNode;
  1976. if (!target || !target.matches) return;
  1977. }
  1978. Object.defineProperty(event, "currentTarget", {
  1979. configurable: true,
  1980. get() {
  1981. return target;
  1982. }
  1983. });
  1984. const returnValue = callback.call(target, event);
  1985. if (returnValue === false) {
  1986. event.preventDefault();
  1987. event.stopPropagation();
  1988. }
  1989. event.stopImmediatePropagation();
  1990. }
  1991. document.addEventListener(type, handler, true);
  1992. });
  1993. },
  1994. isVisible(ele) {
  1995. return !!(ele.offsetWidth || ele.offsetHeight || ele.getClientRects().length);
  1996. },
  1997. createElement(name, attrs) {
  1998. const element = document.createElement(name);
  1999. if (attrs) this.attr(element, attrs);
  2000. return element;
  2001. },
  2002. attr(ele, attrs, value) {
  2003. if (!ele) return;
  2004. if (typeof attrs === "object") {
  2005. for (const name in attrs) ele.setAttribute(name, attrs[name]);
  2006. return;
  2007. }
  2008. if (value === void 0) return ele.getAttribute(attrs);
  2009. if (value === false || value === null) return ele.removeAttribute(attrs);
  2010. ele.setAttribute(attrs, value);
  2011. },
  2012. query(selector, context) {
  2013. const ctx = context || document;
  2014. if (selector instanceof HTMLElement) return selector;
  2015. return ctx.querySelector(selector);
  2016. },
  2017. queryAll(selector, context) {
  2018. const ctx = context || document;
  2019. if (selector instanceof HTMLElement) return new NodeList(selector);
  2020. if (selector instanceof NodeList) return selector;
  2021. return ctx.querySelectorAll(selector);
  2022. },
  2023. addClass(ele, className) {
  2024. if (!ele) return;
  2025. if (ele instanceof HTMLElement) return ele.classList.add(className);
  2026. if (ele instanceof NodeList || ele instanceof Array) {
  2027. ele.forEach((el) => this.addClass(el, className));
  2028. }
  2029. },
  2030. removeClass(ele, className) {
  2031. if (!ele) return;
  2032. if (ele instanceof HTMLElement) {
  2033. const classList = ele.classList;
  2034. if (className === void 0) {
  2035. while (classList.length > 0) {
  2036. classList.remove(classList.item(0));
  2037. }
  2038. return;
  2039. }
  2040. return classList.remove(className);
  2041. }
  2042. if (ele instanceof NodeList || ele instanceof Array) {
  2043. ele.forEach((el) => this.removeClass(el, className));
  2044. }
  2045. },
  2046. toggleClass(ele, className) {
  2047. if (!ele) return;
  2048. this.hasClass(ele, className) ? this.removeClass(ele, className) : this.addClass(ele, className);
  2049. },
  2050. hasClass(ele, className) {
  2051. if (!ele) return false;
  2052. if (ele instanceof HTMLElement) return ele.classList.contains(className);
  2053. if (ele instanceof NodeList) {
  2054. return ele.some((el) => this.hasClass(el, className));
  2055. }
  2056. },
  2057. show(ele) {
  2058. if (!ele) return;
  2059. const style = ele.style;
  2060. const display = getComputedStyle(ele).display;
  2061. if (style.display === "none") style.display = "";
  2062. if (style.display === "" && display === "none") {
  2063. style.display = getDefaultDisplay(ele);
  2064. }
  2065. },
  2066. hide(ele) {
  2067. if (ele.defaultDisplay === void 0) {
  2068. const computedDisplay = getComputedStyle(ele).display;
  2069. if (!Object.is(computedDisplay, "none")) {
  2070. ele.defaultDisplay = computedDisplay;
  2071. }
  2072. }
  2073. ele.style.display = "none";
  2074. }
  2075. });
  2076. const URL$1 = exports("e", {
  2077. JSON_CRACK_WIDGET: "https://jsoncrack.feny.ink/widget",
  2078. EXAMPLE_JSON: "https://fetch-api.feny.ink/example.json",
  2079. ONLINE_REQUEST: "https://fetch-api.feny.ink/httpRequest",
  2080. LAYUI_JS: "https://unpkg.com/layui@2.7.6/dist/layui.js"
  2081. });
  2082. const layout = `
  2083. <template data-for="viewFormater">
  2084. <div class="toolbar-item btn" id="saveJson">保存</div>
  2085. <div class="toolbar-item btn" id="copyJson">复制</div>
  2086. <div class="toolbar-item btn" id="sorted">排序</div>
  2087. <div class="toolbar-item btn" id="collapseAll">全部折叠</div>
  2088. <div class="toolbar-item btn" id="expandAll">全部展开</div>
  2089. <div class="searchbox">
  2090. <input class="filter" type="text" placeholder="JSON 过滤" />
  2091. <button class="clear" hidden></button>
  2092. </div>
  2093. </template>
  2094. <template data-for="viewMind">
  2095. <div class="toolbar-item btn" id="saveJson">保存</div>
  2096. <div class="toolbar-item btn" id="collapseAll">全部折叠</div>
  2097. <div class="toolbar-item btn" id="expandAll">全部展开</div>
  2098. <div class="toolbar-item btn" id="jsoncrack">JSON Crack</div>
  2099. </template>
  2100. <template data-for="viewRawText">
  2101. <div class="toolbar-item btn" id="saveJson">保存</div>
  2102. <div class="toolbar-item btn" id="copyJson">复制</div>
  2103. <div class="toolbar-item btn" id="beautify">美化输出</div>
  2104. </template>
  2105. <div class="json-viewer-layout">
  2106. <div class="panel">
  2107. <div class="tabs">
  2108. <div class="tabs-item btn active" id="viewFormater">JSON 格式化</div>
  2109. <div class="tabs-item btn" id="viewMind">JSON 脑图</div>
  2110. <div class="tabs-item btn" id="viewRawText">原始数据</div>
  2111. </div>
  2112. <div class="toolbar"></div>
  2113. <div class="rightbox">
  2114. <div class="style">
  2115. <span>风格</span>
  2116. <template data-type="style">
  2117. <ul>
  2118. <li data-type="style" data-value="default">默认</li>
  2119. <li data-type="style" data-value="table">表格</li>
  2120. </ul>
  2121. </template>
  2122. </div>
  2123. <div class="theme">
  2124. <span>主题</span>
  2125. <template data-type="theme">
  2126. <ul>
  2127. <li data-type="theme" data-value="default">默认</li>
  2128. <li data-type="theme" data-value="light">浅色</li>
  2129. <li data-type="theme" data-value="dark">暗黑</li>
  2130. <li data-type="theme" data-value="dark-plus">暗黑+</li>
  2131. </ul>
  2132. </template>
  2133. </div>
  2134. <div class="tools">
  2135. <span>工具</span>
  2136. <template data-type="tools">
  2137. <ul>
  2138. <li data-type="tools" data-value="inputJson">JSON 输入</li>
  2139. <li data-type="tools" data-value="fetchJson">HTTP 请求</li>
  2140. </ul>
  2141. </template>
  2142. </div>
  2143. </div>
  2144. </div>
  2145. <div class="container">
  2146. <div class="active" data-for="viewFormater" id="formatBox"></div>
  2147. <div data-for="viewMind" id="mindBox"></div>
  2148. <div data-for="viewRawText" id="rawTextBox">
  2149. <pre></pre>
  2150. </div>
  2151. </div>
  2152. </div>
  2153. `;
  2154. const { EXAMPLE_JSON, LAYUI_JS } = URL$1;
  2155. (function() {
  2156. const openInTab = () => _GM_openInTab(EXAMPLE_JSON);
  2157. _GM_registerMenuCommand("测试JSON( Alt + j )", openInTab);
  2158. window.addEventListener("keydown", function(event) {
  2159. const { key, altKey } = event;
  2160. if (altKey && key.toLowerCase() === "j") openInTab();
  2161. });
  2162. const innerText = document.body.innerText;
  2163. const { rawText, jsonpFun } = Utils.matchJsonp(innerText);
  2164. if (!Utils.isJSON(rawText)) return __vitePreload(() => module.import('./index-DLZ17pA5-Cq4Fkhm4.js'), void 0 );
  2165. _unsafeWindow.RAW_TEXT = rawText;
  2166. _unsafeWindow.GLOBAL_JSONP_FUN = jsonpFun;
  2167. _unsafeWindow.GLOBAL_JSON = Utils.parse(_unsafeWindow.RAW_TEXT);
  2168. Utils.hide(Utils.query("pre"));
  2169. Utils.addClass(Utils.query("html"), "monkey-jsonviewer");
  2170. window.postMessage({ addStyle: true });
  2171. const meta = Utils.createElement("meta", {
  2172. name: "viewport",
  2173. content: "width=device-width, initial-scale=1.0"
  2174. });
  2175. document.head.appendChild(meta);
  2176. const script = Utils.createElement("script", { src: LAYUI_JS, type: "text/javascript" });
  2177. document.head.appendChild(script);
  2178. setTimeout(() => {
  2179. document.body.insertAdjacentHTML("afterbegin", layout);
  2180. const temp = Utils.query('template[data-for="viewFormater"]');
  2181. Utils.query(".toolbar").innerHTML = temp.innerHTML;
  2182. __vitePreload(() => module.import('./index-BGdPvk5r-DqYMgukj.js'), void 0 ).then(() => {
  2183. __vitePreload(() => module.import('./index-Dp0sEvxN-Dpx6ZRv0.js'), void 0 );
  2184. __vitePreload(() => module.import('./index-B8Td95-5-Bw55YpHI.js'), void 0 );
  2185. });
  2186. });
  2187. })();
  2188.  
  2189. })
  2190. };
  2191. }));
  2192.  
  2193. System.register("./index-DLZ17pA5-Cq4Fkhm4.js", ['highlight.js', 'beautifier', './__monkey.entry-BchYAXNu.js'], (function (exports, module) {
  2194. 'use strict';
  2195. var hljs, css_beautify, js_beautify, Utils;
  2196. return {
  2197. setters: [module => {
  2198. hljs = module.default;
  2199. }, module => {
  2200. css_beautify = module.css_beautify;
  2201. js_beautify = module.js_beautify;
  2202. }, module => {
  2203. Utils = module.U;
  2204. }],
  2205. execute: (function () {
  2206.  
  2207. const layout = `
  2208. <div class="beautify_checkbox">
  2209. <input type="checkbox" id="beautify" />
  2210. <label for="beautify">美化输出</label>
  2211. </div>
  2212. `;
  2213. (function() {
  2214. const docType = ["application/x-javascript", "application/javascript", "text/javascript", "text/css"];
  2215. const contentType = document.contentType;
  2216. if (!docType.includes(contentType)) return;
  2217. const preElement = Utils.query("pre");
  2218. if (!preElement) return;
  2219. window.postMessage({ addStyle: true });
  2220. Utils.addClass(Utils.query("html"), "monkey-js-css-beautify");
  2221. setTimeout(() => {
  2222. const rawText = preElement.innerText;
  2223. document.body.insertAdjacentHTML("afterbegin", layout);
  2224. const checkbox = Utils.query(".beautify_checkbox input");
  2225. checkbox.addEventListener("click", function() {
  2226. if (this.checked) {
  2227. beautifyCode(contentType, preElement, rawText);
  2228. } else {
  2229. preElement.innerText = rawText;
  2230. }
  2231. });
  2232. });
  2233. })();
  2234. function beautifyCode(contentType, element, rawText) {
  2235. const language = contentType.substring(contentType.indexOf("/") + 1);
  2236. if (!["css", "javascript", "x-javascript"].includes(language)) {
  2237. return;
  2238. }
  2239. let beautifyCode2;
  2240. if ("css" === language) {
  2241. const cssBeautify = css_beautify ? css_beautify : window.css_beautify;
  2242. beautifyCode2 = cssBeautify(rawText);
  2243. beautifyCode2 = hljs.highlight(beautifyCode2, {
  2244. language
  2245. }).value;
  2246. } else {
  2247. const jsBeautify = js_beautify ? js_beautify : window.js_beautify;
  2248. beautifyCode2 = jsBeautify(rawText);
  2249. beautifyCode2 = hljs.highlight(beautifyCode2, {
  2250. language: "javascript"
  2251. }).value;
  2252. }
  2253. element.innerHTML = `<code>${beautifyCode2}</code>`;
  2254. }
  2255.  
  2256. })
  2257. };
  2258. }));
  2259.  
  2260. System.register("./index-BGdPvk5r-DqYMgukj.js", ['./__monkey.entry-BchYAXNu.js', './tippy.esm-Ot9MORvr-DNGa7Opj.js'], (function (exports, module) {
  2261. 'use strict';
  2262. var _GM_setValue, _unsafeWindow, Utils, _GM_getValue, _GM_setClipboard, tippy;
  2263. return {
  2264. setters: [module => {
  2265. _GM_setValue = module._;
  2266. _unsafeWindow = module.a;
  2267. Utils = module.U;
  2268. _GM_getValue = module.b;
  2269. _GM_setClipboard = module.c;
  2270. }, module => {
  2271. tippy = module.t;
  2272. }],
  2273. execute: (function () {
  2274.  
  2275. var __defProp = Object.defineProperty;
  2276. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  2277. var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  2278. const SORTED = { ASC: "ASC", DESC: "DESC" };
  2279. const STYLE = { TABLE: "table", VIEWER: "viewer" };
  2280. class JsonFormat {
  2281. constructor(options, tag, clazz) {
  2282. __publicField(this, "DEFAULTS", {
  2283. sort: null,
  2284. json: null,
  2285. style: null,
  2286. theme: "default",
  2287. container: null,
  2288. expander: null,
  2289. onExpand: null,
  2290. collapser: null,
  2291. onCollapse: null
  2292. });
  2293. this.options = Object.assign(this.DEFAULTS, options);
  2294. if (!options.container) throw new Error("Container is required");
  2295. if (!options.json) throw new Error("json is required");
  2296. this.render(tag, clazz);
  2297. this.bindEvent();
  2298. this.setTheme(this.options.theme);
  2299. }
  2300. render(tag, clazz) {
  2301. this.$container = Utils.query(this.options.container);
  2302. this.$container.innerHTML = "";
  2303. const box = Utils.createElement(tag, { class: clazz });
  2304. this.createNode(box, this.options.json, "Root", "Root", 1);
  2305. this.$container.appendChild(box);
  2306. }
  2307. setTheme(theme) {
  2308. const classList = document.body.classList;
  2309. classList.forEach((clas) => {
  2310. if (clas.includes("theme")) classList.remove(clas);
  2311. });
  2312. classList.add(`${theme}-theme`);
  2313. }
  2314. keySort(json) {
  2315. const { sort } = this.options;
  2316. if (sort === null) return json;
  2317. if (Array.isArray(json)) return json;
  2318. const entries = Object.entries(json);
  2319. const asc = ([prev], [next]) => prev.localeCompare(next);
  2320. const desc = ([prev], [next]) => next.localeCompare(prev);
  2321. const result = Object.is(SORTED.ASC, sort) ? entries.sort(asc) : entries.sort(desc);
  2322. return Object.fromEntries(result);
  2323. }
  2324. sorted() {
  2325. if (this.options.sort === null) {
  2326. this.options.sort = SORTED.ASC;
  2327. this.reload();
  2328. return "升序";
  2329. }
  2330. if (SORTED.ASC === this.options.sort) {
  2331. this.options.sort = SORTED.DESC;
  2332. this.reload();
  2333. return "降序";
  2334. }
  2335. if (SORTED.DESC === this.options.sort) {
  2336. this.options.sort = null;
  2337. this.reload();
  2338. return "排序";
  2339. }
  2340. }
  2341. reload() {
  2342. const box = this.$container.firstChild;
  2343. box.innerHTML = null;
  2344. this.createNode(box, this.options.json, "Root", "Root", 1);
  2345. this.$container.appendChild(box);
  2346. this.bindEvent();
  2347. }
  2348. creatValueNode(type, value) {
  2349. const node = Utils.createElement("span", { class: `json-${type}` });
  2350. node.textContent = `${value}`;
  2351. if (Object.is("string", type)) {
  2352. value = this.escape(value);
  2353. node.textContent = `"${value}"`;
  2354. }
  2355. if (this.isUrl(value)) {
  2356. node.textContent = "";
  2357. const a = Utils.createElement("a", { target: "_blank", href: value });
  2358. a.textContent = `"${value}"`;
  2359. node.appendChild(a);
  2360. }
  2361. if (this.isColor(value)) {
  2362. const span = Utils.createElement("span", {
  2363. class: "json-color",
  2364. style: `background-color: ${value}`
  2365. });
  2366. node.prepend(span);
  2367. }
  2368. return node;
  2369. }
  2370. creatOtherNodes(node, value) {
  2371. if (!this.canIterate(value)) return;
  2372. const arrow = Utils.createElement("span", { class: "json-formater-arrow" });
  2373. node.prepend(arrow);
  2374. const copy = Utils.createElement("span", { title: "复制", class: "json-formater-copy" });
  2375. copy.json = value;
  2376. node.appendChild(copy);
  2377. const placeholder = this.creatPlaceholder(value);
  2378. node.appendChild(placeholder);
  2379. }
  2380. creatPlaceholder(json) {
  2381. const placeholder = Utils.createElement("span", { class: "json-formater-placeholder" });
  2382. const type = Utils.getType(json);
  2383. const length = Object.keys(json).length;
  2384. const span = Utils.createElement("span");
  2385. span.textContent = `${length}${length > 1 ? " items" : " item"}`;
  2386. if (Object.is(type, "object")) {
  2387. span.textContent = `${length}${length > 1 ? " keys" : " key"}`;
  2388. }
  2389. placeholder.appendChild(span);
  2390. if (STYLE.TABLE === this.options.style) {
  2391. let text = document.createTextNode(Object.is(type, "object") ? "{" : "[");
  2392. placeholder.prepend(text);
  2393. text = document.createTextNode(Object.is(type, "object") ? "}" : "]");
  2394. placeholder.appendChild(text);
  2395. }
  2396. return placeholder;
  2397. }
  2398. createBracket(type) {
  2399. const node = Utils.createElement("span", { class: `json-${type}-bracket` });
  2400. node.textContent = Object.is(type, "array") ? "[]" : "{}";
  2401. return node;
  2402. }
  2403. bindEvent() {
  2404. const { expander, collapser, onExpand, onCollapse } = this.options;
  2405. if (expander) this.addEvent(`click`, expander, () => this.expandAll());
  2406. if (collapser) this.addEvent(`click`, collapser, () => this.collapseAll());
  2407. this.addEvent("click", ".json-formater-copy", (e) => {
  2408. const className = "success";
  2409. const target = e.currentTarget;
  2410. if (!target.json || Utils.hasClass(target, className)) return;
  2411. Utils.setClipboard(Utils.stringify(target.json, null, 2));
  2412. Utils.addClass(target, className);
  2413. setTimeout(() => Utils.removeClass(target, className), 1500);
  2414. });
  2415. this.addEvent("click", ".json-formater-placeholder", (e) => {
  2416. const node = this.closest(e.currentTarget, ".json-formater-item");
  2417. this.show(node);
  2418. });
  2419. this.addEvent("click", ".json-formater-arrow", (e) => {
  2420. const node = this.closest(e.currentTarget, ".json-formater-item");
  2421. if (Utils.hasClass(node, "json-formater-opened")) {
  2422. this.hide(node);
  2423. if (onCollapse) onCollapse(node, this);
  2424. } else {
  2425. this.show(node);
  2426. if (onExpand) onExpand(node, this);
  2427. }
  2428. });
  2429. }
  2430. expandAll() {
  2431. this.nodes().forEach((node) => this.show(node));
  2432. }
  2433. collapseAll() {
  2434. this.nodes().forEach((node) => this.hide(node));
  2435. }
  2436. show(node) {
  2437. Utils.addClass(node, "json-formater-opened");
  2438. Utils.removeClass(node, "json-formater-closed");
  2439. this.showDescs(node);
  2440. this.showAfter(node);
  2441. }
  2442. showDescs(node) {
  2443. const children = this.findChildren(node);
  2444. if (children.length === 0) return;
  2445. children.forEach((child) => {
  2446. Utils.show(child);
  2447. const hasClass = Utils.hasClass(child, "json-formater-opened");
  2448. const isTable = Object.is(STYLE.TABLE, this.options.style);
  2449. if (isTable && hasClass) this.showDescs(child);
  2450. });
  2451. }
  2452. showAfter(node) {
  2453. Utils.hide(this.queryPlaceholder(node));
  2454. }
  2455. hide(node) {
  2456. Utils.addClass(node, "json-formater-closed");
  2457. Utils.removeClass(node, "json-formater-opened");
  2458. this.hideDescs(node);
  2459. this.hideAfter(node);
  2460. }
  2461. hideDescs(node) {
  2462. const children = this.findChildren(node);
  2463. if (children.length === 0) return;
  2464. children.forEach((child) => {
  2465. Utils.hide(child);
  2466. const isTable = Object.is(STYLE.TABLE, this.options.style);
  2467. if (isTable) this.hideDescs(child);
  2468. });
  2469. }
  2470. hideAfter(node) {
  2471. Utils.show(this.queryPlaceholder(node));
  2472. }
  2473. queryPlaceholder(node) {
  2474. const id = node.dataset.nodeId;
  2475. const selector = `*[data-node-id="${id}"] .json-formater-placeholder`;
  2476. return Utils.query(selector, node);
  2477. }
  2478. findChildren(node) {
  2479. const pid = node.dataset.nodeId;
  2480. return Utils.queryAll(`*[data-node-pid="${pid}"]`, this.$container);
  2481. }
  2482. findByID(id) {
  2483. return Utils.query(`*[data-node-id="${id}"]`, this.$container);
  2484. }
  2485. openByID(id) {
  2486. this.show(this.findByID(id));
  2487. }
  2488. closeByID(id) {
  2489. this.hide(this.findByID(id));
  2490. }
  2491. nodes() {
  2492. const arrows = Utils.queryAll(".json-formater-arrow", this.$container);
  2493. return arrows.map((ele) => this.closest(ele, ".json-formater-item"));
  2494. }
  2495. addEvent(type, selector, fn) {
  2496. Utils.queryAll(selector).forEach((el) => el.addEventListener(type, fn));
  2497. }
  2498. closest(element, selector) {
  2499. while (element) {
  2500. if (element.matches(selector)) return element;
  2501. element = element.parentElement;
  2502. }
  2503. return null;
  2504. }
  2505. JSONPath(path, key) {
  2506. if (this.isNumber(key)) return `${path}[${key}]`;
  2507. if (key.includes(".")) return `${path}["${key}"]`;
  2508. return `${path}.${key}`;
  2509. }
  2510. isNumber(str) {
  2511. return /^\d+$/.test(str);
  2512. }
  2513. isIterate(value) {
  2514. const type = Utils.getType(value);
  2515. return ["array", "object"].includes(type);
  2516. }
  2517. canIterate(value) {
  2518. if (!this.isIterate(value)) return false;
  2519. return Object.keys(value).length > 0;
  2520. }
  2521. isUrl(str) {
  2522. const regexp = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
  2523. return regexp.test(str);
  2524. }
  2525. escape(str) {
  2526. return str.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
  2527. }
  2528. isColor(str) {
  2529. const hexCodeRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
  2530. const rgbRegex = /^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/;
  2531. const rgbaRegex = /^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(0|1|0\.\d+)\s*\)$/;
  2532. return hexCodeRegex.test(str) || rgbRegex.test(str) || rgbaRegex.test(str);
  2533. }
  2534. random() {
  2535. let randomString = "";
  2536. const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  2537. for (let i = 0; i < 10; i++) {
  2538. const randomIndex = Math.floor(Math.random() * characters.length);
  2539. randomString += characters.charAt(randomIndex);
  2540. }
  2541. return randomString;
  2542. }
  2543. }
  2544. __publicField(JsonFormat, "STYLE", STYLE);
  2545. class JsonViewer extends JsonFormat {
  2546. constructor(options) {
  2547. options.style = JsonFormat.STYLE.VIEWER;
  2548. super(options, "div", "json-view-formater");
  2549. }
  2550. createNode(box, json, JSONPath, pid) {
  2551. const type = Utils.getType(json);
  2552. const isIterate = this.isIterate(json);
  2553. const canIterate = this.canIterate(json);
  2554. if (canIterate) {
  2555. this.depthNode(box, type, json, JSONPath, pid);
  2556. } else if (isIterate) {
  2557. const bracket = this.createBracket(type);
  2558. box.appendChild(bracket);
  2559. } else {
  2560. const valueNode = this.creatValueNode(type, json);
  2561. box.appendChild(valueNode);
  2562. }
  2563. }
  2564. depthNode(box, type, json, path, pid) {
  2565. json = this.keySort(json);
  2566. box.appendChild(this.startBracket(type));
  2567. this.creatOther(box, json);
  2568. let length = Object.keys(json).length;
  2569. for (var key in json) {
  2570. if (Object.prototype.hasOwnProperty.call(json, key)) {
  2571. const value = json[key];
  2572. const id = this.random();
  2573. const canComma = --length > 0;
  2574. const JSONPath = this.JSONPath(path, key);
  2575. const node = Utils.createElement("div", {
  2576. JSONPath,
  2577. "data-node-id": id,
  2578. "data-node-pid": pid,
  2579. style: `padding-left: 20px`,
  2580. "data-type": Utils.getType(value),
  2581. class: `json-formater-item${this.canIterate(value) ? " json-formater-opened" : ""}`
  2582. });
  2583. this.createKeyNode(node, key);
  2584. this.createNode(node, value, JSONPath, id);
  2585. if (canComma) {
  2586. const comma = Utils.createElement("span", { class: "json-comma" });
  2587. comma.textContent = ",";
  2588. node.appendChild(comma);
  2589. }
  2590. box.appendChild(node);
  2591. }
  2592. }
  2593. box.appendChild(this.endBracket(type));
  2594. }
  2595. startBracket(type) {
  2596. const span = Utils.createElement("span", { class: `json-${type}-bracket` });
  2597. span.textContent = Object.is(type, "array") ? "[" : "{";
  2598. return span;
  2599. }
  2600. endBracket(type) {
  2601. const span = Utils.createElement("span", { class: `json-${type}-bracket` });
  2602. span.textContent = Object.is(type, "array") ? "]" : "}";
  2603. return span;
  2604. }
  2605. createKeyNode(node, key) {
  2606. if (this.isNumber(key)) return;
  2607. const span = Utils.createElement("span", { class: "json-key" });
  2608. span.textContent = `"${key}"`;
  2609. node.appendChild(span);
  2610. const colon = Utils.createElement("span", { class: "json-colon" });
  2611. colon.textContent = ":";
  2612. node.appendChild(colon);
  2613. }
  2614. creatOther(node, json) {
  2615. if (!node.dataset.nodeId) return;
  2616. this.creatOtherNodes(node, json);
  2617. }
  2618. }
  2619. class JsonToTable extends JsonFormat {
  2620. constructor(options) {
  2621. options.style = JsonFormat.STYLE.TABLE;
  2622. super(options, "table", "json-tree-table");
  2623. }
  2624. createNode(table, json, path, pid, depth) {
  2625. json = this.keySort(json);
  2626. for (const key in json) {
  2627. if (Object.prototype.hasOwnProperty.call(json, key)) {
  2628. let value = json[key];
  2629. const type = Utils.getType(value);
  2630. const JSONPath = this.JSONPath(path, key);
  2631. const args = { key, value, type, depth, JSONPath, pid };
  2632. const item = this.createItem(args);
  2633. table.appendChild(item);
  2634. if (this.canIterate(value)) {
  2635. const nodeId = item.dataset.nodeId;
  2636. this.createNode(table, value, JSONPath, nodeId, depth + 1);
  2637. }
  2638. }
  2639. }
  2640. }
  2641. createItem(args) {
  2642. const { key, value, type, depth, JSONPath, pid } = args;
  2643. const id = this.random();
  2644. const isIterate = this.isIterate(value);
  2645. const canIterate = this.canIterate(value);
  2646. const node = Utils.createElement("tr", {
  2647. "data-type": type,
  2648. "data-node-id": id,
  2649. "data-node-pid": pid,
  2650. class: `json-formater-item${this.canIterate(value) ? " json-formater-opened" : ""}`
  2651. });
  2652. const keyNode = this.createKeyNode(key, value, depth, JSONPath);
  2653. node.appendChild(keyNode);
  2654. const td = Utils.createElement("td");
  2655. if (!isIterate) {
  2656. td.appendChild(this.creatValueNode(type, value));
  2657. node.appendChild(td);
  2658. }
  2659. if (isIterate && !canIterate) {
  2660. td.appendChild(this.createBracket(type));
  2661. node.appendChild(td);
  2662. }
  2663. return node;
  2664. }
  2665. createKeyNode(key, value, depth, JSONPath) {
  2666. const node = Utils.createElement("td", {
  2667. JSONPath,
  2668. colspan: this.canIterate(value) ? 2 : 0,
  2669. style: `padding-left: ${depth * 20}px`
  2670. });
  2671. const span = Utils.createElement("span", { class: "json-key" });
  2672. span.textContent = `${key}`;
  2673. node.appendChild(span);
  2674. const colon = Utils.createElement("span", { class: "json-colon" });
  2675. colon.textContent = ":";
  2676. node.appendChild(colon);
  2677. this.creatOtherNodes(node, value);
  2678. return node;
  2679. }
  2680. bindEvent() {
  2681. super.bindEvent();
  2682. Utils.addEvent("mousedown", "table tr", function(event) {
  2683. const { tagName, className } = event.target;
  2684. if (event.ctrlKey || tagName === "A" || tagName === "SPAN" && className !== "json-key") {
  2685. return;
  2686. }
  2687. const filter = Utils.queryAll(".selected").filter((ele) => ele !== this);
  2688. Utils.removeClass(filter, "selected");
  2689. Utils.toggleClass(this, "selected");
  2690. });
  2691. }
  2692. }
  2693. class FormaterFactory {
  2694. static getInstance(options) {
  2695. return Object.is(JsonToTable.STYLE.TABLE, options.style) ? new JsonToTable(options) : new JsonViewer(options);
  2696. }
  2697. }
  2698. const evnet = {
  2699. urlHover() {
  2700. Utils.addEvent("mouseenter", "a[href]", function() {
  2701. const href = Utils.attr(this, "href");
  2702. if (!Utils.isImg(href)) return;
  2703. tippy(this, {
  2704. duration: 800,
  2705. allowHTML: true,
  2706. theme: "imagebox",
  2707. content: `<img style="max-width: 500px;" src="${href}" />`
  2708. }).show();
  2709. });
  2710. return this;
  2711. },
  2712. eventPath() {
  2713. Utils.addEvent("click mouseenter", ".json-key", (event) => {
  2714. const target = event.target;
  2715. const JSONPath = Utils.attr(target.parentElement, "JSONPath");
  2716. if (Object.is(event.type, "click") && event.ctrlKey) {
  2717. return _GM_setClipboard(JSONPath) & layer.msg("复制成功", { time: 1500 });
  2718. }
  2719. tippy(target, {
  2720. duration: 800,
  2721. theme: "layer",
  2722. allowHTML: true,
  2723. content: `<i>ctrlclick 复制</i><br/><b>路径:</b>${JSONPath}`
  2724. }).show();
  2725. });
  2726. return this;
  2727. },
  2728. init() {
  2729. this.urlHover().eventPath();
  2730. }
  2731. };
  2732. const format = exports("default", {
  2733. changeStyle(style) {
  2734. _GM_setValue("style", style) & this.setStyle();
  2735. return this;
  2736. },
  2737. setStyle() {
  2738. _unsafeWindow.FILTER_VALUE = "";
  2739. Utils.query(".filter").value = "";
  2740. Utils.attr(Utils.query(".clear"), "hidden", true);
  2741. this.render(_unsafeWindow.GLOBAL_JSON);
  2742. return this;
  2743. },
  2744. render(json) {
  2745. const container = Utils.query("#formatBox");
  2746. const style = _GM_getValue("style") || "default";
  2747. const theme = _GM_getValue("theme") || "default";
  2748. const options = { json, style, theme, container };
  2749. _unsafeWindow.JSON_FORMATER = FormaterFactory.getInstance(options);
  2750. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  2751. const start = Utils.createElement("div", { class: "jsonp" });
  2752. start.textContent = `${_unsafeWindow.GLOBAL_JSONP_FUN}(`;
  2753. container.prepend(start);
  2754. const end = start.cloneNode(true);
  2755. end.textContent = ")";
  2756. container.append(end);
  2757. }
  2758. return this;
  2759. },
  2760. filter(json, text) {
  2761. text = text.toLowerCase();
  2762. function match(json2, text2) {
  2763. const newJson = Array.isArray(json2) ? new Array() : new Object();
  2764. for (const key in json2) {
  2765. if (Object.prototype.hasOwnProperty.call(json2, key)) {
  2766. const value = json2[key];
  2767. const type = Utils.getType(value);
  2768. const _key = key.toLowerCase();
  2769. const _value = Utils.stringify(value).toLowerCase();
  2770. if (!_key.includes(text2) && !_value.includes(text2)) continue;
  2771. if (["array", "object"].includes(type)) {
  2772. const result = match(value, text2);
  2773. const _result = Utils.stringify(result).toLowerCase();
  2774. if (_key.includes(text2) || _result.includes(text2)) {
  2775. newJson[key] = result;
  2776. }
  2777. } else {
  2778. newJson[key] = value;
  2779. }
  2780. }
  2781. }
  2782. return newJson;
  2783. }
  2784. return match(json, text);
  2785. },
  2786. input() {
  2787. const debounceInput = Utils.debounce((event) => {
  2788. const value = event.target.value;
  2789. _unsafeWindow.FILTER_VALUE = value;
  2790. const clear = Utils.query(".clear");
  2791. Utils.attr(clear, "hidden", !value);
  2792. const newJson = this.filter(_unsafeWindow.GLOBAL_JSON, value);
  2793. this.render(newJson);
  2794. }, 400);
  2795. Utils.addEvent("input", ".filter", debounceInput);
  2796. return this;
  2797. },
  2798. clear() {
  2799. Utils.addEvent("click", ".clear", () => this.setStyle());
  2800. return this;
  2801. },
  2802. init() {
  2803. this.setStyle().input().clear();
  2804. evnet.init();
  2805. }
  2806. });
  2807. window.addEventListener("message", function(event) {
  2808. const { data } = event;
  2809. if (!data) return;
  2810. if (data.reload) return format.setStyle();
  2811. const { type, value } = data;
  2812. if (Object.is(type, "style")) format.changeStyle(value);
  2813. });
  2814. format.init();
  2815.  
  2816. })
  2817. };
  2818. }));
  2819.  
  2820. System.register("./index-Dp0sEvxN-Dpx6ZRv0.js", ['./tippy.esm-Ot9MORvr-DNGa7Opj.js', 'jsmind', './__monkey.entry-BchYAXNu.js', 'dom-to-image'], (function (exports, module) {
  2821. 'use strict';
  2822. var tippy, require$$0, commonjsGlobal, Utils, _unsafeWindow, _GM_setClipboard, _GM_getValue, URL$1, _GM_setValue, require$$1;
  2823. return {
  2824. setters: [module => {
  2825. tippy = module.t;
  2826. }, module => {
  2827. require$$0 = module.default;
  2828. }, module => {
  2829. commonjsGlobal = module.d;
  2830. Utils = module.U;
  2831. _unsafeWindow = module.a;
  2832. _GM_setClipboard = module.c;
  2833. _GM_getValue = module.b;
  2834. URL$1 = module.e;
  2835. _GM_setValue = module._;
  2836. }, module => {
  2837. require$$1 = module.default;
  2838. }],
  2839. execute: (function () {
  2840.  
  2841. /**
  2842. * @license BSD-3-Clause
  2843. * @copyright 2014-2023 hizzgdev@163.com
  2844. *
  2845. * Project Home:
  2846. * https://github.com/hizzgdev/jsmind/
  2847. */
  2848. (function(module, exports) {
  2849. !function(e, t) {
  2850. t(require$$0, require$$1);
  2851. }(commonjsGlobal, function(e, t) {
  2852. function i(e2) {
  2853. return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
  2854. }
  2855. var n = i(e), o = i(t);
  2856. if (!n.default) throw new Error("jsMind is not defined");
  2857. if (!o.default) throw new Error("dom-to-image is required");
  2858. const r = n.default.$, s = { filename: null, watermark: { left: r.w.location, right: "https://github.com/hizzgdev/jsmind" }, background: "transparent" };
  2859. class a {
  2860. constructor(e2, t2) {
  2861. var i2 = {};
  2862. 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;
  2863. }
  2864. shoot() {
  2865. let e2 = this.create_canvas(), t2 = e2.getContext("2d");
  2866. 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));
  2867. }
  2868. create_canvas() {
  2869. let e2 = r.c("canvas");
  2870. const t2 = this.jm.view.size.w, i2 = this.jm.view.size.h;
  2871. 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;
  2872. }
  2873. clear(e2) {
  2874. e2.parentNode.removeChild(e2);
  2875. }
  2876. draw_background(e2) {
  2877. return new Promise(function(t2, i2) {
  2878. const n2 = this.options.background;
  2879. n2 && "transparent" !== n2 && (e2.fillStyle = this.options.background, e2.fillRect(0, 0, this.jm.view.size.w, this.jm.view.size.h)), t2(e2);
  2880. }.bind(this));
  2881. }
  2882. draw_lines(e2) {
  2883. return new Promise(function(t2, i2) {
  2884. this.jm.view.graph.copy_to(e2, function() {
  2885. t2(e2);
  2886. });
  2887. }.bind(this));
  2888. }
  2889. draw_nodes(e2) {
  2890. return o.default.toSvg(this.jm.view.e_nodes, { style: { zoom: 1 } }).then(this.load_image).then(function(t2) {
  2891. return e2.drawImage(t2, 0, 0), e2;
  2892. });
  2893. }
  2894. draw_watermark(e2, t2) {
  2895. 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;
  2896. }
  2897. load_image(e2) {
  2898. return new Promise(function(t2, i2) {
  2899. let n2 = new Image();
  2900. n2.onload = function() {
  2901. t2(n2);
  2902. }, n2.onerror = i2, n2.src = e2;
  2903. });
  2904. }
  2905. download(e2) {
  2906. var t2 = (this.options.filename || this.jm.mind.name) + ".png";
  2907. if (navigator.msSaveBlob && e2.msToBlob) {
  2908. var i2 = e2.msToBlob();
  2909. navigator.msSaveBlob(i2, t2);
  2910. } else {
  2911. var n2 = e2.toDataURL(), o2 = r.c("a");
  2912. if ("download" in o2) {
  2913. o2.style.visibility = "hidden", o2.href = n2, o2.download = t2, r.d.body.appendChild(o2);
  2914. var s2 = r.d.createEvent("MouseEvents");
  2915. s2.initEvent("click", true, true), o2.dispatchEvent(s2), r.d.body.removeChild(o2);
  2916. } else location.href = n2;
  2917. }
  2918. }
  2919. }
  2920. let d = new n.default.plugin("screenshot", function(e2, t2) {
  2921. var i2 = new a(e2, t2);
  2922. e2.screenshot = i2, e2.shoot = function() {
  2923. i2.shoot();
  2924. };
  2925. });
  2926. n.default.register_plugin(d);
  2927. });
  2928. })();
  2929. const jsonMind = {
  2930. isFirst: true,
  2931. transform(json) {
  2932. const children = [];
  2933. if (Utils.isObject(json)) {
  2934. for (const key in json) {
  2935. let val = json[key];
  2936. const isArray = Array.isArray(val);
  2937. const type = Utils.getPropType(val);
  2938. if (isArray && val.length > 0) val = Utils.findMaxKeysObject(val);
  2939. const isObject = Object.is(Utils.getType(val), "object");
  2940. const keys = isObject ? Object.keys(val) : null;
  2941. children.push({
  2942. keys,
  2943. isArray,
  2944. chain: key,
  2945. id: key + "_" + Math.random(),
  2946. topic: `${key}<span class="datatype">${type}</span>`,
  2947. children: this.transform(val)
  2948. });
  2949. }
  2950. }
  2951. return children;
  2952. },
  2953. getChain(node) {
  2954. let chain = node.data.chain;
  2955. if (!node.parent) return chain;
  2956. const parent = node.parent;
  2957. const parentChain = this.getChain(parent);
  2958. if (parent.data.isArray) return `${parentChain}[i].${chain}`;
  2959. if (chain.includes(".")) return `${parentChain}["${chain}"]`;
  2960. return `${parentChain}.${chain}`;
  2961. },
  2962. show(json) {
  2963. let isArray = Array.isArray(json);
  2964. if (isArray) {
  2965. if (typeof json[0] !== "object") {
  2966. layer.msg("无法生成脑图", { time: 1e3 });
  2967. return this;
  2968. }
  2969. json = Utils.findMaxKeysObject(json);
  2970. }
  2971. if (!this.isFirst) return this;
  2972. _unsafeWindow.GLOBAL_JSMIND.show({
  2973. meta: {
  2974. version: "1.0",
  2975. name: "JSON脑图",
  2976. author: "1220301855@qq.com"
  2977. },
  2978. format: "node_tree",
  2979. data: {
  2980. isArray,
  2981. id: "root",
  2982. chain: "Root",
  2983. topic: "Root",
  2984. direction: "left",
  2985. keys: Object.keys(json),
  2986. children: this.transform(json)
  2987. }
  2988. });
  2989. this.isFirst = false;
  2990. return this;
  2991. },
  2992. event() {
  2993. Utils.addEvent("click mouseover", "jmnode", (event) => {
  2994. const target = event.target;
  2995. const nodeid = Utils.attr(target, "nodeid");
  2996. const node = _unsafeWindow.GLOBAL_JSMIND.get_node(nodeid);
  2997. const chain = this.getChain(node);
  2998. if (event.type === "click") {
  2999. if (event.ctrlKey) {
  3000. _GM_setClipboard(chain);
  3001. layer.msg("复制成功", { time: 1500 });
  3002. return;
  3003. }
  3004. const keys = node.data.keys;
  3005. if (!keys || keys.length === 0) return;
  3006. this.popup(chain, keys);
  3007. } else {
  3008. const content = `<i>ctrlclick 复制</i><br/><b>路径:</b>${chain}`;
  3009. tippy(target, {
  3010. content,
  3011. duration: 800,
  3012. allowHTML: true,
  3013. theme: "layer"
  3014. }).show();
  3015. }
  3016. });
  3017. return this;
  3018. },
  3019. popup(chain, keys) {
  3020. layer.open({
  3021. type: 1,
  3022. move: false,
  3023. shadeClose: true,
  3024. title: " 节点",
  3025. content: function() {
  3026. const chain2 = Utils.createElement("div");
  3027. const chainCon = Utils.createElement("div");
  3028. chain2.appendChild(chainCon);
  3029. const content = Utils.createElement("div", { class: "js-mind-child-node" });
  3030. const copy = Utils.createElement("div", { title: "复制", class: "js-mind-copy" });
  3031. content.appendChild(copy);
  3032. keys.forEach((i) => {
  3033. const child = Utils.createElement("div");
  3034. child.textContent = i;
  3035. content.appendChild(child);
  3036. });
  3037. return content.outerHTML;
  3038. }(),
  3039. success(layero) {
  3040. layero.on("click", ".js-mind-copy", function() {
  3041. _GM_setClipboard(chain + "\n\n" + keys.join("\n"));
  3042. layer.msg("复制成功", { time: 1500 });
  3043. });
  3044. }
  3045. });
  3046. },
  3047. init(json) {
  3048. if (_unsafeWindow.GLOBAL_JSMIND) return;
  3049. _unsafeWindow.GLOBAL_JSMIND = new require$$0({
  3050. mode: "side",
  3051. editable: false,
  3052. container: "mindBox",
  3053. view: {
  3054. hmargin: 50,
  3055. vmargin: 50,
  3056. engine: "svg",
  3057. draggable: true,
  3058. support_html: false,
  3059. line_color: "#C4C9D0"
  3060. },
  3061. layout: {
  3062. vspace: 5,
  3063. hspace: 130
  3064. }
  3065. });
  3066. this.show(json).event();
  3067. }
  3068. };
  3069. const mindBox = Utils.query("#mindBox");
  3070. const formatBox = Utils.query("#formatBox");
  3071. const rawTextBox = Utils.query("#rawTextBox");
  3072. const rawTextPre = Utils.query("pre", rawTextBox);
  3073. const tabs = {
  3074. viewFormater() {
  3075. const value = _unsafeWindow.FILTER_VALUE || "";
  3076. Utils.query(".filter").value = value;
  3077. Utils.attr(Utils.query(".clear"), "hidden", !value);
  3078. },
  3079. saveJson() {
  3080. if (Utils.isVisible(mindBox)) return _unsafeWindow.GLOBAL_JSMIND.shoot();
  3081. const content = rawTextPre.textContent || _unsafeWindow.RAW_TEXT;
  3082. const filename = (/* @__PURE__ */ new Date()).getTime() + ".json";
  3083. Utils.downloadText(content, filename);
  3084. },
  3085. copyJson() {
  3086. const content = rawTextPre.textContent || _unsafeWindow.RAW_TEXT;
  3087. _GM_setClipboard(content);
  3088. layer.msg("复制成功", { time: 1500 });
  3089. },
  3090. sorted(el) {
  3091. const text = _unsafeWindow.JSON_FORMATER.sorted();
  3092. el.textContent = text;
  3093. },
  3094. collapseAll() {
  3095. Utils.isVisible(formatBox) ? _unsafeWindow.JSON_FORMATER.collapseAll() : _unsafeWindow.GLOBAL_JSMIND.collapse_all();
  3096. },
  3097. expandAll() {
  3098. if (Utils.isVisible(formatBox)) return _unsafeWindow.JSON_FORMATER.expandAll();
  3099. _unsafeWindow.GLOBAL_JSMIND.expand_all();
  3100. _unsafeWindow.GLOBAL_JSMIND.scroll_node_to_center(_unsafeWindow.GLOBAL_JSMIND?.get_root());
  3101. },
  3102. viewMind() {
  3103. jsonMind.init(_unsafeWindow.GLOBAL_JSON);
  3104. _unsafeWindow.GLOBAL_JSMIND.scroll_node_to_center(_unsafeWindow.GLOBAL_JSMIND.get_root());
  3105. },
  3106. jsoncrack() {
  3107. const theme2 = (_GM_getValue("theme") || "light").replace(/-.*/, "");
  3108. layer.closeAll();
  3109. layer.open({
  3110. type: 1,
  3111. move: false,
  3112. title: false,
  3113. area: ["100vw", "100vh"],
  3114. content: `<iframe id="jsoncrackEmbed" src="${URL$1.JSON_CRACK_WIDGET}"></iframe>`,
  3115. success() {
  3116. const jsonCrackEmbed = Utils.query("#jsoncrackEmbed");
  3117. window?.addEventListener("message", () => {
  3118. const msg = { options: { theme: theme2 }, json: _unsafeWindow.RAW_TEXT };
  3119. jsonCrackEmbed?.contentWindow?.postMessage(msg, "*");
  3120. });
  3121. }
  3122. });
  3123. },
  3124. _setRawText() {
  3125. let rawText = _unsafeWindow.RAW_TEXT;
  3126. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  3127. rawText = `${_unsafeWindow.GLOBAL_JSONP_FUN}(${rawText})`;
  3128. }
  3129. rawTextPre.textContent = rawText;
  3130. },
  3131. firstFormat: true,
  3132. viewRawText() {
  3133. if (!this.firstFormat) return;
  3134. this.firstFormat = false;
  3135. this._setRawText();
  3136. },
  3137. isBeautify: false,
  3138. beautify() {
  3139. this.isBeautify = !this.isBeautify;
  3140. if (!this.isBeautify) return this._setRawText();
  3141. let str = Utils.stringify(_unsafeWindow.GLOBAL_JSON, null, 2);
  3142. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  3143. str = `${_unsafeWindow.GLOBAL_JSONP_FUN}(${str})`;
  3144. }
  3145. rawTextPre.textContent = str;
  3146. },
  3147. init() {
  3148. Utils.addEvent("click", ".btn", (e) => {
  3149. const target = e.target;
  3150. const id = target.id;
  3151. if (Utils.hasClass(target, "tabs-item")) {
  3152. const clas = "active";
  3153. Utils.removeClass(Utils.queryAll(".tabs-item"), clas);
  3154. Utils.addClass(target, clas);
  3155. Utils.removeClass(Utils.queryAll("div[data-for]"), clas);
  3156. Utils.addClass(Utils.query(`div[data-for="${id}"]`), clas);
  3157. const template = Utils.query(`template[data-for='${id}']`);
  3158. Utils.query(".toolbar").innerHTML = template.innerHTML;
  3159. }
  3160. this[id](target);
  3161. });
  3162. }
  3163. };
  3164. window.addEventListener("message", function(event) {
  3165. const { data } = event;
  3166. if (!data?.reload) return;
  3167. jsonMind.isFirst = true;
  3168. tabs.isBeautify = false;
  3169. tabs.firstFormat = true;
  3170. mindBox.innerHTML = null;
  3171. _unsafeWindow.GLOBAL_JSMIND = void 0;
  3172. if (Utils.isVisible(rawTextBox)) return tabs.viewRawText();
  3173. if (Utils.isVisible(mindBox)) return jsonMind.init(_unsafeWindow.GLOBAL_JSON);
  3174. });
  3175. const theme = {
  3176. changeTheme(theme2) {
  3177. _GM_setValue("theme", theme2) & this.setTheme();
  3178. },
  3179. setTheme() {
  3180. const theme2 = _GM_getValue("theme") || "default";
  3181. _unsafeWindow.JSON_FORMATER.setTheme(theme2);
  3182. }
  3183. };
  3184. const http_form = `
  3185. <form class="httpRequest">
  3186. <div class="requestbox">
  3187. <select name="method">
  3188. <option value="POST">POST</option>
  3189. <option value="GET">GET</option>
  3190. <option value="PUT">PUT</option>
  3191. <option value="DELETE">DELETE</option>
  3192. </select>
  3193. <input name="url" placeholder="请求地址" />
  3194. <select name="contentType">
  3195. <option value="application/x-www-form-urlencoded;charset=UTF-8">urlencoded</option>
  3196. <option value="application/json;charset=UTF-8">application/json</option>
  3197. </select>
  3198. <button type="submit">发送</button>
  3199. </div>
  3200. <div class="textarea">
  3201. <input name="headers" placeholder='请求头 {"token": "test"}' />
  3202. <input name="params" placeholder='请求参数 {"id": "test", ""name": "test"}' />
  3203. </div>
  3204. </form>
  3205. `;
  3206. const tools = {
  3207. inputJson() {
  3208. layer.prompt(
  3209. {
  3210. move: false,
  3211. formType: 2,
  3212. btn: ["确认"],
  3213. shadeClose: true,
  3214. title: "JSON 输入",
  3215. area: ["400px", "300px"],
  3216. maxlength: Number.MAX_VALUE
  3217. },
  3218. (text) => {
  3219. if (!text) return layer.msg("内容不能为空", { time: 1500 });
  3220. const { rawText, jsonpFun } = Utils.matchJsonp(text);
  3221. try {
  3222. const json = Utils.parse(rawText);
  3223. this.reload(json, rawText, jsonpFun);
  3224. } catch (e) {
  3225. layer.msg("JSON格式不正确", { time: 1500 });
  3226. console.log("格式化异常: ", e);
  3227. }
  3228. }
  3229. );
  3230. return this;
  3231. },
  3232. fetchJson() {
  3233. const success = () => {
  3234. const formElem = Utils.query("form");
  3235. formElem.addEventListener("submit", (event) => {
  3236. event.preventDefault();
  3237. const formData = new FormData(formElem);
  3238. const submitData = {};
  3239. for (const [name, value] of formData) {
  3240. submitData[name] = value;
  3241. }
  3242. this._submit(submitData);
  3243. });
  3244. };
  3245. layer.open({
  3246. success,
  3247. type: 1,
  3248. shadeClose: true,
  3249. title: "HTTP 请求",
  3250. content: http_form
  3251. });
  3252. return this;
  3253. },
  3254. async _submit(submitData) {
  3255. if (!submitData.url) return layer.msg("请求地址不能为空");
  3256. let params = submitData.params;
  3257. let headers = submitData.headers;
  3258. if (headers && !(headers.startsWith("{") && headers.endsWith("}"))) {
  3259. return layer.msg("请求头 格式不合法");
  3260. }
  3261. if (params && !(params.startsWith("{") && params.endsWith("}"))) {
  3262. return layer.msg("请求参数 格式不合法");
  3263. }
  3264. try {
  3265. layer.load();
  3266. const response = await fetch(URL$1.ONLINE_REQUEST, {
  3267. method: "POST",
  3268. body: Utils.stringify(submitData),
  3269. headers: { "Content-Type": "application/json" }
  3270. });
  3271. let result = await response.json();
  3272. if (Utils.isObject(result)) result = Utils.stringify(result);
  3273. const { rawText, jsonpFun } = Utils.matchJsonp(result);
  3274. const json = Utils.parse(rawText);
  3275. this.reload(json, rawText, jsonpFun);
  3276. } catch (e) {
  3277. layer.closeAll();
  3278. layer.msg("请求异常:" + e.message);
  3279. console.log("HTTP 请求异常:", e);
  3280. }
  3281. },
  3282. reload(json, rawText, jsonpFun) {
  3283. layer.closeAll();
  3284. _unsafeWindow.RAW_TEXT = rawText;
  3285. _unsafeWindow.GLOBAL_JSON = json;
  3286. _unsafeWindow.GLOBAL_JSONP_FUN = jsonpFun;
  3287. window.postMessage({ reload: true });
  3288. }
  3289. };
  3290. const active = "active";
  3291. const handleBar = {
  3292. currentTippy: null,
  3293. handle() {
  3294. const tagName = "span";
  3295. [".style", ".theme", ".tools"].forEach((selector) => {
  3296. tippy(selector, {
  3297. duration: 500,
  3298. allowHTML: true,
  3299. interactive: true,
  3300. trigger: "click",
  3301. appendTo: Utils.query(selector).parentNode,
  3302. onTrigger: (instance) => {
  3303. this.currentTippy = instance;
  3304. const target = instance.reference;
  3305. Utils.addClass(Utils.query(tagName, target), active);
  3306. const template = Utils.query("template", target);
  3307. const ul = template.content.cloneNode(true);
  3308. const type = template.dataset.type;
  3309. const value = _GM_getValue(type) || "default";
  3310. const current = Utils.query(`li[data-value=${value}]`, ul);
  3311. Utils.addClass(current, active);
  3312. const tempDiv = Utils.createElement("div");
  3313. while (ul.firstChild) tempDiv.appendChild(ul.firstChild);
  3314. instance.setContent(tempDiv.innerHTML);
  3315. },
  3316. onHide(instance) {
  3317. Utils.removeClass(Utils.query(tagName, instance.reference));
  3318. }
  3319. });
  3320. });
  3321. return this;
  3322. },
  3323. checked() {
  3324. const selector = ".rightbox li";
  3325. Utils.addEvent("click", selector, (event) => {
  3326. const target = event.target;
  3327. if (Utils.hasClass(target, active)) return;
  3328. const type = target.dataset.type;
  3329. const value = target.dataset.value;
  3330. window.postMessage({ type, value });
  3331. if (Object.is(type, "tools")) return this.currentTippy.hide();
  3332. Utils.removeClass(Utils.queryAll(selector));
  3333. Utils.addClass(target, active);
  3334. });
  3335. return this;
  3336. },
  3337. init() {
  3338. this.handle().checked();
  3339. }
  3340. };
  3341. tabs.init();
  3342. theme.setTheme();
  3343. handleBar.init();
  3344. window.addEventListener("message", function(event) {
  3345. const { data } = event;
  3346. if (!data) return;
  3347. const { type, value } = data;
  3348. if (!type && !value) return;
  3349. if (Object.is(type, "tools")) return tools[value]();
  3350. if (Object.is(type, "theme")) return theme.changeTheme(value);
  3351. });
  3352.  
  3353. })
  3354. };
  3355. }));
  3356.  
  3357. System.register("./index-B8Td95-5-Bw55YpHI.js", ['./tippy.esm-Ot9MORvr-DNGa7Opj.js', './__monkey.entry-BchYAXNu.js'], (function (exports, module) {
  3358. 'use strict';
  3359. var tippy, Utils;
  3360. return {
  3361. setters: [module => {
  3362. tippy = module.t;
  3363. }, module => {
  3364. Utils = module.U;
  3365. }],
  3366. execute: (function () {
  3367.  
  3368. const scroll = Utils.createElement("div", { class: "scroll-top" });
  3369. document.body.appendChild(scroll);
  3370. tippy(scroll, { theme: "scroll", placement: "left", content: "返回顶部" });
  3371. const $container = Utils.query(".container");
  3372. $container.addEventListener("scroll", function() {
  3373. this.scrollTop > 500 ? Utils.show(scroll) : Utils.hide(scroll);
  3374. });
  3375. scroll.addEventListener("click", function() {
  3376. $container.scrollTop = 0;
  3377. });
  3378.  
  3379. })
  3380. };
  3381. }));
  3382.  
  3383. System.register("./tippy.esm-Ot9MORvr-DNGa7Opj.js", [], (function (exports, module) {
  3384. 'use strict';
  3385. return {
  3386. execute: (function () {
  3387.  
  3388. exports("t", tippy);
  3389.  
  3390. var top = "top";
  3391. var bottom = "bottom";
  3392. var right = "right";
  3393. var left = "left";
  3394. var auto = "auto";
  3395. var basePlacements = [top, bottom, right, left];
  3396. var start = "start";
  3397. var end = "end";
  3398. var clippingParents = "clippingParents";
  3399. var viewport = "viewport";
  3400. var popper = "popper";
  3401. var reference = "reference";
  3402. var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
  3403. return acc.concat([placement + "-" + start, placement + "-" + end]);
  3404. }, []);
  3405. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  3406. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  3407. }, []);
  3408. var beforeRead = "beforeRead";
  3409. var read = "read";
  3410. var afterRead = "afterRead";
  3411. var beforeMain = "beforeMain";
  3412. var main = "main";
  3413. var afterMain = "afterMain";
  3414. var beforeWrite = "beforeWrite";
  3415. var write = "write";
  3416. var afterWrite = "afterWrite";
  3417. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  3418. function getNodeName(element) {
  3419. return element ? (element.nodeName || "").toLowerCase() : null;
  3420. }
  3421. function getWindow(node) {
  3422. if (node == null) {
  3423. return window;
  3424. }
  3425. if (node.toString() !== "[object Window]") {
  3426. var ownerDocument = node.ownerDocument;
  3427. return ownerDocument ? ownerDocument.defaultView || window : window;
  3428. }
  3429. return node;
  3430. }
  3431. function isElement$1(node) {
  3432. var OwnElement = getWindow(node).Element;
  3433. return node instanceof OwnElement || node instanceof Element;
  3434. }
  3435. function isHTMLElement(node) {
  3436. var OwnElement = getWindow(node).HTMLElement;
  3437. return node instanceof OwnElement || node instanceof HTMLElement;
  3438. }
  3439. function isShadowRoot(node) {
  3440. if (typeof ShadowRoot === "undefined") {
  3441. return false;
  3442. }
  3443. var OwnElement = getWindow(node).ShadowRoot;
  3444. return node instanceof OwnElement || node instanceof ShadowRoot;
  3445. }
  3446. function applyStyles(_ref) {
  3447. var state = _ref.state;
  3448. Object.keys(state.elements).forEach(function(name) {
  3449. var style = state.styles[name] || {};
  3450. var attributes = state.attributes[name] || {};
  3451. var element = state.elements[name];
  3452. if (!isHTMLElement(element) || !getNodeName(element)) {
  3453. return;
  3454. }
  3455. Object.assign(element.style, style);
  3456. Object.keys(attributes).forEach(function(name2) {
  3457. var value = attributes[name2];
  3458. if (value === false) {
  3459. element.removeAttribute(name2);
  3460. } else {
  3461. element.setAttribute(name2, value === true ? "" : value);
  3462. }
  3463. });
  3464. });
  3465. }
  3466. function effect$2(_ref2) {
  3467. var state = _ref2.state;
  3468. var initialStyles = {
  3469. popper: {
  3470. position: state.options.strategy,
  3471. left: "0",
  3472. top: "0",
  3473. margin: "0"
  3474. },
  3475. arrow: {
  3476. position: "absolute"
  3477. },
  3478. reference: {}
  3479. };
  3480. Object.assign(state.elements.popper.style, initialStyles.popper);
  3481. state.styles = initialStyles;
  3482. if (state.elements.arrow) {
  3483. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  3484. }
  3485. return function() {
  3486. Object.keys(state.elements).forEach(function(name) {
  3487. var element = state.elements[name];
  3488. var attributes = state.attributes[name] || {};
  3489. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
  3490. var style = styleProperties.reduce(function(style2, property) {
  3491. style2[property] = "";
  3492. return style2;
  3493. }, {});
  3494. if (!isHTMLElement(element) || !getNodeName(element)) {
  3495. return;
  3496. }
  3497. Object.assign(element.style, style);
  3498. Object.keys(attributes).forEach(function(attribute) {
  3499. element.removeAttribute(attribute);
  3500. });
  3501. });
  3502. };
  3503. }
  3504. const applyStyles$1 = {
  3505. name: "applyStyles",
  3506. enabled: true,
  3507. phase: "write",
  3508. fn: applyStyles,
  3509. effect: effect$2,
  3510. requires: ["computeStyles"]
  3511. };
  3512. function getBasePlacement$1(placement) {
  3513. return placement.split("-")[0];
  3514. }
  3515. var max = Math.max;
  3516. var min = Math.min;
  3517. var round = Math.round;
  3518. function getUAString() {
  3519. var uaData = navigator.userAgentData;
  3520. if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
  3521. return uaData.brands.map(function(item) {
  3522. return item.brand + "/" + item.version;
  3523. }).join(" ");
  3524. }
  3525. return navigator.userAgent;
  3526. }
  3527. function isLayoutViewport() {
  3528. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  3529. }
  3530. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  3531. if (includeScale === void 0) {
  3532. includeScale = false;
  3533. }
  3534. if (isFixedStrategy === void 0) {
  3535. isFixedStrategy = false;
  3536. }
  3537. var clientRect = element.getBoundingClientRect();
  3538. var scaleX = 1;
  3539. var scaleY = 1;
  3540. if (includeScale && isHTMLElement(element)) {
  3541. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  3542. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  3543. }
  3544. var _ref = isElement$1(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
  3545. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  3546. var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  3547. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  3548. var width = clientRect.width / scaleX;
  3549. var height = clientRect.height / scaleY;
  3550. return {
  3551. width,
  3552. height,
  3553. top: y,
  3554. right: x + width,
  3555. bottom: y + height,
  3556. left: x,
  3557. x,
  3558. y
  3559. };
  3560. }
  3561. function getLayoutRect(element) {
  3562. var clientRect = getBoundingClientRect(element);
  3563. var width = element.offsetWidth;
  3564. var height = element.offsetHeight;
  3565. if (Math.abs(clientRect.width - width) <= 1) {
  3566. width = clientRect.width;
  3567. }
  3568. if (Math.abs(clientRect.height - height) <= 1) {
  3569. height = clientRect.height;
  3570. }
  3571. return {
  3572. x: element.offsetLeft,
  3573. y: element.offsetTop,
  3574. width,
  3575. height
  3576. };
  3577. }
  3578. function contains(parent, child) {
  3579. var rootNode = child.getRootNode && child.getRootNode();
  3580. if (parent.contains(child)) {
  3581. return true;
  3582. } else if (rootNode && isShadowRoot(rootNode)) {
  3583. var next = child;
  3584. do {
  3585. if (next && parent.isSameNode(next)) {
  3586. return true;
  3587. }
  3588. next = next.parentNode || next.host;
  3589. } while (next);
  3590. }
  3591. return false;
  3592. }
  3593. function getComputedStyle(element) {
  3594. return getWindow(element).getComputedStyle(element);
  3595. }
  3596. function isTableElement(element) {
  3597. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  3598. }
  3599. function getDocumentElement(element) {
  3600. return ((isElement$1(element) ? element.ownerDocument : (
  3601. // $FlowFixMe[prop-missing]
  3602. element.document
  3603. )) || window.document).documentElement;
  3604. }
  3605. function getParentNode(element) {
  3606. if (getNodeName(element) === "html") {
  3607. return element;
  3608. }
  3609. return (
  3610. // this is a quicker (but less type safe) way to save quite some bytes from the bundle
  3611. // $FlowFixMe[incompatible-return]
  3612. // $FlowFixMe[prop-missing]
  3613. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  3614. element.parentNode || // DOM Element detected
  3615. (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  3616. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  3617. getDocumentElement(element)
  3618. );
  3619. }
  3620. function getTrueOffsetParent(element) {
  3621. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  3622. getComputedStyle(element).position === "fixed") {
  3623. return null;
  3624. }
  3625. return element.offsetParent;
  3626. }
  3627. function getContainingBlock(element) {
  3628. var isFirefox = /firefox/i.test(getUAString());
  3629. var isIE = /Trident/i.test(getUAString());
  3630. if (isIE && isHTMLElement(element)) {
  3631. var elementCss = getComputedStyle(element);
  3632. if (elementCss.position === "fixed") {
  3633. return null;
  3634. }
  3635. }
  3636. var currentNode = getParentNode(element);
  3637. if (isShadowRoot(currentNode)) {
  3638. currentNode = currentNode.host;
  3639. }
  3640. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  3641. var css = getComputedStyle(currentNode);
  3642. 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") {
  3643. return currentNode;
  3644. } else {
  3645. currentNode = currentNode.parentNode;
  3646. }
  3647. }
  3648. return null;
  3649. }
  3650. function getOffsetParent(element) {
  3651. var window2 = getWindow(element);
  3652. var offsetParent = getTrueOffsetParent(element);
  3653. while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
  3654. offsetParent = getTrueOffsetParent(offsetParent);
  3655. }
  3656. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
  3657. return window2;
  3658. }
  3659. return offsetParent || getContainingBlock(element) || window2;
  3660. }
  3661. function getMainAxisFromPlacement(placement) {
  3662. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  3663. }
  3664. function within(min$1, value, max$1) {
  3665. return max(min$1, min(value, max$1));
  3666. }
  3667. function withinMaxClamp(min2, value, max2) {
  3668. var v = within(min2, value, max2);
  3669. return v > max2 ? max2 : v;
  3670. }
  3671. function getFreshSideObject() {
  3672. return {
  3673. top: 0,
  3674. right: 0,
  3675. bottom: 0,
  3676. left: 0
  3677. };
  3678. }
  3679. function mergePaddingObject(paddingObject) {
  3680. return Object.assign({}, getFreshSideObject(), paddingObject);
  3681. }
  3682. function expandToHashMap(value, keys) {
  3683. return keys.reduce(function(hashMap, key) {
  3684. hashMap[key] = value;
  3685. return hashMap;
  3686. }, {});
  3687. }
  3688. var toPaddingObject = function toPaddingObject2(padding, state) {
  3689. padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
  3690. placement: state.placement
  3691. })) : padding;
  3692. return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  3693. };
  3694. function arrow(_ref) {
  3695. var _state$modifiersData$;
  3696. var state = _ref.state, name = _ref.name, options = _ref.options;
  3697. var arrowElement = state.elements.arrow;
  3698. var popperOffsets2 = state.modifiersData.popperOffsets;
  3699. var basePlacement = getBasePlacement$1(state.placement);
  3700. var axis = getMainAxisFromPlacement(basePlacement);
  3701. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  3702. var len = isVertical ? "height" : "width";
  3703. if (!arrowElement || !popperOffsets2) {
  3704. return;
  3705. }
  3706. var paddingObject = toPaddingObject(options.padding, state);
  3707. var arrowRect = getLayoutRect(arrowElement);
  3708. var minProp = axis === "y" ? top : left;
  3709. var maxProp = axis === "y" ? bottom : right;
  3710. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
  3711. var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
  3712. var arrowOffsetParent = getOffsetParent(arrowElement);
  3713. var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  3714. var centerToReference = endDiff / 2 - startDiff / 2;
  3715. var min2 = paddingObject[minProp];
  3716. var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
  3717. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  3718. var offset2 = within(min2, center, max2);
  3719. var axisProp = axis;
  3720. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
  3721. }
  3722. function effect$1(_ref2) {
  3723. var state = _ref2.state, options = _ref2.options;
  3724. var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
  3725. if (arrowElement == null) {
  3726. return;
  3727. }
  3728. if (typeof arrowElement === "string") {
  3729. arrowElement = state.elements.popper.querySelector(arrowElement);
  3730. if (!arrowElement) {
  3731. return;
  3732. }
  3733. }
  3734. if (!contains(state.elements.popper, arrowElement)) {
  3735. return;
  3736. }
  3737. state.elements.arrow = arrowElement;
  3738. }
  3739. const arrow$1 = {
  3740. name: "arrow",
  3741. enabled: true,
  3742. phase: "main",
  3743. fn: arrow,
  3744. effect: effect$1,
  3745. requires: ["popperOffsets"],
  3746. requiresIfExists: ["preventOverflow"]
  3747. };
  3748. function getVariation(placement) {
  3749. return placement.split("-")[1];
  3750. }
  3751. var unsetSides = {
  3752. top: "auto",
  3753. right: "auto",
  3754. bottom: "auto",
  3755. left: "auto"
  3756. };
  3757. function roundOffsetsByDPR(_ref, win) {
  3758. var x = _ref.x, y = _ref.y;
  3759. var dpr = win.devicePixelRatio || 1;
  3760. return {
  3761. x: round(x * dpr) / dpr || 0,
  3762. y: round(y * dpr) / dpr || 0
  3763. };
  3764. }
  3765. function mapToStyles(_ref2) {
  3766. var _Object$assign2;
  3767. 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;
  3768. 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;
  3769. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  3770. x,
  3771. y
  3772. }) : {
  3773. x,
  3774. y
  3775. };
  3776. x = _ref3.x;
  3777. y = _ref3.y;
  3778. var hasX = offsets.hasOwnProperty("x");
  3779. var hasY = offsets.hasOwnProperty("y");
  3780. var sideX = left;
  3781. var sideY = top;
  3782. var win = window;
  3783. if (adaptive) {
  3784. var offsetParent = getOffsetParent(popper2);
  3785. var heightProp = "clientHeight";
  3786. var widthProp = "clientWidth";
  3787. if (offsetParent === getWindow(popper2)) {
  3788. offsetParent = getDocumentElement(popper2);
  3789. if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
  3790. heightProp = "scrollHeight";
  3791. widthProp = "scrollWidth";
  3792. }
  3793. }
  3794. offsetParent = offsetParent;
  3795. if (placement === top || (placement === left || placement === right) && variation === end) {
  3796. sideY = bottom;
  3797. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
  3798. // $FlowFixMe[prop-missing]
  3799. offsetParent[heightProp]
  3800. );
  3801. y -= offsetY - popperRect.height;
  3802. y *= gpuAcceleration ? 1 : -1;
  3803. }
  3804. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  3805. sideX = right;
  3806. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
  3807. // $FlowFixMe[prop-missing]
  3808. offsetParent[widthProp]
  3809. );
  3810. x -= offsetX - popperRect.width;
  3811. x *= gpuAcceleration ? 1 : -1;
  3812. }
  3813. }
  3814. var commonStyles = Object.assign({
  3815. position
  3816. }, adaptive && unsetSides);
  3817. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  3818. x,
  3819. y
  3820. }, getWindow(popper2)) : {
  3821. x,
  3822. y
  3823. };
  3824. x = _ref4.x;
  3825. y = _ref4.y;
  3826. if (gpuAcceleration) {
  3827. var _Object$assign;
  3828. 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));
  3829. }
  3830. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  3831. }
  3832. function computeStyles(_ref5) {
  3833. var state = _ref5.state, options = _ref5.options;
  3834. 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;
  3835. var commonStyles = {
  3836. placement: getBasePlacement$1(state.placement),
  3837. variation: getVariation(state.placement),
  3838. popper: state.elements.popper,
  3839. popperRect: state.rects.popper,
  3840. gpuAcceleration,
  3841. isFixed: state.options.strategy === "fixed"
  3842. };
  3843. if (state.modifiersData.popperOffsets != null) {
  3844. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  3845. offsets: state.modifiersData.popperOffsets,
  3846. position: state.options.strategy,
  3847. adaptive,
  3848. roundOffsets
  3849. })));
  3850. }
  3851. if (state.modifiersData.arrow != null) {
  3852. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  3853. offsets: state.modifiersData.arrow,
  3854. position: "absolute",
  3855. adaptive: false,
  3856. roundOffsets
  3857. })));
  3858. }
  3859. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  3860. "data-popper-placement": state.placement
  3861. });
  3862. }
  3863. const computeStyles$1 = {
  3864. name: "computeStyles",
  3865. enabled: true,
  3866. phase: "beforeWrite",
  3867. fn: computeStyles,
  3868. data: {}
  3869. };
  3870. var passive = {
  3871. passive: true
  3872. };
  3873. function effect(_ref) {
  3874. var state = _ref.state, instance = _ref.instance, options = _ref.options;
  3875. 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;
  3876. var window2 = getWindow(state.elements.popper);
  3877. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  3878. if (scroll) {
  3879. scrollParents.forEach(function(scrollParent) {
  3880. scrollParent.addEventListener("scroll", instance.update, passive);
  3881. });
  3882. }
  3883. if (resize) {
  3884. window2.addEventListener("resize", instance.update, passive);
  3885. }
  3886. return function() {
  3887. if (scroll) {
  3888. scrollParents.forEach(function(scrollParent) {
  3889. scrollParent.removeEventListener("scroll", instance.update, passive);
  3890. });
  3891. }
  3892. if (resize) {
  3893. window2.removeEventListener("resize", instance.update, passive);
  3894. }
  3895. };
  3896. }
  3897. const eventListeners = {
  3898. name: "eventListeners",
  3899. enabled: true,
  3900. phase: "write",
  3901. fn: function fn() {
  3902. },
  3903. effect,
  3904. data: {}
  3905. };
  3906. var hash$1 = {
  3907. left: "right",
  3908. right: "left",
  3909. bottom: "top",
  3910. top: "bottom"
  3911. };
  3912. function getOppositePlacement(placement) {
  3913. return placement.replace(/left|right|bottom|top/g, function(matched) {
  3914. return hash$1[matched];
  3915. });
  3916. }
  3917. var hash = {
  3918. start: "end",
  3919. end: "start"
  3920. };
  3921. function getOppositeVariationPlacement(placement) {
  3922. return placement.replace(/start|end/g, function(matched) {
  3923. return hash[matched];
  3924. });
  3925. }
  3926. function getWindowScroll(node) {
  3927. var win = getWindow(node);
  3928. var scrollLeft = win.pageXOffset;
  3929. var scrollTop = win.pageYOffset;
  3930. return {
  3931. scrollLeft,
  3932. scrollTop
  3933. };
  3934. }
  3935. function getWindowScrollBarX(element) {
  3936. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  3937. }
  3938. function getViewportRect(element, strategy) {
  3939. var win = getWindow(element);
  3940. var html = getDocumentElement(element);
  3941. var visualViewport = win.visualViewport;
  3942. var width = html.clientWidth;
  3943. var height = html.clientHeight;
  3944. var x = 0;
  3945. var y = 0;
  3946. if (visualViewport) {
  3947. width = visualViewport.width;
  3948. height = visualViewport.height;
  3949. var layoutViewport = isLayoutViewport();
  3950. if (layoutViewport || !layoutViewport && strategy === "fixed") {
  3951. x = visualViewport.offsetLeft;
  3952. y = visualViewport.offsetTop;
  3953. }
  3954. }
  3955. return {
  3956. width,
  3957. height,
  3958. x: x + getWindowScrollBarX(element),
  3959. y
  3960. };
  3961. }
  3962. function getDocumentRect(element) {
  3963. var _element$ownerDocumen;
  3964. var html = getDocumentElement(element);
  3965. var winScroll = getWindowScroll(element);
  3966. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  3967. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  3968. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  3969. var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
  3970. var y = -winScroll.scrollTop;
  3971. if (getComputedStyle(body || html).direction === "rtl") {
  3972. x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  3973. }
  3974. return {
  3975. width,
  3976. height,
  3977. x,
  3978. y
  3979. };
  3980. }
  3981. function isScrollParent(element) {
  3982. var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  3983. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  3984. }
  3985. function getScrollParent(node) {
  3986. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  3987. return node.ownerDocument.body;
  3988. }
  3989. if (isHTMLElement(node) && isScrollParent(node)) {
  3990. return node;
  3991. }
  3992. return getScrollParent(getParentNode(node));
  3993. }
  3994. function listScrollParents(element, list) {
  3995. var _element$ownerDocumen;
  3996. if (list === void 0) {
  3997. list = [];
  3998. }
  3999. var scrollParent = getScrollParent(element);
  4000. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  4001. var win = getWindow(scrollParent);
  4002. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  4003. var updatedList = list.concat(target);
  4004. return isBody ? updatedList : (
  4005. // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  4006. updatedList.concat(listScrollParents(getParentNode(target)))
  4007. );
  4008. }
  4009. function rectToClientRect(rect) {
  4010. return Object.assign({}, rect, {
  4011. left: rect.x,
  4012. top: rect.y,
  4013. right: rect.x + rect.width,
  4014. bottom: rect.y + rect.height
  4015. });
  4016. }
  4017. function getInnerBoundingClientRect(element, strategy) {
  4018. var rect = getBoundingClientRect(element, false, strategy === "fixed");
  4019. rect.top = rect.top + element.clientTop;
  4020. rect.left = rect.left + element.clientLeft;
  4021. rect.bottom = rect.top + element.clientHeight;
  4022. rect.right = rect.left + element.clientWidth;
  4023. rect.width = element.clientWidth;
  4024. rect.height = element.clientHeight;
  4025. rect.x = rect.left;
  4026. rect.y = rect.top;
  4027. return rect;
  4028. }
  4029. function getClientRectFromMixedType(element, clippingParent, strategy) {
  4030. return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  4031. }
  4032. function getClippingParents(element) {
  4033. var clippingParents2 = listScrollParents(getParentNode(element));
  4034. var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle(element).position) >= 0;
  4035. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  4036. if (!isElement$1(clipperElement)) {
  4037. return [];
  4038. }
  4039. return clippingParents2.filter(function(clippingParent) {
  4040. return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
  4041. });
  4042. }
  4043. function getClippingRect(element, boundary, rootBoundary, strategy) {
  4044. var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
  4045. var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
  4046. var firstClippingParent = clippingParents2[0];
  4047. var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
  4048. var rect = getClientRectFromMixedType(element, clippingParent, strategy);
  4049. accRect.top = max(rect.top, accRect.top);
  4050. accRect.right = min(rect.right, accRect.right);
  4051. accRect.bottom = min(rect.bottom, accRect.bottom);
  4052. accRect.left = max(rect.left, accRect.left);
  4053. return accRect;
  4054. }, getClientRectFromMixedType(element, firstClippingParent, strategy));
  4055. clippingRect.width = clippingRect.right - clippingRect.left;
  4056. clippingRect.height = clippingRect.bottom - clippingRect.top;
  4057. clippingRect.x = clippingRect.left;
  4058. clippingRect.y = clippingRect.top;
  4059. return clippingRect;
  4060. }
  4061. function computeOffsets(_ref) {
  4062. var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
  4063. var basePlacement = placement ? getBasePlacement$1(placement) : null;
  4064. var variation = placement ? getVariation(placement) : null;
  4065. var commonX = reference2.x + reference2.width / 2 - element.width / 2;
  4066. var commonY = reference2.y + reference2.height / 2 - element.height / 2;
  4067. var offsets;
  4068. switch (basePlacement) {
  4069. case top:
  4070. offsets = {
  4071. x: commonX,
  4072. y: reference2.y - element.height
  4073. };
  4074. break;
  4075. case bottom:
  4076. offsets = {
  4077. x: commonX,
  4078. y: reference2.y + reference2.height
  4079. };
  4080. break;
  4081. case right:
  4082. offsets = {
  4083. x: reference2.x + reference2.width,
  4084. y: commonY
  4085. };
  4086. break;
  4087. case left:
  4088. offsets = {
  4089. x: reference2.x - element.width,
  4090. y: commonY
  4091. };
  4092. break;
  4093. default:
  4094. offsets = {
  4095. x: reference2.x,
  4096. y: reference2.y
  4097. };
  4098. }
  4099. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  4100. if (mainAxis != null) {
  4101. var len = mainAxis === "y" ? "height" : "width";
  4102. switch (variation) {
  4103. case start:
  4104. offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
  4105. break;
  4106. case end:
  4107. offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
  4108. break;
  4109. }
  4110. }
  4111. return offsets;
  4112. }
  4113. function detectOverflow(state, options) {
  4114. if (options === void 0) {
  4115. options = {};
  4116. }
  4117. 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;
  4118. var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  4119. var altContext = elementContext === popper ? reference : popper;
  4120. var popperRect = state.rects.popper;
  4121. var element = state.elements[altBoundary ? altContext : elementContext];
  4122. var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
  4123. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  4124. var popperOffsets2 = computeOffsets({
  4125. reference: referenceClientRect,
  4126. element: popperRect,
  4127. strategy: "absolute",
  4128. placement
  4129. });
  4130. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
  4131. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
  4132. var overflowOffsets = {
  4133. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  4134. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  4135. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  4136. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  4137. };
  4138. var offsetData = state.modifiersData.offset;
  4139. if (elementContext === popper && offsetData) {
  4140. var offset2 = offsetData[placement];
  4141. Object.keys(overflowOffsets).forEach(function(key) {
  4142. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  4143. var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
  4144. overflowOffsets[key] += offset2[axis] * multiply;
  4145. });
  4146. }
  4147. return overflowOffsets;
  4148. }
  4149. function computeAutoPlacement(state, options) {
  4150. if (options === void 0) {
  4151. options = {};
  4152. }
  4153. 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;
  4154. var variation = getVariation(placement);
  4155. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
  4156. return getVariation(placement2) === variation;
  4157. }) : basePlacements;
  4158. var allowedPlacements = placements$1.filter(function(placement2) {
  4159. return allowedAutoPlacements.indexOf(placement2) >= 0;
  4160. });
  4161. if (allowedPlacements.length === 0) {
  4162. allowedPlacements = placements$1;
  4163. }
  4164. var overflows = allowedPlacements.reduce(function(acc, placement2) {
  4165. acc[placement2] = detectOverflow(state, {
  4166. placement: placement2,
  4167. boundary,
  4168. rootBoundary,
  4169. padding
  4170. })[getBasePlacement$1(placement2)];
  4171. return acc;
  4172. }, {});
  4173. return Object.keys(overflows).sort(function(a, b) {
  4174. return overflows[a] - overflows[b];
  4175. });
  4176. }
  4177. function getExpandedFallbackPlacements(placement) {
  4178. if (getBasePlacement$1(placement) === auto) {
  4179. return [];
  4180. }
  4181. var oppositePlacement = getOppositePlacement(placement);
  4182. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  4183. }
  4184. function flip(_ref) {
  4185. var state = _ref.state, options = _ref.options, name = _ref.name;
  4186. if (state.modifiersData[name]._skip) {
  4187. return;
  4188. }
  4189. 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;
  4190. var preferredPlacement = state.options.placement;
  4191. var basePlacement = getBasePlacement$1(preferredPlacement);
  4192. var isBasePlacement = basePlacement === preferredPlacement;
  4193. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  4194. var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
  4195. return acc.concat(getBasePlacement$1(placement2) === auto ? computeAutoPlacement(state, {
  4196. placement: placement2,
  4197. boundary,
  4198. rootBoundary,
  4199. padding,
  4200. flipVariations,
  4201. allowedAutoPlacements
  4202. }) : placement2);
  4203. }, []);
  4204. var referenceRect = state.rects.reference;
  4205. var popperRect = state.rects.popper;
  4206. var checksMap = /* @__PURE__ */ new Map();
  4207. var makeFallbackChecks = true;
  4208. var firstFittingPlacement = placements2[0];
  4209. for (var i = 0; i < placements2.length; i++) {
  4210. var placement = placements2[i];
  4211. var _basePlacement = getBasePlacement$1(placement);
  4212. var isStartVariation = getVariation(placement) === start;
  4213. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  4214. var len = isVertical ? "width" : "height";
  4215. var overflow = detectOverflow(state, {
  4216. placement,
  4217. boundary,
  4218. rootBoundary,
  4219. altBoundary,
  4220. padding
  4221. });
  4222. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  4223. if (referenceRect[len] > popperRect[len]) {
  4224. mainVariationSide = getOppositePlacement(mainVariationSide);
  4225. }
  4226. var altVariationSide = getOppositePlacement(mainVariationSide);
  4227. var checks = [];
  4228. if (checkMainAxis) {
  4229. checks.push(overflow[_basePlacement] <= 0);
  4230. }
  4231. if (checkAltAxis) {
  4232. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  4233. }
  4234. if (checks.every(function(check) {
  4235. return check;
  4236. })) {
  4237. firstFittingPlacement = placement;
  4238. makeFallbackChecks = false;
  4239. break;
  4240. }
  4241. checksMap.set(placement, checks);
  4242. }
  4243. if (makeFallbackChecks) {
  4244. var numberOfChecks = flipVariations ? 3 : 1;
  4245. var _loop = function _loop2(_i2) {
  4246. var fittingPlacement = placements2.find(function(placement2) {
  4247. var checks2 = checksMap.get(placement2);
  4248. if (checks2) {
  4249. return checks2.slice(0, _i2).every(function(check) {
  4250. return check;
  4251. });
  4252. }
  4253. });
  4254. if (fittingPlacement) {
  4255. firstFittingPlacement = fittingPlacement;
  4256. return "break";
  4257. }
  4258. };
  4259. for (var _i = numberOfChecks; _i > 0; _i--) {
  4260. var _ret = _loop(_i);
  4261. if (_ret === "break") break;
  4262. }
  4263. }
  4264. if (state.placement !== firstFittingPlacement) {
  4265. state.modifiersData[name]._skip = true;
  4266. state.placement = firstFittingPlacement;
  4267. state.reset = true;
  4268. }
  4269. }
  4270. const flip$1 = {
  4271. name: "flip",
  4272. enabled: true,
  4273. phase: "main",
  4274. fn: flip,
  4275. requiresIfExists: ["offset"],
  4276. data: {
  4277. _skip: false
  4278. }
  4279. };
  4280. function getSideOffsets(overflow, rect, preventedOffsets) {
  4281. if (preventedOffsets === void 0) {
  4282. preventedOffsets = {
  4283. x: 0,
  4284. y: 0
  4285. };
  4286. }
  4287. return {
  4288. top: overflow.top - rect.height - preventedOffsets.y,
  4289. right: overflow.right - rect.width + preventedOffsets.x,
  4290. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  4291. left: overflow.left - rect.width - preventedOffsets.x
  4292. };
  4293. }
  4294. function isAnySideFullyClipped(overflow) {
  4295. return [top, right, bottom, left].some(function(side) {
  4296. return overflow[side] >= 0;
  4297. });
  4298. }
  4299. function hide(_ref) {
  4300. var state = _ref.state, name = _ref.name;
  4301. var referenceRect = state.rects.reference;
  4302. var popperRect = state.rects.popper;
  4303. var preventedOffsets = state.modifiersData.preventOverflow;
  4304. var referenceOverflow = detectOverflow(state, {
  4305. elementContext: "reference"
  4306. });
  4307. var popperAltOverflow = detectOverflow(state, {
  4308. altBoundary: true
  4309. });
  4310. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  4311. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  4312. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  4313. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  4314. state.modifiersData[name] = {
  4315. referenceClippingOffsets,
  4316. popperEscapeOffsets,
  4317. isReferenceHidden,
  4318. hasPopperEscaped
  4319. };
  4320. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  4321. "data-popper-reference-hidden": isReferenceHidden,
  4322. "data-popper-escaped": hasPopperEscaped
  4323. });
  4324. }
  4325. const hide$1 = {
  4326. name: "hide",
  4327. enabled: true,
  4328. phase: "main",
  4329. requiresIfExists: ["preventOverflow"],
  4330. fn: hide
  4331. };
  4332. function distanceAndSkiddingToXY(placement, rects, offset2) {
  4333. var basePlacement = getBasePlacement$1(placement);
  4334. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  4335. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  4336. placement
  4337. })) : offset2, skidding = _ref[0], distance = _ref[1];
  4338. skidding = skidding || 0;
  4339. distance = (distance || 0) * invertDistance;
  4340. return [left, right].indexOf(basePlacement) >= 0 ? {
  4341. x: distance,
  4342. y: skidding
  4343. } : {
  4344. x: skidding,
  4345. y: distance
  4346. };
  4347. }
  4348. function offset(_ref2) {
  4349. var state = _ref2.state, options = _ref2.options, name = _ref2.name;
  4350. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  4351. var data = placements.reduce(function(acc, placement) {
  4352. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  4353. return acc;
  4354. }, {});
  4355. var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
  4356. if (state.modifiersData.popperOffsets != null) {
  4357. state.modifiersData.popperOffsets.x += x;
  4358. state.modifiersData.popperOffsets.y += y;
  4359. }
  4360. state.modifiersData[name] = data;
  4361. }
  4362. const offset$1 = {
  4363. name: "offset",
  4364. enabled: true,
  4365. phase: "main",
  4366. requires: ["popperOffsets"],
  4367. fn: offset
  4368. };
  4369. function popperOffsets(_ref) {
  4370. var state = _ref.state, name = _ref.name;
  4371. state.modifiersData[name] = computeOffsets({
  4372. reference: state.rects.reference,
  4373. element: state.rects.popper,
  4374. strategy: "absolute",
  4375. placement: state.placement
  4376. });
  4377. }
  4378. const popperOffsets$1 = {
  4379. name: "popperOffsets",
  4380. enabled: true,
  4381. phase: "read",
  4382. fn: popperOffsets,
  4383. data: {}
  4384. };
  4385. function getAltAxis(axis) {
  4386. return axis === "x" ? "y" : "x";
  4387. }
  4388. function preventOverflow(_ref) {
  4389. var state = _ref.state, options = _ref.options, name = _ref.name;
  4390. 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;
  4391. var overflow = detectOverflow(state, {
  4392. boundary,
  4393. rootBoundary,
  4394. padding,
  4395. altBoundary
  4396. });
  4397. var basePlacement = getBasePlacement$1(state.placement);
  4398. var variation = getVariation(state.placement);
  4399. var isBasePlacement = !variation;
  4400. var mainAxis = getMainAxisFromPlacement(basePlacement);
  4401. var altAxis = getAltAxis(mainAxis);
  4402. var popperOffsets2 = state.modifiersData.popperOffsets;
  4403. var referenceRect = state.rects.reference;
  4404. var popperRect = state.rects.popper;
  4405. var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
  4406. placement: state.placement
  4407. })) : tetherOffset;
  4408. var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
  4409. mainAxis: tetherOffsetValue,
  4410. altAxis: tetherOffsetValue
  4411. } : Object.assign({
  4412. mainAxis: 0,
  4413. altAxis: 0
  4414. }, tetherOffsetValue);
  4415. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  4416. var data = {
  4417. x: 0,
  4418. y: 0
  4419. };
  4420. if (!popperOffsets2) {
  4421. return;
  4422. }
  4423. if (checkMainAxis) {
  4424. var _offsetModifierState$;
  4425. var mainSide = mainAxis === "y" ? top : left;
  4426. var altSide = mainAxis === "y" ? bottom : right;
  4427. var len = mainAxis === "y" ? "height" : "width";
  4428. var offset2 = popperOffsets2[mainAxis];
  4429. var min$1 = offset2 + overflow[mainSide];
  4430. var max$1 = offset2 - overflow[altSide];
  4431. var additive = tether ? -popperRect[len] / 2 : 0;
  4432. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  4433. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
  4434. var arrowElement = state.elements.arrow;
  4435. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  4436. width: 0,
  4437. height: 0
  4438. };
  4439. var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
  4440. var arrowPaddingMin = arrowPaddingObject[mainSide];
  4441. var arrowPaddingMax = arrowPaddingObject[altSide];
  4442. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  4443. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  4444. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  4445. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  4446. var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  4447. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  4448. var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
  4449. var tetherMax = offset2 + maxOffset - offsetModifierValue;
  4450. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
  4451. popperOffsets2[mainAxis] = preventedOffset;
  4452. data[mainAxis] = preventedOffset - offset2;
  4453. }
  4454. if (checkAltAxis) {
  4455. var _offsetModifierState$2;
  4456. var _mainSide = mainAxis === "x" ? top : left;
  4457. var _altSide = mainAxis === "x" ? bottom : right;
  4458. var _offset = popperOffsets2[altAxis];
  4459. var _len = altAxis === "y" ? "height" : "width";
  4460. var _min = _offset + overflow[_mainSide];
  4461. var _max = _offset - overflow[_altSide];
  4462. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  4463. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  4464. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  4465. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  4466. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  4467. popperOffsets2[altAxis] = _preventedOffset;
  4468. data[altAxis] = _preventedOffset - _offset;
  4469. }
  4470. state.modifiersData[name] = data;
  4471. }
  4472. const preventOverflow$1 = {
  4473. name: "preventOverflow",
  4474. enabled: true,
  4475. phase: "main",
  4476. fn: preventOverflow,
  4477. requiresIfExists: ["offset"]
  4478. };
  4479. function getHTMLElementScroll(element) {
  4480. return {
  4481. scrollLeft: element.scrollLeft,
  4482. scrollTop: element.scrollTop
  4483. };
  4484. }
  4485. function getNodeScroll(node) {
  4486. if (node === getWindow(node) || !isHTMLElement(node)) {
  4487. return getWindowScroll(node);
  4488. } else {
  4489. return getHTMLElementScroll(node);
  4490. }
  4491. }
  4492. function isElementScaled(element) {
  4493. var rect = element.getBoundingClientRect();
  4494. var scaleX = round(rect.width) / element.offsetWidth || 1;
  4495. var scaleY = round(rect.height) / element.offsetHeight || 1;
  4496. return scaleX !== 1 || scaleY !== 1;
  4497. }
  4498. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  4499. if (isFixed === void 0) {
  4500. isFixed = false;
  4501. }
  4502. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  4503. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  4504. var documentElement = getDocumentElement(offsetParent);
  4505. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  4506. var scroll = {
  4507. scrollLeft: 0,
  4508. scrollTop: 0
  4509. };
  4510. var offsets = {
  4511. x: 0,
  4512. y: 0
  4513. };
  4514. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  4515. if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
  4516. isScrollParent(documentElement)) {
  4517. scroll = getNodeScroll(offsetParent);
  4518. }
  4519. if (isHTMLElement(offsetParent)) {
  4520. offsets = getBoundingClientRect(offsetParent, true);
  4521. offsets.x += offsetParent.clientLeft;
  4522. offsets.y += offsetParent.clientTop;
  4523. } else if (documentElement) {
  4524. offsets.x = getWindowScrollBarX(documentElement);
  4525. }
  4526. }
  4527. return {
  4528. x: rect.left + scroll.scrollLeft - offsets.x,
  4529. y: rect.top + scroll.scrollTop - offsets.y,
  4530. width: rect.width,
  4531. height: rect.height
  4532. };
  4533. }
  4534. function order(modifiers) {
  4535. var map = /* @__PURE__ */ new Map();
  4536. var visited = /* @__PURE__ */ new Set();
  4537. var result = [];
  4538. modifiers.forEach(function(modifier) {
  4539. map.set(modifier.name, modifier);
  4540. });
  4541. function sort(modifier) {
  4542. visited.add(modifier.name);
  4543. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  4544. requires.forEach(function(dep) {
  4545. if (!visited.has(dep)) {
  4546. var depModifier = map.get(dep);
  4547. if (depModifier) {
  4548. sort(depModifier);
  4549. }
  4550. }
  4551. });
  4552. result.push(modifier);
  4553. }
  4554. modifiers.forEach(function(modifier) {
  4555. if (!visited.has(modifier.name)) {
  4556. sort(modifier);
  4557. }
  4558. });
  4559. return result;
  4560. }
  4561. function orderModifiers(modifiers) {
  4562. var orderedModifiers = order(modifiers);
  4563. return modifierPhases.reduce(function(acc, phase) {
  4564. return acc.concat(orderedModifiers.filter(function(modifier) {
  4565. return modifier.phase === phase;
  4566. }));
  4567. }, []);
  4568. }
  4569. function debounce$1(fn2) {
  4570. var pending;
  4571. return function() {
  4572. if (!pending) {
  4573. pending = new Promise(function(resolve) {
  4574. Promise.resolve().then(function() {
  4575. pending = void 0;
  4576. resolve(fn2());
  4577. });
  4578. });
  4579. }
  4580. return pending;
  4581. };
  4582. }
  4583. function mergeByName(modifiers) {
  4584. var merged = modifiers.reduce(function(merged2, current) {
  4585. var existing = merged2[current.name];
  4586. merged2[current.name] = existing ? Object.assign({}, existing, current, {
  4587. options: Object.assign({}, existing.options, current.options),
  4588. data: Object.assign({}, existing.data, current.data)
  4589. }) : current;
  4590. return merged2;
  4591. }, {});
  4592. return Object.keys(merged).map(function(key) {
  4593. return merged[key];
  4594. });
  4595. }
  4596. var DEFAULT_OPTIONS = {
  4597. placement: "bottom",
  4598. modifiers: [],
  4599. strategy: "absolute"
  4600. };
  4601. function areValidElements() {
  4602. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  4603. args[_key] = arguments[_key];
  4604. }
  4605. return !args.some(function(element) {
  4606. return !(element && typeof element.getBoundingClientRect === "function");
  4607. });
  4608. }
  4609. function popperGenerator(generatorOptions) {
  4610. if (generatorOptions === void 0) {
  4611. generatorOptions = {};
  4612. }
  4613. 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;
  4614. return function createPopper2(reference2, popper2, options) {
  4615. if (options === void 0) {
  4616. options = defaultOptions;
  4617. }
  4618. var state = {
  4619. placement: "bottom",
  4620. orderedModifiers: [],
  4621. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  4622. modifiersData: {},
  4623. elements: {
  4624. reference: reference2,
  4625. popper: popper2
  4626. },
  4627. attributes: {},
  4628. styles: {}
  4629. };
  4630. var effectCleanupFns = [];
  4631. var isDestroyed = false;
  4632. var instance = {
  4633. state,
  4634. setOptions: function setOptions(setOptionsAction) {
  4635. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  4636. cleanupModifierEffects();
  4637. state.options = Object.assign({}, defaultOptions, state.options, options2);
  4638. state.scrollParents = {
  4639. reference: isElement$1(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
  4640. popper: listScrollParents(popper2)
  4641. };
  4642. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  4643. state.orderedModifiers = orderedModifiers.filter(function(m) {
  4644. return m.enabled;
  4645. });
  4646. runModifierEffects();
  4647. return instance.update();
  4648. },
  4649. // Sync update – it will always be executed, even if not necessary. This
  4650. // is useful for low frequency updates where sync behavior simplifies the
  4651. // logic.
  4652. // For high frequency updates (e.g. `resize` and `scroll` events), always
  4653. // prefer the async Popper#update method
  4654. forceUpdate: function forceUpdate() {
  4655. if (isDestroyed) {
  4656. return;
  4657. }
  4658. var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
  4659. if (!areValidElements(reference3, popper3)) {
  4660. return;
  4661. }
  4662. state.rects = {
  4663. reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
  4664. popper: getLayoutRect(popper3)
  4665. };
  4666. state.reset = false;
  4667. state.placement = state.options.placement;
  4668. state.orderedModifiers.forEach(function(modifier) {
  4669. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  4670. });
  4671. for (var index = 0; index < state.orderedModifiers.length; index++) {
  4672. if (state.reset === true) {
  4673. state.reset = false;
  4674. index = -1;
  4675. continue;
  4676. }
  4677. 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;
  4678. if (typeof fn2 === "function") {
  4679. state = fn2({
  4680. state,
  4681. options: _options,
  4682. name,
  4683. instance
  4684. }) || state;
  4685. }
  4686. }
  4687. },
  4688. // Async and optimistically optimized update – it will not be executed if
  4689. // not necessary (debounced to run at most once-per-tick)
  4690. update: debounce$1(function() {
  4691. return new Promise(function(resolve) {
  4692. instance.forceUpdate();
  4693. resolve(state);
  4694. });
  4695. }),
  4696. destroy: function destroy() {
  4697. cleanupModifierEffects();
  4698. isDestroyed = true;
  4699. }
  4700. };
  4701. if (!areValidElements(reference2, popper2)) {
  4702. return instance;
  4703. }
  4704. instance.setOptions(options).then(function(state2) {
  4705. if (!isDestroyed && options.onFirstUpdate) {
  4706. options.onFirstUpdate(state2);
  4707. }
  4708. });
  4709. function runModifierEffects() {
  4710. state.orderedModifiers.forEach(function(_ref) {
  4711. var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect3 = _ref.effect;
  4712. if (typeof effect3 === "function") {
  4713. var cleanupFn = effect3({
  4714. state,
  4715. name,
  4716. instance,
  4717. options: options2
  4718. });
  4719. var noopFn = function noopFn2() {
  4720. };
  4721. effectCleanupFns.push(cleanupFn || noopFn);
  4722. }
  4723. });
  4724. }
  4725. function cleanupModifierEffects() {
  4726. effectCleanupFns.forEach(function(fn2) {
  4727. return fn2();
  4728. });
  4729. effectCleanupFns = [];
  4730. }
  4731. return instance;
  4732. };
  4733. }
  4734. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  4735. var createPopper = /* @__PURE__ */ popperGenerator({
  4736. defaultModifiers
  4737. });
  4738. var BOX_CLASS = "tippy-box";
  4739. var CONTENT_CLASS = "tippy-content";
  4740. var BACKDROP_CLASS = "tippy-backdrop";
  4741. var ARROW_CLASS = "tippy-arrow";
  4742. var SVG_ARROW_CLASS = "tippy-svg-arrow";
  4743. var TOUCH_OPTIONS = {
  4744. passive: true,
  4745. capture: true
  4746. };
  4747. var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO2() {
  4748. return document.body;
  4749. };
  4750. function getValueAtIndexOrReturn(value, index, defaultValue) {
  4751. if (Array.isArray(value)) {
  4752. var v = value[index];
  4753. return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;
  4754. }
  4755. return value;
  4756. }
  4757. function isType(value, type) {
  4758. var str = {}.toString.call(value);
  4759. return str.indexOf("[object") === 0 && str.indexOf(type + "]") > -1;
  4760. }
  4761. function invokeWithArgsOrReturn(value, args) {
  4762. return typeof value === "function" ? value.apply(void 0, args) : value;
  4763. }
  4764. function debounce(fn5, ms) {
  4765. if (ms === 0) {
  4766. return fn5;
  4767. }
  4768. var timeout;
  4769. return function(arg) {
  4770. clearTimeout(timeout);
  4771. timeout = setTimeout(function() {
  4772. fn5(arg);
  4773. }, ms);
  4774. };
  4775. }
  4776. function splitBySpaces(value) {
  4777. return value.split(/\s+/).filter(Boolean);
  4778. }
  4779. function normalizeToArray(value) {
  4780. return [].concat(value);
  4781. }
  4782. function pushIfUnique(arr, value) {
  4783. if (arr.indexOf(value) === -1) {
  4784. arr.push(value);
  4785. }
  4786. }
  4787. function unique(arr) {
  4788. return arr.filter(function(item, index) {
  4789. return arr.indexOf(item) === index;
  4790. });
  4791. }
  4792. function getBasePlacement(placement) {
  4793. return placement.split("-")[0];
  4794. }
  4795. function arrayFrom(value) {
  4796. return [].slice.call(value);
  4797. }
  4798. function removeUndefinedProps(obj) {
  4799. return Object.keys(obj).reduce(function(acc, key) {
  4800. if (obj[key] !== void 0) {
  4801. acc[key] = obj[key];
  4802. }
  4803. return acc;
  4804. }, {});
  4805. }
  4806. function div() {
  4807. return document.createElement("div");
  4808. }
  4809. function isElement(value) {
  4810. return ["Element", "Fragment"].some(function(type) {
  4811. return isType(value, type);
  4812. });
  4813. }
  4814. function isNodeList(value) {
  4815. return isType(value, "NodeList");
  4816. }
  4817. function isMouseEvent(value) {
  4818. return isType(value, "MouseEvent");
  4819. }
  4820. function isReferenceElement(value) {
  4821. return !!(value && value._tippy && value._tippy.reference === value);
  4822. }
  4823. function getArrayOfElements(value) {
  4824. if (isElement(value)) {
  4825. return [value];
  4826. }
  4827. if (isNodeList(value)) {
  4828. return arrayFrom(value);
  4829. }
  4830. if (Array.isArray(value)) {
  4831. return value;
  4832. }
  4833. return arrayFrom(document.querySelectorAll(value));
  4834. }
  4835. function setTransitionDuration(els, value) {
  4836. els.forEach(function(el) {
  4837. if (el) {
  4838. el.style.transitionDuration = value + "ms";
  4839. }
  4840. });
  4841. }
  4842. function setVisibilityState(els, state) {
  4843. els.forEach(function(el) {
  4844. if (el) {
  4845. el.setAttribute("data-state", state);
  4846. }
  4847. });
  4848. }
  4849. function getOwnerDocument(elementOrElements) {
  4850. var _element$ownerDocumen;
  4851. var _normalizeToArray = normalizeToArray(elementOrElements), element = _normalizeToArray[0];
  4852. return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
  4853. }
  4854. function isCursorOutsideInteractiveBorder(popperTreeData, event) {
  4855. var clientX = event.clientX, clientY = event.clientY;
  4856. return popperTreeData.every(function(_ref) {
  4857. var popperRect = _ref.popperRect, popperState = _ref.popperState, props = _ref.props;
  4858. var interactiveBorder = props.interactiveBorder;
  4859. var basePlacement = getBasePlacement(popperState.placement);
  4860. var offsetData = popperState.modifiersData.offset;
  4861. if (!offsetData) {
  4862. return true;
  4863. }
  4864. var topDistance = basePlacement === "bottom" ? offsetData.top.y : 0;
  4865. var bottomDistance = basePlacement === "top" ? offsetData.bottom.y : 0;
  4866. var leftDistance = basePlacement === "right" ? offsetData.left.x : 0;
  4867. var rightDistance = basePlacement === "left" ? offsetData.right.x : 0;
  4868. var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder;
  4869. var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder;
  4870. var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder;
  4871. var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder;
  4872. return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
  4873. });
  4874. }
  4875. function updateTransitionEndListener(box, action, listener) {
  4876. var method = action + "EventListener";
  4877. ["transitionend", "webkitTransitionEnd"].forEach(function(event) {
  4878. box[method](event, listener);
  4879. });
  4880. }
  4881. function actualContains(parent, child) {
  4882. var target = child;
  4883. while (target) {
  4884. var _target$getRootNode;
  4885. if (parent.contains(target)) {
  4886. return true;
  4887. }
  4888. target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
  4889. }
  4890. return false;
  4891. }
  4892. var currentInput = {
  4893. isTouch: false
  4894. };
  4895. var lastMouseMoveTime = 0;
  4896. function onDocumentTouchStart() {
  4897. if (currentInput.isTouch) {
  4898. return;
  4899. }
  4900. currentInput.isTouch = true;
  4901. if (window.performance) {
  4902. document.addEventListener("mousemove", onDocumentMouseMove);
  4903. }
  4904. }
  4905. function onDocumentMouseMove() {
  4906. var now = performance.now();
  4907. if (now - lastMouseMoveTime < 20) {
  4908. currentInput.isTouch = false;
  4909. document.removeEventListener("mousemove", onDocumentMouseMove);
  4910. }
  4911. lastMouseMoveTime = now;
  4912. }
  4913. function onWindowBlur() {
  4914. var activeElement = document.activeElement;
  4915. if (isReferenceElement(activeElement)) {
  4916. var instance = activeElement._tippy;
  4917. if (activeElement.blur && !instance.state.isVisible) {
  4918. activeElement.blur();
  4919. }
  4920. }
  4921. }
  4922. function bindGlobalEventListeners() {
  4923. document.addEventListener("touchstart", onDocumentTouchStart, TOUCH_OPTIONS);
  4924. window.addEventListener("blur", onWindowBlur);
  4925. }
  4926. var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
  4927. var isIE11 = isBrowser ? (
  4928. // @ts-ignore
  4929. !!window.msCrypto
  4930. ) : false;
  4931. var pluginProps = {
  4932. animateFill: false,
  4933. followCursor: false,
  4934. inlinePositioning: false,
  4935. sticky: false
  4936. };
  4937. var renderProps = {
  4938. allowHTML: false,
  4939. animation: "fade",
  4940. arrow: true,
  4941. content: "",
  4942. inertia: false,
  4943. maxWidth: 350,
  4944. role: "tooltip",
  4945. theme: "",
  4946. zIndex: 9999
  4947. };
  4948. var defaultProps = Object.assign({
  4949. appendTo: TIPPY_DEFAULT_APPEND_TO,
  4950. aria: {
  4951. content: "auto",
  4952. expanded: "auto"
  4953. },
  4954. delay: 0,
  4955. duration: [300, 250],
  4956. getReferenceClientRect: null,
  4957. hideOnClick: true,
  4958. ignoreAttributes: false,
  4959. interactive: false,
  4960. interactiveBorder: 2,
  4961. interactiveDebounce: 0,
  4962. moveTransition: "",
  4963. offset: [0, 10],
  4964. onAfterUpdate: function onAfterUpdate() {
  4965. },
  4966. onBeforeUpdate: function onBeforeUpdate() {
  4967. },
  4968. onCreate: function onCreate() {
  4969. },
  4970. onDestroy: function onDestroy() {
  4971. },
  4972. onHidden: function onHidden() {
  4973. },
  4974. onHide: function onHide() {
  4975. },
  4976. onMount: function onMount() {
  4977. },
  4978. onShow: function onShow() {
  4979. },
  4980. onShown: function onShown() {
  4981. },
  4982. onTrigger: function onTrigger() {
  4983. },
  4984. onUntrigger: function onUntrigger() {
  4985. },
  4986. onClickOutside: function onClickOutside() {
  4987. },
  4988. placement: "top",
  4989. plugins: [],
  4990. popperOptions: {},
  4991. render: null,
  4992. showOnCreate: false,
  4993. touch: true,
  4994. trigger: "mouseenter focus",
  4995. triggerTarget: null
  4996. }, pluginProps, renderProps);
  4997. var defaultKeys = Object.keys(defaultProps);
  4998. var setDefaultProps = function setDefaultProps2(partialProps) {
  4999. var keys = Object.keys(partialProps);
  5000. keys.forEach(function(key) {
  5001. defaultProps[key] = partialProps[key];
  5002. });
  5003. };
  5004. function getExtendedPassedProps(passedProps) {
  5005. var plugins = passedProps.plugins || [];
  5006. var pluginProps2 = plugins.reduce(function(acc, plugin) {
  5007. var name = plugin.name, defaultValue = plugin.defaultValue;
  5008. if (name) {
  5009. var _name;
  5010. acc[name] = passedProps[name] !== void 0 ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
  5011. }
  5012. return acc;
  5013. }, {});
  5014. return Object.assign({}, passedProps, pluginProps2);
  5015. }
  5016. function getDataAttributeProps(reference2, plugins) {
  5017. var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
  5018. plugins
  5019. }))) : defaultKeys;
  5020. var props = propKeys.reduce(function(acc, key) {
  5021. var valueAsString = (reference2.getAttribute("data-tippy-" + key) || "").trim();
  5022. if (!valueAsString) {
  5023. return acc;
  5024. }
  5025. if (key === "content") {
  5026. acc[key] = valueAsString;
  5027. } else {
  5028. try {
  5029. acc[key] = JSON.parse(valueAsString);
  5030. } catch (e) {
  5031. acc[key] = valueAsString;
  5032. }
  5033. }
  5034. return acc;
  5035. }, {});
  5036. return props;
  5037. }
  5038. function evaluateProps(reference2, props) {
  5039. var out = Object.assign({}, props, {
  5040. content: invokeWithArgsOrReturn(props.content, [reference2])
  5041. }, props.ignoreAttributes ? {} : getDataAttributeProps(reference2, props.plugins));
  5042. out.aria = Object.assign({}, defaultProps.aria, out.aria);
  5043. out.aria = {
  5044. expanded: out.aria.expanded === "auto" ? props.interactive : out.aria.expanded,
  5045. content: out.aria.content === "auto" ? props.interactive ? null : "describedby" : out.aria.content
  5046. };
  5047. return out;
  5048. }
  5049. var innerHTML = function innerHTML2() {
  5050. return "innerHTML";
  5051. };
  5052. function dangerouslySetInnerHTML(element, html) {
  5053. element[innerHTML()] = html;
  5054. }
  5055. function createArrowElement(value) {
  5056. var arrow2 = div();
  5057. if (value === true) {
  5058. arrow2.className = ARROW_CLASS;
  5059. } else {
  5060. arrow2.className = SVG_ARROW_CLASS;
  5061. if (isElement(value)) {
  5062. arrow2.appendChild(value);
  5063. } else {
  5064. dangerouslySetInnerHTML(arrow2, value);
  5065. }
  5066. }
  5067. return arrow2;
  5068. }
  5069. function setContent(content, props) {
  5070. if (isElement(props.content)) {
  5071. dangerouslySetInnerHTML(content, "");
  5072. content.appendChild(props.content);
  5073. } else if (typeof props.content !== "function") {
  5074. if (props.allowHTML) {
  5075. dangerouslySetInnerHTML(content, props.content);
  5076. } else {
  5077. content.textContent = props.content;
  5078. }
  5079. }
  5080. }
  5081. function getChildren(popper2) {
  5082. var box = popper2.firstElementChild;
  5083. var boxChildren = arrayFrom(box.children);
  5084. return {
  5085. box,
  5086. content: boxChildren.find(function(node) {
  5087. return node.classList.contains(CONTENT_CLASS);
  5088. }),
  5089. arrow: boxChildren.find(function(node) {
  5090. return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS);
  5091. }),
  5092. backdrop: boxChildren.find(function(node) {
  5093. return node.classList.contains(BACKDROP_CLASS);
  5094. })
  5095. };
  5096. }
  5097. function render(instance) {
  5098. var popper2 = div();
  5099. var box = div();
  5100. box.className = BOX_CLASS;
  5101. box.setAttribute("data-state", "hidden");
  5102. box.setAttribute("tabindex", "-1");
  5103. var content = div();
  5104. content.className = CONTENT_CLASS;
  5105. content.setAttribute("data-state", "hidden");
  5106. setContent(content, instance.props);
  5107. popper2.appendChild(box);
  5108. box.appendChild(content);
  5109. onUpdate(instance.props, instance.props);
  5110. function onUpdate(prevProps, nextProps) {
  5111. var _getChildren = getChildren(popper2), box2 = _getChildren.box, content2 = _getChildren.content, arrow2 = _getChildren.arrow;
  5112. if (nextProps.theme) {
  5113. box2.setAttribute("data-theme", nextProps.theme);
  5114. } else {
  5115. box2.removeAttribute("data-theme");
  5116. }
  5117. if (typeof nextProps.animation === "string") {
  5118. box2.setAttribute("data-animation", nextProps.animation);
  5119. } else {
  5120. box2.removeAttribute("data-animation");
  5121. }
  5122. if (nextProps.inertia) {
  5123. box2.setAttribute("data-inertia", "");
  5124. } else {
  5125. box2.removeAttribute("data-inertia");
  5126. }
  5127. box2.style.maxWidth = typeof nextProps.maxWidth === "number" ? nextProps.maxWidth + "px" : nextProps.maxWidth;
  5128. if (nextProps.role) {
  5129. box2.setAttribute("role", nextProps.role);
  5130. } else {
  5131. box2.removeAttribute("role");
  5132. }
  5133. if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) {
  5134. setContent(content2, instance.props);
  5135. }
  5136. if (nextProps.arrow) {
  5137. if (!arrow2) {
  5138. box2.appendChild(createArrowElement(nextProps.arrow));
  5139. } else if (prevProps.arrow !== nextProps.arrow) {
  5140. box2.removeChild(arrow2);
  5141. box2.appendChild(createArrowElement(nextProps.arrow));
  5142. }
  5143. } else if (arrow2) {
  5144. box2.removeChild(arrow2);
  5145. }
  5146. }
  5147. return {
  5148. popper: popper2,
  5149. onUpdate
  5150. };
  5151. }
  5152. render.$$tippy = true;
  5153. var idCounter = 1;
  5154. var mouseMoveListeners = [];
  5155. var mountedInstances = [];
  5156. function createTippy(reference2, passedProps) {
  5157. var props = evaluateProps(reference2, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps))));
  5158. var showTimeout;
  5159. var hideTimeout;
  5160. var scheduleHideAnimationFrame;
  5161. var isVisibleFromClick = false;
  5162. var didHideDueToDocumentMouseDown = false;
  5163. var didTouchMove = false;
  5164. var ignoreOnFirstUpdate = false;
  5165. var lastTriggerEvent;
  5166. var currentTransitionEndListener;
  5167. var onFirstUpdate;
  5168. var listeners = [];
  5169. var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
  5170. var currentTarget;
  5171. var id = idCounter++;
  5172. var popperInstance = null;
  5173. var plugins = unique(props.plugins);
  5174. var state = {
  5175. // Is the instance currently enabled?
  5176. isEnabled: true,
  5177. // Is the tippy currently showing and not transitioning out?
  5178. isVisible: false,
  5179. // Has the instance been destroyed?
  5180. isDestroyed: false,
  5181. // Is the tippy currently mounted to the DOM?
  5182. isMounted: false,
  5183. // Has the tippy finished transitioning in?
  5184. isShown: false
  5185. };
  5186. var instance = {
  5187. // properties
  5188. id,
  5189. reference: reference2,
  5190. popper: div(),
  5191. popperInstance,
  5192. props,
  5193. state,
  5194. plugins,
  5195. // methods
  5196. clearDelayTimeouts,
  5197. setProps,
  5198. setContent: setContent2,
  5199. show,
  5200. hide: hide2,
  5201. hideWithInteractivity,
  5202. enable,
  5203. disable,
  5204. unmount,
  5205. destroy
  5206. };
  5207. if (!props.render) {
  5208. return instance;
  5209. }
  5210. var _props$render = props.render(instance), popper2 = _props$render.popper, onUpdate = _props$render.onUpdate;
  5211. popper2.setAttribute("data-tippy-root", "");
  5212. popper2.id = "tippy-" + instance.id;
  5213. instance.popper = popper2;
  5214. reference2._tippy = instance;
  5215. popper2._tippy = instance;
  5216. var pluginsHooks = plugins.map(function(plugin) {
  5217. return plugin.fn(instance);
  5218. });
  5219. var hasAriaExpanded = reference2.hasAttribute("aria-expanded");
  5220. addListeners();
  5221. handleAriaExpandedAttribute();
  5222. handleStyles();
  5223. invokeHook("onCreate", [instance]);
  5224. if (props.showOnCreate) {
  5225. scheduleShow();
  5226. }
  5227. popper2.addEventListener("mouseenter", function() {
  5228. if (instance.props.interactive && instance.state.isVisible) {
  5229. instance.clearDelayTimeouts();
  5230. }
  5231. });
  5232. popper2.addEventListener("mouseleave", function() {
  5233. if (instance.props.interactive && instance.props.trigger.indexOf("mouseenter") >= 0) {
  5234. getDocument().addEventListener("mousemove", debouncedOnMouseMove);
  5235. }
  5236. });
  5237. return instance;
  5238. function getNormalizedTouchSettings() {
  5239. var touch = instance.props.touch;
  5240. return Array.isArray(touch) ? touch : [touch, 0];
  5241. }
  5242. function getIsCustomTouchBehavior() {
  5243. return getNormalizedTouchSettings()[0] === "hold";
  5244. }
  5245. function getIsDefaultRenderFn() {
  5246. var _instance$props$rende;
  5247. return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
  5248. }
  5249. function getCurrentTarget() {
  5250. return currentTarget || reference2;
  5251. }
  5252. function getDocument() {
  5253. var parent = getCurrentTarget().parentNode;
  5254. return parent ? getOwnerDocument(parent) : document;
  5255. }
  5256. function getDefaultTemplateChildren() {
  5257. return getChildren(popper2);
  5258. }
  5259. function getDelay(isShow) {
  5260. if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === "focus") {
  5261. return 0;
  5262. }
  5263. return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
  5264. }
  5265. function handleStyles(fromHide) {
  5266. if (fromHide === void 0) {
  5267. fromHide = false;
  5268. }
  5269. popper2.style.pointerEvents = instance.props.interactive && !fromHide ? "" : "none";
  5270. popper2.style.zIndex = "" + instance.props.zIndex;
  5271. }
  5272. function invokeHook(hook, args, shouldInvokePropsHook) {
  5273. if (shouldInvokePropsHook === void 0) {
  5274. shouldInvokePropsHook = true;
  5275. }
  5276. pluginsHooks.forEach(function(pluginHooks) {
  5277. if (pluginHooks[hook]) {
  5278. pluginHooks[hook].apply(pluginHooks, args);
  5279. }
  5280. });
  5281. if (shouldInvokePropsHook) {
  5282. var _instance$props;
  5283. (_instance$props = instance.props)[hook].apply(_instance$props, args);
  5284. }
  5285. }
  5286. function handleAriaContentAttribute() {
  5287. var aria = instance.props.aria;
  5288. if (!aria.content) {
  5289. return;
  5290. }
  5291. var attr = "aria-" + aria.content;
  5292. var id2 = popper2.id;
  5293. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  5294. nodes.forEach(function(node) {
  5295. var currentValue = node.getAttribute(attr);
  5296. if (instance.state.isVisible) {
  5297. node.setAttribute(attr, currentValue ? currentValue + " " + id2 : id2);
  5298. } else {
  5299. var nextValue = currentValue && currentValue.replace(id2, "").trim();
  5300. if (nextValue) {
  5301. node.setAttribute(attr, nextValue);
  5302. } else {
  5303. node.removeAttribute(attr);
  5304. }
  5305. }
  5306. });
  5307. }
  5308. function handleAriaExpandedAttribute() {
  5309. if (hasAriaExpanded || !instance.props.aria.expanded) {
  5310. return;
  5311. }
  5312. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  5313. nodes.forEach(function(node) {
  5314. if (instance.props.interactive) {
  5315. node.setAttribute("aria-expanded", instance.state.isVisible && node === getCurrentTarget() ? "true" : "false");
  5316. } else {
  5317. node.removeAttribute("aria-expanded");
  5318. }
  5319. });
  5320. }
  5321. function cleanupInteractiveMouseListeners() {
  5322. getDocument().removeEventListener("mousemove", debouncedOnMouseMove);
  5323. mouseMoveListeners = mouseMoveListeners.filter(function(listener) {
  5324. return listener !== debouncedOnMouseMove;
  5325. });
  5326. }
  5327. function onDocumentPress(event) {
  5328. if (currentInput.isTouch) {
  5329. if (didTouchMove || event.type === "mousedown") {
  5330. return;
  5331. }
  5332. }
  5333. var actualTarget = event.composedPath && event.composedPath()[0] || event.target;
  5334. if (instance.props.interactive && actualContains(popper2, actualTarget)) {
  5335. return;
  5336. }
  5337. if (normalizeToArray(instance.props.triggerTarget || reference2).some(function(el) {
  5338. return actualContains(el, actualTarget);
  5339. })) {
  5340. if (currentInput.isTouch) {
  5341. return;
  5342. }
  5343. if (instance.state.isVisible && instance.props.trigger.indexOf("click") >= 0) {
  5344. return;
  5345. }
  5346. } else {
  5347. invokeHook("onClickOutside", [instance, event]);
  5348. }
  5349. if (instance.props.hideOnClick === true) {
  5350. instance.clearDelayTimeouts();
  5351. instance.hide();
  5352. didHideDueToDocumentMouseDown = true;
  5353. setTimeout(function() {
  5354. didHideDueToDocumentMouseDown = false;
  5355. });
  5356. if (!instance.state.isMounted) {
  5357. removeDocumentPress();
  5358. }
  5359. }
  5360. }
  5361. function onTouchMove() {
  5362. didTouchMove = true;
  5363. }
  5364. function onTouchStart() {
  5365. didTouchMove = false;
  5366. }
  5367. function addDocumentPress() {
  5368. var doc = getDocument();
  5369. doc.addEventListener("mousedown", onDocumentPress, true);
  5370. doc.addEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
  5371. doc.addEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
  5372. doc.addEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
  5373. }
  5374. function removeDocumentPress() {
  5375. var doc = getDocument();
  5376. doc.removeEventListener("mousedown", onDocumentPress, true);
  5377. doc.removeEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
  5378. doc.removeEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
  5379. doc.removeEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
  5380. }
  5381. function onTransitionedOut(duration, callback) {
  5382. onTransitionEnd(duration, function() {
  5383. if (!instance.state.isVisible && popper2.parentNode && popper2.parentNode.contains(popper2)) {
  5384. callback();
  5385. }
  5386. });
  5387. }
  5388. function onTransitionedIn(duration, callback) {
  5389. onTransitionEnd(duration, callback);
  5390. }
  5391. function onTransitionEnd(duration, callback) {
  5392. var box = getDefaultTemplateChildren().box;
  5393. function listener(event) {
  5394. if (event.target === box) {
  5395. updateTransitionEndListener(box, "remove", listener);
  5396. callback();
  5397. }
  5398. }
  5399. if (duration === 0) {
  5400. return callback();
  5401. }
  5402. updateTransitionEndListener(box, "remove", currentTransitionEndListener);
  5403. updateTransitionEndListener(box, "add", listener);
  5404. currentTransitionEndListener = listener;
  5405. }
  5406. function on(eventType, handler, options) {
  5407. if (options === void 0) {
  5408. options = false;
  5409. }
  5410. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  5411. nodes.forEach(function(node) {
  5412. node.addEventListener(eventType, handler, options);
  5413. listeners.push({
  5414. node,
  5415. eventType,
  5416. handler,
  5417. options
  5418. });
  5419. });
  5420. }
  5421. function addListeners() {
  5422. if (getIsCustomTouchBehavior()) {
  5423. on("touchstart", onTrigger2, {
  5424. passive: true
  5425. });
  5426. on("touchend", onMouseLeave, {
  5427. passive: true
  5428. });
  5429. }
  5430. splitBySpaces(instance.props.trigger).forEach(function(eventType) {
  5431. if (eventType === "manual") {
  5432. return;
  5433. }
  5434. on(eventType, onTrigger2);
  5435. switch (eventType) {
  5436. case "mouseenter":
  5437. on("mouseleave", onMouseLeave);
  5438. break;
  5439. case "focus":
  5440. on(isIE11 ? "focusout" : "blur", onBlurOrFocusOut);
  5441. break;
  5442. case "focusin":
  5443. on("focusout", onBlurOrFocusOut);
  5444. break;
  5445. }
  5446. });
  5447. }
  5448. function removeListeners() {
  5449. listeners.forEach(function(_ref) {
  5450. var node = _ref.node, eventType = _ref.eventType, handler = _ref.handler, options = _ref.options;
  5451. node.removeEventListener(eventType, handler, options);
  5452. });
  5453. listeners = [];
  5454. }
  5455. function onTrigger2(event) {
  5456. var _lastTriggerEvent;
  5457. var shouldScheduleClickHide = false;
  5458. if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
  5459. return;
  5460. }
  5461. var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === "focus";
  5462. lastTriggerEvent = event;
  5463. currentTarget = event.currentTarget;
  5464. handleAriaExpandedAttribute();
  5465. if (!instance.state.isVisible && isMouseEvent(event)) {
  5466. mouseMoveListeners.forEach(function(listener) {
  5467. return listener(event);
  5468. });
  5469. }
  5470. if (event.type === "click" && (instance.props.trigger.indexOf("mouseenter") < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
  5471. shouldScheduleClickHide = true;
  5472. } else {
  5473. scheduleShow(event);
  5474. }
  5475. if (event.type === "click") {
  5476. isVisibleFromClick = !shouldScheduleClickHide;
  5477. }
  5478. if (shouldScheduleClickHide && !wasFocused) {
  5479. scheduleHide(event);
  5480. }
  5481. }
  5482. function onMouseMove(event) {
  5483. var target = event.target;
  5484. var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper2.contains(target);
  5485. if (event.type === "mousemove" && isCursorOverReferenceOrPopper) {
  5486. return;
  5487. }
  5488. var popperTreeData = getNestedPopperTree().concat(popper2).map(function(popper22) {
  5489. var _instance$popperInsta;
  5490. var instance2 = popper22._tippy;
  5491. var state2 = (_instance$popperInsta = instance2.popperInstance) == null ? void 0 : _instance$popperInsta.state;
  5492. if (state2) {
  5493. return {
  5494. popperRect: popper22.getBoundingClientRect(),
  5495. popperState: state2,
  5496. props
  5497. };
  5498. }
  5499. return null;
  5500. }).filter(Boolean);
  5501. if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
  5502. cleanupInteractiveMouseListeners();
  5503. scheduleHide(event);
  5504. }
  5505. }
  5506. function onMouseLeave(event) {
  5507. var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf("click") >= 0 && isVisibleFromClick;
  5508. if (shouldBail) {
  5509. return;
  5510. }
  5511. if (instance.props.interactive) {
  5512. instance.hideWithInteractivity(event);
  5513. return;
  5514. }
  5515. scheduleHide(event);
  5516. }
  5517. function onBlurOrFocusOut(event) {
  5518. if (instance.props.trigger.indexOf("focusin") < 0 && event.target !== getCurrentTarget()) {
  5519. return;
  5520. }
  5521. if (instance.props.interactive && event.relatedTarget && popper2.contains(event.relatedTarget)) {
  5522. return;
  5523. }
  5524. scheduleHide(event);
  5525. }
  5526. function isEventListenerStopped(event) {
  5527. return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf("touch") >= 0 : false;
  5528. }
  5529. function createPopperInstance() {
  5530. destroyPopperInstance();
  5531. 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;
  5532. var arrow2 = getIsDefaultRenderFn() ? getChildren(popper2).arrow : null;
  5533. var computedReference = getReferenceClientRect ? {
  5534. getBoundingClientRect: getReferenceClientRect,
  5535. contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
  5536. } : reference2;
  5537. var tippyModifier = {
  5538. name: "$$tippy",
  5539. enabled: true,
  5540. phase: "beforeWrite",
  5541. requires: ["computeStyles"],
  5542. fn: function fn5(_ref2) {
  5543. var state2 = _ref2.state;
  5544. if (getIsDefaultRenderFn()) {
  5545. var _getDefaultTemplateCh = getDefaultTemplateChildren(), box = _getDefaultTemplateCh.box;
  5546. ["placement", "reference-hidden", "escaped"].forEach(function(attr) {
  5547. if (attr === "placement") {
  5548. box.setAttribute("data-placement", state2.placement);
  5549. } else {
  5550. if (state2.attributes.popper["data-popper-" + attr]) {
  5551. box.setAttribute("data-" + attr, "");
  5552. } else {
  5553. box.removeAttribute("data-" + attr);
  5554. }
  5555. }
  5556. });
  5557. state2.attributes.popper = {};
  5558. }
  5559. }
  5560. };
  5561. var modifiers = [{
  5562. name: "offset",
  5563. options: {
  5564. offset: offset2
  5565. }
  5566. }, {
  5567. name: "preventOverflow",
  5568. options: {
  5569. padding: {
  5570. top: 2,
  5571. bottom: 2,
  5572. left: 5,
  5573. right: 5
  5574. }
  5575. }
  5576. }, {
  5577. name: "flip",
  5578. options: {
  5579. padding: 5
  5580. }
  5581. }, {
  5582. name: "computeStyles",
  5583. options: {
  5584. adaptive: !moveTransition
  5585. }
  5586. }, tippyModifier];
  5587. if (getIsDefaultRenderFn() && arrow2) {
  5588. modifiers.push({
  5589. name: "arrow",
  5590. options: {
  5591. element: arrow2,
  5592. padding: 3
  5593. }
  5594. });
  5595. }
  5596. modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
  5597. instance.popperInstance = createPopper(computedReference, popper2, Object.assign({}, popperOptions, {
  5598. placement,
  5599. onFirstUpdate,
  5600. modifiers
  5601. }));
  5602. }
  5603. function destroyPopperInstance() {
  5604. if (instance.popperInstance) {
  5605. instance.popperInstance.destroy();
  5606. instance.popperInstance = null;
  5607. }
  5608. }
  5609. function mount() {
  5610. var appendTo = instance.props.appendTo;
  5611. var parentNode;
  5612. var node = getCurrentTarget();
  5613. if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === "parent") {
  5614. parentNode = node.parentNode;
  5615. } else {
  5616. parentNode = invokeWithArgsOrReturn(appendTo, [node]);
  5617. }
  5618. if (!parentNode.contains(popper2)) {
  5619. parentNode.appendChild(popper2);
  5620. }
  5621. instance.state.isMounted = true;
  5622. createPopperInstance();
  5623. }
  5624. function getNestedPopperTree() {
  5625. return arrayFrom(popper2.querySelectorAll("[data-tippy-root]"));
  5626. }
  5627. function scheduleShow(event) {
  5628. instance.clearDelayTimeouts();
  5629. if (event) {
  5630. invokeHook("onTrigger", [instance, event]);
  5631. }
  5632. addDocumentPress();
  5633. var delay = getDelay(true);
  5634. var _getNormalizedTouchSe = getNormalizedTouchSettings(), touchValue = _getNormalizedTouchSe[0], touchDelay = _getNormalizedTouchSe[1];
  5635. if (currentInput.isTouch && touchValue === "hold" && touchDelay) {
  5636. delay = touchDelay;
  5637. }
  5638. if (delay) {
  5639. showTimeout = setTimeout(function() {
  5640. instance.show();
  5641. }, delay);
  5642. } else {
  5643. instance.show();
  5644. }
  5645. }
  5646. function scheduleHide(event) {
  5647. instance.clearDelayTimeouts();
  5648. invokeHook("onUntrigger", [instance, event]);
  5649. if (!instance.state.isVisible) {
  5650. removeDocumentPress();
  5651. return;
  5652. }
  5653. if (instance.props.trigger.indexOf("mouseenter") >= 0 && instance.props.trigger.indexOf("click") >= 0 && ["mouseleave", "mousemove"].indexOf(event.type) >= 0 && isVisibleFromClick) {
  5654. return;
  5655. }
  5656. var delay = getDelay(false);
  5657. if (delay) {
  5658. hideTimeout = setTimeout(function() {
  5659. if (instance.state.isVisible) {
  5660. instance.hide();
  5661. }
  5662. }, delay);
  5663. } else {
  5664. scheduleHideAnimationFrame = requestAnimationFrame(function() {
  5665. instance.hide();
  5666. });
  5667. }
  5668. }
  5669. function enable() {
  5670. instance.state.isEnabled = true;
  5671. }
  5672. function disable() {
  5673. instance.hide();
  5674. instance.state.isEnabled = false;
  5675. }
  5676. function clearDelayTimeouts() {
  5677. clearTimeout(showTimeout);
  5678. clearTimeout(hideTimeout);
  5679. cancelAnimationFrame(scheduleHideAnimationFrame);
  5680. }
  5681. function setProps(partialProps) {
  5682. if (instance.state.isDestroyed) {
  5683. return;
  5684. }
  5685. invokeHook("onBeforeUpdate", [instance, partialProps]);
  5686. removeListeners();
  5687. var prevProps = instance.props;
  5688. var nextProps = evaluateProps(reference2, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
  5689. ignoreAttributes: true
  5690. }));
  5691. instance.props = nextProps;
  5692. addListeners();
  5693. if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
  5694. cleanupInteractiveMouseListeners();
  5695. debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
  5696. }
  5697. if (prevProps.triggerTarget && !nextProps.triggerTarget) {
  5698. normalizeToArray(prevProps.triggerTarget).forEach(function(node) {
  5699. node.removeAttribute("aria-expanded");
  5700. });
  5701. } else if (nextProps.triggerTarget) {
  5702. reference2.removeAttribute("aria-expanded");
  5703. }
  5704. handleAriaExpandedAttribute();
  5705. handleStyles();
  5706. if (onUpdate) {
  5707. onUpdate(prevProps, nextProps);
  5708. }
  5709. if (instance.popperInstance) {
  5710. createPopperInstance();
  5711. getNestedPopperTree().forEach(function(nestedPopper) {
  5712. requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
  5713. });
  5714. }
  5715. invokeHook("onAfterUpdate", [instance, partialProps]);
  5716. }
  5717. function setContent2(content) {
  5718. instance.setProps({
  5719. content
  5720. });
  5721. }
  5722. function show() {
  5723. var isAlreadyVisible = instance.state.isVisible;
  5724. var isDestroyed = instance.state.isDestroyed;
  5725. var isDisabled = !instance.state.isEnabled;
  5726. var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
  5727. var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
  5728. if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
  5729. return;
  5730. }
  5731. if (getCurrentTarget().hasAttribute("disabled")) {
  5732. return;
  5733. }
  5734. invokeHook("onShow", [instance], false);
  5735. if (instance.props.onShow(instance) === false) {
  5736. return;
  5737. }
  5738. instance.state.isVisible = true;
  5739. if (getIsDefaultRenderFn()) {
  5740. popper2.style.visibility = "visible";
  5741. }
  5742. handleStyles();
  5743. addDocumentPress();
  5744. if (!instance.state.isMounted) {
  5745. popper2.style.transition = "none";
  5746. }
  5747. if (getIsDefaultRenderFn()) {
  5748. var _getDefaultTemplateCh2 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh2.box, content = _getDefaultTemplateCh2.content;
  5749. setTransitionDuration([box, content], 0);
  5750. }
  5751. onFirstUpdate = function onFirstUpdate2() {
  5752. var _instance$popperInsta2;
  5753. if (!instance.state.isVisible || ignoreOnFirstUpdate) {
  5754. return;
  5755. }
  5756. ignoreOnFirstUpdate = true;
  5757. void popper2.offsetHeight;
  5758. popper2.style.transition = instance.props.moveTransition;
  5759. if (getIsDefaultRenderFn() && instance.props.animation) {
  5760. var _getDefaultTemplateCh3 = getDefaultTemplateChildren(), _box = _getDefaultTemplateCh3.box, _content = _getDefaultTemplateCh3.content;
  5761. setTransitionDuration([_box, _content], duration);
  5762. setVisibilityState([_box, _content], "visible");
  5763. }
  5764. handleAriaContentAttribute();
  5765. handleAriaExpandedAttribute();
  5766. pushIfUnique(mountedInstances, instance);
  5767. (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
  5768. invokeHook("onMount", [instance]);
  5769. if (instance.props.animation && getIsDefaultRenderFn()) {
  5770. onTransitionedIn(duration, function() {
  5771. instance.state.isShown = true;
  5772. invokeHook("onShown", [instance]);
  5773. });
  5774. }
  5775. };
  5776. mount();
  5777. }
  5778. function hide2() {
  5779. var isAlreadyHidden = !instance.state.isVisible;
  5780. var isDestroyed = instance.state.isDestroyed;
  5781. var isDisabled = !instance.state.isEnabled;
  5782. var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
  5783. if (isAlreadyHidden || isDestroyed || isDisabled) {
  5784. return;
  5785. }
  5786. invokeHook("onHide", [instance], false);
  5787. if (instance.props.onHide(instance) === false) {
  5788. return;
  5789. }
  5790. instance.state.isVisible = false;
  5791. instance.state.isShown = false;
  5792. ignoreOnFirstUpdate = false;
  5793. isVisibleFromClick = false;
  5794. if (getIsDefaultRenderFn()) {
  5795. popper2.style.visibility = "hidden";
  5796. }
  5797. cleanupInteractiveMouseListeners();
  5798. removeDocumentPress();
  5799. handleStyles(true);
  5800. if (getIsDefaultRenderFn()) {
  5801. var _getDefaultTemplateCh4 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh4.box, content = _getDefaultTemplateCh4.content;
  5802. if (instance.props.animation) {
  5803. setTransitionDuration([box, content], duration);
  5804. setVisibilityState([box, content], "hidden");
  5805. }
  5806. }
  5807. handleAriaContentAttribute();
  5808. handleAriaExpandedAttribute();
  5809. if (instance.props.animation) {
  5810. if (getIsDefaultRenderFn()) {
  5811. onTransitionedOut(duration, instance.unmount);
  5812. }
  5813. } else {
  5814. instance.unmount();
  5815. }
  5816. }
  5817. function hideWithInteractivity(event) {
  5818. getDocument().addEventListener("mousemove", debouncedOnMouseMove);
  5819. pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
  5820. debouncedOnMouseMove(event);
  5821. }
  5822. function unmount() {
  5823. if (instance.state.isVisible) {
  5824. instance.hide();
  5825. }
  5826. if (!instance.state.isMounted) {
  5827. return;
  5828. }
  5829. destroyPopperInstance();
  5830. getNestedPopperTree().forEach(function(nestedPopper) {
  5831. nestedPopper._tippy.unmount();
  5832. });
  5833. if (popper2.parentNode) {
  5834. popper2.parentNode.removeChild(popper2);
  5835. }
  5836. mountedInstances = mountedInstances.filter(function(i) {
  5837. return i !== instance;
  5838. });
  5839. instance.state.isMounted = false;
  5840. invokeHook("onHidden", [instance]);
  5841. }
  5842. function destroy() {
  5843. if (instance.state.isDestroyed) {
  5844. return;
  5845. }
  5846. instance.clearDelayTimeouts();
  5847. instance.unmount();
  5848. removeListeners();
  5849. delete reference2._tippy;
  5850. instance.state.isDestroyed = true;
  5851. invokeHook("onDestroy", [instance]);
  5852. }
  5853. }
  5854. function tippy(targets, optionalProps) {
  5855. if (optionalProps === void 0) {
  5856. optionalProps = {};
  5857. }
  5858. var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
  5859. bindGlobalEventListeners();
  5860. var passedProps = Object.assign({}, optionalProps, {
  5861. plugins
  5862. });
  5863. var elements = getArrayOfElements(targets);
  5864. var instances = elements.reduce(function(acc, reference2) {
  5865. var instance = reference2 && createTippy(reference2, passedProps);
  5866. if (instance) {
  5867. acc.push(instance);
  5868. }
  5869. return acc;
  5870. }, []);
  5871. return isElement(targets) ? instances[0] : instances;
  5872. }
  5873. tippy.defaultProps = defaultProps;
  5874. tippy.setDefaultProps = setDefaultProps;
  5875. tippy.currentInput = currentInput;
  5876. Object.assign({}, applyStyles$1, {
  5877. effect: function effect2(_ref) {
  5878. var state = _ref.state;
  5879. var initialStyles = {
  5880. popper: {
  5881. position: state.options.strategy,
  5882. left: "0",
  5883. top: "0",
  5884. margin: "0"
  5885. },
  5886. arrow: {
  5887. position: "absolute"
  5888. },
  5889. reference: {}
  5890. };
  5891. Object.assign(state.elements.popper.style, initialStyles.popper);
  5892. state.styles = initialStyles;
  5893. if (state.elements.arrow) {
  5894. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  5895. }
  5896. }
  5897. });
  5898. tippy.setDefaultProps({
  5899. render
  5900. });
  5901.  
  5902. })
  5903. };
  5904. }));
  5905.  
  5906. System.import("./__entry.js", "./");