@rizom/brain 0.2.0-alpha.812 → 0.2.0-alpha.813
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brain.js +4 -4
- package/dist/chunks/{app-qpfe9we3.js → app-dp77f48x.js} +2 -2
- package/dist/chunks/{index-h8kmfws8.js → index-k85eqshq.js} +2 -2
- package/dist/chunks/{index-3fsarvay.js → index-k9f824dj.js} +3 -3
- package/dist/chunks/{index-3fsarvay.js.map → index-k9f824dj.js.map} +1 -1
- package/dist/chunks/{package-ns4wpasv.js → package-4f5htv60.js} +3 -3
- package/dist/chunks/{package-ns4wpasv.js.map → package-4f5htv60.js.map} +1 -1
- package/dist/model.js +4 -4
- package/dist/model.js.map +1 -1
- package/dist/testing.js +1 -1
- package/dist/ui/{studio-app-023d8880dab10e4740921b89693c9df8122e7ba235ca87c3c9d22fae7fc330f8.css → studio-app-5bdcd9cd016f80c11395bbe23b418696473441a81e00d56a4b57c35311be00ab.css} +13 -0
- package/dist/ui/{studio-app-w59hyhkf.js → studio-app-wcr2aapb.js} +5 -5
- package/dist/ui/{studio-app-w59hyhkf.js.map → studio-app-wcr2aapb.js.map} +1 -1
- package/dist/ui/studio-asset-manifest.json +37 -37
- package/dist/ui/studio-chunks/{account-view-b2evrja2.js → account-view-tgaymkvr.js} +2 -2
- package/dist/ui/studio-chunks/{account-view-b2evrja2.js.map → account-view-tgaymkvr.js.map} +1 -1
- package/dist/ui/studio-chunks/{chat-mmjr8wmz.js → chat-yvjjpyqb.js} +2 -2
- package/dist/ui/studio-chunks/{chat-mmjr8wmz.js.map → chat-yvjjpyqb.js.map} +1 -1
- package/dist/ui/studio-chunks/{highlighted-body-OFNGDK62-cgp6zkr4.js → highlighted-body-OFNGDK62-6etvn2rv.js} +2 -2
- package/dist/ui/studio-chunks/{highlighted-body-OFNGDK62-cgp6zkr4.js.map → highlighted-body-OFNGDK62-6etvn2rv.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-m5z56g9h.js → main-63p7zhs5.js} +4 -4
- package/dist/ui/studio-chunks/{main-m5z56g9h.js.map → main-63p7zhs5.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-tpm8md0v.js → main-8tryr4tg.js} +2 -2
- package/dist/ui/studio-chunks/{main-tpm8md0v.js.map → main-8tryr4tg.js.map} +1 -1
- package/dist/ui/studio-chunks/main-btvhjems.js +6 -0
- package/dist/ui/studio-chunks/main-btvhjems.js.map +21 -0
- package/dist/ui/studio-chunks/{main-qsazykzx.js → main-dxzyxzd6.js} +2 -2
- package/dist/ui/studio-chunks/{main-qsazykzx.js.map → main-dxzyxzd6.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-r3c1gnzk.js → main-k5c23t4a.js} +35 -35
- package/dist/ui/studio-chunks/{main-r3c1gnzk.js.map → main-k5c23t4a.js.map} +2 -2
- package/dist/ui/studio-chunks/{main-w5dyhtpj.js → main-s8mh4mst.js} +3 -3
- package/dist/ui/studio-chunks/{main-w5dyhtpj.js.map → main-s8mh4mst.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-sfmn4003.js → main-sh3gd7gt.js} +2 -2
- package/dist/ui/studio-chunks/{main-sfmn4003.js.map → main-sh3gd7gt.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-8965fkrd.js → main-th1maryg.js} +2 -2
- package/dist/ui/studio-chunks/{main-8965fkrd.js.map → main-th1maryg.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-4saypexd.js → main-v1mxpp7f.js} +3 -3
- package/dist/ui/studio-chunks/{main-4saypexd.js.map → main-v1mxpp7f.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-kh9c8p9q.js → main-v63y95pw.js} +2 -2
- package/dist/ui/studio-chunks/{main-kh9c8p9q.js.map → main-v63y95pw.js.map} +1 -1
- package/dist/ui/studio-chunks/mermaid-GHXKKRXX-2d3nmnjs.js +3 -0
- package/dist/ui/studio-chunks/{studio-ask-panel-gm2gtrvk.js → studio-ask-panel-fxkbrg2k.js} +2 -2
- package/dist/ui/studio-chunks/{studio-ask-panel-gm2gtrvk.js.map → studio-ask-panel-fxkbrg2k.js.map} +1 -1
- package/dist/ui/studio-chunks/studio-chat-workspace-24s9ryqw.js +3 -0
- package/dist/ui/studio-chunks/studio-chat-workspace-24s9ryqw.js.map +22 -0
- package/package.json +1 -1
- package/dist/ui/studio-chunks/main-fyw0r43g.js +0 -6
- package/dist/ui/studio-chunks/main-fyw0r43g.js.map +0 -21
- package/dist/ui/studio-chunks/mermaid-GHXKKRXX-3a1txmqw.js +0 -3
- package/dist/ui/studio-chunks/studio-chat-workspace-zrztt0xb.js +0 -3
- package/dist/ui/studio-chunks/studio-chat-workspace-zrztt0xb.js.map +0 -21
- /package/dist/chunks/{app-qpfe9we3.js.map → app-dp77f48x.js.map} +0 -0
- /package/dist/chunks/{index-h8kmfws8.js.map → index-k85eqshq.js.map} +0 -0
- /package/dist/ui/studio-chunks/{mermaid-GHXKKRXX-3a1txmqw.js.map → mermaid-GHXKKRXX-2d3nmnjs.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as Ay,A as r3,B as Oy,C as Ly,D as Kc,E as Ty,F as Lx,G as Nx,H as Wa,I as Oh,J as zx,K as Ey,L as VL,M as wt,N as fy,O as gz,P as Mh,Q as zy,R as ZL,S as dy,T as Xc,U as vi,V as ts,W as Tz,X as ky,Y as Ez,Z as yz,_ as bz,a as SD,aa as S3,b as xD,ba as _z,c as kD,d as ng,e as Jt,f as ve,g as sg,h as Ir,i as OD,j as Ae,k as zD,l as rg,m as Az,n as Wn,o as BD,p as e3,q as HD,r as t3,s as n3,t as gn,u as i3,v as o3,w as s3,x as _x,y as ID,z as l3}from"./studio-chunks/main-8965fkrd.js";import{pa as jc,sa as Iz,ta as Uz}from"./studio-chunks/main-gttn05ps.js";import{$a as xz,Aa as cy,Ab as GO,Ba as fn,Bb as KO,Ca as Ar,Da as k3,Ea as L3,Eb as LL,Fa as w3,Ga as Uy,Ha as kl,Ia as Jz,Ja as Na,Ka as Hy,La as Fc,Ma as Ux,Na as Lh,Oa as Hs,Qa as y3,Ra as b3,Sa as z3,Ta as Ri,Ua as Iy,Wa as za,Xa as Ex,Za as Sz,_a as Dx,ab as kz,bb as wz,cb as no,db as Cz,fb as Mi,gb as ug,hb as T3,ib as E3,jb as $x,kb as hi,lb as Ol,mb as Vg,nb as ja,ob as di,pb as ey,qb as dh,rb as Gg,sb as rO,tb as aO,ub as hh,vb as LM,wb as zM,xa as R3,xb as F,ya as pc,yb as uL,za as O3,zb as hx}from"./studio-chunks/main-kh9c8p9q.js";import"./studio-chunks/main-m5z56g9h.js";import{Mb as Bz,Nb as Hz,Pb as C3,Vb as Oz,Xb as Lz,Yb as zz}from"./studio-chunks/main-tpm8md0v.js";import{$b as LD,Zb as li,_b as Gn,ac as Is}from"./studio-chunks/main-qsazykzx.js";import{Ac as my,Bc as gy,Ec as i2,Gc as ry,Hc as Jm,Ic as eg,Kc as ES,Lc as mn,Mc as re,Nc as Qn,Pc as $d,Sc as Ny,Vc as qd,Wc as oy,Xc as AS,Yc as YL,cc as N,cd as to,ec as Qz,ed as bi,fc as he,fd as hc,gc as hz,gd as A3,hc as we,hd as $n,ic as Eh,id as By,jc as La,jd as yi,kc as cg,kd as lg,mc as Qc,nc as Wc,oc as cz,od as jo,pc as Yc,pd as N3,qc as fz,qd as B3,rc as yn,rd as Kt,sc as Rz,sd as Vn,tc as RL,uc as ML,vc as OL,xc as Mz,yc as hy,zc as py}from"./studio-chunks/main-r3c1gnzk.js";import{Td as mi}from"./studio-chunks/main-w5dyhtpj.js";import{df as ft,ff as yH}from"./studio-chunks/main-4saypexd.js";import{Lf as Y,Nf as xS,Qf as fg}from"./studio-chunks/main-sfmn4003.js";var pD=xS(function(gH){(function(){function e(){if(q=!1,ce){var W=gH.unstable_now();pe=W;var oe=!0;try{e:{H=!1,V&&(V=!1,G(He),He=-1),M=!0;var ee=D;try{t:{u(W);for(C=o(S);C!==null&&!(C.expirationTime>W&&h());){var fe=C.callback;if(typeof fe==="function"){C.callback=null,D=C.priorityLevel;var me=fe(C.expirationTime<=W);if(W=gH.unstable_now(),typeof me==="function"){C.callback=me,u(W),oe=!0;break t}C===o(S)&&l(S),u(W)}else l(S);C=o(S)}if(C!==null)oe=!0;else{var Ye=o(w);Ye!==null&&p(f,Ye.startTime-W),oe=!1}}break e}finally{C=null,D=ee,M=!1}oe=void 0}}finally{oe?ye():ce=!1}}}function i(W,oe){var ee=W.length;W.push(oe);e:for(;0<ee;){var fe=ee-1>>>1,me=W[fe];if(0<a(me,oe))W[fe]=oe,W[ee]=me,ee=fe;else break e}}function o(W){return W.length===0?null:W[0]}function l(W){if(W.length===0)return null;var oe=W[0],ee=W.pop();if(ee!==oe){W[0]=ee;e:for(var fe=0,me=W.length,Ye=me>>>1;fe<Ye;){var Le=2*(fe+1)-1,dt=W[Le],tt=Le+1,Ie=W[tt];if(0>a(dt,ee))tt<me&&0>a(Ie,dt)?(W[fe]=Ie,W[tt]=ee,fe=tt):(W[fe]=dt,W[Le]=ee,fe=Le);else if(tt<me&&0>a(Ie,ee))W[fe]=Ie,W[tt]=ee,fe=tt;else break e}}return oe}function a(W,oe){var ee=W.sortIndex-oe.sortIndex;return ee!==0?ee:W.id-oe.id}function u(W){for(var oe=o(w);oe!==null;){if(oe.callback===null)l(w);else if(oe.startTime<=W)l(w),oe.sortIndex=oe.expirationTime,i(S,oe);else break;oe=o(w)}}function f(W){if(V=!1,u(W),!H)if(o(S)!==null)H=!0,ce||(ce=!0,ye());else{var oe=o(w);oe!==null&&p(f,oe.startTime-W)}}function h(){return q?!0:gH.unstable_now()-pe<U?!1:!0}function p(W,oe){He=j(function(){W(gH.unstable_now())},oe)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),gH.unstable_now=void 0,typeof performance==="object"&&typeof performance.now==="function"){var g=performance;gH.unstable_now=function(){return g.now()}}else{var y=Date,v=y.now();gH.unstable_now=function(){return y.now()-v}}var S=[],w=[],A=1,C=null,D=3,M=!1,H=!1,V=!1,q=!1,j=typeof setTimeout==="function"?setTimeout:null,G=typeof clearTimeout==="function"?clearTimeout:null,se=typeof setImmediate<"u"?setImmediate:null,ce=!1,He=-1,U=5,pe=-1;if(typeof se==="function")var ye=function(){se(e)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,vt=ae.port2;ae.port1.onmessage=e,ye=function(){vt.postMessage(null)}}else ye=function(){j(e,0)};gH.unstable_IdlePriority=5,gH.unstable_ImmediatePriority=1,gH.unstable_LowPriority=4,gH.unstable_NormalPriority=3,gH.unstable_Profiling=null,gH.unstable_UserBlockingPriority=2,gH.unstable_cancelCallback=function(W){W.callback=null},gH.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<W?Math.floor(1000/W):5},gH.unstable_getCurrentPriorityLevel=function(){return D},gH.unstable_next=function(W){switch(D){case 1:case 2:case 3:var oe=3;break;default:oe=D}var ee=D;D=oe;try{return W()}finally{D=ee}},gH.unstable_requestPaint=function(){q=!0},gH.unstable_runWithPriority=function(W,oe){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var ee=D;D=W;try{return oe()}finally{D=ee}},gH.unstable_scheduleCallback=function(W,oe,ee){var fe=gH.unstable_now();switch(typeof ee==="object"&&ee!==null?(ee=ee.delay,ee=typeof ee==="number"&&0<ee?fe+ee:fe):ee=fe,W){case 1:var me=-1;break;case 2:me=250;break;case 5:me=1073741823;break;case 4:me=1e4;break;default:me=5000}return me=ee+me,W={id:A++,callback:oe,priorityLevel:W,startTime:ee,expirationTime:me,sortIndex:-1},ee>fe?(W.sortIndex=ee,i(w,W),o(S)===null&&W===o(w)&&(V?(G(He),He=-1):V=!0,p(f,ee-fe))):(W.sortIndex=me,i(S,W),H||M||(H=!0,ce||(ce=!0,ye()))),W},gH.unstable_shouldYield=h,gH.unstable_wrapCallback=function(W){var oe=D;return function(){var ee=D;D=oe;try{return W.apply(this,arguments)}finally{D=ee}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var mD=xS(function(bH){var nt=Y(pD()),rc=Y(ft()),kS=Y(yH());(function(){function e(t,n){for(t=t.memoizedState;t!==null&&0<n;)t=t.next,n--;return t}function i(t,n,s,r){if(s>=n.length)return r;var c=n[s],d=dn(t)?t.slice():Ve({},t);return d[c]=i(t[c],n,s+1,r),d}function o(t,n,s){if(n.length!==s.length)console.warn("copyWithRename() expects paths of the same length");else{for(var r=0;r<s.length-1;r++)if(n[r]!==s[r]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return l(t,n,s,0)}}function l(t,n,s,r){var c=n[r],d=dn(t)?t.slice():Ve({},t);return r+1===n.length?(d[s[r]]=d[c],dn(d)?d.splice(c,1):delete d[c]):d[c]=l(t[c],n,s,r+1),d}function a(t,n,s){var r=n[s],c=dn(t)?t.slice():Ve({},t);if(s+1===n.length)return dn(c)?c.splice(r,1):delete c[r],c;return c[r]=a(t[r],n,s+1),c}function u(){return!1}function f(){return null}function h(){console.error("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://react.dev/link/rules-of-hooks")}function p(){console.error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().")}function g(){}function y(){}function v(t){var n=[];return t.forEach(function(s){n.push(s)}),n.sort().join(", ")}function S(t,n,s,r){return new sN(t,n,s,r)}function w(t,n){t.context===ir&&($b(t.current,2,n,t,null,null),bu())}function A(t,n){if(ao!==null){var s=n.staleFamilies;n=n.updatedFamilies,zf(),Sk(t.current,n,s),bu()}}function C(t){ao=t}function D(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function M(t){var n=t,s=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(s=n.return),t=n.return;while(t)}return n.tag===3?s:null}function H(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function V(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function q(t){if(M(t)!==t)throw Error("Unable to find node on an unmounted component.")}function j(t){var n=t.alternate;if(!n){if(n=M(t),n===null)throw Error("Unable to find node on an unmounted component.");return n!==t?null:t}for(var s=t,r=n;;){var c=s.return;if(c===null)break;var d=c.alternate;if(d===null){if(r=c.return,r!==null){s=r;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===s)return q(c),t;if(d===r)return q(c),n;d=d.sibling}throw Error("Unable to find node on an unmounted component.")}if(s.return!==r.return)s=c,r=d;else{for(var m=!1,b=c.child;b;){if(b===s){m=!0,s=c,r=d;break}if(b===r){m=!0,r=c,s=d;break}b=b.sibling}if(!m){for(b=d.child;b;){if(b===s){m=!0,s=d,r=c;break}if(b===r){m=!0,r=d,s=c;break}b=b.sibling}if(!m)throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(s.alternate!==r)throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(s.tag!==3)throw Error("Unable to find node on an unmounted component.");return s.stateNode.current===s?t:n}function G(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=G(t),n!==null)return n;t=t.sibling}return null}function se(t){if(t===null||typeof t!=="object")return null;return t=EA&&t[EA]||t["@@iterator"],typeof t==="function"?t:null}function ce(t){if(t==null)return null;if(typeof t==="function")return t.$$typeof===TB?null:t.displayName||t.name||null;if(typeof t==="string")return t;switch(t){case Au:return"Fragment";case Wb:return"Profiler";case Wp:return"StrictMode";case Xb:return"Suspense";case Fb:return"SuspenseList";case Kb:return"Activity"}if(typeof t==="object")switch(typeof t.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case Cu:return"Portal";case As:return t.displayName||"Context";case Yb:return(t._context.displayName||"Context")+".Consumer";case jf:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Yp:return n=t.displayName||null,n!==null?n:ce(t.type)||"Memo";case Wi:n=t._payload,t=t._init;try{return ce(t(n))}catch(s){}}return null}function He(t){return typeof t.tag==="number"?U(t):typeof t.name==="string"?t.name:null}function U(t){var n=t.type;switch(t.tag){case 31:return"Activity";case 24:return"Cache";case 9:return(n._context.displayName||"Context")+".Consumer";case 10:return n.displayName||"Context";case 18:return"DehydratedFragment";case 11:return t=n.render,t=t.displayName||t.name||"",n.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 26:case 27:case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ce(n);case 8:return n===Wp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 14:case 15:if(typeof n==="function")return n.displayName||n.name||null;if(typeof n==="string")return n;break;case 29:if(n=t._debugInfo,n!=null){for(var s=n.length-1;0<=s;s--)if(typeof n[s].name==="string")return n[s].name}if(t.return!==null)return U(t.return)}return null}function pe(t){return{current:t}}function ye(t,n){0>sl?console.error("Unexpected pop."):(n!==Jb[sl]&&console.error("Unexpected Fiber popped."),t.current=Zb[sl],Zb[sl]=null,Jb[sl]=null,sl--)}function ae(t,n,s){sl++,Zb[sl]=t.current,Jb[sl]=s,t.current=n}function vt(t){return t===null&&console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."),t}function W(t,n){ae(Kl,n,t),ae(Vf,t,t),ae(Fl,null,t);var s=n.nodeType;switch(s){case 9:case 11:s=s===9?"#document":"#fragment",n=(n=n.documentElement)?(n=n.namespaceURI)?KC(n):vl:vl;break;default:if(s=n.tagName,n=n.namespaceURI)n=KC(n),n=ZC(n,s);else switch(s){case"svg":n=sc;break;case"math":n=Qm;break;default:n=vl}}s=s.toLowerCase(),s=Gx(null,s),s={context:n,ancestorInfo:s},ye(Fl,t),ae(Fl,s,t)}function oe(t){ye(Fl,t),ye(Vf,t),ye(Kl,t)}function ee(){return vt(Fl.current)}function fe(t){t.memoizedState!==null&&ae(Xp,t,t);var n=vt(Fl.current),s=t.type,r=ZC(n.context,s);s=Gx(n.ancestorInfo,s),r={context:r,ancestorInfo:s},n!==r&&(ae(Vf,t,t),ae(Fl,r,t))}function me(t){Vf.current===t&&(ye(Fl,t),ye(Vf,t)),Xp.current===t&&(ye(Xp,t),Bd._currentValue=Ma)}function Ye(){}function Le(){if(Gf===0){DA=console.log,RA=console.info,MA=console.warn,OA=console.error,LA=console.group,zA=console.groupCollapsed,NA=console.groupEnd;var t={configurable:!0,enumerable:!0,value:Ye,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}Gf++}function dt(){if(Gf--,Gf===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Ve({},t,{value:DA}),info:Ve({},t,{value:RA}),warn:Ve({},t,{value:MA}),error:Ve({},t,{value:OA}),group:Ve({},t,{value:LA}),groupCollapsed:Ve({},t,{value:zA}),groupEnd:Ve({},t,{value:NA})})}0>Gf&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function tt(t){var n=Error.prepareStackTrace;if(Error.prepareStackTrace=void 0,t=t.stack,Error.prepareStackTrace=n,t.startsWith(`Error: react-stack-top-frame
|
|
1
|
+
import{$ as Ay,A as r3,B as Oy,C as Ly,D as Kc,E as Ty,F as Lx,G as Nx,H as Wa,I as Oh,J as zx,K as Ey,L as VL,M as wt,N as fy,O as gz,P as Mh,Q as zy,R as ZL,S as dy,T as Xc,U as vi,V as ts,W as Tz,X as ky,Y as Ez,Z as yz,_ as bz,a as SD,aa as S3,b as xD,ba as _z,c as kD,d as ng,e as Jt,f as ve,g as sg,h as Ir,i as OD,j as Ae,k as zD,l as rg,m as Az,n as Wn,o as BD,p as e3,q as HD,r as t3,s as n3,t as gn,u as i3,v as o3,w as s3,x as _x,y as ID,z as l3}from"./studio-chunks/main-th1maryg.js";import{pa as jc,sa as Iz,ta as Uz}from"./studio-chunks/main-gttn05ps.js";import{$a as xz,Aa as cy,Ab as GO,Ba as fn,Bb as KO,Ca as Ar,Da as k3,Ea as L3,Eb as LL,Fa as w3,Ga as Uy,Ha as kl,Ia as Jz,Ja as Na,Ka as Hy,La as Fc,Ma as Ux,Na as Lh,Oa as Hs,Qa as y3,Ra as b3,Sa as z3,Ta as Ri,Ua as Iy,Wa as za,Xa as Ex,Za as Sz,_a as Dx,ab as kz,bb as wz,cb as no,db as Cz,fb as Mi,gb as ug,hb as T3,ib as E3,jb as $x,kb as hi,lb as Ol,mb as Vg,nb as ja,ob as di,pb as ey,qb as dh,rb as Gg,sb as rO,tb as aO,ub as hh,vb as LM,wb as zM,xa as R3,xb as F,ya as pc,yb as uL,za as O3,zb as hx}from"./studio-chunks/main-v63y95pw.js";import"./studio-chunks/main-63p7zhs5.js";import{Mb as Bz,Nb as Hz,Pb as C3,Vb as Oz,Xb as Lz,Yb as zz}from"./studio-chunks/main-8tryr4tg.js";import{$b as LD,Zb as li,_b as Gn,ac as Is}from"./studio-chunks/main-dxzyxzd6.js";import{Ac as my,Bc as gy,Ec as i2,Gc as ry,Hc as Jm,Ic as eg,Kc as ES,Lc as mn,Mc as re,Nc as Qn,Pc as $d,Tc as Ny,Wc as qd,Xc as oy,Yc as AS,Zc as YL,cc as N,dd as to,ec as Qz,fc as he,fd as bi,gc as hz,gd as hc,hc as we,hd as A3,ic as Eh,id as $n,jc as La,jd as By,kc as cg,kd as yi,ld as lg,mc as Qc,nc as Wc,oc as cz,pc as Yc,pd as jo,qc as fz,qd as N3,rc as yn,rd as B3,sc as Rz,sd as Kt,tc as RL,td as Vn,uc as ML,vc as OL,xc as Mz,yc as hy,zc as py}from"./studio-chunks/main-k5c23t4a.js";import{Ud as mi}from"./studio-chunks/main-s8mh4mst.js";import{ef as ft,gf as yH}from"./studio-chunks/main-v1mxpp7f.js";import{Mf as Y,Of as xS,Rf as fg}from"./studio-chunks/main-sh3gd7gt.js";var pD=xS(function(gH){(function(){function e(){if(q=!1,ce){var W=gH.unstable_now();pe=W;var oe=!0;try{e:{H=!1,V&&(V=!1,G(He),He=-1),M=!0;var ee=D;try{t:{u(W);for(C=o(S);C!==null&&!(C.expirationTime>W&&h());){var fe=C.callback;if(typeof fe==="function"){C.callback=null,D=C.priorityLevel;var me=fe(C.expirationTime<=W);if(W=gH.unstable_now(),typeof me==="function"){C.callback=me,u(W),oe=!0;break t}C===o(S)&&l(S),u(W)}else l(S);C=o(S)}if(C!==null)oe=!0;else{var Ye=o(w);Ye!==null&&p(f,Ye.startTime-W),oe=!1}}break e}finally{C=null,D=ee,M=!1}oe=void 0}}finally{oe?ye():ce=!1}}}function i(W,oe){var ee=W.length;W.push(oe);e:for(;0<ee;){var fe=ee-1>>>1,me=W[fe];if(0<a(me,oe))W[fe]=oe,W[ee]=me,ee=fe;else break e}}function o(W){return W.length===0?null:W[0]}function l(W){if(W.length===0)return null;var oe=W[0],ee=W.pop();if(ee!==oe){W[0]=ee;e:for(var fe=0,me=W.length,Ye=me>>>1;fe<Ye;){var Le=2*(fe+1)-1,dt=W[Le],tt=Le+1,Ie=W[tt];if(0>a(dt,ee))tt<me&&0>a(Ie,dt)?(W[fe]=Ie,W[tt]=ee,fe=tt):(W[fe]=dt,W[Le]=ee,fe=Le);else if(tt<me&&0>a(Ie,ee))W[fe]=Ie,W[tt]=ee,fe=tt;else break e}}return oe}function a(W,oe){var ee=W.sortIndex-oe.sortIndex;return ee!==0?ee:W.id-oe.id}function u(W){for(var oe=o(w);oe!==null;){if(oe.callback===null)l(w);else if(oe.startTime<=W)l(w),oe.sortIndex=oe.expirationTime,i(S,oe);else break;oe=o(w)}}function f(W){if(V=!1,u(W),!H)if(o(S)!==null)H=!0,ce||(ce=!0,ye());else{var oe=o(w);oe!==null&&p(f,oe.startTime-W)}}function h(){return q?!0:gH.unstable_now()-pe<U?!1:!0}function p(W,oe){He=j(function(){W(gH.unstable_now())},oe)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),gH.unstable_now=void 0,typeof performance==="object"&&typeof performance.now==="function"){var g=performance;gH.unstable_now=function(){return g.now()}}else{var y=Date,v=y.now();gH.unstable_now=function(){return y.now()-v}}var S=[],w=[],A=1,C=null,D=3,M=!1,H=!1,V=!1,q=!1,j=typeof setTimeout==="function"?setTimeout:null,G=typeof clearTimeout==="function"?clearTimeout:null,se=typeof setImmediate<"u"?setImmediate:null,ce=!1,He=-1,U=5,pe=-1;if(typeof se==="function")var ye=function(){se(e)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,vt=ae.port2;ae.port1.onmessage=e,ye=function(){vt.postMessage(null)}}else ye=function(){j(e,0)};gH.unstable_IdlePriority=5,gH.unstable_ImmediatePriority=1,gH.unstable_LowPriority=4,gH.unstable_NormalPriority=3,gH.unstable_Profiling=null,gH.unstable_UserBlockingPriority=2,gH.unstable_cancelCallback=function(W){W.callback=null},gH.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<W?Math.floor(1000/W):5},gH.unstable_getCurrentPriorityLevel=function(){return D},gH.unstable_next=function(W){switch(D){case 1:case 2:case 3:var oe=3;break;default:oe=D}var ee=D;D=oe;try{return W()}finally{D=ee}},gH.unstable_requestPaint=function(){q=!0},gH.unstable_runWithPriority=function(W,oe){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var ee=D;D=W;try{return oe()}finally{D=ee}},gH.unstable_scheduleCallback=function(W,oe,ee){var fe=gH.unstable_now();switch(typeof ee==="object"&&ee!==null?(ee=ee.delay,ee=typeof ee==="number"&&0<ee?fe+ee:fe):ee=fe,W){case 1:var me=-1;break;case 2:me=250;break;case 5:me=1073741823;break;case 4:me=1e4;break;default:me=5000}return me=ee+me,W={id:A++,callback:oe,priorityLevel:W,startTime:ee,expirationTime:me,sortIndex:-1},ee>fe?(W.sortIndex=ee,i(w,W),o(S)===null&&W===o(w)&&(V?(G(He),He=-1):V=!0,p(f,ee-fe))):(W.sortIndex=me,i(S,W),H||M||(H=!0,ce||(ce=!0,ye()))),W},gH.unstable_shouldYield=h,gH.unstable_wrapCallback=function(W){var oe=D;return function(){var ee=D;D=oe;try{return W.apply(this,arguments)}finally{D=ee}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var mD=xS(function(bH){var nt=Y(pD()),rc=Y(ft()),kS=Y(yH());(function(){function e(t,n){for(t=t.memoizedState;t!==null&&0<n;)t=t.next,n--;return t}function i(t,n,s,r){if(s>=n.length)return r;var c=n[s],d=dn(t)?t.slice():Ve({},t);return d[c]=i(t[c],n,s+1,r),d}function o(t,n,s){if(n.length!==s.length)console.warn("copyWithRename() expects paths of the same length");else{for(var r=0;r<s.length-1;r++)if(n[r]!==s[r]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return l(t,n,s,0)}}function l(t,n,s,r){var c=n[r],d=dn(t)?t.slice():Ve({},t);return r+1===n.length?(d[s[r]]=d[c],dn(d)?d.splice(c,1):delete d[c]):d[c]=l(t[c],n,s,r+1),d}function a(t,n,s){var r=n[s],c=dn(t)?t.slice():Ve({},t);if(s+1===n.length)return dn(c)?c.splice(r,1):delete c[r],c;return c[r]=a(t[r],n,s+1),c}function u(){return!1}function f(){return null}function h(){console.error("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://react.dev/link/rules-of-hooks")}function p(){console.error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().")}function g(){}function y(){}function v(t){var n=[];return t.forEach(function(s){n.push(s)}),n.sort().join(", ")}function S(t,n,s,r){return new sN(t,n,s,r)}function w(t,n){t.context===ir&&($b(t.current,2,n,t,null,null),bu())}function A(t,n){if(ao!==null){var s=n.staleFamilies;n=n.updatedFamilies,zf(),Sk(t.current,n,s),bu()}}function C(t){ao=t}function D(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function M(t){var n=t,s=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(s=n.return),t=n.return;while(t)}return n.tag===3?s:null}function H(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function V(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function q(t){if(M(t)!==t)throw Error("Unable to find node on an unmounted component.")}function j(t){var n=t.alternate;if(!n){if(n=M(t),n===null)throw Error("Unable to find node on an unmounted component.");return n!==t?null:t}for(var s=t,r=n;;){var c=s.return;if(c===null)break;var d=c.alternate;if(d===null){if(r=c.return,r!==null){s=r;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===s)return q(c),t;if(d===r)return q(c),n;d=d.sibling}throw Error("Unable to find node on an unmounted component.")}if(s.return!==r.return)s=c,r=d;else{for(var m=!1,b=c.child;b;){if(b===s){m=!0,s=c,r=d;break}if(b===r){m=!0,r=c,s=d;break}b=b.sibling}if(!m){for(b=d.child;b;){if(b===s){m=!0,s=d,r=c;break}if(b===r){m=!0,r=d,s=c;break}b=b.sibling}if(!m)throw Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(s.alternate!==r)throw Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(s.tag!==3)throw Error("Unable to find node on an unmounted component.");return s.stateNode.current===s?t:n}function G(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=G(t),n!==null)return n;t=t.sibling}return null}function se(t){if(t===null||typeof t!=="object")return null;return t=EA&&t[EA]||t["@@iterator"],typeof t==="function"?t:null}function ce(t){if(t==null)return null;if(typeof t==="function")return t.$$typeof===TB?null:t.displayName||t.name||null;if(typeof t==="string")return t;switch(t){case Au:return"Fragment";case Wb:return"Profiler";case Wp:return"StrictMode";case Xb:return"Suspense";case Fb:return"SuspenseList";case Kb:return"Activity"}if(typeof t==="object")switch(typeof t.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case Cu:return"Portal";case As:return t.displayName||"Context";case Yb:return(t._context.displayName||"Context")+".Consumer";case jf:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Yp:return n=t.displayName||null,n!==null?n:ce(t.type)||"Memo";case Wi:n=t._payload,t=t._init;try{return ce(t(n))}catch(s){}}return null}function He(t){return typeof t.tag==="number"?U(t):typeof t.name==="string"?t.name:null}function U(t){var n=t.type;switch(t.tag){case 31:return"Activity";case 24:return"Cache";case 9:return(n._context.displayName||"Context")+".Consumer";case 10:return n.displayName||"Context";case 18:return"DehydratedFragment";case 11:return t=n.render,t=t.displayName||t.name||"",n.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 26:case 27:case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ce(n);case 8:return n===Wp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 14:case 15:if(typeof n==="function")return n.displayName||n.name||null;if(typeof n==="string")return n;break;case 29:if(n=t._debugInfo,n!=null){for(var s=n.length-1;0<=s;s--)if(typeof n[s].name==="string")return n[s].name}if(t.return!==null)return U(t.return)}return null}function pe(t){return{current:t}}function ye(t,n){0>sl?console.error("Unexpected pop."):(n!==Jb[sl]&&console.error("Unexpected Fiber popped."),t.current=Zb[sl],Zb[sl]=null,Jb[sl]=null,sl--)}function ae(t,n,s){sl++,Zb[sl]=t.current,Jb[sl]=s,t.current=n}function vt(t){return t===null&&console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."),t}function W(t,n){ae(Kl,n,t),ae(Vf,t,t),ae(Fl,null,t);var s=n.nodeType;switch(s){case 9:case 11:s=s===9?"#document":"#fragment",n=(n=n.documentElement)?(n=n.namespaceURI)?KC(n):vl:vl;break;default:if(s=n.tagName,n=n.namespaceURI)n=KC(n),n=ZC(n,s);else switch(s){case"svg":n=sc;break;case"math":n=Qm;break;default:n=vl}}s=s.toLowerCase(),s=Gx(null,s),s={context:n,ancestorInfo:s},ye(Fl,t),ae(Fl,s,t)}function oe(t){ye(Fl,t),ye(Vf,t),ye(Kl,t)}function ee(){return vt(Fl.current)}function fe(t){t.memoizedState!==null&&ae(Xp,t,t);var n=vt(Fl.current),s=t.type,r=ZC(n.context,s);s=Gx(n.ancestorInfo,s),r={context:r,ancestorInfo:s},n!==r&&(ae(Vf,t,t),ae(Fl,r,t))}function me(t){Vf.current===t&&(ye(Fl,t),ye(Vf,t)),Xp.current===t&&(ye(Xp,t),Bd._currentValue=Ma)}function Ye(){}function Le(){if(Gf===0){DA=console.log,RA=console.info,MA=console.warn,OA=console.error,LA=console.group,zA=console.groupCollapsed,NA=console.groupEnd;var t={configurable:!0,enumerable:!0,value:Ye,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}Gf++}function dt(){if(Gf--,Gf===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Ve({},t,{value:DA}),info:Ve({},t,{value:RA}),warn:Ve({},t,{value:MA}),error:Ve({},t,{value:OA}),group:Ve({},t,{value:LA}),groupCollapsed:Ve({},t,{value:zA}),groupEnd:Ve({},t,{value:NA})})}0>Gf&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function tt(t){var n=Error.prepareStackTrace;if(Error.prepareStackTrace=void 0,t=t.stack,Error.prepareStackTrace=n,t.startsWith(`Error: react-stack-top-frame
|
|
2
2
|
`)&&(t=t.slice(29)),n=t.indexOf(`
|
|
3
3
|
`),n!==-1&&(t=t.slice(n+1)),n=t.indexOf("react_stack_bottom_frame"),n!==-1&&(n=t.lastIndexOf(`
|
|
4
4
|
`,n)),n!==-1)t=t.slice(0,n);else return"";return t}function Ie(t){if(ev===void 0)try{throw Error()}catch(s){var n=s.stack.trim().match(/\n( *(at )?)/);ev=n&&n[1]||"",BA=-1<s.stack.indexOf(`
|
|
@@ -215,7 +215,7 @@ You might need to use a local HTTP server (instead of file://): https://react.de
|
|
|
215
215
|
`),l=i.trim().slice(0,120),a=eg(Jm(l),80);if(!a)return null;let u=o.join(`
|
|
216
216
|
`).trim();return{slug:a,title:l,body:u?`# ${l}
|
|
217
217
|
|
|
218
|
-
${u}`:`# ${l}`}}var Se=Y(he(),1),o2=15000,n2=2;function Pd(e){return Se.jsxDEV("a",{href:e.href,className:e.className,onClick:(i)=>{if(!kl(i))return;i.preventDefault(),e.onNavigate(e.href)},children:e.children},void 0,!1,void 0,this)}function Ke(...e){return re("",...e).trim()}var EH={error:Be.dotError,warn:Be.dotWarn,info:Be.dotInfo},DH={good:Be.statusGood,warn:Be.statusWarn,error:Be.statusError};function RH(e){return Se.jsxDEV("section",{"aria-labelledby":"home-needs-you",children:[Se.jsxDEV("h2",{id:"home-needs-you",className:Ke(Be.bandHead),children:["Needs you",e.items.length>0&&Se.jsxDEV("span",{className:Ke(Be.bandCount),children:e.items.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.items.length===0?Se.jsxDEV("p",{className:Ke(Be.allClear),children:"Nothing is waiting on you."},void 0,!1,void 0,this):Se.jsxDEV("ul",{style:{listStyle:"none",margin:0,padding:0},children:e.items.map((i)=>Se.jsxDEV("li",{"data-home-attention":i.severity,className:Ke(Be.attention),children:[Se.jsxDEV("span",{"aria-hidden":"true",className:Ke(Be.dot,EH[i.severity])},void 0,!1,void 0,this),Se.jsxDEV("div",{className:Ke(Be.attentionText),children:[Se.jsxDEV("p",{className:Ke(Be.attentionTitle),children:i.title},void 0,!1,void 0,this),i.detail&&Se.jsxDEV("p",{className:Ke(Be.attentionDetail),children:i.detail},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.action&&Se.jsxDEV("span",{className:Ke(Be.attentionAction),children:Se.jsxDEV(we,{type:"button",variant:"secondary",size:"sm",onClick:()=>{if(i.action)e.onNavigate(i.action.href)},children:i.action.label},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},i.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function MH(e){if(e.drafts.length===0&&e.conversations.length===0)return null;return Se.jsxDEV("section",{"aria-labelledby":"home-continue",children:[Se.jsxDEV("h2",{id:"home-continue",className:Ke(Be.bandHead),children:"Continue"},void 0,!1,void 0,this),e.drafts.map((i)=>Se.jsxDEV(Pd,{href:i.href,onNavigate:e.onNavigate,className:Ke(Be.card),children:[Se.jsxDEV("span",{className:Ke(Be.cardMeta),children:[Se.jsxDEV("span",{className:Ke(Be.draftBadge),children:"Draft"},void 0,!1,void 0,this),`${i.typeLabel}, edited ${za(i.updated)}`]},void 0,!0,void 0,this),Se.jsxDEV("p",{className:Ke(Be.cardTitle),children:i.title},void 0,!1,void 0,this)]},`${i.entityType}/${i.id}`,!0,void 0,this)),e.conversations.map((i)=>Se.jsxDEV(Pd,{href:`${Na}?session=${encodeURIComponent(i.id)}`,onNavigate:e.onNavigate,className:Ke(Be.card),children:[Se.jsxDEV("span",{className:Ke(Be.cardMeta),children:`Conversation, ${za(i.lastActiveAt)}`},void 0,!1,void 0,this),Se.jsxDEV("p",{className:Ke(Be.cardTitle),children:i.title},void 0,!1,void 0,this)]},i.id,!0,void 0,this))]},void 0,!0,void 0,this)}function OH(e){if(e.published.length===0)return null;return Se.jsxDEV("section",{"aria-labelledby":"home-published",children:[Se.jsxDEV("h2",{id:"home-published",className:Ke(Be.bandHead),children:"Recently published"},void 0,!1,void 0,this),e.published.map((i)=>Se.jsxDEV(Pd,{href:i.href,onNavigate:e.onNavigate,className:Ke(Be.published),children:[Se.jsxDEV("span",{className:Ke(Be.publishedTitle),children:i.title},void 0,!1,void 0,this),Se.jsxDEV("time",{dateTime:i.publishedAt,className:Ke(Be.publishedDate),children:new Date(i.publishedAt).toLocaleDateString(void 0,{day:"numeric",month:"short"})},void 0,!1,void 0,this)]},`${i.entityType}/${i.id}`,!0,void 0,this))]},void 0,!0,void 0,this)}function LH(e){let i=Kt(),[o,l]=LS.useState(""),[a,u]=LS.useState(null),f=Ar({mutationFn:async(y)=>{let v=t2(y);if(!v)throw Error("Write a few words to save a note.");let S=await i.createEntity({entityType:"note",idPath:[v.slug],frontmatter:{},body:v.body});return{title:v.title,entityId:S.entityId}},onSuccess:({title:y,entityId:v})=>{l(""),u({title:y,href:$n(Hs(),"note",v)})}}),h=o.trim(),p=()=>{if(!h||!e.canAsk)return;e.onAsk(h)},g=(y)=>{if(y.key!=="Enter")return;if(y.metaKey||y.ctrlKey)y.preventDefault(),p();else if(y.shiftKey&&h)y.preventDefault(),f.mutate(h)};return Se.jsxDEV("div",{"data-home-composer":"",className:Ke(Be.composer),children:[Se.jsxDEV("textarea",{"aria-label":"Write something down, or ask your brain",rows:2,value:o,placeholder:"Write something down, or ask your brain…",className:Ke(Be.composerInput),onChange:(y)=>{l(y.target.value),u(null),f.reset()},onKeyDown:g},void 0,!1,void 0,this),Se.jsxDEV("div",{className:Ke(Be.composerBar),children:[Se.jsxDEV(we,{type:"button",variant:"secondary",size:"sm",disabled:!h||f.isPending,onClick:()=>f.mutate(h),children:f.isPending?"Saving…":"Save as note"},void 0,!1,void 0,this),e.canAsk&&Se.jsxDEV(we,{type:"button",variant:"secondary",size:"sm",disabled:!h,onClick:p,children:"Ask"},void 0,!1,void 0,this),Se.jsxDEV("span",{className:Ke(Be.composerHint),children:e.canAsk?"⌘↵ asks · ⇧↵ saves":"⇧↵ saves"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(a??f.error)&&Se.jsxDEV("p",{role:"status",className:Ke(Be.composerNote),children:a?Se.jsxDEV(Se.Fragment,{children:["Saved as a note."," ",Se.jsxDEV(Pd,{href:a.href,onNavigate:e.onNavigate,className:Ke(Be.link),children:"Open it"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):f.error?.message??""},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function zH(e){let i=i2(),{data:o}=fn({queryKey:["studio","home","conversations",e??""],queryFn:async()=>{let{chatSessionsResponseSchema:l}=await import("./studio-chunks/chat-mmjr8wmz.js"),a=(e??"").replace(/\/+$/,""),u=await(i??fetch)(`${a}/sessions?limit=${n2}`);if(!u.ok)return[];return l.parse(await u.json()).sessions.slice(0,n2)},enabled:e!==void 0,refetchInterval:o2});return o??[]}function s2(e){let i=Kt(),{data:o,error:l}=fn({queryKey:["studio","home"],queryFn:()=>i.fetchHome(),refetchInterval:o2}),a=zH(e.chatApiPath);if(!o)return Se.jsxDEV("main",{className:Ke(Be.page),children:Se.jsxDEV(ve,{...l?{tone:"error"}:{},children:l?"Home could not be read. It tries again shortly.":"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this);return Se.jsxDEV("main",{"data-studio-home":"",className:Ke(Be.page),children:[Se.jsxDEV("header",{className:"studio-page-head",children:[Se.jsxDEV("p",{className:Ke(Be.date),children:e2(o.now)},void 0,!1,void 0,this),Se.jsxDEV("h1",{className:Ke(Be.sentence),children:JD({needs:o.needsYou.length,drafts:o.drafts.length})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Se.jsxDEV(LH,{onAsk:e.onAsk,onNavigate:e.onNavigate,canAsk:e.chatApiPath!==void 0},void 0,!1,void 0,this),Se.jsxDEV("div",{className:Ke(Be.columns),children:[Se.jsxDEV(RH,{items:o.needsYou,onNavigate:e.onNavigate},void 0,!1,void 0,this),Se.jsxDEV("div",{children:[Se.jsxDEV(MH,{drafts:o.drafts,conversations:a,onNavigate:e.onNavigate},void 0,!1,void 0,this),Se.jsxDEV("div",{style:{marginTop:28},children:Se.jsxDEV(OH,{published:o.published,onNavigate:e.onNavigate},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Se.jsxDEV("footer",{role:"status",className:Ke(Be.status),children:[Se.jsxDEV("span",{"aria-hidden":"true",className:Ke(Be.statusDot,DH[o.status.tone])},void 0,!1,void 0,this),Se.jsxDEV("span",{className:Ke(Be.statusText),children:o.status.text},void 0,!1,void 0,this),Se.jsxDEV(Pd,{href:o.status.history.href,onNavigate:e.onNavigate,className:Ke(Be.link),children:o.status.history.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Dy=Y(ft(),1);var dg=Y(ft(),1);var lt=Y(he(),1);function r2(e){let{state:i}=e,o=dg.useRef(null);if(dg.useEffect(()=>{if(i.kind==="error"&&i.issues?.length&&!o.current?.closest("form")?.querySelector("[data-studio-invalid-field]")){let l=o.current?.querySelector("details");if(l)l.open=!0;o.current?.focus()}},[i]),i.kind==="saved")return i.noop?lt.jsxDEV(ve,{tone:"good",save:!0,children:"No changes — already saved."},void 0,!1,void 0,this):lt.jsxDEV(ve,{tone:"good",save:!0,children:"Saved through the entity service."},void 0,!1,void 0,this);if(i.kind==="conflict")return lt.jsxDEV("section",{...N(Jt.conflict),role:"alert","data-studio-conflict":"",children:[lt.jsxDEV("h4",{...N(Jt.conflictTitle),children:"The manuscript changed elsewhere"},void 0,!1,void 0,this),lt.jsxDEV("p",{...N(Jt.conflictCopy),children:i.message},void 0,!1,void 0,this),e.conflictActions]},void 0,!0,void 0,this);if(i.kind==="error")return lt.jsxDEV("div",{...N(Jt.validationSummary),ref:o,tabIndex:-1,role:"group","aria-label":"Save failed",children:[lt.jsxDEV(ve,{tone:"error",save:!0,children:[i.message,i.issues?.length?" Your draft is unchanged.":""]},void 0,!0,void 0,this),i.issues&&i.issues.length>0&<.jsxDEV("details",{children:[lt.jsxDEV("summary",{children:["Review last save errors (",i.issues.length,")"]},void 0,!0,void 0,this),lt.jsxDEV("div",{...N(Jt.validationDetails),tabIndex:0,role:"region","aria-label":"Save validation errors",children:[lt.jsxDEV("p",{children:"Correct the affected fields, then save again. Fields that are read-only here must be corrected through their owning tool."},void 0,!1,void 0,this),lt.jsxDEV("ul",{children:i.issues.map((l,a)=>lt.jsxDEV("li",{children:[l.path.length?`${l.path.join(".")}: `:"",l.message]},a,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return null}function a2(e,i,o="edit"){if(e.kind==="saving")return"Saving…";if(e.kind==="conflict")return"Conflict — your changes are not saved";if(e.kind==="error")return"Save failed — your changes are not saved";if(o==="create")return"Not created yet";if(o==="first-save")return"Not saved yet";return i?"Unsaved changes":"Saved"}function hg(e){let{save:i,git:o,baselineCommit:l}=e,a=o?.lastCommit?o.lastCommit.slice(0,7):null;if(i.kind==="saving")return{db:"active",exported:"pending",committed:"pending",commitRef:a};if(i.kind!=="saved")return{db:"pending",exported:"pending",committed:"pending",commitRef:a};if(i.noop)return{db:"done",exported:"done",committed:"done",commitRef:a};if(!o)return{db:"done",exported:"done",committed:"pending",commitRef:a};if(o.hasChanges)return{db:"done",exported:"done",committed:"active",commitRef:a};if(o.lastCommit!==l)return{db:"done",exported:"done",committed:"done",commitRef:a};return{db:"done",exported:"active",committed:"pending",commitRef:a}}function zS(e){return lt.jsxDEV("span",{...N(Jt.station,e.state==="done"&&Jt.done,e.state==="active"&&Jt.active),"data-studio-station":e.state,children:[lt.jsxDEV("span",{...N(Jt.dot,e.state==="done"&&Jt.doneDot,e.state==="active"&&Jt.activeDot)},void 0,!1,void 0,this),e.label]},void 0,!0,void 0,this)}function l2(e){return lt.jsxDEV("span",{...N(Jt.track),"data-studio-flowing":e.flowing?"":void 0,"aria-hidden":"true",children:lt.jsxDEV("span",{...N(Jt.flow,e.flowing&&Jt.flowing)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function u2(e){let{view:i,gitConfigured:o}=e;return lt.jsxDEV("span",{...N(Jt.wrap),children:[lt.jsxDEV("span",{...N(Jt.stations),children:[lt.jsxDEV(zS,{state:i.db,label:"entity db"},void 0,!1,void 0,this),lt.jsxDEV(l2,{flowing:i.db==="done"&&i.exported==="active"},void 0,!1,void 0,this),lt.jsxDEV(zS,{state:i.exported,label:"exported to file"},void 0,!1,void 0,this),o?lt.jsxDEV(lt.Fragment,{children:[lt.jsxDEV(l2,{flowing:i.exported==="done"&&i.committed==="active"},void 0,!1,void 0,this),lt.jsxDEV(zS,{state:i.committed,label:"committed"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):lt.jsxDEV("span",{...N(Jt.station,Jt.noGit),children:"no git remote"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.commitRef&<.jsxDEV("span",{...N(Jt.ref),children:["last write ",lt.jsxDEV("b",{...N(Jt.refValue),children:i.commitRef},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function c2(e){return lt.jsxDEV(yn,{mark:"×",title:"Delete this entry?",titleId:"delete-title",cancelLabel:"Keep entry",confirmLabel:e.deleting?"Deleting…":"Delete entry",pending:e.deleting===!0,confirmVariant:"danger",onCancel:e.onCancel,onConfirm:e.onConfirm,children:lt.jsxDEV("p",{children:["This removes “",e.title,"” and its file. Earlier versions stay in the content history."]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var wy=Y(ft(),1);var Us={root:{k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kUk6DE:"x98rzlu",kAzted:"x2lwn1j",$$css:!0},toolbar:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kOIVth:"x1jnr06f x1h74ku2",kwnvtZ:"xozqiw3 x5kkq21",kmVPX3:"xnohdxd",kWkggS:"xjbqb8w",kAzted:"x2lwn1j",kTWfjk:"x1c4ya5t",kRugJJ:"xiuf7f6",$$css:!0},modes:{k1xSpc:"xkaaz9w",$$css:!0},inlineModes:{k1xSpc:"x13v5x0x",$$css:!0},metadata:{koQZXg:"x8x9d4c x703316",kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg x155ir8z",kMwMTN:"x1ar3pfp",kb6lSQ:"x12oo3zp",$$css:!0},panes:{k1xSpc:"xrvj5dj",kUk6DE:"x98rzlu",kAzted:"x2lwn1j",kVQacm:"xb3r6kr",kya2p2:"x1qt74i8",$$css:!0},split:{kumcoG:"x1o61qjw x1xh6270 xreyasp",k9llMU:"xnfwqkv x5ktkrg",kORKVm:"x10wlt62",$$css:!0},source:{kMwMTN:"xqvuw85",kWkggS:"xjbqb8w",kAzted:"x2lwn1j",k7Eaqz:"xeuugli",kSWEuD:"x32b0ac",k26BEO:"xe636ye",kWqL5O:"xgfja2r x1hwe9mw x18p9hjd x1y4yzp4",kfdmCh:"x1q0q8m5",kL6WhQ:"xpqg30t",kt9PQ7:"x1qhh985 x1byj73k x3l60dh",kTWfjk:"x1qm741w",kya2p2:"x1qt74i8",$$css:!0},preview:{k7Eaqz:"xeuugli",kI3sdo:"x16dl9wz",kInvED:"x2ssjo2",kAzted:"x2lwn1j",kmVPX3:"x1539ny5",kORKVm:"x1odjw0f",kHjlTd:"xj0a0fe",kZeWKH:"xish69e",k6w4Gs:"xgwpcrc",k5wCbM:"x1597r2g",kubnTK:"xj8g7ue",kOLLwu:"xf8ucz8",k3VDzK:"x5hh3dx",kRoeRy:"xkp4qii",kh9fTk:"x1pll5v8",kfGByI:"xdjr4gx",kKq9zD:"xscgqpg",kHdLCk:"x1806iup",$$css:!0}};var BS=[],p2=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((i)=>i?parseInt(i,36):1);for(let i=0,o=0;i<e.length;i++)(i%2?p2:BS).push(o=o+e[i])})();function NH(e){if(e<768)return!1;for(let i=0,o=BS.length;;){let l=i+o>>1;if(e<BS[l])o=l;else if(e>=p2[l])i=l+1;else return!0;if(i==o)return!1}}function f2(e){return e>=127462&&e<=127487}var d2=8205;function m2(e,i,o=!0,l=!0){return(o?g2:BH)(e,i,l)}function g2(e,i,o){if(i==e.length)return i;if(i&&y2(e.charCodeAt(i))&&b2(e.charCodeAt(i-1)))i--;let l=NS(e,i);i+=h2(l);while(i<e.length){let a=NS(e,i);if(l==d2||a==d2||o&&NH(a))i+=h2(a),l=a;else if(f2(a)){let u=0,f=i-2;while(f>=0&&f2(NS(e,f)))u++,f-=2;if(u%2==0)break;else i+=2}else break}return i}function BH(e,i,o){while(i>1){let l=g2(e,i-2,o);if(l<i)return l;i--}return 0}function NS(e,i){let o=e.charCodeAt(i);if(!b2(o)||i+1==e.length)return o;let l=e.charCodeAt(i+1);if(!y2(l))return o;return(o-55296<<10)+(l-56320)+65536}function y2(e){return e>=56320&&e<57344}function b2(e){return e>=55296&&e<56320}function h2(e){return e<65536?1:2}class it{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,i,o){[e,i]=vc(this,e,i);let l=[];if(this.decompose(0,e,l,2),o.length)o.decompose(0,o.length,l,3);return this.decompose(i,this.length,l,1),_s.from(l,this.length-(i-e)+o.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,i=this.length){[e,i]=vc(this,e,i);let o=[];return this.decompose(e,i,o,0),_s.from(o,i-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let i=this.scanIdentical(e,1),o=this.length-this.scanIdentical(e,-1),l=new yc(this),a=new yc(e);for(let u=i,f=i;;){if(l.next(u),a.next(u),u=0,l.lineBreak!=a.lineBreak||l.done!=a.done||l.value!=a.value)return!1;if(f+=l.value.length,l.done||f>=o)return!0}}iter(e=1){return new yc(this,e)}iterRange(e,i=this.length){return new QS(this,e,i)}iterLines(e,i){let o;if(e==null)o=this.iter();else{if(i==null)i=this.lines+1;let l=this.line(e).from;o=this.iterRange(l,Math.max(l,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))}return new WS(o)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw RangeError("A document must have at least one line");if(e.length==1&&!e[0])return it.empty;return e.length<=32?new en(e):_s.from(en.split(e,[]))}}class en extends it{constructor(e,i=HH(e)){super();this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,o,l){for(let a=0;;a++){let u=this.text[a],f=l+u.length;if((i?o:f)>=e)return new C2(l,f,o,u);l=f+1,o++}}decompose(e,i,o,l){let a=e<=0&&i>=this.length?this:new en(v2(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(l&1){let u=o.pop(),f=yg(a.text,u.text.slice(),0,a.length);if(f.length<=32)o.push(new en(f,u.length+a.length));else{let h=f.length>>1;o.push(new en(f.slice(0,h)),new en(f.slice(h)))}}else o.push(a)}replace(e,i,o){if(!(o instanceof en))return super.replace(e,i,o);[e,i]=vc(this,e,i);let l=yg(this.text,yg(o.text,v2(this.text,0,e)),i),a=this.length+o.length-(i-e);if(l.length<=32)return new en(l,a);return _s.from(en.split(l,[]),a)}sliceString(e,i=this.length,o=`
|
|
218
|
+
${u}`:`# ${l}`}}var Se=Y(he(),1),o2=15000,n2=2;function Pd(e){return Se.jsxDEV("a",{href:e.href,className:e.className,onClick:(i)=>{if(!kl(i))return;i.preventDefault(),e.onNavigate(e.href)},children:e.children},void 0,!1,void 0,this)}function Ke(...e){return re("",...e).trim()}var EH={error:Be.dotError,warn:Be.dotWarn,info:Be.dotInfo},DH={good:Be.statusGood,warn:Be.statusWarn,error:Be.statusError};function RH(e){return Se.jsxDEV("section",{"aria-labelledby":"home-needs-you",children:[Se.jsxDEV("h2",{id:"home-needs-you",className:Ke(Be.bandHead),children:["Needs you",e.items.length>0&&Se.jsxDEV("span",{className:Ke(Be.bandCount),children:e.items.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.items.length===0?Se.jsxDEV("p",{className:Ke(Be.allClear),children:"Nothing is waiting on you."},void 0,!1,void 0,this):Se.jsxDEV("ul",{style:{listStyle:"none",margin:0,padding:0},children:e.items.map((i)=>Se.jsxDEV("li",{"data-home-attention":i.severity,className:Ke(Be.attention),children:[Se.jsxDEV("span",{"aria-hidden":"true",className:Ke(Be.dot,EH[i.severity])},void 0,!1,void 0,this),Se.jsxDEV("div",{className:Ke(Be.attentionText),children:[Se.jsxDEV("p",{className:Ke(Be.attentionTitle),children:i.title},void 0,!1,void 0,this),i.detail&&Se.jsxDEV("p",{className:Ke(Be.attentionDetail),children:i.detail},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.action&&Se.jsxDEV("span",{className:Ke(Be.attentionAction),children:Se.jsxDEV(we,{type:"button",variant:"secondary",size:"sm",onClick:()=>{if(i.action)e.onNavigate(i.action.href)},children:i.action.label},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},i.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function MH(e){if(e.drafts.length===0&&e.conversations.length===0)return null;return Se.jsxDEV("section",{"aria-labelledby":"home-continue",children:[Se.jsxDEV("h2",{id:"home-continue",className:Ke(Be.bandHead),children:"Continue"},void 0,!1,void 0,this),e.drafts.map((i)=>Se.jsxDEV(Pd,{href:i.href,onNavigate:e.onNavigate,className:Ke(Be.card),children:[Se.jsxDEV("span",{className:Ke(Be.cardMeta),children:[Se.jsxDEV("span",{className:Ke(Be.draftBadge),children:"Draft"},void 0,!1,void 0,this),`${i.typeLabel}, edited ${za(i.updated)}`]},void 0,!0,void 0,this),Se.jsxDEV("p",{className:Ke(Be.cardTitle),children:i.title},void 0,!1,void 0,this)]},`${i.entityType}/${i.id}`,!0,void 0,this)),e.conversations.map((i)=>Se.jsxDEV(Pd,{href:`${Na}?session=${encodeURIComponent(i.id)}`,onNavigate:e.onNavigate,className:Ke(Be.card),children:[Se.jsxDEV("span",{className:Ke(Be.cardMeta),children:`Conversation, ${za(i.lastActiveAt)}`},void 0,!1,void 0,this),Se.jsxDEV("p",{className:Ke(Be.cardTitle),children:i.title},void 0,!1,void 0,this)]},i.id,!0,void 0,this))]},void 0,!0,void 0,this)}function OH(e){if(e.published.length===0)return null;return Se.jsxDEV("section",{"aria-labelledby":"home-published",children:[Se.jsxDEV("h2",{id:"home-published",className:Ke(Be.bandHead),children:"Recently published"},void 0,!1,void 0,this),e.published.map((i)=>Se.jsxDEV(Pd,{href:i.href,onNavigate:e.onNavigate,className:Ke(Be.published),children:[Se.jsxDEV("span",{className:Ke(Be.publishedTitle),children:i.title},void 0,!1,void 0,this),Se.jsxDEV("time",{dateTime:i.publishedAt,className:Ke(Be.publishedDate),children:new Date(i.publishedAt).toLocaleDateString(void 0,{day:"numeric",month:"short"})},void 0,!1,void 0,this)]},`${i.entityType}/${i.id}`,!0,void 0,this))]},void 0,!0,void 0,this)}function LH(e){let i=Kt(),[o,l]=LS.useState(""),[a,u]=LS.useState(null),f=Ar({mutationFn:async(y)=>{let v=t2(y);if(!v)throw Error("Write a few words to save a note.");let S=await i.createEntity({entityType:"note",idPath:[v.slug],frontmatter:{},body:v.body});return{title:v.title,entityId:S.entityId}},onSuccess:({title:y,entityId:v})=>{l(""),u({title:y,href:$n(Hs(),"note",v)})}}),h=o.trim(),p=()=>{if(!h||!e.canAsk)return;e.onAsk(h)},g=(y)=>{if(y.key!=="Enter")return;if(y.metaKey||y.ctrlKey)y.preventDefault(),p();else if(y.shiftKey&&h)y.preventDefault(),f.mutate(h)};return Se.jsxDEV("div",{"data-home-composer":"",className:Ke(Be.composer),children:[Se.jsxDEV("textarea",{"aria-label":"Write something down, or ask your brain",rows:2,value:o,placeholder:"Write something down, or ask your brain…",className:Ke(Be.composerInput),onChange:(y)=>{l(y.target.value),u(null),f.reset()},onKeyDown:g},void 0,!1,void 0,this),Se.jsxDEV("div",{className:Ke(Be.composerBar),children:[Se.jsxDEV(we,{type:"button",variant:"secondary",size:"sm",disabled:!h||f.isPending,onClick:()=>f.mutate(h),children:f.isPending?"Saving…":"Save as note"},void 0,!1,void 0,this),e.canAsk&&Se.jsxDEV(we,{type:"button",variant:"secondary",size:"sm",disabled:!h,onClick:p,children:"Ask"},void 0,!1,void 0,this),Se.jsxDEV("span",{className:Ke(Be.composerHint),children:e.canAsk?"⌘↵ asks · ⇧↵ saves":"⇧↵ saves"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(a??f.error)&&Se.jsxDEV("p",{role:"status",className:Ke(Be.composerNote),children:a?Se.jsxDEV(Se.Fragment,{children:["Saved as a note."," ",Se.jsxDEV(Pd,{href:a.href,onNavigate:e.onNavigate,className:Ke(Be.link),children:"Open it"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):f.error?.message??""},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function zH(e){let i=i2(),{data:o}=fn({queryKey:["studio","home","conversations",e??""],queryFn:async()=>{let{chatSessionsResponseSchema:l}=await import("./studio-chunks/chat-yvjjpyqb.js"),a=(e??"").replace(/\/+$/,""),u=await(i??fetch)(`${a}/sessions?limit=${n2}`);if(!u.ok)return[];return l.parse(await u.json()).sessions.slice(0,n2)},enabled:e!==void 0,refetchInterval:o2});return o??[]}function s2(e){let i=Kt(),{data:o,error:l}=fn({queryKey:["studio","home"],queryFn:()=>i.fetchHome(),refetchInterval:o2}),a=zH(e.chatApiPath);if(!o)return Se.jsxDEV("main",{className:Ke(Be.page),children:Se.jsxDEV(ve,{...l?{tone:"error"}:{},children:l?"Home could not be read. It tries again shortly.":"Loading…"},void 0,!1,void 0,this)},void 0,!1,void 0,this);return Se.jsxDEV("main",{"data-studio-home":"",className:Ke(Be.page),children:[Se.jsxDEV("header",{className:"studio-page-head",children:[Se.jsxDEV("p",{className:Ke(Be.date),children:e2(o.now)},void 0,!1,void 0,this),Se.jsxDEV("h1",{className:Ke(Be.sentence),children:JD({needs:o.needsYou.length,drafts:o.drafts.length})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Se.jsxDEV(LH,{onAsk:e.onAsk,onNavigate:e.onNavigate,canAsk:e.chatApiPath!==void 0},void 0,!1,void 0,this),Se.jsxDEV("div",{className:Ke(Be.columns),children:[Se.jsxDEV(RH,{items:o.needsYou,onNavigate:e.onNavigate},void 0,!1,void 0,this),Se.jsxDEV("div",{children:[Se.jsxDEV(MH,{drafts:o.drafts,conversations:a,onNavigate:e.onNavigate},void 0,!1,void 0,this),Se.jsxDEV("div",{style:{marginTop:28},children:Se.jsxDEV(OH,{published:o.published,onNavigate:e.onNavigate},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Se.jsxDEV("footer",{role:"status",className:Ke(Be.status),children:[Se.jsxDEV("span",{"aria-hidden":"true",className:Ke(Be.statusDot,DH[o.status.tone])},void 0,!1,void 0,this),Se.jsxDEV("span",{className:Ke(Be.statusText),children:o.status.text},void 0,!1,void 0,this),Se.jsxDEV(Pd,{href:o.status.history.href,onNavigate:e.onNavigate,className:Ke(Be.link),children:o.status.history.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Dy=Y(ft(),1);var dg=Y(ft(),1);var lt=Y(he(),1);function r2(e){let{state:i}=e,o=dg.useRef(null);if(dg.useEffect(()=>{if(i.kind==="error"&&i.issues?.length&&!o.current?.closest("form")?.querySelector("[data-studio-invalid-field]")){let l=o.current?.querySelector("details");if(l)l.open=!0;o.current?.focus()}},[i]),i.kind==="saved")return i.noop?lt.jsxDEV(ve,{tone:"good",save:!0,children:"No changes — already saved."},void 0,!1,void 0,this):lt.jsxDEV(ve,{tone:"good",save:!0,children:"Saved through the entity service."},void 0,!1,void 0,this);if(i.kind==="conflict")return lt.jsxDEV("section",{...N(Jt.conflict),role:"alert","data-studio-conflict":"",children:[lt.jsxDEV("h4",{...N(Jt.conflictTitle),children:"The manuscript changed elsewhere"},void 0,!1,void 0,this),lt.jsxDEV("p",{...N(Jt.conflictCopy),children:i.message},void 0,!1,void 0,this),e.conflictActions]},void 0,!0,void 0,this);if(i.kind==="error")return lt.jsxDEV("div",{...N(Jt.validationSummary),ref:o,tabIndex:-1,role:"group","aria-label":"Save failed",children:[lt.jsxDEV(ve,{tone:"error",save:!0,children:[i.message,i.issues?.length?" Your draft is unchanged.":""]},void 0,!0,void 0,this),i.issues&&i.issues.length>0&<.jsxDEV("details",{children:[lt.jsxDEV("summary",{children:["Review last save errors (",i.issues.length,")"]},void 0,!0,void 0,this),lt.jsxDEV("div",{...N(Jt.validationDetails),tabIndex:0,role:"region","aria-label":"Save validation errors",children:[lt.jsxDEV("p",{children:"Correct the affected fields, then save again. Fields that are read-only here must be corrected through their owning tool."},void 0,!1,void 0,this),lt.jsxDEV("ul",{children:i.issues.map((l,a)=>lt.jsxDEV("li",{children:[l.path.length?`${l.path.join(".")}: `:"",l.message]},a,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return null}function a2(e,i,o="edit"){if(e.kind==="saving")return"Saving…";if(e.kind==="conflict")return"Conflict — your changes are not saved";if(e.kind==="error")return"Save failed — your changes are not saved";if(o==="create")return"Not created yet";if(o==="first-save")return"Not saved yet";return i?"Unsaved changes":"Saved"}function hg(e){let{save:i,git:o,baselineCommit:l}=e,a=o?.lastCommit?o.lastCommit.slice(0,7):null;if(i.kind==="saving")return{db:"active",exported:"pending",committed:"pending",commitRef:a};if(i.kind!=="saved")return{db:"pending",exported:"pending",committed:"pending",commitRef:a};if(i.noop)return{db:"done",exported:"done",committed:"done",commitRef:a};if(!o)return{db:"done",exported:"done",committed:"pending",commitRef:a};if(o.hasChanges)return{db:"done",exported:"done",committed:"active",commitRef:a};if(o.lastCommit!==l)return{db:"done",exported:"done",committed:"done",commitRef:a};return{db:"done",exported:"active",committed:"pending",commitRef:a}}function zS(e){return lt.jsxDEV("span",{...N(Jt.station,e.state==="done"&&Jt.done,e.state==="active"&&Jt.active),"data-studio-station":e.state,children:[lt.jsxDEV("span",{...N(Jt.dot,e.state==="done"&&Jt.doneDot,e.state==="active"&&Jt.activeDot)},void 0,!1,void 0,this),e.label]},void 0,!0,void 0,this)}function l2(e){return lt.jsxDEV("span",{...N(Jt.track),"data-studio-flowing":e.flowing?"":void 0,"aria-hidden":"true",children:lt.jsxDEV("span",{...N(Jt.flow,e.flowing&&Jt.flowing)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function u2(e){let{view:i,gitConfigured:o}=e;return lt.jsxDEV("span",{...N(Jt.wrap),children:[lt.jsxDEV("span",{...N(Jt.stations),children:[lt.jsxDEV(zS,{state:i.db,label:"entity db"},void 0,!1,void 0,this),lt.jsxDEV(l2,{flowing:i.db==="done"&&i.exported==="active"},void 0,!1,void 0,this),lt.jsxDEV(zS,{state:i.exported,label:"exported to file"},void 0,!1,void 0,this),o?lt.jsxDEV(lt.Fragment,{children:[lt.jsxDEV(l2,{flowing:i.exported==="done"&&i.committed==="active"},void 0,!1,void 0,this),lt.jsxDEV(zS,{state:i.committed,label:"committed"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):lt.jsxDEV("span",{...N(Jt.station,Jt.noGit),children:"no git remote"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.commitRef&<.jsxDEV("span",{...N(Jt.ref),children:["last write ",lt.jsxDEV("b",{...N(Jt.refValue),children:i.commitRef},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function c2(e){return lt.jsxDEV(yn,{mark:"×",title:"Delete this entry?",titleId:"delete-title",cancelLabel:"Keep entry",confirmLabel:e.deleting?"Deleting…":"Delete entry",pending:e.deleting===!0,confirmVariant:"danger",onCancel:e.onCancel,onConfirm:e.onConfirm,children:lt.jsxDEV("p",{children:["This removes “",e.title,"” and its file. Earlier versions stay in the content history."]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var wy=Y(ft(),1);var Us={root:{k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kUk6DE:"x98rzlu",kAzted:"x2lwn1j",$$css:!0},toolbar:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kOIVth:"x1jnr06f x1h74ku2",kwnvtZ:"xozqiw3 x5kkq21",kmVPX3:"xnohdxd",kWkggS:"xjbqb8w",kAzted:"x2lwn1j",kTWfjk:"x1c4ya5t",kRugJJ:"xiuf7f6",$$css:!0},modes:{k1xSpc:"xkaaz9w",$$css:!0},inlineModes:{k1xSpc:"x13v5x0x",$$css:!0},metadata:{koQZXg:"x8x9d4c x703316",kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg x155ir8z",kMwMTN:"x1ar3pfp",kb6lSQ:"x12oo3zp",$$css:!0},panes:{k1xSpc:"xrvj5dj",kUk6DE:"x98rzlu",kAzted:"x2lwn1j",kVQacm:"xb3r6kr",kya2p2:"x1qt74i8",$$css:!0},split:{kumcoG:"x1o61qjw x1xh6270 xreyasp",k9llMU:"xnfwqkv x5ktkrg",kORKVm:"x10wlt62",$$css:!0},source:{kMwMTN:"xqvuw85",kWkggS:"xjbqb8w",kAzted:"x2lwn1j",k7Eaqz:"xeuugli",kSWEuD:"x32b0ac",k26BEO:"xe636ye",kWqL5O:"xgfja2r x1hwe9mw x18p9hjd x1y4yzp4",kfdmCh:"x1q0q8m5",kL6WhQ:"xpqg30t",kt9PQ7:"x1qhh985 x1byj73k x3l60dh",kTWfjk:"x1qm741w",kya2p2:"x1qt74i8",$$css:!0},preview:{k7Eaqz:"xeuugli",kI3sdo:"x16dl9wz",kInvED:"x2ssjo2",kAzted:"x2lwn1j",kmVPX3:"x1539ny5",kORKVm:"x1odjw0f",kHjlTd:"xj0a0fe",kZeWKH:"xish69e",k6w4Gs:"xgwpcrc",k5wCbM:"x1597r2g",kubnTK:"xj8g7ue",kOLLwu:"xf8ucz8",k3VDzK:"x5hh3dx",kRoeRy:"xkp4qii",kh9fTk:"x1pll5v8",kfGByI:"xdjr4gx",kKq9zD:"xscgqpg",kHdLCk:"x1806iup",$$css:!0}};var BS=[],p2=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((i)=>i?parseInt(i,36):1);for(let i=0,o=0;i<e.length;i++)(i%2?p2:BS).push(o=o+e[i])})();function NH(e){if(e<768)return!1;for(let i=0,o=BS.length;;){let l=i+o>>1;if(e<BS[l])o=l;else if(e>=p2[l])i=l+1;else return!0;if(i==o)return!1}}function f2(e){return e>=127462&&e<=127487}var d2=8205;function m2(e,i,o=!0,l=!0){return(o?g2:BH)(e,i,l)}function g2(e,i,o){if(i==e.length)return i;if(i&&y2(e.charCodeAt(i))&&b2(e.charCodeAt(i-1)))i--;let l=NS(e,i);i+=h2(l);while(i<e.length){let a=NS(e,i);if(l==d2||a==d2||o&&NH(a))i+=h2(a),l=a;else if(f2(a)){let u=0,f=i-2;while(f>=0&&f2(NS(e,f)))u++,f-=2;if(u%2==0)break;else i+=2}else break}return i}function BH(e,i,o){while(i>1){let l=g2(e,i-2,o);if(l<i)return l;i--}return 0}function NS(e,i){let o=e.charCodeAt(i);if(!b2(o)||i+1==e.length)return o;let l=e.charCodeAt(i+1);if(!y2(l))return o;return(o-55296<<10)+(l-56320)+65536}function y2(e){return e>=56320&&e<57344}function b2(e){return e>=55296&&e<56320}function h2(e){return e<65536?1:2}class it{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,i,o){[e,i]=vc(this,e,i);let l=[];if(this.decompose(0,e,l,2),o.length)o.decompose(0,o.length,l,3);return this.decompose(i,this.length,l,1),_s.from(l,this.length-(i-e)+o.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,i=this.length){[e,i]=vc(this,e,i);let o=[];return this.decompose(e,i,o,0),_s.from(o,i-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let i=this.scanIdentical(e,1),o=this.length-this.scanIdentical(e,-1),l=new yc(this),a=new yc(e);for(let u=i,f=i;;){if(l.next(u),a.next(u),u=0,l.lineBreak!=a.lineBreak||l.done!=a.done||l.value!=a.value)return!1;if(f+=l.value.length,l.done||f>=o)return!0}}iter(e=1){return new yc(this,e)}iterRange(e,i=this.length){return new QS(this,e,i)}iterLines(e,i){let o;if(e==null)o=this.iter();else{if(i==null)i=this.lines+1;let l=this.line(e).from;o=this.iterRange(l,Math.max(l,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))}return new WS(o)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw RangeError("A document must have at least one line");if(e.length==1&&!e[0])return it.empty;return e.length<=32?new en(e):_s.from(en.split(e,[]))}}class en extends it{constructor(e,i=HH(e)){super();this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,o,l){for(let a=0;;a++){let u=this.text[a],f=l+u.length;if((i?o:f)>=e)return new C2(l,f,o,u);l=f+1,o++}}decompose(e,i,o,l){let a=e<=0&&i>=this.length?this:new en(v2(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(l&1){let u=o.pop(),f=yg(a.text,u.text.slice(),0,a.length);if(f.length<=32)o.push(new en(f,u.length+a.length));else{let h=f.length>>1;o.push(new en(f.slice(0,h)),new en(f.slice(h)))}}else o.push(a)}replace(e,i,o){if(!(o instanceof en))return super.replace(e,i,o);[e,i]=vc(this,e,i);let l=yg(this.text,yg(o.text,v2(this.text,0,e)),i),a=this.length+o.length-(i-e);if(l.length<=32)return new en(l,a);return _s.from(en.split(l,[]),a)}sliceString(e,i=this.length,o=`
|
|
219
219
|
`){[e,i]=vc(this,e,i);let l="";for(let a=0,u=0;a<=i&&u<this.text.length;u++){let f=this.text[u],h=a+f.length;if(a>e&&u)l+=o;if(e<h&&i>a)l+=f.slice(Math.max(0,e-a),i-a);a=h+1}return l}flatten(e){for(let i of this.text)e.push(i)}scanIdentical(){return 0}static split(e,i){let o=[],l=-1;for(let a of e)if(o.push(a),l+=a.length+1,o.length==32)i.push(new en(o,l)),o=[],l=-1;if(l>-1)i.push(new en(o,l));return i}}class _s extends it{constructor(e,i){super();this.children=e,this.length=i,this.lines=0;for(let o of e)this.lines+=o.lines}lineInner(e,i,o,l){for(let a=0;;a++){let u=this.children[a],f=l+u.length,h=o+u.lines-1;if((i?h:f)>=e)return u.lineInner(e,i,o,l);l=f+1,o=h+1}}decompose(e,i,o,l){for(let a=0,u=0;u<=i&&a<this.children.length;a++){let f=this.children[a],h=u+f.length;if(e<=h&&i>=u){let p=l&((u<=e?1:0)|(h>=i?2:0));if(u>=e&&h<=i&&!p)o.push(f);else f.decompose(e-u,i-u,o,p)}u=h+1}}replace(e,i,o){if([e,i]=vc(this,e,i),o.lines<this.lines)for(let l=0,a=0;l<this.children.length;l++){let u=this.children[l],f=a+u.length;if(e>=a&&i<=f){let h=u.replace(e-a,i-a,o),p=this.lines-u.lines+h.lines;if(h.lines<p>>4&&h.lines>p>>6){let g=this.children.slice();return g[l]=h,new _s(g,this.length-(i-e)+o.length)}return super.replace(a,f,h)}a=f+1}return super.replace(e,i,o)}sliceString(e,i=this.length,o=`
|
|
220
220
|
`){[e,i]=vc(this,e,i);let l="";for(let a=0,u=0;a<this.children.length&&u<=i;a++){let f=this.children[a],h=u+f.length;if(u>e&&a)l+=o;if(e<h&&i>u)l+=f.sliceString(e-u,i-u,o);u=h+1}return l}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof _s))return 0;let o=0,[l,a,u,f]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=i,a+=i){if(l==u||a==f)return o;let h=this.children[l],p=e.children[a];if(h!=p)return o+h.scanIdentical(p,i);o+=h.length+1}}static from(e,i=e.reduce((o,l)=>o+l.length+1,-1)){let o=0;for(let S of e)o+=S.lines;if(o<32){let S=[];for(let w of e)w.flatten(S);return new en(S,i)}let l=Math.max(32,o>>5),a=l<<1,u=l>>1,f=[],h=0,p=-1,g=[];function y(S){let w;if(S.lines>a&&S instanceof _s)for(let A of S.children)y(A);else if(S.lines>u&&(h>u||!h))v(),f.push(S);else if(S instanceof en&&h&&(w=g[g.length-1])instanceof en&&S.lines+w.lines<=32)h+=S.lines,p+=S.length+1,g[g.length-1]=new en(w.text.concat(S.text),w.length+1+S.length);else{if(h+S.lines>l)v();h+=S.lines,p+=S.length+1,g.push(S)}}function v(){if(h==0)return;f.push(g.length==1?g[0]:_s.from(g,p)),p=-1,h=g.length=0}for(let S of e)y(S);return v(),f.length==1?f[0]:new _s(f,i)}}it.empty=new en([""],0);function HH(e){let i=-1;for(let o of e)i+=o.length+1;return i}function yg(e,i,o=0,l=1e9){for(let a=0,u=0,f=!0;u<e.length&&a<=l;u++){let h=e[u],p=a+h.length;if(p>=o){if(p>l)h=h.slice(0,l-a);if(a<o)h=h.slice(o-a);if(f)i[i.length-1]+=h,f=!1;else i.push(h)}a=p+1}return i}function v2(e,i,o){return yg(e,[""],i,o)}class yc{constructor(e,i=1){this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[i>0?1:(e instanceof en?e.text.length:e.children.length)<<1]}nextInner(e,i){this.done=this.lineBreak=!1;for(;;){let o=this.nodes.length-1,l=this.nodes[o],a=this.offsets[o],u=a>>1,f=l instanceof en?l.text.length:l.children.length;if(u==(i>0?f:0)){if(o==0)return this.done=!0,this.value="",this;if(i>0)this.offsets[o-1]++;this.nodes.pop(),this.offsets.pop()}else if((a&1)==(i>0?0:1)){if(this.offsets[o]+=i,e==0)return this.lineBreak=!0,this.value=`
|
|
221
221
|
`,this;e--}else if(l instanceof en){let h=l.text[u+(i<0?-1:0)];if(this.offsets[o]+=i,h.length>Math.max(0,e))return this.value=e==0?h:i>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=l.children[u+(i<0?-1:0)];if(e>h.length)e-=h.length,this.offsets[o]+=i;else{if(i<0)this.offsets[o]--;this.nodes.push(h),this.offsets.push(i>0?1:(h instanceof en?h.text.length:h.children.length)<<1)}}}}next(e=0){if(e<0)this.nextInner(-e,-this.dir),e=this.value.length;return this.nextInner(e,this.dir)}}class QS{constructor(e,i,o){this.value="",this.done=!1,this.cursor=new yc(e,i>o?-1:1),this.pos=i>o?e.length:0,this.from=Math.min(i,o),this.to=Math.max(i,o)}nextInner(e,i){if(i<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos);let o=i<0?this.pos-this.from:this.to-this.pos;if(e>o)e=o;o-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*i,this.value=l.length<=o?l:i<0?l.slice(l.length-o):l.slice(0,o),this.done=!this.value,this}next(e=0){if(e<0)e=Math.max(e,this.from-this.pos);else if(e>0)e=Math.min(e,this.to-this.pos);return this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class WS{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:o,value:l}=this.inner.next(e);if(i&&this.afterBreak)this.value="",this.afterBreak=!1;else if(i)this.done=!0,this.value="";else if(o)if(this.afterBreak)this.value="";else this.afterBreak=!0,this.next();else this.value=l,this.afterBreak=!1;return this}get lineBreak(){return!1}}if(typeof Symbol<"u")it.prototype[Symbol.iterator]=function(){return this.iter()},yc.prototype[Symbol.iterator]=QS.prototype[Symbol.iterator]=WS.prototype[Symbol.iterator]=function(){return this};class C2{constructor(e,i,o,l){this.from=e,this.to=i,this.number=o,this.text=l}get length(){return this.to-this.from}}function vc(e,i,o){return i=Math.max(0,Math.min(e.length,i)),[i,Math.max(i,Math.min(e.length,o))]}function vo(e,i,o=!0,l=!0){return m2(e,i,o,l)}function IH(e){return e>=56320&&e<57344}function UH(e){return e>=55296&&e<56320}function YS(e,i){let o=e.charCodeAt(i);if(!UH(o)||i+1==e.length)return o;let l=e.charCodeAt(i+1);if(!IH(l))return o;return(o-55296<<10)+(l-56320)+65536}function XS(e){return e<65536?1:2}var IS=/\r\n?|\n/,Ln=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Ln||(Ln={}));class wl{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;i<this.sections.length;i+=2)e+=this.sections[i];return e}get newLength(){let e=0;for(let i=0;i<this.sections.length;i+=2){let o=this.sections[i+1];e+=o<0?this.sections[i]:o}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let i=0,o=0,l=0;i<this.sections.length;){let a=this.sections[i++],u=this.sections[i++];if(u<0)e(o,l,a),l+=a;else l+=u;o+=a}}iterChangedRanges(e,i=!1){US(this,e,i)}get invertedDesc(){let e=[];for(let i=0;i<this.sections.length;){let o=this.sections[i++],l=this.sections[i++];if(l<0)e.push(o,l);else e.push(l,o)}return new wl(e)}composeDesc(e){return this.empty?e:e.empty?this:A2(this,e)}mapDesc(e,i=!1){return e.empty?this:_S(this,e,i)}mapPos(e,i=-1,o=Ln.Simple){let l=0,a=0;for(let u=0;u<this.sections.length;){let f=this.sections[u++],h=this.sections[u++],p=l+f;if(h<0){if(p>e)return a+(e-l);a+=f}else{if(o!=Ln.Simple&&p>=e&&(o==Ln.TrackDel&&l<e&&p>e||o==Ln.TrackBefore&&l<e||o==Ln.TrackAfter&&p>e))return null;if(p>e||p==e&&i<0&&!f)return e==l||i<0?a:a+h;a+=h}l=p}if(e>l)throw RangeError(`Position ${e} is out of range for changeset of length ${l}`);return a}touchesRange(e,i=e){for(let o=0,l=0;o<this.sections.length&&l<=i;){let a=this.sections[o++],u=this.sections[o++],f=l+a;if(u>=0&&l<=i&&f>=e)return l<e&&f>i?"cover":!0;l=f}return!1}toString(){let e="";for(let i=0;i<this.sections.length;){let o=this.sections[i++],l=this.sections[i++];e+=(e?" ":"")+o+(l>=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some((i)=>typeof i!="number"))throw RangeError("Invalid JSON representation of ChangeDesc");return new wl(e)}static create(e){return new wl(e)}}class bn extends wl{constructor(e,i){super(e);this.inserted=i}apply(e){if(this.length!=e.length)throw RangeError("Applying change set to a document with the wrong length");return US(this,(i,o,l,a,u)=>e=e.replace(l,l+(o-i),u),!1),e}mapDesc(e,i=!1){return _S(this,e,i,!0)}invert(e){let i=this.sections.slice(),o=[];for(let l=0,a=0;l<i.length;l+=2){let u=i[l],f=i[l+1];if(f>=0){i[l]=f,i[l+1]=u;let h=l>>1;while(o.length<h)o.push(it.empty);o.push(u?e.slice(a,a+u):it.empty)}a+=u}return new bn(i,o)}compose(e){return this.empty?e:e.empty?this:A2(this,e,!0)}map(e,i=!1){return e.empty?this:_S(this,e,i,!0)}iterChanges(e,i=!1){US(this,e,i)}get desc(){return wl.create(this.sections)}filter(e){let i=[],o=[],l=[],a=new Sc(this);e:for(let u=0,f=0;;){let h=u==e.length?1e9:e[u++];while(f<h||f==h&&a.len==0){if(a.done)break e;let g=Math.min(a.len,h-f);jn(l,g,-1);let y=a.ins==-1?-1:a.off==0?a.ins:0;if(jn(i,g,y),y>0)Dr(o,i,a.text);a.forward(g),f+=g}let p=e[u++];while(f<p){if(a.done)break e;let g=Math.min(a.len,p-f);jn(i,g,-1),jn(l,g,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(g),f+=g}}return{changes:new bn(i,o),filtered:wl.create(l)}}toJSON(){let e=[];for(let i=0;i<this.sections.length;i+=2){let o=this.sections[i],l=this.sections[i+1];if(l<0)e.push(o);else if(l==0)e.push([o]);else e.push([o].concat(this.inserted[i>>1].toJSON()))}return e}static of(e,i,o){let l=[],a=[],u=0,f=null;function h(g=!1){if(!g&&!l.length)return;if(u<i)jn(l,i-u,-1);let y=new bn(l,a);f=f?f.compose(y.map(f)):y,l=[],a=[],u=0}function p(g){if(Array.isArray(g))for(let y of g)p(y);else if(g instanceof bn){if(g.length!=i)throw RangeError(`Mismatched change set length (got ${g.length}, expected ${i})`);h(),f=f?f.compose(g.map(f)):g}else{let{from:y,to:v=y,insert:S}=g;if(y>v||y<0||v>i)throw RangeError(`Invalid change range ${y} to ${v} (in doc of length ${i})`);let w=!S?it.empty:typeof S=="string"?it.of(S.split(o||IS)):S,A=w.length;if(y==v&&A==0)return;if(y<u)h();if(y>u)jn(l,y-u,-1);jn(l,v-y,A),Dr(a,l,w),u=v}}return p(e),h(!f),f}static empty(e){return new bn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw RangeError("Invalid JSON representation of ChangeSet");let i=[],o=[];for(let l=0;l<e.length;l++){let a=e[l];if(typeof a=="number")i.push(a,-1);else if(!Array.isArray(a)||typeof a[0]!="number"||a.some((u,f)=>f&&typeof u!="string"))throw RangeError("Invalid JSON representation of ChangeSet");else if(a.length==1)i.push(a[0],0);else{while(o.length<l)o.push(it.empty);o[l]=it.of(a.slice(1)),i.push(a[0],o[l].length)}}return new bn(i,o)}static createSet(e,i){return new bn(e,i)}}function jn(e,i,o,l=!1){if(i==0&&o<=0)return;let a=e.length-2;if(a>=0&&o<=0&&o==e[a+1])e[a]+=i;else if(a>=0&&i==0&&e[a]==0)e[a+1]+=o;else if(l)e[a]+=i,e[a+1]+=o;else e.push(i,o)}function Dr(e,i,o){if(o.length==0)return;let l=i.length-2>>1;if(l<e.length)e[e.length-1]=e[e.length-1].append(o);else{while(e.length<l)e.push(it.empty);e.push(o)}}function US(e,i,o){let l=e.inserted;for(let a=0,u=0,f=0;f<e.sections.length;){let h=e.sections[f++],p=e.sections[f++];if(p<0)a+=h,u+=h;else{let g=a,y=u,v=it.empty;for(;;){if(g+=h,y+=p,p&&l)v=v.append(l[f-2>>1]);if(o||f==e.sections.length||e.sections[f+1]<0)break;h=e.sections[f++],p=e.sections[f++]}i(a,g,u,y,v),a=g,u=y}}}function _S(e,i,o,l=!1){let a=[],u=l?[]:null,f=new Sc(e),h=new Sc(i);for(let p=-1;;)if(f.done&&h.len||h.done&&f.len)throw Error("Mismatched change set lengths");else if(f.ins==-1&&h.ins==-1){let g=Math.min(f.len,h.len);jn(a,g,-1),f.forward(g),h.forward(g)}else if(h.ins>=0&&(f.ins<0||p==f.i||f.off==0&&(h.len<f.len||h.len==f.len&&!o))){let g=h.len;jn(a,h.ins,-1);while(g){let y=Math.min(f.len,g);if(f.ins>=0&&p<f.i&&f.len<=y){if(jn(a,0,f.ins),u)Dr(u,a,f.text);p=f.i}f.forward(y),g-=y}h.next()}else if(f.ins>=0){let g=0,y=f.len;while(y)if(h.ins==-1){let v=Math.min(y,h.len);g+=v,y-=v,h.forward(v)}else if(h.ins==0&&h.len<y)y-=h.len,h.next();else break;if(jn(a,g,p<f.i?f.ins:0),u&&p<f.i)Dr(u,a,f.text);p=f.i,f.forward(f.len-y)}else if(f.done&&h.done)return u?bn.createSet(a,u):wl.create(a);else throw Error("Mismatched change set lengths")}function A2(e,i,o=!1){let l=[],a=o?[]:null,u=new Sc(e),f=new Sc(i);for(let h=!1;;)if(u.done&&f.done)return a?bn.createSet(l,a):wl.create(l);else if(u.ins==0)jn(l,u.len,0,h),u.next();else if(f.len==0&&!f.done){if(jn(l,0,f.ins,h),a)Dr(a,l,f.text);f.next()}else if(u.done||f.done)throw Error("Mismatched change set lengths");else{let p=Math.min(u.len2,f.len),g=l.length;if(u.ins==-1){let y=f.ins==-1?-1:f.off?0:f.ins;if(jn(l,p,y,h),a&&y)Dr(a,l,f.text)}else if(f.ins==-1){if(jn(l,u.off?0:u.len,p,h),a)Dr(a,l,u.textBit(p))}else if(jn(l,u.off?0:u.len,f.off?0:f.ins,h),a&&!f.off)Dr(a,l,f.text);h=(u.ins>p||f.ins>=0&&f.len>p)&&(h||l.length>g),u.forward2(p),f.forward(p)}}class Sc{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;if(this.i<e.length)this.len=e[this.i++],this.ins=e[this.i++];else this.len=0,this.ins=-2;this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length?it.empty:e[i]}textBit(e){let{inserted:i}=this.set,o=this.i-2>>1;return o>=i.length&&!e?it.empty:i[o].slice(this.off,e==null?void 0:this.off+e)}forward(e){if(e==this.len)this.next();else this.len-=e,this.off+=e}forward2(e){if(this.ins==-1)this.forward(e);else if(e==this.ins)this.next();else this.ins-=e,this.off+=e}}class Er{constructor(e,i,o,l){this.from=e,this.to=i,this.flags=o,this.goalColumn=l}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,i=-1){let o,l;if(this.empty)o=l=e.mapPos(this.from,i);else o=e.mapPos(this.from,1),l=e.mapPos(this.to,-1);return o==this.from&&l==this.to?this:new Er(o,l,this.flags,this.goalColumn)}extend(e,i=e,o=0){if(e<=this.anchor&&i>=this.anchor)return Z.range(e,i,void 0,void 0,o);let l=Math.abs(e-this.anchor)>Math.abs(i-this.anchor)?e:i;return Z.range(this.anchor,l,void 0,void 0,o)}eq(e,i=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!i||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw RangeError("Invalid JSON representation for SelectionRange");return Z.range(e.anchor,e.head)}static create(e,i,o,l){return new Er(e,i,o,l)}}class Z{constructor(e,i){this.ranges=e,this.mainIndex=i}map(e,i=-1){if(e.empty)return this;return Z.create(this.ranges.map((o)=>o.map(e,i)),this.mainIndex)}eq(e,i=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let o=0;o<this.ranges.length;o++)if(!this.ranges[o].eq(e.ranges[o],i))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Z([this.main],0)}addRange(e,i=!0){return Z.create([e].concat(this.ranges),i?0:this.mainIndex+1)}replaceRange(e,i=this.mainIndex){let o=this.ranges.slice();return o[i]=e,Z.create(o,this.mainIndex)}toJSON(){return{ranges:this.ranges.map((e)=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw RangeError("Invalid JSON representation for EditorSelection");return new Z(e.ranges.map((i)=>Er.fromJSON(i)),e.main)}static single(e,i=e){return new Z([Z.range(e,i)],0)}static create(e,i=0){if(e.length==0)throw RangeError("A selection needs at least one range");for(let o=0,l=0;l<e.length;l++){let a=e[l];if(a.empty?a.from<=o:a.from<o)return Z.normalized(e.slice(),i);o=a.to}return new Z(e,i)}static cursor(e,i=0,o,l){return Er.create(e,e,(i==0?0:i<0?8:16)|(o==null?7:Math.min(6,o)),l)}static range(e,i,o,l,a){let u=l==null?7:Math.min(6,l);if(!a&&e!=i)a=i<e?1:-1;if(a)u|=a<0?8:16;return i<e?Er.create(i,e,u|32,o):Er.create(e,i,u,o)}static undirectionalRange(e,i){return Er.create(e,i,64,void 0)}static normalized(e,i=0){let o=e[i];e.sort((l,a)=>l.from-a.from),i=e.indexOf(o);for(let l=1;l<e.length;l++){let a=e[l],u=e[l-1];if(a.empty?a.from<=u.to:a.from<u.to){let f=u.from,h=Math.max(a.to,u.to);if(l<=i)i--;e.splice(--l,2,a.anchor>a.head?Z.range(h,f):Z.range(f,h))}}return new Z(e,i)}}function T2(e,i){for(let o of e.ranges)if(o.to>i)throw RangeError("Selection points outside of document")}var FS=0;class Te{constructor(e,i,o,l,a){this.combine=e,this.compareInput=i,this.compare=o,this.isStatic=l,this.id=FS++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(e={}){return new Te(e.combine||((i)=>i),e.compareInput||((i,o)=>i===o),e.compare||(!e.combine?KS:(i,o)=>i===o),!!e.static,e.enables)}of(e){return new Vd([],this,0,e)}compute(e,i){if(this.isStatic)throw Error("Can't compute a static facet");return new Vd(e,this,1,i)}computeN(e,i){if(this.isStatic)throw Error("Can't compute a static facet");return new Vd(e,this,2,i)}from(e,i){if(!i)i=(o)=>o;return this.compute([e],(o)=>i(o.field(e)))}}function KS(e,i){return e==i||e.length==i.length&&e.every((o,l)=>o===i[l])}class Vd{constructor(e,i,o,l){this.dependencies=e,this.facet=i,this.type=o,this.value=l,this.id=FS++}dynamicSlot(e){var i;let o=this.value,l=this.facet.compareInput,a=this.id,u=e[a]>>1,f=this.type==2,h=!1,p=!1,g=[];for(let y of this.dependencies)if(y=="doc")h=!0;else if(y=="selection")p=!0;else if((((i=e[y.id])!==null&&i!==void 0?i:1)&1)==0)g.push(e[y.id]);return{create(y){return y.values[u]=o(y),1},update(y,v){if(h&&v.docChanged||p&&(v.docChanged||v.selection)||qS(y,g)){let S=o(y);if(f?!S2(S,y.values[u],l):!l(S,y.values[u]))return y.values[u]=S,1}return 0},reconfigure:(y,v)=>{let S,w=v.config.address[a];if(w!=null){let A=Sg(v,w);if(this.dependencies.every((C)=>C instanceof Te?v.facet(C)===y.facet(C):C instanceof Qo?v.field(C,!1)==y.field(C,!1):!0)||(f?S2(S=o(y),A,l):l(S=o(y),A)))return y.values[u]=A,0}else S=o(y);return y.values[u]=S,1}}}get extension(){return this}}function S2(e,i,o){if(e.length!=i.length)return!1;for(let l=0;l<e.length;l++)if(!o(e[l],i[l]))return!1;return!0}function qS(e,i){let o=!1;for(let l of i)if(Gd(e,l)&1)o=!0;return o}function _H(e,i,o){let l=o.map((p)=>e[p.id]),a=o.map((p)=>p.type),u=l.filter((p)=>!(p&1)),f=e[i.id]>>1;function h(p){let g=[];for(let y=0;y<l.length;y++){let v=Sg(p,l[y]);if(a[y]==2)for(let S of v)g.push(S);else g.push(v)}return i.combine(g)}return{create(p){for(let g of l)Gd(p,g);return p.values[f]=h(p),1},update(p,g){if(!qS(p,u))return 0;let y=h(p);if(i.compare(y,p.values[f]))return 0;return p.values[f]=y,1},reconfigure(p,g){let y=qS(p,l),v=g.config.facets[i.id],S=g.facet(i);if(v&&!y&&KS(o,v))return p.values[f]=S,0;let w=h(p);if(i.compare(w,S))return p.values[f]=S,0;return p.values[f]=w,1}}}var pg=Te.define({static:!0});class Qo{constructor(e,i,o,l,a){this.id=e,this.createF=i,this.updateF=o,this.compareF=l,this.spec=a,this.provides=void 0}static define(e){let i=new Qo(FS++,e.create,e.update,e.compare||((o,l)=>o===l),e);if(e.provide)i.provides=e.provide(i);return i}create(e){let i=e.facet(pg).find((o)=>o.field==this);return((i===null||i===void 0?void 0:i.create)||this.createF)(e)}slot(e){let i=e[this.id]>>1;return{create:(o)=>(o.values[i]=this.create(o),1),update:(o,l)=>{let a=o.values[i],u=this.updateF(a,l);if(this.compareF(a,u))return 0;return o.values[i]=u,1},reconfigure:(o,l)=>{let a=o.facet(pg),u=l.facet(pg),f;if((f=a.find((h)=>h.field==this))&&f!=u.find((h)=>h.field==this))return o.values[i]=f.create(o),1;if(l.config.address[this.id]!=null)return o.values[i]=l.field(this),0;return o.values[i]=this.create(o),1}}}init(e){return[this,pg.of({field:this,create:e})]}get extension(){return this}}var Ba={lowest:4,low:3,default:2,high:1,highest:0};function jd(e){return(i)=>new ZS(i,e)}var Cl={highest:jd(Ba.highest),high:jd(Ba.high),default:jd(Ba.default),low:jd(Ba.low),lowest:jd(Ba.lowest)};class ZS{constructor(e,i){this.inner=e,this.prec=i}get extension(){return this}}class xc{of(e){return new bg(this,e)}reconfigure(e){return xc.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class bg{constructor(e,i){this.compartment=e,this.inner=i}get extension(){return this}}class vg{constructor(e,i,o,l,a,u){this.base=e,this.compartments=i,this.dynamicSlots=o,this.address=l,this.staticValues=a,this.facets=u,this.statusTemplate=[];while(this.statusTemplate.length<o.length)this.statusTemplate.push(0)}staticFacet(e){let i=this.address[e.id];return i==null?e.default:this.staticValues[i>>1]}static resolve(e,i,o){let l=[],a=Object.create(null),u=new Map;for(let v of qH(e,i,u))if(v instanceof Qo)l.push(v);else(a[v.facet.id]||(a[v.facet.id]=[])).push(v);let f=Object.create(null),h=[],p=[];for(let v of l)f[v.id]=p.length<<1,p.push((S)=>v.slot(S));let g=o===null||o===void 0?void 0:o.config.facets;for(let v in a){let S=a[v],w=S[0].facet,A=g&&g[v]||[];if(S.every((C)=>C.type==0))if(f[w.id]=h.length<<1|1,KS(A,S))h.push(o.facet(w));else{let C=w.combine(S.map((D)=>D.value));h.push(o&&w.compare(C,o.facet(w))?o.facet(w):C)}else{for(let C of S)if(C.type==0)f[C.id]=h.length<<1|1,h.push(C.value);else f[C.id]=p.length<<1,p.push((D)=>C.dynamicSlot(D));f[w.id]=p.length<<1,p.push((C)=>_H(C,w,S))}}let y=p.map((v)=>v(f));return new vg(e,u,y,f,h,a)}}function qH(e,i,o){let l=[[],[],[],[],[]],a=new Map;function u(f,h){let p=a.get(f);if(p!=null){if(p<=h)return;let g=l[p].indexOf(f);if(g>-1)l[p].splice(g,1);if(f instanceof bg)o.delete(f.compartment)}if(a.set(f,h),Array.isArray(f))for(let g of f)u(g,h);else if(f instanceof bg){if(o.has(f.compartment))throw RangeError("Duplicate use of compartment in extensions");let g=i.get(f.compartment)||f.inner;o.set(f.compartment,g),u(g,h)}else if(f instanceof ZS)u(f.inner,f.prec);else if(f instanceof Qo){if(l[h].push(f),f.provides)u(f.provides,h)}else if(f instanceof Vd){if(l[h].push(f),f.facet.extensions)u(f.facet.extensions,Ba.default)}else{let g=f.extension;if(!g)throw Error(`Unrecognized extension value in extension set (${f}).`);if(g==f)throw Error(`Unrecognized extension value in extension set (${f}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);u(g,h)}}return u(e,Ba.default),l.reduce((f,h)=>f.concat(h))}function Gd(e,i){if(i&1)return 2;let o=i>>1,l=e.status[o];if(l==4)throw Error("Cyclic dependency between fields and/or facets");if(l&2)return l;e.status[o]=4;let a=e.computeSlot(e,e.config.dynamicSlots[o]);return e.status[o]=2|a}function Sg(e,i){return i&1?e.config.staticValues[i>>1]:e.values[i>>1]}var E2=Te.define(),$S=Te.define({combine:(e)=>e.some((i)=>i),static:!0}),D2=Te.define({combine:(e)=>e.length?e[0]:void 0,static:!0}),R2=Te.define(),M2=Te.define(),O2=Te.define(),L2=Te.define({combine:(e)=>e.length?e[0]:!1});class So{constructor(e,i){this.type=e,this.value=i}static define(){return new z2}}class z2{of(e){return new So(this,e)}}class N2{constructor(e){this.map=e}of(e){return new Bt(this,e)}}class Bt{constructor(e,i){this.type=e,this.value=i}map(e){let i=this.type.map(this.value,e);return i===void 0?void 0:i==this.value?this:new Bt(this.type,i)}is(e){return this.type==e}static define(e={}){return new N2(e.map||((i)=>i))}static mapEffects(e,i){if(!e.length)return e;let o=[];for(let l of e){let a=l.map(i);if(a)o.push(a)}return o}}Bt.reconfigure=Bt.define();Bt.appendConfig=Bt.define();class vn{constructor(e,i,o,l,a,u){if(this.startState=e,this.changes=i,this.selection=o,this.effects=l,this.annotations=a,this.scrollIntoView=u,this._doc=null,this._state=null,o)T2(o,i.newLength);if(!a.some((f)=>f.type==vn.time))this.annotations=a.concat(vn.time.of(Date.now()))}static create(e,i,o,l,a,u){return new vn(e,i,o,l,a,u)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){if(!this._state)this.startState.applyTransaction(this);return this._state}annotation(e){for(let i of this.annotations)if(i.type==e)return i.value;return}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let i=this.annotation(vn.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}}vn.time=So.define();vn.userEvent=So.define();vn.addToHistory=So.define();vn.remote=So.define();function $H(e,i){let o=[];for(let l=0,a=0;;){let u,f;if(l<e.length&&(a==i.length||i[a]>=e[l]))u=e[l++],f=e[l++];else if(a<i.length)u=i[a++],f=i[a++];else return o;if(!o.length||o[o.length-1]<u)o.push(u,f);else if(o[o.length-1]<f)o[o.length-1]=f}}function B2(e,i,o){var l;let a,u,f;if(o)a=i.changes,u=bn.empty(i.changes.length),f=e.changes.compose(i.changes);else a=i.changes.map(e.changes),u=e.changes.mapDesc(i.changes,!0),f=e.changes.compose(a);return{changes:f,selection:i.selection?i.selection.map(u):(l=e.selection)===null||l===void 0?void 0:l.map(a),effects:Bt.mapEffects(e.effects,a).concat(Bt.mapEffects(i.effects,u)),annotations:e.annotations.length?e.annotations.concat(i.annotations):i.annotations,scrollIntoView:e.scrollIntoView||i.scrollIntoView}}function PS(e,i,o){let l=i.selection,a=bc(i.annotations);if(i.userEvent)a=a.concat(vn.userEvent.of(i.userEvent));return{changes:i.changes instanceof bn?i.changes:bn.of(i.changes||[],o,e.facet(D2)),selection:l&&(l instanceof Z?l:Z.single(l.anchor,l.head)),effects:bc(i.effects),annotations:a,scrollIntoView:!!i.scrollIntoView}}function H2(e,i,o){let l=PS(e,i.length?i[0]:{},e.doc.length);if(i.length&&i[0].filter===!1)o=!1;for(let u=1;u<i.length;u++){if(i[u].filter===!1)o=!1;let f=!!i[u].sequential;l=B2(l,PS(e,i[u],f?l.changes.newLength:e.doc.length),f)}let a=vn.create(e,l.changes,l.selection,l.effects,l.annotations,l.scrollIntoView);return jH(o?PH(a):a)}function PH(e){let i=e.startState,o=!0;for(let a of i.facet(R2)){let u=a(e);if(u===!1){o=!1;break}if(Array.isArray(u))o=o===!0?u:$H(o,u)}if(o!==!0){let a,u;if(o===!1)u=e.changes.invertedDesc,a=bn.empty(i.doc.length);else{let f=e.changes.filter(o);a=f.changes,u=f.filtered.mapDesc(f.changes).invertedDesc}e=vn.create(i,a,e.selection&&e.selection.map(u),Bt.mapEffects(e.effects,u),e.annotations,e.scrollIntoView)}let l=i.facet(M2);for(let a=l.length-1;a>=0;a--){let u=l[a](e);if(u instanceof vn)e=u;else if(Array.isArray(u)&&u.length==1&&u[0]instanceof vn)e=u[0];else e=H2(i,bc(u),!1)}return e}function jH(e){let i=e.startState,o=i.facet(O2),l=e;for(let a=o.length-1;a>=0;a--){let u=o[a](e);if(u&&Object.keys(u).length)l=B2(l,PS(i,u,e.changes.newLength),!0)}return l==e?e:vn.create(i,e.changes,e.selection,l.effects,l.annotations,l.scrollIntoView)}var VH=[];function bc(e){return e==null?VH:Array.isArray(e)?e:[e]}var Vo=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Vo||(Vo={})),GH=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,jS;try{jS=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}function QH(e){if(jS)return jS.test(e);for(let i=0;i<e.length;i++){let o=e[i];if(/\w/.test(o)||o>""&&(o.toUpperCase()!=o.toLowerCase()||GH.test(o)))return!0}return!1}function WH(e){return(i)=>{if(!/\S/.test(i))return Vo.Space;if(QH(i))return Vo.Word;for(let o=0;o<e.length;o++)if(i.indexOf(e[o])>-1)return Vo.Word;return Vo.Other}}class Ze{constructor(e,i,o,l,a,u){if(this.config=e,this.doc=i,this.selection=o,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=a,u)u._state=this;for(let f=0;f<this.config.dynamicSlots.length;f++)Gd(this,f<<1);this.computeSlot=null}field(e,i=!0){let o=this.config.address[e.id];if(o==null){if(i)throw RangeError("Field is not present in this state");return}return Gd(this,o),Sg(this,o)}update(...e){return H2(this,e,!0)}applyTransaction(e){let i=this.config,{base:o,compartments:l}=i;for(let f of e.effects)if(f.is(xc.reconfigure)){if(i)l=new Map,i.compartments.forEach((h,p)=>l.set(p,h)),i=null;l.set(f.value.compartment,f.value.extension)}else if(f.is(Bt.reconfigure))i=null,o=f.value;else if(f.is(Bt.appendConfig))i=null,o=bc(o).concat(f.value);let a;if(!i)i=vg.resolve(o,l,this),a=new Ze(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(h,p)=>p.reconfigure(h,this),null).values;else a=e.startState.values.slice();let u=e.startState.facet($S)?e.newSelection:e.newSelection.asSingle();new Ze(i,e.newDoc,u,a,(f,h)=>h.update(f,e),e)}replaceSelection(e){if(typeof e=="string")e=this.toText(e);return this.changeByRange((i)=>({changes:{from:i.from,to:i.to,insert:e},range:Z.cursor(i.from+e.length)}))}changeByRange(e){let i=this.selection,o=e(i.ranges[0]),l=this.changes(o.changes),a=[o.range],u=bc(o.effects);for(let f=1;f<i.ranges.length;f++){let h=e(i.ranges[f]),p=this.changes(h.changes),g=p.map(l);for(let v=0;v<f;v++)a[v]=a[v].map(g);let y=l.mapDesc(p,!0);a.push(h.range.map(y)),l=l.compose(g),u=Bt.mapEffects(u,g).concat(Bt.mapEffects(bc(h.effects),y))}return{changes:l,selection:Z.create(a,i.mainIndex),effects:u}}changes(e=[]){if(e instanceof bn)return e;return bn.of(e,this.doc.length,this.facet(Ze.lineSeparator))}toText(e){return it.of(e.split(this.facet(Ze.lineSeparator)||IS))}sliceDoc(e=0,i=this.doc.length){return this.doc.sliceString(e,i,this.lineBreak)}facet(e){let i=this.config.address[e.id];if(i==null)return e.default;return Gd(this,i),Sg(this,i)}toJSON(e){let i={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let o in e){let l=e[o];if(l instanceof Qo&&this.config.address[l.id]!=null)i[o]=l.spec.toJSON(this.field(e[o]),this)}return i}static fromJSON(e,i={},o){if(!e||typeof e.doc!="string")throw RangeError("Invalid JSON representation for EditorState");let l=[];if(o){for(let a in o)if(Object.prototype.hasOwnProperty.call(e,a)){let u=o[a],f=e[a];l.push(u.init((h)=>u.spec.fromJSON(f,h)))}}return Ze.create({doc:e.doc,selection:Z.fromJSON(e.selection),extensions:i.extensions?l.concat([i.extensions]):l})}static create(e={}){let i=vg.resolve(e.extensions||[],new Map),o=e.doc instanceof it?e.doc:it.of((e.doc||"").split(i.staticFacet(Ze.lineSeparator)||IS)),l=!e.selection?Z.single(0):e.selection instanceof Z?e.selection:Z.single(e.selection.anchor,e.selection.head);if(T2(l,o.length),!i.staticFacet($S))l=l.asSingle();return new Ze(i,o,l,i.dynamicSlots.map(()=>null),(a,u)=>u.create(a),null)}get tabSize(){return this.facet(Ze.tabSize)}get lineBreak(){return this.facet(Ze.lineSeparator)||`
|
|
@@ -241,11 +241,11 @@ ${u}`:`# ${l}`}}var Se=Y(he(),1),o2=15000,n2=2;function Pd(e){return Se.jsxDEV("
|
|
|
241
241
|
constructor(\${params}) {
|
|
242
242
|
\${}
|
|
243
243
|
}
|
|
244
|
-
}`,{label:"class",detail:"definition",type:"keyword"}),pi('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),pi('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],a5=ZO.concat([pi("interface ${name} {\n\t${}\n}",{label:"interface",detail:"definition",type:"keyword"}),pi("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),pi("enum ${name} {\n\t${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),YO=new ey,JO=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ch(e){return(i,o)=>{let l=i.node.getChild("VariableDefinition");if(l)o(l,e);return!0}}var u5=["FunctionDeclaration"],c5={FunctionDeclaration:Ch("function"),ClassDeclaration:Ch("class"),ClassExpression:()=>!0,EnumDeclaration:Ch("constant"),TypeAliasDeclaration:Ch("type"),NamespaceDeclaration:Ch("namespace"),VariableDefinition(e,i){if(!e.matchContext(u5))i(e,"variable")},TypeDefinition(e,i){i(e,"type")},__proto__:null};function eL(e,i){let o=YO.get(i);if(o)return o;let l=[],a=!0;function u(f,h){let p=e.sliceString(f.from,f.to);l.push({label:p,type:h})}return i.cursor(ja.IncludeAnonymous).iterate((f)=>{if(a)a=!1;else if(f.name){let h=c5[f.name];if(h&&h(f,u)||JO.has(f.name))return!1}else if(f.to-f.from>8192){for(let h of eL(e,f.node))l.push(h);return!1}}),YO.set(i,l),l}var XO=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,tL=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function f5(e){let i=Wt(e.state).resolveInner(e.pos,-1);if(tL.indexOf(i.name)>-1)return null;let o=i.name=="VariableName"||i.to-i.from<20&&XO.test(e.state.sliceDoc(i.from,i.to));if(!o&&!e.explicit)return null;let l=[];for(let a=i;a;a=a.parent)if(JO.has(a.name))l=l.concat(eL(e.state.doc,a));return{options:l,from:o?i.from:e.pos,validFor:XO}}var Jo=Ml.define({name:"javascript",parser:KO.configure({props:[Br.add({IfStatement:zc({except:/^\s*({|else\b)/}),TryStatement:zc({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:IM,SwitchBody:(e)=>{let i=e.textAfter,o=/^\s*\}/.test(i),l=/^\s*(case|default)\b/.test(i);return e.baseIndent+(o?0:l?1:2)*e.unit},Block:HM({closing:"}"}),ArrowFunction:(e)=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":zc({except:/^\s*{/}),JSXElement(e){let i=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(i?0:e.unit)},JSXEscape(e){let i=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(i?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),Ll.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Yg,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let i=e.firstChild;if(!i||i.name=="JSXSelfClosingTag")return null;let o=e.lastChild;return{from:i.to,to:o.type.isError?e.to:o.from}},"JSXSelfClosingTag JSXOpenTag"(e){var i;let o=(i=e.firstChild)===null||i===void 0?void 0:i.nextSibling,l=e.lastChild;if(!o||o.type.isError)return null;return{from:o.to,to:l.type.isError?e.to:l.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),nL={test:(e)=>/^JSX/.test(e.name),facet:ph({commentTokens:{block:{open:"{/*",close:"*/}"}}})},rx=Jo.configure({dialect:"ts"},"typescript"),ax=Jo.configure({dialect:"jsx",props:[Qg.add((e)=>e.isTop?[nL]:void 0)]}),ux=Jo.configure({dialect:"jsx ts",props:[Qg.add((e)=>e.isTop?[nL]:void 0)]},"typescript"),iL=(e)=>({label:e,type:"keyword"}),oL="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(iL),d5=oL.concat(["declare","implements","private","protected","public"].map(iL));function sL(e={}){let i=e.jsx?e.typescript?ux:ax:e.typescript?rx:Jo,o=e.typescript?a5.concat(d5):ZO.concat(oL);return new $s(i,[Jo.data.of({autocomplete:QM(tL,GM(o))}),Jo.data.of({autocomplete:f5}),e.jsx?m5:[]])}function h5(e){for(;;){if(e.name=="JSXOpenTag"||e.name=="JSXSelfClosingTag"||e.name=="JSXFragmentTag")return e;if(e.name=="JSXEscape"||!e.parent)return null;e=e.parent}}function FO(e,i,o=e.length){for(let l=i===null||i===void 0?void 0:i.firstChild;l;l=l.nextSibling)if(l.name=="JSXIdentifier"||l.name=="JSXBuiltin"||l.name=="JSXNamespacedName"||l.name=="JSXMemberExpression")return e.sliceString(l.from,Math.min(l.to,o));return""}var p5=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),m5=xe.inputHandler.of((e,i,o,l,a)=>{if((p5?e.composing:e.compositionStarted)||e.state.readOnly||i!=o||l!=">"&&l!="/"||!Jo.isActiveAt(e.state,i,-1))return!1;let u=a(),{state:f}=u,h=f.changeByRange((p)=>{var g;let{head:y}=p,v=Wt(f).resolveInner(y-1,-1),S;if(v.name=="JSXStartTag")v=v.parent;if(f.doc.sliceString(y-1,y)!=l||v.name=="JSXAttributeValue"&&v.to>y);else if(l==">"&&v.name=="JSXFragmentTag")return{range:p,changes:{from:y,insert:"</>"}};else if(l=="/"&&v.name=="JSXStartCloseTag"){let w=v.parent,A=w.parent;if(A&&w.from==y-2&&((S=FO(f.doc,A.firstChild,y))||((g=A.firstChild)===null||g===void 0?void 0:g.name)=="JSXFragmentTag")){let C=`${S}>`;return{range:Z.cursor(y+C.length,-1),changes:{from:y,insert:C}}}}else if(l==">"){let w=h5(v);if(w&&w.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(f.doc.sliceString(y,y+2))&&(S=FO(f.doc,w,y)))return{range:p,changes:{from:y,insert:`</${S}>`}}}return{range:p}});if(h.changes.empty)return!1;return e.dispatch([u,f.update(h,{userEvent:"input.complete",scrollIntoView:!0})]),!0});var Ah=["_blank","_self","_top","_parent"],cx=["ascii","utf-8","utf-16","latin1","latin1"],fx=["get","post","put","delete"],dx=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],oo=["true","false"],de={},g5={a:{attrs:{href:null,ping:null,type:null,media:null,target:Ah,hreflang:null}},abbr:de,address:de,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:de,aside:de,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:de,base:{attrs:{href:null,target:Ah}},bdi:de,bdo:de,blockquote:{attrs:{cite:null}},body:de,br:de,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:dx,formmethod:fx,formnovalidate:["novalidate"],formtarget:Ah,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:de,center:de,cite:de,code:de,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:de,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:de,div:de,dl:de,dt:de,em:de,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:de,figure:de,footer:de,form:{attrs:{action:null,name:null,"accept-charset":cx,autocomplete:["on","off"],enctype:dx,method:fx,novalidate:["novalidate"],target:Ah}},h1:de,h2:de,h3:de,h4:de,h5:de,h6:de,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:de,hgroup:de,hr:de,html:{attrs:{manifest:null}},i:de,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:dx,formmethod:fx,formnovalidate:["novalidate"],formtarget:Ah,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:de,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:de,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:de,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:cx,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:de,noscript:de,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:de,param:{attrs:{name:null,value:null}},pre:de,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:de,rt:de,ruby:de,samp:de,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:cx}},section:de,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:de,source:{attrs:{src:null,type:null,media:null}},span:de,strong:de,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:de,summary:de,sup:de,table:de,tbody:de,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:de,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:de,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:de,time:{attrs:{datetime:null}},title:de,tr:de,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:de,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:de},cL={accesskey:null,class:null,contenteditable:oo,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:oo,autocorrect:oo,autocapitalize:oo,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":oo,"aria-autocomplete":["inline","list","both","none"],"aria-busy":oo,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":oo,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":oo,"aria-hidden":oo,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":oo,"aria-multiselectable":oo,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":oo,"aria-relevant":null,"aria-required":oo,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},fL="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((e)=>"on"+e);for(let e of fL)cL[e]=null;class Uc{constructor(e,i){this.tags={...g5,...e},this.globalAttrs={...cL,...i},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}Uc.default=new Uc;function _c(e,i,o=e.length){if(!i)return"";let l=i.firstChild,a=l&&l.getChild("TagName");return a?e.sliceString(a.from,Math.min(a.to,o)):""}function qc(e,i=!1){for(;e;e=e.parent)if(e.name=="Element")if(i)i=!1;else return e;return null}function dL(e,i,o){let l=o.tags[_c(e,qc(i))];return(l===null||l===void 0?void 0:l.children)||o.allTags}function px(e,i){let o=[];for(let l=qc(i);l&&!l.type.isTop;l=qc(l.parent)){let a=_c(e,l);if(a&&l.lastChild.name=="CloseTag")break;if(a&&o.indexOf(a)<0&&(i.name=="EndTag"||i.from>=l.firstChild.to))o.push(a)}return o}var hL=/^[:\-\.\w\u00b7-\uffff]*$/;function lL(e,i,o,l,a){let u=/\s*>/.test(e.sliceDoc(a,a+5))?"":">",f=qc(o,o.name=="StartTag"||o.name=="TagName");return{from:l,to:a,options:dL(e.doc,f,i).map((h)=>({label:h,type:"type"})).concat(px(e.doc,o).map((h,p)=>({label:"/"+h,apply:"/"+h+u,type:"type",boost:99-p}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function rL(e,i,o,l){let a=/\s*>/.test(e.sliceDoc(l,l+5))?"":">";return{from:o,to:l,options:px(e.doc,i).map((u,f)=>({label:u,apply:u+a,type:"type",boost:99-f})),validFor:hL}}function y5(e,i,o,l){let a=[],u=0;for(let f of dL(e.doc,o,i))a.push({label:"<"+f,type:"type"});for(let f of px(e.doc,o))a.push({label:"</"+f+">",type:"type",boost:99-u++});return{from:l,to:l,options:a,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function b5(e,i,o,l,a){let u=qc(o),f=u?i.tags[_c(e.doc,u)]:null,h=f&&f.attrs?Object.keys(f.attrs):[],p=f&&f.globalAttrs===!1?h:h.length?h.concat(i.globalAttrNames):i.globalAttrNames;return{from:l,to:a,options:p.map((g)=>({label:g,type:"property"})),validFor:hL}}function v5(e,i,o,l,a){var u;let f=(u=o.parent)===null||u===void 0?void 0:u.getChild("AttributeName"),h=[],p=void 0;if(f){let g=e.sliceDoc(f.from,f.to),y=i.globalAttrs[g];if(!y){let v=qc(o),S=v?i.tags[_c(e.doc,v)]:null;y=(S===null||S===void 0?void 0:S.attrs)&&S.attrs[g]}if(y){let v=e.sliceDoc(l,a).toLowerCase(),S='"',w='"';if(/^['"]/.test(v))p=v[0]=='"'?/^[^"]*$/:/^[^']*$/,S="",w=e.sliceDoc(a,a+1)==v[0]?"":v[0],v=v.slice(1),l++;else p=/^[^\s<>='"]*$/;for(let A of y)h.push({label:A,apply:S+A+w,type:"constant"})}}return{from:l,to:a,options:h,validFor:p}}function pL(e,i){let{state:o,pos:l}=i,a=Wt(o).resolveInner(l,-1),u=a.resolve(l);for(let f=l,h;u==a&&(h=a.childBefore(f));){let p=h.lastChild;if(!p||!p.type.isError||p.from<p.to)break;u=a=h,f=p.from}if(a.name=="TagName")return a.parent&&/CloseTag$/.test(a.parent.name)?rL(o,a,a.from,l):lL(o,e,a,a.from,l);else if(a.name=="StartTag"||a.name=="IncompleteTag")return lL(o,e,a,l,l);else if(a.name=="StartCloseTag"||a.name=="IncompleteCloseTag")return rL(o,a,l,l);else if(a.name=="OpenTag"||a.name=="SelfClosingTag"||a.name=="AttributeName")return b5(o,e,a,a.name=="AttributeName"?a.from:l,l);else if(a.name=="Is"||a.name=="AttributeValue"||a.name=="UnquotedAttributeValue")return v5(o,e,a,a.name=="Is"?l:a.from,l);else if(i.explicit&&(u.name=="Element"||u.name=="Text"||u.name=="Document"))return y5(o,e,a,l);else return null}function mL(e){return pL(Uc.default,e)}function S5(e){let{extraTags:i,extraGlobalAttributes:o}=e,l=o||i?new Uc(i,o):Uc.default;return(a)=>pL(l,a)}var x5=Jo.parser.configure({top:"SingleExpression"}),gL=[{tag:"script",attrs:(e)=>e.type=="text/typescript"||e.lang=="ts",parser:rx.parser},{tag:"script",attrs:(e)=>e.type=="text/babel"||e.type=="text/jsx",parser:ax.parser},{tag:"script",attrs:(e)=>e.type=="text/typescript-jsx",parser:ux.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:x5},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Jo.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:wh.parser}],yL=[{name:"style",parser:wh.parser.configure({top:"Styles"})}].concat(fL.map((e)=>({name:e,parser:Jo.parser}))),bL=Ml.define({name:"html",parser:uL.configure({props:[Br.add({Element(e){let i=/^(\s*)(<\/)?/.exec(e.textAfter);if(e.node.to<=e.pos+i[0].length)return e.continue();return e.lineIndent(e.node.from)+(i[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let i=null,o;for(let l=e.node;;){let a=l.lastChild;if(!a||a.name!="Element"||a.to!=l.to)break;i=l=a}if(i&&!((o=i.lastChild)&&(o.name=="CloseTag"||o.name=="SelfClosingTag")))return e.lineIndent(i.from)+e.unit;return null}}),Ll.add({Element(e){let{firstChild:i,lastChild:o}=e;if(!i||i.name!="OpenTag")return null;return{from:i.to,to:o.name=="CloseTag"?o.from:e.to}}}),PM.add({"OpenTag CloseTag":(e)=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),ty=bL.configure({wrap:hx(gL,yL)});function vL(e={}){let i="",o;if(e.matchClosingTags===!1)i="noMatch";if(e.selfClosingTags===!0)i=(i?i+" ":"")+"selfClosing";if(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)o=hx((e.nestedLanguages||[]).concat(gL),(e.nestedAttributes||[]).concat(yL));let l=o?bL.configure({wrap:o,dialect:i}):i?ty.configure({dialect:i}):ty;return new $s(l,[ty.data.of({autocomplete:S5(e)}),e.autoCloseTags!==!1?k5:[],sL().support,WO().support])}var aL=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),k5=xe.inputHandler.of((e,i,o,l,a)=>{if(e.composing||e.state.readOnly||i!=o||l!=">"&&l!="/"||!ty.isActiveAt(e.state,i,-1))return!1;let u=a(),{state:f}=u,h=f.changeByRange((p)=>{var g,y,v;let S=f.doc.sliceString(p.from-1,p.to)==l,{head:w}=p,A=Wt(f).resolveInner(w,-1),C;if(S&&l==">"&&A.name=="EndTag"){let D=A.parent;if(((y=(g=D.parent)===null||g===void 0?void 0:g.lastChild)===null||y===void 0?void 0:y.name)!="CloseTag"&&(C=_c(f.doc,D.parent,w))&&!aL.has(C)){let M=w+(f.doc.sliceString(w,w+1)===">"?1:0),H=`</${C}>`;return{range:p,changes:{from:w,to:M,insert:H}}}}else if(S&&l=="/"&&A.name=="IncompleteCloseTag"){let D=A.parent;if(A.from==w-2&&((v=D.lastChild)===null||v===void 0?void 0:v.name)!="CloseTag"&&(C=_c(f.doc,D,w))&&!aL.has(C)){let M=w+(f.doc.sliceString(w,w+1)===">"?1:0),H=`${C}>`;return{range:Z.cursor(w+H.length,-1),changes:{from:w,to:M,insert:H}}}}return{range:p}});if(h.changes.empty)return!1;return e.dispatch([u,f.update(h,{userEvent:"input.complete",scrollIntoView:!0})]),!0});var kL=ph({commentTokens:{block:{open:"<!--",close:"-->"}}}),wL=new hi,CL=zO.configure({props:[Ll.add((e)=>!e.is("Block")||e.is("Document")||yx(e)!=null||w5(e)?void 0:(i,o)=>({from:o.doc.lineAt(i.from).to,to:i.to})),wL.add(yx),Br.add({Document:()=>null}),Nr.add({Document:kL})]});function yx(e){let i=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return i?+i[1]:void 0}function w5(e){return e.name=="OrderedList"||e.name=="BulletList"}function C5(e,i){let o=e;for(;;){let l=o.nextSibling,a;if(!l||(a=yx(l.type))!=null&&a<=i)break;o=l}return o.to}var A5=UM.of((e,i,o)=>{for(let l=Wt(e).resolveInner(o,-1);l;l=l.parent){if(l.from<i)break;let a=l.type.prop(wL);if(a==null)continue;let u=C5(l,a);if(u>o)return{from:o,to:u}}return null});function bx(e){return new Li(kL,e,[],"markdown")}var T5=bx(CL),E5=CL.configure([IO,qO,_O,$O,{props:[Ll.add({Table:(e,i)=>({from:i.doc.lineAt(e.from).to,to:e.to})})]}]),iy=bx(E5);function D5(e,i){return(o)=>{if(o&&e){let l=null;if(o=/\S*/.exec(o)[0],typeof e=="function")l=e(o);else l=mh.matchLanguageName(e,o,!0);if(l instanceof mh)return l.support?l.support.language.parser:Mc.getSkippingParser(l.load());else if(l)return l.parser}return i?i.parser:null}}class ny{constructor(e,i,o,l,a,u,f){this.node=e,this.from=i,this.to=o,this.spaceBefore=l,this.spaceAfter=a,this.type=u,this.item=f}blank(e,i=!0){let o=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){while(o.length<e)o+=" ";return o}else{for(let l=this.to-this.from-o.length-this.spaceAfter.length;l>0;l--)o+=" ";return o+(i?this.spaceAfter:"")}}marker(e,i){let o=this.node.name=="OrderedList"?String(+TL(this.item,e)[2]+i):"";return this.spaceBefore+o+this.type+this.spaceAfter}}function AL(e,i){let o=[],l=[];for(let a=e;a;a=a.parent){if(a.name=="FencedCode")return l;if(a.name=="ListItem"||a.name=="Blockquote")o.push(a)}for(let a=o.length-1;a>=0;a--){let u=o[a],f,h=i.lineAt(u.from),p=u.from-h.from;if(u.name=="Blockquote"&&(f=/^ *>( ?)/.exec(h.text.slice(p))))l.push(new ny(u,p,p+f[0].length,"",f[1],">",null));else if(u.name=="ListItem"&&u.parent.name=="OrderedList"&&(f=/^( *)\d+([.)])( *)/.exec(h.text.slice(p)))){let g=f[3],y=f[0].length;if(g.length>=4)g=g.slice(0,g.length-4),y-=4;l.push(new ny(u.parent,p,p+y,f[1],g,f[2],u))}else if(u.name=="ListItem"&&u.parent.name=="BulletList"&&(f=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(h.text.slice(p)))){let g=f[4],y=f[0].length;if(g.length>4)g=g.slice(0,g.length-4),y-=4;let v=f[2];if(f[3])v+=f[3].replace(/[xX]/," ");l.push(new ny(u.parent,p,p+y,f[1],g,v,u))}}return l}function TL(e,i){return/^(\s*)(\d+)(?=[.)])/.exec(i.sliceString(e.from,e.from+10))}function mx(e,i,o,l=0){for(let a=-1,u=e;;){if(u.name=="ListItem"){let h=TL(u,i),p=+h[2];if(a>=0){if(p!=a+1)return;o.push({from:u.from+h[1].length,to:u.from+h[0].length,insert:String(a+2+l)})}a=p}let f=u.nextSibling;if(!f)break;u=f}}function vx(e,i){let o=/^[ \t]*/.exec(e)[0].length;if(!o||i.facet(Wg)!="\t")return e;let l=Rr(e,4,o),a="";for(let u=l;u>0;)if(u>=4)a+="\t",u-=4;else a+=" ",u--;return a+e.slice(o)}var R5=(e={})=>({state:i,dispatch:o})=>{let l=Wt(i),{doc:a}=i,u=null,f=i.changeByRange((h)=>{if(!h.empty||!iy.isActiveAt(i,h.from,-1)&&!iy.isActiveAt(i,h.from,1))return u={range:h};let p=h.from,g=a.lineAt(p),y=AL(l.resolveInner(p,-1),a);while(y.length&&y[y.length-1].from>p-g.from)y.pop();if(!y.length)return u={range:h};let v=y[y.length-1];if(v.to-v.spaceAfter.length>p-g.from)return u={range:h};let S=p>=v.to-v.spaceAfter.length&&!/\S/.test(g.text.slice(v.to));if(v.item&&S){let M=v.node.firstChild,H=v.node.getChild("ListItem","ListItem");if(M.to>=p||H&&H.to<p||g.from>0&&!/[^\s>]/.test(a.lineAt(g.from-1).text)||e.nonTightLists===!1){let V=y.length>1?y[y.length-2]:null,q,j="";if(V&&V.item)q=g.from+V.from,j=V.marker(a,1);else q=g.from+(V?V.to:0);let G=[{from:q,to:p,insert:j}];if(v.node.name=="OrderedList")mx(v.item,a,G,-2);if(V&&V.node.name=="OrderedList")mx(V.item,a,G);return{range:Z.cursor(q+j.length),changes:G}}else{let V=xL(y,i,g);return{range:Z.cursor(p+V.length+1),changes:{from:g.from,insert:V+i.lineBreak}}}}if(v.node.name=="Blockquote"&&S&&g.from){let M=a.lineAt(g.from-1),H=/>\s*$/.exec(M.text);if(H&&H.index==v.from){let V=i.changes([{from:M.from+H.index,to:M.to},{from:g.from+v.from,to:g.to}]);return{range:h.map(V),changes:V}}}let w=[];if(v.node.name=="OrderedList")mx(v.item,a,w);let A=v.item&&v.item.from<g.from,C="";if(!A||/^[\s\d.)\-+*>]*/.exec(g.text)[0].length>=v.to)for(let M=0,H=y.length-1;M<=H;M++)C+=M==H&&!A?y[M].marker(a,1):y[M].blank(M<H?Rr(g.text,4,y[M+1].from)-C.length:null);let D=p;while(D>g.from&&/\s/.test(g.text.charAt(D-g.from-1)))D--;if(C=vx(C,i),O5(v.node,i.doc))C=xL(y,i,g)+i.lineBreak+C;return w.push({from:D,to:p,insert:i.lineBreak+C}),{range:Z.cursor(D+C.length+1),changes:w}});if(u)return!1;return o(i.update(f,{scrollIntoView:!0,userEvent:"input"})),!0},M5=R5();function SL(e){return e.name=="QuoteMark"||e.name=="ListMark"}function O5(e,i){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let o=e.firstChild,l=e.getChild("ListItem","ListItem");if(!l)return!1;let a=i.lineAt(o.to),u=i.lineAt(l.from),f=/^[\s>]*$/.test(a.text);return a.number+(f?0:1)<u.number}function xL(e,i,o){let l="";for(let a=0,u=e.length-2;a<=u;a++)l+=e[a].blank(a<u?Rr(o.text,4,e[a+1].from)-l.length:null,a<u);return vx(l,i)}function L5(e,i){let o=e.resolveInner(i,-1),l=i;if(SL(o))l=o.from,o=o.parent;for(let a;a=o.childBefore(l);)if(SL(a))l=a.from;else if(a.name=="OrderedList"||a.name=="BulletList")o=a.lastChild,l=o.to;else break;return o}var z5=({state:e,dispatch:i})=>{let o=Wt(e),l=null,a=e.changeByRange((u)=>{let f=u.from,{doc:h}=e;if(u.empty&&iy.isActiveAt(e,u.from)){let p=h.lineAt(f),g=AL(L5(o,f),h);if(g.length){let y=g[g.length-1],v=y.to-y.spaceAfter.length+(y.spaceAfter?1:0);if(f-p.from>v&&!/\S/.test(p.text.slice(v,f-p.from)))return{range:Z.cursor(p.from+v),changes:{from:p.from+v,to:f}};if(f-p.from==v&&(!y.item||p.from<=y.item.from||!/\S/.test(p.text.slice(0,y.to)))){let S=p.from+y.from;if(y.item&&y.node.from<y.item.from&&/\S/.test(p.text.slice(y.from,y.to))){let w=y.blank(Rr(p.text,4,y.to)-Rr(p.text,4,y.from));if(S==p.from)w=vx(w,e);return{range:Z.cursor(S+w.length),changes:{from:S,to:p.from+y.to,insert:w}}}if(S<f)return{range:Z.cursor(S),changes:{from:S,to:f}}}}}return l={range:u}});if(l)return!1;return i(e.update(a,{scrollIntoView:!0,userEvent:"delete"})),!0},N5=[{key:"Enter",run:M5},{key:"Backspace",run:z5}],EL=vL({matchClosingTags:!1});function DL(e={}){let{codeLanguages:i,defaultCodeLanguage:o,addKeymap:l=!0,base:{parser:a}=T5,completeHTMLTags:u=!0,pasteURLAsLink:f=!0,htmlTagLanguage:h=EL}=e;if(!(a instanceof kh))throw RangeError("Base parser provided to `markdown` should be a Markdown parser");let p=e.extensions?[e.extensions]:[],g=[h.support,A5],y;if(f)g.push(U5);if(o instanceof $s)g.push(o.support),y=o.language;else if(o)y=o;let v=i||y?D5(i,y):void 0;if(p.push(NO({codeParser:v,htmlParser:h.language.parser})),l)g.push(Cl.high(ch.of(N5)));let S=bx(a.configure(p));if(u)g.push(S.data.of({autocomplete:B5}));return new $s(S,g)}function B5(e){let{state:i,pos:o}=e,l=/<[:\-\.\w\u00b7-\uffff]*$/.exec(i.sliceDoc(o-25,o));if(!l)return null;let a=Wt(i).resolveInner(o,-1);while(a&&!a.type.isTop){if(a.name=="CodeBlock"||a.name=="FencedCode"||a.name=="ProcessingInstructionBlock"||a.name=="CommentBlock"||a.name=="Link"||a.name=="Image")return null;a=a.parent}return{from:o-l[0].length,to:o,options:H5(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}var gx=null;function H5(){if(gx)return gx;let e=mL(new j1(Ze.create({extensions:EL}),0,!0));return gx=e?e.options:[]}var I5=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,U5=xe.domEventHandlers({paste:(e,i)=>{var o;let{main:l}=i.state.selection;if(l.empty)return!1;let a=(o=e.clipboardData)===null||o===void 0?void 0:o.getData("text/plain");if(!a||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(a))return!1;if(/^www\./.test(a))a="https://"+a;if(!iy.isActiveAt(i.state,l.from,1))return!1;let u=Wt(i.state),f=!1;if(u.iterate({from:l.from,to:l.to,enter:(h)=>{if(h.from>l.from||I5.test(h.name))f=!0},leave:(h)=>{if(h.to<l.to)f=!0}}),f)return!1;return i.dispatch({changes:[{from:l.from,insert:"["},{from:l.to,insert:`](${a})`}],userEvent:"input.paste",scrollIntoView:!0}),!0}});var Nn=Y(ft(),1);var Ao=Y(he(),1),_5=["source","split","preview"];function q5(e){return e==="source"||e==="split"||e==="preview"}var $5={source:"Source",split:"Split",preview:"Preview"},zL=So.define(),P5=Nc.define([{tag:F.heading1,fontFamily:"var(--console-display)",fontSize:"1.75em",fontWeight:"600",color:"var(--console-text)"},{tag:F.heading2,fontFamily:"var(--console-display)",fontSize:"1.4em",fontWeight:"600",color:"var(--console-text)"},{tag:F.heading3,fontFamily:"var(--console-display)",fontSize:"1.18em",fontWeight:"600",color:"var(--console-text)"},{tag:F.heading,color:"var(--console-text)",fontWeight:"600"},{tag:F.monospace,fontFamily:"var(--console-mono)",fontSize:"0.86em"},{tag:F.meta,color:"var(--console-text-muted)"},{tag:F.emphasis,fontStyle:"italic"},{tag:F.strong,fontWeight:"600"},{tag:[F.link,F.url],color:"var(--console-text)",textDecoration:"underline"},{tag:F.quote,color:"var(--console-text-dim)"}]),j5=[DL(),qM(P5),xe.lineWrapping,xe.contentAttributes.of({"aria-label":"Markdown source",tabindex:"0"})];function V5(e,i=[]){return Ze.create({doc:e,extensions:[...j5,...i]})}function G5(e,i){if(e.state.doc.toString()===i)return;e.dispatch({changes:{from:0,to:e.state.doc.length,insert:i},annotations:zL.of(!0)})}function Q5(e){let{value:i,onChange:o,onSelectionChange:l,readOnly:a}=e,u=Nn.useRef(null),f=Nn.useRef(null),h=Nn.useRef(i),p=Nn.useRef(a),g=Nn.useRef(new xc),y=Nn.useRef(o),v=Nn.useRef(l),S=Nn.useCallback((w)=>{let A=w.state.selection.main;v.current?.(A.empty?null:{from:A.from,to:A.to})},[]);return Nn.useEffect(()=>{y.current=o,v.current=l},[o,l]),Nn.useEffect(()=>{let w=u.current;if(!w)return;let A=new xe({parent:w,state:V5(h.current,[g.current.of([Ze.readOnly.of(p.current),xe.editable.of(!p.current)]),xe.updateListener.of((C)=>{if(!C.docChanged)return;if(C.transactions.some((D)=>D.annotation(zL)===!0))return;y.current(C.state.doc.toString())}),xe.updateListener.of((C)=>{if(!C.selectionSet&&!C.docChanged)return;S(C.view)}),xe.domEventHandlers({keyup:(C,D)=>(S(D),!1),mouseup:(C,D)=>(window.setTimeout(()=>S(D),0),!1),touchend:(C,D)=>(window.setTimeout(()=>S(D),0),!1)})])});return f.current=A,()=>{if(A.destroy(),f.current===A)f.current=null}},[S]),Nn.useEffect(()=>{let w=f.current;if(!w)return;G5(w,i)},[i]),Nn.useEffect(()=>{let w=f.current;if(!w)return;w.dispatch({effects:g.current.reconfigure([Ze.readOnly.of(a),xe.editable.of(!a)])})},[a]),Ao.jsxDEV("div",{ref:u,...N(Us.source),"data-editor":"codemirror6"},void 0,!1,void 0,this)}function NL(e){let{value:i,mode:o,onChange:l,onModeChange:a,onSelectionChange:u,readOnly:f=!1,singlePane:h=!1}=e,p=h&&o==="split"?f?"preview":"source":o,g=Nn.useId(),y=p!=="preview",v=p!=="source";return Ao.jsxDEV("div",{...N(Us.root),children:[Ao.jsxDEV("header",{...N(Us.toolbar),children:[Ao.jsxDEV(RL,{value:p,onValueChange:(S)=>{if(q5(S))a(S)},children:Ao.jsxDEV(ML,{...N(Us.modes,h&&Us.inlineModes),"aria-label":"Editor body view",children:_5.filter((S)=>!h||S!=="split").map((S)=>Ao.jsxDEV(OL,{value:S,id:`${g}-${S}`,"aria-controls":g,children:$5[S]},S,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ao.jsxDEV("span",{...N(Us.metadata),children:[i.trim()?i.trim().split(/\s+/).length.toLocaleString():0," ","words"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Ao.jsxDEV("div",{...N(Us.panes,y&&v&&Us.split),"data-studio-split":y&&v?"":void 0,id:g,role:"tabpanel","aria-labelledby":`${g}-${p}`,children:[y&&Ao.jsxDEV(Q5,{value:i,onChange:l,onSelectionChange:(S)=>u?.(S?{...S,text:i.slice(S.from,S.to)}:null),readOnly:f},void 0,!1,void 0,this),v&&Ao.jsxDEV("div",{...N(Us.preview),"data-studio-preview":"",tabIndex:0,role:"region","aria-label":"Rendered document",children:Ao.jsxDEV(LL,{presentation:"document",documentTitle:e.documentTitle,children:i},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Nl="grouping-definitions",Ga=20,W5=mi.strictObject({label:oy.shape.label,excludeTypes:mi.array(oy.shape.types.element).max(100).refine((e)=>new Set(e).size===e.length,"Excluded types must be unique.").optional(),multiple:mi.boolean(),values:mi.array(mi.string().min(1)).min(1).superRefine((e,i)=>{let o=new Set;e.forEach((l,a)=>{if(o.has(l))i.addIssue({code:"custom",path:[a],message:"Values must be unique (matching is exact)."});o.add(l)})}).optional()}),BL=mi.object({groupings:mi.record(oy.shape.key,W5).refine((e)=>Object.keys(e).length<=Ga,`Define at most ${Ga} groupings.`).default({})});var Qa=Y(ft(),1);var Th=Y(he(),1);function $c(e,i){return i==="split"?e.fields.find((o)=>o.name==="title"&&o.widget==="string"):void 0}function HL(e){let i=Qa.useId(),o=Qa.useRef(null),l=Qa.useRef(null),a=e.issues?.find((u)=>u.path[0]===e.descriptor.name);return Qa.useEffect(()=>{let u=o.current;if(!a||!u||u!==u.closest("form")?.querySelector("[data-studio-invalid-field]"))return;l.current?.focus()},[a,e.issues]),Th.jsxDEV("span",{ref:o,...a&&{"data-studio-invalid-field":""},children:[Th.jsxDEV("span",{"data-value":e.value,...N(li.titleGrow),children:Th.jsxDEV("textarea",{ref:l,rows:1,name:e.descriptor.name,"aria-label":e.descriptor.label,value:e.value,required:e.descriptor.required!==!1,placeholder:e.placeholder,"aria-invalid":a?!0:void 0,"aria-describedby":a?i:void 0,onKeyDown:(u)=>{if(u.key==="Enter")u.preventDefault()},onChange:(u)=>e.onChange(u.currentTarget.value.replace(/\r?\n/g," ")),...N(li.titleInput)},void 0,!1,void 0,this)},void 0,!1,void 0,this),a&&Th.jsxDEV("span",{id:i,...N(li.titleIssue),children:a.message},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var sy="studio-save-reason";function ly(e,i,o){if(!Sx(e,i,o))return;let l=i.fieldIssues?.some((a)=>a.path[0]!=="segment"&&a.path[0]!=="prefix");if(_d(e)||l)return"Fix the highlighted fields first.";if(i.destinationBlocked&&e.mode.kind==="create")return i.presentation&&$c(i.entitySchema,i.presentation)?"Give this entry a title to create it.":"Name the file to create this entry.";return}function Sx(e,i,o){let l=i.selectedEntityType===Nl,a=l||e.mode.kind==="create"&&i.entitySchema.isSingleton;return!i.canEdit||_d(e)||l&&!i.entitySchema.groupingDefinitions||i.destinationBlocked||e.save.kind==="saving"||a&&!o}var Pc=Y(ft(),1);var Ni={root:{keoZOQ:"x1sgpng",kmVPX3:"x6w2896",kaIpWk:"xu4hgxq",kWkggS:"x18s3upu",$$css:!0},head:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kjj79g:"x1qughib",kOIVth:"x883omv",kMwMTN:"x1ar3pfp",$$css:!0},state:{kMwMTN:"xgi1xjn",k63SB2:"x1pd3egz",$$css:!0},copy:{kogj98:"x108lf0y",kMwMTN:"x1ar3pfp",kGuDYH:"x1j6dyjg",kLWn49:"xfrs9s4",kHjlTd:"xj0a0fe",$$css:!0},actions:{k1xSpc:"x78zum5",kwnvtZ:"x1a02dak",kOIVth:"x1j9xkj6",keoZOQ:"xk9mzb7",$$css:!0},button:{kAzted:"x1rz828m x1c4ya5t",kmVPX3:"x1jmcyos",kGuDYH:"x1k6wstc",$$css:!0},publish:{kVAM5u:"xawfzfr",kWkggS:"x15vqgvx",kMwMTN:"x1um1dla",$$css:!0},complete:{kMwMTN:"x19k5i5u",kMv6JI:"xa9opjo",$$css:!0},confirmation:{kmVPX3:"x12s40zk",kWkggS:"xc1c755",kVVagm:"x1t8o5tu",$$css:!0}};var Bn=Y(he(),1);function xx(e){return"success"in e&&e.success===!1}function kx(e){return"needsConfirmation"in e&&e.needsConfirmation===!0}function Y5(e){return Bn.jsxDEV(yn,{mark:"↑",title:`Publish ${e.title} now?`,titleId:"publish-confirm-title",cancelLabel:"Review again",confirmLabel:e.confirming?"Publishing…":"Confirm publication",pending:e.confirming,confirmVariant:"primary",onCancel:e.onCancel,onConfirm:e.onConfirm,children:[Bn.jsxDEV("p",{children:e.preview},void 0,!1,void 0,this),Bn.jsxDEV("p",{...N(Ni.confirmation),children:"This sends the current saved version to an external public provider."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function IL(e){let[i,o]=Pc.useState(null),[l,a]=Pc.useState(null),[u,f]=Pc.useState(null),h={entityType:e.entityType,entityId:e.entityId},p=e.unsaved||i!==null,g=e.status==="draft"?e.missing??[]:[],y=g.length>0,v=Pc.useCallback(async(A,C)=>{o(C),a(null);try{let D=await e.onAction(A);if(xx(D))throw Error(D.error);if(kx(D))f({args:D.args,preview:D.preview??`This will publish ${e.entityType}:${e.entityId} publicly.`});else if(A.type==="publish")f(null)}catch(D){a(Mi(D))}finally{o(null)}},[e]),S=e.status==="queued"?{type:"remove",...h}:e.status==="failed"?{type:"retry",...h}:{type:"queue",...h},w=e.status==="queued"?"Remove from queue":e.status==="failed"?"Retry":"Add to queue";return Bn.jsxDEV("section",{...N(Ni.root),"aria-label":"Publication actions",children:[Bn.jsxDEV("header",{...N(Ni.head,Vn.eyebrow),children:[Bn.jsxDEV("span",{children:"Publication"},void 0,!1,void 0,this),Bn.jsxDEV("b",{...N(Ni.state,ry(e.status==="queued"?"warn":e.status==="failed"?"error":e.status==="published"?"good":void 0)),children:e.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Bn.jsxDEV("p",{...N(Ni.copy),children:"Operates on the saved entity. Publication state is separate from the save pipeline below."},void 0,!1,void 0,this),e.unsaved&&Bn.jsxDEV("p",{...N(Ni.copy,ry("warn")),children:"Save changes before changing publication state."},void 0,!1,void 0,this),y&&Bn.jsxDEV("p",{...N(Ni.copy,ry("warn")),children:X5(g)},void 0,!1,void 0,this),e.status!=="published"&&Bn.jsxDEV("div",{...N(Ni.actions),children:[Bn.jsxDEV(we,{type:"button",variant:"ghost",xstyle:Ni.button,disabled:p||y,onClick:()=>void v(S,"lifecycle"),children:i==="lifecycle"?"Working…":w},void 0,!1,void 0,this),Bn.jsxDEV(we,{type:"button",xstyle:[Ni.button,Ni.publish],disabled:p||y,onClick:()=>void v({type:"publish",...h},"publish"),children:i==="publish"?"Preparing…":"Publish now"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.status==="published"&&Bn.jsxDEV("p",{...N(Ni.copy,Ni.complete),children:"Published externally."},void 0,!1,void 0,this),l&&Bn.jsxDEV(ve,{tone:"error",children:l},void 0,!1,void 0,this),u&&Bn.jsxDEV(Y5,{title:e.title,preview:u.preview,confirming:i==="confirm",onCancel:()=>f(null),onConfirm:()=>void v({type:"publish",...h,confirmation:u.args},"confirm")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function X5(e){return`Add ${e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)??""}`} before publishing.`}var ay=Y(ft(),1);var Ps={editor:{kumcoG:"x1mkdm3x",k9llMU:"xxq7klm",k6KnKl:"x8ef1wo",k1JLwA:"x4jmfmw",k9pwkU:"x1y6iwit",$$css:!0},content:{kBCFzs:"x1osaytk",kbNqZ1:"x7sv70a",k7Eaqz:"xeuugli",kAzted:"x2lwn1j",kORKVm:"x1odjw0f",k3Woio:"x16dl9wz",kiEn40:"x1bqaal",k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kWkggS:"x18s3upu",$$css:!0},properties:{kmuXW:"x2lah0s",kORKVm:"xryxfnj",kWqL5O:"xgfja2r",kWkggS:"x18s3upu",kmVPX3:"x11wck8f",kubnTK:"x1crvqbx",kOLLwu:"x1inw03p",kRugJJ:"x1h32jcg",$$css:!0},manuscript:{kUk6DE:"x1mg3qzt",kAzted:"x5mc7k8",kVQacm:"xb3r6kr",kKq9zD:"x9uj0fw",krFdGn:"x19d57q8",kTWfjk:"x1f8pdon",$$css:!0},disclosure:{kmuXW:"x2lah0s",k7Eaqz:"xeuugli",kogj98:"x1vmk1f4",kaIpWk:"x12oqio5",kKwWVI:"x1hyyza1",$$css:!0},disclosedFields:{kmVPX3:"x560879",k7Eaqz:"xeuugli",$$css:!0},summaryDescription:{kGuDYH:"xfifm61",k63SB2:"xo1l8bm",kMwMTN:"xgi1xjn",keTefX:"xcev3uh",k1xSpc:"xt0psk2 xkaaz9w",$$css:!0},summary:{kkrTdU:"x1ypdohk",kmVPX3:"x1j671cp",kGuDYH:"xif65rj",k63SB2:"x19s9jnd",k3Woio:"x16dl9wz",kiEn40:"x7s97pk",$$css:!0}};var js=Y(he(),1);function UL(e){e.querySelector("details[data-studio-properties]")?.setAttribute("open","")}function _L({presentation:e,children:i}){return e==="split"?js.jsxDEV(js.Fragment,{children:i},void 0,!1,void 0,this):js.jsxDEV("div",{"data-studio-editor-content":"",role:"region","aria-label":"Record contents",tabIndex:0,...N(Ps.content),children:i},void 0,!1,void 0,this)}function qL({presentation:e,reveal:i,children:o,summaryDescription:l,hidden:a=!1}){let u=ay.useRef(null);if(ay.useLayoutEffect(()=>{if(i&&u.current)u.current.open=!0},[i]),e==="document")return js.jsxDEV("details",{ref:u,"data-studio-properties":"",...N(Ps.disclosure),children:[js.jsxDEV("summary",{...N(Ps.summary),children:["Properties",l&&js.jsxDEV("span",{...N(Ps.summaryDescription),children:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this),js.jsxDEV("div",{...N(Ps.disclosedFields),children:o},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return js.jsxDEV("aside",{"data-studio-properties":"",...N(Gn.colophon,e==="form"&&Gn.fullWidthProperties,e==="form"&&Ps.properties,a&&Gn.colophonHidden),children:o},void 0,!1,void 0,this)}var Rh=Y(ft(),1);var Hn=Y(ft(),1);function uy(e,i=[]){if(e!==void 0&&!Qn(e))return{rows:[],nextId:0,malformed:{value:e}};let o=Object.entries(e??{}).map(([l,a],u)=>({id:u,key:l,value:a,...i.includes(l)?{savedKey:l}:{}}));return{rows:o,nextId:o.length}}function $L(e){return{...e,rows:[...e.rows,{id:e.nextId,key:"",value:{label:"",multiple:!0}}],nextId:e.nextId+1}}function PL(e,i,o){return{...e,rows:e.rows.map((l)=>{if(l.id!==i)return l;if(l.savedKey!==void 0&&o.key!==void 0&&o.key!==l.savedKey)throw Error("Saved grouping keys cannot be renamed.");return{...l,...o}})}}function jL(e,i){return{...e,rows:e.rows.filter((o)=>o.id!==i)}}function wx(e){if(e.malformed)return{value:void 0,issues:[{path:["groupings"],message:"Groupings must be a mapping. Repair the source or explicitly replace it."}],pendingChanges:!1};let i=e.rows.filter((u,f)=>e.rows.some((h,p)=>p<f&&h.key===u.key));if(i.length)return{value:void 0,issues:i.map((u)=>({path:["groupings",u.key],message:`The key “${u.key}” is already used. Choose a different key.`})),pendingChanges:!0};let o=Object.fromEntries(e.rows.map((u)=>[u.key,u.value])),l=BL.safeParse({groupings:o}),a=l.success?[]:l.error.issues.map((u)=>({path:u.path.map((f)=>typeof f==="symbol"?String(f):f),message:u.message}));return{value:o,issues:a,pendingChanges:!1}}var _t={intro:{kMwMTN:"xgi1xjn",kGuDYH:"x4z9k3i",kLWn49:"x1dbl2gt",k1K539:"x1hq5gj4",ks0D6T:"x70i6om",$$css:!0},help:{kMwMTN:"xgi1xjn",$$css:!0},grid:{k1xSpc:"xrvj5dj",kumcoG:"xnby9oq x4jmfmw",kOIVth:"xhp1hw2",kqGvvJ:"x1mibpdg",k7Eaqz:"xeuugli",$$css:!0},choices:{kmVPX3:"x1717udv",kogj98:"x1ghz6dp",kMzoRj:"xc342km",k7Eaqz:"xeuugli",$$css:!0},choice:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kOIVth:"x883omv",kAzted:"xu0aao5 x1c4ya5t",kHjlTd:"xj0a0fe",$$css:!0},readOnly:{k1xSpc:"x1lliihq",kmVPX3:"x1160tuk",kaIpWk:"x1kogg8i",kWkggS:"xbslqsl",kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kHjlTd:"xj0a0fe",$$css:!0},first:{k8WAf4:"x10bfh3y",ks0D6T:"xe0576n",$$css:!0},actions:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kjj79g:"x1qughib",kOIVth:"xou54vl",keoZOQ:"xhrpt6u",$$css:!0},exclusions:{k1K539:"xod5an3",$$css:!0},exclusionsSummary:{k1xSpc:"xtcx8v3",kpqbRz:"x1cy9i3i",kkrTdU:"x1ypdohk",kAzted:"x1gg8mnh",k8WAf4:"x10dr8xq",$$css:!0},rule:{k1xSpc:"x78zum5",kwnvtZ:"x1a02dak",kOIVth:"xfe5i6u",k1K539:"xod5an3",$$css:!0}};var ke=Y(he(),1);function Dh(e,i,o){let l={...e,[i]:o};if(i==="excludeTypes"&&Array.isArray(o)&&o.length===0)delete l[i];return l}function GL(e){let{row:i,readOnly:o}=e,l=Qn(i.value)?i.value:void 0,a=i.savedKey!==void 0,u=typeof l?.label==="string"&&l.label.length>0?l.label:a?i.key:"New grouping",f=(h)=>e.onUpdate({value:h});return ke.jsxDEV("section",{...N(Ir.section),"aria-label":u,"data-definition-row":i.id,children:[ke.jsxDEV("div",{...N(Ir.head),children:[ke.jsxDEV("h2",{...N(Ir.title),children:u},void 0,!1,void 0,this),!o&&ke.jsxDEV(we,{type:"button",variant:"ghost","aria-label":`Remove ${u} grouping`,onClick:(h)=>e.onRemove(h.currentTarget),children:"Remove grouping"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.issues.length>0&&ke.jsxDEV(ve,{tone:"error",children:e.issues.map((h)=>h.message).join(" · ")},void 0,!1,void 0,this),!l?ke.jsxDEV(ke.Fragment,{children:[ke.jsxDEV(ve,{tone:"error",children:"This definition is not a mapping. Repair its source or explicitly remove the definition."},void 0,!1,void 0,this),ke.jsxDEV("pre",{...N(_t.readOnly),children:JSON.stringify(i.value,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):ke.jsxDEV(ke.Fragment,{children:[ke.jsxDEV(F5,{entry:l,label:u,rowKey:i.key,saved:a,readOnly:o,onChange:f,onKeyChange:(h)=>e.onUpdate({key:h})},void 0,!1,void 0,this),ke.jsxDEV(K5,{entry:l,contributorTypes:e.contributorTypes,systemTypes:e.systemTypes,readOnly:o,onChange:f},void 0,!1,void 0,this),ke.jsxDEV(Z5,{entry:l,label:u,name:e.allowedValuesName,usage:e.usage,readOnly:o,onChange:f},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function F5(e){let{entry:i,label:o,saved:l,readOnly:a}=e,u=i.multiple;return ke.jsxDEV("div",{...N(_t.grid),children:[ke.jsxDEV("label",{...N(Wn.field),children:[ke.jsxDEV("span",{...N(Wn.label),children:"Label"},void 0,!1,void 0,this),a?ke.jsxDEV("span",{...N(_t.readOnly),children:o},void 0,!1,void 0,this):ke.jsxDEV(Eh,{"aria-label":`${o} label`,value:typeof i.label==="string"?i.label:"",onChange:(f)=>e.onChange(Dh(i,"label",f.currentTarget.value)),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ke.jsxDEV("label",{...N(Wn.field),children:[ke.jsxDEV("span",{...N(Wn.label),children:"Key"},void 0,!1,void 0,this),a?ke.jsxDEV("code",{...N(_t.readOnly),children:e.rowKey},void 0,!1,void 0,this):ke.jsxDEV(Eh,{"aria-label":`${o} key`,value:e.rowKey,readOnly:l,xstyle:l?Wn.readOnly:void 0,required:!0,onChange:(f)=>{if(!l)e.onKeyChange(f.currentTarget.value)}},void 0,!1,void 0,this),ke.jsxDEV("span",{...N(Wn.listHelp,_t.help),children:l?"Fixed after creation":"Lowercase letters, digits and hyphens. Fixed when saved."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ke.jsxDEV("label",{...N(Wn.field),children:[ke.jsxDEV("span",{...N(Wn.label),children:"Values per entry"},void 0,!1,void 0,this),a?ke.jsxDEV("span",{...N(_t.readOnly),children:u===!0?"Several":u===!1?"One":"Invalid cardinality"},void 0,!1,void 0,this):ke.jsxDEV(La,{"aria-label":`${o} values per entry`,value:u===!0?"several":u===!1?"one":"",onChange:(f)=>e.onChange(Dh(i,"multiple",f.currentTarget.value==="several")),required:!0,children:[ke.jsxDEV("option",{value:"",disabled:!0,children:"Choose cardinality"},void 0,!1,void 0,this),ke.jsxDEV("option",{value:"one",children:"One"},void 0,!1,void 0,this),ke.jsxDEV("option",{value:"several",children:"Several"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function K5(e){let{entry:i,contributorTypes:o}=e,l=Array.isArray(i.excludeTypes)?i.excludeTypes.filter((f)=>typeof f==="string"):[],a=l.filter((f)=>!e.systemTypes.includes(f)),u=new Set(o.map((f)=>f.entityType));return ke.jsxDEV("details",{...N(_t.exclusions),children:[ke.jsxDEV("summary",{...N(Wn.label,_t.exclusionsSummary),children:["Exclude types",a.length>0?` (${a.length})`:""]},void 0,!0,void 0,this),ke.jsxDEV("p",{...N(Wn.listHelp,_t.help),children:"Content types participate unless excluded. System types never participate."},void 0,!1,void 0,this),e.readOnly?ke.jsxDEV("span",{...N(_t.readOnly),children:a.map((f)=>o.find((h)=>h.entityType===f)?.label??`${f} (unavailable)`).join(", ")||"None"},void 0,!1,void 0,this):ke.jsxDEV("fieldset",{...N(_t.choices),children:[ke.jsxDEV("legend",{...N(Wn.label),children:"Excluded content types"},void 0,!1,void 0,this),[...o,...a.filter((f)=>!u.has(f)).map((f)=>({entityType:f,label:`${f} (unavailable)`}))].map((f)=>ke.jsxDEV("label",{...N(_t.choice),children:[ke.jsxDEV("input",{type:"checkbox","aria-label":`Exclude ${f.label}`,...N(Ir.checkbox),checked:l.includes(f.entityType),onChange:(h)=>e.onChange(Dh(i,"excludeTypes",h.currentTarget.checked?[...l,f.entityType]:l.filter((p)=>p!==f.entityType)))},void 0,!1,void 0,this),f.label]},f.entityType,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Z5(e){let{entry:i,label:o,usage:l}=e,a=Object.hasOwn(i,"values"),u=l?new Map(l.values.map((f)=>[f.value,f.count])):void 0;return ke.jsxDEV(ke.Fragment,{children:[ke.jsxDEV("fieldset",{...N(_t.choices,_t.rule),children:[ke.jsxDEV("legend",{...N(Wn.label),children:"Allowed values"},void 0,!1,void 0,this),e.readOnly?ke.jsxDEV("span",{...N(_t.readOnly),children:a?"Only these values":"Any value"},void 0,!1,void 0,this):ke.jsxDEV(ke.Fragment,{children:[!1,!0].map((f)=>ke.jsxDEV("label",{...N(_t.choice),children:[ke.jsxDEV("input",{type:"radio",name:e.name,"aria-label":`${o}: ${f?"only these values":"any value"}`,checked:a===f,...N(Ir.checkbox),onChange:()=>e.onChange(f?Dh(i,"values",[]):Object.fromEntries(Object.entries(i).filter(([h])=>h!=="values")))},void 0,!1,void 0,this),f?"Only these values":"Any value"]},String(f),!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a&&ke.jsxDEV(ke.Fragment,{children:[ke.jsxDEV(VL,{label:`${o} allowed values`,purpose:"allowed-values",definition:{multiple:!0},value:i.values,onChange:(f)=>e.onChange(Dh(i,"values",f)),readOnly:e.readOnly,counts:u},void 0,!1,void 0,this),ke.jsxDEV("p",{...N(Wn.listHelp,_t.help),children:Array.isArray(i.values)&&i.values.length===0?"Add at least one allowed value, or choose Any value.":l?"Numbers show current usage. Unused values remain available.":"Usage is unavailable until this grouping can be read."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Ht=Y(he(),1);function QL(e,i){return e&&Object.hasOwn(e,i)?e[i]:void 0}function WL(e){let[i,o]=Hn.useState(()=>uy(e.value,e.savedKeys)),[l,a]=Hn.useState(null),u=Hn.useRef(null),f=Hn.useRef(void 0),h=Hn.useRef(null),p=Hn.useId(),g=Hn.useId(),y=JSON.stringify(e.value),v=JSON.stringify(e.savedKeys),S=Hn.useRef(y),w=Hn.useRef(v),A=Hn.useRef(void 0),C=wx(i);Hn.useEffect(()=>{if(y===S.current&&v===w.current)return;S.current=y,w.current=v,o(uy(e.value,e.savedKeys)),a(null)},[y,e.value,v,e.savedKeys]),Hn.useEffect(()=>{let q={issues:C.issues,pendingChanges:C.pendingChanges},j=JSON.stringify(q);if(A.current===j)return;A.current=j,e.onStateChange(q)}),Hn.useEffect(()=>{if(f.current!==void 0)u.current?.querySelector(`[data-definition-row="${f.current}"] input`)?.focus(),f.current=void 0;if(l===null&&h.current)(h.current.isConnected?h.current:u.current?.querySelector("[data-definition-add]"))?.focus(),h.current=null},[i,l]);let D=(q,j)=>{j.focus(),h.current=j,a(q)},M=(q)=>{if(e.readOnly)return;o(q);let j=wx(q);if(j.value!==void 0)S.current=JSON.stringify(j.value),e.onChange(j.value);let G={issues:j.issues,pendingChanges:j.pendingChanges};A.current=JSON.stringify(G),e.onStateChange(G)},H=i.rows.find((q)=>q.id===l),V=[...C.issues,...e.issues??[]];return Ht.jsxDEV("div",{ref:u,role:"group","aria-label":"Grouping definitions","aria-describedby":V.length?g:void 0,children:[Ht.jsxDEV("p",{...N(_t.intro),children:"Groups collect entries by exact frontmatter values. Removing a grouping or a listed value never rewrites entries. Values outside a list stay visible until an editor changes them."},void 0,!1,void 0,this),e.readOnly&&Ht.jsxDEV(ve,{children:"You can use these groupings. Only administrators can change their definitions."},void 0,!1,void 0,this),i.malformed?Ht.jsxDEV(Ht.Fragment,{children:[Ht.jsxDEV(ve,{tone:"error",children:"The stored groupings are not a mapping. Their source has not been discarded."},void 0,!1,void 0,this),Ht.jsxDEV("pre",{...N(_t.readOnly),children:JSON.stringify(i.malformed.value,null,2)},void 0,!1,void 0,this),!e.readOnly&&Ht.jsxDEV(we,{type:"button",variant:"outline",onClick:(q)=>D("reset",q.currentTarget),children:"Replace invalid definitions"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Ht.jsxDEV(Ht.Fragment,{children:[i.rows.length===0&&Ht.jsxDEV("section",{...N(_t.first),children:[Ht.jsxDEV("h2",{...N(Ir.title),children:"Your first grouping"},void 0,!1,void 0,this),Ht.jsxDEV("p",{...N(_t.intro),children:"Bring related entries together, of any content type, without moving them. Give a grouping a label and say whether an entry belongs to one value or several."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.rows.map((q)=>Ht.jsxDEV(GL,{row:q,usage:QL(e.usage,q.key),contributorTypes:e.contributorTypes,systemTypes:e.systemTypes,readOnly:e.readOnly,issues:V.filter((j)=>j.path[1]===q.key),allowedValuesName:`${p}-${q.id}-allowed`,onUpdate:(j)=>M(PL(i,q.id,j)),onRemove:(j)=>D(q.id,j)},q.id,!1,void 0,this)),!e.readOnly&&Ht.jsxDEV("div",{...N(_t.actions),children:[Ht.jsxDEV(we,{type:"button",variant:"outline","data-definition-add":"",disabled:i.rows.length>=Ga,onClick:()=>{f.current=i.nextId,M($L(i))},children:"Add grouping"},void 0,!1,void 0,this),Ht.jsxDEV("span",{...N(Wn.kind),children:[i.rows.length," / ",Ga]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),V.length>0&&Ht.jsxDEV("div",{id:g,children:Ht.jsxDEV(ve,{tone:"error",children:["Cannot save:"," ",V.map((q)=>{let j=q.path.slice(1).join(".");return j?`${j}: ${q.message}`:q.message}).join(" · ")]},void 0,!0,void 0,this)},void 0,!1,void 0,this),l!==null&&!e.readOnly&&Ht.jsxDEV(J5,{target:l,row:H,usage:H?QL(e.usage,H.key):void 0,titleId:p,onCancel:()=>a(null),onConfirm:()=>{M(l==="reset"?uy({}):jL(i,l)),a(null)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function J5(e){let{row:i,usage:o}=e,l=e.target==="reset",a=i&&Qn(i.value)&&typeof i.value.label==="string"?i.value.label:i?.key;return Ht.jsxDEV(yn,{mark:"−",title:l?"Replace invalid definitions?":`Remove ${a?.length?a:"unsaved"} grouping?`,titleId:e.titleId,cancelLabel:l?"Keep definitions":"Keep grouping",confirmLabel:l?"Replace definitions":"Remove grouping",confirmVariant:"danger",onCancel:e.onCancel,onConfirm:e.onConfirm,children:[Ht.jsxDEV("p",{children:[l?"This replaces the invalid definitions with an empty document when you save. ":o?o.entries===1?"1 entry carries this grouping and keeps its values. ":`${o.entries} entries carry this grouping and keep their values. `:"Usage is unavailable. Existing entries keep their values. ","No entries are deleted or moved. The change takes effect after saving."]},void 0,!0,void 0,this),!l&&Ht.jsxDEV("p",{children:"Re-adding the same key can collect those values again."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Bl=Y(he(),1);function XL(e){let{editor:i,schema:o,dispatch:l}=e,a=i.draft.groupings,u=i.mode.kind==="edit"?i.mode.entity.frontmatter.groupings:void 0,f=Qn(u)?Object.keys(u):[],h=o.issues.filter((M)=>{let H=M.path[1];if(typeof H==="string"&&Qn(a)&&Qn(u))return Object.hasOwn(a,H)&&JSON.stringify(a[H])===JSON.stringify(u[H]);return JSON.stringify(a)===JSON.stringify(u)}),p=h.length>0;Rh.useEffect(()=>{l({type:"compoundFieldStateChanged",field:"grouping-source",invalid:p,pendingChanges:!1})},[l,p]);let g=Kt(),y=Rh.useMemo(()=>(Qn(u)?Object.keys(u):[]).filter((M)=>YL.safeParse(M).success&&Qn(a)&&Object.hasOwn(a,M)).slice(0,Ga).map((M)=>{let H=Qn(a)&&Qn(a[M])?a[M]:void 0,V=Array.isArray(H?.values)?H.values.filter((q)=>typeof q==="string"):[];return{key:M,values:V}}),[a,u]),v=Rh.useMemo(()=>y.map(({key:M,values:H})=>ED(g,M,H)),[g,y]),S=cy({queries:v}),w=Object.fromEntries(y.flatMap(({key:M},H)=>{let V=S[H];return V?.isSuccess&&!V.isFetching?[[M,V.data]]:[]})),A=S.some((M)=>M.isFetching),C=S.some((M)=>fc(M.failureReason)),D=S.filter((M)=>M.isError&&!M.isFetching);return Bl.jsxDEV(Bl.Fragment,{children:[A&&Bl.jsxDEV(ve,{children:Bl.jsxDEV("span",{role:"status",children:C?"Groupings are initializing. Usage will load when ready.":"Loading grouping usage…"},void 0,!1,void 0,this)},void 0,!1,void 0,this),D.length>0&&Bl.jsxDEV(ve,{tone:"error",children:["Some grouping usage is unavailable. Counts are not assumed to be zero."," ",Bl.jsxDEV(we,{type:"button",variant:"outline",size:"sm",onClick:()=>{for(let M of D)M.refetch()},children:"Retry usage"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Bl.jsxDEV(WL,{value:a,savedKeys:f,contributorTypes:o.contributorTypes,systemTypes:o.systemTypes,readOnly:e.readOnly,usage:w,issues:h,onChange:(M)=>l({type:"fieldChanged",descriptor:{name:"groupings",label:"Groupings",widget:"object"},raw:M}),onStateChange:(M)=>l({type:"compoundFieldStateChanged",field:"groupings",pendingChanges:M.pendingChanges,invalid:M.issues.length>0})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var To=Y(ft(),1);var et=Y(he(),1),eI=new Set(["preferredTerms","preferred","avoid"]),tI=new Set(["description","purpose","positioning","summary","artDirection","composition"]);function nI(e){return e.widget==="string"&&tI.has(e.name)?{...e,widget:"text"}:e}function FL(e){let i=e.fields.filter((f)=>Mh(f,e.draft)&&(!e.readOnly||e.draft[f.name]!==void 0||f.required!==!1));if(i.length===0)return null;if(e.readOnly)return et.jsxDEV("div",{"data-studio-system-fields":"",...N(wt.root),children:[e.title&&et.jsxDEV("h2",{...N(wt.heading),children:e.title},void 0,!1,void 0,this),et.jsxDEV("dl",{...N(wt.profile),children:i.map((f)=>et.jsxDEV("div",{...N(wt.row),children:[et.jsxDEV("dt",{...N(wt.term),children:f.label},void 0,!1,void 0,this),et.jsxDEV("dd",{...N(wt.value),children:et.jsxDEV(fy,{vocabulary:e.vocabularies?.[f.name],literalStrings:e.literalFields?.includes(f.name),value:e.draft[f.name],fields:f.fields},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},f.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let o=i.filter((f)=>f.widget==="object"&&f.fields?.length),l=i.filter((f)=>!o.includes(f)&&f.name!=="visibility"),a=i.filter((f)=>f.name==="visibility"),u=(f)=>et.jsxDEV(KL,{vocabulary:e.vocabularies?.[f.name],literalList:e.literalFields?.includes(f.name),suggestions:e.suggestions?.[f.name],descriptor:f,value:e.draft[f.name],issues:e.issues,onChange:(h)=>e.onChange(f,h),children:e.renderAssist?.(f)},f.name,!1,void 0,this);return et.jsxDEV("div",{"data-studio-system-fields":"",...N(wt.root),children:[l.length>0&&et.jsxDEV(et.Fragment,{children:[e.title&&et.jsxDEV("h2",{...N(wt.heading),children:e.title},void 0,!1,void 0,this),et.jsxDEV("div",{"data-studio-system-grid":"",...N(wt.grid),children:l.map(u)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),o.map(u),a.length>0&&et.jsxDEV("section",{...N(wt.section),children:[et.jsxDEV("h2",{...N(wt.heading),children:"Access"},void 0,!1,void 0,this),et.jsxDEV("div",{"data-studio-system-grid":"",...N(wt.grid),children:a.map(u)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function KL(e){let i=nI(e.descriptor);if(i.widget==="object"&&i.fields?.length)return et.jsxDEV(oI,{...e},void 0,!1,void 0,this);if(i.widget==="list"&&i.fields?.length)return et.jsxDEV(iI,{...e},void 0,!1,void 0,this);return et.jsxDEV("div",{...N(wt.onlyField,(i.widget==="text"||i.widget==="list"&&!eI.has(i.name)||i.widget==="object"||i.widget==="image")&&wt.wide),"data-studio-field-assist":"",children:[et.jsxDEV(dy,{vocabulary:e.vocabulary,literalList:e.literalList,suggestions:e.suggestions,descriptor:i,value:e.value,issues:e.issues,onChange:e.onChange},void 0,!1,void 0,this),e.children]},void 0,!0,void 0,this)}function iI(e){let i=To.useMemo(()=>e.issues?.filter((a)=>a.path[0]===e.descriptor.name)??[],[e.issues,e.descriptor.name]),o=To.useRef(null),l=To.useId();return To.useEffect(()=>{let a=o.current;if(i.length&&a===a?.closest("form")?.querySelector("[data-studio-invalid-field]"))a?.focus()},[i]),et.jsxDEV("div",{ref:o,role:"group","aria-label":e.descriptor.label,tabIndex:-1,"data-studio-invalid-field":i.length?e.descriptor.name:void 0,"aria-describedby":i.length?l:void 0,...N(wt.wide),children:[et.jsxDEV("h2",{...N(wt.heading),children:e.descriptor.label},void 0,!1,void 0,this),et.jsxDEV(fy,{value:e.value,fields:e.descriptor.fields},void 0,!1,void 0,this),et.jsxDEV("p",{...N(wt.description),children:"Read-only structured field"},void 0,!1,void 0,this),i.length>0&&et.jsxDEV("div",{id:l,children:et.jsxDEV(ve,{tone:"error",children:i.map((a)=>a.message).join(" · ")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function oI(e){let{descriptor:i}=e,o=Qn(e.value)?e.value:{},l=i.fields??[],a=To.useMemo(()=>e.issues?.filter((g)=>g.path[0]===i.name).map((g)=>({...g,path:g.path.slice(1)})),[e.issues,i.name]),u=a?.filter((g)=>g.path.length===0)??[],f=To.useId(),h=To.useRef(null);To.useEffect(()=>{let g=h.current;if(g?.hasAttribute("data-studio-invalid-field")&&g===g.closest("form")?.querySelector("[data-studio-invalid-field]"))g.focus()},[a]);let p=Object.fromEntries(Object.entries(o).filter(([g])=>!l.some((y)=>y.name===g)));return et.jsxDEV("div",{ref:h,role:"group","aria-label":i.label,tabIndex:-1,"data-studio-invalid-field":u.length?i.name:void 0,"aria-describedby":u.length?f:void 0,...N(wt.section,wt.wide),children:[et.jsxDEV("h2",{...N(wt.heading),children:i.label},void 0,!1,void 0,this),u.length>0&&et.jsxDEV("div",{id:f,children:et.jsxDEV(ve,{tone:"error",children:u.map((g)=>g.message).join(" · ")},void 0,!1,void 0,this)},void 0,!1,void 0,this),et.jsxDEV("div",{"data-studio-system-grid":"",...N(wt.grid),children:l.filter((g)=>Mh(g,o)).map((g)=>et.jsxDEV(KL,{descriptor:i.required===!1&&e.value===void 0?{...g,required:!1}:g,value:o[g.name],issues:a,onChange:(y)=>e.onChange(CS(o,g,y))},g.name,!1,void 0,this))},void 0,!1,void 0,this),Object.keys(p).length>0&&et.jsxDEV(fy,{value:p},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Eo=Y(he(),1);function JL(e){let{editor:i,dispatchEditor:o,fieldAssistState:l}=e,{mode:a,draft:u,body:f}=i,{entitySchema:h,presentation:p,selectedEntityType:g,groupingFields:y,groupingVocabularies:v,systemDesign:S,canEdit:w,canAssist:A,fieldIssues:C}=e.model,D=ac(g,a),M=$c(h,p),H=A&&h.hasBody&&f.trim().length>0,V=(G)=>H&&!v[G.name]?.values?Eo.jsxDEV(ZL,{descriptor:G,state:l,onRun:e.runFieldAssist,onApply:e.applyFieldAssist,onDiscard:()=>e.setFieldAssistState({kind:"idle"})},void 0,!1,void 0,this):null,q=(G,se)=>o({type:"fieldChanged",descriptor:G,raw:se}),j=g===Nl;return Eo.jsxDEV("fieldset",{className:re("",Gn.fields),disabled:!w,children:[S?Eo.jsxDEV(Eo.Fragment,{children:[j&&(h.groupingDefinitions?Eo.jsxDEV(XL,{editor:i,schema:h.groupingDefinitions,readOnly:!w,dispatch:o},void 0,!1,void 0,this):Eo.jsxDEV(ve,{tone:"error",children:"Grouping definitions are unavailable. Reload before editing."},void 0,!1,void 0,this)),Eo.jsxDEV(FL,{vocabularies:v,literalFields:y,suggestions:e.groupingSuggestions,fields:j?h.fields.filter((G)=>G.name!=="groupings"):h.fields,draft:u,title:p==="document"?"":S.fieldsTitle,readOnly:!w,issues:C,onChange:q,renderAssist:V},void 0,!1,void 0,this)]},void 0,!0,void 0,this):h.fields.filter((G)=>Mh(G,u)).filter((G)=>G!==M).map((G)=>Eo.jsxDEV("div",{"data-studio-field-assist":"",children:[Eo.jsxDEV(dy,{readOnly:!w||G.name==="status"&&e.model.publicationWorkspace!==void 0,vocabulary:v[G.name],literalList:y.includes(G.name),suggestions:e.groupingSuggestions?.[G.name],descriptor:G,issues:C,value:u[G.name],onChange:(se)=>q(G,se)},void 0,!1,void 0,this),V(G)]},`${D}:${G.name}`,!0,void 0,this)),h.format==="raw"&&Eo.jsxDEV(ve,{children:"This type is raw markdown — the whole document is the body."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Ur=Y(he(),1),sI=["details","write","preview"],ez={details:"Properties",write:"Source",preview:"Preview"},lI={write:"source",preview:"preview"};function tz(e){return Ur.jsxDEV("div",{className:re("studio-mobile-tabs",mn.mobileModes),children:Ur.jsxDEV(hy,{children:[Ur.jsxDEV(py,{asChild:!0,children:Ur.jsxDEV("button",{type:"button","aria-label":"Editor view",className:re("",mn.paneTrigger,Vn.eyebrow),children:[ez[e.pane],Ur.jsxDEV("span",{"aria-hidden":"true",children:"⌄"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Ur.jsxDEV(my,{align:"start",children:sI.map((i)=>Ur.jsxDEV(gy,{disabled:i!=="details"&&!e.hasBody,onSelect:()=>{e.onPane(i);let o=lI[i];if(o)e.onBodyMode(o)},children:ez[i]},i,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var nz=Y(he(),1);function yy(e){return nz.jsxDEV(we,{type:"button",variant:"ghost",xstyle:e.placement==="head"?jc.toggleHead:jc.toggleBar,"data-studio-ask-toggle":e.placement,"aria-pressed":e.ask.open,"aria-keyshortcuts":"Control+j Meta+j",title:"Ask about this entry (Ctrl+J or ⌘J)",onClick:()=>e.ask.setOpen(!e.ask.open),children:"Ask"},void 0,!1,void 0,this)}function Vc(e){return{entity:e,draft:{...e.frontmatter},body:e.body}}var gi=Y(ft(),1);var Gc={versions:{k1xSpc:"xrvj5dj",kumcoG:"xcjjqqt",kOIVth:"xou54vl",k1JLwA:"x4jmfmw",$$css:!0},version:{kzqmXN:"xh8yej3",k7Eaqz:"xeuugli",kZKoxP:"x1isuwpm",kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kMwMTN:"xqvuw85",kWkggS:"x18s3upu",kmVPX3:"xc7ga6q",$$css:!0},actions:{k1xSpc:"x78zum5",kwnvtZ:"x1a02dak",kOIVth:"x167g77z",keoZOQ:"x14vqqas",$$css:!0}};var bt=Y(he(),1);function iz(e,i){return JSON.stringify({frontmatter:e,body:i},null,2)}function oz(e){let i=Kt(),[o,l]=gi.useState(!1),[a,u]=gi.useState(null),[f,h]=gi.useState(!1),[p,g]=gi.useState(null),[y,v]=gi.useState(!1),[S,w]=gi.useState(!1),[A,C]=gi.useState(!1),[D,M]=gi.useState(!1),{conflictId:H}=e,V=async(He)=>{if(H===void 0)return;M(!0),g(null);try{await i.resolveConflict(H,He);let U=await i.fetchEntity(e.entity.entityType,e.entity.id);w(!1),C(!1),l(!1),e.onUseLatest(U)}catch(U){w(!1),C(!1),g($d(U,"The conflict could not be resolved")||"The conflict could not be resolved")}finally{M(!1)}},q=gi.useRef(0),j=gi.useRef(null);gi.useEffect(()=>()=>{q.current+=1},[]);let G=iz(e.draft,e.body);gi.useEffect(()=>v(!1),[G]);let se=async()=>{v(!1);try{await navigator.clipboard.writeText(G),v(!0)}catch{g("Copy unavailable. Select Your version manually."),l(!0)}},ce=async()=>{let He=++q.current;h(!0),u(null),g(null);try{let U=await i.fetchEntity(e.entity.entityType,e.entity.id);if(q.current===He)u(U)}catch(U){if(q.current===He)g($d(U,"Latest version could not be loaded")||"Latest version could not be loaded")}finally{if(q.current===He)h(!1)}};return bt.jsxDEV(bt.Fragment,{children:[bt.jsxDEV("div",{...N(Gc.actions),children:[bt.jsxDEV("span",{ref:j,children:bt.jsxDEV(we,{type:"button",variant:"ghost",onClick:()=>{l(!0),ce()},children:"Compare changes"},void 0,!1,void 0,this)},void 0,!1,void 0,this),bt.jsxDEV(we,{type:"button",variant:"ghost",onClick:()=>void se(),children:"Copy my version"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y&&bt.jsxDEV(ve,{children:"Version copied, including properties and body."},void 0,!1,void 0,this),bt.jsxDEV(Qc,{open:o,onOpenChange:(He)=>{if(l(He),!He)w(!1),q.current+=1,h(!1)},children:bt.jsxDEV(Wc,{"aria-describedby":"conflict-comparison-description",onCloseAutoFocus:(He)=>{He.preventDefault(),j.current?.querySelector("button")?.focus()},children:[bt.jsxDEV(Yc,{children:"Compare changes"},void 0,!1,void 0,this),bt.jsxDEV("p",{id:"conflict-comparison-description",children:"Your draft is unchanged. Review both versions before choosing to replace it."},void 0,!1,void 0,this),H!==void 0&&bt.jsxDEV("p",{children:"Your version is also kept in the Inbox as a conflict, so it is not lost if you close this page."},void 0,!1,void 0,this),p&&bt.jsxDEV(ve,{tone:"error",children:p},void 0,!1,void 0,this),bt.jsxDEV("div",{...N(Gc.versions),children:[bt.jsxDEV("label",{children:["Your version",bt.jsxDEV("textarea",{...N(Gc.version),readOnly:!0,value:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this),bt.jsxDEV("label",{children:["Latest saved version",bt.jsxDEV("textarea",{...N(Gc.version),readOnly:!0,value:a?iz(a.frontmatter,a.body):"Not loaded"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),bt.jsxDEV("div",{...N(Gc.actions),children:[bt.jsxDEV(we,{type:"button",variant:"ghost",disabled:f,onClick:()=>void ce(),children:f?"Loading latest…":"Retry latest"},void 0,!1,void 0,this),bt.jsxDEV(we,{type:"button",variant:"ghost",onClick:()=>l(!1),children:"Keep editing my version"},void 0,!1,void 0,this),H!==void 0&&bt.jsxDEV(we,{type:"button",variant:"ghost",disabled:!a||f||D,onClick:()=>C(!0),children:"Save my version"},void 0,!1,void 0,this),bt.jsxDEV(we,{type:"button",disabled:!a||f||p!==null,onClick:()=>w(!0),children:"Use latest version"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),S&&a&&bt.jsxDEV(yn,{title:"Replace your local draft?",titleId:"replace-conflicted-draft",mark:"↩",cancelLabel:"Keep my draft",confirmLabel:"Replace with latest",onCancel:()=>w(!1),onConfirm:()=>{if(H!==void 0){V("keep-current");return}e.onUseLatest(a),w(!1),l(!1)},children:bt.jsxDEV("p",{children:"This discards your local edits. Copy your version first if you want to keep it. Nothing is written to the server."},void 0,!1,void 0,this)},void 0,!1,void 0,this),A&&a&&bt.jsxDEV(yn,{title:"Save your version over the latest?",titleId:"apply-kept-version",mark:"↑",cancelLabel:"Not now",confirmLabel:"Save over latest",onCancel:()=>C(!1),onConfirm:()=>void V("apply"),children:bt.jsxDEV("p",{children:"This replaces the latest saved version with the version you tried to save. The latest version's changes are overwritten."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var es=Y(he(),1);function sz(e){let{editor:i,syncStatus:o,hasUnsavedChanges:l,dispatchEditor:a}=e,{mode:u,draft:f,body:h,save:p}=i,{entitySchema:g,presentation:y,canEdit:v}=e.model,S=v||y==="split"?ly(i,e.model,l):void 0;return es.jsxDEV("footer",{className:re("",mn.pipeline,Gn.pipeline),"data-studio-save-bar":"",children:[es.jsxDEV("div",{children:[es.jsxDEV("span",{"data-studio-save-state":"",className:re("",Gn.saveState),children:[es.jsxDEV("span",{role:"status","aria-live":"polite",title:"Saved means stored in this Brain. File export and Git synchronization are separate.",children:!v&&y!=="split"?"Read-only":a2(p,l,u.kind!=="create"?"edit":g.isSingleton?"first-save":"create")},void 0,!1,void 0,this),S&&es.jsxDEV("span",{id:sy,children:S},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.readError&&es.jsxDEV(ve,{tone:"error",children:["Your draft is unchanged. ",e.readError,es.jsxDEV(we,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),es.jsxDEV(r2,{state:o?.directorySync&&p.kind==="saved"&&!p.noop?{kind:"idle"}:p,conflictActions:u.kind==="edit"?es.jsxDEV(oz,{entity:u.entity,draft:f,body:h,...p.kind==="conflict"&&p.conflictId!==void 0&&{conflictId:p.conflictId},onUseLatest:(w)=>a({type:"documentOpened",document:Vc(w)})},`${u.entity.entityType}:${u.entity.id}`,!1,void 0,this):void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.ask&&u.kind==="edit"&&e.model.canAssist&&es.jsxDEV(yy,{ask:e.ask,placement:"bar"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var by={section:{keoZOQ:"x1tfhste",kLKAdn:"x1cnzs8",kg3NbH:"xr244g7",$$css:!0},head:{k1xSpc:"x78zum5",kGNEyG:"x1pha0wt",kOIVth:"x1v2ro7d",k1K539:"x1e56ztr",$$css:!0},count:{kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",kMwMTN:"x1ar3pfp",$$css:!0}};var Vs=Y(he(),1);function rI(e){let{page:i}=e;return Vs.jsxDEV("section",{"data-studio-collection-members":"","aria-labelledby":"studio-collection-members",className:re("",by.section),children:[Vs.jsxDEV("div",{className:re("",by.head),children:[Vs.jsxDEV("h2",{id:"studio-collection-members",className:re("",Vn.eyebrow),children:"Members"},void 0,!1,void 0,this),Vs.jsxDEV("span",{className:re("",by.count),children:i.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.entities.map((o,l)=>Vs.jsxDEV("a",{href:$n(Hs(),o.entityType,o.id),"data-studio-record":"",className:re("",Ae.row,Ae.recordLink,mn.listingRow),onClick:(a)=>{if(!kl(a))return;a.preventDefault(),e.onOpen(o.id,o.entityType)},children:[Vs.jsxDEV("span",{className:re("",Ae.index),children:String(l+1).padStart(2,"0")},void 0,!1,void 0,this),Vs.jsxDEV("span",{className:re("",Ae.title),title:o.id,children:Ri(o,o.path?.at(-1))},void 0,!1,void 0,this),Vs.jsxDEV("time",{className:re("",Ae.updated),dateTime:o.updated,children:za(o.updated)},void 0,!1,void 0,this)]},JSON.stringify([o.entityType,o.id]),!0,void 0,this))]},void 0,!0,void 0,this)}function lz(e){let i=Kt(),{data:o}=fn({queryKey:["studio","collection-members",e.entityType,e.entityId],queryFn:()=>i.fetchCollectionMembers(e.entityType,e.entityId)});return o?Vs.jsxDEV(rI,{page:o,onOpen:e.onOpen},void 0,!1,void 0,this):null}var vy=Y(ft(),1),Cx=(e)=>`studio.inspector.${e}`;function rz(e){try{return window.localStorage.getItem(Cx(e))==="hidden"}catch{return!1}}function az(e){let[i,o]=vy.useState(()=>({entityType:e,hidden:rz(e)})),l=i.entityType===e?i:{entityType:e,hidden:rz(e)};if(l!==i)o(l);let a=vy.useCallback((u)=>{o({entityType:e,hidden:u});try{if(u)window.localStorage.setItem(Cx(e),"hidden");else window.localStorage.removeItem(Cx(e))}catch{}},[e]);return[l.hidden,a]}var xy=Y(ft(),1);var uz={list:{k1xSpc:"xrvj5dj",kumcoG:"xrwz996",kOIVth:"xfe5i6u",kogj98:"x1ghz6dp",$$css:!0},keys:{kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kMwMTN:"x1ar3pfp",$$css:!0},row:{k1xSpc:"xjp7ctv",$$css:!0},action:{kogj98:"x1ghz6dp",$$css:!0}};var Gs=Y(he(),1),aI=[["Ctrl+S or ⌘S","Save changes"],["Ctrl+\\ or ⌘\\","Show or hide Details"],["Ctrl+K or ⌘K","Search or do anything"],["?","Show these shortcuts"]],Sy=uz;function uI(e){return e instanceof HTMLElement&&(e.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(e.tagName))}function dz(){let[e,i]=xy.useState(!1);return xy.useEffect(()=>{let o=(l)=>{if(l.key!=="?"||uI(l.target))return;l.preventDefault(),i(!0)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[]),Gs.jsxDEV(Qc,{open:e,onOpenChange:i,children:Gs.jsxDEV(Wc,{children:[Gs.jsxDEV(cz,{children:[Gs.jsxDEV(Yc,{children:"Keyboard shortcuts"},void 0,!1,void 0,this),Gs.jsxDEV(fz,{children:"While an entry is open."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Gs.jsxDEV("dl",{...N(Sy.list),children:aI.map(([o,l])=>Gs.jsxDEV("div",{...N(Sy.row),children:[Gs.jsxDEV("dt",{...N(Sy.keys),children:o},void 0,!1,void 0,this),Gs.jsxDEV("dd",{...N(Sy.action),children:l},void 0,!1,void 0,this)]},l,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var _r=Y(he(),1);function pz(e){return _r.jsxDEV(hy,{children:[_r.jsxDEV(py,{className:hz("ghost","icon"),"aria-label":"More document actions",children:"•••"},void 0,!1,void 0,this),_r.jsxDEV(my,{align:"end",children:_r.jsxDEV(gy,{variant:"destructive",onSelect:e.onDelete,children:"Delete entry"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function mz(e){let{syncStatus:i}=e;if(!i?.directorySync)return null;return _r.jsxDEV("details",{"data-studio-sync-details":"",children:[_r.jsxDEV("summary",{children:"Sync details"},void 0,!1,void 0,this),_r.jsxDEV(u2,{view:hg({save:e.editor.save,git:i.git,baselineCommit:e.baselineCommit}),gitConfigured:i.git!==null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Pe=Y(he(),1);function Ax(e){let{editor:i,bodyMode:o,mobilePane:l,hasUnsavedChanges:a,dispatchEditor:u,setBodyMode:f,setMobilePane:h,backToList:p,performPublishingAction:g,save:y}=e,{mode:v,body:S,save:w}=i,{entitySchema:A,presentation:C,selectedEntityType:D,systemDesign:M,canEdit:H,namedCreate:V,fieldIssues:q,hierarchyKind:j,canPublish:G,canAssist:se,collectionLabel:ce,publicationWorkspace:He,publicationState:U,editorHead:pe}=e.model,ye=Sx(i,e.model,a),ae=ly(i,e.model,a),vt=v.kind==="create"&&!A.isSingleton,W=C==="split",[oe,ee]=az(D),fe=e.ask?.open===!0&&v.kind==="edit"&&se,me=oe||fe,Ye=(Oe)=>{if(!Oe&&fe)e.ask?.setOpen(!1);ee(Oe)},Le=H?$c(A,C):void 0,dt=typeof i.draft.title==="string"?i.draft.title:"",tt=Le?Pe.jsxDEV(HL,{descriptor:Le,value:dt,placeholder:`Untitled ${e.model.entryLabel.toLowerCase()}`,issues:q,onChange:(Oe)=>u({type:"fieldChanged",descriptor:Le,raw:Oe})},void 0,!1,void 0,this):void 0;function Ie(Oe){let Xn=Oe.currentTarget.querySelector("input:invalid, select:invalid, textarea:invalid");if(Xn&&!Xn.closest("[data-studio-properties]"))return;UL(Oe.currentTarget);let Ro=W&&me;if(l==="details"&&!Ro)return;Oe.preventDefault();let os=Oe.currentTarget.querySelector("input:invalid, select:invalid, textarea:invalid");if(Oe.target!==os)return;if(h("details"),Ro)Ye(!1);requestAnimationFrame(()=>{if(os.isConnected)os.focus(),os.reportValidity()})}let Yt=wy.useRef(null);wy.useEffect(()=>(document.addEventListener("keydown",Sn),()=>document.removeEventListener("keydown",Sn)));function Sn(Oe){if(W&&(Oe.ctrlKey||Oe.metaKey)&&!Oe.altKey&&!Oe.shiftKey&&Oe.key==="\\"){Oe.preventDefault(),Ye(!me);return}if(!(Oe.ctrlKey||Oe.metaKey)||Oe.altKey||Oe.shiftKey||Oe.key.toLowerCase()!=="s")return;if(Oe.target instanceof HTMLElement&&Oe.target.closest('[role="dialog"], [role="alertdialog"]'))return;if(Oe.preventDefault(),!ye)Yt.current?.requestSubmit()}return Pe.jsxDEV("form",{role:"main","aria-label":"Document editor",className:re("",Gn.editor,C!=="split"&&Ps.editor),"data-studio-editor":"","data-editor-presentation":C,"data-mobile-pane":C==="split"?l:void 0,"data-inspector":W?me?"hidden":"shown":void 0,onInvalidCapture:Ie,onSubmit:(Oe)=>{if(Oe.preventDefault(),!ye)y()},ref:Yt,children:Pe.jsxDEV(gz,{value:w.kind==="error"?"save":"check",children:[Pe.jsxDEV(Is,{model:pe,appearance:"document",titleEditor:tt,navigation:!A.isSingleton?Pe.jsxDEV(we,{type:"button",variant:"ghost",onClick:p,"aria-label":`Back to ${e.groupReturnLabel??ce}`,children:[Pe.jsxDEV("span",{"aria-hidden":"true",children:"←"},void 0,!1,void 0,this)," Back to"," ",e.groupReturnLabel??ce]},void 0,!0,void 0,this):void 0,action:H||C==="split"?Pe.jsxDEV(Pe.Fragment,{children:[e.ask&&v.kind==="edit"&&se&&Pe.jsxDEV(yy,{ask:e.ask,placement:"head"},void 0,!1,void 0,this),W&&Pe.jsxDEV(we,{type:"button",variant:"ghost",className:"studio-inspector-toggle",xstyle:Gn.inspectorToggle,"aria-pressed":!me,"aria-keyshortcuts":"Control+Backslash Meta+Backslash",title:"Details (Ctrl+\\\\ or ⌘\\\\)",onClick:()=>Ye(!me),children:"Details"},void 0,!1,void 0,this),Pe.jsxDEV(we,{type:"submit",className:"studio-editor-head-save",variant:a?"default":"outline",title:`${vt?"Create":"Save changes"} (Ctrl+S or ⌘S)`,"aria-keyshortcuts":"Control+s Meta+s",disabled:ye,...ae&&{"aria-describedby":sy},children:w.kind==="saving"?vt?"Creating…":"Saving…":vt?"Create":"Save changes"},void 0,!1,void 0,this),v.kind==="edit"&&!A.isSingleton&&e.model.canDelete&&Pe.jsxDEV(pz,{onDelete:()=>u({type:"deleteRequested"})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):void 0},void 0,!1,void 0,this),e.draftRecovery?.offer&&Pe.jsxDEV("div",{"data-studio-draft-offer":"",children:Pe.jsxDEV(ve,{className:re("",li.inset),children:["Unsaved changes from"," ",Pe.jsxDEV("time",{dateTime:new Date(e.draftRecovery.offer.savedAt).toISOString(),children:new Date(e.draftRecovery.offer.savedAt).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})},void 0,!1,void 0,this)," ","were kept in this browser."," ",Pe.jsxDEV(we,{type:"button",variant:"outline",onClick:e.draftRecovery.restore,children:"Restore"},void 0,!1,void 0,this)," ",Pe.jsxDEV(we,{type:"button",variant:"ghost",onClick:e.draftRecovery.discard,children:"Discard"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Pe.jsxDEV(yz,{active:V,split:C==="split",children:[v.kind==="create"&&V&&Pe.jsxDEV("div",{className:re("",li.inset,ts.destinationFrame),children:[Pe.jsxDEV(ky,{kind:j,collectionLabel:ce,collectionPath:e.collectionPath,query:{...e.collectionQuery,prefix:v.prefix??null},onNavigate:e.selectFolder,fixed:!0},void 0,!1,void 0,this),Pe.jsxDEV(bz,{kind:j,segment:v.segment??"",followsTitle:Le!==void 0&&v.segmentFollowsTitle===!0,onSegmentChange:(Oe)=>u({type:"segmentChanged",segment:Oe}),preview:e.creationDestination.data,pending:e.creationDestination.pending,error:e.creationDestination.error,issues:w.kind==="error"?w.issues:void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C==="split"&&Pe.jsxDEV(tz,{pane:l,hasBody:A.hasBody,onPane:h,onBodyMode:f},void 0,!1,void 0,this),Pe.jsxDEV(_L,{presentation:C,children:[M&&Pe.jsxDEV("p",{"data-studio-system-intro":"",...N(wt.intro),children:M.intro},void 0,!1,void 0,this),Pe.jsxDEV(qL,{presentation:C,hidden:W&&me,summaryDescription:M?A.fields.slice(0,3).map((Oe)=>Oe.label).join(" · "):void 0,reveal:C==="document"&&!i.body.trim()||(q?.length??0)>0,children:[C!=="document"&&!M&&Pe.jsxDEV("div",{className:re("",mn.propertiesHead),children:[Pe.jsxDEV("h2",{className:re("",mn.propertiesLabel,Vn.eyebrow),children:"Properties"},void 0,!1,void 0,this),v.kind==="create"||U?Pe.jsxDEV("span",{className:re("",mn.propertiesLabel,Vn.eyebrow),children:v.kind==="create"?"New":U},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),Pe.jsxDEV(JL,{...e},void 0,!1,void 0,this),Pe.jsxDEV(mz,{syncStatus:e.syncStatus,baselineCommit:e.baselineCommit,editor:i},void 0,!1,void 0,this),He&&v.kind==="edit"&&G&&Pe.jsxDEV(IL,{entityType:D,entityId:v.entity.id,title:Ri(v.entity),missing:(e.model.activeType?.publishRequires??[]).filter((Oe)=>{let Xn=v.entity.frontmatter[Oe];return Xn===void 0||Xn===null||typeof Xn==="string"&&Xn.trim()===""}),status:typeof v.entity.frontmatter.status==="string"?v.entity.frontmatter.status:"draft",unsaved:a,onAction:g},void 0,!1,void 0,this)]},ac(D,v),!0,void 0,this),A.hasBody&&Pe.jsxDEV("section",{className:re("",Gn.manuscript,C!=="split"&&Ps.manuscript),children:[M&&Pe.jsxDEV("header",{...N(wt.bodyHeading),children:[Pe.jsxDEV("h2",{...N(Vn.secondaryDisplay),children:M.bodyTitle},void 0,!1,void 0,this),Pe.jsxDEV("p",{...N(wt.description),children:M.bodyDescription},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Pe.jsxDEV(NL,{value:S,mode:o,singlePane:C!=="split",onChange:(Oe)=>u({type:"bodyChanged",body:Oe}),onModeChange:f,readOnly:!H,documentTitle:Le?dt:pe.title,onSelectionChange:e.ask?.setSelection},void 0,!1,void 0,this),v.kind==="edit"&&e.model.activeType?.collection&&Pe.jsxDEV(lz,{entityType:D,entityId:v.entity.id,onOpen:e.openEntity},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Pe.jsxDEV(sz,{...e},void 0,!1,void 0,this),Pe.jsxDEV(dz,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var Cy=Y(ft(),1),Tx="studio.density";function cI(){try{return window.localStorage.getItem(Tx)==="compact"?"compact":"comfortable"}catch{return"comfortable"}}function fI(e){try{if(e==="compact")window.localStorage.setItem(Tx,e);else window.localStorage.removeItem(Tx)}catch{}}function vz(){let[e,i]=Cy.useState(cI),o=Cy.useCallback((l)=>{i(l),fI(l)},[]);return[e,o]}var De=Y(he(),1);function Dz(e){let{entities:i,entityOffset:o,entityLimit:l,entityTotal:a,entityListLoading:u,schema:f,changeEntityPage:h,startCreate:p}=e,{activeType:g,entitySchema:y,systemDesign:v,canCreate:S,hierarchyKind:w,folderContext:A,collectionLabel:C,entryLabel:D,pageEnd:M,collectionFiltered:H,listingHead:V}=e.model,q=WD({activeType:g,entityType:e.entityType,entities:i,entityOffset:o,entryLabel:D,collectionLabel:C,onConfirmed:e.onRefineConfirmed}),j=q.picked.length>0,[G,se]=vz(),ce=y.fields.some((ae)=>ae.column==="excerpt"||ae.column==="cover"),He=ce&&G==="compact",U=!He&&(i??[]).some((ae)=>Dx(ae,y.fields)),pe=PD(q.picked.length,D,C),ye=g?.refinesInto;return De.jsxDEV("main",{className:re("",Ae.listing,li.inset,(S||j)&&ts.withMobileBar),"data-studio-library":"","aria-busy":u,onKeyDown:(ae)=>{if(ae.key==="Escape"&&j&&!q.asking)q.clear()},children:[e.readError&&De.jsxDEV(ve,{tone:"error",children:[i?.length?"Showing previously loaded entries. ":"",e.readError,De.jsxDEV(we,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),De.jsxDEV(Is,{model:j?{...V,metadata:[$D(q.picked.length,a)]}:V,action:j?De.jsxDEV(De.Fragment,{children:[De.jsxDEV(we,{type:"button",variant:"ghost",xstyle:ts.desktopCreateAction,onClick:q.clear,children:"Cancel"},void 0,!1,void 0,this),De.jsxDEV(we,{type:"button","data-studio-library-refine":"",xstyle:ts.desktopCreateAction,onClick:q.ask,children:pe},void 0,!1,void 0,this)]},void 0,!0,void 0,this):(!v||S)&&De.jsxDEV(we,{type:"button",disabled:!S||!f,"data-studio-library-new":"",xstyle:ts.desktopCreateAction,onClick:p,children:["New ",no(D)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),De.jsxDEV(XD,{notice:e.refineNotice??null},void 0,!1,void 0,this),q.refusal&&De.jsxDEV(ve,{tone:"error",children:q.refusal},void 0,!1,void 0,this),v&&De.jsxDEV("p",{"data-studio-system-intro":"",...N(wt.collectionIntro),children:v.intro},void 0,!1,void 0,this),De.jsxDEV(ky,{kind:w,collectionLabel:C,collectionPath:e.collectionPath,query:e.collectionQuery,trail:e.collectionTrail,onNavigate:e.selectFolder},void 0,!1,void 0,this),!y.isSingleton&&De.jsxDEV(Az,{kind:w,query:e.collectionQuery,fields:y.fields,total:a,onChange:e.onCollectionQueryChange,...ce&&{density:G,onDensityChange:se}},void 0,!1,void 0,this),!u&&De.jsxDEV(Ez,{kind:w,folders:e.folders,collectionPath:e.collectionPath,query:e.collectionQuery,onNavigate:e.selectFolder},void 0,!1,void 0,this),e.folders.length>0&&a>0&&De.jsxDEV("div",{className:re("",ts.label),children:[De.jsxDEV("span",{children:"Entries here"},void 0,!1,void 0,this),De.jsxDEV("span",{children:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!y.isSingleton&&a>0&&De.jsxDEV(rg,{label:`${g?.label??"Entity"} pagination`,offset:o,count:Math.max(0,M-o),total:a,loading:u,hasNext:o+l<a,onPrevious:()=>h(Math.max(0,o-l)),onNext:()=>h(o+l)},void 0,!1,void 0,this),u&&De.jsxDEV(ve,{className:re("",Ae.empty),children:"Loading entries…"},void 0,!1,void 0,this),!u&&(i??[]).map((ae,vt)=>De.jsxDEV(dI,{entity:ae,index:String(o+vt+1).padStart(2,"0"),view:e,refine:q,picking:j,compact:He,covers:U},ae.id,!1,void 0,this)),!e.readError&&!u&&i?.length===0&&e.folders.length===0&&De.jsxDEV(ve,{className:re("",Ae.empty),children:[e.collectionQuery.q||e.collectionQuery.status||e.collectionQuery.visibility!=="all"?"No entries match these filters. Clear or change the filters to try again.":S?"Nothing here yet — start the first entry.":"No entries are available in this collection.",H&&e.collectionQuery.prefix&&e.collectionQuery.scope==="folder"&&De.jsxDEV(we,{type:"button",variant:"ghost",onClick:()=>e.onCollectionQueryChange({...e.collectionQuery,scope:"collection",offset:0}),children:"Search whole collection"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j?De.jsxDEV("div",{"data-studio-refine-action":!0,className:re("",ts.mobileBar),children:[De.jsxDEV(we,{type:"button",variant:"ghost",onClick:q.clear,children:"Cancel"},void 0,!1,void 0,this),De.jsxDEV(we,{type:"button",onClick:q.ask,children:pe},void 0,!1,void 0,this)]},void 0,!0,void 0,this):S&&De.jsxDEV("div",{"data-studio-folder-action":!0,className:re("",ts.mobileBar),children:[De.jsxDEV("span",{children:["Creating in ",De.jsxDEV("strong",{children:A},void 0,!1,void 0,this)]},void 0,!0,void 0,this),De.jsxDEV(we,{type:"button",onClick:p,disabled:!f,children:["New ",no(D)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.asking&&e.entityType&&ye&&De.jsxDEV(FD,{entityType:e.entityType,entryLabel:D,collectionLabel:C,targetLabel:ye.label,picked:(i??[]).filter(({id:ae})=>q.picked.includes(ae)),onCancel:q.closeAsk,onRefused:q.refused,onConfirmed:(ae)=>{q.confirmed(ae),e.selectEntityType(ye.entityType)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function dI(e){let{entity:i,view:o,refine:l}=e,{systemDesign:a,entitySchema:u}=o.model,f=o.collectionQuery,h=Ri(i,i.path?.at(-1)),p=wz(i),g=Sz(i,u.fields),y=kz(i,u.fields),v=e.compact?null:xz(i,u.fields),S=e.covers,w=Dx(i,u.fields),A=S&&De.jsxDEV("span",{"data-studio-row-cover":"","aria-hidden":"true",...N(Ae.cover),children:w&&De.jsxDEV(ug,{imageId:w,thumbnailWidth:ag,alt:"",placeholder:De.jsxDEV("span",{...N(Ae.coverPending)},void 0,!1,void 0,this),...N(Ae.coverImage)},void 0,!1,void 0,this)},void 0,!1,void 0,this),C=()=>o.openEntity(i.id,i.entityType),D=$n(Hs(),i.entityType,i.id),M=(V)=>{if(!kl(V))return;V.preventDefault(),C()},H=De.jsxDEV("span",{className:re("",Ae.title),title:i.id,children:[h,(f.q||f.scope==="collection")&&i.path&&i.path.length>1&&De.jsxDEV("span",{className:re("",ts.context),children:i.path.slice(0,-1).map(Tz).join(" / ")},void 0,!1,void 0,this),v&&De.jsxDEV("span",{"data-studio-row-excerpt":"",...N(Ae.excerpt),children:v},void 0,!1,void 0,this),g&&De.jsxDEV("span",{className:re("studio-publication-state",mn.publication,e.compact&&Ae.inlineStatus),children:Cz(g)},void 0,!1,void 0,this),p&&De.jsxDEV("span",{"data-studio-generation":p,className:re("",mn.publication),children:p},void 0,!1,void 0,this),i.members&&De.jsxDEV("span",{"data-studio-row-members":"",className:re("",Ae.members),children:i.members.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(l.available&&!a){let V=l.picked.includes(i.id);return De.jsxDEV("div",{"data-studio-row":"",...e.picking&&{"data-picking":""},className:re("",Ae.row,mn.listingRow,Pn.row,S&&Ae.covered,e.compact&&Ae.compact,V&&Pn.rowPicked),children:[De.jsxDEV(YD,{index:e.index,title:h,picked:V,onToggle:()=>l.toggle(i.id)},void 0,!1,void 0,this),De.jsxDEV("a",{href:D,"data-studio-record":"",...N(Pn.open),onClick:M,children:[A,H,De.jsxDEV("time",{className:re("",Ae.updated,Pn.updated),dateTime:y.iso,title:y.iso,children:Ex(y)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}return De.jsxDEV("a",{href:D,className:re("",Ae.row,Ae.recordLink,mn.listingRow,S&&Ae.covered,e.compact&&Ae.compact),"data-studio-record":"",onClick:M,children:[De.jsxDEV("span",{className:re("",Ae.index),children:e.index},void 0,!1,void 0,this),A,H,De.jsxDEV("time",{className:re("",Ae.updated),dateTime:y.iso,title:y.iso,children:Ex(y)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var hI={surface:{kzqmXN:"xh8yej3",kB7OPa:"x9f619",k7Eaqz:"xeuugli",kAzted:"x2lwn1j",kGO01o:"x1sgudl8",kORKVm:"x1odjw0f",kh9fTk:"x1c54s19",kKq9zD:"xiqhxos",k4sGnE:"x11u2ate",kzrhLs:"x14214pg","--operator-section-spacing":"xn0jjtu","--operator-section-transform":"x6lesxo",$$css:!0}};function Rx(e){return`${e} ${N(hI.surface,li.inset,Vn.operatorRoles).className??""}`}var Mx=Y(ft(),1);function pI(e){return Mx.createElement(Rz,{...e,children:Mx.createElement("div",N(Ae.readable),e.children)})}var Ox={engine:"app",density:"comfortable",Button:we,Input:Eh,Select:La,Textarea:cg,ConfirmDialog:yn,Disclosure:pI,Tabs:Mz};var ns=Y(he(),1);function Nz(e){let{activeWorkspaceId:i,workspaceError:o,declarativeWorkspaceData:l,workspaceQuery:a,openWorkspaceEntity:u,openWorkspaceLaunch:f,performDeclarativeAction:h,onWorkspaceQueryChange:p}=e,{declarativeHead:g}=e.model;return o&&!l?ns.jsxDEV("main",{className:Rx(""),children:ns.jsxDEV(ve,{tone:"error",children:[o,ns.jsxDEV(we,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):l&&g?ns.jsxDEV("div",{className:Rx("studio-workspace-frame"),children:[o&&ns.jsxDEV(ve,{tone:"error",children:["Showing previously loaded content. ",o,ns.jsxDEV(we,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ns.jsxDEV(Is,{model:g,...l.view.headQuery&&i?{control:ns.jsxDEV(Oz,{control:l.view.headQuery,query:a,onQueryChange:(y)=>p(i,y,y)},void 0,!1,void 0,this)}:{},...g.primaryAction?{action:ns.jsxDEV(Lz,{action:g.primaryAction,primary:!0,onAction:h,components:Ox},void 0,!1,void 0,this)}:{}},void 0,!1,void 0,this),ns.jsxDEV(zz,{data:l,components:Ox,renderHead:!1,onOpenEntity:u,onLaunch:f,onAction:h,query:a,...i?{onQueryChange:(y)=>p(i,y,y)}:{}},i,!1,void 0,this)]},void 0,!0,void 0,this):null}var gt=Y(he(),1);function qz(e,i,o=!1){if(!e.hasBody)return"details";return i??(o?"write":"preview")}function Ya(e){return gt.jsxDEV("div",{className:re("studio",Ae.frame,Vn.operatorRoles,Ty.space),"data-studio-shell":"",children:[gt.jsxDEV(Ey,{contextLabel:"Studio"},void 0,!1,void 0,this),gt.jsxDEV("main",{"aria-label":"Studio status",children:[gt.jsxDEV(ve,{tone:e.error?"error":void 0,className:re("",Ae.boot),children:[e.message,e.onRetry&>.jsxDEV(we,{type:"button",variant:"ghost",onClick:e.onRetry,children:"Retry"},void 0,!1,void 0,this),e.onHome&>.jsxDEV(we,{type:"button",variant:"ghost",onClick:e.onHome,children:"Open Studio"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.children&>.jsxDEV("div",{className:re("",Ae.boot),children:e.children},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function $z(e){let i=Lx();return gt.jsxDEV("div",{className:re("studio",Ae.frame,Vn.operatorRoles,Ty.space),"data-view":"account","data-studio-shell":"",children:[gt.jsxDEV(Ey,{contextLabel:"Account",navigation:{types:e.types,workspaces:e.workspaces,activeEntityType:null,activeWorkspaceId:e.workspaceId,workspaceBadges:Ay(e.workspaces),selectEntityType:e.selectEntityType,selectWorkspace:e.selectWorkspace}},void 0,!1,void 0,this),gt.jsxDEV("div",{className:Oh("",Gn.body,Wa.shell,i&&Wa.shellCollapsed),"data-studio-body":"",children:[gt.jsxDEV("aside",{className:Oh("rail",Wa.rail),children:gt.jsxDEV(zx,{renderMode:"desktop",types:e.types,active:null,onSelect:e.selectEntityType,workspaces:e.workspaces,activeWorkspace:e.workspaceId,workspaceBadges:Ay(e.workspaces),onSelectWorkspace:e.selectWorkspace},void 0,!1,void 0,this)},void 0,!1,void 0,this),gt.jsxDEV("main",{className:Hz("account-studio-pane",Bz.pane),children:e.children},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Pz(e){let i=Lx(),{activeWorkspaceId:o,types:l,workspaces:a,entityType:u,editor:f,deleting:h,navigationBlocked:p,dispatchEditor:g,selectEntityType:y,selectWorkspace:v,remove:S,onNavigationReset:w,onNavigationProceed:A}=e,{mode:C,deleteOpen:D}=f,M=_z(e),H=gI(e,M),{editing:V,canDelete:q,collectionLabel:j,workspaceBadges:G}=M;return gt.jsxDEV("div",{className:re("studio",Ae.frame,Vn.operatorRoles,Ty.space),"data-studio-shell":"","data-view":e.groupingView?"grouping":e.imagesView?"images":o?"workspace":V?"editor":"listing",children:[gt.jsxDEV(Ey,{pageTitle:V?M.editorHead.title:void 0,contextLabel:e.groupReturnLabel??(e.images?.active?"Images":void 0)??e.groupings?.items.find((se)=>se.key===e.groupings?.active)?.label??j,navigation:{groupings:e.groupings,images:e.images,types:l,workspaces:a,activeEntityType:o||e.groupings?.active||e.images?.active?null:u,activeWorkspaceId:o,workspaceBadges:G,selectEntityType:y,selectWorkspace:v,editing:V}},void 0,!1,void 0,this),gt.jsxDEV("div",{className:Oh("",Gn.body,Wa.shell,i&&Wa.shellCollapsed),"data-studio-body":"",children:[gt.jsxDEV("aside",{className:Oh("rail",Wa.rail),children:gt.jsxDEV(zx,{renderMode:"desktop",focus:V,groupings:e.groupings,images:e.images,types:l,active:o||e.groupings?.active||e.images?.active?null:u,onSelect:y,workspaces:a,activeWorkspace:o,workspaceBadges:Ay(a),onSelectWorkspace:v},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.groupingView??e.imagesView??e.homeView??(o?gt.jsxDEV(Nz,{...e,model:M},void 0,!1,void 0,this):!V?gt.jsxDEV(Dz,{...e,model:M},void 0,!1,void 0,this):H?gt.jsxDEV("div",{...N(jc.row),children:[gt.jsxDEV("div",{...N(jc.grow),children:gt.jsxDEV(Ax,{...e,model:M},void 0,!1,void 0,this)},void 0,!1,void 0,this),H]},void 0,!0,void 0,this):gt.jsxDEV(Ax,{...e,model:M},void 0,!1,void 0,this))]},void 0,!0,void 0,this),D&&C.kind==="edit"&&q&>.jsxDEV(c2,{title:Ri(C.entity),deleting:h,onCancel:()=>g({type:"deleteCancelled"}),onConfirm:S},void 0,!1,void 0,this),p&>.jsxDEV(yn,{mark:"↩",title:"Discard unsaved changes?",titleId:"discard-navigation-title",cancelLabel:"Keep editing",confirmLabel:"Discard and continue",confirmVariant:"danger",onCancel:w,onConfirm:A,children:gt.jsxDEV("p",{children:"This draft has not been saved. Continue only if you want to leave it behind."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var mI=Dy.lazy(async()=>({default:(await import("./studio-chunks/studio-ask-panel-gm2gtrvk.js")).StudioAskPanel}));function gI(e,i){let{ask:o,editor:l,dispatchEditor:a}=e,{mode:u,body:f}=l;if(!o?.open||u.kind!=="edit"||!i.canAssist)return null;let h=i.entitySchema.fields,p=(g,y)=>{if(g.field==="selection"){let S=y?Iz(f,y,g.text):null;if(S===null)return"The selected passage has changed. Select it again and ask once more.";return a({type:"bodyChanged",body:S}),null}if(g.field==="body")return a({type:"bodyChanged",body:g.text}),null;let v=h.find((S)=>S.name===g.field);if(!v)return`This entry has no ${g.label.toLowerCase()}.`;return a({type:"fieldChanged",descriptor:v,raw:g.text}),null};return gt.jsxDEV(Dy.Suspense,{fallback:null,children:gt.jsxDEV(mI,{chatApiPath:o.chatApiPath,draftStore:o.draftStore,entityType:i.selectedEntityType,entityId:u.entity.id,title:i.editorHead.title,typeLabel:i.entryLabel.toLowerCase(),savedBody:u.entity.body,unsaved:e.hasUnsavedChanges,selection:o.selection,onClearSelection:()=>o.setSelection(null),fields:Uz(h),agents:e.agentTargets,onApply:p,onClose:()=>o.setOpen(!1)},`${i.selectedEntityType}:${u.entity.id}`,!1,void 0,this)},void 0,!1,void 0,this)}var Hi=Y(ft(),1);function jz(e,i){return e.toLowerCase().includes(i.toLowerCase())}function Vz(e){let i=e.query.trim(),o=e.openEntry&&e.hasChat?[{id:"ask-entry",title:`Ask about this ${e.openEntry.typeLabel}`,kbd:"⌘J",command:{kind:"ask-entry"}}].filter((g)=>!i||jz(g.title,i)):[],l=e.types.filter((g)=>g.canCreate&&!g.isSingleton&&g.classification!=="system").map((g)=>({id:`create:${g.entityType}`,title:`New ${g.singularLabel.toLowerCase()}`,command:{kind:"create",entityType:g.entityType}})),a={id:"climate",title:"Switch light and dark",command:{kind:"climate"}},u=i?[...[...l,a].filter((g)=>jz(g.title,i)),...e.hasChat?[{id:"ask-brain",title:`Ask your brain “${i}”`,command:{kind:"ask-brain",question:i}}]:[]]:[...l.slice(0,3),a],f=(e.remote?.groups??[]).map((g)=>({id:g.id,label:g.label,items:g.items.map((y)=>({id:`${g.id}:${y.id}`,title:y.title,sub:y.sub,command:y.run?{kind:"run",...y.run,href:y.href}:{kind:"open",href:y.href}}))})),h=f.filter((g)=>g.id==="actions").flatMap((g)=>g.items),p=[...u,...h];return[...o.length>0&&e.openEntry?[{id:"for-open",label:`For this ${e.openEntry.typeLabel}`,items:o}]:[],...p.length>0?[{id:"actions",label:"Actions",items:p}]:[],...f.filter((g)=>g.id!=="actions")].filter((g)=>g.items.length>0)}function Gz(e,i,o){if(o===0)return-1;return((e+i)%o+o)%o}var Bi={content:{kB7OPa:"x9f619",kzqmXN:"xcs98ov",kskxy:"xu180u2",kmVPX3:"x1717udv",k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kVQacm:"xb3r6kr",kMv6JI:"x5ddh9m",$$css:!0},field:{k8WAf4:"x10dr8xq",kg3NbH:"x1hr3lfm",kt9PQ7:"xso031l",kfdmCh:"x1q0q8m5",kL6WhQ:"xpqg30t",$$css:!0},input:{kB7OPa:"x9f619",kzqmXN:"xh8yej3",kMzoRj:"xc342km",ksu8eU:"xng3xce",k3XXqK:"x1t137rt",kWkggS:"xjbqb8w",kMwMTN:"xqvuw85",kMv6JI:"x5ddh9m",kGuDYH:"x1j61zf2",$$css:!0},list:{kORKVm:"x1odjw0f",k8WAf4:"x1t0vds8",kogj98:"x1ghz6dp",$$css:!0},section:{k8WAf4:"x12ulsxz",$$css:!0},label:{kogj98:"x1ghz6dp",k8WAf4:"x1t0vds8",kg3NbH:"x1hr3lfm",kGuDYH:"x1j6dyjg",kb6lSQ:"x1vyo3qp",kP9fke:"xtvhhri",kMwMTN:"xqvuw85",kMv6JI:"xa9opjo",$$css:!0},item:{k1xSpc:"x78zum5",kGNEyG:"x1pha0wt",kOIVth:"x883omv",k8WAf4:"x1vvogim",kg3NbH:"x1hr3lfm",kMwMTN:"xqvuw85",kkrTdU:"x1ypdohk",$$css:!0},active:{kWkggS:"x9kxhyz",$$css:!0},title:{kGuDYH:"xif65rj",$$css:!0},sub:{kGuDYH:"xfifm61",kMwMTN:"xqvuw85",$$css:!0},kbd:{keTefX:"xvc5jky",kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg",kMwMTN:"xqvuw85",$$css:!0},empty:{kogj98:"x1ghz6dp",k8WAf4:"x1xn8qrt",kg3NbH:"x1hr3lfm",kGuDYH:"x4z9k3i",kMwMTN:"x1ar3pfp",$$css:!0}};var Yn=Y(he(),1),yI=150;function Wz(e){let i=Kt(),o=Hi.useId(),[l,a]=Hi.useState(!1),[u,f]=Hi.useState(""),[h,p]=Hi.useState(null),[g,y]=Hi.useState(0),[v,S]=Hi.useState(null),[w,A]=Hi.useState(null);Hi.useEffect(()=>{let j=(se)=>{if(se.key.toLowerCase()!=="k"||!(se.metaKey||se.ctrlKey)||se.altKey||se.shiftKey)return;se.preventDefault(),a((ce)=>!ce)},G=()=>a(!0);return window.addEventListener("keydown",j),window.addEventListener(Nx,G),()=>{window.removeEventListener("keydown",j),window.removeEventListener(Nx,G)}},[]),Hi.useEffect(()=>{if(!l)return;let j=!0,G=window.setTimeout(()=>{i.fetchPalette(u).then((se)=>{if(j)p(se)}).catch(()=>{if(j)p(null)})},yI);return()=>{j=!1,window.clearTimeout(G)}},[i,l,u]);let C=Hi.useMemo(()=>Vz({query:u,types:e.types,hasChat:e.hasChat,openEntry:e.openEntry,remote:h}),[u,e.types,e.hasChat,e.openEntry,h]),D=C.flatMap((j)=>j.items),M=Math.min(g,D.length-1),H=()=>{a(!1),f(""),y(0),A(null)},V=(j)=>{if(j.kind!=="run"){H(),e.onCommand(j);return}if(v)return;S(j.actionId),A(null),Promise.resolve(e.onCommand(j)).then(H).catch((G)=>A(Mi(G))).finally(()=>S(null))},q=(j)=>{if(j.key==="ArrowDown"||j.key==="ArrowUp")j.preventDefault(),y(Gz(M,j.key==="ArrowDown"?1:-1,D.length));else if(j.key==="Enter"){let G=D[M];if(!G)return;j.preventDefault(),V(G.command)}};return Yn.jsxDEV(Qc,{open:l,onOpenChange:(j)=>{if(!j)H()},children:Yn.jsxDEV(Wc,{"aria-describedby":void 0,"data-studio-palette":"",...N(Bi.content),children:[Yn.jsxDEV(Qz.Root,{children:Yn.jsxDEV(Yc,{children:"Search or run a command"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Yn.jsxDEV("div",{...N(Bi.field),children:Yn.jsxDEV("input",{...N(Bi.input),role:"combobox","aria-expanded":"true","aria-controls":o,"aria-activedescendant":D[M]?`${o}-${M}`:void 0,"aria-label":"Search or run a command",placeholder:"Search or do…",value:u,autoFocus:!0,onChange:(j)=>{f(j.currentTarget.value),y(0)},onKeyDown:q},void 0,!1,void 0,this)},void 0,!1,void 0,this),(v??w)&&Yn.jsxDEV("p",{...N(Bi.empty),role:"status",children:v?"Running…":w},void 0,!1,void 0,this),Yn.jsxDEV("div",{...N(Bi.list),id:o,role:"listbox",children:D.length===0?Yn.jsxDEV("p",{...N(Bi.empty),children:["Nothing matches “",u.trim(),"”."]},void 0,!0,void 0,this):C.map((j)=>Yn.jsxDEV("div",{role:"group","aria-labelledby":`${o}-${j.id}`,...N(Bi.section),children:[Yn.jsxDEV("div",{id:`${o}-${j.id}`,role:"presentation",...N(Bi.label),children:j.label},void 0,!1,void 0,this),j.items.map((G)=>{let se=D.indexOf(G);return Yn.jsxDEV("div",{id:`${o}-${se}`,role:"option","aria-selected":se===M,"data-palette-item":G.id,...N(Bi.item,se===M&&Bi.active),onMouseMove:()=>y(se),onClick:()=>V(G.command),children:[Yn.jsxDEV("span",{...N(Bi.title),children:G.title},void 0,!1,void 0,this),G.sub&&Yn.jsxDEV("span",{...N(Bi.sub),children:G.sub},void 0,!1,void 0,this),G.kbd&&Yn.jsxDEV("kbd",{...N(Bi.kbd),children:G.kbd},void 0,!1,void 0,this)]},G.id,!0,void 0,this)})]},j.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Yz(e,i,o){return{studioChatHandoff:{version:1,sourceId:e,itemId:i,label:o,prompt:"Help me understand this Inbox item and decide what to do next."}}}function Xz(e){if(typeof e!=="object"||e===null)return null;let i=Reflect.get(e,"studioChatHandoff");if(typeof i!=="object"||i===null)return null;let o=Reflect.get(i,"version"),l=Reflect.get(i,"sourceId"),a=Reflect.get(i,"itemId"),u=Reflect.get(i,"label"),f=Reflect.get(i,"prompt");if(o!==1||typeof l!=="string"||!/^[a-z][a-z0-9-]*$/.test(l)||l.length>64||typeof a!=="string"||a.trim().length===0||a.length>300||typeof u!=="string"||u.trim().length===0||u.length>160||typeof f!=="string"||f.trim().length===0||f.length>1e4)return null;return{sourceId:l,itemId:a,label:u,prompt:f}}function qr(e){if(e instanceof jo)switch(e.status){case 401:return"Your session is no longer authenticated. Sign in again in another tab, then retry here. Keep this tab open to preserve your draft.";case 403:return"You do not currently have permission to read this content. Ask an administrator to check access, then retry.";case 404:return"This content is unavailable. It may have moved, been removed, or be outside your access. Choose another destination or retry.";case 429:return"Studio is receiving too many requests. Wait briefly before retrying."}return`Studio could not load this data. Check your connection or retry later. ${Mi(e)}`}var Ry=Y(ft(),1);var bI=to.parse({});function Fz(e){let i=Kt(),o=Ry.useMemo(()=>e.filter((h)=>!h.rules?.values),[e]),l=Ry.useMemo(()=>o.map((h)=>ig(i,h.key,bI)),[i,o]),a=cy({queries:l}),u={};a.forEach((h,p)=>{let g=o[p];if(g&&h.isSuccess&&h.data.kind==="catalog")u[g.field]=h.data.values.map((y)=>y.value)});let f=JSON.stringify(u);return Ry.useMemo(()=>JSON.parse(f),[f])}var Hx=Y(ft(),1);var Kz=new Set(["offset","limit"]);function Zz(e,i){if(e?.urlQuery!==!0)return{};let o={};for(let[l,a]of new URLSearchParams(i))if(!Kz.has(l))o[l]=a;return o}function Bx(e){let i=new URLSearchParams,o=Object.entries(e).filter(([a,u])=>!Kz.has(a)&&u!==void 0&&(typeof u!=="number"||Number.isFinite(u))).sort(([a],[u])=>a.localeCompare(u));for(let[a,u]of o)i.set(a,String(u));let l=i.toString();return l?`?${l}`:""}function Xa(e,i){return`${e}${Bx(i)}`}function My(e,i,o,l){if(l!==i)return;e.replace(Xa(i,o))}var vI=[],SI=[],xI=[],kI={};function a3(e){let{api:i,entityType:o,activeWorkspaceId:l,routeSearch:a,workspaceQueries:u,editor:f}=e,{mode:h,draft:p,body:g}=f,y=fn(o3(i)),v=y.data?.types??null,S=y.data?.groupings??vI,w=v?.find((In)=>In.entityType===o),A=v?w?.containedIn??o:null,C=w?.capabilities,D=Hx.useMemo(()=>w?.isSingleton?Xc("?scope=collection"):Xc(a),[w?.isSingleton,a]),M=D.offset,H=y.data?.workspaces??xI,V=H.find((In)=>In.id===l),q=V?.rendererName===Jz,j=V?.rendererName===Fc,G=V?.rendererName==="DeclarativeOperatorWorkspace"&&V.id!==Lh,se=l?u[l]:void 0,ce=V?.urlQuery!==!0||se?.urlSearch===a,He=Hx.useMemo(()=>Zz(V,a),[V,a]),U=l?se&&ce?se.query:He:kI,pe=fn({...s3(i,l??"",U),enabled:G}),ye=pe.data??null,ae=ye?.data??null,vt=pe.error?qr(pe.error):null,W=h.kind==="edit"?h.entity.id:null,oe=fn({...l3(i,o??"",W??""),enabled:o!==null&&W!==null&&C?.canAssist===!0&&C.canUpdate}),ee=oe.data??SI,fe=fn({...r3(i),enabled:o!==null}),me=fe.data??null,Ye=fn({...Ly(i,A??"",D),enabled:A!==null}),Le=A?Ye.data?.entities??null:null,dt=Ye.data?.total,tt=fn({...Oy(i,o??""),enabled:o!==null}),Ie=o?tt.data??null:null,Yt=bD(h),Sn=fn(i3(i,o&&Yt&&h.kind==="create"&&h.segment?{entityType:o,idPath:Yt,frontmatter:zy(Ie?.fields??[],p),...Ie?.hasBody&&{body:g}}:null));fn({...Kc(i,o??"",W??""),enabled:o!==null&&W!==null});let Oe=Ar({mutationFn:(In)=>n3(i,In)}),Xn=Ar({mutationFn:(In)=>t3(i,In)}),Ro=Ar({mutationFn:(In)=>e3(i,In)}),os=Xn.isPending,ne=G&&ye?ye.data:null;return{navigationQuery:y,types:v,groupings:S,activeType:w,collectionType:A,activeCapabilities:C,entityCollectionQuery:D,entityListOffset:M,workspaces:H,activeWorkspace:V,activeAccount:q,activeChat:j,activeDeclarativeWorkspace:G,storedWorkspaceQuery:se,storedQueryMatchesLocation:ce,initialUrlWorkspaceQuery:He,workspaceRequestQuery:U,workspaceQuery:pe,workspaceResponse:ye,workspaceData:ae,workspaceError:vt,activeEntityId:W,agentTargetsQuery:oe,agentTargets:ee,syncStatusQuery:fe,syncStatus:me,entityListQuery:Ye,entities:Le,entityListTotal:dt,entitySchemaQuery:tt,schema:Ie,createPath:Yt,destinationQuery:Sn,saveEntityMutation:Oe,deleteEntityMutation:Xn,declarativeWorkspaceActionMutation:Ro,deleting:os,declarativeWorkspaceData:ne}}var Do=Y(ft(),1);var u3=(e)=>mi.string().trim().min(1).max(e).refine((i)=>!/[\p{Cc}\p{Cf}]/u.test(i)),wI=(e)=>mi.string().trim().min(1).max(e).refine((i)=>Array.from(i).every((o)=>o===`
|
|
244
|
+
}`,{label:"class",detail:"definition",type:"keyword"}),pi('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),pi('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],a5=ZO.concat([pi("interface ${name} {\n\t${}\n}",{label:"interface",detail:"definition",type:"keyword"}),pi("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),pi("enum ${name} {\n\t${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),YO=new ey,JO=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ch(e){return(i,o)=>{let l=i.node.getChild("VariableDefinition");if(l)o(l,e);return!0}}var u5=["FunctionDeclaration"],c5={FunctionDeclaration:Ch("function"),ClassDeclaration:Ch("class"),ClassExpression:()=>!0,EnumDeclaration:Ch("constant"),TypeAliasDeclaration:Ch("type"),NamespaceDeclaration:Ch("namespace"),VariableDefinition(e,i){if(!e.matchContext(u5))i(e,"variable")},TypeDefinition(e,i){i(e,"type")},__proto__:null};function eL(e,i){let o=YO.get(i);if(o)return o;let l=[],a=!0;function u(f,h){let p=e.sliceString(f.from,f.to);l.push({label:p,type:h})}return i.cursor(ja.IncludeAnonymous).iterate((f)=>{if(a)a=!1;else if(f.name){let h=c5[f.name];if(h&&h(f,u)||JO.has(f.name))return!1}else if(f.to-f.from>8192){for(let h of eL(e,f.node))l.push(h);return!1}}),YO.set(i,l),l}var XO=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,tL=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function f5(e){let i=Wt(e.state).resolveInner(e.pos,-1);if(tL.indexOf(i.name)>-1)return null;let o=i.name=="VariableName"||i.to-i.from<20&&XO.test(e.state.sliceDoc(i.from,i.to));if(!o&&!e.explicit)return null;let l=[];for(let a=i;a;a=a.parent)if(JO.has(a.name))l=l.concat(eL(e.state.doc,a));return{options:l,from:o?i.from:e.pos,validFor:XO}}var Jo=Ml.define({name:"javascript",parser:KO.configure({props:[Br.add({IfStatement:zc({except:/^\s*({|else\b)/}),TryStatement:zc({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:IM,SwitchBody:(e)=>{let i=e.textAfter,o=/^\s*\}/.test(i),l=/^\s*(case|default)\b/.test(i);return e.baseIndent+(o?0:l?1:2)*e.unit},Block:HM({closing:"}"}),ArrowFunction:(e)=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":zc({except:/^\s*{/}),JSXElement(e){let i=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(i?0:e.unit)},JSXEscape(e){let i=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(i?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),Ll.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Yg,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let i=e.firstChild;if(!i||i.name=="JSXSelfClosingTag")return null;let o=e.lastChild;return{from:i.to,to:o.type.isError?e.to:o.from}},"JSXSelfClosingTag JSXOpenTag"(e){var i;let o=(i=e.firstChild)===null||i===void 0?void 0:i.nextSibling,l=e.lastChild;if(!o||o.type.isError)return null;return{from:o.to,to:l.type.isError?e.to:l.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),nL={test:(e)=>/^JSX/.test(e.name),facet:ph({commentTokens:{block:{open:"{/*",close:"*/}"}}})},rx=Jo.configure({dialect:"ts"},"typescript"),ax=Jo.configure({dialect:"jsx",props:[Qg.add((e)=>e.isTop?[nL]:void 0)]}),ux=Jo.configure({dialect:"jsx ts",props:[Qg.add((e)=>e.isTop?[nL]:void 0)]},"typescript"),iL=(e)=>({label:e,type:"keyword"}),oL="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(iL),d5=oL.concat(["declare","implements","private","protected","public"].map(iL));function sL(e={}){let i=e.jsx?e.typescript?ux:ax:e.typescript?rx:Jo,o=e.typescript?a5.concat(d5):ZO.concat(oL);return new $s(i,[Jo.data.of({autocomplete:QM(tL,GM(o))}),Jo.data.of({autocomplete:f5}),e.jsx?m5:[]])}function h5(e){for(;;){if(e.name=="JSXOpenTag"||e.name=="JSXSelfClosingTag"||e.name=="JSXFragmentTag")return e;if(e.name=="JSXEscape"||!e.parent)return null;e=e.parent}}function FO(e,i,o=e.length){for(let l=i===null||i===void 0?void 0:i.firstChild;l;l=l.nextSibling)if(l.name=="JSXIdentifier"||l.name=="JSXBuiltin"||l.name=="JSXNamespacedName"||l.name=="JSXMemberExpression")return e.sliceString(l.from,Math.min(l.to,o));return""}var p5=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),m5=xe.inputHandler.of((e,i,o,l,a)=>{if((p5?e.composing:e.compositionStarted)||e.state.readOnly||i!=o||l!=">"&&l!="/"||!Jo.isActiveAt(e.state,i,-1))return!1;let u=a(),{state:f}=u,h=f.changeByRange((p)=>{var g;let{head:y}=p,v=Wt(f).resolveInner(y-1,-1),S;if(v.name=="JSXStartTag")v=v.parent;if(f.doc.sliceString(y-1,y)!=l||v.name=="JSXAttributeValue"&&v.to>y);else if(l==">"&&v.name=="JSXFragmentTag")return{range:p,changes:{from:y,insert:"</>"}};else if(l=="/"&&v.name=="JSXStartCloseTag"){let w=v.parent,A=w.parent;if(A&&w.from==y-2&&((S=FO(f.doc,A.firstChild,y))||((g=A.firstChild)===null||g===void 0?void 0:g.name)=="JSXFragmentTag")){let C=`${S}>`;return{range:Z.cursor(y+C.length,-1),changes:{from:y,insert:C}}}}else if(l==">"){let w=h5(v);if(w&&w.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(f.doc.sliceString(y,y+2))&&(S=FO(f.doc,w,y)))return{range:p,changes:{from:y,insert:`</${S}>`}}}return{range:p}});if(h.changes.empty)return!1;return e.dispatch([u,f.update(h,{userEvent:"input.complete",scrollIntoView:!0})]),!0});var Ah=["_blank","_self","_top","_parent"],cx=["ascii","utf-8","utf-16","latin1","latin1"],fx=["get","post","put","delete"],dx=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],oo=["true","false"],de={},g5={a:{attrs:{href:null,ping:null,type:null,media:null,target:Ah,hreflang:null}},abbr:de,address:de,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:de,aside:de,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:de,base:{attrs:{href:null,target:Ah}},bdi:de,bdo:de,blockquote:{attrs:{cite:null}},body:de,br:de,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:dx,formmethod:fx,formnovalidate:["novalidate"],formtarget:Ah,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:de,center:de,cite:de,code:de,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:de,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:de,div:de,dl:de,dt:de,em:de,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:de,figure:de,footer:de,form:{attrs:{action:null,name:null,"accept-charset":cx,autocomplete:["on","off"],enctype:dx,method:fx,novalidate:["novalidate"],target:Ah}},h1:de,h2:de,h3:de,h4:de,h5:de,h6:de,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:de,hgroup:de,hr:de,html:{attrs:{manifest:null}},i:de,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:dx,formmethod:fx,formnovalidate:["novalidate"],formtarget:Ah,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:de,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:de,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:de,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:cx,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:de,noscript:de,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:de,param:{attrs:{name:null,value:null}},pre:de,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:de,rt:de,ruby:de,samp:de,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:cx}},section:de,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:de,source:{attrs:{src:null,type:null,media:null}},span:de,strong:de,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:de,summary:de,sup:de,table:de,tbody:de,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:de,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:de,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:de,time:{attrs:{datetime:null}},title:de,tr:de,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:de,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:de},cL={accesskey:null,class:null,contenteditable:oo,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:oo,autocorrect:oo,autocapitalize:oo,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":oo,"aria-autocomplete":["inline","list","both","none"],"aria-busy":oo,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":oo,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":oo,"aria-hidden":oo,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":oo,"aria-multiselectable":oo,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":oo,"aria-relevant":null,"aria-required":oo,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},fL="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((e)=>"on"+e);for(let e of fL)cL[e]=null;class Uc{constructor(e,i){this.tags={...g5,...e},this.globalAttrs={...cL,...i},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}Uc.default=new Uc;function _c(e,i,o=e.length){if(!i)return"";let l=i.firstChild,a=l&&l.getChild("TagName");return a?e.sliceString(a.from,Math.min(a.to,o)):""}function qc(e,i=!1){for(;e;e=e.parent)if(e.name=="Element")if(i)i=!1;else return e;return null}function dL(e,i,o){let l=o.tags[_c(e,qc(i))];return(l===null||l===void 0?void 0:l.children)||o.allTags}function px(e,i){let o=[];for(let l=qc(i);l&&!l.type.isTop;l=qc(l.parent)){let a=_c(e,l);if(a&&l.lastChild.name=="CloseTag")break;if(a&&o.indexOf(a)<0&&(i.name=="EndTag"||i.from>=l.firstChild.to))o.push(a)}return o}var hL=/^[:\-\.\w\u00b7-\uffff]*$/;function lL(e,i,o,l,a){let u=/\s*>/.test(e.sliceDoc(a,a+5))?"":">",f=qc(o,o.name=="StartTag"||o.name=="TagName");return{from:l,to:a,options:dL(e.doc,f,i).map((h)=>({label:h,type:"type"})).concat(px(e.doc,o).map((h,p)=>({label:"/"+h,apply:"/"+h+u,type:"type",boost:99-p}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function rL(e,i,o,l){let a=/\s*>/.test(e.sliceDoc(l,l+5))?"":">";return{from:o,to:l,options:px(e.doc,i).map((u,f)=>({label:u,apply:u+a,type:"type",boost:99-f})),validFor:hL}}function y5(e,i,o,l){let a=[],u=0;for(let f of dL(e.doc,o,i))a.push({label:"<"+f,type:"type"});for(let f of px(e.doc,o))a.push({label:"</"+f+">",type:"type",boost:99-u++});return{from:l,to:l,options:a,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function b5(e,i,o,l,a){let u=qc(o),f=u?i.tags[_c(e.doc,u)]:null,h=f&&f.attrs?Object.keys(f.attrs):[],p=f&&f.globalAttrs===!1?h:h.length?h.concat(i.globalAttrNames):i.globalAttrNames;return{from:l,to:a,options:p.map((g)=>({label:g,type:"property"})),validFor:hL}}function v5(e,i,o,l,a){var u;let f=(u=o.parent)===null||u===void 0?void 0:u.getChild("AttributeName"),h=[],p=void 0;if(f){let g=e.sliceDoc(f.from,f.to),y=i.globalAttrs[g];if(!y){let v=qc(o),S=v?i.tags[_c(e.doc,v)]:null;y=(S===null||S===void 0?void 0:S.attrs)&&S.attrs[g]}if(y){let v=e.sliceDoc(l,a).toLowerCase(),S='"',w='"';if(/^['"]/.test(v))p=v[0]=='"'?/^[^"]*$/:/^[^']*$/,S="",w=e.sliceDoc(a,a+1)==v[0]?"":v[0],v=v.slice(1),l++;else p=/^[^\s<>='"]*$/;for(let A of y)h.push({label:A,apply:S+A+w,type:"constant"})}}return{from:l,to:a,options:h,validFor:p}}function pL(e,i){let{state:o,pos:l}=i,a=Wt(o).resolveInner(l,-1),u=a.resolve(l);for(let f=l,h;u==a&&(h=a.childBefore(f));){let p=h.lastChild;if(!p||!p.type.isError||p.from<p.to)break;u=a=h,f=p.from}if(a.name=="TagName")return a.parent&&/CloseTag$/.test(a.parent.name)?rL(o,a,a.from,l):lL(o,e,a,a.from,l);else if(a.name=="StartTag"||a.name=="IncompleteTag")return lL(o,e,a,l,l);else if(a.name=="StartCloseTag"||a.name=="IncompleteCloseTag")return rL(o,a,l,l);else if(a.name=="OpenTag"||a.name=="SelfClosingTag"||a.name=="AttributeName")return b5(o,e,a,a.name=="AttributeName"?a.from:l,l);else if(a.name=="Is"||a.name=="AttributeValue"||a.name=="UnquotedAttributeValue")return v5(o,e,a,a.name=="Is"?l:a.from,l);else if(i.explicit&&(u.name=="Element"||u.name=="Text"||u.name=="Document"))return y5(o,e,a,l);else return null}function mL(e){return pL(Uc.default,e)}function S5(e){let{extraTags:i,extraGlobalAttributes:o}=e,l=o||i?new Uc(i,o):Uc.default;return(a)=>pL(l,a)}var x5=Jo.parser.configure({top:"SingleExpression"}),gL=[{tag:"script",attrs:(e)=>e.type=="text/typescript"||e.lang=="ts",parser:rx.parser},{tag:"script",attrs:(e)=>e.type=="text/babel"||e.type=="text/jsx",parser:ax.parser},{tag:"script",attrs:(e)=>e.type=="text/typescript-jsx",parser:ux.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:x5},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Jo.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:wh.parser}],yL=[{name:"style",parser:wh.parser.configure({top:"Styles"})}].concat(fL.map((e)=>({name:e,parser:Jo.parser}))),bL=Ml.define({name:"html",parser:uL.configure({props:[Br.add({Element(e){let i=/^(\s*)(<\/)?/.exec(e.textAfter);if(e.node.to<=e.pos+i[0].length)return e.continue();return e.lineIndent(e.node.from)+(i[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let i=null,o;for(let l=e.node;;){let a=l.lastChild;if(!a||a.name!="Element"||a.to!=l.to)break;i=l=a}if(i&&!((o=i.lastChild)&&(o.name=="CloseTag"||o.name=="SelfClosingTag")))return e.lineIndent(i.from)+e.unit;return null}}),Ll.add({Element(e){let{firstChild:i,lastChild:o}=e;if(!i||i.name!="OpenTag")return null;return{from:i.to,to:o.name=="CloseTag"?o.from:e.to}}}),PM.add({"OpenTag CloseTag":(e)=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),ty=bL.configure({wrap:hx(gL,yL)});function vL(e={}){let i="",o;if(e.matchClosingTags===!1)i="noMatch";if(e.selfClosingTags===!0)i=(i?i+" ":"")+"selfClosing";if(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)o=hx((e.nestedLanguages||[]).concat(gL),(e.nestedAttributes||[]).concat(yL));let l=o?bL.configure({wrap:o,dialect:i}):i?ty.configure({dialect:i}):ty;return new $s(l,[ty.data.of({autocomplete:S5(e)}),e.autoCloseTags!==!1?k5:[],sL().support,WO().support])}var aL=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),k5=xe.inputHandler.of((e,i,o,l,a)=>{if(e.composing||e.state.readOnly||i!=o||l!=">"&&l!="/"||!ty.isActiveAt(e.state,i,-1))return!1;let u=a(),{state:f}=u,h=f.changeByRange((p)=>{var g,y,v;let S=f.doc.sliceString(p.from-1,p.to)==l,{head:w}=p,A=Wt(f).resolveInner(w,-1),C;if(S&&l==">"&&A.name=="EndTag"){let D=A.parent;if(((y=(g=D.parent)===null||g===void 0?void 0:g.lastChild)===null||y===void 0?void 0:y.name)!="CloseTag"&&(C=_c(f.doc,D.parent,w))&&!aL.has(C)){let M=w+(f.doc.sliceString(w,w+1)===">"?1:0),H=`</${C}>`;return{range:p,changes:{from:w,to:M,insert:H}}}}else if(S&&l=="/"&&A.name=="IncompleteCloseTag"){let D=A.parent;if(A.from==w-2&&((v=D.lastChild)===null||v===void 0?void 0:v.name)!="CloseTag"&&(C=_c(f.doc,D,w))&&!aL.has(C)){let M=w+(f.doc.sliceString(w,w+1)===">"?1:0),H=`${C}>`;return{range:Z.cursor(w+H.length,-1),changes:{from:w,to:M,insert:H}}}}return{range:p}});if(h.changes.empty)return!1;return e.dispatch([u,f.update(h,{userEvent:"input.complete",scrollIntoView:!0})]),!0});var kL=ph({commentTokens:{block:{open:"<!--",close:"-->"}}}),wL=new hi,CL=zO.configure({props:[Ll.add((e)=>!e.is("Block")||e.is("Document")||yx(e)!=null||w5(e)?void 0:(i,o)=>({from:o.doc.lineAt(i.from).to,to:i.to})),wL.add(yx),Br.add({Document:()=>null}),Nr.add({Document:kL})]});function yx(e){let i=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return i?+i[1]:void 0}function w5(e){return e.name=="OrderedList"||e.name=="BulletList"}function C5(e,i){let o=e;for(;;){let l=o.nextSibling,a;if(!l||(a=yx(l.type))!=null&&a<=i)break;o=l}return o.to}var A5=UM.of((e,i,o)=>{for(let l=Wt(e).resolveInner(o,-1);l;l=l.parent){if(l.from<i)break;let a=l.type.prop(wL);if(a==null)continue;let u=C5(l,a);if(u>o)return{from:o,to:u}}return null});function bx(e){return new Li(kL,e,[],"markdown")}var T5=bx(CL),E5=CL.configure([IO,qO,_O,$O,{props:[Ll.add({Table:(e,i)=>({from:i.doc.lineAt(e.from).to,to:e.to})})]}]),iy=bx(E5);function D5(e,i){return(o)=>{if(o&&e){let l=null;if(o=/\S*/.exec(o)[0],typeof e=="function")l=e(o);else l=mh.matchLanguageName(e,o,!0);if(l instanceof mh)return l.support?l.support.language.parser:Mc.getSkippingParser(l.load());else if(l)return l.parser}return i?i.parser:null}}class ny{constructor(e,i,o,l,a,u,f){this.node=e,this.from=i,this.to=o,this.spaceBefore=l,this.spaceAfter=a,this.type=u,this.item=f}blank(e,i=!0){let o=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){while(o.length<e)o+=" ";return o}else{for(let l=this.to-this.from-o.length-this.spaceAfter.length;l>0;l--)o+=" ";return o+(i?this.spaceAfter:"")}}marker(e,i){let o=this.node.name=="OrderedList"?String(+TL(this.item,e)[2]+i):"";return this.spaceBefore+o+this.type+this.spaceAfter}}function AL(e,i){let o=[],l=[];for(let a=e;a;a=a.parent){if(a.name=="FencedCode")return l;if(a.name=="ListItem"||a.name=="Blockquote")o.push(a)}for(let a=o.length-1;a>=0;a--){let u=o[a],f,h=i.lineAt(u.from),p=u.from-h.from;if(u.name=="Blockquote"&&(f=/^ *>( ?)/.exec(h.text.slice(p))))l.push(new ny(u,p,p+f[0].length,"",f[1],">",null));else if(u.name=="ListItem"&&u.parent.name=="OrderedList"&&(f=/^( *)\d+([.)])( *)/.exec(h.text.slice(p)))){let g=f[3],y=f[0].length;if(g.length>=4)g=g.slice(0,g.length-4),y-=4;l.push(new ny(u.parent,p,p+y,f[1],g,f[2],u))}else if(u.name=="ListItem"&&u.parent.name=="BulletList"&&(f=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(h.text.slice(p)))){let g=f[4],y=f[0].length;if(g.length>4)g=g.slice(0,g.length-4),y-=4;let v=f[2];if(f[3])v+=f[3].replace(/[xX]/," ");l.push(new ny(u.parent,p,p+y,f[1],g,v,u))}}return l}function TL(e,i){return/^(\s*)(\d+)(?=[.)])/.exec(i.sliceString(e.from,e.from+10))}function mx(e,i,o,l=0){for(let a=-1,u=e;;){if(u.name=="ListItem"){let h=TL(u,i),p=+h[2];if(a>=0){if(p!=a+1)return;o.push({from:u.from+h[1].length,to:u.from+h[0].length,insert:String(a+2+l)})}a=p}let f=u.nextSibling;if(!f)break;u=f}}function vx(e,i){let o=/^[ \t]*/.exec(e)[0].length;if(!o||i.facet(Wg)!="\t")return e;let l=Rr(e,4,o),a="";for(let u=l;u>0;)if(u>=4)a+="\t",u-=4;else a+=" ",u--;return a+e.slice(o)}var R5=(e={})=>({state:i,dispatch:o})=>{let l=Wt(i),{doc:a}=i,u=null,f=i.changeByRange((h)=>{if(!h.empty||!iy.isActiveAt(i,h.from,-1)&&!iy.isActiveAt(i,h.from,1))return u={range:h};let p=h.from,g=a.lineAt(p),y=AL(l.resolveInner(p,-1),a);while(y.length&&y[y.length-1].from>p-g.from)y.pop();if(!y.length)return u={range:h};let v=y[y.length-1];if(v.to-v.spaceAfter.length>p-g.from)return u={range:h};let S=p>=v.to-v.spaceAfter.length&&!/\S/.test(g.text.slice(v.to));if(v.item&&S){let M=v.node.firstChild,H=v.node.getChild("ListItem","ListItem");if(M.to>=p||H&&H.to<p||g.from>0&&!/[^\s>]/.test(a.lineAt(g.from-1).text)||e.nonTightLists===!1){let V=y.length>1?y[y.length-2]:null,q,j="";if(V&&V.item)q=g.from+V.from,j=V.marker(a,1);else q=g.from+(V?V.to:0);let G=[{from:q,to:p,insert:j}];if(v.node.name=="OrderedList")mx(v.item,a,G,-2);if(V&&V.node.name=="OrderedList")mx(V.item,a,G);return{range:Z.cursor(q+j.length),changes:G}}else{let V=xL(y,i,g);return{range:Z.cursor(p+V.length+1),changes:{from:g.from,insert:V+i.lineBreak}}}}if(v.node.name=="Blockquote"&&S&&g.from){let M=a.lineAt(g.from-1),H=/>\s*$/.exec(M.text);if(H&&H.index==v.from){let V=i.changes([{from:M.from+H.index,to:M.to},{from:g.from+v.from,to:g.to}]);return{range:h.map(V),changes:V}}}let w=[];if(v.node.name=="OrderedList")mx(v.item,a,w);let A=v.item&&v.item.from<g.from,C="";if(!A||/^[\s\d.)\-+*>]*/.exec(g.text)[0].length>=v.to)for(let M=0,H=y.length-1;M<=H;M++)C+=M==H&&!A?y[M].marker(a,1):y[M].blank(M<H?Rr(g.text,4,y[M+1].from)-C.length:null);let D=p;while(D>g.from&&/\s/.test(g.text.charAt(D-g.from-1)))D--;if(C=vx(C,i),O5(v.node,i.doc))C=xL(y,i,g)+i.lineBreak+C;return w.push({from:D,to:p,insert:i.lineBreak+C}),{range:Z.cursor(D+C.length+1),changes:w}});if(u)return!1;return o(i.update(f,{scrollIntoView:!0,userEvent:"input"})),!0},M5=R5();function SL(e){return e.name=="QuoteMark"||e.name=="ListMark"}function O5(e,i){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let o=e.firstChild,l=e.getChild("ListItem","ListItem");if(!l)return!1;let a=i.lineAt(o.to),u=i.lineAt(l.from),f=/^[\s>]*$/.test(a.text);return a.number+(f?0:1)<u.number}function xL(e,i,o){let l="";for(let a=0,u=e.length-2;a<=u;a++)l+=e[a].blank(a<u?Rr(o.text,4,e[a+1].from)-l.length:null,a<u);return vx(l,i)}function L5(e,i){let o=e.resolveInner(i,-1),l=i;if(SL(o))l=o.from,o=o.parent;for(let a;a=o.childBefore(l);)if(SL(a))l=a.from;else if(a.name=="OrderedList"||a.name=="BulletList")o=a.lastChild,l=o.to;else break;return o}var z5=({state:e,dispatch:i})=>{let o=Wt(e),l=null,a=e.changeByRange((u)=>{let f=u.from,{doc:h}=e;if(u.empty&&iy.isActiveAt(e,u.from)){let p=h.lineAt(f),g=AL(L5(o,f),h);if(g.length){let y=g[g.length-1],v=y.to-y.spaceAfter.length+(y.spaceAfter?1:0);if(f-p.from>v&&!/\S/.test(p.text.slice(v,f-p.from)))return{range:Z.cursor(p.from+v),changes:{from:p.from+v,to:f}};if(f-p.from==v&&(!y.item||p.from<=y.item.from||!/\S/.test(p.text.slice(0,y.to)))){let S=p.from+y.from;if(y.item&&y.node.from<y.item.from&&/\S/.test(p.text.slice(y.from,y.to))){let w=y.blank(Rr(p.text,4,y.to)-Rr(p.text,4,y.from));if(S==p.from)w=vx(w,e);return{range:Z.cursor(S+w.length),changes:{from:S,to:p.from+y.to,insert:w}}}if(S<f)return{range:Z.cursor(S),changes:{from:S,to:f}}}}}return l={range:u}});if(l)return!1;return i(e.update(a,{scrollIntoView:!0,userEvent:"delete"})),!0},N5=[{key:"Enter",run:M5},{key:"Backspace",run:z5}],EL=vL({matchClosingTags:!1});function DL(e={}){let{codeLanguages:i,defaultCodeLanguage:o,addKeymap:l=!0,base:{parser:a}=T5,completeHTMLTags:u=!0,pasteURLAsLink:f=!0,htmlTagLanguage:h=EL}=e;if(!(a instanceof kh))throw RangeError("Base parser provided to `markdown` should be a Markdown parser");let p=e.extensions?[e.extensions]:[],g=[h.support,A5],y;if(f)g.push(U5);if(o instanceof $s)g.push(o.support),y=o.language;else if(o)y=o;let v=i||y?D5(i,y):void 0;if(p.push(NO({codeParser:v,htmlParser:h.language.parser})),l)g.push(Cl.high(ch.of(N5)));let S=bx(a.configure(p));if(u)g.push(S.data.of({autocomplete:B5}));return new $s(S,g)}function B5(e){let{state:i,pos:o}=e,l=/<[:\-\.\w\u00b7-\uffff]*$/.exec(i.sliceDoc(o-25,o));if(!l)return null;let a=Wt(i).resolveInner(o,-1);while(a&&!a.type.isTop){if(a.name=="CodeBlock"||a.name=="FencedCode"||a.name=="ProcessingInstructionBlock"||a.name=="CommentBlock"||a.name=="Link"||a.name=="Image")return null;a=a.parent}return{from:o-l[0].length,to:o,options:H5(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}var gx=null;function H5(){if(gx)return gx;let e=mL(new j1(Ze.create({extensions:EL}),0,!0));return gx=e?e.options:[]}var I5=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,U5=xe.domEventHandlers({paste:(e,i)=>{var o;let{main:l}=i.state.selection;if(l.empty)return!1;let a=(o=e.clipboardData)===null||o===void 0?void 0:o.getData("text/plain");if(!a||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(a))return!1;if(/^www\./.test(a))a="https://"+a;if(!iy.isActiveAt(i.state,l.from,1))return!1;let u=Wt(i.state),f=!1;if(u.iterate({from:l.from,to:l.to,enter:(h)=>{if(h.from>l.from||I5.test(h.name))f=!0},leave:(h)=>{if(h.to<l.to)f=!0}}),f)return!1;return i.dispatch({changes:[{from:l.from,insert:"["},{from:l.to,insert:`](${a})`}],userEvent:"input.paste",scrollIntoView:!0}),!0}});var Nn=Y(ft(),1);var Ao=Y(he(),1),_5=["source","split","preview"];function q5(e){return e==="source"||e==="split"||e==="preview"}var $5={source:"Source",split:"Split",preview:"Preview"},zL=So.define(),P5=Nc.define([{tag:F.heading1,fontFamily:"var(--console-display)",fontSize:"1.75em",fontWeight:"600",color:"var(--console-text)"},{tag:F.heading2,fontFamily:"var(--console-display)",fontSize:"1.4em",fontWeight:"600",color:"var(--console-text)"},{tag:F.heading3,fontFamily:"var(--console-display)",fontSize:"1.18em",fontWeight:"600",color:"var(--console-text)"},{tag:F.heading,color:"var(--console-text)",fontWeight:"600"},{tag:F.monospace,fontFamily:"var(--console-mono)",fontSize:"0.86em"},{tag:F.meta,color:"var(--console-text-muted)"},{tag:F.emphasis,fontStyle:"italic"},{tag:F.strong,fontWeight:"600"},{tag:[F.link,F.url],color:"var(--console-text)",textDecoration:"underline"},{tag:F.quote,color:"var(--console-text-dim)"}]),j5=[DL(),qM(P5),xe.lineWrapping,xe.contentAttributes.of({"aria-label":"Markdown source",tabindex:"0"})];function V5(e,i=[]){return Ze.create({doc:e,extensions:[...j5,...i]})}function G5(e,i){if(e.state.doc.toString()===i)return;e.dispatch({changes:{from:0,to:e.state.doc.length,insert:i},annotations:zL.of(!0)})}function Q5(e){let{value:i,onChange:o,onSelectionChange:l,readOnly:a}=e,u=Nn.useRef(null),f=Nn.useRef(null),h=Nn.useRef(i),p=Nn.useRef(a),g=Nn.useRef(new xc),y=Nn.useRef(o),v=Nn.useRef(l),S=Nn.useCallback((w)=>{let A=w.state.selection.main;v.current?.(A.empty?null:{from:A.from,to:A.to})},[]);return Nn.useEffect(()=>{y.current=o,v.current=l},[o,l]),Nn.useEffect(()=>{let w=u.current;if(!w)return;let A=new xe({parent:w,state:V5(h.current,[g.current.of([Ze.readOnly.of(p.current),xe.editable.of(!p.current)]),xe.updateListener.of((C)=>{if(!C.docChanged)return;if(C.transactions.some((D)=>D.annotation(zL)===!0))return;y.current(C.state.doc.toString())}),xe.updateListener.of((C)=>{if(!C.selectionSet&&!C.docChanged)return;S(C.view)}),xe.domEventHandlers({keyup:(C,D)=>(S(D),!1),mouseup:(C,D)=>(window.setTimeout(()=>S(D),0),!1),touchend:(C,D)=>(window.setTimeout(()=>S(D),0),!1)})])});return f.current=A,()=>{if(A.destroy(),f.current===A)f.current=null}},[S]),Nn.useEffect(()=>{let w=f.current;if(!w)return;G5(w,i)},[i]),Nn.useEffect(()=>{let w=f.current;if(!w)return;w.dispatch({effects:g.current.reconfigure([Ze.readOnly.of(a),xe.editable.of(!a)])})},[a]),Ao.jsxDEV("div",{ref:u,...N(Us.source),"data-editor":"codemirror6"},void 0,!1,void 0,this)}function NL(e){let{value:i,mode:o,onChange:l,onModeChange:a,onSelectionChange:u,readOnly:f=!1,singlePane:h=!1}=e,p=h&&o==="split"?f?"preview":"source":o,g=Nn.useId(),y=p!=="preview",v=p!=="source";return Ao.jsxDEV("div",{...N(Us.root),children:[Ao.jsxDEV("header",{...N(Us.toolbar),children:[Ao.jsxDEV(RL,{value:p,onValueChange:(S)=>{if(q5(S))a(S)},children:Ao.jsxDEV(ML,{...N(Us.modes,h&&Us.inlineModes),"aria-label":"Editor body view",children:_5.filter((S)=>!h||S!=="split").map((S)=>Ao.jsxDEV(OL,{value:S,id:`${g}-${S}`,"aria-controls":g,children:$5[S]},S,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ao.jsxDEV("span",{...N(Us.metadata),children:[i.trim()?i.trim().split(/\s+/).length.toLocaleString():0," ","words"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Ao.jsxDEV("div",{...N(Us.panes,y&&v&&Us.split),"data-studio-split":y&&v?"":void 0,id:g,role:"tabpanel","aria-labelledby":`${g}-${p}`,children:[y&&Ao.jsxDEV(Q5,{value:i,onChange:l,onSelectionChange:(S)=>u?.(S?{...S,text:i.slice(S.from,S.to)}:null),readOnly:f},void 0,!1,void 0,this),v&&Ao.jsxDEV("div",{...N(Us.preview),"data-studio-preview":"",tabIndex:0,role:"region","aria-label":"Rendered document",children:Ao.jsxDEV(LL,{presentation:"document",documentTitle:e.documentTitle,children:i},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Nl="grouping-definitions",Ga=20,W5=mi.strictObject({label:oy.shape.label,excludeTypes:mi.array(oy.shape.types.element).max(100).refine((e)=>new Set(e).size===e.length,"Excluded types must be unique.").optional(),multiple:mi.boolean(),values:mi.array(mi.string().min(1)).min(1).superRefine((e,i)=>{let o=new Set;e.forEach((l,a)=>{if(o.has(l))i.addIssue({code:"custom",path:[a],message:"Values must be unique (matching is exact)."});o.add(l)})}).optional()}),BL=mi.object({groupings:mi.record(oy.shape.key,W5).refine((e)=>Object.keys(e).length<=Ga,`Define at most ${Ga} groupings.`).default({})});var Qa=Y(ft(),1);var Th=Y(he(),1);function $c(e,i){return i==="split"?e.fields.find((o)=>o.name==="title"&&o.widget==="string"):void 0}function HL(e){let i=Qa.useId(),o=Qa.useRef(null),l=Qa.useRef(null),a=e.issues?.find((u)=>u.path[0]===e.descriptor.name);return Qa.useEffect(()=>{let u=o.current;if(!a||!u||u!==u.closest("form")?.querySelector("[data-studio-invalid-field]"))return;l.current?.focus()},[a,e.issues]),Th.jsxDEV("span",{ref:o,...a&&{"data-studio-invalid-field":""},children:[Th.jsxDEV("span",{"data-value":e.value,...N(li.titleGrow),children:Th.jsxDEV("textarea",{ref:l,rows:1,name:e.descriptor.name,"aria-label":e.descriptor.label,value:e.value,required:e.descriptor.required!==!1,placeholder:e.placeholder,"aria-invalid":a?!0:void 0,"aria-describedby":a?i:void 0,onKeyDown:(u)=>{if(u.key==="Enter")u.preventDefault()},onChange:(u)=>e.onChange(u.currentTarget.value.replace(/\r?\n/g," ")),...N(li.titleInput)},void 0,!1,void 0,this)},void 0,!1,void 0,this),a&&Th.jsxDEV("span",{id:i,...N(li.titleIssue),children:a.message},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var sy="studio-save-reason";function ly(e,i,o){if(!Sx(e,i,o))return;let l=i.fieldIssues?.some((a)=>a.path[0]!=="segment"&&a.path[0]!=="prefix");if(_d(e)||l)return"Fix the highlighted fields first.";if(i.destinationBlocked&&e.mode.kind==="create")return i.presentation&&$c(i.entitySchema,i.presentation)?"Give this entry a title to create it.":"Name the file to create this entry.";return}function Sx(e,i,o){let l=i.selectedEntityType===Nl,a=l||e.mode.kind==="create"&&i.entitySchema.isSingleton;return!i.canEdit||_d(e)||l&&!i.entitySchema.groupingDefinitions||i.destinationBlocked||e.save.kind==="saving"||a&&!o}var Pc=Y(ft(),1);var Ni={root:{keoZOQ:"x1sgpng",kmVPX3:"x6w2896",kaIpWk:"xu4hgxq",kWkggS:"x18s3upu",$$css:!0},head:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kjj79g:"x1qughib",kOIVth:"x883omv",kMwMTN:"x1ar3pfp",$$css:!0},state:{kMwMTN:"xgi1xjn",k63SB2:"x1pd3egz",$$css:!0},copy:{kogj98:"x108lf0y",kMwMTN:"x1ar3pfp",kGuDYH:"x1j6dyjg",kLWn49:"xfrs9s4",kHjlTd:"xj0a0fe",$$css:!0},actions:{k1xSpc:"x78zum5",kwnvtZ:"x1a02dak",kOIVth:"x1j9xkj6",keoZOQ:"xk9mzb7",$$css:!0},button:{kAzted:"x1rz828m x1c4ya5t",kmVPX3:"x1jmcyos",kGuDYH:"x1k6wstc",$$css:!0},publish:{kVAM5u:"xawfzfr",kWkggS:"x15vqgvx",kMwMTN:"x1um1dla",$$css:!0},complete:{kMwMTN:"x19k5i5u",kMv6JI:"xa9opjo",$$css:!0},confirmation:{kmVPX3:"x12s40zk",kWkggS:"xc1c755",kVVagm:"x1t8o5tu",$$css:!0}};var Bn=Y(he(),1);function xx(e){return"success"in e&&e.success===!1}function kx(e){return"needsConfirmation"in e&&e.needsConfirmation===!0}function Y5(e){return Bn.jsxDEV(yn,{mark:"↑",title:`Publish ${e.title} now?`,titleId:"publish-confirm-title",cancelLabel:"Review again",confirmLabel:e.confirming?"Publishing…":"Confirm publication",pending:e.confirming,confirmVariant:"primary",onCancel:e.onCancel,onConfirm:e.onConfirm,children:[Bn.jsxDEV("p",{children:e.preview},void 0,!1,void 0,this),Bn.jsxDEV("p",{...N(Ni.confirmation),children:"This sends the current saved version to an external public provider."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function IL(e){let[i,o]=Pc.useState(null),[l,a]=Pc.useState(null),[u,f]=Pc.useState(null),h={entityType:e.entityType,entityId:e.entityId},p=e.unsaved||i!==null,g=e.status==="draft"?e.missing??[]:[],y=g.length>0,v=Pc.useCallback(async(A,C)=>{o(C),a(null);try{let D=await e.onAction(A);if(xx(D))throw Error(D.error);if(kx(D))f({args:D.args,preview:D.preview??`This will publish ${e.entityType}:${e.entityId} publicly.`});else if(A.type==="publish")f(null)}catch(D){a(Mi(D))}finally{o(null)}},[e]),S=e.status==="queued"?{type:"remove",...h}:e.status==="failed"?{type:"retry",...h}:{type:"queue",...h},w=e.status==="queued"?"Remove from queue":e.status==="failed"?"Retry":"Add to queue";return Bn.jsxDEV("section",{...N(Ni.root),"aria-label":"Publication actions",children:[Bn.jsxDEV("header",{...N(Ni.head,Vn.eyebrow),children:[Bn.jsxDEV("span",{children:"Publication"},void 0,!1,void 0,this),Bn.jsxDEV("b",{...N(Ni.state,ry(e.status==="queued"?"warn":e.status==="failed"?"error":e.status==="published"?"good":void 0)),children:e.status},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Bn.jsxDEV("p",{...N(Ni.copy),children:"Operates on the saved entity. Publication state is separate from the save pipeline below."},void 0,!1,void 0,this),e.unsaved&&Bn.jsxDEV("p",{...N(Ni.copy,ry("warn")),children:"Save changes before changing publication state."},void 0,!1,void 0,this),y&&Bn.jsxDEV("p",{...N(Ni.copy,ry("warn")),children:X5(g)},void 0,!1,void 0,this),e.status!=="published"&&Bn.jsxDEV("div",{...N(Ni.actions),children:[Bn.jsxDEV(we,{type:"button",variant:"ghost",xstyle:Ni.button,disabled:p||y,onClick:()=>void v(S,"lifecycle"),children:i==="lifecycle"?"Working…":w},void 0,!1,void 0,this),Bn.jsxDEV(we,{type:"button",xstyle:[Ni.button,Ni.publish],disabled:p||y,onClick:()=>void v({type:"publish",...h},"publish"),children:i==="publish"?"Preparing…":"Publish now"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.status==="published"&&Bn.jsxDEV("p",{...N(Ni.copy,Ni.complete),children:"Published externally."},void 0,!1,void 0,this),l&&Bn.jsxDEV(ve,{tone:"error",children:l},void 0,!1,void 0,this),u&&Bn.jsxDEV(Y5,{title:e.title,preview:u.preview,confirming:i==="confirm",onCancel:()=>f(null),onConfirm:()=>void v({type:"publish",...h,confirmation:u.args},"confirm")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function X5(e){return`Add ${e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)??""}`} before publishing.`}var ay=Y(ft(),1);var Ps={editor:{kumcoG:"x1mkdm3x",k9llMU:"xxq7klm",k6KnKl:"x8ef1wo",k1JLwA:"x4jmfmw",k9pwkU:"x1y6iwit",$$css:!0},content:{kBCFzs:"x1osaytk",kbNqZ1:"x7sv70a",k7Eaqz:"xeuugli",kAzted:"x2lwn1j",kORKVm:"x1odjw0f",k3Woio:"x16dl9wz",kiEn40:"x1bqaal",k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kWkggS:"x18s3upu",$$css:!0},properties:{kmuXW:"x2lah0s",kORKVm:"xryxfnj",kWqL5O:"xgfja2r",kWkggS:"x18s3upu",kmVPX3:"x11wck8f",kubnTK:"x1crvqbx",kOLLwu:"x1inw03p",kRugJJ:"x1h32jcg",$$css:!0},manuscript:{kUk6DE:"x1mg3qzt",kAzted:"x5mc7k8",kVQacm:"xb3r6kr",kKq9zD:"x9uj0fw",krFdGn:"x19d57q8",kTWfjk:"x1f8pdon",$$css:!0},disclosure:{kmuXW:"x2lah0s",k7Eaqz:"xeuugli",kogj98:"x1vmk1f4",kaIpWk:"x12oqio5",kKwWVI:"x1hyyza1",$$css:!0},disclosedFields:{kmVPX3:"x560879",k7Eaqz:"xeuugli",$$css:!0},summaryDescription:{kGuDYH:"xfifm61",k63SB2:"xo1l8bm",kMwMTN:"xgi1xjn",keTefX:"xcev3uh",k1xSpc:"xt0psk2 xkaaz9w",$$css:!0},summary:{kkrTdU:"x1ypdohk",kmVPX3:"x1j671cp",kGuDYH:"xif65rj",k63SB2:"x19s9jnd",k3Woio:"x16dl9wz",kiEn40:"x7s97pk",$$css:!0}};var js=Y(he(),1);function UL(e){e.querySelector("details[data-studio-properties]")?.setAttribute("open","")}function _L({presentation:e,children:i}){return e==="split"?js.jsxDEV(js.Fragment,{children:i},void 0,!1,void 0,this):js.jsxDEV("div",{"data-studio-editor-content":"",role:"region","aria-label":"Record contents",tabIndex:0,...N(Ps.content),children:i},void 0,!1,void 0,this)}function qL({presentation:e,reveal:i,children:o,summaryDescription:l,hidden:a=!1}){let u=ay.useRef(null);if(ay.useLayoutEffect(()=>{if(i&&u.current)u.current.open=!0},[i]),e==="document")return js.jsxDEV("details",{ref:u,"data-studio-properties":"",...N(Ps.disclosure),children:[js.jsxDEV("summary",{...N(Ps.summary),children:["Properties",l&&js.jsxDEV("span",{...N(Ps.summaryDescription),children:l},void 0,!1,void 0,this)]},void 0,!0,void 0,this),js.jsxDEV("div",{...N(Ps.disclosedFields),children:o},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return js.jsxDEV("aside",{"data-studio-properties":"",...N(Gn.colophon,e==="form"&&Gn.fullWidthProperties,e==="form"&&Ps.properties,a&&Gn.colophonHidden),children:o},void 0,!1,void 0,this)}var Rh=Y(ft(),1);var Hn=Y(ft(),1);function uy(e,i=[]){if(e!==void 0&&!Qn(e))return{rows:[],nextId:0,malformed:{value:e}};let o=Object.entries(e??{}).map(([l,a],u)=>({id:u,key:l,value:a,...i.includes(l)?{savedKey:l}:{}}));return{rows:o,nextId:o.length}}function $L(e){return{...e,rows:[...e.rows,{id:e.nextId,key:"",value:{label:"",multiple:!0}}],nextId:e.nextId+1}}function PL(e,i,o){return{...e,rows:e.rows.map((l)=>{if(l.id!==i)return l;if(l.savedKey!==void 0&&o.key!==void 0&&o.key!==l.savedKey)throw Error("Saved grouping keys cannot be renamed.");return{...l,...o}})}}function jL(e,i){return{...e,rows:e.rows.filter((o)=>o.id!==i)}}function wx(e){if(e.malformed)return{value:void 0,issues:[{path:["groupings"],message:"Groupings must be a mapping. Repair the source or explicitly replace it."}],pendingChanges:!1};let i=e.rows.filter((u,f)=>e.rows.some((h,p)=>p<f&&h.key===u.key));if(i.length)return{value:void 0,issues:i.map((u)=>({path:["groupings",u.key],message:`The key “${u.key}” is already used. Choose a different key.`})),pendingChanges:!0};let o=Object.fromEntries(e.rows.map((u)=>[u.key,u.value])),l=BL.safeParse({groupings:o}),a=l.success?[]:l.error.issues.map((u)=>({path:u.path.map((f)=>typeof f==="symbol"?String(f):f),message:u.message}));return{value:o,issues:a,pendingChanges:!1}}var _t={intro:{kMwMTN:"xgi1xjn",kGuDYH:"x4z9k3i",kLWn49:"x1dbl2gt",k1K539:"x1hq5gj4",ks0D6T:"x70i6om",$$css:!0},help:{kMwMTN:"xgi1xjn",$$css:!0},grid:{k1xSpc:"xrvj5dj",kumcoG:"xnby9oq x4jmfmw",kOIVth:"xhp1hw2",kqGvvJ:"x1mibpdg",k7Eaqz:"xeuugli",$$css:!0},choices:{kmVPX3:"x1717udv",kogj98:"x1ghz6dp",kMzoRj:"xc342km",k7Eaqz:"xeuugli",$$css:!0},choice:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kOIVth:"x883omv",kAzted:"xu0aao5 x1c4ya5t",kHjlTd:"xj0a0fe",$$css:!0},readOnly:{k1xSpc:"x1lliihq",kmVPX3:"x1160tuk",kaIpWk:"x1kogg8i",kWkggS:"xbslqsl",kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kHjlTd:"xj0a0fe",$$css:!0},first:{k8WAf4:"x10bfh3y",ks0D6T:"xe0576n",$$css:!0},actions:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kjj79g:"x1qughib",kOIVth:"xou54vl",keoZOQ:"xhrpt6u",$$css:!0},exclusions:{k1K539:"xod5an3",$$css:!0},exclusionsSummary:{k1xSpc:"xtcx8v3",kpqbRz:"x1cy9i3i",kkrTdU:"x1ypdohk",kAzted:"x1gg8mnh",k8WAf4:"x10dr8xq",$$css:!0},rule:{k1xSpc:"x78zum5",kwnvtZ:"x1a02dak",kOIVth:"xfe5i6u",k1K539:"xod5an3",$$css:!0}};var ke=Y(he(),1);function Dh(e,i,o){let l={...e,[i]:o};if(i==="excludeTypes"&&Array.isArray(o)&&o.length===0)delete l[i];return l}function GL(e){let{row:i,readOnly:o}=e,l=Qn(i.value)?i.value:void 0,a=i.savedKey!==void 0,u=typeof l?.label==="string"&&l.label.length>0?l.label:a?i.key:"New grouping",f=(h)=>e.onUpdate({value:h});return ke.jsxDEV("section",{...N(Ir.section),"aria-label":u,"data-definition-row":i.id,children:[ke.jsxDEV("div",{...N(Ir.head),children:[ke.jsxDEV("h2",{...N(Ir.title),children:u},void 0,!1,void 0,this),!o&&ke.jsxDEV(we,{type:"button",variant:"ghost","aria-label":`Remove ${u} grouping`,onClick:(h)=>e.onRemove(h.currentTarget),children:"Remove grouping"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.issues.length>0&&ke.jsxDEV(ve,{tone:"error",children:e.issues.map((h)=>h.message).join(" · ")},void 0,!1,void 0,this),!l?ke.jsxDEV(ke.Fragment,{children:[ke.jsxDEV(ve,{tone:"error",children:"This definition is not a mapping. Repair its source or explicitly remove the definition."},void 0,!1,void 0,this),ke.jsxDEV("pre",{...N(_t.readOnly),children:JSON.stringify(i.value,null,2)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):ke.jsxDEV(ke.Fragment,{children:[ke.jsxDEV(F5,{entry:l,label:u,rowKey:i.key,saved:a,readOnly:o,onChange:f,onKeyChange:(h)=>e.onUpdate({key:h})},void 0,!1,void 0,this),ke.jsxDEV(K5,{entry:l,contributorTypes:e.contributorTypes,systemTypes:e.systemTypes,readOnly:o,onChange:f},void 0,!1,void 0,this),ke.jsxDEV(Z5,{entry:l,label:u,name:e.allowedValuesName,usage:e.usage,readOnly:o,onChange:f},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function F5(e){let{entry:i,label:o,saved:l,readOnly:a}=e,u=i.multiple;return ke.jsxDEV("div",{...N(_t.grid),children:[ke.jsxDEV("label",{...N(Wn.field),children:[ke.jsxDEV("span",{...N(Wn.label),children:"Label"},void 0,!1,void 0,this),a?ke.jsxDEV("span",{...N(_t.readOnly),children:o},void 0,!1,void 0,this):ke.jsxDEV(Eh,{"aria-label":`${o} label`,value:typeof i.label==="string"?i.label:"",onChange:(f)=>e.onChange(Dh(i,"label",f.currentTarget.value)),required:!0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ke.jsxDEV("label",{...N(Wn.field),children:[ke.jsxDEV("span",{...N(Wn.label),children:"Key"},void 0,!1,void 0,this),a?ke.jsxDEV("code",{...N(_t.readOnly),children:e.rowKey},void 0,!1,void 0,this):ke.jsxDEV(Eh,{"aria-label":`${o} key`,value:e.rowKey,readOnly:l,xstyle:l?Wn.readOnly:void 0,required:!0,onChange:(f)=>{if(!l)e.onKeyChange(f.currentTarget.value)}},void 0,!1,void 0,this),ke.jsxDEV("span",{...N(Wn.listHelp,_t.help),children:l?"Fixed after creation":"Lowercase letters, digits and hyphens. Fixed when saved."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ke.jsxDEV("label",{...N(Wn.field),children:[ke.jsxDEV("span",{...N(Wn.label),children:"Values per entry"},void 0,!1,void 0,this),a?ke.jsxDEV("span",{...N(_t.readOnly),children:u===!0?"Several":u===!1?"One":"Invalid cardinality"},void 0,!1,void 0,this):ke.jsxDEV(La,{"aria-label":`${o} values per entry`,value:u===!0?"several":u===!1?"one":"",onChange:(f)=>e.onChange(Dh(i,"multiple",f.currentTarget.value==="several")),required:!0,children:[ke.jsxDEV("option",{value:"",disabled:!0,children:"Choose cardinality"},void 0,!1,void 0,this),ke.jsxDEV("option",{value:"one",children:"One"},void 0,!1,void 0,this),ke.jsxDEV("option",{value:"several",children:"Several"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function K5(e){let{entry:i,contributorTypes:o}=e,l=Array.isArray(i.excludeTypes)?i.excludeTypes.filter((f)=>typeof f==="string"):[],a=l.filter((f)=>!e.systemTypes.includes(f)),u=new Set(o.map((f)=>f.entityType));return ke.jsxDEV("details",{...N(_t.exclusions),children:[ke.jsxDEV("summary",{...N(Wn.label,_t.exclusionsSummary),children:["Exclude types",a.length>0?` (${a.length})`:""]},void 0,!0,void 0,this),ke.jsxDEV("p",{...N(Wn.listHelp,_t.help),children:"Content types participate unless excluded. System types never participate."},void 0,!1,void 0,this),e.readOnly?ke.jsxDEV("span",{...N(_t.readOnly),children:a.map((f)=>o.find((h)=>h.entityType===f)?.label??`${f} (unavailable)`).join(", ")||"None"},void 0,!1,void 0,this):ke.jsxDEV("fieldset",{...N(_t.choices),children:[ke.jsxDEV("legend",{...N(Wn.label),children:"Excluded content types"},void 0,!1,void 0,this),[...o,...a.filter((f)=>!u.has(f)).map((f)=>({entityType:f,label:`${f} (unavailable)`}))].map((f)=>ke.jsxDEV("label",{...N(_t.choice),children:[ke.jsxDEV("input",{type:"checkbox","aria-label":`Exclude ${f.label}`,...N(Ir.checkbox),checked:l.includes(f.entityType),onChange:(h)=>e.onChange(Dh(i,"excludeTypes",h.currentTarget.checked?[...l,f.entityType]:l.filter((p)=>p!==f.entityType)))},void 0,!1,void 0,this),f.label]},f.entityType,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Z5(e){let{entry:i,label:o,usage:l}=e,a=Object.hasOwn(i,"values"),u=l?new Map(l.values.map((f)=>[f.value,f.count])):void 0;return ke.jsxDEV(ke.Fragment,{children:[ke.jsxDEV("fieldset",{...N(_t.choices,_t.rule),children:[ke.jsxDEV("legend",{...N(Wn.label),children:"Allowed values"},void 0,!1,void 0,this),e.readOnly?ke.jsxDEV("span",{...N(_t.readOnly),children:a?"Only these values":"Any value"},void 0,!1,void 0,this):ke.jsxDEV(ke.Fragment,{children:[!1,!0].map((f)=>ke.jsxDEV("label",{...N(_t.choice),children:[ke.jsxDEV("input",{type:"radio",name:e.name,"aria-label":`${o}: ${f?"only these values":"any value"}`,checked:a===f,...N(Ir.checkbox),onChange:()=>e.onChange(f?Dh(i,"values",[]):Object.fromEntries(Object.entries(i).filter(([h])=>h!=="values")))},void 0,!1,void 0,this),f?"Only these values":"Any value"]},String(f),!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a&&ke.jsxDEV(ke.Fragment,{children:[ke.jsxDEV(VL,{label:`${o} allowed values`,purpose:"allowed-values",definition:{multiple:!0},value:i.values,onChange:(f)=>e.onChange(Dh(i,"values",f)),readOnly:e.readOnly,counts:u},void 0,!1,void 0,this),ke.jsxDEV("p",{...N(Wn.listHelp,_t.help),children:Array.isArray(i.values)&&i.values.length===0?"Add at least one allowed value, or choose Any value.":l?"Numbers show current usage. Unused values remain available.":"Usage is unavailable until this grouping can be read."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var Ht=Y(he(),1);function QL(e,i){return e&&Object.hasOwn(e,i)?e[i]:void 0}function WL(e){let[i,o]=Hn.useState(()=>uy(e.value,e.savedKeys)),[l,a]=Hn.useState(null),u=Hn.useRef(null),f=Hn.useRef(void 0),h=Hn.useRef(null),p=Hn.useId(),g=Hn.useId(),y=JSON.stringify(e.value),v=JSON.stringify(e.savedKeys),S=Hn.useRef(y),w=Hn.useRef(v),A=Hn.useRef(void 0),C=wx(i);Hn.useEffect(()=>{if(y===S.current&&v===w.current)return;S.current=y,w.current=v,o(uy(e.value,e.savedKeys)),a(null)},[y,e.value,v,e.savedKeys]),Hn.useEffect(()=>{let q={issues:C.issues,pendingChanges:C.pendingChanges},j=JSON.stringify(q);if(A.current===j)return;A.current=j,e.onStateChange(q)}),Hn.useEffect(()=>{if(f.current!==void 0)u.current?.querySelector(`[data-definition-row="${f.current}"] input`)?.focus(),f.current=void 0;if(l===null&&h.current)(h.current.isConnected?h.current:u.current?.querySelector("[data-definition-add]"))?.focus(),h.current=null},[i,l]);let D=(q,j)=>{j.focus(),h.current=j,a(q)},M=(q)=>{if(e.readOnly)return;o(q);let j=wx(q);if(j.value!==void 0)S.current=JSON.stringify(j.value),e.onChange(j.value);let G={issues:j.issues,pendingChanges:j.pendingChanges};A.current=JSON.stringify(G),e.onStateChange(G)},H=i.rows.find((q)=>q.id===l),V=[...C.issues,...e.issues??[]];return Ht.jsxDEV("div",{ref:u,role:"group","aria-label":"Grouping definitions","aria-describedby":V.length?g:void 0,children:[Ht.jsxDEV("p",{...N(_t.intro),children:"Groups collect entries by exact frontmatter values. Removing a grouping or a listed value never rewrites entries. Values outside a list stay visible until an editor changes them."},void 0,!1,void 0,this),e.readOnly&&Ht.jsxDEV(ve,{children:"You can use these groupings. Only administrators can change their definitions."},void 0,!1,void 0,this),i.malformed?Ht.jsxDEV(Ht.Fragment,{children:[Ht.jsxDEV(ve,{tone:"error",children:"The stored groupings are not a mapping. Their source has not been discarded."},void 0,!1,void 0,this),Ht.jsxDEV("pre",{...N(_t.readOnly),children:JSON.stringify(i.malformed.value,null,2)},void 0,!1,void 0,this),!e.readOnly&&Ht.jsxDEV(we,{type:"button",variant:"outline",onClick:(q)=>D("reset",q.currentTarget),children:"Replace invalid definitions"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Ht.jsxDEV(Ht.Fragment,{children:[i.rows.length===0&&Ht.jsxDEV("section",{...N(_t.first),children:[Ht.jsxDEV("h2",{...N(Ir.title),children:"Your first grouping"},void 0,!1,void 0,this),Ht.jsxDEV("p",{...N(_t.intro),children:"Bring related entries together, of any content type, without moving them. Give a grouping a label and say whether an entry belongs to one value or several."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.rows.map((q)=>Ht.jsxDEV(GL,{row:q,usage:QL(e.usage,q.key),contributorTypes:e.contributorTypes,systemTypes:e.systemTypes,readOnly:e.readOnly,issues:V.filter((j)=>j.path[1]===q.key),allowedValuesName:`${p}-${q.id}-allowed`,onUpdate:(j)=>M(PL(i,q.id,j)),onRemove:(j)=>D(q.id,j)},q.id,!1,void 0,this)),!e.readOnly&&Ht.jsxDEV("div",{...N(_t.actions),children:[Ht.jsxDEV(we,{type:"button",variant:"outline","data-definition-add":"",disabled:i.rows.length>=Ga,onClick:()=>{f.current=i.nextId,M($L(i))},children:"Add grouping"},void 0,!1,void 0,this),Ht.jsxDEV("span",{...N(Wn.kind),children:[i.rows.length," / ",Ga]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),V.length>0&&Ht.jsxDEV("div",{id:g,children:Ht.jsxDEV(ve,{tone:"error",children:["Cannot save:"," ",V.map((q)=>{let j=q.path.slice(1).join(".");return j?`${j}: ${q.message}`:q.message}).join(" · ")]},void 0,!0,void 0,this)},void 0,!1,void 0,this),l!==null&&!e.readOnly&&Ht.jsxDEV(J5,{target:l,row:H,usage:H?QL(e.usage,H.key):void 0,titleId:p,onCancel:()=>a(null),onConfirm:()=>{M(l==="reset"?uy({}):jL(i,l)),a(null)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function J5(e){let{row:i,usage:o}=e,l=e.target==="reset",a=i&&Qn(i.value)&&typeof i.value.label==="string"?i.value.label:i?.key;return Ht.jsxDEV(yn,{mark:"−",title:l?"Replace invalid definitions?":`Remove ${a?.length?a:"unsaved"} grouping?`,titleId:e.titleId,cancelLabel:l?"Keep definitions":"Keep grouping",confirmLabel:l?"Replace definitions":"Remove grouping",confirmVariant:"danger",onCancel:e.onCancel,onConfirm:e.onConfirm,children:[Ht.jsxDEV("p",{children:[l?"This replaces the invalid definitions with an empty document when you save. ":o?o.entries===1?"1 entry carries this grouping and keeps its values. ":`${o.entries} entries carry this grouping and keep their values. `:"Usage is unavailable. Existing entries keep their values. ","No entries are deleted or moved. The change takes effect after saving."]},void 0,!0,void 0,this),!l&&Ht.jsxDEV("p",{children:"Re-adding the same key can collect those values again."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Bl=Y(he(),1);function XL(e){let{editor:i,schema:o,dispatch:l}=e,a=i.draft.groupings,u=i.mode.kind==="edit"?i.mode.entity.frontmatter.groupings:void 0,f=Qn(u)?Object.keys(u):[],h=o.issues.filter((M)=>{let H=M.path[1];if(typeof H==="string"&&Qn(a)&&Qn(u))return Object.hasOwn(a,H)&&JSON.stringify(a[H])===JSON.stringify(u[H]);return JSON.stringify(a)===JSON.stringify(u)}),p=h.length>0;Rh.useEffect(()=>{l({type:"compoundFieldStateChanged",field:"grouping-source",invalid:p,pendingChanges:!1})},[l,p]);let g=Kt(),y=Rh.useMemo(()=>(Qn(u)?Object.keys(u):[]).filter((M)=>YL.safeParse(M).success&&Qn(a)&&Object.hasOwn(a,M)).slice(0,Ga).map((M)=>{let H=Qn(a)&&Qn(a[M])?a[M]:void 0,V=Array.isArray(H?.values)?H.values.filter((q)=>typeof q==="string"):[];return{key:M,values:V}}),[a,u]),v=Rh.useMemo(()=>y.map(({key:M,values:H})=>ED(g,M,H)),[g,y]),S=cy({queries:v}),w=Object.fromEntries(y.flatMap(({key:M},H)=>{let V=S[H];return V?.isSuccess&&!V.isFetching?[[M,V.data]]:[]})),A=S.some((M)=>M.isFetching),C=S.some((M)=>fc(M.failureReason)),D=S.filter((M)=>M.isError&&!M.isFetching);return Bl.jsxDEV(Bl.Fragment,{children:[A&&Bl.jsxDEV(ve,{children:Bl.jsxDEV("span",{role:"status",children:C?"Groupings are initializing. Usage will load when ready.":"Loading grouping usage…"},void 0,!1,void 0,this)},void 0,!1,void 0,this),D.length>0&&Bl.jsxDEV(ve,{tone:"error",children:["Some grouping usage is unavailable. Counts are not assumed to be zero."," ",Bl.jsxDEV(we,{type:"button",variant:"outline",size:"sm",onClick:()=>{for(let M of D)M.refetch()},children:"Retry usage"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Bl.jsxDEV(WL,{value:a,savedKeys:f,contributorTypes:o.contributorTypes,systemTypes:o.systemTypes,readOnly:e.readOnly,usage:w,issues:h,onChange:(M)=>l({type:"fieldChanged",descriptor:{name:"groupings",label:"Groupings",widget:"object"},raw:M}),onStateChange:(M)=>l({type:"compoundFieldStateChanged",field:"groupings",pendingChanges:M.pendingChanges,invalid:M.issues.length>0})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var To=Y(ft(),1);var et=Y(he(),1),eI=new Set(["preferredTerms","preferred","avoid"]),tI=new Set(["description","purpose","positioning","summary","artDirection","composition"]);function nI(e){return e.widget==="string"&&tI.has(e.name)?{...e,widget:"text"}:e}function FL(e){let i=e.fields.filter((f)=>Mh(f,e.draft)&&(!e.readOnly||e.draft[f.name]!==void 0||f.required!==!1));if(i.length===0)return null;if(e.readOnly)return et.jsxDEV("div",{"data-studio-system-fields":"",...N(wt.root),children:[e.title&&et.jsxDEV("h2",{...N(wt.heading),children:e.title},void 0,!1,void 0,this),et.jsxDEV("dl",{...N(wt.profile),children:i.map((f)=>et.jsxDEV("div",{...N(wt.row),children:[et.jsxDEV("dt",{...N(wt.term),children:f.label},void 0,!1,void 0,this),et.jsxDEV("dd",{...N(wt.value),children:et.jsxDEV(fy,{vocabulary:e.vocabularies?.[f.name],literalStrings:e.literalFields?.includes(f.name),value:e.draft[f.name],fields:f.fields},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},f.name,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let o=i.filter((f)=>f.widget==="object"&&f.fields?.length),l=i.filter((f)=>!o.includes(f)&&f.name!=="visibility"),a=i.filter((f)=>f.name==="visibility"),u=(f)=>et.jsxDEV(KL,{vocabulary:e.vocabularies?.[f.name],literalList:e.literalFields?.includes(f.name),suggestions:e.suggestions?.[f.name],descriptor:f,value:e.draft[f.name],issues:e.issues,onChange:(h)=>e.onChange(f,h),children:e.renderAssist?.(f)},f.name,!1,void 0,this);return et.jsxDEV("div",{"data-studio-system-fields":"",...N(wt.root),children:[l.length>0&&et.jsxDEV(et.Fragment,{children:[e.title&&et.jsxDEV("h2",{...N(wt.heading),children:e.title},void 0,!1,void 0,this),et.jsxDEV("div",{"data-studio-system-grid":"",...N(wt.grid),children:l.map(u)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),o.map(u),a.length>0&&et.jsxDEV("section",{...N(wt.section),children:[et.jsxDEV("h2",{...N(wt.heading),children:"Access"},void 0,!1,void 0,this),et.jsxDEV("div",{"data-studio-system-grid":"",...N(wt.grid),children:a.map(u)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function KL(e){let i=nI(e.descriptor);if(i.widget==="object"&&i.fields?.length)return et.jsxDEV(oI,{...e},void 0,!1,void 0,this);if(i.widget==="list"&&i.fields?.length)return et.jsxDEV(iI,{...e},void 0,!1,void 0,this);return et.jsxDEV("div",{...N(wt.onlyField,(i.widget==="text"||i.widget==="list"&&!eI.has(i.name)||i.widget==="object"||i.widget==="image")&&wt.wide),"data-studio-field-assist":"",children:[et.jsxDEV(dy,{vocabulary:e.vocabulary,literalList:e.literalList,suggestions:e.suggestions,descriptor:i,value:e.value,issues:e.issues,onChange:e.onChange},void 0,!1,void 0,this),e.children]},void 0,!0,void 0,this)}function iI(e){let i=To.useMemo(()=>e.issues?.filter((a)=>a.path[0]===e.descriptor.name)??[],[e.issues,e.descriptor.name]),o=To.useRef(null),l=To.useId();return To.useEffect(()=>{let a=o.current;if(i.length&&a===a?.closest("form")?.querySelector("[data-studio-invalid-field]"))a?.focus()},[i]),et.jsxDEV("div",{ref:o,role:"group","aria-label":e.descriptor.label,tabIndex:-1,"data-studio-invalid-field":i.length?e.descriptor.name:void 0,"aria-describedby":i.length?l:void 0,...N(wt.wide),children:[et.jsxDEV("h2",{...N(wt.heading),children:e.descriptor.label},void 0,!1,void 0,this),et.jsxDEV(fy,{value:e.value,fields:e.descriptor.fields},void 0,!1,void 0,this),et.jsxDEV("p",{...N(wt.description),children:"Read-only structured field"},void 0,!1,void 0,this),i.length>0&&et.jsxDEV("div",{id:l,children:et.jsxDEV(ve,{tone:"error",children:i.map((a)=>a.message).join(" · ")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function oI(e){let{descriptor:i}=e,o=Qn(e.value)?e.value:{},l=i.fields??[],a=To.useMemo(()=>e.issues?.filter((g)=>g.path[0]===i.name).map((g)=>({...g,path:g.path.slice(1)})),[e.issues,i.name]),u=a?.filter((g)=>g.path.length===0)??[],f=To.useId(),h=To.useRef(null);To.useEffect(()=>{let g=h.current;if(g?.hasAttribute("data-studio-invalid-field")&&g===g.closest("form")?.querySelector("[data-studio-invalid-field]"))g.focus()},[a]);let p=Object.fromEntries(Object.entries(o).filter(([g])=>!l.some((y)=>y.name===g)));return et.jsxDEV("div",{ref:h,role:"group","aria-label":i.label,tabIndex:-1,"data-studio-invalid-field":u.length?i.name:void 0,"aria-describedby":u.length?f:void 0,...N(wt.section,wt.wide),children:[et.jsxDEV("h2",{...N(wt.heading),children:i.label},void 0,!1,void 0,this),u.length>0&&et.jsxDEV("div",{id:f,children:et.jsxDEV(ve,{tone:"error",children:u.map((g)=>g.message).join(" · ")},void 0,!1,void 0,this)},void 0,!1,void 0,this),et.jsxDEV("div",{"data-studio-system-grid":"",...N(wt.grid),children:l.filter((g)=>Mh(g,o)).map((g)=>et.jsxDEV(KL,{descriptor:i.required===!1&&e.value===void 0?{...g,required:!1}:g,value:o[g.name],issues:a,onChange:(y)=>e.onChange(CS(o,g,y))},g.name,!1,void 0,this))},void 0,!1,void 0,this),Object.keys(p).length>0&&et.jsxDEV(fy,{value:p},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Eo=Y(he(),1);function JL(e){let{editor:i,dispatchEditor:o,fieldAssistState:l}=e,{mode:a,draft:u,body:f}=i,{entitySchema:h,presentation:p,selectedEntityType:g,groupingFields:y,groupingVocabularies:v,systemDesign:S,canEdit:w,canAssist:A,fieldIssues:C}=e.model,D=ac(g,a),M=$c(h,p),H=A&&h.hasBody&&f.trim().length>0,V=(G)=>H&&!v[G.name]?.values?Eo.jsxDEV(ZL,{descriptor:G,state:l,onRun:e.runFieldAssist,onApply:e.applyFieldAssist,onDiscard:()=>e.setFieldAssistState({kind:"idle"})},void 0,!1,void 0,this):null,q=(G,se)=>o({type:"fieldChanged",descriptor:G,raw:se}),j=g===Nl;return Eo.jsxDEV("fieldset",{className:re("",Gn.fields),disabled:!w,children:[S?Eo.jsxDEV(Eo.Fragment,{children:[j&&(h.groupingDefinitions?Eo.jsxDEV(XL,{editor:i,schema:h.groupingDefinitions,readOnly:!w,dispatch:o},void 0,!1,void 0,this):Eo.jsxDEV(ve,{tone:"error",children:"Grouping definitions are unavailable. Reload before editing."},void 0,!1,void 0,this)),Eo.jsxDEV(FL,{vocabularies:v,literalFields:y,suggestions:e.groupingSuggestions,fields:j?h.fields.filter((G)=>G.name!=="groupings"):h.fields,draft:u,title:p==="document"?"":S.fieldsTitle,readOnly:!w,issues:C,onChange:q,renderAssist:V},void 0,!1,void 0,this)]},void 0,!0,void 0,this):h.fields.filter((G)=>Mh(G,u)).filter((G)=>G!==M).map((G)=>Eo.jsxDEV("div",{"data-studio-field-assist":"",children:[Eo.jsxDEV(dy,{readOnly:!w||G.name==="status"&&e.model.publicationWorkspace!==void 0,vocabulary:v[G.name],literalList:y.includes(G.name),suggestions:e.groupingSuggestions?.[G.name],descriptor:G,issues:C,value:u[G.name],onChange:(se)=>q(G,se)},void 0,!1,void 0,this),V(G)]},`${D}:${G.name}`,!0,void 0,this)),h.format==="raw"&&Eo.jsxDEV(ve,{children:"This type is raw markdown — the whole document is the body."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Ur=Y(he(),1),sI=["details","write","preview"],ez={details:"Properties",write:"Source",preview:"Preview"},lI={write:"source",preview:"preview"};function tz(e){return Ur.jsxDEV("div",{className:re("studio-mobile-tabs",mn.mobileModes),children:Ur.jsxDEV(hy,{children:[Ur.jsxDEV(py,{asChild:!0,children:Ur.jsxDEV("button",{type:"button","aria-label":"Editor view",className:re("",mn.paneTrigger,Vn.eyebrow),children:[ez[e.pane],Ur.jsxDEV("span",{"aria-hidden":"true",children:"⌄"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Ur.jsxDEV(my,{align:"start",children:sI.map((i)=>Ur.jsxDEV(gy,{disabled:i!=="details"&&!e.hasBody,onSelect:()=>{e.onPane(i);let o=lI[i];if(o)e.onBodyMode(o)},children:ez[i]},i,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var nz=Y(he(),1);function yy(e){return nz.jsxDEV(we,{type:"button",variant:"ghost",xstyle:e.placement==="head"?jc.toggleHead:jc.toggleBar,"data-studio-ask-toggle":e.placement,"aria-pressed":e.ask.open,"aria-keyshortcuts":"Control+j Meta+j",title:"Ask about this entry (Ctrl+J or ⌘J)",onClick:()=>e.ask.setOpen(!e.ask.open),children:"Ask"},void 0,!1,void 0,this)}function Vc(e){return{entity:e,draft:{...e.frontmatter},body:e.body}}var gi=Y(ft(),1);var Gc={versions:{k1xSpc:"xrvj5dj",kumcoG:"xcjjqqt",kOIVth:"xou54vl",k1JLwA:"x4jmfmw",$$css:!0},version:{kzqmXN:"xh8yej3",k7Eaqz:"xeuugli",kZKoxP:"x1isuwpm",kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kMwMTN:"xqvuw85",kWkggS:"x18s3upu",kmVPX3:"xc7ga6q",$$css:!0},actions:{k1xSpc:"x78zum5",kwnvtZ:"x1a02dak",kOIVth:"x167g77z",keoZOQ:"x14vqqas",$$css:!0}};var bt=Y(he(),1);function iz(e,i){return JSON.stringify({frontmatter:e,body:i},null,2)}function oz(e){let i=Kt(),[o,l]=gi.useState(!1),[a,u]=gi.useState(null),[f,h]=gi.useState(!1),[p,g]=gi.useState(null),[y,v]=gi.useState(!1),[S,w]=gi.useState(!1),[A,C]=gi.useState(!1),[D,M]=gi.useState(!1),{conflictId:H}=e,V=async(He)=>{if(H===void 0)return;M(!0),g(null);try{await i.resolveConflict(H,He);let U=await i.fetchEntity(e.entity.entityType,e.entity.id);w(!1),C(!1),l(!1),e.onUseLatest(U)}catch(U){w(!1),C(!1),g($d(U,"The conflict could not be resolved")||"The conflict could not be resolved")}finally{M(!1)}},q=gi.useRef(0),j=gi.useRef(null);gi.useEffect(()=>()=>{q.current+=1},[]);let G=iz(e.draft,e.body);gi.useEffect(()=>v(!1),[G]);let se=async()=>{v(!1);try{await navigator.clipboard.writeText(G),v(!0)}catch{g("Copy unavailable. Select Your version manually."),l(!0)}},ce=async()=>{let He=++q.current;h(!0),u(null),g(null);try{let U=await i.fetchEntity(e.entity.entityType,e.entity.id);if(q.current===He)u(U)}catch(U){if(q.current===He)g($d(U,"Latest version could not be loaded")||"Latest version could not be loaded")}finally{if(q.current===He)h(!1)}};return bt.jsxDEV(bt.Fragment,{children:[bt.jsxDEV("div",{...N(Gc.actions),children:[bt.jsxDEV("span",{ref:j,children:bt.jsxDEV(we,{type:"button",variant:"ghost",onClick:()=>{l(!0),ce()},children:"Compare changes"},void 0,!1,void 0,this)},void 0,!1,void 0,this),bt.jsxDEV(we,{type:"button",variant:"ghost",onClick:()=>void se(),children:"Copy my version"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y&&bt.jsxDEV(ve,{children:"Version copied, including properties and body."},void 0,!1,void 0,this),bt.jsxDEV(Qc,{open:o,onOpenChange:(He)=>{if(l(He),!He)w(!1),q.current+=1,h(!1)},children:bt.jsxDEV(Wc,{"aria-describedby":"conflict-comparison-description",onCloseAutoFocus:(He)=>{He.preventDefault(),j.current?.querySelector("button")?.focus()},children:[bt.jsxDEV(Yc,{children:"Compare changes"},void 0,!1,void 0,this),bt.jsxDEV("p",{id:"conflict-comparison-description",children:"Your draft is unchanged. Review both versions before choosing to replace it."},void 0,!1,void 0,this),H!==void 0&&bt.jsxDEV("p",{children:"Your version is also kept in the Inbox as a conflict, so it is not lost if you close this page."},void 0,!1,void 0,this),p&&bt.jsxDEV(ve,{tone:"error",children:p},void 0,!1,void 0,this),bt.jsxDEV("div",{...N(Gc.versions),children:[bt.jsxDEV("label",{children:["Your version",bt.jsxDEV("textarea",{...N(Gc.version),readOnly:!0,value:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this),bt.jsxDEV("label",{children:["Latest saved version",bt.jsxDEV("textarea",{...N(Gc.version),readOnly:!0,value:a?iz(a.frontmatter,a.body):"Not loaded"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),bt.jsxDEV("div",{...N(Gc.actions),children:[bt.jsxDEV(we,{type:"button",variant:"ghost",disabled:f,onClick:()=>void ce(),children:f?"Loading latest…":"Retry latest"},void 0,!1,void 0,this),bt.jsxDEV(we,{type:"button",variant:"ghost",onClick:()=>l(!1),children:"Keep editing my version"},void 0,!1,void 0,this),H!==void 0&&bt.jsxDEV(we,{type:"button",variant:"ghost",disabled:!a||f||D,onClick:()=>C(!0),children:"Save my version"},void 0,!1,void 0,this),bt.jsxDEV(we,{type:"button",disabled:!a||f||p!==null,onClick:()=>w(!0),children:"Use latest version"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),S&&a&&bt.jsxDEV(yn,{title:"Replace your local draft?",titleId:"replace-conflicted-draft",mark:"↩",cancelLabel:"Keep my draft",confirmLabel:"Replace with latest",onCancel:()=>w(!1),onConfirm:()=>{if(H!==void 0){V("keep-current");return}e.onUseLatest(a),w(!1),l(!1)},children:bt.jsxDEV("p",{children:"This discards your local edits. Copy your version first if you want to keep it. Nothing is written to the server."},void 0,!1,void 0,this)},void 0,!1,void 0,this),A&&a&&bt.jsxDEV(yn,{title:"Save your version over the latest?",titleId:"apply-kept-version",mark:"↑",cancelLabel:"Not now",confirmLabel:"Save over latest",onCancel:()=>C(!1),onConfirm:()=>void V("apply"),children:bt.jsxDEV("p",{children:"This replaces the latest saved version with the version you tried to save. The latest version's changes are overwritten."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var es=Y(he(),1);function sz(e){let{editor:i,syncStatus:o,hasUnsavedChanges:l,dispatchEditor:a}=e,{mode:u,draft:f,body:h,save:p}=i,{entitySchema:g,presentation:y,canEdit:v}=e.model,S=v||y==="split"?ly(i,e.model,l):void 0;return es.jsxDEV("footer",{className:re("",mn.pipeline,Gn.pipeline),"data-studio-save-bar":"",children:[es.jsxDEV("div",{children:[es.jsxDEV("span",{"data-studio-save-state":"",className:re("",Gn.saveState),children:[es.jsxDEV("span",{role:"status","aria-live":"polite",title:"Saved means stored in this Brain. File export and Git synchronization are separate.",children:!v&&y!=="split"?"Read-only":a2(p,l,u.kind!=="create"?"edit":g.isSingleton?"first-save":"create")},void 0,!1,void 0,this),S&&es.jsxDEV("span",{id:sy,children:S},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.readError&&es.jsxDEV(ve,{tone:"error",children:["Your draft is unchanged. ",e.readError,es.jsxDEV(we,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),es.jsxDEV(r2,{state:o?.directorySync&&p.kind==="saved"&&!p.noop?{kind:"idle"}:p,conflictActions:u.kind==="edit"?es.jsxDEV(oz,{entity:u.entity,draft:f,body:h,...p.kind==="conflict"&&p.conflictId!==void 0&&{conflictId:p.conflictId},onUseLatest:(w)=>a({type:"documentOpened",document:Vc(w)})},`${u.entity.entityType}:${u.entity.id}`,!1,void 0,this):void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.ask&&u.kind==="edit"&&e.model.canAssist&&es.jsxDEV(yy,{ask:e.ask,placement:"bar"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var by={section:{keoZOQ:"x1tfhste",kLKAdn:"x1cnzs8",kg3NbH:"xr244g7",$$css:!0},head:{k1xSpc:"x78zum5",kGNEyG:"x1pha0wt",kOIVth:"x1v2ro7d",k1K539:"x1e56ztr",$$css:!0},count:{kMv6JI:"x5ddh9m",kGuDYH:"x4z9k3i",kMwMTN:"x1ar3pfp",$$css:!0}};var Vs=Y(he(),1);function rI(e){let{page:i}=e;return Vs.jsxDEV("section",{"data-studio-collection-members":"","aria-labelledby":"studio-collection-members",className:re("",by.section),children:[Vs.jsxDEV("div",{className:re("",by.head),children:[Vs.jsxDEV("h2",{id:"studio-collection-members",className:re("",Vn.eyebrow),children:"Members"},void 0,!1,void 0,this),Vs.jsxDEV("span",{className:re("",by.count),children:i.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.entities.map((o,l)=>Vs.jsxDEV("a",{href:$n(Hs(),o.entityType,o.id),"data-studio-record":"",className:re("",Ae.row,Ae.recordLink,mn.listingRow),onClick:(a)=>{if(!kl(a))return;a.preventDefault(),e.onOpen(o.id,o.entityType)},children:[Vs.jsxDEV("span",{className:re("",Ae.index),children:String(l+1).padStart(2,"0")},void 0,!1,void 0,this),Vs.jsxDEV("span",{className:re("",Ae.title),title:o.id,children:Ri(o,o.path?.at(-1))},void 0,!1,void 0,this),Vs.jsxDEV("time",{className:re("",Ae.updated),dateTime:o.updated,children:za(o.updated)},void 0,!1,void 0,this)]},JSON.stringify([o.entityType,o.id]),!0,void 0,this))]},void 0,!0,void 0,this)}function lz(e){let i=Kt(),{data:o}=fn({queryKey:["studio","collection-members",e.entityType,e.entityId],queryFn:()=>i.fetchCollectionMembers(e.entityType,e.entityId)});return o?Vs.jsxDEV(rI,{page:o,onOpen:e.onOpen},void 0,!1,void 0,this):null}var vy=Y(ft(),1),Cx=(e)=>`studio.inspector.${e}`;function rz(e){try{return window.localStorage.getItem(Cx(e))==="hidden"}catch{return!1}}function az(e){let[i,o]=vy.useState(()=>({entityType:e,hidden:rz(e)})),l=i.entityType===e?i:{entityType:e,hidden:rz(e)};if(l!==i)o(l);let a=vy.useCallback((u)=>{o({entityType:e,hidden:u});try{if(u)window.localStorage.setItem(Cx(e),"hidden");else window.localStorage.removeItem(Cx(e))}catch{}},[e]);return[l.hidden,a]}var xy=Y(ft(),1);var uz={list:{k1xSpc:"xrvj5dj",kumcoG:"xrwz996",kOIVth:"xfe5i6u",kogj98:"x1ghz6dp",$$css:!0},keys:{kMv6JI:"xa9opjo",kGuDYH:"xfifm61",kMwMTN:"x1ar3pfp",$$css:!0},row:{k1xSpc:"xjp7ctv",$$css:!0},action:{kogj98:"x1ghz6dp",$$css:!0}};var Gs=Y(he(),1),aI=[["Ctrl+S or ⌘S","Save changes"],["Ctrl+\\ or ⌘\\","Show or hide Details"],["Ctrl+K or ⌘K","Search or do anything"],["?","Show these shortcuts"]],Sy=uz;function uI(e){return e instanceof HTMLElement&&(e.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(e.tagName))}function dz(){let[e,i]=xy.useState(!1);return xy.useEffect(()=>{let o=(l)=>{if(l.key!=="?"||uI(l.target))return;l.preventDefault(),i(!0)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[]),Gs.jsxDEV(Qc,{open:e,onOpenChange:i,children:Gs.jsxDEV(Wc,{children:[Gs.jsxDEV(cz,{children:[Gs.jsxDEV(Yc,{children:"Keyboard shortcuts"},void 0,!1,void 0,this),Gs.jsxDEV(fz,{children:"While an entry is open."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Gs.jsxDEV("dl",{...N(Sy.list),children:aI.map(([o,l])=>Gs.jsxDEV("div",{...N(Sy.row),children:[Gs.jsxDEV("dt",{...N(Sy.keys),children:o},void 0,!1,void 0,this),Gs.jsxDEV("dd",{...N(Sy.action),children:l},void 0,!1,void 0,this)]},l,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var _r=Y(he(),1);function pz(e){return _r.jsxDEV(hy,{children:[_r.jsxDEV(py,{className:hz("ghost","icon"),"aria-label":"More document actions",children:"•••"},void 0,!1,void 0,this),_r.jsxDEV(my,{align:"end",children:_r.jsxDEV(gy,{variant:"destructive",onSelect:e.onDelete,children:"Delete entry"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function mz(e){let{syncStatus:i}=e;if(!i?.directorySync)return null;return _r.jsxDEV("details",{"data-studio-sync-details":"",children:[_r.jsxDEV("summary",{children:"Sync details"},void 0,!1,void 0,this),_r.jsxDEV(u2,{view:hg({save:e.editor.save,git:i.git,baselineCommit:e.baselineCommit}),gitConfigured:i.git!==null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Pe=Y(he(),1);function Ax(e){let{editor:i,bodyMode:o,mobilePane:l,hasUnsavedChanges:a,dispatchEditor:u,setBodyMode:f,setMobilePane:h,backToList:p,performPublishingAction:g,save:y}=e,{mode:v,body:S,save:w}=i,{entitySchema:A,presentation:C,selectedEntityType:D,systemDesign:M,canEdit:H,namedCreate:V,fieldIssues:q,hierarchyKind:j,canPublish:G,canAssist:se,collectionLabel:ce,publicationWorkspace:He,publicationState:U,editorHead:pe}=e.model,ye=Sx(i,e.model,a),ae=ly(i,e.model,a),vt=v.kind==="create"&&!A.isSingleton,W=C==="split",[oe,ee]=az(D),fe=e.ask?.open===!0&&v.kind==="edit"&&se,me=oe||fe,Ye=(Oe)=>{if(!Oe&&fe)e.ask?.setOpen(!1);ee(Oe)},Le=H?$c(A,C):void 0,dt=typeof i.draft.title==="string"?i.draft.title:"",tt=Le?Pe.jsxDEV(HL,{descriptor:Le,value:dt,placeholder:`Untitled ${e.model.entryLabel.toLowerCase()}`,issues:q,onChange:(Oe)=>u({type:"fieldChanged",descriptor:Le,raw:Oe})},void 0,!1,void 0,this):void 0;function Ie(Oe){let Xn=Oe.currentTarget.querySelector("input:invalid, select:invalid, textarea:invalid");if(Xn&&!Xn.closest("[data-studio-properties]"))return;UL(Oe.currentTarget);let Ro=W&&me;if(l==="details"&&!Ro)return;Oe.preventDefault();let os=Oe.currentTarget.querySelector("input:invalid, select:invalid, textarea:invalid");if(Oe.target!==os)return;if(h("details"),Ro)Ye(!1);requestAnimationFrame(()=>{if(os.isConnected)os.focus(),os.reportValidity()})}let Yt=wy.useRef(null);wy.useEffect(()=>(document.addEventListener("keydown",Sn),()=>document.removeEventListener("keydown",Sn)));function Sn(Oe){if(W&&(Oe.ctrlKey||Oe.metaKey)&&!Oe.altKey&&!Oe.shiftKey&&Oe.key==="\\"){Oe.preventDefault(),Ye(!me);return}if(!(Oe.ctrlKey||Oe.metaKey)||Oe.altKey||Oe.shiftKey||Oe.key.toLowerCase()!=="s")return;if(Oe.target instanceof HTMLElement&&Oe.target.closest('[role="dialog"], [role="alertdialog"]'))return;if(Oe.preventDefault(),!ye)Yt.current?.requestSubmit()}return Pe.jsxDEV("form",{role:"main","aria-label":"Document editor",className:re("",Gn.editor,C!=="split"&&Ps.editor),"data-studio-editor":"","data-editor-presentation":C,"data-mobile-pane":C==="split"?l:void 0,"data-inspector":W?me?"hidden":"shown":void 0,onInvalidCapture:Ie,onSubmit:(Oe)=>{if(Oe.preventDefault(),!ye)y()},ref:Yt,children:Pe.jsxDEV(gz,{value:w.kind==="error"?"save":"check",children:[Pe.jsxDEV(Is,{model:pe,appearance:"document",titleEditor:tt,navigation:!A.isSingleton?Pe.jsxDEV(we,{type:"button",variant:"ghost",onClick:p,"aria-label":`Back to ${e.groupReturnLabel??ce}`,children:[Pe.jsxDEV("span",{"aria-hidden":"true",children:"←"},void 0,!1,void 0,this)," Back to"," ",e.groupReturnLabel??ce]},void 0,!0,void 0,this):void 0,action:H||C==="split"?Pe.jsxDEV(Pe.Fragment,{children:[e.ask&&v.kind==="edit"&&se&&Pe.jsxDEV(yy,{ask:e.ask,placement:"head"},void 0,!1,void 0,this),W&&Pe.jsxDEV(we,{type:"button",variant:"ghost",className:"studio-inspector-toggle",xstyle:Gn.inspectorToggle,"aria-pressed":!me,"aria-keyshortcuts":"Control+Backslash Meta+Backslash",title:"Details (Ctrl+\\\\ or ⌘\\\\)",onClick:()=>Ye(!me),children:"Details"},void 0,!1,void 0,this),Pe.jsxDEV(we,{type:"submit",className:"studio-editor-head-save",variant:a?"default":"outline",title:`${vt?"Create":"Save changes"} (Ctrl+S or ⌘S)`,"aria-keyshortcuts":"Control+s Meta+s",disabled:ye,...ae&&{"aria-describedby":sy},children:w.kind==="saving"?vt?"Creating…":"Saving…":vt?"Create":"Save changes"},void 0,!1,void 0,this),v.kind==="edit"&&!A.isSingleton&&e.model.canDelete&&Pe.jsxDEV(pz,{onDelete:()=>u({type:"deleteRequested"})},void 0,!1,void 0,this)]},void 0,!0,void 0,this):void 0},void 0,!1,void 0,this),e.draftRecovery?.offer&&Pe.jsxDEV("div",{"data-studio-draft-offer":"",children:Pe.jsxDEV(ve,{className:re("",li.inset),children:["Unsaved changes from"," ",Pe.jsxDEV("time",{dateTime:new Date(e.draftRecovery.offer.savedAt).toISOString(),children:new Date(e.draftRecovery.offer.savedAt).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})},void 0,!1,void 0,this)," ","were kept in this browser."," ",Pe.jsxDEV(we,{type:"button",variant:"outline",onClick:e.draftRecovery.restore,children:"Restore"},void 0,!1,void 0,this)," ",Pe.jsxDEV(we,{type:"button",variant:"ghost",onClick:e.draftRecovery.discard,children:"Discard"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Pe.jsxDEV(yz,{active:V,split:C==="split",children:[v.kind==="create"&&V&&Pe.jsxDEV("div",{className:re("",li.inset,ts.destinationFrame),children:[Pe.jsxDEV(ky,{kind:j,collectionLabel:ce,collectionPath:e.collectionPath,query:{...e.collectionQuery,prefix:v.prefix??null},onNavigate:e.selectFolder,fixed:!0},void 0,!1,void 0,this),Pe.jsxDEV(bz,{kind:j,segment:v.segment??"",followsTitle:Le!==void 0&&v.segmentFollowsTitle===!0,onSegmentChange:(Oe)=>u({type:"segmentChanged",segment:Oe}),preview:e.creationDestination.data,pending:e.creationDestination.pending,error:e.creationDestination.error,issues:w.kind==="error"?w.issues:void 0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C==="split"&&Pe.jsxDEV(tz,{pane:l,hasBody:A.hasBody,onPane:h,onBodyMode:f},void 0,!1,void 0,this),Pe.jsxDEV(_L,{presentation:C,children:[M&&Pe.jsxDEV("p",{"data-studio-system-intro":"",...N(wt.intro),children:M.intro},void 0,!1,void 0,this),Pe.jsxDEV(qL,{presentation:C,hidden:W&&me,summaryDescription:M?A.fields.slice(0,3).map((Oe)=>Oe.label).join(" · "):void 0,reveal:C==="document"&&!i.body.trim()||(q?.length??0)>0,children:[C!=="document"&&!M&&Pe.jsxDEV("div",{className:re("",mn.propertiesHead),children:[Pe.jsxDEV("h2",{className:re("",mn.propertiesLabel,Vn.eyebrow),children:"Properties"},void 0,!1,void 0,this),v.kind==="create"||U?Pe.jsxDEV("span",{className:re("",mn.propertiesLabel,Vn.eyebrow),children:v.kind==="create"?"New":U},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),Pe.jsxDEV(JL,{...e},void 0,!1,void 0,this),Pe.jsxDEV(mz,{syncStatus:e.syncStatus,baselineCommit:e.baselineCommit,editor:i},void 0,!1,void 0,this),He&&v.kind==="edit"&&G&&Pe.jsxDEV(IL,{entityType:D,entityId:v.entity.id,title:Ri(v.entity),missing:(e.model.activeType?.publishRequires??[]).filter((Oe)=>{let Xn=v.entity.frontmatter[Oe];return Xn===void 0||Xn===null||typeof Xn==="string"&&Xn.trim()===""}),status:typeof v.entity.frontmatter.status==="string"?v.entity.frontmatter.status:"draft",unsaved:a,onAction:g},void 0,!1,void 0,this)]},ac(D,v),!0,void 0,this),A.hasBody&&Pe.jsxDEV("section",{className:re("",Gn.manuscript,C!=="split"&&Ps.manuscript),children:[M&&Pe.jsxDEV("header",{...N(wt.bodyHeading),children:[Pe.jsxDEV("h2",{...N(Vn.secondaryDisplay),children:M.bodyTitle},void 0,!1,void 0,this),Pe.jsxDEV("p",{...N(wt.description),children:M.bodyDescription},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Pe.jsxDEV(NL,{value:S,mode:o,singlePane:C!=="split",onChange:(Oe)=>u({type:"bodyChanged",body:Oe}),onModeChange:f,readOnly:!H,documentTitle:Le?dt:pe.title,onSelectionChange:e.ask?.setSelection},void 0,!1,void 0,this),v.kind==="edit"&&e.model.activeType?.collection&&Pe.jsxDEV(lz,{entityType:D,entityId:v.entity.id,onOpen:e.openEntity},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Pe.jsxDEV(sz,{...e},void 0,!1,void 0,this),Pe.jsxDEV(dz,{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var Cy=Y(ft(),1),Tx="studio.density";function cI(){try{return window.localStorage.getItem(Tx)==="compact"?"compact":"comfortable"}catch{return"comfortable"}}function fI(e){try{if(e==="compact")window.localStorage.setItem(Tx,e);else window.localStorage.removeItem(Tx)}catch{}}function vz(){let[e,i]=Cy.useState(cI),o=Cy.useCallback((l)=>{i(l),fI(l)},[]);return[e,o]}var De=Y(he(),1);function Dz(e){let{entities:i,entityOffset:o,entityLimit:l,entityTotal:a,entityListLoading:u,schema:f,changeEntityPage:h,startCreate:p}=e,{activeType:g,entitySchema:y,systemDesign:v,canCreate:S,hierarchyKind:w,folderContext:A,collectionLabel:C,entryLabel:D,pageEnd:M,collectionFiltered:H,listingHead:V}=e.model,q=WD({activeType:g,entityType:e.entityType,entities:i,entityOffset:o,entryLabel:D,collectionLabel:C,onConfirmed:e.onRefineConfirmed}),j=q.picked.length>0,[G,se]=vz(),ce=y.fields.some((ae)=>ae.column==="excerpt"||ae.column==="cover"),He=ce&&G==="compact",U=!He&&(i??[]).some((ae)=>Dx(ae,y.fields)),pe=PD(q.picked.length,D,C),ye=g?.refinesInto;return De.jsxDEV("main",{className:re("",Ae.listing,li.inset,(S||j)&&ts.withMobileBar),"data-studio-library":"","aria-busy":u,onKeyDown:(ae)=>{if(ae.key==="Escape"&&j&&!q.asking)q.clear()},children:[e.readError&&De.jsxDEV(ve,{tone:"error",children:[i?.length?"Showing previously loaded entries. ":"",e.readError,De.jsxDEV(we,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),De.jsxDEV(Is,{model:j?{...V,metadata:[$D(q.picked.length,a)]}:V,action:j?De.jsxDEV(De.Fragment,{children:[De.jsxDEV(we,{type:"button",variant:"ghost",xstyle:ts.desktopCreateAction,onClick:q.clear,children:"Cancel"},void 0,!1,void 0,this),De.jsxDEV(we,{type:"button","data-studio-library-refine":"",xstyle:ts.desktopCreateAction,onClick:q.ask,children:pe},void 0,!1,void 0,this)]},void 0,!0,void 0,this):(!v||S)&&De.jsxDEV(we,{type:"button",disabled:!S||!f,"data-studio-library-new":"",xstyle:ts.desktopCreateAction,onClick:p,children:["New ",no(D)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),De.jsxDEV(XD,{notice:e.refineNotice??null},void 0,!1,void 0,this),q.refusal&&De.jsxDEV(ve,{tone:"error",children:q.refusal},void 0,!1,void 0,this),v&&De.jsxDEV("p",{"data-studio-system-intro":"",...N(wt.collectionIntro),children:v.intro},void 0,!1,void 0,this),De.jsxDEV(ky,{kind:w,collectionLabel:C,collectionPath:e.collectionPath,query:e.collectionQuery,trail:e.collectionTrail,onNavigate:e.selectFolder},void 0,!1,void 0,this),!y.isSingleton&&De.jsxDEV(Az,{kind:w,query:e.collectionQuery,fields:y.fields,total:a,onChange:e.onCollectionQueryChange,...ce&&{density:G,onDensityChange:se}},void 0,!1,void 0,this),!u&&De.jsxDEV(Ez,{kind:w,folders:e.folders,collectionPath:e.collectionPath,query:e.collectionQuery,onNavigate:e.selectFolder},void 0,!1,void 0,this),e.folders.length>0&&a>0&&De.jsxDEV("div",{className:re("",ts.label),children:[De.jsxDEV("span",{children:"Entries here"},void 0,!1,void 0,this),De.jsxDEV("span",{children:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!y.isSingleton&&a>0&&De.jsxDEV(rg,{label:`${g?.label??"Entity"} pagination`,offset:o,count:Math.max(0,M-o),total:a,loading:u,hasNext:o+l<a,onPrevious:()=>h(Math.max(0,o-l)),onNext:()=>h(o+l)},void 0,!1,void 0,this),u&&De.jsxDEV(ve,{className:re("",Ae.empty),children:"Loading entries…"},void 0,!1,void 0,this),!u&&(i??[]).map((ae,vt)=>De.jsxDEV(dI,{entity:ae,index:String(o+vt+1).padStart(2,"0"),view:e,refine:q,picking:j,compact:He,covers:U},ae.id,!1,void 0,this)),!e.readError&&!u&&i?.length===0&&e.folders.length===0&&De.jsxDEV(ve,{className:re("",Ae.empty),children:[e.collectionQuery.q||e.collectionQuery.status||e.collectionQuery.visibility!=="all"?"No entries match these filters. Clear or change the filters to try again.":S?"Nothing here yet — start the first entry.":"No entries are available in this collection.",H&&e.collectionQuery.prefix&&e.collectionQuery.scope==="folder"&&De.jsxDEV(we,{type:"button",variant:"ghost",onClick:()=>e.onCollectionQueryChange({...e.collectionQuery,scope:"collection",offset:0}),children:"Search whole collection"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j?De.jsxDEV("div",{"data-studio-refine-action":!0,className:re("",ts.mobileBar),children:[De.jsxDEV(we,{type:"button",variant:"ghost",onClick:q.clear,children:"Cancel"},void 0,!1,void 0,this),De.jsxDEV(we,{type:"button",onClick:q.ask,children:pe},void 0,!1,void 0,this)]},void 0,!0,void 0,this):S&&De.jsxDEV("div",{"data-studio-folder-action":!0,className:re("",ts.mobileBar),children:[De.jsxDEV("span",{children:["Creating in ",De.jsxDEV("strong",{children:A},void 0,!1,void 0,this)]},void 0,!0,void 0,this),De.jsxDEV(we,{type:"button",onClick:p,disabled:!f,children:["New ",no(D)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q.asking&&e.entityType&&ye&&De.jsxDEV(FD,{entityType:e.entityType,entryLabel:D,collectionLabel:C,targetLabel:ye.label,picked:(i??[]).filter(({id:ae})=>q.picked.includes(ae)),onCancel:q.closeAsk,onRefused:q.refused,onConfirmed:(ae)=>{q.confirmed(ae),e.selectEntityType(ye.entityType)}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function dI(e){let{entity:i,view:o,refine:l}=e,{systemDesign:a,entitySchema:u}=o.model,f=o.collectionQuery,h=Ri(i,i.path?.at(-1)),p=wz(i),g=Sz(i,u.fields),y=kz(i,u.fields),v=e.compact?null:xz(i,u.fields),S=e.covers,w=Dx(i,u.fields),A=S&&De.jsxDEV("span",{"data-studio-row-cover":"","aria-hidden":"true",...N(Ae.cover),children:w&&De.jsxDEV(ug,{imageId:w,thumbnailWidth:ag,alt:"",placeholder:De.jsxDEV("span",{...N(Ae.coverPending)},void 0,!1,void 0,this),...N(Ae.coverImage)},void 0,!1,void 0,this)},void 0,!1,void 0,this),C=()=>o.openEntity(i.id,i.entityType),D=$n(Hs(),i.entityType,i.id),M=(V)=>{if(!kl(V))return;V.preventDefault(),C()},H=De.jsxDEV("span",{className:re("",Ae.title),title:i.id,children:[h,(f.q||f.scope==="collection")&&i.path&&i.path.length>1&&De.jsxDEV("span",{className:re("",ts.context),children:i.path.slice(0,-1).map(Tz).join(" / ")},void 0,!1,void 0,this),v&&De.jsxDEV("span",{"data-studio-row-excerpt":"",...N(Ae.excerpt),children:v},void 0,!1,void 0,this),g&&De.jsxDEV("span",{className:re("studio-publication-state",mn.publication,e.compact&&Ae.inlineStatus),children:Cz(g)},void 0,!1,void 0,this),p&&De.jsxDEV("span",{"data-studio-generation":p,className:re("",mn.publication),children:p},void 0,!1,void 0,this),i.members&&De.jsxDEV("span",{"data-studio-row-members":"",className:re("",Ae.members),children:i.members.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(l.available&&!a){let V=l.picked.includes(i.id);return De.jsxDEV("div",{"data-studio-row":"",...e.picking&&{"data-picking":""},className:re("",Ae.row,mn.listingRow,Pn.row,S&&Ae.covered,e.compact&&Ae.compact,V&&Pn.rowPicked),children:[De.jsxDEV(YD,{index:e.index,title:h,picked:V,onToggle:()=>l.toggle(i.id)},void 0,!1,void 0,this),De.jsxDEV("a",{href:D,"data-studio-record":"",...N(Pn.open),onClick:M,children:[A,H,De.jsxDEV("time",{className:re("",Ae.updated,Pn.updated),dateTime:y.iso,title:y.iso,children:Ex(y)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}return De.jsxDEV("a",{href:D,className:re("",Ae.row,Ae.recordLink,mn.listingRow,S&&Ae.covered,e.compact&&Ae.compact),"data-studio-record":"",onClick:M,children:[De.jsxDEV("span",{className:re("",Ae.index),children:e.index},void 0,!1,void 0,this),A,H,De.jsxDEV("time",{className:re("",Ae.updated),dateTime:y.iso,title:y.iso,children:Ex(y)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var hI={surface:{kzqmXN:"xh8yej3",kB7OPa:"x9f619",k7Eaqz:"xeuugli",kAzted:"x2lwn1j",kGO01o:"x1sgudl8",kORKVm:"x1odjw0f",kh9fTk:"x1c54s19",kKq9zD:"xiqhxos",k4sGnE:"x11u2ate",kzrhLs:"x14214pg","--operator-section-spacing":"xn0jjtu","--operator-section-transform":"x6lesxo",$$css:!0}};function Rx(e){return`${e} ${N(hI.surface,li.inset,Vn.operatorRoles).className??""}`}var Mx=Y(ft(),1);function pI(e){return Mx.createElement(Rz,{...e,children:Mx.createElement("div",N(Ae.readable),e.children)})}var Ox={engine:"app",density:"comfortable",Button:we,Input:Eh,Select:La,Textarea:cg,ConfirmDialog:yn,Disclosure:pI,Tabs:Mz};var ns=Y(he(),1);function Nz(e){let{activeWorkspaceId:i,workspaceError:o,declarativeWorkspaceData:l,workspaceQuery:a,openWorkspaceEntity:u,openWorkspaceLaunch:f,performDeclarativeAction:h,onWorkspaceQueryChange:p}=e,{declarativeHead:g}=e.model;return o&&!l?ns.jsxDEV("main",{className:Rx(""),children:ns.jsxDEV(ve,{tone:"error",children:[o,ns.jsxDEV(we,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this):l&&g?ns.jsxDEV("div",{className:Rx("studio-workspace-frame"),children:[o&&ns.jsxDEV(ve,{tone:"error",children:["Showing previously loaded content. ",o,ns.jsxDEV(we,{type:"button",variant:"ghost",onClick:e.onRetryRead,children:"Retry"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ns.jsxDEV(Is,{model:g,...l.view.headQuery&&i?{control:ns.jsxDEV(Oz,{control:l.view.headQuery,query:a,onQueryChange:(y)=>p(i,y,y)},void 0,!1,void 0,this)}:{},...g.primaryAction?{action:ns.jsxDEV(Lz,{action:g.primaryAction,primary:!0,onAction:h,components:Ox},void 0,!1,void 0,this)}:{}},void 0,!1,void 0,this),ns.jsxDEV(zz,{data:l,components:Ox,renderHead:!1,onOpenEntity:u,onLaunch:f,onAction:h,query:a,...i?{onQueryChange:(y)=>p(i,y,y)}:{}},i,!1,void 0,this)]},void 0,!0,void 0,this):null}var gt=Y(he(),1);function qz(e,i,o=!1){if(!e.hasBody)return"details";return i??(o?"write":"preview")}function Ya(e){return gt.jsxDEV("div",{className:re("studio",Ae.frame,Vn.operatorRoles,Ty.space),"data-studio-shell":"",children:[gt.jsxDEV(Ey,{contextLabel:"Studio"},void 0,!1,void 0,this),gt.jsxDEV("main",{"aria-label":"Studio status",children:[gt.jsxDEV(ve,{tone:e.error?"error":void 0,className:re("",Ae.boot),children:[e.message,e.onRetry&>.jsxDEV(we,{type:"button",variant:"ghost",onClick:e.onRetry,children:"Retry"},void 0,!1,void 0,this),e.onHome&>.jsxDEV(we,{type:"button",variant:"ghost",onClick:e.onHome,children:"Open Studio"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.children&>.jsxDEV("div",{className:re("",Ae.boot),children:e.children},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function $z(e){let i=Lx();return gt.jsxDEV("div",{className:re("studio",Ae.frame,Vn.operatorRoles,Ty.space),"data-view":"account","data-studio-shell":"",children:[gt.jsxDEV(Ey,{contextLabel:"Account",navigation:{types:e.types,workspaces:e.workspaces,activeEntityType:null,activeWorkspaceId:e.workspaceId,workspaceBadges:Ay(e.workspaces),selectEntityType:e.selectEntityType,selectWorkspace:e.selectWorkspace}},void 0,!1,void 0,this),gt.jsxDEV("div",{className:Oh("",Gn.body,Wa.shell,i&&Wa.shellCollapsed),"data-studio-body":"",children:[gt.jsxDEV("aside",{className:Oh("rail",Wa.rail),children:gt.jsxDEV(zx,{renderMode:"desktop",types:e.types,active:null,onSelect:e.selectEntityType,workspaces:e.workspaces,activeWorkspace:e.workspaceId,workspaceBadges:Ay(e.workspaces),onSelectWorkspace:e.selectWorkspace},void 0,!1,void 0,this)},void 0,!1,void 0,this),gt.jsxDEV("main",{className:Hz("account-studio-pane",Bz.pane),children:e.children},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Pz(e){let i=Lx(),{activeWorkspaceId:o,types:l,workspaces:a,entityType:u,editor:f,deleting:h,navigationBlocked:p,dispatchEditor:g,selectEntityType:y,selectWorkspace:v,remove:S,onNavigationReset:w,onNavigationProceed:A}=e,{mode:C,deleteOpen:D}=f,M=_z(e),H=gI(e,M),{editing:V,canDelete:q,collectionLabel:j,workspaceBadges:G}=M;return gt.jsxDEV("div",{className:re("studio",Ae.frame,Vn.operatorRoles,Ty.space),"data-studio-shell":"","data-view":e.groupingView?"grouping":e.imagesView?"images":o?"workspace":V?"editor":"listing",children:[gt.jsxDEV(Ey,{pageTitle:V?M.editorHead.title:void 0,contextLabel:e.groupReturnLabel??(e.images?.active?"Images":void 0)??e.groupings?.items.find((se)=>se.key===e.groupings?.active)?.label??j,navigation:{groupings:e.groupings,images:e.images,types:l,workspaces:a,activeEntityType:o||e.groupings?.active||e.images?.active?null:u,activeWorkspaceId:o,workspaceBadges:G,selectEntityType:y,selectWorkspace:v,editing:V}},void 0,!1,void 0,this),gt.jsxDEV("div",{className:Oh("",Gn.body,Wa.shell,i&&Wa.shellCollapsed),"data-studio-body":"",children:[gt.jsxDEV("aside",{className:Oh("rail",Wa.rail),children:gt.jsxDEV(zx,{renderMode:"desktop",focus:V,groupings:e.groupings,images:e.images,types:l,active:o||e.groupings?.active||e.images?.active?null:u,onSelect:y,workspaces:a,activeWorkspace:o,workspaceBadges:Ay(a),onSelectWorkspace:v},void 0,!1,void 0,this)},void 0,!1,void 0,this),e.groupingView??e.imagesView??e.homeView??(o?gt.jsxDEV(Nz,{...e,model:M},void 0,!1,void 0,this):!V?gt.jsxDEV(Dz,{...e,model:M},void 0,!1,void 0,this):H?gt.jsxDEV("div",{...N(jc.row),children:[gt.jsxDEV("div",{...N(jc.grow),children:gt.jsxDEV(Ax,{...e,model:M},void 0,!1,void 0,this)},void 0,!1,void 0,this),H]},void 0,!0,void 0,this):gt.jsxDEV(Ax,{...e,model:M},void 0,!1,void 0,this))]},void 0,!0,void 0,this),D&&C.kind==="edit"&&q&>.jsxDEV(c2,{title:Ri(C.entity),deleting:h,onCancel:()=>g({type:"deleteCancelled"}),onConfirm:S},void 0,!1,void 0,this),p&>.jsxDEV(yn,{mark:"↩",title:"Discard unsaved changes?",titleId:"discard-navigation-title",cancelLabel:"Keep editing",confirmLabel:"Discard and continue",confirmVariant:"danger",onCancel:w,onConfirm:A,children:gt.jsxDEV("p",{children:"This draft has not been saved. Continue only if you want to leave it behind."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var mI=Dy.lazy(async()=>({default:(await import("./studio-chunks/studio-ask-panel-fxkbrg2k.js")).StudioAskPanel}));function gI(e,i){let{ask:o,editor:l,dispatchEditor:a}=e,{mode:u,body:f}=l;if(!o?.open||u.kind!=="edit"||!i.canAssist)return null;let h=i.entitySchema.fields,p=(g,y)=>{if(g.field==="selection"){let S=y?Iz(f,y,g.text):null;if(S===null)return"The selected passage has changed. Select it again and ask once more.";return a({type:"bodyChanged",body:S}),null}if(g.field==="body")return a({type:"bodyChanged",body:g.text}),null;let v=h.find((S)=>S.name===g.field);if(!v)return`This entry has no ${g.label.toLowerCase()}.`;return a({type:"fieldChanged",descriptor:v,raw:g.text}),null};return gt.jsxDEV(Dy.Suspense,{fallback:null,children:gt.jsxDEV(mI,{chatApiPath:o.chatApiPath,draftStore:o.draftStore,entityType:i.selectedEntityType,entityId:u.entity.id,title:i.editorHead.title,typeLabel:i.entryLabel.toLowerCase(),savedBody:u.entity.body,unsaved:e.hasUnsavedChanges,selection:o.selection,onClearSelection:()=>o.setSelection(null),fields:Uz(h),agents:e.agentTargets,onApply:p,onClose:()=>o.setOpen(!1)},`${i.selectedEntityType}:${u.entity.id}`,!1,void 0,this)},void 0,!1,void 0,this)}var Hi=Y(ft(),1);function jz(e,i){return e.toLowerCase().includes(i.toLowerCase())}function Vz(e){let i=e.query.trim(),o=e.openEntry&&e.hasChat?[{id:"ask-entry",title:`Ask about this ${e.openEntry.typeLabel}`,kbd:"⌘J",command:{kind:"ask-entry"}}].filter((g)=>!i||jz(g.title,i)):[],l=e.types.filter((g)=>g.canCreate&&!g.isSingleton&&g.classification!=="system").map((g)=>({id:`create:${g.entityType}`,title:`New ${g.singularLabel.toLowerCase()}`,command:{kind:"create",entityType:g.entityType}})),a={id:"climate",title:"Switch light and dark",command:{kind:"climate"}},u=i?[...[...l,a].filter((g)=>jz(g.title,i)),...e.hasChat?[{id:"ask-brain",title:`Ask your brain “${i}”`,command:{kind:"ask-brain",question:i}}]:[]]:[...l.slice(0,3),a],f=(e.remote?.groups??[]).map((g)=>({id:g.id,label:g.label,items:g.items.map((y)=>({id:`${g.id}:${y.id}`,title:y.title,sub:y.sub,command:y.run?{kind:"run",...y.run,href:y.href}:{kind:"open",href:y.href}}))})),h=f.filter((g)=>g.id==="actions").flatMap((g)=>g.items),p=[...u,...h];return[...o.length>0&&e.openEntry?[{id:"for-open",label:`For this ${e.openEntry.typeLabel}`,items:o}]:[],...p.length>0?[{id:"actions",label:"Actions",items:p}]:[],...f.filter((g)=>g.id!=="actions")].filter((g)=>g.items.length>0)}function Gz(e,i,o){if(o===0)return-1;return((e+i)%o+o)%o}var Bi={content:{kB7OPa:"x9f619",kzqmXN:"xcs98ov",kskxy:"xu180u2",kmVPX3:"x1717udv",k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kVQacm:"xb3r6kr",kMv6JI:"x5ddh9m",$$css:!0},field:{k8WAf4:"x10dr8xq",kg3NbH:"x1hr3lfm",kt9PQ7:"xso031l",kfdmCh:"x1q0q8m5",kL6WhQ:"xpqg30t",$$css:!0},input:{kB7OPa:"x9f619",kzqmXN:"xh8yej3",kMzoRj:"xc342km",ksu8eU:"xng3xce",k3XXqK:"x1t137rt",kWkggS:"xjbqb8w",kMwMTN:"xqvuw85",kMv6JI:"x5ddh9m",kGuDYH:"x1j61zf2",$$css:!0},list:{kORKVm:"x1odjw0f",k8WAf4:"x1t0vds8",kogj98:"x1ghz6dp",$$css:!0},section:{k8WAf4:"x12ulsxz",$$css:!0},label:{kogj98:"x1ghz6dp",k8WAf4:"x1t0vds8",kg3NbH:"x1hr3lfm",kGuDYH:"x1j6dyjg",kb6lSQ:"x1vyo3qp",kP9fke:"xtvhhri",kMwMTN:"xqvuw85",kMv6JI:"xa9opjo",$$css:!0},item:{k1xSpc:"x78zum5",kGNEyG:"x1pha0wt",kOIVth:"x883omv",k8WAf4:"x1vvogim",kg3NbH:"x1hr3lfm",kMwMTN:"xqvuw85",kkrTdU:"x1ypdohk",$$css:!0},active:{kWkggS:"x9kxhyz",$$css:!0},title:{kGuDYH:"xif65rj",$$css:!0},sub:{kGuDYH:"xfifm61",kMwMTN:"xqvuw85",$$css:!0},kbd:{keTefX:"xvc5jky",kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg",kMwMTN:"xqvuw85",$$css:!0},empty:{kogj98:"x1ghz6dp",k8WAf4:"x1xn8qrt",kg3NbH:"x1hr3lfm",kGuDYH:"x4z9k3i",kMwMTN:"x1ar3pfp",$$css:!0}};var Yn=Y(he(),1),yI=150;function Wz(e){let i=Kt(),o=Hi.useId(),[l,a]=Hi.useState(!1),[u,f]=Hi.useState(""),[h,p]=Hi.useState(null),[g,y]=Hi.useState(0),[v,S]=Hi.useState(null),[w,A]=Hi.useState(null);Hi.useEffect(()=>{let j=(se)=>{if(se.key.toLowerCase()!=="k"||!(se.metaKey||se.ctrlKey)||se.altKey||se.shiftKey)return;se.preventDefault(),a((ce)=>!ce)},G=()=>a(!0);return window.addEventListener("keydown",j),window.addEventListener(Nx,G),()=>{window.removeEventListener("keydown",j),window.removeEventListener(Nx,G)}},[]),Hi.useEffect(()=>{if(!l)return;let j=!0,G=window.setTimeout(()=>{i.fetchPalette(u).then((se)=>{if(j)p(se)}).catch(()=>{if(j)p(null)})},yI);return()=>{j=!1,window.clearTimeout(G)}},[i,l,u]);let C=Hi.useMemo(()=>Vz({query:u,types:e.types,hasChat:e.hasChat,openEntry:e.openEntry,remote:h}),[u,e.types,e.hasChat,e.openEntry,h]),D=C.flatMap((j)=>j.items),M=Math.min(g,D.length-1),H=()=>{a(!1),f(""),y(0),A(null)},V=(j)=>{if(j.kind!=="run"){H(),e.onCommand(j);return}if(v)return;S(j.actionId),A(null),Promise.resolve(e.onCommand(j)).then(H).catch((G)=>A(Mi(G))).finally(()=>S(null))},q=(j)=>{if(j.key==="ArrowDown"||j.key==="ArrowUp")j.preventDefault(),y(Gz(M,j.key==="ArrowDown"?1:-1,D.length));else if(j.key==="Enter"){let G=D[M];if(!G)return;j.preventDefault(),V(G.command)}};return Yn.jsxDEV(Qc,{open:l,onOpenChange:(j)=>{if(!j)H()},children:Yn.jsxDEV(Wc,{"aria-describedby":void 0,"data-studio-palette":"",...N(Bi.content),children:[Yn.jsxDEV(Qz.Root,{children:Yn.jsxDEV(Yc,{children:"Search or run a command"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Yn.jsxDEV("div",{...N(Bi.field),children:Yn.jsxDEV("input",{...N(Bi.input),role:"combobox","aria-expanded":"true","aria-controls":o,"aria-activedescendant":D[M]?`${o}-${M}`:void 0,"aria-label":"Search or run a command",placeholder:"Search or do…",value:u,autoFocus:!0,onChange:(j)=>{f(j.currentTarget.value),y(0)},onKeyDown:q},void 0,!1,void 0,this)},void 0,!1,void 0,this),(v??w)&&Yn.jsxDEV("p",{...N(Bi.empty),role:"status",children:v?"Running…":w},void 0,!1,void 0,this),Yn.jsxDEV("div",{...N(Bi.list),id:o,role:"listbox",children:D.length===0?Yn.jsxDEV("p",{...N(Bi.empty),children:["Nothing matches “",u.trim(),"”."]},void 0,!0,void 0,this):C.map((j)=>Yn.jsxDEV("div",{role:"group","aria-labelledby":`${o}-${j.id}`,...N(Bi.section),children:[Yn.jsxDEV("div",{id:`${o}-${j.id}`,role:"presentation",...N(Bi.label),children:j.label},void 0,!1,void 0,this),j.items.map((G)=>{let se=D.indexOf(G);return Yn.jsxDEV("div",{id:`${o}-${se}`,role:"option","aria-selected":se===M,"data-palette-item":G.id,...N(Bi.item,se===M&&Bi.active),onMouseMove:()=>y(se),onClick:()=>V(G.command),children:[Yn.jsxDEV("span",{...N(Bi.title),children:G.title},void 0,!1,void 0,this),G.sub&&Yn.jsxDEV("span",{...N(Bi.sub),children:G.sub},void 0,!1,void 0,this),G.kbd&&Yn.jsxDEV("kbd",{...N(Bi.kbd),children:G.kbd},void 0,!1,void 0,this)]},G.id,!0,void 0,this)})]},j.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function Yz(e,i,o){return{studioChatHandoff:{version:1,sourceId:e,itemId:i,label:o,prompt:"Help me understand this Inbox item and decide what to do next."}}}function Xz(e){if(typeof e!=="object"||e===null)return null;let i=Reflect.get(e,"studioChatHandoff");if(typeof i!=="object"||i===null)return null;let o=Reflect.get(i,"version"),l=Reflect.get(i,"sourceId"),a=Reflect.get(i,"itemId"),u=Reflect.get(i,"label"),f=Reflect.get(i,"prompt");if(o!==1||typeof l!=="string"||!/^[a-z][a-z0-9-]*$/.test(l)||l.length>64||typeof a!=="string"||a.trim().length===0||a.length>300||typeof u!=="string"||u.trim().length===0||u.length>160||typeof f!=="string"||f.trim().length===0||f.length>1e4)return null;return{sourceId:l,itemId:a,label:u,prompt:f}}function qr(e){if(e instanceof jo)switch(e.status){case 401:return"Your session is no longer authenticated. Sign in again in another tab, then retry here. Keep this tab open to preserve your draft.";case 403:return"You do not currently have permission to read this content. Ask an administrator to check access, then retry.";case 404:return"This content is unavailable. It may have moved, been removed, or be outside your access. Choose another destination or retry.";case 429:return"Studio is receiving too many requests. Wait briefly before retrying."}return`Studio could not load this data. Check your connection or retry later. ${Mi(e)}`}var Ry=Y(ft(),1);var bI=to.parse({});function Fz(e){let i=Kt(),o=Ry.useMemo(()=>e.filter((h)=>!h.rules?.values),[e]),l=Ry.useMemo(()=>o.map((h)=>ig(i,h.key,bI)),[i,o]),a=cy({queries:l}),u={};a.forEach((h,p)=>{let g=o[p];if(g&&h.isSuccess&&h.data.kind==="catalog")u[g.field]=h.data.values.map((y)=>y.value)});let f=JSON.stringify(u);return Ry.useMemo(()=>JSON.parse(f),[f])}var Hx=Y(ft(),1);var Kz=new Set(["offset","limit"]);function Zz(e,i){if(e?.urlQuery!==!0)return{};let o={};for(let[l,a]of new URLSearchParams(i))if(!Kz.has(l))o[l]=a;return o}function Bx(e){let i=new URLSearchParams,o=Object.entries(e).filter(([a,u])=>!Kz.has(a)&&u!==void 0&&(typeof u!=="number"||Number.isFinite(u))).sort(([a],[u])=>a.localeCompare(u));for(let[a,u]of o)i.set(a,String(u));let l=i.toString();return l?`?${l}`:""}function Xa(e,i){return`${e}${Bx(i)}`}function My(e,i,o,l){if(l!==i)return;e.replace(Xa(i,o))}var vI=[],SI=[],xI=[],kI={};function a3(e){let{api:i,entityType:o,activeWorkspaceId:l,routeSearch:a,workspaceQueries:u,editor:f}=e,{mode:h,draft:p,body:g}=f,y=fn(o3(i)),v=y.data?.types??null,S=y.data?.groupings??vI,w=v?.find((In)=>In.entityType===o),A=v?w?.containedIn??o:null,C=w?.capabilities,D=Hx.useMemo(()=>w?.isSingleton?Xc("?scope=collection"):Xc(a),[w?.isSingleton,a]),M=D.offset,H=y.data?.workspaces??xI,V=H.find((In)=>In.id===l),q=V?.rendererName===Jz,j=V?.rendererName===Fc,G=V?.rendererName==="DeclarativeOperatorWorkspace"&&V.id!==Lh,se=l?u[l]:void 0,ce=V?.urlQuery!==!0||se?.urlSearch===a,He=Hx.useMemo(()=>Zz(V,a),[V,a]),U=l?se&&ce?se.query:He:kI,pe=fn({...s3(i,l??"",U),enabled:G}),ye=pe.data??null,ae=ye?.data??null,vt=pe.error?qr(pe.error):null,W=h.kind==="edit"?h.entity.id:null,oe=fn({...l3(i,o??"",W??""),enabled:o!==null&&W!==null&&C?.canAssist===!0&&C.canUpdate}),ee=oe.data??SI,fe=fn({...r3(i),enabled:o!==null}),me=fe.data??null,Ye=fn({...Ly(i,A??"",D),enabled:A!==null}),Le=A?Ye.data?.entities??null:null,dt=Ye.data?.total,tt=fn({...Oy(i,o??""),enabled:o!==null}),Ie=o?tt.data??null:null,Yt=bD(h),Sn=fn(i3(i,o&&Yt&&h.kind==="create"&&h.segment?{entityType:o,idPath:Yt,frontmatter:zy(Ie?.fields??[],p),...Ie?.hasBody&&{body:g}}:null));fn({...Kc(i,o??"",W??""),enabled:o!==null&&W!==null});let Oe=Ar({mutationFn:(In)=>n3(i,In)}),Xn=Ar({mutationFn:(In)=>t3(i,In)}),Ro=Ar({mutationFn:(In)=>e3(i,In)}),os=Xn.isPending,ne=G&&ye?ye.data:null;return{navigationQuery:y,types:v,groupings:S,activeType:w,collectionType:A,activeCapabilities:C,entityCollectionQuery:D,entityListOffset:M,workspaces:H,activeWorkspace:V,activeAccount:q,activeChat:j,activeDeclarativeWorkspace:G,storedWorkspaceQuery:se,storedQueryMatchesLocation:ce,initialUrlWorkspaceQuery:He,workspaceRequestQuery:U,workspaceQuery:pe,workspaceResponse:ye,workspaceData:ae,workspaceError:vt,activeEntityId:W,agentTargetsQuery:oe,agentTargets:ee,syncStatusQuery:fe,syncStatus:me,entityListQuery:Ye,entities:Le,entityListTotal:dt,entitySchemaQuery:tt,schema:Ie,createPath:Yt,destinationQuery:Sn,saveEntityMutation:Oe,deleteEntityMutation:Xn,declarativeWorkspaceActionMutation:Ro,deleting:os,declarativeWorkspaceData:ne}}var Do=Y(ft(),1);var u3=(e)=>mi.string().trim().min(1).max(e).refine((i)=>!/[\p{Cc}\p{Cf}]/u.test(i)),wI=(e)=>mi.string().trim().min(1).max(e).refine((i)=>Array.from(i).every((o)=>o===`
|
|
245
245
|
`||o==="\t"||!/[\p{Cc}\p{Cf}]/u.test(o))),CI=mi.strictObject({version:mi.literal(2),entityType:mi.literal("note"),title:u3(160),body:wI(1000).optional(),backlink:u3(500).regex(/^entity:\/\/[^/]+\/.+$/)}),Ix=mi.looseObject({studioCreatePrefill:CI});function c3(e,i,o){return Ix.parse({studioCreatePrefill:{version:2,entityType:"note",title:e,...o?{body:o}:{},backlink:i}})}function f3(e){let{history:i,studioBasePath:o,routeSearch:l,entityType:a,collectionType:u,entityCollectionQuery:f,groupReturnPath:h,workspaces:p,schema:g,activeCapabilities:y,pendingOpenState:v,setFieldAssistState:S,setWorkspaceQueries:w}=e,A=u??a,C=Do.useCallback((U,pe)=>{let ye=$n(o,U,pe);v.current={pathname:ye,save:{kind:"idle"}},i.push(ye,{studioCollectionPath:bi(o,U)})},[o,i]),D=Do.useCallback((U,pe,ye,ae)=>{i.push(By(o,"note"),c3(U,`entity://${encodeURIComponent(ye)}/${encodeURIComponent(ae)}`,pe))},[o,i]),M=Do.useCallback((U,pe,ye)=>{if(p.some((ae)=>ae.rendererName===Fc)){i.push(Ux(o),Yz(U,pe,ye));return}},[i,o,p]),H=Do.useCallback((U)=>{switch(U.target){case"account-settings":{i.push(yi(o,Ny));return}case"invitations":i.push(Xa(yi(o,"admin:administration"),{tab:"invitations"}));return;case"admin-peer-invite":{i.push(Xa(yi(o,"admin:administration"),{tab:"invitations",peerId:U.peerId,displayName:U.displayName}));return}case"inbox":{let pe={};if("source"in U){if(pe.sourceId="mail-items",U.filter==="high-priority")pe["facet.mail-priority"]="high";else if(U.filter==="needs-reply")pe["facet.needs-reply"]="true";else if(U.filter==="unclassified")pe["facet.category"]="unclassified"}i.push(Xa(yi(o,"unified-inbox:inbox"),pe));return}case"publishing":i.push(yi(o,"content-pipeline:publishing"));return;case"site":i.push(yi(o,"site-builder:site"));return;case"traffic":i.push(yi(o,"analytics:traffic"));return;case"board":i.push(yi(o,"action-board:board"));return;case"inbox-open-entity":C(U.entityType,U.entityId);return;case"inbox-capture-note":D(U.title,U.summary,U.entityType,U.entityId);return;case"inbox-discuss-in-chat":M(U.sourceId,U.itemId,U.label)}},[D,o,M,C,l,i]),V=Do.useCallback((U)=>{i.push(bi(o,U)),window.scrollTo({top:0,left:0})},[o,i]),q=Do.useCallback((U)=>{if(!A)return;i.push(`${bi(o,A)}${vi({...f,offset:U})}`),window.scrollTo({top:0,left:0})},[A,f,o,i]),j=Do.useCallback((U)=>{i.push(U===Hy?Ux(o):yi(o,U)),window.scrollTo({top:0,left:0})},[o,i]),G=Do.useCallback((U)=>{if(!A)return;i.push(`${bi(o,A)}${vi({...f,prefix:U,offset:0})}`),window.scrollTo({top:0,left:0})},[A,o,f,i]),se=Do.useCallback(()=>{if(!g||!a||y?.canCreate!==!0)return;let U=new URLSearchParams(vi(f));U.set("mode","create"),i.push(`${bi(o,a)}?${U.toString()}`,{studioCollectionPath:`${bi(o,a)}${vi(f)}`}),S({kind:"idle"})},[y,g,a,f,o,i]),ce=Do.useCallback(()=>{if(h){if(i.canGoBack())i.back();else i.replace(h);return}if(!A)return;let U=`${bi(o,A)}${vi(f)}`,pe=i.location.state;if(typeof pe==="object"&&pe!==null&&"studioCollectionPath"in pe&&pe.studioCollectionPath===U&&i.canGoBack()){i.back();return}i.replace(U)},[o,A,f,i,h]),He=Do.useCallback((U,pe,ye)=>{let ae=p.find((W)=>W.id===U),vt=ae?.urlQuery===!0?l:void 0;if(ae?.urlQuery===!0&&ye!==void 0){let W=yi(o,U);vt=Bx(ye),My(i,W,ye,window.location.pathname)}w((W)=>({...W,[U]:{query:pe,...vt!==void 0?{urlSearch:vt}:{}}}))},[o,l,i,p]);return{openWorkspaceEntity:C,captureInboxAsNote:D,discussInboxInChat:M,openWorkspaceLaunch:H,selectEntityType:V,changeEntityPage:q,selectWorkspace:j,selectFolder:G,startCreate:se,backToList:ce,changeWorkspaceQuery:He}}var Ii=Y(ft(),1);function d3(e){let{studioCreatePrefill:i,...o}=e;return o}function h3(e,i,o){let l=Ix.safeParse(e);if(!l.success||l.data.studioCreatePrefill.entityType!==i)return;return o(),{title:l.data.studioCreatePrefill.title,...l.data.studioCreatePrefill.body?{body:l.data.studioCreatePrefill.body}:{},backlink:l.data.studioCreatePrefill.backlink}}function p3(e,i){let o=Iy(e);if(!i)return{draft:o,body:""};if(e.some((a)=>a.name==="title"))o.title=i.title;let l=`## Source
|
|
246
246
|
|
|
247
247
|
[Open the Inbox item](${i.backlink})`;return{draft:o,body:i.body?`${i.body}
|
|
248
248
|
|
|
249
|
-
${l}`:l}}function AI(){let e=window.history.state;return qd(e)?e:{}}function m3(e){let{api:i,queryClient:o,history:l,studioBasePath:a,routeTarget:u,routePathname:f,routeSearch:h,currentStudioPathname:p,createMode:g,entityType:y,collectionType:v,activeType:S,entityCollectionQuery:w,preferredMobilePane:A,dispatchEditor:C,setMobilePane:D,setBodyMode:M,setFieldAssistState:H}=e,V=S?.capabilities.canCreate===!0,q=S?.hierarchy.nested!==!1,[j,G]=Ii.useState(null),[se,ce]=Ii.useState(0),He=Ii.useRef(null),U=Ii.useRef(0),pe=Ii.useRef(y);pe.current=y,Ii.useEffect(()=>{if(u.kind==="grouping"){C({type:"collectionChanged"});return}if(!y||u.kind==="workspace"||u.kind==="not-found")return;let oe=u.kind==="entity"&&u.entityType===y?u.id:null,ee=++U.current;C({type:"collectionChanged"}),D("details"),H({kind:"idle"});let fe=!0,me=()=>fe&&ee===U.current;return o.fetchQuery({...Oy(i,y),staleTime:0}).then(async(Ye)=>{if(!fe||ee!==U.current)return;let Le=qz(Ye,A.current,g&&oe===null);if(D(Le),window.matchMedia("(max-width: 640px)").matches&&Le!=="details")M(Le==="write"?"source":"preview");if(g&&oe===null){if(!V){G(`Creating ${y} is not allowed.`);return}let dt=h3(window.history.state,y,()=>window.history.replaceState(d3(AI()),"",window.location.href)),tt=p3(Ye.fields,dt);C({type:"creationStarted",draft:tt.draft,body:tt.body,...Ye.isSingleton&&{singleton:!0},...dt&&{prefilled:!0},...!dt&&!Ye.isSingleton&&{prefix:q?Xc(h).prefix:null}});return}if(oe!==null)return o.fetchQuery({...Kc(i,y,oe),staleTime:0}).then((dt)=>{if(!fe||ee!==U.current)return;let tt=Vc(dt),Ie=He.current,Yt=$n(a,y,oe),Sn=Ie?.pathname===Yt?Ie.save:{kind:"idle"};if(Ie?.pathname===Yt)He.current=null;C({type:"documentOpened",document:tt,save:Sn})});if(Ye.isSingleton){let dt=await o.ensureQueryData(Ly(i,y,Xc("?scope=collection")));if(!me())return;let tt=dt.entities[0];if(tt)return o.fetchQuery({...Kc(i,y,tt.id),staleTime:0}).then((Ie)=>{if(!fe||ee!==U.current)return;let Yt=Vc(Ie);C({type:"documentOpened",document:Yt})});C({type:"creationStarted",singleton:!0,draft:Iy(Ye.fields)})}return}).catch((Ye)=>{if(fe&&ee===U.current)G(qr(Ye))}),()=>{fe=!1}},[g,p,y,se,o,f,h,u,V,q]);let ye=Ii.useCallback((oe,ee={kind:"idle"},fe=y)=>{if(!fe||!y)return;let me=$n(a,fe,oe);if(!(fe===y&&u.kind==="entity"&&u.entityType===y&&u.id===oe)){He.current={pathname:me,save:ee};let tt=`${bi(a,v??y)}${vi(w)}`,Ie=g&&ee.kind==="saved",Yt=l.location.state,Sn=!Ie||qd(Yt)&&Yt.studioCollectionPath===tt;l[Ie?"replace":"push"](`${me}${vi(w)}`,Sn?{studioCollectionPath:tt}:void 0,ee.kind==="saved"?{ignoreBlocker:!0}:void 0);return}let Le=++U.current,dt=y;o.fetchQuery({...Kc(i,y,oe),staleTime:0}).then((tt)=>{if(Le!==U.current||pe.current!==dt)return;let Ie=Vc(tt);C({type:"documentOpened",document:Ie,save:ee}),H({kind:"idle"})}).catch((tt)=>{if(Le===U.current)G(qr(tt))})},[a,p,u,g,y,v,w,o,l]),ae=Ii.useCallback(()=>{ce((oe)=>oe+1)},[]),vt=Ii.useCallback(()=>{U.current+=1},[]),W=Ii.useCallback(()=>U.current,[]);return{openEntity:ye,loadError:j,setLoadError:G,retryOpen:ae,supersedeOpen:vt,currentOpenRequest:W,pendingOpenState:He}}var is=Y(ft(),1);function g3(e){let{api:i,queryClient:o,history:l,studioBasePath:a,entityType:u,collectionType:f,entityCollectionQuery:h,groupReturnPath:p,activeCapabilities:g,schema:y,editor:v,dispatchEditor:S,createPath:w,syncStatus:A,deleting:C,saveEntityMutation:D,deleteEntityMutation:M,openEntity:H,currentOpenRequest:V,setMobilePane:q,setFieldAssistState:j}=e,{mode:G,draft:se,body:ce,save:He}=v,[U,pe]=is.useState(null),ye=is.useRef(0);is.useEffect(()=>{if(He.kind!=="saved"||!A?.git)return;if(hg({save:He,git:A.git,baselineCommit:U}).committed==="done")return;if(Date.now()-ye.current>20000)return;let fe=window.setTimeout(()=>{o.invalidateQueries({queryKey:gn.syncStatus()})},900);return()=>window.clearTimeout(fe)},[He,A,U,o]);let ae=is.useCallback((ee,fe)=>{if(!u||G.kind!=="edit"||g?.canUpdate!==!0||g.canAssist!==!0||ce.trim().length===0)return;j({kind:"loading",field:fe,variant:ee}),i.requestFieldAssist({variant:ee,entityType:u,id:G.entity.id,targetField:fe}).then((me)=>{let Ye=me.variant==="summarize"?me.suggestion:me.suggestions;j({kind:"suggested",field:me.targetField,variant:me.variant,suggestion:Ye})}).catch((me)=>{j({kind:"error",field:fe,message:Mi(me)})})},[g,ce,u,G]),vt=is.useCallback((ee,fe)=>{S({type:"fieldAssistApplied",field:ee,suggestion:fe}),j({kind:"idle"})},[]),W=is.useCallback(()=>{if(!u||G.kind==="browse"||!y||u===Nl&&!y.groupingDefinitions||_d(v)||(G.kind==="create"&&y.isSingleton||u===Nl)&&!tg(v))return;if(G.kind==="create"?g?.canCreate!==!0:g?.canUpdate!==!0)return;ye.current=Date.now(),pe(A?.git?.lastCommit??null),S({type:"saveStarted"});let ee=y.hasBody?{body:ce}:{},fe=zy(y.fields,se),me=G.kind==="create"?{kind:"create",entityType:u,...w&&{idPath:w},frontmatter:fe,...ee}:{kind:"update",entityType:u,id:G.entity.id,frontmatter:fe,baseContentHash:G.entity.contentHash,...ee},Ye=V();D.mutate(me,{onSuccess:async(Le)=>{if(await Promise.all([o.invalidateQueries({queryKey:["studio","groupings"]}),o.invalidateQueries({queryKey:gn.entities(u)}),...f&&f!==u?[o.invalidateQueries({queryKey:gn.entities(f)})]:[],o.invalidateQueries({queryKey:gn.syncStatus()}),...u===Nl?[o.invalidateQueries({queryKey:["studio","schema"]})]:[],...G.kind==="create"||u===Nl?[o.invalidateQueries({queryKey:gn.navigation()})]:[]]),Ye!==V())return;let dt="skipped"in Le&&Le.skipped===!0;H(Le.entityId,{kind:"saved",noop:dt})},onError:(Le)=>{if(Ye!==V())return;if(Le instanceof jo&&(Le.status===400||Le.status===409))Promise.all([o.invalidateQueries({queryKey:gn.navigation()}),o.invalidateQueries({queryKey:["studio","schema"]}),o.invalidateQueries({queryKey:["studio","groupings"]})]);if(Le instanceof jo&&Le.issues.length>0)q("details");S({type:"saveFailed",save:Le instanceof jo&&Le.status===409&&G.kind==="edit"?{kind:"conflict",message:Mi(Le),...Le.conflictId!==void 0&&{conflictId:Le.conflictId}}:{kind:"error",message:Le instanceof jo&&Le.issues.length>0?Le.message||"Validation failed":Mi(Le),...Le instanceof jo?{issues:Le.issues}:{}}})}})},[g,u,f,G,w,v,se,ce,y,H,A,o,D]),oe=is.useCallback(()=>{if(!u||G.kind!=="edit"||C||g?.canDelete!==!0)return;let{id:ee}=G.entity;M.mutate({entityType:u,id:ee},{onSuccess:async()=>{S({type:"deleteSucceeded"}),o.removeQueries({queryKey:gn.entity(u,ee)}),await Promise.all([o.invalidateQueries({queryKey:["studio","groupings"]}),o.invalidateQueries({queryKey:gn.entityLists()}),o.invalidateQueries({queryKey:gn.syncStatus()}),o.invalidateQueries({queryKey:gn.navigation()})]),l.replace(p??`${bi(a,f??u)}${vi(h)}`,void 0,{ignoreBlocker:!0})},onError:(fe)=>{S({type:"deleteFailed",message:Mi(fe)})}})},[g,a,u,f,G,C,o,M,l,p,h]);return{runFieldAssist:ae,applyFieldAssist:vt,save:W,remove:oe,baselineCommit:U}}var zh=Y(ft(),1);function v3(e){let{history:i,queryClient:o,studioBasePath:l,routeTarget:a,routePathname:u,routeSearch:f,entityType:h,activeWorkspaceId:p,types:g,groupings:y,workspaces:v,activeType:S,activeWorkspace:w,entityCollectionQuery:A,entityListOffset:C,entityListTotal:D,declarativeWorkspaceData:M,initialUrlWorkspaceQuery:H,setActiveWorkspaceId:V,setEntityType:q,setLoadError:j,supersedeOpen:G}=e;zh.useEffect(()=>{if(!h||!S||p||a.kind!=="collection"&&a.kind!=="entity"||a.entityType!==h)return;if(D===void 0)return;let se=Math.floor(Math.max(0,D-1)/A.limit)*A.limit;if(C>se)i.replace(`${u}${vi({...A,offset:se})}`,i.location.state)},[S,p,C,D,A,h,u,a,i]),zh.useEffect(()=>{if(!p||!M?.refreshAfterMs)return;let se=window.setTimeout(()=>{o.invalidateQueries({queryKey:gn.workspace(p)})},M.refreshAfterMs);return()=>window.clearTimeout(se)},[p,M,o]),zh.useEffect(()=>{if(w?.urlQuery!==!0||a.kind!=="workspace"||a.workspaceId!==w.id)return;let se=yi(l,w.id);if(Xa(se,H)!==`${se}${f}`)My(i,se,H,window.location.pathname)},[w,l,H,f,a,i]),zh.useEffect(()=>{if(!g)return;if(j(null),a.kind==="not-found"){G(),j(`Studio route not found: ${a.pathname}`);return}if(a.kind==="images"){G(),V(null),q(null);return}if(a.kind==="grouping"){if(G(),V(null),q(null),!y.some((U)=>U.key===a.grouping))j("Collection unavailable for this account.");return}if(a.kind==="workspace"){let U=v.find((pe)=>pe.id===a.workspaceId);if(!U){let pe=y3(l,a.workspaceId,f,v);if(pe){i.replace(pe);return}G(),j(`Workspace unavailable for this account: ${a.workspaceId}`);return}V(U.id),q(null);return}let se=a.kind==="collection"||a.kind==="entity"?a.entityType:void 0,ce=g.find((U)=>!U.isSingleton)??g[0];if(a.kind==="home"){let U=b3(l,g,v);if(U!==l){i.replace(U);return}}let He=se??ce?.entityType??null;if(se!==void 0&&!g.some((U)=>U.entityType===se)){G(),j(`Collection unavailable for this account: ${se}`);return}V(null),q(He)},[f,a,i,l,g,y,v])}var qx=Y(ft(),1);function x3(e){let{queryClient:i,workspaces:o,activeWorkspaceId:l,entityType:a,mode:u,declarativeWorkspaceActionMutation:f,openEntity:h}=e,p=qx.useCallback(async(y)=>{let v=S3(o,y.entityType);if(!v)throw Error("Publishing is unavailable");let S={entityType:y.entityType,entityId:y.entityId,...y.type==="reorder"?{position:y.position}:{}};if(y.type==="publish"&&!y.confirmation){let C=await f.mutateAsync({workspaceId:v.id,action:{actionId:"publish",label:"Publish now",input:S,invocation:{mode:"prepare"}}});if(typeof C!=="object"||C===null||!("kind"in C)||C.kind!=="prepared-confirmation"||!("token"in C)||typeof C.token!=="string"||!("summary"in C)||typeof C.summary!=="string"||!("expiresAt"in C)||typeof C.expiresAt!=="string")throw Error("Publishing confirmation is unavailable");return{needsConfirmation:!0,summary:C.summary,args:{confirmed:!0,confirmationToken:C.token,contentHash:C.token,expiresAt:C.expiresAt}}}let w=await f.mutateAsync({workspaceId:v.id,action:{actionId:y.type,label:y.type,input:S,...y.type==="publish"&&y.confirmation?{invocation:{mode:"execute",token:y.confirmation.confirmationToken}}:{}}});if(typeof w!=="object"||w===null)throw Error("Publishing returned an invalid result");let A="success"in w&&w.success===!1?{success:!1,error:"error"in w&&typeof w.error==="string"?w.error:"Publishing failed",..."code"in w&&typeof w.code==="string"?{code:w.code}:{}}:{success:!0};if(!xx(A)&&!kx(A)){if(await _x(i,v.id),u.kind==="edit"&&a===y.entityType&&u.entity.id===y.entityId)h(y.entityId)}return A},[a,u,h,i,f,o]),g=qx.useCallback(async(y)=>{if(!l)throw Error("Declarative workspace is unavailable");try{let v=await f.mutateAsync({workspaceId:l,action:y});return await _x(i,l),v}finally{f.reset()}},[l,f,i]);return{performPublishingAction:p,performDeclarativeAction:g}}var Ct=Y(he(),1),TI=st.lazy(()=>OS(async()=>({default:(await import("./studio-chunks/account-view-b2evrja2.js")).AccountApp}))),EI=st.lazy(()=>OS(async()=>({default:(await import("./studio-chunks/studio-chat-workspace-zrztt0xb.js")).StudioChatWorkspace}),()=>Ct.jsxDEV(Ya,{message:"Chat could not open.",children:Ct.jsxDEV(MS,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)));function DI(e){let i=new URLSearchParams(e).get("session")?.trim();return i&&i.length<=256?i:null}var RI=["public","trusted","admin"];function MI(e,i,o){let l=document.querySelector("[data-studio-root]"),a=l?.getAttribute("data-studio-principal-name")??"Your account",u=l?.getAttribute("data-studio-principal-role"),f=RI.find((v)=>v===u)??"public",h=l?.getAttribute("data-studio-mcp-url")??void 0,p=l?.getAttribute("data-studio-dav-url")??void 0,g=new URLSearchParams(o).get("section")??void 0,y=C3(o);return{displayName:a,role:f,routePath:e,studioPath:i,...h?{mcpUrl:h}:{},...p?{davUrl:p}:{},...g?{initialSection:g}:{},...y?{connect:y}:{}}}function D3(){let e=k3(),i=Uy({select:(le)=>le.location.pathname}),o=Uy({select:(le)=>le.location.searchStr}),l=Uy({select:(le)=>le.location.state}),a=Hs(),u=st.useMemo(()=>i===Na?{kind:"workspace",workspaceId:Hy}:lg(i,a),[i,a]),f=st.useMemo(()=>u.kind==="collection"&&new URLSearchParams(o).get("mode")==="create",[o,u]),h=i,[p,g]=st.useState(null),[y,v]=st.useState(null),[S,w]=st.useState({}),[A,C]=st.useReducer(vD,Ud),{mode:D}=A,M=tg(A),[H]=st.useState(()=>new E3),V=st.useSyncExternalStore(H.subscribe,H.hasDrafts,H.hasDrafts),[q,j]=st.useState({hasDraft:!1,busy:!1}),G=w3({shouldBlockFn:({next:le})=>M||i===Na&&T3({...q,hasDraft:V},le.pathname),enableBeforeUnload:M||V||q.busy,withResolver:!0}),[se,ce]=st.useState({kind:"idle"}),[He,U]=st.useState("source"),pe=A.mode.kind==="create";st.useEffect(()=>{if(pe)U("source")},[pe]);let[ye,ae]=st.useState("details"),vt=st.useRef(null),W=st.useCallback((le)=>{vt.current=le,ae(le)},[]),oe=pc(),ee=Kt(),{navigationQuery:fe,types:me,groupings:Ye,activeType:Le,collectionType:dt,activeCapabilities:tt,entityCollectionQuery:Ie,entityListOffset:Yt,workspaces:Sn,activeWorkspace:Oe,activeAccount:Xn,activeChat:Ro,initialUrlWorkspaceQuery:os,workspaceRequestQuery:ne,workspaceQuery:In,workspaceData:Fa,workspaceError:$r,agentTargets:Pr,syncStatus:yt,entityListQuery:Mo,entities:Ka,entityListTotal:Nh,schema:at,createPath:$y,destinationQuery:Oo,saveEntityMutation:Za,deleteEntityMutation:jr,declarativeWorkspaceActionMutation:Py,deleting:Ja,declarativeWorkspaceData:eu}=a3({api:ee,entityType:y,activeWorkspaceId:p,routeSearch:o,workspaceQueries:S,editor:A}),Qs=Sn.find((le)=>le.rendererName===Fc),[jy,tu]=st.useState(!1),[Bh,Zc]=st.useState(null),Vr=A.mode.kind==="edit"?`${A.mode.entity.entityType}:${A.mode.entity.id}`:null;st.useEffect(()=>{Zc(null)},[Vr]);let Ws=Qs?.chatApiPath;st.useEffect(()=>{if(!Ws||Vr===null)return;let le=(ht)=>{if(ht.key.toLowerCase()!=="j"||!(ht.metaKey||ht.ctrlKey)||ht.altKey||ht.shiftKey)return;ht.preventDefault(),tu((_i)=>!_i)};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[Ws,Vr]);let Jc=QD({entityType:y,entities:Ka}),nu=wD({principalId:document.querySelector("[data-studio-root]")?.getAttribute("data-studio-principal-id")??null,entityType:y,editor:A,hasUnsavedChanges:M,fields:at?.fields??[],dispatch:C}),Ys=u.kind==="grouping"?Ye.find((le)=>le.key===u.grouping):void 0,Gr=st.useMemo(()=>TS(o),[o]),Qr=u.kind==="entity"?RD(l,a,Ye):null,Xs=Qr?.path,ss=st.useMemo(()=>y?Ye.filter((le)=>le.types.includes(y)):[],[Ye,y]),Wr=Fz(ss),{openEntity:ls,loadError:nn,setLoadError:rs,retryOpen:Hl,supersedeOpen:Il,currentOpenRequest:ef,pendingOpenState:tf}=m3({api:ee,queryClient:oe,history:e.history,studioBasePath:a,routeTarget:u,routePathname:i,routeSearch:o,currentStudioPathname:h,createMode:f,entityType:y,collectionType:dt,activeType:Le,entityCollectionQuery:Ie,preferredMobilePane:vt,dispatchEditor:C,setMobilePane:ae,setBodyMode:U,setFieldAssistState:ce});v3({history:e.history,queryClient:oe,studioBasePath:a,routeTarget:u,routePathname:i,routeSearch:o,entityType:y,activeWorkspaceId:p,types:me,groupings:Ye,workspaces:Sn,activeType:Le,activeWorkspace:Oe,entityCollectionQuery:Ie,entityListOffset:Yt,entityListTotal:Nh,declarativeWorkspaceData:eu,initialUrlWorkspaceQuery:os,setActiveWorkspaceId:g,setEntityType:v,setLoadError:rs,supersedeOpen:Il});let{openWorkspaceEntity:iu,openWorkspaceLaunch:ou,selectEntityType:Ui,changeEntityPage:Si,selectWorkspace:su,selectFolder:Vy,startCreate:nf,backToList:Hh,changeWorkspaceQuery:lu}=f3({history:e.history,studioBasePath:a,routeSearch:o,entityType:y,collectionType:dt,entityCollectionQuery:Ie,groupReturnPath:Xs,workspaces:Sn,schema:at,activeCapabilities:tt,pendingOpenState:tf,setFieldAssistState:ce,setWorkspaceQueries:w}),{runFieldAssist:xi,applyFieldAssist:Ih,save:of,remove:Uh,baselineCommit:sf}=g3({api:ee,queryClient:oe,history:e.history,studioBasePath:a,entityType:y,collectionType:dt,entityCollectionQuery:Ie,groupReturnPath:Xs,activeCapabilities:tt,schema:at,editor:A,dispatchEditor:C,createPath:$y,syncStatus:yt,deleting:Ja,saveEntityMutation:Za,deleteEntityMutation:jr,openEntity:ls,currentOpenRequest:ef,setMobilePane:ae,setFieldAssistState:ce}),{performPublishingAction:_h,performDeclarativeAction:qh}=x3({queryClient:oe,workspaces:Sn,activeWorkspaceId:p,entityType:y,mode:D,declarativeWorkspaceActionMutation:Py,openEntity:ls}),Fn=nn??(fe.error?qr(fe.error):Mo.error?qr(Mo.error):null),lf=()=>{if(rs(null),fe.error)fe.refetch();if(Mo.error)Mo.refetch();if(In.error)In.refetch();if(D.kind==="browse")Hl()};if(Fn&&!me)return Ct.jsxDEV(Ya,{message:Fn,error:!0,onRetry:lf},void 0,!1,void 0,this);if(!me)return Ct.jsxDEV(Ya,{message:"Loading…"},void 0,!1,void 0,this);let rf=me.find((le)=>le.entityType===y),$h=async(le)=>{if(le.kind==="run")await ee.runWorkspaceAction(le.workspaceId,{actionId:le.actionId,input:{}}),e.history.push(le.href);else if(le.kind==="ask-entry")tu(!0);else if(le.kind==="ask-brain")H.update($x(Ws,null),{text:le.question}),e.history.push(Na);else if(le.kind==="create")e.history.push(By(a,le.entityType));else if(le.kind==="climate")document.getElementById("climateToggle")?.click();else if(le.href.startsWith("/"))e.history.push(le.href);else window.location.assign(le.href)},ru=Ct.jsxDEV(Wz,{types:me.map((le)=>({entityType:le.entityType,singularLabel:le.singularLabel,classification:le.classification,isSingleton:le.isSingleton,canCreate:le.capabilities.canCreate})),hasChat:Ws!==void 0,openEntry:D.kind==="edit"&&rf?.capabilities.canAssist?{typeLabel:rf.singularLabel.toLowerCase()}:null,onCommand:$h},void 0,!1,void 0,this);if(Xn&&Oe){let le=yi(a,Ny);return Ct.jsxDEV(Ct.Fragment,{children:[ru,Ct.jsxDEV($z,{types:me,workspaces:Sn,workspaceId:Oe.id,selectEntityType:Ui,selectWorkspace:su,children:Ct.jsxDEV(st.Suspense,{fallback:Ct.jsxDEV(ve,{children:"Opening Account…"},void 0,!1,void 0,this),children:Ct.jsxDEV(TI,{bootstrap:MI(le,a,o)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}if(Ro&&Oe)return Ct.jsxDEV(Ct.Fragment,{children:[ru,Ct.jsxDEV(st.Suspense,{fallback:Ct.jsxDEV(Ya,{message:"Opening Chat…"},void 0,!1,void 0,this),children:Ct.jsxDEV(EI,{apiPath:Oe.chatApiPath,draftStore:H,onNavigationStateChange:j,studioBasePath:a,sessionId:DI(o),types:me,workspaces:Sn,handoff:Xz(l),navigate:(le,ht)=>{e.history.push(le,void 0,{ignoreBlocker:ht?.preserveWork===!0})},selectEntityType:Ui,selectWorkspace:su},void 0,!1,void 0,this)},void 0,!1,void 0,this),G.status==="blocked"&&Ct.jsxDEV(yn,{mark:"↩",title:"Leave this conversation?",titleId:"chat-navigation-title",cancelLabel:"Stay",confirmLabel:"Leave",onCancel:()=>G.reset(),onConfirm:()=>G.proceed(),children:Ct.jsxDEV("p",{children:"Your draft stays in this tab. Leaving stops receiving the response, but does not undo completed actions or background jobs."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(p?p!==Lh&&!Fa&&!$r:y&&!at&&!Fn)return Ct.jsxDEV(Ya,{message:"Loading…"},void 0,!1,void 0,this);if(!Ys&&u.kind!=="images"&&!p&&(!y||!at&&!Fn))return Ct.jsxDEV(Ya,{message:Fn??"No readable collections are available for this account.",error:Boolean(Fn),...Fn?{onHome:()=>e.history.push(a)}:{}},void 0,!1,void 0,this);return Ct.jsxDEV(Ct.Fragment,{children:[ru,Ct.jsxDEV(Pz,{groupings:{items:Ye,active:Ys?.key??Qr?.grouping??null,onSelect:(le)=>e.history.push(hc(a,le))},images:{active:u.kind==="images",onSelect:()=>e.history.push(A3(a))},imagesView:u.kind==="images"?Ct.jsxDEV(UD,{onOpen:(le,ht)=>e.history.push($n(a,le,ht))},void 0,!1,void 0,this):null,homeView:p===Lh?Ct.jsxDEV(s2,{chatApiPath:Qs?.chatApiPath,onNavigate:(le)=>e.history.push(le),onAsk:(le)=>{H.update($x(Qs?.chatApiPath,null),{text:le}),e.history.push(Na)}},void 0,!1,void 0,this):null,groupReturnLabel:Qr?.label,groupingSuggestions:Wr,groupingView:Ys?Ct.jsxDEV(ND,{basePath:a,grouping:Ys,types:me,query:Gr,onChange:(le,ht)=>{let _i=`${hc(a,Ys.key)}${dc(le)}`,Fs=le.value!==Gr.value||le.offset!==Gr.offset;e.history[Fs&&ht?.replace!==!0?"push":"replace"](_i)},onOpen:(le,ht)=>{let _i=$n(a,le,ht);tf.current={pathname:_i,save:{kind:"idle"}},e.history.push(_i,{studioGroupingPath:`${hc(a,Ys.key)}${dc(Gr)}`})}},void 0,!1,void 0,this):null,activeWorkspaceId:p,types:me,workspaces:Sn,workspaceError:$r,readError:Fn,onRetryRead:lf,declarativeWorkspaceData:eu,workspaceQuery:ne,entityType:y,entities:Ka,refineNotice:Jc.notice,onRefineConfirmed:Jc.confirmed,folders:Mo.data?.folders??[],collectionTrail:Mo.data?.trail,collectionPath:dt?bi(a,dt):a,selectFolder:Vy,creationDestination:{data:Oo.data??null,pending:Oo.isPending,error:Oo.error},entityOffset:Yt,entityLimit:Ie.limit,entityTotal:Nh??0,collectionQuery:Ie,onCollectionQueryChange:(le)=>{if(!dt)return;e.history.push(`${bi(a,dt)}${vi({...le,offset:0})}`),window.scrollTo({top:0,left:0})},entityListLoading:Mo.isPending,schema:at,editor:A,fieldAssistState:se,bodyMode:He,mobilePane:ye,syncStatus:yt,baselineCommit:sf,agentTargets:Pr,ask:Ws?{chatApiPath:Ws,draftStore:H,open:jy,setOpen:tu,selection:Bh,setSelection:Zc}:void 0,deleting:Ja,hasUnsavedChanges:M,navigationBlocked:G.status==="blocked",dispatchEditor:C,setFieldAssistState:ce,setBodyMode:U,setMobilePane:W,backToList:Hh,selectEntityType:Ui,selectWorkspace:su,changeEntityPage:Si,openWorkspaceEntity:iu,openWorkspaceLaunch:ou,performPublishingAction:_h,performDeclarativeAction:qh,onWorkspaceQueryChange:lu,startCreate:nf,openEntity:(le,ht)=>ls(le,void 0,ht),runFieldAssist:xi,applyFieldAssist:Ih,save:of,remove:Uh,onNavigationReset:()=>G.reset?.(),draftRecovery:nu,onNavigationProceed:()=>{nu.forget(),G.proceed?.()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function M3(){return new R3({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}var qy=Y(he(),1),_y=document.querySelector("[data-studio-root]");if(_y){let e=_y.getAttribute("data-studio-base-path")??"/studio",i=new N3({basePath:e});_y.textContent="";let o=M3(),l=z3(e,D3);H3.createRoot(_y).render(qy.jsxDEV(O3,{client:o,children:qy.jsxDEV(B3,{api:i,children:qy.jsxDEV(L3,{router:l},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))}
|
|
249
|
+
${l}`:l}}function AI(){let e=window.history.state;return qd(e)?e:{}}function m3(e){let{api:i,queryClient:o,history:l,studioBasePath:a,routeTarget:u,routePathname:f,routeSearch:h,currentStudioPathname:p,createMode:g,entityType:y,collectionType:v,activeType:S,entityCollectionQuery:w,preferredMobilePane:A,dispatchEditor:C,setMobilePane:D,setBodyMode:M,setFieldAssistState:H}=e,V=S?.capabilities.canCreate===!0,q=S?.hierarchy.nested!==!1,[j,G]=Ii.useState(null),[se,ce]=Ii.useState(0),He=Ii.useRef(null),U=Ii.useRef(0),pe=Ii.useRef(y);pe.current=y,Ii.useEffect(()=>{if(u.kind==="grouping"){C({type:"collectionChanged"});return}if(!y||u.kind==="workspace"||u.kind==="not-found")return;let oe=u.kind==="entity"&&u.entityType===y?u.id:null,ee=++U.current;C({type:"collectionChanged"}),D("details"),H({kind:"idle"});let fe=!0,me=()=>fe&&ee===U.current;return o.fetchQuery({...Oy(i,y),staleTime:0}).then(async(Ye)=>{if(!fe||ee!==U.current)return;let Le=qz(Ye,A.current,g&&oe===null);if(D(Le),window.matchMedia("(max-width: 640px)").matches&&Le!=="details")M(Le==="write"?"source":"preview");if(g&&oe===null){if(!V){G(`Creating ${y} is not allowed.`);return}let dt=h3(window.history.state,y,()=>window.history.replaceState(d3(AI()),"",window.location.href)),tt=p3(Ye.fields,dt);C({type:"creationStarted",draft:tt.draft,body:tt.body,...Ye.isSingleton&&{singleton:!0},...dt&&{prefilled:!0},...!dt&&!Ye.isSingleton&&{prefix:q?Xc(h).prefix:null}});return}if(oe!==null)return o.fetchQuery({...Kc(i,y,oe),staleTime:0}).then((dt)=>{if(!fe||ee!==U.current)return;let tt=Vc(dt),Ie=He.current,Yt=$n(a,y,oe),Sn=Ie?.pathname===Yt?Ie.save:{kind:"idle"};if(Ie?.pathname===Yt)He.current=null;C({type:"documentOpened",document:tt,save:Sn})});if(Ye.isSingleton){let dt=await o.ensureQueryData(Ly(i,y,Xc("?scope=collection")));if(!me())return;let tt=dt.entities[0];if(tt)return o.fetchQuery({...Kc(i,y,tt.id),staleTime:0}).then((Ie)=>{if(!fe||ee!==U.current)return;let Yt=Vc(Ie);C({type:"documentOpened",document:Yt})});C({type:"creationStarted",singleton:!0,draft:Iy(Ye.fields)})}return}).catch((Ye)=>{if(fe&&ee===U.current)G(qr(Ye))}),()=>{fe=!1}},[g,p,y,se,o,f,h,u,V,q]);let ye=Ii.useCallback((oe,ee={kind:"idle"},fe=y)=>{if(!fe||!y)return;let me=$n(a,fe,oe);if(!(fe===y&&u.kind==="entity"&&u.entityType===y&&u.id===oe)){He.current={pathname:me,save:ee};let tt=`${bi(a,v??y)}${vi(w)}`,Ie=g&&ee.kind==="saved",Yt=l.location.state,Sn=!Ie||qd(Yt)&&Yt.studioCollectionPath===tt;l[Ie?"replace":"push"](`${me}${vi(w)}`,Sn?{studioCollectionPath:tt}:void 0,ee.kind==="saved"?{ignoreBlocker:!0}:void 0);return}let Le=++U.current,dt=y;o.fetchQuery({...Kc(i,y,oe),staleTime:0}).then((tt)=>{if(Le!==U.current||pe.current!==dt)return;let Ie=Vc(tt);C({type:"documentOpened",document:Ie,save:ee}),H({kind:"idle"})}).catch((tt)=>{if(Le===U.current)G(qr(tt))})},[a,p,u,g,y,v,w,o,l]),ae=Ii.useCallback(()=>{ce((oe)=>oe+1)},[]),vt=Ii.useCallback(()=>{U.current+=1},[]),W=Ii.useCallback(()=>U.current,[]);return{openEntity:ye,loadError:j,setLoadError:G,retryOpen:ae,supersedeOpen:vt,currentOpenRequest:W,pendingOpenState:He}}var is=Y(ft(),1);function g3(e){let{api:i,queryClient:o,history:l,studioBasePath:a,entityType:u,collectionType:f,entityCollectionQuery:h,groupReturnPath:p,activeCapabilities:g,schema:y,editor:v,dispatchEditor:S,createPath:w,syncStatus:A,deleting:C,saveEntityMutation:D,deleteEntityMutation:M,openEntity:H,currentOpenRequest:V,setMobilePane:q,setFieldAssistState:j}=e,{mode:G,draft:se,body:ce,save:He}=v,[U,pe]=is.useState(null),ye=is.useRef(0);is.useEffect(()=>{if(He.kind!=="saved"||!A?.git)return;if(hg({save:He,git:A.git,baselineCommit:U}).committed==="done")return;if(Date.now()-ye.current>20000)return;let fe=window.setTimeout(()=>{o.invalidateQueries({queryKey:gn.syncStatus()})},900);return()=>window.clearTimeout(fe)},[He,A,U,o]);let ae=is.useCallback((ee,fe)=>{if(!u||G.kind!=="edit"||g?.canUpdate!==!0||g.canAssist!==!0||ce.trim().length===0)return;j({kind:"loading",field:fe,variant:ee}),i.requestFieldAssist({variant:ee,entityType:u,id:G.entity.id,targetField:fe}).then((me)=>{let Ye=me.variant==="summarize"?me.suggestion:me.suggestions;j({kind:"suggested",field:me.targetField,variant:me.variant,suggestion:Ye})}).catch((me)=>{j({kind:"error",field:fe,message:Mi(me)})})},[g,ce,u,G]),vt=is.useCallback((ee,fe)=>{S({type:"fieldAssistApplied",field:ee,suggestion:fe}),j({kind:"idle"})},[]),W=is.useCallback(()=>{if(!u||G.kind==="browse"||!y||u===Nl&&!y.groupingDefinitions||_d(v)||(G.kind==="create"&&y.isSingleton||u===Nl)&&!tg(v))return;if(G.kind==="create"?g?.canCreate!==!0:g?.canUpdate!==!0)return;ye.current=Date.now(),pe(A?.git?.lastCommit??null),S({type:"saveStarted"});let ee=y.hasBody?{body:ce}:{},fe=zy(y.fields,se),me=G.kind==="create"?{kind:"create",entityType:u,...w&&{idPath:w},frontmatter:fe,...ee}:{kind:"update",entityType:u,id:G.entity.id,frontmatter:fe,baseContentHash:G.entity.contentHash,...ee},Ye=V();D.mutate(me,{onSuccess:async(Le)=>{if(await Promise.all([o.invalidateQueries({queryKey:["studio","groupings"]}),o.invalidateQueries({queryKey:gn.entities(u)}),...f&&f!==u?[o.invalidateQueries({queryKey:gn.entities(f)})]:[],o.invalidateQueries({queryKey:gn.syncStatus()}),...u===Nl?[o.invalidateQueries({queryKey:["studio","schema"]})]:[],...G.kind==="create"||u===Nl?[o.invalidateQueries({queryKey:gn.navigation()})]:[]]),Ye!==V())return;let dt="skipped"in Le&&Le.skipped===!0;H(Le.entityId,{kind:"saved",noop:dt})},onError:(Le)=>{if(Ye!==V())return;if(Le instanceof jo&&(Le.status===400||Le.status===409))Promise.all([o.invalidateQueries({queryKey:gn.navigation()}),o.invalidateQueries({queryKey:["studio","schema"]}),o.invalidateQueries({queryKey:["studio","groupings"]})]);if(Le instanceof jo&&Le.issues.length>0)q("details");S({type:"saveFailed",save:Le instanceof jo&&Le.status===409&&G.kind==="edit"?{kind:"conflict",message:Mi(Le),...Le.conflictId!==void 0&&{conflictId:Le.conflictId}}:{kind:"error",message:Le instanceof jo&&Le.issues.length>0?Le.message||"Validation failed":Mi(Le),...Le instanceof jo?{issues:Le.issues}:{}}})}})},[g,u,f,G,w,v,se,ce,y,H,A,o,D]),oe=is.useCallback(()=>{if(!u||G.kind!=="edit"||C||g?.canDelete!==!0)return;let{id:ee}=G.entity;M.mutate({entityType:u,id:ee},{onSuccess:async()=>{S({type:"deleteSucceeded"}),o.removeQueries({queryKey:gn.entity(u,ee)}),await Promise.all([o.invalidateQueries({queryKey:["studio","groupings"]}),o.invalidateQueries({queryKey:gn.entityLists()}),o.invalidateQueries({queryKey:gn.syncStatus()}),o.invalidateQueries({queryKey:gn.navigation()})]),l.replace(p??`${bi(a,f??u)}${vi(h)}`,void 0,{ignoreBlocker:!0})},onError:(fe)=>{S({type:"deleteFailed",message:Mi(fe)})}})},[g,a,u,f,G,C,o,M,l,p,h]);return{runFieldAssist:ae,applyFieldAssist:vt,save:W,remove:oe,baselineCommit:U}}var zh=Y(ft(),1);function v3(e){let{history:i,queryClient:o,studioBasePath:l,routeTarget:a,routePathname:u,routeSearch:f,entityType:h,activeWorkspaceId:p,types:g,groupings:y,workspaces:v,activeType:S,activeWorkspace:w,entityCollectionQuery:A,entityListOffset:C,entityListTotal:D,declarativeWorkspaceData:M,initialUrlWorkspaceQuery:H,setActiveWorkspaceId:V,setEntityType:q,setLoadError:j,supersedeOpen:G}=e;zh.useEffect(()=>{if(!h||!S||p||a.kind!=="collection"&&a.kind!=="entity"||a.entityType!==h)return;if(D===void 0)return;let se=Math.floor(Math.max(0,D-1)/A.limit)*A.limit;if(C>se)i.replace(`${u}${vi({...A,offset:se})}`,i.location.state)},[S,p,C,D,A,h,u,a,i]),zh.useEffect(()=>{if(!p||!M?.refreshAfterMs)return;let se=window.setTimeout(()=>{o.invalidateQueries({queryKey:gn.workspace(p)})},M.refreshAfterMs);return()=>window.clearTimeout(se)},[p,M,o]),zh.useEffect(()=>{if(w?.urlQuery!==!0||a.kind!=="workspace"||a.workspaceId!==w.id)return;let se=yi(l,w.id);if(Xa(se,H)!==`${se}${f}`)My(i,se,H,window.location.pathname)},[w,l,H,f,a,i]),zh.useEffect(()=>{if(!g)return;if(j(null),a.kind==="not-found"){G(),j(`Studio route not found: ${a.pathname}`);return}if(a.kind==="images"){G(),V(null),q(null);return}if(a.kind==="grouping"){if(G(),V(null),q(null),!y.some((U)=>U.key===a.grouping))j("Collection unavailable for this account.");return}if(a.kind==="workspace"){let U=v.find((pe)=>pe.id===a.workspaceId);if(!U){let pe=y3(l,a.workspaceId,f,v);if(pe){i.replace(pe);return}G(),j(`Workspace unavailable for this account: ${a.workspaceId}`);return}V(U.id),q(null);return}let se=a.kind==="collection"||a.kind==="entity"?a.entityType:void 0,ce=g.find((U)=>!U.isSingleton)??g[0];if(a.kind==="home"){let U=b3(l,g,v);if(U!==l){i.replace(U);return}}let He=se??ce?.entityType??null;if(se!==void 0&&!g.some((U)=>U.entityType===se)){G(),j(`Collection unavailable for this account: ${se}`);return}V(null),q(He)},[f,a,i,l,g,y,v])}var qx=Y(ft(),1);function x3(e){let{queryClient:i,workspaces:o,activeWorkspaceId:l,entityType:a,mode:u,declarativeWorkspaceActionMutation:f,openEntity:h}=e,p=qx.useCallback(async(y)=>{let v=S3(o,y.entityType);if(!v)throw Error("Publishing is unavailable");let S={entityType:y.entityType,entityId:y.entityId,...y.type==="reorder"?{position:y.position}:{}};if(y.type==="publish"&&!y.confirmation){let C=await f.mutateAsync({workspaceId:v.id,action:{actionId:"publish",label:"Publish now",input:S,invocation:{mode:"prepare"}}});if(typeof C!=="object"||C===null||!("kind"in C)||C.kind!=="prepared-confirmation"||!("token"in C)||typeof C.token!=="string"||!("summary"in C)||typeof C.summary!=="string"||!("expiresAt"in C)||typeof C.expiresAt!=="string")throw Error("Publishing confirmation is unavailable");return{needsConfirmation:!0,summary:C.summary,args:{confirmed:!0,confirmationToken:C.token,contentHash:C.token,expiresAt:C.expiresAt}}}let w=await f.mutateAsync({workspaceId:v.id,action:{actionId:y.type,label:y.type,input:S,...y.type==="publish"&&y.confirmation?{invocation:{mode:"execute",token:y.confirmation.confirmationToken}}:{}}});if(typeof w!=="object"||w===null)throw Error("Publishing returned an invalid result");let A="success"in w&&w.success===!1?{success:!1,error:"error"in w&&typeof w.error==="string"?w.error:"Publishing failed",..."code"in w&&typeof w.code==="string"?{code:w.code}:{}}:{success:!0};if(!xx(A)&&!kx(A)){if(await _x(i,v.id),u.kind==="edit"&&a===y.entityType&&u.entity.id===y.entityId)h(y.entityId)}return A},[a,u,h,i,f,o]),g=qx.useCallback(async(y)=>{if(!l)throw Error("Declarative workspace is unavailable");try{let v=await f.mutateAsync({workspaceId:l,action:y});return await _x(i,l),v}finally{f.reset()}},[l,f,i]);return{performPublishingAction:p,performDeclarativeAction:g}}var Ct=Y(he(),1),TI=st.lazy(()=>OS(async()=>({default:(await import("./studio-chunks/account-view-tgaymkvr.js")).AccountApp}))),EI=st.lazy(()=>OS(async()=>({default:(await import("./studio-chunks/studio-chat-workspace-24s9ryqw.js")).StudioChatWorkspace}),()=>Ct.jsxDEV(Ya,{message:"Chat could not open.",children:Ct.jsxDEV(MS,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)));function DI(e){let i=new URLSearchParams(e).get("session")?.trim();return i&&i.length<=256?i:null}var RI=["public","trusted","admin"];function MI(e,i,o){let l=document.querySelector("[data-studio-root]"),a=l?.getAttribute("data-studio-principal-name")??"Your account",u=l?.getAttribute("data-studio-principal-role"),f=RI.find((v)=>v===u)??"public",h=l?.getAttribute("data-studio-mcp-url")??void 0,p=l?.getAttribute("data-studio-dav-url")??void 0,g=new URLSearchParams(o).get("section")??void 0,y=C3(o);return{displayName:a,role:f,routePath:e,studioPath:i,...h?{mcpUrl:h}:{},...p?{davUrl:p}:{},...g?{initialSection:g}:{},...y?{connect:y}:{}}}function D3(){let e=k3(),i=Uy({select:(le)=>le.location.pathname}),o=Uy({select:(le)=>le.location.searchStr}),l=Uy({select:(le)=>le.location.state}),a=Hs(),u=st.useMemo(()=>i===Na?{kind:"workspace",workspaceId:Hy}:lg(i,a),[i,a]),f=st.useMemo(()=>u.kind==="collection"&&new URLSearchParams(o).get("mode")==="create",[o,u]),h=i,[p,g]=st.useState(null),[y,v]=st.useState(null),[S,w]=st.useState({}),[A,C]=st.useReducer(vD,Ud),{mode:D}=A,M=tg(A),[H]=st.useState(()=>new E3),V=st.useSyncExternalStore(H.subscribe,H.hasDrafts,H.hasDrafts),[q,j]=st.useState({hasDraft:!1,busy:!1}),G=w3({shouldBlockFn:({next:le})=>M||i===Na&&T3({...q,hasDraft:V},le.pathname),enableBeforeUnload:M||V||q.busy,withResolver:!0}),[se,ce]=st.useState({kind:"idle"}),[He,U]=st.useState("source"),pe=A.mode.kind==="create";st.useEffect(()=>{if(pe)U("source")},[pe]);let[ye,ae]=st.useState("details"),vt=st.useRef(null),W=st.useCallback((le)=>{vt.current=le,ae(le)},[]),oe=pc(),ee=Kt(),{navigationQuery:fe,types:me,groupings:Ye,activeType:Le,collectionType:dt,activeCapabilities:tt,entityCollectionQuery:Ie,entityListOffset:Yt,workspaces:Sn,activeWorkspace:Oe,activeAccount:Xn,activeChat:Ro,initialUrlWorkspaceQuery:os,workspaceRequestQuery:ne,workspaceQuery:In,workspaceData:Fa,workspaceError:$r,agentTargets:Pr,syncStatus:yt,entityListQuery:Mo,entities:Ka,entityListTotal:Nh,schema:at,createPath:$y,destinationQuery:Oo,saveEntityMutation:Za,deleteEntityMutation:jr,declarativeWorkspaceActionMutation:Py,deleting:Ja,declarativeWorkspaceData:eu}=a3({api:ee,entityType:y,activeWorkspaceId:p,routeSearch:o,workspaceQueries:S,editor:A}),Qs=Sn.find((le)=>le.rendererName===Fc),[jy,tu]=st.useState(!1),[Bh,Zc]=st.useState(null),Vr=A.mode.kind==="edit"?`${A.mode.entity.entityType}:${A.mode.entity.id}`:null;st.useEffect(()=>{Zc(null)},[Vr]);let Ws=Qs?.chatApiPath;st.useEffect(()=>{if(!Ws||Vr===null)return;let le=(ht)=>{if(ht.key.toLowerCase()!=="j"||!(ht.metaKey||ht.ctrlKey)||ht.altKey||ht.shiftKey)return;ht.preventDefault(),tu((_i)=>!_i)};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[Ws,Vr]);let Jc=QD({entityType:y,entities:Ka}),nu=wD({principalId:document.querySelector("[data-studio-root]")?.getAttribute("data-studio-principal-id")??null,entityType:y,editor:A,hasUnsavedChanges:M,fields:at?.fields??[],dispatch:C}),Ys=u.kind==="grouping"?Ye.find((le)=>le.key===u.grouping):void 0,Gr=st.useMemo(()=>TS(o),[o]),Qr=u.kind==="entity"?RD(l,a,Ye):null,Xs=Qr?.path,ss=st.useMemo(()=>y?Ye.filter((le)=>le.types.includes(y)):[],[Ye,y]),Wr=Fz(ss),{openEntity:ls,loadError:nn,setLoadError:rs,retryOpen:Hl,supersedeOpen:Il,currentOpenRequest:ef,pendingOpenState:tf}=m3({api:ee,queryClient:oe,history:e.history,studioBasePath:a,routeTarget:u,routePathname:i,routeSearch:o,currentStudioPathname:h,createMode:f,entityType:y,collectionType:dt,activeType:Le,entityCollectionQuery:Ie,preferredMobilePane:vt,dispatchEditor:C,setMobilePane:ae,setBodyMode:U,setFieldAssistState:ce});v3({history:e.history,queryClient:oe,studioBasePath:a,routeTarget:u,routePathname:i,routeSearch:o,entityType:y,activeWorkspaceId:p,types:me,groupings:Ye,workspaces:Sn,activeType:Le,activeWorkspace:Oe,entityCollectionQuery:Ie,entityListOffset:Yt,entityListTotal:Nh,declarativeWorkspaceData:eu,initialUrlWorkspaceQuery:os,setActiveWorkspaceId:g,setEntityType:v,setLoadError:rs,supersedeOpen:Il});let{openWorkspaceEntity:iu,openWorkspaceLaunch:ou,selectEntityType:Ui,changeEntityPage:Si,selectWorkspace:su,selectFolder:Vy,startCreate:nf,backToList:Hh,changeWorkspaceQuery:lu}=f3({history:e.history,studioBasePath:a,routeSearch:o,entityType:y,collectionType:dt,entityCollectionQuery:Ie,groupReturnPath:Xs,workspaces:Sn,schema:at,activeCapabilities:tt,pendingOpenState:tf,setFieldAssistState:ce,setWorkspaceQueries:w}),{runFieldAssist:xi,applyFieldAssist:Ih,save:of,remove:Uh,baselineCommit:sf}=g3({api:ee,queryClient:oe,history:e.history,studioBasePath:a,entityType:y,collectionType:dt,entityCollectionQuery:Ie,groupReturnPath:Xs,activeCapabilities:tt,schema:at,editor:A,dispatchEditor:C,createPath:$y,syncStatus:yt,deleting:Ja,saveEntityMutation:Za,deleteEntityMutation:jr,openEntity:ls,currentOpenRequest:ef,setMobilePane:ae,setFieldAssistState:ce}),{performPublishingAction:_h,performDeclarativeAction:qh}=x3({queryClient:oe,workspaces:Sn,activeWorkspaceId:p,entityType:y,mode:D,declarativeWorkspaceActionMutation:Py,openEntity:ls}),Fn=nn??(fe.error?qr(fe.error):Mo.error?qr(Mo.error):null),lf=()=>{if(rs(null),fe.error)fe.refetch();if(Mo.error)Mo.refetch();if(In.error)In.refetch();if(D.kind==="browse")Hl()};if(Fn&&!me)return Ct.jsxDEV(Ya,{message:Fn,error:!0,onRetry:lf},void 0,!1,void 0,this);if(!me)return Ct.jsxDEV(Ya,{message:"Loading…"},void 0,!1,void 0,this);let rf=me.find((le)=>le.entityType===y),$h=async(le)=>{if(le.kind==="run")await ee.runWorkspaceAction(le.workspaceId,{actionId:le.actionId,input:{}}),e.history.push(le.href);else if(le.kind==="ask-entry")tu(!0);else if(le.kind==="ask-brain")H.update($x(Ws,null),{text:le.question}),e.history.push(Na);else if(le.kind==="create")e.history.push(By(a,le.entityType));else if(le.kind==="climate")document.getElementById("climateToggle")?.click();else if(le.href.startsWith("/"))e.history.push(le.href);else window.location.assign(le.href)},ru=Ct.jsxDEV(Wz,{types:me.map((le)=>({entityType:le.entityType,singularLabel:le.singularLabel,classification:le.classification,isSingleton:le.isSingleton,canCreate:le.capabilities.canCreate})),hasChat:Ws!==void 0,openEntry:D.kind==="edit"&&rf?.capabilities.canAssist?{typeLabel:rf.singularLabel.toLowerCase()}:null,onCommand:$h},void 0,!1,void 0,this);if(Xn&&Oe){let le=yi(a,Ny);return Ct.jsxDEV(Ct.Fragment,{children:[ru,Ct.jsxDEV($z,{types:me,workspaces:Sn,workspaceId:Oe.id,selectEntityType:Ui,selectWorkspace:su,children:Ct.jsxDEV(st.Suspense,{fallback:Ct.jsxDEV(ve,{children:"Opening Account…"},void 0,!1,void 0,this),children:Ct.jsxDEV(TI,{bootstrap:MI(le,a,o)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}if(Ro&&Oe)return Ct.jsxDEV(Ct.Fragment,{children:[ru,Ct.jsxDEV(st.Suspense,{fallback:Ct.jsxDEV(Ya,{message:"Opening Chat…"},void 0,!1,void 0,this),children:Ct.jsxDEV(EI,{apiPath:Oe.chatApiPath,draftStore:H,onNavigationStateChange:j,studioBasePath:a,sessionId:DI(o),types:me,workspaces:Sn,handoff:Xz(l),navigate:(le,ht)=>{e.history.push(le,void 0,{ignoreBlocker:ht?.preserveWork===!0})},selectEntityType:Ui,selectWorkspace:su},void 0,!1,void 0,this)},void 0,!1,void 0,this),G.status==="blocked"&&Ct.jsxDEV(yn,{mark:"↩",title:"Leave this conversation?",titleId:"chat-navigation-title",cancelLabel:"Stay",confirmLabel:"Leave",onCancel:()=>G.reset(),onConfirm:()=>G.proceed(),children:Ct.jsxDEV("p",{children:"Your draft stays in this tab. Leaving stops receiving the response, but does not undo completed actions or background jobs."},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(p?p!==Lh&&!Fa&&!$r:y&&!at&&!Fn)return Ct.jsxDEV(Ya,{message:"Loading…"},void 0,!1,void 0,this);if(!Ys&&u.kind!=="images"&&!p&&(!y||!at&&!Fn))return Ct.jsxDEV(Ya,{message:Fn??"No readable collections are available for this account.",error:Boolean(Fn),...Fn?{onHome:()=>e.history.push(a)}:{}},void 0,!1,void 0,this);return Ct.jsxDEV(Ct.Fragment,{children:[ru,Ct.jsxDEV(Pz,{groupings:{items:Ye,active:Ys?.key??Qr?.grouping??null,onSelect:(le)=>e.history.push(hc(a,le))},images:{active:u.kind==="images",onSelect:()=>e.history.push(A3(a))},imagesView:u.kind==="images"?Ct.jsxDEV(UD,{onOpen:(le,ht)=>e.history.push($n(a,le,ht))},void 0,!1,void 0,this):null,homeView:p===Lh?Ct.jsxDEV(s2,{chatApiPath:Qs?.chatApiPath,onNavigate:(le)=>e.history.push(le),onAsk:(le)=>{H.update($x(Qs?.chatApiPath,null),{text:le}),e.history.push(Na)}},void 0,!1,void 0,this):null,groupReturnLabel:Qr?.label,groupingSuggestions:Wr,groupingView:Ys?Ct.jsxDEV(ND,{basePath:a,grouping:Ys,types:me,query:Gr,onChange:(le,ht)=>{let _i=`${hc(a,Ys.key)}${dc(le)}`,Fs=le.value!==Gr.value||le.offset!==Gr.offset;e.history[Fs&&ht?.replace!==!0?"push":"replace"](_i)},onOpen:(le,ht)=>{let _i=$n(a,le,ht);tf.current={pathname:_i,save:{kind:"idle"}},e.history.push(_i,{studioGroupingPath:`${hc(a,Ys.key)}${dc(Gr)}`})}},void 0,!1,void 0,this):null,activeWorkspaceId:p,types:me,workspaces:Sn,workspaceError:$r,readError:Fn,onRetryRead:lf,declarativeWorkspaceData:eu,workspaceQuery:ne,entityType:y,entities:Ka,refineNotice:Jc.notice,onRefineConfirmed:Jc.confirmed,folders:Mo.data?.folders??[],collectionTrail:Mo.data?.trail,collectionPath:dt?bi(a,dt):a,selectFolder:Vy,creationDestination:{data:Oo.data??null,pending:Oo.isPending,error:Oo.error},entityOffset:Yt,entityLimit:Ie.limit,entityTotal:Nh??0,collectionQuery:Ie,onCollectionQueryChange:(le)=>{if(!dt)return;e.history.push(`${bi(a,dt)}${vi({...le,offset:0})}`),window.scrollTo({top:0,left:0})},entityListLoading:Mo.isPending,schema:at,editor:A,fieldAssistState:se,bodyMode:He,mobilePane:ye,syncStatus:yt,baselineCommit:sf,agentTargets:Pr,ask:Ws?{chatApiPath:Ws,draftStore:H,open:jy,setOpen:tu,selection:Bh,setSelection:Zc}:void 0,deleting:Ja,hasUnsavedChanges:M,navigationBlocked:G.status==="blocked",dispatchEditor:C,setFieldAssistState:ce,setBodyMode:U,setMobilePane:W,backToList:Hh,selectEntityType:Ui,selectWorkspace:su,changeEntityPage:Si,openWorkspaceEntity:iu,openWorkspaceLaunch:ou,performPublishingAction:_h,performDeclarativeAction:qh,onWorkspaceQueryChange:lu,startCreate:nf,openEntity:(le,ht)=>ls(le,void 0,ht),runFieldAssist:xi,applyFieldAssist:Ih,save:of,remove:Uh,onNavigationReset:()=>G.reset?.(),draftRecovery:nu,onNavigationProceed:()=>{nu.forget(),G.proceed?.()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function M3(){return new R3({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}var qy=Y(he(),1),_y=document.querySelector("[data-studio-root]");if(_y){let e=_y.getAttribute("data-studio-base-path")??"/studio",i=new N3({basePath:e});_y.textContent="";let o=M3(),l=z3(e,D3);H3.createRoot(_y).render(qy.jsxDEV(O3,{client:o,children:qy.jsxDEV(B3,{api:i,children:qy.jsxDEV(L3,{router:l},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))}
|
|
250
250
|
|
|
251
|
-
//# debugId=
|
|
251
|
+
//# debugId=5EB2D58A8571ADFE64756E2164756E21
|