omni-context-cli 0.0.96 → 0.0.98

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 (63) hide show
  1. package/README.md +9 -4
  2. package/README.zh-CN.md +10 -5
  3. package/dist/cli.js +7 -7
  4. package/dist/clients/extension.vsix +0 -0
  5. package/dist/clients/web/assets/App-ClEyOIsd.js +2 -0
  6. package/dist/clients/web/assets/{ImageWorkshop-BOjRCQhg.js → ImageWorkshop-C8SKenrA.js} +1 -1
  7. package/dist/clients/web/assets/{_baseUniq-CSlK-r-y.js → _baseUniq-B7aCoho4.js} +1 -1
  8. package/dist/clients/web/assets/{arc-BHcQ2-H-.js → arc-Cr6Qz7J4.js} +1 -1
  9. package/dist/clients/web/assets/{architectureDiagram-VXUJARFQ-DX5Y72ZD.js → architectureDiagram-VXUJARFQ-CS6eT7JZ.js} +1 -1
  10. package/dist/clients/web/assets/{blockDiagram-VD42YOAC-DPTqKNVY.js → blockDiagram-VD42YOAC-BVhAlpfw.js} +1 -1
  11. package/dist/clients/web/assets/{c4Diagram-YG6GDRKO-D1JBCOWQ.js → c4Diagram-YG6GDRKO-CfapaTYu.js} +1 -1
  12. package/dist/clients/web/assets/channel-2ckWZJ8t.js +1 -0
  13. package/dist/clients/web/assets/{chunk-4BX2VUAB-CHWoBAlX.js → chunk-4BX2VUAB-CykDGDtf.js} +1 -1
  14. package/dist/clients/web/assets/{chunk-55IACEB6-C64gHYvs.js → chunk-55IACEB6-H0-NjUu3.js} +1 -1
  15. package/dist/clients/web/assets/{chunk-B4BG7PRW-BSOuYme-.js → chunk-B4BG7PRW-B26dkZKM.js} +1 -1
  16. package/dist/clients/web/assets/{chunk-DI55MBZ5-C8ZzYxAo.js → chunk-DI55MBZ5-CxPj2PHh.js} +1 -1
  17. package/dist/clients/web/assets/{chunk-FMBD7UC4-BerZrvni.js → chunk-FMBD7UC4-DB6M-r48.js} +1 -1
  18. package/dist/clients/web/assets/{chunk-QN33PNHL-BUYVKrNV.js → chunk-QN33PNHL-dWgPBJyJ.js} +1 -1
  19. package/dist/clients/web/assets/{chunk-QZHKN3VN-DOI6e3Kk.js → chunk-QZHKN3VN-DRjdoHp7.js} +1 -1
  20. package/dist/clients/web/assets/{chunk-TZMSLE5B-DJAcr1xu.js → chunk-TZMSLE5B-DvrITfg3.js} +1 -1
  21. package/dist/clients/web/assets/classDiagram-2ON5EDUG-Da9paIBg.js +1 -0
  22. package/dist/clients/web/assets/classDiagram-v2-WZHVMYZB-Da9paIBg.js +1 -0
  23. package/dist/clients/web/assets/clone-Br3pq0at.js +1 -0
  24. package/dist/clients/web/assets/{cose-bilkent-S5V4N54A-D2TtPwTf.js → cose-bilkent-S5V4N54A-D--t7taP.js} +1 -1
  25. package/dist/clients/web/assets/{dagre-6UL2VRFP-BU9iCPUn.js → dagre-6UL2VRFP-DRSHy3Yp.js} +1 -1
  26. package/dist/clients/web/assets/{diagram-PSM6KHXK-Cfg_h6mH.js → diagram-PSM6KHXK-BPTmO_x7.js} +1 -1
  27. package/dist/clients/web/assets/{diagram-QEK2KX5R-CaxIDeaS.js → diagram-QEK2KX5R-2Pj8JMCp.js} +1 -1
  28. package/dist/clients/web/assets/{diagram-S2PKOQOG-DXU6Iyjb.js → diagram-S2PKOQOG-JHUdCspR.js} +1 -1
  29. package/dist/clients/web/assets/{erDiagram-Q2GNP2WA-ftuLyugF.js → erDiagram-Q2GNP2WA-Dy-mgJDl.js} +1 -1
  30. package/dist/clients/web/assets/{flowDiagram-NV44I4VS-BpGkh1yE.js → flowDiagram-NV44I4VS-MIbAory3.js} +1 -1
  31. package/dist/clients/web/assets/{ganttDiagram-JELNMOA3-BKqYFjp9.js → ganttDiagram-JELNMOA3-epMhE7bX.js} +1 -1
  32. package/dist/clients/web/assets/{gitGraphDiagram-NY62KEGX-rHXASPsg.js → gitGraphDiagram-NY62KEGX-C2DwL0rF.js} +1 -1
  33. package/dist/clients/web/assets/{graph-Ld2aQoA_.js → graph-B_cXarik.js} +1 -1
  34. package/dist/clients/web/assets/index-5d2Zh2Cu.css +1 -0
  35. package/dist/clients/web/assets/{index-BSPo2skZ.js → index-BhbpVvH6.js} +2 -2
  36. package/dist/clients/web/assets/{infoDiagram-WHAUD3N6-8Dcy3nHo.js → infoDiagram-WHAUD3N6-DRXrT4kO.js} +1 -1
  37. package/dist/clients/web/assets/{journeyDiagram-XKPGCS4Q-Bat7_9j0.js → journeyDiagram-XKPGCS4Q-DE_vTQLi.js} +1 -1
  38. package/dist/clients/web/assets/{kanban-definition-3W4ZIXB7-gsMM0euH.js → kanban-definition-3W4ZIXB7-CtVotnQj.js} +1 -1
  39. package/dist/clients/web/assets/{layout-Dd17n8J5.js → layout-DlKTD_Q2.js} +1 -1
  40. package/dist/clients/web/assets/{linear-nyXx_SQ-.js → linear-Bp6bodbQ.js} +1 -1
  41. package/dist/clients/web/assets/{min-uUwClZKs.js → min-DBCe67Ga.js} +1 -1
  42. package/dist/clients/web/assets/{mindmap-definition-VGOIOE7T-CkV4iRHY.js → mindmap-definition-VGOIOE7T-BEZSRzt2.js} +1 -1
  43. package/dist/clients/web/assets/{pieDiagram-ADFJNKIX-Bmy__nzs.js → pieDiagram-ADFJNKIX-CmX8krXH.js} +1 -1
  44. package/dist/clients/web/assets/{quadrantDiagram-AYHSOK5B-CqsSmIse.js → quadrantDiagram-AYHSOK5B-CT58RvpV.js} +1 -1
  45. package/dist/clients/web/assets/{requirementDiagram-UZGBJVZJ-YsvePC1f.js → requirementDiagram-UZGBJVZJ-B3PavuSM.js} +1 -1
  46. package/dist/clients/web/assets/{sankeyDiagram-TZEHDZUN-CnbjLupT.js → sankeyDiagram-TZEHDZUN-CuCeS6a-.js} +1 -1
  47. package/dist/clients/web/assets/{sequenceDiagram-WL72ISMW-CeazxNWE.js → sequenceDiagram-WL72ISMW-CYGUBZyh.js} +1 -1
  48. package/dist/clients/web/assets/{stateDiagram-FKZM4ZOC-Djzj8Gbk.js → stateDiagram-FKZM4ZOC-YMZHsiIh.js} +1 -1
  49. package/dist/clients/web/assets/stateDiagram-v2-4FDKWEC3-D6VBSDSs.js +1 -0
  50. package/dist/clients/web/assets/{timeline-definition-IT6M3QCI-BYT5pzX-.js → timeline-definition-IT6M3QCI-CaB2JJ-T.js} +1 -1
  51. package/dist/clients/web/assets/{treemap-KMMF4GRG-D0pwnOqN.js → treemap-KMMF4GRG-BW7EQ5mP.js} +1 -1
  52. package/dist/clients/web/assets/{useAppearance-grxjwaCv.js → useAppearance-ropGPNve.js} +1 -1
  53. package/dist/clients/web/assets/{xychartDiagram-PRI3JC2R-B0RSRTXj.js → xychartDiagram-PRI3JC2R-Cv3n2hw8.js} +1 -1
  54. package/dist/clients/web/index.html +2 -2
  55. package/dist/skills/cookbook/SKILL.md +1 -1
  56. package/package.json +2 -4
  57. package/dist/clients/web/assets/App-CPB0GzVq.js +0 -2
  58. package/dist/clients/web/assets/channel-DvnFEKmR.js +0 -1
  59. package/dist/clients/web/assets/classDiagram-2ON5EDUG-DXl6iSEE.js +0 -1
  60. package/dist/clients/web/assets/classDiagram-v2-WZHVMYZB-DXl6iSEE.js +0 -1
  61. package/dist/clients/web/assets/clone-wHsVzP16.js +0 -1
  62. package/dist/clients/web/assets/index-DnHyiLsK.css +0 -1
  63. package/dist/clients/web/assets/stateDiagram-v2-4FDKWEC3-D4OuhgRJ.js +0 -1
