@univerjs/preset-docs-core 0.7.0-nightly.202505121607 → 0.7.0

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 (2) hide show
  1. package/lib/umd/index.js +1 -1
  2. package/package.json +11 -11
package/lib/umd/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  [&>*:last-child]:univer-relative dark:[&>*:last-child:after]:univer-bg-gray-600`,E=s.useCallback(w=>{o.current={},_(!0);const A=setTimeout(()=>{_(!1)},300);return L(w.key),()=>{clearTimeout(A)}},[]);s.useEffect(()=>{function w(){const M=n.getMenuByPositionKey(Z1.RIBBON);v(M)}w();const A=n.menuChanged$.subscribe(w);return()=>{A.unsubscribe()}},[n]);const D=s.useMemo(()=>{var N,Z;const w=(Z=(N=c.find(R=>R.key===m))==null?void 0:N.children)!=null?Z:[],A=[],M=[];for(const R of w)if(R.children){const G=R.children.filter(Y=>!S.includes(Y.key));G.length>0&&A.push({...R,children:G}),G.length<R.children.length&&M.push({...R,children:R.children.filter(Y=>S.includes(Y.key))})}return{allGroups:w,visibleGroups:A,hiddenGroups:M}},[c,m,S]);s.useEffect(()=>{const w=new ResizeObserver(A=>{var q,e1;const N=A[0].target.clientWidth,R=Object.values(o.current).sort((W,t1)=>W.groupOrder===t1.groupOrder?W.order-t1.order:W.groupOrder-t1.groupOrder),G=[];let Y=0;const J=(((e1=(q=c.find(W=>W.key===m))==null?void 0:q.children)!=null?e1:[]).length-1)*8;Y+=J;for(const{el:W,key:t1}of R)W&&(Y+=(W==null?void 0:W.getBoundingClientRect().width)+8,Y>N-32-J&&G.push(t1));JSON.stringify(G)!==JSON.stringify(S)&&H(G)});return a.current&&w.observe(a.current),()=>{w.disconnect()}},[c,m,S]);const k=s.useMemo(()=>D.allGroups.map(w=>{var A;return C.jsx(s.Fragment,{children:C.jsx("div",{className:z.clsx("univer-flex univer-flex-nowrap univer-gap-2 univer-px-2",V),children:(A=w.children)==null?void 0:A.map(M=>M.item&&C.jsx(x1,{...M.item,ref:N=>{N!=null&&N.el&&(o.current[M.key]={el:N.el,key:M.key,groupOrder:w.order,order:M.order})}},M.key))})},w.key)}),[D.allGroups]);return C.jsxs(C.Fragment,{children:[r&&C.jsxs("header",{className:"univer-relative univer-select-none",children:[C.jsx("div",{className:z.clsx("univer-flex univer-h-0 univer-items-center univer-justify-center univer-gap-2 univer-overflow-hidden univer-transition-all univer-animate-in",{"univer-h-8 univer-slide-in-from-top-full":c.length>1||t&&t.size>0}),children:c.length>1&&c.map(w=>C.jsx("a",{className:z.clsx("univer-box-border univer-cursor-pointer univer-rounded univer-px-2 univer-py-0.5 univer-text-sm univer-text-gray-700 univer-transition-colors dark:univer-text-white dark:hover:univer-bg-gray-700 hover:univer-bg-gray-100",{"univer-bg-primary-500 univer-text-white hover:!univer-bg-primary-500":w.key===m}),onClick:()=>E(w),children:i.t(w.key)},w.key))}),t&&t.size>0&&C.jsx("div",{className:"univer-absolute univer-right-2 univer-top-0 univer-flex univer-h-full univer-items-center univer-gap-2 [&>*]:univer-inline-flex [&>*]:univer-h-6 [&>*]:univer-items-center [&>*]:univer-rounded [&>*]:univer-px-1 [&>*]:univer-transition-colors hover:[&>*]:univer-bg-gray-100",children:C.jsx(h1,{components:t})})]}),C.jsx("section",{role:"toolbar",className:z.clsx("univer-relative univer-box-border univer-flex univer-h-8 univer-select-none univer-items-center univer-bg-white univer-text-base univer-text-gray-800 univer-transition-opacity dark:univer-bg-gray-900",z.borderBottomClassName),children:C.jsxs("div",{className:z.clsx("univer-mx-auto univer-box-border univer-flex univer-h-full univer-flex-1 univer-items-center univer-justify-center univer-gap-1 univer-overflow-hidden univer-bg-gray-50 univer-px-4 dark:univer-bg-gray-900",{"univer-duration-300 univer-animate-in univer-fade-in":d}),children:[D.visibleGroups.map(w=>{var A,M;return(((A=w.children)==null?void 0:A.length)||w.item)&&C.jsx(s.Fragment,{children:C.jsx("div",{className:z.clsx("univer-flex univer-flex-nowrap univer-gap-2 univer-px-2",V),children:w.children?(M=w.children)==null?void 0:M.map(N=>N.item&&C.jsx(x1,{...N.item},N.key)):w.item&&C.jsx(x1,{...w.item},w.key)})},w.key)}),S.length>0&&C.jsx("div",{className:"univer-px-2",children:C.jsx(Q9,{title:i.t("ribbon.more"),placement:"bottom",children:C.jsx(K9,{align:"end",overlay:C.jsx("div",{className:"univer-box-border univer-grid univer-max-w-[var(--radix-popper-available-width)] univer-gap-2 univer-p-2",children:D.hiddenGroups.map(w=>{var A;return C.jsx("div",{className:"univer-flex univer-items-center univer-gap-2",children:C.jsx("div",{className:"univer-flex univer-flex-wrap univer-gap-2",children:w.children?(A=w.children)==null?void 0:A.map(M=>M.item&&C.jsx(x1,{...M.item},M.key)):w.item&&C.jsx(x1,{...w.item},w.key)})},w.key)})}),children:C.jsx($e,{children:C.jsx(Tt,{})})})})})]})}),C.jsx("div",{"aria-hidden":!0,ref:a,className:"univer-invisible univer-absolute univer-left-0 univer-right-0 univer-top-[-99999px] univer-mx-auto univer-box-border univer-flex univer-h-full univer-flex-1 univer-items-center univer-justify-center univer-gap-1 univer-overflow-hidden univer-px-4",children:k})]})}class Ue{constructor(){F(this,"_styleSheetId","univer-theme-css-variables")}injectThemeToHead(t){function r(o,c="--univer"){const v=[];function m(L,d=""){for(const _ in L){const S=L[_],H=d?`${d}-${_}`:_;typeof S=="object"&&S!==null?m(S,H):v.push(`${c}-${H}: ${S};`)}}return m(o),v.join(`
7
7
  `)}const n=r(t),i=document.getElementById(this._styleSheetId);i&&i.remove();const a=document.createElement("style");a.setAttribute("id",this._styleSheetId),a.innerHTML=`:root {
8
8
  ${n}
9
- }`,document.head.appendChild(a)}}const G1=h.createIdentifier("ui.contextmenu.service");class ze extends h.Disposable{constructor(){super(...arguments);F(this,"_currentHandler",null);F(this,"disabled",!1)}get visible(){var r,n;return(n=(r=this._currentHandler)==null?void 0:r.visible)!=null?n:!1}disable(){this.disabled=!0}enable(){this.disabled=!1}triggerContextMenu(r,n){var i;r.stopPropagation(),!this.disabled&&((i=this._currentHandler)==null||i.handleContextMenu(r,n))}hideContextMenu(){var r;(r=this._currentHandler)==null||r.hideContextMenu()}registerContextMenuHandler(r){if(this._currentHandler)throw new Error("There is already a context menu handler!");return this._currentHandler=r,h.toDisposable(()=>this._currentHandler=null)}}function r6(){const e=s.useRef(null),[t,r]=s.useState(!1),[n,i]=s.useState(""),[a,o]=s.useState([0,0]),c=s.useRef(t),v=x.useDependency(G1),m=x.useDependency(h.ICommandService),L=x.useInjector();c.current=t,s.useEffect(()=>{const S=v.registerContextMenuHandler({handleContextMenu:d,hideContextMenu(){r(!1)},get visible(){return c.current}});function H(V){e.current&&!e.current.contains(V.target)&&_()}return document.addEventListener("pointerdown",H),document.addEventListener("wheel",_),()=>{document.removeEventListener("pointerdown",H),document.removeEventListener("wheel",_),S.dispose()}},[v]);function d(S,H){r(!1),requestAnimationFrame(()=>{i(H),o([S.clientX,S.clientY]),r(!0)})}function _(){r(!1)}return C.jsx(z.Popup,{visible:t,offset:a,children:C.jsx("section",{ref:e,children:n&&C.jsx(Oe,{menuType:n,onOptionSelect:S=>{const{label:H,commandId:V,value:E}=S;m&&m.executeCommand(V!=null?V:H,{value:E}),L.get(y1).focus(),r(!1)}})})})}const se=h.createIdentifier("univer.global-zone-service");function Ze(){const e=x.useDependency(se),[t,r]=s.useState(!1),n=x.useObservable(e.componentKey$,e.componentKey),i=x.useDependency(d1),a=s.useMemo(()=>{const o=i.get(n!=null?n:"");if(o)return o},[n,i]);return s.useEffect(()=>{const o=e.visible$.subscribe(c=>{r(c)});return()=>{o.unsubscribe()}},[e.visible$]),t?C.jsx("section",{className:z.clsx("univer-absolute univer-bg-gray-100",{"univer-hidden":!t,"univer-inset-0 univer-z-[100] univer-block univer-size-full":t}),children:a&&C.jsx(a,{})}):null}function Be(){const e=x.useDependency(N1),t=x.useObservable(e.sidebarOptions$),r=s.useRef(null),n=s.useMemo(()=>{if(!t)return null;const o={...t};for(const c of["children","header","footer"]){const v=c;if(t[v]){const{key:m,...L}=t[v];L&&(o[v]=C.jsx(l1,{...L},m))}}return o},[t]);s.useEffect(()=>(r.current&&e.setContainer(r.current),()=>{e.setContainer(void 0)}),[e]),s.useEffect(()=>{const o=v=>{e.scrollEvent$.next(v)},c=r.current;return c&&c.addEventListener("scroll",o),()=>{c==null||c.removeEventListener("scroll",o)}},[e]);const i=s.useMemo(()=>n!=null&&n.visible?typeof n.width=="number"?`${n.width}px`:n.width:0,[n]);function a(){var c;const o={...t,visible:!1};e.options.visible=!1,e.sidebarOptions$.next(o),(c=o==null?void 0:o.onClose)==null||c.call(o)}return C.jsx("section",{"data-u-comp":"sidebar",className:z.clsx("univer-relative univer-h-full univer-bg-white dark:univer-bg-gray-900",{"univer-w-96 univer-translate-x-0":n==null?void 0:n.visible,"univer-w-0 univer-translate-x-full":!(n!=null&&n.visible)}),style:{width:i},children:C.jsxs("section",{ref:r,className:z.clsx("univer-box-border univer-grid univer-h-0 univer-min-h-full univer-grid-rows-[auto_1fr_auto] univer-overflow-y-auto",z.borderLeftBottomClassName,z.scrollbarClassName),children:[C.jsxs("header",{className:"univer-sticky univer-top-0 univer-z-10 univer-box-border univer-flex univer-items-center univer-justify-between univer-p-4 univer-pb-2 univer-text-base univer-font-medium univer-text-gray-800 dark:univer-text-white",children:[n==null?void 0:n.header,C.jsx("a",{className:"univer-cursor-pointer univer-text-gray-500",onClick:a,children:C.jsx(Le,{})})]}),C.jsx("section",{className:"univer-box-border univer-px-4",style:n==null?void 0:n.bodyStyle,children:n==null?void 0:n.children}),(n==null?void 0:n.footer)&&C.jsx("footer",{className:"univer-sticky univer-bottom-0 univer-box-border univer-p-4",children:n.footer})]})})}const le=h.createIdentifier("univer.zen-zone-service");function Fe(){const e=x.useDependency(le),[t,r]=s.useState(!1),[n,i]=s.useState(),a=x.useObservable(e.temporaryHidden$),o=x.useDependency(d1);s.useEffect(()=>{const v=[e.visible$.subscribe(m=>{r(m)}),e.componentKey$.subscribe(m=>{i(m)})];return()=>{v.forEach(m=>{m.unsubscribe()})}},[]);const c=s.useMemo(()=>{const v=o.get(n!=null?n:"");if(v)return v},[n]);return C.jsx("section",{className:z.clsx("univer-absolute univer-z-[-1] univer-flex",{"univer-inset-0 univer-z-[100] univer-bg-gray-100 univer-animate-in univer-fade-in":t,"univer-hidden":a}),children:C.jsx("div",{className:"univer-relative univer-flex-1",children:c&&C.jsx(c,{})})})}function j2(e){const t=S9(z1);return C.jsx(R2,{...e,...t})}function R2(e){var J;const{header:t=!0,toolbar:r=!0,footer:n=!0,headerMenu:i=!0,contextMenu:a=!0,mountContainer:o,onRendered:c}=e,v=x.useDependency(h.LocaleService),m=x.useDependency(h.ThemeService),L=x.useDependency(Ue),d=s.useRef(null),S=x.useDependency(h.IConfigService).getConfig(z1),H=v1(i1.CUSTOM_HEADER),V=v1(i1.FOOTER),E=v1(i1.HEADER),D=v1(i1.HEADER_MENU),k=v1(i1.CONTENT),w=v1(i1.LEFT_SIDEBAR),A=v1(i1.GLOBAL),M=v1(i1.TOOLBAR),N=(J=S==null?void 0:S.popupRootId)!=null?J:"univer-popup-portal";s.useLayoutEffect(()=>{const q=m.currentTheme$.subscribe(e1=>{L.injectThemeToHead(e1)});return()=>{q.unsubscribe()}},[]);const[Z,R]=s.useState(!1);s.useLayoutEffect(()=>{const q=m.darkMode$.subscribe(e1=>{R(e1),e1?document.documentElement.classList.add("univer-dark"):document.documentElement.classList.remove("univer-dark")});return()=>{q.unsubscribe()}},[]),s.useEffect(()=>{d.current&&(c==null||c(d.current))},[c]);const[G,Y]=s.useState(v.getLocales()),K=s.useMemo(()=>document.createElement("div"),[]);return s.useEffect(()=>{document.body.appendChild(K);const q=[v.localeChanged$.subscribe(()=>{Y(v.getLocales())})];return()=>{q.forEach(e1=>e1.unsubscribe()),document.body.removeChild(K)}},[v,o,K,m.currentTheme$]),C.jsxs(z.ConfigProvider,{locale:G==null?void 0:G.design,mountContainer:K,children:[C.jsxs("div",{"data-u-comp":"workbench-layout",className:z.clsx("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:univer-bg-gray-800",{"univer-dark":Z}),tabIndex:-1,onBlur:q=>q.stopPropagation(),children:[C.jsx("div",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white",children:C.jsx(h1,{components:H},"custom-header")}),t&&r&&C.jsx("header",{"data-u-comp":"headerbar",className:"univer-relative univer-z-10 univer-w-full",children:C.jsx(h1,{components:M,sharedProps:{headerMenuComponents:D,headerMenu:i}},"toolbar")}),C.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[C.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[C.jsx("aside",{"data-u-comp":"left-sidebar",className:"univer-h-full",children:C.jsx(h1,{components:w},"left-sidebar")}),C.jsxs("section",{className:z.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white",z.borderBottomClassName),children:[C.jsx("header",{children:t&&C.jsx(h1,{components:E},"header")}),C.jsx("section",{className:"univer-relative univer-overflow-hidden dark:univer-bg-gray-900",ref:d,"data-range-selector":!0,onContextMenu:q=>q.preventDefault(),children:C.jsx(h1,{components:k},"content")})]}),C.jsx("aside",{"data-u-comp":"right-sidebar",className:"univer-h-full",children:C.jsx(Be,{})})]}),n&&C.jsx("footer",{children:C.jsx(h1,{components:V,sharedProps:{contextMenu:a}},"footer")}),C.jsx(Fe,{})]})]}),C.jsx(h1,{components:A},"global"),C.jsx(Ze,{}),a&&C.jsx(r6,{}),C.jsx(G2,{}),C.jsx("div",{id:N})]})}function G2(){const{mountContainer:e}=s.useContext(z.ConfigContext),t=v1(i1.FLOATING);return v3.createPortal(C.jsx(h1,{components:t},"floating"),e)}const W2=3e3;class je extends h.Disposable{constructor(r,n,i,a,o){super();F(this,"_steadyTimeout");F(this,"_renderTimeout");F(this,"_currentRenderId",null);this._injector=r,this._instanceService=n,this._layoutService=i,this._lifecycleService=a,this._renderManagerService=o}dispose(){super.dispose(),clearTimeout(this._steadyTimeout),clearTimeout(this._renderTimeout)}_bootstrapWorkbench(){this.disposeWithMe(this.bootstrap(async(r,n)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(n)),this.disposeWithMe(this._layoutService.registerContentElement(r))),await this._lifecycleService.onStage(h.LifecycleStages.Ready),this._renderTimeout=window.setTimeout(()=>{const i=this._renderManagerService.getRenderAll();for(const[a,o]of i)if(this._changeRenderUnit(a,r))break;this.disposeWithMe(this._instanceService.focused$.subscribe(a=>{a&&this._changeRenderUnit(a,r)})),this.disposeWithMe(this._renderManagerService.created$.subscribe(a=>{var o;a.unitId===((o=this._instanceService.getFocusedUnit())==null?void 0:o.getUnitId())&&this._changeRenderUnit(a.unitId,r)})),this.disposeWithMe(this._renderManagerService.disposed$.subscribe(a=>{this._currentRenderId===a&&(this._currentRenderId=null)})),this._lifecycleService.stage=h.LifecycleStages.Rendered,this._steadyTimeout=window.setTimeout(()=>{this._lifecycleService.stage=h.LifecycleStages.Steady},W2)},300)}))}_changeRenderUnit(r,n){if(this._currentRenderId===r)return!1;const i=this._renderManagerService.getRenderById(r);if(!i||!i.unitId||h.isInternalEditorID(i.unitId))return!1;const a=this._currentRenderId?this._renderManagerService.getRenderById(this._currentRenderId):null;return a==null||a.deactivate(),a==null||a.engine.unmount(),i.engine.mount(n),i.activate(),this._currentRenderId=r,!0}}var Y2=Object.getOwnPropertyDescriptor,X2=(e,t,r,n)=>{for(var i=n>1?void 0:n?Y2(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},w1=(e,t)=>(r,n)=>t(r,n,e);f.DesktopUIController=class extends je{constructor(t,r,n,i,a,o,c,v,m){super(r,o,a,n,i),this._config=t,this._componentManager=m,c.mergeMenu(P9),this._initBuiltinComponents(v),this._registerComponents(),this._bootstrapWorkbench()}_registerComponents(){this.disposeWithMe(this._componentManager.register(b9,p9)),this.disposeWithMe(this._componentManager.register(y9,L9))}bootstrap(t){return q2(this._injector,this._config,t)}_initBuiltinComponents(t){this.disposeWithMe(t.registerComponent(i1.FLOATING,()=>x.connectInjector(Ae,this._injector))),this.disposeWithMe(t.registerComponent(i1.CONTENT,()=>x.connectInjector(ke,this._injector))),this.disposeWithMe(t.registerComponent(i1.TOOLBAR,()=>x.connectInjector(t6,this._injector)))}},f.DesktopUIController=X2([w1(1,h.Inject(h.Injector)),w1(2,h.Inject(h.LifecycleService)),w1(3,P1.IRenderManagerService),w1(4,y1),w1(5,h.IUniverInstanceService),w1(6,b1),w1(7,g1),w1(8,h.Inject(d1))],f.DesktopUIController);function q2(e,t,r){let n;const i=t.container;if(typeof i=="string"){const v=document.getElementById(i);v?n=v:n=n6(i)}else i instanceof HTMLElement?n=i:n=n6("univer");const a=x.connectInjector(j2,e),o=v=>r(v,n);function c(){z.render(C.jsx(a,{...t,mountContainer:n,onRendered:o}),n)}return c(),h.toDisposable(()=>{z.render(C.jsx("div",{}),n),setTimeout(()=>z.render(C.jsx("div",{}),n),200),setTimeout(()=>z.unmount(n),500)})}function n6(e){const t=document.createElement("div");return t.id=e,t}function J2(e){const{menuType:t,onOptionSelect:r}=e,n=x.useDependency(b1);if(!t)return null;const i=s.useMemo(()=>{const a=n.getMenuByPositionKey(t);function o(c){return c.reduce((v,m)=>m.children?[...v,...o(m.children)]:[...v,m],[])}return o(a)},[t]);return C.jsx("div",{className:"univer-box-border univer-grid univer-min-w-8 univer-max-w-52 univer-gap-1 univer-rounded univer-bg-gray-900 univer-px-2 univer-py-1",style:{gridTemplateColumns:`repeat(${Math.min(2,i.length)}, 48px)`},children:i.map(a=>a.item&&C.jsx(Q2,{menuItem:a.item,onClick:o=>r==null?void 0:r({value:"",label:a.key,...o})},a.key))})}function Q2(e){const{menuItem:t,onClick:r}=e,{id:n,type:i,title:a,label:o,icon:c}=t;if(i!==f1.BUTTON)throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${n}".`);const v=x.useObservable(t.disabled$,!1),m=x.useObservable(t.value$);return C.jsx("button",{type:"button",className:z.clsx("univer-flex univer-w-12 univer-flex-col univer-items-center univer-justify-center univer-border-none univer-bg-transparent univer-text-white [&>span]:univer-mt-0.5 [&>span]:univer-w-full [&>span]:univer-truncate [&>span]:univer-text-sm [&>svg]:univer-size-[18px] [&>svg]:univer-text-lg",{}),disabled:v,onClick:()=>r({id:n}),children:C.jsx(l1,{value:m,title:a,label:o,icon:c})},n)}function i6(){const[e,t]=s.useState(!1),[r,n]=s.useState(""),[i,a]=s.useState([0,0]),o=s.useRef(e),c=x.useDependency(G1),v=x.useDependency(h.ICommandService);o.current=e,s.useEffect(()=>{const d=c.registerContextMenuHandler({handleContextMenu:m,hideContextMenu(){t(!1)},get visible(){return o.current}});return document.addEventListener("pointerdown",L),document.addEventListener("wheel",L),()=>{document.removeEventListener("pointerdown",L),document.removeEventListener("wheel",L),d.dispose()}},[c]);function m(d,_){n(_),a([d.clientX,d.clientY]),t(!0)}function L(){t(!1)}return C.jsx(z.Popup,{visible:e,offset:i,children:C.jsx("section",{onPointerDown:d=>d.stopPropagation(),children:r&&C.jsx(J2,{menuType:r,onOptionSelect:d=>{const{label:_,value:S,commandId:H}=d;v&&v.executeCommand(H!=null?H:_,{value:S}),t(!1)}})})})}function K2(e){const{header:t=!0,footer:r=!0,contextMenu:n=!0,mountContainer:i,onRendered:a}=e,o=x.useDependency(h.LocaleService),c=x.useDependency(h.ThemeService),v=s.useRef(null),m=v1(i1.FOOTER),L=v1(i1.HEADER),d=v1(i1.CONTENT),_=v1(i1.LEFT_SIDEBAR),S=v1(i1.GLOBAL),[H,V]=s.useState(!1);s.useEffect(()=>{const w=c.darkMode$.subscribe(A=>{V(A)});return()=>{w.unsubscribe()}},[]),s.useEffect(()=>{v.current&&(a==null||a(v.current))},[a]);const[E,D]=s.useState(o.getLocales()),k=s.useMemo(()=>document.createElement("div"),[]);return s.useEffect(()=>{document.body.appendChild(k);const w=[o.localeChanged$.subscribe(()=>{D(o.getLocales())})];return()=>{w.forEach(A=>A.unsubscribe()),document.body.removeChild(k)}},[o,i,k,c.currentTheme$]),C.jsxs(z.ConfigProvider,{locale:E==null?void 0:E.design,mountContainer:k,children:[C.jsxs("div",{"data-u-comp":"app-layout",className:z.clsx("univer-relative univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:univer-bg-gray-800",{"univer-dark":H}),tabIndex:-1,onBlur:w=>w.stopPropagation(),children:[t&&C.jsx("header",{className:"univer-relative univer-z-10 univer-w-full"}),C.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[C.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[C.jsx("aside",{className:"univer-h-full",children:C.jsx(h1,{components:_},"left-sidebar")}),C.jsxs("section",{className:z.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white",z.borderBottomClassName),children:[C.jsx("header",{className:"univer-w-screen",children:t&&C.jsx(h1,{components:L},"header")}),C.jsx("section",{ref:v,className:"univer-relative univer-overflow-hidden","data-range-selector":!0,onContextMenu:w=>w.preventDefault(),children:C.jsx(h1,{components:d},"content")})]}),C.jsx("aside",{className:"univer-h-full",children:C.jsx(Be,{})})]}),r&&C.jsx("footer",{children:C.jsx(h1,{components:m},"footer")}),C.jsx(Ze,{}),C.jsx(Fe,{})]})]}),C.jsx(h1,{components:S},"global"),n&&C.jsx(i6,{})]})}var e4=Object.getOwnPropertyDescriptor,t4=(e,t,r,n)=>{for(var i=n>1?void 0:n?e4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},A1=(e,t)=>(r,n)=>t(r,n,e);let Re=class extends je{constructor(e,t,r,n,i,a,o){super(t,a,i,r,n),this._config=e,this._initBuiltinComponents(o),this._bootstrapWorkbench()}bootstrap(e){return r4(this._injector,this._config,e)}_initBuiltinComponents(e){this.disposeWithMe(e.registerComponent(i1.CONTENT,()=>x.connectInjector(Ae,this._injector))),this.disposeWithMe(e.registerComponent(i1.CONTENT,()=>x.connectInjector(ke,this._injector)))}};Re=t4([A1(1,h.Inject(h.Injector)),A1(2,h.Inject(h.LifecycleService)),A1(3,P1.IRenderManagerService),A1(4,y1),A1(5,h.IUniverInstanceService),A1(6,g1)],Re);function r4(e,t,r){let n;const i=t.container;if(typeof i=="string"){const v=document.getElementById(i);v?n=v:n=o6(i)}else i instanceof HTMLElement?n=i:n=o6("univer");const a=x.connectInjector(K2,e),o=v=>r(v,n);function c(){z.render(C.jsx(a,{...t,mountContainer:n,onRendered:o}),n)}return c(),h.toDisposable(()=>{z.unmount(n)})}function o6(e){const t=document.createElement("div");return t.id=e,t}const W1=h.createIdentifier("ui.notification.service");var n4=Object.getOwnPropertyDescriptor,i4=(e,t,r,n)=>{for(var i=n>1?void 0:n?n4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},o4=(e,t)=>(r,n)=>t(r,n,e);const Ge=h.createIdentifier("univer.ui.before-close-service");f.DesktopBeforeCloseService=class{constructor(t){F(this,"_beforeUnloadCallbacks",[]);F(this,"_onCloseCallbacks",[]);this._notificationService=t,this._init()}registerBeforeClose(t){return this._beforeUnloadCallbacks.push(t),{dispose:()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(r=>r!==t)}}}registerOnClose(t){return this._onCloseCallbacks.push(t),{dispose:()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(r=>r!==t)}}}_init(){window.addEventListener("beforeunload",t=>{let r=t;const n=this._beforeUnloadCallbacks.map(i=>i()).filter(i=>!!i).join(`
9
+ }`,document.head.appendChild(a)}}const G1=h.createIdentifier("ui.contextmenu.service");class ze extends h.Disposable{constructor(){super(...arguments);F(this,"_currentHandler",null);F(this,"disabled",!1)}get visible(){var r,n;return(n=(r=this._currentHandler)==null?void 0:r.visible)!=null?n:!1}disable(){this.disabled=!0}enable(){this.disabled=!1}triggerContextMenu(r,n){var i;r.stopPropagation(),!this.disabled&&((i=this._currentHandler)==null||i.handleContextMenu(r,n))}hideContextMenu(){var r;(r=this._currentHandler)==null||r.hideContextMenu()}registerContextMenuHandler(r){if(this._currentHandler)throw new Error("There is already a context menu handler!");return this._currentHandler=r,h.toDisposable(()=>this._currentHandler=null)}}function r6(){const e=s.useRef(null),[t,r]=s.useState(!1),[n,i]=s.useState(""),[a,o]=s.useState([0,0]),c=s.useRef(t),v=x.useDependency(G1),m=x.useDependency(h.ICommandService),L=x.useInjector();c.current=t,s.useEffect(()=>{const S=v.registerContextMenuHandler({handleContextMenu:d,hideContextMenu(){r(!1)},get visible(){return c.current}});function H(V){e.current&&!e.current.contains(V.target)&&_()}return document.addEventListener("pointerdown",H),document.addEventListener("wheel",_),()=>{document.removeEventListener("pointerdown",H),document.removeEventListener("wheel",_),S.dispose()}},[v]);function d(S,H){r(!1),requestAnimationFrame(()=>{i(H),o([S.clientX,S.clientY]),r(!0)})}function _(){r(!1)}return C.jsx(z.Popup,{visible:t,offset:a,children:C.jsx("section",{ref:e,children:n&&C.jsx(Oe,{menuType:n,onOptionSelect:S=>{const{label:H,commandId:V,value:E}=S;m&&m.executeCommand(V!=null?V:H,{value:E}),L.get(y1).focus(),r(!1)}})})})}const se=h.createIdentifier("univer.global-zone-service");function Ze(){const e=x.useDependency(se),[t,r]=s.useState(!1),n=x.useObservable(e.componentKey$,e.componentKey),i=x.useDependency(d1),a=s.useMemo(()=>{const o=i.get(n!=null?n:"");if(o)return o},[n,i]);return s.useEffect(()=>{const o=e.visible$.subscribe(c=>{r(c)});return()=>{o.unsubscribe()}},[e.visible$]),t?C.jsx("section",{className:z.clsx("univer-absolute univer-bg-gray-100",{"univer-hidden":!t,"univer-inset-0 univer-z-[100] univer-block univer-size-full":t}),children:a&&C.jsx(a,{})}):null}function Be(){const e=x.useDependency(N1),t=x.useObservable(e.sidebarOptions$),r=s.useRef(null),n=s.useMemo(()=>{if(!t)return null;const o={...t};for(const c of["children","header","footer"]){const v=c;if(t[v]){const{key:m,...L}=t[v];L&&(o[v]=C.jsx(l1,{...L},m))}}return o},[t]);s.useEffect(()=>(r.current&&e.setContainer(r.current),()=>{e.setContainer(void 0)}),[e]),s.useEffect(()=>{const o=v=>{e.scrollEvent$.next(v)},c=r.current;return c&&c.addEventListener("scroll",o),()=>{c==null||c.removeEventListener("scroll",o)}},[e]);const i=s.useMemo(()=>n!=null&&n.visible?typeof n.width=="number"?`${n.width}px`:n.width:0,[n]);function a(){var c;const o={...t,visible:!1};e.options.visible=!1,e.sidebarOptions$.next(o),(c=o==null?void 0:o.onClose)==null||c.call(o)}return C.jsx("section",{"data-u-comp":"sidebar",className:z.clsx("univer-relative univer-h-full univer-bg-white dark:univer-bg-gray-900",{"univer-w-96 univer-translate-x-0":n==null?void 0:n.visible,"univer-w-0 univer-translate-x-full":!(n!=null&&n.visible)}),style:{width:i},children:C.jsxs("section",{ref:r,className:z.clsx("univer-box-border univer-grid univer-h-0 univer-min-h-full univer-grid-rows-[auto_1fr_auto] univer-overflow-y-auto",z.borderLeftBottomClassName,z.scrollbarClassName),children:[C.jsxs("header",{className:"univer-sticky univer-top-0 univer-z-10 univer-box-border univer-flex univer-items-center univer-justify-between univer-bg-white univer-p-4 univer-pb-2 univer-text-base univer-font-medium univer-text-gray-800 dark:univer-bg-gray-900 dark:univer-text-white",children:[n==null?void 0:n.header,C.jsx("a",{className:"univer-cursor-pointer univer-text-gray-500",onClick:a,children:C.jsx(Le,{})})]}),C.jsx("section",{className:"univer-box-border univer-px-4",style:n==null?void 0:n.bodyStyle,children:n==null?void 0:n.children}),(n==null?void 0:n.footer)&&C.jsx("footer",{className:"univer-sticky univer-bottom-0 univer-box-border univer-bg-white univer-p-4 dark:univer-bg-gray-900",children:n.footer})]})})}const le=h.createIdentifier("univer.zen-zone-service");function Fe(){const e=x.useDependency(le),[t,r]=s.useState(!1),[n,i]=s.useState(),a=x.useObservable(e.temporaryHidden$),o=x.useDependency(d1);s.useEffect(()=>{const v=[e.visible$.subscribe(m=>{r(m)}),e.componentKey$.subscribe(m=>{i(m)})];return()=>{v.forEach(m=>{m.unsubscribe()})}},[]);const c=s.useMemo(()=>{const v=o.get(n!=null?n:"");if(v)return v},[n]);return C.jsx("section",{className:z.clsx("univer-absolute univer-z-[-1] univer-flex",{"univer-inset-0 univer-z-[100] univer-bg-gray-100 univer-animate-in univer-fade-in":t,"univer-hidden":a}),children:C.jsx("div",{className:"univer-relative univer-flex-1",children:c&&C.jsx(c,{})})})}function j2(e){const t=S9(z1);return C.jsx(R2,{...e,...t})}function R2(e){var J;const{header:t=!0,toolbar:r=!0,footer:n=!0,headerMenu:i=!0,contextMenu:a=!0,mountContainer:o,onRendered:c}=e,v=x.useDependency(h.LocaleService),m=x.useDependency(h.ThemeService),L=x.useDependency(Ue),d=s.useRef(null),S=x.useDependency(h.IConfigService).getConfig(z1),H=v1(i1.CUSTOM_HEADER),V=v1(i1.FOOTER),E=v1(i1.HEADER),D=v1(i1.HEADER_MENU),k=v1(i1.CONTENT),w=v1(i1.LEFT_SIDEBAR),A=v1(i1.GLOBAL),M=v1(i1.TOOLBAR),N=(J=S==null?void 0:S.popupRootId)!=null?J:"univer-popup-portal";s.useLayoutEffect(()=>{const q=m.currentTheme$.subscribe(e1=>{L.injectThemeToHead(e1)});return()=>{q.unsubscribe()}},[]);const[Z,R]=s.useState(!1);s.useLayoutEffect(()=>{const q=m.darkMode$.subscribe(e1=>{R(e1),e1?document.documentElement.classList.add("univer-dark"):document.documentElement.classList.remove("univer-dark")});return()=>{q.unsubscribe()}},[]),s.useEffect(()=>{d.current&&(c==null||c(d.current))},[c]);const[G,Y]=s.useState(v.getLocales()),K=s.useMemo(()=>document.createElement("div"),[]);return s.useEffect(()=>{document.body.appendChild(K);const q=[v.localeChanged$.subscribe(()=>{Y(v.getLocales())})];return()=>{q.forEach(e1=>e1.unsubscribe()),document.body.removeChild(K)}},[v,o,K,m.currentTheme$]),C.jsxs(z.ConfigProvider,{locale:G==null?void 0:G.design,mountContainer:K,children:[C.jsxs("div",{"data-u-comp":"workbench-layout",className:z.clsx("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:univer-bg-gray-800",{"univer-dark":Z}),tabIndex:-1,onBlur:q=>q.stopPropagation(),children:[C.jsx("div",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white",children:C.jsx(h1,{components:H},"custom-header")}),t&&r&&C.jsx("header",{"data-u-comp":"headerbar",className:"univer-relative univer-z-10 univer-w-full",children:C.jsx(h1,{components:M,sharedProps:{headerMenuComponents:D,headerMenu:i}},"toolbar")}),C.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[C.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[C.jsx("aside",{"data-u-comp":"left-sidebar",className:"univer-h-full",children:C.jsx(h1,{components:w},"left-sidebar")}),C.jsxs("section",{className:z.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white",z.borderBottomClassName),children:[C.jsx("header",{children:t&&C.jsx(h1,{components:E},"header")}),C.jsx("section",{className:"univer-relative univer-overflow-hidden dark:univer-bg-gray-900",ref:d,"data-range-selector":!0,onContextMenu:q=>q.preventDefault(),children:C.jsx(h1,{components:k},"content")})]}),C.jsx("aside",{"data-u-comp":"right-sidebar",className:"univer-h-full",children:C.jsx(Be,{})})]}),n&&C.jsx("footer",{children:C.jsx(h1,{components:V,sharedProps:{contextMenu:a}},"footer")}),C.jsx(Fe,{})]})]}),C.jsx(h1,{components:A},"global"),C.jsx(Ze,{}),a&&C.jsx(r6,{}),C.jsx(G2,{}),C.jsx("div",{id:N})]})}function G2(){const{mountContainer:e}=s.useContext(z.ConfigContext),t=v1(i1.FLOATING);return v3.createPortal(C.jsx(h1,{components:t},"floating"),e)}const W2=3e3;class je extends h.Disposable{constructor(r,n,i,a,o){super();F(this,"_steadyTimeout");F(this,"_renderTimeout");F(this,"_currentRenderId",null);this._injector=r,this._instanceService=n,this._layoutService=i,this._lifecycleService=a,this._renderManagerService=o}dispose(){super.dispose(),clearTimeout(this._steadyTimeout),clearTimeout(this._renderTimeout)}_bootstrapWorkbench(){this.disposeWithMe(this.bootstrap(async(r,n)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(n)),this.disposeWithMe(this._layoutService.registerContentElement(r))),await this._lifecycleService.onStage(h.LifecycleStages.Ready),this._renderTimeout=window.setTimeout(()=>{const i=this._renderManagerService.getRenderAll();for(const[a,o]of i)if(this._changeRenderUnit(a,r))break;this.disposeWithMe(this._instanceService.focused$.subscribe(a=>{a&&this._changeRenderUnit(a,r)})),this.disposeWithMe(this._renderManagerService.created$.subscribe(a=>{var o;a.unitId===((o=this._instanceService.getFocusedUnit())==null?void 0:o.getUnitId())&&this._changeRenderUnit(a.unitId,r)})),this.disposeWithMe(this._renderManagerService.disposed$.subscribe(a=>{this._currentRenderId===a&&(this._currentRenderId=null)})),this._lifecycleService.stage=h.LifecycleStages.Rendered,this._steadyTimeout=window.setTimeout(()=>{this._lifecycleService.stage=h.LifecycleStages.Steady},W2)},300)}))}_changeRenderUnit(r,n){if(this._currentRenderId===r)return!1;const i=this._renderManagerService.getRenderById(r);if(!i||!i.unitId||h.isInternalEditorID(i.unitId))return!1;const a=this._currentRenderId?this._renderManagerService.getRenderById(this._currentRenderId):null;return a==null||a.deactivate(),a==null||a.engine.unmount(),i.engine.mount(n),i.activate(),this._currentRenderId=r,!0}}var Y2=Object.getOwnPropertyDescriptor,X2=(e,t,r,n)=>{for(var i=n>1?void 0:n?Y2(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},w1=(e,t)=>(r,n)=>t(r,n,e);f.DesktopUIController=class extends je{constructor(t,r,n,i,a,o,c,v,m){super(r,o,a,n,i),this._config=t,this._componentManager=m,c.mergeMenu(P9),this._initBuiltinComponents(v),this._registerComponents(),this._bootstrapWorkbench()}_registerComponents(){this.disposeWithMe(this._componentManager.register(b9,p9)),this.disposeWithMe(this._componentManager.register(y9,L9))}bootstrap(t){return q2(this._injector,this._config,t)}_initBuiltinComponents(t){this.disposeWithMe(t.registerComponent(i1.FLOATING,()=>x.connectInjector(Ae,this._injector))),this.disposeWithMe(t.registerComponent(i1.CONTENT,()=>x.connectInjector(ke,this._injector))),this.disposeWithMe(t.registerComponent(i1.TOOLBAR,()=>x.connectInjector(t6,this._injector)))}},f.DesktopUIController=X2([w1(1,h.Inject(h.Injector)),w1(2,h.Inject(h.LifecycleService)),w1(3,P1.IRenderManagerService),w1(4,y1),w1(5,h.IUniverInstanceService),w1(6,b1),w1(7,g1),w1(8,h.Inject(d1))],f.DesktopUIController);function q2(e,t,r){let n;const i=t.container;if(typeof i=="string"){const v=document.getElementById(i);v?n=v:n=n6(i)}else i instanceof HTMLElement?n=i:n=n6("univer");const a=x.connectInjector(j2,e),o=v=>r(v,n);function c(){z.render(C.jsx(a,{...t,mountContainer:n,onRendered:o}),n)}return c(),h.toDisposable(()=>{z.render(C.jsx("div",{}),n),setTimeout(()=>z.render(C.jsx("div",{}),n),200),setTimeout(()=>z.unmount(n),500)})}function n6(e){const t=document.createElement("div");return t.id=e,t}function J2(e){const{menuType:t,onOptionSelect:r}=e,n=x.useDependency(b1);if(!t)return null;const i=s.useMemo(()=>{const a=n.getMenuByPositionKey(t);function o(c){return c.reduce((v,m)=>m.children?[...v,...o(m.children)]:[...v,m],[])}return o(a)},[t]);return C.jsx("div",{className:"univer-box-border univer-grid univer-min-w-8 univer-max-w-52 univer-gap-1 univer-rounded univer-bg-gray-900 univer-px-2 univer-py-1",style:{gridTemplateColumns:`repeat(${Math.min(2,i.length)}, 48px)`},children:i.map(a=>a.item&&C.jsx(Q2,{menuItem:a.item,onClick:o=>r==null?void 0:r({value:"",label:a.key,...o})},a.key))})}function Q2(e){const{menuItem:t,onClick:r}=e,{id:n,type:i,title:a,label:o,icon:c}=t;if(i!==f1.BUTTON)throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${n}".`);const v=x.useObservable(t.disabled$,!1),m=x.useObservable(t.value$);return C.jsx("button",{type:"button",className:z.clsx("univer-flex univer-w-12 univer-flex-col univer-items-center univer-justify-center univer-border-none univer-bg-transparent univer-text-white [&>span]:univer-mt-0.5 [&>span]:univer-w-full [&>span]:univer-truncate [&>span]:univer-text-sm [&>svg]:univer-size-[18px] [&>svg]:univer-text-lg",{}),disabled:v,onClick:()=>r({id:n}),children:C.jsx(l1,{value:m,title:a,label:o,icon:c})},n)}function i6(){const[e,t]=s.useState(!1),[r,n]=s.useState(""),[i,a]=s.useState([0,0]),o=s.useRef(e),c=x.useDependency(G1),v=x.useDependency(h.ICommandService);o.current=e,s.useEffect(()=>{const d=c.registerContextMenuHandler({handleContextMenu:m,hideContextMenu(){t(!1)},get visible(){return o.current}});return document.addEventListener("pointerdown",L),document.addEventListener("wheel",L),()=>{document.removeEventListener("pointerdown",L),document.removeEventListener("wheel",L),d.dispose()}},[c]);function m(d,_){n(_),a([d.clientX,d.clientY]),t(!0)}function L(){t(!1)}return C.jsx(z.Popup,{visible:e,offset:i,children:C.jsx("section",{onPointerDown:d=>d.stopPropagation(),children:r&&C.jsx(J2,{menuType:r,onOptionSelect:d=>{const{label:_,value:S,commandId:H}=d;v&&v.executeCommand(H!=null?H:_,{value:S}),t(!1)}})})})}function K2(e){const{header:t=!0,footer:r=!0,contextMenu:n=!0,mountContainer:i,onRendered:a}=e,o=x.useDependency(h.LocaleService),c=x.useDependency(h.ThemeService),v=s.useRef(null),m=v1(i1.FOOTER),L=v1(i1.HEADER),d=v1(i1.CONTENT),_=v1(i1.LEFT_SIDEBAR),S=v1(i1.GLOBAL),[H,V]=s.useState(!1);s.useEffect(()=>{const w=c.darkMode$.subscribe(A=>{V(A)});return()=>{w.unsubscribe()}},[]),s.useEffect(()=>{v.current&&(a==null||a(v.current))},[a]);const[E,D]=s.useState(o.getLocales()),k=s.useMemo(()=>document.createElement("div"),[]);return s.useEffect(()=>{document.body.appendChild(k);const w=[o.localeChanged$.subscribe(()=>{D(o.getLocales())})];return()=>{w.forEach(A=>A.unsubscribe()),document.body.removeChild(k)}},[o,i,k,c.currentTheme$]),C.jsxs(z.ConfigProvider,{locale:E==null?void 0:E.design,mountContainer:k,children:[C.jsxs("div",{"data-u-comp":"app-layout",className:z.clsx("univer-relative univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:univer-bg-gray-800",{"univer-dark":H}),tabIndex:-1,onBlur:w=>w.stopPropagation(),children:[t&&C.jsx("header",{className:"univer-relative univer-z-10 univer-w-full"}),C.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[C.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[C.jsx("aside",{className:"univer-h-full",children:C.jsx(h1,{components:_},"left-sidebar")}),C.jsxs("section",{className:z.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white",z.borderBottomClassName),children:[C.jsx("header",{className:"univer-w-screen",children:t&&C.jsx(h1,{components:L},"header")}),C.jsx("section",{ref:v,className:"univer-relative univer-overflow-hidden","data-range-selector":!0,onContextMenu:w=>w.preventDefault(),children:C.jsx(h1,{components:d},"content")})]}),C.jsx("aside",{className:"univer-h-full",children:C.jsx(Be,{})})]}),r&&C.jsx("footer",{children:C.jsx(h1,{components:m},"footer")}),C.jsx(Ze,{}),C.jsx(Fe,{})]})]}),C.jsx(h1,{components:S},"global"),n&&C.jsx(i6,{})]})}var e4=Object.getOwnPropertyDescriptor,t4=(e,t,r,n)=>{for(var i=n>1?void 0:n?e4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},A1=(e,t)=>(r,n)=>t(r,n,e);let Re=class extends je{constructor(e,t,r,n,i,a,o){super(t,a,i,r,n),this._config=e,this._initBuiltinComponents(o),this._bootstrapWorkbench()}bootstrap(e){return r4(this._injector,this._config,e)}_initBuiltinComponents(e){this.disposeWithMe(e.registerComponent(i1.CONTENT,()=>x.connectInjector(Ae,this._injector))),this.disposeWithMe(e.registerComponent(i1.CONTENT,()=>x.connectInjector(ke,this._injector)))}};Re=t4([A1(1,h.Inject(h.Injector)),A1(2,h.Inject(h.LifecycleService)),A1(3,P1.IRenderManagerService),A1(4,y1),A1(5,h.IUniverInstanceService),A1(6,g1)],Re);function r4(e,t,r){let n;const i=t.container;if(typeof i=="string"){const v=document.getElementById(i);v?n=v:n=o6(i)}else i instanceof HTMLElement?n=i:n=o6("univer");const a=x.connectInjector(K2,e),o=v=>r(v,n);function c(){z.render(C.jsx(a,{...t,mountContainer:n,onRendered:o}),n)}return c(),h.toDisposable(()=>{z.unmount(n)})}function o6(e){const t=document.createElement("div");return t.id=e,t}const W1=h.createIdentifier("ui.notification.service");var n4=Object.getOwnPropertyDescriptor,i4=(e,t,r,n)=>{for(var i=n>1?void 0:n?n4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},o4=(e,t)=>(r,n)=>t(r,n,e);const Ge=h.createIdentifier("univer.ui.before-close-service");f.DesktopBeforeCloseService=class{constructor(t){F(this,"_beforeUnloadCallbacks",[]);F(this,"_onCloseCallbacks",[]);this._notificationService=t,this._init()}registerBeforeClose(t){return this._beforeUnloadCallbacks.push(t),{dispose:()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(r=>r!==t)}}}registerOnClose(t){return this._onCloseCallbacks.push(t),{dispose:()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(r=>r!==t)}}}_init(){window.addEventListener("beforeunload",t=>{let r=t;const n=this._beforeUnloadCallbacks.map(i=>i()).filter(i=>!!i).join(`
10
10
  `);if(n)return this._notificationService.show({type:"error",title:"Some changes are not saved",content:n}),typeof r>"u"&&(r=window.event),r.returnValue=n,n}),window.addEventListener("unload",()=>{this._onCloseCallbacks.forEach(t=>t())})}},f.DesktopBeforeCloseService=i4([o4(0,W1)],f.DesktopBeforeCloseService);function a6(){return typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText<"u"}var a4=Object.getOwnPropertyDescriptor,s4=(e,t,r,n)=>{for(var i=n>1?void 0:n?a4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},We=(e,t)=>(r,n)=>t(r,n,e);const Ye="text/plain",Xe="text/html",s6="image/png",l6="image/jpeg",c6="image/bmp",u6="image/webp",l4="image/svg+xml",c4=new Set([c6,l6,u6,s6]),qe=h.createIdentifier("univer.clipboard-interface-service");f.BrowserClipboardService=class extends h.Disposable{constructor(t,r,n){super(),this._localeService=t,this._logService=r,this._notificationService=n}get supportClipboard(){return a6()}async write(t,r){if(!this.supportClipboard)return this._legacyCopyHtml(r);try{return await navigator.clipboard.write([new ClipboardItem({[Ye]:new Blob([t],{type:Ye}),[Xe]:new Blob([r],{type:Xe})})])}catch(n){this._logService.error("[BrowserClipboardService]",n),this._showClipboardAuthenticationNotification()}}async writeText(t){if(!this.supportClipboard)return this._legacyCopyText(t);try{return await navigator.clipboard.writeText(t)}catch(r){this._logService.error("[BrowserClipboardService]",r),this._showClipboardAuthenticationNotification()}}async read(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return navigator.clipboard.read()}catch(t){return this._logService.error("[BrowserClipboardService]",t),this._showClipboardAuthenticationNotification(),[]}}async readText(){if(!this.supportClipboard)throw new Error("[BrowserClipboardService] read() is not supported on this platform.");try{return await navigator.clipboard.readText()}catch(t){return this._logService.error("[BrowserClipboardService]",t),this._showClipboardAuthenticationNotification(),""}}_legacyCopyHtml(t){const r=document.activeElement,n=d4();document.body.appendChild(n),n.innerHTML=t;try{d6(n),document.execCommand("copy")}finally{r instanceof HTMLElement&&r.focus(),document.body.removeChild(n)}}_legacyCopyText(t){const r=document.activeElement,n=u4();document.body.appendChild(n),n.value=t;try{d6(n),document.execCommand("copy")}finally{r instanceof HTMLElement&&r.focus(),document.body.removeChild(n)}}_showClipboardAuthenticationNotification(){var t;(t=this._notificationService)==null||t.show({type:"warning",title:this._localeService.t("clipboard.authentication.title"),content:this._localeService.t("clipboard.authentication.content")})}},f.BrowserClipboardService=s4([We(0,h.Inject(h.LocaleService)),We(1,h.ILogService),We(2,h.Optional(W1))],f.BrowserClipboardService);function u4(){const e=document.createElement("textarea");return e.style.position="absolute",e.style.height="1px",e.style.width="1px",e.style.opacity="0",e.readOnly=!0,e}function d4(){const e=document.createElement("div");return e.contentEditable="true",e.style.position="absolute",e.style.opacity="0",e.style.height="1px",e.style.width="1px",e}function d6(e){if(e instanceof HTMLTextAreaElement){const n=e.hasAttribute("readonly");return n||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),n||e.removeAttribute("readonly"),e.value}e.hasAttribute("contenteditable")&&e.focus();const t=document.createRange();t.selectNodeContents(e);const r=window.getSelection();if(!r)throw new Error;return r.removeAllRanges(),r.addRange(t),r.toString()}const ce=h.createIdentifier("univer.confirm-service");class f4{constructor(){F(this,"confirmOptions$",new j.Subject)}dispose(){this.confirmOptions$.complete()}open(t){throw new Error("This is not implemented in the test service!")}confirm(t){return Promise.resolve(!0)}close(t){throw new Error("This is not implemented in the test service!")}}const h4=e=>{const{children:t,onClose:r,onConfirm:n}=e,[i]=s.useState({}),a=s.cloneElement(t,{hooks:i});return C.jsx(z.Confirm,{...e,children:a,onClose:()=>{const o=i.beforeClose;if(o){const c=o();if(c.cancel)return;r==null||r(c);return}r==null||r()},onConfirm:()=>{const o=i.beforeConfirm;if(o){const c=o();if(c.cancel)return;n==null||n(c);return}n==null||n()}})};function v4(){const e=x.useDependency(ce),[t,r]=s.useState([]);s.useEffect(()=>{const i=e.confirmOptions$.subscribe(a=>{r(a)});return()=>{i.unsubscribe()}},[]);const n=t.map(i=>{const{children:a,title:o,...c}=i,v=c;for(const m of["children","title"]){const L=m,d=i[L];d&&(v[L]=C.jsx(l1,{...d}))}return v});return n==null?void 0:n.map((i,a)=>C.jsx(h4,{...i,children:i.children},a))}var C4=Object.getOwnPropertyDescriptor,g4=(e,t,r,n)=>{for(var i=n>1?void 0:n?C4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},f6=(e,t)=>(r,n)=>t(r,n,e);f.DesktopConfirmService=class extends h.Disposable{constructor(r,n){super();F(this,"_confirmOptions",[]);F(this,"confirmOptions$",new j.BehaviorSubject([]));this._injector=r,this._uiPartsService=n,this._initUIPart()}open(r){return this._confirmOptions.find(n=>n.id===r.id)?this._confirmOptions=this._confirmOptions.map(n=>({...n.id===r.id?r:n,visible:n.id===r.id?!0:n.visible})):this._confirmOptions.push({...r,visible:!0}),this.confirmOptions$.next(this._confirmOptions),h.toDisposable(()=>{this._confirmOptions=[],this.confirmOptions$.next([])})}confirm(r){return new Promise(n=>{const i=this.open({...r,onConfirm:()=>{i.dispose(),n(!0)},onClose:()=>{i.dispose(),n(!1)}})})}close(r){this._confirmOptions=this._confirmOptions.map(n=>({...n,visible:n.id===r?!1:n.visible})),this.confirmOptions$.next([...this._confirmOptions])}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(i1.GLOBAL,()=>x.connectInjector(v4,this._injector)))}},f.DesktopConfirmService=g4([f6(0,h.Inject(h.Injector)),f6(1,g1)],f.DesktopConfirmService);const ue=h.createIdentifier("univer.ui.dialog-service");function m4(){const e=x.useDependency(ue),[t,r]=s.useState([]);s.useEffect(()=>{const a=e.getDialogs$().subscribe(o=>{r(o)});return()=>a.unsubscribe()},[]);const n=s.useMemo(()=>t.map(i=>{const{children:a,title:o,footer:c,...v}=i,m=v;for(const L of["children","title","footer"]){const d=L,_=i[d];_&&(m[d]=C.jsx(l1,{..._}))}return m}),[t]);return n==null?void 0:n.map(i=>C.jsx(z.Dialog,{...i},i.id))}var p4=Object.getOwnPropertyDescriptor,b4=(e,t,r,n)=>{for(var i=n>1?void 0:n?p4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},h6=(e,t)=>(r,n)=>t(r,n,e);f.DesktopDialogService=class extends h.Disposable{constructor(r,n){super();F(this,"_dialogOptions",[]);F(this,"_dialogOptions$",new j.Subject);this._injector=r,this._uiPartsService=n,this._initUIPart()}dispose(){super.dispose(),this._dialogOptions=[],this._dialogOptions$.complete()}open(r){return this._dialogOptions.find(n=>n.id===r.id)?this._dialogOptions=this._dialogOptions.map(n=>({...n.id===r.id?r:n,open:n.id===r.id?!0:n.open})):this._dialogOptions.push({...r,open:!0}),this._dialogOptions$.next(this._dialogOptions),h.toDisposable(()=>{this._dialogOptions=[],this._dialogOptions$.next([])})}close(r){this._dialogOptions=this._dialogOptions.map(n=>({...n,open:n.id===r?!1:n.open})),this._dialogOptions$.next([...this._dialogOptions])}closeAll(r){const n=new Set(r);this._dialogOptions=this._dialogOptions.map(i=>({...i,open:n.has(i.id)?i.open:!1})),this._dialogOptions$.next([...this._dialogOptions])}getDialogs$(){return this._dialogOptions$.asObservable()}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(i1.GLOBAL,()=>x.connectInjector(m4,this._injector)))}},f.DesktopDialogService=b4([h6(0,h.Inject(h.Injector)),h6(1,g1)],f.DesktopDialogService);const de=h.createIdentifier("univer.ui.gallery-service");function L4(){const e=x.useDependency(de),t=x.useObservable(e.gallery$);return t?C.jsx(z.Gallery,{...t}):null}var y4=Object.getOwnPropertyDescriptor,_4=(e,t,r,n)=>{for(var i=n>1?void 0:n?y4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},v6=(e,t)=>(r,n)=>t(r,n,e);f.DesktopGalleryService=class extends h.Disposable{constructor(r,n){super();F(this,"gallery$",new j.Subject);this._injector=r,this._uiPartsService=n,this._initUIPart()}dispose(){super.dispose()}open(r){return this.gallery$.next({open:!0,...r}),h.toDisposable(()=>{this.gallery$.complete()})}close(){this.gallery$.next({open:!1,images:[]})}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(i1.GLOBAL,()=>x.connectInjector(L4,this._injector)))}},f.DesktopGalleryService=_4([v6(0,h.Inject(h.Injector)),v6(1,g1)],f.DesktopGalleryService);var S4=Object.getOwnPropertyDescriptor,M4=(e,t,r,n)=>{for(var i=n>1?void 0:n?S4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},w4=(e,t)=>(r,n)=>t(r,n,e);f.DesktopGlobalZoneService=class{constructor(t){F(this,"visible$",new j.Subject);F(this,"componentKey$",new j.Subject);F(this,"_componentKey","");this._componentManager=t}get componentKey(){return this._componentKey}set(t,r){return this._componentManager.register(t,r),this.componentKey$.next(t),this._componentKey=t,h.toDisposable(()=>{this._componentManager.delete(t),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}},f.DesktopGlobalZoneService=M4([w4(0,h.Inject(d1))],f.DesktopGlobalZoneService);var fe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function H4(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function he(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Je={exports:{}};/*!
11
11
  localForage -- Offline Storage, Improved
12
12
  Version 1.10.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/preset-docs-core",
3
- "version": "0.7.0-nightly.202505121607",
3
+ "version": "0.7.0",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -57,21 +57,21 @@
57
57
  "rxjs": ">=7.0.0"
58
58
  },
59
59
  "dependencies": {
60
- "@univerjs/design": "0.7.0-nightly.202505121607",
61
- "@univerjs/docs": "0.7.0-nightly.202505121607",
62
- "@univerjs/docs-ui": "0.7.0-nightly.202505121607",
63
- "@univerjs/engine-formula": "0.7.0-nightly.202505121607",
64
- "@univerjs/engine-render": "0.7.0-nightly.202505121607",
65
- "@univerjs/network": "0.7.0-nightly.202505121607",
66
- "@univerjs/ui": "0.7.0-nightly.202505121607",
67
- "rxjs": ">=7.0.0"
60
+ "@univerjs/design": "0.7.0",
61
+ "@univerjs/docs": "0.7.0",
62
+ "@univerjs/docs-ui": "0.7.0",
63
+ "@univerjs/engine-formula": "0.7.0",
64
+ "@univerjs/engine-render": "0.7.0",
65
+ "@univerjs/network": "0.7.0",
66
+ "@univerjs/ui": "0.7.0"
68
67
  },
69
68
  "devDependencies": {
70
- "@univerjs/core": "0.7.0-nightly.202505121607",
69
+ "@univerjs/core": "0.7.0",
71
70
  "react": "18.3.1",
72
71
  "react-dom": "18.3.1",
72
+ "rxjs": "7.8.2",
73
73
  "typescript": "^5.8.3",
74
- "@univerjs-infra/shared": "0.7.0-beta.1"
74
+ "@univerjs-infra/shared": "0.7.0"
75
75
  },
76
76
  "scripts": {
77
77
  "prebuild:preset": "tsx prepare.ts",