@rizom/brain 0.2.0-alpha.354 → 0.2.0-alpha.355

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.
Files changed (37) hide show
  1. package/dist/brain.js +37 -37
  2. package/dist/chunks/{app-m9hjd2pg.js → app-c5pdekt0.js} +2 -2
  3. package/dist/chunks/{blog-post-adapter-bqm9vrja.js → blog-post-adapter-njnq5kyv.js} +2 -2
  4. package/dist/chunks/{index-dqe1320c.js → index-6ckkrggy.js} +3 -3
  5. package/dist/chunks/{index-dqe1320c.js.map → index-6ckkrggy.js.map} +1 -1
  6. package/dist/chunks/{index-4x71s1h0.js → index-bjmmrp5q.js} +3 -3
  7. package/dist/chunks/{index-4x71s1h0.js.map → index-bjmmrp5q.js.map} +3 -3
  8. package/dist/chunks/{index-qpztpfw8.js → index-e2scq3d5.js} +2 -2
  9. package/dist/chunks/{index-d6q3sk2w.js → index-p49nmsdm.js} +2 -2
  10. package/dist/chunks/{index-d6q3sk2w.js.map → index-p49nmsdm.js.map} +2 -2
  11. package/dist/chunks/{index-6m5e8k9d.js → index-v3xvnwsn.js} +2 -2
  12. package/dist/chunks/{index-4mr9k51y.js → index-w5e9n75h.js} +3 -3
  13. package/dist/chunks/{index-4mr9k51y.js.map → index-w5e9n75h.js.map} +3 -3
  14. package/dist/chunks/{linkedin-template-d4av3dpq.js → linkedin-template-2yn0zvz4.js} +2 -2
  15. package/dist/chunks/{rss-datasource-5vhyhygh.js → rss-datasource-6drt6y87.js} +2 -2
  16. package/dist/entities.js +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/interfaces.js +1 -1
  19. package/dist/model.js +38 -38
  20. package/dist/model.js.map +13 -13
  21. package/dist/plugins.js +1 -1
  22. package/dist/services.js +1 -1
  23. package/dist/ui/studio-app.js +3 -3
  24. package/dist/ui/studio-app.js.map +3 -3
  25. package/dist/ui/studio-asset-manifest.json +4 -4
  26. package/dist/ui/studio-chunks/{main-x38k1kej.js → main-8g7rwpye.js} +5 -9
  27. package/dist/ui/studio-chunks/{main-x38k1kej.js.map → main-8g7rwpye.js.map} +3 -3
  28. package/dist/ui/studio-chunks/{studio-chat-workspace-a7km8rss.js → studio-chat-workspace-z9973dz1.js} +1 -1
  29. package/package.json +1 -1
  30. package/templates/deploy/scripts/create-predeploy-backup.ts +11 -1
  31. /package/dist/chunks/{app-m9hjd2pg.js.map → app-c5pdekt0.js.map} +0 -0
  32. /package/dist/chunks/{blog-post-adapter-bqm9vrja.js.map → blog-post-adapter-njnq5kyv.js.map} +0 -0
  33. /package/dist/chunks/{index-qpztpfw8.js.map → index-e2scq3d5.js.map} +0 -0
  34. /package/dist/chunks/{index-6m5e8k9d.js.map → index-v3xvnwsn.js.map} +0 -0
  35. /package/dist/chunks/{linkedin-template-d4av3dpq.js.map → linkedin-template-2yn0zvz4.js.map} +0 -0
  36. /package/dist/chunks/{rss-datasource-5vhyhygh.js.map → rss-datasource-6drt6y87.js.map} +0 -0
  37. /package/dist/ui/studio-chunks/{studio-chat-workspace-a7km8rss.js.map → studio-chat-workspace-z9973dz1.js.map} +0 -0
package/dist/plugins.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Re as p,Se as m,Te as c,Ue as l,Ve as g,We as u,Ye as h,Ze as R,pc as t,qc as o,rc as s,sc as r,tc as i}from"./chunks/index-4mr9k51y.js";import"./chunks/index-tn0cdbvz.js";import"./chunks/index-1zp6cenk.js";import{_g as e,ch as n,dh as a}from"./chunks/index-jmww3sdn.js";import"./chunks/index-a7613zm4.js";import"./chunks/index-1g11e6qn.js";export{a as AgentResponseSchema,i as AnchorProfileSchema,m as AppInfoSchema,R as BaseMessageSchema,r as BrainCharacterSchema,p as ChatContextSchema,o as ConversationSchema,t as ExtensionMetadataSchema,h as MessageResponseSchema,s as MessageSchema,e as PendingConfirmationSchema,c as RuntimeHealthCheckSchema,l as RuntimeQueueSignalsSchema,u as RuntimeReadinessSchema,g as RuntimeResourceSignalsSchema,n as ToolResultDataSchema};
2
+ import{Re as p,Se as m,Te as c,Ue as l,Ve as g,We as u,Ye as h,Ze as R,pc as t,qc as o,rc as s,sc as r,tc as i}from"./chunks/index-w5e9n75h.js";import"./chunks/index-tn0cdbvz.js";import"./chunks/index-1zp6cenk.js";import{_g as e,ch as n,dh as a}from"./chunks/index-jmww3sdn.js";import"./chunks/index-a7613zm4.js";import"./chunks/index-1g11e6qn.js";export{a as AgentResponseSchema,i as AnchorProfileSchema,m as AppInfoSchema,R as BaseMessageSchema,r as BrainCharacterSchema,p as ChatContextSchema,o as ConversationSchema,t as ExtensionMetadataSchema,h as MessageResponseSchema,s as MessageSchema,e as PendingConfirmationSchema,c as RuntimeHealthCheckSchema,l as RuntimeQueueSignalsSchema,u as RuntimeReadinessSchema,g as RuntimeResourceSignalsSchema,n as ToolResultDataSchema};
3
3
 
4
4
  //# debugId=6990315A5C8F55C064756E2164756E21
5
5
  //# sourceMappingURL=plugins.js.map
package/dist/services.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{be as i,ce as o,me as t,qe as r,re as n,se as a,te as c,ue as p}from"./chunks/index-4mr9k51y.js";import"./chunks/index-tn0cdbvz.js";import"./chunks/index-1zp6cenk.js";import"./chunks/index-jmww3sdn.js";import{kj as e}from"./chunks/index-a7613zm4.js";import"./chunks/index-1g11e6qn.js";export{a as defineAccountSettings,i as defineDashboardWidget,c as defineEntityCatalog,r as defineJob,p as defineServicePlugin,o as defineStudioWorkspace,n as defineTool,t as defineWorkspaceAction,e as z};
2
+ import{be as i,ce as o,me as t,qe as r,re as n,se as a,te as c,ue as p}from"./chunks/index-w5e9n75h.js";import"./chunks/index-tn0cdbvz.js";import"./chunks/index-1zp6cenk.js";import"./chunks/index-jmww3sdn.js";import{kj as e}from"./chunks/index-a7613zm4.js";import"./chunks/index-1g11e6qn.js";export{a as defineAccountSettings,i as defineDashboardWidget,c as defineEntityCatalog,r as defineJob,p as defineServicePlugin,o as defineStudioWorkspace,n as defineTool,t as defineWorkspaceAction,e as z};
3
3
 
4
4
  //# debugId=60B406971E41EA4564756E2164756E21
5
5
  //# sourceMappingURL=services.js.map
