@cartanova/qgrid-cli 2.7.0 → 2.7.1

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.
Files changed (126) hide show
  1. package/bundle/dist/_virtual/_rolldown/runtime.js +20 -1
  2. package/bundle/dist/application/qgrid/qgrid.dispatcher.js +17 -6
  3. package/bundle/dist/application/qgrid/qgrid.frame.js +1 -1
  4. package/bundle/dist/application/qgrid/schema-prompt.js +240 -0
  5. package/bundle/dist/application/qgrid/tool-emulation.js +7 -5
  6. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js +112 -0
  7. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js +140 -0
  8. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +676 -0
  9. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js +143 -0
  10. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js +104 -0
  11. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +225 -0
  12. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js +30 -0
  13. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js +20 -0
  14. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +135 -0
  15. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +63 -0
  16. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +148 -0
  17. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js +25 -0
  18. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +50 -0
  19. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +174 -0
  20. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js +33 -0
  21. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +435 -0
  22. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +115 -0
  23. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js +74 -0
  24. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +585 -0
  25. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/data.js +20 -0
  26. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +44 -0
  27. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.js +52 -0
  28. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.js +22 -0
  29. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.js +53 -0
  30. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.js +18 -0
  31. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.js +38 -0
  32. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.js +21 -0
  33. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.js +87 -0
  34. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.js +61 -0
  35. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js +14 -0
  36. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js +27 -0
  37. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js +14 -0
  38. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js +18 -0
  39. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +59 -0
  40. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +98 -0
  41. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +31 -0
  42. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +18 -0
  43. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +91 -0
  44. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +89 -0
  45. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +18 -0
  46. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js +64 -0
  47. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +62 -0
  48. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +61 -0
  49. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +36 -0
  50. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js +33 -0
  51. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +53 -0
  52. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +63 -0
  53. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +19 -0
  54. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +54 -0
  55. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +43 -0
  56. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +19 -0
  57. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js +132 -0
  58. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js +16 -0
  59. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js +24 -0
  60. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +114 -0
  61. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +103 -0
  62. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +16 -0
  63. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js +37 -0
  64. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +48 -0
  65. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +47 -0
  66. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js +24 -0
  67. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +22 -0
  68. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +17 -0
  69. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js +94 -0
  70. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js +12 -0
  71. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js +25 -0
  72. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js +21 -0
  73. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js +15 -0
  74. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +48 -0
  75. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +61 -0
  76. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js +29 -0
  77. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +19 -0
  78. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js +51 -0
  79. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js +50 -0
  80. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js +20 -0
  81. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +30 -0
  82. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +35 -0
  83. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +49 -0
  84. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +30 -0
  85. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +29 -0
  86. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +40 -0
  87. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +74 -0
  88. package/bundle/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +72 -0
  89. package/bundle/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +35 -0
  90. package/bundle/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +238 -0
  91. package/bundle/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +189 -0
  92. package/bundle/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +284 -0
  93. package/bundle/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +80 -0
  94. package/bundle/dist/testing/schema-bench.js +0 -0
  95. package/bundle/dist/utils/providers/anthropic/fence-strip.js +83 -0
  96. package/bundle/dist/utils/providers/anthropic/stream-json-adapter.js +3 -5
  97. package/bundle/src/application/qgrid/qgrid.dispatcher.test.ts +250 -34
  98. package/bundle/src/application/qgrid/qgrid.dispatcher.ts +36 -5
  99. package/bundle/src/application/qgrid/qgrid.frame.test.ts +120 -153
  100. package/bundle/src/application/qgrid/qgrid.frame.ts +2 -0
  101. package/bundle/src/application/qgrid/schema-prompt.test.ts +166 -0
  102. package/bundle/src/application/qgrid/schema-prompt.ts +293 -0
  103. package/bundle/src/application/qgrid/tool-emulation.test.ts +36 -0
  104. package/bundle/src/application/qgrid/tool-emulation.ts +19 -7
  105. package/bundle/src/testing/schema-bench.test.ts +358 -0
  106. package/bundle/src/testing/schema-bench.ts +352 -0
  107. package/bundle/src/utils/providers/anthropic/fence-strip.test.ts +122 -0
  108. package/bundle/src/utils/providers/anthropic/fence-strip.ts +105 -0
  109. package/bundle/src/utils/providers/anthropic/stream-json-adapter.ts +2 -8
  110. package/bundle/web-dist/client/assets/{index-C24D5PiN.js → index-C0594sjh.js} +3 -3
  111. package/bundle/web-dist/client/assets/{logs-CIlZG6A3.js → logs-BotUcOEB.js} +1 -1
  112. package/bundle/web-dist/client/assets/{monit-DZFBMxKl.js → monit-kk3vnGvu.js} +1 -1
  113. package/bundle/web-dist/client/assets/{routes-C3wlSNBL.js → routes-J4bnHVfl.js} +1 -1
  114. package/bundle/web-dist/client/assets/{settings-ClRDWO-8.js → settings-CAAQSIyg.js} +1 -1
  115. package/bundle/web-dist/client/assets/{show-BP7U8yyJ.js → show-BryNvjUT.js} +1 -1
  116. package/bundle/web-dist/client/assets/{tokens-DfQeULnJ.js → tokens-DDrATjGA.js} +1 -1
  117. package/bundle/web-dist/client/assets/{use-oauth-login-flow-CY-ASCfL.js → use-oauth-login-flow-CptleCFM.js} +1 -1
  118. package/bundle/web-dist/client/index.html +1 -1
  119. package/bundle/web-dist/server/entry-server.generated.js +1 -1
  120. package/package.json +1 -1
  121. package/skills/qgrid/references/ai-sdk-provider-contract.md +20 -15
  122. package/skills/qgrid/references/anthropic-claude-code-runtime.md +31 -14
  123. package/skills/qgrid/references/decision-rationale.md +13 -3
  124. package/skills/qgrid/references/prompt-cache-and-usage.md +4 -1
  125. package/skills/qgrid/references/provider-runtime-differences.md +3 -3
  126. package/skills/qgrid/references/tool-calling-and-multiturn.md +16 -6
