zidane-gui 9.3.1 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/out/main/chunks/{remote-hosts-B8_tzg_n.js → remote-hosts-CSiGJAfm.js} +1 -1
  2. package/out/main/chunks/{session-search-sql-2EUzjHAT.js → session-search-sql-D51BmAO2.js} +5 -5
  3. package/out/main/index.js +4397 -4086
  4. package/out/main/session-search-worker.js +1 -1
  5. package/out/preload/index.mjs +36 -2
  6. package/out/renderer/assets/{24BXRY42-eTlQfl4v.js → 24BXRY42-0UXaaWjY.js} +1 -1
  7. package/out/renderer/assets/{4FHPYW2L-BHx1bBmw.js → 4FHPYW2L-BWpHahlW.js} +1 -1
  8. package/out/renderer/assets/{4LWW3ZNH-D7lTurDT.js → 4LWW3ZNH-CPyJ9o9Y.js} +1 -1
  9. package/out/renderer/assets/{5XYWFMKW-e04QMbw9.js → 5XYWFMKW-ZZpHHfGa.js} +1 -1
  10. package/out/renderer/assets/{64PMEAB3-DTIFpDpU.js → 64PMEAB3-DOEnEuzl.js} +1 -1
  11. package/out/renderer/assets/{6BEWHPQE-BrYtHcZG.js → 6BEWHPQE-C2ZZckdj.js} +1 -1
  12. package/out/renderer/assets/{6PIGVMFT-CoAPPYTl.js → 6PIGVMFT-CRGq6eh3.js} +1 -1
  13. package/out/renderer/assets/{75JW6PN6-JbXPfJg4.js → 75JW6PN6-CYzAa9yx.js} +1 -1
  14. package/out/renderer/assets/{7XWI72E6-CFY3Kecs.js → 7XWI72E6-C_GZbyIF.js} +1 -1
  15. package/out/renderer/assets/{BGW36YJW-DhmSG9tb.js → BGW36YJW-BAwgTZ_z.js} +1 -1
  16. package/out/renderer/assets/{CGIZI67J-Cr9B0EmW.js → CGIZI67J-BxXITbQC.js} +1 -1
  17. package/out/renderer/assets/{CodeEditor-C6EJBlGG.js → CodeEditor-CLsAw7eu.js} +2 -2
  18. package/out/renderer/assets/{ComposerEditor-oFIdMkLB.js → ComposerEditor-BqnIn2NQ.js} +1 -1
  19. package/out/renderer/assets/{DNNCRC2E-CMqlK0W6.js → DNNCRC2E-kbsNJgPT.js} +1 -1
  20. package/out/renderer/assets/DiffsTab--BHt7StP.js +3 -0
  21. package/out/renderer/assets/{E67EBMDD-C_T2QnwF.js → E67EBMDD-BOeJkFNZ.js} +1 -1
  22. package/out/renderer/assets/{EFYWJBJK-Cbn-VZcb.js → EFYWJBJK-CFT5CQUG.js} +1 -1
  23. package/out/renderer/assets/{EXE5EH6O-SXdUe5We.js → EXE5EH6O-Cbj5xPKl.js} +1 -1
  24. package/out/renderer/assets/{EditorWorkers-bVeEZI8X.js → EditorWorkers-CXBU_HFf.js} +1 -1
  25. package/out/renderer/assets/{FilesTab-DtM2Q5R0.js → FilesTab-CZHD0eBx.js} +4 -4
  26. package/out/renderer/assets/{G6GPDDNC-XfFyRa0j.js → G6GPDDNC-Ax6dML4i.js} +1 -1
  27. package/out/renderer/assets/{G76NGGFM-Bj_m2WLJ.js → G76NGGFM-BxPXXNt_.js} +1 -1
  28. package/out/renderer/assets/{GH6G3TJC-wPRy41Zv.js → GH6G3TJC-CiCXY2r6.js} +1 -1
  29. package/out/renderer/assets/{HPNUA7RO-BhLNmX-t.js → HPNUA7RO-DiyW9VGu.js} +1 -1
  30. package/out/renderer/assets/{HQRGC5D7-dvTAT1Uv.js → HQRGC5D7-ArfvIYAC.js} +1 -1
  31. package/out/renderer/assets/{IX6Z2TVR-CzV_umYo.js → IX6Z2TVR-Df9chdw8.js} +1 -1
  32. package/out/renderer/assets/IconButtonTip-D0dQOfg6.js +1 -0
  33. package/out/renderer/assets/{J77NQRCJ-DTwwq3Ci.js → J77NQRCJ-DOWauTsf.js} +1 -1
  34. package/out/renderer/assets/{JAD36DTZ-DArKsMUT.js → JAD36DTZ-CJDdMCD5.js} +1 -1
  35. package/out/renderer/assets/{LF3NJQAX-DjYdE7YV.js → LF3NJQAX-B89ZqOpY.js} +1 -1
  36. package/out/renderer/assets/{LRZCOFJZ-C7m8fw-0.js → LRZCOFJZ-BBX_wZ5T.js} +1 -1
  37. package/out/renderer/assets/{N5NF2FGY-CqGhgjNF.js → N5NF2FGY-BoIFu-8L.js} +1 -1
  38. package/out/renderer/assets/{N7OWWQHY-BRk68LVa.js → N7OWWQHY-CloOgGu1.js} +1 -1
  39. package/out/renderer/assets/{NT5JY5WP-B1NtxJ-K.js → NT5JY5WP-BhjzefjG.js} +1 -1
  40. package/out/renderer/assets/{OT7W3RNY-CtDQ--Ld.js → OT7W3RNY-BRzBqtKB.js} +1 -1
  41. package/out/renderer/assets/{P67P66DB-LeAz_z3Z.js → P67P66DB-Dw-K1Ghu.js} +1 -1
  42. package/out/renderer/assets/{PFLLLM7K-CgODCVD8.js → PFLLLM7K-DfSPUrIT.js} +1 -1
  43. package/out/renderer/assets/{PUAMC4MJ-9REX_vGK.js → PUAMC4MJ-BnY1F2cF.js} +1 -1
  44. package/out/renderer/assets/{PVFCHRLY-CK5jTRjy.js → PVFCHRLY-BcyVPS3n.js} +1 -1
  45. package/out/renderer/assets/{PinnedSavedView-Dtdra7Gq.js → PinnedSavedView-ciRhY0cN.js} +1 -1
  46. package/out/renderer/assets/{QQW2P742-B2snHr_6.js → QQW2P742-D6aitZ24.js} +1 -1
  47. package/out/renderer/assets/{S63OEDPG-BeWWF1tc.js → S63OEDPG-Dlz1a9cD.js} +1 -1
  48. package/out/renderer/assets/{SG5TVYLW-ClCsbQ87.js → SG5TVYLW-Bu7LZZpx.js} +1 -1
  49. package/out/renderer/assets/{SavedViewArtifact-ATjDgAUF.js → SavedViewArtifact-CM9L4mc8.js} +1 -1
  50. package/out/renderer/assets/{SidebarPreviewPane-DHllX0GN.js → SidebarPreviewPane-DkOCt7Gb.js} +1 -1
  51. package/out/renderer/assets/{TranscriptViews-DD_JshFH.js → TranscriptViews-aYvP71ow.js} +1 -1
  52. package/out/renderer/assets/{UGRSUGA2-jP6nv8HL.js → UGRSUGA2-avwOtJG1.js} +1 -1
  53. package/out/renderer/assets/{V44WA6U7-Dr_tS3uH.js → V44WA6U7-DMF87Y7j.js} +1 -1
  54. package/out/renderer/assets/{V67O4WWV-BRn52u9c.js → V67O4WWV-BsDLuBDb.js} +1 -1
  55. package/out/renderer/assets/{VBUCM3YD-0sLtn_Zp.js → VBUCM3YD-C6FrRswP.js} +1 -1
  56. package/out/renderer/assets/{VINGRCPA-n98Gf7V0.js → VINGRCPA-Do3Pv3Tc.js} +1 -1
  57. package/out/renderer/assets/{ViewBlock-DdcTHRu3.js → ViewBlock-B-ppjb34.js} +3 -3
  58. package/out/renderer/assets/{ViewCharts-BAw6tExV.js → ViewCharts-jvS22ppO.js} +2 -2
  59. package/out/renderer/assets/{ViewCustom-BzwMbjqg.js → ViewCustom-yFkoy6a-.js} +1 -1
  60. package/out/renderer/assets/{ViewExtension-Ch5_33Ra.js → ViewExtension-DuHxho6W.js} +1 -1
  61. package/out/renderer/assets/{ViewInputs-BHooAs2f.js → ViewInputs-VAMDh56H.js} +1 -1
  62. package/out/renderer/assets/{ViewMcpApp-CJnOESMk.js → ViewMcpApp-CH_W9CZt.js} +1 -1
  63. package/out/renderer/assets/{ViewSessionAction-BHJv5QNb.js → ViewSessionAction-66veqRhO.js} +1 -1
  64. package/out/renderer/assets/{ViewTables-DBTupg46.js → ViewTables-CKKDcYKH.js} +1 -1
  65. package/out/renderer/assets/{WL6DNKX4-Csfp__Nw.js → WL6DNKX4-Cq-YK4Uf.js} +1 -1
  66. package/out/renderer/assets/{WQ63CJYP-oSbguA5n.js → WQ63CJYP-fjrhTSVs.js} +1 -1
  67. package/out/renderer/assets/{XOYAOB3S-DfDDKmX8.js → XOYAOB3S-CAQPI0he.js} +1 -1
  68. package/out/renderer/assets/{Y5LQLG3M-BnZ8APdi.js → Y5LQLG3M-DKntYAaW.js} +1 -1
  69. package/out/renderer/assets/{YIK6JTN6-Bunk5CDx.js → YIK6JTN6-CcjcC5JX.js} +1 -1
  70. package/out/renderer/assets/{core-BbPUgmX7.js → core-Cj89wpQh.js} +4 -4
  71. package/out/renderer/assets/{file-tabs-CFdJBYJ9.js → file-tabs-PoAgFa7v.js} +1 -1
  72. package/out/renderer/assets/{ghostty-web-Dn7o-dzQ.js → ghostty-web-DiMuvUtH.js} +1 -1
  73. package/out/renderer/assets/{highlights-eTGcn9lP.js → highlights-7WH0ppQl.js} +1 -1
  74. package/out/renderer/assets/{highlights-D4Jo_Sz0.js → highlights-DnSmFBdQ.js} +1 -1
  75. package/out/renderer/assets/index-CiuUSFeC.js +11 -0
  76. package/out/renderer/assets/kit-CD3F-f6F.js +147 -0
  77. package/out/renderer/assets/{langs-CXhlGiW6.js → langs-D5CRC9qz.js} +1 -1
  78. package/out/renderer/assets/{lazy-D3tN-GAO.js → lazy-CUmWiDAP.js} +3 -3
  79. package/out/renderer/assets/{loader-DGyfh0zB.js → loader-CPY9efuc.js} +1 -1
  80. package/out/renderer/assets/{pierre-theme-BZvsTYqQ.js → pierre-theme-BrzM0xZU.js} +3 -3
  81. package/out/renderer/assets/setting-demos-BW7cG2_G.css +1 -0
  82. package/out/renderer/assets/setting-demos-DEURBrvf.js +1 -0
  83. package/out/renderer/assets/{shiki-Wqv4XEGM.js → shiki-DFrbO9j3.js} +1 -1
  84. package/out/renderer/assets/{sidebar-layout-sK8ujsHX.js → sidebar-layout-fobokay5.js} +1 -1
  85. package/out/renderer/assets/{stream-tokenizer-C18hljKL.js → stream-tokenizer-CT1HAjvR.js} +1 -1
  86. package/out/renderer/assets/{themes-Dfx1_kFe.js → themes-Cj62ov9J.js} +1 -1
  87. package/out/renderer/assets/{useFind-BBxfQuQ2.js → useFind-Cdl0rVJO.js} +3 -3
  88. package/out/renderer/assets/{useFolderChanges-BcfSJoBT.js → useFolderChanges-C9L_NOgw.js} +2 -2
  89. package/out/renderer/assets/{view-preview-B2Rj--lZ.js → view-preview-BvCO9WZH.js} +1 -1
  90. package/out/renderer/assets/{zoom-reset-l-YVDJrI.js → zoom-reset-COqHFP45.js} +1 -1
  91. package/out/renderer/index.html +5 -5
  92. package/out/renderer/view-preview.html +6 -6
  93. package/package.json +2 -2
  94. package/out/renderer/assets/DiffsTab-D690H0Dy.js +0 -3
  95. package/out/renderer/assets/IconButtonTip-P9QUxPjA.js +0 -1
  96. package/out/renderer/assets/index-c95EBMdk.js +0 -8
  97. package/out/renderer/assets/kit-C9O_D5xC.js +0 -147
  98. package/out/renderer/assets/setting-demos-B0787McX.js +0 -1
  99. package/out/renderer/assets/setting-demos-vtrBsYTd.css +0 -1