@@ -1,4 +1,4 @@
1
- import{a as h1,b as Wm,c as oE}from"./studio-chunks/main-vrdekcfb.js";import{$ as Fm,A as tE,B as vh,C as f1,D as Un,E as TE,F as CE,G as AE,H as lr,I as RE,J as PE,K as S1,L as EE,M as ME,N as x1,O as w1,P as wh,Q as nE,R as iE,S as zE,T as d1,U as aE,V as lE,W as Im,X as DE,Y as XE,Z as ZE,_ as UE,aa as Jm,ba as eO,d as LE,e as bE,f as YE,g as ar,h as nO,i as vE,j as qE,k as SE,l as iO,m as Ic,n as O1,o as xE,p as ya,q as wE,r as g1,s as kE,t as QE,u as y1,v as b1,w as v1,x as Hm,y as Nm,z as Sh}from"./studio-chunks/main-x38k1kej.js";import{fa as jm}from"./studio-chunks/main-mv52cpdf.js";import{Ca as $E,Da as BE,Ea as VE,Fa as Vm,Ha as Km,ha as Jr,ja as Cn,ka as IP,la as ln,ma as jp,na as Yp,qa as qo,ra as ST,sa as Ym,ta as qm,ua as Bm,va as xT,wa as FP,xa as JP,ya as KP,za as eE}from"./studio-chunks/main-rjtgxw09.js";import{Ia as wt,Ja as _y,La as yE,Ma as yc,Oa as TD}from"./studio-chunks/main-cv5ngmvq.js";var lT=_y(function($D){(function(){function e(){if(le=!1,ce){var V=$D.unstable_now();fe=V;var me=!0;try{e:{Y=!1,U&&(U=!1,se(ae),ae=-1),Z=!0;var he=E;try{t:{c(V);for(P=a(v);P!==null&&!(P.expirationTime>V&&d());){var Ae=P.callback;if(typeof Ae==="function"){P.callback=null,E=P.priorityLevel;var Ue=Ae(P.expirationTime<=V);if(V=$D.unstable_now(),typeof Ue==="function"){P.callback=Ue,c(V),me=!0;break t}P===a(v)&&o(v),c(V)}else o(v);P=a(v)}if(P!==null)me=!0;else{var Ge=a(w);Ge!==null&&p(u,Ge.startTime-V),me=!1}}break e}finally{P=null,E=he,Z=!1}me=void 0}}finally{me?ne():ce=!1}}}function i(V,me){var he=V.length;V.push(me);e:for(;0<he;){var Ae=he-1>>>1,Ue=V[Ae];if(0<r(Ue,me))V[Ae]=me,V[he]=Ue,he=Ae;else break e}}function a(V){return V.length===0?null:V[0]}function o(V){if(V.length===0)return null;var me=V[0],he=V.pop();if(he!==me){V[0]=he;e:for(var Ae=0,Ue=V.length,Ge=Ue>>>1;Ae<Ge;){var He=2*(Ae+1)-1,$t=V[He],Ye=He+1,Se=V[Ye];if(0>r($t,he))Ye<Ue&&0>r(Se,$t)?(V[Ae]=Se,V[Ye]=he,Ae=Ye):(V[Ae]=$t,V[He]=he,Ae=He);else if(Ye<Ue&&0>r(Se,he))V[Ae]=Se,V[Ye]=he,Ae=Ye;else break e}}return me}function r(V,me){var he=V.sortIndex-me.sortIndex;return he!==0?he:V.id-me.id}function c(V){for(var me=a(w);me!==null;){if(me.callback===null)o(w);else if(me.startTime<=V)o(w),me.sortIndex=me.expirationTime,i(v,me);else break;me=a(w)}}function u(V){if(U=!1,c(V),!Y)if(a(v)!==null)Y=!0,ce||(ce=!0,ne());else{var me=a(w);me!==null&&p(u,me.startTime-V)}}function d(){return le?!0:$D.unstable_now()-fe<I?!1:!0}function p(V,me){ae=ee(function(){V($D.unstable_now())},me)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),$D.unstable_now=void 0,typeof performance==="object"&&typeof performance.now==="function"){var O=performance;$D.unstable_now=function(){return O.now()}}else{var g=Date,b=g.now();$D.unstable_now=function(){return g.now()-b}}var v=[],w=[],k=1,P=null,E=3,Z=!1,Y=!1,U=!1,le=!1,ee=typeof setTimeout==="function"?setTimeout:null,se=typeof clearTimeout==="function"?clearTimeout:null,W=typeof setImmediate<"u"?setImmediate:null,ce=!1,ae=-1,I=5,fe=-1;if(typeof W==="function")var ne=function(){W(e)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,Xe=re.port2;re.port1.onmessage=e,ne=function(){Xe.postMessage(null)}}else ne=function(){ee(e,0)};$D.unstable_IdlePriority=5,$D.unstable_ImmediatePriority=1,$D.unstable_LowPriority=4,$D.unstable_NormalPriority=3,$D.unstable_Profiling=null,$D.unstable_UserBlockingPriority=2,$D.unstable_cancelCallback=function(V){V.callback=null},$D.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<V?Math.floor(1000/V):5},$D.unstable_getCurrentPriorityLevel=function(){return E},$D.unstable_next=function(V){switch(E){case 1:case 2:case 3:var me=3;break;default:me=E}var he=E;E=me;try{return V()}finally{E=he}},$D.unstable_requestPaint=function(){le=!0},$D.unstable_runWithPriority=function(V,me){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var he=E;E=V;try{return me()}finally{E=he}},$D.unstable_scheduleCallback=function(V,me,he){var Ae=$D.unstable_now();switch(typeof he==="object"&&he!==null?(he=he.delay,he=typeof he==="number"&&0<he?Ae+he:Ae):he=Ae,V){case 1:var Ue=-1;break;case 2:Ue=250;break;case 5:Ue=1073741823;break;case 4:Ue=1e4;break;default:Ue=5000}return Ue=he+Ue,V={id:k++,callback:me,priorityLevel:V,startTime:he,expirationTime:Ue,sortIndex:-1},he>Ae?(V.sortIndex=he,i(w,V),a(v)===null&&V===a(w)&&(U?(se(ae),ae=-1):U=!0,p(u,he-Ae))):(V.sortIndex=Ue,i(v,V),Y||Z||(Y=!0,ce||(ce=!0,ne()))),V},$D.unstable_shouldYield=d,$D.unstable_wrapCallback=function(V){var me=E;return function(){var he=E;E=me;try{return V.apply(this,arguments)}finally{E=he}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var oT=_y(function(CD){var Je=wt(lT()),bc=wt(yc()),Ly=wt(TD());(function(){function e(t,n){for(t=t.memoizedState;t!==null&&0<n;)t=t.next,n--;return t}function i(t,n,l,s){if(l>=n.length)return s;var f=n[l],h=tn(t)?t.slice():_e({},t);return h[f]=i(t[f],n,l+1,s),h}function a(t,n,l){if(n.length!==l.length)console.warn("copyWithRename() expects paths of the same length");else{for(var s=0;s<l.length-1;s++)if(n[s]!==l[s]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return o(t,n,l,0)}}function o(t,n,l,s){var f=n[s],h=tn(t)?t.slice():_e({},t);return s+1===n.length?(h[l[s]]=h[f],tn(h)?h.splice(f,1):delete h[f]):h[f]=o(t[f],n,l,s+1),h}function r(t,n,l){var s=n[l],f=tn(t)?t.slice():_e({},t);if(l+1===n.length)return tn(f)?f.splice(s,1):delete f[s],f;return f[s]=r(t[s],n,l+1),f}function c(){return!1}function u(){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 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 O(){}function g(){}function b(t){var n=[];return t.forEach(function(l){n.push(l)}),n.sort().join(", ")}function v(t,n,l,s){return new mM(t,n,l,s)}function w(t,n){t.context===bo&&(a0(t.current,2,n,t,null,null),As())}function k(t,n){if(Pi!==null){var l=n.staleFamilies;n=n.updatedFamilies,Qu(),fS(t.current,n,l),As()}}function P(t){Pi=t}function E(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Z(t){var n=t,l=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(l=n.return),t=n.return;while(t)}return n.tag===3?l:null}function Y(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 U(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 le(t){if(Z(t)!==t)throw Error("Unable to find node on an unmounted component.")}function ee(t){var n=t.alternate;if(!n){if(n=Z(t),n===null)throw Error("Unable to find node on an unmounted component.");return n!==t?null:t}for(var l=t,s=n;;){var f=l.return;if(f===null)break;var h=f.alternate;if(h===null){if(s=f.return,s!==null){l=s;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===l)return le(f),t;if(h===s)return le(f),n;h=h.sibling}throw Error("Unable to find node on an unmounted component.")}if(l.return!==s.return)l=f,s=h;else{for(var m=!1,y=f.child;y;){if(y===l){m=!0,l=f,s=h;break}if(y===s){m=!0,s=f,l=h;break}y=y.sibling}if(!m){for(y=h.child;y;){if(y===l){m=!0,l=h,s=f;break}if(y===s){m=!0,s=h,l=f;break}y=y.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(l.alternate!==s)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(l.tag!==3)throw Error("Unable to find node on an unmounted component.");return l.stateNode.current===l?t:n}function se(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=se(t),n!==null)return n;t=t.sibling}return null}function W(t){if(t===null||typeof t!=="object")return null;return t=yk&&t[yk]||t["@@iterator"],typeof t==="function"?t:null}function ce(t){if(t==null)return null;if(typeof t==="function")return t.$$typeof===X5?null:t.displayName||t.name||null;if(typeof t==="string")return t;switch(t){case Xs:return"Fragment";case u0:return"Profiler";case Rd:return"StrictMode";case h0:return"Suspense";case d0:return"SuspenseList";case p0: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 Ds:return"Portal";case La:return t.displayName||"Context";case f0:return(t._context.displayName||"Context")+".Consumer";case Du:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Pd:return n=t.displayName||null,n!==null?n:ce(t.type)||"Memo";case pi:n=t._payload,t=t._init;try{return ce(t(n))}catch(l){}}return null}function ae(t){return typeof t.tag==="number"?I(t):typeof t.name==="string"?t.name:null}function I(t){var n=t.type;switch(t.tag){case 31:return"Activity";case 24:return"Cache";case 9:return(n._context.displayName||"Context")+".Consumer";case 10:return n.displayName||"Context";case 18:return"DehydratedFragment";case 11:return t=n.render,t=t.displayName||t.name||"",n.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 26:case 27:case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ce(n);case 8:return n===Rd?"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 l=n.length-1;0<=l;l--)if(typeof n[l].name==="string")return n[l].name}if(t.return!==null)return I(t.return)}return null}function fe(t){return{current:t}}function ne(t,n){0>Ol?console.error("Unexpected pop."):(n!==O0[Ol]&&console.error("Unexpected Fiber popped."),t.current=m0[Ol],m0[Ol]=null,O0[Ol]=null,Ol--)}function re(t,n,l){Ol++,m0[Ol]=t.current,O0[Ol]=l,t.current=n}function Xe(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 V(t,n){re(ho,n,t),re(Xu,t,t),re(fo,null,t);var l=n.nodeType;switch(l){case 9:case 11:l=l===9?"#document":"#fragment",n=(n=n.documentElement)?(n=n.namespaceURI)?qw(n):Rl:Rl;break;default:if(l=n.tagName,n=n.namespaceURI)n=qw(n),n=Bw(n,l);else switch(l){case"svg":n=Oc;break;case"math":n=Ap;break;default:n=Rl}}l=l.toLowerCase(),l=X1(null,l),l={context:n,ancestorInfo:l},ne(fo,t),re(fo,l,t)}function me(t){ne(fo,t),ne(Xu,t),ne(ho,t)}function he(){return Xe(fo.current)}function Ae(t){t.memoizedState!==null&&re(Ed,t,t);var n=Xe(fo.current),l=t.type,s=Bw(n.context,l);l=X1(n.ancestorInfo,l),s={context:s,ancestorInfo:l},n!==s&&(re(Xu,t,t),re(fo,s,t))}function Ue(t){Xu.current===t&&(ne(fo,t),ne(Xu,t)),Ed.current===t&&(ne(Ed,t),Cf._currentValue=Ir)}function Ge(){}function He(){if(Zu===0){bk=console.log,vk=console.info,Sk=console.warn,xk=console.error,wk=console.group,kk=console.groupCollapsed,Qk=console.groupEnd;var t={configurable:!0,enumerable:!0,value:Ge,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}Zu++}function $t(){if(Zu--,Zu===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:_e({},t,{value:bk}),info:_e({},t,{value:vk}),warn:_e({},t,{value:Sk}),error:_e({},t,{value:xk}),group:_e({},t,{value:wk}),groupCollapsed:_e({},t,{value:kk}),groupEnd:_e({},t,{value:Qk})})}0>Zu&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function Ye(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 h1,b as Wm,c as oE}from"./studio-chunks/main-vrdekcfb.js";import{$ as Fm,A as tE,B as vh,C as f1,D as Un,E as TE,F as CE,G as AE,H as lr,I as RE,J as PE,K as S1,L as EE,M as ME,N as x1,O as w1,P as wh,Q as nE,R as iE,S as zE,T as d1,U as aE,V as lE,W as Im,X as DE,Y as XE,Z as ZE,_ as UE,aa as Jm,ba as eO,d as LE,e as bE,f as YE,g as ar,h as nO,i as vE,j as qE,k as SE,l as iO,m as Ic,n as O1,o as xE,p as ya,q as wE,r as g1,s as kE,t as QE,u as y1,v as b1,w as v1,x as Hm,y as Nm,z as Sh}from"./studio-chunks/main-8g7rwpye.js";import{fa as jm}from"./studio-chunks/main-mv52cpdf.js";import{Ca as $E,Da as BE,Ea as VE,Fa as Vm,Ha as Km,ha as Jr,ja as Cn,ka as IP,la as ln,ma as jp,na as Yp,qa as qo,ra as ST,sa as Ym,ta as qm,ua as Bm,va as xT,wa as FP,xa as JP,ya as KP,za as eE}from"./studio-chunks/main-rjtgxw09.js";import{Ia as wt,Ja as _y,La as yE,Ma as yc,Oa as TD}from"./studio-chunks/main-cv5ngmvq.js";var lT=_y(function($D){(function(){function e(){if(le=!1,ce){var V=$D.unstable_now();fe=V;var me=!0;try{e:{Y=!1,U&&(U=!1,se(ae),ae=-1),Z=!0;var he=E;try{t:{c(V);for(P=a(v);P!==null&&!(P.expirationTime>V&&d());){var Ae=P.callback;if(typeof Ae==="function"){P.callback=null,E=P.priorityLevel;var Ue=Ae(P.expirationTime<=V);if(V=$D.unstable_now(),typeof Ue==="function"){P.callback=Ue,c(V),me=!0;break t}P===a(v)&&o(v),c(V)}else o(v);P=a(v)}if(P!==null)me=!0;else{var Ge=a(w);Ge!==null&&p(u,Ge.startTime-V),me=!1}}break e}finally{P=null,E=he,Z=!1}me=void 0}}finally{me?ne():ce=!1}}}function i(V,me){var he=V.length;V.push(me);e:for(;0<he;){var Ae=he-1>>>1,Ue=V[Ae];if(0<r(Ue,me))V[Ae]=me,V[he]=Ue,he=Ae;else break e}}function a(V){return V.length===0?null:V[0]}function o(V){if(V.length===0)return null;var me=V[0],he=V.pop();if(he!==me){V[0]=he;e:for(var Ae=0,Ue=V.length,Ge=Ue>>>1;Ae<Ge;){var He=2*(Ae+1)-1,$t=V[He],Ye=He+1,Se=V[Ye];if(0>r($t,he))Ye<Ue&&0>r(Se,$t)?(V[Ae]=Se,V[Ye]=he,Ae=Ye):(V[Ae]=$t,V[He]=he,Ae=He);else if(Ye<Ue&&0>r(Se,he))V[Ae]=Se,V[Ye]=he,Ae=Ye;else break e}}return me}function r(V,me){var he=V.sortIndex-me.sortIndex;return he!==0?he:V.id-me.id}function c(V){for(var me=a(w);me!==null;){if(me.callback===null)o(w);else if(me.startTime<=V)o(w),me.sortIndex=me.expirationTime,i(v,me);else break;me=a(w)}}function u(V){if(U=!1,c(V),!Y)if(a(v)!==null)Y=!0,ce||(ce=!0,ne());else{var me=a(w);me!==null&&p(u,me.startTime-V)}}function d(){return le?!0:$D.unstable_now()-fe<I?!1:!0}function p(V,me){ae=ee(function(){V($D.unstable_now())},me)}if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()),$D.unstable_now=void 0,typeof performance==="object"&&typeof performance.now==="function"){var O=performance;$D.unstable_now=function(){return O.now()}}else{var g=Date,b=g.now();$D.unstable_now=function(){return g.now()-b}}var v=[],w=[],k=1,P=null,E=3,Z=!1,Y=!1,U=!1,le=!1,ee=typeof setTimeout==="function"?setTimeout:null,se=typeof clearTimeout==="function"?clearTimeout:null,W=typeof setImmediate<"u"?setImmediate:null,ce=!1,ae=-1,I=5,fe=-1;if(typeof W==="function")var ne=function(){W(e)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,Xe=re.port2;re.port1.onmessage=e,ne=function(){Xe.postMessage(null)}}else ne=function(){ee(e,0)};$D.unstable_IdlePriority=5,$D.unstable_ImmediatePriority=1,$D.unstable_LowPriority=4,$D.unstable_NormalPriority=3,$D.unstable_Profiling=null,$D.unstable_UserBlockingPriority=2,$D.unstable_cancelCallback=function(V){V.callback=null},$D.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<V?Math.floor(1000/V):5},$D.unstable_getCurrentPriorityLevel=function(){return E},$D.unstable_next=function(V){switch(E){case 1:case 2:case 3:var me=3;break;default:me=E}var he=E;E=me;try{return V()}finally{E=he}},$D.unstable_requestPaint=function(){le=!0},$D.unstable_runWithPriority=function(V,me){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var he=E;E=V;try{return me()}finally{E=he}},$D.unstable_scheduleCallback=function(V,me,he){var Ae=$D.unstable_now();switch(typeof he==="object"&&he!==null?(he=he.delay,he=typeof he==="number"&&0<he?Ae+he:Ae):he=Ae,V){case 1:var Ue=-1;break;case 2:Ue=250;break;case 5:Ue=1073741823;break;case 4:Ue=1e4;break;default:Ue=5000}return Ue=he+Ue,V={id:k++,callback:me,priorityLevel:V,startTime:he,expirationTime:Ue,sortIndex:-1},he>Ae?(V.sortIndex=he,i(w,V),a(v)===null&&V===a(w)&&(U?(se(ae),ae=-1):U=!0,p(u,he-Ae))):(V.sortIndex=Ue,i(v,V),Y||Z||(Y=!0,ce||(ce=!0,ne()))),V},$D.unstable_shouldYield=d,$D.unstable_wrapCallback=function(V){var me=E;return function(){var he=E;E=me;try{return V.apply(this,arguments)}finally{E=he}}},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()});var oT=_y(function(CD){var Je=wt(lT()),bc=wt(yc()),Ly=wt(TD());(function(){function e(t,n){for(t=t.memoizedState;t!==null&&0<n;)t=t.next,n--;return t}function i(t,n,l,s){if(l>=n.length)return s;var f=n[l],h=tn(t)?t.slice():_e({},t);return h[f]=i(t[f],n,l+1,s),h}function a(t,n,l){if(n.length!==l.length)console.warn("copyWithRename() expects paths of the same length");else{for(var s=0;s<l.length-1;s++)if(n[s]!==l[s]){console.warn("copyWithRename() expects paths to be the same except for the deepest key");return}return o(t,n,l,0)}}function o(t,n,l,s){var f=n[s],h=tn(t)?t.slice():_e({},t);return s+1===n.length?(h[l[s]]=h[f],tn(h)?h.splice(f,1):delete h[f]):h[f]=o(t[f],n,l,s+1),h}function r(t,n,l){var s=n[l],f=tn(t)?t.slice():_e({},t);if(l+1===n.length)return tn(f)?f.splice(s,1):delete f[s],f;return f[s]=r(t[s],n,l+1),f}function c(){return!1}function u(){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 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 O(){}function g(){}function b(t){var n=[];return t.forEach(function(l){n.push(l)}),n.sort().join(", ")}function v(t,n,l,s){return new mM(t,n,l,s)}function w(t,n){t.context===bo&&(a0(t.current,2,n,t,null,null),As())}function k(t,n){if(Pi!==null){var l=n.staleFamilies;n=n.updatedFamilies,Qu(),fS(t.current,n,l),As()}}function P(t){Pi=t}function E(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Z(t){var n=t,l=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(l=n.return),t=n.return;while(t)}return n.tag===3?l:null}function Y(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 U(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 le(t){if(Z(t)!==t)throw Error("Unable to find node on an unmounted component.")}function ee(t){var n=t.alternate;if(!n){if(n=Z(t),n===null)throw Error("Unable to find node on an unmounted component.");return n!==t?null:t}for(var l=t,s=n;;){var f=l.return;if(f===null)break;var h=f.alternate;if(h===null){if(s=f.return,s!==null){l=s;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===l)return le(f),t;if(h===s)return le(f),n;h=h.sibling}throw Error("Unable to find node on an unmounted component.")}if(l.return!==s.return)l=f,s=h;else{for(var m=!1,y=f.child;y;){if(y===l){m=!0,l=f,s=h;break}if(y===s){m=!0,s=f,l=h;break}y=y.sibling}if(!m){for(y=h.child;y;){if(y===l){m=!0,l=h,s=f;break}if(y===s){m=!0,s=h,l=f;break}y=y.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(l.alternate!==s)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(l.tag!==3)throw Error("Unable to find node on an unmounted component.");return l.stateNode.current===l?t:n}function se(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=se(t),n!==null)return n;t=t.sibling}return null}function W(t){if(t===null||typeof t!=="object")return null;return t=yk&&t[yk]||t["@@iterator"],typeof t==="function"?t:null}function ce(t){if(t==null)return null;if(typeof t==="function")return t.$$typeof===X5?null:t.displayName||t.name||null;if(typeof t==="string")return t;switch(t){case Xs:return"Fragment";case u0:return"Profiler";case Rd:return"StrictMode";case h0:return"Suspense";case d0:return"SuspenseList";case p0: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 Ds:return"Portal";case La:return t.displayName||"Context";case f0:return(t._context.displayName||"Context")+".Consumer";case Du:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Pd:return n=t.displayName||null,n!==null?n:ce(t.type)||"Memo";case pi:n=t._payload,t=t._init;try{return ce(t(n))}catch(l){}}return null}function ae(t){return typeof t.tag==="number"?I(t):typeof t.name==="string"?t.name:null}function I(t){var n=t.type;switch(t.tag){case 31:return"Activity";case 24:return"Cache";case 9:return(n._context.displayName||"Context")+".Consumer";case 10:return n.displayName||"Context";case 18:return"DehydratedFragment";case 11:return t=n.render,t=t.displayName||t.name||"",n.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 26:case 27:case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ce(n);case 8:return n===Rd?"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 l=n.length-1;0<=l;l--)if(typeof n[l].name==="string")return n[l].name}if(t.return!==null)return I(t.return)}return null}function fe(t){return{current:t}}function ne(t,n){0>Ol?console.error("Unexpected pop."):(n!==O0[Ol]&&console.error("Unexpected Fiber popped."),t.current=m0[Ol],m0[Ol]=null,O0[Ol]=null,Ol--)}function re(t,n,l){Ol++,m0[Ol]=t.current,O0[Ol]=l,t.current=n}function Xe(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 V(t,n){re(ho,n,t),re(Xu,t,t),re(fo,null,t);var l=n.nodeType;switch(l){case 9:case 11:l=l===9?"#document":"#fragment",n=(n=n.documentElement)?(n=n.namespaceURI)?qw(n):Rl:Rl;break;default:if(l=n.tagName,n=n.namespaceURI)n=qw(n),n=Bw(n,l);else switch(l){case"svg":n=Oc;break;case"math":n=Ap;break;default:n=Rl}}l=l.toLowerCase(),l=X1(null,l),l={context:n,ancestorInfo:l},ne(fo,t),re(fo,l,t)}function me(t){ne(fo,t),ne(Xu,t),ne(ho,t)}function he(){return Xe(fo.current)}function Ae(t){t.memoizedState!==null&&re(Ed,t,t);var n=Xe(fo.current),l=t.type,s=Bw(n.context,l);l=X1(n.ancestorInfo,l),s={context:s,ancestorInfo:l},n!==s&&(re(Xu,t,t),re(fo,s,t))}function Ue(t){Xu.current===t&&(ne(fo,t),ne(Xu,t)),Ed.current===t&&(ne(Ed,t),Cf._currentValue=Ir)}function Ge(){}function He(){if(Zu===0){bk=console.log,vk=console.info,Sk=console.warn,xk=console.error,wk=console.group,kk=console.groupCollapsed,Qk=console.groupEnd;var t={configurable:!0,enumerable:!0,value:Ge,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}Zu++}function $t(){if(Zu--,Zu===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:_e({},t,{value:bk}),info:_e({},t,{value:vk}),warn:_e({},t,{value:Sk}),error:_e({},t,{value:xk}),group:_e({},t,{value:wk}),groupCollapsed:_e({},t,{value:kk}),groupEnd:_e({},t,{value:Qk})})}0>Zu&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function Ye(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 Se(t){if(g0===void 0)try{throw Error()}catch(l){var n=l.stack.trim().match(/\n( *(at )?)/);g0=n&&n[1]||"",$k=-1<l.stack.indexOf(`
@@ -2015,6 +2015,6 @@ ${Lp}`},void 0,!1,void 0,this),te.jsxDEV(Fm,{contextLabel:ut,onContextClick:ii&&
2015
2015
 
2016
2016
  [Open the Inbox item](${i.backlink})`;return{draft:a,body:i.body?`${i.body}
2017
2017
 
2018
- ${o}`:o}}function AL(e,i,a){let o={...e};if(a==="")return delete o[i.name],o;if(i.widget==="boolean")return o[i.name]=a===!0,o;if(i.widget==="number")return o[i.name]=Number(a),o;return o[i.name]=a,o}var xh={mode:{kind:"browse"},draft:{},body:"",save:{kind:"idle"},deleteOpen:!1};function hE(e){if(e.mode.kind==="browse")return!1;if(e.mode.kind==="create")return!0;return e.body!==e.mode.entity.body||JSON.stringify(e.draft)!==JSON.stringify(e.mode.entity.frontmatter)}function dE(e,i){switch(i.type){case"collectionChanged":return xh;case"documentOpened":return{mode:{kind:"edit",entity:i.document.entity},draft:i.document.draft,body:i.document.body,save:i.save??{kind:"idle"},deleteOpen:!1};case"creationStarted":if(e.mode.kind!=="browse")return e;return{mode:{kind:"create"},draft:i.draft,body:i.body??"",save:{kind:"idle"},deleteOpen:!1};case"browseRequested":return xh;case"fieldChanged":return e.mode.kind==="browse"?e:{...e,draft:AL(e.draft,i.descriptor,i.raw)};case"fieldAssistApplied":return e.mode.kind==="browse"?e:{...e,draft:{...e.draft,[i.field]:i.suggestion}};case"bodyChanged":return e.mode.kind==="browse"?e:{...e,body:i.body};case"saveStarted":return e.mode.kind==="browse"?e:{...e,save:{kind:"saving"}};case"saveFailed":return e.mode.kind==="browse"?e:{...e,save:i.save};case"deleteRequested":return e.mode.kind==="edit"?{...e,deleteOpen:!0}:e;case"deleteCancelled":return e.deleteOpen?{...e,deleteOpen:!1}:e;case"deleteSucceeded":return e.mode.kind==="edit"?xh:e;case"deleteFailed":return e.mode.kind==="edit"?{...e,deleteOpen:!1,save:{kind:"error",message:i.message}}:e}}function pE(e,i,a){return{studioChatHandoff:{version:1,sourceId:e,itemId:i,label:a,prompt:"Help me understand this Inbox item and decide what to do next."}}}function mE(e){if(typeof e!=="object"||e===null)return null;let i=Reflect.get(e,"studioChatHandoff");if(typeof i!=="object"||i===null)return null;let a=Reflect.get(i,"version"),o=Reflect.get(i,"sourceId"),r=Reflect.get(i,"itemId"),c=Reflect.get(i,"label"),u=Reflect.get(i,"prompt");if(a!==1||typeof o!=="string"||!/^[a-z][a-z0-9-]*$/.test(o)||o.length>64||typeof r!=="string"||r.trim().length===0||r.length>300||typeof c!=="string"||c.trim().length===0||c.length>160||typeof u!=="string"||u.trim().length===0||u.length>1e4)return null;return{sourceId:o,itemId:r,label:c,prompt:u}}var OE=new Set(["offset","limit"]);function gE(e,i){if(e?.urlQuery!==!0)return{};let a={};for(let[o,r]of new URLSearchParams(i))if(!OE.has(o))a[o]=r;return a}function p1(e){let i=new URLSearchParams,a=Object.entries(e).filter(([r,c])=>!OE.has(r)&&c!==void 0&&(typeof c!=="number"||Number.isFinite(c))).sort(([r],[c])=>r.localeCompare(c));for(let[r,c]of a)i.set(r,String(c));let o=i.toString();return o?`?${o}`:""}function Hc(e,i){return`${e}${p1(i)}`}function m1(e,i,a,o){if(o!==i)return;e.replace(Hc(i,a))}var $i=wt(Cn(),1),RL=ke.lazy(async()=>({default:(await import("./studio-chunks/account-view-9nxfz348.js")).AccountApp})),PL=ke.lazy(async()=>({default:(await import("./studio-chunks/studio-chat-workspace-a7km8rss.js")).StudioChatWorkspace}));function EL(e){let i=new URLSearchParams(e).get("session")?.trim();return i&&i.length<=256?i:null}function ML(){let e=window.history.state;return cT(e)?e:{}}var zL=[],DL=[],XL={},ZL=["public","trusted","admin"];function _L(e,i){let a=document.querySelector("[data-studio-root]"),o=a?.getAttribute("data-studio-principal-name")??"Your account",r=a?.getAttribute("data-studio-principal-role"),c=ZL.find((u)=>u===r)??"public";return{displayName:o,role:c,routePath:e,studioPath:i}}function _E(){let e=vE(),i=iO({select:(q)=>q.location.pathname}),a=iO({select:(q)=>q.location.searchStr}),o=iO({select:(q)=>q.location.state}),r=DE(),c=ke.useMemo(()=>i===QE?{kind:"workspace",workspaceId:y1}:wE(i,r),[i,r]),u=ke.useMemo(()=>c.kind==="collection"&&new URLSearchParams(a).get("mode")==="create",[a,c]),d=i,[p,O]=ke.useState(null),[g,b]=ke.useState(null),[v,w]=ke.useState({}),[k,P]=ke.useReducer(dE,xh),{mode:E,draft:Z,body:Y,save:U}=k,le=hE(k),ee=SE({shouldBlockFn:()=>le,enableBeforeUnload:le,withResolver:!0}),[se,W]=ke.useState({kind:"idle"}),[ce,ae]=ke.useState("split"),[I,fe]=ke.useState("details"),[ne,re]=ke.useState(null),[Xe,V]=ke.useState(null),me=ke.useRef(0),he=ke.useRef(null),Ae=ke.useRef(0),Ue=ke.useRef(g);Ue.current=g;let Ge=bE(),He=Vm(),$t=ar(RE(He)),Ye=$t.data?.types??null,bt=Ye?.find((q)=>q.entityType===g)?.capabilities,Pt=$t.data?.workspaces??DL,ct=Pt.find((q)=>q.id===p),ds=ct?.rendererName===kE,xn=ct?.rendererName===b1,Ul=ct?.rendererName==="DeclarativeOperatorWorkspace",F=p?v[p]:void 0,al=ct?.urlQuery!==!0||F?.urlSearch===a,ii=ke.useMemo(()=>gE(ct,a),[ct,a]),ba=p?F&&al?F.query:ii:XL,wn=ar({...PE(He,p??"",ba),enabled:Ul}),it=wn.data??null,or=it?.data??null,ll=wn.error?Un(wn.error):null,Nl=E.kind==="edit"?E.entity.id:null,rr=ar({...EE(He,g??"",Nl??""),enabled:g!==null&&Nl!==null&&bt?.canAssist===!0&&bt.canUpdate}).data??zL,ai=ar({...ME(He),enabled:g!==null}).data??null,va=ar({...w1(He,g??""),enabled:g!==null}),sr=g?va.data??null:null,cr=ar({...x1(He,g??""),enabled:g!==null}),kn=g?cr.data??null:null;ar({...wh(He,g??"",Nl??""),enabled:g!==null&&Nl!==null});let li=nO({mutationFn:(q)=>AE(He,q)}),Re=nO({mutationFn:(q)=>CE(He,q)}),sn=nO({mutationFn:(q)=>TE(He,q)}),Wl=Re.isPending,ur=Ul&&it?it.data:null;ke.useEffect(()=>{if(!p||!ur?.refreshAfterMs)return;let q=window.setTimeout(()=>{Ge.invalidateQueries({queryKey:lr.workspace(p)})},ur.refreshAfterMs);return()=>window.clearTimeout(q)},[p,ur,Ge]),ke.useEffect(()=>{if(ct?.urlQuery!==!0||c.kind!=="workspace"||c.workspaceId!==ct.id)return;let q=ya(r,ct.id);if(Hc(q,ii)!==`${q}${a}`)m1(e.history,q,ii,window.location.pathname)},[ct,r,ii,a,c,e.history]),ke.useEffect(()=>{if(!Ye)return;if(re(null),c.kind==="not-found"){Ae.current+=1,re(`Studio route not found: ${c.pathname}`);return}if(c.kind==="workspace"){let de=Pt.find((qt)=>qt.id===c.workspaceId);if(!de){let qt=XE(r,c.workspaceId,a,Pt);if(qt){e.history.replace(qt);return}Ae.current+=1,re(`Unknown Studio workspace: ${c.workspaceId}`);return}O(de.id),b(null);return}let q=c.kind==="collection"||c.kind==="entity"?c.entityType:void 0,ye=Ye.find((de)=>!de.isSingleton)??Ye[0];if(c.kind==="home"){let de=ZE(r,Ye,Pt);if(de!==r){e.history.replace(de);return}}let Ce=q??ye?.entityType??null;if(q!==void 0&&!Ye.some((de)=>de.entityType===q)){Ae.current+=1,re(`Unknown Studio entity type: ${q}`);return}O(null),b(Ce)},[a,c,e.history,r,Ye,Pt]),ke.useEffect(()=>{if(U.kind!=="saved"||!ai?.git)return;if(Um({save:U,git:ai.git,baselineCommit:Xe}).committed==="done")return;if(Date.now()-me.current>20000)return;let ye=window.setTimeout(()=>{Ge.invalidateQueries({queryKey:lr.syncStatus()})},900);return()=>window.clearTimeout(ye)},[U,ai,Xe,Ge]),ke.useEffect(()=>{if(!g||c.kind==="workspace"||c.kind==="not-found")return;let q=c.kind==="entity"&&c.entityType===g?c.id:null,ye=++Ae.current;P({type:"collectionChanged"}),fe("details"),W({kind:"idle"});let Ce=!0;return Promise.all([Ge.fetchQuery({...x1(He,g),staleTime:0}),Ge.ensureQueryData(w1(He,g))]).then(([de,qt])=>{if(!Ce||ye!==Ae.current)return;if(u&&q===null){if(Ye?.find((Jl)=>Jl.entityType===g)?.capabilities.canCreate!==!0){re(`Creating ${g} is not allowed.`);return}let Gi=uE(window.history.state,g,()=>window.history.replaceState(cE(ML()),"",window.location.href)),Hi=fE(de.fields,Gi);P({type:"creationStarted",draft:Hi.draft,body:Hi.body});return}if(q!==null)return Ge.fetchQuery({...wh(He,g,q),staleTime:0}).then((Ie)=>{if(!Ce||ye!==Ae.current)return;let Gi=tO(Ie),Hi=he.current,Jl=Hi?.pathname===d?Hi.save:{kind:"idle"};if(Hi?.pathname===d)he.current=null;P({type:"documentOpened",document:Gi,save:Jl})});if(de.isSingleton){let Ie=qt[0];if(Ie)return Ge.fetchQuery({...wh(He,g,Ie.id),staleTime:0}).then((Gi)=>{if(!Ce||ye!==Ae.current)return;let Hi=tO(Gi);P({type:"documentOpened",document:Hi})});P({type:"creationStarted",draft:Sh(de.fields)})}return}).catch((de)=>{if(Ce&&ye===Ae.current)re(Un(de))}),()=>{Ce=!1}},[u,d,g,Ge,i,c,Ye]);let ol=ke.useCallback((q,ye={kind:"idle"})=>{if(!g)return;let Ce=O1(r,g,q);if(Ce!==d){he.current={pathname:Ce,save:ye},e.history.push(Ce,{studioCollectionPath:Ic(r,g)},ye.kind==="saved"?{ignoreBlocker:!0}:void 0);return}let de=++Ae.current,qt=g;Ge.fetchQuery({...wh(He,g,q),staleTime:0}).then((Ie)=>{if(de!==Ae.current||Ue.current!==qt)return;let Gi=tO(Ie);P({type:"documentOpened",document:Gi,save:ye}),W({kind:"idle"})}).catch((Ie)=>{if(de===Ae.current)re(Un(Ie))})},[r,d,g,Ge,e.history]),ps=ke.useCallback((q,ye)=>{let Ce=O1(r,q,ye);he.current={pathname:Ce,save:{kind:"idle"}},e.history.push(Ce,{studioCollectionPath:Ic(r,q)})},[r,e.history]),Fc=ke.useCallback((q,ye,Ce,de)=>{e.history.push(xE(r,"note"),fT(q,`entity://${encodeURIComponent(Ce)}/${encodeURIComponent(de)}`,ye))},[r,e.history]),ms=ke.useCallback((q,ye,Ce)=>{if(Pt.some((de)=>de.rendererName===b1)){e.history.push(v1(r),pE(q,ye,Ce));return}},[e.history,r,Pt]),kh=ke.useCallback((q)=>{switch(q.target){case"account-settings":{e.history.push(ya(r,g1));return}case"invitations":e.history.push(Hc(ya(r,"admin:administration"),{tab:"invitations"}));return;case"admin-peer-invite":{e.history.push(Hc(ya(r,"admin:administration"),{tab:"invitations",peerId:q.peerId,displayName:q.displayName}));return}case"inbox":{let ye={};if("source"in q){if(ye.sourceId="mail-items",q.filter==="high-priority")ye["facet.mail-priority"]="high";else if(q.filter==="needs-reply")ye["facet.needs-reply"]="true";else if(q.filter==="unclassified")ye["facet.category"]="unclassified"}e.history.push(Hc(ya(r,"unified-inbox:inbox"),ye));return}case"publishing":e.history.push(ya(r,"content-pipeline:publishing"));return;case"site":e.history.push(ya(r,"site-builder:site"));return;case"inbox-open-entity":ps(q.entityType,q.entityId);return;case"inbox-capture-note":Fc(q.title,q.summary,q.entityType,q.entityId);return;case"inbox-discuss-in-chat":ms(q.sourceId,q.itemId,q.label)}},[Fc,r,ms,ps,a,e.history]),Os=ke.useCallback((q)=>{e.history.push(Ic(r,q))},[r,e.history]),fr=ke.useCallback((q)=>{e.history.push(q===y1?v1(r):ya(r,q))},[r,e.history]),Gl=ke.useCallback(()=>{if(!kn||bt?.canCreate!==!0)return;P({type:"creationStarted",draft:Sh(kn.fields)}),W({kind:"idle"})},[bt,kn]),Sa=ke.useCallback(()=>{if(!g)return;let q=Ic(r,g),ye=e.history.location.state;if(typeof ye==="object"&&ye!==null&&"studioCollectionPath"in ye&&ye.studioCollectionPath===q&&e.history.canGoBack()){e.history.back();return}e.history.replace(q)},[r,g,e.history]),hr=ke.useCallback((q,ye)=>{if(!g||E.kind!=="edit"||bt?.canUpdate!==!0||bt.canAssist!==!0||Y.trim().length===0)return;W({kind:"loading",field:ye,variant:q}),He.requestFieldAssist({variant:q,entityType:g,id:E.entity.id,targetField:ye}).then((Ce)=>{let de=Ce.variant==="summarise"?Ce.suggestion:Ce.suggestions;W({kind:"suggested",field:Ce.targetField,variant:Ce.variant,suggestion:de})}).catch((Ce)=>{W({kind:"error",field:ye,message:Un(Ce)})})},[bt,Y,g,E]),Hl=ke.useCallback((q,ye)=>{P({type:"fieldAssistApplied",field:q,suggestion:ye}),W({kind:"idle"})},[]),Wt=ke.useCallback(()=>{if(!g||E.kind==="browse"||!kn)return;if(E.kind==="create"?bt?.canCreate!==!0:bt?.canUpdate!==!0)return;me.current=Date.now(),V(ai?.git?.lastCommit??null),P({type:"saveStarted"});let q=kn.hasBody?{body:Y}:{},ye=zE(kn.fields,Z),Ce=E.kind==="create"?{kind:"create",entityType:g,frontmatter:ye,...q}:{kind:"update",entityType:g,id:E.entity.id,frontmatter:ye,baseContentHash:E.entity.contentHash,...q};li.mutate(Ce,{onSuccess:async(de)=>{await Promise.all([Ge.invalidateQueries({queryKey:lr.entities(g)}),Ge.invalidateQueries({queryKey:lr.syncStatus()})]);let qt="skipped"in de&&de.skipped===!0;ol(de.entityId,{kind:"saved",noop:qt})},onError:(de)=>{P({type:"saveFailed",save:de instanceof $E&&de.status===409?{kind:"conflict",message:Un(de)}:{kind:"error",message:Un(de)}})}})},[bt,g,E,Z,Y,kn,ol,ai,Ge,li]),rl=ke.useCallback(()=>{if(!g||E.kind!=="edit"||Wl||bt?.canDelete!==!0)return;let{id:q}=E.entity;Re.mutate({entityType:g,id:q},{onSuccess:async()=>{P({type:"deleteSucceeded"}),Ge.removeQueries({queryKey:lr.entity(g,q)}),await Promise.all([Ge.invalidateQueries({queryKey:lr.entities(g)}),Ge.invalidateQueries({queryKey:lr.syncStatus()})]),e.history.replace(Ic(r,g),void 0,{ignoreBlocker:!0})},onError:(ye)=>{P({type:"deleteFailed",message:Un(ye)})}})},[bt,r,g,E,Wl,Ge,Re,e.history]),Il=ke.useCallback(async(q)=>{let ye=Pt.find((Ie)=>Ie.pluginId==="content-pipeline"&&Ie.entityTypes.includes(q.entityType));if(!ye)throw Error("Publishing is unavailable");let Ce={entityType:q.entityType,entityId:q.entityId,...q.type==="reorder"?{position:q.position}:{}};if(q.type==="publish"&&!q.confirmation){let Ie=await sn.mutateAsync({workspaceId:ye.id,action:{actionId:"publish",label:"Publish now",input:Ce,invocation:{mode:"prepare"}}});if(typeof Ie!=="object"||Ie===null||!("kind"in Ie)||Ie.kind!=="prepared-confirmation"||!("token"in Ie)||typeof Ie.token!=="string"||!("summary"in Ie)||typeof Ie.summary!=="string"||!("expiresAt"in Ie)||typeof Ie.expiresAt!=="string")throw Error("Publishing confirmation is unavailable");return{needsConfirmation:!0,summary:Ie.summary,args:{confirmed:!0,confirmationToken:Ie.token,contentHash:Ie.token,expiresAt:Ie.expiresAt}}}let de=await sn.mutateAsync({workspaceId:ye.id,action:{actionId:q.type,label:q.type,input:Ce,...q.type==="publish"&&q.confirmation?{invocation:{mode:"execute",token:q.confirmation.confirmationToken}}:{}}});if(typeof de!=="object"||de===null)throw Error("Publishing returned an invalid result");let qt="success"in de&&de.success===!1?{success:!1,error:"error"in de&&typeof de.error==="string"?de.error:"Publishing failed",..."code"in de&&typeof de.code==="string"?{code:de.code}:{}}:{success:!0};if(!c1(qt)&&!u1(qt)){if(await S1(Ge,ye.id),E.kind==="edit"&&g===q.entityType&&E.entity.id===q.entityId)ol(q.entityId)}return qt},[g,E,ol,Ge,sn,Pt]),Fl=ke.useCallback(async(q)=>{if(!p)throw Error("Declarative workspace is unavailable");try{let ye=await sn.mutateAsync({workspaceId:p,action:q});return await S1(Ge,p),ye}finally{sn.reset()}},[p,sn,Ge]),Jc=ke.useCallback((q,ye,Ce)=>{let de=Pt.find((Ie)=>Ie.id===q),qt=de?.urlQuery===!0?a:void 0;if(de?.urlQuery===!0&&Ce!==void 0){let Ie=ya(r,q);qt=p1(Ce),m1(e.history,Ie,Ce,window.location.pathname)}w((Ie)=>({...Ie,[q]:{query:ye,...qt!==void 0?{urlSearch:qt}:{}}}))},[r,a,e.history,Pt]),Kc=ne??($t.error?Un($t.error):null);if(Kc)return $i.jsxDEV(Gc,{message:Kc,error:!0},void 0,!1,void 0,this);if(!Ye)return $i.jsxDEV(Gc,{message:"Loading…"},void 0,!1,void 0,this);if(ds){let q=ya(r,g1);return $i.jsxDEV(rE,{types:Ye,workspaces:Pt,workspaceId:ct.id,selectEntityType:Os,selectWorkspace:fr,children:$i.jsxDEV(ke.Suspense,{fallback:$i.jsxDEV("p",{className:"status",children:"Opening Account…"},void 0,!1,void 0,this),children:$i.jsxDEV(RL,{bootstrap:_L(q,r)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}if(xn)return $i.jsxDEV(ke.Suspense,{fallback:$i.jsxDEV(Gc,{message:"Opening Chat…"},void 0,!1,void 0,this),children:$i.jsxDEV(PL,{apiPath:ct.chatApiPath,studioBasePath:r,sessionId:EL(a),types:Ye,workspaces:Pt,handoff:mE(o),navigate:(q)=>e.history.push(q),selectEntityType:Os,selectWorkspace:fr},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(p?!or&&!ll:g&&(!kn||!sr))return $i.jsxDEV(Gc,{message:"Loading…"},void 0,!1,void 0,this);if(!p&&(!g||!kn))return $i.jsxDEV(Gc,{message:"No editable entity types are registered."},void 0,!1,void 0,this);return $i.jsxDEV(sE,{activeWorkspaceId:p,types:Ye,workspaces:Pt,workspaceError:ll,declarativeWorkspaceData:ur,workspaceQuery:ba,entityType:g,entities:sr,schema:kn,editor:k,fieldAssistState:se,bodyMode:ce,mobilePane:I,syncStatus:ai,baselineCommit:Xe,agentTargets:rr,deleting:Wl,hasUnsavedChanges:le,navigationBlocked:ee.status==="blocked",dispatchEditor:P,setFieldAssistState:W,setBodyMode:ae,setMobilePane:fe,backToList:Sa,selectEntityType:Os,selectWorkspace:fr,openWorkspaceEntity:ps,openWorkspaceLaunch:kh,performPublishingAction:Il,performDeclarativeAction:Fl,onWorkspaceQueryChange:Jc,startCreate:Gl,openEntity:ol,runFieldAssist:hr,applyFieldAssist:Hl,save:Wt,remove:rl,onNavigationReset:()=>ee.reset?.(),onNavigationProceed:()=>ee.proceed?.()},void 0,!1,void 0,this)}function jE(){return new LE({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}var lO=wt(Cn(),1),aO=document.querySelector("[data-studio-root]");if(aO){let e=aO.getAttribute("data-studio-base-path")??"/studio",i=new BE({basePath:e});aO.textContent="";let a=jE(),o=UE(e,_E);NE.createRoot(aO).render(lO.jsxDEV(YE,{client:a,children:lO.jsxDEV(VE,{api:i,children:lO.jsxDEV(qE,{router:o},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))}
2018
+ ${o}`:o}}function AL(e,i,a){let o={...e};if(a==="")return delete o[i.name],o;if(i.widget==="boolean")return o[i.name]=a===!0,o;if(i.widget==="number")return o[i.name]=Number(a),o;return o[i.name]=a,o}var xh={mode:{kind:"browse"},draft:{},body:"",save:{kind:"idle"},deleteOpen:!1};function hE(e){if(e.mode.kind==="browse")return!1;if(e.mode.kind==="create")return!0;return e.body!==e.mode.entity.body||JSON.stringify(e.draft)!==JSON.stringify(e.mode.entity.frontmatter)}function dE(e,i){switch(i.type){case"collectionChanged":return xh;case"documentOpened":return{mode:{kind:"edit",entity:i.document.entity},draft:i.document.draft,body:i.document.body,save:i.save??{kind:"idle"},deleteOpen:!1};case"creationStarted":if(e.mode.kind!=="browse")return e;return{mode:{kind:"create"},draft:i.draft,body:i.body??"",save:{kind:"idle"},deleteOpen:!1};case"browseRequested":return xh;case"fieldChanged":return e.mode.kind==="browse"?e:{...e,draft:AL(e.draft,i.descriptor,i.raw)};case"fieldAssistApplied":return e.mode.kind==="browse"?e:{...e,draft:{...e.draft,[i.field]:i.suggestion}};case"bodyChanged":return e.mode.kind==="browse"?e:{...e,body:i.body};case"saveStarted":return e.mode.kind==="browse"?e:{...e,save:{kind:"saving"}};case"saveFailed":return e.mode.kind==="browse"?e:{...e,save:i.save};case"deleteRequested":return e.mode.kind==="edit"?{...e,deleteOpen:!0}:e;case"deleteCancelled":return e.deleteOpen?{...e,deleteOpen:!1}:e;case"deleteSucceeded":return e.mode.kind==="edit"?xh:e;case"deleteFailed":return e.mode.kind==="edit"?{...e,deleteOpen:!1,save:{kind:"error",message:i.message}}:e}}function pE(e,i,a){return{studioChatHandoff:{version:1,sourceId:e,itemId:i,label:a,prompt:"Help me understand this Inbox item and decide what to do next."}}}function mE(e){if(typeof e!=="object"||e===null)return null;let i=Reflect.get(e,"studioChatHandoff");if(typeof i!=="object"||i===null)return null;let a=Reflect.get(i,"version"),o=Reflect.get(i,"sourceId"),r=Reflect.get(i,"itemId"),c=Reflect.get(i,"label"),u=Reflect.get(i,"prompt");if(a!==1||typeof o!=="string"||!/^[a-z][a-z0-9-]*$/.test(o)||o.length>64||typeof r!=="string"||r.trim().length===0||r.length>300||typeof c!=="string"||c.trim().length===0||c.length>160||typeof u!=="string"||u.trim().length===0||u.length>1e4)return null;return{sourceId:o,itemId:r,label:c,prompt:u}}var OE=new Set(["offset","limit"]);function gE(e,i){if(e?.urlQuery!==!0)return{};let a={};for(let[o,r]of new URLSearchParams(i))if(!OE.has(o))a[o]=r;return a}function p1(e){let i=new URLSearchParams,a=Object.entries(e).filter(([r,c])=>!OE.has(r)&&c!==void 0&&(typeof c!=="number"||Number.isFinite(c))).sort(([r],[c])=>r.localeCompare(c));for(let[r,c]of a)i.set(r,String(c));let o=i.toString();return o?`?${o}`:""}function Hc(e,i){return`${e}${p1(i)}`}function m1(e,i,a,o){if(o!==i)return;e.replace(Hc(i,a))}var $i=wt(Cn(),1),RL=ke.lazy(async()=>({default:(await import("./studio-chunks/account-view-9nxfz348.js")).AccountApp})),PL=ke.lazy(async()=>({default:(await import("./studio-chunks/studio-chat-workspace-z9973dz1.js")).StudioChatWorkspace}));function EL(e){let i=new URLSearchParams(e).get("session")?.trim();return i&&i.length<=256?i:null}function ML(){let e=window.history.state;return cT(e)?e:{}}var zL=[],DL=[],XL={},ZL=["public","trusted","admin"];function _L(e,i){let a=document.querySelector("[data-studio-root]"),o=a?.getAttribute("data-studio-principal-name")??"Your account",r=a?.getAttribute("data-studio-principal-role"),c=ZL.find((u)=>u===r)??"public";return{displayName:o,role:c,routePath:e,studioPath:i}}function _E(){let e=vE(),i=iO({select:(q)=>q.location.pathname}),a=iO({select:(q)=>q.location.searchStr}),o=iO({select:(q)=>q.location.state}),r=DE(),c=ke.useMemo(()=>i===QE?{kind:"workspace",workspaceId:y1}:wE(i,r),[i,r]),u=ke.useMemo(()=>c.kind==="collection"&&new URLSearchParams(a).get("mode")==="create",[a,c]),d=i,[p,O]=ke.useState(null),[g,b]=ke.useState(null),[v,w]=ke.useState({}),[k,P]=ke.useReducer(dE,xh),{mode:E,draft:Z,body:Y,save:U}=k,le=hE(k),ee=SE({shouldBlockFn:()=>le,enableBeforeUnload:le,withResolver:!0}),[se,W]=ke.useState({kind:"idle"}),[ce,ae]=ke.useState("split"),[I,fe]=ke.useState("details"),[ne,re]=ke.useState(null),[Xe,V]=ke.useState(null),me=ke.useRef(0),he=ke.useRef(null),Ae=ke.useRef(0),Ue=ke.useRef(g);Ue.current=g;let Ge=bE(),He=Vm(),$t=ar(RE(He)),Ye=$t.data?.types??null,bt=Ye?.find((q)=>q.entityType===g)?.capabilities,Pt=$t.data?.workspaces??DL,ct=Pt.find((q)=>q.id===p),ds=ct?.rendererName===kE,xn=ct?.rendererName===b1,Ul=ct?.rendererName==="DeclarativeOperatorWorkspace",F=p?v[p]:void 0,al=ct?.urlQuery!==!0||F?.urlSearch===a,ii=ke.useMemo(()=>gE(ct,a),[ct,a]),ba=p?F&&al?F.query:ii:XL,wn=ar({...PE(He,p??"",ba),enabled:Ul}),it=wn.data??null,or=it?.data??null,ll=wn.error?Un(wn.error):null,Nl=E.kind==="edit"?E.entity.id:null,rr=ar({...EE(He,g??"",Nl??""),enabled:g!==null&&Nl!==null&&bt?.canAssist===!0&&bt.canUpdate}).data??zL,ai=ar({...ME(He),enabled:g!==null}).data??null,va=ar({...w1(He,g??""),enabled:g!==null}),sr=g?va.data??null:null,cr=ar({...x1(He,g??""),enabled:g!==null}),kn=g?cr.data??null:null;ar({...wh(He,g??"",Nl??""),enabled:g!==null&&Nl!==null});let li=nO({mutationFn:(q)=>AE(He,q)}),Re=nO({mutationFn:(q)=>CE(He,q)}),sn=nO({mutationFn:(q)=>TE(He,q)}),Wl=Re.isPending,ur=Ul&&it?it.data:null;ke.useEffect(()=>{if(!p||!ur?.refreshAfterMs)return;let q=window.setTimeout(()=>{Ge.invalidateQueries({queryKey:lr.workspace(p)})},ur.refreshAfterMs);return()=>window.clearTimeout(q)},[p,ur,Ge]),ke.useEffect(()=>{if(ct?.urlQuery!==!0||c.kind!=="workspace"||c.workspaceId!==ct.id)return;let q=ya(r,ct.id);if(Hc(q,ii)!==`${q}${a}`)m1(e.history,q,ii,window.location.pathname)},[ct,r,ii,a,c,e.history]),ke.useEffect(()=>{if(!Ye)return;if(re(null),c.kind==="not-found"){Ae.current+=1,re(`Studio route not found: ${c.pathname}`);return}if(c.kind==="workspace"){let de=Pt.find((qt)=>qt.id===c.workspaceId);if(!de){let qt=XE(r,c.workspaceId,a,Pt);if(qt){e.history.replace(qt);return}Ae.current+=1,re(`Unknown Studio workspace: ${c.workspaceId}`);return}O(de.id),b(null);return}let q=c.kind==="collection"||c.kind==="entity"?c.entityType:void 0,ye=Ye.find((de)=>!de.isSingleton)??Ye[0];if(c.kind==="home"){let de=ZE(r,Ye,Pt);if(de!==r){e.history.replace(de);return}}let Ce=q??ye?.entityType??null;if(q!==void 0&&!Ye.some((de)=>de.entityType===q)){Ae.current+=1,re(`Unknown Studio entity type: ${q}`);return}O(null),b(Ce)},[a,c,e.history,r,Ye,Pt]),ke.useEffect(()=>{if(U.kind!=="saved"||!ai?.git)return;if(Um({save:U,git:ai.git,baselineCommit:Xe}).committed==="done")return;if(Date.now()-me.current>20000)return;let ye=window.setTimeout(()=>{Ge.invalidateQueries({queryKey:lr.syncStatus()})},900);return()=>window.clearTimeout(ye)},[U,ai,Xe,Ge]),ke.useEffect(()=>{if(!g||c.kind==="workspace"||c.kind==="not-found")return;let q=c.kind==="entity"&&c.entityType===g?c.id:null,ye=++Ae.current;P({type:"collectionChanged"}),fe("details"),W({kind:"idle"});let Ce=!0;return Promise.all([Ge.fetchQuery({...x1(He,g),staleTime:0}),Ge.ensureQueryData(w1(He,g))]).then(([de,qt])=>{if(!Ce||ye!==Ae.current)return;if(u&&q===null){if(Ye?.find((Jl)=>Jl.entityType===g)?.capabilities.canCreate!==!0){re(`Creating ${g} is not allowed.`);return}let Gi=uE(window.history.state,g,()=>window.history.replaceState(cE(ML()),"",window.location.href)),Hi=fE(de.fields,Gi);P({type:"creationStarted",draft:Hi.draft,body:Hi.body});return}if(q!==null)return Ge.fetchQuery({...wh(He,g,q),staleTime:0}).then((Ie)=>{if(!Ce||ye!==Ae.current)return;let Gi=tO(Ie),Hi=he.current,Jl=Hi?.pathname===d?Hi.save:{kind:"idle"};if(Hi?.pathname===d)he.current=null;P({type:"documentOpened",document:Gi,save:Jl})});if(de.isSingleton){let Ie=qt[0];if(Ie)return Ge.fetchQuery({...wh(He,g,Ie.id),staleTime:0}).then((Gi)=>{if(!Ce||ye!==Ae.current)return;let Hi=tO(Gi);P({type:"documentOpened",document:Hi})});P({type:"creationStarted",draft:Sh(de.fields)})}return}).catch((de)=>{if(Ce&&ye===Ae.current)re(Un(de))}),()=>{Ce=!1}},[u,d,g,Ge,i,c,Ye]);let ol=ke.useCallback((q,ye={kind:"idle"})=>{if(!g)return;let Ce=O1(r,g,q);if(Ce!==d){he.current={pathname:Ce,save:ye},e.history.push(Ce,{studioCollectionPath:Ic(r,g)},ye.kind==="saved"?{ignoreBlocker:!0}:void 0);return}let de=++Ae.current,qt=g;Ge.fetchQuery({...wh(He,g,q),staleTime:0}).then((Ie)=>{if(de!==Ae.current||Ue.current!==qt)return;let Gi=tO(Ie);P({type:"documentOpened",document:Gi,save:ye}),W({kind:"idle"})}).catch((Ie)=>{if(de===Ae.current)re(Un(Ie))})},[r,d,g,Ge,e.history]),ps=ke.useCallback((q,ye)=>{let Ce=O1(r,q,ye);he.current={pathname:Ce,save:{kind:"idle"}},e.history.push(Ce,{studioCollectionPath:Ic(r,q)})},[r,e.history]),Fc=ke.useCallback((q,ye,Ce,de)=>{e.history.push(xE(r,"note"),fT(q,`entity://${encodeURIComponent(Ce)}/${encodeURIComponent(de)}`,ye))},[r,e.history]),ms=ke.useCallback((q,ye,Ce)=>{if(Pt.some((de)=>de.rendererName===b1)){e.history.push(v1(r),pE(q,ye,Ce));return}},[e.history,r,Pt]),kh=ke.useCallback((q)=>{switch(q.target){case"account-settings":{e.history.push(ya(r,g1));return}case"invitations":e.history.push(Hc(ya(r,"admin:administration"),{tab:"invitations"}));return;case"admin-peer-invite":{e.history.push(Hc(ya(r,"admin:administration"),{tab:"invitations",peerId:q.peerId,displayName:q.displayName}));return}case"inbox":{let ye={};if("source"in q){if(ye.sourceId="mail-items",q.filter==="high-priority")ye["facet.mail-priority"]="high";else if(q.filter==="needs-reply")ye["facet.needs-reply"]="true";else if(q.filter==="unclassified")ye["facet.category"]="unclassified"}e.history.push(Hc(ya(r,"unified-inbox:inbox"),ye));return}case"publishing":e.history.push(ya(r,"content-pipeline:publishing"));return;case"site":e.history.push(ya(r,"site-builder:site"));return;case"inbox-open-entity":ps(q.entityType,q.entityId);return;case"inbox-capture-note":Fc(q.title,q.summary,q.entityType,q.entityId);return;case"inbox-discuss-in-chat":ms(q.sourceId,q.itemId,q.label)}},[Fc,r,ms,ps,a,e.history]),Os=ke.useCallback((q)=>{e.history.push(Ic(r,q)),window.scrollTo({top:0,left:0})},[r,e.history]),fr=ke.useCallback((q)=>{e.history.push(q===y1?v1(r):ya(r,q)),window.scrollTo({top:0,left:0})},[r,e.history]),Gl=ke.useCallback(()=>{if(!kn||bt?.canCreate!==!0)return;P({type:"creationStarted",draft:Sh(kn.fields)}),W({kind:"idle"})},[bt,kn]),Sa=ke.useCallback(()=>{if(!g)return;let q=Ic(r,g),ye=e.history.location.state;if(typeof ye==="object"&&ye!==null&&"studioCollectionPath"in ye&&ye.studioCollectionPath===q&&e.history.canGoBack()){e.history.back();return}e.history.replace(q)},[r,g,e.history]),hr=ke.useCallback((q,ye)=>{if(!g||E.kind!=="edit"||bt?.canUpdate!==!0||bt.canAssist!==!0||Y.trim().length===0)return;W({kind:"loading",field:ye,variant:q}),He.requestFieldAssist({variant:q,entityType:g,id:E.entity.id,targetField:ye}).then((Ce)=>{let de=Ce.variant==="summarise"?Ce.suggestion:Ce.suggestions;W({kind:"suggested",field:Ce.targetField,variant:Ce.variant,suggestion:de})}).catch((Ce)=>{W({kind:"error",field:ye,message:Un(Ce)})})},[bt,Y,g,E]),Hl=ke.useCallback((q,ye)=>{P({type:"fieldAssistApplied",field:q,suggestion:ye}),W({kind:"idle"})},[]),Wt=ke.useCallback(()=>{if(!g||E.kind==="browse"||!kn)return;if(E.kind==="create"?bt?.canCreate!==!0:bt?.canUpdate!==!0)return;me.current=Date.now(),V(ai?.git?.lastCommit??null),P({type:"saveStarted"});let q=kn.hasBody?{body:Y}:{},ye=zE(kn.fields,Z),Ce=E.kind==="create"?{kind:"create",entityType:g,frontmatter:ye,...q}:{kind:"update",entityType:g,id:E.entity.id,frontmatter:ye,baseContentHash:E.entity.contentHash,...q};li.mutate(Ce,{onSuccess:async(de)=>{await Promise.all([Ge.invalidateQueries({queryKey:lr.entities(g)}),Ge.invalidateQueries({queryKey:lr.syncStatus()})]);let qt="skipped"in de&&de.skipped===!0;ol(de.entityId,{kind:"saved",noop:qt})},onError:(de)=>{P({type:"saveFailed",save:de instanceof $E&&de.status===409?{kind:"conflict",message:Un(de)}:{kind:"error",message:Un(de)}})}})},[bt,g,E,Z,Y,kn,ol,ai,Ge,li]),rl=ke.useCallback(()=>{if(!g||E.kind!=="edit"||Wl||bt?.canDelete!==!0)return;let{id:q}=E.entity;Re.mutate({entityType:g,id:q},{onSuccess:async()=>{P({type:"deleteSucceeded"}),Ge.removeQueries({queryKey:lr.entity(g,q)}),await Promise.all([Ge.invalidateQueries({queryKey:lr.entities(g)}),Ge.invalidateQueries({queryKey:lr.syncStatus()})]),e.history.replace(Ic(r,g),void 0,{ignoreBlocker:!0})},onError:(ye)=>{P({type:"deleteFailed",message:Un(ye)})}})},[bt,r,g,E,Wl,Ge,Re,e.history]),Il=ke.useCallback(async(q)=>{let ye=Pt.find((Ie)=>Ie.pluginId==="content-pipeline"&&Ie.entityTypes.includes(q.entityType));if(!ye)throw Error("Publishing is unavailable");let Ce={entityType:q.entityType,entityId:q.entityId,...q.type==="reorder"?{position:q.position}:{}};if(q.type==="publish"&&!q.confirmation){let Ie=await sn.mutateAsync({workspaceId:ye.id,action:{actionId:"publish",label:"Publish now",input:Ce,invocation:{mode:"prepare"}}});if(typeof Ie!=="object"||Ie===null||!("kind"in Ie)||Ie.kind!=="prepared-confirmation"||!("token"in Ie)||typeof Ie.token!=="string"||!("summary"in Ie)||typeof Ie.summary!=="string"||!("expiresAt"in Ie)||typeof Ie.expiresAt!=="string")throw Error("Publishing confirmation is unavailable");return{needsConfirmation:!0,summary:Ie.summary,args:{confirmed:!0,confirmationToken:Ie.token,contentHash:Ie.token,expiresAt:Ie.expiresAt}}}let de=await sn.mutateAsync({workspaceId:ye.id,action:{actionId:q.type,label:q.type,input:Ce,...q.type==="publish"&&q.confirmation?{invocation:{mode:"execute",token:q.confirmation.confirmationToken}}:{}}});if(typeof de!=="object"||de===null)throw Error("Publishing returned an invalid result");let qt="success"in de&&de.success===!1?{success:!1,error:"error"in de&&typeof de.error==="string"?de.error:"Publishing failed",..."code"in de&&typeof de.code==="string"?{code:de.code}:{}}:{success:!0};if(!c1(qt)&&!u1(qt)){if(await S1(Ge,ye.id),E.kind==="edit"&&g===q.entityType&&E.entity.id===q.entityId)ol(q.entityId)}return qt},[g,E,ol,Ge,sn,Pt]),Fl=ke.useCallback(async(q)=>{if(!p)throw Error("Declarative workspace is unavailable");try{let ye=await sn.mutateAsync({workspaceId:p,action:q});return await S1(Ge,p),ye}finally{sn.reset()}},[p,sn,Ge]),Jc=ke.useCallback((q,ye,Ce)=>{let de=Pt.find((Ie)=>Ie.id===q),qt=de?.urlQuery===!0?a:void 0;if(de?.urlQuery===!0&&Ce!==void 0){let Ie=ya(r,q);qt=p1(Ce),m1(e.history,Ie,Ce,window.location.pathname)}w((Ie)=>({...Ie,[q]:{query:ye,...qt!==void 0?{urlSearch:qt}:{}}}))},[r,a,e.history,Pt]),Kc=ne??($t.error?Un($t.error):null);if(Kc)return $i.jsxDEV(Gc,{message:Kc,error:!0},void 0,!1,void 0,this);if(!Ye)return $i.jsxDEV(Gc,{message:"Loading…"},void 0,!1,void 0,this);if(ds){let q=ya(r,g1);return $i.jsxDEV(rE,{types:Ye,workspaces:Pt,workspaceId:ct.id,selectEntityType:Os,selectWorkspace:fr,children:$i.jsxDEV(ke.Suspense,{fallback:$i.jsxDEV("p",{className:"status",children:"Opening Account…"},void 0,!1,void 0,this),children:$i.jsxDEV(RL,{bootstrap:_L(q,r)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}if(xn)return $i.jsxDEV(ke.Suspense,{fallback:$i.jsxDEV(Gc,{message:"Opening Chat…"},void 0,!1,void 0,this),children:$i.jsxDEV(PL,{apiPath:ct.chatApiPath,studioBasePath:r,sessionId:EL(a),types:Ye,workspaces:Pt,handoff:mE(o),navigate:(q)=>e.history.push(q),selectEntityType:Os,selectWorkspace:fr},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(p?!or&&!ll:g&&(!kn||!sr))return $i.jsxDEV(Gc,{message:"Loading…"},void 0,!1,void 0,this);if(!p&&(!g||!kn))return $i.jsxDEV(Gc,{message:"No editable entity types are registered."},void 0,!1,void 0,this);return $i.jsxDEV(sE,{activeWorkspaceId:p,types:Ye,workspaces:Pt,workspaceError:ll,declarativeWorkspaceData:ur,workspaceQuery:ba,entityType:g,entities:sr,schema:kn,editor:k,fieldAssistState:se,bodyMode:ce,mobilePane:I,syncStatus:ai,baselineCommit:Xe,agentTargets:rr,deleting:Wl,hasUnsavedChanges:le,navigationBlocked:ee.status==="blocked",dispatchEditor:P,setFieldAssistState:W,setBodyMode:ae,setMobilePane:fe,backToList:Sa,selectEntityType:Os,selectWorkspace:fr,openWorkspaceEntity:ps,openWorkspaceLaunch:kh,performPublishingAction:Il,performDeclarativeAction:Fl,onWorkspaceQueryChange:Jc,startCreate:Gl,openEntity:ol,runFieldAssist:hr,applyFieldAssist:Hl,save:Wt,remove:rl,onNavigationReset:()=>ee.reset?.(),onNavigationProceed:()=>ee.proceed?.()},void 0,!1,void 0,this)}function jE(){return new LE({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1},mutations:{retry:!1}}})}var lO=wt(Cn(),1),aO=document.querySelector("[data-studio-root]");if(aO){let e=aO.getAttribute("data-studio-base-path")??"/studio",i=new BE({basePath:e});aO.textContent="";let a=jE(),o=UE(e,_E);NE.createRoot(aO).render(lO.jsxDEV(YE,{client:a,children:lO.jsxDEV(VE,{api:i,children:lO.jsxDEV(qE,{router:o},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this))}
2019
2019
 
2020
- //# debugId=A5951D57E1E9ED1264756E2164756E21
2020
+ //# debugId=685258F6BE6B8F1364756E2164756E21