JSON Viewer

格式化显示JSON使数据看起来更加漂亮,支持折叠/展开格式化后的数据,支持JSON脑图让调用层级看着更清晰,支持复制JSON脑图节点路径

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

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