JSON Viewer

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

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

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