@@ -1,3 +1,3 @@
1
- import"./vendor-owxl31sT.js";import"./setting-demos-B0787McX.js";import{e as clientExports,j as jsxRuntimeExports,r as reactExports}from"./vendor-react-CxJ4vs-5.js";import{fk as VIEW_PREVIEW_GLOBAL}from"./core-BbPUgmX7.js";import{aq as themeStylesheet,ar as createViewsHost,v as viewsScopeOf,as as ViewsProvider,i as ViewsScopeContext,at as AllNearViewportContext}from"./kit-C9O_D5xC.js";import{V as ViewInputsPreviewContext}from"./input-preview-CvBe1Cwt.js";import{E as readThemeVars,S as StoredViewBlock}from"./ViewBlock-DdcTHRu3.js";import"./vendor-motion-C2jPaSqL.js";import"./vendor-editor-gVJMCtGz.js";const STYLE_MIN_TEXT_PX=11,STYLE_MIN_CONTRAST_TEXT=4.5,STYLE_MIN_CONTRAST_LABEL=3,STYLE_MIN_DRAWING_SHARE=.6,STYLE_MIN_DIAGRAM_SHARE=.7,STYLE_DIAGRAM_MIN_HEIGHT=240,WIDE_FRAME_PX=600,DRAWING_MIN_HEIGHT=100,NAMES_MAX=3,DISABLED=':disabled, [aria-disabled="true"]',TEXTS_MAX=1500;function quote(text){const clean=text.replace(/\s+/g," ").trim();return`"${clean.length>32?`${clean.slice(0,31)}…`:clean}"`}function colorReader(){if(typeof navigator<"u"&&/jsdom/i.test(navigator.userAgent))return;const ctx=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});if(!ctx)return;const cache=new Map;return css=>{if(!css||css==="none"||css.startsWith("url("))return;if(cache.has(css))return cache.get(css);ctx.clearRect(0,0,1,1),ctx.fillStyle="rgba(0, 0, 0, 0)",ctx.fillStyle=css,ctx.fillRect(0,0,1,1);const[r,g,b,a]=ctx.getImageData(0,0,1,1).data,color={r,g,b,a:a/255};return cache.set(css,color),color}}function over(top,bottom){const a=top.a+bottom.a*(1-top.a);if(a===0)return{r:0,g:0,b:0,a:0};const mix=(t,b)=>(t*top.a+b*bottom.a*(1-top.a))/a;return{r:mix(top.r,bottom.r),g:mix(top.g,bottom.g),b:mix(top.b,bottom.b),a}}function luminance({r,g,b}){const channel=value=>{const c=value/255;return c<=.03928?c/12.92:((c+.055)/1.055)**2.4};return .2126*channel(r)+.7152*channel(g)+.0722*channel(b)}function contrast(a,b){const[hi,lo]=[luminance(a),luminance(b)].sort((x,y)=>y-x);return(hi+.05)/(lo+.05)}function backdrop(el,read){const layers=[];for(let at=el;at;at=at.parentElement){const color=read(getComputedStyle(at).backgroundColor);if(color&&color.a>0&&layers.push(color),color&&color.a>=1)break}return layers.reduceRight((under,layer)=>over(layer,under),{r:255,g:255,b:255,a:1})}function opacityOf(el,stop){let opacity=1;for(let at=el;at&&at!==stop.parentElement;at=at.parentElement)opacity*=Number.parseFloat(getComputedStyle(at).opacity)||0;return opacity}function drawnSize(el){const font=Number.parseFloat(getComputedStyle(el).fontSize)||0;let scale=1;for(let at=el;at;at=at.parentElement)if(at instanceof SVGSVGElement&&"getScreenCTM"in at){const ctm=(el instanceof SVGGraphicsElement?el:at).getScreenCTM();ctm&&(scale=Math.sqrt(Math.abs(ctm.a*ctm.d-ctm.b*ctm.c)));break}return{drawn:font*scale,font}}function textElements(root){const out=new Set,walker=document.createTreeWalker(root,NodeFilter.SHOW_TEXT);for(let node=walker.nextNode();node&&out.size<TEXTS_MAX;node=walker.nextNode()){if(!node.textContent?.trim()||!node.parentElement)continue;const el=node.parentElement;if(el.closest("[data-zg-view-controls], style, script, title, desc"))continue;const rect=el.getBoundingClientRect();if(rect.width<=1||rect.height<=1)continue;const style=getComputedStyle(el);style.visibility==="hidden"||style.display==="none"||out.add(el)}return[...out]}function overlapArea(a,b){const w=Math.min(a.right,b.right)-Math.max(a.left,b.left),h=Math.min(a.bottom,b.bottom)-Math.max(a.top,b.top);return w>1&&h>1?w*h:0}function crowdedLabels(body){const found=[];for(const svg of body.querySelectorAll(".zg-chart-plot svg")){const labels=[...svg.querySelectorAll("text")].filter(text=>text.textContent?.trim()&&opacityOf(text,svg)>.1).map(text=>({text:text.textContent.trim(),rect:text.getBoundingClientRect()})).filter(({rect})=>rect.width>0&&rect.height>0);for(let i=0;i<labels.length&&found.length<NAMES_MAX;i++)for(let j=i+1;j<labels.length;j++){const a=labels[i],b=labels[j],smaller=Math.min(a.rect.width*a.rect.height,b.rect.width*b.rect.height);if(a.text!==b.text&&overlapArea(a.rect,b.rect)>smaller*.2){found.push(`${quote(a.text)} and ${quote(b.text)}`);break}}}return found}function hasNeighbor(el,body){const box=el.getBoundingClientRect();for(const other of body.querySelectorAll("svg, img, canvas, p, span, td, th, li, h1, h2, h3, h4, button")){if(other===el||other.contains(el)||el.contains(other))continue;const rect=other.getBoundingClientRect();if(!(rect.width<2||rect.height<2||rect.top>=box.bottom-4||rect.bottom<=box.top+4)&&(rect.right<=box.left+1||rect.left>=box.right-1))return!0}return!1}function emptySpace(body){const width=body.getBoundingClientRect().width,found={model:[],kit:[]};if(width<WIDE_FRAME_PX)return found;const drawings=[...body.querySelectorAll(".zg-chart-plot svg, [data-zg-diagram] svg, [data-zg-view-body] img, [data-zg-view-body] canvas")];for(const el of drawings){if(drawings.some(other=>other!==el&&other.contains(el)))continue;const rect=el.getBoundingClientRect();if(rect.height<DRAWING_MIN_HEIGHT)continue;const share=rect.width/width,diagram=el.closest("[data-zg-diagram]")!==null;if(!(diagram?share<STYLE_MIN_DIAGRAM_SHARE&&rect.height<STYLE_DIAGRAM_MIN_HEIGHT:share<STYLE_MIN_DRAWING_SHARE)||hasNeighbor(el,body))continue;const image=el.tagName.toLowerCase()==="img",list=image?found.model:found.kit;list.length<NAMES_MAX&&list.push(`${diagram?"a diagram":image?"an image":"a chart"} ${Math.round(rect.width)} px wide (${Math.round(share*100)}%)`)}return found}function measureViewStyle(frame){const body=frame.querySelector("[data-zg-view-body]")??frame,problems=[],read=colorReader(),scaled=[],small=[],faint=[];let diagramSmall=!1;for(const el of textElements(body)){const opacity=opacityOf(el,frame);if(opacity<.1)continue;const{drawn:size,font}=drawnSize(el);if(size>0&&size<STYLE_MIN_TEXT_PX-.25){const name=`${quote(el.textContent??"")} (${size.toFixed(1).replace(/\.0$/,"")} px)`;size<font-.25?(scaled.length<NAMES_MAX&&scaled.push(name),el.closest("[data-zg-diagram]")&&(diagramSmall=!0)):small.length<NAMES_MAX&&small.push(name)}if(!read||el.closest(DISABLED))continue;const style=getComputedStyle(el),ink=read(el instanceof SVGElement?style.fill:style.color);if(!ink)continue;const behind=backdrop(el,read),shown=over({...ink,a:ink.a*opacity*(el instanceof SVGElement&&Number.parseFloat(style.fillOpacity)||1)},behind),ratio=contrast(shown,behind),floor=size>=13?STYLE_MIN_CONTRAST_TEXT:STYLE_MIN_CONTRAST_LABEL;ratio<floor-.05&&faint.length<NAMES_MAX&&faint.push(`${quote(el.textContent??"")} (${ratio.toFixed(1)}:1, needs ${floor}:1)`)}scaled.length>0&&problems.push({kind:"style",message:`Text is scaled down under ${STYLE_MIN_TEXT_PX} px: ${scaled.join(", ")}.${diagramSmall?" The diagram is too wide for the frame: put fewer nodes side by side, such as one node for a group.":" Let the drawing span the frame, or draw less in it."}`}),small.length>0&&problems.push({kind:"style",note:!0,message:`Text is smaller than ${STYLE_MIN_TEXT_PX} px: ${small.join(", ")}.`}),faint.length>0&&problems.push({kind:"style",note:!0,message:`Text is hard to read on its background: ${faint.join(", ")}.`}),body.getBoundingClientRect().width>=WIDE_FRAME_PX&&body.querySelector("[data-zg-diagram-scroll]")&&problems.push({kind:"style",message:`A diagram is too wide for the frame: shrunk to fit, its text would be under ${STYLE_MIN_TEXT_PX} px, so it scrolls sideways. Put fewer nodes side by side, such as one node for a group.`});const crowded=crowdedLabels(body);crowded.length>0&&problems.push({kind:"style",message:`Labels in a chart overlap: ${crowded.join("; ")}. Label fewer points (the subject and the outliers), or use a Table for the rest.`});const empty=emptySpace(body);return empty.model.length>0&&problems.push({kind:"style",message:`A drawing leaves most of the frame empty: ${empty.model.join(", ")}. Let it span the frame: a viewBox and no fixed width.`}),empty.kit.length>0&&problems.push({kind:"style",note:!0,message:`A drawing leaves most of the frame empty: ${empty.kit.join(", ")}.`}),problems}const VIEW_PREVIEW_SETTLE_MS=1e4,OVERFLOW_NAMES_MAX=3;function metaOf(view){return{id:view.id,anchor:view.anchor,title:view.title,alt:view.alt,heights:view.heights,origin:view.origin,createdAt:view.createdAt,hasErrors:(view.errors??[]).some(error=>error.level==="error")}}function asStored(view){return{turnId:view.anchor.turnId,source:"",data:{},original:view.tree,version:1,errors:[],...view}}function ViewPreview({view,inputs=!1}){const host=reactExports.useMemo(()=>{const stored=asStored(view);return createViewsHost({meta:async()=>[metaOf(view)],get:async(_sessionId,ids)=>ids.includes(stored.id)?[structuredClone(stored)]:[]})},[view]),meta=reactExports.useMemo(()=>metaOf(view),[view]),scope=reactExports.useMemo(()=>inputs?viewsScopeOf(!0,!1,!0,null,null):null,[inputs]),block=jsxRuntimeExports.jsx(ViewsProvider,{host,children:jsxRuntimeExports.jsx(StoredViewBlock,{sessionId:view.sessionId,meta})}),preview=jsxRuntimeExports.jsx(ViewInputsPreviewContext.Provider,{value:!0,children:block}),scoped=scope?jsxRuntimeExports.jsx(ViewsScopeContext.Provider,{value:scope,children:preview}):preview;return jsxRuntimeExports.jsx(AllNearViewportContext.Provider,{value:!0,children:scoped})}function nextFrame(){return new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(()=>resolve())))}function settled(root){return root.querySelector("[data-zg-view-body]")?.getAttribute("data-zg-view-body")==="drawn"&&root.querySelector("[data-zg-view-skeleton]")===null&&root.querySelector('[data-zg-diagram="pending"]')===null&&root.querySelector('[data-zg-image="pending"]')===null&&root.querySelector('[data-zg-highlight="pending"]')===null&&root.querySelector("[data-zg-view-pending]")===null}async function waitSettled(root,settleMs){const until=Date.now()+settleMs;for(await nextFrame();!settled(root)&&Date.now()<until;)await new Promise(resolve=>setTimeout(resolve,25));const held=settled(root);return await document.fonts?.ready,await Promise.all([...root.querySelectorAll("img")].map(img=>typeof img.decode=="function"?img.decode().catch(()=>{}):void 0)),await nextFrame(),held}function insideScroller(el,frame){for(let at=el.parentElement;at&&at!==frame;at=at.parentElement){const overflow=getComputedStyle(at).overflowX;if(overflow==="auto"||overflow==="scroll"||overflow==="hidden"||overflow==="clip")return!0}return!1}function nameOf(el){const text=(el.innerText??el.textContent??"").replace(/\s+/g," ").trim();return text?`"${text.length>40?`${text.slice(0,39)}…`:text}"`:`a ${el.tagName.toLowerCase()} element`}function measureViewPreview(root){const problems=[],frame=root.querySelector("[data-zg-view]");if(!frame)return{height:1,problems:[{kind:"empty",message:"The view draws nothing."}]};const box=frame.getBoundingClientRect(),margin=Number.parseFloat(getComputedStyle(frame).marginBottom)||0,doc=document.documentElement;if(doc.scrollWidth>doc.clientWidth+1)problems.push({kind:"overflow",message:`The view is wider than the screen: ${doc.scrollWidth} px in ${doc.clientWidth} px.`});else{const out=[];for(const el of frame.querySelectorAll("*")){const rect=el.getBoundingClientRect();if(!(rect.width===0||rect.right<=box.right+1&&rect.left>=box.left-1)&&!insideScroller(el,frame)&&!(out.length>0&&el.parentElement&&el.parentElement.getBoundingClientRect().right>box.right+1)&&(out.push(nameOf(el)),out.length>=OVERFLOW_NAMES_MAX))break}out.length>0&&problems.push({kind:"overflow",message:`Part of the view is wider than its frame: ${out.join(", ")}.`})}const scrolls=[];for(const el of frame.querySelectorAll("*")){const overflow=getComputedStyle(el).overflowX;if((overflow==="auto"||overflow==="scroll")&&el.scrollWidth>el.clientWidth+1&&(scrolls.push(`${nameOf(el)} (${el.scrollWidth} px in ${el.clientWidth} px)`),scrolls.length>=OVERFLOW_NAMES_MAX))break}scrolls.length>0&&problems.push({kind:"scroll",message:`Part of the view scrolls sideways: ${scrolls.join(", ")}.`});const body=frame.querySelector("[data-zg-view-body]"),text=body?.innerText?.trim()??"",media=[...body?.querySelectorAll("svg, img, canvas")??[]].some(el=>{const rect=el.getBoundingClientRect();return rect.width>0&&rect.height>0});return!body||!text&&!media||body.getBoundingClientRect().height<4?problems.push({kind:"empty",message:"The view draws nothing."}):problems.push(...measureViewStyle(frame)),{height:Math.ceil(box.bottom+margin),problems}}function installViewPreviewPage(options={}){const root=options.root??document.getElementById("root")??document.body.appendChild(document.createElement("div")),style=document.createElement("style");style.textContent=`${themeStylesheet(options.themes??{})}
1
+ import"./vendor-owxl31sT.js";import"./setting-demos-DEURBrvf.js";import{e as clientExports,j as jsxRuntimeExports,r as reactExports}from"./vendor-react-CxJ4vs-5.js";import{fo as VIEW_PREVIEW_GLOBAL}from"./core-Cj89wpQh.js";import{aq as themeStylesheet,ar as createViewsHost,v as viewsScopeOf,as as ViewsProvider,i as ViewsScopeContext,at as AllNearViewportContext}from"./kit-CD3F-f6F.js";import{V as ViewInputsPreviewContext}from"./input-preview-CvBe1Cwt.js";import{E as readThemeVars,S as StoredViewBlock}from"./ViewBlock-B-ppjb34.js";import"./vendor-motion-C2jPaSqL.js";import"./vendor-editor-gVJMCtGz.js";const STYLE_MIN_TEXT_PX=11,STYLE_MIN_CONTRAST_TEXT=4.5,STYLE_MIN_CONTRAST_LABEL=3,STYLE_MIN_DRAWING_SHARE=.6,STYLE_MIN_DIAGRAM_SHARE=.7,STYLE_DIAGRAM_MIN_HEIGHT=240,WIDE_FRAME_PX=600,DRAWING_MIN_HEIGHT=100,NAMES_MAX=3,DISABLED=':disabled, [aria-disabled="true"]',TEXTS_MAX=1500;function quote(text){const clean=text.replace(/\s+/g," ").trim();return`"${clean.length>32?`${clean.slice(0,31)}…`:clean}"`}function colorReader(){if(typeof navigator<"u"&&/jsdom/i.test(navigator.userAgent))return;const ctx=document.createElement("canvas").getContext("2d",{willReadFrequently:!0});if(!ctx)return;const cache=new Map;return css=>{if(!css||css==="none"||css.startsWith("url("))return;if(cache.has(css))return cache.get(css);ctx.clearRect(0,0,1,1),ctx.fillStyle="rgba(0, 0, 0, 0)",ctx.fillStyle=css,ctx.fillRect(0,0,1,1);const[r,g,b,a]=ctx.getImageData(0,0,1,1).data,color={r,g,b,a:a/255};return cache.set(css,color),color}}function over(top,bottom){const a=top.a+bottom.a*(1-top.a);if(a===0)return{r:0,g:0,b:0,a:0};const mix=(t,b)=>(t*top.a+b*bottom.a*(1-top.a))/a;return{r:mix(top.r,bottom.r),g:mix(top.g,bottom.g),b:mix(top.b,bottom.b),a}}function luminance({r,g,b}){const channel=value=>{const c=value/255;return c<=.03928?c/12.92:((c+.055)/1.055)**2.4};return .2126*channel(r)+.7152*channel(g)+.0722*channel(b)}function contrast(a,b){const[hi,lo]=[luminance(a),luminance(b)].sort((x,y)=>y-x);return(hi+.05)/(lo+.05)}function backdrop(el,read){const layers=[];for(let at=el;at;at=at.parentElement){const color=read(getComputedStyle(at).backgroundColor);if(color&&color.a>0&&layers.push(color),color&&color.a>=1)break}return layers.reduceRight((under,layer)=>over(layer,under),{r:255,g:255,b:255,a:1})}function opacityOf(el,stop){let opacity=1;for(let at=el;at&&at!==stop.parentElement;at=at.parentElement)opacity*=Number.parseFloat(getComputedStyle(at).opacity)||0;return opacity}function drawnSize(el){const font=Number.parseFloat(getComputedStyle(el).fontSize)||0;let scale=1;for(let at=el;at;at=at.parentElement)if(at instanceof SVGSVGElement&&"getScreenCTM"in at){const ctm=(el instanceof SVGGraphicsElement?el:at).getScreenCTM();ctm&&(scale=Math.sqrt(Math.abs(ctm.a*ctm.d-ctm.b*ctm.c)));break}return{drawn:font*scale,font}}function textElements(root){const out=new Set,walker=document.createTreeWalker(root,NodeFilter.SHOW_TEXT);for(let node=walker.nextNode();node&&out.size<TEXTS_MAX;node=walker.nextNode()){if(!node.textContent?.trim()||!node.parentElement)continue;const el=node.parentElement;if(el.closest("[data-zg-view-controls], style, script, title, desc"))continue;const rect=el.getBoundingClientRect();if(rect.width<=1||rect.height<=1)continue;const style=getComputedStyle(el);style.visibility==="hidden"||style.display==="none"||out.add(el)}return[...out]}function overlapArea(a,b){const w=Math.min(a.right,b.right)-Math.max(a.left,b.left),h=Math.min(a.bottom,b.bottom)-Math.max(a.top,b.top);return w>1&&h>1?w*h:0}function crowdedLabels(body){const found=[];for(const svg of body.querySelectorAll(".zg-chart-plot svg")){const labels=[...svg.querySelectorAll("text")].filter(text=>text.textContent?.trim()&&opacityOf(text,svg)>.1).map(text=>({text:text.textContent.trim(),rect:text.getBoundingClientRect()})).filter(({rect})=>rect.width>0&&rect.height>0);for(let i=0;i<labels.length&&found.length<NAMES_MAX;i++)for(let j=i+1;j<labels.length;j++){const a=labels[i],b=labels[j],smaller=Math.min(a.rect.width*a.rect.height,b.rect.width*b.rect.height);if(a.text!==b.text&&overlapArea(a.rect,b.rect)>smaller*.2){found.push(`${quote(a.text)} and ${quote(b.text)}`);break}}}return found}function hasNeighbor(el,body){const box=el.getBoundingClientRect();for(const other of body.querySelectorAll("svg, img, canvas, p, span, td, th, li, h1, h2, h3, h4, button")){if(other===el||other.contains(el)||el.contains(other))continue;const rect=other.getBoundingClientRect();if(!(rect.width<2||rect.height<2||rect.top>=box.bottom-4||rect.bottom<=box.top+4)&&(rect.right<=box.left+1||rect.left>=box.right-1))return!0}return!1}function emptySpace(body){const width=body.getBoundingClientRect().width,found={model:[],kit:[]};if(width<WIDE_FRAME_PX)return found;const drawings=[...body.querySelectorAll(".zg-chart-plot svg, [data-zg-diagram] svg, [data-zg-view-body] img, [data-zg-view-body] canvas")];for(const el of drawings){if(drawings.some(other=>other!==el&&other.contains(el)))continue;const rect=el.getBoundingClientRect();if(rect.height<DRAWING_MIN_HEIGHT)continue;const share=rect.width/width,diagram=el.closest("[data-zg-diagram]")!==null;if(!(diagram?share<STYLE_MIN_DIAGRAM_SHARE&&rect.height<STYLE_DIAGRAM_MIN_HEIGHT:share<STYLE_MIN_DRAWING_SHARE)||hasNeighbor(el,body))continue;const image=el.tagName.toLowerCase()==="img",list=image?found.model:found.kit;list.length<NAMES_MAX&&list.push(`${diagram?"a diagram":image?"an image":"a chart"} ${Math.round(rect.width)} px wide (${Math.round(share*100)}%)`)}return found}function measureViewStyle(frame){const body=frame.querySelector("[data-zg-view-body]")??frame,problems=[],read=colorReader(),scaled=[],small=[],faint=[];let diagramSmall=!1;for(const el of textElements(body)){const opacity=opacityOf(el,frame);if(opacity<.1)continue;const{drawn:size,font}=drawnSize(el);if(size>0&&size<STYLE_MIN_TEXT_PX-.25){const name=`${quote(el.textContent??"")} (${size.toFixed(1).replace(/\.0$/,"")} px)`;size<font-.25?(scaled.length<NAMES_MAX&&scaled.push(name),el.closest("[data-zg-diagram]")&&(diagramSmall=!0)):small.length<NAMES_MAX&&small.push(name)}if(!read||el.closest(DISABLED))continue;const style=getComputedStyle(el),ink=read(el instanceof SVGElement?style.fill:style.color);if(!ink)continue;const behind=backdrop(el,read),shown=over({...ink,a:ink.a*opacity*(el instanceof SVGElement&&Number.parseFloat(style.fillOpacity)||1)},behind),ratio=contrast(shown,behind),floor=size>=13?STYLE_MIN_CONTRAST_TEXT:STYLE_MIN_CONTRAST_LABEL;ratio<floor-.05&&faint.length<NAMES_MAX&&faint.push(`${quote(el.textContent??"")} (${ratio.toFixed(1)}:1, needs ${floor}:1)`)}scaled.length>0&&problems.push({kind:"style",message:`Text is scaled down under ${STYLE_MIN_TEXT_PX} px: ${scaled.join(", ")}.${diagramSmall?" The diagram is too wide for the frame: put fewer nodes side by side, such as one node for a group.":" Let the drawing span the frame, or draw less in it."}`}),small.length>0&&problems.push({kind:"style",note:!0,message:`Text is smaller than ${STYLE_MIN_TEXT_PX} px: ${small.join(", ")}.`}),faint.length>0&&problems.push({kind:"style",note:!0,message:`Text is hard to read on its background: ${faint.join(", ")}.`}),body.getBoundingClientRect().width>=WIDE_FRAME_PX&&body.querySelector("[data-zg-diagram-scroll]")&&problems.push({kind:"style",message:`A diagram is too wide for the frame: shrunk to fit, its text would be under ${STYLE_MIN_TEXT_PX} px, so it scrolls sideways. Put fewer nodes side by side, such as one node for a group.`});const crowded=crowdedLabels(body);crowded.length>0&&problems.push({kind:"style",message:`Labels in a chart overlap: ${crowded.join("; ")}. Label fewer points (the subject and the outliers), or use a Table for the rest.`});const empty=emptySpace(body);return empty.model.length>0&&problems.push({kind:"style",message:`A drawing leaves most of the frame empty: ${empty.model.join(", ")}. Let it span the frame: a viewBox and no fixed width.`}),empty.kit.length>0&&problems.push({kind:"style",note:!0,message:`A drawing leaves most of the frame empty: ${empty.kit.join(", ")}.`}),problems}const VIEW_PREVIEW_SETTLE_MS=1e4,OVERFLOW_NAMES_MAX=3;function metaOf(view){return{id:view.id,anchor:view.anchor,title:view.title,alt:view.alt,heights:view.heights,origin:view.origin,createdAt:view.createdAt,hasErrors:(view.errors??[]).some(error=>error.level==="error")}}function asStored(view){return{turnId:view.anchor.turnId,source:"",data:{},original:view.tree,version:1,errors:[],...view}}function ViewPreview({view,inputs=!1}){const host=reactExports.useMemo(()=>{const stored=asStored(view);return createViewsHost({meta:async()=>[metaOf(view)],get:async(_sessionId,ids)=>ids.includes(stored.id)?[structuredClone(stored)]:[]})},[view]),meta=reactExports.useMemo(()=>metaOf(view),[view]),scope=reactExports.useMemo(()=>inputs?viewsScopeOf(!0,!1,!0,null,null):null,[inputs]),block=jsxRuntimeExports.jsx(ViewsProvider,{host,children:jsxRuntimeExports.jsx(StoredViewBlock,{sessionId:view.sessionId,meta})}),preview=jsxRuntimeExports.jsx(ViewInputsPreviewContext.Provider,{value:!0,children:block}),scoped=scope?jsxRuntimeExports.jsx(ViewsScopeContext.Provider,{value:scope,children:preview}):preview;return jsxRuntimeExports.jsx(AllNearViewportContext.Provider,{value:!0,children:scoped})}function nextFrame(){return new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(()=>resolve())))}function settled(root){return root.querySelector("[data-zg-view-body]")?.getAttribute("data-zg-view-body")==="drawn"&&root.querySelector("[data-zg-view-skeleton]")===null&&root.querySelector('[data-zg-diagram="pending"]')===null&&root.querySelector('[data-zg-image="pending"]')===null&&root.querySelector('[data-zg-highlight="pending"]')===null&&root.querySelector("[data-zg-view-pending]")===null}async function waitSettled(root,settleMs){const until=Date.now()+settleMs;for(await nextFrame();!settled(root)&&Date.now()<until;)await new Promise(resolve=>setTimeout(resolve,25));const held=settled(root);return await document.fonts?.ready,await Promise.all([...root.querySelectorAll("img")].map(img=>typeof img.decode=="function"?img.decode().catch(()=>{}):void 0)),await nextFrame(),held}function insideScroller(el,frame){for(let at=el.parentElement;at&&at!==frame;at=at.parentElement){const overflow=getComputedStyle(at).overflowX;if(overflow==="auto"||overflow==="scroll"||overflow==="hidden"||overflow==="clip")return!0}return!1}function nameOf(el){const text=(el.innerText??el.textContent??"").replace(/\s+/g," ").trim();return text?`"${text.length>40?`${text.slice(0,39)}…`:text}"`:`a ${el.tagName.toLowerCase()} element`}function measureViewPreview(root){const problems=[],frame=root.querySelector("[data-zg-view]");if(!frame)return{height:1,problems:[{kind:"empty",message:"The view draws nothing."}]};const box=frame.getBoundingClientRect(),margin=Number.parseFloat(getComputedStyle(frame).marginBottom)||0,doc=document.documentElement;if(doc.scrollWidth>doc.clientWidth+1)problems.push({kind:"overflow",message:`The view is wider than the screen: ${doc.scrollWidth} px in ${doc.clientWidth} px.`});else{const out=[];for(const el of frame.querySelectorAll("*")){const rect=el.getBoundingClientRect();if(!(rect.width===0||rect.right<=box.right+1&&rect.left>=box.left-1)&&!insideScroller(el,frame)&&!(out.length>0&&el.parentElement&&el.parentElement.getBoundingClientRect().right>box.right+1)&&(out.push(nameOf(el)),out.length>=OVERFLOW_NAMES_MAX))break}out.length>0&&problems.push({kind:"overflow",message:`Part of the view is wider than its frame: ${out.join(", ")}.`})}const scrolls=[];for(const el of frame.querySelectorAll("*")){const overflow=getComputedStyle(el).overflowX;if((overflow==="auto"||overflow==="scroll")&&el.scrollWidth>el.clientWidth+1&&(scrolls.push(`${nameOf(el)} (${el.scrollWidth} px in ${el.clientWidth} px)`),scrolls.length>=OVERFLOW_NAMES_MAX))break}scrolls.length>0&&problems.push({kind:"scroll",message:`Part of the view scrolls sideways: ${scrolls.join(", ")}.`});const body=frame.querySelector("[data-zg-view-body]"),text=body?.innerText?.trim()??"",media=[...body?.querySelectorAll("svg, img, canvas")??[]].some(el=>{const rect=el.getBoundingClientRect();return rect.width>0&&rect.height>0});return!body||!text&&!media||body.getBoundingClientRect().height<4?problems.push({kind:"empty",message:"The view draws nothing."}):problems.push(...measureViewStyle(frame)),{height:Math.ceil(box.bottom+margin),problems}}function installViewPreviewPage(options={}){const root=options.root??document.getElementById("root")??document.body.appendChild(document.createElement("div")),style=document.createElement("style");style.textContent=`${themeStylesheet(options.themes??{})}
2
2
  html, body { margin: 0; background: var(--zg-bg); color: var(--zg-text); font-family: var(--zg-font-ui, system-ui, sans-serif); }
3
3
  body { overflow-y: hidden; }`,document.head.append(style),document.documentElement.setAttribute("data-motion","off");const react=clientExports.createRoot(root);let drawn=0,settleMs=VIEW_PREVIEW_SETTLE_MS,stuck=!1;const api={async render(input){const html=document.documentElement;html.classList.remove("dark","light"),html.classList.add(input.appearance==="light"?"light":"dark"),html.style.colorScheme=input.appearance==="light"?"light":"dark",drawn+=1;const asked=input.settleMs;return settleMs=typeof asked=="number"&&asked>0?asked:VIEW_PREVIEW_SETTLE_MS,react.render(jsxRuntimeExports.jsx(reactExports.StrictMode,{children:jsxRuntimeExports.jsx(ViewPreview,{view:input.view,inputs:input.inputs===!0},drawn)})),stuck=!await waitSettled(root,settleMs),{...measureViewPreview(root),theme:readThemeVars()}},frame:async()=>{stuck?await nextFrame():await waitSettled(root,settleMs)}};return Object.assign(window,{[VIEW_PREVIEW_GLOBAL]:api}),api}installViewPreviewPage();
@@ -1 +1 @@
1
- import{j as jsxRuntimeExports}from"./vendor-react-CxJ4vs-5.js";import{t as useLabels,I as IconButton}from"./kit-C9O_D5xC.js";import"./vendor-motion-C2jPaSqL.js";import"./vendor-owxl31sT.js";import"./core-BbPUgmX7.js";import"./vendor-editor-gVJMCtGz.js";function ZoomResetButton({onReset}){const labels=useLabels();return jsxRuntimeExports.jsx("div",{className:"zg-chart-corner",children:jsxRuntimeExports.jsx(IconButton,{size:"sm",icon:"i-ph-arrows-in-line-horizontal",label:labels.chartResetZoom,onClick:onReset})})}export{ZoomResetButton};
1
+ import{j as jsxRuntimeExports}from"./vendor-react-CxJ4vs-5.js";import{t as useLabels,I as IconButton}from"./kit-CD3F-f6F.js";import"./vendor-motion-C2jPaSqL.js";import"./vendor-owxl31sT.js";import"./core-Cj89wpQh.js";import"./vendor-editor-gVJMCtGz.js";function ZoomResetButton({onReset}){const labels=useLabels();return jsxRuntimeExports.jsx("div",{className:"zg-chart-corner",children:jsxRuntimeExports.jsx(IconButton,{size:"sm",icon:"i-ph-arrows-in-line-horizontal",label:labels.chartResetZoom,onClick:onReset})})}export{ZoomResetButton};
@@ -88,16 +88,16 @@
88
88
  pointer-events: none;
89
89
  }
90
90
  </style>
91
- <script type="module" crossorigin src="./assets/index-c95EBMdk.js"></script>
91
+ <script type="module" crossorigin src="./assets/index-CiuUSFeC.js"></script>
92
92
  <link rel="modulepreload" crossorigin href="./assets/vendor-react-CxJ4vs-5.js">
93
93
  <link rel="modulepreload" crossorigin href="./assets/vendor-motion-C2jPaSqL.js">
94
94
  <link rel="modulepreload" crossorigin href="./assets/vendor-owxl31sT.js">
95
- <link rel="modulepreload" crossorigin href="./assets/core-BbPUgmX7.js">
95
+ <link rel="modulepreload" crossorigin href="./assets/core-Cj89wpQh.js">
96
96
  <link rel="modulepreload" crossorigin href="./assets/vendor-editor-gVJMCtGz.js">
97
- <link rel="modulepreload" crossorigin href="./assets/kit-C9O_D5xC.js">
98
- <link rel="modulepreload" crossorigin href="./assets/setting-demos-B0787McX.js">
97
+ <link rel="modulepreload" crossorigin href="./assets/kit-CD3F-f6F.js">
98
+ <link rel="modulepreload" crossorigin href="./assets/setting-demos-DEURBrvf.js">
99
99
  <link rel="stylesheet" crossorigin href="./assets/vendor-DeJTMLhw.css">
100
- <link rel="stylesheet" crossorigin href="./assets/setting-demos-vtrBsYTd.css">
100
+ <link rel="stylesheet" crossorigin href="./assets/setting-demos-BW7cG2_G.css">
101
101
  </head>
102
102
  <body class="zg-app">
103
103
  <div id="root"></div>
@@ -4,18 +4,18 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>View preview</title>
7
- <script type="module" crossorigin src="./assets/view-preview-B2Rj--lZ.js"></script>
7
+ <script type="module" crossorigin src="./assets/view-preview-BvCO9WZH.js"></script>
8
8
  <link rel="modulepreload" crossorigin href="./assets/vendor-react-CxJ4vs-5.js">
9
9
  <link rel="modulepreload" crossorigin href="./assets/vendor-owxl31sT.js">
10
10
  <link rel="modulepreload" crossorigin href="./assets/vendor-motion-C2jPaSqL.js">
11
- <link rel="modulepreload" crossorigin href="./assets/core-BbPUgmX7.js">
11
+ <link rel="modulepreload" crossorigin href="./assets/core-Cj89wpQh.js">
12
12
  <link rel="modulepreload" crossorigin href="./assets/vendor-editor-gVJMCtGz.js">
13
- <link rel="modulepreload" crossorigin href="./assets/kit-C9O_D5xC.js">
14
- <link rel="modulepreload" crossorigin href="./assets/setting-demos-B0787McX.js">
13
+ <link rel="modulepreload" crossorigin href="./assets/kit-CD3F-f6F.js">
14
+ <link rel="modulepreload" crossorigin href="./assets/setting-demos-DEURBrvf.js">
15
15
  <link rel="modulepreload" crossorigin href="./assets/input-preview-CvBe1Cwt.js">
16
- <link rel="modulepreload" crossorigin href="./assets/ViewBlock-DdcTHRu3.js">
16
+ <link rel="modulepreload" crossorigin href="./assets/ViewBlock-B-ppjb34.js">
17
17
  <link rel="stylesheet" crossorigin href="./assets/vendor-DeJTMLhw.css">
18
- <link rel="stylesheet" crossorigin href="./assets/setting-demos-vtrBsYTd.css">
18
+ <link rel="stylesheet" crossorigin href="./assets/setting-demos-BW7cG2_G.css">
19
19
  </head>
20
20
  <body>
21
21
  <div id="root"></div>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zidane-gui",
3
3
  "productName": "Zidane",
4
- "version": "9.3.1",
4
+ "version": "9.4.0",
5
5
  "description": "Zidane Desktop",
6
6
  "author": "StackBlitz",
7
7
  "homepage": "https://zidane.si",
@@ -77,7 +77,7 @@
77
77
  "sonner": "^2.0.8",
78
78
  "tippy.js": "^6.3.7",
79
79
  "typescript-language-server": "^6.0.3",
80
- "zidane": "9.3.1",
80
+ "zidane": "9.4.0",
81
81
  "zod": "^4.6.7"
82
82
  },
83
83
  "devDependencies": {
@@ -1,3 +0,0 @@
1
- import{r as reactExports,j as jsxRuntimeExports}from"./vendor-react-CxJ4vs-5.js";import{au as mediaTypeOfPath,av as useFilesHost,aw as useFilesLabels,ax as filesRootOf,ay as collectSessionDiffs,az as groupByPath,aA as usePanelVisible,aB as fileDiffCounts,aC as buildDiffTree,aD as fileOrder,aE as visibleRows,aF as useAppearanceReducedMotion,aG as relativeTo,aH as matchRanges,aI as steppedIndex,aJ as Segmented,aK as DiffCounts,aL as IconToggle,aM as PanelLoading,aN as PanelEmpty,aO as DiffFileTree}from"./kit-C9O_D5xC.js";import{M as MediaView,p as parseFilePatch,u as useDiagnosticsRun,c as countBySeverity,a as useFolderChanges,b as createPatchParser,d as useNoEdits,n as nameMatches,e as useNoKeyScope,F as FilesChatContext,S as SearchPanel,D as DiffScroller,f as DiffView,R as ReviewableDiff}from"./useFolderChanges-BcfSJoBT.js";import{T as TreeChevron,F as FileIcon}from"./FileIcon-DECOEMOz.js";import{u as useFind,F as FindBar,d as diffLines,s as settleScroll}from"./useFind-BBxfQuQ2.js";import"./vendor-motion-C2jPaSqL.js";import"./vendor-owxl31sT.js";import"./core-BbPUgmX7.js";import"./vendor-editor-gVJMCtGz.js";import"./pierre-theme-BZvsTYqQ.js";import"./hastToHtml-C4ea9WpN.js";import"./index-C-yjveB4.js";const WINDOW_FIRST=6,WINDOW_PER_FRAME=2,WINDOW_ENTER_PX=1200,WINDOW_LEAVE_PX=3e3;function grow(mounted,keys,count){let added=0,next=null;for(const key of keys){if(added>=count)break;mounted.has(key)||(next??=new Set(mounted),next.add(key),added++)}return next??mounted}function sameSet(a,b){if(a.size!==b.size)return!1;for(const k of a)if(!b.has(k))return!1;return!0}function useDiffWindow(keys,resetKey){const[state,setState]=reactExports.useState(()=>({reset:resetKey,mounted:grow(new Set,keys,WINDOW_FIRST)})),[visible,setVisible]=reactExports.useState(()=>new Set);let current=state;state.reset!==resetKey&&(current={reset:resetKey,mounted:grow(new Set,keys,WINDOW_FIRST)},setState(current));const latest=reactExports.useRef({keys,resetKey,mounted:current.mounted});latest.current={keys,resetKey,mounted:current.mounted};const t=reactExports.useRef(null),sync=reactExports.useCallback(()=>{const run=()=>{const tracker=trackerOf(t);tracker.frame=0;const{keys:order,resetKey:reset,mounted}=latest.current;setVisible(prev=>sameSet(prev,tracker.seen)?prev:new Set(tracker.seen));const more=order.some(k=>tracker.near.has(k)&&!mounted.has(k));setState(s=>{if(s.reset!==reset)return s;let next=null;for(const key of s.mounted){const gone=!tracker.els.has(key)&&!order.includes(key),far=tracker.known.has(key)&&!tracker.kept.has(key);(gone||far)&&(next??=new Set(s.mounted),next.delete(key))}const base=next??s.mounted,wanted=order.filter(k=>tracker.near.has(k)&&!base.has(k));wanted.sort((a,b)=>Number(tracker.seen.has(b))-Number(tracker.seen.has(a)));const grown=grow(base,wanted,WINDOW_PER_FRAME);return grown===s.mounted?s:{reset:s.reset,mounted:grown}}),more&&(tracker.frame=requestAnimationFrame(run))};run()},[]),schedule=reactExports.useCallback(()=>{const tracker=trackerOf(t);tracker.frame||(tracker.frame=requestAnimationFrame(sync))},[sync]),root=reactExports.useCallback(el=>{const tracker=trackerOf(t);if(el===tracker.rootEl)return;for(const o of tracker.observers)o.disconnect();if(tracker.observers=[],tracker.near.clear(),tracker.kept.clear(),tracker.known.clear(),tracker.seen.clear(),tracker.rootEl=el,!el||typeof IntersectionObserver>"u")return;const watch=(margin,into,mark)=>new IntersectionObserver(entries=>{for(const entry of entries){const key=tracker.keyOf.get(entry.target);key!==void 0&&(mark?.add(key),entry.isIntersecting?into.add(key):into.delete(key))}schedule()},{root:el,rootMargin:margin});tracker.observers=[watch(`${WINDOW_ENTER_PX}px 0px`,tracker.near),watch(`${WINDOW_LEAVE_PX}px 0px`,tracker.kept,tracker.known),watch("-1px 0px 0px 0px",tracker.seen)];for(const node of tracker.keyOf.keys())for(const o of tracker.observers)o.observe(node)},[schedule]),track=reactExports.useCallback(key=>{const tracker=trackerOf(t);let ref=tracker.refs.get(key);return ref||(ref=el=>{if(el){tracker.els.set(key,el),tracker.keyOf.set(el,key);for(const o of tracker.observers)o.observe(el);return()=>{for(const o of tracker.observers)o.unobserve(el);tracker.keyOf.delete(el),tracker.els.get(key)===el&&(tracker.els.delete(key),tracker.refs.delete(key),tracker.near.delete(key),tracker.kept.delete(key),tracker.known.delete(key),tracker.seen.delete(key)&&schedule())}}},tracker.refs.set(key,ref)),ref},[schedule]),pending=keys.some(key=>!current.mounted.has(key));reactExports.useEffect(()=>{if(!pending||trackerOf(t).observers.length>0)return;const frame=requestAnimationFrame(()=>setState(s=>s.reset===resetKey?{reset:s.reset,mounted:grow(s.mounted,keys,WINDOW_PER_FRAME)}:s));return()=>cancelAnimationFrame(frame)},[pending,keys,resetKey,current.mounted]),reactExports.useEffect(()=>()=>{const tracker=trackerOf(t);cancelAnimationFrame(tracker.frame),tracker.frame=0;for(const o of tracker.observers)o.disconnect();tracker.observers=[],tracker.rootEl=null},[]);const element=reactExports.useCallback(key=>trackerOf(t).els.get(key),[]),elements=reactExports.useCallback(()=>trackerOf(t).els,[]);return reactExports.useMemo(()=>({mounted:current.mounted,visible,track,root,element,elements}),[current.mounted,visible,track,root,element,elements])}function trackerOf(ref){return ref.current??={els:new Map,keyOf:new Map,refs:new Map,rootEl:null,observers:[],near:new Set,kept:new Set,known:new Set,seen:new Set,frame:0},ref.current}function isMediaDiff(file){return file.hunks.length===0&&mediaTypeOfPath(file.name)!==null}const MediaDiff=reactExports.memo(({file,cwd})=>{const mediaUrl=useFilesHost().mediaUrl,labels=useFilesLabels(),type=mediaTypeOfPath(file.name),name=file.name.slice(file.name.lastIndexOf("/")+1),oldPath=file.prevName??file.name,sides=[...file.type==="new"?[]:[{label:labels.filesBefore,src:mediaUrl({kind:"diff",cwd,path:oldPath,side:"old",version:file.prevObjectId})}],...file.type==="deleted"?[]:[{label:labels.filesAfter,src:mediaUrl({kind:"diff",cwd,path:file.name,side:"new",version:file.newObjectId})}]];return jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[jsxRuntimeExports.jsx("div",{className:"zg-meta px-3 py-2 truncate",title:file.name,children:file.name}),jsxRuntimeExports.jsx("div",{className:"grid gap-3 px-3 pb-3 grid-cols-[repeat(auto-fit,minmax(12rem,1fr))]","data-testid":"media-diff",children:sides.map(side=>jsxRuntimeExports.jsxs("figure",{className:"m-0 flex flex-col items-center gap-1.5 min-w-0",children:[jsxRuntimeExports.jsx(MediaView,{kind:type.kind,src:side.src,name,fit:"row"},side.src),jsxRuntimeExports.jsx("figcaption",{className:"text-zg-meta text-[var(--zg-text-muted)]",children:side.label})]},side.label))})]})});MediaDiff.displayName="MediaDiff";const TAU_MS=70,followers=new WeakMap;function followerFor(el){let follower=followers.get(el);return follower||(follower=createFollower(el),followers.set(el,follower)),follower}function createFollower(el){let target=null,raf=0,last=0,pos=0;const stop=()=>{cancelAnimationFrame(raf),raf=0,target=null},tick=now=>{if(raf=0,target===null)return;const dt=last?Math.min(64,now-last):16;last=now;const left=target-pos;if(Math.abs(left)<.5){el.scrollTop=target,target=null;return}pos+=left*(1-Math.exp(-dt/TAU_MS)),el.scrollTop=pos,raf=requestAnimationFrame(tick)};return el.addEventListener("wheel",stop,{passive:!0}),el.addEventListener("pointerdown",stop),el.addEventListener("keydown",stop),{to(top,instant){if(instant){stop(),el.scrollTop=top;return}target===null&&(pos=el.scrollTop,last=0),target=top,raf||=requestAnimationFrame(tick)},target:()=>target,stop}}const PARSED_PATCH_CHARS=16*1024*1024,parsedPatches=new Map;let parsedChars=0;function parseSessionPatch(id,patch){const hit=parsedPatches.get(id);if(hit){if(parsedPatches.delete(id),hit.patch===patch)return parsedPatches.set(id,hit),hit.diff;parsedChars-=hit.patch.length}let diff=null;try{diff=parseFilePatch(patch,`${id}:`)??null}catch{diff=null}if(patch.length>PARSED_PATCH_CHARS)return diff;parsedPatches.set(id,{patch,diff}),parsedChars+=patch.length;for(const[oldest,entry]of parsedPatches){if(parsedChars<=PARSED_PATCH_CHARS)break;parsedPatches.delete(oldest),parsedChars-=entry.patch.length}return diff}function useFilesDiagnostics(cwd,paths,version){const{result}=useDiagnosticsRun(cwd,paths,{version:useVersionKey(version),settle:!0,lsp:!1});return reactExports.useMemo(()=>{if(!result)return null;const byPath=new Map;for(const d of result.diagnostics)byPath.set(d.path,[...byPath.get(d.path)??[],d]);return new Map([...byPath].map(([p,items])=>[p,countBySeverity(items)]))},[result])}function useVersionKey(version){const last=reactExports.useRef({value:version,counter:0});return version==null||typeof version!="object"?String(version):(last.current.value!==version&&(last.current={value:version,counter:last.current.counter+1}),`${Array.isArray(version)?version.length:0}:${last.current.counter}`)}const SETTLE_MS=400,NO_FILES=[],parsers=new WeakMap,ON_THIS_THREAD=createPatchParser(null);function parserFor(createWorker){if(!createWorker||typeof Worker>"u")return ON_THIS_THREAD;let parser=parsers.get(createWorker);return parser||parsers.set(createWorker,parser=createPatchParser(createWorker)),parser}function useWorkingTreeDiff(scope,active,createWorker){const diffOf=useFilesHost().workingTreeDiff,calls=reactExports.useRef({diffOf,parse:parserFor(createWorker)});calls.current={diffOf,parse:parserFor(createWorker)};const cwd=diffOf&&filesRootOf(scope)||null,onFolderChange=useFolderChanges(scope),[files,setFiles]=reactExports.useState(null),byKey=reactExports.useRef(new Map),cwdRef=reactExports.useRef(cwd);cwdRef.current=cwd;const flight=reactExports.useRef(null),stale=reactExports.useRef(!0),lastPatch=reactExports.useRef(null),read=reactExports.useCallback(async()=>{const at=cwdRef.current;if(at){if(flight.current?.cwd===at){flight.current.again=!0;return}flight.current={cwd:at,again:!1};try{const{diffOf:diff,parse}=calls.current,patch=diff?await diff(at).catch(()=>null):null;if(cwdRef.current!==at)return;if(patch===null){setFiles(prev=>prev??[]);return}if(patch===lastPatch.current)return;if(lastPatch.current=patch,!patch.trim()){byKey.current=new Map,setFiles([]);return}const res=await parse(patch,[...byKey.current.keys()]);if(cwdRef.current!==at)return;const next=new Map,list=[];for(const{key,file}of res.files){const parsed=file===void 0?byKey.current.get(key):file;parsed&&(next.set(key,parsed),list.push(parsed))}byKey.current=next,setFiles(prev=>prev&&prev.length===list.length&&prev.every((f,i)=>f===list[i])?prev:list)}finally{const again=flight.current?.cwd===at&&flight.current.again;flight.current?.cwd===at&&(flight.current=null),(again||cwdRef.current&&cwdRef.current!==at)&&read()}}},[]);return reactExports.useEffect(()=>{byKey.current=new Map,lastPatch.current=null,stale.current=!0,setFiles(null)},[cwd]),reactExports.useEffect(()=>{if(!cwd)return;active&&stale.current&&(stale.current=!1,read());let timer;const off=onFolderChange(()=>{if(!active){stale.current=!0;return}clearTimeout(timer),timer=setTimeout(()=>{read()},SETTLE_MS)});return()=>{clearTimeout(timer),off()}},[cwd,onFolderChange,active,read]),diffOf?files:NO_FILES}const MAX_SEARCH_LINES=2e3,renderFileIcon=path=>jsxRuntimeExports.jsx(FileIcon,{path}),DIFF_HEADER_INSET={"--zg-diff-header-inset":"15px"},renderChevron=open=>jsxRuntimeExports.jsx(TreeChevron,{open,className:"text-[var(--zg-text-muted)]"}),SessionDiff=reactExports.memo(({id,patch,diffStyle,wrap})=>{const fileDiff=reactExports.useMemo(()=>parseSessionPatch(id,patch),[id,patch]);return fileDiff?jsxRuntimeExports.jsx(ReviewableDiff,{fileDiff,diffStyle,wrap}):jsxRuntimeExports.jsx(DiffView,{patch,diffStyle,wrap})}),seenHeights=new WeakMap;function layoutOf(diffStyle,wrap){return`${diffStyle}:${wrap?"wrap":"scroll"}`}function useSectionRef(key,track,measured,layout,mounted){const node=reactExports.useRef(null),ref=reactExports.useCallback(el=>{const off=track(key)(el);return node.current=el,()=>{off?.(),node.current=null}},[track,key]);return reactExports.useEffect(()=>{const el=node.current;if(!mounted||!el||typeof ResizeObserver>"u")return;const observer=new ResizeObserver(([entry])=>{const height=entry?.contentRect.height??0;if(height<=0)return;let byLayout=seenHeights.get(measured);byLayout||seenHeights.set(measured,byLayout=new Map),byLayout.set(layout,height)});return observer.observe(el),()=>observer.disconnect()},[mounted,measured,layout]),ref}const HEADER_PX=44,SEPARATOR_PX=32,SPACING_PX=8,WorkingSection=reactExports.memo(({file,mounted,diffStyle,wrap,track,mediaCwd})=>{const layout=layoutOf(diffStyle,wrap),media=mediaCwd!==null&&isMediaDiff(file),ref=useSectionRef(file.name,track,file,layout,mounted&&!media);let body;if(media)body=jsxRuntimeExports.jsx(MediaDiff,{file,cwd:mediaCwd});else if(mounted)body=jsxRuntimeExports.jsx(ReviewableDiff,{fileDiff:file,diffStyle,wrap});else{let lines=0,fixed=HEADER_PX;file.hunks.forEach((h,i)=>{lines+=diffStyle==="split"?h.splitLineCount:h.unifiedLineCount,h.collapsedBefore>0&&(fixed+=SEPARATOR_PX+SPACING_PX+(i>0?SPACING_PX:0))}),file.hunks.length>0&&(fixed+=SPACING_PX),body=jsxRuntimeExports.jsx(DiffPlaceholder,{seen:seenHeights.get(file)?.get(layout),lines,fixed})}return jsxRuntimeExports.jsx("section",{ref,"data-diff-key":file.name,className:"zg-diff-file",children:body})});WorkingSection.displayName="WorkingSection";const SessionSection=reactExports.memo(({group,mounted,diffStyle,wrap,track})=>{const layout=layoutOf(diffStyle,wrap),ref=useSectionRef(group.path,track,group.entries,layout,mounted);return jsxRuntimeExports.jsx("section",{ref,"data-diff-key":group.path,className:"zg-diff-file",children:mounted?group.entries.map(e=>jsxRuntimeExports.jsx("div",{className:"zg-diff-edit",children:jsxRuntimeExports.jsx(SessionDiff,{id:e.id,patch:e.patch,diffStyle,wrap})},e.id)):jsxRuntimeExports.jsx(DiffPlaceholder,{seen:seenHeights.get(group.entries)?.get(layout),lines:group.entries.reduce((n,e)=>n+lineCount(e.patch),0),fixed:32})})});SessionSection.displayName="SessionSection";function DiffPlaceholder({seen,lines,fixed}){const height=seen!==void 0?`${seen}px`:`calc(${fixed}px + ${lines} * var(--diffs-line-height, 20px))`;return jsxRuntimeExports.jsx("div",{"aria-hidden":!0,style:{height}})}function lineCount(patch){let n=0;for(let i=patch.indexOf(`
2
- `);i!==-1;i=patch.indexOf(`
3
- `,i+1))n++;return n}function DiffsTab({scope,useEdits=useNoEdits,useKeyScope=useNoKeyScope,chat=null,workingTreeRequest=0,onWorkingTreeTaken,createParseWorker,className,style}){const host=useFilesHost(),labels=useFilesLabels(),bound=typeof scope.session=="string",hasWorking=host.workingTreeDiff!==void 0,edits=useEdits(bound?scope.session:null),cwd=filesRootOf(scope)||null,[picked,setSource]=reactExports.useState(()=>workingTreeRequest>0||!bound?"working":"session"),source=bound&&hasWorking?picked:bound?"session":"working";reactExports.useEffect(()=>{workingTreeRequest&&(onWorkingTreeTaken?.(),setSource("working"))},[workingTreeRequest]);const sourceOptions=reactExports.useMemo(()=>[{value:"session",label:labels.filesSourceSession},{value:"working",label:labels.filesSourceWorking}],[labels]),[diffStyle,setDiffStyle]=reactExports.useState("unified"),[wrap,setWrap]=reactExports.useState(!1),[listOpen,setListOpen]=reactExports.useState(!0),sessionEntries=reactExports.useMemo(()=>collectSessionDiffs(edits),[edits]),sessionGroups=reactExports.useMemo(()=>groupByPath(sessionEntries),[sessionEntries]),tabShown=usePanelVisible(),working=useWorkingTreeDiff(scope,tabShown&&source==="working",createParseWorker),list=reactExports.useMemo(()=>source==="session"?sessionGroups.map(g=>({key:g.path,added:g.added,removed:g.removed})):(working??[]).map(f=>({key:f.name,...f.prevName&&f.prevName!==f.name?{prevPath:f.prevName}:{},...fileDiffCounts(f)})),[source,sessionGroups,working]),tree=reactExports.useMemo(()=>buildDiffTree(list,cwd),[list,cwd]),order=reactExports.useMemo(()=>fileOrder(tree).map(f=>f.key),[tree]),orderedSession=reactExports.useMemo(()=>{const byKey=new Map(sessionGroups.map(g=>[g.path,g]));return order.flatMap(k=>byKey.get(k)??[])},[order,sessionGroups]),orderedWorking=reactExports.useMemo(()=>{const byKey=new Map((working??[]).map(f=>[f.name,f]));return order.flatMap(k=>byKey.get(k)??[])},[order,working]),diffKeys=reactExports.useMemo(()=>source==="session"?orderedSession.map(g=>g.path):orderedWorking.map(f=>f.name),[source,orderedSession,orderedWorking]),win=useDiffWindow(diffKeys,source),{mounted,visible}=win,[collapsed,setCollapsed]=reactExports.useState(()=>new Set),rows=reactExports.useMemo(()=>visibleRows(tree,collapsed),[tree,collapsed]),toggleDir=reactExports.useCallback(path=>setCollapsed(prev=>{const next=new Set(prev);return next.delete(path)||next.add(path),next}),[]),stats=reactExports.useMemo(()=>({files:list.length,added:list.reduce((n,f)=>n+f.added,0),removed:list.reduce((n,f)=>n+f.removed,0)}),[list]),scroller=reactExports.useRef(null),winRoot=win.root,setScroller=reactExports.useCallback(el=>{scroller.current=el?.firstElementChild??null,winRoot(scroller.current)},[winRoot]),reducedMotion=useAppearanceReducedMotion(),stopScroll=reactExports.useRef(null),scrollTo=key=>{const root=scroller.current;root&&(stopScroll.current?.(),stopScroll.current=settleScroll(root,()=>win.element(key),{offset:0,smooth:!reducedMotion}))};reactExports.useEffect(()=>()=>stopScroll.current?.(),[]);const listRef=reactExports.useRef(null),listBrowsed=reactExports.useRef(!1),[listLeft,setListLeft]=reactExports.useState(0),onListBrowse=reactExports.useCallback(browsing=>{listBrowsed.current&&!browsing&&setListLeft(n=>n+1),browsing&&!listBrowsed.current&&listRef.current&&followerFor(listRef.current).stop(),listBrowsed.current=browsing},[]);reactExports.useEffect(()=>{const ul=listRef.current,browsing=listBrowsed.current&&ul?.matches(":hover");if(!ul||!listOpen||browsing||visible.size===0)return;let first=-1,last=-1;rows.forEach((n,i)=>{(n.kind==="file"?visible.has(n.key):collapsed.has(n.path)&&n.fileKeys.some(k=>visible.has(k)))&&(first<0&&(first=i),last=i)});const rowHeight=ul.querySelector(":scope > li[data-row]")?.offsetHeight;if(first<0||!rowHeight)return;const top=first*rowHeight,bottom=(last+1)*rowHeight,pad=8,follow=followerFor(ul),viewTop=follow.target()??ul.scrollTop,viewBottom=viewTop+ul.clientHeight;let next=null;bottom-top>ul.clientHeight-pad*2||top<viewTop+pad?next=top-pad:bottom>viewBottom-pad&&(next=bottom-ul.clientHeight+pad),next!==null&&(next=Math.max(0,Math.min(next,ul.scrollHeight-ul.clientHeight)),!(Math.abs(next-viewTop)<1)&&follow.to(next,reducedMotion))},[visible,rows,collapsed,listOpen,reducedMotion,listLeft]);const filePaths=reactExports.useMemo(()=>source==="session"?sessionGroups.map(g=>g.path):(working??[]).map(f=>f.name),[source,sessionGroups,working]),findings=useFilesDiagnostics(cwd,filePaths,source==="session"?edits.length:working),findParts=()=>source==="session"?orderedSession.flatMap(g=>g.entries.map((e,j)=>{const diff=parseSessionPatch(e.id,e.patch);return{part:`${g.path}#${j}`,lines:diff?diffLines(diff):[]}})):orderedWorking.map(f=>({part:`${f.name}#0`,lines:diffLines(f)})),find=useFind({parts:findParts,version:source==="session"?orderedSession:orderedWorking,surfaces:()=>[...win.elements()].flatMap(([key,section])=>[...section.querySelectorAll("diffs-container")].flatMap((host2,j)=>host2.shadowRoot?[{part:`${key}#${j}`,root:host2.shadowRoot}]:[])),scroller:()=>scroller.current,fallback:m=>win.element(m.part.slice(0,m.part.lastIndexOf("#"))),smooth:!reducedMotion}),[searchOpen,setSearchOpen]=reactExports.useState(!1),[searchAsk,setSearchAsk]=reactExports.useState(0),findPartsRef=reactExports.useRef(findParts);findPartsRef.current=findParts;const searchNames=reactExports.useCallback((query,opts)=>nameMatches(order.map(k=>relativeTo(cwd,k)),query,opts),[order,cwd]),searchContents=reactExports.useCallback(async(query,opts)=>{const matches=[];let capped=!1;for(const{part,lines}of findPartsRef.current()){const path=relativeTo(cwd,part.slice(0,part.lastIndexOf("#")));for(const l of lines){const ranges=matchRanges(l.text,query,opts);if(ranges.length!==0){if(matches.length>=MAX_SEARCH_LINES){capped=!0;break}matches.push({path,line:l.line,text:l.text,ranges,part,side:l.side})}}if(capped)break}return{matches,capped,engine:"none"}},[cwd]),{jumpTo}=find,openSearchLine=reactExports.useCallback((m,query,opts)=>jumpTo(query,opts,{part:m.part??"",side:m.side??"new",line:m.line,start:m.ranges[0]?.start??0}),[jumpTo]),openSearchFile=reactExports.useCallback(path=>{const key=order.find(k=>relativeTo(cwd,k)===path);key&&scrollTo(key)},[order,cwd]),closeSearch=reactExports.useCallback(()=>setSearchOpen(!1),[]),current=reactExports.useRef(null),rootRef=reactExports.useRef(null);return useKeyScope(rootRef,{step:direction=>{const keys=order,from=current.current&&keys.includes(current.current)?current.current:keys.find(k=>visible.has(k)),next=steppedIndex(from?keys.indexOf(from):-1,keys.length,direction);return next<0?!1:(current.current=keys[next],scrollTo(keys[next]),!0)},close:()=>!0,find:mode=>order.length===0?!1:(mode==="files"?(setListOpen(!0),setSearchOpen(!0),setSearchAsk(n=>n+1)):find.show(),!0)}),jsxRuntimeExports.jsx(FilesChatContext.Provider,{value:chat,children:jsxRuntimeExports.jsxs("div",{ref:rootRef,className:`flex-1 min-h-0 flex flex-col${className?` ${className}`:""}`,style,children:[jsxRuntimeExports.jsxs("div",{role:"toolbar","aria-label":labels.filesDiffsToolbar,className:"shrink-0 flex items-center gap-2 px-2 h-10",children:[bound&&hasWorking?jsxRuntimeExports.jsx(Segmented,{size:"sm",ariaLabel:labels.filesDiffSource,value:source,onChange:setSource,options:sourceOptions}):jsxRuntimeExports.jsx("span",{className:"text-zg-meta text-[var(--zg-text-muted)] px-1",children:bound?labels.filesSourceSession:labels.filesSourceWorking}),stats.files>0&&jsxRuntimeExports.jsx(DiffCounts,{added:stats.added,removed:stats.removed}),jsxRuntimeExports.jsxs("div",{className:"zg-segment ml-auto shrink-0",children:[list.length>0&&jsxRuntimeExports.jsx(IconToggle,{active:listOpen,onClick:()=>setListOpen(v=>!v),icon:"i-ph-list-bullets",label:listOpen?labels.filesHideFileList:labels.filesShowFileList,badge:String(list.length)}),jsxRuntimeExports.jsx(IconToggle,{active:diffStyle==="split",onClick:()=>setDiffStyle(s=>s==="split"?"unified":"split"),icon:"i-ph-columns",label:labels.filesSplit}),jsxRuntimeExports.jsx(IconToggle,{active:wrap,onClick:()=>setWrap(w=>!w),icon:"i-ph-text-align-left",label:labels.filesWrap})]})]}),source==="working"&&working===null?jsxRuntimeExports.jsx(PanelLoading,{}):list.length===0?source==="session"?jsxRuntimeExports.jsx(PanelEmpty,{icon:"i-ph-git-diff",title:labels.filesNoChangesYet,hint:labels.filesNoChangesHint}):jsxRuntimeExports.jsx(PanelEmpty,{icon:"i-ph-git-diff",title:cwd?hasWorking?labels.filesWorkingTreeClean:labels.filesNoWorkingTree:bound?labels.filesSessionNoFolder:labels.filesNoFolder}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:`zg-collapse shrink-0 ${searchOpen?"max-h-[45%]":"max-h-[30%]"}`,"data-open":listOpen,children:jsxRuntimeExports.jsx("div",{className:"min-h-0 overflow-hidden flex flex-col",children:searchOpen?jsxRuntimeExports.jsx(SearchPanel,{label:labels.filesSearchInChanges,asked:searchAsk,names:searchNames,search:searchContents,onOpenFile:openSearchFile,onOpenLine:openSearchLine,onClose:closeSearch}):jsxRuntimeExports.jsx(DiffFileTree,{rows,visible,collapsed,findings,onToggle:toggleDir,onOpen:scrollTo,fileIcon:renderFileIcon,chevron:renderChevron,listRef,onBrowse:onListBrowse})})}),jsxRuntimeExports.jsxs("div",{className:"relative flex-1 min-h-0 flex flex-col",style:DIFF_HEADER_INSET,ref:setScroller,children:[jsxRuntimeExports.jsx(DiffScroller,{className:"flex-1 min-h-0 overflow-y-auto",contentClassName:"flex flex-col",children:source==="session"?orderedSession.map(g=>jsxRuntimeExports.jsx(SessionSection,{group:g,mounted:mounted.has(g.path),diffStyle,wrap,track:win.track},g.path)):orderedWorking.map(f=>jsxRuntimeExports.jsx(WorkingSection,{file:f,mounted:mounted.has(f.name),diffStyle,wrap,track:win.track,mediaCwd:cwd&&host.mediaUrl?cwd:null},f.name))}),jsxRuntimeExports.jsx(FindBar,{find,label:labels.filesFindInDiffs})]})]})]})})}SessionDiff.displayName="SessionDiff";export{DiffsTab};
@@ -1 +0,0 @@
1
- import{j as jsxRuntimeExports}from"./vendor-react-CxJ4vs-5.js";import{A as AnchoredTooltip,K as KeyCombo}from"./kit-C9O_D5xC.js";import"./vendor-motion-C2jPaSqL.js";import"./vendor-owxl31sT.js";import"./core-BbPUgmX7.js";import"./vendor-editor-gVJMCtGz.js";function IconButtonTip({anchor,label,shortcut,initial,pointerInside}){return jsxRuntimeExports.jsx(AnchoredTooltip,{anchor,initial,pointerInside,portal:!0,label:shortcut?jsxRuntimeExports.jsxs("span",{className:"inline-flex items-center gap-2",children:[label,jsxRuntimeExports.jsx(KeyCombo,{spec:shortcut.split("|")[0].trim(),size:"sm",physical:!0,spoken:!1})]}):label})}export{IconButtonTip};