@@ -1 +1 @@
1
- import{R as e,j as o,u as n,r as t,a as i,b as a,c as l,d as r}from"./index-BSPo2skZ.js";import{I as s,P as d,C as c,a as u,n as v,b as m,s as h,S as p,c as g,T as b,d as f,u as x,e as w,f as y,g as N,L as k,h as C}from"./useAppearance-grxjwaCv.js";const I=o=>e.createElement("svg",Object.assign({viewBox:"0 0 24 24",width:"24",height:"24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},o),e.createElement("path",{d:"M7 2h10v2H7zM5 4h2v10H5zm12-2h2v12h-2z"}),e.createElement("path",{d:"M13 2h2v6h-2zM9 2h2v4H9zm-4 8h14v2H5zm2 4h10v2H7zm2 2h2v4H9zm4 0h2v4h-2zm-4 4h6v2H9z"})),M=o=>e.createElement("svg",Object.assign({viewBox:"0 0 24 24",width:"24",height:"24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},o),e.createElement("path",{d:"M21 15v4h-2v-4zm-2 4v2H5v-2zM5 15v4H3v-4zm8-12v14h-2V3z"}),e.createElement("path",{d:"M7 11v2h10v-2zm2 2v2h2v-2zm4 0v2h2v-2z"}),e.createElement("path",{d:"M15 11v2h2v-2z"})),z=o=>e.createElement("svg",Object.assign({viewBox:"0 0 24 24",width:"24",height:"24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},o),e.createElement("path",{d:"M4 4h6v2H4zm0 14h16v2H4zM20 8h2v10h-2zM2 6h2v12H2zm8 0h10v2H10z"})),S=o=>e.createElement("svg",Object.assign({viewBox:"0 0 24 24",width:"24",height:"24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},o),e.createElement("path",{d:"M7 2h4v2H7zM2 5h14v2H2zm9 2h2v2h-2zM9 9h2v2H9zm-2 2h2v2H7zM5 9h2v2H5zm4 4h2v2H9zm-4 0h2v2H5zm8 2h2v7h-2zm2-2h5v2h-5zm5 2h2v7h-2zm-5 2h5v2h-5z"}));function V({src:e,alt:n="",overlayUrl:t,children:i}){return o.jsxs("div",{className:"relative overflow-hidden",children:[o.jsx("img",{src:e,alt:n,className:"w-full block object-contain select-none pointer-events-none"}),t&&o.jsx("img",{src:t,alt:"",className:"absolute inset-0 w-full h-full object-contain pointer-events-none"}),i]})}function R({assets:e,dragging:i,paintingId:a,paintedMasks:l,canPaintMask:r,onAddFiles:v,onOpenFolder:m,onRemoveAsset:h,onPaintMask:p}){const g=n(),b=t.useRef(null);return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"block text-sm font-medium text-vscode-text",children:g.workshop.referenceImages}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(s,{icon:z,title:g.workshop.folder,onClick:m,className:"hidden md:inline-flex p-1 text-vscode-accent hover:opacity-80"}),o.jsx("input",{ref:b,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:function(e){e.target.files&&v(e.target.files),e.target.value=""}}),o.jsx(s,{icon:d,title:g.workshop.dropImages,onClick:()=>{var e;return null==(e=b.current)?void 0:e.click()},className:"p-1 text-vscode-accent hover:opacity-80"})]})]}),e.length>0&&o.jsx("div",{className:"space-y-2",children:e.map(e=>{var n;return o.jsxs("div",{className:"relative group min-w-0 border border-dashed border-vscode-border",children:[o.jsx("div",{className:"bg-vscode-bg p-1",children:o.jsx(V,{src:e.url,alt:e.fileName||g.workshop.referenceImageAlt,overlayUrl:(null==(n=l.get(e.id))?void 0:n.overlayUrl)??null})}),o.jsxs("div",{className:"absolute top-1 right-1 flex items-center gap-1 opacity-100 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100 transition-opacity",children:[r&&o.jsx(s,{icon:I,title:g.workshop.paintMask,onClick:()=>p(e.id),className:"p-1 bg-vscode-bg/80 "+(a===e.id?"text-vscode-accent":"hover:text-vscode-accent")}),o.jsx(s,{icon:c,title:g.workshop.removeImage,onClick:()=>h(e.id),className:"p-1 bg-vscode-bg/80 hover:text-vscode-error"})]}),o.jsx("div",{className:"p-1 text-[10px] text-vscode-text-muted truncate",children:e.fileName})]},e.id)})}),o.jsxs("div",{className:`border border-dashed flex items-center justify-center text-vscode-text-muted text-sm gap-2 text-center px-4 ${0===e.length?"h-40 flex-col leading-relaxed":"h-10"} ${i?"border-vscode-accent bg-vscode-element":"border-vscode-border bg-vscode-bg"}`,children:[0===e.length&&o.jsx(u,{width:32,height:32}),o.jsx("span",{children:g.workshop.dropImages})]})]})}function j(e,o){if(!e||"auto"===e)return null;const n=e.match(/^(\d+)x(\d+)$/);if(!n)return"Use WIDTHxHEIGHT, for example 1536x1024.";const t=Number(n[1]),i=Number(n[2]),a=Math.max(t,i),l=Math.min(t,i),r=t*i;return t%o.multipleOf!==0||i%o.multipleOf!==0?`Both edges must be multiples of ${o.multipleOf}.`:a>o.maxLongEdge?`The longest edge must be ${o.maxLongEdge}px or less.`:a/l>o.maxRatio?`The aspect ratio must not exceed ${o.maxRatio}:1.`:r<o.minPixels||r>o.maxPixels?`Total pixels must be between ${o.minPixels.toLocaleString()} and ${o.maxPixels.toLocaleString()}.`:null}function P(e){return"image/jpeg"===e?".jpg":"image/webp"===e?".webp":"video/mp4"===e?".mp4":"video/webm"===e?".webm":"video/quicktime"===e?".mov":".png"}function A(e){const o=e.match(/^data:([^;]+);base64,(.+)$/s);return o?{mediaType:o[1],base64:o[2]}:null}function O(){var e,o;try{const n=null==(o=null==(e=globalThis.crypto)?void 0:e.randomUUID)?void 0:o.call(e);if(n)return n}catch{}return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function $(e){return new Promise((o,n)=>{const t=new Image;t.onload=()=>o(t),t.onerror=()=>n(new Error("Failed to load image")),t.src=e})}function T({children:e,onClick:n,disabled:t,variant:i="secondary",className:a="",href:l,download:r}){const s=`inline-flex items-center justify-center gap-2 px-3 py-2.5 border border-dashed text-xs font-bold uppercase tracking-wider transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-vscode-accent ${"primary"===i?"bg-vscode-accent text-white border-vscode-accent hover:opacity-90":"danger"===i?"text-vscode-error border-vscode-error/60 hover:bg-vscode-error/10":"text-vscode-text border-vscode-border hover:bg-vscode-element"} ${t?"opacity-50 cursor-not-allowed":"cursor-pointer"} ${a}`;return l&&!t?o.jsx("a",{href:l,download:r,className:s,children:e}):o.jsx("button",{type:"button",onClick:n,disabled:t,className:s,children:e})}function H({item:e,onReuse:t,onRemove:i}){const a=n(),l=e.revisedPrompt||e.prompt,r=!!l.trim(),u=e.mimeType.startsWith("video/");return o.jsxs("article",{className:"relative group border border-dashed border-vscode-border bg-vscode-sidebar min-w-0",children:[o.jsx("div",{className:"bg-vscode-bg p-2 flex items-center justify-center",children:u?o.jsx("video",{src:e.url,controls:!0,playsInline:!0,preload:"auto",className:"block w-full max-h-[70vh]"}):o.jsx("img",{src:e.url,alt:r?l:a.workshop.resultImageAlt,className:"block w-full max-h-[70vh] object-contain"})}),o.jsx("div",{className:"absolute top-1 right-1 opacity-100 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100 transition-opacity",children:o.jsx(s,{icon:c,title:a.workshop.removeFromResults,onClick:()=>i(e.id),className:"p-1 bg-vscode-bg/80 hover:text-vscode-error"})}),o.jsxs("div",{className:"p-3 space-y-3 min-w-0",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs text-vscode-text-muted min-w-0",children:[o.jsx("span",{className:"uppercase shrink-0",children:e.kind}),o.jsx("span",{className:"truncate",children:e.model})]}),r&&o.jsx("p",{className:"text-xs text-vscode-text-muted line-clamp-2",children:l}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 min-w-0",children:[o.jsxs(T,{href:e.url,download:`${u?"video":"image"}-${e.id}${P(e.mimeType)}`,className:"min-w-0",children:[o.jsx(M,{width:14,height:14}),a.workshop.download]}),!u&&o.jsxs(T,{onClick:()=>t(e),children:[o.jsx(d,{width:14,height:14}),a.workshop.reuse]}),r&&o.jsxs(T,{onClick:async function(){try{await navigator.clipboard.writeText(l)}catch{return void h(a.actions.copyFailed,"error")}h(a.workshop.promptCopied,"success")},children:[o.jsx(m,{width:14,height:14}),a.workshop.copyPrompt]})]})]})]})}function E({baseImage:e,mask:i,paintOverlayUrl:a,onMaskChange:l,onDone:r}){const s=n(),d=t.useRef(null),c=t.useRef(void 0),u=t.useRef(null),[v,m]=t.useState(48),[h,p]=t.useState(!1),[g,b]=t.useState(!1);function f(o){if(!e)return;const n=o.currentTarget,t=n.getContext("2d");if(!t)return;const{x:i,y:a}=function(e,o){const n=o.getBoundingClientRect();return{x:(e.clientX-n.left)/n.width*o.width,y:(e.clientY-n.top)/n.height*o.height}}(o,n),l=n.width/n.getBoundingClientRect().width;t.fillStyle="rgba(255,255,255,0.55)",t.beginPath(),t.arc(i,a,v*l/2,0,2*Math.PI),t.fill(),b(!0)}function x(){const o=d.current;if(!o||!e||!g)return void l(null,null);const n=o.toDataURL("image/png");u.current=n;const t=document.createElement("canvas");t.width=o.width,t.height=o.height;const i=t.getContext("2d"),a=o.getContext("2d");if(!i||!a)return;const r=a.getImageData(0,0,o.width,o.height),s=i.createImageData(o.width,o.height);for(let e=0;e<r.data.length;e+=4){const o=r.data[e+3]>0;s.data[e]=255,s.data[e+1]=255,s.data[e+2]=255,s.data[e+3]=o?0:255}i.putImageData(s,0,0);const c=t.toDataURL("image/png"),v=A(c);v&&l({id:O(),base64:v.base64,mediaType:v.mediaType,fileName:"mask.png",url:c,width:o.width,height:o.height},n)}return t.useEffect(()=>{const o=d.current;if(!o||!(null==e?void 0:e.width)||!(null==e?void 0:e.height))return;if(c.current===e.id)return;c.current=e.id,o.width=e.width,o.height=e.height;const n=o.getContext("2d");n&&(n.clearRect(0,0,o.width,o.height),b(!1))},[null==e?void 0:e.id]),t.useEffect(()=>{const o=d.current;if(!o||!e||!a)return;if(a===u.current)return;const n=o.getContext("2d");if(!n)return;const t=new Image;t.onload=()=>{n.clearRect(0,0,o.width,o.height),n.drawImage(t,0,0,o.width,o.height),b(!0)},t.src=a},[e,a]),e?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"bg-vscode-bg p-2",children:o.jsx(V,{src:e.url,alt:e.fileName||s.workshop.referenceImageAlt,children:o.jsx("canvas",{ref:d,className:"absolute inset-0 w-full h-full cursor-crosshair touch-none",onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),p(!0),f(e)},onPointerMove:e=>{h&&f(e)},onPointerUp:e=>{p(!1),e.currentTarget.releasePointerCapture(e.pointerId),x()},onPointerCancel:()=>{p(!1),x()}})})}),o.jsxs("div",{className:"p-3 space-y-3",children:[o.jsxs("label",{className:"block space-y-2",children:[o.jsx("span",{className:"block text-sm font-medium text-vscode-text",children:s.workshop.brushSize}),o.jsx("input",{type:"range",min:8,max:160,value:v,onChange:e=>m(Number(e.target.value)),className:"pixel-range w-full"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(T,{onClick:r,children:s.workshop.done}),o.jsx(T,{onClick:function(){const e=d.current,o=null==e?void 0:e.getContext("2d");e&&o&&o.clearRect(0,0,e.width,e.height),b(!1),l(null,null)},disabled:!g&&!i,children:s.workshop.clear})]})]})]}):null}function F({options:e,value:n,onChange:t}){const i=1===e.length?"grid-cols-1":"grid-cols-2";return o.jsx("div",{className:`grid ${i} gap-1 bg-vscode-element border border-dashed border-vscode-border p-1`,children:e.map(e=>o.jsx("button",{type:"button",onClick:()=>t(e.value),className:"p-2 text-xs font-bold uppercase cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-vscode-accent "+(n===e.value?"bg-vscode-accent text-white":"text-vscode-text-muted hover:text-vscode-text hover:bg-vscode-bg/60"),children:e.label},e.value))})}function D({label:e,children:n,hint:t}){return o.jsxs("label",{className:"block space-y-2",children:[o.jsx("span",{className:"block text-sm font-medium text-vscode-text",children:e}),n,t&&o.jsx("span",{className:"block text-xs text-vscode-text-muted leading-relaxed",children:t})]})}function W({options:e,capabilities:i,onClose:a,onSave:l}){const r=n(),s=r.workshop,[d,v]=t.useState("output"),[m,h]=t.useState(e),x=t.useMemo(()=>(null==i?void 0:i.openaiImageSizeConstraints)?function(e,o){return[{value:"auto",label:o.auto},...e.presets.map(e=>({value:e,label:e.replace("x"," x ")})),{value:"custom",label:o.custom}]}(i.openaiImageSizeConstraints,s):[{value:"auto",label:s.auto}],[null==i?void 0:i.openaiImageSizeConstraints,s]),w=null==i?void 0:i.openaiImageSizeConstraints,y="custom"===m.openaiImageSize?m.openaiImageCustomSize:m.openaiImageSize,N=w?j(y,w):null,k=!!w&&function(e,o){const n=e.match(/^(\d+)x(\d+)$/);return!!n&&Number(n[1])*Number(n[2])>o.experimentalAbove}(y,w),C=N||(k?s.experimentalSize:void 0),I=(null==i?void 0:i.googleImageAspectRatios)??(null==i?void 0:i.googleVideoAspectRatios)??(null==i?void 0:i.xaiVideoAspectRatios)??(null==i?void 0:i.xaiImageAspectRatios),M=(null==i?void 0:i.googleImageSizes)??(null==i?void 0:i.googleVideoResolutions)??(null==i?void 0:i.xaiVideoResolutions)??(null==i?void 0:i.xaiImageResolutions),z=(null==i?void 0:i.googleImageAspectRatios)?m.googleImageAspectRatio:(null==i?void 0:i.googleVideoAspectRatios)?m.googleVideoAspectRatio:(null==i?void 0:i.xaiVideoAspectRatios)?m.xaiVideoAspectRatio:m.xaiImageAspectRatio,S=(null==i?void 0:i.googleImageSizes)?m.googleImageSize:(null==i?void 0:i.googleVideoResolutions)?m.googleVideoResolution:(null==i?void 0:i.xaiVideoResolutions)?m.xaiVideoResolution:m.xaiImageResolution,V=(null==i?void 0:i.googleImageAspectRatios)?"googleImageAspectRatio":(null==i?void 0:i.googleVideoAspectRatios)?"googleVideoAspectRatio":(null==i?void 0:i.xaiVideoAspectRatios)?"xaiVideoAspectRatio":"xaiImageAspectRatio",R=(null==i?void 0:i.googleImageSizes)?"googleImageSize":(null==i?void 0:i.googleVideoResolutions)?"googleVideoResolution":(null==i?void 0:i.xaiVideoResolutions)?"xaiVideoResolution":"xaiImageResolution",P=[{id:"output",label:s.output,icon:u},{id:"preferences",label:s.preferences,icon:p}];function A(e,o){h(n=>({...n,[e]:o}))}return o.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 animate-fade-in",children:o.jsxs("div",{className:"bg-vscode-sidebar border border-dashed border-vscode-border w-full max-w-lg overflow-hidden m-4",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-dashed border-vscode-border bg-vscode-element/50",children:[o.jsx("h2",{className:"text-sm font-bold text-vscode-text-header uppercase tracking-widest",children:r.settings.title}),o.jsx("button",{type:"button",onClick:a,className:"text-vscode-text-muted hover:text-vscode-text p-1 hover:bg-vscode-border transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-vscode-accent",children:o.jsx(c,{width:18,height:18})})]}),o.jsx("div",{className:"flex border-b border-dashed border-vscode-border",children:P.map(e=>o.jsxs("button",{type:"button",onClick:()=>v(e.id),className:"flex-1 flex items-center justify-center gap-2 px-4 py-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-vscode-accent "+(d===e.id?"text-vscode-accent border-b-2 border-vscode-accent":"text-vscode-text-muted hover:text-vscode-text"),children:[o.jsx(e.icon,{width:16,height:16}),o.jsx("span",{children:e.label})]},e.id))}),o.jsxs("div",{className:"p-6 space-y-5 max-h-[60vh] overflow-y-auto",children:["output"===d&&o.jsxs(o.Fragment,{children:[w&&o.jsx(g,{label:s.size,value:m.openaiImageSize,onChange:e=>A("openaiImageSize",e),options:x,description:"custom"!==m.openaiImageSize?C:void 0}),w&&"custom"===m.openaiImageSize&&o.jsx(D,{label:s.customSize,hint:C||s.sizeMultipleHint(w.multipleOf),children:o.jsx("input",{value:m.openaiImageCustomSize,onChange:e=>A("openaiImageCustomSize",e.target.value),placeholder:"1536x1024",className:"w-full px-4 py-2.5 bg-vscode-bg border border-dashed border-vscode-border text-sm text-vscode-text focus:outline-none focus:border-vscode-accent focus-visible:ring-1 focus-visible:ring-vscode-accent disabled:opacity-60 disabled:cursor-not-allowed","aria-invalid":!!N})}),(null==i?void 0:i.xaiVideoSupportsMode)&&o.jsx(g,{label:s.videoMode,value:m.xaiVideoMode,onChange:e=>A("xaiVideoMode",e),options:[{value:"image-to-video",label:s.imageToVideo},{value:"reference-to-video",label:s.referenceToVideo}]}),I&&o.jsx(g,{label:s.aspectRatio,value:z,onChange:e=>A(V,e),options:I.map(e=>({value:e,label:"auto"===e?s.auto:e}))}),M&&o.jsx(g,{label:s.resolution,value:S,onChange:e=>A(R,e),options:M.map(e=>({value:e,label:"auto"===e?s.auto:e}))}),((null==i?void 0:i.googleVideoSupportsDuration)||(null==i?void 0:i.xaiVideoSupportsDuration))&&o.jsx(g,{label:s.duration,value:String(i.googleVideoSupportsDuration?m.googleVideoDuration:m.xaiVideoDuration),onChange:e=>A(i.googleVideoSupportsDuration?"googleVideoDuration":"xaiVideoDuration",Number(e)),options:Array.from({length:15},(e,o)=>{const n=String(o+1);return{value:n,label:n}})}),(null==i?void 0:i.googleVideoSupportsAudio)&&o.jsx(b,{label:s.audio,description:s.audioDescription,enabled:m.googleVideoGenerateAudio,onChange:e=>A("googleVideoGenerateAudio",e)}),(null==i?void 0:i.googleVideoSupportsEnhancePrompt)&&o.jsx(b,{label:s.enhancePrompt,description:s.enhancePromptDescription,enabled:m.googleVideoEnhancePrompt,onChange:e=>A("googleVideoEnhancePrompt",e)}),(null==i?void 0:i.googleVideoPersonGenerations)&&o.jsx(g,{label:s.personGeneration,value:m.googleVideoPersonGeneration,onChange:e=>A("googleVideoPersonGeneration",e),options:i.googleVideoPersonGenerations.map(e=>({value:e,label:"auto"===e?s.auto:e}))}),(null==i?void 0:i.googleVideoSupportsFps)&&o.jsx(g,{label:s.fps,value:String(m.googleVideoFps),onChange:e=>A("googleVideoFps",Number(e)),options:[12,15,24,25,30,48,50,60,120,240].map(e=>({value:String(e),label:String(e)}))}),(null==i?void 0:i.openaiImageSupportsQuality)&&o.jsx(g,{label:s.quality,value:m.openaiImageQuality,onChange:e=>A("openaiImageQuality",e),options:[{value:"auto",label:s.auto},{value:"low",label:s.qualityLow},{value:"medium",label:s.qualityMedium},{value:"high",label:s.qualityHigh}]}),(null==i?void 0:i.openaiImageSupportsOutputFormat)&&o.jsx(g,{label:s.format,value:m.openaiImageOutputFormat,onChange:e=>A("openaiImageOutputFormat",e),options:[{value:"png",label:"PNG"},{value:"jpeg",label:"JPEG"},{value:"webp",label:"WebP"}]}),(null==i?void 0:i.openaiImageSupportsCompression)&&"png"!==m.openaiImageOutputFormat&&o.jsx(g,{label:s.compression,value:String(m.openaiImageOutputCompression),onChange:e=>A("openaiImageOutputCompression",Number(e)),options:Array.from({length:21},(e,o)=>{const n=String(5*o);return{value:n,label:n}})}),(null==i?void 0:i.openaiImageSupportsBackground)&&o.jsx(g,{label:s.background,value:m.openaiImageBackground,onChange:e=>A("openaiImageBackground",e),options:[{value:"auto",label:s.auto},{value:"opaque",label:s.opaque}]}),(null==i?void 0:i.openaiImageSupportsModeration)&&o.jsx(g,{label:s.moderation,value:m.openaiImageModeration,onChange:e=>A("openaiImageModeration",e),options:[{value:"auto",label:s.auto},{value:"low",label:s.low}]}),((null==i?void 0:i.openaiImageSupportsMultipleOutputs)||(null==i?void 0:i.xaiImageSupportsMultipleOutputs))&&o.jsx(g,{label:s.images,value:String(i.xaiImageSupportsMultipleOutputs?m.xaiImageCount:m.openaiImageCount),onChange:e=>A(i.xaiImageSupportsMultipleOutputs?"xaiImageCount":"openaiImageCount",Number(e)),options:Array.from({length:10},(e,o)=>{const n=String(o+1);return{value:n,label:n}})})]}),"preferences"===d&&o.jsx(b,{label:s.privacyMode,description:s.privacyModeDescription,enabled:m.privacyMode,onChange:e=>A("privacyMode",e)})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-6 py-4 border-t border-dashed border-vscode-border bg-vscode-element/30",children:[o.jsx("button",{type:"button",onClick:a,className:"px-4 py-2 text-xs font-bold text-vscode-text hover:bg-vscode-border transition-colors uppercase tracking-wider",children:r.settings.cancel}),o.jsxs("button",{type:"button",onClick:function(){l(m),a()},disabled:!!N,className:"px-6 py-2 text-xs font-bold bg-vscode-accent text-white hover:brightness-110 transition-colors uppercase tracking-wider border border-dashed border-vscode-accent/50 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:[o.jsx(f,{width:16,height:16}),o.jsx("span",{children:r.settings.save})]})]})]})})}function G(e){return{base64:e.base64,mediaType:e.mediaType,fileName:e.fileName}}async function B(){const e=await i(a("imageWorkshop/config"));if(!e.ok)throw new Error("Failed to load image workshop config");return e.json()}async function q(){const e=await i(a("imageWorkshop/session"));if(!e.ok)throw new Error("Failed to load workshop session");return e.json()}async function U(){const e=await i(a("imageWorkshop/sessions"));return e.ok?e.json():[]}function J(e=null){var o;return{privacyMode:!1,openaiImageCount:1,openaiImageSize:"auto",openaiImageCustomSize:(null==(o=null==e?void 0:e.openaiImageSizeConstraints)?void 0:o.presets[0])??"",openaiImageQuality:"auto",openaiImageOutputFormat:"png",openaiImageOutputCompression:100,openaiImageBackground:"auto",openaiImageModeration:"auto",googleImageAspectRatio:"auto",googleImageSize:"auto",googleVideoDuration:8,googleVideoAspectRatio:"auto",googleVideoResolution:"auto",googleVideoGenerateAudio:!1,googleVideoEnhancePrompt:!1,googleVideoPersonGeneration:"auto",googleVideoFps:24,xaiImageCount:1,xaiImageAspectRatio:"auto",xaiImageResolution:"auto",xaiVideoMode:"image-to-video",xaiVideoDuration:8,xaiVideoAspectRatio:"auto",xaiVideoResolution:"auto"}}function Q(e){return e.type.startsWith("image/")||/\.(avif|gif|heic|heif|jpe?g|png|webp)$/i.test(e.name)}function L(){const e=r(e=>e.getConfig),d=r(e=>{var o;return null==(o=e.config)?void 0:o.projectName}),m=r(e=>{var o;return null==(o=e.config)?void 0:o.workLanguage}),[p,b]=t.useState(null),[f,I]=t.useState(!0),[M,z]=t.useState(null),[V,T]=t.useState(""),[D,L]=t.useState([]),[K,X]=t.useState("generate"),[Y,Z]=t.useState(""),[_,ee]=t.useState(""),[oe,ne]=t.useState([]),[te,ie]=t.useState([]),[ae,le]=t.useState(!1),[re,se]=t.useState(!1),[de,ce]=t.useState(!1),[ue,ve]=t.useState("input"),[me,he]=t.useState(!1),[pe,ge]=t.useState(()=>J()),be=t.useRef(null),fe=t.useRef(null),xe=t.useRef(null),we=t.useRef(!1),[ye,Ne]=t.useState(null),[ke,Ce]=t.useState(new Map),Ie=n();x(),t.useEffect(()=>{e().catch(()=>{}),Promise.all([B(),q(),U()]).then(([e,o,n])=>{b(e);const t=e.imageModels.find(o=>o.id===e.defaultImageModelId)??null;ee(e.defaultImageModelId||""),ge(J((null==t?void 0:t.capabilities)??null)),z(o.id),T(o.title),ie(o.items),L(n)}).catch(e=>h(e instanceof Error?e.message:String(e),"error")).finally(()=>I(!1))},[]),t.useEffect(()=>{document.title=d?`${d} - ${Ie.workshop.title}`:Ie.workshop.title},[d,Ie.workshop.title]),t.useEffect(()=>{if(!be.current)return;be.current.style.height="auto";const e=Math.max(160,Math.min(be.current.scrollHeight,640));be.current.style.height=`${e}px`},[Y]);const Me=(null==p?void 0:p.imageModels.find(e=>e.id===_))??null,ze=(null==Me?void 0:Me.capabilities)??null,Se=(null==ze?void 0:ze.maxReferenceImages)??10,Ve=!!(null==ze?void 0:ze.supportsMask),Re=!!(null==ze?void 0:ze.supportsEditing),je=!!(null==ze?void 0:ze.supportsGenerationReferences),Pe=Ve?oe.find(e=>ke.has(e.id)):void 0,Ae=Pe?ke.get(Pe.id).mask:null,Oe=Pe?[Pe,...oe.filter(e=>e.id!==Pe.id)]:oe,$e="custom"===pe.openaiImageSize?pe.openaiImageCustomSize:pe.openaiImageSize,Te=(null==ze?void 0:ze.openaiImageSizeConstraints)?j($e,ze.openaiImageSizeConstraints):null,He=!ae&&!re&&!f&&!!_&&!!Y.trim()&&!Te&&("edit"!==K||Re&&oe.length>0),Ee=m&&"disabled"!==m&&!ae&&!re&&!!Y.trim(),Fe=ye?oe.find(e=>e.id===ye)??null:null,De=Fe?ke.get(Fe.id):void 0,We=Ve&&De?De.mask:null,Ge=(null==De?void 0:De.overlayUrl)??null;function Be(e){var o;null==(o=("input"===e?fe:xe).current)||o.scrollTo({top:0,behavior:"smooth"})}function qe(e){ve(e),requestAnimationFrame(()=>Be(e))}function Ue(){ne([]),Ce(new Map),Ne(null),X("generate"),Z("")}async function Je(e){const o=Array.from(e).filter(Q);if(0===o.length)return;X(je&&!Re?"generate":"edit"),qe("input");const n=(await Promise.allSettled(o.map(e=>async function(e){const o=await new Promise((o,n)=>{const t=new FileReader;t.onload=e=>{var n;return o(String(null==(n=e.target)?void 0:n.result))},t.onerror=()=>n(t.error),t.readAsDataURL(e)}),n=A(o);if(!n)throw new Error("Invalid image file");const t=await v(o,n.mediaType,e.name),i=(null==t?void 0:t.dataUrl)??o,a=await $(i);return{id:O(),base64:(null==t?void 0:t.base64)??n.base64,mediaType:(null==t?void 0:t.mediaType)??n.mediaType,fileName:(null==t?void 0:t.fileName)??e.name,url:i,width:a.naturalWidth,height:a.naturalHeight}}(e)))).filter(e=>"fulfilled"===e.status).map(e=>e.value);0!==n.length&&ne(e=>{const o=Math.max(0,Se-e.length);return n.length>o&&h(Ie.workshop.maxReferences(Se),"info"),[...e,...n].slice(0,Se)})}async function Qe(e){if(Re||je)try{const o=await async function(e){try{const o=await fetch(e.url),n=await o.blob(),t=await new Promise(e=>{const o=new FileReader;o.onloadend=()=>e(o.result),o.readAsDataURL(n)}),i=A(t);if(!i)return null;const a=await $(t);return{id:O(),base64:i.base64,mediaType:i.mediaType,fileName:`${e.id}${P(i.mediaType)}`,url:t,width:a.naturalWidth,height:a.naturalHeight}}catch{return null}}(e);if(!o)return void h(Ie.workshop.reuseFailed,"error");X(je&&!Re?"generate":"edit"),ne(e=>[o,...e].slice(0,Se)),qe("input"),h(Ie.workshop.reuseToast,"success")}catch(o){h(o instanceof Error?o.message:String(o),"error")}}async function Le(e){const o=te.find(o=>o.id===e);if(ie(o=>o.filter(o=>o.id!==e)),!(null==o?void 0:o.transient))try{await async function(e){if(!(await i(a("imageWorkshop/item/remove"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})})).ok)throw new Error("Failed to remove item")}(e)}catch(n){const e=await q().catch(()=>null);e&&ie(e.items),h(n instanceof Error?n.message:String(n),"error")}}return o.jsxs("div",{className:"h-full flex flex-col bg-vscode-bg text-vscode-text text-sm overflow-hidden",onDragOver:e=>{e.preventDefault(),ce(!0)},onDragLeave:function(e){const o=e.relatedTarget;o instanceof Node&&e.currentTarget.contains(o)||ce(!1)},onDrop:function(e){e.preventDefault(),ce(!1),Je(e.dataTransfer.files)},children:[o.jsx("header",{className:"safe-area-top flex-none pb-2 bg-vscode-bg z-10 px-4 border-b border-dashed border-vscode-border",children:o.jsxs("div",{className:"flex items-center justify-between gap-4 w-full",children:[o.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1 max-w-[min(48rem,60vw)]",children:o.jsx(w,{icon:u,title:pe.privacyMode?Ie.workshop.privateSession:V||Ie.workshop.newSession,sessions:D,currentId:M,emptyText:Ie.workshop.noSessions,newTitle:Ie.workshop.newSession,onSelect:async function(e){try{const o=await async function(e){const o=await i(a("imageWorkshop/session/load"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})});if(!o.ok)throw new Error("Session not found");return o.json()}(e.id);z(o.id),T(o.title),ie(o.items),Ue(),requestAnimationFrame(()=>Be("input"))}catch(o){h(o instanceof Error?o.message:String(o),"error")}},onNew:async function(){try{const e=await async function(){const e=await i(a("imageWorkshop/session/new"),{method:"POST"});if(!e.ok)throw new Error("Failed to create session");return e.json()}();z(e.id),T(e.title),ie([]),Ue(),requestAnimationFrame(()=>Be("input"))}catch(e){h(e instanceof Error?e.message:String(e),"error")}},disabled:ae})}),o.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[ae?o.jsx(s,{icon:c,title:Ie.workshop.stop,onClick:async function(){we.current=!0,await async function(){await i(a("imageWorkshop/stop"),{method:"POST"})}().catch(()=>{}),le(!1)}}):o.jsx(s,{icon:y,title:Ie.workshop.run,onClick:async function(){if(!He||!ze)return;we.current=!1,Ne(null),qe("results"),le(!0);const e="generate"===K?"generate":"edit";try{const o=[];await async function(e,o,n,t){var r;const s={modelId:o.modelId,prompt:o.prompt,...(d=o.options,c=o.capabilities,{privacyMode:d.privacyMode,openaiImageCount:c.openaiImageSupportsMultipleOutputs?d.openaiImageCount:void 0,openaiImageSize:c.openaiImageSizeConstraints?"custom"===d.openaiImageSize?d.openaiImageCustomSize:d.openaiImageSize:void 0,openaiImageQuality:c.openaiImageSupportsQuality?d.openaiImageQuality:void 0,openaiImageOutputFormat:c.openaiImageSupportsOutputFormat?d.openaiImageOutputFormat:void 0,openaiImageOutputCompression:c.openaiImageSupportsCompression?d.openaiImageOutputCompression:void 0,openaiImageBackground:c.openaiImageSupportsBackground?d.openaiImageBackground:void 0,openaiImageModeration:c.openaiImageSupportsModeration?d.openaiImageModeration:void 0,googleImageAspectRatio:c.googleImageAspectRatios?d.googleImageAspectRatio:void 0,googleImageSize:c.googleImageSizes?d.googleImageSize:void 0,googleVideoDuration:c.googleVideoSupportsDuration?d.googleVideoDuration:void 0,googleVideoAspectRatio:c.googleVideoAspectRatios?d.googleVideoAspectRatio:void 0,googleVideoResolution:c.googleVideoResolutions?d.googleVideoResolution:void 0,googleVideoGenerateAudio:c.googleVideoSupportsAudio?d.googleVideoGenerateAudio:void 0,googleVideoEnhancePrompt:c.googleVideoSupportsEnhancePrompt?d.googleVideoEnhancePrompt:void 0,googleVideoPersonGeneration:c.googleVideoPersonGenerations?d.googleVideoPersonGeneration:void 0,googleVideoFps:c.googleVideoSupportsFps?d.googleVideoFps:void 0,xaiImageCount:c.xaiImageSupportsMultipleOutputs?d.xaiImageCount:void 0,xaiImageAspectRatio:c.xaiImageAspectRatios?d.xaiImageAspectRatio:void 0,xaiImageResolution:c.xaiImageResolutions?d.xaiImageResolution:void 0,xaiVideoMode:c.xaiVideoSupportsMode?d.xaiVideoMode:void 0,xaiVideoDuration:c.xaiVideoSupportsDuration?d.xaiVideoDuration:void 0,xaiVideoAspectRatio:c.xaiVideoAspectRatios?d.xaiVideoAspectRatio:void 0,xaiVideoResolution:c.xaiVideoResolutions?d.xaiVideoResolution:void 0}),images:null==(r=o.images)?void 0:r.map(G),mask:o.mask?G(o.mask):void 0};var d,c;const u=await i(a(`imageWorkshop/${e}`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!u.ok){const e=await u.json().catch(()=>null);throw new Error((null==e?void 0:e.error)||(e?JSON.stringify(e):"Request failed"))}await l(u,(e,o)=>{if("image"===e)n(o);else if("session"===e)null==t||t(o);else if("error"===e)throw new Error(o.error||"Request failed")})}(e,{modelId:_,prompt:Y,options:pe,capabilities:ze,images:"generate"===K&&je?oe:"edit"===K?Oe:[],mask:"edit"===K?Ae:null},e=>o.push(e),e=>{z(e.id),T(e.title),L(o=>o.some(o=>o.id===e.id)?o.map(o=>o.id===e.id?e:o):[e,...o])}),o.length>0&&(ie(e=>[...o,...e]),qe("results")),Z(""),ne([]),Ce(new Map),Ne(null)}catch(o){we.current||h(o instanceof Error?o.message:String(o),"error")}finally{le(!1)}},disabled:!He}),o.jsx(s,{icon:N,title:Ie.app.settings,onClick:()=>he(!0)})]})]})}),o.jsxs("main",{className:"flex-1 min-h-0 overflow-hidden md:grid md:grid-cols-4",children:[o.jsxs("aside",{ref:fe,className:("input"===ue?"block":"hidden")+" md:block h-full min-h-0 md:col-span-1 md:border-r border-dashed border-vscode-border bg-vscode-sidebar p-4 space-y-4 overflow-y-auto",children:[o.jsxs("section",{className:"space-y-2",children:[o.jsx(F,{options:[{value:"generate",label:Ie.workshop.generate},...Re?[{value:"edit",label:Ie.workshop.edit}]:[]],value:K,onChange:e=>{X(e),Be("input"),"edit"!==e&&(Ne(null),Ce(new Map))}}),o.jsx("p",{className:"text-xs text-vscode-text-muted leading-relaxed",children:"generate"===K?Ie.workshop.generateDescription:Ie.workshop.editDescription})]}),o.jsx(g,{label:Ie.workshop.imageModel,value:_,onChange:function(e){var o,n;const t=(null==p?void 0:p.imageModels.find(o=>o.id===e))??null,i=(null==t?void 0:t.capabilities)??null,a=(null==i?void 0:i.maxReferenceImages)??10;ee(e);const l=oe.slice(0,a);oe.length>l.length&&h(Ie.workshop.keptReferences(a),"info"),ne(l),Ne(e=>e&&l.some(o=>o.id===e)?e:null),Ce(e=>{let o=!1;for(const t of e.keys())if(!l.some(e=>e.id===t)){o=!0;break}if(!o)return e;const n=new Map(e);for(const t of[...n.keys()])l.some(e=>e.id===t)||n.delete(t);return n});const r=(null==(o=null==ze?void 0:ze.openaiImageSizeConstraints)?void 0:o.presets[0])??"",s=(null==(n=null==i?void 0:i.openaiImageSizeConstraints)?void 0:n.presets[0])??"";ge(e=>({...e,openaiImageCustomSize:e.openaiImageCustomSize&&e.openaiImageCustomSize!==r?e.openaiImageCustomSize:s||e.openaiImageCustomSize})),(null==i?void 0:i.supportsEditing)||X("generate"),(null==i?void 0:i.supportsMask)||(Ce(new Map),Ne(null))},options:(null==p?void 0:p.imageModels.map(e=>({value:e.id,label:e.nickname||e.name})))||[],placeholder:Ie.workshop.noModelsPlaceholder,disabled:0===(null==p?void 0:p.imageModels.length)}),0===(null==p?void 0:p.imageModels.length)&&o.jsx("p",{className:"text-xs text-vscode-warning",children:Ie.workshop.addModelHint}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"block text-sm font-medium text-vscode-text",children:Ie.workshop.prompt}),o.jsx(s,{icon:re?k:S,title:Ie.workshop.translatePrompt,onClick:async function(){se(!0);try{Z(await async function(e){const o=await i(a("imageWorkshop/translatePrompt"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e})}),n=await o.json().catch(()=>null);if(!o.ok)throw new Error((null==n?void 0:n.error)||"Failed to translate prompt");return n.prompt}(Y))}catch(e){h(e instanceof Error?e.message:String(e),"error")}finally{se(!1)}},disabled:!Ee,className:"p-1 text-vscode-accent hover:opacity-80 "+(re?"animate-spin":"")})]}),o.jsx("textarea",{ref:be,value:Y,onChange:e=>Z(e.target.value),placeholder:Ie.workshop.promptPlaceholder,className:"w-full h-40 max-h-[40rem] resize-none overflow-y-auto px-4 py-3 bg-vscode-bg border border-dashed border-vscode-border text-sm text-vscode-text placeholder-vscode-text-muted focus:outline-none focus:border-vscode-accent focus-visible:ring-1 focus-visible:ring-vscode-accent leading-relaxed"})]}),ze&&Se>0&&("edit"===K||je)&&o.jsx(R,{assets:oe,dragging:de,paintingId:ye,paintedMasks:ke,canPaintMask:Ve,onAddFiles:Je,onOpenFolder:()=>async function(){await i(a("imageWorkshop/openFolder"),{method:"POST"})}().catch(()=>{}),onRemoveAsset:e=>{ne(o=>o.filter(o=>o.id!==e)),ye===e&&Ne(null),Ce(o=>{if(!o.has(e))return o;const n=new Map(o);return n.delete(e),n})},onPaintMask:e=>{Ne(e),qe("results")}})]}),o.jsxs("section",{ref:xe,className:("results"===ue?"block":"hidden")+" md:block h-full min-h-0 md:col-span-3 p-4 space-y-4 overflow-y-auto",children:[Fe&&Ve&&o.jsxs("article",{className:"border border-dashed border-vscode-accent/50 bg-vscode-sidebar min-w-0",children:[o.jsx("div",{className:"p-3 min-w-0",children:o.jsxs("h2",{className:"text-sm font-medium text-vscode-text",children:[Ie.workshop.maskPainter," — ",Fe.fileName]})}),o.jsx(E,{baseImage:Fe,mask:We,paintOverlayUrl:Ge,onMaskChange:(e,o)=>{Ce(()=>{const n=new Map;return e&&o&&n.set(Fe.id,{mask:e,overlayUrl:o}),n})},onDone:()=>{Ne(null),qe("input")}})]}),0===te.length?!Fe&&(ae?o.jsxs("div",{className:"min-h-[24rem] border border-dashed border-vscode-border bg-vscode-sidebar flex flex-col items-center justify-center text-center text-vscode-text-muted gap-3",children:[o.jsx(k,{width:40,height:40,className:"animate-spin text-vscode-accent"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-vscode-text-header font-bold uppercase tracking-wider",children:Ie.workshop.generating}),o.jsx("p",{className:"mt-2 text-sm",children:Ie.workshop.generatingHint})]})]}):o.jsxs("div",{className:"min-h-[24rem] flex flex-col items-center justify-center text-center text-vscode-text-muted gap-3",children:[o.jsx(u,{width:48,height:48}),o.jsxs("div",{children:[o.jsx("div",{className:"text-vscode-text-header font-bold uppercase tracking-wider",children:Ie.workshop.noImagesYet}),o.jsx("p",{className:"mt-2 text-sm",children:Ie.workshop.emptyHint})]})]})):o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-sm font-medium text-vscode-text",children:Ie.workshop.results}),o.jsxs("div",{className:"space-y-4",children:[ae&&o.jsxs("div",{className:"border border-dashed border-vscode-border bg-vscode-sidebar p-6 flex items-center gap-3 text-vscode-text-muted",children:[o.jsx(k,{width:24,height:24,className:"animate-spin text-vscode-accent shrink-0"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-vscode-text-header font-bold uppercase tracking-wider",children:Ie.workshop.generating}),o.jsx("p",{className:"mt-1 text-xs",children:Ie.workshop.generatingHint})]})]}),te.map(e=>o.jsx(H,{item:e,onReuse:Qe,onRemove:Le},e.id))]})]})]})]}),o.jsx("div",{className:"safe-area-bottom flex-none bg-vscode-sidebar px-4 border-t border-dashed border-vscode-border md:hidden",children:o.jsx("div",{className:"py-4",children:o.jsx(F,{options:[{value:"input",label:Ie.workshop.prompt},{value:"results",label:Ie.workshop.results}],value:ue,onChange:qe})})}),me&&o.jsx(W,{options:pe,capabilities:ze,onClose:()=>he(!1),onSave:ge}),o.jsx(C,{})]})}export{L as default};
1
+ import{R as e,j as o,u as n,r as t,a as i,b as a,c as l,d as r}from"./index-BhbpVvH6.js";import{I as s,P as d,C as c,a as u,n as v,b as m,s as h,S as p,c as g,T as b,d as f,u as x,e as w,f as y,g as N,L as k,h as C}from"./useAppearance-ropGPNve.js";const I=o=>e.createElement("svg",Object.assign({viewBox:"0 0 24 24",width:"24",height:"24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},o),e.createElement("path",{d:"M7 2h10v2H7zM5 4h2v10H5zm12-2h2v12h-2z"}),e.createElement("path",{d:"M13 2h2v6h-2zM9 2h2v4H9zm-4 8h14v2H5zm2 4h10v2H7zm2 2h2v4H9zm4 0h2v4h-2zm-4 4h6v2H9z"})),M=o=>e.createElement("svg",Object.assign({viewBox:"0 0 24 24",width:"24",height:"24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},o),e.createElement("path",{d:"M21 15v4h-2v-4zm-2 4v2H5v-2zM5 15v4H3v-4zm8-12v14h-2V3z"}),e.createElement("path",{d:"M7 11v2h10v-2zm2 2v2h2v-2zm4 0v2h2v-2z"}),e.createElement("path",{d:"M15 11v2h2v-2z"})),z=o=>e.createElement("svg",Object.assign({viewBox:"0 0 24 24",width:"24",height:"24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},o),e.createElement("path",{d:"M4 4h6v2H4zm0 14h16v2H4zM20 8h2v10h-2zM2 6h2v12H2zm8 0h10v2H10z"})),S=o=>e.createElement("svg",Object.assign({viewBox:"0 0 24 24",width:"24",height:"24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},o),e.createElement("path",{d:"M7 2h4v2H7zM2 5h14v2H2zm9 2h2v2h-2zM9 9h2v2H9zm-2 2h2v2H7zM5 9h2v2H5zm4 4h2v2H9zm-4 0h2v2H5zm8 2h2v7h-2zm2-2h5v2h-5zm5 2h2v7h-2zm-5 2h5v2h-5z"}));function V({src:e,alt:n="",overlayUrl:t,children:i}){return o.jsxs("div",{className:"relative overflow-hidden",children:[o.jsx("img",{src:e,alt:n,className:"w-full block object-contain select-none pointer-events-none"}),t&&o.jsx("img",{src:t,alt:"",className:"absolute inset-0 w-full h-full object-contain pointer-events-none"}),i]})}function R({assets:e,dragging:i,paintingId:a,paintedMasks:l,canPaintMask:r,onAddFiles:v,onOpenFolder:m,onRemoveAsset:h,onPaintMask:p}){const g=n(),b=t.useRef(null);return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"block text-sm font-medium text-vscode-text",children:g.workshop.referenceImages}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(s,{icon:z,title:g.workshop.folder,onClick:m,className:"hidden md:inline-flex p-1 text-vscode-accent hover:opacity-80"}),o.jsx("input",{ref:b,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:function(e){e.target.files&&v(e.target.files),e.target.value=""}}),o.jsx(s,{icon:d,title:g.workshop.dropImages,onClick:()=>{var e;return null==(e=b.current)?void 0:e.click()},className:"p-1 text-vscode-accent hover:opacity-80"})]})]}),e.length>0&&o.jsx("div",{className:"space-y-2",children:e.map(e=>{var n;return o.jsxs("div",{className:"relative group min-w-0 border border-dashed border-vscode-border",children:[o.jsx("div",{className:"bg-vscode-bg p-1",children:o.jsx(V,{src:e.url,alt:e.fileName||g.workshop.referenceImageAlt,overlayUrl:(null==(n=l.get(e.id))?void 0:n.overlayUrl)??null})}),o.jsxs("div",{className:"absolute top-1 right-1 flex items-center gap-1 opacity-100 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100 transition-opacity",children:[r&&o.jsx(s,{icon:I,title:g.workshop.paintMask,onClick:()=>p(e.id),className:"p-1 bg-vscode-bg/80 "+(a===e.id?"text-vscode-accent":"hover:text-vscode-accent")}),o.jsx(s,{icon:c,title:g.workshop.removeImage,onClick:()=>h(e.id),className:"p-1 bg-vscode-bg/80 hover:text-vscode-error"})]}),o.jsx("div",{className:"p-1 text-[10px] text-vscode-text-muted truncate",children:e.fileName})]},e.id)})}),o.jsxs("div",{className:`border border-dashed flex items-center justify-center text-vscode-text-muted text-sm gap-2 text-center px-4 ${0===e.length?"h-40 flex-col leading-relaxed":"h-10"} ${i?"border-vscode-accent bg-vscode-element":"border-vscode-border bg-vscode-bg"}`,children:[0===e.length&&o.jsx(u,{width:32,height:32}),o.jsx("span",{children:g.workshop.dropImages})]})]})}function j(e,o){if(!e||"auto"===e)return null;const n=e.match(/^(\d+)x(\d+)$/);if(!n)return"Use WIDTHxHEIGHT, for example 1536x1024.";const t=Number(n[1]),i=Number(n[2]),a=Math.max(t,i),l=Math.min(t,i),r=t*i;return t%o.multipleOf!==0||i%o.multipleOf!==0?`Both edges must be multiples of ${o.multipleOf}.`:a>o.maxLongEdge?`The longest edge must be ${o.maxLongEdge}px or less.`:a/l>o.maxRatio?`The aspect ratio must not exceed ${o.maxRatio}:1.`:r<o.minPixels||r>o.maxPixels?`Total pixels must be between ${o.minPixels.toLocaleString()} and ${o.maxPixels.toLocaleString()}.`:null}function P(e){return"image/jpeg"===e?".jpg":"image/webp"===e?".webp":"video/mp4"===e?".mp4":"video/webm"===e?".webm":"video/quicktime"===e?".mov":".png"}function A(e){const o=e.match(/^data:([^;]+);base64,(.+)$/s);return o?{mediaType:o[1],base64:o[2]}:null}function O(){var e,o;try{const n=null==(o=null==(e=globalThis.crypto)?void 0:e.randomUUID)?void 0:o.call(e);if(n)return n}catch{}return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function $(e){return new Promise((o,n)=>{const t=new Image;t.onload=()=>o(t),t.onerror=()=>n(new Error("Failed to load image")),t.src=e})}function T({children:e,onClick:n,disabled:t,variant:i="secondary",className:a="",href:l,download:r}){const s=`inline-flex items-center justify-center gap-2 px-3 py-2.5 border border-dashed text-xs font-bold uppercase tracking-wider transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-vscode-accent ${"primary"===i?"bg-vscode-accent text-white border-vscode-accent hover:opacity-90":"danger"===i?"text-vscode-error border-vscode-error/60 hover:bg-vscode-error/10":"text-vscode-text border-vscode-border hover:bg-vscode-element"} ${t?"opacity-50 cursor-not-allowed":"cursor-pointer"} ${a}`;return l&&!t?o.jsx("a",{href:l,download:r,className:s,children:e}):o.jsx("button",{type:"button",onClick:n,disabled:t,className:s,children:e})}function H({item:e,onReuse:t,onRemove:i}){const a=n(),l=e.revisedPrompt||e.prompt,r=!!l.trim(),u=e.mimeType.startsWith("video/");return o.jsxs("article",{className:"relative group border border-dashed border-vscode-border bg-vscode-sidebar min-w-0",children:[o.jsx("div",{className:"bg-vscode-bg p-2 flex items-center justify-center",children:u?o.jsx("video",{src:e.url,controls:!0,playsInline:!0,preload:"auto",className:"block w-full max-h-[70vh]"}):o.jsx("img",{src:e.url,alt:r?l:a.workshop.resultImageAlt,className:"block w-full max-h-[70vh] object-contain"})}),o.jsx("div",{className:"absolute top-1 right-1 opacity-100 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100 transition-opacity",children:o.jsx(s,{icon:c,title:a.workshop.removeFromResults,onClick:()=>i(e.id),className:"p-1 bg-vscode-bg/80 hover:text-vscode-error"})}),o.jsxs("div",{className:"p-3 space-y-3 min-w-0",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs text-vscode-text-muted min-w-0",children:[o.jsx("span",{className:"uppercase shrink-0",children:e.kind}),o.jsx("span",{className:"truncate",children:e.model})]}),r&&o.jsx("p",{className:"text-xs text-vscode-text-muted line-clamp-2",children:l}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2 min-w-0",children:[o.jsxs(T,{href:e.url,download:`${u?"video":"image"}-${e.id}${P(e.mimeType)}`,className:"min-w-0",children:[o.jsx(M,{width:14,height:14}),a.workshop.download]}),!u&&o.jsxs(T,{onClick:()=>t(e),children:[o.jsx(d,{width:14,height:14}),a.workshop.reuse]}),r&&o.jsxs(T,{onClick:async function(){try{await navigator.clipboard.writeText(l)}catch{return void h(a.actions.copyFailed,"error")}h(a.workshop.promptCopied,"success")},children:[o.jsx(m,{width:14,height:14}),a.workshop.copyPrompt]})]})]})]})}function E({baseImage:e,mask:i,paintOverlayUrl:a,onMaskChange:l,onDone:r}){const s=n(),d=t.useRef(null),c=t.useRef(void 0),u=t.useRef(null),[v,m]=t.useState(48),[h,p]=t.useState(!1),[g,b]=t.useState(!1);function f(o){if(!e)return;const n=o.currentTarget,t=n.getContext("2d");if(!t)return;const{x:i,y:a}=function(e,o){const n=o.getBoundingClientRect();return{x:(e.clientX-n.left)/n.width*o.width,y:(e.clientY-n.top)/n.height*o.height}}(o,n),l=n.width/n.getBoundingClientRect().width;t.fillStyle="rgba(255,255,255,0.55)",t.beginPath(),t.arc(i,a,v*l/2,0,2*Math.PI),t.fill(),b(!0)}function x(){const o=d.current;if(!o||!e||!g)return void l(null,null);const n=o.toDataURL("image/png");u.current=n;const t=document.createElement("canvas");t.width=o.width,t.height=o.height;const i=t.getContext("2d"),a=o.getContext("2d");if(!i||!a)return;const r=a.getImageData(0,0,o.width,o.height),s=i.createImageData(o.width,o.height);for(let e=0;e<r.data.length;e+=4){const o=r.data[e+3]>0;s.data[e]=255,s.data[e+1]=255,s.data[e+2]=255,s.data[e+3]=o?0:255}i.putImageData(s,0,0);const c=t.toDataURL("image/png"),v=A(c);v&&l({id:O(),base64:v.base64,mediaType:v.mediaType,fileName:"mask.png",url:c,width:o.width,height:o.height},n)}return t.useEffect(()=>{const o=d.current;if(!o||!(null==e?void 0:e.width)||!(null==e?void 0:e.height))return;if(c.current===e.id)return;c.current=e.id,o.width=e.width,o.height=e.height;const n=o.getContext("2d");n&&(n.clearRect(0,0,o.width,o.height),b(!1))},[null==e?void 0:e.id]),t.useEffect(()=>{const o=d.current;if(!o||!e||!a)return;if(a===u.current)return;const n=o.getContext("2d");if(!n)return;const t=new Image;t.onload=()=>{n.clearRect(0,0,o.width,o.height),n.drawImage(t,0,0,o.width,o.height),b(!0)},t.src=a},[e,a]),e?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"bg-vscode-bg p-2",children:o.jsx(V,{src:e.url,alt:e.fileName||s.workshop.referenceImageAlt,children:o.jsx("canvas",{ref:d,className:"absolute inset-0 w-full h-full cursor-crosshair touch-none",onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),p(!0),f(e)},onPointerMove:e=>{h&&f(e)},onPointerUp:e=>{p(!1),e.currentTarget.releasePointerCapture(e.pointerId),x()},onPointerCancel:()=>{p(!1),x()}})})}),o.jsxs("div",{className:"p-3 space-y-3",children:[o.jsxs("label",{className:"block space-y-2",children:[o.jsx("span",{className:"block text-sm font-medium text-vscode-text",children:s.workshop.brushSize}),o.jsx("input",{type:"range",min:8,max:160,value:v,onChange:e=>m(Number(e.target.value)),className:"pixel-range w-full"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(T,{onClick:r,children:s.workshop.done}),o.jsx(T,{onClick:function(){const e=d.current,o=null==e?void 0:e.getContext("2d");e&&o&&o.clearRect(0,0,e.width,e.height),b(!1),l(null,null)},disabled:!g&&!i,children:s.workshop.clear})]})]})]}):null}function F({options:e,value:n,onChange:t}){const i=1===e.length?"grid-cols-1":"grid-cols-2";return o.jsx("div",{className:`grid ${i} gap-1 bg-vscode-element border border-dashed border-vscode-border p-1`,children:e.map(e=>o.jsx("button",{type:"button",onClick:()=>t(e.value),className:"p-2 text-xs font-bold uppercase cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-vscode-accent "+(n===e.value?"bg-vscode-accent text-white":"text-vscode-text-muted hover:text-vscode-text hover:bg-vscode-bg/60"),children:e.label},e.value))})}function D({label:e,children:n,hint:t}){return o.jsxs("label",{className:"block space-y-2",children:[o.jsx("span",{className:"block text-sm font-medium text-vscode-text",children:e}),n,t&&o.jsx("span",{className:"block text-xs text-vscode-text-muted leading-relaxed",children:t})]})}function W({options:e,capabilities:i,onClose:a,onSave:l}){const r=n(),s=r.workshop,[d,v]=t.useState("output"),[m,h]=t.useState(e),x=t.useMemo(()=>(null==i?void 0:i.openaiImageSizeConstraints)?function(e,o){return[{value:"auto",label:o.auto},...e.presets.map(e=>({value:e,label:e.replace("x"," x ")})),{value:"custom",label:o.custom}]}(i.openaiImageSizeConstraints,s):[{value:"auto",label:s.auto}],[null==i?void 0:i.openaiImageSizeConstraints,s]),w=null==i?void 0:i.openaiImageSizeConstraints,y="custom"===m.openaiImageSize?m.openaiImageCustomSize:m.openaiImageSize,N=w?j(y,w):null,k=!!w&&function(e,o){const n=e.match(/^(\d+)x(\d+)$/);return!!n&&Number(n[1])*Number(n[2])>o.experimentalAbove}(y,w),C=N||(k?s.experimentalSize:void 0),I=(null==i?void 0:i.googleImageAspectRatios)??(null==i?void 0:i.googleVideoAspectRatios)??(null==i?void 0:i.xaiVideoAspectRatios)??(null==i?void 0:i.xaiImageAspectRatios),M=(null==i?void 0:i.googleImageSizes)??(null==i?void 0:i.googleVideoResolutions)??(null==i?void 0:i.xaiVideoResolutions)??(null==i?void 0:i.xaiImageResolutions),z=(null==i?void 0:i.googleImageAspectRatios)?m.googleImageAspectRatio:(null==i?void 0:i.googleVideoAspectRatios)?m.googleVideoAspectRatio:(null==i?void 0:i.xaiVideoAspectRatios)?m.xaiVideoAspectRatio:m.xaiImageAspectRatio,S=(null==i?void 0:i.googleImageSizes)?m.googleImageSize:(null==i?void 0:i.googleVideoResolutions)?m.googleVideoResolution:(null==i?void 0:i.xaiVideoResolutions)?m.xaiVideoResolution:m.xaiImageResolution,V=(null==i?void 0:i.googleImageAspectRatios)?"googleImageAspectRatio":(null==i?void 0:i.googleVideoAspectRatios)?"googleVideoAspectRatio":(null==i?void 0:i.xaiVideoAspectRatios)?"xaiVideoAspectRatio":"xaiImageAspectRatio",R=(null==i?void 0:i.googleImageSizes)?"googleImageSize":(null==i?void 0:i.googleVideoResolutions)?"googleVideoResolution":(null==i?void 0:i.xaiVideoResolutions)?"xaiVideoResolution":"xaiImageResolution",P=[{id:"output",label:s.output,icon:u},{id:"preferences",label:s.preferences,icon:p}];function A(e,o){h(n=>({...n,[e]:o}))}return o.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-50 animate-fade-in",children:o.jsxs("div",{className:"bg-vscode-sidebar border border-dashed border-vscode-border w-full max-w-lg overflow-hidden m-4",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-dashed border-vscode-border bg-vscode-element/50",children:[o.jsx("h2",{className:"text-sm font-bold text-vscode-text-header uppercase tracking-widest",children:r.settings.title}),o.jsx("button",{type:"button",onClick:a,className:"text-vscode-text-muted hover:text-vscode-text p-1 hover:bg-vscode-border transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-vscode-accent",children:o.jsx(c,{width:18,height:18})})]}),o.jsx("div",{className:"flex border-b border-dashed border-vscode-border",children:P.map(e=>o.jsxs("button",{type:"button",onClick:()=>v(e.id),className:"flex-1 flex items-center justify-center gap-2 px-4 py-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-vscode-accent "+(d===e.id?"text-vscode-accent border-b-2 border-vscode-accent":"text-vscode-text-muted hover:text-vscode-text"),children:[o.jsx(e.icon,{width:16,height:16}),o.jsx("span",{children:e.label})]},e.id))}),o.jsxs("div",{className:"p-6 space-y-5 max-h-[60vh] overflow-y-auto",children:["output"===d&&o.jsxs(o.Fragment,{children:[w&&o.jsx(g,{label:s.size,value:m.openaiImageSize,onChange:e=>A("openaiImageSize",e),options:x,description:"custom"!==m.openaiImageSize?C:void 0}),w&&"custom"===m.openaiImageSize&&o.jsx(D,{label:s.customSize,hint:C||s.sizeMultipleHint(w.multipleOf),children:o.jsx("input",{value:m.openaiImageCustomSize,onChange:e=>A("openaiImageCustomSize",e.target.value),placeholder:"1536x1024",className:"w-full px-4 py-2.5 bg-vscode-bg border border-dashed border-vscode-border text-sm text-vscode-text focus:outline-none focus:border-vscode-accent focus-visible:ring-1 focus-visible:ring-vscode-accent disabled:opacity-60 disabled:cursor-not-allowed","aria-invalid":!!N})}),(null==i?void 0:i.xaiVideoSupportsMode)&&o.jsx(g,{label:s.videoMode,value:m.xaiVideoMode,onChange:e=>A("xaiVideoMode",e),options:[{value:"image-to-video",label:s.imageToVideo},{value:"reference-to-video",label:s.referenceToVideo}]}),I&&o.jsx(g,{label:s.aspectRatio,value:z,onChange:e=>A(V,e),options:I.map(e=>({value:e,label:"auto"===e?s.auto:e}))}),M&&o.jsx(g,{label:s.resolution,value:S,onChange:e=>A(R,e),options:M.map(e=>({value:e,label:"auto"===e?s.auto:e}))}),((null==i?void 0:i.googleVideoSupportsDuration)||(null==i?void 0:i.xaiVideoSupportsDuration))&&o.jsx(g,{label:s.duration,value:String(i.googleVideoSupportsDuration?m.googleVideoDuration:m.xaiVideoDuration),onChange:e=>A(i.googleVideoSupportsDuration?"googleVideoDuration":"xaiVideoDuration",Number(e)),options:Array.from({length:15},(e,o)=>{const n=String(o+1);return{value:n,label:n}})}),(null==i?void 0:i.googleVideoSupportsAudio)&&o.jsx(b,{label:s.audio,description:s.audioDescription,enabled:m.googleVideoGenerateAudio,onChange:e=>A("googleVideoGenerateAudio",e)}),(null==i?void 0:i.googleVideoSupportsEnhancePrompt)&&o.jsx(b,{label:s.enhancePrompt,description:s.enhancePromptDescription,enabled:m.googleVideoEnhancePrompt,onChange:e=>A("googleVideoEnhancePrompt",e)}),(null==i?void 0:i.googleVideoPersonGenerations)&&o.jsx(g,{label:s.personGeneration,value:m.googleVideoPersonGeneration,onChange:e=>A("googleVideoPersonGeneration",e),options:i.googleVideoPersonGenerations.map(e=>({value:e,label:"auto"===e?s.auto:e}))}),(null==i?void 0:i.googleVideoSupportsFps)&&o.jsx(g,{label:s.fps,value:String(m.googleVideoFps),onChange:e=>A("googleVideoFps",Number(e)),options:[12,15,24,25,30,48,50,60,120,240].map(e=>({value:String(e),label:String(e)}))}),(null==i?void 0:i.openaiImageSupportsQuality)&&o.jsx(g,{label:s.quality,value:m.openaiImageQuality,onChange:e=>A("openaiImageQuality",e),options:[{value:"auto",label:s.auto},{value:"low",label:s.qualityLow},{value:"medium",label:s.qualityMedium},{value:"high",label:s.qualityHigh}]}),(null==i?void 0:i.openaiImageSupportsOutputFormat)&&o.jsx(g,{label:s.format,value:m.openaiImageOutputFormat,onChange:e=>A("openaiImageOutputFormat",e),options:[{value:"png",label:"PNG"},{value:"jpeg",label:"JPEG"},{value:"webp",label:"WebP"}]}),(null==i?void 0:i.openaiImageSupportsCompression)&&"png"!==m.openaiImageOutputFormat&&o.jsx(g,{label:s.compression,value:String(m.openaiImageOutputCompression),onChange:e=>A("openaiImageOutputCompression",Number(e)),options:Array.from({length:21},(e,o)=>{const n=String(5*o);return{value:n,label:n}})}),(null==i?void 0:i.openaiImageSupportsBackground)&&o.jsx(g,{label:s.background,value:m.openaiImageBackground,onChange:e=>A("openaiImageBackground",e),options:[{value:"auto",label:s.auto},{value:"opaque",label:s.opaque}]}),(null==i?void 0:i.openaiImageSupportsModeration)&&o.jsx(g,{label:s.moderation,value:m.openaiImageModeration,onChange:e=>A("openaiImageModeration",e),options:[{value:"auto",label:s.auto},{value:"low",label:s.low}]}),((null==i?void 0:i.openaiImageSupportsMultipleOutputs)||(null==i?void 0:i.xaiImageSupportsMultipleOutputs))&&o.jsx(g,{label:s.images,value:String(i.xaiImageSupportsMultipleOutputs?m.xaiImageCount:m.openaiImageCount),onChange:e=>A(i.xaiImageSupportsMultipleOutputs?"xaiImageCount":"openaiImageCount",Number(e)),options:Array.from({length:10},(e,o)=>{const n=String(o+1);return{value:n,label:n}})})]}),"preferences"===d&&o.jsx(b,{label:s.privacyMode,description:s.privacyModeDescription,enabled:m.privacyMode,onChange:e=>A("privacyMode",e)})]}),o.jsxs("div",{className:"flex justify-end gap-3 px-6 py-4 border-t border-dashed border-vscode-border bg-vscode-element/30",children:[o.jsx("button",{type:"button",onClick:a,className:"px-4 py-2 text-xs font-bold text-vscode-text hover:bg-vscode-border transition-colors uppercase tracking-wider",children:r.settings.cancel}),o.jsxs("button",{type:"button",onClick:function(){l(m),a()},disabled:!!N,className:"px-6 py-2 text-xs font-bold bg-vscode-accent text-white hover:brightness-110 transition-colors uppercase tracking-wider border border-dashed border-vscode-accent/50 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:[o.jsx(f,{width:16,height:16}),o.jsx("span",{children:r.settings.save})]})]})]})})}function G(e){return{base64:e.base64,mediaType:e.mediaType,fileName:e.fileName}}async function B(){const e=await i(a("imageWorkshop/config"));if(!e.ok)throw new Error("Failed to load image workshop config");return e.json()}async function q(){const e=await i(a("imageWorkshop/session"));if(!e.ok)throw new Error("Failed to load workshop session");return e.json()}async function U(){const e=await i(a("imageWorkshop/sessions"));return e.ok?e.json():[]}function J(e=null){var o;return{privacyMode:!1,openaiImageCount:1,openaiImageSize:"auto",openaiImageCustomSize:(null==(o=null==e?void 0:e.openaiImageSizeConstraints)?void 0:o.presets[0])??"",openaiImageQuality:"auto",openaiImageOutputFormat:"png",openaiImageOutputCompression:100,openaiImageBackground:"auto",openaiImageModeration:"auto",googleImageAspectRatio:"auto",googleImageSize:"auto",googleVideoDuration:8,googleVideoAspectRatio:"auto",googleVideoResolution:"auto",googleVideoGenerateAudio:!1,googleVideoEnhancePrompt:!1,googleVideoPersonGeneration:"auto",googleVideoFps:24,xaiImageCount:1,xaiImageAspectRatio:"auto",xaiImageResolution:"auto",xaiVideoMode:"image-to-video",xaiVideoDuration:8,xaiVideoAspectRatio:"auto",xaiVideoResolution:"auto"}}function Q(e){return e.type.startsWith("image/")||/\.(avif|gif|heic|heif|jpe?g|png|webp)$/i.test(e.name)}function L(){const e=r(e=>e.getConfig),d=r(e=>{var o;return null==(o=e.config)?void 0:o.projectName}),m=r(e=>{var o;return null==(o=e.config)?void 0:o.workLanguage}),[p,b]=t.useState(null),[f,I]=t.useState(!0),[M,z]=t.useState(null),[V,T]=t.useState(""),[D,L]=t.useState([]),[K,X]=t.useState("generate"),[Y,Z]=t.useState(""),[_,ee]=t.useState(""),[oe,ne]=t.useState([]),[te,ie]=t.useState([]),[ae,le]=t.useState(!1),[re,se]=t.useState(!1),[de,ce]=t.useState(!1),[ue,ve]=t.useState("input"),[me,he]=t.useState(!1),[pe,ge]=t.useState(()=>J()),be=t.useRef(null),fe=t.useRef(null),xe=t.useRef(null),we=t.useRef(!1),[ye,Ne]=t.useState(null),[ke,Ce]=t.useState(new Map),Ie=n();x(),t.useEffect(()=>{e().catch(()=>{}),Promise.all([B(),q(),U()]).then(([e,o,n])=>{b(e);const t=e.imageModels.find(o=>o.id===e.defaultImageModelId)??null;ee(e.defaultImageModelId||""),ge(J((null==t?void 0:t.capabilities)??null)),z(o.id),T(o.title),ie(o.items),L(n)}).catch(e=>h(e instanceof Error?e.message:String(e),"error")).finally(()=>I(!1))},[]),t.useEffect(()=>{document.title=d?`${d} - ${Ie.workshop.title}`:Ie.workshop.title},[d,Ie.workshop.title]),t.useEffect(()=>{if(!be.current)return;be.current.style.height="auto";const e=Math.max(160,Math.min(be.current.scrollHeight,640));be.current.style.height=`${e}px`},[Y]);const Me=(null==p?void 0:p.imageModels.find(e=>e.id===_))??null,ze=(null==Me?void 0:Me.capabilities)??null,Se=(null==ze?void 0:ze.maxReferenceImages)??10,Ve=!!(null==ze?void 0:ze.supportsMask),Re=!!(null==ze?void 0:ze.supportsEditing),je=!!(null==ze?void 0:ze.supportsGenerationReferences),Pe=Ve?oe.find(e=>ke.has(e.id)):void 0,Ae=Pe?ke.get(Pe.id).mask:null,Oe=Pe?[Pe,...oe.filter(e=>e.id!==Pe.id)]:oe,$e="custom"===pe.openaiImageSize?pe.openaiImageCustomSize:pe.openaiImageSize,Te=(null==ze?void 0:ze.openaiImageSizeConstraints)?j($e,ze.openaiImageSizeConstraints):null,He=!ae&&!re&&!f&&!!_&&!!Y.trim()&&!Te&&("edit"!==K||Re&&oe.length>0),Ee=m&&"disabled"!==m&&!ae&&!re&&!!Y.trim(),Fe=ye?oe.find(e=>e.id===ye)??null:null,De=Fe?ke.get(Fe.id):void 0,We=Ve&&De?De.mask:null,Ge=(null==De?void 0:De.overlayUrl)??null;function Be(e){var o;null==(o=("input"===e?fe:xe).current)||o.scrollTo({top:0,behavior:"smooth"})}function qe(e){ve(e),requestAnimationFrame(()=>Be(e))}function Ue(){ne([]),Ce(new Map),Ne(null),X("generate"),Z("")}async function Je(e){const o=Array.from(e).filter(Q);if(0===o.length)return;X(je&&!Re?"generate":"edit"),qe("input");const n=(await Promise.allSettled(o.map(e=>async function(e){const o=await new Promise((o,n)=>{const t=new FileReader;t.onload=e=>{var n;return o(String(null==(n=e.target)?void 0:n.result))},t.onerror=()=>n(t.error),t.readAsDataURL(e)}),n=A(o);if(!n)throw new Error("Invalid image file");const t=await v(o,n.mediaType,e.name),i=(null==t?void 0:t.dataUrl)??o,a=await $(i);return{id:O(),base64:(null==t?void 0:t.base64)??n.base64,mediaType:(null==t?void 0:t.mediaType)??n.mediaType,fileName:(null==t?void 0:t.fileName)??e.name,url:i,width:a.naturalWidth,height:a.naturalHeight}}(e)))).filter(e=>"fulfilled"===e.status).map(e=>e.value);0!==n.length&&ne(e=>{const o=Math.max(0,Se-e.length);return n.length>o&&h(Ie.workshop.maxReferences(Se),"info"),[...e,...n].slice(0,Se)})}async function Qe(e){if(Re||je)try{const o=await async function(e){try{const o=await fetch(e.url),n=await o.blob(),t=await new Promise(e=>{const o=new FileReader;o.onloadend=()=>e(o.result),o.readAsDataURL(n)}),i=A(t);if(!i)return null;const a=await $(t);return{id:O(),base64:i.base64,mediaType:i.mediaType,fileName:`${e.id}${P(i.mediaType)}`,url:t,width:a.naturalWidth,height:a.naturalHeight}}catch{return null}}(e);if(!o)return void h(Ie.workshop.reuseFailed,"error");X(je&&!Re?"generate":"edit"),ne(e=>[o,...e].slice(0,Se)),qe("input"),h(Ie.workshop.reuseToast,"success")}catch(o){h(o instanceof Error?o.message:String(o),"error")}}async function Le(e){const o=te.find(o=>o.id===e);if(ie(o=>o.filter(o=>o.id!==e)),!(null==o?void 0:o.transient))try{await async function(e){if(!(await i(a("imageWorkshop/item/remove"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})})).ok)throw new Error("Failed to remove item")}(e)}catch(n){const e=await q().catch(()=>null);e&&ie(e.items),h(n instanceof Error?n.message:String(n),"error")}}return o.jsxs("div",{className:"h-full flex flex-col bg-vscode-bg text-vscode-text text-sm overflow-hidden",onDragOver:e=>{e.preventDefault(),ce(!0)},onDragLeave:function(e){const o=e.relatedTarget;o instanceof Node&&e.currentTarget.contains(o)||ce(!1)},onDrop:function(e){e.preventDefault(),ce(!1),Je(e.dataTransfer.files)},children:[o.jsx("header",{className:"safe-area-top flex-none pb-2 bg-vscode-bg z-10 px-4 border-b border-dashed border-vscode-border",children:o.jsxs("div",{className:"flex items-center justify-between gap-4 w-full",children:[o.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1 max-w-[min(48rem,60vw)]",children:o.jsx(w,{icon:u,title:pe.privacyMode?Ie.workshop.privateSession:V||Ie.workshop.newSession,sessions:D,currentId:M,emptyText:Ie.workshop.noSessions,newTitle:Ie.workshop.newSession,onSelect:async function(e){try{const o=await async function(e){const o=await i(a("imageWorkshop/session/load"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})});if(!o.ok)throw new Error("Session not found");return o.json()}(e.id);z(o.id),T(o.title),ie(o.items),Ue(),requestAnimationFrame(()=>Be("input"))}catch(o){h(o instanceof Error?o.message:String(o),"error")}},onNew:async function(){try{const e=await async function(){const e=await i(a("imageWorkshop/session/new"),{method:"POST"});if(!e.ok)throw new Error("Failed to create session");return e.json()}();z(e.id),T(e.title),ie([]),Ue(),requestAnimationFrame(()=>Be("input"))}catch(e){h(e instanceof Error?e.message:String(e),"error")}},disabled:ae})}),o.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[ae?o.jsx(s,{icon:c,title:Ie.workshop.stop,onClick:async function(){we.current=!0,await async function(){await i(a("imageWorkshop/stop"),{method:"POST"})}().catch(()=>{}),le(!1)}}):o.jsx(s,{icon:y,title:Ie.workshop.run,onClick:async function(){if(!He||!ze)return;we.current=!1,Ne(null),qe("results"),le(!0);const e="generate"===K?"generate":"edit";try{const o=[];await async function(e,o,n,t){var r;const s={modelId:o.modelId,prompt:o.prompt,...(d=o.options,c=o.capabilities,{privacyMode:d.privacyMode,openaiImageCount:c.openaiImageSupportsMultipleOutputs?d.openaiImageCount:void 0,openaiImageSize:c.openaiImageSizeConstraints?"custom"===d.openaiImageSize?d.openaiImageCustomSize:d.openaiImageSize:void 0,openaiImageQuality:c.openaiImageSupportsQuality?d.openaiImageQuality:void 0,openaiImageOutputFormat:c.openaiImageSupportsOutputFormat?d.openaiImageOutputFormat:void 0,openaiImageOutputCompression:c.openaiImageSupportsCompression?d.openaiImageOutputCompression:void 0,openaiImageBackground:c.openaiImageSupportsBackground?d.openaiImageBackground:void 0,openaiImageModeration:c.openaiImageSupportsModeration?d.openaiImageModeration:void 0,googleImageAspectRatio:c.googleImageAspectRatios?d.googleImageAspectRatio:void 0,googleImageSize:c.googleImageSizes?d.googleImageSize:void 0,googleVideoDuration:c.googleVideoSupportsDuration?d.googleVideoDuration:void 0,googleVideoAspectRatio:c.googleVideoAspectRatios?d.googleVideoAspectRatio:void 0,googleVideoResolution:c.googleVideoResolutions?d.googleVideoResolution:void 0,googleVideoGenerateAudio:c.googleVideoSupportsAudio?d.googleVideoGenerateAudio:void 0,googleVideoEnhancePrompt:c.googleVideoSupportsEnhancePrompt?d.googleVideoEnhancePrompt:void 0,googleVideoPersonGeneration:c.googleVideoPersonGenerations?d.googleVideoPersonGeneration:void 0,googleVideoFps:c.googleVideoSupportsFps?d.googleVideoFps:void 0,xaiImageCount:c.xaiImageSupportsMultipleOutputs?d.xaiImageCount:void 0,xaiImageAspectRatio:c.xaiImageAspectRatios?d.xaiImageAspectRatio:void 0,xaiImageResolution:c.xaiImageResolutions?d.xaiImageResolution:void 0,xaiVideoMode:c.xaiVideoSupportsMode?d.xaiVideoMode:void 0,xaiVideoDuration:c.xaiVideoSupportsDuration?d.xaiVideoDuration:void 0,xaiVideoAspectRatio:c.xaiVideoAspectRatios?d.xaiVideoAspectRatio:void 0,xaiVideoResolution:c.xaiVideoResolutions?d.xaiVideoResolution:void 0}),images:null==(r=o.images)?void 0:r.map(G),mask:o.mask?G(o.mask):void 0};var d,c;const u=await i(a(`imageWorkshop/${e}`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!u.ok){const e=await u.json().catch(()=>null);throw new Error((null==e?void 0:e.error)||(e?JSON.stringify(e):"Request failed"))}await l(u,(e,o)=>{if("image"===e)n(o);else if("session"===e)null==t||t(o);else if("error"===e)throw new Error(o.error||"Request failed")})}(e,{modelId:_,prompt:Y,options:pe,capabilities:ze,images:"generate"===K&&je?oe:"edit"===K?Oe:[],mask:"edit"===K?Ae:null},e=>o.push(e),e=>{z(e.id),T(e.title),L(o=>o.some(o=>o.id===e.id)?o.map(o=>o.id===e.id?e:o):[e,...o])}),o.length>0&&(ie(e=>[...o,...e]),qe("results")),Z(""),ne([]),Ce(new Map),Ne(null)}catch(o){we.current||h(o instanceof Error?o.message:String(o),"error")}finally{le(!1)}},disabled:!He}),o.jsx(s,{icon:N,title:Ie.app.settings,onClick:()=>he(!0)})]})]})}),o.jsxs("main",{className:"flex-1 min-h-0 overflow-hidden md:grid md:grid-cols-4",children:[o.jsxs("aside",{ref:fe,className:("input"===ue?"block":"hidden")+" md:block h-full min-h-0 md:col-span-1 md:border-r border-dashed border-vscode-border bg-vscode-sidebar p-4 space-y-4 overflow-y-auto",children:[o.jsxs("section",{className:"space-y-2",children:[o.jsx(F,{options:[{value:"generate",label:Ie.workshop.generate},...Re?[{value:"edit",label:Ie.workshop.edit}]:[]],value:K,onChange:e=>{X(e),Be("input"),"edit"!==e&&(Ne(null),Ce(new Map))}}),o.jsx("p",{className:"text-xs text-vscode-text-muted leading-relaxed",children:"generate"===K?Ie.workshop.generateDescription:Ie.workshop.editDescription})]}),o.jsx(g,{label:Ie.workshop.imageModel,value:_,onChange:function(e){var o,n;const t=(null==p?void 0:p.imageModels.find(o=>o.id===e))??null,i=(null==t?void 0:t.capabilities)??null,a=(null==i?void 0:i.maxReferenceImages)??10;ee(e);const l=oe.slice(0,a);oe.length>l.length&&h(Ie.workshop.keptReferences(a),"info"),ne(l),Ne(e=>e&&l.some(o=>o.id===e)?e:null),Ce(e=>{let o=!1;for(const t of e.keys())if(!l.some(e=>e.id===t)){o=!0;break}if(!o)return e;const n=new Map(e);for(const t of[...n.keys()])l.some(e=>e.id===t)||n.delete(t);return n});const r=(null==(o=null==ze?void 0:ze.openaiImageSizeConstraints)?void 0:o.presets[0])??"",s=(null==(n=null==i?void 0:i.openaiImageSizeConstraints)?void 0:n.presets[0])??"";ge(e=>({...e,openaiImageCustomSize:e.openaiImageCustomSize&&e.openaiImageCustomSize!==r?e.openaiImageCustomSize:s||e.openaiImageCustomSize})),(null==i?void 0:i.supportsEditing)||X("generate"),(null==i?void 0:i.supportsMask)||(Ce(new Map),Ne(null))},options:(null==p?void 0:p.imageModels.map(e=>({value:e.id,label:e.nickname||e.name})))||[],placeholder:Ie.workshop.noModelsPlaceholder,disabled:0===(null==p?void 0:p.imageModels.length)}),0===(null==p?void 0:p.imageModels.length)&&o.jsx("p",{className:"text-xs text-vscode-warning",children:Ie.workshop.addModelHint}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"block text-sm font-medium text-vscode-text",children:Ie.workshop.prompt}),o.jsx(s,{icon:re?k:S,title:Ie.workshop.translatePrompt,onClick:async function(){se(!0);try{Z(await async function(e){const o=await i(a("imageWorkshop/translatePrompt"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e})}),n=await o.json().catch(()=>null);if(!o.ok)throw new Error((null==n?void 0:n.error)||"Failed to translate prompt");return n.prompt}(Y))}catch(e){h(e instanceof Error?e.message:String(e),"error")}finally{se(!1)}},disabled:!Ee,className:"p-1 text-vscode-accent hover:opacity-80 "+(re?"animate-spin":"")})]}),o.jsx("textarea",{ref:be,value:Y,onChange:e=>Z(e.target.value),placeholder:Ie.workshop.promptPlaceholder,className:"w-full h-40 max-h-[40rem] resize-none overflow-y-auto px-4 py-3 bg-vscode-bg border border-dashed border-vscode-border text-sm text-vscode-text placeholder-vscode-text-muted focus:outline-none focus:border-vscode-accent focus-visible:ring-1 focus-visible:ring-vscode-accent leading-relaxed"})]}),ze&&Se>0&&("edit"===K||je)&&o.jsx(R,{assets:oe,dragging:de,paintingId:ye,paintedMasks:ke,canPaintMask:Ve,onAddFiles:Je,onOpenFolder:()=>async function(){await i(a("imageWorkshop/openFolder"),{method:"POST"})}().catch(()=>{}),onRemoveAsset:e=>{ne(o=>o.filter(o=>o.id!==e)),ye===e&&Ne(null),Ce(o=>{if(!o.has(e))return o;const n=new Map(o);return n.delete(e),n})},onPaintMask:e=>{Ne(e),qe("results")}})]}),o.jsxs("section",{ref:xe,className:("results"===ue?"block":"hidden")+" md:block h-full min-h-0 md:col-span-3 p-4 space-y-4 overflow-y-auto",children:[Fe&&Ve&&o.jsxs("article",{className:"border border-dashed border-vscode-accent/50 bg-vscode-sidebar min-w-0",children:[o.jsx("div",{className:"p-3 min-w-0",children:o.jsxs("h2",{className:"text-sm font-medium text-vscode-text",children:[Ie.workshop.maskPainter," — ",Fe.fileName]})}),o.jsx(E,{baseImage:Fe,mask:We,paintOverlayUrl:Ge,onMaskChange:(e,o)=>{Ce(()=>{const n=new Map;return e&&o&&n.set(Fe.id,{mask:e,overlayUrl:o}),n})},onDone:()=>{Ne(null),qe("input")}})]}),0===te.length?!Fe&&(ae?o.jsxs("div",{className:"min-h-[24rem] border border-dashed border-vscode-border bg-vscode-sidebar flex flex-col items-center justify-center text-center text-vscode-text-muted gap-3",children:[o.jsx(k,{width:40,height:40,className:"animate-spin text-vscode-accent"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-vscode-text-header font-bold uppercase tracking-wider",children:Ie.workshop.generating}),o.jsx("p",{className:"mt-2 text-sm",children:Ie.workshop.generatingHint})]})]}):o.jsxs("div",{className:"min-h-[24rem] flex flex-col items-center justify-center text-center text-vscode-text-muted gap-3",children:[o.jsx(u,{width:48,height:48}),o.jsxs("div",{children:[o.jsx("div",{className:"text-vscode-text-header font-bold uppercase tracking-wider",children:Ie.workshop.noImagesYet}),o.jsx("p",{className:"mt-2 text-sm",children:Ie.workshop.emptyHint})]})]})):o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-sm font-medium text-vscode-text",children:Ie.workshop.results}),o.jsxs("div",{className:"space-y-4",children:[ae&&o.jsxs("div",{className:"border border-dashed border-vscode-border bg-vscode-sidebar p-6 flex items-center gap-3 text-vscode-text-muted",children:[o.jsx(k,{width:24,height:24,className:"animate-spin text-vscode-accent shrink-0"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-vscode-text-header font-bold uppercase tracking-wider",children:Ie.workshop.generating}),o.jsx("p",{className:"mt-1 text-xs",children:Ie.workshop.generatingHint})]})]}),te.map(e=>o.jsx(H,{item:e,onReuse:Qe,onRemove:Le},e.id))]})]})]})]}),o.jsx("div",{className:"safe-area-bottom flex-none bg-vscode-sidebar px-4 border-t border-dashed border-vscode-border md:hidden",children:o.jsx("div",{className:"py-4",children:o.jsx(F,{options:[{value:"input",label:Ie.workshop.prompt},{value:"results",label:Ie.workshop.results}],value:ue,onChange:qe})})}),me&&o.jsx(W,{options:pe,capabilities:ze,onClose:()=>he(!1),onSave:ge}),o.jsx(C,{})]})}export{L as default};
@@ -1 +1 @@
1
- import{aU as r,bq as n,aE as t,aS as u,aD as e,br as o,bs as i,bt as f,bu as a,bv as c,bl as v,bw as s,aV as l,a_ as b,b1 as j,bx as d,aY as p,by as y,bo as w,aF as _,bm as m,bz as O}from"./App-CPB0GzVq.js";function h(t){return"symbol"==typeof t||r(t)&&"[object Symbol]"==n(t)}function g(r,n){for(var t=-1,u=null==r?0:r.length,e=Array(u);++t<u;)e[t]=n(r[t],t,r);return e}var A=u?u.prototype:void 0,k=A?A.toString:void 0;function S(r){if("string"==typeof r)return r;if(t(r))return g(r,S)+"";if(h(r))return k?k.call(r):"";var n=r+"";return"0"==n&&1/r==-1/0?"-0":n}function x(r,n){for(var t=-1,u=null==r?0:r.length;++t<u&&!1!==n(r[t],t,r););return r}function D(r,n,t,u){for(var e=r.length,o=t+-1;++o<e;)if(n(r[o],o,r))return o;return-1}function E(r){return r!=r}function $(r,n){return!!(null==r?0:r.length)&&function(r,n,t){return n==n?function(r,n,t){for(var u=t-1,e=r.length;++u<e;)if(r[u]===n)return u;return-1}(r,n,t):D(r,E,t)}(r,n,0)>-1}function q(r){return e(r)?o(r):i(r)}var B=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,V=/^\w*$/;function z(r,n){if(t(r))return!1;var u=typeof r;return!("number"!=u&&"symbol"!=u&&"boolean"!=u&&null!=r&&!h(r))||(V.test(r)||!B.test(r)||null!=n&&r in Object(n))}var F,M,N,R=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,U=/\\(\\)?/g,Y=(F=function(r){var n=[];return 46===r.charCodeAt(0)&&n.push(""),r.replace(R,function(r,t,u,e){n.push(u?e.replace(U,"$1"):t||r)}),n},M=f(F,function(r){return 500===N.size&&N.clear(),r}),N=M.cache,M);function C(r){return null==r?"":S(r)}function G(r,n){return t(r)?r:z(r,n)?[r]:Y(C(r))}function H(r){if("string"==typeof r||h(r))return r;var n=r+"";return"0"==n&&1/r==-1/0?"-0":n}function I(r,n){for(var t=0,u=(n=G(n,r)).length;null!=r&&t<u;)r=r[H(n[t++])];return t&&t==u?r:void 0}function J(r,n){for(var t=-1,u=n.length,e=r.length;++t<u;)r[e+t]=n[t];return r}var K=u?u.isConcatSpreadable:void 0;function L(r){return t(r)||a(r)||!!(K&&r&&r[K])}function P(r,n,t,u,e){var o=-1,i=r.length;for(t||(t=L),e||(e=[]);++o<i;){var f=r[o];t(f)?J(e,f):u||(e[e.length]=f)}return e}function Q(r,n,t,u){var e=-1,o=null==r?0:r.length;for(u&&o&&(t=r[++e]);++e<o;)t=n(t,r[e],e,r);return t}function T(r,n){for(var t=-1,u=null==r?0:r.length,e=0,o=[];++t<u;){var i=r[t];n(i,t,r)&&(o[e++]=i)}return o}function W(){return[]}var X=Object.prototype.propertyIsEnumerable,Z=Object.getOwnPropertySymbols,rr=Z?function(r){return null==r?[]:(r=Object(r),T(Z(r),function(n){return X.call(r,n)}))}:W;function nr(r,n,u){var e=n(r);return t(r)?e:J(e,u(r))}function tr(r){return nr(r,q,rr)}function ur(r){var n=-1,t=null==r?0:r.length;for(this.__data__=new c;++n<t;)this.add(r[n])}function er(r,n){for(var t=-1,u=null==r?0:r.length;++t<u;)if(n(r[t],t,r))return!0;return!1}function or(r,n){return r.has(n)}ur.prototype.add=ur.prototype.push=function(r){return this.__data__.set(r,"__lodash_hash_undefined__"),this},ur.prototype.has=function(r){return this.__data__.has(r)};function ir(r,n,t,u,e,o){var i=1&t,f=r.length,a=n.length;if(f!=a&&!(i&&a>f))return!1;var c=o.get(r),v=o.get(n);if(c&&v)return c==n&&v==r;var s=-1,l=!0,b=2&t?new ur:void 0;for(o.set(r,n),o.set(n,r);++s<f;){var j=r[s],d=n[s];if(u)var p=i?u(d,j,s,n,r,o):u(j,d,s,r,n,o);if(void 0!==p){if(p)continue;l=!1;break}if(b){if(!er(n,function(r,n){if(!or(b,n)&&(j===r||e(j,r,t,u,o)))return b.push(n)})){l=!1;break}}else if(j!==d&&!e(j,d,t,u,o)){l=!1;break}}return o.delete(r),o.delete(n),l}function fr(r){var n=-1,t=Array(r.size);return r.forEach(function(r,u){t[++n]=[u,r]}),t}function ar(r){var n=-1,t=Array(r.size);return r.forEach(function(r){t[++n]=r}),t}var cr=u?u.prototype:void 0,vr=cr?cr.valueOf:void 0;var sr=Object.prototype.hasOwnProperty;var lr="[object Arguments]",br="[object Array]",jr="[object Object]",dr=Object.prototype.hasOwnProperty;function pr(r,n,u,e,o,i){var f=t(r),a=t(n),c=f?br:l(r),p=a?br:l(n),y=(c=c==lr?jr:c)==jr,w=(p=p==lr?jr:p)==jr,_=c==p;if(_&&b(r)){if(!b(n))return!1;f=!0,y=!1}if(_&&!y)return i||(i=new j),f||d(r)?ir(r,n,u,e,o,i):function(r,n,t,u,e,o,i){switch(t){case"[object DataView]":if(r.byteLength!=n.byteLength||r.byteOffset!=n.byteOffset)return!1;r=r.buffer,n=n.buffer;case"[object ArrayBuffer]":return!(r.byteLength!=n.byteLength||!o(new s(r),new s(n)));case"[object Boolean]":case"[object Date]":case"[object Number]":return v(+r,+n);case"[object Error]":return r.name==n.name&&r.message==n.message;case"[object RegExp]":case"[object String]":return r==n+"";case"[object Map]":var f=fr;case"[object Set]":var a=1&u;if(f||(f=ar),r.size!=n.size&&!a)return!1;var c=i.get(r);if(c)return c==n;u|=2,i.set(r,n);var l=ir(f(r),f(n),u,e,o,i);return i.delete(r),l;case"[object Symbol]":if(vr)return vr.call(r)==vr.call(n)}return!1}(r,n,c,u,e,o,i);if(!(1&u)){var m=y&&dr.call(r,"__wrapped__"),O=w&&dr.call(n,"__wrapped__");if(m||O){var h=m?r.value():r,g=O?n.value():n;return i||(i=new j),o(h,g,u,e,i)}}return!!_&&(i||(i=new j),function(r,n,t,u,e,o){var i=1&t,f=tr(r),a=f.length;if(a!=tr(n).length&&!i)return!1;for(var c=a;c--;){var v=f[c];if(!(i?v in n:sr.call(n,v)))return!1}var s=o.get(r),l=o.get(n);if(s&&l)return s==n&&l==r;var b=!0;o.set(r,n),o.set(n,r);for(var j=i;++c<a;){var d=r[v=f[c]],p=n[v];if(u)var y=i?u(p,d,v,n,r,o):u(d,p,v,r,n,o);if(!(void 0===y?d===p||e(d,p,t,u,o):y)){b=!1;break}j||(j="constructor"==v)}if(b&&!j){var w=r.constructor,_=n.constructor;w==_||!("constructor"in r)||!("constructor"in n)||"function"==typeof w&&w instanceof w&&"function"==typeof _&&_ instanceof _||(b=!1)}return o.delete(r),o.delete(n),b}(r,n,u,e,o,i))}function yr(n,t,u,e,o){return n===t||(null==n||null==t||!r(n)&&!r(t)?n!=n&&t!=t:pr(n,t,u,e,yr,o))}function wr(r){return r==r&&!p(r)}function _r(r,n){return function(t){return null!=t&&(t[r]===n&&(void 0!==n||r in Object(t)))}}function mr(r){var n=function(r){for(var n=q(r),t=n.length;t--;){var u=n[t],e=r[u];n[t]=[u,e,wr(e)]}return n}(r);return 1==n.length&&n[0][2]?_r(n[0][0],n[0][1]):function(t){return t===r||function(r,n,t,u){var e=t.length,o=e;if(null==r)return!o;for(r=Object(r);e--;){var i=t[e];if(i[2]?i[1]!==r[i[0]]:!(i[0]in r))return!1}for(;++e<o;){var f=(i=t[e])[0],a=r[f],c=i[1];if(i[2]){if(void 0===a&&!(f in r))return!1}else if(!yr(c,a,3,u,new j))return!1}return!0}(t,0,n)}}function Or(r,n){return null!=r&&n in Object(r)}function hr(r,n,u){for(var e=-1,o=(n=G(n,r)).length,i=!1;++e<o;){var f=H(n[e]);if(!(i=null!=r&&u(r,f)))break;r=r[f]}return i||++e!=o?i:!!(o=null==r?0:r.length)&&y(o)&&w(f,o)&&(t(r)||a(r))}function gr(r,n){return null!=r&&hr(r,n,Or)}function Ar(r,n){return z(r)&&wr(n)?_r(H(r),n):function(t){var u=function(r,n,t){var u=null==r?void 0:I(r,n);return void 0===u?t:u}(t,r);return void 0===u&&u===n?gr(t,r):yr(n,u,3)}}function kr(r){return z(r)?(n=H(r),function(r){return null==r?void 0:r[n]}):function(r){return function(n){return I(n,r)}}(r);var n}function Sr(r){return"function"==typeof r?r:null==r?_:"object"==typeof r?t(r)?Ar(r[0],r[1]):mr(r):kr(r)}function xr(r,n){return r&&m(r,n,q)}var Dr,Er=(Dr=xr,function(r,n){if(null==r)return r;if(!e(r))return Dr(r,n);for(var t=r.length,u=-1,o=Object(r);++u<t&&!1!==n(o[u],u,o););return r});function $r(r){return"function"==typeof r?r:_}function qr(r,n){return(t(r)?x:Er)(r,$r(n))}function Br(r,n){var t=[];return Er(r,function(r,u,e){n(r,u,e)&&t.push(r)}),t}function Vr(r,n){return(t(r)?T:Br)(r,Sr(n))}function zr(r,n,t,u,e){return e(r,function(r,e,o){t=u?(u=!1,r):n(t,r,e,o)}),t}function Fr(r,n,u){var e=t(r)?Q:zr,o=arguments.length<3;return e(r,Sr(n),u,o,Er)}var Mr=O&&1/ar(new O([,-0]))[1]==1/0?function(r){return new O(r)}:function(){};function Nr(r,n,t){var u=-1,e=$,o=r.length,i=!0,f=[],a=f;if(o>=200){var c=n?null:Mr(r);if(c)return ar(c);i=!1,e=or,a=new ur}else a=n?[]:f;r:for(;++u<o;){var v=r[u],s=n?n(v):v;if(v=0!==v?v:0,i&&s==s){for(var l=a.length;l--;)if(a[l]===s)continue r;n&&a.push(s),f.push(v)}else e(a,s,t)||(a!==f&&a.push(s),f.push(v))}return f}export{Er as a,P as b,Sr as c,g as d,J as e,nr as f,rr as g,x as h,h as i,tr as j,q as k,Nr as l,Vr as m,qr as n,D as o,$r as p,xr as q,Fr as r,W as s,hr as t,G as u,H as v,I as w,gr as x,C as y};
1
+ import{aU as r,bq as n,aE as t,aS as u,aD as e,br as o,bs as i,bt as f,bu as a,bv as c,bl as v,bw as s,aV as l,a_ as b,b1 as j,bx as d,aY as p,by as y,bo as w,aF as _,bm as m,bz as O}from"./App-ClEyOIsd.js";function h(t){return"symbol"==typeof t||r(t)&&"[object Symbol]"==n(t)}function g(r,n){for(var t=-1,u=null==r?0:r.length,e=Array(u);++t<u;)e[t]=n(r[t],t,r);return e}var A=u?u.prototype:void 0,k=A?A.toString:void 0;function S(r){if("string"==typeof r)return r;if(t(r))return g(r,S)+"";if(h(r))return k?k.call(r):"";var n=r+"";return"0"==n&&1/r==-1/0?"-0":n}function x(r,n){for(var t=-1,u=null==r?0:r.length;++t<u&&!1!==n(r[t],t,r););return r}function D(r,n,t,u){for(var e=r.length,o=t+-1;++o<e;)if(n(r[o],o,r))return o;return-1}function E(r){return r!=r}function $(r,n){return!!(null==r?0:r.length)&&function(r,n,t){return n==n?function(r,n,t){for(var u=t-1,e=r.length;++u<e;)if(r[u]===n)return u;return-1}(r,n,t):D(r,E,t)}(r,n,0)>-1}function q(r){return e(r)?o(r):i(r)}var B=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,V=/^\w*$/;function z(r,n){if(t(r))return!1;var u=typeof r;return!("number"!=u&&"symbol"!=u&&"boolean"!=u&&null!=r&&!h(r))||(V.test(r)||!B.test(r)||null!=n&&r in Object(n))}var F,M,N,R=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,U=/\\(\\)?/g,Y=(F=function(r){var n=[];return 46===r.charCodeAt(0)&&n.push(""),r.replace(R,function(r,t,u,e){n.push(u?e.replace(U,"$1"):t||r)}),n},M=f(F,function(r){return 500===N.size&&N.clear(),r}),N=M.cache,M);function C(r){return null==r?"":S(r)}function G(r,n){return t(r)?r:z(r,n)?[r]:Y(C(r))}function H(r){if("string"==typeof r||h(r))return r;var n=r+"";return"0"==n&&1/r==-1/0?"-0":n}function I(r,n){for(var t=0,u=(n=G(n,r)).length;null!=r&&t<u;)r=r[H(n[t++])];return t&&t==u?r:void 0}function J(r,n){for(var t=-1,u=n.length,e=r.length;++t<u;)r[e+t]=n[t];return r}var K=u?u.isConcatSpreadable:void 0;function L(r){return t(r)||a(r)||!!(K&&r&&r[K])}function P(r,n,t,u,e){var o=-1,i=r.length;for(t||(t=L),e||(e=[]);++o<i;){var f=r[o];t(f)?J(e,f):u||(e[e.length]=f)}return e}function Q(r,n,t,u){var e=-1,o=null==r?0:r.length;for(u&&o&&(t=r[++e]);++e<o;)t=n(t,r[e],e,r);return t}function T(r,n){for(var t=-1,u=null==r?0:r.length,e=0,o=[];++t<u;){var i=r[t];n(i,t,r)&&(o[e++]=i)}return o}function W(){return[]}var X=Object.prototype.propertyIsEnumerable,Z=Object.getOwnPropertySymbols,rr=Z?function(r){return null==r?[]:(r=Object(r),T(Z(r),function(n){return X.call(r,n)}))}:W;function nr(r,n,u){var e=n(r);return t(r)?e:J(e,u(r))}function tr(r){return nr(r,q,rr)}function ur(r){var n=-1,t=null==r?0:r.length;for(this.__data__=new c;++n<t;)this.add(r[n])}function er(r,n){for(var t=-1,u=null==r?0:r.length;++t<u;)if(n(r[t],t,r))return!0;return!1}function or(r,n){return r.has(n)}ur.prototype.add=ur.prototype.push=function(r){return this.__data__.set(r,"__lodash_hash_undefined__"),this},ur.prototype.has=function(r){return this.__data__.has(r)};function ir(r,n,t,u,e,o){var i=1&t,f=r.length,a=n.length;if(f!=a&&!(i&&a>f))return!1;var c=o.get(r),v=o.get(n);if(c&&v)return c==n&&v==r;var s=-1,l=!0,b=2&t?new ur:void 0;for(o.set(r,n),o.set(n,r);++s<f;){var j=r[s],d=n[s];if(u)var p=i?u(d,j,s,n,r,o):u(j,d,s,r,n,o);if(void 0!==p){if(p)continue;l=!1;break}if(b){if(!er(n,function(r,n){if(!or(b,n)&&(j===r||e(j,r,t,u,o)))return b.push(n)})){l=!1;break}}else if(j!==d&&!e(j,d,t,u,o)){l=!1;break}}return o.delete(r),o.delete(n),l}function fr(r){var n=-1,t=Array(r.size);return r.forEach(function(r,u){t[++n]=[u,r]}),t}function ar(r){var n=-1,t=Array(r.size);return r.forEach(function(r){t[++n]=r}),t}var cr=u?u.prototype:void 0,vr=cr?cr.valueOf:void 0;var sr=Object.prototype.hasOwnProperty;var lr="[object Arguments]",br="[object Array]",jr="[object Object]",dr=Object.prototype.hasOwnProperty;function pr(r,n,u,e,o,i){var f=t(r),a=t(n),c=f?br:l(r),p=a?br:l(n),y=(c=c==lr?jr:c)==jr,w=(p=p==lr?jr:p)==jr,_=c==p;if(_&&b(r)){if(!b(n))return!1;f=!0,y=!1}if(_&&!y)return i||(i=new j),f||d(r)?ir(r,n,u,e,o,i):function(r,n,t,u,e,o,i){switch(t){case"[object DataView]":if(r.byteLength!=n.byteLength||r.byteOffset!=n.byteOffset)return!1;r=r.buffer,n=n.buffer;case"[object ArrayBuffer]":return!(r.byteLength!=n.byteLength||!o(new s(r),new s(n)));case"[object Boolean]":case"[object Date]":case"[object Number]":return v(+r,+n);case"[object Error]":return r.name==n.name&&r.message==n.message;case"[object RegExp]":case"[object String]":return r==n+"";case"[object Map]":var f=fr;case"[object Set]":var a=1&u;if(f||(f=ar),r.size!=n.size&&!a)return!1;var c=i.get(r);if(c)return c==n;u|=2,i.set(r,n);var l=ir(f(r),f(n),u,e,o,i);return i.delete(r),l;case"[object Symbol]":if(vr)return vr.call(r)==vr.call(n)}return!1}(r,n,c,u,e,o,i);if(!(1&u)){var m=y&&dr.call(r,"__wrapped__"),O=w&&dr.call(n,"__wrapped__");if(m||O){var h=m?r.value():r,g=O?n.value():n;return i||(i=new j),o(h,g,u,e,i)}}return!!_&&(i||(i=new j),function(r,n,t,u,e,o){var i=1&t,f=tr(r),a=f.length;if(a!=tr(n).length&&!i)return!1;for(var c=a;c--;){var v=f[c];if(!(i?v in n:sr.call(n,v)))return!1}var s=o.get(r),l=o.get(n);if(s&&l)return s==n&&l==r;var b=!0;o.set(r,n),o.set(n,r);for(var j=i;++c<a;){var d=r[v=f[c]],p=n[v];if(u)var y=i?u(p,d,v,n,r,o):u(d,p,v,r,n,o);if(!(void 0===y?d===p||e(d,p,t,u,o):y)){b=!1;break}j||(j="constructor"==v)}if(b&&!j){var w=r.constructor,_=n.constructor;w==_||!("constructor"in r)||!("constructor"in n)||"function"==typeof w&&w instanceof w&&"function"==typeof _&&_ instanceof _||(b=!1)}return o.delete(r),o.delete(n),b}(r,n,u,e,o,i))}function yr(n,t,u,e,o){return n===t||(null==n||null==t||!r(n)&&!r(t)?n!=n&&t!=t:pr(n,t,u,e,yr,o))}function wr(r){return r==r&&!p(r)}function _r(r,n){return function(t){return null!=t&&(t[r]===n&&(void 0!==n||r in Object(t)))}}function mr(r){var n=function(r){for(var n=q(r),t=n.length;t--;){var u=n[t],e=r[u];n[t]=[u,e,wr(e)]}return n}(r);return 1==n.length&&n[0][2]?_r(n[0][0],n[0][1]):function(t){return t===r||function(r,n,t,u){var e=t.length,o=e;if(null==r)return!o;for(r=Object(r);e--;){var i=t[e];if(i[2]?i[1]!==r[i[0]]:!(i[0]in r))return!1}for(;++e<o;){var f=(i=t[e])[0],a=r[f],c=i[1];if(i[2]){if(void 0===a&&!(f in r))return!1}else if(!yr(c,a,3,u,new j))return!1}return!0}(t,0,n)}}function Or(r,n){return null!=r&&n in Object(r)}function hr(r,n,u){for(var e=-1,o=(n=G(n,r)).length,i=!1;++e<o;){var f=H(n[e]);if(!(i=null!=r&&u(r,f)))break;r=r[f]}return i||++e!=o?i:!!(o=null==r?0:r.length)&&y(o)&&w(f,o)&&(t(r)||a(r))}function gr(r,n){return null!=r&&hr(r,n,Or)}function Ar(r,n){return z(r)&&wr(n)?_r(H(r),n):function(t){var u=function(r,n,t){var u=null==r?void 0:I(r,n);return void 0===u?t:u}(t,r);return void 0===u&&u===n?gr(t,r):yr(n,u,3)}}function kr(r){return z(r)?(n=H(r),function(r){return null==r?void 0:r[n]}):function(r){return function(n){return I(n,r)}}(r);var n}function Sr(r){return"function"==typeof r?r:null==r?_:"object"==typeof r?t(r)?Ar(r[0],r[1]):mr(r):kr(r)}function xr(r,n){return r&&m(r,n,q)}var Dr,Er=(Dr=xr,function(r,n){if(null==r)return r;if(!e(r))return Dr(r,n);for(var t=r.length,u=-1,o=Object(r);++u<t&&!1!==n(o[u],u,o););return r});function $r(r){return"function"==typeof r?r:_}function qr(r,n){return(t(r)?x:Er)(r,$r(n))}function Br(r,n){var t=[];return Er(r,function(r,u,e){n(r,u,e)&&t.push(r)}),t}function Vr(r,n){return(t(r)?T:Br)(r,Sr(n))}function zr(r,n,t,u,e){return e(r,function(r,e,o){t=u?(u=!1,r):n(t,r,e,o)}),t}function Fr(r,n,u){var e=t(r)?Q:zr,o=arguments.length<3;return e(r,Sr(n),u,o,Er)}var Mr=O&&1/ar(new O([,-0]))[1]==1/0?function(r){return new O(r)}:function(){};function Nr(r,n,t){var u=-1,e=$,o=r.length,i=!0,f=[],a=f;if(o>=200){var c=n?null:Mr(r);if(c)return ar(c);i=!1,e=or,a=new ur}else a=n?[]:f;r:for(;++u<o;){var v=r[u],s=n?n(v):v;if(v=0!==v?v:0,i&&s==s){for(var l=a.length;l--;)if(a[l]===s)continue r;n&&a.push(s),f.push(v)}else e(a,s,t)||(a!==f&&a.push(s),f.push(v))}return f}export{Er as a,P as b,Sr as c,g as d,J as e,nr as f,rr as g,x as h,h as i,tr as j,q as k,Nr as l,Vr as m,qr as n,D as o,$r as p,xr as q,Fr as r,W as s,hr as t,G as u,H as v,I as w,gr as x,C as y};
@@ -1 +1 @@
1
- import{a0 as n,a1 as t,a2 as u,a3 as r,a4 as i,a5 as a,a6 as f,a7 as o,a8 as e,a9 as s,aa as c,ab as l,ac as h,ad as p,ae as v}from"./App-CPB0GzVq.js";function y(n){return n.innerRadius}function x(n){return n.outerRadius}function d(n){return n.startAngle}function m(n){return n.endAngle}function b(n){return n&&n.padAngle}function j(n,t,u,r,i,a,f){var o=n-u,s=t-r,c=(f?a:-a)/e(o*o+s*s),l=c*s,p=-c*o,v=n+l,y=t+p,x=u+l,d=r+p,m=(v+x)/2,b=(y+d)/2,j=x-v,A=d-y,g=j*j+A*A,k=i-a,q=v*d-x*y,w=(A<0?-1:1)*e(h(0,k*k*g-q*q)),z=(q*A-j*w)/g,B=(-q*j-A*w)/g,C=(q*A+j*w)/g,D=(-q*j+A*w)/g,E=z-m,F=B-b,G=C-m,H=D-b;return E*E+F*F>G*G+H*H&&(z=C,B=D),{cx:z,cy:B,x01:-l,y01:-p,x11:z*(i/k-1),y11:B*(i/k-1)}}function A(){var h=y,A=x,g=i(0),k=null,q=d,w=m,z=b,B=null,C=n(D);function D(){var n,i,y=+h.apply(this,arguments),x=+A.apply(this,arguments),d=q.apply(this,arguments)-a,m=w.apply(this,arguments)-a,b=c(m-d),D=m>d;if(B||(B=n=C()),x<y&&(i=x,x=y,y=i),x>f)if(b>o-f)B.moveTo(x*u(d),x*r(d)),B.arc(0,0,x,d,m,!D),y>f&&(B.moveTo(y*u(m),y*r(m)),B.arc(0,0,y,m,d,D));else{var E,F,G=d,H=m,I=d,J=m,K=b,L=b,M=z.apply(this,arguments)/2,N=M>f&&(k?+k.apply(this,arguments):e(y*y+x*x)),O=s(c(x-y)/2,+g.apply(this,arguments)),P=O,Q=O;if(N>f){var R=p(N/y*r(M)),S=p(N/x*r(M));(K-=2*R)>f?(I+=R*=D?1:-1,J-=R):(K=0,I=J=(d+m)/2),(L-=2*S)>f?(G+=S*=D?1:-1,H-=S):(L=0,G=H=(d+m)/2)}var T=x*u(G),U=x*r(G),V=y*u(J),W=y*r(J);if(O>f){var X,Y=x*u(H),Z=x*r(H),$=y*u(I),_=y*r(I);if(b<t)if(X=function(n,t,u,r,i,a,o,e){var s=u-n,c=r-t,l=o-i,h=e-a,p=h*s-l*c;if(!(p*p<f))return[n+(p=(l*(t-a)-h*(n-i))/p)*s,t+p*c]}(T,U,$,_,Y,Z,V,W)){var nn=T-X[0],tn=U-X[1],un=Y-X[0],rn=Z-X[1],an=1/r(v((nn*un+tn*rn)/(e(nn*nn+tn*tn)*e(un*un+rn*rn)))/2),fn=e(X[0]*X[0]+X[1]*X[1]);P=s(O,(y-fn)/(an-1)),Q=s(O,(x-fn)/(an+1))}else P=Q=0}L>f?Q>f?(E=j($,_,T,U,x,Q,D),F=j(Y,Z,V,W,x,Q,D),B.moveTo(E.cx+E.x01,E.cy+E.y01),Q<O?B.arc(E.cx,E.cy,Q,l(E.y01,E.x01),l(F.y01,F.x01),!D):(B.arc(E.cx,E.cy,Q,l(E.y01,E.x01),l(E.y11,E.x11),!D),B.arc(0,0,x,l(E.cy+E.y11,E.cx+E.x11),l(F.cy+F.y11,F.cx+F.x11),!D),B.arc(F.cx,F.cy,Q,l(F.y11,F.x11),l(F.y01,F.x01),!D))):(B.moveTo(T,U),B.arc(0,0,x,G,H,!D)):B.moveTo(T,U),y>f&&K>f?P>f?(E=j(V,W,Y,Z,y,-P,D),F=j(T,U,$,_,y,-P,D),B.lineTo(E.cx+E.x01,E.cy+E.y01),P<O?B.arc(E.cx,E.cy,P,l(E.y01,E.x01),l(F.y01,F.x01),!D):(B.arc(E.cx,E.cy,P,l(E.y01,E.x01),l(E.y11,E.x11),!D),B.arc(0,0,y,l(E.cy+E.y11,E.cx+E.x11),l(F.cy+F.y11,F.cx+F.x11),D),B.arc(F.cx,F.cy,P,l(F.y11,F.x11),l(F.y01,F.x01),!D))):B.arc(0,0,y,J,I,D):B.lineTo(V,W)}else B.moveTo(0,0);if(B.closePath(),n)return B=null,n+""||null}return D.centroid=function(){var n=(+h.apply(this,arguments)+ +A.apply(this,arguments))/2,i=(+q.apply(this,arguments)+ +w.apply(this,arguments))/2-t/2;return[u(i)*n,r(i)*n]},D.innerRadius=function(n){return arguments.length?(h="function"==typeof n?n:i(+n),D):h},D.outerRadius=function(n){return arguments.length?(A="function"==typeof n?n:i(+n),D):A},D.cornerRadius=function(n){return arguments.length?(g="function"==typeof n?n:i(+n),D):g},D.padRadius=function(n){return arguments.length?(k=null==n?null:"function"==typeof n?n:i(+n),D):k},D.startAngle=function(n){return arguments.length?(q="function"==typeof n?n:i(+n),D):q},D.endAngle=function(n){return arguments.length?(w="function"==typeof n?n:i(+n),D):w},D.padAngle=function(n){return arguments.length?(z="function"==typeof n?n:i(+n),D):z},D.context=function(n){return arguments.length?(B=null==n?null:n,D):B},D}export{A as d};
1
+ import{a0 as n,a1 as t,a2 as u,a3 as r,a4 as i,a5 as a,a6 as f,a7 as o,a8 as e,a9 as s,aa as c,ab as l,ac as h,ad as p,ae as v}from"./App-ClEyOIsd.js";function y(n){return n.innerRadius}function x(n){return n.outerRadius}function d(n){return n.startAngle}function m(n){return n.endAngle}function b(n){return n&&n.padAngle}function j(n,t,u,r,i,a,f){var o=n-u,s=t-r,c=(f?a:-a)/e(o*o+s*s),l=c*s,p=-c*o,v=n+l,y=t+p,x=u+l,d=r+p,m=(v+x)/2,b=(y+d)/2,j=x-v,A=d-y,g=j*j+A*A,k=i-a,q=v*d-x*y,w=(A<0?-1:1)*e(h(0,k*k*g-q*q)),z=(q*A-j*w)/g,B=(-q*j-A*w)/g,C=(q*A+j*w)/g,D=(-q*j+A*w)/g,E=z-m,F=B-b,G=C-m,H=D-b;return E*E+F*F>G*G+H*H&&(z=C,B=D),{cx:z,cy:B,x01:-l,y01:-p,x11:z*(i/k-1),y11:B*(i/k-1)}}function A(){var h=y,A=x,g=i(0),k=null,q=d,w=m,z=b,B=null,C=n(D);function D(){var n,i,y=+h.apply(this,arguments),x=+A.apply(this,arguments),d=q.apply(this,arguments)-a,m=w.apply(this,arguments)-a,b=c(m-d),D=m>d;if(B||(B=n=C()),x<y&&(i=x,x=y,y=i),x>f)if(b>o-f)B.moveTo(x*u(d),x*r(d)),B.arc(0,0,x,d,m,!D),y>f&&(B.moveTo(y*u(m),y*r(m)),B.arc(0,0,y,m,d,D));else{var E,F,G=d,H=m,I=d,J=m,K=b,L=b,M=z.apply(this,arguments)/2,N=M>f&&(k?+k.apply(this,arguments):e(y*y+x*x)),O=s(c(x-y)/2,+g.apply(this,arguments)),P=O,Q=O;if(N>f){var R=p(N/y*r(M)),S=p(N/x*r(M));(K-=2*R)>f?(I+=R*=D?1:-1,J-=R):(K=0,I=J=(d+m)/2),(L-=2*S)>f?(G+=S*=D?1:-1,H-=S):(L=0,G=H=(d+m)/2)}var T=x*u(G),U=x*r(G),V=y*u(J),W=y*r(J);if(O>f){var X,Y=x*u(H),Z=x*r(H),$=y*u(I),_=y*r(I);if(b<t)if(X=function(n,t,u,r,i,a,o,e){var s=u-n,c=r-t,l=o-i,h=e-a,p=h*s-l*c;if(!(p*p<f))return[n+(p=(l*(t-a)-h*(n-i))/p)*s,t+p*c]}(T,U,$,_,Y,Z,V,W)){var nn=T-X[0],tn=U-X[1],un=Y-X[0],rn=Z-X[1],an=1/r(v((nn*un+tn*rn)/(e(nn*nn+tn*tn)*e(un*un+rn*rn)))/2),fn=e(X[0]*X[0]+X[1]*X[1]);P=s(O,(y-fn)/(an-1)),Q=s(O,(x-fn)/(an+1))}else P=Q=0}L>f?Q>f?(E=j($,_,T,U,x,Q,D),F=j(Y,Z,V,W,x,Q,D),B.moveTo(E.cx+E.x01,E.cy+E.y01),Q<O?B.arc(E.cx,E.cy,Q,l(E.y01,E.x01),l(F.y01,F.x01),!D):(B.arc(E.cx,E.cy,Q,l(E.y01,E.x01),l(E.y11,E.x11),!D),B.arc(0,0,x,l(E.cy+E.y11,E.cx+E.x11),l(F.cy+F.y11,F.cx+F.x11),!D),B.arc(F.cx,F.cy,Q,l(F.y11,F.x11),l(F.y01,F.x01),!D))):(B.moveTo(T,U),B.arc(0,0,x,G,H,!D)):B.moveTo(T,U),y>f&&K>f?P>f?(E=j(V,W,Y,Z,y,-P,D),F=j(T,U,$,_,y,-P,D),B.lineTo(E.cx+E.x01,E.cy+E.y01),P<O?B.arc(E.cx,E.cy,P,l(E.y01,E.x01),l(F.y01,F.x01),!D):(B.arc(E.cx,E.cy,P,l(E.y01,E.x01),l(E.y11,E.x11),!D),B.arc(0,0,y,l(E.cy+E.y11,E.cx+E.x11),l(F.cy+F.y11,F.cx+F.x11),D),B.arc(F.cx,F.cy,P,l(F.y11,F.x11),l(F.y01,F.x01),!D))):B.arc(0,0,y,J,I,D):B.lineTo(V,W)}else B.moveTo(0,0);if(B.closePath(),n)return B=null,n+""||null}return D.centroid=function(){var n=(+h.apply(this,arguments)+ +A.apply(this,arguments))/2,i=(+q.apply(this,arguments)+ +w.apply(this,arguments))/2-t/2;return[u(i)*n,r(i)*n]},D.innerRadius=function(n){return arguments.length?(h="function"==typeof n?n:i(+n),D):h},D.outerRadius=function(n){return arguments.length?(A="function"==typeof n?n:i(+n),D):A},D.cornerRadius=function(n){return arguments.length?(g="function"==typeof n?n:i(+n),D):g},D.padRadius=function(n){return arguments.length?(k=null==n?null:"function"==typeof n?n:i(+n),D):k},D.startAngle=function(n){return arguments.length?(q="function"==typeof n?n:i(+n),D):q},D.endAngle=function(n){return arguments.length?(w="function"==typeof n?n:i(+n),D):w},D.padAngle=function(n){return arguments.length?(z="function"==typeof n?n:i(+n),D):z},D.context=function(n){return arguments.length?(B=null==n?null:n,D):B},D}export{A as d};