@inkandswitch/patchwork-pkg-base 0.0.104 → 0.0.105

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.
@@ -0,0 +1,1210 @@
1
+ import{a as Be,b as Lr}from"./chunk-FW4363Y4.js";var bt=Be((Si,gt)=>{var Q=1e3,ee=Q*60,te=ee*60,X=te*24,to=X*7,ro=X*365.25;gt.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return oo(e);if(t==="number"&&isFinite(e))return r.long?ao(e):no(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function oo(e){if(e=String(e),!(e.length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var t=parseFloat(r[1]),o=(r[2]||"ms").toLowerCase();switch(o){case"years":case"year":case"yrs":case"yr":case"y":return t*ro;case"weeks":case"week":case"w":return t*to;case"days":case"day":case"d":return t*X;case"hours":case"hour":case"hrs":case"hr":case"h":return t*te;case"minutes":case"minute":case"mins":case"min":case"m":return t*ee;case"seconds":case"second":case"secs":case"sec":case"s":return t*Q;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function no(e){var r=Math.abs(e);return r>=X?Math.round(e/X)+"d":r>=te?Math.round(e/te)+"h":r>=ee?Math.round(e/ee)+"m":r>=Q?Math.round(e/Q)+"s":e+"ms"}function ao(e){var r=Math.abs(e);return r>=X?Ce(e,r,X,"day"):r>=te?Ce(e,r,te,"hour"):r>=ee?Ce(e,r,ee,"minute"):r>=Q?Ce(e,r,Q,"second"):e+" ms"}function Ce(e,r,t,o){var n=r>=t*1.5;return Math.round(e/t)+" "+o+(n?"s":"")}});var wt=Be((Ei,vt)=>{function io(e){t.debug=t,t.default=t,t.coerce=l,t.disable=a,t.enable=n,t.enabled=c,t.humanize=bt(),t.destroy=d,Object.keys(e).forEach(s=>{t[s]=e[s]}),t.names=[],t.skips=[],t.formatters={};function r(s){let u=0;for(let h=0;h<s.length;h++)u=(u<<5)-u+s.charCodeAt(h),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=r;function t(s){let u,h=null,b,w;function g(...f){if(!g.enabled)return;let m=g,y=Number(new Date),A=y-(u||y);m.diff=A,m.prev=u,m.curr=y,u=y,f[0]=t.coerce(f[0]),typeof f[0]!="string"&&f.unshift("%O");let D=0;f[0]=f[0].replace(/%([a-zA-Z%])/g,(V,Y)=>{if(V==="%%")return"%";D++;let z=t.formatters[Y];if(typeof z=="function"){let j=f[D];V=z.call(m,j),f.splice(D,1),D--}return V}),t.formatArgs.call(m,f),(m.log||t.log).apply(m,f)}return g.namespace=s,g.useColors=t.useColors(),g.color=t.selectColor(s),g.extend=o,g.destroy=t.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(b!==t.namespaces&&(b=t.namespaces,w=t.enabled(s)),w),set:f=>{h=f}}),typeof t.init=="function"&&t.init(g),g}function o(s,u){let h=t(this.namespace+(typeof u>"u"?":":u)+s);return h.log=this.log,h}function n(s){t.save(s),t.namespaces=s,t.names=[],t.skips=[];let u=(typeof s=="string"?s:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let h of u)h[0]==="-"?t.skips.push(h.slice(1)):t.names.push(h)}function i(s,u){let h=0,b=0,w=-1,g=0;for(;h<s.length;)if(b<u.length&&(u[b]===s[h]||u[b]==="*"))u[b]==="*"?(w=b,g=h,b++):(h++,b++);else if(w!==-1)b=w+1,g++,h=g;else return!1;for(;b<u.length&&u[b]==="*";)b++;return b===u.length}function a(){let s=[...t.names,...t.skips.map(u=>"-"+u)].join(",");return t.enable(""),s}function c(s){for(let u of t.skips)if(i(s,u))return!1;for(let u of t.names)if(i(s,u))return!0;return!1}function l(s){return s instanceof Error?s.stack||s.message:s}function d(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}vt.exports=io});var _t=Be((F,$e)=>{F.formatArgs=lo;F.save=co;F.load=uo;F.useColors=so;F.storage=po();F.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();F.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function so(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function lo(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+$e.exports.humanize(this.diff),!this.useColors)return;let r="color: "+this.color;e.splice(1,0,r,"color: inherit");let t=0,o=0;e[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(t++,n==="%c"&&(o=t))}),e.splice(o,0,r)}F.log=console.debug||console.log||(()=>{});function co(e){try{e?F.storage.setItem("debug",e):F.storage.removeItem("debug")}catch{}}function uo(){let e;try{e=F.storage.getItem("debug")||F.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function po(){try{return localStorage}catch{}}$e.exports=wt()(F);var{formatters:ho}=$e.exports;ho.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});import{template as Rr}from"solid-js/web";import{createComponent as qa}from"solid-js/web";import{setAttribute as Ba}from"solid-js/web";import{effect as Ja}from"solid-js/web";import{insert as Fr}from"solid-js/web";import{getOwner as Va}from"solid-js/web";import{createMemo as Dr}from"solid-js";import{createStore as Ga,reconcile as Ka}from"solid-js/store";import{render as Za}from"solid-js/web";import{template as at}from"solid-js/web";import{insert as we}from"solid-js/web";import{getOwner as We}from"solid-js/web";import{use as Ne}from"solid-js/web";import{createComponent as J}from"solid-js/web";import{createUniqueId as Pr,untrack as st}from"solid-js";import{isServer as Mr,isDev as lt}from"solid-js/web";import{reconcile as zr}from"solid-js/store";function Je(e,r={}){let t=r.storage||globalThis.localStorage,o=r.name||`storage-${Pr()}`;if(!t)return Object.assign(e,{2:null});let n=r.storageOptions,i=r.serialize||JSON.stringify.bind(JSON),a=r.deserialize||JSON.parse.bind(JSON),c=t.getItem(o,n),l=typeof e[0]=="function"?s=>{try{let u=a(s);e[1](()=>u)}catch(u){lt&&console.warn(u)}}:s=>{try{let u=a(s);e[1](zr(u))}catch(u){lt&&console.warn(u)}},d=!0;if(c instanceof Promise?c.then(s=>d&&s&&l(s)):c&&l(c),typeof r.sync?.[0]=="function"){let s=typeof e[0]=="function"?e[0]:()=>e[0];r.sync[0](u=>{u.key!==o||!Mr&&(u.url||globalThis.location.href)!==globalThis.location.href||u.newValue===i(st(s))||l(u.newValue)})}return Object.assign([],e,{1:typeof e[0]=="function"?s=>{let u=e[1](s),h=s!=null?i(u):s;return r.sync?.[1](o,h),h!=null?t.setItem(o,h,n):t.removeItem(o,n),d=!1,u}:(...s)=>{e[1](...s);let u=st(()=>i(e[0]));r.sync?.[1](o,u),t.setItem(o,u,n),d=!1},2:c})}import{createEffect as $r,createMemo as Sr,createSignal as K,on as Er,onCleanup as ja,onMount as Wa,Show as He}from"solid-js";import{createEffect as dt,createSignal as ct,on as ut}from"solid-js";var W={leftCollapsed:"patchwork:leftSidebarCollapsed",rightCollapsed:"patchwork:rightSidebarCollapsed",leftWidth:"patchwork:leftSidebarWidth",rightWidth:"patchwork:rightSidebarWidth",contextToolId:"patchwork:contextSidebarToolId"},xe="patchwork:collapse-context-sidebar",ke=400;function pt(e,r){let t=localStorage.getItem(e);return t?parseInt(t,10):r}function ht(e){return localStorage.getItem(e)==="true"}function Or(){let[e,r]=ct(ht(W.leftCollapsed)),[t,o]=ct(pt(W.leftWidth,ke));return dt(ut(e,n=>{localStorage.setItem(W.leftCollapsed,String(n))})),dt(ut(t,n=>{localStorage.setItem(W.leftWidth,String(n))})),{isSidebarCollapsed:e,setIsSidebarCollapsed:r,leftSidebarWidth:t,setLeftSidebarWidth:o}}import{onCleanup as Ur,onMount as jr}from"solid-js";var ft=180,Wr=720,Nr=120,mt=3;function Ve(e,{isCollapsed:r,setCollapsed:t,setWidth:o}){let n=!1,i=null,a=!1,c=null,l=m=>{if(m<Nr){r()||t(!0),c=null;return}r()&&t(!1);let y=Math.min(Wr,m);o(y),c=y},d=()=>{r()||c!==null&&c<ft&&o(ft)},s=null,u=()=>{document.body.setAttribute("data-sidebar-resizing",e),s=document.createElement("div"),s.style.cssText="position:fixed;inset:0;z-index:2147483647;cursor:col-resize;",document.body.appendChild(s)},h=()=>{n=!1,i=null,document.body.style.userSelect="",document.body.removeAttribute("data-sidebar-resizing"),s?.remove(),s=null},b=m=>{m.preventDefault(),i={x:m.clientX,y:m.clientY},a=!1,c=null,n=!0,document.body.style.userSelect="none"},w=()=>{let m=n,y=a;h(),m&&y&&d()},g=m=>{if(!n||!i)return;let y=Math.abs(m.clientX-i.x),A=Math.abs(m.clientY-i.y);!a&&(y>mt||A>mt)&&(a=!0,u()),l(e==="left"?m.clientX:window.innerWidth-m.clientX)},f=m=>{if(a){m.preventDefault(),m.stopPropagation(),a=!1;return}t(y=>!y)};return jr(()=>{document.addEventListener("mousemove",g),document.addEventListener("mouseup",w),Ur(()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",w),n&&h()})}),{handleMouseDown:b,handleToggleClick:f}}import{createEffect as Hr,createSignal as qr,onCleanup as Br}from"solid-js";var Z=(e,r)=>{let[t,o]=qr(!1);return Hr(()=>{let n=r();if(!n)return;o(!1);let i=a=>{a.detail?.componentId===e&&o(!0)};n.addEventListener("patchwork:mounted",i),Br(()=>n.removeEventListener("patchwork:mounted",i))}),t};import{createEffect as Jr,createSignal as Vr,onCleanup as Yr}from"solid-js";var Xr=5e3,Gr=(e,r)=>{let[t,o]=Vr(!1);return Jr(()=>{if(t())return;let n=e(),i=r();if(!n||!i)return;let a=l=>{let d=l.detail;d?.url&&d.url!==i||o(!0)};n.addEventListener("patchwork:mounted",a),n.addEventListener("patchwork:no-tool",a);let c=setTimeout(()=>o(!0),Xr);Yr(()=>{n.removeEventListener("patchwork:mounted",a),n.removeEventListener("patchwork:no-tool",a),clearTimeout(c)})}),t};import{getRegistry as Kr}from"@inkandswitch/patchwork-plugins";import{createMemo as Zr,createSignal as Qr,onCleanup as eo}from"solid-js";function ce(e){let r=Kr("patchwork:component"),[t,o]=Qr(0),n=r.on("changed",()=>o(i=>i+1));return eo(n),Zr(()=>(t(),(r.all?.()??[]).filter(i=>(i.tags??[]).includes(e)).map(i=>({id:i.id,name:i.name||i.id,icon:i.icon})).sort((i,a)=>i.name.localeCompare(a.name))))}import{template as ge}from"solid-js/web";import{delegateEvents as on}from"solid-js/web";import{getOwner as nn}from"solid-js/web";import{effect as Vt}from"solid-js/web";import{setAttribute as an}from"solid-js/web";import{memo as Yt}from"solid-js/web";import{insert as ne}from"solid-js/web";import{createComponent as ae}from"solid-js/web";import{For as pn,Show as Qe}from"solid-js";import{template as At}from"solid-js/web";import{delegateEvents as Co}from"solid-js/web";import{setAttribute as $o}from"solid-js/web";import{insert as So}from"solid-js/web";import"solid-js/web";import{effect as Tt}from"solid-js/web";import{use as Dt}from"solid-js/web";import{createComponent as Ye}from"solid-js/web";var kt=Lr(_t(),1),Ct=(0,kt.default)("cabbages");function yt(e){return typeof e=="object"&&typeof e!=null&&Object.getPrototypeOf(e)==Object.prototype}var fo="\uFFFC";function $t(e,...r){if(r.length==0){Ct("empty patch");return}let[t,o,n]=r,i=[...t];for(;;){let a=i.shift();if(!i.length){let l=Array.isArray(o);if(yt(e)&&l&&typeof a>"u"&&typeof o[0]=="string"){delete e[o[0]];return}if(l||typeof o=="number"){if(typeof a>"u")throw new Error("cant treat top level as a seq");a=a;let[d,s]=Array.isArray(o)?o:[o,o+1],u=Array.isArray(o)&&o.length==0;if(!u&&(d==null||s==null))throw new RangeError("it's all or nothing, no half measures");let h=typeof n>"u",b=d===s&&!h,w=u&&!h,g=!b&&!h&&!w;if(typeof e[a]>"u"){if(typeof e=="string")return;typeof n=="string"?e[a]="":e[a]=[]}let f=e[a];if(Array.isArray(f)){if(w){Array.isArray(n)?f.push(...n):f.push(n);return}if(b||g){Array.isArray(n)?f.splice(d,s-d,...n):f.splice(d,s-d,n);return}if(h){f.splice(d,s-d);return}throw new Error("i don't know what happened")}if(typeof f=="string"){if(w){e[a]=f+n;return}if(g||b){e[a]=f.slice(0,d)+(typeof n=="string"?n:n.map(m=>typeof m=="string"?m:fo).join(""))+f.slice(s);return}if(h){e[a]=f.slice(0,d)+f.slice(s);return}throw new Error("i don't know what happened")}if(yt(f)&&l&&typeof o[0]=="string"){delete f[o[0]];return}throw new Error("not implemented")}if(typeof a>"u"){if(typeof o!="string")throw new Error(`can't index top-level map with ${o}`);typeof n>"u"?delete e[o]:e[o]=n;return}if(typeof e[a]>"u"&&(e[a]={}),l){let[d,s]=o;d!=null&&s!=null&&(typeof n>"u"&&d!=null&&s!=null?delete e[a][d||s]:e[a][d||s]=n)}else if(typeof n>"u")delete e[a][o];else{if(typeof e[a]=="string")return;e[a][o]=n}return}if(typeof a>"u")throw new Error("cant treat top level as a seq");a=a;let c=i[0];if(typeof e[a]>"u")if(typeof c=="string")e[a]={};else if(typeof c=="number")e[a]=[];else throw new Error(`can't go down this road ${e}.${a}.${c}`);e=e[a]}}function xt(e,r){for(let t=0;t<r.length;t++)e=e?e[r[t]]:void 0;return e}function St(e,r){let t=e.path.slice(0,-1),o=e.path[e.path.length-1];switch(e.action){case"mark":case"unmark":return Ct(`skipping ${e.action} because it doesn't affect material reality`),[];case"inc":if(r)return[t,o,xt(r.patchInfo.after,e.path)];throw new Error(`can't apply ${e.action} without payload argument`);case"conflict":if(r)return[t,o,xt(r.patchInfo.after,e.path)];throw new Error(`can't apply ${e.action} without payload argument`);case"del":return typeof o=="string"?[t,o]:[t,[o,o+(e.length||1)]];case"insert":return[t,[o,o],structuredClone(e.values)];case"splice":return[t,[o,o],[e.value]];case"put":return[t,o,structuredClone(e.value)]}}function Se(e){return r=>{for(let t of e.patches)$t(r,...St(t,e))}}import{createMemo as vo}from"solid-js";import{onCleanup as mo}from"solid-js";import{createStore as go,produce as bo,reconcile as Et}from"solid-js/store";var ue=new WeakMap;function Ee(e){if(mo(()=>{let i=ue.get(e);i&&(i.refs--||i.cleanup())}),ue.has(e)){let i=ue.get(e);return i.refs++,i.store}let[r,t]=go(structuredClone(e.doc()));ue.set(e,{refs:0,store:r,cleanup(){e.off("change",o),e.off("delete",n),ue.delete(e)}});function o(i){if(i.scopeReplaced){t(Et(i.doc??{}));return}t(bo(Se(i)))}function n(){t(Et({}))}return e.on("change",o),e.on("delete",n),e.whenReady().then(()=>{t(structuredClone(e.doc()))}),r}import{getOwner as Mi,onCleanup as zi,createSignal as Oi,untrack as Ui,sharedConfig as ji,onMount as Wi,DEV as Ni,equalFn as Hi}from"solid-js";import{isServer as Bi}from"solid-js/web";var re=e=>typeof e=="function"&&!e.length?e():e;function Te(e){return vo(()=>re(e)&&Ee(re(e)))}import{createEffect as _o,createResource as yo,useContext as xo}from"solid-js";import{createContext as wo}from"solid-js";var Ae=wo(null);function pe(e,r){let t=xo(Ae);if(!r?.repo&&!t)throw new Error("use outside <RepoContext> requires options.repo");let o=r?.repo||t;function n(){if(r?.["~skipInitialValue"])return;let c=re(e);if(!c)return;let l=o.findWithProgress(c).peek();return l.state==="ready"?l.handle:void 0}let[i,{mutate:a}]=yo(e,c=>o.findWithProgress(c).whenReady(),{initialValue:n()});return _o(()=>{re(e)||a()}),i}function De(e,r){let t=pe(e,r);return[Te(t),t]}import{onCleanup as ls}from"solid-js";import{createSignal as cs}from"solid-js";import{createEffect as hs,onCleanup as fs}from"solid-js";import{createSignal as gs}from"solid-js";import{useContext as ks}from"solid-js";import{getType as To}from"@inkandswitch/patchwork-filesystem";import{getRegistry as Ao,isLoadedPlugin as Do}from"@inkandswitch/patchwork-plugins";import{createEffect as Io,createMemo as Ie,createSignal as Xe,onCleanup as Ro,onMount as Rt,Show as Ft}from"solid-js";var It=At("<span class=threepane__title-text>"),Eo=At("<input class=threepane__title-input type=text>");function Lt(e){let r,[t,o]=Xe();return Rt(()=>{o(r.closest("repo-provider")?.repo)}),Ye(Ft,{get when(){return t()},get fallback(){return(()=>{var n=It(),i=r;return typeof i=="function"?Dt(i,n):r=n,n})()},children:n=>Ye(Fo,{get docUrl(){return e.docUrl},get repo(){return n()}})})}function Fo(e){let[r,t]=De(()=>e.docUrl(),{repo:e.repo}),o=Ao("patchwork:datatype"),[n,i]=Xe(0);Rt(()=>{let g=o.on("changed",()=>i(f=>f+1));Ro(g)});let a=Ie(()=>{let g=r();return g?To(g):void 0});Io(()=>{let g=a();g&&o.load(g)});let c=Ie(()=>{n();let g=a();if(!g)return;let f=o.get(g);return f&&Do(f)?f:void 0}),l=Ie(()=>{let g=r(),f=c();if(!(!g||!f))return f.module.getTitle(g)}),d=Ie(()=>!!t()&&typeof c()?.module.setTitle=="function"),[s,u]=Xe(!1),h;function b(){d()&&(u(!0),queueMicrotask(()=>{h?.focus(),h?.select()}))}function w(g){if(!s()||(u(!1),!g))return;let f=h?.value.trim();if(!f||f===l())return;let m=t(),y=c()?.module.setTitle;!m||!y||m.change(A=>{y(A,f);let D=A["@patchwork"];D&&(D.title=f)})}return Ye(Ft,{get when(){return s()},get fallback(){return(()=>{var g=It();return g.$$click=b,So(g,()=>l()??"Untitled"),Tt(f=>{var m=!!d(),y=d()?"Rename":void 0;return m!==f.e&&g.classList.toggle("threepane__title-text--editable",f.e=m),y!==f.t&&$o(g,"title",f.t=y),f},{e:void 0,t:void 0}),g})()},get children(){var g=Eo();g.$$keydown=m=>{m.key==="Enter"?(m.preventDefault(),w(!0)):m.key==="Escape"&&(m.preventDefault(),w(!1))},g.addEventListener("blur",()=>w(!0));var f=h;return typeof f=="function"?Dt(f,g):h=g,Tt(()=>g.value=l()??""),g}})}Co(["keydown","click"]);import{template as me}from"solid-js/web";import{delegateEvents as Jo}from"solid-js/web";import{getOwner as Vo}from"solid-js/web";import{insert as fe}from"solid-js/web";import{createComponent as oe}from"solid-js/web";import{Show as Ge}from"solid-js";import{template as Ot}from"solid-js/web";import{delegateEvents as Lo}from"solid-js/web";import{setStyleProperty as Po}from"solid-js/web";import{insert as Mo}from"solid-js/web";import{setAttribute as Re}from"solid-js/web";import{effect as Pt}from"solid-js/web";import{memo as he}from"solid-js/web";import{createComponent as Mt}from"solid-js/web";import{Show as zt}from"solid-js";var zo=Ot('<button class="sidebar-toggle sidebar-toggle--resizable">'),Oo=Ot("<div class=sidebar>");function Ut(e){let r=()=>`${e.isCollapsed()?0:e.width()}px`,t=()=>e.canExpand?.()??!0,o=()=>Mt(zt,{get when(){return!e.isCollapsed()},get children(){return e.children}}),n=()=>Mt(zt,{get when(){return!e.isCollapsed()||t()},get children(){var i=zo();return i.$$mousedown=a=>e.onMouseDown(a),i.$$click=a=>e.onToggleClick(a),Pt(a=>{var c=e.isCollapsed()?"Expand sidebar":"Toggle or resize sidebar",l=e.isCollapsed()?"Click to expand, drag to resize":"Click to toggle, drag to resize";return c!==a.e&&Re(i,"aria-label",a.e=c),l!==a.t&&Re(i,"title",a.t=l),a},{e:void 0,t:void 0}),i}});return(()=>{var i=Oo();return Mo(i,(()=>{var a=he(()=>e.side==="left");return()=>a()?[he(o),he(n)]:[he(n),he(o)]})()),Pt(a=>{var c=e.side,l=e.isCollapsed()?"":void 0,d=r();return c!==a.e&&Re(i,"data-side",a.e=c),l!==a.t&&Re(i,"data-collapsed",a.t=l),d!==a.a&&Po(i,"width",a.a=d),a},{e:void 0,t:void 0,a:void 0}),i})()}Lo(["click","mousedown"]);import{template as Wt}from"solid-js/web";import{delegateEvents as Uo}from"solid-js/web";import{setAttribute as jo}from"solid-js/web";import{effect as Wo}from"solid-js/web";import{insert as jt}from"solid-js/web";import{createComponent as No}from"solid-js/web";import{For as Bo}from"solid-js";var Ho=Wt("<div role=tablist class=context-sidebar__tablist>"),qo=Wt("<button type=button role=tab class=context-sidebar__tab>");function Nt(e){let r=()=>{let t=e.items().map(n=>n.id),o=e.selectedToolId();return o&&t.includes(o)?o:t[0]};return(()=>{var t=Ho();return jt(t,No(Bo,{get each(){return e.items()},children:o=>(()=>{var n=qo();return n.$$click=()=>e.setSelectedToolId(o.id),jt(n,()=>o.name),Wo(()=>jo(n,"data-active",r()===o.id?"":void 0)),n})()})),t})()}Uo(["click"]);var Yo=me('<div class=context-sidebar__tabs><button type=button class=context-sidebar__close title="Hide context sidebar"aria-label="Hide context sidebar">'),Xo=me("<div class=context-sidebar__content>"),Go=me("<div class=context-sidebar>"),Ko=me("<patchwork-view>",!0,!1,!1),Zo=me('<svg xmlns=http://www.w3.org/2000/svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=var(--studio-chrome-line) stroke-width=1.75 stroke-linecap=round stroke-linejoin=round><rect width=18 height=18 x=3 y=3 rx=2></rect><path d="M15 3v18">');function Ht(e){let r=ce("context-tool"),t=()=>{let o=r().map(i=>i.id),n=e.selectedToolId();return n&&o.includes(n)?n:o[0]};return oe(Ut,{side:"right",get isCollapsed(){return e.isCollapsed},get width(){return e.width},get onMouseDown(){return e.onMouseDown},get onToggleClick(){return e.onToggleClick},get canExpand(){return e.canExpand},get children(){var o=Go();return fe(o,oe(Ge,{get when(){return r().length},get children(){var n=Yo(),i=n.firstChild;return fe(n,oe(Nt,{items:r,get selectedToolId(){return e.selectedToolId},get setSelectedToolId(){return e.setSelectedToolId}}),i),i.$$click=()=>e.onCollapse(),fe(i,oe(Ke,{})),n}}),null),fe(o,oe(Ge,{get when(){return!e.isCollapsed()},get children(){var n=Xo();return fe(n,oe(Ge,{get when(){return t()},keyed:!0,children:i=>(()=>{var a=Ko();return a.component=i,a._$owner=Vo(),a})()})),n}}),null),o}})}function Ke(){return Zo()}Jo(["click"]);import{template as Qo}from"solid-js/web";import{effect as qt}from"solid-js/web";import{getOwner as Bt}from"solid-js/web";import{createComponent as en}from"solid-js/web";import{memo as tn}from"solid-js/web";import{Show as rn}from"solid-js";var Jt=Qo("<patchwork-view>",!0,!1,!1),Ze=e=>Array.isArray(e)?String(e[0]):String(e);function Fl(e){let r=new Set;return e.filter(t=>{let o=Ze(t);return r.has(o)?!1:(r.add(o),!0)})}function Ll(e){return en(rn,{get when(){return tn(()=>!!Array.isArray(e.slot))()?e.slot:!1},get fallback(){return(()=>{var r=Jt();return r._$owner=Bt(),qt(()=>r.component=String(e.slot)),r})()},children:r=>(()=>{var t=Jt();return t._$owner=Bt(),qt(o=>{var n=r()[1],i=r()[0];return n!==o.e&&(t.docUrl=o.e=n),i!==o.t&&(t.toolId=o.t=i),o},{e:void 0,t:void 0}),t})()})}var sn=ge("<div class=threepane__title>"),ln=ge("<div class=threepane__doctitle-tools>"),dn=ge('<button type=button class=frame__sidebar-toggle title="Show context sidebar"aria-label="Show context sidebar">'),cn=ge("<div class=frame__topbar><div class=threepane__spacer>"),un=ge("<patchwork-view>",!0,!1,!1);function Xt(e){let r=()=>e.toolSlots()??[];return(()=>{var t=cn(),o=t.firstChild;return ne(t,ae(Qe,{get when(){return e.docUrl()},get children(){var n=sn();return ne(n,ae(Lt,{get docUrl(){return e.docUrl}})),n}}),o),ne(t,ae(Qe,{get when(){return Yt(()=>!!e.docUrl())()&&r().length},get children(){var n=ln();return ne(n,ae(pn,{get each(){return r()},children:i=>(()=>{var a=un();return a._$owner=nn(),Vt(c=>{var l=Ze(i),d=e.docUrl();return l!==c.e&&(a.toolId=c.e=l),d!==c.t&&(a.docUrl=c.t=d),c},{e:void 0,t:void 0}),a})()})),n}}),null),ne(t,ae(Qe,{get when(){return Yt(()=>!!e.hasContext())()&&e.isRightCollapsed()},get children(){var n=dn();return n.$$click=()=>e.onToggleRight(),an(n,"aria-pressed",!1),ne(n,ae(Ke,{})),n}}),null),Vt(()=>t.classList.toggle("frame__topbar--left-collapsed",!!e.isLeftCollapsed())),t})()}on(["click"]);import{template as je}from"solid-js/web";import{effect as wr}from"solid-js/web";import{getOwner as _r}from"solid-js/web";import{insert as B}from"solid-js/web";import{createComponent as R}from"solid-js/web";import{memo as Ue}from"solid-js/web";import{use as yr}from"solid-js/web";import{parseAutomergeUrl as Ea}from"@automerge/automerge-repo/slim";import{getSuggestedImportUrl as Ta,getType as Aa}from"@inkandswitch/patchwork-filesystem";import{getFallbackTool as Da,getRegistry as Ia}from"@inkandswitch/patchwork-plugins";import{createEffect as vr,createMemo as Oe,createSignal as q,onCleanup as se,onMount as Ra,Show as H}from"solid-js";import{template as $}from"solid-js/web";import{delegateEvents as Kn}from"solid-js/web";import{setAttribute as Me}from"solid-js/web";import{effect as nt}from"solid-js/web";import"solid-js/web";import{createComponent as I}from"solid-js/web";import{insert as T}from"solid-js/web";import{use as Zn}from"solid-js/web";import{importPackage as wa}from"@inkandswitch/patchwork-filesystem";import{registerPlugins as _a}from"@inkandswitch/patchwork-plugins";import{createResource as ya,createSignal as ve,onCleanup as ur,onMount as xa,Show as N}from"solid-js";import{template as C}from"solid-js/web";import{delegateEvents as _n}from"solid-js/web";import{effect as sr}from"solid-js/web";import{memo as yn}from"solid-js/web";import{insert as v}from"solid-js/web";import{createComponent as x}from"solid-js/web";import{use as xn}from"solid-js/web";import{setAttribute as be}from"solid-js/web";import{createResource as Bn,createSignal as Le,For as ot,Match as ie,onMount as Jn,Show as L,Switch as or}from"solid-js";import*as Kt from"@automerge/automerge/slim";import{getImportableUrlFromAutomergeUrl as hn}from"@inkandswitch/patchwork-filesystem";var et=e=>e.startsWith("automerge:");function fn(e){return e.replace(/[#?].*$/,"")}function Zt(e){let r=e.split("#")[1];return r?r.split("|").filter(Boolean):[]}var O=e=>typeof e=="string"&&e.trim()?e.trim():void 0;function mn(e){if(typeof e=="string")return O(e);if(e&&typeof e=="object"){let{name:r,email:t}=e,o=O(r),n=O(t);return o&&n?`${o} <${n}>`:o??n}}function Qt(e){if(!e||typeof e!="object")return{};let r=e,t=r.supportedDatatypes;return{id:O(r.id),name:O(r.name),type:O(r.type),supportedDatatypes:typeof t=="string"?[t]:Array.isArray(t)?t.filter(o=>typeof o=="string"):void 0}}async function Gt(e){try{let r=await fetch(e);return r.ok?await r.json():void 0}catch{return}}var gn=new Set(["dist","build","lib","out","esm","src","public"]);async function bn(e){if(et(e)){let o=hn(e);return Gt(new URL("package.json",o).href)}let r;try{r=new URL(e)}catch{return}let t=r.pathname.split("/").filter(Boolean);for(/\.[a-z0-9]+$/i.test(t.at(-1)??"")&&t.pop();;){let o=`${r.origin}/${t.join("/")}${t.length?"/":""}`,n=await Gt(new URL("package.json",o).href);if(n&&typeof n=="object")return n;if(!gn.has(t.at(-1)?.toLowerCase()??""))return;t.pop()}}async function er(e){let r=await bn(e);if(r)return{name:O(r.name),title:O(r.title),version:O(r.version),description:O(r.description),author:mn(r.author),plugins:Array.isArray(r.plugins)?r.plugins.map(Qt):void 0}}var Fe,vn=1,G=new Map;function wn(){if(Fe)return Fe;let e=new Worker("/module-loader-worker.js",{type:"module",name:"threepane-package-preview"});return e.addEventListener("message",r=>{let t=r.data,o=t&&G.get(t.id);o&&(G.delete(t.id),t.type==="descriptors"?o.resolve(t.descriptors.map(Qt)):o.reject(new Error(t.error)))}),e.addEventListener("error",r=>{let t=new Error(`the background worker stopped: ${r.message??"no reason given"}`);for(let o of G.values())o.reject(t);G.clear(),Fe=void 0}),Fe=e,e}function tr(e,r=15e3){let t=vn++;return new Promise((o,n)=>{let i=setTimeout(()=>{G.delete(t)&&n(new Error("it took too long to answer"))},r);G.set(t,{resolve:a=>{clearTimeout(i),o(a)},reject:a=>{clearTimeout(i),n(a)}});try{wn().postMessage({type:"discover",id:t,url:e})}catch(a){clearTimeout(i),G.delete(t),n(a instanceof Error?a:new Error(String(a)))}})}async function rr(e,r){let t=await e.find(fn(r)),o=t.doc();await new Promise(a=>setTimeout(a,0));let n=Kt.getChangesMetaSince(o,[]),i=new Map;for(let a of n){let c=a.time??0,l=i.get(a.actor);if(!l){i.set(a.actor,{actor:a.actor,changes:1,first:c,last:c});continue}l.changes++,c&&(!l.first||c<l.first)&&(l.first=c),c>l.last&&(l.last=c)}return{heads:[...t.heads()],changes:n.length,writers:[...i.values()].sort((a,c)=>c.changes-a.changes)}}var kn=C("<button type=button class=doc-card__link>see package details"),Cn=C("<p class=pkg-about__quiet>reading\u2026"),$n=C("<p class=pkg-about__quiet>no package.json."),Sn=C("<dl class=pkg-about__facts><dt>plugins</dt><dd>"),En=C("<dt>pinned"),rt=C("<dd>"),tt=C("<dt>history"),Tn=C("<dd class=pkg-about__quiet>reading\u2026"),An=C("<dd class=pkg-about__quiet>couldn't get its folder."),Dn=C('<div class=pkg-about popover=auto><header class=pkg-about__header><h3 class=doc-card__rough></h3><button type=button class="doc-card__link pkg-about__close"popovertargetaction=hide aria-label=close>\xD7</button></header><section class="pkg-about__section pkg-about__section--claims"><h4>self-reported <span class=pkg-about__tag>unverified</span></h4></section><section class=pkg-about__section><h4>source</h4><dl class=pkg-about__facts><dt>url</dt><dd><code class="doc-card__code doc-card__url">'),In=C("<span class=pkg-about__version> "),Rn=C("<button type=button class=doc-card__link>"),Fn=C("<span class=pkg-about__quiet>unknown until loaded"),Ln=C("<p class=doc-card__notice>"),Pn=C("<dt>heads"),Mn=C("<dd> <!>, <!> <p class=pkg-about__quiet>writers are devices, not people. folder only."),zn=C("<dt>"),lr=C("<ul class=pkg-about__list>"),On=C("<span>nothing"),Un=C("<span class=pkg-about__quiet> for "),jn=C("<li>"),dr=C("<span class=pkg-about__quiet> \xB7 "),Wn=C("<span class=pkg-about__heads>"),Nn=C("<code class=doc-card__code>"),Hn=C("<li class=pkg-about__quiet>and <!> more"),qn=C("<li><code class=doc-card__code></code> <!> "),Vn=0;function cr(e){let r=`pkg-about-${++Vn}`,t=et(e.url),o=Zt(e.url),[n,i]=Le(!1),[a]=Bn(()=>n()&&t?e.url:void 0,m=>rr(e.repo,m)),[c,l]=Le(!1),[d,s]=Le(),[u,h]=Le();async function b(){if(window.confirm(`Listing its plugins runs the package's code in a background worker.
2
+
3
+ ${e.url}
4
+
5
+ It can use the network and this site's stored data, including your documents. Only run it if you trust where it came from.
6
+
7
+ Run it?`)){h(void 0),l(!0);try{s(await tr(e.url))}catch(y){h(y?.message??String(y))}finally{l(!1)}}}let w;Jn(()=>{w.addEventListener("toggle",m=>{m.newState==="open"&&i(!0)})});let g=()=>e.claims?.title??e.claims?.name??"package",f=()=>d()??e.claims?.plugins;return[(()=>{var m=kn();return be(m,"popovertarget",r),m})(),(()=>{var m=Dn(),y=m.firstChild,A=y.firstChild,D=A.nextSibling,U=y.nextSibling,V=U.firstChild,Y=U.nextSibling,z=Y.firstChild,j=z.nextSibling,le=j.firstChild,de=le.nextSibling,_e=de.firstChild,ye=w;return typeof ye=="function"?xn(ye,m):w=m,be(m,"id",r),v(A,g,null),v(A,x(L,{get when(){return e.claims?.version},children:S=>(()=>{var p=In(),_=p.firstChild;return v(p,S,null),p})()}),null),be(D,"popovertarget",r),v(U,x(or,{get children(){return[x(ie,{get when(){return e.claimsLoading},get children(){return Cn()}}),x(ie,{get when(){return yn(()=>!e.claims)()&&!d()},get children(){return $n()}}),x(ie,{when:!0,get children(){var S=Sn(),p=S.firstChild,_=p.nextSibling;return v(S,x(Pe,{label:"name",get value(){return e.claims?.name}}),p),v(S,x(Pe,{label:"title",get value(){return e.claims?.title}}),p),v(S,x(Pe,{label:"author",get value(){return e.claims?.author}}),p),v(S,x(Pe,{label:"description",get value(){return e.claims?.description}}),p),v(_,x(L,{get when(){return f()},get fallback(){return x(L,{when:t,get fallback(){return Fn()},get children(){var k=Rn();return k.$$click=()=>void b(),v(k,()=>c()?"listing\u2026":"list them"),sr(()=>k.disabled=c()),k}})},children:k=>x(Yn,{get plugins(){return k()}})}),null),v(_,x(L,{get when(){return u()},children:k=>(()=>{var E=Ln();return v(E,k),E})()}),null),S}})]}}),null),v(_e,()=>e.url),v(j,x(L,{get when(){return o.length},get children(){return[En(),(()=>{var S=rt();return v(S,x(nr,{heads:o})),S})()]}}),null),v(j,x(L,{when:t,get children(){return x(or,{get children(){return[x(ie,{get when(){return a.loading},get children(){return[tt(),Tn()]}}),x(ie,{get when(){return a.error},get children(){return[tt(),An()]}}),x(ie,{get when(){return a()},children:S=>[Pn(),(()=>{var p=rt();return v(p,x(nr,{get heads(){return S().heads}})),p})(),tt(),(()=>{var p=Mn(),_=p.firstChild,k=_.nextSibling,E=k.nextSibling,P=E.nextSibling,M=P.nextSibling,it=M.nextSibling;return v(p,()=>S().changes,_),v(p,()=>S().changes===1?"change":"changes",k),v(p,()=>S().writers.length,P),v(p,()=>S().writers.length===1?"writer":"writers",it),v(p,x(Xn,{get writers(){return S().writers}}),it),p})()]})]}})}}),null),m})()]}function Pe(e){return x(L,{get when(){return e.value},get children(){return[(()=>{var r=zn();return v(r,()=>e.label),r})(),(()=>{var r=rt();return v(r,()=>e.value),r})()]}})}function Yn(e){return x(L,{get when(){return e.plugins.length},get fallback(){return On()},get children(){var r=lr();return v(r,x(ot,{get each(){return e.plugins},children:t=>(()=>{var o=jn();return v(o,()=>t.name??t.id??"(unnamed)",null),v(o,x(L,{get when(){return t.type},children:n=>(()=>{var i=dr(),a=i.firstChild;return v(i,n,null),i})()}),null),v(o,x(L,{get when(){return t.supportedDatatypes?.length},get children(){var n=Un(),i=n.firstChild;return v(n,()=>t.supportedDatatypes.join(", "),null),n}}),null),o})()})),r}})}function nr(e){return(()=>{var r=Wn();return v(r,x(ot,{get each(){return e.heads},children:t=>(()=>{var o=Nn();return be(o,"title",t),v(o,()=>t.slice(0,7)),o})()})),r})()}var ar=6;function Xn(e){let r=()=>e.writers.length-ar;return(()=>{var t=lr();return v(t,x(ot,{get each(){return e.writers.slice(0,ar)},children:o=>(()=>{var n=qn(),i=n.firstChild,a=i.nextSibling,c=a.nextSibling,l=c.nextSibling;return v(i,()=>o.actor.slice(0,8)),v(n,()=>o.changes,c),v(n,()=>o.changes===1?"change":"changes",null),v(n,x(L,{get when(){return o.last},get children(){var d=dr(),s=d.firstChild;return v(d,()=>Gn(o),null),d}}),null),sr(()=>be(i,"title",o.actor)),n})()}),null),v(t,x(L,{get when(){return r()>0},get children(){var o=Hn(),n=o.firstChild,i=n.nextSibling,a=i.nextSibling;return v(o,r,i),o}}),null),t})()}function ir(e){return new Date(e*1e3).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Gn(e){let r=ir(e.last),t=e.first?ir(e.first):r;return t===r?r:`${t} \u2013 ${r}`}_n(["click"]);var Qn=$("<div class=doc-card><svg class=doc-card__defs aria-hidden=true><filter id=doc-card-rough><feTurbulence type=fractalNoise baseFrequency=0.04 numOctaves=2 seed=1></feTurbulence><feDisplacementMap in=SourceGraphic scale=1.4></feDisplacementMap></filter></svg><div class=doc-card__sheet><h2 class=doc-card__rough>"),ea=$('<div class="doc-card doc-card--finding"role=status><span class=doc-card__dot></span><span class=doc-card__finding-label>finding this doc\u2026'),ta=$("<p>it's a <code class=doc-card__code></code>.<br>nothing here opens one yet."),ra=$("<p class=doc-card__links>"),oa=$("<p>it'll open here if a package adds a tool for it."),na=$("<p>the doc suggests "),pr=$('<div class=doc-card__actions><button type=button class="doc-card__button doc-card__button--primary">'),aa=$("<strong class=pkg-line>"),ia=$("<span class=pkg-line__version> "),sa=$("<p class=doc-card__notice>couldn't load it: "),la=$("<button type=button class=doc-card__link>open doc with "),da=$("<p>we couldn't get it from anywhere we looked.<br>that might mean:"),ca=$("<ul class=doc-card__reasons><li>the person who sent you the link hasn't given you access yet</li><li>it hasn't finished syncing from their device yet</li><li>something's wrong with the "),ua=$("<p>we'll keep looking. if it turns up, it'll open right here."),pa=$("<button type=button class=doc-card__sync>sync server"),ha=$("<span class=doc-card__sync-told role=status> (<!>)"),fa=$("<p>the doc is here, but the tool that shows it didn't load."),ma=$("<p class=doc-card__notice>"),ga=$("<p>a bit of it got lost or changed on the way here, so it can't point at any doc. maybe a character dropped when it was copied, or the link got cut short."),ba=$("<p>if someone sent it to you, ask them for the link again."),va=$('<p class=doc-card__aside><code class="doc-card__code doc-card__url">');function ze(e){let r;return xa(()=>{r.dispatchEvent(new CustomEvent("patchwork:no-tool",{bubbles:!0,composed:!0,detail:{url:e.url}}))}),(()=>{var t=Qn(),o=t.firstChild,n=o.nextSibling,i=n.firstChild,a=r;return typeof a=="function"?Zn(a,t):r=t,T(i,()=>e.title),T(n,()=>e.children,null),t})()}function hr(){return ea()}function fr(e){let[r,t]=ve(!1),[o,n]=ve(),[i]=ya(()=>e.suggestion,l=>er(l).catch(()=>{}));async function a(l){if(window.confirm(`Load this package?
8
+
9
+ ${l}
10
+
11
+ Its code runs in this page and can read and change your documents. Only load it if you trust where it came from.`)){n(void 0),t(!0);try{let s=await wa(l);if(!Array.isArray(s?.plugins))throw new Error("it doesn't export any plugins");_a(s.plugins,l)}catch(s){console.error(`couldn't load the package at ${l}`,s),n(s?.message??String(s))}finally{t(!1)}}}let c=()=>{let l=i();return l&&(l.title||l.name)?l:void 0};return I(ze,{get url(){return e.url},title:"no tool for this",get children(){return[(()=>{var l=ta(),d=l.firstChild,s=d.nextSibling;return T(s,()=>e.type),l})(),I(N,{get when(){return e.suggestion},get fallback(){return oa()},children:l=>[(()=>{var d=na(),s=d.firstChild;return T(d,I(N,{get when(){return c()},fallback:"a package.",children:u=>[(()=>{var h=aa();return T(h,()=>u().title??u().name),h})(),I(N,{get when(){return u().version},children:h=>(()=>{var b=ia(),w=b.firstChild;return T(b,h,null),b})()}),"."]}),null),d})(),(()=>{var d=pr(),s=d.firstChild;return s.$$click=()=>void a(l()),T(s,()=>r()?"loading\u2026":"load package"),nt(()=>s.disabled=r()),d})(),I(N,{get when(){return o()},children:d=>(()=>{var s=sa(),u=s.firstChild;return T(s,d,null),s})()})]}),I(N,{get when(){return e.suggestion||e.anything},get children(){var l=ra();return T(l,I(N,{get when(){return e.suggestion},children:d=>I(cr,{get url(){return d()},get repo(){return e.repo},get claims(){return i()},get claimsLoading(){return i.loading}})}),null),T(l,I(N,{get when(){return e.anything},children:d=>(()=>{var s=la(),u=s.firstChild;return s.$$click=()=>e.onPeek(d().id),T(s,()=>d().name.toLowerCase(),null),s})()}),null),l}})]}})}function mr(e){let r=e.repo,t=typeof r.isSubductionConnected=="function",[o,n]=ve(t?r.isSubductionConnected():void 0),i=a=>{let c=o();n(a),a&&c===!1&&e.onRetry()};if(t&&r.on&&r.off){let a=c=>i(c.connected);r.on("subduction-connection",a),ur(()=>r.off("subduction-connection",a))}if(t){let a=setInterval(()=>i(r.isSubductionConnected()),2e3);ur(()=>clearInterval(a))}return I(ze,{get url(){return e.url},title:"can't load this doc",get children(){return[da(),(()=>{var a=ca(),c=a.firstChild,l=c.nextSibling,d=l.nextSibling,s=d.firstChild;return T(d,I(N,{get when(){return o()!==void 0},fallback:"sync server",get children(){return I(ka,{get connected(){return o()}})}}),null),a})(),ua()]}})}function ka(e){let[r,t]=ve(!1),o=()=>`sync server: ${e.connected?"connected":"disconnected"}`;return[(()=>{var n=pa();return n.$$click=()=>t(i=>!i),nt(i=>{var a=e.connected?"":void 0,c=o(),l=o(),d=r();return a!==i.e&&Me(n,"data-connected",i.e=a),c!==i.t&&Me(n,"title",i.t=c),l!==i.a&&Me(n,"aria-label",i.a=l),d!==i.o&&Me(n,"aria-expanded",i.o=d),i},{e:void 0,t:void 0,a:void 0,o:void 0}),n})(),I(N,{get when(){return r()},get children(){var n=ha(),i=n.firstChild,a=i.nextSibling,c=a.nextSibling;return T(n,()=>e.connected?"connected":"disconnected",a),n}})]}function gr(e){let[r,t]=ve(!1),o=async()=>{t(!0);try{await e.onRetry()}finally{t(!1)}};return I(ze,{get url(){return e.url},get title(){return`can't load ${e.name}`},get children(){return[fa(),(()=>{var n=ma();return T(n,()=>e.error),n})(),(()=>{var n=pr(),i=n.firstChild;return i.$$click=()=>void o(),T(i,()=>r()?"trying\u2026":"try again"),nt(()=>i.disabled=r()),n})()]}})}function br(e){return I(ze,{get url(){return e.url},title:"this link is broken",get children(){return[ga(),ba(),(()=>{var r=va(),t=r.firstChild;return T(t,()=>e.url),r})()]}})}Kn(["click"]);var Ca=je("<div class=document-view>"),xr=je("<patchwork-view>",!0,!1,!1),$a=je("<div class=placeholder>Select a document in the sidebar"),Sa=je("<div class=doc-stack>");function kr({viewKey:e,selectedDocUrl:r,toolId:t,ref:o}){let n,[i,a]=q();return Ra(()=>{a(n.closest("repo-provider")?.repo??null)}),(()=>{var c=Ca();return yr(l=>{n=l,o?.(l)},c),B(c,R(H,{get when(){return Ue(()=>i()!==void 0)()&&e()},keyed:!0,children:l=>R(H,{get when(){return i()},get fallback(){return(()=>{var d=xr();return d._$owner=_r(),wr(s=>{var u=r(),h=t();return u!==s.e&&(d.docUrl=s.e=u),h!==s.t&&(d.toolId=s.t=h),s},{e:void 0,t:void 0}),d})()},children:d=>R(Fa,{get url(){return r()},toolId:t,get repo(){return d()}})})}),null),B(c,(()=>{var l=Ue(()=>!r());return()=>l()&&$a()})(),null),c})()}function Fa(e){let r=Ia("patchwork:tool"),[t,o]=q(0);se(r.on("changed",()=>{o(p=>p+1)}));let[n,i]=q({state:"finding"}),[a,c]=q(),l=()=>e.toolId()??a(),[d,s]=q(!1),[u,h]=q(0),b=!1;se(()=>b=!0);async function w(){try{let p=await e.repo.find(e.url);if(b)return;let _=n().state==="unavailable";i({state:"ready",doc:p.doc()}),_&&!d()&&h(k=>k+1)}catch(p){if(b)return;let _=Pa(p);i({state:_?"invalid":"unavailable"}),_||f(k=>k+1)}}let[g,f]=q(0),m,y;function A(){y?.(),m=La(e.repo,e.url),y=m?.subscribe(p=>{p.state==="ready"&&n().state==="unavailable"&&w()})}se(()=>y?.()),w(),A();function D(){let p=e.repo;if(typeof p.resyncSubduction=="function")try{p.resyncSubduction(Ea(e.url).documentId)}catch{}}let U;se(()=>clearTimeout(U));function V(p=1e3){D(),clearTimeout(U),U=setTimeout(()=>void w(),p)}vr(()=>{let p=g();p===0||n().state!=="unavailable"||d()||(V(Math.min(3e4,3e3*2**(p-1))),se(()=>clearTimeout(U)))});let Y=Oe(()=>{t();let p=n();if(p.state!=="ready")return p;let _=p.doc,k=_?Aa(_):void 0;if(!k)return{state:"open",toolId:void 0};let E=l(),P;if(!E){let M=Cr(()=>Da(_));M&&Ma(M.supportedDatatypes,k)?P={id:M.id,name:M.name}:M&&(E=M.id)}return E&&r.get(E)?{state:"open",toolId:E}:{state:"no-tool",type:k,suggestion:Ta(_),anything:P}}),z=Oe(()=>Y().state),j=Oe(()=>{let p=Y();return p.state==="open"?p.toolId:void 0}),[le,de]=q();async function _e(p){try{return await r.load(p),j()===p&&de(void 0),!0}catch(_){return j()===p&&de({id:p,message:_ instanceof Error?_.message:String(_)}),!1}}vr(()=>{let p=j();de(void 0),p&&_e(p)});async function ye(){let p=le()?.id;p&&await _e(p)&&h(_=>_+1)}let S=Oe(()=>{let p=Y();return p.state==="no-tool"?p:void 0});return(()=>{var p=Sa();return yr(_=>{let k=E=>{let P=E.detail;P?.url&&P.url!==e.url||(s(!0),n().state==="unavailable"&&w())};_.addEventListener("patchwork:mounted",k),se(()=>_.removeEventListener("patchwork:mounted",k))},p),B(p,R(H,{get when(){return Ue(()=>z()==="open")()&&!le()||z()==="unavailable"},get children(){return R(H,{get when(){return u()+1},keyed:!0,children:_=>(()=>{var k=xr();return k._$owner=_r(),wr(E=>{var P=e.url,M=l();return P!==E.e&&(k.docUrl=E.e=P),M!==E.t&&(k.toolId=E.t=M),E},{e:void 0,t:void 0}),k})()})}}),null),B(p,R(H,{get when(){return z()==="finding"},get children(){return R(hr,{})}}),null),B(p,R(H,{get when(){return le()},children:_=>R(gr,{get url(){return e.url},get name(){return r.get(_().id)?.name??_().id},get error(){return _().message},onRetry:ye})}),null),B(p,R(H,{get when(){return z()==="invalid"},get children(){return R(br,{get url(){return e.url}})}}),null),B(p,R(H,{get when(){return Ue(()=>z()==="unavailable")()&&!d()},get children(){return R(mr,{get url(){return e.url},get repo(){return e.repo},onRetry:V})}}),null),B(p,R(H,{get when(){return S()},children:_=>R(fr,{get url(){return e.url},get type(){return _().type},get suggestion(){return _().suggestion},get anything(){return _().anything},onPeek:c,get repo(){return e.repo}})}),null),p})()}function La(e,r){let t=e.findWithProgress;if(typeof t=="function")return Cr(()=>{let o=t.call(e,r);return typeof o?.subscribe=="function"&&typeof o?.peek=="function"?o:void 0})}function Pa(e){let r=e?.message??String(e);return/invalid (automergeurl|document url|documentid|document id)/i.test(r)}function Ma(e,r){let t=e==="*"?["*"]:e??[];return t.includes("*")&&!t.includes(r)}function Cr(e){try{return e()}catch{return}}var za=at("<patchwork-view component=patchwork-draft-state-provider>",!0,!1,!1),Oa=at("<div class=frame__main-column><div class=frame__doc-column><div class=main-area>"),Ua=at("<patchwork-view component=patchwork-draft-overlay-provider><patchwork-view component=patchwork-comments-provider><patchwork-view component=patchwork-focus-provider>",!0,!1,!1);function Tr(e){let[r,t]=K(e.initialRightCollapsed()),[o,n]=K(e.initialRightWidth());$r(Er(r,h=>{try{localStorage.setItem(W.rightCollapsed,String(h))}catch{}},{defer:!0})),$r(Er(o,h=>{try{localStorage.setItem(W.rightWidth,String(h))}catch{}},{defer:!0}));let i=Ve("right",{isCollapsed:r,setCollapsed:t,setWidth:n});Wa(()=>{let h=()=>t(!0);window.addEventListener(xe,h),ja(()=>window.removeEventListener(xe,h))});let[a,c]=Je(K(),{name:W.contextToolId}),[l,d]=K(),s=Z("patchwork-draft-state-provider",l),u=()=>s()?l():void 0;return J(He,{get when(){return e.selectedDocUrl()},keyed:!0,children:h=>(()=>{var b=za();return Ne(d,b),b.docUrl=h,b._$owner=We(),we(b,J(He,{get when(){return u()},children:w=>J(Na,{get host(){return w()},get setMainDocElement(){return e.setMainDocElement},get selectedDocUrl(){return e.selectedDocUrl},get selectedToolId(){return e.selectedToolId},get doctitleSlots(){return e.doctitleSlots},get isLeftCollapsed(){return e.isLeftCollapsed},isRightSidebarCollapsed:r,setIsRightSidebarCollapsed:t,rightSidebarWidth:o,get handleMouseDown(){return i.handleMouseDown},get handleToggleClick(){return i.handleToggleClick},selectedContextToolId:a,setSelectedContextToolId:c})})),b})()})}function Na(e){let r=ce("context-tool"),t=()=>r().length>0,o=Sr(()=>e.selectedDocUrl()),[n,i]=K(),a=Z("patchwork-draft-overlay-provider",n),[c,l]=K(),d=Z("patchwork-comments-provider",c),[s,u]=K(),h=Z("patchwork-focus-provider",s),b=Sr(()=>a()&&d()&&h());return(()=>{var w=Ua(),g=w.firstChild,f=g.firstChild;return Ne(i,w),w._$owner=We(),Ne(l,g),g._$owner=We(),Ne(u,f),f._$owner=We(),we(f,J(He,{get when(){return b()},get children(){var m=Oa(),y=m.firstChild,A=y.firstChild;return we(y,J(Xt,{get docUrl(){return e.selectedDocUrl},get toolSlots(){return e.doctitleSlots},get isLeftCollapsed(){return e.isLeftCollapsed},hasContext:t,get isRightCollapsed(){return e.isRightSidebarCollapsed},onToggleRight:()=>e.setIsRightSidebarCollapsed(D=>!D)}),A),we(A,J(kr,{viewKey:o,get selectedDocUrl(){return e.selectedDocUrl},get toolId(){return e.selectedToolId},ref:D=>e.setMainDocElement?.(D)})),we(m,J(He,{get when(){return t()},get children(){return J(Ht,{get selectedToolId(){return e.selectedContextToolId},get setSelectedToolId(){return e.setSelectedContextToolId},get isCollapsed(){return e.isRightSidebarCollapsed},get width(){return e.rightSidebarWidth},get onMouseDown(){return e.handleMouseDown},get onToggleClick(){return e.handleToggleClick},onCollapse:()=>e.setIsRightSidebarCollapsed(!0)})}}),null),m}})),w})()}var qe=`:root,
12
+ :host,
13
+ [theme] {
14
+ --threepane-bg: var(--studio-fill, white);
15
+ --threepane-sidebar-fill: var(--studio-chrome, var(--studio-fill, white));
16
+ --threepane-fg: var(--studio-line, black);
17
+ /* ink for text sitting ON the sidebar/account-bar chrome surface. mirrors the
18
+ toolbar/context-sidebar fg: it rides --studio-chrome-line (the chrome's own
19
+ ink) so it tracks the chrome palette, not the content page. --threepane-fg
20
+ is content ink and only belongs on --threepane-bg surfaces. */
21
+ --threepane-sidebar-fg: var(--studio-chrome-line, var(--studio-line, black));
22
+ --threepane-muted: var(--studio-line-offset-50, #999);
23
+ --threepane-family: var(--studio-family-sans, system-ui, sans-serif);
24
+ --threepane-family-code: var(--studio-family-code, ui-monospace, monospace);
25
+
26
+ /* spacing scale, aliased from the base theme */
27
+ --threepane-space-3xs: var(--studio-space-3xs, 0.125rem);
28
+ --threepane-space-2xs: var(--studio-space-2xs, 0.25rem);
29
+ --threepane-space-xs: var(--studio-space-xs, 0.375rem);
30
+ --threepane-space-sm: var(--studio-space-sm, 0.5rem);
31
+ --threepane-space: var(--studio-space, 0.75rem);
32
+ --threepane-space-md: var(--studio-space-md, 1rem);
33
+ --threepane-space-2xl: var(--studio-space-2xl, 3rem);
34
+
35
+ /* radius scale, aliased from the base theme */
36
+ --threepane-radius-xs: var(--studio-radius-xs, 2px);
37
+ --threepane-radius-sm: var(--studio-radius-sm, 4px);
38
+ --threepane-radius-md: var(--studio-radius-md, 8px);
39
+ --threepane-radius-round: var(--studio-radius-round, 9999px);
40
+
41
+ /* Height of the frame's top strip: the top bar over the main column, and the
42
+ matching empty space reserved above the left sidebar's widgets so the two
43
+ line up and the left toggle has a home. */
44
+ --threepane-header-height: calc(
45
+ env(safe-area-inset-top, 0px) + var(--threepane-space-2xl)
46
+ );
47
+
48
+ /* the left footer and right tray boxes share one height so they line up. */
49
+ --threepane-tray-height: var(--threepane-space-2xl);
50
+ /* sidebar toggles ride a touch paler than the line (first ink offset). they
51
+ sit on chrome (left toggle over the sidebar, right over the toolbar), so
52
+ they use the chrome ink ramp, not the content one. */
53
+ --threepane-toggle-fg: var(--studio-chrome-line-offset-10, var(--studio-line-offset-10, #333));
54
+
55
+ --threepane-toolbar: var(--studio-chrome, white);
56
+ /* toolbar text rides on the chrome surface, so it uses the chrome ink */
57
+ --threepane-toolbar-fg: var(--studio-chrome-line, var(--studio-line, black));
58
+ --threepane-toolbar-border: var(--studio-chrome-offset-10, #ddd);
59
+ /* Resize handle: a faint 1px divider that tracks the chrome ramp's contrast
60
+ (it mixes toward the chrome ink, so it reads darker on light themes and
61
+ lighter on dark ones), plus a primary-tinted glow + grab pill on hover. */
62
+ --threepane-sidebar-divider: var(--studio-chrome-offset-20, #d4d4d4);
63
+ --threepane-resize-glow: color-mix(in oklch, var(--studio-primary-fill, var(--studio-primary, #35f7ca)), transparent 35%);
64
+ --threepane-resize-pill: var(--studio-primary-fill, var(--studio-primary, #35f7ca));
65
+
66
+ /* The context (right) sidebar sits on a chrome surface stepped one offset off
67
+ the toolbar's flat chrome, so the two chrome regions read as distinct. */
68
+ --threepane-context-sidebar-fill: var(--studio-chrome-offset-10, #ececec);
69
+
70
+ /* Context sidebar (tabbed) */
71
+ --context-sidebar-bg: var(--threepane-context-sidebar-fill);
72
+ /* the tab-bar header rides on the same flat chrome as the toolbar above it,
73
+ so the two chrome strips read as one continuous band */
74
+ --context-sidebar-header-bg: var(--studio-chrome, #f2f2f2);
75
+ --context-sidebar-fg: var(--studio-chrome-line, var(--studio-line, black));
76
+ /* match the lines drawn around the document-view so tab/tray edges read as
77
+ one continuous frame */
78
+ --context-sidebar-border: var(--threepane-toolbar-border);
79
+ --context-sidebar-tab-fg: var(--studio-chrome-line-offset-40, var(--studio-line-offset-40, #666));
80
+ --context-sidebar-tab-hover: var(--studio-chrome-offset-10, #e5e5e5);
81
+ --context-sidebar-tab-active-bg: var(--studio-fill, white);
82
+ --context-sidebar-tab-active-fg: var(--studio-line, black);
83
+ --context-sidebar-tab-active-accent: var(--studio-primary-line, var(--studio-primary, #35f7ca));
84
+ /* the content panel shares the active tab's surface so the selected tab
85
+ connects seamlessly into the tool view below it */
86
+ --context-sidebar-content-bg: var(--context-sidebar-tab-active-bg);
87
+ --context-sidebar-family: var(--studio-family-sans, system-ui, sans-serif);
88
+ }
89
+
90
+ .frame-shell {
91
+ display: flex;
92
+ flex-direction: column;
93
+ width: 100%;
94
+ height: 100%;
95
+ }
96
+
97
+ .frame-warning-banner {
98
+ flex: none;
99
+ padding: var(--threepane-space-2xs) var(--threepane-space-sm);
100
+ text-align: center;
101
+ text-transform: uppercase;
102
+ font-family: var(--studio-family-ui, var(--threepane-family));
103
+ font-size: 0.75rem;
104
+ background: var(--studio-warning-fill, yellow);
105
+ color: var(--studio-warning-line);
106
+ }
107
+
108
+ .frame {
109
+ position: relative;
110
+ display: flex;
111
+ width: 100%;
112
+ flex: 1;
113
+ min-height: 0;
114
+ font-family: var(--threepane-family);
115
+ color: var(--threepane-fg);
116
+ background: var(--threepane-bg);
117
+ }
118
+
119
+ .frame__version {
120
+ position: absolute;
121
+ top: var(--threepane-space-2xs);
122
+ right: var(--threepane-space-sm);
123
+ z-index: var(--studio-layer-raised, 10);
124
+ color: var(--threepane-muted);
125
+ font-size: 0.75rem;
126
+ font-weight: 500;
127
+ pointer-events: none;
128
+ user-select: none;
129
+ }
130
+
131
+ .sidebar {
132
+ position: relative;
133
+ display: flex;
134
+ flex: none;
135
+ /* visible so the resize handle can straddle the boundary (sit on *both*
136
+ sides of the divider line); the content clips itself instead. z-index lifts
137
+ the handle's outer half above the main area so it stays grabbable. */
138
+ overflow: visible;
139
+ z-index: 1;
140
+ }
141
+
142
+ .sidebar[data-collapsed] {
143
+ overflow: visible;
144
+ }
145
+
146
+ .sidebar[data-side="left"] {
147
+ background: var(--threepane-sidebar-fill);
148
+ color: var(--threepane-sidebar-fg);
149
+ }
150
+
151
+ .sidebar[data-side="right"] {
152
+ background: var(--threepane-context-sidebar-fill);
153
+ }
154
+
155
+ .main-area {
156
+ flex: 1;
157
+ min-width: 0;
158
+ display: flex;
159
+ flex-direction: column;
160
+ height: 100%;
161
+ overflow: hidden;
162
+ }
163
+
164
+ /* The main column (right of the left sidebar): a row of
165
+ [document column | right sidebar], so the right sidebar spans the full frame
166
+ height and its resize divider runs top-to-bottom exactly like the left one. */
167
+ .frame__main-column {
168
+ position: relative;
169
+ flex: 1;
170
+ min-width: 0;
171
+ display: flex;
172
+ flex-direction: row;
173
+ height: 100%;
174
+ overflow: hidden;
175
+ }
176
+
177
+ /* The document column: the top bar over the main document view. Sits left of the
178
+ full-height context sidebar. */
179
+ .frame__doc-column {
180
+ flex: 1;
181
+ min-width: 0;
182
+ width: 100%;
183
+ display: flex;
184
+ flex-direction: column;
185
+ height: 100%;
186
+ overflow: hidden;
187
+ }
188
+
189
+ .frame__doc-column > patchwork-view,
190
+ .frame__doc-column > patchwork-view > patchwork-view,
191
+ .frame__doc-column > patchwork-view > patchwork-view > patchwork-view,
192
+ .frame__doc-column
193
+ > patchwork-view
194
+ > patchwork-view
195
+ > patchwork-view
196
+ > patchwork-view {
197
+ display: contents;
198
+ }
199
+
200
+ /* The full-width top toolbar. Its height + top safe-area inset match the
201
+ sideboard's reserved top margin so the bar reads as continuous across the top
202
+ (the left sidebar's empty top region lines up with it). */
203
+ .frame__topbar {
204
+ display: flex;
205
+ align-items: stretch;
206
+ box-sizing: border-box;
207
+ min-height: var(--threepane-space-2xl);
208
+ padding-top: env(safe-area-inset-top, 0px);
209
+ padding-inline: var(--threepane-space-2xs);
210
+ gap: var(--threepane-space-2xs);
211
+ background: var(--threepane-toolbar);
212
+ color: var(--threepane-toolbar-fg);
213
+ /* A hairline along the bottom, in the same colour as the document-view's
214
+ border, so the line under the bar runs unbroken across the whole width
215
+ (document column + context tabs). The active tab pulls down 1px to break
216
+ through it and connect to its panel below. */
217
+ border-bottom: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--threepane-toolbar-border);
218
+ /* Animate the collapsed left-slot in step with the sidebar's width transition
219
+ so the title glides up against the pinned toggle instead of jumping. */
220
+ transition: padding-left var(--studio-transition-slow, 0.25s ease);
221
+ }
222
+
223
+ /* When the left sidebar is collapsed the bar's left edge reaches the frame edge,
224
+ where the pinned left toggle lives; reserve a matching slot so the title slides
225
+ up against the toggle rather than under it. */
226
+ .frame__topbar--left-collapsed {
227
+ padding-left: var(--threepane-space-2xl);
228
+ }
229
+
230
+ /* The left sidebar toggle, pinned to the frame's top-left corner so it keeps the
231
+ same spot whether the sidebar is open or closed. Square, filling the top strip;
232
+ sits over the sidebar's reserved (empty) top area when open. */
233
+ .frame__left-toggle {
234
+ position: absolute;
235
+ top: 0;
236
+ left: 0;
237
+ z-index: 5;
238
+ width: var(--threepane-space-2xl);
239
+ height: var(--threepane-header-height);
240
+ padding-top: env(safe-area-inset-top, 0px);
241
+ }
242
+
243
+ /* A sidebar toggle at either end of the top bar (always present). */
244
+ .frame__sidebar-toggle {
245
+ display: flex;
246
+ align-items: center;
247
+ justify-content: center;
248
+ flex-shrink: 0;
249
+ padding-inline: var(--threepane-space-sm);
250
+ border: none;
251
+ background: transparent;
252
+ color: var(--threepane-toggle-fg);
253
+ cursor: var(--studio-cursor-pointer, pointer);
254
+ transition: color var(--studio-transition-fast, 0.1s ease);
255
+ }
256
+
257
+ .frame__sidebar-toggle:hover {
258
+ color: var(--threepane-sidebar-fg);
259
+ }
260
+
261
+ /* The document title, rendered intrinsically: shrinks to the title's width but
262
+ never past half the bar; ellipsis beyond. */
263
+ .threepane__title {
264
+ display: flex;
265
+ align-items: center;
266
+ flex: 0 1 auto;
267
+ min-width: 0;
268
+ max-width: 50%;
269
+ overflow: hidden;
270
+ padding-inline: var(--threepane-space-sm);
271
+ }
272
+
273
+ .threepane__title-text {
274
+ font-weight: 600;
275
+ white-space: nowrap;
276
+ min-width: 0;
277
+ overflow: hidden;
278
+ text-overflow: ellipsis;
279
+ }
280
+
281
+ .threepane__title-text--editable {
282
+ cursor: var(--studio-cursor-text, text);
283
+ }
284
+
285
+ .threepane__title-text--editable:hover {
286
+ opacity: 0.7;
287
+ }
288
+
289
+ .threepane__title-input {
290
+ font: inherit;
291
+ font-weight: 600;
292
+ color: inherit;
293
+ min-width: 0;
294
+ width: 100%;
295
+ padding: 0;
296
+ margin: 0;
297
+ border: none;
298
+ outline: none;
299
+ background: transparent;
300
+ }
301
+
302
+ /* built-in spacer between the title and the right-hand tools */
303
+ .threepane__spacer {
304
+ flex: 1;
305
+ min-width: var(--threepane-space-sm);
306
+ }
307
+
308
+ /* configured doctitle tools at the right end; scroll horizontally when they
309
+ overflow rather than squashing. */
310
+ .threepane__doctitle-tools {
311
+ display: flex;
312
+ align-items: center;
313
+ gap: var(--threepane-space-sm);
314
+ min-width: 0;
315
+ padding-inline: var(--threepane-space-sm);
316
+ overflow-x: auto;
317
+ overflow-y: hidden;
318
+ scrollbar-width: none;
319
+ }
320
+
321
+ .threepane__doctitle-tools::-webkit-scrollbar {
322
+ display: none;
323
+ }
324
+
325
+ .threepane__doctitle-tools patchwork-view {
326
+ display: flex;
327
+ align-items: center;
328
+ height: 2rem;
329
+ flex-shrink: 0;
330
+ width: auto;
331
+ }
332
+
333
+ .document-view {
334
+ flex: 1;
335
+ min-height: 0;
336
+ overflow: hidden;
337
+ /* Left divider only, square corners. The top line is the top bar's
338
+ border-bottom and the bottom is open to the frame edge. The right divider
339
+ (to the context sidebar) is the sidebar's own full-height border-left, so
340
+ it runs the whole frame height rather than just the document view. When the
341
+ left sidebar is collapsed the left divider is dropped (see the :has rule
342
+ below) so nothing rides the frame edge. */
343
+ border-left: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--threepane-toolbar-border);
344
+ }
345
+
346
+ /* Left sidebar collapsed to 0: drop the document-view's left divider so there's
347
+ no stray line hugging the frame's left edge. */
348
+ .frame:has(.sidebar[data-side="left"][data-collapsed]) .document-view {
349
+ border-left: none;
350
+ }
351
+
352
+ .document-view patchwork-view {
353
+ display: block;
354
+ width: 100%;
355
+ height: 100%;
356
+ }
357
+
358
+ .placeholder {
359
+ display: flex;
360
+ align-items: center;
361
+ justify-content: center;
362
+ height: 100%;
363
+ color: var(--threepane-fg);
364
+ }
365
+
366
+ /* the main doc, and what's said in its place when it can't be shown. the
367
+ cards lie over the patchwork-view (which may still be recovering) */
368
+ .doc-stack {
369
+ position: relative;
370
+ width: 100%;
371
+ height: 100%;
372
+ }
373
+
374
+ /* a card in place of a doc: the sheet lattice and knit draw, in the theme's
375
+ colours, with its serif drawn a little by hand (but holding still) */
376
+ .doc-card {
377
+ --doc-card-ink: var(--studio-line, #1c1a17);
378
+ --doc-card-muted: var(--studio-line-offset-50, color-mix(in oklab, var(--doc-card-ink) 55%, transparent));
379
+ --doc-card-line: var(--studio-chrome-line, var(--doc-card-ink));
380
+ --doc-card-sheet: var(--editor-fill, var(--text-editor-fill, var(--studio-fill, #fffdf5)));
381
+ --doc-card-highlighter: var(--studio-selection-fill, #ffee8888);
382
+ --doc-card-accent: var(--studio-primary-fill, var(--studio-primary, #ff2284));
383
+ --doc-card-accent-ink: var(--studio-primary-line, #fff);
384
+ --doc-card-danger: var(--studio-danger-text, var(--studio-danger, #d33a4c));
385
+ --doc-card-good: var(--studio-added, #40dcba);
386
+ --doc-card-radius: var(--studio-radius-sm, 3px);
387
+ --doc-card-serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
388
+ --doc-card-mono: var(--studio-family-code, Monaco, ui-monospace, monospace);
389
+
390
+ position: absolute;
391
+ inset: 0;
392
+ z-index: 1;
393
+ display: grid;
394
+ box-sizing: border-box;
395
+ place-items: center;
396
+ overflow: auto;
397
+ padding: 16px;
398
+ background: var(--threepane-bg);
399
+ color: var(--doc-card-ink);
400
+ font-family: var(--studio-family-ui, var(--threepane-family));
401
+ /* a doc that's only slow shouldn't flash a card on its way in */
402
+ animation: doc-card-in var(--studio-duration-slow, 0.3s) ease 0.4s both;
403
+ }
404
+
405
+ @keyframes doc-card-in {
406
+ from { opacity: 0; }
407
+ }
408
+
409
+ @media (prefers-reduced-motion: reduce) {
410
+ .doc-card {
411
+ animation-duration: 0.01s;
412
+ }
413
+ }
414
+
415
+ .doc-card__defs {
416
+ position: absolute;
417
+ width: 0;
418
+ height: 0;
419
+ }
420
+
421
+ .doc-card__sheet {
422
+ box-sizing: border-box;
423
+ max-width: 440px;
424
+ padding: 24px 28px 20px;
425
+ border: 1px solid var(--doc-card-line);
426
+ border-radius: 0.5em;
427
+ background: var(--doc-card-sheet);
428
+ box-shadow: 0 0 10px 2px #66003322;
429
+ text-align: center;
430
+
431
+ & p {
432
+ margin: 0 0 12px;
433
+ color: var(--doc-card-muted);
434
+ }
435
+ }
436
+
437
+ .doc-card__rough {
438
+ margin: 0 0 6px;
439
+ font: 400 28px/1.1 var(--doc-card-serif);
440
+ filter: url(#doc-card-rough);
441
+ }
442
+
443
+ .doc-card__code {
444
+ padding: 1px 5px;
445
+ border-radius: var(--doc-card-radius);
446
+ background: var(--doc-card-highlighter);
447
+ color: var(--doc-card-ink);
448
+ font: 11px var(--doc-card-mono);
449
+ }
450
+
451
+ .doc-card__url {
452
+ display: inline-block;
453
+ max-width: 100%;
454
+ margin-top: 4px;
455
+ overflow-wrap: anywhere;
456
+ }
457
+
458
+ .doc-card__reasons {
459
+ margin: 0 0 12px;
460
+ padding: 0 0 0 1.2em;
461
+ color: var(--doc-card-muted);
462
+ text-align: left;
463
+
464
+ & li + li {
465
+ margin-top: 4px;
466
+ }
467
+ }
468
+
469
+ /* how the sync server looks from here */
470
+ /* "sync server", in the colour of the connection as it stands. a button, so
471
+ a tap can say which on a phone, where a title never shows */
472
+ .doc-card__sync {
473
+ padding: 0;
474
+ border: none;
475
+ background: none;
476
+ color: var(--doc-card-danger);
477
+ font: inherit;
478
+ text-decoration: underline dotted;
479
+ text-underline-offset: 3px;
480
+ cursor: help;
481
+
482
+ &[data-connected] {
483
+ color: var(--doc-card-good);
484
+ }
485
+ }
486
+
487
+ .doc-card__sync-told {
488
+ color: var(--doc-card-ink);
489
+ }
490
+
491
+ .doc-card__actions {
492
+ display: flex;
493
+ justify-content: center;
494
+ gap: 8px;
495
+ margin: 0 0 12px;
496
+ }
497
+
498
+ .doc-card__button {
499
+ padding: 2px 10px;
500
+ border: 1px solid var(--doc-card-line);
501
+ border-radius: 2px;
502
+ background: var(--doc-card-sheet);
503
+ box-shadow: 1px 1px 0 var(--doc-card-line);
504
+ color: inherit;
505
+ font: inherit;
506
+ cursor: pointer;
507
+
508
+ &:hover:not(:disabled) {
509
+ translate: -1px -1px;
510
+ box-shadow: 2px 2px 0 var(--doc-card-line);
511
+ }
512
+
513
+ &:active:not(:disabled) {
514
+ translate: 1px 1px;
515
+ box-shadow: none;
516
+ }
517
+
518
+ &:disabled {
519
+ cursor: progress;
520
+ opacity: 0.7;
521
+ }
522
+ }
523
+
524
+ .doc-card__button--primary {
525
+ min-width: 5em;
526
+ background: var(--doc-card-accent);
527
+ color: var(--doc-card-accent-ink);
528
+ font-weight: 600;
529
+ }
530
+
531
+ .doc-card__link {
532
+ padding: 0;
533
+ border: none;
534
+ background: none;
535
+ color: inherit;
536
+ font: inherit;
537
+ text-decoration: underline;
538
+ text-underline-offset: 2px;
539
+ cursor: pointer;
540
+ }
541
+
542
+ .doc-card__aside {
543
+ font-size: 0.9em;
544
+
545
+ &:last-child {
546
+ margin-bottom: 0;
547
+ }
548
+ }
549
+
550
+ .doc-card__notice {
551
+ color: var(--doc-card-danger) !important;
552
+ }
553
+
554
+ /* a suggested package, as its package.json names it */
555
+ .pkg-line {
556
+ color: var(--doc-card-ink);
557
+ }
558
+
559
+ .pkg-line__version {
560
+ color: var(--doc-card-muted);
561
+ }
562
+
563
+ /* the card's quieter ways on, one to a line */
564
+ .doc-card__links {
565
+ display: flex;
566
+ flex-direction: column;
567
+ align-items: center;
568
+ gap: 4px;
569
+ font-size: 0.9em;
570
+
571
+ &:last-child {
572
+ margin-bottom: 0;
573
+ }
574
+ }
575
+
576
+ /* everything known about a suggested package. a popover, so it sits in the
577
+ top layer, but still inherits the card's colours */
578
+ .pkg-about[popover] {
579
+ box-sizing: border-box;
580
+ width: min(440px, calc(100vw - 32px));
581
+ max-height: calc(100vh - 64px);
582
+ margin: auto;
583
+ overflow: auto;
584
+ padding: 18px 22px 16px;
585
+ border: 1px solid var(--doc-card-line);
586
+ border-radius: 0.5em;
587
+ background: var(--doc-card-sheet);
588
+ box-shadow: 0 0 10px 2px #66003322, 3px 3px 0 var(--doc-card-line);
589
+ color: var(--doc-card-ink);
590
+ font: 13px/1.45 var(--studio-family-ui, var(--threepane-family));
591
+ text-align: left;
592
+
593
+ &::backdrop {
594
+ background: color-mix(in oklab, var(--doc-card-ink) 12%, transparent);
595
+ }
596
+
597
+ & h3 {
598
+ margin: 0;
599
+ font-size: 22px;
600
+ }
601
+
602
+ & h4 {
603
+ margin: 0 0 6px;
604
+ font-size: 11px;
605
+ font-weight: 600;
606
+ letter-spacing: 0.08em;
607
+ text-transform: uppercase;
608
+ color: var(--doc-card-muted);
609
+ }
610
+ }
611
+
612
+ .pkg-about__header {
613
+ display: flex;
614
+ align-items: baseline;
615
+ justify-content: space-between;
616
+ margin-bottom: 12px;
617
+ }
618
+
619
+ .pkg-about__close {
620
+ font-size: 20px;
621
+ line-height: 1;
622
+ text-decoration: none;
623
+ }
624
+
625
+ .pkg-about__section {
626
+ margin: 0 0 14px;
627
+ padding: 10px 12px;
628
+ border: 1px solid var(--doc-card-line);
629
+ border-radius: var(--doc-card-radius);
630
+
631
+ &:last-child {
632
+ margin-bottom: 0;
633
+ }
634
+ }
635
+
636
+ /* the package's own word gets a dashed edge and the highlighter: it's quoted,
637
+ not vouched for */
638
+ .pkg-about__section--claims {
639
+ border-style: dashed;
640
+ background: color-mix(in oklab, var(--doc-card-highlighter) 35%, transparent);
641
+ }
642
+
643
+ .pkg-about__version {
644
+ color: var(--doc-card-muted);
645
+ font-size: 0.7em;
646
+ }
647
+
648
+ /* the claims are the package's own: say so where they're headed */
649
+ .pkg-about__tag {
650
+ margin-left: 4px;
651
+ padding: 0 5px;
652
+ border: 1px dashed currentColor;
653
+ border-radius: var(--doc-card-radius);
654
+ font-weight: 400;
655
+ letter-spacing: 0.04em;
656
+ }
657
+
658
+ .pkg-about__quiet {
659
+ color: var(--doc-card-muted);
660
+ }
661
+
662
+ .pkg-about__facts {
663
+ display: grid;
664
+ grid-template-columns: max-content 1fr;
665
+ gap: 4px 12px;
666
+ margin: 0 0 8px;
667
+
668
+ & dt {
669
+ color: var(--doc-card-muted);
670
+ }
671
+
672
+ & dd {
673
+ min-width: 0;
674
+ margin: 0;
675
+ overflow-wrap: anywhere;
676
+ }
677
+ }
678
+
679
+ .pkg-about__list {
680
+ margin: 4px 0;
681
+ padding: 0 0 0 1.1em;
682
+ }
683
+
684
+ .pkg-about__heads {
685
+ display: inline-flex;
686
+ flex-wrap: wrap;
687
+ gap: 4px;
688
+ }
689
+
690
+ .pkg-about__ask {
691
+ & .doc-card__notice {
692
+ margin: 6px 0 0;
693
+ }
694
+ }
695
+
696
+ /* still finding it: a quiet dot, once it's been a moment */
697
+ .doc-card--finding {
698
+ display: flex;
699
+ justify-content: center;
700
+ gap: 8px;
701
+ color: var(--doc-card-muted);
702
+ font-size: 0.9em;
703
+ animation-delay: 1.5s;
704
+ }
705
+
706
+ .doc-card__dot {
707
+ width: 8px;
708
+ height: 8px;
709
+ border-radius: 50%;
710
+ background: currentColor;
711
+ animation: doc-card-pulse 2s ease-in-out infinite;
712
+ }
713
+
714
+ @keyframes doc-card-pulse {
715
+ 0%, 100% { opacity: 0.25; transform: scale(0.6); }
716
+ 50% { opacity: 1; transform: scale(1); }
717
+ }
718
+
719
+ @media (prefers-reduced-motion: reduce) {
720
+ .doc-card__dot {
721
+ animation: none;
722
+ }
723
+ }
724
+
725
+ .sidebar patchwork-view {
726
+ display: block;
727
+ width: 100%;
728
+ height: 100%;
729
+ /* the sidebar itself doesn't clip, so the content does */
730
+ overflow: hidden;
731
+ }
732
+
733
+ /* Context sidebar (tabbed): lifted tabs with a top accent bar and surface fill
734
+ on the active tab, a hover surface, and a bottom-border separator between the
735
+ tab bar and the mounted tool view. */
736
+ .context-sidebar {
737
+ flex: 1;
738
+ min-width: 0;
739
+ width: 100%;
740
+ height: 100%;
741
+ display: flex;
742
+ flex-direction: column;
743
+ overflow: hidden;
744
+ font-family: var(--context-sidebar-family);
745
+ color: var(--context-sidebar-fg);
746
+ background: var(--context-sidebar-bg);
747
+ /* The full-height divider between the document column and the sidebar. Lives
748
+ here (not on the document view) so it runs the whole frame height \u2014 top bar
749
+ level included \u2014 and the resize handle straddling this edge is grabbable end
750
+ to end, matching the left sidebar. */
751
+ border-left: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--context-sidebar-border);
752
+ }
753
+
754
+ /* Tab bar: the row holding the tab list and the collapse button. Its height +
755
+ top safe-area inset match the document column's top bar so the two header
756
+ strips line up and their bottom hairlines read as one continuous line across
757
+ the divider. */
758
+ .context-sidebar__tabs {
759
+ display: flex;
760
+ align-items: flex-end;
761
+ box-sizing: border-box;
762
+ min-height: var(--threepane-space-2xl);
763
+ padding-top: env(safe-area-inset-top, 0px);
764
+ background: var(--context-sidebar-header-bg);
765
+ border-bottom: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--context-sidebar-border);
766
+ }
767
+
768
+ .context-sidebar__tablist {
769
+ display: flex;
770
+ flex: 1;
771
+ min-width: 0;
772
+ align-items: flex-end;
773
+ gap: var(--threepane-space-2xs);
774
+ padding-inline: var(--threepane-space-2xs);
775
+ /* when there are more tabs than fit, scroll them horizontally rather than
776
+ letting them shrink/wrap; scrollbar hidden for a clean header. */
777
+ overflow-x: auto;
778
+ overflow-y: hidden;
779
+ scrollbar-width: none;
780
+ /* extend the clip box 1px past the tab-bar border (compensated by the
781
+ negative margin so layout is unchanged) so the active tab's -1px overflow
782
+ isn't clipped by the horizontal scroll container, and it can still cover
783
+ the border-bottom to connect into the panel. */
784
+ padding-bottom: 1px;
785
+ margin-bottom: -1px;
786
+ }
787
+ .context-sidebar__tablist::-webkit-scrollbar {
788
+ display: none;
789
+ }
790
+
791
+ /* A single tab. */
792
+ .context-sidebar__tab {
793
+ display: flex;
794
+ align-items: center;
795
+ flex-shrink: 0;
796
+ padding: var(--threepane-space-xs) var(--threepane-space-sm);
797
+ border: var(--studio-border-width, 1px) var(--studio-border-style, solid) transparent;
798
+ border-bottom: none;
799
+ border-top-left-radius: var(--threepane-radius-xs);
800
+ border-top-right-radius: var(--threepane-radius-xs);
801
+ background: transparent;
802
+ font-family: inherit;
803
+ font-size: 0.875rem;
804
+ white-space: nowrap;
805
+ color: var(--context-sidebar-tab-fg);
806
+ cursor: var(--studio-cursor-pointer, pointer);
807
+ user-select: none;
808
+ transition: background var(--studio-transition-fast, 0.1s ease),
809
+ color var(--studio-transition-fast, 0.1s ease);
810
+ }
811
+
812
+ .context-sidebar__tab:hover {
813
+ background: var(--studio-chrome-hover-fill, var(--context-sidebar-tab-hover));
814
+ color: var(--context-sidebar-tab-active-fg);
815
+ }
816
+
817
+ /* Exception: the selected tab. Pulled down 1px so its fill covers the tab-bar's
818
+ bottom border, connecting the tab seamlessly into the panel below. */
819
+ .context-sidebar__tab[data-active] {
820
+ position: relative;
821
+ margin-bottom: -1px;
822
+ background: var(--context-sidebar-tab-active-bg);
823
+ color: var(--context-sidebar-tab-active-fg);
824
+ border-color: var(--context-sidebar-border);
825
+ box-shadow: inset 0 1px 0 0 var(--context-sidebar-tab-active-accent);
826
+ }
827
+
828
+ /* The close (collapse) button. Centred vertically in the tab header (the header
829
+ is otherwise flex-end for the tabs) so it lands at the same height as the
830
+ reopen toggle in the top bar when the sidebar is collapsed. */
831
+ .context-sidebar__close {
832
+ display: flex;
833
+ align-items: center;
834
+ justify-content: center;
835
+ align-self: center;
836
+ flex-shrink: 0;
837
+ padding-inline: var(--threepane-space-sm);
838
+ margin-right: var(--threepane-space-2xs);
839
+ border: none;
840
+ background: transparent;
841
+ color: var(--context-sidebar-fg);
842
+ cursor: var(--studio-cursor-pointer, pointer);
843
+ opacity: 0.5;
844
+ transition: opacity var(--studio-transition-fast, 0.1s ease);
845
+ }
846
+
847
+ .context-sidebar__close:hover {
848
+ opacity: 1;
849
+ }
850
+
851
+ /* The mounted tool view. */
852
+ .context-sidebar__content {
853
+ flex: 1;
854
+ min-height: 0;
855
+ overflow: auto;
856
+ background: var(--context-sidebar-content-bg);
857
+ contain: content;
858
+ }
859
+
860
+ .context-sidebar__content patchwork-view {
861
+ display: block;
862
+ width: 100%;
863
+ height: 100%;
864
+ }
865
+
866
+ /* Left sidebar body: a stack of widgets with the account footer pinned below. */
867
+ .threepane-sidebar {
868
+ display: flex;
869
+ flex-direction: column;
870
+ width: 100%;
871
+ height: 100%;
872
+ min-height: 0;
873
+ }
874
+
875
+ /* Reserve the docked tray's height at the sidebar's bottom so the account bar
876
+ sits above the tray (which is pinned outside this collapsing column). */
877
+ .threepane-sidebar--has-tray {
878
+ padding-bottom: calc(
879
+ var(--threepane-tray-height) + env(safe-area-inset-bottom, 0px)
880
+ );
881
+ }
882
+
883
+ /* account / packages / settings footer, pinned to the sidebar bottom */
884
+ .threepane-sidebar--has-tray .threepane-sidebar__footer {
885
+ flex: none;
886
+ margin-bottom: calc(var(--threepane-tray-height) + env(safe-area-inset-bottom, 0px));
887
+ }
888
+
889
+ /* The inlined account bar: avatar (account picker) + Packages + Settings. */
890
+ .threepane-account-bar {
891
+ container-type: inline-size;
892
+ display: flex;
893
+ align-items: center;
894
+ gap: var(--threepane-space-md);
895
+ min-height: var(--threepane-space-2xl);
896
+ box-sizing: border-box;
897
+ background: var(--threepane-sidebar-fill);
898
+ color: var(--threepane-sidebar-fg);
899
+ border-top: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--threepane-sidebar-divider);
900
+ padding-block: var(--threepane-space-2xs);
901
+ padding-bottom: calc(var(--threepane-space-2xs) + env(safe-area-inset-bottom));
902
+ padding-left: calc(env(safe-area-inset-left) + var(--threepane-space-md));
903
+ padding-right: calc(env(safe-area-inset-right) + var(--threepane-space-md));
904
+ justify-content: space-between;
905
+ overflow: hidden;
906
+ }
907
+
908
+ .threepane-account-bar__button {
909
+ display: flex;
910
+ align-items: center;
911
+ border: var(--studio-border-width, 1px) var(--studio-border-style, solid) transparent;
912
+ padding-inline: var(--threepane-space-2xs);
913
+ padding-block: var(--threepane-space-3xs);
914
+ border-radius: var(--threepane-radius-xs);
915
+ background: transparent;
916
+ color: inherit;
917
+ font: inherit;
918
+ white-space: nowrap;
919
+ cursor: var(--studio-cursor-pointer, pointer);
920
+ }
921
+
922
+ .threepane-account-bar__button:hover {
923
+ border-color: var(--threepane-sidebar-divider);
924
+ }
925
+
926
+ .threepane-account-bar__avatar {
927
+ padding: 0;
928
+ }
929
+
930
+ .threepane-account-bar__avatar patchwork-view {
931
+ display: block;
932
+ width: 100%;
933
+ height: 100%;
934
+ }
935
+
936
+ /* Left sidebar: a stack of configured widgets. The widgets start below the
937
+ frame's top strip (the empty space matching the top bar), so the frame owns
938
+ that spacing rather than each widget reserving its own top margin. */
939
+ .threepane-widgets {
940
+ flex: 1;
941
+ display: flex;
942
+ flex-direction: column;
943
+ width: 100%;
944
+ min-height: 0;
945
+ padding-top: var(--threepane-header-height);
946
+ gap: 1rem;
947
+ }
948
+
949
+ .threepane-widget {
950
+ position: relative;
951
+ flex: 1;
952
+ min-height: 0;
953
+ overflow: hidden;
954
+ }
955
+
956
+ .threepane-widget patchwork-view {
957
+ display: block;
958
+ width: 100%;
959
+ height: 100%;
960
+ }
961
+
962
+ /* empty state: offer to add the document list */
963
+ .threepane-widgets__empty {
964
+ flex: 1;
965
+ display: flex;
966
+ align-items: flex-start;
967
+ justify-content: center;
968
+ }
969
+
970
+ .threepane-widgets__add {
971
+ padding: var(--threepane-space-xs) var(--threepane-space-sm);
972
+ border: var(--studio-border-width, 1px) dashed var(--threepane-sidebar-divider);
973
+ border-radius: var(--threepane-radius-sm);
974
+ background: transparent;
975
+ color: var(--threepane-muted);
976
+ font: inherit;
977
+ cursor: var(--studio-cursor-pointer, pointer);
978
+ white-space: nowrap;
979
+ }
980
+
981
+ .threepane-widgets__add:hover:not(:disabled) {
982
+ color: var(--threepane-sidebar-fg);
983
+ border-color: var(--threepane-sidebar-fg);
984
+ }
985
+
986
+ .threepane-widgets__add:disabled {
987
+ opacity: var(--studio-disabled-opacity, 0.5);
988
+ cursor: var(--studio-cursor-default, default);
989
+ }
990
+
991
+ /* System tray dock: pinned to the frame's bottom-left. Lives outside the
992
+ collapsing left sidebar so it isn't torn down when the sidebar closes. When
993
+ the sidebar is open the dock spans its width (set inline) and fills the space
994
+ reserved by \`threepane-sidebar--has-tray\`; when the sidebar closes the dock is
995
+ hidden (\`display: none\`) but stays mounted, so the tray is invisible while its
996
+ tools keep running. */
997
+ .frame__tray-dock {
998
+ position: absolute;
999
+ left: 0;
1000
+ bottom: 0;
1001
+ z-index: 4;
1002
+ box-sizing: border-box;
1003
+ /* Fade the tray in only *after* the sidebar's width animation completes, so it
1004
+ doesn't flash at full size over the still-expanding sidebar. The delay equals
1005
+ the sidebar's transition duration; collapsing overrides this to hide at once. */
1006
+ opacity: 1;
1007
+ transition: opacity var(--studio-transition-fast, 0.1s ease) 0.25s;
1008
+ }
1009
+
1010
+ .frame__tray-dock--collapsed {
1011
+ opacity: 0;
1012
+ pointer-events: none;
1013
+ /* Hide immediately on collapse \u2014 no wait, no fade. */
1014
+ transition: opacity 0s;
1015
+ }
1016
+
1017
+ /* A row of tray-tagged tools, filling the dock. */
1018
+ .frame-tray {
1019
+ display: flex;
1020
+ align-items: center;
1021
+ gap: var(--threepane-space-2xs);
1022
+ box-sizing: border-box;
1023
+ /* min-height includes the safe-area inset (border-box), and the matching
1024
+ padding-bottom lifts the tray's contents clear of it while the tray's own
1025
+ background fills the inset down to the very bottom edge. */
1026
+ min-height: calc(
1027
+ var(--threepane-tray-height) + env(safe-area-inset-bottom, 0px)
1028
+ );
1029
+ padding-inline: var(--threepane-space-sm);
1030
+ padding-bottom: env(safe-area-inset-bottom, 0px);
1031
+ border-top: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--threepane-sidebar-divider);
1032
+ background: var(--threepane-sidebar-fill);
1033
+ }
1034
+
1035
+ .frame-tray__item {
1036
+ display: flex;
1037
+ align-items: center;
1038
+ }
1039
+
1040
+ .frame-tray patchwork-view {
1041
+ display: flex;
1042
+ width: auto;
1043
+ height: auto;
1044
+ }
1045
+
1046
+ /* Isolation-mode chrome popover.
1047
+ In isolation the main document area is a sandboxed iframe, so host-realm tools
1048
+ opened from the account bar (account picker / Packages / Settings) are floated
1049
+ over the frame here instead of being routed into the iframe. The backdrop is a
1050
+ lowish-opacity, theme-tinted ink wash (dims the frame + picks up the theme's
1051
+ ink hue); the panel carries a soft drop shadow so it reads as lifted. Absolute
1052
+ inset:0 resolves to the \`.frame\` (its nearest positioned ancestor). */
1053
+ .frame__popover-backdrop {
1054
+ position: absolute;
1055
+ inset: 0;
1056
+ z-index: var(--studio-layer-modal, 1000);
1057
+ display: flex;
1058
+ align-items: center;
1059
+ justify-content: center;
1060
+ padding: var(--threepane-space-2xl);
1061
+ background: var(--studio-backdrop, color-mix(in oklch, var(--threepane-fg), transparent 82%));
1062
+ animation: frame-popover-fade var(--studio-transition, 0.15s ease);
1063
+ }
1064
+
1065
+ .frame__popover {
1066
+ display: flex;
1067
+ flex-direction: column;
1068
+ width: min(1100px, 100%);
1069
+ height: min(900px, 100%);
1070
+ overflow: hidden;
1071
+ background: var(--threepane-bg);
1072
+ color: var(--threepane-fg);
1073
+ border: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--threepane-toolbar-border);
1074
+ border-radius: var(--threepane-radius-md);
1075
+ box-shadow:
1076
+ 0 32px 80px color-mix(in oklch, var(--threepane-fg), transparent 45%),
1077
+ 0 12px 32px color-mix(in oklch, var(--threepane-fg), transparent 60%),
1078
+ 0 2px 8px color-mix(in oklch, var(--threepane-fg), transparent 70%);
1079
+ animation: frame-popover-pop var(--studio-transition, 0.15s ease);
1080
+ }
1081
+
1082
+ /* The "Open with" picker, docked to the popover's top. Sits at its natural
1083
+ height above the tool body; the doc-openwith tool renders a small titlebar
1084
+ button, so this is left-aligned chrome rather than a full-height view. */
1085
+ .frame__popover-toolbar {
1086
+ display: flex;
1087
+ align-items: center;
1088
+ flex: 0 0 auto;
1089
+ gap: var(--threepane-space-sm);
1090
+ padding: var(--threepane-space-sm) var(--threepane-space-md);
1091
+ border-bottom: var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--threepane-toolbar-border);
1092
+ }
1093
+
1094
+ .frame__popover-toolbar patchwork-view {
1095
+ display: block;
1096
+ }
1097
+
1098
+ .frame__popover-body {
1099
+ flex: 1 1 auto;
1100
+ min-height: 0;
1101
+ overflow: auto;
1102
+ }
1103
+
1104
+ .frame__popover-body patchwork-view {
1105
+ display: block;
1106
+ width: 100%;
1107
+ height: 100%;
1108
+ overflow: auto;
1109
+ }
1110
+
1111
+ @keyframes frame-popover-fade {
1112
+ from {
1113
+ opacity: 0;
1114
+ }
1115
+ to {
1116
+ opacity: 1;
1117
+ }
1118
+ }
1119
+
1120
+ @keyframes frame-popover-pop {
1121
+ from {
1122
+ opacity: 0;
1123
+ transform: translateY(8px) scale(0.98);
1124
+ }
1125
+ to {
1126
+ opacity: 1;
1127
+ transform: none;
1128
+ }
1129
+ }
1130
+
1131
+ .frame {
1132
+ .sidebar-toggle {
1133
+ position: relative;
1134
+ align-self: stretch;
1135
+ height: 100%;
1136
+ padding: 0;
1137
+ /* 1px wide, overlapping the divider border while reserving no layout column
1138
+ (content stays flush against the view's border - no offset-bg seam). The
1139
+ divider border is painted inside the following column, so a centered 2px
1140
+ strip reads half a pixel left of the line. */
1141
+ width: 1px;
1142
+ margin-inline: 0 -1px;
1143
+ margin-block: 0;
1144
+ border: 0;
1145
+ z-index: 1;
1146
+ cursor: var(--studio-cursor-pointer, pointer);
1147
+ /* transparent at rest - the visible divider is the main view's border; the
1148
+ handle lights up (full-height glow + pill) on hover to signal resize. */
1149
+ background: transparent;
1150
+ transition: background-color var(--studio-transition, 0.15s ease);
1151
+ /* invisible hit target straddling the divider. The toggle sits on opposite
1152
+ edges of the two sidebars (right edge of the left pane, left edge of the
1153
+ right pane). The grab area reaches 6px past the line on both sides, so it
1154
+ works the same on either edge without per-side rules. */
1155
+ &::before {
1156
+ content: "";
1157
+ position: absolute;
1158
+ inset-block: 0;
1159
+ inset-inline: -6px;
1160
+ }
1161
+ &::after {
1162
+ content: "";
1163
+ position: absolute;
1164
+ top: 50%;
1165
+ left: 50%;
1166
+ width: 5px;
1167
+ height: 44px;
1168
+ border-radius: var(--threepane-radius-round);
1169
+ background: var(--threepane-resize-pill);
1170
+ opacity: 0;
1171
+ transform: translate(-50%, -50%) scaleY(0.55);
1172
+ transition: opacity var(--studio-transition, 0.15s ease),
1173
+ transform var(--studio-transition, 0.15s ease);
1174
+ pointer-events: none;
1175
+ }
1176
+ /* on hover the divider line lights up in the frame primary */
1177
+ &:hover,
1178
+ &:active {
1179
+ background: var(--threepane-resize-glow);
1180
+ }
1181
+ &:hover::after,
1182
+ &:active::after {
1183
+ opacity: 1;
1184
+ transform: translate(-50%, -50%) scaleY(1);
1185
+ }
1186
+ }
1187
+
1188
+ .sidebar-toggle--resizable {
1189
+ cursor: var(--studio-cursor-resize-col, col-resize);
1190
+ &:hover {
1191
+ cursor: var(--studio-cursor-resize-col, col-resize);
1192
+ }
1193
+ &:active {
1194
+ cursor: var(--studio-cursor-resize-col, col-resize);
1195
+ }
1196
+ }
1197
+
1198
+ }
1199
+
1200
+ /* Animate sidebar width on collapse/expand, but never while the handle is being
1201
+ actively dragged - the width must track the pointer 1:1 with no easing lag.
1202
+ The body flag is set for the duration of a drag by \`useSidebarResize\`. */
1203
+ .sidebar {
1204
+ transition: width var(--studio-transition-slow, 0.25s ease);
1205
+ }
1206
+ body[data-sidebar-resizing] .sidebar {
1207
+ transition: none;
1208
+ }
1209
+ `;function Ar(){let e="patchwork-frame-styles",r=document.getElementById(e);if(r){r.textContent!==qe&&(r.textContent=qe);return}let t=document.createElement("style");t.id=e,t.textContent=qe,document.head.append(t)}var Ya=Rr("<patchwork-view component=patchwork-isolation root-component=threepane-isolation-root shared-providers=patchwork:contact,patchwork:selected-doc,patchwork:worker-channel shared-tools=llm-config-tray style=display:contents><script type=application/json data-root-component-data>",!0,!1,!1),Xa=Rr("<div class=frame>");function cc(e){let r=Dr(()=>{let o=new Set,n=e.selectedDocUrl();return n&&o.add(n),e.contactUrl&&o.add(e.contactUrl),[...o]}),t=Dr(()=>JSON.stringify({selectedDocUrl:e.selectedDocUrl(),selectedToolId:e.selectedToolId(),doctitleSlots:e.doctitleSlots(),isLeftCollapsed:e.isLeftCollapsed(),initialRightWidth:e.initialRightWidth(),initialRightCollapsed:e.initialRightCollapsed()}));return(()=>{var o=Ya(),n=o.firstChild;return o._$owner=Va(),Fr(n,t),Ja(()=>Ba(o,"automerge-allowlist",r().join(","))),o})()}function Ir(e){if(!e?.textContent)return{};try{return JSON.parse(e.textContent)}catch(r){return console.error("[threepane-isolation-root] bad props JSON:",r),{}}}function uc(e){Ar();let r=e.querySelector('script[type="application/json"]'),[t,o]=Ga(Ir(r)),n=new MutationObserver(()=>{o(Ka(Ir(r)))});r&&n.observe(r,{characterData:!0,childList:!0,subtree:!0});let i=Za(()=>(()=>{var a=Xa();return Fr(a,qa(Tr,{selectedDocUrl:()=>t.selectedDocUrl,selectedToolId:()=>t.selectedToolId,doctitleSlots:()=>t.doctitleSlots,isLeftCollapsed:()=>t.isLeftCollapsed??!1,initialRightWidth:()=>t.initialRightWidth??ke,initialRightCollapsed:()=>t.initialRightCollapsed??!1})),a})(),e);return()=>{n.disconnect(),i()}}export{_t as a,pe as b,W as c,xe as d,ke as e,pt as f,ht as g,Or as h,Ve as i,Gr as j,Ut as k,Ze as l,Fl as m,Ll as n,kr as o,Tr as p,Ar as q,cc as r,uc as s};
1210
+ //# sourceMappingURL=chunk-LNR6ATYD.js.map