@inkandswitch/patchwork-pkg-base 0.0.103 → 0.0.104

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 je,b as Ir}from"./chunk-FW4363Y4.js";var mt=je((ki,ft)=>{var ee=1e3,te=ee*60,re=te*60,J=re*24,Zr=J*7,Qr=J*365.25;ft.exports=function(e,r){r=r||{};var t=typeof e;if(t==="string"&&e.length>0)return eo(e);if(t==="number"&&isFinite(e))return r.long?ro(e):to(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function eo(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*Qr;case"weeks":case"week":case"w":return t*Zr;case"days":case"day":case"d":return t*J;case"hours":case"hour":case"hrs":case"hr":case"h":return t*re;case"minutes":case"minute":case"mins":case"min":case"m":return t*te;case"seconds":case"second":case"secs":case"sec":case"s":return t*ee;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function to(e){var r=Math.abs(e);return r>=J?Math.round(e/J)+"d":r>=re?Math.round(e/re)+"h":r>=te?Math.round(e/te)+"m":r>=ee?Math.round(e/ee)+"s":e+"ms"}function ro(e){var r=Math.abs(e);return r>=J?_e(e,r,J,"day"):r>=re?_e(e,r,re,"hour"):r>=te?_e(e,r,te,"minute"):r>=ee?_e(e,r,ee,"second"):e+" ms"}function _e(e,r,t,o){var n=r>=t*1.5;return Math.round(e/t)+" "+o+(n?"s":"")}});var bt=je((Ci,gt)=>{function oo(e){t.debug=t,t.default=t,t.coerce=l,t.disable=a,t.enable=n,t.enabled=c,t.humanize=mt(),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 p=0;p<s.length;p++)u=(u<<5)-u+s.charCodeAt(p),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=r;function t(s){let u,p=null,g,v;function m(...h){if(!m.enabled)return;let f=m,w=Number(new Date),T=w-(u||w);f.diff=T,f.prev=u,f.curr=w,u=w,h[0]=t.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let A=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(q,K)=>{if(q==="%%")return"%";A++;let z=t.formatters[K];if(typeof z=="function"){let B=h[A];q=z.call(f,B),h.splice(A,1),A--}return q}),t.formatArgs.call(f,h),(f.log||t.log).apply(f,h)}return m.namespace=s,m.useColors=t.useColors(),m.color=t.selectColor(s),m.extend=o,m.destroy=t.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(g!==t.namespaces&&(g=t.namespaces,v=t.enabled(s)),v),set:h=>{p=h}}),typeof t.init=="function"&&t.init(m),m}function o(s,u){let p=t(this.namespace+(typeof u>"u"?":":u)+s);return p.log=this.log,p}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 p of u)p[0]==="-"?t.skips.push(p.slice(1)):t.names.push(p)}function i(s,u){let p=0,g=0,v=-1,m=0;for(;p<s.length;)if(g<u.length&&(u[g]===s[p]||u[g]==="*"))u[g]==="*"?(v=g,m=p,g++):(p++,g++);else if(v!==-1)g=v+1,m++,p=m;else return!1;for(;g<u.length&&u[g]==="*";)g++;return g===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}gt.exports=oo});var vt=je((I,ye)=>{I.formatArgs=ao;I.save=io;I.load=so;I.useColors=no;I.storage=lo();I.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`."))}})();I.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 no(){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 ao(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+ye.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)}I.log=console.debug||console.log||(()=>{});function io(e){try{e?I.storage.setItem("debug",e):I.storage.removeItem("debug")}catch{}}function so(){let e;try{e=I.storage.getItem("debug")||I.storage.getItem("DEBUG")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function lo(){try{return localStorage}catch{}}ye.exports=bt()(I);var{formatters:co}=ye.exports;co.j=function(e){try{return JSON.stringify(e)}catch(r){return"[UnexpectedJSONParseError]: "+r.message}}});import{template as Tr}from"solid-js/web";import{createComponent as Wa}from"solid-js/web";import{setAttribute as Na}from"solid-js/web";import{effect as Ha}from"solid-js/web";import{insert as Ar}from"solid-js/web";import{getOwner as qa}from"solid-js/web";import{createMemo as Sr}from"solid-js";import{createStore as Va,reconcile as Ya}from"solid-js/store";import{render as Xa}from"solid-js/web";import{template as rt}from"solid-js/web";import{insert as be}from"solid-js/web";import{getOwner as Me}from"solid-js/web";import{use as ze}from"solid-js/web";import{createComponent as H}from"solid-js/web";import{createUniqueId as Rr,untrack as at}from"solid-js";import{isServer as Fr,isDev as it}from"solid-js/web";import{reconcile as Lr}from"solid-js/store";function We(e,r={}){let t=r.storage||globalThis.localStorage,o=r.name||`storage-${Rr()}`;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){it&&console.warn(u)}}:s=>{try{let u=a(s);e[1](Lr(u))}catch(u){it&&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||!Fr&&(u.url||globalThis.location.href)!==globalThis.location.href||u.newValue===i(at(s))||l(u.newValue)})}return Object.assign([],e,{1:typeof e[0]=="function"?s=>{let u=e[1](s),p=s!=null?i(u):s;return r.sync?.[1](o,p),p!=null?t.setItem(o,p,n):t.removeItem(o,n),d=!1,u}:(...s)=>{e[1](...s);let u=at(()=>i(e[0]));r.sync?.[1](o,u),t.setItem(o,u,n),d=!1},2:c})}import{createEffect as _r,createMemo as yr,createSignal as G,on as kr,onCleanup as za,onMount as Oa,Show as Oe}from"solid-js";import{createEffect as st,createSignal as lt,on as dt}from"solid-js";var j={leftCollapsed:"patchwork:leftSidebarCollapsed",rightCollapsed:"patchwork:rightSidebarCollapsed",leftWidth:"patchwork:leftSidebarWidth",rightWidth:"patchwork:rightSidebarWidth",contextToolId:"patchwork:contextSidebarToolId"},we="patchwork:collapse-context-sidebar",xe=400;function ct(e,r){let t=localStorage.getItem(e);return t?parseInt(t,10):r}function ut(e){return localStorage.getItem(e)==="true"}function Pr(){let[e,r]=lt(ut(j.leftCollapsed)),[t,o]=lt(ct(j.leftWidth,xe));return st(dt(e,n=>{localStorage.setItem(j.leftCollapsed,String(n))})),st(dt(t,n=>{localStorage.setItem(j.leftWidth,String(n))})),{isSidebarCollapsed:e,setIsSidebarCollapsed:r,leftSidebarWidth:t,setLeftSidebarWidth:o}}import{onCleanup as Mr,onMount as zr}from"solid-js";var pt=180,Or=720,Ur=120,ht=3;function Ne(e,{isCollapsed:r,setCollapsed:t,setWidth:o}){let n=!1,i=null,a=!1,c=null,l=f=>{if(f<Ur){r()||t(!0),c=null;return}r()&&t(!1);let w=Math.min(Or,f);o(w),c=w},d=()=>{r()||c!==null&&c<pt&&o(pt)},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)},p=()=>{n=!1,i=null,document.body.style.userSelect="",document.body.removeAttribute("data-sidebar-resizing"),s?.remove(),s=null},g=f=>{f.preventDefault(),i={x:f.clientX,y:f.clientY},a=!1,c=null,n=!0,document.body.style.userSelect="none"},v=()=>{let f=n,w=a;p(),f&&w&&d()},m=f=>{if(!n||!i)return;let w=Math.abs(f.clientX-i.x),T=Math.abs(f.clientY-i.y);!a&&(w>ht||T>ht)&&(a=!0,u()),l(e==="left"?f.clientX:window.innerWidth-f.clientX)},h=f=>{if(a){f.preventDefault(),f.stopPropagation(),a=!1;return}t(w=>!w)};return zr(()=>{document.addEventListener("mousemove",m),document.addEventListener("mouseup",v),Mr(()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",v),n&&p()})}),{handleMouseDown:g,handleToggleClick:h}}import{createEffect as jr,createSignal as Wr,onCleanup as Nr}from"solid-js";var Q=(e,r)=>{let[t,o]=Wr(!1);return jr(()=>{let n=r();if(!n)return;o(!1);let i=a=>{a.detail?.componentId===e&&o(!0)};n.addEventListener("patchwork:mounted",i),Nr(()=>n.removeEventListener("patchwork:mounted",i))}),t};import{createEffect as Hr,createSignal as qr,onCleanup as Br}from"solid-js";var Jr=5e3,Vr=(e,r)=>{let[t,o]=qr(!1);return Hr(()=>{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),Jr);Br(()=>{n.removeEventListener("patchwork:mounted",a),n.removeEventListener("patchwork:no-tool",a),clearTimeout(c)})}),t};import{getRegistry as Yr}from"@inkandswitch/patchwork-plugins";import{createMemo as Xr,createSignal as Gr,onCleanup as Kr}from"solid-js";function de(e){let r=Yr("patchwork:component"),[t,o]=Gr(0),n=r.on("changed",()=>o(i=>i+1));return Kr(n),Xr(()=>(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 me}from"solid-js/web";import{delegateEvents as en}from"solid-js/web";import{getOwner as tn}from"solid-js/web";import{effect as Bt}from"solid-js/web";import{setAttribute as rn}from"solid-js/web";import{memo as Jt}from"solid-js/web";import{insert as ae}from"solid-js/web";import{createComponent as ie}from"solid-js/web";import{For as dn,Show as Ye}from"solid-js";import{template as Et}from"solid-js/web";import{delegateEvents as _o}from"solid-js/web";import{setAttribute as yo}from"solid-js/web";import{insert as ko}from"solid-js/web";import"solid-js/web";import{effect as St}from"solid-js/web";import{use as Tt}from"solid-js/web";import{createComponent as He}from"solid-js/web";var _t=Ir(vt(),1),yt=(0,_t.default)("cabbages");function wt(e){return typeof e=="object"&&typeof e!=null&&Object.getPrototypeOf(e)==Object.prototype}var uo="\uFFFC";function kt(e,...r){if(r.length==0){yt("empty patch");return}let[t,o,n]=r,i=[...t];for(;;){let a=i.shift();if(!i.length){let l=Array.isArray(o);if(wt(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 p=typeof n>"u",g=d===s&&!p,v=u&&!p,m=!g&&!p&&!v;if(typeof e[a]>"u"){if(typeof e=="string")return;typeof n=="string"?e[a]="":e[a]=[]}let h=e[a];if(Array.isArray(h)){if(v){Array.isArray(n)?h.push(...n):h.push(n);return}if(g||m){Array.isArray(n)?h.splice(d,s-d,...n):h.splice(d,s-d,n);return}if(p){h.splice(d,s-d);return}throw new Error("i don't know what happened")}if(typeof h=="string"){if(v){e[a]=h+n;return}if(m||g){e[a]=h.slice(0,d)+(typeof n=="string"?n:n.map(f=>typeof f=="string"?f:uo).join(""))+h.slice(s);return}if(p){e[a]=h.slice(0,d)+h.slice(s);return}throw new Error("i don't know what happened")}if(wt(h)&&l&&typeof o[0]=="string"){delete h[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 Ct(e,r){let t=e.path.slice(0,-1),o=e.path[e.path.length-1];switch(e.action){case"mark":case"unmark":return yt(`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 ke(e){return r=>{for(let t of e.patches)kt(r,...Ct(t,e))}}import{createMemo as mo}from"solid-js";import{onCleanup as po}from"solid-js";import{createStore as ho,produce as fo,reconcile as $t}from"solid-js/store";var ce=new WeakMap;function Ce(e){if(po(()=>{let i=ce.get(e);i&&(i.refs--||i.cleanup())}),ce.has(e)){let i=ce.get(e);return i.refs++,i.store}let[r,t]=ho(structuredClone(e.doc()));ce.set(e,{refs:0,store:r,cleanup(){e.off("change",o),e.off("delete",n),ce.delete(e)}});function o(i){if(i.scopeReplaced){t($t(i.doc??{}));return}t(fo(ke(i)))}function n(){t($t({}))}return e.on("change",o),e.on("delete",n),e.whenReady().then(()=>{t(structuredClone(e.doc()))}),r}import{getOwner as Fi,onCleanup as Li,createSignal as Pi,untrack as Mi,sharedConfig as zi,onMount as Oi,DEV as Ui,equalFn as ji}from"solid-js";import{isServer as Ni}from"solid-js/web";var oe=e=>typeof e=="function"&&!e.length?e():e;function $e(e){return mo(()=>oe(e)&&Ce(oe(e)))}import{createEffect as bo,createResource as vo,useContext as wo}from"solid-js";import{createContext as go}from"solid-js";var Se=go(null);function ue(e,r){let t=wo(Se);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=oe(e);if(!c)return;let l=o.findWithProgress(c).peek();return l.state==="ready"?l.handle:void 0}let[i,{mutate:a}]=vo(e,c=>o.findWithProgress(c).whenReady(),{initialValue:n()});return bo(()=>{oe(e)||a()}),i}function Ee(e,r){let t=ue(e,r);return[$e(t),t]}import{onCleanup as as}from"solid-js";import{createSignal as ss}from"solid-js";import{createEffect as cs,onCleanup as us}from"solid-js";import{createSignal as hs}from"solid-js";import{useContext as xs}from"solid-js";import{getType as $o}from"@inkandswitch/patchwork-filesystem";import{getRegistry as So,isLoadedPlugin as Eo}from"@inkandswitch/patchwork-plugins";import{createEffect as To,createMemo as Te,createSignal as qe,onCleanup as Ao,onMount as Dt,Show as It}from"solid-js";var At=Et("<span class=threepane__title-text>"),Co=Et("<input class=threepane__title-input type=text>");function Rt(e){let r,[t,o]=qe();return Dt(()=>{o(r.closest("repo-provider")?.repo)}),He(It,{get when(){return t()},get fallback(){return(()=>{var n=At(),i=r;return typeof i=="function"?Tt(i,n):r=n,n})()},children:n=>He(Do,{get docUrl(){return e.docUrl},get repo(){return n()}})})}function Do(e){let[r,t]=Ee(()=>e.docUrl(),{repo:e.repo}),o=So("patchwork:datatype"),[n,i]=qe(0);Dt(()=>{let m=o.on("changed",()=>i(h=>h+1));Ao(m)});let a=Te(()=>{let m=r();return m?$o(m):void 0});To(()=>{let m=a();m&&o.load(m)});let c=Te(()=>{n();let m=a();if(!m)return;let h=o.get(m);return h&&Eo(h)?h:void 0}),l=Te(()=>{let m=r(),h=c();if(!(!m||!h))return h.module.getTitle(m)}),d=Te(()=>!!t()&&typeof c()?.module.setTitle=="function"),[s,u]=qe(!1),p;function g(){d()&&(u(!0),queueMicrotask(()=>{p?.focus(),p?.select()}))}function v(m){if(!s()||(u(!1),!m))return;let h=p?.value.trim();if(!h||h===l())return;let f=t(),w=c()?.module.setTitle;!f||!w||f.change(T=>{w(T,h);let A=T["@patchwork"];A&&(A.title=h)})}return He(It,{get when(){return s()},get fallback(){return(()=>{var m=At();return m.$$click=g,ko(m,()=>l()??"Untitled"),St(h=>{var f=!!d(),w=d()?"Rename":void 0;return f!==h.e&&m.classList.toggle("threepane__title-text--editable",h.e=f),w!==h.t&&yo(m,"title",h.t=w),h},{e:void 0,t:void 0}),m})()},get children(){var m=Co();m.$$keydown=f=>{f.key==="Enter"?(f.preventDefault(),v(!0)):f.key==="Escape"&&(f.preventDefault(),v(!1))},m.addEventListener("blur",()=>v(!0));var h=p;return typeof h=="function"?Tt(h,m):p=m,St(()=>m.value=l()??""),m}})}_o(["keydown","click"]);import{template as fe}from"solid-js/web";import{delegateEvents as Ho}from"solid-js/web";import{getOwner as qo}from"solid-js/web";import{insert as he}from"solid-js/web";import{createComponent as ne}from"solid-js/web";import{Show as Be}from"solid-js";import{template as Mt}from"solid-js/web";import{delegateEvents as Io}from"solid-js/web";import{setStyleProperty as Ro}from"solid-js/web";import{insert as Fo}from"solid-js/web";import{setAttribute as Ae}from"solid-js/web";import{effect as Ft}from"solid-js/web";import{memo as pe}from"solid-js/web";import{createComponent as Lt}from"solid-js/web";import{Show as Pt}from"solid-js";var Lo=Mt('<button class="sidebar-toggle sidebar-toggle--resizable">'),Po=Mt("<div class=sidebar>");function zt(e){let r=()=>`${e.isCollapsed()?0:e.width()}px`,t=()=>e.canExpand?.()??!0,o=()=>Lt(Pt,{get when(){return!e.isCollapsed()},get children(){return e.children}}),n=()=>Lt(Pt,{get when(){return!e.isCollapsed()||t()},get children(){var i=Lo();return i.$$mousedown=a=>e.onMouseDown(a),i.$$click=a=>e.onToggleClick(a),Ft(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&&Ae(i,"aria-label",a.e=c),l!==a.t&&Ae(i,"title",a.t=l),a},{e:void 0,t:void 0}),i}});return(()=>{var i=Po();return Fo(i,(()=>{var a=pe(()=>e.side==="left");return()=>a()?[pe(o),pe(n)]:[pe(n),pe(o)]})()),Ft(a=>{var c=e.side,l=e.isCollapsed()?"":void 0,d=r();return c!==a.e&&Ae(i,"data-side",a.e=c),l!==a.t&&Ae(i,"data-collapsed",a.t=l),d!==a.a&&Ro(i,"width",a.a=d),a},{e:void 0,t:void 0,a:void 0}),i})()}Io(["click","mousedown"]);import{template as Ut}from"solid-js/web";import{delegateEvents as Mo}from"solid-js/web";import{setAttribute as zo}from"solid-js/web";import{effect as Oo}from"solid-js/web";import{insert as Ot}from"solid-js/web";import{createComponent as Uo}from"solid-js/web";import{For as No}from"solid-js";var jo=Ut("<div role=tablist class=context-sidebar__tablist>"),Wo=Ut("<button type=button role=tab class=context-sidebar__tab>");function jt(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=jo();return Ot(t,Uo(No,{get each(){return e.items()},children:o=>(()=>{var n=Wo();return n.$$click=()=>e.setSelectedToolId(o.id),Ot(n,()=>o.name),Oo(()=>zo(n,"data-active",r()===o.id?"":void 0)),n})()})),t})()}Mo(["click"]);var Bo=fe('<div class=context-sidebar__tabs><button type=button class=context-sidebar__close title="Hide context sidebar"aria-label="Hide context sidebar">'),Jo=fe("<div class=context-sidebar__content>"),Vo=fe("<div class=context-sidebar>"),Yo=fe("<patchwork-view>",!0,!1,!1),Xo=fe('<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 Wt(e){let r=de("context-tool"),t=()=>{let o=r().map(i=>i.id),n=e.selectedToolId();return n&&o.includes(n)?n:o[0]};return ne(zt,{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=Vo();return he(o,ne(Be,{get when(){return r().length},get children(){var n=Bo(),i=n.firstChild;return he(n,ne(jt,{items:r,get selectedToolId(){return e.selectedToolId},get setSelectedToolId(){return e.setSelectedToolId}}),i),i.$$click=()=>e.onCollapse(),he(i,ne(Je,{})),n}}),null),he(o,ne(Be,{get when(){return!e.isCollapsed()},get children(){var n=Jo();return he(n,ne(Be,{get when(){return t()},keyed:!0,children:i=>(()=>{var a=Yo();return a.component=i,a._$owner=qo(),a})()})),n}}),null),o}})}function Je(){return Xo()}Ho(["click"]);import{template as Go}from"solid-js/web";import{effect as Nt}from"solid-js/web";import{getOwner as Ht}from"solid-js/web";import{createComponent as Ko}from"solid-js/web";import{memo as Zo}from"solid-js/web";import{Show as Qo}from"solid-js";var qt=Go("<patchwork-view>",!0,!1,!1),Ve=e=>Array.isArray(e)?String(e[0]):String(e);function Dl(e){let r=new Set;return e.filter(t=>{let o=Ve(t);return r.has(o)?!1:(r.add(o),!0)})}function Il(e){return Ko(Qo,{get when(){return Zo(()=>!!Array.isArray(e.slot))()?e.slot:!1},get fallback(){return(()=>{var r=qt();return r._$owner=Ht(),Nt(()=>r.component=String(e.slot)),r})()},children:r=>(()=>{var t=qt();return t._$owner=Ht(),Nt(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 on=me("<div class=threepane__title>"),nn=me("<div class=threepane__doctitle-tools>"),an=me('<button type=button class=frame__sidebar-toggle title="Show context sidebar"aria-label="Show context sidebar">'),sn=me("<div class=frame__topbar><div class=threepane__spacer>"),ln=me("<patchwork-view>",!0,!1,!1);function Vt(e){let r=()=>e.toolSlots()??[];return(()=>{var t=sn(),o=t.firstChild;return ae(t,ie(Ye,{get when(){return e.docUrl()},get children(){var n=on();return ae(n,ie(Rt,{get docUrl(){return e.docUrl}})),n}}),o),ae(t,ie(Ye,{get when(){return Jt(()=>!!e.docUrl())()&&r().length},get children(){var n=nn();return ae(n,ie(dn,{get each(){return r()},children:i=>(()=>{var a=ln();return a._$owner=tn(),Bt(c=>{var l=Ve(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),ae(t,ie(Ye,{get when(){return Jt(()=>!!e.hasContext())()&&e.isRightCollapsed()},get children(){var n=an();return n.$$click=()=>e.onToggleRight(),rn(n,"aria-pressed",!1),ae(n,ie(Je,{})),n}}),null),Bt(()=>t.classList.toggle("frame__topbar--left-collapsed",!!e.isLeftCollapsed())),t})()}en(["click"]);import{template as Pe}from"solid-js/web";import{effect as mr}from"solid-js/web";import{getOwner as gr}from"solid-js/web";import{insert as X}from"solid-js/web";import{createComponent as L}from"solid-js/web";import{memo as tt}from"solid-js/web";import{use as br}from"solid-js/web";import{parseAutomergeUrl as ka}from"@automerge/automerge-repo/slim";import{getSuggestedImportUrl as Ca,getType as $a}from"@inkandswitch/patchwork-filesystem";import{getFallbackTool as Sa,getRegistry as Ea}from"@inkandswitch/patchwork-plugins";import{createEffect as Ta,createMemo as et,createSignal as Y,onCleanup as le,onMount as Aa,Show as N}from"solid-js";import{template as S}from"solid-js/web";import{delegateEvents as Yn}from"solid-js/web";import{setAttribute as Fe}from"solid-js/web";import{effect as cr}from"solid-js/web";import"solid-js/web";import{createComponent as R}from"solid-js/web";import{insert as F}from"solid-js/web";import{use as Xn}from"solid-js/web";import{importPackage as ma}from"@inkandswitch/patchwork-filesystem";import{registerPlugins as ga}from"@inkandswitch/patchwork-plugins";import{createResource as ba,createSignal as Le,onCleanup as dr,onMount as va,Show as W}from"solid-js";import{template as C}from"solid-js/web";import{delegateEvents as bn}from"solid-js/web";import{effect as ar}from"solid-js/web";import{memo as vn}from"solid-js/web";import{insert as b}from"solid-js/web";import{createComponent as _}from"solid-js/web";import{use as wn}from"solid-js/web";import{setAttribute as ge}from"solid-js/web";import{createResource as Nn,createSignal as Ie,For as Ze,Match as se,onMount as Hn,Show as P,Switch as tr}from"solid-js";import*as Xt from"@automerge/automerge/slim";import{getImportableUrlFromAutomergeUrl as cn}from"@inkandswitch/patchwork-filesystem";var Xe=e=>e.startsWith("automerge:");function un(e){return e.replace(/[#?].*$/,"")}function Gt(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 pn(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 Kt(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 Yt(e){try{let r=await fetch(e);return r.ok?await r.json():void 0}catch{return}}var hn=new Set(["dist","build","lib","out","esm","src","public"]);async function fn(e){if(Xe(e)){let o=cn(e);return Yt(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 Yt(new URL("package.json",o).href);if(n&&typeof n=="object")return n;if(!hn.has(t.at(-1)?.toLowerCase()??""))return;t.pop()}}async function Zt(e){let r=await fn(e);if(r)return{name:O(r.name),title:O(r.title),version:O(r.version),description:O(r.description),author:pn(r.author),plugins:Array.isArray(r.plugins)?r.plugins.map(Kt):void 0}}var De,mn=1,V=new Map;function gn(){if(De)return De;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&&V.get(t.id);o&&(V.delete(t.id),t.type==="descriptors"?o.resolve(t.descriptors.map(Kt)):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 V.values())o.reject(t);V.clear(),De=void 0}),De=e,e}function Qt(e,r=15e3){let t=mn++;return new Promise((o,n)=>{let i=setTimeout(()=>{V.delete(t)&&n(new Error("it took too long to answer"))},r);V.set(t,{resolve:a=>{clearTimeout(i),o(a)},reject:a=>{clearTimeout(i),n(a)}});try{gn().postMessage({type:"discover",id:t,url:e})}catch(a){clearTimeout(i),V.delete(t),n(a instanceof Error?a:new Error(String(a)))}})}async function er(e,r){let t=await e.find(un(r)),o=t.doc();await new Promise(a=>setTimeout(a,0));let n=Xt.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 xn=C("<button type=button class=doc-card__link>see package details"),_n=C("<p class=pkg-about__quiet>reading\u2026"),yn=C("<p class=pkg-about__quiet>no package.json."),kn=C("<dl class=pkg-about__facts><dt>plugins</dt><dd>"),Cn=C("<dt>pinned"),Ke=C("<dd>"),Ge=C("<dt>history"),$n=C("<dd class=pkg-about__quiet>reading\u2026"),Sn=C("<dd class=pkg-about__quiet>couldn't get its folder."),En=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">'),Tn=C("<span class=pkg-about__version> "),An=C("<button type=button class=doc-card__link>"),Dn=C("<span class=pkg-about__quiet>unknown until loaded"),In=C("<p class=doc-card__notice>"),Rn=C("<dt>heads"),Fn=C("<dd> <!>, <!> <p class=pkg-about__quiet>writers are devices, not people. folder only."),Ln=C("<dt>"),ir=C("<ul class=pkg-about__list>"),Pn=C("<span>nothing"),Mn=C("<span class=pkg-about__quiet> for "),zn=C("<li>"),sr=C("<span class=pkg-about__quiet> \xB7 "),On=C("<span class=pkg-about__heads>"),Un=C("<code class=doc-card__code>"),jn=C("<li class=pkg-about__quiet>and <!> more"),Wn=C("<li><code class=doc-card__code></code> <!> "),qn=0;function lr(e){let r=`pkg-about-${++qn}`,t=Xe(e.url),o=Gt(e.url),[n,i]=Ie(!1),[a]=Nn(()=>n()&&t?e.url:void 0,f=>er(e.repo,f)),[c,l]=Ie(!1),[d,s]=Ie(),[u,p]=Ie();async function g(){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?`)){p(void 0),l(!0);try{s(await Qt(e.url))}catch(w){p(w?.message??String(w))}finally{l(!1)}}}let v;Hn(()=>{v.addEventListener("toggle",f=>{f.newState==="open"&&i(!0)})});let m=()=>e.claims?.title??e.claims?.name??"package",h=()=>d()??e.claims?.plugins;return[(()=>{var f=xn();return ge(f,"popovertarget",r),f})(),(()=>{var f=En(),w=f.firstChild,T=w.firstChild,A=T.nextSibling,U=w.nextSibling,q=U.firstChild,K=U.nextSibling,z=K.firstChild,B=z.nextSibling,x=B.firstChild,$=x.nextSibling,E=$.firstChild,D=v;return typeof D=="function"?wn(D,f):v=f,ge(f,"id",r),b(T,m,null),b(T,_(P,{get when(){return e.claims?.version},children:k=>(()=>{var y=Tn(),Z=y.firstChild;return b(y,k,null),y})()}),null),ge(A,"popovertarget",r),b(U,_(tr,{get children(){return[_(se,{get when(){return e.claimsLoading},get children(){return _n()}}),_(se,{get when(){return vn(()=>!e.claims)()&&!d()},get children(){return yn()}}),_(se,{when:!0,get children(){var k=kn(),y=k.firstChild,Z=y.nextSibling;return b(k,_(Re,{label:"name",get value(){return e.claims?.name}}),y),b(k,_(Re,{label:"title",get value(){return e.claims?.title}}),y),b(k,_(Re,{label:"author",get value(){return e.claims?.author}}),y),b(k,_(Re,{label:"description",get value(){return e.claims?.description}}),y),b(Z,_(P,{get when(){return h()},get fallback(){return _(P,{when:t,get fallback(){return Dn()},get children(){var M=An();return M.$$click=()=>void g(),b(M,()=>c()?"listing\u2026":"list them"),ar(()=>M.disabled=c()),M}})},children:M=>_(Bn,{get plugins(){return M()}})}),null),b(Z,_(P,{get when(){return u()},children:M=>(()=>{var ve=In();return b(ve,M),ve})()}),null),k}})]}}),null),b(E,()=>e.url),b(B,_(P,{get when(){return o.length},get children(){return[Cn(),(()=>{var k=Ke();return b(k,_(rr,{heads:o})),k})()]}}),null),b(B,_(P,{when:t,get children(){return _(tr,{get children(){return[_(se,{get when(){return a.loading},get children(){return[Ge(),$n()]}}),_(se,{get when(){return a.error},get children(){return[Ge(),Sn()]}}),_(se,{get when(){return a()},children:k=>[Rn(),(()=>{var y=Ke();return b(y,_(rr,{get heads(){return k().heads}})),y})(),Ge(),(()=>{var y=Fn(),Z=y.firstChild,M=Z.nextSibling,ve=M.nextSibling,ot=ve.nextSibling,Dr=ot.nextSibling,nt=Dr.nextSibling;return b(y,()=>k().changes,Z),b(y,()=>k().changes===1?"change":"changes",M),b(y,()=>k().writers.length,ot),b(y,()=>k().writers.length===1?"writer":"writers",nt),b(y,_(Jn,{get writers(){return k().writers}}),nt),y})()]})]}})}}),null),f})()]}function Re(e){return _(P,{get when(){return e.value},get children(){return[(()=>{var r=Ln();return b(r,()=>e.label),r})(),(()=>{var r=Ke();return b(r,()=>e.value),r})()]}})}function Bn(e){return _(P,{get when(){return e.plugins.length},get fallback(){return Pn()},get children(){var r=ir();return b(r,_(Ze,{get each(){return e.plugins},children:t=>(()=>{var o=zn();return b(o,()=>t.name??t.id??"(unnamed)",null),b(o,_(P,{get when(){return t.type},children:n=>(()=>{var i=sr(),a=i.firstChild;return b(i,n,null),i})()}),null),b(o,_(P,{get when(){return t.supportedDatatypes?.length},get children(){var n=Mn(),i=n.firstChild;return b(n,()=>t.supportedDatatypes.join(", "),null),n}}),null),o})()})),r}})}function rr(e){return(()=>{var r=On();return b(r,_(Ze,{get each(){return e.heads},children:t=>(()=>{var o=Un();return ge(o,"title",t),b(o,()=>t.slice(0,7)),o})()})),r})()}var or=6;function Jn(e){let r=()=>e.writers.length-or;return(()=>{var t=ir();return b(t,_(Ze,{get each(){return e.writers.slice(0,or)},children:o=>(()=>{var n=Wn(),i=n.firstChild,a=i.nextSibling,c=a.nextSibling,l=c.nextSibling;return b(i,()=>o.actor.slice(0,8)),b(n,()=>o.changes,c),b(n,()=>o.changes===1?"change":"changes",null),b(n,_(P,{get when(){return o.last},get children(){var d=sr(),s=d.firstChild;return b(d,()=>Vn(o),null),d}}),null),ar(()=>ge(i,"title",o.actor)),n})()}),null),b(t,_(P,{get when(){return r()>0},get children(){var o=jn(),n=o.firstChild,i=n.nextSibling,a=i.nextSibling;return b(o,r,i),o}}),null),t})()}function nr(e){return new Date(e*1e3).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Vn(e){let r=nr(e.last),t=e.first?nr(e.first):r;return t===r?r:`${t} \u2013 ${r}`}bn(["click"]);var Gn=S("<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>"),Kn=S('<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'),Zn=S("<p>it's a <code class=doc-card__code></code>.<br>nothing here opens one yet."),Qn=S("<p class=doc-card__links>"),ea=S("<p>it'll open here if a package adds a tool for it."),ta=S("<p>the doc suggests "),ra=S('<div class=doc-card__actions><button type=button class="doc-card__button doc-card__button--primary">'),oa=S("<strong class=pkg-line>"),na=S("<span class=pkg-line__version> "),aa=S("<p class=doc-card__notice>couldn't load it: "),ia=S("<button type=button class=doc-card__link>open doc with "),sa=S("<p>we couldn't get it from anywhere we looked.<br>that might mean:"),la=S("<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 "),da=S("<p>we'll keep looking. if it turns up, it'll open right here."),ca=S("<button type=button class=doc-card__sync>sync server"),ua=S("<span class=doc-card__sync-told role=status> (<!>)"),pa=S("<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."),ha=S("<p>if someone sent it to you, ask them for the link again."),fa=S('<p class=doc-card__aside><code class="doc-card__code doc-card__url">');function Qe(e){let r;return va(()=>{r.dispatchEvent(new CustomEvent("patchwork:no-tool",{bubbles:!0,composed:!0,detail:{url:e.url}}))}),(()=>{var t=Gn(),o=t.firstChild,n=o.nextSibling,i=n.firstChild,a=r;return typeof a=="function"?Xn(a,t):r=t,F(i,()=>e.title),F(n,()=>e.children,null),t})()}function ur(){return Kn()}function pr(e){let[r,t]=Le(!1),[o,n]=Le(),[i]=ba(()=>e.suggestion,l=>Zt(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 ma(l);if(!Array.isArray(s?.plugins))throw new Error("it doesn't export any plugins");ga(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 R(Qe,{get url(){return e.url},title:"no tool for this",get children(){return[(()=>{var l=Zn(),d=l.firstChild,s=d.nextSibling;return F(s,()=>e.type),l})(),R(W,{get when(){return e.suggestion},get fallback(){return ea()},children:l=>[(()=>{var d=ta(),s=d.firstChild;return F(d,R(W,{get when(){return c()},fallback:"a package.",children:u=>[(()=>{var p=oa();return F(p,()=>u().title??u().name),p})(),R(W,{get when(){return u().version},children:p=>(()=>{var g=na(),v=g.firstChild;return F(g,p,null),g})()}),"."]}),null),d})(),(()=>{var d=ra(),s=d.firstChild;return s.$$click=()=>void a(l()),F(s,()=>r()?"loading\u2026":"load package"),cr(()=>s.disabled=r()),d})(),R(W,{get when(){return o()},children:d=>(()=>{var s=aa(),u=s.firstChild;return F(s,d,null),s})()})]}),R(W,{get when(){return e.suggestion||e.anything},get children(){var l=Qn();return F(l,R(W,{get when(){return e.suggestion},children:d=>R(lr,{get url(){return d()},get repo(){return e.repo},get claims(){return i()},get claimsLoading(){return i.loading}})}),null),F(l,R(W,{get when(){return e.anything},children:d=>(()=>{var s=ia(),u=s.firstChild;return s.$$click=()=>e.onPeek(d().id),F(s,()=>d().name.toLowerCase(),null),s})()}),null),l}})]}})}function hr(e){let r=e.repo,t=typeof r.isSubductionConnected=="function",[o,n]=Le(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),dr(()=>r.off("subduction-connection",a))}if(t){let a=setInterval(()=>i(r.isSubductionConnected()),2e3);dr(()=>clearInterval(a))}return R(Qe,{get url(){return e.url},title:"can't load this doc",get children(){return[sa(),(()=>{var a=la(),c=a.firstChild,l=c.nextSibling,d=l.nextSibling,s=d.firstChild;return F(d,R(W,{get when(){return o()!==void 0},fallback:"sync server",get children(){return R(wa,{get connected(){return o()}})}}),null),a})(),da()]}})}function wa(e){let[r,t]=Le(!1),o=()=>`sync server: ${e.connected?"connected":"disconnected"}`;return[(()=>{var n=ca();return n.$$click=()=>t(i=>!i),cr(i=>{var a=e.connected?"":void 0,c=o(),l=o(),d=r();return a!==i.e&&Fe(n,"data-connected",i.e=a),c!==i.t&&Fe(n,"title",i.t=c),l!==i.a&&Fe(n,"aria-label",i.a=l),d!==i.o&&Fe(n,"aria-expanded",i.o=d),i},{e:void 0,t:void 0,a:void 0,o:void 0}),n})(),R(W,{get when(){return r()},get children(){var n=ua(),i=n.firstChild,a=i.nextSibling,c=a.nextSibling;return F(n,()=>e.connected?"connected":"disconnected",a),n}})]}function fr(e){return R(Qe,{get url(){return e.url},title:"this link is broken",get children(){return[pa(),ha(),(()=>{var r=fa(),t=r.firstChild;return F(t,()=>e.url),r})()]}})}Yn(["click"]);var xa=Pe("<div class=document-view>"),vr=Pe("<patchwork-view>",!0,!1,!1),_a=Pe("<div class=placeholder>Select a document in the sidebar"),ya=Pe("<div class=doc-stack>");function wr({viewKey:e,selectedDocUrl:r,toolId:t,ref:o}){let n,[i,a]=Y();return Aa(()=>{a(n.closest("repo-provider")?.repo??null)}),(()=>{var c=xa();return br(l=>{n=l,o?.(l)},c),X(c,L(N,{get when(){return tt(()=>i()!==void 0)()&&e()},keyed:!0,children:l=>L(N,{get when(){return i()},get fallback(){return(()=>{var d=vr();return d._$owner=gr(),mr(s=>{var u=r(),p=t();return u!==s.e&&(d.docUrl=s.e=u),p!==s.t&&(d.toolId=s.t=p),s},{e:void 0,t:void 0}),d})()},children:d=>L(Da,{get url(){return r()},toolId:t,get repo(){return d()}})})}),null),X(c,(()=>{var l=tt(()=>!r());return()=>l()&&_a()})(),null),c})()}function Da(e){let r=Ea("patchwork:tool"),[t,o]=Y(0);le(r.on("changed",()=>{o(x=>x+1)}));let[n,i]=Y({state:"finding"}),[a,c]=Y(),l=()=>e.toolId()??a(),[d,s]=Y(!1),[u,p]=Y(0),g=!1;le(()=>g=!0);async function v(){try{let x=await e.repo.find(e.url);if(g)return;let $=n().state==="unavailable";i({state:"ready",doc:x.doc()}),$&&!d()&&p(E=>E+1)}catch(x){if(g)return;let $=Ra(x);i({state:$?"invalid":"unavailable"}),$||h(E=>E+1)}}let[m,h]=Y(0),f,w;function T(){w?.(),f=Ia(e.repo,e.url),w=f?.subscribe(x=>{x.state==="ready"&&n().state==="unavailable"&&v()})}le(()=>w?.()),v(),T();function A(){let x=e.repo;if(typeof x.resyncSubduction=="function")try{x.resyncSubduction(ka(e.url).documentId)}catch{}}let U;le(()=>clearTimeout(U));function q(x=1e3){A(),clearTimeout(U),U=setTimeout(()=>void v(),x)}Ta(()=>{let x=m();x===0||n().state!=="unavailable"||d()||(q(Math.min(3e4,3e3*2**(x-1))),le(()=>clearTimeout(U)))});let K=et(()=>{t();let x=n();if(x.state!=="ready")return x;let $=x.doc,E=$?$a($):void 0;if(!E)return{state:"open"};let D=l(),k;if(!D){let y=xr(()=>Sa($));y&&Fa(y.supportedDatatypes,E)?k={id:y.id,name:y.name}:y&&(D=y.id)}return D&&r.get(D)?{state:"open"}:{state:"no-tool",type:E,suggestion:Ca($),anything:k}}),z=et(()=>K().state),B=et(()=>{let x=K();return x.state==="no-tool"?x:void 0});return(()=>{var x=ya();return br($=>{let E=D=>{let k=D.detail;k?.url&&k.url!==e.url||(s(!0),n().state==="unavailable"&&v())};$.addEventListener("patchwork:mounted",E),le(()=>$.removeEventListener("patchwork:mounted",E))},x),X(x,L(N,{get when(){return z()==="open"||z()==="unavailable"},get children(){return L(N,{get when(){return u()+1},keyed:!0,children:$=>(()=>{var E=vr();return E._$owner=gr(),mr(D=>{var k=e.url,y=l();return k!==D.e&&(E.docUrl=D.e=k),y!==D.t&&(E.toolId=D.t=y),D},{e:void 0,t:void 0}),E})()})}}),null),X(x,L(N,{get when(){return z()==="finding"},get children(){return L(ur,{})}}),null),X(x,L(N,{get when(){return z()==="invalid"},get children(){return L(fr,{get url(){return e.url}})}}),null),X(x,L(N,{get when(){return tt(()=>z()==="unavailable")()&&!d()},get children(){return L(hr,{get url(){return e.url},get repo(){return e.repo},onRetry:q})}}),null),X(x,L(N,{get when(){return B()},children:$=>L(pr,{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),x})()}function Ia(e,r){let t=e.findWithProgress;if(typeof t=="function")return xr(()=>{let o=t.call(e,r);return typeof o?.subscribe=="function"&&typeof o?.peek=="function"?o:void 0})}function Ra(e){let r=e?.message??String(e);return/invalid (automergeurl|document url|documentid|document id)/i.test(r)}function Fa(e,r){let t=e==="*"?["*"]:e??[];return t.includes("*")&&!t.includes(r)}function xr(e){try{return e()}catch{return}}var La=rt("<patchwork-view component=patchwork-draft-state-provider>",!0,!1,!1),Pa=rt("<div class=frame__main-column><div class=frame__doc-column><div class=main-area>"),Ma=rt("<patchwork-view component=patchwork-draft-overlay-provider><patchwork-view component=patchwork-comments-provider><patchwork-view component=patchwork-focus-provider>",!0,!1,!1);function Cr(e){let[r,t]=G(e.initialRightCollapsed()),[o,n]=G(e.initialRightWidth());_r(kr(r,p=>{try{localStorage.setItem(j.rightCollapsed,String(p))}catch{}},{defer:!0})),_r(kr(o,p=>{try{localStorage.setItem(j.rightWidth,String(p))}catch{}},{defer:!0}));let i=Ne("right",{isCollapsed:r,setCollapsed:t,setWidth:n});Oa(()=>{let p=()=>t(!0);window.addEventListener(we,p),za(()=>window.removeEventListener(we,p))});let[a,c]=We(G(),{name:j.contextToolId}),[l,d]=G(),s=Q("patchwork-draft-state-provider",l),u=()=>s()?l():void 0;return H(Oe,{get when(){return e.selectedDocUrl()},keyed:!0,children:p=>(()=>{var g=La();return ze(d,g),g.docUrl=p,g._$owner=Me(),be(g,H(Oe,{get when(){return u()},children:v=>H(Ua,{get host(){return v()},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})})),g})()})}function Ua(e){let r=de("context-tool"),t=()=>r().length>0,o=yr(()=>e.selectedDocUrl()),[n,i]=G(),a=Q("patchwork-draft-overlay-provider",n),[c,l]=G(),d=Q("patchwork-comments-provider",c),[s,u]=G(),p=Q("patchwork-focus-provider",s),g=yr(()=>a()&&d()&&p());return(()=>{var v=Ma(),m=v.firstChild,h=m.firstChild;return ze(i,v),v._$owner=Me(),ze(l,m),m._$owner=Me(),ze(u,h),h._$owner=Me(),be(h,H(Oe,{get when(){return g()},get children(){var f=Pa(),w=f.firstChild,T=w.firstChild;return be(w,H(Vt,{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(A=>!A)}),T),be(T,H(wr,{viewKey:o,get selectedDocUrl(){return e.selectedDocUrl},get toolId(){return e.selectedToolId},ref:A=>e.setMainDocElement?.(A)})),be(f,H(Oe,{get when(){return t()},get children(){return H(Wt,{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),f}})),v})()}var Ue=`: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 $r(){let e="patchwork-frame-styles",r=document.getElementById(e);if(r){r.textContent!==Ue&&(r.textContent=Ue);return}let t=document.createElement("style");t.id=e,t.textContent=Ue,document.head.append(t)}var Ba=Tr("<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),Ja=Tr("<div class=frame>");function sc(e){let r=Sr(()=>{let o=new Set,n=e.selectedDocUrl();return n&&o.add(n),e.contactUrl&&o.add(e.contactUrl),[...o]}),t=Sr(()=>JSON.stringify({selectedDocUrl:e.selectedDocUrl(),selectedToolId:e.selectedToolId(),doctitleSlots:e.doctitleSlots(),isLeftCollapsed:e.isLeftCollapsed(),initialRightWidth:e.initialRightWidth(),initialRightCollapsed:e.initialRightCollapsed()}));return(()=>{var o=Ba(),n=o.firstChild;return o._$owner=qa(),Ar(n,t),Ha(()=>Na(o,"automerge-allowlist",r().join(","))),o})()}function Er(e){if(!e?.textContent)return{};try{return JSON.parse(e.textContent)}catch(r){return console.error("[threepane-isolation-root] bad props JSON:",r),{}}}function lc(e){$r();let r=e.querySelector('script[type="application/json"]'),[t,o]=Va(Er(r)),n=new MutationObserver(()=>{o(Ya(Er(r)))});r&&n.observe(r,{characterData:!0,childList:!0,subtree:!0});let i=Xa(()=>(()=>{var a=Ja();return Ar(a,Wa(Cr,{selectedDocUrl:()=>t.selectedDocUrl,selectedToolId:()=>t.selectedToolId,doctitleSlots:()=>t.doctitleSlots,isLeftCollapsed:()=>t.isLeftCollapsed??!1,initialRightWidth:()=>t.initialRightWidth??xe,initialRightCollapsed:()=>t.initialRightCollapsed??!1})),a})(),e);return()=>{n.disconnect(),i()}}export{vt as a,ue as b,j as c,we as d,xe as e,ct as f,ut as g,Pr as h,Ne as i,Vr as j,zt as k,Ve as l,Dl as m,Il as n,wr as o,Cr as p,$r as q,sc as r,lc as s};
1210
+ //# sourceMappingURL=chunk-LVZ6VVQF.js.map