ccdeck 3.82.4 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSING.md +42 -4
- package/README.md +183 -72
- package/THIRD_PARTY_NOTICES.md +243 -17
- package/bin/cli/tui.js +58 -4
- package/bin/deck.js +27 -1
- package/dist/web/assets/AccountBridge-OQHT5qmS.js +1 -0
- package/dist/web/assets/AccountSection-BpIHPhF3.js +1 -0
- package/dist/web/assets/BrowserWatchModal-DBdt52v7.js +1 -0
- package/dist/web/assets/FeedbackConversations-BJjgXI0-.js +1 -0
- package/dist/web/assets/IntegrationModal-DQ0vEz4X.js +7 -0
- package/dist/web/assets/IntegrationSkeleton-JCPbqp96.js +1 -0
- package/dist/web/assets/RadioPanel-Be6AkrKl.js +1 -0
- package/dist/web/assets/StageShell-Dq0JOQhd.js +4 -0
- package/dist/web/assets/TrafficRadar-7jqJbhaK.js +8 -0
- package/dist/web/assets/UsageHistoryModal-ckawZGoe.js +1 -0
- package/dist/web/assets/addon-unicode-graphemes-DW3WJwyh.js +18 -0
- package/dist/web/assets/addon-web-links-BWjmmSgS.js +12 -0
- package/dist/web/assets/addon-webgl-CLK4R-_u.js +75 -0
- package/dist/web/assets/app-40gNTTfq.js +361 -0
- package/dist/web/assets/app-BRjYF6oD.css +1 -0
- package/dist/web/assets/{index-B-l-VxLm.js → index-XIY3yFiN.js} +1 -1
- package/dist/web/assets/inspector-status-pane-BV_m7eBv.js +1 -0
- package/dist/web/assets/screens-9_ivqfcF.js +12 -0
- package/dist/web/assets/screens-DUniTTbC.css +1 -0
- package/dist/web/assets/stage-board-NF_wgGRA.js +2 -0
- package/dist/web/assets/use-account-BUmI-A8e.js +1 -0
- package/dist/web/assets/xterm-4jYizCpg.js +27 -0
- package/dist/web/assets/xterm-sheet-6GBZ9nXN.css +32 -0
- package/dist/web/index.html +16 -6
- package/package.json +13 -1
- package/release-notes.json +67 -0
- package/src/server/account-client.mjs +196 -0
- package/src/server/account-connect.mjs +238 -0
- package/src/server/account-flag.mjs +106 -0
- package/src/server/account-projects.mjs +1 -1
- package/src/server/account-service.mjs +532 -0
- package/src/server/account-status.mjs +293 -0
- package/src/server/account-store.mjs +137 -0
- package/src/server/account-sync.mjs +473 -0
- package/src/server/account-token-store.mjs +216 -0
- package/src/server/account-ui-fields.mjs +126 -0
- package/src/server/account-watch.mjs +1 -1
- package/src/server/browser-watch-log.mjs +1 -1
- package/src/server/browser-watch-store.mjs +1 -1
- package/src/server/ccdeck-account-routes.mjs +252 -0
- package/src/server/ccusage-install.mjs +2 -2
- package/src/server/ccusage-registry.mjs +4 -4
- package/src/server/ccusage-session.mjs +11 -0
- package/src/server/claude-accounts.mjs +1 -1
- package/src/server/claude-recovery.mjs +9 -4
- package/src/server/claude-settings-catalog.mjs +6 -6
- package/src/server/claude-settings.mjs +1 -1
- package/src/server/codex-auto.mjs +1 -1
- package/src/server/codex-cost-usage.mjs +7 -2
- package/src/server/codex-live-checkpoint.mjs +24 -9
- package/src/server/codex-live-engine.mjs +14 -4
- package/src/server/codex-live-handoff.mjs +53 -9
- package/src/server/codex-names.mjs +49 -0
- package/src/server/codex-translate.mjs +1 -1
- package/src/server/codex-ultrafast.d.mts +3 -0
- package/src/server/codex-ultrafast.mjs +5 -0
- package/src/server/codex-watch.mjs +25 -0
- package/src/server/command-panel-engine.mjs +300 -0
- package/src/server/command-panel-platform.mjs +99 -0
- package/src/server/cswap-auto-choice.mjs +1 -1
- package/src/server/cswap-auto-loop.mjs +1 -1
- package/src/server/cswap-install.mjs +21 -40
- package/src/server/deck-home.mjs +6 -0
- package/src/server/deck-prefs.mjs +53 -1
- package/src/server/detach.mjs +1 -1
- package/src/server/engine-download.mjs +277 -0
- package/src/server/engine-install.mjs +378 -0
- package/src/server/engine-package.mjs +267 -0
- package/src/server/event-log.mjs +7 -1
- package/src/server/event-pipeline.mjs +29 -1
- package/src/server/ghostty-handoff.mjs +81 -0
- package/src/server/index.mjs +143 -5
- package/src/server/installer.mjs +4 -1
- package/src/server/integrations/jira-write-guard.mjs +14 -208
- package/src/server/integrations/store.mjs +37 -19
- package/src/server/integrations/write-guard.mjs +223 -0
- package/src/server/intel-cpu-temperature.mjs +26 -0
- package/src/server/lifecycle.mjs +69 -6
- package/src/server/log-replay.mjs +4 -0
- package/src/server/login-service.mjs +7 -1
- package/src/server/macmon.mjs +1 -1
- package/src/server/npm-latest.mjs +1 -1
- package/src/server/org-telemetry.mjs +1 -1
- package/src/server/output-watch.mjs +4 -1
- package/src/server/panel-provenance.mjs +390 -0
- package/src/server/pinned-build.mjs +14 -0
- package/src/server/prefs-refusal.mjs +8 -1
- package/src/server/prefs-routes.mjs +60 -11
- package/src/server/pro-engine-client.mjs +339 -0
- package/src/server/pro-engine-install.mjs +294 -0
- package/src/server/pro-engine-terminal.mjs +308 -0
- package/src/server/project-discovery.mjs +139 -0
- package/src/server/provider-session-name.mjs +58 -0
- package/src/server/quota-closes.mjs +1 -1
- package/src/server/quota-history.mjs +1 -1
- package/src/server/reports.mjs +86 -21
- package/src/server/request-gates.mjs +34 -5
- package/src/server/restart-note.mjs +1 -1
- package/src/server/seed-boundary.mjs +489 -0
- package/src/server/session-counts.mjs +244 -0
- package/src/server/session-deck-names.mjs +143 -0
- package/src/server/session-enrichment.mjs +43 -6
- package/src/server/session-name-route.mjs +73 -0
- package/src/server/session-summary.mjs +12 -1
- package/src/server/session-transcript-routes.mjs +167 -0
- package/src/server/swap-log.mjs +1 -1
- package/src/server/system-metrics.mjs +57 -0
- package/src/server/terminal-bridge.mjs +485 -0
- package/src/server/terminal-folder.mjs +61 -0
- package/src/server/terminal-js-routes.mjs +752 -0
- package/src/server/terminal-routes.mjs +553 -0
- package/src/server/terminal-sessions.mjs +759 -0
- package/src/server/terminal-socket.mjs +403 -0
- package/src/server/terminal-target.mjs +928 -0
- package/src/server/thermal-metrics.mjs +13 -9
- package/src/server/tmux-control.mjs +1319 -0
- package/src/server/tmux-download.mjs +220 -0
- package/src/server/tmux.mjs +542 -0
- package/src/server/token-redact.mjs +42 -3
- package/src/server/tool-audit-report.mjs +44 -6
- package/src/server/tool-audit-routes.mjs +12 -1
- package/src/server/tool-audit.mjs +42 -8
- package/src/server/traffic-radar-monitor.mjs +1 -1
- package/src/server/traffic-radar-permission.mjs +1 -1
- package/src/server/transcript-gate.mjs +1 -1
- package/src/server/transcript-scan.mjs +15 -7
- package/src/server/transcript-turns.mjs +154 -0
- package/src/server/tui-network.mjs +1 -0
- package/src/server/tui-view.mjs +28 -0
- package/src/server/utf8-carry.mjs +159 -0
- package/src/server/uv-bootstrap.mjs +2 -2
- package/src/server/windows-acl.mjs +158 -0
- package/src/server/ws-frames.mjs +690 -0
- package/dist/web/assets/BrowserWatchModal-CWVooKxD.js +0 -1
- package/dist/web/assets/IntegrationModal-DLX43RIK.js +0 -7
- package/dist/web/assets/RadioPanel-Cj6PjrvQ.js +0 -1
- package/dist/web/assets/TrafficRadar-Bq1YcuHB.js +0 -8
- package/dist/web/assets/UsageHistoryModal-CMSCca5_.js +0 -1
- package/dist/web/assets/app-BHxsMz3-.js +0 -358
- package/dist/web/assets/app-CbXmr9rC.css +0 -1
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{j as e,t as pt,b as d,a7 as zn,a6 as nn,a8 as Be,o as rn,u as Oe,a9 as yn,r as Vr,g as un,e as $n,aa as Fr,w as Hr,ab as Wn,C as Br,D as zr,z as $r}from"./app-BHxsMz3-.js";const Wr={radar:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M20 12a8 8 0 1 1-8-8v8l5-5"}),e.jsx("path",{d:"M12 8a4 4 0 1 0 4 4"}),e.jsx("circle",{cx:"12",cy:"12",r:"1"})]}),connection:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M8 8h8v8H8zM12 3v5M12 16v5M3 12h5M16 12h5"}),e.jsx("circle",{cx:"12",cy:"3",r:"1"}),e.jsx("circle",{cx:"21",cy:"12",r:"1"})]}),logs:e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"5",y:"3",width:"14",height:"18",rx:"2"}),e.jsx("path",{d:"M9 8h6M9 12h6M9 16h3"})]}),metrics:e.jsx(e.Fragment,{children:e.jsx("path",{d:"M4 20h16M7 16v-5M12 16V4M17 16V8"})}),traces:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M7 5h10M7 12h10M7 19h10M12 5v14"}),e.jsx("circle",{cx:"7",cy:"5",r:"2"}),e.jsx("circle",{cx:"17",cy:"12",r:"2"}),e.jsx("circle",{cx:"7",cy:"19",r:"2"})]}),info:e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 11v5M12 7h.01"})]})};function Lt({kind:t,...n}){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:Wr[t]})}function mn({className:t="",children:n,...r}){return e.jsxs("span",{className:"tr-select-wrap",children:[e.jsx("select",{...r,className:`tr-select${t?` ${t}`:""}`,children:n}),e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})]})}function fn(t,n=!1,r=pt){return n||t.active===null?r("radar.conn.unavailable"):t.connecting?t.active?r("radar.conn.connecting"):r("radar.conn.attempted"):t.active?r("radar.conn.active"):r("radar.conn.previous")}function Un(t){return[...new Set(t.filter(n=>n.key.endsWith("ENDPOINT")).map(n=>n.value).filter(n=>/^https?:\/\//.test(n)))]}function Ur(t){return(t==null?void 0:t.status)!=="observing"?[]:[...new Set(t.connections.filter(n=>n.active===!0&&!n.connecting).map(n=>n.destination))]}function Yr(t){try{const n=new URL(t);return/^\d+\.\d+\.\d+\.\d+$/.test(n.hostname)?`${n.hostname}:${n.port||(n.protocol==="https:"?"443":"80")}`:null}catch{return null}}function Jr(t){const n=t.filter(r=>r.key==="CLAUDE_CODE_ENABLE_TELEMETRY").map(r=>r.value);return n.length?new Set(n).size>1?"conflict":n[0]==="Enabled"?"enabled":n[0]==="Disabled"?"disabled":"unknown":"unknown"}function Gr(t,n=pt){const r=t.filter(i=>i.key==="CLAUDE_CODE_ENABLE_TELEMETRY"),s=r.map(i=>i.value);if(!s.length)return n("radar.state.unknown");if(new Set(s).size>1)return n("radar.state.conflict");const o=r.every(i=>i.launch);return s[0]==="Enabled"?n(o?"radar.state.enabledLaunch":"radar.state.enabledSettings"):s[0]==="Disabled"?n(o?"radar.state.disabledLaunch":"radar.state.disabledSettings"):n("radar.state.unknown")}function qr(t){const n=t.replace(/^\uFEFF/,"").trim();if(!n)return[];let r;try{JSON.parse(n),r=[n]}catch{r=t.replace(/^\uFEFF/,"").split(/\r?\n/)}if(r.length>1e4)throw new Error(pt("radar.file.tooLong"));return r.flatMap((s,o)=>{var i;if(!s.trim())return[];try{const c=JSON.parse(s),u=c&&typeof c=="object"?c:{},m=new Set,l=[c];for(;l.length;){const a=l.pop();if(!a||typeof a!="object")continue;if(Array.isArray(a)){for(const f of a)l.push(f);continue}const p=a;for(const f of["session.id","session_id","sessionId"])typeof p[f]=="string"&&m.add(p[f]);if(["session.id","session_id"].includes(String(p.key))){const f=p.value;typeof(f==null?void 0:f.stringValue)=="string"&&m.add(f.stringValue)}for(const f of Object.values(p))l.push(f)}return[{line:o+1,raw:s,sessionIds:[...m],label:String(u.eventName??((i=u.event)==null?void 0:i.name)??u.type??u.model??pt("radar.file.jsonRecord")).slice(0,160),sessionId:typeof(u.session_id??u.sessionId??u["session.id"])=="string"?u.session_id??u.sessionId??u["session.id"]:null,timestamp:typeof u.timestamp=="string"?u.timestamp:null,valid:!0}]}catch{return[{line:o+1,raw:s,label:pt("radar.invalidJson"),sessionId:null,timestamp:null,sessionIds:[],valid:!1}]}})}function Xr(){const[t,n]=d.useState(null),[r,s]=d.useState(!1),o=d.useRef(0);return d.useEffect(()=>{let c=!0,u,m=null;const l=()=>document.visibilityState!=="hidden",a=()=>{clearTimeout(u),m==null||m.abort(),m=null},p=async()=>{if(!c||!l()||m)return;const x=new AbortController,w=o.current;m=x;try{const b=await fetch("/api/system/traffic-radar",{signal:x.signal});if(!b.ok)throw new Error("radar_unavailable");const v=await b.json();if(!v.ok)throw new Error("radar_unavailable");c&&!x.signal.aborted&&w===o.current&&(n(v),s(!1))}catch{c&&!x.signal.aborted&&w===o.current&&s(!0)}finally{m===x&&(m=null),c&&!x.signal.aborted&&l()&&(u=setTimeout(p,5e3))}},f=()=>{a(),document.visibilityState!=="hidden"&&p()};return p(),document.addEventListener("visibilitychange",f),()=>{c=!1,a(),document.removeEventListener("visibilitychange",f)}},[]),{snapshot:t,failed:r,updateConfig:c=>{o.current++,n(u=>u&&{...u,config:c})}}}function Zr(){const[t,n]=d.useState(null),[r,s]=d.useState(!1),[o,i]=d.useState(!1),[c,u]=d.useState(""),[m,l]=d.useState(null),[a,p]=d.useState(null),f=d.useRef(null),x=d.useRef(null),w=d.useRef(0);return d.useEffect(()=>{let v=!0,C,I=null;const A=()=>document.visibilityState!=="hidden",E=()=>{clearTimeout(C),I==null||I.abort(),I=null},g=async()=>{if(!v||!A()||I)return;if(f.current){C=setTimeout(g,1e3);return}const N=w.current,S=new AbortController;I=S;try{const O=await fetch("/api/system/traffic-radar/capture",{signal:S.signal});if(!O.ok)throw new Error;const T=await O.json();v&&!S.signal.aborted&&N===w.current&&(n(T),s(!1))}catch{v&&!S.signal.aborted&&N===w.current&&s(!0)}finally{I===S&&(I=null),v&&!S.signal.aborted&&A()&&(C=setTimeout(g,1e3))}},y=()=>{E(),document.visibilityState!=="hidden"&&g()};return g(),document.addEventListener("visibilitychange",y),()=>{var N;v=!1,E(),(N=x.current)==null||N.abort(),document.removeEventListener("visibilitychange",y)}},[]),{capture:t,failed:r,busy:o,pendingAction:a,error:c,permission:m,action:async v=>{if(!zn(f.current))return;w.current++,f.current=v,p(v),i(!0),u(""),v==="permission"&&l(null);const C=new AbortController;x.current=C;const I=setTimeout(()=>C.abort(),v==="permission"?3e5:2e4);try{const A=await fetch(`/api/system/traffic-radar/capture/${v}`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}",signal:C.signal}),E=await A.json();if(!A.ok)throw new nn(Be(E.error)||pt("radar.srv.captureActionFailed"));v==="permission"&&l(E);const g=await fetch("/api/system/traffic-radar/capture",{signal:C.signal});g.ok&&(n(await g.json()),s(!1))}catch(A){u(rn(A,pt("radar.srv.captureActionFailed")))}finally{clearTimeout(I),x.current=null,f.current=null,p(null),i(!1)}}}}function Qr({workspace:t,width:n,onCommit:r}){const s=Oe(),o=d.useRef(null),i=a=>Math.max(28,Math.min(65,a)),c=a=>{var p;return(p=t.current)==null?void 0:p.style.setProperty("--tr-feed-width",`${a}%`)},u=a=>{const p=i(a);c(p),r(p)},m=a=>{if(o.current===null||!t.current)return;const p=t.current.getBoundingClientRect();o.current=i((a.clientX-p.left)/p.width*100),c(o.current),a.currentTarget.setAttribute("aria-valuenow",String(Math.round(o.current)))},l=()=>{var p;if(o.current===null)return;const a=o.current;o.current=null,(p=t.current)==null||p.removeAttribute("data-resizing"),u(a)};return e.jsx("div",{className:"tr-splitter",role:"separator","aria-label":s("radar.splitter.label"),"aria-orientation":"vertical","aria-valuemin":28,"aria-valuemax":65,"aria-valuenow":Math.round(n),tabIndex:0,title:s("radar.splitter.hint"),onPointerDown:a=>{var p;a.button===0&&(a.preventDefault(),o.current=n,a.currentTarget.setPointerCapture(a.pointerId),(p=t.current)==null||p.setAttribute("data-resizing",""))},onPointerMove:m,onPointerUp:l,onPointerCancel:l,onLostPointerCapture:l,onDoubleClick:()=>u(34),onKeyDown:a=>{const p=a.key==="ArrowLeft"?n-(a.shiftKey?10:2):a.key==="ArrowRight"?n+(a.shiftKey?10:2):a.key==="Home"?28:a.key==="End"?65:a.key==="Enter"?34:null;p!==null&&(a.preventDefault(),u(p))}})}const an=["prompt_text","user_prompt","prompt","gen_ai.prompt","gen_ai.input.messages"],vn=["response","assistant_response","completion","gen_ai.completion","gen_ai.output.messages"],Yn=["project.name","project_name","project","workspace.name","workspace","repository.name","repo.name"],Jn=["cwd","working_directory","working.directory","process.cwd","process.working_directory","workspace.path","project.path","project_path"],St=t=>t&&typeof t=="object"&&!Array.isArray(t)?t:{},Wt=t=>Array.isArray(t)?t:[];function Ht(t){const n=St(t);for(const r of["stringValue","intValue","doubleValue","boolValue","bytesValue"])if(n[r]!==void 0)return n[r];return n.arrayValue?Wt(St(n.arrayValue).values).map(Ht):n.kvlistValue?Dt(St(n.kvlistValue).values):null}function Dt(t){return Object.fromEntries(Wt(t).map(n=>{const r=St(n);return[String(r.key),Ht(r.value)]}))}const gn=t=>typeof t=="string"&&/^(?:\[redacted\]|<redacted>|\(redacted\)|redacted)$/i.test(t.trim());function ut(t,n){const r=n.filter(o=>t[o]!==void 0&&t[o]!==null&&t[o]!==""),s=r.find(o=>!gn(t[o]))??r[0];return s?{state:gn(t[s])?"redacted":"included",key:s,value:t[s]}:{state:"absent",key:null,value:null}}function ea(t){let n=!1;const r=St(t);for(const[s,o,i]of[["resourceLogs","scopeLogs","logRecords"],["resourceSpans","scopeSpans","spans"],["resourceMetrics","scopeMetrics","metrics"]])for(const c of Wt(r[s]))for(const u of Wt(St(c)[o]))for(const m of Wt(St(u)[i])){const l=ut(Dt(St(m).attributes),an);if(l.state==="redacted"&&(n=!0),l.state==="included"){const a=(typeof l.value=="string"?l.value:JSON.stringify(l.value)).replace(/\s+/g," ").trim();if(a)return a.length>180?`${a.slice(0,180)}…`:a}}return n?pt("radar.payload.promptRedacted"):null}function ta(t){const n=Dt(t.attributes);if(/error|fatal/i.test(String(t.severityText??""))||typeof t.severityNumber=="number"&&t.severityNumber>=17||ut(n,["error.message","exception.message","error","error_type"]).state!=="absent"||n.success===!1)return 0;if(ut(n,an).state!=="absent")return 1;if(ut(n,vn).state!=="absent")return 2;if(ut(n,["tool_name","tool.name","gen_ai.tool.name","model","gen_ai.request.model","cost_usd","input_tokens"]).state!=="absent")return 3;const r=String(t.eventName??t.name??n["event.name"]??"");return/^(?:claude_code[._])?(?:plugin[._]loaded|managed[._]settings[._]resolved)$/i.test(r)?4:t.body!==void 0&&Ht(t.body)!==null&&Ht(t.body)!==""?3:4}function na(t,n){const r=ut(t,Yn),s=ut(t,Jn);if(r.state!=="absent"||s.state!=="absent")return{source:"export",project:r,directory:s};const o=ut(t,["session.id","session_id","gen_ai.conversation.id"]),i=n.filter(u=>u.id===o.value&&u.workspace);return new Set(i.map(u=>u.workspace)).size===1?{source:"local",project:{state:"included",value:i[0].project??i[0].label,key:null},directory:{state:"included",value:i[0].workspace,key:null}}:{source:"absent",project:r,directory:s}}function ra({event:t}){const n=Oe(),r=d.useRef(null),[s,o]=d.useState(null);return d.useEffect(()=>{const i=new AbortController;let c=!1;const u=()=>{c||(c=!0,fetch(`/api/system/traffic-radar/capture/event?id=${t.id}`,{signal:i.signal}).then(async l=>{if(!l.ok)return;const a=await l.json();i.signal.aborted||o(ea(a.payload))}).catch(()=>{}))},m=typeof IntersectionObserver>"u"?null:new IntersectionObserver(l=>{l.some(a=>a.isIntersecting)&&(u(),m==null||m.disconnect())},{rootMargin:"100px"});return r.current&&m?m.observe(r.current):u(),()=>{i.abort(),m==null||m.disconnect()}},[t.id,t.observedAt]),e.jsx("span",{ref:r,className:"tr-prompt-preview",children:s??n("radar.feed.preview")})}const Tt=()=>{},bn=t=>Array.isArray(t)?t:[t],et=t=>t!==null&&typeof t=="object",jn=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Gn=t=>t!=null&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function",qn=t=>t&&typeof t=="object"&&"type"in t&&"target"in t&&"preventDefault"in t&&typeof t.preventDefault=="function",An=(t,n)=>{if(typeof t!="string")return null;const r=n.filter(s=>s instanceof Object&&s.enum&&s.values.includes(t)&&s.matchPriority);return r.sort((s,o)=>(o.matchPriority??0)-(s.matchPriority??0)),r[0]??null},Xn=t=>{if(t!==Zn){if(t&&typeof t=="object")for(const n in t){const r=t[n],s=Xn(r);s!==r&&(t[n]=s)}return t}},Zn="__undefined__",Qn=t=>t.split(/(\.|\[\d+\])/).filter(n=>n!=="."&&n!=="").map(n=>{const r=/\[(\d+)\]/.exec(n);return r?Number(r[1]):n}),er=t=>typeof t=="string"?t:typeof t=="number"?String(t):t.reduce((n,r)=>typeof r=="number"?`${n}[${r}]`:n===""?r:`${n}.${r}`,""),nt=t=>t.length===1&&t[0]===""?"\0":t.map(n=>encodeURIComponent(String(n))).join("/"),ht=(t,n)=>t.length===n.length&&t.every((r,s)=>r===n[s]),wn=(t,n)=>t.length>=n.length&&n.every((r,s)=>r===t[s]),Pt=(t,n,r,s,o)=>{if(!s)throw new Error(o??`Invalid property path: ${n}
|
|
2
|
-
Couldn't access "${r}" in ${JSON.stringify(t)}`)},Xt=t=>Array.isArray(t),tr=(t,n)=>t.filter((r,s)=>s!==n),aa=(t,n,r,s={})=>{const{remove:o=!1,createNew:i=!0,noError:c=!1}=s,u=t,m=er(n),l={...s,remove:o,createNew:i,noError:c,fullData:u,fullPath:m},a=Array.isArray(n)?n:Qn(n);return Xt(t)&&o&&a.length===1?tr(t,a[0]):$t(t,a,r,l)},$t=(t,n,r,s)=>{const o=jn(t)?{...t}:null,i=Xt(t)?[...t]:null;if(n.length===0)return t;if(!o&&!i)throw new Error("Can't assign property -- invalid input object");const{createNew:c,remove:u,noError:m,fullData:l,fullPath:a}=s,p=n[0];if(i&&typeof p=="string")return i.map(b=>$t(b,n,r,s));if(n.length===1)return o&&typeof p=="string"?sa(o,p,r,s)??o:i&&typeof p=="number"?(oa(i,p,r,s),i):(Pt(l,a,p,m),t);const f=o||i||[];if(u&&n.length===2&&typeof n[1]=="number"){const b=f[p],v=n[1];return Xt(b)?f[p]=tr(b,v):Pt(l,a,p,m,"Trying to remove an indexed item from an object that is not an array"),f}const x=n.slice(1);if(p in t){if(w=f[p],!Xt(w)&&!jn(w)){if(!c)return Pt(l,a,p,m),f;f[p]={}}return f[p]=$t(f[p],x,r,s),f}var w;if(c){const b=typeof x[0]=="number"?[]:{};if(o)return f[p]=b,f[p]=$t(f[p],x,r,s),f;if(i&&Array.isArray(f)){f.push(b);const v=f.length-1;return f[v]=$t(f[v],x,r,s),f}}return Pt(l,a,p,m),f},sa=(t,n,r,s)=>{const{remove:o,createNew:i,noError:c,insertAfter:u,insertBefore:m,fullData:l,fullPath:a}=s;if(m!==void 0||u!==void 0){const f=Object.entries(t);let x;return x=typeof m=="number"?m:typeof u=="number"?u:f.findIndex(([w])=>w===(m??u)),u!==void 0&&x++,f.splice(x,0,[n,r]),Object.fromEntries(f)}const p=n in t;o?p?delete t[n]:Pt(l,a,n,c):i||p?t[n]=r:Pt(l,a,n,c)},oa=(t,n,r,s)=>{const{noError:o,fullData:i,fullPath:c,createNew:u,insert:m}=s;m&&t.splice(n,0,r),n in t?t[n]=r:u?t.push(r):Pt(i,c,n,o)},tt=(t,n,r)=>{const s=Array.isArray(n)?n:Qn(n);if(s.length===0)return t;const o=s[0];if(Array.isArray(t)&&typeof o!="number"&&t.length>0)return t.map(c=>tt(c,s,r));if(typeof t!="object"||t===null||!(o in t))return ia(t,o,r);const i=t[o];return s.length===1?i:tt(i,s.slice(1),r)},ia=(t,n,r)=>{if(r===void 0)throw new Error(`Unable to extract object property
|
|
3
|
-
Looking for property: ${n}
|
|
4
|
-
In object: ${JSON.stringify(t)}`);return r},wt=(t,n,r="",s)=>{if(n.length===0)return{key:r,path:[],level:0,index:0,value:t,size:et(t)?Object.keys(t).length:1,parentData:null,fullData:t};const o=n[n.length-1],i=tt(t,n),c=tt(t,n.slice(0,-1))??null;let u=0;if(Array.isArray(c))u=typeof o=="number"?o:Number(o);else if(c&&typeof c=="object"){const m=Object.entries(c);s==null||s(m,l=>l),u=m.findIndex(([l])=>l===o)}return{key:o,path:n,level:n.length,index:u,value:i,size:et(i)?Object.keys(i).length:null,parentData:c,fullData:t}},nr=typeof window<"u"?d.useLayoutEffect:d.useEffect,rr=({className:t,name:n,value:r,setValue:s,onKeyDown:o,styles:i,textAreaRef:c})=>{const u=d.useRef(null);if(nr(()=>{const l=u.current;u.current=null;const a=c==null?void 0:c.current;if(!l||!a)return;const p=l.start+r.length-l.sourceLength,f=Math.max(0,Math.min(p,r.length));a.selectionStart!==f&&a.setSelectionRange(f,f)},[r,c]),typeof r!="string")return null;const m=r.slice(-1)===`
|
|
5
|
-
`?r+".":r;return e.jsxs("div",{style:{display:"grid"},children:[e.jsx("textarea",{id:`${n}_textarea`,ref:c,style:{height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap",...i},rows:1,className:t,name:`${n}_textarea`,value:r,onChange:l=>{const{value:a,selectionStart:p}=l.target;u.current=p!==null&&p<a.length?{start:p,sourceLength:a.length}:null,s(a)},autoFocus:!0,onFocus:l=>{r.length<40&&l.target.select()},onKeyDown:o}),e.jsx("span",{className:t,style:{visibility:"hidden",height:"auto",gridArea:"1 / 1 / 2 / 2",color:"red",opacity:.9,whiteSpace:"pre-wrap",overflowY:"auto",border:"1px solid transparent",...i},children:m})]})},Nn=t=>t.shiftKey?"Shift":t.metaKey?"Meta":t.ctrlKey?"Control":t.altKey?"Alt":void 0,la=(t,n,r)=>{if(!n)return!1;const s=t.key,o=Nn(t);if(Array.isArray(n))return!!o&&n.includes(o);const{key:i,modifier:c}=n;return(r!=="stringLineBreak"||s!=="Enter"||o!=="Shift"||i!=="Enter"||!(c!=null&&c.includes("Shift")))&&s===i&&(c===o||Array.isArray(c)&&c.includes(o))},At={key:"Enter"},In={confirm:At,cancel:{key:"Escape"},objectConfirm:{...At,modifier:["Meta","Shift","Control"]},objectLineBreak:At,stringConfirm:At,stringLineBreak:{...At,modifier:["Shift"]},numberConfirm:At,numberUp:{key:"ArrowUp"},numberDown:{key:"ArrowDown"},tabForward:{key:"Tab"},tabBack:{key:"Tab",modifier:"Shift"},booleanConfirm:At,booleanToggle:{key:" "},clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},ca=["stringConfirm","numberConfirm","booleanConfirm"],ar=(t,n)=>{const r=t.current,s=r.selectionStart??1/0,o=r.selectionEnd??1/0,i=r.value.slice(0,s)+n+r.value.slice(o);return r.value=i,r.setSelectionRange(s+1,s+1),i},Zt=(t,n,r="next",s,o)=>{const i=n.slice(0,n.length-1),c=n.slice(-1)[0];if(c===void 0)return null;const u=tt(t,i),m=da(u);Array.isArray(u)||s(m,({key:f,value:x})=>[f,x]);const l=m.findIndex(f=>f.key===c),a=m[l+(r==="next"?1:-1)];if(!a)return i.length===0?null:Zt(t,i,r,s,o);let p;if(et(a.value)){if(Object.keys(a.value).length===0)return Zt(t,[...i,a.key],r,s,o);p=sr(t,[...i,a.key],r,s)}else p=[...i,a.key];return p?o(wt(t,p,"",s))?p:Zt(t,p,r,s,o):null},sr=(t,n,r="next",s)=>{const o=tt(t,n);if(!et(o))return n;const i=Array.isArray(o)?o.map((u,m)=>m):Object.keys(o);s(i,u=>[u,o]);const c=r==="next"?i[0]:i[i.length-1];return sr(t,[...n,c],r,s)},da=t=>Array.isArray(t)?t.map((n,r)=>({value:n,key:r})):Object.entries(t).map(([n,r])=>({key:n,value:r})),Ln={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2},sn={displayName:"Default",icons:{add:{content:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),e.jsx("path",{d:"M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z"})]})},edit:{content:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M7 17.013l4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z"}),e.jsx("path",{d:"M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z"})]}),svgProps:{transform:"translate(0, 0.5)"}},delete:{content:e.jsx("path",{d:"M6 19a2 2 0 002 2h8a2 2 0 002-2V7H6v12m2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12M15.5 4l-1-1h-5l-1 1H5v2h14V4h-3.5z"}),scale:1.04},copy:{content:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M9 2 H15 A1 1 0 0 1 16 3 V5 A1 1 0 0 1 15 6 H9 A1 1 0 0 1 8 5 V3 A1 1 0 0 1 9 2 z"}),e.jsx("path",{d:"M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11"}),e.jsx("path",{d:"M15 10l-4 4 4 4"})]}),svgProps:Ln,scale:.86},ok:{content:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),e.jsx("path",{d:"M22 4L12 14.01l-3-3"})]}),svgProps:Ln,scale:.9},cancel:{content:e.jsx("path",{d:"M12 4c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8zm-5 8c0-.832.224-1.604.584-2.295l6.711 6.711A4.943 4.943 0 0112 17c-2.757 0-5-2.243-5-5zm9.416 2.295L9.705 7.584A4.943 4.943 0 0112 7c2.757 0 5 2.243 5 5 0 .832-.224 1.604-.584 2.295z"}),svgProps:{baseProfile:"tiny"},scale:1.3},collection:{content:e.jsx("path",{d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"}),viewBox:"0 0 512 512",scale:.7}},styles:{container:{backgroundColor:"#f6f6f6",fontFamily:"monospace"},property:"#292929",bracket:{color:"#002b36",fontWeight:"bold"},itemCount:{color:"#0000004d",fontStyle:"italic"},string:"#cb4b16",number:"#268bd2",boolean:"green",null:{color:"#dc322f",fontVariant:"small-caps",fontWeight:"bold"},input:["#292929"],inputHighlight:"#b3d8ff",error:{fontSize:"0.8em",color:"red",fontWeight:"bold"},iconCollection:"#002b36",iconEdit:"#2aa198",iconDelete:"#cb4b16",iconAdd:"#2aa198",iconCopy:"#268bd2",iconOk:"green",iconCancel:"#cb4b16"}},ua={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",headerRow:"backgroundColor",valueRow:"backgroundColor",dropZone:"borderColor",inputHighlight:"backgroundColor"},or=t=>[sn,...bn(t)].map(n=>"styles"in n?n:{styles:n}),ir=t=>{const n={};for(const{icons:r}of or(t))r&&Object.assign(n,r);return n},lr=d.createContext({getStyles:()=>({}),icons:ir(sn),cssVars:{}}),pa=({theme:t=sn,children:n})=>{const r=d.useMemo(()=>(u=>{var m;const l=or(u),a={},p={};for(const{fragments:x,styles:w}of l)for(const b in w){const v=b;for(const C of[].concat(w[v]))if(typeof C=="function")(p[v]??(p[v]=[])).push(C);else{const I=typeof C=="string"?(x==null?void 0:x[C])??C:C;a[v]={...a[v],...typeof I=="string"?{[ua[v]??"color"]:I}:I}}}for(const x in p)a[m=x]??(a[m]={});const f={};for(const x in a){const w=x,b=a[w],v=p[w];f[w]=v?C=>v.reduce((I,A)=>({...I,...A(C)??{}}),b):b}return f})(t),[t]),s=d.useMemo(()=>ir(t),[t]),o=d.useMemo(()=>(u=>{const{inputHighlight:m,iconCopy:l}=u,a={};return typeof m!="function"&&(m!=null&&m.backgroundColor)&&(a["--jer-highlight-color"]=m.backgroundColor),typeof l!="function"&&(l!=null&&l.color)&&(a["--jer-icon-copy-color"]=l.color),a})(r),[r]),i=d.useCallback((u,m)=>((l,a,p)=>{const f=l[a];return typeof f=="function"?f(p):f??{}})(r,u,m),[r]),c=d.useMemo(()=>({getStyles:i,icons:s,cssVars:o}),[i,s,o]);return e.jsx(lr.Provider,{value:c,children:n})},mt=()=>d.useContext(lr),ha={edit:{start:"startEdit",submit:"submitEdit",cancel:"cancelEdit",commit:"commitEdit"},add:{start:"startAdd",submit:"submitAdd",cancel:"cancelAdd",commit:"commitAdd"},rename:{start:"startRename",submit:"submitRename",cancel:"cancelRename",commit:"commitRename"},delete:{commit:"delete"},move:{commit:"move"}},It=(t,n)=>ha[t][n]??null,Ft=(t,n)=>t!==null&&n!==null&&t.op===n.op&&ht(t.path,n.path),ma={active:null,settling:{}},cr=d.createContext(null),fa=({children:t,onEditEvent:n,buildNodeDataFromPathRef:r,commitRef:s})=>{const o=d.useRef(n);o.current=n;const i=d.useRef(null);return i.current===null&&(i.current=((c,u,m)=>{let l=ma;const a=new Set;let p=null,f=null,x=!1,w=0;const b=E=>{l=E,a.forEach(g=>g())},v=(E,g,y)=>{var N;(N=c.current)==null||N.call(c,{...E,...y,event:g})},C=(E,g,y)=>{var S;if(!c.current)return;let N;try{N=(S=u.current)==null?void 0:S.call(u,E)}catch{return b({...l,active:null}),p=null,void(f=null)}N&&v(N,g,y)},I=(E,g)=>{var S;var y;p=(g==null?void 0:g.cancelOp)??null,f=(g==null?void 0:g.commitOp)??null,y=E,Ft(l.active,y)&&((S=l.active)==null?void 0:S.phase)===(y==null?void 0:y.phase)||b({...l,active:y});const N=It(E.op,"start");N&&C(E.path,N)},A=(E,g,y,N,S,O,T,H,le)=>{var j;const K=nt(E);if(!T()){if(N.status==="cancel"||N.status==="error"){l.active&&ht(l.active.path,E)&&(l.active.phase==="held"||l.active.phase==="editing")&&(b({...l,active:null}),p=null,f=null);const k=It(g,"cancel");return k&&v(H,k),N.status==="error"&&v(H,"updateError",{operation:g,error:N.error}),N}S()}if(l.settling[K]===y){switch((k=>{if(!(k in l.settling))return;const L={...l.settling};delete L[k],b({...l,settling:L})})(K),N.status){case"cancel":O();break;case"error":O(),v(H,"updateError",{operation:g,error:N.error});break;case"override":(j=m.current)==null||j.applyValue(N.path,N.value),v(H,"updateSuccess",{operation:g,...le});break;case"commit":v(H,"updateSuccess",{operation:g,...le})}return N}};return{subscribe:E=>(a.add(E),()=>a.delete(E)),getSnapshot:()=>l,getServerSnapshot:()=>l,open:(E,g)=>{var T;if(((T=l.active)==null?void 0:T.phase)==="held")return;const y={path:E,op:(g==null?void 0:g.op)??"edit",phase:"editing",force:g==null?void 0:g.force},N=l.active,S=N!==null&&!Ft(N,y);if(S&&f)return void f(()=>I(y,g));const O=p;if(p=null,f=null,O&&O(),S&&Ft(l.active,N)){const H=It(N.op,"cancel");H&&C(N.path,H)}I(y,g)},cancel:()=>{var g;if(x||((g=l.active)==null?void 0:g.phase)==="held")return;const E=l.active;x=!0;try{const y=p;if(p=null,f=null,y&&y(),E!==null){l.active!==null&&b({...l,active:null});const N=It(E.op,"cancel");N&&C(E.path,N)}}finally{x=!1}},submit:E=>{const{op:g,path:y,instant:N,onCommit:S}=E,O=m.current;let T;try{T=(O==null?void 0:O.buildCommit(E))??null}catch{return Ft(l.active,{path:y,op:g})&&b({...l,active:null}),p=null,f=null,S==null||S(),Promise.resolve(void 0)}const H=T==null?void 0:T.extra,le=nt(y),K=++w;if(!N){const pe=It(g,"submit");pe&&C(y,pe)}if(!T||T.isNoOp){Ft(l.active,{path:y,op:g})&&b({...l,active:null}),p=null,f=null;const pe=It(g,"commit");return pe&&(T?v(T.nodeData,pe,H):C(y,pe,H)),S==null||S(),Promise.resolve(void 0)}const{input:j,nodeData:k,apply:L,revert:B}=T,W=!!(O!=null&&O.runUpdate);let $=!1,ce=!1;const de=()=>{if($)return;$=!0,L(),p=null,f=null,Ft(l.active,{path:y,op:g})&&b({...l,active:null}),W&&((U,ie)=>{b({...l,settling:{...l.settling,[U]:ie}})})(le,K);const pe=It(g,"commit");pe&&v(k,pe,H),S==null||S()},ye={hold:()=>{var pe;return ce=!0,b({...l,active:{path:y,op:g,phase:"held",force:(pe=l.active)==null?void 0:pe.force}}),()=>de()}};if(!W)return de(),Promise.resolve(void 0);const re=O.runUpdate(j,ye),q=Gn(re);if(!ce&&!N&&!q)return Promise.resolve(A(y,g,K,re,de,B,()=>$,k,H));const oe=q?re:Promise.resolve(re);let Re;return ce||(N?Re=setTimeout(de,100):de()),oe.then(pe=>(clearTimeout(Re),A(y,g,K,pe,de,B,()=>$,k,H)))},areChildrenBeingEdited:E=>l.active!==null&&wn(l.active.path,E)}})(o,r,s)),e.jsx(cr.Provider,{value:i.current,children:t})},Ot=()=>{const t=d.useContext(cr);if(!t)throw new Error("Missing Editing Context Provider");return t},Ut=t=>{const n=Ot();return d.useSyncExternalStore(n.subscribe,()=>t(n.getSnapshot()),()=>t(n.getServerSnapshot()))},dr=d.createContext(null),ga=({children:t,onCollapse:n,buildNodeDataFromPathRef:r})=>{const[s,o]=d.useState({commands:null,version:0}),i=d.useRef(n);i.current=n;const c=d.useCallback(m=>{if(m===null)return void o(f=>f.commands===null?f:{commands:null,version:f.version});const l=bn(m),a=l.map(f=>({...f,path:[...f.path]}));o(f=>({commands:a,version:f.version+1}));const p=i.current;p&&l.forEach(f=>{var w;const x=(w=r.current)==null?void 0:w.call(r,f.path);x&&p({...x,collapsed:f.collapsed,includeChildren:f.includeChildren})})},[r]),u=d.useMemo(()=>({commands:s.commands,version:s.version,setCollapseState:c}),[s.commands,s.version,c]);return e.jsx(dr.Provider,{value:u,children:t})},en=()=>{const t=d.useContext(dr);if(!t)throw new Error("Missing Collapse Context Provider");return t},ja=(t,n)=>{if(!n.includeChildren)return n.path.length===t.length&&n.path.every((r,s)=>t[s]===r);for(const[r,s]of n.path.entries())if(s!==t[r])return!1;return!0},ur=d.createContext(null),xa=({children:t})=>{const[n,r]=d.useState({path:null,canDelete:!1}),s=d.useRef(!1),o=d.useMemo(()=>({dragSource:n,setDragSource:r,armed:s}),[n]);return e.jsx(ur.Provider,{value:o,children:t})},ya=({children:t,onEditEvent:n,onCollapse:r,buildNodeDataFromPathRef:s,commitRef:o})=>e.jsx(fa,{onEditEvent:n,buildNodeDataFromPathRef:s,commitRef:o,children:e.jsx(ga,{onCollapse:r,buildNodeDataFromPathRef:s,children:e.jsx(xa,{children:t})})}),pr=d.createContext(void 0),va=({value:t,children:n})=>e.jsx(pr.Provider,{value:t,children:n}),En=()=>{const t=d.useContext(pr);if(t===void 0)throw new Error("Missing FilterStateProvider");return t},hr=t=>{const n=En();return n===null||n.visiblePaths.has(nt(t))},ba=t=>{const n=En();return n===null?null:n.visibleChildCounts.get(nt(t))??null},xn="**INVALID_FUNCTION**",wa=({nodeData:t,showStringQuotes:n=!0,stringTruncateLength:r=200,pathString:s,canEdit:o,setIsEditing:i,styles:c,translate:u,showIconTooltips:m=!1,value:l,TextWrapper:a=({children:p})=>p})=>{const p=l??t.value,[f,x]=d.useState(!1),w=n?'"':"",b=p.length>r,v=()=>{o?i(!0):x(!f)},C=u("SHOW_MORE",t);return e.jsxs("div",{id:`${s}_display`,onDoubleClick:v,onClick:I=>{(I.getModifierState("Control")||I.getModifierState("Meta"))&&v()},className:"jer-value-string",style:c,children:[w,b?e.jsxs(e.Fragment,f?{children:[e.jsx(a,{children:e.jsxs("span",{children:[p,w]})})," ",e.jsx("button",{type:"button",tabIndex:-1,className:"jer-string-expansion jer-show-less",onClick:()=>x(!1),children:u("SHOW_LESS",t)})]}:{children:[e.jsxs(a,{children:[e.jsx("span",{children:p.slice(0,r-2).trimEnd()})," "]}),e.jsx("button",{type:"button",tabIndex:-1,className:"jer-string-expansion jer-ellipsis",onClick:()=>x(!0),"aria-label":C,title:m?C:"",children:"..."}),w]}):e.jsx(a,{children:`${p}${w}`})]})},Na=({styles:t,pathString:n,value:r,setValue:s,handleEdit:o,handleKeyboard:i,keyboardCommon:c})=>{const u=d.useRef(null);return e.jsx(rr,{className:"jer-input-text",textAreaRef:u,name:n,value:r,setValue:s,onKeyDown:m=>{i(m,{stringConfirm:o,stringLineBreak:()=>{const l=ar(u,`
|
|
6
|
-
`);s(l)},...c})},styles:t})},Ea=({isEditing:t,path:n,enumType:r,...s})=>{const{getStyles:o}=mt(),i=nt(n),{value:c,setValue:u,nodeData:m,handleEdit:l,handleKeyboard:a,keyboardCommon:p,Select:f}=s;return t&&r?e.jsx(f,{name:`${i}-value-select`,value:c,onChange:u,options:r.values,autoFocus:!0,onKeyDown:x=>a(x,{stringConfirm:l,...p})}):t?e.jsx(Na,{styles:o("input",m),pathString:i,...s,setValue:s.setValue}):e.jsx(wa,{pathString:i,styles:o("string",m),...s})},Ca=({value:t,setValue:n,isEditing:r,path:s,setIsEditing:o,handleEdit:i,nodeData:c,handleKeyboard:u,keyboardCommon:m})=>{const{getStyles:l}=mt();return r?e.jsx("input",{className:"jer-input-number",type:"text",name:nt(s),value:t,onChange:a=>n(a.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:a=>setTimeout(()=>a.target.select(),10),onKeyDown:a=>u(a,{numberConfirm:i,numberUp:()=>n(Number(t)+1),numberDown:()=>n(Number(t)-1),...m}),style:{width:String(t).length/1.5+2+"em",...l("input",c)}}):e.jsx("span",{onDoubleClick:()=>o(!0),className:"jer-value-number",style:l("number",c),children:t})},ka=({value:t,setValue:n,isEditing:r,path:s,setIsEditing:o,handleEdit:i,nodeData:c,handleKeyboard:u,keyboardCommon:m})=>{const{getStyles:l}=mt();return typeof t!="boolean"?null:r?e.jsx("input",{className:"jer-input-boolean",type:"checkbox",name:nt(s),checked:t,onChange:()=>n(!t),onKeyDown:a=>{a.key===" "&&a.preventDefault(),u(a,{booleanConfirm:i,booleanToggle:()=>n(!t),...m})},autoFocus:!0}):e.jsx("span",{onDoubleClick:()=>o(!0),className:"jer-value-boolean",style:l("boolean",c),children:String(t)})},Sa=(t,n)=>{const r=d.useRef(void 0),s=d.useRef(n);d.useEffect(()=>{s.current=n},[n]);const o=i=>{s.current(i)};d.useEffect(()=>{if(window.clearTimeout(r.current),t)return r.current=window.setTimeout(()=>{window.addEventListener("keydown",o)},100),()=>{window.clearTimeout(r.current),window.removeEventListener("keydown",o)}},[t])},Da=({value:t,isEditing:n,setIsEditing:r,handleEdit:s,nodeData:o,handleKeyboard:i,keyboardCommon:c})=>{const{getStyles:u}=mt();return Sa(n,m=>i(m,{confirm:s,...c})),e.jsx("div",{onDoubleClick:()=>r(!0),className:"jer-value-null",style:u("null",o),children:String(t)})},Ta=({value:t})=>{let n="Error!";switch(typeof t){case"string":t===xn&&(n="Function");break;case"undefined":n="Undefined";break;case"symbol":n="Symbol"}return e.jsx("span",{className:"jer-value-invalid",children:n})},Oa=({scale:t=1,viewBox:n="0 0 24 24",fill:r="currentColor",children:s,...o})=>{const i=1.4*t+"em";return e.jsx("svg",{viewBox:n,fill:r,width:i,height:i,...o,children:s})},Mt=({name:t,nodeData:n})=>{const{getStyles:r,icons:s}=mt(),o=s[t],i=`icon${t[0].toUpperCase()}${t.slice(1)}`;return e.jsx(Oa,{viewBox:o.viewBox,...o.svgProps,scale:o.scale,className:t==="collection"?void 0:"jer-icon",style:r(i,n),children:o.content})},mr=({startEdit:t,handleDelete:n,handleAdd:r,showClipboardButton:s,onCopy:o,type:i,customButtons:c,handleEdit:u,canEdit:m,nodeData:l,translate:a,keyboardControls:p,handleKeyboard:f,editConfirmRef:x,getNewKeyOptions:w,jsonStringify:b,showIconTooltips:v,Select:C})=>{const{getStyles:I}=mt(),{open:A,cancel:E}=Ot(),[g,y]=d.useState(""),[N,S]=d.useState(!1),{path:O,value:T}=l,H=Ut(j=>{const k=j.active;return k!==null&&k.op==="add"&&ht(k.path,O)}),le=Array.isArray(N);nr(()=>{var L;if(!H)return S(!1),void y("");const j=Object.keys(tt(l.fullData,O)),k=w?(L=w(l))==null?void 0:L.filter(B=>!j.includes(B)):null;S(k??!0)},[H]);const K=()=>{r&&g&&r(i==="array"?"":g)};return e.jsxs("div",{className:"jer-edit-buttons",style:{opacity:H?1:void 0},onClick:j=>j.stopPropagation(),children:[s&&e.jsx("button",{type:"button",tabIndex:-1,onClick:j=>{var ce;j.stopPropagation();let k,L,B="value",W="",$=null;if(s){const de=Nn(j);if(de&&p.clipboardModifier.includes(de)?(k=er(O),W=k,B="path"):(k=T,W=typeof k=="object"?b(T):String(k)),!navigator.clipboard)return void(o==null?void 0:o({...l,success:!1,stringValue:W,type:B,error:{code:"CLIPBOARD_ERROR",message:"Can't access clipboard API"}}));(ce=navigator.clipboard)==null||ce.writeText(W).then(()=>L=!0).catch(ye=>{L=!1,$=ye.message}).finally(()=>{o==null||o({...l,success:L,stringValue:W,type:B,error:L?void 0:{code:"CLIPBOARD_ERROR",message:$??"Copy failed"}})})}},className:"jer-copy-pulse","aria-label":a("TOOLTIP_COPY",l),title:v?a("TOOLTIP_COPY",l):"",children:e.jsx(Mt,{name:"copy",nodeData:l})}),t&&e.jsx("button",{type:"button",tabIndex:-1,onClick:t,"aria-label":a("TOOLTIP_EDIT",l),title:v?a("TOOLTIP_EDIT",l):"",children:e.jsx(Mt,{name:"edit",nodeData:l})}),n&&e.jsx("button",{type:"button",tabIndex:-1,onClick:n,"aria-label":a("TOOLTIP_DELETE",l),title:v?a("TOOLTIP_DELETE",l):"",children:e.jsx(Mt,{name:"delete",nodeData:l})}),r&&e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>{i==="object"?A(O,{op:"add"}):r("")},"aria-label":a("TOOLTIP_ADD",l),title:v?a("TOOLTIP_ADD",l):"",children:e.jsx(Mt,{name:"add",nodeData:l})}),c==null?void 0:c.map(({Element:j,onClick:k,label:L},B)=>{const W=$=>k==null?void 0:k(l,$,{handleEdit:u,canEdit:m});return L?e.jsx("button",{type:"button",className:"jer-custom-button",tabIndex:-1,onClick:W,"aria-label":L,title:v?L:"",children:e.jsx(j,{nodeData:l,canEdit:m,handleEdit:u})},B):e.jsx("div",{className:"jer-custom-button",onClick:W,children:e.jsx(j,{nodeData:l,canEdit:m,handleEdit:u})},B)}),H&&r&&i==="object"&&e.jsxs(e.Fragment,{children:[le?e.jsx(C,{name:"new-key-select",onChange:r,defaultValue:"",autoFocus:!0,onKeyDown:j=>f(j,{cancel:()=>E()}),placeholder:N.length>0?a("KEY_SELECT",l):a("NO_KEY_OPTIONS",l),options:N}):e.jsx("input",{className:"jer-input-text jer-input-new-key",type:"text",name:"new-object-key",value:g,placeholder:a("KEY_NEW",l),onChange:j=>y(j.target.value),autoFocus:!0,onKeyDown:j=>{f(j,{stringConfirm:()=>K(),cancel:()=>E()})},style:I("input",l)}),e.jsx(Cn,{onOk:()=>K(),onCancel:()=>E(),nodeData:l,translate:a,showIconTooltips:v,editConfirmRef:x,hideOk:le})]})]})},Cn=({onOk:t,onCancel:n,nodeData:r,translate:s,showIconTooltips:o,editConfirmRef:i,hideOk:c=!1})=>e.jsxs("div",{className:"jer-confirm-buttons",children:[!c&&e.jsx("button",{type:"button",tabIndex:-1,onClick:t,"aria-label":s("TOOLTIP_OK",r),title:o?s("TOOLTIP_OK",r):"",ref:i,children:e.jsx(Mt,{name:"ok",nodeData:r})}),e.jsx("button",{type:"button",tabIndex:-1,onClick:n,"aria-label":s("TOOLTIP_CANCEL",r),title:o?s("TOOLTIP_CANCEL",r):"",children:e.jsx(Mt,{name:"cancel",nodeData:r})})]}),fr=["string","number","boolean","null"],Ra=["object","array"],_a=[...fr,...Ra],gr=t=>{const{component:n,wrapperComponent:r,keyComponent:s,showKey:o=!0,showEditTools:i=!0,showOnEdit:c=!1,showOnView:u=!0,showCollectionWrapper:m=!0,...l}=t;return{CustomComponent:n,CustomWrapperComponent:r,CustomKeyComponent:s,showKey:o,showEditTools:i,showOnEdit:c,showOnView:u,showCollectionWrapper:m,...l}},jr=(t=[],n)=>{const r=t.find(({condition:s})=>s(n));return r?gr(r):{}},xr=({props:t,collapsed:n})=>{const{nodeData:r,parentData:s,onError:o,getLatestData:i,showErrorMessages:c,allowEditFilter:u,allowDeleteFilter:m,allowAddFilter:l,allowDragFilter:a,canAddHere:p,translate:f,errorDisplayTime:x,sort:w,arrayIndexStart:b,handleKeyboard:v,customNodeData:C}=t,{submit:I}=Ot(),[A,E]=d.useState(null),g={...r,collapsed:n,visibleSize:ba(r.path)},{path:y,key:N,size:S}=g,O=nt(y),T=Ut(U=>{const ie=U.active;return ie!==null&&ie.op==="edit"&&ht(ie.path,y)}),H=Ut(U=>{const ie=U.active;return ie!==null&&ie.op==="rename"&&ht(ie.path,y)}),le=Ut(U=>O in U.settling),K=u(g),j=m(g),k=l(g),L=a(g),B=U=>{c&&(E(U),setTimeout(()=>E(null),x)),console.warn("Error",U)},W=d.useRef(g);W.current=g;const $=d.useCallback((U,ie)=>{B(U.message),o&&o({...W.current,fullData:i(),error:U,errorValue:ie})},[o,c,i,x]),ce=En(),de=d.useCallback(U=>(ce===null||ce.visiblePaths.has(nt(U.path)))&&u(U),[ce,u]),ye=U=>Zt(i(),y,U,w,de),re=(U,ie)=>{s&&(N!==U&&Object.keys(s).includes(U)?$({code:"KEY_EXISTS",message:f("ERROR_KEY_EXISTS",g)},U):I({op:"rename",path:y,newKey:U,onCommit:ie}).then(Q=>{(Q==null?void 0:Q.status)==="error"&&$(Q.error,U)}))},q=typeof y.slice(-1)[0]=="number",oe=s!==null&&!q&&j&&p,Re={isEditing:T,isEditingKey:H,isPending:le,isArray:q,canEditKey:oe},pe=N===""&&y.length>0?f("EMPTY_STRING",g):null;return{pathString:O,nodeData:g,path:y,name:N,size:S,canEdit:K,canDelete:j,canAdd:k,canDrag:L,error:A,showError:B,onError:$,setError:E,handleEditKey:re,derivedValues:Re,emptyStringKey:pe,getNextOrPreviousAtPath:ye,buildKeyDisplayProps:({handleCancel:U,getStyles:ie,keyValueArray:Q,handleClick:ve})=>({canEditKey:oe,isEditingKey:H,pathString:O,path:y,name:N,arrayIndexStart:b,handleKeyboard:v,handleEditKey:re,handleCancel:U,styles:ie("property",g),getNextOrPrevious:ye,emptyStringKey:pe,nodeData:g,customNodeData:C,getStyles:ie,...Q!==void 0?{keyValueArray:Q}:{},...ve!==void 0?{handleClick:ve}:{}})}},yr=({canDrag:t,canDelete:n,canDragOnto:r,canAddHere:s,path:o,nodeData:i,onError:c,translate:u})=>{const{getStyles:m}=mt(),{dragSource:l,setDragSource:a,armed:p}=(()=>{const E=d.useContext(ur);if(!E)throw new Error("Missing DragSource Context Provider");return E})(),f=Ot(),[x,w]=d.useState(!1),b=()=>l.path!==null&&!wn(o,l.path)&&(ht(l.path.slice(0,-1),o.slice(0,-1))?r:l.canDelete&&s),v=d.useMemo(()=>t?{onMouseDown:E=>{E.button===0&&f.getSnapshot().active===null&&(p.current=!0)},onMouseUp:()=>{p.current=!1},onDragStart:E=>{if(!p.current||f.getSnapshot().active!==null)return E.preventDefault(),void E.stopPropagation();p.current=!1,E.stopPropagation(),a({path:o,canDelete:n})},onDragEnd:E=>{p.current=!1,E.stopPropagation(),a({path:null,canDelete:!1})}}:{},[t,n,o]),C=d.useMemo(()=>E=>r||s?{onDragOver:g=>{g.stopPropagation(),b()&&g.preventDefault()},onDrop:g=>{g.stopPropagation(),A(E),a({path:null,canDelete:!1}),w(!1)},onDragEnter:g=>{g.stopPropagation(),b()&&w(E)},onDragExit:g=>{g.stopPropagation(),w(!1)}}:{},[l,r,s,o]),I=d.useMemo(()=>l.path!==null&&b()?e.jsx("div",{className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:o.length},...C("below")}):null,[l,r,s,o.length]),A=E=>{if(l.path===null||!b())return;const g=l.path.slice(-1)[0],y=l.path.slice(0,-1),N=o.slice(0,-1),{parentData:S}=i;typeof g=="string"&&S&&!Array.isArray(S)&&Object.keys(S).includes(g)&&g in S&&!ht(y,N)?c({code:"KEY_EXISTS",message:u("ERROR_KEY_EXISTS",i)},g):f.submit({op:"move",path:l.path,to:{path:o,position:E},instant:!0})};return{dragSourceProps:v,getDropTargetProps:C,BottomDropTarget:I,DropTargetPadding:({position:E,nodeData:g})=>x===E?e.jsx("div",{className:"jer-drag-n-drop-padding",style:m("dropZone",g)}):null,handleDrop:A}},tn=({isEditingKey:t,canEditKey:n,pathString:r,path:s,name:o,arrayIndexStart:i,handleKeyboard:c,handleEditKey:u,handleCancel:m,handleClick:l,keyValueArray:a,styles:p,getNextOrPrevious:f,emptyStringKey:x,nodeData:w,customNodeData:b,getStyles:v})=>{const{open:C,cancel:I}=Ot(),A=yn.useRef(null),E=y=>{var N;return u(((N=A.current)==null?void 0:N.value)??String(o),y)},g=typeof o=="number"?String(o+i):o;if(!t){const y={...p,minWidth:`${Math.min(g.length+1,5)}ch`,flexShrink:g.length>10?1:0};if(b!=null&&b.CustomKeyComponent&&w&&v){const{CustomKeyComponent:N,componentProps:S}=b;return e.jsx(N,{nodeData:w,name:x??g,path:s,canEditKey:n,handleEditKey:O=>{n&&u(O)},startEditingKey:()=>{n&&C(s,{op:"rename",commitOp:E})},handleClick:l,styles:y,componentProps:S,getStyles:v})}return e.jsxs("span",{className:"jer-key-text",style:y,onDoubleClick:()=>n&&C(s,{op:"rename",commitOp:E}),onClick:l,children:[x?e.jsx("span",{className:"jer-empty-string",children:x}):g,g!==""||x?e.jsx("span",{className:"jer-key-colon",children:":"}):null]})}return e.jsx("input",{ref:A,className:"jer-input-text jer-key-edit",type:"text",name:r,defaultValue:g,autoFocus:!0,onFocus:y=>y.target.select(),onKeyDown:y=>c(y,{stringConfirm:()=>u(y.target.value),cancel:m,tabForward:()=>{const N=y.target.value;u(N,()=>{if(a){const S=a==null?void 0:a[0][0],O=S?[...s,S]:f("next");O?C(O):I()}else C(s)})},tabBack:()=>{const N=y.target.value;u(N,()=>{const S=f("prev");S?C(S):I()})}}),style:{width:g.length/1.5+.5+"em"}})},Aa=new Set(["nodeData","customNodeData"]),vr=(t,n)=>{if(r=t.nodeData,s=n.nodeData,r.key!==s.key||r.index!==s.index||r.level!==s.level||r.size!==s.size||!ht(r.path,s.path))return!1;var r,s;const o=Object.keys(n);if(o.length!==Object.keys(t).length)return!1;for(const i of o)if(!Aa.has(i)&&!Object.is(t[i],n[i]))return!1;return!0},Ia=t=>{const{data:n,parentData:r,onChange:s,showClipboardButton:o,onCopy:i,canDragOnto:c,canAddHere:u,allowTypeSelection:m,showLabel:l,stringTruncateLength:a,showStringQuotes:p,indent:f,translate:x,customNodeDefinitions:w,customNodeData:b,Select:v,handleKeyboard:C,keyboardControls:I,editConfirmRef:A,jsonStringify:E,showIconTooltips:g,getLatestData:y}=t,{getStyles:N}=mt(),{open:S,cancel:O,submit:T,getSnapshot:H}=Ot(),{setCollapseState:le}=en(),[K,j]=d.useState(typeof n=="function"?xn:n),{nodeData:k,path:L,name:B,canEdit:W,canDelete:$,canDrag:ce,error:de,onError:ye,setError:re,derivedValues:q,getNextOrPreviousAtPath:oe,buildKeyDisplayProps:Re}=xr({props:t}),{dragSourceProps:pe,getDropTargetProps:U,BottomDropTarget:ie,DropTargetPadding:Q}=yr({canDrag:ce,canDelete:$,canDragOnto:c,canAddHere:u,path:L,nodeData:k,onError:ye,translate:x}),[ve,we]=d.useState(Qt(n,b)),Ke=d.useRef(K);Ke.current=K;const F=d.useRef(k);F.current=k;const J=d.useCallback(R=>{if(!s)return void j(R);const X=s({...F.current,value:Ke.current,fullData:y(),newValue:R});j(X)},[s,y]),Z=()=>{j(typeof n=="function"?xn:n),we(Qt(n,b)),We(An(n,Ne))};d.useEffect(()=>{q.isEditing||Z()},[n]);const Ne=d.useMemo(()=>{const R=[..._a,...w.filter(({showInTypeSelector:me=!1,name:h})=>me&&!!h).map(({name:me})=>me)];if(typeof m=="boolean")return m?R:[];if(Array.isArray(m))return m;const X=m(k);return typeof X=="boolean"?X?R:[]:X},[k,m,w]),[Ce,We]=d.useState(An(K,Ne)),{isEditing:ke,isPending:Ve}=q,ft=hr(L),Se=d.useRef(Tt);if(!ft)return null;const Ee=ke&&ve!==Qt(n,b),De=Ee?w.find(R=>R.name===ve&&Pn(R)):void 0,he=De?gr(De):b,{CustomComponent:Ye,componentProps:rt,showKey:Et=!0,showEditTools:at=!0,showOnEdit:Le,showOnView:xe,passOriginalNode:_e}=he,st=Ye&&(De!==void 0||!Ee&&(ke&&Le||!ke&&xe)),Rt=R=>{le(null);const X=Ee&&!De?void 0:he,me=X!=null&&X.toStandardType?X.toStandardType(K):K,h=w.find(G=>G.name===R);if(h){const G=typeof h.defaultValue=="function"?h.defaultValue(k):h.defaultValue;if(Pn(h)){let Ie=G;if(h.fromStandardType)try{Ie=h.fromStandardType(me,k,h.componentProps)}catch{}return j(Ie),we(R),void We(null)}return T({op:"edit",path:L,value:G}).then(Je(G)),void le({path:L,collapsed:!1,includeChildren:!1})}const P=Ne.find(G=>G instanceof Object&&G.enum===R);if(P)return typeof K=="string"&&P.values.includes(K)||j(P.values[0]),We(P),void we(R);const ee=La(me,R,x("DEFAULT_NEW_KEY",k));if(R==="object"||R==="array"||R==="null")return T({op:"edit",path:L,value:ee}).then(Je(ee)),void(R!=="null"&&le({path:L,collapsed:!1,includeChildren:!1}));j(ee),we(R),We(null)},Je=R=>X=>{if((X==null?void 0:X.status)==="error"&&ye(X.error,R),(X==null?void 0:X.status)==="error"||(X==null?void 0:X.status)==="cancel"){const me=H().active;(me==null?void 0:me.phase)==="editing"&&ht(me.path,L)||Z()}},Ae=(R,X)=>{const me=R!==void 0&&!qn(R);let h;if(me)h=R;else if(st&&he.fromStandardType)try{h=he.fromStandardType(K,k,he.componentProps)}catch(ee){return void ye({code:"UPDATE_ERROR",message:ee instanceof Error?ee.message:String(ee)},K)}else h=ve==="number"?wr(K):K;re(null),De&&le({path:L,collapsed:!1,includeChildren:!1});const P=me&&et(h)&&!et(n);T({op:"edit",path:L,value:h,onCommit:()=>{P&&le({path:L,collapsed:!1,includeChildren:!1}),X==null||X()}}).then(Je(h))};Se.current=Ae;const ze=()=>{re(null),Z(),O()},{isEditingKey:Pe}=q,ot=!!de,gt=ke&&Ne.length>1,jt=(ve!=="invalid"||Ye)&&!de&&at,it=l&&Et,Ge=()=>S(L,{cancelOp:Z,commitOp:R=>Se.current(void 0,R)}),lt=W?Ge:Tt,xt=R=>()=>{const X=oe(R);X&&Ae(void 0,()=>S(X))},qe={value:K,parentData:r,setValue:J,isEditing:ke,canEdit:W,setIsEditing:lt,handleEdit:Ae,handleCancel:ze,path:L,stringTruncateLength:a,showStringQuotes:p,showIconTooltips:g,nodeData:k,enumType:Ce,translate:x,handleKeyboard:C,keyboardCommon:{cancel:ze,tabForward:xt("next"),tabBack:xt("prev")},Select:v},ct={...Re({handleCancel:ze,getStyles:N}),customNodeData:he},yt=st?e.jsx(Ye,{...t,value:K,componentProps:rt,setValue:J,handleEdit:Ae,handleCancel:ze,onKeyDown:R=>C(R,{stringConfirm:Ae,cancel:ze}),isEditing:ke,isPending:Ve,setIsEditing:lt,getStyles:N,originalNode:_e?Mn(n,ve,qe):void 0,originalNodeKey:_e?e.jsx(tn,{...ct,customNodeData:void 0}):void 0,canEdit:W,keyboardCommon:qe.keyboardCommon}):Mn(n,ve,qe);return e.jsxs("div",{className:"jer-component jer-value-component",style:{marginLeft:r!==null?f/2+"em":0,position:"relative"},draggable:ce&&!ke&&!Pe,...pe,...U("above"),children:[ie,e.jsx(Q,{position:"above",nodeData:k}),e.jsxs("div",{className:"jer-value-main-row",style:{...N("valueRow",k),flexWrap:B.length>10?"wrap":"nowrap"},children:[it&&e.jsx(tn,{...ct}),e.jsxs("div",{className:"jer-value-and-buttons",children:[e.jsx("div",{className:"jer-input-component",children:yt}),ke?e.jsx(Cn,{onOk:Ae,onCancel:ze,nodeData:k,translate:x,showIconTooltips:g,editConfirmRef:A}):jt&&e.jsx(mr,{startEdit:W?Ge:void 0,handleDelete:$?()=>{T({op:"delete",path:L,instant:!0}).then(R=>{(R==null?void 0:R.status)==="error"&&ye(R.error,K)})}:void 0,showClipboardButton:o,onCopy:i,translate:x,customButtons:t.customButtons,handleEdit:R=>Ae(R),canEdit:W,nodeData:k,handleKeyboard:C,keyboardControls:I,editConfirmRef:A,jsonStringify:E,showIconTooltips:g,Select:v}),gt&&e.jsx(v,{name:`${B}-type-select`,value:Ce?Ce.enum:ve,onChange:R=>Rt(R),options:Ne.map(R=>R instanceof Object&&"enum"in R?R.enum:R)}),ot&&e.jsx("span",{className:"jer-error-slug",style:N("error",k),children:de})]})]}),e.jsx(Q,{position:"below",nodeData:k})]})},br=yn.memo(Ia,vr),Pn=t=>!!t.editOnTypeSwitch&&!!t.component&&!!t.showOnEdit,Qt=(t,n)=>n!=null&&n.CustomComponent&&(n!=null&&n.name)&&n.showInTypeSelector?n.name:typeof t=="string"?"string":typeof t=="number"?"number":typeof t=="boolean"?"boolean":t===null?"null":"invalid",Mn=(t,n,r)=>{const s=fr.includes(n)?n:typeof t=="function"?"invalid":Qt(r.value),{value:o}=r;switch(s){case"string":return e.jsx(Ea,{...r,value:o});case"number":return e.jsx(Ca,{...r,value:o});case"boolean":return e.jsx(ka,{...r,value:o});case"null":return e.jsx(Da,{...r});default:return e.jsx(Ta,{...r})}},wr=t=>{if(typeof t=="symbol")return 0;const n=Number(t);return isNaN(n)?0:n},La=(t,n,r)=>{switch(n){case"string":return t==null?"":String(t);case"number":return wr(t);case"boolean":return!!t;case"null":return null;case"object":return{[r]:t};case"array":return[t];default:return String(t)}},Pa=t=>{const{getStyles:n}=mt(),{open:r,cancel:s,submit:o,areChildrenBeingEdited:i,getSnapshot:c}=Ot(),{setCollapseState:u}=en(),{mainContainerRef:m,data:l,nodeData:a,parentData:p,showCollectionCount:f,canDragOnto:x,canAddHere:w,collapseFilter:b,collapseAnimationTime:v,showClipboardButton:C,onCopy:I,showIconTooltips:A,indent:E,sort:g,showArrayIndexes:y,defaultValue:N,newKeyOptions:S,translate:O,customNodeDefinitions:T,customNodeData:H,jsonParse:le,jsonStringify:K,TextEditor:j,Select:k,keyboardControls:L,handleKeyboard:B,insertAtTop:W,onCollapse:$,editConfirmRef:ce,collapseClickZones:de,getLatestData:ye}=t,[re,q]=d.useState(null),{showCollectionWrapper:oe=!0}=H,Re=oe&&b(a),{contentRef:pe,isAnimating:U,maxHeight:ie,collapsed:Q,animateCollapse:ve,cssTransitionValue:we}=((D,Y,Te,ue,ge)=>{const[He,bt]=d.useState(Te?0:void 0),[_t,Rr]=d.useState(Te),on=d.useRef(!1),ln=d.useRef(null),Sn=d.useRef(0),Dn=d.useRef(0),_r=Y/1e3+"s",Ar=d.useCallback(cn=>{var Tn;if(_t!==cn){switch(window.clearTimeout(Dn.current),on.current=!0,cn){case!0:{const Gt=((Tn=ln.current)==null?void 0:Tn.offsetHeight)??0;Sn.current=Gt,bt(Gt),setTimeout(()=>{bt(0)},5);break}case!1:bt(Sn.current||((Gt,On,Ir,Lr)=>{var _n;if(!On.current)return 0;const Rn=parseInt(getComputedStyle(Ir.current).getPropertyValue("line-height"))||16,Pr=(((_n=On.current)==null?void 0:_n.offsetWidth)??0)/(.5*Rn),Mr=Lr(Gt).replace(/\\n/g,`
|
|
7
|
-
`).split(`
|
|
8
|
-
`).map(dn=>Math.ceil(dn.length/Pr)).reduce((dn,Kr)=>dn+Kr,0)*Rn;return Math.min(Mr+30,window.innerHeight-50)})(D,ln,ue,ge))}Rr(!_t),Dn.current=window.setTimeout(()=>{on.current=!1,cn||bt(void 0)},Y)}},[Y,_t,D,ue,ge]);return{contentRef:ln,isAnimating:on.current,animateCollapse:Ar,maxHeight:He,collapsed:_t,cssTransitionValue:_r}})(l,v,Re,m,K),{pathString:Ke,nodeData:F,path:J,name:Z,size:Ne,canEdit:Ce,canDelete:We,canAdd:ke,canDrag:Ve,error:ft,setError:Se,onError:Ee,derivedValues:De,buildKeyDisplayProps:he}=xr({props:t,collapsed:Q}),{dragSourceProps:Ye,getDropTargetProps:rt,BottomDropTarget:Et,DropTargetPadding:at}=yr({canDrag:Ve,canDelete:We,canDragOnto:x,canAddHere:w,path:J,nodeData:F,onError:Ee,translate:O}),Le=d.useRef(!Re),{isEditing:xe,isEditingKey:_e,isPending:st,isArray:Rt}=De,Je=(D=>{const Y=d.useRef(D),Te=!Object.is(Y.current,D);return d.useEffect(()=>{Y.current=D}),Te})(b);d.useEffect(()=>{const D=oe&&b(F)&&!xe;Le.current=!D,ve(D),Je&&u(null)},[b]),((D,Y,Te)=>{const{commands:ue,version:ge}=en(),He=d.useRef(0);d.useEffect(()=>{if(ge===He.current||(He.current=ge,!ue))return;let bt;for(const _t of ue)ja(D,_t)&&(bt=_t);bt&&(bt.collapsed||(Y.current=!0),Te(bt.collapsed))},[ge,ue])})(J,Le,oe?ve:Tt);const Ae=d.useRef(null),ze=d.useCallback(D=>q(Y=>typeof D=="function"?D(Y??K(l)):D),[l,K]),Pe=d.useCallback(()=>q(null),[]),ot=d.useMemo(()=>xe?re??K(l):null,[xe,re,l,K]),gt=d.useCallback((D,Y)=>{if(typeof N!="function")return N;const Te=N(D,Y);return Te!==void 0?Te:null},[N]),jt=d.useCallback(D=>S?typeof S!="function"?S:S(D):null,[S]),{CustomComponent:it,componentProps:Ge,CustomWrapperComponent:lt,wrapperProps:xt={},showKey:qe=!0,showEditTools:ct=!0,showOnEdit:yt,showOnView:R,passOriginalNode:X}=H,me=Ut(D=>D.active!==null&&wn(D.active.path,J));!me&&oe||!Q||ve(!1);const h=hr(J)||F.level===0,P=d.useRef(Tt);if(!h&&!me)return null;const{visibleSize:ee}=F,G=Array.isArray(l)?"array":"object",Ie=G==="array"?{open:"[",close:"]"}:{open:"{",close:"}"},Ct=D=>{if(D.key==="Tab"&&!D.getModifierState("Shift")&&D.target===Ae.current){D.preventDefault();const Y=ar(Ae," ");return void q(Y)}B(D,{objectConfirm:vt,cancel:_})},Kt=D=>{if(D.stopPropagation(),!oe)return;const Y=Nn(D);if(Y&&L.collapseModifier.includes(Y))return Le.current=!0,void u({collapsed:!Q,path:J,includeChildren:!0});i(J)||(Le.current=!0,$&&$({...F,fullData:ye(),collapsed:!Q,includeChildren:!1}),ve(!Q))},vt=(D,Y)=>{const Te=D!==void 0&&!qn(D);let ue=l;if(Te)ue=D;else if(re!==null)try{ue=le(re)}catch{return void Ee({code:"INVALID_JSON",message:O("ERROR_INVALID_JSON",F)},re)}Se(null),o({op:"edit",path:J,value:ue,onCommit:()=>{Pe(),Y==null||Y()}}).then(ge=>{if((ge==null?void 0:ge.status)==="error"&&Ee(ge.error,ue),(ge==null?void 0:ge.status)==="error"||(ge==null?void 0:ge.status)==="cancel"){const He=c().active;(He==null?void 0:He.phase)==="editing"&&ht(He.path,J)||Pe()}})};P.current=vt;const Vt=D=>vt(D),V=J.length>0?()=>{o({op:"delete",path:J,instant:!0}).then(D=>{(D==null?void 0:D.status)==="error"&&Ee(D.error,l)})}:void 0,_=()=>{s(),Se(null),Pe()},te=f==="when-collapsed"?Q:f==="when-collapsed-or-filtered"?Q||ee!=null:f,fe=!xe&&ct,ne=(y||!Rt)&&qe&&Z!==void 0,be=it&&(xe&&yt||!xe&&R),ae=Object.entries(l).map(([D,Y])=>[G==="array"?Number(D):D,Y]);G==="object"&&g(ae,D=>D);const M=!xe||!!it&&yt,z=()=>e.jsxs("div",{className:"jer-collection-text-edit"+(j?"-custom":""),children:[j?e.jsx(j,{value:ot??"",onChange:q,onKeyDown:D=>B(D,{objectConfirm:vt,cancel:_})}):e.jsx(rr,{textAreaRef:Ae,className:"jer-collection-text-area",name:Ke,value:ot??"",setValue:ze,onKeyDown:Ct,styles:n("input",F)}),e.jsx("div",{className:"jer-collection-input-button-row",children:e.jsx(Cn,{onOk:vt,onCancel:_,nodeData:F,translate:O,showIconTooltips:A,editConfirmRef:ce})})]}),se=Le.current?M?ae.map(([D,Y],Te)=>{const ue={key:D,value:Y,path:[...J,D],level:J.length+1,index:Te,size:et(Y)?Object.keys(Y).length:null,parentData:l,fullData:F.fullData},ge=jr(T,ue);return e.jsx("div",{className:"jer-collection-element",style:n("collectionElement",ue),children:et(Y)&&!(ge!=null&&ge.renderCollectionAsValue)?e.jsx(Nr,{...t,data:Y,parentData:l,nodeData:ue,canDragOnto:Ce,canAddHere:ke,customNodeData:ge},D):e.jsx(br,{...t,data:Y,parentData:l,nodeData:ue,canDragOnto:Ce,canAddHere:ke,showLabel:G==="object"||y,customNodeData:ge},D)},D)}):e.jsx(e.Fragment,{children:z()}):null,je=!!oe&&Q&&!me;je||(Le.current=!0);const $e=O(Q?"TOOLTIP_EXPAND":"TOOLTIP_COLLAPSE",F),Xe=()=>({...t,data:l,value:l,parentData:p,nodeData:F,setValue:Vt,handleEdit:vt,handleCancel:_,onKeyDown:Ct,isEditing:xe,isPending:st,setIsEditing:Ce?()=>r(J,{cancelOp:Pe,commitOp:D=>P.current(void 0,D)}):Tt,getStyles:n,canDragOnto:Ce,canAddHere:ke,canEdit:Ce,keyboardCommon:{}}),Me=be?e.jsx(it,{componentProps:Ge,...Xe(),originalNode:X&&xe?z():void 0,children:se}):se,Ze=fe&&e.jsx(mr,{startEdit:Ce?()=>{Le.current=!0,r(J,{cancelOp:Pe,commitOp:D=>P.current(void 0,D)})}:void 0,handleAdd:ke?D=>{u(null),ve(!1);const Y=gt(F,D);if(G==="array"){const ue=W.array?0:l.length,ge=W.array?{insert:!0}:{};return void o({op:"add",path:J,key:ue,value:Y,options:ge,instant:!0}).then(He=>{(He==null?void 0:He.status)==="error"&&Ee(He.error,Y)})}if(D in l)return Ee({code:"KEY_EXISTS",message:O("ERROR_KEY_EXISTS",F)},D),void s();const Te=W.object?{insertBefore:0}:{};o({op:"add",path:J,key:D,value:Y,options:Te}).then(ue=>{(ue==null?void 0:ue.status)==="error"&&Ee(ue.error,Y)})}:void 0,handleDelete:We?V:void 0,showClipboardButton:C,onCopy:I,type:G,nodeData:F,translate:O,customButtons:t.customButtons,handleEdit:Vt,canEdit:Ce,keyboardControls:L,handleKeyboard:B,getNewKeyOptions:jt,editConfirmRef:ce,jsonStringify:K,showIconTooltips:A,Select:k}),Fe=he({handleCancel:_,getStyles:n,keyValueArray:ae,handleClick:de.includes("property")?Kt:D=>D.stopPropagation()}),dt=e.jsxs("div",{className:"jer-component jer-collection-component",style:{marginLeft:(J.length===0?0:E/2)+"em",...n("collection",F),position:"relative"},draggable:Ve&&!xe&&!_e&&!me,...Ye,...rt("above"),children:[oe&&e.jsx("div",{className:"jer-clickzone",style:{width:E/2+1+"em",zIndex:10+2*F.level},onClick:de.includes("left")?Kt:void 0}),!xe&&Et,e.jsx(at,{position:"above",nodeData:F}),oe?e.jsxs("div",{className:"jer-collection-header-row",style:{...n("headerRow",F),position:"relative"},onClick:de.includes("header")?Kt:void 0,children:[e.jsxs("div",{className:"jer-collection-name",children:[e.jsx("button",{type:"button",className:"jer-collapse-icon jer-accordion-icon"+(Q?" jer-rotate-90":""),style:{zIndex:11+2*F.level,transition:we},onClick:Kt,tabIndex:-1,"aria-expanded":!Q,"aria-label":$e,title:A?$e:"",children:e.jsx(Mt,{name:"collection",nodeData:F})}),ne&&e.jsx(tn,{...Fe}),!xe&&e.jsx("span",{className:"jer-brackets jer-bracket-open",style:n("bracket",F),children:Ie.open})]}),f!==!1&&!xe&&e.jsx("div",{className:"jer-collection-item-count"+(te?" jer-visible":" jer-hidden"),style:{...n("itemCount",F),transition:we,transitionBehavior:"allow-discrete"},children:ee!=null&&ee!==Ne?O("ITEMS_FILTERED",F,{visible:ee,total:Ne}):Ne===1?O("ITEM_SINGLE",{...F,size:1},1):O("ITEMS_MULTIPLE",F,Ne)}),e.jsx("div",{className:"jer-brackets"+(je?" jer-visible":" jer-hidden"),style:{...n("bracket",F),transition:we},children:Ie.close}),Ze]}):qe?e.jsxs("div",{className:"jer-collection-header-row",style:{...n("headerRow",F),position:"relative"},children:[e.jsx(tn,{...Fe}),Ze]}):e.jsx(e.Fragment,{}),e.jsxs("div",{className:"jer-collection-inner",style:{overflowY:je||U?"clip":"visible",maxHeight:me?void 0:ie,...n("collectionInner",F),transition:`max-height ${we}`},ref:pe,children:[Me,e.jsx("div",{className:xe?"jer-collection-error-row-edit":"jer-collection-error-row",children:ft&&e.jsx("span",{className:"jer-error-slug",style:n("error",F),children:ft})}),!xe&&oe&&e.jsx("div",{className:"jer-brackets jer-bracket-outside",style:n("bracket",F),children:Ie.close})]}),e.jsx(at,{position:"below",nodeData:F})]});return lt?e.jsx(lt,{wrapperProps:xt,...Xe(),children:dt}):dt},Nr=yn.memo(Pa,vr),Ma=({options:t,value:n,defaultValue:r,onChange:s,placeholder:o,className:i,...c})=>e.jsxs("div",{className:"jer-select",children:[e.jsxs("select",{className:i??"jer-select-inner",onChange:u=>s(u.target.value),...c,...n!==void 0?{value:n}:{defaultValue:r??""},children:[o!==void 0&&e.jsx("option",{value:"",disabled:!0,children:o}),t.map(u=>e.jsx("option",{value:u,children:u},u))]}),e.jsx("span",{className:"focus"})]}),Jt=(t,n="")=>{const{value:r}=t;if(r===null&&"null".includes(n.toLowerCase()))return!0;switch(typeof r){case"string":return r.toLowerCase().includes(n.toLowerCase());case"number":return!!String(r).includes(n);case"boolean":return r?"true".includes(n.toLowerCase())||n==="1":"false".includes(n.toLowerCase())||n==="0";default:return!1}},Kn=({key:t,path:n},r="")=>!!Jt({value:t},r)||!!n.some(s=>Jt({value:s},r)),Ka={ITEM_SINGLE:"{{count}} item",ITEMS_MULTIPLE:"{{count}} items",ITEMS_FILTERED:"{{visible}} of {{total}} items",KEY_NEW:"Enter new key",KEY_SELECT:"Select key",NO_KEY_OPTIONS:"No key options",ERROR_KEY_EXISTS:"Key already exists",ERROR_INVALID_JSON:"Invalid JSON",ERROR_UPDATE:"Update unsuccessful",ERROR_DELETE:"Delete unsuccessful",ERROR_ADD:"Adding node unsuccessful",ERROR_RENAME:"Rename unsuccessful",ERROR_MOVE:"Move unsuccessful",DEFAULT_NEW_KEY:"key",SHOW_LESS:"(Show less)",SHOW_MORE:"Show more",EMPTY_STRING:"<empty string>",TOOLTIP_COPY:"Copy to clipboard",TOOLTIP_EDIT:"Edit",TOOLTIP_DELETE:"Delete",TOOLTIP_ADD:"Add",TOOLTIP_OK:"OK",TOOLTIP_CANCEL:"Cancel",TOOLTIP_COLLAPSE:"Collapse",TOOLTIP_EXPAND:"Expand"};var pn=':root,:host{--jer-select-border: #b6b6b6;--jer-select-focus: #777;--jer-select-arrow: #777;--jer-form-border: 1px solid #ededf0;--jer-form-border-focus: 1px solid #e2e2e2;--jer-highlight-color: #b3d8ff;--jer-icon-copy-color: #268bd2}.jer-visible{opacity:1}.jer-hidden{opacity:0}.jer-select select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:none;padding:0 1em 0 0;margin:0;font-family:inherit;font-size:.8em;color:#000;cursor:inherit;line-height:inherit;z-index:1;outline:none}select::-ms-expand{display:none}.jer-select{display:grid;grid-template-areas:"select";align-items:center;position:relative;min-width:12ch;max-width:15ch;border:1px solid var(--jer-select-border);border-radius:.25em;padding:.25em .5em;cursor:pointer;line-height:1.1;background-color:#fff;background-image:linear-gradient(to top,#f9f9f9,#fff 33%)}.jer-select select,.jer-select:after{grid-area:select}.jer-select:not(.jer-select--multiple):after{content:"";justify-self:end;width:.8em;height:.5em;background-color:var(--jer-select-arrow);clip-path:polygon(100% 0%,0 0%,50% 100%)}select:focus+.focus{position:absolute;inset:-1px;border:1px solid var(--jer-select-focus);border-radius:inherit}.jer-select-inner{width:100%;text-overflow:ellipsis}.jer-editor-container{position:relative;font-size:16px;line-height:1;padding:1em 1em 1em 2em;border-radius:.5em;text-align:left}.jer-editor-container textarea{color:var(--jer-input-color);border:var(--jer-form-border);border-radius:.3em;outline:none}.jer-editor-container textarea:focus{border:var(--jer-form-border-focus)}.jer-editor-container input{border:var(--jer-form-border);border-radius:.3em;outline:none;font-family:inherit}.jer-editor-container input:focus{border:var(--jer-form-border-focus)}.jer-editor-container ::selection{background-color:var(--jer-highlight-color)}.jer-collection-header-row,.jer-value-main-row{display:flex;min-height:1.7em;gap:.3em;align-items:center}.jer-collection-header-row{flex-wrap:wrap}.jer-value-main-row{gap:0}.jer-bracket-outside{padding-left:0}.jer-collection-item-count{display:none}.jer-collection-item-count.jer-visible{display:block}@starting-style{.jer-collection-item-count.jer-visible{opacity:0}}.jer-collapse-icon{position:absolute;left:-1.2em;top:50%;transform:translateY(-50%)}.jer-collapse-icon.jer-rotate-90{transform:translateY(-50%) rotate(-90deg)}.jer-collection-inner{position:relative}.jer-collection-text-edit,.jer-collection-text-edit-custom{display:flex;flex-direction:column;gap:.3em;align-items:flex-start;line-height:1.1em}.jer-collection-text-edit{width:fit-content}.jer-collection-text-area{box-sizing:content-box;resize:both;padding:.2em .5em 0;overflow:hidden;max-height:40em;line-height:1.25em;font-family:inherit;font-size:.85em}.jer-collection-input-button-row{display:flex;justify-content:flex-end;width:100%;font-size:150%;margin-top:.4em}.jer-collection-error-row-edit{position:absolute;bottom:.5em}.jer-error-slug{margin-left:1em}.jer-value-component{position:relative}.jer-value-and-buttons{display:flex;justify-content:flex-start;align-items:center;padding-left:.5em}.jer-value-error-row{position:absolute}.jer-value-string{line-height:1.3em;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}.jer-string-expansion{cursor:pointer;opacity:.6;filter:saturate(50%)}.jer-string-expansion.jer-show-less{font-size:80%}.jer-hyperlink{text-decoration:underline}.jer-input-text{box-sizing:content-box;resize:none;margin:0;height:1.2em;padding:.25em .5em .2em;min-width:6em;overflow:hidden;line-height:1.2em;font-family:inherit;font-size:.9em}.jer-input-boolean{transform:scale(1.5);margin-left:.3em;margin-right:.3em}.jer-key-text{word-break:break-word;line-height:1.1em;white-space:pre-wrap}.jer-value-invalid{opacity:.5;font-style:italic}.jer-input-number{min-width:3em;font-size:90%}.jer-edit-buttons,.jer-confirm-buttons{display:flex;align-items:center;cursor:pointer;height:1em;margin-right:.2em}.jer-edit-buttons>button,.jer-confirm-buttons>button,button.jer-collapse-icon,button.jer-string-expansion{appearance:none;background:none;border:none;margin:0;padding:0;font:inherit;color:inherit;vertical-align:baseline}.jer-input-buttons{gap:.4em}.jer-edit-buttons{gap:.4em;margin-left:.5em;opacity:0}.jer-custom-button:empty{display:none}.jer-confirm-buttons{gap:.2em;margin-left:.4em}.jer-edit-buttons:hover{opacity:1;position:relative}.jer-collection-header-row:hover>.jer-edit-buttons{opacity:1}.jer-value-main-row:hover>.jer-edit-buttons{opacity:1}.jer-value-and-buttons:hover>.jer-edit-buttons{opacity:1}.jer-copy-pulse{position:relative;transition:.3s}.jer-copy-pulse:hover{opacity:.85;transition:.3s;transform:scale(1.2)}.jer-copy-pulse:after{content:"";display:block;position:absolute;border-radius:50%;left:0;top:0;width:100%;height:100%;opacity:0;transition:all .5s;box-shadow:0 0 15px 5px var(--jer-icon-copy-color)}.jer-copy-pulse:active:after{box-shadow:0 0 0 0 var(--jer-icon-copy-color);position:absolute;border-radius:4em;left:0;top:0;opacity:1;transition:0s}.jer-copy-pulse:active{top:.07em}.jer-icon:hover{opacity:.85;transition:.3s;transform:scale(1.2)}.jer-empty-string{font-style:italic;font-size:90%}.jer-drag-n-drop-padding{height:.5em;border:1px dashed #b4b4b4;border-radius:.3em}.jer-clickzone{position:absolute;left:-1em;top:1.2em;height:calc(100% - .8em)}';const Vn="data-jer-styles",Va=(t,n)=>JSON.stringify(t,n,2),Fa={edit:"ERROR_UPDATE",add:"ERROR_ADD",delete:"ERROR_DELETE",rename:"ERROR_RENAME",move:"ERROR_MOVE"},Ha={edit:"UPDATE_ERROR",add:"ADD_ERROR",delete:"DELETE_ERROR",rename:"RENAME_ERROR",move:"MOVE_ERROR"},Bt=t=>{const n=d.useRef(t);t&&(n.current=t);const r=d.useRef((...s)=>n.current(...s));return t?r.current:void 0},Ba=[],za=["header","left"],$a={},Wa={},Ua={},Ya=[],Ja=({data:t,setData:n,buildNodeDataFromPathRef:r,commitRef:s,rootName:o="root",onUpdate:i=Tt,onChange:c,onError:u,onEditEvent:m,showErrorMessages:l=!0,showClipboardButton:a=!0,onCopy:p,indent:f=2,collapse:x=3,collapseAnimationTime:w=300,showCollectionCount:b="when-collapsed-or-filtered",allowEdit:v=!0,allowDelete:C=!0,allowAdd:I=!0,allowTypeSelection:A=!0,allowDrag:E=!1,searchFilter:g,searchText:y,searchDebounceTime:N=350,sortKeys:S=!1,showArrayIndexes:O=!0,arrayIndexStart:T=0,showStringQuotes:H=!0,showIconTooltips:le=!1,defaultValue:K=null,newKeyOptions:j,minWidth:k=250,maxWidth:L="min(600px, 90vw)",baseFontSize:B,stringTruncateLength:W=250,translations:$=$a,className:ce,id:de,customText:ye=Wa,customNodeDefinitions:re=Ba,customButtons:q=Ya,jsonParse:oe=JSON.parse,jsonStringify:Re=Va,TextEditor:pe,Select:U=Ma,errorDisplayTime:ie=2500,keyboardControls:Q=Ua,editorRef:ve,insertAtTop:we=!1,onCollapse:Ke,collapseClickZones:F=za})=>{const{getStyles:J,cssVars:Z}=mt(),{open:Ne,cancel:Ce,getSnapshot:We}=Ot(),ke=d.useMemo(()=>zt(x),[x]),Ve=d.useMemo(()=>((V,_)=>(te,fe,ne)=>((be,ae,M,z,se)=>{if(ae[z]){const $e=ae[z](M);if($e!==null)return $e}let je=z in be?be[z]:Ka[z];if(se!==void 0){const $e=jn(se)?se:{count:se};for(const[Xe,Me]of Object.entries($e))je=je==null?void 0:je.replace(`{{${Xe}}}`,String(Me))}return je})(V,_,fe,te,ne))($,ye),[$,ye]),[ft,Se]=d.useState(y),Ee=d.useRef(null);d.useEffect(()=>{Ce();const V=setTimeout(()=>Se(y),N);return()=>clearTimeout(V)},[y,N]);const De=wt(t,[],o),he=d.useRef(t);he.current=t;const Ye=d.useRef(n);Ye.current=n;const rt=d.useRef(Ve);rt.current=Ve;const Et=d.useRef(De);Et.current=De;const at=d.useRef(i);at.current=i;const Le=d.useRef(o);Le.current=o;const xe=d.useRef(void 0),_e=d.useCallback(()=>he.current,[]),st=Bt(c),Rt=Bt(u),Je=Bt(Ke),Ae=Bt(m),ze=Bt(p),Pe=d.useCallback(V=>{he.current=V,Ye.current(V)},[]),ot=d.useCallback((V,_)=>{Pe(Qe(he.current,V,_,"update").newData)},[Pe]),gt=d.useCallback(V=>{const _=he.current,te=Le.current,fe=xe.current,ne=Pe,{op:be,path:ae}=V;switch(be){case"edit":{const{newData:M,currentValue:z,newValue:se}=Qe(_,ae,V.value,"update"),je=wt(_,ae,te,fe);return{input:{...je,newData:M,event:"edit",newValue:se},nodeData:je,isNoOp:z===se,apply:()=>ne(M),revert:()=>ne(Qe(he.current,ae,z,"update").newData)}}case"delete":{const{newData:M,currentValue:z}=Qe(_,ae,"","delete"),se=wt(_,ae,te,fe);return{input:{...se,newData:M,event:"delete"},nodeData:se,isNoOp:!1,apply:()=>ne(M),revert:()=>ne(Qe(he.current,ae,z,"add",{insert:!0,insertBefore:se.index}).newData)}}case"add":{const M=[...ae,V.key],{newData:z,newValue:se}=Qe(_,M,V.value,"add",V.options),je=wt(z,M,te,fe);return{input:{...je,value:void 0,size:null,parentData:tt(_,ae)??null,fullData:_,newData:z,event:"add",newValue:se},nodeData:je,isNoOp:!1,apply:()=>ne(z),revert:()=>ne(Qe(he.current,M,"","delete").newData)}}case"rename":{const M=ae.slice(0,-1),z=ae[ae.length-1],{newKey:se}=V,je=tt(_,M),$e=Object.fromEntries(Object.entries(je).map(([Ze,Fe])=>Ze===z?[se,Fe]:[Ze,Fe])),{newData:Xe}=Qe(_,M,$e,"update"),Me=wt(_,ae,te,fe);return{input:{...Me,newData:Xe,event:"rename",newKey:se},nodeData:Me,isNoOp:z===se,apply:()=>ne(Xe),revert:()=>ne(Qe(he.current,M,je,"update").newData),extra:{oldKey:z,newKey:se}}}case"move":{const M=ae,{path:z,position:se}=V.to,je=_,{newData:$e,currentValue:Xe}=Qe(_,M,"","delete"),Me=M.slice(-1)[0],Ze=z.slice(0,-1),Fe=z.slice(-1)[0];let dt=typeof Fe=="number"?se==="above"?Fe:Fe+1:typeof Me=="number"?`arr_${Me}`:Me;M.slice(0,-1).join(".")===z.slice(0,-1).join(".")&&typeof Me=="number"&&typeof dt=="number"&&Me<dt&&(dt-=1);const D=typeof dt=="number"?{insert:!0}:se==="above"?{insertBefore:Fe}:{insertAfter:Fe},Y=[...Ze,dt],{newData:Te}=Qe($e,Y,Xe,"add",D),ue=wt(_,M,te,fe);return{input:{...ue,newData:Te,event:"move",newPath:Y},nodeData:ue,isNoOp:!1,apply:()=>ne(Te),revert:()=>ne(je)}}}},[Pe]),jt=d.useCallback((V,_)=>{const te=Ha[V.event],fe=()=>rt.current(Fa[V.event],Et.current),ne=M=>{const z=M instanceof Error&&M.message?M.message:typeof M=="string"&&M?M:fe();return{status:"error",error:{code:te,message:z}}},be=M=>{if(M===!1)return{status:"error",error:{code:te,message:fe()}};if(M===null)return{status:"cancel"};if(M&&typeof M=="object"){if(M.error!==void 0)return typeof M.error=="string"?{status:"error",error:{code:te,message:M.error}}:{status:"error",error:M.error};const z=M.data!==void 0,se=M.value!==void 0;if(z&&se&&console.warn("json-edit-react: onUpdate returned both { value } and { data }; { data } (whole-document) takes precedence and { value } is ignored."),z)return{status:"override",value:M.data,path:[]};if(se&&(V.event==="edit"||V.event==="add"))return{status:"override",value:M.value,path:V.path}}return{status:"commit"}};let ae;try{ae=at.current(V,_)}catch(M){return ne(M)}return Gn(ae)?ae.then(be,ne):be(ae)},[]),it=d.useMemo(()=>({runUpdate:i===Tt?void 0:jt,buildCommit:gt,applyValue:ot}),[jt,gt,ot,i]);s.current=it;const Ge=d.useMemo(()=>zt(v),[v]),lt=d.useMemo(()=>zt(C),[C]),xt=d.useMemo(()=>zt(I),[I]),qe=d.useMemo(()=>zt(E),[E]),ct=d.useMemo(()=>qa(g),[g]),yt=d.useMemo(()=>((V,_,te)=>{if(!_&&!te)return null;const fe=new Set,ne=new Map,be=_??Jt,ae=te??"",M=z=>{let se=be(z,ae);if(et(z.value)){let je=0;const $e=Array.isArray(z.value),Xe=Object.entries(z.value);for(const[Me,Ze]of Xe){const Fe=$e?Number(Me):Me,dt={key:Fe,path:[...z.path,Fe],level:z.level+1,index:je,value:Ze,size:et(Ze)?Object.keys(Ze).length:null,parentData:z.value,fullData:z.fullData};M(dt)&&(se=!0,je++)}ne.set(nt(z.path),je)}return se&&fe.add(nt(z.path)),se};return M(V),{visiblePaths:fe,visibleChildCounts:ne}})(De,ct,ft),[t,ft,ct,o]),R=d.useMemo(()=>(V=>{const _={...In};for(const te of Object.keys(In)){const fe=te,ne=V[fe];if(ne===void 0)continue;const be=te==="clipboardModifier"||te==="collapseModifier";if(ne===null){_[fe]=be?[]:null;continue}const ae=be?bn(ne):typeof ne=="string"?{key:ne}:ne;_[fe]=ae}return ca.forEach(te=>{V[te]===void 0&&V.confirm!==void 0&&(_[te]=_.confirm)}),_})(Q),[Q]),X=d.useCallback((V,_)=>((te,fe,ne)=>{for(const[be,ae]of Object.entries(fe))if(la(ne,te[be],be)){ne.preventDefault(),ae();break}})(R,_,V),[R]),me=d.useMemo(()=>{const V=Fn(re,"stringifyReplacer");return _=>Re(_,V)},[re,Re]),h=d.useMemo(()=>{const V=Fn(re,"parseReviver");return _=>{const te=oe(_,V);return Xn(te)}},[re,oe]),P=d.useRef(null),{setCollapseState:ee}=en(),G=d.useCallback((V,_)=>{S!==!1&&(typeof S!="function"?V.sort((te,fe)=>{const ne=_(te)[0],be=_(fe)[0];return ne<be?-1:ne>be?1:0}):V.sort((te,fe)=>S(_(te),_(fe))))},[S]);xe.current=G;const Ie=d.useCallback(V=>wt(_e(),V,Le.current,xe.current),[_e]);r.current=Ie,d.useImperativeHandle(ve,()=>{const V=Symbol("path-missing");return{collapse:_=>ee(_),startEdit:({path:_,overrideRestrictions:te=!1})=>tt(_e(),_,V)===V?"PATH_NOT_FOUND":te||Ge(wt(_e(),_,o,G))?(Ne(_,{force:!0}),!0):"RESTRICTED",confirm:()=>{var _;P.current&&(P.current.click(),((_=We().active)==null?void 0:_.phase)!=="editing"&&Ce())},cancel:()=>Ce()}},[ee,Ne,Ce,We,Ge,_e,o,G]);const Ct=jr(re,De),Kt=d.useMemo(()=>({object:we===!0||we==="object",array:we===!0||we==="array"}),[we]),vt={mainContainerRef:Ee,name:o,nodeData:De,getLatestData:_e,onChange:st,onError:Rt,onEditEvent:Ae,showErrorMessages:l,showCollectionCount:b,collapseFilter:ke,collapseAnimationTime:w,allowEditFilter:Ge,allowDeleteFilter:lt,allowAddFilter:xt,allowTypeSelection:A,allowDragFilter:qe,canDragOnto:!1,canAddHere:!1,showClipboardButton:a,onCopy:ze,sortKeys:S,sort:G,showArrayIndexes:O,arrayIndexStart:T,showStringQuotes:H,showIconTooltips:le,indent:f,defaultValue:K,newKeyOptions:j,stringTruncateLength:W,translate:Ve,customNodeDefinitions:re,customNodeData:Ct,customButtons:q,parentData:null,jsonParse:h,jsonStringify:me,TextEditor:pe,Select:U,errorDisplayTime:ie,handleKeyboard:X,keyboardControls:R,insertAtTop:Kt,onCollapse:Je,editConfirmRef:P,collapseClickZones:F},Vt={...J("container",De),...Z,minWidth:k,maxWidth:L};return Vt.fontSize=B??Vt.fontSize,e.jsx("div",{id:de,ref:Ee,className:`jer-editor-container ${ce??""}`,style:Vt,children:e.jsx(va,{value:yt,children:et(t)&&!Ct.renderCollectionAsValue?e.jsx(Nr,{data:t,...vt}):e.jsx(br,{data:t,showLabel:!0,...vt})})})};function Ga(t){d.useInsertionEffect(()=>{(()=>{if(typeof document>"u")return;const o=document.head.querySelector(`style[${Vn}]`);if(o)return void(o.textContent!==pn&&(o.textContent=pn));const i=document.createElement("style");i.setAttribute(Vn,""),i.textContent=pn,document.head.appendChild(i)})()},[]);const n=d.useRef(void 0),r=d.useRef(void 0),s=t;return e.jsx(pa,{theme:s.theme??sn,children:e.jsx(ya,{onEditEvent:s.onEditEvent,onCollapse:s.onCollapse,buildNodeDataFromPathRef:n,commitRef:r,children:e.jsx(Ja,{...s,buildNodeDataFromPathRef:n,commitRef:r})})})}const Qe=(t,n,r,s,o={})=>{if(n.length===0)return{currentData:t,newData:r,currentValue:t,newValue:r};const i={remove:s==="delete",...o},c=s!=="add"?tt(t,n):void 0;return{currentData:t,newData:aa(t,n,r,i),currentValue:c,newValue:s!=="delete"?r:void 0}},zt=t=>typeof t=="boolean"?()=>t:typeof t=="number"?({level:n})=>n>=t:t,qa=t=>{if(t!==void 0)return t==="value"?Jt:t==="key"?Kn:t==="all"?(n,r)=>Jt(n,r)||Kn(n,r):t},Fn=(t,n)=>{const r=n==="stringifyReplacer"?[s=>s===void 0?Zn:s]:[];if(r.push(...t.map(s=>s[n]).filter(s=>!!s)),r.length!==0)return(s,o)=>{let i=o;for(const c of r)i=c(i);return i}};function Xa(t){const{editorRef:n,...r}=t,s=d.useRef(null);return d.useImperativeHandle(n,()=>({collapse:o=>{var i;return(i=s.current)==null?void 0:i.collapse(o)}}),[]),e.jsx(Ga,{...r,editorRef:s,setData:Tt,allowEdit:!1,allowAdd:!1,allowDelete:!1,allowDrag:!1})}const Yt=50,Za=2e5,Er=d.createContext(""),Cr=d.createContext(null),Qa={container:{backgroundColor:"transparent",color:"var(--text)",fontFamily:"var(--font-mono)",padding:"8px 0 8px 20px"},property:"var(--text)",string:"var(--ok)",number:"var(--accent)",boolean:"var(--accent)",null:"var(--text-secondary)",bracket:"var(--text-secondary)",itemCount:"var(--text-secondary)",iconCollection:"var(--text-secondary)",iconCopy:"var(--text-secondary)",collectionInner:{borderLeft:"1px solid var(--line)"},inputHighlight:"var(--ctl-fill)"},es=new Set(["resourceLogs","resourceMetrics","resourceSpans","scopeLogs","scopeMetrics","scopeSpans","logRecords","metrics","spans"]),ts=({path:t,level:n,size:r})=>r!==null&&r>Yt?n>0:n===0?!1:!t.every(s=>typeof s=="number"||es.has(s)),ns=[{condition:({size:t})=>t!==null&&t>Yt,renderCollectionAsValue:!0,component:({value:t})=>e.jsx(Dr,{value:t,root:!0})}];function kr({name:t}){return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"tr-json-key",children:typeof t=="string"?JSON.stringify(t):t}),": "]})}function Sr({value:t,name:n,root:r=!1}){if(t!==null&&typeof t=="object")return e.jsx(Dr,{value:t,name:n,root:r});const s=t===null?"null":typeof t;return e.jsxs("div",{children:[n!==void 0&&e.jsx(kr,{name:n}),e.jsx("span",{className:`tr-json-${s}`,children:JSON.stringify(t)})]})}function Dr({value:t,name:n,root:r}){const s=Oe(),[o,i]=d.useState(r),[c,u]=d.useState(Yt),m=d.useContext(Cr);d.useEffect(()=>{m&&i(!m.collapsed&&r)},[m,r]);const l=d.useContext(Er).trim().toLowerCase(),a=Array.isArray(t),p=d.useMemo(()=>Array.isArray(t)?null:Object.keys(t),[t]),f=d.useMemo(()=>l?(p??Array.from({length:t.length},(b,v)=>v)).filter(b=>String(b).toLowerCase().includes(l)||JSON.stringify(Array.isArray(t)?t[Number(b)]:t[b]).toLowerCase().includes(l)):null,[t,p,l]),x=f?f.length:a?t.length:p.length,w=Math.min(c,x);return e.jsxs("details",{open:o,onToggle:b=>{b.target===b.currentTarget&&i(b.currentTarget.open)},children:[e.jsxs("summary",{children:[n!==void 0&&e.jsx(kr,{name:n}),e.jsxs("span",{children:[a?"[":"{",x===0?a?"]":"}":"…"]}),x>0&&e.jsx("span",{className:"tr-count",children:s(a?"radar.json.items":"radar.json.keys",{count:x})})]}),o&&x>0&&e.jsxs("div",{children:[Array.from({length:w},(b,v)=>{const C=f?f[v]:p?p[v]:v,I=Array.isArray(t)?t[Number(C)]:t[C];return e.jsx(Sr,{name:C,value:I},C)}),w<x&&e.jsx("button",{type:"button",className:"btn",onClick:()=>u(b=>b+Yt),children:s("radar.json.more",{n:Math.min(Yt,x-w),rest:x-w})}),e.jsx("div",{children:a?"]":"}"})]})]})}function rs({value:t}){const n=d.useMemo(()=>{const r=JSON.stringify(t,null,2);if(r.length>Za)return r;const s=[],o=/"(?:\\.|[^"\\])*"(\s*:)?|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|\b(?:true|false|null)\b/g;let i=0;for(const c of r.matchAll(o)){const u=c.index;u>i&&s.push(r.slice(i,u));const m=c[0],l=c[1]||"",a=l?"key":m[0]==='"'?"string":m==="null"?"null":m==="true"||m==="false"?"boolean":"number";s.push(e.jsx("span",{className:`tr-json-${a}`,children:l?m.slice(0,-l.length):m},u)),l&&s.push(l),i=u+m.length}return i<r.length&&s.push(r.slice(i)),s},[t]);return e.jsx("pre",{className:"tr-value",children:n})}function Tr({value:t,initialMode:n="tree"}){const r=Oe(),[s,o]=d.useState(n),[i,c]=d.useState(""),[u,m]=d.useState(!1),l=d.useRef(null),a=d.useRef(null),[p,f]=d.useState(null);return d.useEffect(()=>{const x=a.current;if(!x)return;const w=()=>x.querySelectorAll(".jer-editor-container button[tabindex='-1']").forEach(v=>{v.tabIndex=0});w();const b=new MutationObserver(w);return b.observe(x,{childList:!0,subtree:!0}),()=>b.disconnect()},[s,t]),e.jsxs("div",{children:[e.jsxs("div",{className:"tr-detail-tabs",role:"group","aria-label":r("radar.json.view"),children:[e.jsx("button",{type:"button",className:"btn","aria-pressed":s==="tree",onClick:()=>o("tree"),children:r("radar.json.tree")}),e.jsx("button",{type:"button",className:"btn","aria-pressed":s==="raw",onClick:()=>o("raw"),children:r("radar.json.raw")})]}),s==="raw"?e.jsx(rs,{value:t}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"tr-json-tools",children:[e.jsxs("label",{className:"tr-json-search",children:[r("radar.json.search"),e.jsx("input",{type:"search",className:"tr-input",value:i,placeholder:r("radar.json.find"),onChange:x=>c(x.target.value)})]}),e.jsx("button",{type:"button",className:"btn",onClick:()=>{var x;f(w=>({revision:((w==null?void 0:w.revision)??0)+1,collapsed:!0})),(x=l.current)==null||x.collapse({path:[],collapsed:!0,includeChildren:!0})},children:r("radar.json.collapse")}),e.jsx("button",{type:"button",className:"btn",onClick:()=>{var x;f(w=>({revision:((w==null?void 0:w.revision)??0)+1,collapsed:!1})),(x=l.current)==null||x.collapse([{path:[],collapsed:!0,includeChildren:!0},{path:[],collapsed:!1,includeChildren:!1}])},children:r("radar.json.openRoot")})]}),e.jsx("p",{className:"tr-note",children:r("radar.json.copyHint")}),u&&e.jsx("p",{role:"alert",className:"tr-capture-error",children:r("radar.clipboard.value")}),e.jsx(Er.Provider,{value:i,children:e.jsx(Cr.Provider,{value:p,children:e.jsx("div",{ref:a,className:"tr-value tr-json-tree",children:t===null||typeof t!="object"?e.jsx(Sr,{value:t}):e.jsx(Xa,{data:t,editorRef:l,theme:Qa,rootName:"",collapse:i?!1:ts,collapseAnimationTime:0,searchText:i||void 0,searchFilter:i?"all":void 0,searchDebounceTime:200,customNodeDefinitions:ns,minWidth:0,maxWidth:"100%",baseFontSize:"inherit",indent:2,stringTruncateLength:300,showIconTooltips:!0,translations:{ITEM_SINGLE:r("radar.json.lib.item"),ITEMS_MULTIPLE:r("radar.json.lib.items"),ITEMS_FILTERED:r("radar.json.lib.filtered"),SHOW_LESS:r("radar.json.lib.showLess"),SHOW_MORE:r("radar.json.lib.showMore"),EMPTY_STRING:r("radar.json.lib.empty"),TOOLTIP_COPY:r("radar.json.lib.copy"),TOOLTIP_COLLAPSE:r("radar.json.lib.collapse"),TOOLTIP_EXPAND:r("radar.json.lib.expand")},onCopy:({success:x})=>m(!x)},i?"search":"browse")})})})]})]})}function as(t,n=!1,r=pt){var f,x,w,b,v;const s=!!t&&(t.featureEnabled??t.enabled??["awaiting","receiving","capturing"].includes(t.state)),o=((f=t==null?void 0:t.sources)==null?void 0:f.filter(C=>C.active).length)??0,i=/permission/i.test((t==null?void 0:t.setupError)??"")||!!((x=t==null?void 0:t.sources)!=null&&x.some(C=>/permission/i.test(C.error??""))),c=/^Install /.test((t==null?void 0:t.setupError)??""),u=(t==null?void 0:t.events.length)??0,m=((w=t==null?void 0:t.observations)==null?void 0:w.length)??0,l=!!(t!=null&&t.bytes)||m>0||u>0;let a=r("radar.monitor.stopped"),p="neutral";return n?(a=r("radar.monitor.lost"),p="error"):t?s&&i?(a=r("radar.monitor.permission"),p="attention"):s&&c?(a=r("radar.monitor.setup"),p="attention"):t.automatic&&s&&!((b=t.sources)!=null&&b.length)&&t.state!=="error"?a=r("radar.monitor.waiting"):t.state==="error"?(a=r("radar.monitor.error"),p="error"):s&&o>0&&o<(((v=t.sources)==null?void 0:v.length)??0)?(a=r("radar.monitor.some"),p="attention"):s&&i?(a=r("radar.monitor.permission"),p="attention"):s&&t.state==="interrupted"?(a=r("radar.monitor.reconnecting"),p="attention"):s&&(o||!t.managed&&["receiving","capturing"].includes(t.state))?(a=r("radar.monitor.listening"),p="ok"):s&&(a=t.managed?r("radar.monitor.starting"):r("radar.monitor.activation")):a=r("radar.monitor.reading"),{enabled:s,active:o,permission:i,install:c,decoded:u,observed:m,traffic:l,title:a,tone:p}}const Ue=t=>t&&typeof t=="object"&&!Array.isArray(t)?t:{},kt=t=>Array.isArray(t)?t:[],qt=t=>new Date(t).toLocaleTimeString($n()),Hn="agent-dag.radar-feed-width",ss=(t,n=pt)=>n(`radar.outcome.${t.outcome}`),os=["encrypted","joined_midstream","capture_gap","decode_failed","payload_limit","stream_limit","connection_limit","unsupported_compression","unsupported_link","unsupported_network","fragmented","unknown_export","connection_closed","idle_connection"],hn=(t,n)=>os.includes(t)?n(`radar.issue.${t}`):void 0;function is(t,n){return/prompt/i.test(t)?n("radar.attr.prompt"):/response|completion/i.test(t)?n("radar.attr.response"):/tool/i.test(t)?n("radar.attr.tool"):/session/i.test(t)?n("radar.attr.session"):/user|email|account/i.test(t)?n("radar.attr.user"):/token|cost|duration|latency/i.test(t)?n("radar.attr.usage"):n("radar.attr.other")}function Nt({value:t}){return e.jsx("pre",{className:"tr-value",children:typeof t=="string"?t:JSON.stringify(t,null,2)})}function ls({value:t}){const n=Oe();return e.jsx("dl",{className:"tr-attributes",children:kt(t).map((r,s)=>{const o=Ue(r);return e.jsxs("div",{children:[e.jsxs("dt",{children:[e.jsx("code",{children:String(o.key??n("radar.attr.unnamed"))}),e.jsx("span",{children:is(String(o.key),n)})]}),e.jsx("dd",{children:e.jsx(Nt,{value:Ht(o.value)})})]},s)})})}const cs=[["error",["error.message","exception.message","error","error_type"]],["prompt",an],["response",vn],["project",Yn],["directory",Jn],["repository",["repository.url","repo_url","vcs.repository.url.full"]],["branch",["git.branch","branch","vcs.ref.head.name"]],["tool",["tool_name","tool.name","gen_ai.tool.name"]],["toolInput",["tool_parameters","tool_input","tool.input"]],["toolResult",["tool_result","tool_response","tool.output"]],["model",["model","gen_ai.request.model","gen_ai.response.model"]],["inputTokens",["input_tokens","gen_ai.usage.input_tokens"]],["outputTokens",["output_tokens","gen_ai.usage.output_tokens"]],["cacheRead",["cache_read_tokens"]],["cacheCreation",["cache_creation_tokens"]],["cost",["cost_usd"]],["duration",["duration_ms","interaction.duration_ms"]],["ttft",["ttft_ms"]],["success",["success"]],["stopReason",["stop_reason","gen_ai.response.finish_reasons"]],["tokenType",["type"]]];function Or({value:t}){const n=Oe(),r=Dt(t);return e.jsx("dl",{className:"tr-highlights",children:cs.flatMap(([s,o])=>{const i=ut(r,o).key;if(!i)return[];const c=r[i];if(c===null||c==="")return[];const u=n(`radar.field.${s}`);if((s==="prompt"||s==="response")&&gn(c))return[e.jsxs("div",{"data-field":u,children:[e.jsx("dt",{children:u}),e.jsxs("dd",{children:[e.jsx("span",{className:"tr-evidence-status",children:n("radar.payload.redacted")}),e.jsx("p",{className:"tr-note",children:n("radar.payload.redactedNote")})]})]},s)];const m=typeof c=="string"?c:JSON.stringify(c,null,2);return[e.jsxs("div",{"data-field":u,children:[e.jsx("dt",{children:u}),e.jsx("dd",{children:m.length>800?e.jsxs(e.Fragment,{children:[e.jsx(Nt,{value:m.slice(0,800)+"…"}),e.jsxs("details",{className:"tr-details",children:[e.jsx("summary",{children:n(s==="prompt"?"radar.payload.showFullPrompt":s==="response"?"radar.payload.showFullResponse":"radar.payload.showFull")}),e.jsx(Nt,{value:c})]})]}):e.jsx(Nt,{value:c})})]},s)]})})}function kn({label:t,value:n}){const[r,s]=d.useState(!1);return e.jsxs("details",{className:"tr-details",onToggle:o=>{o.target===o.currentTarget&&s(o.currentTarget.open)},children:[e.jsx("summary",{children:t}),r&&e.jsx(Tr,{value:n})]})}function ds({record:t}){const n=Oe(),r=["gauge","sum","histogram","exponentialHistogram","summary"].find(s=>t[s]);return r?e.jsxs("div",{children:[t.description&&e.jsx("p",{className:"tr-note",children:String(t.description)}),kt(Ue(t[r]).dataPoints).map((s,o)=>{const i=Ue(s);return e.jsxs("section",{children:[e.jsxs("dl",{className:"tr-facts",children:[e.jsxs("div",{children:[e.jsx("dt",{children:n("radar.payload.measurement")}),e.jsx("dd",{children:r})]}),i.asInt!==void 0||i.asDouble!==void 0?e.jsxs("div",{children:[e.jsx("dt",{children:n("radar.payload.value")}),e.jsx("dd",{children:e.jsxs("code",{children:[String(i.asInt??i.asDouble)," ",String(t.unit??"")]})})]}):null,i.count!==void 0&&e.jsxs("div",{children:[e.jsx("dt",{children:n("radar.payload.count")}),e.jsx("dd",{children:e.jsx("code",{children:String(i.count)})})]}),i.sum!==void 0&&e.jsxs("div",{children:[e.jsx("dt",{children:n("radar.payload.sum")}),e.jsx("dd",{children:e.jsxs("code",{children:[String(i.sum)," ",String(t.unit??"")]})})]})]}),e.jsx(Or,{value:i.attributes}),e.jsx(kn,{label:n("radar.payload.allMeasurement"),value:i})]},o)})]}):null}function us({record:t}){const n=Oe();let r=null;try{r=`${Number(BigInt(String(t.endTimeUnixNano))-BigInt(String(t.startTimeUnixNano)))/1e6} ms`}catch{r=null}return e.jsxs("dl",{className:"tr-facts",children:[e.jsxs("div",{children:[e.jsx("dt",{children:n("radar.payload.duration")}),e.jsx("dd",{children:r??n("radar.payload.notIncluded")})]}),t.kind&&e.jsxs("div",{children:[e.jsx("dt",{children:n("radar.payload.spanKind")}),e.jsx("dd",{children:String(t.kind)})]}),t.status&&e.jsxs("div",{children:[e.jsx("dt",{children:n("radar.payload.spanStatus")}),e.jsx("dd",{children:e.jsx(Nt,{value:t.status})})]})]})}const ps=[["prompt",an],["response",vn]];function hs({fields:t}){const n=Oe();return e.jsx("dl",{className:"tr-content-evidence",children:ps.map(([r,s])=>{const o=t.map(u=>ut(u,s)),i=o.some(u=>u.state==="included"),c=o.some(u=>u.state==="redacted");return e.jsxs("div",{children:[e.jsx("dt",{children:n(`radar.field.${r}`)}),e.jsx("dd",{"data-evidence":i?"included":c?"redacted":"absent",children:n(i?c?"radar.payload.includedSome":"radar.payload.included":c?"radar.payload.redactedInExport":"radar.payload.notInExport")})]},String(r))})})}function ms({fields:t,sessions:n}){const r=Oe(),o=t.map(c=>na(c,n)).filter(c=>c.source!=="absent"),i=o.filter((c,u)=>o.findIndex(m=>m.source===c.source&&m.project.value===c.project.value&&m.directory.value===c.directory.value)===u);return e.jsxs("section",{className:"tr-project-context","aria-label":r("radar.payload.projectContext"),children:[e.jsx("h4",{children:r("radar.payload.projectDirectory")}),i.length?i.map((c,u)=>e.jsxs("div",{children:[c.project.value!==null&&(c.project.state==="redacted"?e.jsx("p",{className:"tr-note",children:r("radar.payload.projectRedacted")}):e.jsx(Nt,{value:c.project.value})),c.directory.value!==null&&c.directory.value!==c.project.value&&(c.directory.state==="redacted"?e.jsx("p",{className:"tr-note",children:r("radar.payload.directoryRedacted")}):e.jsx(Nt,{value:c.directory.value})),e.jsx("p",{className:"tr-note",children:c.source==="export"?r("radar.payload.included"):r("radar.payload.fromLocal")})]},u)):e.jsx("p",{className:"tr-note",children:r("radar.payload.noContext")})]})}function Bn({record:t,signal:n}){const r=Oe(),s=Dt(t.attributes),o=t.eventName??t.name??s["event.name"]??r(n==="logs"?"radar.payload.logRecord":"radar.payload.record"),i=Ht(t.body),c=typeof i=="string"&&(i===o||i===`claude_code.${o}`);return e.jsxs("article",{className:"tr-record",children:[e.jsx("h4",{children:String(o)}),t.body&&!c&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"tr-note",children:r("radar.payload.body")}),e.jsx(Nt,{value:i})]}),n==="metrics"&&e.jsx(ds,{record:t}),n==="traces"&&e.jsx(us,{record:t}),t.attributes&&e.jsx(Or,{value:t.attributes}),t.severityText&&e.jsx("p",{className:"tr-note",children:r("radar.payload.severity",{value:String(t.severityText)})}),e.jsx(kn,{label:r("radar.payload.allRecord"),value:t})]})}function fs({scope:t,signal:n,item:r}){const s=Oe(),o=kt(t[r]).map(Ue),i=n==="logs"?o.map((p,f)=>({record:p,index:f,priority:ta(p)})).sort((p,f)=>p.priority-f.priority||p.index-f.index):[],c=i.some(p=>p.priority<4),u=c?i.filter(p=>p.priority<4).map(({record:p})=>p):o,m=c?i.filter(p=>p.priority===4).map(({record:p})=>p):[],[l,a]=d.useState(!1);return e.jsxs("div",{children:[u.map((p,f)=>e.jsx(Bn,{record:p,signal:n},f)),!!m.length&&e.jsxs("details",{className:"tr-details",onToggle:p=>{p.target===p.currentTarget&&a(p.currentTarget.open)},children:[e.jsx("summary",{children:s("radar.payload.other",{count:m.length})}),l&&m.map((p,f)=>e.jsx(Bn,{record:p,signal:n},f))]}),t.scope&&e.jsx(kn,{label:s("radar.payload.instrumentation"),value:t.scope})]})}function gs({payload:t,signal:n,sessions:r=[]}){const s=Oe(),o=n==="traces"?"Spans":n==="logs"?"Logs":"Metrics",i=n==="traces"?"spans":n==="logs"?"logRecords":"metrics",c=kt(t["resource"+o]).map(Ue),u=c.flatMap(m=>{const l=Dt(Ue(m.resource).attributes),a=kt(m["scope"+o]).flatMap(p=>kt(Ue(p)[i]).map(Ue));return a.length?a.flatMap(p=>{const f={...l,...Dt(p.attributes)},x=["gauge","sum","histogram","exponentialHistogram","summary"].find(b=>p[b]),w=x?kt(Ue(p[x]).dataPoints):[];return w.length?w.map(b=>({...f,...Dt(Ue(b).attributes)})):[f]}):[l]});return e.jsxs("div",{className:"tr-decoded",children:[e.jsx(ms,{fields:u,sessions:r}),e.jsx(hs,{fields:u}),e.jsxs("details",{className:"tr-details tr-export-scope",children:[e.jsx("summary",{children:s("radar.payload.aboutContent")}),e.jsx("p",{className:"tr-note",children:s("radar.payload.aboutContentNote")})]}),c.map((m,l)=>e.jsxs("section",{children:[kt(m["scope"+o]).map((a,p)=>e.jsx(fs,{scope:Ue(a),signal:n,item:i},p)),e.jsxs("details",{className:"tr-details",children:[e.jsx("summary",{children:s("radar.payload.resource")}),e.jsx(ls,{value:Ue(m.resource).attributes})]})]},l))]})}function js({platform:t,install:n,asking:r,permission:s,onAllow:o,onCopy:i,copied:c}){const u=Oe(),m=t==="win32",l=t==="darwin",a=s&&(s.outcome==="unavailable"||s.outcome==="failed");return e.jsxs("section",{className:"tr-activation","aria-labelledby":"tr-setup-title",children:[e.jsx("strong",{id:"tr-setup-title",children:u("radar.setup.title")}),e.jsx("p",{className:"tr-note",children:u(m?"radar.setup.whyWin":l?"radar.setup.whyMac":"radar.setup.whyLinux")}),e.jsx("p",{className:"tr-note",children:u(m?n?"radar.setup.winInstall":"radar.setup.winRestricted":l?"radar.setup.mac":n?"radar.setup.linuxInstall":"radar.setup.linux")}),m?e.jsx("a",{className:"btn primary",href:"https://www.wireshark.org/download.html",target:"_blank",rel:"noreferrer",children:u("radar.setup.wireshark")}):e.jsx("button",{type:"button",className:"btn primary","aria-busy":r,onClick:()=>{r||o()},children:u(r?"radar.setup.waiting":"radar.setup.allow")}),e.jsxs("div",{role:"status",children:[(s==null?void 0:s.outcome)==="cancelled"&&e.jsx("p",{className:"tr-note",children:u("radar.setup.cancelled")}),(s==null?void 0:s.outcome)==="granted"&&e.jsx("p",{className:"tr-note",children:u("radar.setup.granted")}),a&&e.jsxs("p",{className:"tr-note",children:[Be(s.message,u),s.command&&" "+u("radar.setup.runInstead")]})]}),a&&s.command&&e.jsxs("div",{className:"tr-command-entry",children:[e.jsx("div",{children:e.jsx("button",{type:"button",className:"btn",onClick:()=>i(s.command),children:u(c?"radar.copied":"radar.setup.copyCommand")})}),e.jsx("pre",{className:"tr-command",children:s.command})]})]})}function xs({capture:t,radar:n,failed:r,busy:s,pendingAction:o=null,error:i,permission:c=null,action:u,sessionFilter:m="all",sessions:l=[]}){var Ae,ze,Pe,ot,gt,jt,it,Ge,lt,xt,qe,ct,yt,R,X,me;const a=Oe(),p=Un([...((Ae=n==null?void 0:n.config)==null?void 0:Ae.variables)??[],...(n==null?void 0:n.environment)??[]]),f=[...new Set(p.map(Yr).filter(h=>!!h))],[x,w]=d.useState(null),[b,v]=d.useState(null),[C,I]=d.useState("all"),[A,E]=d.useState("all"),g=d.useRef(null),[y,N]=d.useState(()=>{const h=Number(Vr(Hn));return h>=28&&h<=65?h:34}),S=h=>{N(h),Hr(Hn,String(h))},[O,T]=d.useState(!1),[H,le]=d.useState(100),[K,j]=d.useState(null),[k,L]=d.useState(null),[B,W]=d.useState(null),[$,ce]=d.useState(!1),de=d.useRef(0),[ye,re]=d.useState("summary"),[q,oe]=d.useState(null),[Re,pe]=d.useState(0),U=d.useRef(null),ie=(t==null?void 0:t.events)??[],Q=!!(ie.length||(ze=t==null?void 0:t.observations)!=null&&ze.length),ve=new Map(ie.map(h=>[h.id,h])),we=k?k.map(h=>ve.get(h.id)).filter(h=>!!h):ie,Ke=we.filter(h=>{var P,ee;return(!O||h.content.includes("Prompt"))&&(A==="all"||h.signal===A)&&(C==="all"||C===h.destination)&&(m==="all"||(m==="unidentified"?!((P=h.sessionIds)!=null&&P.length):(ee=h.sessionIds)==null?void 0:ee.includes(m)))}),F=((t==null?void 0:t.observations)??[]).filter(h=>!O&&(K===null||K.includes(h.id))&&A==="all"&&(m==="all"||m==="unidentified")&&(C==="all"||C===h.destination)),J=F.find(h=>h.id===x),Z=x!==null?void 0:b===null?Ke[0]:Ke.find(h=>h.id===b),Ne=[...Ke.map(h=>({kind:"export",event:h})),...F.map(h=>({kind:"observation",event:h}))].sort((h,P)=>P.event.at-h.event.at||P.event.id-h.event.id),Ce=new Set(k==null?void 0:k.map(h=>h.id)),We=new Set(K),ke=k===null?0:ie.filter(h=>!Ce.has(h.id)).length+((t==null?void 0:t.observations)??[]).filter(h=>!We.has(h.id)).length,Ve=Z==null?void 0:Z.id;d.useEffect(()=>{v(null),w(null),le(100)},[m,A,C,O]),d.useEffect(()=>{b!==null||x!==null||(Ke.length?v(Ke[0].id):F.length&&w(F[0].id))},[(Pe=Ke[0])==null?void 0:Pe.id,(ot=F[0])==null?void 0:ot.id,b,x]),d.useEffect(()=>{if(oe(null),W(null),Ve===void 0)return;const h=new AbortController;let P=!0;const ee=setTimeout(()=>h.abort(),5e3);return fetch(`/api/system/traffic-radar/capture/event?id=${Ve}`,{signal:h.signal}).then(async G=>{if(!G.ok)throw new nn(a("radar.insp.expired"));const Ie=await G.json();P&&!h.signal.aborted&&oe({id:Ve,payload:Ie.payload})}).catch(G=>{P&&oe({id:Ve,error:h.signal.aborted?a("radar.insp.timeout"):rn(G,a("radar.insp.readFailed"))})}).finally(()=>clearTimeout(ee)),()=>{P=!1,clearTimeout(ee),h.abort()}},[Ve,x,Re]),d.useEffect(()=>{if(!B||B==="failed")return;const h=setTimeout(()=>W(null),2e3);return()=>clearTimeout(h)},[B]),d.useEffect(()=>{if(!$)return;const h=setTimeout(()=>ce(!1),5e3);return()=>clearTimeout(h)},[$]);const ft=(t==null?void 0:t.platform)??(n==null?void 0:n.platform),Se=as(t,r,a),Ee=Se.enabled,De=!!(t!=null&&t.managed),he=De&&(Se.permission||Se.install),Ye=Se.active,rt=((gt=t==null?void 0:t.sources)==null?void 0:gt.length)??1,Et=Se.title,at=h=>{const P=Wn(o??(s?"capture":null),h);return{disabled:P.disabled,"aria-busy":P.busy}},Le=h=>{var P,ee,G;w(null),v(h.id),typeof window<"u"&&((P=window.matchMedia)!=null&&P.call(window,"(max-width: 640px)").matches)&&((ee=U.current)==null||ee.focus({preventScroll:!0}),(G=U.current)==null||G.scrollIntoView({block:"start",behavior:"auto"}))},xe=()=>{const h=Date.now(),P=Fr({armedFor:$?"history":null,target:"history",armedAt:de.current,now:h,gapMs:350});if(P==="arm"){de.current=h,ce(!0);return}P!=="ignore"&&(ce(!1),v(null),w(null),L(null),j(null),u("clear"))},_e=async(h,P)=>{try{await navigator.clipboard.writeText(h),W(P)}catch{W("failed")}},st=(h=[])=>h.length?h.map(P=>{var ee;return`${((ee=l.find(G=>G.id===P))==null?void 0:ee.label)??a("radar.session")} · ${P.slice(0,8)}`}).join(", "):a("radar.session.unidentified"),Rt=new Set([...((jt=t==null?void 0:t.sources)==null?void 0:jt.map(h=>h.destination))??[],...f]),Je=(n==null?void 0:n.status)==="observing"?n.connections.filter(h=>h.active&&Rt.has(h.destination)):[];return e.jsxs("div",{className:"tr-telemetry",children:[e.jsx("div",{className:"tr-capture-bar",children:e.jsxs("div",{children:[e.jsxs("h3",{role:"status","aria-live":"polite",children:[e.jsx("span",{className:`tr-live-dot tr-dot-${Se.tone}`}),Et]}),e.jsx("p",{className:"tr-note",children:r?a("radar.cap.noteFailed"):he?(it=t==null?void 0:t.sources)!=null&&it.length?a("radar.cap.noteSetupFound"):a("radar.cap.noteSetup"):Ee?!((Ge=t==null?void 0:t.sources)!=null&&Ge.length)&&!(t!=null&&t.destination)?a("radar.cap.noteLooking"):Ye?a("radar.cap.noteListening",{active:Ye,count:rt,traffic:Se.traffic?a("radar.cap.trafficSeen"):a("radar.cap.trafficNone")}):a("radar.cap.noteNotReady"):a("radar.cap.noteIdle")}),Ee&&(((lt=t==null?void 0:t.sources)==null?void 0:lt.length)||(t==null?void 0:t.destination))&&e.jsxs("div",{className:"tr-active-destinations",role:"group","aria-label":a("radar.cap.monitored"),children:[e.jsx("span",{children:a("radar.cap.destination",{count:rt})}),(xt=t==null?void 0:t.sources)!=null&&xt.length?t.sources.map(h=>e.jsxs("span",{className:"tr-destination-entry",children:[e.jsx("code",{children:h.destination}),(rt>1||!h.active)&&e.jsx("span",{className:h.active?"tr-source-ready":"tr-source-pending",children:h.active?a("radar.cap.sourceReady"):a("radar.cap.sourcePending")}),!h.active&&h.error&&!he&&e.jsx("span",{className:"tr-source-error",children:Be(h.error,a)})]},h.destination)):(t==null?void 0:t.destination)&&e.jsx("code",{children:t.destination})]})]})}),(n==null?void 0:n.status)==="unsupported"&&e.jsx("p",{className:"tr-capture-error",role:"status",children:a("radar.cap.unsupported")}),(t==null?void 0:t.setupError)&&!he&&e.jsx("p",{className:"tr-capture-error",role:"status",children:Be(t.setupError,a)}),i&&e.jsx("p",{className:"tr-capture-error",role:"alert",children:Be(i,a)}),he&&e.jsx(js,{platform:ft,install:Se.install,asking:o==="permission",permission:c,onAllow:()=>void u("permission"),onCopy:h=>void _e(h,"setup"),copied:B==="setup"}),B==="failed"&&e.jsx("p",{className:"tr-capture-error",role:"alert",children:a("radar.clipboard.text")}),e.jsxs("div",{className:"tr-workspace","data-empty":!Q,ref:g,style:{"--tr-feed-width":`${y}%`},children:[e.jsxs("section",{className:"tr-feed","aria-label":a("radar.feed.label"),children:[Q&&e.jsxs("div",{className:"tr-feed-head",children:[e.jsxs("h3",{children:[a("radar.feed.activity")," ",e.jsx("span",{className:"tr-count",children:Ne.length})]}),e.jsxs("label",{className:"tr-prompt-filter",title:a("radar.feed.promptHint"),children:[e.jsx("span",{children:a("radar.feed.withPrompt")}),e.jsx("button",{type:"button",className:"switch",role:"switch","aria-label":a("radar.feed.withPrompt"),"aria-checked":O,onClick:()=>T(h=>!h),children:e.jsx("span",{className:"switch-knob"})})]})]}),(Q||k!==null||A!=="all"||C!=="all")&&e.jsxs("details",{className:"tr-details tr-feed-options",children:[e.jsx("summary",{children:a(A!=="all"||C!=="all"?"radar.feed.filtered":"radar.feed.filters")}),e.jsxs("div",{className:"tr-filter",children:[e.jsx("label",{children:e.jsxs(mn,{"aria-label":a("radar.feed.type"),value:A,onChange:h=>{v(null),E(h.target.value)},children:[e.jsx("option",{value:"all",children:a("radar.feed.allTypes")}),e.jsx("option",{value:"logs",children:a("radar.feed.events")}),e.jsx("option",{value:"metrics",children:a("radar.feed.metrics")}),e.jsx("option",{value:"traces",children:a("radar.feed.traces")})]})}),e.jsx("label",{children:e.jsxs(mn,{"aria-label":a("radar.feed.destination"),value:C,onChange:h=>{v(null),I(h.target.value)},children:[e.jsx("option",{value:"all",children:a("radar.feed.allDestinations")}),[...new Set([...f,...((qe=t==null?void 0:t.sources)==null?void 0:qe.map(h=>h.destination))??[],...ie.map(h=>h.destination),...((t==null?void 0:t.observations)??[]).map(h=>h.destination)])].map(h=>e.jsx("option",{value:h,children:h},h))]})})]}),e.jsxs("div",{className:"tr-history-toolbar",children:[e.jsx("p",{className:"tr-history",title:a("radar.feed.historyHint"),children:a("radar.feed.history",{decoded:Ke.length,observed:F.length})}),e.jsxs("div",{className:"tr-capture-actions",children:[e.jsxs("button",{className:"btn","aria-pressed":k!==null,title:a(k?"radar.feed.resumeHint":"radar.feed.pauseHint"),disabled:!we.length&&!F.length&&k===null,onClick:()=>{L(k?null:[...we]),j(k?null:((t==null?void 0:t.observations)??[]).map(h=>h.id))},children:[e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:k?e.jsx("path",{d:"m9 5 11 7-11 7z"}):e.jsx("path",{d:"M8 5v14M16 5v14"})}),e.jsx("span",{className:"tr-action-label",children:a(k?"radar.feed.resume":"radar.feed.pause")})]}),e.jsxs("button",{className:$?"btn danger armed":"btn",...at("clear"),disabled:at("clear").disabled||!(t!=null&&t.events.length)&&!((ct=t==null?void 0:t.observations)!=null&&ct.length),title:a($?"radar.feed.clearArmedHint":"radar.feed.clearHint"),onBlur:()=>ce(!1),onClick:xe,children:[e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M3 6h18M9 6V3h6v3M5 6l1 15h12l1-15M10 10v7M14 10v7"})}),e.jsx("span",{className:$?"":"tr-action-label",children:a($?"radar.feed.clearConfirm":"radar.feed.clear")})]})]})]})]}),k&&e.jsx("p",{className:"tr-list-notice",role:"status",children:ke>0?a("radar.feed.pausedNew",{count:ke}):a("radar.feed.paused")}),(yt=t==null?void 0:t.retention)!=null&&yt.evictedExports?e.jsx("p",{className:"tr-note",children:a("radar.feed.evicted",{count:t.retention.evictedExports,n:un(t.retention.evictedExports,0)})}):null,Ne.length?e.jsx("ul",{className:"tr-connections",onKeyDown:h=>{var Ct;if(!["ArrowDown","ArrowUp","Home","End"].includes(h.key))return;const P=Array.from(h.currentTarget.querySelectorAll(".tr-message")),ee=P.indexOf(document.activeElement);if(ee<0)return;h.preventDefault();const G=h.key==="Home"?0:h.key==="End"?P.length-1:Math.max(0,Math.min(P.length-1,ee+(h.key==="ArrowDown"?1:-1))),Ie=Ne[G];Ie&&(v(Ie.kind==="export"?Ie.event.id:null),w(Ie.kind==="observation"?Ie.event.id:null)),(Ct=P[G])==null||Ct.focus()},children:Ne.slice(0,H).map(h=>h.kind==="export"?e.jsx("li",{children:e.jsxs("button",{className:"tr-message","aria-pressed":(Z==null?void 0:Z.id)===h.event.id,onClick:()=>Le(h.event),children:[e.jsx(Lt,{kind:h.event.signal,className:"tr-row-icon"}),e.jsxs("span",{className:"tr-event-top",children:[e.jsx("strong",{className:"tr-event-name",title:h.event.name,children:h.event.name}),e.jsx("time",{dateTime:new Date(h.event.at).toISOString(),children:qt(h.event.at)})]}),h.event.content.includes("Prompt")&&e.jsx(ra,{event:h.event}),e.jsx("span",{className:"tr-event-context",title:st(h.event.sessionIds),children:st(h.event.sessionIds)}),e.jsxs("span",{className:"tr-event-bottom",children:[e.jsx("span",{className:`tr-receipt ${h.event.outcome==="accepted"?"tr-tone-ok":h.event.outcome==="rejected"?"tr-tone-error":h.event.outcome==="partial"?"tr-tone-enabled":""}`,children:a(`radar.receipt.${["accepted","unconfirmed","partial","rejected"].includes(h.event.outcome)?h.event.outcome:"unknown"}`)}),e.jsx("span",{children:a("radar.feed.records",{count:h.event.count})})]})]})},`event-${h.event.id}`):e.jsx("li",{children:e.jsxs("button",{className:"tr-message","aria-pressed":x===h.event.id,onClick:()=>{var P,ee,G;v(null),w(h.event.id),(P=window.matchMedia)!=null&&P.call(window,"(max-width: 640px)").matches&&((ee=U.current)==null||ee.focus({preventScroll:!0}),(G=U.current)==null||G.scrollIntoView({block:"start",behavior:"auto"}))},children:[e.jsx(Lt,{kind:"connection",className:"tr-row-icon"}),e.jsxs("span",{className:"tr-event-top",children:[e.jsx("strong",{className:"tr-event-name",children:a("radar.feed.connection")}),e.jsx("time",{dateTime:new Date(h.event.at).toISOString(),children:qt(h.event.at)})]}),e.jsxs("span",{className:"tr-event-context",title:h.event.destination,children:[h.event.destination," · ",h.event.reason==="encrypted"?a("radar.feed.encrypted"):a("radar.feed.undecoded")]})]})},`observation-${h.event.id}`))}):e.jsxs("div",{className:"tr-empty-capture",children:[!Q&&e.jsx(Lt,{kind:"radar"}),e.jsx("h4",{children:ie.length||(R=t==null?void 0:t.observations)!=null&&R.length?a("radar.feed.noMatch"):a(he?"radar.feed.notListening":"radar.feed.waiting")}),e.jsx("p",{className:"tr-note",children:ie.length||(X=t==null?void 0:t.observations)!=null&&X.length?a(O?"radar.feed.noPrompts":"radar.feed.tryOther"):a(he?"radar.feed.afterAllow":"radar.feed.autoMonitor")})]}),Ne.length>H&&e.jsx("button",{className:"btn",onClick:()=>le(h=>h+100),children:a("radar.feed.older")}),Je.length>0&&e.jsxs("details",{className:"tr-details",children:[e.jsx("summary",{children:a("radar.feed.connections",{count:Je.length})}),e.jsx("ul",{className:"tr-live-connections",children:Je.map(h=>e.jsxs("li",{children:[e.jsx("code",{children:h.destination}),e.jsxs("span",{children:["Claude · ",h.connecting&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"tr-attempt",children:fn(h,!1,a)})," · "]}),"PID ",h.pid," · ",h.workspace??a("radar.workspaceUnknown")]})]},`${h.pid}:${h.destination}`))}),e.jsx("p",{className:"tr-note",children:a("radar.feed.connectionsNote")})]})]}),Q&&e.jsx(Qr,{workspace:g,width:y,onCommit:S}),e.jsx("section",{className:"tr-inspector",hidden:!Q,"aria-label":a("radar.insp.label"),ref:U,tabIndex:-1,children:J?e.jsxs("div",{children:[e.jsx("div",{className:"tr-inspector-head",children:e.jsxs("h3",{children:[e.jsx(Lt,{kind:"connection"}),a("radar.insp.connection")]})}),e.jsxs("dl",{className:"tr-facts",children:[e.jsxs("div",{children:[e.jsx("dt",{children:a("radar.destination")}),e.jsxs("dd",{className:"tr-fact-copy",children:[e.jsx("code",{children:J.destination}),e.jsx("button",{className:"tr-inline-copy","aria-label":a("radar.insp.copyDestination"),onClick:()=>void _e(J.destination,"destination"),title:a(B==="destination"?"radar.insp.copiedDestination":"radar.insp.copyDestination"),children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:B==="destination"?e.jsx("path",{d:"m5 12 4 4L19 6"}):e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"2"}),e.jsx("path",{d:"M16 8V4H4v12h4"})]})})})]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:a("radar.insp.observed")}),e.jsx("dd",{children:e.jsx("time",{dateTime:new Date(J.at).toISOString(),children:new Date(J.at).toLocaleString($n())})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:a("radar.insp.source")}),e.jsx("dd",{children:e.jsx("code",{children:J.source||a("radar.insp.notIdentified")})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:a("radar.insp.contents")}),e.jsx("dd",{children:J.reason==="encrypted"?a("radar.insp.encrypted"):a("radar.insp.notDecoded")})]}),e.jsxs("div",{children:[e.jsx("dt",{children:a("radar.insp.session")}),e.jsx("dd",{children:a("radar.insp.notIdentified")})]})]}),e.jsxs("div",{className:"tr-inspection-limit",children:[e.jsx(Lt,{kind:"info"}),e.jsxs("div",{children:[e.jsx("h4",{children:J.reason==="encrypted"?a("radar.insp.encryptedTitle"):a("radar.insp.unavailableTitle")}),e.jsx("p",{children:J.reason==="joined_midstream"?a("radar.insp.joined"):J.reason==="encrypted"?a("radar.insp.https"):hn(J.reason,a)??a("radar.issue.fallbackConnection")}),e.jsxs("details",{className:"tr-details",children:[e.jsx("summary",{children:a("radar.insp.technical")}),e.jsx("p",{className:"tr-note",children:hn(J.reason,a)??a("radar.issue.fallbackDecoder")}),e.jsxs("p",{className:"tr-note",children:[a("radar.insp.noJson")," ",J.reason==="joined_midstream"&&a("radar.insp.noRebuild")]})]})]})]})]}):Z?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"tr-inspector-head",children:[e.jsxs("h3",{children:[e.jsx(Lt,{kind:Z.signal}),Z.name]}),e.jsx("p",{className:"tr-note",children:a(`radar.insp.decoded.${Z.signal}`,{session:st(Z.sessionIds),time:qt(Z.at)})})]}),e.jsxs("div",{className:"tr-detail-tabs",role:"group","aria-label":a("radar.insp.format"),children:[e.jsx("button",{className:"btn","aria-pressed":ye==="summary",onClick:()=>re("summary"),children:a("radar.insp.overview")}),e.jsx("button",{className:"btn","aria-pressed":ye==="json",onClick:()=>re("json"),children:"JSON"}),e.jsx("button",{className:"btn tr-copy-json",disabled:!(q!=null&&q.payload)||q.id!==Z.id,onClick:()=>void _e(JSON.stringify(q==null?void 0:q.payload,null,2),"json"),children:a(B==="json"?"radar.copied":"radar.copyJson")})]}),(q==null?void 0:q.id)===Z.id?q.payload?ye==="json"?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"tr-note",children:a("radar.insp.otlp")}),e.jsx(Tr,{value:q.payload},Z.id)]}):e.jsxs(e.Fragment,{children:[e.jsx(gs,{payload:q.payload,signal:Z.signal,sessions:l},Z.id),e.jsxs("details",{className:"tr-details",children:[e.jsx("summary",{children:a("radar.insp.transfer")}),e.jsxs("dl",{className:"tr-facts",children:[e.jsxs("div",{children:[e.jsx("dt",{children:a("radar.destination")}),e.jsxs("dd",{className:"tr-fact-copy",children:[e.jsx("code",{children:Z.destination}),e.jsx("button",{className:"tr-inline-copy","aria-label":a("radar.insp.copyDestination"),onClick:()=>void _e(Z.destination,"destination"),title:a(B==="destination"?"radar.insp.copiedDestination":"radar.insp.copyDestination"),children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:B==="destination"?e.jsx("path",{d:"m5 12 4 4L19 6"}):e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"8",y:"8",width:"12",height:"12",rx:"2"}),e.jsx("path",{d:"M16 8V4H4v12h4"})]})})})]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:a("radar.insp.time")}),e.jsx("dd",{children:qt(Z.at)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:a("radar.insp.receipt")}),e.jsx("dd",{children:ss(Z,a)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:a("radar.insp.size")}),e.jsx("dd",{children:a("radar.insp.sizeValue",{bytes:un(Z.bytes,0),records:a("radar.feed.records",{count:Z.count})})})]}),((me=Z.response)==null?void 0:me.message)&&e.jsxs("div",{children:[e.jsx("dt",{children:a("radar.insp.response")}),e.jsx("dd",{children:e.jsx(Nt,{value:Z.response.message})})]})]})]})]}):e.jsxs("div",{role:"alert",children:[e.jsx("p",{children:q.error}),e.jsx("button",{className:"btn",onClick:()=>pe(Re+1),children:a("radar.retry")})]}):e.jsx("p",{className:"tr-note",role:"status",children:a("radar.insp.loading")})]}):e.jsxs("div",{className:"tr-inspector-empty",children:[e.jsx("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.25","aria-hidden":"true",children:e.jsx("path",{d:"M8 4H5a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h3M16 4h3a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1h-3M10 8l-3 4 3 4M14 8l3 4-3 4"})}),e.jsx("h3",{children:a(b!==null||x!==null?"radar.insp.goneTitle":"radar.insp.emptyTitle")}),e.jsx("p",{className:"tr-note",children:b!==null||x!==null?a("radar.insp.goneNote"):Se.traffic&&!Se.decoded?a("radar.insp.trafficNote"):a("radar.insp.selectNote")})]})})]}),e.jsxs("footer",{className:"tr-monitor-footer",children:[(Ee||Q||r)&&e.jsx("span",{children:a("radar.foot.memory",{state:a(r?"radar.foot.interrupted":Ee?De?"radar.foot.continuous":"radar.foot.local":"radar.foot.off")})}),e.jsxs("details",{children:[e.jsx("summary",{children:a("radar.foot.limits")}),e.jsxs("div",{children:[e.jsx("p",{children:a("radar.foot.p1")}),e.jsx("p",{children:a("radar.foot.p2")}),e.jsx("p",{children:a("radar.foot.p3")}),t!=null&&t.bytes?e.jsx("p",{children:a("radar.foot.bytes",{bytes:un(t.bytes,0)})}):null,De&&e.jsx("p",{children:a("radar.foot.always")}),Object.entries((t==null?void 0:t.issues)??{}).map(([h,P])=>e.jsx("p",{children:a("radar.foot.issue",{text:hn(h,a)??a("radar.issue.fallbackLimit"),count:P})},h))]})]})]})]})}function ys({sessionFilter:t="all",onSessions:n}){const r=Oe(),[s,o]=d.useState([]),[i,c]=d.useState(""),[u,m]=d.useState(""),[l,a]=d.useState(!1),[p,f]=d.useState(null),[x,w]=d.useState(""),[b,v]=d.useState(!1),C=d.useRef(0),I=async y=>{if(!y)return;const N=++C.current;m(""),a(!0),v(!1);try{if(y.size>10*1024*1024)throw new nn(r("radar.fileview.tooBig"));const S=await y.text(),O=qr(S);if(N!==C.current)return;n==null||n([...new Set(O.flatMap(T=>T.sessionIds))]),o(O),c(y.name),f(null),w(""),O.length||m(r("radar.fileview.empty"))}catch(S){N===C.current&&m(rn(S,r("radar.fileview.readFailed")))}finally{N===C.current&&a(!1)}},A=s.filter(y=>(t==="all"||(t==="unidentified"?!y.sessionIds.length:y.sessionIds.includes(t)))&&(!x||y.raw.toLowerCase().includes(x.toLowerCase()))),E=A.slice(0,200),g=p===null?E[0]:A.find(y=>y.line===p);return e.jsxs("div",{className:"tr-file",children:[e.jsxs("div",{className:"tr-file-toolbar",children:[e.jsxs("div",{children:[e.jsx("h3",{children:r("radar.fileview.title")}),e.jsx("p",{className:"tr-note",children:r("radar.fileview.note")})]}),e.jsxs("label",{className:"btn tr-file-picker",children:[r(l?"radar.fileview.reading":i?"radar.fileview.another":"radar.fileview.open"),e.jsx("input",{type:"file",accept:".json,.jsonl,.ndjson,application/json","aria-label":r("radar.fileview.openLabel"),onChange:y=>{var N;I((N=y.target.files)==null?void 0:N[0]),y.target.value=""}})]})]}),u&&e.jsx("p",{className:"tr-capture-error",role:"alert",children:u}),e.jsxs("div",{className:"tr-workspace","data-empty":s.length===0,children:[e.jsxs("section",{className:"tr-feed","aria-label":r("radar.fileview.records"),children:[s.length>0&&e.jsxs("h3",{children:[i||r("radar.fileview.records")," ",e.jsx("span",{className:"tr-count",children:A.length})]}),s.length>0&&e.jsx("input",{type:"search",className:"tr-input tr-search","aria-label":r("radar.fileview.searchLabel"),placeholder:r("radar.fileview.searchPlaceholder"),value:x,onChange:y=>{w(y.target.value),f(null)}}),E.length?e.jsx("ul",{className:"tr-connections",children:E.map(y=>e.jsx("li",{children:e.jsxs("button",{className:"tr-message","aria-pressed":(g==null?void 0:g.line)===y.line,onClick:()=>{f(y.line),v(!1)},children:[e.jsxs("span",{className:"tr-event-top",children:[e.jsx("span",{children:r("radar.fileview.line",{n:y.line})}),e.jsx("span",{className:y.valid?"":"tr-tone-enabled",children:y.valid?"JSON":r("radar.invalidJson")})]}),e.jsx("strong",{children:y.label}),y.timestamp&&e.jsx("span",{children:y.timestamp}),e.jsx("span",{children:y.sessionIds.join(", ")||r("radar.session.unidentified")})]})},y.line))}):e.jsxs("div",{className:"tr-empty-capture",children:[e.jsx("h4",{children:s.length?r("radar.fileview.noMatch"):r("radar.fileview.openTitle")}),e.jsx("p",{className:"tr-note",children:s.length?r("radar.fileview.tryOther"):r("radar.fileview.choose")})]}),A.length>E.length&&e.jsx("p",{className:"tr-note",children:r("radar.fileview.first")})]}),e.jsx("section",{className:"tr-inspector",hidden:!s.length,"aria-label":r("radar.fileview.contents"),children:g?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"tr-feed-head",children:[e.jsx("h3",{children:r("radar.fileview.line",{n:g.line})}),e.jsx("button",{className:"btn",onClick:()=>{navigator.clipboard.writeText(g.raw).then(()=>v(!0),()=>m(r("radar.clipboard.json")))},children:r(b?"radar.copied":"radar.copyJson")})]}),e.jsx("p",{className:"tr-note",children:r("radar.fileview.original")}),e.jsx("pre",{className:"tr-value",children:g.raw})]}):e.jsxs("div",{className:"tr-inspector-empty",children:[e.jsx("h3",{children:r("radar.fileview.inspect")}),e.jsx("p",{className:"tr-note",children:r("radar.fileview.select")})]})})]})]})}function Ns({onClose:t,sessions:n=[]}){const r=Br(t),s=zr(t),{snapshot:o,failed:i,updateConfig:c}=Xr(),u=Zr();return e.jsx("div",{className:"modal-backdrop",...s,role:"presentation",children:e.jsx("div",{className:"modal tr-modal",ref:r,role:"dialog","aria-modal":"true","aria-labelledby":"tr-title","aria-describedby":"tr-purpose",onClick:m=>m.stopPropagation(),children:e.jsx(vs,{snapshot:o,failed:i,captureState:u,sessions:n,onConfigChange:c,onClose:t})})})}function vs({snapshot:t,failed:n=!1,captureState:r,sessions:s=[],onConfigChange:o,onClose:i}){var y,N,S,O;const c=Oe(),[u,m]=d.useState("monitor"),[l,a]=d.useState([]),[p,f]=d.useState("all"),x=["monitor","configuration","file"],w=T=>{var K;const H=$r(T,x.indexOf(u),x.length);if(H.kind!=="select")return;T.preventDefault();const le=x[H.index];m(le),(K=document.getElementById(`tr-tab-${le}`))==null||K.focus()},b=[...((y=t==null?void 0:t.config)==null?void 0:y.variables)??[],...(t==null?void 0:t.environment)??[]],v=Un(b),C=Gr(b,c),I=Jr(b),A=(N=t==null?void 0:t.config)==null?void 0:N.sources.some(T=>T.status==="unavailable"),E=n?[]:Ur(t),g=new Map(s.map(T=>[T.id,T.label]));for(const T of((S=r==null?void 0:r.capture)==null?void 0:S.events)??[])for(const H of T.sessionIds??[])g.has(H)||g.set(H,c("radar.session"));for(const T of l)g.has(T)||g.set(T,c("radar.session"));return e.jsxs("div",{className:"tr-body",children:[e.jsxs("header",{className:"modal-head tr-header",children:[e.jsxs("div",{className:"tr-identity",children:[e.jsxs("div",{className:"modal-title",children:[e.jsx("span",{className:"modal-tool-name",id:"tr-title",children:c("radar.title")}),e.jsx("span",{className:"tr-beta",title:c("radar.betaHint"),children:c("radar.beta")})]}),e.jsx("p",{id:"tr-purpose",children:c("radar.purpose")})]}),e.jsxs("div",{className:"tr-navigation",children:[e.jsxs("div",{className:"tr-tabs",role:"tablist","aria-label":c("radar.views"),onKeyDown:w,children:[e.jsx("button",{id:"tr-tab-monitor",className:"tr-tab",role:"tab","aria-selected":u==="monitor","aria-controls":"tr-panel-monitor",tabIndex:u==="monitor"?0:-1,onClick:()=>m("monitor"),children:c("radar.tab.monitor")}),e.jsx("button",{id:"tr-tab-configuration",className:"tr-tab",role:"tab","aria-selected":u==="configuration","aria-controls":"tr-panel-configuration",tabIndex:u==="configuration"?0:-1,onClick:()=>m("configuration"),children:c("radar.tab.configuration")}),e.jsx("button",{id:"tr-tab-file",className:"tr-tab",role:"tab","aria-selected":u==="file","aria-controls":"tr-panel-file",tabIndex:u==="file"?0:-1,onClick:()=>m("file"),children:c("radar.tab.file")})]}),e.jsxs("label",{className:"tr-session-filter",hidden:!g.size&&p==="all"&&!((O=r==null?void 0:r.capture)!=null&&O.events.length),children:[c("radar.session"),e.jsxs(mn,{value:p,onChange:T=>f(T.target.value),"aria-label":c("radar.session"),children:[e.jsx("option",{value:"all",children:c("radar.session.all")}),[...g].map(([T,H])=>e.jsxs("option",{value:T,children:[H," · ",T.slice(0,8)]},T)),e.jsx("option",{value:"unidentified",children:c("radar.session.unidentified")})]})]}),e.jsxs("details",{className:"tr-help",children:[e.jsxs("summary",{children:[e.jsx(Lt,{kind:"info"}),e.jsx("span",{className:"tr-help-label",children:c("radar.about")})]}),e.jsxs("div",{children:[e.jsx("h3",{children:c("radar.about.title")}),e.jsx("p",{children:c("radar.about.p1")}),e.jsx("p",{children:c("radar.about.p2")}),e.jsx("p",{children:c("radar.about.p3")}),e.jsx("a",{href:"https://code.claude.com/docs/en/monitoring-usage",target:"_blank",rel:"noreferrer",children:c("radar.about.docs")})]})]})]}),i&&e.jsx("button",{className:"glyph-btn tr-header-close",onClick:i,"aria-label":c("radar.close"),title:c("radar.close"),children:"×"})]}),e.jsx("div",{className:"tr-page",id:"tr-panel-monitor",role:"tabpanel","aria-labelledby":"tr-tab-monitor",hidden:u!=="monitor",children:r?e.jsx(xs,{...r,radar:n&&t?{...t,status:"unavailable"}:t,sessionFilter:p,sessions:s}):e.jsx("p",{className:"tr-empty",children:c("radar.readingStatus")})}),e.jsxs("div",{className:"tr-page tr-configuration-page",id:"tr-panel-configuration",role:"tabpanel","aria-labelledby":"tr-tab-configuration",hidden:u!=="configuration",children:[e.jsxs("div",{className:"tr-summary",children:[e.jsxs("div",{className:"tr-summary-state",children:[e.jsx("span",{className:`tr-state ${n||!t||A?"tr-tone-unknown":I==="enabled"?"tr-tone-enabled":"tr-tone-unknown"}`,children:n?c("radar.cfg.unavailable"):t?A?c("radar.cfg.incomplete"):I==="unknown"?c("radar.cfg.unknown"):C:c("radar.cfg.reading")}),e.jsx("span",{className:"tr-note",children:v.length?c("radar.cfg.destinations",{count:v.length}):c("radar.cfg.noDestination")})]}),v.length>0&&e.jsx("div",{className:"tr-endpoints",children:v.map(T=>e.jsx("code",{children:T},T))}),!v.length&&E.length>0&&e.jsxs("div",{className:"tr-observed-summary",children:[e.jsx("span",{className:"tr-state",children:c("radar.cfg.observed")}),e.jsx("div",{className:"tr-endpoints",children:E.map(T=>e.jsx("code",{children:T},T))}),e.jsx("p",{className:"tr-note",children:c("radar.cfg.observedNote")})]})]}),t?e.jsx(bs,{snapshot:t,stale:n,onConfigChange:o,sessionLabel:p==="all"?void 0:g.get(p)??p}):e.jsx("p",{className:"tr-empty",children:c(n?"radar.cfg.readFailed":"radar.cfg.readingLocal")})]}),e.jsx("div",{className:"tr-page",id:"tr-panel-file",role:"tabpanel","aria-labelledby":"tr-tab-file",hidden:u!=="file",children:e.jsx(ys,{onSessions:a,sessionFilter:p})})]})}function bs({snapshot:t,sessionLabel:n,stale:r=!1,onConfigChange:s}){var O,T,H,le,K;const o=Oe(),i=o("radar.config.launchNote"),[c,u]=d.useState(null),[m,l]=d.useState(null),a=d.useRef(null),[p,f]=d.useState(""),[x,w]=d.useState(""),b=(O=c??t.config)==null?void 0:O.sources.some(j=>j.status==="unavailable");d.useEffect(()=>{u(null)},[t.config]);const v=[...((T=c??t.config)==null?void 0:T.variables)??[],...t.environment??[]],C=t.uninspected??0,I=async(j,k)=>{if(!zn(a.current)||r)return;a.current=j,l(j),w(""),f("");const L=new AbortController,B=setTimeout(()=>L.abort(),2e4);try{const W=await fetch("/api/system/traffic-radar/configuration",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:j,enabled:k}),signal:L.signal}),$=await W.json();if(!W.ok||!$.ok)throw new nn($.error?Be($.error):o("radar.config.saveFailed"));u($.config),s==null||s($.config),f(o("radar.config.saved"))}catch(W){w(L.signal.aborted?o("radar.config.saveTimeout"):rn(W,o("radar.config.saveRetry")))}finally{clearTimeout(B),a.current=null,l(null)}},A=v.filter(j=>j.key.endsWith("ENDPOINT")),E={CLAUDE_CODE_ENABLE_TELEMETRY:o("radar.flag.telemetry"),OTEL_LOG_USER_PROMPTS:o("radar.flag.prompts"),OTEL_LOG_ASSISTANT_RESPONSES:o("radar.flag.responses"),OTEL_LOG_TOOL_DETAILS:o("radar.flag.toolDetails"),OTEL_LOG_TOOL_CONTENT:o("radar.flag.toolContent"),OTEL_LOG_RAW_API_BODIES:o("radar.flag.apiBodies"),OTEL_LOG_MANAGED_SETTINGS:o("radar.flag.managed"),CLAUDE_CODE_ENHANCED_TELEMETRY_BETA:o("radar.flag.enhanced"),ENABLE_ENHANCED_TELEMETRY_BETA:o("radar.flag.enhanced")},g=Object.keys(E),y=j=>g.includes(j)?g.indexOf(j):g.length,N=(((H=c??t.config)==null?void 0:H.unsetFlags)??[]).map(j=>({key:j,value:"Not set",source:"User settings",unset:!0,editable:!0})),S=[...v.filter(j=>j.key.startsWith("OTEL_LOG_")||j.key.includes("ENABLE")||j.key.includes("TELEMETRY_BETA")),...N].sort((j,k)=>y(j.key)-y(k.key));return e.jsxs("section",{className:"tr-config","aria-label":o("radar.config.label"),children:[e.jsx("h3",{children:o("radar.config.title")}),r&&e.jsx("p",{className:"tr-warning",role:"status",children:o("radar.config.stale")}),b&&e.jsx("p",{className:"tr-warning",role:"status",children:o("radar.config.incomplete")}),e.jsx("p",{className:"tr-note",children:(le=t.environment)!=null&&le.length?o("radar.config.readEnv"):o("radar.config.read")}),C>0&&e.jsx("p",{className:"tr-note",children:o("radar.config.uninspected",{count:C})}),n&&e.jsx("p",{className:"tr-note",children:o("radar.config.session",{session:n})}),e.jsx("h4",{children:o("radar.config.destinations")}),A.length?e.jsx("ul",{className:"tr-destinations",children:A.map(j=>e.jsxs("li",{children:[e.jsx("code",{children:j.value}),e.jsxs("span",{children:[Be(j.source,o)," · ",j.key]})]},`${j.source}:${j.key}`))}):e.jsx("p",{className:"tr-note",children:o("radar.config.noDestination")}),e.jsx("h4",{children:o("radar.config.flags")}),e.jsx("p",{className:"tr-note",children:o("radar.config.flagsNote")}),p&&e.jsx("p",{className:"tr-note",role:"status",children:p}),x&&e.jsx("p",{className:"tr-warning",role:"alert",children:x}),S.length?e.jsx("dl",{className:"tr-variables tr-flags",children:S.map(j=>{const k=j.value.startsWith("Enabled"),L=k||j.value==="Disabled"||j.unset,B=Wn(m,j.key),W=j.unset?o("radar.config.notInFile"):Be(j.source,o),$=o("radar.config.flagLabel",{name:E[j.key]??j.key,source:j.unset?o("radar.config.notSet"):Be(j.source,o)}),ce=j.launch===!0,de=!ce&&(r||b||j.editable!==!0&&!j.blockedReason),ye=!ce&&j.editable!==!0&&!de,re=j.blockedReason?Be(j.blockedReason,o):void 0,q=(oe,Re=re)=>e.jsx("button",{type:"button",className:"switch",role:"switch","data-tone":"warn","aria-checked":k,"aria-label":$,...oe?{disabled:!0,title:Re}:{"aria-busy":B.busy,disabled:B.disabled,title:o(k?"radar.config.turnOff":"radar.config.turnOn"),onClick:()=>void I(j.key,!k)},children:e.jsx("span",{className:"switch-knob"})});return e.jsxs("div",{children:[e.jsxs("dt",{children:[e.jsx("strong",{children:E[j.key]??j.key}),e.jsx("code",{children:j.key}),e.jsx("span",{children:W}),j.blockedReason&&!b&&e.jsx("span",{children:re})]}),e.jsxs("dd",{className:"tr-flag-control",children:[e.jsxs("span",{className:"tr-flag-value",children:[e.jsx("span",{className:`tr-state ${k?"tr-tone-enabled":"tr-tone-unknown"}`,children:Be(j.value,o)}),j.rawValue!==void 0&&e.jsx("code",{className:"tr-raw-flag",children:j.rawValue})]}),e.jsxs("span",{className:"tr-flag-action",children:[ce?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"tr-control-note",title:i,children:o("radar.config.readonly")}),L&&q(!0,i)]}):de?e.jsx("span",{className:"tr-control-note",title:re,children:o("radar.config.unavailable")}):ye?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"tr-control-note",title:re,children:o("radar.config.managed")}),L&&q(!0)]}):L?q(!1):e.jsx("span",{className:"tr-unknown-actions",children:[!0,!1].map(oe=>e.jsx("button",{type:"button",className:"btn","aria-label":o(oe?"radar.config.enableLabel":"radar.config.disableLabel",{name:$}),"aria-busy":B.busy,disabled:B.disabled,onClick:()=>void I(j.key,oe),children:o(oe?"radar.config.enable":"radar.config.disable")},String(oe)))}),m===j.key&&e.jsx("span",{className:"tr-control-note",role:"status",children:o("radar.config.saving")})]})]})]},`${j.source}:${j.key}`)})}):e.jsx("p",{className:"tr-note",children:o("radar.config.noFlags")}),!A.length&&t.connections.length>0&&e.jsxs("details",{className:"tr-details",children:[e.jsx("summary",{children:o("radar.config.observedConnections",{count:t.connections.length})}),e.jsx("ul",{className:"tr-live-connections",children:t.connections.map(j=>e.jsxs("li",{children:[e.jsx("code",{children:j.destination}),e.jsxs("span",{children:[j.connecting&&!r&&j.active!==null?e.jsx("span",{className:"tr-attempt",children:fn(j,!1,o)}):fn(j,r,o)," · PID ",j.pid," · ",j.workspace??o("radar.workspaceUnknown")]})]},`${j.pid}:${j.destination}`))}),e.jsx("p",{className:"tr-note",children:o("radar.config.observedConnectionsNote")})]}),e.jsxs("details",{className:"tr-details",children:[e.jsx("summary",{children:o("radar.config.allVariables")}),e.jsx("dl",{className:"tr-variables",children:v.map(j=>e.jsxs("div",{children:[e.jsxs("dt",{children:[e.jsx("code",{children:j.key}),e.jsx("span",{children:Be(j.source,o)})]}),e.jsx("dd",{children:Be(j.value,o)})]},`${j.source}:${j.key}`))}),e.jsx("ul",{className:"tr-sources",children:(K=t.config)==null?void 0:K.sources.map(j=>e.jsxs("li",{children:[e.jsx("span",{children:Be(j.name,o)}),e.jsx("span",{children:j.status==="read"?o("radar.config.sourceRead"):j.status==="absent"?o("radar.config.sourceAbsent"):o("radar.config.sourceUnavailable")})]},j.name))}),e.jsx("p",{className:"tr-note",children:o("radar.config.hidden")})]})]})}export{bs as Configuration,vs as TrafficRadarView,Ns as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as V,Q as q,b as c,s as le,S as ce,u as I,U as P,j as e,V as b,W as Q,X as x,Y as X,C as de,D as ue,Z as he,_ as me,R as ge,i as H,$ as pe,a0 as xe}from"./app-BHxsMz3-.js";function fe(t){return!t.answer||t.answer.range!==t.want?{phase:"busy",stale:!1}:t.answer.ok?{phase:t.answer.days>0?"chart":"empty",stale:t.loading}:{phase:"error",stale:t.loading}}function Y(t){const s=new Map;for(const a of t)for(const o of a.agents??[]){if(!o||typeof o.agent!="string"||o.agent==="")continue;const l=s.get(o.agent)??{id:o.agent,cost:0,tokens:0};l.cost+=Number.isFinite(o.totalCost)?o.totalCost:0,l.tokens+=Number.isFinite(o.totalTokens)?o.totalTokens:0,s.set(o.agent,l)}return[...s.values()].sort((a,o)=>o.cost-a.cost||a.id.localeCompare(o.id))}function je(t){const s=Y([{agents:t}]);return s.length<2?null:s.map(a=>`${V(a.id)} ${q(a.cost)}`).join(" · ")}function z(t){switch(t.toLowerCase()){case"claude":return"var(--model-opus)";case"codex":return"var(--model-codex)";case"gemini":return"var(--model-gemini)";case"copilot":return"var(--model-haiku)";default:return"var(--model-other)"}}function Ne(t,s){if(!(s>0)||!(t>0))return"0%";const a=t/s*100;return a<.1?"<0.1%":`${a.toFixed(1)}%`}const m=t=>typeof t=="number"&&Number.isFinite(t)?t:0,$=t=>typeof t=="string"?t:"",G=t=>Array.isArray(t)?t.filter(s=>typeof s=="string"):[];function ke(t){const s=t??{};return{modelName:$(s.modelName),cost:m(s.cost),...typeof s.missingPricing=="boolean"?{missingPricing:s.missingPricing}:{},...typeof s.storedCost=="number"&&Number.isFinite(s.storedCost)&&s.storedCost>=0?{storedCost:Math.min(s.storedCost,Math.max(0,m(s.cost)))}:{},inputTokens:m(s.inputTokens),outputTokens:m(s.outputTokens),cacheCreationTokens:m(s.cacheCreationTokens),cacheReadTokens:m(s.cacheReadTokens)}}function be(t){const s=t??{},a=Array.isArray(s.agents)?s.agents.map(o=>{const l=o??{};return{agent:$(l.agent),totalCost:m(l.totalCost),totalTokens:m(l.totalTokens)}}):void 0;return{period:$(s.period),totalCost:m(s.totalCost),totalTokens:m(s.totalTokens),inputTokens:m(s.inputTokens),outputTokens:m(s.outputTokens),cacheCreationTokens:m(s.cacheCreationTokens),cacheReadTokens:m(s.cacheReadTokens),modelsUsed:G(s.modelsUsed),modelBreakdowns:Array.isArray(s.modelBreakdowns)?s.modelBreakdowns.map(ke):[],...a?{agents:a}:{},...s.metadata&&typeof s.metadata=="object"?{metadata:{agents:G(s.metadata.agents)}}:{}}}function ve(t){const s=t??{};return{...s,ok:s.ok===!0,days:Array.isArray(s.days)?s.days.map(be):void 0}}function T(t){const s=t.toLowerCase();return s.includes("opus")?"var(--model-opus)":s.includes("sonnet")?"var(--model-sonnet)":s.includes("haiku")?"var(--model-haiku)":s.includes("gpt-5")||s.includes("gpt5")?"var(--model-gpt5)":s.includes("gpt")?"var(--model-gpt)":s.includes("gemini")?"var(--model-gemini)":s.includes("codex")?"var(--model-codex)":s.includes("fable")||s.includes("mythos")?"var(--model-fable)":"var(--model-other)"}function ye(t){let s=0,a=0,o=0,l=0;const g=new Map,i=new Set;let r=null;for(const d of t){s+=d.totalCost,a+=d.totalTokens,o+=d.inputTokens+d.outputTokens,l+=d.cacheReadTokens;for(const h of d.modelBreakdowns)g.set(h.modelName,(g.get(h.modelName)??0)+h.cost),h.missingPricing&&i.add(h.modelName),h.storedCost!==void 0&&(r=(r??0)+h.storedCost)}return{totalCost:s,totalTok:a,inOut:o,cacheRead:l,modelCosts:g,missingModels:i,storedCost:r}}function Ce(t){return Array.from(t.entries()).sort((s,a)=>a[1]-s[1])}function Z(t){return t.slice().sort((s,a)=>a.cost-s.cost)}function w(t,s){return s>0?t/s*100:0}function we(t){var a,o;return je(t.agents)??((o=(a=t.metadata)==null?void 0:a.agents)!=null&&o.length?t.metadata.agents.join(" · "):null)}function Te(t){return t<=14?1:t<=31?2:7}function Re(){let t=0;return{begin(){const s=++t;return()=>s===t},cancel(){t++}}}function Me(t){const[s,a]=c.useState(null),[o,l]=c.useState(!1),g=c.useState(Re)[0],i=c.useRef(!1),r=(d=!1)=>{if(d&&!le(i.current))return;const h=g.begin();i.current=d;const f=t;l(!0);const R=`/api/ccusage?since=${ce(f)}${d?"&refresh=1":""}`;fetch(R).then(u=>u.json()).then(u=>{h()&&a({range:f,resp:ve(u)})}).catch(()=>{h()&&a({range:f,resp:{ok:!1,reason:"unreachable"}})}).finally(()=>{h()&&(i.current=!1,l(!1))})};return c.useEffect(()=>(r(!1),()=>g.cancel()),[t]),{landed:s,loading:o,reload:()=>r(!0)}}function Se({selectedDay:t}){const s=I(),a=we(t),o=t.modelBreakdowns.some(i=>i.missingPricing),l=t.modelBreakdowns.filter(i=>i.storedCost!==void 0),g=P(l.length?l.reduce((i,r)=>i+r.storedCost,0):null,t.totalCost);return e.jsxs("div",{className:"uh-detail",children:[e.jsxs("div",{className:"uh-detail-head",children:[e.jsx("span",{className:"uh-detail-date",children:t.period}),e.jsx("span",{className:"uh-detail-cost",children:b(t.totalCost,o)}),a&&e.jsx("span",{className:"uh-detail-agents",title:a,children:a})]}),o&&e.jsx("p",{className:"uh-cost-note",children:Q()}),g&&e.jsx("p",{className:"uh-cost-note",children:g}),e.jsxs("div",{className:"uh-detail-mini",children:[e.jsx(y,{label:s("insights.cost.input"),val:x(t.inputTokens)}),e.jsx(y,{label:s("insights.cost.output"),val:x(t.outputTokens)}),e.jsx(y,{label:s("insights.usage.cacheWrite"),val:x(t.cacheCreationTokens)}),e.jsx(y,{label:s("insights.usage.cacheRead"),val:x(t.cacheReadTokens)})]}),e.jsx("div",{className:"uh-detail-models",children:Z(t.modelBreakdowns).map(i=>{const r=w(i.cost,t.totalCost);return e.jsxs("div",{className:"uh-model-row",title:i.modelName,children:[e.jsxs("span",{className:"uh-model-name",children:[e.jsx("span",{className:"uh-legend-dot",style:{background:T(i.modelName)}}),e.jsx("span",{className:"uh-model-label",children:X(i.modelName)})]}),e.jsx("span",{className:"uh-model-bar",children:e.jsx("span",{className:"uh-model-bar-fill",style:{width:`${r}%`,background:T(i.modelName)}})}),e.jsx("span",{className:"uh-model-cost",children:b(i.cost,i.missingPricing)})]},i.modelName)})})]})}function y({label:t,val:s}){return e.jsxs("div",{className:"uh-ministat",children:[e.jsx("span",{className:"uh-ministat-val",children:s}),e.jsx("span",{className:"uh-ministat-label",children:t})]})}const Pe=[7,14,30,90];function Le({onClose:t,providers:s}){var U;const a=I(),[o,l]=c.useState(30),[g,i]=c.useState(null),{landed:r,loading:d,reload:h}=Me(o),f=c.useRef(null),L=de(t,{focusRef:f}),R=ue(t),u=fe({loading:d,want:o,answer:r&&{range:r.range,ok:r.resp.ok===!0,days:((U=r.resp.days)==null?void 0:U.length)??0}}),[_,J]=c.useState(()=>typeof document<"u"&&document.hidden);c.useEffect(()=>{if(u.phase!=="busy")return;const n=()=>J(document.hidden);return n(),document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)},[u.phase]);const p=u.phase==="chart"?r.resp.days??[]:[],A=c.useRef(null),K=he(u.phase!=="error",A),D=c.useMemo(()=>p.reduce((n,j)=>Math.max(n,j.totalCost),0),[p]),B=c.useRef(null);c.useLayoutEffect(()=>{const n=B.current;n&&(n.scrollLeft=n.scrollWidth)},[p]);const{totalCost:N,totalTok:ee,inOut:se,cacheRead:te,modelCosts:E,missingModels:M,storedCost:F}=c.useMemo(()=>ye(p),[p]),ae=c.useMemo(()=>Ce(E),[E]),v=c.useMemo(()=>Y(p),[p]),ne=v.length>1,O=g?p.find(n=>n.period===g)??null:null,oe=Te(p.length);return e.jsx("div",{className:"modal-backdrop",...R,role:"presentation",children:e.jsxs("div",{ref:L,className:"modal uh-modal",onClick:n=>n.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":a("insights.usage.title"),children:[e.jsxs("header",{className:"modal-head uh-head",children:[e.jsxs("div",{className:"uh-titlewrap",children:[e.jsx("div",{className:"modal-tool-name",children:a("insights.usage.title")}),e.jsx("div",{className:"uh-sub",children:u.stale?a("insights.usage.running"):me(s,v.map(n=>n.id))})]}),e.jsx("div",{className:"uh-range",role:"group","aria-label":a("insights.usage.range"),children:Pe.map(n=>e.jsx("button",{type:"button","aria-pressed":o===n,className:"uh-range-btn",onClick:()=>{l(n),i(null)},children:a("insights.usage.days",{n})},n))}),e.jsx("button",{ref:A,className:"glyph-btn uh-reload",onClick:h,...H(d),title:a("insights.usage.rerun"),"aria-label":a("insights.usage.reload"),children:d?"…":e.jsx(ge,{})}),e.jsx("button",{ref:f,className:"glyph-btn uh-close",onClick:t,"aria-label":a("insights.usage.close"),children:"×"})]}),u.phase==="busy"?e.jsxs("div",{className:"uh-status uh-status-wait",role:"status","aria-label":a("insights.usage.reading"),"aria-busy":"true","data-paused":_||void 0,children:[e.jsxs("span",{className:"uh-wait-word",children:[e.jsxs("svg",{className:"uh-reading-art",viewBox:"0 0 240 96",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M25 24v-7a4 4 0 0 1 4-4h28a4 4 0 0 1 4 4v43"}),e.jsx("rect",{x:"17",y:"24",width:"36",height:"51",rx:"4"}),e.jsx("path",{d:"M25 36h19M25 44h19M25 52h13M25 64h7"}),e.jsx("path",{className:"uh-reading-link",d:"M69 49h59"}),e.jsxs("g",{className:"uh-reading-packets",children:[e.jsx("rect",{x:"76",y:"46",width:"6",height:"6",rx:"1.5"}),e.jsx("rect",{x:"76",y:"46",width:"6",height:"6",rx:"1.5"}),e.jsx("rect",{x:"76",y:"46",width:"6",height:"6",rx:"1.5"})]}),e.jsx("rect",{x:"145",y:"18",width:"76",height:"57",rx:"5"}),e.jsx("path",{d:"M154 28h21M154 64h57M154 38v26M163 39h47M163 49h47"}),e.jsx("circle",{cx:"209",cy:"28",r:"2"})]}),e.jsx("strong",{className:"uh-reading-title",children:a("insights.usage.reading")}),e.jsx("span",{className:"uh-reading-note",children:a("insights.usage.gathering")}),!r&&e.jsx("span",{className:"uh-reading-hint",children:a("insights.usage.firstRun")})]}),e.jsx("span",{className:"uh-wait-axis","aria-hidden":!0})]}):u.phase==="error"?e.jsxs("div",{className:"uh-status uh-err",title:xe(r.resp)||void 0,children:[pe(r.resp,a("insights.usage.noReport")),e.jsx("div",{children:e.jsx("button",{className:"btn uh-retry",onClick:()=>{K(),h()},...H(d),children:a(d?"insights.usage.trying":"insights.audit.tryAgain")})})]}):u.phase==="empty"?e.jsx("div",{className:`uh-status${u.stale?" uh-stale":""}`,"aria-busy":u.stale||void 0,children:a("insights.usage.empty")}):e.jsxs("div",{className:u.stale?"uh-stale":void 0,"aria-busy":u.stale||void 0,children:[e.jsxs("div",{className:"uh-totals",children:[e.jsx(C,{label:a("insights.usage.totalCost"),val:b(N,M.size>0),accent:!0}),e.jsx(C,{label:a("insights.usage.tokens"),val:x(ee)}),e.jsx(C,{label:a("insights.usage.inOut"),val:x(se)}),e.jsx(C,{label:a("insights.usage.cacheReads"),val:x(te)})]}),M.size>0&&e.jsx("p",{className:"uh-cost-note",children:Q()}),P(F,N)&&e.jsx("p",{className:"uh-cost-note",children:P(F,N)}),ne&&e.jsxs("div",{className:"uh-agents",role:"group","aria-label":a("insights.usage.byCli"),children:[e.jsx("div",{className:"uh-agent-bar","aria-hidden":"true",children:v.map(n=>e.jsx("span",{className:"uh-agent-seg",style:{width:`${w(n.cost,N)}%`,background:z(n.id)}},n.id))}),e.jsx("div",{className:"uh-agent-keys",children:v.map(n=>e.jsxs("span",{className:"uh-agent-key",title:a("insights.usage.agentTokens",{id:n.id,tokens:x(n.tokens)}),children:[e.jsx("span",{className:"uh-legend-dot",style:{background:z(n.id)}}),V(n.id),e.jsx("span",{className:"uh-agent-cost",children:q(n.cost)}),e.jsx("span",{className:"uh-agent-share",children:Ne(n.cost,N)})]},n.id))})]}),e.jsx("div",{ref:B,className:"uh-chart",role:"group","aria-label":a("insights.usage.daily"),children:p.map((n,j)=>{const ie=w(n.totalCost,D),S=n.period===g,W=`${n.period}, ${b(n.totalCost,n.modelBreakdowns.some(k=>k.missingPricing))}`;return e.jsxs("button",{className:`uh-bar-col${S?" sel":""}`,onClick:()=>i(S?null:n.period),"aria-pressed":S,"aria-label":W,title:W,style:{flexBasis:`${100/p.length}%`,"--uh-i":j,"--uh-step":`${Math.min(10,200/Math.max(p.length,1))}ms`},children:[e.jsx("div",{className:"uh-bar",style:{height:`${Math.max(ie,n.totalCost>0?2:0)}%`},children:Z(n.modelBreakdowns).map(k=>{const re=w(k.cost,n.totalCost);return e.jsx("div",{className:"uh-bar-seg",style:{height:`${re}%`,background:T(k.modelName)}},k.modelName)})}),(p.length-1-j)%oe===0&&e.jsx("span",{className:"uh-bar-label",children:n.period.slice(5)})]},n.period)})}),e.jsx("div",{className:"uh-legend",children:ae.map(([n,j])=>e.jsxs("span",{className:"uh-legend-item",title:n,children:[e.jsx("span",{className:"uh-legend-dot",style:{background:T(n)}}),X(n)," ",e.jsx("span",{className:"uh-legend-cost",children:b(j,M.has(n))})]},n))}),O&&e.jsx(Se,{selectedDay:O})]})]})})}function C({label:t,val:s,accent:a}){return e.jsxs("div",{className:"uh-stat",children:[e.jsx("span",{className:`uh-stat-val${a?" accent":""}`,children:s}),e.jsx("span",{className:"uh-stat-label",children:t})]})}export{Le as default};
|