@@ -1 +1 @@
1
- import"./rolldown-runtime-Dw2cE7zH.js";import{l as e,u as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,r}from"./vendor-react-DH4kUfK2.js";import{h as i,m as a,n as o,o as s,p as c,r as l}from"./services.generated-jGypfumC.js";import{n as u}from"./index-C24D5PiN.js";import{n as d,r as f,t as p}from"./cost-CpjVoAqp.js";n();var m=r(),h=e=>(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,m.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m15 18l-6-6l6-6`})}),g=e=>(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,m.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m9 18l6-6l-6-6`})}),_=50,v=`__unassigned__`;function y(e){let t=new Date(e);return`${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function b(e){return e.toLocaleString()}function x(e){let t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n>0?`${n}m ${r}s`:`${r}s`}function S({status:e,requestedModel:t,servedModel:n,fallbackCount:r}){if(e===`running`)return(0,m.jsx)(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-blue-100 text-blue-600 font-medium whitespace-nowrap`,children:`실행 중`});let i=t!==null&&n!==null&&t!==n,a=t!==null&&n===null;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`text-xs text-sand-500`,children:i?`${t} → ${n}`:n??t??`—`}),a&&(0,m.jsx)(`span`,{className:`ml-1 text-[9px] text-sand-400`,children:`요청`}),(r??0)>0&&(0,m.jsxs)(`span`,{className:`ml-1 text-[9px] text-caution-500`,children:[`×`,r]})]})}function C(e){return e<=0?`—`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}var w=[{label:`ID`,align:`left`,width:`w-12`,sortKey:`id`},{label:`Date`,align:`left`,width:`w-20`,sortKey:`created_at`},{label:`Project`,align:`left`,width:`w-20`},{label:`Token`,align:`left`,width:`w-24`},{label:`Model`,align:`left`,width:`w-20`},{label:`TTFT`,align:`right`,width:`w-16`,sortKey:`ttft_ms`},{label:`Duration`,align:`right`,width:`w-20`,sortKey:`duration_ms`},{label:`In`,align:`right`,width:`w-16`,sortKey:`input_tokens`},{label:`Out`,align:`right`,width:`w-20`,sortKey:`output_tokens`},{label:`C.Read`,align:`right`,width:`w-20`,sortKey:`cache_read_tokens`},{label:`C.Write`,align:`right`,width:`w-20`,sortKey:`cache_creation_tokens`},{label:`Hit`,align:`right`,width:`w-14`},{label:`Tools`,align:`right`,width:`w-14`},{label:`Cost`,align:`right`,width:`w-20`,sortKey:`cost_usd`}];function T({search:n,onSearchChange:r}){let i=t(),a=n.page??1,c=n.token??``,u=n.project??``,T=n.model??``,{data:E}=s.useTokens(`A`),D=(E?.rows??[]).map(e=>e.name).filter(Boolean),{data:O}=o.useProjectNames(),k=O?.names??[],{data:A}=o.useModelNames(),j=A?.names??[],M=u===v?{project_name_is_null:!0}:u?{project_name:u}:{},N={...c?{token_name:c}:{},...M,...T?{model_name:T}:{}},P=n.sort??`id-desc`,F=P.lastIndexOf(`-`),I=P.slice(0,F),L=P.slice(F+1)===`asc`?`asc`:`desc`,{data:R,isLoading:z}=l.useRequestLogs(`P`,{num:_,page:a,orderBy:P,...N}),{data:B}=o.useTotalCost({num:0,page:1,...N}),V=R?.rows??[],H=R?.total??0,U=Math.ceil(H/_),W=e=>{r({...n,...e,page:1})};return(0,m.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`panel-header flex items-center gap-2 px-3 py-2.5 flex-wrap sm:gap-3 sm:px-5`,children:[(0,m.jsxs)(`select`,{value:c,onChange:e=>W({token:e.target.value||void 0}),disabled:D.length===0,className:`border border-sand-200/80 rounded-lg px-2.5 py-1.5 text-[11px] text-sand-700 bg-sand-50/50 focus:outline-none focus:border-sienna-300 disabled:text-sand-300 disabled:cursor-not-allowed`,children:[(0,m.jsx)(`option`,{value:``,children:D.length>0?`All Tokens`:`Tokens —`}),D.map(e=>(0,m.jsx)(`option`,{value:e,children:e},e))]}),(0,m.jsxs)(`select`,{value:u,onChange:e=>W({project:e.target.value||void 0}),className:`border border-sand-200/80 rounded-lg px-2.5 py-1.5 text-[11px] text-sand-700 bg-sand-50/50 focus:outline-none focus:border-sienna-300`,children:[(0,m.jsx)(`option`,{value:``,children:`All Projects`}),(0,m.jsx)(`option`,{value:v,children:`(unassigned)`}),k.map(e=>(0,m.jsx)(`option`,{value:e,children:e},e))]}),(0,m.jsxs)(`select`,{value:T,onChange:e=>W({model:e.target.value||void 0}),disabled:j.length===0,className:`border border-sand-200/80 rounded-lg px-2.5 py-1.5 text-[11px] text-sand-700 bg-sand-50/50 focus:outline-none focus:border-sienna-300 disabled:text-sand-300 disabled:cursor-not-allowed`,children:[(0,m.jsx)(`option`,{value:``,children:j.length>0?`All Models`:`Models —`}),j.map(e=>(0,m.jsx)(`option`,{value:e,children:e},e))]}),(0,m.jsx)(`div`,{className:`flex-1`}),(0,m.jsxs)(`span`,{className:`text-[11px] text-sand-400`,children:[H,` results`]}),(0,m.jsx)(`span`,{className:`text-[11px] tabular-nums font-medium text-sienna-600`,children:f(B?.usd??0)})]}),z?(0,m.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:5}).map((e,t)=>(0,m.jsx)(`div`,{className:`h-8 bg-sand-100 rounded animate-pulse`},`skel-${t}`))}):V.length===0?(0,m.jsx)(`div`,{className:`text-sand-400 text-center py-12 text-sm`,children:`No requests yet.`}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`overflow-x-auto px-3 py-3 sm:px-5`,children:(0,m.jsxs)(`table`,{className:`w-full min-w-[900px] text-[13px]`,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{className:`border-b border-sand-100/60`,children:[w.map(e=>{let t=e.label===`Duration`?`pl-5 pr-3`:e.width?`px-4`:`px-3`,n=e.sortKey===I;return(0,m.jsx)(`th`,{className:`${e.align===`right`?`text-right`:`text-left`} ${e.width??``} ${e.width?`whitespace-nowrap`:``} ${t} py-1.5 text-[10px] uppercase font-medium ${n?`text-sienna-600`:`text-sand-400`}`,children:e.sortKey?(0,m.jsxs)(`button`,{type:`button`,onClick:()=>W({sort:`${e.sortKey}-${n&&L===`desc`?`asc`:`desc`}`}),className:`inline-flex items-center gap-0.5 text-[10px] uppercase font-medium hover:text-sienna-500 transition-colors duration-150 ${e.align===`right`?`justify-end w-full`:``}`,children:[e.label,(0,m.jsx)(`span`,{className:n?``:`text-sand-300`,children:n?L===`desc`?`↓`:`↑`:`↕`})]}):e.label},e.label)}),(0,m.jsx)(`th`,{className:`w-8`})]})}),(0,m.jsx)(`tbody`,{className:`divide-y divide-sand-100/60`,children:V.map(t=>(0,m.jsxs)(`tr`,{className:`transition-colors duration-150 hover:bg-sand-100/60 cursor-pointer`,onClick:e=>{if(e.metaKey||e.ctrlKey){window.open(`/requests/show?id=${t.id}`,`_blank`);return}i({to:`/requests/show`,search:{id:t.id}})},children:[(0,m.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:(0,m.jsx)(e,{to:`/requests/show`,search:{id:t.id},onClick:e=>e.stopPropagation(),className:`text-xs text-sand-500 tabular-nums hover:text-sienna-500`,children:t.id})}),(0,m.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:(0,m.jsx)(`span`,{className:`text-xs text-sand-400 tabular-nums`,children:y(t.created_at)})}),(0,m.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:(0,m.jsx)(`span`,{className:`text-xs text-sand-600`,children:t.project_name??`—`})}),(0,m.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:(0,m.jsx)(`span`,{className:`text-xs text-sand-500`,children:t.token_name})}),(0,m.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:(0,m.jsx)(S,{status:t.status,requestedModel:t.requested_model_name,servedModel:t.model_name,fallbackCount:t.fallback_count})}),(0,m.jsx)(`td`,{className:`px-4 py-1.5 text-right tabular-nums text-sand-500 whitespace-nowrap`,children:C(t.ttft_ms)}),(0,m.jsx)(`td`,{className:`pl-5 pr-3 py-1.5 text-right tabular-nums text-sand-500 whitespace-nowrap`,children:x(t.duration_ms)}),(0,m.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:b(t.input_tokens)}),(0,m.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:b(t.output_tokens)}),(0,m.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:b(t.cache_read_tokens)}),(0,m.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:b(t.cache_creation_tokens)}),(0,m.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:p(t)}),(0,m.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-500`,children:t.tool_call_count>0?t.tool_call_count:`—`}),(0,m.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:t.image_cost_usd===null?t.cost_usd===null?`—`:d(t.cost_usd):d((t.cost_usd??0)+t.image_cost_usd)}),(0,m.jsx)(`td`,{className:`px-2 py-1.5`,children:(0,m.jsx)(g,{className:`size-4 text-sand-400`})})]},t.id))})]})}),U>1&&(0,m.jsxs)(`div`,{className:`flex items-center justify-center gap-3 px-5 py-2.5 border-t border-sand-100/60`,children:[(0,m.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-sand-600 disabled:opacity-30 transition-colors`,disabled:a===1,onClick:()=>r({...n,page:a-1}),children:(0,m.jsx)(h,{className:`size-4`})}),(0,m.jsxs)(`span`,{className:`text-[11px] text-sand-400 tabular-nums`,children:[a,` / `,U]}),(0,m.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-sand-600 disabled:opacity-30 transition-colors`,disabled:a===U,onClick:()=>r({...n,page:a+1}),children:(0,m.jsx)(g,{className:`size-4`})})]})]})]})}a({token:i().optional(),project:i().optional(),model:i().optional(),sort:i().optional(),page:c().optional().default(1)});function E(){let e=u.useSearch(),t=u.useNavigate();return(0,m.jsx)(`div`,{className:`max-w-[100rem] mx-auto`,children:(0,m.jsx)(T,{search:e,onSearchChange:e=>t({search:e})})})}export{E as component};
1
+ import"./rolldown-runtime-Dw2cE7zH.js";import{l as e,u as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,r}from"./vendor-react-DH4kUfK2.js";import{h as i,m as a,n as o,o as s,p as c,r as l}from"./services.generated-jGypfumC.js";import{n as u}from"./index-C0594sjh.js";import{n as d,r as f,t as p}from"./cost-CpjVoAqp.js";n();var m=r(),h=e=>(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,m.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m15 18l-6-6l6-6`})}),g=e=>(0,m.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,m.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m9 18l6-6l-6-6`})}),_=50,v=`__unassigned__`;function y(e){let t=new Date(e);return`${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function b(e){return e.toLocaleString()}function x(e){let t=Math.round(e/1e3),n=Math.floor(t/60),r=t%60;return n>0?`${n}m ${r}s`:`${r}s`}function S({status:e,requestedModel:t,servedModel:n,fallbackCount:r}){if(e===`running`)return(0,m.jsx)(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-blue-100 text-blue-600 font-medium whitespace-nowrap`,children:`실행 중`});let i=t!==null&&n!==null&&t!==n,a=t!==null&&n===null;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`text-xs text-sand-500`,children:i?`${t} → ${n}`:n??t??`—`}),a&&(0,m.jsx)(`span`,{className:`ml-1 text-[9px] text-sand-400`,children:`요청`}),(r??0)>0&&(0,m.jsxs)(`span`,{className:`ml-1 text-[9px] text-caution-500`,children:[`×`,r]})]})}function C(e){return e<=0?`—`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}var w=[{label:`ID`,align:`left`,width:`w-12`,sortKey:`id`},{label:`Date`,align:`left`,width:`w-20`,sortKey:`created_at`},{label:`Project`,align:`left`,width:`w-20`},{label:`Token`,align:`left`,width:`w-24`},{label:`Model`,align:`left`,width:`w-20`},{label:`TTFT`,align:`right`,width:`w-16`,sortKey:`ttft_ms`},{label:`Duration`,align:`right`,width:`w-20`,sortKey:`duration_ms`},{label:`In`,align:`right`,width:`w-16`,sortKey:`input_tokens`},{label:`Out`,align:`right`,width:`w-20`,sortKey:`output_tokens`},{label:`C.Read`,align:`right`,width:`w-20`,sortKey:`cache_read_tokens`},{label:`C.Write`,align:`right`,width:`w-20`,sortKey:`cache_creation_tokens`},{label:`Hit`,align:`right`,width:`w-14`},{label:`Tools`,align:`right`,width:`w-14`},{label:`Cost`,align:`right`,width:`w-20`,sortKey:`cost_usd`}];function T({search:n,onSearchChange:r}){let i=t(),a=n.page??1,c=n.token??``,u=n.project??``,T=n.model??``,{data:E}=s.useTokens(`A`),D=(E?.rows??[]).map(e=>e.name).filter(Boolean),{data:O}=o.useProjectNames(),k=O?.names??[],{data:A}=o.useModelNames(),j=A?.names??[],M=u===v?{project_name_is_null:!0}:u?{project_name:u}:{},N={...c?{token_name:c}:{},...M,...T?{model_name:T}:{}},P=n.sort??`id-desc`,F=P.lastIndexOf(`-`),I=P.slice(0,F),L=P.slice(F+1)===`asc`?`asc`:`desc`,{data:R,isLoading:z}=l.useRequestLogs(`P`,{num:_,page:a,orderBy:P,...N}),{data:B}=o.useTotalCost({num:0,page:1,...N}),V=R?.rows??[],H=R?.total??0,U=Math.ceil(H/_),W=e=>{r({...n,...e,page:1})};return(0,m.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`panel-header flex items-center gap-2 px-3 py-2.5 flex-wrap sm:gap-3 sm:px-5`,children:[(0,m.jsxs)(`select`,{value:c,onChange:e=>W({token:e.target.value||void 0}),disabled:D.length===0,className:`border border-sand-200/80 rounded-lg px-2.5 py-1.5 text-[11px] text-sand-700 bg-sand-50/50 focus:outline-none focus:border-sienna-300 disabled:text-sand-300 disabled:cursor-not-allowed`,children:[(0,m.jsx)(`option`,{value:``,children:D.length>0?`All Tokens`:`Tokens —`}),D.map(e=>(0,m.jsx)(`option`,{value:e,children:e},e))]}),(0,m.jsxs)(`select`,{value:u,onChange:e=>W({project:e.target.value||void 0}),className:`border border-sand-200/80 rounded-lg px-2.5 py-1.5 text-[11px] text-sand-700 bg-sand-50/50 focus:outline-none focus:border-sienna-300`,children:[(0,m.jsx)(`option`,{value:``,children:`All Projects`}),(0,m.jsx)(`option`,{value:v,children:`(unassigned)`}),k.map(e=>(0,m.jsx)(`option`,{value:e,children:e},e))]}),(0,m.jsxs)(`select`,{value:T,onChange:e=>W({model:e.target.value||void 0}),disabled:j.length===0,className:`border border-sand-200/80 rounded-lg px-2.5 py-1.5 text-[11px] text-sand-700 bg-sand-50/50 focus:outline-none focus:border-sienna-300 disabled:text-sand-300 disabled:cursor-not-allowed`,children:[(0,m.jsx)(`option`,{value:``,children:j.length>0?`All Models`:`Models —`}),j.map(e=>(0,m.jsx)(`option`,{value:e,children:e},e))]}),(0,m.jsx)(`div`,{className:`flex-1`}),(0,m.jsxs)(`span`,{className:`text-[11px] text-sand-400`,children:[H,` results`]}),(0,m.jsx)(`span`,{className:`text-[11px] tabular-nums font-medium text-sienna-600`,children:f(B?.usd??0)})]}),z?(0,m.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:5}).map((e,t)=>(0,m.jsx)(`div`,{className:`h-8 bg-sand-100 rounded animate-pulse`},`skel-${t}`))}):V.length===0?(0,m.jsx)(`div`,{className:`text-sand-400 text-center py-12 text-sm`,children:`No requests yet.`}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`overflow-x-auto px-3 py-3 sm:px-5`,children:(0,m.jsxs)(`table`,{className:`w-full min-w-[900px] text-[13px]`,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{className:`border-b border-sand-100/60`,children:[w.map(e=>{let t=e.label===`Duration`?`pl-5 pr-3`:e.width?`px-4`:`px-3`,n=e.sortKey===I;return(0,m.jsx)(`th`,{className:`${e.align===`right`?`text-right`:`text-left`} ${e.width??``} ${e.width?`whitespace-nowrap`:``} ${t} py-1.5 text-[10px] uppercase font-medium ${n?`text-sienna-600`:`text-sand-400`}`,children:e.sortKey?(0,m.jsxs)(`button`,{type:`button`,onClick:()=>W({sort:`${e.sortKey}-${n&&L===`desc`?`asc`:`desc`}`}),className:`inline-flex items-center gap-0.5 text-[10px] uppercase font-medium hover:text-sienna-500 transition-colors duration-150 ${e.align===`right`?`justify-end w-full`:``}`,children:[e.label,(0,m.jsx)(`span`,{className:n?``:`text-sand-300`,children:n?L===`desc`?`↓`:`↑`:`↕`})]}):e.label},e.label)}),(0,m.jsx)(`th`,{className:`w-8`})]})}),(0,m.jsx)(`tbody`,{className:`divide-y divide-sand-100/60`,children:V.map(t=>(0,m.jsxs)(`tr`,{className:`transition-colors duration-150 hover:bg-sand-100/60 cursor-pointer`,onClick:e=>{if(e.metaKey||e.ctrlKey){window.open(`/requests/show?id=${t.id}`,`_blank`);return}i({to:`/requests/show`,search:{id:t.id}})},children:[(0,m.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:(0,m.jsx)(e,{to:`/requests/show`,search:{id:t.id},onClick:e=>e.stopPropagation(),className:`text-xs text-sand-500 tabular-nums hover:text-sienna-500`,children:t.id})}),(0,m.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:(0,m.jsx)(`span`,{className:`text-xs text-sand-400 tabular-nums`,children:y(t.created_at)})}),(0,m.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:(0,m.jsx)(`span`,{className:`text-xs text-sand-600`,children:t.project_name??`—`})}),(0,m.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:(0,m.jsx)(`span`,{className:`text-xs text-sand-500`,children:t.token_name})}),(0,m.jsx)(`td`,{className:`px-4 py-1.5 whitespace-nowrap`,children:(0,m.jsx)(S,{status:t.status,requestedModel:t.requested_model_name,servedModel:t.model_name,fallbackCount:t.fallback_count})}),(0,m.jsx)(`td`,{className:`px-4 py-1.5 text-right tabular-nums text-sand-500 whitespace-nowrap`,children:C(t.ttft_ms)}),(0,m.jsx)(`td`,{className:`pl-5 pr-3 py-1.5 text-right tabular-nums text-sand-500 whitespace-nowrap`,children:x(t.duration_ms)}),(0,m.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:b(t.input_tokens)}),(0,m.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:b(t.output_tokens)}),(0,m.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:b(t.cache_read_tokens)}),(0,m.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:b(t.cache_creation_tokens)}),(0,m.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:p(t)}),(0,m.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-500`,children:t.tool_call_count>0?t.tool_call_count:`—`}),(0,m.jsx)(`td`,{className:`px-3 py-1.5 text-right tabular-nums text-sand-700`,children:t.image_cost_usd===null?t.cost_usd===null?`—`:d(t.cost_usd):d((t.cost_usd??0)+t.image_cost_usd)}),(0,m.jsx)(`td`,{className:`px-2 py-1.5`,children:(0,m.jsx)(g,{className:`size-4 text-sand-400`})})]},t.id))})]})}),U>1&&(0,m.jsxs)(`div`,{className:`flex items-center justify-center gap-3 px-5 py-2.5 border-t border-sand-100/60`,children:[(0,m.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-sand-600 disabled:opacity-30 transition-colors`,disabled:a===1,onClick:()=>r({...n,page:a-1}),children:(0,m.jsx)(h,{className:`size-4`})}),(0,m.jsxs)(`span`,{className:`text-[11px] text-sand-400 tabular-nums`,children:[a,` / `,U]}),(0,m.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-sand-600 disabled:opacity-30 transition-colors`,disabled:a===U,onClick:()=>r({...n,page:a+1}),children:(0,m.jsx)(g,{className:`size-4`})})]})]})]})}a({token:i().optional(),project:i().optional(),model:i().optional(),sort:i().optional(),page:c().optional().default(1)});function E(){let e=u.useSearch(),t=u.useNavigate();return(0,m.jsx)(`div`,{className:`max-w-[100rem] mx-auto`,children:(0,m.jsx)(T,{search:e,onSearchChange:e=>t({search:e})})})}export{E as component};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{_ as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,n as r,r as i}from"./vendor-react-DH4kUfK2.js";import{f as a,m as o,t as s}from"./services.generated-jGypfumC.js";import{a as c,r as l}from"./index-C24D5PiN.js";var u=e(n(),1),d=e(r(),1);function f(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function p(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function m(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var h=(e,t)=>Math.abs(e-t)<1.01,g=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},_,v=()=>{if(_!==void 0)return _;if(typeof navigator>`u`)return _=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return _=!0;let e=navigator.maxTouchPoints;return _=navigator.platform===`MacIntel`&&e!==void 0&&e>0},y=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},b=e=>e,x=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},S=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(y(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(y(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},C={passive:!0},w=typeof window>`u`?!0:`onscrollend`in window,T=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&w,o=0,s=a?null:g(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,C),a&&r.addEventListener(`scrollend`,u,C),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},E=(e,t)=>T(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),D=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},O=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},k=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:b,rangeExtractor:x,onChange:()=>{},measureElement:D,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=e.start+t;n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=p(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!v()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,C),e.addEventListener(`touchend`,n,C),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(v()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=p(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.getMeasurements=p(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=f(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),p=Array(a).fill(void 0),m=new Float64Array(a),h=0;for(let e=0;e<u;e++){let t=d[e];t&&(p[t.lane]===void 0&&h++,p[t.lane]=e,m[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,f,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=p[u],r=e===void 0?void 0:d[e];f=r?r.end+s:t+n}else if(h===a){let e=0,t=m[0],n=p[0];for(let r=1;r<a;r++){let i=m[r];(i<t||i===t&&p[r]<n)&&(e=r,t=i,n=p[r])}u=e,f=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,f=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=f+v;d[i]={index:i,start:f,size:v,end:y,key:e,lane:u},p[u]===void 0&&h++,p[u]=i,m[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=p(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=M(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=p(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);if(o!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,s=a?this.getTotalSize():0,c=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(i)||this.scrollDirection!==`backward`):this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,a?this.applyScrollAdjustment(this.getTotalSize()-s):c&&this.applyScrollAdjustment(o),this.notify(!1)}},this.getVirtualItems=p(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return m(t[A(0,t.length-1,r?e=>n[e*2]:e=>m(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t);this.scrollState={index:null,align:t,behavior:n,startedAt:this.now(),lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e;this.scrollState={index:null,align:`start`,behavior:t,startedAt:this.now(),lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){e!==0&&(v()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&h(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},A=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function j(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function M(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=j(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=A(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var N=typeof document<`u`?u.useLayoutEffect:u.useEffect;function P({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=u.useReducer(e=>e+1,0)[1],a=u.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}let r=!!e.options.horizontal,i=t.mode===`transform`,o=r?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let n of c){let a=n.start-s,c=e.elementsCache.get(n.key);c&&t.lastPositions.get(c)!==a&&(t.lastPositions.set(c,a),i?c.style.transform=r?`translate3d(${a}px, 0, 0)`:`translate3d(0, ${a}px, 0)`:c.style[o]=`${a}px`)}},s={...r,onChange:(t,n)=>{var s;let c=a.current,l=!0;if(c.enabled){o(t);let e=t.range,n=c.prevRange;l=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,l&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}l&&(e&&n?(0,d.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[c]=u.useState(()=>{let e=new k(s);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return c.setOptions(s),N(()=>c._didMount(),[]),N(()=>c._willUpdate()),N(()=>{o(c)}),c}function F(e){return P({observeElementRect:S,observeElementOffset:E,scrollToFn:O,...e})}var I=i(),L=e=>(0,I.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,I.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,I.jsx)(`path`,{d:`M3 12a9 9 0 0 1 9-9a9.75 9.75 0 0 1 6.74 2.74L21 8`}),(0,I.jsx)(`path`,{d:`M21 3v5h-5m5 4a9 9 0 0 1-9 9a9.75 9.75 0 0 1-6.74-2.74L3 16`}),(0,I.jsx)(`path`,{d:`M8 16H3v5`})]})}),R=1e3,z=5e3,B=4e3,V={trace:0,debug:1,info:2,warning:3,error:4,fatal:5},H=/autoscale|worker/i,U={trace:`TRC`,debug:`DBG`,info:`INF`,warning:`WRN`,error:`ERR`,fatal:`FTL`},W=new Intl.DateTimeFormat(`en-GB`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1});function G(e){return W.format(new Date(e))}function K(e){return e.join(`·`)}function q({search:e,onSearchChange:n}){let[r,i]=(0,u.useState)([]),a=(0,u.useRef)(void 0),o=(0,u.useRef)(void 0),l=(0,u.useRef)(0),[d,f]=(0,u.useState)(()=>Date.now()),p=t({queryKey:[`Monit`,`monitLogs`],queryFn:()=>s.monitLogs(a.current),refetchInterval:R,retry:!1}),m=t({...s.monitInfoQueryOptions(),staleTime:1/0}).data,h=p.data?.vitals;(0,u.useEffect)(()=>{let e=p.data;e&&g(e)},[p.data]);function g(e){let t=()=>++l.current;i(n=>{let r=n,i=[];o.current!==void 0&&e.processStartedAt!==o.current?(r=[],i.push({kind:`restart`,key:t(),processStartedAt:e.processStartedAt})):e.dropped>0&&i.push({kind:`dropped`,key:t(),count:e.dropped}),o.current=e.processStartedAt,a.current=e.nextCursor;let s=r.findLast(e=>e.kind===`log`)?.entry.seq;for(let n of e.entries)s!==void 0&&n.seq<=s||i.push({kind:`log`,key:t(),entry:n});if(i.length===0)return n;let c=[...r,...i];return c.length>B?c.slice(-B):c})}(0,u.useEffect)(()=>{let e=window.setInterval(()=>f(Date.now()),2e3);return()=>window.clearInterval(e)},[]);let _=r.length>0&&(p.isRefetchError||p.dataUpdatedAt>0&&d-p.dataUpdatedAt>z),v=(0,u.useMemo)(()=>r.filter(t=>{if(t.kind!==`log`)return!0;switch(e.level){case`scaling`:return H.test(t.entry.text);case`warn`:return(V[t.entry.level]??2)>=3;case`error`:return(V[t.entry.level]??2)>=4;default:return!0}}),[r,e.level]),y=(0,u.useRef)(null),b=F({count:v.length,getScrollElement:()=>y.current,estimateSize:()=>20,getItemKey:e=>v[e].key,anchorTo:`end`,followOnAppend:!0,scrollEndThreshold:80,overscan:12}),x=b.isAtEnd(),S=p.dataUpdatedAt>0,C=!S&&p.isError;return(0,I.jsxs)(`section`,{className:`panel overflow-hidden`,children:[(0,I.jsxs)(`header`,{className:`panel-header flex min-h-11 flex-wrap items-center gap-x-3 gap-y-2 px-4 py-2 sm:px-5`,children:[(0,I.jsx)(`h2`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-sand-800`,children:`Server logs`}),(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11px] font-medium text-sand-700`,children:[(0,I.jsx)(`span`,{className:c(`size-1.5 rounded-full`,_||C?`bg-danger-400`:`bg-sienna-500 motion-safe:animate-pulse`)}),C?`Disconnected`:_?`Stale`:S?`Live`:`…`]}),o.current!==void 0&&(0,I.jsxs)(`span`,{className:`text-[11px] text-sand-500`,children:[`ephemeral · resets on restart · since `,G(o.current)]}),(0,I.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:(0,I.jsx)(`div`,{className:`segmented-control inline-flex`,role:`tablist`,"aria-label":`Log filter`,children:[{value:`all`,label:`All`},{value:`scaling`,label:`Scaling`},{value:`warn`,label:`Warn+`},{value:`error`,label:`Err+`}].map(t=>(0,I.jsx)(`button`,{type:`button`,"data-active":e.level===t.value,onClick:()=>n({...e,level:t.value}),className:`rounded-[6px] px-2.5 py-1 text-[11px] font-medium text-sand-500 transition-colors hover:text-sand-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sienna-300 data-[active=true]:text-sand-900`,children:t.label},t.value))})})]}),m&&(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 gap-y-1 border-b border-sand-100 bg-sand-50/60 px-4 py-2 text-[11px] text-sand-600 sm:px-5`,children:[(0,I.jsxs)(`span`,{children:[`server `,(0,I.jsx)(`span`,{className:`font-mono text-sand-800`,children:m.serverUrl})]}),(0,I.jsxs)(`span`,{children:[`db`,` `,(0,I.jsxs)(`span`,{className:`font-mono text-sand-800`,children:[m.dbHost,`/`,m.dbName]})]}),(0,I.jsxs)(`span`,{children:[`workers/token`,` `,(0,I.jsxs)(`span`,{className:`font-mono text-sand-800`,children:[m.openai.minWorkersPerToken,`–`,m.openai.maxWorkersPerToken]}),` `,m.openai.autoscale?`autoscale`:`fixed`]}),h&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`span`,{children:[`openai workers`,` `,(0,I.jsxs)(`span`,{className:`font-mono text-sand-800`,children:[h.openaiReadyWorkerCount,`/`,h.openaiWorkerCount]}),` `,`ready`]}),(0,I.jsxs)(`span`,{children:[`queue`,` `,(0,I.jsx)(`span`,{className:c(`font-mono`,h.openaiQueueLength>0?`font-semibold text-caution-500`:`text-sand-800`),children:h.openaiQueueLength})]})]})]}),h&&(h.openaiWorkersByToken.length>0||h.anthropicTokenNames.length>0)&&(0,I.jsxs)(`div`,{className:`space-y-1.5 border-b border-sand-100 px-4 py-2.5 sm:px-5`,children:[h.openaiWorkersByToken.length>0&&(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`w-[4.5rem] shrink-0 text-[10px] font-medium uppercase tracking-[0.08em] text-sand-400`,children:`openai`}),h.openaiWorkersByToken.map(e=>(0,I.jsxs)(`span`,{title:`${e.name}: ${e.count} workers`,className:`inline-flex items-baseline gap-1.5 rounded-md border border-sand-200 bg-white px-2 py-1`,children:[(0,I.jsx)(`span`,{className:`font-mono text-[11px] text-sand-600`,children:e.name.split(`/`).pop()}),(0,I.jsx)(`span`,{className:`font-mono text-[13px] font-semibold tracking-[-0.02em] text-sand-900`,children:e.count})]},e.name))]}),h.anthropicTokenNames.length>0&&(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`w-[4.5rem] shrink-0 text-[10px] font-medium uppercase tracking-[0.08em] text-sand-400`,children:`anthropic`}),h.anthropicTokenNames.map(e=>(0,I.jsx)(`span`,{title:e,className:`inline-flex items-baseline rounded-md border border-sand-200 bg-white px-2 py-1 font-mono text-[11px] text-sand-600`,children:e.split(`/`).pop()},e))]})]}),(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsx)(`div`,{ref:y,role:`log`,"aria-label":`Server process logs`,tabIndex:0,className:`main-scroll h-[calc(100vh-232px)] min-h-[320px] overflow-y-auto bg-sand-900 px-4 py-3 font-mono text-[12px] leading-[1.6] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sienna-400`,children:C?(0,I.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-sand-400`,children:[(0,I.jsxs)(`p`,{className:`text-[12px]`,children:[`Could not reach the qgrid server — is it running?`,p.error instanceof Error&&(0,I.jsx)(`span`,{className:`block text-center text-[11px] text-sand-500`,children:p.error.message})]}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>void p.refetch(),className:`inline-flex items-center gap-1.5 rounded-md border border-sand-600 px-2.5 py-1.5 text-[11px] font-medium text-sand-300 transition-colors hover:bg-sand-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sienna-400`,children:[(0,I.jsx)(L,{className:`size-3`}),`Retry now`]})]}):S?v.length===0?(0,I.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-sand-500`,children:r.length===0?`No log lines yet — waiting for activity since ${o.current===void 0?`startup`:G(o.current)}.`:`No lines match the current filters.`}):(0,I.jsx)(`div`,{className:`relative w-full`,style:{height:`${b.getTotalSize()}px`},children:b.getVirtualItems().map(e=>{let t=v[e.index];return(0,I.jsx)(`div`,{ref:b.measureElement,"data-index":e.index,className:`absolute left-0 top-0 w-full`,style:{transform:`translateY(${e.start}px)`},children:(0,I.jsx)(J,{item:t})},e.key)})}):(0,I.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-sand-500`,children:`Connecting to server logs…`})}),S&&!C&&!x&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>b.scrollToEnd(),className:`absolute bottom-4 right-5 inline-flex items-center gap-1.5 rounded-full border border-sand-600 bg-sand-800/90 px-3 py-1.5 text-[11px] font-medium text-sand-200 shadow-lg backdrop-blur transition-colors hover:bg-sand-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sienna-400`,children:`↓ Jump to live`})]})]})}function J({item:e}){if(e.kind===`restart`)return(0,I.jsxs)(`div`,{className:`py-1 text-center text-[11px] text-caution-400`,children:[`── process restarted · `,G(e.processStartedAt),` ──`]});if(e.kind===`dropped`)return(0,I.jsxs)(`div`,{className:`py-1 text-center text-[11px] italic text-sand-500`,children:[`── `,e.count,` lines dropped (buffer overflow) ──`]});let{entry:t}=e;return(0,I.jsxs)(`div`,{className:`whitespace-pre-wrap break-words text-sand-200`,children:[(0,I.jsx)(`span`,{className:`text-sand-500`,children:G(t.timestamp)}),` `,(0,I.jsx)(`span`,{className:c(`font-semibold`,t.level===`fatal`||t.level===`error`?`text-danger-400`:t.level===`warning`?`text-caution-400`:`text-sand-400`),children:U[t.level]??t.level.slice(0,3).toUpperCase()}),` `,(0,I.jsx)(`span`,{className:`text-sienna-300`,children:K(t.category)}),` `,(0,I.jsx)(`span`,{children:t.text})]})}o({level:a([`all`,`scaling`,`warn`,`error`]).optional().default(`all`)});function Y(){let e=l.useSearch(),t=l.useNavigate();return(0,I.jsx)(`div`,{className:`max-w-[100rem] mx-auto`,children:(0,I.jsx)(q,{search:e,onSearchChange:e=>t({search:e,replace:!0})})})}export{Y as component};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{_ as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,n as r,r as i}from"./vendor-react-DH4kUfK2.js";import{f as a,m as o,t as s}from"./services.generated-jGypfumC.js";import{a as c,r as l}from"./index-C0594sjh.js";var u=e(n(),1),d=e(r(),1);function f(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function p(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function m(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var h=(e,t)=>Math.abs(e-t)<1.01,g=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},_,v=()=>{if(_!==void 0)return _;if(typeof navigator>`u`)return _=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return _=!0;let e=navigator.maxTouchPoints;return _=navigator.platform===`MacIntel`&&e!==void 0&&e>0},y=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},b=e=>e,x=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},S=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(y(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(y(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},C={passive:!0},w=typeof window>`u`?!0:`onscrollend`in window,T=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&w,o=0,s=a?null:g(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,C),a&&r.addEventListener(`scrollend`,u,C),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},E=(e,t)=>T(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),D=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},O=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},k=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:b,rangeExtractor:x,onChange:()=>{},measureElement:D,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=e.start+t;n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=p(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!v()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,C),e.addEventListener(`touchend`,n,C),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(v()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=p(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.getMeasurements=p(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=f(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),p=Array(a).fill(void 0),m=new Float64Array(a),h=0;for(let e=0;e<u;e++){let t=d[e];t&&(p[t.lane]===void 0&&h++,p[t.lane]=e,m[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,f,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=p[u],r=e===void 0?void 0:d[e];f=r?r.end+s:t+n}else if(h===a){let e=0,t=m[0],n=p[0];for(let r=1;r<a;r++){let i=m[r];(i<t||i===t&&p[r]<n)&&(e=r,t=i,n=p[r])}u=e,f=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,f=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=f+v;d[i]={index:i,start:f,size:v,end:y,key:e,lane:u},p[u]===void 0&&h++,p[u]=i,m[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=p(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=M(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=p(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);if(o!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,s=a?this.getTotalSize():0,c=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(i)||this.scrollDirection!==`backward`):this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,a?this.applyScrollAdjustment(this.getTotalSize()-s):c&&this.applyScrollAdjustment(o),this.notify(!1)}},this.getVirtualItems=p(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return m(t[A(0,t.length-1,r?e=>n[e*2]:e=>m(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t);this.scrollState={index:null,align:t,behavior:n,startedAt:this.now(),lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e;this.scrollState={index:null,align:`start`,behavior:t,startedAt:this.now(),lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){e!==0&&(v()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&h(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},A=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function j(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function M(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=j(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=A(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var N=typeof document<`u`?u.useLayoutEffect:u.useEffect;function P({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=u.useReducer(e=>e+1,0)[1],a=u.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}let r=!!e.options.horizontal,i=t.mode===`transform`,o=r?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let n of c){let a=n.start-s,c=e.elementsCache.get(n.key);c&&t.lastPositions.get(c)!==a&&(t.lastPositions.set(c,a),i?c.style.transform=r?`translate3d(${a}px, 0, 0)`:`translate3d(0, ${a}px, 0)`:c.style[o]=`${a}px`)}},s={...r,onChange:(t,n)=>{var s;let c=a.current,l=!0;if(c.enabled){o(t);let e=t.range,n=c.prevRange;l=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,l&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}l&&(e&&n?(0,d.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[c]=u.useState(()=>{let e=new k(s);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return c.setOptions(s),N(()=>c._didMount(),[]),N(()=>c._willUpdate()),N(()=>{o(c)}),c}function F(e){return P({observeElementRect:S,observeElementOffset:E,scrollToFn:O,...e})}var I=i(),L=e=>(0,I.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,I.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,I.jsx)(`path`,{d:`M3 12a9 9 0 0 1 9-9a9.75 9.75 0 0 1 6.74 2.74L21 8`}),(0,I.jsx)(`path`,{d:`M21 3v5h-5m5 4a9 9 0 0 1-9 9a9.75 9.75 0 0 1-6.74-2.74L3 16`}),(0,I.jsx)(`path`,{d:`M8 16H3v5`})]})}),R=1e3,z=5e3,B=4e3,V={trace:0,debug:1,info:2,warning:3,error:4,fatal:5},H=/autoscale|worker/i,U={trace:`TRC`,debug:`DBG`,info:`INF`,warning:`WRN`,error:`ERR`,fatal:`FTL`},W=new Intl.DateTimeFormat(`en-GB`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1});function G(e){return W.format(new Date(e))}function K(e){return e.join(`·`)}function q({search:e,onSearchChange:n}){let[r,i]=(0,u.useState)([]),a=(0,u.useRef)(void 0),o=(0,u.useRef)(void 0),l=(0,u.useRef)(0),[d,f]=(0,u.useState)(()=>Date.now()),p=t({queryKey:[`Monit`,`monitLogs`],queryFn:()=>s.monitLogs(a.current),refetchInterval:R,retry:!1}),m=t({...s.monitInfoQueryOptions(),staleTime:1/0}).data,h=p.data?.vitals;(0,u.useEffect)(()=>{let e=p.data;e&&g(e)},[p.data]);function g(e){let t=()=>++l.current;i(n=>{let r=n,i=[];o.current!==void 0&&e.processStartedAt!==o.current?(r=[],i.push({kind:`restart`,key:t(),processStartedAt:e.processStartedAt})):e.dropped>0&&i.push({kind:`dropped`,key:t(),count:e.dropped}),o.current=e.processStartedAt,a.current=e.nextCursor;let s=r.findLast(e=>e.kind===`log`)?.entry.seq;for(let n of e.entries)s!==void 0&&n.seq<=s||i.push({kind:`log`,key:t(),entry:n});if(i.length===0)return n;let c=[...r,...i];return c.length>B?c.slice(-B):c})}(0,u.useEffect)(()=>{let e=window.setInterval(()=>f(Date.now()),2e3);return()=>window.clearInterval(e)},[]);let _=r.length>0&&(p.isRefetchError||p.dataUpdatedAt>0&&d-p.dataUpdatedAt>z),v=(0,u.useMemo)(()=>r.filter(t=>{if(t.kind!==`log`)return!0;switch(e.level){case`scaling`:return H.test(t.entry.text);case`warn`:return(V[t.entry.level]??2)>=3;case`error`:return(V[t.entry.level]??2)>=4;default:return!0}}),[r,e.level]),y=(0,u.useRef)(null),b=F({count:v.length,getScrollElement:()=>y.current,estimateSize:()=>20,getItemKey:e=>v[e].key,anchorTo:`end`,followOnAppend:!0,scrollEndThreshold:80,overscan:12}),x=b.isAtEnd(),S=p.dataUpdatedAt>0,C=!S&&p.isError;return(0,I.jsxs)(`section`,{className:`panel overflow-hidden`,children:[(0,I.jsxs)(`header`,{className:`panel-header flex min-h-11 flex-wrap items-center gap-x-3 gap-y-2 px-4 py-2 sm:px-5`,children:[(0,I.jsx)(`h2`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-sand-800`,children:`Server logs`}),(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11px] font-medium text-sand-700`,children:[(0,I.jsx)(`span`,{className:c(`size-1.5 rounded-full`,_||C?`bg-danger-400`:`bg-sienna-500 motion-safe:animate-pulse`)}),C?`Disconnected`:_?`Stale`:S?`Live`:`…`]}),o.current!==void 0&&(0,I.jsxs)(`span`,{className:`text-[11px] text-sand-500`,children:[`ephemeral · resets on restart · since `,G(o.current)]}),(0,I.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:(0,I.jsx)(`div`,{className:`segmented-control inline-flex`,role:`tablist`,"aria-label":`Log filter`,children:[{value:`all`,label:`All`},{value:`scaling`,label:`Scaling`},{value:`warn`,label:`Warn+`},{value:`error`,label:`Err+`}].map(t=>(0,I.jsx)(`button`,{type:`button`,"data-active":e.level===t.value,onClick:()=>n({...e,level:t.value}),className:`rounded-[6px] px-2.5 py-1 text-[11px] font-medium text-sand-500 transition-colors hover:text-sand-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sienna-300 data-[active=true]:text-sand-900`,children:t.label},t.value))})})]}),m&&(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 gap-y-1 border-b border-sand-100 bg-sand-50/60 px-4 py-2 text-[11px] text-sand-600 sm:px-5`,children:[(0,I.jsxs)(`span`,{children:[`server `,(0,I.jsx)(`span`,{className:`font-mono text-sand-800`,children:m.serverUrl})]}),(0,I.jsxs)(`span`,{children:[`db`,` `,(0,I.jsxs)(`span`,{className:`font-mono text-sand-800`,children:[m.dbHost,`/`,m.dbName]})]}),(0,I.jsxs)(`span`,{children:[`workers/token`,` `,(0,I.jsxs)(`span`,{className:`font-mono text-sand-800`,children:[m.openai.minWorkersPerToken,`–`,m.openai.maxWorkersPerToken]}),` `,m.openai.autoscale?`autoscale`:`fixed`]}),h&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`span`,{children:[`openai workers`,` `,(0,I.jsxs)(`span`,{className:`font-mono text-sand-800`,children:[h.openaiReadyWorkerCount,`/`,h.openaiWorkerCount]}),` `,`ready`]}),(0,I.jsxs)(`span`,{children:[`queue`,` `,(0,I.jsx)(`span`,{className:c(`font-mono`,h.openaiQueueLength>0?`font-semibold text-caution-500`:`text-sand-800`),children:h.openaiQueueLength})]})]})]}),h&&(h.openaiWorkersByToken.length>0||h.anthropicTokenNames.length>0)&&(0,I.jsxs)(`div`,{className:`space-y-1.5 border-b border-sand-100 px-4 py-2.5 sm:px-5`,children:[h.openaiWorkersByToken.length>0&&(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`w-[4.5rem] shrink-0 text-[10px] font-medium uppercase tracking-[0.08em] text-sand-400`,children:`openai`}),h.openaiWorkersByToken.map(e=>(0,I.jsxs)(`span`,{title:`${e.name}: ${e.count} workers`,className:`inline-flex items-baseline gap-1.5 rounded-md border border-sand-200 bg-white px-2 py-1`,children:[(0,I.jsx)(`span`,{className:`font-mono text-[11px] text-sand-600`,children:e.name.split(`/`).pop()}),(0,I.jsx)(`span`,{className:`font-mono text-[13px] font-semibold tracking-[-0.02em] text-sand-900`,children:e.count})]},e.name))]}),h.anthropicTokenNames.length>0&&(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,I.jsx)(`span`,{className:`w-[4.5rem] shrink-0 text-[10px] font-medium uppercase tracking-[0.08em] text-sand-400`,children:`anthropic`}),h.anthropicTokenNames.map(e=>(0,I.jsx)(`span`,{title:e,className:`inline-flex items-baseline rounded-md border border-sand-200 bg-white px-2 py-1 font-mono text-[11px] text-sand-600`,children:e.split(`/`).pop()},e))]})]}),(0,I.jsxs)(`div`,{className:`relative`,children:[(0,I.jsx)(`div`,{ref:y,role:`log`,"aria-label":`Server process logs`,tabIndex:0,className:`main-scroll h-[calc(100vh-232px)] min-h-[320px] overflow-y-auto bg-sand-900 px-4 py-3 font-mono text-[12px] leading-[1.6] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sienna-400`,children:C?(0,I.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-sand-400`,children:[(0,I.jsxs)(`p`,{className:`text-[12px]`,children:[`Could not reach the qgrid server — is it running?`,p.error instanceof Error&&(0,I.jsx)(`span`,{className:`block text-center text-[11px] text-sand-500`,children:p.error.message})]}),(0,I.jsxs)(`button`,{type:`button`,onClick:()=>void p.refetch(),className:`inline-flex items-center gap-1.5 rounded-md border border-sand-600 px-2.5 py-1.5 text-[11px] font-medium text-sand-300 transition-colors hover:bg-sand-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sienna-400`,children:[(0,I.jsx)(L,{className:`size-3`}),`Retry now`]})]}):S?v.length===0?(0,I.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-sand-500`,children:r.length===0?`No log lines yet — waiting for activity since ${o.current===void 0?`startup`:G(o.current)}.`:`No lines match the current filters.`}):(0,I.jsx)(`div`,{className:`relative w-full`,style:{height:`${b.getTotalSize()}px`},children:b.getVirtualItems().map(e=>{let t=v[e.index];return(0,I.jsx)(`div`,{ref:b.measureElement,"data-index":e.index,className:`absolute left-0 top-0 w-full`,style:{transform:`translateY(${e.start}px)`},children:(0,I.jsx)(J,{item:t})},e.key)})}):(0,I.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-sand-500`,children:`Connecting to server logs…`})}),S&&!C&&!x&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>b.scrollToEnd(),className:`absolute bottom-4 right-5 inline-flex items-center gap-1.5 rounded-full border border-sand-600 bg-sand-800/90 px-3 py-1.5 text-[11px] font-medium text-sand-200 shadow-lg backdrop-blur transition-colors hover:bg-sand-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sienna-400`,children:`↓ Jump to live`})]})]})}function J({item:e}){if(e.kind===`restart`)return(0,I.jsxs)(`div`,{className:`py-1 text-center text-[11px] text-caution-400`,children:[`── process restarted · `,G(e.processStartedAt),` ──`]});if(e.kind===`dropped`)return(0,I.jsxs)(`div`,{className:`py-1 text-center text-[11px] italic text-sand-500`,children:[`── `,e.count,` lines dropped (buffer overflow) ──`]});let{entry:t}=e;return(0,I.jsxs)(`div`,{className:`whitespace-pre-wrap break-words text-sand-200`,children:[(0,I.jsx)(`span`,{className:`text-sand-500`,children:G(t.timestamp)}),` `,(0,I.jsx)(`span`,{className:c(`font-semibold`,t.level===`fatal`||t.level===`error`?`text-danger-400`:t.level===`warning`?`text-caution-400`:`text-sand-400`),children:U[t.level]??t.level.slice(0,3).toUpperCase()}),` `,(0,I.jsx)(`span`,{className:`text-sienna-300`,children:K(t.category)}),` `,(0,I.jsx)(`span`,{children:t.text})]})}o({level:a([`all`,`scaling`,`warn`,`error`]).optional().default(`all`)});function Y(){let e=l.useSearch(),t=l.useNavigate();return(0,I.jsx)(`div`,{className:`max-w-[100rem] mx-auto`,children:(0,I.jsx)(q,{search:e,onSearchChange:e=>t({search:e,replace:!0})})})}export{Y as component};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{y as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,n as r,r as i}from"./vendor-react-DH4kUfK2.js";import{n as a,o}from"./services.generated-jGypfumC.js";import{i as s}from"./index-C24D5PiN.js";import{r as c}from"./cost-CpjVoAqp.js";import{n as l,r as u,t as d}from"./use-oauth-login-flow-CY-ASCfL.js";var f=e(r()),p=e(n());function m(){var e=[...arguments];return(0,p.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var h=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function g(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function _(e){return`nodeType`in e}function v(e){return e?g(e)?e:_(e)?e.ownerDocument?.defaultView??window:window:window}function y(e){let{Document:t}=v(e);return e instanceof t}function b(e){return g(e)?!1:e instanceof v(e).HTMLElement}function x(e){return e instanceof v(e).SVGElement}function S(e){return e?g(e)?e.document:_(e)?y(e)?e:b(e)||x(e)?e.ownerDocument:document:document:document}var C=h?p.useLayoutEffect:p.useEffect;function w(e){let t=(0,p.useRef)(e);return C(()=>{t.current=e}),(0,p.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function T(){let e=(0,p.useRef)(null);return[(0,p.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,p.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function E(e,t){let n=(0,p.useRef)();return(0,p.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function ee(e){let t=w(e),n=(0,p.useRef)(null);return[n,(0,p.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}var D={};function O(e,t){return(0,p.useMemo)(()=>{if(t)return t;let n=D[e]==null?0:D[e]+1;return D[e]=n,e+`-`+n},[e,t])}function k(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var A=k(1),te=k(-1);function j(e){return`clientX`in e&&`clientY`in e}function M(e){if(!e)return!1;let{KeyboardEvent:t}=v(e.target);return t&&e instanceof t}function ne(e){if(!e)return!1;let{TouchEvent:t}=v(e.target);return t&&e instanceof t}function re(e){if(ne(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return j(e)?{x:e.clientX,y:e.clientY}:null}var N=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[N.Translate.toString(e),N.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),ie={display:`none`};function P(e){let{id:t,value:n}=e;return p.createElement(`div`,{id:t,style:ie},n)}function F(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return p.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function ae(){let[e,t]=(0,p.useState)(``);return{announce:(0,p.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var oe={draggable:`
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{y as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,n as r,r as i}from"./vendor-react-DH4kUfK2.js";import{n as a,o}from"./services.generated-jGypfumC.js";import{i as s}from"./index-C0594sjh.js";import{r as c}from"./cost-CpjVoAqp.js";import{n as l,r as u,t as d}from"./use-oauth-login-flow-CptleCFM.js";var f=e(r()),p=e(n());function m(){var e=[...arguments];return(0,p.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var h=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function g(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function _(e){return`nodeType`in e}function v(e){return e?g(e)?e:_(e)?e.ownerDocument?.defaultView??window:window:window}function y(e){let{Document:t}=v(e);return e instanceof t}function b(e){return g(e)?!1:e instanceof v(e).HTMLElement}function x(e){return e instanceof v(e).SVGElement}function S(e){return e?g(e)?e.document:_(e)?y(e)?e:b(e)||x(e)?e.ownerDocument:document:document:document}var C=h?p.useLayoutEffect:p.useEffect;function w(e){let t=(0,p.useRef)(e);return C(()=>{t.current=e}),(0,p.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function T(){let e=(0,p.useRef)(null);return[(0,p.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,p.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function E(e,t){let n=(0,p.useRef)();return(0,p.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function ee(e){let t=w(e),n=(0,p.useRef)(null);return[n,(0,p.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}var D={};function O(e,t){return(0,p.useMemo)(()=>{if(t)return t;let n=D[e]==null?0:D[e]+1;return D[e]=n,e+`-`+n},[e,t])}function k(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var A=k(1),te=k(-1);function j(e){return`clientX`in e&&`clientY`in e}function M(e){if(!e)return!1;let{KeyboardEvent:t}=v(e.target);return t&&e instanceof t}function ne(e){if(!e)return!1;let{TouchEvent:t}=v(e.target);return t&&e instanceof t}function re(e){if(ne(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return j(e)?{x:e.clientX,y:e.clientY}:null}var N=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[N.Translate.toString(e),N.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),ie={display:`none`};function P(e){let{id:t,value:n}=e;return p.createElement(`div`,{id:t,style:ie},n)}function F(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return p.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function ae(){let[e,t]=(0,p.useState)(``);return{announce:(0,p.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var oe={draggable:`
2
2
  To pick up a draggable item, press the space bar.
3
3
  While dragging, use the arrow keys to move the item.
4
4
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{_ as t,y as n}from"./vendor-tanstack-DJRQAbrY.js";import{i as r,r as i}from"./vendor-react-DH4kUfK2.js";import{a,c as o,g as s,n as c}from"./services.generated-jGypfumC.js";import{s as l}from"./index-C24D5PiN.js";import{t as u}from"./plus-DqBd6gHk.js";var d=e(r()),f=i(),p=e=>(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,f.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,f.jsx)(`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0`}),(0,f.jsx)(`circle`,{cx:12,cy:12,r:3})]})}),m=e=>(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,f.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,f.jsx)(`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575a1 1 0 0 1 0 .696a10.8 10.8 0 0 1-1.444 2.49m-6.41-.679a3 3 0 0 1-4.242-4.242`}),(0,f.jsx)(`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 4.446-5.143M2 2l20 20`})]})}),h=e=>(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,f.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 12h14`})}),g={openai:`OpenAI 워커`,slack:`Slack 알림`,slackConnection:`Slack 연결`},_=180*1e3;function v(e){return e?e.length<=12?`•`.repeat(e.length):`${e.slice(0,8)}${`•`.repeat(12)}${e.slice(-4)}`:``}function y({value:e,min:t,max:n,step:r,disabled:i,onChange:a}){let o=Number(e),s=Number.isFinite(o),c=t??-1/0,l=n??1/0,d=e=>{let n=Math.min(Math.max((s?o:t??0)+e,c),l);a(String(Number(n.toFixed(2))))};return(0,f.jsxs)(`div`,{className:`inline-flex items-center rounded-lg border border-sand-200/80 bg-white overflow-hidden`,children:[(0,f.jsx)(`button`,{type:`button`,"aria-label":`감소`,onClick:()=>d(-r),disabled:i||s&&o<=c,className:`size-7 grid place-items-center text-sand-500 hover:bg-sand-100 disabled:opacity-30 disabled:hover:bg-transparent transition-colors duration-150`,children:(0,f.jsx)(h,{className:`size-3`})}),(0,f.jsx)(`input`,{value:e,onChange:e=>a(e.target.value),disabled:i,inputMode:`decimal`,className:`w-12 text-center text-[12px] tabular-nums text-sand-800 bg-transparent border-x border-sand-200/80 py-1 focus:outline-none focus:bg-sand-50`}),(0,f.jsx)(`button`,{type:`button`,"aria-label":`증가`,onClick:()=>d(r),disabled:i||s&&o>=l,className:`size-7 grid place-items-center text-sand-500 hover:bg-sand-100 disabled:opacity-30 disabled:hover:bg-transparent transition-colors duration-150`,children:(0,f.jsx)(u,{className:`size-3`})})]})}function b({value:e,presets:t,disabled:n,onChange:r}){let i=Number(e);return(0,f.jsx)(`div`,{className:`segmented-control inline-flex`,children:t.map(e=>(0,f.jsx)(`button`,{type:`button`,disabled:n,"data-active":i===e,onClick:()=>r(String(e)),className:`rounded-[6px] px-2.5 py-1 text-[11px] font-medium tabular-nums text-sand-500 transition-colors hover:text-sand-800 disabled:opacity-50 data-[active=true]:text-sand-900`,children:e>=60?`${e/60}시간`:`${e}분`},e))})}function x({source:e}){return(0,f.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded ${e===`db`?`bg-sienna-50 text-sienna-600`:`bg-sand-100 text-sand-500`}`,children:e===`db`?`저장값`:e===`env`?`환경변수`:`기본값`})}function S({on:e,disabled:t,onChange:n}){return(0,f.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,disabled:t,onClick:()=>n(!e),className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors duration-200 disabled:opacity-50 ${e?`bg-sage-400`:`bg-sand-300`}`,children:(0,f.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform duration-200 ${e?`translate-x-4.5`:`translate-x-0.5`}`})})}function C({item:e}){let[t,r]=(0,d.useState)(null),[i,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(null),u=n(),h=a.useUpdateSettingMutation(),g=a.useResetSettingMutation(),_=h.isPending||g.isPending,C=t??e.value,w=t!==null&&t!==e.value,T=()=>u.invalidateQueries({queryKey:a.getSettingListQueryOptions().queryKey}),E=async t=>{c(null);try{await h.mutateAsync({key:e.key,value:t}),await T(),r(null)}catch(e){c(e.message)}},D=async()=>{c(null);try{await g.mutateAsync({key:e.key}),await T(),r(null)}catch(e){c(e.message)}},O=e.kind===`secret`;return(0,f.jsxs)(`div`,{className:`px-4 py-3 sm:px-5`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,f.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`text-[13px] text-sand-800`,children:e.label}),(0,f.jsx)(x,{source:e.source}),e.applies===`restart`&&(0,f.jsx)(`span`,{className:`text-[10px] text-caution-500`,title:`저장해도 다음 재시작부터 반영됩니다`,children:`재시작 필요`})]}),e.help&&(0,f.jsx)(`p`,{className:`mt-0.5 text-[11px] text-sand-500`,children:e.help})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[e.kind===`boolean`&&(0,f.jsx)(S,{on:C===`true`,disabled:_,onChange:e=>void E(String(e))}),e.kind===`preset`&&(0,f.jsx)(b,{value:C,presets:e.presets,disabled:_,onChange:e=>void E(e)}),(e.kind===`integer`||e.kind===`number`)&&(0,f.jsx)(y,{value:C,min:e.min,max:e.max,step:e.kind===`integer`?1:.5,disabled:_,onChange:r}),(e.kind===`string`||O)&&(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(`input`,{value:O&&!i?v(C):C,onChange:e=>r(e.target.value),onFocus:()=>O&&o(!0),disabled:_,className:`w-48 sm:w-64 rounded-lg border border-sand-200/80 bg-white py-1.5 pl-2.5 text-[12px] text-sand-800 focus:outline-none focus:border-sienna-300 ${O?`pr-8 font-mono`:`pr-2.5`}`}),O&&(0,f.jsx)(`button`,{type:`button`,"aria-label":i?`값 숨기기`:`값 보기`,onClick:()=>o(e=>!e),className:`absolute right-1.5 top-1/2 -translate-y-1/2 size-6 grid place-items-center text-sand-400 hover:text-sand-600 transition-colors duration-150`,children:i?(0,f.jsx)(m,{className:`size-3.5`}):(0,f.jsx)(p,{className:`size-3.5`})})]}),w&&(0,f.jsx)(`button`,{type:`button`,onClick:()=>void E(C),disabled:_,className:`px-2.5 py-1.5 text-[11px] font-medium rounded-lg bg-sienna-400 text-white hover:bg-sienna-500 disabled:opacity-50 transition-colors duration-150`,children:h.isPending?`저장 중`:`저장`}),!w&&e.source===`db`&&(0,f.jsx)(`button`,{type:`button`,title:`저장값을 지웁니다 — 환경변수 또는 기본값으로 돌아갑니다`,onClick:()=>void D(),disabled:_,className:`size-7 grid place-items-center rounded-lg text-sand-400 hover:text-sand-600 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150`,children:(0,f.jsx)(l,{className:`size-3.5`})})]})]}),s&&(0,f.jsx)(`p`,{className:`mt-1.5 text-[11px] text-red-500`,children:s})]})}function w(){let[e,t]=(0,d.useState)(null),n=a.useTriggerExpiryReminderMutation(),r=async()=>{t(null);try{let{sent:e}=await n.mutateAsync();t(e===0?`재로그인이 필요한 토큰이 없습니다`:`${e}건 발송`)}catch(e){t(e.message)}};return(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e&&(0,f.jsx)(`span`,{className:`text-[11px] text-sand-500`,children:e}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>void r(),disabled:n.isPending,className:`px-2 py-1 text-[11px] rounded-lg border border-sand-200/80 text-sand-600 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150`,children:n.isPending?`보내는 중`:`지금 보내기`})]})}function T({supervisor:e}){let[r,i]=(0,d.useState)(!1),[l,u]=(0,d.useState)(!1),[p,m]=(0,d.useState)(null),[h,g]=(0,d.useState)(!1),[v,y]=(0,d.useState)(!1),[b,x]=(0,d.useState)(null),S=(0,d.useRef)(!1),C=(0,d.useRef)(0),w=n(),T=a.useRestartServerMutation(),E=T.reset,D=t({...c.healthQueryOptions(),enabled:l&&!v,refetchInterval:l&&!v?1e3:!1,refetchIntervalInBackground:!0,retry:!1});(0,d.useEffect)(()=>{if(!l||p===null||v)return;let e=Math.max(0,_-(Date.now()-p)),t=window.setTimeout(()=>{C.current+=1,E(),i(!1),u(!1),m(null),g(!1),x(`재시작 후 3분 안에 서버 준비를 확인하지 못했습니다. 상태를 확인한 뒤 다시 시도하세요.`)},e);return()=>window.clearTimeout(t)},[v,E,l,p]),(0,d.useEffect)(()=>{if(!l||p===null)return;let e=D.isError&&D.errorUpdatedAt>=p,t=D.isSuccess&&D.dataUpdatedAt>=p;if(e||t&&!D.data.ready){g(!0);return}!h||!t||!D.data.ready||S.current||(S.current=!0,y(!0),w.invalidateQueries({queryKey:a.getSettingListQueryOptions().queryKey}).then(()=>{C.current+=1,E(),i(!1),u(!1),m(null),g(!1)}).catch(e=>{C.current+=1,E(),i(!1),u(!1),m(null),g(!1),x(`서버는 준비됐지만 설정을 새로고침하지 못했습니다: ${e.message}`)}).finally(()=>{S.current=!1,y(!1)}))},[D.dataUpdatedAt,D.data?.ready,D.errorUpdatedAt,D.isError,D.isSuccess,w,E,p,l,h]);let O=async()=>{let e=C.current+1;C.current=e,x(null),g(!1),y(!1),S.current=!1,u(!0),m(Date.now());try{await T.mutateAsync()}catch(t){if(C.current!==e)return;(o(t)?t.code>=400&&t.code<500:s(t)&&t.response!==void 0&&t.response.status>=400&&t.response.status<500)&&(C.current+=1,E(),i(!1),u(!1),m(null),x(t.message||`재시작 요청이 거부되었습니다.`))}},k=()=>{l||(i(!1),x(null))};return(0,f.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,f.jsx)(`div`,{className:`panel-header px-4 py-2.5 sm:px-5`,children:(0,f.jsx)(`span`,{className:`text-[13px] font-medium text-sand-700`,children:`서버 제어`})}),(0,f.jsxs)(`div`,{className:`px-4 py-3 sm:px-5 flex items-start justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-[13px] text-sand-800`,children:`qgrid 재시작`}),(0,f.jsx)(`p`,{className:`mt-0.5 text-[11px] text-sand-500`,children:e?`재시작 필요 설정을 반영하고 qgrid·Codex·Claude CLI를 확인합니다`:`로컬 실행 환경에서는 재시작할 수 없습니다`})]}),(0,f.jsx)(`button`,{type:`button`,disabled:!e||l||T.isPending,onClick:()=>i(!0),className:`shrink-0 px-2.5 py-1.5 text-[11px] font-medium rounded-lg border border-red-200 text-red-600 hover:bg-red-50 disabled:opacity-40 disabled:hover:bg-transparent transition-colors duration-150`,children:`재시작`})]}),b&&(0,f.jsx)(`p`,{className:`px-4 pb-3 sm:px-5 text-[11px] text-red-500`,children:b}),r&&(0,f.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:k,onKeyDown:()=>{}}),(0,f.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-sm mx-4`,children:[(0,f.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/60`,children:(0,f.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:l?T.isPending?`재시작 요청 중`:`서버 재연결 중`:`qgrid 재시작`})}),(0,f.jsxs)(`div`,{className:`px-5 py-4 space-y-2`,children:[(0,f.jsxs)(`p`,{className:`text-[13px] text-sand-700`,children:[`워커가 다시 뜰 때까지 `,(0,f.jsx)(`strong`,{className:`text-sand-900`,children:`1~2분간 요청이 실패`}),`합니다.`]}),(0,f.jsx)(`p`,{className:`text-[12px] text-sand-500`,children:`서버를 종료하면 모니터링 도구가 다시 띄웁니다. 이때 재시작 필요 설정을 반영하고, qgrid와 Codex CLI·Claude Code의 최신 버전을 확인합니다.`}),l&&(0,f.jsx)(`p`,{className:`text-[12px] font-medium text-sienna-600`,children:T.isPending?`종료 요청을 처리하고 있습니다…`:h?`새 서버가 준비될 때까지 연결을 확인하고 있습니다…`:`서버 종료를 기다리고 있습니다…`})]}),(0,f.jsxs)(`div`,{className:`px-5 py-3 border-t border-sand-100/60 flex justify-end gap-2`,children:[!l&&(0,f.jsx)(`button`,{type:`button`,onClick:k,className:`px-3 py-1.5 text-[12px] rounded-lg text-sand-600 hover:bg-sand-100 transition-colors duration-150`,children:`취소`}),(0,f.jsx)(`button`,{type:`button`,disabled:l||T.isPending,onClick:()=>void O(),className:`px-3 py-1.5 text-[12px] font-medium rounded-lg bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 transition-colors duration-150`,children:l?T.isPending?`요청 중`:`재연결 중`:`재시작`})]})]})]})]})}function E(){let e=a.useSettingList(),{data:t,isLoading:n}=e;if(n)return(0,f.jsx)(`div`,{className:`space-y-4`,children:[0,1].map(e=>(0,f.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,f.jsx)(`div`,{className:`panel-header px-4 py-2.5 sm:px-5`,children:(0,f.jsx)(`div`,{className:`h-3 w-24 rounded bg-sand-200 animate-pulse`})}),(0,f.jsx)(`div`,{className:`divide-y divide-sand-100/80`,children:[0,1,2].map(e=>(0,f.jsxs)(`div`,{className:`px-4 py-3 sm:px-5 flex items-center justify-between gap-4`,children:[(0,f.jsx)(`div`,{className:`h-3 w-40 rounded bg-sand-100 animate-pulse`}),(0,f.jsx)(`div`,{className:`h-7 w-24 rounded-lg bg-sand-100 animate-pulse`})]},e))})]},e))});if(e.isError&&!t)return(0,f.jsxs)(`div`,{className:`panel px-5 py-6 text-center`,children:[(0,f.jsx)(`p`,{className:`text-[13px] font-medium text-sand-800`,children:`설정을 불러오지 못했습니다`}),(0,f.jsx)(`p`,{className:`mt-1 text-[11px] text-red-500`,children:e.error.message}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>void e.refetch(),disabled:e.isFetching,className:`mt-3 px-3 py-1.5 text-[12px] rounded-lg border border-sand-200 text-sand-600 hover:bg-sand-100 disabled:opacity-50`,children:e.isFetching?`다시 불러오는 중`:`다시 시도`})]});let r=t?.settings??[],i=t?.runtime??[],o=[...new Set(r.map(e=>e.group))];return(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`panel-header flex items-center justify-between px-4 py-2.5 sm:px-5`,children:[(0,f.jsx)(`span`,{className:`text-[13px] font-medium text-sand-700`,children:`환경`}),(0,f.jsx)(`span`,{className:`text-[11px] text-sand-400`,children:`기동 시점 값`})]}),(0,f.jsx)(`dl`,{className:`px-4 py-3 sm:px-5 grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-1.5`,children:i.map(e=>(0,f.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 min-w-0`,children:[(0,f.jsx)(`dt`,{className:`text-[11px] text-sand-500 shrink-0`,children:e.label}),(0,f.jsx)(`dd`,{className:`text-[12px] font-mono text-sand-700 truncate`,children:e.value})]},e.label))})]}),o.map(e=>{let t=r.filter(t=>t.group===e);return(0,f.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`panel-header flex items-center justify-between px-4 py-2.5 sm:px-5`,children:[(0,f.jsx)(`span`,{className:`text-[13px] font-medium text-sand-700`,children:g[e]??e}),e===`slack`&&(0,f.jsx)(w,{})]}),(0,f.jsx)(`div`,{className:`divide-y divide-sand-100/80`,children:t.map(e=>(0,f.jsx)(C,{item:e},e.key))})]},e)}),(0,f.jsx)(T,{supervisor:t?.supervisor??null})]})}function D(){return(0,f.jsx)(`div`,{className:`max-w-4xl mx-auto`,children:(0,f.jsx)(E,{})})}export{D as component};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{_ as t,y as n}from"./vendor-tanstack-DJRQAbrY.js";import{i as r,r as i}from"./vendor-react-DH4kUfK2.js";import{a,c as o,g as s,n as c}from"./services.generated-jGypfumC.js";import{s as l}from"./index-C0594sjh.js";import{t as u}from"./plus-DqBd6gHk.js";var d=e(r()),f=i(),p=e=>(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,f.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,f.jsx)(`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0`}),(0,f.jsx)(`circle`,{cx:12,cy:12,r:3})]})}),m=e=>(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,f.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,f.jsx)(`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575a1 1 0 0 1 0 .696a10.8 10.8 0 0 1-1.444 2.49m-6.41-.679a3 3 0 0 1-4.242-4.242`}),(0,f.jsx)(`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 4.446-5.143M2 2l20 20`})]})}),h=e=>(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,f.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 12h14`})}),g={openai:`OpenAI 워커`,slack:`Slack 알림`,slackConnection:`Slack 연결`},_=180*1e3;function v(e){return e?e.length<=12?`•`.repeat(e.length):`${e.slice(0,8)}${`•`.repeat(12)}${e.slice(-4)}`:``}function y({value:e,min:t,max:n,step:r,disabled:i,onChange:a}){let o=Number(e),s=Number.isFinite(o),c=t??-1/0,l=n??1/0,d=e=>{let n=Math.min(Math.max((s?o:t??0)+e,c),l);a(String(Number(n.toFixed(2))))};return(0,f.jsxs)(`div`,{className:`inline-flex items-center rounded-lg border border-sand-200/80 bg-white overflow-hidden`,children:[(0,f.jsx)(`button`,{type:`button`,"aria-label":`감소`,onClick:()=>d(-r),disabled:i||s&&o<=c,className:`size-7 grid place-items-center text-sand-500 hover:bg-sand-100 disabled:opacity-30 disabled:hover:bg-transparent transition-colors duration-150`,children:(0,f.jsx)(h,{className:`size-3`})}),(0,f.jsx)(`input`,{value:e,onChange:e=>a(e.target.value),disabled:i,inputMode:`decimal`,className:`w-12 text-center text-[12px] tabular-nums text-sand-800 bg-transparent border-x border-sand-200/80 py-1 focus:outline-none focus:bg-sand-50`}),(0,f.jsx)(`button`,{type:`button`,"aria-label":`증가`,onClick:()=>d(r),disabled:i||s&&o>=l,className:`size-7 grid place-items-center text-sand-500 hover:bg-sand-100 disabled:opacity-30 disabled:hover:bg-transparent transition-colors duration-150`,children:(0,f.jsx)(u,{className:`size-3`})})]})}function b({value:e,presets:t,disabled:n,onChange:r}){let i=Number(e);return(0,f.jsx)(`div`,{className:`segmented-control inline-flex`,children:t.map(e=>(0,f.jsx)(`button`,{type:`button`,disabled:n,"data-active":i===e,onClick:()=>r(String(e)),className:`rounded-[6px] px-2.5 py-1 text-[11px] font-medium tabular-nums text-sand-500 transition-colors hover:text-sand-800 disabled:opacity-50 data-[active=true]:text-sand-900`,children:e>=60?`${e/60}시간`:`${e}분`},e))})}function x({source:e}){return(0,f.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded ${e===`db`?`bg-sienna-50 text-sienna-600`:`bg-sand-100 text-sand-500`}`,children:e===`db`?`저장값`:e===`env`?`환경변수`:`기본값`})}function S({on:e,disabled:t,onChange:n}){return(0,f.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,disabled:t,onClick:()=>n(!e),className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors duration-200 disabled:opacity-50 ${e?`bg-sage-400`:`bg-sand-300`}`,children:(0,f.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform duration-200 ${e?`translate-x-4.5`:`translate-x-0.5`}`})})}function C({item:e}){let[t,r]=(0,d.useState)(null),[i,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(null),u=n(),h=a.useUpdateSettingMutation(),g=a.useResetSettingMutation(),_=h.isPending||g.isPending,C=t??e.value,w=t!==null&&t!==e.value,T=()=>u.invalidateQueries({queryKey:a.getSettingListQueryOptions().queryKey}),E=async t=>{c(null);try{await h.mutateAsync({key:e.key,value:t}),await T(),r(null)}catch(e){c(e.message)}},D=async()=>{c(null);try{await g.mutateAsync({key:e.key}),await T(),r(null)}catch(e){c(e.message)}},O=e.kind===`secret`;return(0,f.jsxs)(`div`,{className:`px-4 py-3 sm:px-5`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,f.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`text-[13px] text-sand-800`,children:e.label}),(0,f.jsx)(x,{source:e.source}),e.applies===`restart`&&(0,f.jsx)(`span`,{className:`text-[10px] text-caution-500`,title:`저장해도 다음 재시작부터 반영됩니다`,children:`재시작 필요`})]}),e.help&&(0,f.jsx)(`p`,{className:`mt-0.5 text-[11px] text-sand-500`,children:e.help})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[e.kind===`boolean`&&(0,f.jsx)(S,{on:C===`true`,disabled:_,onChange:e=>void E(String(e))}),e.kind===`preset`&&(0,f.jsx)(b,{value:C,presets:e.presets,disabled:_,onChange:e=>void E(e)}),(e.kind===`integer`||e.kind===`number`)&&(0,f.jsx)(y,{value:C,min:e.min,max:e.max,step:e.kind===`integer`?1:.5,disabled:_,onChange:r}),(e.kind===`string`||O)&&(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(`input`,{value:O&&!i?v(C):C,onChange:e=>r(e.target.value),onFocus:()=>O&&o(!0),disabled:_,className:`w-48 sm:w-64 rounded-lg border border-sand-200/80 bg-white py-1.5 pl-2.5 text-[12px] text-sand-800 focus:outline-none focus:border-sienna-300 ${O?`pr-8 font-mono`:`pr-2.5`}`}),O&&(0,f.jsx)(`button`,{type:`button`,"aria-label":i?`값 숨기기`:`값 보기`,onClick:()=>o(e=>!e),className:`absolute right-1.5 top-1/2 -translate-y-1/2 size-6 grid place-items-center text-sand-400 hover:text-sand-600 transition-colors duration-150`,children:i?(0,f.jsx)(m,{className:`size-3.5`}):(0,f.jsx)(p,{className:`size-3.5`})})]}),w&&(0,f.jsx)(`button`,{type:`button`,onClick:()=>void E(C),disabled:_,className:`px-2.5 py-1.5 text-[11px] font-medium rounded-lg bg-sienna-400 text-white hover:bg-sienna-500 disabled:opacity-50 transition-colors duration-150`,children:h.isPending?`저장 중`:`저장`}),!w&&e.source===`db`&&(0,f.jsx)(`button`,{type:`button`,title:`저장값을 지웁니다 — 환경변수 또는 기본값으로 돌아갑니다`,onClick:()=>void D(),disabled:_,className:`size-7 grid place-items-center rounded-lg text-sand-400 hover:text-sand-600 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150`,children:(0,f.jsx)(l,{className:`size-3.5`})})]})]}),s&&(0,f.jsx)(`p`,{className:`mt-1.5 text-[11px] text-red-500`,children:s})]})}function w(){let[e,t]=(0,d.useState)(null),n=a.useTriggerExpiryReminderMutation(),r=async()=>{t(null);try{let{sent:e}=await n.mutateAsync();t(e===0?`재로그인이 필요한 토큰이 없습니다`:`${e}건 발송`)}catch(e){t(e.message)}};return(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e&&(0,f.jsx)(`span`,{className:`text-[11px] text-sand-500`,children:e}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>void r(),disabled:n.isPending,className:`px-2 py-1 text-[11px] rounded-lg border border-sand-200/80 text-sand-600 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150`,children:n.isPending?`보내는 중`:`지금 보내기`})]})}function T({supervisor:e}){let[r,i]=(0,d.useState)(!1),[l,u]=(0,d.useState)(!1),[p,m]=(0,d.useState)(null),[h,g]=(0,d.useState)(!1),[v,y]=(0,d.useState)(!1),[b,x]=(0,d.useState)(null),S=(0,d.useRef)(!1),C=(0,d.useRef)(0),w=n(),T=a.useRestartServerMutation(),E=T.reset,D=t({...c.healthQueryOptions(),enabled:l&&!v,refetchInterval:l&&!v?1e3:!1,refetchIntervalInBackground:!0,retry:!1});(0,d.useEffect)(()=>{if(!l||p===null||v)return;let e=Math.max(0,_-(Date.now()-p)),t=window.setTimeout(()=>{C.current+=1,E(),i(!1),u(!1),m(null),g(!1),x(`재시작 후 3분 안에 서버 준비를 확인하지 못했습니다. 상태를 확인한 뒤 다시 시도하세요.`)},e);return()=>window.clearTimeout(t)},[v,E,l,p]),(0,d.useEffect)(()=>{if(!l||p===null)return;let e=D.isError&&D.errorUpdatedAt>=p,t=D.isSuccess&&D.dataUpdatedAt>=p;if(e||t&&!D.data.ready){g(!0);return}!h||!t||!D.data.ready||S.current||(S.current=!0,y(!0),w.invalidateQueries({queryKey:a.getSettingListQueryOptions().queryKey}).then(()=>{C.current+=1,E(),i(!1),u(!1),m(null),g(!1)}).catch(e=>{C.current+=1,E(),i(!1),u(!1),m(null),g(!1),x(`서버는 준비됐지만 설정을 새로고침하지 못했습니다: ${e.message}`)}).finally(()=>{S.current=!1,y(!1)}))},[D.dataUpdatedAt,D.data?.ready,D.errorUpdatedAt,D.isError,D.isSuccess,w,E,p,l,h]);let O=async()=>{let e=C.current+1;C.current=e,x(null),g(!1),y(!1),S.current=!1,u(!0),m(Date.now());try{await T.mutateAsync()}catch(t){if(C.current!==e)return;(o(t)?t.code>=400&&t.code<500:s(t)&&t.response!==void 0&&t.response.status>=400&&t.response.status<500)&&(C.current+=1,E(),i(!1),u(!1),m(null),x(t.message||`재시작 요청이 거부되었습니다.`))}},k=()=>{l||(i(!1),x(null))};return(0,f.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,f.jsx)(`div`,{className:`panel-header px-4 py-2.5 sm:px-5`,children:(0,f.jsx)(`span`,{className:`text-[13px] font-medium text-sand-700`,children:`서버 제어`})}),(0,f.jsxs)(`div`,{className:`px-4 py-3 sm:px-5 flex items-start justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-[13px] text-sand-800`,children:`qgrid 재시작`}),(0,f.jsx)(`p`,{className:`mt-0.5 text-[11px] text-sand-500`,children:e?`재시작 필요 설정을 반영하고 qgrid·Codex·Claude CLI를 확인합니다`:`로컬 실행 환경에서는 재시작할 수 없습니다`})]}),(0,f.jsx)(`button`,{type:`button`,disabled:!e||l||T.isPending,onClick:()=>i(!0),className:`shrink-0 px-2.5 py-1.5 text-[11px] font-medium rounded-lg border border-red-200 text-red-600 hover:bg-red-50 disabled:opacity-40 disabled:hover:bg-transparent transition-colors duration-150`,children:`재시작`})]}),b&&(0,f.jsx)(`p`,{className:`px-4 pb-3 sm:px-5 text-[11px] text-red-500`,children:b}),r&&(0,f.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:k,onKeyDown:()=>{}}),(0,f.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-sm mx-4`,children:[(0,f.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/60`,children:(0,f.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:l?T.isPending?`재시작 요청 중`:`서버 재연결 중`:`qgrid 재시작`})}),(0,f.jsxs)(`div`,{className:`px-5 py-4 space-y-2`,children:[(0,f.jsxs)(`p`,{className:`text-[13px] text-sand-700`,children:[`워커가 다시 뜰 때까지 `,(0,f.jsx)(`strong`,{className:`text-sand-900`,children:`1~2분간 요청이 실패`}),`합니다.`]}),(0,f.jsx)(`p`,{className:`text-[12px] text-sand-500`,children:`서버를 종료하면 모니터링 도구가 다시 띄웁니다. 이때 재시작 필요 설정을 반영하고, qgrid와 Codex CLI·Claude Code의 최신 버전을 확인합니다.`}),l&&(0,f.jsx)(`p`,{className:`text-[12px] font-medium text-sienna-600`,children:T.isPending?`종료 요청을 처리하고 있습니다…`:h?`새 서버가 준비될 때까지 연결을 확인하고 있습니다…`:`서버 종료를 기다리고 있습니다…`})]}),(0,f.jsxs)(`div`,{className:`px-5 py-3 border-t border-sand-100/60 flex justify-end gap-2`,children:[!l&&(0,f.jsx)(`button`,{type:`button`,onClick:k,className:`px-3 py-1.5 text-[12px] rounded-lg text-sand-600 hover:bg-sand-100 transition-colors duration-150`,children:`취소`}),(0,f.jsx)(`button`,{type:`button`,disabled:l||T.isPending,onClick:()=>void O(),className:`px-3 py-1.5 text-[12px] font-medium rounded-lg bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 transition-colors duration-150`,children:l?T.isPending?`요청 중`:`재연결 중`:`재시작`})]})]})]})]})}function E(){let e=a.useSettingList(),{data:t,isLoading:n}=e;if(n)return(0,f.jsx)(`div`,{className:`space-y-4`,children:[0,1].map(e=>(0,f.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,f.jsx)(`div`,{className:`panel-header px-4 py-2.5 sm:px-5`,children:(0,f.jsx)(`div`,{className:`h-3 w-24 rounded bg-sand-200 animate-pulse`})}),(0,f.jsx)(`div`,{className:`divide-y divide-sand-100/80`,children:[0,1,2].map(e=>(0,f.jsxs)(`div`,{className:`px-4 py-3 sm:px-5 flex items-center justify-between gap-4`,children:[(0,f.jsx)(`div`,{className:`h-3 w-40 rounded bg-sand-100 animate-pulse`}),(0,f.jsx)(`div`,{className:`h-7 w-24 rounded-lg bg-sand-100 animate-pulse`})]},e))})]},e))});if(e.isError&&!t)return(0,f.jsxs)(`div`,{className:`panel px-5 py-6 text-center`,children:[(0,f.jsx)(`p`,{className:`text-[13px] font-medium text-sand-800`,children:`설정을 불러오지 못했습니다`}),(0,f.jsx)(`p`,{className:`mt-1 text-[11px] text-red-500`,children:e.error.message}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>void e.refetch(),disabled:e.isFetching,className:`mt-3 px-3 py-1.5 text-[12px] rounded-lg border border-sand-200 text-sand-600 hover:bg-sand-100 disabled:opacity-50`,children:e.isFetching?`다시 불러오는 중`:`다시 시도`})]});let r=t?.settings??[],i=t?.runtime??[],o=[...new Set(r.map(e=>e.group))];return(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`panel-header flex items-center justify-between px-4 py-2.5 sm:px-5`,children:[(0,f.jsx)(`span`,{className:`text-[13px] font-medium text-sand-700`,children:`환경`}),(0,f.jsx)(`span`,{className:`text-[11px] text-sand-400`,children:`기동 시점 값`})]}),(0,f.jsx)(`dl`,{className:`px-4 py-3 sm:px-5 grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-1.5`,children:i.map(e=>(0,f.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 min-w-0`,children:[(0,f.jsx)(`dt`,{className:`text-[11px] text-sand-500 shrink-0`,children:e.label}),(0,f.jsx)(`dd`,{className:`text-[12px] font-mono text-sand-700 truncate`,children:e.value})]},e.label))})]}),o.map(e=>{let t=r.filter(t=>t.group===e);return(0,f.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`panel-header flex items-center justify-between px-4 py-2.5 sm:px-5`,children:[(0,f.jsx)(`span`,{className:`text-[13px] font-medium text-sand-700`,children:g[e]??e}),e===`slack`&&(0,f.jsx)(w,{})]}),(0,f.jsx)(`div`,{className:`divide-y divide-sand-100/80`,children:t.map(e=>(0,f.jsx)(C,{item:e},e.key))})]},e)}),(0,f.jsx)(T,{supervisor:t?.supervisor??null})]})}function D(){return(0,f.jsx)(`div`,{className:`max-w-4xl mx-auto`,children:(0,f.jsx)(E,{})})}export{D as component};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{l as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,r}from"./vendor-react-DH4kUfK2.js";import{i,r as a}from"./services.generated-jGypfumC.js";import{c as o,l as s,o as c,t as l}from"./index-C24D5PiN.js";import{n as u,t as d}from"./cost-CpjVoAqp.js";function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(null,arguments)}function p(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var m=e(n()),h=r(),g={},_=(0,m.createContext)(g),v=(e,t)=>f({},e,t),y=()=>(0,m.useContext)(_),b=(0,m.createContext)(()=>{});b.displayName=`JVR.DispatchShowTools`;function x(){return(0,m.useReducer)(v,g)}function S(){return(0,m.useContext)(b)}var C=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,h.jsx)(_.Provider,{value:t,children:(0,h.jsx)(b.Provider,{value:n,children:r})})};C.displayName=`JVR.ShowTools`;var w={},T=(0,m.createContext)(w),E=(e,t)=>f({},e,t),D=()=>(0,m.useContext)(T),O=(0,m.createContext)(()=>{});O.displayName=`JVR.DispatchExpands`;function ee(){return(0,m.useReducer)(E,w)}function te(){return(0,m.useContext)(O)}var ne=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,h.jsx)(T.Provider,{value:t,children:(0,h.jsx)(O.Provider,{value:n,children:r})})};ne.displayName=`JVR.Expands`;var re={Str:{as:`span`,"data-type":`string`,style:{color:`var(--w-rjv-type-string-color, #cb4b16)`},className:`w-rjv-type`,children:`string`},Url:{as:`a`,style:{color:`var(--w-rjv-type-url-color, #0969da)`},"data-type":`url`,className:`w-rjv-type`,children:`url`},Undefined:{style:{color:`var(--w-rjv-type-undefined-color, #586e75)`},as:`span`,"data-type":`undefined`,className:`w-rjv-type`,children:`undefined`},Null:{style:{color:`var(--w-rjv-type-null-color, #d33682)`},as:`span`,"data-type":`null`,className:`w-rjv-type`,children:`null`},Map:{style:{color:`var(--w-rjv-type-map-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`map`,className:`w-rjv-type`,children:`Map`},Nan:{style:{color:`var(--w-rjv-type-nan-color, #859900)`},as:`span`,"data-type":`nan`,className:`w-rjv-type`,children:`NaN`},Bigint:{style:{color:`var(--w-rjv-type-bigint-color, #268bd2)`},as:`span`,"data-type":`bigint`,className:`w-rjv-type`,children:`bigint`},Int:{style:{color:`var(--w-rjv-type-int-color, #268bd2)`},as:`span`,"data-type":`int`,className:`w-rjv-type`,children:`int`},Set:{style:{color:`var(--w-rjv-type-set-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`set`,className:`w-rjv-type`,children:`Set`},Float:{style:{color:`var(--w-rjv-type-float-color, #859900)`},as:`span`,"data-type":`float`,className:`w-rjv-type`,children:`float`},True:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},False:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},Date:{style:{color:`var(--w-rjv-type-date-color, #268bd2)`},as:`span`,"data-type":`date`,className:`w-rjv-type`,children:`date`}},ie=(0,m.createContext)(re),ae=(e,t)=>f({},e,t),k=()=>(0,m.useContext)(ie),oe=(0,m.createContext)(()=>{});oe.displayName=`JVR.DispatchTypes`;function se(){return(0,m.useReducer)(ae,re)}function ce(){return(0,m.useContext)(oe)}function le(e){var{initial:t,dispatch:n,children:r}=e;return(0,h.jsx)(ie.Provider,{value:t,children:(0,h.jsx)(oe.Provider,{value:n,children:r})})}le.displayName=`JVR.Types`;var ue=[`style`];function de(e){var{style:t}=e,n=p(e,ue);return(0,h.jsx)(`svg`,f({viewBox:`0 0 24 24`,fill:`var(--w-rjv-arrow-color, currentColor)`,style:f({cursor:`pointer`,height:`1em`,width:`1em`,userSelect:`none`,display:`inline-flex`},t)},n,{children:(0,h.jsx)(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`})}))}de.displayName=`JVR.TriangleArrow`;var fe={Arrow:{as:`span`,className:`w-rjv-arrow`,style:{transform:`rotate(0deg)`,transition:`all 0.3s`},children:(0,h.jsx)(de,{})},Colon:{as:`span`,style:{color:`var(--w-rjv-colon-color, var(--w-rjv-color))`,marginLeft:0,marginRight:2},className:`w-rjv-colon`,children:`:`},Quote:{as:`span`,style:{color:`var(--w-rjv-quotes-color, #236a7c)`},className:`w-rjv-quotes`,children:`"`},ValueQuote:{as:`span`,style:{color:`var(--w-rjv-quotes-string-color, #cb4b16)`},className:`w-rjv-quotes`,children:`"`},BracketsLeft:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-start`,children:`[`},BracketsRight:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-end`,children:`]`},BraceLeft:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-start`,children:`{`},BraceRight:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-end`,children:`}`}},pe=(0,m.createContext)(fe),me=(e,t)=>f({},e,t),A=()=>(0,m.useContext)(pe),j=(0,m.createContext)(()=>{});j.displayName=`JVR.DispatchSymbols`;function he(){return(0,m.useReducer)(me,fe)}function ge(){return(0,m.useContext)(j)}var _e=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,h.jsx)(pe.Provider,{value:t,children:(0,h.jsx)(j.Provider,{value:n,children:r})})};_e.displayName=`JVR.Symbols`;var ve={Copied:{className:`w-rjv-copied`,style:{height:`1em`,width:`1em`,cursor:`pointer`,verticalAlign:`middle`,marginLeft:5}},CountInfo:{as:`span`,className:`w-rjv-object-size`,style:{color:`var(--w-rjv-info-color, #0000004d)`,paddingLeft:8,fontStyle:`italic`}},CountInfoExtra:{as:`span`,className:`w-rjv-object-extra`,style:{paddingLeft:8}},Ellipsis:{as:`span`,style:{cursor:`pointer`,color:`var(--w-rjv-ellipsis-color, #cb4b16)`,userSelect:`none`},className:`w-rjv-ellipsis`,children:`...`},Row:{as:`div`,className:`w-rjv-line`},KeyName:{as:`span`,className:`w-rjv-object-key`}},ye=(0,m.createContext)(ve),be=(e,t)=>f({},e,t),M=()=>(0,m.useContext)(ye),N=(0,m.createContext)(()=>{});N.displayName=`JVR.DispatchSection`;function xe(){return(0,m.useReducer)(be,ve)}function Se(){return(0,m.useContext)(N)}var Ce=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,h.jsx)(ye.Provider,{value:t,children:(0,h.jsx)(N.Provider,{value:n,children:r})})};Ce.displayName=`JVR.Section`;var we={objectSortKeys:!1,indentWidth:15},P=(0,m.createContext)(we);P.displayName=`JVR.Context`;var Te=(0,m.createContext)(()=>{});Te.displayName=`JVR.DispatchContext`;function Ee(e,t){return f({},e,t)}var F=()=>(0,m.useContext)(P),De=e=>{var{children:t,initialState:n,initialTypes:r}=e,[i,a]=(0,m.useReducer)(Ee,Object.assign({},we,n)),[o,s]=x(),[c,l]=ee(),[u,d]=se(),[p,g]=he(),[_,v]=xe();return(0,m.useEffect)(()=>a(f({},n)),[n]),(0,h.jsx)(P.Provider,{value:i,children:(0,h.jsx)(Te.Provider,{value:a,children:(0,h.jsx)(C,{initial:o,dispatch:s,children:(0,h.jsx)(ne,{initial:c,dispatch:l,children:(0,h.jsx)(le,{initial:f({},u,r),dispatch:d,children:(0,h.jsx)(_e,{initial:p,dispatch:g,children:(0,h.jsx)(Ce,{initial:_,dispatch:v,children:t})})})})})})})};De.displayName=`JVR.Provider`;function Oe(e){if(e==null)throw TypeError(`Cannot destructure `+e)}var ke=[`isNumber`,`value`,`parentValue`,`keyName`,`keys`],Ae=[`as`,`render`],je=[`as`,`render`],Me=[`as`,`render`],Ne=[`as`,`style`,`render`],Pe=[`as`,`render`],Fe=[`as`,`render`],Ie=[`as`,`render`],Le=[`as`,`render`],I=e=>{var{Quote:t={}}=A(),{isNumber:n,value:r,parentValue:i,keyName:a,keys:o}=e,s=p(e,ke);if(n)return null;var{as:c,render:l}=t,u=p(t,Ae),d=c||`span`,m=f({},s,u);return typeof m.children==`string`&&(m.children=m.children.trim()||void 0),l&&typeof l==`function`&&l(m,{value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])})||(0,h.jsx)(d,f({},m))};I.displayName=`JVR.Quote`;var L=e=>{var{ValueQuote:t={}}=A(),n=f({},(Oe(e),e)),{as:r,render:i}=t,a=p(t,je),o=r||`span`,s=f({},n,a);return i&&typeof i==`function`&&i(s,{})||(0,h.jsx)(o,f({},s))};L.displayName=`JVR.ValueQuote`;var Re=e=>{var{value:t,parentValue:n,keyName:r,keys:i}=e,{Colon:a={}}=A(),{as:o,render:s}=a,c=p(a,Me),l=o||`span`;return s&&typeof s==`function`&&s(c,{value:t,parentValue:n,keyName:r,keys:i||(r?[r]:[])})||(0,h.jsx)(l,f({},c))};Re.displayName=`JVR.Colon`;var ze=e=>{var{Arrow:t={}}=A(),n=D(),{expandKey:r,style:i,value:a,parentValue:o,keyName:s,keys:c}=e,l=!!n[r],{as:u,style:d,render:m}=t,g=p(t,Ne),_=u||`span`,v=m&&typeof m==`function`,y=f({},g,{"data-expanded":l,style:f({},d,i)});return v&&m(y,{value:a,parentValue:o,keyName:s,keys:c||(s?[s]:[])})||(0,h.jsx)(_,f({},g,{style:f({},d,i)}))};ze.displayName=`JVR.Arrow`;var Be=e=>{var{isBrackets:t,value:n,parentValue:r,keyName:i,keys:a}=e,{BracketsLeft:o={},BraceLeft:s={}}=A(),c={value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])};if(t){var{as:l,render:u}=o,d=p(o,Pe),m=l||`span`;return u&&typeof u==`function`&&u(d,c)||(0,h.jsx)(m,f({},d))}var{as:g,render:_}=s,v=p(s,Fe),y=g||`span`;return _&&typeof _==`function`&&_(v,c)||(0,h.jsx)(y,f({},v))};Be.displayName=`JVR.BracketsOpen`;var R=e=>{var{isBrackets:t,isVisiable:n,value:r,parentValue:i,keyName:a,keys:o}=e,s={value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])};if(!n)return null;var{BracketsRight:c={},BraceRight:l={}}=A();if(t){var{as:u,render:d}=c,m=p(c,Ie),g=u||`span`;return d&&typeof d==`function`&&d(m,s)||(0,h.jsx)(g,f({},m))}var{as:_,render:v}=l,y=p(l,Le),b=_||`span`;return v&&typeof v==`function`&&v(y,s)||(0,h.jsx)(b,f({},y))};R.displayName=`JVR.BracketsClose`;var Ve=e=>{var{keyName:t,value:n,expandKey:r,parentValue:i,level:a,keys:o=[]}=e,s=D(),{collapsed:c,shouldExpandNodeInitially:l}=F(),u=typeof c==`boolean`?c:typeof c==`number`?a>c:!1,d=s[r]??(l?!1:u),p=l&&l(!d,{value:n,keys:o,level:a,keyName:t,parentValue:i});if(l&&c===!1){if(s[r]===void 0&&!p)return null}else if(s[r]===void 0&&p)return null;var m=Object.keys(n).length;if(d||m===0)return null;var g={paddingLeft:4},_={keyName:t,value:n,keys:o,parentValue:i},v=Array.isArray(n),y=n instanceof Set;return(0,h.jsx)(`div`,{style:g,children:(0,h.jsx)(R,f({isBrackets:v||y},_,{isVisiable:!0}))})};Ve.displayName=`JVR.NestedClose`;var He=[`as`,`render`],Ue=[`as`,`render`],We=[`as`,`render`],Ge=[`as`,`render`],Ke=[`as`,`render`],qe=[`as`,`render`],Je=[`as`,`render`],Ye=[`as`,`render`],Xe=[`as`,`render`],Ze=[`as`,`render`],Qe=[`as`,`render`],$e=[`as`,`render`],et=[`as`,`render`],z=e=>{if(e===void 0)return`0n`;if(typeof e==`string`)try{e=BigInt(e)}catch{return`0n`}return e?e.toString()+`n`:`0n`},tt=e=>{var{value:t,keyName:n}=e,{Set:r={},displayDataTypes:i}=k();if(!(t instanceof Set)||!i)return null;var{as:a,render:o}=r,s=p(r,He);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,h.jsx)(a||`span`,f({},s))};tt.displayName=`JVR.SetComp`;var nt=e=>{var{value:t,keyName:n}=e,{Map:r={},displayDataTypes:i}=k();if(!(t instanceof Map)||!i)return null;var{as:a,render:o}=r,s=p(r,Ue);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,h.jsx)(a||`span`,f({},s))};nt.displayName=`JVR.MapComp`;var B={opacity:.75,paddingRight:4},rt=e=>{var{children:t=``,keyName:n,keys:r}=e,{Str:i={},displayDataTypes:a}=k(),{shortenTextAfterLength:o=30,stringEllipsis:s=`...`}=F(),{as:c,render:l}=i,u=p(i,We),d=t,[g,_]=(0,m.useState)(o&&d.length>o);(0,m.useEffect)(()=>_(o&&d.length>o),[o]);var v=c||`span`,y=f({},B,i.style||{});o>0&&(u.style=f({},u.style,{cursor:d.length<=o?`initial`:`pointer`}),d.length>o&&(u.onClick=()=>{_(!g)}));var b=g?``+d.slice(0,o)+s:d,x=l&&typeof l==`function`,S=x&&l(f({},u,{style:y}),{type:`type`,value:t,keyName:n,keys:r}),C=g?`w-rjv-value w-rjv-value-short`:`w-rjv-value`,w=x&&l(f({},u,{children:b,className:C}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(S||(0,h.jsx)(v,f({},u,{style:y}))),w||(0,h.jsxs)(m.Fragment,{children:[(0,h.jsx)(L,{}),(0,h.jsx)(v,f({},u,{className:C,children:b})),(0,h.jsx)(L,{})]})]})};rt.displayName=`JVR.TypeString`;var it=e=>{var{children:t,keyName:n,keys:r}=e,{True:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,Ge),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_||(0,h.jsx)(l,f({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};it.displayName=`JVR.TypeTrue`;var at=e=>{var{children:t,keyName:n,keys:r}=e,{False:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,Ke),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_||(0,h.jsx)(l,f({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};at.displayName=`JVR.TypeFalse`;var ot=e=>{var{children:t,keyName:n,keys:r}=e,{Float:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,qe),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_||(0,h.jsx)(l,f({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};ot.displayName=`JVR.TypeFloat`;var st=e=>{var{children:t,keyName:n,keys:r}=e,{Int:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,Je),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_||(0,h.jsx)(l,f({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};st.displayName=`JVR.TypeInt`;var ct=e=>{var{children:t,keyName:n,keys:r}=e,{Bigint:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,Ye),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_||(0,h.jsx)(l,f({},c,{className:`w-rjv-value`,children:z(t?.toString())}))]})};ct.displayName=`JVR.TypeFloat`;var lt=e=>{var{children:t,keyName:n,keys:r}=e,{Url:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,Xe),l=o||`span`,u=f({},B,i.style),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t?.href,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_||(0,h.jsxs)(`a`,f({href:t?.href,target:`_blank`},c,{className:`w-rjv-value`,children:[(0,h.jsx)(L,{}),t?.href,(0,h.jsx)(L,{})]}))]})};lt.displayName=`JVR.TypeUrl`;var ut=e=>{var{children:t,keyName:n,keys:r}=e,{Date:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,Ze),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=t instanceof Date?t.toLocaleString():t,v=d&&s(f({},c,{children:_,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),v||(0,h.jsx)(l,f({},c,{className:`w-rjv-value`,children:_}))]})};ut.displayName=`JVR.TypeDate`;var dt=e=>{var{children:t,keyName:n,keys:r}=e,{Undefined:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,Qe),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_]})};dt.displayName=`JVR.TypeUndefined`;var ft=e=>{var{children:t,keyName:n,keys:r}=e,{Null:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,$e),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_]})};ft.displayName=`JVR.TypeNull`;var pt=e=>{var{children:t,keyName:n,keys:r}=e,{Nan:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,et),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t?.toString(),className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_]})};pt.displayName=`JVR.TypeNan`;var mt=e=>Number(e)===e&&e%1!=0||isNaN(e),ht=e=>{var{value:t,keyName:n,keys:r}=e,i={keyName:n,keys:r};return t instanceof URL?(0,h.jsx)(lt,f({},i,{children:t})):typeof t==`string`?(0,h.jsx)(rt,f({},i,{children:t})):t===!0?(0,h.jsx)(it,f({},i,{children:t})):t===!1?(0,h.jsx)(at,f({},i,{children:t})):t===null?(0,h.jsx)(ft,f({},i,{children:t})):t===void 0?(0,h.jsx)(dt,f({},i,{children:t})):t instanceof Date?(0,h.jsx)(ut,f({},i,{children:t})):typeof t==`number`&&isNaN(t)?(0,h.jsx)(pt,f({},i,{children:t})):typeof t==`number`&&mt(t)?(0,h.jsx)(ot,f({},i,{children:t})):typeof t==`bigint`?(0,h.jsx)(ct,f({},i,{children:t})):typeof t==`number`?(0,h.jsx)(st,f({},i,{children:t})):null};ht.displayName=`JVR.Value`;function V(e,t,n){var r=ge(),i=f({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:f({},e.style,t.style),children:t.children||e.children});(0,m.useEffect)(()=>r({[n]:i}),[t])}function H(e,t,n){var r=ce(),i=f({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:f({},e.style,t.style),children:t.children||e.children});(0,m.useEffect)(()=>r({[n]:i}),[t])}function U(e,t,n){var r=Se(),i=f({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:f({},e.style,t.style),children:t.children||e.children});(0,m.useEffect)(()=>r({[n]:i}),[t])}var gt=[`as`,`render`],_t=e=>{var{KeyName:t={}}=M();return U(t,e,`KeyName`),null};_t.displayName=`JVR.KeyName`;var vt=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o={color:typeof t==`number`?`var(--w-rjv-key-number, #268bd2)`:`var(--w-rjv-key-string, #002b36)`},{KeyName:s={}}=M(),{as:c,render:l}=s,u=p(s,gt);u.style=f({},u.style,o);var d=c||`span`;return l&&typeof l==`function`&&l(f({},u,{children:t}),{value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])})||(0,h.jsx)(d,f({},u,{children:t}))};vt.displayName=`JVR.KeyNameComp`;var yt=[`children`,`value`,`parentValue`,`keyName`,`keys`],bt=[`as`,`render`,`children`],xt=e=>{var{Row:t={}}=M();return U(t,e,`Row`),null};xt.displayName=`JVR.Row`;var St=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o=p(e,yt),{Row:s={}}=M(),{as:c,render:l}=s,u=p(s,bt),d=c||`div`;return l&&typeof l==`function`&&l(f({},o,u,{children:t}),{value:n,keyName:i,parentValue:r,keys:a})||(0,h.jsx)(d,f({},o,u,{children:t}))};St.displayName=`JVR.RowComp`;function Ct(e){var t=(0,m.useRef)();return(0,m.useEffect)(()=>{t.current=e}),t.current}function wt(e){var{value:t,highlightUpdates:n,highlightContainer:r}=e,i=Ct(t),a=(0,m.useMemo)(()=>{if(!n||i===void 0)return!1;if(typeof t!=typeof i)return!0;if(typeof t==`number`)return isNaN(t)&&isNaN(i)?!1:t!==i;if(Array.isArray(t)!==Array.isArray(i))return!0;if(typeof t==`object`||typeof t==`function`)return!1;if(t!==i)return!0},[n,t]);(0,m.useEffect)(()=>{r&&r.current&&a&&`animate`in r.current&&r.current.animate([{backgroundColor:`var(--w-rjv-update-color, #ebcb8b)`},{backgroundColor:``}],{duration:1e3,easing:`ease-in`})},[a,t,r])}var Tt=[`keyName`,`value`,`parentValue`,`expandKey`,`keys`,`beforeCopy`],Et=[`as`,`render`],W=e=>{var{keyName:t,value:n,parentValue:r,expandKey:i,keys:a,beforeCopy:o}=e,s=p(e,Tt),{onCopied:c,enableClipboard:l,beforeCopy:u}=F(),d=y()[i],[g,_]=(0,m.useState)(!1),{Copied:v={}}=M(),b=v?.beforeCopy;if(l===!1||!d)return null;var x={style:{display:`inline-flex`},fill:g?`var(--w-rjv-copied-success-color, #28a745)`:`var(--w-rjv-copied-color, currentColor)`,onClick:e=>{e.stopPropagation();var s=``;s=typeof n==`number`&&n===1/0?`Infinity`:typeof n==`number`&&isNaN(n)?`NaN`:typeof n==`bigint`?z(n):n instanceof Date?n.toLocaleString():JSON.stringify(n,(e,t)=>typeof t==`bigint`?z(t):t,2);var l=o||b||u;l&&typeof l==`function`&&(s=l(s,t,n,r,i,a)),c&&c(s,n),_(!0),(navigator.clipboard||{writeText(e){return new Promise((t,n)=>{var r=document.createElement(`textarea`);r.style.position=`absolute`,r.style.opacity=`0`,r.style.left=`-99999999px`,r.value=e,document.body.appendChild(r),r.select(),document.execCommand(`copy`)?t():n(),r.remove()})}}).writeText(s).then(()=>{var e=setTimeout(()=>{_(!1),clearTimeout(e)},3e3)}).catch(e=>{})}},{render:S}=v,C=p(v,Et),w=f({},C,s,x,{style:f({},C.style,s.style,x.style)});return S&&typeof S==`function`&&S(f({},w,{"data-copied":g}),{value:n,keyName:t,keys:a,parentValue:r})||(g?(0,h.jsx)(`svg`,f({viewBox:`0 0 32 36`},w,{children:(0,h.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})):(0,h.jsx)(`svg`,f({viewBox:`0 0 32 36`},w,{children:(0,h.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})))};W.displayName=`JVR.Copied`;function Dt(){var e=(0,m.useRef)(null);return e.current===null&&(e.current=`custom-id-`+Math.random().toString(36).substr(2,9)),e.current}var Ot=e=>{var{keyName:t,value:n,expandKey:r=``,level:i,keys:a=[],parentValue:o}=e,s=D(),{objectSortKeys:c,indentWidth:l,collapsed:u,shouldExpandNodeInitially:d}=F(),f=typeof u==`boolean`?u:typeof u==`number`?i>u:!1,p=s[r]??(d?!1:f),m=d&&d(!p,{value:n,keys:a,level:i,keyName:t,parentValue:o});if(d&&u===!1){if(s[r]===void 0&&!m)return null}else if(s[r]===void 0&&m)return null;if(p)return null;var g=Array.isArray(n)?Object.entries(n).map(e=>[Number(e[0]),e[1]]):Object.entries(n);return c&&(g=c===!0?g.sort((e,t)=>{var[n]=e,[r]=t;return typeof n==`string`&&typeof r==`string`?n.localeCompare(r):0}):g.sort((e,t)=>{var[n,r]=e,[i,a]=t;return typeof n==`string`&&typeof i==`string`?c(n,i,r,a):0})),(0,h.jsx)(`div`,{className:`w-rjv-wrap`,style:{borderLeft:`var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)`,paddingLeft:l,marginLeft:6},children:g.map((e,t)=>{var[r,o]=e;return(0,h.jsx)(kt,{parentValue:n,keyName:r,keys:[...a,r],value:o,level:i},t)})})};Ot.displayName=`JVR.KeyValues`;var G=e=>{var{keyName:t,parentValue:n,keys:r,value:i}=e,{highlightUpdates:a}=F(),o=typeof t==`number`,s=(0,m.useRef)(null);wt({value:i,highlightUpdates:a,highlightContainer:s});var c={keyName:t,value:i,keys:r,parentValue:n};return(0,h.jsxs)(m.Fragment,{children:[(0,h.jsxs)(`span`,{ref:s,children:[(0,h.jsx)(I,f({isNumber:o,"data-placement":`left`},c)),(0,h.jsx)(vt,f({},c,{children:t})),(0,h.jsx)(I,f({isNumber:o,"data-placement":`right`},c))]}),(0,h.jsx)(Re,f({},c))]})};G.displayName=`JVR.KayName`;var kt=e=>{var{keyName:t,value:n,parentValue:r,level:i=0,keys:a=[]}=e,o=S(),s=Dt(),c=Array.isArray(n),l=n instanceof Set,u=n instanceof Map,d=n instanceof Date,p=n instanceof URL;return n&&typeof n==`object`&&!c&&!l&&!u&&!d&&!p||c||l||u?(0,h.jsx)(Ut,{keyName:t,value:l?Array.from(n):u?Object.fromEntries(n):n,parentValue:r,initialValue:n,keys:a,level:i+1}):(0,h.jsxs)(St,f({className:`w-rjv-line`,value:n,keyName:t,keys:a,parentValue:r},{onMouseEnter:()=>o({[s]:!0}),onMouseLeave:()=>o({[s]:!1})},{children:[(0,h.jsx)(G,{keyName:t,value:n,keys:a,parentValue:r}),(0,h.jsx)(ht,{keyName:t,value:n,keys:a}),(0,h.jsx)(W,{keyName:t,value:n,keys:a,parentValue:r,expandKey:s})]}))};kt.displayName=`JVR.KeyValuesItem`;var At=[`value`,`keyName`],jt=[`as`,`render`],Mt=e=>{var{CountInfoExtra:t={}}=M();return U(t,e,`CountInfoExtra`),null};Mt.displayName=`JVR.CountInfoExtra`;var Nt=e=>{var{value:t={},keyName:n}=e,r=p(e,At),{CountInfoExtra:i={}}=M(),{as:a,render:o}=i,s=p(i,jt);if(!o&&!s.children)return null;var c=a||`span`,l=o&&typeof o==`function`,u=f({},s,r);return l&&o(u,{value:t,keyName:n})||(0,h.jsx)(c,f({},u))};Nt.displayName=`JVR.CountInfoExtraComps`;var Pt=[`value`,`keyName`],Ft=[`as`,`render`],It=e=>{var{CountInfo:t={}}=M();return U(t,e,`CountInfo`),null};It.displayName=`JVR.CountInfo`;var Lt=e=>{var{value:t={},keyName:n}=e,r=p(e,Pt),{displayObjectSize:i}=F(),{CountInfo:a={}}=M();if(!i)return null;var{as:o,render:s}=a,c=p(a,Ft),l=o||`span`;c.style=f({},c.style,e.style);var u=Object.keys(t).length;c.children||=u+` item`+(u===1?``:`s`);var d=f({},c,r);return s&&typeof s==`function`&&s(f({},d,{"data-length":u}),{value:t,keyName:n})||(0,h.jsx)(l,f({},d))};Lt.displayName=`JVR.CountInfoComp`;var Rt=[`as`,`render`],zt=e=>{var{Ellipsis:t={}}=M();return U(t,e,`Ellipsis`),null};zt.displayName=`JVR.Ellipsis`;var Bt=e=>{var{isExpanded:t,value:n,keyName:r}=e,{Ellipsis:i={}}=M(),{as:a,render:o}=i,s=p(i,Rt),c=a||`span`;return o&&typeof o==`function`&&o(f({},s,{"data-expanded":t}),{value:n,keyName:r})||(!t||typeof n==`object`&&Object.keys(n).length==0?null:(0,h.jsx)(c,f({},s)))};Bt.displayName=`JVR.EllipsisComp`;var Vt=e=>{var{keyName:t,expandKey:n,keys:r=[],initialValue:i,value:a,parentValue:o,level:s}=e,c=D(),l=te(),{onExpand:u,collapsed:d,shouldExpandNodeInitially:p}=F(),m=typeof d==`boolean`?d:typeof d==`number`?s>d:!1,g=c[n]??(p?!1:m),_=p&&p(!g,{value:a,keys:r,level:s,keyName:t,parentValue:o});c[n]===void 0&&p&&(g=!_);var v=()=>{var e={expand:!g,value:a,keyid:n,keyName:t};u&&u(e),l({[n]:e.expand})},y={display:`inline-flex`,alignItems:`center`},b={transform:`rotate(`+(g?`-90`:`0`)+`deg)`,transition:`all 0.3s`},x=Object.keys(a).length,S=typeof a==`object`,C=Array.isArray(a),w=a instanceof Set,T=x!==0&&(C||w||S),E={style:y};T&&(E.onClick=v);var O={keyName:t,value:a,keys:r,parentValue:o};return(0,h.jsxs)(`span`,f({},E,{children:[T&&(0,h.jsx)(ze,f({style:b,expandKey:n},O)),(t||typeof t==`number`)&&(0,h.jsx)(G,f({},O)),(0,h.jsx)(tt,{value:i,keyName:t}),(0,h.jsx)(nt,{value:i,keyName:t}),(0,h.jsx)(Be,f({isBrackets:C||w},O)),(0,h.jsx)(Bt,{keyName:t,value:a,isExpanded:g}),(0,h.jsx)(R,f({isVisiable:g||!T,isBrackets:C||w},O)),(0,h.jsx)(Lt,{value:a,keyName:t}),(0,h.jsx)(Nt,{value:a,keyName:t}),(0,h.jsx)(W,{keyName:t,value:a,expandKey:n,parentValue:o,keys:r})]}))};Vt.displayName=`JVR.NestedOpen`;var Ht=[`className`,`children`,`parentValue`,`keyid`,`level`,`value`,`initialValue`,`keys`,`keyName`],Ut=(0,m.forwardRef)((e,t)=>{var{className:n=``,parentValue:r,level:i=1,value:a,initialValue:o,keys:s,keyName:c}=e,l=p(e,Ht),u=S(),d=Dt();return(0,h.jsxs)(`div`,f({className:[n,`w-rjv-inner`].filter(Boolean).join(` `),ref:t},l,{onMouseEnter:()=>u({[d]:!0}),onMouseLeave:()=>u({[d]:!1})},{children:[(0,h.jsx)(Vt,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c,initialValue:o}),(0,h.jsx)(Ot,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c}),(0,h.jsx)(Ve,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c})]}))});Ut.displayName=`JVR.Container`;var Wt=e=>{var{BraceLeft:t={}}=A();return V(t,e,`BraceLeft`),null};Wt.displayName=`JVR.BraceLeft`;var Gt=e=>{var{BraceRight:t={}}=A();return V(t,e,`BraceRight`),null};Gt.displayName=`JVR.BraceRight`;var Kt=e=>{var{BracketsLeft:t={}}=A();return V(t,e,`BracketsLeft`),null};Kt.displayName=`JVR.BracketsLeft`;var qt=e=>{var{BracketsRight:t={}}=A();return V(t,e,`BracketsRight`),null};qt.displayName=`JVR.BracketsRight`;var Jt=e=>{var{Arrow:t={}}=A();return V(t,e,`Arrow`),null};Jt.displayName=`JVR.Arrow`;var Yt=e=>{var{Colon:t={}}=A();return V(t,e,`Colon`),null};Yt.displayName=`JVR.Colon`;var Xt=e=>{var{Quote:t={}}=A();return V(t,e,`Quote`),null};Xt.displayName=`JVR.Quote`;var Zt=e=>{var{ValueQuote:t={}}=A();return V(t,e,`ValueQuote`),null};Zt.displayName=`JVR.ValueQuote`;var Qt=e=>{var{Bigint:t={}}=k();return H(t,e,`Bigint`),null};Qt.displayName=`JVR.Bigint`;var $t=e=>{var{Date:t={}}=k();return H(t,e,`Date`),null};$t.displayName=`JVR.Date`;var en=e=>{var{False:t={}}=k();return H(t,e,`False`),null};en.displayName=`JVR.False`;var tn=e=>{var{Float:t={}}=k();return H(t,e,`Float`),null};tn.displayName=`JVR.Float`;var nn=e=>{var{Int:t={}}=k();return H(t,e,`Int`),null};nn.displayName=`JVR.Int`;var rn=e=>{var{Map:t={}}=k();return H(t,e,`Map`),null};rn.displayName=`JVR.Map`;var an=e=>{var{Nan:t={}}=k();return H(t,e,`Nan`),null};an.displayName=`JVR.Nan`;var on=e=>{var{Null:t={}}=k();return H(t,e,`Null`),null};on.displayName=`JVR.Null`;var sn=e=>{var{Set:t={}}=k();return H(t,e,`Set`),null};sn.displayName=`JVR.Set`;var cn=e=>{var{Str:t={}}=k();return H(t,e,`Str`),null};cn.displayName=`JVR.StringText`;var ln=e=>{var{True:t={}}=k();return H(t,e,`True`),null};ln.displayName=`JVR.True`;var un=e=>{var{Undefined:t={}}=k();return H(t,e,`Undefined`),null};un.displayName=`JVR.Undefined`;var dn=e=>{var{Url:t={}}=k();return H(t,e,`Url`),null};dn.displayName=`JVR.Url`;var fn=e=>{var{Copied:t={}}=M();return U(t,e,`Copied`),null};fn.displayName=`JVR.Copied`;var pn=[`className`,`style`,`value`,`children`,`collapsed`,`shouldExpandNodeInitially`,`indentWidth`,`displayObjectSize`,`shortenTextAfterLength`,`stringEllipsis`,`highlightUpdates`,`enableClipboard`,`displayDataTypes`,`objectSortKeys`,`onExpand`,`onCopied`,`beforeCopy`],K=(0,m.forwardRef)((e,t)=>{var{className:n=``,style:r,value:i,children:a,collapsed:o=!1,shouldExpandNodeInitially:s,indentWidth:c=15,displayObjectSize:l=!0,shortenTextAfterLength:u=30,stringEllipsis:d,highlightUpdates:m=!0,enableClipboard:g=!0,displayDataTypes:_=!0,objectSortKeys:v=!1,onExpand:y,onCopied:b,beforeCopy:x}=e,S=p(e,pn),C=f({lineHeight:1.4,fontFamily:`var(--w-rjv-font-family, Menlo, monospace)`,color:`var(--w-rjv-color, #002b36)`,backgroundColor:`var(--w-rjv-background-color, #00000000)`,fontSize:13},r),w=[`w-json-view-container`,`w-rjv`,n].filter(Boolean).join(` `);return(0,h.jsxs)(De,{initialState:{value:i,objectSortKeys:v,indentWidth:c,shouldExpandNodeInitially:o===!1?s:void 0,displayObjectSize:l,collapsed:o,enableClipboard:g,shortenTextAfterLength:u,stringEllipsis:d,highlightUpdates:m,onCopied:b,onExpand:y,beforeCopy:x},initialTypes:{displayDataTypes:_},children:[(0,h.jsx)(Ut,f({value:i},S,{ref:t,className:w,style:C})),a]})});K.Bigint=Qt,K.Date=$t,K.False=en,K.Float=tn,K.Int=nn,K.Map=rn,K.Nan=an,K.Null=on,K.Set=sn,K.String=cn,K.True=ln,K.Undefined=un,K.Url=dn,K.ValueQuote=Zt,K.Arrow=Jt,K.Colon=Yt,K.Quote=Xt,K.Ellipsis=zt,K.BraceLeft=Wt,K.BraceRight=Gt,K.BracketsLeft=Kt,K.BracketsRight=qt,K.Copied=fn,K.CountInfo=It,K.CountInfoExtra=Mt,K.KeyName=_t,K.Row=xt,K.displayName=`JVR.JsonView`;var mn={"--w-rjv-font-family":`monospace`,"--w-rjv-color":`#002b36`,"--w-rjv-key-string":`#002b36`,"--w-rjv-background-color":`#ffffff`,"--w-rjv-line-color":`#ebebeb`,"--w-rjv-arrow-color":`var(--w-rjv-color)`,"--w-rjv-edit-color":`var(--w-rjv-color)`,"--w-rjv-info-color":`#0000004d`,"--w-rjv-update-color":`#ebcb8b`,"--w-rjv-copied-color":`#002b36`,"--w-rjv-copied-success-color":`#28a745`,"--w-rjv-curlybraces-color":`#236a7c`,"--w-rjv-colon-color":`#002b36`,"--w-rjv-brackets-color":`#236a7c`,"--w-rjv-quotes-color":`var(--w-rjv-key-string)`,"--w-rjv-quotes-string-color":`var(--w-rjv-type-string-color)`,"--w-rjv-type-string-color":`#cb4b16`,"--w-rjv-type-int-color":`#268bd2`,"--w-rjv-type-float-color":`#859900`,"--w-rjv-type-bigint-color":`#268bd2`,"--w-rjv-type-boolean-color":`#2aa198`,"--w-rjv-type-date-color":`#586e75`,"--w-rjv-type-url-color":`#0969da`,"--w-rjv-type-null-color":`#d33682`,"--w-rjv-type-nan-color":`#859900`,"--w-rjv-type-undefined-color":`#586e75`},hn=e=>(0,h.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,h.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m12 19l-7-7l7-7m7 7H5`})}),gn=e=>(0,h.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,h.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M20 6L9 17l-5-5`})}),q=e=>(0,h.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,h.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m6 9l6 6l6-6`})}),_n=e=>(0,h.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,h.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,h.jsx)(`rect`,{width:14,height:14,x:8,y:8,rx:2,ry:2}),(0,h.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]})});function vn(){let{id:e}=l.useSearch();return(0,h.jsx)(Xn,{id:e})}function J(e){return e.toLocaleString()}var yn=new Set;function bn(e){try{return{ok:!0,value:JSON.parse(e)}}catch{return{ok:!1}}}function xn(e){if(!e)return{};try{return JSON.parse(e)}catch{return e}}function Sn({text:e}){let[t,n]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>n(!1),1500);return()=>clearTimeout(e)},[t]),(0,h.jsx)(`button`,{type:`button`,className:`absolute top-2 right-2 p-1 rounded text-sand-400 hover:text-sand-600 transition-colors`,onClick:()=>{navigator.clipboard.writeText(e),n(!0)},children:t?(0,h.jsx)(gn,{className:`size-3.5 text-sage-500`}):(0,h.jsx)(_n,{className:`size-3.5`})})}var Cn=/<img\s+[^>]*src=["'](data:image\/[^"']+;base64,[^"']+)["'][^>]*(?:alt=["']([^"']*)["'][^>]*)?\/?>/gi;function wn(e){let t=[],n=0;for(let r of e.matchAll(Cn)){let i=r.index??0;i>n&&t.push({type:`text`,text:e.slice(n,i)}),t.push({type:`image`,src:r[1],alt:r[2]??`generated image`}),n=i+r[0].length}return n<e.length&&t.push({type:`text`,text:e.slice(n)}),t.filter(e=>e.type===`image`||e.text.trim().length>0)}function Tn({text:e,markdown:t}){let[n,r]=(0,m.useState)(null),i=wn(e);return i.some(e=>e.type===`image`)?(0,h.jsxs)(`div`,{className:`space-y-3`,children:[i.map((e,n)=>e.type===`text`?t?(0,h.jsx)(`div`,{className:`prose prose-sm prose-qgrid max-w-none`,children:(0,h.jsx)(s,{remarkPlugins:[o],children:e.text})},`text-${n}`):(0,h.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:e.text},`text-${n}`):(0,h.jsx)(`button`,{type:`button`,className:`block max-w-full rounded-md border border-sand-200 overflow-hidden bg-white hover:border-sienna-300 transition-colors`,onClick:()=>r(e.src),title:`Open image`,children:(0,h.jsx)(`img`,{src:e.src,alt:e.alt,className:`max-h-[520px] max-w-full object-contain`,loading:`lazy`})},`image-${n}`)),n&&(0,h.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-black/70 p-4 flex items-center justify-center`,onClick:()=>r(null),children:[(0,h.jsx)(`button`,{type:`button`,className:`absolute top-4 right-4 p-2 rounded-full bg-white/90 text-sand-700 hover:bg-white`,onClick:()=>r(null),title:`Close image`,children:(0,h.jsx)(c,{className:`size-5`})}),(0,h.jsx)(`img`,{src:n,alt:`generated preview`,className:`max-h-full max-w-full object-contain rounded-md bg-white`,onClick:e=>e.stopPropagation()})]})]}):t?(0,h.jsx)(`div`,{className:`prose prose-sm prose-qgrid max-w-none`,children:(0,h.jsx)(s,{remarkPlugins:[o],children:e})}):(0,h.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:e})}function Y({text:e,markdown:t}){let n=bn(e),[r,i]=(0,m.useState)(`pretty`),a=n.ok&&n.value!==null&&(Array.isArray(n.value)||typeof n.value==`object`);return!n.ok||!a?t?(0,h.jsx)(Tn,{text:e,markdown:!0}):(0,h.jsx)(Tn,{text:n.ok?JSON.stringify(n.value,null,2):e}):(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{className:`flex gap-1 mb-2`,children:[(0,h.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${r===`plain`?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>i(`plain`),children:`Plain`}),(0,h.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${r===`pretty`?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>i(`pretty`),children:`Pretty`})]}),r===`pretty`?(0,h.jsx)(K,{value:n.value,style:mn,displayDataTypes:!1,enableClipboard:!0,collapsed:!1}):(0,h.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:JSON.stringify(n.value,null,2)})]})}function X({title:e,defaultOpen:t=!0,children:n}){return(0,h.jsxs)(`details`,{open:t,className:`group panel overflow-hidden`,children:[(0,h.jsxs)(`summary`,{className:`panel-header flex items-center gap-1.5 cursor-pointer select-none list-none px-4 py-2.5`,children:[(0,h.jsx)(q,{className:`size-3.5 text-sand-400 transition-transform group-open:rotate-0 -rotate-90`}),(0,h.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-sand-500 font-medium`,children:e})]}),(0,h.jsx)(`div`,{className:`p-4`,children:n})]})}function Z({label:e,value:t}){return(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium truncate`,children:e}),(0,h.jsx)(`dd`,{className:`text-[15px] font-semibold text-sand-800 tabular-nums mt-0.5 truncate`,children:t})]})}var En={running:`bg-blue-100 text-blue-600`,succeeded:`bg-sage-100 text-sage-600`,error:`bg-red-100 text-red-600`,aborted:`bg-caution-400/15 text-caution-500`};function Dn({message:e}){return(0,h.jsxs)(`div`,{className:`panel overflow-hidden border border-red-200 bg-red-50/60`,children:[(0,h.jsx)(`div`,{className:`px-4 py-2.5 border-b border-red-100 flex items-center gap-1.5`,children:(0,h.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-red-600 font-medium`,children:`Error`})}),(0,h.jsx)(`div`,{className:`p-4`,children:(0,h.jsx)(`pre`,{className:`text-[12px] text-red-700 whitespace-pre-wrap break-words font-mono leading-relaxed max-h-80 overflow-auto`,children:e})})]})}function On({data:e}){let t=e.status===`running`,n=!t&&e.requested_model_name!==null&&e.model_name!==null&&e.requested_model_name!==e.model_name,r=!t&&e.requested_model_name!==null&&e.model_name===null;return(0,h.jsxs)(`div`,{className:`panel overflow-hidden px-4 py-3 flex flex-wrap items-center gap-x-2 gap-y-1.5 sm:px-5`,children:[(0,h.jsx)(`span`,{className:`text-[15px] font-semibold text-sand-900 break-all`,children:t?`실행 중`:n?`${e.requested_model_name} → ${e.model_name}`:e.model_name??e.requested_model_name??`Unknown model`}),r&&(0,h.jsx)(`span`,{className:`text-[10px] text-sand-400`,children:`요청`}),!t&&(e.fallback_count??0)>0&&(0,h.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase`,children:[`fallback ×`,e.fallback_count]}),!t&&e.status!==`succeeded`&&(0,h.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full font-medium uppercase ${En[e.status]??`bg-sand-100 text-sand-500`}`,children:e.status}),e.effort&&(0,h.jsxs)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded-md bg-sand-100 text-sand-500 font-mono`,children:[`effort=`,e.effort]}),e.project_name&&(0,h.jsxs)(`span`,{className:`text-[12px] text-sand-400`,children:[`· project=`,e.project_name]}),(0,h.jsx)(`span`,{className:`ml-auto text-[11px] text-sand-400`,children:e.token_name})]})}function kn({data:e,toolCallCount:t}){let n=Nn(e);return(0,h.jsxs)(`div`,{className:`panel overflow-hidden px-5 py-3 space-y-3`,children:[(0,h.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-x-6 gap-y-3`,children:[(0,h.jsx)(Z,{label:`Duration`,value:`${(e.duration_ms/1e3).toFixed(1)}s`}),(0,h.jsx)(Z,{label:`TTFT`,value:jn(e.ttft_ms)}),(0,h.jsx)(Z,{label:`Tokens/sec`,value:Pn(e.output_tokens,e.duration_ms,e.ttft_ms,n)}),(0,h.jsx)(Z,{label:`Driver Cost`,value:e.cost_usd===null?`—`:u(e.cost_usd)}),(0,h.jsx)(Z,{label:`Cost Source`,value:e.cost_source??`legacy`}),(0,h.jsx)(Z,{label:`Image Cost`,value:e.image_cost_usd===null?`—`:u(e.image_cost_usd)}),(0,h.jsx)(Z,{label:`Tool Calls`,value:`${t}회`})]}),(0,h.jsxs)(`div`,{className:`border-t border-sand-100/60 pt-3 grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-x-6 gap-y-3`,children:[(0,h.jsx)(Z,{label:`Input`,value:J(e.input_tokens)}),(0,h.jsx)(Z,{label:`Output`,value:J(e.output_tokens)}),(0,h.jsx)(Z,{label:`Cache Read`,value:J(e.cache_read_tokens)}),(0,h.jsx)(Z,{label:`Cache Write`,value:J(e.cache_creation_tokens)}),(0,h.jsx)(Z,{label:`Cache Write (5m)`,value:e.cache_creation_5m_tokens===null?`—`:J(e.cache_creation_5m_tokens)}),(0,h.jsx)(Z,{label:`Cache Write (1h)`,value:e.cache_creation_1h_tokens===null?`—`:J(e.cache_creation_1h_tokens)}),(0,h.jsx)(Z,{label:`Cache Hit`,value:d(e)})]})]})}function An(e){return e==null?`—`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function jn(e){return e==null||e<=0?`—`:An(e)}function Mn(e){let t=e.model_name?.trim().toLowerCase();if(t){let e=t.includes(`/`)?t.split(`/`).pop():t;if(e.startsWith(`claude-`))return`anthropic`;if(/^(gpt-|codex-|o\d)/.test(e))return`openai`}let n=e.token_name?.trim().toLowerCase();return n?.startsWith(`anthropic/`)?`anthropic`:n?.startsWith(`openai/`)?`openai`:null}function Nn(e){let t=Mn(e);return t!==null&&yn.has(t)}function Pn(e,t,n,r){if(!r||e==null||t==null||n==null||n<=0)return`—`;let i=t-n;return e<=0||i<=0?`—`:`${Math.round(e/(i/1e3)).toLocaleString()} tok/s`}function Q({label:e,value:t}){return(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium truncate`,children:e}),(0,h.jsx)(`div`,{className:`mt-0.5 text-[13px] font-semibold text-sand-800 tabular-nums truncate`,children:t})]})}function Fn(e){if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e.inputImages;return Array.isArray(t)?t:void 0}function In(e){return(Fn(e)??[]).filter(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.url==`string`&&t.url.length>0||typeof t.data==`string`&&t.data.length>0})}function Ln(e){if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e,n=Fn(t);return n?{...t,inputImages:n.map(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e,n=typeof t.url==`string`&&t.url.toLowerCase().startsWith(`data:`)?`[data-url ${t.url.length} chars]`:t.url;return{mediaType:t.mediaType,byteSize:t.byteSize,...n?{url:n}:{},...t.data?{data:`[base64 ${t.data.length} chars]`}:{}}})}:e}function Rn({images:e}){let t=e.map((e,t)=>{let n=e.url&&!e.url.startsWith(`[`)?e.url:void 0,r=e.data?`data:${e.mediaType??`image/png`};base64,${e.data}`:``,i=n??r;return i?{image:e,index:t,src:i}:null}).filter(e=>e!==null);return t.length===0?null:(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Input Images`}),(0,h.jsx)(`div`,{className:`mt-1 grid grid-cols-1 sm:grid-cols-2 gap-2`,children:t.map(({image:e,index:t,src:n})=>(0,h.jsxs)(`div`,{className:`rounded-md border border-sand-200 bg-white overflow-hidden`,children:[(0,h.jsx)(`img`,{src:n,alt:`reference ${t+1}`,className:`max-h-64 w-full object-contain bg-white`,loading:`lazy`}),(0,h.jsxs)(`div`,{className:`px-2 py-1 text-[10px] text-sand-500 font-mono border-t border-sand-100`,children:[e.mediaType??`image`,` ·`,` `,e.byteSize===void 0?`url`:`${e.byteSize.toLocaleString()} bytes`]})]},`${e.mediaType??`image`}-${t}`))})]})}function zn({stepId:e}){let{data:t}=i.useRequestLogStep(`I`,e??0,{enabled:e!==null});return(0,h.jsx)(Rn,{images:In(t?xn(t.tool_args):null)})}function Bn({entry:e}){let t=!!e.error,[n,r]=(0,m.useState)(!1),{data:a}=i.useRequestLogStep(`A`,e.id,{enabled:n}),o=Ln(a?xn(a.tool_args):null),s=a?xn(a.tool_result):null,c=a?.error??e.error;return(0,h.jsxs)(`details`,{className:`group/tool`,onToggle:e=>r(e.currentTarget.open),children:[(0,h.jsxs)(`summary`,{className:`flex items-center gap-2 px-3 py-2 cursor-pointer select-none list-none hover:bg-sand-50 transition-colors rounded-md`,children:[(0,h.jsx)(q,{className:`size-3 text-sand-400 transition-transform group-open/tool:rotate-0 -rotate-90 shrink-0`}),(0,h.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sand-100 text-sand-500 font-mono shrink-0`,children:[`call `,e.callIndex+1]}),(0,h.jsx)(`span`,{className:`text-[13px] font-medium text-sand-800 font-mono truncate`,children:e.toolName}),t&&(0,h.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-red-100 text-red-600 font-medium uppercase shrink-0`,children:`error`}),(0,h.jsx)(`span`,{className:`ml-auto text-[11px] text-sand-400 tabular-nums shrink-0`,children:An(e.durationMs)})]}),n&&(0,h.jsxs)(`div`,{className:`mt-1 mx-1 mb-3 space-y-2`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Request`}),(0,h.jsx)(`div`,{className:`mt-1 rounded-md bg-sand-50 p-3 overflow-auto`,children:(0,h.jsx)(Y,{text:a?JSON.stringify(o):`Loading...`})})]}),c&&(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-red-500 font-medium px-2`,children:`Error`}),(0,h.jsx)(`div`,{className:`mt-1 rounded-md bg-red-50 border border-red-100 p-3 overflow-auto`,children:(0,h.jsx)(Y,{text:c})})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Response`}),(0,h.jsx)(`div`,{className:`mt-1 rounded-md bg-sand-50 p-3 overflow-auto`,children:(0,h.jsx)(Y,{text:a?typeof s==`string`?s:JSON.stringify(s):`Loading...`,markdown:!0})})]})]})]})}function Vn({stepId:e}){let[t,n]=(0,m.useState)(!1),{data:r}=i.useRequestLogStep(`A`,e,{enabled:t}),a=r?.reasoning_text??null;return(0,h.jsxs)(`details`,{className:`group/reason mt-3`,onToggle:e=>n(e.currentTarget.open),children:[(0,h.jsxs)(`summary`,{className:`flex items-center gap-2 cursor-pointer select-none list-none`,children:[(0,h.jsx)(q,{className:`size-3 text-sand-400 transition-transform group-open/reason:rotate-0 -rotate-90 shrink-0`}),(0,h.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Reasoning`})]}),t&&(0,h.jsx)(`div`,{className:`mt-2 rounded-md bg-white/70 border border-sand-100 p-3 overflow-auto`,children:a?(0,h.jsx)(Y,{text:a,markdown:!0}):r?(0,h.jsx)(`p`,{className:`text-sm text-sand-400`,children:`No reasoning text captured.`}):(0,h.jsx)(`p`,{className:`text-sm text-sand-400`,children:`Loading...`})})]})}function Hn({entry:e,tokensPerSecEnabled:t}){let n=e.generate,r=n!==null&&n.reasoningTokens!==null&&n.reasoningTokens!==void 0&&n.reasoningTokens>0,i=e.toolCalls.filter(e=>e.error).length;return(0,h.jsxs)(`details`,{open:!0,className:`group/step border-l border-sand-200 pl-3`,children:[(0,h.jsxs)(`summary`,{className:`flex items-center gap-2 py-2 cursor-pointer select-none list-none`,children:[(0,h.jsx)(q,{className:`size-3.5 text-sand-400 transition-transform group-open/step:rotate-0 -rotate-90 shrink-0`}),(0,h.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sienna-100 text-sienna-700 font-mono shrink-0`,children:[`step `,e.stepIndex+1]}),(0,h.jsx)(`span`,{className:`text-[13px] font-semibold text-sand-900`,children:`LLM call`}),n?.finishReason&&(0,h.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sand-100 text-sand-500 font-mono shrink-0`,children:n.finishReason}),n&&(n.fallbackCount??0)>0&&(0,h.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase shrink-0`,children:[n.requestedModelName,` → `,n.modelName]}),r&&(0,h.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-blue-100 text-blue-600 font-medium shrink-0`,children:`reasoning`}),i>0&&(0,h.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-red-100 text-red-600 font-medium uppercase shrink-0`,children:[i,` error`]}),(0,h.jsxs)(`span`,{className:`ml-auto text-[11px] text-sand-400 tabular-nums shrink-0`,children:[e.toolCalls.length,` tools`]})]}),(0,h.jsxs)(`div`,{className:`ml-4 mb-4 space-y-3`,children:[n&&(0,h.jsxs)(`div`,{className:`rounded-md border border-sand-100 bg-sand-50/70 p-3`,children:[(0,h.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-8 gap-x-4 gap-y-3`,children:[(0,h.jsx)(Q,{label:`Duration`,value:An(n.durationMs)}),(0,h.jsx)(Q,{label:`TTFT`,value:jn(n.ttftMs)}),(0,h.jsx)(Q,{label:`Tokens/sec`,value:Pn(n.outputTokens,n.durationMs,n.ttftMs,t)}),(0,h.jsx)(Q,{label:`Input`,value:J(n.inputTokens??0)}),(0,h.jsx)(Q,{label:`Output`,value:J(n.outputTokens??0)}),(0,h.jsx)(Q,{label:`Cache Read`,value:J(n.cacheReadTokens??0)}),(0,h.jsx)(Q,{label:`Cache Write`,value:J(n.cacheCreationTokens??0)}),(0,h.jsx)(Q,{label:`Cache 5m / 1h`,value:`${n.cacheCreation5mTokens===null?`—`:J(n.cacheCreation5mTokens)} / ${n.cacheCreation1hTokens===null?`—`:J(n.cacheCreation1hTokens)}`}),(0,h.jsx)(Q,{label:`Cost`,value:n.costUsd===null?`—`:u(n.costUsd)}),(0,h.jsx)(Q,{label:`Cost Source`,value:n.costSource??`legacy`}),(0,h.jsx)(Q,{label:`Reasoning`,value:n.reasoningTokens!==null&&n.reasoningTokens!==void 0?J(n.reasoningTokens):`—`})]}),r&&(0,h.jsx)(Vn,{stepId:n.id})]}),e.toolCalls.length>0&&(0,h.jsx)(`div`,{className:`space-y-0.5`,children:e.toolCalls.map(e=>(0,h.jsx)(Bn,{entry:e},`${e.stepIndex}-${e.callIndex}-${e.toolCallId}`))})]})]})}function Un({steps:e,tokensPerSecEnabled:t}){let n=e.reduce((e,t)=>e+t.toolCalls.length,0);return(0,h.jsx)(X,{title:`Steps (${e.length} steps · ${n} tool calls)`,defaultOpen:!0,children:(0,h.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>(0,h.jsx)(Hn,{entry:e,tokensPerSecEnabled:t},e.stepIndex))})})}function Wn(e){let t=new Map;function n(e){let n=t.get(e);if(n)return n;let r={stepIndex:e,generate:null,toolCalls:[]};return t.set(e,r),r}for(let t of e){let e=n(t.step_index);if(t.type===`generate`){e.generate={id:t.id,stepIndex:t.step_index,modelName:t.model_name,requestedModelName:t.requested_model_name,fallbackCount:t.fallback_count,inputTokens:t.input_tokens,outputTokens:t.output_tokens,cacheReadTokens:t.cache_read_tokens,cacheCreationTokens:t.cache_creation_tokens,cacheCreation5mTokens:t.cache_creation_5m_tokens,cacheCreation1hTokens:t.cache_creation_1h_tokens,costUsd:t.cost_usd,costSource:t.cost_source,durationMs:t.duration_ms,ttftMs:t.ttft_ms,finishReason:t.finish_reason,reasoningTokens:t.reasoning_tokens};continue}t.type===`tool_call`&&e.toolCalls.push({id:t.id,stepIndex:t.step_index,callIndex:t.tool_call_index??e.toolCalls.length,toolCallId:t.tool_call_id??``,toolName:t.tool_name??``,durationMs:t.tool_duration_ms??0,error:t.error})}return[...t.values()].map(e=>({...e,toolCalls:e.toolCalls.toSorted((e,t)=>e.callIndex-t.callIndex)})).toSorted((e,t)=>e.stepIndex-t.stepIndex)}function Gn(e){return e.type===`function_call`||e.type===`function_call_output`?`bg-caution-400/10`:e.role===`assistant`?`bg-sage-50`:`bg-sand-50`}function Kn(e){return e.type===`function_call`?`fn: ${e.name??`unknown`}`:e.type===`function_call_output`?`fn result`:e.role??e.type}function qn(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>typeof e==`object`&&e&&`text`in e?e.text:JSON.stringify(e)).join(`
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{l as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,r}from"./vendor-react-DH4kUfK2.js";import{i,r as a}from"./services.generated-jGypfumC.js";import{c as o,l as s,o as c,t as l}from"./index-C0594sjh.js";import{n as u,t as d}from"./cost-CpjVoAqp.js";function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f.apply(null,arguments)}function p(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var m=e(n()),h=r(),g={},_=(0,m.createContext)(g),v=(e,t)=>f({},e,t),y=()=>(0,m.useContext)(_),b=(0,m.createContext)(()=>{});b.displayName=`JVR.DispatchShowTools`;function x(){return(0,m.useReducer)(v,g)}function S(){return(0,m.useContext)(b)}var C=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,h.jsx)(_.Provider,{value:t,children:(0,h.jsx)(b.Provider,{value:n,children:r})})};C.displayName=`JVR.ShowTools`;var w={},T=(0,m.createContext)(w),E=(e,t)=>f({},e,t),D=()=>(0,m.useContext)(T),O=(0,m.createContext)(()=>{});O.displayName=`JVR.DispatchExpands`;function ee(){return(0,m.useReducer)(E,w)}function te(){return(0,m.useContext)(O)}var ne=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,h.jsx)(T.Provider,{value:t,children:(0,h.jsx)(O.Provider,{value:n,children:r})})};ne.displayName=`JVR.Expands`;var re={Str:{as:`span`,"data-type":`string`,style:{color:`var(--w-rjv-type-string-color, #cb4b16)`},className:`w-rjv-type`,children:`string`},Url:{as:`a`,style:{color:`var(--w-rjv-type-url-color, #0969da)`},"data-type":`url`,className:`w-rjv-type`,children:`url`},Undefined:{style:{color:`var(--w-rjv-type-undefined-color, #586e75)`},as:`span`,"data-type":`undefined`,className:`w-rjv-type`,children:`undefined`},Null:{style:{color:`var(--w-rjv-type-null-color, #d33682)`},as:`span`,"data-type":`null`,className:`w-rjv-type`,children:`null`},Map:{style:{color:`var(--w-rjv-type-map-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`map`,className:`w-rjv-type`,children:`Map`},Nan:{style:{color:`var(--w-rjv-type-nan-color, #859900)`},as:`span`,"data-type":`nan`,className:`w-rjv-type`,children:`NaN`},Bigint:{style:{color:`var(--w-rjv-type-bigint-color, #268bd2)`},as:`span`,"data-type":`bigint`,className:`w-rjv-type`,children:`bigint`},Int:{style:{color:`var(--w-rjv-type-int-color, #268bd2)`},as:`span`,"data-type":`int`,className:`w-rjv-type`,children:`int`},Set:{style:{color:`var(--w-rjv-type-set-color, #268bd2)`,marginRight:3},as:`span`,"data-type":`set`,className:`w-rjv-type`,children:`Set`},Float:{style:{color:`var(--w-rjv-type-float-color, #859900)`},as:`span`,"data-type":`float`,className:`w-rjv-type`,children:`float`},True:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},False:{style:{color:`var(--w-rjv-type-boolean-color, #2aa198)`},as:`span`,"data-type":`bool`,className:`w-rjv-type`,children:`bool`},Date:{style:{color:`var(--w-rjv-type-date-color, #268bd2)`},as:`span`,"data-type":`date`,className:`w-rjv-type`,children:`date`}},ie=(0,m.createContext)(re),ae=(e,t)=>f({},e,t),k=()=>(0,m.useContext)(ie),oe=(0,m.createContext)(()=>{});oe.displayName=`JVR.DispatchTypes`;function se(){return(0,m.useReducer)(ae,re)}function ce(){return(0,m.useContext)(oe)}function le(e){var{initial:t,dispatch:n,children:r}=e;return(0,h.jsx)(ie.Provider,{value:t,children:(0,h.jsx)(oe.Provider,{value:n,children:r})})}le.displayName=`JVR.Types`;var ue=[`style`];function de(e){var{style:t}=e,n=p(e,ue);return(0,h.jsx)(`svg`,f({viewBox:`0 0 24 24`,fill:`var(--w-rjv-arrow-color, currentColor)`,style:f({cursor:`pointer`,height:`1em`,width:`1em`,userSelect:`none`,display:`inline-flex`},t)},n,{children:(0,h.jsx)(`path`,{d:`M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z`})}))}de.displayName=`JVR.TriangleArrow`;var fe={Arrow:{as:`span`,className:`w-rjv-arrow`,style:{transform:`rotate(0deg)`,transition:`all 0.3s`},children:(0,h.jsx)(de,{})},Colon:{as:`span`,style:{color:`var(--w-rjv-colon-color, var(--w-rjv-color))`,marginLeft:0,marginRight:2},className:`w-rjv-colon`,children:`:`},Quote:{as:`span`,style:{color:`var(--w-rjv-quotes-color, #236a7c)`},className:`w-rjv-quotes`,children:`"`},ValueQuote:{as:`span`,style:{color:`var(--w-rjv-quotes-string-color, #cb4b16)`},className:`w-rjv-quotes`,children:`"`},BracketsLeft:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-start`,children:`[`},BracketsRight:{as:`span`,style:{color:`var(--w-rjv-brackets-color, #236a7c)`},className:`w-rjv-brackets-end`,children:`]`},BraceLeft:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-start`,children:`{`},BraceRight:{as:`span`,style:{color:`var(--w-rjv-curlybraces-color, #236a7c)`},className:`w-rjv-curlybraces-end`,children:`}`}},pe=(0,m.createContext)(fe),me=(e,t)=>f({},e,t),A=()=>(0,m.useContext)(pe),j=(0,m.createContext)(()=>{});j.displayName=`JVR.DispatchSymbols`;function he(){return(0,m.useReducer)(me,fe)}function ge(){return(0,m.useContext)(j)}var _e=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,h.jsx)(pe.Provider,{value:t,children:(0,h.jsx)(j.Provider,{value:n,children:r})})};_e.displayName=`JVR.Symbols`;var ve={Copied:{className:`w-rjv-copied`,style:{height:`1em`,width:`1em`,cursor:`pointer`,verticalAlign:`middle`,marginLeft:5}},CountInfo:{as:`span`,className:`w-rjv-object-size`,style:{color:`var(--w-rjv-info-color, #0000004d)`,paddingLeft:8,fontStyle:`italic`}},CountInfoExtra:{as:`span`,className:`w-rjv-object-extra`,style:{paddingLeft:8}},Ellipsis:{as:`span`,style:{cursor:`pointer`,color:`var(--w-rjv-ellipsis-color, #cb4b16)`,userSelect:`none`},className:`w-rjv-ellipsis`,children:`...`},Row:{as:`div`,className:`w-rjv-line`},KeyName:{as:`span`,className:`w-rjv-object-key`}},ye=(0,m.createContext)(ve),be=(e,t)=>f({},e,t),M=()=>(0,m.useContext)(ye),N=(0,m.createContext)(()=>{});N.displayName=`JVR.DispatchSection`;function xe(){return(0,m.useReducer)(be,ve)}function Se(){return(0,m.useContext)(N)}var Ce=e=>{var{initial:t,dispatch:n,children:r}=e;return(0,h.jsx)(ye.Provider,{value:t,children:(0,h.jsx)(N.Provider,{value:n,children:r})})};Ce.displayName=`JVR.Section`;var we={objectSortKeys:!1,indentWidth:15},P=(0,m.createContext)(we);P.displayName=`JVR.Context`;var Te=(0,m.createContext)(()=>{});Te.displayName=`JVR.DispatchContext`;function Ee(e,t){return f({},e,t)}var F=()=>(0,m.useContext)(P),De=e=>{var{children:t,initialState:n,initialTypes:r}=e,[i,a]=(0,m.useReducer)(Ee,Object.assign({},we,n)),[o,s]=x(),[c,l]=ee(),[u,d]=se(),[p,g]=he(),[_,v]=xe();return(0,m.useEffect)(()=>a(f({},n)),[n]),(0,h.jsx)(P.Provider,{value:i,children:(0,h.jsx)(Te.Provider,{value:a,children:(0,h.jsx)(C,{initial:o,dispatch:s,children:(0,h.jsx)(ne,{initial:c,dispatch:l,children:(0,h.jsx)(le,{initial:f({},u,r),dispatch:d,children:(0,h.jsx)(_e,{initial:p,dispatch:g,children:(0,h.jsx)(Ce,{initial:_,dispatch:v,children:t})})})})})})})};De.displayName=`JVR.Provider`;function Oe(e){if(e==null)throw TypeError(`Cannot destructure `+e)}var ke=[`isNumber`,`value`,`parentValue`,`keyName`,`keys`],Ae=[`as`,`render`],je=[`as`,`render`],Me=[`as`,`render`],Ne=[`as`,`style`,`render`],Pe=[`as`,`render`],Fe=[`as`,`render`],Ie=[`as`,`render`],Le=[`as`,`render`],I=e=>{var{Quote:t={}}=A(),{isNumber:n,value:r,parentValue:i,keyName:a,keys:o}=e,s=p(e,ke);if(n)return null;var{as:c,render:l}=t,u=p(t,Ae),d=c||`span`,m=f({},s,u);return typeof m.children==`string`&&(m.children=m.children.trim()||void 0),l&&typeof l==`function`&&l(m,{value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])})||(0,h.jsx)(d,f({},m))};I.displayName=`JVR.Quote`;var L=e=>{var{ValueQuote:t={}}=A(),n=f({},(Oe(e),e)),{as:r,render:i}=t,a=p(t,je),o=r||`span`,s=f({},n,a);return i&&typeof i==`function`&&i(s,{})||(0,h.jsx)(o,f({},s))};L.displayName=`JVR.ValueQuote`;var Re=e=>{var{value:t,parentValue:n,keyName:r,keys:i}=e,{Colon:a={}}=A(),{as:o,render:s}=a,c=p(a,Me),l=o||`span`;return s&&typeof s==`function`&&s(c,{value:t,parentValue:n,keyName:r,keys:i||(r?[r]:[])})||(0,h.jsx)(l,f({},c))};Re.displayName=`JVR.Colon`;var ze=e=>{var{Arrow:t={}}=A(),n=D(),{expandKey:r,style:i,value:a,parentValue:o,keyName:s,keys:c}=e,l=!!n[r],{as:u,style:d,render:m}=t,g=p(t,Ne),_=u||`span`,v=m&&typeof m==`function`,y=f({},g,{"data-expanded":l,style:f({},d,i)});return v&&m(y,{value:a,parentValue:o,keyName:s,keys:c||(s?[s]:[])})||(0,h.jsx)(_,f({},g,{style:f({},d,i)}))};ze.displayName=`JVR.Arrow`;var Be=e=>{var{isBrackets:t,value:n,parentValue:r,keyName:i,keys:a}=e,{BracketsLeft:o={},BraceLeft:s={}}=A(),c={value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])};if(t){var{as:l,render:u}=o,d=p(o,Pe),m=l||`span`;return u&&typeof u==`function`&&u(d,c)||(0,h.jsx)(m,f({},d))}var{as:g,render:_}=s,v=p(s,Fe),y=g||`span`;return _&&typeof _==`function`&&_(v,c)||(0,h.jsx)(y,f({},v))};Be.displayName=`JVR.BracketsOpen`;var R=e=>{var{isBrackets:t,isVisiable:n,value:r,parentValue:i,keyName:a,keys:o}=e,s={value:r,parentValue:i,keyName:a,keys:o||(a?[a]:[])};if(!n)return null;var{BracketsRight:c={},BraceRight:l={}}=A();if(t){var{as:u,render:d}=c,m=p(c,Ie),g=u||`span`;return d&&typeof d==`function`&&d(m,s)||(0,h.jsx)(g,f({},m))}var{as:_,render:v}=l,y=p(l,Le),b=_||`span`;return v&&typeof v==`function`&&v(y,s)||(0,h.jsx)(b,f({},y))};R.displayName=`JVR.BracketsClose`;var Ve=e=>{var{keyName:t,value:n,expandKey:r,parentValue:i,level:a,keys:o=[]}=e,s=D(),{collapsed:c,shouldExpandNodeInitially:l}=F(),u=typeof c==`boolean`?c:typeof c==`number`?a>c:!1,d=s[r]??(l?!1:u),p=l&&l(!d,{value:n,keys:o,level:a,keyName:t,parentValue:i});if(l&&c===!1){if(s[r]===void 0&&!p)return null}else if(s[r]===void 0&&p)return null;var m=Object.keys(n).length;if(d||m===0)return null;var g={paddingLeft:4},_={keyName:t,value:n,keys:o,parentValue:i},v=Array.isArray(n),y=n instanceof Set;return(0,h.jsx)(`div`,{style:g,children:(0,h.jsx)(R,f({isBrackets:v||y},_,{isVisiable:!0}))})};Ve.displayName=`JVR.NestedClose`;var He=[`as`,`render`],Ue=[`as`,`render`],We=[`as`,`render`],Ge=[`as`,`render`],Ke=[`as`,`render`],qe=[`as`,`render`],Je=[`as`,`render`],Ye=[`as`,`render`],Xe=[`as`,`render`],Ze=[`as`,`render`],Qe=[`as`,`render`],$e=[`as`,`render`],et=[`as`,`render`],z=e=>{if(e===void 0)return`0n`;if(typeof e==`string`)try{e=BigInt(e)}catch{return`0n`}return e?e.toString()+`n`:`0n`},tt=e=>{var{value:t,keyName:n}=e,{Set:r={},displayDataTypes:i}=k();if(!(t instanceof Set)||!i)return null;var{as:a,render:o}=r,s=p(r,He);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,h.jsx)(a||`span`,f({},s))};tt.displayName=`JVR.SetComp`;var nt=e=>{var{value:t,keyName:n}=e,{Map:r={},displayDataTypes:i}=k();if(!(t instanceof Map)||!i)return null;var{as:a,render:o}=r,s=p(r,Ue);return o&&typeof o==`function`&&o(s,{type:`type`,value:t,keyName:n})||(0,h.jsx)(a||`span`,f({},s))};nt.displayName=`JVR.MapComp`;var B={opacity:.75,paddingRight:4},rt=e=>{var{children:t=``,keyName:n,keys:r}=e,{Str:i={},displayDataTypes:a}=k(),{shortenTextAfterLength:o=30,stringEllipsis:s=`...`}=F(),{as:c,render:l}=i,u=p(i,We),d=t,[g,_]=(0,m.useState)(o&&d.length>o);(0,m.useEffect)(()=>_(o&&d.length>o),[o]);var v=c||`span`,y=f({},B,i.style||{});o>0&&(u.style=f({},u.style,{cursor:d.length<=o?`initial`:`pointer`}),d.length>o&&(u.onClick=()=>{_(!g)}));var b=g?``+d.slice(0,o)+s:d,x=l&&typeof l==`function`,S=x&&l(f({},u,{style:y}),{type:`type`,value:t,keyName:n,keys:r}),C=g?`w-rjv-value w-rjv-value-short`:`w-rjv-value`,w=x&&l(f({},u,{children:b,className:C}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(S||(0,h.jsx)(v,f({},u,{style:y}))),w||(0,h.jsxs)(m.Fragment,{children:[(0,h.jsx)(L,{}),(0,h.jsx)(v,f({},u,{className:C,children:b})),(0,h.jsx)(L,{})]})]})};rt.displayName=`JVR.TypeString`;var it=e=>{var{children:t,keyName:n,keys:r}=e,{True:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,Ge),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_||(0,h.jsx)(l,f({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};it.displayName=`JVR.TypeTrue`;var at=e=>{var{children:t,keyName:n,keys:r}=e,{False:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,Ke),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_||(0,h.jsx)(l,f({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};at.displayName=`JVR.TypeFalse`;var ot=e=>{var{children:t,keyName:n,keys:r}=e,{Float:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,qe),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_||(0,h.jsx)(l,f({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};ot.displayName=`JVR.TypeFloat`;var st=e=>{var{children:t,keyName:n,keys:r}=e,{Int:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,Je),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_||(0,h.jsx)(l,f({},c,{className:`w-rjv-value`,children:t?.toString()}))]})};st.displayName=`JVR.TypeInt`;var ct=e=>{var{children:t,keyName:n,keys:r}=e,{Bigint:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,Ye),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_||(0,h.jsx)(l,f({},c,{className:`w-rjv-value`,children:z(t?.toString())}))]})};ct.displayName=`JVR.TypeFloat`;var lt=e=>{var{children:t,keyName:n,keys:r}=e,{Url:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,Xe),l=o||`span`,u=f({},B,i.style),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t?.href,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_||(0,h.jsxs)(`a`,f({href:t?.href,target:`_blank`},c,{className:`w-rjv-value`,children:[(0,h.jsx)(L,{}),t?.href,(0,h.jsx)(L,{})]}))]})};lt.displayName=`JVR.TypeUrl`;var ut=e=>{var{children:t,keyName:n,keys:r}=e,{Date:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,Ze),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=t instanceof Date?t.toLocaleString():t,v=d&&s(f({},c,{children:_,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),v||(0,h.jsx)(l,f({},c,{className:`w-rjv-value`,children:_}))]})};ut.displayName=`JVR.TypeDate`;var dt=e=>{var{children:t,keyName:n,keys:r}=e,{Undefined:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,Qe),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_]})};dt.displayName=`JVR.TypeUndefined`;var ft=e=>{var{children:t,keyName:n,keys:r}=e,{Null:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,$e),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t,className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_]})};ft.displayName=`JVR.TypeNull`;var pt=e=>{var{children:t,keyName:n,keys:r}=e,{Nan:i={},displayDataTypes:a}=k(),{as:o,render:s}=i,c=p(i,et),l=o||`span`,u=f({},B,i.style||{}),d=s&&typeof s==`function`,g=d&&s(f({},c,{style:u}),{type:`type`,value:t,keyName:n,keys:r}),_=d&&s(f({},c,{children:t?.toString(),className:`w-rjv-value`}),{type:`value`,value:t,keyName:n,keys:r});return(0,h.jsxs)(m.Fragment,{children:[a&&(g||(0,h.jsx)(l,f({},c,{style:u}))),_]})};pt.displayName=`JVR.TypeNan`;var mt=e=>Number(e)===e&&e%1!=0||isNaN(e),ht=e=>{var{value:t,keyName:n,keys:r}=e,i={keyName:n,keys:r};return t instanceof URL?(0,h.jsx)(lt,f({},i,{children:t})):typeof t==`string`?(0,h.jsx)(rt,f({},i,{children:t})):t===!0?(0,h.jsx)(it,f({},i,{children:t})):t===!1?(0,h.jsx)(at,f({},i,{children:t})):t===null?(0,h.jsx)(ft,f({},i,{children:t})):t===void 0?(0,h.jsx)(dt,f({},i,{children:t})):t instanceof Date?(0,h.jsx)(ut,f({},i,{children:t})):typeof t==`number`&&isNaN(t)?(0,h.jsx)(pt,f({},i,{children:t})):typeof t==`number`&&mt(t)?(0,h.jsx)(ot,f({},i,{children:t})):typeof t==`bigint`?(0,h.jsx)(ct,f({},i,{children:t})):typeof t==`number`?(0,h.jsx)(st,f({},i,{children:t})):null};ht.displayName=`JVR.Value`;function V(e,t,n){var r=ge(),i=f({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:f({},e.style,t.style),children:t.children||e.children});(0,m.useEffect)(()=>r({[n]:i}),[t])}function H(e,t,n){var r=ce(),i=f({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:f({},e.style,t.style),children:t.children||e.children});(0,m.useEffect)(()=>r({[n]:i}),[t])}function U(e,t,n){var r=Se(),i=f({},e,t,{className:[e.className,t.className].filter(Boolean).join(` `),style:f({},e.style,t.style),children:t.children||e.children});(0,m.useEffect)(()=>r({[n]:i}),[t])}var gt=[`as`,`render`],_t=e=>{var{KeyName:t={}}=M();return U(t,e,`KeyName`),null};_t.displayName=`JVR.KeyName`;var vt=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o={color:typeof t==`number`?`var(--w-rjv-key-number, #268bd2)`:`var(--w-rjv-key-string, #002b36)`},{KeyName:s={}}=M(),{as:c,render:l}=s,u=p(s,gt);u.style=f({},u.style,o);var d=c||`span`;return l&&typeof l==`function`&&l(f({},u,{children:t}),{value:n,parentValue:r,keyName:i,keys:a||(i?[i]:[])})||(0,h.jsx)(d,f({},u,{children:t}))};vt.displayName=`JVR.KeyNameComp`;var yt=[`children`,`value`,`parentValue`,`keyName`,`keys`],bt=[`as`,`render`,`children`],xt=e=>{var{Row:t={}}=M();return U(t,e,`Row`),null};xt.displayName=`JVR.Row`;var St=e=>{var{children:t,value:n,parentValue:r,keyName:i,keys:a}=e,o=p(e,yt),{Row:s={}}=M(),{as:c,render:l}=s,u=p(s,bt),d=c||`div`;return l&&typeof l==`function`&&l(f({},o,u,{children:t}),{value:n,keyName:i,parentValue:r,keys:a})||(0,h.jsx)(d,f({},o,u,{children:t}))};St.displayName=`JVR.RowComp`;function Ct(e){var t=(0,m.useRef)();return(0,m.useEffect)(()=>{t.current=e}),t.current}function wt(e){var{value:t,highlightUpdates:n,highlightContainer:r}=e,i=Ct(t),a=(0,m.useMemo)(()=>{if(!n||i===void 0)return!1;if(typeof t!=typeof i)return!0;if(typeof t==`number`)return isNaN(t)&&isNaN(i)?!1:t!==i;if(Array.isArray(t)!==Array.isArray(i))return!0;if(typeof t==`object`||typeof t==`function`)return!1;if(t!==i)return!0},[n,t]);(0,m.useEffect)(()=>{r&&r.current&&a&&`animate`in r.current&&r.current.animate([{backgroundColor:`var(--w-rjv-update-color, #ebcb8b)`},{backgroundColor:``}],{duration:1e3,easing:`ease-in`})},[a,t,r])}var Tt=[`keyName`,`value`,`parentValue`,`expandKey`,`keys`,`beforeCopy`],Et=[`as`,`render`],W=e=>{var{keyName:t,value:n,parentValue:r,expandKey:i,keys:a,beforeCopy:o}=e,s=p(e,Tt),{onCopied:c,enableClipboard:l,beforeCopy:u}=F(),d=y()[i],[g,_]=(0,m.useState)(!1),{Copied:v={}}=M(),b=v?.beforeCopy;if(l===!1||!d)return null;var x={style:{display:`inline-flex`},fill:g?`var(--w-rjv-copied-success-color, #28a745)`:`var(--w-rjv-copied-color, currentColor)`,onClick:e=>{e.stopPropagation();var s=``;s=typeof n==`number`&&n===1/0?`Infinity`:typeof n==`number`&&isNaN(n)?`NaN`:typeof n==`bigint`?z(n):n instanceof Date?n.toLocaleString():JSON.stringify(n,(e,t)=>typeof t==`bigint`?z(t):t,2);var l=o||b||u;l&&typeof l==`function`&&(s=l(s,t,n,r,i,a)),c&&c(s,n),_(!0),(navigator.clipboard||{writeText(e){return new Promise((t,n)=>{var r=document.createElement(`textarea`);r.style.position=`absolute`,r.style.opacity=`0`,r.style.left=`-99999999px`,r.value=e,document.body.appendChild(r),r.select(),document.execCommand(`copy`)?t():n(),r.remove()})}}).writeText(s).then(()=>{var e=setTimeout(()=>{_(!1),clearTimeout(e)},3e3)}).catch(e=>{})}},{render:S}=v,C=p(v,Et),w=f({},C,s,x,{style:f({},C.style,s.style,x.style)});return S&&typeof S==`function`&&S(f({},w,{"data-copied":g}),{value:n,keyName:t,keys:a,parentValue:r})||(g?(0,h.jsx)(`svg`,f({viewBox:`0 0 32 36`},w,{children:(0,h.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,15.2249049 C29.1403264,13.8627542 29.9736597,13.1778155 30,13.1700887 C30,11.9705278 30,10.0804982 30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,26.1114493 L27.5,28.4926435 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M28.5589286,16 L32,19.6 L21.0160714,30.5382252 L13.5303571,24.2571429 L17.1303571,20.6571429 L21.0160714,24.5428571 L28.5589286,16 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})):(0,h.jsx)(`svg`,f({viewBox:`0 0 32 36`},w,{children:(0,h.jsx)(`path`,{d:`M27.5,33 L2.5,33 L2.5,12.5 L27.5,12.5 L27.5,20 L30,20 L30,7.5 C30,6.1 28.9,5 27.5,5 L20,5 C20,2.2 17.8,0 15,0 C12.2,0 10,2.2 10,5 L2.5,5 C1.1,5 0,6.1 0,7.5 L0,33 C0,34.4 1.1,36 2.5,36 L27.5,36 C28.9,36 30,34.4 30,33 L30,29 L27.5,29 L27.5,33 Z M7.5,7.5 L10,7.5 C10,7.5 12.5,6.4 12.5,5 C12.5,3.6 13.6,2.5 15,2.5 C16.4,2.5 17.5,3.6 17.5,5 C17.5,6.4 18.8,7.5 20,7.5 L22.5,7.5 C22.5,7.5 25,8.6 25,10 L5,10 C5,8.5 6.1,7.5 7.5,7.5 Z M5,27.5 L10,27.5 L10,25 L5,25 L5,27.5 Z M22.5,21.5 L22.5,16.5 L12.5,24 L22.5,31.5 L22.5,26.5 L32,26.5 L32,21.5 L22.5,21.5 Z M17.5,15 L5,15 L5,17.5 L17.5,17.5 L17.5,15 Z M10,20 L5,20 L5,22.5 L10,22.5 L10,20 Z`})})))};W.displayName=`JVR.Copied`;function Dt(){var e=(0,m.useRef)(null);return e.current===null&&(e.current=`custom-id-`+Math.random().toString(36).substr(2,9)),e.current}var Ot=e=>{var{keyName:t,value:n,expandKey:r=``,level:i,keys:a=[],parentValue:o}=e,s=D(),{objectSortKeys:c,indentWidth:l,collapsed:u,shouldExpandNodeInitially:d}=F(),f=typeof u==`boolean`?u:typeof u==`number`?i>u:!1,p=s[r]??(d?!1:f),m=d&&d(!p,{value:n,keys:a,level:i,keyName:t,parentValue:o});if(d&&u===!1){if(s[r]===void 0&&!m)return null}else if(s[r]===void 0&&m)return null;if(p)return null;var g=Array.isArray(n)?Object.entries(n).map(e=>[Number(e[0]),e[1]]):Object.entries(n);return c&&(g=c===!0?g.sort((e,t)=>{var[n]=e,[r]=t;return typeof n==`string`&&typeof r==`string`?n.localeCompare(r):0}):g.sort((e,t)=>{var[n,r]=e,[i,a]=t;return typeof n==`string`&&typeof i==`string`?c(n,i,r,a):0})),(0,h.jsx)(`div`,{className:`w-rjv-wrap`,style:{borderLeft:`var(--w-rjv-border-left-width, 1px) var(--w-rjv-line-style, solid) var(--w-rjv-line-color, #ebebeb)`,paddingLeft:l,marginLeft:6},children:g.map((e,t)=>{var[r,o]=e;return(0,h.jsx)(kt,{parentValue:n,keyName:r,keys:[...a,r],value:o,level:i},t)})})};Ot.displayName=`JVR.KeyValues`;var G=e=>{var{keyName:t,parentValue:n,keys:r,value:i}=e,{highlightUpdates:a}=F(),o=typeof t==`number`,s=(0,m.useRef)(null);wt({value:i,highlightUpdates:a,highlightContainer:s});var c={keyName:t,value:i,keys:r,parentValue:n};return(0,h.jsxs)(m.Fragment,{children:[(0,h.jsxs)(`span`,{ref:s,children:[(0,h.jsx)(I,f({isNumber:o,"data-placement":`left`},c)),(0,h.jsx)(vt,f({},c,{children:t})),(0,h.jsx)(I,f({isNumber:o,"data-placement":`right`},c))]}),(0,h.jsx)(Re,f({},c))]})};G.displayName=`JVR.KayName`;var kt=e=>{var{keyName:t,value:n,parentValue:r,level:i=0,keys:a=[]}=e,o=S(),s=Dt(),c=Array.isArray(n),l=n instanceof Set,u=n instanceof Map,d=n instanceof Date,p=n instanceof URL;return n&&typeof n==`object`&&!c&&!l&&!u&&!d&&!p||c||l||u?(0,h.jsx)(Ut,{keyName:t,value:l?Array.from(n):u?Object.fromEntries(n):n,parentValue:r,initialValue:n,keys:a,level:i+1}):(0,h.jsxs)(St,f({className:`w-rjv-line`,value:n,keyName:t,keys:a,parentValue:r},{onMouseEnter:()=>o({[s]:!0}),onMouseLeave:()=>o({[s]:!1})},{children:[(0,h.jsx)(G,{keyName:t,value:n,keys:a,parentValue:r}),(0,h.jsx)(ht,{keyName:t,value:n,keys:a}),(0,h.jsx)(W,{keyName:t,value:n,keys:a,parentValue:r,expandKey:s})]}))};kt.displayName=`JVR.KeyValuesItem`;var At=[`value`,`keyName`],jt=[`as`,`render`],Mt=e=>{var{CountInfoExtra:t={}}=M();return U(t,e,`CountInfoExtra`),null};Mt.displayName=`JVR.CountInfoExtra`;var Nt=e=>{var{value:t={},keyName:n}=e,r=p(e,At),{CountInfoExtra:i={}}=M(),{as:a,render:o}=i,s=p(i,jt);if(!o&&!s.children)return null;var c=a||`span`,l=o&&typeof o==`function`,u=f({},s,r);return l&&o(u,{value:t,keyName:n})||(0,h.jsx)(c,f({},u))};Nt.displayName=`JVR.CountInfoExtraComps`;var Pt=[`value`,`keyName`],Ft=[`as`,`render`],It=e=>{var{CountInfo:t={}}=M();return U(t,e,`CountInfo`),null};It.displayName=`JVR.CountInfo`;var Lt=e=>{var{value:t={},keyName:n}=e,r=p(e,Pt),{displayObjectSize:i}=F(),{CountInfo:a={}}=M();if(!i)return null;var{as:o,render:s}=a,c=p(a,Ft),l=o||`span`;c.style=f({},c.style,e.style);var u=Object.keys(t).length;c.children||=u+` item`+(u===1?``:`s`);var d=f({},c,r);return s&&typeof s==`function`&&s(f({},d,{"data-length":u}),{value:t,keyName:n})||(0,h.jsx)(l,f({},d))};Lt.displayName=`JVR.CountInfoComp`;var Rt=[`as`,`render`],zt=e=>{var{Ellipsis:t={}}=M();return U(t,e,`Ellipsis`),null};zt.displayName=`JVR.Ellipsis`;var Bt=e=>{var{isExpanded:t,value:n,keyName:r}=e,{Ellipsis:i={}}=M(),{as:a,render:o}=i,s=p(i,Rt),c=a||`span`;return o&&typeof o==`function`&&o(f({},s,{"data-expanded":t}),{value:n,keyName:r})||(!t||typeof n==`object`&&Object.keys(n).length==0?null:(0,h.jsx)(c,f({},s)))};Bt.displayName=`JVR.EllipsisComp`;var Vt=e=>{var{keyName:t,expandKey:n,keys:r=[],initialValue:i,value:a,parentValue:o,level:s}=e,c=D(),l=te(),{onExpand:u,collapsed:d,shouldExpandNodeInitially:p}=F(),m=typeof d==`boolean`?d:typeof d==`number`?s>d:!1,g=c[n]??(p?!1:m),_=p&&p(!g,{value:a,keys:r,level:s,keyName:t,parentValue:o});c[n]===void 0&&p&&(g=!_);var v=()=>{var e={expand:!g,value:a,keyid:n,keyName:t};u&&u(e),l({[n]:e.expand})},y={display:`inline-flex`,alignItems:`center`},b={transform:`rotate(`+(g?`-90`:`0`)+`deg)`,transition:`all 0.3s`},x=Object.keys(a).length,S=typeof a==`object`,C=Array.isArray(a),w=a instanceof Set,T=x!==0&&(C||w||S),E={style:y};T&&(E.onClick=v);var O={keyName:t,value:a,keys:r,parentValue:o};return(0,h.jsxs)(`span`,f({},E,{children:[T&&(0,h.jsx)(ze,f({style:b,expandKey:n},O)),(t||typeof t==`number`)&&(0,h.jsx)(G,f({},O)),(0,h.jsx)(tt,{value:i,keyName:t}),(0,h.jsx)(nt,{value:i,keyName:t}),(0,h.jsx)(Be,f({isBrackets:C||w},O)),(0,h.jsx)(Bt,{keyName:t,value:a,isExpanded:g}),(0,h.jsx)(R,f({isVisiable:g||!T,isBrackets:C||w},O)),(0,h.jsx)(Lt,{value:a,keyName:t}),(0,h.jsx)(Nt,{value:a,keyName:t}),(0,h.jsx)(W,{keyName:t,value:a,expandKey:n,parentValue:o,keys:r})]}))};Vt.displayName=`JVR.NestedOpen`;var Ht=[`className`,`children`,`parentValue`,`keyid`,`level`,`value`,`initialValue`,`keys`,`keyName`],Ut=(0,m.forwardRef)((e,t)=>{var{className:n=``,parentValue:r,level:i=1,value:a,initialValue:o,keys:s,keyName:c}=e,l=p(e,Ht),u=S(),d=Dt();return(0,h.jsxs)(`div`,f({className:[n,`w-rjv-inner`].filter(Boolean).join(` `),ref:t},l,{onMouseEnter:()=>u({[d]:!0}),onMouseLeave:()=>u({[d]:!1})},{children:[(0,h.jsx)(Vt,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c,initialValue:o}),(0,h.jsx)(Ot,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c}),(0,h.jsx)(Ve,{expandKey:d,value:a,level:i,keys:s,parentValue:r,keyName:c})]}))});Ut.displayName=`JVR.Container`;var Wt=e=>{var{BraceLeft:t={}}=A();return V(t,e,`BraceLeft`),null};Wt.displayName=`JVR.BraceLeft`;var Gt=e=>{var{BraceRight:t={}}=A();return V(t,e,`BraceRight`),null};Gt.displayName=`JVR.BraceRight`;var Kt=e=>{var{BracketsLeft:t={}}=A();return V(t,e,`BracketsLeft`),null};Kt.displayName=`JVR.BracketsLeft`;var qt=e=>{var{BracketsRight:t={}}=A();return V(t,e,`BracketsRight`),null};qt.displayName=`JVR.BracketsRight`;var Jt=e=>{var{Arrow:t={}}=A();return V(t,e,`Arrow`),null};Jt.displayName=`JVR.Arrow`;var Yt=e=>{var{Colon:t={}}=A();return V(t,e,`Colon`),null};Yt.displayName=`JVR.Colon`;var Xt=e=>{var{Quote:t={}}=A();return V(t,e,`Quote`),null};Xt.displayName=`JVR.Quote`;var Zt=e=>{var{ValueQuote:t={}}=A();return V(t,e,`ValueQuote`),null};Zt.displayName=`JVR.ValueQuote`;var Qt=e=>{var{Bigint:t={}}=k();return H(t,e,`Bigint`),null};Qt.displayName=`JVR.Bigint`;var $t=e=>{var{Date:t={}}=k();return H(t,e,`Date`),null};$t.displayName=`JVR.Date`;var en=e=>{var{False:t={}}=k();return H(t,e,`False`),null};en.displayName=`JVR.False`;var tn=e=>{var{Float:t={}}=k();return H(t,e,`Float`),null};tn.displayName=`JVR.Float`;var nn=e=>{var{Int:t={}}=k();return H(t,e,`Int`),null};nn.displayName=`JVR.Int`;var rn=e=>{var{Map:t={}}=k();return H(t,e,`Map`),null};rn.displayName=`JVR.Map`;var an=e=>{var{Nan:t={}}=k();return H(t,e,`Nan`),null};an.displayName=`JVR.Nan`;var on=e=>{var{Null:t={}}=k();return H(t,e,`Null`),null};on.displayName=`JVR.Null`;var sn=e=>{var{Set:t={}}=k();return H(t,e,`Set`),null};sn.displayName=`JVR.Set`;var cn=e=>{var{Str:t={}}=k();return H(t,e,`Str`),null};cn.displayName=`JVR.StringText`;var ln=e=>{var{True:t={}}=k();return H(t,e,`True`),null};ln.displayName=`JVR.True`;var un=e=>{var{Undefined:t={}}=k();return H(t,e,`Undefined`),null};un.displayName=`JVR.Undefined`;var dn=e=>{var{Url:t={}}=k();return H(t,e,`Url`),null};dn.displayName=`JVR.Url`;var fn=e=>{var{Copied:t={}}=M();return U(t,e,`Copied`),null};fn.displayName=`JVR.Copied`;var pn=[`className`,`style`,`value`,`children`,`collapsed`,`shouldExpandNodeInitially`,`indentWidth`,`displayObjectSize`,`shortenTextAfterLength`,`stringEllipsis`,`highlightUpdates`,`enableClipboard`,`displayDataTypes`,`objectSortKeys`,`onExpand`,`onCopied`,`beforeCopy`],K=(0,m.forwardRef)((e,t)=>{var{className:n=``,style:r,value:i,children:a,collapsed:o=!1,shouldExpandNodeInitially:s,indentWidth:c=15,displayObjectSize:l=!0,shortenTextAfterLength:u=30,stringEllipsis:d,highlightUpdates:m=!0,enableClipboard:g=!0,displayDataTypes:_=!0,objectSortKeys:v=!1,onExpand:y,onCopied:b,beforeCopy:x}=e,S=p(e,pn),C=f({lineHeight:1.4,fontFamily:`var(--w-rjv-font-family, Menlo, monospace)`,color:`var(--w-rjv-color, #002b36)`,backgroundColor:`var(--w-rjv-background-color, #00000000)`,fontSize:13},r),w=[`w-json-view-container`,`w-rjv`,n].filter(Boolean).join(` `);return(0,h.jsxs)(De,{initialState:{value:i,objectSortKeys:v,indentWidth:c,shouldExpandNodeInitially:o===!1?s:void 0,displayObjectSize:l,collapsed:o,enableClipboard:g,shortenTextAfterLength:u,stringEllipsis:d,highlightUpdates:m,onCopied:b,onExpand:y,beforeCopy:x},initialTypes:{displayDataTypes:_},children:[(0,h.jsx)(Ut,f({value:i},S,{ref:t,className:w,style:C})),a]})});K.Bigint=Qt,K.Date=$t,K.False=en,K.Float=tn,K.Int=nn,K.Map=rn,K.Nan=an,K.Null=on,K.Set=sn,K.String=cn,K.True=ln,K.Undefined=un,K.Url=dn,K.ValueQuote=Zt,K.Arrow=Jt,K.Colon=Yt,K.Quote=Xt,K.Ellipsis=zt,K.BraceLeft=Wt,K.BraceRight=Gt,K.BracketsLeft=Kt,K.BracketsRight=qt,K.Copied=fn,K.CountInfo=It,K.CountInfoExtra=Mt,K.KeyName=_t,K.Row=xt,K.displayName=`JVR.JsonView`;var mn={"--w-rjv-font-family":`monospace`,"--w-rjv-color":`#002b36`,"--w-rjv-key-string":`#002b36`,"--w-rjv-background-color":`#ffffff`,"--w-rjv-line-color":`#ebebeb`,"--w-rjv-arrow-color":`var(--w-rjv-color)`,"--w-rjv-edit-color":`var(--w-rjv-color)`,"--w-rjv-info-color":`#0000004d`,"--w-rjv-update-color":`#ebcb8b`,"--w-rjv-copied-color":`#002b36`,"--w-rjv-copied-success-color":`#28a745`,"--w-rjv-curlybraces-color":`#236a7c`,"--w-rjv-colon-color":`#002b36`,"--w-rjv-brackets-color":`#236a7c`,"--w-rjv-quotes-color":`var(--w-rjv-key-string)`,"--w-rjv-quotes-string-color":`var(--w-rjv-type-string-color)`,"--w-rjv-type-string-color":`#cb4b16`,"--w-rjv-type-int-color":`#268bd2`,"--w-rjv-type-float-color":`#859900`,"--w-rjv-type-bigint-color":`#268bd2`,"--w-rjv-type-boolean-color":`#2aa198`,"--w-rjv-type-date-color":`#586e75`,"--w-rjv-type-url-color":`#0969da`,"--w-rjv-type-null-color":`#d33682`,"--w-rjv-type-nan-color":`#859900`,"--w-rjv-type-undefined-color":`#586e75`},hn=e=>(0,h.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,h.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m12 19l-7-7l7-7m7 7H5`})}),gn=e=>(0,h.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,h.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M20 6L9 17l-5-5`})}),q=e=>(0,h.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,h.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`m6 9l6 6l6-6`})}),_n=e=>(0,h.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,h.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,h.jsx)(`rect`,{width:14,height:14,x:8,y:8,rx:2,ry:2}),(0,h.jsx)(`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`})]})});function vn(){let{id:e}=l.useSearch();return(0,h.jsx)(Xn,{id:e})}function J(e){return e.toLocaleString()}var yn=new Set;function bn(e){try{return{ok:!0,value:JSON.parse(e)}}catch{return{ok:!1}}}function xn(e){if(!e)return{};try{return JSON.parse(e)}catch{return e}}function Sn({text:e}){let[t,n]=(0,m.useState)(!1);return(0,m.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>n(!1),1500);return()=>clearTimeout(e)},[t]),(0,h.jsx)(`button`,{type:`button`,className:`absolute top-2 right-2 p-1 rounded text-sand-400 hover:text-sand-600 transition-colors`,onClick:()=>{navigator.clipboard.writeText(e),n(!0)},children:t?(0,h.jsx)(gn,{className:`size-3.5 text-sage-500`}):(0,h.jsx)(_n,{className:`size-3.5`})})}var Cn=/<img\s+[^>]*src=["'](data:image\/[^"']+;base64,[^"']+)["'][^>]*(?:alt=["']([^"']*)["'][^>]*)?\/?>/gi;function wn(e){let t=[],n=0;for(let r of e.matchAll(Cn)){let i=r.index??0;i>n&&t.push({type:`text`,text:e.slice(n,i)}),t.push({type:`image`,src:r[1],alt:r[2]??`generated image`}),n=i+r[0].length}return n<e.length&&t.push({type:`text`,text:e.slice(n)}),t.filter(e=>e.type===`image`||e.text.trim().length>0)}function Tn({text:e,markdown:t}){let[n,r]=(0,m.useState)(null),i=wn(e);return i.some(e=>e.type===`image`)?(0,h.jsxs)(`div`,{className:`space-y-3`,children:[i.map((e,n)=>e.type===`text`?t?(0,h.jsx)(`div`,{className:`prose prose-sm prose-qgrid max-w-none`,children:(0,h.jsx)(s,{remarkPlugins:[o],children:e.text})},`text-${n}`):(0,h.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:e.text},`text-${n}`):(0,h.jsx)(`button`,{type:`button`,className:`block max-w-full rounded-md border border-sand-200 overflow-hidden bg-white hover:border-sienna-300 transition-colors`,onClick:()=>r(e.src),title:`Open image`,children:(0,h.jsx)(`img`,{src:e.src,alt:e.alt,className:`max-h-[520px] max-w-full object-contain`,loading:`lazy`})},`image-${n}`)),n&&(0,h.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-black/70 p-4 flex items-center justify-center`,onClick:()=>r(null),children:[(0,h.jsx)(`button`,{type:`button`,className:`absolute top-4 right-4 p-2 rounded-full bg-white/90 text-sand-700 hover:bg-white`,onClick:()=>r(null),title:`Close image`,children:(0,h.jsx)(c,{className:`size-5`})}),(0,h.jsx)(`img`,{src:n,alt:`generated preview`,className:`max-h-full max-w-full object-contain rounded-md bg-white`,onClick:e=>e.stopPropagation()})]})]}):t?(0,h.jsx)(`div`,{className:`prose prose-sm prose-qgrid max-w-none`,children:(0,h.jsx)(s,{remarkPlugins:[o],children:e})}):(0,h.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:e})}function Y({text:e,markdown:t}){let n=bn(e),[r,i]=(0,m.useState)(`pretty`),a=n.ok&&n.value!==null&&(Array.isArray(n.value)||typeof n.value==`object`);return!n.ok||!a?t?(0,h.jsx)(Tn,{text:e,markdown:!0}):(0,h.jsx)(Tn,{text:n.ok?JSON.stringify(n.value,null,2):e}):(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{className:`flex gap-1 mb-2`,children:[(0,h.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${r===`plain`?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>i(`plain`),children:`Plain`}),(0,h.jsx)(`button`,{type:`button`,className:`px-2 py-0.5 text-[10px] rounded-md transition-colors ${r===`pretty`?`bg-sand-200 text-sand-700`:`text-sand-400 hover:text-sand-600`}`,onClick:()=>i(`pretty`),children:`Pretty`})]}),r===`pretty`?(0,h.jsx)(K,{value:n.value,style:mn,displayDataTypes:!1,enableClipboard:!0,collapsed:!1}):(0,h.jsx)(`pre`,{className:`text-sm text-sand-800 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed`,children:JSON.stringify(n.value,null,2)})]})}function X({title:e,defaultOpen:t=!0,children:n}){return(0,h.jsxs)(`details`,{open:t,className:`group panel overflow-hidden`,children:[(0,h.jsxs)(`summary`,{className:`panel-header flex items-center gap-1.5 cursor-pointer select-none list-none px-4 py-2.5`,children:[(0,h.jsx)(q,{className:`size-3.5 text-sand-400 transition-transform group-open:rotate-0 -rotate-90`}),(0,h.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-sand-500 font-medium`,children:e})]}),(0,h.jsx)(`div`,{className:`p-4`,children:n})]})}function Z({label:e,value:t}){return(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium truncate`,children:e}),(0,h.jsx)(`dd`,{className:`text-[15px] font-semibold text-sand-800 tabular-nums mt-0.5 truncate`,children:t})]})}var En={running:`bg-blue-100 text-blue-600`,succeeded:`bg-sage-100 text-sage-600`,error:`bg-red-100 text-red-600`,aborted:`bg-caution-400/15 text-caution-500`};function Dn({message:e}){return(0,h.jsxs)(`div`,{className:`panel overflow-hidden border border-red-200 bg-red-50/60`,children:[(0,h.jsx)(`div`,{className:`px-4 py-2.5 border-b border-red-100 flex items-center gap-1.5`,children:(0,h.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-red-600 font-medium`,children:`Error`})}),(0,h.jsx)(`div`,{className:`p-4`,children:(0,h.jsx)(`pre`,{className:`text-[12px] text-red-700 whitespace-pre-wrap break-words font-mono leading-relaxed max-h-80 overflow-auto`,children:e})})]})}function On({data:e}){let t=e.status===`running`,n=!t&&e.requested_model_name!==null&&e.model_name!==null&&e.requested_model_name!==e.model_name,r=!t&&e.requested_model_name!==null&&e.model_name===null;return(0,h.jsxs)(`div`,{className:`panel overflow-hidden px-4 py-3 flex flex-wrap items-center gap-x-2 gap-y-1.5 sm:px-5`,children:[(0,h.jsx)(`span`,{className:`text-[15px] font-semibold text-sand-900 break-all`,children:t?`실행 중`:n?`${e.requested_model_name} → ${e.model_name}`:e.model_name??e.requested_model_name??`Unknown model`}),r&&(0,h.jsx)(`span`,{className:`text-[10px] text-sand-400`,children:`요청`}),!t&&(e.fallback_count??0)>0&&(0,h.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase`,children:[`fallback ×`,e.fallback_count]}),!t&&e.status!==`succeeded`&&(0,h.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full font-medium uppercase ${En[e.status]??`bg-sand-100 text-sand-500`}`,children:e.status}),e.effort&&(0,h.jsxs)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded-md bg-sand-100 text-sand-500 font-mono`,children:[`effort=`,e.effort]}),e.project_name&&(0,h.jsxs)(`span`,{className:`text-[12px] text-sand-400`,children:[`· project=`,e.project_name]}),(0,h.jsx)(`span`,{className:`ml-auto text-[11px] text-sand-400`,children:e.token_name})]})}function kn({data:e,toolCallCount:t}){let n=Nn(e);return(0,h.jsxs)(`div`,{className:`panel overflow-hidden px-5 py-3 space-y-3`,children:[(0,h.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-x-6 gap-y-3`,children:[(0,h.jsx)(Z,{label:`Duration`,value:`${(e.duration_ms/1e3).toFixed(1)}s`}),(0,h.jsx)(Z,{label:`TTFT`,value:jn(e.ttft_ms)}),(0,h.jsx)(Z,{label:`Tokens/sec`,value:Pn(e.output_tokens,e.duration_ms,e.ttft_ms,n)}),(0,h.jsx)(Z,{label:`Driver Cost`,value:e.cost_usd===null?`—`:u(e.cost_usd)}),(0,h.jsx)(Z,{label:`Cost Source`,value:e.cost_source??`legacy`}),(0,h.jsx)(Z,{label:`Image Cost`,value:e.image_cost_usd===null?`—`:u(e.image_cost_usd)}),(0,h.jsx)(Z,{label:`Tool Calls`,value:`${t}회`})]}),(0,h.jsxs)(`div`,{className:`border-t border-sand-100/60 pt-3 grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-x-6 gap-y-3`,children:[(0,h.jsx)(Z,{label:`Input`,value:J(e.input_tokens)}),(0,h.jsx)(Z,{label:`Output`,value:J(e.output_tokens)}),(0,h.jsx)(Z,{label:`Cache Read`,value:J(e.cache_read_tokens)}),(0,h.jsx)(Z,{label:`Cache Write`,value:J(e.cache_creation_tokens)}),(0,h.jsx)(Z,{label:`Cache Write (5m)`,value:e.cache_creation_5m_tokens===null?`—`:J(e.cache_creation_5m_tokens)}),(0,h.jsx)(Z,{label:`Cache Write (1h)`,value:e.cache_creation_1h_tokens===null?`—`:J(e.cache_creation_1h_tokens)}),(0,h.jsx)(Z,{label:`Cache Hit`,value:d(e)})]})]})}function An(e){return e==null?`—`:e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function jn(e){return e==null||e<=0?`—`:An(e)}function Mn(e){let t=e.model_name?.trim().toLowerCase();if(t){let e=t.includes(`/`)?t.split(`/`).pop():t;if(e.startsWith(`claude-`))return`anthropic`;if(/^(gpt-|codex-|o\d)/.test(e))return`openai`}let n=e.token_name?.trim().toLowerCase();return n?.startsWith(`anthropic/`)?`anthropic`:n?.startsWith(`openai/`)?`openai`:null}function Nn(e){let t=Mn(e);return t!==null&&yn.has(t)}function Pn(e,t,n,r){if(!r||e==null||t==null||n==null||n<=0)return`—`;let i=t-n;return e<=0||i<=0?`—`:`${Math.round(e/(i/1e3)).toLocaleString()} tok/s`}function Q({label:e,value:t}){return(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium truncate`,children:e}),(0,h.jsx)(`div`,{className:`mt-0.5 text-[13px] font-semibold text-sand-800 tabular-nums truncate`,children:t})]})}function Fn(e){if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e.inputImages;return Array.isArray(t)?t:void 0}function In(e){return(Fn(e)??[]).filter(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.url==`string`&&t.url.length>0||typeof t.data==`string`&&t.data.length>0})}function Ln(e){if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e,n=Fn(t);return n?{...t,inputImages:n.map(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e,n=typeof t.url==`string`&&t.url.toLowerCase().startsWith(`data:`)?`[data-url ${t.url.length} chars]`:t.url;return{mediaType:t.mediaType,byteSize:t.byteSize,...n?{url:n}:{},...t.data?{data:`[base64 ${t.data.length} chars]`}:{}}})}:e}function Rn({images:e}){let t=e.map((e,t)=>{let n=e.url&&!e.url.startsWith(`[`)?e.url:void 0,r=e.data?`data:${e.mediaType??`image/png`};base64,${e.data}`:``,i=n??r;return i?{image:e,index:t,src:i}:null}).filter(e=>e!==null);return t.length===0?null:(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Input Images`}),(0,h.jsx)(`div`,{className:`mt-1 grid grid-cols-1 sm:grid-cols-2 gap-2`,children:t.map(({image:e,index:t,src:n})=>(0,h.jsxs)(`div`,{className:`rounded-md border border-sand-200 bg-white overflow-hidden`,children:[(0,h.jsx)(`img`,{src:n,alt:`reference ${t+1}`,className:`max-h-64 w-full object-contain bg-white`,loading:`lazy`}),(0,h.jsxs)(`div`,{className:`px-2 py-1 text-[10px] text-sand-500 font-mono border-t border-sand-100`,children:[e.mediaType??`image`,` ·`,` `,e.byteSize===void 0?`url`:`${e.byteSize.toLocaleString()} bytes`]})]},`${e.mediaType??`image`}-${t}`))})]})}function zn({stepId:e}){let{data:t}=i.useRequestLogStep(`I`,e??0,{enabled:e!==null});return(0,h.jsx)(Rn,{images:In(t?xn(t.tool_args):null)})}function Bn({entry:e}){let t=!!e.error,[n,r]=(0,m.useState)(!1),{data:a}=i.useRequestLogStep(`A`,e.id,{enabled:n}),o=Ln(a?xn(a.tool_args):null),s=a?xn(a.tool_result):null,c=a?.error??e.error;return(0,h.jsxs)(`details`,{className:`group/tool`,onToggle:e=>r(e.currentTarget.open),children:[(0,h.jsxs)(`summary`,{className:`flex items-center gap-2 px-3 py-2 cursor-pointer select-none list-none hover:bg-sand-50 transition-colors rounded-md`,children:[(0,h.jsx)(q,{className:`size-3 text-sand-400 transition-transform group-open/tool:rotate-0 -rotate-90 shrink-0`}),(0,h.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sand-100 text-sand-500 font-mono shrink-0`,children:[`call `,e.callIndex+1]}),(0,h.jsx)(`span`,{className:`text-[13px] font-medium text-sand-800 font-mono truncate`,children:e.toolName}),t&&(0,h.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-red-100 text-red-600 font-medium uppercase shrink-0`,children:`error`}),(0,h.jsx)(`span`,{className:`ml-auto text-[11px] text-sand-400 tabular-nums shrink-0`,children:An(e.durationMs)})]}),n&&(0,h.jsxs)(`div`,{className:`mt-1 mx-1 mb-3 space-y-2`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Request`}),(0,h.jsx)(`div`,{className:`mt-1 rounded-md bg-sand-50 p-3 overflow-auto`,children:(0,h.jsx)(Y,{text:a?JSON.stringify(o):`Loading...`})})]}),c&&(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-red-500 font-medium px-2`,children:`Error`}),(0,h.jsx)(`div`,{className:`mt-1 rounded-md bg-red-50 border border-red-100 p-3 overflow-auto`,children:(0,h.jsx)(Y,{text:c})})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-400 font-medium px-2`,children:`Response`}),(0,h.jsx)(`div`,{className:`mt-1 rounded-md bg-sand-50 p-3 overflow-auto`,children:(0,h.jsx)(Y,{text:a?typeof s==`string`?s:JSON.stringify(s):`Loading...`,markdown:!0})})]})]})]})}function Vn({stepId:e}){let[t,n]=(0,m.useState)(!1),{data:r}=i.useRequestLogStep(`A`,e,{enabled:t}),a=r?.reasoning_text??null;return(0,h.jsxs)(`details`,{className:`group/reason mt-3`,onToggle:e=>n(e.currentTarget.open),children:[(0,h.jsxs)(`summary`,{className:`flex items-center gap-2 cursor-pointer select-none list-none`,children:[(0,h.jsx)(q,{className:`size-3 text-sand-400 transition-transform group-open/reason:rotate-0 -rotate-90 shrink-0`}),(0,h.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Reasoning`})]}),t&&(0,h.jsx)(`div`,{className:`mt-2 rounded-md bg-white/70 border border-sand-100 p-3 overflow-auto`,children:a?(0,h.jsx)(Y,{text:a,markdown:!0}):r?(0,h.jsx)(`p`,{className:`text-sm text-sand-400`,children:`No reasoning text captured.`}):(0,h.jsx)(`p`,{className:`text-sm text-sand-400`,children:`Loading...`})})]})}function Hn({entry:e,tokensPerSecEnabled:t}){let n=e.generate,r=n!==null&&n.reasoningTokens!==null&&n.reasoningTokens!==void 0&&n.reasoningTokens>0,i=e.toolCalls.filter(e=>e.error).length;return(0,h.jsxs)(`details`,{open:!0,className:`group/step border-l border-sand-200 pl-3`,children:[(0,h.jsxs)(`summary`,{className:`flex items-center gap-2 py-2 cursor-pointer select-none list-none`,children:[(0,h.jsx)(q,{className:`size-3.5 text-sand-400 transition-transform group-open/step:rotate-0 -rotate-90 shrink-0`}),(0,h.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sienna-100 text-sienna-700 font-mono shrink-0`,children:[`step `,e.stepIndex+1]}),(0,h.jsx)(`span`,{className:`text-[13px] font-semibold text-sand-900`,children:`LLM call`}),n?.finishReason&&(0,h.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-sand-100 text-sand-500 font-mono shrink-0`,children:n.finishReason}),n&&(n.fallbackCount??0)>0&&(0,h.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-caution-400/15 text-caution-500 font-medium uppercase shrink-0`,children:[n.requestedModelName,` → `,n.modelName]}),r&&(0,h.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-blue-100 text-blue-600 font-medium shrink-0`,children:`reasoning`}),i>0&&(0,h.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-red-100 text-red-600 font-medium uppercase shrink-0`,children:[i,` error`]}),(0,h.jsxs)(`span`,{className:`ml-auto text-[11px] text-sand-400 tabular-nums shrink-0`,children:[e.toolCalls.length,` tools`]})]}),(0,h.jsxs)(`div`,{className:`ml-4 mb-4 space-y-3`,children:[n&&(0,h.jsxs)(`div`,{className:`rounded-md border border-sand-100 bg-sand-50/70 p-3`,children:[(0,h.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-8 gap-x-4 gap-y-3`,children:[(0,h.jsx)(Q,{label:`Duration`,value:An(n.durationMs)}),(0,h.jsx)(Q,{label:`TTFT`,value:jn(n.ttftMs)}),(0,h.jsx)(Q,{label:`Tokens/sec`,value:Pn(n.outputTokens,n.durationMs,n.ttftMs,t)}),(0,h.jsx)(Q,{label:`Input`,value:J(n.inputTokens??0)}),(0,h.jsx)(Q,{label:`Output`,value:J(n.outputTokens??0)}),(0,h.jsx)(Q,{label:`Cache Read`,value:J(n.cacheReadTokens??0)}),(0,h.jsx)(Q,{label:`Cache Write`,value:J(n.cacheCreationTokens??0)}),(0,h.jsx)(Q,{label:`Cache 5m / 1h`,value:`${n.cacheCreation5mTokens===null?`—`:J(n.cacheCreation5mTokens)} / ${n.cacheCreation1hTokens===null?`—`:J(n.cacheCreation1hTokens)}`}),(0,h.jsx)(Q,{label:`Cost`,value:n.costUsd===null?`—`:u(n.costUsd)}),(0,h.jsx)(Q,{label:`Cost Source`,value:n.costSource??`legacy`}),(0,h.jsx)(Q,{label:`Reasoning`,value:n.reasoningTokens!==null&&n.reasoningTokens!==void 0?J(n.reasoningTokens):`—`})]}),r&&(0,h.jsx)(Vn,{stepId:n.id})]}),e.toolCalls.length>0&&(0,h.jsx)(`div`,{className:`space-y-0.5`,children:e.toolCalls.map(e=>(0,h.jsx)(Bn,{entry:e},`${e.stepIndex}-${e.callIndex}-${e.toolCallId}`))})]})]})}function Un({steps:e,tokensPerSecEnabled:t}){let n=e.reduce((e,t)=>e+t.toolCalls.length,0);return(0,h.jsx)(X,{title:`Steps (${e.length} steps · ${n} tool calls)`,defaultOpen:!0,children:(0,h.jsx)(`div`,{className:`space-y-1`,children:e.map(e=>(0,h.jsx)(Hn,{entry:e,tokensPerSecEnabled:t},e.stepIndex))})})}function Wn(e){let t=new Map;function n(e){let n=t.get(e);if(n)return n;let r={stepIndex:e,generate:null,toolCalls:[]};return t.set(e,r),r}for(let t of e){let e=n(t.step_index);if(t.type===`generate`){e.generate={id:t.id,stepIndex:t.step_index,modelName:t.model_name,requestedModelName:t.requested_model_name,fallbackCount:t.fallback_count,inputTokens:t.input_tokens,outputTokens:t.output_tokens,cacheReadTokens:t.cache_read_tokens,cacheCreationTokens:t.cache_creation_tokens,cacheCreation5mTokens:t.cache_creation_5m_tokens,cacheCreation1hTokens:t.cache_creation_1h_tokens,costUsd:t.cost_usd,costSource:t.cost_source,durationMs:t.duration_ms,ttftMs:t.ttft_ms,finishReason:t.finish_reason,reasoningTokens:t.reasoning_tokens};continue}t.type===`tool_call`&&e.toolCalls.push({id:t.id,stepIndex:t.step_index,callIndex:t.tool_call_index??e.toolCalls.length,toolCallId:t.tool_call_id??``,toolName:t.tool_name??``,durationMs:t.tool_duration_ms??0,error:t.error})}return[...t.values()].map(e=>({...e,toolCalls:e.toolCalls.toSorted((e,t)=>e.callIndex-t.callIndex)})).toSorted((e,t)=>e.stepIndex-t.stepIndex)}function Gn(e){return e.type===`function_call`||e.type===`function_call_output`?`bg-caution-400/10`:e.role===`assistant`?`bg-sage-50`:`bg-sand-50`}function Kn(e){return e.type===`function_call`?`fn: ${e.name??`unknown`}`:e.type===`function_call_output`?`fn result`:e.role??e.type}function qn(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>typeof e==`object`&&e&&`text`in e?e.text:JSON.stringify(e)).join(`
2
2
  `):JSON.stringify(e)}function $({className:e,children:t}){return(0,h.jsx)(`pre`,{className:`text-[12px] text-sand-700 whitespace-pre-wrap wrap-break-word font-mono leading-relaxed max-h-40 overflow-auto ${e??``}`,children:t})}function Jn({history:e}){return(0,h.jsx)(X,{title:`History`,defaultOpen:!1,children:(0,h.jsx)(`div`,{className:`space-y-1.5`,children:e.map((e,t)=>(0,h.jsxs)(`div`,{className:`rounded-md px-3 py-2 ${Gn(e)}`,children:[(0,h.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium mb-1`,children:Kn(e)}),e.content!==null&&e.content!==void 0&&(0,h.jsx)($,{children:qn(e.content)}),e.arguments&&(0,h.jsx)($,{children:e.arguments}),e.output&&(0,h.jsx)($,{children:e.output})]},`hist-${t}`))})})}function Yn({tools:e}){return(0,h.jsx)(X,{title:`Tools (${e.length})`,defaultOpen:!1,children:(0,h.jsx)(`div`,{className:`space-y-1.5`,children:e.map((e,t)=>(0,h.jsxs)(`div`,{className:`rounded-md px-3 py-2 bg-caution-400/10`,children:[(0,h.jsxs)(`div`,{className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium mb-1`,children:[`fn: `,e.name]}),e.description&&(0,h.jsx)(`p`,{className:`text-[12px] text-sand-700 leading-relaxed`,children:e.description}),e.inputSchema!==void 0&&e.inputSchema!==null&&(0,h.jsx)($,{className:`mt-1`,children:JSON.stringify(e.inputSchema,null,2)})]},`tool-${t}`))})})}function Xn({id:e}){let{data:n,isLoading:r}=a.useRequestLog(`A`,e),{data:o}=i.useRequestLogSteps(`T`,{request_log_id:e,num:0,page:1,orderBy:`id-asc`}),s=Wn(o?.rows??[]);if(r)return(0,h.jsxs)(`div`,{className:`max-w-6xl mx-auto space-y-4`,children:[(0,h.jsx)(`div`,{className:`h-4 w-32 bg-sand-200 rounded animate-pulse`}),(0,h.jsx)(`div`,{className:`h-40 panel animate-pulse`}),(0,h.jsx)(`div`,{className:`h-32 panel animate-pulse`})]});if(!n)return(0,h.jsxs)(`div`,{className:`max-w-6xl mx-auto`,children:[(0,h.jsxs)(t,{to:`/logs`,className:`flex items-center gap-1 text-[13px] text-sand-500 hover:text-sienna-500 mb-4`,children:[(0,h.jsx)(hn,{className:`size-3.5`}),`Back to Logs`]}),(0,h.jsx)(`p`,{className:`text-sand-400 text-sm`,children:`Request not found.`})]});let c=s.flatMap(e=>e.toolCalls),l=c.find(e=>e.toolName===`image_generation`)?.id??null,u=s.length>0,d=Nn(n),f=n.history??null,p=f!==null&&f.length>0,m=n.tools??null,g=m!==null&&m.length>0,_=(0,h.jsxs)(`div`,{className:`space-y-4`,children:[(0,h.jsx)(X,{title:`System`,children:(0,h.jsxs)(`div`,{className:`relative`,children:[(0,h.jsx)(Sn,{text:n.system_prompt??`null`}),(0,h.jsx)(Y,{text:n.system_prompt??`null`,markdown:!0})]})}),(0,h.jsx)(X,{title:`User`,children:(0,h.jsxs)(`div`,{className:`space-y-3`,children:[(0,h.jsxs)(`div`,{className:`relative`,children:[(0,h.jsx)(Sn,{text:n.user_prompt??`null`}),(0,h.jsx)(Y,{text:n.user_prompt??`null`,markdown:!0})]}),(0,h.jsx)(zn,{stepId:l})]})})]});return(0,h.jsxs)(`div`,{className:`mx-auto space-y-4 ${u?`max-w-[120rem]`:`max-w-6xl`}`,children:[(0,h.jsxs)(t,{to:`/logs`,className:`inline-flex items-center gap-1 text-[13px] text-sand-500 hover:text-sienna-500 transition-colors`,children:[(0,h.jsx)(hn,{className:`size-3.5`}),`Back to Logs`]}),(0,h.jsx)(On,{data:n}),n.error_message&&(0,h.jsx)(Dn,{message:n.error_message}),p&&(0,h.jsx)(Jn,{history:f}),g&&(0,h.jsx)(Yn,{tools:m}),u?(0,h.jsxs)(`div`,{className:`flex flex-col lg:flex-row gap-4 items-stretch lg:items-start`,children:[(0,h.jsx)(`div`,{className:`order-1 lg:order-2 flex-1 min-w-0 space-y-4`,children:(0,h.jsx)(Un,{steps:s,tokensPerSecEnabled:d})}),(0,h.jsx)(`div`,{className:`order-2 lg:order-1 flex-1 min-w-0`,children:_})]}):_,(0,h.jsx)(X,{title:`Response`,children:(0,h.jsxs)(`div`,{className:`relative`,children:[(0,h.jsx)(Sn,{text:n.response}),(0,h.jsx)(Y,{text:n.response,markdown:!0})]})}),(0,h.jsx)(kn,{data:n,toolCallCount:c.length}),(0,h.jsx)(`div`,{className:`pb-8`})]})}export{vn as component};