@rizom/brain 0.2.0-alpha.381 → 0.2.0-alpha.382

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.
@@ -495,6 +495,7 @@
495
495
  .x5zjp28:not(#\#):not(#\#):not(#\#){padding-inline-end:30px}
496
496
  .xsfy40s:not(#\#):not(#\#):not(#\#){padding-inline-end:32px}
497
497
  .xhig867:not(#\#):not(#\#):not(#\#){padding-inline-end:34px}
498
+ .xe2zdcy:not(#\#):not(#\#):not(#\#){padding-inline-start:10px}
498
499
  .x106a9eq:not(#\#):not(#\#):not(#\#){padding-inline-start:20px}
499
500
  .x162tt16:not(#\#):not(#\#):not(#\#){padding-inline-start:30px}
500
501
  .xhikr00:not(#\#):not(#\#):not(#\#){padding-inline-start:31px}
@@ -1,4 +1,4 @@
1
- import{a as Ob,d as CO,e as AO,f as TO,g as EO}from"./studio-chunks/main-vzjqx8f9.js";import{$ as Ri,A as V1,Aa as kD,B as GO,Ba as _m,C as Uo,Ca as oR,D as QO,Da as lR,E as I1,Ea as sR,F as WO,Fa as pR,G as L1,Ga as Pm,H as FO,I as JO,J as ZO,K as xl,L as KO,M as eR,N as $1,O as tR,P as nR,Q as P1,R as Y1,S as Mh,T as vO,U as br,V as Th,W as jm,X as Eh,Y as E1,Z as M1,_ as Vm,aa as xO,ba as D1,ca as If,da as iR,ea as kO,fa as z1,ga as O1,h as rR,ha as $p,i as IO,ia as En,j as cR,ja as Jn,k as ya,ka as cs,l as Ym,la as km,m as $O,ma as mr,n as fR,na as Fn,o as PO,oa as zm,p as Xm,pa as hh,q as Ft,qa as Cm,r as Mt,ra as zM,s as _1,sa as BM,t as U1,ta as dh,u as q1,ua as oM,v as j1,va as lM,w as YO,wa as W,xa as HD,y as XO,ya as d1,z as ba,za as yD}from"./studio-chunks/main-ew6ym140.js";import"./studio-chunks/main-b34wmcw1.js";import{Ab as ci,Bb as R1,Cb as Im,Db as MO,Na as P,Oa as ds,Pa as qe,Qa as sn,Ta as wO,Ua as et,Va as Xp,Wa as ia,Za as pO,bb as mO,cb as gO,db as Ki,eb as H2,fb as nO,gb as iO,hb as oO,ib as N2,jb as k1,kb as C1,lb as A1,mb as T1,pb as sr,qb as Zi,rb as qO,sb as yr,tb as jO,ub as vr,vb as hR,wb as dR,xb as Zu,yb as yO,zb as Pp}from"./studio-chunks/main-1gqf08r8.js";import{Eb as We,Fb as Tb,Hb as VO,Ib as gl,Kb as FB}from"./studio-chunks/main-rjhqdb2v.js";var b2=Tb(function(WB){(function(){function t(){if(ne=!1,Ne){var Q=WB.unstable_now();at=Q;var de=!0;try{e:{V=!1,I&&(I=!1,st(At),At=-1),_=!0;var pe=L;try{t:{c(Q);for(R=l(w);R!==null&&!(R.expirationTime>Q&&d());){var rt=R.callback;if(typeof rt==="function"){R.callback=null,L=R.priorityLevel;var Ge=rt(R.expirationTime<=Q);if(Q=WB.unstable_now(),typeof Ge==="function"){R.callback=Ge,c(Q),de=!0;break t}R===l(w)&&s(w),c(Q)}else s(w);R=l(w)}if(R!==null)de=!0;else{var zi=l(k);zi!==null&&m(h,zi.startTime-Q),de=!1}}break e}finally{R=null,L=pe,_=!1}de=void 0}}finally{de?te():Ne=!1}}}function i(Q,de){var pe=Q.length;Q.push(de);e:for(;0<pe;){var rt=pe-1>>>1,Ge=Q[rt];if(0<r(Ge,de))Q[rt]=de,Q[pe]=Ge,pe=rt;else break e}}function l(Q){return Q.length===0?null:Q[0]}function s(Q){if(Q.length===0)return null;var de=Q[0],pe=Q.pop();if(pe!==de){Q[0]=pe;e:for(var rt=0,Ge=Q.length,zi=Ge>>>1;rt<zi;){var qo=2*(rt+1)-1,so=Q[qo],Nn=qo+1,Rt=Q[Nn];if(0>r(so,pe))Nn<Ge&&0>r(Rt,so)?(Q[rt]=Rt,Q[Nn]=pe,rt=Nn):(Q[rt]=so,Q[qo]=pe,rt=qo);else if(Nn<Ge&&0>r(Rt,pe))Q[rt]=Rt,Q[Nn]=pe,rt=Nn;else break e}}return de}function r(Q,de){var pe=Q.sortIndex-de.sortIndex;return pe!==0?pe:Q.id-de.id}function c(Q){for(var de=l(k);de!==null;){if(de.callback===null)s(k);else if(de.startTime<=Q)s(k),de.sortIndex=de.expirationTime,i(w,de);else break;de=l(k)}}function h(Q){if(I=!1,c(Q),!V)if(l(w)!==null)V=!0,Ne||(Ne=!0,te());else{var de=l(k);de!==null&&m(h,de.startTime-Q)}}function d(){return ne?!0:WB.unstable_now()-at<se?!1:!0}function m(Q,de){At=be(function(){Q(WB.unstable_now())},de)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),WB.unstable_now=void 0,typeof performance==="object"&&typeof performance.now==="function"){var y=performance;WB.unstable_now=function(){return y.now()}}else{var b=Date,S=b.now();WB.unstable_now=function(){return b.now()-S}}var w=[],k=[],E=1,R=null,L=3,_=!1,V=!1,I=!1,ne=!1,be=typeof setTimeout==="function"?setTimeout:null,st=typeof clearTimeout==="function"?clearTimeout:null,Nt=typeof setImmediate<"u"?setImmediate:null,Ne=!1,At=-1,se=5,at=-1;if(typeof Nt==="function")var te=function(){Nt(t)};else if(typeof MessageChannel<"u"){var je=new MessageChannel,Jt=je.port2;je.port1.onmessage=t,te=function(){Jt.postMessage(null)}}else te=function(){be(t,0)};WB.unstable_IdlePriority=5,WB.unstable_ImmediatePriority=1,WB.unstable_LowPriority=4,WB.unstable_NormalPriority=3,WB.unstable_Profiling=null,WB.unstable_UserBlockingPriority=2,WB.unstable_cancelCallback=function(Q){Q.callback=null},WB.unstable_forceFrameRate=function(Q){0>Q||125<Q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):se=0<Q?Math.floor(1000/Q):5},WB.unstable_getCurrentPriorityLevel=function(){return L},WB.unstable_next=function(Q){switch(L){case 1:case 2:case 3:var de=3;break;default:de=L}var pe=L;L=de;try{return Q()}finally{L=pe}},WB.unstable_requestPaint=function(){ne=!0},WB.unstable_runWithPriority=function(Q,de){switch(Q){case 1:case 2:case 3:case 4:case 5:break;default:Q=3}var pe=L;L=Q;try{return de()}finally{L=pe}},WB.unstable_scheduleCallback=function(Q,de,pe){var rt=WB.unstable_now();switch(typeof pe==="object"&&pe!==null?(pe=pe.delay,pe=typeof pe==="number"&&0<pe?rt+pe:rt):pe=rt,Q){case 1:var Ge=-1;break;case 2:Ge=250;break;case 5:Ge=1073741823;break;case 4:Ge=1e4;break;default:Ge=5000}return Ge=pe+Ge,Q={id:E++,callback:de,priorityLevel:Q,startTime:pe,expirationTime:Ge,sortIndex:-1},pe>rt?(Q.sortIndex=pe,i(k,Q),l(w)===null&&Q===l(k)&&(I?(st(At),At=-1):I=!0,m(h,pe-rt))):(Q.sortIndex=Ge,i(w,Q),V||_||(V=!0,Ne||(Ne=!0,te()))),Q},WB.unstable_shouldYield=d,WB.unstable_wrapCallback=function(Q){var de=L;return function(){var pe=L;L=de;try{return Q.apply(this,arguments)}finally{L=pe}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var v2=Tb(function(JB){var Qe=We(b2()),Tu=We(gl()),Eb=We(FB());(function(){function t(e,n){for(e=e.memoizedState;e!==null&&0<n;)e=e.next,n--;return e}function i(e,n,o,a){if(o>=n.length)return a;var u=n[o],f=fn(e)?e.slice():Oe({},e);return f[u]=i(e[u],n,o+1,a),f}function l(e,n,o){if(n.length!==o.length)console.warn("copyWithRename() expects paths of the same length");else{for(var a=0;a<o.length-1;a++)if(n[a]!==o[a]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return s(e,n,o,0)}}function s(e,n,o,a){var u=n[a],f=fn(e)?e.slice():Oe({},e);return a+1===n.length?(f[o[a]]=f[u],fn(f)?f.splice(u,1):delete f[u]):f[u]=s(e[u],n,o,a+1),f}function r(e,n,o){var a=n[o],u=fn(e)?e.slice():Oe({},e);if(o+1===n.length)return fn(u)?u.splice(a,1):delete u[a],u;return u[a]=r(e[a],n,o+1),u}function c(){return!1}function h(){return null}function d(){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 m(){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 y(){}function b(){}function S(e){var n=[];return e.forEach(function(o){n.push(o)}),n.sort().join(", ")}function w(e,n,o,a){return new UR(e,n,o,a)}function k(e,n){e.context===Hs&&(Xy(e.current,2,n,e,null,null),_r())}function E(e,n){if(Vi!==null){var o=n.staleFamilies;n=n.updatedFamilies,Bc(),CS(e.current,n,o),_r()}}function R(e){Vi=e}function L(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function _(e){var n=e,o=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(o=n.return),e=n.return;while(e)}return n.tag===3?o:null}function V(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function I(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function ne(e){if(_(e)!==e)throw Error("Unable to find node on an unmounted component.")}function be(e){var n=e.alternate;if(!n){if(n=_(e),n===null)throw Error("Unable to find node on an unmounted component.");return n!==e?null:e}for(var o=e,a=n;;){var u=o.return;if(u===null)break;var f=u.alternate;if(f===null){if(a=u.return,a!==null){o=a;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===o)return ne(u),e;if(f===a)return ne(u),n;f=f.sibling}throw Error("Unable to find node on an unmounted component.")}if(o.return!==a.return)o=u,a=f;else{for(var p=!1,g=u.child;g;){if(g===o){p=!0,o=u,a=f;break}if(g===a){p=!0,a=u,o=f;break}g=g.sibling}if(!p){for(g=f.child;g;){if(g===o){p=!0,o=f,a=u;break}if(g===a){p=!0,a=f,o=u;break}g=g.sibling}if(!p)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!==a)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?e:n}function st(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=st(e),n!==null)return n;e=e.sibling}return null}function Nt(e){if(e===null||typeof e!=="object")return null;return e=Rk&&e[Rk]||e["@@iterator"],typeof e==="function"?e:null}function Ne(e){if(e==null)return null;if(typeof e==="function")return e.$$typeof===lz?null:e.displayName||e.name||null;if(typeof e==="string")return e;switch(e){case Pr:return"Fragment";case Zy:return"Profiler";case _d:return"StrictMode";case e0:return"Suspense";case t0:return"SuspenseList";case n0:return"Activity"}if(typeof e==="object")switch(typeof e.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case $r:return"Portal";case ll:return e.displayName||"Context";case Ky:return(e._context.displayName||"Context")+".Consumer";case Pc:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ud:return n=e.displayName||null,n!==null?n:Ne(e.type)||"Memo";case wi:n=e._payload,e=e._init;try{return Ne(e(n))}catch(o){}}return null}function At(e){return typeof e.tag==="number"?se(e):typeof e.name==="string"?e.name:null}function se(e){var n=e.type;switch(e.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 e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"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 Ne(n);case 8:return n===_d?"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=e._debugInfo,n!=null){for(var o=n.length-1;0<=o;o--)if(typeof n[o].name==="string")return n[o].name}if(e.return!==null)return se(e.return)}return null}function at(e){return{current:e}}function te(e,n){0>ql?console.error("Unexpected pop."):(n!==o0[ql]&&console.error("Unexpected Fiber popped."),e.current=i0[ql],i0[ql]=null,o0[ql]=null,ql--)}function je(e,n,o){ql++,i0[ql]=e.current,o0[ql]=o,e.current=n}function Jt(e){return e===null&&console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."),e}function Q(e,n){je(Ds,n,e),je(Yc,e,e),je(Ms,null,e);var o=n.nodeType;switch(o){case 9:case 11:o=o===9?"#document":"#fragment",n=(n=n.documentElement)?(n=n.namespaceURI)?tk(n):Kl:Kl;break;default:if(o=n.tagName,n=n.namespaceURI)n=tk(n),n=nk(n,o);else switch(o){case"svg":n=Cu;break;case"math":n=Np;break;default:n=Kl}}o=o.toLowerCase(),o=W1(null,o),o={context:n,ancestorInfo:o},te(Ms,e),je(Ms,o,e)}function de(e){te(Ms,e),te(Yc,e),te(Ds,e)}function pe(){return Jt(Ms.current)}function rt(e){e.memoizedState!==null&&je(qd,e,e);var n=Jt(Ms.current),o=e.type,a=nk(n.context,o);o=W1(n.ancestorInfo,o),a={context:a,ancestorInfo:o},n!==a&&(je(Yc,e,e),je(Ms,a,e))}function Ge(e){Yc.current===e&&(te(Ms,e),te(Yc,e)),qd.current===e&&(te(qd,e),_f._currentValue=or)}function zi(){}function qo(){if(Xc===0){Lk=console.log,zk=console.info,Bk=console.warn,Hk=console.error,Nk=console.group,_k=console.groupCollapsed,Uk=console.groupEnd;var e={configurable:!0,enumerable:!0,value:zi,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Xc++}function so(){if(Xc--,Xc===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Oe({},e,{value:Lk}),info:Oe({},e,{value:zk}),warn:Oe({},e,{value:Bk}),error:Oe({},e,{value:Hk}),group:Oe({},e,{value:Nk}),groupCollapsed:Oe({},e,{value:_k}),groupEnd:Oe({},e,{value:Uk})})}0>Xc&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function Nn(e){var n=Error.prepareStackTrace;if(Error.prepareStackTrace=void 0,e=e.stack,Error.prepareStackTrace=n,e.startsWith(`Error: react-stack-top-frame
1
+ import{a as Ob,d as CO,e as AO,f as TO,g as EO}from"./studio-chunks/main-vzjqx8f9.js";import{$ as Ri,A as V1,Aa as kD,B as GO,Ba as _m,C as Uo,Ca as oR,D as QO,Da as lR,E as I1,Ea as sR,F as WO,Fa as pR,G as L1,Ga as Pm,H as FO,I as JO,J as ZO,K as xl,L as KO,M as eR,N as $1,O as tR,P as nR,Q as P1,R as Y1,S as Mh,T as vO,U as br,V as Th,W as jm,X as Eh,Y as E1,Z as M1,_ as Vm,aa as xO,ba as D1,ca as If,da as iR,ea as kO,fa as z1,ga as O1,h as rR,ha as $p,i as IO,ia as En,j as cR,ja as Jn,k as ya,ka as cs,l as Ym,la as km,m as $O,ma as mr,n as fR,na as Fn,o as PO,oa as zm,p as Xm,pa as hh,q as Ft,qa as Cm,r as Mt,ra as zM,s as _1,sa as BM,t as U1,ta as dh,u as q1,ua as oM,v as j1,va as lM,w as YO,wa as W,xa as HD,y as XO,ya as d1,z as ba,za as yD}from"./studio-chunks/main-ptks77cs.js";import"./studio-chunks/main-b34wmcw1.js";import{Ab as ci,Bb as R1,Cb as Im,Db as MO,Na as P,Oa as ds,Pa as qe,Qa as sn,Ta as wO,Ua as et,Va as Xp,Wa as ia,Za as pO,bb as mO,cb as gO,db as Ki,eb as H2,fb as nO,gb as iO,hb as oO,ib as N2,jb as k1,kb as C1,lb as A1,mb as T1,pb as sr,qb as Zi,rb as qO,sb as yr,tb as jO,ub as vr,vb as hR,wb as dR,xb as Zu,yb as yO,zb as Pp}from"./studio-chunks/main-1gqf08r8.js";import{Eb as We,Fb as Tb,Hb as VO,Ib as gl,Kb as FB}from"./studio-chunks/main-rjhqdb2v.js";var b2=Tb(function(WB){(function(){function t(){if(ne=!1,Ne){var Q=WB.unstable_now();at=Q;var de=!0;try{e:{V=!1,I&&(I=!1,st(At),At=-1),_=!0;var pe=L;try{t:{c(Q);for(R=l(w);R!==null&&!(R.expirationTime>Q&&d());){var rt=R.callback;if(typeof rt==="function"){R.callback=null,L=R.priorityLevel;var Ge=rt(R.expirationTime<=Q);if(Q=WB.unstable_now(),typeof Ge==="function"){R.callback=Ge,c(Q),de=!0;break t}R===l(w)&&s(w),c(Q)}else s(w);R=l(w)}if(R!==null)de=!0;else{var zi=l(k);zi!==null&&m(h,zi.startTime-Q),de=!1}}break e}finally{R=null,L=pe,_=!1}de=void 0}}finally{de?te():Ne=!1}}}function i(Q,de){var pe=Q.length;Q.push(de);e:for(;0<pe;){var rt=pe-1>>>1,Ge=Q[rt];if(0<r(Ge,de))Q[rt]=de,Q[pe]=Ge,pe=rt;else break e}}function l(Q){return Q.length===0?null:Q[0]}function s(Q){if(Q.length===0)return null;var de=Q[0],pe=Q.pop();if(pe!==de){Q[0]=pe;e:for(var rt=0,Ge=Q.length,zi=Ge>>>1;rt<zi;){var qo=2*(rt+1)-1,so=Q[qo],Nn=qo+1,Rt=Q[Nn];if(0>r(so,pe))Nn<Ge&&0>r(Rt,so)?(Q[rt]=Rt,Q[Nn]=pe,rt=Nn):(Q[rt]=so,Q[qo]=pe,rt=qo);else if(Nn<Ge&&0>r(Rt,pe))Q[rt]=Rt,Q[Nn]=pe,rt=Nn;else break e}}return de}function r(Q,de){var pe=Q.sortIndex-de.sortIndex;return pe!==0?pe:Q.id-de.id}function c(Q){for(var de=l(k);de!==null;){if(de.callback===null)s(k);else if(de.startTime<=Q)s(k),de.sortIndex=de.expirationTime,i(w,de);else break;de=l(k)}}function h(Q){if(I=!1,c(Q),!V)if(l(w)!==null)V=!0,Ne||(Ne=!0,te());else{var de=l(k);de!==null&&m(h,de.startTime-Q)}}function d(){return ne?!0:WB.unstable_now()-at<se?!1:!0}function m(Q,de){At=be(function(){Q(WB.unstable_now())},de)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),WB.unstable_now=void 0,typeof performance==="object"&&typeof performance.now==="function"){var y=performance;WB.unstable_now=function(){return y.now()}}else{var b=Date,S=b.now();WB.unstable_now=function(){return b.now()-S}}var w=[],k=[],E=1,R=null,L=3,_=!1,V=!1,I=!1,ne=!1,be=typeof setTimeout==="function"?setTimeout:null,st=typeof clearTimeout==="function"?clearTimeout:null,Nt=typeof setImmediate<"u"?setImmediate:null,Ne=!1,At=-1,se=5,at=-1;if(typeof Nt==="function")var te=function(){Nt(t)};else if(typeof MessageChannel<"u"){var je=new MessageChannel,Jt=je.port2;je.port1.onmessage=t,te=function(){Jt.postMessage(null)}}else te=function(){be(t,0)};WB.unstable_IdlePriority=5,WB.unstable_ImmediatePriority=1,WB.unstable_LowPriority=4,WB.unstable_NormalPriority=3,WB.unstable_Profiling=null,WB.unstable_UserBlockingPriority=2,WB.unstable_cancelCallback=function(Q){Q.callback=null},WB.unstable_forceFrameRate=function(Q){0>Q||125<Q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):se=0<Q?Math.floor(1000/Q):5},WB.unstable_getCurrentPriorityLevel=function(){return L},WB.unstable_next=function(Q){switch(L){case 1:case 2:case 3:var de=3;break;default:de=L}var pe=L;L=de;try{return Q()}finally{L=pe}},WB.unstable_requestPaint=function(){ne=!0},WB.unstable_runWithPriority=function(Q,de){switch(Q){case 1:case 2:case 3:case 4:case 5:break;default:Q=3}var pe=L;L=Q;try{return de()}finally{L=pe}},WB.unstable_scheduleCallback=function(Q,de,pe){var rt=WB.unstable_now();switch(typeof pe==="object"&&pe!==null?(pe=pe.delay,pe=typeof pe==="number"&&0<pe?rt+pe:rt):pe=rt,Q){case 1:var Ge=-1;break;case 2:Ge=250;break;case 5:Ge=1073741823;break;case 4:Ge=1e4;break;default:Ge=5000}return Ge=pe+Ge,Q={id:E++,callback:de,priorityLevel:Q,startTime:pe,expirationTime:Ge,sortIndex:-1},pe>rt?(Q.sortIndex=pe,i(k,Q),l(w)===null&&Q===l(k)&&(I?(st(At),At=-1):I=!0,m(h,pe-rt))):(Q.sortIndex=Ge,i(w,Q),V||_||(V=!0,Ne||(Ne=!0,te()))),Q},WB.unstable_shouldYield=d,WB.unstable_wrapCallback=function(Q){var de=L;return function(){var pe=L;L=de;try{return Q.apply(this,arguments)}finally{L=pe}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var v2=Tb(function(JB){var Qe=We(b2()),Tu=We(gl()),Eb=We(FB());(function(){function t(e,n){for(e=e.memoizedState;e!==null&&0<n;)e=e.next,n--;return e}function i(e,n,o,a){if(o>=n.length)return a;var u=n[o],f=fn(e)?e.slice():Oe({},e);return f[u]=i(e[u],n,o+1,a),f}function l(e,n,o){if(n.length!==o.length)console.warn("copyWithRename() expects paths of the same length");else{for(var a=0;a<o.length-1;a++)if(n[a]!==o[a]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return s(e,n,o,0)}}function s(e,n,o,a){var u=n[a],f=fn(e)?e.slice():Oe({},e);return a+1===n.length?(f[o[a]]=f[u],fn(f)?f.splice(u,1):delete f[u]):f[u]=s(e[u],n,o,a+1),f}function r(e,n,o){var a=n[o],u=fn(e)?e.slice():Oe({},e);if(o+1===n.length)return fn(u)?u.splice(a,1):delete u[a],u;return u[a]=r(e[a],n,o+1),u}function c(){return!1}function h(){return null}function d(){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 m(){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 y(){}function b(){}function S(e){var n=[];return e.forEach(function(o){n.push(o)}),n.sort().join(", ")}function w(e,n,o,a){return new UR(e,n,o,a)}function k(e,n){e.context===Hs&&(Xy(e.current,2,n,e,null,null),_r())}function E(e,n){if(Vi!==null){var o=n.staleFamilies;n=n.updatedFamilies,Bc(),CS(e.current,n,o),_r()}}function R(e){Vi=e}function L(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function _(e){var n=e,o=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(o=n.return),e=n.return;while(e)}return n.tag===3?o:null}function V(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function I(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function ne(e){if(_(e)!==e)throw Error("Unable to find node on an unmounted component.")}function be(e){var n=e.alternate;if(!n){if(n=_(e),n===null)throw Error("Unable to find node on an unmounted component.");return n!==e?null:e}for(var o=e,a=n;;){var u=o.return;if(u===null)break;var f=u.alternate;if(f===null){if(a=u.return,a!==null){o=a;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===o)return ne(u),e;if(f===a)return ne(u),n;f=f.sibling}throw Error("Unable to find node on an unmounted component.")}if(o.return!==a.return)o=u,a=f;else{for(var p=!1,g=u.child;g;){if(g===o){p=!0,o=u,a=f;break}if(g===a){p=!0,a=u,o=f;break}g=g.sibling}if(!p){for(g=f.child;g;){if(g===o){p=!0,o=f,a=u;break}if(g===a){p=!0,a=f,o=u;break}g=g.sibling}if(!p)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!==a)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?e:n}function st(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=st(e),n!==null)return n;e=e.sibling}return null}function Nt(e){if(e===null||typeof e!=="object")return null;return e=Rk&&e[Rk]||e["@@iterator"],typeof e==="function"?e:null}function Ne(e){if(e==null)return null;if(typeof e==="function")return e.$$typeof===lz?null:e.displayName||e.name||null;if(typeof e==="string")return e;switch(e){case Pr:return"Fragment";case Zy:return"Profiler";case _d:return"StrictMode";case e0:return"Suspense";case t0:return"SuspenseList";case n0:return"Activity"}if(typeof e==="object")switch(typeof e.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case $r:return"Portal";case ll:return e.displayName||"Context";case Ky:return(e._context.displayName||"Context")+".Consumer";case Pc:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ud:return n=e.displayName||null,n!==null?n:Ne(e.type)||"Memo";case wi:n=e._payload,e=e._init;try{return Ne(e(n))}catch(o){}}return null}function At(e){return typeof e.tag==="number"?se(e):typeof e.name==="string"?e.name:null}function se(e){var n=e.type;switch(e.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 e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"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 Ne(n);case 8:return n===_d?"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=e._debugInfo,n!=null){for(var o=n.length-1;0<=o;o--)if(typeof n[o].name==="string")return n[o].name}if(e.return!==null)return se(e.return)}return null}function at(e){return{current:e}}function te(e,n){0>ql?console.error("Unexpected pop."):(n!==o0[ql]&&console.error("Unexpected Fiber popped."),e.current=i0[ql],i0[ql]=null,o0[ql]=null,ql--)}function je(e,n,o){ql++,i0[ql]=e.current,o0[ql]=o,e.current=n}function Jt(e){return e===null&&console.error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."),e}function Q(e,n){je(Ds,n,e),je(Yc,e,e),je(Ms,null,e);var o=n.nodeType;switch(o){case 9:case 11:o=o===9?"#document":"#fragment",n=(n=n.documentElement)?(n=n.namespaceURI)?tk(n):Kl:Kl;break;default:if(o=n.tagName,n=n.namespaceURI)n=tk(n),n=nk(n,o);else switch(o){case"svg":n=Cu;break;case"math":n=Np;break;default:n=Kl}}o=o.toLowerCase(),o=W1(null,o),o={context:n,ancestorInfo:o},te(Ms,e),je(Ms,o,e)}function de(e){te(Ms,e),te(Yc,e),te(Ds,e)}function pe(){return Jt(Ms.current)}function rt(e){e.memoizedState!==null&&je(qd,e,e);var n=Jt(Ms.current),o=e.type,a=nk(n.context,o);o=W1(n.ancestorInfo,o),a={context:a,ancestorInfo:o},n!==a&&(je(Yc,e,e),je(Ms,a,e))}function Ge(e){Yc.current===e&&(te(Ms,e),te(Yc,e)),qd.current===e&&(te(qd,e),_f._currentValue=or)}function zi(){}function qo(){if(Xc===0){Lk=console.log,zk=console.info,Bk=console.warn,Hk=console.error,Nk=console.group,_k=console.groupCollapsed,Uk=console.groupEnd;var e={configurable:!0,enumerable:!0,value:zi,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Xc++}function so(){if(Xc--,Xc===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Oe({},e,{value:Lk}),info:Oe({},e,{value:zk}),warn:Oe({},e,{value:Bk}),error:Oe({},e,{value:Hk}),group:Oe({},e,{value:Nk}),groupCollapsed:Oe({},e,{value:_k}),groupEnd:Oe({},e,{value:Uk})})}0>Xc&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function Nn(e){var n=Error.prepareStackTrace;if(Error.prepareStackTrace=void 0,e=e.stack,Error.prepareStackTrace=n,e.startsWith(`Error: react-stack-top-frame
2
2
  `)&&(e=e.slice(29)),n=e.indexOf(`
3
3
  `),n!==-1&&(e=e.slice(n+1)),n=e.indexOf("react_stack_bottom_frame"),n!==-1&&(n=e.lastIndexOf(`
4
4
  `,n)),n!==-1)e=e.slice(0,n);else return"";return e}function Rt(e){if(l0===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);l0=n&&n[1]||"",qk=-1<o.stack.indexOf(`
@@ -242,6 +242,6 @@ You might need to use a local HTTP server (instead of file://): https://react.de
242
242
 
243
243
  [Open the Inbox item](${i.backlink})`;return{draft:l,body:i.body?`${i.body}
244
244
 
245
- ${s}`:s}}function HO(t,i,l){return{studioChatHandoff:{version:1,sourceId:t,itemId:i,label:l,prompt:"Help me understand this Inbox item and decide what to do next."}}}function NO(t){if(typeof t!=="object"||t===null)return null;let i=Reflect.get(t,"studioChatHandoff");if(typeof i!=="object"||i===null)return null;let l=Reflect.get(i,"version"),s=Reflect.get(i,"sourceId"),r=Reflect.get(i,"itemId"),c=Reflect.get(i,"label"),h=Reflect.get(i,"prompt");if(l!==1||typeof s!=="string"||!/^[a-z][a-z0-9-]*$/.test(s)||s.length>64||typeof r!=="string"||r.trim().length===0||r.length>300||typeof c!=="string"||c.trim().length===0||c.length>160||typeof h!=="string"||h.trim().length===0||h.length>1e4)return null;return{sourceId:s,itemId:r,label:c,prompt:h}}function ic(t){if(t instanceof vr)switch(t.status){case 401:return"Your session is no longer authenticated. Sign in again in another tab, then retry here. Keep this tab open to preserve your draft.";case 403:return"You do not currently have permission to read this content. Ask an administrator to check access, then retry.";case 404:return"This content is unavailable. It may have moved, been removed, or be outside your access. Choose another destination or retry.";case 429:return"Studio is receiving too many requests. Wait briefly before retrying."}return`Studio could not load this data. Check your connection or retry later. ${Ri(t)}`}var _O=new Set(["offset","limit"]);function UO(t,i){if(t?.urlQuery!==!0)return{};let l={};for(let[s,r]of new URLSearchParams(i))if(!_O.has(s))l[s]=r;return l}function B1(t){let i=new URLSearchParams,l=Object.entries(t).filter(([r,c])=>!_O.has(r)&&c!==void 0&&(typeof c!=="number"||Number.isFinite(c))).sort(([r],[c])=>r.localeCompare(c));for(let[r,c]of l)i.set(r,String(c));let s=i.toString();return s?`?${s}`:""}function oc(t,i){return`${t}${B1(i)}`}function H1(t,i,l,s){if(s!==i)return;t.replace(oc(i,l))}function N1(t){let i=yr.safeParse(jO(new URLSearchParams(t))),l=i.success?i.data:yr.parse({});return{...l,offset:Math.floor(l.offset/l.limit)*l.limit}}function Sr(t){let i=new URLSearchParams;if(t.offset>0)i.set("offset",String(t.offset));if(t.limit!==qO)i.set("limit",String(t.limit));if(t.q)i.set("q",t.q);if(t.visibility!=="all")i.set("visibility",t.visibility);if(t.status)i.set("status",t.status);if(t.sort!=="updated-desc")i.set("sort",t.sort);let l=i.toString();return l?`?${l}`:""}var wn=We(sn(),1),DH=le.lazy(async()=>({default:(await import("./studio-chunks/account-view-4544h367.js")).AccountApp})),OH=le.lazy(async()=>({default:(await import("./studio-chunks/studio-chat-workspace-g2rp0g08.js")).StudioChatWorkspace}));function RH(t){let i=new URLSearchParams(t).get("session")?.trim();return i&&i.length<=256?i:null}function LH(){let t=window.history.state;return x2(t)?t:{}}var zH=[],BH=[],HH={},NH=["public","trusted","admin"];function _H(t,i){let l=document.querySelector("[data-studio-root]"),s=l?.getAttribute("data-studio-principal-name")??"Your account",r=l?.getAttribute("data-studio-principal-role"),c=NH.find((h)=>h===r)??"public";return{displayName:s,role:c,routePath:t,studioPath:i}}function aR(){let t=$O(),i=Xm({select:(U)=>U.location.pathname}),l=Xm({select:(U)=>U.location.searchStr}),s=Xm({select:(U)=>U.location.state}),r=oR(),c=le.useMemo(()=>i===_1?{kind:"workspace",workspaceId:U1}:QO(i,r),[i,r]),h=le.useMemo(()=>c.kind==="collection"&&new URLSearchParams(l).get("mode")==="create",[l,c]),d=i,[m,y]=le.useState(null),[b,S]=le.useState(null),[w,k]=le.useState({}),[E,R]=le.useReducer(T2,jf),{mode:L,draft:_,body:V,save:I}=E,ne=A2(E),[be]=le.useState(()=>new XO),st=le.useSyncExternalStore(be.subscribe,be.hasDrafts,be.hasDrafts),[Nt,Ne]=le.useState({hasDraft:!1,busy:!1}),At=PO({shouldBlockFn:({next:U})=>ne||i===_1&&YO({...Nt,hasDraft:st},U.pathname),enableBeforeUnload:ne||st||Nt.busy,withResolver:!0}),[se,at]=le.useState({kind:"idle"}),[te,je]=le.useState("preview"),[Jt,Q]=le.useState("details"),de=le.useRef(null),pe=le.useCallback((U)=>{de.current=U,Q(U)},[]),[rt,Ge]=le.useState(null),[zi,qo]=le.useState(0),[so,Nn]=le.useState(null),Rt=le.useRef(0),ao=le.useRef(null),an=le.useRef(0),va=le.useRef(b);va.current=b;let ut=IO(),_t=Zu(),Be=ya(KO(_t)),X=Be.data?.types??null,Kn=X?.find((U)=>U.entityType===b),Ke=Kn?.capabilities,It=le.useMemo(()=>Kn?.isSingleton?N1(""):N1(l),[Kn?.isSingleton,l]),Lt=It.offset,Se=Be.data?.workspaces??BH,Ye=Se.find((U)=>U.id===m),rn=Ye?.rendererName===WO,jo=Ye?.rendererName===q1,we=Ye?.rendererName==="DeclarativeOperatorWorkspace",kl=m?w[m]:void 0,ei=Ye?.urlQuery!==!0||kl?.urlSearch===l,un=le.useMemo(()=>UO(Ye,l),[Ye,l]),ro=m?kl&&ei?kl.query:un:HH,Cl=ya({...eR(_t,m??"",ro),enabled:we}),uo=Cl.data??null,Sa=uo?.data??null,Bi=Cl.error?ic(Cl.error):null,co=L.kind==="edit"?L.entity.id:null,wr=ya({...tR(_t,b??"",co??""),enabled:b!==null&&co!==null&&Ke?.canAssist===!0&&Ke.canUpdate}).data??zH,Hi=ya({...nR(_t),enabled:b!==null}).data??null,Ni=ya({...Y1(_t,b??"",It),enabled:b!==null}),xr=b?Ni.data?.entities??null:null,Vo=Ni.data?.total,Al=ya({...P1(_t,b??""),enabled:b!==null}),_n=b?Al.data??null:null;ya({...Mh(_t,b??"",co??""),enabled:b!==null&&co!==null});let fo=Ym({mutationFn:(U)=>ZO(_t,U)}),K=Ym({mutationFn:(U)=>JO(_t,U)}),bt=Ym({mutationFn:(U)=>FO(_t,U)}),Tl=K.isPending,ho=we&&uo?uo.data:null;le.useEffect(()=>{if(!b||!Kn||m||c.kind!=="collection"&&c.kind!=="entity"||c.entityType!==b)return;if(Vo===void 0)return;let U=Math.floor(Math.max(0,Vo-1)/It.limit)*It.limit;if(Lt>U)t.history.replace(`${i}${Sr({...It,offset:U})}`,t.history.location.state)},[Kn,m,Lt,Vo,It,b,i,c,t.history]),le.useEffect(()=>{if(!m||!ho?.refreshAfterMs)return;let U=window.setTimeout(()=>{ut.invalidateQueries({queryKey:xl.workspace(m)})},ho.refreshAfterMs);return()=>window.clearTimeout(U)},[m,ho,ut]),le.useEffect(()=>{if(Ye?.urlQuery!==!0||c.kind!=="workspace"||c.workspaceId!==Ye.id)return;let U=Uo(r,Ye.id);if(oc(U,un)!==`${U}${l}`)H1(t.history,U,un,window.location.pathname)},[Ye,r,un,l,c,t.history]),le.useEffect(()=>{if(!X)return;if(Ge(null),c.kind==="not-found"){an.current+=1,Ge(`Studio route not found: ${c.pathname}`);return}if(c.kind==="workspace"){let xe=Se.find((Me)=>Me.id===c.workspaceId);if(!xe){let Me=lR(r,c.workspaceId,l,Se);if(Me){t.history.replace(Me);return}an.current+=1,Ge(`Workspace unavailable for this account: ${c.workspaceId}`);return}y(xe.id),S(null);return}let U=c.kind==="collection"||c.kind==="entity"?c.entityType:void 0,re=X.find((xe)=>!xe.isSingleton)??X[0];if(c.kind==="home"){let xe=sR(r,X,Se);if(xe!==r){t.history.replace(xe);return}}let Le=U??re?.entityType??null;if(U!==void 0&&!X.some((xe)=>xe.entityType===U)){an.current+=1,Ge(`Collection unavailable for this account: ${U}`);return}y(null),S(Le)},[l,c,t.history,r,X,Se]),le.useEffect(()=>{if(I.kind!=="saved"||!Hi?.git)return;if(qm({save:I,git:Hi.git,baselineCommit:so}).committed==="done")return;if(Date.now()-Rt.current>20000)return;let re=window.setTimeout(()=>{ut.invalidateQueries({queryKey:xl.syncStatus()})},900);return()=>window.clearTimeout(re)},[I,Hi,so,ut]),le.useEffect(()=>{if(!b||c.kind==="workspace"||c.kind==="not-found")return;let U=c.kind==="entity"&&c.entityType===b?c.id:null,re=++an.current;R({type:"collectionChanged"}),Q("details"),at({kind:"idle"});let Le=!0,xe=()=>Le&&re===an.current;return ut.fetchQuery({...P1(_t,b),staleTime:0}).then(async(Me)=>{if(!Le||re!==an.current)return;let Ve=DO(Me,de.current);if(Q(Ve),window.matchMedia("(max-width: 640px)").matches&&Ve!=="details")je(Ve==="write"?"source":"preview");if(h&&U===null){if(X?.find((cn)=>cn.entityType===b)?.capabilities.canCreate!==!0){Ge(`Creating ${b} is not allowed.`);return}let Ol=zO(window.history.state,b,()=>window.history.replaceState(LO(LH()),"",window.location.href)),go=BO(Me.fields,Ol);R({type:"creationStarted",draft:go.draft,body:go.body});return}if(U!==null)return ut.fetchQuery({...Mh(_t,b,U),staleTime:0}).then((Dl)=>{if(!Le||re!==an.current)return;let Ol=tc(Dl),go=ao.current,cn=go?.pathname===d?go.save:{kind:"idle"};if(go?.pathname===d)ao.current=null;R({type:"documentOpened",document:Ol,save:cn})});if(Me.isSingleton){let Dl=await ut.ensureQueryData(Y1(_t,b));if(!xe())return;let Ol=Dl.entities[0];if(Ol)return ut.fetchQuery({...Mh(_t,b,Ol.id),staleTime:0}).then((go)=>{if(!Le||re!==an.current)return;let cn=tc(go);R({type:"documentOpened",document:cn})});R({type:"creationStarted",draft:Eh(Me.fields)})}return}).catch((Me)=>{if(Le&&re===an.current)Ge(ic(Me))}),()=>{Le=!1}},[h,d,b,zi,ut,i,c,X]);let zt=le.useCallback((U,re={kind:"idle"})=>{if(!b)return;let Le=V1(r,b,U);if(Le!==d){ao.current={pathname:Le,save:re},t.history.push(`${Le}${Sr(It)}`,{studioCollectionPath:`${ba(r,b)}${Sr(It)}`},re.kind==="saved"?{ignoreBlocker:!0}:void 0);return}let xe=++an.current,Me=b;ut.fetchQuery({...Mh(_t,b,U),staleTime:0}).then((Ve)=>{if(xe!==an.current||va.current!==Me)return;let Dl=tc(Ve);R({type:"documentOpened",document:Dl,save:re}),at({kind:"idle"})}).catch((Ve)=>{if(xe===an.current)Ge(ic(Ve))})},[r,d,b,It,ut,t.history]),po=le.useCallback((U,re)=>{let Le=V1(r,U,re);ao.current={pathname:Le,save:{kind:"idle"}},t.history.push(Le,{studioCollectionPath:ba(r,U)})},[r,t.history]),El=le.useCallback((U,re,Le,xe)=>{t.history.push(GO(r,"note"),C2(U,`entity://${encodeURIComponent(Le)}/${encodeURIComponent(xe)}`,re))},[r,t.history]),Ml=le.useCallback((U,re,Le)=>{if(Se.some((xe)=>xe.rendererName===q1)){t.history.push(j1(r),HO(U,re,Le));return}},[t.history,r,Se]),sc=le.useCallback((U)=>{switch(U.target){case"account-settings":{t.history.push(Uo(r,I1));return}case"invitations":t.history.push(oc(Uo(r,"admin:administration"),{tab:"invitations"}));return;case"admin-peer-invite":{t.history.push(oc(Uo(r,"admin:administration"),{tab:"invitations",peerId:U.peerId,displayName:U.displayName}));return}case"inbox":{let re={};if("source"in U){if(re.sourceId="mail-items",U.filter==="high-priority")re["facet.mail-priority"]="high";else if(U.filter==="needs-reply")re["facet.needs-reply"]="true";else if(U.filter==="unclassified")re["facet.category"]="unclassified"}t.history.push(oc(Uo(r,"unified-inbox:inbox"),re));return}case"publishing":t.history.push(Uo(r,"content-pipeline:publishing"));return;case"site":t.history.push(Uo(r,"site-builder:site"));return;case"inbox-open-entity":po(U.entityType,U.entityId);return;case"inbox-capture-note":El(U.title,U.summary,U.entityType,U.entityId);return;case"inbox-discuss-in-chat":Ml(U.sourceId,U.itemId,U.label)}},[El,r,Ml,po,l,t.history]),kr=le.useCallback((U)=>{t.history.push(ba(r,U)),window.scrollTo({top:0,left:0})},[r,t.history]),Cr=le.useCallback((U)=>{if(!b)return;t.history.push(`${ba(r,b)}${Sr({...It,offset:U})}`),window.scrollTo({top:0,left:0})},[b,It,r,t.history]),ms=le.useCallback((U)=>{t.history.push(U===U1?j1(r):Uo(r,U)),window.scrollTo({top:0,left:0})},[r,t.history]),mo=le.useCallback(()=>{if(!_n||Ke?.canCreate!==!0)return;R({type:"creationStarted",draft:Eh(_n.fields)}),at({kind:"idle"})},[Ke,_n]),ti=le.useCallback(()=>{if(!b)return;let U=`${ba(r,b)}${Sr(It)}`,re=t.history.location.state;if(typeof re==="object"&&re!==null&&"studioCollectionPath"in re&&re.studioCollectionPath===U&&t.history.canGoBack()){t.history.back();return}t.history.replace(U)},[r,b,It,t.history]),Dh=le.useCallback((U,re)=>{if(!b||L.kind!=="edit"||Ke?.canUpdate!==!0||Ke.canAssist!==!0||V.trim().length===0)return;at({kind:"loading",field:re,variant:U}),_t.requestFieldAssist({variant:U,entityType:b,id:L.entity.id,targetField:re}).then((Le)=>{let xe=Le.variant==="summarise"?Le.suggestion:Le.suggestions;at({kind:"suggested",field:Le.targetField,variant:Le.variant,suggestion:xe})}).catch((Le)=>{at({kind:"error",field:re,message:Ri(Le)})})},[Ke,V,b,L]),Wm=le.useCallback((U,re)=>{R({type:"fieldAssistApplied",field:U,suggestion:re}),at({kind:"idle"})},[]),ac=le.useCallback(()=>{if(!b||L.kind==="browse"||!_n)return;if(L.kind==="create"?Ke?.canCreate!==!0:Ke?.canUpdate!==!0)return;Rt.current=Date.now(),Nn(Hi?.git?.lastCommit??null),R({type:"saveStarted"});let U=_n.hasBody?{body:V}:{},re=iR(_n.fields,_),Le=L.kind==="create"?{kind:"create",entityType:b,frontmatter:re,...U}:{kind:"update",entityType:b,id:L.entity.id,frontmatter:re,baseContentHash:L.entity.contentHash,...U},xe=an.current;fo.mutate(Le,{onSuccess:async(Me)=>{if(await Promise.all([ut.invalidateQueries({queryKey:xl.entities(b)}),ut.invalidateQueries({queryKey:xl.syncStatus()}),...L.kind==="create"?[ut.invalidateQueries({queryKey:xl.navigation()})]:[]]),xe!==an.current)return;let Ve="skipped"in Me&&Me.skipped===!0;zt(Me.entityId,{kind:"saved",noop:Ve})},onError:(Me)=>{if(xe!==an.current)return;if(Me instanceof vr&&Me.issues.length>0)Q("details");R({type:"saveFailed",save:Me instanceof vr&&Me.status===409?{kind:"conflict",message:Ri(Me)}:{kind:"error",message:Me instanceof vr&&Me.issues.length>0?Me.message||"Validation failed":Ri(Me),...Me instanceof vr?{issues:Me.issues}:{}}})}})},[Ke,b,L,_,V,_n,zt,Hi,ut,fo]),Oh=le.useCallback(()=>{if(!b||L.kind!=="edit"||Tl||Ke?.canDelete!==!0)return;let{id:U}=L.entity;K.mutate({entityType:b,id:U},{onSuccess:async()=>{R({type:"deleteSucceeded"}),ut.removeQueries({queryKey:xl.entity(b,U)}),await Promise.all([ut.invalidateQueries({queryKey:xl.entities(b)}),ut.invalidateQueries({queryKey:xl.syncStatus()}),ut.invalidateQueries({queryKey:xl.navigation()})]),t.history.replace(ba(r,b),void 0,{ignoreBlocker:!0})},onError:(re)=>{R({type:"deleteFailed",message:Ri(re)})}})},[Ke,r,b,L,Tl,ut,K,t.history]),Ar=le.useCallback(async(U)=>{let re=Se.find((Ve)=>Ve.pluginId==="content-pipeline"&&Ve.entityTypes.includes(U.entityType));if(!re)throw Error("Publishing is unavailable");let Le={entityType:U.entityType,entityId:U.entityId,...U.type==="reorder"?{position:U.position}:{}};if(U.type==="publish"&&!U.confirmation){let Ve=await bt.mutateAsync({workspaceId:re.id,action:{actionId:"publish",label:"Publish now",input:Le,invocation:{mode:"prepare"}}});if(typeof Ve!=="object"||Ve===null||!("kind"in Ve)||Ve.kind!=="prepared-confirmation"||!("token"in Ve)||typeof Ve.token!=="string"||!("summary"in Ve)||typeof Ve.summary!=="string"||!("expiresAt"in Ve)||typeof Ve.expiresAt!=="string")throw Error("Publishing confirmation is unavailable");return{needsConfirmation:!0,summary:Ve.summary,args:{confirmed:!0,confirmationToken:Ve.token,contentHash:Ve.token,expiresAt:Ve.expiresAt}}}let xe=await bt.mutateAsync({workspaceId:re.id,action:{actionId:U.type,label:U.type,input:Le,...U.type==="publish"&&U.confirmation?{invocation:{mode:"execute",token:U.confirmation.confirmationToken}}:{}}});if(typeof xe!=="object"||xe===null)throw Error("Publishing returned an invalid result");let Me="success"in xe&&xe.success===!1?{success:!1,error:"error"in xe&&typeof xe.error==="string"?xe.error:"Publishing failed",..."code"in xe&&typeof xe.code==="string"?{code:xe.code}:{}}:{success:!0};if(!w1(Me)&&!x1(Me)){if(await $1(ut,re.id),L.kind==="edit"&&b===U.entityType&&L.entity.id===U.entityId)zt(U.entityId)}return Me},[b,L,zt,ut,bt,Se]),ni=le.useCallback(async(U)=>{if(!m)throw Error("Declarative workspace is unavailable");try{let re=await bt.mutateAsync({workspaceId:m,action:U});return await $1(ut,m),re}finally{bt.reset()}},[m,bt,ut]),Rh=le.useCallback((U,re,Le)=>{let xe=Se.find((Ve)=>Ve.id===U),Me=xe?.urlQuery===!0?l:void 0;if(xe?.urlQuery===!0&&Le!==void 0){let Ve=Uo(r,U);Me=B1(Le),H1(t.history,Ve,Le,window.location.pathname)}k((Ve)=>({...Ve,[U]:{query:re,...Me!==void 0?{urlSearch:Me}:{}}}))},[r,l,t.history,Se]),_i=rt??(Be.error?ic(Be.error):Ni.error?ic(Ni.error):null),rc=()=>{if(Ge(null),Be.error)Be.refetch();if(Ni.error)Ni.refetch();if(Cl.error)Cl.refetch();if(L.kind==="browse")qo((U)=>U+1)};if(_i&&!X)return wn.jsxDEV(nc,{message:_i,error:!0,onRetry:rc},void 0,!1,void 0,this);if(!X)return wn.jsxDEV(nc,{message:"Loading…"},void 0,!1,void 0,this);if(rn){let U=Uo(r,I1);return wn.jsxDEV(OO,{types:X,workspaces:Se,workspaceId:Ye.id,selectEntityType:kr,selectWorkspace:ms,children:wn.jsxDEV(le.Suspense,{fallback:wn.jsxDEV(Mt,{children:"Opening Account…"},void 0,!1,void 0,this),children:wn.jsxDEV(DH,{bootstrap:_H(U,r)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}if(jo)return wn.jsxDEV(wn.Fragment,{children:[wn.jsxDEV(le.Suspense,{fallback:wn.jsxDEV(nc,{message:"Opening Chat…"},void 0,!1,void 0,this),children:wn.jsxDEV(OH,{apiPath:Ye.chatApiPath,draftStore:be,onNavigationStateChange:Ne,studioBasePath:r,sessionId:RH(l),types:X,workspaces:Se,handoff:NO(s),navigate:(U,re)=>{t.history.push(U,void 0,{ignoreBlocker:re?.preserveWork===!0})},selectEntityType:kr,selectWorkspace:ms},void 0,!1,void 0,this)},void 0,!1,void 0,this),At.status==="blocked"&&wn.jsxDEV(Ki,{mark:"↩",title:"Leave this conversation?",titleId:"chat-navigation-title",cancelLabel:"Stay",confirmLabel:"Leave",onCancel:()=>At.reset(),onConfirm:()=>At.proceed(),children:wn.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(m?!Sa&&!Bi:b&&!_n&&!_i)return wn.jsxDEV(nc,{message:"Loading…"},void 0,!1,void 0,this);if(!m&&(!b||!_n&&!_i))return wn.jsxDEV(nc,{message:_i??"No readable collections are available for this account.",error:Boolean(_i),..._i?{onHome:()=>t.history.push(r)}:{}},void 0,!1,void 0,this);return wn.jsxDEV(RO,{activeWorkspaceId:m,types:X,workspaces:Se,workspaceError:Bi,readError:_i,onRetryRead:rc,declarativeWorkspaceData:ho,workspaceQuery:ro,entityType:b,entities:xr,entityOffset:Lt,entityLimit:It.limit,entityTotal:Vo??0,collectionQuery:It,onCollectionQueryChange:(U)=>{if(!b)return;t.history.push(`${ba(r,b)}${Sr({...U,offset:0})}`),window.scrollTo({top:0,left:0})},entityListLoading:Ni.isPending,schema:_n,editor:E,fieldAssistState:se,bodyMode:te,mobilePane:Jt,syncStatus:Hi,baselineCommit:so,agentTargets:wr,deleting:Tl,hasUnsavedChanges:ne,navigationBlocked:At.status==="blocked",dispatchEditor:R,setFieldAssistState:at,setBodyMode:je,setMobilePane:pe,backToList:ti,selectEntityType:kr,selectWorkspace:ms,changeEntityPage:Cr,openWorkspaceEntity:po,openWorkspaceLaunch:sc,performPublishingAction:Ar,performDeclarativeAction:ni,onWorkspaceQueryChange:Rh,startCreate:mo,openEntity:zt,runFieldAssist:Dh,applyFieldAssist:Wm,save:ac,remove:Oh,onNavigationReset:()=>At.reset?.(),onNavigationProceed:()=>At.proceed?.()},void 0,!1,void 0,this)}function uR(){return new rR({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}var Qm=We(sn(),1),Gm=document.querySelector("[data-studio-root]");if(Gm){let t=Gm.getAttribute("data-studio-base-path")??"/studio",i=new hR({basePath:t});Gm.textContent="";let l=uR(),s=pR(t,aR);mR.createRoot(Gm).render(Qm.jsxDEV(cR,{client:l,children:Qm.jsxDEV(dR,{api:i,children:Qm.jsxDEV(fR,{router:s},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))}
245
+ ${s}`:s}}function HO(t,i,l){return{studioChatHandoff:{version:1,sourceId:t,itemId:i,label:l,prompt:"Help me understand this Inbox item and decide what to do next."}}}function NO(t){if(typeof t!=="object"||t===null)return null;let i=Reflect.get(t,"studioChatHandoff");if(typeof i!=="object"||i===null)return null;let l=Reflect.get(i,"version"),s=Reflect.get(i,"sourceId"),r=Reflect.get(i,"itemId"),c=Reflect.get(i,"label"),h=Reflect.get(i,"prompt");if(l!==1||typeof s!=="string"||!/^[a-z][a-z0-9-]*$/.test(s)||s.length>64||typeof r!=="string"||r.trim().length===0||r.length>300||typeof c!=="string"||c.trim().length===0||c.length>160||typeof h!=="string"||h.trim().length===0||h.length>1e4)return null;return{sourceId:s,itemId:r,label:c,prompt:h}}function ic(t){if(t instanceof vr)switch(t.status){case 401:return"Your session is no longer authenticated. Sign in again in another tab, then retry here. Keep this tab open to preserve your draft.";case 403:return"You do not currently have permission to read this content. Ask an administrator to check access, then retry.";case 404:return"This content is unavailable. It may have moved, been removed, or be outside your access. Choose another destination or retry.";case 429:return"Studio is receiving too many requests. Wait briefly before retrying."}return`Studio could not load this data. Check your connection or retry later. ${Ri(t)}`}var _O=new Set(["offset","limit"]);function UO(t,i){if(t?.urlQuery!==!0)return{};let l={};for(let[s,r]of new URLSearchParams(i))if(!_O.has(s))l[s]=r;return l}function B1(t){let i=new URLSearchParams,l=Object.entries(t).filter(([r,c])=>!_O.has(r)&&c!==void 0&&(typeof c!=="number"||Number.isFinite(c))).sort(([r],[c])=>r.localeCompare(c));for(let[r,c]of l)i.set(r,String(c));let s=i.toString();return s?`?${s}`:""}function oc(t,i){return`${t}${B1(i)}`}function H1(t,i,l,s){if(s!==i)return;t.replace(oc(i,l))}function N1(t){let i=yr.safeParse(jO(new URLSearchParams(t))),l=i.success?i.data:yr.parse({});return{...l,offset:Math.floor(l.offset/l.limit)*l.limit}}function Sr(t){let i=new URLSearchParams;if(t.offset>0)i.set("offset",String(t.offset));if(t.limit!==qO)i.set("limit",String(t.limit));if(t.q)i.set("q",t.q);if(t.visibility!=="all")i.set("visibility",t.visibility);if(t.status)i.set("status",t.status);if(t.sort!=="updated-desc")i.set("sort",t.sort);let l=i.toString();return l?`?${l}`:""}var wn=We(sn(),1),DH=le.lazy(async()=>({default:(await import("./studio-chunks/account-view-4544h367.js")).AccountApp})),OH=le.lazy(async()=>({default:(await import("./studio-chunks/studio-chat-workspace-kpfmp85b.js")).StudioChatWorkspace}));function RH(t){let i=new URLSearchParams(t).get("session")?.trim();return i&&i.length<=256?i:null}function LH(){let t=window.history.state;return x2(t)?t:{}}var zH=[],BH=[],HH={},NH=["public","trusted","admin"];function _H(t,i){let l=document.querySelector("[data-studio-root]"),s=l?.getAttribute("data-studio-principal-name")??"Your account",r=l?.getAttribute("data-studio-principal-role"),c=NH.find((h)=>h===r)??"public";return{displayName:s,role:c,routePath:t,studioPath:i}}function aR(){let t=$O(),i=Xm({select:(U)=>U.location.pathname}),l=Xm({select:(U)=>U.location.searchStr}),s=Xm({select:(U)=>U.location.state}),r=oR(),c=le.useMemo(()=>i===_1?{kind:"workspace",workspaceId:U1}:QO(i,r),[i,r]),h=le.useMemo(()=>c.kind==="collection"&&new URLSearchParams(l).get("mode")==="create",[l,c]),d=i,[m,y]=le.useState(null),[b,S]=le.useState(null),[w,k]=le.useState({}),[E,R]=le.useReducer(T2,jf),{mode:L,draft:_,body:V,save:I}=E,ne=A2(E),[be]=le.useState(()=>new XO),st=le.useSyncExternalStore(be.subscribe,be.hasDrafts,be.hasDrafts),[Nt,Ne]=le.useState({hasDraft:!1,busy:!1}),At=PO({shouldBlockFn:({next:U})=>ne||i===_1&&YO({...Nt,hasDraft:st},U.pathname),enableBeforeUnload:ne||st||Nt.busy,withResolver:!0}),[se,at]=le.useState({kind:"idle"}),[te,je]=le.useState("preview"),[Jt,Q]=le.useState("details"),de=le.useRef(null),pe=le.useCallback((U)=>{de.current=U,Q(U)},[]),[rt,Ge]=le.useState(null),[zi,qo]=le.useState(0),[so,Nn]=le.useState(null),Rt=le.useRef(0),ao=le.useRef(null),an=le.useRef(0),va=le.useRef(b);va.current=b;let ut=IO(),_t=Zu(),Be=ya(KO(_t)),X=Be.data?.types??null,Kn=X?.find((U)=>U.entityType===b),Ke=Kn?.capabilities,It=le.useMemo(()=>Kn?.isSingleton?N1(""):N1(l),[Kn?.isSingleton,l]),Lt=It.offset,Se=Be.data?.workspaces??BH,Ye=Se.find((U)=>U.id===m),rn=Ye?.rendererName===WO,jo=Ye?.rendererName===q1,we=Ye?.rendererName==="DeclarativeOperatorWorkspace",kl=m?w[m]:void 0,ei=Ye?.urlQuery!==!0||kl?.urlSearch===l,un=le.useMemo(()=>UO(Ye,l),[Ye,l]),ro=m?kl&&ei?kl.query:un:HH,Cl=ya({...eR(_t,m??"",ro),enabled:we}),uo=Cl.data??null,Sa=uo?.data??null,Bi=Cl.error?ic(Cl.error):null,co=L.kind==="edit"?L.entity.id:null,wr=ya({...tR(_t,b??"",co??""),enabled:b!==null&&co!==null&&Ke?.canAssist===!0&&Ke.canUpdate}).data??zH,Hi=ya({...nR(_t),enabled:b!==null}).data??null,Ni=ya({...Y1(_t,b??"",It),enabled:b!==null}),xr=b?Ni.data?.entities??null:null,Vo=Ni.data?.total,Al=ya({...P1(_t,b??""),enabled:b!==null}),_n=b?Al.data??null:null;ya({...Mh(_t,b??"",co??""),enabled:b!==null&&co!==null});let fo=Ym({mutationFn:(U)=>ZO(_t,U)}),K=Ym({mutationFn:(U)=>JO(_t,U)}),bt=Ym({mutationFn:(U)=>FO(_t,U)}),Tl=K.isPending,ho=we&&uo?uo.data:null;le.useEffect(()=>{if(!b||!Kn||m||c.kind!=="collection"&&c.kind!=="entity"||c.entityType!==b)return;if(Vo===void 0)return;let U=Math.floor(Math.max(0,Vo-1)/It.limit)*It.limit;if(Lt>U)t.history.replace(`${i}${Sr({...It,offset:U})}`,t.history.location.state)},[Kn,m,Lt,Vo,It,b,i,c,t.history]),le.useEffect(()=>{if(!m||!ho?.refreshAfterMs)return;let U=window.setTimeout(()=>{ut.invalidateQueries({queryKey:xl.workspace(m)})},ho.refreshAfterMs);return()=>window.clearTimeout(U)},[m,ho,ut]),le.useEffect(()=>{if(Ye?.urlQuery!==!0||c.kind!=="workspace"||c.workspaceId!==Ye.id)return;let U=Uo(r,Ye.id);if(oc(U,un)!==`${U}${l}`)H1(t.history,U,un,window.location.pathname)},[Ye,r,un,l,c,t.history]),le.useEffect(()=>{if(!X)return;if(Ge(null),c.kind==="not-found"){an.current+=1,Ge(`Studio route not found: ${c.pathname}`);return}if(c.kind==="workspace"){let xe=Se.find((Me)=>Me.id===c.workspaceId);if(!xe){let Me=lR(r,c.workspaceId,l,Se);if(Me){t.history.replace(Me);return}an.current+=1,Ge(`Workspace unavailable for this account: ${c.workspaceId}`);return}y(xe.id),S(null);return}let U=c.kind==="collection"||c.kind==="entity"?c.entityType:void 0,re=X.find((xe)=>!xe.isSingleton)??X[0];if(c.kind==="home"){let xe=sR(r,X,Se);if(xe!==r){t.history.replace(xe);return}}let Le=U??re?.entityType??null;if(U!==void 0&&!X.some((xe)=>xe.entityType===U)){an.current+=1,Ge(`Collection unavailable for this account: ${U}`);return}y(null),S(Le)},[l,c,t.history,r,X,Se]),le.useEffect(()=>{if(I.kind!=="saved"||!Hi?.git)return;if(qm({save:I,git:Hi.git,baselineCommit:so}).committed==="done")return;if(Date.now()-Rt.current>20000)return;let re=window.setTimeout(()=>{ut.invalidateQueries({queryKey:xl.syncStatus()})},900);return()=>window.clearTimeout(re)},[I,Hi,so,ut]),le.useEffect(()=>{if(!b||c.kind==="workspace"||c.kind==="not-found")return;let U=c.kind==="entity"&&c.entityType===b?c.id:null,re=++an.current;R({type:"collectionChanged"}),Q("details"),at({kind:"idle"});let Le=!0,xe=()=>Le&&re===an.current;return ut.fetchQuery({...P1(_t,b),staleTime:0}).then(async(Me)=>{if(!Le||re!==an.current)return;let Ve=DO(Me,de.current);if(Q(Ve),window.matchMedia("(max-width: 640px)").matches&&Ve!=="details")je(Ve==="write"?"source":"preview");if(h&&U===null){if(X?.find((cn)=>cn.entityType===b)?.capabilities.canCreate!==!0){Ge(`Creating ${b} is not allowed.`);return}let Ol=zO(window.history.state,b,()=>window.history.replaceState(LO(LH()),"",window.location.href)),go=BO(Me.fields,Ol);R({type:"creationStarted",draft:go.draft,body:go.body});return}if(U!==null)return ut.fetchQuery({...Mh(_t,b,U),staleTime:0}).then((Dl)=>{if(!Le||re!==an.current)return;let Ol=tc(Dl),go=ao.current,cn=go?.pathname===d?go.save:{kind:"idle"};if(go?.pathname===d)ao.current=null;R({type:"documentOpened",document:Ol,save:cn})});if(Me.isSingleton){let Dl=await ut.ensureQueryData(Y1(_t,b));if(!xe())return;let Ol=Dl.entities[0];if(Ol)return ut.fetchQuery({...Mh(_t,b,Ol.id),staleTime:0}).then((go)=>{if(!Le||re!==an.current)return;let cn=tc(go);R({type:"documentOpened",document:cn})});R({type:"creationStarted",draft:Eh(Me.fields)})}return}).catch((Me)=>{if(Le&&re===an.current)Ge(ic(Me))}),()=>{Le=!1}},[h,d,b,zi,ut,i,c,X]);let zt=le.useCallback((U,re={kind:"idle"})=>{if(!b)return;let Le=V1(r,b,U);if(Le!==d){ao.current={pathname:Le,save:re},t.history.push(`${Le}${Sr(It)}`,{studioCollectionPath:`${ba(r,b)}${Sr(It)}`},re.kind==="saved"?{ignoreBlocker:!0}:void 0);return}let xe=++an.current,Me=b;ut.fetchQuery({...Mh(_t,b,U),staleTime:0}).then((Ve)=>{if(xe!==an.current||va.current!==Me)return;let Dl=tc(Ve);R({type:"documentOpened",document:Dl,save:re}),at({kind:"idle"})}).catch((Ve)=>{if(xe===an.current)Ge(ic(Ve))})},[r,d,b,It,ut,t.history]),po=le.useCallback((U,re)=>{let Le=V1(r,U,re);ao.current={pathname:Le,save:{kind:"idle"}},t.history.push(Le,{studioCollectionPath:ba(r,U)})},[r,t.history]),El=le.useCallback((U,re,Le,xe)=>{t.history.push(GO(r,"note"),C2(U,`entity://${encodeURIComponent(Le)}/${encodeURIComponent(xe)}`,re))},[r,t.history]),Ml=le.useCallback((U,re,Le)=>{if(Se.some((xe)=>xe.rendererName===q1)){t.history.push(j1(r),HO(U,re,Le));return}},[t.history,r,Se]),sc=le.useCallback((U)=>{switch(U.target){case"account-settings":{t.history.push(Uo(r,I1));return}case"invitations":t.history.push(oc(Uo(r,"admin:administration"),{tab:"invitations"}));return;case"admin-peer-invite":{t.history.push(oc(Uo(r,"admin:administration"),{tab:"invitations",peerId:U.peerId,displayName:U.displayName}));return}case"inbox":{let re={};if("source"in U){if(re.sourceId="mail-items",U.filter==="high-priority")re["facet.mail-priority"]="high";else if(U.filter==="needs-reply")re["facet.needs-reply"]="true";else if(U.filter==="unclassified")re["facet.category"]="unclassified"}t.history.push(oc(Uo(r,"unified-inbox:inbox"),re));return}case"publishing":t.history.push(Uo(r,"content-pipeline:publishing"));return;case"site":t.history.push(Uo(r,"site-builder:site"));return;case"inbox-open-entity":po(U.entityType,U.entityId);return;case"inbox-capture-note":El(U.title,U.summary,U.entityType,U.entityId);return;case"inbox-discuss-in-chat":Ml(U.sourceId,U.itemId,U.label)}},[El,r,Ml,po,l,t.history]),kr=le.useCallback((U)=>{t.history.push(ba(r,U)),window.scrollTo({top:0,left:0})},[r,t.history]),Cr=le.useCallback((U)=>{if(!b)return;t.history.push(`${ba(r,b)}${Sr({...It,offset:U})}`),window.scrollTo({top:0,left:0})},[b,It,r,t.history]),ms=le.useCallback((U)=>{t.history.push(U===U1?j1(r):Uo(r,U)),window.scrollTo({top:0,left:0})},[r,t.history]),mo=le.useCallback(()=>{if(!_n||Ke?.canCreate!==!0)return;R({type:"creationStarted",draft:Eh(_n.fields)}),at({kind:"idle"})},[Ke,_n]),ti=le.useCallback(()=>{if(!b)return;let U=`${ba(r,b)}${Sr(It)}`,re=t.history.location.state;if(typeof re==="object"&&re!==null&&"studioCollectionPath"in re&&re.studioCollectionPath===U&&t.history.canGoBack()){t.history.back();return}t.history.replace(U)},[r,b,It,t.history]),Dh=le.useCallback((U,re)=>{if(!b||L.kind!=="edit"||Ke?.canUpdate!==!0||Ke.canAssist!==!0||V.trim().length===0)return;at({kind:"loading",field:re,variant:U}),_t.requestFieldAssist({variant:U,entityType:b,id:L.entity.id,targetField:re}).then((Le)=>{let xe=Le.variant==="summarise"?Le.suggestion:Le.suggestions;at({kind:"suggested",field:Le.targetField,variant:Le.variant,suggestion:xe})}).catch((Le)=>{at({kind:"error",field:re,message:Ri(Le)})})},[Ke,V,b,L]),Wm=le.useCallback((U,re)=>{R({type:"fieldAssistApplied",field:U,suggestion:re}),at({kind:"idle"})},[]),ac=le.useCallback(()=>{if(!b||L.kind==="browse"||!_n)return;if(L.kind==="create"?Ke?.canCreate!==!0:Ke?.canUpdate!==!0)return;Rt.current=Date.now(),Nn(Hi?.git?.lastCommit??null),R({type:"saveStarted"});let U=_n.hasBody?{body:V}:{},re=iR(_n.fields,_),Le=L.kind==="create"?{kind:"create",entityType:b,frontmatter:re,...U}:{kind:"update",entityType:b,id:L.entity.id,frontmatter:re,baseContentHash:L.entity.contentHash,...U},xe=an.current;fo.mutate(Le,{onSuccess:async(Me)=>{if(await Promise.all([ut.invalidateQueries({queryKey:xl.entities(b)}),ut.invalidateQueries({queryKey:xl.syncStatus()}),...L.kind==="create"?[ut.invalidateQueries({queryKey:xl.navigation()})]:[]]),xe!==an.current)return;let Ve="skipped"in Me&&Me.skipped===!0;zt(Me.entityId,{kind:"saved",noop:Ve})},onError:(Me)=>{if(xe!==an.current)return;if(Me instanceof vr&&Me.issues.length>0)Q("details");R({type:"saveFailed",save:Me instanceof vr&&Me.status===409?{kind:"conflict",message:Ri(Me)}:{kind:"error",message:Me instanceof vr&&Me.issues.length>0?Me.message||"Validation failed":Ri(Me),...Me instanceof vr?{issues:Me.issues}:{}}})}})},[Ke,b,L,_,V,_n,zt,Hi,ut,fo]),Oh=le.useCallback(()=>{if(!b||L.kind!=="edit"||Tl||Ke?.canDelete!==!0)return;let{id:U}=L.entity;K.mutate({entityType:b,id:U},{onSuccess:async()=>{R({type:"deleteSucceeded"}),ut.removeQueries({queryKey:xl.entity(b,U)}),await Promise.all([ut.invalidateQueries({queryKey:xl.entities(b)}),ut.invalidateQueries({queryKey:xl.syncStatus()}),ut.invalidateQueries({queryKey:xl.navigation()})]),t.history.replace(ba(r,b),void 0,{ignoreBlocker:!0})},onError:(re)=>{R({type:"deleteFailed",message:Ri(re)})}})},[Ke,r,b,L,Tl,ut,K,t.history]),Ar=le.useCallback(async(U)=>{let re=Se.find((Ve)=>Ve.pluginId==="content-pipeline"&&Ve.entityTypes.includes(U.entityType));if(!re)throw Error("Publishing is unavailable");let Le={entityType:U.entityType,entityId:U.entityId,...U.type==="reorder"?{position:U.position}:{}};if(U.type==="publish"&&!U.confirmation){let Ve=await bt.mutateAsync({workspaceId:re.id,action:{actionId:"publish",label:"Publish now",input:Le,invocation:{mode:"prepare"}}});if(typeof Ve!=="object"||Ve===null||!("kind"in Ve)||Ve.kind!=="prepared-confirmation"||!("token"in Ve)||typeof Ve.token!=="string"||!("summary"in Ve)||typeof Ve.summary!=="string"||!("expiresAt"in Ve)||typeof Ve.expiresAt!=="string")throw Error("Publishing confirmation is unavailable");return{needsConfirmation:!0,summary:Ve.summary,args:{confirmed:!0,confirmationToken:Ve.token,contentHash:Ve.token,expiresAt:Ve.expiresAt}}}let xe=await bt.mutateAsync({workspaceId:re.id,action:{actionId:U.type,label:U.type,input:Le,...U.type==="publish"&&U.confirmation?{invocation:{mode:"execute",token:U.confirmation.confirmationToken}}:{}}});if(typeof xe!=="object"||xe===null)throw Error("Publishing returned an invalid result");let Me="success"in xe&&xe.success===!1?{success:!1,error:"error"in xe&&typeof xe.error==="string"?xe.error:"Publishing failed",..."code"in xe&&typeof xe.code==="string"?{code:xe.code}:{}}:{success:!0};if(!w1(Me)&&!x1(Me)){if(await $1(ut,re.id),L.kind==="edit"&&b===U.entityType&&L.entity.id===U.entityId)zt(U.entityId)}return Me},[b,L,zt,ut,bt,Se]),ni=le.useCallback(async(U)=>{if(!m)throw Error("Declarative workspace is unavailable");try{let re=await bt.mutateAsync({workspaceId:m,action:U});return await $1(ut,m),re}finally{bt.reset()}},[m,bt,ut]),Rh=le.useCallback((U,re,Le)=>{let xe=Se.find((Ve)=>Ve.id===U),Me=xe?.urlQuery===!0?l:void 0;if(xe?.urlQuery===!0&&Le!==void 0){let Ve=Uo(r,U);Me=B1(Le),H1(t.history,Ve,Le,window.location.pathname)}k((Ve)=>({...Ve,[U]:{query:re,...Me!==void 0?{urlSearch:Me}:{}}}))},[r,l,t.history,Se]),_i=rt??(Be.error?ic(Be.error):Ni.error?ic(Ni.error):null),rc=()=>{if(Ge(null),Be.error)Be.refetch();if(Ni.error)Ni.refetch();if(Cl.error)Cl.refetch();if(L.kind==="browse")qo((U)=>U+1)};if(_i&&!X)return wn.jsxDEV(nc,{message:_i,error:!0,onRetry:rc},void 0,!1,void 0,this);if(!X)return wn.jsxDEV(nc,{message:"Loading…"},void 0,!1,void 0,this);if(rn){let U=Uo(r,I1);return wn.jsxDEV(OO,{types:X,workspaces:Se,workspaceId:Ye.id,selectEntityType:kr,selectWorkspace:ms,children:wn.jsxDEV(le.Suspense,{fallback:wn.jsxDEV(Mt,{children:"Opening Account…"},void 0,!1,void 0,this),children:wn.jsxDEV(DH,{bootstrap:_H(U,r)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}if(jo)return wn.jsxDEV(wn.Fragment,{children:[wn.jsxDEV(le.Suspense,{fallback:wn.jsxDEV(nc,{message:"Opening Chat…"},void 0,!1,void 0,this),children:wn.jsxDEV(OH,{apiPath:Ye.chatApiPath,draftStore:be,onNavigationStateChange:Ne,studioBasePath:r,sessionId:RH(l),types:X,workspaces:Se,handoff:NO(s),navigate:(U,re)=>{t.history.push(U,void 0,{ignoreBlocker:re?.preserveWork===!0})},selectEntityType:kr,selectWorkspace:ms},void 0,!1,void 0,this)},void 0,!1,void 0,this),At.status==="blocked"&&wn.jsxDEV(Ki,{mark:"↩",title:"Leave this conversation?",titleId:"chat-navigation-title",cancelLabel:"Stay",confirmLabel:"Leave",onCancel:()=>At.reset(),onConfirm:()=>At.proceed(),children:wn.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(m?!Sa&&!Bi:b&&!_n&&!_i)return wn.jsxDEV(nc,{message:"Loading…"},void 0,!1,void 0,this);if(!m&&(!b||!_n&&!_i))return wn.jsxDEV(nc,{message:_i??"No readable collections are available for this account.",error:Boolean(_i),..._i?{onHome:()=>t.history.push(r)}:{}},void 0,!1,void 0,this);return wn.jsxDEV(RO,{activeWorkspaceId:m,types:X,workspaces:Se,workspaceError:Bi,readError:_i,onRetryRead:rc,declarativeWorkspaceData:ho,workspaceQuery:ro,entityType:b,entities:xr,entityOffset:Lt,entityLimit:It.limit,entityTotal:Vo??0,collectionQuery:It,onCollectionQueryChange:(U)=>{if(!b)return;t.history.push(`${ba(r,b)}${Sr({...U,offset:0})}`),window.scrollTo({top:0,left:0})},entityListLoading:Ni.isPending,schema:_n,editor:E,fieldAssistState:se,bodyMode:te,mobilePane:Jt,syncStatus:Hi,baselineCommit:so,agentTargets:wr,deleting:Tl,hasUnsavedChanges:ne,navigationBlocked:At.status==="blocked",dispatchEditor:R,setFieldAssistState:at,setBodyMode:je,setMobilePane:pe,backToList:ti,selectEntityType:kr,selectWorkspace:ms,changeEntityPage:Cr,openWorkspaceEntity:po,openWorkspaceLaunch:sc,performPublishingAction:Ar,performDeclarativeAction:ni,onWorkspaceQueryChange:Rh,startCreate:mo,openEntity:zt,runFieldAssist:Dh,applyFieldAssist:Wm,save:ac,remove:Oh,onNavigationReset:()=>At.reset?.(),onNavigationProceed:()=>At.proceed?.()},void 0,!1,void 0,this)}function uR(){return new rR({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}var Qm=We(sn(),1),Gm=document.querySelector("[data-studio-root]");if(Gm){let t=Gm.getAttribute("data-studio-base-path")??"/studio",i=new hR({basePath:t});Gm.textContent="";let l=uR(),s=pR(t,aR);mR.createRoot(Gm).render(Qm.jsxDEV(cR,{client:l,children:Qm.jsxDEV(dR,{api:i,children:Qm.jsxDEV(fR,{router:s},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))}
246
246
 
247
247
  //# debugId=37C0D182364C1B9064756E2164756E21
@@ -12,15 +12,15 @@
12
12
  "studio-chunks/main-1gqf08r8.js.map": "studio-chunks/main-1gqf08r8.js.map",
13
13
  "studio-chunks/main-b34wmcw1.js": "studio-chunks/main-b34wmcw1.js",
14
14
  "studio-chunks/main-b34wmcw1.js.map": "studio-chunks/main-b34wmcw1.js.map",
15
- "studio-chunks/main-ew6ym140.js": "studio-chunks/main-ew6ym140.js",
16
- "studio-chunks/main-ew6ym140.js.map": "studio-chunks/main-ew6ym140.js.map",
15
+ "studio-chunks/main-ptks77cs.js": "studio-chunks/main-ptks77cs.js",
16
+ "studio-chunks/main-ptks77cs.js.map": "studio-chunks/main-ptks77cs.js.map",
17
17
  "studio-chunks/main-rjhqdb2v.js": "studio-chunks/main-rjhqdb2v.js",
18
18
  "studio-chunks/main-rjhqdb2v.js.map": "studio-chunks/main-rjhqdb2v.js.map",
19
19
  "studio-chunks/main-vzjqx8f9.js": "studio-chunks/main-vzjqx8f9.js",
20
20
  "studio-chunks/main-vzjqx8f9.js.map": "studio-chunks/main-vzjqx8f9.js.map",
21
21
  "studio-chunks/mermaid-GHXKKRXX-ftrk50mv.js": "studio-chunks/mermaid-GHXKKRXX-ftrk50mv.js",
22
22
  "studio-chunks/mermaid-GHXKKRXX-ftrk50mv.js.map": "studio-chunks/mermaid-GHXKKRXX-ftrk50mv.js.map",
23
- "studio-chunks/studio-chat-workspace-g2rp0g08.js": "studio-chunks/studio-chat-workspace-g2rp0g08.js",
24
- "studio-chunks/studio-chat-workspace-g2rp0g08.js.map": "studio-chunks/studio-chat-workspace-g2rp0g08.js.map"
23
+ "studio-chunks/studio-chat-workspace-kpfmp85b.js": "studio-chunks/studio-chat-workspace-kpfmp85b.js",
24
+ "studio-chunks/studio-chat-workspace-kpfmp85b.js.map": "studio-chunks/studio-chat-workspace-kpfmp85b.js.map"
25
25
  }
26
26
  }