@rizom/brain 0.2.0-alpha.796 → 0.2.0-alpha.798
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-tmhbz538.js → app-n2spv8qr.js} +2 -2
- package/dist/chunks/{index-177cedqj.js → index-mspwyc3a.js} +2 -2
- package/dist/chunks/{index-jyrw4n9k.js → index-r1hwjqtq.js} +3 -3
- package/dist/chunks/{index-jyrw4n9k.js.map → index-r1hwjqtq.js.map} +1 -1
- package/dist/chunks/{package-2hjtd7f7.js → package-p4q00bfd.js} +3 -3
- package/dist/chunks/{package-2hjtd7f7.js.map → package-p4q00bfd.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-ygxtah3w.js → studio-app-wft7ba0t.js} +4 -4
- package/dist/ui/{studio-app-ygxtah3w.js.map → studio-app-wft7ba0t.js.map} +1 -1
- package/dist/ui/studio-asset-manifest.json +27 -27
- package/dist/ui/studio-chunks/{account-view-0b7z2qws.js → account-view-kkfs676e.js} +2 -2
- package/dist/ui/studio-chunks/{account-view-0b7z2qws.js.map → account-view-kkfs676e.js.map} +1 -1
- package/dist/ui/studio-chunks/{chat-921jr7fh.js → chat-45vnn1n8.js} +2 -2
- package/dist/ui/studio-chunks/{chat-921jr7fh.js.map → chat-45vnn1n8.js.map} +1 -1
- package/dist/ui/studio-chunks/{highlighted-body-OFNGDK62-bvb957zm.js → highlighted-body-OFNGDK62-8vfrsfzz.js} +2 -2
- package/dist/ui/studio-chunks/{highlighted-body-OFNGDK62-bvb957zm.js.map → highlighted-body-OFNGDK62-8vfrsfzz.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-053fxhzx.js → main-3htxv1fh.js} +2 -2
- package/dist/ui/studio-chunks/{main-053fxhzx.js.map → main-3htxv1fh.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-dervqz6s.js → main-6t5cpsqt.js} +3 -3
- package/dist/ui/studio-chunks/{main-dervqz6s.js.map → main-6t5cpsqt.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-g0036mxt.js → main-78k6snwb.js} +3 -3
- package/dist/ui/studio-chunks/{main-g0036mxt.js.map → main-78k6snwb.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-kd598aj5.js → main-7qt9yk4m.js} +5 -5
- package/dist/ui/studio-chunks/{main-kd598aj5.js.map → main-7qt9yk4m.js.map} +1 -1
- package/dist/ui/studio-chunks/{main-mxng8gm1.js → main-e3v487c0.js} +2 -2
- package/dist/ui/studio-chunks/{main-mxng8gm1.js.map → main-e3v487c0.js.map} +1 -1
- package/dist/ui/studio-chunks/main-jch2bj9d.js +9 -0
- package/dist/ui/studio-chunks/{main-8yebv6e9.js.map → main-jch2bj9d.js.map} +6 -6
- package/dist/ui/studio-chunks/{main-84jneqcz.js → main-sf1tftcq.js} +3 -3
- package/dist/ui/studio-chunks/{main-84jneqcz.js.map → main-sf1tftcq.js.map} +1 -1
- package/dist/ui/studio-chunks/mermaid-GHXKKRXX-p4y3pesq.js +3 -0
- package/dist/ui/studio-chunks/mermaid-GHXKKRXX-p4y3pesq.js.map +9 -0
- package/dist/ui/studio-chunks/studio-chat-workspace-wy37fxat.js +3 -0
- package/dist/ui/studio-chunks/{studio-chat-workspace-y0mmt0cs.js.map → studio-chat-workspace-wy37fxat.js.map} +6 -5
- package/package.json +1 -1
- package/dist/ui/studio-chunks/main-8yebv6e9.js +0 -9
- package/dist/ui/studio-chunks/mermaid-GHXKKRXX-nayd45cf.js +0 -3
- package/dist/ui/studio-chunks/mermaid-GHXKKRXX-nayd45cf.js.map +0 -9
- package/dist/ui/studio-chunks/studio-chat-workspace-y0mmt0cs.js +0 -3
- /package/dist/chunks/{app-tmhbz538.js.map → app-n2spv8qr.js.map} +0 -0
- /package/dist/chunks/{index-177cedqj.js.map → index-mspwyc3a.js.map} +0 -0
package/dist/testing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ge as k,he as V,ie as U}from"./chunks/index-
|
|
2
|
+
import{ge as k,he as V,ie as U}from"./chunks/index-r1hwjqtq.js";import{$e as N,Ae as A,Be as x,af as O,bf as z,cf as M,df as q,ef as J,ff as L,hf as _,if as j,je as E,me as I}from"./chunks/index-eh14snbv.js";import"./chunks/index-2fzk7ry8.js";import{mf as D}from"./chunks/index-v1w1v20e.js";import{Al as P,Bl as w,Po as B,oj as C,pg as h}from"./chunks/index-bm3cdksa.js";import{aq as p}from"./chunks/index-jnhy5rdc.js";import{Gt as S,It as v}from"./chunks/index-fgy1pfas.js";import"./chunks/index-acmkz3bm.js";import"./chunks/index-scaa1esw.js";import"./chunks/index-ntzw85st.js";import"./chunks/index-ew0x69wp.js";import{mkdtemp as K,rm as b}from"fs/promises";import{tmpdir as X}from"os";import{join as m}from"path";var y="none";function s(){return Promise.reject(Error("A test brain has no AI provider"))}function W(e){return{specificationVersion:"v3",provider:"test-brain",modelId:e,supportedUrls:{},doGenerate:s,doStream:s}}function T(e){let r={...e};return{generateText:s,generateObject:s,judge:s,generateImage:s,getModel:()=>W(r.model??"none"),canGenerateImages:()=>!1,getConfig:()=>({...r}),updateConfig:(o)=>{r={...r,...o}}}}function R(){return{identity:{model:"test:none",dimensions:1536,promptRevision:0},embedQuery:s,embedDocuments:s}}var Y="shell",ee=20;function te(e){if("needsConfirmation"in e)return{needsConfirmation:!0,summary:e.summary};if(!e.success)return{success:!1,error:e.error,...p({code:e.code})};return{success:!0,...p({data:e.data,message:e.message})}}function re(e,r){if(e.status==="completed"||e.status==="failed")return!0;return e.status==="pending"&&e.lastError!==null&&e.scheduledFor>r}function ne(e,r){return e.flatMap((o)=>{if(!D(o))throw Error("A test brain runs packages configured with use(), as defineBrain does");return P(o.definition,o.config,r)})}async function F(e,r){let o=k(r.directory);V(o,r.brainVersion);let f=ne(e.plugins,{name:o.name,version:o.version}),a=await K(m(r.temporaryRoot??X(),"rizom-test-brain-")),g={...E({dataDir:a,cacheDir:m(a,"cache"),distDir:m(a,"dist")}),embedding:{enabled:!1}},i;try{await new J(v.createFresh({level:S.WARN,context:"test-brain"}),{getStandardConfigWithDirectories:async()=>g,migrateEntities:O,migrateJobQueue:z,migrateConversations:M,migrateRuntimeState:q}).runAllMigrations();let t=_({name:o.name,version:o.version,logLevel:"warn",plugins:f,shellConfig:{...g,dataDir:m(a,"brain-data"),ai:{model:y}}}),n=I(j(t));i=N.createFresh(n,{aiService:T(A(n)),embeddingService:R()}),await i.initialize()}catch(t){throw await b(a,{recursive:!0,force:!0}),t}let Z=f.map((t)=>t.id),H,Q=async()=>{try{await i.shutdown()}finally{await b(a,{recursive:!0,force:!0})}};return Object.freeze({async tool(t,n){let l=i.getMCPService().listTools(),d=l.find(({tool:u})=>u.name===t);if(!d)throw Error(`No tool "${t}"; this brain has ${l.map(({tool:u})=>u.name).join(", ")}`);return te(await d.tool.handler(n,L()))},request:(t,n)=>h(i.getMessageBus(),t,n,Y),async fetch(t){let n=x(B(i),t.method.toUpperCase(),new URL(t.url).pathname);if(!n)return new Response("Not Found",{status:404});if(n.sharedHostAdmission==="deny")return new Response("Unauthorized",{status:401});return n.handler(t)},entities:C(i.getEntityService(),"restricted"),jobs:Object.freeze({async wait(t,n){let l=i.getJobQueueService(),d=async()=>{let c=await l.getStatus(n);if(!c||!Z.some((G)=>c.type===`${G}:${t.name}`))return null;if(re(c,Date.now()))return c;return await Bun.sleep(ee),d()},u=await d();return u?w(t,u):null}}),stop:()=>H??=Q()})}function Ee(e){return F(e,{brainVersion:U.version,directory:process.cwd()})}export{Ee as startTestBrain};
|
|
3
3
|
|
|
4
4
|
//# debugId=2715038A06CA0DA564756E2164756E21
|
|
5
5
|
//# sourceMappingURL=testing.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Az,b as Tz,d as a3,k as kz,l as wz}from"./studio-chunks/main-053fxhzx.js";import{$ as mz,$a as ci,A as tn,Aa as Va,B as he,Ba as xh,C as Xm,Ca as xx,D as zr,Da as by,E as k2,Ea as BL,F as ml,Fa as kt,G as Hz,Ga as ty,H as pc,Ha as lz,I as Ay,Ia as Sh,J as Gc,Ja as wy,K as Ax,Ka as jL,L as kh,La as ny,M as Rs,Ma as Vc,N as t3,Na as yi,O as n3,Oa as Ko,P as b3,Pa as yz,Q as Ae,Qa as py,R as Ei,Ra as bz,S as Ty,Sa as rz,T as Ma,Ta as az,U as mx,Ua as yy,V as fz,Va as o3,W as gx,Wa as Ez,X as dz,Xa as fi,Y as hz,Ya as Cl,Z as pz,Za as zg,_ as Zi,_a,aa as $n,ab as jg,ba as C2,bb as ih,ca as Km,cb as Ng,da as gz,db as ZM,ea as Jm,eb as JM,fa as Wn,fb as oh,ga as T2,gb as wM,ha as Iz,hb as CM,ia as E2,ib as K,ja as Uz,jb as eL,ka as _z,kb as nx,la as bn,lb as HO,m as p3,ma as qz,mb as PO,n as dc,na as $z,nb as Wg,o as g3,oa as Pz,p as ey,pa as Tx,q as hn,qa as D2,r as Sr,ra as jz,s as l3,sa as Vz,t as y3,ta as xy,u as r3,ua as ky,v as Ey,va as Qc,w as f2,wa as c3,x as d2,xa as f3,y as h2,ya as d3,z as Qm,za as Sx}from"./studio-chunks/main-8yebv6e9.js";import"./studio-chunks/main-kd598aj5.js";import{Ab as pe,Ac as u3,Bb as $a,Bc as qn,Cb as pl,Cc as Yz,Db as eg,Dc as mi,Ec as Fm,Fb as ry,Ic as qo,Jb as ay,Jc as v3,Kb as ez,Kc as S3,Lb as uy,Lc as Jt,Mb as tz,Mc as ii,Nb as vn,Nc as Gn,Ob as Sz,Oc as w2,Pb as xL,Pc as Ms,Qb as kL,Rb as wL,Rc as Vn,Tb as xz,Ub as iy,Vb as oy,Wb as sy,Xb as ly,_b as Y2,ac as Kg,bc as jm,cc as Vm,ec as mS,fc as yn,gc as le,hc as Qn,jc as Ld,kc as Cy,nc as Od,oc as Yg,pc as hS,qc as _L,vb as N,wc as Ki,yb as xe,yc as gi,zb as iz,zc as fc}from"./studio-chunks/main-g0036mxt.js";import{qd as hi}from"./studio-chunks/main-dervqz6s.js";import{Be as yt,De as nH}from"./studio-chunks/main-84jneqcz.js";import{hf as F,jf as uS,mf as xS}from"./studio-chunks/main-mxng8gm1.js";var s2=uS(function(tH){(function(){function e(){if(q=!1,ue){var W=tH.unstable_now();fe=W;var ie=!0;try{e:{B=!1,P&&(P=!1,V(Oe),Oe=-1),M=!0;var J=E;try{t:{u(W);for(C=s(S);C!==null&&!(C.expirationTime>W&&h());){var ce=C.callback;if(typeof ce==="function"){C.callback=null,E=C.priorityLevel;var Se=ce(C.expirationTime<=W);if(W=tH.unstable_now(),typeof Se==="function"){C.callback=Se,u(W),ie=!0;break t}C===s(S)&&l(S),u(W)}else l(S);C=s(S)}if(C!==null)ie=!0;else{var Fe=s(w);Fe!==null&&p(f,Fe.startTime-W),ie=!1}}break e}finally{C=null,E=J,M=!1}ie=void 0}}finally{ie?Y():ue=!1}}}function i(W,ie){var J=W.length;W.push(ie);e:for(;0<J;){var ce=J-1>>>1,Se=W[ce];if(0<a(Se,ie))W[ce]=ie,W[J]=Se,J=ce;else break e}}function s(W){return W.length===0?null:W[0]}function l(W){if(W.length===0)return null;var ie=W[0],J=W.pop();if(J!==ie){W[0]=J;e:for(var ce=0,Se=W.length,Fe=Se>>>1;ce<Fe;){var _e=2*(ce+1)-1,mt=W[_e],et=_e+1,ze=W[et];if(0>a(mt,J))et<Se&&0>a(ze,mt)?(W[ce]=ze,W[et]=J,ce=et):(W[ce]=mt,W[_e]=J,ce=_e);else if(et<Se&&0>a(ze,J))W[ce]=ze,W[et]=J,ce=et;else break e}}return ie}function a(W,ie){var J=W.sortIndex-ie.sortIndex;return J!==0?J:W.id-ie.id}function u(W){for(var ie=s(w);ie!==null;){if(ie.callback===null)l(w);else if(ie.startTime<=W)l(w),ie.sortIndex=ie.expirationTime,i(S,ie);else break;ie=s(w)}}function f(W){if(P=!1,u(W),!B)if(s(S)!==null)B=!0,ue||(ue=!0,Y());else{var ie=s(w);ie!==null&&p(f,ie.startTime-W)}}function h(){return q?!0:tH.unstable_now()-fe<U?!1:!0}function p(W,ie){Oe=Q(function(){W(tH.unstable_now())},ie)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),tH.unstable_now=void 0,typeof performance==="object"&&typeof performance.now==="function"){var g=performance;tH.unstable_now=function(){return g.now()}}else{var y=Date,v=y.now();tH.unstable_now=function(){return y.now()-v}}var S=[],w=[],A=1,C=null,E=3,M=!1,B=!1,P=!1,q=!1,Q=typeof setTimeout==="function"?setTimeout:null,V=typeof clearTimeout==="function"?clearTimeout:null,ve=typeof setImmediate<"u"?setImmediate:null,ue=!1,Oe=-1,U=5,fe=-1;if(typeof ve==="function")var Y=function(){ve(e)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,rt=re.port2;re.port1.onmessage=e,Y=function(){rt.postMessage(null)}}else Y=function(){Q(e,0)};tH.unstable_IdlePriority=5,tH.unstable_ImmediatePriority=1,tH.unstable_LowPriority=4,tH.unstable_NormalPriority=3,tH.unstable_Profiling=null,tH.unstable_UserBlockingPriority=2,tH.unstable_cancelCallback=function(W){W.callback=null},tH.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},tH.unstable_getCurrentPriorityLevel=function(){return E},tH.unstable_next=function(W){switch(E){case 1:case 2:case 3:var ie=3;break;default:ie=E}var J=E;E=ie;try{return W()}finally{E=J}},tH.unstable_requestPaint=function(){q=!0},tH.unstable_runWithPriority=function(W,ie){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var J=E;E=W;try{return ie()}finally{E=J}},tH.unstable_scheduleCallback=function(W,ie,J){var ce=tH.unstable_now();switch(typeof J==="object"&&J!==null?(J=J.delay,J=typeof J==="number"&&0<J?ce+J:ce):J=ce,W){case 1:var Se=-1;break;case 2:Se=250;break;case 5:Se=1073741823;break;case 4:Se=1e4;break;default:Se=5000}return Se=J+Se,W={id:A++,callback:ie,priorityLevel:W,startTime:J,expirationTime:Se,sortIndex:-1},J>ce?(W.sortIndex=J,i(w,W),s(S)===null&&W===s(w)&&(P?(V(Oe),Oe=-1):P=!0,p(f,J-ce))):(W.sortIndex=Se,i(S,W),B||M||(B=!0,ue||(ue=!0,Y()))),W},tH.unstable_shouldYield=h,tH.unstable_wrapCallback=function(W){var ie=E;return function(){var J=E;E=ie;try{return W.apply(this,arguments)}finally{E=J}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var l2=uS(function(iH){var it=F(s2()),sc=F(yt()),cS=F(nH());(function(){function e(t,n){for(t=t.memoizedState;t!==null&&0<n;)t=t.next,n--;return t}function i(t,n,o,r){if(o>=n.length)return r;var c=n[o],d=pn(t)?t.slice():je({},t);return d[c]=i(t[c],n,o+1,r),d}function s(t,n,o){if(n.length!==o.length)console.warn("copyWithRename() expects paths of the same length");else{for(var r=0;r<o.length-1;r++)if(n[r]!==o[r]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return l(t,n,o,0)}}function l(t,n,o,r){var c=n[r],d=pn(t)?t.slice():je({},t);return r+1===n.length?(d[o[r]]=d[c],pn(d)?d.splice(c,1):delete d[c]):d[c]=l(t[c],n,o,r+1),d}function a(t,n,o){var r=n[o],c=pn(t)?t.slice():je({},t);if(o+1===n.length)return pn(c)?c.splice(r,1):delete c[r],c;return c[r]=a(t[r],n,o+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(o){n.push(o)}),n.sort().join(", ")}function S(t,n,o,r){return new V3(t,n,o,r)}function w(t,n){t.context===Zl&&(Rb(t.current,2,n,t,null,null),gu())}function A(t,n){if(so!==null){var o=n.staleFamilies;n=n.updatedFamilies,Cf(),fk(t.current,n,o),gu()}}function C(t){so=t}function E(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function M(t){var n=t,o=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(o=n.return),t=n.return;while(t)}return n.tag===3?o:null}function B(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 P(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 Q(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 o=t,r=n;;){var c=o.return;if(c===null)break;var d=c.alternate;if(d===null){if(r=c.return,r!==null){o=r;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===o)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(o.return!==r.return)o=c,r=d;else{for(var m=!1,b=c.child;b;){if(b===o){m=!0,o=c,r=d;break}if(b===r){m=!0,r=c,o=d;break}b=b.sibling}if(!m){for(b=d.child;b;){if(b===o){m=!0,o=d,r=c;break}if(b===r){m=!0,r=d,o=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(o.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(o.tag!==3)throw Error("Unable to find node on an unmounted component.");return o.stateNode.current===o?t:n}function V(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=V(t),n!==null)return n;t=t.sibling}return null}function ve(t){if(t===null||typeof t!=="object")return null;return t=bA&&t[bA]||t["@@iterator"],typeof t==="function"?t:null}function ue(t){if(t==null)return null;if(typeof t==="function")return t.$$typeof===fB?null:t.displayName||t.name||null;if(typeof t==="string")return t;switch(t){case wu:return"Fragment";case Bb:return"Profiler";case Ip:return"StrictMode";case Ib:return"Suspense";case Ub:return"SuspenseList";case _b: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 ku:return"Portal";case bs:return t.displayName||"Context";case Hb:return(t._context.displayName||"Context")+".Consumer";case Nf:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Up:return n=t.displayName||null,n!==null?n:ue(t.type)||"Memo";case ji:n=t._payload,t=t._init;try{return ue(t(n))}catch(o){}}return null}function Oe(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 ue(n);case 8:return n===Ip?"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 o=n.length-1;0<=o;o--)if(typeof n[o].name==="string")return n[o].name}if(t.return!==null)return U(t.return)}return null}function fe(t){return{current:t}}function Y(t,n){0>Ks?console.error("Unexpected pop."):(n!==$b[Ks]&&console.error("Unexpected Fiber popped."),t.current=qb[Ks],qb[Ks]=null,$b[Ks]=null,Ks--)}function re(t,n,o){Ks++,qb[Ks]=t.current,$b[Ks]=o,t.current=n}function rt(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){re(Ql,n,t),re(Bf,t,t),re(Gl,null,t);var o=n.nodeType;switch(o){case 9:case 11:o=o===9?"#document":"#fragment",n=(n=n.documentElement)?(n=n.namespaceURI)?PC(n):fl:fl;break;default:if(o=n.tagName,n=n.namespaceURI)n=PC(n),n=jC(n,o);else switch(o){case"svg":n=ic;break;case"math":n=Hm;break;default:n=fl}}o=o.toLowerCase(),o=Hx(null,o),o={context:n,ancestorInfo:o},Y(Gl,t),re(Gl,o,t)}function ie(t){Y(Gl,t),Y(Bf,t),Y(Ql,t)}function J(){return rt(Gl.current)}function ce(t){t.memoizedState!==null&&re(_p,t,t);var n=rt(Gl.current),o=t.type,r=jC(n.context,o);o=Hx(n.ancestorInfo,o),r={context:r,ancestorInfo:o},n!==r&&(re(Bf,t,t),re(Gl,r,t))}function Se(t){Bf.current===t&&(Y(Gl,t),Y(Bf,t)),_p.current===t&&(Y(_p,t),Td._currentValue=Da)}function Fe(){}function _e(){if(Hf===0){vA=console.log,SA=console.info,xA=console.warn,kA=console.error,wA=console.group,CA=console.groupCollapsed,AA=console.groupEnd;var t={configurable:!0,enumerable:!0,value:Fe,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}Hf++}function mt(){if(Hf--,Hf===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:je({},t,{value:vA}),info:je({},t,{value:SA}),warn:je({},t,{value:xA}),error:je({},t,{value:kA}),group:je({},t,{value:wA}),groupCollapsed:je({},t,{value:CA}),groupEnd:je({},t,{value:AA})})}0>Hf&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function et(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{a as Az,b as Tz,d as a3,k as kz,l as wz}from"./studio-chunks/main-3htxv1fh.js";import{$ as mz,$a as ci,A as tn,Aa as Va,B as he,Ba as xh,C as Xm,Ca as xx,D as zr,Da as by,E as k2,Ea as BL,F as ml,Fa as kt,G as Hz,Ga as ty,H as pc,Ha as lz,I as Ay,Ia as Sh,J as Gc,Ja as wy,K as Ax,Ka as jL,L as kh,La as ny,M as Rs,Ma as Vc,N as t3,Na as yi,O as n3,Oa as Ko,P as b3,Pa as yz,Q as Ae,Qa as py,R as Ei,Ra as bz,S as Ty,Sa as rz,T as Ma,Ta as az,U as mx,Ua as yy,V as fz,Va as o3,W as gx,Wa as Ez,X as dz,Xa as fi,Y as hz,Ya as Cl,Z as pz,Za as zg,_ as Zi,_a,aa as $n,ab as jg,ba as C2,bb as ih,ca as Km,cb as Ng,da as gz,db as ZM,ea as Jm,eb as JM,fa as Wn,fb as oh,ga as T2,gb as wM,ha as Iz,hb as CM,ia as E2,ib as K,ja as Uz,jb as eL,ka as _z,kb as nx,la as bn,lb as HO,m as p3,ma as qz,mb as PO,n as dc,na as $z,o as g3,oa as Pz,p as ey,pa as Tx,pb as Wg,q as hn,qa as D2,r as Sr,ra as jz,s as l3,sa as Vz,t as y3,ta as xy,u as r3,ua as ky,v as Ey,va as Qc,w as f2,wa as c3,x as d2,xa as f3,y as h2,ya as d3,z as Qm,za as Sx}from"./studio-chunks/main-jch2bj9d.js";import"./studio-chunks/main-7qt9yk4m.js";import{Ab as xe,Ac as gi,Bb as iz,Bc as fc,Cb as pe,Cc as u3,Db as $a,Dc as qn,Eb as pl,Ec as Yz,Fb as eg,Fc as mi,Gc as Fm,Hb as ry,Kc as qo,Lb as ay,Lc as v3,Mb as ez,Mc as S3,Nb as uy,Nc as Jt,Ob as tz,Oc as ii,Pb as vn,Pc as Gn,Qb as Sz,Qc as w2,Rb as xL,Rc as Ms,Sb as kL,Tb as wL,Tc as Vn,Vb as xz,Wb as iy,Xb as oy,Yb as sy,Zb as ly,ac as Y2,cc as Kg,dc as jm,ec as Vm,gc as mS,hc as yn,ic as le,jc as Qn,lc as Ld,mc as Cy,pc as Od,qc as Yg,rc as hS,sc as _L,xb as N,yc as Ki}from"./studio-chunks/main-78k6snwb.js";import{sd as hi}from"./studio-chunks/main-6t5cpsqt.js";import{De as yt,Fe as nH}from"./studio-chunks/main-sf1tftcq.js";import{jf as F,lf as uS,of as xS}from"./studio-chunks/main-e3v487c0.js";var s2=uS(function(tH){(function(){function e(){if(q=!1,ue){var W=tH.unstable_now();fe=W;var ie=!0;try{e:{B=!1,P&&(P=!1,V(Oe),Oe=-1),M=!0;var J=E;try{t:{u(W);for(C=s(S);C!==null&&!(C.expirationTime>W&&h());){var ce=C.callback;if(typeof ce==="function"){C.callback=null,E=C.priorityLevel;var Se=ce(C.expirationTime<=W);if(W=tH.unstable_now(),typeof Se==="function"){C.callback=Se,u(W),ie=!0;break t}C===s(S)&&l(S),u(W)}else l(S);C=s(S)}if(C!==null)ie=!0;else{var Fe=s(w);Fe!==null&&p(f,Fe.startTime-W),ie=!1}}break e}finally{C=null,E=J,M=!1}ie=void 0}}finally{ie?Y():ue=!1}}}function i(W,ie){var J=W.length;W.push(ie);e:for(;0<J;){var ce=J-1>>>1,Se=W[ce];if(0<a(Se,ie))W[ce]=ie,W[J]=Se,J=ce;else break e}}function s(W){return W.length===0?null:W[0]}function l(W){if(W.length===0)return null;var ie=W[0],J=W.pop();if(J!==ie){W[0]=J;e:for(var ce=0,Se=W.length,Fe=Se>>>1;ce<Fe;){var _e=2*(ce+1)-1,mt=W[_e],et=_e+1,ze=W[et];if(0>a(mt,J))et<Se&&0>a(ze,mt)?(W[ce]=ze,W[et]=J,ce=et):(W[ce]=mt,W[_e]=J,ce=_e);else if(et<Se&&0>a(ze,J))W[ce]=ze,W[et]=J,ce=et;else break e}}return ie}function a(W,ie){var J=W.sortIndex-ie.sortIndex;return J!==0?J:W.id-ie.id}function u(W){for(var ie=s(w);ie!==null;){if(ie.callback===null)l(w);else if(ie.startTime<=W)l(w),ie.sortIndex=ie.expirationTime,i(S,ie);else break;ie=s(w)}}function f(W){if(P=!1,u(W),!B)if(s(S)!==null)B=!0,ue||(ue=!0,Y());else{var ie=s(w);ie!==null&&p(f,ie.startTime-W)}}function h(){return q?!0:tH.unstable_now()-fe<U?!1:!0}function p(W,ie){Oe=Q(function(){W(tH.unstable_now())},ie)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),tH.unstable_now=void 0,typeof performance==="object"&&typeof performance.now==="function"){var g=performance;tH.unstable_now=function(){return g.now()}}else{var y=Date,v=y.now();tH.unstable_now=function(){return y.now()-v}}var S=[],w=[],A=1,C=null,E=3,M=!1,B=!1,P=!1,q=!1,Q=typeof setTimeout==="function"?setTimeout:null,V=typeof clearTimeout==="function"?clearTimeout:null,ve=typeof setImmediate<"u"?setImmediate:null,ue=!1,Oe=-1,U=5,fe=-1;if(typeof ve==="function")var Y=function(){ve(e)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,rt=re.port2;re.port1.onmessage=e,Y=function(){rt.postMessage(null)}}else Y=function(){Q(e,0)};tH.unstable_IdlePriority=5,tH.unstable_ImmediatePriority=1,tH.unstable_LowPriority=4,tH.unstable_NormalPriority=3,tH.unstable_Profiling=null,tH.unstable_UserBlockingPriority=2,tH.unstable_cancelCallback=function(W){W.callback=null},tH.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},tH.unstable_getCurrentPriorityLevel=function(){return E},tH.unstable_next=function(W){switch(E){case 1:case 2:case 3:var ie=3;break;default:ie=E}var J=E;E=ie;try{return W()}finally{E=J}},tH.unstable_requestPaint=function(){q=!0},tH.unstable_runWithPriority=function(W,ie){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var J=E;E=W;try{return ie()}finally{E=J}},tH.unstable_scheduleCallback=function(W,ie,J){var ce=tH.unstable_now();switch(typeof J==="object"&&J!==null?(J=J.delay,J=typeof J==="number"&&0<J?ce+J:ce):J=ce,W){case 1:var Se=-1;break;case 2:Se=250;break;case 5:Se=1073741823;break;case 4:Se=1e4;break;default:Se=5000}return Se=J+Se,W={id:A++,callback:ie,priorityLevel:W,startTime:J,expirationTime:Se,sortIndex:-1},J>ce?(W.sortIndex=J,i(w,W),s(S)===null&&W===s(w)&&(P?(V(Oe),Oe=-1):P=!0,p(f,J-ce))):(W.sortIndex=Se,i(S,W),B||M||(B=!0,ue||(ue=!0,Y()))),W},tH.unstable_shouldYield=h,tH.unstable_wrapCallback=function(W){var ie=E;return function(){var J=E;E=ie;try{return W.apply(this,arguments)}finally{E=J}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var l2=uS(function(iH){var it=F(s2()),sc=F(yt()),cS=F(nH());(function(){function e(t,n){for(t=t.memoizedState;t!==null&&0<n;)t=t.next,n--;return t}function i(t,n,o,r){if(o>=n.length)return r;var c=n[o],d=pn(t)?t.slice():je({},t);return d[c]=i(t[c],n,o+1,r),d}function s(t,n,o){if(n.length!==o.length)console.warn("copyWithRename() expects paths of the same length");else{for(var r=0;r<o.length-1;r++)if(n[r]!==o[r]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return l(t,n,o,0)}}function l(t,n,o,r){var c=n[r],d=pn(t)?t.slice():je({},t);return r+1===n.length?(d[o[r]]=d[c],pn(d)?d.splice(c,1):delete d[c]):d[c]=l(t[c],n,o,r+1),d}function a(t,n,o){var r=n[o],c=pn(t)?t.slice():je({},t);if(o+1===n.length)return pn(c)?c.splice(r,1):delete c[r],c;return c[r]=a(t[r],n,o+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(o){n.push(o)}),n.sort().join(", ")}function S(t,n,o,r){return new V3(t,n,o,r)}function w(t,n){t.context===Zl&&(Rb(t.current,2,n,t,null,null),gu())}function A(t,n){if(so!==null){var o=n.staleFamilies;n=n.updatedFamilies,Cf(),fk(t.current,n,o),gu()}}function C(t){so=t}function E(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function M(t){var n=t,o=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(o=n.return),t=n.return;while(t)}return n.tag===3?o:null}function B(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 P(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 Q(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 o=t,r=n;;){var c=o.return;if(c===null)break;var d=c.alternate;if(d===null){if(r=c.return,r!==null){o=r;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===o)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(o.return!==r.return)o=c,r=d;else{for(var m=!1,b=c.child;b;){if(b===o){m=!0,o=c,r=d;break}if(b===r){m=!0,r=c,o=d;break}b=b.sibling}if(!m){for(b=d.child;b;){if(b===o){m=!0,o=d,r=c;break}if(b===r){m=!0,r=d,o=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(o.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(o.tag!==3)throw Error("Unable to find node on an unmounted component.");return o.stateNode.current===o?t:n}function V(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=V(t),n!==null)return n;t=t.sibling}return null}function ve(t){if(t===null||typeof t!=="object")return null;return t=bA&&t[bA]||t["@@iterator"],typeof t==="function"?t:null}function ue(t){if(t==null)return null;if(typeof t==="function")return t.$$typeof===fB?null:t.displayName||t.name||null;if(typeof t==="string")return t;switch(t){case wu:return"Fragment";case Bb:return"Profiler";case Ip:return"StrictMode";case Ib:return"Suspense";case Ub:return"SuspenseList";case _b: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 ku:return"Portal";case bs:return t.displayName||"Context";case Hb:return(t._context.displayName||"Context")+".Consumer";case Nf:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Up:return n=t.displayName||null,n!==null?n:ue(t.type)||"Memo";case ji:n=t._payload,t=t._init;try{return ue(t(n))}catch(o){}}return null}function Oe(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 ue(n);case 8:return n===Ip?"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 o=n.length-1;0<=o;o--)if(typeof n[o].name==="string")return n[o].name}if(t.return!==null)return U(t.return)}return null}function fe(t){return{current:t}}function Y(t,n){0>Ks?console.error("Unexpected pop."):(n!==$b[Ks]&&console.error("Unexpected Fiber popped."),t.current=qb[Ks],qb[Ks]=null,$b[Ks]=null,Ks--)}function re(t,n,o){Ks++,qb[Ks]=t.current,$b[Ks]=o,t.current=n}function rt(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){re(Ql,n,t),re(Bf,t,t),re(Gl,null,t);var o=n.nodeType;switch(o){case 9:case 11:o=o===9?"#document":"#fragment",n=(n=n.documentElement)?(n=n.namespaceURI)?PC(n):fl:fl;break;default:if(o=n.tagName,n=n.namespaceURI)n=PC(n),n=jC(n,o);else switch(o){case"svg":n=ic;break;case"math":n=Hm;break;default:n=fl}}o=o.toLowerCase(),o=Hx(null,o),o={context:n,ancestorInfo:o},Y(Gl,t),re(Gl,o,t)}function ie(t){Y(Gl,t),Y(Bf,t),Y(Ql,t)}function J(){return rt(Gl.current)}function ce(t){t.memoizedState!==null&&re(_p,t,t);var n=rt(Gl.current),o=t.type,r=jC(n.context,o);o=Hx(n.ancestorInfo,o),r={context:r,ancestorInfo:o},n!==r&&(re(Bf,t,t),re(Gl,r,t))}function Se(t){Bf.current===t&&(Y(Gl,t),Y(Bf,t)),_p.current===t&&(Y(_p,t),Td._currentValue=Da)}function Fe(){}function _e(){if(Hf===0){vA=console.log,SA=console.info,xA=console.warn,kA=console.error,wA=console.group,CA=console.groupCollapsed,AA=console.groupEnd;var t={configurable:!0,enumerable:!0,value:Fe,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}Hf++}function mt(){if(Hf--,Hf===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:je({},t,{value:vA}),info:je({},t,{value:SA}),warn:je({},t,{value:xA}),error:je({},t,{value:kA}),group:je({},t,{value:wA}),groupCollapsed:je({},t,{value:CA}),groupEnd:je({},t,{value:AA})})}0>Hf&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function et(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 ze(t){if(Pb===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);Pb=n&&n[1]||"",TA=-1<o.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=Vm(jm(l),80);if(!a)return null;let u=s.join(`
|
|
216
216
|
`).trim();return{slug:a,title:l,body:u?`# ${l}
|
|
217
217
|
|
|
218
|
-
${u}`:`# ${l}`}}var ye=F(xe(),1),X2=15000,W2=2;function zd(e){return ye.jsxDEV("a",{href:e.href,className:e.className,onClick:(i)=>{if(!ml(i))return;i.preventDefault(),e.onNavigate(e.href)},children:e.children},void 0,!1,void 0,this)}function Ke(...e){return le("",...e).trim()}var dH={error:Be.dotError,warn:Be.dotWarn,info:Be.dotInfo},hH={good:Be.statusGood,warn:Be.statusWarn,error:Be.statusError};function pH(e){return ye.jsxDEV("section",{"aria-labelledby":"home-needs-you",children:[ye.jsxDEV("h2",{id:"home-needs-you",className:Ke(Be.bandHead),children:["Needs you",e.items.length>0&&ye.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?ye.jsxDEV("p",{className:Ke(Be.allClear),children:"Nothing is waiting on you."},void 0,!1,void 0,this):ye.jsxDEV("ul",{style:{listStyle:"none",margin:0,padding:0},children:e.items.map((i)=>ye.jsxDEV("li",{"data-home-attention":i.severity,className:Ke(Be.attention),children:[ye.jsxDEV("span",{"aria-hidden":"true",className:Ke(Be.dot,dH[i.severity])},void 0,!1,void 0,this),ye.jsxDEV("div",{className:Ke(Be.attentionText),children:[ye.jsxDEV("p",{className:Ke(Be.attentionTitle),children:i.title},void 0,!1,void 0,this),i.detail&&ye.jsxDEV("p",{className:Ke(Be.attentionDetail),children:i.detail},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.action&&ye.jsxDEV("span",{className:Ke(Be.attentionAction),children:ye.jsxDEV(pe,{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 ye.jsxDEV("section",{"aria-labelledby":"home-continue",children:[ye.jsxDEV("h2",{id:"home-continue",className:Ke(Be.bandHead),children:"Continue"},void 0,!1,void 0,this),e.drafts.map((i)=>ye.jsxDEV(zd,{href:i.href,onNavigate:e.onNavigate,className:Ke(Be.card),children:[ye.jsxDEV("span",{className:Ke(Be.cardMeta),children:[ye.jsxDEV("span",{className:Ke(Be.draftBadge),children:"Draft"},void 0,!1,void 0,this),`${i.typeLabel}, edited ${Ma(i.updated)}`]},void 0,!0,void 0,this),ye.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)=>ye.jsxDEV(zd,{href:`${pc}?session=${encodeURIComponent(i.id)}`,onNavigate:e.onNavigate,className:Ke(Be.card),children:[ye.jsxDEV("span",{className:Ke(Be.cardMeta),children:`Conversation, ${Ma(i.lastActiveAt)}`},void 0,!1,void 0,this),ye.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 gH(e){if(e.published.length===0)return null;return ye.jsxDEV("section",{"aria-labelledby":"home-published",children:[ye.jsxDEV("h2",{id:"home-published",className:Ke(Be.bandHead),children:"Recently published"},void 0,!1,void 0,this),e.published.map((i)=>ye.jsxDEV(zd,{href:i.href,onNavigate:e.onNavigate,className:Ke(Be.published),children:[ye.jsxDEV("span",{className:Ke(Be.publishedTitle),children:i.title},void 0,!1,void 0,this),ye.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 yH(e){let i=Jt(),[s,l]=SS.useState(""),[a,u]=SS.useState(null),f=Sr({mutationFn:async(y)=>{let v=Q2(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:qn(Rs(),"note",v)})}}),h=s.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 ye.jsxDEV("div",{"data-home-composer":"",className:Ke(Be.composer),children:[ye.jsxDEV("textarea",{"aria-label":"Write something down, or ask your brain",rows:2,value:s,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),ye.jsxDEV("div",{className:Ke(Be.composerBar),children:[ye.jsxDEV(pe,{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&&ye.jsxDEV(pe,{type:"button",variant:"secondary",size:"sm",disabled:!h,onClick:p,children:"Ask"},void 0,!1,void 0,this),ye.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)&&ye.jsxDEV("p",{role:"status",className:Ke(Be.composerNote),children:a?ye.jsxDEV(ye.Fragment,{children:["Saved as a note."," ",ye.jsxDEV(zd,{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 bH(e){let i=Y2(),{data:s}=hn({queryKey:["studio","home","conversations",e??""],queryFn:async()=>{let{chatSessionsResponseSchema:l}=await import("./studio-chunks/chat-921jr7fh.js"),a=(e??"").replace(/\/+$/,""),u=await(i??fetch)(`${a}/sessions?limit=${W2}`);if(!u.ok)return[];return l.parse(await u.json()).sessions.slice(0,W2)},enabled:e!==void 0,refetchInterval:X2});return s??[]}function F2(e){let i=Jt(),{data:s,error:l}=hn({queryKey:["studio","home"],queryFn:()=>i.fetchHome(),refetchInterval:X2}),a=bH(e.chatApiPath);if(!s)return ye.jsxDEV("main",{className:Ke(Be.page),children:ye.jsxDEV(he,{...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 ye.jsxDEV("main",{"data-studio-home":"",className:Ke(Be.page),children:[ye.jsxDEV("header",{className:"studio-page-head",children:[ye.jsxDEV("p",{className:Ke(Be.date),children:G2(s.now)},void 0,!1,void 0,this),ye.jsxDEV("h1",{className:Ke(Be.sentence),children:V2({needs:s.needsYou.length,drafts:s.drafts.length})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ye.jsxDEV(yH,{onAsk:e.onAsk,onNavigate:e.onNavigate,canAsk:e.chatApiPath!==void 0},void 0,!1,void 0,this),ye.jsxDEV("div",{className:Ke(Be.columns),children:[ye.jsxDEV(pH,{items:s.needsYou,onNavigate:e.onNavigate},void 0,!1,void 0,this),ye.jsxDEV("div",{children:[ye.jsxDEV(mH,{drafts:s.drafts,conversations:a,onNavigate:e.onNavigate},void 0,!1,void 0,this),ye.jsxDEV("div",{style:{marginTop:28},children:ye.jsxDEV(gH,{published:s.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),ye.jsxDEV("footer",{role:"status",className:Ke(Be.status),children:[ye.jsxDEV("span",{"aria-hidden":"true",className:Ke(Be.statusDot,hH[s.status.tone])},void 0,!1,void 0,this),ye.jsxDEV("span",{className:Ke(Be.statusText),children:s.status.text},void 0,!1,void 0,this),ye.jsxDEV(zd,{href:s.status.history.href,onNavigate:e.onNavigate,className:Ke(Be.link),children:s.status.history.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var tg=F(yt(),1);var lt=F(xe(),1);function Z2(e){let{state:i}=e,s=tg.useRef(null);if(tg.useEffect(()=>{if(i.kind==="error"&&i.issues?.length&&!s.current?.closest("form")?.querySelector("[data-studio-invalid-field]")){let l=s.current?.querySelector("details");if(l)l.open=!0;s.current?.focus()}},[i]),i.kind==="saved")return i.noop?lt.jsxDEV(he,{tone:"good",save:!0,children:"No changes — already saved."},void 0,!1,void 0,this):lt.jsxDEV(he,{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(tn.conflict),role:"alert","data-studio-conflict":"",children:[lt.jsxDEV("h4",{...N(tn.conflictTitle),children:"The manuscript changed elsewhere"},void 0,!1,void 0,this),lt.jsxDEV("p",{...N(tn.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(tn.validationSummary),ref:s,tabIndex:-1,role:"group","aria-label":"Save failed",children:[lt.jsxDEV(he,{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(tn.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 J2(e,i,s="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(s==="create")return"Not created yet";if(s==="first-save")return"Not saved yet";return i?"Unsaved changes":"Saved"}function ng(e){let{save:i,git:s,baselineCommit:l}=e,a=s?.lastCommit?s.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(!s)return{db:"done",exported:"done",committed:"pending",commitRef:a};if(s.hasChanges)return{db:"done",exported:"done",committed:"active",commitRef:a};if(s.lastCommit!==l)return{db:"done",exported:"done",committed:"done",commitRef:a};return{db:"done",exported:"active",committed:"pending",commitRef:a}}function kS(e){return lt.jsxDEV("span",{...N(tn.station,e.state==="done"&&tn.done,e.state==="active"&&tn.active),"data-studio-station":e.state,children:[lt.jsxDEV("span",{...N(tn.dot,e.state==="done"&&tn.doneDot,e.state==="active"&&tn.activeDot)},void 0,!1,void 0,this),e.label]},void 0,!0,void 0,this)}function K2(e){return lt.jsxDEV("span",{...N(tn.track),"data-studio-flowing":e.flowing?"":void 0,"aria-hidden":"true",children:lt.jsxDEV("span",{...N(tn.flow,e.flowing&&tn.flowing)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function eD(e){let{view:i,gitConfigured:s}=e;return lt.jsxDEV("span",{...N(tn.wrap),children:[lt.jsxDEV("span",{...N(tn.stations),children:[lt.jsxDEV(kS,{state:i.db,label:"entity db"},void 0,!1,void 0,this),lt.jsxDEV(K2,{flowing:i.db==="done"&&i.exported==="active"},void 0,!1,void 0,this),lt.jsxDEV(kS,{state:i.exported,label:"exported to file"},void 0,!1,void 0,this),s?lt.jsxDEV(lt.Fragment,{children:[lt.jsxDEV(K2,{flowing:i.exported==="done"&&i.committed==="active"},void 0,!1,void 0,this),lt.jsxDEV(kS,{state:i.committed,label:"committed"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):lt.jsxDEV("span",{...N(tn.station,tn.noGit),children:"no git remote"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.commitRef&<.jsxDEV("span",{...N(tn.ref),children:["last write ",lt.jsxDEV("b",{...N(tn.refValue),children:i.commitRef},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function tD(e){return lt.jsxDEV(vn,{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 my=F(yt(),1);var Mt={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},assist:{k1xSpc:"x78zum5 x1bkxw62 x10acg2q xbrvn9l",kGNEyG:"x6s0dn4",kOIVth:"x883omv",kmVPX3:"x13j9azq",kWkggS:"xg47p5g",kAzted:"x2lwn1j",k1JLwA:"xlpkf44",kLyoy9:"x1otypdl",kRugJJ:"x1xccwpl",$$css:!0},input:{kUk6DE:"x98rzlu",k7Eaqz:"xfb3i0g",kXkAfU:"x1w9335",kr4CYY:"xf2x79s",$$css:!0},select:{ks0D6T:"x1racy4e",kCrP1I:"x1yagzmq",koRygp:"x1dbdljh",k76vLx:"xeyi6kz",$$css:!0},run:{kmVPX3:"xbnpv00",khDVqt:"xuxw1ft",$$css:!0},presets:{k1xSpc:"x3nfvp2",kOIVth:"x1jnr06f",kCrP1I:"x1yagzmq",kjH4Xa:"xal9krd",$$css:!0},preset:{khDVqt:"x1tndu2m",$$css:!0},assistMeta:{kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg",kMwMTN:"x1ar3pfp",khDVqt:"xuxw1ft",kHdLCk:"xkaaz9w",$$css:!0},suggestion:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kOIVth:"x1v2ro7d",kmVPX3:"xnohdxd",kWkggS:"x153t6mt",kdLj2q:"x1o3peri",kf00j:"xzbubq",kRugJJ:"xlko52b",$$css:!0},answer:{kWkggS:"x9kxhyz",$$css:!0},copy:{kskxy:"x1aoj0v",kVQacm:"xysyzu8",kGuDYH:"x4z9k3i",kMwMTN:"xqvuw85",kHjlTd:"xj0a0fe",koRygp:"x1dbdljh",kKwN1N:"x1h9t1nj",$$css:!0},answerTitle:{k1xSpc:"x1lliihq",k1K539:"xzueoph",kMv6JI:"xa9opjo",kGuDYH:"x1k6wstc",kb6lSQ:"x1vyo3qp",kMwMTN:"x1es3s4s",$$css:!0},spacer:{kUk6DE:"x98rzlu",$$css:!0},status:{kmVPX3:"x1vrqldd",$$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 CS=[],sD=[];(()=>{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,s=0;i<e.length;i++)(i%2?sD:CS).push(s=s+e[i])})();function vH(e){if(e<768)return!1;for(let i=0,s=CS.length;;){let l=i+s>>1;if(e<CS[l])s=l;else if(e>=sD[l])i=l+1;else return!0;if(i==s)return!1}}function nD(e){return e>=127462&&e<=127487}var iD=8205;function lD(e,i,s=!0,l=!0){return(s?rD:SH)(e,i,l)}function rD(e,i,s){if(i==e.length)return i;if(i&&aD(e.charCodeAt(i))&&uD(e.charCodeAt(i-1)))i--;let l=wS(e,i);i+=oD(l);while(i<e.length){let a=wS(e,i);if(l==iD||a==iD||s&&vH(a))i+=oD(a),l=a;else if(nD(a)){let u=0,f=i-2;while(f>=0&&nD(wS(e,f)))u++,f-=2;if(u%2==0)break;else i+=2}else break}return i}function SH(e,i,s){while(i>1){let l=rD(e,i-2,s);if(l<i)return l;i--}return 0}function wS(e,i){let s=e.charCodeAt(i);if(!uD(s)||i+1==e.length)return s;let l=e.charCodeAt(i+1);if(!aD(l))return s;return(s-55296<<10)+(l-56320)+65536}function aD(e){return e>=56320&&e<57344}function uD(e){return e>=55296&&e<56320}function oD(e){return e<65536?1:2}class ot{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,s){[e,i]=bc(this,e,i);let l=[];if(this.decompose(0,e,l,2),s.length)s.decompose(0,s.length,l,3);return this.decompose(i,this.length,l,1),Os.from(l,this.length-(i-e)+s.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,i=this.length){[e,i]=bc(this,e,i);let s=[];return this.decompose(e,i,s,0),Os.from(s,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),s=this.length-this.scanIdentical(e,-1),l=new gc(this),a=new gc(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>=s)return!0}}iter(e=1){return new gc(this,e)}iterRange(e,i=this.length){return new BS(this,e,i)}iterLines(e,i){let s;if(e==null)s=this.iter();else{if(i==null)i=this.lines+1;let l=this.line(e).from;s=this.iterRange(l,Math.max(l,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))}return new HS(s)}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 ot.empty;return e.length<=32?new nn(e):Os.from(nn.split(e,[]))}}class nn extends ot{constructor(e,i=xH(e)){super();this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,s,l){for(let a=0;;a++){let u=this.text[a],f=l+u.length;if((i?s:f)>=e)return new mD(l,f,s,u);l=f+1,s++}}decompose(e,i,s,l){let a=e<=0&&i>=this.length?this:new nn(cD(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(l&1){let u=s.pop(),f=lg(a.text,u.text.slice(),0,a.length);if(f.length<=32)s.push(new nn(f,u.length+a.length));else{let h=f.length>>1;s.push(new nn(f.slice(0,h)),new nn(f.slice(h)))}}else s.push(a)}replace(e,i,s){if(!(s instanceof nn))return super.replace(e,i,s);[e,i]=bc(this,e,i);let l=lg(this.text,lg(s.text,cD(this.text,0,e)),i),a=this.length+s.length-(i-e);if(l.length<=32)return new nn(l,a);return Os.from(nn.split(l,[]),a)}sliceString(e,i=this.length,s=`
|
|
218
|
+
${u}`:`# ${l}`}}var ye=F(xe(),1),X2=15000,W2=2;function zd(e){return ye.jsxDEV("a",{href:e.href,className:e.className,onClick:(i)=>{if(!ml(i))return;i.preventDefault(),e.onNavigate(e.href)},children:e.children},void 0,!1,void 0,this)}function Ke(...e){return le("",...e).trim()}var dH={error:Be.dotError,warn:Be.dotWarn,info:Be.dotInfo},hH={good:Be.statusGood,warn:Be.statusWarn,error:Be.statusError};function pH(e){return ye.jsxDEV("section",{"aria-labelledby":"home-needs-you",children:[ye.jsxDEV("h2",{id:"home-needs-you",className:Ke(Be.bandHead),children:["Needs you",e.items.length>0&&ye.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?ye.jsxDEV("p",{className:Ke(Be.allClear),children:"Nothing is waiting on you."},void 0,!1,void 0,this):ye.jsxDEV("ul",{style:{listStyle:"none",margin:0,padding:0},children:e.items.map((i)=>ye.jsxDEV("li",{"data-home-attention":i.severity,className:Ke(Be.attention),children:[ye.jsxDEV("span",{"aria-hidden":"true",className:Ke(Be.dot,dH[i.severity])},void 0,!1,void 0,this),ye.jsxDEV("div",{className:Ke(Be.attentionText),children:[ye.jsxDEV("p",{className:Ke(Be.attentionTitle),children:i.title},void 0,!1,void 0,this),i.detail&&ye.jsxDEV("p",{className:Ke(Be.attentionDetail),children:i.detail},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.action&&ye.jsxDEV("span",{className:Ke(Be.attentionAction),children:ye.jsxDEV(pe,{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 ye.jsxDEV("section",{"aria-labelledby":"home-continue",children:[ye.jsxDEV("h2",{id:"home-continue",className:Ke(Be.bandHead),children:"Continue"},void 0,!1,void 0,this),e.drafts.map((i)=>ye.jsxDEV(zd,{href:i.href,onNavigate:e.onNavigate,className:Ke(Be.card),children:[ye.jsxDEV("span",{className:Ke(Be.cardMeta),children:[ye.jsxDEV("span",{className:Ke(Be.draftBadge),children:"Draft"},void 0,!1,void 0,this),`${i.typeLabel}, edited ${Ma(i.updated)}`]},void 0,!0,void 0,this),ye.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)=>ye.jsxDEV(zd,{href:`${pc}?session=${encodeURIComponent(i.id)}`,onNavigate:e.onNavigate,className:Ke(Be.card),children:[ye.jsxDEV("span",{className:Ke(Be.cardMeta),children:`Conversation, ${Ma(i.lastActiveAt)}`},void 0,!1,void 0,this),ye.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 gH(e){if(e.published.length===0)return null;return ye.jsxDEV("section",{"aria-labelledby":"home-published",children:[ye.jsxDEV("h2",{id:"home-published",className:Ke(Be.bandHead),children:"Recently published"},void 0,!1,void 0,this),e.published.map((i)=>ye.jsxDEV(zd,{href:i.href,onNavigate:e.onNavigate,className:Ke(Be.published),children:[ye.jsxDEV("span",{className:Ke(Be.publishedTitle),children:i.title},void 0,!1,void 0,this),ye.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 yH(e){let i=Jt(),[s,l]=SS.useState(""),[a,u]=SS.useState(null),f=Sr({mutationFn:async(y)=>{let v=Q2(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:qn(Rs(),"note",v)})}}),h=s.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 ye.jsxDEV("div",{"data-home-composer":"",className:Ke(Be.composer),children:[ye.jsxDEV("textarea",{"aria-label":"Write something down, or ask your brain",rows:2,value:s,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),ye.jsxDEV("div",{className:Ke(Be.composerBar),children:[ye.jsxDEV(pe,{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&&ye.jsxDEV(pe,{type:"button",variant:"secondary",size:"sm",disabled:!h,onClick:p,children:"Ask"},void 0,!1,void 0,this),ye.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)&&ye.jsxDEV("p",{role:"status",className:Ke(Be.composerNote),children:a?ye.jsxDEV(ye.Fragment,{children:["Saved as a note."," ",ye.jsxDEV(zd,{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 bH(e){let i=Y2(),{data:s}=hn({queryKey:["studio","home","conversations",e??""],queryFn:async()=>{let{chatSessionsResponseSchema:l}=await import("./studio-chunks/chat-45vnn1n8.js"),a=(e??"").replace(/\/+$/,""),u=await(i??fetch)(`${a}/sessions?limit=${W2}`);if(!u.ok)return[];return l.parse(await u.json()).sessions.slice(0,W2)},enabled:e!==void 0,refetchInterval:X2});return s??[]}function F2(e){let i=Jt(),{data:s,error:l}=hn({queryKey:["studio","home"],queryFn:()=>i.fetchHome(),refetchInterval:X2}),a=bH(e.chatApiPath);if(!s)return ye.jsxDEV("main",{className:Ke(Be.page),children:ye.jsxDEV(he,{...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 ye.jsxDEV("main",{"data-studio-home":"",className:Ke(Be.page),children:[ye.jsxDEV("header",{className:"studio-page-head",children:[ye.jsxDEV("p",{className:Ke(Be.date),children:G2(s.now)},void 0,!1,void 0,this),ye.jsxDEV("h1",{className:Ke(Be.sentence),children:V2({needs:s.needsYou.length,drafts:s.drafts.length})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ye.jsxDEV(yH,{onAsk:e.onAsk,onNavigate:e.onNavigate,canAsk:e.chatApiPath!==void 0},void 0,!1,void 0,this),ye.jsxDEV("div",{className:Ke(Be.columns),children:[ye.jsxDEV(pH,{items:s.needsYou,onNavigate:e.onNavigate},void 0,!1,void 0,this),ye.jsxDEV("div",{children:[ye.jsxDEV(mH,{drafts:s.drafts,conversations:a,onNavigate:e.onNavigate},void 0,!1,void 0,this),ye.jsxDEV("div",{style:{marginTop:28},children:ye.jsxDEV(gH,{published:s.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),ye.jsxDEV("footer",{role:"status",className:Ke(Be.status),children:[ye.jsxDEV("span",{"aria-hidden":"true",className:Ke(Be.statusDot,hH[s.status.tone])},void 0,!1,void 0,this),ye.jsxDEV("span",{className:Ke(Be.statusText),children:s.status.text},void 0,!1,void 0,this),ye.jsxDEV(zd,{href:s.status.history.href,onNavigate:e.onNavigate,className:Ke(Be.link),children:s.status.history.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var tg=F(yt(),1);var lt=F(xe(),1);function Z2(e){let{state:i}=e,s=tg.useRef(null);if(tg.useEffect(()=>{if(i.kind==="error"&&i.issues?.length&&!s.current?.closest("form")?.querySelector("[data-studio-invalid-field]")){let l=s.current?.querySelector("details");if(l)l.open=!0;s.current?.focus()}},[i]),i.kind==="saved")return i.noop?lt.jsxDEV(he,{tone:"good",save:!0,children:"No changes — already saved."},void 0,!1,void 0,this):lt.jsxDEV(he,{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(tn.conflict),role:"alert","data-studio-conflict":"",children:[lt.jsxDEV("h4",{...N(tn.conflictTitle),children:"The manuscript changed elsewhere"},void 0,!1,void 0,this),lt.jsxDEV("p",{...N(tn.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(tn.validationSummary),ref:s,tabIndex:-1,role:"group","aria-label":"Save failed",children:[lt.jsxDEV(he,{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(tn.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 J2(e,i,s="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(s==="create")return"Not created yet";if(s==="first-save")return"Not saved yet";return i?"Unsaved changes":"Saved"}function ng(e){let{save:i,git:s,baselineCommit:l}=e,a=s?.lastCommit?s.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(!s)return{db:"done",exported:"done",committed:"pending",commitRef:a};if(s.hasChanges)return{db:"done",exported:"done",committed:"active",commitRef:a};if(s.lastCommit!==l)return{db:"done",exported:"done",committed:"done",commitRef:a};return{db:"done",exported:"active",committed:"pending",commitRef:a}}function kS(e){return lt.jsxDEV("span",{...N(tn.station,e.state==="done"&&tn.done,e.state==="active"&&tn.active),"data-studio-station":e.state,children:[lt.jsxDEV("span",{...N(tn.dot,e.state==="done"&&tn.doneDot,e.state==="active"&&tn.activeDot)},void 0,!1,void 0,this),e.label]},void 0,!0,void 0,this)}function K2(e){return lt.jsxDEV("span",{...N(tn.track),"data-studio-flowing":e.flowing?"":void 0,"aria-hidden":"true",children:lt.jsxDEV("span",{...N(tn.flow,e.flowing&&tn.flowing)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function eD(e){let{view:i,gitConfigured:s}=e;return lt.jsxDEV("span",{...N(tn.wrap),children:[lt.jsxDEV("span",{...N(tn.stations),children:[lt.jsxDEV(kS,{state:i.db,label:"entity db"},void 0,!1,void 0,this),lt.jsxDEV(K2,{flowing:i.db==="done"&&i.exported==="active"},void 0,!1,void 0,this),lt.jsxDEV(kS,{state:i.exported,label:"exported to file"},void 0,!1,void 0,this),s?lt.jsxDEV(lt.Fragment,{children:[lt.jsxDEV(K2,{flowing:i.exported==="done"&&i.committed==="active"},void 0,!1,void 0,this),lt.jsxDEV(kS,{state:i.committed,label:"committed"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):lt.jsxDEV("span",{...N(tn.station,tn.noGit),children:"no git remote"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i.commitRef&<.jsxDEV("span",{...N(tn.ref),children:["last write ",lt.jsxDEV("b",{...N(tn.refValue),children:i.commitRef},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function tD(e){return lt.jsxDEV(vn,{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 my=F(yt(),1);var Mt={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},assist:{k1xSpc:"x78zum5 x1bkxw62 x10acg2q xbrvn9l",kGNEyG:"x6s0dn4",kOIVth:"x883omv",kmVPX3:"x13j9azq",kWkggS:"xg47p5g",kAzted:"x2lwn1j",k1JLwA:"xlpkf44",kLyoy9:"x1otypdl",kRugJJ:"x1xccwpl",$$css:!0},input:{kUk6DE:"x98rzlu",k7Eaqz:"xfb3i0g",kXkAfU:"x1w9335",kr4CYY:"xf2x79s",$$css:!0},select:{ks0D6T:"x1racy4e",kCrP1I:"x1yagzmq",koRygp:"x1dbdljh",k76vLx:"xeyi6kz",$$css:!0},run:{kmVPX3:"xbnpv00",khDVqt:"xuxw1ft",$$css:!0},presets:{k1xSpc:"x3nfvp2",kOIVth:"x1jnr06f",kCrP1I:"x1yagzmq",kjH4Xa:"xal9krd",$$css:!0},preset:{khDVqt:"x1tndu2m",$$css:!0},assistMeta:{kMv6JI:"xa9opjo",kGuDYH:"x1j6dyjg",kMwMTN:"x1ar3pfp",khDVqt:"xuxw1ft",kHdLCk:"xkaaz9w",$$css:!0},suggestion:{k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",kOIVth:"x1v2ro7d",kmVPX3:"xnohdxd",kWkggS:"x153t6mt",kdLj2q:"x1o3peri",kf00j:"xzbubq",kRugJJ:"xlko52b",$$css:!0},answer:{kWkggS:"x9kxhyz",$$css:!0},copy:{kskxy:"x1aoj0v",kVQacm:"xysyzu8",kGuDYH:"x4z9k3i",kMwMTN:"xqvuw85",kHjlTd:"xj0a0fe",koRygp:"x1dbdljh",kKwN1N:"x1h9t1nj",$$css:!0},answerTitle:{k1xSpc:"x1lliihq",k1K539:"xzueoph",kMv6JI:"xa9opjo",kGuDYH:"x1k6wstc",kb6lSQ:"x1vyo3qp",kMwMTN:"x1es3s4s",$$css:!0},spacer:{kUk6DE:"x98rzlu",$$css:!0},status:{kmVPX3:"x1vrqldd",$$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 CS=[],sD=[];(()=>{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,s=0;i<e.length;i++)(i%2?sD:CS).push(s=s+e[i])})();function vH(e){if(e<768)return!1;for(let i=0,s=CS.length;;){let l=i+s>>1;if(e<CS[l])s=l;else if(e>=sD[l])i=l+1;else return!0;if(i==s)return!1}}function nD(e){return e>=127462&&e<=127487}var iD=8205;function lD(e,i,s=!0,l=!0){return(s?rD:SH)(e,i,l)}function rD(e,i,s){if(i==e.length)return i;if(i&&aD(e.charCodeAt(i))&&uD(e.charCodeAt(i-1)))i--;let l=wS(e,i);i+=oD(l);while(i<e.length){let a=wS(e,i);if(l==iD||a==iD||s&&vH(a))i+=oD(a),l=a;else if(nD(a)){let u=0,f=i-2;while(f>=0&&nD(wS(e,f)))u++,f-=2;if(u%2==0)break;else i+=2}else break}return i}function SH(e,i,s){while(i>1){let l=rD(e,i-2,s);if(l<i)return l;i--}return 0}function wS(e,i){let s=e.charCodeAt(i);if(!uD(s)||i+1==e.length)return s;let l=e.charCodeAt(i+1);if(!aD(l))return s;return(s-55296<<10)+(l-56320)+65536}function aD(e){return e>=56320&&e<57344}function uD(e){return e>=55296&&e<56320}function oD(e){return e<65536?1:2}class ot{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,s){[e,i]=bc(this,e,i);let l=[];if(this.decompose(0,e,l,2),s.length)s.decompose(0,s.length,l,3);return this.decompose(i,this.length,l,1),Os.from(l,this.length-(i-e)+s.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,i=this.length){[e,i]=bc(this,e,i);let s=[];return this.decompose(e,i,s,0),Os.from(s,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),s=this.length-this.scanIdentical(e,-1),l=new gc(this),a=new gc(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>=s)return!0}}iter(e=1){return new gc(this,e)}iterRange(e,i=this.length){return new BS(this,e,i)}iterLines(e,i){let s;if(e==null)s=this.iter();else{if(i==null)i=this.lines+1;let l=this.line(e).from;s=this.iterRange(l,Math.max(l,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))}return new HS(s)}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 ot.empty;return e.length<=32?new nn(e):Os.from(nn.split(e,[]))}}class nn extends ot{constructor(e,i=xH(e)){super();this.text=e,this.length=i}get lines(){return this.text.length}get children(){return null}lineInner(e,i,s,l){for(let a=0;;a++){let u=this.text[a],f=l+u.length;if((i?s:f)>=e)return new mD(l,f,s,u);l=f+1,s++}}decompose(e,i,s,l){let a=e<=0&&i>=this.length?this:new nn(cD(this.text,e,i),Math.min(i,this.length)-Math.max(0,e));if(l&1){let u=s.pop(),f=lg(a.text,u.text.slice(),0,a.length);if(f.length<=32)s.push(new nn(f,u.length+a.length));else{let h=f.length>>1;s.push(new nn(f.slice(0,h)),new nn(f.slice(h)))}}else s.push(a)}replace(e,i,s){if(!(s instanceof nn))return super.replace(e,i,s);[e,i]=bc(this,e,i);let l=lg(this.text,lg(s.text,cD(this.text,0,e)),i),a=this.length+s.length-(i-e);if(l.length<=32)return new nn(l,a);return Os.from(nn.split(l,[]),a)}sliceString(e,i=this.length,s=`
|
|
219
219
|
`){[e,i]=bc(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+=s;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 s=[],l=-1;for(let a of e)if(s.push(a),l+=a.length+1,s.length==32)i.push(new nn(s,l)),s=[],l=-1;if(l>-1)i.push(new nn(s,l));return i}}class Os extends ot{constructor(e,i){super();this.children=e,this.length=i,this.lines=0;for(let s of e)this.lines+=s.lines}lineInner(e,i,s,l){for(let a=0;;a++){let u=this.children[a],f=l+u.length,h=s+u.lines-1;if((i?h:f)>=e)return u.lineInner(e,i,s,l);l=f+1,s=h+1}}decompose(e,i,s,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)s.push(f);else f.decompose(e-u,i-u,s,p)}u=h+1}}replace(e,i,s){if([e,i]=bc(this,e,i),s.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,s),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 Os(g,this.length-(i-e)+s.length)}return super.replace(a,f,h)}a=f+1}return super.replace(e,i,s)}sliceString(e,i=this.length,s=`
|
|
220
220
|
`){[e,i]=bc(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+=s;if(e<h&&i>u)l+=f.sliceString(e-u,i-u,s);u=h+1}return l}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof Os))return 0;let s=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 s;let h=this.children[l],p=e.children[a];if(h!=p)return s+h.scanIdentical(p,i);s+=h.length+1}}static from(e,i=e.reduce((s,l)=>s+l.length+1,-1)){let s=0;for(let S of e)s+=S.lines;if(s<32){let S=[];for(let w of e)w.flatten(S);return new nn(S,i)}let l=Math.max(32,s>>5),a=l<<1,u=l>>1,f=[],h=0,p=-1,g=[];function y(S){let w;if(S.lines>a&&S instanceof Os)for(let A of S.children)y(A);else if(S.lines>u&&(h>u||!h))v(),f.push(S);else if(S instanceof nn&&h&&(w=g[g.length-1])instanceof nn&&S.lines+w.lines<=32)h+=S.lines,p+=S.length+1,g[g.length-1]=new nn(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]:Os.from(g,p)),p=-1,h=g.length=0}for(let S of e)y(S);return v(),f.length==1?f[0]:new Os(f,i)}}ot.empty=new nn([""],0);function xH(e){let i=-1;for(let s of e)i+=s.length+1;return i}function lg(e,i,s=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>=s){if(p>l)h=h.slice(0,l-a);if(a<s)h=h.slice(s-a);if(f)i[i.length-1]+=h,f=!1;else i.push(h)}a=p+1}return i}function cD(e,i,s){return lg(e,[""],i,s)}class gc{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 nn?e.text.length:e.children.length)<<1]}nextInner(e,i){this.done=this.lineBreak=!1;for(;;){let s=this.nodes.length-1,l=this.nodes[s],a=this.offsets[s],u=a>>1,f=l instanceof nn?l.text.length:l.children.length;if(u==(i>0?f:0)){if(s==0)return this.done=!0,this.value="",this;if(i>0)this.offsets[s-1]++;this.nodes.pop(),this.offsets.pop()}else if((a&1)==(i>0?0:1)){if(this.offsets[s]+=i,e==0)return this.lineBreak=!0,this.value=`
|
|
221
221
|
`,this;e--}else if(l instanceof nn){let h=l.text[u+(i<0?-1:0)];if(this.offsets[s]+=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[s]+=i;else{if(i<0)this.offsets[s]--;this.nodes.push(h),this.offsets.push(i>0?1:(h instanceof nn?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 BS{constructor(e,i,s){this.value="",this.done=!1,this.cursor=new gc(e,i>s?-1:1),this.pos=i>s?e.length:0,this.from=Math.min(i,s),this.to=Math.max(i,s)}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 s=i<0?this.pos-this.from:this.to-this.pos;if(e>s)e=s;s-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*i,this.value=l.length<=s?l:i<0?l.slice(l.length-s):l.slice(0,s),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 HS{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:s,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(s)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")ot.prototype[Symbol.iterator]=function(){return this.iter()},gc.prototype[Symbol.iterator]=BS.prototype[Symbol.iterator]=HS.prototype[Symbol.iterator]=function(){return this};class mD{constructor(e,i,s,l){this.from=e,this.to=i,this.number=s,this.text=l}get length(){return this.to-this.from}}function bc(e,i,s){return i=Math.max(0,Math.min(e.length,i)),[i,Math.max(i,Math.min(e.length,s))]}function go(e,i,s=!0,l=!0){return lD(e,i,s,l)}function kH(e){return e>=56320&&e<57344}function wH(e){return e>=55296&&e<56320}function IS(e,i){let s=e.charCodeAt(i);if(!wH(s)||i+1==e.length)return s;let l=e.charCodeAt(i+1);if(!kH(l))return s;return(s-55296<<10)+(l-56320)+65536}function US(e){return e<65536?1:2}var TS=/\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 gl{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 s=this.sections[i+1];e+=s<0?this.sections[i]:s}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let i=0,s=0,l=0;i<this.sections.length;){let a=this.sections[i++],u=this.sections[i++];if(u<0)e(s,l,a),l+=a;else l+=u;s+=a}}iterChangedRanges(e,i=!1){ES(this,e,i)}get invertedDesc(){let e=[];for(let i=0;i<this.sections.length;){let s=this.sections[i++],l=this.sections[i++];if(l<0)e.push(s,l);else e.push(l,s)}return new gl(e)}composeDesc(e){return this.empty?e:e.empty?this:gD(this,e)}mapDesc(e,i=!1){return e.empty?this:DS(this,e,i)}mapPos(e,i=-1,s=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(s!=Ln.Simple&&p>=e&&(s==Ln.TrackDel&&l<e&&p>e||s==Ln.TrackBefore&&l<e||s==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 s=0,l=0;s<this.sections.length&&l<=i;){let a=this.sections[s++],u=this.sections[s++],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 s=this.sections[i++],l=this.sections[i++];e+=(e?" ":"")+s+(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 gl(e)}static create(e){return new gl(e)}}class Sn extends gl{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 ES(this,(i,s,l,a,u)=>e=e.replace(l,l+(s-i),u),!1),e}mapDesc(e,i=!1){return DS(this,e,i,!0)}invert(e){let i=this.sections.slice(),s=[];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(s.length<h)s.push(ot.empty);s.push(u?e.slice(a,a+u):ot.empty)}a+=u}return new Sn(i,s)}compose(e){return this.empty?e:e.empty?this:gD(this,e,!0)}map(e,i=!1){return e.empty?this:DS(this,e,i,!0)}iterChanges(e,i=!1){ES(this,e,i)}get desc(){return gl.create(this.sections)}filter(e){let i=[],s=[],l=[],a=new vc(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)wr(s,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 Sn(i,s),filtered:gl.create(l)}}toJSON(){let e=[];for(let i=0;i<this.sections.length;i+=2){let s=this.sections[i],l=this.sections[i+1];if(l<0)e.push(s);else if(l==0)e.push([s]);else e.push([s].concat(this.inserted[i>>1].toJSON()))}return e}static of(e,i,s){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 Sn(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 Sn){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?ot.empty:typeof S=="string"?ot.of(S.split(s||TS)):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),wr(a,l,w),u=v}}return p(e),h(!f),f}static empty(e){return new Sn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw RangeError("Invalid JSON representation of ChangeSet");let i=[],s=[];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(s.length<l)s.push(ot.empty);s[l]=ot.of(a.slice(1)),i.push(a[0],s[l].length)}}return new Sn(i,s)}static createSet(e,i){return new Sn(e,i)}}function jn(e,i,s,l=!1){if(i==0&&s<=0)return;let a=e.length-2;if(a>=0&&s<=0&&s==e[a+1])e[a]+=i;else if(a>=0&&i==0&&e[a]==0)e[a+1]+=s;else if(l)e[a]+=i,e[a+1]+=s;else e.push(i,s)}function wr(e,i,s){if(s.length==0)return;let l=i.length-2>>1;if(l<e.length)e[e.length-1]=e[e.length-1].append(s);else{while(e.length<l)e.push(ot.empty);e.push(s)}}function ES(e,i,s){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=ot.empty;for(;;){if(g+=h,y+=p,p&&l)v=v.append(l[f-2>>1]);if(s||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 DS(e,i,s,l=!1){let a=[],u=l?[]:null,f=new vc(e),h=new vc(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&&!s))){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)wr(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)wr(u,a,f.text);p=f.i,f.forward(f.len-y)}else if(f.done&&h.done)return u?Sn.createSet(a,u):gl.create(a);else throw Error("Mismatched change set lengths")}function gD(e,i,s=!1){let l=[],a=s?[]:null,u=new vc(e),f=new vc(i);for(let h=!1;;)if(u.done&&f.done)return a?Sn.createSet(l,a):gl.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)wr(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)wr(a,l,f.text)}else if(f.ins==-1){if(jn(l,u.off?0:u.len,p,h),a)wr(a,l,u.textBit(p))}else if(jn(l,u.off?0:u.len,f.off?0:f.ins,h),a&&!f.off)wr(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 vc{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?ot.empty:e[i]}textBit(e){let{inserted:i}=this.set,s=this.i-2>>1;return s>=i.length&&!e?ot.empty:i[s].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 kr{constructor(e,i,s,l){this.from=e,this.to=i,this.flags=s,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 s,l;if(this.empty)s=l=e.mapPos(this.from,i);else s=e.mapPos(this.from,1),l=e.mapPos(this.to,-1);return s==this.from&&l==this.to?this:new kr(s,l,this.flags,this.goalColumn)}extend(e,i=e,s=0){if(e<=this.anchor&&i>=this.anchor)return ee.range(e,i,void 0,void 0,s);let l=Math.abs(e-this.anchor)>Math.abs(i-this.anchor)?e:i;return ee.range(this.anchor,l,void 0,void 0,s)}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 ee.range(e.anchor,e.head)}static create(e,i,s,l){return new kr(e,i,s,l)}}class ee{constructor(e,i){this.ranges=e,this.mainIndex=i}map(e,i=-1){if(e.empty)return this;return ee.create(this.ranges.map((s)=>s.map(e,i)),this.mainIndex)}eq(e,i=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let s=0;s<this.ranges.length;s++)if(!this.ranges[s].eq(e.ranges[s],i))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new ee([this.main],0)}addRange(e,i=!0){return ee.create([e].concat(this.ranges),i?0:this.mainIndex+1)}replaceRange(e,i=this.mainIndex){let s=this.ranges.slice();return s[i]=e,ee.create(s,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 ee(e.ranges.map((i)=>kr.fromJSON(i)),e.main)}static single(e,i=e){return new ee([ee.range(e,i)],0)}static create(e,i=0){if(e.length==0)throw RangeError("A selection needs at least one range");for(let s=0,l=0;l<e.length;l++){let a=e[l];if(a.empty?a.from<=s:a.from<s)return ee.normalized(e.slice(),i);s=a.to}return new ee(e,i)}static cursor(e,i=0,s,l){return kr.create(e,e,(i==0?0:i<0?8:16)|(s==null?7:Math.min(6,s)),l)}static range(e,i,s,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?kr.create(i,e,u|32,s):kr.create(e,i,u,s)}static undirectionalRange(e,i){return kr.create(e,i,64,void 0)}static normalized(e,i=0){let s=e[i];e.sort((l,a)=>l.from-a.from),i=e.indexOf(s);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?ee.range(h,f):ee.range(f,h))}}return new ee(e,i)}}function yD(e,i){for(let s of e.ranges)if(s.to>i)throw RangeError("Selection points outside of document")}var _S=0;class Te{constructor(e,i,s,l,a){this.combine=e,this.compareInput=i,this.compare=s,this.isStatic=l,this.id=_S++,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,s)=>i===s),e.compare||(!e.combine?qS:(i,s)=>i===s),!!e.static,e.enables)}of(e){return new Bd([],this,0,e)}compute(e,i){if(this.isStatic)throw Error("Can't compute a static facet");return new Bd(e,this,1,i)}computeN(e,i){if(this.isStatic)throw Error("Can't compute a static facet");return new Bd(e,this,2,i)}from(e,i){if(!i)i=(s)=>s;return this.compute([e],(s)=>i(s.field(e)))}}function qS(e,i){return e==i||e.length==i.length&&e.every((s,l)=>s===i[l])}class Bd{constructor(e,i,s,l){this.dependencies=e,this.facet=i,this.type=s,this.value=l,this.id=_S++}dynamicSlot(e){var i;let s=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]=s(y),1},update(y,v){if(h&&v.docChanged||p&&(v.docChanged||v.selection)||RS(y,g)){let S=s(y);if(f?!fD(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=ug(v,w);if(this.dependencies.every((C)=>C instanceof Te?v.facet(C)===y.facet(C):C instanceof jo?v.field(C,!1)==y.field(C,!1):!0)||(f?fD(S=s(y),A,l):l(S=s(y),A)))return y.values[u]=A,0}else S=s(y);return y.values[u]=S,1}}}get extension(){return this}}function fD(e,i,s){if(e.length!=i.length)return!1;for(let l=0;l<e.length;l++)if(!s(e[l],i[l]))return!1;return!0}function RS(e,i){let s=!1;for(let l of i)if(Hd(e,l)&1)s=!0;return s}function CH(e,i,s){let l=s.map((p)=>e[p.id]),a=s.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=ug(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)Hd(p,g);return p.values[f]=h(p),1},update(p,g){if(!RS(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=RS(p,l),v=g.config.facets[i.id],S=g.facet(i);if(v&&!y&&qS(s,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 ig=Te.define({static:!0});class jo{constructor(e,i,s,l,a){this.id=e,this.createF=i,this.updateF=s,this.compareF=l,this.spec=a,this.provides=void 0}static define(e){let i=new jo(_S++,e.create,e.update,e.compare||((s,l)=>s===l),e);if(e.provide)i.provides=e.provide(i);return i}create(e){let i=e.facet(ig).find((s)=>s.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:(s)=>(s.values[i]=this.create(s),1),update:(s,l)=>{let a=s.values[i],u=this.updateF(a,l);if(this.compareF(a,u))return 0;return s.values[i]=u,1},reconfigure:(s,l)=>{let a=s.facet(ig),u=l.facet(ig),f;if((f=a.find((h)=>h.field==this))&&f!=u.find((h)=>h.field==this))return s.values[i]=f.create(s),1;if(l.config.address[this.id]!=null)return s.values[i]=l.field(this),0;return s.values[i]=this.create(s),1}}}init(e){return[this,ig.of({field:this,create:e})]}get extension(){return this}}var Oa={lowest:4,low:3,default:2,high:1,highest:0};function Nd(e){return(i)=>new $S(i,e)}var yl={highest:Nd(Oa.highest),high:Nd(Oa.high),default:Nd(Oa.default),low:Nd(Oa.low),lowest:Nd(Oa.lowest)};class $S{constructor(e,i){this.inner=e,this.prec=i}get extension(){return this}}class Sc{of(e){return new rg(this,e)}reconfigure(e){return Sc.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class rg{constructor(e,i){this.compartment=e,this.inner=i}get extension(){return this}}class ag{constructor(e,i,s,l,a,u){this.base=e,this.compartments=i,this.dynamicSlots=s,this.address=l,this.staticValues=a,this.facets=u,this.statusTemplate=[];while(this.statusTemplate.length<s.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,s){let l=[],a=Object.create(null),u=new Map;for(let v of AH(e,i,u))if(v instanceof jo)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=s===null||s===void 0?void 0:s.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,qS(A,S))h.push(s.facet(w));else{let C=w.combine(S.map((E)=>E.value));h.push(s&&w.compare(C,s.facet(w))?s.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((E)=>C.dynamicSlot(E));f[w.id]=p.length<<1,p.push((C)=>CH(C,w,S))}}let y=p.map((v)=>v(f));return new ag(e,u,y,f,h,a)}}function AH(e,i,s){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 rg)s.delete(f.compartment)}if(a.set(f,h),Array.isArray(f))for(let g of f)u(g,h);else if(f instanceof rg){if(s.has(f.compartment))throw RangeError("Duplicate use of compartment in extensions");let g=i.get(f.compartment)||f.inner;s.set(f.compartment,g),u(g,h)}else if(f instanceof $S)u(f.inner,f.prec);else if(f instanceof jo){if(l[h].push(f),f.provides)u(f.provides,h)}else if(f instanceof Bd){if(l[h].push(f),f.facet.extensions)u(f.facet.extensions,Oa.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,Oa.default),l.reduce((f,h)=>f.concat(h))}function Hd(e,i){if(i&1)return 2;let s=i>>1,l=e.status[s];if(l==4)throw Error("Cyclic dependency between fields and/or facets");if(l&2)return l;e.status[s]=4;let a=e.computeSlot(e,e.config.dynamicSlots[s]);return e.status[s]=2|a}function ug(e,i){return i&1?e.config.staticValues[i>>1]:e.values[i>>1]}var bD=Te.define(),MS=Te.define({combine:(e)=>e.some((i)=>i),static:!0}),vD=Te.define({combine:(e)=>e.length?e[0]:void 0,static:!0}),SD=Te.define(),xD=Te.define(),kD=Te.define(),wD=Te.define({combine:(e)=>e.length?e[0]:!1});class yo{constructor(e,i){this.type=e,this.value=i}static define(){return new CD}}class CD{of(e){return new yo(this,e)}}class AD{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 AD(e.map||((i)=>i))}static mapEffects(e,i){if(!e.length)return e;let s=[];for(let l of e){let a=l.map(i);if(a)s.push(a)}return s}}Bt.reconfigure=Bt.define();Bt.appendConfig=Bt.define();class xn{constructor(e,i,s,l,a,u){if(this.startState=e,this.changes=i,this.selection=s,this.effects=l,this.annotations=a,this.scrollIntoView=u,this._doc=null,this._state=null,s)yD(s,i.newLength);if(!a.some((f)=>f.type==xn.time))this.annotations=a.concat(xn.time.of(Date.now()))}static create(e,i,s,l,a,u){return new xn(e,i,s,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(xn.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}}xn.time=yo.define();xn.userEvent=yo.define();xn.addToHistory=yo.define();xn.remote=yo.define();function TH(e,i){let s=[];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 s;if(!s.length||s[s.length-1]<u)s.push(u,f);else if(s[s.length-1]<f)s[s.length-1]=f}}function TD(e,i,s){var l;let a,u,f;if(s)a=i.changes,u=Sn.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 OS(e,i,s){let l=i.selection,a=yc(i.annotations);if(i.userEvent)a=a.concat(xn.userEvent.of(i.userEvent));return{changes:i.changes instanceof Sn?i.changes:Sn.of(i.changes||[],s,e.facet(vD)),selection:l&&(l instanceof ee?l:ee.single(l.anchor,l.head)),effects:yc(i.effects),annotations:a,scrollIntoView:!!i.scrollIntoView}}function ED(e,i,s){let l=OS(e,i.length?i[0]:{},e.doc.length);if(i.length&&i[0].filter===!1)s=!1;for(let u=1;u<i.length;u++){if(i[u].filter===!1)s=!1;let f=!!i[u].sequential;l=TD(l,OS(e,i[u],f?l.changes.newLength:e.doc.length),f)}let a=xn.create(e,l.changes,l.selection,l.effects,l.annotations,l.scrollIntoView);return DH(s?EH(a):a)}function EH(e){let i=e.startState,s=!0;for(let a of i.facet(SD)){let u=a(e);if(u===!1){s=!1;break}if(Array.isArray(u))s=s===!0?u:TH(s,u)}if(s!==!0){let a,u;if(s===!1)u=e.changes.invertedDesc,a=Sn.empty(i.doc.length);else{let f=e.changes.filter(s);a=f.changes,u=f.filtered.mapDesc(f.changes).invertedDesc}e=xn.create(i,a,e.selection&&e.selection.map(u),Bt.mapEffects(e.effects,u),e.annotations,e.scrollIntoView)}let l=i.facet(xD);for(let a=l.length-1;a>=0;a--){let u=l[a](e);if(u instanceof xn)e=u;else if(Array.isArray(u)&&u.length==1&&u[0]instanceof xn)e=u[0];else e=ED(i,yc(u),!1)}return e}function DH(e){let i=e.startState,s=i.facet(kD),l=e;for(let a=s.length-1;a>=0;a--){let u=s[a](e);if(u&&Object.keys(u).length)l=TD(l,OS(i,u,e.changes.newLength),!0)}return l==e?e:xn.create(i,e.changes,e.selection,l.effects,l.annotations,l.scrollIntoView)}var RH=[];function yc(e){return e==null?RH:Array.isArray(e)?e:[e]}var $o=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}($o||($o={})),MH=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,LS;try{LS=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}function OH(e){if(LS)return LS.test(e);for(let i=0;i<e.length;i++){let s=e[i];if(/\w/.test(s)||s>""&&(s.toUpperCase()!=s.toLowerCase()||MH.test(s)))return!0}return!1}function LH(e){return(i)=>{if(!/\S/.test(i))return $o.Space;if(OH(i))return $o.Word;for(let s=0;s<e.length;s++)if(i.indexOf(e[s])>-1)return $o.Word;return $o.Other}}class Ze{constructor(e,i,s,l,a,u){if(this.config=e,this.doc=i,this.selection=s,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++)Hd(this,f<<1);this.computeSlot=null}field(e,i=!0){let s=this.config.address[e.id];if(s==null){if(i)throw RangeError("Field is not present in this state");return}return Hd(this,s),ug(this,s)}update(...e){return ED(this,e,!0)}applyTransaction(e){let i=this.config,{base:s,compartments:l}=i;for(let f of e.effects)if(f.is(Sc.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,s=f.value;else if(f.is(Bt.appendConfig))i=null,s=yc(s).concat(f.value);let a;if(!i)i=ag.resolve(s,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(MS)?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:ee.cursor(i.from+e.length)}))}changeByRange(e){let i=this.selection,s=e(i.ranges[0]),l=this.changes(s.changes),a=[s.range],u=yc(s.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(yc(h.effects),y))}return{changes:l,selection:ee.create(a,i.mainIndex),effects:u}}changes(e=[]){if(e instanceof Sn)return e;return Sn.of(e,this.doc.length,this.facet(Ze.lineSeparator))}toText(e){return ot.of(e.split(this.facet(Ze.lineSeparator)||TS))}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 Hd(this,i),ug(this,i)}toJSON(e){let i={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let s in e){let l=e[s];if(l instanceof jo&&this.config.address[l.id]!=null)i[s]=l.spec.toJSON(this.field(e[s]),this)}return i}static fromJSON(e,i={},s){if(!e||typeof e.doc!="string")throw RangeError("Invalid JSON representation for EditorState");let l=[];if(s){for(let a in s)if(Object.prototype.hasOwnProperty.call(e,a)){let u=s[a],f=e[a];l.push(u.init((h)=>u.spec.fromJSON(f,h)))}}return Ze.create({doc:e.doc,selection:ee.fromJSON(e.selection),extensions:i.extensions?l.concat([i.extensions]):l})}static create(e={}){let i=ag.resolve(e.extensions||[],new Map),s=e.doc instanceof ot?e.doc:ot.of((e.doc||"").split(i.staticFacet(Ze.lineSeparator)||TS)),l=!e.selection?ee.single(0):e.selection instanceof ee?e.selection:ee.single(e.selection.anchor,e.selection.head);if(yD(l,s.length),!i.staticFacet(MS))l=l.asSingle();return new Ze(i,s,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)||`
|
|
@@ -246,6 +246,6 @@ ${u}`:`# ${l}`}}var ye=F(xe(),1),X2=15000,W2=2;function zd(e){return ye.jsxDEV("
|
|
|
246
246
|
|
|
247
247
|
[Open the Inbox item](${i.backlink})`;return{draft:s,body:i.body?`${i.body}
|
|
248
248
|
|
|
249
|
-
${l}`:l}}function cI(){let e=window.history.state;return Od(e)?e:{}}function Jz(e){let{api:i,queryClient:s,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:E,setBodyMode:M,setFieldAssistState:B}=e,P=S?.capabilities.canCreate===!0,q=S?.hierarchy.nested!==!1,[Q,V]=Li.useState(null),[ve,ue]=Li.useState(0),Oe=Li.useRef(null),U=Li.useRef(0),fe=Li.useRef(y);fe.current=y,Li.useEffect(()=>{if(u.kind==="grouping"){C({type:"collectionChanged"});return}if(!y||u.kind==="workspace"||u.kind==="not-found")return;let ie=u.kind==="entity"&&u.entityType===y?u.id:null,J=++U.current;C({type:"collectionChanged"}),E("details"),B({kind:"idle"});let ce=!0,Se=()=>ce&&J===U.current;return s.fetchQuery({...xy(i,y),staleTime:0}).then(async(Fe)=>{if(!ce||J!==U.current)return;let _e=Dz(Fe,A.current,g&&ie===null);if(E(_e),window.matchMedia("(max-width: 640px)").matches&&_e!=="details")M(_e==="write"?"source":"preview");if(g&&ie===null){if(!P){V(`Creating ${y} is not allowed.`);return}let mt=Kz(window.history.state,y,()=>window.history.replaceState(Fz(cI()),"",window.location.href)),et=Zz(Fe.fields,mt);C({type:"creationStarted",draft:et.draft,body:et.body,...Fe.isSingleton&&{singleton:!0},...mt&&{prefilled:!0},...!mt&&!Fe.isSingleton&&{prefix:q?Vc(h).prefix:null}});return}if(ie!==null)return s.fetchQuery({...Qc(i,y,ie),staleTime:0}).then((mt)=>{if(!ce||J!==U.current)return;let et=Pc(mt),ze=Oe.current,Ce=qn(a,y,ie),$t=ze?.pathname===Ce?ze.save:{kind:"idle"};if(ze?.pathname===Ce)Oe.current=null;C({type:"documentOpened",document:et,save:$t})});if(Fe.isSingleton){let mt=await s.ensureQueryData(ky(i,y,Vc("?scope=collection")));if(!Se())return;let et=mt.entities[0];if(et)return s.fetchQuery({...Qc(i,y,et.id),staleTime:0}).then((ze)=>{if(!ce||J!==U.current)return;let Ce=Pc(ze);C({type:"documentOpened",document:Ce})});C({type:"creationStarted",singleton:!0,draft:Ty(Fe.fields)})}return}).catch((Fe)=>{if(ce&&J===U.current)V(Hr(Fe))}),()=>{ce=!1}},[g,p,y,ve,s,f,h,u,P,q]);let Y=Li.useCallback((ie,J={kind:"idle"},ce=y)=>{if(!ce||!y)return;let Se=qn(a,ce,ie);if(!(ce===y&&u.kind==="entity"&&u.entityType===y&&u.id===ie)){Oe.current={pathname:Se,save:J};let et=`${gi(a,v??y)}${yi(w)}`,ze=g&&J.kind==="saved",Ce=l.location.state,$t=!ze||Od(Ce)&&Ce.studioCollectionPath===et;l[ze?"replace":"push"](`${Se}${yi(w)}`,$t?{studioCollectionPath:et}:void 0,J.kind==="saved"?{ignoreBlocker:!0}:void 0);return}let _e=++U.current,mt=y;s.fetchQuery({...Qc(i,y,ie),staleTime:0}).then((et)=>{if(_e!==U.current||fe.current!==mt)return;let ze=Pc(et);C({type:"documentOpened",document:ze,save:J}),B({kind:"idle"})}).catch((et)=>{if(_e===U.current)V(Hr(et))})},[a,p,u,g,y,v,w,s,l]),re=Li.useCallback(()=>{ue((ie)=>ie+1)},[]),rt=Li.useCallback(()=>{U.current+=1},[]),W=Li.useCallback(()=>U.current,[]);return{openEntity:Y,loadError:Q,setLoadError:V,retryOpen:re,supersedeOpen:rt,currentOpenRequest:W,pendingOpenState:Oe}}var Zo=F(yt(),1);function e3(e){let{api:i,queryClient:s,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:E,deleteEntityMutation:M,openEntity:B,currentOpenRequest:P,setMobilePane:q,setFieldAssistState:Q}=e,{mode:V,draft:ve,body:ue,save:Oe}=v,[U,fe]=Zo.useState(null),Y=Zo.useRef(0);Zo.useEffect(()=>{if(Oe.kind!=="saved"||!A?.git)return;if(ng({save:Oe,git:A.git,baselineCommit:U}).committed==="done")return;if(Date.now()-Y.current>20000)return;let ce=window.setTimeout(()=>{s.invalidateQueries({queryKey:bn.syncStatus()})},900);return()=>window.clearTimeout(ce)},[Oe,A,U,s]);let re=Zo.useCallback((J,ce)=>{if(!u||V.kind!=="edit"||g?.canUpdate!==!0||g.canAssist!==!0||ue.trim().length===0)return;Q({kind:"loading",field:ce,variant:J}),i.requestFieldAssist({variant:J,entityType:u,id:V.entity.id,targetField:ce}).then((Se)=>{let Fe=Se.variant==="summarize"?Se.suggestion:Se.suggestions;Q({kind:"suggested",field:Se.targetField,variant:Se.variant,suggestion:Fe})}).catch((Se)=>{Q({kind:"error",field:ce,message:$n(Se)})})},[g,ue,u,V]),rt=Zo.useCallback((J,ce)=>{S({type:"fieldAssistApplied",field:J,suggestion:ce}),Q({kind:"idle"})},[]),W=Zo.useCallback(()=>{if(!u||V.kind==="browse"||!y||u===El&&!y.groupingDefinitions||Md(v)||(V.kind==="create"&&y.isSingleton||u===El)&&!Gm(v))return;if(V.kind==="create"?g?.canCreate!==!0:g?.canUpdate!==!0)return;Y.current=Date.now(),fe(A?.git?.lastCommit??null),S({type:"saveStarted"});let J=y.hasBody?{body:ue}:{},ce=wy(y.fields,ve),Se=V.kind==="create"?{kind:"create",entityType:u,...w&&{idPath:w},frontmatter:ce,...J}:{kind:"update",entityType:u,id:V.entity.id,frontmatter:ce,baseContentHash:V.entity.contentHash,...J},Fe=P();E.mutate(Se,{onSuccess:async(_e)=>{if(await Promise.all([s.invalidateQueries({queryKey:["studio","groupings"]}),s.invalidateQueries({queryKey:bn.entities(u)}),...f&&f!==u?[s.invalidateQueries({queryKey:bn.entities(f)})]:[],s.invalidateQueries({queryKey:bn.syncStatus()}),...u===El?[s.invalidateQueries({queryKey:["studio","schema"]})]:[],...V.kind==="create"||u===El?[s.invalidateQueries({queryKey:bn.navigation()})]:[]]),Fe!==P())return;let mt="skipped"in _e&&_e.skipped===!0;B(_e.entityId,{kind:"saved",noop:mt})},onError:(_e)=>{if(Fe!==P())return;if(_e instanceof qo&&(_e.status===400||_e.status===409))Promise.all([s.invalidateQueries({queryKey:bn.navigation()}),s.invalidateQueries({queryKey:["studio","schema"]}),s.invalidateQueries({queryKey:["studio","groupings"]})]);if(_e instanceof qo&&_e.issues.length>0)q("details");S({type:"saveFailed",save:_e instanceof qo&&_e.status===409&&V.kind==="edit"?{kind:"conflict",message:$n(_e),..._e.conflictId!==void 0&&{conflictId:_e.conflictId}}:{kind:"error",message:_e instanceof qo&&_e.issues.length>0?_e.message||"Validation failed":$n(_e),..._e instanceof qo?{issues:_e.issues}:{}}})}})},[g,u,f,V,w,v,ve,ue,y,B,A,s,E]),ie=Zo.useCallback(()=>{if(!u||V.kind!=="edit"||C||g?.canDelete!==!0)return;let{id:J}=V.entity;M.mutate({entityType:u,id:J},{onSuccess:async()=>{S({type:"deleteSucceeded"}),s.removeQueries({queryKey:bn.entity(u,J)}),await Promise.all([s.invalidateQueries({queryKey:["studio","groupings"]}),s.invalidateQueries({queryKey:bn.entityLists()}),s.invalidateQueries({queryKey:bn.syncStatus()}),s.invalidateQueries({queryKey:bn.navigation()})]),l.replace(p??`${gi(a,f??u)}${yi(h)}`,void 0,{ignoreBlocker:!0})},onError:(ce)=>{S({type:"deleteFailed",message:$n(ce)})}})},[g,a,u,f,V,C,s,M,l,p,h]);return{runFieldAssist:re,applyFieldAssist:rt,save:W,remove:ie,baselineCommit:U}}var wh=F(yt(),1);function i3(e){let{history:i,queryClient:s,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:E,declarativeWorkspaceData:M,initialUrlWorkspaceQuery:B,setActiveWorkspaceId:P,setEntityType:q,setLoadError:Q,supersedeOpen:V}=e;wh.useEffect(()=>{if(!h||!S||p||a.kind!=="collection"&&a.kind!=="entity"||a.entityType!==h)return;if(E===void 0)return;let ve=Math.floor(Math.max(0,E-1)/A.limit)*A.limit;if(C>ve)i.replace(`${u}${yi({...A,offset:ve})}`,i.location.state)},[S,p,C,E,A,h,u,a,i]),wh.useEffect(()=>{if(!p||!M?.refreshAfterMs)return;let ve=window.setTimeout(()=>{s.invalidateQueries({queryKey:bn.workspace(p)})},M.refreshAfterMs);return()=>window.clearTimeout(ve)},[p,M,s]),wh.useEffect(()=>{if(w?.urlQuery!==!0||a.kind!=="workspace"||a.workspaceId!==w.id)return;let ve=mi(l,w.id);if(Qa(ve,B)!==`${ve}${f}`)Sy(i,ve,B,window.location.pathname)},[w,l,B,f,a,i]),wh.useEffect(()=>{if(!g)return;if(Q(null),a.kind==="not-found"){V(),Q(`Studio route not found: ${a.pathname}`);return}if(a.kind==="images"){V(),P(null),q(null);return}if(a.kind==="grouping"){if(V(),P(null),q(null),!y.some((U)=>U.key===a.grouping))Q("Collection unavailable for this account.");return}if(a.kind==="workspace"){let U=v.find((fe)=>fe.id===a.workspaceId);if(!U){let fe=t3(l,a.workspaceId,f,v);if(fe){i.replace(fe);return}V(),Q(`Workspace unavailable for this account: ${a.workspaceId}`);return}P(U.id),q(null);return}let ve=a.kind==="collection"||a.kind==="entity"?a.entityType:void 0,ue=g.find((U)=>!U.isSingleton)??g[0];if(a.kind==="home"){let U=n3(l,g,v);if(U!==l){i.replace(U);return}}let Oe=ve??ue?.entityType??null;if(ve!==void 0&&!g.some((U)=>U.entityType===ve)){V(),Q(`Collection unavailable for this account: ${ve}`);return}P(null),q(Oe)},[f,a,i,l,g,y,v])}var Ex=F(yt(),1);function s3(e){let{queryClient:i,workspaces:s,activeWorkspaceId:l,entityType:a,mode:u,declarativeWorkspaceActionMutation:f,openEntity:h}=e,p=Ex.useCallback(async(y)=>{let v=o3(s,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(!cx(A)&&!fx(A)){if(await Tx(i,v.id),u.kind==="edit"&&a===y.entityType&&u.entity.id===y.entityId)h(y.entityId)}return A},[a,u,h,i,f,s]),g=Ex.useCallback(async(y)=>{if(!l)throw Error("Declarative workspace is unavailable");try{let v=await f.mutateAsync({workspaceId:l,action:y});return await Tx(i,l),v}finally{f.reset()}},[l,f,i]);return{performPublishingAction:p,performDeclarativeAction:g}}var Qt=F(xe(),1),fI=pt.lazy(()=>vS(async()=>({default:(await import("./studio-chunks/account-view-0b7z2qws.js")).AccountApp}))),dI=pt.lazy(()=>vS(async()=>({default:(await import("./studio-chunks/studio-chat-workspace-y0mmt0cs.js")).StudioChatWorkspace}),()=>Qt.jsxDEV(Ga,{message:"Chat could not open.",children:Qt.jsxDEV(bS,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)));function hI(e){let i=new URLSearchParams(e).get("session")?.trim();return i&&i.length<=256?i:null}var pI=["public","trusted","admin"];function mI(e,i,s){let l=document.querySelector("[data-studio-root]"),a=l?.getAttribute("data-studio-principal-name")??"Your account",u=l?.getAttribute("data-studio-principal-role"),f=pI.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(s).get("section")??void 0,y=a3(s);return{displayName:a,role:f,routePath:e,studioPath:i,...h?{mcpUrl:h}:{},...p?{davUrl:p}:{},...g?{initialSection:g}:{},...y?{connect:y}:{}}}function h3(){let e=l3(),i=Ey({select:(qe)=>qe.location.pathname}),s=Ey({select:(qe)=>qe.location.searchStr}),l=Ey({select:(qe)=>qe.location.state}),a=Rs(),u=pt.useMemo(()=>i===pc?{kind:"workspace",workspaceId:Ay}:Fm(i,a),[i,a]),f=pt.useMemo(()=>u.kind==="collection"&&new URLSearchParams(s).get("mode")==="create",[s,u]),h=i,[p,g]=pt.useState(null),[y,v]=pt.useState(null),[S,w]=pt.useState({}),[A,C]=pt.useReducer(c2,Rd),{mode:E}=A,M=Gm(A),[B]=pt.useState(()=>new f3),P=pt.useSyncExternalStore(B.subscribe,B.hasDrafts,B.hasDrafts),[q,Q]=pt.useState({hasDraft:!1,busy:!1}),V=r3({shouldBlockFn:({next:qe})=>M||i===pc&&c3({...q,hasDraft:P},qe.pathname),enableBeforeUnload:M||P||q.busy,withResolver:!0}),[ve,ue]=pt.useState({kind:"idle"}),[Oe,U]=pt.useState("source"),fe=A.mode.kind==="create";pt.useEffect(()=>{if(fe)U("source")},[fe]);let[Y,re]=pt.useState("details"),rt=pt.useRef(null),W=pt.useCallback((qe)=>{rt.current=qe,re(qe)},[]),ie=dc(),J=Jt(),{navigationQuery:ce,types:Se,groupings:Fe,activeType:_e,collectionType:mt,activeCapabilities:et,entityCollectionQuery:ze,entityListOffset:Ce,workspaces:$t,activeWorkspace:zi,activeAccount:to,activeChat:Rl,initialUrlWorkspaceQuery:Wc,workspaceRequestQuery:oe,workspaceQuery:Hn,workspaceData:Wa,workspaceError:Ir,agentTargets:Ur,syncStatus:gt,entityListQuery:Ao,entities:Ya,entityListTotal:Ch,schema:ut,createPath:My,destinationQuery:To,saveEntityMutation:Xa,deleteEntityMutation:_r,declarativeWorkspaceActionMutation:Oy,deleting:Fa,declarativeWorkspaceData:Ka}=Gz({api:J,entityType:y,activeWorkspaceId:p,routeSearch:s,workspaceQueries:S,editor:A}),Ml=$t.find((qe)=>qe.rendererName===Gc),Ah=I2({entityType:y,entities:Ya}),Yc=p2({principalId:document.querySelector("[data-studio-root]")?.getAttribute("data-studio-principal-id")??null,entityType:y,editor:A,hasUnsavedChanges:M,fields:ut?.fields??[],dispatch:C}),qs=u.kind==="grouping"?Fe.find((qe)=>qe.key===u.grouping):void 0,qr=pt.useMemo(()=>pS(s),[s]),$r=u.kind==="entity"?S2(l,a,Fe):null,Xc=$r?.path,Th=pt.useMemo(()=>y?Fe.filter((qe)=>qe.types.includes(y)):[],[Fe,y]),Fc=zz(Th),{openEntity:Za,loadError:Eh,setLoadError:Ja,retryOpen:Ol,supersedeOpen:Jo,currentOpenRequest:Pr,pendingOpenState:$s}=Jz({api:J,queryClient:ie,history:e.history,studioBasePath:a,routeTarget:u,routePathname:i,routeSearch:s,currentStudioPathname:h,createMode:f,entityType:y,collectionType:mt,activeType:_e,entityCollectionQuery:ze,preferredMobilePane:rt,dispatchEditor:C,setMobilePane:re,setBodyMode:U,setFieldAssistState:ue});i3({history:e.history,queryClient:ie,studioBasePath:a,routeTarget:u,routePathname:i,routeSearch:s,entityType:y,activeWorkspaceId:p,types:Se,groupings:Fe,workspaces:$t,activeType:_e,activeWorkspace:zi,entityCollectionQuery:ze,entityListOffset:Ce,entityListTotal:Ch,declarativeWorkspaceData:Ka,initialUrlWorkspaceQuery:Wc,setActiveWorkspaceId:g,setEntityType:v,setLoadError:Ja,supersedeOpen:Jo});let{openWorkspaceEntity:sn,openWorkspaceLaunch:Ps,selectEntityType:es,changeEntityPage:Ll,selectWorkspace:jr,selectFolder:Dh,startCreate:eu,backToList:tu,changeWorkspaceQuery:Eo}=Xz({history:e.history,studioBasePath:a,routeSearch:s,entityType:y,collectionType:mt,entityCollectionQuery:ze,groupReturnPath:Xc,workspaces:$t,schema:ut,activeCapabilities:et,pendingOpenState:$s,setFieldAssistState:ue,setWorkspaceQueries:w}),{runFieldAssist:bi,applyFieldAssist:Rh,save:Ly,remove:Kc,baselineCommit:Mh}=e3({api:J,queryClient:ie,history:e.history,studioBasePath:a,entityType:y,collectionType:mt,entityCollectionQuery:ze,groupReturnPath:Xc,activeCapabilities:et,schema:ut,editor:A,dispatchEditor:C,createPath:My,syncStatus:gt,deleting:Fa,saveEntityMutation:Xa,deleteEntityMutation:_r,openEntity:Za,currentOpenRequest:Pr,setMobilePane:re,setFieldAssistState:ue}),{performPublishingAction:nu,performDeclarativeAction:vi}=s3({queryClient:ie,workspaces:$t,activeWorkspaceId:p,entityType:y,mode:E,declarativeWorkspaceActionMutation:Oy,openEntity:Za}),Do=Eh??(ce.error?Hr(ce.error):Ao.error?Hr(Ao.error):null),iu=()=>{if(Ja(null),ce.error)ce.refetch();if(Ao.error)Ao.refetch();if(Hn.error)Hn.refetch();if(E.kind==="browse")Ol()};if(Do&&!Se)return Qt.jsxDEV(Ga,{message:Do,error:!0,onRetry:iu},void 0,!1,void 0,this);if(!Se)return Qt.jsxDEV(Ga,{message:"Loading…"},void 0,!1,void 0,this);if(to&&zi){let qe=mi(a,Cy);return Qt.jsxDEV(Rz,{types:Se,workspaces:$t,workspaceId:zi.id,selectEntityType:es,selectWorkspace:jr,children:Qt.jsxDEV(pt.Suspense,{fallback:Qt.jsxDEV(he,{children:"Opening Account…"},void 0,!1,void 0,this),children:Qt.jsxDEV(fI,{bootstrap:mI(qe,a,s)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}if(Rl&&zi)return Qt.jsxDEV(Qt.Fragment,{children:[Qt.jsxDEV(pt.Suspense,{fallback:Qt.jsxDEV(Ga,{message:"Opening Chat…"},void 0,!1,void 0,this),children:Qt.jsxDEV(dI,{apiPath:zi.chatApiPath,draftStore:B,onNavigationStateChange:Q,studioBasePath:a,sessionId:hI(s),types:Se,workspaces:$t,handoff:Lz(l),navigate:(qe,Ni)=>{e.history.push(qe,void 0,{ignoreBlocker:Ni?.preserveWork===!0})},selectEntityType:es,selectWorkspace:jr},void 0,!1,void 0,this)},void 0,!1,void 0,this),V.status==="blocked"&&Qt.jsxDEV(vn,{mark:"↩",title:"Leave this conversation?",titleId:"chat-navigation-title",cancelLabel:"Stay",confirmLabel:"Leave",onCancel:()=>V.reset(),onConfirm:()=>V.proceed(),children:Qt.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!==kh&&!Wa&&!Ir:y&&!ut&&!Do)return Qt.jsxDEV(Ga,{message:"Loading…"},void 0,!1,void 0,this);if(!qs&&u.kind!=="images"&&!p&&(!y||!ut&&!Do))return Qt.jsxDEV(Ga,{message:Do??"No readable collections are available for this account.",error:Boolean(Do),...Do?{onHome:()=>e.history.push(a)}:{}},void 0,!1,void 0,this);return Qt.jsxDEV(Mz,{groupings:{items:Fe,active:qs?.key??$r?.grouping??null,onSelect:(qe)=>e.history.push(fc(a,qe))},images:{active:u.kind==="images",onSelect:()=>e.history.push(u3(a))},imagesView:u.kind==="images"?Qt.jsxDEV(R2,{onOpen:(qe,Ni)=>e.history.push(qn(a,qe,Ni))},void 0,!1,void 0,this):null,homeView:p===kh?Qt.jsxDEV(F2,{chatApiPath:Ml?.chatApiPath,onNavigate:(qe)=>e.history.push(qe),onAsk:(qe)=>{B.update(d3(Ml?.chatApiPath,null),{text:qe}),e.history.push(pc)}},void 0,!1,void 0,this):null,groupReturnLabel:$r?.label,groupingSuggestions:Fc,groupingView:qs?Qt.jsxDEV(A2,{basePath:a,grouping:qs,types:Se,query:qr,onChange:(qe,Ni)=>{let Vr=`${fc(a,qs.key)}${cc(qe)}`,Oh=qe.value!==qr.value||qe.offset!==qr.offset;e.history[Oh&&Ni?.replace!==!0?"push":"replace"](Vr)},onOpen:(qe,Ni)=>{let Vr=qn(a,qe,Ni);$s.current={pathname:Vr,save:{kind:"idle"}},e.history.push(Vr,{studioGroupingPath:`${fc(a,qs.key)}${cc(qr)}`})}},void 0,!1,void 0,this):null,activeWorkspaceId:p,types:Se,workspaces:$t,workspaceError:Ir,readError:Do,onRetryRead:iu,declarativeWorkspaceData:Ka,workspaceQuery:oe,entityType:y,entities:Ya,refineNotice:Ah.notice,onRefineConfirmed:Ah.confirmed,folders:Ao.data?.folders??[],collectionTrail:Ao.data?.trail,collectionPath:mt?gi(a,mt):a,selectFolder:Dh,creationDestination:{data:To.data??null,pending:To.isPending,error:To.error},entityOffset:Ce,entityLimit:ze.limit,entityTotal:Ch??0,collectionQuery:ze,onCollectionQueryChange:(qe)=>{if(!mt)return;e.history.push(`${gi(a,mt)}${yi({...qe,offset:0})}`),window.scrollTo({top:0,left:0})},entityListLoading:Ao.isPending,schema:ut,editor:A,fieldAssistState:ve,bodyMode:Oe,mobilePane:Y,syncStatus:gt,baselineCommit:Mh,agentTargets:Ur,deleting:Fa,hasUnsavedChanges:M,navigationBlocked:V.status==="blocked",dispatchEditor:C,setFieldAssistState:ue,setBodyMode:U,setMobilePane:W,backToList:tu,selectEntityType:es,selectWorkspace:jr,changeEntityPage:Ll,openWorkspaceEntity:sn,openWorkspaceLaunch:Ps,performPublishingAction:nu,performDeclarativeAction:vi,onWorkspaceQueryChange:Eo,startCreate:eu,openEntity:(qe,Ni)=>Za(qe,void 0,Ni),runFieldAssist:bi,applyFieldAssist:Rh,save:Ly,remove:Kc,onNavigationReset:()=>V.reset?.(),draftRecovery:Yc,onNavigationProceed:()=>{Yc.forget(),V.proceed?.()}},void 0,!1,void 0,this)}function m3(){return new p3({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}var Ry=F(xe(),1),Dy=document.querySelector("[data-studio-root]");if(Dy){let e=Dy.getAttribute("data-studio-base-path")??"/studio",i=new v3({basePath:e});Dy.textContent="";let s=m3(),l=b3(e,h3);x3.createRoot(Dy).render(Ry.jsxDEV(g3,{client:s,children:Ry.jsxDEV(S3,{api:i,children:Ry.jsxDEV(y3,{router:l},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))}
|
|
249
|
+
${l}`:l}}function cI(){let e=window.history.state;return Od(e)?e:{}}function Jz(e){let{api:i,queryClient:s,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:E,setBodyMode:M,setFieldAssistState:B}=e,P=S?.capabilities.canCreate===!0,q=S?.hierarchy.nested!==!1,[Q,V]=Li.useState(null),[ve,ue]=Li.useState(0),Oe=Li.useRef(null),U=Li.useRef(0),fe=Li.useRef(y);fe.current=y,Li.useEffect(()=>{if(u.kind==="grouping"){C({type:"collectionChanged"});return}if(!y||u.kind==="workspace"||u.kind==="not-found")return;let ie=u.kind==="entity"&&u.entityType===y?u.id:null,J=++U.current;C({type:"collectionChanged"}),E("details"),B({kind:"idle"});let ce=!0,Se=()=>ce&&J===U.current;return s.fetchQuery({...xy(i,y),staleTime:0}).then(async(Fe)=>{if(!ce||J!==U.current)return;let _e=Dz(Fe,A.current,g&&ie===null);if(E(_e),window.matchMedia("(max-width: 640px)").matches&&_e!=="details")M(_e==="write"?"source":"preview");if(g&&ie===null){if(!P){V(`Creating ${y} is not allowed.`);return}let mt=Kz(window.history.state,y,()=>window.history.replaceState(Fz(cI()),"",window.location.href)),et=Zz(Fe.fields,mt);C({type:"creationStarted",draft:et.draft,body:et.body,...Fe.isSingleton&&{singleton:!0},...mt&&{prefilled:!0},...!mt&&!Fe.isSingleton&&{prefix:q?Vc(h).prefix:null}});return}if(ie!==null)return s.fetchQuery({...Qc(i,y,ie),staleTime:0}).then((mt)=>{if(!ce||J!==U.current)return;let et=Pc(mt),ze=Oe.current,Ce=qn(a,y,ie),$t=ze?.pathname===Ce?ze.save:{kind:"idle"};if(ze?.pathname===Ce)Oe.current=null;C({type:"documentOpened",document:et,save:$t})});if(Fe.isSingleton){let mt=await s.ensureQueryData(ky(i,y,Vc("?scope=collection")));if(!Se())return;let et=mt.entities[0];if(et)return s.fetchQuery({...Qc(i,y,et.id),staleTime:0}).then((ze)=>{if(!ce||J!==U.current)return;let Ce=Pc(ze);C({type:"documentOpened",document:Ce})});C({type:"creationStarted",singleton:!0,draft:Ty(Fe.fields)})}return}).catch((Fe)=>{if(ce&&J===U.current)V(Hr(Fe))}),()=>{ce=!1}},[g,p,y,ve,s,f,h,u,P,q]);let Y=Li.useCallback((ie,J={kind:"idle"},ce=y)=>{if(!ce||!y)return;let Se=qn(a,ce,ie);if(!(ce===y&&u.kind==="entity"&&u.entityType===y&&u.id===ie)){Oe.current={pathname:Se,save:J};let et=`${gi(a,v??y)}${yi(w)}`,ze=g&&J.kind==="saved",Ce=l.location.state,$t=!ze||Od(Ce)&&Ce.studioCollectionPath===et;l[ze?"replace":"push"](`${Se}${yi(w)}`,$t?{studioCollectionPath:et}:void 0,J.kind==="saved"?{ignoreBlocker:!0}:void 0);return}let _e=++U.current,mt=y;s.fetchQuery({...Qc(i,y,ie),staleTime:0}).then((et)=>{if(_e!==U.current||fe.current!==mt)return;let ze=Pc(et);C({type:"documentOpened",document:ze,save:J}),B({kind:"idle"})}).catch((et)=>{if(_e===U.current)V(Hr(et))})},[a,p,u,g,y,v,w,s,l]),re=Li.useCallback(()=>{ue((ie)=>ie+1)},[]),rt=Li.useCallback(()=>{U.current+=1},[]),W=Li.useCallback(()=>U.current,[]);return{openEntity:Y,loadError:Q,setLoadError:V,retryOpen:re,supersedeOpen:rt,currentOpenRequest:W,pendingOpenState:Oe}}var Zo=F(yt(),1);function e3(e){let{api:i,queryClient:s,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:E,deleteEntityMutation:M,openEntity:B,currentOpenRequest:P,setMobilePane:q,setFieldAssistState:Q}=e,{mode:V,draft:ve,body:ue,save:Oe}=v,[U,fe]=Zo.useState(null),Y=Zo.useRef(0);Zo.useEffect(()=>{if(Oe.kind!=="saved"||!A?.git)return;if(ng({save:Oe,git:A.git,baselineCommit:U}).committed==="done")return;if(Date.now()-Y.current>20000)return;let ce=window.setTimeout(()=>{s.invalidateQueries({queryKey:bn.syncStatus()})},900);return()=>window.clearTimeout(ce)},[Oe,A,U,s]);let re=Zo.useCallback((J,ce)=>{if(!u||V.kind!=="edit"||g?.canUpdate!==!0||g.canAssist!==!0||ue.trim().length===0)return;Q({kind:"loading",field:ce,variant:J}),i.requestFieldAssist({variant:J,entityType:u,id:V.entity.id,targetField:ce}).then((Se)=>{let Fe=Se.variant==="summarize"?Se.suggestion:Se.suggestions;Q({kind:"suggested",field:Se.targetField,variant:Se.variant,suggestion:Fe})}).catch((Se)=>{Q({kind:"error",field:ce,message:$n(Se)})})},[g,ue,u,V]),rt=Zo.useCallback((J,ce)=>{S({type:"fieldAssistApplied",field:J,suggestion:ce}),Q({kind:"idle"})},[]),W=Zo.useCallback(()=>{if(!u||V.kind==="browse"||!y||u===El&&!y.groupingDefinitions||Md(v)||(V.kind==="create"&&y.isSingleton||u===El)&&!Gm(v))return;if(V.kind==="create"?g?.canCreate!==!0:g?.canUpdate!==!0)return;Y.current=Date.now(),fe(A?.git?.lastCommit??null),S({type:"saveStarted"});let J=y.hasBody?{body:ue}:{},ce=wy(y.fields,ve),Se=V.kind==="create"?{kind:"create",entityType:u,...w&&{idPath:w},frontmatter:ce,...J}:{kind:"update",entityType:u,id:V.entity.id,frontmatter:ce,baseContentHash:V.entity.contentHash,...J},Fe=P();E.mutate(Se,{onSuccess:async(_e)=>{if(await Promise.all([s.invalidateQueries({queryKey:["studio","groupings"]}),s.invalidateQueries({queryKey:bn.entities(u)}),...f&&f!==u?[s.invalidateQueries({queryKey:bn.entities(f)})]:[],s.invalidateQueries({queryKey:bn.syncStatus()}),...u===El?[s.invalidateQueries({queryKey:["studio","schema"]})]:[],...V.kind==="create"||u===El?[s.invalidateQueries({queryKey:bn.navigation()})]:[]]),Fe!==P())return;let mt="skipped"in _e&&_e.skipped===!0;B(_e.entityId,{kind:"saved",noop:mt})},onError:(_e)=>{if(Fe!==P())return;if(_e instanceof qo&&(_e.status===400||_e.status===409))Promise.all([s.invalidateQueries({queryKey:bn.navigation()}),s.invalidateQueries({queryKey:["studio","schema"]}),s.invalidateQueries({queryKey:["studio","groupings"]})]);if(_e instanceof qo&&_e.issues.length>0)q("details");S({type:"saveFailed",save:_e instanceof qo&&_e.status===409&&V.kind==="edit"?{kind:"conflict",message:$n(_e),..._e.conflictId!==void 0&&{conflictId:_e.conflictId}}:{kind:"error",message:_e instanceof qo&&_e.issues.length>0?_e.message||"Validation failed":$n(_e),..._e instanceof qo?{issues:_e.issues}:{}}})}})},[g,u,f,V,w,v,ve,ue,y,B,A,s,E]),ie=Zo.useCallback(()=>{if(!u||V.kind!=="edit"||C||g?.canDelete!==!0)return;let{id:J}=V.entity;M.mutate({entityType:u,id:J},{onSuccess:async()=>{S({type:"deleteSucceeded"}),s.removeQueries({queryKey:bn.entity(u,J)}),await Promise.all([s.invalidateQueries({queryKey:["studio","groupings"]}),s.invalidateQueries({queryKey:bn.entityLists()}),s.invalidateQueries({queryKey:bn.syncStatus()}),s.invalidateQueries({queryKey:bn.navigation()})]),l.replace(p??`${gi(a,f??u)}${yi(h)}`,void 0,{ignoreBlocker:!0})},onError:(ce)=>{S({type:"deleteFailed",message:$n(ce)})}})},[g,a,u,f,V,C,s,M,l,p,h]);return{runFieldAssist:re,applyFieldAssist:rt,save:W,remove:ie,baselineCommit:U}}var wh=F(yt(),1);function i3(e){let{history:i,queryClient:s,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:E,declarativeWorkspaceData:M,initialUrlWorkspaceQuery:B,setActiveWorkspaceId:P,setEntityType:q,setLoadError:Q,supersedeOpen:V}=e;wh.useEffect(()=>{if(!h||!S||p||a.kind!=="collection"&&a.kind!=="entity"||a.entityType!==h)return;if(E===void 0)return;let ve=Math.floor(Math.max(0,E-1)/A.limit)*A.limit;if(C>ve)i.replace(`${u}${yi({...A,offset:ve})}`,i.location.state)},[S,p,C,E,A,h,u,a,i]),wh.useEffect(()=>{if(!p||!M?.refreshAfterMs)return;let ve=window.setTimeout(()=>{s.invalidateQueries({queryKey:bn.workspace(p)})},M.refreshAfterMs);return()=>window.clearTimeout(ve)},[p,M,s]),wh.useEffect(()=>{if(w?.urlQuery!==!0||a.kind!=="workspace"||a.workspaceId!==w.id)return;let ve=mi(l,w.id);if(Qa(ve,B)!==`${ve}${f}`)Sy(i,ve,B,window.location.pathname)},[w,l,B,f,a,i]),wh.useEffect(()=>{if(!g)return;if(Q(null),a.kind==="not-found"){V(),Q(`Studio route not found: ${a.pathname}`);return}if(a.kind==="images"){V(),P(null),q(null);return}if(a.kind==="grouping"){if(V(),P(null),q(null),!y.some((U)=>U.key===a.grouping))Q("Collection unavailable for this account.");return}if(a.kind==="workspace"){let U=v.find((fe)=>fe.id===a.workspaceId);if(!U){let fe=t3(l,a.workspaceId,f,v);if(fe){i.replace(fe);return}V(),Q(`Workspace unavailable for this account: ${a.workspaceId}`);return}P(U.id),q(null);return}let ve=a.kind==="collection"||a.kind==="entity"?a.entityType:void 0,ue=g.find((U)=>!U.isSingleton)??g[0];if(a.kind==="home"){let U=n3(l,g,v);if(U!==l){i.replace(U);return}}let Oe=ve??ue?.entityType??null;if(ve!==void 0&&!g.some((U)=>U.entityType===ve)){V(),Q(`Collection unavailable for this account: ${ve}`);return}P(null),q(Oe)},[f,a,i,l,g,y,v])}var Ex=F(yt(),1);function s3(e){let{queryClient:i,workspaces:s,activeWorkspaceId:l,entityType:a,mode:u,declarativeWorkspaceActionMutation:f,openEntity:h}=e,p=Ex.useCallback(async(y)=>{let v=o3(s,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(!cx(A)&&!fx(A)){if(await Tx(i,v.id),u.kind==="edit"&&a===y.entityType&&u.entity.id===y.entityId)h(y.entityId)}return A},[a,u,h,i,f,s]),g=Ex.useCallback(async(y)=>{if(!l)throw Error("Declarative workspace is unavailable");try{let v=await f.mutateAsync({workspaceId:l,action:y});return await Tx(i,l),v}finally{f.reset()}},[l,f,i]);return{performPublishingAction:p,performDeclarativeAction:g}}var Qt=F(xe(),1),fI=pt.lazy(()=>vS(async()=>({default:(await import("./studio-chunks/account-view-kkfs676e.js")).AccountApp}))),dI=pt.lazy(()=>vS(async()=>({default:(await import("./studio-chunks/studio-chat-workspace-wy37fxat.js")).StudioChatWorkspace}),()=>Qt.jsxDEV(Ga,{message:"Chat could not open.",children:Qt.jsxDEV(bS,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)));function hI(e){let i=new URLSearchParams(e).get("session")?.trim();return i&&i.length<=256?i:null}var pI=["public","trusted","admin"];function mI(e,i,s){let l=document.querySelector("[data-studio-root]"),a=l?.getAttribute("data-studio-principal-name")??"Your account",u=l?.getAttribute("data-studio-principal-role"),f=pI.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(s).get("section")??void 0,y=a3(s);return{displayName:a,role:f,routePath:e,studioPath:i,...h?{mcpUrl:h}:{},...p?{davUrl:p}:{},...g?{initialSection:g}:{},...y?{connect:y}:{}}}function h3(){let e=l3(),i=Ey({select:(qe)=>qe.location.pathname}),s=Ey({select:(qe)=>qe.location.searchStr}),l=Ey({select:(qe)=>qe.location.state}),a=Rs(),u=pt.useMemo(()=>i===pc?{kind:"workspace",workspaceId:Ay}:Fm(i,a),[i,a]),f=pt.useMemo(()=>u.kind==="collection"&&new URLSearchParams(s).get("mode")==="create",[s,u]),h=i,[p,g]=pt.useState(null),[y,v]=pt.useState(null),[S,w]=pt.useState({}),[A,C]=pt.useReducer(c2,Rd),{mode:E}=A,M=Gm(A),[B]=pt.useState(()=>new f3),P=pt.useSyncExternalStore(B.subscribe,B.hasDrafts,B.hasDrafts),[q,Q]=pt.useState({hasDraft:!1,busy:!1}),V=r3({shouldBlockFn:({next:qe})=>M||i===pc&&c3({...q,hasDraft:P},qe.pathname),enableBeforeUnload:M||P||q.busy,withResolver:!0}),[ve,ue]=pt.useState({kind:"idle"}),[Oe,U]=pt.useState("source"),fe=A.mode.kind==="create";pt.useEffect(()=>{if(fe)U("source")},[fe]);let[Y,re]=pt.useState("details"),rt=pt.useRef(null),W=pt.useCallback((qe)=>{rt.current=qe,re(qe)},[]),ie=dc(),J=Jt(),{navigationQuery:ce,types:Se,groupings:Fe,activeType:_e,collectionType:mt,activeCapabilities:et,entityCollectionQuery:ze,entityListOffset:Ce,workspaces:$t,activeWorkspace:zi,activeAccount:to,activeChat:Rl,initialUrlWorkspaceQuery:Wc,workspaceRequestQuery:oe,workspaceQuery:Hn,workspaceData:Wa,workspaceError:Ir,agentTargets:Ur,syncStatus:gt,entityListQuery:Ao,entities:Ya,entityListTotal:Ch,schema:ut,createPath:My,destinationQuery:To,saveEntityMutation:Xa,deleteEntityMutation:_r,declarativeWorkspaceActionMutation:Oy,deleting:Fa,declarativeWorkspaceData:Ka}=Gz({api:J,entityType:y,activeWorkspaceId:p,routeSearch:s,workspaceQueries:S,editor:A}),Ml=$t.find((qe)=>qe.rendererName===Gc),Ah=I2({entityType:y,entities:Ya}),Yc=p2({principalId:document.querySelector("[data-studio-root]")?.getAttribute("data-studio-principal-id")??null,entityType:y,editor:A,hasUnsavedChanges:M,fields:ut?.fields??[],dispatch:C}),qs=u.kind==="grouping"?Fe.find((qe)=>qe.key===u.grouping):void 0,qr=pt.useMemo(()=>pS(s),[s]),$r=u.kind==="entity"?S2(l,a,Fe):null,Xc=$r?.path,Th=pt.useMemo(()=>y?Fe.filter((qe)=>qe.types.includes(y)):[],[Fe,y]),Fc=zz(Th),{openEntity:Za,loadError:Eh,setLoadError:Ja,retryOpen:Ol,supersedeOpen:Jo,currentOpenRequest:Pr,pendingOpenState:$s}=Jz({api:J,queryClient:ie,history:e.history,studioBasePath:a,routeTarget:u,routePathname:i,routeSearch:s,currentStudioPathname:h,createMode:f,entityType:y,collectionType:mt,activeType:_e,entityCollectionQuery:ze,preferredMobilePane:rt,dispatchEditor:C,setMobilePane:re,setBodyMode:U,setFieldAssistState:ue});i3({history:e.history,queryClient:ie,studioBasePath:a,routeTarget:u,routePathname:i,routeSearch:s,entityType:y,activeWorkspaceId:p,types:Se,groupings:Fe,workspaces:$t,activeType:_e,activeWorkspace:zi,entityCollectionQuery:ze,entityListOffset:Ce,entityListTotal:Ch,declarativeWorkspaceData:Ka,initialUrlWorkspaceQuery:Wc,setActiveWorkspaceId:g,setEntityType:v,setLoadError:Ja,supersedeOpen:Jo});let{openWorkspaceEntity:sn,openWorkspaceLaunch:Ps,selectEntityType:es,changeEntityPage:Ll,selectWorkspace:jr,selectFolder:Dh,startCreate:eu,backToList:tu,changeWorkspaceQuery:Eo}=Xz({history:e.history,studioBasePath:a,routeSearch:s,entityType:y,collectionType:mt,entityCollectionQuery:ze,groupReturnPath:Xc,workspaces:$t,schema:ut,activeCapabilities:et,pendingOpenState:$s,setFieldAssistState:ue,setWorkspaceQueries:w}),{runFieldAssist:bi,applyFieldAssist:Rh,save:Ly,remove:Kc,baselineCommit:Mh}=e3({api:J,queryClient:ie,history:e.history,studioBasePath:a,entityType:y,collectionType:mt,entityCollectionQuery:ze,groupReturnPath:Xc,activeCapabilities:et,schema:ut,editor:A,dispatchEditor:C,createPath:My,syncStatus:gt,deleting:Fa,saveEntityMutation:Xa,deleteEntityMutation:_r,openEntity:Za,currentOpenRequest:Pr,setMobilePane:re,setFieldAssistState:ue}),{performPublishingAction:nu,performDeclarativeAction:vi}=s3({queryClient:ie,workspaces:$t,activeWorkspaceId:p,entityType:y,mode:E,declarativeWorkspaceActionMutation:Oy,openEntity:Za}),Do=Eh??(ce.error?Hr(ce.error):Ao.error?Hr(Ao.error):null),iu=()=>{if(Ja(null),ce.error)ce.refetch();if(Ao.error)Ao.refetch();if(Hn.error)Hn.refetch();if(E.kind==="browse")Ol()};if(Do&&!Se)return Qt.jsxDEV(Ga,{message:Do,error:!0,onRetry:iu},void 0,!1,void 0,this);if(!Se)return Qt.jsxDEV(Ga,{message:"Loading…"},void 0,!1,void 0,this);if(to&&zi){let qe=mi(a,Cy);return Qt.jsxDEV(Rz,{types:Se,workspaces:$t,workspaceId:zi.id,selectEntityType:es,selectWorkspace:jr,children:Qt.jsxDEV(pt.Suspense,{fallback:Qt.jsxDEV(he,{children:"Opening Account…"},void 0,!1,void 0,this),children:Qt.jsxDEV(fI,{bootstrap:mI(qe,a,s)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}if(Rl&&zi)return Qt.jsxDEV(Qt.Fragment,{children:[Qt.jsxDEV(pt.Suspense,{fallback:Qt.jsxDEV(Ga,{message:"Opening Chat…"},void 0,!1,void 0,this),children:Qt.jsxDEV(dI,{apiPath:zi.chatApiPath,draftStore:B,onNavigationStateChange:Q,studioBasePath:a,sessionId:hI(s),types:Se,workspaces:$t,handoff:Lz(l),navigate:(qe,Ni)=>{e.history.push(qe,void 0,{ignoreBlocker:Ni?.preserveWork===!0})},selectEntityType:es,selectWorkspace:jr},void 0,!1,void 0,this)},void 0,!1,void 0,this),V.status==="blocked"&&Qt.jsxDEV(vn,{mark:"↩",title:"Leave this conversation?",titleId:"chat-navigation-title",cancelLabel:"Stay",confirmLabel:"Leave",onCancel:()=>V.reset(),onConfirm:()=>V.proceed(),children:Qt.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!==kh&&!Wa&&!Ir:y&&!ut&&!Do)return Qt.jsxDEV(Ga,{message:"Loading…"},void 0,!1,void 0,this);if(!qs&&u.kind!=="images"&&!p&&(!y||!ut&&!Do))return Qt.jsxDEV(Ga,{message:Do??"No readable collections are available for this account.",error:Boolean(Do),...Do?{onHome:()=>e.history.push(a)}:{}},void 0,!1,void 0,this);return Qt.jsxDEV(Mz,{groupings:{items:Fe,active:qs?.key??$r?.grouping??null,onSelect:(qe)=>e.history.push(fc(a,qe))},images:{active:u.kind==="images",onSelect:()=>e.history.push(u3(a))},imagesView:u.kind==="images"?Qt.jsxDEV(R2,{onOpen:(qe,Ni)=>e.history.push(qn(a,qe,Ni))},void 0,!1,void 0,this):null,homeView:p===kh?Qt.jsxDEV(F2,{chatApiPath:Ml?.chatApiPath,onNavigate:(qe)=>e.history.push(qe),onAsk:(qe)=>{B.update(d3(Ml?.chatApiPath,null),{text:qe}),e.history.push(pc)}},void 0,!1,void 0,this):null,groupReturnLabel:$r?.label,groupingSuggestions:Fc,groupingView:qs?Qt.jsxDEV(A2,{basePath:a,grouping:qs,types:Se,query:qr,onChange:(qe,Ni)=>{let Vr=`${fc(a,qs.key)}${cc(qe)}`,Oh=qe.value!==qr.value||qe.offset!==qr.offset;e.history[Oh&&Ni?.replace!==!0?"push":"replace"](Vr)},onOpen:(qe,Ni)=>{let Vr=qn(a,qe,Ni);$s.current={pathname:Vr,save:{kind:"idle"}},e.history.push(Vr,{studioGroupingPath:`${fc(a,qs.key)}${cc(qr)}`})}},void 0,!1,void 0,this):null,activeWorkspaceId:p,types:Se,workspaces:$t,workspaceError:Ir,readError:Do,onRetryRead:iu,declarativeWorkspaceData:Ka,workspaceQuery:oe,entityType:y,entities:Ya,refineNotice:Ah.notice,onRefineConfirmed:Ah.confirmed,folders:Ao.data?.folders??[],collectionTrail:Ao.data?.trail,collectionPath:mt?gi(a,mt):a,selectFolder:Dh,creationDestination:{data:To.data??null,pending:To.isPending,error:To.error},entityOffset:Ce,entityLimit:ze.limit,entityTotal:Ch??0,collectionQuery:ze,onCollectionQueryChange:(qe)=>{if(!mt)return;e.history.push(`${gi(a,mt)}${yi({...qe,offset:0})}`),window.scrollTo({top:0,left:0})},entityListLoading:Ao.isPending,schema:ut,editor:A,fieldAssistState:ve,bodyMode:Oe,mobilePane:Y,syncStatus:gt,baselineCommit:Mh,agentTargets:Ur,deleting:Fa,hasUnsavedChanges:M,navigationBlocked:V.status==="blocked",dispatchEditor:C,setFieldAssistState:ue,setBodyMode:U,setMobilePane:W,backToList:tu,selectEntityType:es,selectWorkspace:jr,changeEntityPage:Ll,openWorkspaceEntity:sn,openWorkspaceLaunch:Ps,performPublishingAction:nu,performDeclarativeAction:vi,onWorkspaceQueryChange:Eo,startCreate:eu,openEntity:(qe,Ni)=>Za(qe,void 0,Ni),runFieldAssist:bi,applyFieldAssist:Rh,save:Ly,remove:Kc,onNavigationReset:()=>V.reset?.(),draftRecovery:Yc,onNavigationProceed:()=>{Yc.forget(),V.proceed?.()}},void 0,!1,void 0,this)}function m3(){return new p3({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}var Ry=F(xe(),1),Dy=document.querySelector("[data-studio-root]");if(Dy){let e=Dy.getAttribute("data-studio-base-path")??"/studio",i=new v3({basePath:e});Dy.textContent="";let s=m3(),l=b3(e,h3);x3.createRoot(Dy).render(Ry.jsxDEV(g3,{client:s,children:Ry.jsxDEV(S3,{api:i,children:Ry.jsxDEV(y3,{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=3629C0DAFF4D17C564756E2164756E21
|