LLM(openai, gemini, claude) API Request/Response Visualization in mitmweb.
// ==UserScript== // @name mitmproxy-llm-better-view // @name:zh-CN mitmproxy-llm-better-view // @namespace npm/vite-plugin-monkey // @version 0.5.0 // @description LLM(openai, gemini, claude) API Request/Response Visualization in mitmweb. // @description:zh-CN mitmweb中 可视化大模型(openai, gemini, claude)请求/响应内容 // @icon https://s3.api2o.com/mitm-better-view.png // @homepage https://github.com/ctxinf/mitmproxy-llm-better-view // @match http://localhost:8081/* // @match http://127.0.0.1:8081/* // @match http://127.0.0.1:9090/* // @match http://127.0.0.1:8888/or_add_match_pattern_for_your_specific_mitmweb_endpoint/* // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.global.prod.js // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/system.min.js // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/extras/named-register.min.js // @require data:application/javascript,%3B(typeof%20System!%3D'undefined')%26%26(System%3Dnew%20System.constructor())%3B // @grant GM_addStyle // @grant unsafeWindow // ==/UserScript== System.addImportMap({ imports: {"vue":"user:vue"} }); System.set("user:vue", (()=>{const _=Vue;('default' in _)||(_.default=_);return _})()); System.register("./__entry.js", ['./main-CBTFarNI-HX0H7eVT.js'], (function (exports, module) { 'use strict'; var importCSS; return { setters: [module => { importCSS = module.b; }], execute: (function () { importCSS(' .standard-select[data-v-a122a048]{font-size:11px;padding:2px 6px;border:1px solid #e0e0e0;border-radius:3px;background-color:#fffc;color:#666;cursor:pointer;outline:none;opacity:.6;transition:opacity .2s,border-color .2s}.standard-select[data-v-a122a048]:hover{opacity:1;border-color:#ccc}.standard-select[data-v-a122a048]:focus{opacity:1;border-color:#999}.view-dashboard-proxy[data-v-e9d7881c]{position:relative}.standard-selector[data-v-e9d7881c]{position:absolute;top:4px;right:4px;z-index:10}.llm-better-view[data-v-901eaafb]{margin:2rem 0;border-radius:0 0 6px 6px;box-shadow:0 6px 12px #0000001f,-6px 0 12px #00000014,6px 0 12px #00000014;transition:box-shadow .25s ease}.llm-better-view[data-v-901eaafb]:hover{box-shadow:0 12px 24px #0003,-12px 0 24px #00000026,12px 0 24px #00000026}.summary[data-v-901eaafb]{display:flex;align-items:center;position:sticky;top:0;padding:.5rem 4px;background:color-mix(in srgb,var(--llm-subject-color) 30%,white 70%);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color .2s ease;position:relative}.summary[data-v-901eaafb]:hover{background:color-mix(in srgb,var(--llm-subject-color) 35%,white 65%)}.summary[data-v-901eaafb]::-webkit-details-marker{display:none}.title[data-v-901eaafb]{display:flex;align-items:center;font-size:1.25rem;white-space:nowrap;font-weight:600;color:#1e293b}.arrow[data-v-901eaafb]{font-size:1.1rem;transition:transform .3s ease;color:#0284c7}.llm-better-view[open] .arrow[data-v-901eaafb]{transform:rotate(90deg)}.github-link[data-v-901eaafb]{color:#24292f;margin:0 .5rem;opacity:.66;transition:opacity .2s ease}.github-link[data-v-901eaafb]:hover{opacity:1;outline:1px solid rgba(0,0,0,.462);border-radius:5px}.content[data-v-901eaafb]{padding:0;margin:0;padding-top:1rem}.unknown-standard-selector[data-v-30b82ae2]{width:100%;display:flex;justify-content:flex-end;margin:0}.selector-row[data-v-30b82ae2]{display:flex;align-items:center}.selector-trigger[data-v-30b82ae2]{width:80px;height:30px;border:0px solid #cfd8e3;border-radius:999px;background:#f8fafc;cursor:pointer;padding:0 6px;display:inline-flex;align-items:center;justify-content:center;overflow:hidden;transition:transform .2s ease,border-color .2s ease,background-color .2s ease}.selector-trigger[data-v-30b82ae2]:hover{background:#eff6ff}.selector-trigger-open[data-v-30b82ae2]{transform:translate(-6px)}.trigger-icon[data-v-30b82ae2]{width:auto;max-width:100%;object-fit:contain;display:block}.selector-panel[data-v-30b82ae2]{max-width:0;margin-left:0;overflow:hidden;opacity:0;transition:max-width .2s ease,opacity .2s ease,margin-left .2s ease}.selector-panel-open[data-v-30b82ae2]{max-width:170px;margin-left:6px;opacity:1}.unknown-dashboard-gate[data-v-b69d838d]{margin:2rem 0}.debug-toggle-btn[data-v-de0e06ab]{position:fixed;top:10px;right:10px;padding:8px 12px;background:#667eea;color:#fff;border:none;border-radius:4px;cursor:pointer;z-index:10001}.debug-toggle-btn[data-v-de0e06ab]:hover{background:#5568d3}.collapse-card[data-v-fb667e93]{background:#fff;border:1px solid #e2e8f0;border-radius:12px;box-shadow:0 1px 2px #0000000d;margin-bottom:16px;overflow:hidden;transition:box-shadow .3s ease,border-color .3s ease}.collapse-card[data-v-fb667e93]:hover{border-color:#cbd5e1;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.card-header[data-v-fb667e93]{width:100%;box-sizing:border-box;display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:color-mix(in srgb,var(--llm-subject-color, #e2e8f0) 20%,transparent);border:none;border-bottom:1px solid #cbd5e1;cursor:pointer;text-align:left;transition:background-color .2s;outline:none}.card-header[data-v-fb667e93]:hover{background:color-mix(in srgb,var(--llm-subject-color, #ffffff) 30%,transparent)}.header-left[data-v-fb667e93]{display:flex;align-items:center;gap:8px}.header-right[data-v-fb667e93]{display:flex;align-items:center;gap:8px;margin-right:8px}.title[data-v-fb667e93]{font-size:2rem;font-weight:600;color:#1e293b}.badge[data-v-fb667e93]{display:inline-flex;align-items:center;justify-content:center;background-color:#dbeafe;color:#1e40af;font-size:1.5rem;font-weight:600;padding:4px 8px;border-radius:6px}.chevron-icon[data-v-fb667e93]{color:#64748b;transform:rotate(-90deg);transition:transform .3s cubic-bezier(.4,0,.2,1),color .2s}.collapse-card.is-open .chevron-icon[data-v-fb667e93]{transform:rotate(0);color:#475569}.card-content-wrapper[data-v-fb667e93]{display:grid;grid-template-rows:0fr;transition:grid-template-rows .3s cubic-bezier(.4,0,.2,1)}.collapse-card.is-open .card-content-wrapper[data-v-fb667e93]{grid-template-rows:1fr}.card-content-inner[data-v-fb667e93]{overflow:hidden}.content-padding[data-v-fb667e93]{padding:2px}.header-actions[data-v-fb667e93]{display:flex;gap:4px;opacity:0;transition:opacity .2s ease}.card-header:hover .header-actions[data-v-fb667e93]{opacity:1}.action-btn[data-v-fb667e93]{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:none;border-radius:var(--llm-radius-sm, 4px);background:transparent;color:var(--llm-text-secondary, #64748b);cursor:pointer;transition:all .2s ease}.action-btn[data-v-fb667e93]:hover{background:var(--llm-bg-hover, #f1f5f9)}.action-btn:hover .action-icon[data-v-fb667e93]{filter:brightness(.7)}.action-btn[data-v-fb667e93]:active{transform:scale(.95)}.action-icon[data-v-fb667e93]{width:16px;height:16px}.info-item[data-v-5d157f12]{padding:8px 4px;border-bottom:1px solid #f1f5f9;display:flex;justify-content:space-between;align-items:center}.info-item[data-v-5d157f12]:last-child{border-bottom:none}.info-label[data-v-5d157f12]{font-size:1.2800000000000002rem;color:#64748b;font-weight:500;min-width:120px}.info-value[data-v-5d157f12]{font-weight:600;color:#1e293b;font-size:1.2800000000000002rem}.prose-wrapper[data-v-f5992598]{width:100%;overflow:hidden}.prose[data-v-f5992598]{font-size:1.5rem;line-height:1.75;color:#374151;word-wrap:break-word}[data-v-f5992598] h1,[data-v-f5992598] h2,[data-v-f5992598] h3,[data-v-f5992598] h4{color:#111827;font-weight:600;line-height:1.3;margin-top:1.5em;margin-bottom:.8em}[data-v-f5992598] h1{font-size:1.75em;border-bottom:1px solid #e5e7eb;padding-bottom:.3em}[data-v-f5992598] h2{font-size:1.5em;border-bottom:1px solid #e5e7eb;padding-bottom:.3em}[data-v-f5992598] h3{font-size:1.25em}[data-v-f5992598] p{margin-bottom:.25em}[data-v-f5992598] code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.9em;background-color:#f1f5f9;color:#ef4444;padding:.2em .4em;border-radius:4px}[data-v-f5992598] pre{background:#1e293b;color:#f8fafc;padding:1rem;border-radius:8px;overflow-x:var(--v2941c8b5);white-space:var(--e754ac8c);margin:1.5em 0}[data-v-f5992598] pre code{background:transparent;color:inherit;padding:0}[data-v-f5992598] blockquote{border-left:4px solid #e5e7eb;padding-left:1em;color:#6b7280;font-style:italic;margin:1.5em 0}[data-v-f5992598] img{max-width:100%;border-radius:8px}[data-v-f5992598] table{width:100%;border-collapse:collapse;margin-bottom:1.5em}[data-v-f5992598] th,[data-v-f5992598] td{border:1px solid #e5e7eb;padding:.6em;text-align:left}[data-v-f5992598] th{background:#f9fafb}[data-v-f5992598] .xv-tag{color:#22863a;font-weight:600}[data-v-f5992598] .xv-bracket{color:#6f42c1}[data-v-f5992598] .xv-attr-name{color:#005cc5}[data-v-f5992598] .xv-attr-value{color:#032f62}[data-v-f5992598] .xv-equals{color:#24292e}[data-v-f5992598] .xv-comment{color:#6a737d;font-style:italic}.xml-view-container[data-v-b0f5e2f7]{position:relative;background-color:#fafafa;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}.xml-code[data-v-b0f5e2f7]{margin:0;padding:12px;font-size:12px;line-height:1.5;white-space:var(--v07dd4f84);word-break:var(--v77d3f20b);overflow-x:var(--v4aad7caa);color:#24292e}[data-v-b0f5e2f7] .xv-tag{color:#22863a;font-weight:600}[data-v-b0f5e2f7] .xv-bracket{color:#6f42c1}[data-v-b0f5e2f7] .xv-attr-name{color:#005cc5}[data-v-b0f5e2f7] .xv-attr-value{color:#032f62}[data-v-b0f5e2f7] .xv-equals{color:#24292e}[data-v-b0f5e2f7] .xv-comment{color:#6a737d;font-style:italic}.json-view-container[data-v-baf7cacd]{position:relative;background-color:#fafafa;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}.json-code[data-v-baf7cacd]{margin:0;padding:12px;font-size:12px;line-height:1.5;white-space:var(--v4d64ba78);word-break:var(--f5f67a02);overflow-x:var(--v79cea837);color:#24292e}[data-v-baf7cacd] .jv-key{color:#795da3;font-weight:600}[data-v-baf7cacd] .jv-string{color:#032f62}[data-v-baf7cacd] .jv-number{color:#005cc5}[data-v-baf7cacd] .jv-boolean{color:#d73a49}[data-v-baf7cacd] .jv-null{color:#6a737d}.raw-viewer[data-v-75b62bea]{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;background:#1e293b;color:#e2e8f0;padding:12px;border-radius:6px;font-size:.9rem;line-height:1.5;overflow-x:auto;margin:0}.format-selector[data-v-2e77cd25]{position:relative;display:inline-flex;pointer-events:auto}.format-label[data-v-2e77cd25]{font-size:.85rem;color:#64748b;font-family:ui-monospace,monospace;text-transform:uppercase;letter-spacing:.05em;background:#fff9;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);padding:2px;border-radius:4px;cursor:pointer;transition:all .2s}.format-label[data-v-2e77cd25]:hover{background:#ffffffe6;color:#334155}.format-dropdown[data-v-2e77cd25]{position:absolute;top:calc(100% + 4px);left:0;background:#fff;border:1px solid #e2e8f0;border-radius:6px;box-shadow:0 4px 12px #0000001a;min-width:120px;overflow:hidden;pointer-events:auto;z-index:9999}.format-option[data-v-2e77cd25]{display:block;width:100%;padding:8px 12px;text-align:left;border:none;background:none;font-size:.875rem;color:#374151;cursor:pointer;transition:background .15s;font-family:ui-monospace,monospace;text-transform:uppercase;letter-spacing:.05em}.format-option[data-v-2e77cd25]:hover{background:#f1f5f9}.format-option.active[data-v-2e77cd25]{background:#eff6ff;color:#2563eb;font-weight:500}.dropdown-enter-active[data-v-2e77cd25],.dropdown-leave-active[data-v-2e77cd25]{transition:opacity .2s,transform .2s}.dropdown-enter-from[data-v-2e77cd25],.dropdown-leave-to[data-v-2e77cd25]{opacity:0;transform:translateY(-8px)}.copy-btn[data-v-e0a8f595]{display:flex;align-items:center;justify-content:center;padding:4px;border-radius:4px;border:1px solid #d1d5db;background:#fff;color:#6b7280;cursor:pointer}.copy-btn[data-v-e0a8f595]:hover{background-color:#f3f4f6;color:#111827}.option-button[data-v-ab422d13]{display:flex;align-items:center;justify-content:center;padding:4px;border-radius:4px;border:1px solid #d1d5db;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s}.option-button[data-v-ab422d13]:hover{background-color:#f3f4f6;color:#111827}.option-button.active[data-v-ab422d13]{background-color:#eff6ff;border-color:#3b82f6;color:#2563eb;opacity:1}[data-v-ab422d13] .text-block-header:hover .option-button,[data-v-ab422d13] .viewer-toolbar:hover .option-button{opacity:1}.option-button[data-v-1738c9d5]{display:flex;align-items:center;justify-content:center;padding:4px;border-radius:4px;border:1px solid #d1d5db;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s}.option-button[data-v-1738c9d5]:hover{background-color:#f3f4f6;color:#111827}.option-button.active[data-v-1738c9d5]{background-color:#eff6ff;border-color:#3b82f6;color:#2563eb}.text-block[data-v-8e519c3a]{margin:0;position:relative}.text-block-header[data-v-8e519c3a]{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:-2px;position:relative;z-index:5}.text-block-body[data-v-8e519c3a]{position:relative;border-radius:6px}.text-block-body[data-v-8e519c3a]:hover{box-shadow:0 0 0 1px #94a3b899}.scroll-content[data-v-8e519c3a]{position:relative;min-height:40px;height:auto;overflow:visible;transition:box-shadow .2s}.scroll-content.scroll-mode[data-v-8e519c3a]{max-height:min(50vh,400px);overflow-y:auto;scrollbar-width:thin;scrollbar-color:#cbd5e1 transparent}.scroll-content.scroll-mode[data-v-8e519c3a]::-webkit-scrollbar{width:6px}.scroll-content.scroll-mode[data-v-8e519c3a]::-webkit-scrollbar-thumb{background-color:#cbd5e1;border-radius:3px}.floating-buttons[data-v-8e519c3a]{position:absolute;top:6px;right:6px;display:flex;gap:4px;opacity:0;transition:opacity .2s;z-index:10;pointer-events:none;background:#ffffffd9;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);padding:2px;border-radius:6px;box-shadow:0 1px 2px #0000000d}.floating-buttons.visible[data-v-8e519c3a]{opacity:1;pointer-events:auto}.header-actions[data-v-8e519c3a]{display:flex;align-items:center;gap:4px;pointer-events:auto}.view-raw-btn[data-v-8e519c3a]{display:flex;align-items:center;gap:4px;border:none;background:#fff9;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);padding:2px 6px;border-radius:4px;font-size:.85rem;color:#64748b;cursor:pointer;transition:all .2s}.view-raw-btn[data-v-8e519c3a]:hover{background:#ffffffe6;color:#334155}.text-content[data-v-8e519c3a]{font-size:1.5rem;font-family:inherit;white-space:pre-wrap;word-wrap:break-word;margin:0;padding:0}.deferred-placeholder[data-v-8e519c3a]{padding:10px 0;font-size:1.2rem;color:#64748b;font-style:italic}.tool-args[data-v-e00c2d00]{font-family:Monaco,Menlo,monospace;border-radius:4px}.param-list[data-v-e00c2d00]{display:flex;flex-direction:column;gap:0px}.param-item[data-v-e00c2d00]{display:flex;align-items:flex-start;gap:12px;padding:2px 4px;border:1px solid rgba(226,232,240,.8);border-radius:6px}.param-name[data-v-e00c2d00]{font-size:1.3rem;font-weight:600;color:#2563eb;min-width:80px;flex-shrink:0;padding-top:2px}.param-value[data-v-e00c2d00]{flex:1;font-size:1.2rem;min-width:0}.param-value[data-v-e00c2d00] .text-block{margin:0}.native-details[data-v-3e1e1023]{display:block;box-sizing:border-box;width:100%}.native-summary[data-v-3e1e1023]{display:list-item;list-style:disclosure-closed inside;cursor:pointer;outline:none;padding:4px 0;-webkit-user-select:none;user-select:none;align-items:center}.summary-content[data-v-3e1e1023]{display:inline-flex;align-items:center;gap:8px;white-space:nowrap}.native-details[open]>.native-summary[data-v-3e1e1023]{list-style-type:disclosure-open}.native-summary[data-v-3e1e1023]::-webkit-details-marker{color:inherit}.tool-parameters[data-v-da5963be]{--color-border: #e2e8f0;--color-bg-subtle: #f8fafc;--color-bg-hover: #f1f5f9;--color-text-main: #1e293b;--color-text-sub: #64748b;--color-primary: #0ea5e9;--color-nonrequired: #c6c6c682;--color-warning: #f59e0b;--color-success: #10b981;--font-mono: "Monaco", "Menlo", "Consolas", monospace;font-size:14px;width:100%}.properties-list[data-v-da5963be]{display:flex;flex-direction:column;gap:8px}.property-row[data-v-da5963be]{border:1px solid var(--color-border);border-radius:6px;background:#fff;transition:all .2s ease;overflow:hidden}.property-row.is-required[data-v-da5963be]{border-left:3px solid var(--color-warning)}.property-row[data-v-da5963be]:not(.is-required){border-left:3px solid var(--color-nonrequired)}.property-content[data-v-da5963be]{padding:10px 12px}.property-header[data-v-da5963be]{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.expand-btn[data-v-da5963be]{background:none;border:none;cursor:pointer;padding:0;width:16px;height:16px;display:flex;align-items:center;justify-content:center;color:var(--color-text-sub);transition:transform .2s}.expand-btn[data-v-da5963be]:hover{color:var(--color-primary)}.expand-btn.is-closed .icon-caret[data-v-da5963be]{transform:rotate(-90deg)}.icon-caret[data-v-da5963be]{font-size:10px;transition:transform .2s}.expand-placeholder[data-v-da5963be]{width:16px}.property-name[data-v-da5963be]{font-family:var(--font-mono);font-weight:600;color:var(--color-text-main);font-size:14px}.property-type[data-v-da5963be]{font-family:var(--font-mono);font-size:12px;color:var(--color-primary);background:#e0f2fe;padding:1px 6px;border-radius:4px}.badge[data-v-da5963be]{font-size:10px;font-weight:700;text-transform:uppercase;padding:1px 4px;border-radius:3px;letter-spacing:.05em}.required-badge[data-v-da5963be]{color:#b45309;background:#fffbeb;border:1px solid #fcd34d}.enum-badge[data-v-da5963be]{color:#047857;background:#ecfdf5;border:1px solid #6ee7b7}.property-desc[data-v-da5963be]{margin-top:4px;color:var(--color-text-sub);font-size:13px;line-height:1.5;padding-left:24px}.meta-block[data-v-da5963be]{margin-top:8px;padding-left:24px;display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}.meta-label[data-v-da5963be]{font-size:11px;font-weight:600;color:var(--color-text-sub);text-transform:uppercase}.enum-container[data-v-da5963be]{display:flex;flex-wrap:wrap;gap:4px}.code-pill[data-v-da5963be]{font-family:var(--font-mono);font-size:11px;padding:2px 6px;background:var(--color-bg-subtle);border:1px solid var(--color-border);border-radius:4px;color:var(--color-text-main)}.default-pill[data-v-da5963be]{background:#f1f5f9;color:#475569}.nested-container[data-v-da5963be]{background:#f8fafc;border-top:1px solid var(--color-border);padding:8px 12px 12px 36px}.nested-label[data-v-da5963be]{font-size:11px;font-weight:600;color:var(--color-text-sub);margin-bottom:8px;text-transform:uppercase;letter-spacing:.05em}.nested-container[data-v-da5963be] .property-row{background:#fff;border-color:#e2e8f0}.no-properties[data-v-da5963be]{padding:20px;text-align:center;color:var(--color-text-sub);font-style:italic;background:var(--color-bg-subtle);border-radius:6px;border:1px dashed var(--color-border)}.tool-item[data-v-26afee9b]{margin-bottom:8px;border:1px solid #e2e8f0;border-radius:8px;background:#fff;overflow:hidden}.tool-header[data-v-26afee9b]{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:#f8fafc;cursor:pointer;transition:background-color .2s}.tool-header[data-v-26afee9b]:hover{background:#f1f5f9}.header-left[data-v-26afee9b]{display:flex;flex:1;min-width:0;align-items:center;gap:8px}.header-right[data-v-26afee9b]{flex-shrink:0}.toggle-icon[data-v-26afee9b]{color:#64748b;font-size:1.2rem}.tool-index[data-v-26afee9b]{font-size:1.3rem;color:#94a3b8;font-weight:500}.tool-name[data-v-26afee9b]{font-family:Monaco,Menlo,Consolas,monospace;font-size:1.6rem;font-weight:600;padding:4px 10px;border-radius:4px;flex-shrink:0;background:var(--llm-badge-tool-bg);color:var(--llm-badge-tool-text)}.tool-desc-preview[data-v-26afee9b]{font-size:1.3rem;color:#64748b;font-style:italic;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:60%}.raw-btn[data-v-26afee9b]{padding:4px 10px;font-size:1.1rem;color:#64748b;background:transparent;border:1px solid #d1d5db;border-radius:6px;cursor:pointer;transition:all .2s}.raw-btn[data-v-26afee9b]:hover{color:#374151;border-color:#9ca3af}.raw-btn.active[data-v-26afee9b]{color:#3b82f6;border-color:#3b82f6;background:#3b82f60d}.tool-content[data-v-26afee9b]{padding:6px 6px 6px 16px;border-top:1px solid #e2e8f0}.raw-mode[data-v-26afee9b]{margin:0}.description-section[data-v-26afee9b],.parameters-section[data-v-26afee9b]{margin-bottom:16px;padding-left:1rem}.description-section[data-v-26afee9b]:last-child,.parameters-section[data-v-26afee9b]:last-child{margin-bottom:0}.section-label[data-v-26afee9b]{font-size:1.2rem;font-weight:600;color:#64748b;text-transform:uppercase;letter-spacing:.05em;margin-bottom:8px}.role-badge[data-v-cff38f4a]{padding:2px 6px;border-radius:var(--llm-radius-sm);font-size:1rem;font-weight:600;text-transform:uppercase}.role-user[data-v-cff38f4a]{background:var(--llm-badge-user-bg);color:var(--llm-badge-user-text)}.role-assistant[data-v-cff38f4a]{background:var(--llm-badge-assistant-bg);color:var(--llm-badge-assistant-text)}.role-system[data-v-cff38f4a]{background:var(--llm-badge-system-bg);color:var(--llm-badge-system-text)}.role-developer[data-v-cff38f4a]{background:#e0e7ff;color:#4338ca}.role-tool[data-v-cff38f4a]{background:var(--llm-badge-tool-bg);color:var(--llm-badge-tool-text)}.role-model[data-v-cff38f4a]{background:var(--llm-badge-model-bg);color:var(--llm-badge-model-text)}.role-function[data-v-cff38f4a]{background:var(--llm-badge-tool-bg);color:var(--llm-badge-tool-text)}.message-item[data-v-e920ba37]{border-bottom:2px solid var(--llm-message-border, rgba(126, 180, 233, .31));padding:var(--llm-spacing-xs, 4px) var(--llm-spacing-md, 12px);margin:var(--llm-spacing-sm, 8px) 0}.message-item[data-v-e920ba37]:last-child{border-bottom:none}.role-system[data-v-e920ba37]{border-left:3px solid var(--llm-border-system, #8b5cf6)}.role-developer[data-v-e920ba37]{border-left:3px solid #6366f1}.role-user[data-v-e920ba37]{border-left:3px solid var(--llm-border-user, #3b82f6)}.role-assistant[data-v-e920ba37]{border-left:3px solid var(--llm-border-assistant, #10b981)}.role-tool[data-v-e920ba37]{border-left:3px solid var(--llm-border-tool, #f59e0b)}.role-model[data-v-e920ba37]{border-left:3px solid var(--llm-border-model, #ec4899)}.role-function[data-v-e920ba37]{border-left:3px solid var(--llm-border-function, #6b7280)}.header[data-v-e920ba37]{padding:6px 0;cursor:pointer;display:flex;justify-content:space-between;align-items:center}.header[data-v-e920ba37]:hover{background:color-mix(in srgb,var(--llm-subject-color, #929aa56a) 15%,#4ef19da0 10%);margin:0 -12px;padding:6px 12px;border-radius:var(--llm-radius-md, 6px)}.header-left[data-v-e920ba37]{display:flex;align-items:center;gap:var(--llm-spacing-md, 12px)}.toggle[data-v-e920ba37]{color:var(--llm-text-secondary, #64748b);font-size:1.2rem;transition:transform var(--llm-transition-fast, .2s)}.index[data-v-e920ba37]{font-size:1.2rem;color:var(--llm-text-muted, #94a3b8);font-weight:500}.count-badge[data-v-e920ba37]{display:inline-flex;align-items:center;justify-content:center;padding:0 3px;border:1px solid var(--llm-border-color, #cbd5e1);border-radius:6px;font-size:1.1rem;font-weight:500;color:var(--llm-text-muted, #94a3b8)}.raw-btn[data-v-e920ba37]{padding:4px 10px;font-size:1.1rem;color:var(--llm-text-secondary, #64748b);background:transparent;border:1px solid var(--llm-border-color, #cbd5e1);border-radius:var(--llm-radius-lg, 8px);cursor:pointer;transition:all var(--llm-transition-fast, .2s)}.raw-btn[data-v-e920ba37]:hover{color:var(--llm-text-primary, #334155);border-color:var(--llm-border-dark, #94a3b8)}.raw-btn.active[data-v-e920ba37]{color:var(--llm-btn-active-text, #2563eb);border-color:var(--llm-btn-active-border, #2563eb);background:var(--llm-btn-active-bg, rgba(37, 99, 235, .1))}.content[data-v-e920ba37]{padding:var(--llm-spacing-sm) var(--llm-spacing-md);background:var(--llm-bg-content, rgba(248, 250, 252, .5))}.sub-message-item[data-v-c7d01d1a]{padding:0;margin:0;border:none;background:transparent}.header[data-v-c7d01d1a]{padding:4px 0;cursor:pointer;display:flex;justify-content:space-between;align-items:center}.header[data-v-c7d01d1a]:hover{background:var(--llm-bg-hover, rgba(148, 163, 184, .08));margin:0 -8px;padding:4px 8px;border-radius:var(--llm-radius-sm, 4px)}.header-left[data-v-c7d01d1a],.header-right[data-v-c7d01d1a]{display:flex;align-items:center;gap:var(--llm-spacing-sm, 8px)}.toggle[data-v-c7d01d1a]{color:var(--llm-text-secondary, #64748b);font-size:1.1rem;transition:transform var(--llm-transition-fast, .2s)}.index[data-v-c7d01d1a]{font-size:1.2rem;color:var(--llm-text-secondary, #64748b);font-weight:500}.badge[data-v-c7d01d1a]{display:inline-flex;align-items:center;padding:3px 10px;border-radius:var(--llm-radius-sm, 4px);font-size:.9rem;font-weight:600;text-transform:uppercase;letter-spacing:.02em}.badge-text[data-v-c7d01d1a]{background:var(--llm-badge-text-bg, color-mix(in srgb, #10b981 25%, transparent));color:var(--llm-badge-text-text, #10b981)}.badge-image[data-v-c7d01d1a]{background:var(--llm-badge-image-bg, color-mix(in srgb, #3b82f6 25%, transparent));color:var(--llm-badge-image-text, #3b82f6)}.badge-tool[data-v-c7d01d1a]{background:var(--llm-badge-tool-bg, color-mix(in srgb, #8b5cf6 25%, transparent));color:var(--llm-badge-tool-text, #8b5cf6)}.badge-thinking[data-v-c7d01d1a]{background:var(--llm-badge-thinking-bg, color-mix(in srgb, #afafafac 35%, transparent));color:var(--llm-badge-thinking-text, #4b5563)}.badge-system[data-v-c7d01d1a]{background:var(--llm-badge-system-bg, color-mix(in srgb, #f59e0b 25%, transparent));color:var(--llm-badge-system-text, #f59e0b)}.content[data-v-c7d01d1a]{padding:var(--llm-spacing-sm, 8px) 0 var(--llm-spacing-sm, 8px) var(--llm-spacing-md, 12px);background:transparent}.image-block[data-v-f7ba3b8d]{margin:8px 0;border-radius:6px;overflow:hidden;background:#f8fafc}.image-image[data-v-f7ba3b8d]{max-width:100%;max-height:400px;display:block;border-radius:6px}.image-placeholder[data-v-f7ba3b8d],.image-error[data-v-f7ba3b8d]{padding:16px;text-align:center;color:#64748b;font-style:italic;border-radius:6px;border:2px dashed #e2e8f0}.image-error[data-v-f7ba3b8d]{color:#dc2626;border-color:#fecaca}.image-mime[data-v-f7ba3b8d]{display:block;font-size:1.2rem;font-family:Monaco,Menlo,monospace;margin-top:4px;color:#94a3b8}.tool-calls[data-v-c91d1315]{margin-top:2px;position:relative}.raw-button-wrapper[data-v-c91d1315]{display:flex;justify-content:flex-end;margin-top:-2px}.view-raw-btn[data-v-c91d1315]{padding:1px 2px;font-size:.9rem;color:#94a3b8;background:transparent;border:none;cursor:pointer;transition:all .2s;z-index:10}.view-raw-btn[data-v-c91d1315]:hover{color:#1d4ed8}.tool-requests[data-v-c91d1315]{display:flex;flex-direction:column;gap:8px}.tool-request[data-v-c91d1315]{background:#f8fafc;border-radius:6px;padding:2px}.tool-request-header[data-v-c91d1315]{display:flex;align-items:center;font-weight:600;font-size:1.4rem;color:#1e293b}.badge-call[data-v-c91d1315]{padding:2px 6px;border-radius:3px;font-size:1rem;font-weight:600;text-transform:uppercase;background:var(--llm-badge-tool-bg);color:var(--llm-badge-tool-text)}.tool-idx[data-v-c91d1315]{color:#64748b;font-size:1.2rem}.tool-fn[data-v-c91d1315]{margin-left:1rem}.tool-id[data-v-c91d1315]{margin-left:auto;font-size:1.1rem;color:#94a3b8;font-family:Monaco,Menlo,monospace}.clickable[data-v-c91d1315]{color:inherit;text-decoration:none;cursor:pointer;border-bottom:1px dotted transparent;transition:all .2s}.clickable[data-v-c91d1315]:hover{color:#1d4ed8;border-bottom-color:#1d4ed8}.message-content-flow[data-v-f30df913]{padding:var(--llm-spacing-xs) 0}.empty[data-v-f30df913]{color:var(--llm-text-muted);font-style:italic;padding:8px 0}.openai-request-view[data-v-5b1fd070]{padding:var(--llm-spacing-sm)}.header[data-v-5b1fd070]{margin-bottom:var(--llm-spacing-2xl);text-align:center}.header h2[data-v-5b1fd070]{margin:0 0 var(--llm-spacing-md) 0;font-size:2rem;font-weight:600;color:#1f2937;display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-sm)}.header-icon[data-v-5b1fd070]{width:32px;height:32px;vertical-align:middle}.meta[data-v-5b1fd070]{display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-md);font-size:14px;color:#6b7280}.meta code[data-v-5b1fd070]{background:#f3f4f6;padding:2px 6px;border-radius:var(--llm-radius-sm);font-size:13px;font-family:var(--llm-font-mono);color:#374151}.divider[data-v-5b1fd070]{color:#d1d5db}.empty-state[data-v-5b1fd070]{text-align:center;color:var(--llm-text-secondary);font-style:italic;padding:40px 20px}.token-usage[data-v-6f83fb0d]{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:8px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}.card[data-v-6f83fb0d]{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:10px;display:flex;flex-direction:column;justify-content:stretch}.header[data-v-6f83fb0d]{display:flex;flex-direction:column;align-items:flex-start;margin-bottom:4px}.label[data-v-6f83fb0d]{padding:0;font-size:1.2rem;color:#64748b;text-transform:uppercase;font-weight:900;letter-spacing:.05em;margin-bottom:2px}.value[data-v-6f83fb0d]{font-size:2.25rem;font-weight:700;color:#0f172a;line-height:1.2}.details[data-v-6f83fb0d]{display:flex;flex-direction:column;gap:4px;margin-top:4px;border-top:1px dashed #f1f5f9;padding-top:6px}.detail-item[data-v-6f83fb0d]{font-size:1.75rem;color:#475569;display:flex;align-items:center;gap:6px}.dot[data-v-6f83fb0d]{width:6px;height:6px;border-radius:50%;background-color:#94a3b8;flex-shrink:0}.card.input[data-v-6f83fb0d]{background:#f8fafc}.detail-item.cache-hit[data-v-6f83fb0d]{color:#166534;font-weight:500}.detail-item.cache-hit .dot[data-v-6f83fb0d]{background-color:#22c55e}.card.output[data-v-6f83fb0d]{background:#fffcf8;border-color:#fed7aa}.detail-item.reasoning[data-v-6f83fb0d]{color:#7c3aed;font-weight:500}.detail-item.reasoning .dot[data-v-6f83fb0d]{background-color:#8b5cf6}.card.total[data-v-6f83fb0d]{background:#eff6ff;border-color:#bfdbfe}.card.total .value[data-v-6f83fb0d]{color:#1d4ed8}.detail-item.cache-write[data-v-6f83fb0d]{color:#b45309}.detail-item.cache-write .dot[data-v-6f83fb0d]{background-color:#f59e0b}.dot.audio[data-v-6f83fb0d]{background-color:#0ea5e9}.dot.image[data-v-6f83fb0d]{background-color:#ec4899}.choice-item[data-v-a06d35e4]{border-radius:8px;margin-bottom:16px;overflow:hidden;border:1px solid #e2e8f0}.choice-header[data-v-a06d35e4]{background:#f8fafc;padding:8px 6px;cursor:pointer;display:flex;align-items:center;justify-content:space-between;border:none;width:100%;text-align:left}.choice-header[data-v-a06d35e4]:hover{background:#f1f5f9}.choice-meta[data-v-a06d35e4]{display:flex;gap:12px;align-items:center;flex-wrap:wrap}.choice-index[data-v-a06d35e4]{font-weight:600;color:#1e293b;font-size:1.4rem}.choice-badge[data-v-a06d35e4]{background:#10b981;color:#fff;padding:4px 8px;border-radius:4px;font-size:1.2000000000000002rem;font-weight:600}.finish-reason-badge[data-v-a06d35e4]{padding:2px 6px;border-radius:4px;font-size:1.1rem;font-weight:500;text-transform:lowercase}.toggle-icon[data-v-a06d35e4]{transition:transform .2s;color:#64748b;font-size:1.2000000000000002rem}.choice-content[data-v-a06d35e4]{padding:6px}.refusal[data-v-a06d35e4]{display:flex;align-items:center;gap:8px;padding:8px 12px;margin-bottom:12px;background:#fef2f2;border-radius:6px;border:1px solid #fecaca}.refusal-badge[data-v-a06d35e4]{padding:2px 6px;border-radius:3px;font-size:1rem;font-weight:600;text-transform:uppercase;background:#dc2626;color:#fff}.refusal-text[data-v-a06d35e4]{color:#991b1b;font-size:1.4rem}.reasoning[data-v-a06d35e4]{margin-bottom:12px;border-left:3px solid #8b5cf6;background:#f5f3ff;border-radius:0 6px 6px 0}.reasoning-label[data-v-a06d35e4]{padding:4px 12px;font-size:.85rem;font-weight:600;text-transform:uppercase;color:#7c3aed;background:#ede9fe;border-radius:0 4px 0 0;display:inline-block}.reasoning-content[data-v-a06d35e4]{padding:8px 12px;color:#5b21b6}.reasoning-content[data-v-a06d35e4] p{margin:0 0 8px}.reasoning-content[data-v-a06d35e4] p:last-child{margin-bottom:0}.choice-message[data-v-a06d35e4]{margin-bottom:12px}.tool-calls-container[data-v-a06d35e4]{margin-top:8px;display:flex;flex-direction:column;gap:8px}.openai-response-view[data-v-cd90a515]{padding:var(--llm-spacing-sm)}.header[data-v-cd90a515]{margin-bottom:var(--llm-spacing-2xl);text-align:center}.header h2[data-v-cd90a515]{margin:0 0 var(--llm-spacing-md) 0;font-size:20px;font-weight:600;color:#1f2937;display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-sm)}.header-icon[data-v-cd90a515]{width:28px;height:28px;vertical-align:middle}.meta[data-v-cd90a515]{display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-md);font-size:14px;color:#6b7280;flex-wrap:wrap}.meta code[data-v-cd90a515]{background:#f3f4f6;padding:2px 6px;border-radius:var(--llm-radius-sm);font-size:13px;font-family:var(--llm-font-mono);color:#374151}.divider[data-v-cd90a515]{color:#d1d5db}.empty-state[data-v-cd90a515]{text-align:center;color:var(--llm-text-secondary);font-style:italic;padding:40px 20px}.finish-summary[data-v-cd90a515]{padding:2px 8px;border-radius:var(--llm-radius-md);font-size:12px;font-weight:500}.finish-stop[data-v-cd90a515]{background:var(--llm-finish-stop-bg);color:var(--llm-finish-stop-text)}.finish-length[data-v-cd90a515]{background:var(--llm-finish-length-bg);color:var(--llm-finish-length-text)}.finish-tool-calls[data-v-cd90a515]{background:var(--llm-finish-tool-bg);color:var(--llm-finish-tool-text)}.finish-content-filter[data-v-cd90a515]{background:var(--llm-finish-filter-bg);color:var(--llm-finish-filter-text)}.input-item-body[data-v-8cd2d36b]{padding:var(--llm-spacing-xs) 0}.empty-state[data-v-8cd2d36b]{color:var(--llm-text-muted);font-style:italic;padding:4px 0}.call-header[data-v-8cd2d36b]{display:flex;align-items:center;gap:8px;margin-bottom:6px}.call-badge[data-v-8cd2d36b]{padding:2px 8px;border-radius:4px;font-size:1.05rem;font-weight:600;background:var(--llm-badge-tool-bg);color:var(--llm-badge-tool-text)}.call-badge.output[data-v-8cd2d36b]{background:#e2e8f0;color:#334155}.call-name[data-v-8cd2d36b]{font-size:1.2rem;color:#334155}.status-badge[data-v-8cd2d36b]{font-size:1.05rem;font-weight:600;color:#065f46;background:#d1fae5;padding:1px 6px;border-radius:4px}.call-link[data-v-8cd2d36b]{margin-left:auto;font-family:var(--llm-font-mono);font-size:1.05rem;color:#1d4ed8;text-decoration:none;cursor:pointer}.call-link[data-v-8cd2d36b]:hover{text-decoration:underline}.meta-note[data-v-8cd2d36b]{margin-top:8px;font-size:1.1rem;color:var(--llm-text-secondary)}.meta-note code[data-v-8cd2d36b]{font-family:var(--llm-font-mono);color:#334155}.openai-request-view[data-v-062dc21d]{padding:var(--llm-spacing-sm)}.header[data-v-062dc21d]{margin-bottom:var(--llm-spacing-2xl);text-align:center}.header h2[data-v-062dc21d]{margin:0 0 var(--llm-spacing-md) 0;font-size:2rem;font-weight:600;color:#1f2937;display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-sm)}.header-icon[data-v-062dc21d]{width:32px;height:32px;vertical-align:middle}.meta[data-v-062dc21d]{display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-md);font-size:14px;color:#6b7280;flex-wrap:wrap}.meta code[data-v-062dc21d]{background:#f3f4f6;padding:2px 6px;border-radius:var(--llm-radius-sm);font-size:13px;font-family:var(--llm-font-mono);color:#374151}.divider[data-v-062dc21d]{color:#d1d5db}.empty-state[data-v-062dc21d]{text-align:center;color:var(--llm-text-secondary);font-style:italic;padding:40px 20px}.other-fields-table[data-v-062dc21d]{width:100%;border-collapse:collapse}.other-fields-table th[data-v-062dc21d],.other-fields-table td[data-v-062dc21d]{border:1px solid #e2e8f0;padding:8px;text-align:left;vertical-align:top}.other-fields-table thead th[data-v-062dc21d]{background:#f8fafc;font-size:1.2rem;color:#334155}.other-fields-table tbody th[data-v-062dc21d]{width:180px;font-size:1.2rem;font-weight:600;color:#475569}.openai-responses-response-view[data-v-63ea447a]{padding:var(--llm-spacing-sm)}.header[data-v-63ea447a]{margin-bottom:var(--llm-spacing-2xl);text-align:center}.header h2[data-v-63ea447a]{margin:0 0 var(--llm-spacing-md) 0;font-size:2rem;font-weight:600;color:#1f2937;display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-sm)}.header-icon[data-v-63ea447a]{width:32px;height:32px;vertical-align:middle}.meta[data-v-63ea447a]{display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-md);font-size:14px;color:#6b7280;flex-wrap:wrap}.meta code[data-v-63ea447a]{background:#f3f4f6;padding:2px 6px;border-radius:var(--llm-radius-sm);font-size:13px;font-family:var(--llm-font-mono);color:#374151}.divider[data-v-63ea447a]{color:#d1d5db}.status-pill[data-v-63ea447a]{padding:2px 8px;border-radius:var(--llm-radius-md);font-size:12px;font-weight:600;background:#e2e8f0;color:#334155}.empty-state[data-v-63ea447a]{text-align:center;color:var(--llm-text-secondary);font-style:italic;padding:40px 20px}.info-group-title[data-v-63ea447a]{margin:14px 0 6px;font-size:1.15rem;font-weight:700;color:#475569;text-transform:uppercase;letter-spacing:.06em}.other-fields-table[data-v-63ea447a]{width:100%;border-collapse:collapse;margin-top:6px}.other-fields-table th[data-v-63ea447a],.other-fields-table td[data-v-63ea447a]{border:1px solid #e2e8f0;padding:8px;text-align:left;vertical-align:top}.other-fields-table thead th[data-v-63ea447a]{background:#f8fafc;font-size:1.2rem;color:#334155}.other-fields-table tbody th[data-v-63ea447a]{width:180px;font-size:1.2rem;font-weight:600;color:#475569}.block-wrapper[data-v-4068a120]{margin:var(--llm-spacing-md) 0}.block-image[data-v-4068a120]{margin:var(--llm-spacing-md) 0;max-width:400px}.empty[data-v-4068a120]{color:var(--llm-text-muted);font-style:italic;padding:8px 0}.reasoning-content[data-v-4068a120]{color:var(--llm-text-secondary);font-style:italic}.tool-name[data-v-4068a120]{font-weight:600;color:var(--llm-text-primary);font-family:var(--llm-font-mono)}.tool-id-ref[data-v-4068a120]{color:var(--llm-text-primary);font-family:var(--llm-font-mono);font-weight:600}.mini-image-placeholder[data-v-4068a120]{padding:4px 8px;background:var(--llm-bg-hover);border:1px dashed var(--llm-border-light);color:var(--llm-text-muted);border-radius:4px;display:inline-block;margin-top:4px}.system-message[data-v-41c2420a]{border-bottom:1px solid var(--llm-border-light);padding:var(--llm-spacing-xs) var(--llm-spacing-md)}.system-message[data-v-41c2420a]:last-child{border-bottom:none}.header[data-v-41c2420a]{padding:6px 0;cursor:pointer;display:flex;justify-content:space-between;align-items:center}.header[data-v-41c2420a]:hover{background:var(--llm-bg-hover);margin:0 -12px;padding:6px 12px;border-radius:var(--llm-radius-md)}.header-left[data-v-41c2420a]{display:flex;align-items:center;gap:var(--llm-spacing-md)}.toggle[data-v-41c2420a]{color:var(--llm-text-secondary);font-size:1.2rem;transition:transform var(--llm-transition-fast)}.index[data-v-41c2420a]{font-size:1.2rem;color:var(--llm-text-muted);font-weight:500}.cache-badge[data-v-41c2420a]{padding:2px 6px;border-radius:var(--llm-radius-sm);font-size:1rem;font-weight:600;text-transform:uppercase;background:var(--llm-info-bg);color:var(--llm-info-text)}.content[data-v-41c2420a]{padding:var(--llm-spacing-sm) var(--llm-spacing-xl);background:var(--llm-bg-content)}.claude-request-view[data-v-79ea931d]{padding:var(--llm-spacing-sm)}.header[data-v-79ea931d]{margin-bottom:var(--llm-spacing-2xl);text-align:center}.header h2[data-v-79ea931d]{margin:0 0 var(--llm-spacing-md) 0;font-size:2rem;font-weight:600;color:#1f2937;display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-sm)}.header-icon[data-v-79ea931d]{width:32px;height:32px}.meta[data-v-79ea931d]{display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-md);font-size:14px;color:#6b7280;flex-wrap:wrap}.meta code[data-v-79ea931d]{background:#f3f4f6;padding:2px 6px;border-radius:var(--llm-radius-sm);font-size:13px;font-family:var(--llm-font-mono);color:#374151}.divider[data-v-79ea931d]{color:#d1d5db}.empty-state[data-v-79ea931d]{text-align:center;color:var(--llm-text-secondary);font-style:italic;padding:40px 20px}.content-block[data-v-17a28202]{margin-bottom:12px;margin-left:8px;overflow:hidden}.content-block[data-v-17a28202]:last-child{margin-bottom:0}.block-header[data-v-17a28202]{display:flex;align-items:center;justify-content:space-between;cursor:pointer;transition:background-color .2s}.header-left[data-v-17a28202]{display:flex;max-width:100%;align-items:center}.block-index[data-v-17a28202]{font-size:1.3rem;color:#94a3b8;font-weight:500}.block-type-badge[data-v-17a28202]{font-size:1rem;font-weight:600;padding:2px 8px;border-radius:4px;text-transform:uppercase;letter-spacing:.05em}.block-name[data-v-17a28202]{font-family:var(--llm-font-mono);font-size:1.4rem;font-weight:600;color:var(--llm-badge-tool-use-text);background:var(--llm-badge-tool-use-bg);padding:4px 10px;border-radius:4px;flex-shrink:0}.type-unknown[data-v-17a28202]{border-left:3px solid #9ca3af}.badge-text[data-v-17a28202]{background:var(--llm-badge-assistant-bg);color:var(--llm-badge-assistant-text)}.badge-tool-use[data-v-17a28202]{background:var(--llm-badge-tool-bg);color:var(--llm-badge-tool-text)}.badge-thinking[data-v-17a28202]{background:var(--llm-badge-thinking-bg);color:var(--llm-badge-thinking-text)}.badge-unknown[data-v-17a28202]{background:#f3f4f6;color:#4b5563}.tool-summary[data-v-17a28202]{display:flex;align-items:center;gap:8px}.tool-id[data-v-17a28202]{font-family:Monaco,Menlo,monospace;font-size:1.1rem;color:#6b7280}.thinking-content[data-v-17a28202]{border-left:3px solid var(--llm-border-thinking);border-radius:0 6px 6px 0;padding:8px 12px;font-style:italic}.citations-section[data-v-17a28202]{margin-top:12px;padding-top:12px;border-top:1px dashed #e2e8f0}.citations-label[data-v-17a28202]{font-size:1.1rem;font-weight:600;color:#64748b;text-transform:uppercase;letter-spacing:.05em;margin-bottom:8px}.citation-item[data-v-17a28202]{display:flex;align-items:center;gap:8px;padding:4px 0;font-size:1.2rem}.citation-range[data-v-17a28202]{font-family:Monaco,Menlo,monospace;color:#2563eb;font-weight:500}.citation-type[data-v-17a28202]{color:#6b7280;text-transform:capitalize}.unknown-block[data-v-17a28202]{background:#f9fafb;border-radius:6px;padding:12px}.empty-state[data-v-17a28202]{text-align:center;color:var(--llm-text-secondary);font-style:italic;padding:40px 20px}.token-usage[data-v-0d6d91b7]{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:8px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}.card[data-v-0d6d91b7]{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:10px;display:flex;flex-direction:column;justify-content:stretch}.header[data-v-0d6d91b7]{display:flex;flex-direction:column;align-items:flex-start;margin-bottom:4px}.label[data-v-0d6d91b7]{padding:0;font-size:1.2rem;color:#64748b;text-transform:uppercase;font-weight:900;letter-spacing:.05em;margin-bottom:2px}.value[data-v-0d6d91b7]{font-size:2.25rem;font-weight:700;color:#0f172a;line-height:1.2}.details[data-v-0d6d91b7]{display:flex;flex-direction:column;gap:4px;margin-top:4px;border-top:1px dashed #f1f5f9;padding-top:6px}.detail-item[data-v-0d6d91b7]{font-size:1.75rem;color:#475569;display:flex;align-items:center;gap:6px}.dot[data-v-0d6d91b7]{width:6px;height:6px;border-radius:50%;background-color:#94a3b8;flex-shrink:0}.card.input[data-v-0d6d91b7]{background:#f8fafc}.detail-item.cache-hit[data-v-0d6d91b7]{color:#166534;font-weight:500}.detail-item.cache-hit .dot[data-v-0d6d91b7]{background-color:#22c55e}.detail-item.cache-write[data-v-0d6d91b7]{color:#b45309;font-weight:500}.detail-item.cache-write .dot[data-v-0d6d91b7]{background-color:#f59e0b}.card.output[data-v-0d6d91b7]{background:#fffcf8;border-color:#fed7aa}.card.total[data-v-0d6d91b7]{background:#eff6ff;border-color:#bfdbfe}.card.total .value[data-v-0d6d91b7]{color:#1d4ed8}.claude-response-view[data-v-ff5dfa37]{padding:var(--llm-spacing-sm)}.header[data-v-ff5dfa37]{margin-bottom:var(--llm-spacing-2xl);text-align:center}.header h2[data-v-ff5dfa37]{margin:0 0 var(--llm-spacing-md) 0;font-size:2rem;font-weight:600;color:#1f2937;display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-sm)}.header-icon[data-v-ff5dfa37]{width:32px;height:32px;vertical-align:middle}.meta[data-v-ff5dfa37]{display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-md);font-size:14px;color:#6b7280;flex-wrap:wrap}.meta code[data-v-ff5dfa37]{background:#f3f4f6;padding:2px 6px;border-radius:var(--llm-radius-sm);font-size:13px;font-family:var(--llm-font-mono);color:#374151}.divider[data-v-ff5dfa37]{color:#d1d5db}.stop-reason[data-v-ff5dfa37]{padding:2px 8px;border-radius:var(--llm-radius-md);font-size:12px;font-weight:500}.stop-end-turn[data-v-ff5dfa37]{background:var(--llm-finish-stop-bg);color:var(--llm-finish-stop-text)}.stop-max-tokens[data-v-ff5dfa37]{background:var(--llm-finish-length-bg);color:var(--llm-finish-length-text)}.stop-sequence[data-v-ff5dfa37]{background:var(--llm-finish-filter-bg);color:var(--llm-finish-filter-text)}.stop-tool-use[data-v-ff5dfa37]{background:var(--llm-finish-tool-bg);color:var(--llm-finish-tool-text)}.empty-state[data-v-ff5dfa37]{text-align:center;color:var(--llm-text-secondary);font-style:italic;padding:40px 20px}.error-content[data-v-ff5dfa37]{padding:12px;background:#fef2f2;border:1px solid #fecaca;border-radius:6px}.error-type[data-v-ff5dfa37]{font-family:var(--llm-font-mono);font-size:1.2rem;font-weight:600;color:#dc2626;text-transform:uppercase;margin-bottom:4px}.error-message[data-v-ff5dfa37]{font-size:1.4rem;color:#7f1d1d;line-height:1.5}.function-call[data-v-7bbef335]{position:relative}.call-content[data-v-7bbef335]{background:#f8fafc;border-radius:6px;padding:2px}.call-header[data-v-7bbef335]{display:flex;align-items:center;gap:8px;font-weight:600;font-size:1.4rem;color:#1e293b}.call-name[data-v-7bbef335]{font-family:Monaco,Menlo,Consolas,monospace;font-weight:600}.call-args[data-v-7bbef335]{margin:8px 0 0}.function-response[data-v-1fe87f38]{position:relative}.response-content[data-v-1fe87f38]{background:#f8fafc;border-radius:6px;padding:2px}.response-name[data-v-1fe87f38]{font-family:Monaco,Menlo,Consolas,monospace;font-weight:800}.response-data[data-v-1fe87f38]{margin:8px 0 0}.message-content-flow[data-v-84c0f87c]{padding:var(--llm-spacing-xs) 0}.empty-state[data-v-84c0f87c]{text-align:center;color:var(--llm-text-secondary);font-style:italic;padding:20px}.part[data-v-84c0f87c]{margin-bottom:var(--llm-spacing-md);padding:var(--llm-spacing-sm);border-radius:var(--llm-radius-md);background:var(--llm-bg-content)}.part[data-v-84c0f87c]:last-child{margin-bottom:0}.file-part[data-v-84c0f87c]{background:#f1f5f9}.file-info[data-v-84c0f87c]{display:flex;align-items:center;gap:var(--llm-spacing-sm);font-size:1.2rem}.file-icon[data-v-84c0f87c]{font-size:1.4rem}.file-uri[data-v-84c0f87c]{font-family:var(--llm-font-mono);color:var(--llm-text-primary)}.file-mime[data-v-84c0f87c]{color:var(--llm-text-muted)}.code-part[data-v-84c0f87c]{background:#1e1e1e;color:#d4d4d4}.code-header[data-v-84c0f87c]{display:flex;align-items:center;gap:var(--llm-spacing-sm);margin-bottom:var(--llm-spacing-xs);padding-bottom:var(--llm-spacing-xs);border-bottom:1px solid #333}.code-icon[data-v-84c0f87c]{font-size:1.2rem}.code-lang[data-v-84c0f87c]{color:#9cdcfe;font-weight:600;text-transform:uppercase;font-size:1.1rem}.code-content[data-v-84c0f87c]{margin:0;font-family:var(--llm-font-mono);font-size:1.1rem;line-height:1.5;overflow-x:auto;white-space:pre-wrap;word-wrap:break-word}.result-part[data-v-84c0f87c]{background:#f0fdf4;border-left:3px solid #22c55e}.result-header[data-v-84c0f87c]{display:flex;align-items:center;gap:var(--llm-spacing-sm);margin-bottom:var(--llm-spacing-xs)}.result-icon[data-v-84c0f87c]{font-size:1.2rem}.result-outcome[data-v-84c0f87c]{font-weight:600;text-transform:uppercase;font-size:1.1rem}.outcome-success[data-v-84c0f87c]{color:#16a34a}.outcome-failure[data-v-84c0f87c],.outcome-error[data-v-84c0f87c]{color:#dc2626}.result-output[data-v-84c0f87c]{margin:0;padding:var(--llm-spacing-sm);background:#ffffffb3;border-radius:var(--llm-radius-sm);font-family:var(--llm-font-mono);font-size:1.1rem;overflow-x:auto;white-space:pre-wrap;word-wrap:break-word}.unknown-part[data-v-84c0f87c]{background:#fef2f2;border-left:3px solid #ef4444}.unknown-part pre[data-v-84c0f87c]{margin:0;font-family:var(--llm-font-mono);font-size:1.1rem;overflow-x:auto}.gemini-request-view[data-v-e3739da4]{padding:var(--llm-spacing-sm)}.header[data-v-e3739da4]{margin-bottom:var(--llm-spacing-2xl);text-align:center}.header h2[data-v-e3739da4]{margin:0 0 var(--llm-spacing-md) 0;font-size:2rem;font-weight:600;color:#1f2937;display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-sm)}.header-icon[data-v-e3739da4]{width:32px;height:32px;vertical-align:middle}.meta[data-v-e3739da4]{display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-md);font-size:14px;color:#6b7280;flex-wrap:wrap}.meta code[data-v-e3739da4]{background:#f3f4f6;padding:2px 6px;border-radius:var(--llm-radius-sm);font-size:13px;font-family:var(--llm-font-mono);color:#374151}.divider[data-v-e3739da4]{color:#d1d5db}.empty-state[data-v-e3739da4]{text-align:center;color:var(--llm-text-secondary);font-style:italic;padding:40px 20px}.safety-settings-list[data-v-e3739da4]{display:flex;flex-direction:column;gap:8px}.safety-setting-item[data-v-e3739da4]{display:flex;align-items:center;gap:8px;padding:8px 12px;background:#f8fafc;border-radius:6px;font-size:.95rem}.setting-category[data-v-e3739da4]{font-weight:500;color:#374151}.setting-arrow[data-v-e3739da4]{color:#9ca3af}.setting-threshold[data-v-e3739da4]{color:#059669;font-weight:500;background:#d1fae5;padding:2px 8px;border-radius:4px}.token-usage[data-v-c84da9b7]{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:8px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}.card[data-v-c84da9b7]{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:10px;display:flex;flex-direction:column;justify-content:stretch}.header[data-v-c84da9b7]{display:flex;flex-direction:column;align-items:flex-start;margin-bottom:4px}.label[data-v-c84da9b7]{padding:0;font-size:1.2rem;color:#64748b;text-transform:uppercase;font-weight:900;letter-spacing:.05em;margin-bottom:2px}.value[data-v-c84da9b7]{font-size:2.25rem;font-weight:700;color:#0f172a;line-height:1.2}.details[data-v-c84da9b7]{display:flex;flex-direction:column;gap:4px;margin-top:4px;border-top:1px dashed #f1f5f9;padding-top:6px}.detail-item[data-v-c84da9b7]{font-size:1.75rem;color:#475569;display:flex;align-items:center;gap:6px}.dot[data-v-c84da9b7]{width:6px;height:6px;border-radius:50%;background-color:#94a3b8;flex-shrink:0}.card.input[data-v-c84da9b7]{background:#f8fafc}.detail-item.cache-hit[data-v-c84da9b7]{color:#166534;font-weight:500}.detail-item.cache-hit .dot[data-v-c84da9b7]{background-color:#22c55e}.card.output[data-v-c84da9b7]{background:#fffcf8;border-color:#fed7aa}.detail-item.reasoning[data-v-c84da9b7]{color:#7c3aed;font-weight:500}.detail-item.reasoning .dot[data-v-c84da9b7]{background-color:#8b5cf6}.card.total[data-v-c84da9b7]{background:#eff6ff;border-color:#bfdbfe}.card.total .value[data-v-c84da9b7]{color:#1d4ed8}.content-block[data-v-917c489e]{margin-bottom:12px;margin-left:8px}.content-block[data-v-917c489e]:last-child{margin-bottom:0}.block-header[data-v-917c489e]{display:flex;align-items:center;justify-content:space-between;padding-bottom:4px}.header-left[data-v-917c489e]{display:flex;max-width:100%;align-items:center;gap:8px}.block-index[data-v-917c489e]{font-size:1.3rem;color:#94a3b8;font-weight:500}.block-type-badge[data-v-917c489e]{font-size:1rem;font-weight:600;padding:2px 8px;border-radius:4px;text-transform:uppercase;letter-spacing:.05em}.block-name[data-v-917c489e]{font-family:var(--llm-font-mono, monospace);font-size:1.4rem;font-weight:600;color:var(--llm-badge-tool-use-text, #b45309);background:var(--llm-badge-tool-use-bg, #fffbeb);padding:4px 10px;border-radius:4px;flex-shrink:0}.name-response[data-v-917c489e]{color:#0891b2;background:#cffafe}.badge-text[data-v-917c489e]{background:var(--llm-badge-assistant-bg, #dbeafe);color:var(--llm-badge-assistant-text, #1e40af)}.badge-tool-use[data-v-917c489e]{background:var(--llm-badge-tool-bg, #e0e7ff);color:var(--llm-badge-tool-text, #3730a3)}.badge-media[data-v-917c489e]{background:#d1fae5;color:#065f46}.badge-file[data-v-917c489e]{background:#fef3c7;color:#92400e}.badge-response[data-v-917c489e]{background:#cffafe;color:#155e75}.badge-code[data-v-917c489e]{background:#e2e8f0;color:#1e293b}.badge-result[data-v-917c489e]{background:#dcfce7;color:#166534}.badge-unknown[data-v-917c489e]{background:#f3f4f6;color:#4b5563}.type-unknown[data-v-917c489e]{border-left:3px solid #9ca3af;padding-left:8px}.block-content[data-v-917c489e]{padding-top:4px}.meta-label[data-v-917c489e]{font-size:.8rem;color:#64748b;margin-bottom:4px;font-family:var(--llm-font-mono, monospace)}.file-info[data-v-917c489e]{display:flex;align-items:center;gap:8px;padding:8px;background:#f8fafc;border-radius:4px;border:1px solid #e2e8f0}.file-uri[data-v-917c489e]{font-family:var(--llm-font-mono, monospace);font-size:.9rem;color:#334155}.sub-header[data-v-917c489e]{font-family:var(--llm-font-mono, monospace);font-weight:600;margin-bottom:6px;font-size:.85rem;text-transform:uppercase}.text-blue[data-v-917c489e]{color:#3b82f6}.code-block[data-v-917c489e]{margin:0;padding:10px;border-radius:6px;font-family:var(--llm-font-mono, monospace);font-size:.85rem;white-space:pre-wrap;overflow-x:auto}.bg-light[data-v-917c489e]{background:#f8fafc;border:1px solid #e2e8f0;color:#334155}.bg-dark[data-v-917c489e]{background:#1e293b;color:#e2e8f0}.unknown-block[data-v-917c489e]{background:#f9fafb;border-radius:6px;padding:12px}.result-header[data-v-917c489e]{margin-bottom:8px}.outcome-badge[data-v-917c489e]{text-transform:uppercase;font-size:.75rem;font-weight:700;padding:2px 6px;border-radius:3px}.outcome-badge.ok[data-v-917c489e],.outcome-badge.success[data-v-917c489e]{background:#dcfce7;color:#166534}.outcome-badge.error[data-v-917c489e],.outcome-badge.dead[data-v-917c489e]{background:#fee2e2;color:#991b1b}.candidate[data-v-93faa5c5]{background:#fff;border:1px solid #e2e8f0;border-radius:8px;margin-bottom:12px;overflow:hidden}.candidate-header[data-v-93faa5c5]{padding:12px 16px;cursor:pointer;display:flex;justify-content:space-between;align-items:center;background:#f8fafc;transition:background-color .2s}.candidate-header[data-v-93faa5c5]:hover{background:#f1f5f9}.header-left[data-v-93faa5c5]{display:flex;align-items:center;gap:10px}.toggle[data-v-93faa5c5]{color:#64748b;font-size:.9rem}.index[data-v-93faa5c5]{font-weight:600;color:#374151;font-size:1.5rem}.finish-reason[data-v-93faa5c5]{padding:2px 8px;border-radius:4px;font-size:1.5rem;font-weight:500;text-transform:uppercase}.finish-stop[data-v-93faa5c5]{background:#dcfce7;color:#166534}.finish-length[data-v-93faa5c5]{background:#fef3c7;color:#92400e}.finish-safety[data-v-93faa5c5]{background:#fee2e2;color:#991b1b}.finish-recitation[data-v-93faa5c5]{background:#e0e7ff;color:#3730a3}.finish-other[data-v-93faa5c5]{background:#f3f4f6;color:#4b5563}.header-right[data-v-93faa5c5]{display:flex;align-items:center;gap:12px}.citation-count[data-v-93faa5c5],.token-count[data-v-93faa5c5]{font-size:.85rem;color:#64748b;background:#e2e8f0;padding:2px 8px;border-radius:4px}.candidate-content[data-v-93faa5c5]{padding:6px;border-top:1px solid #e2e8f0}.section-title[data-v-93faa5c5]{font-size:.9rem;font-weight:600;color:#1e293b;margin-bottom:12px;text-transform:uppercase;letter-spacing:.05em}.parts-section[data-v-93faa5c5]{margin-bottom:20px}.grounding-section[data-v-93faa5c5]{margin-top:20px;padding-top:20px;border-top:1px solid #e2e8f0}.grounding-chunks[data-v-93faa5c5]{display:flex;flex-direction:column;gap:8px}.grounding-chunk[data-v-93faa5c5]{display:flex;align-items:center;gap:8px;padding:8px 12px;background:#f0f9ff;border:1px solid #bae6fd;border-radius:6px}.chunk-link[data-v-93faa5c5]{color:#0284c7;text-decoration:none;font-weight:500}.chunk-link[data-v-93faa5c5]:hover{text-decoration:underline}.chunk-context[data-v-93faa5c5]{color:#64748b}.safety-section[data-v-93faa5c5]{margin-top:20px;padding-top:20px;border-top:1px solid #e2e8f0}.safety-list[data-v-93faa5c5]{display:flex;flex-direction:column;gap:8px}.safety-item[data-v-93faa5c5]{display:flex;align-items:center;gap:12px;padding:10px 12px;background:#f8fafc;border-radius:6px}.safety-item.is-blocked[data-v-93faa5c5]{background:#fef2f2;border:1px solid #fecaca}.safety-category[data-v-93faa5c5]{font-weight:500;color:#374151;flex:1}.safety-probability[data-v-93faa5c5]{padding:2px 8px;border-radius:4px;font-size:.85rem;font-weight:500;text-transform:uppercase}.prob-negligible[data-v-93faa5c5]{background:#dcfce7;color:#166534}.prob-low[data-v-93faa5c5]{background:#dbeafe;color:#1e40af}.prob-medium[data-v-93faa5c5]{background:#fef3c7;color:#92400e}.prob-high[data-v-93faa5c5]{background:#fee2e2;color:#991b1b}.blocked-badge[data-v-93faa5c5]{background:#ef4444;color:#fff;padding:2px 8px;border-radius:4px;font-size:.75rem;font-weight:600}.gemini-response-view[data-v-e869ebc9]{padding:var(--llm-spacing-sm)}.header[data-v-e869ebc9]{margin-bottom:var(--llm-spacing-2xl);text-align:center}.header h2[data-v-e869ebc9]{margin:0 0 var(--llm-spacing-md) 0;font-size:2rem;font-weight:600;color:#1f2937;display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-sm)}.header-icon[data-v-e869ebc9]{width:32px;height:32px;vertical-align:middle}.meta[data-v-e869ebc9]{display:flex;align-items:center;justify-content:center;gap:var(--llm-spacing-md);font-size:14px;color:#6b7280;flex-wrap:wrap}.meta code[data-v-e869ebc9]{background:#f3f4f6;padding:2px 6px;border-radius:var(--llm-radius-sm);font-size:13px;font-family:var(--llm-font-mono);color:#374151}.divider[data-v-e869ebc9]{color:#d1d5db}.empty-state[data-v-e869ebc9]{text-align:center;color:var(--llm-text-secondary);font-style:italic;padding:40px 20px}.finish-summary[data-v-e869ebc9]{padding:2px 8px;border-radius:var(--llm-radius-md);font-size:12px;font-weight:500}.finish-stop[data-v-e869ebc9]{background:var(--llm-finish-stop-bg);color:var(--llm-finish-stop-text)}.finish-length[data-v-e869ebc9]{background:var(--llm-finish-length-bg);color:var(--llm-finish-length-text)}.finish-safety[data-v-e869ebc9]{background:var(--llm-finish-filter-bg);color:var(--llm-finish-filter-text)}.finish-recitation[data-v-e869ebc9]{background:#e0e7ff;color:#3730a3}.finish-other[data-v-e869ebc9]{background:#f3f4f6;color:#4b5563}.safety-warning[data-v-e869ebc9]{padding:12px;background:#fef2f2;border:1px solid #fecaca;border-radius:6px}.warning-title[data-v-e869ebc9]{font-weight:600;color:#dc2626;margin-bottom:8px}.warning-text[data-v-e869ebc9]{color:#7f1d1d;font-size:14px;line-height:1.5}.safety-list[data-v-e869ebc9]{margin-top:12px;display:flex;flex-direction:column;gap:8px}.safety-item[data-v-e869ebc9]{display:flex;align-items:center;gap:12px;padding:10px 12px;background:#f8fafc;border-radius:6px}.safety-item.is-blocked[data-v-e869ebc9]{background:#fef2f2;border:1px solid #fecaca}.safety-category[data-v-e869ebc9]{font-weight:500;color:#374151;flex:1}.safety-probability[data-v-e869ebc9]{padding:2px 8px;border-radius:4px;font-size:.85rem;font-weight:500;text-transform:uppercase}.prob-negligible[data-v-e869ebc9]{background:#dcfce7;color:#166534}.prob-low[data-v-e869ebc9]{background:#dbeafe;color:#1e40af}.prob-medium[data-v-e869ebc9]{background:#fef3c7;color:#92400e}.prob-high[data-v-e869ebc9]{background:#fee2e2;color:#991b1b}.blocked-badge[data-v-e869ebc9]{background:#ef4444;color:#fff;padding:2px 8px;border-radius:4px;font-size:.75rem;font-weight:600} '); }) }; })); System.register("./OpenaiRequestView-D-ZioDy1-B9LDHfkP.js", ['vue', './BetterDetails-BDkik7Go-BoTQ2MR3.js', './SubMessageItem-CDY-oINa-C9F6H7x7.js', './ImageBlock-DPbM__Ea-CdY7PxBB.js', './OpenaiAssistantToolCalls-ASy2xv7a-D4h2FAmn.js', './main-CBTFarNI-HX0H7eVT.js', './openai-d0N2HAk8-DfEE7-Ya.js'], (function (exports, module) { 'use strict'; var defineComponent, openBlock, createBlock, computed, createElementBlock, createElementVNode, unref, createTextVNode, toDisplayString, createCommentVNode, createVNode, withCtx, Fragment, renderList, CollapsibleSection, LabelValueRow, BetterDetails, SmartViewer, hashId, ToolItem, MessageItem, SubMessageItem, ImageBlock, OpenaiAssistantToolCalls, _export_sfc, OpenaiIcon; return { setters: [module => { defineComponent = module.defineComponent; openBlock = module.openBlock; createBlock = module.createBlock; computed = module.computed; createElementBlock = module.createElementBlock; createElementVNode = module.createElementVNode; unref = module.unref; createTextVNode = module.createTextVNode; toDisplayString = module.toDisplayString; createCommentVNode = module.createCommentVNode; createVNode = module.createVNode; withCtx = module.withCtx; Fragment = module.Fragment; renderList = module.renderList; }, module => { CollapsibleSection = module.C; LabelValueRow = module.L; BetterDetails = module.B; SmartViewer = module.S; hashId = module.h; }, module => { ToolItem = module.T; MessageItem = module.M; SubMessageItem = module.S; }, module => { ImageBlock = module.I; }, module => { OpenaiAssistantToolCalls = module.O; }, module => { _export_sfc = module._; }, module => { OpenaiIcon = module.O; }], execute: (function () { const _hoisted_1$1 = { class: "message-content-flow" }; const _hoisted_2$1 = { key: 1, class: "empty", hidden: "" }; const _sfc_main$2 = defineComponent({ __name: "OpenaiMessageItem", props: { id: {}, role: {}, index: {}, message: {} }, setup(__props) { const props = __props; const msgHashId = computed(() => { const content = props.message.content; if (typeof content === "string") { return hashId(`${props.index}-${props.role}-${content.length}`); } if (Array.isArray(content)) { return hashId(`${props.index}-${props.role}-parts-${content.length}`); } return hashId(`${props.index}-${props.role}-empty`); }); const contentItems = computed(() => { const content = props.message.content; if (!content) return []; if (typeof content === "string") { return [{ type: "text", text: content, id: "content-0" }]; } if (Array.isArray(content)) { return content.map((item, idx) => { if (item.type === "text") { return { type: "text", text: item.text, id: `content-${idx}` }; } else if (item.type === "image_url") { return { type: "image", url: item.image_url.url, id: `content-${idx}` }; } return { type: "unknown", id: `content-${idx}` }; }); } return []; }); const hasMultipleContent = computed(() => contentItems.value.length > 1); const toolRequests = computed(() => { if (props.message.role !== "assistant") return []; return props.message.tool_calls || []; }); const hasContent = computed(() => contentItems.value.length > 0); return (_ctx, _cache) => { return openBlock(), createBlock(MessageItem, { count: contentItems.value.length + toolRequests.value.length, "data-for-raw": __props.message, id: __props.id, index: String(__props.index), role: __props.role, "storage-prefix": "openai-msg" }, { default: withCtx(() => [ createElementVNode("div", _hoisted_1$1, [ hasContent.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ !hasMultipleContent.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(contentItems.value, (item) => { return openBlock(), createElementBlock(Fragment, { key: item.id }, [ item.type === "text" && item.text ? (openBlock(), createBlock(SmartViewer, { key: 0, text: item.text }, null, 8, ["text"])) : item.type === "image" && item.url ? (openBlock(), createBlock(ImageBlock, { key: 1, url: item.url }, null, 8, ["url"])) : createCommentVNode("", true) ], 64); }), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(contentItems.value, (item, subIndex) => { return openBlock(), createBlock(SubMessageItem, { key: item.id, "badge-type": item.type === "image" ? "image" : "text", "badge-text": item.type === "image" ? "IMAGE" : "TEXT", id: `${msgHashId.value}-${item.id}`, index: `${__props.index}-${subIndex + 1}`, "storage-prefix": "openai-sub" }, { default: withCtx(() => [ item.type === "text" && item.text ? (openBlock(), createBlock(SmartViewer, { key: 0, text: item.text }, null, 8, ["text"])) : item.type === "image" && item.url ? (openBlock(), createBlock(ImageBlock, { key: 1, url: item.url }, null, 8, ["url"])) : createCommentVNode("", true) ]), _: 2 }, 1032, ["badge-type", "badge-text", "id", "index"]); }), 128)) ], 64)) : (openBlock(), createElementBlock("div", _hoisted_2$1)), toolRequests.value.length ? (openBlock(), createBlock(OpenaiAssistantToolCalls, { key: 2, "tool-calls": toolRequests.value }, null, 8, ["tool-calls"])) : createCommentVNode("", true) ]) ]), _: 1 }, 8, ["count", "data-for-raw", "id", "index", "role"]); }; } }); const OpenaiMessageItem = _export_sfc(_sfc_main$2, [["__scopeId", "data-v-f30df913"]]); const _hoisted_1 = { class: "openai-request-view" }; const _hoisted_2 = { class: "header" }; const _hoisted_3 = ["src"]; const _hoisted_4 = { class: "meta" }; const _hoisted_5 = { key: 0, class: "divider" }; const _hoisted_6 = { key: 1 }; const _hoisted_7 = { key: 0, class: "empty-state" }; const _sfc_main$1 = defineComponent({ __name: "OpenaiChatRequestView", props: { data: {} }, setup(__props) { const props = __props; const messages = computed(() => props.data.messages || []); const tools = computed(() => props.data.tools || []); const toolChoice = computed(() => { const tc = props.data.tool_choice; if (!tc) return "none"; if (typeof tc === "string") return tc; if (tc.type === "function") return `function: ${tc.function.name}`; return "unknown"; }); const responseFormat = computed(() => { const rf = props.data.response_format; if (!rf) return "none"; if (typeof rf === "string") return rf; if (rf.type === "json_schema") return `json_schema: ${rf.json_schema.name}`; return rf.type; }); const stopValue = computed(() => { if (Array.isArray(props.data.stop)) { return props.data.stop.join(", "); } return props.data.stop; }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ createElementVNode("h2", null, [ createElementVNode("img", { src: unref(OpenaiIcon), class: "header-icon", alt: "OpenAI" }, null, 8, _hoisted_3), _cache[0] || (_cache[0] = createTextVNode(" OpenAI Chat Completions API Request", -1)) ]), createElementVNode("div", _hoisted_4, [ createElementVNode("span", null, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "llm-label" }, "model", -1)), createElementVNode("code", null, toDisplayString(__props.data.model), 1) ]), _cache[2] || (_cache[2] = createElementVNode("span", { class: "divider" }, "·", -1)), createElementVNode("span", null, toDisplayString(messages.value.length) + " messages", 1), tools.value.length > 0 ? (openBlock(), createElementBlock("span", _hoisted_5, "·")) : createCommentVNode("", true), tools.value.length > 0 ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(tools.value.length) + " tools", 1)) : createCommentVNode("", true), _cache[3] || (_cache[3] = createElementVNode("span", { class: "divider" }, "·", -1)), createElementVNode("span", null, "stream: " + toDisplayString(__props.data.stream ? "true" : "false"), 1) ]) ]), createVNode(CollapsibleSection, { title: "Parameters", "default-open": true, "storage-key": "parameters" }, { default: withCtx(() => [ createVNode(LabelValueRow, { label: "Temperature", value: __props.data.temperature }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Top P", value: __props.data.top_p }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Max Tokens", value: __props.data.max_tokens }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Tool Choice", value: toolChoice.value }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Response Format", value: responseFormat.value }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Seed", value: __props.data.seed }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Stop", value: stopValue.value }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Frequency Penalty", value: __props.data.frequency_penalty }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Presence Penalty", value: __props.data.presence_penalty }, null, 8, ["value"]) ]), _: 1 }), createVNode(CollapsibleSection, { title: "Messages", count: messages.value.length, "default-open": true, "storage-key": "messages", "enable-bulk-actions": "", variant: "default" }, { default: withCtx(() => [ messages.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_7, " No messages ")) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(messages.value, (message, index) => { return openBlock(), createBlock(OpenaiMessageItem, { key: index, role: message.role, index: index + 1, message }, null, 8, ["role", "index", "message"]); }), 128)) ]), _: 1 }, 8, ["count"]), tools.value.length > 0 ? (openBlock(), createBlock(CollapsibleSection, { key: 0, title: "Tools", "storage-key": "tools", count: tools.value.length, variant: "tools", "enable-bulk-actions": "" }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(tools.value, (tool, index) => { return openBlock(), createBlock(ToolItem, { key: index, name: tool.function.name, description: tool.function.description, params: tool.function.parameters, index, standard: "openai" }, null, 8, ["name", "description", "params", "index"]); }), 128)) ]), _: 1 }, 8, ["count"])) : createCommentVNode("", true), createVNode(BetterDetails, { title: "Full Request" }, { default: withCtx(() => [ createVNode(SmartViewer, { text: JSON.stringify(__props.data, null, 2) }, null, 8, ["text"]) ]), _: 1 }) ]); }; } }); const OpenaiChatRequestView = _export_sfc(_sfc_main$1, [["__scopeId", "data-v-5b1fd070"]]); const _sfc_main = exports("default", defineComponent({ __name: "OpenaiRequestView", props: { data: {} }, setup(__props) { return (_ctx, _cache) => { return openBlock(), createBlock(OpenaiChatRequestView, { data: __props.data }, null, 8, ["data"]); }; } })); }) }; })); System.register("./OpenaiResponseView-C5XZPN_T-ZKX67r0N.js", ['vue', './BetterDetails-BDkik7Go-BoTQ2MR3.js', './OpenaiTokenUsage-BDr-HLbW-CjGmC_HL.js', './OpenaiAssistantToolCalls-ASy2xv7a-D4h2FAmn.js', './main-CBTFarNI-HX0H7eVT.js', './openai-d0N2HAk8-DfEE7-Ya.js'], (function (exports, module) { 'use strict'; var defineComponent, computed, openBlock, createElementBlock, createElementVNode, unref, createTextVNode, toDisplayString, createCommentVNode, normalizeClass, createVNode, withCtx, createBlock, Fragment, renderList, ref, CollapsibleSection, LabelValueRow, BetterDetails, SmartViewer, OpenaiTokenUsage, OpenaiAssistantToolCalls, _export_sfc, OpenaiIcon; return { setters: [module => { defineComponent = module.defineComponent; computed = module.computed; openBlock = module.openBlock; createElementBlock = module.createElementBlock; createElementVNode = module.createElementVNode; unref = module.unref; createTextVNode = module.createTextVNode; toDisplayString = module.toDisplayString; createCommentVNode = module.createCommentVNode; normalizeClass = module.normalizeClass; createVNode = module.createVNode; withCtx = module.withCtx; createBlock = module.createBlock; Fragment = module.Fragment; renderList = module.renderList; ref = module.ref; }, module => { CollapsibleSection = module.C; LabelValueRow = module.L; BetterDetails = module.B; SmartViewer = module.S; }, module => { OpenaiTokenUsage = module.O; }, module => { OpenaiAssistantToolCalls = module.O; }, module => { _export_sfc = module._; }, module => { OpenaiIcon = module.O; }], execute: (function () { const _hoisted_1$1 = { class: "choice-meta" }; const _hoisted_2$1 = { class: "choice-index" }; const _hoisted_3$1 = { key: 0, class: "choice-badge" }; const _hoisted_4$1 = { class: "toggle-icon" }; const _hoisted_5$1 = { key: 1, class: "choice-content" }; const _hoisted_6$1 = { key: 0, class: "refusal" }; const _hoisted_7$1 = { class: "refusal-text" }; const _hoisted_8 = { key: 1, class: "" }; const _hoisted_9 = { class: "reasoning" }; const _hoisted_10 = { key: 2, class: "choice-message" }; const _sfc_main$1 = defineComponent({ __name: "OpenaiChoice", props: { choice: {}, isStream: { type: Boolean, default: false }, finishReasonClass: { type: Function, default: () => "" }, showHeader: { type: Boolean, default: true } }, setup(__props) { const props = __props; const isOpen = ref(true); const toggleIcon = computed(() => isOpen.value ? "▼" : "▶"); const isStreamingChoice = computed(() => { return "delta" in props.choice; }); const toolCalls = computed(() => { if (isStreamingChoice.value) { return props.choice.message?.tool_calls || []; } return props.choice.message?.tool_calls || []; }); const content = computed(() => { if (isStreamingChoice.value) { return props.choice.message?.content || ""; } return props.choice.message?.content || ""; }); const reasoning = computed(() => { if (isStreamingChoice.value) { return props.choice.message?.reasoning || ""; } return props.choice.message?.reasoning || ""; }); const refusal = computed(() => { if (isStreamingChoice.value) return null; return props.choice.message?.refusal || null; }); const finishReason = computed(() => { return props.choice.finish_reason; }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass(["choice-item", { "no-header": !__props.showHeader }]) }, [ __props.showHeader ? (openBlock(), createElementBlock("div", { key: 0, class: "choice-header", onClick: _cache[0] || (_cache[0] = ($event) => isOpen.value = !isOpen.value) }, [ createElementVNode("div", _hoisted_1$1, [ createElementVNode("span", _hoisted_2$1, "#" + toDisplayString(__props.choice.index + 1), 1), __props.isStream ? (openBlock(), createElementBlock("span", _hoisted_3$1, "streaming")) : createCommentVNode("", true), finishReason.value ? (openBlock(), createElementBlock("span", { key: 1, class: normalizeClass(["finish-reason-badge", __props.finishReasonClass(finishReason.value)]) }, toDisplayString(finishReason.value), 3)) : createCommentVNode("", true) ]), createElementVNode("span", _hoisted_4$1, toDisplayString(toggleIcon.value), 1) ])) : createCommentVNode("", true), isOpen.value ? (openBlock(), createElementBlock("div", _hoisted_5$1, [ refusal.value ? (openBlock(), createElementBlock("div", _hoisted_6$1, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "refusal-badge" }, "refusal", -1)), createElementVNode("span", _hoisted_7$1, toDisplayString(refusal.value), 1) ])) : createCommentVNode("", true), reasoning.value ? (openBlock(), createElementBlock("div", _hoisted_8, [ createVNode(BetterDetails, { title: "reasoning" }, { default: withCtx(() => [ createElementVNode("div", _hoisted_9, [ createVNode(SmartViewer, { text: reasoning.value }, null, 8, ["text"]) ]) ]), _: 1 }) ])) : createCommentVNode("", true), content.value ? (openBlock(), createElementBlock("div", _hoisted_10, [ createVNode(SmartViewer, { text: content.value }, null, 8, ["text"]) ])) : createCommentVNode("", true), toolCalls.value.length > 0 ? (openBlock(), createBlock(OpenaiAssistantToolCalls, { key: 3, "tool-calls": toolCalls.value, variant: "compact" }, null, 8, ["tool-calls"])) : createCommentVNode("", true) ])) : createCommentVNode("", true) ], 2); }; } }); const OpenaiChoice = _export_sfc(_sfc_main$1, [["__scopeId", "data-v-a06d35e4"]]); const _hoisted_1 = { class: "openai-response-view" }; const _hoisted_2 = { class: "header" }; const _hoisted_3 = ["src"]; const _hoisted_4 = { class: "meta" }; const _hoisted_5 = { key: 0, class: "divider" }; const _hoisted_6 = { key: 1 }; const _hoisted_7 = { key: 0, class: "empty-state" }; const _sfc_main = defineComponent({ __name: "OpenaiResponseView", props: { data: {} }, setup(__props) { const props = __props; const choices = computed(() => { return props.data.choices || []; }); const totalTokens = computed(() => { return props.data.usage?.total_tokens || 0; }); const finishReasonClass = (reason) => { if (!reason) return ""; const r = reason.toLowerCase(); if (r === "stop") return "finish-stop"; if (r === "length") return "finish-length"; if (r === "tool_calls") return "finish-tool-calls"; if (r === "content_filter") return "finish-content-filter"; return ""; }; const getFinishReasonSummary = () => { const reasons = choices.value.map((c) => c.finish_reason).filter((r) => !!r); if (reasons.length === 0) return ""; const unique = [...new Set(reasons)]; return unique.join(", "); }; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ createElementVNode("h2", null, [ createElementVNode("img", { src: unref(OpenaiIcon), class: "header-icon", alt: "OpenAI" }, null, 8, _hoisted_3), _cache[0] || (_cache[0] = createTextVNode(" OpenAI Chat Completions API Response", -1)) ]), createElementVNode("div", _hoisted_4, [ createElementVNode("span", null, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "llm-label" }, "model", -1)), createElementVNode("code", null, toDisplayString(__props.data.model), 1) ]), _cache[3] || (_cache[3] = createElementVNode("span", { class: "divider" }, "·", -1)), createElementVNode("span", null, toDisplayString(choices.value.length) + " choices", 1), _cache[4] || (_cache[4] = createElementVNode("span", { class: "divider" }, "·", -1)), createElementVNode("span", null, toDisplayString(totalTokens.value.toLocaleString()) + " tokens", 1), getFinishReasonSummary() ? (openBlock(), createElementBlock("span", _hoisted_5, "·")) : createCommentVNode("", true), getFinishReasonSummary() ? (openBlock(), createElementBlock("span", _hoisted_6, [ _cache[2] || (_cache[2] = createTextVNode(" finish_reason: ", -1)), createElementVNode("span", { class: normalizeClass(["finish-summary", finishReasonClass(getFinishReasonSummary())]) }, toDisplayString(getFinishReasonSummary()), 3) ])) : createCommentVNode("", true) ]) ]), createVNode(CollapsibleSection, { title: "Basic Info", "default-open": true, "storage-key": "response-basic" }, { default: withCtx(() => [ createVNode(LabelValueRow, { label: "ID", value: __props.data.id }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Object", value: __props.data.object }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Model", value: __props.data.model }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "System Fingerprint", value: __props.data.system_fingerprint }, null, 8, ["value"]) ]), _: 1 }), __props.data.usage ? (openBlock(), createBlock(CollapsibleSection, { key: 0, title: "Token Usage", "default-open": true, "storage-key": "response-usage" }, { default: withCtx(() => [ createVNode(OpenaiTokenUsage, { usage: __props.data.usage }, null, 8, ["usage"]) ]), _: 1 })) : createCommentVNode("", true), createVNode(CollapsibleSection, { title: "Choices", count: choices.value.length, "default-open": true, "storage-key": "response-choices", variant: "default" }, { default: withCtx(() => [ choices.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_7, " No choices ")) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(choices.value, (choice) => { return openBlock(), createBlock(OpenaiChoice, { key: choice.index, choice, "finish-reason-class": finishReasonClass, "show-header": choices.value.length > 1 }, null, 8, ["choice", "show-header"]); }), 128)) ]), _: 1 }, 8, ["count"]), createVNode(BetterDetails, { title: "Full Response" }, { default: withCtx(() => [ createVNode(SmartViewer, { text: JSON.stringify(__props.data, null, 2) }, null, 8, ["text"]) ]), _: 1 }) ]); }; } }); const OpenaiResponseView = exports("default", _export_sfc(_sfc_main, [["__scopeId", "data-v-cd90a515"]])); }) }; })); System.register("./OpenaiResponsesRequestView-YlS72uxt-BamTWWMz.js", ['vue', './BetterDetails-BDkik7Go-BoTQ2MR3.js', './openai-d0N2HAk8-DfEE7-Ya.js', './OpenaiResponseToolItem.vue_vue_type_script_setup_true_lang-CvtaN2bd-BDeuAnGN.js', './main-CBTFarNI-HX0H7eVT.js'], (function (exports, module) { 'use strict'; var defineComponent, computed, openBlock, createElementBlock, createElementVNode, unref, createTextVNode, toDisplayString, createCommentVNode, createVNode, withCtx, createBlock, Fragment, renderList, CollapsibleSection, LabelValueRow, SmartViewer, BetterDetails, hashId, OpenaiIcon, OpenaiResponseInputItemView, _sfc_main$1, _export_sfc; return { setters: [module => { defineComponent = module.defineComponent; computed = module.computed; openBlock = module.openBlock; createElementBlock = module.createElementBlock; createElementVNode = module.createElementVNode; unref = module.unref; createTextVNode = module.createTextVNode; toDisplayString = module.toDisplayString; createCommentVNode = module.createCommentVNode; createVNode = module.createVNode; withCtx = module.withCtx; createBlock = module.createBlock; Fragment = module.Fragment; renderList = module.renderList; }, module => { CollapsibleSection = module.C; LabelValueRow = module.L; SmartViewer = module.S; BetterDetails = module.B; hashId = module.h; }, module => { OpenaiIcon = module.O; }, module => { OpenaiResponseInputItemView = module.O; _sfc_main$1 = module._; }, module => { _export_sfc = module._; }], execute: (function () { const _hoisted_1 = { class: "openai-request-view" }; const _hoisted_2 = { class: "header" }; const _hoisted_3 = ["src"]; const _hoisted_4 = { class: "meta" }; const _hoisted_5 = { key: 0, class: "divider" }; const _hoisted_6 = { key: 1 }; const _hoisted_7 = { class: "other-fields-table" }; const _hoisted_8 = { key: 0, class: "empty-state" }; const _sfc_main = defineComponent({ __name: "OpenaiResponsesRequestView", props: { data: {}, path: {} }, setup(__props) { const props = __props; const inputItems = computed(() => { const input = props.data.input; if (typeof input === "string") { return [ { type: "message", role: "user", content: [{ type: "input_text", text: input }] } ]; } if (Array.isArray(input)) { return input; } if (input && typeof input === "object" && "type" in input) { return [input]; } return []; }); const tools = computed(() => props.data.tools || []); const hasInstructions = computed(() => { return typeof props.data.instructions === "string" && props.data.instructions.trim().length > 0; }); const toolChoiceDisplay = computed(() => { const toolChoice = props.data.tool_choice; if (!toolChoice) return "none"; if (typeof toolChoice === "string") return toolChoice; if (typeof toolChoice.name === "string") return `${toolChoice.type}: ${toolChoice.name}`; return toolChoice.type; }); const reasoningDisplay = computed(() => { const reasoning = props.data.reasoning; if (!reasoning) return "none"; const effort = reasoning.effort ? `effort=${reasoning.effort}` : null; const summary = reasoning.summary ? `summary=${reasoning.summary}` : null; return [effort, summary].filter(Boolean).join(", ") || "configured"; }); const textDisplay = computed(() => { const textConfig = props.data.text; if (!textConfig) return "none"; if (textConfig.verbosity) return `verbosity=${textConfig.verbosity}`; return "configured"; }); const includeDisplay = computed(() => { if (!props.data.include || props.data.include.length === 0) return null; return props.data.include.join(", "); }); const getInputItemId = (item, index) => { const idCandidate = item.id; if (typeof idCandidate === "string" && idCandidate.length > 0) return idCandidate; const callIdCandidate = item.call_id; if (typeof callIdCandidate === "string" && callIdCandidate.length > 0) { return `${callIdCandidate}-${item.type}`; } return `openai-response-input-${index}-${hashId(JSON.stringify(item))}`; }; const getToolId = (tool, index) => { if (typeof tool.type === "string" && tool.type === "function") { const toolName = tool.name; if (typeof toolName === "string" && toolName.length > 0) { return `openai-response-tool-${toolName}`; } } return `openai-response-tool-${index}-${hashId(JSON.stringify(tool))}`; }; const highlightedKeys = new Set([ "model", "instructions", "input", "tools", "tool_choice", "parallel_tool_calls", "reasoning", "text", "stream", "store", "include", "temperature", "top_p", "max_output_tokens", "max_tool_calls", "prompt_cache_key" ]); const stringifyForTable = (value) => { if (value === null) return "null"; if (value === void 0) return ""; if (typeof value === "string") return value; if (typeof value === "number" || typeof value === "boolean") return String(value); try { return JSON.stringify(value, null, 2); } catch { return String(value); } }; const otherFieldRows = computed(() => { return Object.entries(props.data).filter(([key, value]) => !highlightedKeys.has(key) && value !== void 0).map(([key, value]) => ({ key, value: stringifyForTable(value) })); }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ createElementVNode("h2", null, [ createElementVNode("img", { src: unref(OpenaiIcon), class: "header-icon", alt: "OpenAI" }, null, 8, _hoisted_3), _cache[0] || (_cache[0] = createTextVNode(" OpenAI Responses API Request", -1)) ]), createElementVNode("div", _hoisted_4, [ createElementVNode("span", null, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "llm-label" }, "model", -1)), createElementVNode("code", null, toDisplayString(__props.data.model), 1) ]), _cache[2] || (_cache[2] = createElementVNode("span", { class: "divider" }, "·", -1)), createElementVNode("span", null, toDisplayString(inputItems.value.length) + " input items", 1), tools.value.length > 0 ? (openBlock(), createElementBlock("span", _hoisted_5, "·")) : createCommentVNode("", true), tools.value.length > 0 ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(tools.value.length) + " tools", 1)) : createCommentVNode("", true), _cache[3] || (_cache[3] = createElementVNode("span", { class: "divider" }, "·", -1)), createElementVNode("span", null, "stream: " + toDisplayString(__props.data.stream ? "true" : "false"), 1) ]) ]), createVNode(CollapsibleSection, { title: "Parameters", "default-open": true, "storage-key": "openai-responses-parameters" }, { default: withCtx(() => [ createVNode(LabelValueRow, { label: "Tool Choice", value: toolChoiceDisplay.value }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Reasoning", value: reasoningDisplay.value }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Text", value: textDisplay.value }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Temperature", value: __props.data.temperature }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Top P", value: __props.data.top_p }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Max Output Tokens", value: __props.data.max_output_tokens }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Max Tool Calls", value: __props.data.max_tool_calls }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Parallel Tool Calls", value: __props.data.parallel_tool_calls !== void 0 ? String(__props.data.parallel_tool_calls) : null }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Store", value: __props.data.store !== void 0 ? String(__props.data.store) : null }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Include", value: includeDisplay.value }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Prompt Cache Key", value: __props.data.prompt_cache_key }, null, 8, ["value"]) ]), _: 1 }), otherFieldRows.value.length > 0 ? (openBlock(), createBlock(CollapsibleSection, { key: 0, title: "Other Fields", "default-open": false, "storage-key": "openai-responses-other-fields" }, { default: withCtx(() => [ createElementVNode("table", _hoisted_7, [ _cache[4] || (_cache[4] = createElementVNode("thead", null, [ createElementVNode("tr", null, [ createElementVNode("th", null, "field"), createElementVNode("th", null, "value") ]) ], -1)), createElementVNode("tbody", null, [ (openBlock(true), createElementBlock(Fragment, null, renderList(otherFieldRows.value, (row) => { return openBlock(), createElementBlock("tr", { key: row.key }, [ createElementVNode("th", null, toDisplayString(row.key), 1), createElementVNode("td", null, [ createVNode(SmartViewer, { text: row.value }, null, 8, ["text"]) ]) ]); }), 128)) ]) ]) ]), _: 1 })) : createCommentVNode("", true), hasInstructions.value ? (openBlock(), createBlock(CollapsibleSection, { key: 1, title: "Instructions", "default-open": true, "storage-key": "openai-responses-instructions", variant: "system" }, { default: withCtx(() => [ createVNode(SmartViewer, { text: String(__props.data.instructions) }, null, 8, ["text"]) ]), _: 1 })) : createCommentVNode("", true), createVNode(CollapsibleSection, { title: "Input", count: inputItems.value.length, "default-open": true, "storage-key": "openai-responses-input", variant: "default", "enable-bulk-actions": "" }, { default: withCtx(() => [ inputItems.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_8, "No input items")) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(inputItems.value, (item, index) => { return openBlock(), createBlock(OpenaiResponseInputItemView, { key: getInputItemId(item, index), id: getInputItemId(item, index), item, index: index + 1 }, null, 8, ["id", "item", "index"]); }), 128)) ]), _: 1 }, 8, ["count"]), tools.value.length > 0 ? (openBlock(), createBlock(CollapsibleSection, { key: 2, title: "Tools", count: tools.value.length, "storage-key": "openai-responses-tools", variant: "tools", "enable-bulk-actions": "" }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(tools.value, (tool, index) => { return openBlock(), createBlock(_sfc_main$1, { key: getToolId(tool, index), id: getToolId(tool, index), tool, index }, null, 8, ["id", "tool", "index"]); }), 128)) ]), _: 1 }, 8, ["count"])) : createCommentVNode("", true), createVNode(BetterDetails, { title: "Full Request" }, { default: withCtx(() => [ createVNode(SmartViewer, { text: JSON.stringify(__props.data, null, 2) }, null, 8, ["text"]) ]), _: 1 }) ]); }; } }); const OpenaiResponsesRequestView = exports("default", _export_sfc(_sfc_main, [["__scopeId", "data-v-062dc21d"]])); }) }; })); System.register("./OpenaiResponsesResponseView-CLoPvDKP-CDgX4KAr.js", ['vue', './BetterDetails-BDkik7Go-BoTQ2MR3.js', './main-CBTFarNI-HX0H7eVT.js', './OpenaiTokenUsage-BDr-HLbW-CjGmC_HL.js', './openai-d0N2HAk8-DfEE7-Ya.js', './OpenaiResponseToolItem.vue_vue_type_script_setup_true_lang-CvtaN2bd-BDeuAnGN.js'], (function (exports, module) { 'use strict'; var defineComponent, computed, openBlock, createElementBlock, createElementVNode, unref, createTextVNode, toDisplayString, createCommentVNode, Fragment, createVNode, withCtx, createBlock, renderList, CollapsibleSection, LabelValueRow, SmartViewer, BetterDetails, hashId, _export_sfc, isOpenaiResponseSSEWrapper, isOpenaiResponse, OpenaiTokenUsage, OpenaiIcon, OpenaiResponseInputItemView, _sfc_main$1; return { setters: [module => { defineComponent = module.defineComponent; computed = module.computed; openBlock = module.openBlock; createElementBlock = module.createElementBlock; createElementVNode = module.createElementVNode; unref = module.unref; createTextVNode = module.createTextVNode; toDisplayString = module.toDisplayString; createCommentVNode = module.createCommentVNode; Fragment = module.Fragment; createVNode = module.createVNode; withCtx = module.withCtx; createBlock = module.createBlock; renderList = module.renderList; }, module => { CollapsibleSection = module.C; LabelValueRow = module.L; SmartViewer = module.S; BetterDetails = module.B; hashId = module.h; }, module => { _export_sfc = module._; isOpenaiResponseSSEWrapper = module.i; isOpenaiResponse = module.a; }, module => { OpenaiTokenUsage = module.O; }, module => { OpenaiIcon = module.O; }, module => { OpenaiResponseInputItemView = module.O; _sfc_main$1 = module._; }], execute: (function () { const _hoisted_1 = { class: "openai-responses-response-view" }; const _hoisted_2 = { class: "header" }; const _hoisted_3 = ["src"]; const _hoisted_4 = { class: "meta" }; const _hoisted_5 = { class: "status-pill" }; const _hoisted_6 = { key: 0, class: "divider" }; const _hoisted_7 = { key: 1 }; const _hoisted_8 = { key: 2, class: "divider" }; const _hoisted_9 = { key: 3 }; const _hoisted_10 = { key: 0, class: "empty-state" }; const _hoisted_11 = { key: 0, class: "info-group-title" }; const _hoisted_12 = { key: 4, class: "info-group-title" }; const _hoisted_13 = { key: 5, class: "other-fields-table" }; const _hoisted_14 = { key: 0, class: "empty-state" }; const _sfc_main = defineComponent({ __name: "OpenaiResponsesResponseView", props: { data: {} }, setup(__props) { const props = __props; const response = computed(() => { if (isOpenaiResponseSSEWrapper(props.data)) return props.data.response; if (isOpenaiResponse(props.data)) return props.data; return null; }); const sseMeta = computed(() => { return isOpenaiResponseSSEWrapper(props.data) ? props.data.meta ?? null : null; }); const responseId = computed(() => response.value?.id ?? ""); const model = computed(() => response.value?.model ?? ""); const status = computed(() => response.value?.status ?? "unknown"); const outputItems = computed(() => { return Array.isArray(response.value?.output) ? response.value?.output ?? [] : []; }); const ignoreRequestEcho = computed(() => true); const tools = computed(() => { if (ignoreRequestEcho.value) return []; return Array.isArray(response.value?.tools) ? response.value?.tools ?? [] : []; }); const totalTokens = computed(() => response.value?.usage?.total_tokens ?? 0); const sseEventCount = computed(() => { return typeof sseMeta.value?.event_count === "number" ? sseMeta.value.event_count : null; }); const hasInstructions = computed(() => { if (ignoreRequestEcho.value) return false; return typeof response.value?.instructions === "string" && response.value.instructions.trim().length > 0; }); const toolChoiceDisplay = computed(() => { const toolChoice = response.value?.tool_choice; if (!toolChoice) return "none"; if (typeof toolChoice === "string") return toolChoice; if (typeof toolChoice.name === "string") return `${toolChoice.type}: ${toolChoice.name}`; return toolChoice.type; }); const reasoningDisplay = computed(() => { const reasoning = response.value?.reasoning; if (!reasoning) return "none"; const effort = reasoning.effort ? `effort=${reasoning.effort}` : null; const summary = reasoning.summary ? `summary=${reasoning.summary}` : null; return [effort, summary].filter(Boolean).join(", ") || "configured"; }); const textDisplay = computed(() => { const textConfig = response.value?.text; if (!textConfig) return "none"; if (textConfig.verbosity) return `verbosity=${textConfig.verbosity}`; return "configured"; }); const includeDisplay = computed(() => { if (!response.value?.include || response.value.include.length === 0) return null; return response.value.include.join(", "); }); const hasError = computed(() => { return response.value?.error !== null && response.value?.error !== void 0; }); const stringifyForTable = (value) => { if (value === null) return "null"; if (value === void 0) return ""; if (typeof value === "string") return value; if (typeof value === "number" || typeof value === "boolean") return String(value); try { return JSON.stringify(value, null, 2); } catch { return String(value); } }; const highlightedKeys = new Set([ "id", "object", "created_at", "status", "background", "completed_at", "error", "model", "instructions", "output", "tools", "tool_choice", "parallel_tool_calls", "reasoning", "text", "usage", "temperature", "top_p", "frequency_penalty", "presence_penalty", "max_output_tokens", "max_tool_calls", "prompt_cache_key", "prompt_cache_retention", "previous_response_id", "service_tier", "store", "truncation", "user", "include", "safety_identifier" ]); const otherFieldRows = computed(() => { if (!response.value) return []; return Object.entries(response.value).filter(([key, value]) => !highlightedKeys.has(key) && value !== void 0).map(([key, value]) => ({ key, value: stringifyForTable(value) })); }); const getOutputItemId = (item, index) => { const idCandidate = item.id; if (typeof idCandidate === "string" && idCandidate.length > 0) return idCandidate; const callIdCandidate = item.call_id; if (typeof callIdCandidate === "string" && callIdCandidate.length > 0) { return `${callIdCandidate}-${item.type}`; } return `openai-response-output-${index}-${hashId(JSON.stringify(item))}`; }; const getToolId = (tool, index) => { if (typeof tool.type === "string" && tool.type === "function") { const toolName = tool.name; if (typeof toolName === "string" && toolName.length > 0) { return `openai-response-tool-${toolName}`; } } return `openai-response-tool-${index}-${hashId(JSON.stringify(tool))}`; }; const rawJson = computed(() => { try { return JSON.stringify(props.data ?? {}, null, 2); } catch { return String(props.data ?? ""); } }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ createElementVNode("h2", null, [ createElementVNode("img", { src: unref(OpenaiIcon), class: "header-icon", alt: "OpenAI" }, null, 8, _hoisted_3), _cache[0] || (_cache[0] = createTextVNode(" OpenAI Responses API Response", -1)) ]), createElementVNode("div", _hoisted_4, [ createElementVNode("span", null, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "llm-label" }, "model", -1)), createElementVNode("code", null, toDisplayString(model.value || "N/A"), 1) ]), _cache[3] || (_cache[3] = createElementVNode("span", { class: "divider" }, "·", -1)), createElementVNode("span", null, toDisplayString(outputItems.value.length) + " output items", 1), _cache[4] || (_cache[4] = createElementVNode("span", { class: "divider" }, "·", -1)), createElementVNode("span", null, [ _cache[2] || (_cache[2] = createTextVNode("status: ", -1)), createElementVNode("span", _hoisted_5, toDisplayString(status.value), 1) ]), totalTokens.value > 0 ? (openBlock(), createElementBlock("span", _hoisted_6, "·")) : createCommentVNode("", true), totalTokens.value > 0 ? (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(totalTokens.value.toLocaleString()) + " tokens", 1)) : createCommentVNode("", true), sseEventCount.value !== null ? (openBlock(), createElementBlock("span", _hoisted_8, "·")) : createCommentVNode("", true), sseEventCount.value !== null ? (openBlock(), createElementBlock("span", _hoisted_9, "SSE events: " + toDisplayString(sseEventCount.value), 1)) : createCommentVNode("", true) ]) ]), !response.value ? (openBlock(), createElementBlock("div", _hoisted_10, " Invalid Responses API payload ")) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [ createVNode(CollapsibleSection, { title: "Basic Info", "default-open": true, "storage-key": "openai-responses-response-basic" }, { default: withCtx(() => [ createVNode(LabelValueRow, { label: "ID", value: responseId.value }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Object", value: response.value.object }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Status", value: response.value.status }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Model", value: response.value.model }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Created At", value: response.value.created_at }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Completed At", value: response.value.completed_at }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Background", value: response.value.background !== void 0 ? String(response.value.background) : null }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Service Tier", value: response.value.service_tier }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Previous Response ID", value: response.value.previous_response_id }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Prompt Cache Key", value: response.value.prompt_cache_key }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Safety Identifier", value: response.value.safety_identifier }, null, 8, ["value"]), _cache[6] || (_cache[6] = createElementVNode("div", { class: "info-group-title" }, "Parameters", -1)), createVNode(LabelValueRow, { label: "Tool Choice", value: toolChoiceDisplay.value }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Reasoning", value: reasoningDisplay.value }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Text", value: textDisplay.value }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Temperature", value: response.value.temperature }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Top P", value: response.value.top_p }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Frequency Penalty", value: response.value.frequency_penalty }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Presence Penalty", value: response.value.presence_penalty }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Max Output Tokens", value: response.value.max_output_tokens }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Max Tool Calls", value: response.value.max_tool_calls }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Parallel Tool Calls", value: response.value.parallel_tool_calls !== void 0 ? String(response.value.parallel_tool_calls) : null }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Store", value: response.value.store !== void 0 ? String(response.value.store) : null }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Truncation", value: response.value.truncation }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Include", value: includeDisplay.value }, null, 8, ["value"]), sseMeta.value ? (openBlock(), createElementBlock("div", _hoisted_11, "SSE Meta")) : createCommentVNode("", true), sseMeta.value ? (openBlock(), createBlock(LabelValueRow, { key: 1, label: "Event Count", value: sseMeta.value.event_count }, null, 8, ["value"])) : createCommentVNode("", true), sseMeta.value ? (openBlock(), createBlock(LabelValueRow, { key: 2, label: "Parse Errors", value: sseMeta.value.parse_error_count }, null, 8, ["value"])) : createCommentVNode("", true), sseMeta.value?.unknown_event_types?.length ? (openBlock(), createBlock(LabelValueRow, { key: 3, label: "Unknown Event Types", value: sseMeta.value.unknown_event_types.join(", ") }, null, 8, ["value"])) : createCommentVNode("", true), otherFieldRows.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_12, "Other Fields")) : createCommentVNode("", true), otherFieldRows.value.length > 0 ? (openBlock(), createElementBlock("table", _hoisted_13, [ _cache[5] || (_cache[5] = createElementVNode("thead", null, [ createElementVNode("tr", null, [ createElementVNode("th", null, "field"), createElementVNode("th", null, "value") ]) ], -1)), createElementVNode("tbody", null, [ (openBlock(true), createElementBlock(Fragment, null, renderList(otherFieldRows.value, (row) => { return openBlock(), createElementBlock("tr", { key: row.key }, [ createElementVNode("th", null, toDisplayString(row.key), 1), createElementVNode("td", null, [ createVNode(SmartViewer, { text: row.value }, null, 8, ["text"]) ]) ]); }), 128)) ]) ])) : createCommentVNode("", true) ]), _: 1 }), hasError.value ? (openBlock(), createBlock(CollapsibleSection, { key: 0, title: "Error", "default-open": true, "storage-key": "openai-responses-response-error", variant: "error" }, { default: withCtx(() => [ createVNode(SmartViewer, { text: stringifyForTable(response.value.error) }, null, 8, ["text"]) ]), _: 1 })) : createCommentVNode("", true), response.value.usage ? (openBlock(), createBlock(CollapsibleSection, { key: 1, title: "Token Usage", "default-open": true, "storage-key": "openai-responses-response-usage" }, { default: withCtx(() => [ createVNode(OpenaiTokenUsage, { usage: response.value.usage }, null, 8, ["usage"]) ]), _: 1 })) : createCommentVNode("", true), hasInstructions.value ? (openBlock(), createBlock(CollapsibleSection, { key: 2, title: "Instructions", "default-open": false, "storage-key": "openai-responses-response-instructions", variant: "system" }, { default: withCtx(() => [ createVNode(SmartViewer, { text: String(response.value.instructions) }, null, 8, ["text"]) ]), _: 1 })) : createCommentVNode("", true), createVNode(CollapsibleSection, { title: "Output", count: outputItems.value.length, "default-open": true, "storage-key": "openai-responses-response-output", variant: "default", "enable-bulk-actions": "" }, { default: withCtx(() => [ outputItems.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_14, "No output items")) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(outputItems.value, (item, index) => { return openBlock(), createBlock(OpenaiResponseInputItemView, { key: getOutputItemId(item, index), id: getOutputItemId(item, index), item, index: index + 1, "storage-prefix": "openai-response-output", "storage-sub-prefix": "openai-response-output-sub" }, null, 8, ["id", "item", "index"]); }), 128)) ]), _: 1 }, 8, ["count"]), tools.value.length > 0 ? (openBlock(), createBlock(CollapsibleSection, { key: 3, title: "Tools", count: tools.value.length, "storage-key": "openai-responses-response-tools", variant: "tools", "enable-bulk-actions": "" }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(tools.value, (tool, index) => { return openBlock(), createBlock(_sfc_main$1, { key: getToolId(tool, index), id: getToolId(tool, index), tool, index }, null, 8, ["id", "tool", "index"]); }), 128)) ]), _: 1 }, 8, ["count"])) : createCommentVNode("", true), createVNode(BetterDetails, { title: "Full Response" }, { default: withCtx(() => [ createVNode(SmartViewer, { text: rawJson.value }, null, 8, ["text"]) ]), _: 1 }) ], 64)) ]); }; } }); const OpenaiResponsesResponseView = exports("default", _export_sfc(_sfc_main, [["__scopeId", "data-v-63ea447a"]])); }) }; })); System.register("./ClaudeRequestView-Yzc3Jd7c-z7M9c2Zp.js", ['vue', './BetterDetails-BDkik7Go-BoTQ2MR3.js', './SubMessageItem-CDY-oINa-C9F6H7x7.js', './ImageBlock-DPbM__Ea-CdY7PxBB.js', './main-CBTFarNI-HX0H7eVT.js', './claude-DAANm4EN-CSvzQzJE.js'], (function (exports, module) { 'use strict'; var defineComponent, computed, openBlock, createElementBlock, createElementVNode, unref, createTextVNode, toDisplayString, createCommentVNode, createVNode, withCtx, createBlock, Fragment, renderList, withDirectives, vShow, CollapsibleSection, LabelValueRow, BetterDetails, SmartViewer, hashId, useSessionStorage, ToolArgs, ToolItem, RoleBadge, MessageItem, SubMessageItem, ImageBlock, _export_sfc, ClaudeIcon; return { setters: [module => { defineComponent = module.defineComponent; computed = module.computed; openBlock = module.openBlock; createElementBlock = module.createElementBlock; createElementVNode = module.createElementVNode; unref = module.unref; createTextVNode = module.createTextVNode; toDisplayString = module.toDisplayString; createCommentVNode = module.createCommentVNode; createVNode = module.createVNode; withCtx = module.withCtx; createBlock = module.createBlock; Fragment = module.Fragment; renderList = module.renderList; withDirectives = module.withDirectives; vShow = module.vShow; }, module => { CollapsibleSection = module.C; LabelValueRow = module.L; BetterDetails = module.B; SmartViewer = module.S; hashId = module.h; useSessionStorage = module.u; ToolArgs = module.T; }, module => { ToolItem = module.T; RoleBadge = module.R; MessageItem = module.M; SubMessageItem = module.S; }, module => { ImageBlock = module.I; }, module => { _export_sfc = module._; }, module => { ClaudeIcon = module.C; }], execute: (function () { const _hoisted_1$2 = { class: "message-content-flow" }; const _hoisted_2$2 = { key: 0, class: "block-wrapper" }; const _hoisted_3$2 = { class: "reasoning-content" }; const _hoisted_4$2 = { key: 1, class: "block-wrapper" }; const _hoisted_5$2 = { key: 2, class: "block-image" }; const _hoisted_6$2 = { key: 3, class: "block-wrapper" }; const _hoisted_7$1 = { class: "tool-name" }; const _hoisted_8 = { key: 4, class: "block-wrapper" }; const _hoisted_9 = { class: "tool-id-ref" }; const _hoisted_10 = { class: "tool-result-content" }; const _hoisted_11 = { key: 1, class: "mini-image-placeholder" }; const _hoisted_12 = { key: 0, class: "empty" }; const _sfc_main$2 = defineComponent({ __name: "ClaudeMessageItem", props: { message: {}, index: {} }, setup(__props) { const props = __props; const msgHashId = computed(() => { const content = props.message.content; if (typeof content === "string") { return hashId(`${props.index}-${props.message.role}-${content.length}`); } if (Array.isArray(content)) { return hashId(`${props.index}-${props.message.role}-blocks-${content.length}`); } return hashId(`${props.index}-${props.message.role}-empty`); }); const contentBlocks = computed(() => { const content = props.message.content; if (!content) return []; if (typeof content === "string") { return [{ type: "text", text: content, id: "content-0" }]; } if (Array.isArray(content)) { return content.map((block, idx) => { if (typeof block === "string") { return { type: "text", text: block, id: `content-${idx}` }; } return { ...block, id: block.id || block.tool_use_id || `content-${idx}` }; }); } return []; }); const messageCount = computed(() => { const content = props.message.content; if (typeof content === "string") { return 1; } else if (Array.isArray(content)) { return content.length; } return 0; }); const hasContent = computed(() => contentBlocks.value.length > 0); return (_ctx, _cache) => { return openBlock(), createBlock(MessageItem, { count: messageCount.value, "data-for-raw": __props.message, index: String(__props.index), role: __props.message.role, "storage-prefix": "claude-msg" }, { default: withCtx(() => [ createElementVNode("div", _hoisted_1$2, [ (openBlock(true), createElementBlock(Fragment, null, renderList(contentBlocks.value, (block, subIndex) => { return openBlock(), createElementBlock(Fragment, { key: block.id }, [ block.type === "thinking" ? (openBlock(), createElementBlock("div", _hoisted_2$2, [ createVNode(SubMessageItem, { "badge-type": "thinking", "badge-text": "THINKING", index: `${__props.index}-${subIndex + 1}`, id: `${msgHashId.value}-${block.id}` }, { default: withCtx(() => [ createElementVNode("div", _hoisted_3$2, [ createVNode(SmartViewer, { text: block.thinking }, null, 8, ["text"]) ]) ]), _: 2 }, 1032, ["index", "id"]) ])) : block.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_4$2, [ createVNode(SubMessageItem, { "badge-type": "text", "badge-text": "TEXT", index: `${__props.index}-${subIndex + 1}`, id: `${msgHashId.value}-${block.id}` }, { default: withCtx(() => [ createVNode(SmartViewer, { text: block.text }, null, 8, ["text"]) ]), _: 2 }, 1032, ["index", "id"]) ])) : block.type === "image" ? (openBlock(), createElementBlock("div", _hoisted_5$2, [ createVNode(ImageBlock, { url: `data:${block.source.media_type};base64,${block.source.data}` }, null, 8, ["url"]) ])) : block.type === "tool_use" ? (openBlock(), createElementBlock("div", _hoisted_6$2, [ createVNode(SubMessageItem, { "badge-type": "tool", "badge-text": "TOOL_USE", index: `${__props.index}-${subIndex + 1}`, id: `${msgHashId.value}-${block.id}` }, { header: withCtx(() => [ createElementVNode("span", _hoisted_7$1, toDisplayString(block.name), 1) ]), default: withCtx(() => [ createVNode(ToolArgs, { input: block.input }, null, 8, ["input"]) ]), _: 2 }, 1032, ["index", "id"]) ])) : block.type === "tool_result" ? (openBlock(), createElementBlock("div", _hoisted_8, [ createVNode(SubMessageItem, { "badge-type": "tool", "badge-text": "TOOL_RESULT", index: `${__props.index}-${subIndex + 1}`, id: `${msgHashId.value}-${block.tool_use_id}` }, { header: withCtx(() => [ createElementVNode("span", _hoisted_9, toDisplayString(block.tool_use_id), 1) ]), default: withCtx(() => [ createElementVNode("div", _hoisted_10, [ typeof block.content === "string" ? (openBlock(), createBlock(SmartViewer, { key: 0, text: block.content }, null, 8, ["text"])) : Array.isArray(block.content) ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(block.content, (item, i) => { return openBlock(), createElementBlock("div", { key: i }, [ item.type === "text" ? (openBlock(), createBlock(SmartViewer, { key: 0, text: item.text }, null, 8, ["text"])) : item.type === "image" ? (openBlock(), createElementBlock("div", _hoisted_11, " [Image Result] ")) : createCommentVNode("", true) ]); }), 128)) : createCommentVNode("", true) ]) ]), _: 2 }, 1032, ["index", "id"]) ])) : createCommentVNode("", true) ], 64); }), 128)), !hasContent.value ? (openBlock(), createElementBlock("div", _hoisted_12, "No content")) : createCommentVNode("", true) ]) ]), _: 1 }, 8, ["count", "data-for-raw", "index", "role"]); }; } }); const ClaudeMessageItem = _export_sfc(_sfc_main$2, [["__scopeId", "data-v-4068a120"]]); const _hoisted_1$1 = { class: "system-message" }; const _hoisted_2$1 = { class: "header-left" }; const _hoisted_3$1 = { class: "toggle" }; const _hoisted_4$1 = { class: "index" }; const _hoisted_5$1 = { key: 0, class: "cache-badge", title: "Ephemeral cache control" }; const _hoisted_6$1 = { class: "content" }; const _sfc_main$1 = defineComponent({ __name: "ClaudeSystemMessage", props: { message: {}, index: {} }, setup(__props) { const props = __props; const storageKey = computed(() => `claude-sys-${hashId(JSON.stringify(props.message))}-open`); const isOpen = useSessionStorage(storageKey, true); const hasCacheControl = computed(() => { return props.message.cache_control?.type === "ephemeral"; }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$1, [ createElementVNode("div", { class: "header", onClick: _cache[0] || (_cache[0] = ($event) => isOpen.value = !unref(isOpen)) }, [ createElementVNode("div", _hoisted_2$1, [ createElementVNode("span", _hoisted_3$1, toDisplayString(unref(isOpen) ? "▼" : "▶"), 1), createElementVNode("span", _hoisted_4$1, "#" + toDisplayString(__props.index + 1), 1), createVNode(RoleBadge, { role: "system" }), hasCacheControl.value ? (openBlock(), createElementBlock("span", _hoisted_5$1, " cache ")) : createCommentVNode("", true) ]) ]), withDirectives(createElementVNode("div", _hoisted_6$1, [ createVNode(SmartViewer, { text: __props.message.text }, null, 8, ["text"]) ], 512), [ [vShow, unref(isOpen)] ]) ]); }; } }); const ClaudeSystemMessage = _export_sfc(_sfc_main$1, [["__scopeId", "data-v-41c2420a"]]); const _hoisted_1 = { class: "claude-request-view" }; const _hoisted_2 = { class: "header" }; const _hoisted_3 = ["src"]; const _hoisted_4 = { class: "meta" }; const _hoisted_5 = { key: 0, class: "divider" }; const _hoisted_6 = { key: 1 }; const _hoisted_7 = { key: 0, class: "empty-state" }; const _sfc_main = defineComponent({ __name: "ClaudeRequestView", props: { data: {} }, setup(__props) { const props = __props; const messages = computed(() => props.data.messages || []); const tools = computed(() => props.data.tools || []); const systemMessages = computed(() => { const sys = props.data.system; if (!sys) return []; if (typeof sys === "string") return [{ type: "text", text: sys }]; return sys; }); const thinkingConfig = computed(() => { const thinking = props.data.thinking; if (!thinking) return "disabled"; if (thinking.type === "disabled") return "disabled"; return `enabled (budget: ${thinking.budget_tokens || "auto"} tokens)`; }); const toolChoice = computed(() => { const tc = props.data.tool_choice; if (!tc) return "auto"; if (tc.type === "auto") return "auto"; if (tc.type === "any") return "any"; if (tc.type === "tool") return `tool: ${tc.name}`; return "auto"; }); const stopSequences = computed(() => { const stop = props.data.stop_sequences; if (!stop || stop.length === 0) return "none"; return stop.join(", "); }); const hasSystemMessages = computed(() => { const sys = props.data.system; if (!sys) return false; if (typeof sys === "string") return sys.length > 0; return sys.length > 0; }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ createElementVNode("h2", null, [ createElementVNode("img", { src: unref(ClaudeIcon), class: "header-icon", alt: "Claude" }, null, 8, _hoisted_3), _cache[0] || (_cache[0] = createTextVNode(" Claude Messages API Request ", -1)) ]), createElementVNode("div", _hoisted_4, [ createElementVNode("span", null, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "llm-label" }, "model", -1)), createElementVNode("code", null, toDisplayString(__props.data.model), 1) ]), _cache[2] || (_cache[2] = createElementVNode("span", { class: "divider" }, "·", -1)), createElementVNode("span", null, toDisplayString(messages.value.length) + " messages", 1), tools.value.length > 0 ? (openBlock(), createElementBlock("span", _hoisted_5, "·")) : createCommentVNode("", true), tools.value.length > 0 ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(tools.value.length) + " tools", 1)) : createCommentVNode("", true), _cache[3] || (_cache[3] = createElementVNode("span", { class: "divider" }, "·", -1)), createElementVNode("span", null, "stream: " + toDisplayString(__props.data.stream ? "true" : "false"), 1), _cache[4] || (_cache[4] = createElementVNode("span", { class: "divider" }, "·", -1)), createElementVNode("span", null, "max_tokens: " + toDisplayString(__props.data.max_tokens), 1) ]) ]), createVNode(CollapsibleSection, { title: "Parameters", "default-open": true, "storage-key": "claude-parameters" }, { default: withCtx(() => [ createVNode(LabelValueRow, { label: "Temperature", value: __props.data.temperature }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Top P", value: __props.data.top_p }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Top K", value: __props.data.top_k }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Max Tokens", value: __props.data.max_tokens }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Thinking", value: thinkingConfig.value }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Tool Choice", value: toolChoice.value }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Stop Sequences", value: stopSequences.value }, null, 8, ["value"]) ]), _: 1 }), hasSystemMessages.value ? (openBlock(), createBlock(CollapsibleSection, { key: 0, title: "System Messages", count: systemMessages.value.length, "default-open": true, "storage-key": "claude-system", variant: "system" }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(systemMessages.value, (msg, index) => { return openBlock(), createBlock(ClaudeSystemMessage, { key: index, message: msg, index }, null, 8, ["message", "index"]); }), 128)) ]), _: 1 }, 8, ["count"])) : createCommentVNode("", true), createVNode(CollapsibleSection, { title: "Messages", count: messages.value.length, "default-open": true, "storage-key": "claude-messages", variant: "default", "enable-bulk-actions": true }, { default: withCtx(() => [ messages.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_7, "No messages")) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(messages.value, (message, index) => { return openBlock(), createBlock(ClaudeMessageItem, { key: index, message, index: index + 1 }, null, 8, ["message", "index"]); }), 128)) ]), _: 1 }, 8, ["count"]), tools.value.length > 0 ? (openBlock(), createBlock(CollapsibleSection, { key: 1, title: "Tools", count: tools.value.length, "storage-key": "claude-tools", variant: "tools", "enable-bulk-actions": "" }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(tools.value, (tool, index) => { return openBlock(), createBlock(ToolItem, { key: index, name: tool.name, description: tool.description, params: tool.input_schema, index, standard: "claude" }, null, 8, ["name", "description", "params", "index"]); }), 128)) ]), _: 1 }, 8, ["count"])) : createCommentVNode("", true), createVNode(BetterDetails, { title: "Full Request" }, { default: withCtx(() => [ createVNode(SmartViewer, { text: JSON.stringify(__props.data, null, 2) }, null, 8, ["text"]) ]), _: 1 }) ]); }; } }); const ClaudeRequestView = exports("default", _export_sfc(_sfc_main, [["__scopeId", "data-v-79ea931d"]])); }) }; })); System.register("./ClaudeResponseView-Bpb2GKVr-kaBtCnVu.js", ['vue', './BetterDetails-BDkik7Go-BoTQ2MR3.js', './main-CBTFarNI-HX0H7eVT.js', './claude-DAANm4EN-CSvzQzJE.js'], (function (exports, module) { 'use strict'; var defineComponent, computed, openBlock, createElementBlock, createElementVNode, unref, createTextVNode, toDisplayString, normalizeClass, createCommentVNode, createBlock, withCtx, createVNode, Fragment, renderList, CollapsibleSection, LabelValueRow, BetterDetails, SmartViewer, ToolArgs, _export_sfc, ClaudeIcon; return { setters: [module => { defineComponent = module.defineComponent; computed = module.computed; openBlock = module.openBlock; createElementBlock = module.createElementBlock; createElementVNode = module.createElementVNode; unref = module.unref; createTextVNode = module.createTextVNode; toDisplayString = module.toDisplayString; normalizeClass = module.normalizeClass; createCommentVNode = module.createCommentVNode; createBlock = module.createBlock; withCtx = module.withCtx; createVNode = module.createVNode; Fragment = module.Fragment; renderList = module.renderList; }, module => { CollapsibleSection = module.C; LabelValueRow = module.L; BetterDetails = module.B; SmartViewer = module.S; ToolArgs = module.T; }, module => { _export_sfc = module._; }, module => { ClaudeIcon = module.C; }], execute: (function () { const _hoisted_1$2 = { class: "block-header" }; const _hoisted_2$2 = { class: "header-left" }; const _hoisted_3$2 = { class: "block-index" }; const _hoisted_4$2 = { class: "block-name" }; const _hoisted_5$2 = { class: "" }; const _hoisted_6$2 = { key: 0, class: "citations-section" }; const _hoisted_7$2 = { class: "citations-label" }; const _hoisted_8$2 = { class: "citation-range" }; const _hoisted_9$2 = { class: "citation-type" }; const _hoisted_10$2 = { key: 2, class: "thinking-content" }; const _hoisted_11$1 = { key: 3, class: "unknown-block" }; const _sfc_main$2 = defineComponent({ __name: "ClaudeResponseContentBlock", props: { block: {}, index: {} }, setup(__props) { const props = __props; const isTextBlock = (block) => { return block.type === "text"; }; const isToolUseBlock = (block) => { return block.type === "tool_use"; }; const isThinkingBlock = (block) => { return block.type === "thinking"; }; const blockTypeLabel = computed(() => { if (isTextBlock(props.block)) return "TEXT"; if (isToolUseBlock(props.block)) return "TOOL"; if (isThinkingBlock(props.block)) return "THINK"; return "UNKNOWN"; }); const blockTypeClass = computed(() => { if (isTextBlock(props.block)) return "type-text"; if (isToolUseBlock(props.block)) return "type-tool-use"; if (isThinkingBlock(props.block)) return "type-thinking"; return "type-unknown"; }); const badgeTypeClass = computed(() => { if (isTextBlock(props.block)) return "badge-text"; if (isToolUseBlock(props.block)) return "badge-tool-use"; if (isThinkingBlock(props.block)) return "badge-thinking"; return "badge-unknown"; }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass(["content-block", blockTypeClass.value]) }, [ createElementVNode("div", _hoisted_1$2, [ createElementVNode("div", _hoisted_2$2, [ createElementVNode("span", { class: normalizeClass(["block-type-badge", badgeTypeClass.value]) }, toDisplayString(blockTypeLabel.value), 3), createElementVNode("span", _hoisted_3$2, "#" + toDisplayString(__props.index + 1), 1), createElementVNode("span", _hoisted_4$2, toDisplayString(props.block?.name), 1) ]) ]), createElementVNode("div", _hoisted_5$2, [ isTextBlock(__props.block) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ createVNode(SmartViewer, { text: __props.block.text }, null, 8, ["text"]), __props.block.citations && __props.block.citations.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_6$2, [ createElementVNode("div", _hoisted_7$2, "Citations (" + toDisplayString(__props.block.citations.length) + ")", 1), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.block.citations, (citation, idx) => { return openBlock(), createElementBlock("div", { key: idx, class: "citation-item" }, [ createElementVNode("span", _hoisted_8$2, "[" + toDisplayString(citation.start) + "-" + toDisplayString(citation.end) + "]", 1), createElementVNode("span", _hoisted_9$2, toDisplayString(citation.document.type), 1) ]); }), 128)) ])) : createCommentVNode("", true) ], 64)) : isToolUseBlock(__props.block) ? (openBlock(), createBlock(ToolArgs, { key: 1, input: __props.block.input }, null, 8, ["input"])) : isThinkingBlock(__props.block) ? (openBlock(), createElementBlock("div", _hoisted_10$2, [ createVNode(SmartViewer, { text: __props.block.thinking }, null, 8, ["text"]) ])) : (openBlock(), createElementBlock("div", _hoisted_11$1, [ createVNode(SmartViewer, { text: JSON.stringify(__props.block, null, 2) }, null, 8, ["text"]) ])) ]) ], 2); }; } }); const ClaudeResponseContentBlock = _export_sfc(_sfc_main$2, [["__scopeId", "data-v-17a28202"]]); const _hoisted_1$1 = { class: "token-usage" }; const _hoisted_2$1 = { class: "card input" }; const _hoisted_3$1 = { class: "header" }; const _hoisted_4$1 = { class: "value" }; const _hoisted_5$1 = { class: "details" }; const _hoisted_6$1 = { key: 0, class: "detail-item cache-hit" }; const _hoisted_7$1 = { key: 1, class: "detail-item cache-write" }; const _hoisted_8$1 = { class: "card output" }; const _hoisted_9$1 = { class: "header" }; const _hoisted_10$1 = { class: "value" }; const _hoisted_11 = { class: "card total" }; const _hoisted_12 = { class: "header" }; const _hoisted_13 = { class: "value" }; const _sfc_main$1 = defineComponent({ __name: "ClaudeTokenUsage", props: { usage: {} }, setup(__props) { const props = __props; const stats = computed(() => { const u = props.usage; const inputTokens = u.input_tokens || 0; const cacheReadTokens = u.cache_read_input_tokens || 0; const cacheCreationTokens = u.cache_creation_input_tokens || 0; const outputTokens = u.output_tokens || 0; const totalTokens = inputTokens + outputTokens; const cacheReadPercent = inputTokens > 0 ? Math.round(cacheReadTokens / inputTokens * 100) : 0; return { input: { count: inputTokens, cacheRead: cacheReadTokens, cacheCreation: cacheCreationTokens, cacheReadPercent }, output: { count: outputTokens }, total: totalTokens }; }); const formatNum = (num) => num.toLocaleString(); const formatPercent = (percent) => `${percent}%`; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$1, [ createElementVNode("div", _hoisted_2$1, [ createElementVNode("div", _hoisted_3$1, [ _cache[0] || (_cache[0] = createElementVNode("span", { class: "label" }, "Input", -1)), createElementVNode("span", _hoisted_4$1, toDisplayString(formatNum(stats.value.input.count)), 1) ]), createElementVNode("div", _hoisted_5$1, [ stats.value.input.cacheRead > 0 ? (openBlock(), createElementBlock("div", _hoisted_6$1, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "dot" }, null, -1)), createElementVNode("span", null, "Cache Read: " + toDisplayString(formatNum(stats.value.input.cacheRead)) + " (" + toDisplayString(formatPercent(stats.value.input.cacheReadPercent)) + ")", 1) ])) : createCommentVNode("", true), stats.value.input.cacheCreation > 0 ? (openBlock(), createElementBlock("div", _hoisted_7$1, [ _cache[2] || (_cache[2] = createElementVNode("span", { class: "dot" }, null, -1)), createElementVNode("span", null, "Cache Write: " + toDisplayString(formatNum(stats.value.input.cacheCreation)), 1) ])) : createCommentVNode("", true) ]) ]), createElementVNode("div", _hoisted_8$1, [ createElementVNode("div", _hoisted_9$1, [ _cache[3] || (_cache[3] = createElementVNode("span", { class: "label" }, "Output", -1)), createElementVNode("span", _hoisted_10$1, toDisplayString(formatNum(stats.value.output.count)), 1) ]) ]), createElementVNode("div", _hoisted_11, [ createElementVNode("div", _hoisted_12, [ _cache[4] || (_cache[4] = createElementVNode("span", { class: "label" }, "Total", -1)), createElementVNode("span", _hoisted_13, toDisplayString(formatNum(stats.value.total)), 1) ]) ]) ]); }; } }); const ClaudeTokenUsage = _export_sfc(_sfc_main$1, [["__scopeId", "data-v-0d6d91b7"]]); const _hoisted_1 = { class: "claude-response-view" }; const _hoisted_2 = { class: "header" }; const _hoisted_3 = ["src"]; const _hoisted_4 = { class: "meta" }; const _hoisted_5 = { key: 0, class: "divider" }; const _hoisted_6 = { key: 1 }; const _hoisted_7 = { class: "error-content" }; const _hoisted_8 = { class: "error-type" }; const _hoisted_9 = { class: "error-message" }; const _hoisted_10 = { key: 0, class: "empty-state" }; const _sfc_main = defineComponent({ __name: "ClaudeResponseView", props: { data: {} }, setup(__props) { const props = __props; const contentBlocks = computed(() => props.data.content || []); const stopReasonDisplay = computed(() => { const reason = props.data.stop_reason; if (!reason) return "unknown"; return reason; }); const stopReasonClass = computed(() => { const reason = props.data.stop_reason; if (!reason) return ""; switch (reason) { case "end_turn": return "stop-end-turn"; case "max_tokens": return "stop-max-tokens"; case "stop_sequence": return "stop-sequence"; case "tool_use": return "stop-tool-use"; default: return ""; } }); const hasError = computed(() => { return props.data.error && props.data.error !== null; }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ createElementVNode("h2", null, [ createElementVNode("img", { src: unref(ClaudeIcon), class: "header-icon", alt: "Claude" }, null, 8, _hoisted_3), _cache[0] || (_cache[0] = createTextVNode(" Claude Messages API Response", -1)) ]), createElementVNode("div", _hoisted_4, [ createElementVNode("span", null, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "llm-label" }, "model", -1)), createElementVNode("code", null, toDisplayString(__props.data.model), 1) ]), _cache[3] || (_cache[3] = createElementVNode("span", { class: "divider" }, "·", -1)), createElementVNode("span", null, toDisplayString(contentBlocks.value.length) + " content blocks", 1), _cache[4] || (_cache[4] = createElementVNode("span", { class: "divider" }, "·", -1)), createElementVNode("span", null, [ _cache[2] || (_cache[2] = createTextVNode("stop: ", -1)), createElementVNode("span", { class: normalizeClass(["stop-reason", stopReasonClass.value]) }, toDisplayString(stopReasonDisplay.value), 3) ]), __props.data.usage ? (openBlock(), createElementBlock("span", _hoisted_5, "·")) : createCommentVNode("", true), __props.data.usage ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString((__props.data.usage.input_tokens + __props.data.usage.output_tokens).toLocaleString()) + " tokens", 1)) : createCommentVNode("", true) ]) ]), hasError.value ? (openBlock(), createBlock(CollapsibleSection, { key: 0, title: "Error", "default-open": true, "storage-key": "claude-response-error", variant: "error" }, { default: withCtx(() => [ createElementVNode("div", _hoisted_7, [ createElementVNode("div", _hoisted_8, toDisplayString(__props.data.error?.type), 1), createElementVNode("div", _hoisted_9, toDisplayString(__props.data.error?.message), 1) ]) ]), _: 1 })) : createCommentVNode("", true), createVNode(CollapsibleSection, { title: "Basic Info", "default-open": true, "storage-key": "claude-response-basic" }, { default: withCtx(() => [ createVNode(LabelValueRow, { label: "ID", value: __props.data.id }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Type", value: __props.data.type }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Role", value: __props.data.role }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Model", value: __props.data.model }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Stop Reason", value: __props.data.stop_reason }, null, 8, ["value"]), __props.data.stop_sequence ? (openBlock(), createBlock(LabelValueRow, { key: 0, label: "Stop Sequence", value: __props.data.stop_sequence }, null, 8, ["value"])) : createCommentVNode("", true) ]), _: 1 }), __props.data.usage ? (openBlock(), createBlock(CollapsibleSection, { key: 1, title: "Token Usage", "default-open": true, "storage-key": "claude-response-usage" }, { default: withCtx(() => [ createVNode(ClaudeTokenUsage, { usage: __props.data.usage }, null, 8, ["usage"]) ]), _: 1 })) : createCommentVNode("", true), createVNode(CollapsibleSection, { title: "Content Blocks", count: contentBlocks.value.length, "default-open": true, "storage-key": "claude-response-content", variant: "default" }, { default: withCtx(() => [ contentBlocks.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_10, " No content blocks ")) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(contentBlocks.value, (block, index) => { return openBlock(), createBlock(ClaudeResponseContentBlock, { key: index, block, index }, null, 8, ["block", "index"]); }), 128)) ]), _: 1 }, 8, ["count"]), createVNode(BetterDetails, { title: "Full Response" }, { default: withCtx(() => [ createVNode(SmartViewer, { text: JSON.stringify(__props.data, null, 2) }, null, 8, ["text"]) ]), _: 1 }) ]); }; } }); const ClaudeResponseView = exports("default", _export_sfc(_sfc_main, [["__scopeId", "data-v-ff5dfa37"]])); }) }; })); System.register("./GeminiRequestView-BE0LEHPc-COWphn4v.js", ['vue', './BetterDetails-BDkik7Go-BoTQ2MR3.js', './SubMessageItem-CDY-oINa-C9F6H7x7.js', './ImageBlock-DPbM__Ea-CdY7PxBB.js', './main-CBTFarNI-HX0H7eVT.js', './gemini-BkXZ0qKW-CQKs9TIJ.js'], (function (exports, module) { 'use strict'; var defineComponent, computed, openBlock, createElementBlock, createElementVNode, unref, createTextVNode, toDisplayString, createCommentVNode, createVNode, withCtx, createBlock, Fragment, renderList, normalizeClass, CollapsibleSection, LabelValueRow, SmartViewer, BetterDetails, hashId, ToolArgs, ToolItem, MessageItem, SubMessageItem, ImageBlock, _export_sfc, GeminiIcon; return { setters: [module => { defineComponent = module.defineComponent; computed = module.computed; openBlock = module.openBlock; createElementBlock = module.createElementBlock; createElementVNode = module.createElementVNode; unref = module.unref; createTextVNode = module.createTextVNode; toDisplayString = module.toDisplayString; createCommentVNode = module.createCommentVNode; createVNode = module.createVNode; withCtx = module.withCtx; createBlock = module.createBlock; Fragment = module.Fragment; renderList = module.renderList; normalizeClass = module.normalizeClass; }, module => { CollapsibleSection = module.C; LabelValueRow = module.L; SmartViewer = module.S; BetterDetails = module.B; hashId = module.h; ToolArgs = module.T; }, module => { ToolItem = module.T; MessageItem = module.M; SubMessageItem = module.S; }, module => { ImageBlock = module.I; }, module => { _export_sfc = module._; }, module => { GeminiIcon = module.G; }], execute: (function () { const _hoisted_1$3 = { class: "function-call" }; const _hoisted_2$3 = { class: "call-content" }; const _hoisted_3$3 = { class: "call-header" }; const _hoisted_4$3 = { class: "call-name" }; const _sfc_main$3 = defineComponent({ __name: "GeminiFunctionCall", props: { data: {} }, setup(__props) { return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$3, [ createElementVNode("div", _hoisted_2$3, [ createElementVNode("div", _hoisted_3$3, [ createElementVNode("span", _hoisted_4$3, toDisplayString(__props.data.name), 1) ]), createVNode(ToolArgs, { input: __props.data.args }, null, 8, ["input"]) ]) ]); }; } }); const GeminiFunctionCall = _export_sfc(_sfc_main$3, [["__scopeId", "data-v-7bbef335"]]); const _hoisted_1$2 = { class: "function-response" }; const _hoisted_2$2 = { class: "response-content" }; const _hoisted_3$2 = { class: "response-header" }; const _hoisted_4$2 = { class: "response-name" }; const _sfc_main$2 = defineComponent({ __name: "GeminiFunctionResponse", props: { data: {} }, setup(__props) { return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$2, [ createElementVNode("div", _hoisted_2$2, [ createElementVNode("div", _hoisted_3$2, [ createElementVNode("span", _hoisted_4$2, toDisplayString(__props.data.name), 1) ]), __props.data.response["content"] ? (openBlock(), createBlock(SmartViewer, { key: 0, text: __props.data.response["content"] }, null, 8, ["text"])) : createCommentVNode("", true) ]) ]); }; } }); const GeminiFunctionResponse = _export_sfc(_sfc_main$2, [["__scopeId", "data-v-1fe87f38"]]); const _hoisted_1$1 = { class: "message-content-flow" }; const _hoisted_2$1 = { key: 0, class: "empty-state" }; const _hoisted_3$1 = { key: 2, class: "file-part" }; const _hoisted_4$1 = { class: "file-info" }; const _hoisted_5$1 = { class: "file-uri" }; const _hoisted_6$1 = { class: "file-mime" }; const _hoisted_7$1 = { key: 5, class: "code-part" }; const _hoisted_8$1 = { class: "code-header" }; const _hoisted_9$1 = { class: "code-lang" }; const _hoisted_10$1 = { class: "code-content" }; const _hoisted_11$1 = { key: 6, class: "result-part" }; const _hoisted_12$1 = { class: "result-header" }; const _hoisted_13$1 = { class: "result-output" }; const _hoisted_14$1 = { key: 7, class: "part unknown-part" }; const _sfc_main$1 = defineComponent({ __name: "GeminiMessageItem", props: { id: {}, index: {}, content: {} }, setup(__props) { const props = __props; const msgHashId = computed(() => { const partCount = props.content.parts?.length ?? 0; return hashId(`${props.index}-${props.content.role}-parts-${partCount}`); }); const role = computed(() => props.content.role); const parts = computed(() => props.content.parts || []); const isTextPart = (part) => "text" in part; const isInlineDataPart = (part) => "inlineData" in part; const isFileDataPart = (part) => "fileData" in part; const isFunctionCallPart = (part) => "functionCall" in part; const isFunctionResponsePart = (part) => "functionResponse" in part; const isExecutableCodePart = (part) => "executableCode" in part; const isCodeExecutionResultPart = (part) => "codeExecutionResult" in part; const getInlineDataUrl = (part) => { return `data:${part.inlineData.mimeType};base64,${part.inlineData.data}`; }; const getBadgeInfo = (part) => { if (isTextPart(part)) return { type: "text", text: "TEXT" }; if (isInlineDataPart(part)) return { type: "image", text: "IMAGE" }; if (isFileDataPart(part)) return { type: "system", text: "FILE" }; if (isFunctionCallPart(part)) return { type: "tool", text: "FUNCTION_CALL" }; if (isFunctionResponsePart(part)) return { type: "tool", text: "FUNCTION_RESPONSE" }; if (isExecutableCodePart(part)) return { type: "thinking", text: "CODE" }; if (isCodeExecutionResultPart(part)) return { type: "thinking", text: "RESULT" }; return { type: "text", text: "UNKNOWN" }; }; return (_ctx, _cache) => { return openBlock(), createBlock(MessageItem, { count: parts.value.length, "data-for-raw": __props.content, id: __props.id, index: String(__props.index), role: role.value === "model" ? "model" : role.value, "storage-prefix": "gemini-msg" }, { default: withCtx(() => [ createElementVNode("div", _hoisted_1$1, [ parts.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_2$1, " No parts in this message ")) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(parts.value, (part, subIndex) => { return openBlock(), createBlock(SubMessageItem, { key: subIndex, "badge-type": getBadgeInfo(part).type, "badge-text": getBadgeInfo(part).text, id: `${msgHashId.value}-part-${subIndex}`, index: `${__props.index}-${subIndex + 1}`, "storage-prefix": "gemini-sub" }, { default: withCtx(() => [ isTextPart(part) ? (openBlock(), createBlock(SmartViewer, { key: 0, text: part.text }, null, 8, ["text"])) : isInlineDataPart(part) ? (openBlock(), createBlock(ImageBlock, { key: 1, url: getInlineDataUrl(part) }, null, 8, ["url"])) : isFileDataPart(part) ? (openBlock(), createElementBlock("div", _hoisted_3$1, [ createElementVNode("div", _hoisted_4$1, [ _cache[0] || (_cache[0] = createElementVNode("span", { class: "file-icon" }, "📎", -1)), createElementVNode("span", _hoisted_5$1, toDisplayString(part.fileData.fileUri), 1), createElementVNode("span", _hoisted_6$1, "(" + toDisplayString(part.fileData.mimeType) + ")", 1) ]) ])) : isFunctionCallPart(part) ? (openBlock(), createBlock(GeminiFunctionCall, { key: 3, data: part.functionCall }, null, 8, ["data"])) : isFunctionResponsePart(part) ? (openBlock(), createBlock(GeminiFunctionResponse, { key: 4, data: part.functionResponse }, null, 8, ["data"])) : isExecutableCodePart(part) ? (openBlock(), createElementBlock("div", _hoisted_7$1, [ createElementVNode("div", _hoisted_8$1, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "code-icon" }, "💻", -1)), createElementVNode("span", _hoisted_9$1, toDisplayString(part.executableCode.language), 1) ]), createElementVNode("pre", _hoisted_10$1, toDisplayString(part.executableCode.code), 1) ])) : isCodeExecutionResultPart(part) ? (openBlock(), createElementBlock("div", _hoisted_11$1, [ createElementVNode("div", _hoisted_12$1, [ _cache[2] || (_cache[2] = createElementVNode("span", { class: "result-icon" }, "📊", -1)), createElementVNode("span", { class: normalizeClass(["result-outcome", `outcome-${part.codeExecutionResult.outcome.toLowerCase()}`]) }, toDisplayString(part.codeExecutionResult.outcome), 3) ]), createElementVNode("pre", _hoisted_13$1, toDisplayString(part.codeExecutionResult.output), 1) ])) : (openBlock(), createElementBlock("div", _hoisted_14$1, [ createElementVNode("pre", null, toDisplayString(JSON.stringify(part, null, 2)), 1) ])) ]), _: 2 }, 1032, ["badge-type", "badge-text", "id", "index"]); }), 128)) ]) ]), _: 1 }, 8, ["count", "data-for-raw", "id", "index", "role"]); }; } }); const GeminiMessageItem = _export_sfc(_sfc_main$1, [["__scopeId", "data-v-84c0f87c"]]); const _hoisted_1 = { class: "gemini-request-view" }; const _hoisted_2 = { class: "header" }; const _hoisted_3 = ["src"]; const _hoisted_4 = { class: "meta" }; const _hoisted_5 = { key: 0 }; const _hoisted_6 = { key: 1 }; const _hoisted_7 = { key: 2 }; const _hoisted_8 = { key: 0, class: "divider" }; const _hoisted_9 = { key: 1 }; const _hoisted_10 = { key: 2, class: "divider" }; const _hoisted_11 = { class: "safety-settings-list" }; const _hoisted_12 = { class: "setting-category" }; const _hoisted_13 = { class: "setting-threshold" }; const _hoisted_14 = { key: 0, class: "empty-state" }; const _sfc_main = defineComponent({ __name: "GeminiRequestView", props: { data: {}, path: {} }, setup(__props) { const props = __props; const modelName = computed(() => { if (!props.path) return void 0; const path = props.path; const match = path.match(/\/models\/([^/:?]+)/); return match ? match[1] : void 0; }); const contents = computed(() => props.data.contents || []); const tools = computed(() => props.data.tools || []); const systemInstruction = computed(() => props.data.systemInstruction); const generationConfig = computed(() => props.data.generationConfig); const toolConfig = computed(() => props.data.toolConfig); const toolConfigDisplay = computed(() => { if (!toolConfig.value?.functionCallingConfig) return void 0; const mode = toolConfig.value.functionCallingConfig.mode; const allowed = toolConfig.value.functionCallingConfig.allowedFunctionNames; if (allowed && allowed.length > 0) { return `${mode} (${allowed.join(", ")})`; } return mode; }); const hasSystemInstruction = computed(() => { return systemInstruction.value && systemInstruction.value.parts.length > 0; }); const systemInstructionText = computed(() => { if (!systemInstruction.value) return ""; return systemInstruction.value.parts.filter((p) => "text" in p).map((p) => p.text).join("\n"); }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ createElementVNode("h2", null, [ createElementVNode("img", { src: unref(GeminiIcon), class: "header-icon", alt: "Gemini" }, null, 8, _hoisted_3), _cache[0] || (_cache[0] = createTextVNode(" Gemini API Request", -1)) ]), createElementVNode("div", _hoisted_4, [ createElementVNode("span", null, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "llm-label" }, "model", -1)), modelName.value ? (openBlock(), createElementBlock("code", _hoisted_5, toDisplayString(modelName.value), 1)) : __props.data.cachedContent ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(__props.data.cachedContent), 1)) : (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(contents.value.length) + " contents", 1)) ]), tools.value.length > 0 ? (openBlock(), createElementBlock("span", _hoisted_8, "·")) : createCommentVNode("", true), tools.value.length > 0 ? (openBlock(), createElementBlock("span", _hoisted_9, toDisplayString(tools.value.length) + " tools", 1)) : createCommentVNode("", true), hasSystemInstruction.value ? (openBlock(), createElementBlock("span", _hoisted_10, "·")) : createCommentVNode("", true) ]) ]), createVNode(CollapsibleSection, { title: "Parameters", "default-open": true, "storage-key": "gemini-parameters" }, { default: withCtx(() => [ createVNode(LabelValueRow, { label: "Temperature", value: generationConfig.value?.temperature }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Top P", value: generationConfig.value?.topP }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Top K", value: generationConfig.value?.topK }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Max Output Tokens", value: generationConfig.value?.maxOutputTokens }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Candidate Count", value: generationConfig.value?.candidateCount }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Response MimeType", value: generationConfig.value?.responseMimeType }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Presence Penalty", value: generationConfig.value?.presencePenalty }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Frequency Penalty", value: generationConfig.value?.frequencyPenalty }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Tool Config", value: toolConfigDisplay.value }, null, 8, ["value"]) ]), _: 1 }), __props.data.safetySettings && __props.data.safetySettings.length > 0 ? (openBlock(), createBlock(CollapsibleSection, { key: 0, title: "Safety Settings", count: __props.data.safetySettings.length, "default-open": false, "storage-key": "gemini-safety-settings" }, { default: withCtx(() => [ createElementVNode("div", _hoisted_11, [ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.data.safetySettings, (setting, idx) => { return openBlock(), createElementBlock("div", { key: idx, class: "safety-setting-item" }, [ createElementVNode("span", _hoisted_12, toDisplayString(setting.category), 1), _cache[2] || (_cache[2] = createElementVNode("span", { class: "setting-arrow" }, "→", -1)), createElementVNode("span", _hoisted_13, toDisplayString(setting.threshold), 1) ]); }), 128)) ]) ]), _: 1 }, 8, ["count"])) : createCommentVNode("", true), hasSystemInstruction.value ? (openBlock(), createBlock(CollapsibleSection, { key: 1, title: "System Instruction", "default-open": true, "storage-key": "gemini-system-instruction", variant: "system" }, { default: withCtx(() => [ createVNode(SmartViewer, { text: systemInstructionText.value }, null, 8, ["text"]) ]), _: 1 })) : createCommentVNode("", true), createVNode(CollapsibleSection, { title: "Contents", count: contents.value.length, "default-open": true, "storage-key": "gemini-contents", variant: "default", "enable-bulk-actions": "" }, { default: withCtx(() => [ contents.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_14, " No contents ")) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(contents.value, (content, index) => { return openBlock(), createBlock(GeminiMessageItem, { key: index, content, index: index + 1 }, null, 8, ["content", "index"]); }), 128)) ]), _: 1 }, 8, ["count"]), tools.value.length > 0 ? (openBlock(), createBlock(CollapsibleSection, { key: 2, title: "Tools", count: tools.value.reduce((acc, t) => acc + (t.functionDeclarations?.length || 0), 0), "storage-key": "gemini-tools", variant: "tools", "enable-bulk-actions": "" }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(tools.value, (tool, toolIdx) => { return openBlock(), createElementBlock(Fragment, { key: toolIdx }, [ (openBlock(true), createElementBlock(Fragment, null, renderList(tool.functionDeclarations, (func, funcIdx) => { return openBlock(), createBlock(ToolItem, { key: `${toolIdx}-${funcIdx}`, name: func.name, description: func.description, params: func.parameters, index: tools.value.slice(0, toolIdx).reduce((acc, t) => acc + (t.functionDeclarations?.length || 0), 0) + funcIdx, standard: "gemini" }, null, 8, ["name", "description", "params", "index"]); }), 128)) ], 64); }), 128)) ]), _: 1 }, 8, ["count"])) : createCommentVNode("", true), createVNode(BetterDetails, { title: "Full Request" }, { default: withCtx(() => [ createVNode(SmartViewer, { text: JSON.stringify(__props.data, null, 2) }, null, 8, ["text"]) ]), _: 1 }) ]); }; } }); const GeminiRequestView = exports("default", _export_sfc(_sfc_main, [["__scopeId", "data-v-e3739da4"]])); }) }; })); System.register("./GeminiResponseView-Ca9JEayb-UEo7uEpb.js", ['vue', './BetterDetails-BDkik7Go-BoTQ2MR3.js', './main-CBTFarNI-HX0H7eVT.js', './ImageBlock-DPbM__Ea-CdY7PxBB.js', './gemini-BkXZ0qKW-CQKs9TIJ.js'], (function (exports, module) { 'use strict'; var defineComponent, computed, openBlock, createElementBlock, createElementVNode, unref, createTextVNode, toDisplayString, createCommentVNode, normalizeClass, createBlock, withCtx, createVNode, Fragment, renderList, withDirectives, vShow, CollapsibleSection, LabelValueRow, BetterDetails, SmartViewer, useSessionStorage, ToolArgs, _export_sfc, ImageBlock, GeminiIcon; return { setters: [module => { defineComponent = module.defineComponent; computed = module.computed; openBlock = module.openBlock; createElementBlock = module.createElementBlock; createElementVNode = module.createElementVNode; unref = module.unref; createTextVNode = module.createTextVNode; toDisplayString = module.toDisplayString; createCommentVNode = module.createCommentVNode; normalizeClass = module.normalizeClass; createBlock = module.createBlock; withCtx = module.withCtx; createVNode = module.createVNode; Fragment = module.Fragment; renderList = module.renderList; withDirectives = module.withDirectives; vShow = module.vShow; }, module => { CollapsibleSection = module.C; LabelValueRow = module.L; BetterDetails = module.B; SmartViewer = module.S; useSessionStorage = module.u; ToolArgs = module.T; }, module => { _export_sfc = module._; }, module => { ImageBlock = module.I; }, module => { GeminiIcon = module.G; }], execute: (function () { const _hoisted_1$3 = { class: "token-usage" }; const _hoisted_2$3 = { class: "card input" }; const _hoisted_3$3 = { class: "header" }; const _hoisted_4$3 = { class: "value" }; const _hoisted_5$3 = { class: "details" }; const _hoisted_6$3 = { key: 0, class: "detail-item cache-hit" }; const _hoisted_7$3 = { class: "card output" }; const _hoisted_8$3 = { class: "header" }; const _hoisted_9$3 = { class: "value" }; const _hoisted_10$3 = { class: "details" }; const _hoisted_11$3 = { key: 0, class: "detail-item reasoning" }; const _hoisted_12$3 = { class: "card total" }; const _hoisted_13$2 = { class: "header" }; const _hoisted_14$2 = { class: "value" }; const _sfc_main$3 = defineComponent({ __name: "GeminiTokenUsage", props: { usage: {} }, setup(__props) { const props = __props; const stats = computed(() => { const u = props.usage; const inputTokens = u.promptTokenCount || 0; const cachedTokens = u.cachedContentTokenCount || 0; const cachedPercent = inputTokens > 0 ? Math.round(cachedTokens / inputTokens * 100) : 0; const outputTokens = u.candidatesTokenCount || 0; const reasoningTokens = u.thoughtsTokenCount || 0; const totalTokens = u.totalTokenCount || inputTokens + outputTokens; return { input: { count: inputTokens, cached: cachedTokens, cachedPercent }, output: { count: outputTokens, reasoning: reasoningTokens }, total: totalTokens }; }); const formatNum = (num) => num.toLocaleString(); const formatPercent = (percent) => `${percent}%`; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$3, [ createElementVNode("div", _hoisted_2$3, [ createElementVNode("div", _hoisted_3$3, [ _cache[0] || (_cache[0] = createElementVNode("span", { class: "label" }, "Input", -1)), createElementVNode("span", _hoisted_4$3, toDisplayString(formatNum(stats.value.input.count)), 1) ]), createElementVNode("div", _hoisted_5$3, [ stats.value.input.cached > 0 ? (openBlock(), createElementBlock("div", _hoisted_6$3, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "dot" }, null, -1)), createElementVNode("span", null, "Cached: " + toDisplayString(formatNum(stats.value.input.cached)) + " (" + toDisplayString(formatPercent(stats.value.input.cachedPercent)) + ")", 1) ])) : createCommentVNode("", true) ]) ]), createElementVNode("div", _hoisted_7$3, [ createElementVNode("div", _hoisted_8$3, [ _cache[2] || (_cache[2] = createElementVNode("span", { class: "label" }, "Output", -1)), createElementVNode("span", _hoisted_9$3, toDisplayString(formatNum(stats.value.output.count)), 1) ]), createElementVNode("div", _hoisted_10$3, [ stats.value.output.reasoning > 0 ? (openBlock(), createElementBlock("div", _hoisted_11$3, [ _cache[3] || (_cache[3] = createElementVNode("span", { class: "dot" }, null, -1)), createElementVNode("span", null, "Reasoning: " + toDisplayString(formatNum(stats.value.output.reasoning)), 1) ])) : createCommentVNode("", true) ]) ]), createElementVNode("div", _hoisted_12$3, [ createElementVNode("div", _hoisted_13$2, [ _cache[4] || (_cache[4] = createElementVNode("span", { class: "label" }, "Total", -1)), createElementVNode("span", _hoisted_14$2, toDisplayString(formatNum(stats.value.total)), 1) ]) ]) ]); }; } }); const GeminiTokenUsage = _export_sfc(_sfc_main$3, [["__scopeId", "data-v-c84da9b7"]]); const _hoisted_1$2 = { class: "block-header" }; const _hoisted_2$2 = { class: "header-left" }; const _hoisted_3$2 = { class: "block-index" }; const _hoisted_4$2 = { key: 0, class: "block-name" }; const _hoisted_5$2 = { key: 1, class: "block-name name-response" }; const _hoisted_6$2 = { class: "block-content" }; const _hoisted_7$2 = { class: "meta-label" }; const _hoisted_8$2 = { key: 2, class: "file-info" }; const _hoisted_9$2 = { class: "file-uri" }; const _hoisted_10$2 = { class: "meta-label" }; const _hoisted_11$2 = { key: 4, class: "code-block bg-light" }; const _hoisted_12$2 = { class: "sub-header text-blue" }; const _hoisted_13$1 = { class: "code-block bg-dark text-light" }; const _hoisted_14$1 = { class: "result-header" }; const _hoisted_15$1 = { class: "code-block bg-light" }; const _hoisted_16$1 = { key: 7, class: "unknown-block" }; const _sfc_main$2 = defineComponent({ __name: "GeminiPart", props: { part: {}, index: {} }, setup(__props) { const props = __props; const PART_CONFIG = { text: { label: "TEXT", class: "text" }, inlineData: { label: "MEDIA", class: "media" }, fileData: { label: "FILE", class: "file" }, functionCall: { label: "TOOL", class: "tool-use" }, functionResponse: { label: "RESP", class: "response" }, executableCode: { label: "CODE", class: "code" }, codeExecutionResult: { label: "RESULT", class: "result" }, unknown: { label: "UNKNOWN", class: "unknown" } }; const activeTypeKey = computed(() => { const keys = Object.keys(props.part); const foundKey = keys.find((k) => k in PART_CONFIG); return foundKey || "unknown"; }); const activeConfig = computed(() => PART_CONFIG[activeTypeKey.value]); const mediaUrl = computed(() => { if ("inlineData" in props.part) { return `data:${props.part.inlineData.mimeType};base64,${props.part.inlineData.data}`; } return ""; }); const toolInfo = computed(() => { if ("functionCall" in props.part) { return { name: props.part.functionCall.name, args: props.part.functionCall.args }; } return null; }); const prettyJson = (data) => JSON.stringify(data, null, 2); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass(["content-block", `type-${activeConfig.value.class}`]) }, [ createElementVNode("div", _hoisted_1$2, [ createElementVNode("div", _hoisted_2$2, [ createElementVNode("span", { class: normalizeClass(["block-type-badge", `badge-${activeConfig.value.class}`]) }, toDisplayString(activeConfig.value.label), 3), createElementVNode("span", _hoisted_3$2, "#" + toDisplayString(__props.index + 1), 1), toolInfo.value?.name ? (openBlock(), createElementBlock("span", _hoisted_4$2, toDisplayString(toolInfo.value.name), 1)) : createCommentVNode("", true), activeTypeKey.value === "functionResponse" ? (openBlock(), createElementBlock("span", _hoisted_5$2, toDisplayString(__props.part.functionResponse.name), 1)) : createCommentVNode("", true) ]) ]), createElementVNode("div", _hoisted_6$2, [ activeTypeKey.value === "text" ? (openBlock(), createBlock(SmartViewer, { key: 0, text: __props.part.text }, null, 8, ["text"])) : activeTypeKey.value === "inlineData" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [ createElementVNode("div", _hoisted_7$2, toDisplayString(__props.part.inlineData.mimeType), 1), createVNode(ImageBlock, { url: mediaUrl.value }, null, 8, ["url"]) ], 64)) : activeTypeKey.value === "fileData" ? (openBlock(), createElementBlock("div", _hoisted_8$2, [ _cache[0] || (_cache[0] = createElementVNode("span", { class: "file-icon" }, "📎", -1)), createElementVNode("span", _hoisted_9$2, toDisplayString(__props.part.fileData.fileUri), 1), createElementVNode("span", _hoisted_10$2, "(" + toDisplayString(__props.part.fileData.mimeType) + ")", 1) ])) : activeTypeKey.value === "functionCall" && toolInfo.value ? (openBlock(), createBlock(ToolArgs, { key: 3, input: toolInfo.value.args }, null, 8, ["input"])) : activeTypeKey.value === "functionResponse" ? (openBlock(), createElementBlock("pre", _hoisted_11$2, toDisplayString(prettyJson(__props.part.functionResponse.response)), 1)) : activeTypeKey.value === "executableCode" ? (openBlock(), createElementBlock(Fragment, { key: 5 }, [ createElementVNode("div", _hoisted_12$2, toDisplayString(__props.part.executableCode.language), 1), createElementVNode("pre", _hoisted_13$1, toDisplayString(__props.part.executableCode.code), 1) ], 64)) : activeTypeKey.value === "codeExecutionResult" ? (openBlock(), createElementBlock(Fragment, { key: 6 }, [ createElementVNode("div", _hoisted_14$1, [ createElementVNode("span", { class: normalizeClass(["outcome-badge", __props.part.codeExecutionResult.outcome.toLowerCase()]) }, toDisplayString(__props.part.codeExecutionResult.outcome), 3) ]), createElementVNode("pre", _hoisted_15$1, toDisplayString(__props.part.codeExecutionResult.output), 1) ], 64)) : (openBlock(), createElementBlock("div", _hoisted_16$1, [ createVNode(SmartViewer, { text: prettyJson(__props.part) }, null, 8, ["text"]) ])) ]) ], 2); }; } }); const GeminiPart = _export_sfc(_sfc_main$2, [["__scopeId", "data-v-917c489e"]]); const _hoisted_1$1 = { class: "header-left" }; const _hoisted_2$1 = { class: "toggle" }; const _hoisted_3$1 = { class: "index" }; const _hoisted_4$1 = ["title"]; const _hoisted_5$1 = { class: "header-right" }; const _hoisted_6$1 = { key: 0, class: "citation-count" }; const _hoisted_7$1 = { key: 1, class: "token-count" }; const _hoisted_8$1 = { class: "candidate-content" }; const _hoisted_9$1 = { key: 0, class: "parts-section" }; const _hoisted_10$1 = { key: 1, class: "grounding-section" }; const _hoisted_11$1 = { key: 0, class: "grounding-chunks" }; const _hoisted_12$1 = ["href"]; const _hoisted_13 = { key: 1, class: "chunk-context" }; const _hoisted_14 = { key: 2, class: "safety-section" }; const _hoisted_15 = { class: "section-title" }; const _hoisted_16 = { class: "safety-list" }; const _hoisted_17 = { class: "safety-category" }; const _hoisted_18 = { key: 0, class: "blocked-badge" }; const _sfc_main$1 = defineComponent({ __name: "GeminiCandidate", props: { candidate: {}, index: {} }, setup(__props) { const props = __props; const storageKey = computed(() => `gemini-candidate-${props.index}-open`); const isOpen = useSessionStorage(storageKey, true); const parts = computed(() => props.candidate.content?.parts || []); const finishReasonClass = computed(() => { const reason = props.candidate.finishReason?.toLowerCase(); if (!reason) return ""; if (reason === "stop") return "finish-stop"; if (reason === "max_tokens") return "finish-length"; if (reason === "safety") return "finish-safety"; if (reason === "recitation") return "finish-recitation"; if (reason === "other") return "finish-other"; return ""; }); const citationCount = computed(() => { return props.candidate.citationMetadata?.citationSources?.length || 0; }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass(["candidate", { "is-open": unref(isOpen) }]) }, [ createElementVNode("div", { class: "candidate-header", onClick: _cache[0] || (_cache[0] = ($event) => isOpen.value = !unref(isOpen)) }, [ createElementVNode("div", _hoisted_1$1, [ createElementVNode("span", _hoisted_2$1, toDisplayString(unref(isOpen) ? "▼" : "▶"), 1), createElementVNode("span", _hoisted_3$1, "#" + toDisplayString(__props.index), 1), __props.candidate.finishReason ? (openBlock(), createElementBlock("span", { key: 0, class: normalizeClass(["finish-reason", finishReasonClass.value]), title: __props.candidate.finishMessage }, toDisplayString(__props.candidate.finishReason), 11, _hoisted_4$1)) : createCommentVNode("", true) ]), createElementVNode("div", _hoisted_5$1, [ citationCount.value > 0 ? (openBlock(), createElementBlock("span", _hoisted_6$1, toDisplayString(citationCount.value) + " citation(s)", 1)) : createCommentVNode("", true), __props.candidate.tokenCount ? (openBlock(), createElementBlock("span", _hoisted_7$1, toDisplayString(__props.candidate.tokenCount) + " tokens", 1)) : createCommentVNode("", true) ]) ]), withDirectives(createElementVNode("div", _hoisted_8$1, [ parts.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_9$1, [ (openBlock(true), createElementBlock(Fragment, null, renderList(parts.value, (part, idx) => { return openBlock(), createBlock(GeminiPart, { key: idx, part, index: idx }, null, 8, ["part", "index"]); }), 128)) ])) : createCommentVNode("", true), __props.candidate.groundingMetadata ? (openBlock(), createElementBlock("div", _hoisted_10$1, [ _cache[1] || (_cache[1] = createElementVNode("div", { class: "section-title" }, "Grounding", -1)), __props.candidate.groundingMetadata.groundingChunks?.length ? (openBlock(), createElementBlock("div", _hoisted_11$1, [ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.candidate.groundingMetadata.groundingChunks, (chunk, idx) => { return openBlock(), createElementBlock("div", { key: idx, class: "grounding-chunk" }, [ chunk.web?.uri ? (openBlock(), createElementBlock("a", { key: 0, href: chunk.web.uri, target: "_blank", class: "chunk-link" }, toDisplayString(chunk.web.title || chunk.web.uri), 9, _hoisted_12$1)) : chunk.retrievedContext ? (openBlock(), createElementBlock("span", _hoisted_13, toDisplayString(chunk.retrievedContext.title), 1)) : createCommentVNode("", true) ]); }), 128)) ])) : createCommentVNode("", true) ])) : createCommentVNode("", true), __props.candidate.safetyRatings?.length ? (openBlock(), createElementBlock("div", _hoisted_14, [ createElementVNode("div", _hoisted_15, "Safety Ratings (" + toDisplayString(__props.candidate.safetyRatings.length) + ")", 1), createElementVNode("div", _hoisted_16, [ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.candidate.safetyRatings, (rating, idx) => { return openBlock(), createElementBlock("div", { key: idx, class: normalizeClass(["safety-item", { "is-blocked": rating.blocked }]) }, [ createElementVNode("span", _hoisted_17, toDisplayString(rating.category), 1), createElementVNode("span", { class: normalizeClass(["safety-probability", `prob-${rating.probability.toLowerCase()}`]) }, toDisplayString(rating.probability), 3), rating.blocked ? (openBlock(), createElementBlock("span", _hoisted_18, "BLOCKED")) : createCommentVNode("", true) ], 2); }), 128)) ]) ])) : createCommentVNode("", true) ], 512), [ [vShow, unref(isOpen)] ]) ], 2); }; } }); const GeminiCandidate = _export_sfc(_sfc_main$1, [["__scopeId", "data-v-93faa5c5"]]); const _hoisted_1 = { class: "gemini-response-view" }; const _hoisted_2 = { class: "header" }; const _hoisted_3 = ["src"]; const _hoisted_4 = { class: "meta" }; const _hoisted_5 = { key: 0 }; const _hoisted_6 = { key: 1 }; const _hoisted_7 = { key: 0, class: "divider" }; const _hoisted_8 = { key: 1 }; const _hoisted_9 = { key: 0, class: "safety-list" }; const _hoisted_10 = { class: "safety-category" }; const _hoisted_11 = { key: 0, class: "blocked-badge" }; const _hoisted_12 = { key: 0, class: "empty-state" }; const _sfc_main = defineComponent({ __name: "GeminiResponseView", props: { data: {} }, setup(__props) { const props = __props; const candidates = computed(() => props.data.candidates || []); const totalTokens = computed(() => { return props.data.usageMetadata?.totalTokenCount || 0; }); const finishReasonClass = (reason) => { if (!reason) return ""; const r = reason.toLowerCase(); if (r === "stop") return "finish-stop"; if (r === "max_tokens") return "finish-length"; if (r === "safety") return "finish-safety"; if (r === "recitation") return "finish-recitation"; if (r === "other") return "finish-other"; return ""; }; const getFinishReasonSummary = () => { const reasons = candidates.value.map((c) => c.finishReason).filter((r) => !!r); if (reasons.length === 0) return ""; const unique = [...new Set(reasons)]; return unique.join(", "); }; const promptFeedbackInfo = computed(() => { if (!props.data.promptFeedback) return null; return { blockReason: props.data.promptFeedback.blockReason, safetyRatingsCount: props.data.promptFeedback.safetyRatings?.length || 0 }; }); const hasSafetyBlock = computed(() => { return candidates.value.some( (c) => c.finishReason?.toLowerCase() === "safety" || c.finishReason?.toLowerCase() === "recitation" ); }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ createElementVNode("h2", null, [ createElementVNode("img", { src: unref(GeminiIcon), class: "header-icon", alt: "Gemini" }, null, 8, _hoisted_3), _cache[0] || (_cache[0] = createTextVNode(" Gemini API Response", -1)) ]), createElementVNode("div", _hoisted_4, [ createElementVNode("span", null, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "llm-label" }, "model", -1)), __props.data.modelVersion ? (openBlock(), createElementBlock("code", _hoisted_5, toDisplayString(__props.data.modelVersion), 1)) : (openBlock(), createElementBlock("span", _hoisted_6, "Unknown Model")) ]), _cache[3] || (_cache[3] = createElementVNode("span", { class: "divider" }, "·", -1)), createElementVNode("span", null, toDisplayString(totalTokens.value.toLocaleString()) + " tokens", 1), getFinishReasonSummary() ? (openBlock(), createElementBlock("span", _hoisted_7, "·")) : createCommentVNode("", true), getFinishReasonSummary() ? (openBlock(), createElementBlock("span", _hoisted_8, [ _cache[2] || (_cache[2] = createTextVNode(" finish: ", -1)), createElementVNode("span", { class: normalizeClass(["finish-summary", finishReasonClass(getFinishReasonSummary())]) }, toDisplayString(getFinishReasonSummary()), 3) ])) : createCommentVNode("", true) ]) ]), hasSafetyBlock.value ? (openBlock(), createBlock(CollapsibleSection, { key: 0, title: "Safety Block Detected", "default-open": true, "storage-key": "gemini-safety-block", variant: "error" }, { default: withCtx(() => [..._cache[4] || (_cache[4] = [ createElementVNode("div", { class: "safety-warning" }, [ createElementVNode("div", { class: "warning-title" }, "Content generation was blocked"), createElementVNode("div", { class: "warning-text" }, " One or more candidates were blocked due to safety settings or recitation policy. Check individual candidate details for more information. ") ], -1) ])]), _: 1 })) : createCommentVNode("", true), promptFeedbackInfo.value ? (openBlock(), createBlock(CollapsibleSection, { key: 1, title: "Prompt Feedback", "default-open": true, "storage-key": "gemini-prompt-feedback", variant: "system" }, { default: withCtx(() => [ createVNode(LabelValueRow, { label: "Block Reason", value: promptFeedbackInfo.value.blockReason || "None", formatter: (v) => v === "None" ? "Not blocked" : String(v) }, null, 8, ["value", "formatter"]), __props.data.promptFeedback?.safetyRatings?.length ? (openBlock(), createElementBlock("div", _hoisted_9, [ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.data.promptFeedback.safetyRatings, (rating, idx) => { return openBlock(), createElementBlock("div", { key: idx, class: normalizeClass(["safety-item", { "is-blocked": rating.blocked }]) }, [ createElementVNode("span", _hoisted_10, toDisplayString(rating.category), 1), createElementVNode("span", { class: normalizeClass(["safety-probability", `prob-${rating.probability.toLowerCase()}`]) }, toDisplayString(rating.probability), 3), rating.blocked ? (openBlock(), createElementBlock("span", _hoisted_11, "BLOCKED")) : createCommentVNode("", true) ], 2); }), 128)) ])) : createCommentVNode("", true) ]), _: 1 })) : createCommentVNode("", true), __props.data.usageMetadata ? (openBlock(), createBlock(CollapsibleSection, { key: 2, title: "Token Usage", "default-open": true, "storage-key": "gemini-token-usage" }, { default: withCtx(() => [ createVNode(GeminiTokenUsage, { usage: __props.data.usageMetadata }, null, 8, ["usage"]) ]), _: 1 })) : createCommentVNode("", true), createVNode(CollapsibleSection, { title: "Candidates", count: candidates.value.length, "default-open": true, "storage-key": "gemini-candidates", variant: "default" }, { default: withCtx(() => [ candidates.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_12, " No candidates ")) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(candidates.value, (candidate) => { return openBlock(), createBlock(GeminiCandidate, { key: candidate.index, candidate, index: candidate.index, "finish-reason-class": finishReasonClass, "show-header": candidates.value.length > 1 }, null, 8, ["candidate", "index", "show-header"]); }), 128)) ]), _: 1 }, 8, ["count"]), createVNode(CollapsibleSection, { title: "Response Info", "default-open": false, "storage-key": "gemini-response-info" }, { default: withCtx(() => [ createVNode(LabelValueRow, { label: "Model Version", value: __props.data.modelVersion }, null, 8, ["value"]), createVNode(LabelValueRow, { label: "Response ID", value: __props.data.responseId }, null, 8, ["value"]) ]), _: 1 }), createVNode(BetterDetails, { title: "Full Response" }, { default: withCtx(() => [ createVNode(SmartViewer, { text: JSON.stringify(__props.data, null, 2) }, null, 8, ["text"]) ]), _: 1 }) ]); }; } }); const GeminiResponseView = exports("default", _export_sfc(_sfc_main, [["__scopeId", "data-v-e869ebc9"]])); }) }; })); System.register("./OpenaiAssistantToolCalls-ASy2xv7a-D4h2FAmn.js", ['vue', './BetterDetails-BDkik7Go-BoTQ2MR3.js', './main-CBTFarNI-HX0H7eVT.js'], (function (exports, module) { 'use strict'; var defineComponent, ref, openBlock, createElementBlock, createElementVNode, toDisplayString, createBlock, Fragment, renderList, withModifiers, createVNode, JsonViewer, ToolArgs, _export_sfc; return { setters: [module => { defineComponent = module.defineComponent; ref = module.ref; openBlock = module.openBlock; createElementBlock = module.createElementBlock; createElementVNode = module.createElementVNode; toDisplayString = module.toDisplayString; createBlock = module.createBlock; Fragment = module.Fragment; renderList = module.renderList; withModifiers = module.withModifiers; createVNode = module.createVNode; }, module => { JsonViewer = module.J; ToolArgs = module.T; }, module => { _export_sfc = module._; }], execute: (function () { const _hoisted_1 = { class: "tool-calls" }; const _hoisted_2 = { class: "raw-button-wrapper" }; const _hoisted_3 = { key: 1, class: "tool-requests" }; const _hoisted_4 = { class: "tool-request-header" }; const _hoisted_5 = { class: "tool-idx" }; const _hoisted_6 = ["onClick"]; const _hoisted_7 = ["id", "onClick"]; const _sfc_main = defineComponent({ __name: "OpenaiAssistantToolCalls", props: { toolCalls: {} }, setup(__props) { const showRaw = ref(false); function scrollTo(selector) { document.querySelector(selector)?.scrollIntoView({ behavior: "smooth" }); } return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ createElementVNode("button", { class: "view-raw-btn", onClick: _cache[0] || (_cache[0] = ($event) => showRaw.value = !showRaw.value) }, toDisplayString(showRaw.value ? "▼" : "▶") + " Raw ", 1) ]), showRaw.value ? (openBlock(), createBlock(JsonViewer, { key: 0, content: __props.toolCalls }, null, 8, ["content"])) : (openBlock(), createElementBlock("div", _hoisted_3, [ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.toolCalls, (req, idx) => { return openBlock(), createElementBlock("div", { key: req.id, class: "tool-request" }, [ createElementVNode("div", _hoisted_4, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "badge-call" }, "tool_call", -1)), createElementVNode("span", _hoisted_5, "#" + toDisplayString(idx + 1), 1), createElementVNode("a", { class: "tool-fn clickable", onClick: withModifiers(($event) => scrollTo(`#tool-def-${req.function.name}`), ["prevent"]) }, toDisplayString(req.function.name), 9, _hoisted_6), createElementVNode("a", { id: `tool-request-${req.id}`, class: "tool-id clickable", onClick: withModifiers(($event) => scrollTo(`#tool-response-${req.id}`), ["prevent"]) }, toDisplayString(req.id), 9, _hoisted_7) ]), createVNode(ToolArgs, { arguments: req.function.arguments }, null, 8, ["arguments"]) ]); }), 128)) ])) ]); }; } }); const OpenaiAssistantToolCalls = exports("O", _export_sfc(_sfc_main, [["__scopeId", "data-v-c91d1315"]])); }) }; })); System.register("./OpenaiTokenUsage-BDr-HLbW-CjGmC_HL.js", ['vue', './main-CBTFarNI-HX0H7eVT.js'], (function (exports, module) { 'use strict'; var defineComponent, computed, openBlock, createElementBlock, createElementVNode, toDisplayString, createCommentVNode, _export_sfc; return { setters: [module => { defineComponent = module.defineComponent; computed = module.computed; openBlock = module.openBlock; createElementBlock = module.createElementBlock; createElementVNode = module.createElementVNode; toDisplayString = module.toDisplayString; createCommentVNode = module.createCommentVNode; }, module => { _export_sfc = module._; }], execute: (function () { const _hoisted_1 = { class: "token-usage" }; const _hoisted_2 = { class: "card input" }; const _hoisted_3 = { class: "header" }; const _hoisted_4 = { class: "value" }; const _hoisted_5 = { class: "details" }; const _hoisted_6 = { key: 0, class: "detail-item cache-hit" }; const _hoisted_7 = { key: 1, class: "detail-item" }; const _hoisted_8 = { key: 2, class: "detail-item" }; const _hoisted_9 = { class: "card output" }; const _hoisted_10 = { class: "header" }; const _hoisted_11 = { class: "value" }; const _hoisted_12 = { class: "details" }; const _hoisted_13 = { key: 0, class: "detail-item reasoning" }; const _hoisted_14 = { key: 1, class: "detail-item" }; const _hoisted_15 = { class: "card total" }; const _hoisted_16 = { class: "header" }; const _hoisted_17 = { class: "value" }; const _hoisted_18 = { key: 0, class: "details" }; const _hoisted_19 = { class: "detail-item cache-write" }; const _sfc_main = defineComponent({ __name: "OpenaiTokenUsage", props: { usage: {} }, setup(__props) { const props = __props; const stats = computed(() => { const u = props.usage; const promptTotal = u.prompt_tokens || u.input_tokens || 0; const promptDetails = u.prompt_tokens_details || u.input_tokens_details || {}; const completionTotal = u.completion_tokens || u.output_tokens || 0; const completionDetails = u.completion_tokens_details || u.output_tokens_details || {}; const total = u.total_tokens || promptTotal + completionTotal; const cacheCreation = (u.claude_cache_creation_5_m_tokens || 0) + (u.claude_cache_creation_1_h_tokens || 0); const calcPercent = (value, total2) => { if (total2 === 0) return 0; return Math.round(value / total2 * 100); }; const promptStats = { count: promptTotal, cached: promptDetails.cached_tokens || 0, audio: promptDetails.audio_tokens || 0, image: promptDetails.image_tokens || 0, cachedPercent: calcPercent(promptDetails.cached_tokens || 0, promptTotal) }; const completionStats = { count: completionTotal, reasoning: completionDetails.reasoning_tokens || 0, audio: completionDetails.audio_tokens || 0 }; return { total, prompt: promptStats, completion: completionStats, cacheCreation, hasCacheWrite: cacheCreation > 0 }; }); const formatNum = (num) => num.toLocaleString(); const formatPercent = (percent) => `${percent}%`; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, [ createElementVNode("div", _hoisted_3, [ _cache[0] || (_cache[0] = createElementVNode("span", { class: "label" }, "Input", -1)), createElementVNode("span", _hoisted_4, toDisplayString(formatNum(stats.value.prompt.count)), 1) ]), createElementVNode("div", _hoisted_5, [ stats.value.prompt.cached > 0 ? (openBlock(), createElementBlock("div", _hoisted_6, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "dot" }, null, -1)), createElementVNode("span", null, "Cached: " + toDisplayString(formatNum(stats.value.prompt.cached)) + " (" + toDisplayString(formatPercent(stats.value.prompt.cachedPercent)) + ")", 1) ])) : createCommentVNode("", true), stats.value.prompt.audio > 0 ? (openBlock(), createElementBlock("div", _hoisted_7, [ _cache[2] || (_cache[2] = createElementVNode("span", { class: "dot audio" }, null, -1)), createElementVNode("span", null, "Audio: " + toDisplayString(formatNum(stats.value.prompt.audio)), 1) ])) : createCommentVNode("", true), stats.value.prompt.image > 0 ? (openBlock(), createElementBlock("div", _hoisted_8, [ _cache[3] || (_cache[3] = createElementVNode("span", { class: "dot image" }, null, -1)), createElementVNode("span", null, "Image: " + toDisplayString(formatNum(stats.value.prompt.image)), 1) ])) : createCommentVNode("", true) ]) ]), createElementVNode("div", _hoisted_9, [ createElementVNode("div", _hoisted_10, [ _cache[4] || (_cache[4] = createElementVNode("span", { class: "label" }, "Output", -1)), createElementVNode("span", _hoisted_11, toDisplayString(formatNum(stats.value.completion.count)), 1) ]), createElementVNode("div", _hoisted_12, [ stats.value.completion.reasoning > 0 ? (openBlock(), createElementBlock("div", _hoisted_13, [ _cache[5] || (_cache[5] = createElementVNode("span", { class: "dot" }, null, -1)), createElementVNode("span", null, "Reasoning: " + toDisplayString(formatNum(stats.value.completion.reasoning)), 1) ])) : createCommentVNode("", true), stats.value.completion.audio > 0 ? (openBlock(), createElementBlock("div", _hoisted_14, [ _cache[6] || (_cache[6] = createElementVNode("span", { class: "dot audio" }, null, -1)), createElementVNode("span", null, "Audio: " + toDisplayString(formatNum(stats.value.completion.audio)), 1) ])) : createCommentVNode("", true) ]) ]), createElementVNode("div", _hoisted_15, [ createElementVNode("div", _hoisted_16, [ _cache[7] || (_cache[7] = createElementVNode("span", { class: "label" }, "Total", -1)), createElementVNode("span", _hoisted_17, toDisplayString(formatNum(stats.value.total)), 1) ]), stats.value.hasCacheWrite ? (openBlock(), createElementBlock("div", _hoisted_18, [ createElementVNode("div", _hoisted_19, [ _cache[8] || (_cache[8] = createElementVNode("span", { class: "dot" }, null, -1)), createElementVNode("span", null, "Cache Write: " + toDisplayString(formatNum(stats.value.cacheCreation)), 1) ]) ])) : createCommentVNode("", true) ]) ]); }; } }); const OpenaiTokenUsage = exports("O", _export_sfc(_sfc_main, [["__scopeId", "data-v-6f83fb0d"]])); }) }; })); System.register("./OpenaiResponseToolItem.vue_vue_type_script_setup_true_lang-CvtaN2bd-BDeuAnGN.js", ['vue', './BetterDetails-BDkik7Go-BoTQ2MR3.js', './ImageBlock-DPbM__Ea-CdY7PxBB.js', './SubMessageItem-CDY-oINa-C9F6H7x7.js', './main-CBTFarNI-HX0H7eVT.js'], (function (exports, module) { 'use strict'; var defineComponent, computed, openBlock, createBlock, createElementBlock, createVNode, withCtx, createElementVNode, Fragment, createCommentVNode, renderList, createTextVNode, toDisplayString, withModifiers, hashId, SmartViewer, ToolArgs, ImageBlock, ToolItem, MessageItem, SubMessageItem, _export_sfc; return { setters: [module => { defineComponent = module.defineComponent; computed = module.computed; openBlock = module.openBlock; createBlock = module.createBlock; createElementBlock = module.createElementBlock; createVNode = module.createVNode; withCtx = module.withCtx; createElementVNode = module.createElementVNode; Fragment = module.Fragment; createCommentVNode = module.createCommentVNode; renderList = module.renderList; createTextVNode = module.createTextVNode; toDisplayString = module.toDisplayString; withModifiers = module.withModifiers; }, module => { hashId = module.h; SmartViewer = module.S; ToolArgs = module.T; }, module => { ImageBlock = module.I; }, module => { ToolItem = module.T; MessageItem = module.M; SubMessageItem = module.S; }, module => { _export_sfc = module._; }], execute: (function () { const _hoisted_1 = ["id"]; const _hoisted_2 = { class: "input-item-body" }; const _hoisted_3 = { key: 0, class: "empty-state" }; const _hoisted_4 = { key: 1, class: "meta-note" }; const _hoisted_5 = { key: 1, class: "meta-note" }; const _hoisted_6 = { class: "call-header" }; const _hoisted_7 = { class: "call-name" }; const _hoisted_8 = { class: "call-header" }; const _hoisted_9 = { class: "call-header" }; const _hoisted_10 = { class: "call-name" }; const _hoisted_11 = { key: 0, class: "status-badge" }; const _hoisted_12 = { class: "call-header" }; const _sfc_main$1 = defineComponent({ __name: "OpenaiResponseInputItem", props: { id: {}, item: {}, index: {}, storagePrefix: { default: "openai-response-input" }, storageSubPrefix: { default: "openai-response-input-sub" } }, setup(__props) { const props = __props; const isMessageItem = (item) => item.type === "message"; const isReasoningItem = (item) => item.type === "reasoning"; const isFunctionCallItem = (item) => item.type === "function_call"; const isFunctionCallOutputItem = (item) => item.type === "function_call_output"; const isCustomToolCallItem = (item) => item.type === "custom_tool_call"; const isCustomToolCallOutputItem = (item) => item.type === "custom_tool_call_output"; const stringifyUnknown = (value) => { if (typeof value === "string") return value; if (value === void 0) return ""; try { return JSON.stringify(value, null, 2); } catch { return String(value); } }; const itemRole = computed(() => { if (isMessageItem(props.item)) return props.item.role; if (isReasoningItem(props.item)) return "assistant"; if (isFunctionCallItem(props.item) || isCustomToolCallItem(props.item)) return "assistant"; if (isFunctionCallOutputItem(props.item) || isCustomToolCallOutputItem(props.item)) return "tool"; return "system"; }); const getContentItemView = (contentItem, idx) => { if (contentItem.type === "input_text" || contentItem.type === "output_text" || contentItem.type === "summary_text") { return { id: `content-${idx}`, badgeType: "text", badgeText: contentItem.type.toUpperCase(), text: typeof contentItem.text === "string" ? contentItem.text : "" }; } if (contentItem.type === "input_image") { return { id: `content-${idx}`, badgeType: "image", badgeText: "INPUT_IMAGE", imageUrl: typeof contentItem.image_url === "string" ? contentItem.image_url : void 0, raw: contentItem }; } if (contentItem.type === "input_file") { const fileText = [ contentItem.file_id ? `file_id: ${contentItem.file_id}` : "", contentItem.filename ? `filename: ${contentItem.filename}` : "" ].filter(Boolean).join("\n"); return { id: `content-${idx}`, badgeType: "system", badgeText: "INPUT_FILE", text: fileText || stringifyUnknown(contentItem), raw: contentItem }; } return { id: `content-${idx}`, badgeType: "text", badgeText: contentItem.type.toUpperCase(), text: stringifyUnknown(contentItem), raw: contentItem }; }; const messageContentItems = computed(() => { if (!isMessageItem(props.item)) return []; const content = props.item.content; if (typeof content === "string") { return [ { id: "content-0", badgeType: "text", badgeText: "TEXT", text: content } ]; } if (Array.isArray(content)) { return content.map((contentItem, idx) => getContentItemView(contentItem, idx)); } return []; }); const reasoningSummaries = computed(() => { if (!isReasoningItem(props.item)) return []; return props.item.summary || []; }); const hasReasoningContent = computed(() => { if (!isReasoningItem(props.item)) return false; return props.item.content !== null && props.item.content !== void 0; }); const hasEncryptedReasoning = computed(() => { if (!isReasoningItem(props.item)) return false; return typeof props.item.encrypted_content === "string" && props.item.encrypted_content.length > 0; }); const callId = computed(() => { if ("call_id" in props.item && typeof props.item.call_id === "string") { return props.item.call_id; } return null; }); const callHash = computed(() => { if (!callId.value) return null; return hashId(callId.value); }); const callAnchorId = computed(() => { if (!callHash.value) return null; return `openai-response-call-${callHash.value}`; }); const outputAnchorId = computed(() => { if (!callHash.value) return null; return `openai-response-output-${callHash.value}`; }); const containerDomId = computed(() => { if (isFunctionCallItem(props.item) || isCustomToolCallItem(props.item)) { return callAnchorId.value || `openai-response-input-${props.id}`; } if (isFunctionCallOutputItem(props.item) || isCustomToolCallOutputItem(props.item)) { return outputAnchorId.value || `openai-response-input-${props.id}`; } return `openai-response-input-${props.id}`; }); const itemCount = computed(() => { if (isMessageItem(props.item)) return messageContentItems.value.length; if (isReasoningItem(props.item)) return reasoningSummaries.value.length + (hasReasoningContent.value ? 1 : 0); return 1; }); const functionCallArguments = computed(() => { if (!isFunctionCallItem(props.item)) return ""; return props.item.arguments; }); const functionCallOutputText = computed(() => { if (!isFunctionCallOutputItem(props.item)) return ""; return stringifyUnknown(props.item.output); }); const customToolCallArguments = computed(() => { if (!isCustomToolCallItem(props.item)) return ""; const input = props.item.input; if (typeof input === "string") return input; if (input && typeof input === "object") return input; return stringifyUnknown(input); }); const customToolCallOutputText = computed(() => { if (!isCustomToolCallOutputItem(props.item)) return ""; return stringifyUnknown(props.item.output); }); const scrollToId = (targetId) => { if (!targetId) return; document.getElementById(targetId)?.scrollIntoView({ behavior: "smooth", block: "center" }); }; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { id: containerDomId.value }, [ createVNode(MessageItem, { id: __props.id, index: String(__props.index), role: itemRole.value, count: itemCount.value, "data-for-raw": __props.item, "storage-prefix": __props.storagePrefix }, { default: withCtx(() => [ createElementVNode("div", _hoisted_2, [ isMessageItem(__props.item) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ messageContentItems.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_3, " Empty message content ")) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(messageContentItems.value, (contentItem, contentIndex) => { return openBlock(), createBlock(SubMessageItem, { key: contentItem.id, id: `${__props.id}-${contentItem.id}`, index: `${__props.index}-${contentIndex + 1}`, "badge-type": contentItem.badgeType, "badge-text": contentItem.badgeText, "storage-prefix": __props.storageSubPrefix }, { default: withCtx(() => [ contentItem.badgeType === "image" && contentItem.imageUrl ? (openBlock(), createBlock(ImageBlock, { key: 0, url: contentItem.imageUrl }, null, 8, ["url"])) : (openBlock(), createBlock(SmartViewer, { key: 1, text: contentItem.text || stringifyUnknown(contentItem.raw) }, null, 8, ["text"])) ]), _: 2 }, 1032, ["id", "index", "badge-type", "badge-text", "storage-prefix"]); }), 128)), __props.item.phase ? (openBlock(), createElementBlock("div", _hoisted_4, [ _cache[4] || (_cache[4] = createTextVNode(" phase: ", -1)), createElementVNode("code", null, toDisplayString(__props.item.phase), 1) ])) : createCommentVNode("", true) ], 64)) : isReasoningItem(__props.item) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [ (openBlock(true), createElementBlock(Fragment, null, renderList(reasoningSummaries.value, (summaryItem, summaryIndex) => { return openBlock(), createBlock(SubMessageItem, { key: `summary-${summaryIndex}`, id: `${__props.id}-summary-${summaryIndex}`, index: `${__props.index}-${summaryIndex + 1}`, "badge-type": "thinking", "badge-text": "SUMMARY", "storage-prefix": __props.storageSubPrefix }, { default: withCtx(() => [ createVNode(SmartViewer, { text: summaryItem.text }, null, 8, ["text"]) ]), _: 2 }, 1032, ["id", "index", "storage-prefix"]); }), 128)), hasReasoningContent.value ? (openBlock(), createBlock(SubMessageItem, { key: 0, id: `${__props.id}-reasoning-content`, index: `${__props.index}-${reasoningSummaries.value.length + 1}`, "badge-type": "thinking", "badge-text": "CONTENT", "storage-prefix": __props.storageSubPrefix }, { default: withCtx(() => [ createVNode(SmartViewer, { text: stringifyUnknown(__props.item.content) }, null, 8, ["text"]) ]), _: 1 }, 8, ["id", "index", "storage-prefix"])) : createCommentVNode("", true), hasEncryptedReasoning.value ? (openBlock(), createElementBlock("div", _hoisted_5, " encrypted reasoning content is hidden ")) : createCommentVNode("", true) ], 64)) : isFunctionCallItem(__props.item) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [ createElementVNode("div", _hoisted_6, [ _cache[5] || (_cache[5] = createElementVNode("span", { class: "call-badge" }, "FUNCTION_CALL", -1)), createElementVNode("code", _hoisted_7, toDisplayString(__props.item.name), 1), outputAnchorId.value && callId.value ? (openBlock(), createElementBlock("a", { key: 0, class: "call-link", onClick: _cache[0] || (_cache[0] = withModifiers(($event) => scrollToId(outputAnchorId.value), ["prevent"])) }, toDisplayString(callId.value), 1)) : createCommentVNode("", true) ]), createVNode(ToolArgs, { arguments: functionCallArguments.value }, null, 8, ["arguments"]) ], 64)) : isFunctionCallOutputItem(__props.item) ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [ createElementVNode("div", _hoisted_8, [ _cache[6] || (_cache[6] = createElementVNode("span", { class: "call-badge output" }, "FUNCTION_OUTPUT", -1)), callAnchorId.value && callId.value ? (openBlock(), createElementBlock("a", { key: 0, class: "call-link", onClick: _cache[1] || (_cache[1] = withModifiers(($event) => scrollToId(callAnchorId.value), ["prevent"])) }, toDisplayString(callId.value), 1)) : createCommentVNode("", true) ]), createVNode(SmartViewer, { text: functionCallOutputText.value }, null, 8, ["text"]) ], 64)) : isCustomToolCallItem(__props.item) ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [ createElementVNode("div", _hoisted_9, [ _cache[7] || (_cache[7] = createElementVNode("span", { class: "call-badge" }, "CUSTOM_TOOL_CALL", -1)), createElementVNode("code", _hoisted_10, toDisplayString(__props.item.name), 1), __props.item.status ? (openBlock(), createElementBlock("span", _hoisted_11, toDisplayString(__props.item.status), 1)) : createCommentVNode("", true), outputAnchorId.value && callId.value ? (openBlock(), createElementBlock("a", { key: 1, class: "call-link", onClick: _cache[2] || (_cache[2] = withModifiers(($event) => scrollToId(outputAnchorId.value), ["prevent"])) }, toDisplayString(callId.value), 1)) : createCommentVNode("", true) ]), createVNode(ToolArgs, { arguments: customToolCallArguments.value }, null, 8, ["arguments"]) ], 64)) : isCustomToolCallOutputItem(__props.item) ? (openBlock(), createElementBlock(Fragment, { key: 5 }, [ createElementVNode("div", _hoisted_12, [ _cache[8] || (_cache[8] = createElementVNode("span", { class: "call-badge output" }, "CUSTOM_TOOL_OUTPUT", -1)), callAnchorId.value && callId.value ? (openBlock(), createElementBlock("a", { key: 0, class: "call-link", onClick: _cache[3] || (_cache[3] = withModifiers(($event) => scrollToId(callAnchorId.value), ["prevent"])) }, toDisplayString(callId.value), 1)) : createCommentVNode("", true) ]), createVNode(SmartViewer, { text: customToolCallOutputText.value }, null, 8, ["text"]) ], 64)) : (openBlock(), createBlock(SmartViewer, { key: 6, text: stringifyUnknown(__props.item) }, null, 8, ["text"])) ]) ]), _: 1 }, 8, ["id", "index", "role", "count", "data-for-raw", "storage-prefix"]) ], 8, _hoisted_1); }; } }); const OpenaiResponseInputItemView = exports("O", _export_sfc(_sfc_main$1, [["__scopeId", "data-v-8cd2d36b"]])); const _sfc_main = exports("_", defineComponent({ __name: "OpenaiResponseToolItem", props: { id: {}, tool: {}, index: {} }, setup(__props) { const props = __props; const isFunctionTool = computed(() => { return props.tool.type === "function" && typeof props.tool.name === "string"; }); const toolName = computed(() => { if (isFunctionTool.value) { return props.tool.name; } return props.tool.type || "tool"; }); const toolDescription = computed(() => { if (isFunctionTool.value) { return props.tool.description; } return void 0; }); const toolParams = computed(() => { if (isFunctionTool.value) { return props.tool.parameters; } return props.tool; }); return (_ctx, _cache) => { return openBlock(), createBlock(ToolItem, { id: __props.id, name: toolName.value, description: toolDescription.value, params: toolParams.value, index: __props.index, standard: "openai" }, null, 8, ["id", "name", "description", "params", "index"]); }; } })); }) }; })); System.register("./openai-d0N2HAk8-DfEE7-Ya.js", [], (function (exports, module) { 'use strict'; return { execute: (function () { const OpenaiIcon = exports("O", "data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='56'%20viewBox='0%200%2024%2024'%20width='56'%20xmlns='http://www.w3.org/2000/svg'%20style='flex:%200%200%20auto;%20line-height:%201;'%3e%3ctitle%3eOpenAI%3c/title%3e%3cpath%20d='M9.205%208.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357%201.356-.523%202.117-.523%202.854%200%204.662%202.212%204.662%204.566%200%20.167%200%20.357-.024.547l-4.71-2.759a.797.797%200%2000-.856%200l-5.97%203.473zm10.609%208.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473%201.95-1.118a.433.433%200%2001.476%200l4.543%202.617c1.309.76%202.189%202.378%202.189%203.948%200%201.808-1.07%203.473-2.76%204.163zM7.802%2012.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545%201.95-4.472%204.591-4.472%201%200%201.927.333%202.712.928L8.23%205.067c-.285.166-.428.404-.428.737v6.898zM12%2015.128l-2.795-1.57v-3.33L12%208.658l2.795%201.57v3.33L12%2015.128zm1.796%207.23c-1%200-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974%201.142c.167.095.238.238.238.428v5.233c0%202.545-1.974%204.472-4.614%204.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482%204.482%200%20014.21%206.327v5.423c0%20.333.143.571.428.738l5.947%203.449-1.95%201.118a.432.432%200%2001-.476%200zm-.262%203.9c-2.688%200-4.662-2.021-4.662-4.519%200-.19.024-.38.047-.57l4.686%202.71c.286.167.571.167.856%200l5.97-3.448v2.26c0%20.19-.07.333-.237.428l-4.543%202.616c-.619.357-1.356.523-2.117.523zm5.899%202.83a5.947%205.947%200%20005.827-4.756C22.287%2018.339%2024%2015.84%2024%2013.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498%200-3.401-2.759-5.947-5.946-5.947-.642%200-1.26.095-1.88.31A5.962%205.962%200%200010.205%200a5.947%205.947%200%2000-5.827%204.757C1.713%205.447%200%207.945%200%2010.49c0%201.666.713%203.283%201.998%204.448-.119.5-.19%201-.19%201.499%200%203.401%202.759%205.946%205.946%205.946.642%200%201.26-.095%201.88-.309a5.96%205.96%200%20004.162%201.713z'%3e%3c/path%3e%3c/svg%3e"); }) }; })); System.register("./claude-DAANm4EN-CSvzQzJE.js", [], (function (exports, module) { 'use strict'; return { execute: (function () { const ClaudeIcon = exports("C", "data:image/svg+xml,%3csvg%20height='56'%20viewBox='0%200%2024%2024'%20width='56'%20xmlns='http://www.w3.org/2000/svg'%20style='flex:%200%200%20auto;%20line-height:%201;'%3e%3ctitle%3eClaude%3c/title%3e%3cpath%20d='M4.709%2015.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0%2011.784l.055-.352.48-.321.686.06%201.52.103%202.278.158%201.652.097%202.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686%201.908%201.476%202.491%201.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97%202.97%200%2001-.104-.729L6.283.134%206.696%200l.996.134.42.364.62%201.414%201.002%202.229%201.555%203.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286%201.851-.559%202.903-.364%201.942h.212l.243-.242.985-1.306%201.652-2.064.73-.82.85-.904.547-.431h1.033l.76%201.129-.34%201.166-1.064%201.347-.881%201.142-1.264%201.7-.79%201.36.073.11.188-.02%202.856-.606%201.543-.28%201.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061%201.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093%201.068%202.006%201.81%202.509%202.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649%202.345%203.521.122%201.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674%207.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434%201.967-2.18%202.945-1.726%201.845-.414.164-.717-.37.067-.662.401-.589%202.388-3.036%201.44-1.882.93-1.086-.006-.158h-.055L4.132%2018.56l-1.13.146-.487-.456.061-.746.231-.243%201.908-1.312-.006.006z'%20fill='%23D97757'%20fill-rule='nonzero'%3e%3c/path%3e%3c/svg%3e"); }) }; })); System.register("./SubMessageItem-CDY-oINa-C9F6H7x7.js", ['vue', './BetterDetails-BDkik7Go-BoTQ2MR3.js', './main-CBTFarNI-HX0H7eVT.js'], (function (exports, module) { 'use strict'; var defineComponent, computed, ref, inject, watch, openBlock, createElementBlock, createElementVNode, toDisplayString, createCommentVNode, unref, withModifiers, normalizeClass, createVNode, Fragment, withDirectives, createBlock, renderSlot, vShow, resolveComponent, normalizeStyle, renderList, useStorage, SmartViewer, hashId, useSessionStorage, _export_sfc; return { setters: [module => { defineComponent = module.defineComponent; computed = module.computed; ref = module.ref; inject = module.inject; watch = module.watch; openBlock = module.openBlock; createElementBlock = module.createElementBlock; createElementVNode = module.createElementVNode; toDisplayString = module.toDisplayString; createCommentVNode = module.createCommentVNode; unref = module.unref; withModifiers = module.withModifiers; normalizeClass = module.normalizeClass; createVNode = module.createVNode; Fragment = module.Fragment; withDirectives = module.withDirectives; createBlock = module.createBlock; renderSlot = module.renderSlot; vShow = module.vShow; resolveComponent = module.resolveComponent; normalizeStyle = module.normalizeStyle; renderList = module.renderList; }, module => { useStorage = module.a; SmartViewer = module.S; hashId = module.h; useSessionStorage = module.u; }, module => { _export_sfc = module._; }], execute: (function () { const _hoisted_1$3 = { key: 0, class: "properties-list" }; const _hoisted_2$3 = { class: "property-content" }; const _hoisted_3$3 = { class: "property-header" }; const _hoisted_4$3 = ["onClick"]; const _hoisted_5$3 = { key: 1, class: "expand-placeholder" }; const _hoisted_6$1 = { class: "property-name" }; const _hoisted_7$1 = { class: "property-type" }; const _hoisted_8$1 = { key: 2, class: "badge required-badge" }; const _hoisted_9$1 = { key: 3, class: "badge enum-badge" }; const _hoisted_10$1 = { key: 0, class: "property-desc" }; const _hoisted_11 = { key: 1, class: "meta-block" }; const _hoisted_12 = { class: "enum-container" }; const _hoisted_13 = { key: 2, class: "meta-block" }; const _hoisted_14 = { class: "code-pill default-pill" }; const _hoisted_15 = { key: 0, class: "nested-container" }; const _hoisted_16 = { class: "nested-label" }; const _hoisted_17 = { key: 1, class: "no-properties" }; const _sfc_main$4 = defineComponent({ ...{ name: "ToolParameters" }, __name: "ToolParameters", props: { schema: { default: () => ({}) }, depth: { default: 0 } }, setup(__props) { const props = __props; const schemaObj = computed(() => props.schema); const schemaProperties = computed(() => { return schemaObj.value.properties || {}; }); const schemaRequired = computed(() => { return schemaObj.value.required || []; }); const propertyKeys = computed(() => Object.keys(schemaProperties.value)); const expandedKeys = ref({}); const toggleExpand = (key) => { if (expandedKeys.value[key] === void 0) { expandedKeys.value[key] = false; } else { expandedKeys.value[key] = !expandedKeys.value[key]; } }; const isExpanded = (key) => { return expandedKeys.value[key] !== false; }; function formatType(prop) { const type = prop.type || "any"; if (type === "array" && prop.items) { const itemType = prop.items.type || "any"; return itemType === "object" ? "Array<Object>" : `${itemType}[]`; } return type; } function formatDefault(prop) { if (prop.default === void 0) return null; if (typeof prop.default === "object") { return JSON.stringify(prop.default); } return String(prop.default); } function getNestedSchema(prop) { if (prop.type === "object" && prop.properties) { return { properties: prop.properties, required: prop.required, type: "object" }; } if (prop.type === "array" && prop.items && prop.items.type === "object" && prop.items.properties) { return { properties: prop.items.properties, required: prop.items.required, type: "object" }; } return null; } return (_ctx, _cache) => { const _component_ToolParameters = resolveComponent("ToolParameters", true); return openBlock(), createElementBlock("div", { class: "tool-parameters", style: normalizeStyle({ "--depth": __props.depth }) }, [ propertyKeys.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_1$3, [ (openBlock(true), createElementBlock(Fragment, null, renderList(propertyKeys.value, (propName) => { return openBlock(), createElementBlock("div", { key: propName, class: normalizeClass(["property-row", { "is-required": schemaRequired.value.includes(propName), "has-nested": !!getNestedSchema(schemaProperties.value[propName]) }]) }, [ createElementVNode("div", _hoisted_2$3, [ createElementVNode("div", _hoisted_3$3, [ getNestedSchema(schemaProperties.value[propName]) ? (openBlock(), createElementBlock("button", { key: 0, class: normalizeClass(["expand-btn", { "is-closed": !isExpanded(propName) }]), onClick: ($event) => toggleExpand(propName), title: "Toggle details" }, [..._cache[0] || (_cache[0] = [ createElementVNode("span", { class: "icon-caret" }, "▼", -1) ])], 10, _hoisted_4$3)) : (openBlock(), createElementBlock("span", _hoisted_5$3)), createElementVNode("span", _hoisted_6$1, toDisplayString(propName), 1), createElementVNode("span", _hoisted_7$1, toDisplayString(formatType(schemaProperties.value[propName])), 1), schemaRequired.value.includes(propName) ? (openBlock(), createElementBlock("span", _hoisted_8$1, "REQUIRED")) : createCommentVNode("", true), schemaProperties.value[propName].enum ? (openBlock(), createElementBlock("span", _hoisted_9$1, " ENUM ")) : createCommentVNode("", true) ]), schemaProperties.value[propName].description ? (openBlock(), createElementBlock("div", _hoisted_10$1, toDisplayString(schemaProperties.value[propName].description), 1)) : createCommentVNode("", true), schemaProperties.value[propName].enum ? (openBlock(), createElementBlock("div", _hoisted_11, [ _cache[1] || (_cache[1] = createElementVNode("span", { class: "meta-label" }, "Options:", -1)), createElementVNode("div", _hoisted_12, [ (openBlock(true), createElementBlock(Fragment, null, renderList(schemaProperties.value[propName].enum, (val) => { return openBlock(), createElementBlock("code", { key: String(val), class: "code-pill" }, toDisplayString(JSON.stringify(val)), 1); }), 128)) ]) ])) : createCommentVNode("", true), formatDefault(schemaProperties.value[propName]) ? (openBlock(), createElementBlock("div", _hoisted_13, [ _cache[2] || (_cache[2] = createElementVNode("span", { class: "meta-label" }, "Default:", -1)), createElementVNode("code", _hoisted_14, toDisplayString(formatDefault(schemaProperties.value[propName])), 1) ])) : createCommentVNode("", true) ]), getNestedSchema(schemaProperties.value[propName]) ? withDirectives((openBlock(), createElementBlock("div", _hoisted_15, [ createElementVNode("div", _hoisted_16, toDisplayString(schemaProperties.value[propName].type === "array" ? "Item Properties:" : "Properties:"), 1), createVNode(_component_ToolParameters, { schema: getNestedSchema(schemaProperties.value[propName]), depth: __props.depth + 1 }, null, 8, ["schema", "depth"]) ], 512)), [ [vShow, isExpanded(propName)] ]) : createCommentVNode("", true) ], 2); }), 128)) ])) : __props.depth === 0 ? (openBlock(), createElementBlock("div", _hoisted_17, " No parameters defined ")) : createCommentVNode("", true) ], 4); }; } }); const ToolParameters = _export_sfc(_sfc_main$4, [["__scopeId", "data-v-da5963be"]]); const _hoisted_1$2 = ["id"]; const _hoisted_2$2 = { class: "header-left" }; const _hoisted_3$2 = { class: "toggle-icon" }; const _hoisted_4$2 = { class: "tool-index" }; const _hoisted_5$2 = { class: "tool-name" }; const _hoisted_6 = { key: 0, class: "tool-desc-preview" }; const _hoisted_7 = { key: 0, class: "tool-content" }; const _hoisted_8 = { key: 0, class: "raw-mode" }; const _hoisted_9 = { key: 0, class: "description-section" }; const _hoisted_10 = { key: 1, class: "parameters-section" }; const _sfc_main$3 = defineComponent({ __name: "ToolItem", props: { id: {}, name: {}, description: {}, params: {}, index: {}, standard: {} }, setup(__props) { const props = __props; const storageKey = computed(() => { return `tool-${props.standard}-${props.id || props.name}-open`; }); const isOpen = useStorage(storageKey.value, true); const toggle = () => { isOpen.value = !isOpen.value; }; const showRaw = ref(false); const toggleRaw = () => { showRaw.value = !showRaw.value; }; const bulkCollapseState = inject("bulkCollapseState"); watch( () => bulkCollapseState?.value, (newState) => { if (newState === "expanded") { isOpen.value = true; } else if (newState === "collapsed") { isOpen.value = false; } }, { immediate: false } ); const toggleIcon = computed(() => isOpen.value ? "▼" : "▶"); const descPreview = computed(() => { if (!props.description) return ""; return props.description.length > 160 ? props.description.slice(0, 160) + "..." : props.description; }); const domId = computed(() => { return props.id || `${props.standard}-tool-${props.name}`; }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { id: domId.value, class: "tool-item" }, [ createElementVNode("div", { class: "tool-header", onClick: toggle }, [ createElementVNode("div", _hoisted_2$2, [ createElementVNode("span", _hoisted_3$2, toDisplayString(toggleIcon.value), 1), createElementVNode("span", _hoisted_4$2, "#" + toDisplayString(__props.index + 1), 1), createElementVNode("span", _hoisted_5$2, toDisplayString(__props.name), 1), descPreview.value ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(descPreview.value), 1)) : createCommentVNode("", true) ]), unref(isOpen) ? (openBlock(), createElementBlock("button", { key: 0, class: normalizeClass(["raw-btn", { active: showRaw.value }]), onClick: withModifiers(toggleRaw, ["stop"]) }, " View Raw ", 2)) : createCommentVNode("", true) ]), unref(isOpen) ? (openBlock(), createElementBlock("div", _hoisted_7, [ showRaw.value ? (openBlock(), createElementBlock("div", _hoisted_8, [ createVNode(SmartViewer, { text: JSON.stringify({ name: __props.name, description: __props.description, params: __props.params }, null, 2) }, null, 8, ["text"]) ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [ __props.description ? (openBlock(), createElementBlock("div", _hoisted_9, [ _cache[0] || (_cache[0] = createElementVNode("div", { class: "section-label" }, "DESCRIPTION", -1)), createVNode(SmartViewer, { text: __props.description }, null, 8, ["text"]) ])) : createCommentVNode("", true), __props.params ? (openBlock(), createElementBlock("div", _hoisted_10, [ _cache[1] || (_cache[1] = createElementVNode("div", { class: "section-label" }, "PARAMETERS", -1)), createVNode(ToolParameters, { schema: __props.params }, null, 8, ["schema"]) ])) : createCommentVNode("", true) ], 64)) ])) : createCommentVNode("", true) ], 8, _hoisted_1$2); }; } }); const ToolItem = exports("T", _export_sfc(_sfc_main$3, [["__scopeId", "data-v-26afee9b"]])); const _sfc_main$2 = defineComponent({ __name: "RoleBadge", props: { role: {} }, setup(__props) { const props = __props; const roleClass = computed(() => { const role = props.role.toLowerCase(); if (role === "model") return "role-model"; if (role === "function") return "role-function"; return `role-${role}`; }); const displayRole = computed(() => { const role = props.role.toLowerCase(); if (role === "model") return "model"; if (role === "function") return "function"; return role; }); return (_ctx, _cache) => { return openBlock(), createElementBlock("span", { class: normalizeClass(["role-badge", roleClass.value]) }, toDisplayString(displayRole.value), 3); }; } }); const RoleBadge = exports("R", _export_sfc(_sfc_main$2, [["__scopeId", "data-v-cff38f4a"]])); const _hoisted_1$1 = { class: "header-left" }; const _hoisted_2$1 = { class: "toggle" }; const _hoisted_3$1 = { class: "index" }; const _hoisted_4$1 = { key: 0, class: "count-badge" }; const _hoisted_5$1 = { key: 0, class: "content" }; const _sfc_main$1 = defineComponent({ __name: "MessageItem", props: { id: {}, index: {}, role: {}, count: { default: 0 }, dataAsText: {}, dataForRaw: {}, storagePrefix: { default: "msg" } }, setup(__props) { const props = __props; const keyId = computed( () => props.id || hashId(`${props.index}-${props.role}`) ); const isOpen = useSessionStorage(() => `${props.storagePrefix}-${keyId.value}-open`, true); const isRawView = useSessionStorage(() => `${props.storagePrefix}-${keyId.value}-raw`, false); const hasOpened = ref(Boolean(isOpen.value)); const bulkCollapseState = inject("bulkCollapseState"); watch( () => bulkCollapseState?.value, (newState) => { if (newState === "expanded") { isOpen.value = true; } else if (newState === "collapsed") { isOpen.value = false; } }, { immediate: false } ); watch( () => isOpen.value, (open) => { if (open) { hasOpened.value = true; } } ); const hasRawData = computed(() => { return typeof props.dataAsText === "string" ? props.dataAsText.length > 0 : props.dataForRaw !== void 0; }); const safeStringify = (value) => { try { return JSON.stringify(value, null, 2); } catch { return String(value ?? ""); } }; const rawText = computed(() => { if (!isRawView.value) return ""; if (typeof props.dataAsText === "string" && props.dataAsText.length > 0) return props.dataAsText; return safeStringify(props.dataForRaw); }); const toggleRawView = (e) => { e.stopPropagation(); isRawView.value = !isRawView.value; }; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass(["message-item", `role-${__props.role.toLowerCase()}`]) }, [ createElementVNode("div", { class: "header", onClick: _cache[0] || (_cache[0] = ($event) => isOpen.value = !unref(isOpen)) }, [ createElementVNode("div", _hoisted_1$1, [ createElementVNode("span", _hoisted_2$1, toDisplayString(unref(isOpen) ? "▼" : "▶"), 1), createElementVNode("span", _hoisted_3$1, "#" + toDisplayString(__props.index), 1), createVNode(RoleBadge, { role: __props.role }, null, 8, ["role"]), __props.count > 0 ? (openBlock(), createElementBlock("span", _hoisted_4$1, toDisplayString(__props.count), 1)) : createCommentVNode("", true) ]), hasRawData.value && unref(isOpen) ? (openBlock(), createElementBlock("button", { key: 0, class: normalizeClass(["raw-btn", { active: unref(isRawView) }]), onClick: toggleRawView }, " View Raw ", 2)) : createCommentVNode("", true) ]), hasOpened.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_5$1, [ unref(isRawView) ? (openBlock(), createBlock(SmartViewer, { key: 0, text: rawText.value }, null, 8, ["text"])) : renderSlot(_ctx.$slots, "default", { key: 1 }, void 0, true) ], 512)), [ [vShow, unref(isOpen)] ]) : createCommentVNode("", true) ], 2); }; } }); const MessageItem = exports("M", _export_sfc(_sfc_main$1, [["__scopeId", "data-v-e920ba37"]])); const _hoisted_1 = { class: "sub-message-item" }; const _hoisted_2 = { class: "header-left" }; const _hoisted_3 = { class: "toggle" }; const _hoisted_4 = { class: "index" }; const _hoisted_5 = { class: "content" }; const _sfc_main = defineComponent({ __name: "SubMessageItem", props: { id: {}, index: {}, badgeType: {}, badgeText: {}, storagePrefix: { default: "sub-msg" }, defaultOpen: { type: Boolean, default: true } }, setup(__props) { const props = __props; const storageKey = computed(() => { const keyId = props.id || hashId(`${props.index}-${props.badgeText}`); return `${props.storagePrefix}-${keyId}-open`; }); const isOpen = useSessionStorage(storageKey, props.defaultOpen); const badgeClass = computed(() => `badge-${props.badgeType}`); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ createElementVNode("div", { class: "header", onClick: _cache[0] || (_cache[0] = ($event) => isOpen.value = !unref(isOpen)) }, [ createElementVNode("div", _hoisted_2, [ createElementVNode("span", _hoisted_3, toDisplayString(unref(isOpen) ? "▼" : "▶"), 1), createElementVNode("span", _hoisted_4, "#" + toDisplayString(__props.index), 1), createElementVNode("span", { class: normalizeClass(["badge", badgeClass.value]) }, toDisplayString(__props.badgeText), 3), renderSlot(_ctx.$slots, "header", {}, void 0, true) ]) ]), withDirectives(createElementVNode("div", _hoisted_5, [ renderSlot(_ctx.$slots, "default", {}, void 0, true) ], 512), [ [vShow, unref(isOpen)] ]) ]); }; } }); const SubMessageItem = exports("S", _export_sfc(_sfc_main, [["__scopeId", "data-v-c7d01d1a"]])); }) }; })); System.register("./gemini-BkXZ0qKW-CQKs9TIJ.js", [], (function (exports, module) { 'use strict'; return { execute: (function () { const GeminiIcon = exports("G", "data:image/svg+xml,%3csvg%20height='56'%20viewBox='0%200%2024%2024'%20width='56'%20xmlns='http://www.w3.org/2000/svg'%20style='flex:%200%200%20auto;%20line-height:%201;'%3e%3ctitle%3eGemini%3c/title%3e%3cpath%20d='M20.616%2010.835a14.147%2014.147%200%2001-4.45-3.001%2014.111%2014.111%200%2001-3.678-6.452.503.503%200%2000-.975%200%2014.134%2014.134%200%2001-3.679%206.452%2014.155%2014.155%200%2001-4.45%203.001c-.65.28-1.318.505-2.002.678a.502.502%200%20000%20.975c.684.172%201.35.397%202.002.677a14.147%2014.147%200%20014.45%203.001%2014.112%2014.112%200%20013.679%206.453.502.502%200%2000.975%200c.172-.685.397-1.351.677-2.003a14.145%2014.145%200%20013.001-4.45%2014.113%2014.113%200%20016.453-3.678.503.503%200%20000-.975%2013.245%2013.245%200%2001-2.003-.678z'%20fill='%233186FF'%3e%3c/path%3e%3cpath%20d='M20.616%2010.835a14.147%2014.147%200%2001-4.45-3.001%2014.111%2014.111%200%2001-3.678-6.452.503.503%200%2000-.975%200%2014.134%2014.134%200%2001-3.679%206.452%2014.155%2014.155%200%2001-4.45%203.001c-.65.28-1.318.505-2.002.678a.502.502%200%20000%20.975c.684.172%201.35.397%202.002.677a14.147%2014.147%200%20014.45%203.001%2014.112%2014.112%200%20013.679%206.453.502.502%200%2000.975%200c.172-.685.397-1.351.677-2.003a14.145%2014.145%200%20013.001-4.45%2014.113%2014.113%200%20016.453-3.678.503.503%200%20000-.975%2013.245%2013.245%200%2001-2.003-.678z'%20fill='url(%23lobe-icons-gemini-fill-0)'%3e%3c/path%3e%3cpath%20d='M20.616%2010.835a14.147%2014.147%200%2001-4.45-3.001%2014.111%2014.111%200%2001-3.678-6.452.503.503%200%2000-.975%200%2014.134%2014.134%200%2001-3.679%206.452%2014.155%2014.155%200%2001-4.45%203.001c-.65.28-1.318.505-2.002.678a.502.502%200%20000%20.975c.684.172%201.35.397%202.002.677a14.147%2014.147%200%20014.45%203.001%2014.112%2014.112%200%20013.679%206.453.502.502%200%2000.975%200c.172-.685.397-1.351.677-2.003a14.145%2014.145%200%20013.001-4.45%2014.113%2014.113%200%20016.453-3.678.503.503%200%20000-.975%2013.245%2013.245%200%2001-2.003-.678z'%20fill='url(%23lobe-icons-gemini-fill-1)'%3e%3c/path%3e%3cpath%20d='M20.616%2010.835a14.147%2014.147%200%2001-4.45-3.001%2014.111%2014.111%200%2001-3.678-6.452.503.503%200%2000-.975%200%2014.134%2014.134%200%2001-3.679%206.452%2014.155%2014.155%200%2001-4.45%203.001c-.65.28-1.318.505-2.002.678a.502.502%200%20000%20.975c.684.172%201.35.397%202.002.677a14.147%2014.147%200%20014.45%203.001%2014.112%2014.112%200%20013.679%206.453.502.502%200%2000.975%200c.172-.685.397-1.351.677-2.003a14.145%2014.145%200%20013.001-4.45%2014.113%2014.113%200%20016.453-3.678.503.503%200%20000-.975%2013.245%2013.245%200%2001-2.003-.678z'%20fill='url(%23lobe-icons-gemini-fill-2)'%3e%3c/path%3e%3cdefs%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20id='lobe-icons-gemini-fill-0'%20x1='7'%20x2='11'%20y1='15.5'%20y2='12'%3e%3cstop%20stop-color='%2308B962'%3e%3c/stop%3e%3cstop%20offset='1'%20stop-color='%2308B962'%20stop-opacity='0'%3e%3c/stop%3e%3c/linearGradient%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20id='lobe-icons-gemini-fill-1'%20x1='8'%20x2='11.5'%20y1='5.5'%20y2='11'%3e%3cstop%20stop-color='%23F94543'%3e%3c/stop%3e%3cstop%20offset='1'%20stop-color='%23F94543'%20stop-opacity='0'%3e%3c/stop%3e%3c/linearGradient%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20id='lobe-icons-gemini-fill-2'%20x1='3.5'%20x2='17.5'%20y1='13.5'%20y2='12'%3e%3cstop%20stop-color='%23FABC12'%3e%3c/stop%3e%3cstop%20offset='.46'%20stop-color='%23FABC12'%20stop-opacity='0'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e"); }) }; })); System.register("./ImageBlock-DPbM__Ea-CdY7PxBB.js", ['vue', './main-CBTFarNI-HX0H7eVT.js'], (function (exports, module) { 'use strict'; var defineComponent, computed, ref, openBlock, createElementBlock, createElementVNode, toDisplayString, createCommentVNode, _export_sfc; return { setters: [module => { defineComponent = module.defineComponent; computed = module.computed; ref = module.ref; openBlock = module.openBlock; createElementBlock = module.createElementBlock; createElementVNode = module.createElementVNode; toDisplayString = module.toDisplayString; createCommentVNode = module.createCommentVNode; }, module => { _export_sfc = module._; }], execute: (function () { const _hoisted_1 = { class: "image-block" }; const _hoisted_2 = { key: 0, class: "image-error" }; const _hoisted_3 = { key: 0, class: "image-mime" }; const _hoisted_4 = ["src", "alt"]; const _hoisted_5 = { key: 2, class: "image-placeholder" }; const _hoisted_6 = { key: 0, class: "image-mime" }; const _sfc_main = defineComponent({ __name: "ImageBlock", props: { id: {}, url: {}, mimeType: {}, data: {} }, setup(__props) { const props = __props; const imageUrl = computed(() => { if (props.url) return props.url; if (props.data && props.mimeType) { return `data:${props.mimeType};base64,${props.data}`; } return ""; }); const hasError = ref(false); function onError() { hasError.value = true; } return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1, [ hasError.value ? (openBlock(), createElementBlock("div", _hoisted_2, [ _cache[0] || (_cache[0] = createElementVNode("span", null, "Failed to load image", -1)), __props.mimeType ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(__props.mimeType), 1)) : createCommentVNode("", true) ])) : imageUrl.value ? (openBlock(), createElementBlock("img", { key: 1, src: imageUrl.value, alt: __props.mimeType || "Image", class: "image-image", loading: "lazy", onError }, null, 40, _hoisted_4)) : (openBlock(), createElementBlock("div", _hoisted_5, [ _cache[1] || (_cache[1] = createElementVNode("span", null, "No image data available", -1)), __props.mimeType ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(__props.mimeType), 1)) : createCommentVNode("", true) ])) ]); }; } }); const ImageBlock = exports("I", _export_sfc(_sfc_main, [["__scopeId", "data-v-f7ba3b8d"]])); }) }; })); System.register("./BetterDetails-BDkik7Go-BoTQ2MR3.js", ['vue', './main-CBTFarNI-HX0H7eVT.js'], (function (exports, module) { 'use strict'; var defineComponent, ref, provide, readonly, watch, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, toDisplayString, createCommentVNode, withModifiers, renderSlot, computed, useSlots, Fragment, createTextVNode, nextTick, onMounted, onBeforeUnmount, createVNode, createBlock, normalizeStyle, shallowRef, toValue, getCurrentScope, onScopeDispose, Transition, withCtx, renderList, useCssVars, getCurrentInstance, toRef$1, customRef, _export_sfc, toast; return { setters: [module => { defineComponent = module.defineComponent; ref = module.ref; provide = module.provide; readonly = module.readonly; watch = module.watch; openBlock = module.openBlock; createElementBlock = module.createElementBlock; normalizeClass = module.normalizeClass; unref = module.unref; createElementVNode = module.createElementVNode; toDisplayString = module.toDisplayString; createCommentVNode = module.createCommentVNode; withModifiers = module.withModifiers; renderSlot = module.renderSlot; computed = module.computed; useSlots = module.useSlots; Fragment = module.Fragment; createTextVNode = module.createTextVNode; nextTick = module.nextTick; onMounted = module.onMounted; onBeforeUnmount = module.onBeforeUnmount; createVNode = module.createVNode; createBlock = module.createBlock; normalizeStyle = module.normalizeStyle; shallowRef = module.shallowRef; toValue = module.toValue; getCurrentScope = module.getCurrentScope; onScopeDispose = module.onScopeDispose; Transition = module.Transition; withCtx = module.withCtx; renderList = module.renderList; useCssVars = module.useCssVars; getCurrentInstance = module.getCurrentInstance; toRef$1 = module.toRef; customRef = module.customRef; }, module => { _export_sfc = module._; toast = module.t; }], execute: (function () { exports({ a: useStorage, h: hashId, u: useSessionStorage }); function tryOnScopeDispose(fn, failSilently) { if (getCurrentScope()) { onScopeDispose(fn, failSilently); return true; } return false; } const isClient = typeof window !== "undefined" && typeof document !== "undefined"; typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope; const toString = Object.prototype.toString; const isObject = (val) => toString.call(val) === "[object Object]"; const noop = () => { }; function toRef(...args) { if (args.length !== 1) return toRef$1(...args); const r = args[0]; return typeof r === "function" ? readonly(customRef(() => ({ get: r, set: noop }))) : ref(r); } function createFilterWrapper(filter, fn) { function wrapper(...args) { return new Promise((resolve, reject) => { Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve).catch(reject); }); } return wrapper; } const bypassFilter = (invoke$1) => { return invoke$1(); }; function pausableFilter(extendFilter = bypassFilter, options = {}) { const { initialState = "active" } = options; const isActive = toRef(initialState === "active"); function pause() { isActive.value = false; } function resume() { isActive.value = true; } const eventFilter = (...args) => { if (isActive.value) extendFilter(...args); }; return { isActive: readonly(isActive), pause, resume, eventFilter }; } function toArray(value) { return Array.isArray(value) ? value : [value]; } function getLifeCycleTarget(target) { return getCurrentInstance(); } function watchWithFilter(source, cb, options = {}) { const { eventFilter = bypassFilter, ...watchOptions } = options; return watch(source, createFilterWrapper(eventFilter, cb), watchOptions); } function watchPausable(source, cb, options = {}) { const { eventFilter: filter, initialState = "active", ...watchOptions } = options; const { eventFilter, pause, resume, isActive } = pausableFilter(filter, { initialState }); return { stop: watchWithFilter(source, cb, { ...watchOptions, eventFilter }), pause, resume, isActive }; } function tryOnMounted(fn, sync = true, target) { if (getLifeCycleTarget()) onMounted(fn, target); else if (sync) fn(); else nextTick(fn); } function watchImmediate(source, cb, options) { return watch(source, cb, { ...options, immediate: true }); } const defaultWindow = isClient ? window : void 0; function unrefElement(elRef) { var _$el; const plain = toValue(elRef); return (_$el = plain === null || plain === void 0 ? void 0 : plain.$el) !== null && _$el !== void 0 ? _$el : plain; } function useEventListener(...args) { const register = (el, event, listener, options) => { el.addEventListener(event, listener, options); return () => el.removeEventListener(event, listener, options); }; const firstParamTargets = computed(() => { const test = toArray(toValue(args[0])).filter((e) => e != null); return test.every((e) => typeof e !== "string") ? test : void 0; }); return watchImmediate(() => { var _firstParamTargets$va, _firstParamTargets$va2; return [ (_firstParamTargets$va = (_firstParamTargets$va2 = firstParamTargets.value) === null || _firstParamTargets$va2 === void 0 ? void 0 : _firstParamTargets$va2.map((e) => unrefElement(e))) !== null && _firstParamTargets$va !== void 0 ? _firstParamTargets$va : [defaultWindow].filter((e) => e != null), toArray(toValue(firstParamTargets.value ? args[1] : args[0])), toArray(unref(firstParamTargets.value ? args[2] : args[1])), toValue(firstParamTargets.value ? args[3] : args[2]) ]; }, ([raw_targets, raw_events, raw_listeners, raw_options], _, onCleanup) => { if (!(raw_targets === null || raw_targets === void 0 ? void 0 : raw_targets.length) || !(raw_events === null || raw_events === void 0 ? void 0 : raw_events.length) || !(raw_listeners === null || raw_listeners === void 0 ? void 0 : raw_listeners.length)) return; const optionsClone = isObject(raw_options) ? { ...raw_options } : raw_options; const cleanups = raw_targets.flatMap((el) => raw_events.flatMap((event) => raw_listeners.map((listener) => register(el, event, listener, optionsClone)))); onCleanup(() => { cleanups.forEach((fn) => fn()); }); }, { flush: "post" }); } function useMounted() { const isMounted = shallowRef(false); const instance = getCurrentInstance(); if (instance) onMounted(() => { isMounted.value = true; }, instance); return isMounted; } function useSupported(callback) { const isMounted = useMounted(); return computed(() => { isMounted.value; return Boolean(callback()); }); } const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; const globalKey = "__vueuse_ssr_handlers__"; const handlers = getHandlers(); function getHandlers() { if (!(globalKey in _global)) _global[globalKey] = _global[globalKey] || {}; return _global[globalKey]; } function getSSRHandler(key, fallback) { return handlers[key] || fallback; } function guessSerializerType(rawInit) { return rawInit == null ? "any" : rawInit instanceof Set ? "set" : rawInit instanceof Map ? "map" : rawInit instanceof Date ? "date" : typeof rawInit === "boolean" ? "boolean" : typeof rawInit === "string" ? "string" : typeof rawInit === "object" ? "object" : !Number.isNaN(rawInit) ? "number" : "any"; } const StorageSerializers = { boolean: { read: (v) => v === "true", write: (v) => String(v) }, object: { read: (v) => JSON.parse(v), write: (v) => JSON.stringify(v) }, number: { read: (v) => Number.parseFloat(v), write: (v) => String(v) }, any: { read: (v) => v, write: (v) => String(v) }, string: { read: (v) => v, write: (v) => String(v) }, map: { read: (v) => new Map(JSON.parse(v)), write: (v) => JSON.stringify(Array.from(v.entries())) }, set: { read: (v) => new Set(JSON.parse(v)), write: (v) => JSON.stringify(Array.from(v)) }, date: { read: (v) => new Date(v), write: (v) => v.toISOString() } }; const customStorageEventName = "vueuse-storage"; function useStorage(key, defaults$1, storage, options = {}) { var _options$serializer; const { flush = "pre", deep = true, listenToStorageChanges = true, writeDefaults = true, mergeDefaults = false, shallow, window: window$1 = defaultWindow, eventFilter, onError = (e) => { console.error(e); }, initOnMounted } = options; const data = (shallow ? shallowRef : ref)(typeof defaults$1 === "function" ? defaults$1() : defaults$1); const keyComputed = computed(() => toValue(key)); if (!storage) try { storage = getSSRHandler("getDefaultStorage", () => defaultWindow === null || defaultWindow === void 0 ? void 0 : defaultWindow.localStorage)(); } catch (e) { onError(e); } if (!storage) return data; const rawInit = toValue(defaults$1); const type = guessSerializerType(rawInit); const serializer = (_options$serializer = options.serializer) !== null && _options$serializer !== void 0 ? _options$serializer : StorageSerializers[type]; const { pause: pauseWatch, resume: resumeWatch } = watchPausable(data, (newValue) => write(newValue), { flush, deep, eventFilter }); watch(keyComputed, () => update(), { flush }); let firstMounted = false; const onStorageEvent = (ev) => { if (initOnMounted && !firstMounted) return; update(ev); }; const onStorageCustomEvent = (ev) => { if (initOnMounted && !firstMounted) return; updateFromCustomEvent(ev); }; if (window$1 && listenToStorageChanges) if (storage instanceof Storage) useEventListener(window$1, "storage", onStorageEvent, { passive: true }); else useEventListener(window$1, customStorageEventName, onStorageCustomEvent); if (initOnMounted) tryOnMounted(() => { firstMounted = true; update(); }); else update(); function dispatchWriteEvent(oldValue, newValue) { if (window$1) { const payload = { key: keyComputed.value, oldValue, newValue, storageArea: storage }; window$1.dispatchEvent(storage instanceof Storage ? new StorageEvent("storage", payload) : new CustomEvent(customStorageEventName, { detail: payload })); } } function write(v) { try { const oldValue = storage.getItem(keyComputed.value); if (v == null) { dispatchWriteEvent(oldValue, null); storage.removeItem(keyComputed.value); } else { const serialized = serializer.write(v); if (oldValue !== serialized) { storage.setItem(keyComputed.value, serialized); dispatchWriteEvent(oldValue, serialized); } } } catch (e) { onError(e); } } function read(event) { const rawValue = event ? event.newValue : storage.getItem(keyComputed.value); if (rawValue == null) { if (writeDefaults && rawInit != null) storage.setItem(keyComputed.value, serializer.write(rawInit)); return rawInit; } else if (!event && mergeDefaults) { const value = serializer.read(rawValue); if (typeof mergeDefaults === "function") return mergeDefaults(value, rawInit); else if (type === "object" && !Array.isArray(value)) return { ...rawInit, ...value }; return value; } else if (typeof rawValue !== "string") return rawValue; else return serializer.read(rawValue); } function update(event) { if (event && event.storageArea !== storage) return; if (event && event.key == null) { data.value = rawInit; return; } if (event && event.key !== keyComputed.value) return; pauseWatch(); try { const serializedData = serializer.write(data.value); if (event === void 0 || (event === null || event === void 0 ? void 0 : event.newValue) !== serializedData) data.value = read(event); } catch (e) { onError(e); } finally { if (event) nextTick(resumeWatch); else resumeWatch(); } } function updateFromCustomEvent(event) { update(event.detail); } return data; } function useResizeObserver(target, callback, options = {}) { const { window: window$1 = defaultWindow, ...observerOptions } = options; let observer; const isSupported = useSupported(() => window$1 && "ResizeObserver" in window$1); const cleanup = () => { if (observer) { observer.disconnect(); observer = void 0; } }; const stopWatch = watch(computed(() => { const _targets = toValue(target); return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)]; }), (els) => { cleanup(); if (isSupported.value && window$1) { observer = new ResizeObserver(callback); for (const _el of els) if (_el) observer.observe(_el, observerOptions); } }, { immediate: true, flush: "post" }); const stop = () => { cleanup(); stopWatch(); }; tryOnScopeDispose(stop); return { isSupported, stop }; } function useSessionStorage(key, initialValue, options = {}) { const { window: window$1 = defaultWindow } = options; return useStorage(key, initialValue, window$1 === null || window$1 === void 0 ? void 0 : window$1.sessionStorage, options); } const CollapseAllIcon = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3e%3cpath%20d='M17%2011l-5-5-5%205M17%2018l-5-5-5%205'/%3e%3c/svg%3e"; const ExpandAllIcon = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3e%3cpath%20d='M7%2013l5%205%205-5M7%206l5%205%205-5'/%3e%3c/svg%3e"; const _hoisted_1$a = { class: "header-left" }; const _hoisted_2$a = { class: "title" }; const _hoisted_3$7 = { key: 0, class: "badge" }; const _hoisted_4$3 = ["src"]; const _hoisted_5 = ["src"]; const _hoisted_6 = { class: "card-content-wrapper" }; const _hoisted_7 = { class: "card-content-inner" }; const _hoisted_8 = { class: "content-padding" }; const _sfc_main$c = defineComponent({ __name: "CollapsibleSection", props: { title: {}, defaultOpen: { type: Boolean, default: false }, count: { default: null }, storageKey: { default: void 0 }, forceOpen: { type: [Boolean, null], default: null }, enableBulkActions: { type: Boolean, default: false } }, setup(__props, { expose: __expose }) { const props = __props; const isOpen = props.storageKey ? useStorage(`llm-better-view-collapse-state-${props.storageKey}`, props.defaultOpen) : ref(props.defaultOpen); const hasRendered = ref(Boolean(isOpen.value)); const bulkCollapseState = ref(null); provide("bulkCollapseState", readonly(bulkCollapseState)); watch(() => props.forceOpen, (newVal) => { if (newVal !== null && newVal !== void 0) { isOpen.value = newVal; } }); watch( () => isOpen.value, (open) => { if (open) { hasRendered.value = true; } } ); const toggle = () => { isOpen.value = !isOpen.value; }; const ensureOpen = () => { if (!isOpen.value) { isOpen.value = true; } }; const handleCollapseAll = () => { bulkCollapseState.value = "collapsed"; setTimeout(() => { bulkCollapseState.value = null; }, 50); }; const handleExpandAll = () => { ensureOpen(); bulkCollapseState.value = "expanded"; setTimeout(() => { bulkCollapseState.value = null; }, 50); }; __expose({ isOpen, toggle, ensureOpen }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass(["collapse-card", { "is-open": unref(isOpen) }]) }, [ createElementVNode("button", { class: "card-header", onClick: toggle, type: "button" }, [ createElementVNode("div", _hoisted_1$a, [ createElementVNode("span", _hoisted_2$a, toDisplayString(__props.title), 1), __props.count !== null ? (openBlock(), createElementBlock("span", _hoisted_3$7, toDisplayString(__props.count), 1)) : createCommentVNode("", true) ]), _cache[2] || (_cache[2] = createElementVNode("div", { style: { "flex-grow": "1" } }, null, -1)), __props.enableBulkActions ? (openBlock(), createElementBlock("div", { key: 0, class: "header-actions", onClick: _cache[0] || (_cache[0] = withModifiers(() => { }, ["stop"])) }, [ createElementVNode("button", { class: "action-btn", title: "Collapse All", onClick: withModifiers(handleCollapseAll, ["stop"]) }, [ createElementVNode("img", { src: unref(CollapseAllIcon), class: "action-icon", alt: "" }, null, 8, _hoisted_4$3) ]), createElementVNode("button", { class: "action-btn", title: "Expand All", onClick: withModifiers(handleExpandAll, ["stop"]) }, [ createElementVNode("img", { src: unref(ExpandAllIcon), class: "action-icon", alt: "" }, null, 8, _hoisted_5) ]) ])) : createCommentVNode("", true), createElementVNode("div", { class: "header-right", onClick: _cache[1] || (_cache[1] = withModifiers(() => { }, ["stop"])) }, [ renderSlot(_ctx.$slots, "header-right", {}, void 0, true) ]), _cache[3] || (_cache[3] = createElementVNode("svg", { class: "chevron-icon", xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, [ createElementVNode("polyline", { points: "6 9 12 15 18 9" }) ], -1)) ]), createElementVNode("div", _hoisted_6, [ createElementVNode("div", _hoisted_7, [ createElementVNode("div", _hoisted_8, [ hasRendered.value ? renderSlot(_ctx.$slots, "default", { key: 0 }, void 0, true) : createCommentVNode("", true) ]) ]) ]) ], 2); }; } }); const CollapsibleSection = exports("C", _export_sfc(_sfc_main$c, [["__scopeId", "data-v-fb667e93"]])); const _hoisted_1$9 = { key: 0, class: "info-item" }; const _hoisted_2$9 = { class: "info-label" }; const _hoisted_3$6 = { class: "info-value" }; const _sfc_main$b = defineComponent({ __name: "LabelValueRow", props: { label: {}, value: { default: null }, formatter: { type: Function, default: void 0 }, hideIfEmpty: { type: Boolean, default: true } }, setup(__props) { const props = __props; const displayValue = computed(() => { if (props.value === null || props.value === void 0) return null; return props.formatter ? props.formatter(props.value) : String(props.value); }); const shouldHide = computed(() => { return props.hideIfEmpty && (displayValue.value === null || displayValue.value === ""); }); return (_ctx, _cache) => { return !shouldHide.value ? (openBlock(), createElementBlock("div", _hoisted_1$9, [ createElementVNode("span", _hoisted_2$9, toDisplayString(__props.label), 1), createElementVNode("span", _hoisted_3$6, toDisplayString(displayValue.value), 1) ])) : createCommentVNode("", true); }; } }); const LabelValueRow = exports("L", _export_sfc(_sfc_main$b, [["__scopeId", "data-v-5d157f12"]])); function _getDefaults() { return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null }; } var _defaults = _getDefaults(); function changeDefaults(newDefaults) { _defaults = newDefaults; } var noopTest = { exec: () => null }; function edit(regex, opt = "") { let source = typeof regex === "string" ? regex : regex.source; const obj = { replace: (name, val) => { let valSource = typeof val === "string" ? val : val.source; valSource = valSource.replace(other.caret, "$1"); source = source.replace(name, valSource); return obj; }, getRegex: () => { return new RegExp(source, opt); } }; return obj; } var other = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ xX]\] +/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (bull) => new RegExp(`^( {0,3}${bull})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`), htmlBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}<(?:[a-z].*>|!--)`, "i") }; var newline = /^(?:[ \t]*(?:\n|$))+/; var blockCode = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/; var fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/; var hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/; var heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/; var bullet = /(?:[*+-]|\d{1,9}[.)])/; var lheadingCore = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/; var lheading = edit(lheadingCore).replace(/bull/g, bullet).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(); var lheadingGfm = edit(lheadingCore).replace(/bull/g, bullet).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(); var _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/; var blockText = /^[^\n]+/; var _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/; var def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(); var list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex(); var _tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul"; var _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/; var html = edit( "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i" ).replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(); var paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex(); var blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex(); var blockNormal = { blockquote, code: blockCode, def, fences, heading, hr, html, lheading, list, newline, paragraph, table: noopTest, text: blockText }; var gfmTable = edit( "^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)" ).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex(); var blockGfm = { ...blockNormal, lheading: lheadingGfm, table: gfmTable, paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex() }; var blockPedantic = { ...blockNormal, html: edit( `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))` ).replace("comment", _comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: noopTest, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }; var escape = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/; var inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/; var br = /^( {2,}|\\)\n(?!\s*$)/; var inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/; var _punctuation = /[\p{P}\p{S}]/u; var _punctuationOrSpace = /[\s\p{P}\p{S}]/u; var _notPunctuationOrSpace = /[^\s\p{P}\p{S}]/u; var punctuation = edit(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, _punctuationOrSpace).getRegex(); var _punctuationGfmStrongEm = /(?!~)[\p{P}\p{S}]/u; var _punctuationOrSpaceGfmStrongEm = /(?!~)[\s\p{P}\p{S}]/u; var _notPunctuationOrSpaceGfmStrongEm = /(?:[^\s\p{P}\p{S}]|~)/u; var blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g; var emStrongLDelimCore = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/; var emStrongLDelim = edit(emStrongLDelimCore, "u").replace(/punct/g, _punctuation).getRegex(); var emStrongLDelimGfm = edit(emStrongLDelimCore, "u").replace(/punct/g, _punctuationGfmStrongEm).getRegex(); var emStrongRDelimAstCore = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)"; var emStrongRDelimAst = edit(emStrongRDelimAstCore, "gu").replace(/notPunctSpace/g, _notPunctuationOrSpace).replace(/punctSpace/g, _punctuationOrSpace).replace(/punct/g, _punctuation).getRegex(); var emStrongRDelimAstGfm = edit(emStrongRDelimAstCore, "gu").replace(/notPunctSpace/g, _notPunctuationOrSpaceGfmStrongEm).replace(/punctSpace/g, _punctuationOrSpaceGfmStrongEm).replace(/punct/g, _punctuationGfmStrongEm).getRegex(); var emStrongRDelimUnd = edit( "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu" ).replace(/notPunctSpace/g, _notPunctuationOrSpace).replace(/punctSpace/g, _punctuationOrSpace).replace(/punct/g, _punctuation).getRegex(); var anyPunctuation = edit(/\\(punct)/, "gu").replace(/punct/g, _punctuation).getRegex(); var autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(); var _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex(); var tag = edit( "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>" ).replace("comment", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(); var _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/; var link = edit(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(); var reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex(); var nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex(); var reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex(); var inlineNormal = { _backpedal: noopTest, anyPunctuation, autolink, blockSkip, br, code: inlineCode, del: noopTest, emStrongLDelim, emStrongRDelimAst, emStrongRDelimUnd, escape, link, nolink, punctuation, reflink, reflinkSearch, tag, text: inlineText, url: noopTest }; var inlinePedantic = { ...inlineNormal, link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(), reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex() }; var inlineGfm = { ...inlineNormal, emStrongRDelimAst: emStrongRDelimAstGfm, emStrongLDelim: emStrongLDelimGfm, url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/, text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/ }; var inlineBreaks = { ...inlineGfm, br: edit(br).replace("{2,}", "*").getRegex(), text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }; var block = { normal: blockNormal, gfm: blockGfm, pedantic: blockPedantic }; var inline = { normal: inlineNormal, gfm: inlineGfm, breaks: inlineBreaks, pedantic: inlinePedantic }; var escapeReplacements = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }; var getEscapeReplacement = (ch) => escapeReplacements[ch]; function escape2(html2, encode) { if (encode) { if (other.escapeTest.test(html2)) { return html2.replace(other.escapeReplace, getEscapeReplacement); } } else { if (other.escapeTestNoEncode.test(html2)) { return html2.replace(other.escapeReplaceNoEncode, getEscapeReplacement); } } return html2; } function cleanUrl(href) { try { href = encodeURI(href).replace(other.percentDecode, "%"); } catch { return null; } return href; } function splitCells(tableRow, count) { const row = tableRow.replace(other.findPipe, (match, offset, str) => { let escaped = false; let curr = offset; while (--curr >= 0 && str[curr] === "\\") escaped = !escaped; if (escaped) { return "|"; } else { return " |"; } }), cells = row.split(other.splitPipe); let i = 0; if (!cells[0].trim()) { cells.shift(); } if (cells.length > 0 && !cells.at(-1)?.trim()) { cells.pop(); } if (count) { if (cells.length > count) { cells.splice(count); } else { while (cells.length < count) cells.push(""); } } for (; i < cells.length; i++) { cells[i] = cells[i].trim().replace(other.slashPipe, "|"); } return cells; } function rtrim(str, c, invert) { const l = str.length; if (l === 0) { return ""; } let suffLen = 0; while (suffLen < l) { const currChar = str.charAt(l - suffLen - 1); if (currChar === c && true) { suffLen++; } else { break; } } return str.slice(0, l - suffLen); } function findClosingBracket(str, b) { if (str.indexOf(b[1]) === -1) { return -1; } let level = 0; for (let i = 0; i < str.length; i++) { if (str[i] === "\\") { i++; } else if (str[i] === b[0]) { level++; } else if (str[i] === b[1]) { level--; if (level < 0) { return i; } } } if (level > 0) { return -2; } return -1; } function outputLink(cap, link2, raw, lexer2, rules) { const href = link2.href; const title = link2.title || null; const text = cap[1].replace(rules.other.outputLinkReplace, "$1"); lexer2.state.inLink = true; const token = { type: cap[0].charAt(0) === "!" ? "image" : "link", raw, href, title, text, tokens: lexer2.inlineTokens(text) }; lexer2.state.inLink = false; return token; } function indentCodeCompensation(raw, text, rules) { const matchIndentToCode = raw.match(rules.other.indentCodeCompensation); if (matchIndentToCode === null) { return text; } const indentToCode = matchIndentToCode[1]; return text.split("\n").map((node) => { const matchIndentInNode = node.match(rules.other.beginningSpace); if (matchIndentInNode === null) { return node; } const [indentInNode] = matchIndentInNode; if (indentInNode.length >= indentToCode.length) { return node.slice(indentToCode.length); } return node; }).join("\n"); } var _Tokenizer = class { options; rules; lexer; constructor(options2) { this.options = options2 || _defaults; } space(src) { const cap = this.rules.block.newline.exec(src); if (cap && cap[0].length > 0) { return { type: "space", raw: cap[0] }; } } code(src) { const cap = this.rules.block.code.exec(src); if (cap) { const text = cap[0].replace(this.rules.other.codeRemoveIndent, ""); return { type: "code", raw: cap[0], codeBlockStyle: "indented", text: !this.options.pedantic ? rtrim(text, "\n") : text }; } } fences(src) { const cap = this.rules.block.fences.exec(src); if (cap) { const raw = cap[0]; const text = indentCodeCompensation(raw, cap[3] || "", this.rules); return { type: "code", raw, lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : cap[2], text }; } } heading(src) { const cap = this.rules.block.heading.exec(src); if (cap) { let text = cap[2].trim(); if (this.rules.other.endingHash.test(text)) { const trimmed = rtrim(text, "#"); if (this.options.pedantic) { text = trimmed.trim(); } else if (!trimmed || this.rules.other.endingSpaceChar.test(trimmed)) { text = trimmed.trim(); } } return { type: "heading", raw: cap[0], depth: cap[1].length, text, tokens: this.lexer.inline(text) }; } } hr(src) { const cap = this.rules.block.hr.exec(src); if (cap) { return { type: "hr", raw: rtrim(cap[0], "\n") }; } } blockquote(src) { const cap = this.rules.block.blockquote.exec(src); if (cap) { let lines = rtrim(cap[0], "\n").split("\n"); let raw = ""; let text = ""; const tokens = []; while (lines.length > 0) { let inBlockquote = false; const currentLines = []; let i; for (i = 0; i < lines.length; i++) { if (this.rules.other.blockquoteStart.test(lines[i])) { currentLines.push(lines[i]); inBlockquote = true; } else if (!inBlockquote) { currentLines.push(lines[i]); } else { break; } } lines = lines.slice(i); const currentRaw = currentLines.join("\n"); const currentText = currentRaw.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, ""); raw = raw ? `${raw} ${currentRaw}` : currentRaw; text = text ? `${text} ${currentText}` : currentText; const top = this.lexer.state.top; this.lexer.state.top = true; this.lexer.blockTokens(currentText, tokens, true); this.lexer.state.top = top; if (lines.length === 0) { break; } const lastToken = tokens.at(-1); if (lastToken?.type === "code") { break; } else if (lastToken?.type === "blockquote") { const oldToken = lastToken; const newText = oldToken.raw + "\n" + lines.join("\n"); const newToken = this.blockquote(newText); tokens[tokens.length - 1] = newToken; raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw; text = text.substring(0, text.length - oldToken.text.length) + newToken.text; break; } else if (lastToken?.type === "list") { const oldToken = lastToken; const newText = oldToken.raw + "\n" + lines.join("\n"); const newToken = this.list(newText); tokens[tokens.length - 1] = newToken; raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw; text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw; lines = newText.substring(tokens.at(-1).raw.length).split("\n"); continue; } } return { type: "blockquote", raw, tokens, text }; } } list(src) { let cap = this.rules.block.list.exec(src); if (cap) { let bull = cap[1].trim(); const isordered = bull.length > 1; const list2 = { type: "list", raw: "", ordered: isordered, start: isordered ? +bull.slice(0, -1) : "", loose: false, items: [] }; bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`; if (this.options.pedantic) { bull = isordered ? bull : "[*+-]"; } const itemRegex = this.rules.other.listItemRegex(bull); let endsWithBlankLine = false; while (src) { let endEarly = false; let raw = ""; let itemContents = ""; if (!(cap = itemRegex.exec(src))) { break; } if (this.rules.block.hr.test(src)) { break; } raw = cap[0]; src = src.substring(raw.length); let line = cap[2].split("\n", 1)[0].replace(this.rules.other.listReplaceTabs, (t) => " ".repeat(3 * t.length)); let nextLine = src.split("\n", 1)[0]; let blankLine = !line.trim(); let indent = 0; if (this.options.pedantic) { indent = 2; itemContents = line.trimStart(); } else if (blankLine) { indent = cap[1].length + 1; } else { indent = cap[2].search(this.rules.other.nonSpaceChar); indent = indent > 4 ? 1 : indent; itemContents = line.slice(indent); indent += cap[1].length; } if (blankLine && this.rules.other.blankLine.test(nextLine)) { raw += nextLine + "\n"; src = src.substring(nextLine.length + 1); endEarly = true; } if (!endEarly) { const nextBulletRegex = this.rules.other.nextBulletRegex(indent); const hrRegex = this.rules.other.hrRegex(indent); const fencesBeginRegex = this.rules.other.fencesBeginRegex(indent); const headingBeginRegex = this.rules.other.headingBeginRegex(indent); const htmlBeginRegex = this.rules.other.htmlBeginRegex(indent); while (src) { const rawLine = src.split("\n", 1)[0]; let nextLineWithoutTabs; nextLine = rawLine; if (this.options.pedantic) { nextLine = nextLine.replace(this.rules.other.listReplaceNesting, " "); nextLineWithoutTabs = nextLine; } else { nextLineWithoutTabs = nextLine.replace(this.rules.other.tabCharGlobal, " "); } if (fencesBeginRegex.test(nextLine)) { break; } if (headingBeginRegex.test(nextLine)) { break; } if (htmlBeginRegex.test(nextLine)) { break; } if (nextBulletRegex.test(nextLine)) { break; } if (hrRegex.test(nextLine)) { break; } if (nextLineWithoutTabs.search(this.rules.other.nonSpaceChar) >= indent || !nextLine.trim()) { itemContents += "\n" + nextLineWithoutTabs.slice(indent); } else { if (blankLine) { break; } if (line.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4) { break; } if (fencesBeginRegex.test(line)) { break; } if (headingBeginRegex.test(line)) { break; } if (hrRegex.test(line)) { break; } itemContents += "\n" + nextLine; } if (!blankLine && !nextLine.trim()) { blankLine = true; } raw += rawLine + "\n"; src = src.substring(rawLine.length + 1); line = nextLineWithoutTabs.slice(indent); } } if (!list2.loose) { if (endsWithBlankLine) { list2.loose = true; } else if (this.rules.other.doubleBlankLine.test(raw)) { endsWithBlankLine = true; } } let istask = null; let ischecked; if (this.options.gfm) { istask = this.rules.other.listIsTask.exec(itemContents); if (istask) { ischecked = istask[0] !== "[ ] "; itemContents = itemContents.replace(this.rules.other.listReplaceTask, ""); } } list2.items.push({ type: "list_item", raw, task: !!istask, checked: ischecked, loose: false, text: itemContents, tokens: [] }); list2.raw += raw; } const lastItem = list2.items.at(-1); if (lastItem) { lastItem.raw = lastItem.raw.trimEnd(); lastItem.text = lastItem.text.trimEnd(); } else { return; } list2.raw = list2.raw.trimEnd(); for (let i = 0; i < list2.items.length; i++) { this.lexer.state.top = false; list2.items[i].tokens = this.lexer.blockTokens(list2.items[i].text, []); if (!list2.loose) { const spacers = list2.items[i].tokens.filter((t) => t.type === "space"); const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t) => this.rules.other.anyLine.test(t.raw)); list2.loose = hasMultipleLineBreaks; } } if (list2.loose) { for (let i = 0; i < list2.items.length; i++) { list2.items[i].loose = true; } } return list2; } } html(src) { const cap = this.rules.block.html.exec(src); if (cap) { const token = { type: "html", block: true, raw: cap[0], pre: cap[1] === "pre" || cap[1] === "script" || cap[1] === "style", text: cap[0] }; return token; } } def(src) { const cap = this.rules.block.def.exec(src); if (cap) { const tag2 = cap[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "); const href = cap[2] ? cap[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : ""; const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3]; return { type: "def", tag: tag2, raw: cap[0], href, title }; } } table(src) { const cap = this.rules.block.table.exec(src); if (!cap) { return; } if (!this.rules.other.tableDelimiter.test(cap[2])) { return; } const headers = splitCells(cap[1]); const aligns = cap[2].replace(this.rules.other.tableAlignChars, "").split("|"); const rows = cap[3]?.trim() ? cap[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : []; const item = { type: "table", raw: cap[0], header: [], align: [], rows: [] }; if (headers.length !== aligns.length) { return; } for (const align of aligns) { if (this.rules.other.tableAlignRight.test(align)) { item.align.push("right"); } else if (this.rules.other.tableAlignCenter.test(align)) { item.align.push("center"); } else if (this.rules.other.tableAlignLeft.test(align)) { item.align.push("left"); } else { item.align.push(null); } } for (let i = 0; i < headers.length; i++) { item.header.push({ text: headers[i], tokens: this.lexer.inline(headers[i]), header: true, align: item.align[i] }); } for (const row of rows) { item.rows.push(splitCells(row, item.header.length).map((cell, i) => { return { text: cell, tokens: this.lexer.inline(cell), header: false, align: item.align[i] }; })); } return item; } lheading(src) { const cap = this.rules.block.lheading.exec(src); if (cap) { return { type: "heading", raw: cap[0], depth: cap[2].charAt(0) === "=" ? 1 : 2, text: cap[1], tokens: this.lexer.inline(cap[1]) }; } } paragraph(src) { const cap = this.rules.block.paragraph.exec(src); if (cap) { const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1]; return { type: "paragraph", raw: cap[0], text, tokens: this.lexer.inline(text) }; } } text(src) { const cap = this.rules.block.text.exec(src); if (cap) { return { type: "text", raw: cap[0], text: cap[0], tokens: this.lexer.inline(cap[0]) }; } } escape(src) { const cap = this.rules.inline.escape.exec(src); if (cap) { return { type: "escape", raw: cap[0], text: cap[1] }; } } tag(src) { const cap = this.rules.inline.tag.exec(src); if (cap) { if (!this.lexer.state.inLink && this.rules.other.startATag.test(cap[0])) { this.lexer.state.inLink = true; } else if (this.lexer.state.inLink && this.rules.other.endATag.test(cap[0])) { this.lexer.state.inLink = false; } if (!this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(cap[0])) { this.lexer.state.inRawBlock = true; } else if (this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(cap[0])) { this.lexer.state.inRawBlock = false; } return { type: "html", raw: cap[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: cap[0] }; } } link(src) { const cap = this.rules.inline.link.exec(src); if (cap) { const trimmedUrl = cap[2].trim(); if (!this.options.pedantic && this.rules.other.startAngleBracket.test(trimmedUrl)) { if (!this.rules.other.endAngleBracket.test(trimmedUrl)) { return; } const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\"); if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) { return; } } else { const lastParenIndex = findClosingBracket(cap[2], "()"); if (lastParenIndex === -2) { return; } if (lastParenIndex > -1) { const start = cap[0].indexOf("!") === 0 ? 5 : 4; const linkLen = start + cap[1].length + lastParenIndex; cap[2] = cap[2].substring(0, lastParenIndex); cap[0] = cap[0].substring(0, linkLen).trim(); cap[3] = ""; } } let href = cap[2]; let title = ""; if (this.options.pedantic) { const link2 = this.rules.other.pedanticHrefTitle.exec(href); if (link2) { href = link2[1]; title = link2[3]; } } else { title = cap[3] ? cap[3].slice(1, -1) : ""; } href = href.trim(); if (this.rules.other.startAngleBracket.test(href)) { if (this.options.pedantic && !this.rules.other.endAngleBracket.test(trimmedUrl)) { href = href.slice(1); } else { href = href.slice(1, -1); } } return outputLink(cap, { href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href, title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title }, cap[0], this.lexer, this.rules); } } reflink(src, links) { let cap; if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) { const linkString = (cap[2] || cap[1]).replace(this.rules.other.multipleSpaceGlobal, " "); const link2 = links[linkString.toLowerCase()]; if (!link2) { const text = cap[0].charAt(0); return { type: "text", raw: text, text }; } return outputLink(cap, link2, cap[0], this.lexer, this.rules); } } emStrong(src, maskedSrc, prevChar = "") { let match = this.rules.inline.emStrongLDelim.exec(src); if (!match) return; if (match[3] && prevChar.match(this.rules.other.unicodeAlphaNumeric)) return; const nextChar = match[1] || match[2] || ""; if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) { const lLength = [...match[0]].length - 1; let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0; const endReg = match[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd; endReg.lastIndex = 0; maskedSrc = maskedSrc.slice(-1 * src.length + lLength); while ((match = endReg.exec(maskedSrc)) != null) { rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6]; if (!rDelim) continue; rLength = [...rDelim].length; if (match[3] || match[4]) { delimTotal += rLength; continue; } else if (match[5] || match[6]) { if (lLength % 3 && !((lLength + rLength) % 3)) { midDelimTotal += rLength; continue; } } delimTotal -= rLength; if (delimTotal > 0) continue; rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal); const lastCharLength = [...match[0]][0].length; const raw = src.slice(0, lLength + match.index + lastCharLength + rLength); if (Math.min(lLength, rLength) % 2) { const text2 = raw.slice(1, -1); return { type: "em", raw, text: text2, tokens: this.lexer.inlineTokens(text2) }; } const text = raw.slice(2, -2); return { type: "strong", raw, text, tokens: this.lexer.inlineTokens(text) }; } } } codespan(src) { const cap = this.rules.inline.code.exec(src); if (cap) { let text = cap[2].replace(this.rules.other.newLineCharGlobal, " "); const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(text); const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text) && this.rules.other.endingSpaceChar.test(text); if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) { text = text.substring(1, text.length - 1); } return { type: "codespan", raw: cap[0], text }; } } br(src) { const cap = this.rules.inline.br.exec(src); if (cap) { return { type: "br", raw: cap[0] }; } } del(src) { const cap = this.rules.inline.del.exec(src); if (cap) { return { type: "del", raw: cap[0], text: cap[2], tokens: this.lexer.inlineTokens(cap[2]) }; } } autolink(src) { const cap = this.rules.inline.autolink.exec(src); if (cap) { let text, href; if (cap[2] === "@") { text = cap[1]; href = "mailto:" + text; } else { text = cap[1]; href = text; } return { type: "link", raw: cap[0], text, href, tokens: [ { type: "text", raw: text, text } ] }; } } url(src) { let cap; if (cap = this.rules.inline.url.exec(src)) { let text, href; if (cap[2] === "@") { text = cap[0]; href = "mailto:" + text; } else { let prevCapZero; do { prevCapZero = cap[0]; cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? ""; } while (prevCapZero !== cap[0]); text = cap[0]; if (cap[1] === "www.") { href = "http://" + cap[0]; } else { href = cap[0]; } } return { type: "link", raw: cap[0], text, href, tokens: [ { type: "text", raw: text, text } ] }; } } inlineText(src) { const cap = this.rules.inline.text.exec(src); if (cap) { const escaped = this.lexer.state.inRawBlock; return { type: "text", raw: cap[0], text: cap[0], escaped }; } } }; var _Lexer = class __Lexer { tokens; options; state; tokenizer; inlineQueue; constructor(options2) { this.tokens = []; this.tokens.links = Object.create(null); this.options = options2 || _defaults; this.options.tokenizer = this.options.tokenizer || new _Tokenizer(); this.tokenizer = this.options.tokenizer; this.tokenizer.options = this.options; this.tokenizer.lexer = this; this.inlineQueue = []; this.state = { inLink: false, inRawBlock: false, top: true }; const rules = { other, block: block.normal, inline: inline.normal }; if (this.options.pedantic) { rules.block = block.pedantic; rules.inline = inline.pedantic; } else if (this.options.gfm) { rules.block = block.gfm; if (this.options.breaks) { rules.inline = inline.breaks; } else { rules.inline = inline.gfm; } } this.tokenizer.rules = rules; } static get rules() { return { block, inline }; } static lex(src, options2) { const lexer2 = new __Lexer(options2); return lexer2.lex(src); } static lexInline(src, options2) { const lexer2 = new __Lexer(options2); return lexer2.inlineTokens(src); } lex(src) { src = src.replace(other.carriageReturn, "\n"); this.blockTokens(src, this.tokens); for (let i = 0; i < this.inlineQueue.length; i++) { const next = this.inlineQueue[i]; this.inlineTokens(next.src, next.tokens); } this.inlineQueue = []; return this.tokens; } blockTokens(src, tokens = [], lastParagraphClipped = false) { if (this.options.pedantic) { src = src.replace(other.tabCharGlobal, " ").replace(other.spaceLine, ""); } while (src) { let token; if (this.options.extensions?.block?.some((extTokenizer) => { if (token = extTokenizer.call({ lexer: this }, src, tokens)) { src = src.substring(token.raw.length); tokens.push(token); return true; } return false; })) { continue; } if (token = this.tokenizer.space(src)) { src = src.substring(token.raw.length); const lastToken = tokens.at(-1); if (token.raw.length === 1 && lastToken !== void 0) { lastToken.raw += "\n"; } else { tokens.push(token); } continue; } if (token = this.tokenizer.code(src)) { src = src.substring(token.raw.length); const lastToken = tokens.at(-1); if (lastToken?.type === "paragraph" || lastToken?.type === "text") { lastToken.raw += "\n" + token.raw; lastToken.text += "\n" + token.text; this.inlineQueue.at(-1).src = lastToken.text; } else { tokens.push(token); } continue; } if (token = this.tokenizer.fences(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (token = this.tokenizer.heading(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (token = this.tokenizer.hr(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (token = this.tokenizer.blockquote(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (token = this.tokenizer.list(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (token = this.tokenizer.html(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (token = this.tokenizer.def(src)) { src = src.substring(token.raw.length); const lastToken = tokens.at(-1); if (lastToken?.type === "paragraph" || lastToken?.type === "text") { lastToken.raw += "\n" + token.raw; lastToken.text += "\n" + token.raw; this.inlineQueue.at(-1).src = lastToken.text; } else if (!this.tokens.links[token.tag]) { this.tokens.links[token.tag] = { href: token.href, title: token.title }; } continue; } if (token = this.tokenizer.table(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (token = this.tokenizer.lheading(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } let cutSrc = src; if (this.options.extensions?.startBlock) { let startIndex = Infinity; const tempSrc = src.slice(1); let tempStart; this.options.extensions.startBlock.forEach((getStartIndex) => { tempStart = getStartIndex.call({ lexer: this }, tempSrc); if (typeof tempStart === "number" && tempStart >= 0) { startIndex = Math.min(startIndex, tempStart); } }); if (startIndex < Infinity && startIndex >= 0) { cutSrc = src.substring(0, startIndex + 1); } } if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) { const lastToken = tokens.at(-1); if (lastParagraphClipped && lastToken?.type === "paragraph") { lastToken.raw += "\n" + token.raw; lastToken.text += "\n" + token.text; this.inlineQueue.pop(); this.inlineQueue.at(-1).src = lastToken.text; } else { tokens.push(token); } lastParagraphClipped = cutSrc.length !== src.length; src = src.substring(token.raw.length); continue; } if (token = this.tokenizer.text(src)) { src = src.substring(token.raw.length); const lastToken = tokens.at(-1); if (lastToken?.type === "text") { lastToken.raw += "\n" + token.raw; lastToken.text += "\n" + token.text; this.inlineQueue.pop(); this.inlineQueue.at(-1).src = lastToken.text; } else { tokens.push(token); } continue; } if (src) { const errMsg = "Infinite loop on byte: " + src.charCodeAt(0); if (this.options.silent) { console.error(errMsg); break; } else { throw new Error(errMsg); } } } this.state.top = true; return tokens; } inline(src, tokens = []) { this.inlineQueue.push({ src, tokens }); return tokens; } inlineTokens(src, tokens = []) { let maskedSrc = src; let match = null; if (this.tokens.links) { const links = Object.keys(this.tokens.links); if (links.length > 0) { while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) { if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) { maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex); } } } } while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) { maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex); } while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) { maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); } let keepPrevChar = false; let prevChar = ""; while (src) { if (!keepPrevChar) { prevChar = ""; } keepPrevChar = false; let token; if (this.options.extensions?.inline?.some((extTokenizer) => { if (token = extTokenizer.call({ lexer: this }, src, tokens)) { src = src.substring(token.raw.length); tokens.push(token); return true; } return false; })) { continue; } if (token = this.tokenizer.escape(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (token = this.tokenizer.tag(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (token = this.tokenizer.link(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (token = this.tokenizer.reflink(src, this.tokens.links)) { src = src.substring(token.raw.length); const lastToken = tokens.at(-1); if (token.type === "text" && lastToken?.type === "text") { lastToken.raw += token.raw; lastToken.text += token.text; } else { tokens.push(token); } continue; } if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (token = this.tokenizer.codespan(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (token = this.tokenizer.br(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (token = this.tokenizer.del(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (token = this.tokenizer.autolink(src)) { src = src.substring(token.raw.length); tokens.push(token); continue; } if (!this.state.inLink && (token = this.tokenizer.url(src))) { src = src.substring(token.raw.length); tokens.push(token); continue; } let cutSrc = src; if (this.options.extensions?.startInline) { let startIndex = Infinity; const tempSrc = src.slice(1); let tempStart; this.options.extensions.startInline.forEach((getStartIndex) => { tempStart = getStartIndex.call({ lexer: this }, tempSrc); if (typeof tempStart === "number" && tempStart >= 0) { startIndex = Math.min(startIndex, tempStart); } }); if (startIndex < Infinity && startIndex >= 0) { cutSrc = src.substring(0, startIndex + 1); } } if (token = this.tokenizer.inlineText(cutSrc)) { src = src.substring(token.raw.length); if (token.raw.slice(-1) !== "_") { prevChar = token.raw.slice(-1); } keepPrevChar = true; const lastToken = tokens.at(-1); if (lastToken?.type === "text") { lastToken.raw += token.raw; lastToken.text += token.text; } else { tokens.push(token); } continue; } if (src) { const errMsg = "Infinite loop on byte: " + src.charCodeAt(0); if (this.options.silent) { console.error(errMsg); break; } else { throw new Error(errMsg); } } } return tokens; } }; var _Renderer = class { options; parser; constructor(options2) { this.options = options2 || _defaults; } space(token) { return ""; } code({ text, lang, escaped }) { const langString = (lang || "").match(other.notSpaceStart)?.[0]; const code = text.replace(other.endingNewline, "") + "\n"; if (!langString) { return "<pre><code>" + (escaped ? code : escape2(code, true)) + "</code></pre>\n"; } return '<pre><code class="language-' + escape2(langString) + '">' + (escaped ? code : escape2(code, true)) + "</code></pre>\n"; } blockquote({ tokens }) { const body = this.parser.parse(tokens); return `<blockquote> ${body}</blockquote> `; } html({ text }) { return text; } heading({ tokens, depth }) { return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}> `; } hr(token) { return "<hr>\n"; } list(token) { const ordered = token.ordered; const start = token.start; let body = ""; for (let j = 0; j < token.items.length; j++) { const item = token.items[j]; body += this.listitem(item); } const type = ordered ? "ol" : "ul"; const startAttr = ordered && start !== 1 ? ' start="' + start + '"' : ""; return "<" + type + startAttr + ">\n" + body + "</" + type + ">\n"; } listitem(item) { let itemBody = ""; if (item.task) { const checkbox = this.checkbox({ checked: !!item.checked }); if (item.loose) { if (item.tokens[0]?.type === "paragraph") { item.tokens[0].text = checkbox + " " + item.tokens[0].text; if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") { item.tokens[0].tokens[0].text = checkbox + " " + escape2(item.tokens[0].tokens[0].text); item.tokens[0].tokens[0].escaped = true; } } else { item.tokens.unshift({ type: "text", raw: checkbox + " ", text: checkbox + " ", escaped: true }); } } else { itemBody += checkbox + " "; } } itemBody += this.parser.parse(item.tokens, !!item.loose); return `<li>${itemBody}</li> `; } checkbox({ checked }) { return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">'; } paragraph({ tokens }) { return `<p>${this.parser.parseInline(tokens)}</p> `; } table(token) { let header = ""; let cell = ""; for (let j = 0; j < token.header.length; j++) { cell += this.tablecell(token.header[j]); } header += this.tablerow({ text: cell }); let body = ""; for (let j = 0; j < token.rows.length; j++) { const row = token.rows[j]; cell = ""; for (let k = 0; k < row.length; k++) { cell += this.tablecell(row[k]); } body += this.tablerow({ text: cell }); } if (body) body = `<tbody>${body}</tbody>`; return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n"; } tablerow({ text }) { return `<tr> ${text}</tr> `; } tablecell(token) { const content = this.parser.parseInline(token.tokens); const type = token.header ? "th" : "td"; const tag2 = token.align ? `<${type} align="${token.align}">` : `<${type}>`; return tag2 + content + `</${type}> `; } strong({ tokens }) { return `<strong>${this.parser.parseInline(tokens)}</strong>`; } em({ tokens }) { return `<em>${this.parser.parseInline(tokens)}</em>`; } codespan({ text }) { return `<code>${escape2(text, true)}</code>`; } br(token) { return "<br>"; } del({ tokens }) { return `<del>${this.parser.parseInline(tokens)}</del>`; } link({ href, title, tokens }) { const text = this.parser.parseInline(tokens); const cleanHref = cleanUrl(href); if (cleanHref === null) { return text; } href = cleanHref; let out = '<a href="' + href + '"'; if (title) { out += ' title="' + escape2(title) + '"'; } out += ">" + text + "</a>"; return out; } image({ href, title, text, tokens }) { if (tokens) { text = this.parser.parseInline(tokens, this.parser.textRenderer); } const cleanHref = cleanUrl(href); if (cleanHref === null) { return escape2(text); } href = cleanHref; let out = `<img src="${href}" alt="${text}"`; if (title) { out += ` title="${escape2(title)}"`; } out += ">"; return out; } text(token) { return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : "escaped" in token && token.escaped ? token.text : escape2(token.text); } }; var _TextRenderer = class { strong({ text }) { return text; } em({ text }) { return text; } codespan({ text }) { return text; } del({ text }) { return text; } html({ text }) { return text; } text({ text }) { return text; } link({ text }) { return "" + text; } image({ text }) { return "" + text; } br() { return ""; } }; var _Parser = class __Parser { options; renderer; textRenderer; constructor(options2) { this.options = options2 || _defaults; this.options.renderer = this.options.renderer || new _Renderer(); this.renderer = this.options.renderer; this.renderer.options = this.options; this.renderer.parser = this; this.textRenderer = new _TextRenderer(); } static parse(tokens, options2) { const parser2 = new __Parser(options2); return parser2.parse(tokens); } static parseInline(tokens, options2) { const parser2 = new __Parser(options2); return parser2.parseInline(tokens); } parse(tokens, top = true) { let out = ""; for (let i = 0; i < tokens.length; i++) { const anyToken = tokens[i]; if (this.options.extensions?.renderers?.[anyToken.type]) { const genericToken = anyToken; const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken); if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) { out += ret || ""; continue; } } const token = anyToken; switch (token.type) { case "space": { out += this.renderer.space(token); continue; } case "hr": { out += this.renderer.hr(token); continue; } case "heading": { out += this.renderer.heading(token); continue; } case "code": { out += this.renderer.code(token); continue; } case "table": { out += this.renderer.table(token); continue; } case "blockquote": { out += this.renderer.blockquote(token); continue; } case "list": { out += this.renderer.list(token); continue; } case "html": { out += this.renderer.html(token); continue; } case "paragraph": { out += this.renderer.paragraph(token); continue; } case "text": { let textToken = token; let body = this.renderer.text(textToken); while (i + 1 < tokens.length && tokens[i + 1].type === "text") { textToken = tokens[++i]; body += "\n" + this.renderer.text(textToken); } if (top) { out += this.renderer.paragraph({ type: "paragraph", raw: body, text: body, tokens: [{ type: "text", raw: body, text: body, escaped: true }] }); } else { out += body; } continue; } default: { const errMsg = 'Token with "' + token.type + '" type was not found.'; if (this.options.silent) { console.error(errMsg); return ""; } else { throw new Error(errMsg); } } } } return out; } parseInline(tokens, renderer = this.renderer) { let out = ""; for (let i = 0; i < tokens.length; i++) { const anyToken = tokens[i]; if (this.options.extensions?.renderers?.[anyToken.type]) { const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken); if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(anyToken.type)) { out += ret || ""; continue; } } const token = anyToken; switch (token.type) { case "escape": { out += renderer.text(token); break; } case "html": { out += renderer.html(token); break; } case "link": { out += renderer.link(token); break; } case "image": { out += renderer.image(token); break; } case "strong": { out += renderer.strong(token); break; } case "em": { out += renderer.em(token); break; } case "codespan": { out += renderer.codespan(token); break; } case "br": { out += renderer.br(token); break; } case "del": { out += renderer.del(token); break; } case "text": { out += renderer.text(token); break; } default: { const errMsg = 'Token with "' + token.type + '" type was not found.'; if (this.options.silent) { console.error(errMsg); return ""; } else { throw new Error(errMsg); } } } } return out; } }; var _Hooks = class { options; block; constructor(options2) { this.options = options2 || _defaults; } static passThroughHooks = new Set([ "preprocess", "postprocess", "processAllTokens" ]); preprocess(markdown) { return markdown; } postprocess(html2) { return html2; } processAllTokens(tokens) { return tokens; } provideLexer() { return this.block ? _Lexer.lex : _Lexer.lexInline; } provideParser() { return this.block ? _Parser.parse : _Parser.parseInline; } }; var Marked = class { defaults = _getDefaults(); options = this.setOptions; parse = this.parseMarkdown(true); parseInline = this.parseMarkdown(false); Parser = _Parser; Renderer = _Renderer; TextRenderer = _TextRenderer; Lexer = _Lexer; Tokenizer = _Tokenizer; Hooks = _Hooks; constructor(...args) { this.use(...args); } walkTokens(tokens, callback) { let values = []; for (const token of tokens) { values = values.concat(callback.call(this, token)); switch (token.type) { case "table": { const tableToken = token; for (const cell of tableToken.header) { values = values.concat(this.walkTokens(cell.tokens, callback)); } for (const row of tableToken.rows) { for (const cell of row) { values = values.concat(this.walkTokens(cell.tokens, callback)); } } break; } case "list": { const listToken = token; values = values.concat(this.walkTokens(listToken.items, callback)); break; } default: { const genericToken = token; if (this.defaults.extensions?.childTokens?.[genericToken.type]) { this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => { const tokens2 = genericToken[childTokens].flat(Infinity); values = values.concat(this.walkTokens(tokens2, callback)); }); } else if (genericToken.tokens) { values = values.concat(this.walkTokens(genericToken.tokens, callback)); } } } } return values; } use(...args) { const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} }; args.forEach((pack) => { const opts = { ...pack }; opts.async = this.defaults.async || opts.async || false; if (pack.extensions) { pack.extensions.forEach((ext) => { if (!ext.name) { throw new Error("extension name required"); } if ("renderer" in ext) { const prevRenderer = extensions.renderers[ext.name]; if (prevRenderer) { extensions.renderers[ext.name] = function(...args2) { let ret = ext.renderer.apply(this, args2); if (ret === false) { ret = prevRenderer.apply(this, args2); } return ret; }; } else { extensions.renderers[ext.name] = ext.renderer; } } if ("tokenizer" in ext) { if (!ext.level || ext.level !== "block" && ext.level !== "inline") { throw new Error("extension level must be 'block' or 'inline'"); } const extLevel = extensions[ext.level]; if (extLevel) { extLevel.unshift(ext.tokenizer); } else { extensions[ext.level] = [ext.tokenizer]; } if (ext.start) { if (ext.level === "block") { if (extensions.startBlock) { extensions.startBlock.push(ext.start); } else { extensions.startBlock = [ext.start]; } } else if (ext.level === "inline") { if (extensions.startInline) { extensions.startInline.push(ext.start); } else { extensions.startInline = [ext.start]; } } } } if ("childTokens" in ext && ext.childTokens) { extensions.childTokens[ext.name] = ext.childTokens; } }); opts.extensions = extensions; } if (pack.renderer) { const renderer = this.defaults.renderer || new _Renderer(this.defaults); for (const prop in pack.renderer) { if (!(prop in renderer)) { throw new Error(`renderer '${prop}' does not exist`); } if (["options", "parser"].includes(prop)) { continue; } const rendererProp = prop; const rendererFunc = pack.renderer[rendererProp]; const prevRenderer = renderer[rendererProp]; renderer[rendererProp] = (...args2) => { let ret = rendererFunc.apply(renderer, args2); if (ret === false) { ret = prevRenderer.apply(renderer, args2); } return ret || ""; }; } opts.renderer = renderer; } if (pack.tokenizer) { const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults); for (const prop in pack.tokenizer) { if (!(prop in tokenizer)) { throw new Error(`tokenizer '${prop}' does not exist`); } if (["options", "rules", "lexer"].includes(prop)) { continue; } const tokenizerProp = prop; const tokenizerFunc = pack.tokenizer[tokenizerProp]; const prevTokenizer = tokenizer[tokenizerProp]; tokenizer[tokenizerProp] = (...args2) => { let ret = tokenizerFunc.apply(tokenizer, args2); if (ret === false) { ret = prevTokenizer.apply(tokenizer, args2); } return ret; }; } opts.tokenizer = tokenizer; } if (pack.hooks) { const hooks = this.defaults.hooks || new _Hooks(); for (const prop in pack.hooks) { if (!(prop in hooks)) { throw new Error(`hook '${prop}' does not exist`); } if (["options", "block"].includes(prop)) { continue; } const hooksProp = prop; const hooksFunc = pack.hooks[hooksProp]; const prevHook = hooks[hooksProp]; if (_Hooks.passThroughHooks.has(prop)) { hooks[hooksProp] = (arg) => { if (this.defaults.async) { return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => { return prevHook.call(hooks, ret2); }); } const ret = hooksFunc.call(hooks, arg); return prevHook.call(hooks, ret); }; } else { hooks[hooksProp] = (...args2) => { let ret = hooksFunc.apply(hooks, args2); if (ret === false) { ret = prevHook.apply(hooks, args2); } return ret; }; } } opts.hooks = hooks; } if (pack.walkTokens) { const walkTokens2 = this.defaults.walkTokens; const packWalktokens = pack.walkTokens; opts.walkTokens = function(token) { let values = []; values.push(packWalktokens.call(this, token)); if (walkTokens2) { values = values.concat(walkTokens2.call(this, token)); } return values; }; } this.defaults = { ...this.defaults, ...opts }; }); return this; } setOptions(opt) { this.defaults = { ...this.defaults, ...opt }; return this; } lexer(src, options2) { return _Lexer.lex(src, options2 ?? this.defaults); } parser(tokens, options2) { return _Parser.parse(tokens, options2 ?? this.defaults); } parseMarkdown(blockType) { const parse2 = (src, options2) => { const origOpt = { ...options2 }; const opt = { ...this.defaults, ...origOpt }; const throwError = this.onError(!!opt.silent, !!opt.async); if (this.defaults.async === true && origOpt.async === false) { return throwError(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.")); } if (typeof src === "undefined" || src === null) { return throwError(new Error("marked(): input parameter is undefined or null")); } if (typeof src !== "string") { return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected")); } if (opt.hooks) { opt.hooks.options = opt; opt.hooks.block = blockType; } const lexer2 = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline; const parser2 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline; if (opt.async) { return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError); } try { if (opt.hooks) { src = opt.hooks.preprocess(src); } let tokens = lexer2(src, opt); if (opt.hooks) { tokens = opt.hooks.processAllTokens(tokens); } if (opt.walkTokens) { this.walkTokens(tokens, opt.walkTokens); } let html2 = parser2(tokens, opt); if (opt.hooks) { html2 = opt.hooks.postprocess(html2); } return html2; } catch (e) { return throwError(e); } }; return parse2; } onError(silent, async) { return (e) => { e.message += "\nPlease report this to https://github.com/markedjs/marked."; if (silent) { const msg = "<p>An error occurred:</p><pre>" + escape2(e.message + "", true) + "</pre>"; if (async) { return Promise.resolve(msg); } return msg; } if (async) { return Promise.reject(e); } throw e; }; } }; var markedInstance = new Marked(); function marked(src, opt) { return markedInstance.parse(src, opt); } marked.options = marked.setOptions = function(options2) { markedInstance.setOptions(options2); marked.defaults = markedInstance.defaults; changeDefaults(marked.defaults); return marked; }; marked.getDefaults = _getDefaults; marked.defaults = _defaults; marked.use = function(...args) { markedInstance.use(...args); marked.defaults = markedInstance.defaults; changeDefaults(marked.defaults); return marked; }; marked.walkTokens = function(tokens, callback) { return markedInstance.walkTokens(tokens, callback); }; marked.parseInline = markedInstance.parseInline; marked.Parser = _Parser; marked.parser = _Parser.parse; marked.Renderer = _Renderer; marked.TextRenderer = _TextRenderer; marked.Lexer = _Lexer; marked.lexer = _Lexer.lex; marked.Tokenizer = _Tokenizer; marked.Hooks = _Hooks; marked.parse = marked; marked.options; marked.setOptions; marked.use; marked.walkTokens; marked.parseInline; _Parser.parse; _Lexer.lex; const TAG_NAME_PATTERN = "[A-Za-z][A-Za-z0-9:_.-]*"; const OPEN_TAG_RE = new RegExp(`^<\\s*(${TAG_NAME_PATTERN})(?=[\\s/>])[^>]*>`); const CLOSE_TAG_RE = new RegExp(`^<\\s*\\/\\s*(${TAG_NAME_PATTERN})\\s*>`); const KNOWN_HTML_TAGS = new Set([ "a", "abbr", "address", "article", "aside", "audio", "b", "bdi", "bdo", "blockquote", "br", "button", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "div", "dl", "dt", "em", "figcaption", "figure", "footer", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hr", "i", "iframe", "img", "input", "ins", "kbd", "label", "li", "main", "mark", "menu", "meter", "nav", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "small", "source", "span", "strong", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "u", "ul", "var", "video", "wbr", "svg", "path", "g", "circle", "rect", "line", "polyline", "polygon", "ellipse", "text", "tspan", "use", "defs", "symbol", "lineargradient", "radialgradient", "stop", "clippath", "mask", "foreignobject" ]); const isKnownTag = (tagName) => KNOWN_HTML_TAGS.has(tagName.toLowerCase()); const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); const escapeHtmlLiteral = (value) => value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); const highlightXmlLikeLiteral = (raw) => { const escaped = escapeHtmlLiteral(raw); return escaped.replace(/(<\/?)([\w-:]+)(.*?)(>)/g, (_, open, tag2, attrs, close) => { const highlightedAttrs = String(attrs).replace( /([\w-:]+)(=)(".*?"|'.*?')/g, '<span class="xv-attr-name">$1</span><span class="xv-equals">$2</span><span class="xv-attr-value">$3</span>' ); return `<span class="xv-bracket">${open}</span><span class="xv-tag">${tag2}</span>${highlightedAttrs}<span class="xv-bracket">${close}</span>`; }); }; const buildLiteralToken = (type, raw) => ({ type, raw, text: raw }); const matchUnknownTagSegment = (source) => { if (!source.startsWith("<")) return null; if (/^<\s*[!?]/.test(source)) return null; const closeMatch = source.match(CLOSE_TAG_RE); if (closeMatch) { return isKnownTag(closeMatch[1]) ? null : closeMatch[0]; } const openMatch = source.match(OPEN_TAG_RE); if (!openMatch) return null; const tagName = openMatch[1]; if (isKnownTag(tagName)) return null; const openingRaw = openMatch[0]; if (/\/\s*>$/.test(openingRaw)) return openingRaw; const closingTagRe = new RegExp(`<\\s*\\/\\s*${escapeRegExp(tagName)}\\s*>`, "i"); const rest = source.slice(openingRaw.length); const closingMatch = closingTagRe.exec(rest); if (!closingMatch) return openingRaw; const endIndex = openingRaw.length + closingMatch.index + closingMatch[0].length; return source.slice(0, endIndex); }; const renderLiteralToken = (token) => { const raw = typeof token.text === "string" ? token.text : token.raw; return highlightXmlLikeLiteral(raw).replace(/\n/g, "<br>\n"); }; const unknownTagBlockExtension = { name: "unknownTagBlockLiteral", level: "block", start(src) { const index = src.indexOf("<"); return index >= 0 ? index : void 0; }, tokenizer(src) { const leadingSpaces = src.match(/^( {0,3})/)?.[0] ?? ""; const rawSource = src.slice(leadingSpaces.length); if (!rawSource.startsWith("<")) return void 0; const matched = matchUnknownTagSegment(rawSource); if (!matched) return void 0; return buildLiteralToken("unknownTagBlockLiteral", `${leadingSpaces}${matched}`); }, renderer(token) { return renderLiteralToken(token); } }; const unknownTagInlineExtension = { name: "unknownTagInlineLiteral", level: "inline", start(src) { const index = src.indexOf("<"); return index >= 0 ? index : void 0; }, tokenizer(src) { const matched = matchUnknownTagSegment(src); if (!matched) return void 0; return buildLiteralToken("unknownTagInlineLiteral", matched); }, renderer(token) { return renderLiteralToken(token); } }; const unknownTagLiteralExtensions = [ unknownTagBlockExtension, unknownTagInlineExtension ]; const _hoisted_1$8 = { class: "prose-wrapper" }; const _hoisted_2$8 = ["innerHTML"]; const _sfc_main$a = defineComponent({ __name: "ProseContent", props: { content: {}, wrapLines: { type: Boolean, default: true } }, emits: ["update:content"], setup(__props) { useCssVars((_ctx) => ({ "v2941c8b5": _ctx.wrapLines ? "auto" : "scroll", "e754ac8c": _ctx.wrapLines ? "pre-wrap" : "pre" })); const props = __props; const markdownParser = new Marked({ breaks: true, gfm: true }); markdownParser.use({ extensions: unknownTagLiteralExtensions }); const htmlContent = computed(() => { if (!props.content) return ""; try { return markdownParser.parse(props.content, { async: false }); } catch (e) { console.error("Markdown parsing error:", e); return escapeHtmlLiteral(props.content); } }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$8, [ createElementVNode("div", { class: "prose", innerHTML: htmlContent.value }, null, 8, _hoisted_2$8) ]); }; } }); const ProseContent = _export_sfc(_sfc_main$a, [["__scopeId", "data-v-f5992598"]]); const _hoisted_1$7 = { class: "xml-view-container" }; const _hoisted_2$7 = ["innerHTML"]; const _sfc_main$9 = defineComponent({ __name: "XMLViewer", props: { content: {}, wrapLines: { type: Boolean, default: true } }, setup(__props) { useCssVars((_ctx) => ({ "v07dd4f84": _ctx.wrapLines ? "pre-wrap" : "pre", "v77d3f20b": _ctx.wrapLines ? "break-all" : "normal", "v4aad7caa": _ctx.wrapLines ? "auto" : "scroll" })); const props = __props; const highlightedXML = computed(() => { let xml = props.content.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); return xml.replace(/(<\/?)([\w-:]+)(.*?)(>)/g, (_, open, tag2, attrs, close) => { const highlightedAttrs = attrs.replace( /([\w-:]+)(=)(".*?"|'.*?')/g, '<span class="xv-attr-name">$1</span><span class="xv-equals">$2</span><span class="xv-attr-value">$3</span>' ); return `<span class="xv-bracket">${open}</span><span class="xv-tag">${tag2}</span>${highlightedAttrs}<span class="xv-bracket">${close}</span>`; }).replace(/(<!--)(.*?)(-->)/g, '<span class="xv-comment">$1$2$3</span>'); }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$7, [ createElementVNode("pre", { class: "xml-code", innerHTML: highlightedXML.value }, null, 8, _hoisted_2$7) ]); }; } }); const XMLViewer = _export_sfc(_sfc_main$9, [["__scopeId", "data-v-b0f5e2f7"]]); const _hoisted_1$6 = { class: "json-view-container" }; const _hoisted_2$6 = ["innerHTML"]; const _sfc_main$8 = defineComponent({ __name: "JsonViewer", props: { content: {}, wrapLines: { type: Boolean, default: true } }, setup(__props) { useCssVars((_ctx) => ({ "v4d64ba78": _ctx.wrapLines ? "pre-wrap" : "pre", "f5f67a02": _ctx.wrapLines ? "break-all" : "normal", "v79cea837": _ctx.wrapLines ? "auto" : "scroll" })); const props = __props; const tryParseJSON = (input) => { if (typeof input !== "string") return input; try { const parsed = JSON.parse(input); if (typeof parsed === "string") { const trimmed = parsed.trim(); if (trimmed.startsWith("{") || trimmed.startsWith("[")) { return tryParseJSON(parsed); } } return parsed; } catch (e) { return input; } }; const parsedData = computed(() => tryParseJSON(props.content)); const jsonString = computed(() => { return JSON.stringify(parsedData.value, null, 2); }); const highlightedCode = computed(() => { if (!jsonString.value) return ""; let json = jsonString.value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); return json.replace( /("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, (match) => { let cls = "jv-number"; if (/^"/.test(match)) { cls = /:$/.test(match) ? "jv-key" : "jv-string"; } else if (/true|false/.test(match)) { cls = "jv-boolean"; } else if (/null/.test(match)) { cls = "jv-null"; } return `<span class="${cls}">${match}</span>`; } ); }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$6, [ createElementVNode("pre", { class: "json-code", innerHTML: highlightedCode.value }, null, 8, _hoisted_2$6) ]); }; } }); const JsonViewer = exports("J", _export_sfc(_sfc_main$8, [["__scopeId", "data-v-baf7cacd"]])); const _sfc_main$7 = defineComponent({ __name: "RawViewer", props: { content: {}, wrapLines: { type: Boolean, default: true } }, setup(__props) { const props = __props; const whiteSpace = computed(() => props.wrapLines ? "pre-wrap" : "pre"); return (_ctx, _cache) => { return openBlock(), createElementBlock("pre", { class: "raw-viewer", style: normalizeStyle({ whiteSpace: whiteSpace.value }) }, toDisplayString(__props.content), 5); }; } }); const RawViewer = _export_sfc(_sfc_main$7, [["__scopeId", "data-v-75b62bea"]]); const _hoisted_1$5 = { class: "format-label" }; const _hoisted_2$5 = { key: 0, class: "format-dropdown" }; const _hoisted_3$5 = ["onClick"]; const _sfc_main$6 = defineComponent({ __name: "FormatSelector", props: { currentFormat: {} }, emits: ["select"], setup(__props, { emit: __emit }) { const emit = __emit; const isOpen = ref(false); let closeTimeout = null; const formats = ["markdown", "json", "xml", "text"]; const handleSelect = (format) => { emit("select", format); closeDropdown(); }; const openDropdown = () => { clearCloseTimeout(); isOpen.value = true; }; const scheduleClose = () => { closeTimeout = setTimeout(() => { isOpen.value = false; }, 200); }; const clearCloseTimeout = () => { if (closeTimeout) { clearTimeout(closeTimeout); closeTimeout = null; } }; const closeDropdown = () => { clearCloseTimeout(); isOpen.value = false; }; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: "format-selector", onMouseenter: openDropdown, onMouseleave: scheduleClose }, [ createElementVNode("span", _hoisted_1$5, toDisplayString(__props.currentFormat), 1), createVNode(Transition, { name: "dropdown" }, { default: withCtx(() => [ isOpen.value ? (openBlock(), createElementBlock("div", _hoisted_2$5, [ (openBlock(), createElementBlock(Fragment, null, renderList(formats, (fmt) => { return createElementVNode("button", { key: fmt, class: normalizeClass(["format-option", { active: __props.currentFormat === fmt }]), onClick: ($event) => handleSelect(fmt) }, toDisplayString(fmt), 11, _hoisted_3$5); }), 64)) ])) : createCommentVNode("", true) ]), _: 1 }) ], 32); }; } }); const FormatSelector = _export_sfc(_sfc_main$6, [["__scopeId", "data-v-2e77cd25"]]); const _sfc_main$5 = defineComponent({ __name: "CopyButton", props: { content: {}, successMessage: { default: "Copied" } }, setup(__props) { const props = __props; const canUseClipboardApi = () => typeof navigator !== "undefined" && typeof navigator.clipboard?.writeText === "function"; const copyWithExecCommand = (content) => { if (typeof document === "undefined") return false; const textarea = document.createElement("textarea"); textarea.value = content; textarea.setAttribute("readonly", "true"); textarea.style.position = "fixed"; textarea.style.opacity = "0"; textarea.style.pointerEvents = "none"; document.body.appendChild(textarea); textarea.focus(); textarea.select(); try { return document.execCommand("copy"); } finally { document.body.removeChild(textarea); } }; const handleCopy = async () => { if (!props.content) return; try { if (canUseClipboardApi()) { await navigator.clipboard.writeText(props.content); toast.success(props.successMessage); return; } } catch { } if (copyWithExecCommand(props.content)) { toast.success(props.successMessage); return; } toast.error("Copy failed"); }; return (_ctx, _cache) => { return openBlock(), createElementBlock("button", { class: "copy-btn", type: "button", title: "Copy", onClick: handleCopy }, [..._cache[0] || (_cache[0] = [ createElementVNode("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, [ createElementVNode("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }), createElementVNode("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }) ], -1) ])]); }; } }); const CopyButton = _export_sfc(_sfc_main$5, [["__scopeId", "data-v-e0a8f595"]]); const _hoisted_1$4 = ["title"]; const _hoisted_2$4 = { key: 0, width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }; const _hoisted_3$4 = { key: 1, width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }; const _sfc_main$4 = defineComponent({ __name: "WrapLineButton", props: { active: { type: Boolean, default: false }, title: { default: "" } }, emits: ["click"], setup(__props, { emit: __emit }) { const emit = __emit; return (_ctx, _cache) => { return openBlock(), createElementBlock("button", { class: normalizeClass(["option-button", { active: __props.active }]), title: __props.title, type: "button", onClick: _cache[0] || (_cache[0] = ($event) => emit("click")) }, [ __props.active ? (openBlock(), createElementBlock("svg", _hoisted_2$4, [..._cache[1] || (_cache[1] = [ createElementVNode("path", { d: "M4 7h16" }, null, -1), createElementVNode("path", { d: "M4 12h12a4 4 0 0 1 0 8H4" }, null, -1) ])])) : (openBlock(), createElementBlock("svg", _hoisted_3$4, [..._cache[2] || (_cache[2] = [ createElementVNode("path", { d: "M4 7h16" }, null, -1), createElementVNode("path", { d: "M4 12h12a4 4 0 0 1 0 8H4" }, null, -1), createElementVNode("path", { d: "M9 17l-4-5 4-5" }, null, -1) ])])) ], 10, _hoisted_1$4); }; } }); const WrapLineButton = _export_sfc(_sfc_main$4, [["__scopeId", "data-v-ab422d13"]]); const _hoisted_1$3 = ["title"]; const _hoisted_2$3 = { key: 0, width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }; const _hoisted_3$3 = { key: 1, width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }; const _sfc_main$3 = defineComponent({ __name: "ExpandButton", props: { expanded: { type: Boolean, default: false }, title: { default: "Toggle full height" } }, emits: ["click"], setup(__props, { emit: __emit }) { const emit = __emit; return (_ctx, _cache) => { return openBlock(), createElementBlock("button", { class: normalizeClass(["option-button", { active: __props.expanded }]), title: __props.title, type: "button", onClick: _cache[0] || (_cache[0] = ($event) => emit("click")) }, [ __props.expanded ? (openBlock(), createElementBlock("svg", _hoisted_2$3, [..._cache[1] || (_cache[1] = [ createElementVNode("polyline", { points: "4 14 12 6 20 14" }, null, -1), createElementVNode("line", { x1: "12", y1: "6", x2: "12", y2: "20" }, null, -1) ])])) : (openBlock(), createElementBlock("svg", _hoisted_3$3, [..._cache[2] || (_cache[2] = [ createElementVNode("polyline", { points: "15 3 21 3 21 9" }, null, -1), createElementVNode("polyline", { points: "9 21 3 21 3 15" }, null, -1), createElementVNode("line", { x1: "21", y1: "3", x2: "14", y2: "10" }, null, -1), createElementVNode("line", { x1: "3", y1: "21", x2: "10", y2: "14" }, null, -1) ])])) ], 10, _hoisted_1$3); }; } }); const ExpandButton = _export_sfc(_sfc_main$3, [["__scopeId", "data-v-1738c9d5"]]); function detectContentFormat(content) { if (!content || typeof content !== "string") return "text"; const trimmed = content.trim(); if (isJson(trimmed)) return "json"; if (isXml(trimmed) && !isMarkdown(trimmed)) return "xml"; if (isMarkdown(trimmed)) return "markdown"; return "text"; } function isJson(str) { try { JSON.parse(str); return true; } catch { return false; } } function isMarkdown(str) { return str.startsWith("#") || str.includes("\n```") || str.includes("\n# ") || str.includes("\n## ") || str.includes("\n### ") || str.includes("\n1. ") || str.includes("\n- "); } function isXml(str) { if (!str || typeof str !== "string") return false; const trimmed = str.trim(); if (trimmed.length === 0) return false; if (!trimmed.includes("<") || !trimmed.includes(">")) return false; const startsWithXml = /^\s*(<\?xml|<[a-zA-Z][a-zA-Z0-9:_.-]*[\s/>])/i.test(trimmed); const hasBalancedTags = (s) => { const tagPattern = /<\/?([a-zA-Z][a-zA-Z0-9:_.-]*)[^>]*>/g; const matches = [...s.matchAll(tagPattern)]; if (matches.length === 0) return false; const openTags = []; for (const match of matches) { const fullTag = match[0]; const tagName = match[1]; if (fullTag.endsWith("/>")) continue; if (fullTag.startsWith("</")) { if (openTags.length === 0 || openTags.pop() !== tagName) return false; } else { openTags.push(tagName); } } return true; }; const hasXmlFeatures = /\s+[a-zA-Z][a-zA-Z0-9:_.-]*\s*=\s*(['"]).*?\1/.test(str) || /<[^>]+\/\s*>/.test(str) || /<!\[CDATA\[.*?\]\]>/.test(str) || /<!--.*?-->/.test(str) || /&[a-zA-Z0-9#]+;/.test(str); return startsWithXml || hasBalancedTags(trimmed) && hasXmlFeatures; } function hashId(input) { const len = input.length; let hash = len ^ 2654435769; if (len === 0) return "0"; const chunk = 20; const headEnd = Math.min(chunk, len); for (let i = 0; i < headEnd; i++) { hash = (hash ^ input.charCodeAt(i)) * 16777619; } if (len > chunk) { const midStart = Math.max(0, (len >> 1) - (chunk >> 1)); const midEnd = Math.min(len, midStart + chunk); for (let i = midStart; i < midEnd; i++) { hash = (hash ^ input.charCodeAt(i)) * 16777619; } } if (len > chunk * 2) { const tailStart = Math.max(chunk, len - chunk); for (let i = tailStart; i < len; i++) { hash = (hash ^ input.charCodeAt(i)) * 16777619; } } return (hash >>> 0).toString(36); } const _hoisted_1$2 = { class: "text-block" }; const _hoisted_2$2 = { key: 0, class: "text-block-header" }; const _hoisted_3$2 = { class: "header-actions" }; const _hoisted_4$2 = { key: 1, class: "deferred-placeholder" }; const _sfc_main$2 = defineComponent({ __name: "SmartViewer", props: { id: {}, text: {} }, setup(__props) { const props = __props; const visible = ref(false); const showRaw = ref(false); const wrapLines = ref(true); const showButtons = ref(false); const contentFormats = ["markdown", "json", "xml", "text"]; const isContentFormat = (value) => typeof value === "string" && contentFormats.includes(value); const formatStorageKey = computed(() => { const keyId = props.id?.trim() ? props.id.trim() : `hash-${hashId(props.text)}`; return `llm-better-view-smart-format-${keyId}`; }); const manualFormatStorage = useSessionStorage(formatStorageKey, null); const manualFormat = computed({ get: () => isContentFormat(manualFormatStorage.value) ? manualFormatStorage.value : null, set: (value) => { manualFormatStorage.value = value; } }); let cancelDeferredMount = null; const scheduleDeferredMount = () => { cancelDeferredMount?.(); const idleWindow = window; if (typeof idleWindow.requestIdleCallback === "function" && typeof idleWindow.cancelIdleCallback === "function") { const handle = idleWindow.requestIdleCallback( () => { visible.value = true; cancelDeferredMount = null; }, { timeout: 300 } ); cancelDeferredMount = () => { idleWindow.cancelIdleCallback?.(handle); cancelDeferredMount = null; }; return; } const timeoutHandle = window.setTimeout(() => { visible.value = true; cancelDeferredMount = null; }, 16); cancelDeferredMount = () => { window.clearTimeout(timeoutHandle); cancelDeferredMount = null; }; }; const scrollContainerRef = ref(null); const isExpanded = ref(false); const needsExpansion = ref(false); const checkHeight = () => { if (!scrollContainerRef.value) return; const el = scrollContainerRef.value; const vhLimit = window.innerHeight * 0.5; const pixelLimit = 400; const threshold = Math.min(vhLimit, pixelLimit); if (el.scrollHeight > threshold + 10) { needsExpansion.value = true; } else { needsExpansion.value = false; if (isExpanded.value) isExpanded.value = false; } }; const toggleExpand = () => { isExpanded.value = !isExpanded.value; }; useResizeObserver(scrollContainerRef, () => { checkHeight(); }); watch([() => props.text, wrapLines, showRaw, () => manualFormat.value, visible], async () => { await nextTick(); checkHeight(); }); const detectedFormat = computed(() => { if (!visible.value) return "text"; return detectContentFormat(props.text); }); const displayFormat = computed(() => manualFormat.value ?? detectedFormat.value); const canToggle = computed(() => visible.value); const showWrapLineBtn = computed(() => displayFormat.value !== "markdown"); const showViewRawBtn = computed(() => !["json", "text"].includes(displayFormat.value)); const showFloatingButtons = computed(() => visible.value && !showRaw.value); const textModel = computed({ get: () => props.text, set: () => { } }); const handleFormatChange = (format) => { manualFormat.value = format === detectedFormat.value ? null : format; }; watch( () => props.text, () => { visible.value = false; showRaw.value = false; scheduleDeferredMount(); } ); onMounted(() => { scheduleDeferredMount(); }); onBeforeUnmount(() => { cancelDeferredMount?.(); }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$2, [ canToggle.value ? (openBlock(), createElementBlock("div", _hoisted_2$2, [ createVNode(FormatSelector, { "current-format": displayFormat.value, onSelect: handleFormatChange }, null, 8, ["current-format"]), createElementVNode("div", _hoisted_3$2, [ showViewRawBtn.value ? (openBlock(), createElementBlock("button", { key: 0, class: "view-raw-btn", onClick: _cache[0] || (_cache[0] = ($event) => showRaw.value = !showRaw.value) }, toDisplayString(showRaw.value ? "▼" : "▶") + " View Raw ", 1)) : createCommentVNode("", true) ]) ])) : createCommentVNode("", true), createElementVNode("div", { class: "text-block-body", onMouseenter: _cache[5] || (_cache[5] = ($event) => showButtons.value = true), onMouseleave: _cache[6] || (_cache[6] = ($event) => showButtons.value = false) }, [ showFloatingButtons.value ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass(["floating-buttons", { visible: showButtons.value }]) }, [ needsExpansion.value ? (openBlock(), createBlock(ExpandButton, { key: 0, expanded: isExpanded.value, title: isExpanded.value ? "Collapse view" : "Expand full height", onClick: toggleExpand }, null, 8, ["expanded", "title"])) : createCommentVNode("", true), showWrapLineBtn.value ? (openBlock(), createBlock(WrapLineButton, { key: 1, active: !wrapLines.value, title: "Toggle word wrap", onClick: _cache[1] || (_cache[1] = ($event) => wrapLines.value = !wrapLines.value) }, null, 8, ["active"])) : createCommentVNode("", true), createVNode(CopyButton, { content: __props.text, "success-message": "Copied" }, null, 8, ["content"]) ], 2)) : createCommentVNode("", true), createElementVNode("div", { ref_key: "scrollContainerRef", ref: scrollContainerRef, class: normalizeClass(["scroll-content", { "scroll-mode": !isExpanded.value && needsExpansion.value }]) }, [ visible.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ showRaw.value ? (openBlock(), createBlock(RawViewer, { key: 0, content: __props.text, "wrap-lines": wrapLines.value }, null, 8, ["content", "wrap-lines"])) : displayFormat.value === "markdown" ? (openBlock(), createBlock(ProseContent, { key: 1, content: textModel.value, "onUpdate:content": _cache[2] || (_cache[2] = ($event) => textModel.value = $event), "wrap-lines": wrapLines.value }, null, 8, ["content", "wrap-lines"])) : displayFormat.value === "xml" ? (openBlock(), createBlock(XMLViewer, { key: 2, content: textModel.value, "onUpdate:content": _cache[3] || (_cache[3] = ($event) => textModel.value = $event), "wrap-lines": wrapLines.value }, null, 8, ["content", "wrap-lines"])) : displayFormat.value === "json" ? (openBlock(), createBlock(JsonViewer, { key: 3, content: textModel.value, "onUpdate:content": _cache[4] || (_cache[4] = ($event) => textModel.value = $event), "wrap-lines": wrapLines.value }, null, 8, ["content", "wrap-lines"])) : (openBlock(), createElementBlock("div", { key: 4, class: "text-content", style: normalizeStyle({ whiteSpace: wrapLines.value ? "pre-wrap" : "pre" }) }, toDisplayString(__props.text), 5)) ], 64)) : (openBlock(), createElementBlock("div", _hoisted_4$2, " Rendering content... ")) ], 2) ], 32) ]); }; } }); const SmartViewer = exports("S", _export_sfc(_sfc_main$2, [["__scopeId", "data-v-8e519c3a"]])); const _hoisted_1$1 = { class: "tool-args" }; const _hoisted_2$1 = { class: "param-list" }; const _hoisted_3$1 = { class: "param-name" }; const _hoisted_4$1 = { class: "param-value" }; const _sfc_main$1 = defineComponent({ __name: "ToolArgs", props: { input: {}, arguments: {} }, setup(__props) { const props = __props; const rawInput = computed(() => { if (props.arguments !== void 0) { if (typeof props.arguments === "string") { try { return JSON.parse(props.arguments); } catch { return { value: props.arguments }; } } else if (props.arguments && typeof props.arguments === "object") { return props.arguments; } return {}; } if (props.input !== void 0) { return props.input; } return {}; }); const parsedArgs = computed(() => { const result = {}; for (const [key, value] of Object.entries(rawInput.value)) { if (value === null) { result[key] = "null"; } else if (value === void 0) { result[key] = "undefined"; } else if (typeof value === "object") { result[key] = JSON.stringify(value); } else { result[key] = String(value); } } return result; }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$1, [ createElementVNode("div", _hoisted_2$1, [ (openBlock(true), createElementBlock(Fragment, null, renderList(parsedArgs.value, (value, key) => { return openBlock(), createElementBlock("div", { key, class: "param-item" }, [ createElementVNode("div", _hoisted_3$1, toDisplayString(key), 1), createElementVNode("div", _hoisted_4$1, [ createVNode(SmartViewer, { text: value }, null, 8, ["text"]) ]) ]); }), 128)) ]) ]); }; } }); const ToolArgs = exports("T", _export_sfc(_sfc_main$1, [["__scopeId", "data-v-e00c2d00"]])); const _hoisted_1 = ["open"]; const _hoisted_2 = { class: "native-summary" }; const _hoisted_3 = { class: "summary-content" }; const _hoisted_4 = { key: 0, class: "details-content" }; const _sfc_main = defineComponent({ __name: "BetterDetails", props: { title: { default: "Details" }, defaultOpen: { type: Boolean, default: false } }, setup(__props) { const props = __props; const slots = useSlots(); const hasRendered = ref(props.defaultOpen); const onToggle = (event) => { const details = event.target; if (details.open) { hasRendered.value = true; } }; return (_ctx, _cache) => { return openBlock(), createElementBlock("details", { class: "native-details", open: __props.defaultOpen, onToggle }, [ createElementVNode("summary", _hoisted_2, [ createElementVNode("span", _hoisted_3, [ unref(slots).summary ? renderSlot(_ctx.$slots, "summary", { key: 0 }, void 0, true) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [ createTextVNode(toDisplayString(__props.title), 1) ], 64)) ]) ]), hasRendered.value ? (openBlock(), createElementBlock("div", _hoisted_4, [ renderSlot(_ctx.$slots, "default", {}, void 0, true) ])) : createCommentVNode("", true) ], 40, _hoisted_1); }; } }); const BetterDetails = exports("B", _export_sfc(_sfc_main, [["__scopeId", "data-v-3e1e1023"]])); }) }; })); System.register("./main-CBTFarNI-HX0H7eVT.js", ['vue'], (function (exports, module) { 'use strict'; var createApp, isVNode, effectScope, ref, markRaw, defineComponent, computed, shallowRef, onMounted, onUnmounted, openBlock, createElementBlock, Fragment, createVNode, unref, toDisplayString, createCommentVNode, createBlock, resolveDynamicComponent, useAttrs, watchEffect, nextTick, createElementVNode, renderList, mergeProps, normalizeStyle, normalizeClass, withCtx, renderSlot, onBeforeUnmount, watch, normalizeProps, createTextVNode, hasInjectionContext, inject, reactive, isRef, isReactive, toRaw, getCurrentScope, onScopeDispose, toRefs, toRef, defineAsyncComponent, onErrorCaptured, Suspense; return { setters: [module => { createApp = module.createApp; isVNode = module.isVNode; effectScope = module.effectScope; ref = module.ref; markRaw = module.markRaw; defineComponent = module.defineComponent; computed = module.computed; shallowRef = module.shallowRef; onMounted = module.onMounted; onUnmounted = module.onUnmounted; openBlock = module.openBlock; createElementBlock = module.createElementBlock; Fragment = module.Fragment; createVNode = module.createVNode; unref = module.unref; toDisplayString = module.toDisplayString; createCommentVNode = module.createCommentVNode; createBlock = module.createBlock; resolveDynamicComponent = module.resolveDynamicComponent; useAttrs = module.useAttrs; watchEffect = module.watchEffect; nextTick = module.nextTick; createElementVNode = module.createElementVNode; renderList = module.renderList; mergeProps = module.mergeProps; normalizeStyle = module.normalizeStyle; normalizeClass = module.normalizeClass; withCtx = module.withCtx; renderSlot = module.renderSlot; onBeforeUnmount = module.onBeforeUnmount; watch = module.watch; normalizeProps = module.normalizeProps; createTextVNode = module.createTextVNode; hasInjectionContext = module.hasInjectionContext; inject = module.inject; reactive = module.reactive; isRef = module.isRef; isReactive = module.isReactive; toRaw = module.toRaw; getCurrentScope = module.getCurrentScope; onScopeDispose = module.onScopeDispose; toRefs = module.toRefs; toRef = module.toRef; defineAsyncComponent = module.defineAsyncComponent; onErrorCaptured = module.onErrorCaptured; Suspense = module.Suspense; }], execute: (async function () { exports({ a: isOpenaiResponse, i: isOpenaiResponseSSEWrapper }); const d=new Set;const importCSS = exports("b", async e=>{d.has(e)||(d.add(e),(t=>{typeof GM_addStyle=="function"?GM_addStyle(t):(document.head||document.documentElement).appendChild(document.createElement("style")).append(t);})(e));}); let activePinia; const setActivePinia = (pinia) => activePinia = pinia; const piniaSymbol = ( Symbol() ); function isPlainObject(o) { return o && typeof o === "object" && Object.prototype.toString.call(o) === "[object Object]" && typeof o.toJSON !== "function"; } var MutationType; (function(MutationType2) { MutationType2["direct"] = "direct"; MutationType2["patchObject"] = "patch object"; MutationType2["patchFunction"] = "patch function"; })(MutationType || (MutationType = {})); function createPinia() { const scope = effectScope(true); const state = scope.run(() => ref({})); let _p = []; let toBeInstalled = []; const pinia = markRaw({ install(app2) { setActivePinia(pinia); pinia._a = app2; app2.provide(piniaSymbol, pinia); app2.config.globalProperties.$pinia = pinia; toBeInstalled.forEach((plugin) => _p.push(plugin)); toBeInstalled = []; }, use(plugin) { if (!this._a) { toBeInstalled.push(plugin); } else { _p.push(plugin); } return this; }, _p, _a: null, _e: scope, _s: new Map(), state }); return pinia; } const noop = () => { }; function addSubscription(subscriptions, callback, detached, onCleanup = noop) { subscriptions.add(callback); const removeSubscription = () => { const isDel = subscriptions.delete(callback); isDel && onCleanup(); }; if (!detached && getCurrentScope()) { onScopeDispose(removeSubscription); } return removeSubscription; } function triggerSubscriptions(subscriptions, ...args) { subscriptions.forEach((callback) => { callback(...args); }); } const fallbackRunWithContext = (fn) => fn(); const ACTION_MARKER = Symbol(); const ACTION_NAME = Symbol(); function mergeReactiveObjects(target, patchToApply) { if (target instanceof Map && patchToApply instanceof Map) { patchToApply.forEach((value, key) => target.set(key, value)); } else if (target instanceof Set && patchToApply instanceof Set) { patchToApply.forEach(target.add, target); } for (const key in patchToApply) { if (!patchToApply.hasOwnProperty(key)) continue; const subPatch = patchToApply[key]; const targetValue = target[key]; if (isPlainObject(targetValue) && isPlainObject(subPatch) && target.hasOwnProperty(key) && !isRef(subPatch) && !isReactive(subPatch)) { target[key] = mergeReactiveObjects(targetValue, subPatch); } else { target[key] = subPatch; } } return target; } const skipHydrateSymbol = ( Symbol() ); function shouldHydrate(obj) { return !isPlainObject(obj) || !Object.prototype.hasOwnProperty.call(obj, skipHydrateSymbol); } const { assign } = Object; function isComputed(o) { return !!(isRef(o) && o.effect); } function createOptionsStore(id, options, pinia, hot) { const { state, actions, getters } = options; const initialState = pinia.state.value[id]; let store; function setup() { if (!initialState && true) { pinia.state.value[id] = state ? state() : {}; } const localState = toRefs(pinia.state.value[id]); return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => { computedGetters[name] = markRaw(computed(() => { setActivePinia(pinia); const store2 = pinia._s.get(id); return getters[name].call(store2, store2); })); return computedGetters; }, {})); } store = createSetupStore(id, setup, options, pinia, hot, true); return store; } function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) { let scope; const optionsForPlugin = assign({ actions: {} }, options); const $subscribeOptions = { deep: true }; let isListening; let isSyncListening; let subscriptions = new Set(); let actionSubscriptions = new Set(); let debuggerEvents; const initialState = pinia.state.value[$id]; if (!isOptionsStore && !initialState && true) { pinia.state.value[$id] = {}; } ref({}); let activeListener; function $patch(partialStateOrMutator) { let subscriptionMutation; isListening = isSyncListening = false; if (typeof partialStateOrMutator === "function") { partialStateOrMutator(pinia.state.value[$id]); subscriptionMutation = { type: MutationType.patchFunction, storeId: $id, events: debuggerEvents }; } else { mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator); subscriptionMutation = { type: MutationType.patchObject, payload: partialStateOrMutator, storeId: $id, events: debuggerEvents }; } const myListenerId = activeListener = Symbol(); nextTick().then(() => { if (activeListener === myListenerId) { isListening = true; } }); isSyncListening = true; triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]); } const $reset = isOptionsStore ? function $reset2() { const { state } = options; const newState = state ? state() : {}; this.$patch(($state) => { assign($state, newState); }); } : ( noop ); function $dispose() { scope.stop(); subscriptions.clear(); actionSubscriptions.clear(); pinia._s.delete($id); } const action = (fn, name = "") => { if (ACTION_MARKER in fn) { fn[ACTION_NAME] = name; return fn; } const wrappedAction = function() { setActivePinia(pinia); const args = Array.from(arguments); const afterCallbackSet = new Set(); const onErrorCallbackSet = new Set(); function after(callback) { afterCallbackSet.add(callback); } function onError(callback) { onErrorCallbackSet.add(callback); } triggerSubscriptions(actionSubscriptions, { args, name: wrappedAction[ACTION_NAME], store, after, onError }); let ret; try { ret = fn.apply(this && this.$id === $id ? this : store, args); } catch (error) { triggerSubscriptions(onErrorCallbackSet, error); throw error; } if (ret instanceof Promise) { return ret.then((value) => { triggerSubscriptions(afterCallbackSet, value); return value; }).catch((error) => { triggerSubscriptions(onErrorCallbackSet, error); return Promise.reject(error); }); } triggerSubscriptions(afterCallbackSet, ret); return ret; }; wrappedAction[ACTION_MARKER] = true; wrappedAction[ACTION_NAME] = name; return wrappedAction; }; const partialStore = { _p: pinia, $id, $onAction: addSubscription.bind(null, actionSubscriptions), $patch, $reset, $subscribe(callback, options2 = {}) { const removeSubscription = addSubscription(subscriptions, callback, options2.detached, () => stopWatcher()); const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => { if (options2.flush === "sync" ? isSyncListening : isListening) { callback({ storeId: $id, type: MutationType.direct, events: debuggerEvents }, state); } }, assign({}, $subscribeOptions, options2))); return removeSubscription; }, $dispose }; const store = reactive(partialStore); pinia._s.set($id, store); const runWithContext = pinia._a && pinia._a.runWithContext || fallbackRunWithContext; const setupStore = runWithContext(() => pinia._e.run(() => (scope = effectScope()).run(() => setup({ action })))); for (const key in setupStore) { const prop = setupStore[key]; if (isRef(prop) && !isComputed(prop) || isReactive(prop)) { if (!isOptionsStore) { if (initialState && shouldHydrate(prop)) { if (isRef(prop)) { prop.value = initialState[key]; } else { mergeReactiveObjects(prop, initialState[key]); } } pinia.state.value[$id][key] = prop; } } else if (typeof prop === "function") { const actionValue = action(prop, key); setupStore[key] = actionValue; optionsForPlugin.actions[key] = prop; } else ; } assign(store, setupStore); assign(toRaw(store), setupStore); Object.defineProperty(store, "$state", { get: () => pinia.state.value[$id], set: (state) => { $patch(($state) => { assign($state, state); }); } }); pinia._p.forEach((extender) => { { assign(store, scope.run(() => extender({ store, app: pinia._a, pinia, options: optionsForPlugin }))); } }); if (initialState && isOptionsStore && options.hydrate) { options.hydrate(store.$state, initialState); } isListening = true; isSyncListening = true; return store; } function defineStore(id, setup, setupOptions) { let options; const isSetupStore = typeof setup === "function"; options = isSetupStore ? setupOptions : setup; function useStore(pinia, hot) { const hasContext = hasInjectionContext(); pinia = pinia || (hasContext ? inject(piniaSymbol, null) : null); if (pinia) setActivePinia(pinia); pinia = activePinia; if (!pinia._s.has(id)) { if (isSetupStore) { createSetupStore(id, setup, options, pinia); } else { createOptionsStore(id, options, pinia); } } const store = pinia._s.get(id); return store; } useStore.$id = id; return useStore; } function storeToRefs(store) { const rawStore = toRaw(store); const refs = {}; for (const key in rawStore) { const value = rawStore[key]; if (value.effect) { refs[key] = computed({ get: () => store[key], set(value2) { store[key] = value2; } }); } else if (isRef(value) || isReactive(value)) { refs[key] = toRef(store, key); } } return refs; } let toastsCounter = 1; var Observer = class { subscribers; toasts; dismissedToasts; constructor() { this.subscribers = []; this.toasts = []; this.dismissedToasts = new Set(); } subscribe = (subscriber) => { this.subscribers.push(subscriber); return () => { const index = this.subscribers.indexOf(subscriber); this.subscribers.splice(index, 1); }; }; publish = (data) => { this.subscribers.forEach((subscriber) => subscriber(data)); }; addToast = (data) => { this.publish(data); this.toasts = [...this.toasts, data]; }; create = (data) => { const { message, ...rest } = data; const id = typeof data.id === "number" || data.id && data.id?.length > 0 ? data.id : toastsCounter++; const alreadyExists = this.toasts.find((toast$1) => { return toast$1.id === id; }); const dismissible = data.dismissible === void 0 ? true : data.dismissible; if (this.dismissedToasts.has(id)) this.dismissedToasts.delete(id); if (alreadyExists) this.toasts = this.toasts.map((toast$1) => { if (toast$1.id === id) { this.publish({ ...toast$1, ...data, id, title: message }); return { ...toast$1, ...data, id, dismissible, title: message }; } return toast$1; }); else this.addToast({ title: message, ...rest, dismissible, id }); return id; }; dismiss = (id) => { if (id) { this.dismissedToasts.add(id); requestAnimationFrame(() => this.subscribers.forEach((subscriber) => subscriber({ id, dismiss: true }))); } else this.toasts.forEach((toast$1) => { this.subscribers.forEach((subscriber) => subscriber({ id: toast$1.id, dismiss: true })); }); return id; }; message = (message, data) => { return this.create({ ...data, message, type: "default" }); }; error = (message, data) => { return this.create({ ...data, type: "error", message }); }; success = (message, data) => { return this.create({ ...data, type: "success", message }); }; info = (message, data) => { return this.create({ ...data, type: "info", message }); }; warning = (message, data) => { return this.create({ ...data, type: "warning", message }); }; loading = (message, data) => { return this.create({ ...data, type: "loading", message }); }; promise = (promise, data) => { if (!data) return; let id; if (data.loading !== void 0) id = this.create({ ...data, promise, type: "loading", message: data.loading, description: typeof data.description !== "function" ? data.description : void 0 }); const p = Promise.resolve(promise instanceof Function ? promise() : promise); let shouldDismiss = id !== void 0; let result; const originalPromise = p.then(async (response) => { result = ["resolve", response]; const isVueComponent = isVNode(response); if (isVueComponent) { shouldDismiss = false; this.create({ id, type: "default", message: response }); } else if (isHttpResponse(response) && !response.ok) { shouldDismiss = false; const promiseData = typeof data.error === "function" ? await data.error(`HTTP error! status: ${response.status}`) : data.error; const description = typeof data.description === "function" ? await data.description(`HTTP error! status: ${response.status}`) : data.description; const isExtendedResult = typeof promiseData === "object" && !isVNode(promiseData); const toastSettings = isExtendedResult ? promiseData : { message: promiseData || "", id: id || "" }; this.create({ id, type: "error", description, ...toastSettings }); } else if (response instanceof Error) { shouldDismiss = false; const promiseData = typeof data.error === "function" ? await data.error(response) : data.error; const description = typeof data.description === "function" ? await data.description(response) : data.description; const isExtendedResult = typeof promiseData === "object" && !isVNode(promiseData); const toastSettings = isExtendedResult ? promiseData : { message: promiseData || "", id: id || "" }; this.create({ id, type: "error", description, ...toastSettings }); } else if (data.success !== void 0) { shouldDismiss = false; const promiseData = typeof data.success === "function" ? await data.success(response) : data.success; const description = typeof data.description === "function" ? await data.description(response) : data.description; const isExtendedResult = typeof promiseData === "object" && !isVNode(promiseData); const toastSettings = isExtendedResult ? promiseData : { message: promiseData || "", id: id || "" }; this.create({ id, type: "success", description, ...toastSettings }); } }).catch(async (error) => { result = ["reject", error]; if (data.error !== void 0) { shouldDismiss = false; const promiseData = typeof data.error === "function" ? await data.error(error) : data.error; const description = typeof data.description === "function" ? await data.description(error) : data.description; const isExtendedResult = typeof promiseData === "object" && !isVNode(promiseData); const toastSettings = isExtendedResult ? promiseData : { message: promiseData || "", id: id || "" }; this.create({ id, type: "error", description, ...toastSettings }); } }).finally(() => { if (shouldDismiss) { this.dismiss(id); id = void 0; } data.finally?.(); }); const unwrap = () => new Promise((resolve, reject) => originalPromise.then(() => result[0] === "reject" ? reject(result[1]) : resolve(result[1])).catch(reject)); if (typeof id !== "string" && typeof id !== "number") return { unwrap }; else return Object.assign(id, { unwrap }); }; custom = (component, data) => { const id = data?.id || toastsCounter++; const alreadyExists = this.toasts.find((toast$1) => { return toast$1.id === id; }); const dismissible = data?.dismissible === void 0 ? true : data.dismissible; if (this.dismissedToasts.has(id)) this.dismissedToasts.delete(id); if (alreadyExists) this.toasts = this.toasts.map((toast$1) => { if (toast$1.id === id) { this.publish({ ...toast$1, component, dismissible, id, ...data }); return { ...toast$1, component, dismissible, id, ...data }; } return toast$1; }); else this.addToast({ component, dismissible, id, ...data }); return id; }; getActiveToasts = () => { return this.toasts.filter((toast$1) => !this.dismissedToasts.has(toast$1.id)); }; }; const ToastState = new Observer(); function toastFunction(message, data) { const id = data?.id || toastsCounter++; ToastState.create({ message, id, type: "default", ...data }); return id; } const isHttpResponse = (data) => { return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number"; }; const basicToast = toastFunction; const getHistory = () => ToastState.toasts; const getToasts = () => ToastState.getActiveToasts(); const toast = exports("t", Object.assign(basicToast, { success: ToastState.success, info: ToastState.info, warning: ToastState.warning, error: ToastState.error, custom: ToastState.custom, message: ToastState.message, promise: ToastState.promise, dismiss: ToastState.dismiss, loading: ToastState.loading }, { getHistory, getToasts })); function isAction(action) { return action.label !== void 0; } const VISIBLE_TOASTS_AMOUNT = 3; const VIEWPORT_OFFSET = "24px"; const MOBILE_VIEWPORT_OFFSET = "16px"; const TOAST_LIFETIME = 4e3; const TOAST_WIDTH = 356; const GAP = 14; const SWIPE_THRESHOLD = 45; const TIME_BEFORE_UNMOUNT = 200; function useIsDocumentHidden() { const isDocumentHidden = ref(false); watchEffect(() => { const callback = () => { isDocumentHidden.value = document.hidden; }; document.addEventListener("visibilitychange", callback); return () => window.removeEventListener("visibilitychange", callback); }); return { isDocumentHidden }; } function cn(...classes) { return classes.filter(Boolean).join(" "); } function getDefaultSwipeDirections(position) { const [y, x] = position.split("-"); const directions = []; if (y) directions.push(y); if (x) directions.push(x); return directions; } function assignOffset(defaultOffset, mobileOffset) { const styles = {}; [defaultOffset, mobileOffset].forEach((offset, index) => { const isMobile = index === 1; const prefix = isMobile ? "--mobile-offset" : "--offset"; const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET; function assignAll(offset$1) { [ "top", "right", "bottom", "left" ].forEach((key) => { styles[`${prefix}-${key}`] = typeof offset$1 === "number" ? `${offset$1}px` : offset$1; }); } if (typeof offset === "number" || typeof offset === "string") assignAll(offset); else if (typeof offset === "object") [ "top", "right", "bottom", "left" ].forEach((key) => { if (offset[key] === void 0) styles[`${prefix}-${key}`] = defaultValue; else styles[`${prefix}-${key}`] = typeof offset[key] === "number" ? `${offset[key]}px` : offset[key]; }); else assignAll(defaultValue); }); return styles; } const _hoisted_1$7 = [ "data-rich-colors", "data-styled", "data-mounted", "data-promise", "data-swiped", "data-removed", "data-visible", "data-y-position", "data-x-position", "data-index", "data-front", "data-swiping", "data-dismissible", "data-type", "data-invert", "data-swipe-out", "data-swipe-direction", "data-expanded", "data-testid" ]; const _hoisted_2$2$1 = [ "aria-label", "data-disabled", "data-close-button-position" ]; var Toast_vue_vue_type_script_setup_true_lang_default = defineComponent({ __name: "Toast", props: { toast: {}, toasts: {}, index: {}, swipeDirections: {}, expanded: { type: Boolean }, invert: { type: Boolean }, heights: {}, gap: {}, position: {}, closeButtonPosition: {}, visibleToasts: {}, expandByDefault: { type: Boolean }, closeButton: { type: Boolean }, interacting: { type: Boolean }, style: {}, cancelButtonStyle: {}, actionButtonStyle: {}, duration: {}, class: {}, unstyled: { type: Boolean }, descriptionClass: {}, loadingIcon: {}, classes: {}, icons: {}, closeButtonAriaLabel: {}, defaultRichColors: { type: Boolean } }, emits: [ "update:heights", "update:height", "removeToast" ], setup(__props, { emit: __emit }) { const props = __props; const emit = __emit; const swipeDirection = ref(null); const swipeOutDirection = ref(null); const mounted = ref(false); const removed = ref(false); const swiping = ref(false); const swipeOut = ref(false); const swiped = ref(false); const offsetBeforeRemove = ref(0); const initialHeight = ref(0); const remainingTime = ref(props.toast.duration || props.duration || TOAST_LIFETIME); const dragStartTime = ref(null); const toastRef = ref(null); const isFront = computed(() => props.index === 0); const isVisible = computed(() => props.index + 1 <= props.visibleToasts); const toastType = computed(() => props.toast.type); const dismissible = computed(() => props.toast.dismissible !== false); const toastClass = computed(() => props.toast.class || ""); const toastDescriptionClass = computed(() => props.descriptionClass || ""); const heightIndex = computed(() => { const currentPosition = props.toast.position || props.position; const samePositionHeights = props.heights.filter((h) => h.position === currentPosition); const index = samePositionHeights.findIndex((height) => height.toastId === props.toast.id); return index >= 0 ? index : 0; }); const toastsHeightBefore = computed(() => { const currentPosition = props.toast.position || props.position; const samePositionHeights = props.heights.filter((h) => h.position === currentPosition); return samePositionHeights.reduce((prev, curr, reducerIndex) => { if (reducerIndex >= heightIndex.value) return prev; return prev + curr.height; }, 0); }); const offset = computed(() => heightIndex.value * props.gap + toastsHeightBefore.value || 0); const closeButton = computed(() => props.toast.closeButton ?? props.closeButton); const duration = computed(() => props.toast.duration || props.duration || TOAST_LIFETIME); const closeTimerStartTimeRef = ref(0); const lastCloseTimerStartTimeRef = ref(0); const pointerStartRef = ref(null); const coords = computed(() => props.position.split("-")); const y = computed(() => coords.value[0]); const x = computed(() => coords.value[1]); const isStringOfTitle = computed(() => typeof props.toast.title !== "string"); const isStringOfDescription = computed(() => typeof props.toast.description !== "string"); const { isDocumentHidden } = useIsDocumentHidden(); const disabled = computed(() => toastType.value && toastType.value === "loading"); onMounted(() => { mounted.value = true; remainingTime.value = duration.value; }); watchEffect(async () => { if (!mounted.value || !toastRef.value) return; await nextTick(); const toastNode = toastRef.value; const originalHeight = toastNode.style.height; toastNode.style.height = "auto"; const newHeight = toastNode.getBoundingClientRect().height; toastNode.style.height = originalHeight; initialHeight.value = newHeight; emit("update:height", { toastId: props.toast.id, height: newHeight, position: props.toast.position || props.position }); }); function deleteToast() { removed.value = true; offsetBeforeRemove.value = offset.value; setTimeout(() => { emit("removeToast", props.toast); }, TIME_BEFORE_UNMOUNT); } function handleCloseToast() { if (disabled.value || !dismissible.value) return {}; deleteToast(); props.toast.onDismiss?.(props.toast); } function onPointerDown(event) { if (event.button === 2) return; if (disabled.value || !dismissible.value) return; dragStartTime.value = new Date(); offsetBeforeRemove.value = offset.value; event.target.setPointerCapture(event.pointerId); if (event.target.tagName === "BUTTON") return; swiping.value = true; pointerStartRef.value = { x: event.clientX, y: event.clientY }; } function onPointerUp() { if (swipeOut.value || !dismissible.value) return; pointerStartRef.value = null; const swipeAmountX = Number(toastRef.value?.style.getPropertyValue("--swipe-amount-x").replace("px", "") || 0); const swipeAmountY = Number(toastRef.value?.style.getPropertyValue("--swipe-amount-y").replace("px", "") || 0); const timeTaken = ( new Date()).getTime() - (dragStartTime.value?.getTime() || 0); const swipeAmount = swipeDirection.value === "x" ? swipeAmountX : swipeAmountY; const velocity = Math.abs(swipeAmount) / timeTaken; if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) { offsetBeforeRemove.value = offset.value; props.toast.onDismiss?.(props.toast); if (swipeDirection.value === "x") swipeOutDirection.value = swipeAmountX > 0 ? "right" : "left"; else swipeOutDirection.value = swipeAmountY > 0 ? "down" : "up"; deleteToast(); swipeOut.value = true; return; } else { toastRef.value?.style.setProperty("--swipe-amount-x", `0px`); toastRef.value?.style.setProperty("--swipe-amount-y", `0px`); } swiped.value = false; swiping.value = false; swipeDirection.value = null; } function onPointerMove(event) { if (!pointerStartRef.value || !dismissible.value) return; const isHighlighted = window?.getSelection()?.toString()?.length ?? false; if (isHighlighted) return; const yDelta = event.clientY - pointerStartRef.value.y; const xDelta = event.clientX - pointerStartRef.value.x; const swipeDirections = props.swipeDirections ?? getDefaultSwipeDirections(props.position); if (!swipeDirection.value && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) swipeDirection.value = Math.abs(xDelta) > Math.abs(yDelta) ? "x" : "y"; let swipeAmount = { x: 0, y: 0 }; const getDampening = (delta) => { const factor = Math.abs(delta) / 20; return 1 / (1.5 + factor); }; if (swipeDirection.value === "y") { if (swipeDirections.includes("top") || swipeDirections.includes("bottom")) if (swipeDirections.includes("top") && yDelta < 0 || swipeDirections.includes("bottom") && yDelta > 0) swipeAmount.y = yDelta; else { const dampenedDelta = yDelta * getDampening(yDelta); swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta; } } else if (swipeDirection.value === "x") { if (swipeDirections.includes("left") || swipeDirections.includes("right")) if (swipeDirections.includes("left") && xDelta < 0 || swipeDirections.includes("right") && xDelta > 0) swipeAmount.x = xDelta; else { const dampenedDelta = xDelta * getDampening(xDelta); swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta; } } if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) swiped.value = true; toastRef.value?.style.setProperty("--swipe-amount-x", `${swipeAmount.x}px`); toastRef.value?.style.setProperty("--swipe-amount-y", `${swipeAmount.y}px`); } onMounted(() => { mounted.value = true; if (!toastRef.value) return; const height = toastRef.value.getBoundingClientRect().height; initialHeight.value = height; const newHeights = [{ toastId: props.toast.id, height, position: props.toast.position }, ...props.heights]; emit("update:heights", newHeights); }); onBeforeUnmount(() => { if (toastRef.value) emit("removeToast", props.toast); }); watchEffect((onInvalidate) => { if (props.toast.promise && toastType.value === "loading" || props.toast.duration === Infinity || props.toast.type === "loading") return; let timeoutId; const pauseTimer = () => { if (lastCloseTimerStartTimeRef.value < closeTimerStartTimeRef.value) { const elapsedTime = ( new Date()).getTime() - closeTimerStartTimeRef.value; remainingTime.value = remainingTime.value - elapsedTime; } lastCloseTimerStartTimeRef.value = ( new Date()).getTime(); }; const startTimer = () => { if (remainingTime.value === Infinity) return; closeTimerStartTimeRef.value = ( new Date()).getTime(); timeoutId = setTimeout(() => { props.toast.onAutoClose?.(props.toast); deleteToast(); }, remainingTime.value); }; if (props.expanded || props.interacting || isDocumentHidden.value) pauseTimer(); else startTimer(); onInvalidate(() => { clearTimeout(timeoutId); }); }); watch(() => props.toast.delete, (value) => { if (value !== void 0 && value) { deleteToast(); props.toast.onDismiss?.(props.toast); } }, { deep: true }); function handleDragEnd() { swiping.value = false; swipeDirection.value = null; pointerStartRef.value = null; } return (_ctx, _cache) => { return openBlock(), createElementBlock("li", { tabindex: "0", ref_key: "toastRef", ref: toastRef, class: normalizeClass(unref(cn)(props.class, toastClass.value, _ctx.classes?.toast, _ctx.toast.classes?.toast, _ctx.classes?.[toastType.value], _ctx.toast?.classes?.[toastType.value])), "data-sonner-toast": "", "data-rich-colors": _ctx.toast.richColors ?? _ctx.defaultRichColors, "data-styled": !Boolean(_ctx.toast.component || _ctx.toast?.unstyled || _ctx.unstyled), "data-mounted": mounted.value, "data-promise": Boolean(_ctx.toast.promise), "data-swiped": swiped.value, "data-removed": removed.value, "data-visible": isVisible.value, "data-y-position": y.value, "data-x-position": x.value, "data-index": _ctx.index, "data-front": isFront.value, "data-swiping": swiping.value, "data-dismissible": dismissible.value, "data-type": toastType.value, "data-invert": _ctx.toast.invert || _ctx.invert, "data-swipe-out": swipeOut.value, "data-swipe-direction": swipeOutDirection.value, "data-expanded": Boolean(_ctx.expanded || _ctx.expandByDefault && mounted.value), "data-testid": _ctx.toast.testId, style: normalizeStyle({ "--index": _ctx.index, "--toasts-before": _ctx.index, "--z-index": _ctx.toasts.length - _ctx.index, "--offset": `${removed.value ? offsetBeforeRemove.value : offset.value}px`, "--initial-height": _ctx.expandByDefault ? "auto" : `${initialHeight.value}px`, ..._ctx.style, ...props.toast.style }), onDragend: handleDragEnd, onPointerdown: onPointerDown, onPointerup: onPointerUp, onPointermove: onPointerMove }, [closeButton.value && !_ctx.toast.component && toastType.value !== "loading" ? (openBlock(), createElementBlock("button", { key: 0, "aria-label": _ctx.closeButtonAriaLabel || "Close toast", "data-disabled": disabled.value, "data-close-button": "true", "data-close-button-position": _ctx.closeButtonPosition, class: normalizeClass(unref(cn)(_ctx.classes?.closeButton, _ctx.toast?.classes?.closeButton)), onClick: handleCloseToast }, [_ctx.icons?.close ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icons?.close), { key: 0 })) : renderSlot(_ctx.$slots, "close-icon", { key: 1 })], 10, _hoisted_2$2$1)) : createCommentVNode("v-if", true), _ctx.toast.component ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.toast.component), mergeProps({ key: 1 }, _ctx.toast.componentProps, { onCloseToast: handleCloseToast, isPaused: _ctx.$props.expanded || _ctx.$props.interacting || unref(isDocumentHidden) }), null, 16, ["isPaused"])) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [ toastType.value !== "default" || _ctx.toast.icon || _ctx.toast.promise ? (openBlock(), createElementBlock("div", { key: 0, "data-icon": "", class: normalizeClass(unref(cn)(_ctx.classes?.icon, _ctx.toast?.classes?.icon)) }, [_ctx.toast.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.toast.icon), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [toastType.value === "loading" ? renderSlot(_ctx.$slots, "loading-icon", { key: 0 }) : toastType.value === "success" ? renderSlot(_ctx.$slots, "success-icon", { key: 1 }) : toastType.value === "error" ? renderSlot(_ctx.$slots, "error-icon", { key: 2 }) : toastType.value === "warning" ? renderSlot(_ctx.$slots, "warning-icon", { key: 3 }) : toastType.value === "info" ? renderSlot(_ctx.$slots, "info-icon", { key: 4 }) : createCommentVNode("v-if", true)], 64))], 2)) : createCommentVNode("v-if", true), createElementVNode("div", { "data-content": "", class: normalizeClass(unref(cn)(_ctx.classes?.content, _ctx.toast?.classes?.content)) }, [createElementVNode("div", { "data-title": "", class: normalizeClass(unref(cn)(_ctx.classes?.title, _ctx.toast.classes?.title)) }, [isStringOfTitle.value ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.toast.title), normalizeProps(mergeProps({ key: 0 }, _ctx.toast.componentProps)), null, 16)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(_ctx.toast.title), 1)], 64))], 2), _ctx.toast.description ? (openBlock(), createElementBlock("div", { key: 0, "data-description": "", class: normalizeClass(unref(cn)(_ctx.descriptionClass, toastDescriptionClass.value, _ctx.classes?.description, _ctx.toast.classes?.description)) }, [isStringOfDescription.value ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.toast.description), normalizeProps(mergeProps({ key: 0 }, _ctx.toast.componentProps)), null, 16)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(_ctx.toast.description), 1)], 64))], 2)) : createCommentVNode("v-if", true)], 2), _ctx.toast.cancel ? (openBlock(), createElementBlock("button", { key: 1, style: normalizeStyle(_ctx.toast.cancelButtonStyle || _ctx.cancelButtonStyle), class: normalizeClass(unref(cn)(_ctx.classes?.cancelButton, _ctx.toast.classes?.cancelButton)), "data-button": "", "data-cancel": "", onClick: _cache[0] || (_cache[0] = (event) => { if (!unref(isAction)(_ctx.toast.cancel)) return; if (!dismissible.value) return; _ctx.toast.cancel.onClick?.(event); deleteToast(); }) }, toDisplayString(unref(isAction)(_ctx.toast.cancel) ? _ctx.toast.cancel?.label : _ctx.toast.cancel), 7)) : createCommentVNode("v-if", true), _ctx.toast.action ? (openBlock(), createElementBlock("button", { key: 2, style: normalizeStyle(_ctx.toast.actionButtonStyle || _ctx.actionButtonStyle), class: normalizeClass(unref(cn)(_ctx.classes?.actionButton, _ctx.toast.classes?.actionButton)), "data-button": "", "data-action": "", onClick: _cache[1] || (_cache[1] = (event) => { if (!unref(isAction)(_ctx.toast.action)) return; _ctx.toast.action.onClick?.(event); if (event.defaultPrevented) return; deleteToast(); }) }, toDisplayString(unref(isAction)(_ctx.toast.action) ? _ctx.toast.action?.label : _ctx.toast.action), 7)) : createCommentVNode("v-if", true) ], 64))], 46, _hoisted_1$7); }; } }); var Toast_default = Toast_vue_vue_type_script_setup_true_lang_default; var export_helper_default = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) target[key] = val; return target; }; const _sfc_main$4$1 = {}; const _hoisted_1$6 = { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stoke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }; function _sfc_render$4(_ctx, _cache) { return openBlock(), createElementBlock("svg", _hoisted_1$6, _cache[0] || (_cache[0] = [createElementVNode("line", { x1: "18", y1: "6", x2: "6", y2: "18" }, null, -1), createElementVNode("line", { x1: "6", y1: "6", x2: "18", y2: "18" }, null, -1)])); } var CloseIcon_default = export_helper_default(_sfc_main$4$1, [["render", _sfc_render$4]]); const _hoisted_1$5 = ["data-visible"]; const _hoisted_2$1$1 = { class: "sonner-spinner" }; var Loader_vue_vue_type_script_setup_true_lang_default = defineComponent({ __name: "Loader", props: { visible: { type: Boolean } }, setup(__props) { const bars = Array(12).fill(0); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: "sonner-loading-wrapper", "data-visible": _ctx.visible }, [createElementVNode("div", _hoisted_2$1$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(bars), (bar) => { return openBlock(), createElementBlock("div", { key: `spinner-bar-${bar}`, class: "sonner-loading-bar" }); }), 128))])], 8, _hoisted_1$5); }; } }); var Loader_default = Loader_vue_vue_type_script_setup_true_lang_default; const _sfc_main$3$1 = {}; const _hoisted_1$4$1 = { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }; function _sfc_render$3(_ctx, _cache) { return openBlock(), createElementBlock("svg", _hoisted_1$4$1, _cache[0] || (_cache[0] = [createElementVNode("path", { "fill-rule": "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z", "clip-rule": "evenodd" }, null, -1)])); } var SuccessIcon_default = export_helper_default(_sfc_main$3$1, [["render", _sfc_render$3]]); const _sfc_main$2$1 = {}; const _hoisted_1$3$1 = { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }; function _sfc_render$2(_ctx, _cache) { return openBlock(), createElementBlock("svg", _hoisted_1$3$1, _cache[0] || (_cache[0] = [createElementVNode("path", { "fill-rule": "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z", "clip-rule": "evenodd" }, null, -1)])); } var InfoIcon_default = export_helper_default(_sfc_main$2$1, [["render", _sfc_render$2]]); const _sfc_main$1$1 = {}; const _hoisted_1$2$1 = { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", height: "20", width: "20" }; function _sfc_render$1(_ctx, _cache) { return openBlock(), createElementBlock("svg", _hoisted_1$2$1, _cache[0] || (_cache[0] = [createElementVNode("path", { "fill-rule": "evenodd", d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z", "clip-rule": "evenodd" }, null, -1)])); } var WarningIcon_default = export_helper_default(_sfc_main$1$1, [["render", _sfc_render$1]]); const _sfc_main$6 = {}; const _hoisted_1$1$1 = { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }; function _sfc_render(_ctx, _cache) { return openBlock(), createElementBlock("svg", _hoisted_1$1$1, _cache[0] || (_cache[0] = [createElementVNode("path", { "fill-rule": "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z", "clip-rule": "evenodd" }, null, -1)])); } var ErrorIcon_default = export_helper_default(_sfc_main$6, [["render", _sfc_render]]); const _hoisted_1$8 = ["aria-label"]; const _hoisted_2$4 = [ "data-sonner-theme", "dir", "data-theme", "data-rich-colors", "data-y-position", "data-x-position" ]; const isClient = typeof window !== "undefined" && typeof document !== "undefined"; function getDocumentDirection() { if (typeof window === "undefined") return "ltr"; if (typeof document === "undefined") return "ltr"; const dirAttribute = document.documentElement.getAttribute("dir"); if (dirAttribute === "auto" || !dirAttribute) return window.getComputedStyle(document.documentElement).direction; return dirAttribute; } var Toaster_vue_vue_type_script_setup_true_lang_default = defineComponent({ name: "Toaster", inheritAttrs: false, __name: "Toaster", props: { id: {}, invert: { type: Boolean, default: false }, theme: { default: "light" }, position: { default: "bottom-right" }, closeButtonPosition: { default: "top-left" }, hotkey: { default: () => ["altKey", "KeyT"] }, richColors: { type: Boolean, default: false }, expand: { type: Boolean, default: false }, duration: {}, gap: { default: GAP }, visibleToasts: { default: VISIBLE_TOASTS_AMOUNT }, closeButton: { type: Boolean, default: false }, toastOptions: { default: () => ({}) }, class: { default: "" }, style: {}, offset: { default: VIEWPORT_OFFSET }, mobileOffset: { default: MOBILE_VIEWPORT_OFFSET }, dir: { default: "auto" }, swipeDirections: {}, icons: {}, containerAriaLabel: { default: "Notifications" } }, setup(__props) { const props = __props; const attrs = useAttrs(); const toasts = ref([]); const filteredToastsById = computed(() => { if (props.id) return toasts.value.filter((toast$1) => toast$1.toasterId === props.id); return toasts.value.filter((toast$1) => !toast$1.toasterId); }); function filteredToasts(pos, index) { return filteredToastsById.value.filter((toast$1) => !toast$1.position && index === 0 || toast$1.position === pos); } const possiblePositions = computed(() => { const posList = filteredToastsById.value.filter((toast$1) => toast$1.position).map((toast$1) => toast$1.position); return posList.length > 0 ? Array.from(new Set([props.position].concat(posList))) : [props.position]; }); const toastsByPosition = computed(() => { const result = {}; possiblePositions.value.forEach((pos) => { result[pos] = toasts.value.filter((t) => t.position === pos); }); return result; }); const heights = ref([]); const expanded = ref({}); const interacting = ref(false); watchEffect(() => { possiblePositions.value.forEach((pos) => { if (!(pos in expanded.value)) expanded.value[pos] = false; }); }); const actualTheme = ref(props.theme !== "system" ? props.theme : typeof window !== "undefined" ? window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "light"); const listRef = ref(null); const lastFocusedElementRef = ref(null); const isFocusWithinRef = ref(false); const hotkeyLabel = props.hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, ""); function removeToast(toastToRemove) { if (!toasts.value.find((toast$1) => toast$1.id === toastToRemove.id)?.delete) ToastState.dismiss(toastToRemove.id); toasts.value = toasts.value.filter(({ id }) => id !== toastToRemove.id); setTimeout(() => { if (!toasts.value.find((t) => t.id === toastToRemove.id)) heights.value = heights.value.filter((h) => h.toastId !== toastToRemove.id); }, TIME_BEFORE_UNMOUNT + 50); } function onBlur(event) { if (isFocusWithinRef.value && !event.currentTarget?.contains?.(event.relatedTarget)) { isFocusWithinRef.value = false; if (lastFocusedElementRef.value) { lastFocusedElementRef.value.focus({ preventScroll: true }); lastFocusedElementRef.value = null; } } } function onFocus(event) { const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false"; if (isNotDismissible) return; if (!isFocusWithinRef.value) { isFocusWithinRef.value = true; lastFocusedElementRef.value = event.relatedTarget; } } function onPointerDown(event) { if (event.target) { const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false"; if (isNotDismissible) return; } interacting.value = true; } watchEffect((onInvalidate) => { const unsubscribe = ToastState.subscribe((toast$1) => { if (toast$1.dismiss) { requestAnimationFrame(() => { toasts.value = toasts.value.map((t) => t.id === toast$1.id ? { ...t, delete: true } : t); }); return; } nextTick(() => { const indexOfExistingToast = toasts.value.findIndex((t) => t.id === toast$1.id); if (indexOfExistingToast !== -1) toasts.value = [ ...toasts.value.slice(0, indexOfExistingToast), { ...toasts.value[indexOfExistingToast], ...toast$1 }, ...toasts.value.slice(indexOfExistingToast + 1) ]; else toasts.value = [toast$1, ...toasts.value]; }); }); onInvalidate(unsubscribe); }); watchEffect((onInvalidate) => { if (typeof window === "undefined") return; if (props.theme !== "system") { actualTheme.value = props.theme; return; } const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)"); const updateTheme = (matches) => { actualTheme.value = matches ? "dark" : "light"; }; updateTheme(darkMediaQuery.matches); const handler = (event) => { updateTheme(event.matches); }; try { darkMediaQuery.addEventListener("change", handler); } catch { darkMediaQuery.addListener(handler); } onInvalidate(() => { try { darkMediaQuery.removeEventListener("change", handler); } catch { darkMediaQuery.removeListener(handler); } }); }); watchEffect(() => { if (listRef.value && lastFocusedElementRef.value) { lastFocusedElementRef.value.focus({ preventScroll: true }); lastFocusedElementRef.value = null; isFocusWithinRef.value = false; } }); watchEffect(() => { if (toasts.value.length <= 1) Object.keys(expanded.value).forEach((pos) => { expanded.value[pos] = false; }); }); watchEffect((onInvalidate) => { function handleKeyDown(event) { const isHotkeyPressed = props.hotkey.every((key) => event[key] || event.code === key); const listRefItem = Array.isArray(listRef.value) ? listRef.value[0] : listRef.value; if (isHotkeyPressed) { possiblePositions.value.forEach((pos) => { expanded.value[pos] = true; }); listRefItem?.focus(); } const isItemActive = document.activeElement === listRef.value || listRefItem?.contains(document.activeElement); if (event.code === "Escape" && isItemActive) possiblePositions.value.forEach((pos) => { expanded.value[pos] = false; }); } if (!isClient) return; document.addEventListener("keydown", handleKeyDown); onInvalidate(() => { document.removeEventListener("keydown", handleKeyDown); }); }); function handleMouseEnter(event) { const target = event.currentTarget; const position = target.getAttribute("data-y-position") + "-" + target.getAttribute("data-x-position"); expanded.value[position] = true; } function handleMouseLeave(event) { if (!interacting.value) { const target = event.currentTarget; const position = target.getAttribute("data-y-position") + "-" + target.getAttribute("data-x-position"); expanded.value[position] = false; } } function handleDragEnd() { Object.keys(expanded.value).forEach((pos) => { expanded.value[pos] = false; }); } function handlePointerUp() { interacting.value = false; } function updateHeights(h) { heights.value = h; } function updateHeight(h) { const index = heights.value.findIndex((item) => item.toastId === h.toastId); if (index !== -1) heights.value[index] = h; else { const samePositionIndex = heights.value.findIndex((item) => item.position === h.position); if (samePositionIndex !== -1) heights.value.splice(samePositionIndex, 0, h); else heights.value.unshift(h); } } return (_ctx, _cache) => { return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" Remove item from normal navigation flow, only available via hotkey "), createElementVNode("section", { "aria-label": `${_ctx.containerAriaLabel} ${unref(hotkeyLabel)}`, tabIndex: -1, "aria-live": "polite", "aria-relevant": "additions text", "aria-atomic": "false" }, [(openBlock(true), createElementBlock(Fragment, null, renderList(possiblePositions.value, (pos, index) => { return openBlock(), createElementBlock("ol", mergeProps({ key: pos, ref_for: true, ref_key: "listRef", ref: listRef, "data-sonner-toaster": "", "data-sonner-theme": actualTheme.value, class: props.class, dir: _ctx.dir === "auto" ? getDocumentDirection() : _ctx.dir, tabIndex: -1, "data-theme": _ctx.theme, "data-rich-colors": _ctx.richColors, "data-y-position": pos.split("-")[0], "data-x-position": pos.split("-")[1], style: { "--front-toast-height": `${heights.value[0]?.height || 0}px`, "--width": `${unref(TOAST_WIDTH)}px`, "--gap": `${_ctx.gap}px`, ..._ctx.style, ...unref(attrs).style, ...unref(assignOffset)(_ctx.offset, _ctx.mobileOffset) } }, { ref_for: true }, _ctx.$attrs, { onBlur, onFocus, onMouseenter: handleMouseEnter, onMousemove: handleMouseEnter, onMouseleave: handleMouseLeave, onDragend: handleDragEnd, onPointerdown: onPointerDown, onPointerup: handlePointerUp }), [(openBlock(true), createElementBlock(Fragment, null, renderList(filteredToasts(pos, index), (toast$1, idx) => { return openBlock(), createBlock(Toast_default, { key: toast$1.id, heights: heights.value, icons: _ctx.icons, index: idx, toast: toast$1, defaultRichColors: _ctx.richColors, duration: _ctx.toastOptions?.duration ?? _ctx.duration, class: normalizeClass(_ctx.toastOptions?.class ?? ""), descriptionClass: _ctx.toastOptions?.descriptionClass, invert: _ctx.invert, visibleToasts: _ctx.visibleToasts, closeButton: _ctx.toastOptions?.closeButton ?? _ctx.closeButton, interacting: interacting.value, position: pos, closeButtonPosition: _ctx.toastOptions?.closeButtonPosition ?? _ctx.closeButtonPosition, style: normalizeStyle(_ctx.toastOptions?.style), unstyled: _ctx.toastOptions?.unstyled, classes: _ctx.toastOptions?.classes, cancelButtonStyle: _ctx.toastOptions?.cancelButtonStyle, actionButtonStyle: _ctx.toastOptions?.actionButtonStyle, "close-button-aria-label": _ctx.toastOptions?.closeButtonAriaLabel, toasts: toastsByPosition.value[pos], expandByDefault: _ctx.expand, gap: _ctx.gap, expanded: expanded.value[pos] || false, swipeDirections: props.swipeDirections, "onUpdate:heights": updateHeights, "onUpdate:height": updateHeight, onRemoveToast: removeToast }, { "close-icon": withCtx(() => [renderSlot(_ctx.$slots, "close-icon", {}, () => [createVNode(CloseIcon_default)])]), "loading-icon": withCtx(() => [renderSlot(_ctx.$slots, "loading-icon", {}, () => [createVNode(Loader_default, { visible: toast$1.type === "loading" }, null, 8, ["visible"])])]), "success-icon": withCtx(() => [renderSlot(_ctx.$slots, "success-icon", {}, () => [createVNode(SuccessIcon_default)])]), "error-icon": withCtx(() => [renderSlot(_ctx.$slots, "error-icon", {}, () => [createVNode(ErrorIcon_default)])]), "warning-icon": withCtx(() => [renderSlot(_ctx.$slots, "warning-icon", {}, () => [createVNode(WarningIcon_default)])]), "info-icon": withCtx(() => [renderSlot(_ctx.$slots, "info-icon", {}, () => [createVNode(InfoIcon_default)])]), _: 2 }, 1032, [ "heights", "icons", "index", "toast", "defaultRichColors", "duration", "class", "descriptionClass", "invert", "visibleToasts", "closeButton", "interacting", "position", "closeButtonPosition", "style", "unstyled", "classes", "cancelButtonStyle", "actionButtonStyle", "close-button-aria-label", "toasts", "expandByDefault", "gap", "expanded", "swipeDirections" ]); }), 128))], 16, _hoisted_2$4); }), 128))], 8, _hoisted_1$8)], 2112); }; } }); var Toaster_default = Toaster_vue_vue_type_script_setup_true_lang_default; const indexCss = 'html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0}html[dir=rtl],[data-sonner-toaster][dir=rtl]{--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}@media(hover:none)and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translate(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}[data-sonner-toast][data-y-position=top]{top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px #0006}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:#00000014}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:#ffffff4d}[data-sonner-toaster] [data-close-button-position=top-left]{--toast-close-button-left: 0;--toast-close-button-right: unset;--toast-close-button-top: 0;--toast-close-button-bottom: unset;--toast-close-button-transform: translate(-35%, -35%)}[data-sonner-toaster] [data-close-button-position=top-right]{--toast-close-button-left: unset;--toast-close-button-right: 0;--toast-close-button-top: 0;--toast-close-button-bottom: unset;--toast-close-button-transform: translate(35%, -35%)}[data-sonner-toaster] [data-close-button-position=bottom-left]{--toast-close-button-left: 0;--toast-close-button-right: unset;--toast-close-button-top: unset;--toast-close-button-bottom: 0;--toast-close-button-transform: translate(-35%, 35%)}[data-sonner-toaster] [data-close-button-position=bottom-right]{--toast-close-button-left: unset;--toast-close-button-right: 0;--toast-close-button-top: unset;--toast-close-button-bottom: 0;--toast-close-button-transform: translate(35%, 35%)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-left);right:var(--toast-close-button-right);top:var(--toast-close-button-top);bottom:var(--toast-close-button-bottom);height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]:before{content:"";position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]:before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]:before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]:before{content:"";position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]:after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y: translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--toasts-before) * .05 + 1));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y: translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]:before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media(max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:calc(var(--mobile-offset-bottom) + max(env(safe-area-inset-bottom),0px))}[data-sonner-toaster][data-y-position=top]{top:calc(var(--mobile-offset-top) + max(env(safe-area-inset-top),0px))}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 87%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 93%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 84%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 43%, 17%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 9%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media(prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}'; importCSS(indexCss); function toFilter(filter) { if (typeof filter === "function") return filter; return getLevelFilter(filter); } function getLevelFilter(level) { if (level == null) return () => false; if (level === "fatal") return (record) => record.level === "fatal"; else if (level === "error") return (record) => record.level === "fatal" || record.level === "error"; else if (level === "warning") return (record) => record.level === "fatal" || record.level === "error" || record.level === "warning"; else if (level === "info") return (record) => record.level === "fatal" || record.level === "error" || record.level === "warning" || record.level === "info"; else if (level === "debug") return (record) => record.level === "fatal" || record.level === "error" || record.level === "warning" || record.level === "info" || record.level === "debug"; else if (level === "trace") return () => true; throw new TypeError(`Invalid log level: ${level}.`); } const logLevels = [ "trace", "debug", "info", "warning", "error", "fatal" ]; function compareLogLevel(a, b) { const aIndex = logLevels.indexOf(a); if (aIndex < 0) throw new TypeError(`Invalid log level: ${JSON.stringify(a)}.`); const bIndex = logLevels.indexOf(b); if (bIndex < 0) throw new TypeError(`Invalid log level: ${JSON.stringify(b)}.`); return aIndex - bIndex; } const lazySymbol = Symbol.for("logtape.lazy"); function isLazy(value) { return value != null && typeof value === "object" && lazySymbol in value && value[lazySymbol] === true; } function resolveProperties(properties) { const resolved = {}; for (const key in properties) { const value = properties[key]; resolved[key] = isLazy(value) ? value.getter() : value; } return resolved; } function getLogger(category = []) { return LoggerImpl.getLogger(category); } const globalRootLoggerSymbol = Symbol.for("logtape.rootLogger"); var LoggerImpl = class LoggerImpl2 { parent; children; category; sinks; parentSinks = "inherit"; filters; lowestLevel = "trace"; contextLocalStorage; static getLogger(category = []) { let rootLogger = globalRootLoggerSymbol in globalThis ? globalThis[globalRootLoggerSymbol] ?? null : null; if (rootLogger == null) { rootLogger = new LoggerImpl2(null, []); globalThis[globalRootLoggerSymbol] = rootLogger; } if (typeof category === "string") return rootLogger.getChild(category); if (category.length === 0) return rootLogger; return rootLogger.getChild(category); } constructor(parent, category) { this.parent = parent; this.children = {}; this.category = category; this.sinks = []; this.filters = []; } getChild(subcategory) { const name = typeof subcategory === "string" ? subcategory : subcategory[0]; const childRef = this.children[name]; let child = childRef instanceof LoggerImpl2 ? childRef : childRef?.deref(); if (child == null) { child = new LoggerImpl2(this, [...this.category, name]); this.children[name] = "WeakRef" in globalThis ? new WeakRef(child) : child; } if (typeof subcategory === "string" || subcategory.length === 1) return child; return child.getChild(subcategory.slice(1)); } reset() { while (this.sinks.length > 0) this.sinks.shift(); this.parentSinks = "inherit"; while (this.filters.length > 0) this.filters.shift(); this.lowestLevel = "trace"; } resetDescendants() { for (const child of Object.values(this.children)) { const logger2 = child instanceof LoggerImpl2 ? child : child.deref(); if (logger2 != null) logger2.resetDescendants(); } this.reset(); } with(properties) { return new LoggerCtx(this, { ...properties }); } filter(record) { for (const filter of this.filters) if (!filter(record)) return false; if (this.filters.length < 1) return this.parent?.filter(record) ?? true; return true; } *getSinks(level) { if (this.lowestLevel === null || compareLogLevel(level, this.lowestLevel) < 0) return; if (this.parent != null && this.parentSinks === "inherit") for (const sink of this.parent.getSinks(level)) yield sink; for (const sink of this.sinks) yield sink; } isEnabledFor(level) { if (this.lowestLevel === null || compareLogLevel(level, this.lowestLevel) < 0) return false; for (const _ of this.getSinks(level)) return true; return false; } emit(record, bypassSinks) { const categoryPrefix = getCategoryPrefix(); const baseCategory = "category" in record ? record.category : this.category; const fullCategory = categoryPrefix.length > 0 ? [...categoryPrefix, ...baseCategory] : baseCategory; const descriptors = Object.getOwnPropertyDescriptors(record); descriptors.category = { value: fullCategory, enumerable: true, configurable: true }; const fullRecord = Object.defineProperties({}, descriptors); if (this.lowestLevel === null || compareLogLevel(fullRecord.level, this.lowestLevel) < 0 || !this.filter(fullRecord)) return; for (const sink of this.getSinks(fullRecord.level)) { if (bypassSinks?.has(sink)) continue; try { sink(fullRecord); } catch (error) { const bypassSinks2 = new Set(bypassSinks); bypassSinks2.add(sink); metaLogger.log("fatal", "Failed to emit a log record to sink {sink}: {error}", { sink, error, record: fullRecord }, bypassSinks2); } } } log(level, rawMessage, properties, bypassSinks) { const implicitContext = getImplicitContext(); let cachedProps = void 0; const record = typeof properties === "function" ? { category: this.category, level, timestamp: Date.now(), get message() { return parseMessageTemplate(rawMessage, this.properties); }, rawMessage, get properties() { if (cachedProps == null) cachedProps = { ...implicitContext, ...properties() }; return cachedProps; } } : { category: this.category, level, timestamp: Date.now(), message: parseMessageTemplate(rawMessage, { ...implicitContext, ...properties }), rawMessage, properties: { ...implicitContext, ...properties } }; this.emit(record, bypassSinks); } logLazily(level, callback, properties = {}) { const implicitContext = getImplicitContext(); let rawMessage = void 0; let msg = void 0; function realizeMessage() { if (msg == null || rawMessage == null) { msg = callback((tpl, ...values) => { rawMessage = tpl; return renderMessage(tpl, values); }); if (rawMessage == null) throw new TypeError("No log record was made."); } return [msg, rawMessage]; } this.emit({ category: this.category, level, get message() { return realizeMessage()[0]; }, get rawMessage() { return realizeMessage()[1]; }, timestamp: Date.now(), properties: { ...implicitContext, ...properties } }); } logTemplate(level, messageTemplate, values, properties = {}) { const implicitContext = getImplicitContext(); this.emit({ category: this.category, level, message: renderMessage(messageTemplate, values), rawMessage: messageTemplate, timestamp: Date.now(), properties: { ...implicitContext, ...properties } }); } trace(message, ...values) { if (typeof message === "string") { const props = values[0]; if (typeof props === "function") { if (props.constructor.name === "AsyncFunction") { if (!this.isEnabledFor("trace")) return Promise.resolve(); return props().then((resolvedProps) => { this.log("trace", message, resolvedProps); }); } const result = props(); if (result instanceof Promise) { if (!this.isEnabledFor("trace")) return Promise.resolve(); return result.then((resolvedProps) => { this.log("trace", message, resolvedProps); }); } this.log("trace", message, result); return; } this.log("trace", message, props ?? {}); } else if (typeof message === "function") this.logLazily("trace", message); else if (!Array.isArray(message)) this.log("trace", "{*}", message); else this.logTemplate("trace", message, values); } debug(message, ...values) { if (typeof message === "string") { const props = values[0]; if (typeof props === "function") { if (props.constructor.name === "AsyncFunction") { if (!this.isEnabledFor("debug")) return Promise.resolve(); return props().then((resolvedProps) => { this.log("debug", message, resolvedProps); }); } const result = props(); if (result instanceof Promise) { if (!this.isEnabledFor("debug")) return Promise.resolve(); return result.then((resolvedProps) => { this.log("debug", message, resolvedProps); }); } this.log("debug", message, result); return; } this.log("debug", message, props ?? {}); } else if (typeof message === "function") this.logLazily("debug", message); else if (!Array.isArray(message)) this.log("debug", "{*}", message); else this.logTemplate("debug", message, values); } info(message, ...values) { if (typeof message === "string") { const props = values[0]; if (typeof props === "function") { if (props.constructor.name === "AsyncFunction") { if (!this.isEnabledFor("info")) return Promise.resolve(); return props().then((resolvedProps) => { this.log("info", message, resolvedProps); }); } const result = props(); if (result instanceof Promise) { if (!this.isEnabledFor("info")) return Promise.resolve(); return result.then((resolvedProps) => { this.log("info", message, resolvedProps); }); } this.log("info", message, result); return; } this.log("info", message, props ?? {}); } else if (typeof message === "function") this.logLazily("info", message); else if (!Array.isArray(message)) this.log("info", "{*}", message); else this.logTemplate("info", message, values); } warn(message, ...values) { if (message instanceof Error) this.log("warning", "{error.message}", { error: message }); else if (typeof message === "string" && values[0] instanceof Error) this.log("warning", message, { error: values[0] }); else if (typeof message === "string") { const props = values[0]; if (typeof props === "function") { if (props.constructor.name === "AsyncFunction") { if (!this.isEnabledFor("warning")) return Promise.resolve(); return props().then((resolvedProps) => { this.log("warning", message, resolvedProps); }); } const result = props(); if (result instanceof Promise) { if (!this.isEnabledFor("warning")) return Promise.resolve(); return result.then((resolvedProps) => { this.log("warning", message, resolvedProps); }); } this.log("warning", message, result); return; } this.log("warning", message, props ?? {}); } else if (typeof message === "function") this.logLazily("warning", message); else if (!Array.isArray(message)) this.log("warning", "{*}", message); else this.logTemplate("warning", message, values); } warning(message, ...values) { if (message instanceof Error) this.log("warning", "{error.message}", { error: message }); else if (typeof message === "string" && values[0] instanceof Error) this.log("warning", message, { error: values[0] }); else if (typeof message === "string") { const props = values[0]; if (typeof props === "function") { if (props.constructor.name === "AsyncFunction") { if (!this.isEnabledFor("warning")) return Promise.resolve(); return props().then((resolvedProps) => { this.log("warning", message, resolvedProps); }); } const result = props(); if (result instanceof Promise) { if (!this.isEnabledFor("warning")) return Promise.resolve(); return result.then((resolvedProps) => { this.log("warning", message, resolvedProps); }); } this.log("warning", message, result); return; } this.log("warning", message, props ?? {}); } else if (typeof message === "function") this.logLazily("warning", message); else if (!Array.isArray(message)) this.log("warning", "{*}", message); else this.logTemplate("warning", message, values); } error(message, ...values) { if (message instanceof Error) this.log("error", "{error.message}", { error: message }); else if (typeof message === "string" && values[0] instanceof Error) this.log("error", message, { error: values[0] }); else if (typeof message === "string") { const props = values[0]; if (typeof props === "function") { if (props.constructor.name === "AsyncFunction") { if (!this.isEnabledFor("error")) return Promise.resolve(); return props().then((resolvedProps) => { this.log("error", message, resolvedProps); }); } const result = props(); if (result instanceof Promise) { if (!this.isEnabledFor("error")) return Promise.resolve(); return result.then((resolvedProps) => { this.log("error", message, resolvedProps); }); } this.log("error", message, result); return; } this.log("error", message, props ?? {}); } else if (typeof message === "function") this.logLazily("error", message); else if (!Array.isArray(message)) this.log("error", "{*}", message); else this.logTemplate("error", message, values); } fatal(message, ...values) { if (message instanceof Error) this.log("fatal", "{error.message}", { error: message }); else if (typeof message === "string" && values[0] instanceof Error) this.log("fatal", message, { error: values[0] }); else if (typeof message === "string") { const props = values[0]; if (typeof props === "function") { if (props.constructor.name === "AsyncFunction") { if (!this.isEnabledFor("fatal")) return Promise.resolve(); return props().then((resolvedProps) => { this.log("fatal", message, resolvedProps); }); } const result = props(); if (result instanceof Promise) { if (!this.isEnabledFor("fatal")) return Promise.resolve(); return result.then((resolvedProps) => { this.log("fatal", message, resolvedProps); }); } this.log("fatal", message, result); return; } this.log("fatal", message, props ?? {}); } else if (typeof message === "function") this.logLazily("fatal", message); else if (!Array.isArray(message)) this.log("fatal", "{*}", message); else this.logTemplate("fatal", message, values); } }; var LoggerCtx = class LoggerCtx2 { logger; properties; constructor(logger2, properties) { this.logger = logger2; this.properties = properties; } get category() { return this.logger.category; } get parent() { return this.logger.parent; } getChild(subcategory) { return this.logger.getChild(subcategory).with(this.properties); } with(properties) { return new LoggerCtx2(this.logger, { ...this.properties, ...properties }); } log(level, message, properties, bypassSinks) { const contextProps = this.properties; this.logger.log(level, message, typeof properties === "function" ? () => resolveProperties({ ...contextProps, ...properties() }) : () => resolveProperties({ ...contextProps, ...properties }), bypassSinks); } logLazily(level, callback) { this.logger.logLazily(level, callback, resolveProperties(this.properties)); } logTemplate(level, messageTemplate, values) { this.logger.logTemplate(level, messageTemplate, values, resolveProperties(this.properties)); } emit(record) { const recordWithContext = { ...record, properties: resolveProperties({ ...this.properties, ...record.properties }) }; this.logger.emit(recordWithContext); } isEnabledFor(level) { return this.logger.isEnabledFor(level); } trace(message, ...values) { if (typeof message === "string") { const props = values[0]; if (typeof props === "function") { if (props.constructor.name === "AsyncFunction") { if (!this.isEnabledFor("trace")) return Promise.resolve(); return props().then((resolvedProps) => { this.log("trace", message, resolvedProps); }); } const result = props(); if (result instanceof Promise) { if (!this.isEnabledFor("trace")) return Promise.resolve(); return result.then((resolvedProps) => { this.log("trace", message, resolvedProps); }); } this.log("trace", message, result); return; } this.log("trace", message, props ?? {}); } else if (typeof message === "function") this.logLazily("trace", message); else if (!Array.isArray(message)) this.log("trace", "{*}", message); else this.logTemplate("trace", message, values); } debug(message, ...values) { if (typeof message === "string") { const props = values[0]; if (typeof props === "function") { if (props.constructor.name === "AsyncFunction") { if (!this.isEnabledFor("debug")) return Promise.resolve(); return props().then((resolvedProps) => { this.log("debug", message, resolvedProps); }); } const result = props(); if (result instanceof Promise) { if (!this.isEnabledFor("debug")) return Promise.resolve(); return result.then((resolvedProps) => { this.log("debug", message, resolvedProps); }); } this.log("debug", message, result); return; } this.log("debug", message, props ?? {}); } else if (typeof message === "function") this.logLazily("debug", message); else if (!Array.isArray(message)) this.log("debug", "{*}", message); else this.logTemplate("debug", message, values); } info(message, ...values) { if (typeof message === "string") { const props = values[0]; if (typeof props === "function") { if (props.constructor.name === "AsyncFunction") { if (!this.isEnabledFor("info")) return Promise.resolve(); return props().then((resolvedProps) => { this.log("info", message, resolvedProps); }); } const result = props(); if (result instanceof Promise) { if (!this.isEnabledFor("info")) return Promise.resolve(); return result.then((resolvedProps) => { this.log("info", message, resolvedProps); }); } this.log("info", message, result); return; } this.log("info", message, props ?? {}); } else if (typeof message === "function") this.logLazily("info", message); else if (!Array.isArray(message)) this.log("info", "{*}", message); else this.logTemplate("info", message, values); } warn(message, ...values) { if (message instanceof Error) this.log("warning", "{error.message}", { error: message }); else if (typeof message === "string" && values[0] instanceof Error) this.log("warning", message, { error: values[0] }); else if (typeof message === "string") { const props = values[0]; if (typeof props === "function") { if (props.constructor.name === "AsyncFunction") { if (!this.isEnabledFor("warning")) return Promise.resolve(); return props().then((resolvedProps) => { this.log("warning", message, resolvedProps); }); } const result = props(); if (result instanceof Promise) { if (!this.isEnabledFor("warning")) return Promise.resolve(); return result.then((resolvedProps) => { this.log("warning", message, resolvedProps); }); } this.log("warning", message, result); return; } this.log("warning", message, props ?? {}); } else if (typeof message === "function") this.logLazily("warning", message); else if (!Array.isArray(message)) this.log("warning", "{*}", message); else this.logTemplate("warning", message, values); } warning(message, ...values) { if (message instanceof Error) this.log("warning", "{error.message}", { error: message }); else if (typeof message === "string" && values[0] instanceof Error) this.log("warning", message, { error: values[0] }); else if (typeof message === "string") { const props = values[0]; if (typeof props === "function") { if (props.constructor.name === "AsyncFunction") { if (!this.isEnabledFor("warning")) return Promise.resolve(); return props().then((resolvedProps) => { this.log("warning", message, resolvedProps); }); } const result = props(); if (result instanceof Promise) { if (!this.isEnabledFor("warning")) return Promise.resolve(); return result.then((resolvedProps) => { this.log("warning", message, resolvedProps); }); } this.log("warning", message, result); return; } this.log("warning", message, props ?? {}); } else if (typeof message === "function") this.logLazily("warning", message); else if (!Array.isArray(message)) this.log("warning", "{*}", message); else this.logTemplate("warning", message, values); } error(message, ...values) { if (message instanceof Error) this.log("error", "{error.message}", { error: message }); else if (typeof message === "string" && values[0] instanceof Error) this.log("error", message, { error: values[0] }); else if (typeof message === "string") { const props = values[0]; if (typeof props === "function") { if (props.constructor.name === "AsyncFunction") { if (!this.isEnabledFor("error")) return Promise.resolve(); return props().then((resolvedProps) => { this.log("error", message, resolvedProps); }); } const result = props(); if (result instanceof Promise) { if (!this.isEnabledFor("error")) return Promise.resolve(); return result.then((resolvedProps) => { this.log("error", message, resolvedProps); }); } this.log("error", message, result); return; } this.log("error", message, props ?? {}); } else if (typeof message === "function") this.logLazily("error", message); else if (!Array.isArray(message)) this.log("error", "{*}", message); else this.logTemplate("error", message, values); } fatal(message, ...values) { if (message instanceof Error) this.log("fatal", "{error.message}", { error: message }); else if (typeof message === "string" && values[0] instanceof Error) this.log("fatal", message, { error: values[0] }); else if (typeof message === "string") { const props = values[0]; if (typeof props === "function") { if (props.constructor.name === "AsyncFunction") { if (!this.isEnabledFor("fatal")) return Promise.resolve(); return props().then((resolvedProps) => { this.log("fatal", message, resolvedProps); }); } const result = props(); if (result instanceof Promise) { if (!this.isEnabledFor("fatal")) return Promise.resolve(); return result.then((resolvedProps) => { this.log("fatal", message, resolvedProps); }); } this.log("fatal", message, result); return; } this.log("fatal", message, props ?? {}); } else if (typeof message === "function") this.logLazily("fatal", message); else if (!Array.isArray(message)) this.log("fatal", "{*}", message); else this.logTemplate("fatal", message, values); } }; const metaLogger = LoggerImpl.getLogger(["logtape", "meta"]); function isNestedAccess(key) { return key.includes(".") || key.includes("[") || key.includes("?."); } function getOwnProperty(obj, key) { if (key === "__proto__" || key === "prototype" || key === "constructor") return void 0; if ((typeof obj === "object" || typeof obj === "function") && obj !== null) return Object.prototype.hasOwnProperty.call(obj, key) ? obj[key] : void 0; return void 0; } function parseNextSegment(path, fromIndex) { const len = path.length; let i = fromIndex; if (i >= len) return null; let segment; if (path[i] === "[") { i++; if (i >= len) return null; if (path[i] === '"' || path[i] === "'") { const quote = path[i]; i++; let segmentStr = ""; while (i < len && path[i] !== quote) if (path[i] === "\\") { i++; if (i < len) { const escapeChar = path[i]; switch (escapeChar) { case "n": segmentStr += "\n"; break; case "t": segmentStr += " "; break; case "r": segmentStr += "\r"; break; case "b": segmentStr += "\b"; break; case "f": segmentStr += "\f"; break; case "v": segmentStr += "\v"; break; case "0": segmentStr += "\0"; break; case "\\": segmentStr += "\\"; break; case '"': segmentStr += '"'; break; case "'": segmentStr += "'"; break; case "u": if (i + 4 < len) { const hex = path.slice(i + 1, i + 5); const codePoint = Number.parseInt(hex, 16); if (!Number.isNaN(codePoint)) { segmentStr += String.fromCharCode(codePoint); i += 4; } else segmentStr += escapeChar; } else segmentStr += escapeChar; break; default: segmentStr += escapeChar; } i++; } } else { segmentStr += path[i]; i++; } if (i >= len) return null; segment = segmentStr; i++; } else { const startIndex = i; while (i < len && path[i] !== "]" && path[i] !== "'" && path[i] !== '"') i++; if (i >= len) return null; const indexStr = path.slice(startIndex, i); if (indexStr.length === 0) return null; const indexNum = Number(indexStr); segment = Number.isNaN(indexNum) ? indexStr : indexNum; } while (i < len && path[i] !== "]") i++; if (i < len) i++; } else { const startIndex = i; while (i < len && path[i] !== "." && path[i] !== "[" && path[i] !== "?" && path[i] !== "]") i++; segment = path.slice(startIndex, i); if (segment.length === 0) return null; } if (i < len && path[i] === ".") i++; return { segment, nextIndex: i }; } function accessProperty(obj, segment) { if (typeof segment === "string") return getOwnProperty(obj, segment); if (Array.isArray(obj) && segment >= 0 && segment < obj.length) return obj[segment]; return void 0; } function resolvePropertyPath(obj, path) { if (obj == null) return void 0; if (path.length === 0 || path.endsWith(".")) return void 0; let current = obj; let i = 0; const len = path.length; while (i < len) { const isOptional = path.slice(i, i + 2) === "?."; if (isOptional) { i += 2; if (current == null) return void 0; } else if (current == null) return void 0; const result = parseNextSegment(path, i); if (result === null) return void 0; const { segment, nextIndex } = result; i = nextIndex; current = accessProperty(current, segment); if (current === void 0) return void 0; } return current; } function parseMessageTemplate(template, properties) { const length = template.length; if (length === 0) return [""]; if (!template.includes("{")) return [template]; const message = []; let startIndex = 0; for (let i = 0; i < length; i++) { const char = template[i]; if (char === "{") { const nextChar = i + 1 < length ? template[i + 1] : ""; if (nextChar === "{") { i++; continue; } const closeIndex = template.indexOf("}", i + 1); if (closeIndex === -1) continue; const beforeText = template.slice(startIndex, i); message.push(beforeText.replace(/{{/g, "{").replace(/}}/g, "}")); const key = template.slice(i + 1, closeIndex); let prop; const trimmedKey = key.trim(); if (trimmedKey === "*") prop = key in properties ? properties[key] : "*" in properties ? properties["*"] : properties; else { if (key !== trimmedKey) prop = key in properties ? properties[key] : properties[trimmedKey]; else prop = properties[key]; if (prop === void 0 && isNestedAccess(trimmedKey)) prop = resolvePropertyPath(properties, trimmedKey); } message.push(prop); i = closeIndex; startIndex = i + 1; } else if (char === "}" && i + 1 < length && template[i + 1] === "}") i++; } const remainingText = template.slice(startIndex); message.push(remainingText.replace(/{{/g, "{").replace(/}}/g, "}")); return message; } function renderMessage(template, values) { const args = []; for (let i = 0; i < template.length; i++) { args.push(template[i]); if (i < values.length) args.push(values[i]); } return args; } const categoryPrefixSymbol = Symbol.for("logtape.categoryPrefix"); function getCategoryPrefix() { const rootLogger = LoggerImpl.getLogger(); const store = rootLogger.contextLocalStorage?.getStore(); if (store == null) return []; const prefix = store[categoryPrefixSymbol]; return Array.isArray(prefix) ? prefix : []; } function getImplicitContext() { const rootLogger = LoggerImpl.getLogger(); const store = rootLogger.contextLocalStorage?.getStore(); if (store == null) return {}; const result = {}; for (const key of Object.keys(store)) result[key] = store[key]; return result; } function inspect$1(obj, options) { const indent = options?.compact === true ? void 0 : 2; return JSON.stringify(obj, null, indent); } const util = Object.freeze( Object.defineProperty({ __proto__: null, inspect: inspect$1 }, Symbol.toStringTag, { value: "Module" })); const levelAbbreviations = { "trace": "TRC", "debug": "DBG", "info": "INF", "warning": "WRN", "error": "ERR", "fatal": "FTL" }; const inspect = typeof document !== "undefined" || typeof navigator !== "undefined" && navigator.product === "ReactNative" ? (v) => JSON.stringify(v) : "Deno" in globalThis && "inspect" in globalThis.Deno && typeof globalThis.Deno.inspect === "function" ? (v, opts) => globalThis.Deno.inspect(v, { strAbbreviateSize: Infinity, iterableLimit: Infinity, ...opts }) : util != null && true && typeof inspect$1 === "function" ? (v, opts) => inspect$1(v, { ...opts }) : (v) => JSON.stringify(v); function padZero(num) { return num < 10 ? `0${num}` : `${num}`; } function padThree(num) { return num < 10 ? `00${num}` : num < 100 ? `0${num}` : `${num}`; } const timestampFormatters = { "date-time-timezone": (ts) => { const d = new Date(ts); const year = d.getUTCFullYear(); const month = padZero(d.getUTCMonth() + 1); const day = padZero(d.getUTCDate()); const hour = padZero(d.getUTCHours()); const minute = padZero(d.getUTCMinutes()); const second = padZero(d.getUTCSeconds()); const ms = padThree(d.getUTCMilliseconds()); return `${year}-${month}-${day} ${hour}:${minute}:${second}.${ms} +00:00`; }, "date-time-tz": (ts) => { const d = new Date(ts); const year = d.getUTCFullYear(); const month = padZero(d.getUTCMonth() + 1); const day = padZero(d.getUTCDate()); const hour = padZero(d.getUTCHours()); const minute = padZero(d.getUTCMinutes()); const second = padZero(d.getUTCSeconds()); const ms = padThree(d.getUTCMilliseconds()); return `${year}-${month}-${day} ${hour}:${minute}:${second}.${ms} +00`; }, "date-time": (ts) => { const d = new Date(ts); const year = d.getUTCFullYear(); const month = padZero(d.getUTCMonth() + 1); const day = padZero(d.getUTCDate()); const hour = padZero(d.getUTCHours()); const minute = padZero(d.getUTCMinutes()); const second = padZero(d.getUTCSeconds()); const ms = padThree(d.getUTCMilliseconds()); return `${year}-${month}-${day} ${hour}:${minute}:${second}.${ms}`; }, "time-timezone": (ts) => { const d = new Date(ts); const hour = padZero(d.getUTCHours()); const minute = padZero(d.getUTCMinutes()); const second = padZero(d.getUTCSeconds()); const ms = padThree(d.getUTCMilliseconds()); return `${hour}:${minute}:${second}.${ms} +00:00`; }, "time-tz": (ts) => { const d = new Date(ts); const hour = padZero(d.getUTCHours()); const minute = padZero(d.getUTCMinutes()); const second = padZero(d.getUTCSeconds()); const ms = padThree(d.getUTCMilliseconds()); return `${hour}:${minute}:${second}.${ms} +00`; }, "time": (ts) => { const d = new Date(ts); const hour = padZero(d.getUTCHours()); const minute = padZero(d.getUTCMinutes()); const second = padZero(d.getUTCSeconds()); const ms = padThree(d.getUTCMilliseconds()); return `${hour}:${minute}:${second}.${ms}`; }, "date": (ts) => { const d = new Date(ts); const year = d.getUTCFullYear(); const month = padZero(d.getUTCMonth() + 1); const day = padZero(d.getUTCDate()); return `${year}-${month}-${day}`; }, "rfc3339": (ts) => new Date(ts).toISOString(), "none": () => null }; const levelRenderersCache = { ABBR: levelAbbreviations, abbr: { trace: "trc", debug: "dbg", info: "inf", warning: "wrn", error: "err", fatal: "ftl" }, FULL: { trace: "TRACE", debug: "DEBUG", info: "INFO", warning: "WARNING", error: "ERROR", fatal: "FATAL" }, full: { trace: "trace", debug: "debug", info: "info", warning: "warning", error: "error", fatal: "fatal" }, L: { trace: "T", debug: "D", info: "I", warning: "W", error: "E", fatal: "F" }, l: { trace: "t", debug: "d", info: "i", warning: "w", error: "e", fatal: "f" } }; function getLineEndingValue(lineEnding) { return lineEnding === "crlf" ? "\r\n" : "\n"; } function jsonReplacer(_key, value) { if (!(value instanceof Error)) return value; const serialized = { name: value.name, message: value.message }; if (typeof value.stack === "string") serialized.stack = value.stack; const cause = value.cause; if (cause !== void 0) serialized.cause = cause; if (typeof AggregateError !== "undefined" && value instanceof AggregateError) serialized.errors = value.errors; for (const key of Object.keys(value)) if (!(key in serialized)) serialized[key] = value[key]; return serialized; } function getTextFormatter(options = {}) { const timestampRenderer = (() => { const tsOption = options.timestamp; if (tsOption == null) return timestampFormatters["date-time-timezone"]; else if (tsOption === "disabled") return timestampFormatters["none"]; else if (typeof tsOption === "string" && tsOption in timestampFormatters) return timestampFormatters[tsOption]; else return tsOption; })(); const categorySeparator = options.category ?? "·"; const valueRenderer = options.value ? (v) => options.value(v, inspect) : inspect; const levelRenderer = (() => { const levelOption = options.level; if (levelOption == null || levelOption === "ABBR") return (level) => levelRenderersCache.ABBR[level]; else if (levelOption === "abbr") return (level) => levelRenderersCache.abbr[level]; else if (levelOption === "FULL") return (level) => levelRenderersCache.FULL[level]; else if (levelOption === "full") return (level) => levelRenderersCache.full[level]; else if (levelOption === "L") return (level) => levelRenderersCache.L[level]; else if (levelOption === "l") return (level) => levelRenderersCache.l[level]; else return levelOption; })(); const lineEnding = getLineEndingValue(options.lineEnding); const formatter = options.format ?? (({ timestamp, level, category, message }) => `${timestamp ? `${timestamp} ` : ""}[${level}] ${category}: ${message}`); return (record) => { const msgParts = record.message; const msgLen = msgParts.length; let message; if (msgLen === 1) message = msgParts[0]; else if (msgLen <= 6) { message = ""; for (let i = 0; i < msgLen; i++) message += i % 2 === 0 ? msgParts[i] : valueRenderer(msgParts[i]); } else { const parts = new Array(msgLen); for (let i = 0; i < msgLen; i++) parts[i] = i % 2 === 0 ? msgParts[i] : valueRenderer(msgParts[i]); message = parts.join(""); } const timestamp = timestampRenderer(record.timestamp); const level = levelRenderer(record.level); const category = typeof categorySeparator === "function" ? categorySeparator(record.category) : record.category.join(categorySeparator); const values = { timestamp, level, category, message, record }; return `${formatter(values)}${lineEnding}`; }; } getTextFormatter(); const RESET = "\x1B[0m"; const ansiColors = { black: "\x1B[30m", red: "\x1B[31m", green: "\x1B[32m", yellow: "\x1B[33m", blue: "\x1B[34m", magenta: "\x1B[35m", cyan: "\x1B[36m", white: "\x1B[37m" }; const ansiStyles = { bold: "\x1B[1m", dim: "\x1B[2m", italic: "\x1B[3m", underline: "\x1B[4m", strikethrough: "\x1B[9m" }; const defaultLevelColors = { trace: null, debug: "blue", info: "green", warning: "yellow", error: "red", fatal: "magenta" }; function getAnsiColorFormatter(options = {}) { const format = options.format; const timestampStyle = typeof options.timestampStyle === "undefined" ? "dim" : options.timestampStyle; const timestampColor = options.timestampColor ?? null; const timestampPrefix = `${timestampStyle == null ? "" : ansiStyles[timestampStyle]}${timestampColor == null ? "" : ansiColors[timestampColor]}`; const timestampSuffix = timestampStyle == null && timestampColor == null ? "" : RESET; const levelStyle = typeof options.levelStyle === "undefined" ? "bold" : options.levelStyle; const levelColors = options.levelColors ?? defaultLevelColors; const categoryStyle = typeof options.categoryStyle === "undefined" ? "dim" : options.categoryStyle; const categoryColor = options.categoryColor ?? null; const categoryPrefix = `${categoryStyle == null ? "" : ansiStyles[categoryStyle]}${categoryColor == null ? "" : ansiColors[categoryColor]}`; const categorySuffix = categoryStyle == null && categoryColor == null ? "" : RESET; return getTextFormatter({ timestamp: "date-time-tz", value(value, fallbackInspect) { return fallbackInspect(value, { colors: true }); }, ...options, format({ timestamp, level, category, message, record }) { const levelColor = levelColors[record.level]; timestamp = timestamp == null ? null : `${timestampPrefix}${timestamp}${timestampSuffix}`; level = `${levelStyle == null ? "" : ansiStyles[levelStyle]}${levelColor == null ? "" : ansiColors[levelColor]}${level}${levelStyle == null && levelColor == null ? "" : RESET}`; return format == null ? `${timestamp == null ? "" : `${timestamp} `}${level} ${categoryPrefix}${category}:${categorySuffix} ${message}` : format({ timestamp, level, category: `${categoryPrefix}${category}${categorySuffix}`, message, record }); } }); } getAnsiColorFormatter(); function getJsonLinesFormatter(options = {}) { const lineEnding = getLineEndingValue(options.lineEnding); if (!options.categorySeparator && !options.message && !options.properties) return (record) => { if (record.message.length === 3) return JSON.stringify({ "@timestamp": new Date(record.timestamp).toISOString(), level: record.level === "warning" ? "WARN" : record.level.toUpperCase(), message: record.message[0] + JSON.stringify(record.message[1]) + record.message[2], logger: record.category.join("."), properties: record.properties }, jsonReplacer) + lineEnding; if (record.message.length === 1) return JSON.stringify({ "@timestamp": new Date(record.timestamp).toISOString(), level: record.level === "warning" ? "WARN" : record.level.toUpperCase(), message: record.message[0], logger: record.category.join("."), properties: record.properties }, jsonReplacer) + lineEnding; let msg = record.message[0]; for (let i = 1; i < record.message.length; i++) msg += i & 1 ? JSON.stringify(record.message[i]) : record.message[i]; return JSON.stringify({ "@timestamp": new Date(record.timestamp).toISOString(), level: record.level === "warning" ? "WARN" : record.level.toUpperCase(), message: msg, logger: record.category.join("."), properties: record.properties }, jsonReplacer) + lineEnding; }; const isTemplateMessage = options.message === "template"; const propertiesOption = options.properties ?? "nest:properties"; let joinCategory; if (typeof options.categorySeparator === "function") joinCategory = options.categorySeparator; else { const separator = options.categorySeparator ?? "."; joinCategory = (category) => category.join(separator); } let getProperties; if (propertiesOption === "flatten") getProperties = (properties) => properties; else if (propertiesOption.startsWith("prepend:")) { const prefix = propertiesOption.substring(8); if (prefix === "") throw new TypeError(`Invalid properties option: ${JSON.stringify(propertiesOption)}. It must be of the form "prepend:<prefix>" where <prefix> is a non-empty string.`); getProperties = (properties) => { const result = {}; for (const key in properties) result[`${prefix}${key}`] = properties[key]; return result; }; } else if (propertiesOption.startsWith("nest:")) { const key = propertiesOption.substring(5); getProperties = (properties) => ({ [key]: properties }); } else throw new TypeError(`Invalid properties option: ${JSON.stringify(propertiesOption)}. It must be "flatten", "prepend:<prefix>", or "nest:<key>".`); let getMessage; if (isTemplateMessage) getMessage = (record) => { if (typeof record.rawMessage === "string") return record.rawMessage; let msg = ""; for (let i = 0; i < record.rawMessage.length; i++) msg += i % 2 < 1 ? record.rawMessage[i] : "{}"; return msg; }; else getMessage = (record) => { const msgLen = record.message.length; if (msgLen === 1) return record.message[0]; let msg = ""; for (let i = 0; i < msgLen; i++) msg += i % 2 < 1 ? record.message[i] : JSON.stringify(record.message[i]); return msg; }; return (record) => { return JSON.stringify({ "@timestamp": new Date(record.timestamp).toISOString(), level: record.level === "warning" ? "WARN" : record.level.toUpperCase(), message: getMessage(record), logger: joinCategory(record.category), ...getProperties(record.properties) }, jsonReplacer) + lineEnding; }; } getJsonLinesFormatter(); const logLevelStyles = { "trace": "background-color: gray; color: white;", "debug": "background-color: gray; color: white;", "info": "background-color: white; color: black;", "warning": "background-color: orange; color: black;", "error": "background-color: red; color: white;", "fatal": "background-color: maroon; color: white;" }; function defaultConsoleFormatter(record) { let msg = ""; const values = []; for (let i = 0; i < record.message.length; i++) if (i % 2 === 0) msg += record.message[i]; else { msg += "%o"; values.push(record.message[i]); } const date = new Date(record.timestamp); const time = `${date.getUTCHours().toString().padStart(2, "0")}:${date.getUTCMinutes().toString().padStart(2, "0")}:${date.getUTCSeconds().toString().padStart(2, "0")}.${date.getUTCMilliseconds().toString().padStart(3, "0")}`; return [ `%c${time} %c${levelAbbreviations[record.level]}%c %c${record.category.join("·")} %c${msg}`, "color: gray;", logLevelStyles[record.level], "background-color: default;", "color: gray;", "color: default;", ...values ]; } function getConsoleSink(options = {}) { const formatter = options.formatter ?? defaultConsoleFormatter; const levelMap = { trace: "debug", debug: "debug", info: "info", warning: "warn", error: "error", fatal: "error", ...options.levelMap ?? {} }; const console2 = options.console ?? globalThis.console; const baseSink = (record) => { const args = formatter(record); const method = levelMap[record.level]; if (method === void 0) throw new TypeError(`Invalid log level: ${record.level}.`); if (typeof args === "string") { const msg = args.replace(/\r?\n$/, ""); console2[method](msg); } else console2[method](...args); }; if (!options.nonBlocking) return baseSink; const nonBlockingConfig = options.nonBlocking === true ? {} : options.nonBlocking; const bufferSize = nonBlockingConfig.bufferSize ?? 100; const flushInterval = nonBlockingConfig.flushInterval ?? 100; const buffer = []; let flushTimer = null; let disposed = false; let flushScheduled = false; const maxBufferSize = bufferSize * 2; function flush() { if (buffer.length === 0) return; const records = buffer.splice(0); for (const record of records) try { baseSink(record); } catch { } } function scheduleFlush() { if (flushScheduled) return; flushScheduled = true; setTimeout(() => { flushScheduled = false; flush(); }, 0); } function startFlushTimer() { if (flushTimer !== null || disposed) return; flushTimer = setInterval(() => { flush(); }, flushInterval); } const nonBlockingSink = (record) => { if (disposed) return; if (buffer.length >= maxBufferSize) buffer.shift(); buffer.push(record); if (buffer.length >= bufferSize) scheduleFlush(); else if (flushTimer === null) startFlushTimer(); }; nonBlockingSink[Symbol.dispose] = () => { disposed = true; if (flushTimer !== null) { clearInterval(flushTimer); flushTimer = null; } flush(); }; return nonBlockingSink; } let currentConfig = null; const strongRefs = new Set(); const disposables = new Set(); const asyncDisposables = new Set(); function isLoggerConfigMeta(cfg) { return cfg.category.length === 0 || cfg.category.length === 1 && cfg.category[0] === "logtape" || cfg.category.length === 2 && cfg.category[0] === "logtape" && cfg.category[1] === "meta"; } async function configure(config) { if (currentConfig != null && !config.reset) throw new ConfigError("Already configured; if you want to reset, turn on the reset flag."); await reset(); try { configureInternal(config, true); } catch (e) { if (e instanceof ConfigError) await reset(); throw e; } } function configureInternal(config, allowAsync) { currentConfig = config; let metaConfigured = false; const configuredCategories = new Set(); for (const cfg of config.loggers) { if (isLoggerConfigMeta(cfg)) metaConfigured = true; const categoryKey = Array.isArray(cfg.category) ? JSON.stringify(cfg.category) : JSON.stringify([cfg.category]); if (configuredCategories.has(categoryKey)) throw new ConfigError(`Duplicate logger configuration for category: ${categoryKey}. Each category can only be configured once.`); configuredCategories.add(categoryKey); const logger2 = LoggerImpl.getLogger(cfg.category); for (const sinkId of cfg.sinks ?? []) { const sink = config.sinks[sinkId]; if (!sink) throw new ConfigError(`Sink not found: ${sinkId}.`); logger2.sinks.push(sink); } logger2.parentSinks = cfg.parentSinks ?? "inherit"; if (cfg.lowestLevel !== void 0) logger2.lowestLevel = cfg.lowestLevel; for (const filterId of cfg.filters ?? []) { const filter = config.filters?.[filterId]; if (filter === void 0) throw new ConfigError(`Filter not found: ${filterId}.`); logger2.filters.push(toFilter(filter)); } strongRefs.add(logger2); } LoggerImpl.getLogger().contextLocalStorage = config.contextLocalStorage; for (const sink of Object.values(config.sinks)) { if (Symbol.asyncDispose in sink) asyncDisposables.add(sink); if (Symbol.dispose in sink) disposables.add(sink); } for (const filter of Object.values(config.filters ?? {})) { if (filter == null || typeof filter === "string") continue; if (Symbol.asyncDispose in filter) asyncDisposables.add(filter); if (Symbol.dispose in filter) disposables.add(filter); } if (typeof globalThis.EdgeRuntime !== "string" && "process" in globalThis && !("Deno" in globalThis)) { const proc = globalThis.process; const onMethod = proc?.["on"]; if (typeof onMethod === "function") onMethod.call(proc, "exit", dispose); } else if ("Deno" in globalThis) addEventListener("unload", dispose); else addEventListener("pagehide", dispose); const meta = LoggerImpl.getLogger(["logtape", "meta"]); if (!metaConfigured) meta.sinks.push(getConsoleSink()); meta.info("LogTape loggers are configured. Note that LogTape itself uses the meta logger, which has category {metaLoggerCategory}. The meta logger purposes to log internal errors such as sink exceptions. If you are seeing this message, the meta logger is automatically configured. It's recommended to configure the meta logger with a separate sink so that you can easily notice if logging itself fails or is misconfigured. To turn off this message, configure the meta logger with higher log levels than {dismissLevel}. See also <https://logtape.org/manual/categories#meta-logger>.", { metaLoggerCategory: ["logtape", "meta"], dismissLevel: "info" }); } async function reset() { await dispose(); resetInternal(); } function resetInternal() { const rootLogger = LoggerImpl.getLogger([]); rootLogger.resetDescendants(); delete rootLogger.contextLocalStorage; strongRefs.clear(); currentConfig = null; } async function dispose() { disposeSync(); const promises = []; for (const disposable of asyncDisposables) { promises.push(disposable[Symbol.asyncDispose]()); asyncDisposables.delete(disposable); } await Promise.all(promises); } function disposeSync() { for (const disposable of disposables) disposable[Symbol.dispose](); disposables.clear(); } var ConfigError = class extends Error { constructor(message) { super(message); this.name = "ConfigureError"; } }; await configure({ sinks: { console: getConsoleSink() }, loggers: [ { category: "llm-better-view", lowestLevel: "debug", sinks: ["console"] } ] }); const logger = getLogger(["llm-better-view"]); const scriptRel = (function detectScriptRel() { const relList = typeof document !== "undefined" && document.createElement("link").relList; return relList && relList.supports && relList.supports("modulepreload") ? "modulepreload" : "preload"; })(); const assetsURL = function(dep) { return "/" + dep; }; const seen = {}; const __vitePreload = function preload(baseModule, deps, importerUrl) { let promise = Promise.resolve(); if (deps && deps.length > 0) { let allSettled = function(promises$2) { return Promise.all(promises$2.map((p) => Promise.resolve(p).then((value$1) => ({ status: "fulfilled", value: value$1 }), (reason) => ({ status: "rejected", reason })))); }; document.getElementsByTagName("link"); const cspNonceMeta = document.querySelector("meta[property=csp-nonce]"); const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce"); promise = allSettled(deps.map((dep) => { dep = assetsURL(dep); if (dep in seen) return; seen[dep] = true; const isCss = dep.endsWith(".css"); const cssSelector = isCss ? '[rel="stylesheet"]' : ""; if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) return; const link = document.createElement("link"); link.rel = isCss ? "stylesheet" : scriptRel; if (!isCss) link.as = "script"; link.crossOrigin = ""; link.href = dep; if (cspNonce) link.setAttribute("nonce", cspNonce); document.head.appendChild(link); if (isCss) return new Promise((res, rej) => { link.addEventListener("load", res); link.addEventListener("error", () => rej( new Error(`Unable to preload CSS for ${dep}`))); }); })); } function handlePreloadError(err$2) { const e$1 = new Event("vite:preloadError", { cancelable: true }); e$1.payload = err$2; window.dispatchEvent(e$1); if (!e$1.defaultPrevented) throw err$2; } return promise.then((res) => { for (const item of res || []) { if (item.status !== "rejected") continue; handlePreloadError(item.reason); } return baseModule().catch(handlePreloadError); }); }; class OpenaiTransferService { provider = "openai"; canHandle(flow) { const path = window.location.pathname; return flow.response.status_code === 200 && flow.response.contentLength > 0 && (path.includes("/chat/completions") || path.includes("/v1/chat/completions") || path.includes("/v1/completions")); } async getSSEContent(flow) { const { id } = flow; const dataUrl = `${window.location.origin}/flows/${id}/response/content/raw.json`; const response = await fetch(dataUrl); if (!response.ok) { throw new Error(`Failed to fetch response content: ${response.statusText}`); } const sseText = (await response.json())?.text; return sseText; } transfer(sseText) { try { if (!sseText || sseText.trim() === "") { return { success: false, error: "Empty SSE content", rawSSE: sseText, timestamp: Date.now() }; } const response = this.aggregateSSEToResponse(sseText); return { success: true, data: response, rawSSE: sseText, timestamp: Date.now() }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error), rawSSE: sseText, timestamp: Date.now() }; } } parseSSEEvents(sseText) { const events = []; let blocks = sseText.replace(/\r\n/g, "\n").split("\n\n"); if (blocks.length === 1 && blocks[0].length > 100) { const lines = sseText.split("\n"); blocks = []; let currentBlock = ""; for (const line of lines) { if (line.trim() === "") { if (currentBlock) blocks.push(currentBlock); currentBlock = ""; } else { currentBlock += line + "\n"; } } if (currentBlock) blocks.push(currentBlock); } for (const block of blocks) { const lines = block.split("\n"); for (const line of lines) { if (line.startsWith("data: ")) { const dataContent = line.slice(6).trim(); if (dataContent === "[DONE]") continue; try { events.push(JSON.parse(dataContent)); } catch (e) { } } } } return events; } aggregateSSEToResponse(sseText) { const events = this.parseSSEEvents(sseText); if (!events.length) { return this.createEmptyResponse(); } return this.processSSEEvents(events); } processSSEEvents(events) { const finalEvent = events.find((e) => e.usage) || events[events.length - 1]; const metaEvent = events.find((e) => e.id && e.model) || finalEvent; return { id: metaEvent.id || "unknown", object: "chat.completion", created: metaEvent.created || Math.floor(Date.now() / 1e3), model: metaEvent.model || "unknown", system_fingerprint: metaEvent.system_fingerprint ?? null, choices: this.aggregateChoices(events), usage: finalEvent.usage ?? void 0 }; } aggregateChoices(events) { const choiceMap = new Map(); for (const event of events) { if (!event.choices) continue; for (const choice of event.choices) { const index = choice.index; if (!choiceMap.has(index)) { choiceMap.set(index, { index, role: "assistant", content: "", refusal: "", reasoning: "", toolCalls: new Map(), finishReason: null }); } const agg = choiceMap.get(index); const delta = choice.delta; if (delta) { if (delta.role === "assistant") agg.role = delta.role; if (delta.content) agg.content += delta.content; if (delta.reasoning) agg.reasoning += delta.reasoning; if (delta.tool_calls) { this.aggregateToolCalls(agg.toolCalls, delta.tool_calls); } } if (choice.finish_reason) { agg.finishReason = choice.finish_reason; } } } return Array.from(choiceMap.values()).map((agg) => this.convertToChoice(agg)).sort((a, b) => a.index - b.index); } aggregateToolCalls(toolCallMap, toolCallDeltas) { for (const toolCallDelta of toolCallDeltas) { const index = toolCallDelta.index ?? 0; if (!toolCallMap.has(index)) { toolCallMap.set(index, { index, id: toolCallDelta.id || "", type: toolCallDelta.type, functionName: toolCallDelta.function.name || "", functionArguments: toolCallDelta.function.arguments || "" }); } else { const existing = toolCallMap.get(index); if (toolCallDelta.id) existing.id = toolCallDelta.id; if (toolCallDelta.type) existing.type = toolCallDelta.type; if (toolCallDelta.function.name) existing.functionName += toolCallDelta.function.name; if (toolCallDelta.function.arguments) existing.functionArguments += toolCallDelta.function.arguments; } } } convertToChoice(agg) { const toolCalls = Array.from(agg.toolCalls.values()).map((state) => ({ id: state.id, type: "function", function: { name: state.functionName, arguments: state.functionArguments }, index: state.index })).sort((a, b) => (a.index ?? 0) - (b.index ?? 0)); const message = { role: agg.role, content: agg.content || null, reasoning: agg.reasoning || void 0, tool_calls: toolCalls.length > 0 ? toolCalls : void 0 }; return { index: agg.index, message, finish_reason: agg.finishReason ?? "stop" }; } createEmptyResponse() { return { id: "empty", object: "chat.completion", created: Math.floor(Date.now() / 1e3), model: "unknown", choices: [] }; } } const openaiTransferService = new OpenaiTransferService(); class OpenaiResponsesTransferService { provider = "openai-response"; canHandle(flow) { return flow.response.status_code === 200 && flow.response.contentLength > 0; } async getSSEContent(flow) { const { id } = flow; const dataUrl = `${window.location.origin}/flows/${id}/response/content/raw.json`; const response = await fetch(dataUrl); if (!response.ok) { throw new Error(`Failed to fetch response content: ${response.statusText}`); } const sseText = (await response.json())?.text; return sseText; } transfer(sseText) { try { if (!sseText || sseText.trim() === "") { return { success: false, error: "Empty SSE content", rawSSE: sseText, timestamp: Date.now() }; } const response = this.aggregateSSEToResponse(sseText); return { success: true, data: response, rawSSE: sseText, timestamp: Date.now() }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error), rawSSE: sseText, timestamp: Date.now() }; } } aggregateSSEToResponse(sseText) { const state = this.createState(); this.parseSSEText(sseText, state); const output = [...state.outputByIndex.entries()].sort((a, b) => a[0] - b[0]).map((entry) => entry[1]); const response = state.response ?? {}; if (output.length > 0) { response.output = output; } else if (!Array.isArray(response.output)) { response.output = []; } const meta = { event_count: state.eventCount, parse_error_count: state.parseErrorCount, unknown_event_types: [...state.unknownEventTypes].sort() }; return { response, meta }; } createState() { return { response: null, outputByIndex: new Map(), outputIndexByItemId: new Map(), eventCount: 0, parseErrorCount: 0, unknownEventTypes: new Set() }; } ensureArrayAt(arr, index, factory) { while (arr.length <= index) arr.push(void 0); if (arr[index] === void 0) arr[index] = factory(); return arr[index]; } mergeItem(target, source) { for (const [key, value] of Object.entries(source)) { if (key === "content" && Array.isArray(value)) { if (!Array.isArray(target.content)) target.content = []; const targetContent = target.content; value.forEach((item, index) => { if (item !== void 0) targetContent[index] = item; }); continue; } if (key === "summary" && Array.isArray(value)) { if (!Array.isArray(target.summary)) target.summary = []; const targetSummary = target.summary; value.forEach((item, index) => { if (item !== void 0) targetSummary[index] = item; }); continue; } target[key] = value; } } ensureItem(state, outputIndex, itemId) { let item = state.outputByIndex.get(outputIndex); if (!item) { item = { id: itemId || `item_${outputIndex}` }; state.outputByIndex.set(outputIndex, item); } if (itemId && !item.id) item.id = itemId; if (item.id) state.outputIndexByItemId.set(item.id, outputIndex); return item; } findOrCreateItemById(state, itemId, hintedOutputIndex) { let index = hintedOutputIndex ?? state.outputIndexByItemId.get(itemId); if (index === void 0) index = state.outputByIndex.size; return this.ensureItem(state, index, itemId); } applyEvent(state, eventName, payload) { const type = eventName || payload?.type; if (!type) return; state.eventCount += 1; if (type === "response.created" || type === "response.in_progress" || type === "response.completed") { const response = payload.response; if (response && typeof response === "object" && !Array.isArray(response)) { state.response = response; } return; } if (type === "response.output_item.added" || type === "response.output_item.done") { const index = payload.output_index; const incomingItem = payload.item; if (!incomingItem || typeof incomingItem !== "object") return; const item = this.ensureItem(state, index ?? state.outputByIndex.size, incomingItem.id); this.mergeItem(item, incomingItem); return; } if (type === "response.content_part.added" || type === "response.content_part.done") { const itemId = payload.item_id; const contentIndex = payload.content_index; if (!itemId || typeof contentIndex !== "number") return; const item = this.findOrCreateItemById(state, itemId, payload.output_index); if (!Array.isArray(item.content)) item.content = []; if (type === "response.content_part.done") { this.ensureArrayAt(item.content, contentIndex, () => ({})); item.content[contentIndex] = payload.part || {}; return; } const part = this.ensureArrayAt(item.content, contentIndex, () => ({})); this.mergeItem(part, payload.part || {}); return; } if (type === "response.output_text.delta" || type === "response.output_text.done") { const itemId = payload.item_id; const contentIndex = payload.content_index; if (!itemId || typeof contentIndex !== "number") return; const item = this.findOrCreateItemById(state, itemId, payload.output_index); if (!Array.isArray(item.content)) item.content = []; const part = this.ensureArrayAt(item.content, contentIndex, () => ({ type: "output_text", text: "", annotations: [], logprobs: [] })); if (type === "response.output_text.delta") { part.text = `${part.text || ""}${payload.delta || ""}`; return; } part.text = payload.text || ""; if (Array.isArray(payload.logprobs)) part.logprobs = payload.logprobs; return; } if (type === "response.function_call_arguments.delta" || type === "response.function_call_arguments.done") { const itemId = payload.item_id; if (!itemId) return; const item = this.findOrCreateItemById(state, itemId, payload.output_index); if (type === "response.function_call_arguments.delta") { item.arguments = `${item.arguments || ""}${payload.delta || ""}`; return; } item.arguments = payload.arguments || ""; return; } if (type === "response.reasoning_summary_part.added" || type === "response.reasoning_summary_part.done" || type === "response.reasoning_summary_text.delta" || type === "response.reasoning_summary_text.done") { const itemId = payload.item_id; const summaryIndex = payload.summary_index; if (!itemId || typeof summaryIndex !== "number") return; const item = this.findOrCreateItemById(state, itemId, payload.output_index); if (!Array.isArray(item.summary)) item.summary = []; const summaryPart = this.ensureArrayAt(item.summary, summaryIndex, () => ({ type: "summary_text", text: "" })); if (type === "response.reasoning_summary_part.done") { item.summary[summaryIndex] = payload.part || summaryPart; return; } if (type === "response.reasoning_summary_part.added") { this.mergeItem(summaryPart, payload.part || {}); return; } if (type === "response.reasoning_summary_text.delta") { summaryPart.text = `${summaryPart.text || ""}${payload.delta || ""}`; return; } summaryPart.text = payload.text || ""; return; } state.unknownEventTypes.add(type); } parseSSEText(sseText, state) { const lines = sseText.replace(/\r\n/g, "\n").split("\n"); let currentEvent = null; let currentDataLines = []; const flush = () => { if (!currentEvent && currentDataLines.length === 0) return; const dataText = currentDataLines.join("\n").trim(); currentDataLines = []; if (!dataText || dataText === "[DONE]") { currentEvent = null; return; } try { const payload = JSON.parse(dataText); this.applyEvent(state, currentEvent, payload); } catch { state.parseErrorCount += 1; } currentEvent = null; }; for (const rawLine of lines) { const line = rawLine.replace(/\r$/, ""); if (line.trim() === "") { flush(); continue; } if (line.startsWith("event:")) { if (currentEvent || currentDataLines.length > 0) flush(); currentEvent = line.slice("event:".length).trim(); continue; } if (line.startsWith("data:")) { currentDataLines.push(line.slice("data:".length).trimStart()); continue; } } flush(); } } const openaiResponsesTransferService = new OpenaiResponsesTransferService(); class ClaudeTransferService { provider = "claude"; canHandle(flow) { const path = window.location.pathname; return flow.response.status_code === 200 && flow.response.contentLength > 0 && (path.includes("/v1/messages") || path.includes("/v1beta/messages") || path.includes("api.anthropic.com")); } async getSSEContent(flow) { const { id } = flow; const dataUrl = `${window.location.origin}/flows/${id}/response/content/raw.json`; const response = await fetch(dataUrl); if (!response.ok) { throw new Error(`Failed to fetch response content: ${response.statusText}`); } const sseText = (await response.json())?.text; return sseText; } transfer(sseText) { try { if (!sseText || sseText.trim() === "") { return { success: false, error: "Empty SSE content", rawSSE: sseText, timestamp: Date.now() }; } const response = this.aggregateSSEToResponse(sseText); return { success: true, data: response, rawSSE: sseText, timestamp: Date.now() }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error), rawSSE: sseText, timestamp: Date.now() }; } } parseSSEEvents(sseText) { const events = []; const lines = sseText.replace(/\r\n/g, "\n").split("\n"); let currentEvent = ""; let eventLine = null; for (const line of lines) { const trimmedLine = line.trim(); if (trimmedLine.startsWith("event:")) { eventLine = trimmedLine.slice(6).trim(); currentEvent = ""; } else if (trimmedLine.startsWith("data:")) { const dataLine = trimmedLine.slice(5).trim(); currentEvent = dataLine; if (eventLine && currentEvent) { try { const data = JSON.parse(currentEvent); events.push({ event: eventLine, data }); } catch (e) { } eventLine = null; currentEvent = ""; } } } return events; } aggregateSSEToResponse(sseText) { const events = this.parseSSEEvents(sseText); if (!events.length) { return this.createEmptyResponse(); } return this.processSSEEvents(events); } processSSEEvents(events) { const state = { id: "", role: "assistant", model: "", stopReason: null, stopSequence: null, inputTokens: 0, outputTokens: 0, cacheReadInputTokens: 0, contentBlocks: new Map() }; for (const event of events) { this.processEvent(state, event); } const content = Array.from(state.contentBlocks.values()).sort((a, b) => a.index - b.index).map((block) => this.convertToContentBlock(block)); const result = { id: state.id || "unknown", type: "message", role: "assistant", content, model: state.model || "unknown", stop_reason: state.stopReason ?? "end_turn", stop_sequence: state.stopSequence, usage: { input_tokens: state.inputTokens, output_tokens: state.outputTokens, cache_read_input_tokens: state.cacheReadInputTokens } }; return result; } processEvent(state, event) { const data = event.data; switch (data.type) { case "message_start": { const messageStart = data; state.id = messageStart.message.id; state.model = messageStart.message.model; state.role = messageStart.message.role; state.stopReason = messageStart.message.stop_reason; state.stopSequence = messageStart.message.stop_sequence; state.inputTokens = messageStart.message.usage.input_tokens; state.outputTokens = messageStart.message.usage.output_tokens; state.cacheReadInputTokens = messageStart.message.usage.cache_read_input_tokens; break; } case "content_block_start": { const blockStart = data; const index = blockStart.index; if (!state.contentBlocks.has(index)) { state.contentBlocks.set(index, { index, type: blockStart.content_block.type }); const block = state.contentBlocks.get(index); switch (blockStart.content_block.type) { case "tool_use": { const toolUse = blockStart.content_block; block.id = toolUse.id; block.name = toolUse.name; block.input = toolUse.input || {}; break; } } } break; } case "content_block_delta": { const deltaData = data; const index = deltaData.index; if (!state.contentBlocks.has(index)) { state.contentBlocks.set(index, { index, type: "text" }); } const block = state.contentBlocks.get(index); const delta = deltaData.delta; if (delta.type === "text_delta") { const textDelta = delta; block.text = (block.text || "") + textDelta.text; block.type = "text"; } else if (delta.type === "thinking_delta") { const thinkingDelta = delta; block.thinking = (block.thinking || "") + thinkingDelta.thinking; block.type = "thinking"; } else if (delta.type === "input_json_delta") { const inputJsonDelta = delta; block.type = "tool_use"; if (!block.input) { block.input = {}; } if (!block.partialJson) { block.partialJson = ""; } block.partialJson += inputJsonDelta.partial_json; } break; } case "message_delta": { const messageDelta = data; if (messageDelta.delta.stop_reason !== void 0) { state.stopReason = messageDelta.delta.stop_reason; } if (messageDelta.delta.stop_sequence !== void 0) { state.stopSequence = messageDelta.delta.stop_sequence; } state.outputTokens = messageDelta.usage.output_tokens; break; } } } convertToContentBlock(state) { switch (state.type) { case "text": { return { type: "text", text: state.text || "" }; } case "thinking": { return { type: "thinking", thinking: state.thinking || "" }; } case "tool_use": { let parsedInput = state.input || {}; if (state.partialJson) { try { parsedInput = JSON.parse(state.partialJson); } catch (e) { parsedInput = state.input || {}; } } return { type: "tool_use", id: state.id || "", name: state.name || "", input: parsedInput }; } default: { return { type: "text", text: state.text || "" }; } } } createEmptyResponse() { return { id: "empty", type: "message", role: "assistant", content: [], model: "unknown", stop_reason: "end_turn", stop_sequence: null, usage: { input_tokens: 0, output_tokens: 0 } }; } } const claudeTransferService = new ClaudeTransferService(); class GeminiTransferService { provider = "gemini"; canHandle(flow) { const path = window.location.pathname; return flow.response.status_code === 200 && flow.response.contentLength > 0 && (path.includes("/v1beta/models/generateContent") || path.includes("/v1/models/generateContent") || path.includes("/v1beta/models/streamGenerateContent") || path.includes("/v1/models/streamGenerateContent") || path.includes("generativelanguage.googleapis.com")); } async getSSEContent(flow) { const { id } = flow; const dataUrl = `${window.location.origin}/flows/${id}/response/content/raw.json`; const response = await fetch(dataUrl); if (!response.ok) { throw new Error(`Failed to fetch response content: ${response.statusText}`); } const sseText = (await response.json())?.text; return sseText; } transfer(sseText) { try { if (!sseText || sseText.trim() === "") { return { success: false, error: "Empty SSE content", rawSSE: sseText, timestamp: Date.now() }; } const response = this.aggregateSSEToResponse(sseText); return { success: true, data: response, rawSSE: sseText, timestamp: Date.now() }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error), rawSSE: sseText, timestamp: Date.now() }; } } parseSSEEvents(sseText) { const events = []; let blocks = sseText.replace(/\r\n/g, "\n").split("\n\n"); if (blocks.length === 1 && blocks[0].length > 100) { const lines = sseText.split("\n"); blocks = []; let currentBlock = ""; for (const line of lines) { if (line.trim() === "") { if (currentBlock) blocks.push(currentBlock); currentBlock = ""; } else { currentBlock += line + "\n"; } } if (currentBlock) blocks.push(currentBlock); } for (const block of blocks) { const lines = block.split("\n"); for (const line of lines) { if (line.startsWith("data: ")) { const dataContent = line.slice(6).trim(); try { events.push(JSON.parse(dataContent)); } catch (e) { } } } } return events; } aggregateSSEToResponse(sseText) { const events = this.parseSSEEvents(sseText); if (!events.length) { return this.createEmptyResponse(); } return this.processSSEEvents(events); } processSSEEvents(events) { const finalEvent = events.find((e) => e.usageMetadata) || events[events.length - 1]; const metaEvent = events.find((e) => e.modelVersion || e.responseId) || finalEvent; const aggregatedCandidates = this.aggregateCandidates(events); const result = { candidates: aggregatedCandidates, modelVersion: metaEvent.modelVersion, responseId: metaEvent.responseId, usageMetadata: finalEvent.usageMetadata }; const promptFeedbackEvent = events.find((e) => e.promptFeedback); if (promptFeedbackEvent?.promptFeedback) { result.promptFeedback = promptFeedbackEvent.promptFeedback; } return result; } aggregateCandidates(events) { const candidateMap = new Map(); for (const event of events) { if (!event.candidates) continue; for (const candidate of event.candidates) { const index = candidate.index ?? 0; if (!candidateMap.has(index)) { candidateMap.set(index, { index, role: "model", parts: [], finishReason: null }); } const agg = candidateMap.get(index); if (candidate.content?.parts) { this.aggregateParts(agg.parts, candidate.content.parts); } if (candidate.finishReason) { agg.finishReason = candidate.finishReason; } if (candidate.safetyRatings) { agg.safetyRatings = candidate.safetyRatings; } if (candidate.citationMetadata) { agg.citationMetadata = candidate.citationMetadata; } if (candidate.groundingMetadata) { agg.groundingMetadata = candidate.groundingMetadata; } if (candidate.tokenCount !== void 0) { agg.tokenCount = candidate.tokenCount; } if (candidate.avgLogprobs !== void 0) { agg.avgLogprobs = candidate.avgLogprobs; } if (candidate.finishMessage) { agg.finishMessage = candidate.finishMessage; } } } return Array.from(candidateMap.values()).map((agg) => this.convertToCandidate(agg)).sort((a, b) => a.index - b.index); } aggregateParts(existingParts, newParts) { for (const part of newParts) { if (this.isTextPart(part)) { const lastPart = existingParts[existingParts.length - 1]; if (lastPart && this.isTextPart(lastPart)) { lastPart.text += part.text; if (part.thought !== void 0) { lastPart.thought = part.thought; } } else { existingParts.push({ ...part }); } } else { existingParts.push({ ...part }); } } } isTextPart(part) { return "text" in part; } convertToCandidate(agg) { const result = { index: agg.index, content: { parts: agg.parts, role: agg.role }, finishReason: agg.finishReason ?? "STOP" }; if (agg.safetyRatings) { result.safetyRatings = agg.safetyRatings; } if (agg.citationMetadata) { result.citationMetadata = agg.citationMetadata; } if (agg.groundingMetadata) { result.groundingMetadata = agg.groundingMetadata; } if (agg.tokenCount !== void 0) { result.tokenCount = agg.tokenCount; } if (agg.avgLogprobs !== void 0) { result.avgLogprobs = agg.avgLogprobs; } if (agg.finishMessage) { result.finishMessage = agg.finishMessage; } return result; } createEmptyResponse() { return { candidates: [] }; } } const geminiTransferService = new GeminiTransferService(); function adaptGeminiRequestBody(rawBody) { if (!rawBody || typeof rawBody !== "object" || Array.isArray(rawBody)) { return { adaptedBody: rawBody, adapted: false }; } const body = rawBody; const shouldTryAdapt = "request" in body && !("content" in body); if (!shouldTryAdapt) { return { adaptedBody: rawBody, adapted: false }; } const wrappedRequest = body.request; if (!wrappedRequest || typeof wrappedRequest !== "object" || Array.isArray(wrappedRequest)) { return { adaptedBody: rawBody, adapted: false }; } return { adaptedBody: wrappedRequest, adapted: true }; } function adaptGeminiResponseBody(rawBody) { if (!rawBody || typeof rawBody !== "object" || Array.isArray(rawBody)) { return { adaptedBody: rawBody, adapted: false }; } const body = rawBody; const shouldTryAdapt = "response" in body && !("candidates" in body); if (!shouldTryAdapt) { return { adaptedBody: rawBody, adapted: false }; } const wrappedResponse = body.response; if (!wrappedResponse || typeof wrappedResponse !== "object" || Array.isArray(wrappedResponse)) { return { adaptedBody: rawBody, adapted: false }; } return { adaptedBody: wrappedResponse, adapted: true }; } function unifiedTransferData(standard, dataType, dataAsText) { if (dataType === "sse") { const service = getTransferService(standard); return service.transfer(dataAsText); } try { const parsedData = JSON.parse(dataAsText); let normalizedData = parsedData; if (standard === "gemini" && dataType === "request") { const { adaptedBody, adapted } = adaptGeminiRequestBody(parsedData); normalizedData = adaptedBody; if (adapted) { logger.info("Detected Gemini /v1internal wrapper. Request body adapted."); } } if (standard === "gemini" && dataType === "response") { const { adaptedBody, adapted } = adaptGeminiResponseBody(parsedData); normalizedData = adaptedBody; if (adapted) { logger.info("Detected Gemini internal wrapper. Response body adapted."); } } return { success: true, data: normalizedData, timestamp: Date.now() }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error), rawSSE: dataAsText, timestamp: Date.now() }; } } function getTransferService(standard) { switch (standard) { case "openai": return openaiTransferService; case "openai-response": return openaiResponsesTransferService; case "claude": return claudeTransferService; case "gemini": return geminiTransferService; default: throw new Error(`Unsupported API standard: ${standard}`); } } const _hoisted_1$4 = ["value"]; const _hoisted_2$3 = { key: 0, value: "" }; const _hoisted_3$3 = ["value"]; const _sfc_main$5 = defineComponent({ __name: "ApiStandardSelect", props: { modelValue: {}, allowEmpty: { type: Boolean }, emptyLabel: {} }, emits: ["update:modelValue"], setup(__props, { emit: __emit }) { const props = __props; const emit = __emit; const standardOptions = [ { value: "openai", label: "OpenAI" }, { value: "openai-response", label: "OpenAI Response" }, { value: "claude", label: "Claude" }, { value: "gemini", label: "Gemini" } ]; const handleChange = (event) => { const target = event.target; const value = target.value; emit("update:modelValue", value); }; return (_ctx, _cache) => { return openBlock(), createElementBlock("select", { value: props.modelValue, onChange: handleChange, class: "standard-select" }, [ props.allowEmpty ? (openBlock(), createElementBlock("option", _hoisted_2$3, toDisplayString(props.emptyLabel || "----Select----"), 1)) : createCommentVNode("", true), (openBlock(), createElementBlock(Fragment, null, renderList(standardOptions, (opt) => { return createElementVNode("option", { key: opt.value, value: opt.value }, toDisplayString(opt.label), 9, _hoisted_3$3); }), 64)) ], 40, _hoisted_1$4); }; } }); const _export_sfc = exports("_", (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }); const ApiStandardSelect = _export_sfc(_sfc_main$5, [["__scopeId", "data-v-a122a048"]]); const _hoisted_1$3 = { class: "view-dashboard-proxy" }; const _hoisted_2$2 = { class: "standard-selector" }; const _hoisted_3$2 = { key: 0, class: "error-state" }; const _hoisted_4$2 = { class: "error-message" }; const _hoisted_5 = { key: 1, class: "error-state" }; const _hoisted_6 = { class: "error-message" }; const _hoisted_7 = { key: 2, class: "empty-state" }; const _sfc_main$4 = defineComponent({ __name: "ViewDashboardProxy", props: { standard: {}, dataType: {}, data: {}, path: {} }, emits: ["update:standard"], setup(__props, { emit: __emit }) { const props = __props; const emit = __emit; const manualStandard = ref(null); const effectiveStandard = computed(() => { return manualStandard.value ?? props.standard; }); const handleStandardChange = (newStandard) => { if (!newStandard) return; manualStandard.value = newStandard; emit("update:standard", newStandard); }; const componentMap = { openai: { request: defineAsyncComponent(() => __vitePreload(() => module.import('./OpenaiRequestView-D-ZioDy1-B9LDHfkP.js'), void 0 )), response: defineAsyncComponent(() => __vitePreload(() => module.import('./OpenaiResponseView-C5XZPN_T-ZKX67r0N.js'), void 0 )), sse: defineAsyncComponent(() => __vitePreload(() => module.import('./OpenaiResponseView-C5XZPN_T-ZKX67r0N.js'), void 0 )) }, "openai-response": { request: defineAsyncComponent(() => __vitePreload(() => module.import('./OpenaiResponsesRequestView-YlS72uxt-BamTWWMz.js'), void 0 )), response: defineAsyncComponent(() => __vitePreload(() => module.import('./OpenaiResponsesResponseView-CLoPvDKP-CDgX4KAr.js'), void 0 )), sse: defineAsyncComponent(() => __vitePreload(() => module.import('./OpenaiResponsesResponseView-CLoPvDKP-CDgX4KAr.js'), void 0 )) }, claude: { request: defineAsyncComponent(() => __vitePreload(() => module.import('./ClaudeRequestView-Yzc3Jd7c-z7M9c2Zp.js'), void 0 )), response: defineAsyncComponent(() => __vitePreload(() => module.import('./ClaudeResponseView-Bpb2GKVr-kaBtCnVu.js'), void 0 )), sse: defineAsyncComponent(() => __vitePreload(() => module.import('./ClaudeResponseView-Bpb2GKVr-kaBtCnVu.js'), void 0 )) }, gemini: { request: defineAsyncComponent(() => __vitePreload(() => module.import('./GeminiRequestView-BE0LEHPc-COWphn4v.js'), void 0 )), response: defineAsyncComponent(() => __vitePreload(() => module.import('./GeminiResponseView-Ca9JEayb-UEo7uEpb.js'), void 0 )), sse: defineAsyncComponent(() => __vitePreload(() => module.import('./GeminiResponseView-Ca9JEayb-UEo7uEpb.js'), void 0 )) } }; const componentError = ref(null); const hasComponentError = computed(() => componentError.value !== null); onErrorCaptured((err) => { console.error("子组件错误:", err); componentError.value = err; return false; }); const transferResult = computed(() => { try { return unifiedTransferData(effectiveStandard.value, props.dataType, props.data); } catch (err) { return { success: false, error: err instanceof Error ? err.message : "Data Conversion Failed", timestamp: Date.now() }; } }); const currentComponent = computed(() => { return componentMap[effectiveStandard.value]?.[props.dataType]; }); const componentData = computed(() => { return transferResult.value.success ? transferResult.value.data : null; }); const errorMessage = computed(() => { if (hasComponentError.value) { return `Component Render Error: ${componentError.value?.message}`; } return transferResult.value.error || null; }); const retry = () => { componentError.value = null; }; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$3, [ createElementVNode("div", _hoisted_2$2, [ createVNode(ApiStandardSelect, { "model-value": effectiveStandard.value, "onUpdate:modelValue": handleStandardChange }, null, 8, ["model-value"]) ]), hasComponentError.value ? (openBlock(), createElementBlock("div", _hoisted_3$2, [ _cache[0] || (_cache[0] = createElementVNode("div", { class: "error-icon" }, "💥", -1)), _cache[1] || (_cache[1] = createElementVNode("div", { class: "error-title" }, "Component Load Failed", -1)), createElementVNode("div", _hoisted_4$2, toDisplayString(componentError.value?.message), 1), createElementVNode("button", { onClick: retry, class: "retry-btn" }, "Retry") ])) : errorMessage.value ? (openBlock(), createElementBlock("div", _hoisted_5, [ _cache[2] || (_cache[2] = createElementVNode("div", { class: "error-icon" }, "⚠️", -1)), _cache[3] || (_cache[3] = createElementVNode("div", { class: "error-title" }, "Data Parse Failed", -1)), createElementVNode("div", _hoisted_6, toDisplayString(errorMessage.value), 1) ])) : !componentData.value ? (openBlock(), createElementBlock("div", _hoisted_7, [..._cache[4] || (_cache[4] = [ createElementVNode("div", { class: "empty-icon" }, "📭", -1), createElementVNode("div", { class: "empty-title" }, "No Data", -1) ])])) : (openBlock(), createBlock(Suspense, { key: 3 }, { fallback: withCtx(() => [..._cache[5] || (_cache[5] = [ createElementVNode("div", { class: "loading-state" }, "⏳ Loading...", -1) ])]), default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(currentComponent.value), { data: componentData.value, path: __props.path }, null, 8, ["data", "path"])) ]), _: 1 })) ]); }; } }); const ViewDashboardProxy = _export_sfc(_sfc_main$4, [["__scopeId", "data-v-e9d7881c"]]); const useCurrentFlowStore = defineStore("current-store", () => { const standard = ref(); const dataType = ref(); const dataAsText = ref(); const flow = ref(); const flowId = computed(() => flow.value?.id); const hasValidData = computed(() => { return standard.value !== void 0 && dataAsText.value !== void 0; }); const currentTypeInfo = computed(() => { return { standard: standard.value, dataType: dataType.value }; }); function setLLMData(newStandard, newDataType, newDataAsText, newFlow) { standard.value = newStandard; dataType.value = newDataType; dataAsText.value = newDataAsText; flow.value = newFlow; } function setUnknownLLMData(newDataType, newFlow, newDataAsText) { standard.value = void 0; dataType.value = newDataType; dataAsText.value = newDataAsText; flow.value = newFlow; } function reset2() { standard.value = void 0; dataType.value = void 0; dataAsText.value = void 0; flow.value = void 0; } function updateDataType(newDataType) { dataType.value = newDataType; } function updateStandard(newStandard) { standard.value = newStandard; } return { standard, dataType, dataAsText, flow, flowId, hasValidData, currentTypeInfo, setLLMData, setUnknownLLMData, reset: reset2, updateDataType, updateStandard }; }); const icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFMAAAAYCAYAAACGLcGvAAAACXBIWXMAAArAAAAKswDqhR9lAAAAAXNSR0IB2cksfwAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABGdBTUEAALGPC/xhBQAAEABJREFUeJzdWXlUlFeWr6J2al+ojSqqitr3fS9qYUdARARREAVEBZF9laXYNzG4iwFxA9SYkMU2nZwkk+6ZJD1Jd5KetGeSmO7OpHO0T5JJps1iNBq/OQ8sLJCY9PyR0z3vnHuqvnd/9y333Xfffe/CYA8pRCIJJhBJDBa7p97q8D1uc8VDFocfsjoDkMHigQxWD6S3uCGDNQ4y3iPwH/AWvy0L3wsUt4hdkA+TW/a9hGzeFetNNu88GZe3c68t0N/9Md2XMYbTsrYW27v3H7Rlsfv+PS09K0OhVJEepq8VC5VKg+kM1gyz3fdvZof/plJr+YsgVn6RJ5BM8YXSKb5QciJGJD0eI1xGItk9Cq8LJ9kyWqgTLP5fjpEuwywlwZL6Bez8d/h4hNIVsGF9CqWLvB+gSZlS/zuDxXPH5U3+QBArL0JjMD+uxIiICJjeYOLbXIFZs933vSBWfgFPIHngcDj6716R/2cFi4tURfNFB00273d6s+tZCo0R/VABg9EsjAus+pNKZ/2ESKIk/2wj/ScquEi8SaW1XDHb/X+k0ZmSFUEkMpVgsnl/K1eb3kWh0bxwHhwOR0RERGB/jsGCXfBz9fV/LXB4BEam1L9usvveJ5FpjCVMOp0Bszp941qj4zoajRGG6glEspfLFx2UyHUfSOS6a7FSzR+iY8RTNDqrBIuL1MAjIn6C83h4QSJRDAKR7Geyea2CWMWzUqXhI5nSeE0s07zCZEXXoNEYwUpyRBIlnhMt6GNx+ANsbkw/lc4sXI7BRRKMLDavLYSh0ZmbHsDg8DoWN6YbYO7hunCReG2Ij8ZghWxuTAebG7PIx2Bx0ggEgqTW265pDLZZJBJ5v0GpXO2wOuMhMpWeC76ptKgNIon6JXCSOTyJN/M2Fj9fvqv+SN7G4pd8CemfGa1eSKGxQhK57mO+UDbHYHJ2ReKJ1ggEgvhjykOjMTwSmZrG5goGY6Xq38jUpq/VBgdkcQagpLTsD7aUVpwtr6w/npa57n2z3QdpDPaveDHiIxgsbnFLAf9lsLhveQJpdxJS1lyPC6TdAPIkCi0zhEGh0Byt0fGFy5sMJaauue6NX/UNmCOVFrUxhEEgEGSVzvoXZ1wyBNpJTM3+0uVLgdR629WICAQegUCQlBrzFYcnCUpJz/kSYNy+1Lsag/0aHA5HEYjkeIsjAHF4woRQgzCNwf6YRK59FbZgjX4QGvgSMz7Nzi28dOrMOd3UydlA//BY9bHjp3PPzF5IPDx+PLO1vaepYPO2uUBy5scgjFDrHZBUafxvoVjxPD2KvT1cgSgUmhsdEwss/LJSa72tM7nAIt3KzN7w5o6ddYd6B0ZLxydOJp44NescO3A0Z2jP/oLZ83PK4dH9+b74Ve+7fSmQXGX4PRwOnzcBJiu6AYRpA8Njm3v7h3WjY4eLgKLoDHZ5qE8yhZ4NwqFgz2BDb/+w/uCRR9Pd/tSbTDavb9G6ydRUMJaO7oHW/qG9tq7eQXNn92ATkAMGJYiVn7M4/He7e4dqO7p6rfsOHjXXNOw+rNbbIAwGKwZtiCSq53RG57NIJAoGI1FoXIvDf51CY2wATAaTU2t1Bu4cOTaVEuwZ3DB1csap1VtP4yKJ2WxuTJXF5h7N27jlVFtn3+4jx6bSTk2ft49PnkzoGxytLN2260wgKfMjoFx2tKAHrByBREmQKHSv2lwJ0Jp1Ba/UNrYNP7L/aMHpmfOBM7MX4g8cnthQVdfSn74694wzLvGqzuiEFGoLlF9YMjN99nH50J79G+sa28cUGvNtYG1gjDEi2eNpmbl/raqpNzGZTFhbZ28jUAowhJCi2FzBUFwg7VZbR3cimUyGgbkA66XSmcUhDIvDD7p9Kbd7+4fT0eiFgKW1LehJSF59Va23faE22KGG5o4ja7LXcgEve+06Tll5zS+kSv21iIgIHGz+rKGtMdt9X1GojBgYXyhZbbC4ryNRKDZg0qPY1XZP4nfHT85Ye/r35A2PHigjkWllYdtUKpaqX6MzWLVGa9zNQFLmp/mFpc83t3UFj06cTHziqV8IUtPXvqY3uyHgDkJWW1nd2P3MpeeZw6P7y7ZX1OxJSsk4IpVrusRS9UUuT3SayxPuMdniIDqDtZUvlD6RkJJ1deLEtH907HD67s6+doXadBOJQrHm3ZJS/+Hm0oqXM1ev4VqtNnJVbcuMXG36GolERYXGKRQrf52dW/he2fZypSg2Fru7o3dYrbdDwEeGYV7IWlf456qaen2oLjcvn1e6fdczMrUZ2lS848W6huZF/7lzV40hMzv/I0Gs/JehOiQSydCb3f/DF0hyYFKFDgz0nRCTxmBtBX7g0Pjx9ME9+wsOHJksodFZi8qUKbTPUqj0ZJFYMWGyee8KRPI5iUL3vlJrhfRm9zdHHz3hOX5iWjE4MpZ14PCjafsOjq8aGNq7+vG5i8zt5dVjJDKtCR6BkMNgsPnDS6rQPEMiUz06k+OaVKF7BdRxooXjSauy/2vy5Ixr5JFDq6tqWx5RqM03gI8DB4JKb7vb2NJ5QKPV4dflrhflbSx5SyRRvRUaI/DdMpXx8/LK+rnEpGRGID6RWVZec0mq0H8CfOE8JgKBl6mMn26vqLuYkZnFlMsVMQKhiCkUijBtwf5gICnzg76BkRQ8gYD0+eMNWBwOGezuz3L7Ur5nsqPbwt2YXGV8S6W19MKUWss+sUz9XIgBDhK9xQOc9pXyXfVjEydmMjjRgh7A40YLWnkxsYNkCjXO5o6HeALxoXA5MOHCLdufODI+AevpG4Bdeu4FzNyTF+FtHUHY5NQZu1JtOBU+iCgmp0QglOxjsrhl4IpKIlNTQX2sVPNOSnrOm6dnHtPn5m95xp+Y/oVcZZhfcDKVvgZc84K9gzvoDEZEVU19XHzS6i85POHiWID1aQwOqL2rv1cslmCKS8o0q9du/DBGKLsUwmCxOCWw1N2dfYNSqSyyaEuJsLRs+3wk09M3HNh3cDyfx+MTctblRe+qrlNERUWhevpHGsCOI5IoieHzEMvUl1Ray9GQMn8ZzqQxWKUylfF6ICnjyvnHn9ZuKCg5SGOwWyVyzVNIJAqv1lvf0RkdnyCQSFq4XDQ/9pjNFX/z9Mxj6rbOvprElNXvZGTl/mpi6rS5pa0rGIkn5YawCAQCo9Ka/hVPIOq1BvuHcpXhDdiCP5zRGJxQsGdo2/6D46t1Jtddudr4n5F4gmnBagVDvoT0W+3BniQymQxv7+zdDE59Foc/H7JgsDgZi8PvBAdHT/9IAYVCiWjZ3bkqLpD2HU8gPo7BYCUAA0Ixs913t7tveDORSEQ0Nu82j4zu84AwcmNhkdIfSGCpNVrW3NOX/D5/PNNkNpPqmzsmVVrrLRQaveT2A4xRrbMegcmU+k6F2vQ2bFkB2x2sQlVtc8vZ83OqrJyC3xOIlBw2h78THCY0OrNguUysVP2Ky5t8debcE9rkVdn/odLZILnKBLW297QPjx7YQaUza0NYNpe/UySW76UzmNnAKulR7BIuTzgEwqTK6sY9M2cvKPI2bL6oNTjugMmH5EQS5ctZOQVXikvKFAKBEN3UGuxQaCwQULrO7Ia0JhekMTqh+OTMj5ta2p2MqChkR1d/kcZg/05rdN4FB5XW6ISAVfoT06+1tgXjCAQCvKmlY3tTa7BXufCYgWCzOZFdfUNlnd2DLQKhEJ+XvzFmU/GO1yQK3XtA4eHzVmhMl1VacztMIJKtNVjcfwPBczgAF4k3gk43l5af3PPIQd+p6fPWOF/SOZnK+C3YQiDABtZAptKz0RisiBMtHAIW1dk9sLN/aG8pCK/Y3JhOsUzzhi9+1Z+nZy9YcvM3n0IgUFo4HA6Tq/QvoDEYnkypfwMsmlxt+ptSa4NKyiqPzZy9IAE+N3117h8UGtOHoZAIgUAQ5WrT59sqap7yBxIYZouVfeDwRG5Dc0dD0+5gXXNbd2NbZ9+Owi3bLqzN2/Sb9fkFQrFEGnV4fHJVXWNbbWNLZ31ja2d9c1vXzrLy6kM564te3VRULBUIhej6pvax7HWFr5VtKxfh8XhwqiekZeZebmnrKicQCLDG5t325FXZn/EE4ulwPYGwz2j1gFg4HUahMWKsrvivyRT62hUs7SVnXOLtDYUlc63t3RVnZh+ztLb3tBUV7ziXmrHuXZc3+SaIycDhI1WZoI1FW89NnZpxueISP5Ep9ZdhC3GrT6W3QQVFZWfPzF7w6wy2CRqDPSyRa3/H5Qnb3d7kqxlZea9u3V51amB4rHj2/Jy2eGvFYM76ol+D5z4Wm1cfGk8knmgBC9ze1d+lVmtwKBQKxeVGE3g8PprPj8GyORxs3voN1Mqa5kd3VNadcHviCGANONxoEo/HxwBiczgYr88f2R7sbymvrD/pcnmI8QlJ1OKyyqf1ZveN3oHRxoHhveW5+Zt/5fQmf97U2u4FyuwdGMkDsS09ir0jXEdUelSRxRn4gkyhMWEIBBKmMzkvimXqF5crE4lCMWMlqmc1Bvv8215u/uYXG1s6g6NjhzaNT55cNXliOhU46pa27pbK6saO6bMXdNnrCl5Q62x3IvEEc6gdTrRgECiho2ug5tjkqaSdVQ17evpHKo4cm1o/eWI66eixqYzBkbGttQ27h1PS174HtqJaZ/uSyxP2h28pEEib7D4o2DtUHuzu91bXNfoqq2o9O3fVuqtrG3y19c2JfQMj/tSMnNfrmtr7O7v6LLtq6uMqq+vcO6tq3RWVNe5d1XW+YHefY31ByZO7apqG2zt7TL0DI0lJadnz/YIdBXwwGG9KRs7lkb0HArvbg9b6prZhvdkFReKJtnAdyZT6N7VGxwy4/NybrNAL/Bbx3mm6vGCwODmIAyUK3Z8UGvMd4Jesrvi7iSlZH68vKHm5oqrhUO/AnootpRWnwZZlsqLrljUBl8i1r4FbT1tnX1NHV39DWXn1yex1ha+D6ykYPPCVCo35plShe5sexSoOjxlDBU8gOgHW4Un8zuNP/cbjT73h8ad+6/alALrh9qV844xL+tbs8EM2V/wdtzcZYL5dwCzgPH6AS75hts9jvnf7koHMrflrYbSgFxdJMAMSxspP2z2JkMubdCMukPaN3Z0AqbSWd8MfYWh0ZonVGfiezeWb7lsgEgnTGhzTGoP9rytNYlEjcDgSPDwQSZQkBpNTzROIT8fKNG8DfwccOlhNvkByeMUFwWCFwFGHnL9cbfpUJFG9wuWLjtIZrG14AsmFQqHZP9R3qICwJIoVXQNuaitRFJMLeDsYTE7VD2Hu0c77GG4NlRaVH94PuOHQo9jFUSxu7TwxuZWhKyTsXmhlsLhvqHSWPeAdeEkhU2h0i8P/rlxl+C0CgaT82KTCCwKJpOJweDUWG6l4GA4EyrhIgh6czhERCMLf08c/UsFgcQqN3vax2e79FyKRvPLLGY3BElsc/itqnfWPkXiC9Wcf5T9BARZssHi+NNt9L5MpNOpDwSd+umoAAAD7SURBVBQqg6s3uy+aHf7bfIH4KBYXqf7ZRvoPWsBOJVNoWRK59mWbK/621mjfTyJTcD9JGI3BwgSx8gKTzfuO2eG7qVAbL8eIZGeEsfLjgnmSLaHwpJfgHkYYwoUnp0C9eIG32NYS/n15wYp9rSCzTF4Yzg/JLfsfnnx7ALf0eyJWqnpSZ3J+bnPFf2WwuJ+O5gvdiPDH4J9asLhIFJsb4zVaXMNuX/Jn8ync+VSo937KNDy9upiu9d6jsHTvYjrVtyg/n0q1xj2Y4l3Sdniq98F2H0wBex/ELdYvyIC3BxB1LE0ve5f8GhZTwD5Io7NUU+lRfBQK9VCF/S8aSlxRLm/xHAAAAABJRU5ErkJggg=="; const _hoisted_1$2 = { class: "summary" }; const _hoisted_2$1 = { class: "title" }; const _hoisted_3$1 = ["src"]; const _hoisted_4$1 = { class: "content" }; const _sfc_main$3 = defineComponent({ __name: "Dashboard", setup(__props) { const currentFlowStore = useCurrentFlowStore(); const { standard, dataType, dataAsText, flow } = storeToRefs(currentFlowStore); const subjectColor = computed(() => { switch (standard.value) { case "openai": return "#08080866"; case "openai-response": return "#21212166"; case "claude": return "#d97757"; case "gemini": return "#3185fe"; default: return "#e2e8f0"; } }); const canRenderDashboard = computed(() => Boolean(standard.value && dataType.value)); const dashboardData = computed(() => dataAsText.value ?? ""); return (_ctx, _cache) => { return openBlock(), createElementBlock("details", { "data-panel-root": "mitmproxy-llm-better-view-dashboard", class: "llm-better-view", open: "", style: normalizeStyle(`--llm-subject-color: ${subjectColor.value}`) }, [ createElementVNode("summary", _hoisted_1$2, [ _cache[2] || (_cache[2] = createElementVNode("span", { class: "arrow" }, "▸", -1)), _cache[3] || (_cache[3] = createElementVNode("div", { style: { "flex": "1" } }, null, -1)), createElementVNode("div", _hoisted_2$1, [ createElementVNode("img", { src: unref(icon), height: "24px" }, null, 8, _hoisted_3$1), _cache[0] || (_cache[0] = createElementVNode("span", { style: { "width": "4px", "height": "4px", "display": "inline-block" } }, null, -1)), _cache[1] || (_cache[1] = createElementVNode("span", { class: "text" }, "LLM Better View", -1)) ]), _cache[4] || (_cache[4] = createElementVNode("div", { style: { "flex": "1" } }, null, -1)), _cache[5] || (_cache[5] = createElementVNode("a", { href: "https://github.com/ctxinf/mitmproxy-llm-better-view", target: "_blank", rel: "noopener noreferrer", class: "github-link", "aria-label": "View mitmproxy-llm-better-view on GitHub" }, [ createElementVNode("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 16 16", fill: "currentColor" }, [ createElementVNode("path", { "fill-rule": "evenodd", d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0116 8c0-4.42-3.58-8-8-8z" }) ]) ], -1)) ]), createElementVNode("div", _hoisted_4$1, [ canRenderDashboard.value ? (openBlock(), createBlock(ViewDashboardProxy, { key: 0, standard: unref(standard), "data-type": unref(dataType), data: dashboardData.value, path: unref(flow)?.request.path }, null, 8, ["standard", "data-type", "data", "path"])) : createCommentVNode("", true) ]) ], 4); }; } }); const Dashboard = _export_sfc(_sfc_main$3, [["__scopeId", "data-v-901eaafb"]]); const CONTAINER_ID = "mitmproxy-llm-better-view-dash-container"; let mountedApp = null; function initPageInjector(options) { const component = options?.component || Dashboard; const props = options?.props || {}; ensureContainer(); mountVueApp(component, props); } function ensureContainer() { if (document.getElementById(CONTAINER_ID)) return; const contentview = document.querySelector(".contentview"); if (!contentview) { logger.warn("no `.contentview` element found"); return; } const container = document.createElement("div"); container.id = CONTAINER_ID; const firstChild = contentview.childNodes[0]; contentview.insertBefore(container, firstChild); } function mountVueApp(component, props) { const container = document.getElementById(CONTAINER_ID); if (!container) return; unmountCurrentApp(); container.replaceChildren(); const app2 = createApp(component, props); app2.mount(container); mountedApp = app2; } function unmountCurrentApp() { if (!mountedApp) return; mountedApp.unmount(); mountedApp = null; } function destroyPageInjector() { unmountCurrentApp(); const container = document.getElementById(CONTAINER_ID); if (!container) return; container.replaceChildren(); container.remove(); } var _unsafeWindow = (() => typeof unsafeWindow != "undefined" ? unsafeWindow : void 0)(); const originalFetch = (typeof _unsafeWindow !== "undefined" ? _unsafeWindow : window).fetch; const flowApiBaseUrl = location.origin; let activeListenerDispose = null; function initRouteListener(hook) { activeListenerDispose?.(); const handleFlowAction = async ({ uuid, action }) => { const flow = await getFlow(uuid); if (!flow) { return; } const dataUrl = `${flowApiBaseUrl}/flows/${uuid}/${action}/content/Auto.json`; const data = await getFlowData(dataUrl); hook(action, data, flow); }; const currentFlow = extractFlowInfo(location.href); if (currentFlow) { handleFlowAction(currentFlow); } const stopListening = listenUrlChange(handleFlowAction); const dispose2 = () => { stopListening(); if (activeListenerDispose === dispose2) { activeListenerDispose = null; } }; activeListenerDispose = dispose2; return dispose2; } function extractFlowInfo(url) { const regex = /#\/flows\/([0-9a-fA-F\-]{36})\/(request|response)/; const match = url.match(regex); if (match) { const [, uuid, action] = match; return { uuid, action }; } return null; } function listenUrlChange(hook) { let currentUrl = location.href; function onUrlChange() { if (location.href !== currentUrl) { const flow = extractFlowInfo(location.href); if (flow) { hook?.(flow); } currentUrl = location.href; } } const originalPushState = history.pushState; history.pushState = function(...args) { originalPushState.apply(this, args); onUrlChange(); }; const originalReplaceState = history.replaceState; history.replaceState = function(...args) { originalReplaceState.apply(this, args); onUrlChange(); }; window.addEventListener("popstate", onUrlChange); return () => { history.pushState = originalPushState; history.replaceState = originalReplaceState; window.removeEventListener("popstate", onUrlChange); }; } function getFlow(uuid) { return originalFetch(`${flowApiBaseUrl}/flows`).then((res) => { if (!res.ok) { throw new Error(`Failed to fetch flow with uuid ${uuid}`); } return res.json(); }).then((flowArray) => { return flowArray.find((flow) => flow.id === uuid) || null; }); } function getFlowData(dataUrl) { return originalFetch(new Request(dataUrl)).then((resp) => resp.json()); } function isOpenaiResponseRequest(data) { if (!data || typeof data !== "object" || Array.isArray(data)) { return false; } const body = data; const hasModel = typeof body.model === "string"; const hasResponseSignal = "input" in body || "instructions" in body || "reasoning" in body || "text" in body; const hasChatMessages = Array.isArray(body.messages); return hasModel && hasResponseSignal && !hasChatMessages; } function isOpenaiResponsesPath(path) { if (!path) { return false; } const normalizedPath = path.toLowerCase(); return normalizedPath.includes("/response"); } function isOpenaiResponse(data) { if (!data || typeof data !== "object" || Array.isArray(data)) return false; const body = data; const hasId = typeof body.id === "string"; const hasSignal = typeof body.object === "string" || typeof body.model === "string"; return hasId && hasSignal; } function isOpenaiResponseSSEWrapper(data) { if (!data || typeof data !== "object" || Array.isArray(data)) return false; const body = data; if (!("response" in body)) return false; return isOpenaiResponse(body.response); } function isJson(flow) { return flow.response.headers.some((h) => { const [key, value] = h; return key.toLowerCase() === "content-type" && value.includes("application/json"); }); } function isSSE(flow) { return flow.response.headers.some((h) => { const [key, value] = h; return key.toLowerCase() === "content-type" && value.includes("text/event-stream"); }); } function parseDataText(text) { try { return typeof text === "string" ? JSON.parse(text) : text; } catch { return null; } } function isOpenAIChatRequestPath(flow) { const path = flow.request.path; return path.endsWith("/completions") || path.includes("/chat/completions"); } function isOpenAIResponsePath(flow) { const path = flow.request.path; return path.endsWith("/completions") || path.includes("/chat/completions"); } function isOpenAIBody(parsedObj) { return parsedObj && typeof parsedObj === "object" && "model" in parsedObj; } function isOpenAIReq(action, data, flow) { if (action !== "request" || !isOpenAIChatRequestPath(flow)) return false; const body = parseDataText(data); const isChatLikeRequest = Array.isArray(body?.messages) || typeof body?.prompt !== "undefined"; return isOpenAIBody(body) && isChatLikeRequest; } function isOpenAIResponsesReq(action, data, flow) { if (action !== "request" || !isOpenaiResponsesPath(flow.request.path)) return false; const body = parseDataText(data); return isOpenaiResponseRequest(body); } function isOpenAIResponsesRes(action, data, flow) { if (action !== "response" || !isOpenaiResponsesPath(flow.request.path)) return false; if (isSSE(flow)) return true; if (isJson(flow)) { const body = parseDataText(data); if (!body) return false; if (isOpenaiResponse(body)) return true; if (body?.response && isOpenaiResponse(body.response)) return true; } return false; } function isOpenAIRes(action, data, flow) { if (action !== "response" || !isOpenAIResponsePath(flow)) return false; if (isSSE(flow)) return true; if (isJson(flow)) { const body = parseDataText(data); return isOpenAIBody(body) && Array.isArray(body.choices); } return false; } function isAnthropicPath(flow) { const path = flow.request.path; return path.includes("/v1/messages") || path.includes("/v1/complete"); } function isAnthropicReq(action, data, flow) { if (action !== "request" || !isAnthropicPath(flow)) return false; const body = parseDataText(data); return body && body.model && (body.messages || body.prompt); } function isAnthropicRes(action, data, flow) { if (action !== "response" || !isAnthropicPath(flow)) return false; if (isSSE(flow)) return true; if (isJson(flow)) { const body = parseDataText(data); return body && (body.type === "message" || body.completion); } return false; } function isGeminiPath(flow) { const path = flow.request.path.toLowerCase(); return path.includes(":generatecontent") || path.includes(":streamgeneratecontent") || path.includes("gemini"); } function isGeminiReq(action, data, flow) { if (action !== "request") return false; const body = parseDataText(data); if (!body) return false; const hasGeminiStructure = Array.isArray(body.contents) && (body.contents.length === 0 || body.contents.some((c) => c && (c.parts || c.role))); const wrappedRequest = body?.request; const hasWrappedGeminiStructure = wrappedRequest && typeof wrappedRequest === "object" && !Array.isArray(wrappedRequest) && !("content" in body) && Array.isArray(wrappedRequest.contents); return isGeminiPath(flow) || hasGeminiStructure || hasWrappedGeminiStructure; } function isGeminiRes(action, data, flow) { if (action !== "response") return false; if (isSSE(flow) && isGeminiPath(flow)) return true; const body = parseDataText(data); if (!body) return false; const hasCandidates = (b) => { if (Array.isArray(b)) return b.some((item) => item && item.candidates); return b && b.candidates; }; const wrappedResponse = body?.response; const hasWrappedCandidates = wrappedResponse && typeof wrappedResponse === "object" && !Array.isArray(wrappedResponse) && hasCandidates(wrappedResponse); return isGeminiPath(flow) || hasCandidates(body) || hasWrappedCandidates; } const _hoisted_1$1 = { class: "unknown-standard-selector" }; const _hoisted_2 = { class: "selector-row" }; const _hoisted_3 = ["aria-expanded"]; const _hoisted_4 = ["src"]; const _sfc_main$2 = defineComponent({ __name: "UnknownStandardSelector", emits: ["select-standard"], setup(__props, { emit: __emit }) { const emit = __emit; const showSelector = ref(false); const selectedStandard = ref(""); const handleStandardChange = (standard) => { selectedStandard.value = standard; if (!standard) return; emit("select-standard", standard); }; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", _hoisted_1$1, [ createElementVNode("div", _hoisted_2, [ createElementVNode("button", { type: "button", class: normalizeClass(["selector-trigger", { "selector-trigger-open": showSelector.value }]), "aria-label": "Manual standard selector", title: "Manual force select standard", "aria-expanded": showSelector.value, onClick: _cache[0] || (_cache[0] = ($event) => showSelector.value = !showSelector.value) }, [ createElementVNode("img", { src: unref(icon), height: "24px", class: "trigger-icon", alt: "LLM Better View" }, null, 8, _hoisted_4) ], 10, _hoisted_3), createElementVNode("div", { class: normalizeClass(["selector-panel", { "selector-panel-open": showSelector.value }]) }, [ showSelector.value ? (openBlock(), createBlock(ApiStandardSelect, { key: 0, "model-value": selectedStandard.value, "allow-empty": true, "empty-label": "----Select----", "onUpdate:modelValue": handleStandardChange }, null, 8, ["model-value"])) : createCommentVNode("", true) ], 2) ]) ]); }; } }); const UnknownStandardSelector = _export_sfc(_sfc_main$2, [["__scopeId", "data-v-30b82ae2"]]); const _hoisted_1 = { key: 1, class: "unknown-dashboard-gate" }; const _sfc_main$1 = defineComponent({ __name: "DashboardGate", setup(__props) { const currentFlowStore = useCurrentFlowStore(); const { standard } = storeToRefs(currentFlowStore); const handleManualStandardSelect = (newStandard) => { currentFlowStore.updateStandard(newStandard); }; return (_ctx, _cache) => { return unref(standard) ? (openBlock(), createBlock(Dashboard, { key: 0 })) : (openBlock(), createElementBlock("div", _hoisted_1, [ createVNode(UnknownStandardSelector, { onSelectStandard: handleManualStandardSelect }) ])); }; } }); const DashboardGate = _export_sfc(_sfc_main$1, [["__scopeId", "data-v-b69d838d"]]); function useEntry() { const { setLLMData, setUnknownLLMData } = useCurrentFlowStore(); let activeDispose = null; const handleLLMData = (type, flowData, flow) => { logger.debug`Detected request/response ${{ type, flowData, flow }}`; try { let standard = null; let dataType = null; const dataAsText = flowData.text; if (isOpenAIResponsesReq(type, dataAsText, flow)) { standard = "openai-response"; dataType = "request"; } else if (isOpenAIResponsesRes(type, dataAsText, flow)) { standard = "openai-response"; dataType = isSSE(flow) ? "sse" : "response"; } else if (isOpenAIReq(type, dataAsText, flow)) { standard = "openai"; dataType = "request"; } else if (isOpenAIRes(type, dataAsText, flow)) { standard = "openai"; if (isSSE(flow)) { dataType = "sse"; } else { dataType = "response"; } } else if (isAnthropicReq(type, dataAsText, flow)) { standard = "claude"; dataType = "request"; toast("Claude Request detected"); } else if (isAnthropicRes(type, dataAsText, flow)) { standard = "claude"; if (isSSE(flow)) { dataType = "sse"; } else { dataType = "response"; } } else if (isGeminiReq(type, dataAsText, flow)) { standard = "gemini"; dataType = "request"; } else if (isGeminiRes(type, dataAsText, flow)) { standard = "gemini"; if (isSSE(flow)) { dataType = "sse"; } else { dataType = "response"; } } if (standard && dataAsText && dataType) { setLLMData(standard, dataType, dataAsText, flow); logger.info`Dashboard data updated ${{ standard, view: dataType }}`; initPageInjector({ component: DashboardGate }); } else { const fallbackDataType = type === "request" ? "request" : isSSE(flow) ? "sse" : "response"; setUnknownLLMData( fallbackDataType, flow, typeof dataAsText === "string" ? dataAsText : void 0 ); initPageInjector({ component: DashboardGate }); logger.warn("Unknown type or no data", { type, hasData: !!dataAsText }); } } catch (error) { logger.error(error); toast("Error processing request"); } return null; }; return { init: () => { activeDispose?.(); const disposeRouteListener = initRouteListener(handleLLMData); activeDispose = () => { disposeRouteListener(); destroyPageInjector(); activeDispose = null; }; return activeDispose; } }; } const _sfc_main = defineComponent({ __name: "App", setup(__props) { const showDebug = ref(false); const isDev = computed(() => false); const DebugHome = shallowRef(); const { init } = useEntry(); let disposeEntry = null; async function toggleDebug() { if (!DebugHome.value && false) ; showDebug.value = !showDebug.value; } onMounted(() => { disposeEntry = init(); }); onUnmounted(() => { disposeEntry?.(); disposeEntry = null; }); return (_ctx, _cache) => { return openBlock(), createElementBlock(Fragment, null, [ createVNode(unref(Toaster_default), { position: "top-center", duration: 1e3 }), isDev.value ? (openBlock(), createElementBlock("button", { key: 0, class: "debug-toggle-btn", onClick: toggleDebug }, toDisplayString(showDebug.value ? "Hide Debug" : "Show Debug"), 1)) : createCommentVNode("", true), showDebug.value && DebugHome.value ? (openBlock(), createBlock(resolveDynamicComponent(DebugHome.value), { key: 1 })) : createCommentVNode("", true) ], 64); }; } }); const App = _export_sfc(_sfc_main, [["__scopeId", "data-v-de0e06ab"]]); const styleCss = ".floating-panel{position:fixed;top:16px;right:16px;width:32rem;height:24rem;background:#fff;border-radius:12px;box-shadow:0 8px 32px #00000026;padding:16px;z-index:9999}.llm-label{font-size:1.5rem;color:var(--llm-text-muted)}"; importCSS(styleCss); const llmCommonCss = ':root{--llm-border-system: #f59e0b;--llm-border-user: #3b82f6;--llm-border-assistant: #10b981;--llm-border-tool: #8b5cf6;--llm-border-model: #10b981;--llm-border-function: #8b5cf6;--llm-border-thinking: #afafafac;--llm-bg-hover: #f8fafc;--llm-bg-content: rgba(136, 188, 197, .08);--llm-bg-tool: #f8fafc;--llm-bg-card: #ffffff;--llm-bg-header: #f8fafc;--llm-bg-raw: #f8fafc;--llm-text-primary: #1e293b;--llm-text-secondary: #64748b;--llm-text-muted: #94a3b8;--llm-text-link: #1d4ed8;--llm-text-code: #374151;--llm-badge-user-bg: #dbeafe;--llm-badge-user-text: #1d4ed8;--llm-badge-assistant-bg: #dcfce7;--llm-badge-assistant-text: #166534;--llm-badge-system-bg: #fef3c7;--llm-badge-system-text: #92400e;--llm-badge-thinking-bg: #d6d6d69a;--llm-badge-thinking-text: #757575;--llm-badge-tool-bg: #d7b9f771;--llm-badge-tool-text: #7b47d5;--llm-badge-model-bg: #dcfce7;--llm-badge-model-text: #166534;--llm-finish-stop-bg: #dcfce7;--llm-finish-stop-text: #166534;--llm-finish-length-bg: #fef3c7;--llm-finish-length-text: #92400e;--llm-finish-tool-bg: #dbeafe;--llm-finish-tool-text: #1e40af;--llm-finish-filter-bg: #fecaca;--llm-finish-filter-text: #991b1b;--llm-tool-name-bg: #f3e8ff;--llm-tool-name-text: #7c3aed;--llm-tool-badge-bg: #dbeafe;--llm-tool-badge-text: #1d4ed8;--llm-btn-active-bg: rgba(59, 130, 246, .05);--llm-btn-active-border: #3b82f6;--llm-btn-active-text: #3b82f6;--llm-message-border: rgba(126, 180, 233, .31);--llm-error-bg: #fee2e2;--llm-error-text: #dc2626;--llm-info-bg: #dbeafe;--llm-info-text: #1e40af;--llm-border-color: #ccd3dc;--llm-border-hover: #f1f5f9;--llm-border-divider: #d1d5db;--llm-border-dark: #999999;--llm-font-mono: "Monaco", "Menlo", "Consolas", "SF Mono", monospace;--llm-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;--llm-spacing-xs: 2px;--llm-spacing-sm: 4px;--llm-spacing-md: 8px;--llm-spacing-lg: 12px;--llm-spacing-xl: 16px;--llm-spacing-2xl: 24px;--llm-radius-sm: 3px;--llm-radius-md: 4px;--llm-radius-lg: 6px;--llm-radius-xl: 8px;--llm-transition-fast: .2s;--llm-transition-normal: .3s}'; importCSS(llmCommonCss); logger.debug`main.ts`; const app = document.createElement("div"); document.body.appendChild(app); createApp(App).use(createPinia()).mount(app); }) }; })); System.import("./__entry.js", "./");