JSON Viewer

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

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

  1. // ==UserScript==
  2. // @name JSON Viewer
  3. // @namespace http://tampermonkey.net/
  4. // @version v0.8.8
  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-BHri9xqK.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-BHri9xqK.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-CV0v1IGA-CtIArosR.js'), void 0 ).then((format) => format.default.init()).then(() => __vitePreload(() => module.import('./index-DHfJirSX-NT9ypnSr.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-CV0v1IGA-CtIArosR.js", ['jquery', './__monkey.entry-BHri9xqK.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-DHfJirSX-NT9ypnSr.js", ['jquery', './tippy.esm-Ot9MORvr-DNGa7Opj.js', 'jsmind', './__monkey.entry-BHri9xqK.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. let content = this.$rawTextPre.text();
  1993. if (!content) {
  1994. content = _unsafeWindow.RAW_TEXT;
  1995. }
  1996. const filename = (/* @__PURE__ */ new Date()).getTime() + ".json";
  1997. Utils.downloadText(content, filename);
  1998. },
  1999. /**
  2000. * 复制JSON文本内容
  2001. */
  2002. copyJson: function() {
  2003. _GM_setClipboard(this.$rawTextPre.text());
  2004. layer.msg("复制成功", { time: 1500 });
  2005. },
  2006. /**
  2007. * 点击了`全部折叠`
  2008. * 如果是JSON 格式化可见,折叠JSON
  2009. * 如果是JSON 脑图可见,折叠脑图节点
  2010. */
  2011. collapseAll: function() {
  2012. if ($formatContainer.is(":visible")) {
  2013. try {
  2014. $("a.json-toggle").not(".collapsed").trigger("click");
  2015. } catch (e) {
  2016. }
  2017. return;
  2018. }
  2019. _unsafeWindow.GLOBAL_JSMIND.collapse_all();
  2020. },
  2021. /**
  2022. * 点击了`全部展开`
  2023. * 如果是JSON 格式化可见,展开JSON
  2024. * 如果是JSON 脑图可见,展开脑图节点
  2025. */
  2026. expandAll: function() {
  2027. if ($formatContainer.is(":visible")) {
  2028. try {
  2029. $("a.json-placeholder").trigger("click").remove();
  2030. } catch (e) {
  2031. }
  2032. return;
  2033. }
  2034. _unsafeWindow.GLOBAL_JSMIND.expand_all();
  2035. _unsafeWindow.GLOBAL_JSMIND.scroll_node_to_center(
  2036. _unsafeWindow.GLOBAL_JSMIND.get_root()
  2037. );
  2038. },
  2039. viewFormater: function() {
  2040. },
  2041. /**
  2042. * tabs点击了`JSON 脑图`
  2043. */
  2044. viewMind: function() {
  2045. jsonMind.init(_unsafeWindow.GLOBAL_JSON);
  2046. _unsafeWindow.GLOBAL_JSMIND.scroll_node_to_center(
  2047. _unsafeWindow.GLOBAL_JSMIND.get_root()
  2048. );
  2049. },
  2050. /**
  2051. * tabs点击了`原始数据`
  2052. */
  2053. viewRawText: function() {
  2054. if (!this.firstFormat) {
  2055. return;
  2056. }
  2057. this.firstFormat = false;
  2058. this._setRawText();
  2059. },
  2060. /**
  2061. * 点击了`美化输出`
  2062. */
  2063. beautify: function() {
  2064. this.isBeautify = !this.isBeautify;
  2065. if (this.isBeautify) {
  2066. let str = JSON.stringify(_unsafeWindow.GLOBAL_JSON, null, 2);
  2067. if (_unsafeWindow.GLOBAL_JSONP_FUN) {
  2068. str = `${_unsafeWindow.GLOBAL_JSONP_FUN}(${str})`;
  2069. }
  2070. this.$rawTextPre.text(str);
  2071. return;
  2072. }
  2073. this._setRawText();
  2074. },
  2075. /**
  2076. * 点击了`JSON Crack`
  2077. */
  2078. jsoncrack: function() {
  2079. let theme2 = _GM_getValue("theme") || "light";
  2080. theme2 = theme2.replace(/_.*/, "");
  2081. layer.closeAll();
  2082. layer.open({
  2083. type: 1,
  2084. title: false,
  2085. area: ["100vw", "100vh"],
  2086. content: `<iframe id="jsoncrackEmbed" src="${URL$1.JSON_CRACK_WIDGET}"></iframe>`,
  2087. success: function(layero) {
  2088. const jsonCrackEmbed = layero.find("#jsoncrackEmbed")[0];
  2089. window == null ? void 0 : window.addEventListener("message", () => {
  2090. var _a;
  2091. (_a = jsonCrackEmbed == null ? void 0 : jsonCrackEmbed.contentWindow) == null ? void 0 : _a.postMessage(
  2092. {
  2093. options: { theme: theme2 },
  2094. json: _unsafeWindow.RAW_TEXT
  2095. },
  2096. "*"
  2097. );
  2098. });
  2099. }
  2100. });
  2101. },
  2102. init: function() {
  2103. $(document.body).on("click", ".btn", (e) => {
  2104. const target = e.target;
  2105. const id = target.id;
  2106. if (target.classList.contains("tabs-item")) {
  2107. const clas = "active";
  2108. const index = $(target).index();
  2109. $(target).addClass(clas).siblings().removeClass(clas);
  2110. $(".tabs-container > div").removeClass(clas).eq(index).addClass(clas);
  2111. const beautifyEl = $("#beautify");
  2112. const searchEl = $(".searchbox");
  2113. const copyEl = $("#copyJson");
  2114. const jsoncrackEl = $("#jsoncrack");
  2115. const aEl = $("#collapseAll, #expandAll");
  2116. id === "viewFormater" ? searchEl.show() : searchEl.hide();
  2117. id === "viewMind" ? copyEl.hide() && jsoncrackEl.show() : copyEl.show() && jsoncrackEl.hide();
  2118. id === "viewRawText" ? beautifyEl.show() && aEl.hide() : beautifyEl.hide() && aEl.show();
  2119. }
  2120. this[id](target);
  2121. });
  2122. return this;
  2123. }
  2124. };
  2125. window.addEventListener("message", function(event2) {
  2126. const { data } = event2;
  2127. if (!(data == null ? void 0 : data.reload)) {
  2128. return;
  2129. }
  2130. $jmContainer.html("");
  2131. jsonMind.isFirst = true;
  2132. tabsEvent.isBeautify = false;
  2133. tabsEvent.firstFormat = true;
  2134. _unsafeWindow.GLOBAL_JSMIND = void 0;
  2135. if ($rawTextContainer.is(":visible")) {
  2136. tabsEvent.viewRawText();
  2137. }
  2138. if ($jmContainer.is(":visible")) {
  2139. jsonMind.init(_unsafeWindow.GLOBAL_JSON);
  2140. }
  2141. });
  2142. const filter = {
  2143. /**
  2144. * 根据`filter`过滤 JSON
  2145. * @param {*} filter 过滤值
  2146. * @returns
  2147. */
  2148. filterJSON: function(filter2) {
  2149. const style = _GM_getValue("style") || "default";
  2150. const allPath = $(`#formatContainer *[json-path]`);
  2151. if (!filter2) {
  2152. style == "default" ? allPath.removeClass("hidden") : allPath.parent().removeClass("hidden");
  2153. return;
  2154. }
  2155. const chainSet = /* @__PURE__ */ new Set();
  2156. document.querySelectorAll("#formatContainer *[json-path]").forEach((el) => {
  2157. let chain = $(el).attr("json-path");
  2158. if (!chain) {
  2159. return;
  2160. }
  2161. const newChain = chain.substring(chain.lastIndexOf("."));
  2162. if (!newChain.toLowerCase().includes(filter2.toLowerCase())) {
  2163. return;
  2164. }
  2165. chainSet.add(chain);
  2166. while (chain = chain.substring(0, chain.lastIndexOf("."))) {
  2167. chainSet.add(chain);
  2168. }
  2169. });
  2170. document.querySelectorAll(
  2171. "#formatContainer *[class*='json-']:not([class*='json-key']):not([class*='json-brackets'])"
  2172. ).forEach((el) => {
  2173. const target = $(el);
  2174. let chain = target.siblings().attr("json-path");
  2175. if (style == "default") {
  2176. chain = target.parent().attr("json-path");
  2177. }
  2178. if (!chain) {
  2179. return;
  2180. }
  2181. const text2 = target.text();
  2182. if (!text2.toLowerCase().includes(filter2.toLowerCase())) {
  2183. return;
  2184. }
  2185. chainSet.add(chain);
  2186. while (chain = chain.substring(0, chain.lastIndexOf("."))) {
  2187. chainSet.add(chain);
  2188. }
  2189. });
  2190. style == "default" ? allPath.addClass("hidden") : allPath.parent().addClass("hidden");
  2191. chainSet.forEach((chain) => {
  2192. const path = $(`#formatContainer *[json-path="${chain}"]`);
  2193. style == "default" ? path.removeClass("hidden") : path.parent().removeClass("hidden");
  2194. });
  2195. },
  2196. /**
  2197. * JSON 过滤输入框事件监听
  2198. * @returns
  2199. */
  2200. input: function() {
  2201. const that2 = this;
  2202. $(document.body).on("input", ".searchbox input", function() {
  2203. const val = $(this).val();
  2204. $(".clear").attr("hidden", !val);
  2205. that2.filterJSON(val);
  2206. });
  2207. return that2;
  2208. },
  2209. /**
  2210. * 清空输入框内容
  2211. * @returns
  2212. */
  2213. clear: function() {
  2214. const that2 = this;
  2215. $(document.body).on("click", ".searchbox .clear", function() {
  2216. that2.filterJSON();
  2217. $("input").val("");
  2218. $(this).attr("hidden", true);
  2219. });
  2220. return this;
  2221. },
  2222. init: function() {
  2223. this.input().clear();
  2224. }
  2225. };
  2226. const theme = {
  2227. /**
  2228. * 切换主题色
  2229. * @param {*} theme 主题色:default、light、dark、dark_plus
  2230. * @returns
  2231. */
  2232. changeTheme: function(theme2) {
  2233. _GM_setValue("theme", theme2);
  2234. this.setTheme();
  2235. return this;
  2236. },
  2237. /**
  2238. * 设置主题
  2239. * @returns
  2240. */
  2241. setTheme: function() {
  2242. const theme2 = _GM_getValue("theme") || "default";
  2243. $(document.body).removeClass().addClass(theme2);
  2244. return this;
  2245. },
  2246. init: function() {
  2247. const that2 = this;
  2248. that2.setTheme();
  2249. window.addEventListener("message", function(event2) {
  2250. const { data } = event2;
  2251. if (!data) {
  2252. return;
  2253. }
  2254. const { type, value } = data;
  2255. if (type === "theme") {
  2256. that2.changeTheme(value);
  2257. }
  2258. });
  2259. }
  2260. };
  2261. const http_form = `
  2262. <form class="httpRequest">
  2263. <div class="requestbox">
  2264. <select name="method">
  2265. <option value="POST">POST</option>
  2266. <option value="GET">GET</option>
  2267. <option value="PUT">PUT</option>
  2268. <option value="DELETE">DELETE</option>
  2269. </select>
  2270. <input name="url" placeholder="请求地址" />
  2271. <select name="contentType">
  2272. <option value="application/x-www-form-urlencoded;charset=UTF-8">urlencoded</option>
  2273. <option value="application/json;charset=UTF-8">application/json</option>
  2274. </select>
  2275. <button type="submit">发送</button>
  2276. </div>
  2277. <div class="textarea">
  2278. <input name="headers" placeholder='请求头 {"token": "test"}' />
  2279. <input name="params" placeholder='请求参数 {"id": "test", ""name": "test"}' />
  2280. </div>
  2281. </form>`;
  2282. const tools = {
  2283. inputJson: function() {
  2284. const that = this;
  2285. layer.prompt(
  2286. {
  2287. title: "JSON 输入",
  2288. formType: 2,
  2289. btn: ["确认"],
  2290. shadeClose: true,
  2291. maxlength: 1e6,
  2292. area: ["400px", "300px"]
  2293. },
  2294. function(text) {
  2295. if (!text) {
  2296. layer.msg("内容不能为空", { time: 1500 });
  2297. return;
  2298. }
  2299. const { rawText, jsonpFun } = Utils.jsonpMatch(text);
  2300. try {
  2301. const json = JSON.parse(JSON.stringify(eval(`(${rawText})`)));
  2302. that.reload(json, rawText, jsonpFun);
  2303. } catch (e) {
  2304. layer.msg("JSON格式不正确", { time: 1500 });
  2305. console.log("格式化异常: ", e);
  2306. }
  2307. }
  2308. );
  2309. return this;
  2310. },
  2311. fetchApi: function() {
  2312. const that = this;
  2313. layer.open({
  2314. type: 1,
  2315. closeBtn: 0,
  2316. shadeClose: true,
  2317. title: "HTTP 请求",
  2318. content: http_form
  2319. });
  2320. $("form").on("submit", function(event) {
  2321. event.preventDefault();
  2322. const serialize = $(this).serializeArray();
  2323. const form = {};
  2324. for (const key in serialize) {
  2325. const it = serialize[key];
  2326. form[it.name] = it.value;
  2327. }
  2328. if (form.url === "") {
  2329. layer.msg("请求URL不能为空");
  2330. return;
  2331. }
  2332. let headers = form.headers;
  2333. let params = form.params;
  2334. try {
  2335. if (headers) {
  2336. headers = JSON.parse(headers);
  2337. }
  2338. } catch (e) {
  2339. layer.msg("请求头格式不合法");
  2340. return;
  2341. }
  2342. try {
  2343. if (params) {
  2344. params = JSON.parse(params);
  2345. }
  2346. } catch (e) {
  2347. layer.msg("请求参数格式不合法");
  2348. return;
  2349. }
  2350. layer.load(0, { shade: false });
  2351. $.ajax({
  2352. type: "POST",
  2353. url: URL$1.ONLINE_REQUEST,
  2354. data: JSON.stringify(form),
  2355. contentType: "application/json"
  2356. }).then(
  2357. (response) => {
  2358. if (typeof response === "string") {
  2359. try {
  2360. const { rawText, jsonpFun } = Utils.jsonpMatch(response);
  2361. const json = JSON.parse(JSON.stringify(eval(`(${rawText})`)));
  2362. that.reload(json, rawText, jsonpFun);
  2363. } catch (e) {
  2364. layer.closeAll();
  2365. layer.msg("HTTP 请求JSON格式不正确", { time: 1500 });
  2366. console.log("HTTP 请求JSON格式不正确:", e);
  2367. }
  2368. } else {
  2369. that.reload(response, JSON.stringify(response), null);
  2370. }
  2371. },
  2372. (error) => {
  2373. layer.closeAll();
  2374. layer.msg("HTTP 请求异常", { time: 1500 });
  2375. console.log("HTTP 请求异常:", error);
  2376. }
  2377. );
  2378. });
  2379. return this;
  2380. },
  2381. reload: function(json2, rawText2, jsonpFun2) {
  2382. _unsafeWindow.GLOBAL_JSON = json2;
  2383. _unsafeWindow.RAW_TEXT = rawText2;
  2384. _unsafeWindow.GLOBAL_JSONP_FUN = jsonpFun2;
  2385. window.postMessage({ reload: true });
  2386. layer.closeAll();
  2387. },
  2388. init: function() {
  2389. window.addEventListener("message", (event2) => {
  2390. const { data } = event2;
  2391. if (!data) {
  2392. return;
  2393. }
  2394. const { type, value } = data;
  2395. if (type === "tools") {
  2396. this[value]();
  2397. }
  2398. });
  2399. }
  2400. };
  2401. const handleBar = {
  2402. instance: null,
  2403. /**
  2404. * 对右侧操作栏的点击事件初始化
  2405. * @returns
  2406. */
  2407. handle: function() {
  2408. const that2 = this;
  2409. const tagName = "span";
  2410. [".style", ".theme", ".tools"].forEach((selector) => {
  2411. tippy(selector, {
  2412. duration: 500,
  2413. allowHTML: true,
  2414. interactive: true,
  2415. trigger: "click",
  2416. onTrigger: function(instance) {
  2417. const tools2 = $(instance.reference);
  2418. tools2.siblings().find(tagName).removeClass();
  2419. tools2.find(tagName).addClass("active");
  2420. const template = tools2.find("template");
  2421. const type = template.data("type");
  2422. const value = _GM_getValue(type) || "default";
  2423. const ul = template.contents();
  2424. ul.find("li").removeClass();
  2425. ul.find(`li[data-value=${value}]`).addClass("active");
  2426. instance.setContent(template.html());
  2427. that2.instance = instance;
  2428. },
  2429. onHide: function(instance) {
  2430. const tools2 = $(instance.reference);
  2431. tools2.find(tagName).removeClass();
  2432. }
  2433. });
  2434. });
  2435. return this;
  2436. },
  2437. /**
  2438. * 点击了对应选项
  2439. * 如点击了`主题`-`暗黑`,通过window.postMessage进行主题色更新
  2440. * @returns
  2441. */
  2442. checked: function() {
  2443. const that2 = this;
  2444. $(document.body).on("click", ".rightbox li", function() {
  2445. const el = $(this);
  2446. const hasClass = el.hasClass("active");
  2447. if (hasClass) {
  2448. return;
  2449. }
  2450. const type = el.data("type");
  2451. const value = el.data("value");
  2452. if (type !== "tools") {
  2453. el.addClass("active").siblings().removeClass();
  2454. } else {
  2455. that2.instance.hide();
  2456. }
  2457. window.postMessage({ type, value });
  2458. });
  2459. return this;
  2460. },
  2461. init: function() {
  2462. this.handle().checked();
  2463. }
  2464. };
  2465. tabsEvent.init();
  2466. theme.init();
  2467. tools.init();
  2468. filter.init();
  2469. handleBar.init();
  2470.  
  2471. })
  2472. };
  2473. }));
  2474.  
  2475. System.register("./tippy.esm-Ot9MORvr-DNGa7Opj.js", [], (function (exports, module) {
  2476. 'use strict';
  2477. return {
  2478. execute: (function () {
  2479.  
  2480. exports("t", tippy);
  2481.  
  2482. var top = "top";
  2483. var bottom = "bottom";
  2484. var right = "right";
  2485. var left = "left";
  2486. var auto = "auto";
  2487. var basePlacements = [top, bottom, right, left];
  2488. var start = "start";
  2489. var end = "end";
  2490. var clippingParents = "clippingParents";
  2491. var viewport = "viewport";
  2492. var popper = "popper";
  2493. var reference = "reference";
  2494. var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
  2495. return acc.concat([placement + "-" + start, placement + "-" + end]);
  2496. }, []);
  2497. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  2498. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  2499. }, []);
  2500. var beforeRead = "beforeRead";
  2501. var read = "read";
  2502. var afterRead = "afterRead";
  2503. var beforeMain = "beforeMain";
  2504. var main = "main";
  2505. var afterMain = "afterMain";
  2506. var beforeWrite = "beforeWrite";
  2507. var write = "write";
  2508. var afterWrite = "afterWrite";
  2509. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  2510. function getNodeName(element) {
  2511. return element ? (element.nodeName || "").toLowerCase() : null;
  2512. }
  2513. function getWindow(node) {
  2514. if (node == null) {
  2515. return window;
  2516. }
  2517. if (node.toString() !== "[object Window]") {
  2518. var ownerDocument = node.ownerDocument;
  2519. return ownerDocument ? ownerDocument.defaultView || window : window;
  2520. }
  2521. return node;
  2522. }
  2523. function isElement$1(node) {
  2524. var OwnElement = getWindow(node).Element;
  2525. return node instanceof OwnElement || node instanceof Element;
  2526. }
  2527. function isHTMLElement(node) {
  2528. var OwnElement = getWindow(node).HTMLElement;
  2529. return node instanceof OwnElement || node instanceof HTMLElement;
  2530. }
  2531. function isShadowRoot(node) {
  2532. if (typeof ShadowRoot === "undefined") {
  2533. return false;
  2534. }
  2535. var OwnElement = getWindow(node).ShadowRoot;
  2536. return node instanceof OwnElement || node instanceof ShadowRoot;
  2537. }
  2538. function applyStyles(_ref) {
  2539. var state = _ref.state;
  2540. Object.keys(state.elements).forEach(function(name) {
  2541. var style = state.styles[name] || {};
  2542. var attributes = state.attributes[name] || {};
  2543. var element = state.elements[name];
  2544. if (!isHTMLElement(element) || !getNodeName(element)) {
  2545. return;
  2546. }
  2547. Object.assign(element.style, style);
  2548. Object.keys(attributes).forEach(function(name2) {
  2549. var value = attributes[name2];
  2550. if (value === false) {
  2551. element.removeAttribute(name2);
  2552. } else {
  2553. element.setAttribute(name2, value === true ? "" : value);
  2554. }
  2555. });
  2556. });
  2557. }
  2558. function effect$2(_ref2) {
  2559. var state = _ref2.state;
  2560. var initialStyles = {
  2561. popper: {
  2562. position: state.options.strategy,
  2563. left: "0",
  2564. top: "0",
  2565. margin: "0"
  2566. },
  2567. arrow: {
  2568. position: "absolute"
  2569. },
  2570. reference: {}
  2571. };
  2572. Object.assign(state.elements.popper.style, initialStyles.popper);
  2573. state.styles = initialStyles;
  2574. if (state.elements.arrow) {
  2575. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  2576. }
  2577. return function() {
  2578. Object.keys(state.elements).forEach(function(name) {
  2579. var element = state.elements[name];
  2580. var attributes = state.attributes[name] || {};
  2581. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
  2582. var style = styleProperties.reduce(function(style2, property) {
  2583. style2[property] = "";
  2584. return style2;
  2585. }, {});
  2586. if (!isHTMLElement(element) || !getNodeName(element)) {
  2587. return;
  2588. }
  2589. Object.assign(element.style, style);
  2590. Object.keys(attributes).forEach(function(attribute) {
  2591. element.removeAttribute(attribute);
  2592. });
  2593. });
  2594. };
  2595. }
  2596. const applyStyles$1 = {
  2597. name: "applyStyles",
  2598. enabled: true,
  2599. phase: "write",
  2600. fn: applyStyles,
  2601. effect: effect$2,
  2602. requires: ["computeStyles"]
  2603. };
  2604. function getBasePlacement$1(placement) {
  2605. return placement.split("-")[0];
  2606. }
  2607. var max = Math.max;
  2608. var min = Math.min;
  2609. var round = Math.round;
  2610. function getUAString() {
  2611. var uaData = navigator.userAgentData;
  2612. if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
  2613. return uaData.brands.map(function(item) {
  2614. return item.brand + "/" + item.version;
  2615. }).join(" ");
  2616. }
  2617. return navigator.userAgent;
  2618. }
  2619. function isLayoutViewport() {
  2620. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  2621. }
  2622. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  2623. if (includeScale === void 0) {
  2624. includeScale = false;
  2625. }
  2626. if (isFixedStrategy === void 0) {
  2627. isFixedStrategy = false;
  2628. }
  2629. var clientRect = element.getBoundingClientRect();
  2630. var scaleX = 1;
  2631. var scaleY = 1;
  2632. if (includeScale && isHTMLElement(element)) {
  2633. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  2634. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  2635. }
  2636. var _ref = isElement$1(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
  2637. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  2638. var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  2639. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  2640. var width = clientRect.width / scaleX;
  2641. var height = clientRect.height / scaleY;
  2642. return {
  2643. width,
  2644. height,
  2645. top: y,
  2646. right: x + width,
  2647. bottom: y + height,
  2648. left: x,
  2649. x,
  2650. y
  2651. };
  2652. }
  2653. function getLayoutRect(element) {
  2654. var clientRect = getBoundingClientRect(element);
  2655. var width = element.offsetWidth;
  2656. var height = element.offsetHeight;
  2657. if (Math.abs(clientRect.width - width) <= 1) {
  2658. width = clientRect.width;
  2659. }
  2660. if (Math.abs(clientRect.height - height) <= 1) {
  2661. height = clientRect.height;
  2662. }
  2663. return {
  2664. x: element.offsetLeft,
  2665. y: element.offsetTop,
  2666. width,
  2667. height
  2668. };
  2669. }
  2670. function contains(parent, child) {
  2671. var rootNode = child.getRootNode && child.getRootNode();
  2672. if (parent.contains(child)) {
  2673. return true;
  2674. } else if (rootNode && isShadowRoot(rootNode)) {
  2675. var next = child;
  2676. do {
  2677. if (next && parent.isSameNode(next)) {
  2678. return true;
  2679. }
  2680. next = next.parentNode || next.host;
  2681. } while (next);
  2682. }
  2683. return false;
  2684. }
  2685. function getComputedStyle(element) {
  2686. return getWindow(element).getComputedStyle(element);
  2687. }
  2688. function isTableElement(element) {
  2689. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  2690. }
  2691. function getDocumentElement(element) {
  2692. return ((isElement$1(element) ? element.ownerDocument : (
  2693. // $FlowFixMe[prop-missing]
  2694. element.document
  2695. )) || window.document).documentElement;
  2696. }
  2697. function getParentNode(element) {
  2698. if (getNodeName(element) === "html") {
  2699. return element;
  2700. }
  2701. return (
  2702. // this is a quicker (but less type safe) way to save quite some bytes from the bundle
  2703. // $FlowFixMe[incompatible-return]
  2704. // $FlowFixMe[prop-missing]
  2705. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  2706. element.parentNode || // DOM Element detected
  2707. (isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  2708. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  2709. getDocumentElement(element)
  2710. );
  2711. }
  2712. function getTrueOffsetParent(element) {
  2713. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  2714. getComputedStyle(element).position === "fixed") {
  2715. return null;
  2716. }
  2717. return element.offsetParent;
  2718. }
  2719. function getContainingBlock(element) {
  2720. var isFirefox = /firefox/i.test(getUAString());
  2721. var isIE = /Trident/i.test(getUAString());
  2722. if (isIE && isHTMLElement(element)) {
  2723. var elementCss = getComputedStyle(element);
  2724. if (elementCss.position === "fixed") {
  2725. return null;
  2726. }
  2727. }
  2728. var currentNode = getParentNode(element);
  2729. if (isShadowRoot(currentNode)) {
  2730. currentNode = currentNode.host;
  2731. }
  2732. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  2733. var css = getComputedStyle(currentNode);
  2734. 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") {
  2735. return currentNode;
  2736. } else {
  2737. currentNode = currentNode.parentNode;
  2738. }
  2739. }
  2740. return null;
  2741. }
  2742. function getOffsetParent(element) {
  2743. var window2 = getWindow(element);
  2744. var offsetParent = getTrueOffsetParent(element);
  2745. while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
  2746. offsetParent = getTrueOffsetParent(offsetParent);
  2747. }
  2748. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
  2749. return window2;
  2750. }
  2751. return offsetParent || getContainingBlock(element) || window2;
  2752. }
  2753. function getMainAxisFromPlacement(placement) {
  2754. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  2755. }
  2756. function within(min$1, value, max$1) {
  2757. return max(min$1, min(value, max$1));
  2758. }
  2759. function withinMaxClamp(min2, value, max2) {
  2760. var v = within(min2, value, max2);
  2761. return v > max2 ? max2 : v;
  2762. }
  2763. function getFreshSideObject() {
  2764. return {
  2765. top: 0,
  2766. right: 0,
  2767. bottom: 0,
  2768. left: 0
  2769. };
  2770. }
  2771. function mergePaddingObject(paddingObject) {
  2772. return Object.assign({}, getFreshSideObject(), paddingObject);
  2773. }
  2774. function expandToHashMap(value, keys) {
  2775. return keys.reduce(function(hashMap, key) {
  2776. hashMap[key] = value;
  2777. return hashMap;
  2778. }, {});
  2779. }
  2780. var toPaddingObject = function toPaddingObject2(padding, state) {
  2781. padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
  2782. placement: state.placement
  2783. })) : padding;
  2784. return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  2785. };
  2786. function arrow(_ref) {
  2787. var _state$modifiersData$;
  2788. var state = _ref.state, name = _ref.name, options = _ref.options;
  2789. var arrowElement = state.elements.arrow;
  2790. var popperOffsets2 = state.modifiersData.popperOffsets;
  2791. var basePlacement = getBasePlacement$1(state.placement);
  2792. var axis = getMainAxisFromPlacement(basePlacement);
  2793. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  2794. var len = isVertical ? "height" : "width";
  2795. if (!arrowElement || !popperOffsets2) {
  2796. return;
  2797. }
  2798. var paddingObject = toPaddingObject(options.padding, state);
  2799. var arrowRect = getLayoutRect(arrowElement);
  2800. var minProp = axis === "y" ? top : left;
  2801. var maxProp = axis === "y" ? bottom : right;
  2802. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
  2803. var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
  2804. var arrowOffsetParent = getOffsetParent(arrowElement);
  2805. var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  2806. var centerToReference = endDiff / 2 - startDiff / 2;
  2807. var min2 = paddingObject[minProp];
  2808. var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
  2809. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  2810. var offset2 = within(min2, center, max2);
  2811. var axisProp = axis;
  2812. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
  2813. }
  2814. function effect$1(_ref2) {
  2815. var state = _ref2.state, options = _ref2.options;
  2816. var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
  2817. if (arrowElement == null) {
  2818. return;
  2819. }
  2820. if (typeof arrowElement === "string") {
  2821. arrowElement = state.elements.popper.querySelector(arrowElement);
  2822. if (!arrowElement) {
  2823. return;
  2824. }
  2825. }
  2826. if (!contains(state.elements.popper, arrowElement)) {
  2827. return;
  2828. }
  2829. state.elements.arrow = arrowElement;
  2830. }
  2831. const arrow$1 = {
  2832. name: "arrow",
  2833. enabled: true,
  2834. phase: "main",
  2835. fn: arrow,
  2836. effect: effect$1,
  2837. requires: ["popperOffsets"],
  2838. requiresIfExists: ["preventOverflow"]
  2839. };
  2840. function getVariation(placement) {
  2841. return placement.split("-")[1];
  2842. }
  2843. var unsetSides = {
  2844. top: "auto",
  2845. right: "auto",
  2846. bottom: "auto",
  2847. left: "auto"
  2848. };
  2849. function roundOffsetsByDPR(_ref, win) {
  2850. var x = _ref.x, y = _ref.y;
  2851. var dpr = win.devicePixelRatio || 1;
  2852. return {
  2853. x: round(x * dpr) / dpr || 0,
  2854. y: round(y * dpr) / dpr || 0
  2855. };
  2856. }
  2857. function mapToStyles(_ref2) {
  2858. var _Object$assign2;
  2859. 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;
  2860. 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;
  2861. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  2862. x,
  2863. y
  2864. }) : {
  2865. x,
  2866. y
  2867. };
  2868. x = _ref3.x;
  2869. y = _ref3.y;
  2870. var hasX = offsets.hasOwnProperty("x");
  2871. var hasY = offsets.hasOwnProperty("y");
  2872. var sideX = left;
  2873. var sideY = top;
  2874. var win = window;
  2875. if (adaptive) {
  2876. var offsetParent = getOffsetParent(popper2);
  2877. var heightProp = "clientHeight";
  2878. var widthProp = "clientWidth";
  2879. if (offsetParent === getWindow(popper2)) {
  2880. offsetParent = getDocumentElement(popper2);
  2881. if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
  2882. heightProp = "scrollHeight";
  2883. widthProp = "scrollWidth";
  2884. }
  2885. }
  2886. offsetParent = offsetParent;
  2887. if (placement === top || (placement === left || placement === right) && variation === end) {
  2888. sideY = bottom;
  2889. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
  2890. // $FlowFixMe[prop-missing]
  2891. offsetParent[heightProp]
  2892. );
  2893. y -= offsetY - popperRect.height;
  2894. y *= gpuAcceleration ? 1 : -1;
  2895. }
  2896. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  2897. sideX = right;
  2898. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
  2899. // $FlowFixMe[prop-missing]
  2900. offsetParent[widthProp]
  2901. );
  2902. x -= offsetX - popperRect.width;
  2903. x *= gpuAcceleration ? 1 : -1;
  2904. }
  2905. }
  2906. var commonStyles = Object.assign({
  2907. position
  2908. }, adaptive && unsetSides);
  2909. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  2910. x,
  2911. y
  2912. }, getWindow(popper2)) : {
  2913. x,
  2914. y
  2915. };
  2916. x = _ref4.x;
  2917. y = _ref4.y;
  2918. if (gpuAcceleration) {
  2919. var _Object$assign;
  2920. 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));
  2921. }
  2922. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  2923. }
  2924. function computeStyles(_ref5) {
  2925. var state = _ref5.state, options = _ref5.options;
  2926. 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;
  2927. var commonStyles = {
  2928. placement: getBasePlacement$1(state.placement),
  2929. variation: getVariation(state.placement),
  2930. popper: state.elements.popper,
  2931. popperRect: state.rects.popper,
  2932. gpuAcceleration,
  2933. isFixed: state.options.strategy === "fixed"
  2934. };
  2935. if (state.modifiersData.popperOffsets != null) {
  2936. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  2937. offsets: state.modifiersData.popperOffsets,
  2938. position: state.options.strategy,
  2939. adaptive,
  2940. roundOffsets
  2941. })));
  2942. }
  2943. if (state.modifiersData.arrow != null) {
  2944. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  2945. offsets: state.modifiersData.arrow,
  2946. position: "absolute",
  2947. adaptive: false,
  2948. roundOffsets
  2949. })));
  2950. }
  2951. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  2952. "data-popper-placement": state.placement
  2953. });
  2954. }
  2955. const computeStyles$1 = {
  2956. name: "computeStyles",
  2957. enabled: true,
  2958. phase: "beforeWrite",
  2959. fn: computeStyles,
  2960. data: {}
  2961. };
  2962. var passive = {
  2963. passive: true
  2964. };
  2965. function effect(_ref) {
  2966. var state = _ref.state, instance = _ref.instance, options = _ref.options;
  2967. 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;
  2968. var window2 = getWindow(state.elements.popper);
  2969. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  2970. if (scroll) {
  2971. scrollParents.forEach(function(scrollParent) {
  2972. scrollParent.addEventListener("scroll", instance.update, passive);
  2973. });
  2974. }
  2975. if (resize) {
  2976. window2.addEventListener("resize", instance.update, passive);
  2977. }
  2978. return function() {
  2979. if (scroll) {
  2980. scrollParents.forEach(function(scrollParent) {
  2981. scrollParent.removeEventListener("scroll", instance.update, passive);
  2982. });
  2983. }
  2984. if (resize) {
  2985. window2.removeEventListener("resize", instance.update, passive);
  2986. }
  2987. };
  2988. }
  2989. const eventListeners = {
  2990. name: "eventListeners",
  2991. enabled: true,
  2992. phase: "write",
  2993. fn: function fn() {
  2994. },
  2995. effect,
  2996. data: {}
  2997. };
  2998. var hash$1 = {
  2999. left: "right",
  3000. right: "left",
  3001. bottom: "top",
  3002. top: "bottom"
  3003. };
  3004. function getOppositePlacement(placement) {
  3005. return placement.replace(/left|right|bottom|top/g, function(matched) {
  3006. return hash$1[matched];
  3007. });
  3008. }
  3009. var hash = {
  3010. start: "end",
  3011. end: "start"
  3012. };
  3013. function getOppositeVariationPlacement(placement) {
  3014. return placement.replace(/start|end/g, function(matched) {
  3015. return hash[matched];
  3016. });
  3017. }
  3018. function getWindowScroll(node) {
  3019. var win = getWindow(node);
  3020. var scrollLeft = win.pageXOffset;
  3021. var scrollTop = win.pageYOffset;
  3022. return {
  3023. scrollLeft,
  3024. scrollTop
  3025. };
  3026. }
  3027. function getWindowScrollBarX(element) {
  3028. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  3029. }
  3030. function getViewportRect(element, strategy) {
  3031. var win = getWindow(element);
  3032. var html = getDocumentElement(element);
  3033. var visualViewport = win.visualViewport;
  3034. var width = html.clientWidth;
  3035. var height = html.clientHeight;
  3036. var x = 0;
  3037. var y = 0;
  3038. if (visualViewport) {
  3039. width = visualViewport.width;
  3040. height = visualViewport.height;
  3041. var layoutViewport = isLayoutViewport();
  3042. if (layoutViewport || !layoutViewport && strategy === "fixed") {
  3043. x = visualViewport.offsetLeft;
  3044. y = visualViewport.offsetTop;
  3045. }
  3046. }
  3047. return {
  3048. width,
  3049. height,
  3050. x: x + getWindowScrollBarX(element),
  3051. y
  3052. };
  3053. }
  3054. function getDocumentRect(element) {
  3055. var _element$ownerDocumen;
  3056. var html = getDocumentElement(element);
  3057. var winScroll = getWindowScroll(element);
  3058. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  3059. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  3060. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  3061. var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
  3062. var y = -winScroll.scrollTop;
  3063. if (getComputedStyle(body || html).direction === "rtl") {
  3064. x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  3065. }
  3066. return {
  3067. width,
  3068. height,
  3069. x,
  3070. y
  3071. };
  3072. }
  3073. function isScrollParent(element) {
  3074. var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  3075. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  3076. }
  3077. function getScrollParent(node) {
  3078. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  3079. return node.ownerDocument.body;
  3080. }
  3081. if (isHTMLElement(node) && isScrollParent(node)) {
  3082. return node;
  3083. }
  3084. return getScrollParent(getParentNode(node));
  3085. }
  3086. function listScrollParents(element, list) {
  3087. var _element$ownerDocumen;
  3088. if (list === void 0) {
  3089. list = [];
  3090. }
  3091. var scrollParent = getScrollParent(element);
  3092. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  3093. var win = getWindow(scrollParent);
  3094. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  3095. var updatedList = list.concat(target);
  3096. return isBody ? updatedList : (
  3097. // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  3098. updatedList.concat(listScrollParents(getParentNode(target)))
  3099. );
  3100. }
  3101. function rectToClientRect(rect) {
  3102. return Object.assign({}, rect, {
  3103. left: rect.x,
  3104. top: rect.y,
  3105. right: rect.x + rect.width,
  3106. bottom: rect.y + rect.height
  3107. });
  3108. }
  3109. function getInnerBoundingClientRect(element, strategy) {
  3110. var rect = getBoundingClientRect(element, false, strategy === "fixed");
  3111. rect.top = rect.top + element.clientTop;
  3112. rect.left = rect.left + element.clientLeft;
  3113. rect.bottom = rect.top + element.clientHeight;
  3114. rect.right = rect.left + element.clientWidth;
  3115. rect.width = element.clientWidth;
  3116. rect.height = element.clientHeight;
  3117. rect.x = rect.left;
  3118. rect.y = rect.top;
  3119. return rect;
  3120. }
  3121. function getClientRectFromMixedType(element, clippingParent, strategy) {
  3122. return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  3123. }
  3124. function getClippingParents(element) {
  3125. var clippingParents2 = listScrollParents(getParentNode(element));
  3126. var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle(element).position) >= 0;
  3127. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  3128. if (!isElement$1(clipperElement)) {
  3129. return [];
  3130. }
  3131. return clippingParents2.filter(function(clippingParent) {
  3132. return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
  3133. });
  3134. }
  3135. function getClippingRect(element, boundary, rootBoundary, strategy) {
  3136. var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
  3137. var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
  3138. var firstClippingParent = clippingParents2[0];
  3139. var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
  3140. var rect = getClientRectFromMixedType(element, clippingParent, strategy);
  3141. accRect.top = max(rect.top, accRect.top);
  3142. accRect.right = min(rect.right, accRect.right);
  3143. accRect.bottom = min(rect.bottom, accRect.bottom);
  3144. accRect.left = max(rect.left, accRect.left);
  3145. return accRect;
  3146. }, getClientRectFromMixedType(element, firstClippingParent, strategy));
  3147. clippingRect.width = clippingRect.right - clippingRect.left;
  3148. clippingRect.height = clippingRect.bottom - clippingRect.top;
  3149. clippingRect.x = clippingRect.left;
  3150. clippingRect.y = clippingRect.top;
  3151. return clippingRect;
  3152. }
  3153. function computeOffsets(_ref) {
  3154. var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
  3155. var basePlacement = placement ? getBasePlacement$1(placement) : null;
  3156. var variation = placement ? getVariation(placement) : null;
  3157. var commonX = reference2.x + reference2.width / 2 - element.width / 2;
  3158. var commonY = reference2.y + reference2.height / 2 - element.height / 2;
  3159. var offsets;
  3160. switch (basePlacement) {
  3161. case top:
  3162. offsets = {
  3163. x: commonX,
  3164. y: reference2.y - element.height
  3165. };
  3166. break;
  3167. case bottom:
  3168. offsets = {
  3169. x: commonX,
  3170. y: reference2.y + reference2.height
  3171. };
  3172. break;
  3173. case right:
  3174. offsets = {
  3175. x: reference2.x + reference2.width,
  3176. y: commonY
  3177. };
  3178. break;
  3179. case left:
  3180. offsets = {
  3181. x: reference2.x - element.width,
  3182. y: commonY
  3183. };
  3184. break;
  3185. default:
  3186. offsets = {
  3187. x: reference2.x,
  3188. y: reference2.y
  3189. };
  3190. }
  3191. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  3192. if (mainAxis != null) {
  3193. var len = mainAxis === "y" ? "height" : "width";
  3194. switch (variation) {
  3195. case start:
  3196. offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
  3197. break;
  3198. case end:
  3199. offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
  3200. break;
  3201. }
  3202. }
  3203. return offsets;
  3204. }
  3205. function detectOverflow(state, options) {
  3206. if (options === void 0) {
  3207. options = {};
  3208. }
  3209. 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;
  3210. var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  3211. var altContext = elementContext === popper ? reference : popper;
  3212. var popperRect = state.rects.popper;
  3213. var element = state.elements[altBoundary ? altContext : elementContext];
  3214. var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
  3215. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  3216. var popperOffsets2 = computeOffsets({
  3217. reference: referenceClientRect,
  3218. element: popperRect,
  3219. strategy: "absolute",
  3220. placement
  3221. });
  3222. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
  3223. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
  3224. var overflowOffsets = {
  3225. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  3226. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  3227. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  3228. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  3229. };
  3230. var offsetData = state.modifiersData.offset;
  3231. if (elementContext === popper && offsetData) {
  3232. var offset2 = offsetData[placement];
  3233. Object.keys(overflowOffsets).forEach(function(key) {
  3234. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  3235. var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
  3236. overflowOffsets[key] += offset2[axis] * multiply;
  3237. });
  3238. }
  3239. return overflowOffsets;
  3240. }
  3241. function computeAutoPlacement(state, options) {
  3242. if (options === void 0) {
  3243. options = {};
  3244. }
  3245. 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;
  3246. var variation = getVariation(placement);
  3247. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
  3248. return getVariation(placement2) === variation;
  3249. }) : basePlacements;
  3250. var allowedPlacements = placements$1.filter(function(placement2) {
  3251. return allowedAutoPlacements.indexOf(placement2) >= 0;
  3252. });
  3253. if (allowedPlacements.length === 0) {
  3254. allowedPlacements = placements$1;
  3255. }
  3256. var overflows = allowedPlacements.reduce(function(acc, placement2) {
  3257. acc[placement2] = detectOverflow(state, {
  3258. placement: placement2,
  3259. boundary,
  3260. rootBoundary,
  3261. padding
  3262. })[getBasePlacement$1(placement2)];
  3263. return acc;
  3264. }, {});
  3265. return Object.keys(overflows).sort(function(a, b) {
  3266. return overflows[a] - overflows[b];
  3267. });
  3268. }
  3269. function getExpandedFallbackPlacements(placement) {
  3270. if (getBasePlacement$1(placement) === auto) {
  3271. return [];
  3272. }
  3273. var oppositePlacement = getOppositePlacement(placement);
  3274. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  3275. }
  3276. function flip(_ref) {
  3277. var state = _ref.state, options = _ref.options, name = _ref.name;
  3278. if (state.modifiersData[name]._skip) {
  3279. return;
  3280. }
  3281. 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;
  3282. var preferredPlacement = state.options.placement;
  3283. var basePlacement = getBasePlacement$1(preferredPlacement);
  3284. var isBasePlacement = basePlacement === preferredPlacement;
  3285. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  3286. var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
  3287. return acc.concat(getBasePlacement$1(placement2) === auto ? computeAutoPlacement(state, {
  3288. placement: placement2,
  3289. boundary,
  3290. rootBoundary,
  3291. padding,
  3292. flipVariations,
  3293. allowedAutoPlacements
  3294. }) : placement2);
  3295. }, []);
  3296. var referenceRect = state.rects.reference;
  3297. var popperRect = state.rects.popper;
  3298. var checksMap = /* @__PURE__ */ new Map();
  3299. var makeFallbackChecks = true;
  3300. var firstFittingPlacement = placements2[0];
  3301. for (var i = 0; i < placements2.length; i++) {
  3302. var placement = placements2[i];
  3303. var _basePlacement = getBasePlacement$1(placement);
  3304. var isStartVariation = getVariation(placement) === start;
  3305. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  3306. var len = isVertical ? "width" : "height";
  3307. var overflow = detectOverflow(state, {
  3308. placement,
  3309. boundary,
  3310. rootBoundary,
  3311. altBoundary,
  3312. padding
  3313. });
  3314. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  3315. if (referenceRect[len] > popperRect[len]) {
  3316. mainVariationSide = getOppositePlacement(mainVariationSide);
  3317. }
  3318. var altVariationSide = getOppositePlacement(mainVariationSide);
  3319. var checks = [];
  3320. if (checkMainAxis) {
  3321. checks.push(overflow[_basePlacement] <= 0);
  3322. }
  3323. if (checkAltAxis) {
  3324. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  3325. }
  3326. if (checks.every(function(check) {
  3327. return check;
  3328. })) {
  3329. firstFittingPlacement = placement;
  3330. makeFallbackChecks = false;
  3331. break;
  3332. }
  3333. checksMap.set(placement, checks);
  3334. }
  3335. if (makeFallbackChecks) {
  3336. var numberOfChecks = flipVariations ? 3 : 1;
  3337. var _loop = function _loop2(_i2) {
  3338. var fittingPlacement = placements2.find(function(placement2) {
  3339. var checks2 = checksMap.get(placement2);
  3340. if (checks2) {
  3341. return checks2.slice(0, _i2).every(function(check) {
  3342. return check;
  3343. });
  3344. }
  3345. });
  3346. if (fittingPlacement) {
  3347. firstFittingPlacement = fittingPlacement;
  3348. return "break";
  3349. }
  3350. };
  3351. for (var _i = numberOfChecks; _i > 0; _i--) {
  3352. var _ret = _loop(_i);
  3353. if (_ret === "break") break;
  3354. }
  3355. }
  3356. if (state.placement !== firstFittingPlacement) {
  3357. state.modifiersData[name]._skip = true;
  3358. state.placement = firstFittingPlacement;
  3359. state.reset = true;
  3360. }
  3361. }
  3362. const flip$1 = {
  3363. name: "flip",
  3364. enabled: true,
  3365. phase: "main",
  3366. fn: flip,
  3367. requiresIfExists: ["offset"],
  3368. data: {
  3369. _skip: false
  3370. }
  3371. };
  3372. function getSideOffsets(overflow, rect, preventedOffsets) {
  3373. if (preventedOffsets === void 0) {
  3374. preventedOffsets = {
  3375. x: 0,
  3376. y: 0
  3377. };
  3378. }
  3379. return {
  3380. top: overflow.top - rect.height - preventedOffsets.y,
  3381. right: overflow.right - rect.width + preventedOffsets.x,
  3382. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  3383. left: overflow.left - rect.width - preventedOffsets.x
  3384. };
  3385. }
  3386. function isAnySideFullyClipped(overflow) {
  3387. return [top, right, bottom, left].some(function(side) {
  3388. return overflow[side] >= 0;
  3389. });
  3390. }
  3391. function hide(_ref) {
  3392. var state = _ref.state, name = _ref.name;
  3393. var referenceRect = state.rects.reference;
  3394. var popperRect = state.rects.popper;
  3395. var preventedOffsets = state.modifiersData.preventOverflow;
  3396. var referenceOverflow = detectOverflow(state, {
  3397. elementContext: "reference"
  3398. });
  3399. var popperAltOverflow = detectOverflow(state, {
  3400. altBoundary: true
  3401. });
  3402. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  3403. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  3404. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  3405. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  3406. state.modifiersData[name] = {
  3407. referenceClippingOffsets,
  3408. popperEscapeOffsets,
  3409. isReferenceHidden,
  3410. hasPopperEscaped
  3411. };
  3412. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  3413. "data-popper-reference-hidden": isReferenceHidden,
  3414. "data-popper-escaped": hasPopperEscaped
  3415. });
  3416. }
  3417. const hide$1 = {
  3418. name: "hide",
  3419. enabled: true,
  3420. phase: "main",
  3421. requiresIfExists: ["preventOverflow"],
  3422. fn: hide
  3423. };
  3424. function distanceAndSkiddingToXY(placement, rects, offset2) {
  3425. var basePlacement = getBasePlacement$1(placement);
  3426. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  3427. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  3428. placement
  3429. })) : offset2, skidding = _ref[0], distance = _ref[1];
  3430. skidding = skidding || 0;
  3431. distance = (distance || 0) * invertDistance;
  3432. return [left, right].indexOf(basePlacement) >= 0 ? {
  3433. x: distance,
  3434. y: skidding
  3435. } : {
  3436. x: skidding,
  3437. y: distance
  3438. };
  3439. }
  3440. function offset(_ref2) {
  3441. var state = _ref2.state, options = _ref2.options, name = _ref2.name;
  3442. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  3443. var data = placements.reduce(function(acc, placement) {
  3444. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  3445. return acc;
  3446. }, {});
  3447. var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
  3448. if (state.modifiersData.popperOffsets != null) {
  3449. state.modifiersData.popperOffsets.x += x;
  3450. state.modifiersData.popperOffsets.y += y;
  3451. }
  3452. state.modifiersData[name] = data;
  3453. }
  3454. const offset$1 = {
  3455. name: "offset",
  3456. enabled: true,
  3457. phase: "main",
  3458. requires: ["popperOffsets"],
  3459. fn: offset
  3460. };
  3461. function popperOffsets(_ref) {
  3462. var state = _ref.state, name = _ref.name;
  3463. state.modifiersData[name] = computeOffsets({
  3464. reference: state.rects.reference,
  3465. element: state.rects.popper,
  3466. strategy: "absolute",
  3467. placement: state.placement
  3468. });
  3469. }
  3470. const popperOffsets$1 = {
  3471. name: "popperOffsets",
  3472. enabled: true,
  3473. phase: "read",
  3474. fn: popperOffsets,
  3475. data: {}
  3476. };
  3477. function getAltAxis(axis) {
  3478. return axis === "x" ? "y" : "x";
  3479. }
  3480. function preventOverflow(_ref) {
  3481. var state = _ref.state, options = _ref.options, name = _ref.name;
  3482. 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;
  3483. var overflow = detectOverflow(state, {
  3484. boundary,
  3485. rootBoundary,
  3486. padding,
  3487. altBoundary
  3488. });
  3489. var basePlacement = getBasePlacement$1(state.placement);
  3490. var variation = getVariation(state.placement);
  3491. var isBasePlacement = !variation;
  3492. var mainAxis = getMainAxisFromPlacement(basePlacement);
  3493. var altAxis = getAltAxis(mainAxis);
  3494. var popperOffsets2 = state.modifiersData.popperOffsets;
  3495. var referenceRect = state.rects.reference;
  3496. var popperRect = state.rects.popper;
  3497. var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
  3498. placement: state.placement
  3499. })) : tetherOffset;
  3500. var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
  3501. mainAxis: tetherOffsetValue,
  3502. altAxis: tetherOffsetValue
  3503. } : Object.assign({
  3504. mainAxis: 0,
  3505. altAxis: 0
  3506. }, tetherOffsetValue);
  3507. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  3508. var data = {
  3509. x: 0,
  3510. y: 0
  3511. };
  3512. if (!popperOffsets2) {
  3513. return;
  3514. }
  3515. if (checkMainAxis) {
  3516. var _offsetModifierState$;
  3517. var mainSide = mainAxis === "y" ? top : left;
  3518. var altSide = mainAxis === "y" ? bottom : right;
  3519. var len = mainAxis === "y" ? "height" : "width";
  3520. var offset2 = popperOffsets2[mainAxis];
  3521. var min$1 = offset2 + overflow[mainSide];
  3522. var max$1 = offset2 - overflow[altSide];
  3523. var additive = tether ? -popperRect[len] / 2 : 0;
  3524. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  3525. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
  3526. var arrowElement = state.elements.arrow;
  3527. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  3528. width: 0,
  3529. height: 0
  3530. };
  3531. var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
  3532. var arrowPaddingMin = arrowPaddingObject[mainSide];
  3533. var arrowPaddingMax = arrowPaddingObject[altSide];
  3534. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  3535. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  3536. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  3537. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  3538. var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  3539. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  3540. var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
  3541. var tetherMax = offset2 + maxOffset - offsetModifierValue;
  3542. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
  3543. popperOffsets2[mainAxis] = preventedOffset;
  3544. data[mainAxis] = preventedOffset - offset2;
  3545. }
  3546. if (checkAltAxis) {
  3547. var _offsetModifierState$2;
  3548. var _mainSide = mainAxis === "x" ? top : left;
  3549. var _altSide = mainAxis === "x" ? bottom : right;
  3550. var _offset = popperOffsets2[altAxis];
  3551. var _len = altAxis === "y" ? "height" : "width";
  3552. var _min = _offset + overflow[_mainSide];
  3553. var _max = _offset - overflow[_altSide];
  3554. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  3555. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  3556. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  3557. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  3558. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  3559. popperOffsets2[altAxis] = _preventedOffset;
  3560. data[altAxis] = _preventedOffset - _offset;
  3561. }
  3562. state.modifiersData[name] = data;
  3563. }
  3564. const preventOverflow$1 = {
  3565. name: "preventOverflow",
  3566. enabled: true,
  3567. phase: "main",
  3568. fn: preventOverflow,
  3569. requiresIfExists: ["offset"]
  3570. };
  3571. function getHTMLElementScroll(element) {
  3572. return {
  3573. scrollLeft: element.scrollLeft,
  3574. scrollTop: element.scrollTop
  3575. };
  3576. }
  3577. function getNodeScroll(node) {
  3578. if (node === getWindow(node) || !isHTMLElement(node)) {
  3579. return getWindowScroll(node);
  3580. } else {
  3581. return getHTMLElementScroll(node);
  3582. }
  3583. }
  3584. function isElementScaled(element) {
  3585. var rect = element.getBoundingClientRect();
  3586. var scaleX = round(rect.width) / element.offsetWidth || 1;
  3587. var scaleY = round(rect.height) / element.offsetHeight || 1;
  3588. return scaleX !== 1 || scaleY !== 1;
  3589. }
  3590. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  3591. if (isFixed === void 0) {
  3592. isFixed = false;
  3593. }
  3594. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  3595. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  3596. var documentElement = getDocumentElement(offsetParent);
  3597. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  3598. var scroll = {
  3599. scrollLeft: 0,
  3600. scrollTop: 0
  3601. };
  3602. var offsets = {
  3603. x: 0,
  3604. y: 0
  3605. };
  3606. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  3607. if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
  3608. isScrollParent(documentElement)) {
  3609. scroll = getNodeScroll(offsetParent);
  3610. }
  3611. if (isHTMLElement(offsetParent)) {
  3612. offsets = getBoundingClientRect(offsetParent, true);
  3613. offsets.x += offsetParent.clientLeft;
  3614. offsets.y += offsetParent.clientTop;
  3615. } else if (documentElement) {
  3616. offsets.x = getWindowScrollBarX(documentElement);
  3617. }
  3618. }
  3619. return {
  3620. x: rect.left + scroll.scrollLeft - offsets.x,
  3621. y: rect.top + scroll.scrollTop - offsets.y,
  3622. width: rect.width,
  3623. height: rect.height
  3624. };
  3625. }
  3626. function order(modifiers) {
  3627. var map = /* @__PURE__ */ new Map();
  3628. var visited = /* @__PURE__ */ new Set();
  3629. var result = [];
  3630. modifiers.forEach(function(modifier) {
  3631. map.set(modifier.name, modifier);
  3632. });
  3633. function sort(modifier) {
  3634. visited.add(modifier.name);
  3635. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  3636. requires.forEach(function(dep) {
  3637. if (!visited.has(dep)) {
  3638. var depModifier = map.get(dep);
  3639. if (depModifier) {
  3640. sort(depModifier);
  3641. }
  3642. }
  3643. });
  3644. result.push(modifier);
  3645. }
  3646. modifiers.forEach(function(modifier) {
  3647. if (!visited.has(modifier.name)) {
  3648. sort(modifier);
  3649. }
  3650. });
  3651. return result;
  3652. }
  3653. function orderModifiers(modifiers) {
  3654. var orderedModifiers = order(modifiers);
  3655. return modifierPhases.reduce(function(acc, phase) {
  3656. return acc.concat(orderedModifiers.filter(function(modifier) {
  3657. return modifier.phase === phase;
  3658. }));
  3659. }, []);
  3660. }
  3661. function debounce$1(fn2) {
  3662. var pending;
  3663. return function() {
  3664. if (!pending) {
  3665. pending = new Promise(function(resolve) {
  3666. Promise.resolve().then(function() {
  3667. pending = void 0;
  3668. resolve(fn2());
  3669. });
  3670. });
  3671. }
  3672. return pending;
  3673. };
  3674. }
  3675. function mergeByName(modifiers) {
  3676. var merged = modifiers.reduce(function(merged2, current) {
  3677. var existing = merged2[current.name];
  3678. merged2[current.name] = existing ? Object.assign({}, existing, current, {
  3679. options: Object.assign({}, existing.options, current.options),
  3680. data: Object.assign({}, existing.data, current.data)
  3681. }) : current;
  3682. return merged2;
  3683. }, {});
  3684. return Object.keys(merged).map(function(key) {
  3685. return merged[key];
  3686. });
  3687. }
  3688. var DEFAULT_OPTIONS = {
  3689. placement: "bottom",
  3690. modifiers: [],
  3691. strategy: "absolute"
  3692. };
  3693. function areValidElements() {
  3694. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  3695. args[_key] = arguments[_key];
  3696. }
  3697. return !args.some(function(element) {
  3698. return !(element && typeof element.getBoundingClientRect === "function");
  3699. });
  3700. }
  3701. function popperGenerator(generatorOptions) {
  3702. if (generatorOptions === void 0) {
  3703. generatorOptions = {};
  3704. }
  3705. 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;
  3706. return function createPopper2(reference2, popper2, options) {
  3707. if (options === void 0) {
  3708. options = defaultOptions;
  3709. }
  3710. var state = {
  3711. placement: "bottom",
  3712. orderedModifiers: [],
  3713. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  3714. modifiersData: {},
  3715. elements: {
  3716. reference: reference2,
  3717. popper: popper2
  3718. },
  3719. attributes: {},
  3720. styles: {}
  3721. };
  3722. var effectCleanupFns = [];
  3723. var isDestroyed = false;
  3724. var instance = {
  3725. state,
  3726. setOptions: function setOptions(setOptionsAction) {
  3727. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  3728. cleanupModifierEffects();
  3729. state.options = Object.assign({}, defaultOptions, state.options, options2);
  3730. state.scrollParents = {
  3731. reference: isElement$1(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
  3732. popper: listScrollParents(popper2)
  3733. };
  3734. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  3735. state.orderedModifiers = orderedModifiers.filter(function(m) {
  3736. return m.enabled;
  3737. });
  3738. runModifierEffects();
  3739. return instance.update();
  3740. },
  3741. // Sync update – it will always be executed, even if not necessary. This
  3742. // is useful for low frequency updates where sync behavior simplifies the
  3743. // logic.
  3744. // For high frequency updates (e.g. `resize` and `scroll` events), always
  3745. // prefer the async Popper#update method
  3746. forceUpdate: function forceUpdate() {
  3747. if (isDestroyed) {
  3748. return;
  3749. }
  3750. var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
  3751. if (!areValidElements(reference3, popper3)) {
  3752. return;
  3753. }
  3754. state.rects = {
  3755. reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
  3756. popper: getLayoutRect(popper3)
  3757. };
  3758. state.reset = false;
  3759. state.placement = state.options.placement;
  3760. state.orderedModifiers.forEach(function(modifier) {
  3761. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  3762. });
  3763. for (var index = 0; index < state.orderedModifiers.length; index++) {
  3764. if (state.reset === true) {
  3765. state.reset = false;
  3766. index = -1;
  3767. continue;
  3768. }
  3769. 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;
  3770. if (typeof fn2 === "function") {
  3771. state = fn2({
  3772. state,
  3773. options: _options,
  3774. name,
  3775. instance
  3776. }) || state;
  3777. }
  3778. }
  3779. },
  3780. // Async and optimistically optimized update – it will not be executed if
  3781. // not necessary (debounced to run at most once-per-tick)
  3782. update: debounce$1(function() {
  3783. return new Promise(function(resolve) {
  3784. instance.forceUpdate();
  3785. resolve(state);
  3786. });
  3787. }),
  3788. destroy: function destroy() {
  3789. cleanupModifierEffects();
  3790. isDestroyed = true;
  3791. }
  3792. };
  3793. if (!areValidElements(reference2, popper2)) {
  3794. return instance;
  3795. }
  3796. instance.setOptions(options).then(function(state2) {
  3797. if (!isDestroyed && options.onFirstUpdate) {
  3798. options.onFirstUpdate(state2);
  3799. }
  3800. });
  3801. function runModifierEffects() {
  3802. state.orderedModifiers.forEach(function(_ref) {
  3803. var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect3 = _ref.effect;
  3804. if (typeof effect3 === "function") {
  3805. var cleanupFn = effect3({
  3806. state,
  3807. name,
  3808. instance,
  3809. options: options2
  3810. });
  3811. var noopFn = function noopFn2() {
  3812. };
  3813. effectCleanupFns.push(cleanupFn || noopFn);
  3814. }
  3815. });
  3816. }
  3817. function cleanupModifierEffects() {
  3818. effectCleanupFns.forEach(function(fn2) {
  3819. return fn2();
  3820. });
  3821. effectCleanupFns = [];
  3822. }
  3823. return instance;
  3824. };
  3825. }
  3826. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  3827. var createPopper = /* @__PURE__ */ popperGenerator({
  3828. defaultModifiers
  3829. });
  3830. var BOX_CLASS = "tippy-box";
  3831. var CONTENT_CLASS = "tippy-content";
  3832. var BACKDROP_CLASS = "tippy-backdrop";
  3833. var ARROW_CLASS = "tippy-arrow";
  3834. var SVG_ARROW_CLASS = "tippy-svg-arrow";
  3835. var TOUCH_OPTIONS = {
  3836. passive: true,
  3837. capture: true
  3838. };
  3839. var TIPPY_DEFAULT_APPEND_TO = function TIPPY_DEFAULT_APPEND_TO2() {
  3840. return document.body;
  3841. };
  3842. function getValueAtIndexOrReturn(value, index, defaultValue) {
  3843. if (Array.isArray(value)) {
  3844. var v = value[index];
  3845. return v == null ? Array.isArray(defaultValue) ? defaultValue[index] : defaultValue : v;
  3846. }
  3847. return value;
  3848. }
  3849. function isType(value, type) {
  3850. var str = {}.toString.call(value);
  3851. return str.indexOf("[object") === 0 && str.indexOf(type + "]") > -1;
  3852. }
  3853. function invokeWithArgsOrReturn(value, args) {
  3854. return typeof value === "function" ? value.apply(void 0, args) : value;
  3855. }
  3856. function debounce(fn5, ms) {
  3857. if (ms === 0) {
  3858. return fn5;
  3859. }
  3860. var timeout;
  3861. return function(arg) {
  3862. clearTimeout(timeout);
  3863. timeout = setTimeout(function() {
  3864. fn5(arg);
  3865. }, ms);
  3866. };
  3867. }
  3868. function splitBySpaces(value) {
  3869. return value.split(/\s+/).filter(Boolean);
  3870. }
  3871. function normalizeToArray(value) {
  3872. return [].concat(value);
  3873. }
  3874. function pushIfUnique(arr, value) {
  3875. if (arr.indexOf(value) === -1) {
  3876. arr.push(value);
  3877. }
  3878. }
  3879. function unique(arr) {
  3880. return arr.filter(function(item, index) {
  3881. return arr.indexOf(item) === index;
  3882. });
  3883. }
  3884. function getBasePlacement(placement) {
  3885. return placement.split("-")[0];
  3886. }
  3887. function arrayFrom(value) {
  3888. return [].slice.call(value);
  3889. }
  3890. function removeUndefinedProps(obj) {
  3891. return Object.keys(obj).reduce(function(acc, key) {
  3892. if (obj[key] !== void 0) {
  3893. acc[key] = obj[key];
  3894. }
  3895. return acc;
  3896. }, {});
  3897. }
  3898. function div() {
  3899. return document.createElement("div");
  3900. }
  3901. function isElement(value) {
  3902. return ["Element", "Fragment"].some(function(type) {
  3903. return isType(value, type);
  3904. });
  3905. }
  3906. function isNodeList(value) {
  3907. return isType(value, "NodeList");
  3908. }
  3909. function isMouseEvent(value) {
  3910. return isType(value, "MouseEvent");
  3911. }
  3912. function isReferenceElement(value) {
  3913. return !!(value && value._tippy && value._tippy.reference === value);
  3914. }
  3915. function getArrayOfElements(value) {
  3916. if (isElement(value)) {
  3917. return [value];
  3918. }
  3919. if (isNodeList(value)) {
  3920. return arrayFrom(value);
  3921. }
  3922. if (Array.isArray(value)) {
  3923. return value;
  3924. }
  3925. return arrayFrom(document.querySelectorAll(value));
  3926. }
  3927. function setTransitionDuration(els, value) {
  3928. els.forEach(function(el) {
  3929. if (el) {
  3930. el.style.transitionDuration = value + "ms";
  3931. }
  3932. });
  3933. }
  3934. function setVisibilityState(els, state) {
  3935. els.forEach(function(el) {
  3936. if (el) {
  3937. el.setAttribute("data-state", state);
  3938. }
  3939. });
  3940. }
  3941. function getOwnerDocument(elementOrElements) {
  3942. var _element$ownerDocumen;
  3943. var _normalizeToArray = normalizeToArray(elementOrElements), element = _normalizeToArray[0];
  3944. return element != null && (_element$ownerDocumen = element.ownerDocument) != null && _element$ownerDocumen.body ? element.ownerDocument : document;
  3945. }
  3946. function isCursorOutsideInteractiveBorder(popperTreeData, event) {
  3947. var clientX = event.clientX, clientY = event.clientY;
  3948. return popperTreeData.every(function(_ref) {
  3949. var popperRect = _ref.popperRect, popperState = _ref.popperState, props = _ref.props;
  3950. var interactiveBorder = props.interactiveBorder;
  3951. var basePlacement = getBasePlacement(popperState.placement);
  3952. var offsetData = popperState.modifiersData.offset;
  3953. if (!offsetData) {
  3954. return true;
  3955. }
  3956. var topDistance = basePlacement === "bottom" ? offsetData.top.y : 0;
  3957. var bottomDistance = basePlacement === "top" ? offsetData.bottom.y : 0;
  3958. var leftDistance = basePlacement === "right" ? offsetData.left.x : 0;
  3959. var rightDistance = basePlacement === "left" ? offsetData.right.x : 0;
  3960. var exceedsTop = popperRect.top - clientY + topDistance > interactiveBorder;
  3961. var exceedsBottom = clientY - popperRect.bottom - bottomDistance > interactiveBorder;
  3962. var exceedsLeft = popperRect.left - clientX + leftDistance > interactiveBorder;
  3963. var exceedsRight = clientX - popperRect.right - rightDistance > interactiveBorder;
  3964. return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
  3965. });
  3966. }
  3967. function updateTransitionEndListener(box, action, listener) {
  3968. var method = action + "EventListener";
  3969. ["transitionend", "webkitTransitionEnd"].forEach(function(event) {
  3970. box[method](event, listener);
  3971. });
  3972. }
  3973. function actualContains(parent, child) {
  3974. var target = child;
  3975. while (target) {
  3976. var _target$getRootNode;
  3977. if (parent.contains(target)) {
  3978. return true;
  3979. }
  3980. target = target.getRootNode == null ? void 0 : (_target$getRootNode = target.getRootNode()) == null ? void 0 : _target$getRootNode.host;
  3981. }
  3982. return false;
  3983. }
  3984. var currentInput = {
  3985. isTouch: false
  3986. };
  3987. var lastMouseMoveTime = 0;
  3988. function onDocumentTouchStart() {
  3989. if (currentInput.isTouch) {
  3990. return;
  3991. }
  3992. currentInput.isTouch = true;
  3993. if (window.performance) {
  3994. document.addEventListener("mousemove", onDocumentMouseMove);
  3995. }
  3996. }
  3997. function onDocumentMouseMove() {
  3998. var now = performance.now();
  3999. if (now - lastMouseMoveTime < 20) {
  4000. currentInput.isTouch = false;
  4001. document.removeEventListener("mousemove", onDocumentMouseMove);
  4002. }
  4003. lastMouseMoveTime = now;
  4004. }
  4005. function onWindowBlur() {
  4006. var activeElement = document.activeElement;
  4007. if (isReferenceElement(activeElement)) {
  4008. var instance = activeElement._tippy;
  4009. if (activeElement.blur && !instance.state.isVisible) {
  4010. activeElement.blur();
  4011. }
  4012. }
  4013. }
  4014. function bindGlobalEventListeners() {
  4015. document.addEventListener("touchstart", onDocumentTouchStart, TOUCH_OPTIONS);
  4016. window.addEventListener("blur", onWindowBlur);
  4017. }
  4018. var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
  4019. var isIE11 = isBrowser ? (
  4020. // @ts-ignore
  4021. !!window.msCrypto
  4022. ) : false;
  4023. var pluginProps = {
  4024. animateFill: false,
  4025. followCursor: false,
  4026. inlinePositioning: false,
  4027. sticky: false
  4028. };
  4029. var renderProps = {
  4030. allowHTML: false,
  4031. animation: "fade",
  4032. arrow: true,
  4033. content: "",
  4034. inertia: false,
  4035. maxWidth: 350,
  4036. role: "tooltip",
  4037. theme: "",
  4038. zIndex: 9999
  4039. };
  4040. var defaultProps = Object.assign({
  4041. appendTo: TIPPY_DEFAULT_APPEND_TO,
  4042. aria: {
  4043. content: "auto",
  4044. expanded: "auto"
  4045. },
  4046. delay: 0,
  4047. duration: [300, 250],
  4048. getReferenceClientRect: null,
  4049. hideOnClick: true,
  4050. ignoreAttributes: false,
  4051. interactive: false,
  4052. interactiveBorder: 2,
  4053. interactiveDebounce: 0,
  4054. moveTransition: "",
  4055. offset: [0, 10],
  4056. onAfterUpdate: function onAfterUpdate() {
  4057. },
  4058. onBeforeUpdate: function onBeforeUpdate() {
  4059. },
  4060. onCreate: function onCreate() {
  4061. },
  4062. onDestroy: function onDestroy() {
  4063. },
  4064. onHidden: function onHidden() {
  4065. },
  4066. onHide: function onHide() {
  4067. },
  4068. onMount: function onMount() {
  4069. },
  4070. onShow: function onShow() {
  4071. },
  4072. onShown: function onShown() {
  4073. },
  4074. onTrigger: function onTrigger() {
  4075. },
  4076. onUntrigger: function onUntrigger() {
  4077. },
  4078. onClickOutside: function onClickOutside() {
  4079. },
  4080. placement: "top",
  4081. plugins: [],
  4082. popperOptions: {},
  4083. render: null,
  4084. showOnCreate: false,
  4085. touch: true,
  4086. trigger: "mouseenter focus",
  4087. triggerTarget: null
  4088. }, pluginProps, renderProps);
  4089. var defaultKeys = Object.keys(defaultProps);
  4090. var setDefaultProps = function setDefaultProps2(partialProps) {
  4091. var keys = Object.keys(partialProps);
  4092. keys.forEach(function(key) {
  4093. defaultProps[key] = partialProps[key];
  4094. });
  4095. };
  4096. function getExtendedPassedProps(passedProps) {
  4097. var plugins = passedProps.plugins || [];
  4098. var pluginProps2 = plugins.reduce(function(acc, plugin) {
  4099. var name = plugin.name, defaultValue = plugin.defaultValue;
  4100. if (name) {
  4101. var _name;
  4102. acc[name] = passedProps[name] !== void 0 ? passedProps[name] : (_name = defaultProps[name]) != null ? _name : defaultValue;
  4103. }
  4104. return acc;
  4105. }, {});
  4106. return Object.assign({}, passedProps, pluginProps2);
  4107. }
  4108. function getDataAttributeProps(reference2, plugins) {
  4109. var propKeys = plugins ? Object.keys(getExtendedPassedProps(Object.assign({}, defaultProps, {
  4110. plugins
  4111. }))) : defaultKeys;
  4112. var props = propKeys.reduce(function(acc, key) {
  4113. var valueAsString = (reference2.getAttribute("data-tippy-" + key) || "").trim();
  4114. if (!valueAsString) {
  4115. return acc;
  4116. }
  4117. if (key === "content") {
  4118. acc[key] = valueAsString;
  4119. } else {
  4120. try {
  4121. acc[key] = JSON.parse(valueAsString);
  4122. } catch (e) {
  4123. acc[key] = valueAsString;
  4124. }
  4125. }
  4126. return acc;
  4127. }, {});
  4128. return props;
  4129. }
  4130. function evaluateProps(reference2, props) {
  4131. var out = Object.assign({}, props, {
  4132. content: invokeWithArgsOrReturn(props.content, [reference2])
  4133. }, props.ignoreAttributes ? {} : getDataAttributeProps(reference2, props.plugins));
  4134. out.aria = Object.assign({}, defaultProps.aria, out.aria);
  4135. out.aria = {
  4136. expanded: out.aria.expanded === "auto" ? props.interactive : out.aria.expanded,
  4137. content: out.aria.content === "auto" ? props.interactive ? null : "describedby" : out.aria.content
  4138. };
  4139. return out;
  4140. }
  4141. var innerHTML = function innerHTML2() {
  4142. return "innerHTML";
  4143. };
  4144. function dangerouslySetInnerHTML(element, html) {
  4145. element[innerHTML()] = html;
  4146. }
  4147. function createArrowElement(value) {
  4148. var arrow2 = div();
  4149. if (value === true) {
  4150. arrow2.className = ARROW_CLASS;
  4151. } else {
  4152. arrow2.className = SVG_ARROW_CLASS;
  4153. if (isElement(value)) {
  4154. arrow2.appendChild(value);
  4155. } else {
  4156. dangerouslySetInnerHTML(arrow2, value);
  4157. }
  4158. }
  4159. return arrow2;
  4160. }
  4161. function setContent(content, props) {
  4162. if (isElement(props.content)) {
  4163. dangerouslySetInnerHTML(content, "");
  4164. content.appendChild(props.content);
  4165. } else if (typeof props.content !== "function") {
  4166. if (props.allowHTML) {
  4167. dangerouslySetInnerHTML(content, props.content);
  4168. } else {
  4169. content.textContent = props.content;
  4170. }
  4171. }
  4172. }
  4173. function getChildren(popper2) {
  4174. var box = popper2.firstElementChild;
  4175. var boxChildren = arrayFrom(box.children);
  4176. return {
  4177. box,
  4178. content: boxChildren.find(function(node) {
  4179. return node.classList.contains(CONTENT_CLASS);
  4180. }),
  4181. arrow: boxChildren.find(function(node) {
  4182. return node.classList.contains(ARROW_CLASS) || node.classList.contains(SVG_ARROW_CLASS);
  4183. }),
  4184. backdrop: boxChildren.find(function(node) {
  4185. return node.classList.contains(BACKDROP_CLASS);
  4186. })
  4187. };
  4188. }
  4189. function render(instance) {
  4190. var popper2 = div();
  4191. var box = div();
  4192. box.className = BOX_CLASS;
  4193. box.setAttribute("data-state", "hidden");
  4194. box.setAttribute("tabindex", "-1");
  4195. var content = div();
  4196. content.className = CONTENT_CLASS;
  4197. content.setAttribute("data-state", "hidden");
  4198. setContent(content, instance.props);
  4199. popper2.appendChild(box);
  4200. box.appendChild(content);
  4201. onUpdate(instance.props, instance.props);
  4202. function onUpdate(prevProps, nextProps) {
  4203. var _getChildren = getChildren(popper2), box2 = _getChildren.box, content2 = _getChildren.content, arrow2 = _getChildren.arrow;
  4204. if (nextProps.theme) {
  4205. box2.setAttribute("data-theme", nextProps.theme);
  4206. } else {
  4207. box2.removeAttribute("data-theme");
  4208. }
  4209. if (typeof nextProps.animation === "string") {
  4210. box2.setAttribute("data-animation", nextProps.animation);
  4211. } else {
  4212. box2.removeAttribute("data-animation");
  4213. }
  4214. if (nextProps.inertia) {
  4215. box2.setAttribute("data-inertia", "");
  4216. } else {
  4217. box2.removeAttribute("data-inertia");
  4218. }
  4219. box2.style.maxWidth = typeof nextProps.maxWidth === "number" ? nextProps.maxWidth + "px" : nextProps.maxWidth;
  4220. if (nextProps.role) {
  4221. box2.setAttribute("role", nextProps.role);
  4222. } else {
  4223. box2.removeAttribute("role");
  4224. }
  4225. if (prevProps.content !== nextProps.content || prevProps.allowHTML !== nextProps.allowHTML) {
  4226. setContent(content2, instance.props);
  4227. }
  4228. if (nextProps.arrow) {
  4229. if (!arrow2) {
  4230. box2.appendChild(createArrowElement(nextProps.arrow));
  4231. } else if (prevProps.arrow !== nextProps.arrow) {
  4232. box2.removeChild(arrow2);
  4233. box2.appendChild(createArrowElement(nextProps.arrow));
  4234. }
  4235. } else if (arrow2) {
  4236. box2.removeChild(arrow2);
  4237. }
  4238. }
  4239. return {
  4240. popper: popper2,
  4241. onUpdate
  4242. };
  4243. }
  4244. render.$$tippy = true;
  4245. var idCounter = 1;
  4246. var mouseMoveListeners = [];
  4247. var mountedInstances = [];
  4248. function createTippy(reference2, passedProps) {
  4249. var props = evaluateProps(reference2, Object.assign({}, defaultProps, getExtendedPassedProps(removeUndefinedProps(passedProps))));
  4250. var showTimeout;
  4251. var hideTimeout;
  4252. var scheduleHideAnimationFrame;
  4253. var isVisibleFromClick = false;
  4254. var didHideDueToDocumentMouseDown = false;
  4255. var didTouchMove = false;
  4256. var ignoreOnFirstUpdate = false;
  4257. var lastTriggerEvent;
  4258. var currentTransitionEndListener;
  4259. var onFirstUpdate;
  4260. var listeners = [];
  4261. var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
  4262. var currentTarget;
  4263. var id = idCounter++;
  4264. var popperInstance = null;
  4265. var plugins = unique(props.plugins);
  4266. var state = {
  4267. // Is the instance currently enabled?
  4268. isEnabled: true,
  4269. // Is the tippy currently showing and not transitioning out?
  4270. isVisible: false,
  4271. // Has the instance been destroyed?
  4272. isDestroyed: false,
  4273. // Is the tippy currently mounted to the DOM?
  4274. isMounted: false,
  4275. // Has the tippy finished transitioning in?
  4276. isShown: false
  4277. };
  4278. var instance = {
  4279. // properties
  4280. id,
  4281. reference: reference2,
  4282. popper: div(),
  4283. popperInstance,
  4284. props,
  4285. state,
  4286. plugins,
  4287. // methods
  4288. clearDelayTimeouts,
  4289. setProps,
  4290. setContent: setContent2,
  4291. show,
  4292. hide: hide2,
  4293. hideWithInteractivity,
  4294. enable,
  4295. disable,
  4296. unmount,
  4297. destroy
  4298. };
  4299. if (!props.render) {
  4300. return instance;
  4301. }
  4302. var _props$render = props.render(instance), popper2 = _props$render.popper, onUpdate = _props$render.onUpdate;
  4303. popper2.setAttribute("data-tippy-root", "");
  4304. popper2.id = "tippy-" + instance.id;
  4305. instance.popper = popper2;
  4306. reference2._tippy = instance;
  4307. popper2._tippy = instance;
  4308. var pluginsHooks = plugins.map(function(plugin) {
  4309. return plugin.fn(instance);
  4310. });
  4311. var hasAriaExpanded = reference2.hasAttribute("aria-expanded");
  4312. addListeners();
  4313. handleAriaExpandedAttribute();
  4314. handleStyles();
  4315. invokeHook("onCreate", [instance]);
  4316. if (props.showOnCreate) {
  4317. scheduleShow();
  4318. }
  4319. popper2.addEventListener("mouseenter", function() {
  4320. if (instance.props.interactive && instance.state.isVisible) {
  4321. instance.clearDelayTimeouts();
  4322. }
  4323. });
  4324. popper2.addEventListener("mouseleave", function() {
  4325. if (instance.props.interactive && instance.props.trigger.indexOf("mouseenter") >= 0) {
  4326. getDocument().addEventListener("mousemove", debouncedOnMouseMove);
  4327. }
  4328. });
  4329. return instance;
  4330. function getNormalizedTouchSettings() {
  4331. var touch = instance.props.touch;
  4332. return Array.isArray(touch) ? touch : [touch, 0];
  4333. }
  4334. function getIsCustomTouchBehavior() {
  4335. return getNormalizedTouchSettings()[0] === "hold";
  4336. }
  4337. function getIsDefaultRenderFn() {
  4338. var _instance$props$rende;
  4339. return !!((_instance$props$rende = instance.props.render) != null && _instance$props$rende.$$tippy);
  4340. }
  4341. function getCurrentTarget() {
  4342. return currentTarget || reference2;
  4343. }
  4344. function getDocument() {
  4345. var parent = getCurrentTarget().parentNode;
  4346. return parent ? getOwnerDocument(parent) : document;
  4347. }
  4348. function getDefaultTemplateChildren() {
  4349. return getChildren(popper2);
  4350. }
  4351. function getDelay(isShow) {
  4352. if (instance.state.isMounted && !instance.state.isVisible || currentInput.isTouch || lastTriggerEvent && lastTriggerEvent.type === "focus") {
  4353. return 0;
  4354. }
  4355. return getValueAtIndexOrReturn(instance.props.delay, isShow ? 0 : 1, defaultProps.delay);
  4356. }
  4357. function handleStyles(fromHide) {
  4358. if (fromHide === void 0) {
  4359. fromHide = false;
  4360. }
  4361. popper2.style.pointerEvents = instance.props.interactive && !fromHide ? "" : "none";
  4362. popper2.style.zIndex = "" + instance.props.zIndex;
  4363. }
  4364. function invokeHook(hook, args, shouldInvokePropsHook) {
  4365. if (shouldInvokePropsHook === void 0) {
  4366. shouldInvokePropsHook = true;
  4367. }
  4368. pluginsHooks.forEach(function(pluginHooks) {
  4369. if (pluginHooks[hook]) {
  4370. pluginHooks[hook].apply(pluginHooks, args);
  4371. }
  4372. });
  4373. if (shouldInvokePropsHook) {
  4374. var _instance$props;
  4375. (_instance$props = instance.props)[hook].apply(_instance$props, args);
  4376. }
  4377. }
  4378. function handleAriaContentAttribute() {
  4379. var aria = instance.props.aria;
  4380. if (!aria.content) {
  4381. return;
  4382. }
  4383. var attr = "aria-" + aria.content;
  4384. var id2 = popper2.id;
  4385. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  4386. nodes.forEach(function(node) {
  4387. var currentValue = node.getAttribute(attr);
  4388. if (instance.state.isVisible) {
  4389. node.setAttribute(attr, currentValue ? currentValue + " " + id2 : id2);
  4390. } else {
  4391. var nextValue = currentValue && currentValue.replace(id2, "").trim();
  4392. if (nextValue) {
  4393. node.setAttribute(attr, nextValue);
  4394. } else {
  4395. node.removeAttribute(attr);
  4396. }
  4397. }
  4398. });
  4399. }
  4400. function handleAriaExpandedAttribute() {
  4401. if (hasAriaExpanded || !instance.props.aria.expanded) {
  4402. return;
  4403. }
  4404. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  4405. nodes.forEach(function(node) {
  4406. if (instance.props.interactive) {
  4407. node.setAttribute("aria-expanded", instance.state.isVisible && node === getCurrentTarget() ? "true" : "false");
  4408. } else {
  4409. node.removeAttribute("aria-expanded");
  4410. }
  4411. });
  4412. }
  4413. function cleanupInteractiveMouseListeners() {
  4414. getDocument().removeEventListener("mousemove", debouncedOnMouseMove);
  4415. mouseMoveListeners = mouseMoveListeners.filter(function(listener) {
  4416. return listener !== debouncedOnMouseMove;
  4417. });
  4418. }
  4419. function onDocumentPress(event) {
  4420. if (currentInput.isTouch) {
  4421. if (didTouchMove || event.type === "mousedown") {
  4422. return;
  4423. }
  4424. }
  4425. var actualTarget = event.composedPath && event.composedPath()[0] || event.target;
  4426. if (instance.props.interactive && actualContains(popper2, actualTarget)) {
  4427. return;
  4428. }
  4429. if (normalizeToArray(instance.props.triggerTarget || reference2).some(function(el) {
  4430. return actualContains(el, actualTarget);
  4431. })) {
  4432. if (currentInput.isTouch) {
  4433. return;
  4434. }
  4435. if (instance.state.isVisible && instance.props.trigger.indexOf("click") >= 0) {
  4436. return;
  4437. }
  4438. } else {
  4439. invokeHook("onClickOutside", [instance, event]);
  4440. }
  4441. if (instance.props.hideOnClick === true) {
  4442. instance.clearDelayTimeouts();
  4443. instance.hide();
  4444. didHideDueToDocumentMouseDown = true;
  4445. setTimeout(function() {
  4446. didHideDueToDocumentMouseDown = false;
  4447. });
  4448. if (!instance.state.isMounted) {
  4449. removeDocumentPress();
  4450. }
  4451. }
  4452. }
  4453. function onTouchMove() {
  4454. didTouchMove = true;
  4455. }
  4456. function onTouchStart() {
  4457. didTouchMove = false;
  4458. }
  4459. function addDocumentPress() {
  4460. var doc = getDocument();
  4461. doc.addEventListener("mousedown", onDocumentPress, true);
  4462. doc.addEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
  4463. doc.addEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
  4464. doc.addEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
  4465. }
  4466. function removeDocumentPress() {
  4467. var doc = getDocument();
  4468. doc.removeEventListener("mousedown", onDocumentPress, true);
  4469. doc.removeEventListener("touchend", onDocumentPress, TOUCH_OPTIONS);
  4470. doc.removeEventListener("touchstart", onTouchStart, TOUCH_OPTIONS);
  4471. doc.removeEventListener("touchmove", onTouchMove, TOUCH_OPTIONS);
  4472. }
  4473. function onTransitionedOut(duration, callback) {
  4474. onTransitionEnd(duration, function() {
  4475. if (!instance.state.isVisible && popper2.parentNode && popper2.parentNode.contains(popper2)) {
  4476. callback();
  4477. }
  4478. });
  4479. }
  4480. function onTransitionedIn(duration, callback) {
  4481. onTransitionEnd(duration, callback);
  4482. }
  4483. function onTransitionEnd(duration, callback) {
  4484. var box = getDefaultTemplateChildren().box;
  4485. function listener(event) {
  4486. if (event.target === box) {
  4487. updateTransitionEndListener(box, "remove", listener);
  4488. callback();
  4489. }
  4490. }
  4491. if (duration === 0) {
  4492. return callback();
  4493. }
  4494. updateTransitionEndListener(box, "remove", currentTransitionEndListener);
  4495. updateTransitionEndListener(box, "add", listener);
  4496. currentTransitionEndListener = listener;
  4497. }
  4498. function on(eventType, handler, options) {
  4499. if (options === void 0) {
  4500. options = false;
  4501. }
  4502. var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
  4503. nodes.forEach(function(node) {
  4504. node.addEventListener(eventType, handler, options);
  4505. listeners.push({
  4506. node,
  4507. eventType,
  4508. handler,
  4509. options
  4510. });
  4511. });
  4512. }
  4513. function addListeners() {
  4514. if (getIsCustomTouchBehavior()) {
  4515. on("touchstart", onTrigger2, {
  4516. passive: true
  4517. });
  4518. on("touchend", onMouseLeave, {
  4519. passive: true
  4520. });
  4521. }
  4522. splitBySpaces(instance.props.trigger).forEach(function(eventType) {
  4523. if (eventType === "manual") {
  4524. return;
  4525. }
  4526. on(eventType, onTrigger2);
  4527. switch (eventType) {
  4528. case "mouseenter":
  4529. on("mouseleave", onMouseLeave);
  4530. break;
  4531. case "focus":
  4532. on(isIE11 ? "focusout" : "blur", onBlurOrFocusOut);
  4533. break;
  4534. case "focusin":
  4535. on("focusout", onBlurOrFocusOut);
  4536. break;
  4537. }
  4538. });
  4539. }
  4540. function removeListeners() {
  4541. listeners.forEach(function(_ref) {
  4542. var node = _ref.node, eventType = _ref.eventType, handler = _ref.handler, options = _ref.options;
  4543. node.removeEventListener(eventType, handler, options);
  4544. });
  4545. listeners = [];
  4546. }
  4547. function onTrigger2(event) {
  4548. var _lastTriggerEvent;
  4549. var shouldScheduleClickHide = false;
  4550. if (!instance.state.isEnabled || isEventListenerStopped(event) || didHideDueToDocumentMouseDown) {
  4551. return;
  4552. }
  4553. var wasFocused = ((_lastTriggerEvent = lastTriggerEvent) == null ? void 0 : _lastTriggerEvent.type) === "focus";
  4554. lastTriggerEvent = event;
  4555. currentTarget = event.currentTarget;
  4556. handleAriaExpandedAttribute();
  4557. if (!instance.state.isVisible && isMouseEvent(event)) {
  4558. mouseMoveListeners.forEach(function(listener) {
  4559. return listener(event);
  4560. });
  4561. }
  4562. if (event.type === "click" && (instance.props.trigger.indexOf("mouseenter") < 0 || isVisibleFromClick) && instance.props.hideOnClick !== false && instance.state.isVisible) {
  4563. shouldScheduleClickHide = true;
  4564. } else {
  4565. scheduleShow(event);
  4566. }
  4567. if (event.type === "click") {
  4568. isVisibleFromClick = !shouldScheduleClickHide;
  4569. }
  4570. if (shouldScheduleClickHide && !wasFocused) {
  4571. scheduleHide(event);
  4572. }
  4573. }
  4574. function onMouseMove(event) {
  4575. var target = event.target;
  4576. var isCursorOverReferenceOrPopper = getCurrentTarget().contains(target) || popper2.contains(target);
  4577. if (event.type === "mousemove" && isCursorOverReferenceOrPopper) {
  4578. return;
  4579. }
  4580. var popperTreeData = getNestedPopperTree().concat(popper2).map(function(popper22) {
  4581. var _instance$popperInsta;
  4582. var instance2 = popper22._tippy;
  4583. var state2 = (_instance$popperInsta = instance2.popperInstance) == null ? void 0 : _instance$popperInsta.state;
  4584. if (state2) {
  4585. return {
  4586. popperRect: popper22.getBoundingClientRect(),
  4587. popperState: state2,
  4588. props
  4589. };
  4590. }
  4591. return null;
  4592. }).filter(Boolean);
  4593. if (isCursorOutsideInteractiveBorder(popperTreeData, event)) {
  4594. cleanupInteractiveMouseListeners();
  4595. scheduleHide(event);
  4596. }
  4597. }
  4598. function onMouseLeave(event) {
  4599. var shouldBail = isEventListenerStopped(event) || instance.props.trigger.indexOf("click") >= 0 && isVisibleFromClick;
  4600. if (shouldBail) {
  4601. return;
  4602. }
  4603. if (instance.props.interactive) {
  4604. instance.hideWithInteractivity(event);
  4605. return;
  4606. }
  4607. scheduleHide(event);
  4608. }
  4609. function onBlurOrFocusOut(event) {
  4610. if (instance.props.trigger.indexOf("focusin") < 0 && event.target !== getCurrentTarget()) {
  4611. return;
  4612. }
  4613. if (instance.props.interactive && event.relatedTarget && popper2.contains(event.relatedTarget)) {
  4614. return;
  4615. }
  4616. scheduleHide(event);
  4617. }
  4618. function isEventListenerStopped(event) {
  4619. return currentInput.isTouch ? getIsCustomTouchBehavior() !== event.type.indexOf("touch") >= 0 : false;
  4620. }
  4621. function createPopperInstance() {
  4622. destroyPopperInstance();
  4623. 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;
  4624. var arrow2 = getIsDefaultRenderFn() ? getChildren(popper2).arrow : null;
  4625. var computedReference = getReferenceClientRect ? {
  4626. getBoundingClientRect: getReferenceClientRect,
  4627. contextElement: getReferenceClientRect.contextElement || getCurrentTarget()
  4628. } : reference2;
  4629. var tippyModifier = {
  4630. name: "$$tippy",
  4631. enabled: true,
  4632. phase: "beforeWrite",
  4633. requires: ["computeStyles"],
  4634. fn: function fn5(_ref2) {
  4635. var state2 = _ref2.state;
  4636. if (getIsDefaultRenderFn()) {
  4637. var _getDefaultTemplateCh = getDefaultTemplateChildren(), box = _getDefaultTemplateCh.box;
  4638. ["placement", "reference-hidden", "escaped"].forEach(function(attr) {
  4639. if (attr === "placement") {
  4640. box.setAttribute("data-placement", state2.placement);
  4641. } else {
  4642. if (state2.attributes.popper["data-popper-" + attr]) {
  4643. box.setAttribute("data-" + attr, "");
  4644. } else {
  4645. box.removeAttribute("data-" + attr);
  4646. }
  4647. }
  4648. });
  4649. state2.attributes.popper = {};
  4650. }
  4651. }
  4652. };
  4653. var modifiers = [{
  4654. name: "offset",
  4655. options: {
  4656. offset: offset2
  4657. }
  4658. }, {
  4659. name: "preventOverflow",
  4660. options: {
  4661. padding: {
  4662. top: 2,
  4663. bottom: 2,
  4664. left: 5,
  4665. right: 5
  4666. }
  4667. }
  4668. }, {
  4669. name: "flip",
  4670. options: {
  4671. padding: 5
  4672. }
  4673. }, {
  4674. name: "computeStyles",
  4675. options: {
  4676. adaptive: !moveTransition
  4677. }
  4678. }, tippyModifier];
  4679. if (getIsDefaultRenderFn() && arrow2) {
  4680. modifiers.push({
  4681. name: "arrow",
  4682. options: {
  4683. element: arrow2,
  4684. padding: 3
  4685. }
  4686. });
  4687. }
  4688. modifiers.push.apply(modifiers, (popperOptions == null ? void 0 : popperOptions.modifiers) || []);
  4689. instance.popperInstance = createPopper(computedReference, popper2, Object.assign({}, popperOptions, {
  4690. placement,
  4691. onFirstUpdate,
  4692. modifiers
  4693. }));
  4694. }
  4695. function destroyPopperInstance() {
  4696. if (instance.popperInstance) {
  4697. instance.popperInstance.destroy();
  4698. instance.popperInstance = null;
  4699. }
  4700. }
  4701. function mount() {
  4702. var appendTo = instance.props.appendTo;
  4703. var parentNode;
  4704. var node = getCurrentTarget();
  4705. if (instance.props.interactive && appendTo === TIPPY_DEFAULT_APPEND_TO || appendTo === "parent") {
  4706. parentNode = node.parentNode;
  4707. } else {
  4708. parentNode = invokeWithArgsOrReturn(appendTo, [node]);
  4709. }
  4710. if (!parentNode.contains(popper2)) {
  4711. parentNode.appendChild(popper2);
  4712. }
  4713. instance.state.isMounted = true;
  4714. createPopperInstance();
  4715. }
  4716. function getNestedPopperTree() {
  4717. return arrayFrom(popper2.querySelectorAll("[data-tippy-root]"));
  4718. }
  4719. function scheduleShow(event) {
  4720. instance.clearDelayTimeouts();
  4721. if (event) {
  4722. invokeHook("onTrigger", [instance, event]);
  4723. }
  4724. addDocumentPress();
  4725. var delay = getDelay(true);
  4726. var _getNormalizedTouchSe = getNormalizedTouchSettings(), touchValue = _getNormalizedTouchSe[0], touchDelay = _getNormalizedTouchSe[1];
  4727. if (currentInput.isTouch && touchValue === "hold" && touchDelay) {
  4728. delay = touchDelay;
  4729. }
  4730. if (delay) {
  4731. showTimeout = setTimeout(function() {
  4732. instance.show();
  4733. }, delay);
  4734. } else {
  4735. instance.show();
  4736. }
  4737. }
  4738. function scheduleHide(event) {
  4739. instance.clearDelayTimeouts();
  4740. invokeHook("onUntrigger", [instance, event]);
  4741. if (!instance.state.isVisible) {
  4742. removeDocumentPress();
  4743. return;
  4744. }
  4745. if (instance.props.trigger.indexOf("mouseenter") >= 0 && instance.props.trigger.indexOf("click") >= 0 && ["mouseleave", "mousemove"].indexOf(event.type) >= 0 && isVisibleFromClick) {
  4746. return;
  4747. }
  4748. var delay = getDelay(false);
  4749. if (delay) {
  4750. hideTimeout = setTimeout(function() {
  4751. if (instance.state.isVisible) {
  4752. instance.hide();
  4753. }
  4754. }, delay);
  4755. } else {
  4756. scheduleHideAnimationFrame = requestAnimationFrame(function() {
  4757. instance.hide();
  4758. });
  4759. }
  4760. }
  4761. function enable() {
  4762. instance.state.isEnabled = true;
  4763. }
  4764. function disable() {
  4765. instance.hide();
  4766. instance.state.isEnabled = false;
  4767. }
  4768. function clearDelayTimeouts() {
  4769. clearTimeout(showTimeout);
  4770. clearTimeout(hideTimeout);
  4771. cancelAnimationFrame(scheduleHideAnimationFrame);
  4772. }
  4773. function setProps(partialProps) {
  4774. if (instance.state.isDestroyed) {
  4775. return;
  4776. }
  4777. invokeHook("onBeforeUpdate", [instance, partialProps]);
  4778. removeListeners();
  4779. var prevProps = instance.props;
  4780. var nextProps = evaluateProps(reference2, Object.assign({}, prevProps, removeUndefinedProps(partialProps), {
  4781. ignoreAttributes: true
  4782. }));
  4783. instance.props = nextProps;
  4784. addListeners();
  4785. if (prevProps.interactiveDebounce !== nextProps.interactiveDebounce) {
  4786. cleanupInteractiveMouseListeners();
  4787. debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
  4788. }
  4789. if (prevProps.triggerTarget && !nextProps.triggerTarget) {
  4790. normalizeToArray(prevProps.triggerTarget).forEach(function(node) {
  4791. node.removeAttribute("aria-expanded");
  4792. });
  4793. } else if (nextProps.triggerTarget) {
  4794. reference2.removeAttribute("aria-expanded");
  4795. }
  4796. handleAriaExpandedAttribute();
  4797. handleStyles();
  4798. if (onUpdate) {
  4799. onUpdate(prevProps, nextProps);
  4800. }
  4801. if (instance.popperInstance) {
  4802. createPopperInstance();
  4803. getNestedPopperTree().forEach(function(nestedPopper) {
  4804. requestAnimationFrame(nestedPopper._tippy.popperInstance.forceUpdate);
  4805. });
  4806. }
  4807. invokeHook("onAfterUpdate", [instance, partialProps]);
  4808. }
  4809. function setContent2(content) {
  4810. instance.setProps({
  4811. content
  4812. });
  4813. }
  4814. function show() {
  4815. var isAlreadyVisible = instance.state.isVisible;
  4816. var isDestroyed = instance.state.isDestroyed;
  4817. var isDisabled = !instance.state.isEnabled;
  4818. var isTouchAndTouchDisabled = currentInput.isTouch && !instance.props.touch;
  4819. var duration = getValueAtIndexOrReturn(instance.props.duration, 0, defaultProps.duration);
  4820. if (isAlreadyVisible || isDestroyed || isDisabled || isTouchAndTouchDisabled) {
  4821. return;
  4822. }
  4823. if (getCurrentTarget().hasAttribute("disabled")) {
  4824. return;
  4825. }
  4826. invokeHook("onShow", [instance], false);
  4827. if (instance.props.onShow(instance) === false) {
  4828. return;
  4829. }
  4830. instance.state.isVisible = true;
  4831. if (getIsDefaultRenderFn()) {
  4832. popper2.style.visibility = "visible";
  4833. }
  4834. handleStyles();
  4835. addDocumentPress();
  4836. if (!instance.state.isMounted) {
  4837. popper2.style.transition = "none";
  4838. }
  4839. if (getIsDefaultRenderFn()) {
  4840. var _getDefaultTemplateCh2 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh2.box, content = _getDefaultTemplateCh2.content;
  4841. setTransitionDuration([box, content], 0);
  4842. }
  4843. onFirstUpdate = function onFirstUpdate2() {
  4844. var _instance$popperInsta2;
  4845. if (!instance.state.isVisible || ignoreOnFirstUpdate) {
  4846. return;
  4847. }
  4848. ignoreOnFirstUpdate = true;
  4849. void popper2.offsetHeight;
  4850. popper2.style.transition = instance.props.moveTransition;
  4851. if (getIsDefaultRenderFn() && instance.props.animation) {
  4852. var _getDefaultTemplateCh3 = getDefaultTemplateChildren(), _box = _getDefaultTemplateCh3.box, _content = _getDefaultTemplateCh3.content;
  4853. setTransitionDuration([_box, _content], duration);
  4854. setVisibilityState([_box, _content], "visible");
  4855. }
  4856. handleAriaContentAttribute();
  4857. handleAriaExpandedAttribute();
  4858. pushIfUnique(mountedInstances, instance);
  4859. (_instance$popperInsta2 = instance.popperInstance) == null ? void 0 : _instance$popperInsta2.forceUpdate();
  4860. invokeHook("onMount", [instance]);
  4861. if (instance.props.animation && getIsDefaultRenderFn()) {
  4862. onTransitionedIn(duration, function() {
  4863. instance.state.isShown = true;
  4864. invokeHook("onShown", [instance]);
  4865. });
  4866. }
  4867. };
  4868. mount();
  4869. }
  4870. function hide2() {
  4871. var isAlreadyHidden = !instance.state.isVisible;
  4872. var isDestroyed = instance.state.isDestroyed;
  4873. var isDisabled = !instance.state.isEnabled;
  4874. var duration = getValueAtIndexOrReturn(instance.props.duration, 1, defaultProps.duration);
  4875. if (isAlreadyHidden || isDestroyed || isDisabled) {
  4876. return;
  4877. }
  4878. invokeHook("onHide", [instance], false);
  4879. if (instance.props.onHide(instance) === false) {
  4880. return;
  4881. }
  4882. instance.state.isVisible = false;
  4883. instance.state.isShown = false;
  4884. ignoreOnFirstUpdate = false;
  4885. isVisibleFromClick = false;
  4886. if (getIsDefaultRenderFn()) {
  4887. popper2.style.visibility = "hidden";
  4888. }
  4889. cleanupInteractiveMouseListeners();
  4890. removeDocumentPress();
  4891. handleStyles(true);
  4892. if (getIsDefaultRenderFn()) {
  4893. var _getDefaultTemplateCh4 = getDefaultTemplateChildren(), box = _getDefaultTemplateCh4.box, content = _getDefaultTemplateCh4.content;
  4894. if (instance.props.animation) {
  4895. setTransitionDuration([box, content], duration);
  4896. setVisibilityState([box, content], "hidden");
  4897. }
  4898. }
  4899. handleAriaContentAttribute();
  4900. handleAriaExpandedAttribute();
  4901. if (instance.props.animation) {
  4902. if (getIsDefaultRenderFn()) {
  4903. onTransitionedOut(duration, instance.unmount);
  4904. }
  4905. } else {
  4906. instance.unmount();
  4907. }
  4908. }
  4909. function hideWithInteractivity(event) {
  4910. getDocument().addEventListener("mousemove", debouncedOnMouseMove);
  4911. pushIfUnique(mouseMoveListeners, debouncedOnMouseMove);
  4912. debouncedOnMouseMove(event);
  4913. }
  4914. function unmount() {
  4915. if (instance.state.isVisible) {
  4916. instance.hide();
  4917. }
  4918. if (!instance.state.isMounted) {
  4919. return;
  4920. }
  4921. destroyPopperInstance();
  4922. getNestedPopperTree().forEach(function(nestedPopper) {
  4923. nestedPopper._tippy.unmount();
  4924. });
  4925. if (popper2.parentNode) {
  4926. popper2.parentNode.removeChild(popper2);
  4927. }
  4928. mountedInstances = mountedInstances.filter(function(i) {
  4929. return i !== instance;
  4930. });
  4931. instance.state.isMounted = false;
  4932. invokeHook("onHidden", [instance]);
  4933. }
  4934. function destroy() {
  4935. if (instance.state.isDestroyed) {
  4936. return;
  4937. }
  4938. instance.clearDelayTimeouts();
  4939. instance.unmount();
  4940. removeListeners();
  4941. delete reference2._tippy;
  4942. instance.state.isDestroyed = true;
  4943. invokeHook("onDestroy", [instance]);
  4944. }
  4945. }
  4946. function tippy(targets, optionalProps) {
  4947. if (optionalProps === void 0) {
  4948. optionalProps = {};
  4949. }
  4950. var plugins = defaultProps.plugins.concat(optionalProps.plugins || []);
  4951. bindGlobalEventListeners();
  4952. var passedProps = Object.assign({}, optionalProps, {
  4953. plugins
  4954. });
  4955. var elements = getArrayOfElements(targets);
  4956. var instances = elements.reduce(function(acc, reference2) {
  4957. var instance = reference2 && createTippy(reference2, passedProps);
  4958. if (instance) {
  4959. acc.push(instance);
  4960. }
  4961. return acc;
  4962. }, []);
  4963. return isElement(targets) ? instances[0] : instances;
  4964. }
  4965. tippy.defaultProps = defaultProps;
  4966. tippy.setDefaultProps = setDefaultProps;
  4967. tippy.currentInput = currentInput;
  4968. Object.assign({}, applyStyles$1, {
  4969. effect: function effect2(_ref) {
  4970. var state = _ref.state;
  4971. var initialStyles = {
  4972. popper: {
  4973. position: state.options.strategy,
  4974. left: "0",
  4975. top: "0",
  4976. margin: "0"
  4977. },
  4978. arrow: {
  4979. position: "absolute"
  4980. },
  4981. reference: {}
  4982. };
  4983. Object.assign(state.elements.popper.style, initialStyles.popper);
  4984. state.styles = initialStyles;
  4985. if (state.elements.arrow) {
  4986. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  4987. }
  4988. }
  4989. });
  4990. tippy.setDefaultProps({
  4991. render
  4992. });
  4993.  
  4994. })
  4995. };
  4996. }));
  4997.  
  4998. System.register("./index-D3l8MoSf-Dhsxm64a.js", ['jquery'], (function (exports, module) {
  4999. 'use strict';
  5000. var $;
  5001. return {
  5002. setters: [module => {
  5003. $ = module.default;
  5004. }],
  5005. execute: (function () {
  5006.  
  5007. const $body = $(document.body);
  5008. const $container = $(".tabs-container");
  5009. $body.append('<div class="scroll-top"></div>');
  5010. $container.on("scroll", function() {
  5011. const scrollTop = $(this).scrollTop();
  5012. const scrollElment = $(".scroll-top");
  5013. scrollTop > 500 ? scrollElment.fadeIn() : scrollElment.fadeOut();
  5014. });
  5015. $body.on("click", ".scroll-top", function() {
  5016. $container.animate({ scrollTop: "0" }, 1e3);
  5017. });
  5018.  
  5019. })
  5020. };
  5021. }));
  5022.  
  5023. System.import("./__entry.js", "./");