JSON Viewer

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

当前为 2024-10-26 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name JSON Viewer
  3. // @namespace http://tampermonkey.net/
  4. // @version v0.8.9
  5. // @author Feny
  6. // @description 格式化显示 JSON 使数据看起来更加漂亮。支持 JSON 主题色切换。支持 JSON 脑图,清晰明了的查看 JSON 层级。支持通过 JSON Crack 查看 JSON。支持手动输入 JSON,HTTP 请求获取 JSON
  7. // @license MIT
  8. // @icon data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAeAB4AAD/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAEAAAAAAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAgACADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD9wvjF8bLX4ZrHZx+XNqlwnmKjH5YUyRvb6kEAd8H058d1b47XV5Ir3eoN++bagaXYrN6KOBn2FfPPx5/aEutX8a+KNWhIubhruZLSNj8u1WMcIOP4QoXOOwNS/wDBM79lDTfjh8YNe+IXj63TxRdeHfKjsE1KMTxtdSbmMmxvlAiVV2IBsUybgAyKR9ZTy6lhsM69Xovm2+iPmKmOqYjEKjT6v5WXU9e8beKrjxZpp/s/xFrfhjWIwWs9X0q42z2kmPlZo2zDcxjqYZ0eNv7obDDf/YL/AG8L745eJNc+G3xCttP0n4qeEWZZ2sVZNP8AENsu0rd2ysS0ZKPG7RMSQsisCcukWd+3x4RtfhpqGk+JNPjS0g1mV7a8iT5UM4XesgHYsofdjglQepJPxwPE1x4V/au8LePtNkeK40ma0lmdDgyorvHMhPo9uxjP+y1bUcHRxmGbS1adn1TXT0/4fcipiqmExCi3pfVdGn19f+GLni/w7ceGf2wPFXga+Vo5rW/vDbI3WWI/v4HA/wBqBg3tk+lfWX7AXia1+F/iDV9B1CRbWHXjFLayyHannpuUxk+rqy4zxlMdWAPQft7fsL33x91nQfiD4DutP0r4oeDXVrT7cWWx1y3UsTZ3LKCyAh5FEigkLLIpHzBk5vwj4JuvE2kLJfeHdY8N6lGAl5pepwBZrOT+JRIuYp0ByBNCzxPg4bIICqYyljMKot62Sa6prr6P/gBDC1MLiHJLS90+jT6ev/Dnmn/BVP8Aaw0nxv4/8P8Aw18KXK69qmk3MlxqEdiRMwuivlpbrtPLopkMnZNy5IIYLyPwa/Z8vvEmv+HtHu4/Ovr+5iS6KDcqAtukwe6om7nuEJxX0XoH7PK/bJG0vRoY5rr/AFslvbLGZf8AfcAf+PGvafgv8CbX4byNqFyI5tWmXYCoytsh6qvqx7t+A4yWiWYUsLhlRpbr72318kVHA1MTiHVqbP7kl0P/2Q==
  9. // @homepage https://github.com/xFeny/monkey-jsonviewer
  10. // @match *://*/*
  11. // @require https://unpkg.com/dom-to-image@2
  12. // @require https://unpkg.com/jquery@3.7.1/dist/jquery.min.js
  13. // @require data:application/javascript,%3Bwindow.jquery%3DjQuery%3B
  14. // @require https://unpkg.com/jsmind@0.8.5/es6/jsmind.js
  15. // @require data:application/javascript,%3Bwindow.jsmind%3DjsMind%3B
  16. // @require https://unpkg.com/beautifier@0.1.7
  17. // @require data:application/javascript,%3Bwindow.beautifier%3Djs_beautify%3Bwindow.js_beautify%3Djs_beautify%3Bwindow.css_beautify%3Dcss_beautify%3B
  18. // @require https://unpkg.com/@highlightjs/cdn-assets@11.10.0/highlight.min.js
  19. // @require data:application/javascript,%3Bwindow.hljs%3Dhljs%3B
  20. // @require https://unpkg.com/systemjs@6.15.1/dist/system.min.js
  21. // @require https://unpkg.com/systemjs@6.15.1/dist/extras/named-register.min.js
  22. // @require data:application/javascript,%3B(typeof%20System!%3D'undefined')%26%26(System%3Dnew%20System.constructor())%3B
  23. // @grant GM_addStyle
  24. // @grant GM_getValue
  25. // @grant GM_openInTab
  26. // @grant GM_registerMenuCommand
  27. // @grant GM_setClipboard
  28. // @grant GM_setValue
  29. // @grant unsafeWindow
  30. // ==/UserScript==
  31.  
  32. (o=>{window.addEventListener("message",r=>{const{data:n}=r;if(!n?.addStyle)return;if(typeof GM_addStyle=="function"){GM_addStyle(o);return}const e=document.createElement("style");e.textContent=o,document.head.append(e)})})(` @charset "UTF-8";.monkey-jsonviewer body li::marker{content:""}.monkey-jsonviewer body input:focus,.monkey-jsonviewer body select:focus,.monkey-jsonviewer body textarea:focus{outline:0}.monkey-jsonviewer body a:hover{text-decoration:underline}.monkey-jsonviewer .hidden{display:none!important}.monkey-jsonviewer .layui-layer-tips{width:auto!important}.monkey-jsonviewer .format-container{top:0;left:0;z-index:10;width:100vw;height:100vh;display:flex;position:fixed;flex-direction:column;background-color:#fefefe}.monkey-jsonviewer .format-container .panel{display:flex;line-height:28px;flex-direction:column;background-color:#ececec}.monkey-jsonviewer .format-container .tabs,.monkey-jsonviewer .format-container .toolbar{display:flex;border-bottom:1px solid #ccc}.monkey-jsonviewer .format-container .tabs>div,.monkey-jsonviewer .format-container .toolbar>div{cursor:pointer;padding:0 10px;font-size:12px;transition:background-color .2s ease}.monkey-jsonviewer .format-container .tabs>div:hover,.monkey-jsonviewer .format-container .toolbar>div:hover{background-color:#d4d4d4}.monkey-jsonviewer .format-container .tabs-item{border-top:3px solid #ececec}.monkey-jsonviewer .format-container .tabs-item:hover{border-top-color:#c3c3c6}.monkey-jsonviewer .format-container .tabs-item.active{color:#0060df;border-top-color:#0060df;background-color:#f1f1f1}.monkey-jsonviewer .format-container .toolbar{line-height:23px}.monkey-jsonviewer .format-container .toolbar .searchbox{padding:0;display:flex;flex-grow:1}.monkey-jsonviewer .format-container .toolbar .searchbox input{flex-grow:1;border:none;outline:none;font-size:12px;padding-left:23px;border-left:1.5px solid #ccc;background-size:12px;background-repeat:no-repeat;background-position:7px center;background-image:url(data:image/svg+xml;base64,PCEtLSBUaGlzIFNvdXJjZSBDb2RlIEZvcm0gaXMgc3ViamVjdCB0byB0aGUgdGVybXMgb2YgdGhlIE1vemlsbGEgUHVibGljCiAgIC0gTGljZW5zZSwgdi4gMi4wLiBJZiBhIGNvcHkgb2YgdGhlIE1QTCB3YXMgbm90IGRpc3RyaWJ1dGVkIHdpdGggdGhpcwogICAtIGZpbGUsIFlvdSBjYW4gb2J0YWluIG9uZSBhdCBodHRwOi8vbW96aWxsYS5vcmcvTVBMLzIuMC8uIC0tPgo8c3ZnIGZpbGw9InJnYmEoMTM1LCAxMzUsIDEzNywgMC45KSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTIgMTIiPgogIDxwYXRoIGZpbGw9ImNvbnRleHQtZmlsbCIgb3BhY2l0eT0iLjQiIGQ9Ik01IDkuMmwyIDEuNlY2LjFMOC41NSA0aC01LjFMNSA2LjF2My4xeiIvPgogIDxwYXRoIGZpbGw9ImNvbnRleHQtZmlsbCIgZD0iTTEuMTggMi42QTEgMSAwIDAgMSAyIDFIMTBhMSAxIDAgMCAxIC44IDEuNkw4IDYuNHY0LjgyYzAgLjYzLS43Mi45OC0xLjIyLjZsLTIuNS0xLjk5QS43NS43NSAwIDAgMSA0IDkuMjVWNi40MUwxLjE4IDIuNnpNMiAyTDUgNi4wOXYzLjA0bDIgMS41OVY2LjA5TDEwLjAxIDJIMnoiLz4KPC9zdmc+Cg==)}.monkey-jsonviewer .format-container .toolbar .searchbox .clear{flex:0 0 auto;align-self:center;margin:0 4px;padding:0;border:0;width:16px;height:16px;background-color:transparent;background-image:url(data:image/svg+xml;base64,PCEtLSBUaGlzIFNvdXJjZSBDb2RlIEZvcm0gaXMgc3ViamVjdCB0byB0aGUgdGVybXMgb2YgdGhlIE1vemlsbGEgUHVibGljCiAgIC0gTGljZW5zZSwgdi4gMi4wLiBJZiBhIGNvcHkgb2YgdGhlIE1QTCB3YXMgbm90IGRpc3RyaWJ1dGVkIHdpdGggdGhpcwogICAtIGZpbGUsIFlvdSBjYW4gb2J0YWluIG9uZSBhdCBodHRwOi8vbW96aWxsYS5vcmcvTVBMLzIuMC8uIC0tPgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiB2aWV3Qm94PSIwIDAgMTYgMTYiIGZpbGw9ImNvbnRleHQtZmlsbCIgZmlsbC1vcGFjaXR5PSJjb250ZXh0LWZpbGwtb3BhY2l0eSI+CiAgPHBhdGggZD0iTTYuNTg2IDhsLTIuMjkzIDIuMjkzYTEgMSAwIDAgMCAxLjQxNCAxLjQxNEw4IDkuNDE0bDIuMjkzIDIuMjkzYTEgMSAwIDAgMCAxLjQxNC0xLjQxNEw5LjQxNCA4bDIuMjkzLTIuMjkzYTEgMSAwIDEgMC0xLjQxNC0xLjQxNEw4IDYuNTg2IDUuNzA3IDQuMjkzYTEgMSAwIDAgMC0xLjQxNCAxLjQxNEw2LjU4NiA4ek04IDBhOCA4IDAgMSAxIDAgMTZBOCA4IDAgMCAxIDggMHoiLz4KPC9zdmc+Cg==)}.monkey-jsonviewer .format-container .rightbox{right:200px;display:flex;font-size:13px;position:absolute}.monkey-jsonviewer .format-container .rightbox>div{padding:0 5px;margin-top:2px}.monkey-jsonviewer .format-container .rightbox>div span{cursor:pointer;display:inline;padding:5px 10px;border-radius:3px;transition:background-color .2s ease}.monkey-jsonviewer .format-container .rightbox>div span:hover{background-color:#ccc}.monkey-jsonviewer .format-container .rightbox>div span:after{content:"";top:-2px;right:-5px;width:0;display:inline-block;height:0;position:relative;border-style:solid;border-width:5px 5px 0 5px;border-color:#999 transparent transparent transparent;transform:rotate(0);transition:transform .3s ease}.monkey-jsonviewer .format-container .rightbox>div span.active:after{transform:rotate(180deg)}.monkey-jsonviewer .format-container .rightbox>div ul{color:#333;cursor:pointer;text-align:center;border-radius:3px}.monkey-jsonviewer .format-container .rightbox>div ul li{font-size:13px;padding:5px 20px;background-color:#dfdfdf;transition:background-color .2s ease}.monkey-jsonviewer .format-container .rightbox>div ul li:hover{border-radius:3px;background-color:#ccc}.monkey-jsonviewer .format-container .rightbox>div ul li.active:before{left:15px;content:"\u221A";display:inline;position:absolute}.monkey-jsonviewer .format-container .rightbox>div .tippy-box{background-color:#dfdfdf!important}.monkey-jsonviewer .format-container .rightbox>div .tippy-box .tippy-arrow{color:#dfdfdf!important}.monkey-jsonviewer .format-container .tabs-container{flex-grow:1;overflow:auto;line-height:1.4;font-size:13.5px;font-family:monospace}.monkey-jsonviewer .format-container .tabs-container>div{display:none}.monkey-jsonviewer .format-container .tabs-container>div.active{display:block}.monkey-jsonviewer .format-container .tabs-container #formatContainer{padding:10px}.monkey-jsonviewer .format-container .tabs-container #rawTextContainer{font-size:13px;padding:5px 10px}.monkey-jsonviewer .format-container .tabs-container #rawTextContainer pre{display:block!important;overflow-wrap:break-word;white-space:pre-wrap}.monkey-jsonviewer .format-container .jsonp{color:#93983a}.monkey-jsonviewer .format-container .json-object,.monkey-jsonviewer .format-container .json-array{margin:0 0 0 2px;list-style-type:none;border-left:1px dotted #5d6d7e}.monkey-jsonviewer .format-container .json-object li,.monkey-jsonviewer .format-container .json-array li{padding-left:24px}.monkey-jsonviewer .format-container .json-brackets{font-weight:700}.monkey-jsonviewer .format-container .json-key{color:#910f93;cursor:pointer}.monkey-jsonviewer .format-container .json-string,.monkey-jsonviewer .format-container .json-string a{color:#2e7c16}.monkey-jsonviewer .format-container .json-number{color:#164ff1}.monkey-jsonviewer .format-container .json-boolean{color:#c41a16}.monkey-jsonviewer .format-container .json-null{color:#228fec}.monkey-jsonviewer .format-container a.json-toggle{position:rElative;color:inherit;opacity:.2;text-decoration:none}.monkey-jsonviewer .format-container a.json-toggle:hover{opacity:.35}.monkey-jsonviewer .format-container a.json-toggle:active{opacity:.5}.monkey-jsonviewer .format-container a.json-toggle:focus{outline:none}.monkey-jsonviewer .format-container a.json-toggle:before{top:2.5px;left:-15px;position:absolute;content:"";display:block;width:0;height:0;border-style:solid;border-width:5px 0 5px 8px;border-color:transparent transparent transparent currentColor;transform:rotate(90deg);transition:transform .3s ease}.monkey-jsonviewer .format-container a.json-toggle.collapsed:before{transform:rotate(0)}.monkey-jsonviewer .format-container a.json-placeholder{color:#ccc;font-size:12px;padding:0 1em;text-decoration:none}.monkey-jsonviewer .format-container a.json-placeholder:hover{text-decoration:underline}.monkey-jsonviewer .format-container .json-curly-brackets{color:#6d9331}.monkey-jsonviewer .format-container .json-square-brackets{color:#8e9331}.monkey-jsonviewer .format-container #jmContainer{width:100vw;height:calc(100vh - 57px)}.monkey-jsonviewer .format-container #jmContainer jmnode{display:flex;align-items:center;padding:0 7px 0 22px;color:#475872!important;box-shadow:none!important;background-color:transparent!important}.monkey-jsonviewer .format-container #jmContainer jmnode.root{padding:0;color:transparent!important}.monkey-jsonviewer .format-container #jmContainer jmnode:before{content:"";top:50%!important;margin-top:1px;position:absolute;border-radius:50%;transform:translateY(-50%);background-color:#8149bf80}.monkey-jsonviewer .format-container #jmContainer jmnode.root:before{left:50%;width:18px;height:18px;transform:translate(-18px,-50%)}.monkey-jsonviewer .format-container #jmContainer jmnode:hover{text-shadow:0px 0px 1px currentColor}.monkey-jsonviewer .format-container #jmContainer jmnode:not(.root):before{left:0;width:15px;height:15px}.monkey-jsonviewer .format-container #jmContainer jmexpander{margin-top:1px;line-height:9px}.monkey-jsonviewer .format-container #jmContainer .datatype{opacity:.6;font-size:12px;margin-top:2px;padding-left:5px}.monkey-jsonviewer .format-container table{margin-left:20px;width:-webkit-fill-available;border-collapse:collapse}.monkey-jsonviewer .format-container table b{font-weight:400}.monkey-jsonviewer .format-container table tr:hover{background-color:#f0f9fe}.monkey-jsonviewer .format-container table tr.selected td,.monkey-jsonviewer .format-container table tr.selected td b,.monkey-jsonviewer .format-container table tr.selected td a{color:#fff!important;background-color:#3875d7}.monkey-jsonviewer .format-container table tr td:first-child{width:120px}.monkey-jsonviewer .format-container table .node-len{cursor:pointer;color:#ccc;font-size:12px;margin-left:.5em}.monkey-jsonviewer .format-container table .node-len span:hover{text-decoration:underline}.monkey-jsonviewer .format-container table .simple-tree-table-empty .simple-tree-table-icon{padding-left:.5em;display:inline!important;background-color:transparent!important}.monkey-jsonviewer .format-container table .simple-tree-table-icon{color:#000;opacity:.2;width:0!important;margin:0!important;line-height:0!important}.monkey-jsonviewer .format-container table .simple-tree-table-icon:before{top:.5px;left:-8px;position:relative;content:"";width:0;height:0;display:none;border-style:solid;border-width:5px 0 5px 8px;border-color:transparent transparent transparent currentColor;transform:rotate(90deg);transition:transform .3s ease}.monkey-jsonviewer .format-container table .simple-tree-table-icon:hover{opacity:.35}.monkey-jsonviewer .format-container table .simple-tree-table-icon:after{content:""!important}.monkey-jsonviewer .format-container table .simple-tree-table-icon:active{opacity:.5}.monkey-jsonviewer .format-container table .simple-tree-table-opened .simple-tree-table-icon:before{display:block}.monkey-jsonviewer .format-container table .simple-tree-table-closed .simple-tree-table-icon:before{display:block;transform:rotate(0)}.monkey-jsonviewer .httpRequest{padding:30px 20px;width:700px}.monkey-jsonviewer .httpRequest>div{display:flex;height:35px;margin-bottom:20px}.monkey-jsonviewer .httpRequest input,.monkey-jsonviewer .httpRequest select{border-radius:0;padding-left:10px;border:1px solid #ccc}.monkey-jsonviewer .httpRequest input{flex-grow:1}.monkey-jsonviewer .httpRequest input[name=url],.monkey-jsonviewer .httpRequest input:first-child,.monkey-jsonviewer .httpRequest select{border-right:none}.monkey-jsonviewer .httpRequest button{cursor:pointer;padding:0 15px;border:1px solid #ccc}.monkey-jsonviewer .httpRequest button:active{background-color:#cfcfcf}.monkey-jsonviewer .light .json-key{color:#0040cf}.monkey-jsonviewer .light .json-string,.monkey-jsonviewer .light .json-string a{color:#a31515}.monkey-jsonviewer .light .json-number{color:#0b7500}.monkey-jsonviewer .light .json-boolean{color:#00f}.monkey-jsonviewer .light .json-null{color:#05f}.monkey-jsonviewer body.dark .format-container li,.monkey-jsonviewer body.dark .format-container pre,.monkey-jsonviewer body.dark_plus .format-container li,.monkey-jsonviewer body.dark_plus .format-container pre{color:#ccc}.monkey-jsonviewer body.dark .format-container .panel,.monkey-jsonviewer body.dark_plus .format-container .panel{color:#c4c4c4;background-color:#333}.monkey-jsonviewer body.dark .format-container .panel>div,.monkey-jsonviewer body.dark_plus .format-container .panel>div{border-bottom-color:#464646}.monkey-jsonviewer body.dark .format-container .panel .tabs-item:hover,.monkey-jsonviewer body.dark .format-container .panel .toolbar-item:hover,.monkey-jsonviewer body.dark_plus .format-container .panel .tabs-item:hover,.monkey-jsonviewer body.dark_plus .format-container .panel .toolbar-item:hover{background-color:#464646}.monkey-jsonviewer body.dark .format-container .panel .tabs-item,.monkey-jsonviewer body.dark_plus .format-container .panel .tabs-item{border-top-color:#333}.monkey-jsonviewer body.dark .format-container .panel .tabs-item:hover,.monkey-jsonviewer body.dark_plus .format-container .panel .tabs-item:hover{border-top-color:#c3c3c6}.monkey-jsonviewer body.dark .format-container .panel .tabs-item.active,.monkey-jsonviewer body.dark_plus .format-container .panel .tabs-item.active{color:#c4c4c4;border-top-color:#64b7ff;background-color:#464646}.monkey-jsonviewer body.dark .format-container .searchbox input,.monkey-jsonviewer body.dark_plus .format-container .searchbox input{color:#ccc;background-color:#464646;border-left-color:#333}.monkey-jsonviewer body.dark .format-container .searchbox .clear,.monkey-jsonviewer body.dark_plus .format-container .searchbox .clear{filter:invert(.8)}.monkey-jsonviewer body.dark .format-container .rightbox>div span:hover,.monkey-jsonviewer body.dark_plus .format-container .rightbox>div span:hover{background-color:#464646}.monkey-jsonviewer body.dark .format-container .rightbox .tippy-box,.monkey-jsonviewer body.dark_plus .format-container .rightbox .tippy-box{background-color:#4e4e4e!important}.monkey-jsonviewer body.dark .format-container .rightbox .tippy-box .tippy-arrow,.monkey-jsonviewer body.dark_plus .format-container .rightbox .tippy-box .tippy-arrow{color:#4e4e4e!important}.monkey-jsonviewer body.dark .format-container .rightbox .tippy-box li,.monkey-jsonviewer body.dark_plus .format-container .rightbox .tippy-box li{background-color:#4e4e4e!important}.monkey-jsonviewer body.dark .format-container .rightbox .tippy-box li:hover,.monkey-jsonviewer body.dark_plus .format-container .rightbox .tippy-box li:hover{background-color:#464646!important}.monkey-jsonviewer body.dark .format-container .jsonp,.monkey-jsonviewer body.dark_plus .format-container .jsonp{color:#f1d700}.monkey-jsonviewer body.dark .format-container .json-toggle,.monkey-jsonviewer body.dark_plus .format-container .json-toggle{opacity:.35}.monkey-jsonviewer body.dark .format-container .json-toggle:hover,.monkey-jsonviewer body.dark_plus .format-container .json-toggle:hover{opacity:.5}.monkey-jsonviewer body.dark .format-container jmnode,.monkey-jsonviewer body.dark_plus .format-container jmnode{filter:brightness(2)}.monkey-jsonviewer body.dark .format-container jmexpander,.monkey-jsonviewer body.dark_plus .format-container jmexpander{background-color:#dfdfdf}.monkey-jsonviewer body.dark .format-container table tr:hover,.monkey-jsonviewer body.dark_plus .format-container table tr:hover{background-color:#353b48}.monkey-jsonviewer body.dark .format-container .simple-tree-table-icon,.monkey-jsonviewer body.dark_plus .format-container .simple-tree-table-icon{color:#fff;opacity:.5}.monkey-jsonviewer body.dark .tabs-container{background-color:#252526}.monkey-jsonviewer body.dark .json-curly-brackets{color:#ce70d6}.monkey-jsonviewer body.dark .json-square-brackets{color:#f1d700}.monkey-jsonviewer body.dark .json-key{color:#9cdcfe}.monkey-jsonviewer body.dark .json-string,.monkey-jsonviewer body.dark .json-string a{color:#ce9178}.monkey-jsonviewer body.dark .json-number{color:#b5cea8}.monkey-jsonviewer body.dark .json-boolean{color:#358cd6}.monkey-jsonviewer body.dark .json-null{color:#569cd6}.monkey-jsonviewer body.dark_plus .tabs-container{background-color:#1e1f22}.monkey-jsonviewer body.dark_plus .json-curly-brackets{color:#bb9667}.monkey-jsonviewer body.dark_plus .json-square-brackets{color:#bbbda3}.monkey-jsonviewer body.dark_plus .json-key{color:#c77dbb}.monkey-jsonviewer body.dark_plus .json-string,.monkey-jsonviewer body.dark_plus .json-string a{color:#6aab73}.monkey-jsonviewer body.dark_plus .json-number{color:#28aab4}.monkey-jsonviewer body.dark_plus .json-boolean{color:#ce8951}.monkey-jsonviewer body.dark_plus .json-null{color:#c78d61}.monkey-jsonviewer #jsoncrackEmbed{width:100%;height:100%;border:0}.monkey-jsonviewer .tippy-box[data-theme~=layer]{color:#fff;padding:5px;font-size:12px;line-height:20px;background-color:#2e59a7}.monkey-jsonviewer .tippy-box[data-theme~=layer] .tippy-arrow{color:#2e59a7}.monkey-jsonviewer .tippy-box[data-theme~=imagebox]{background-color:#d9d9d9}.monkey-jsonviewer .tippy-box[data-theme~=imagebox] .tippy-arrow{color:#d9d9d9}.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}.monkey-js-css-beautify body{padding-top:20px;padding-left:5px}.monkey-js-css-beautify body .beautify_checkbox{top:0;left:0;z-index:999;width:100vw;display:flex;position:fixed;padding:5px 10px;align-items:center;background-color:#f3f3f3;border-bottom:1px solid #ccc}.monkey-js-css-beautify body .beautify_checkbox label{font-size:13px}.monkey-js-css-beautify body .beautify_checkbox input[type=checkbox]{top:1.5px;width:14px;height:14px;margin-right:5px;position:relative}pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{background:#fff;color:#000}.xml .hljs-meta{color:silver}.hljs-comment,.hljs-quote{color:#007400}.hljs-attribute,.hljs-keyword,.hljs-literal,.hljs-name,.hljs-selector-tag,.hljs-tag{color:#aa0d91}.hljs-template-variable,.hljs-variable{color:#3f6e74}.hljs-code,.hljs-meta .hljs-string,.hljs-string{color:#c41a16}.hljs-link,.hljs-regexp{color:#0e0eff}.hljs-bullet,.hljs-number,.hljs-symbol,.hljs-title{color:#1c00cf}.hljs-meta,.hljs-section{color:#643820}.hljs-built_in,.hljs-class .hljs-title,.hljs-params,.hljs-title.class_,.hljs-type{color:#5c2699}.hljs-attr{color:#836c28}.hljs-subst{color:#000}.hljs-formula{background-color:#eee;font-style:italic}.hljs-addition{background-color:#baeeba}.hljs-deletion{background-color:#ffc8bd}.hljs-selector-class,.hljs-selector-id{color:#9b703f}.hljs-doctag,.hljs-strong{font-weight:700}.hljs-emphasis{font-style:italic}/**
  33. * @license BSD
  34. * @copyright 2014-2023 hizzgdev@163.com
  35. *
  36. * Project Home:
  37. * https://github.com/hizzgdev/jsmind/
  38. */.jsmind-inner{position:relative;overflow:auto;width:100%;height:100%;outline:none}.jsmind-inner{moz-user-select:-moz-none;-moz-user-select:none;-o-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.jsmind-inner canvas{position:absolute}svg.jsmind{position:absolute;z-index:1}canvas.jsmind{position:absolute;z-index:1}jmnodes{position:absolute;z-index:2;background-color:#0000}jmnode{position:absolute;cursor:default;max-width:400px}jmexpander{position:absolute;width:11px;height:11px;display:block;overflow:hidden;line-height:12px;font-size:10px;text-align:center;border-radius:6px;border-width:1px;border-style:solid;cursor:pointer}.jmnode-overflow-wrap jmnodes{min-width:420px}.jmnode-overflow-hidden jmnode{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}jmnode{padding:10px;background-color:#fff;color:#333;border-radius:5px;box-shadow:1px 1px 1px #666;font:16px/1.125 Verdana,Arial,Helvetica,sans-serif}jmnode:hover{box-shadow:2px 2px 8px #000;background-color:#ebebeb;color:#333}jmnode.selected{background-color:#11f;color:#fff;box-shadow:2px 2px 8px #000}jmnode.root{font-size:24px}jmexpander{border-color:gray}jmexpander:hover{border-color:#000}@media screen and (max-device-width: 1024px){jmnode{padding:5px;border-radius:3px;font-size:14px}jmnode.root{font-size:21px}}jmnodes.theme-primary jmnode{background-color:#428bca;color:#fff;border-color:#357ebd}jmnodes.theme-primary jmnode:hover{background-color:#3276b1;border-color:#285e8e}jmnodes.theme-primary jmnode.selected{background-color:#f1c40f;color:#fff}jmnodes.theme-warning jmnode{background-color:#f0ad4e;border-color:#eea236;color:#fff}jmnodes.theme-warning jmnode:hover{background-color:#ed9c28;border-color:#d58512}jmnodes.theme-warning jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-danger jmnode{background-color:#d9534f;border-color:#d43f3a;color:#fff}jmnodes.theme-danger jmnode:hover{background-color:#d2322d;border-color:#ac2925}jmnodes.theme-danger jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-success jmnode{background-color:#5cb85c;border-color:#4cae4c;color:#fff}jmnodes.theme-success jmnode:hover{background-color:#47a447;border-color:#398439}jmnodes.theme-success jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-info jmnode{background-color:#5dc0de;border-color:#46b8da;color:#fff}jmnodes.theme-info jmnode:hover{background-color:#39b3d7;border-color:#269abc}jmnodes.theme-info jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-greensea jmnode{background-color:#1abc9c;color:#fff}jmnodes.theme-greensea jmnode:hover{background-color:#16a085}jmnodes.theme-greensea jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-nephrite jmnode{background-color:#2ecc71;color:#fff}jmnodes.theme-nephrite jmnode:hover{background-color:#27ae60}jmnodes.theme-nephrite jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-belizehole jmnode{background-color:#3498db;color:#fff}jmnodes.theme-belizehole jmnode:hover{background-color:#2980b9}jmnodes.theme-belizehole jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-wisteria jmnode{background-color:#9b59b6;color:#fff}jmnodes.theme-wisteria jmnode:hover{background-color:#8e44ad}jmnodes.theme-wisteria jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-asphalt jmnode{background-color:#34495e;color:#fff}jmnodes.theme-asphalt jmnode:hover{background-color:#2c3e50}jmnodes.theme-asphalt jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-orange jmnode{background-color:#f1c40f;color:#fff}jmnodes.theme-orange jmnode:hover{background-color:#f39c12}jmnodes.theme-orange jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-pumpkin jmnode{background-color:#e67e22;color:#fff}jmnodes.theme-pumpkin jmnode:hover{background-color:#d35400}jmnodes.theme-pumpkin jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-pomegranate jmnode{background-color:#e74c3c;color:#fff}jmnodes.theme-pomegranate jmnode:hover{background-color:#c0392b}jmnodes.theme-pomegranate jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-clouds jmnode{background-color:#ecf0f1;color:#333}jmnodes.theme-clouds jmnode:hover{background-color:#bdc3c7}jmnodes.theme-clouds jmnode.selected{background-color:#11f;color:#fff}jmnodes.theme-asbestos jmnode{background-color:#95a5a6;color:#fff}jmnodes.theme-asbestos jmnode:hover{background-color:#7f8c8d}jmnodes.theme-asbestos jmnode.selected{background-color:#11f;color:#fff}.scroll-top{width:48px;height:48px;z-index:999;position:fixed;right:30px;bottom:30px;display:none;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA39JREFUaEPtmV2ITVEUx39rJjT5KPKC5DPKK6UGZZ7Eq0whNUiKFPfcKW9mnmjm7ssLaSLygEx5xItMESnKC4V8FV4IJUkyS+fMHZ07zjl3733PvT6a+3S6Z629/r+99sfa+wgpPw1YDtxLe9/k/1eI4X5STMkSokXWNlloYjgpMZSmIxPgbxBfS8M4QK0eavT78Qw0uodrtd+wDGjAMqBcEVAQw6NaYnzeNwRAi2xBOQlMrYj6jLJTygz6iMzyyR1Ai+xCGUgMqnTmDZErgBYoIJjMXhY2S4mLeWUiNwAt0INwyEqY0iNleq1saxjlAqAB64BrToKEHVLijJNPgnHdALqPaUziOsoKRzGfaKFD+nng6FdlXj+Ay9AZq1Q5L2W2/jEA3c8sWqOSe3aCiK/A3cr/K4G2FKEbxXDZF6KuDKROXKWXFvqlxJdQmBaZzDDdKZP8thhW/RmAgKfA4qrgSq+U6UkSlAostEuJOz4Q3hnQgPXAld+CCh1pB5DogKTcSBAalhpHmw1wGtgxJuhbMczJEqIBbxLmzFUxbGg2gCYE9AVADF6jwctJDzKd73xI7DG/IQQTmCFH+OiaBT+AAyykhWcpBZv7JA4bGmaRHOV5cwBqX7mc5Qe9coyX0TK6n/m0RnVSV4bA1KuTLCi/DBTYhHCpRm+Fe8Bo/b8JmJxp71lqOwNowB7guGuqLe33iuGEpW1k5gTgVDK7qIjbZmyESU1aA1TOuA99dTn5CQulxAsbH3uAeqpOGyXVNrvEcMrGzR4gIGnjsonhYzMkhg4bx3EAm17ysGlIBh4DSzzE+LgMiGG3jaPLEApv2Q7YNFq3jcOmZg9gt/u6aH8PzEx0aGWu9PHapjFrgKimCaIDTHiQqf4pNxHW2AT8ZaMEiZdgSreUKdm25QRQgRi7nIZzI7xZcPmeNkAL5xjmVpVQx1049HUGiCAKFBH6K8GjFUP3MIW2CGJpjd4bFEPnmM54grA761tYWpteAJXgy1A6w6p09Opcu1nED7ZlAcQP/BqwGZjORAblMO9sh03czhsgLZgW6EL4JoYL0b0RTArPBfFnH6G5ZyAVYKTkGBlWQVR2bxDDgvjzvwQQXqGsDQ/sGkTXKdHzOECsB3LtjdjKMjqE/qMMjJwn5olh+98+hM6gvAqXy0aN+4Yuo/HG/weAPmC1GNrzHDbxtn4Coc0pQNdM3UAAAAAASUVORK5CYII=)} `);
  39.  
  40. System.addImportMap({ imports: {"jquery":"user:jquery","highlight.js":"user:highlight.js","beautifier":"user:beautifier","jsmind":"user:jsmind"} });
  41. System.set("user:jquery", (()=>{const _=jquery;('default' in _)||(_.default=_);return _})());
  42. System.set("user:highlight.js", (()=>{const _=hljs;('default' in _)||(_.default=_);return _})());
  43. System.set("user:beautifier", (()=>{const _=beautifier;('default' in _)||(_.default=_);return _})());
  44. System.set("user:jsmind", (()=>{const _=jsmind;('default' in _)||(_.default=_);return _})());
  45.  
  46. System.register("./__entry.js", ['./__monkey.entry-ClII6pV-.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-ClII6pV-.js", ['jquery'], (function (exports, module) {
  59. 'use strict';
  60. var $;
  61. return {
  62. setters: [module => {
  63. $ = module.default;
  64. }],
  65. execute: (function () {
  66.  
  67. const scriptRel = function detectScriptRel() {
  68. const relList = typeof document !== "undefined" && document.createElement("link").relList;
  69. return relList && relList.supports && relList.supports("modulepreload") ? "modulepreload" : "preload";
  70. }();
  71. const assetsURL = function(dep) {
  72. return "/" + dep;
  73. };
  74. const seen = {};
  75. const __vitePreload = function preload(baseModule, deps, importerUrl) {
  76. let promise = Promise.resolve();
  77. if (deps && deps.length > 0) {
  78. document.getElementsByTagName("link");
  79. const cspNonceMeta = document.querySelector(
  80. "meta[property=csp-nonce]"
  81. );
  82. const cspNonce = (cspNonceMeta == null ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta == null ? void 0 : cspNonceMeta.getAttribute("nonce"));
  83. promise = Promise.allSettled(
  84. deps.map((dep) => {
  85. dep = assetsURL(dep);
  86. if (dep in seen) return;
  87. seen[dep] = true;
  88. const isCss = dep.endsWith(".css");
  89. const cssSelector = isCss ? '[rel="stylesheet"]' : "";
  90. if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) {
  91. return;
  92. }
  93. const link = document.createElement("link");
  94. link.rel = isCss ? "stylesheet" : scriptRel;
  95. if (!isCss) {
  96. link.as = "script";
  97. }
  98. link.crossOrigin = "";
  99. link.href = dep;
  100. if (cspNonce) {
  101. link.setAttribute("nonce", cspNonce);
  102. }
  103. document.head.appendChild(link);
  104. if (isCss) {
  105. return new Promise((res, rej) => {
  106. link.addEventListener("load", res);
  107. link.addEventListener(
  108. "error",
  109. () => rej(new Error(`Unable to preload CSS for ${dep}`))
  110. );
  111. });
  112. }
  113. })
  114. );
  115. }
  116. function handlePreloadError(err) {
  117. const e = new Event("vite:preloadError", {
  118. cancelable: true
  119. });
  120. e.payload = err;
  121. window.dispatchEvent(e);
  122. if (!e.defaultPrevented) {
  123. throw err;
  124. }
  125. }
  126. return promise.then((res) => {
  127. for (const item of res || []) {
  128. if (item.status !== "rejected") continue;
  129. handlePreloadError(item.reason);
  130. }
  131. return baseModule().catch(handlePreloadError);
  132. });
  133. };
  134. const Utils = exports("U", {
  135. /**
  136. * 检查字符串是否为URL
  137. * @param {*} str 字符串
  138. * @returns
  139. */
  140. isUrl: function(str) {
  141. const regexp = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
  142. return regexp.test(str);
  143. },
  144. /**
  145. * 检查是否为图片链接
  146. * @param {*} str 字符串
  147. * @returns
  148. */
  149. isImg: function(str) {
  150. const regexp = /\.(ico|bmp|gif|jpg|jpeg|png|svg|webp|GIF|JPG|PNG|WEBP|SVG)([\w#!:.?+=&%@!\-\/])?/i;
  151. return regexp.test(str);
  152. },
  153. /**
  154. * 是否为json格式的内容
  155. * @param {*} str 字符串
  156. * @returns
  157. */
  158. isJSON: function(str) {
  159. try {
  160. JSON.parse(str);
  161. return true;
  162. } catch (e) {
  163. console.log("is not json");
  164. return false;
  165. }
  166. },
  167. /**
  168. * 获取数据类型,全小写
  169. * @param {*} v
  170. * @returns
  171. */
  172. getType: function(v) {
  173. return Object.prototype.toString.call(v).match(/\s(.+)]/)[1].toLowerCase();
  174. },
  175. /**
  176. * 获取数据类型
  177. * @param {*} val
  178. * @returns
  179. */
  180. getPrototype: function(val) {
  181. return Object.prototype.toString.call(val).match(/\s(.+)]/)[1];
  182. },
  183. /**
  184. * 获取数组中对象key最多的对象
  185. * @param {*} arr 对象数组
  186. * @returns
  187. */
  188. findMaxKeysObject: function(arr) {
  189. let maxKeysCount = 0;
  190. let maxKeysObject;
  191. for (const obj of arr) {
  192. const keysCount = Object.keys(obj).length;
  193. if (keysCount > maxKeysCount) {
  194. maxKeysCount = keysCount;
  195. maxKeysObject = obj;
  196. }
  197. }
  198. return maxKeysObject;
  199. },
  200. /**
  201. * 随机rgb颜色
  202. * @param {*} opacity 透明度
  203. * @returns
  204. */
  205. randomColor: (opacity) => {
  206. const red = Math.floor(Math.random() * 256);
  207. const green = Math.floor(Math.random() * 256);
  208. const blue = Math.floor(Math.random() * 256);
  209. return `rgba(${red}, ${green}, ${blue}, ${opacity})`;
  210. },
  211. /**
  212. * 下载文本内容
  213. * @param {*} content 文本内容
  214. * @param {*} filename 文件名
  215. */
  216. downloadText: function(content, filename) {
  217. const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
  218. const url = URL.createObjectURL(blob);
  219. const link = document.createElement("a");
  220. link.href = url;
  221. link.download = filename;
  222. link.click();
  223. URL.revokeObjectURL(url);
  224. },
  225. /**
  226. * JSONP 数据处理
  227. * @param {*} rawText 字符串
  228. * @returns
  229. */
  230. jsonpMatch: function(rawText2) {
  231. const tokens = rawText2.match(/^([^\s(]*)\s*\(([\s\S]*)\)\s*;?$/);
  232. if (tokens && tokens[1] && tokens[2]) {
  233. return {
  234. rawText: tokens[2],
  235. jsonpFun: tokens[1]
  236. };
  237. }
  238. return {
  239. rawText: rawText2,
  240. jsonpFun: null
  241. };
  242. }
  243. });
  244. const URL$1 = exports("d", {
  245. JSON_CRACK_WIDGET: "https://jsoncrack.feny.ink/widget",
  246. EXAMPLE_JSON: "https://fetch-api.feny.ink/example.json",
  247. ONLINE_REQUEST: "https://fetch-api.feny.ink/httpRequest",
  248. LAYUI_JS: "https://unpkg.com/layui@2.7.6/dist/layui.js",
  249. LAYUI_CSS: "https://unpkg.com/layui@2.7.6/dist/css/layui.css"
  250. });
  251. const layout = `
  252. <div class="format-container">
  253. <div class="panel">
  254. <div class="tabs">
  255. <div class="tabs-item btn active" id="viewFormater">JSON 格式化</div>
  256. <div class="tabs-item btn" id="viewMind">JSON 脑图</div>
  257. <div class="tabs-item btn" id="viewRawText">原始数据</div>
  258. </div>
  259. <div class="toolbar">
  260. <div class="toolbar-item btn" id="saveJson">保存</div>
  261. <div class="toolbar-item btn" id="copyJson">复制</div>
  262. <div class="toolbar-item btn" id="collapseAll">全部折叠</div>
  263. <div class="toolbar-item btn" id="expandAll">全部展开</div>
  264. <div class="toolbar-item btn" id="jsoncrack" style="display: none;">JSON Crack</div>
  265. <div class="toolbar-item btn" id="beautify" style="display: none;">美化输出</div>
  266. <div class="searchbox">
  267. <input type="text" placeholder="过滤 JSON "/>
  268. <button class="clear" hidden></button>
  269. </div>
  270. </div>
  271. <div class="rightbox">
  272. <div class="style">
  273. <span>风格</span>
  274. <template data-type="style">
  275. <ul>
  276. <li data-type="style" data-value="default">默认</li>
  277. <li data-type="style" data-value="table">表格</li>
  278. </ul>
  279. </template>
  280. </div>
  281. <div class="theme">
  282. <span>主题</span>
  283. <template data-type="theme">
  284. <ul>
  285. <li data-type="theme" data-value="default">默认</li>
  286. <li data-type="theme" data-value="light">浅色</li>
  287. <li data-type="theme" data-value="dark">暗黑</li>
  288. <li data-type="theme" data-value="dark_plus">暗黑+</li>
  289. </ul>
  290. </template>
  291. </div>
  292. <div class="tools">
  293. <span>工具</span>
  294. <template data-type="tools">
  295. <ul>
  296. <li data-type="tools" data-value="inputJson">JSON 输入</li>
  297. <li data-type="tools" data-value="fetchApi">HTTP 请求</li>
  298. </ul>
  299. </template>
  300. </div>
  301. </div>
  302. </div>
  303. <div class="tabs-container">
  304. <div class="active" id="formatContainer"></div>
  305. <div id="jmContainer"></div>
  306. <div id="rawTextContainer">
  307. <pre></pre>
  308. </div>
  309. </div>
  310. </div>`;
  311. var _GM_addStyle = /* @__PURE__ */ (() => typeof GM_addStyle != "undefined" ? GM_addStyle : void 0)();
  312. var _GM_getValue = exports("a", /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)());
  313. var _GM_openInTab = /* @__PURE__ */ (() => typeof GM_openInTab != "undefined" ? GM_openInTab : void 0)();
  314. var _GM_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
  315. var _GM_setClipboard = exports("c", /* @__PURE__ */ (() => typeof GM_setClipboard != "undefined" ? GM_setClipboard : void 0)());
  316. var _GM_setValue = exports("_", /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)());
  317. var _unsafeWindow = exports("b", /* @__PURE__ */ (() => typeof unsafeWindow != "undefined" ? unsafeWindow : void 0)());
  318. const { EXAMPLE_JSON, LAYUI_CSS, LAYUI_JS } = URL$1;
  319. (function() {
  320. const openInTab = () => _GM_openInTab(EXAMPLE_JSON);
  321. _GM_registerMenuCommand("测试JSON( Alt + j )", openInTab);
  322. window.addEventListener("keydown", function(event) {
  323. const { key, altKey } = event;
  324. if (altKey && (key === "J" || key === "j")) {
  325. openInTab();
  326. }
  327. });
  328. const innerText = document.body.innerText;
  329. const { rawText, jsonpFun } = Utils.jsonpMatch(innerText);
  330. _unsafeWindow.RAW_TEXT = rawText;
  331. _unsafeWindow.GLOBAL_JSONP_FUN = jsonpFun;
  332. if (!Utils.isJSON(_unsafeWindow.RAW_TEXT)) {
  333. __vitePreload(() => module.import('./index-mjXXc9V1-CzTRTL8e.js'), void 0 );
  334. return;
  335. }
  336. $("pre").hide();
  337. $("html").addClass("monkey-jsonviewer");
  338. window.postMessage({ addStyle: true });
  339. $(document.head).append(`<link href="${LAYUI_CSS}" rel="stylesheet"/>`).append(`<script src="${LAYUI_JS}" type="text/javascript"><\/script>`);
  340. _GM_addStyle(`
  341. jmnode.root::before{background-color: ${Utils.randomColor(0.5)}}
  342. jmnode:not(.root)::before{background-color: ${Utils.randomColor(0.5)}}
  343. `);
  344. setTimeout(() => {
  345. try {
  346. _unsafeWindow.GLOBAL_JSON = eval(`(${_unsafeWindow.RAW_TEXT})`);
  347. } catch (e) {
  348. _unsafeWindow.GLOBAL_JSON = JSON.parse(_unsafeWindow.RAW_TEXT);
  349. }
  350. document.body.insertAdjacentHTML("afterbegin", layout);
  351. __vitePreload(() => module.import('./index-BQ0G-sPz-B0Qz591F.js'), void 0 ).then((format) => format.default.init()).then(() => __vitePreload(() => module.import('./index-BF1lJinC-Bkz7tWrF.js'), void 0 )).then(() => __vitePreload(() => module.import('./index-D3l8MoSf-Dhsxm64a.js'), void 0 ));
  352. });
  353. })();
  354.  
  355. })
  356. };
  357. }));
  358.  
  359. System.register("./index-mjXXc9V1-CzTRTL8e.js", ['highlight.js', 'beautifier'], (function (exports, module) {
  360. 'use strict';
  361. var hljs, css_beautify, js_beautify;
  362. return {
  363. setters: [module => {
  364. hljs = module.default;
  365. }, module => {
  366. css_beautify = module.css_beautify;
  367. js_beautify = module.js_beautify;
  368. }],
  369. execute: (function () {
  370.  
  371. const layout = `
  372. <div class="beautify_checkbox">
  373. <input type="checkbox" id="beautify"/>
  374. <label for="beautify">美化输出</label>
  375. </div>`;
  376. (function() {
  377. const docType = [
  378. "application/x-javascript",
  379. "application/javascript",
  380. "text/javascript",
  381. "text/css"
  382. ];
  383. const contentType = document.contentType;
  384. if (!docType.includes(contentType)) {
  385. return;
  386. }
  387. const preElement = document.querySelector("pre");
  388. if (!preElement) {
  389. return;
  390. }
  391. window.postMessage({ addStyle: true });
  392. document.querySelector("html").classList.add("monkey-js-css-beautify");
  393. setTimeout(() => {
  394. const rawText = preElement.innerText;
  395. document.body.insertAdjacentHTML("afterbegin", layout);
  396. const checkbox = document.querySelector(".beautify_checkbox input");
  397. checkbox.addEventListener("click", function() {
  398. if (this.checked) {
  399. beautifyCode(contentType, preElement, rawText);
  400. } else {
  401. preElement.innerText = rawText;
  402. }
  403. });
  404. });
  405. })();
  406. function beautifyCode(contentType, element, rawText) {
  407. const language = contentType.substring(contentType.indexOf("/") + 1);
  408. if (!["css", "javascript", "x-javascript"].includes(language)) {
  409. return;
  410. }
  411. let beautifyCode2;
  412. if ("css" === language) {
  413. const cssBeautify = css_beautify ? css_beautify : window.css_beautify;
  414. beautifyCode2 = cssBeautify(rawText);
  415. beautifyCode2 = hljs.highlight(beautifyCode2, {
  416. language
  417. }).value;
  418. } else {
  419. const jsBeautify = js_beautify ? js_beautify : window.js_beautify;
  420. beautifyCode2 = jsBeautify(rawText);
  421. beautifyCode2 = hljs.highlight(beautifyCode2, {
  422. language: "javascript"
  423. }).value;
  424. }
  425. element.innerHTML = `<code>${beautifyCode2}</code>`;
  426. }
  427.  
  428. })
  429. };
  430. }));
  431.  
  432. System.register("./index-BQ0G-sPz-B0Qz591F.js", ['jquery', './__monkey.entry-ClII6pV-.js', './tippy.esm-Ot9MORvr-DNGa7Opj.js'], (function (exports, module) {
  433. 'use strict';
  434. var $, _GM_setValue, _GM_getValue, _unsafeWindow, Utils, _GM_setClipboard, tippy;
  435. return {
  436. setters: [module => {
  437. $ = module.default;
  438. }, module => {
  439. _GM_setValue = module._;
  440. _GM_getValue = module.a;
  441. _unsafeWindow = module.b;
  442. Utils = module.U;
  443. _GM_setClipboard = module.c;
  444. }, module => {
  445. tippy = module.t;
  446. }],
  447. execute: (function () {
  448.  
  449. (function($2) {
  450. function isCollapsable(arg) {
  451. return arg instanceof Object && Object.keys(arg).length > 0;
  452. }
  453. function json2html(json, parentPath = "") {
  454. let html = "";
  455. const type = Utils.getType(json);
  456. switch (type) {
  457. case "array":
  458. case "object":
  459. let len = json.length || Object.keys(json).length;
  460. if (len > 0) {
  461. html += `<span class="json-brackets ${type == "array" ? "json-square-brackets" : "json-curly-brackets"}">`;
  462. html += type === "array" ? '[</span><ol class="json-array">' : '{</span><ul class="json-object">';
  463. for (var key in json) {
  464. if (json.hasOwnProperty(key)) {
  465. const comma = --len > 0 ? "," : "";
  466. const jsonPath = parentPath + "." + key;
  467. const collapse = isCollapsable(json[key]) ? '<a href class="json-toggle"></a>' : "";
  468. const res = json2html(json[key], jsonPath);
  469. let toHtml = res;
  470. if (type !== "array") {
  471. toHtml = `<span class="json-key">"${key}"</span>: ${res}`;
  472. }
  473. html += [
  474. `<li json-path="${jsonPath}">`,
  475. collapse,
  476. toHtml,
  477. comma,
  478. "</li>"
  479. ].join("");
  480. }
  481. }
  482. if (type === "array") {
  483. html += `</ol><span class="json-brackets json-square-brackets">]</span>`;
  484. } else {
  485. html += `</ul><span class="json-brackets json-curly-brackets">}</span>`;
  486. }
  487. } else {
  488. html += `<span class="json-brackets ${type == "array" ? "json-square-brackets" : "json-curly-brackets"}">`;
  489. html += type === "array" ? "[]" : "{}";
  490. html += "</span>";
  491. }
  492. break;
  493. default:
  494. if (type === "string") {
  495. json = json.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
  496. }
  497. if (Utils.isUrl(json)) {
  498. html += `<a target="_blank" href="${json}" class="json-string">"${json}"</a>`;
  499. } else {
  500. json = type === "string" ? `"${json}"` : json;
  501. html += `<span class="json-${type}">${json}</span>`;
  502. }
  503. break;
  504. }
  505. return html;
  506. }
  507. $2.fn.jsonViewer = function(json, jsonpFn) {
  508. return this.each(function() {
  509. var html = json2html(json);
  510. if (jsonpFn !== void 0 && jsonpFn !== null) {
  511. html = `<div class="jsonp">${jsonpFn}(</div>${html}<div class="jsonp">)</div>`;
  512. }
  513. $2(this).html(html);
  514. $2(this).off("click");
  515. $2(this).on("click", "a.json-toggle", function() {
  516. var target = $2(this).toggleClass("collapsed").siblings("ul.json-object, ol.json-array");
  517. target.toggle();
  518. if (target.is(":visible")) {
  519. target.siblings(".json-placeholder").remove();
  520. } else {
  521. let clas = target.attr("class");
  522. clas = clas.substring(clas.indexOf("-") + 1);
  523. var count = target.children('li:not([class*="hidden"])').length;
  524. var placeholder = count + (count > 1 ? " items" : " item");
  525. if (clas === "object") {
  526. placeholder = count + (count > 1 ? " keys" : " key");
  527. }
  528. target.after(`<a href class="json-placeholder">${placeholder}</a>`);
  529. }
  530. return false;
  531. });
  532. $2(this).on("click", "a.json-placeholder", function() {
  533. $2(this).siblings("a.json-toggle").trigger("click");
  534. $2(this).siblings("a.json-placeholder").remove();
  535. return false;
  536. });
  537. });
  538. };
  539. })($);
  540. !function(e) {
  541. var t = {};
  542. function n(o) {
  543. if (t[o]) return t[o].exports;
  544. var i = t[o] = { i: o, l: false, exports: {} };
  545. return e[o].call(i.exports, i, i.exports, n), i.l = true, i.exports;
  546. }
  547. n.m = e, n.c = t, n.d = function(e2, t2, o) {
  548. n.o(e2, t2) || Object.defineProperty(e2, t2, { enumerable: true, get: o });
  549. }, n.r = function(e2) {
  550. "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e2, "__esModule", { value: true });
  551. }, n.t = function(e2, t2) {
  552. if (1 & t2 && (e2 = n(e2)), 8 & t2) return e2;
  553. if (4 & t2 && "object" == typeof e2 && e2 && e2.__esModule) return e2;
  554. var o = /* @__PURE__ */ Object.create(null);
  555. if (n.r(o), Object.defineProperty(o, "default", { enumerable: true, value: e2 }), 2 & t2 && "string" != typeof e2) for (var i in e2) n.d(o, i, (function(t3) {
  556. return e2[t3];
  557. }).bind(null, i));
  558. return o;
  559. }, n.n = function(e2) {
  560. var t2 = e2 && e2.__esModule ? function() {
  561. return e2.default;
  562. } : function() {
  563. return e2;
  564. };
  565. return n.d(t2, "a", t2), t2;
  566. }, n.o = function(e2, t2) {
  567. return Object.prototype.hasOwnProperty.call(e2, t2);
  568. }, n.p = "/dist", n(n.s = 5);
  569. }([function(e, t) {
  570. e.exports = $;
  571. }, function(e, t, n) {
  572. var o = n(2), i = n(3);
  573. "string" == typeof (i = i.__esModule ? i.default : i) && (i = [[e.i, i, ""]]);
  574. var a = { insert: "head", singleton: false };
  575. o(i, a);
  576. e.exports = i.locals || {};
  577. }, function(e, t, n) {
  578. var o, i = function() {
  579. return void 0 === o && (o = Boolean(window && document && document.all && !window.atob)), o;
  580. }, a = /* @__PURE__ */ function() {
  581. var e2 = {};
  582. return function(t2) {
  583. if (void 0 === e2[t2]) {
  584. var n2 = document.querySelector(t2);
  585. if (window.HTMLIFrameElement && n2 instanceof window.HTMLIFrameElement) try {
  586. n2 = n2.contentDocument.head;
  587. } catch (e3) {
  588. n2 = null;
  589. }
  590. e2[t2] = n2;
  591. }
  592. return e2[t2];
  593. };
  594. }(), r = [];
  595. function s(e2) {
  596. for (var t2 = -1, n2 = 0; n2 < r.length; n2++) if (r[n2].identifier === e2) {
  597. t2 = n2;
  598. break;
  599. }
  600. return t2;
  601. }
  602. function c(e2, t2) {
  603. for (var n2 = {}, o2 = [], i2 = 0; i2 < e2.length; i2++) {
  604. var a2 = e2[i2], c2 = t2.base ? a2[0] + t2.base : a2[0], l2 = n2[c2] || 0, u2 = "".concat(c2, " ").concat(l2);
  605. n2[c2] = l2 + 1;
  606. var d2 = s(u2), f2 = { css: a2[1], media: a2[2], sourceMap: a2[3] };
  607. -1 !== d2 ? (r[d2].references++, r[d2].updater(f2)) : r.push({ identifier: u2, updater: y(f2, t2), references: 1 }), o2.push(u2);
  608. }
  609. return o2;
  610. }
  611. function l(e2) {
  612. var t2 = document.createElement("style"), o2 = e2.attributes || {};
  613. if (void 0 === o2.nonce) {
  614. var i2 = n.nc;
  615. i2 && (o2.nonce = i2);
  616. }
  617. if (Object.keys(o2).forEach(function(e3) {
  618. t2.setAttribute(e3, o2[e3]);
  619. }), "function" == typeof e2.insert) e2.insert(t2);
  620. else {
  621. var r2 = a(e2.insert || "head");
  622. if (!r2) throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
  623. r2.appendChild(t2);
  624. }
  625. return t2;
  626. }
  627. var u, d = (u = [], function(e2, t2) {
  628. return u[e2] = t2, u.filter(Boolean).join("\n");
  629. });
  630. function f(e2, t2, n2, o2) {
  631. var i2 = n2 ? "" : o2.media ? "@media ".concat(o2.media, " {").concat(o2.css, "}") : o2.css;
  632. if (e2.styleSheet) e2.styleSheet.cssText = d(t2, i2);
  633. else {
  634. var a2 = document.createTextNode(i2), r2 = e2.childNodes;
  635. r2[t2] && e2.removeChild(r2[t2]), r2.length ? e2.insertBefore(a2, r2[t2]) : e2.appendChild(a2);
  636. }
  637. }
  638. function h(e2, t2, n2) {
  639. var o2 = n2.css, i2 = n2.media, a2 = n2.sourceMap;
  640. if (i2 ? e2.setAttribute("media", i2) : e2.removeAttribute("media"), a2 && btoa && (o2 += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a2)))), " */")), e2.styleSheet) e2.styleSheet.cssText = o2;
  641. else {
  642. for (; e2.firstChild; ) e2.removeChild(e2.firstChild);
  643. e2.appendChild(document.createTextNode(o2));
  644. }
  645. }
  646. var p = null, v = 0;
  647. function y(e2, t2) {
  648. var n2, o2, i2;
  649. if (t2.singleton) {
  650. var a2 = v++;
  651. n2 = p || (p = l(t2)), o2 = f.bind(null, n2, a2, false), i2 = f.bind(null, n2, a2, true);
  652. } else n2 = l(t2), o2 = h.bind(null, n2, t2), i2 = function() {
  653. !function(e3) {
  654. if (null === e3.parentNode) return false;
  655. e3.parentNode.removeChild(e3);
  656. }(n2);
  657. };
  658. return o2(e2), function(t3) {
  659. if (t3) {
  660. if (t3.css === e2.css && t3.media === e2.media && t3.sourceMap === e2.sourceMap) return;
  661. o2(e2 = t3);
  662. } else i2();
  663. };
  664. }
  665. e.exports = function(e2, t2) {
  666. (t2 = t2 || {}).singleton || "boolean" == typeof t2.singleton || (t2.singleton = i());
  667. var n2 = c(e2 = e2 || [], t2);
  668. return function(e3) {
  669. if (e3 = e3 || [], "[object Array]" === Object.prototype.toString.call(e3)) {
  670. for (var o2 = 0; o2 < n2.length; o2++) {
  671. var i2 = s(n2[o2]);
  672. r[i2].references--;
  673. }
  674. for (var a2 = c(e3, t2), l2 = 0; l2 < n2.length; l2++) {
  675. var u2 = s(n2[l2]);
  676. 0 === r[u2].references && (r[u2].updater(), r.splice(u2, 1));
  677. }
  678. n2 = a2;
  679. }
  680. };
  681. };
  682. }, function(e, t, n) {
  683. (t = n(4)(false)).push([e.i, ".simple-tree-table-icon{display:inline-block;width:1.5em;line-height:1.5em;margin:0.1em;background-color:#eee;text-align:center;cursor:pointer}.simple-tree-table-opened .simple-tree-table-icon:after{content:'-'}.simple-tree-table-closed .simple-tree-table-icon:after{content:'+'}\n", ""]), e.exports = t;
  684. }, function(e, t, n) {
  685. e.exports = function(e2) {
  686. var t2 = [];
  687. return t2.toString = function() {
  688. return this.map(function(t3) {
  689. var n2 = function(e3, t4) {
  690. var n3 = e3[1] || "", o = e3[3];
  691. if (!o) return n3;
  692. if (t4 && "function" == typeof btoa) {
  693. var i = (r = o, s = btoa(unescape(encodeURIComponent(JSON.stringify(r)))), c = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s), "/*# ".concat(c, " */")), a = o.sources.map(function(e4) {
  694. return "/*# sourceURL=".concat(o.sourceRoot || "").concat(e4, " */");
  695. });
  696. return [n3].concat(a).concat([i]).join("\n");
  697. }
  698. var r, s, c;
  699. return [n3].join("\n");
  700. }(t3, e2);
  701. return t3[2] ? "@media ".concat(t3[2], " {").concat(n2, "}") : n2;
  702. }).join("");
  703. }, t2.i = function(e3, n2, o) {
  704. "string" == typeof e3 && (e3 = [[null, e3, ""]]);
  705. var i = {};
  706. if (o) for (var a = 0; a < this.length; a++) {
  707. var r = this[a][0];
  708. null != r && (i[r] = true);
  709. }
  710. for (var s = 0; s < e3.length; s++) {
  711. var c = [].concat(e3[s]);
  712. o && i[c[0]] || (n2 && (c[2] ? c[2] = "".concat(n2, " and ").concat(c[2]) : c[2] = n2), t2.push(c));
  713. }
  714. }, t2;
  715. };
  716. }, function(e, t, n) {
  717. n.r(t);
  718. var o = n(0), i = n.n(o);
  719. function a(e2, t2) {
  720. if (!(e2 instanceof t2)) throw new TypeError("Cannot call a class as a function");
  721. }
  722. function r(e2, t2) {
  723. for (var n2 = 0; n2 < t2.length; n2++) {
  724. var o2 = t2[n2];
  725. o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, o2.key, o2);
  726. }
  727. }
  728. function s(e2, t2, n2) {
  729. return t2 && r(e2.prototype, t2), e2;
  730. }
  731. var c = function() {
  732. function e2() {
  733. var t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  734. a(this, e2), this.opts = { type: t2.type || "session", key: t2.key }, this.inst = new l(this.opts);
  735. }
  736. return s(e2, [{ key: "get", value: function() {
  737. var e3 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
  738. return this.inst.get(this.opts.key) || e3;
  739. } }, { key: "set", value: function(e3) {
  740. this.inst.set(this.opts.key, e3);
  741. } }, { key: "remove", value: function() {
  742. this.inst.remove(this.opts.key);
  743. } }]), e2;
  744. }(), l = function() {
  745. function e2() {
  746. var t2 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  747. a(this, e2), this.storage = { local: window.localStorage, session: window.sessionStorage }[t2.type];
  748. }
  749. return s(e2, [{ key: "get", value: function(e3) {
  750. try {
  751. var t2 = this.storage.getItem(e3);
  752. return t2 ? JSON.parse(t2) : null;
  753. } catch (e4) {
  754. return console.log(e4), null;
  755. }
  756. } }, { key: "set", value: function(e3, t2) {
  757. try {
  758. this.storage.setItem(e3, JSON.stringify(t2));
  759. } catch (e4) {
  760. console.log(e4);
  761. }
  762. } }, { key: "remove", value: function(e3) {
  763. this.storage.removeItem(e3);
  764. } }]), e2;
  765. }(), u = (n(1), "simple-tree-table");
  766. function d(e2, t2) {
  767. if (!(e2 instanceof t2)) throw new TypeError("Cannot call a class as a function");
  768. }
  769. function f(e2, t2) {
  770. for (var n2 = 0; n2 < t2.length; n2++) {
  771. var o2 = t2[n2];
  772. o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, o2.key, o2);
  773. }
  774. }
  775. var h = { expander: null, collapser: null, opened: "all", margin: 20, iconPosition: "> :first-child", iconTemplate: "<span />", store: null, storeKey: null }, p = function() {
  776. function e2(t3) {
  777. var n3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
  778. d(this, e2), this.options = i.a.extend({}, h, n3), this.$table = i()(t3), this.$expander = i()(this.options.expander), this.$collapser = i()(this.options.collapser), this.options.store && this.options.storeKey && (this.store = new c({ type: this.options.store, key: this.options.storeKey })), this.init(), this.load();
  779. }
  780. var t2, n2, o2;
  781. return t2 = e2, o2 = [{ key: "getDefaults", value: function() {
  782. return h;
  783. } }, { key: "setDefaults", value: function(e3) {
  784. return i.a.extend(h, e3);
  785. } }], (n2 = [{ key: "init", value: function() {
  786. this.$table.addClass(u), this.build(), this.unbind(), this.bind();
  787. } }, { key: "destroy", value: function() {
  788. var e3 = function(e4, t3) {
  789. var n3 = new RegExp("".concat(u, "(-\\S+)?"), "g");
  790. return (t3.match(n3) || []).join(" ");
  791. };
  792. this.$table.removeClass(e3), this.nodes().removeClass(e3), this.$table.find(".".concat(u, "-icon")).remove(), this.unbind();
  793. } }, { key: "build", value: function() {
  794. var e3 = this;
  795. this.nodes().not("[data-node-depth]").each(function(t3, n3) {
  796. var o3 = i()(n3), a2 = e3.depth(o3);
  797. o3.data("node-depth", a2), 1 == a2 && o3.addClass("".concat(u, "-root"));
  798. }), this.nodes().filter(function(t3, n3) {
  799. return 0 == i()(n3).find(e3.options.iconPosition).find(".".concat(u, "-handler")).length;
  800. }).each(function(t3, n3) {
  801. var o3 = i()(n3), a2 = e3.depth(o3), r2 = e3.options.margin * (a2 - 1), s2 = i()(e3.options.iconTemplate).addClass("".concat(u, "-handler ").concat(u, "-icon")).css("margin-left", "".concat(r2, "px"));
  802. o3.find(e3.options.iconPosition).prepend(s2);
  803. }), this.nodes().not(".".concat(u, "-empty, .").concat(u, "-opened, .").concat(u, "-closed")).each(function(t3, n3) {
  804. var o3 = i()(n3);
  805. e3.hasChildren(o3) ? e3.opensDefault(o3) ? o3.addClass("".concat(u, "-opened")) : o3.addClass("".concat(u, "-closed")) : o3.addClass("".concat(u, "-empty"));
  806. }), this.nodes().filter(".".concat(u, "-opened")).each(function(t3, n3) {
  807. e3.show(i()(n3));
  808. }), this.nodes().filter(".".concat(u, "-closed")).each(function(t3, n3) {
  809. e3.hide(i()(n3));
  810. });
  811. } }, { key: "opensDefault", value: function(e3) {
  812. var t3 = this.options.opened;
  813. return t3 && ("all" == t3 || -1 != t3.indexOf(e3.data("node-id")));
  814. } }, { key: "bind", value: function() {
  815. var e3 = this;
  816. this.$expander.on("click.".concat(u), function(t3) {
  817. e3.expand();
  818. }), this.$collapser.on("click.".concat(u), function(t3) {
  819. e3.collapse();
  820. }), this.$table.on("click.".concat(u), "tr .".concat(u, "-handler"), function(t3) {
  821. var n3 = i()(t3.currentTarget).closest("tr");
  822. n3.hasClass("".concat(u, "-opened")) ? e3.close(n3) : e3.open(n3);
  823. });
  824. } }, { key: "unbind", value: function() {
  825. this.$expander.off(".".concat(u)), this.$collapser.off(".".concat(u)), this.$table.off(".".concat(u, " node:open node:close"));
  826. } }, { key: "expand", value: function() {
  827. var e3 = this;
  828. this.nodes().each(function(t3, n3) {
  829. e3.show(i()(n3));
  830. }), this.save();
  831. } }, { key: "collapse", value: function() {
  832. var e3 = this;
  833. this.nodes().each(function(t3, n3) {
  834. e3.hide(i()(n3));
  835. }), this.save();
  836. } }, { key: "nodes", value: function() {
  837. return this.$table.find("tr[data-node-id]");
  838. } }, { key: "depth", value: function(e3) {
  839. var t3 = e3.data("node-depth");
  840. if (t3) return t3;
  841. var n3 = this.findByID(e3.data("node-pid"));
  842. return 0 != n3.length ? this.depth(n3) + 1 : 1;
  843. } }, { key: "open", value: function(e3) {
  844. this.show(e3), this.save(), e3.trigger("node:open", [e3]);
  845. } }, { key: "show", value: function(e3) {
  846. e3.hasClass("".concat(u, "-empty")) || (e3.removeClass("".concat(u, "-closed")).addClass("".concat(u, "-opened")), this.showDescs(e3));
  847. } }, { key: "showDescs", value: function(e3) {
  848. var t3 = this;
  849. this.findChildren(e3).each(function(e4, n3) {
  850. var o3 = i()(n3);
  851. o3.show(), o3.hasClass("".concat(u, "-opened")) && t3.showDescs(o3);
  852. });
  853. } }, { key: "close", value: function(e3) {
  854. this.hide(e3), this.save(), e3.trigger("node:close", [e3]);
  855. } }, { key: "hide", value: function(e3) {
  856. e3.hasClass("".concat(u, "-empty")) || (e3.removeClass("".concat(u, "-opened")).addClass("".concat(u, "-closed")), this.hideDescs(e3));
  857. } }, { key: "hideDescs", value: function(e3) {
  858. var t3 = this;
  859. this.findChildren(e3).each(function(e4, n3) {
  860. var o3 = i()(n3);
  861. o3.hide(), t3.hideDescs(o3);
  862. });
  863. } }, { key: "hasChildren", value: function(e3) {
  864. return 0 != this.findChildren(e3).length;
  865. } }, { key: "findChildren", value: function(e3) {
  866. var t3 = e3.data("node-id");
  867. return this.$table.find('tr[data-node-pid="'.concat(t3, '"]'));
  868. } }, { key: "findDescendants", value: function(e3) {
  869. var t3 = this, n3 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [], o3 = this.findChildren(e3);
  870. return n3.push(o3), o3.each(function(e4, o4) {
  871. t3.findDescendants(i()(o4), n3);
  872. }), n3;
  873. } }, { key: "findByID", value: function(e3) {
  874. return this.$table.find('tr[data-node-id="'.concat(e3, '"]'));
  875. } }, { key: "openByID", value: function(e3) {
  876. this.open(this.findByID(e3));
  877. } }, { key: "closeByID", value: function(e3) {
  878. this.close(this.findByID(e3));
  879. } }, { key: "load", value: function() {
  880. var e3 = this;
  881. if (this.store) {
  882. var t3 = this.store.get();
  883. t3 && (this.nodes().each(function(t4, n3) {
  884. e3.show(i()(n3));
  885. }), this.nodes().filter(function(e4, n3) {
  886. return -1 != t3.indexOf(i()(n3).data("node-id"));
  887. }).each(function(t4, n3) {
  888. e3.hide(i()(n3));
  889. }));
  890. }
  891. } }, { key: "save", value: function() {
  892. if (this.store) {
  893. var e3 = this.nodes().filter(".".concat(u, "-closed")).map(function(e4, t3) {
  894. return i()(t3).data("node-id");
  895. }).get();
  896. this.store.set(e3);
  897. }
  898. } }]) && f(t2.prototype, n2), o2 && f(t2, o2), e2;
  899. }();
  900. i.a.fn.simpleTreeTable = function(e2) {
  901. return this.each(function(t2, n2) {
  902. var o2 = i()(n2);
  903. o2.data(u) && o2.data(u).destroy(), o2.data(u, new p(o2, e2));
  904. });
  905. }, i.a.SimpleTreeTable = p;
  906. }]);
  907. function generateTrHtml(json, level = 0, pId = "", pChain = "") {
  908. let tr = "";
  909. for (const key in json) {
  910. let val = json[key];
  911. const type = Utils.getType(val);
  912. const chain = pChain + "." + key;
  913. const tId = key + "_" + Math.random();
  914. if (["array", "object"].includes(type)) {
  915. const res = generateTrHtml(val, level + 1, tId, chain);
  916. let brackets = "";
  917. if (!res) {
  918. if (type === "array") {
  919. brackets = `<span class="json-brackets json-square-brackets">[]</span>`;
  920. } else {
  921. brackets = `<span class="json-brackets json-curly-brackets">{}</span>`;
  922. }
  923. }
  924. tr += `
  925. <tr data-node-id="${tId}" data-node-pid="${pId}" type="${type}">
  926. <td colspan="${res ? 2 : ""}"
  927. json-path="${chain}"
  928. style="padding-left: ${level * 19}px">
  929. <b class="json-key">${key}:</b>
  930. <span class="node-len"></span>
  931. </td>
  932. <td>${brackets}</td>
  933. </tr>`;
  934. tr += res;
  935. } else {
  936. if (type === "string") {
  937. val = val.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
  938. }
  939. tr += `<tr data-node-id="${tId}" data-node-pid="${pId}" type="${type}">
  940. <td json-path="${chain}"
  941. style="padding-left: ${level * 19}px">
  942. <b class="json-key">${key}:</b>
  943. </td>`;
  944. if (Utils.isUrl(val)) {
  945. tr += `<td class="json-${type}"><a target="_blank" href="${val}">"${val}"</a></td>`;
  946. } else {
  947. val = type === "string" ? `"${val}"` : val;
  948. tr += `<td class="json-${type}">${val}</td>`;
  949. }
  950. tr += "</tr>";
  951. }
  952. }
  953. return tr;
  954. }
  955. const evnet = {
  956. /**
  957. * a标签鼠标移入,看是否是图片,是图片生成预览图
  958. * @returns this
  959. */
  960. urlHover: function() {
  961. $(document.body).on("mouseenter", "a[href]", function() {
  962. const href = $(this).attr("href");
  963. if (Utils.isImg(href)) {
  964. tippy(this, {
  965. duration: 800,
  966. content: `<img style="max-width: 500px;" src="${href}" />`,
  967. allowHTML: true,
  968. theme: "imagebox"
  969. }).show();
  970. }
  971. });
  972. return this;
  973. },
  974. /**
  975. * 鼠标移入key提示JSONPath
  976. * @returns this
  977. */
  978. tipsJsonPath: function() {
  979. const that = this;
  980. $(document.body).on("mouseenter", ".json-key", function() {
  981. const jsonPath = that.getJsonPath(this);
  982. const content = `<b>ctrl + 点击复制</b><br/>${jsonPath}`;
  983. tippy(this, {
  984. content,
  985. duration: 800,
  986. allowHTML: true,
  987. theme: "layer"
  988. }).show();
  989. });
  990. return that;
  991. },
  992. /**
  993. * 复制key的JSONPath
  994. * @returns
  995. */
  996. copyJsonPath: function() {
  997. const that = this;
  998. $(document.body).on("click", ".json-key", function(event) {
  999. if (event.ctrlKey) {
  1000. const jsonPath = that.getJsonPath(this);
  1001. _GM_setClipboard(jsonPath);
  1002. layer.msg("复制成功", { time: 1500 });
  1003. }
  1004. });
  1005. return that;
  1006. },
  1007. /**
  1008. * 给定HtmlElement获取JSONPath
  1009. * @param {*} element
  1010. * @returns
  1011. */
  1012. getJsonPath: function(element) {
  1013. const jsonPath = $(element).parent().attr("json-path");
  1014. const path = jsonPath.split(".");
  1015. path.splice(0, 1);
  1016. return path.reduce((prev, next) => {
  1017. return /^\d+$/.test(next) ? prev + `[${next}]` : prev + "." + next;
  1018. }, "Root");
  1019. },
  1020. init: function() {
  1021. this.urlHover().tipsJsonPath().copyJsonPath();
  1022. }
  1023. };
  1024. const $formatContainer = $("#formatContainer");
  1025. function onNodeOpen($node) {
  1026. $node.find(".node-len").html("");
  1027. }
  1028. function onNodeClose($node) {
  1029. const type = $node.attr("type");
  1030. const id = $node.data("node-id");
  1031. const length = $(`tr[data-node-pid="${id}"]:not(.hidden)`).length;
  1032. let content = `[ <span>${length}${length > 1 ? " items" : " item"}</span> ]`;
  1033. if (type === "object") {
  1034. content = `{ <span>${length}${length > 1 ? " keys" : " key"}</span> }`;
  1035. }
  1036. $node.find(".node-len").html(content);
  1037. }
  1038. const format_style = exports("default", {
  1039. /**
  1040. * 切换JSON 格式化风格
  1041. * @param {*} style 格式化风格,default/table
  1042. * @returns
  1043. */
  1044. changeStyle: function(style) {
  1045. layer.load(0, { shade: false });
  1046. _GM_setValue("style", style);
  1047. this.setStyle();
  1048. return this;
  1049. },
  1050. /**
  1051. * 设置JSON 格式化风格
  1052. * @returns
  1053. */
  1054. setStyle: function() {
  1055. const style = _GM_getValue("style") || "default";
  1056. $("input").val("");
  1057. $formatContainer.html("");
  1058. try {
  1059. if (style === "default") {
  1060. $formatContainer.jsonViewer(
  1061. _unsafeWindow.GLOBAL_JSON,
  1062. _unsafeWindow.GLOBAL_JSONP_FUN
  1063. );
  1064. return this;
  1065. }
  1066. this.tableFormat();
  1067. } finally {
  1068. try {
  1069. layer.closeAll();
  1070. } catch (error) {
  1071. }
  1072. }
  1073. },
  1074. /**
  1075. * JSON 表格格式化
  1076. */
  1077. tableFormat: function() {
  1078. const trHTML = generateTrHtml(_unsafeWindow.GLOBAL_JSON);
  1079. let appendHtml = `<table id="treeTable">${trHTML}</table>`;
  1080. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  1081. appendHtml = `
  1082. <div class="jsonp">${_unsafeWindow.GLOBAL_JSONP_FUN}(</div>
  1083. ${appendHtml}
  1084. <div class="jsonp">)</div>`;
  1085. }
  1086. $formatContainer.append(appendHtml);
  1087. setTimeout(() => {
  1088. const simpleTreeTable = $("#treeTable").simpleTreeTable({
  1089. expander: "#expandAll",
  1090. collapser: "#collapseAll"
  1091. }).on("node:open", (e, $node) => onNodeOpen($node)).on("node:close", (e, $node) => onNodeClose($node));
  1092. const arrow = $("tr:not(.simple-tree-table-empty)");
  1093. $(document.body).on("click", "#expandAll", function() {
  1094. arrow.each((i, node) => onNodeOpen($(node)));
  1095. });
  1096. $(document.body).on("click", "#collapseAll", function() {
  1097. arrow.each((i, node) => onNodeClose($(node)));
  1098. });
  1099. simpleTreeTable.on("click", ".node-len", function() {
  1100. const id = $(this).closest("tr").data("node-id");
  1101. simpleTreeTable.data("simple-tree-table").openByID(id);
  1102. });
  1103. });
  1104. $("#treeTable").on("mousedown", "tr", function(event) {
  1105. const { tagName } = event.target;
  1106. if (tagName === "A" || tagName === "SPAN" || event.ctrlKey) {
  1107. return;
  1108. }
  1109. $(".selected").not(this).removeClass("selected");
  1110. $(this).toggleClass("selected");
  1111. });
  1112. return this;
  1113. },
  1114. init: function() {
  1115. const that = this;
  1116. that.setStyle();
  1117. evnet.init();
  1118. window.addEventListener("message", function(event) {
  1119. const { data } = event;
  1120. if (!data) {
  1121. return;
  1122. }
  1123. if (data.reload) {
  1124. that.setStyle();
  1125. return;
  1126. }
  1127. const { type, value } = data;
  1128. if (type === "style") {
  1129. that.changeStyle(value);
  1130. return;
  1131. }
  1132. });
  1133. }
  1134. });
  1135.  
  1136. })
  1137. };
  1138. }));
  1139.  
  1140. System.register("./index-BF1lJinC-Bkz7tWrF.js", ['jquery', './tippy.esm-Ot9MORvr-DNGa7Opj.js', 'jsmind', './__monkey.entry-ClII6pV-.js'], (function (exports, module) {
  1141. 'use strict';
  1142. var $, tippy, require$$0, _unsafeWindow, Utils, _GM_setClipboard, _GM_getValue, URL$1, _GM_setValue;
  1143. return {
  1144. setters: [module => {
  1145. $ = module.default;
  1146. }, module => {
  1147. tippy = module.t;
  1148. }, module => {
  1149. require$$0 = module.default;
  1150. }, module => {
  1151. _unsafeWindow = module.b;
  1152. Utils = module.U;
  1153. _GM_setClipboard = module.c;
  1154. _GM_getValue = module.a;
  1155. URL$1 = module.d;
  1156. _GM_setValue = module._;
  1157. }],
  1158. execute: (function () {
  1159.  
  1160. var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  1161. var domToImage = { exports: {} };
  1162. var hasRequiredDomToImage;
  1163. function requireDomToImage() {
  1164. if (hasRequiredDomToImage) return domToImage.exports;
  1165. hasRequiredDomToImage = 1;
  1166. (function(module) {
  1167. (function(global2) {
  1168. var util = newUtil();
  1169. var inliner = newInliner();
  1170. var fontFaces = newFontFaces();
  1171. var images = newImages();
  1172. var defaultOptions = {
  1173. // Default is to fail on error, no placeholder
  1174. imagePlaceholder: void 0,
  1175. // Default cache bust is false, it will use the cache
  1176. cacheBust: false
  1177. };
  1178. var domtoimage = {
  1179. toSvg,
  1180. toPng,
  1181. toJpeg,
  1182. toBlob,
  1183. toPixelData,
  1184. impl: {
  1185. fontFaces,
  1186. images,
  1187. util,
  1188. inliner,
  1189. options: {}
  1190. }
  1191. };
  1192. module.exports = domtoimage;
  1193. function toSvg(node, options) {
  1194. options = options || {};
  1195. copyOptions(options);
  1196. return Promise.resolve(node).then(function(node2) {
  1197. return cloneNode(node2, options.filter, true);
  1198. }).then(embedFonts).then(inlineImages).then(applyOptions).then(function(clone) {
  1199. return makeSvgDataUri(
  1200. clone,
  1201. options.width || util.width(node),
  1202. options.height || util.height(node)
  1203. );
  1204. });
  1205. function applyOptions(clone) {
  1206. if (options.bgcolor) clone.style.backgroundColor = options.bgcolor;
  1207. if (options.width) clone.style.width = options.width + "px";
  1208. if (options.height) clone.style.height = options.height + "px";
  1209. if (options.style)
  1210. Object.keys(options.style).forEach(function(property) {
  1211. clone.style[property] = options.style[property];
  1212. });
  1213. return clone;
  1214. }
  1215. }
  1216. function toPixelData(node, options) {
  1217. return draw(node, options || {}).then(function(canvas) {
  1218. return canvas.getContext("2d").getImageData(
  1219. 0,
  1220. 0,
  1221. util.width(node),
  1222. util.height(node)
  1223. ).data;
  1224. });
  1225. }
  1226. function toPng(node, options) {
  1227. return draw(node, options || {}).then(function(canvas) {
  1228. return canvas.toDataURL();
  1229. });
  1230. }
  1231. function toJpeg(node, options) {
  1232. options = options || {};
  1233. return draw(node, options).then(function(canvas) {
  1234. return canvas.toDataURL("image/jpeg", options.quality || 1);
  1235. });
  1236. }
  1237. function toBlob(node, options) {
  1238. return draw(node, options || {}).then(util.canvasToBlob);
  1239. }
  1240. function copyOptions(options) {
  1241. if (typeof options.imagePlaceholder === "undefined") {
  1242. domtoimage.impl.options.imagePlaceholder = defaultOptions.imagePlaceholder;
  1243. } else {
  1244. domtoimage.impl.options.imagePlaceholder = options.imagePlaceholder;
  1245. }
  1246. if (typeof options.cacheBust === "undefined") {
  1247. domtoimage.impl.options.cacheBust = defaultOptions.cacheBust;
  1248. } else {
  1249. domtoimage.impl.options.cacheBust = options.cacheBust;
  1250. }
  1251. }
  1252. function draw(domNode, options) {
  1253. return toSvg(domNode, options).then(util.makeImage).then(util.delay(100)).then(function(image) {
  1254. var canvas = newCanvas(domNode);
  1255. canvas.getContext("2d").drawImage(image, 0, 0);
  1256. return canvas;
  1257. });
  1258. function newCanvas(domNode2) {
  1259. var canvas = document.createElement("canvas");
  1260. canvas.width = options.width || util.width(domNode2);
  1261. canvas.height = options.height || util.height(domNode2);
  1262. if (options.bgcolor) {
  1263. var ctx = canvas.getContext("2d");
  1264. ctx.fillStyle = options.bgcolor;
  1265. ctx.fillRect(0, 0, canvas.width, canvas.height);
  1266. }
  1267. return canvas;
  1268. }
  1269. }
  1270. function cloneNode(node, filter2, root) {
  1271. if (!root && filter2 && !filter2(node)) return Promise.resolve();
  1272. return Promise.resolve(node).then(makeNodeCopy).then(function(clone) {
  1273. return cloneChildren(node, clone, filter2);
  1274. }).then(function(clone) {
  1275. return processClone(node, clone);
  1276. });
  1277. function makeNodeCopy(node2) {
  1278. if (node2 instanceof HTMLCanvasElement) return util.makeImage(node2.toDataURL());
  1279. return node2.cloneNode(false);
  1280. }
  1281. function cloneChildren(original, clone, filter3) {
  1282. var children = original.childNodes;
  1283. if (children.length === 0) return Promise.resolve(clone);
  1284. return cloneChildrenInOrder(clone, util.asArray(children), filter3).then(function() {
  1285. return clone;
  1286. });
  1287. function cloneChildrenInOrder(parent, children2, filter4) {
  1288. var done = Promise.resolve();
  1289. children2.forEach(function(child) {
  1290. done = done.then(function() {
  1291. return cloneNode(child, filter4);
  1292. }).then(function(childClone) {
  1293. if (childClone) parent.appendChild(childClone);
  1294. });
  1295. });
  1296. return done;
  1297. }
  1298. }
  1299. function processClone(original, clone) {
  1300. if (!(clone instanceof Element)) return clone;
  1301. return Promise.resolve().then(cloneStyle).then(clonePseudoElements).then(copyUserInput).then(fixSvg).then(function() {
  1302. return clone;
  1303. });
  1304. function cloneStyle() {
  1305. copyStyle(window.getComputedStyle(original), clone.style);
  1306. function copyStyle(source, target) {
  1307. if (source.cssText) target.cssText = source.cssText;
  1308. else copyProperties(source, target);
  1309. function copyProperties(source2, target2) {
  1310. util.asArray(source2).forEach(function(name) {
  1311. target2.setProperty(
  1312. name,
  1313. source2.getPropertyValue(name),
  1314. source2.getPropertyPriority(name)
  1315. );
  1316. });
  1317. }
  1318. }
  1319. }
  1320. function clonePseudoElements() {
  1321. [":before", ":after"].forEach(function(element) {
  1322. clonePseudoElement(element);
  1323. });
  1324. function clonePseudoElement(element) {
  1325. var style = window.getComputedStyle(original, element);
  1326. var content = style.getPropertyValue("content");
  1327. if (content === "" || content === "none") return;
  1328. var className = util.uid();
  1329. clone.className = clone.className + " " + className;
  1330. var styleElement = document.createElement("style");
  1331. styleElement.appendChild(formatPseudoElementStyle(className, element, style));
  1332. clone.appendChild(styleElement);
  1333. function formatPseudoElementStyle(className2, element2, style2) {
  1334. var selector = "." + className2 + ":" + element2;
  1335. var cssText = style2.cssText ? formatCssText(style2) : formatCssProperties(style2);
  1336. return document.createTextNode(selector + "{" + cssText + "}");
  1337. function formatCssText(style3) {
  1338. var content2 = style3.getPropertyValue("content");
  1339. return style3.cssText + " content: " + content2 + ";";
  1340. }
  1341. function formatCssProperties(style3) {
  1342. return util.asArray(style3).map(formatProperty).join("; ") + ";";
  1343. function formatProperty(name) {
  1344. return name + ": " + style3.getPropertyValue(name) + (style3.getPropertyPriority(name) ? " !important" : "");
  1345. }
  1346. }
  1347. }
  1348. }
  1349. }
  1350. function copyUserInput() {
  1351. if (original instanceof HTMLTextAreaElement) clone.innerHTML = original.value;
  1352. if (original instanceof HTMLInputElement) clone.setAttribute("value", original.value);
  1353. }
  1354. function fixSvg() {
  1355. if (!(clone instanceof SVGElement)) return;
  1356. clone.setAttribute("xmlns", "http://www.w3.org/2000/svg");
  1357. if (!(clone instanceof SVGRectElement)) return;
  1358. ["width", "height"].forEach(function(attribute) {
  1359. var value = clone.getAttribute(attribute);
  1360. if (!value) return;
  1361. clone.style.setProperty(attribute, value);
  1362. });
  1363. }
  1364. }
  1365. }
  1366. function embedFonts(node) {
  1367. return fontFaces.resolveAll().then(function(cssText) {
  1368. var styleNode = document.createElement("style");
  1369. node.appendChild(styleNode);
  1370. styleNode.appendChild(document.createTextNode(cssText));
  1371. return node;
  1372. });
  1373. }
  1374. function inlineImages(node) {
  1375. return images.inlineAll(node).then(function() {
  1376. return node;
  1377. });
  1378. }
  1379. function makeSvgDataUri(node, width, height) {
  1380. return Promise.resolve(node).then(function(node2) {
  1381. node2.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
  1382. return new XMLSerializer().serializeToString(node2);
  1383. }).then(util.escapeXhtml).then(function(xhtml) {
  1384. return '<foreignObject x="0" y="0" width="100%" height="100%">' + xhtml + "</foreignObject>";
  1385. }).then(function(foreignObject) {
  1386. return '<svg xmlns="http://www.w3.org/2000/svg" width="' + width + '" height="' + height + '">' + foreignObject + "</svg>";
  1387. }).then(function(svg) {
  1388. return "data:image/svg+xml;charset=utf-8," + svg;
  1389. });
  1390. }
  1391. function newUtil() {
  1392. return {
  1393. escape,
  1394. parseExtension,
  1395. mimeType,
  1396. dataAsUrl,
  1397. isDataUrl,
  1398. canvasToBlob,
  1399. resolveUrl,
  1400. getAndEncode,
  1401. uid: uid(),
  1402. delay,
  1403. asArray,
  1404. escapeXhtml,
  1405. makeImage,
  1406. width,
  1407. height
  1408. };
  1409. function mimes() {
  1410. var WOFF = "application/font-woff";
  1411. var JPEG = "image/jpeg";
  1412. return {
  1413. "woff": WOFF,
  1414. "woff2": WOFF,
  1415. "ttf": "application/font-truetype",
  1416. "eot": "application/vnd.ms-fontobject",
  1417. "png": "image/png",
  1418. "jpg": JPEG,
  1419. "jpeg": JPEG,
  1420. "gif": "image/gif",
  1421. "tiff": "image/tiff",
  1422. "svg": "image/svg+xml"
  1423. };
  1424. }
  1425. function parseExtension(url) {
  1426. var match = /\.([^\.\/]*?)$/g.exec(url);
  1427. if (match) return match[1];
  1428. else return "";
  1429. }
  1430. function mimeType(url) {
  1431. var extension = parseExtension(url).toLowerCase();
  1432. return mimes()[extension] || "";
  1433. }
  1434. function isDataUrl(url) {
  1435. return url.search(/^(data:)/) !== -1;
  1436. }
  1437. function toBlob2(canvas) {
  1438. return new Promise(function(resolve) {
  1439. var binaryString = window.atob(canvas.toDataURL().split(",")[1]);
  1440. var length = binaryString.length;
  1441. var binaryArray = new Uint8Array(length);
  1442. for (var i = 0; i < length; i++)
  1443. binaryArray[i] = binaryString.charCodeAt(i);
  1444. resolve(new Blob([binaryArray], {
  1445. type: "image/png"
  1446. }));
  1447. });
  1448. }
  1449. function canvasToBlob(canvas) {
  1450. if (canvas.toBlob)
  1451. return new Promise(function(resolve) {
  1452. canvas.toBlob(resolve);
  1453. });
  1454. return toBlob2(canvas);
  1455. }
  1456. function resolveUrl(url, baseUrl) {
  1457. var doc = document.implementation.createHTMLDocument();
  1458. var base = doc.createElement("base");
  1459. doc.head.appendChild(base);
  1460. var a = doc.createElement("a");
  1461. doc.body.appendChild(a);
  1462. base.href = baseUrl;
  1463. a.href = url;
  1464. return a.href;
  1465. }
  1466. function uid() {
  1467. var index = 0;
  1468. return function() {
  1469. return "u" + fourRandomChars() + index++;
  1470. function fourRandomChars() {
  1471. return ("0000" + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);
  1472. }
  1473. };
  1474. }
  1475. function makeImage(uri) {
  1476. return new Promise(function(resolve, reject) {
  1477. var image = new Image();
  1478. image.onload = function() {
  1479. resolve(image);
  1480. };
  1481. image.onerror = reject;
  1482. image.src = uri;
  1483. });
  1484. }
  1485. function getAndEncode(url) {
  1486. var TIMEOUT = 3e4;
  1487. if (domtoimage.impl.options.cacheBust) {
  1488. url += (/\?/.test(url) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime();
  1489. }
  1490. return new Promise(function(resolve) {
  1491. var request = new XMLHttpRequest();
  1492. request.onreadystatechange = done;
  1493. request.ontimeout = timeout;
  1494. request.responseType = "blob";
  1495. request.timeout = TIMEOUT;
  1496. request.open("GET", url, true);
  1497. request.send();
  1498. var placeholder;
  1499. if (domtoimage.impl.options.imagePlaceholder) {
  1500. var split = domtoimage.impl.options.imagePlaceholder.split(/,/);
  1501. if (split && split[1]) {
  1502. placeholder = split[1];
  1503. }
  1504. }
  1505. function done() {
  1506. if (request.readyState !== 4) return;
  1507. if (request.status !== 200) {
  1508. if (placeholder) {
  1509. resolve(placeholder);
  1510. } else {
  1511. fail("cannot fetch resource: " + url + ", status: " + request.status);
  1512. }
  1513. return;
  1514. }
  1515. var encoder = new FileReader();
  1516. encoder.onloadend = function() {
  1517. var content = encoder.result.split(/,/)[1];
  1518. resolve(content);
  1519. };
  1520. encoder.readAsDataURL(request.response);
  1521. }
  1522. function timeout() {
  1523. if (placeholder) {
  1524. resolve(placeholder);
  1525. } else {
  1526. fail("timeout of " + TIMEOUT + "ms occured while fetching resource: " + url);
  1527. }
  1528. }
  1529. function fail(message) {
  1530. console.error(message);
  1531. resolve("");
  1532. }
  1533. });
  1534. }
  1535. function dataAsUrl(content, type) {
  1536. return "data:" + type + ";base64," + content;
  1537. }
  1538. function escape(string) {
  1539. return string.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
  1540. }
  1541. function delay(ms) {
  1542. return function(arg) {
  1543. return new Promise(function(resolve) {
  1544. setTimeout(function() {
  1545. resolve(arg);
  1546. }, ms);
  1547. });
  1548. };
  1549. }
  1550. function asArray(arrayLike) {
  1551. var array = [];
  1552. var length = arrayLike.length;
  1553. for (var i = 0; i < length; i++) array.push(arrayLike[i]);
  1554. return array;
  1555. }
  1556. function escapeXhtml(string) {
  1557. return string.replace(/#/g, "%23").replace(/\n/g, "%0A");
  1558. }
  1559. function width(node) {
  1560. var leftBorder = px(node, "border-left-width");
  1561. var rightBorder = px(node, "border-right-width");
  1562. return node.scrollWidth + leftBorder + rightBorder;
  1563. }
  1564. function height(node) {
  1565. var topBorder = px(node, "border-top-width");
  1566. var bottomBorder = px(node, "border-bottom-width");
  1567. return node.scrollHeight + topBorder + bottomBorder;
  1568. }
  1569. function px(node, styleProperty) {
  1570. var value = window.getComputedStyle(node).getPropertyValue(styleProperty);
  1571. return parseFloat(value.replace("px", ""));
  1572. }
  1573. }
  1574. function newInliner() {
  1575. var URL_REGEX = /url\(['"]?([^'"]+?)['"]?\)/g;
  1576. return {
  1577. inlineAll,
  1578. shouldProcess,
  1579. impl: {
  1580. readUrls,
  1581. inline
  1582. }
  1583. };
  1584. function shouldProcess(string) {
  1585. return string.search(URL_REGEX) !== -1;
  1586. }
  1587. function readUrls(string) {
  1588. var result = [];
  1589. var match;
  1590. while ((match = URL_REGEX.exec(string)) !== null) {
  1591. result.push(match[1]);
  1592. }
  1593. return result.filter(function(url) {
  1594. return !util.isDataUrl(url);
  1595. });
  1596. }
  1597. function inline(string, url, baseUrl, get) {
  1598. return Promise.resolve(url).then(function(url2) {
  1599. return baseUrl ? util.resolveUrl(url2, baseUrl) : url2;
  1600. }).then(get || util.getAndEncode).then(function(data) {
  1601. return util.dataAsUrl(data, util.mimeType(url));
  1602. }).then(function(dataUrl) {
  1603. return string.replace(urlAsRegex(url), "$1" + dataUrl + "$3");
  1604. });
  1605. function urlAsRegex(url2) {
  1606. return new RegExp(`(url\\(['"]?)(` + util.escape(url2) + `)(['"]?\\))`, "g");
  1607. }
  1608. }
  1609. function inlineAll(string, baseUrl, get) {
  1610. if (nothingToInline()) return Promise.resolve(string);
  1611. return Promise.resolve(string).then(readUrls).then(function(urls) {
  1612. var done = Promise.resolve(string);
  1613. urls.forEach(function(url) {
  1614. done = done.then(function(string2) {
  1615. return inline(string2, url, baseUrl, get);
  1616. });
  1617. });
  1618. return done;
  1619. });
  1620. function nothingToInline() {
  1621. return !shouldProcess(string);
  1622. }
  1623. }
  1624. }
  1625. function newFontFaces() {
  1626. return {
  1627. resolveAll,
  1628. impl: {
  1629. readAll
  1630. }
  1631. };
  1632. function resolveAll() {
  1633. return readAll().then(function(webFonts) {
  1634. return Promise.all(
  1635. webFonts.map(function(webFont) {
  1636. return webFont.resolve();
  1637. })
  1638. );
  1639. }).then(function(cssStrings) {
  1640. return cssStrings.join("\n");
  1641. });
  1642. }
  1643. function readAll() {
  1644. return Promise.resolve(util.asArray(document.styleSheets)).then(getCssRules).then(selectWebFontRules).then(function(rules) {
  1645. return rules.map(newWebFont);
  1646. });
  1647. function selectWebFontRules(cssRules) {
  1648. return cssRules.filter(function(rule) {
  1649. return rule.type === CSSRule.FONT_FACE_RULE;
  1650. }).filter(function(rule) {
  1651. return inliner.shouldProcess(rule.style.getPropertyValue("src"));
  1652. });
  1653. }
  1654. function getCssRules(styleSheets) {
  1655. var cssRules = [];
  1656. styleSheets.forEach(function(sheet) {
  1657. try {
  1658. util.asArray(sheet.cssRules || []).forEach(cssRules.push.bind(cssRules));
  1659. } catch (e) {
  1660. console.log("Error while reading CSS rules from " + sheet.href, e.toString());
  1661. }
  1662. });
  1663. return cssRules;
  1664. }
  1665. function newWebFont(webFontRule) {
  1666. return {
  1667. resolve: function resolve() {
  1668. var baseUrl = (webFontRule.parentStyleSheet || {}).href;
  1669. return inliner.inlineAll(webFontRule.cssText, baseUrl);
  1670. },
  1671. src: function() {
  1672. return webFontRule.style.getPropertyValue("src");
  1673. }
  1674. };
  1675. }
  1676. }
  1677. }
  1678. function newImages() {
  1679. return {
  1680. inlineAll,
  1681. impl: {
  1682. newImage
  1683. }
  1684. };
  1685. function newImage(element) {
  1686. return {
  1687. inline
  1688. };
  1689. function inline(get) {
  1690. if (util.isDataUrl(element.src)) return Promise.resolve();
  1691. return Promise.resolve(element.src).then(get || util.getAndEncode).then(function(data) {
  1692. return util.dataAsUrl(data, util.mimeType(element.src));
  1693. }).then(function(dataUrl) {
  1694. return new Promise(function(resolve, reject) {
  1695. element.onload = resolve;
  1696. element.onerror = reject;
  1697. element.src = dataUrl;
  1698. });
  1699. });
  1700. }
  1701. }
  1702. function inlineAll(node) {
  1703. if (!(node instanceof Element)) return Promise.resolve(node);
  1704. return inlineBackground(node).then(function() {
  1705. if (node instanceof HTMLImageElement)
  1706. return newImage(node).inline();
  1707. else
  1708. return Promise.all(
  1709. util.asArray(node.childNodes).map(function(child) {
  1710. return inlineAll(child);
  1711. })
  1712. );
  1713. });
  1714. function inlineBackground(node2) {
  1715. var background = node2.style.getPropertyValue("background");
  1716. if (!background) return Promise.resolve(node2);
  1717. return inliner.inlineAll(background).then(function(inlined) {
  1718. node2.style.setProperty(
  1719. "background",
  1720. inlined,
  1721. node2.style.getPropertyPriority("background")
  1722. );
  1723. }).then(function() {
  1724. return node2;
  1725. });
  1726. }
  1727. }
  1728. }
  1729. })();
  1730. })(domToImage);
  1731. return domToImage.exports;
  1732. }
  1733. /**
  1734. * @license BSD-3-Clause
  1735. * @copyright 2014-2023 hizzgdev@163.com
  1736. *
  1737. * Project Home:
  1738. * https://github.com/hizzgdev/jsmind/
  1739. */
  1740. (function(module, exports) {
  1741. !function(e, t) {
  1742. t(require$$0, requireDomToImage());
  1743. }(commonjsGlobal, function(e, t) {
  1744. function i(e2) {
  1745. return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
  1746. }
  1747. var n = i(e), o = i(t);
  1748. if (!n.default) throw new Error("jsMind is not defined");
  1749. if (!o.default) throw new Error("dom-to-image is required");
  1750. const r = n.default.$, s = { filename: null, watermark: { left: r.w.location, right: "https://github.com/hizzgdev/jsmind" }, background: "transparent" };
  1751. class a {
  1752. constructor(e2, t2) {
  1753. var i2 = {};
  1754. 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;
  1755. }
  1756. shoot() {
  1757. let e2 = this.create_canvas(), t2 = e2.getContext("2d");
  1758. 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));
  1759. }
  1760. create_canvas() {
  1761. let e2 = r.c("canvas");
  1762. const t2 = this.jm.view.size.w, i2 = this.jm.view.size.h;
  1763. 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;
  1764. }
  1765. clear(e2) {
  1766. e2.parentNode.removeChild(e2);
  1767. }
  1768. draw_background(e2) {
  1769. return new Promise((function(t2, i2) {
  1770. const n2 = this.options.background;
  1771. n2 && "transparent" !== n2 && (e2.fillStyle = this.options.background, e2.fillRect(0, 0, this.jm.view.size.w, this.jm.view.size.h)), t2(e2);
  1772. }).bind(this));
  1773. }
  1774. draw_lines(e2) {
  1775. return new Promise((function(t2, i2) {
  1776. this.jm.view.graph.copy_to(e2, function() {
  1777. t2(e2);
  1778. });
  1779. }).bind(this));
  1780. }
  1781. draw_nodes(e2) {
  1782. return o.default.toSvg(this.jm.view.e_nodes, { style: { zoom: 1 } }).then(this.load_image).then(function(t2) {
  1783. return e2.drawImage(t2, 0, 0), e2;
  1784. });
  1785. }
  1786. draw_watermark(e2, t2) {
  1787. 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;
  1788. }
  1789. load_image(e2) {
  1790. return new Promise(function(t2, i2) {
  1791. let n2 = new Image();
  1792. n2.onload = function() {
  1793. t2(n2);
  1794. }, n2.onerror = i2, n2.src = e2;
  1795. });
  1796. }
  1797. download(e2) {
  1798. var t2 = (this.options.filename || this.jm.mind.name) + ".png";
  1799. if (navigator.msSaveBlob && e2.msToBlob) {
  1800. var i2 = e2.msToBlob();
  1801. navigator.msSaveBlob(i2, t2);
  1802. } else {
  1803. var n2 = e2.toDataURL(), o2 = r.c("a");
  1804. if ("download" in o2) {
  1805. o2.style.visibility = "hidden", o2.href = n2, o2.download = t2, r.d.body.appendChild(o2);
  1806. var s2 = r.d.createEvent("MouseEvents");
  1807. s2.initEvent("click", true, true), o2.dispatchEvent(s2), r.d.body.removeChild(o2);
  1808. } else location.href = n2;
  1809. }
  1810. }
  1811. }
  1812. let d = new n.default.plugin("screenshot", function(e2, t2) {
  1813. var i2 = new a(e2, t2);
  1814. e2.screenshot = i2, e2.shoot = function() {
  1815. i2.shoot();
  1816. };
  1817. });
  1818. n.default.register_plugin(d);
  1819. });
  1820. })();
  1821. const jsonMind = {
  1822. isFirst: true,
  1823. /**
  1824. * JSON数据转换为jsMind所需要的数据结构
  1825. * @param {*} json JSON 数据
  1826. * @returns
  1827. */
  1828. convert: function(json2) {
  1829. const children = [];
  1830. if (typeof json2 === "object") {
  1831. for (const key in json2) {
  1832. let val = json2[key], isArray = Array.isArray(val);
  1833. const type = Utils.getPrototype(val);
  1834. if (isArray && val.length > 0) {
  1835. val = Utils.findMaxKeysObject(val);
  1836. }
  1837. children.push({
  1838. isArray,
  1839. chain: key,
  1840. id: key + "_" + Math.random(),
  1841. topic: `${key}<span class="datatype">${type}</span>`,
  1842. children: this.convert(val)
  1843. });
  1844. }
  1845. }
  1846. return children;
  1847. },
  1848. /**
  1849. * 脑图节点调用链
  1850. * @param {*} node 脑图节点对象
  1851. * @returns
  1852. */
  1853. mindChain: function(node) {
  1854. let chain = node.data.chain;
  1855. if (!node.parent) {
  1856. return chain;
  1857. }
  1858. const parent = node.parent;
  1859. const parentChain = this.mindChain(parent);
  1860. chain = parent.data.isArray ? `${parentChain}[i].${chain}` : `${parentChain}.${chain}`;
  1861. return chain;
  1862. },
  1863. /**
  1864. * 显示脑图
  1865. * @param {*} json JSON 数据
  1866. * @returns
  1867. */
  1868. show: function(json2) {
  1869. let isArr = Array.isArray(json2);
  1870. if (isArr) {
  1871. if (typeof json2[0] !== "object") {
  1872. layer.msg("数据结构无法生成脑图", { time: 1e3 });
  1873. return this;
  1874. }
  1875. json2 = Utils.findMaxKeysObject(json2);
  1876. }
  1877. if (!this.isFirst) {
  1878. return this;
  1879. }
  1880. _unsafeWindow.GLOBAL_JSMIND.show({
  1881. meta: {
  1882. version: "1.0",
  1883. name: "JSON脑图",
  1884. author: "1220301855@qq.com"
  1885. },
  1886. format: "node_tree",
  1887. /* 数据内容 */
  1888. data: {
  1889. id: "root",
  1890. topic: "Root",
  1891. direction: "left",
  1892. children: this.convert(json2),
  1893. chain: isArr ? "Root[i]" : "Root"
  1894. }
  1895. });
  1896. this.isFirst = false;
  1897. return this;
  1898. },
  1899. /**
  1900. * 脑图节点事件
  1901. * @returns
  1902. */
  1903. event: function() {
  1904. const jsonMind2 = this;
  1905. $(document.body).on("dblclick mouseover", "jmnode", function(event2) {
  1906. const nodeid = $(this).attr("nodeid");
  1907. const node = _unsafeWindow.GLOBAL_JSMIND.get_node(nodeid);
  1908. if (!node.parent) {
  1909. return;
  1910. }
  1911. if (event2.type === "dblclick") {
  1912. _GM_setClipboard(jsonMind2.mindChain(node));
  1913. layer.msg("节点路径复制成功", { time: 1500 });
  1914. } else {
  1915. const chain = jsonMind2.mindChain(node);
  1916. const content = `<b>节点路径(双击复制)</b><br/>${chain}`;
  1917. tippy(this, {
  1918. content,
  1919. duration: 800,
  1920. allowHTML: true,
  1921. theme: "layer"
  1922. }).show();
  1923. }
  1924. });
  1925. return this;
  1926. },
  1927. init: function(json2) {
  1928. if (!_unsafeWindow.GLOBAL_JSMIND) {
  1929. _unsafeWindow.GLOBAL_JSMIND = new require$$0({
  1930. mode: "side",
  1931. editable: false,
  1932. container: "jmContainer",
  1933. view: {
  1934. hmargin: 50,
  1935. // 思维导图距容器外框的最小水平距离
  1936. vmargin: 50,
  1937. // 思维导图距容器外框的最小垂直距离
  1938. engine: "svg",
  1939. // 思维导图各节点之间线条的绘制引擎
  1940. draggable: true,
  1941. // 当容器不能完全容纳思维导图时,是否允许拖动画布代替鼠标滚动
  1942. support_html: false,
  1943. line_color: "#C4C9D0"
  1944. },
  1945. zoom: {
  1946. // 配置缩放
  1947. min: 0.1,
  1948. // 最小的缩放比例
  1949. max: 2.1,
  1950. // 最大的缩放比例
  1951. step: 0.1
  1952. // 缩放比例间隔
  1953. },
  1954. layout: {
  1955. vspace: 7,
  1956. // 节点之间的垂直间距
  1957. hspace: 150
  1958. // 节点之间的水平空间
  1959. }
  1960. });
  1961. }
  1962. this.show(json2).event();
  1963. }
  1964. };
  1965. const $jmContainer = $("#jmContainer");
  1966. const $formatContainer = $("#formatContainer");
  1967. const $rawTextContainer = $("#rawTextContainer");
  1968. const tabsEvent = {
  1969. firstFormat: true,
  1970. isBeautify: false,
  1971. $rawTextPre: $rawTextContainer.find("pre"),
  1972. /**
  1973. * 原始数据
  1974. */
  1975. _setRawText: function() {
  1976. let rawText2 = _unsafeWindow.RAW_TEXT;
  1977. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  1978. rawText2 = `${_unsafeWindow.GLOBAL_JSONP_FUN}(${rawText2})`;
  1979. }
  1980. this.$rawTextPre.text(rawText2);
  1981. },
  1982. /**
  1983. * 保存为文件
  1984. * 如果是JSON 格式化可见,保存JSON数据为.json文件
  1985. * 如果是JSON 脑图可见,保存脑图为图片
  1986. */
  1987. saveJson: function() {
  1988. if ($jmContainer.is(":visible")) {
  1989. _unsafeWindow.GLOBAL_JSMIND.shoot();
  1990. return;
  1991. }
  1992. const content = this.$rawTextPre.text() || _unsafeWindow.RAW_TEXT;
  1993. const filename = (/* @__PURE__ */ new Date()).getTime() + ".json";
  1994. Utils.downloadText(content, filename);
  1995. },
  1996. /**
  1997. * 复制JSON文本内容
  1998. */
  1999. copyJson: function() {
  2000. const content = this.$rawTextPre.text() || _unsafeWindow.RAW_TEXT;
  2001. _GM_setClipboard(content);
  2002. layer.msg("复制成功", { time: 1500 });
  2003. },
  2004. /**
  2005. * 点击了`全部折叠`
  2006. * 如果是JSON 格式化可见,折叠JSON
  2007. * 如果是JSON 脑图可见,折叠脑图节点
  2008. */
  2009. collapseAll: function() {
  2010. if ($formatContainer.is(":visible")) {
  2011. try {
  2012. $("a.json-toggle").not(".collapsed").trigger("click");
  2013. } catch (e) {
  2014. }
  2015. return;
  2016. }
  2017. _unsafeWindow.GLOBAL_JSMIND.collapse_all();
  2018. },
  2019. /**
  2020. * 点击了`全部展开`
  2021. * 如果是JSON 格式化可见,展开JSON
  2022. * 如果是JSON 脑图可见,展开脑图节点
  2023. */
  2024. expandAll: function() {
  2025. if ($formatContainer.is(":visible")) {
  2026. try {
  2027. $("a.json-placeholder").trigger("click").remove();
  2028. } catch (e) {
  2029. }
  2030. return;
  2031. }
  2032. _unsafeWindow.GLOBAL_JSMIND.expand_all();
  2033. _unsafeWindow.GLOBAL_JSMIND.scroll_node_to_center(
  2034. _unsafeWindow.GLOBAL_JSMIND.get_root()
  2035. );
  2036. },
  2037. viewFormater: function() {
  2038. },
  2039. /**
  2040. * tabs点击了`JSON 脑图`
  2041. */
  2042. viewMind: function() {
  2043. jsonMind.init(_unsafeWindow.GLOBAL_JSON);
  2044. _unsafeWindow.GLOBAL_JSMIND.scroll_node_to_center(
  2045. _unsafeWindow.GLOBAL_JSMIND.get_root()
  2046. );
  2047. },
  2048. /**
  2049. * tabs点击了`原始数据`
  2050. */
  2051. viewRawText: function() {
  2052. if (!this.firstFormat) {
  2053. return;
  2054. }
  2055. this.firstFormat = false;
  2056. this._setRawText();
  2057. },
  2058. /**
  2059. * 点击了`美化输出`
  2060. */
  2061. beautify: function() {
  2062. this.isBeautify = !this.isBeautify;
  2063. if (this.isBeautify) {
  2064. let str = JSON.stringify(_unsafeWindow.GLOBAL_JSON, null, 2);
  2065. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  2066. str = `${_unsafeWindow.GLOBAL_JSONP_FUN}(${str})`;
  2067. }
  2068. this.$rawTextPre.text(str);
  2069. return;
  2070. }
  2071. this._setRawText();
  2072. },
  2073. /**
  2074. * 点击了`JSON Crack`
  2075. */
  2076. jsoncrack: function() {
  2077. let theme2 = _GM_getValue("theme") || "light";
  2078. theme2 = theme2.replace(/_.*/, "");
  2079. layer.closeAll();
  2080. layer.open({
  2081. type: 1,
  2082. title: false,
  2083. area: ["100vw", "100vh"],
  2084. content: `<iframe id="jsoncrackEmbed" src="${URL$1.JSON_CRACK_WIDGET}"></iframe>`,
  2085. success: function(layero) {
  2086. const jsonCrackEmbed = layero.find("#jsoncrackEmbed")[0];
  2087. window == null ? void 0 : window.addEventListener("message", () => {
  2088. var _a;
  2089. (_a = jsonCrackEmbed == null ? void 0 : jsonCrackEmbed.contentWindow) == null ? void 0 : _a.postMessage(
  2090. {
  2091. options: { theme: theme2 },
  2092. json: _unsafeWindow.RAW_TEXT
  2093. },
  2094. "*"
  2095. );
  2096. });
  2097. }
  2098. });
  2099. },
  2100. init: function() {
  2101. $(document.body).on("click", ".btn", (e) => {
  2102. const target = e.target;
  2103. const id = target.id;
  2104. if (target.classList.contains("tabs-item")) {
  2105. const clas = "active";
  2106. const index = $(target).index();
  2107. $(target).addClass(clas).siblings().removeClass(clas);
  2108. $(".tabs-container > div").removeClass(clas).eq(index).addClass(clas);
  2109. const beautifyEl = $("#beautify");
  2110. const searchEl = $(".searchbox");
  2111. const copyEl = $("#copyJson");
  2112. const jsoncrackEl = $("#jsoncrack");
  2113. const aEl = $("#collapseAll, #expandAll");
  2114. id === "viewFormater" ? searchEl.show() : searchEl.hide();
  2115. id === "viewMind" ? copyEl.hide() && jsoncrackEl.show() : copyEl.show() && jsoncrackEl.hide();
  2116. id === "viewRawText" ? beautifyEl.show() && aEl.hide() : beautifyEl.hide() && aEl.show();
  2117. }
  2118. this[id](target);
  2119. });
  2120. return this;
  2121. }
  2122. };
  2123. window.addEventListener("message", function(event2) {
  2124. const { data } = event2;
  2125. if (!(data == null ? void 0 : data.reload)) {
  2126. return;
  2127. }
  2128. $jmContainer.html("");
  2129. jsonMind.isFirst = true;
  2130. tabsEvent.isBeautify = false;
  2131. tabsEvent.firstFormat = true;
  2132. _unsafeWindow.GLOBAL_JSMIND = void 0;
  2133. if ($rawTextContainer.is(":visible")) {
  2134. tabsEvent.viewRawText();
  2135. }
  2136. if ($jmContainer.is(":visible")) {
  2137. jsonMind.init(_unsafeWindow.GLOBAL_JSON);
  2138. }
  2139. });
  2140. const filter = {
  2141. /**
  2142. * 根据`filter`过滤 JSON
  2143. * @param {*} filter 过滤值
  2144. * @returns
  2145. */
  2146. filterJSON: function(filter2) {
  2147. const style = _GM_getValue("style") || "default";
  2148. const allPath = $(`#formatContainer *[json-path]`);
  2149. if (!filter2) {
  2150. style == "default" ? allPath.removeClass("hidden") : allPath.parent().removeClass("hidden");
  2151. return;
  2152. }
  2153. const chainSet = /* @__PURE__ */ new Set();
  2154. document.querySelectorAll("#formatContainer *[json-path]").forEach((el) => {
  2155. let chain = $(el).attr("json-path");
  2156. if (!chain) {
  2157. return;
  2158. }
  2159. const newChain = chain.substring(chain.lastIndexOf("."));
  2160. if (!newChain.toLowerCase().includes(filter2.toLowerCase())) {
  2161. return;
  2162. }
  2163. chainSet.add(chain);
  2164. while (chain = chain.substring(0, chain.lastIndexOf("."))) {
  2165. chainSet.add(chain);
  2166. }
  2167. });
  2168. document.querySelectorAll(
  2169. "#formatContainer *[class*='json-']:not([class*='json-key']):not([class*='json-brackets'])"
  2170. ).forEach((el) => {
  2171. const target = $(el);
  2172. let chain = target.siblings().attr("json-path");
  2173. if (style == "default") {
  2174. chain = target.parent().attr("json-path");
  2175. }
  2176. if (!chain) {
  2177. return;
  2178. }
  2179. const text2 = target.text();
  2180. if (!text2.toLowerCase().includes(filter2.toLowerCase())) {
  2181. return;
  2182. }
  2183. chainSet.add(chain);
  2184. while (chain = chain.substring(0, chain.lastIndexOf("."))) {
  2185. chainSet.add(chain);
  2186. }
  2187. });
  2188. style == "default" ? allPath.addClass("hidden") : allPath.parent().addClass("hidden");
  2189. chainSet.forEach((chain) => {
  2190. const path = $(`#formatContainer *[json-path="${chain}"]`);
  2191. style == "default" ? path.removeClass("hidden") : path.parent().removeClass("hidden");
  2192. });
  2193. },
  2194. /**
  2195. * JSON 过滤输入框事件监听
  2196. * @returns
  2197. */
  2198. input: function() {
  2199. const that2 = this;
  2200. $(document.body).on("input", ".searchbox input", function() {
  2201. const val = $(this).val();
  2202. $(".clear").attr("hidden", !val);
  2203. that2.filterJSON(val);
  2204. });
  2205. return that2;
  2206. },
  2207. /**
  2208. * 清空输入框内容
  2209. * @returns
  2210. */
  2211. clear: function() {
  2212. const that2 = this;
  2213. $(document.body).on("click", ".searchbox .clear", function() {
  2214. that2.filterJSON();
  2215. $("input").val("");
  2216. $(this).attr("hidden", true);
  2217. });
  2218. return this;
  2219. },
  2220. init: function() {
  2221. this.input().clear();
  2222. }
  2223. };
  2224. const theme = {
  2225. /**
  2226. * 切换主题色
  2227. * @param {*} theme 主题色:default、light、dark、dark_plus
  2228. * @returns
  2229. */
  2230. changeTheme: function(theme2) {
  2231. _GM_setValue("theme", theme2);
  2232. this.setTheme();
  2233. return this;
  2234. },
  2235. /**
  2236. * 设置主题
  2237. * @returns
  2238. */
  2239. setTheme: function() {
  2240. const theme2 = _GM_getValue("theme") || "default";
  2241. $(document.body).removeClass().addClass(theme2);
  2242. return this;
  2243. },
  2244. init: function() {
  2245. const that2 = this;
  2246. that2.setTheme();
  2247. window.addEventListener("message", function(event2) {
  2248. const { data } = event2;
  2249. if (!data) {
  2250. return;
  2251. }
  2252. const { type, value } = data;
  2253. if (type === "theme") {
  2254. that2.changeTheme(value);
  2255. }
  2256. });
  2257. }
  2258. };
  2259. const http_form = `
  2260. <form class="httpRequest">
  2261. <div class="requestbox">
  2262. <select name="method">
  2263. <option value="POST">POST</option>
  2264. <option value="GET">GET</option>
  2265. <option value="PUT">PUT</option>
  2266. <option value="DELETE">DELETE</option>
  2267. </select>
  2268. <input name="url" placeholder="请求地址" />
  2269. <select name="contentType">
  2270. <option value="application/x-www-form-urlencoded;charset=UTF-8">urlencoded</option>
  2271. <option value="application/json;charset=UTF-8">application/json</option>
  2272. </select>
  2273. <button type="submit">发送</button>
  2274. </div>
  2275. <div class="textarea">
  2276. <input name="headers" placeholder='请求头 {"token": "test"}' />
  2277. <input name="params" placeholder='请求参数 {"id": "test", ""name": "test"}' />
  2278. </div>
  2279. </form>`;
  2280. const tools = {
  2281. inputJson: function() {
  2282. const that = this;
  2283. layer.prompt(
  2284. {
  2285. title: "JSON 输入",
  2286. formType: 2,
  2287. btn: ["确认"],
  2288. shadeClose: true,
  2289. maxlength: 1e6,
  2290. area: ["400px", "300px"]
  2291. },
  2292. function(text) {
  2293. if (!text) {
  2294. layer.msg("内容不能为空", { time: 1500 });
  2295. return;
  2296. }
  2297. const { rawText, jsonpFun } = Utils.jsonpMatch(text);
  2298. try {
  2299. const json = JSON.parse(JSON.stringify(eval(`(${rawText})`)));
  2300. that.reload(json, rawText, jsonpFun);
  2301. } catch (e) {
  2302. layer.msg("JSON格式不正确", { time: 1500 });
  2303. console.log("格式化异常: ", e);
  2304. }
  2305. }
  2306. );
  2307. return this;
  2308. },
  2309. fetchApi: function() {
  2310. const that = this;
  2311. layer.open({
  2312. type: 1,
  2313. closeBtn: 0,
  2314. shadeClose: true,
  2315. title: "HTTP 请求",
  2316. content: http_form
  2317. });
  2318. $("form").on("submit", function(event) {
  2319. event.preventDefault();
  2320. const serialize = $(this).serializeArray();
  2321. const form = {};
  2322. for (const key in serialize) {
  2323. const it = serialize[key];
  2324. form[it.name] = it.value;
  2325. }
  2326. if (form.url === "") {
  2327. layer.msg("请求URL不能为空");
  2328. return;
  2329. }
  2330. let headers = form.headers;
  2331. let params = form.params;
  2332. try {
  2333. if (headers) {
  2334. headers = JSON.parse(headers);
  2335. }
  2336. } catch (e) {
  2337. layer.msg("请求头格式不合法");
  2338. return;
  2339. }
  2340. try {
  2341. if (params) {
  2342. params = JSON.parse(params);
  2343. }
  2344. } catch (e) {
  2345. layer.msg("请求参数格式不合法");
  2346. return;
  2347. }
  2348. layer.load(0, { shade: false });
  2349. $.ajax({
  2350. type: "POST",
  2351. url: URL$1.ONLINE_REQUEST,
  2352. data: JSON.stringify(form),
  2353. contentType: "application/json"
  2354. }).then(
  2355. (response) => {
  2356. if (typeof response === "string") {
  2357. try {
  2358. const { rawText, jsonpFun } = Utils.jsonpMatch(response);
  2359. const json = JSON.parse(JSON.stringify(eval(`(${rawText})`)));
  2360. that.reload(json, rawText, jsonpFun);
  2361. } catch (e) {
  2362. layer.closeAll();
  2363. layer.msg("HTTP 请求JSON格式不正确", { time: 1500 });
  2364. console.log("HTTP 请求JSON格式不正确:", e);
  2365. }
  2366. } else {
  2367. that.reload(response, JSON.stringify(response), null);
  2368. }
  2369. },
  2370. (error) => {
  2371. layer.closeAll();
  2372. layer.msg("HTTP 请求异常", { time: 1500 });
  2373. console.log("HTTP 请求异常:", error);
  2374. }
  2375. );
  2376. });
  2377. return this;
  2378. },
  2379. reload: function(json2, rawText2, jsonpFun2) {
  2380. _unsafeWindow.GLOBAL_JSON = json2;
  2381. _unsafeWindow.RAW_TEXT = rawText2;
  2382. _unsafeWindow.GLOBAL_JSONP_FUN = jsonpFun2;
  2383. window.postMessage({ reload: true });
  2384. layer.closeAll();
  2385. },
  2386. init: function() {
  2387. window.addEventListener("message", (event2) => {
  2388. const { data } = event2;
  2389. if (!data) {
  2390. return;
  2391. }
  2392. const { type, value } = data;
  2393. if (type === "tools") {
  2394. this[value]();
  2395. }
  2396. });
  2397. }
  2398. };
  2399. const handleBar = {
  2400. instance: null,
  2401. /**
  2402. * 对右侧操作栏的点击事件初始化
  2403. * @returns
  2404. */
  2405. handle: function() {
  2406. const that2 = this;
  2407. const tagName = "span";
  2408. [".style", ".theme", ".tools"].forEach((selector) => {
  2409. tippy(selector, {
  2410. duration: 500,
  2411. allowHTML: true,
  2412. interactive: true,
  2413. trigger: "click",
  2414. onTrigger: function(instance) {
  2415. const tools2 = $(instance.reference);
  2416. tools2.siblings().find(tagName).removeClass();
  2417. tools2.find(tagName).addClass("active");
  2418. const template = tools2.find("template");
  2419. const type = template.data("type");
  2420. const value = _GM_getValue(type) || "default";
  2421. const ul = template.contents();
  2422. ul.find("li").removeClass();
  2423. ul.find(`li[data-value=${value}]`).addClass("active");
  2424. instance.setContent(template.html());
  2425. that2.instance = instance;
  2426. },
  2427. onHide: function(instance) {
  2428. const tools2 = $(instance.reference);
  2429. tools2.find(tagName).removeClass();
  2430. }
  2431. });
  2432. });
  2433. return this;
  2434. },
  2435. /**
  2436. * 点击了对应选项
  2437. * 如点击了`主题`-`暗黑`,通过window.postMessage进行主题色更新
  2438. * @returns
  2439. */
  2440. checked: function() {
  2441. const that2 = this;
  2442. $(document.body).on("click", ".rightbox li", function() {
  2443. const el = $(this);
  2444. const hasClass = el.hasClass("active");
  2445. if (hasClass) {
  2446. return;
  2447. }
  2448. const type = el.data("type");
  2449. const value = el.data("value");
  2450. if (type !== "tools") {
  2451. el.addClass("active").siblings().removeClass();
  2452. } else {
  2453. that2.instance.hide();
  2454. }
  2455. window.postMessage({ type, value });
  2456. });
  2457. return this;
  2458. },
  2459. init: function() {
  2460. this.handle().checked();
  2461. }
  2462. };
  2463. tabsEvent.init();
  2464. theme.init();
  2465. tools.init();
  2466. filter.init();
  2467. handleBar.init();
  2468.  
  2469. })
  2470. };
  2471. }));
  2472.  
  2473. System.register("./tippy.esm-Ot9MORvr-DNGa7Opj.js", [], (function (exports, module) {
  2474. 'use strict';
  2475. return {
  2476. execute: (function () {
  2477.  
  2478. exports("t", tippy);
  2479.  
  2480. var top = "top";
  2481. var bottom = "bottom";
  2482. var right = "right";
  2483. var left = "left";
  2484. var auto = "auto";
  2485. var basePlacements = [top, bottom, right, left];
  2486. var start = "start";
  2487. var end = "end";
  2488. var clippingParents = "clippingParents";
  2489. var viewport = "viewport";
  2490. var popper = "popper";
  2491. var reference = "reference";
  2492. var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
  2493. return acc.concat([placement + "-" + start, placement + "-" + end]);
  2494. }, []);
  2495. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  2496. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  2497. }, []);
  2498. var beforeRead = "beforeRead";
  2499. var read = "read";
  2500. var afterRead = "afterRead";
  2501. var beforeMain = "beforeMain";
  2502. var main = "main";
  2503. var afterMain = "afterMain";
  2504. var beforeWrite = "beforeWrite";
  2505. var write = "write";
  2506. var afterWrite = "afterWrite";
  2507. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  2508. function getNodeName(element) {
  2509. return element ? (element.nodeName || "").toLowerCase() : null;
  2510. }
  2511. function getWindow(node) {
  2512. if (node == null) {
  2513. return window;
  2514. }
  2515. if (node.toString() !== "[object Window]") {
  2516. var ownerDocument = node.ownerDocument;
  2517. return ownerDocument ? ownerDocument.defaultView || window : window;
  2518. }
  2519. return node;
  2520. }
  2521. function isElement$1(node) {
  2522. var OwnElement = getWindow(node).Element;
  2523. return node instanceof OwnElement || node instanceof Element;
  2524. }
  2525. function isHTMLElement(node) {
  2526. var OwnElement = getWindow(node).HTMLElement;
  2527. return node instanceof OwnElement || node instanceof HTMLElement;
  2528. }
  2529. function isShadowRoot(node) {
  2530. if (typeof ShadowRoot === "undefined") {
  2531. return false;
  2532. }
  2533. var OwnElement = getWindow(node).ShadowRoot;
  2534. return node instanceof OwnElement || node instanceof ShadowRoot;
  2535. }
  2536. function applyStyles(_ref) {
  2537. var state = _ref.state;
  2538. Object.keys(state.elements).forEach(function(name) {
  2539. var style = state.styles[name] || {};
  2540. var attributes = state.attributes[name] || {};
  2541. var element = state.elements[name];
  2542. if (!isHTMLElement(element) || !getNodeName(element)) {
  2543. return;
  2544. }
  2545. Object.assign(element.style, style);
  2546. Object.keys(attributes).forEach(function(name2) {
  2547. var value = attributes[name2];
  2548. if (value === false) {
  2549. element.removeAttribute(name2);
  2550. } else {
  2551. element.setAttribute(name2, value === true ? "" : value);
  2552. }
  2553. });
  2554. });
  2555. }
  2556. function effect$2(_ref2) {
  2557. var state = _ref2.state;
  2558. var initialStyles = {
  2559. popper: {
  2560. position: state.options.strategy,
  2561. left: "0",
  2562. top: "0",
  2563. margin: "0"
  2564. },
  2565. arrow: {
  2566. position: "absolute"
  2567. },
  2568. reference: {}
  2569. };
  2570. Object.assign(state.elements.popper.style, initialStyles.popper);
  2571. state.styles = initialStyles;
  2572. if (state.elements.arrow) {
  2573. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  2574. }
  2575. return function() {
  2576. Object.keys(state.elements).forEach(function(name) {
  2577. var element = state.elements[name];
  2578. var attributes = state.attributes[name] || {};
  2579. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
  2580. var style = styleProperties.reduce(function(style2, property) {
  2581. style2[property] = "";
  2582. return style2;
  2583. }, {});
  2584. if (!isHTMLElement(element) || !getNodeName(element)) {
  2585. return;
  2586. }
  2587. Object.assign(element.style, style);
  2588. Object.keys(attributes).forEach(function(attribute) {
  2589. element.removeAttribute(attribute);
  2590. });
  2591. });
  2592. };
  2593. }
  2594. const applyStyles$1 = {
  2595. name: "applyStyles",
  2596. enabled: true,
  2597. phase: "write",
  2598. fn: applyStyles,
  2599. effect: effect$2,
  2600. requires: ["computeStyles"]
  2601. };
  2602. function getBasePlacement$1(placement) {
  2603. return placement.split("-")[0];
  2604. }
  2605. var max = Math.max;
  2606. var min = Math.min;
  2607. var round = Math.round;
  2608. function getUAString() {
  2609. var uaData = navigator.userAgentData;
  2610. if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
  2611. return uaData.brands.map(function(item) {
  2612. return item.brand + "/" + item.version;
  2613. }).join(" ");
  2614. }
  2615. return navigator.userAgent;
  2616. }
  2617. function isLayoutViewport() {
  2618. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  2619. }
  2620. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  2621. if (includeScale === void 0) {
  2622. includeScale = false;
  2623. }
  2624. if (isFixedStrategy === void 0) {
  2625. isFixedStrategy = false;
  2626. }
  2627. var clientRect = element.getBoundingClientRect();
  2628. var scaleX = 1;
  2629. var scaleY = 1;
  2630. if (includeScale && isHTMLElement(element)) {
  2631. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  2632. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  2633. }
  2634. var _ref = isElement$1(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
  2635. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  2636. var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  2637. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  2638. var width = clientRect.width / scaleX;
  2639. var height = clientRect.height / scaleY;
  2640. return {
  2641. width,
  2642. height,
  2643. top: y,
  2644. right: x + width,
  2645. bottom: y + height,
  2646. left: x,
  2647. x,
  2648. y
  2649. };
  2650. }
  2651. function getLayoutRect(element) {
  2652. var clientRect = getBoundingClientRect(element);
  2653. var width = element.offsetWidth;
  2654. var height = element.offsetHeight;
  2655. if (Math.abs(clientRect.width - width) <= 1) {
  2656. width = clientRect.width;
  2657. }
  2658. if (Math.abs(clientRect.height - height) <= 1) {
  2659. height = clientRect.height;
  2660. }
  2661. return {
  2662. x: element.offsetLeft,
  2663. y: element.offsetTop,
  2664. width,
  2665. height
  2666. };
  2667. }
  2668. function contains(parent, child) {
  2669. var rootNode = child.getRootNode && child.getRootNode();
  2670. if (parent.contains(child)) {
  2671. return true;
  2672. } else if (rootNode && isShadowRoot(rootNode)) {
  2673. var next = child;
  2674. do {
  2675. if (next && parent.isSameNode(next)) {
  2676. return true;
  2677. }
  2678. next = next.parentNode || next.host;
  2679. } while (next);
  2680. }
  2681. return false;
  2682. }
  2683. function getComputedStyle(element) {
  2684. return getWindow(element).getComputedStyle(element);
  2685. }
  2686. function isTableElement(element) {
  2687. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  2688. }
  2689. function getDocumentElement(element) {
  2690. return ((isElement$1(element) ? element.ownerDocument : (
  2691. // $FlowFixMe[prop-missing]
  2692. element.document
  2693. )) || window.document).documentElement;
  2694. }
  2695. function getParentNode(element) {
  2696. if (getNodeName(element) === "html") {
  2697. return element;
  2698. }
  2699. return (
  2700. // this is a quicker (but less type safe) way to save quite some bytes from the bundle
  2701. // $FlowFixMe[incompatible-return]
  2702. // $FlowFixMe[prop-missing]
  2703. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  2704. element.parentNode || // DOM Element detected
  2705. (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  2706. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  2707. getDocumentElement(element)
  2708. );
  2709. }
  2710. function getTrueOffsetParent(element) {
  2711. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  2712. getComputedStyle(element).position === "fixed") {
  2713. return null;
  2714. }
  2715. return element.offsetParent;
  2716. }
  2717. function getContainingBlock(element) {
  2718. var isFirefox = /firefox/i.test(getUAString());
  2719. var isIE = /Trident/i.test(getUAString());
  2720. if (isIE && isHTMLElement(element)) {
  2721. var elementCss = getComputedStyle(element);
  2722. if (elementCss.position === "fixed") {
  2723. return null;
  2724. }
  2725. }
  2726. var currentNode = getParentNode(element);
  2727. if (isShadowRoot(currentNode)) {
  2728. currentNode = currentNode.host;
  2729. }
  2730. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  2731. var css = getComputedStyle(currentNode);
  2732. 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") {
  2733. return currentNode;
  2734. } else {
  2735. currentNode = currentNode.parentNode;
  2736. }
  2737. }
  2738. return null;
  2739. }
  2740. function getOffsetParent(element) {
  2741. var window2 = getWindow(element);
  2742. var offsetParent = getTrueOffsetParent(element);
  2743. while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
  2744. offsetParent = getTrueOffsetParent(offsetParent);
  2745. }
  2746. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
  2747. return window2;
  2748. }
  2749. return offsetParent || getContainingBlock(element) || window2;
  2750. }
  2751. function getMainAxisFromPlacement(placement) {
  2752. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  2753. }
  2754. function within(min$1, value, max$1) {
  2755. return max(min$1, min(value, max$1));
  2756. }
  2757. function withinMaxClamp(min2, value, max2) {
  2758. var v = within(min2, value, max2);
  2759. return v > max2 ? max2 : v;
  2760. }
  2761. function getFreshSideObject() {
  2762. return {
  2763. top: 0,
  2764. right: 0,
  2765. bottom: 0,
  2766. left: 0
  2767. };
  2768. }
  2769. function mergePaddingObject(paddingObject) {
  2770. return Object.assign({}, getFreshSideObject(), paddingObject);
  2771. }
  2772. function expandToHashMap(value, keys) {
  2773. return keys.reduce(function(hashMap, key) {
  2774. hashMap[key] = value;
  2775. return hashMap;
  2776. }, {});
  2777. }
  2778. var toPaddingObject = function toPaddingObject2(padding, state) {
  2779. padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
  2780. placement: state.placement
  2781. })) : padding;
  2782. return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  2783. };
  2784. function arrow(_ref) {
  2785. var _state$modifiersData$;
  2786. var state = _ref.state, name = _ref.name, options = _ref.options;
  2787. var arrowElement = state.elements.arrow;
  2788. var popperOffsets2 = state.modifiersData.popperOffsets;
  2789. var basePlacement = getBasePlacement$1(state.placement);
  2790. var axis = getMainAxisFromPlacement(basePlacement);
  2791. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  2792. var len = isVertical ? "height" : "width";
  2793. if (!arrowElement || !popperOffsets2) {
  2794. return;
  2795. }
  2796. var paddingObject = toPaddingObject(options.padding, state);
  2797. var arrowRect = getLayoutRect(arrowElement);
  2798. var minProp = axis === "y" ? top : left;
  2799. var maxProp = axis === "y" ? bottom : right;
  2800. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
  2801. var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
  2802. var arrowOffsetParent = getOffsetParent(arrowElement);
  2803. var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  2804. var centerToReference = endDiff / 2 - startDiff / 2;
  2805. var min2 = paddingObject[minProp];
  2806. var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
  2807. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  2808. var offset2 = within(min2, center, max2);
  2809. var axisProp = axis;
  2810. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
  2811. }
  2812. function effect$1(_ref2) {
  2813. var state = _ref2.state, options = _ref2.options;
  2814. var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
  2815. if (arrowElement == null) {
  2816. return;
  2817. }
  2818. if (typeof arrowElement === "string") {
  2819. arrowElement = state.elements.popper.querySelector(arrowElement);
  2820. if (!arrowElement) {
  2821. return;
  2822. }
  2823. }
  2824. if (!contains(state.elements.popper, arrowElement)) {
  2825. return;
  2826. }
  2827. state.elements.arrow = arrowElement;
  2828. }
  2829. const arrow$1 = {
  2830. name: "arrow",
  2831. enabled: true,
  2832. phase: "main",
  2833. fn: arrow,
  2834. effect: effect$1,
  2835. requires: ["popperOffsets"],
  2836. requiresIfExists: ["preventOverflow"]
  2837. };
  2838. function getVariation(placement) {
  2839. return placement.split("-")[1];
  2840. }
  2841. var unsetSides = {
  2842. top: "auto",
  2843. right: "auto",
  2844. bottom: "auto",
  2845. left: "auto"
  2846. };
  2847. function roundOffsetsByDPR(_ref, win) {
  2848. var x = _ref.x, y = _ref.y;
  2849. var dpr = win.devicePixelRatio || 1;
  2850. return {
  2851. x: round(x * dpr) / dpr || 0,
  2852. y: round(y * dpr) / dpr || 0
  2853. };
  2854. }
  2855. function mapToStyles(_ref2) {
  2856. var _Object$assign2;
  2857. 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;
  2858. 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;
  2859. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  2860. x,
  2861. y
  2862. }) : {
  2863. x,
  2864. y
  2865. };
  2866. x = _ref3.x;
  2867. y = _ref3.y;
  2868. var hasX = offsets.hasOwnProperty("x");
  2869. var hasY = offsets.hasOwnProperty("y");
  2870. var sideX = left;
  2871. var sideY = top;
  2872. var win = window;
  2873. if (adaptive) {
  2874. var offsetParent = getOffsetParent(popper2);
  2875. var heightProp = "clientHeight";
  2876. var widthProp = "clientWidth";
  2877. if (offsetParent === getWindow(popper2)) {
  2878. offsetParent = getDocumentElement(popper2);
  2879. if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
  2880. heightProp = "scrollHeight";
  2881. widthProp = "scrollWidth";
  2882. }
  2883. }
  2884. offsetParent = offsetParent;
  2885. if (placement === top || (placement === left || placement === right) && variation === end) {
  2886. sideY = bottom;
  2887. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
  2888. // $FlowFixMe[prop-missing]
  2889. offsetParent[heightProp]
  2890. );
  2891. y -= offsetY - popperRect.height;
  2892. y *= gpuAcceleration ? 1 : -1;
  2893. }
  2894. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  2895. sideX = right;
  2896. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
  2897. // $FlowFixMe[prop-missing]
  2898. offsetParent[widthProp]
  2899. );
  2900. x -= offsetX - popperRect.width;
  2901. x *= gpuAcceleration ? 1 : -1;
  2902. }
  2903. }
  2904. var commonStyles = Object.assign({
  2905. position
  2906. }, adaptive && unsetSides);
  2907. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  2908. x,
  2909. y
  2910. }, getWindow(popper2)) : {
  2911. x,
  2912. y
  2913. };
  2914. x = _ref4.x;
  2915. y = _ref4.y;
  2916. if (gpuAcceleration) {
  2917. var _Object$assign;
  2918. 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));
  2919. }
  2920. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  2921. }
  2922. function computeStyles(_ref5) {
  2923. var state = _ref5.state, options = _ref5.options;
  2924. 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;
  2925. var commonStyles = {
  2926. placement: getBasePlacement$1(state.placement),
  2927. variation: getVariation(state.placement),
  2928. popper: state.elements.popper,
  2929. popperRect: state.rects.popper,
  2930. gpuAcceleration,
  2931. isFixed: state.options.strategy === "fixed"
  2932. };
  2933. if (state.modifiersData.popperOffsets != null) {
  2934. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  2935. offsets: state.modifiersData.popperOffsets,
  2936. position: state.options.strategy,
  2937. adaptive,
  2938. roundOffsets
  2939. })));
  2940. }
  2941. if (state.modifiersData.arrow != null) {
  2942. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  2943. offsets: state.modifiersData.arrow,
  2944. position: "absolute",
  2945. adaptive: false,
  2946. roundOffsets
  2947. })));
  2948. }
  2949. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  2950. "data-popper-placement": state.placement
  2951. });
  2952. }
  2953. const computeStyles$1 = {
  2954. name: "computeStyles",
  2955. enabled: true,
  2956. phase: "beforeWrite",
  2957. fn: computeStyles,
  2958. data: {}
  2959. };
  2960. var passive = {
  2961. passive: true
  2962. };
  2963. function effect(_ref) {
  2964. var state = _ref.state, instance = _ref.instance, options = _ref.options;
  2965. 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;
  2966. var window2 = getWindow(state.elements.popper);
  2967. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  2968. if (scroll) {
  2969. scrollParents.forEach(function(scrollParent) {
  2970. scrollParent.addEventListener("scroll", instance.update, passive);
  2971. });
  2972. }
  2973. if (resize) {
  2974. window2.addEventListener("resize", instance.update, passive);
  2975. }
  2976. return function() {
  2977. if (scroll) {
  2978. scrollParents.forEach(function(scrollParent) {
  2979. scrollParent.removeEventListener("scroll", instance.update, passive);
  2980. });
  2981. }
  2982. if (resize) {
  2983. window2.removeEventListener("resize", instance.update, passive);
  2984. }
  2985. };
  2986. }
  2987. const eventListeners = {
  2988. name: "eventListeners",
  2989. enabled: true,
  2990. phase: "write",
  2991. fn: function fn() {
  2992. },
  2993. effect,
  2994. data: {}
  2995. };
  2996. var hash$1 = {
  2997. left: "right",
  2998. right: "left",
  2999. bottom: "top",
  3000. top: "bottom"
  3001. };
  3002. function getOppositePlacement(placement) {
  3003. return placement.replace(/left|right|bottom|top/g, function(matched) {
  3004. return hash$1[matched];
  3005. });
  3006. }
  3007. var hash = {
  3008. start: "end",
  3009. end: "start"
  3010. };
  3011. function getOppositeVariationPlacement(placement) {
  3012. return placement.replace(/start|end/g, function(matched) {
  3013. return hash[matched];
  3014. });
  3015. }
  3016. function getWindowScroll(node) {
  3017. var win = getWindow(node);
  3018. var scrollLeft = win.pageXOffset;
  3019. var scrollTop = win.pageYOffset;
  3020. return {
  3021. scrollLeft,
  3022. scrollTop
  3023. };
  3024. }
  3025. function getWindowScrollBarX(element) {
  3026. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  3027. }
  3028. function getViewportRect(element, strategy) {
  3029. var win = getWindow(element);
  3030. var html = getDocumentElement(element);
  3031. var visualViewport = win.visualViewport;
  3032. var width = html.clientWidth;
  3033. var height = html.clientHeight;
  3034. var x = 0;
  3035. var y = 0;
  3036. if (visualViewport) {
  3037. width = visualViewport.width;
  3038. height = visualViewport.height;
  3039. var layoutViewport = isLayoutViewport();
  3040. if (layoutViewport || !layoutViewport && strategy === "fixed") {
  3041. x = visualViewport.offsetLeft;
  3042. y = visualViewport.offsetTop;
  3043. }
  3044. }
  3045. return {
  3046. width,
  3047. height,
  3048. x: x + getWindowScrollBarX(element),
  3049. y
  3050. };
  3051. }
  3052. function getDocumentRect(element) {
  3053. var _element$ownerDocumen;
  3054. var html = getDocumentElement(element);
  3055. var winScroll = getWindowScroll(element);
  3056. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  3057. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  3058. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  3059. var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
  3060. var y = -winScroll.scrollTop;
  3061. if (getComputedStyle(body || html).direction === "rtl") {
  3062. x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  3063. }
  3064. return {
  3065. width,
  3066. height,
  3067. x,
  3068. y
  3069. };
  3070. }
  3071. function isScrollParent(element) {
  3072. var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  3073. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  3074. }
  3075. function getScrollParent(node) {
  3076. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  3077. return node.ownerDocument.body;
  3078. }
  3079. if (isHTMLElement(node) && isScrollParent(node)) {
  3080. return node;
  3081. }
  3082. return getScrollParent(getParentNode(node));
  3083. }
  3084. function listScrollParents(element, list) {
  3085. var _element$ownerDocumen;
  3086. if (list === void 0) {
  3087. list = [];
  3088. }
  3089. var scrollParent = getScrollParent(element);
  3090. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  3091. var win = getWindow(scrollParent);
  3092. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  3093. var updatedList = list.concat(target);
  3094. return isBody ? updatedList : (
  3095. // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  3096. updatedList.concat(listScrollParents(getParentNode(target)))
  3097. );
  3098. }
  3099. function rectToClientRect(rect) {
  3100. return Object.assign({}, rect, {
  3101. left: rect.x,
  3102. top: rect.y,
  3103. right: rect.x + rect.width,
  3104. bottom: rect.y + rect.height
  3105. });
  3106. }
  3107. function getInnerBoundingClientRect(element, strategy) {
  3108. var rect = getBoundingClientRect(element, false, strategy === "fixed");
  3109. rect.top = rect.top + element.clientTop;
  3110. rect.left = rect.left + element.clientLeft;
  3111. rect.bottom = rect.top + element.clientHeight;
  3112. rect.right = rect.left + element.clientWidth;
  3113. rect.width = element.clientWidth;
  3114. rect.height = element.clientHeight;
  3115. rect.x = rect.left;
  3116. rect.y = rect.top;
  3117. return rect;
  3118. }
  3119. function getClientRectFromMixedType(element, clippingParent, strategy) {
  3120. return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  3121. }
  3122. function getClippingParents(element) {
  3123. var clippingParents2 = listScrollParents(getParentNode(element));
  3124. var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle(element).position) >= 0;
  3125. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  3126. if (!isElement$1(clipperElement)) {
  3127. return [];
  3128. }
  3129. return clippingParents2.filter(function(clippingParent) {
  3130. return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
  3131. });
  3132. }
  3133. function getClippingRect(element, boundary, rootBoundary, strategy) {
  3134. var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
  3135. var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
  3136. var firstClippingParent = clippingParents2[0];
  3137. var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
  3138. var rect = getClientRectFromMixedType(element, clippingParent, strategy);
  3139. accRect.top = max(rect.top, accRect.top);
  3140. accRect.right = min(rect.right, accRect.right);
  3141. accRect.bottom = min(rect.bottom, accRect.bottom);
  3142. accRect.left = max(rect.left, accRect.left);
  3143. return accRect;
  3144. }, getClientRectFromMixedType(element, firstClippingParent, strategy));
  3145. clippingRect.width = clippingRect.right - clippingRect.left;
  3146. clippingRect.height = clippingRect.bottom - clippingRect.top;
  3147. clippingRect.x = clippingRect.left;
  3148. clippingRect.y = clippingRect.top;
  3149. return clippingRect;
  3150. }
  3151. function computeOffsets(_ref) {
  3152. var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
  3153. var basePlacement = placement ? getBasePlacement$1(placement) : null;
  3154. var variation = placement ? getVariation(placement) : null;
  3155. var commonX = reference2.x + reference2.width / 2 - element.width / 2;
  3156. var commonY = reference2.y + reference2.height / 2 - element.height / 2;
  3157. var offsets;
  3158. switch (basePlacement) {
  3159. case top:
  3160. offsets = {
  3161. x: commonX,
  3162. y: reference2.y - element.height
  3163. };
  3164. break;
  3165. case bottom:
  3166. offsets = {
  3167. x: commonX,
  3168. y: reference2.y + reference2.height
  3169. };
  3170. break;
  3171. case right:
  3172. offsets = {
  3173. x: reference2.x + reference2.width,
  3174. y: commonY
  3175. };
  3176. break;
  3177. case left:
  3178. offsets = {
  3179. x: reference2.x - element.width,
  3180. y: commonY
  3181. };
  3182. break;
  3183. default:
  3184. offsets = {
  3185. x: reference2.x,
  3186. y: reference2.y
  3187. };
  3188. }
  3189. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  3190. if (mainAxis != null) {
  3191. var len = mainAxis === "y" ? "height" : "width";
  3192. switch (variation) {
  3193. case start:
  3194. offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
  3195. break;
  3196. case end:
  3197. offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
  3198. break;
  3199. }
  3200. }
  3201. return offsets;
  3202. }
  3203. function detectOverflow(state, options) {
  3204. if (options === void 0) {
  3205. options = {};
  3206. }
  3207. 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;
  3208. var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  3209. var altContext = elementContext === popper ? reference : popper;
  3210. var popperRect = state.rects.popper;
  3211. var element = state.elements[altBoundary ? altContext : elementContext];
  3212. var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
  3213. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  3214. var popperOffsets2 = computeOffsets({
  3215. reference: referenceClientRect,
  3216. element: popperRect,
  3217. strategy: "absolute",
  3218. placement
  3219. });
  3220. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
  3221. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
  3222. var overflowOffsets = {
  3223. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  3224. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  3225. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  3226. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  3227. };
  3228. var offsetData = state.modifiersData.offset;
  3229. if (elementContext === popper && offsetData) {
  3230. var offset2 = offsetData[placement];
  3231. Object.keys(overflowOffsets).forEach(function(key) {
  3232. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  3233. var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
  3234. overflowOffsets[key] += offset2[axis] * multiply;
  3235. });
  3236. }
  3237. return overflowOffsets;
  3238. }
  3239. function computeAutoPlacement(state, options) {
  3240. if (options === void 0) {
  3241. options = {};
  3242. }
  3243. 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;
  3244. var variation = getVariation(placement);
  3245. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
  3246. return getVariation(placement2) === variation;
  3247. }) : basePlacements;
  3248. var allowedPlacements = placements$1.filter(function(placement2) {
  3249. return allowedAutoPlacements.indexOf(placement2) >= 0;
  3250. });
  3251. if (allowedPlacements.length === 0) {
  3252. allowedPlacements = placements$1;
  3253. }
  3254. var overflows = allowedPlacements.reduce(function(acc, placement2) {
  3255. acc[placement2] = detectOverflow(state, {
  3256. placement: placement2,
  3257. boundary,
  3258. rootBoundary,
  3259. padding
  3260. })[getBasePlacement$1(placement2)];
  3261. return acc;
  3262. }, {});
  3263. return Object.keys(overflows).sort(function(a, b) {
  3264. return overflows[a] - overflows[b];
  3265. });
  3266. }
  3267. function getExpandedFallbackPlacements(placement) {
  3268. if (getBasePlacement$1(placement) === auto) {
  3269. return [];
  3270. }
  3271. var oppositePlacement = getOppositePlacement(placement);
  3272. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  3273. }
  3274. function flip(_ref) {
  3275. var state = _ref.state, options = _ref.options, name = _ref.name;
  3276. if (state.modifiersData[name]._skip) {
  3277. return;
  3278. }
  3279. 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;
  3280. var preferredPlacement = state.options.placement;
  3281. var basePlacement = getBasePlacement$1(preferredPlacement);
  3282. var isBasePlacement = basePlacement === preferredPlacement;
  3283. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  3284. var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
  3285. return acc.concat(getBasePlacement$1(placement2) === auto ? computeAutoPlacement(state, {
  3286. placement: placement2,
  3287. boundary,
  3288. rootBoundary,
  3289. padding,
  3290. flipVariations,
  3291. allowedAutoPlacements
  3292. }) : placement2);
  3293. }, []);
  3294. var referenceRect = state.rects.reference;
  3295. var popperRect = state.rects.popper;
  3296. var checksMap = /* @__PURE__ */ new Map();
  3297. var makeFallbackChecks = true;
  3298. var firstFittingPlacement = placements2[0];
  3299. for (var i = 0; i < placements2.length; i++) {
  3300. var placement = placements2[i];
  3301. var _basePlacement = getBasePlacement$1(placement);
  3302. var isStartVariation = getVariation(placement) === start;
  3303. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  3304. var len = isVertical ? "width" : "height";
  3305. var overflow = detectOverflow(state, {
  3306. placement,
  3307. boundary,
  3308. rootBoundary,
  3309. altBoundary,
  3310. padding
  3311. });
  3312. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  3313. if (referenceRect[len] > popperRect[len]) {
  3314. mainVariationSide = getOppositePlacement(mainVariationSide);
  3315. }
  3316. var altVariationSide = getOppositePlacement(mainVariationSide);
  3317. var checks = [];
  3318. if (checkMainAxis) {
  3319. checks.push(overflow[_basePlacement] <= 0);
  3320. }
  3321. if (checkAltAxis) {
  3322. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  3323. }
  3324. if (checks.every(function(check) {
  3325. return check;
  3326. })) {
  3327. firstFittingPlacement = placement;
  3328. makeFallbackChecks = false;
  3329. break;
  3330. }
  3331. checksMap.set(placement, checks);
  3332. }
  3333. if (makeFallbackChecks) {
  3334. var numberOfChecks = flipVariations ? 3 : 1;
  3335. var _loop = function _loop2(_i2) {
  3336. var fittingPlacement = placements2.find(function(placement2) {
  3337. var checks2 = checksMap.get(placement2);
  3338. if (checks2) {
  3339. return checks2.slice(0, _i2).every(function(check) {
  3340. return check;
  3341. });
  3342. }
  3343. });
  3344. if (fittingPlacement) {
  3345. firstFittingPlacement = fittingPlacement;
  3346. return "break";
  3347. }
  3348. };
  3349. for (var _i = numberOfChecks; _i > 0; _i--) {
  3350. var _ret = _loop(_i);
  3351. if (_ret === "break") break;
  3352. }
  3353. }
  3354. if (state.placement !== firstFittingPlacement) {
  3355. state.modifiersData[name]._skip = true;
  3356. state.placement = firstFittingPlacement;
  3357. state.reset = true;
  3358. }
  3359. }
  3360. const flip$1 = {
  3361. name: "flip",
  3362. enabled: true,
  3363. phase: "main",
  3364. fn: flip,
  3365. requiresIfExists: ["offset"],
  3366. data: {
  3367. _skip: false
  3368. }
  3369. };
  3370. function getSideOffsets(overflow, rect, preventedOffsets) {
  3371. if (preventedOffsets === void 0) {
  3372. preventedOffsets = {
  3373. x: 0,
  3374. y: 0
  3375. };
  3376. }
  3377. return {
  3378. top: overflow.top - rect.height - preventedOffsets.y,
  3379. right: overflow.right - rect.width + preventedOffsets.x,
  3380. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  3381. left: overflow.left - rect.width - preventedOffsets.x
  3382. };
  3383. }
  3384. function isAnySideFullyClipped(overflow) {
  3385. return [top, right, bottom, left].some(function(side) {
  3386. return overflow[side] >= 0;
  3387. });
  3388. }
  3389. function hide(_ref) {
  3390. var state = _ref.state, name = _ref.name;
  3391. var referenceRect = state.rects.reference;
  3392. var popperRect = state.rects.popper;
  3393. var preventedOffsets = state.modifiersData.preventOverflow;
  3394. var referenceOverflow = detectOverflow(state, {
  3395. elementContext: "reference"
  3396. });
  3397. var popperAltOverflow = detectOverflow(state, {
  3398. altBoundary: true
  3399. });
  3400. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  3401. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  3402. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  3403. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  3404. state.modifiersData[name] = {
  3405. referenceClippingOffsets,
  3406. popperEscapeOffsets,
  3407. isReferenceHidden,
  3408. hasPopperEscaped
  3409. };
  3410. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  3411. "data-popper-reference-hidden": isReferenceHidden,
  3412. "data-popper-escaped": hasPopperEscaped
  3413. });
  3414. }
  3415. const hide$1 = {
  3416. name: "hide",
  3417. enabled: true,
  3418. phase: "main",
  3419. requiresIfExists: ["preventOverflow"],
  3420. fn: hide
  3421. };
  3422. function distanceAndSkiddingToXY(placement, rects, offset2) {
  3423. var basePlacement = getBasePlacement$1(placement);
  3424. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  3425. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  3426. placement
  3427. })) : offset2, skidding = _ref[0], distance = _ref[1];
  3428. skidding = skidding || 0;
  3429. distance = (distance || 0) * invertDistance;
  3430. return [left, right].indexOf(basePlacement) >= 0 ? {
  3431. x: distance,
  3432. y: skidding
  3433. } : {
  3434. x: skidding,
  3435. y: distance
  3436. };
  3437. }
  3438. function offset(_ref2) {
  3439. var state = _ref2.state, options = _ref2.options, name = _ref2.name;
  3440. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  3441. var data = placements.reduce(function(acc, placement) {
  3442. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  3443. return acc;
  3444. }, {});
  3445. var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
  3446. if (state.modifiersData.popperOffsets != null) {
  3447. state.modifiersData.popperOffsets.x += x;
  3448. state.modifiersData.popperOffsets.y += y;
  3449. }
  3450. state.modifiersData[name] = data;
  3451. }
  3452. const offset$1 = {
  3453. name: "offset",
  3454. enabled: true,
  3455. phase: "main",
  3456. requires: ["popperOffsets"],
  3457. fn: offset
  3458. };
  3459. function popperOffsets(_ref) {
  3460. var state = _ref.state, name = _ref.name;
  3461. state.modifiersData[name] = computeOffsets({
  3462. reference: state.rects.reference,
  3463. element: state.rects.popper,
  3464. strategy: "absolute",
  3465. placement: state.placement
  3466. });
  3467. }
  3468. const popperOffsets$1 = {
  3469. name: "popperOffsets",
  3470. enabled: true,
  3471. phase: "read",
  3472. fn: popperOffsets,
  3473. data: {}
  3474. };
  3475. function getAltAxis(axis) {
  3476. return axis === "x" ? "y" : "x";
  3477. }
  3478. function preventOverflow(_ref) {
  3479. var state = _ref.state, options = _ref.options, name = _ref.name;
  3480. 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;
  3481. var overflow = detectOverflow(state, {
  3482. boundary,
  3483. rootBoundary,
  3484. padding,
  3485. altBoundary
  3486. });
  3487. var basePlacement = getBasePlacement$1(state.placement);
  3488. var variation = getVariation(state.placement);
  3489. var isBasePlacement = !variation;
  3490. var mainAxis = getMainAxisFromPlacement(basePlacement);
  3491. var altAxis = getAltAxis(mainAxis);
  3492. var popperOffsets2 = state.modifiersData.popperOffsets;
  3493. var referenceRect = state.rects.reference;
  3494. var popperRect = state.rects.popper;
  3495. var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
  3496. placement: state.placement
  3497. })) : tetherOffset;
  3498. var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
  3499. mainAxis: tetherOffsetValue,
  3500. altAxis: tetherOffsetValue
  3501. } : Object.assign({
  3502. mainAxis: 0,
  3503. altAxis: 0
  3504. }, tetherOffsetValue);
  3505. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  3506. var data = {
  3507. x: 0,
  3508. y: 0
  3509. };
  3510. if (!popperOffsets2) {
  3511. return;
  3512. }
  3513. if (checkMainAxis) {
  3514. var _offsetModifierState$;
  3515. var mainSide = mainAxis === "y" ? top : left;
  3516. var altSide = mainAxis === "y" ? bottom : right;
  3517. var len = mainAxis === "y" ? "height" : "width";
  3518. var offset2 = popperOffsets2[mainAxis];
  3519. var min$1 = offset2 + overflow[mainSide];
  3520. var max$1 = offset2 - overflow[altSide];
  3521. var additive = tether ? -popperRect[len] / 2 : 0;
  3522. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  3523. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
  3524. var arrowElement = state.elements.arrow;
  3525. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  3526. width: 0,
  3527. height: 0
  3528. };
  3529. var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
  3530. var arrowPaddingMin = arrowPaddingObject[mainSide];
  3531. var arrowPaddingMax = arrowPaddingObject[altSide];
  3532. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  3533. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  3534. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  3535. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  3536. var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  3537. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  3538. var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
  3539. var tetherMax = offset2 + maxOffset - offsetModifierValue;
  3540. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
  3541. popperOffsets2[mainAxis] = preventedOffset;
  3542. data[mainAxis] = preventedOffset - offset2;
  3543. }
  3544. if (checkAltAxis) {
  3545. var _offsetModifierState$2;
  3546. var _mainSide = mainAxis === "x" ? top : left;
  3547. var _altSide = mainAxis === "x" ? bottom : right;
  3548. var _offset = popperOffsets2[altAxis];
  3549. var _len = altAxis === "y" ? "height" : "width";
  3550. var _min = _offset + overflow[_mainSide];
  3551. var _max = _offset - overflow[_altSide];
  3552. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  3553. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  3554. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  3555. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  3556. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  3557. popperOffsets2[altAxis] = _preventedOffset;
  3558. data[altAxis] = _preventedOffset - _offset;
  3559. }
  3560. state.modifiersData[name] = data;
  3561. }
  3562. const preventOverflow$1 = {
  3563. name: "preventOverflow",
  3564. enabled: true,
  3565. phase: "main",
  3566. fn: preventOverflow,
  3567. requiresIfExists: ["offset"]
  3568. };
  3569. function getHTMLElementScroll(element) {
  3570. return {
  3571. scrollLeft: element.scrollLeft,
  3572. scrollTop: element.scrollTop
  3573. };
  3574. }
  3575. function getNodeScroll(node) {
  3576. if (node === getWindow(node) || !isHTMLElement(node)) {
  3577. return getWindowScroll(node);
  3578. } else {
  3579. return getHTMLElementScroll(node);
  3580. }
  3581. }
  3582. function isElementScaled(element) {
  3583. var rect = element.getBoundingClientRect();
  3584. var scaleX = round(rect.width) / element.offsetWidth || 1;
  3585. var scaleY = round(rect.height) / element.offsetHeight || 1;
  3586. return scaleX !== 1 || scaleY !== 1;
  3587. }
  3588. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  3589. if (isFixed === void 0) {
  3590. isFixed = false;
  3591. }
  3592. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  3593. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  3594. var documentElement = getDocumentElement(offsetParent);
  3595. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  3596. var scroll = {
  3597. scrollLeft: 0,
  3598. scrollTop: 0
  3599. };
  3600. var offsets = {
  3601. x: 0,
  3602. y: 0
  3603. };
  3604. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  3605. if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
  3606. isScrollParent(documentElement)) {
  3607. scroll = getNodeScroll(offsetParent);
  3608. }
  3609. if (isHTMLElement(offsetParent)) {
  3610. offsets = getBoundingClientRect(offsetParent, true);
  3611. offsets.x += offsetParent.clientLeft;
  3612. offsets.y += offsetParent.clientTop;
  3613. } else if (documentElement) {
  3614. offsets.x = getWindowScrollBarX(documentElement);
  3615. }
  3616. }
  3617. return {
  3618. x: rect.left + scroll.scrollLeft - offsets.x,
  3619. y: rect.top + scroll.scrollTop - offsets.y,
  3620. width: rect.width,
  3621. height: rect.height
  3622. };
  3623. }
  3624. function order(modifiers) {
  3625. var map = /* @__PURE__ */ new Map();
  3626. var visited = /* @__PURE__ */ new Set();
  3627. var result = [];
  3628. modifiers.forEach(function(modifier) {
  3629. map.set(modifier.name, modifier);
  3630. });
  3631. function sort(modifier) {
  3632. visited.add(modifier.name);
  3633. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  3634. requires.forEach(function(dep) {
  3635. if (!visited.has(dep)) {
  3636. var depModifier = map.get(dep);
  3637. if (depModifier) {
  3638. sort(depModifier);
  3639. }
  3640. }
  3641. });
  3642. result.push(modifier);
  3643. }
  3644. modifiers.forEach(function(modifier) {
  3645. if (!visited.has(modifier.name)) {
  3646. sort(modifier);
  3647. }
  3648. });
  3649. return result;
  3650. }
  3651. function orderModifiers(modifiers) {
  3652. var orderedModifiers = order(modifiers);
  3653. return modifierPhases.reduce(function(acc, phase) {
  3654. return acc.concat(orderedModifiers.filter(function(modifier) {
  3655. return modifier.phase === phase;
  3656. }));
  3657. }, []);
  3658. }
  3659. function debounce$1(fn2) {
  3660. var pending;
  3661. return function() {
  3662. if (!pending) {
  3663. pending = new Promise(function(resolve) {
  3664. Promise.resolve().then(function() {
  3665. pending = void 0;
  3666. resolve(fn2());
  3667. });
  3668. });
  3669. }
  3670. return pending;
  3671. };
  3672. }
  3673. function mergeByName(modifiers) {
  3674. var merged = modifiers.reduce(function(merged2, current) {
  3675. var existing = merged2[current.name];
  3676. merged2[current.name] = existing ? Object.assign({}, existing, current, {
  3677. options: Object.assign({}, existing.options, current.options),
  3678. data: Object.assign({}, existing.data, current.data)
  3679. }) : current;
  3680. return merged2;
  3681. }, {});
  3682. return Object.keys(merged).map(function(key) {
  3683. return merged[key];
  3684. });
  3685. }
  3686. var DEFAULT_OPTIONS = {
  3687. placement: "bottom",
  3688. modifiers: [],
  3689. strategy: "absolute"
  3690. };
  3691. function areValidElements() {
  3692. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  3693. args[_key] = arguments[_key];
  3694. }
  3695. return !args.some(function(element) {
  3696. return !(element && typeof element.getBoundingClientRect === "function");
  3697. });
  3698. }
  3699. function popperGenerator(generatorOptions) {
  3700. if (generatorOptions === void 0) {
  3701. generatorOptions = {};
  3702. }
  3703. 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;
  3704. return function createPopper2(reference2, popper2, options) {
  3705. if (options === void 0) {
  3706. options = defaultOptions;
  3707. }
  3708. var state = {
  3709. placement: "bottom",
  3710. orderedModifiers: [],
  3711. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  3712. modifiersData: {},
  3713. elements: {
  3714. reference: reference2,
  3715. popper: popper2
  3716. },
  3717. attributes: {},
  3718. styles: {}
  3719. };
  3720. var effectCleanupFns = [];
  3721. var isDestroyed = false;
  3722. var instance = {
  3723. state,
  3724. setOptions: function setOptions(setOptionsAction) {
  3725. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  3726. cleanupModifierEffects();
  3727. state.options = Object.assign({}, defaultOptions, state.options, options2);
  3728. state.scrollParents = {
  3729. reference: isElement$1(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
  3730. popper: listScrollParents(popper2)
  3731. };
  3732. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  3733. state.orderedModifiers = orderedModifiers.filter(function(m) {
  3734. return m.enabled;
  3735. });
  3736. runModifierEffects();
  3737. return instance.update();
  3738. },
  3739. // Sync update – it will always be executed, even if not necessary. This
  3740. // is useful for low frequency updates where sync behavior simplifies the
  3741. // logic.
  3742. // For high frequency updates (e.g. `resize` and `scroll` events), always
  3743. // prefer the async Popper#update method
  3744. forceUpdate: function forceUpdate() {
  3745. if (isDestroyed) {
  3746. return;
  3747. }
  3748. var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
  3749. if (!areValidElements(reference3, popper3)) {
  3750. return;
  3751. }
  3752. state.rects = {
  3753. reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
  3754. popper: getLayoutRect(popper3)
  3755. };
  3756. state.reset = false;
  3757. state.placement = state.options.placement;
  3758. state.orderedModifiers.forEach(function(modifier) {
  3759. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  3760. });
  3761. for (var index = 0; index < state.orderedModifiers.length; index++) {
  3762. if (state.reset === true) {
  3763. state.reset = false;
  3764. index = -1;
  3765. continue;
  3766. }
  3767. 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;
  3768. if (typeof fn2 === "function") {
  3769. state = fn2({
  3770. state,
  3771. options: _options,
  3772. name,
  3773. instance
  3774. }) || state;
  3775. }
  3776. }
  3777. },
  3778. // Async and optimistically optimized update – it will not be executed if
  3779. // not necessary (debounced to run at most once-per-tick)
  3780. update: debounce$1(function() {
  3781. return new Promise(function(resolve) {
  3782. instance.forceUpdate();
  3783. resolve(state);
  3784. });
  3785. }),
  3786. destroy: function destroy() {
  3787. cleanupModifierEffects();
  3788. isDestroyed = true;
  3789. }
  3790. };
  3791. if (!areValidElements(reference2, popper2)) {
  3792. return instance;
  3793. }
  3794. instance.setOptions(options).then(function(state2) {
  3795. if (!isDestroyed && options.onFirstUpdate) {
  3796. options.onFirstUpdate(state2);
  3797. }
  3798. });
  3799. function runModifierEffects() {
  3800. state.orderedModifiers.forEach(function(_ref) {
  3801. var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect3 = _ref.effect;
  3802. if (typeof effect3 === "function") {
  3803. var cleanupFn = effect3({
  3804. state,
  3805. name,
  3806. instance,
  3807. options: options2
  3808. });
  3809. var noopFn = function noopFn2() {
  3810. };
  3811. effectCleanupFns.push(cleanupFn || noopFn);
  3812. }
  3813. });
  3814. }
  3815. function cleanupModifierEffects() {
  3816. effectCleanupFns.forEach(function(fn2) {
  3817. return fn2();
  3818. });
  3819. effectCleanupFns = [];
  3820. }
  3821. return instance;
  3822. };
  3823. }
  3824. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  3825. var createPopper = /* @__PURE__ */ popperGenerator({
  3826. defaultModifiers
  3827. });
  3828. var BOX_CLASS = "tippy-box";
  3829. var CONTENT_CLASS = "tippy-content";
  3830. var BACKDROP_CLASS = "tippy-backdrop";
  3831. var ARROW_CLASS = "tippy-arrow";
  3832. var SVG_ARROW_CLASS = "tippy-svg-arrow";
  3833. var TOUCH_OPTIONS = {
  3834. passive: true,
  3835. capture: true
  3836. };
  3837. var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO2() {
  3838. return document.body;
  3839. };
  3840. function getValueAtIndexOrReturn(value, index, defaultValue) {
  3841. if (Array.isArray(value)) {
  3842. var v = value[index];
  3843. return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;
  3844. }
  3845. return value;
  3846. }
  3847. function isType(value, type) {
  3848. var str = {}.toString.call(value);
  3849. return str.indexOf("[object") === 0 && str.indexOf(type + "]") > -1;
  3850. }
  3851. function invokeWithArgsOrReturn(value, args) {
  3852. return typeof value === "function" ? value.apply(void 0, args) : value;
  3853. }
  3854. function debounce(fn5, ms) {
  3855. if (ms === 0) {
  3856. return fn5;
  3857. }
  3858. var timeout;
  3859. return function(arg) {
  3860. clearTimeout(timeout);
  3861. timeout = setTimeout(function() {
  3862. fn5(arg);
  3863. }, ms);
  3864. };
  3865. }
  3866. function splitBySpaces(value) {
  3867. return value.split(/\s+/).filter(Boolean);
  3868. }
  3869. function normalizeToArray(value) {
  3870. return [].concat(value);
  3871. }
  3872. function pushIfUnique(arr, value) {
  3873. if (arr.indexOf(value) === -1) {
  3874. arr.push(value);
  3875. }
  3876. }
  3877. function unique(arr) {
  3878. return arr.filter(function(item, index) {
  3879. return arr.indexOf(item) === index;
  3880. });
  3881. }
  3882. function getBasePlacement(placement) {
  3883. return placement.split("-")[0];
  3884. }
  3885. function arrayFrom(value) {
  3886. return [].slice.call(value);
  3887. }
  3888. function removeUndefinedProps(obj) {
  3889. return Object.keys(obj).reduce(function(acc, key) {
  3890. if (obj[key] !== void 0) {
  3891. acc[key] = obj[key];
  3892. }
  3893. return acc;
  3894. }, {});
  3895. }
  3896. function div() {
  3897. return document.createElement("div");
  3898. }
  3899. function isElement(value) {
  3900. return ["Element", "Fragment"].some(function(type) {
  3901. return isType(value, type);
  3902. });
  3903. }
  3904. function isNodeList(value) {
  3905. return isType(value, "NodeList");
  3906. }
  3907. function isMouseEvent(value) {
  3908. return isType(value, "MouseEvent");
  3909. }
  3910. function isReferenceElement(value) {
  3911. return !!(value && value._tippy && value._tippy.reference === value);
  3912. }
  3913. function getArrayOfElements(value) {
  3914. if (isElement(value)) {
  3915. return [value];
  3916. }
  3917. if (isNodeList(value)) {
  3918. return arrayFrom(value);
  3919. }
  3920. if (Array.isArray(value)) {
  3921. return value;
  3922. }
  3923. return arrayFrom(document.querySelectorAll(value));
  3924. }
  3925. function setTransitionDuration(els, value) {
  3926. els.forEach(function(el) {
  3927. if (el) {
  3928. el.style.transitionDuration = value + "ms";
  3929. }
  3930. });
  3931. }
  3932. function setVisibilityState(els, state) {
  3933. els.forEach(function(el) {
  3934. if (el) {
  3935. el.setAttribute("data-state", state);
  3936. }
  3937. });
  3938. }
  3939. function getOwnerDocument(elementOrElements) {
  3940. var _element$ownerDocumen;
  3941. var _normalizeToArray = normalizeToArray(elementOrElements), element = _normalizeToArray[0];
  3942. return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
  3943. }
  3944. function isCursorOutsideInteractiveBorder(popperTreeData, event) {
  3945. var clientX = event.clientX, clientY = event.clientY;
  3946. return popperTreeData.every(function(_ref) {
  3947. var popperRect = _ref.popperRect, popperState = _ref.popperState, props = _ref.props;
  3948. var interactiveBorder = props.interactiveBorder;
  3949. var basePlacement = getBasePlacement(popperState.placement);
  3950. var offsetData = popperState.modifiersData.offset;
  3951. if (!offsetData) {
  3952. return true;
  3953. }
  3954. var topDistance = basePlacement === "bottom" ? offsetData.top.y : 0;
  3955. var bottomDistance = basePlacement === "top" ? offsetData.bottom.y : 0;
  3956. var leftDistance = basePlacement === "right" ? offsetData.left.x : 0;
  3957. var rightDistance = basePlacement === "left" ? offsetData.right.x : 0;
  3958. var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder;
  3959. var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder;
  3960. var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder;
  3961. var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder;
  3962. return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
  3963. });
  3964. }
  3965. function updateTransitionEndListener(box, action, listener) {
  3966. var method = action + "EventListener";
  3967. ["transitionend", "webkitTransitionEnd"].forEach(function(event) {
  3968. box[method](event, listener);
  3969. });
  3970. }
  3971. function actualContains(parent, child) {
  3972. var target = child;
  3973. while (target) {
  3974. var _target$getRootNode;
  3975. if (parent.contains(target)) {
  3976. return true;
  3977. }
  3978. target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
  3979. }
  3980. return false;
  3981. }
  3982. var currentInput = {
  3983. isTouch: false
  3984. };
  3985. var lastMouseMoveTime = 0;
  3986. function onDocumentTouchStart() {
  3987. if (currentInput.isTouch) {
  3988. return;
  3989. }
  3990. currentInput.isTouch = true;
  3991. if (window.performance) {
  3992. document.addEventListener("mousemove", onDocumentMouseMove);
  3993. }
  3994. }
  3995. function onDocumentMouseMove() {
  3996. var now = performance.now();
  3997. if (now - lastMouseMoveTime < 20) {
  3998. currentInput.isTouch = false;
  3999. document.removeEventListener("mousemove", onDocumentMouseMove);
  4000. }
  4001. lastMouseMoveTime = now;
  4002. }
  4003. function onWindowBlur() {
  4004. var activeElement = document.activeElement;
  4005. if (isReferenceElement(activeElement)) {
  4006. var instance = activeElement._tippy;
  4007. if (activeElement.blur && !instance.state.isVisible) {
  4008. activeElement.blur();
  4009. }
  4010. }
  4011. }
  4012. function bindGlobalEventListeners() {
  4013. document.addEventListener("touchstart", onDocumentTouchStart, TOUCH_OPTIONS);
  4014. window.addEventListener("blur", onWindowBlur);
  4015. }
  4016. var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
  4017. var isIE11 = isBrowser ? (
  4018. // @ts-ignore
  4019. !!window.msCrypto
  4020. ) : false;
  4021. var pluginProps = {
  4022. animateFill: false,
  4023. followCursor: false,
  4024. inlinePositioning: false,
  4025. sticky: false
  4026. };
  4027. var renderProps = {
  4028. allowHTML: false,
  4029. animation: "fade",
  4030. arrow: true,
  4031. content: "",
  4032. inertia: false,
  4033. maxWidth: 350,
  4034. role: "tooltip",
  4035. theme: "",
  4036. zIndex: 9999
  4037. };
  4038. var defaultProps = Object.assign({
  4039. appendTo: TIPPY_DEFAULT_APPEND_TO,
  4040. aria: {
  4041. content: "auto",
  4042. expanded: "auto"
  4043. },
  4044. delay: 0,
  4045. duration: [300, 250],
  4046. getReferenceClientRect: null,
  4047. hideOnClick: true,
  4048. ignoreAttributes: false,
  4049. interactive: false,
  4050. interactiveBorder: 2,
  4051. interactiveDebounce: 0,
  4052. moveTransition: "",
  4053. offset: [0, 10],
  4054. onAfterUpdate: function onAfterUpdate() {
  4055. },
  4056. onBeforeUpdate: function onBeforeUpdate() {
  4057. },
  4058. onCreate: function onCreate() {
  4059. },
  4060. onDestroy: function onDestroy() {
  4061. },
  4062. onHidden: function onHidden() {
  4063. },
  4064. onHide: function onHide() {
  4065. },
  4066. onMount: function onMount() {
  4067. },
  4068. onShow: function onShow() {
  4069. },
  4070. onShown: function onShown() {
  4071. },
  4072. onTrigger: function onTrigger() {
  4073. },
  4074. onUntrigger: function onUntrigger() {
  4075. },
  4076. onClickOutside: function onClickOutside() {
  4077. },
  4078. placement: "top",
  4079. plugins: [],
  4080. popperOptions: {},
  4081. render: null,
  4082. showOnCreate: false,
  4083. touch: true,
  4084. trigger: "mouseenter focus",
  4085. triggerTarget: null
  4086. }, pluginProps, renderProps);
  4087. var defaultKeys = Object.keys(defaultProps);
  4088. var setDefaultProps = function setDefaultProps2(partialProps) {
  4089. var keys = Object.keys(partialProps);
  4090. keys.forEach(function(key) {
  4091. defaultProps[key] = partialProps[key];
  4092. });
  4093. };
  4094. function getExtendedPassedProps(passedProps) {
  4095. var plugins = passedProps.plugins || [];
  4096. var pluginProps2 = plugins.reduce(function(acc, plugin) {
  4097. var name = plugin.name, defaultValue = plugin.defaultValue;
  4098. if (name) {
  4099. var _name;
  4100. acc[name] = passedProps[name] !== void 0 ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
  4101. }
  4102. return acc;
  4103. }, {});
  4104. return Object.assign({}, passedProps, pluginProps2);
  4105. }
  4106. function getDataAttributeProps(reference2, plugins) {
  4107. var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
  4108. plugins
  4109. }))) : defaultKeys;
  4110. var props = propKeys.reduce(function(acc, key) {
  4111. var valueAsString = (reference2.getAttribute("data-tippy-" + key) || "").trim();
  4112. if (!valueAsString) {
  4113. return acc;
  4114. }
  4115. if (key === "content") {
  4116. acc[key] = valueAsString;
  4117. } else {
  4118. try {
  4119. acc[key] = JSON.parse(valueAsString);
  4120. } catch (e) {
  4121. acc[key] = valueAsString;
  4122. }
  4123. }
  4124. return acc;
  4125. }, {});
  4126. return props;
  4127. }
  4128. function evaluateProps(reference2, props) {
  4129. var out = Object.assign({}, props, {
  4130. content: invokeWithArgsOrReturn(props.content, [reference2])
  4131. }, props.ignoreAttributes ? {} : getDataAttributeProps(reference2, props.plugins));
  4132. out.aria = Object.assign({}, defaultProps.aria, out.aria);
  4133. out.aria = {
  4134. expanded: out.aria.expanded === "auto" ? props.interactive : out.aria.expanded,
  4135. content: out.aria.content === "auto" ? props.interactive ? null : "describedby" : out.aria.content
  4136. };
  4137. return out;
  4138. }
  4139. var innerHTML = function innerHTML2() {
  4140. return "innerHTML";
  4141. };
  4142. function dangerouslySetInnerHTML(element, html) {
  4143. element[innerHTML()] = html;
  4144. }
  4145. function createArrowElement(value) {
  4146. var arrow2 = div();
  4147. if (value === true) {
  4148. arrow2.className = ARROW_CLASS;
  4149. } else {
  4150. arrow2.className = SVG_ARROW_CLASS;
  4151. if (isElement(value)) {
  4152. arrow2.appendChild(value);
  4153. } else {
  4154. dangerouslySetInnerHTML(arrow2, value);
  4155. }
  4156. }
  4157. return arrow2;
  4158. }
  4159. function setContent(content, props) {
  4160. if (isElement(props.content)) {
  4161. dangerouslySetInnerHTML(content, "");
  4162. content.appendChild(props.content);
  4163. } else if (typeof props.content !== "function") {
  4164. if (props.allowHTML) {
  4165. dangerouslySetInnerHTML(content, props.content);
  4166. } else {
  4167. content.textContent = props.content;
  4168. }
  4169. }
  4170. }
  4171. function getChildren(popper2) {
  4172. var box = popper2.firstElementChild;
  4173. var boxChildren = arrayFrom(box.children);
  4174. return {
  4175. box,
  4176. content: boxChildren.find(function(node) {
  4177. return node.classList.contains(CONTENT_CLASS);
  4178. }),
  4179. arrow: boxChildren.find(function(node) {
  4180. return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS);
  4181. }),
  4182. backdrop: boxChildren.find(function(node) {
  4183. return node.classList.contains(BACKDROP_CLASS);
  4184. })
  4185. };
  4186. }
  4187. function render(instance) {
  4188. var popper2 = div();
  4189. var box = div();
  4190. box.className = BOX_CLASS;
  4191. box.setAttribute("data-state", "hidden");
  4192. box.setAttribute("tabindex", "-1");
  4193. var content = div();
  4194. content.className = CONTENT_CLASS;
  4195. content.setAttribute("data-state", "hidden");
  4196. setContent(content, instance.props);
  4197. popper2.appendChild(box);
  4198. box.appendChild(content);
  4199. onUpdate(instance.props, instance.props);
  4200. function onUpdate(prevProps, nextProps) {
  4201. var _getChildren = getChildren(popper2), box2 = _getChildren.box, content2 = _getChildren.content, arrow2 = _getChildren.arrow;
  4202. if (nextProps.theme) {
  4203. box2.setAttribute("data-theme", nextProps.theme);
  4204. } else {
  4205. box2.removeAttribute("data-theme");
  4206. }
  4207. if (typeof nextProps.animation === "string") {
  4208. box2.setAttribute("data-animation", nextProps.animation);
  4209. } else {
  4210. box2.removeAttribute("data-animation");
  4211. }
  4212. if (nextProps.inertia) {
  4213. box2.setAttribute("data-inertia", "");
  4214. } else {
  4215. box2.removeAttribute("data-inertia");
  4216. }
  4217. box2.style.maxWidth = typeof nextProps.maxWidth === "number" ? nextProps.maxWidth + "px" : nextProps.maxWidth;
  4218. if (nextProps.role) {
  4219. box2.setAttribute("role", nextProps.role);
  4220. } else {
  4221. box2.removeAttribute("role");
  4222. }
  4223. if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) {
  4224. setContent(content2, instance.props);
  4225. }
  4226. if (nextProps.arrow) {
  4227. if (!arrow2) {
  4228. box2.appendChild(createArrowElement(nextProps.arrow));
  4229. } else if (prevProps.arrow !== nextProps.arrow) {
  4230. box2.removeChild(arrow2);
  4231. box2.appendChild(createArrowElement(nextProps.arrow));
  4232. }
  4233. } else if (arrow2) {
  4234. box2.removeChild(arrow2);
  4235. }
  4236. }
  4237. return {
  4238. popper: popper2,
  4239. onUpdate
  4240. };
  4241. }
  4242. render.$$tippy = true;
  4243. var idCounter = 1;
  4244. var mouseMoveListeners = [];
  4245. var mountedInstances = [];
  4246. function createTippy(reference2, passedProps) {
  4247. var props = evaluateProps(reference2, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps))));
  4248. var showTimeout;
  4249. var hideTimeout;
  4250. var scheduleHideAnimationFrame;
  4251. var isVisibleFromClick = false;
  4252. var didHideDueToDocumentMouseDown = false;
  4253. var didTouchMove = false;
  4254. var ignoreOnFirstUpdate = false;
  4255. var lastTriggerEvent;
  4256. var currentTransitionEndListener;
  4257. var onFirstUpdate;
  4258. var listeners = [];
  4259. var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
  4260. var currentTarget;
  4261. var id = idCounter++;
  4262. var popperInstance = null;
  4263. var plugins = unique(props.plugins);
  4264. var state = {
  4265. // Is the instance currently enabled?
  4266. isEnabled: true,
  4267. // Is the tippy currently showing and not transitioning out?
  4268. isVisible: false,
  4269. // Has the instance been destroyed?
  4270. isDestroyed: false,
  4271. // Is the tippy currently mounted to the DOM?
  4272. isMounted: false,
  4273. // Has the tippy finished transitioning in?
  4274. isShown: false
  4275. };
  4276. var instance = {
  4277. // properties
  4278. id,
  4279. reference: reference2,
  4280. popper: div(),
  4281. popperInstance,
  4282. props,
  4283. state,
  4284. plugins,
  4285. // methods
  4286. clearDelayTimeouts,
  4287. setProps,
  4288. setContent: setContent2,
  4289. show,
  4290. hide: hide2,
  4291. hideWithInteractivity,
  4292. enable,
  4293. disable,
  4294. unmount,
  4295. destroy
  4296. };
  4297. if (!props.render) {
  4298. return instance;
  4299. }
  4300. var _props$render = props.render(instance), popper2 = _props$render.popper, onUpdate = _props$render.onUpdate;
  4301. popper2.setAttribute("data-tippy-root", "");
  4302. popper2.id = "tippy-" + instance.id;
  4303. instance.popper = popper2;
  4304. reference2._tippy = instance;
  4305. popper2._tippy = instance;
  4306. var pluginsHooks = plugins.map(function(plugin) {
  4307. return plugin.fn(instance);
  4308. });
  4309. var hasAriaExpanded = reference2.hasAttribute("aria-expanded");
  4310. addListeners();
  4311. handleAriaExpandedAttribute();
  4312. handleStyles();
  4313. invokeHook("onCreate", [instance]);
  4314. if (props.showOnCreate) {
  4315. scheduleShow();
  4316. }
  4317. popper2.addEventListener("mouseenter", function() {
  4318. if (instance.props.interactive && instance.state.isVisible) {
  4319. instance.clearDelayTimeouts();
  4320. }
  4321. });
  4322. popper2.addEventListener("mouseleave", function() {
  4323. if (instance.props.interactive && instance.props.trigger.indexOf("mouseenter") >= 0) {
  4324. getDocument().addEventListener("mousemove", debouncedOnMouseMove);
  4325. }
  4326. });
  4327. return instance;
  4328. function getNormalizedTouchSettings() {
  4329. var touch = instance.props.touch;
  4330. return Array.isArray(touch) ? touch : [touch, 0];
  4331. }
  4332. function getIsCustomTouchBehavior() {
  4333. return getNormalizedTouchSettings()[0] === "hold";
  4334. }
  4335. function getIsDefaultRenderFn() {
  4336. var _instance$props$rende;
  4337. return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
  4338. }
  4339. function getCurrentTarget() {
  4340. return currentTarget || reference2;
  4341. }
  4342. function getDocument() {
  4343. var parent = getCurrentTarget().parentNode;
  4344. return parent ? getOwnerDocument(parent) : document;
  4345. }
  4346. function getDefaultTemplateChildren() {
  4347. return getChildren(popper2);
  4348. }
  4349. function getDelay(isShow) {
  4350. if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === "focus") {
  4351. return 0;
  4352. }
  4353. return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
  4354. }
  4355. function handleStyles(fromHide) {
  4356. if (fromHide === void 0) {
  4357. fromHide = false;
  4358. }
  4359. popper2.style.pointerEvents = instance.props.interactive && !fromHide ? "" : "none";
  4360. popper2.style.zIndex = "" + instance.props.zIndex;
  4361. }
  4362. function invokeHook(hook, args, shouldInvokePropsHook) {
  4363. if (shouldInvokePropsHook === void 0) {
  4364. shouldInvokePropsHook = true;
  4365. }
  4366. pluginsHooks.forEach(function(pluginHooks) {
  4367. if (pluginHooks[hook]) {
  4368. pluginHooks[hook].apply(pluginHooks, args);
  4369. }
  4370. });
  4371. if (shouldInvokePropsHook) {
  4372. var _instance$props;
  4373. (_instance$props = instance.props)[hook].apply(_instance$props, args);
  4374. }
  4375. }
  4376. function handleAriaContentAttribute() {
  4377. var aria = instance.props.aria;
  4378. if (!aria.content) {
  4379. return;
  4380. }
  4381. var attr = "aria-" + aria.content;
  4382. var id2 = popper2.id;
  4383. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  4384. nodes.forEach(function(node) {
  4385. var currentValue = node.getAttribute(attr);
  4386. if (instance.state.isVisible) {
  4387. node.setAttribute(attr, currentValue ? currentValue + " " + id2 : id2);
  4388. } else {
  4389. var nextValue = currentValue && currentValue.replace(id2, "").trim();
  4390. if (nextValue) {
  4391. node.setAttribute(attr, nextValue);
  4392. } else {
  4393. node.removeAttribute(attr);
  4394. }
  4395. }
  4396. });
  4397. }
  4398. function handleAriaExpandedAttribute() {
  4399. if (hasAriaExpanded || !instance.props.aria.expanded) {
  4400. return;
  4401. }
  4402. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  4403. nodes.forEach(function(node) {
  4404. if (instance.props.interactive) {
  4405. node.setAttribute("aria-expanded", instance.state.isVisible && node === getCurrentTarget() ? "true" : "false");
  4406. } else {
  4407. node.removeAttribute("aria-expanded");
  4408. }
  4409. });
  4410. }
  4411. function cleanupInteractiveMouseListeners() {
  4412. getDocument().removeEventListener("mousemove", debouncedOnMouseMove);
  4413. mouseMoveListeners = mouseMoveListeners.filter(function(listener) {
  4414. return listener !== debouncedOnMouseMove;
  4415. });
  4416. }
  4417. function onDocumentPress(event) {
  4418. if (currentInput.isTouch) {
  4419. if (didTouchMove || event.type === "mousedown") {
  4420. return;
  4421. }
  4422. }
  4423. var actualTarget = event.composedPath && event.composedPath()[0] || event.target;
  4424. if (instance.props.interactive && actualContains(popper2, actualTarget)) {
  4425. return;
  4426. }
  4427. if (normalizeToArray(instance.props.triggerTarget || reference2).some(function(el) {
  4428. return actualContains(el, actualTarget);
  4429. })) {
  4430. if (currentInput.isTouch) {
  4431. return;
  4432. }
  4433. if (instance.state.isVisible && instance.props.trigger.indexOf("click") >= 0) {
  4434. return;
  4435. }
  4436. } else {
  4437. invokeHook("onClickOutside", [instance, event]);
  4438. }
  4439. if (instance.props.hideOnClick === true) {
  4440. instance.clearDelayTimeouts();
  4441. instance.hide();
  4442. didHideDueToDocumentMouseDown = true;
  4443. setTimeout(function() {
  4444. didHideDueToDocumentMouseDown = false;
  4445. });
  4446. if (!instance.state.isMounted) {
  4447. removeDocumentPress();
  4448. }
  4449. }
  4450. }
  4451. function onTouchMove() {
  4452. didTouchMove = true;
  4453. }
  4454. function onTouchStart() {
  4455. didTouchMove = false;
  4456. }
  4457. function addDocumentPress() {
  4458. var doc = getDocument();
  4459. doc.addEventListener("mousedown", onDocumentPress, true);
  4460. doc.addEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
  4461. doc.addEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
  4462. doc.addEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
  4463. }
  4464. function removeDocumentPress() {
  4465. var doc = getDocument();
  4466. doc.removeEventListener("mousedown", onDocumentPress, true);
  4467. doc.removeEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
  4468. doc.removeEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
  4469. doc.removeEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
  4470. }
  4471. function onTransitionedOut(duration, callback) {
  4472. onTransitionEnd(duration, function() {
  4473. if (!instance.state.isVisible && popper2.parentNode && popper2.parentNode.contains(popper2)) {
  4474. callback();
  4475. }
  4476. });
  4477. }
  4478. function onTransitionedIn(duration, callback) {
  4479. onTransitionEnd(duration, callback);
  4480. }
  4481. function onTransitionEnd(duration, callback) {
  4482. var box = getDefaultTemplateChildren().box;
  4483. function listener(event) {
  4484. if (event.target === box) {
  4485. updateTransitionEndListener(box, "remove", listener);
  4486. callback();
  4487. }
  4488. }
  4489. if (duration === 0) {
  4490. return callback();
  4491. }
  4492. updateTransitionEndListener(box, "remove", currentTransitionEndListener);
  4493. updateTransitionEndListener(box, "add", listener);
  4494. currentTransitionEndListener = listener;
  4495. }
  4496. function on(eventType, handler, options) {
  4497. if (options === void 0) {
  4498. options = false;
  4499. }
  4500. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  4501. nodes.forEach(function(node) {
  4502. node.addEventListener(eventType, handler, options);
  4503. listeners.push({
  4504. node,
  4505. eventType,
  4506. handler,
  4507. options
  4508. });
  4509. });
  4510. }
  4511. function addListeners() {
  4512. if (getIsCustomTouchBehavior()) {
  4513. on("touchstart", onTrigger2, {
  4514. passive: true
  4515. });
  4516. on("touchend", onMouseLeave, {
  4517. passive: true
  4518. });
  4519. }
  4520. splitBySpaces(instance.props.trigger).forEach(function(eventType) {
  4521. if (eventType === "manual") {
  4522. return;
  4523. }
  4524. on(eventType, onTrigger2);
  4525. switch (eventType) {
  4526. case "mouseenter":
  4527. on("mouseleave", onMouseLeave);
  4528. break;
  4529. case "focus":
  4530. on(isIE11 ? "focusout" : "blur", onBlurOrFocusOut);
  4531. break;
  4532. case "focusin":
  4533. on("focusout", onBlurOrFocusOut);
  4534. break;
  4535. }
  4536. });
  4537. }
  4538. function removeListeners() {
  4539. listeners.forEach(function(_ref) {
  4540. var node = _ref.node, eventType = _ref.eventType, handler = _ref.handler, options = _ref.options;
  4541. node.removeEventListener(eventType, handler, options);
  4542. });
  4543. listeners = [];
  4544. }
  4545. function onTrigger2(event) {
  4546. var _lastTriggerEvent;
  4547. var shouldScheduleClickHide = false;
  4548. if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
  4549. return;
  4550. }
  4551. var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === "focus";
  4552. lastTriggerEvent = event;
  4553. currentTarget = event.currentTarget;
  4554. handleAriaExpandedAttribute();
  4555. if (!instance.state.isVisible && isMouseEvent(event)) {
  4556. mouseMoveListeners.forEach(function(listener) {
  4557. return listener(event);
  4558. });
  4559. }
  4560. if (event.type === "click" && (instance.props.trigger.indexOf("mouseenter") < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
  4561. shouldScheduleClickHide = true;
  4562. } else {
  4563. scheduleShow(event);
  4564. }
  4565. if (event.type === "click") {
  4566. isVisibleFromClick = !shouldScheduleClickHide;
  4567. }
  4568. if (shouldScheduleClickHide && !wasFocused) {
  4569. scheduleHide(event);
  4570. }
  4571. }
  4572. function onMouseMove(event) {
  4573. var target = event.target;
  4574. var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper2.contains(target);
  4575. if (event.type === "mousemove" && isCursorOverReferenceOrPopper) {
  4576. return;
  4577. }
  4578. var popperTreeData = getNestedPopperTree().concat(popper2).map(function(popper22) {
  4579. var _instance$popperInsta;
  4580. var instance2 = popper22._tippy;
  4581. var state2 = (_instance$popperInsta = instance2.popperInstance) == null ? void 0 : _instance$popperInsta.state;
  4582. if (state2) {
  4583. return {
  4584. popperRect: popper22.getBoundingClientRect(),
  4585. popperState: state2,
  4586. props
  4587. };
  4588. }
  4589. return null;
  4590. }).filter(Boolean);
  4591. if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
  4592. cleanupInteractiveMouseListeners();
  4593. scheduleHide(event);
  4594. }
  4595. }
  4596. function onMouseLeave(event) {
  4597. var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf("click") >= 0 && isVisibleFromClick;
  4598. if (shouldBail) {
  4599. return;
  4600. }
  4601. if (instance.props.interactive) {
  4602. instance.hideWithInteractivity(event);
  4603. return;
  4604. }
  4605. scheduleHide(event);
  4606. }
  4607. function onBlurOrFocusOut(event) {
  4608. if (instance.props.trigger.indexOf("focusin") < 0 && event.target !== getCurrentTarget()) {
  4609. return;
  4610. }
  4611. if (instance.props.interactive && event.relatedTarget && popper2.contains(event.relatedTarget)) {
  4612. return;
  4613. }
  4614. scheduleHide(event);
  4615. }
  4616. function isEventListenerStopped(event) {
  4617. return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf("touch") >= 0 : false;
  4618. }
  4619. function createPopperInstance() {
  4620. destroyPopperInstance();
  4621. 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;
  4622. var arrow2 = getIsDefaultRenderFn() ? getChildren(popper2).arrow : null;
  4623. var computedReference = getReferenceClientRect ? {
  4624. getBoundingClientRect: getReferenceClientRect,
  4625. contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
  4626. } : reference2;
  4627. var tippyModifier = {
  4628. name: "$$tippy",
  4629. enabled: true,
  4630. phase: "beforeWrite",
  4631. requires: ["computeStyles"],
  4632. fn: function fn5(_ref2) {
  4633. var state2 = _ref2.state;
  4634. if (getIsDefaultRenderFn()) {
  4635. var _getDefaultTemplateCh = getDefaultTemplateChildren(), box = _getDefaultTemplateCh.box;
  4636. ["placement", "reference-hidden", "escaped"].forEach(function(attr) {
  4637. if (attr === "placement") {
  4638. box.setAttribute("data-placement", state2.placement);
  4639. } else {
  4640. if (state2.attributes.popper["data-popper-" + attr]) {
  4641. box.setAttribute("data-" + attr, "");
  4642. } else {
  4643. box.removeAttribute("data-" + attr);
  4644. }
  4645. }
  4646. });
  4647. state2.attributes.popper = {};
  4648. }
  4649. }
  4650. };
  4651. var modifiers = [{
  4652. name: "offset",
  4653. options: {
  4654. offset: offset2
  4655. }
  4656. }, {
  4657. name: "preventOverflow",
  4658. options: {
  4659. padding: {
  4660. top: 2,
  4661. bottom: 2,
  4662. left: 5,
  4663. right: 5
  4664. }
  4665. }
  4666. }, {
  4667. name: "flip",
  4668. options: {
  4669. padding: 5
  4670. }
  4671. }, {
  4672. name: "computeStyles",
  4673. options: {
  4674. adaptive: !moveTransition
  4675. }
  4676. }, tippyModifier];
  4677. if (getIsDefaultRenderFn() && arrow2) {
  4678. modifiers.push({
  4679. name: "arrow",
  4680. options: {
  4681. element: arrow2,
  4682. padding: 3
  4683. }
  4684. });
  4685. }
  4686. modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
  4687. instance.popperInstance = createPopper(computedReference, popper2, Object.assign({}, popperOptions, {
  4688. placement,
  4689. onFirstUpdate,
  4690. modifiers
  4691. }));
  4692. }
  4693. function destroyPopperInstance() {
  4694. if (instance.popperInstance) {
  4695. instance.popperInstance.destroy();
  4696. instance.popperInstance = null;
  4697. }
  4698. }
  4699. function mount() {
  4700. var appendTo = instance.props.appendTo;
  4701. var parentNode;
  4702. var node = getCurrentTarget();
  4703. if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === "parent") {
  4704. parentNode = node.parentNode;
  4705. } else {
  4706. parentNode = invokeWithArgsOrReturn(appendTo, [node]);
  4707. }
  4708. if (!parentNode.contains(popper2)) {
  4709. parentNode.appendChild(popper2);
  4710. }
  4711. instance.state.isMounted = true;
  4712. createPopperInstance();
  4713. }
  4714. function getNestedPopperTree() {
  4715. return arrayFrom(popper2.querySelectorAll("[data-tippy-root]"));
  4716. }
  4717. function scheduleShow(event) {
  4718. instance.clearDelayTimeouts();
  4719. if (event) {
  4720. invokeHook("onTrigger", [instance, event]);
  4721. }
  4722. addDocumentPress();
  4723. var delay = getDelay(true);
  4724. var _getNormalizedTouchSe = getNormalizedTouchSettings(), touchValue = _getNormalizedTouchSe[0], touchDelay = _getNormalizedTouchSe[1];
  4725. if (currentInput.isTouch && touchValue === "hold" && touchDelay) {
  4726. delay = touchDelay;
  4727. }
  4728. if (delay) {
  4729. showTimeout = setTimeout(function() {
  4730. instance.show();
  4731. }, delay);
  4732. } else {
  4733. instance.show();
  4734. }
  4735. }
  4736. function scheduleHide(event) {
  4737. instance.clearDelayTimeouts();
  4738. invokeHook("onUntrigger", [instance, event]);
  4739. if (!instance.state.isVisible) {
  4740. removeDocumentPress();
  4741. return;
  4742. }
  4743. if (instance.props.trigger.indexOf("mouseenter") >= 0 && instance.props.trigger.indexOf("click") >= 0 && ["mouseleave", "mousemove"].indexOf(event.type) >= 0 && isVisibleFromClick) {
  4744. return;
  4745. }
  4746. var delay = getDelay(false);
  4747. if (delay) {
  4748. hideTimeout = setTimeout(function() {
  4749. if (instance.state.isVisible) {
  4750. instance.hide();
  4751. }
  4752. }, delay);
  4753. } else {
  4754. scheduleHideAnimationFrame = requestAnimationFrame(function() {
  4755. instance.hide();
  4756. });
  4757. }
  4758. }
  4759. function enable() {
  4760. instance.state.isEnabled = true;
  4761. }
  4762. function disable() {
  4763. instance.hide();
  4764. instance.state.isEnabled = false;
  4765. }
  4766. function clearDelayTimeouts() {
  4767. clearTimeout(showTimeout);
  4768. clearTimeout(hideTimeout);
  4769. cancelAnimationFrame(scheduleHideAnimationFrame);
  4770. }
  4771. function setProps(partialProps) {
  4772. if (instance.state.isDestroyed) {
  4773. return;
  4774. }
  4775. invokeHook("onBeforeUpdate", [instance, partialProps]);
  4776. removeListeners();
  4777. var prevProps = instance.props;
  4778. var nextProps = evaluateProps(reference2, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
  4779. ignoreAttributes: true
  4780. }));
  4781. instance.props = nextProps;
  4782. addListeners();
  4783. if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
  4784. cleanupInteractiveMouseListeners();
  4785. debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
  4786. }
  4787. if (prevProps.triggerTarget && !nextProps.triggerTarget) {
  4788. normalizeToArray(prevProps.triggerTarget).forEach(function(node) {
  4789. node.removeAttribute("aria-expanded");
  4790. });
  4791. } else if (nextProps.triggerTarget) {
  4792. reference2.removeAttribute("aria-expanded");
  4793. }
  4794. handleAriaExpandedAttribute();
  4795. handleStyles();
  4796. if (onUpdate) {
  4797. onUpdate(prevProps, nextProps);
  4798. }
  4799. if (instance.popperInstance) {
  4800. createPopperInstance();
  4801. getNestedPopperTree().forEach(function(nestedPopper) {
  4802. requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
  4803. });
  4804. }
  4805. invokeHook("onAfterUpdate", [instance, partialProps]);
  4806. }
  4807. function setContent2(content) {
  4808. instance.setProps({
  4809. content
  4810. });
  4811. }
  4812. function show() {
  4813. var isAlreadyVisible = instance.state.isVisible;
  4814. var isDestroyed = instance.state.isDestroyed;
  4815. var isDisabled = !instance.state.isEnabled;
  4816. var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
  4817. var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
  4818. if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
  4819. return;
  4820. }
  4821. if (getCurrentTarget().hasAttribute("disabled")) {
  4822. return;
  4823. }
  4824. invokeHook("onShow", [instance], false);
  4825. if (instance.props.onShow(instance) === false) {
  4826. return;
  4827. }
  4828. instance.state.isVisible = true;
  4829. if (getIsDefaultRenderFn()) {
  4830. popper2.style.visibility = "visible";
  4831. }
  4832. handleStyles();
  4833. addDocumentPress();
  4834. if (!instance.state.isMounted) {
  4835. popper2.style.transition = "none";
  4836. }
  4837. if (getIsDefaultRenderFn()) {
  4838. var _getDefaultTemplateCh2 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh2.box, content = _getDefaultTemplateCh2.content;
  4839. setTransitionDuration([box, content], 0);
  4840. }
  4841. onFirstUpdate = function onFirstUpdate2() {
  4842. var _instance$popperInsta2;
  4843. if (!instance.state.isVisible || ignoreOnFirstUpdate) {
  4844. return;
  4845. }
  4846. ignoreOnFirstUpdate = true;
  4847. void popper2.offsetHeight;
  4848. popper2.style.transition = instance.props.moveTransition;
  4849. if (getIsDefaultRenderFn() && instance.props.animation) {
  4850. var _getDefaultTemplateCh3 = getDefaultTemplateChildren(), _box = _getDefaultTemplateCh3.box, _content = _getDefaultTemplateCh3.content;
  4851. setTransitionDuration([_box, _content], duration);
  4852. setVisibilityState([_box, _content], "visible");
  4853. }
  4854. handleAriaContentAttribute();
  4855. handleAriaExpandedAttribute();
  4856. pushIfUnique(mountedInstances, instance);
  4857. (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
  4858. invokeHook("onMount", [instance]);
  4859. if (instance.props.animation && getIsDefaultRenderFn()) {
  4860. onTransitionedIn(duration, function() {
  4861. instance.state.isShown = true;
  4862. invokeHook("onShown", [instance]);
  4863. });
  4864. }
  4865. };
  4866. mount();
  4867. }
  4868. function hide2() {
  4869. var isAlreadyHidden = !instance.state.isVisible;
  4870. var isDestroyed = instance.state.isDestroyed;
  4871. var isDisabled = !instance.state.isEnabled;
  4872. var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
  4873. if (isAlreadyHidden || isDestroyed || isDisabled) {
  4874. return;
  4875. }
  4876. invokeHook("onHide", [instance], false);
  4877. if (instance.props.onHide(instance) === false) {
  4878. return;
  4879. }
  4880. instance.state.isVisible = false;
  4881. instance.state.isShown = false;
  4882. ignoreOnFirstUpdate = false;
  4883. isVisibleFromClick = false;
  4884. if (getIsDefaultRenderFn()) {
  4885. popper2.style.visibility = "hidden";
  4886. }
  4887. cleanupInteractiveMouseListeners();
  4888. removeDocumentPress();
  4889. handleStyles(true);
  4890. if (getIsDefaultRenderFn()) {
  4891. var _getDefaultTemplateCh4 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh4.box, content = _getDefaultTemplateCh4.content;
  4892. if (instance.props.animation) {
  4893. setTransitionDuration([box, content], duration);
  4894. setVisibilityState([box, content], "hidden");
  4895. }
  4896. }
  4897. handleAriaContentAttribute();
  4898. handleAriaExpandedAttribute();
  4899. if (instance.props.animation) {
  4900. if (getIsDefaultRenderFn()) {
  4901. onTransitionedOut(duration, instance.unmount);
  4902. }
  4903. } else {
  4904. instance.unmount();
  4905. }
  4906. }
  4907. function hideWithInteractivity(event) {
  4908. getDocument().addEventListener("mousemove", debouncedOnMouseMove);
  4909. pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
  4910. debouncedOnMouseMove(event);
  4911. }
  4912. function unmount() {
  4913. if (instance.state.isVisible) {
  4914. instance.hide();
  4915. }
  4916. if (!instance.state.isMounted) {
  4917. return;
  4918. }
  4919. destroyPopperInstance();
  4920. getNestedPopperTree().forEach(function(nestedPopper) {
  4921. nestedPopper._tippy.unmount();
  4922. });
  4923. if (popper2.parentNode) {
  4924. popper2.parentNode.removeChild(popper2);
  4925. }
  4926. mountedInstances = mountedInstances.filter(function(i) {
  4927. return i !== instance;
  4928. });
  4929. instance.state.isMounted = false;
  4930. invokeHook("onHidden", [instance]);
  4931. }
  4932. function destroy() {
  4933. if (instance.state.isDestroyed) {
  4934. return;
  4935. }
  4936. instance.clearDelayTimeouts();
  4937. instance.unmount();
  4938. removeListeners();
  4939. delete reference2._tippy;
  4940. instance.state.isDestroyed = true;
  4941. invokeHook("onDestroy", [instance]);
  4942. }
  4943. }
  4944. function tippy(targets, optionalProps) {
  4945. if (optionalProps === void 0) {
  4946. optionalProps = {};
  4947. }
  4948. var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
  4949. bindGlobalEventListeners();
  4950. var passedProps = Object.assign({}, optionalProps, {
  4951. plugins
  4952. });
  4953. var elements = getArrayOfElements(targets);
  4954. var instances = elements.reduce(function(acc, reference2) {
  4955. var instance = reference2 && createTippy(reference2, passedProps);
  4956. if (instance) {
  4957. acc.push(instance);
  4958. }
  4959. return acc;
  4960. }, []);
  4961. return isElement(targets) ? instances[0] : instances;
  4962. }
  4963. tippy.defaultProps = defaultProps;
  4964. tippy.setDefaultProps = setDefaultProps;
  4965. tippy.currentInput = currentInput;
  4966. Object.assign({}, applyStyles$1, {
  4967. effect: function effect2(_ref) {
  4968. var state = _ref.state;
  4969. var initialStyles = {
  4970. popper: {
  4971. position: state.options.strategy,
  4972. left: "0",
  4973. top: "0",
  4974. margin: "0"
  4975. },
  4976. arrow: {
  4977. position: "absolute"
  4978. },
  4979. reference: {}
  4980. };
  4981. Object.assign(state.elements.popper.style, initialStyles.popper);
  4982. state.styles = initialStyles;
  4983. if (state.elements.arrow) {
  4984. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  4985. }
  4986. }
  4987. });
  4988. tippy.setDefaultProps({
  4989. render
  4990. });
  4991.  
  4992. })
  4993. };
  4994. }));
  4995.  
  4996. System.register("./index-D3l8MoSf-Dhsxm64a.js", ['jquery'], (function (exports, module) {
  4997. 'use strict';
  4998. var $;
  4999. return {
  5000. setters: [module => {
  5001. $ = module.default;
  5002. }],
  5003. execute: (function () {
  5004.  
  5005. const $body = $(document.body);
  5006. const $container = $(".tabs-container");
  5007. $body.append('<div class="scroll-top"></div>');
  5008. $container.on("scroll", function() {
  5009. const scrollTop = $(this).scrollTop();
  5010. const scrollElment = $(".scroll-top");
  5011. scrollTop > 500 ? scrollElment.fadeIn() : scrollElment.fadeOut();
  5012. });
  5013. $body.on("click", ".scroll-top", function() {
  5014. $container.animate({ scrollTop: "0" }, 1e3);
  5015. });
  5016.  
  5017. })
  5018. };
  5019. }));
  5020.  
  5021. System.import("./__entry.js", "./");