@forsion/unit 2.13.0 → 2.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.mjs +5 -3
- package/package.json +1 -1
- package/release.json +5 -5
- package/web/assets/{ArtificialView-BSv3Mx5C.js → ArtificialView-XwHMLUFb.js} +1 -1
- package/web/assets/{AutomationBuilder-BuiHtVB-.js → AutomationBuilder-hqs0QhMt.js} +1 -1
- package/web/assets/{CalendarConfigView-BJtG6cqN.js → CalendarConfigView-DKib8Oed.js} +1 -1
- package/web/assets/{CalendarView-C-FX1RED.js → CalendarView-DJ5iOzvu.js} +1 -1
- package/web/assets/{CapabilityMenu-kx1TIJYN.js → CapabilityMenu-SwVlZ06x.js} +1 -1
- package/web/assets/{CheckboxInput-eW7xdiRS.js → CheckboxInput-BC-5a_C9.js} +1 -1
- package/web/assets/{Chrome-B77-lQyh.js → Chrome-HdfyYV3i.js} +1 -1
- package/web/assets/{CodeView-Df3AiSIi.js → CodeView-CFL6yQ-6.js} +3 -3
- package/web/assets/{DashboardGridView-MlO1dpuo.js → DashboardGridView-B9DCWYVb.js} +12 -12
- package/web/assets/{EventCard-CDmeCbI8.js → EventCard-B_ndpqH_.js} +1 -1
- package/web/assets/{ExcalidrawCanvas-D9vkBh_5.js → ExcalidrawCanvas-BQ4KKLJP.js} +1 -1
- package/web/assets/{FloatingToc-tART_jC4.js → FloatingToc-Ce9GamvH.js} +1 -1
- package/web/assets/{HomepageView-Trqmd3RV.js → HomepageView-RCOfcVbE.js} +1 -1
- package/web/assets/{ImageStudioPanels-BfCVTnKC.js → ImageStudioPanels-lkS_y2uM.js} +2 -2
- package/web/assets/{ImageStudioView-KJhx0wJk.js → ImageStudioView-UPv52acl.js} +1 -1
- package/web/assets/{InlineFiles-BHwivGbQ.js → InlineFiles-CQbQumkf.js} +1 -1
- package/web/assets/{MarkdownBlock-D8LgHFYY.js → MarkdownBlock-CkqiwPXa.js} +19 -19
- package/web/assets/{ModelPill-DrW2cG0l.js → ModelPill-CY-rU1RU.js} +2 -2
- package/web/assets/{MuseLibraryView-CW78Uivf.js → MuseLibraryView-CtTHlVnT.js} +2 -2
- package/web/assets/{MuseView-Cb6R_l4i.js → MuseView-CC2A7MBs.js} +2 -2
- package/web/assets/{PageHistoryPanel-BQs9IWTP.js → PageHistoryPanel-KhKT1DLy.js} +2 -2
- package/web/assets/{PdfAnnotator-BFTBkxvO.js → PdfAnnotator-DUyrgY-t.js} +1 -1
- package/web/assets/{ProductView-mB-S0j81.js → ProductView-CgsIYZqD.js} +1 -1
- package/web/assets/{RightPanel-BVZeVO3c.js → RightPanel-BHDgqTFs.js} +3 -3
- package/web/assets/RunLocationPicker-DBnXYV5B.js +38 -0
- package/web/assets/{SidebarRow-D77yrSLf.js → SidebarRow-BAJxbMcx.js} +1 -1
- package/web/assets/{SketchCard-CAAr_cqF.js → SketchCard-BGYz-bXP.js} +1 -1
- package/web/assets/{StudioGuestSurface-DthpuVGg.js → StudioGuestSurface-lt6znmkl.js} +1 -1
- package/web/assets/{TodoListView-C3ZkMIIf.js → TodoListView-DPKhee6i.js} +1 -1
- package/web/assets/{Tooltip-D9Dt9ZTr.js → Tooltip-ZxrDqN4p.js} +1 -1
- package/web/assets/{UnifiedPage-C75y-MKT.js → UnifiedPage-BX6ZQL0h.js} +27 -27
- package/web/assets/{amadeus-manual.en-D5wZKuag.js → amadeus-manual.en-DzRWr4BL.js} +15 -15
- package/web/assets/{amadeus-manual.zh-Br5fidrj.js → amadeus-manual.zh-DW32DkL7.js} +15 -15
- package/web/assets/{appStore-B1ynyt42.js → appStore-DWP8UET9.js} +99 -79
- package/web/assets/appStore-wtOILggO.css +1 -0
- package/web/assets/{arrow-up-right-R10mR2I6.js → arrow-up-right-DrCXuWS7.js} +1 -1
- package/web/assets/{astryxBridge-CU_kQTEl.js → astryxBridge-D-m4_kYt.js} +3 -3
- package/web/assets/{automationListSource-B8EIRmDW.js → automationListSource-C8BNy6RY.js} +1 -1
- package/web/assets/{book-open-DBJ3dDpw.js → book-open-OLNm7OaB.js} +1 -1
- package/web/assets/{calendarNavStore-DGvUlU5N.js → calendarNavStore-Cylfvv3s.js} +1 -1
- package/web/assets/{canvasPrefs-DwL_OAAo.js → canvasPrefs-8taQ42Cz.js} +1 -1
- package/web/assets/{chatBoxSurface-Lq-2qfd3.js → chatBoxSurface-CIlzs45H.js} +1 -1
- package/web/assets/{circle-question-mark-HPZpZQxd.js → circle-question-mark-XbAFplz1.js} +1 -1
- package/web/assets/{circle-x-BZfe7d6S.js → circle-x-fcReAZaE.js} +1 -1
- package/web/assets/{client-DxGbwZLy.js → client-0MPbodA6.js} +1 -1
- package/web/assets/{code-xml-joKQ-qGS.js → code-xml-Cuna8Kh4.js} +1 -1
- package/web/assets/{codeStudioStore-C7rGKlOC.js → codeStudioStore-BBU62GTy.js} +1 -1
- package/web/assets/{codingNavigation-CjeWG4xm.js → codingNavigation-DDlPpPk5.js} +7 -7
- package/web/assets/{create-BjBRKATq.js → create-BGtEfCcg.js} +2 -2
- package/web/assets/{dashboardSurface-Cojgf_-U.js → dashboardSurface-BYM3C7WG.js} +1 -1
- package/web/assets/{deskCapture-DnGWk1iq.js → deskCapture-BiUCmqfc.js} +1 -1
- package/web/assets/{diff2html-Cd1rVi_Z.js → diff2html-BNp2FTbk.js} +1 -1
- package/web/assets/{docx-preview-CK0k1mUD.js → docx-preview-CFznGVOU.js} +1 -1
- package/web/assets/{emoji-Cjm3bKiF.js → emoji-6zl4yfOS.js} +1 -1
- package/web/assets/{floatingTocSurface-Dd1pT5j5.js → floatingTocSurface-DreXPCa6.js} +1 -1
- package/web/assets/{foldActions-Dm-uAt3L.js → foldActions-05QcQziQ.js} +1 -1
- package/web/assets/{folder-CvZyHIgb.js → folder-BpsfOHD4.js} +1 -1
- package/web/assets/{folder-plus-BRScGQ9m.js → folder-plus-BeQHr4AZ.js} +1 -1
- package/web/assets/{gestures-CZQVefU0.js → gestures-DQBCcK4y.js} +1 -1
- package/web/assets/{hand-D3QspKYq.js → hand-Bko7ms15.js} +1 -1
- package/web/assets/{hard-drive-BQsHSala.js → hard-drive-BpuI5ebj.js} +1 -1
- package/web/assets/{i18n.generated-BZRHO2Nc.js → i18n.generated-BuLjnmY8.js} +1 -1
- package/web/assets/{imageStudio-Cy3_437s.js → imageStudio-BLVNKmEG.js} +2 -2
- package/web/assets/{index-BPhwi4-v.js → index-BF10xp_K.js} +1 -1
- package/web/assets/{index-GjLSlygt.js → index-BHm6K743.js} +1 -1
- package/web/assets/{index-Bh_nLVTc.js → index-BM2o7PeV.js} +5 -5
- package/web/assets/{index-BcVGjCAJ.js → index-BgnNNv3e.js} +1 -1
- package/web/assets/{index-CcOag8eb.js → index-C0Gy2NQ6.js} +1 -1
- package/web/assets/{index-0AYHATDX.js → index-C1doZp5H.js} +1 -1
- package/web/assets/{index-9BmmlTjY.js → index-C4L6vjd_.js} +1 -1
- package/web/assets/{index-8ag1K7AZ.js → index-CD3yIkOA.js} +1 -1
- package/web/assets/{index-Dkd-nl1u.js → index-CJeUgjPU.js} +1 -1
- package/web/assets/{index-B5GxvbNm.js → index-CLHoq1w-.js} +1 -1
- package/web/assets/{index-DElrDw66.js → index-CUZI62qU.js} +1 -1
- package/web/assets/{index-BgtO11q8.js → index-Cff42k7q.js} +1 -1
- package/web/assets/{index-Dj-PygjB.js → index-Ck_O3Jdd.js} +1 -1
- package/web/assets/index-CuiYK18N.js +1 -0
- package/web/assets/{index-Bpc3R3DS.js → index-CwcOeZdT.js} +1 -1
- package/web/assets/{index-DJLWTPtq.js → index-D6AycQIz.js} +1 -1
- package/web/assets/{index-C9yo04Ck.js → index-D7gVhvNY.js} +1 -1
- package/web/assets/{index-BnWj6ggb.js → index-D9UZQy42.js} +1 -1
- package/web/assets/{index-D6mpAJ9S.js → index-DuBQ0j2g.js} +1 -1
- package/web/assets/{index-1FhRiJ_X.js → index-OD1gSX3h.js} +1 -1
- package/web/assets/{index-DNE_PBJt.js → index-Uo5tswys.js} +1 -1
- package/web/assets/{index-BgDZGDqt.js → index-o8cj0pRH.js} +1 -1
- package/web/assets/{index-BdZaheMZ.js → index-rHjhbwvm.js} +1 -1
- package/web/assets/{index-4E9nrhwf.js → index-rggq2czF.js} +1 -1
- package/web/assets/{index-D0FLFLfh.js → index-sCXThwqZ.js} +1 -1
- package/web/assets/{invitePage-B4gMvEKi.js → invitePage-b0HGvMj6.js} +1 -1
- package/web/assets/{ipc-CPhL3bPp.js → ipc-CxAyeo8q.js} +1 -1
- package/web/assets/{jszip.min-DAJT9RUA.js → jszip.min-B94KpE21.js} +1 -1
- package/web/assets/{layout-grid-DfUfnvDS.js → layout-grid-BBVuEdWG.js} +1 -1
- package/web/assets/{linkFollow-C6PHGUxk.js → linkFollow-B7ivDZMM.js} +5 -5
- package/web/assets/{list-tree-DaGpnIYu.js → list-tree-4-0QDbLu.js} +1 -1
- package/web/assets/{listFold-Q_8mh5ZG.js → listFold-DLuxXiIj.js} +1 -1
- package/web/assets/{lock-DQ_yL4nF.js → lock-CnbZm4vo.js} +1 -1
- package/web/assets/{log-out-DFwTeh2X.js → log-out-BEynWaHa.js} +1 -1
- package/web/assets/{main-NgUPPqDn.css → main-BiS_5wrB.css} +1 -1
- package/web/assets/main-sIq2N9Z5.js +20 -0
- package/web/assets/{markdownEditorSurface-e_oMhqx-.js → markdownEditorSurface-ZSJ3RHAv.js} +1 -1
- package/web/assets/{mdMarkStore-DjN4bf1T.js → mdMarkStore-DQHDjG7s.js} +2 -2
- package/web/assets/{mdMarks-cmL6vzR-.js → mdMarks-DbIcRa0O.js} +1 -1
- package/web/assets/{message-square-plus-CEHkduIL.js → message-square-plus-CpiKDvle.js} +1 -1
- package/web/assets/{messages-CBtmbpur.js → messages-_jta1lSI.js} +1 -1
- package/web/assets/minus-C9ndHJ9O.js +1 -0
- package/web/assets/{mobileEntry-qR7BAROr.js → mobileEntry-CPmU_c4m.js} +1 -1
- package/web/assets/{nativeDownload-CziEyW_p.js → nativeDownload-BYT082bY.js} +1 -1
- package/web/assets/{pageChrome-DFz_AAzZ.js → pageChrome-D3Niv1JM.js} +1 -1
- package/web/assets/{pageTree-yVO1_fSy.js → pageTree-CgfvpzIj.js} +1 -1
- package/web/assets/{pen-tool-uxsFELYC.js → pen-tool-BXEFnU2i.js} +1 -1
- package/web/assets/{pencil-BSbra1Ra.js → pencil-cqvCkekG.js} +1 -1
- package/web/assets/pluginChat-BbBukMuN.js +2 -0
- package/web/assets/{redo-2-BK5LMNa5.js → redo-2-BO7wCDwy.js} +1 -1
- package/web/assets/{rotate-ccw-HedfU4na.js → rotate-ccw-BvipPIjC.js} +1 -1
- package/web/assets/{sharePage-CpzDpuU1.js → sharePage-XbN50US7.js} +2 -2
- package/web/assets/{shareViewer-BwzH2bIs.js → shareViewer-BaYogetW.js} +1 -1
- package/web/assets/{star-CgYon3z4.js → star-BQWMXnn7.js} +1 -1
- package/web/assets/tableSurface-BXqqidd1.js +1 -0
- package/web/assets/{terminal-krsPf1mc.js → terminal-l9k6RDrH.js} +1 -1
- package/web/assets/{terminalView-4e2_u5_I.js → terminalView-Cpnt5_0P.js} +1 -1
- package/web/assets/{type-GJYLEhY-.js → type-CFoaj2eD.js} +1 -1
- package/web/assets/{undo-2-DCTs4Ro4.js → undo-2-DusxpdLa.js} +1 -1
- package/web/assets/{unitAccount-D3xjX3cu.js → unitAccount-DwutFPPw.js} +1 -1
- package/web/assets/{unitBridge-D5JcIkAP.js → unitBridge-CcgQpkqV.js} +1 -1
- package/web/assets/{unitCloudTransport-B44L3x6M.js → unitCloudTransport-vA7cLDts.js} +1 -1
- package/web/assets/{unitOwnerAccess-CRUHWGpf.js → unitOwnerAccess-LBlJ1YfA.js} +1 -1
- package/web/assets/{unitShim-_VzxvdEG.js → unitShim-B_M9IrbC.js} +3 -3
- package/web/assets/{upload-MVVRQtkj.js → upload-ZrOj6tXA.js} +1 -1
- package/web/assets/{userSpaces-CI4eqEgh.js → userSpaces-uJOnsedR.js} +1 -1
- package/web/assets/viewportLock-D3SNkwS2.js +631 -0
- package/web/assets/{workflow-DzeW9OXR.js → workflow-DPoG4QE2.js} +1 -1
- package/web/assets/{zoom-in-CovPsw4g.js → zoom-in-lbTgzdQP.js} +1 -1
- package/web/index.html +27 -7
- package/web/assets/RunLocationPicker-CyVa0RJa.js +0 -38
- package/web/assets/appStore-BC_CQv-L.css +0 -1
- package/web/assets/index-BaRySZ-M.js +0 -1
- package/web/assets/main-CwqZ_ymb.js +0 -19
- package/web/assets/minus-BUT48dAC.js +0 -1
- package/web/assets/pluginChat-BMFnf_j2.js +0 -2
- package/web/assets/tableSurface-CmDwnKnd.js +0 -1
- package/web/assets/viewportLock-BH26xHQO.js +0 -611
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as H,d as o,j as t}from"./index-Bh_nLVTc.js";import{F as xe,aE as fe,aM as te,aN as $,T as J,kl as Se,bT as je,bG as Re,bH as $e,bI as ve,a4 as Ae,ap as Be,R as He,d_ as Fe,km as Ue,a5 as _e,b0 as qe,u as Ve,fy as Ke,fL as V,aK as We,L as Ye,kn as Ge,K as Xe,dW as Qe,cN as Ze,ko as Je,fH as et}from"./appStore-B1ynyt42.js";import"./client-DxGbwZLy.js";import{u as tt}from"./gestures-CZQVefU0.js";import{C as st,a as it}from"./Chrome-B77-lQyh.js";import{b as M,i as be,u as r,a as at,C as nt,r as ce,m as rt,c as ot,d as ye,e as ue,f as me,g as lt,n as dt,h as ct}from"./RightPanel-BVZeVO3c.js";import{s as ut,d as ee,r as mt,h as gt,a as pt,b as Ce,c as we,p as B,e as ke,I as ht,i as xt,f as ft,l as St,u as jt,g as A,S as ge,j as vt,k as K,L as bt,m as yt,n as Ct,o as wt}from"./imageStudio-Cy3_437s.js";import{L as kt}from"./lock-DQ_yL4nF.js";import{L as zt}from"./InlineFiles-BHwivGbQ.js";import{U as W}from"./upload-MVVRQtkj.js";/* empty css */import{F as Nt,R as It}from"./redo-2-BK5LMNa5.js";import{U as Et}from"./undo-2-DCTs4Ro4.js";import{L as Lt}from"./layout-grid-DfUfnvDS.js";import{A as Pt}from"./arrow-up-right-R10mR2I6.js";import{H as Tt}from"./hand-D3QspKYq.js";import{T as Mt,F as Dt}from"./type-GJYLEhY-.js";import"./nativeDownload-CziEyW_p.js";import"./ipc-CPhL3bPp.js";import"./minus-BUT48dAC.js";import"./book-open-DBJ3dDpw.js";import"./folder-plus-BRScGQ9m.js";import"./folder-CvZyHIgb.js";import"./pencil-BSbra1Ra.js";const Ot=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],Rt=xe("clipboard-paste",Ot);const $t=[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],At=xe("copy-plus",$t);function Bt({board:s,selection:i,onClose:j}){const{t:c}=H(),[g,v]=o.useState("png"),[b,w]=o.useState(1),[l,p]=o.useState("transparent"),[S,y]=o.useState(.92),[N,C]=o.useState(!1),[u,d]=o.useState(""),z=ut(s,i),L=z?.bounds,P=Math.round((L?.w||0)*b),D=Math.round((L?.h||0)*b),O=!L||P<1||D<1||P*D>4e7||Math.max(P,D)>16384;return t.jsxs("section",{className:"ims-export ims-panel","aria-label":c("imageStudio.exportOptions"),children:[t.jsxs("div",{className:"ims-section-head",children:[t.jsx("h3",{children:c("imageStudio.exportOptions")}),t.jsx("button",{"aria-label":c("imageStudio.close"),onClick:j,children:t.jsx(fe,{size:15})})]}),t.jsxs("div",{className:"ims-fields",children:[t.jsxs("label",{children:[c("imageStudio.format"),t.jsx("select",{"aria-label":c("imageStudio.format"),value:g,onChange:h=>v(h.target.value),children:["png","jpeg","webp","svg"].map(h=>t.jsx("option",{value:h,children:h.toUpperCase()},h))})]}),t.jsxs("label",{children:[c("imageStudio.scale"),t.jsx("select",{"aria-label":c("imageStudio.scale"),value:b,onChange:h=>w(Number(h.target.value)),children:[.5,1,2,3].map(h=>t.jsxs("option",{value:h,children:[h,"×"]},h))})]}),t.jsxs("label",{children:[c("imageStudio.background"),t.jsxs("select",{"aria-label":c("imageStudio.background"),value:l,onChange:h=>p(h.target.value),children:[t.jsx("option",{value:"transparent",children:c("imageStudio.transparent")}),t.jsx("option",{value:"#ffffff",children:c("imageStudio.white")}),t.jsx("option",{value:"#000000",children:c("imageStudio.black")})]})]}),(g==="jpeg"||g==="webp")&&t.jsxs("label",{children:[c("imageStudio.quality"),t.jsx("input",{"aria-label":c("imageStudio.quality"),type:"range",min:".1",max:"1",step:".05",value:S,onChange:h=>y(Number(h.target.value))})]})]}),t.jsxs("p",{children:[P," × ",D," px · ",c(i.length?"imageStudio.selectedOnly":"imageStudio.allVisible")]}),g==="svg"&&t.jsx("p",{children:c("imageStudio.svgHint")}),g==="jpeg"&&l==="transparent"&&t.jsx("p",{children:c("imageStudio.jpegHint")}),O&&t.jsx("p",{role:"alert",children:c("imageStudio.exportLimit")}),t.jsxs("button",{className:"ims-primary",disabled:N||O,onClick:async()=>{C(!0),d("");try{ee(await mt(s,i,{format:g,scale:b,background:l,quality:S}),`${s.name}.${g==="jpeg"?"jpg":g}`)}catch(h){d(String(h))}finally{C(!1)}},children:[N?t.jsx(te,{className:"ims-spin",size:15}):t.jsx($,{size:15}),c("imageStudio.download")]}),u&&t.jsx("p",{role:"alert",children:c("imageStudio.error",{error:u})})]})}function Ht({target:s,board:i,busy:j,onClose:c,onImport:g,onExport:v,onInspect:b,run:w}){const{t:l}=H(),p=i?M(i).filter(d=>s.ids.includes(d.id)):[],S=p.length===1&&be(p[0])?p[0]:void 0,y=p.filter(d=>!d.locked).map(d=>d.id),N=/Mac|iPhone|iPad/.test(navigator.platform)?"⌘":"Ctrl+",C=d=>()=>{i&&r.getState().activeId!==i.id||(r.setState({selection:p.map(z=>z.id)}),d())},u=[];return S&&u.push({label:l("imageStudio.downloadImage"),icon:t.jsx($,{size:14}),disabled:j,run:C(()=>{w(async()=>ee(await pt([S],!0),S.name.replace(/\.[^.]+$/,"")+".png"))})},{label:l("imageStudio.downloadOriginal"),icon:t.jsx($,{size:14}),run:C(()=>{const d={"image/png":"png","image/jpeg":"jpg","image/webp":"webp","image/gif":"gif"}[S.blob.type]||"png";ee(S.blob,S.name.replace(/\.[^.]+$/,"")+"-original."+d)})}),p.length&&i?u.push({label:l("imageStudio.exportSelection"),icon:t.jsx($,{size:14}),disabled:j,run:C(v)},{label:l("imageStudio.reference"),icon:t.jsx(J,{size:14}),separatorBefore:!0,disabled:j||p.length>8,run:C(()=>{w(Ce)})},{label:l("imageStudio.inspector"),icon:t.jsx(Se,{size:14}),run:C(b)},{label:l("imageStudio.copyObjects"),icon:t.jsx(je,{size:14}),shortcut:`${N}C`,separatorBefore:!0,run:C(we)},{label:l("imageStudio.duplicate"),icon:t.jsx(At,{size:14}),shortcut:`${N}D`,run:C(()=>B(!0))},{label:l("imageStudio.layerUp"),icon:t.jsx(Re,{size:14}),separatorBefore:!0,disabled:!y.length,run:C(()=>r.getState().update(i.id,d=>ce(d,y,"up")))},{label:l("imageStudio.layerDown"),icon:t.jsx($e,{size:14}),disabled:!y.length,run:C(()=>r.getState().update(i.id,d=>ce(d,y,"down")))},{label:l(y.length?"imageStudio.lock":"imageStudio.unlock"),icon:y.length?t.jsx(kt,{size:14}):t.jsx(zt,{size:14}),run:C(()=>r.getState().update(i.id,d=>rt(d,z=>s.ids.includes(z.id)?{...z,locked:!!y.length}:z)))},{label:l("imageStudio.remove"),icon:t.jsx(ve,{size:14}),shortcut:"⌫",separatorBefore:!0,danger:!0,disabled:!y.length,run:C(ke)}):u.push({label:l("imageStudio.import"),icon:t.jsx(W,{size:14}),disabled:j,run:g},{label:l("imageStudio.pasteObjects"),icon:t.jsx(Rt,{size:14}),shortcut:`${N}V`,disabled:!i||!gt(),run:C(()=>B())},{label:l("imageStudio.selectAll"),icon:t.jsx(at,{size:14}),disabled:!i?.images.length&&!i?.elements?.length,run:()=>r.setState({selection:i?M(i).filter(d=>!d.hidden).map(d=>d.id):[]})},{label:l("imageStudio.exportBoard"),icon:t.jsx($,{size:14}),separatorBefore:!0,disabled:j||!i||!M(i).some(d=>!d.hidden),run:C(v)}),t.jsx(nt,{menu:{x:s.x,y:s.y,items:u},onClose:c,autoFocus:!0})}const pe=4/3,Ft=.05;function Ut({board:s}){const i=ot(s,2);if(!i.length)return t.jsx("span",{className:"ims-cover is-empty",children:t.jsx("span",{className:"ims-cover-in",children:t.jsx(Ue,{size:22,strokeWidth:1.4})})});const j=i.map(g=>{const v=ye(g);return v.w/v.h}),c=Math.min(1,(1-Ft*(i.length-1))*pe/j.reduce((g,v)=>g+v,0));return t.jsx("span",{className:"ims-cover",children:t.jsx("span",{className:"ims-cover-in",children:i.map((g,v)=>t.jsx("span",{className:"ims-cover-img",style:{width:`${j[v]*c/pe*100}%`,aspectRatio:String(j[v])},children:t.jsx(ht,{image:g})},g.id))})})}function _t(){const{t:s,locale:i}=H(),j=r(u=>u.boards),[c,g]=o.useState(""),[v,b]=o.useState(!1),[w,l]=o.useState(""),p=o.useRef(null),S=o.useMemo(()=>Object.values(j).sort((u,d)=>d.updatedAt-u.updatedAt),[j]),y=c.trim().toLocaleLowerCase(),N=y?S.filter(u=>u.name.toLocaleLowerCase().includes(y)):S,C=async u=>{b(!0),l("");try{const d=await xt(u),z=r.getState().create(d.name);r.getState().update(z,L=>({...d,id:L.id}))}catch(d){l(String(d))}finally{b(!1)}};return t.jsx("div",{className:"csl-launchpad ims-launch",children:t.jsx("div",{className:"csl-inner",children:t.jsxs("main",{className:"csl-catalog",children:[t.jsxs("header",{className:"csl-catalog-header",children:[t.jsxs("div",{children:[t.jsx("h1",{children:s("imageStudio.projects")}),t.jsx("p",{children:s("imageStudio.launch.subtitle")})]}),t.jsxs("div",{className:"csl-catalog-actions",children:[t.jsxs("button",{type:"button",className:"csl-import",disabled:v,onClick:()=>p.current?.click(),children:[t.jsx(Ae,{size:15}),s("imageStudio.restore")]}),t.jsxs("button",{type:"button",className:"csl-new",onClick:()=>r.getState().create(s("imageStudio.untitled")),children:[t.jsx(Be,{size:16}),s("imageStudio.new")]})]})]}),w&&t.jsx("div",{className:"ims-error",role:"alert",children:s("imageStudio.error",{error:w})}),S.length>0&&t.jsx("div",{className:"csl-catalog-toolbar",children:t.jsxs("label",{className:"csl-search",children:[t.jsx(He,{size:15}),t.jsx("input",{type:"search","aria-label":s("imageStudio.launch.search"),placeholder:s("imageStudio.launch.search"),value:c,onChange:u=>g(u.target.value)})]})}),N.length?t.jsx("div",{className:"ims-launch-grid",role:"group","aria-label":s("imageStudio.projects"),children:N.map(u=>t.jsxs("button",{type:"button",className:"ims-launch-card","data-project-id":u.id,onClick:()=>r.getState().open(u.id),children:[t.jsx(Ut,{board:u}),t.jsxs("span",{className:"ims-launch-meta",children:[t.jsx("strong",{children:u.name}),t.jsxs("small",{children:[s("imageStudio.itemCount",{count:M(u).length})," · ",Fe(u.updatedAt,{locale:i})]})]})]},u.id))}):t.jsxs("div",{className:"csl-empty",children:[t.jsx("strong",{children:s(S.length?"imageStudio.launch.noMatch":"imageStudio.launch.empty")}),!S.length&&t.jsx("p",{children:s("imageStudio.launch.emptyHint")})]}),t.jsx("input",{ref:p,type:"file",accept:".json",hidden:!0,onChange:u=>{const d=u.target.files?.[0];u.target.value="",d&&C(d)}})]})})})}const he=[];function xs(s){const{t:i}=H(),j=r(l=>l.ready),c=r(l=>l.error),g=r(l=>l.activeId);o.useEffect(()=>{r.getState().hydrate();const l=()=>{r.getState().flush()},p=S=>{const y=r.getState();(y.saving||y.ready&&y.error)&&(l(),S.preventDefault(),S.returnValue="")};return window.addEventListener("pagehide",l),window.addEventListener("beforeunload",p),()=>{window.removeEventListener("pagehide",l),window.removeEventListener("beforeunload",p),l()}},[]);const v=_e(l=>l.activeSpaceId==="image-studio")&&qe()==="main",b=!!g,w=o.useRef(!1);return o.useEffect(()=>{!j||!v||(b?ft():St(w.current),w.current=b)},[j,v,b]),j?g?t.jsx(qt,{},g):t.jsx(_t,{}):t.jsx("div",{className:"ims-panel ims-panel-empty",children:c?t.jsxs(t.Fragment,{children:[t.jsx("p",{role:"alert",children:i("imageStudio.error",{error:c})}),t.jsx("button",{onClick:()=>{r.getState().hydrate()},children:i("imageStudio.retry")})]}):t.jsx(te,{className:"ims-spin"})})}function qt(){const{t:s}=H(),i=r(e=>e.activeId?e.boards[e.activeId]:void 0),j=r(e=>e.saving),c=r(e=>e.error),g=r(e=>i&&e.past[i.id]?.length||0),v=r(e=>i&&e.future[i.id]?.length||0),b=r(e=>e.selection),w=r(e=>i&&e.placeholders[i.id]||he),l=Ve(e=>!!(i?.sessionId&&e.runningBySession[i.sessionId])),[p,S]=o.useState(!1),[y,N]=o.useState(""),[C,u]=o.useState(0),[d,z]=o.useState(!1),[L,P]=o.useState(!1),[D,O]=o.useState(!1),h=o.useRef(null),[se,ze]=o.useState(!0),[ie,Ne]=o.useState(!1),[Ie,Y]=o.useState(!1),I=o.useRef(null),F=o.useRef(null),[ae,ne]=o.useState(null),Ee=o.useCallback(()=>{ne(null),I.current?.focus({preventScroll:!0})},[]),m=Ke(I,`image-studio:${i?.id||""}`,void 0,{x:56,y:64,z:1}),U=i?.images||[],T=i?M(i):[],_=T.filter(e=>!e.hidden),Le=!T.length&&!g&&!v,G=[..._,...w],q=o.useRef(!0);o.useEffect(()=>(q.current=!0,()=>{q.current=!1}),[]);const re=o.useCallback(e=>{q.current&&N(e)},[]);jt(i||Vt,re,C);const x=tt(I,m,{boxes:()=>new Map(_.map(e=>[e.id,e])),identity:()=>i?.id,commit:e=>{i&&r.getState().update(i.id,a=>me(a,e))},constrain:(e,a)=>{if(a.kind!=="resize")return e;const n=U.find(Oe=>Oe.id===a.key),f=e.get(a.key);if(!n||!f)return e;const k=ye(n),E=Math.max(48,f.w),De=E*k.h/k.w;return new Map(e).set(a.key,{...f,w:E,h:De})},hitKey:e=>e.closest("[data-image-id]")?.dataset.imageId||null,isEditing:e=>!!T.find(a=>a.id===e)?.locked,hitEdge:e=>e.dataset.resize||null,onDelete:e=>{i&&r.getState().update(i.id,a=>ue(a,M(a).filter(n=>n.locked||!e.includes(n.id))))},onDoubleClick:e=>{e&&(r.setState({selection:[e]}),A(K))},onContextMenu:(e,a)=>{const n=e?x.sel.includes(e)?x.sel:[e]:[];x.setSel(n),r.setState({selection:n}),ne({x:a.clientX,y:a.clientY,ids:n})},minW:48,minH:48,repel:!1},se);o.useEffect(()=>x.bind(I.current),[x.bind]),o.useEffect(()=>m.bindWheel(I.current),[m.bindWheel]),o.useEffect(()=>{const e=()=>{O(!1),h.current=null};return window.addEventListener("blur",e),()=>window.removeEventListener("blur",e)},[]);const oe=o.useRef(x.sel);o.useEffect(()=>{oe.current!==x.sel&&(oe.current=x.sel,r.setState({selection:x.sel}))},[x.sel]),o.useEffect(()=>{if(b.join("|")!==x.sel.join("|")){x.setSel(b);const e=T.find(a=>a.id===b[0]);if(e){const{w:a,h:n}=V(I.current),f=m.vpRef.current,k=(e.x+e.w/2)*f.z+f.x,E=(e.y+e.h/2)*f.z+f.y;(k<0||k>a||E<0||E>n)&&m.centerOn(e.x+e.w/2,e.y+e.h/2)}}},[b,x.setSel]);const le=o.useRef(0);o.useEffect(()=>{const e=T.length+w.length;e>le.current&&m.fitTo(G,64),le.current=e},[T,w,m.fitTo]);const R=async e=>{S(!0),N("");try{await e()}catch(a){re(String(a))}finally{q.current&&S(!1)}},X=()=>i?.id||r.getState().create(s("imageStudio.untitled")),de=async e=>{const a=await Promise.all(e.map(f=>wt(f,f.name,"import")));if(!a.length)return;const n=X();r.getState().update(n,f=>{const k=[...f.images];for(const E of a)k.push({...E,...ct(E.width,E.height,k)});return{...f,images:k}})},Pe=e=>{R(async()=>{const a=X();await yt(a,s(e))})},Q=T.filter(e=>b.includes(e.id)),Te=i&&x.live?M(me(i,x.live)):T,Z=e=>{const a=X(),{w:n,h:f}=V(I.current),k=dt(e,s(`imageStudio.new.${e}`),(n/2-m.vp.x)/m.vp.z,(f/2-m.vp.y)/m.vp.z);k.x-=k.w/2,k.y-=k.h/2,r.getState().update(a,E=>ue(E,[...M(E),k])),r.setState({selection:[k.id]}),A(K)},Me=e=>{const{w:a,h:n}=V(I.current);m.setVp(et(m.vp,m.vp.z*e,a/2,n/2))};return t.jsxs("div",{className:"ims",onKeyDownCapture:e=>{if(e.target.closest('input, select, textarea, button, [contenteditable="true"]'))return;const a=e.metaKey||e.ctrlKey,n=e.key.toLowerCase();let f=!0;a&&n==="z"&&i?r.getState().undo(i.id,e.shiftKey):a&&n==="c"?we():a&&n==="v"?B():a&&n==="d"?B(!0):a&&n==="e"?z(!0):!a&&n==="t"?Z("text"):!a&&n==="f"?Z("frame"):!a&&n==="h"?P(!0):!a&&n==="v"?P(!1):n===" "?O(!0):(n==="escape"&&(P(!1),z(!1)),f=!1),f&&(e.preventDefault(),e.stopPropagation())},onKeyUpCapture:e=>{e.key===" "&&(O(!1),e.preventDefault(),e.stopPropagation())},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(O(!1),h.current=null)},children:[t.jsxs("header",{className:"ims-header",children:[t.jsxs("button",{className:"ims-back",title:s("imageStudio.back"),onClick:()=>r.getState().close(),children:[t.jsx(We,{size:15}),t.jsx("span",{children:i?.name})]}),t.jsxs("div",{className:"ims-head-actions",children:[i&&t.jsx("button",{disabled:p,title:s("imageStudio.backup"),"aria-label":s("imageStudio.backup"),onClick:()=>{R(()=>Ct(i))},children:t.jsx(Nt,{size:16})}),t.jsxs("button",{className:"ims-primary",disabled:!_.length||p,onClick:()=>z(!d),children:[t.jsx($,{size:14}),t.jsx("span",{children:s("imageStudio.exportOptions")})]})]})]}),t.jsxs("div",{className:"ims-toolbar",role:"toolbar","aria-label":s("imageStudio.title"),children:[t.jsxs("button",{disabled:p,onClick:()=>F.current?.click(),children:[t.jsx(W,{size:15}),t.jsx("span",{children:s("imageStudio.import")})]}),!Le&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"ims-divider"}),t.jsx("button",{disabled:!g,title:s("imageStudio.undo"),"aria-label":s("imageStudio.undo"),onClick:()=>i&&r.getState().undo(i.id),children:t.jsx(Et,{size:15})}),t.jsx("button",{disabled:!v,title:s("imageStudio.redo"),"aria-label":s("imageStudio.redo"),onClick:()=>i&&r.getState().undo(i.id,!0),children:t.jsx(It,{size:15})}),t.jsx("button",{disabled:!U.some(e=>!e.locked&&!e.hidden),title:s("imageStudio.arrange"),"aria-label":s("imageStudio.arrange"),onClick:()=>{if(i){const e=lt(U.filter(a=>!a.locked&&!a.hidden));r.getState().update(i.id,a=>({...a,images:a.images.map(n=>e.find(f=>f.id===n.id)||n)})),m.fitTo(e)}},children:t.jsx(Lt,{size:15})}),t.jsx("button",{disabled:!Q.length,title:s("imageStudio.remove"),"aria-label":s("imageStudio.remove"),onClick:ke,children:t.jsx(ve,{size:15})}),t.jsx("button",{disabled:!Q.length,title:s("imageStudio.duplicate"),"aria-label":s("imageStudio.duplicate"),onClick:()=>B(!0),children:t.jsx(je,{size:15})}),t.jsx("button",{disabled:!Q.length||p,title:s("imageStudio.reference"),"aria-label":s("imageStudio.reference"),onClick:()=>{R(Ce)},children:t.jsx(J,{size:15})})]}),t.jsx("span",{className:"ims-toolbar-space"}),[[ge,J,"imageStudio.chat"],[vt,Ye,"imageStudio.layers"],[K,Se,"imageStudio.inspector"]].map(([e,a,n])=>t.jsx("button",{title:s(n),"aria-label":s(n),onClick:()=>A(e),children:t.jsx(a,{size:16})},e))]}),d&&i&&t.jsx(Bt,{board:i,selection:b,onClose:()=>z(!1)}),c&&t.jsxs("div",{className:"ims-error",role:"alert",children:[s("imageStudio.saveError"),t.jsx("button",{onClick:()=>{r.getState().flush()},children:s("imageStudio.retry")})]}),y&&t.jsxs("div",{className:"ims-error",role:"alert",children:[s("imageStudio.error",{error:y}),t.jsx("button",{onClick:()=>{N(""),u(e=>e+1)},children:s("imageStudio.retry")})]}),t.jsxs("div",{ref:I,className:`ims-stage${L||D?" is-panning":""}`,tabIndex:0,onContextMenu:e=>e.stopPropagation(),onPointerDownCapture:e=>{e.button===2||!(L||D)||e.target.closest(".amx-stage-tools, .amx-stage-hud, .amx-stage-minimap")||(e.stopPropagation(),e.preventDefault(),e.currentTarget.focus(),e.currentTarget.setPointerCapture(e.pointerId),h.current={id:e.pointerId,x:e.clientX,y:e.clientY,vx:m.vp.x,vy:m.vp.y})},onPointerMoveCapture:e=>{const a=h.current;if(!a||a.id!==e.pointerId)return;e.stopPropagation();const{u:n}=V(I.current);m.setVp({...m.vp,x:a.vx+(e.clientX-a.x)/n,y:a.vy+(e.clientY-a.y)/n})},onPointerUpCapture:e=>{h.current?.id===e.pointerId&&(e.stopPropagation(),h.current=null)},onPointerCancel:()=>{h.current=null},"aria-label":s("imageStudio.title"),onDragOver:e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),Y(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Y(!1)},onDrop:e=>{e.preventDefault(),Y(!1),p||R(()=>de(Array.from(e.dataTransfer.files)))},children:[t.jsx("div",{className:"ims-grid",style:Ge(m.vp)}),t.jsxs("div",{className:"ims-world",style:{transform:`translate(${m.vp.x}px, ${m.vp.y}px) scale(${m.vp.z})`},children:[_.map(e=>{const a=Te.find(n=>n.id===e.id)||e;return t.jsxs("div",{"data-image-id":e.id,className:`ims-layer ${be(e)?"ims-image":`ims-${e.kind}`}${x.sel.includes(e.id)?" is-selected":""}${e.locked?" is-locked":""}`,style:{left:a.x,top:a.y,width:a.w,height:a.h},children:[t.jsx(bt,{item:e}),t.jsx("div",{className:"ims-image-label",children:e.name}),x.sel.includes(e.id)&&!e.locked&&t.jsx("div",{className:"ims-resize","data-resize":"se"})]},e.id)}),w.map(e=>{const a=U.find(n=>n.id===e.sourceIds[0]);return t.jsxs("div",{"data-generation-id":e.id,className:`ims-generation${e.status==="failed"?" is-failed":""}`,style:{left:e.x,top:e.y,width:e.w,height:e.h},role:e.status==="failed"?"alert":"status","aria-live":"polite",onPointerDown:n=>n.stopPropagation(),children:[t.jsx("div",{className:"ims-generation-sheen"}),t.jsxs("div",{className:"ims-generation-copy",children:[t.jsx(Xe,{size:20,strokeWidth:1.5}),t.jsx("strong",{children:s(e.kind==="edit"?"imageStudio.generation.editing":"imageStudio.generation.creating")}),t.jsx("span",{children:e.status==="failed"?s("imageStudio.generation.failed"):s(e.status==="preparing"?"imageStudio.generation.preparing":"imageStudio.generation.running")}),a&&t.jsx("small",{children:s("imageStudio.generation.versionOf",{name:a.name})}),e.count>1&&t.jsxs("small",{children:[e.index+1," / ",e.count]})]}),e.status==="failed"&&t.jsxs("div",{className:"ims-generation-actions amx-stage-tools",children:[t.jsx("button",{onClick:()=>A(ge),children:s("imageStudio.generation.openChat")}),t.jsx("button",{title:s("imageStudio.generation.dismiss"),"aria-label":s("imageStudio.generation.dismiss"),onClick:()=>r.getState().removeGeneration(i.id,e.id),children:t.jsx(fe,{size:14})})]})]},e.id)}),x.marquee&&t.jsx("div",{className:"ims-marquee",style:{left:x.marquee.x,top:x.marquee.y,width:x.marquee.w,height:x.marquee.h}})]}),!T.length&&!w.length&&t.jsxs("div",{className:"ims-empty amx-stage-tools",children:[t.jsxs("div",{className:"ims-eyebrow",children:[s("imageStudio.title")," ",t.jsx("span",{children:"/"})," ",s("imageStudio.new")]}),t.jsx("h1",{children:s("imageStudio.headline")}),t.jsx("p",{children:s("imageStudio.intro")}),t.jsx("div",{className:"ims-starters",children:["poster","product","illustration"].map(e=>t.jsxs("button",{disabled:p,onClick:()=>Pe(`imageStudio.${e}Prompt`),children:[t.jsx("span",{children:s(`imageStudio.${e}`)}),t.jsx(Pt,{size:14})]},e))}),t.jsxs("button",{className:"ims-empty-import",disabled:p,onClick:()=>F.current?.click(),children:[t.jsx(W,{size:16}),s("imageStudio.import")]}),t.jsx("small",{children:s("imageStudio.importLimit")})]}),!w.length&&(l||p)&&t.jsxs("div",{className:"ims-progress amx-stage-tools",role:"status",children:[t.jsx(te,{size:15,className:"ims-spin"}),s(l?"imageStudio.generating":"imageStudio.busy")]}),Ie&&t.jsxs("div",{className:"ims-drop",children:[t.jsx(W,{size:28}),s("imageStudio.drop")]}),t.jsxs("div",{className:"ims-create-tools amx-stage-tools",role:"toolbar","aria-label":s("imageStudio.canvasTools"),children:[t.jsx("button",{title:s("imageStudio.selectTool"),"aria-label":s("imageStudio.selectTool"),"aria-pressed":!L,onClick:()=>{P(!1),I.current?.focus()},children:t.jsx(Qe,{size:17})}),t.jsx("button",{title:s("imageStudio.handTool"),"aria-label":s("imageStudio.handTool"),"aria-pressed":L,onClick:()=>{P(!0),I.current?.focus()},children:t.jsx(Tt,{size:17})}),t.jsx("span",{}),[["text",Mt],["rectangle",Ze],["ellipse",Je],["frame",Dt]].map(([e,a])=>t.jsx("button",{title:s(`imageStudio.add.${e}`),"aria-label":s(`imageStudio.add.${e}`),onClick:()=>Z(e),children:t.jsx(a,{size:17})},e))]}),ie&&t.jsx(st,{hostRef:I,vp:m.vp,items:G.map(e=>({key:e.id,kind:"card",box:e})),onCenter:m.centerOn}),t.jsx(it,{zoom:m.vp.z,onZoomBy:Me,onFit:()=>m.fitTo(G),snap:se,onSnap:ze,mini:ie,onMini:Ne})]}),t.jsxs("footer",{className:"ims-footer",children:[t.jsx("span",{title:s("imageStudio.hint"),children:s(i?c?"imageStudio.unsaved":j?"imageStudio.saving":"imageStudio.local":"imageStudio.empty")}),i&&t.jsx("input",{"aria-label":s("imageStudio.name"),value:i.name,onChange:e=>r.getState().update(i.id,a=>({...a,name:e.target.value}),!1)}),t.jsx("span",{children:s("imageStudio.itemCount",{count:T.length})})]}),ae&&t.jsx(Ht,{target:ae,board:i,busy:p,onClose:Ee,onImport:()=>F.current?.click(),onExport:()=>z(!0),onInspect:()=>A(K),run:R}),t.jsx("input",{ref:F,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",multiple:!0,hidden:!0,onChange:e=>{const a=Array.from(e.target.files||[]);e.target.value="",R(()=>de(a))}})]})}const Vt={version:1,id:"",name:"",updatedAt:0,sessionId:null,images:[],collected:[]};export{xs as ImageStudioView};
|
|
1
|
+
import{u as U,d as o,j as t}from"./index-BM2o7PeV.js";import{F as xe,aE as fe,aM as te,aN as R,T as Z,kn as Se,bU as je,bH as $e,bI as Re,bJ as ve,a4 as Ae,aq as Be,R as Ue,d$ as Fe,ko as He,a5 as qe,b1 as _e,u as Ve,fA as Ke,fN as V,aK as We,L as Ye,kp as Xe,K as Ge,dX as Je,cO as Qe,kq as Ze,fJ as et}from"./appStore-DWP8UET9.js";import"./client-0MPbodA6.js";import{u as tt}from"./gestures-DQBCcK4y.js";import{C as st,a as it}from"./Chrome-HdfyYV3i.js";import{b as M,i as be,u as r,a as at,C as nt,r as ce,m as rt,c as ot,d as ye,e as ue,f as me,g as lt,n as dt,h as ct}from"./RightPanel-BHDgqTFs.js";import{s as ut,d as ee,r as mt,h as gt,a as pt,b as Ce,c as we,p as B,e as ke,I as ht,i as xt,f as ft,l as St,u as jt,g as A,S as ge,j as vt,k as K,L as bt,m as yt,n as Ct,o as wt}from"./imageStudio-BLVNKmEG.js";import{L as kt}from"./lock-CnbZm4vo.js";import{L as zt}from"./InlineFiles-CQbQumkf.js";import{U as W}from"./upload-ZrOj6tXA.js";/* empty css */import{F as Nt,R as It}from"./redo-2-BO7wCDwy.js";import{U as Et}from"./undo-2-DusxpdLa.js";import{L as Lt}from"./layout-grid-BBVuEdWG.js";import{A as Pt}from"./arrow-up-right-DrCXuWS7.js";import{H as Tt}from"./hand-Bko7ms15.js";import{T as Mt,F as Ot}from"./type-CFoaj2eD.js";import"./nativeDownload-BYT082bY.js";import"./ipc-CxAyeo8q.js";import"./minus-C9ndHJ9O.js";import"./book-open-OLNm7OaB.js";import"./folder-plus-BeQHr4AZ.js";import"./folder-BpsfOHD4.js";import"./pencil-cqvCkekG.js";const Dt=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],$t=xe("clipboard-paste",Dt);const Rt=[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],At=xe("copy-plus",Rt);function Bt({board:s,selection:i,onClose:j}){const{t:c}=U(),[g,v]=o.useState("png"),[b,w]=o.useState(1),[l,p]=o.useState("transparent"),[S,y]=o.useState(.92),[N,C]=o.useState(!1),[u,d]=o.useState(""),z=ut(s,i),L=z?.bounds,P=Math.round((L?.w||0)*b),O=Math.round((L?.h||0)*b),D=!L||P<1||O<1||P*O>4e7||Math.max(P,O)>16384;return t.jsxs("section",{className:"ims-export ims-panel","aria-label":c("imageStudio.exportOptions"),children:[t.jsxs("div",{className:"ims-section-head",children:[t.jsx("h3",{children:c("imageStudio.exportOptions")}),t.jsx("button",{"aria-label":c("imageStudio.close"),onClick:j,children:t.jsx(fe,{size:15})})]}),t.jsxs("div",{className:"ims-fields",children:[t.jsxs("label",{children:[c("imageStudio.format"),t.jsx("select",{"aria-label":c("imageStudio.format"),value:g,onChange:h=>v(h.target.value),children:["png","jpeg","webp","svg"].map(h=>t.jsx("option",{value:h,children:h.toUpperCase()},h))})]}),t.jsxs("label",{children:[c("imageStudio.scale"),t.jsx("select",{"aria-label":c("imageStudio.scale"),value:b,onChange:h=>w(Number(h.target.value)),children:[.5,1,2,3].map(h=>t.jsxs("option",{value:h,children:[h,"×"]},h))})]}),t.jsxs("label",{children:[c("imageStudio.background"),t.jsxs("select",{"aria-label":c("imageStudio.background"),value:l,onChange:h=>p(h.target.value),children:[t.jsx("option",{value:"transparent",children:c("imageStudio.transparent")}),t.jsx("option",{value:"#ffffff",children:c("imageStudio.white")}),t.jsx("option",{value:"#000000",children:c("imageStudio.black")})]})]}),(g==="jpeg"||g==="webp")&&t.jsxs("label",{children:[c("imageStudio.quality"),t.jsx("input",{"aria-label":c("imageStudio.quality"),type:"range",min:".1",max:"1",step:".05",value:S,onChange:h=>y(Number(h.target.value))})]})]}),t.jsxs("p",{children:[P," × ",O," px · ",c(i.length?"imageStudio.selectedOnly":"imageStudio.allVisible")]}),g==="svg"&&t.jsx("p",{children:c("imageStudio.svgHint")}),g==="jpeg"&&l==="transparent"&&t.jsx("p",{children:c("imageStudio.jpegHint")}),D&&t.jsx("p",{role:"alert",children:c("imageStudio.exportLimit")}),t.jsxs("button",{className:"ims-primary",disabled:N||D,onClick:async()=>{C(!0),d("");try{ee(await mt(s,i,{format:g,scale:b,background:l,quality:S}),`${s.name}.${g==="jpeg"?"jpg":g}`)}catch(h){d(String(h))}finally{C(!1)}},children:[N?t.jsx(te,{className:"ims-spin",size:15}):t.jsx(R,{size:15}),c("imageStudio.download")]}),u&&t.jsx("p",{role:"alert",children:c("imageStudio.error",{error:u})})]})}function Ut({target:s,board:i,busy:j,onClose:c,onImport:g,onExport:v,onInspect:b,run:w}){const{t:l}=U(),p=i?M(i).filter(d=>s.ids.includes(d.id)):[],S=p.length===1&&be(p[0])?p[0]:void 0,y=p.filter(d=>!d.locked).map(d=>d.id),N=/Mac|iPhone|iPad/.test(navigator.platform)?"⌘":"Ctrl+",C=d=>()=>{i&&r.getState().activeId!==i.id||(r.setState({selection:p.map(z=>z.id)}),d())},u=[];return S&&u.push({label:l("imageStudio.downloadImage"),icon:t.jsx(R,{size:14}),disabled:j,run:C(()=>{w(async()=>ee(await pt([S],!0),S.name.replace(/\.[^.]+$/,"")+".png"))})},{label:l("imageStudio.downloadOriginal"),icon:t.jsx(R,{size:14}),run:C(()=>{const d={"image/png":"png","image/jpeg":"jpg","image/webp":"webp","image/gif":"gif"}[S.blob.type]||"png";ee(S.blob,S.name.replace(/\.[^.]+$/,"")+"-original."+d)})}),p.length&&i?u.push({label:l("imageStudio.exportSelection"),icon:t.jsx(R,{size:14}),disabled:j,run:C(v)},{label:l("imageStudio.reference"),icon:t.jsx(Z,{size:14}),separatorBefore:!0,disabled:j||p.length>8,run:C(()=>{w(Ce)})},{label:l("imageStudio.inspector"),icon:t.jsx(Se,{size:14}),run:C(b)},{label:l("imageStudio.copyObjects"),icon:t.jsx(je,{size:14}),shortcut:`${N}C`,separatorBefore:!0,run:C(we)},{label:l("imageStudio.duplicate"),icon:t.jsx(At,{size:14}),shortcut:`${N}D`,run:C(()=>B(!0))},{label:l("imageStudio.layerUp"),icon:t.jsx($e,{size:14}),separatorBefore:!0,disabled:!y.length,run:C(()=>r.getState().update(i.id,d=>ce(d,y,"up")))},{label:l("imageStudio.layerDown"),icon:t.jsx(Re,{size:14}),disabled:!y.length,run:C(()=>r.getState().update(i.id,d=>ce(d,y,"down")))},{label:l(y.length?"imageStudio.lock":"imageStudio.unlock"),icon:y.length?t.jsx(kt,{size:14}):t.jsx(zt,{size:14}),run:C(()=>r.getState().update(i.id,d=>rt(d,z=>s.ids.includes(z.id)?{...z,locked:!!y.length}:z)))},{label:l("imageStudio.remove"),icon:t.jsx(ve,{size:14}),shortcut:"⌫",separatorBefore:!0,danger:!0,disabled:!y.length,run:C(ke)}):u.push({label:l("imageStudio.import"),icon:t.jsx(W,{size:14}),disabled:j,run:g},{label:l("imageStudio.pasteObjects"),icon:t.jsx($t,{size:14}),shortcut:`${N}V`,disabled:!i||!gt(),run:C(()=>B())},{label:l("imageStudio.selectAll"),icon:t.jsx(at,{size:14}),disabled:!i?.images.length&&!i?.elements?.length,run:()=>r.setState({selection:i?M(i).filter(d=>!d.hidden).map(d=>d.id):[]})},{label:l("imageStudio.exportBoard"),icon:t.jsx(R,{size:14}),separatorBefore:!0,disabled:j||!i||!M(i).some(d=>!d.hidden),run:C(v)}),t.jsx(nt,{menu:{x:s.x,y:s.y,items:u},onClose:c,autoFocus:!0})}const pe=4/3,Ft=.05;function Ht({board:s}){const i=ot(s,2);if(!i.length)return t.jsx("span",{className:"ims-cover is-empty",children:t.jsx("span",{className:"ims-cover-in",children:t.jsx(He,{size:22,strokeWidth:1.4})})});const j=i.map(g=>{const v=ye(g);return v.w/v.h}),c=Math.min(1,(1-Ft*(i.length-1))*pe/j.reduce((g,v)=>g+v,0));return t.jsx("span",{className:"ims-cover",children:t.jsx("span",{className:"ims-cover-in",children:i.map((g,v)=>t.jsx("span",{className:"ims-cover-img",style:{width:`${j[v]*c/pe*100}%`,aspectRatio:String(j[v])},children:t.jsx(ht,{image:g})},g.id))})})}function qt(){const{t:s,locale:i}=U(),j=r(u=>u.boards),[c,g]=o.useState(""),[v,b]=o.useState(!1),[w,l]=o.useState(""),p=o.useRef(null),S=o.useMemo(()=>Object.values(j).sort((u,d)=>d.updatedAt-u.updatedAt),[j]),y=c.trim().toLocaleLowerCase(),N=y?S.filter(u=>u.name.toLocaleLowerCase().includes(y)):S,C=async u=>{b(!0),l("");try{const d=await xt(u),z=r.getState().create(d.name);r.getState().update(z,L=>({...d,id:L.id}))}catch(d){l(String(d))}finally{b(!1)}};return t.jsx("div",{className:"csl-launchpad ims-launch",children:t.jsx("div",{className:"csl-inner",children:t.jsxs("main",{className:"csl-catalog",children:[t.jsxs("header",{className:"csl-catalog-header",children:[t.jsxs("div",{children:[t.jsx("h1",{children:s("imageStudio.projects")}),t.jsx("p",{children:s("imageStudio.launch.subtitle")})]}),t.jsxs("div",{className:"csl-catalog-actions",children:[t.jsxs("button",{type:"button",className:"csl-import",disabled:v,onClick:()=>p.current?.click(),children:[t.jsx(Ae,{size:15}),s("imageStudio.restore")]}),t.jsxs("button",{type:"button",className:"csl-new",onClick:()=>r.getState().create(s("imageStudio.untitled")),children:[t.jsx(Be,{size:16}),s("imageStudio.new")]})]})]}),w&&t.jsx("div",{className:"ims-error",role:"alert",children:s("imageStudio.error",{error:w})}),S.length>0&&t.jsx("div",{className:"csl-catalog-toolbar",children:t.jsxs("label",{className:"csl-search",children:[t.jsx(Ue,{size:15}),t.jsx("input",{type:"search","aria-label":s("imageStudio.launch.search"),placeholder:s("imageStudio.launch.search"),value:c,onChange:u=>g(u.target.value)})]})}),N.length?t.jsx("div",{className:"ims-launch-grid",role:"group","aria-label":s("imageStudio.projects"),children:N.map(u=>t.jsxs("button",{type:"button",className:"ims-launch-card","data-project-id":u.id,onClick:()=>r.getState().open(u.id),children:[t.jsx(Ht,{board:u}),t.jsxs("span",{className:"ims-launch-meta",children:[t.jsx("strong",{children:u.name}),t.jsxs("small",{children:[s("imageStudio.itemCount",{count:M(u).length})," · ",Fe(u.updatedAt,{locale:i})]})]})]},u.id))}):t.jsxs("div",{className:"csl-empty",children:[t.jsx("strong",{children:s(S.length?"imageStudio.launch.noMatch":"imageStudio.launch.empty")}),!S.length&&t.jsx("p",{children:s("imageStudio.launch.emptyHint")})]}),t.jsx("input",{ref:p,type:"file",accept:".json",hidden:!0,onChange:u=>{const d=u.target.files?.[0];u.target.value="",d&&C(d)}})]})})})}const he=[];function xs(s){const{t:i}=U(),j=r(l=>l.ready),c=r(l=>l.error),g=r(l=>l.activeId);o.useEffect(()=>{r.getState().hydrate();const l=()=>{r.getState().flush()},p=S=>{const y=r.getState();(y.saving||y.ready&&y.error)&&(l(),S.preventDefault(),S.returnValue="")};return window.addEventListener("pagehide",l),window.addEventListener("beforeunload",p),()=>{window.removeEventListener("pagehide",l),window.removeEventListener("beforeunload",p),l()}},[]);const v=qe(l=>l.activeSpaceId==="image-studio")&&_e()==="main",b=!!g,w=o.useRef(!1);return o.useEffect(()=>{!j||!v||(b?ft():St(w.current),w.current=b)},[j,v,b]),j?g?t.jsx(_t,{},g):t.jsx(qt,{}):t.jsx("div",{className:"ims-panel ims-panel-empty",children:c?t.jsxs(t.Fragment,{children:[t.jsx("p",{role:"alert",children:i("imageStudio.error",{error:c})}),t.jsx("button",{onClick:()=>{r.getState().hydrate()},children:i("imageStudio.retry")})]}):t.jsx(te,{className:"ims-spin"})})}function _t(){const{t:s}=U(),i=r(e=>e.activeId?e.boards[e.activeId]:void 0),j=r(e=>e.saving),c=r(e=>e.error),g=r(e=>i&&e.past[i.id]?.length||0),v=r(e=>i&&e.future[i.id]?.length||0),b=r(e=>e.selection),w=r(e=>i&&e.placeholders[i.id]||he),l=Ve(e=>!!(i?.sessionId&&e.runningBySession[i.sessionId])),[p,S]=o.useState(!1),[y,N]=o.useState(""),[C,u]=o.useState(0),[d,z]=o.useState(!1),[L,P]=o.useState(!1),[O,D]=o.useState(!1),h=o.useRef(null),[se,ze]=o.useState(!0),[ie,Ne]=o.useState(!1),[Ie,Y]=o.useState(!1),I=o.useRef(null),F=o.useRef(null),[ae,ne]=o.useState(null),Ee=o.useCallback(()=>{ne(null),I.current?.focus({preventScroll:!0})},[]),m=Ke(I,`image-studio:${i?.id||""}`,void 0,{x:56,y:64,z:1}),H=i?.images||[],T=i?M(i):[],q=T.filter(e=>!e.hidden),Le=!T.length&&!g&&!v,X=[...q,...w],_=o.useRef(!0);o.useEffect(()=>(_.current=!0,()=>{_.current=!1}),[]);const re=o.useCallback(e=>{_.current&&N(e)},[]);jt(i||Vt,re,C);const x=tt(I,m,{boxes:()=>new Map(q.map(e=>[e.id,e])),identity:()=>i?.id,commit:e=>{i&&r.getState().update(i.id,a=>me(a,e))},constrain:(e,a)=>{if(a.kind!=="resize")return e;const n=H.find(De=>De.id===a.key),f=e.get(a.key);if(!n||!f)return e;const k=ye(n),E=Math.max(48,f.w),Oe=E*k.h/k.w;return new Map(e).set(a.key,{...f,w:E,h:Oe})},hitKey:e=>e.closest("[data-image-id]")?.dataset.imageId||null,isEditing:e=>!!T.find(a=>a.id===e)?.locked,hitEdge:e=>e.dataset.resize||null,onDelete:e=>{i&&r.getState().update(i.id,a=>ue(a,M(a).filter(n=>n.locked||!e.includes(n.id))))},onDoubleClick:e=>{e&&(r.setState({selection:[e]}),A(K))},onContextMenu:(e,a)=>{const n=e?x.sel.includes(e)?x.sel:[e]:[];x.setSel(n),r.setState({selection:n}),ne({x:a.clientX,y:a.clientY,ids:n})},minW:48,minH:48,repel:!1},se);o.useEffect(()=>x.bind(I.current),[x.bind]),o.useEffect(()=>m.bindWheel(I.current),[m.bindWheel]),o.useEffect(()=>{const e=()=>{D(!1),h.current=null};return window.addEventListener("blur",e),()=>window.removeEventListener("blur",e)},[]);const oe=o.useRef(x.sel);o.useEffect(()=>{oe.current!==x.sel&&(oe.current=x.sel,r.setState({selection:x.sel}))},[x.sel]),o.useEffect(()=>{if(b.join("|")!==x.sel.join("|")){x.setSel(b);const e=T.find(a=>a.id===b[0]);if(e){const{w:a,h:n}=V(I.current),f=m.vpRef.current,k=(e.x+e.w/2)*f.z+f.x,E=(e.y+e.h/2)*f.z+f.y;(k<0||k>a||E<0||E>n)&&m.centerOn(e.x+e.w/2,e.y+e.h/2)}}},[b,x.setSel]);const le=o.useRef(0);o.useEffect(()=>{const e=T.length+w.length;e>le.current&&m.fitTo(X,64),le.current=e},[T,w,m.fitTo]);const $=async e=>{S(!0),N("");try{await e()}catch(a){re(String(a))}finally{_.current&&S(!1)}},G=()=>i?.id||r.getState().create(s("imageStudio.untitled")),de=async e=>{const a=await Promise.all(e.map(f=>wt(f,f.name,"import")));if(!a.length)return;const n=G();r.getState().update(n,f=>{const k=[...f.images];for(const E of a)k.push({...E,...ct(E.width,E.height,k)});return{...f,images:k}})},Pe=e=>{$(async()=>{const a=G();await yt(a,s(e))})},J=T.filter(e=>b.includes(e.id)),Te=i&&x.live?M(me(i,x.live)):T,Q=e=>{const a=G(),{w:n,h:f}=V(I.current),k=dt(e,s(`imageStudio.new.${e}`),(n/2-m.vp.x)/m.vp.z,(f/2-m.vp.y)/m.vp.z);k.x-=k.w/2,k.y-=k.h/2,r.getState().update(a,E=>ue(E,[...M(E),k])),r.setState({selection:[k.id]}),A(K)},Me=e=>{const{w:a,h:n}=V(I.current);m.setVp(et(m.vp,m.vp.z*e,a/2,n/2))};return t.jsxs("div",{className:"ims",onKeyDownCapture:e=>{if(e.target.closest('input, select, textarea, button, [contenteditable="true"]'))return;const a=e.metaKey||e.ctrlKey,n=e.key.toLowerCase();let f=!0;a&&n==="z"&&i?r.getState().undo(i.id,e.shiftKey):a&&n==="c"?we():a&&n==="v"?B():a&&n==="d"?B(!0):a&&n==="e"?z(!0):!a&&n==="t"?Q("text"):!a&&n==="f"?Q("frame"):!a&&n==="h"?P(!0):!a&&n==="v"?P(!1):n===" "?D(!0):(n==="escape"&&(P(!1),z(!1)),f=!1),f&&(e.preventDefault(),e.stopPropagation())},onKeyUpCapture:e=>{e.key===" "&&(D(!1),e.preventDefault(),e.stopPropagation())},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(D(!1),h.current=null)},children:[t.jsxs("header",{className:"ims-header",children:[t.jsxs("button",{className:"ims-back",title:s("imageStudio.back"),onClick:()=>r.getState().close(),children:[t.jsx(We,{size:15}),t.jsx("span",{children:i?.name})]}),t.jsxs("div",{className:"ims-head-actions",children:[i&&t.jsx("button",{disabled:p,title:s("imageStudio.backup"),"aria-label":s("imageStudio.backup"),onClick:()=>{$(()=>Ct(i))},children:t.jsx(Nt,{size:16})}),t.jsxs("button",{className:"ims-primary",disabled:!q.length||p,onClick:()=>z(!d),children:[t.jsx(R,{size:14}),t.jsx("span",{children:s("imageStudio.exportOptions")})]})]})]}),t.jsxs("div",{className:"ims-toolbar",role:"toolbar","aria-label":s("imageStudio.title"),children:[t.jsxs("button",{disabled:p,onClick:()=>F.current?.click(),children:[t.jsx(W,{size:15}),t.jsx("span",{children:s("imageStudio.import")})]}),!Le&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"ims-divider"}),t.jsx("button",{disabled:!g,title:s("imageStudio.undo"),"aria-label":s("imageStudio.undo"),onClick:()=>i&&r.getState().undo(i.id),children:t.jsx(Et,{size:15})}),t.jsx("button",{disabled:!v,title:s("imageStudio.redo"),"aria-label":s("imageStudio.redo"),onClick:()=>i&&r.getState().undo(i.id,!0),children:t.jsx(It,{size:15})}),t.jsx("button",{disabled:!H.some(e=>!e.locked&&!e.hidden),title:s("imageStudio.arrange"),"aria-label":s("imageStudio.arrange"),onClick:()=>{if(i){const e=lt(H.filter(a=>!a.locked&&!a.hidden));r.getState().update(i.id,a=>({...a,images:a.images.map(n=>e.find(f=>f.id===n.id)||n)})),m.fitTo(e)}},children:t.jsx(Lt,{size:15})}),t.jsx("button",{disabled:!J.length,title:s("imageStudio.remove"),"aria-label":s("imageStudio.remove"),onClick:ke,children:t.jsx(ve,{size:15})}),t.jsx("button",{disabled:!J.length,title:s("imageStudio.duplicate"),"aria-label":s("imageStudio.duplicate"),onClick:()=>B(!0),children:t.jsx(je,{size:15})}),t.jsx("button",{disabled:!J.length||p,title:s("imageStudio.reference"),"aria-label":s("imageStudio.reference"),onClick:()=>{$(Ce)},children:t.jsx(Z,{size:15})})]}),t.jsx("span",{className:"ims-toolbar-space"}),[[ge,Z,"imageStudio.chat"],[vt,Ye,"imageStudio.layers"],[K,Se,"imageStudio.inspector"]].map(([e,a,n])=>t.jsx("button",{title:s(n),"aria-label":s(n),onClick:()=>A(e),children:t.jsx(a,{size:16})},e))]}),d&&i&&t.jsx(Bt,{board:i,selection:b,onClose:()=>z(!1)}),c&&t.jsxs("div",{className:"ims-error",role:"alert",children:[s("imageStudio.saveError"),t.jsx("button",{onClick:()=>{r.getState().flush()},children:s("imageStudio.retry")})]}),y&&t.jsxs("div",{className:"ims-error",role:"alert",children:[s("imageStudio.error",{error:y}),t.jsx("button",{onClick:()=>{N(""),u(e=>e+1)},children:s("imageStudio.retry")})]}),t.jsxs("div",{ref:I,className:`ims-stage${L||O?" is-panning":""}`,tabIndex:0,onContextMenu:e=>e.stopPropagation(),onPointerDownCapture:e=>{e.button===2||!(L||O)||e.target.closest(".amx-stage-tools, .amx-stage-hud, .amx-stage-minimap")||(e.stopPropagation(),e.preventDefault(),e.currentTarget.focus(),e.currentTarget.setPointerCapture(e.pointerId),h.current={id:e.pointerId,x:e.clientX,y:e.clientY,vx:m.vp.x,vy:m.vp.y})},onPointerMoveCapture:e=>{const a=h.current;if(!a||a.id!==e.pointerId)return;e.stopPropagation();const{u:n}=V(I.current);m.setVp({...m.vp,x:a.vx+(e.clientX-a.x)/n,y:a.vy+(e.clientY-a.y)/n})},onPointerUpCapture:e=>{h.current?.id===e.pointerId&&(e.stopPropagation(),h.current=null)},onPointerCancel:()=>{h.current=null},"aria-label":s("imageStudio.title"),onDragOver:e=>{e.dataTransfer.types.includes("Files")&&(e.preventDefault(),Y(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Y(!1)},onDrop:e=>{e.preventDefault(),Y(!1),p||$(()=>de(Array.from(e.dataTransfer.files)))},children:[t.jsx("div",{className:"ims-grid",style:Xe(m.vp)}),t.jsxs("div",{className:"ims-world",style:{transform:`translate(${m.vp.x}px, ${m.vp.y}px) scale(${m.vp.z})`},children:[q.map(e=>{const a=Te.find(n=>n.id===e.id)||e;return t.jsxs("div",{"data-image-id":e.id,className:`ims-layer ${be(e)?"ims-image":`ims-${e.kind}`}${x.sel.includes(e.id)?" is-selected":""}${e.locked?" is-locked":""}`,style:{left:a.x,top:a.y,width:a.w,height:a.h},children:[t.jsx(bt,{item:e}),t.jsx("div",{className:"ims-image-label",children:e.name}),x.sel.includes(e.id)&&!e.locked&&t.jsx("div",{className:"ims-resize","data-resize":"se"})]},e.id)}),w.map(e=>{const a=H.find(n=>n.id===e.sourceIds[0]);return t.jsxs("div",{"data-generation-id":e.id,className:`ims-generation${e.status==="failed"?" is-failed":""}`,style:{left:e.x,top:e.y,width:e.w,height:e.h},role:e.status==="failed"?"alert":"status","aria-live":"polite",onPointerDown:n=>n.stopPropagation(),children:[t.jsx("div",{className:"ims-generation-sheen"}),t.jsxs("div",{className:"ims-generation-copy",children:[t.jsx(Ge,{size:20,strokeWidth:1.5}),t.jsx("strong",{children:s(e.kind==="edit"?"imageStudio.generation.editing":"imageStudio.generation.creating")}),t.jsx("span",{children:e.status==="failed"?s("imageStudio.generation.failed"):s(e.status==="preparing"?"imageStudio.generation.preparing":"imageStudio.generation.running")}),a&&t.jsx("small",{children:s("imageStudio.generation.versionOf",{name:a.name})}),e.count>1&&t.jsxs("small",{children:[e.index+1," / ",e.count]})]}),e.status==="failed"&&t.jsxs("div",{className:"ims-generation-actions amx-stage-tools",children:[t.jsx("button",{onClick:()=>A(ge),children:s("imageStudio.generation.openChat")}),t.jsx("button",{title:s("imageStudio.generation.dismiss"),"aria-label":s("imageStudio.generation.dismiss"),onClick:()=>r.getState().removeGeneration(i.id,e.id),children:t.jsx(fe,{size:14})})]})]},e.id)}),x.marquee&&t.jsx("div",{className:"ims-marquee",style:{left:x.marquee.x,top:x.marquee.y,width:x.marquee.w,height:x.marquee.h}})]}),!T.length&&!w.length&&t.jsxs("div",{className:"ims-empty amx-stage-tools",children:[t.jsxs("div",{className:"ims-eyebrow",children:[s("imageStudio.title")," ",t.jsx("span",{children:"/"})," ",s("imageStudio.new")]}),t.jsx("h1",{children:s("imageStudio.headline")}),t.jsx("p",{children:s("imageStudio.intro")}),t.jsx("div",{className:"ims-starters",children:["poster","product","illustration"].map(e=>t.jsxs("button",{disabled:p,onClick:()=>Pe(`imageStudio.${e}Prompt`),children:[t.jsx("span",{children:s(`imageStudio.${e}`)}),t.jsx(Pt,{size:14})]},e))}),t.jsxs("button",{className:"ims-empty-import",disabled:p,onClick:()=>F.current?.click(),children:[t.jsx(W,{size:16}),s("imageStudio.import")]}),t.jsx("small",{children:s("imageStudio.importLimit")})]}),!w.length&&(l||p)&&t.jsxs("div",{className:"ims-progress amx-stage-tools",role:"status",children:[t.jsx(te,{size:15,className:"ims-spin"}),s(l?"imageStudio.generating":"imageStudio.busy")]}),Ie&&t.jsxs("div",{className:"ims-drop",children:[t.jsx(W,{size:28}),s("imageStudio.drop")]}),t.jsxs("div",{className:"ims-create-tools amx-stage-tools",role:"toolbar","aria-label":s("imageStudio.canvasTools"),children:[t.jsx("button",{title:s("imageStudio.selectTool"),"aria-label":s("imageStudio.selectTool"),"aria-pressed":!L,onClick:()=>{P(!1),I.current?.focus()},children:t.jsx(Je,{size:17})}),t.jsx("button",{title:s("imageStudio.handTool"),"aria-label":s("imageStudio.handTool"),"aria-pressed":L,onClick:()=>{P(!0),I.current?.focus()},children:t.jsx(Tt,{size:17})}),t.jsx("span",{}),[["text",Mt],["rectangle",Qe],["ellipse",Ze],["frame",Ot]].map(([e,a])=>t.jsx("button",{title:s(`imageStudio.add.${e}`),"aria-label":s(`imageStudio.add.${e}`),onClick:()=>Q(e),children:t.jsx(a,{size:17})},e))]}),ie&&t.jsx(st,{hostRef:I,vp:m.vp,items:X.map(e=>({key:e.id,kind:"card",box:e})),onCenter:m.centerOn}),t.jsx(it,{zoom:m.vp.z,onZoomBy:Me,onFit:()=>m.fitTo(X),snap:se,onSnap:ze,mini:ie,onMini:Ne})]}),t.jsxs("footer",{className:"ims-footer",children:[t.jsx("span",{title:s("imageStudio.hint"),children:s(i?c?"imageStudio.unsaved":j?"imageStudio.saving":"imageStudio.local":"imageStudio.empty")}),i&&t.jsx("input",{"aria-label":s("imageStudio.name"),value:i.name,onChange:e=>r.getState().update(i.id,a=>({...a,name:e.target.value}),!1)}),t.jsx("span",{children:s("imageStudio.itemCount",{count:T.length})})]}),ae&&t.jsx(Ut,{target:ae,board:i,busy:p,onClose:Ee,onImport:()=>F.current?.click(),onExport:()=>z(!0),onInspect:()=>A(K),run:$}),t.jsx("input",{ref:F,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",multiple:!0,hidden:!0,onChange:e=>{const a=Array.from(e.target.files||[]);e.target.value="",$(()=>de(a))}})]})}const Vt={version:1,id:"",name:"",updatedAt:0,sessionId:null,images:[],collected:[]};export{xs as ImageStudioView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as
|
|
1
|
+
import{F as v,mf as k,kZ as L,ci as w,k$ as p,k_ as x,mg as U,kx as z}from"./appStore-DWP8UET9.js";import{j as l,d as y}from"./index-BM2o7PeV.js";import{n as T}from"./nativeDownload-BYT082bY.js";const S=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],_=v("lock-open",S),R=t=>(t.mime?.startsWith("image/")??!1)||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(t.name);function N(t){const n=t.match(/^data:([^;]+);base64,(.*)$/),e=p(n?.[2]||"");return{mimeType:n?.[1]||"application/octet-stream",bytes:e,size:e.length}}function E(t,n,e,i){e=t.sourceSessionId||e;const o=i==="host"?k(e):null,s=r=>{T({text:r?.message||String(r),level:"error"})},a=o?.downloadHostFile;return{name:t.name,path:o?.local&&t.path&&/^([/~]|[A-Za-z]:[\\/])/.test(t.path)?t.path:void 0,load:async()=>{if(t.dataUrl)return N(t.dataUrl);if(!t.path)return null;if(o){const c=await o.readHostFile(t.path);return c.tooLarge?{tooLarge:!0,size:c.size}:{mimeType:c.mimeType,bytes:p(c.content),size:c.size}}const r=await x(w(e),e,t.path);return{mimeType:r.mimeType,bytes:p(r.content),size:r.size}},download:t.path?i==="host"?a?()=>{a(t.path,t.name).catch(s)}:void 0:()=>{L(w(e),e,t.path).catch(s)}:void 0}}const f=({f:t,onClick:n})=>{const e=z(t.mime||"",t.name);return l.jsxs("button",{className:"inline-file-card",title:t.name,onClick:n,children:[l.jsx(e,{size:15}),l.jsx("span",{className:"inline-file-name",children:t.name})]})},D=({f:t,cfg:n,sessionId:e,execMode:i,onClick:o})=>{e=t.sourceSessionId||e;const s=t.dataUrl||(t.path&&i!=="host"?U(w(e),e,t.path):null),[a,r]=y.useState(s),[c,h]=y.useState(!1),d=y.useRef(null);return y.useEffect(()=>{if(h(!1),s){r(s);return}let u=!1;return(async()=>{if(!t.path)return;const b=i==="host"?k(e):null;try{let g=null,F="";if(b){const m=await b.readHostFile(t.path);if(u)return;if(m.tooLarge){h(!0);return}g=p(m.content),F=m.mimeType}else if(i!=="host"){const m=await x(w(e),e,t.path);if(u)return;g=p(m.content),F=m.mimeType}if(!g||u)return;const j=URL.createObjectURL(new Blob([g],{type:F||t.mime||"image/png"}));d.current=j,r(j)}catch{u||h(!0)}})(),()=>{u=!0,d.current&&(URL.revokeObjectURL(d.current),d.current=null)}},[t.path,t.dataUrl]),c?l.jsx(f,{f:t,onClick:o}):a?l.jsx("img",{className:"inline-file-img",src:a,alt:t.name,title:t.name,onClick:o,draggable:!1,onError:()=>h(!0)}):null},$=({files:t,cfg:n,sessionId:e,execMode:i,onOpenPreview:o})=>{if(!t.length)return null;const s=a=>o?.(E(a,n,e,i));return l.jsx("div",{className:"inline-file-grid",children:t.map((a,r)=>R(a)?l.jsx(D,{f:a,cfg:n,sessionId:e,execMode:i,onClick:()=>s(a)},r):l.jsx(f,{f:a,onClick:()=>s(a)},r))})};export{$ as I,_ as L,E as t};
|