JSON Viewer

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

目前為 2024-11-04 提交的版本,檢視 最新版本

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