@jxsuite/studio 10.0.0 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{2020-j56903f1.js → 2020-mkb0qa6p.js} +2 -2
- package/dist/chunks/adapter-xcpsmecx.js +4 -0
- package/dist/chunks/{add-new-flow-snx1s4b0.js → add-new-flow-ptmhmzr9.js} +3 -3
- package/dist/chunks/{cf-account-picker-xyqw0jex.js → cf-account-picker-z1sgwpwd.js} +3 -3
- package/dist/chunks/cf-settings-xqvhxxe9.js +4 -0
- package/dist/chunks/components-whsc81a7.js +4 -0
- package/dist/chunks/content-source-jwtxg78w.js +4 -0
- package/dist/chunks/{convert-to-repeater-fhdwyg14.js → convert-to-repeater-f92ey3kp.js} +3 -3
- package/dist/chunks/editor-zdqdpq1x.js +4 -0
- package/dist/chunks/entry-commands-w8p2fbpt.js +4 -0
- package/dist/chunks/{extension-sections-8ez2rrk8.js → extension-sections-y2p1te2r.js} +3 -3
- package/dist/chunks/file-ops-13ab4swj.js +4 -0
- package/dist/chunks/files-zbc8p6v1.js +4 -0
- package/dist/chunks/{format-host-zfjz4rzm.js → format-host-zjsbktbx.js} +3 -3
- package/dist/chunks/fs-events-t6x0hch6.js +4 -0
- package/dist/chunks/grid-open-fyzdwpkh.js +4 -0
- package/dist/chunks/{grid-view-ka55z38f.js → grid-view-r22jsqht.js} +5 -5
- package/dist/chunks/{iframe-host-na2mywz4.js → iframe-host-kbyqc7pt.js} +3 -3
- package/dist/chunks/index-6nvj89vb.js +4 -0
- package/dist/chunks/{index-qb98xhse.js → index-pxwwf00y.js} +2 -2
- package/dist/chunks/{javascript-ces13wny.js → javascript-pzqryby6.js} +2 -2
- package/dist/chunks/{jsonMode-6md16d4v.js → jsonMode-tcnyxyap.js} +5 -5
- package/dist/chunks/jx-validate-5sp8a4rm.js +4 -0
- package/dist/chunks/layers-panel-qrxj9vr2.js +4 -0
- package/dist/chunks/layers-tpzayggx.js +4 -0
- package/dist/chunks/lit-html-x6nrxsx3.js +4 -0
- package/dist/chunks/media-library-ywppnjrz.js +4 -0
- package/dist/chunks/media-picker-etxgc8qq.js +4 -0
- package/dist/chunks/{monaco-binding-p8j80s4w.js → monaco-binding-bqpge64f.js} +2 -2
- package/dist/chunks/monaco-buffer-qrnqhk0b.js +4 -0
- package/dist/chunks/{monaco-setup-wasktzfg.js → monaco-setup-1mkab762.js} +3 -3
- package/dist/chunks/notify-kcv38wwe.js +4 -0
- package/dist/chunks/parse-df2kkmhc.js +4 -0
- package/dist/chunks/{platform-c16mqvmp.js → platform-dtsysmyd.js} +2 -2
- package/dist/chunks/publish-panel-evb1rcxt.js +4 -0
- package/dist/chunks/{publish-quick-vr695j26.js → publish-quick-m9vkhahq.js} +3 -3
- package/dist/chunks/publish-workspace-ktk9h536.js +4 -0
- package/dist/chunks/quick-search-2f47fxcw.js +4 -0
- package/dist/chunks/references-5w6ajjv7.js +4 -0
- package/dist/chunks/right-panel-kz0a6byf.js +4 -0
- package/dist/chunks/source-control-1phx90zk.js +4 -0
- package/dist/chunks/{studio-h5tpz5ke.js → studio-07k0geap.js} +4 -4
- package/dist/chunks/{studio-7xag4na8.js → studio-0g2sm01j.js} +4 -4
- package/dist/chunks/{studio-de1s2x9v.js → studio-0hr000ba.js} +4 -4
- package/dist/chunks/{studio-35vrtpdq.js → studio-1wyp7dt5.js} +4 -4
- package/dist/chunks/{studio-34jrz12k.js → studio-20ap8dds.js} +4 -4
- package/dist/chunks/{studio-d83m0wyq.js → studio-291gqh98.js} +3 -3
- package/dist/chunks/{studio-xdpz9rpe.js → studio-37twdaf7.js} +29 -29
- package/dist/chunks/{studio-ry81j4q1.js → studio-4nkm4404.js} +4 -4
- package/dist/chunks/{studio-3v5cagy9.js → studio-4smcnv33.js} +3 -3
- package/dist/chunks/{studio-k3a8rp3d.js → studio-4zqfw5ha.js} +2 -2
- package/dist/chunks/{studio-d038kqbs.js → studio-56egy6vf.js} +4 -4
- package/dist/chunks/{studio-x3mjr5cc.js → studio-5dmgmyw4.js} +4 -4
- package/dist/chunks/{studio-x97ay0v4.js → studio-5e7p1vgd.js} +3 -3
- package/dist/chunks/{studio-ndskgqef.js → studio-5m0w815d.js} +3 -3
- package/dist/chunks/{studio-pqqq6v85.js → studio-695k95bw.js} +4 -4
- package/dist/chunks/{studio-gwrhcrss.js → studio-6vwvshw8.js} +2 -2
- package/dist/chunks/{studio-pgm83a2f.js → studio-76t560kn.js} +4 -4
- package/dist/chunks/{studio-396srjbk.js → studio-7823f0g8.js} +3 -3
- package/dist/chunks/{studio-r17asgs0.js → studio-7vb997ff.js} +4 -4
- package/dist/chunks/{studio-et2q4s8n.js → studio-8486jn4r.js} +3 -3
- package/dist/chunks/{studio-3w35qvay.js → studio-848rk4p1.js} +4 -4
- package/dist/chunks/{studio-5tzgq6fx.js → studio-8jb31dcf.js} +4 -4
- package/dist/chunks/{studio-y26hx9re.js → studio-8qejv8yf.js} +4 -4
- package/dist/chunks/{studio-h7weqf2q.js → studio-8x8616xd.js} +4 -4
- package/dist/chunks/{studio-hcsba201.js → studio-9cp96v90.js} +2 -2
- package/dist/chunks/{studio-dx73md4n.js → studio-9rcbvksg.js} +6 -6
- package/dist/chunks/{studio-m48v13s3.js → studio-a3s6frde.js} +3 -3
- package/dist/chunks/{studio-4kzbrr5t.js → studio-ahf3cspq.js} +3 -3
- package/dist/chunks/{studio-zgx7svjd.js → studio-bkmv1h3e.js} +5 -5
- package/dist/chunks/{studio-3c8pp7pb.js → studio-brdp85q7.js} +4 -4
- package/dist/chunks/{studio-yg3djpnm.js → studio-cgb97rwv.js} +4 -4
- package/dist/chunks/{studio-tj2s0tks.js → studio-ch8gt8vt.js} +3 -3
- package/dist/chunks/{studio-p1n2xjda.js → studio-cqf1k4qk.js} +4 -4
- package/dist/chunks/{studio-jttyqrmh.js → studio-cvz0e00f.js} +4 -4
- package/dist/chunks/{studio-5wzdy1jc.js → studio-dbgv4fv9.js} +14 -14
- package/dist/chunks/{studio-h310mbqm.js → studio-dy2xtt7a.js} +4 -4
- package/dist/chunks/{studio-xkxetm65.js → studio-eesyjg7h.js} +5 -5
- package/dist/chunks/studio-et6t8g4m.js +4 -0
- package/dist/chunks/{studio-cpkamjdn.js → studio-f2j9et3h.js} +8 -8
- package/dist/chunks/{studio-epenqmvk.js → studio-fep7hr66.js} +4 -4
- package/dist/chunks/{studio-2ks6ka4g.js → studio-fyf7j57j.js} +3 -3
- package/dist/chunks/{studio-rzg8hnkf.js → studio-g5prntab.js} +4 -4
- package/dist/chunks/{studio-c1pxszat.js → studio-ga77mf07.js} +4 -4
- package/dist/chunks/{studio-9cxmp61c.js → studio-ggm7zf70.js} +3 -3
- package/dist/chunks/studio-h7gy12h2.js +5 -0
- package/dist/chunks/{studio-9dz76yqc.js → studio-hsr3k06v.js} +5 -5
- package/dist/chunks/{studio-vzgmyt0v.js → studio-j933k8nr.js} +4 -4
- package/dist/chunks/studio-jgbvqcgh.js +5 -0
- package/dist/chunks/{studio-wxhy1yh7.js → studio-jh6t5qz4.js} +3 -3
- package/dist/chunks/{studio-88bmt9rh.js → studio-k4xc5g6h.js} +4 -4
- package/dist/chunks/{studio-wxdcd42g.js → studio-mwnmzx7g.js} +6 -6
- package/dist/chunks/{studio-1e8dw2w2.js → studio-nf0pqpbj.js} +4 -4
- package/dist/chunks/{studio-2j86y34y.js → studio-p0nf2e1f.js} +5 -5
- package/dist/chunks/{studio-k3bcy02e.js → studio-pd9dsqpq.js} +4 -4
- package/dist/chunks/{studio-agyvzfm4.js → studio-pmzg17fj.js} +4 -4
- package/dist/chunks/{studio-zg16eeq1.js → studio-pzfa2vmb.js} +4 -4
- package/dist/chunks/{studio-hy4ye0dx.js → studio-qyb5bebs.js} +7 -7
- package/dist/chunks/{studio-0ydxv2mr.js → studio-rf8d6p9f.js} +6 -6
- package/dist/chunks/{studio-45gyxpcq.js → studio-rt498t2v.js} +4 -4
- package/dist/chunks/studio-sd07xva5.js +6 -0
- package/dist/chunks/{studio-06j4en5h.js → studio-skynbac3.js} +2 -2
- package/dist/chunks/{studio-vswcpzk7.js → studio-t3j8htp7.js} +5 -5
- package/dist/chunks/{studio-3zge48z4.js → studio-thj81e98.js} +6 -6
- package/dist/chunks/{studio-ekgtrndg.js → studio-tpy3rdxn.js} +4 -4
- package/dist/chunks/{studio-ewarnzm4.js → studio-va0e63sk.js} +4 -4
- package/dist/chunks/{studio-gr36vnte.js → studio-vcz63n42.js} +4 -4
- package/dist/chunks/studio-vffwe9k7.js +5 -0
- package/dist/chunks/{studio-7dzyz9n8.js → studio-vjhej0w5.js} +103 -103
- package/dist/chunks/{studio-hwejq03c.js → studio-vxjap704.js} +4 -4
- package/dist/chunks/{studio-03mqh8ax.js → studio-w67vfgy5.js} +2 -2
- package/dist/chunks/{studio-ajw4k8hp.js → studio-x2metr13.js} +3 -3
- package/dist/chunks/{studio-771k2n12.js → studio-xebavr9s.js} +4 -4
- package/dist/chunks/{studio-x08a3m0a.js → studio-yg5n49za.js} +4 -4
- package/dist/chunks/{studio-xh683qzy.js → studio-yhz5b313.js} +4 -4
- package/dist/chunks/{studio-fy7jzj9j.js → studio-zacvfm31.js} +4 -4
- package/dist/chunks/{studio-zkq3r91p.js → studio-zsjpsw08.js} +4 -4
- package/dist/chunks/{studio-2hsqbq7b.js → studio-zxm98z2m.js} +6 -6
- package/dist/chunks/{tsMode-h6tkz0ea.js → tsMode-6vwhy6ty.js} +5 -5
- package/dist/chunks/workspace-d65bz1qk.js +4 -0
- package/dist/chunks/workspace-home-vbg9b3jh.js +4 -0
- package/dist/chunks/{ws-client-e951my95.js → ws-client-zcxkfgmf.js} +3 -3
- package/dist/manifest.json +71 -71
- package/dist/studio.js +73 -70
- package/package.json +4 -4
- package/src/platform-errors.ts +17 -1
- package/src/platforms/cloud.ts +14 -0
- package/src/publish/publish-changes.ts +136 -4
- package/src/types.ts +14 -0
- package/dist/chunks/adapter-wc5zvg9a.js +0 -4
- package/dist/chunks/cf-settings-hp1pjm0n.js +0 -4
- package/dist/chunks/components-nkwphrx3.js +0 -4
- package/dist/chunks/content-source-6a253wmk.js +0 -4
- package/dist/chunks/editor-wqrc68ca.js +0 -4
- package/dist/chunks/entry-commands-nef0wrmp.js +0 -4
- package/dist/chunks/file-ops-y3w71k1n.js +0 -4
- package/dist/chunks/files-de90apn9.js +0 -4
- package/dist/chunks/fs-events-77c0mr0x.js +0 -4
- package/dist/chunks/grid-open-4n4fjfpf.js +0 -4
- package/dist/chunks/index-ewmgdb7c.js +0 -4
- package/dist/chunks/jx-validate-b309c020.js +0 -4
- package/dist/chunks/layers-8rn8y6qv.js +0 -4
- package/dist/chunks/layers-panel-eyah7h9z.js +0 -4
- package/dist/chunks/lit-html-wyqw04y2.js +0 -4
- package/dist/chunks/media-library-gs3np47y.js +0 -4
- package/dist/chunks/media-picker-tt7dk4tb.js +0 -4
- package/dist/chunks/monaco-buffer-wsf6cmnq.js +0 -4
- package/dist/chunks/notify-qwst108r.js +0 -4
- package/dist/chunks/parse-n8dfxnqf.js +0 -4
- package/dist/chunks/publish-panel-d34bhvwj.js +0 -4
- package/dist/chunks/publish-workspace-2yr60mt4.js +0 -4
- package/dist/chunks/quick-search-e6xsdv0d.js +0 -4
- package/dist/chunks/references-gsj6trdv.js +0 -4
- package/dist/chunks/right-panel-33jv1knc.js +0 -4
- package/dist/chunks/source-control-bj9bejjv.js +0 -4
- package/dist/chunks/studio-38g0jdz7.js +0 -5
- package/dist/chunks/studio-dbxv7w4s.js +0 -5
- package/dist/chunks/studio-psh8mwnw.js +0 -4
- package/dist/chunks/studio-v9ywz2se.js +0 -6
- package/dist/chunks/studio-yx8hzqja.js +0 -5
- package/dist/chunks/workspace-home-zkkrxq3r.js +0 -4
- package/dist/chunks/workspace-tdqqjqaa.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{te}from"./studio-psh8mwnw.js";import{p}from"./studio-03mqh8ax.js";import{g,C}from"./studio-4kzbrr5t.js";import{hh,Sr,E$}from"./studio-de1s2x9v.js";import{Ot,Nt}from"./studio-cpkamjdn.js";import{Ue,wi,ft,T,R,Yt,tt}from"./studio-jttyqrmh.js";import{m,u,Kd}from"./studio-vzgmyt0v.js";import{zd}from"./studio-k3bcy02e.js";import{He}from"./studio-x3mjr5cc.js";import{zc,_a,XL,uA,QL,Sa,pA,fA,jb,tr}from"./studio-34jrz12k.js";import{Ow,Gu}from"./studio-hy4ye0dx.js";import{NT,Wu}from"./studio-agyvzfm4.js";import{Wt}from"./studio-x97ay0v4.js";import{jT,HT,BT,zT,ym}from"./studio-ndskgqef.js";import{bp}from"./studio-pgm83a2f.js";import{Rd,Dd,qu,_p,Aw}from"./studio-gr36vnte.js";import{n,_}from"./studio-zkq3r91p.js";import{le}from"./studio-7xag4na8.js";var D=[{key:"all",label:"All media"},{key:"image",label:"Images"},{key:"video",label:"Video"},{key:"audio",label:"Audio"},{key:"document",label:"Documents"},{key:"font",label:"Fonts"},{key:"unused",label:"Unused"}],pS=D.map((e)=>e.key);function re(e){return pS.some((t)=>t===e)}function L(e){return D.find((t)=>t.key===e)?.label??"All media"}var z=[{key:"newest",label:"Newest"},{key:"name",label:"Name"},{key:"size",label:"Size"}],Ce=z.map((e)=>e.key);function ne(e){return Ce.some((t)=>t===e)}function U(e,t,i){switch(t){case"all":return!0;case"unused":return i!==null&&i.has(e.file);default:return e.kind===t}}function W(e,t){let i=t.trim().toLowerCase();return i===""||e.name.toLowerCase().includes(i)}function q(e,t){return e.filter((a)=>U(a,t.filter,t.unused)&&W(a,t.query)).toSorted((a,r)=>De(t.sort,a,r)||a.file.localeCompare(r.file))}function De(e,t,i){switch(e){case"name":return t.name.localeCompare(i.name,void 0,{numeric:!0,sensitivity:"base"});case"size":return(i.bytes??-1)-(t.bytes??-1);default:return(i.modified??"").localeCompare(t.modified??"")}}function oe(e,t){let i={all:e.length,audio:0,document:0,font:0,image:0,unused:t===null?null:e.filter((a)=>t.has(a.file)).length,video:0};for(let a of e)i[a.kind]=(i[a.kind]??0)+1;return i}var Ee=132,ae=12;function se(e){return Math.max(1,Math.floor((e+ae)/(Ee+ae)))}function de(e,t,i,a,r=!1){if(a===0)return null;let o=Math.min(Math.max(e,0),a-1),l=o-o%i,c;switch(t){case"ArrowRight":{c=o+1;break}case"ArrowLeft":{c=o-1;break}case"ArrowDown":{c=o+i;break}case"ArrowUp":{c=o-i;break}case"Home":{c=r?0:l;break}case"End":{c=r?a-1:Math.min(l+i-1,a-1);break}default:return null}return c<0||c>=a?o:c}var pe={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaLibrary",$description:"The Media workspace's library (`specs/studio.md` §22.6): the project's media as filters, a grid and the selected file's detail. ONE document in two modes. In `manage` it is the Media home tab, with Replace, Open in viewer and Delete under the detail; in `pick` it is the full-size picker inside a `jx-dialog` (`media-pick-dialog.json`), and the dialog's own footer answers Cancel or Use <file>. `media/media-library.ts` keeps every decision (which files a filter keeps, the sort, what a count may claim, where an arrow lands, what Replace writes) and hands this document strings and discriminants. **Unused is drawn with no number until the usage sweep has settled**, and Missing alt text and tags are not drawn at all: each needs a store that does not exist, and a filter that cannot be answered is not shipped as one that always answers nothing.",tagName:"div",attributes:{part:"media-library","data-jx-region":"${state.region}","data-mode":"${state.mode}","data-drop":"${state.dropActive}"},style:{$description:"Three columns over the whole stage: the filters, the grid with its toolbar, and the selected file's detail. Fills the pane's stage by its own geometry, as the workspace home does: the stage is `position: relative` (`pane-grid.json`). In pick mode the same columns fill the dialog's body instead, so the root's box is the only thing that differs between the two modes.",position:"absolute",inset:"0",display:"grid",gridTemplateColumns:"200px minmax(0, 1fr) 300px",boxSizing:"border-box",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",background:"var(--bg)",'&[data-mode="pick"]':{$description:"Inside a dialog there is no stage to fill: the box is the dialog body's, at a height the dialog can scroll within.",position:"relative",inset:"auto",height:"min(70vh, 620px)",gridTemplateColumns:"150px minmax(0, 1fr) 210px"},'&[data-drop="true"]':{$description:"The drop affordance is a STATE the flow holds, not a class a handler adds and forgets to take off.",outline:"2px dashed var(--accent)",outlineOffset:"-4px"},'& [part="filters"]':{display:"flex",flexDirection:"column",gap:"2px",padding:"var(--jx-space-3) var(--jx-space-2)",borderRight:"1px solid var(--border)",background:"var(--bg-panel)",overflowY:"auto"},'& [part="filters-heading"]':{margin:"0",padding:"var(--jx-space-2) var(--jx-space-2) var(--jx-space-1)",fontSize:"var(--jx-text-xs)",fontWeight:"600",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--fg-dim)"},'& [part="filter"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",height:"30px",padding:"0 var(--jx-space-2)",border:"none",borderRadius:"var(--radius)",background:"none",color:"var(--fg)",font:"inherit",textAlign:"left",cursor:"pointer"},'& [part="filter"]:hover':{background:"var(--hover-bg)"},'& [part="filter"][aria-pressed="true"]':{background:"color-mix(in srgb, var(--accent) 16%, transparent)",color:"var(--fg)",fontWeight:"600"},'& [part="filter"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="filter-count"]':{marginLeft:"auto",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",fontWeight:"400"},'& [part="main"]':{display:"flex",flexDirection:"column",minWidth:"0",minHeight:"0"},'& [part="toolbar"]':{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)"},'& [part="title"]':{margin:"0 auto 0 0",fontSize:"var(--jx-text-lg)",fontWeight:"600"},'& [part="search"]':{width:"220px"},'& [part="sort"]':{width:"130px"},'& [part="upload"], & [part="empty-upload"]':{$description:"A LABEL around the file picker, not a button that clicks a hidden one: the picker is the control, so it takes focus, Enter opens it and a screen reader announces a file upload. A plain element because a label forwards a click to the input it contains and a custom element between the two would break that.",position:"relative",display:"inline-flex",alignItems:"center",gap:"6px",height:"28px",padding:"0 var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg-panel)",color:"var(--fg)",font:"inherit",cursor:"pointer",":hover":{background:"var(--hover-bg)"},":has(:focus-visible)":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}},'& [part="upload-input"], & [part="replace-input"]':{$description:"Out of the way but still FOCUSABLE: `display: none` would take the control out of the tab order, and the label around it draws the focus ring for it.",position:"absolute",width:"1px",height:"1px",opacity:"0",pointerEvents:"none"},'& [part="upload-glyph"]':{"--jx-icon-size":"16px"},'& [part="body"]':{flex:"1",minHeight:"0",overflowY:"auto",padding:"var(--jx-space-4)"},'& [part="grid"]':{$description:"auto-fill over a minimum tile width; `media/media-library-model.ts` `gridColumns` does the same arithmetic, so ArrowDown lands on the tile drawn under the current one. Keep the two numbers in step.",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(132px, 1fr))",gap:"12px",alignContent:"start"},'& [part="tile"]':{display:"flex",flexDirection:"column",gap:"4px",padding:"4px",borderRadius:"var(--jx-radius-md, 6px)",border:"2px solid transparent",cursor:"pointer",minWidth:"0",outline:"none"},'& [part="tile"]:hover':{background:"var(--hover-bg)"},'& [part="tile"][aria-selected="true"]':{borderColor:"var(--accent)"},'& [part="tile"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"2px"},'& [part="thumb"]':{display:"flex",alignItems:"center",justifyContent:"center",aspectRatio:"4 / 3",borderRadius:"var(--radius)",background:"var(--bg-input)",overflow:"hidden",color:"var(--fg-dim)","--jx-icon-size":"28px"},'& [part="thumb-img"]':{width:"100%",height:"100%",objectFit:"cover"},'& [part="tile-name"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-sm)"},'& [part="tile-caption"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",minHeight:"1em"},'& [part="empty"]':{display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)",padding:"48px var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)","--jx-icon-size":"40px"},'& [part="empty-title"]':{margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600",color:"var(--fg)"},'& [part="empty-detail"]':{margin:"0",maxWidth:"42ch",lineHeight:"1.5"},'& [part="detail"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",padding:"var(--jx-space-4)",borderLeft:"1px solid var(--border)",background:"var(--bg-panel)",overflowY:"auto",minWidth:"0"},'& [part="detail-hint"]':{margin:"auto 0",textAlign:"center",color:"var(--fg-dim)"},'& [part="detail-preview"]':{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"140px",maxHeight:"220px",borderRadius:"var(--radius)",background:"var(--bg-input)",overflow:"hidden",color:"var(--fg-dim)","--jx-icon-size":"40px"},'& [part="preview-img"], & [part="preview-video"]':{maxWidth:"100%",maxHeight:"220px",objectFit:"contain"},'& [part="preview-audio"]':{width:"100%"},'& [part="preview-specimen"]':{$description:"The viewer's specimen at a side pane's size. The face arrives as the `@font-face` the flow writes under a family name generated from the path (`media/media-pane.ts` `specimenOf`); the element carries only that name, as a custom property, and the fallback stack is a rule, here.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-4)",maxWidth:"100%",color:"var(--fg)",fontFamily:"var(--jx-specimen-family, system-ui), system-ui, sans-serif"},'& [part="specimen-line"]':{margin:"0",lineHeight:"1.3",overflowWrap:"anywhere"},'& [part="specimen-line"][data-size="32"]':{fontSize:"32px"},'& [part="specimen-line"][data-size="14"]':{fontSize:"var(--jx-text-md)"},'& [part="detail-name"]':{margin:"0",fontSize:"var(--jx-text-md)",fontWeight:"600",overflowWrap:"anywhere"},'& [part="facts"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="group-title"]':{margin:"0",fontSize:"var(--jx-text-xs)",fontWeight:"600",color:"var(--fg-dim)"},'& [part="url"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="url-value"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--jx-font-mono)",fontSize:"var(--jx-text-sm)"},'& [part="usage"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)"},'& [part="usage-headline"]':{margin:"0",fontSize:"var(--jx-text-sm)"},'& [part="usage-list"]':{margin:"0",padding:"0",listStyle:"none",display:"flex",flexDirection:"column",gap:"2px"},'& [part="usage-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)"},'& [part="usage-link"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",border:"none",background:"none",padding:"0",color:"var(--accent)",font:"inherit",fontSize:"var(--jx-text-sm)",textAlign:"left",cursor:"pointer",":hover":{textDecoration:"underline"},":focus-visible":{outline:"var(--jx-focus-ring)"}},'& [part="usage-count"]':{fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)"},'& [part="actions"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)",marginTop:"var(--jx-space-2)"},'& [part="replace"]':{position:"relative",display:"inline-flex",alignItems:"center",height:"28px",padding:"0 var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg)",color:"var(--fg)",font:"inherit",cursor:"pointer",":hover":{background:"var(--hover-bg)"},":has(:focus-visible)":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}}},ondragover:{$prototype:"Function",body:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/dragOver"},value:[]}],description:"A file dropped ANYWHERE on the library uploads, to the destination the Upload label names before the drop: public/media/."},ondragleave:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dragOut"},value:[]}]},ondrop:{$prototype:"Function",body:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/drop"},value:[{$ref:"event#/dataTransfer/files"}]}]},children:[{tagName:"nav",attributes:{part:"filters","aria-label":"Media filters"},children:[{tagName:"h2",attributes:{part:"filters-heading"},textContent:"Library"},{$prototype:"Array",items:{$ref:"#/state/filters"},key:{$ref:"$map/item/key"},map:{tagName:"button",attributes:{part:"filter",type:"button","aria-pressed":"${$map.item.pressed}","data-filter":"${$map.item.key}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",attributes:{part:"filter-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"filter-count"},textContent:"${$map.item.count}"}]}}]},{tagName:"section",attributes:{part:"main","aria-labelledby":"${state.titleId}"},children:[{tagName:"header",attributes:{part:"toolbar"},children:[{tagName:"h2",attributes:{part:"title",id:"${state.titleId}"},textContent:"${state.title}"},{tagName:"jx-textfield",attributes:{part:"search"},$props:{type:"search",size:"sm",label:"Search media",placeholder:"Search by name…",autocomplete:"off",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setQuery"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"sort"},$props:{label:"Sort",size:"sm",options:{$ref:"#/state/sortOptions"},value:{$ref:"#/state/sort"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSort"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"label",attributes:{part:"upload",title:"${state.uploadHint}"},children:[{tagName:"input",attributes:{part:"upload-input",type:"file",multiple:!0,accept:"${state.uploadAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[{$ref:"event#/target"}]}],description:"The picker itself, so the destination in the label's tooltip is visible BEFORE the files are chosen. The flow takes the element rather than the file list because a file input that is not cleared refuses the same file twice."}},{tagName:"jx-icon",attributes:{part:"upload-glyph","aria-hidden":"true"},$props:{name:"upload-simple"}},{tagName:"span",textContent:"Upload"}]}]},{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"grid-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/gridState"},cases:{loading:{tagName:"p",attributes:{part:"empty",role:"status"},textContent:"Reading the project's media…"},counting:{tagName:"p",attributes:{part:"empty",role:"status"},textContent:"${state.countingLabel}"},empty:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"jx-icon",attributes:{part:"empty-glyph","aria-hidden":"true"},$props:{name:"image"}},{tagName:"p",attributes:{part:"empty-title"},textContent:"${state.emptyTitle}"},{tagName:"p",attributes:{part:"empty-detail"},textContent:"${state.emptyDetail}"},{tagName:"label",attributes:{part:"empty-upload",title:"${state.uploadHint}"},children:[{tagName:"input",attributes:{part:"upload-input",type:"file",multiple:!0,accept:"${state.uploadAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[{$ref:"event#/target"}]}],description:"The picker itself, so the destination in the label's tooltip is visible BEFORE the files are chosen. The flow takes the element rather than the file list because a file input that is not cleared refuses the same file twice."}},{tagName:"jx-icon",attributes:{part:"upload-glyph","aria-hidden":"true"},$props:{name:"upload-simple"}},{tagName:"span",textContent:"Upload"}]}]},nomatch:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"jx-icon",attributes:{part:"empty-glyph","aria-hidden":"true"},$props:{name:"image"}},{tagName:"p",attributes:{part:"empty-title"},textContent:"${state.emptyTitle}"},{tagName:"p",attributes:{part:"empty-detail"},textContent:"${state.emptyDetail}"},{tagName:"jx-button",attributes:{part:"reset"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/reset"},value:[]}]},children:[{tagName:"span",textContent:"Show all media"}]}]},listed:{tagName:"div",attributes:{part:"grid",role:"listbox","aria-labelledby":"${state.titleId}"},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowRight:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowLeft:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],Home:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],End:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/activateSelected"},value:[]}]}}],description:"The grid pattern: arrows move one tile, Home and End to the ends of the row, Ctrl+Home and Ctrl+End to the ends of the grid, and Enter opens the selected file (in pick mode, uses it). The flow computes where the move lands; the tile that receives it takes focus, so the roving tabindex follows the selection."},children:[{$prototype:"Array",items:{$ref:"#/state/tiles"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"tile",role:"option","aria-selected":"${$map.item.selected}",tabindex:"${$map.item.tabindex}","data-file":"${$map.item.file}",title:"${$map.item.name}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"$map/item/file"}]}]},onfocus:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/focusTile"},value:[{$ref:"$map/item/file"}]}],description:"Selection follows focus, the listbox pattern: a Tab onto the grid lands on the roving stop and selects it, so the first Enter opens (in pick mode, uses) the tile the focus ring is on rather than nothing."},ondblclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/file"}]}]},oncontextmenu:{$prototype:"Function",body:[{$switch:{$ref:"#/state/mode"},cases:{manage:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/file"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]}}],description:"Manage mode only: the detail pane's actions at the pointer. Pick mode's dialog is modal, and a menu in the popover layer outside it would be inert, so its right-click is left to the platform."},children:[{tagName:"div",attributes:{part:"thumb"},children:[{tagName:"div",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/thumbState"},cases:{image:{tagName:"img",attributes:{part:"thumb-img",src:"${$map.item.thumbSrc}",alt:"",draggable:"false"},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"$map/item/file"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}},pending:{tagName:"span",attributes:{part:"thumb-pending","aria-hidden":"true"}},glyph:{tagName:"jx-icon",attributes:{part:"thumb-glyph","aria-hidden":"true"},$props:{name:{$ref:"$map/item/glyph"}}}},$description:"The thumbnail is asked for when the tile scrolls into view, not when the grid is built: `pending` until the flow's observer reports the tile, then the picture. A file the browser draws no picture of shows its kind's glyph."}]},{tagName:"span",attributes:{part:"tile-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"tile-caption"},textContent:"${$map.item.caption}"}]}}]}}}]}]},{tagName:"aside",attributes:{part:"detail","aria-label":"Details"},children:[{tagName:"div",attributes:{part:"detail-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/detailState"},cases:{none:{tagName:"p",attributes:{part:"detail-hint"},textContent:"${state.detailHint}"},shown:{tagName:"div",attributes:{part:"detail-body",role:"none"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"detail-preview"},children:[{tagName:"div",attributes:{part:"preview-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/previewKind"},cases:{image:{tagName:"img",attributes:{part:"preview-img",src:"${state.previewSrc}",alt:""},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"#/state/selectedFile"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}},video:{tagName:"video",attributes:{part:"preview-video",src:"${state.previewSrc}",controls:!0}},audio:{tagName:"audio",attributes:{part:"preview-audio",src:"${state.previewSrc}",controls:!0}},font:{tagName:"div",attributes:{part:"preview-specimen",style:"${state.previewSpecimenFamily}"},children:[{tagName:"style",textContent:"${state.previewFontFace}"},{tagName:"p",attributes:{part:"specimen-line","data-size":"32"},textContent:"Aa"},{tagName:"p",attributes:{part:"specimen-line","data-size":"14"},textContent:"${state.previewSpecimen}"}]},glyph:{tagName:"jx-icon",attributes:{part:"preview-glyph","aria-hidden":"true"},$props:{name:{$ref:"#/state/previewGlyph"}}}}}]},{tagName:"h3",attributes:{part:"detail-name"},textContent:"${state.detailName}"},{tagName:"p",attributes:{part:"facts"},textContent:"${state.detailFacts}"},{tagName:"div",attributes:{part:"url-group"},children:[{tagName:"h4",attributes:{part:"group-title"},textContent:"Site URL"},{tagName:"div",attributes:{part:"url"},children:[{tagName:"code",attributes:{part:"url-value"},textContent:"${state.detailRef}"},{tagName:"jx-action-button",attributes:{part:"copy"},$props:{size:"sm",quiet:!0,hint:"Copy the site URL"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/copyRef"},value:[]}]},children:[{tagName:"span",textContent:"Copy"}]}]}]},{tagName:"div",attributes:{part:"usage-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/usageState"},cases:{shown:{tagName:"div",attributes:{part:"usage"},children:[{tagName:"h4",attributes:{part:"group-title"},textContent:"Used on"},{tagName:"p",attributes:{part:"usage-headline"},textContent:"${state.usageHeadline}"},{tagName:"div",attributes:{part:"usage-list-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasUsageFiles"},cases:{true:{tagName:"ul",attributes:{part:"usage-list"},children:[{$prototype:"Array",items:{$ref:"#/state/usageFiles"},key:{$ref:"$map/item/path"},map:{tagName:"li",attributes:{part:"usage-row","data-usage":"${$map.item.path}"},children:[{tagName:"button",attributes:{part:"usage-link",type:"button",title:"Open ${$map.item.path}"},textContent:"${$map.item.path}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openDocument"},value:[{$ref:"$map/item/path"}]}]}},{tagName:"span",attributes:{part:"usage-count"},textContent:"${$map.item.count}"}]}}]}}}]}},$description:'Hidden on a host with no reference index, which is a different fact from "nothing uses it": a confident zero is the one answer this pane must never invent.'},{tagName:"div",attributes:{part:"actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/mode"},cases:{manage:{tagName:"div",attributes:{part:"actions"},children:[{tagName:"label",attributes:{part:"replace",title:"Replace ${state.detailName} everywhere it is used"},children:[{tagName:"input",attributes:{part:"replace-input",type:"file",accept:"${state.replaceAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/replace"},value:[{$ref:"event#/target"}]}],description:"Replace writes the chosen file over this one's path, so every reference keeps resolving and now shows the new bytes (studio.md §9.3). The element rather than the list, so the input can be cleared."}},{tagName:"span",textContent:"Replace"}]},{tagName:"jx-button",attributes:{part:"open-viewer"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openViewer"},value:[]}]},children:[{tagName:"span",textContent:"Open in viewer"}]},{tagName:"jx-button",attributes:{part:"delete"},$props:{size:"sm",variant:"negative"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[]}]},children:[{tagName:"span",textContent:"Delete"}]}]}},$description:"Manage mode's actions. Pick mode has none here: its answer is the dialog's own footer, Cancel and Use <file>."}]}}}]}]};T("media-library",pe);function Ie(){return{countingLabel:"",detailFacts:"",detailHint:"",detailName:"",detailRef:"",detailState:"none",dropActive:"false",emptyDetail:"",emptyTitle:"",filters:[],gridState:"loading",mode:"manage",previewFontFace:"",previewGlyph:"",previewKind:"glyph",previewSpecimen:"",previewSpecimenFamily:"",previewSrc:"",query:"",region:"",replaceAccept:"",selectedFile:"",sort:"",sortOptions:[],tiles:[],title:"",titleId:"",uploadAccept:"",uploadHint:"",usageFiles:[],usageHeadline:"",usageState:"hidden"}}function ce(e,t){Object.assign(e,t),e.hasUsageFiles=t.usageFiles.length>0}function Re(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function Pe(e){let t=e?.$map,i=_(t)&&"item"in t?t.item:void 0;return _(i)&&"file"in i&&n(i.file)?i.file:null}function V(e,t,i,a){if(a.clear)e.replaceChildren();let{tileHost:r,gridHost:o,inputHost:l,...c}=i,s=g({...Ie(),...c,hasUsageFiles:!1});ce(s,t);let h=null,w=!1,K=R("media-library",s,e,{onNodeCreated:(f,d,k,je)=>{if(w||!(f instanceof HTMLElement))return;let H=Re(k);if(H==="tile"){let ie=Pe(je);if(ie!==null)r(f,ie)}else if(H==="grid")o(f);else if(f instanceof HTMLInputElement&&H==="upload-input")l(f,"upload");else if(f instanceof HTMLInputElement&&H==="replace-input")l(f,"replace")}}).then((f)=>{if(w)f.dispose();else h=f;return f.root});return{attached:()=>{if(w)return!1;let f=h?.root;return f===void 0?!0:f instanceof HTMLElement&&e.contains(f)},dispose(){w=!0,h?.dispose(),h=null},ready:K,update:(f)=>ce(s,f)}}var ue={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaPickDialog",$description:"The full-size media picker (`specs/studio.md` §9.3): a `jx-dialog` whose body is the Media workspace's own library surface in pick mode, so the picker and the workspace are one surface at two sizes. The dialog owns modality, Escape, the backdrop and focus restoration, and its footer is the answer: Cancel, or Use <file>, disabled until a file is chosen. The body is an ISLAND: this document draws the slot and nothing in it, and `surfaces/media-pick-dialog.ts` mounts `media-library.json` there through `onNodeCreated`.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/headline"},confirmLabel:{$ref:"#/state/confirmLabel"},confirmDisabled:{$ref:"#/state/blocked"},cancelLabel:"Cancel",dismissible:!0,size:"xl"},attributes:{part:"media-pick"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},children:[{tagName:"div",attributes:{part:"library-slot"},style:{$description:"The library's box in pick mode is its own (`media-library.json`, `data-mode=\"pick\"`); the slot only gives it the dialog body's width.",minWidth:"0"}}]};T("media-pick-dialog",ue);var B="media-picker";function Ke(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function fe(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(Ue,ft("dialog",B)),e.layer.append(t);let i=!1,a=()=>{if(i)return;i=!0,e.closed()},r=()=>i,o=g({...e.view,closed:a,confirm:e.confirm}),l=null,c=R("media-pick-dialog",o,t,{onNodeCreated:(s,h,w)=>{if(!r()&&s instanceof HTMLElement&&Ke(w)==="library-slot")e.body(s)}}).then(async(s)=>{l=s;let h=s.root;if(r())return s.dispose(),h;if(await Yt(h),!r())Ot(h);return h});return{close(){let s=l?.root;if(s instanceof HTMLElement)Nt(s);l?.dispose(),l=null,t.remove(),a()},host:t,ready:c,update(s){Object.assign(o,s)}}}var nP="media-home",be={audio:"play",document:"file-text",font:"text-aa",image:"image",video:"play"},ze={audio:"Audio",document:"Document",font:"Font",image:"Image",video:"Video"},y={filter:"all",query:"",sort:"newest",selected:null},j=null,x=null,I=0,P=0,A=!1,Y=0;function J(){x=null,A=!1,I=0,P=0,Y+=1}function _e(){return[...S].some((e)=>!e.disposed&&e.choice.filter==="unused")}async function We(e){if(A||x!==null||!hh())return;let t=Y;A=!0,I=0,P=e.length;let i=new Set;for(let a of e){let r=await Gu(a.file);if(t!==Y)return;if(!_e()){J();return}if(r.status==="ready"&&r.result.files.length===0)i.add(a.file);I+=1,b()}x=i,A=!1,b()}var S=new Set,M=new Map,Q=new Set,N=null;function we(){if(N!==null)return;let e=()=>{J(),b()},t=NT(e),i=E$(e);N=()=>{t(),i()}}function qe(){if(S.size===0&&N)N(),N=null}function v(e){if(!e.disposed){if(e.handle?.update(Z(e)),e.onSelect?.(),Ve(e),e.focusOwed)queueMicrotask(()=>Ne(e));xe(e)}}function Ve(e){let t=e.reveal,i=t===null?void 0:e.tiles.get(t);if(i?.isConnected)e.reveal=null,i.scrollIntoView({block:"nearest"})}function xe(e){if(e.sweepTimer!==null||e.disposed)return;e.sweepTimer=setTimeout(()=>{e.sweepTimer=null,e.observer.releaseDetached();for(let[t,i]of e.tiles)if(!i.isConnected)e.tiles.delete(t);for(let t of[e.inputs.upload,e.inputs.replace])for(let i of t)if(!i.isConnected)t.delete(i)},0)}function Me(e){return[...e].find((t)=>t.isConnected)??null}function b(){for(let e of S)v(e)}function X(e){if(e.disposed=!0,e.sweepTimer!==null)clearTimeout(e.sweepTimer),e.sweepTimer=null;e.inputs.upload.clear(),e.inputs.replace.clear(),e.observer.destroy(),e.handle?.dispose(),e.handle=null,e.tiles.clear(),S.delete(e),qe()}function $e(e){let t=Wu(),i=t===null?null:e.images?t.filter((r)=>r.isImage):t;return{files:(i??[]).map((r)=>{let o=Dd(r.file);return{bytes:o?.bytes??null,file:r.file,kind:r.kind,modified:o?.modified??null,name:r.name}}),listed:i}}function Be(e){return D.filter((t)=>(t.key!=="unused"||hh())&&(!e.images||t.key==="image"||t.key==="unused"))}function wb(e){let{filter:t,query:i,selected:a}=e.choice;if(a===null)return null;let r=Wu()?.find((l)=>l.file===a)??null;if(r===null||e.images&&!r.isImage)return null;let o={bytes:null,file:r.file,kind:r.kind,modified:null,name:r.name};return U(o,t,x)&&W(o,i)?r:null}function Ge(e,t){if(t===0)return{emptyDetail:`Upload files or drop them anywhere here. They are saved under ${e.uploadDir}/, and anything already under public/ or a collection's images/ folder is listed here too.`,emptyTitle:e.images?"No images yet":"No media yet"};let{filter:i,query:a}=e.choice;if(a.trim()!=="")return{emptyDetail:`Nothing in ${L(i)} matches it.`,emptyTitle:`No matches for “${a.trim()}”`};if(i==="unused")return{emptyDetail:"Every file is referenced by at least one document.",emptyTitle:"No unused media"};return{emptyDetail:`${t} ${t===1?"file":"files"} in the project, none of them ${L(i).toLowerCase()}.`,emptyTitle:`No ${L(i).toLowerCase()}`}}function Z(e){let{choice:t}=e,{files:i,listed:a}=$e(e),r=oe(i,x),o=Be(e);if(!o.some((d)=>d.key===t.filter))t.filter=o[0]?.key??"all";let l=q(i,{filter:t.filter,query:t.query,sort:t.sort,unused:x}),c=Wu();if(t.filter==="unused"&&c!==null)We(c);let s="listed";if(a===null)s="loading";else if(t.filter==="unused"&&x===null)s="counting";else if(i.length===0||l.length===0)s=i.length===0?"empty":"nomatch";let h=wb(e),w=l.some((d)=>d.file===t.selected)?t.selected:l[0]?.file??null,K=l.map((d)=>{let k=d.kind==="image";return{caption:Aw(Dd(d.file))||ze[d.kind],file:d.file,glyph:be[d.kind],key:d.file,name:d.name,selected:d.file===t.selected?"true":"false",tabindex:d.file===w?"0":"-1",thumbSrc:k&&e.visible.has(d.file)?tr(d.file):"",thumbState:k?e.visible.has(d.file)?"image":"pending":"glyph"}}),f=e.images&&t.filter==="image"?"Images":L(t.filter);return{countingLabel:P>0?`Counting references… ${I} of ${P}`:"Counting references…",dropActive:e.dropActive?"true":"false",filters:o.map((d)=>{let k=r[d.key];return{count:k===null?"":String(k),key:d.key,label:e.images&&d.key==="image"?"All images":d.label,pressed:d.key===t.filter?"true":"false"}}),gridState:s,mode:e.mode,query:t.query,region:e.region,sort:t.sort,sortOptions:z.map((d)=>({label:d.label,value:d.key})),tiles:K,title:f,titleId:`media-library-title-${e.region.replaceAll(/[^\w-]/g,"-")}`,uploadAccept:e.images?"image/*":zc(),uploadHint:`Upload into ${e.uploadDir}/`,...Ge(e,i.length),...Ye(e,h)}}function Ye(e,t){if(t===null)return{detailFacts:"",detailHint:e.mode==="pick"?"Choose a file to use it.":"Select a file to see its details.",detailName:"",detailRef:"",detailState:"none",previewFontFace:"",previewGlyph:"",previewKind:"glyph",previewSpecimen:"",previewSpecimenFamily:"",previewSrc:"",replaceAccept:"",selectedFile:"",usageFiles:[],usageHeadline:"",usageState:"hidden"};let i=Dd(t.file),a=Ow(t.file);if(!Rd(t.file))qu(t.file).then(b);if(a===null||a.status==="pending")Gu(t.file).then(b);let r=jT(t.file),o=r==="image"||r==="video"||r==="audio"||r==="font"?r:"glyph",l=o==="font"?BT(t.file):{fontFace:"",specimen:"",specimenFamily:""};return{detailFacts:HT(t.file,i),detailHint:"",detailName:t.name,detailRef:t.ref,detailState:"shown",previewFontFace:l.fontFace,previewGlyph:be[t.kind],previewKind:o,previewSpecimen:l.specimen,previewSpecimenFamily:l.specimenFamily,previewSrc:o==="glyph"?"":tr(t.file),replaceAccept:pA(t.file),selectedFile:t.file,...zT(a)}}var me=null,ge=null;function Je(){return me??=(le("de90apn9"),import("./files-de90apn9.js")),me}function Qe(){return ge??=(le("y3w71k1n"),import("./file-ops-y3w71k1n.js")),ge}function ee(e){try{e.showPicker()}catch{e.focus()}}function F(e,t){e.choice.selected=t,v(e)}async function he(e,t){let i=await Sa([...t],{dir:e.uploadDir,only:e.images?"image":"media"}),[a]=i;if(!a)return;if(e.choice.filter!=="all"&&e.choice.filter!==a.kind)e.choice.filter=e.images?"image":"all";e.choice.query="",e.reveal=a.path,F(e,a.path)}async function KD(e){let t=e.split("/").pop()??e,{confirmFileDelete:i}=await Qe();if(!await i({name:t,path:e}))return!1;let{markLocalMutation:a}=await (le("77c0mr0x"),import("./fs-events-77c0mr0x.js"));try{a(e),await p().deleteFile(e)}catch(l){return C.error(`Could not delete ${t}.`,{detail:te(l),path:e,source:"Media"}),!1}if(zd([e]),Sr(),m.tabs.has(e))Kd(e);for(let l of S)if(l.choice.selected===e)l.choice.selected=null;if(y.selected===e)y.selected=null;let r=jb(e),o=await Xe(r,a);return await QL(o?jb(r):r),C.success(`Deleted ${t}`),!0}async function Xe(e,t){if(!uA(e))return!1;let i=p();try{if((await i.listDirectory(e)).length>0)return!1;return t(e),await i.deleteFile(e),!0}catch{return!1}}function ke(e){return{activate:(t)=>{F(e,t),ye(e,t)},activateSelected:()=>{let{selected:t}=e.choice;if(t!==null)ye(e,t)},contextMenu:(t,i,a)=>Ze(e,t,i,a),copyRef:()=>{let t=wb(e);if(t)Se(t)},dragOut:()=>{if(e.dropActive)e.dropActive=!1,v(e)},dragOver:()=>{if(!e.dropActive)e.dropActive=!0,v(e)},drop:(t)=>{if(e.dropActive=!1,v(e),t?.length)he(e,t)},focusTile:(t)=>{if(e.choice.selected!==t)F(e,t)},gridHost:(t)=>{e.grid=t},inputHost:(t,i)=>{e.inputs[i].add(t),xe(e);let a=j;if(e.mode==="manage"&&a?.role===i&&(i==="upload"||a.file===e.choice.selected))j=null,ee(t)},key:(t,i)=>et(e,t,i),measure:(t,i,a)=>{if(_p(t,i,a))b();else if(!Rd(t))qu(t).then(b)},openDocument:(t)=>{Je().then(({openFileInTab:i})=>i(t))},openViewer:()=>{let{selected:t}=e.choice;if(t!==null)ym(t)},remove:()=>{let{selected:t}=e.choice;if(t!==null)KD(t)},replace:(t)=>{let[i]=t.files??[];t.value="";let{selected:a}=e.choice;if(i&&a!==null)fA(a,i).then(b)},reset:()=>{e.choice.filter=e.images?"image":"all",e.choice.query="",v(e)},select:(t)=>F(e,t),setFilter:(t)=>{if(re(t))e.choice.filter=t,v(e)},setQuery:(t)=>{e.choice.query=t,v(e)},setSort:(t)=>{if(ne(t))e.choice.sort=t,v(e)},tileHost:(t,i)=>{e.tiles.set(i,t),Fe.set(t,i),e.observer.observe(t)},upload:(t)=>{let i=[...t.files??[]];if(t.value="",i.length>0)he(e,i)}}}function Se(e){if("clipboard"in navigator)navigator.clipboard.writeText(e.ref)}var E=null;function Ze(e,t,i,a){F(e,t);let r=wb(e);if(!r)return;E?.close();let o=(l,c,s,h={})=>({destructive:!1,disabled:!1,dividerAbove:!1,id:l,run:s,title:c,...h});E=Wt({label:`${r.name} actions`,onClosed:(l)=>{if(E===l)E=null},origin:{x:i,y:a},region:"media-tile",rows:[o("open","Open in Viewer",()=>ym(t)),o("copy-url","Copy Site URL",()=>Se(r)),o("replace","Replace…",()=>P2(t),{dividerAbove:!0}),o("delete","Delete",()=>{KD(t)},{destructive:!0,dividerAbove:!0})]})}function ye(e,t){if(e.mode==="pick"){let i=wb(e);if(i)e.onPick?.(i);return}ym(t)}function et(e,t,i){let{files:a}=$e(e),r=q(a,{filter:e.choice.filter,query:e.choice.query,sort:e.choice.sort,unused:x}),o=r.findIndex((h)=>h.file===e.choice.selected),l=e.grid?se(He(e.grid).width):1,c=o===-1?r.length>0?0:null:de(o,t,l,r.length,i),s=c===null?void 0:r[c];if(!s)return;F(e,s.file),e.tiles.get(s.file)?.focus()}var Fe=new WeakMap;function Le(e,t,i,a,r,o){let l={choice:t,disposed:!1,dropActive:!1,grid:null,handle:null,images:r,inputs:{replace:new Set,upload:new Set},mode:e,observer:bp((c)=>{let s=Fe.get(c);if(s!==void 0&&!l.visible.has(s))l.visible.add(s),it(l)}),onPick:null,onSelect:null,paneId:a,reveal:null,focusOwed:!1,region:i,sweepTimer:null,tiles:new Map,uploadDir:o,visible:new Set};return l}var G=new Set;function it(e){if(G.has(e))return;G.add(e),queueMicrotask(()=>{G.delete(e),v(e)})}function fS(e,t){let i=M.get(e);return i!==void 0&&i.tabId===t.id&&i.wrap.isConnected&&i.mount.handle!==null&&i.mount.handle.attached()}function _w(e){let t=M.get(e);if(!t)return;X(t.mount),M.delete(e)}function LT(e,t){let{paneId:i,wrap:a}=e;if(fS(i,t))return;_w(i);let r=Le("manage",y,wi(i,"media-library"),i,!1,_a);if(S.add(r),we(),r.handle=V(a,Z(r),ke(r),{clear:!0}),M.set(i,{mount:r,tabId:t.id,wrap:a}),Q.delete(i))Te(r)}async function Te(e){await e.handle?.ready,Ne(e,!0)}function Ne(e,t=e.focusOwed){if(!t||e.disposed)return;let{selected:i}=e.choice,a=(i===null?void 0:e.tiles.get(i))??[...e.tiles.values()].find((r)=>r.getAttribute("tabindex")==="0");if(a?.isConnected){e.focusOwed=!1,a.focus();return}e.focusOwed=!0}function $T(e){let t=M.get(e);if(t?.wrap.isConnected&&t.mount.handle?.attached()===!0){Te(t.mount);return}Q.add(e)}function M2(e){if(e.filter!==void 0)y.filter=e.filter;if(e.query!==void 0)y.query=e.query;if(e.select!==void 0){if(y.selected=e.select,y.filter!=="all")y.filter="all";y.query=""}b()}function iP(){let e=[...M.values()].map((t)=>Me(t.mount.inputs.upload)).find((t)=>t!==null)??null;if(e){ee(e);return}j={file:null,role:"upload"}}function P2(e){M2({select:e});let t=null;for(let i of M.values())if(i.mount.choice.selected===e)t??=Me(i.mount.inputs.replace);if(t){ee(t);return}j={file:e,role:"replace"}}var O=null;function ve(e){let t=wb(e);return{blocked:t===null,confirmLabel:t?`Use ${t.name}`:e.images?"Use image":"Use file",headline:e.images?"Choose an image":"Choose media"}}function mS(){let e=O;if(O=null,e)X(e.mount),e.dialog.close()}function oP(e){mS();let t={filter:e.images?"image":"all",query:"",selected:null,sort:"newest"},i=Le("pick",t,`${ft("dialog",B)}/library`,null,e.images,XL(u.value?.documentPath??null)),a=(o)=>{mS(),e.onPick(o.ref)};i.onPick=a,S.add(i),we();let r=fe({body:(o)=>{i.handle=V(o,Z(i),ke(i),{clear:!1})},closed:()=>{if(O?.mount===i)mS();else X(i)},confirm:()=>{let o=wb(i);if(o)a(o)},layer:tt("dialog"),view:ve(i)});i.onSelect=()=>r.update(ve(i)),O={dialog:r,mount:i}}function IT(){mS();for(let e of M.keys())_w(e);y.filter="all",y.query="",y.selected=null,y.sort="newest",j=null,Q.clear(),J()}
|
|
2
|
-
export{pS,
|
|
1
|
+
import{ee}from"./studio-et6t8g4m.js";import{p}from"./studio-w67vfgy5.js";import{g,C}from"./studio-ahf3cspq.js";import{hh,Sr,E$}from"./studio-0hr000ba.js";import{Ot,Nt}from"./studio-f2j9et3h.js";import{Ue,xi,ft,T,R,Yt,tt}from"./studio-cvz0e00f.js";import{m,h,Jd}from"./studio-j933k8nr.js";import{Wd}from"./studio-pd9dsqpq.js";import{He}from"./studio-5dmgmyw4.js";import{Wc,_a,XL,uA,QL,Sa,pA,fA,jb,tr}from"./studio-20ap8dds.js";import{Ow,Gu}from"./studio-qyb5bebs.js";import{NT,Wu}from"./studio-pmzg17fj.js";import{Wt}from"./studio-5e7p1vgd.js";import{jT,HT,BT,zT,ym}from"./studio-5m0w815d.js";import{bp}from"./studio-76t560kn.js";import{Dd,Nd,qu,_p,Aw}from"./studio-vcz63n42.js";import{n,_}from"./studio-zsjpsw08.js";import{le}from"./studio-0g2sm01j.js";var D=[{key:"all",label:"All media"},{key:"image",label:"Images"},{key:"video",label:"Video"},{key:"audio",label:"Audio"},{key:"document",label:"Documents"},{key:"font",label:"Fonts"},{key:"unused",label:"Unused"}],pS=D.map((e)=>e.key);function re(e){return pS.some((t)=>t===e)}function L(e){return D.find((t)=>t.key===e)?.label??"All media"}var z=[{key:"newest",label:"Newest"},{key:"name",label:"Name"},{key:"size",label:"Size"}],Ce=z.map((e)=>e.key);function ne(e){return Ce.some((t)=>t===e)}function U(e,t,i){switch(t){case"all":return!0;case"unused":return i!==null&&i.has(e.file);default:return e.kind===t}}function W(e,t){let i=t.trim().toLowerCase();return i===""||e.name.toLowerCase().includes(i)}function q(e,t){return e.filter((a)=>U(a,t.filter,t.unused)&&W(a,t.query)).toSorted((a,r)=>De(t.sort,a,r)||a.file.localeCompare(r.file))}function De(e,t,i){switch(e){case"name":return t.name.localeCompare(i.name,void 0,{numeric:!0,sensitivity:"base"});case"size":return(i.bytes??-1)-(t.bytes??-1);default:return(i.modified??"").localeCompare(t.modified??"")}}function oe(e,t){let i={all:e.length,audio:0,document:0,font:0,image:0,unused:t===null?null:e.filter((a)=>t.has(a.file)).length,video:0};for(let a of e)i[a.kind]=(i[a.kind]??0)+1;return i}var Ee=132,ae=12;function se(e){return Math.max(1,Math.floor((e+ae)/(Ee+ae)))}function de(e,t,i,a,r=!1){if(a===0)return null;let o=Math.min(Math.max(e,0),a-1),l=o-o%i,c;switch(t){case"ArrowRight":{c=o+1;break}case"ArrowLeft":{c=o-1;break}case"ArrowDown":{c=o+i;break}case"ArrowUp":{c=o-i;break}case"Home":{c=r?0:l;break}case"End":{c=r?a-1:Math.min(l+i-1,a-1);break}default:return null}return c<0||c>=a?o:c}var pe={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaLibrary",$description:"The Media workspace's library (`specs/studio.md` §22.6): the project's media as filters, a grid and the selected file's detail. ONE document in two modes. In `manage` it is the Media home tab, with Replace, Open in viewer and Delete under the detail; in `pick` it is the full-size picker inside a `jx-dialog` (`media-pick-dialog.json`), and the dialog's own footer answers Cancel or Use <file>. `media/media-library.ts` keeps every decision (which files a filter keeps, the sort, what a count may claim, where an arrow lands, what Replace writes) and hands this document strings and discriminants. **Unused is drawn with no number until the usage sweep has settled**, and Missing alt text and tags are not drawn at all: each needs a store that does not exist, and a filter that cannot be answered is not shipped as one that always answers nothing.",tagName:"div",attributes:{part:"media-library","data-jx-region":"${state.region}","data-mode":"${state.mode}","data-drop":"${state.dropActive}"},style:{$description:"Three columns over the whole stage: the filters, the grid with its toolbar, and the selected file's detail. Fills the pane's stage by its own geometry, as the workspace home does: the stage is `position: relative` (`pane-grid.json`). In pick mode the same columns fill the dialog's body instead, so the root's box is the only thing that differs between the two modes.",position:"absolute",inset:"0",display:"grid",gridTemplateColumns:"200px minmax(0, 1fr) 300px",boxSizing:"border-box",fontFamily:"var(--jx-font-sans)",fontSize:"var(--jx-text-md)",color:"var(--fg)",background:"var(--bg)",'&[data-mode="pick"]':{$description:"Inside a dialog there is no stage to fill: the box is the dialog body's, at a height the dialog can scroll within.",position:"relative",inset:"auto",height:"min(70vh, 620px)",gridTemplateColumns:"150px minmax(0, 1fr) 210px"},'&[data-drop="true"]':{$description:"The drop affordance is a STATE the flow holds, not a class a handler adds and forgets to take off.",outline:"2px dashed var(--accent)",outlineOffset:"-4px"},'& [part="filters"]':{display:"flex",flexDirection:"column",gap:"2px",padding:"var(--jx-space-3) var(--jx-space-2)",borderRight:"1px solid var(--border)",background:"var(--bg-panel)",overflowY:"auto"},'& [part="filters-heading"]':{margin:"0",padding:"var(--jx-space-2) var(--jx-space-2) var(--jx-space-1)",fontSize:"var(--jx-text-xs)",fontWeight:"600",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--fg-dim)"},'& [part="filter"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",height:"30px",padding:"0 var(--jx-space-2)",border:"none",borderRadius:"var(--radius)",background:"none",color:"var(--fg)",font:"inherit",textAlign:"left",cursor:"pointer"},'& [part="filter"]:hover':{background:"var(--hover-bg)"},'& [part="filter"][aria-pressed="true"]':{background:"color-mix(in srgb, var(--accent) 16%, transparent)",color:"var(--fg)",fontWeight:"600"},'& [part="filter"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"-2px"},'& [part="filter-count"]':{marginLeft:"auto",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",fontWeight:"400"},'& [part="main"]':{display:"flex",flexDirection:"column",minWidth:"0",minHeight:"0"},'& [part="toolbar"]':{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"var(--jx-space-3)",padding:"var(--jx-space-3) var(--jx-space-4)",borderBottom:"1px solid var(--border)"},'& [part="title"]':{margin:"0 auto 0 0",fontSize:"var(--jx-text-lg)",fontWeight:"600"},'& [part="search"]':{width:"220px"},'& [part="sort"]':{width:"130px"},'& [part="upload"], & [part="empty-upload"]':{$description:"A LABEL around the file picker, not a button that clicks a hidden one: the picker is the control, so it takes focus, Enter opens it and a screen reader announces a file upload. A plain element because a label forwards a click to the input it contains and a custom element between the two would break that.",position:"relative",display:"inline-flex",alignItems:"center",gap:"6px",height:"28px",padding:"0 var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg-panel)",color:"var(--fg)",font:"inherit",cursor:"pointer",":hover":{background:"var(--hover-bg)"},":has(:focus-visible)":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}},'& [part="upload-input"], & [part="replace-input"]':{$description:"Out of the way but still FOCUSABLE: `display: none` would take the control out of the tab order, and the label around it draws the focus ring for it.",position:"absolute",width:"1px",height:"1px",opacity:"0",pointerEvents:"none"},'& [part="upload-glyph"]':{"--jx-icon-size":"16px"},'& [part="body"]':{flex:"1",minHeight:"0",overflowY:"auto",padding:"var(--jx-space-4)"},'& [part="grid"]':{$description:"auto-fill over a minimum tile width; `media/media-library-model.ts` `gridColumns` does the same arithmetic, so ArrowDown lands on the tile drawn under the current one. Keep the two numbers in step.",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(132px, 1fr))",gap:"12px",alignContent:"start"},'& [part="tile"]':{display:"flex",flexDirection:"column",gap:"4px",padding:"4px",borderRadius:"var(--jx-radius-md, 6px)",border:"2px solid transparent",cursor:"pointer",minWidth:"0",outline:"none"},'& [part="tile"]:hover':{background:"var(--hover-bg)"},'& [part="tile"][aria-selected="true"]':{borderColor:"var(--accent)"},'& [part="tile"]:focus-visible':{outline:"var(--jx-focus-ring)",outlineOffset:"2px"},'& [part="thumb"]':{display:"flex",alignItems:"center",justifyContent:"center",aspectRatio:"4 / 3",borderRadius:"var(--radius)",background:"var(--bg-input)",overflow:"hidden",color:"var(--fg-dim)","--jx-icon-size":"28px"},'& [part="thumb-img"]':{width:"100%",height:"100%",objectFit:"cover"},'& [part="tile-name"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-sm)"},'& [part="tile-caption"]':{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)",minHeight:"1em"},'& [part="empty"]':{display:"flex",flexDirection:"column",alignItems:"center",gap:"var(--jx-space-3)",padding:"48px var(--jx-space-6)",textAlign:"center",color:"var(--fg-dim)","--jx-icon-size":"40px"},'& [part="empty-title"]':{margin:"0",fontSize:"var(--jx-text-lg)",fontWeight:"600",color:"var(--fg)"},'& [part="empty-detail"]':{margin:"0",maxWidth:"42ch",lineHeight:"1.5"},'& [part="detail"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",padding:"var(--jx-space-4)",borderLeft:"1px solid var(--border)",background:"var(--bg-panel)",overflowY:"auto",minWidth:"0"},'& [part="detail-hint"]':{margin:"auto 0",textAlign:"center",color:"var(--fg-dim)"},'& [part="detail-preview"]':{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"140px",maxHeight:"220px",borderRadius:"var(--radius)",background:"var(--bg-input)",overflow:"hidden",color:"var(--fg-dim)","--jx-icon-size":"40px"},'& [part="preview-img"], & [part="preview-video"]':{maxWidth:"100%",maxHeight:"220px",objectFit:"contain"},'& [part="preview-audio"]':{width:"100%"},'& [part="preview-specimen"]':{$description:"The viewer's specimen at a side pane's size. The face arrives as the `@font-face` the flow writes under a family name generated from the path (`media/media-pane.ts` `specimenOf`); the element carries only that name, as a custom property, and the fallback stack is a rule, here.",display:"flex",flexDirection:"column",gap:"var(--jx-space-2)",padding:"var(--jx-space-4)",maxWidth:"100%",color:"var(--fg)",fontFamily:"var(--jx-specimen-family, system-ui), system-ui, sans-serif"},'& [part="specimen-line"]':{margin:"0",lineHeight:"1.3",overflowWrap:"anywhere"},'& [part="specimen-line"][data-size="32"]':{fontSize:"32px"},'& [part="specimen-line"][data-size="14"]':{fontSize:"var(--jx-text-md)"},'& [part="detail-name"]':{margin:"0",fontSize:"var(--jx-text-md)",fontWeight:"600",overflowWrap:"anywhere"},'& [part="facts"]':{margin:"0",color:"var(--fg-dim)",fontSize:"var(--jx-text-sm)"},'& [part="group-title"]':{margin:"0",fontSize:"var(--jx-text-xs)",fontWeight:"600",color:"var(--fg-dim)"},'& [part="url"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)",minWidth:"0"},'& [part="url-value"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--jx-font-mono)",fontSize:"var(--jx-text-sm)"},'& [part="usage"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)"},'& [part="usage-headline"]':{margin:"0",fontSize:"var(--jx-text-sm)"},'& [part="usage-list"]':{margin:"0",padding:"0",listStyle:"none",display:"flex",flexDirection:"column",gap:"2px"},'& [part="usage-row"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-2)"},'& [part="usage-link"]':{flex:"1",minWidth:"0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",border:"none",background:"none",padding:"0",color:"var(--accent)",font:"inherit",fontSize:"var(--jx-text-sm)",textAlign:"left",cursor:"pointer",":hover":{textDecoration:"underline"},":focus-visible":{outline:"var(--jx-focus-ring)"}},'& [part="usage-count"]':{fontSize:"var(--jx-text-xs)",color:"var(--fg-dim)"},'& [part="actions"]':{display:"flex",flexWrap:"wrap",gap:"var(--jx-space-2)",marginTop:"var(--jx-space-2)"},'& [part="replace"]':{position:"relative",display:"inline-flex",alignItems:"center",height:"28px",padding:"0 var(--jx-space-3)",border:"1px solid var(--border)",borderRadius:"var(--radius)",background:"var(--bg)",color:"var(--fg)",font:"inherit",cursor:"pointer",":hover":{background:"var(--hover-bg)"},":has(:focus-visible)":{outline:"var(--jx-focus-ring)",outlineOffset:"2px"}}},ondragover:{$prototype:"Function",body:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/dragOver"},value:[]}],description:"A file dropped ANYWHERE on the library uploads, to the destination the Upload label names before the drop: public/media/."},ondragleave:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dragOut"},value:[]}]},ondrop:{$prototype:"Function",body:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/drop"},value:[{$ref:"event#/dataTransfer/files"}]}]},children:[{tagName:"nav",attributes:{part:"filters","aria-label":"Media filters"},children:[{tagName:"h2",attributes:{part:"filters-heading"},textContent:"Library"},{$prototype:"Array",items:{$ref:"#/state/filters"},key:{$ref:"$map/item/key"},map:{tagName:"button",attributes:{part:"filter",type:"button","aria-pressed":"${$map.item.pressed}","data-filter":"${$map.item.key}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setFilter"},value:[{$ref:"$map/item/key"}]}]},children:[{tagName:"span",attributes:{part:"filter-label"},textContent:"${$map.item.label}"},{tagName:"span",attributes:{part:"filter-count"},textContent:"${$map.item.count}"}]}}]},{tagName:"section",attributes:{part:"main","aria-labelledby":"${state.titleId}"},children:[{tagName:"header",attributes:{part:"toolbar"},children:[{tagName:"h2",attributes:{part:"title",id:"${state.titleId}"},textContent:"${state.title}"},{tagName:"jx-textfield",attributes:{part:"search"},$props:{type:"search",size:"sm",label:"Search media",placeholder:"Search by name…",autocomplete:"off",value:{$ref:"#/state/query"}},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setQuery"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"jx-select",attributes:{part:"sort"},$props:{label:"Sort",size:"sm",options:{$ref:"#/state/sortOptions"},value:{$ref:"#/state/sort"}},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/setSort"},value:[{$ref:"event#/target/value"}]}]}},{tagName:"label",attributes:{part:"upload",title:"${state.uploadHint}"},children:[{tagName:"input",attributes:{part:"upload-input",type:"file",multiple:!0,accept:"${state.uploadAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[{$ref:"event#/target"}]}],description:"The picker itself, so the destination in the label's tooltip is visible BEFORE the files are chosen. The flow takes the element rather than the file list because a file input that is not cleared refuses the same file twice."}},{tagName:"jx-icon",attributes:{part:"upload-glyph","aria-hidden":"true"},$props:{name:"upload-simple"}},{tagName:"span",textContent:"Upload"}]}]},{tagName:"div",attributes:{part:"body"},children:[{tagName:"div",attributes:{part:"grid-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/gridState"},cases:{loading:{tagName:"p",attributes:{part:"empty",role:"status"},textContent:"Reading the project's media…"},counting:{tagName:"p",attributes:{part:"empty",role:"status"},textContent:"${state.countingLabel}"},empty:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"jx-icon",attributes:{part:"empty-glyph","aria-hidden":"true"},$props:{name:"image"}},{tagName:"p",attributes:{part:"empty-title"},textContent:"${state.emptyTitle}"},{tagName:"p",attributes:{part:"empty-detail"},textContent:"${state.emptyDetail}"},{tagName:"label",attributes:{part:"empty-upload",title:"${state.uploadHint}"},children:[{tagName:"input",attributes:{part:"upload-input",type:"file",multiple:!0,accept:"${state.uploadAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/upload"},value:[{$ref:"event#/target"}]}],description:"The picker itself, so the destination in the label's tooltip is visible BEFORE the files are chosen. The flow takes the element rather than the file list because a file input that is not cleared refuses the same file twice."}},{tagName:"jx-icon",attributes:{part:"upload-glyph","aria-hidden":"true"},$props:{name:"upload-simple"}},{tagName:"span",textContent:"Upload"}]}]},nomatch:{tagName:"div",attributes:{part:"empty"},children:[{tagName:"jx-icon",attributes:{part:"empty-glyph","aria-hidden":"true"},$props:{name:"image"}},{tagName:"p",attributes:{part:"empty-title"},textContent:"${state.emptyTitle}"},{tagName:"p",attributes:{part:"empty-detail"},textContent:"${state.emptyDetail}"},{tagName:"jx-button",attributes:{part:"reset"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/reset"},value:[]}]},children:[{tagName:"span",textContent:"Show all media"}]}]},listed:{tagName:"div",attributes:{part:"grid",role:"listbox","aria-labelledby":"${state.titleId}"},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"event#/key"},cases:{ArrowRight:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowLeft:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowDown:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],ArrowUp:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],Home:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],End:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/key"},value:[{$ref:"event#/key"},{$ref:"event#/ctrlKey"}]}],Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/activateSelected"},value:[]}]}}],description:"The grid pattern: arrows move one tile, Home and End to the ends of the row, Ctrl+Home and Ctrl+End to the ends of the grid, and Enter opens the selected file (in pick mode, uses it). The flow computes where the move lands; the tile that receives it takes focus, so the roving tabindex follows the selection."},children:[{$prototype:"Array",items:{$ref:"#/state/tiles"},key:{$ref:"$map/item/key"},map:{tagName:"div",attributes:{part:"tile",role:"option","aria-selected":"${$map.item.selected}",tabindex:"${$map.item.tabindex}","data-file":"${$map.item.file}",title:"${$map.item.name}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/select"},value:[{$ref:"$map/item/file"}]}]},onfocus:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/focusTile"},value:[{$ref:"$map/item/file"}]}],description:"Selection follows focus, the listbox pattern: a Tab onto the grid lands on the roving stop and selects it, so the first Enter opens (in pick mode, uses) the tile the focus ring is on rather than nothing."},ondblclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/activate"},value:[{$ref:"$map/item/file"}]}]},oncontextmenu:{$prototype:"Function",body:[{$switch:{$ref:"#/state/mode"},cases:{manage:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/contextMenu"},value:[{$ref:"$map/item/file"},{$ref:"event#/clientX"},{$ref:"event#/clientY"}]}]}}],description:"Manage mode only: the detail pane's actions at the pointer. Pick mode's dialog is modal, and a menu in the popover layer outside it would be inert, so its right-click is left to the platform."},children:[{tagName:"div",attributes:{part:"thumb"},children:[{tagName:"div",attributes:{part:"thumb-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"$map/item/thumbState"},cases:{image:{tagName:"img",attributes:{part:"thumb-img",src:"${$map.item.thumbSrc}",alt:"",draggable:"false"},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"$map/item/file"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}},pending:{tagName:"span",attributes:{part:"thumb-pending","aria-hidden":"true"}},glyph:{tagName:"jx-icon",attributes:{part:"thumb-glyph","aria-hidden":"true"},$props:{name:{$ref:"$map/item/glyph"}}}},$description:"The thumbnail is asked for when the tile scrolls into view, not when the grid is built: `pending` until the flow's observer reports the tile, then the picture. A file the browser draws no picture of shows its kind's glyph."}]},{tagName:"span",attributes:{part:"tile-name"},textContent:"${$map.item.name}"},{tagName:"span",attributes:{part:"tile-caption"},textContent:"${$map.item.caption}"}]}}]}}}]}]},{tagName:"aside",attributes:{part:"detail","aria-label":"Details"},children:[{tagName:"div",attributes:{part:"detail-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/detailState"},cases:{none:{tagName:"p",attributes:{part:"detail-hint"},textContent:"${state.detailHint}"},shown:{tagName:"div",attributes:{part:"detail-body",role:"none"},style:{display:"contents"},children:[{tagName:"div",attributes:{part:"detail-preview"},children:[{tagName:"div",attributes:{part:"preview-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/previewKind"},cases:{image:{tagName:"img",attributes:{part:"preview-img",src:"${state.previewSrc}",alt:""},onload:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/measure"},value:[{$ref:"#/state/selectedFile"},{$ref:"event#/target/naturalWidth"},{$ref:"event#/target/naturalHeight"}]}]}},video:{tagName:"video",attributes:{part:"preview-video",src:"${state.previewSrc}",controls:!0}},audio:{tagName:"audio",attributes:{part:"preview-audio",src:"${state.previewSrc}",controls:!0}},font:{tagName:"div",attributes:{part:"preview-specimen",style:"${state.previewSpecimenFamily}"},children:[{tagName:"style",textContent:"${state.previewFontFace}"},{tagName:"p",attributes:{part:"specimen-line","data-size":"32"},textContent:"Aa"},{tagName:"p",attributes:{part:"specimen-line","data-size":"14"},textContent:"${state.previewSpecimen}"}]},glyph:{tagName:"jx-icon",attributes:{part:"preview-glyph","aria-hidden":"true"},$props:{name:{$ref:"#/state/previewGlyph"}}}}}]},{tagName:"h3",attributes:{part:"detail-name"},textContent:"${state.detailName}"},{tagName:"p",attributes:{part:"facts"},textContent:"${state.detailFacts}"},{tagName:"div",attributes:{part:"url-group"},children:[{tagName:"h4",attributes:{part:"group-title"},textContent:"Site URL"},{tagName:"div",attributes:{part:"url"},children:[{tagName:"code",attributes:{part:"url-value"},textContent:"${state.detailRef}"},{tagName:"jx-action-button",attributes:{part:"copy"},$props:{size:"sm",quiet:!0,hint:"Copy the site URL"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/copyRef"},value:[]}]},children:[{tagName:"span",textContent:"Copy"}]}]}]},{tagName:"div",attributes:{part:"usage-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/usageState"},cases:{shown:{tagName:"div",attributes:{part:"usage"},children:[{tagName:"h4",attributes:{part:"group-title"},textContent:"Used on"},{tagName:"p",attributes:{part:"usage-headline"},textContent:"${state.usageHeadline}"},{tagName:"div",attributes:{part:"usage-list-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/hasUsageFiles"},cases:{true:{tagName:"ul",attributes:{part:"usage-list"},children:[{$prototype:"Array",items:{$ref:"#/state/usageFiles"},key:{$ref:"$map/item/path"},map:{tagName:"li",attributes:{part:"usage-row","data-usage":"${$map.item.path}"},children:[{tagName:"button",attributes:{part:"usage-link",type:"button",title:"Open ${$map.item.path}"},textContent:"${$map.item.path}",onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openDocument"},value:[{$ref:"$map/item/path"}]}]}},{tagName:"span",attributes:{part:"usage-count"},textContent:"${$map.item.count}"}]}}]}}}]}},$description:'Hidden on a host with no reference index, which is a different fact from "nothing uses it": a confident zero is the one answer this pane must never invent.'},{tagName:"div",attributes:{part:"actions-slot",role:"none"},style:{display:"contents"},$switch:{$ref:"#/state/mode"},cases:{manage:{tagName:"div",attributes:{part:"actions"},children:[{tagName:"label",attributes:{part:"replace",title:"Replace ${state.detailName} everywhere it is used"},children:[{tagName:"input",attributes:{part:"replace-input",type:"file",accept:"${state.replaceAccept}"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/replace"},value:[{$ref:"event#/target"}]}],description:"Replace writes the chosen file over this one's path, so every reference keeps resolving and now shows the new bytes (studio.md §9.3). The element rather than the list, so the input can be cleared."}},{tagName:"span",textContent:"Replace"}]},{tagName:"jx-button",attributes:{part:"open-viewer"},$props:{size:"sm",variant:"secondary"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/openViewer"},value:[]}]},children:[{tagName:"span",textContent:"Open in viewer"}]},{tagName:"jx-button",attributes:{part:"delete"},$props:{size:"sm",variant:"negative"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/remove"},value:[]}]},children:[{tagName:"span",textContent:"Delete"}]}]}},$description:"Manage mode's actions. Pick mode has none here: its answer is the dialog's own footer, Cancel and Use <file>."}]}}}]}]};T("media-library",pe);function Ie(){return{countingLabel:"",detailFacts:"",detailHint:"",detailName:"",detailRef:"",detailState:"none",dropActive:"false",emptyDetail:"",emptyTitle:"",filters:[],gridState:"loading",mode:"manage",previewFontFace:"",previewGlyph:"",previewKind:"glyph",previewSpecimen:"",previewSpecimenFamily:"",previewSrc:"",query:"",region:"",replaceAccept:"",selectedFile:"",sort:"",sortOptions:[],tiles:[],title:"",titleId:"",uploadAccept:"",uploadHint:"",usageFiles:[],usageHeadline:"",usageState:"hidden"}}function ce(e,t){Object.assign(e,t),e.hasUsageFiles=t.usageFiles.length>0}function Re(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function Pe(e){let t=e?.$map,i=_(t)&&"item"in t?t.item:void 0;return _(i)&&"file"in i&&n(i.file)?i.file:null}function V(e,t,i,a){if(a.clear)e.replaceChildren();let{tileHost:r,gridHost:o,inputHost:l,...c}=i,s=g({...Ie(),...c,hasUsageFiles:!1});ce(s,t);let f=null,w=!1,K=R("media-library",s,e,{onNodeCreated:(u,d,k,je)=>{if(w||!(u instanceof HTMLElement))return;let H=Re(k);if(H==="tile"){let ie=Pe(je);if(ie!==null)r(u,ie)}else if(H==="grid")o(u);else if(u instanceof HTMLInputElement&&H==="upload-input")l(u,"upload");else if(u instanceof HTMLInputElement&&H==="replace-input")l(u,"replace")}}).then((u)=>{if(w)u.dispose();else f=u;return u.root});return{attached:()=>{if(w)return!1;let u=f?.root;return u===void 0?!0:u instanceof HTMLElement&&e.contains(u)},dispose(){w=!0,f?.dispose(),f=null},ready:K,update:(u)=>ce(s,u)}}var ue={$schema:"https://jxsuite.com/schema/v1",$id:"StudioMediaPickDialog",$description:"The full-size media picker (`specs/studio.md` §9.3): a `jx-dialog` whose body is the Media workspace's own library surface in pick mode, so the picker and the workspace are one surface at two sizes. The dialog owns modality, Escape, the backdrop and focus restoration, and its footer is the answer: Cancel, or Use <file>, disabled until a file is chosen. The body is an ISLAND: this document draws the slot and nothing in it, and `surfaces/media-pick-dialog.ts` mounts `media-library.json` there through `onNodeCreated`.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/headline"},confirmLabel:{$ref:"#/state/confirmLabel"},confirmDisabled:{$ref:"#/state/blocked"},cancelLabel:"Cancel",dismissible:!0,size:"xl"},attributes:{part:"media-pick"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},children:[{tagName:"div",attributes:{part:"library-slot"},style:{$description:"The library's box in pick mode is its own (`media-library.json`, `data-mode=\"pick\"`); the slot only gives it the dialog body's width.",minWidth:"0"}}]};T("media-pick-dialog",ue);var B="media-picker";function Ke(e){let t=n(e)?void 0:e.attributes?.part;return n(t)?t:""}function fe(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(Ue,ft("dialog",B)),e.layer.append(t);let i=!1,a=()=>{if(i)return;i=!0,e.closed()},r=()=>i,o=g({...e.view,closed:a,confirm:e.confirm}),l=null,c=R("media-pick-dialog",o,t,{onNodeCreated:(s,f,w)=>{if(!r()&&s instanceof HTMLElement&&Ke(w)==="library-slot")e.body(s)}}).then(async(s)=>{l=s;let f=s.root;if(r())return s.dispose(),f;if(await Yt(f),!r())Ot(f);return f});return{close(){let s=l?.root;if(s instanceof HTMLElement)Nt(s);l?.dispose(),l=null,t.remove(),a()},host:t,ready:c,update(s){Object.assign(o,s)}}}var iP="media-home",be={audio:"play",document:"file-text",font:"text-aa",image:"image",video:"play"},ze={audio:"Audio",document:"Document",font:"Font",image:"Image",video:"Video"},y={filter:"all",query:"",sort:"newest",selected:null},j=null,x=null,I=0,P=0,A=!1,Y=0;function J(){x=null,A=!1,I=0,P=0,Y+=1}function _e(){return[...S].some((e)=>!e.disposed&&e.choice.filter==="unused")}async function We(e){if(A||x!==null||!hh())return;let t=Y;A=!0,I=0,P=e.length;let i=new Set;for(let a of e){let r=await Gu(a.file);if(t!==Y)return;if(!_e()){J();return}if(r.status==="ready"&&r.result.files.length===0)i.add(a.file);I+=1,b()}x=i,A=!1,b()}var S=new Set,M=new Map,Q=new Set,N=null;function we(){if(N!==null)return;let e=()=>{J(),b()},t=NT(e),i=E$(e);N=()=>{t(),i()}}function qe(){if(S.size===0&&N)N(),N=null}function v(e){if(!e.disposed){if(e.handle?.update(Z(e)),e.onSelect?.(),Ve(e),e.focusOwed)queueMicrotask(()=>Ne(e));xe(e)}}function Ve(e){let t=e.reveal,i=t===null?void 0:e.tiles.get(t);if(i?.isConnected)e.reveal=null,i.scrollIntoView({block:"nearest"})}function xe(e){if(e.sweepTimer!==null||e.disposed)return;e.sweepTimer=setTimeout(()=>{e.sweepTimer=null,e.observer.releaseDetached();for(let[t,i]of e.tiles)if(!i.isConnected)e.tiles.delete(t);for(let t of[e.inputs.upload,e.inputs.replace])for(let i of t)if(!i.isConnected)t.delete(i)},0)}function Me(e){return[...e].find((t)=>t.isConnected)??null}function b(){for(let e of S)v(e)}function X(e){if(e.disposed=!0,e.sweepTimer!==null)clearTimeout(e.sweepTimer),e.sweepTimer=null;e.inputs.upload.clear(),e.inputs.replace.clear(),e.observer.destroy(),e.handle?.dispose(),e.handle=null,e.tiles.clear(),S.delete(e),qe()}function $e(e){let t=Wu(),i=t===null?null:e.images?t.filter((r)=>r.isImage):t;return{files:(i??[]).map((r)=>{let o=Nd(r.file);return{bytes:o?.bytes??null,file:r.file,kind:r.kind,modified:o?.modified??null,name:r.name}}),listed:i}}function Be(e){return D.filter((t)=>(t.key!=="unused"||hh())&&(!e.images||t.key==="image"||t.key==="unused"))}function wb(e){let{filter:t,query:i,selected:a}=e.choice;if(a===null)return null;let r=Wu()?.find((l)=>l.file===a)??null;if(r===null||e.images&&!r.isImage)return null;let o={bytes:null,file:r.file,kind:r.kind,modified:null,name:r.name};return U(o,t,x)&&W(o,i)?r:null}function Ge(e,t){if(t===0)return{emptyDetail:`Upload files or drop them anywhere here. They are saved under ${e.uploadDir}/, and anything already under public/ or a collection's images/ folder is listed here too.`,emptyTitle:e.images?"No images yet":"No media yet"};let{filter:i,query:a}=e.choice;if(a.trim()!=="")return{emptyDetail:`Nothing in ${L(i)} matches it.`,emptyTitle:`No matches for “${a.trim()}”`};if(i==="unused")return{emptyDetail:"Every file is referenced by at least one document.",emptyTitle:"No unused media"};return{emptyDetail:`${t} ${t===1?"file":"files"} in the project, none of them ${L(i).toLowerCase()}.`,emptyTitle:`No ${L(i).toLowerCase()}`}}function Z(e){let{choice:t}=e,{files:i,listed:a}=$e(e),r=oe(i,x),o=Be(e);if(!o.some((d)=>d.key===t.filter))t.filter=o[0]?.key??"all";let l=q(i,{filter:t.filter,query:t.query,sort:t.sort,unused:x}),c=Wu();if(t.filter==="unused"&&c!==null)We(c);let s="listed";if(a===null)s="loading";else if(t.filter==="unused"&&x===null)s="counting";else if(i.length===0||l.length===0)s=i.length===0?"empty":"nomatch";let f=wb(e),w=l.some((d)=>d.file===t.selected)?t.selected:l[0]?.file??null,K=l.map((d)=>{let k=d.kind==="image";return{caption:Aw(Nd(d.file))||ze[d.kind],file:d.file,glyph:be[d.kind],key:d.file,name:d.name,selected:d.file===t.selected?"true":"false",tabindex:d.file===w?"0":"-1",thumbSrc:k&&e.visible.has(d.file)?tr(d.file):"",thumbState:k?e.visible.has(d.file)?"image":"pending":"glyph"}}),u=e.images&&t.filter==="image"?"Images":L(t.filter);return{countingLabel:P>0?`Counting references… ${I} of ${P}`:"Counting references…",dropActive:e.dropActive?"true":"false",filters:o.map((d)=>{let k=r[d.key];return{count:k===null?"":String(k),key:d.key,label:e.images&&d.key==="image"?"All images":d.label,pressed:d.key===t.filter?"true":"false"}}),gridState:s,mode:e.mode,query:t.query,region:e.region,sort:t.sort,sortOptions:z.map((d)=>({label:d.label,value:d.key})),tiles:K,title:u,titleId:`media-library-title-${e.region.replaceAll(/[^\w-]/g,"-")}`,uploadAccept:e.images?"image/*":Wc(),uploadHint:`Upload into ${e.uploadDir}/`,...Ge(e,i.length),...Ye(e,f)}}function Ye(e,t){if(t===null)return{detailFacts:"",detailHint:e.mode==="pick"?"Choose a file to use it.":"Select a file to see its details.",detailName:"",detailRef:"",detailState:"none",previewFontFace:"",previewGlyph:"",previewKind:"glyph",previewSpecimen:"",previewSpecimenFamily:"",previewSrc:"",replaceAccept:"",selectedFile:"",usageFiles:[],usageHeadline:"",usageState:"hidden"};let i=Nd(t.file),a=Ow(t.file);if(!Dd(t.file))qu(t.file).then(b);if(a===null||a.status==="pending")Gu(t.file).then(b);let r=jT(t.file),o=r==="image"||r==="video"||r==="audio"||r==="font"?r:"glyph",l=o==="font"?BT(t.file):{fontFace:"",specimen:"",specimenFamily:""};return{detailFacts:HT(t.file,i),detailHint:"",detailName:t.name,detailRef:t.ref,detailState:"shown",previewFontFace:l.fontFace,previewGlyph:be[t.kind],previewKind:o,previewSpecimen:l.specimen,previewSpecimenFamily:l.specimenFamily,previewSrc:o==="glyph"?"":tr(t.file),replaceAccept:pA(t.file),selectedFile:t.file,...zT(a)}}var me=null,ge=null;function Je(){return me??=(le("zbc8p6v1"),import("./files-zbc8p6v1.js")),me}function Qe(){return ge??=(le("13ab4swj"),import("./file-ops-13ab4swj.js")),ge}function te(e){try{e.showPicker()}catch{e.focus()}}function F(e,t){e.choice.selected=t,v(e)}async function he(e,t){let i=await Sa([...t],{dir:e.uploadDir,only:e.images?"image":"media"}),[a]=i;if(!a)return;if(e.choice.filter!=="all"&&e.choice.filter!==a.kind)e.choice.filter=e.images?"image":"all";e.choice.query="",e.reveal=a.path,F(e,a.path)}async function KD(e){let t=e.split("/").pop()??e,{confirmFileDelete:i}=await Qe();if(!await i({name:t,path:e}))return!1;let{markLocalMutation:a}=await (le("t6x0hch6"),import("./fs-events-t6x0hch6.js"));try{a(e),await p().deleteFile(e)}catch(l){return C.error(`Could not delete ${t}.`,{detail:ee(l),path:e,source:"Media"}),!1}if(Wd([e]),Sr(),m.tabs.has(e))Jd(e);for(let l of S)if(l.choice.selected===e)l.choice.selected=null;if(y.selected===e)y.selected=null;let r=jb(e),o=await Xe(r,a);return await QL(o?jb(r):r),C.success(`Deleted ${t}`),!0}async function Xe(e,t){if(!uA(e))return!1;let i=p();try{if((await i.listDirectory(e)).length>0)return!1;return t(e),await i.deleteFile(e),!0}catch{return!1}}function ke(e){return{activate:(t)=>{F(e,t),ye(e,t)},activateSelected:()=>{let{selected:t}=e.choice;if(t!==null)ye(e,t)},contextMenu:(t,i,a)=>Ze(e,t,i,a),copyRef:()=>{let t=wb(e);if(t)Se(t)},dragOut:()=>{if(e.dropActive)e.dropActive=!1,v(e)},dragOver:()=>{if(!e.dropActive)e.dropActive=!0,v(e)},drop:(t)=>{if(e.dropActive=!1,v(e),t?.length)he(e,t)},focusTile:(t)=>{if(e.choice.selected!==t)F(e,t)},gridHost:(t)=>{e.grid=t},inputHost:(t,i)=>{e.inputs[i].add(t),xe(e);let a=j;if(e.mode==="manage"&&a?.role===i&&(i==="upload"||a.file===e.choice.selected))j=null,te(t)},key:(t,i)=>et(e,t,i),measure:(t,i,a)=>{if(_p(t,i,a))b();else if(!Dd(t))qu(t).then(b)},openDocument:(t)=>{Je().then(({openFileInTab:i})=>i(t))},openViewer:()=>{let{selected:t}=e.choice;if(t!==null)ym(t)},remove:()=>{let{selected:t}=e.choice;if(t!==null)KD(t)},replace:(t)=>{let[i]=t.files??[];t.value="";let{selected:a}=e.choice;if(i&&a!==null)fA(a,i).then(b)},reset:()=>{e.choice.filter=e.images?"image":"all",e.choice.query="",v(e)},select:(t)=>F(e,t),setFilter:(t)=>{if(re(t))e.choice.filter=t,v(e)},setQuery:(t)=>{e.choice.query=t,v(e)},setSort:(t)=>{if(ne(t))e.choice.sort=t,v(e)},tileHost:(t,i)=>{e.tiles.set(i,t),Fe.set(t,i),e.observer.observe(t)},upload:(t)=>{let i=[...t.files??[]];if(t.value="",i.length>0)he(e,i)}}}function Se(e){if("clipboard"in navigator)navigator.clipboard.writeText(e.ref)}var E=null;function Ze(e,t,i,a){F(e,t);let r=wb(e);if(!r)return;E?.close();let o=(l,c,s,f={})=>({destructive:!1,disabled:!1,dividerAbove:!1,id:l,run:s,title:c,...f});E=Wt({label:`${r.name} actions`,onClosed:(l)=>{if(E===l)E=null},origin:{x:i,y:a},region:"media-tile",rows:[o("open","Open in Viewer",()=>ym(t)),o("copy-url","Copy Site URL",()=>Se(r)),o("replace","Replace…",()=>F2(t),{dividerAbove:!0}),o("delete","Delete",()=>{KD(t)},{destructive:!0,dividerAbove:!0})]})}function ye(e,t){if(e.mode==="pick"){let i=wb(e);if(i)e.onPick?.(i);return}ym(t)}function et(e,t,i){let{files:a}=$e(e),r=q(a,{filter:e.choice.filter,query:e.choice.query,sort:e.choice.sort,unused:x}),o=r.findIndex((f)=>f.file===e.choice.selected),l=e.grid?se(He(e.grid).width):1,c=o===-1?r.length>0?0:null:de(o,t,l,r.length,i),s=c===null?void 0:r[c];if(!s)return;F(e,s.file),e.tiles.get(s.file)?.focus()}var Fe=new WeakMap;function Le(e,t,i,a,r,o){let l={choice:t,disposed:!1,dropActive:!1,grid:null,handle:null,images:r,inputs:{replace:new Set,upload:new Set},mode:e,observer:bp((c)=>{let s=Fe.get(c);if(s!==void 0&&!l.visible.has(s))l.visible.add(s),it(l)}),onPick:null,onSelect:null,paneId:a,reveal:null,focusOwed:!1,region:i,sweepTimer:null,tiles:new Map,uploadDir:o,visible:new Set};return l}var G=new Set;function it(e){if(G.has(e))return;G.add(e),queueMicrotask(()=>{G.delete(e),v(e)})}function fS(e,t){let i=M.get(e);return i!==void 0&&i.tabId===t.id&&i.wrap.isConnected&&i.mount.handle!==null&&i.mount.handle.attached()}function _w(e){let t=M.get(e);if(!t)return;X(t.mount),M.delete(e)}function LT(e,t){let{paneId:i,wrap:a}=e;if(fS(i,t))return;_w(i);let r=Le("manage",y,xi(i,"media-library"),i,!1,_a);if(S.add(r),we(),r.handle=V(a,Z(r),ke(r),{clear:!0}),M.set(i,{mount:r,tabId:t.id,wrap:a}),Q.delete(i))Te(r)}async function Te(e){await e.handle?.ready,Ne(e,!0)}function Ne(e,t=e.focusOwed){if(!t||e.disposed)return;let{selected:i}=e.choice,a=(i===null?void 0:e.tiles.get(i))??[...e.tiles.values()].find((r)=>r.getAttribute("tabindex")==="0");if(a?.isConnected){e.focusOwed=!1,a.focus();return}e.focusOwed=!0}function $T(e){let t=M.get(e);if(t?.wrap.isConnected&&t.mount.handle?.attached()===!0){Te(t.mount);return}Q.add(e)}function P2(e){if(e.filter!==void 0)y.filter=e.filter;if(e.query!==void 0)y.query=e.query;if(e.select!==void 0){if(y.selected=e.select,y.filter!=="all")y.filter="all";y.query=""}b()}function oP(){let e=[...M.values()].map((t)=>Me(t.mount.inputs.upload)).find((t)=>t!==null)??null;if(e){te(e);return}j={file:null,role:"upload"}}function F2(e){P2({select:e});let t=null;for(let i of M.values())if(i.mount.choice.selected===e)t??=Me(i.mount.inputs.replace);if(t){te(t);return}j={file:e,role:"replace"}}var O=null;function ve(e){let t=wb(e);return{blocked:t===null,confirmLabel:t?`Use ${t.name}`:e.images?"Use image":"Use file",headline:e.images?"Choose an image":"Choose media"}}function mS(){let e=O;if(O=null,e)X(e.mount),e.dialog.close()}function rP(e){mS();let t={filter:e.images?"image":"all",query:"",selected:null,sort:"newest"},i=Le("pick",t,`${ft("dialog",B)}/library`,null,e.images,XL(h.value?.documentPath??null)),a=(o)=>{mS(),e.onPick(o.ref)};i.onPick=a,S.add(i),we();let r=fe({body:(o)=>{i.handle=V(o,Z(i),ke(i),{clear:!1})},closed:()=>{if(O?.mount===i)mS();else X(i)},confirm:()=>{let o=wb(i);if(o)a(o)},layer:tt("dialog"),view:ve(i)});i.onSelect=()=>r.update(ve(i)),O={dialog:r,mount:i}}function IT(){mS();for(let e of M.keys())_w(e);y.filter="all",y.query="",y.selected=null,y.sort="newest",j=null,Q.clear(),J()}
|
|
2
|
+
export{pS,iP,wb,KD,fS,_w,LT,$T,P2,oP,F2,mS,rP,IT};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=7977148675C8494C64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-cqf1k4qk.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{mt,io}from"./studio-ajw4k8hp.js";import{VA,fC,Ot,Nt,dh,YA,ae}from"./studio-cpkamjdn.js";import{ge,ne,g,Zd,C,Th}from"./studio-4kzbrr5t.js";import{te}from"./studio-psh8mwnw.js";import{n,Q}from"./studio-zkq3r91p.js";var Ue="data-jx-region",fe=["rail","navigator","inspector","pane","dock.bottom","statusbar","commandbar","overlay"],pe=new Set(["dock.bottom"]);function me(e){let t=e.indexOf("/"),o=t===-1?e:e.slice(0,t),r=t===-1?void 0:e.slice(t+1);if(r===""||o==="")return null;let s=o,i;if(!pe.has(o)){let c=o.indexOf(".");if(c!==-1){if(s=o.slice(0,c),i=o.slice(c+1),i==="")return null}}let l=fe.find((c)=>c===s);if(l===void 0)return null;return i===void 0?r===void 0?{surface:l}:{part:r,surface:l}:r===void 0?{instance:i,surface:l}:{instance:i,part:r,surface:l}}function ve(e){return me(e)!==null}function he(e){if(e==="pane")return"pane.primary";return e.startsWith("pane/")?`pane.primary/${e.slice(5)}`:e}function X(e){return e??document}var be=[{locate:([,e],t)=>{let r=Op(`inspector/field:${e}`,t)?.querySelector('[part="browse"]');return r?[r]:[]},pattern:/^inspector\/field:(.+)\/browse$/},{locate:([,e],t)=>{let o=Op("inspector",t);return o?[...o.querySelectorAll(`[data-prop="${CSS.escape(e)}"]`)]:[]},pattern:/^inspector\/field:(.+)$/}];function ye(e,t){let o=he(e);if(!ve(o))return[];let r=[...X(t).querySelectorAll(`[data-jx-region="${CSS.escape(o)}"]`)];if(r.length>0)return r;for(let s of be){let i=o.match(s.pattern);if(i)return s.locate(i,X(t))}return[]}function Op(e,t){return ye(e,t).at(-1)??null}var p$={dock:"dock.bottom",inspector:"inspector",navigator:"navigator",pane:"pane.primary",rail:"rail",status:"statusbar"};function wi(e,t){return t?`pane.${e}/${t}`:`pane.${e}`}function PA(e){return wi(e,"tabs")}function FA(e){return`navigator/panel:${e}`}function jA(e){return`inspector/tab:${e}`}var HA="navigator/statements";function BA(e){return`inspector/statements:${e}`}function mx(e){return`dock.bottom/panel:${e}`}var xe={dialog:"dialog",modal:"dialog",popover:"menu",toast:"toasts"};function ft(e,t){let o=xe[e];return t?`overlay.${o}:${t}`:`overlay.${o}`}var _=new Map,Z=1;function ee(e){let t=Z;return Z+=1,_.set(t,{...e,id:t}),t}function I(e){_.delete(e)}function oe(){return[..._.values()]}function OA(e){let t=e.toLowerCase();return oe().filter((o)=>o.elements.has(t))}function MA(e){return oe().filter((t)=>t.name===e)}var F=null;function h$(e=document){return F??=YA({document:e}),F}function re(){return F??h$()}var E="jx-studio:/surfaces/",M=new Map;function T(e,t){M.set(e,t),fC(Se(e),t)}function Se(e){return`${E}${e}.json`}function zA(e){return M.get(e)}function $e(e){if(!e.startsWith(E)||!e.endsWith(".json"))return;return M.get(e.slice(E.length,-5))}async function R(e,t,o,r={}){let s=M.get(e);if(!s)throw Error(`Studio surface "${e}" is not registered`);if(await re(),r.region)o.setAttribute(Ue,r.region);let i={scope:t,base:E,resolver:$e};if(r.onNodeCreated)i.onNodeCreated=r.onNodeCreated;if(r.onNodeMoved)i.onNodeMoved=r.onNodeMoved;if(r.signal)i.signal=r.signal;let l=await VA(s,o,i),c=(a)=>({dispose:a,elements:l.elements,root:l.root,scope:l.scope});if(r.signal?.aborted)return c(l.dispose);let d=0,p=()=>{l.dispose(),I(d)};return d=ee({elements:l.elements,host:o,name:e,remount:async()=>{p(),await R(e,t,o,r)}}),r.signal?.addEventListener("abort",()=>I(d),{once:!0}),c(p)}var ie={$schema:"https://jxsuite.com/schema/v1",$id:"StudioDialog",$description:"Studio's confirm, save-or-discard and prompt dialogs: one jx-dialog whose body is projected from the adapter's scope. `message` is a sentence; `choice` is a `jx-select` over the options; `field` is the prompt's jx-textfield with its refusal. The four answers call the host's functions, and the host decides when the dialog closes.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/headline"},confirmLabel:{$ref:"#/state/confirmLabel"},secondaryLabel:{$ref:"#/state/secondaryLabel"},cancelLabel:{$ref:"#/state/cancelLabel"},destructive:{$ref:"#/state/destructive"},size:{$ref:"#/state/size"}},attributes:{headline:"${state.headline}","confirm-label":"${state.confirmLabel || null}","secondary-label":"${state.secondaryLabel || null}","cancel-label":"${state.cancelLabel || null}",part:"dialog-host"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},onsecondary:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/secondary"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{'& [part="message"]':{$description:"The one part of a dialog that is text rather than interface, so it opts back in to selection. The root sets `user-select: none` and `styles/tokens.json` restates it on every `dialog`, so the headline, the labels and the buttons around this sentence stay unselectable; a message is often the thing a reader copies into a search or a bug report.",margin:"0 0 var(--jx-space-3)",userSelect:"text"},'& [part="message"]:last-child':{margin:"0"},'& [part="island"] > p, & [part="island"] > span, & [part="island"] > strong, & [part="island"] > em, & [part="island"] > code':{$description:"The island's own prose is the message's other form — a body richer than a sentence, written straight into the island from a lit template (studio-ui-guidelines.md §9.4) — so it is selectable for the same reason `[part=\"message\"]` is. The opt-in stops at those children because the island is ALSO the mount point for a whole document: the Open Grid picker and Push Schema's plan put their surfaces here, and `user-select` inherits, so a rule on the island itself would hand selection to every heading, source row and button they draw, which is the interface the policy exists to keep unselectable. A mounted surface roots a `div`; a message writes paragraphs and text-level spans, so the two forms are told apart by the child that arrives.",userSelect:"text"},'& [part="island"]:empty':{display:"none"},'& [part="message-slot"], & [part="choice-slot"], & [part="field-slot"]':{display:"contents"},'& [part="choice-row"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",margin:"0 0 var(--jx-space-3)"},'& [part="choice-label"]':{fontSize:"var(--jx-text-sm)",color:"var(--jx-fg-dim)"},"& jx-textfield":{width:"100%"}},children:[{tagName:"div",attributes:{part:"message-slot",role:"none"},$switch:{$ref:"#/state/hasMessage"},cases:{true:{tagName:"p",attributes:{part:"message"},textContent:"${state.message}"}}},{tagName:"div",attributes:{part:"island"}},{tagName:"div",attributes:{part:"choice-slot",role:"none"},$switch:{$ref:"#/state/hasChoice"},cases:{true:{tagName:"div",attributes:{part:"choice-row"},children:[{tagName:"span",attributes:{part:"choice-label"},textContent:"${state.choiceLabel}"},{tagName:"jx-select",$props:{label:{$ref:"#/state/choiceLabel"},options:{$ref:"#/state/options"},value:{$ref:"#/state/chosen"}},attributes:{part:"choice"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pick"},value:[{$ref:"event#/target/value"}]}]}}]}}},{tagName:"div",attributes:{part:"field-slot",role:"none"},$switch:{$ref:"#/state/hasField"},cases:{true:{tagName:"jx-textfield",$props:{label:{$ref:"#/state/headline"},value:{$ref:"#/state/value"},placeholder:{$ref:"#/state/placeholder"},invalid:{$ref:"#/state/invalid"},error:{$ref:"#/state/error"},multiline:{$ref:"#/state/multiline"},rows:{$ref:"#/state/rows"},mono:{$ref:"#/state/mono"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/input"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"#/state/singleLine"},cases:{true:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]}}]}}]},$description:"The prompt's one field. `multiline` is what makes it a paste box rather than a line: an import the author copied out of a `_redirects` file is column-aligned, so it also asks for `mono`. A multiline field takes Enter as a newline, which is why the Enter-confirms handler below is guarded on it — a paste box whose second line submits the dialog cannot be typed into."}}}]};T("dialog",ie);function Yt(e){if(e.querySelector('[part="dialog"]'))return Promise.resolve(e);return new Promise((t)=>{e.addEventListener("jx-ready",function o(r){if(r.target!==e&&!e.querySelector('[part="dialog"]'))return;e.removeEventListener("jx-ready",o),t(e)})})}function Ys(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(Ue,ft("dialog",e.region)),e.layer.append(t);let o=g({cancel:()=>{e.onCancel()},cancelLabel:e.cancelLabel,choiceLabel:e.choice?.label??"",chosen:e.choice?.chosen??"",closed:()=>{e.onClosed()},confirm:()=>{e.onConfirm()},confirmLabel:e.confirmLabel,destructive:e.destructive===!0,error:"",hasChoice:e.choice!==void 0,hasField:e.field!==void 0,mono:e.field?.mono===!0,multiline:e.field?.multiline===!0,rows:e.field?.rows??"3",singleLine:e.field!==void 0&&e.field.multiline!==!0?"true":"false",hasMessage:e.message!==void 0&&e.message!=="",headline:e.headline,input:(a)=>{o.value=a,e.onInput?.(a)},invalid:!1,message:e.message??"",options:e.choice?.options??[],pick:(a)=>{e.onPick?.(a)},placeholder:e.field?.placeholder??"",secondary:()=>{e.onSecondary?.()},secondaryLabel:e.secondaryLabel??"",size:e.size??"sm",value:e.field?.value??""}),r=null,s=!1,i=()=>s,l=()=>{},c=new Promise((a)=>{l=a}),p=R("dialog",o,t).then(async(a)=>{let u=a.root;if(i())return a.dispose(),u;if(r=a,await Promise.race([Yt(u),c]),i())return u;if(e.island?.(u.querySelector('[part="island"]')??u),Ot(u),e.field){let x=u.querySelector("jx-textfield");if(x)setTimeout(()=>{if(!s)dh(x,e.field?.select??"all")},0)}return u});return{close(){if(s)return;s=!0,l();let a=r?.root;if(a instanceof HTMLElement)Nt(a);r?.dispose(),r=null,t.remove()},host:t,ready:p,update(a){if(a.confirmLabel!==void 0)o.confirmLabel=a.confirmLabel;if(a.cancelLabel!==void 0)o.cancelLabel=a.cancelLabel;if(a.secondaryLabel!==void 0)o.secondaryLabel=a.secondaryLabel;if(a.message!==void 0)o.message=a.message,o.hasMessage=a.message!=="";if(a.value!==void 0)o.value=a.value;if(a.placeholder!==void 0)o.placeholder=a.placeholder;if(a.invalid!==void 0)o.invalid=a.invalid;if(a.error!==void 0)if(a.error!==""&&a.error===o.error){o.error="";let u=a.error;queueMicrotask(()=>{o.error=u})}else o.error=a.error;if(a.options!==void 0)o.options=a.options;if(a.chosen!==void 0)o.chosen=a.chosen}}}var se={$schema:"https://jxsuite.com/schema/v1",$id:"StudioToasts",$description:"The toast stack: a rendering of the notification service's toasts, newest last. Each row is projected by ui/layers.ts with its severity glyph and, where a recovery command exists, that command's title and gate; the two buttons call back into the host, which owns the records and their timers.",tagName:"div",attributes:{part:"stack"},style:{position:"absolute",right:"var(--jx-space-4)",bottom:"36px",display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",alignItems:"flex-end",maxWidth:"min(420px, calc(100vw - 24px))",'& [part="toast"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",pointerEvents:"auto",padding:"var(--jx-space-3)",border:"1px solid var(--jx-border)",borderLeft:"3px solid var(--jx-fg-dim)",borderRadius:"var(--jx-radius-md)",background:"var(--jx-bg-panel)",color:"var(--jx-fg)",fontSize:"var(--jx-text-sm)",lineHeight:"var(--jx-leading-sm)",boxShadow:"var(--jx-shadow-popover)"},'& [part="toast"][data-severity="success"]':{borderLeftColor:"var(--jx-success)"},'& [part="toast"][data-severity="info"]':{borderLeftColor:"var(--jx-accent)"},'& [part="toast"][data-severity="warn"]':{borderLeftColor:"var(--jx-warning)"},'& [part="toast"][data-severity="error"]':{borderLeftColor:"var(--jx-danger)"},'& [part="icon"]':{flex:"none",width:"14px",textAlign:"center",fontWeight:"700"},'& [data-severity="success"] [part="icon"]':{color:"var(--jx-success)"},'& [data-severity="info"] [part="icon"]':{color:"var(--jx-accent)"},'& [data-severity="warn"] [part="icon"]':{color:"var(--jx-warning)"},'& [data-severity="error"] [part="icon"]':{color:"var(--jx-danger)"},'& [part="message"]':{flex:"1",minWidth:"0",overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3"},'& [part="action-slot"]':{display:"contents"},'& [part="action"] > [part="control"]':{color:"var(--jx-accent)"}},children:[{$prototype:"Array",items:{$ref:"#/state/toasts"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"toast","data-severity":"${$map.item.severity}"},children:[{tagName:"span",attributes:{part:"icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"span",attributes:{part:"message"},textContent:"${$map.item.message}"},{tagName:"span",attributes:{part:"action-slot",role:"none"},$switch:{$ref:"$map/item/hasAction"},cases:{true:{tagName:"jx-button",$props:{size:"sm",quiet:!0,disabled:{$ref:"$map/item/actionDisabled"}},attributes:{part:"action",title:"${$map.item.actionTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runAction"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"${$map.item.actionLabel}"}]}}},{tagName:"jx-action-button",$props:{label:"Dismiss notification",hint:"Dismiss notification",icon:"x",size:"sm"},attributes:{part:"dismiss"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dismissToast"},value:[{$ref:"$map/item/id"}]}]}}]}}]};function Te(e){return e instanceof RangeError||e instanceof Error&&e.name==="CommandUnavailableError"}function En(e,t,o,r=t){let s=(l)=>{if(!Te(l))console.error(`${r}: command "${t}" failed`,l);C.error(te(l),{key:`command.run:${t}`,source:r})},i;try{i=e.run(t,o)}catch(l){return s(l),Promise.resolve()}return Promise.resolve(i).catch(s)}function rt(e,t,o){let r=ae();return r?En(r,e,t,o):Promise.resolve()}var de=null,z=null,J=null,j=null;function tt(e){return(e==="popover"?de:e==="modal"?z:e==="toast"?j:J)??document.body}function f$(){de=document.querySelector("#layer-popover"),z=document.querySelector("#layer-modal"),J=document.querySelector("#layer-dialog"),j=document.querySelector("#layer-toast"),Ne()}var le="jx-dialog[data-open], dialog[open]";function qb(){return Boolean(J?.querySelector(le)||z?.querySelector(le))}function m$(){return document.querySelector(":popover-open")!==null}function qo(e,t,o={}){let{confirmLabel:r="Confirm",cancelLabel:s="Cancel",destructive:i=!1}=o;return new Promise((l)=>{let c=!1,d=(a)=>{if(c)return;c=!0,p.close(),l(a)},p=Ys({cancelLabel:s,confirmLabel:r,destructive:i,headline:e,layer:tt("dialog"),...U(t),onCancel:()=>d(!1),onClosed:()=>d(!1),onConfirm:()=>d(!0)})})}function pC(e,t,o={}){let{saveLabel:r="Save",discardLabel:s="Discard",cancelLabel:i="Cancel"}=o;return new Promise((l)=>{let c=!1,d=(a)=>{if(c)return;c=!0,p.close(),l(a)},p=Ys({cancelLabel:i,confirmLabel:r,headline:e,layer:tt("dialog"),...U(t),onCancel:()=>d("cancel"),onClosed:()=>d("cancel"),onConfirm:()=>d("save"),onSecondary:()=>d("discard"),secondaryLabel:s})})}function U(e){if(n(e))return{message:e};return{island:(t)=>{io(e,t)}}}function xi(e,t={}){let{cancelLabel:o="Cancel",choice:r,confirmLabel:s="OK",message:i,mono:l=!1,multiline:c=!1,placeholder:d="",rows:p="3",select:a="all",size:u,validate:x,value:ue=""}=t,P=(v)=>x?x(v,L):v.trim()?"":"Enter a value.",h=ue,L=r?.initial??"",m="",V=!1,W=()=>Q(d)?d():d,K=()=>r?r.options().map((v)=>({label:v.label,value:v.value})):[];return new Promise((v)=>{let B=!1,D=(f)=>{if(B)return;B=!0,k.close(),v(f)},Y=(f)=>{m=f,k.update({error:m,invalid:m!==""})},S={cancelLabel:o,confirmLabel:s,headline:e,layer:tt("dialog"),onCancel:()=>D(null),onClosed:()=>D(null),onConfirm:()=>{let f=P(h);if(f){Y(f);return}D(h.trim())},onInput:(f)=>{V=!0,h=f;let w=P(h);if(w!==m)Y(w)},onPick:(f)=>{L=f,r?.onChange?.(f);let w=P(h);m=V||m?w:"",k.update({chosen:L,error:m,invalid:m!=="",options:K(),placeholder:W()})}};if(i!==void 0)Object.assign(S,U(i));if(r)S.choice={chosen:L,label:r.label,options:K()};if(S.field={mono:l,multiline:c,placeholder:W(),rows:p,select:a,value:h},u!==void 0)S.size=u;let k=Ys(S)})}var N=new Map;function Zs(e,t){let o=`${e}:${t}`,r=N.get(o);if(r&&r.parentElement)return r;return r=document.createElement("div"),r.style.pointerEvents="auto",r.setAttribute(Ue,ft(e,t)),tt(e).append(r),N.set(o,r),r}function Gb(e,t){let o=`${e}:${t}`,r=N.get(o);if(r)io(mt,r),r.remove(),N.delete(o)}var we=180,Ee={error:"✕",info:"ℹ",success:"✓",warn:"!"},A=null,y=new Map,b=new Set;function Me(){if(!("matchMedia"in globalThis))return!1;return globalThis.matchMedia("(prefers-reduced-motion: reduce)").matches===!0}function Oe(){try{return new URLSearchParams(globalThis.location.search).get("automation")==="1"}catch{return!1}}function g$(){return[...b].map((e)=>`overlay: toast ${e} settling in`)}function q(e){let t=y.get(e);if(t!==void 0)clearTimeout(t),y.delete(e);b.delete(e),Th(e)}function Ce(e){if(y.has(e.id)||b.has(e.id))return;let t=Me()?0:we;if(t>0)b.add(e.id),setTimeout(()=>b.delete(e.id),t);let o=e.timeoutMs??0;if(o<=0||Oe())return;y.set(e.id,setTimeout(()=>q(e.id),o))}T("toasts",se);var G=null,H=null,O=null;function ce(){return G??=g({dismissToast:(e)=>{q(e)},runAction:(e)=>{let t=Zd.find((r)=>r.id===e),o=ae();if(!t?.action||!o)return;q(e),En(o,t.action,t.actionArgs,"Notifications")},toasts:[]}),G}function je(e){let t=e.action===void 0?null:ae(),o=e.action,r=t&&o!==void 0?t.get(o):void 0,s=r&&o!==void 0&&t.isVisible(o)?r:null,i=s&&o!==void 0?t.disabledReason(o):void 0;return{actionDisabled:i!==void 0,actionLabel:s?.title??"",actionTitle:s===null?"":i===void 0?s.title:`${s.title} — requires ${i}`,hasAction:s!==null,icon:Ee[e.severity],id:e.id,message:e.message,severity:e.severity}}function Ne(){if(Ae(),!j)return;A=ge(),A.run(()=>{ne(()=>{Zd.length,ae();for(let e of Zd)Ce(e);ce().toasts=Zd.map((e)=>je(e))})}),H=R("toasts",ce(),j),H.then((e)=>{O=e})}function Ae(){A?.stop(),A=null;for(let t of y.values())clearTimeout(t);y.clear(),b.clear();let e=H;if(H=null,O)O.dispose(),O=null;else if(e)e.then((t)=>t.dispose());G=null}
|
|
2
|
-
export{
|
|
1
|
+
import{mt,io}from"./studio-x2metr13.js";import{UA,fC,Ot,Nt,dh,ZA,ae}from"./studio-f2j9et3h.js";import{ge,ne,g,Xd,C,Th}from"./studio-ahf3cspq.js";import{ee}from"./studio-et6t8g4m.js";import{n,Q}from"./studio-zsjpsw08.js";var Ue="data-jx-region",fe=["rail","navigator","inspector","pane","dock.bottom","statusbar","commandbar","overlay"],pe=new Set(["dock.bottom"]);function me(e){let t=e.indexOf("/"),o=t===-1?e:e.slice(0,t),r=t===-1?void 0:e.slice(t+1);if(r===""||o==="")return null;let s=o,i;if(!pe.has(o)){let c=o.indexOf(".");if(c!==-1){if(s=o.slice(0,c),i=o.slice(c+1),i==="")return null}}let l=fe.find((c)=>c===s);if(l===void 0)return null;return i===void 0?r===void 0?{surface:l}:{part:r,surface:l}:r===void 0?{instance:i,surface:l}:{instance:i,part:r,surface:l}}function ve(e){return me(e)!==null}function he(e){if(e==="pane")return"pane.primary";return e.startsWith("pane/")?`pane.primary/${e.slice(5)}`:e}function X(e){return e??document}var be=[{locate:([,e],t)=>{let r=Op(`inspector/field:${e}`,t)?.querySelector('[part="browse"]');return r?[r]:[]},pattern:/^inspector\/field:(.+)\/browse$/},{locate:([,e],t)=>{let o=Op("inspector",t);return o?[...o.querySelectorAll(`[data-prop="${CSS.escape(e)}"]`)]:[]},pattern:/^inspector\/field:(.+)$/}];function ye(e,t){let o=he(e);if(!ve(o))return[];let r=[...X(t).querySelectorAll(`[data-jx-region="${CSS.escape(o)}"]`)];if(r.length>0)return r;for(let s of be){let i=o.match(s.pattern);if(i)return s.locate(i,X(t))}return[]}function Op(e,t){return ye(e,t).at(-1)??null}var p$={dock:"dock.bottom",inspector:"inspector",navigator:"navigator",pane:"pane.primary",rail:"rail",status:"statusbar"};function xi(e,t){return t?`pane.${e}/${t}`:`pane.${e}`}function FA(e){return xi(e,"tabs")}function jA(e){return`navigator/panel:${e}`}function HA(e){return`inspector/tab:${e}`}var BA="navigator/statements";function zA(e){return`inspector/statements:${e}`}function mx(e){return`dock.bottom/panel:${e}`}var xe={dialog:"dialog",modal:"dialog",popover:"menu",toast:"toasts"};function ft(e,t){let o=xe[e];return t?`overlay.${o}:${t}`:`overlay.${o}`}var _=new Map,Z=1;function te(e){let t=Z;return Z+=1,_.set(t,{...e,id:t}),t}function I(e){_.delete(e)}function oe(){return[..._.values()]}function MA(e){let t=e.toLowerCase();return oe().filter((o)=>o.elements.has(t))}function PA(e){return oe().filter((t)=>t.name===e)}var F=null;function h$(e=document){return F??=ZA({document:e}),F}function re(){return F??h$()}var E="jx-studio:/surfaces/",M=new Map;function T(e,t){M.set(e,t),fC(Se(e),t)}function Se(e){return`${E}${e}.json`}function WA(e){return M.get(e)}function $e(e){if(!e.startsWith(E)||!e.endsWith(".json"))return;return M.get(e.slice(E.length,-5))}async function R(e,t,o,r={}){let s=M.get(e);if(!s)throw Error(`Studio surface "${e}" is not registered`);if(await re(),r.region)o.setAttribute(Ue,r.region);let i={scope:t,base:E,resolver:$e};if(r.onNodeCreated)i.onNodeCreated=r.onNodeCreated;if(r.onNodeMoved)i.onNodeMoved=r.onNodeMoved;if(r.signal)i.signal=r.signal;let l=await UA(s,o,i),c=(a)=>({dispose:a,elements:l.elements,root:l.root,scope:l.scope});if(r.signal?.aborted)return c(l.dispose);let d=0,p=()=>{l.dispose(),I(d)};return d=te({elements:l.elements,host:o,name:e,remount:async()=>{p(),await R(e,t,o,r)}}),r.signal?.addEventListener("abort",()=>I(d),{once:!0}),c(p)}var ie={$schema:"https://jxsuite.com/schema/v1",$id:"StudioDialog",$description:"Studio's confirm, save-or-discard and prompt dialogs: one jx-dialog whose body is projected from the adapter's scope. `message` is a sentence; `choice` is a `jx-select` over the options; `field` is the prompt's jx-textfield with its refusal. The four answers call the host's functions, and the host decides when the dialog closes.",tagName:"jx-dialog",$props:{headline:{$ref:"#/state/headline"},confirmLabel:{$ref:"#/state/confirmLabel"},secondaryLabel:{$ref:"#/state/secondaryLabel"},cancelLabel:{$ref:"#/state/cancelLabel"},destructive:{$ref:"#/state/destructive"},size:{$ref:"#/state/size"}},attributes:{headline:"${state.headline}","confirm-label":"${state.confirmLabel || null}","secondary-label":"${state.secondaryLabel || null}","cancel-label":"${state.cancelLabel || null}",part:"dialog-host"},onconfirm:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]},onsecondary:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/secondary"},value:[]}]},oncancel:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/cancel"},value:[]}]},onclose:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/closed"},value:[]}]},style:{'& [part="message"]':{$description:"The one part of a dialog that is text rather than interface, so it opts back in to selection. The root sets `user-select: none` and `styles/tokens.json` restates it on every `dialog`, so the headline, the labels and the buttons around this sentence stay unselectable; a message is often the thing a reader copies into a search or a bug report.",margin:"0 0 var(--jx-space-3)",userSelect:"text"},'& [part="message"]:last-child':{margin:"0"},'& [part="island"] > p, & [part="island"] > span, & [part="island"] > strong, & [part="island"] > em, & [part="island"] > code':{$description:"The island's own prose is the message's other form — a body richer than a sentence, written straight into the island from a lit template (studio-ui-guidelines.md §9.4) — so it is selectable for the same reason `[part=\"message\"]` is. The opt-in stops at those children because the island is ALSO the mount point for a whole document: the Open Grid picker and Push Schema's plan put their surfaces here, and `user-select` inherits, so a rule on the island itself would hand selection to every heading, source row and button they draw, which is the interface the policy exists to keep unselectable. A mounted surface roots a `div`; a message writes paragraphs and text-level spans, so the two forms are told apart by the child that arrives.",userSelect:"text"},'& [part="island"]:empty':{display:"none"},'& [part="message-slot"], & [part="choice-slot"], & [part="field-slot"]':{display:"contents"},'& [part="choice-row"]':{display:"flex",flexDirection:"column",gap:"var(--jx-space-1)",margin:"0 0 var(--jx-space-3)"},'& [part="choice-label"]':{fontSize:"var(--jx-text-sm)",color:"var(--jx-fg-dim)"},"& jx-textfield":{width:"100%"}},children:[{tagName:"div",attributes:{part:"message-slot",role:"none"},$switch:{$ref:"#/state/hasMessage"},cases:{true:{tagName:"p",attributes:{part:"message"},textContent:"${state.message}"}}},{tagName:"div",attributes:{part:"island"}},{tagName:"div",attributes:{part:"choice-slot",role:"none"},$switch:{$ref:"#/state/hasChoice"},cases:{true:{tagName:"div",attributes:{part:"choice-row"},children:[{tagName:"span",attributes:{part:"choice-label"},textContent:"${state.choiceLabel}"},{tagName:"jx-select",$props:{label:{$ref:"#/state/choiceLabel"},options:{$ref:"#/state/options"},value:{$ref:"#/state/chosen"}},attributes:{part:"choice"},onchange:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/pick"},value:[{$ref:"event#/target/value"}]}]}}]}}},{tagName:"div",attributes:{part:"field-slot",role:"none"},$switch:{$ref:"#/state/hasField"},cases:{true:{tagName:"jx-textfield",$props:{label:{$ref:"#/state/headline"},value:{$ref:"#/state/value"},placeholder:{$ref:"#/state/placeholder"},invalid:{$ref:"#/state/invalid"},error:{$ref:"#/state/error"},multiline:{$ref:"#/state/multiline"},rows:{$ref:"#/state/rows"},mono:{$ref:"#/state/mono"}},attributes:{part:"field"},oninput:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/input"},value:[{$ref:"event#/target/value"}]}]},onkeydown:{$prototype:"Function",body:[{$switch:{$ref:"#/state/singleLine"},cases:{true:[{$switch:{$ref:"event#/key"},cases:{Enter:[{preventDefault:!0},{operator:"call",target:{$ref:"#/state/confirm"},value:[]}]}}]}}]},$description:"The prompt's one field. `multiline` is what makes it a paste box rather than a line: an import the author copied out of a `_redirects` file is column-aligned, so it also asks for `mono`. A multiline field takes Enter as a newline, which is why the Enter-confirms handler below is guarded on it — a paste box whose second line submits the dialog cannot be typed into."}}}]};T("dialog",ie);function Yt(e){if(e.querySelector('[part="dialog"]'))return Promise.resolve(e);return new Promise((t)=>{e.addEventListener("jx-ready",function o(r){if(r.target!==e&&!e.querySelector('[part="dialog"]'))return;e.removeEventListener("jx-ready",o),t(e)})})}function Zs(e){let t=document.createElement("div");t.style.pointerEvents="auto",t.setAttribute(Ue,ft("dialog",e.region)),e.layer.append(t);let o=g({cancel:()=>{e.onCancel()},cancelLabel:e.cancelLabel,choiceLabel:e.choice?.label??"",chosen:e.choice?.chosen??"",closed:()=>{e.onClosed()},confirm:()=>{e.onConfirm()},confirmLabel:e.confirmLabel,destructive:e.destructive===!0,error:"",hasChoice:e.choice!==void 0,hasField:e.field!==void 0,mono:e.field?.mono===!0,multiline:e.field?.multiline===!0,rows:e.field?.rows??"3",singleLine:e.field!==void 0&&e.field.multiline!==!0?"true":"false",hasMessage:e.message!==void 0&&e.message!=="",headline:e.headline,input:(a)=>{o.value=a,e.onInput?.(a)},invalid:!1,message:e.message??"",options:e.choice?.options??[],pick:(a)=>{e.onPick?.(a)},placeholder:e.field?.placeholder??"",secondary:()=>{e.onSecondary?.()},secondaryLabel:e.secondaryLabel??"",size:e.size??"sm",value:e.field?.value??""}),r=null,s=!1,i=()=>s,l=()=>{},c=new Promise((a)=>{l=a}),p=R("dialog",o,t).then(async(a)=>{let u=a.root;if(i())return a.dispose(),u;if(r=a,await Promise.race([Yt(u),c]),i())return u;if(e.island?.(u.querySelector('[part="island"]')??u),Ot(u),e.field){let x=u.querySelector("jx-textfield");if(x)setTimeout(()=>{if(!s)dh(x,e.field?.select??"all")},0)}return u});return{close(){if(s)return;s=!0,l();let a=r?.root;if(a instanceof HTMLElement)Nt(a);r?.dispose(),r=null,t.remove()},host:t,ready:p,update(a){if(a.confirmLabel!==void 0)o.confirmLabel=a.confirmLabel;if(a.cancelLabel!==void 0)o.cancelLabel=a.cancelLabel;if(a.secondaryLabel!==void 0)o.secondaryLabel=a.secondaryLabel;if(a.message!==void 0)o.message=a.message,o.hasMessage=a.message!=="";if(a.value!==void 0)o.value=a.value;if(a.placeholder!==void 0)o.placeholder=a.placeholder;if(a.invalid!==void 0)o.invalid=a.invalid;if(a.error!==void 0)if(a.error!==""&&a.error===o.error){o.error="";let u=a.error;queueMicrotask(()=>{o.error=u})}else o.error=a.error;if(a.options!==void 0)o.options=a.options;if(a.chosen!==void 0)o.chosen=a.chosen}}}var se={$schema:"https://jxsuite.com/schema/v1",$id:"StudioToasts",$description:"The toast stack: a rendering of the notification service's toasts, newest last. Each row is projected by ui/layers.ts with its severity glyph and, where a recovery command exists, that command's title and gate; the two buttons call back into the host, which owns the records and their timers.",tagName:"div",attributes:{part:"stack"},style:{position:"absolute",right:"var(--jx-space-4)",bottom:"36px",display:"flex",flexDirection:"column",gap:"var(--jx-space-3)",alignItems:"flex-end",maxWidth:"min(420px, calc(100vw - 24px))",'& [part="toast"]':{display:"flex",alignItems:"center",gap:"var(--jx-space-3)",pointerEvents:"auto",padding:"var(--jx-space-3)",border:"1px solid var(--jx-border)",borderLeft:"3px solid var(--jx-fg-dim)",borderRadius:"var(--jx-radius-md)",background:"var(--jx-bg-panel)",color:"var(--jx-fg)",fontSize:"var(--jx-text-sm)",lineHeight:"var(--jx-leading-sm)",boxShadow:"var(--jx-shadow-popover)"},'& [part="toast"][data-severity="success"]':{borderLeftColor:"var(--jx-success)"},'& [part="toast"][data-severity="info"]':{borderLeftColor:"var(--jx-accent)"},'& [part="toast"][data-severity="warn"]':{borderLeftColor:"var(--jx-warning)"},'& [part="toast"][data-severity="error"]':{borderLeftColor:"var(--jx-danger)"},'& [part="icon"]':{flex:"none",width:"14px",textAlign:"center",fontWeight:"700"},'& [data-severity="success"] [part="icon"]':{color:"var(--jx-success)"},'& [data-severity="info"] [part="icon"]':{color:"var(--jx-accent)"},'& [data-severity="warn"] [part="icon"]':{color:"var(--jx-warning)"},'& [data-severity="error"] [part="icon"]':{color:"var(--jx-danger)"},'& [part="message"]':{flex:"1",minWidth:"0",overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"3"},'& [part="action-slot"]':{display:"contents"},'& [part="action"] > [part="control"]':{color:"var(--jx-accent)"}},children:[{$prototype:"Array",items:{$ref:"#/state/toasts"},key:{$ref:"$map/item/id"},map:{tagName:"div",attributes:{part:"toast","data-severity":"${$map.item.severity}"},children:[{tagName:"span",attributes:{part:"icon","aria-hidden":"true"},textContent:"${$map.item.icon}"},{tagName:"span",attributes:{part:"message"},textContent:"${$map.item.message}"},{tagName:"span",attributes:{part:"action-slot",role:"none"},$switch:{$ref:"$map/item/hasAction"},cases:{true:{tagName:"jx-button",$props:{size:"sm",quiet:!0,disabled:{$ref:"$map/item/actionDisabled"}},attributes:{part:"action",title:"${$map.item.actionTitle}"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/runAction"},value:[{$ref:"$map/item/id"}]}]},children:[{tagName:"span",textContent:"${$map.item.actionLabel}"}]}}},{tagName:"jx-action-button",$props:{label:"Dismiss notification",hint:"Dismiss notification",icon:"x",size:"sm"},attributes:{part:"dismiss"},onclick:{$prototype:"Function",body:[{operator:"call",target:{$ref:"#/state/dismissToast"},value:[{$ref:"$map/item/id"}]}]}}]}}]};function Te(e){return e instanceof RangeError||e instanceof Error&&e.name==="CommandUnavailableError"}function En(e,t,o,r=t){let s=(l)=>{if(!Te(l))console.error(`${r}: command "${t}" failed`,l);C.error(ee(l),{key:`command.run:${t}`,source:r})},i;try{i=e.run(t,o)}catch(l){return s(l),Promise.resolve()}return Promise.resolve(i).catch(s)}function rt(e,t,o){let r=ae();return r?En(r,e,t,o):Promise.resolve()}var de=null,z=null,J=null,j=null;function tt(e){return(e==="popover"?de:e==="modal"?z:e==="toast"?j:J)??document.body}function f$(){de=document.querySelector("#layer-popover"),z=document.querySelector("#layer-modal"),J=document.querySelector("#layer-dialog"),j=document.querySelector("#layer-toast"),Ne()}var le="jx-dialog[data-open], dialog[open]";function qb(){return Boolean(J?.querySelector(le)||z?.querySelector(le))}function m$(){return document.querySelector(":popover-open")!==null}function qo(e,t,o={}){let{confirmLabel:r="Confirm",cancelLabel:s="Cancel",destructive:i=!1}=o;return new Promise((l)=>{let c=!1,d=(a)=>{if(c)return;c=!0,p.close(),l(a)},p=Zs({cancelLabel:s,confirmLabel:r,destructive:i,headline:e,layer:tt("dialog"),...U(t),onCancel:()=>d(!1),onClosed:()=>d(!1),onConfirm:()=>d(!0)})})}function pC(e,t,o={}){let{saveLabel:r="Save",discardLabel:s="Discard",cancelLabel:i="Cancel"}=o;return new Promise((l)=>{let c=!1,d=(a)=>{if(c)return;c=!0,p.close(),l(a)},p=Zs({cancelLabel:i,confirmLabel:r,headline:e,layer:tt("dialog"),...U(t),onCancel:()=>d("cancel"),onClosed:()=>d("cancel"),onConfirm:()=>d("save"),onSecondary:()=>d("discard"),secondaryLabel:s})})}function U(e){if(n(e))return{message:e};return{island:(t)=>{io(e,t)}}}function Qn(e,t={}){let{cancelLabel:o="Cancel",choice:r,confirmLabel:s="OK",message:i,mono:l=!1,multiline:c=!1,placeholder:d="",rows:p="3",select:a="all",size:u,validate:x,value:ue=""}=t,P=(v)=>x?x(v,L):v.trim()?"":"Enter a value.",h=ue,L=r?.initial??"",m="",V=!1,W=()=>Q(d)?d():d,K=()=>r?r.options().map((v)=>({label:v.label,value:v.value})):[];return new Promise((v)=>{let B=!1,D=(f)=>{if(B)return;B=!0,k.close(),v(f)},Y=(f)=>{m=f,k.update({error:m,invalid:m!==""})},S={cancelLabel:o,confirmLabel:s,headline:e,layer:tt("dialog"),onCancel:()=>D(null),onClosed:()=>D(null),onConfirm:()=>{let f=P(h);if(f){Y(f);return}D(h.trim())},onInput:(f)=>{V=!0,h=f;let w=P(h);if(w!==m)Y(w)},onPick:(f)=>{L=f,r?.onChange?.(f);let w=P(h);m=V||m?w:"",k.update({chosen:L,error:m,invalid:m!=="",options:K(),placeholder:W()})}};if(i!==void 0)Object.assign(S,U(i));if(r)S.choice={chosen:L,label:r.label,options:K()};if(S.field={mono:l,multiline:c,placeholder:W(),rows:p,select:a,value:h},u!==void 0)S.size=u;let k=Zs(S)})}var N=new Map;function Xs(e,t){let o=`${e}:${t}`,r=N.get(o);if(r&&r.parentElement)return r;return r=document.createElement("div"),r.style.pointerEvents="auto",r.setAttribute(Ue,ft(e,t)),tt(e).append(r),N.set(o,r),r}function Gb(e,t){let o=`${e}:${t}`,r=N.get(o);if(r)io(mt,r),r.remove(),N.delete(o)}var we=180,Ee={error:"✕",info:"ℹ",success:"✓",warn:"!"},A=null,y=new Map,b=new Set;function Me(){if(!("matchMedia"in globalThis))return!1;return globalThis.matchMedia("(prefers-reduced-motion: reduce)").matches===!0}function Oe(){try{return new URLSearchParams(globalThis.location.search).get("automation")==="1"}catch{return!1}}function g$(){return[...b].map((e)=>`overlay: toast ${e} settling in`)}function q(e){let t=y.get(e);if(t!==void 0)clearTimeout(t),y.delete(e);b.delete(e),Th(e)}function Ce(e){if(y.has(e.id)||b.has(e.id))return;let t=Me()?0:we;if(t>0)b.add(e.id),setTimeout(()=>b.delete(e.id),t);let o=e.timeoutMs??0;if(o<=0||Oe())return;y.set(e.id,setTimeout(()=>q(e.id),o))}T("toasts",se);var G=null,H=null,O=null;function ce(){return G??=g({dismissToast:(e)=>{q(e)},runAction:(e)=>{let t=Xd.find((r)=>r.id===e),o=ae();if(!t?.action||!o)return;q(e),En(o,t.action,t.actionArgs,"Notifications")},toasts:[]}),G}function je(e){let t=e.action===void 0?null:ae(),o=e.action,r=t&&o!==void 0?t.get(o):void 0,s=r&&o!==void 0&&t.isVisible(o)?r:null,i=s&&o!==void 0?t.disabledReason(o):void 0;return{actionDisabled:i!==void 0,actionLabel:s?.title??"",actionTitle:s===null?"":i===void 0?s.title:`${s.title} — requires ${i}`,hasAction:s!==null,icon:Ee[e.severity],id:e.id,message:e.message,severity:e.severity}}function Ne(){if(Ae(),!j)return;A=ge(),A.run(()=>{ne(()=>{Xd.length,ae();for(let e of Xd)Ce(e);ce().toasts=Xd.map((e)=>je(e))})}),H=R("toasts",ce(),j),H.then((e)=>{O=e})}function Ae(){A?.stop(),A=null;for(let t of y.values())clearTimeout(t);y.clear(),b.clear();let e=H;if(H=null,O)O.dispose(),O=null;else if(e)e.then((t)=>t.dispose());G=null}
|
|
2
|
+
export{MA,PA,h$,Ue,Op,p$,xi,FA,jA,HA,BA,zA,mx,ft,T,WA,R,Yt,Zs,En,rt,tt,f$,qb,m$,qo,pC,Qn,Xs,Gb,g$};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=8298734C6849741564756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-cvz0e00f.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ee}from"./studio-et6t8g4m.js";import{p}from"./studio-w67vfgy5.js";import{ge,ne,Kr,Jr,g,de,rM,C}from"./studio-ahf3cspq.js";import{Pn,yx,ln,go,vC,xx,iv,I$,an,lv,Fm,Hi,Vn,Ce,hi,To,Y,pi,zm,m,kr,Ql,jt}from"./studio-j933k8nr.js";import{nf}from"./studio-848rk4p1.js";import{pt,Uo,xr}from"./studio-xebavr9s.js";import{S,Qc,wn}from"./studio-rt498t2v.js";import{n,Z,Ze,Iv,Q,_,v}from"./studio-zsjpsw08.js";import{le}from"./studio-0g2sm01j.js";function F(e){return e.replaceAll("~","~0").replaceAll("/","~1")}var Ue=100;function H(e){let t={blankAfter:new Set,escaped:new Map,inline:new Map},o=0,r=()=>{let l=0;while(o<e.length&&(e[o]===" "||e[o]==="\t"||e[o]==="\r"||e[o]===`
|
|
2
2
|
`)){if(e[o]===`
|
|
3
|
-
`)l+=1;o+=1}return l},s=()=>{let l=o,
|
|
4
|
-
`.includes(e[o]))o+=1};return a(""),t}function
|
|
5
|
-
${s.has(
|
|
6
|
-
`:""}`).join(""),
|
|
7
|
-
${" ".repeat(
|
|
8
|
-
${Xe(c,w,o,(A)=>s.has(`${
|
|
9
|
-
${
|
|
10
|
-
${
|
|
11
|
-
`}function Xe(e,t,o,r){let s=[],i="";for(let[a,l]of e.entries()){let
|
|
12
|
-
`)}function km(e){return Co(e,ye())}var k=null,j=null,N=null,I=null;function ye(){return we()?.doc.layout??I}var G=null;function we(){let e=m.tabs.get(an);return e?de(e):null}function Qe(){if(j)Fm(j),j=null;k=null,N=null,I=null,G=null}function ve(){return G??=(async()=>{try{let e=await p().readFile(an),{document:t,layout:o}=ks(e);I=o,N=Co(t,ye())}catch{N=null}})(),G}async function jL(e){if(await ve(),e.doc.layout===null&&I!==null)e.doc.layout=I}function et(e){let t=wn();if(t.projectConfig===e)return;Xc({...t,projectConfig:e}),Ql(m.projectRoot,e)}function tt(){let e=S?.projectConfig;return e?de(e):null}function K(e){return de(e)}function xe(e,t){for(let o of Object.keys(e))delete e[o];Object.assign(e,t)}function he(e){return k=e,e.scope.run(()=>{ne(()=>{let t=e.doc.document;if(k!==e||!S)return;et(K(t))})}),e}function XS(){let e=wn(),t=we();if(k&&(k!==(t??j)||de(k.doc.document)!==e.projectConfig))Qe();if(k)return k;if(t)return he(t);return j=lv({document:e.projectConfig??{},documentPath:an,id:an}),he(j)}function Se(e){return JSON.stringify(e.extensions??null)}async function ot(){let{loadFormats:e,refreshExtensionUi:t,refreshFormats:o}=await (le("zfjz4rzm"),import("./format-host-zfjz4rzm.js"));o(),e(),t(p())}async function Gl(e){let t=tt(),o=XS();await jL(o);let r=K(o.doc.document),s=km(r),i=t&&t!==r&&km(t)!==s?t:null;if(i&&o.doc.dirty){let b=Error(`${an} has unsaved changes in its editor tab`);return C.error(`Could not save ${an} — the file is open with unsaved changes. Save or `+"revert that tab, then make the settings change again.",{key:`save:${an}`,path:an,source:"Settings"}),{error:b,ok:!1}}let a=i??r,l=e?{...a,...e}:a,u=km(l);if(!i&&!o.doc.dirty&&u===N)return{ok:!0};let d=Se(r);Y(o,(b)=>{let y=b.doc.document;if(i)xe(y,i);for(let[x,P]of Object.entries(e??{}))y[x]=P});let c=K(o.doc.document),f=km(c);try{await p().writeFile(an,f)}catch(b){return C.error(`Could not save ${an} — ${te(b)}`,{key:`save:${an}`,path:an,source:"Settings"}),{error:b,ok:!1}}if(N=f,o.doc.dirty=!1,Se(c)!==d)await ot();return{ok:!0}}async function ZN(e,t){if(!S){Ql(m.projectRoot,e);return}let o=XS();Y(o,(r)=>xe(r.doc.document,e),{skipHistory:!0}),o.doc.dirty=!1,await ve(),I=H(t),o.doc.layout=I,N=km(e)}function to(e){let t=S?.projectConfig?.$media;if(!t)return e||{};if(!e)return{...t};return{...t,...e}}function wr(e){let t=S?.projectConfig?.style;if(!t)return e||{};if(!e)return{...t};let o={...t};for(let[r,s]of Object.entries(e)){let i=o[r];o[r]=_(s)&&_(i)?{...i,...s}:s}return o}function XN(e,t=[]){return{...HL(t),...S?.projectConfig?.imports,...e}}function HL(e){let t=e.flatMap((o)=>(o.classes??[]).filter((r)=>r.path.endsWith(".class.json")).map((r)=>[r.name,r.path]));return Object.fromEntries(t.toReversed())}function Xw(e){let t=S?.projectConfig?.$elements;if(!t?.length)return e||[];if(!e?.length)return[...t];let o=new Set,r=[];for(let s of[...t,...e]){let i=n(s)?s:_(s)?s.$ref:void 0;if(i&&!o.has(i))o.add(i),r.push(s)}return r}function Qw(e){let t=S?.projectConfig?.$head;if(!t?.length)return e||[];if(!e?.length)return[...t];let o=new Set,r=[];for(let s of[...t,...e]){let i=_(s)?s.attributes:void 0,a=String(i?.href||i?.src||"")||JSON.stringify(s);if(!o.has(a))o.add(a),r.push(s)}return r}function Es(){let e=S?.projectConfig;return e?ln(e).i18n:null}function Ip(e,t){let o=Es();if(o===null)return null;let r=Pn(e);if(r!==null&&o.locales.includes(r))return r;return go(t??"",o)??o.defaultLocale}var q=new Map;function QN(){q.clear()}function il(e){if(e===!1)return null;let t=S?.projectConfig?.defaults?.layout;return e||t||null}async function ex(e){let t=e.replace(/^\.\//,""),o=q.get(t);if(o!==void 0)return structuredClone(o);try{let s=await p().readFile(t),i=JSON.parse(s);return q.set(t,i),structuredClone(i)}catch{return null}}function BL(e,t){let o=t.children??[],r=Array.isArray(o)?o:[],s=new Map,i=[];for(let a of r){let l=n(a)?void 0:a.attributes?.slot;if(!n(a)&&n(l)&&l){if(!s.has(l))s.set(l,[]);s.get(l).push(a)}else i.push(a)}if(Pe(e,s,i),t.state)e.state={...e.state,...t.state};if(t.$media)e.$media={...e.$media,...t.$media};if(t.style)e.style={...e.style,...t.style};if(t.attributes)e.attributes={...e.attributes,...t.attributes};return e}function Pe(e,t,o){if(!Array.isArray(e.children))return;let r=[];for(let s of e.children)if(_(s)&&s.tagName==="slot"){let i=s.attributes?.name;if(n(i)&&i&&t.has(i))r.push(...t.get(i)),t.delete(i);else if(!i&&o.length>0)r.push(...o);else if(Array.isArray(s.children))r.push(...s.children)}else{if(_(s))Pe(s,t,o);r.push(s)}e.children=r}async function no(e){let t=await Gl(e);if(!t.ok)throw t.error}var Te=new Set([hi,zm]),nt=new Set(["auto","light","dark"]);function rt(e){return n(e)&&nt.has(e)}function it(e){let{ui:t}=e.session;return{activeMedia:t.activeMedia,canvasMode:t.canvasMode,editZoom:t.editZoom,preview:t.preview,previewColorScheme:t.previewColorScheme,previewLocale:t.previewLocale,showLayout:t.showLayout,zoom:t.zoom}}function ke(){let e={},t=[];for(let o of m.panes){if(o.derived)continue;let r=[];for(let i of o.tabOrder){let a=m.tabs.get(i);if(!a?.documentPath)continue;r.push(a.documentPath),e[a.documentPath]=it(a)}if(r.length===0)continue;let s=o.activeTabId?m.tabs.get(o.activeTabId):null;t.push({activeFile:s?.documentPath??null,files:r,id:o.id})}return{focusedPane:m.activePaneId,panes:t,ui:e}}function st(e){if(!v(e))return{};let t={};if(n(e.canvasMode))t.canvasMode=e.canvasMode;if(Ze(e.preview))t.preview=e.preview;if(Z(e.zoom)&&Number.isFinite(e.zoom))t.zoom=e.zoom;if(Z(e.editZoom)&&Number.isFinite(e.editZoom))t.editZoom=e.editZoom;if(e.activeMedia===null||n(e.activeMedia))t.activeMedia=e.activeMedia;if(rt(e.previewColorScheme))t.previewColorScheme=e.previewColorScheme;if(e.previewLocale===null||n(e.previewLocale)&&yx(e.previewLocale))t.previewLocale=e.previewLocale;if(Ze(e.showLayout))t.showLayout=e.showLayout;return t}function Ie(e){if(!v(e)||!Array.isArray(e.panes))return null;let t=[];for(let r of e.panes){if(!v(r)||!n(r.id)||!Te.has(r.id))continue;let s=Array.isArray(r.files)?r.files.filter((i)=>n(i)&&i!==""):[];if(s.length===0)continue;t.push({activeFile:n(r.activeFile)&&s.includes(r.activeFile)?r.activeFile:null,files:s,id:r.id})}if(t.length===0)return null;let o={};if(_(e.ui))for(let[r,s]of Object.entries(e.ui))o[r]=st(s);return{focusedPane:n(e.focusedPane)&&Te.has(e.focusedPane)?e.focusedPane:hi,panes:t,ui:o}}async function eA(e,t){let o=0;if(e.panes.some((i)=>i.id===zm))t.ensureSecondPane();for(let i of e.panes)for(let a of i.files){try{await t.openFile(a,i.id)}catch{}if([...m.tabs.values()].some((l)=>l.documentPath===a))o+=1}if(o===0)return 0;for(let i of m.tabs.values()){let a=i.documentPath?e.ui[i.documentPath]:void 0;if(!a)continue;let{ui:l}=i.session;if(a.canvasMode&&i.capabilities.modes.includes(a.canvasMode))l.canvasMode=a.canvasMode;if(a.preview!==void 0)l.preview=a.preview;if(a.zoom!==void 0)l.zoom=a.zoom;if(a.editZoom!==void 0)l.editZoom=a.editZoom;if(a.activeMedia!==void 0)l.activeMedia=a.activeMedia;if(a.previewColorScheme!==void 0)l.previewColorScheme=a.previewColorScheme;if(a.previewLocale!==void 0)l.previewLocale=a.previewLocale;if(a.showLayout!==void 0)l.showLayout=a.showLayout}let r=m.panes.some((i)=>i.id===e.focusedPane)?e.focusedPane:null,s=null;for(let i of e.panes){let a=m.panes.find((u)=>u.id===i.id);if(!a||!i.activeFile)continue;let l=a.tabOrder.find((u)=>m.tabs.get(u)?.documentPath===i.activeFile);if(!l)continue;if(a.id===r)s=l;else jt(l,{focus:!1})}if(s)jt(s);else if(r)kr(r);return o}var Em=["review","deploys","branches","hosting"],QS={branches:"Branches",deploys:"Deploys",hosting:"Hosting",review:"Review changes"},at=["live","review"],_e="review",Ee="live",lt=new Set(Em),ct=new Set(at);function tA(e){return typeof e==="string"&<.has(e)}function tx(e){return typeof e==="string"&&ct.has(e)}var ut={default:{description:"Resume whatever was persisted — layout, recents, settings, chat history.",id:"default",reset:"none"},fresh:{description:"A first-run app: no layout, no recents, no settings, no history.",id:"fresh",reset:"app-state"}},Ae=new Map(Object.entries(ut)),ft="default",dt=/^jx[-._:]/;function mt(e){return dt.test(e)}function gt(){let e=typeof localStorage>"u"?void 0:localStorage;if(!e)return[];let t=[];try{for(let o=0;o<e.length;o++){let r=e.key(o);if(r&&mt(r))t.push(r)}for(let o of t)e.removeItem(o)}catch{}return t}function bt(e){let t=Ae.get(e);if(!t)throw RangeError(`unknown startup profile "${e}"; declared: ${[...Ae.keys()].join(", ")}`);if(t.reset==="app-state")gt();return t}var B=null;function je(e){if(B)return B;let t=new URLSearchParams(e??(typeof location>"u"?"":location.search)),o=bt(t.get("profile")??ft),r=t.get("clock");return B={clock:r===null?null:oM(r),profile:o},B}var W=["site","collections","styles","files","search","i18n","layers","data","packages","insert"],ht=new Set(["collections","styles"]);function Oe(e){return e&&!ht.has(e)?e:yt}var St=new Map([["blocks","insert"],["head","site"],["page","site"],["imports","packages"],["git","site"],["state","data"]]),yt="site";function eC(e,t){let o=W.find((r)=>r===e);if(o===void 0)throw Error(`${t}: "${e}" is not a declared Navigator panel id.`);return o}function se(e){if(!n(e))return null;let t=St.get(e);if(t)return t;return W.find((o)=>o===e)??null}var oe=["page","properties","style","events","assistant"],nx="page",wt=["properties","style","events"],tC="properties";function ix(e){return typeof e==="string"&&wt.some((t)=>t===e)}function zL(e){return typeof e==="string"&&oe.some((t)=>t===e)}var ox=["problems","logic","activity"],WL="problems";function VL(e){return typeof e==="string"&&ox.some((t)=>t===e)}var rx=["light","dark"],Hc={content:{id:"content",inspector:{open:!1,whileWriting:!0},navigator:{open:!0,panel:"collections"},rail:!1,tabStrip:!0},design:{id:"design",inspector:{open:!0},navigator:{initial:"site",open:!0},rail:!0,tabStrip:!0},media:{id:"media",inspector:{open:!1},navigator:{open:!1},rail:!1,tabStrip:!1},publish:{id:"publish",inspector:{open:!1},navigator:{open:!1},rail:!1,tabStrip:!1},styles:{id:"styles",inspector:{open:!1,tab:"style",whileWriting:!0},navigator:{open:!0,panel:"styles"},rail:!1,tabStrip:!1}},De="jx-studio-panel-widths",Le="jx-studio-project::",vt="dark";function UL(e){return typeof e==="string"&&rx.some((t)=>t===e)}function xt(){let e=Uo(pt.theme);return UL(e)?e:vt}var sx=["left","right","bottom"],D={bottom:{collapsed:!0,size:220},left:{collapsed:!1,size:240},right:{collapsed:!1,size:280}},nA={bottom:D.bottom.size,left:D.left.size,right:D.right.size},Pt={bottom:"--dock-h-bottom",left:"--panel-w-left",right:"--panel-w-right"},Tt={bottom:"bottom-collapsed",left:"left-collapsed",right:"right-collapsed"},qL=0.5,nC=0.2,iC=0.8;function kt(e){return Z(e)&&e>=nC&&e<=iC?e:qL}function iA(e){h.paneSplit=Math.min(iC,Math.max(nC,e))}function It(){try{let e=JSON.parse(localStorage.getItem(De)||"{}");return v(e)?e:{}}catch{return{}}}function _t(e){return{left:e("left"),right:e("right"),bottom:e("bottom")}}function Re(){return{branches:null,commitMessage:"",diffState:null,error:null,lastUpdated:null,loading:!1,logEntries:null,rev:0,status:null}}function $e(){return{build:{for:"",state:"idle",text:""},deploys:{error:"",project:"",rows:[],state:"idle"},destination:Ee,review:{number:0,url:""},tab:_e}}var Et="tokens";function Je(){return{customizedOnly:!1,filter:"",selection:null,variable:null,view:Et}}function Ct(){let e=It(),t=_t((o)=>{let r=e[o],s=e[`${o}Collapsed`];return{collapsed:Ze(s)?s:D[o].collapsed,size:Z(r)&&r>0?r:D[o].size}});return{bottomTab:VL(e.bottomTab)?e.bottomTab:WL,docks:t,focusRegion:"pane",paneSplit:kt(e.paneSplit),git:Re(),publish:$e(),layoutSelection:null,leftTab:Oe(se(e.leftTab)),stylebook:Je(),theme:xt(),workspace:xx}}je();var At=["jx-studio-doc-header-expanded"];function Nt(){try{for(let e of At)localStorage.removeItem(e)}catch{}}Nt();var h=g(Ct());function Ad(){try{localStorage.setItem(De,JSON.stringify({bottom:h.docks.bottom.size,bottomCollapsed:h.docks.bottom.collapsed,bottomTab:h.bottomTab,left:h.docks.left.size,leftCollapsed:h.docks.left.collapsed,leftTab:h.leftTab,paneSplit:h.paneSplit,right:h.docks.right.size,rightCollapsed:h.docks.right.collapsed}))}catch{}}var re,ae={};function ce(e){if(!e)return{};try{let t=JSON.parse(localStorage.getItem(`${Le}${e}`)||"{}");return v(t)?t:{}}catch{return{}}}function GL(e){let t=ce(e).workspace;return I$(t)?t:xx}function oA(e){return Ie(ce(e).session)}var ue=null;function ax(e){ue=e}function rA(){fe()}function fe(){let e=m.projectRoot;if(!e)return;try{localStorage.setItem(`${Le}${e}`,JSON.stringify({session:e===ue?ke():ce(e).session,workspace:h.workspace}))}catch{}}function Ot(e){if(e===re)return;if(re=e,ae={},h.workspace=GL(e),e===null){h.leftTab=Oe(se(h.leftTab));return}Kr();try{Me(h.workspace),Ad()}finally{Jr()}}function KL(e,t){let{inspector:o}=Hc[e];return o.open||o.whileWriting===!0&&t}function Me(e,t){let o=Hc[e],r=se(o.navigator.panel??ae[e]??o.navigator.initial??h.leftTab);if(r)h.leftTab=r;if(h.docks.left.collapsed=!o.navigator.open,h.docks.right.collapsed=!KL(e,t?.writingOnCanvas?.()===!0),o.inspector.tab&&t)t.setInspectorTab(o.inspector.tab)}function oC(e,t){if(h.workspace===e)return!1;if(!Hc[h.workspace].navigator.panel)ae[h.workspace]=h.leftTab;return h.workspace=e,Me(e,t),Ad(),fe(),!0}function Tm(e=h.theme){return e==="light"?"vs":"vs-dark"}function Dt(){document.documentElement.dataset.theme=h.theme,nf()?.editor.setTheme(Tm())}var Lt="rail-hidden",Rt="tabs-hidden";function Pb(e=h.workspace){return Hc[e].tabStrip}function $t(){let e=document.documentElement;for(let o of sx)e.style.setProperty(Pt[o],`${h.docks[o].size}px`);let t=document.querySelector("#app");if(!t)return;for(let o of sx)t.classList.toggle(Tt[o],h.docks[o].collapsed);t.classList.toggle(Lt,!Hc[h.workspace].rail),t.classList.toggle(Rt,!Hc[h.workspace].tabStrip)}var X=null,ie=[];function Fb(e){if(!ie.includes(e))ie.push(e)}function sA(){if(X)return;for(let e of ie)e.mount();X=ge(),X.run(()=>{ne(()=>{$t()}),ne(()=>{Dt()}),ne(()=>{Ot(m.projectRoot)}),ne(()=>{let e=m.projectRoot;m.activePaneId;for(let t of m.panes)t.id,t.activeTabId,t.tabOrder.join("\x00");if(e)fe()})})}function ko(e,t){if(h.docks[e].collapsed===t){Ad();return}h.docks[e].collapsed=t,Ad()}function Jt(e){ko(e,!h.docks[e].collapsed)}function aA(e,t){h.docks[e].size=t}function Bc(e){h.leftTab=e,ko("left",!1),Ad()}function oh(e){h.bottomTab=e,ko("bottom",!1),Ad()}function JL(e){if(h.theme===e)return;h.theme=e,xr(pt.theme,e)}function lA(e){if(e===h.leftTab&&!h.docks.left.collapsed){ko("left",!0);return}Bc(e)}function YL(e){h.layoutSelection=e}function lx(){Object.assign(h.git,Re()),Object.assign(h.publish,$e()),Object.assign(h.stylebook,Je()),h.layoutSelection=null,ue=null,re=void 0}function Ne(e,t){if(t.showWorkspace){t.showWorkspace(e);return}oC(e,t)}var ee=(e)=>e.project.open;function Mt(e){return[{args:Ce({tab:ui(W,"Which Navigator panel to show.")}),category:"View",id:"view.setActivity",level:"application",menus:["commandbar/overflow","palette"],group:"4_docks",requires:"an open project",when:ee,run:(t,o)=>{let r=Vn("view.setActivity",o,"tab",W);if(e.panelAvailable&&!e.panelAvailable(r))throw RangeError(`command "view.setActivity" argument "tab": "${r}" names a panel that is registered but not available right now, so showing it would persist a Navigator tab nothing can draw`);Bc(r)},title:"Show Navigator Panel"},{args:Ce({tab:ui(oe,"Which Inspector tab to show.")}),category:"View",id:"view.setRightTab",level:"document",menus:["palette"],group:"4_docks",requires:"an open document",when:(t)=>t.document.open,run:(t,o)=>{e.setInspectorTab(Vn("view.setRightTab",o,"tab",oe))},title:"Show Inspector Tab"},{args:Ce({open:To("True to show the Navigator dock, false to collapse it.")}),category:"View",id:"view.setNavigator",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{ko("left",!Hi("view.setNavigator",o,"open"))},title:"Show Navigator Dock"},{args:Ce({open:To("True to show the Inspector dock, false to collapse it.")}),category:"View",id:"view.setRightPanel",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{ko("right",!Hi("view.setRightPanel",o,"open"))},title:"Show Inspector Dock"},{args:Ce({open:To("True to show the Bottom dock, false to collapse it.")}),category:"View",id:"view.setBottomDock",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{ko("bottom",!Hi("view.setBottomDock",o,"open"))},title:"Show Bottom Dock"},{category:"View",id:"view.toggleBottomDock",keybinding:"mod+j",level:"application",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>{Jt("bottom")},title:"Toggle Bottom Dock"},{args:Ce({tab:ui(ox,"Which Bottom dock tab to show.")}),category:"View",id:"view.setBottomTab",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{let r=Vn("view.setBottomTab",o,"tab",ox);if(e.panelAvailable&&!e.panelAvailable(r))throw RangeError(`command "view.setBottomTab" argument "tab": "${r}" names a panel that is registered but not available right now, so showing it would persist a Bottom dock tab nothing can draw`);oh(r)},title:"Show Bottom Dock Tab"},{args:Ce({open:To("True to show the Assistant tab, false to step off it.")}),category:"View",id:"view.setAssistant",level:"application",menus:["never"],group:"4_docks",run:(t,o)=>{if(Hi("view.setAssistant",o,"open")){ko("right",!1),e.setInspectorTab("assistant");return}if(e.inspectorTab()==="assistant")e.setInspectorTab(e.restingInspectorTab?.()??nx)},title:"Show Assistant"},{args:Ce({workspace:ui(vC,"Which workspace to show.")}),category:"View",id:"view.setWorkspace",level:"application",menus:["never"],group:"4_workspaces",requires:"an open project",when:ee,run:(t,o)=>{Ne(Vn("view.setWorkspace",o,"workspace",vC),e)},title:"Switch Workspace"},...iv.map((t,o)=>({category:"View",id:`workspace.focus.${t.id}`,keybinding:`mod+${o+1}`,level:"application",menus:["palette"],group:"4_workspaces",requires:"an open project",when:ee,run:()=>{Ne(t.id,e)},title:`Go to ${t.title}`})),{args:Ce({color:ui(rx,"The Studio chrome's theme.")}),category:"View",id:"view.setTheme",level:"application",menus:["palette"],group:"6_appearance",run:(t,o)=>{JL(Vn("view.setTheme",o,"color",rx))},title:"Set Theme"}]}function cA(e,t){e.registerAll(Mt(t))}
|
|
13
|
-
export{
|
|
3
|
+
`)l+=1;o+=1}return l},s=()=>{let l=o,f=new Set;o+=1;while(o<e.length&&e[o]!=='"')if(e[o]==="\\")if(e[o+1]==="u"){let b=Number.parseInt(e.slice(o+2,o+6),16);if(b>=128)f.add(b);o+=6}else o+=2;else o+=1;return o+=1,{escaped:f,raw:e.slice(l,o)}},i=(l,f)=>{let b=r();if(e[o]===f)return o+=1,!0;if(o+=1,b+=r(),b>=2)t.blankAfter.add(l);return!1},a=(l)=>{r();let f=e[o];if(f==="{"){o+=1;let b=r()>0;if(e[o]==="}"){o+=1;return}t.inline.set(l,!b);while(o<e.length){let c=JSON.parse(s().raw);r(),o+=1;let d=`${l}/${F(c)}`;if(a(d),i(d,"}"))return}}else if(f==="["){if(o+=1,r(),e[o]==="]"){o+=1;return}for(let b=0;o<e.length;b+=1){let c=`${l}/${b}`;if(a(c),i(c,"]"))return}}else if(f==='"'){let{escaped:b}=s();if(b.size>0)t.escaped.set(l,b)}else while(o<e.length&&!`,]} \r
|
|
4
|
+
`.includes(e[o]))o+=1};return a(""),t}function Es(e){return{document:JSON.parse(e),layout:H(e)}}var Ve=/[^\u0020-\u007E]/,He=/^[\p{Mn}\p{Me}\p{Cf}]$/u,Ge=/^\p{Emoji_Presentation}$/u;function Ke(e){return e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=12871&&e!==12351||e>=12880&&e<=19903||e>=19968&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510||e>=110592&&e<=110593||e>=127488&&e<=127569||e>=131072&&e<=262141)}function me(e){if(!Ve.test(e))return e.length;let t=0;for(let o of e){if(He.test(o))continue;t+=Ke(o.codePointAt(0))||Ge.test(o)?2:1}return t}function be(e){return e===void 0||Q(e)||Iv(e)}function U(e){return Object.entries(e).filter(([,t])=>!be(t))}function M(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function qe(e){if(e.length<2)return!1;let t=Array.isArray(e[0])?"array":M(e[0])?"object":null;if(t===null)return!1;return e.every((o)=>t==="array"?Array.isArray(o)&&o.length>1:M(o)&&U(o).length>1)}function Ye(e){return e.length>1&&e.every((t)=>Z(t))}function V(e,t){let o=be(e)?"null":JSON.stringify(e);return t===void 0?o:o.replaceAll(/[\u0080-\uFFFF]/g,(r)=>{let s=r.codePointAt(0);return t.has(s)?`\\u${s.toString(16).padStart(4,"0")}`:r})}function Co(e,t,o=Ue){let r=t?.inline??new Map,s=t?.blankAfter??new Set,i=t?.escaped??new Map,a=(c,d)=>r.get(c)??d,l=(c,d,h)=>{if(Array.isArray(c)){if(c.length===0)return"[]";if(qe(c))return null;let y=[];for(let[x,P]of c.entries()){let T=`${d}/${x}`,w=s.has(T)?null:l(P,T,h);if(w===null)return null;y.push(w)}return`[${y.join(", ")}]`}if(M(c)){let y=U(c);if(y.length===0)return"{}";if(!a(d,h))return null;let x=[];for(let[P,T]of y){let w=`${d}/${F(P)}`,E=s.has(w)?null:l(T,w,!0);if(E===null)return null;x.push(`${JSON.stringify(P)}: ${E}`)}return`{ ${x.join(", ")} }`}return V(c,i.get(d))},f=(c)=>c.map(({path:d,text:h},y)=>y===c.length-1?h:`${h},
|
|
5
|
+
${s.has(d)?`
|
|
6
|
+
`:""}`).join(""),b=(c,d,h,y,x,P)=>{if(!Array.isArray(c)&&!M(c))return V(c,i.get(d));let T=l(c,d,x);if(T!==null&&y+me(T)+P<=o)return T;let w=" ".repeat(h+2),E=`
|
|
7
|
+
${" ".repeat(h)}`;if(Array.isArray(c)){if(Ye(c))return`[
|
|
8
|
+
${Xe(c,w,o,(A)=>s.has(`${d}/${A}`))}${E}]`;let L=c.map((R,A)=>{let O=`${d}/${A}`,J=A===c.length-1,z=b(R,O,h+2,w.length,x,J?0:1);return{path:O,text:`${w}${z}`}});return`[
|
|
9
|
+
${f(L)}${E}]`}let pe=U(c),Be=a(d,x),We=pe.map(([L,R],A)=>{let O=`${d}/${F(L)}`,J=`${JSON.stringify(L)}: `,z=A===pe.length-1,ze=w.length+me(J),Fe=b(R,O,h+2,ze,Be,z?0:1);return{path:O,text:`${w}${J}${Fe}`}});return`{
|
|
10
|
+
${f(We)}${E}}`};return`${b(e,"",0,0,!1,0)}
|
|
11
|
+
`}function Xe(e,t,o,r){let s=[],i="";for(let[a,l]of e.entries()){let f=`${V(l)}${a===e.length-1?"":","}`;if(i==="")i=`${t}${f}`;else if(i.length+1+f.length<=o)i=`${i} ${f}`;else s.push(i),i=`${t}${f}`;if(r(a)&&a<e.length-1)s.push(i,""),i=""}return s.push(i),s.join(`
|
|
12
|
+
`)}function km(e){return Co(e,ye())}var k=null,j=null,N=null,I=null;function ye(){return we()?.doc.layout??I}var G=null;function we(){let e=m.tabs.get(an);return e?de(e):null}function Qe(){if(j)Fm(j),j=null;k=null,N=null,I=null,G=null}function ve(){return G??=(async()=>{try{let e=await p().readFile(an),{document:t,layout:o}=Es(e);I=o,N=Co(t,ye())}catch{N=null}})(),G}async function jL(e){if(await ve(),e.doc.layout===null&&I!==null)e.doc.layout=I}function et(e){let t=wn();if(t.projectConfig===e)return;Qc({...t,projectConfig:e}),Ql(m.projectRoot,e)}function tt(){let e=S?.projectConfig;return e?de(e):null}function K(e){return de(e)}function xe(e,t){for(let o of Object.keys(e))delete e[o];Object.assign(e,t)}function he(e){return k=e,e.scope.run(()=>{ne(()=>{let t=e.doc.document;if(k!==e||!S)return;et(K(t))})}),e}function XS(){let e=wn(),t=we();if(k&&(k!==(t??j)||de(k.doc.document)!==e.projectConfig))Qe();if(k)return k;if(t)return he(t);return j=lv({document:e.projectConfig??{},documentPath:an,id:an}),he(j)}function Se(e){return JSON.stringify(e.extensions??null)}async function ot(){let{loadFormats:e,refreshExtensionUi:t,refreshFormats:o}=await (le("zjsbktbx"),import("./format-host-zjsbktbx.js"));o(),e(),t(p())}async function Gl(e){let t=tt(),o=XS();await jL(o);let r=K(o.doc.document),s=km(r),i=t&&t!==r&&km(t)!==s?t:null;if(i&&o.doc.dirty){let h=Error(`${an} has unsaved changes in its editor tab`);return C.error(`Could not save ${an} — the file is open with unsaved changes. Save or `+"revert that tab, then make the settings change again.",{key:`save:${an}`,path:an,source:"Settings"}),{error:h,ok:!1}}let a=i??r,l=e?{...a,...e}:a,f=km(l);if(!i&&!o.doc.dirty&&f===N)return{ok:!0};let b=Se(r);Y(o,(h)=>{let y=h.doc.document;if(i)xe(y,i);for(let[x,P]of Object.entries(e??{}))y[x]=P});let c=K(o.doc.document),d=km(c);try{await p().writeFile(an,d)}catch(h){return C.error(`Could not save ${an} — ${ee(h)}`,{key:`save:${an}`,path:an,source:"Settings"}),{error:h,ok:!1}}if(N=d,o.doc.dirty=!1,Se(c)!==b)await ot();return{ok:!0}}async function ZN(e,t){if(!S){Ql(m.projectRoot,e);return}let o=XS();Y(o,(r)=>xe(r.doc.document,e),{skipHistory:!0}),o.doc.dirty=!1,await ve(),I=H(t),o.doc.layout=I,N=km(e)}function to(e){let t=S?.projectConfig?.$media;if(!t)return e||{};if(!e)return{...t};return{...t,...e}}function wr(e){let t=S?.projectConfig?.style;if(!t)return e||{};if(!e)return{...t};let o={...t};for(let[r,s]of Object.entries(e)){let i=o[r];o[r]=_(s)&&_(i)?{...i,...s}:s}return o}function XN(e,t=[]){return{...HL(t),...S?.projectConfig?.imports,...e}}function HL(e){let t=e.flatMap((o)=>(o.classes??[]).filter((r)=>r.path.endsWith(".class.json")).map((r)=>[r.name,r.path]));return Object.fromEntries(t.toReversed())}function Xw(e){let t=S?.projectConfig?.$elements;if(!t?.length)return e||[];if(!e?.length)return[...t];let o=new Set,r=[];for(let s of[...t,...e]){let i=n(s)?s:_(s)?s.$ref:void 0;if(i&&!o.has(i))o.add(i),r.push(s)}return r}function Qw(e){let t=S?.projectConfig?.$head;if(!t?.length)return e||[];if(!e?.length)return[...t];let o=new Set,r=[];for(let s of[...t,...e]){let i=_(s)?s.attributes:void 0,a=String(i?.href||i?.src||"")||JSON.stringify(s);if(!o.has(a))o.add(a),r.push(s)}return r}function Ts(){let e=S?.projectConfig;return e?ln(e).i18n:null}function Ip(e,t){let o=Ts();if(o===null)return null;let r=Pn(e);if(r!==null&&o.locales.includes(r))return r;return go(t??"",o)??o.defaultLocale}var q=new Map;function QN(){q.clear()}function il(e){if(e===!1)return null;let t=S?.projectConfig?.defaults?.layout;return e||t||null}async function ex(e){let t=e.replace(/^\.\//,""),o=q.get(t);if(o!==void 0)return structuredClone(o);try{let s=await p().readFile(t),i=JSON.parse(s);return q.set(t,i),structuredClone(i)}catch{return null}}function BL(e,t){let o=t.children??[],r=Array.isArray(o)?o:[],s=new Map,i=[];for(let a of r){let l=n(a)?void 0:a.attributes?.slot;if(!n(a)&&n(l)&&l){if(!s.has(l))s.set(l,[]);s.get(l).push(a)}else i.push(a)}if(Pe(e,s,i),t.state)e.state={...e.state,...t.state};if(t.$media)e.$media={...e.$media,...t.$media};if(t.style)e.style={...e.style,...t.style};if(t.attributes)e.attributes={...e.attributes,...t.attributes};return e}function Pe(e,t,o){if(!Array.isArray(e.children))return;let r=[];for(let s of e.children)if(_(s)&&s.tagName==="slot"){let i=s.attributes?.name;if(n(i)&&i&&t.has(i))r.push(...t.get(i)),t.delete(i);else if(!i&&o.length>0)r.push(...o);else if(Array.isArray(s.children))r.push(...s.children)}else{if(_(s))Pe(s,t,o);r.push(s)}e.children=r}async function no(e){let t=await Gl(e);if(!t.ok)throw t.error}var Te=new Set([pi,zm]),nt=new Set(["auto","light","dark"]);function rt(e){return n(e)&&nt.has(e)}function it(e){let{ui:t}=e.session;return{activeMedia:t.activeMedia,canvasMode:t.canvasMode,editZoom:t.editZoom,preview:t.preview,previewColorScheme:t.previewColorScheme,previewLocale:t.previewLocale,showLayout:t.showLayout,zoom:t.zoom}}function ke(){let e={},t=[];for(let o of m.panes){if(o.derived)continue;let r=[];for(let i of o.tabOrder){let a=m.tabs.get(i);if(!a?.documentPath)continue;r.push(a.documentPath),e[a.documentPath]=it(a)}if(r.length===0)continue;let s=o.activeTabId?m.tabs.get(o.activeTabId):null;t.push({activeFile:s?.documentPath??null,files:r,id:o.id})}return{focusedPane:m.activePaneId,panes:t,ui:e}}function st(e){if(!v(e))return{};let t={};if(n(e.canvasMode))t.canvasMode=e.canvasMode;if(Ze(e.preview))t.preview=e.preview;if(Z(e.zoom)&&Number.isFinite(e.zoom))t.zoom=e.zoom;if(Z(e.editZoom)&&Number.isFinite(e.editZoom))t.editZoom=e.editZoom;if(e.activeMedia===null||n(e.activeMedia))t.activeMedia=e.activeMedia;if(rt(e.previewColorScheme))t.previewColorScheme=e.previewColorScheme;if(e.previewLocale===null||n(e.previewLocale)&&yx(e.previewLocale))t.previewLocale=e.previewLocale;if(Ze(e.showLayout))t.showLayout=e.showLayout;return t}function Ie(e){if(!v(e)||!Array.isArray(e.panes))return null;let t=[];for(let r of e.panes){if(!v(r)||!n(r.id)||!Te.has(r.id))continue;let s=Array.isArray(r.files)?r.files.filter((i)=>n(i)&&i!==""):[];if(s.length===0)continue;t.push({activeFile:n(r.activeFile)&&s.includes(r.activeFile)?r.activeFile:null,files:s,id:r.id})}if(t.length===0)return null;let o={};if(_(e.ui))for(let[r,s]of Object.entries(e.ui))o[r]=st(s);return{focusedPane:n(e.focusedPane)&&Te.has(e.focusedPane)?e.focusedPane:pi,panes:t,ui:o}}async function eA(e,t){let o=0;if(e.panes.some((i)=>i.id===zm))t.ensureSecondPane();for(let i of e.panes)for(let a of i.files){try{await t.openFile(a,i.id)}catch{}if([...m.tabs.values()].some((l)=>l.documentPath===a))o+=1}if(o===0)return 0;for(let i of m.tabs.values()){let a=i.documentPath?e.ui[i.documentPath]:void 0;if(!a)continue;let{ui:l}=i.session;if(a.canvasMode&&i.capabilities.modes.includes(a.canvasMode))l.canvasMode=a.canvasMode;if(a.preview!==void 0)l.preview=a.preview;if(a.zoom!==void 0)l.zoom=a.zoom;if(a.editZoom!==void 0)l.editZoom=a.editZoom;if(a.activeMedia!==void 0)l.activeMedia=a.activeMedia;if(a.previewColorScheme!==void 0)l.previewColorScheme=a.previewColorScheme;if(a.previewLocale!==void 0)l.previewLocale=a.previewLocale;if(a.showLayout!==void 0)l.showLayout=a.showLayout}let r=m.panes.some((i)=>i.id===e.focusedPane)?e.focusedPane:null,s=null;for(let i of e.panes){let a=m.panes.find((f)=>f.id===i.id);if(!a||!i.activeFile)continue;let l=a.tabOrder.find((f)=>m.tabs.get(f)?.documentPath===i.activeFile);if(!l)continue;if(a.id===r)s=l;else jt(l,{focus:!1})}if(s)jt(s);else if(r)kr(r);return o}var Em=["review","deploys","branches","hosting"],QS={branches:"Branches",deploys:"Deploys",hosting:"Hosting",review:"Review changes"},at=["live","review"],_e="review",Ee="live",lt=new Set(Em),ct=new Set(at);function tA(e){return typeof e==="string"&<.has(e)}function tx(e){return typeof e==="string"&&ct.has(e)}var ut={default:{description:"Resume whatever was persisted — layout, recents, settings, chat history.",id:"default",reset:"none"},fresh:{description:"A first-run app: no layout, no recents, no settings, no history.",id:"fresh",reset:"app-state"}},Ae=new Map(Object.entries(ut)),ft="default",dt=/^jx[-._:]/;function mt(e){return dt.test(e)}function gt(){let e=typeof localStorage>"u"?void 0:localStorage;if(!e)return[];let t=[];try{for(let o=0;o<e.length;o++){let r=e.key(o);if(r&&mt(r))t.push(r)}for(let o of t)e.removeItem(o)}catch{}return t}function bt(e){let t=Ae.get(e);if(!t)throw RangeError(`unknown startup profile "${e}"; declared: ${[...Ae.keys()].join(", ")}`);if(t.reset==="app-state")gt();return t}var B=null;function je(e){if(B)return B;let t=new URLSearchParams(e??(typeof location>"u"?"":location.search)),o=bt(t.get("profile")??ft),r=t.get("clock");return B={clock:r===null?null:rM(r),profile:o},B}var W=["site","collections","styles","files","search","i18n","layers","data","packages","insert"],ht=new Set(["collections","styles"]);function Oe(e){return e&&!ht.has(e)?e:yt}var St=new Map([["blocks","insert"],["head","site"],["page","site"],["imports","packages"],["git","site"],["state","data"]]),yt="site";function eC(e,t){let o=W.find((r)=>r===e);if(o===void 0)throw Error(`${t}: "${e}" is not a declared Navigator panel id.`);return o}function se(e){if(!n(e))return null;let t=St.get(e);if(t)return t;return W.find((o)=>o===e)??null}var oe=["page","properties","style","events","assistant"],nx="page",wt=["properties","style","events"],tC="properties";function ix(e){return typeof e==="string"&&wt.some((t)=>t===e)}function zL(e){return typeof e==="string"&&oe.some((t)=>t===e)}var ox=["problems","logic","activity"],WL="problems";function VL(e){return typeof e==="string"&&ox.some((t)=>t===e)}var rx=["light","dark"],Bc={content:{id:"content",inspector:{open:!1,whileWriting:!0},navigator:{open:!0,panel:"collections"},rail:!1,tabStrip:!0},design:{id:"design",inspector:{open:!0},navigator:{initial:"site",open:!0},rail:!0,tabStrip:!0},media:{id:"media",inspector:{open:!1},navigator:{open:!1},rail:!1,tabStrip:!1},publish:{id:"publish",inspector:{open:!1},navigator:{open:!1},rail:!1,tabStrip:!1},styles:{id:"styles",inspector:{open:!1,tab:"style",whileWriting:!0},navigator:{open:!0,panel:"styles"},rail:!1,tabStrip:!1}},De="jx-studio-panel-widths",Le="jx-studio-project::",vt="dark";function UL(e){return typeof e==="string"&&rx.some((t)=>t===e)}function xt(){let e=Uo(pt.theme);return UL(e)?e:vt}var sx=["left","right","bottom"],D={bottom:{collapsed:!0,size:220},left:{collapsed:!1,size:240},right:{collapsed:!1,size:280}},nA={bottom:D.bottom.size,left:D.left.size,right:D.right.size},Pt={bottom:"--dock-h-bottom",left:"--panel-w-left",right:"--panel-w-right"},Tt={bottom:"bottom-collapsed",left:"left-collapsed",right:"right-collapsed"},qL=0.5,nC=0.2,iC=0.8;function kt(e){return Z(e)&&e>=nC&&e<=iC?e:qL}function iA(e){u.paneSplit=Math.min(iC,Math.max(nC,e))}function It(){try{let e=JSON.parse(localStorage.getItem(De)||"{}");return v(e)?e:{}}catch{return{}}}function _t(e){return{left:e("left"),right:e("right"),bottom:e("bottom")}}function Re(){return{branches:null,commitMessage:"",diffState:null,error:null,lastUpdated:null,loading:!1,logEntries:null,rev:0,status:null}}function $e(){return{build:{for:"",state:"idle",text:""},deploys:{error:"",project:"",rows:[],state:"idle"},destination:Ee,review:{number:0,url:""},tab:_e}}var Et="tokens";function Je(){return{customizedOnly:!1,filter:"",selection:null,variable:null,view:Et}}function Ct(){let e=It(),t=_t((o)=>{let r=e[o],s=e[`${o}Collapsed`];return{collapsed:Ze(s)?s:D[o].collapsed,size:Z(r)&&r>0?r:D[o].size}});return{bottomTab:VL(e.bottomTab)?e.bottomTab:WL,docks:t,focusRegion:"pane",paneSplit:kt(e.paneSplit),git:Re(),publish:$e(),layoutSelection:null,leftTab:Oe(se(e.leftTab)),stylebook:Je(),theme:xt(),workspace:xx}}je();var At=["jx-studio-doc-header-expanded"];function Nt(){try{for(let e of At)localStorage.removeItem(e)}catch{}}Nt();var u=g(Ct());function Od(){try{localStorage.setItem(De,JSON.stringify({bottom:u.docks.bottom.size,bottomCollapsed:u.docks.bottom.collapsed,bottomTab:u.bottomTab,left:u.docks.left.size,leftCollapsed:u.docks.left.collapsed,leftTab:u.leftTab,paneSplit:u.paneSplit,right:u.docks.right.size,rightCollapsed:u.docks.right.collapsed}))}catch{}}var re,ae={};function ce(e){if(!e)return{};try{let t=JSON.parse(localStorage.getItem(`${Le}${e}`)||"{}");return v(t)?t:{}}catch{return{}}}function GL(e){let t=ce(e).workspace;return I$(t)?t:xx}function oA(e){return Ie(ce(e).session)}var ue=null;function ax(e){ue=e}function rA(){fe()}function fe(){let e=m.projectRoot;if(!e)return;try{localStorage.setItem(`${Le}${e}`,JSON.stringify({session:e===ue?ke():ce(e).session,workspace:u.workspace}))}catch{}}function Ot(e){if(e===re)return;if(re=e,ae={},u.workspace=GL(e),e===null){u.leftTab=Oe(se(u.leftTab));return}Kr();try{Me(u.workspace),Od()}finally{Jr()}}function KL(e,t){let{inspector:o}=Bc[e];return o.open||o.whileWriting===!0&&t}function Me(e,t){let o=Bc[e],r=se(o.navigator.panel??ae[e]??o.navigator.initial??u.leftTab);if(r)u.leftTab=r;if(u.docks.left.collapsed=!o.navigator.open,u.docks.right.collapsed=!KL(e,t?.writingOnCanvas?.()===!0),o.inspector.tab&&t)t.setInspectorTab(o.inspector.tab)}function oC(e,t){if(u.workspace===e)return!1;if(!Bc[u.workspace].navigator.panel)ae[u.workspace]=u.leftTab;return u.workspace=e,Me(e,t),Od(),fe(),!0}function Tm(e=u.theme){return e==="light"?"vs":"vs-dark"}function Dt(){document.documentElement.dataset.theme=u.theme,nf()?.editor.setTheme(Tm())}var Lt="rail-hidden",Rt="tabs-hidden";function Pb(e=u.workspace){return Bc[e].tabStrip}function $t(){let e=document.documentElement;for(let o of sx)e.style.setProperty(Pt[o],`${u.docks[o].size}px`);let t=document.querySelector("#app");if(!t)return;for(let o of sx)t.classList.toggle(Tt[o],u.docks[o].collapsed);t.classList.toggle(Lt,!Bc[u.workspace].rail),t.classList.toggle(Rt,!Bc[u.workspace].tabStrip)}var X=null,ie=[];function Fb(e){if(!ie.includes(e))ie.push(e)}function sA(){if(X)return;for(let e of ie)e.mount();X=ge(),X.run(()=>{ne(()=>{$t()}),ne(()=>{Dt()}),ne(()=>{Ot(m.projectRoot)}),ne(()=>{let e=m.projectRoot;m.activePaneId;for(let t of m.panes)t.id,t.activeTabId,t.tabOrder.join("\x00");if(e)fe()})})}function ko(e,t){if(u.docks[e].collapsed===t){Od();return}u.docks[e].collapsed=t,Od()}function Jt(e){ko(e,!u.docks[e].collapsed)}function aA(e,t){u.docks[e].size=t}function zc(e){u.leftTab=e,ko("left",!1),Od()}function oh(e){u.bottomTab=e,ko("bottom",!1),Od()}function JL(e){if(u.theme===e)return;u.theme=e,xr(pt.theme,e)}function lA(e){if(e===u.leftTab&&!u.docks.left.collapsed){ko("left",!0);return}zc(e)}function YL(e){u.layoutSelection=e}function lx(){Object.assign(u.git,Re()),Object.assign(u.publish,$e()),Object.assign(u.stylebook,Je()),u.layoutSelection=null,ue=null,re=void 0}function Ne(e,t){if(t.showWorkspace){t.showWorkspace(e);return}oC(e,t)}var te=(e)=>e.project.open;function Mt(e){return[{args:Ce({tab:hi(W,"Which Navigator panel to show.")}),category:"View",id:"view.setActivity",level:"application",menus:["commandbar/overflow","palette"],group:"4_docks",requires:"an open project",when:te,run:(t,o)=>{let r=Vn("view.setActivity",o,"tab",W);if(e.panelAvailable&&!e.panelAvailable(r))throw RangeError(`command "view.setActivity" argument "tab": "${r}" names a panel that is registered but not available right now, so showing it would persist a Navigator tab nothing can draw`);zc(r)},title:"Show Navigator Panel"},{args:Ce({tab:hi(oe,"Which Inspector tab to show.")}),category:"View",id:"view.setRightTab",level:"document",menus:["palette"],group:"4_docks",requires:"an open document",when:(t)=>t.document.open,run:(t,o)=>{e.setInspectorTab(Vn("view.setRightTab",o,"tab",oe))},title:"Show Inspector Tab"},{args:Ce({open:To("True to show the Navigator dock, false to collapse it.")}),category:"View",id:"view.setNavigator",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{ko("left",!Hi("view.setNavigator",o,"open"))},title:"Show Navigator Dock"},{args:Ce({open:To("True to show the Inspector dock, false to collapse it.")}),category:"View",id:"view.setRightPanel",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{ko("right",!Hi("view.setRightPanel",o,"open"))},title:"Show Inspector Dock"},{args:Ce({open:To("True to show the Bottom dock, false to collapse it.")}),category:"View",id:"view.setBottomDock",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{ko("bottom",!Hi("view.setBottomDock",o,"open"))},title:"Show Bottom Dock"},{category:"View",id:"view.toggleBottomDock",keybinding:"mod+j",level:"application",menus:["commandbar/overflow","palette"],group:"4_docks",run:()=>{Jt("bottom")},title:"Toggle Bottom Dock"},{args:Ce({tab:hi(ox,"Which Bottom dock tab to show.")}),category:"View",id:"view.setBottomTab",level:"application",menus:["palette"],group:"4_docks",run:(t,o)=>{let r=Vn("view.setBottomTab",o,"tab",ox);if(e.panelAvailable&&!e.panelAvailable(r))throw RangeError(`command "view.setBottomTab" argument "tab": "${r}" names a panel that is registered but not available right now, so showing it would persist a Bottom dock tab nothing can draw`);oh(r)},title:"Show Bottom Dock Tab"},{args:Ce({open:To("True to show the Assistant tab, false to step off it.")}),category:"View",id:"view.setAssistant",level:"application",menus:["never"],group:"4_docks",run:(t,o)=>{if(Hi("view.setAssistant",o,"open")){ko("right",!1),e.setInspectorTab("assistant");return}if(e.inspectorTab()==="assistant")e.setInspectorTab(e.restingInspectorTab?.()??nx)},title:"Show Assistant"},{args:Ce({workspace:hi(vC,"Which workspace to show.")}),category:"View",id:"view.setWorkspace",level:"application",menus:["never"],group:"4_workspaces",requires:"an open project",when:te,run:(t,o)=>{Ne(Vn("view.setWorkspace",o,"workspace",vC),e)},title:"Switch Workspace"},...iv.map((t,o)=>({category:"View",id:`workspace.focus.${t.id}`,keybinding:`mod+${o+1}`,level:"application",menus:["palette"],group:"4_workspaces",requires:"an open project",when:te,run:()=>{Ne(t.id,e)},title:`Go to ${t.title}`})),{args:Ce({color:hi(rx,"The Studio chrome's theme.")}),category:"View",id:"view.setTheme",level:"application",menus:["palette"],group:"6_appearance",run:(t,o)=>{JL(Vn("view.setTheme",o,"color",rx))},title:"Set Theme"}]}function cA(e,t){e.registerAll(Mt(t))}
|
|
13
|
+
export{Es,Co,km,jL,XS,Gl,ZN,to,wr,XN,HL,Xw,Qw,Ts,Ip,QN,il,ex,BL,no,eA,Em,QS,tA,tx,eC,nx,tC,ix,zL,ox,WL,VL,rx,Bc,UL,sx,nA,qL,nC,iC,iA,u,Od,GL,oA,ax,rA,KL,oC,Tm,Pb,Fb,sA,ko,aA,zc,oh,JL,lA,YL,lx,cA};
|
|
14
14
|
|
|
15
|
-
//# debugId=
|
|
16
|
-
//# sourceMappingURL=studio-
|
|
15
|
+
//# debugId=0692ACCC791BFF7564756E2164756E21
|
|
16
|
+
//# sourceMappingURL=studio-dbgv4fv9.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{p}from"./studio-
|
|
2
|
-
export{Bp,
|
|
1
|
+
import{p}from"./studio-w67vfgy5.js";import{Sr}from"./studio-0hr000ba.js";import{us,Wd,$$}from"./studio-pd9dsqpq.js";import{cv,m}from"./studio-j933k8nr.js";import{S}from"./studio-rt498t2v.js";var P=/[.*+?^${}()|[\]\\]/;function v(e){return P.test(e)?`\\${e}`:e}function L(e){let t=e.length;while(t>0&&e[t-1]===" "){let n=0,r=t-2;while(r>=0&&e[r]==="\\")n+=1,r-=1;if(n%2===1)break;t-=1}return e.slice(0,t)}function T(e,t){let n=t+1;if(e[n]==="!")n+=1;if(e[n]==="]")n+=1;while(n<e.length){if(e[n]==="\\"){n+=2;continue}if(e[n]==="]")return n;n+=1}return-1}function k(e){let t="",n=0;while(n<e.length){let r=e[n];if(r==="\\"){let o=e[n+1];if(o===void 0)t+=String.raw`\\`,n+=1;else t+=v(o),n+=2;continue}if(r==="*"){let o=0;while(e[n]==="*")o+=1,n+=1;let i=t===""||t.endsWith("/");if(o>=2&&i&&e[n]==="/")t+="(?:[^/]+/)*",n+=1;else if(o>=2&&i&&n>=e.length)t+=".*";else t+="[^/]*";continue}if(r==="?"){t+="[^/]",n+=1;continue}if(r==="["){let o=T(e,n);if(o===-1){t+=String.raw`\[`,n+=1;continue}let i=e.slice(n+1,o),s=i.startsWith("!"),a=s?i.slice(1):i;t+=`[${s?"^":""}${a.startsWith("]")?String.raw`\]${a.slice(1)}`:a}]`,n=o+1;continue}t+=v(r),n+=1}return t}function F(e){let t=L(e);if(t===""||t.startsWith("#"))return null;let n=!1;if(t.startsWith("!"))n=!0,t=t.slice(1);let r=!1;if(t.endsWith("/"))r=!0,t=t.slice(0,-1);let o=t.includes("/");if(t.startsWith("/"))t=t.slice(1),o=!0;if(t==="")return null;let i=k(t);return{dirOnly:r,negated:n,re:new RegExp(`^${o?"":"(?:.*/)?"}${i}$`),source:e}}function M(e){let t=[];for(let n of e.split(/\r?\n/)){let r=F(n);if(r)t.push(r)}return t}function b(e){let t=e.replaceAll("\\","/").replace(/^\.\/+/,"").replace(/\/+$/,"");return t==="."?"":t}function O(e,t){if(e==="")return t;return t.startsWith(`${e}/`)?t.slice(e.length+1):null}function x(e){let t=b(e),n=[""];if(t==="")return n;let r="";for(let o of t.split("/"))r=r===""?o:`${r}/${o}`,n.push(r);return n}function W(e,t,n){let r=!1;for(let o of e){let i=O(o.base,t);if(i===null||i==="")continue;for(let s of o.rules){if(s.dirOnly&&!n)continue;if(s.re.test(i))r=!s.negated}}return r}function N(e,t,n){let r=b(t);if(r==="")return!1;let o=r.split("/"),i="";for(let[s,a]of o.entries()){i=i===""?a:`${i}/${a}`;let u=s===o.length-1;if(W(e,i,u?n:!0))return!0}return!1}var g=new Map,h=new Map;function Bp(){g.clear(),h.clear()}async function w(e){try{let t=await p().readFile(e===""?".gitignore":`${e}/.gitignore`);return{base:e,rules:M(t)}}catch{return null}}function _(e){let t=g.get(e);if(t!==void 0)return Promise.resolve(t);let n=h.get(e);if(n)return n;let r=w(e).then((o)=>(g.set(e,o),h.delete(e),o));return h.set(e,r),r}async function E(){let e=[...g.keys()];h.clear();let t=await Promise.all(e.map((n)=>w(n)));g.clear();for(let[n,r]of e.entries())g.set(r,t[n]??null)}async function QA(e){await Promise.all(x(e).map((t)=>_(t)))}function A(e){let t=[];for(let n of x(e)){let r=g.get(n);if(r)t.push(r)}return t}function eO(e,t,n){return N(A(e),t,n)}function C(e){return e.some((t)=>b(t).split("/").pop()===".gitignore")}var U=1500,D={commit:0,open:1,reconnect:2},G=250,V=8,R=new Map,I=(e)=>e.replaceAll("\\","/");function Ta(...e){Wd(e,e);let t=Date.now()+U;for(let n of e)if(n)R.set(I(n),t)}function Bd(e){let t=I(e),n=R.get(t);if(n===void 0)return!1;if(Date.now()>n)return R.delete(t),!1;return!0}function Y(e){let t=e.lastIndexOf("/");return t===-1?".":e.slice(0,t)}function z(e){let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)}function B(e,t,n){let r=new Set;for(let o of n){let i=Y(o.path);if(o.type==="add"||o.type==="addDir"){let s=e.get(i);if(s&&!s.some((a)=>a.path===o.path))s.push({name:z(o.path),path:o.path,type:o.isDir?"directory":"file"}),r.add(i);if(o.type==="addDir"&&!e.has(o.path))e.set(o.path,[])}else if(o.type==="unlink"||o.type==="unlinkDir"){let s=e.get(i);if(s){let a=s.findIndex((u)=>u.path===o.path);if(a!==-1)s.splice(a,1),r.add(i)}if(o.type==="unlinkDir"){e.delete(o.path);let a=[];for(let c of e.keys())if(c.startsWith(`${o.path}/`))a.push(c);for(let c of a)e.delete(c);let u=[];for(let c of t)if(c===o.path||c.startsWith(`${o.path}/`))u.push(c);for(let c of u)t.delete(c)}}}return r}function j(e){let t=[],n=[];for(let r of e)if(r.type==="unlinkDir")n.push(r.path);else if(r.type!=="addDir")t.push(r.path);if(t.length>0||n.length>0)Wd(t,n)}function q(e,t){return e!==void 0&&e.length===t.length&&e.every((n,r)=>n===t[r])}var K=2;async function H(e,t){let n=[...e.keys()],r=0,o=async(s)=>{for(let a=0;a<K;a+=1){let u=e.get(s);if(!u)return;let c=[...u],l;try{l=await t(s)}catch{l=null}if(!e.has(s))return;if(!q(e.get(s),c))continue;if(l)e.set(s,l);else e.delete(s);return}},i=async()=>{while(r<n.length){let s=n[r];r+=1,await o(s)}};await Promise.all(Array.from({length:Math.min(V,n.length)},i))}var J=new Set(["media","grid"]);function Q(e){return e.some((t)=>J.has(t))||e.length>0&&e.every((t)=>t==="git-diff")}function X(){let e=new Set;for(let t of m.tabs.values()){let n=t.documentPath;if(n&&!t.doc.dirty&&!cv(n)&&!Q(t.capabilities.modes))e.add(n)}return[...e]}function C$(e){let t=p();if(!t.subscribeFileEvents)return()=>{};let n=[],r=null,o=null,i=null,s=()=>{r=null;let l=S,f=n.filter((d)=>!Bd(d.path));if(n=[],!l||f.length===0)return;let y=B(l.dirs,l.expanded,f);if(e.onContentChange){for(let d of f)if(d.type==="change")e.onContentChange(d.path)}if(y.size>0)e.renderLeftPanel()},a=async()=>{i=null;let l=o;o=null;let f=S;if(!f||!l)return;let y=H(f.dirs,(d)=>us(()=>t.listDirectory(d)));if(l==="reconnect")Sr(),e.invalidateDerivedCaches?.(void 0,!0),await Promise.all([y,E()]);else await y;if(S!==f)return;if(l==="reconnect")e.onResyncContent?.(X());e.renderLeftPanel()},u=(l)=>{if(l!=="commit")$$();if(!o||D[l]>D[o])o=l;if(i)clearTimeout(i);i=setTimeout(()=>{a()},G)},c=t.subscribeFileEvents((l)=>{if(Sr(),e.invalidateDerivedCaches?.(l.map((f)=>f.path),l.some((f)=>f.type!=="change")),j(l),C(l.map((f)=>f.path)))E().then(()=>e.renderLeftPanel());if(n.push(...l),r)clearTimeout(r);r=setTimeout(s,50)},{onResync:u});return()=>{if(i)clearTimeout(i),i=null;c()}}
|
|
2
|
+
export{Bp,QA,eO,Ta,Bd,C$};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=studio-
|
|
4
|
+
//# debugId=3BFDDAEC29DF32CA64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=studio-dy2xtt7a.js.map
|