@blinkk/root-cms 3.0.1 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +5 -5
- package/dist/{chunk-KGAUXTJ6.js → chunk-7Z5IRD2G.js} +176 -83
- package/dist/{chunk-2BSW7SIH.js → chunk-N4K6ICFR.js} +4 -4
- package/dist/{chunk-BGTUWIV6.js → chunk-PNLLZXVY.js} +4 -4
- package/dist/{chunk-C245C557.js → chunk-RXWDB3K4.js} +3 -3
- package/dist/{chunk-XLX37FRL.js → chunk-TEKMLYXS.js} +3 -4
- package/dist/cli/cli.d.ts +12 -0
- package/dist/cli/docs.d.ts +49 -0
- package/dist/cli/export.d.ts +11 -0
- package/dist/cli/generate-types.d.ts +6 -0
- package/dist/cli/import.d.ts +13 -0
- package/dist/cli/init-firebase.d.ts +7 -0
- package/dist/cli/utils.d.ts +27 -0
- package/dist/cli.js +10 -10
- package/dist/client.js +1 -1
- package/dist/core/ai-tools.d.ts +156 -0
- package/dist/core/ai.d.ts +330 -0
- package/dist/core/api.d.ts +21 -0
- package/dist/core/app.d.ts +16 -0
- package/dist/core/checks-translations.d.ts +13 -0
- package/dist/core/checks.d.ts +48 -0
- package/dist/core/client.d.ts +715 -0
- package/dist/core/core.d.ts +5 -0
- package/dist/core/cron.d.ts +19 -0
- package/dist/core/csv.d.ts +5 -0
- package/dist/core/functions.d.ts +9 -0
- package/dist/core/plugin.d.ts +357 -0
- package/dist/{project.d.ts → core/project.d.ts} +8 -12
- package/dist/core/richtext.d.ts +101 -0
- package/dist/{core.d.ts → core/route.d.ts} +13 -66
- package/dist/core/runtime.d.ts +46 -0
- package/dist/{schema-Db_xODoi.d.ts → core/schema.d.ts} +47 -100
- package/dist/core/search-extract.d.ts +70 -0
- package/dist/core/search-index.d.ts +182 -0
- package/dist/core/search-query.d.ts +68 -0
- package/dist/core/security.d.ts +6 -0
- package/dist/core/server-version.d.ts +5 -0
- package/dist/core/services-notifications.d.ts +57 -0
- package/dist/core/services.d.ts +44 -0
- package/dist/core/sse.d.ts +10 -0
- package/dist/core/translations-manager.d.ts +187 -0
- package/dist/core/translations.d.ts +83 -0
- package/dist/core/url-safety.d.ts +19 -0
- package/dist/core/validation.d.ts +30 -0
- package/dist/core/values.d.ts +9 -0
- package/dist/core/versions.d.ts +48 -0
- package/dist/core.js +1 -1
- package/dist/edit-M4PN4SGX.js +7 -0
- package/dist/functions.js +4 -4
- package/dist/{generate-types-SPV7I3A5.js → generate-types-JWIG4QVI.js} +1 -1
- package/dist/plugin.js +124 -129
- package/dist/shared/marshal.d.ts +68 -0
- package/dist/shared/objects.d.ts +9 -0
- package/dist/shared/richtext.d.ts +74 -0
- package/dist/shared/safe-json.d.ts +11 -0
- package/dist/shared/sanitize.d.ts +12 -0
- package/dist/shared/slug.d.ts +19 -0
- package/dist/shared/sse.d.ts +16 -0
- package/dist/shared/strings.d.ts +23 -0
- package/dist/ui/AIPage-2LUC2PWC.js +1 -0
- package/dist/ui/AssetsPage-PODV4QAB.js +1 -0
- package/dist/ui/CollectionPage-4DMKW5YB.js +1 -0
- package/dist/ui/ComparePage-JMJE5A5Y.js +1 -0
- package/dist/ui/DataPage-MVLZT2BU.js +1 -0
- package/dist/ui/DataSourcePage-4RPBXRI2.js +1 -0
- package/dist/ui/DocTranslationsPage-XJSPKGVX.js +1 -0
- package/dist/ui/DocumentPage-R2PVNG24.js +1 -0
- package/dist/ui/EditDataSourcePage-3SHAARNL.js +1 -0
- package/dist/ui/EditReleasePage-G5VW2OGW.js +1 -0
- package/dist/ui/ImageEditorDialog-4H665KK2.js +81 -0
- package/dist/ui/ImageEditorDialog-4H665KK2.js.LEGAL.txt +17 -0
- package/dist/ui/LogsPage-K6KYEG2P.js +1 -0
- package/dist/ui/NewDataSourcePage-O2VQEOJG.js +1 -0
- package/dist/ui/NewReleasePage-RSVS32RZ.js +1 -0
- package/dist/ui/NotFoundPage-ZYD5ILG6.js +1 -0
- package/dist/ui/ProjectPage-X3YQBWL4.js +1 -0
- package/dist/ui/ReleasePage-FJHHXNNB.js +1 -0
- package/dist/ui/ReleasesPage-VGWIBNEZ.js +1 -0
- package/dist/ui/SettingsPage-C4RXOQ6T.js +1 -0
- package/dist/ui/SidebarToolsPage-ZBOKPEMP.js +1 -0
- package/dist/ui/TaskPage-BQ4OX5WN.js +1 -0
- package/dist/ui/TasksPage-3IGQYVYS.js +1 -0
- package/dist/ui/TranslationsArbPage-GGHCWPQL.js +2 -0
- package/dist/ui/TranslationsEditPage-E2BCMKYV.js +1 -0
- package/dist/ui/TranslationsPage-MC4O4ZNI.js +162 -0
- package/dist/ui/ai-tools-5E5ELLZX.js +1 -0
- package/dist/ui/chunk-3IYZCUPI.js +1 -0
- package/dist/ui/chunk-4KE2SZKH.js +1 -0
- package/dist/ui/chunk-4W73RW5I.js +1 -0
- package/dist/ui/chunk-54DVDYU6.js +1 -0
- package/dist/ui/chunk-5MV6XVGA.js +1 -0
- package/dist/ui/chunk-62UWGWON.js +1 -0
- package/dist/ui/chunk-6IFGKSIE.js +1 -0
- package/dist/ui/chunk-767BAQ53.js +1 -0
- package/dist/ui/chunk-AFWBSIPL.js +1 -0
- package/dist/ui/chunk-AL3TN2KI.js +1 -0
- package/dist/ui/chunk-B6BLDN24.js +141 -0
- package/dist/ui/chunk-B6BLDN24.js.LEGAL.txt +106 -0
- package/dist/ui/chunk-BZIRGB4W.js +1 -0
- package/dist/ui/chunk-C5NH23G4.js +3 -0
- package/dist/ui/chunk-CGCKJFL4.js +1 -0
- package/dist/ui/chunk-DEGMKEHP.js +1 -0
- package/dist/ui/chunk-DTMZLUNY.js +15 -0
- package/dist/ui/chunk-DTMZLUNY.js.LEGAL.txt +237 -0
- package/dist/ui/chunk-DUJYIOLE.js +5 -0
- package/dist/ui/chunk-E2RCCK2T.js +1 -0
- package/dist/ui/chunk-EGEB6N4J.js +22 -0
- package/dist/ui/chunk-EGEB6N4J.js.LEGAL.txt +1059 -0
- package/dist/ui/chunk-GXSAEPU3.js +1 -0
- package/dist/ui/chunk-HHMG665Z.js +1 -0
- package/dist/ui/chunk-HKINZLMW.js +84 -0
- package/dist/ui/chunk-HLMBCVRX.js +1 -0
- package/dist/ui/chunk-HRGYNHZ3.js +1 -0
- package/dist/ui/chunk-I6ICVKEC.js +1 -0
- package/dist/ui/chunk-IU36W2TB.js +1 -0
- package/dist/ui/chunk-JDW4UORS.js +1 -0
- package/dist/ui/chunk-JHBAMPGB.js +1 -0
- package/dist/ui/chunk-JYFLU7DM.js +19 -0
- package/dist/ui/chunk-JZFTZ4X4.js +87 -0
- package/dist/ui/chunk-JZFTZ4X4.js.LEGAL.txt +9 -0
- package/dist/ui/chunk-KFAZBEPV.js +1 -0
- package/dist/ui/chunk-KKEWCXVV.js +1 -0
- package/dist/ui/chunk-KUCVLANF.js +1 -0
- package/dist/ui/chunk-KYDOSLTO.js +1 -0
- package/dist/ui/chunk-L4RHGQUG.js +1 -0
- package/dist/ui/chunk-MDUBCXU2.js +1 -0
- package/dist/ui/chunk-NXQVLOTK.js +1 -0
- package/dist/ui/chunk-NZHF733K.js +7 -0
- package/dist/ui/chunk-NZHF733K.js.LEGAL.txt +146 -0
- package/dist/ui/chunk-ONTGW2VA.js +1 -0
- package/dist/ui/chunk-ORXEMIQC.js +1 -0
- package/dist/ui/chunk-PHBMVORG.js +1 -0
- package/dist/ui/chunk-PJA7YP4A.js +1 -0
- package/dist/ui/chunk-PVAE643M.js +1 -0
- package/dist/ui/chunk-PWKJDYE2.js +1 -0
- package/dist/ui/chunk-RSVO46S3.js +1 -0
- package/dist/ui/chunk-SKEP5WYH.js +10 -0
- package/dist/ui/chunk-SKEP5WYH.js.LEGAL.txt +176 -0
- package/dist/ui/chunk-SQRKKWRG.js +3 -0
- package/dist/ui/chunk-UEON4JAT.js +1 -0
- package/dist/ui/chunk-V7S4IAGB.js +1 -0
- package/dist/ui/chunk-VMT7JFAM.js +1 -0
- package/dist/ui/chunk-W3BJ2EZX.js +1 -0
- package/dist/ui/chunk-W3HIZQ4Z.js +1 -0
- package/dist/ui/chunk-X2WHBGTP.js +1 -0
- package/dist/ui/chunk-XOQ3KDSR.js +3 -0
- package/dist/ui/chunk-YDO2EDVY.js +1 -0
- package/dist/ui/chunk-YFA6U2CV.js +1 -0
- package/dist/ui/gcs-L33FIRZU.js +1 -0
- package/dist/ui/prerender-Q4YSDCPB.js +1 -0
- package/dist/ui/signin.js +1 -1
- package/dist/ui/ui.css +1 -1
- package/dist/ui/ui.js +1 -630
- package/dist/ui/ui.js.LEGAL.txt +19 -732
- package/package.json +20 -20
- package/dist/client-1puwLgNx.d.ts +0 -1552
- package/dist/client.d.ts +0 -5
- package/dist/edit-MT4B37QK.js +0 -7
- package/dist/functions.d.ts +0 -13
- package/dist/plugin.d.ts +0 -5
- package/dist/richtext.d.ts +0 -104
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as r}from"./chunk-AL3TN2KI.js";import{Ha as i}from"./chunk-NZHF733K.js";function f(n){let{className:a,as:l,size:t,weight:e,color:o,children:s,...x}=n;return i(l||"div",{...x,className:r(a,"text",t&&`size:${t}`,e&&`weight:${e}`,o&&`color:${o}`),children:s})}export{f as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as D,K as x,R as A,b as k,ea as L,ga as B,i as I,sa as F,v as d,y as M}from"./chunk-NZHF733K.js";import{j as R}from"./chunk-KUCVLANF.js";M();M();var h=R(null);h.displayName="@mantine/modals/ModalsContext";function j(){let o=I(h);if(!o)throw new Error("[@mantine/modals] useModals hook was called outside of context, wrap your app with ModalsProvider component");return o}M();M();var W=Object.defineProperty,X=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable,V=(o,r,e)=>r in o?W(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e,S=(o,r)=>{for(var e in r||(r={}))Z.call(r,e)&&V(o,e,r[e]);if(T)for(var e of T(r))$.call(r,e)&&V(o,e,r[e]);return o},G=(o,r)=>X(o,Y(r));function q({id:o,cancelProps:r,confirmProps:e,labels:c={cancel:"",confirm:""},closeOnConfirm:n=!0,closeOnCancel:s=!0,groupProps:m,onCancel:u,onConfirm:f,children:v}){let{cancel:_,confirm:y}=c,P=j(),w=l=>{typeof r?.onClick=="function"&&r?.onClick(l),typeof u=="function"&&u(),s&&P.closeModal(o)},b=l=>{typeof e?.onClick=="function"&&e?.onClick(l),typeof f=="function"&&f(),n&&P.closeModal(o)};return d.createElement(d.Fragment,null,v&&d.createElement(A,{mb:"md"},v),d.createElement(B,S({position:"right"},m),d.createElement(L,G(S({variant:"default"},r),{onClick:w}),r?.children||_),d.createElement(L,G(S({},e),{onClick:b}),e?.children||y)))}function z(o,r){switch(r.type){case"OPEN":return{current:r.payload,modals:[...o.modals,r.payload]};case"CLOSE":return{current:o.modals[o.modals.length-2]||null,modals:o.modals.filter(e=>e.id!==r.payload)};case"CLOSE_ALL":return{current:o.current,modals:[]};default:return o}}var oo=Object.defineProperty,ro=Object.defineProperties,eo=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,H=(o,r,e)=>r in o?oo(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e,E=(o,r)=>{for(var e in r||(r={}))K.call(r,e)&&H(o,e,r[e]);if(g)for(var e of g(r))Q.call(r,e)&&H(o,e,r[e]);return o},J=(o,r)=>ro(o,eo(r)),N=(o,r)=>{var e={};for(var c in o)K.call(o,c)&&r.indexOf(c)<0&&(e[c]=o[c]);if(o!=null&&g)for(var c of g(o))r.indexOf(c)<0&&Q.call(o,c)&&(e[c]=o[c]);return e};function to(o){if(!o)return{confirmProps:{},modalProps:{}};let r=o,{id:e,children:c,onCancel:n,onConfirm:s,closeOnConfirm:m,closeOnCancel:u,cancelProps:f,confirmProps:v,groupProps:_,labels:y}=r,P=N(r,["id","children","onCancel","onConfirm","closeOnConfirm","closeOnCancel","cancelProps","confirmProps","groupProps","labels"]);return{confirmProps:{id:e,children:c,onCancel:n,onConfirm:s,closeOnConfirm:m,closeOnCancel:u,cancelProps:f,confirmProps:v,groupProps:_,labels:y},modalProps:E({id:e},P)}}function no({children:o,modalProps:r,labels:e,modals:c}){let[n,s]=k(z,{modals:[],current:null}),m=l=>{n.modals.forEach(t=>{var a,p,i,O;t.type==="confirm"&&l&&((p=(a=t.props)==null?void 0:a.onCancel)==null||p.call(a)),(O=(i=t.props)==null?void 0:i.onClose)==null||O.call(i)}),s({type:"CLOSE_ALL"})},u=l=>{let t=l.id||x();return s({type:"OPEN",payload:{id:t,type:"content",props:l}}),t},f=l=>{let t=l.id||x();return s({type:"OPEN",payload:{id:t,type:"confirm",props:l}}),t},v=(l,t)=>{let a=t.id||x();return s({type:"OPEN",payload:{id:a,type:"context",props:t,ctx:l}}),a},_=(l,t)=>{var a,p,i,O;if(n.modals.length<=1){m(t);return}let C=n.modals.find(U=>U.id===l);C?.type==="confirm"&&t&&((p=(a=C.props)==null?void 0:a.onCancel)==null||p.call(a)),(O=(i=C?.props)==null?void 0:i.onClose)==null||O.call(i),s({type:"CLOSE",payload:C.id})},y={modals:n.modals,openModal:u,openConfirmModal:f,openContextModal:v,closeModal:_,closeAll:m},P=()=>{var l;switch((l=n.current)==null?void 0:l.type){case"context":{let t=n.current.props,{innerProps:a}=t,p=N(t,["innerProps"]),i=c[n.current.ctx];return{modalProps:p,content:d.createElement(i,{innerProps:a,context:y,id:n.current.id})}}case"confirm":{let{modalProps:t,confirmProps:a}=to(n.current.props);return{modalProps:t,content:d.createElement(q,J(E({},a),{id:n.current.id,labels:n.current.props.labels||e}))}}case"content":{let t=n.current.props,{children:a}=t;return{modalProps:N(t,["children"]),content:d.createElement(d.Fragment,null,a)}}default:return{modalProps:{},content:null}}},{modalProps:w,content:b}=P();return d.createElement(h.Provider,{value:y},d.createElement(F,J(E(E({},r),w),{opened:n.modals.length>0,onClose:()=>_(n.current.id)}),b),o)}function bo(){let o=D();return{overlayColor:o.colorScheme==="dark"?o.colors.dark[9]:o.colors.gray[2],overlayOpacity:.55,overlayBlur:3}}export{j as a,no as b,bo as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as at,D as st,G as pt,J as ut,K as ft,M as lt,N as ct,R as dt,X as mt,Z as ht,c as T,e as w,n as it,na as L,s as S,t as C,ua as Et,v as l,y as h}from"./chunk-NZHF733K.js";import{j as ot}from"./chunk-KUCVLANF.js";h();var R={show:"mantine:show-notification",hide:"mantine:hide-notification",update:"mantine:update-notification",clean:"mantine:clean-notifications",cleanQueue:"mantine:clean-notifications-queue"};function G(t,e){return new CustomEvent(t,{detail:e})}function $t(t){window.dispatchEvent(G(R.show,t))}function Yt(t){window.dispatchEvent(G(R.update,t))}function Bt(t){window.dispatchEvent(G(R.hide,t))}function vt(t){let e={show:n=>t.showNotification(n.detail),hide:n=>t.hideNotification(n.detail),update:n=>t.updateNotification(n.detail.id,n.detail),clean:t.clean,cleanQueue:t.cleanQueue};T(()=>(Object.keys(e).forEach(n=>{window.addEventListener(R[n],e[n])}),()=>{Object.keys(e).forEach(n=>{window.removeEventListener(R[n],e[n])})}),[])}h();function D(t,e){return D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,o){return i.__proto__=o,i},D(t,e)}function I(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,D(t,e)}h();h();var W={disabled:!1};h();var O=l.createContext(null);var xt=function(e){return e.scrollTop};var M="unmounted",y="exited",_="entering",b="entered",Q="exiting",E=(function(t){I(e,t);function e(i,o){var r;r=t.call(this,i,o)||this;var a=o,s=a&&!a.isMounting?i.enter:i.appear,p;return r.appearStatus=null,i.in?s?(p=y,r.appearStatus=_):p=b:i.unmountOnExit||i.mountOnEnter?p=M:p=y,r.state={status:p},r.nextCallback=null,r}e.getDerivedStateFromProps=function(o,r){var a=o.in;return a&&r.status===M?{status:y}:null};var n=e.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(o){var r=null;if(o!==this.props){var a=this.state.status;this.props.in?a!==_&&a!==b&&(r=_):(a===_||a===b)&&(r=Q)}this.updateStatus(!1,r)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,r,a,s;return r=a=s=o,o!=null&&typeof o!="number"&&(r=o.exit,a=o.enter,s=o.appear!==void 0?o.appear:a),{exit:r,enter:a,appear:s}},n.updateStatus=function(o,r){if(o===void 0&&(o=!1),r!==null)if(this.cancelNextCallback(),r===_){if(this.props.unmountOnExit||this.props.mountOnEnter){var a=this.props.nodeRef?this.props.nodeRef.current:l.findDOMNode(this);a&&xt(a)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===y&&this.setState({status:M})},n.performEnter=function(o){var r=this,a=this.props.enter,s=this.context?this.context.isMounting:o,p=this.props.nodeRef?[s]:[l.findDOMNode(this),s],u=p[0],f=p[1],c=this.getTimeouts(),d=s?c.appear:c.enter;if(!o&&!a||W.disabled){this.safeSetState({status:b},function(){r.props.onEntered(u)});return}this.props.onEnter(u,f),this.safeSetState({status:_},function(){r.props.onEntering(u,f),r.onTransitionEnd(d,function(){r.safeSetState({status:b},function(){r.props.onEntered(u,f)})})})},n.performExit=function(){var o=this,r=this.props.exit,a=this.getTimeouts(),s=this.props.nodeRef?void 0:l.findDOMNode(this);if(!r||W.disabled){this.safeSetState({status:y},function(){o.props.onExited(s)});return}this.props.onExit(s),this.safeSetState({status:Q},function(){o.props.onExiting(s),o.onTransitionEnd(a.exit,function(){o.safeSetState({status:y},function(){o.props.onExited(s)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(o,r){r=this.setNextCallback(r),this.setState(o,r)},n.setNextCallback=function(o){var r=this,a=!0;return this.nextCallback=function(s){a&&(a=!1,r.nextCallback=null,o(s))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},n.onTransitionEnd=function(o,r){this.setNextCallback(r);var a=this.props.nodeRef?this.props.nodeRef.current:l.findDOMNode(this),s=o==null&&!this.props.addEndListener;if(!a||s){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var p=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],u=p[0],f=p[1];this.props.addEndListener(u,f)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===M)return null;var r=this.props,a=r.children,s=r.in,p=r.mountOnEnter,u=r.unmountOnExit,f=r.appear,c=r.enter,d=r.exit,v=r.timeout,m=r.addEndListener,U=r.onEnter,N=r.onEntering,B=r.onEntered,Z=r.onExit,J=r.onExiting,H=r.onExited,K=r.nodeRef,j=L(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return l.createElement(O.Provider,{value:null},typeof a=="function"?a(o,j):l.cloneElement(l.Children.only(a),j))},e})(l.Component);E.contextType=O;E.propTypes={};function P(){}E.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:P,onEntering:P,onEntered:P,onExit:P,onExiting:P,onExited:P};E.UNMOUNTED=M;E.EXITED=y;E.ENTERING=_;E.ENTERED=b;E.EXITING=Q;var X=E;function q(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}h();h();function k(t,e){var n=function(r){return e&&S(r)?e(r):r},i=Object.create(null);return t&&it.map(t,function(o){return o}).forEach(function(o){i[o.key]=n(o)}),i}function Zt(t,e){t=t||{},e=e||{};function n(f){return f in e?e[f]:t[f]}var i=Object.create(null),o=[];for(var r in t)r in e?o.length&&(i[r]=o,o=[]):o.push(r);var a,s={};for(var p in e){if(i[p])for(a=0;a<i[p].length;a++){var u=i[p][a];s[i[p][a]]=n(u)}s[p]=n(p)}for(a=0;a<o.length;a++)s[o[a]]=n(o[a]);return s}function g(t,e,n){return n[e]!=null?n[e]:t.props[e]}function yt(t,e){return k(t.children,function(n){return C(n,{onExited:e.bind(null,n),in:!0,appear:g(n,"appear",t),enter:g(n,"enter",t),exit:g(n,"exit",t)})})}function _t(t,e,n){var i=k(t.children),o=Zt(e,i);return Object.keys(o).forEach(function(r){var a=o[r];if(S(a)){var s=r in e,p=r in i,u=e[r],f=S(u)&&!u.props.in;p&&(!s||f)?o[r]=C(a,{onExited:n.bind(null,a),in:!0,exit:g(a,"exit",t),enter:g(a,"enter",t)}):!p&&s&&!f?o[r]=C(a,{in:!1}):p&&s&&S(u)&&(o[r]=C(a,{onExited:n.bind(null,a),in:u.props.in,exit:g(a,"exit",t),enter:g(a,"enter",t)}))}}),o}var Jt=Object.values||function(t){return Object.keys(t).map(function(e){return t[e]})},Kt={component:"div",childFactory:function(e){return e}},z=(function(t){I(e,t);function e(i,o){var r;r=t.call(this,i,o)||this;var a=r.handleExited.bind(q(r));return r.state={contextValue:{isMounting:!0},handleExited:a,firstRender:!0},r}var n=e.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},e.getDerivedStateFromProps=function(o,r){var a=r.children,s=r.handleExited,p=r.firstRender;return{children:p?yt(o,s):_t(o,a,s),firstRender:!1}},n.handleExited=function(o,r){var a=k(this.props.children);o.key in a||(o.props.onExited&&o.props.onExited(r),this.mounted&&this.setState(function(s){var p=ht({},s.children);return delete p[o.key],{children:p}}))},n.render=function(){var o=this.props,r=o.component,a=o.childFactory,s=L(o,["component","childFactory"]),p=this.state.contextValue,u=Jt(this.state.children).map(a);return delete s.appear,delete s.enter,delete s.exit,r===null?l.createElement(O.Provider,{value:p},u):l.createElement(O.Provider,{value:p},l.createElement(r,s,u))},e})(l.Component);z.propTypes={};z.defaultProps=Kt;var A=z;h();var $=ot(null);$.displayName="@mantine/notifications/NotificationsContext";function te([t,e],n,i){let o={};return t==="top"&&(o.top=i),t==="bottom"&&(o.bottom=i),e==="left"&&(o.left=i),e==="right"&&(o.right=i),e==="center"&&(o.left="50%",o.transform="translateX(-50%)"),o}var gt=te;var ee=Object.defineProperty,Nt=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,Ot=(t,e,n)=>e in t?ee(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Pt=(t,e)=>{for(var n in e||(e={}))ne.call(e,n)&&Ot(t,n,e[n]);if(Nt)for(var n of Nt(e))re.call(e,n)&&Ot(t,n,e[n]);return t},bt={left:"translateX(-100%)",right:"translateX(100%)","top-center":"translateY(-100%)","bottom-center":"translateY(100%)"},oe={left:"translateX(0)",right:"translateX(0)","top-center":"translateY(0)","bottom-center":"translateY(0)"};function ie({state:t,maxHeight:e,positioning:n,transitionDuration:i}){let[o,r]=n,a=r==="center"?`${o}-center`:r,s={opacity:0,maxHeight:e,transform:bt[a],transitionDuration:`${i}ms, ${i}ms, ${i}ms`,transitionTimingFunction:"cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear",transitionProperty:"opacity, transform, max-height"},p={opacity:1,transform:oe[a]},u={opacity:0,maxHeight:0,transform:bt[a]},f={entering:p,entered:p,exiting:u,exited:u};return Pt(Pt({},s),f[t])}var Tt=ie;h();function ae(t,e){return typeof e=="number"?e:e===!1||t===!1?!1:t}var wt=ae;var se=Object.defineProperty,pe=Object.defineProperties,ue=Object.getOwnPropertyDescriptors,V=Object.getOwnPropertySymbols,Dt=Object.prototype.hasOwnProperty,It=Object.prototype.propertyIsEnumerable,St=(t,e,n)=>e in t?se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ct=(t,e)=>{for(var n in e||(e={}))Dt.call(e,n)&&St(t,n,e[n]);if(V)for(var n of V(e))It.call(e,n)&&St(t,n,e[n]);return t},fe=(t,e)=>pe(t,ue(e)),Rt=(t,e)=>{var n={};for(var i in t)Dt.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&V)for(var i of V(t))e.indexOf(i)<0&&It.call(t,i)&&(n[i]=t[i]);return n};function Mt(t){var e=t,{notification:n,autoClose:i,onHide:o,innerRef:r}=e,a=Rt(e,["notification","autoClose","onHide","innerRef"]);let s=n,{autoClose:p}=s,u=Rt(s,["autoClose"]),f=wt(i,p),c=w(),d=()=>{o(n.id),window.clearTimeout(c.current)},v=()=>{clearTimeout(c.current)},m=()=>{typeof f=="number"&&(c.current=window.setTimeout(d,f))};return T(()=>{typeof n.onOpen=="function"&&n.onOpen(n)},[]),T(()=>(m(),v),[i,n.autoClose]),l.createElement(Et,fe(Ct(Ct({},u),a),{onClose:d,onMouseEnter:v,onMouseLeave:m,ref:r}),n.message)}Mt.displayName="@mantine/notifications/NotificationContainer";var jt=Mt;var le=st(t=>({notifications:{width:`calc(100% - ${t.spacing.md*2}px)`,boxSizing:"border-box",position:"fixed",zIndex:1e3},notification:{"&:not(:first-of-type)":{marginTop:t.spacing.sm}}})),Lt=le;var ce=Object.defineProperty,de=Object.defineProperties,me=Object.getOwnPropertyDescriptors,kt=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,Vt=(t,e,n)=>e in t?ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ve=(t,e)=>{for(var n in e||(e={}))he.call(e,n)&&Vt(t,n,e[n]);if(kt)for(var n of kt(e))Ee.call(e,n)&&Vt(t,n,e[n]);return t},xe=(t,e)=>de(t,me(e));function ye({limit:t}){let{state:e,queue:n,update:i,cleanQueue:o}=lt({initialValues:[],limit:t});return{notifications:e,queue:n,showNotification:u=>{let f=u.id||ft();return i(c=>u.id&&c.some(d=>d.id===u.id)?c:[...c,xe(ve({},u),{id:f})]),f},updateNotification:(u,f)=>i(c=>{let d=c.findIndex(m=>m.id===u);if(d===-1)return c;let v=[...c];return v[d]=f,v}),hideNotification:u=>i(f=>f.filter(c=>c.id===u?(typeof c.onClose=="function"&&c.onClose(c),!1):!0)),cleanQueue:o,clean:()=>i(()=>[])}}var Ft=ye;var _e=Object.defineProperty,F=Object.getOwnPropertySymbols,Ht=Object.prototype.hasOwnProperty,Gt=Object.prototype.propertyIsEnumerable,Ut=(t,e,n)=>e in t?_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Y=(t,e)=>{for(var n in e||(e={}))Ht.call(e,n)&&Ut(t,n,e[n]);if(F)for(var n of F(e))Gt.call(e,n)&&Ut(t,n,e[n]);return t},ge=(t,e)=>{var n={};for(var i in t)Ht.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&F)for(var i of F(t))e.indexOf(i)<0&&Gt.call(t,i)&&(n[i]=t[i]);return n},Ne=["top-left","top-right","top-center","bottom-left","bottom-right","bottom-center"];function Wt(t){var e=t,{className:n,position:i="bottom-right",autoClose:o=4e3,transitionDuration:r=250,containerWidth:a=440,notificationMaxHeight:s=200,limit:p=5,zIndex:u=at("overlay"),style:f,children:c}=e,d=ge(e,["className","position","autoClose","transitionDuration","containerWidth","notificationMaxHeight","limit","zIndex","style","children"]);let v=ut(),m=w({}),U=w(0),{notifications:N,queue:B,showNotification:Z,updateNotification:J,hideNotification:H,clean:K,cleanQueue:j}=Ft({limit:p}),tt=ct()?1:r,{classes:et,cx:Qt,theme:Xt}=Lt(),nt=(Ne.includes(i)?i:"bottom-right").split("-"),rt={notifications:N,queue:B,showNotification:Z,hideNotification:H,updateNotification:J,clean:K,cleanQueue:j};pt(()=>{N.length>U.current&&setTimeout(()=>v(),0),U.current=N.length},[N]),vt(rt);let qt=N.map(x=>l.createElement(X,{key:x.id,timeout:tt,onEnter:()=>m.current[x.id].offsetHeight,nodeRef:{current:m.current[x.id]}},zt=>l.createElement(jt,{innerRef:At=>{m.current[x.id]=At},notification:x,onHide:H,className:et.notification,autoClose:o,sx:[Y({},Tt({state:zt,positioning:nt,transitionDuration:tt,maxHeight:s})),...Array.isArray(x.sx)?x.sx:[x.sx]]})));return l.createElement($.Provider,{value:rt},l.createElement(mt,{zIndex:u},l.createElement(dt,Y({className:Qt(et.notifications,n),style:f,sx:Y({maxWidth:a},gt(nt,a,Xt.spacing.md))},d),l.createElement(A,null,qt))),c)}Wt.displayName="@mantine/notifications/NotificationsProvider";export{$t as a,Yt as b,Bt as c,Wt as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as h}from"./chunk-YDO2EDVY.js";import{g as y}from"./chunk-XOQ3KDSR.js";import{a as x}from"./chunk-5MV6XVGA.js";import{c as f,n as g}from"./chunk-EGEB6N4J.js";async function b(e){let t=window.firebase.db,s=window.__ROOT_CTX.rootConfig.projectId,[a,c]=e.split("/",2),o=await h(a),r=f(t,"Projects",s,"Collections",a,"Drafts",c),i=(await g(r)).data()||{},p=new Set;return m(p,o.fields,i.fields||{},o.types||{}),Array.from(p)}async function C(e){let t=window.firebase.db,s=window.__ROOT_CTX.rootConfig.projectId,[a,c]=e.split("/",2),o=await h(a),r=f(t,"Projects",s,"Collections",a,"Drafts",c),i=(await g(r)).data()||{},p=new Map;return d(p,o.fields,i.fields||{},o.types||{}),p}function m(e,t,s,a={}){t.forEach(c=>{if(!c.id)return;let o=s[c.id],r=`@${c.id}`;s[r]?.disableTranslations||R(e,c,o,a)})}function d(e,t,s,a={}){t.forEach(c=>{if(!c.id)return;let o=s[c.id],r=`@${c.id}`,n=s[r];if(n?.disableTranslations)return;let i=n?.description;S(e,c,o,a,i)})}function R(e,t,s,a={}){if(!s)return;function c(o){let r=y(o);r&&e.add(r)}if(t.type==="object")m(e,t.fields||[],s,a);else if(t.type==="array"){let o=s._array||[];for(let r of o)R(e,t.of,s[r],a)}else if(t.type==="string"||t.type==="select")t.translate&&c(s);else if(t.type==="image")t.translate&&s&&s.alt&&t.alt!==!1&&c(s.alt);else if(t.type==="multiselect"){if(t.translate&&Array.isArray(s))for(let o of s)c(o)}else if(t.type==="oneof"){let o=t.types||[],r;typeof o[0]=="string"?o.includes(s._type)&&(r=a[s._type]):r=o.find(n=>n.name===s._type),r&&m(e,r.fields||[],s,a)}else t.type==="richtext"?t.translate&&T(e,s):console.log(`extract: ignoring field, id=${t.id}, type=${t.type}`)}function S(e,t,s,a={},c){if(!s)return;function o(r){let n=y(r);if(n){let i=e.get(n);(!i||!i.description)&&e.set(n,{description:c})}}if(t.type==="object")d(e,t.fields||[],s,a);else if(t.type==="array"){let r=s._array||[];for(let n of r)S(e,t.of,s[n],a,c)}else if(t.type==="string"||t.type==="select")t.translate&&o(s);else if(t.type==="image")t.translate&&s&&s.alt&&t.alt!==!1&&o(s.alt);else if(t.type==="multiselect"){if(t.translate&&Array.isArray(s))for(let r of s)o(r)}else if(t.type==="oneof"){let r=t.types||[],n;typeof r[0]=="string"?r.includes(s._type)&&(n=a[s._type]):n=r.find(i=>i.name===s._type),n&&d(e,n.fields||[],s,a)}else if(t.type==="richtext"&&t.translate){let r=new Set;T(r,s),r.forEach(n=>o(n))}}function T(e,t){(t?.blocks||[]).forEach(a=>{w(e,a)})}function w(e,t){if(!t?.type)return;function s(r){if(!r)return;let n=y(r);n&&e.add(n)}function a(r){r&&Object.values(r).forEach(n=>{c(n)})}function c(r){if(typeof r=="string"){s(r);return}if(Array.isArray(r)){r.forEach(n=>c(n));return}x(r)&&Object.values(r).forEach(n=>c(n))}function o(r){r&&r.forEach(n=>{s(n.content),a(n.components),o(n.items)})}t.type==="heading"||t.type==="paragraph"?(s(t.data?.text),a(t.data?.components)):t.type==="orderedList"||t.type==="unorderedList"?o(t.data?.items):t.type==="html"?s(t.data?.html):t.type==="table"&&(t.data?.rows||[]).forEach(n=>{(n.cells||[]).forEach(p=>{(p.blocks||[]).forEach(_=>{w(e,_)})})})}export{b as a,C as b,R as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=/^[a-z0-9_]+(?:--?[a-z0-9_]+)*$/;function s(e,r){r||(r=n);let t=typeof r=="string"?new RegExp(r):r;return!!(e&&t.test(e))}function o(e,r){if(!e)return"Slug cannot be empty.";if(r){let t=typeof r=="string"?new RegExp(r):r;return t.test(e)?"":`Slug does not match required pattern: ${t.source}`}return/[A-Z]/.test(e)?"Slug must not contain uppercase letters.":/[^a-z0-9_-]/.test(e)?"Slug can only contain lowercase letters, numbers, dashes, and underscores.":e.startsWith("-")?"Slug must not start with a dash.":e.endsWith("-")?"Slug must not end with a dash.":n.test(e)?"":'Invalid slug format. Use only lowercase letters, numbers, dashes, and underscores (e.g. "foo-bar-123").'}function i(e){return e.replace(/^[\s/]*/g,"").replace(/[\s/]*$/g,"").replace(/^\/+|\/+$/g,"").replaceAll("/","--")}export{s as a,o as b,i as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as _}from"./chunk-4KE2SZKH.js";import{a as S,c as u}from"./chunk-HRGYNHZ3.js";import{Ha as e,V as n,a as l,c as d,ea as c,j as x}from"./chunk-NZHF733K.js";x();var r="DataSourceSelectModal";function L(){let a=S(),t=u();return{open:i=>{a.openContextModal(r,{...t,innerProps:i,size:"600px",overflow:"inside"})},close:()=>{a.closeModal(r)}}}function h(a){let{innerProps:t}=a,[i,m]=l(!0),[s,p]=l([]),D=t.selectedDataSourceIds||[];d(()=>{async function o(){let v=await _();p(v.filter(g=>!g.archivedAt)),m(!1)}o()},[]);function f(o){t.onChange&&t.onChange(o,!0)}function M(o){t.onChange&&t.onChange(o,!1)}return e("div",{className:"DataSourceSelectModal",children:i?e("div",{className:"DataSourceSelectModal__loading",children:e(n,{color:"gray",size:"xl"})}):s.length===0?e("div",{className:"DataSourceSelectModal__empty",children:"No data sources."}):e("div",{className:"DataSourceSelectModal__list",children:s.map(o=>e("div",{className:"DataSourceSelectModal__item",children:[e("div",{className:"DataSourceSelectModal__item__info",children:[e("div",{className:"DataSourceSelectModal__item__id",children:o.id}),e("div",{className:"DataSourceSelectModal__item__description",children:o.description||""})]}),e("div",{className:"DataSourceSelectModal__item__action",children:D.includes(o.id)?e(c,{variant:"light",color:"blue",size:"xs",onClick:()=>M(o.id),children:"Unselect"}):e(c,{variant:"filled",color:"blue",size:"xs",onClick:()=>f(o.id),children:"Select"})})]},o.id))})})}h.id=r;export{L as a,h as b};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{a as _t,b as ht,c as ut,d as tt}from"./chunk-PHBMVORG.js";import{a as lt,b as mt,d as Z}from"./chunk-JZFTZ4X4.js";import{b as dt,d as ct}from"./chunk-HKINZLMW.js";import{f as pt}from"./chunk-SKEP5WYH.js";import{f as K}from"./chunk-5MV6XVGA.js";import{d as at,f as M}from"./chunk-AL3TN2KI.js";import{$a as X,Bc as rt,Ga as O,Ha as t,Pc as st,Uc as B,V,W as E,_a as q,a as p,ab as Y,c as k,ca as J,e as N,ea as S,ec as G,g as ot,h as T,j as At,jc as Q,kc as it,mb as nt,ra as $,vc as j}from"./chunk-NZHF733K.js";import{d as et}from"./chunk-KUCVLANF.js";At();function ft(o){let{size:e=14}=o,a=e*3.57,i=e*2;return t("div",{className:"BouncingLoader",style:{"--dot-size":`${e}px`,width:`${a}px`,height:`${i}px`}})}var W=[{id:"read",label:"Read only",description:"Inspect CMS content without planning or applying writes."},{id:"approve",label:"Ask before writing",description:"Read freely, then pause for approval before draft edits."},{id:"auto",label:"Auto-apply draft edits",description:"Apply draft-only writes without approval in this chat."}],It="root-cms.ai.executionMode",vt="root-cms.ai.selectedModel";function bt(o){return W.some(e=>e.id===o)}function Rt(){if(typeof window>"u")return"approve";try{let o=window.localStorage.getItem(It);if(bt(o))return o}catch(o){console.error("failed to read AI execution mode preference",o)}return"approve"}function yt(o){if(typeof window>"u")return null;try{let e=window.localStorage.getItem(vt);if(e&&o.some(a=>a.id===e))return e}catch(e){console.error("failed to read AI model preference",e)}return null}function wt(o){if(!(typeof window>"u"))try{window.localStorage.setItem(vt,o)}catch(e){console.error("failed to save AI model preference",e)}}function kt(o){if(!(typeof window>"u"))try{window.localStorage.setItem(It,o)}catch(e){console.error("failed to save AI execution mode preference",e)}}var U="";function Ie(o){let[e,a]=p(null),[i,m]=p("");k(()=>{let r=!0;return fetch("/cms/api/ai.config",{credentials:"include"}).then(async l=>{let g=await l.json();r&&a(g)}).catch(l=>{r&&m(String(l))}),()=>{r=!1}},[]);let h=!!e?.enabled&&(e.models?.length||0)>0;return t("div",{className:M("RootAIChat",`RootAIChat--${o.variant}`),children:!e&&!i?t("div",{className:"RootAIChat__loading",children:t(V,{size:"md",color:"gray"})}):h?t(Mt,{variant:o.variant,config:e,initialChatId:o.variant==="panel"?void 0:o.initialChatId,docContext:o.docContext,onClose:o.onClose}):t(Nt,{error:i,onClose:o.onClose})})}function Nt(o){return t("div",{className:"RootAIChat__notEnabled",children:[o.onClose&&t(E,{className:"RootAIChat__notEnabled__close",onClick:o.onClose,title:"Close",children:t(B,{size:16})}),t("div",{className:"RootAIChat__notEnabled__icon",children:t(j,{size:36})}),t("div",{className:"RootAIChat__notEnabled__title",children:"Root AI is not configured for this project."}),t("div",{className:"RootAIChat__notEnabled__body",children:["Add an ",t("code",{children:"ai.models"})," entry to ",t("code",{children:"cmsPlugin()"})," in"," ",t("code",{children:"root.config.ts"}),"."]}),o.error&&t("pre",{className:"RootAIChat__notEnabled__error",children:o.error})]})}function Mt(o){let e=o.variant==="panel",{route:a}=at(),i=o.config.models||[],m=()=>yt(i)||o.config.defaultModel||i[0]?.id||"",[h,r]=p(m),[l,g]=p(Rt),[u,I]=p(o.initialChatId||U),[P,y]=p(o.initialChatId||U),[D,s]=p([]),[f,x]=p([]),[v,w]=p(0),z=async()=>{if(!e)try{let R=await(await fetch("/cms/api/ai.chats.list",{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({})})).json();R.success&&x(R.chats||[])}catch(d){console.error("failed to load chat list",d)}};k(()=>{z(),!e&&o.initialChatId&&n(o.initialChatId)},[]),k(()=>{kt(l)},[l]);let n=async d=>{try{let b=await(await fetch("/cms/api/ai.chats.get",{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({id:d})})).json();if(!b.success)return;I(d),y(d),s(b.chat.messages||[]),b.chat.modelId&&i.find(F=>F.id===b.chat.modelId)&&r(b.chat.modelId),w(L=>L+1)}catch(R){console.error("failed to load chat",R)}},_=()=>{r(m()),I(U),y(U),s([]),w(d=>d+1),e||a("/cms/ai")},c=async d=>{if(d!==P)try{let b=await(await fetch("/cms/api/ai.chats.get",{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({id:d})})).json();if(!b.success)return;I(d),y(d),s(b.chat.messages||[]),b.chat.modelId&&i.find(F=>F.id===b.chat.modelId)&&r(b.chat.modelId),w(L=>L+1),e||a(`/cms/ai/chat/${d}`)}catch(R){console.error("failed to load chat",R)}},C=async d=>{try{await fetch("/cms/api/ai.chats.delete",{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({id:d})}),P===d&&_(),z()}catch(R){console.error("failed to delete chat",R)}},A=i.find(d=>d.id===h)||i[0],H=d=>{r(d),wt(d)};return t("div",{className:"RootAIChat__layout",children:[!e&&t(Tt,{chats:f,activeChatId:P,onSelect:c,onNew:_,onDelete:C}),t("div",{className:"RootAIChat__main",children:[e&&t(Pt,{onNewChat:_,onClose:o.onClose}),t(zt,{initialChatId:u,model:A,initialMessages:D,executionMode:l,models:i,selectedModel:A,docContext:o.docContext,onSelectModel:H,onSelectExecutionMode:g,onChatPersisted:d=>{y(d),z(),e||window.history.replaceState(null,"",`/cms/ai/chat/${d}`)}},v)]})]})}function Pt(o){return t("div",{className:"RootAIChat__panelHeader",children:[t("div",{className:"RootAIChat__panelHeader__title",children:[t(j,{size:14}),t("span",{children:"Root AI"})]}),t("div",{className:"RootAIChat__panelHeader__actions",children:[t(O,{label:"New chat",children:t(E,{size:"xs",onClick:o.onNewChat,children:t(G,{size:14})})}),o.onClose&&t(O,{label:"Close (\u2318 + i)",children:t(E,{size:"xs",onClick:o.onClose,children:t(B,{size:14})})})]})]})}function Tt(o){return t("aside",{className:"RootAIChat__sidebar",children:[t("button",{type:"button",className:"RootAIChat__sidebar__newButton",onClick:o.onNew,children:[t(G,{size:18}),t("span",{children:"New chat"})]}),t("div",{className:"RootAIChat__sidebar__list",children:[o.chats.length===0&&t("div",{className:"RootAIChat__sidebar__empty",children:"No chats yet."}),o.chats.map(e=>t("div",{className:M("RootAIChat__sidebar__item",e.id===o.activeChatId&&"RootAIChat__sidebar__item--active"),onClick:()=>o.onSelect(e.id),children:[t("div",{className:"RootAIChat__sidebar__item__title",title:e.title||"Untitled chat",children:e.title||"Untitled chat"}),t("button",{type:"button",className:"RootAIChat__sidebar__item__delete",title:"Delete chat",onClick:a=>{a.stopPropagation(),window.confirm("Delete this chat?")&&o.onDelete(e.id)},children:t(st,{size:14})})]},e.id))]})]})}function Et(o){let e=W.find(a=>a.id===o.executionMode)||W[0];return t("div",{className:"RootAIChat__options",children:[t($,{control:t(S,{type:"button",className:"RootAIChat__modePicker",variant:"subtle",color:"dark",size:"xs",compact:!0,leftIcon:t(it,{size:16}),children:e.label}),children:W.map(a=>t($.Item,{onClick:()=>o.onSelectExecutionMode(a.id),children:t("div",{className:"RootAIChat__modePicker__option",children:[t("div",{className:"RootAIChat__modePicker__option__label",children:a.label}),t("div",{className:"RootAIChat__modePicker__option__description",children:a.description})]})},a.id))}),t($,{control:t(S,{type:"button",className:"RootAIChat__modelPicker",variant:"subtle",color:"dark",size:"xs",compact:!0,leftIcon:t(j,{size:16}),children:o.selectedModel?.label||"Select model"}),children:o.models.map(a=>t($.Item,{onClick:()=>o.onSelectModel(a.id),children:t("div",{className:"RootAIChat__modelPicker__option",children:[t("div",{className:"RootAIChat__modelPicker__option__label",children:a.label}),a.description&&t("div",{className:"RootAIChat__modelPicker__option__description",children:a.description})]})},a.id))})]})}function zt(o){let[e]=p(()=>o.initialChatId||Gt()),a=N(o.model?.id);a.current=o.model?.id;let i=N(o.executionMode);i.current=o.executionMode;let m=N(o.docContext);m.current=o.docContext;let[h,r]=p({}),l=N({});k(()=>()=>{for(let n of Object.values(l.current))n("reject");l.current={}},[]);let g=T((n,_,c,C)=>new Promise(A=>{l.current[n]=A,r(H=>({...H,[n]:{toolCallId:n,toolName:_,input:c,preview:C,status:"pending"}}))}),[]),u=T(n=>{r(_=>{let c=_[n];return c?{..._,[n]:{...c,status:"executing"}}:_}),l.current[n]?.("approve"),delete l.current[n]},[]),I=T(n=>{r(_=>{let c={..._};return delete c[n],c}),l.current[n]?.("reject"),delete l.current[n]},[]),P=T(async n=>{if(!ht(n.toolName))return await tt(n.toolName,n.input);let _=i.current;if(_==="read")return{success:!1,error:"WRITE_BLOCKED_BY_MODE",message:"The current execution mode is read only. Do not call write tools."};let c;try{c=await ut(n.toolName,n.input)}catch(C){return{success:!1,error:"PREVIEW_FAILED",message:C?.message||String(C)}}if(c.error)return{success:!1,error:c.error,message:c.summary,errors:c.errors,hint:c.hint};if(_==="approve"&&await g(n.toolCallId,n.toolName,n.input,c)==="reject")return{success:!1,error:"USER_REJECTED",message:"The user rejected this draft change. Do not retry unless they ask for a revised version."};try{return await tt(n.toolName,n.input)}finally{r(C=>{if(!C[n.toolCallId])return C;let A={...C};return delete A[n.toolCallId],A})}},[g]),y=ot(()=>new dt({api:"/cms/api/ai.chat",credentials:"include",prepareSendMessagesRequest:({messages:n})=>({body:{message:n.at(-1),chatId:e,modelId:a.current,executionMode:i.current,docId:m.current?.docId}})}),[e]),{messages:D,sendMessage:s,status:f,error:x,stop:v,addToolOutput:w}=_t({id:e,messages:o.initialMessages,transport:y,sendAutomaticallyWhen:ct,onToolCall:async({toolCall:n})=>{let _=await P(n);w({tool:n.toolName,toolCallId:n.toolCallId,output:_})},onFinish:()=>{o.onChatPersisted(e)}}),z=f==="streaming"||f==="submitted";return t(et,{children:[t(St,{messages:D,isStreaming:z,emptyMessage:o.model?void 0:"Select a model to start.",toolApprovals:{approvals:h,onApprove:u,onReject:I}}),x&&t("div",{className:"RootAIChat__error",children:[t("strong",{children:"Error:"})," ",x.message]}),t(Vt,{disabled:!o.model,canAttach:o.model?.capabilities.attachments??!1,isStreaming:z,onStop:v,controls:t(Et,{models:o.models,selectedModel:o.selectedModel,onSelectModel:o.onSelectModel,executionMode:o.executionMode,onSelectExecutionMode:o.onSelectExecutionMode}),onSend:(n,_)=>{if(!n&&_.length===0)return;let c=Jt(_),C=[n,c.text].filter(Boolean).join(`
|
|
2
|
+
|
|
3
|
+
`);s({text:C,files:c.files.map(A=>({type:"file",mediaType:A.mediaType,url:A.url,filename:A.filename}))})}})]})}function St(o){let e=N(null);return k(()=>{let a=e.current;a&&(a.scrollTop=a.scrollHeight)},[o.messages]),o.messages.length===0?t("div",{className:"RootAIChat__transcript RootAIChat__transcript--empty",ref:e,children:t("div",{className:"RootAIChat__welcome",children:[t("div",{className:"RootAIChat__welcome__icon",children:t(j,{size:36})}),t("div",{className:"RootAIChat__welcome__title",children:"Root AI"}),t("div",{className:"RootAIChat__welcome__body",children:o.emptyMessage||"What are we going to get done today?"})]})}):t("div",{className:"RootAIChat__transcript",ref:e,children:t("div",{className:"RootAIChat__transcript__inner",children:[o.messages.map(a=>t(jt,{message:a,toolApprovals:o.toolApprovals},a.id)),o.isStreaming&&t("div",{className:"RootAIChat__streamingIndicator",children:t(ft,{size:6})})]})})}function jt(o){let e=o.message,a=e.role==="user",i=a?"You":"Root AI",m=a?window.firebase.user?.photoURL:null,[h,r]=p(!1),l=T(()=>(e.parts||[]).filter(u=>u.type==="text"&&u.text).map(u=>u.text).join(`
|
|
4
|
+
|
|
5
|
+
`),[e.parts]),g=T(async()=>{let u=l();if(!u)return;let I=mt.parse(u);try{await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([I],{type:"text/html"}),"text/plain":new Blob([u],{type:"text/plain"})})]),r(!0),setTimeout(()=>r(!1),2e3)}catch{await navigator.clipboard.writeText(u),r(!0),setTimeout(()=>r(!1),2e3)}},[l]);return t("div",{className:M("RootAIChat__message",`RootAIChat__message--${e.role}`),children:[t("div",{className:"RootAIChat__message__avatar",children:m?t("img",{src:m,alt:i}):t(j,{size:20})}),t("div",{className:"RootAIChat__message__body",children:[t("div",{className:"RootAIChat__message__username",children:i}),t("div",{className:"RootAIChat__message__parts",children:(e.parts||[]).map((u,I)=>t(Dt,{part:u,toolApprovals:o.toolApprovals},I))}),t("button",{type:"button",className:M("RootAIChat__message__copy",h&&"RootAIChat__message__copy--copied"),title:h?"Copied!":"Copy message",onClick:g,children:h?t(q,{size:14}):t(nt,{size:14})})]})]})}function Dt(o){let e=o.part;return e.type==="text"?e.text?t("div",{className:"RootAIChat__textPart",children:t(Z,{code:e.text})}):null:e.type==="reasoning"?t(Lt,{text:e.text}):e.type==="file"?t($t,{part:e}):e.type==="source-url"?t("a",{className:"RootAIChat__sourcePart",href:e.url,target:"_blank",rel:"noopener noreferrer",children:e.title||e.url}):typeof e.type=="string"&&e.type.startsWith("tool-")?t(gt,{part:e,toolApprovals:o.toolApprovals}):e.type==="dynamic-tool"?t(gt,{part:e,toolApprovals:o.toolApprovals}):e.type==="step-start"?null:t("div",{className:"RootAIChat__unknownPart",children:t("pre",{children:JSON.stringify(e,null,2)})})}function Lt(o){let[e,a]=p(!1);return o.text?t("div",{className:M("RootAIChat__reasoning",e&&"RootAIChat__reasoning--open"),children:[t("button",{type:"button",className:"RootAIChat__reasoning__toggle",onClick:()=>a(!e),children:[t(X,{size:14,style:{transform:e?"rotate(0deg)":"rotate(-90deg)"}}),t("span",{children:"Thinking"})]}),e&&t("div",{className:"RootAIChat__reasoning__body",children:t(Z,{code:o.text})})]}):null}function $t(o){let e=o.part;return e.mediaType?.startsWith("image/")?t("div",{className:"RootAIChat__filePart",children:t("img",{src:e.url,alt:e.filename||"attachment"})}):t("a",{className:"RootAIChat__filePart RootAIChat__filePart--link",href:e.url,target:"_blank",rel:"noopener noreferrer",children:[t(Q,{size:14}),t("span",{children:e.filename||e.url})]})}function gt(o){let e=o.part,a=typeof e.type=="string"&&e.type.startsWith("tool-")?e.type.slice(5):e.toolName||"tool",i=e.state||"",m=Bt(e),h=o.toolApprovals,r=m?h?.approvals[m]:void 0,[l,g]=p(!!r);return k(()=>{r&&g(!0)},[r]),t("div",{className:"RootAIChat__tool",children:[t("button",{type:"button",className:"RootAIChat__tool__header",onClick:()=>g(!l),children:[t(X,{className:M("RootAIChat__tool__header__icon",l&&"RootAIChat__tool__header__icon--open"),size:14}),t(J,{color:"dark",variant:"filled",size:"xs",children:a}),t("span",{className:"RootAIChat__tool__title",children:Ot(a,e.input)}),t("span",{className:"RootAIChat__tool__state",children:r?Ht(r.status):Ft(i)})]}),l&&t("div",{className:"RootAIChat__tool__body",children:[r&&h&&t(Ut,{approval:r,onApprove:()=>h.onApprove(r.toolCallId),onReject:()=>h.onReject(r.toolCallId)}),e.output?.receipt&&t(Wt,{output:e.output}),e.input&&t("details",{children:[t("summary",{children:[t(Y,{size:14,className:"RootAIChat__tool__json__icon"}),t("span",{children:"Input"})]}),t("pre",{children:JSON.stringify(e.input,null,2)})]}),e.output&&t("details",{children:[t("summary",{children:[t(Y,{size:14,className:"RootAIChat__tool__json__icon"}),t("span",{children:"Output"})]}),t("pre",{children:JSON.stringify(e.output,null,2)})]}),e.errorText&&t("div",{className:"RootAIChat__tool__error",children:e.errorText})]})]})}function Bt(o){return o.toolCallId||o.id||""}function Ot(o,e){switch(o){case"collections_list":return"List collections";case"docs_list":return`List ${e?.collectionId||"documents"}`;case"docs_search":return`Search docs${e?.query?` for "${e.query}"`:""}`;case"doc_get":return`Read ${e?.docId||"document"}`;case"doc_getVersion":return`Read ${e?.docId||"document"} version`;case"doc_set":return`Replace ${e?.docId||"draft fields"}`;case"doc_create":return`Create ${e?.docId||"draft document"}`;case"doc_updateField":return`Update ${e?.path||"field"}`;case"doc_edit":return`Edit ${e?.docId||"document"}`;case"doc_duplicate":return`Duplicate ${e?.fromDocId||"document"}`;case"doc_listVersions":return`List versions for ${e?.docId||"document"}`;case"doc_translateField":return"Translate field text";case"schema_get":return`Read ${e?.collectionId||"collection"} schema`;default:return o}}function Ut(o){let e=o.approval.preview,a=e.before!==void 0&&e.after!==void 0;return t("div",{className:"RootAIChat__approval",children:[t("div",{className:"RootAIChat__approval__header",children:[t("div",{children:[t("div",{className:"RootAIChat__approval__title",children:e.title}),t("div",{className:"RootAIChat__approval__summary",children:e.summary})]}),t(J,{className:"RootAIChat__approval__status",variant:"light",color:"gray",children:o.approval.status==="executing"?"Applying":"Review"})]}),e.details.length>0&&t("div",{className:"RootAIChat__approval__details",children:e.details.map(i=>t("div",{children:[t("span",{children:i.label}),t("strong",{children:i.value})]},`${i.label}:${i.value}`))}),a&&t(lt,{className:"RootAIChat__approval__diff",oldCode:K(e.before),newCode:K(e.after)}),t("div",{className:"RootAIChat__approval__actions",children:[t(S,{variant:"default",color:"dark",size:"xs",type:"button",className:"RootAIChat__approval__button",disabled:o.approval.status==="executing",onClick:o.onReject,children:"Reject"}),t(S,{variant:"filled",color:"green",size:"xs",type:"button",className:"RootAIChat__approval__button RootAIChat__approval__button--primary",disabled:o.approval.status==="executing",onClick:o.onApprove,children:"Approve draft edit"})]})]})}function Wt(o){let e=o.output.receipt;return t("div",{className:"RootAIChat__receipt",children:[t("div",{className:"RootAIChat__receipt__title",children:[t(q,{size:14}),t("span",{children:e.title})]}),t("div",{className:"RootAIChat__receipt__summary",children:e.summary}),e.details?.length>0&&t("div",{className:"RootAIChat__receipt__details",children:e.details.map(a=>t("div",{children:[t("span",{children:a.label}),t("strong",{children:a.value})]},`${a.label}:${a.value}`))}),e.adminUrl&&t(S,{component:"a",className:"RootAIChat__receipt__link",variant:"default",size:"xs",compact:!0,href:e.adminUrl,children:"Open document"})]})}function Ht(o){return o==="executing"?"applying\u2026":"waiting for approval"}function Ft(o){switch(o){case"input-streaming":return"preparing\u2026";case"input-available":return"running\u2026";case"output-available":return"done";case"output-error":return"error";default:return o}}function Vt(o){let[e,a]=p(""),[i,m]=p([]),[h,r]=p(!1),l=N(null),g=N(null);k(()=>{window.requestAnimationFrame(()=>{let s=g.current;s&&(s.style.height="auto",s.style.height=`${Math.min(s.scrollHeight,240)}px`)})},[e,i]);let I=()=>{o.disabled||o.isStreaming||!e&&i.length===0||(o.onSend(e,i),a(""),m([]),l.current&&(l.current.value=""))},P=s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),I())},y=async s=>{r(!0);try{let f=s.type||Yt(s.name),x=await qt(s,f),v=await pt(s,{disableGci:!0});m(w=>[...w,{url:v.src,filename:v.filename||s.name,mediaType:f,textContent:x?.text,textTruncated:x?.truncated,width:v.width,height:v.height}])}catch(f){console.error("upload failed",f)}finally{r(!1),l.current&&(l.current.value="")}},D=s=>{let f=s.target;Array.from(f.files||[]).forEach(y)};return t("div",{className:"RootAIChat__composer",children:[i.length>0&&t("div",{className:"RootAIChat__composer__attachments",children:i.map((s,f)=>t("div",{className:"RootAIChat__composer__attachment",children:[s.mediaType.startsWith("image/")?t("img",{src:s.url,alt:s.filename}):t("span",{className:"RootAIChat__composer__attachment__name",children:s.filename}),t("button",{type:"button",className:"RootAIChat__composer__attachment__remove",onClick:()=>m(x=>x.filter((v,w)=>w!==f)),children:t(B,{size:12})})]},f))}),t("div",{className:"RootAIChat__composer__row",children:[t(O,{label:o.canAttach?"Attach file":"Model doesn't support attachments",className:"RootAIChat__composer__attachTooltip",children:t(E,{component:"label",radius:"xl",className:M("RootAIChat__composer__attach",!o.canAttach&&"RootAIChat__composer__attach--disabled"),disabled:!o.canAttach,children:[h?t(V,{size:"xs"}):t(Q,{size:18}),t("input",{ref:l,type:"file",style:{display:"none"},onChange:D})]})}),t("textarea",{ref:g,className:"RootAIChat__composer__textarea",placeholder:o.disabled?"Select a model\u2026":"Ask anything\u2026",value:e,rows:1,autofocus:!0,disabled:o.disabled,onKeyDown:P,onChange:s=>a(s.target.value),onPaste:s=>{let f=s.clipboardData?.items||[];for(let x of f)if(x.kind==="file"){let v=x.getAsFile();v&&o.canAttach&&y(v)}}}),o.isStreaming?t(E,{className:"RootAIChat__composer__button RootAIChat__composer__stopButton",radius:"xl",color:"dark",variant:"filled",onClick:o.onStop,title:"Stop",children:t(B,{size:18})}):t(E,{className:"RootAIChat__composer__button RootAIChat__composer__submitButton",radius:"xl",color:"dark",variant:"filled",disabled:o.disabled||h||!e&&i.length===0,onClick:I,title:"Send",children:t(rt,{size:18})})]}),o.controls]})}var xt=1e5;function Jt(o){let e=o.filter(Ct),a=o.filter(i=>!Ct(i)).map(Kt);return{files:e,text:a.length?`Attached files:
|
|
6
|
+
|
|
7
|
+
${a.join(`
|
|
8
|
+
|
|
9
|
+
`)}`:""}}function Ct(o){return o.mediaType.startsWith("image/")}function Kt(o){let e=`File: ${o.filename} (${o.mediaType})`;if(o.textContent!==void 0){let a=o.textTruncated?`
|
|
10
|
+
|
|
11
|
+
[Content truncated before sending to the model.]`:"";return`${e}
|
|
12
|
+
URL: ${o.url}
|
|
13
|
+
|
|
14
|
+
~~~
|
|
15
|
+
${o.textContent}${a}
|
|
16
|
+
~~~`}return`${e}
|
|
17
|
+
URL: ${o.url}
|
|
18
|
+
|
|
19
|
+
[The file was uploaded, but its binary content was not inlined into this chat message.]`}async function qt(o,e){if(!Xt(o.name,e))return null;let a=await o.text();return a.length<=xt?{text:a,truncated:!1}:{text:a.slice(0,xt),truncated:!0}}function Xt(o,e){return e.startsWith("text/")?!0:[".css",".js",".jsx",".json",".md",".mdx",".mjs",".scss",".ts",".tsx",".txt",".yaml",".yml"].some(a=>o.toLowerCase().endsWith(a))}function Yt(o){let e=o.toLowerCase();return e.endsWith(".png")?"image/png":e.endsWith(".webp")?"image/webp":e.endsWith(".jpg")||e.endsWith(".jpeg")?"image/jpeg":e.endsWith(".gif")?"image/gif":e.endsWith(".svg")?"image/svg+xml":e.endsWith(".pdf")?"application/pdf":e.endsWith(".json")?"application/json":e.endsWith(".csv")?"text/csv":e.endsWith(".md")?"text/markdown":e.endsWith(".txt")?"text/plain":"application/octet-stream"}function Gt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`chat-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}export{Ie as a};
|