Greasy Fork 还支持 简体中文。

JSON Viewer

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

目前為 2024-10-20 提交的版本,檢視 最新版本

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