@univerjs/ui 0.10.10 → 0.10.11-nightly.202510220308

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/lib/cjs/index.js CHANGED
@@ -8,7 +8,7 @@ hover:univer-bg-gray-100 whitespace-nowrap univer-w-max
8
8
  `;function X6(e){const{children:t,className:r,style:n,disabled:i=!1,active:a=!1,noIcon:o,onClick:c,onDoubleClick:C,...g}=e,p=L=>{if(i){L.preventDefault();return}c&&c(L)},d=L=>{if(i){L.preventDefault();return}C&&C(L)};return h.jsx("button",{type:"button",className:T.clsx(Y6,{"univer-px-2":o,"!univer-bg-gray-200 dark:!univer-bg-gray-500":a}),style:n,disabled:i,onClick:p,onDoubleClick:d,...g,children:t})}function q6(e){const{disabled$:t,hidden$:r,activated$:n,value$:i}=e,[a,o]=s.useState(),[c,C]=s.useState(!1),[g,p]=s.useState(!1),[d,L]=s.useState(!1);return s.useEffect(()=>{const _=[];return t&&_.push(t.subscribe(M=>C(M))),r&&_.push(r.subscribe(M=>L(M))),n&&_.push(n.subscribe(M=>p(M))),i&&_.push(i.subscribe(M=>o(M))),()=>_.forEach(M=>M.unsubscribe())},[n,t,r,i]),{disabled:c,value:a,activated:g,hidden:d}}const f3=s.createContext({dropdownVisible:!1,setDropdownVisible:e=>{}}),i4=s.forwardRef((e,t)=>{const{children:r,...n}=e,i=s.useRef(null),[a,o]=s.useState(!1),[c,C]=s.useState(!1);function g(L){o(c?!1:L)}function p(L){C(L),o(!1)}const d=s.useMemo(()=>({dropdownVisible:c,setDropdownVisible:p}),[c]);return s.useImperativeHandle(t,()=>({el:i.current})),n.title?h.jsx(T.Tooltip,{visible:a,onVisibleChange:g,...n,children:h.jsx("span",{ref:i,children:h.jsx(f3.Provider,{value:d,children:r})})}):h.jsx("span",{ref:i,children:r})});function o4(e){const{children:t,overlay:r,disabled:n,align:i="start"}=e,{dropdownVisible:a,setDropdownVisible:o}=s.useContext(f3);function c(C){o(C)}return h.jsx(T.Dropdown,{align:i,overlay:h.jsx("div",{className:"univer-grid univer-gap-2",children:r}),disabled:n,open:a,onOpenChange:c,children:h.jsx("div",{className:"univer-h-full",onClick:C=>C.stopPropagation(),children:t})})}function fe({icon:e,value:t,option:r,onOptionSelect:n}){var o;const i=c=>{n==null||n({value:c,label:r==null?void 0:r.label,commandId:r==null?void 0:r.commandId})},a=typeof r.label=="string"||typeof r.label=="object"&&((o=r.label)==null?void 0:o.selectable)!==!1;return h.jsxs("div",{className:T.clsx("univer-relative univer-flex univer-items-center univer-gap-2",{"univer-pl-6":a}),children:[a&&String(t)===String(r.value)&&h.jsx(Je,{className:"univer-absolute univer-left-1 univer-top-0.5 univer-text-primary-600"}),h.jsx(h1,{className:"univer-text-sm",icon:e,value$:r.value$,value:r.value,label:r.label,onChange:i})]})}function rt({menuId:e,slot:t,value:r,options:n,children:i,disabled:a,onOptionSelect:o}){var O;const{dropdownVisible:c,setDropdownVisible:C}=s.useContext(f3),g=D.useDependency(x1),[p,d]=s.useState({}),L=s.useMemo(()=>e?g.getMenuByPositionKey(e):[],[e]),_=s.useMemo(()=>L.filter(H=>{var V;if(!H.children)return!p[H.key];const x=((V=H.key)==null?void 0:V.toString())||"";return!p[x]}),[L,p]);function M(H){C(H)}if(s.useEffect(()=>{const H=[];return L.forEach(x=>{var V;if(x.children){const R=x.children.map(y=>{var N,k;return(k=(N=y.item)==null?void 0:N.hidden$)!=null?k:F.of(!1)}),B=F.combineLatest(R).subscribe(y=>{const N=y.every(k=>k===!0);d(k=>({...k,[x.key]:N}))});H.push(B)}else if((V=x.item)!=null&&V.hidden$){const R=x.item.hidden$.subscribe(B=>{d(y=>({...y,[x.key]:B}))});H.push(R)}}),()=>{H.forEach(x=>x==null?void 0:x.unsubscribe()),d({})}},[L]),t)return h.jsx(o4,{disabled:a,overlay:n.map((H,x)=>h.jsx(fe,{value:r,option:H,onOptionSelect:o},x)),children:i});if(n!=null&&n.length){const H=n.map(x=>{var V;return{type:"item",className:T.clsx({"focus:univer-bg-white":typeof x.label!="string"&&((V=x.label)==null?void 0:V.hoverable)===!1}),children:h.jsx(fe,{icon:x.icon,value:r,option:x,onOptionSelect:o}),disabled:x.disabled,onSelect:()=>{typeof x.value>"u"||o==null||o({...x})}}});for(const x of _){if(!x.item)continue;const{title:V,id:R,commandId:B,icon:y}=x.item;if(!V)throw new Error("Menu item title is required");H.push({type:"item",children:h.jsx(fe,{icon:y,value:r,option:{label:{name:V,selectable:!1}}}),onSelect:()=>{o==null||o({commandId:B,id:R})}})}return h.jsx(T.DropdownMenu,{align:"start",items:H,disabled:a,open:c,onOpenChange:M,children:i})}else{const H=[];for(const x of _)if(x.item){const{title:V,id:R,commandId:B,icon:y}=x.item;if(!V)throw new Error("Menu item title is required");H.push({type:"item",children:h.jsx(fe,{icon:y,value:r,option:{label:{name:V,selectable:!1}}}),onSelect:()=>{o==null||o({commandId:B,id:R})}})}else(O=x.children)!=null&&O.length;return h.jsx(T.DropdownMenu,{align:"start",items:H,disabled:a,open:c,onOpenChange:M,children:i})}}const X1=s.forwardRef((e,t)=>{const r=D.useDependency(f.LocaleService),n=D.useDependency(f.ICommandService),i=D.useDependency(S1),a=D.useDependency(m1),{value:o,hidden:c,disabled:C,activated:g}=q6(e),p=(z,W)=>{i.focus(),n.executeCommand(z,W)},{tooltip:d,shortcut:L,icon:_,title:M,label:O,id:H,commandId:x,type:V,slot:R,params:B}=e,y=r.t(d!=null?d:"")+(L?` (${L})`:""),{selections:N}=e,k=s.useMemo(()=>F.isObservable(N)?N:new F.Observable(z=>{z.next(N)}),[N]),Y=D.useObservable(k),$=s.useMemo(()=>F.isObservable(_)?_:new F.Observable(z=>{var K,a1;const W=(a1=(K=Y==null?void 0:Y.find(u1=>u1.value===o))==null?void 0:K.icon)!=null?a1:_;z.next(W)}),[_,Y,o]),G=D.useObservable($,void 0,!0);function X(z){var o1;const W=e.selectionsCommandId,K=x!=null?x:H,a1=(o1=W!=null?W:x)!=null?o1:H;function u1(r1){if(C)return;let c1=a1;r1.id&&(c1=r1.id),p(c1,{value:r1.value})}function p1(r1){C||p(a1,{value:r1})}function L1(){C||z===g1.BUTTON_SELECTOR&&p(K,{value:o})}return z===g1.BUTTON_SELECTOR?h.jsxs("div",{"data-u-command":H,"data-disabled":C,className:T.clsx("univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-rounded univer-pr-5 univer-text-sm univer-transition-colors hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",{"univer-text-gray-900 dark:!univer-text-white":!C,"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600":C}),children:[h.jsx("div",{className:T.clsx("univer-relative univer-z-[1] univer-flex univer-h-full univer-items-center univer-rounded-l univer-px-1 univer-transition-colors hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-600",{"univer-bg-gray-200 dark:!univer-bg-gray-500":g,"univer-bg-gray-100":g&&C}),onClick:L1,children:h.jsx(h1,{icon:G,title:M,value:o,label:O,onChange:p1})}),h.jsx(rt,{menuId:H,slot:R,value:o,options:Y,disabled:C,onOptionSelect:u1,children:h.jsx("div",{className:T.clsx("univer-absolute univer-right-0 univer-top-0 univer-box-border univer-flex univer-h-6 univer-w-5 univer-items-center univer-justify-center univer-rounded-r univer-transition-colors hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-600",{"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600":C,"univer-bg-gray-200 dark:!univer-bg-gray-500":g,"univer-bg-gray-100":g&&C}),"data-disabled":C,children:h.jsx(Q1,{})})})]}):h.jsx(rt,{menuId:H,slot:R,value:o,options:Y,disabled:C,onOptionSelect:u1,children:h.jsxs("div",{"data-u-command":H,className:T.clsx("univer-animate-in univer-fade-in univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-gap-2 univer-whitespace-nowrap univer-rounded univer-px-1 univer-transition-colors hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",{"univer-text-gray-900 dark:!univer-text-white":!C,"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600":C,"univer-bg-gray-200":g,"univer-bg-gray-100":g&&C}),children:[h.jsx(h1,{icon:G,title:M,value:o,label:O,onChange:p1}),h.jsx("div",{className:T.clsx("univer-flex univer-h-full univer-items-center",{"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600":C}),children:h.jsx(Q1,{})})]})})}function q(){var W;const z=a.get(typeof O=="string"?O:(W=O==null?void 0:O.name)!=null?W:"");return h.jsx(X6,{"data-u-command":H,className:"univer-text-sm",noIcon:!_,active:g,disabled:C,onClick:()=>{var K;return p((K=e.commandId)!=null?K:e.id,o!=null?o:B)},onDoubleClick:()=>e.subId&&p(e.subId),children:z?h.jsx(h1,{title:M,value:o,label:O}):_?h.jsx(h1,{icon:_}):h.jsx(h1,{title:M})})}function Q(){switch(V){case g1.BUTTON_SELECTOR:case g1.SELECTOR:case g1.SUBITEMS:return X(V);case g1.BUTTON:default:return q()}}return!c&&h.jsx(i4,{ref:t,title:y,placement:"bottom",children:Q()})}),a4={[f1.START]:f9,[f1.INSERT]:w9,[f1.FORMULAS]:Ke,[f1.DATA]:Pt,[f1.VIEW]:e9,[f1.OTHERS]:e3};function J6(e){const{ribbonType:t,headerMenuComponents:r,headerMenu:n=!0}=e,i=D.useDependency(x1),a=D.useDependency(f.IUniverInstanceService),o=D.useDependency(f.LocaleService),[c,C]=s.useState(0),g=D.useObservable(a.focused$);s.useEffect(()=>{const $=i.menuChanged$.subscribe(()=>{C(G=>G+1)});return()=>{$.unsubscribe()}},[]);const p=s.useRef(null),d=s.useRef({}),[L,_]=s.useState([]),[M,O]=s.useState(f1.START),[H,x]=s.useState(!1),[V,R]=s.useState([]),[B,y]=s.useState(!1),N=s.useCallback($=>{d.current={},O($.key),x(!1)},[]);s.useEffect(()=>{var q;const $=i.getMenuByPositionKey(ee.RIBBON),G=[],X=[];for(const Q of $)if(Q.children){for(const z of Q.children)if(z.children)for(const W of z.children)(q=W.item)!=null&&q.hidden$&&(G.push(W.item.hidden$),X.push(`${Q.key}/${z.key}/${W.key}`))}F.combineLatest(G).subscribe(Q=>{var K,a1,u1,p1,L1,o1;const z=[],W=Q.map((r1,c1)=>r1?X[c1]:null).filter(r1=>!!r1);for(const r1 of $){const c1={...r1,children:[]};if((K=r1.children)!=null&&K.length)for(const b1 of r1.children){const M1={...b1,children:[]};let V1=!0;if((a1=b1.children)!=null&&a1.length){for(const Z1 of b1.children){const j1=`${r1.key}/${b1.key}/${Z1.key}`;W.includes(j1)||(u1=M1.children)==null||u1.push(Z1)}(p1=M1.children)!=null&&p1.every(Z1=>{var j1;return((j1=Z1.children)==null?void 0:j1.length)===0})&&(V1=!1)}V1&&((L1=c1.children)==null||L1.push(M1))}(o1=c1.children)!=null&&o1.length&&c1.children.every(b1=>{var M1;return(M1=b1.children)==null?void 0:M1.length})&&z.push(c1)}if(t==="simple"){const r1=[{key:f1.START,children:[],order:0}];z.forEach(c1=>{var b1;(b1=c1.children)==null||b1.forEach(M1=>{var V1;(V1=r1[0].children)==null||V1.push(M1)})}),_(r1)}else _(z)}).unsubscribe()},[c,g]);const k=s.useMemo(()=>{var q,Q;const $=(Q=(q=L.find(z=>z.key===M))==null?void 0:q.children)!=null?Q:[],G=[],X=[];for(const z of $)if(z.children){const W=z.children.filter(K=>!V.includes(K.key));W.length>0&&G.push({...z,children:W}),W.length<z.children.length&&X.push({...z,children:z.children.filter(K=>V.includes(K.key))})}return{allGroups:$,visibleGroups:G,hiddenGroups:X}},[V,L,M]);s.useEffect(()=>{let $=null;const G=new ResizeObserver(f.throttle(X=>{for(const q of X)y(!0),$=requestAnimationFrame(()=>{var L1,o1;const{width:Q}=q.contentRect,W=Object.values(d.current).sort((r1,c1)=>r1.order-c1.order||r1.groupOrder-c1.groupOrder||r1.itemOrder-c1.itemOrder),K=[];let a1=32;const p1=(((o1=(L1=L.find(r1=>r1.key===M))==null?void 0:L1.children)!=null?o1:[]).length-1)*8;a1+=p1;for(const{el:r1,key:c1}of W){const{width:b1}=r1.getBoundingClientRect();a1+=b1+8,a1>Q&&K.push(c1)}R(K),y(!1)})},100));return G.observe(p.current),()=>{$&&cancelAnimationFrame($),G.disconnect()}},[L,M]);const Y=s.useMemo(()=>h.jsx("div",{"aria-hidden":"true",className:T.clsx("univer-invisible univer-absolute -univer-left-[99999] -univer-top-[99999] univer-box-border univer-flex univer-h-10 univer-min-w-min univer-items-center univer-px-3 univer-opacity-0",{"univer-hidden":!B},T.divideXClassName,T.borderBottomClassName),children:k.allGroups.map(($,G)=>{var X,q;return(((X=$.children)==null?void 0:X.length)||$.item)&&h.jsx(s.Fragment,{children:h.jsx("div",{className:"univer-grid univer-shrink-0 univer-grid-flow-col univer-gap-2 univer-px-2",children:$.children&&((q=$.children)==null?void 0:q.map(Q=>Q.item&&h.jsx(X1,{...Q.item,ref:z=>{z!=null&&z.el&&(d.current[Q.key]={el:z.el,key:Q.key,order:G,groupOrder:$.order,itemOrder:Q.order})}},Q.key)))})},$.key)})}),[k.allGroups,B]);return h.jsxs(h.Fragment,{children:[n&&r&&r.size>0&&h.jsx("header",{className:T.clsx("univer-relative univer-h-11 univer-select-none",T.borderBottomClassName),children:h.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:h.jsx(v1,{components:r})})}),h.jsxs("div",{className:T.clsx("univer-box-border univer-grid univer-h-10 univer-grid-flow-col univer-items-center univer-px-3",{"univer-grid-cols-[auto,1fr]":L.length>1,"univer-grid-cols-none":L.length===1},T.borderBottomClassName),children:[L.length>1&&h.jsx(T.HoverCard,{className:"univer-max-w-96 !univer-rounded-xl",align:"start",open:H,overlay:h.jsx("div",{className:"univer-grid univer-gap-1 univer-px-2 univer-py-1",children:L.map($=>{const G=a4[$.key];return h.jsxs("a",{"data-u-comp":"ribbon-group-btn",className:"univer-box-border univer-flex univer-cursor-pointer univer-items-center univer-gap-2.5 univer-rounded-lg univer-px-2 univer-py-1.5 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",onClick:()=>N($),children:[h.jsx("span",{className:T.clsx("univer-box-border univer-flex univer-size-9 univer-flex-shrink-0 univer-items-center univer-justify-center univer-rounded-lg",T.borderClassName),children:h.jsx(G,{className:"univer-text-gray-500 dark:!univer-text-gray-300"})}),h.jsxs("span",{className:"univer-flex univer-flex-col",children:[h.jsx("strong",{className:"univer-text-sm univer-font-semibold univer-text-gray-800 dark:!univer-text-gray-200",children:o.t($.key)}),h.jsx("span",{className:"univer-text-xs univer-text-gray-400",children:o.t(`${$.key}Desc`)})]})]},$.key)})}),onOpenChange:x,children:h.jsxs("a",{className:"univer-mr-2 univer-flex univer-h-7 univer-cursor-pointer univer-items-center univer-gap-1.5 univer-whitespace-nowrap !univer-rounded-full univer-bg-gray-700 univer-pl-3 univer-pr-2 univer-text-sm univer-text-white dark:!univer-bg-gray-200 dark:!univer-text-gray-800",onClick:()=>x(!0),children:[o.t(M),h.jsx(Q1,{className:"univer-text-gray-200 dark:!univer-text-gray-500"})]})}),h.jsxs("div",{"data-u-comp":"ribbon-toolbar",ref:p,className:T.clsx("univer-flex univer-overflow-hidden",T.divideXClassName),children:[k.visibleGroups.map($=>{var G,X;return(((G=$.children)==null?void 0:G.length)||$.item)&&h.jsx(s.Fragment,{children:h.jsx("div",{className:"univer-grid univer-shrink-0 univer-grid-flow-col univer-gap-2 univer-px-2",children:$.children&&((X=$.children)==null?void 0:X.map(q=>q.item&&h.jsx(X1,{...q.item},q.key)))})},$.key)}),V.length>0&&h.jsx("div",{"data-u-comp":"ribbon-toolbar-more",className:"univer-pl-2 rtl:univer-pr-2",children:h.jsx(T.Dropdown,{collisionPadding:{right:12,left:12},overlay:h.jsx("div",{className:"univer-box-border univer-grid univer-max-w-[var(--radix-popper-available-width)] univer-gap-2 univer-p-2",children:k.hiddenGroups.map($=>{var G;return h.jsx("div",{className:"univer-flex univer-items-center univer-gap-2",children:h.jsx("div",{className:"univer-flex univer-flex-wrap univer-gap-2",children:$.children?(G=$.children)==null?void 0:G.map(X=>X.item&&h.jsx(X1,{...X.item},X.key)):$.item&&h.jsx(X1,{...$.item},$.key)})},$.key)})}),children:h.jsx("a",{className:Y6,type:"button",children:h.jsx(e3,{})})})})]})]}),Y]})}class ie extends f.Disposable{constructor(){super(...arguments);U(this,"_styleSheetId","univer-theme-css-variables")}injectThemeToHead(r){function n(c,C="--univer"){const g=[];function p(d,L=""){for(const _ in d){const M=d[_],O=L?`${L}-${_}`:_;typeof M=="object"&&M!==null?p(M,O):g.push(`${C}-${O}: ${M};`)}}return p(c),g.join(`
9
9
  `)}const i=n(r),a=document.getElementById(this._styleSheetId);a&&a.remove();const o=document.createElement("style");o.setAttribute("id",this._styleSheetId),o.innerHTML=`:root {
10
10
  ${i}
11
- }`,document.head.appendChild(o)}dispose(){super.dispose()}}const oe=f.createIdentifier("ui.contextmenu.service");class h3 extends f.Disposable{constructor(){super(...arguments);U(this,"_currentHandler",null);U(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,f.toDisposable(()=>this._currentHandler=null)}}function Q6(){const e=s.useRef(null),[t,r]=s.useState(!1),[n,i]=s.useState(""),[a,o]=s.useState([0,0]),c=s.useRef(t),C=D.useDependency(oe),g=D.useDependency(f.ICommandService),p=D.useInjector();c.current=t,s.useEffect(()=>{const _=C.registerContextMenuHandler({handleContextMenu:d,hideContextMenu(){r(!1)},get visible(){return c.current}});function M(O){e.current&&!e.current.contains(O.target)&&L()}return document.addEventListener("pointerdown",M),document.addEventListener("wheel",L),()=>{document.removeEventListener("pointerdown",M),document.removeEventListener("wheel",L),_.dispose()}},[C]);function d(_,M){r(!1),requestAnimationFrame(()=>{i(M),o([_.clientX,_.clientY]),r(!0)})}function L(){r(!1)}return h.jsx(T.Popup,{visible:t,offset:a,children:h.jsx("section",{ref:e,children:n&&h.jsx(n3,{menuType:n,onOptionSelect:_=>{const{label:M,commandId:O,value:H}=_;g&&g.executeCommand(O!=null?O:M,{value:H}),p.get(S1).focus(),r(!1)}})})})}const xe=f.createIdentifier("univer.global-zone-service");function C3(){const e=D.useDependency(xe),[t,r]=s.useState(!1),n=D.useObservable(e.componentKey$,e.componentKey),i=D.useDependency(m1),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?h.jsx("section",{className:T.clsx("univer-absolute univer-bg-gray-100",{"univer-hidden":!t,"univer-inset-0 univer-z-[100] univer-block univer-size-full":t}),children:a&&h.jsx(a,{})}):null}function v3(){const e=D.useDependency(P1),t=D.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 C=c;if(t[C]){const{key:g,...p}=t[C];p&&(o[C]=h.jsx(h1,{...p},g))}}return o},[t]);s.useEffect(()=>(r.current&&e.setContainer(r.current),()=>{e.setContainer(void 0)}),[e]),s.useEffect(()=>{const o=C=>{e.scrollEvent$.next(C)},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 h.jsx("section",{"data-u-comp":"sidebar",className:T.clsx("univer-relative univer-h-full univer-bg-white univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-white",{"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:h.jsxs("section",{ref:r,className:T.clsx("univer-box-border univer-grid univer-h-0 univer-min-h-full univer-grid-rows-[auto_1fr_auto] univer-overflow-y-auto",T.borderLeftBottomClassName,T.scrollbarClassName),children:[h.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,h.jsx("a",{className:"univer-cursor-pointer univer-text-gray-500 dark:!univer-text-gray-300",onClick:a,children:h.jsx(Qe,{})})]}),h.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)&&h.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 Se=f.createIdentifier("univer.zen-zone-service");function g3(){const e=D.useDependency(Se),[t,r]=s.useState(!1),[n,i]=s.useState(),a=D.useObservable(e.temporaryHidden$),o=D.useDependency(m1);s.useEffect(()=>{const C=[e.visible$.subscribe(g=>{r(g)}),e.componentKey$.subscribe(g=>{i(g)})];return()=>{C.forEach(g=>{g.unsubscribe()})}},[]);const c=s.useMemo(()=>{const C=o.get(n!=null?n:"");if(C)return C},[n]);return h.jsx("section",{className:T.clsx("univer-absolute univer-z-[-1] univer-flex",{"univer-animate-in univer-fade-in univer-inset-0 univer-z-[100] univer-bg-gray-100":t,"univer-hidden":a}),children:h.jsx("div",{className:"univer-relative univer-flex-1",children:c&&h.jsx(c,{})})})}function s4(e){const t=S6(U1);return h.jsx(l4,{...e,...t})}function l4(e){var Q;const{header:t=!0,toolbar:r=!0,footer:n=!0,headerMenu:i=!0,contextMenu:a=!0,ribbonType:o="default",mountContainer:c,onRendered:C}=e,g=D.useDependency(f.LocaleService),p=D.useDependency(f.ThemeService),d=D.useDependency(ie),L=s.useRef(null),M=D.useDependency(f.IConfigService).getConfig(U1),O=C1(i1.CUSTOM_HEADER),H=C1(i1.FOOTER),x=C1(i1.HEADER),V=C1(i1.HEADER_MENU),R=C1(i1.CONTENT),B=C1(i1.LEFT_SIDEBAR),y=C1(i1.GLOBAL),N=C1(i1.TOOLBAR),k=(Q=M==null?void 0:M.popupRootId)!=null?Q:"univer-popup-portal";s.useLayoutEffect(()=>{const z=p.currentTheme$.subscribe(W=>{d.injectThemeToHead(W)});return()=>{z.unsubscribe()}},[]);const[Y,$]=s.useState(!1);s.useLayoutEffect(()=>{const z=p.darkMode$.subscribe(W=>{$(W),W?document.documentElement.classList.add("univer-dark"):document.documentElement.classList.remove("univer-dark")});return()=>{z.unsubscribe()}},[]),s.useEffect(()=>{L.current&&(C==null||C(L.current))},[C]);const[G,X]=s.useState(g.getLocales()),q=s.useMemo(()=>document.createElement("div"),[]);return s.useEffect(()=>{document.body.appendChild(q);const z=[g.localeChanged$.subscribe(()=>{X(g.getLocales())})];return()=>{z.forEach(W=>W.unsubscribe()),document.body.removeChild(q)}},[g,c,q]),h.jsxs(T.ConfigProvider,{locale:G==null?void 0:G.design,mountContainer:q,children:[h.jsxs("div",{"data-u-comp":"workbench-layout",className:T.clsx("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",{"univer-dark":Y}),tabIndex:-1,onBlur:z=>z.stopPropagation(),onContextMenu:z=>z.preventDefault(),children:[h.jsx("div",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",children:h.jsx(v1,{components:O},"custom-header")}),t&&r&&h.jsx("header",{"data-u-comp":"headerbar",className:"univer-relative univer-z-10 univer-w-full univer-overflow-hidden",children:h.jsx(v1,{components:N,sharedProps:{ribbonType:o,headerMenuComponents:V,headerMenu:i}},"toolbar")}),h.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[h.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[h.jsx("aside",{"data-u-comp":"left-sidebar",className:"univer-h-full",children:h.jsx(v1,{components:B},"left-sidebar")}),h.jsxs("section",{className:T.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",T.borderBottomClassName),children:[h.jsx("header",{children:t&&h.jsx(v1,{components:x},"header")}),h.jsx("section",{className:"univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",ref:L,"data-range-selector":!0,onContextMenu:z=>z.preventDefault(),children:h.jsx(v1,{components:R},"content")})]}),h.jsx("aside",{"data-u-comp":"right-sidebar",className:"univer-h-full",children:h.jsx(v3,{})})]}),n&&h.jsx("footer",{children:h.jsx(v1,{components:H,sharedProps:{contextMenu:a}},"footer")}),h.jsx(g3,{})]})]}),h.jsx(v1,{components:y},"global"),h.jsx(C3,{}),a&&h.jsx(Q6,{}),h.jsx(c4,{}),h.jsx("div",{id:k})]})}function c4(){const{mountContainer:e}=s.useContext(T.ConfigContext),t=C1(i1.FLOATING);return vt.createPortal(h.jsx(v1,{components:t},"floating"),e)}const u4=3e3;class m3 extends f.Disposable{constructor(r,n,i,a,o){super();U(this,"_steadyTimeout");U(this,"_renderTimeout");U(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)));try{await this._lifecycleService.onStage(f.LifecycleStages.Ready),this._renderTimeout=window.setTimeout(()=>{const i=this._renderManagerService.getRenderAll();for(const[a]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=f.LifecycleStages.Rendered,this._steadyTimeout=window.setTimeout(()=>{this._lifecycleService.stage=f.LifecycleStages.Steady},u4)},300)}catch(i){if(i instanceof f.LifecycleUnreachableError)return;throw i}}))}_changeRenderUnit(r,n){if(this._currentRenderId===r)return!1;const i=this._renderManagerService.getRenderById(r);if(!i||!i.unitId||f.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 d4=Object.getOwnPropertyDescriptor,f4=(e,t,r,n)=>{for(var i=n>1?void 0:n?d4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},R1=(e,t)=>(r,n)=>t(r,n,e);exports.DesktopUIController=class extends m3{constructor(t,r,n,i,a,o,c,C,g){super(r,o,a,n,i),this._config=t,this._componentManager=g,c.mergeMenu(j6),this._initBuiltinComponents(C),this._registerComponents(),this._bootstrapWorkbench()}_registerComponents(){[[_6,w6],[M6,y6],[E6,H6],[D6,R6],[V6,O6],[I6,T.ColorPicker]].forEach(([t,r])=>{this.disposeWithMe(this._componentManager.register(t,r))})}bootstrap(t){return h4(this._injector,this._config,t)}_initBuiltinComponents(t){this.disposeWithMe(t.registerComponent(i1.FLOATING,()=>D.connectInjector(d3,this._injector))),this.disposeWithMe(t.registerComponent(i1.CONTENT,()=>D.connectInjector(c3,this._injector))),this.disposeWithMe(t.registerComponent(i1.TOOLBAR,()=>D.connectInjector(J6,this._injector)))}};exports.DesktopUIController=f4([R1(1,f.Inject(f.Injector)),R1(2,f.Inject(f.LifecycleService)),R1(3,re.IRenderManagerService),R1(4,S1),R1(5,f.IUniverInstanceService),R1(6,x1),R1(7,y1),R1(8,f.Inject(m1))],exports.DesktopUIController);function h4(e,t,r){let n;const i=t.container;if(typeof i=="string"){const C=document.getElementById(i);C?n=C:n=nt(i)}else i instanceof HTMLElement?n=i:n=nt("univer");const a=D.connectInjector(s4,e),o=C=>r(C,n);function c(){T.render(h.jsx(a,{...t,mountContainer:n,onRendered:o}),n)}return c(),f.toDisposable(()=>{T.render(h.jsx("div",{}),n),setTimeout(()=>T.render(h.jsx("div",{}),n),200),setTimeout(()=>T.unmount(n),500)})}function nt(e){const t=document.createElement("div");return t.id=e,t}const te=f.createIdentifier("univer.ui.ui-controller");function C4(e){const{menuType:t,onOptionSelect:r}=e,n=D.useDependency(x1);if(!t)return null;const i=s.useMemo(()=>{const a=n.getMenuByPositionKey(t);function o(c){return c.reduce((C,g)=>g.children?[...C,...o(g.children)]:[...C,g],[])}return o(a)},[t]);return h.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)}, 72px)`},children:i.map(a=>a.item&&h.jsx(v4,{menuItem:a.item,onClick:o=>r==null?void 0:r({value:"",label:a.key,...o})},a.key))})}function v4(e){const{menuItem:t,onClick:r}=e,{id:n,type:i,title:a,label:o,icon:c}=t;if(i!==g1.BUTTON)throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${n}".`);const C=D.useObservable(t.disabled$,!1),g=D.useObservable(t.value$);return h.jsx("button",{type:"button",className:T.clsx("univer-w-18 univer-flex 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:C,onClick:()=>r({id:n}),children:h.jsx(h1,{value:g,title:a,label:o,icon:c})},n)}function K6(){const[e,t]=s.useState(!1),[r,n]=s.useState(""),[i,a]=s.useState([0,0]),o=s.useRef(e),c=D.useDependency(oe),C=D.useDependency(f.ICommandService);o.current=e,s.useEffect(()=>{const d=c.registerContextMenuHandler({handleContextMenu:g,hideContextMenu(){t(!1)},get visible(){return o.current}});return document.addEventListener("pointerdown",p),document.addEventListener("wheel",p),()=>{document.removeEventListener("pointerdown",p),document.removeEventListener("wheel",p),d.dispose()}},[c]);function g(d,L){n(L),a([d.clientX,d.clientY]),t(!0)}function p(){t(!1)}return h.jsx(T.Popup,{visible:e,offset:i,children:h.jsx("section",{onPointerDown:d=>d.stopPropagation(),children:r&&h.jsx(C4,{menuType:r,onOptionSelect:d=>{const{label:L,value:_,commandId:M}=d;C&&C.executeCommand(M!=null?M:L,{value:_}),t(!1)}})})})}function g4(e){const{header:t=!0,footer:r=!0,contextMenu:n=!0,mountContainer:i,onRendered:a}=e,o=D.useDependency(f.LocaleService),c=D.useDependency(f.ThemeService),C=D.useDependency(ie),g=s.useRef(null),p=C1(i1.FOOTER),d=C1(i1.HEADER),L=C1(i1.CONTENT),_=C1(i1.LEFT_SIDEBAR),M=C1(i1.GLOBAL),[O,H]=s.useState(!1);s.useEffect(()=>{const B=c.darkMode$.subscribe(y=>{H(y)});return()=>{B.unsubscribe()}},[]),s.useEffect(()=>{g.current&&(a==null||a(g.current))},[a]);const[x,V]=s.useState(o.getLocales()),R=s.useMemo(()=>document.createElement("div"),[]);return s.useLayoutEffect(()=>{const B=c.currentTheme$.subscribe(y=>{C.injectThemeToHead(y)});return()=>{B.unsubscribe()}},[]),s.useEffect(()=>{document.body.appendChild(R);const B=[o.localeChanged$.subscribe(()=>{V(o.getLocales())})];return()=>{B.forEach(y=>y.unsubscribe()),document.body.removeChild(R)}},[o,i,R]),h.jsxs(T.ConfigProvider,{locale:x==null?void 0:x.design,mountContainer:R,children:[h.jsxs("div",{"data-u-comp":"app-layout",className:T.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":O}),tabIndex:-1,onBlur:B=>B.stopPropagation(),children:[t&&h.jsx("header",{className:"univer-relative univer-z-10 univer-w-full"}),h.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[h.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[h.jsx("aside",{className:"univer-h-full",children:h.jsx(v1,{components:_},"left-sidebar")}),h.jsxs("section",{className:T.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",T.borderBottomClassName),children:[h.jsx("header",{className:"univer-w-screen",children:t&&h.jsx(v1,{components:d},"header")}),h.jsx("section",{ref:g,className:"univer-relative univer-overflow-hidden","data-range-selector":!0,onContextMenu:B=>B.preventDefault(),children:h.jsx(v1,{components:L},"content")})]}),h.jsx("aside",{className:"univer-h-full",children:h.jsx(v3,{})})]}),r&&h.jsx("footer",{children:h.jsx(v1,{components:p},"footer")}),h.jsx(C3,{}),h.jsx(g3,{})]})]}),h.jsx(v1,{components:M},"global"),n&&h.jsx(K6,{})]})}var m4=Object.getOwnPropertyDescriptor,p4=(e,t,r,n)=>{for(var i=n>1?void 0:n?m4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},$1=(e,t)=>(r,n)=>t(r,n,e);let Ge=class extends m3{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 b4(this._injector,this._config,e)}_initBuiltinComponents(e){this.disposeWithMe(e.registerComponent(i1.CONTENT,()=>D.connectInjector(d3,this._injector))),this.disposeWithMe(e.registerComponent(i1.CONTENT,()=>D.connectInjector(c3,this._injector)))}};Ge=p4([$1(1,f.Inject(f.Injector)),$1(2,f.Inject(f.LifecycleService)),$1(3,re.IRenderManagerService),$1(4,S1),$1(5,f.IUniverInstanceService),$1(6,y1)],Ge);function b4(e,t,r){let n;const i=t.container;if(typeof i=="string"){const C=document.getElementById(i);C?n=C:n=it(i)}else i instanceof HTMLElement?n=i:n=it("univer");const a=D.connectInjector(g4,e),o=C=>r(C,n);function c(){T.render(h.jsx(a,{...t,mountContainer:n,onRendered:o}),n)}return c(),f.toDisposable(()=>{T.unmount(n)})}function it(e){const t=document.createElement("div");return t.id=e,t}const ae=f.createIdentifier("ui.notification.service");var L4=Object.getOwnPropertyDescriptor,w4=(e,t,r,n)=>{for(var i=n>1?void 0:n?L4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},_4=(e,t)=>(r,n)=>t(r,n,e);const p3=f.createIdentifier("univer.ui.before-close-service");exports.DesktopBeforeCloseService=class{constructor(t){U(this,"_beforeUnloadCallbacks",[]);U(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(`
11
+ }`,document.head.appendChild(o)}dispose(){super.dispose()}}const oe=f.createIdentifier("ui.contextmenu.service");class h3 extends f.Disposable{constructor(){super(...arguments);U(this,"_currentHandler",null);U(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,f.toDisposable(()=>this._currentHandler=null)}}function Q6(){const e=s.useRef(null),[t,r]=s.useState(!1),[n,i]=s.useState(""),[a,o]=s.useState([0,0]),c=s.useRef(t),C=D.useDependency(oe),g=D.useDependency(f.ICommandService),p=D.useInjector();c.current=t,s.useEffect(()=>{const _=C.registerContextMenuHandler({handleContextMenu:d,hideContextMenu(){r(!1)},get visible(){return c.current}});function M(O){e.current&&!e.current.contains(O.target)&&L()}return document.addEventListener("pointerdown",M),document.addEventListener("wheel",L),()=>{document.removeEventListener("pointerdown",M),document.removeEventListener("wheel",L),_.dispose()}},[C]);function d(_,M){r(!1),requestAnimationFrame(()=>{i(M),o([_.clientX,_.clientY]),r(!0)})}function L(){r(!1)}return h.jsx(T.Popup,{visible:t,offset:a,children:h.jsx("section",{ref:e,children:n&&h.jsx(n3,{menuType:n,onOptionSelect:_=>{const{label:M,commandId:O,value:H}=_;g&&g.executeCommand(O!=null?O:M,{value:H}),p.get(S1).focus(),r(!1)}})})})}const xe=f.createIdentifier("univer.global-zone-service");function C3(){const e=D.useDependency(xe),[t,r]=s.useState(!1),n=D.useObservable(e.componentKey$,e.componentKey),i=D.useDependency(m1),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?h.jsx("section",{className:T.clsx("univer-absolute univer-bg-gray-100",{"univer-hidden":!t,"univer-inset-0 univer-z-[100] univer-block univer-size-full":t}),children:a&&h.jsx(a,{})}):null}function v3(){const e=D.useDependency(P1),t=D.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 C=c;if(t[C]){const{key:g,...p}=t[C];p&&(o[C]=h.jsx(h1,{...p},g))}}return o},[t]);s.useEffect(()=>(r.current&&e.setContainer(r.current),()=>{e.setContainer(void 0)}),[e]),s.useEffect(()=>{const o=C=>{e.scrollEvent$.next(C)},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 h.jsx("section",{"data-u-comp":"sidebar",className:T.clsx("univer-relative univer-h-full univer-bg-white univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-white",{"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:h.jsxs("section",{ref:r,className:T.clsx("univer-box-border univer-grid univer-h-0 univer-min-h-full univer-grid-rows-[auto_1fr_auto] univer-overflow-y-auto",T.borderLeftBottomClassName,T.scrollbarClassName),children:[h.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,h.jsx("a",{className:"univer-cursor-pointer univer-text-gray-500 dark:!univer-text-gray-300",onClick:a,children:h.jsx(Qe,{})})]}),h.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)&&h.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 Se=f.createIdentifier("univer.zen-zone-service");function g3(){const e=D.useDependency(Se),[t,r]=s.useState(!1),[n,i]=s.useState(),a=D.useObservable(e.temporaryHidden$),o=D.useDependency(m1);s.useEffect(()=>{const C=[e.visible$.subscribe(g=>{r(g)}),e.componentKey$.subscribe(g=>{i(g)})];return()=>{C.forEach(g=>{g.unsubscribe()})}},[]);const c=s.useMemo(()=>{const C=o.get(n!=null?n:"");if(C)return C},[n]);return h.jsx("section",{className:T.clsx("univer-absolute univer-z-[-1] univer-flex",{"univer-animate-in univer-fade-in univer-inset-0 univer-z-[100] univer-bg-gray-100":t,"univer-hidden":a}),children:h.jsx("div",{className:"univer-relative univer-flex-1",children:c&&h.jsx(c,{})})})}function s4(e){const t=S6(U1);return h.jsx(l4,{...e,...t})}function l4(e){var Q;const{header:t=!0,toolbar:r=!0,footer:n=!0,headerMenu:i=!0,contextMenu:a=!0,ribbonType:o="default",mountContainer:c,onRendered:C}=e,g=D.useDependency(f.LocaleService),p=D.useDependency(f.ThemeService),d=D.useDependency(ie),L=s.useRef(null),M=D.useDependency(f.IConfigService).getConfig(U1),O=C1(i1.CUSTOM_HEADER),H=C1(i1.FOOTER),x=C1(i1.HEADER),V=C1(i1.HEADER_MENU),R=C1(i1.CONTENT),B=C1(i1.LEFT_SIDEBAR),y=C1(i1.GLOBAL),N=C1(i1.TOOLBAR),k=(Q=M==null?void 0:M.popupRootId)!=null?Q:"univer-popup-portal";s.useLayoutEffect(()=>{const z=p.currentTheme$.subscribe(W=>{d.injectThemeToHead(W)});return()=>{z.unsubscribe()}},[]);const[Y,$]=s.useState(!1);s.useLayoutEffect(()=>{const z=p.darkMode$.subscribe(W=>{$(W),W?document.documentElement.classList.add("univer-dark"):document.documentElement.classList.remove("univer-dark")});return()=>{z.unsubscribe()}},[]),s.useEffect(()=>{L.current&&(C==null||C(L.current))},[C]);const[G,X]=s.useState(g.getLocales()),q=s.useMemo(()=>document.createElement("div"),[]);return s.useEffect(()=>{document.body.appendChild(q);const z=[g.localeChanged$.subscribe(()=>{X(g.getLocales())})];return()=>{z.forEach(W=>W.unsubscribe()),document.body.removeChild(q)}},[g,c,q]),h.jsxs(T.ConfigProvider,{locale:G==null?void 0:G.design,mountContainer:q,children:[h.jsxs("div",{"data-u-comp":"workbench-layout",className:T.clsx("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",{"univer-dark":Y}),tabIndex:-1,onBlur:z=>z.stopPropagation(),onContextMenu:z=>z.preventDefault(),children:[h.jsx("div",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",children:h.jsx(v1,{components:O},"custom-header")}),t&&r&&h.jsx("header",{"data-u-comp":"headerbar",className:"univer-relative univer-z-10 univer-w-full univer-overflow-hidden",children:h.jsx(v1,{components:N,sharedProps:{ribbonType:o,headerMenuComponents:V,headerMenu:i}},"toolbar")}),h.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[h.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[h.jsx("aside",{"data-u-comp":"left-sidebar",className:"univer-h-full",children:h.jsx(v1,{components:B},"left-sidebar")}),h.jsxs("section",{className:T.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",T.borderBottomClassName),children:[h.jsx("header",{children:t&&h.jsx(v1,{components:x},"header")}),h.jsx("section",{className:"univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",ref:L,"data-range-selector":!0,onContextMenu:z=>z.preventDefault(),children:h.jsx(v1,{components:R},"content")})]}),h.jsx("aside",{"data-u-comp":"right-sidebar",className:"univer-h-full",children:h.jsx(v3,{})})]}),n&&h.jsx("footer",{children:h.jsx(v1,{components:H,sharedProps:{contextMenu:a}},"footer")}),h.jsx(g3,{})]})]}),h.jsx(v1,{components:y},"global"),h.jsx(C3,{}),a&&h.jsx(Q6,{}),h.jsx(c4,{}),h.jsx("div",{id:k})]})}function c4(){const{mountContainer:e}=s.useContext(T.ConfigContext),t=C1(i1.FLOATING);return vt.createPortal(h.jsx(v1,{components:t},"floating"),e)}const u4=3e3;class m3 extends f.Disposable{constructor(r,n,i,a,o){super();U(this,"_steadyTimeout");U(this,"_renderTimeout");U(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),delete this._instanceService,delete this._layoutService,delete this._lifecycleService,delete this._renderManagerService}_bootstrapWorkbench(){this.disposeWithMe(this.bootstrap(async(r,n)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(n)),this.disposeWithMe(this._layoutService.registerContentElement(r)));try{await this._lifecycleService.onStage(f.LifecycleStages.Ready),this._renderTimeout=window.setTimeout(()=>{const i=this._renderManagerService.getRenderAll();for(const[a]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=f.LifecycleStages.Rendered,this._steadyTimeout=window.setTimeout(()=>{this._lifecycleService.stage=f.LifecycleStages.Steady},u4)},300)}catch(i){if(i instanceof f.LifecycleUnreachableError)return;throw i}}))}_changeRenderUnit(r,n){if(this._currentRenderId===r)return!1;const i=this._renderManagerService.getRenderById(r);if(!i||!i.unitId||f.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 d4=Object.getOwnPropertyDescriptor,f4=(e,t,r,n)=>{for(var i=n>1?void 0:n?d4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},R1=(e,t)=>(r,n)=>t(r,n,e);exports.DesktopUIController=class extends m3{constructor(t,r,n,i,a,o,c,C,g){super(r,o,a,n,i),this._config=t,this._componentManager=g,c.mergeMenu(j6),this._initBuiltinComponents(C),this._registerComponents(),this._bootstrapWorkbench()}_registerComponents(){[[_6,w6],[M6,y6],[E6,H6],[D6,R6],[V6,O6],[I6,T.ColorPicker]].forEach(([t,r])=>{this.disposeWithMe(this._componentManager.register(t,r))})}dispose(){super.dispose(),this._componentManager.dispose()}bootstrap(t){return h4(this._injector,this._config,t)}_initBuiltinComponents(t){this.disposeWithMe(t.registerComponent(i1.FLOATING,()=>D.connectInjector(d3,this._injector))),this.disposeWithMe(t.registerComponent(i1.CONTENT,()=>D.connectInjector(c3,this._injector))),this.disposeWithMe(t.registerComponent(i1.TOOLBAR,()=>D.connectInjector(J6,this._injector)))}};exports.DesktopUIController=f4([R1(1,f.Inject(f.Injector)),R1(2,f.Inject(f.LifecycleService)),R1(3,re.IRenderManagerService),R1(4,S1),R1(5,f.IUniverInstanceService),R1(6,x1),R1(7,y1),R1(8,f.Inject(m1))],exports.DesktopUIController);function h4(e,t,r){let n;const i=t.container;if(typeof i=="string"){const C=document.getElementById(i);C?n=C:n=nt(i)}else i instanceof HTMLElement?n=i:n=nt("univer");const a=D.connectInjector(s4,e),o=C=>r(C,n);function c(){T.render(h.jsx(a,{...t,mountContainer:n,onRendered:o}),n)}return c(),f.toDisposable(()=>{T.render(h.jsx("div",{}),n),setTimeout(()=>T.render(h.jsx("div",{}),n),200),setTimeout(()=>T.unmount(n),500)})}function nt(e){const t=document.createElement("div");return t.id=e,t}const te=f.createIdentifier("univer.ui.ui-controller");function C4(e){const{menuType:t,onOptionSelect:r}=e,n=D.useDependency(x1);if(!t)return null;const i=s.useMemo(()=>{const a=n.getMenuByPositionKey(t);function o(c){return c.reduce((C,g)=>g.children?[...C,...o(g.children)]:[...C,g],[])}return o(a)},[t]);return h.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)}, 72px)`},children:i.map(a=>a.item&&h.jsx(v4,{menuItem:a.item,onClick:o=>r==null?void 0:r({value:"",label:a.key,...o})},a.key))})}function v4(e){const{menuItem:t,onClick:r}=e,{id:n,type:i,title:a,label:o,icon:c}=t;if(i!==g1.BUTTON)throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${n}".`);const C=D.useObservable(t.disabled$,!1),g=D.useObservable(t.value$);return h.jsx("button",{type:"button",className:T.clsx("univer-w-18 univer-flex 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:C,onClick:()=>r({id:n}),children:h.jsx(h1,{value:g,title:a,label:o,icon:c})},n)}function K6(){const[e,t]=s.useState(!1),[r,n]=s.useState(""),[i,a]=s.useState([0,0]),o=s.useRef(e),c=D.useDependency(oe),C=D.useDependency(f.ICommandService);o.current=e,s.useEffect(()=>{const d=c.registerContextMenuHandler({handleContextMenu:g,hideContextMenu(){t(!1)},get visible(){return o.current}});return document.addEventListener("pointerdown",p),document.addEventListener("wheel",p),()=>{document.removeEventListener("pointerdown",p),document.removeEventListener("wheel",p),d.dispose()}},[c]);function g(d,L){n(L),a([d.clientX,d.clientY]),t(!0)}function p(){t(!1)}return h.jsx(T.Popup,{visible:e,offset:i,children:h.jsx("section",{onPointerDown:d=>d.stopPropagation(),children:r&&h.jsx(C4,{menuType:r,onOptionSelect:d=>{const{label:L,value:_,commandId:M}=d;C&&C.executeCommand(M!=null?M:L,{value:_}),t(!1)}})})})}function g4(e){const{header:t=!0,footer:r=!0,contextMenu:n=!0,mountContainer:i,onRendered:a}=e,o=D.useDependency(f.LocaleService),c=D.useDependency(f.ThemeService),C=D.useDependency(ie),g=s.useRef(null),p=C1(i1.FOOTER),d=C1(i1.HEADER),L=C1(i1.CONTENT),_=C1(i1.LEFT_SIDEBAR),M=C1(i1.GLOBAL),[O,H]=s.useState(!1);s.useEffect(()=>{const B=c.darkMode$.subscribe(y=>{H(y)});return()=>{B.unsubscribe()}},[]),s.useEffect(()=>{g.current&&(a==null||a(g.current))},[a]);const[x,V]=s.useState(o.getLocales()),R=s.useMemo(()=>document.createElement("div"),[]);return s.useLayoutEffect(()=>{const B=c.currentTheme$.subscribe(y=>{C.injectThemeToHead(y)});return()=>{B.unsubscribe()}},[]),s.useEffect(()=>{document.body.appendChild(R);const B=[o.localeChanged$.subscribe(()=>{V(o.getLocales())})];return()=>{B.forEach(y=>y.unsubscribe()),document.body.removeChild(R)}},[o,i,R]),h.jsxs(T.ConfigProvider,{locale:x==null?void 0:x.design,mountContainer:R,children:[h.jsxs("div",{"data-u-comp":"app-layout",className:T.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":O}),tabIndex:-1,onBlur:B=>B.stopPropagation(),children:[t&&h.jsx("header",{className:"univer-relative univer-z-10 univer-w-full"}),h.jsxs("section",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-1 univer-flex-col",children:[h.jsxs("div",{className:"univer-grid univer-h-full univer-grid-cols-[auto_1fr_auto] univer-grid-rows-[100%] univer-overflow-hidden",children:[h.jsx("aside",{className:"univer-h-full",children:h.jsx(v1,{components:_},"left-sidebar")}),h.jsxs("section",{className:T.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",T.borderBottomClassName),children:[h.jsx("header",{className:"univer-w-screen",children:t&&h.jsx(v1,{components:d},"header")}),h.jsx("section",{ref:g,className:"univer-relative univer-overflow-hidden","data-range-selector":!0,onContextMenu:B=>B.preventDefault(),children:h.jsx(v1,{components:L},"content")})]}),h.jsx("aside",{className:"univer-h-full",children:h.jsx(v3,{})})]}),r&&h.jsx("footer",{children:h.jsx(v1,{components:p},"footer")}),h.jsx(C3,{}),h.jsx(g3,{})]})]}),h.jsx(v1,{components:M},"global"),n&&h.jsx(K6,{})]})}var m4=Object.getOwnPropertyDescriptor,p4=(e,t,r,n)=>{for(var i=n>1?void 0:n?m4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},$1=(e,t)=>(r,n)=>t(r,n,e);let Ge=class extends m3{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 b4(this._injector,this._config,e)}_initBuiltinComponents(e){this.disposeWithMe(e.registerComponent(i1.CONTENT,()=>D.connectInjector(d3,this._injector))),this.disposeWithMe(e.registerComponent(i1.CONTENT,()=>D.connectInjector(c3,this._injector)))}};Ge=p4([$1(1,f.Inject(f.Injector)),$1(2,f.Inject(f.LifecycleService)),$1(3,re.IRenderManagerService),$1(4,S1),$1(5,f.IUniverInstanceService),$1(6,y1)],Ge);function b4(e,t,r){let n;const i=t.container;if(typeof i=="string"){const C=document.getElementById(i);C?n=C:n=it(i)}else i instanceof HTMLElement?n=i:n=it("univer");const a=D.connectInjector(g4,e),o=C=>r(C,n);function c(){T.render(h.jsx(a,{...t,mountContainer:n,onRendered:o}),n)}return c(),f.toDisposable(()=>{T.unmount(n)})}function it(e){const t=document.createElement("div");return t.id=e,t}const ae=f.createIdentifier("ui.notification.service");var L4=Object.getOwnPropertyDescriptor,w4=(e,t,r,n)=>{for(var i=n>1?void 0:n?L4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},_4=(e,t)=>(r,n)=>t(r,n,e);const p3=f.createIdentifier("univer.ui.before-close-service");exports.DesktopBeforeCloseService=class{constructor(t){U(this,"_beforeUnloadCallbacks",[]);U(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(`
12
12
  `);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())})}};exports.DesktopBeforeCloseService=w4([_4(0,ae)],exports.DesktopBeforeCloseService);function er(){return typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText<"u"}var y4=Object.getOwnPropertyDescriptor,M4=(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},Be=(e,t)=>(r,n)=>t(r,n,e);const We="text/plain",Ye="text/html",tr="image/png",rr="image/jpeg",nr="image/bmp",ir="image/webp",x4="image/svg+xml",S4=new Set([nr,rr,ir,tr]),b3=f.createIdentifier("univer.clipboard-interface-service");exports.BrowserClipboardService=class extends f.Disposable{constructor(t,r,n){super(),this._localeService=t,this._logService=r,this._notificationService=n}get supportClipboard(){return er()}async write(t,r){if(!this.supportClipboard)return this._legacyCopyHtml(r);try{return await navigator.clipboard.write([new ClipboardItem({[We]:new Blob([t],{type:We}),[Ye]:new Blob([r],{type:Ye})})])}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=H4();document.body.appendChild(n),n.innerHTML=t;try{ot(n),document.execCommand("copy")}finally{r instanceof HTMLElement&&r.focus(),document.body.removeChild(n)}}_legacyCopyText(t){const r=document.activeElement,n=I4();document.body.appendChild(n),n.value=t;try{ot(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")})}};exports.BrowserClipboardService=M4([Be(0,f.Inject(f.LocaleService)),Be(1,f.ILogService),Be(2,f.Optional(ae))],exports.BrowserClipboardService);function I4(){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 H4(){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 ot(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 Ie=f.createIdentifier("univer.confirm-service");class R4{constructor(){U(this,"confirmOptions$",new F.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 E4=e=>{const{children:t,onClose:r,onConfirm:n}=e,[i]=s.useState({}),a=t?s.cloneElement(t,{hooks:i}):null;return h.jsx(T.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 D4(){const e=D.useDependency(Ie),[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,C=c;for(const g of["children","title"]){const p=g,d=i[p];d&&(C[p]=h.jsx(h1,{...d}))}return C});return n==null?void 0:n.map((i,a)=>h.jsx(E4,{...i,children:i.children},a))}var O4=Object.getOwnPropertyDescriptor,V4=(e,t,r,n)=>{for(var i=n>1?void 0:n?O4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},at=(e,t)=>(r,n)=>t(r,n,e);exports.DesktopConfirmService=class extends f.Disposable{constructor(r,n){super();U(this,"_confirmOptions",[]);U(this,"confirmOptions$",new F.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),f.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,()=>D.connectInjector(D4,this._injector)))}};exports.DesktopConfirmService=V4([at(0,f.Inject(f.Injector)),at(1,y1)],exports.DesktopConfirmService);const He=f.createIdentifier("univer.ui.dialog-service");function N4(){const e=D.useDependency(He),[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,...C}=i,g=C;for(const p of["children","title","footer"]){const d=p,L=i[d];L&&(g[d]=h.jsx(h1,{...L}))}return g}),[t]);return n==null?void 0:n.map(i=>h.jsx(T.Dialog,{...i},i.id))}var T4=Object.getOwnPropertyDescriptor,Z4=(e,t,r,n)=>{for(var i=n>1?void 0:n?T4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},st=(e,t)=>(r,n)=>t(r,n,e);exports.DesktopDialogService=class extends f.Disposable{constructor(r,n){super();U(this,"_dialogOptions",[]);U(this,"_dialogOptions$",new F.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),f.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,()=>D.connectInjector(N4,this._injector)))}};exports.DesktopDialogService=Z4([st(0,f.Inject(f.Injector)),st(1,y1)],exports.DesktopDialogService);const Re=f.createIdentifier("univer.ui.gallery-service");function j4(){const e=D.useDependency(Re),t=D.useObservable(e.gallery$);return t?h.jsx(T.Gallery,{...t}):null}var k4=Object.getOwnPropertyDescriptor,A4=(e,t,r,n)=>{for(var i=n>1?void 0:n?k4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},lt=(e,t)=>(r,n)=>t(r,n,e);exports.DesktopGalleryService=class extends f.Disposable{constructor(r,n){super();U(this,"gallery$",new F.Subject);this._injector=r,this._uiPartsService=n,this._initUIPart()}dispose(){super.dispose()}open(r){return this.gallery$.next({open:!0,...r}),f.toDisposable(()=>{this.gallery$.complete()})}close(){this.gallery$.next({open:!1,images:[]})}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(i1.GLOBAL,()=>D.connectInjector(j4,this._injector)))}};exports.DesktopGalleryService=A4([lt(0,f.Inject(f.Injector)),lt(1,y1)],exports.DesktopGalleryService);var $4=Object.getOwnPropertyDescriptor,B4=(e,t,r,n)=>{for(var i=n>1?void 0:n?$4(t,r):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},P4=(e,t)=>(r,n)=>t(r,n,e);exports.DesktopGlobalZoneService=class{constructor(t){U(this,"visible$",new F.Subject);U(this,"componentKey$",new F.Subject);U(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,f.toDisposable(()=>{this._componentManager.delete(t),this.visible$.complete(),this.componentKey$.complete()})}open(){this.visible$.next(!0)}close(){this.visible$.next(!1)}};exports.DesktopGlobalZoneService=B4([P4(0,f.Inject(m1))],exports.DesktopGlobalZoneService);class L3 extends f.Disposable{openFile(t){return new Promise(r=>{var i,a;const n=document.createElement("input");n.type="file",n.accept=(i=t==null?void 0:t.accept)!=null?i:"",n.multiple=(a=t==null?void 0:t.multiple)!=null?a:!1,n.onchange=o=>{const c=o.target.files;c&&r(Array.from(c))},n.click()})}downloadFile(t,r){const n=document.createElement("a");n.download=r,n.href=window.URL.createObjectURL(t),n.click()}}const w3=f.createIdentifier("univer-ui.local-file.service");var he=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function U4(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ce(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 Pe={exports:{}};/*!
13
13
  localForage -- Offline Storage, Improved
14
14
  Version 1.10.0
package/lib/es/index.js CHANGED
@@ -4443,7 +4443,7 @@ class on extends v1 {
4443
4443
  this._injector = r, this._instanceService = n, this._layoutService = i, this._lifecycleService = a, this._renderManagerService = o;
4444
4444
  }
4445
4445
  dispose() {
4446
- super.dispose(), clearTimeout(this._steadyTimeout), clearTimeout(this._renderTimeout);
4446
+ super.dispose(), clearTimeout(this._steadyTimeout), clearTimeout(this._renderTimeout), delete this._instanceService, delete this._layoutService, delete this._lifecycleService, delete this._renderManagerService;
4447
4447
  }
4448
4448
  _bootstrapWorkbench() {
4449
4449
  this.disposeWithMe(this.bootstrap(async (r, n) => {
@@ -4502,6 +4502,9 @@ let B3 = class extends on {
4502
4502
  );
4503
4503
  });
4504
4504
  }
4505
+ dispose() {
4506
+ super.dispose(), this._componentManager.dispose();
4507
+ }
4505
4508
  bootstrap(e) {
4506
4509
  return pi(this._injector, this._config, e);
4507
4510
  }
package/lib/index.css CHANGED
@@ -1 +1 @@
1
- .univer-pointer-events-none{pointer-events:none}.univer-pointer-events-auto{pointer-events:auto}.univer-invisible{visibility:hidden}.univer-fixed{position:fixed}.univer-absolute{position:absolute}.univer-relative{position:relative}.univer-sticky{position:sticky}.univer-inset-0{top:0;right:0;bottom:0;left:0}.-univer-left-\[99999\]{left:-99999}.-univer-top-\[99999\]{top:-99999}.univer-bottom-0{bottom:0}.univer-left-0{left:0}.univer-left-1{left:.25rem}.univer-left-1\/2{left:50%}.univer-left-\[-9999px\]{left:-9999px}.univer-right-0{right:0}.univer-right-2{right:.5rem}.univer-top-0{top:0}.univer-top-0\.5{top:.125rem}.univer-top-1\/2{top:50%}.univer-top-\[-9999px\]{top:-9999px}.univer-top-\[calc\(50\%-6px\)\]{top:calc(50% - 6px)}.univer-z-10{z-index:10}.univer-z-\[-1\]{z-index:-1}.univer-z-\[100\]{z-index:100}.univer-z-\[1020\]{z-index:1020}.univer-z-\[1\]{z-index:1}.univer-m-0{margin:0}.univer-mx-2{margin-left:.5rem;margin-right:.5rem}.univer-mr-1{margin-right:.25rem}.univer-mr-2{margin-right:.5rem}.univer-box-border{box-sizing:border-box}.univer-line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.univer-block{display:block}.univer-flex{display:flex}.univer-inline-flex{display:inline-flex}.univer-grid{display:grid}.univer-hidden{display:none}.univer-size-3{width:.75rem;height:.75rem}.univer-size-3\.5{width:.875rem;height:.875rem}.univer-size-4{width:1rem;height:1rem}.univer-size-6{width:1.5rem;height:1.5rem}.univer-size-9{width:2.25rem;height:2.25rem}.univer-size-full{width:100%;height:100%}.univer-h-0{height:0px}.univer-h-0\.5{height:.125rem}.univer-h-1{height:.25rem}.univer-h-10{height:2.5rem}.univer-h-11{height:2.75rem}.univer-h-6{height:1.5rem}.univer-h-7{height:1.75rem}.univer-h-full{height:100%}.univer-min-h-0{min-height:0px}.univer-min-h-full{min-height:100%}.univer-w-0{width:0px}.univer-w-0\.5{width:.125rem}.univer-w-20{width:5rem}.univer-w-24{width:6rem}.univer-w-32{width:8rem}.univer-w-40{width:10rem}.univer-w-5{width:1.25rem}.univer-w-7{width:1.75rem}.univer-w-96{width:24rem}.univer-w-full{width:100%}.univer-w-max{width:-moz-max-content;width:max-content}.univer-w-screen{width:100vw}.univer-min-w-6{min-width:1.5rem}.univer-min-w-8{min-width:2rem}.univer-min-w-min{min-width:-moz-min-content;min-width:min-content}.univer-max-w-52{max-width:13rem}.univer-max-w-96{max-width:24rem}.univer-max-w-\[var\(--radix-popper-available-width\)\]{max-width:var(--radix-popper-available-width)}.univer-flex-1{flex:1 1 0%}.univer-flex-shrink-0,.univer-shrink-0{flex-shrink:0}.univer-origin-center{transform-origin:center}.-univer-translate-x-1\/2{--univer-tw-translate-x: -50%;transform:translate(-50%,var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.-univer-translate-y-1\/2{--univer-tw-translate-y: -50%;transform:translate(var(--univer-tw-translate-x),-50%) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-translate-x-0{--univer-tw-translate-x: 0px;transform:translateY(var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-translate-x-full{--univer-tw-translate-x: 100%;transform:translate(100%,var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-cursor-not-allowed{cursor:not-allowed}.univer-cursor-pointer{cursor:pointer}.univer-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.univer-list-none{list-style-type:none}.univer-grid-flow-col{grid-auto-flow:column}.univer-grid-cols-\[auto\,1fr\]{grid-template-columns:auto 1fr}.univer-grid-cols-\[auto_1fr_auto\]{grid-template-columns:auto 1fr auto}.univer-grid-cols-none{grid-template-columns:none}.univer-grid-rows-\[100\%\]{grid-template-rows:100%}.univer-grid-rows-\[auto_1fr\]{grid-template-rows:auto 1fr}.univer-grid-rows-\[auto_1fr_auto\]{grid-template-rows:auto 1fr auto}.univer-flex-col{flex-direction:column}.univer-flex-wrap{flex-wrap:wrap}.univer-items-center{align-items:center}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-gap-1{gap:.25rem}.univer-gap-1\.5{gap:.375rem}.univer-gap-2{gap:.5rem}.univer-gap-2\.5{gap:.625rem}.univer-overflow-hidden{overflow:hidden}.univer-overflow-y-auto{overflow-y:auto}.univer-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.univer-whitespace-nowrap{white-space:nowrap}.\!univer-rounded-full{border-radius:9999px!important}.\!univer-rounded-xl{border-radius:.75rem!important}.univer-rounded{border-radius:.25rem}.univer-rounded-2xl{border-radius:1rem}.univer-rounded-full{border-radius:9999px}.univer-rounded-lg{border-radius:.5rem}.univer-rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.univer-rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.univer-border-none{border-style:none}.\!univer-bg-gray-200{background-color:var(--univer-gray-200)!important}.\!univer-bg-gray-500{background-color:var(--univer-gray-500)!important}.univer-bg-gray-100{background-color:var(--univer-gray-100)}.univer-bg-gray-200{background-color:var(--univer-gray-200)}.univer-bg-gray-400{background-color:var(--univer-gray-400)}.univer-bg-gray-700{background-color:var(--univer-gray-700)}.univer-bg-gray-900{background-color:var(--univer-gray-900)}.univer-bg-primary-600{background-color:var(--univer-primary-600)}.univer-bg-transparent{background-color:transparent}.univer-bg-white{background-color:var(--univer-white)}.univer-bg-none{background-image:none}.univer-p-0{padding:0}.univer-p-2{padding:.5rem}.univer-p-4{padding:1rem}.univer-px-1{padding-left:.25rem;padding-right:.25rem}.univer-px-1\.5{padding-left:.375rem;padding-right:.375rem}.univer-px-2{padding-left:.5rem;padding-right:.5rem}.univer-px-3{padding-left:.75rem;padding-right:.75rem}.univer-px-4{padding-left:1rem;padding-right:1rem}.univer-py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.univer-py-1{padding-top:.25rem;padding-bottom:.25rem}.univer-py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.univer-pb-2{padding-bottom:.5rem}.univer-pl-2{padding-left:.5rem}.univer-pl-3{padding-left:.75rem}.univer-pl-5{padding-left:1.25rem}.univer-pl-6{padding-left:1.5rem}.univer-pr-2{padding-right:.5rem}.univer-pr-5{padding-right:1.25rem}.univer-text-right{text-align:right}.univer-text-base{font-size:1rem;line-height:1.5rem}.univer-text-sm{font-size:.875rem;line-height:1.25rem}.univer-text-xs{font-size:.75rem;line-height:1rem}.univer-font-bold{font-weight:700}.univer-font-medium{font-weight:500}.univer-font-semibold{font-weight:600}.univer-leading-6{line-height:1.5rem}.\!univer-text-gray-600{color:var(--univer-gray-600)!important}.\!univer-text-white{color:var(--univer-white)!important}.univer-text-gray-200{color:var(--univer-gray-200)}.univer-text-gray-300{color:var(--univer-gray-300)}.univer-text-gray-400{color:var(--univer-gray-400)}.univer-text-gray-500{color:var(--univer-gray-500)}.univer-text-gray-800{color:var(--univer-gray-800)}.univer-text-gray-900{color:var(--univer-gray-900)}.univer-text-primary-600{color:var(--univer-primary-600)}.univer-text-white{color:var(--univer-white)}.univer-underline{text-decoration-line:underline}.univer-opacity-0{opacity:0}.univer-shadow{--univer-tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1);--univer-tw-shadow-colored: 0 1px 3px 0 var(--univer-tw-shadow-color), 0 1px 2px -1px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 3px #0000001a,0 1px 2px -1px #0000001a;box-shadow:var(--univer-tw-ring-offset-shadow, 0 0 rgba(0,0,0,0)),var(--univer-tw-ring-shadow, 0 0 rgba(0,0,0,0)),var(--univer-tw-shadow)}.univer-outline-none{outline:2px solid transparent;outline-offset:2px}.univer-transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.univer-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@keyframes enter{0%{opacity:1;opacity:var(--univer-tw-enter-opacity, 1);transform:translateZ(0) scaleZ(1) rotate(0);transform:translate3d(var(--univer-tw-enter-translate-x, 0),var(--univer-tw-enter-translate-y, 0),0) scale3d(var(--univer-tw-enter-scale, 1),var(--univer-tw-enter-scale, 1),var(--univer-tw-enter-scale, 1)) rotate(var(--univer-tw-enter-rotate, 0))}}@keyframes exit{to{opacity:1;opacity:var(--univer-tw-exit-opacity, 1);transform:translateZ(0) scaleZ(1) rotate(0);transform:translate3d(var(--univer-tw-exit-translate-x, 0),var(--univer-tw-exit-translate-y, 0),0) scale3d(var(--univer-tw-exit-scale, 1),var(--univer-tw-exit-scale, 1),var(--univer-tw-exit-scale, 1)) rotate(var(--univer-tw-exit-rotate, 0))}}.univer-animate-in{animation-name:enter;animation-duration:.15s;--univer-tw-enter-opacity: initial;--univer-tw-enter-scale: initial;--univer-tw-enter-rotate: initial;--univer-tw-enter-translate-x: initial;--univer-tw-enter-translate-y: initial }.univer-fade-in{--univer-tw-enter-opacity: 0 }.univer-fade-in-70{--univer-tw-enter-opacity: .7 }.last\:univer-border-b-0:last-child{border-bottom-width:0px}.hover\:univer-bg-gray-100:hover{background-color:var(--univer-gray-100)}.hover\:univer-bg-gray-200:hover{background-color:var(--univer-gray-200)}.hover\:univer-opacity-50:hover{opacity:.5}.focus\:univer-bg-white:focus{background-color:var(--univer-white)}.disabled\:univer-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:univer-text-gray-300:disabled{color:var(--univer-gray-300)}.disabled\:hover\:univer-bg-transparent:hover:disabled{background-color:transparent}@media (min-width: 640px){.sm\:\!univer-block{display:block!important}}.rtl\:univer-pr-2:where([dir=rtl],[dir=rtl] *){padding-right:.5rem}.dark\:\!univer-bg-gray-200:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-200)!important}.dark\:\!univer-bg-gray-500:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-500)!important}.dark\:\!univer-bg-gray-800:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-800)!important}.dark\:\!univer-bg-gray-900:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-900)!important}.dark\:\!univer-text-gray-200:where(.univer-dark,.univer-dark *){color:var(--univer-gray-200)!important}.dark\:\!univer-text-gray-300:where(.univer-dark,.univer-dark *){color:var(--univer-gray-300)!important}.dark\:\!univer-text-gray-500:where(.univer-dark,.univer-dark *){color:var(--univer-gray-500)!important}.dark\:\!univer-text-gray-600:where(.univer-dark,.univer-dark *){color:var(--univer-gray-600)!important}.dark\:\!univer-text-gray-800:where(.univer-dark,.univer-dark *){color:var(--univer-gray-800)!important}.dark\:\!univer-text-white:where(.univer-dark,.univer-dark *){color:var(--univer-white)!important}.dark\:hover\:\!univer-bg-gray-600:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-600)!important}.dark\:hover\:\!univer-bg-gray-700:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-700)!important}.dark\:disabled\:\!univer-text-gray-600:disabled:where(.univer-dark,.univer-dark *){color:var(--univer-gray-600)!important}.\[\&\>\*\]\:univer-inline-flex>*{display:inline-flex}.\[\&\>\*\]\:univer-h-6>*{height:1.5rem}.\[\&\>\*\]\:univer-items-center>*{align-items:center}.\[\&\>\*\]\:univer-rounded>*{border-radius:.25rem}.\[\&\>\*\]\:univer-px-1>*{padding-left:.25rem;padding-right:.25rem}.\[\&\>\*\]\:univer-transition-colors>*{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\:\[\&\>\*\]\:univer-bg-gray-100>*:hover{background-color:var(--univer-gray-100)}.\[\&\>span\]\:univer-mt-0\.5>span{margin-top:.125rem}.\[\&\>span\]\:univer-w-full>span{width:100%}.\[\&\>span\]\:univer-truncate>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.\[\&\>span\]\:univer-text-sm>span{font-size:.875rem;line-height:1.25rem}.\[\&\>svg\]\:univer-size-\[18px\]>svg{width:18px;height:18px}.\[\&\>svg\]\:univer-text-lg>svg{font-size:1.125rem;line-height:1.75rem}.\[\&_input\:focus\]\:\!univer-ring-0 input:focus{--univer-tw-ring-offset-shadow: var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color) !important;--univer-tw-ring-shadow: var(--univer-tw-ring-inset) 0 0 0 calc(0px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color) !important;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000!important;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow, 0 0 rgba(0,0,0,0))!important}.\[\&_input\]\:univer-h-6 input{height:1.5rem}.\[\&_input\]\:univer-w-7 input{width:1.75rem}.\[\&_input\]\:univer-border-none input{border-style:none}.\[\&_input\]\:\!univer-bg-transparent input{background-color:transparent!important}.\[\&_input\]\:univer-p-0 input{padding:0}.\[\&_input\]\:univer-text-sm input{font-size:.875rem;line-height:1.25rem}
1
+ .univer-pointer-events-none{pointer-events:none}.univer-pointer-events-auto{pointer-events:auto}.univer-invisible{visibility:hidden}.univer-fixed{position:fixed}.univer-absolute{position:absolute}.univer-relative{position:relative}.univer-sticky{position:sticky}.univer-inset-0{top:0;right:0;bottom:0;left:0}.-univer-left-\[99999\]{left:-99999}.-univer-top-\[99999\]{top:-99999}.univer-bottom-0{bottom:0}.univer-left-0{left:0}.univer-left-1{left:.25rem}.univer-left-1\/2{left:50%}.univer-left-\[-9999px\]{left:-9999px}.univer-right-0{right:0}.univer-right-2{right:.5rem}.univer-top-0{top:0}.univer-top-0\.5{top:.125rem}.univer-top-1\/2{top:50%}.univer-top-\[-9999px\]{top:-9999px}.univer-top-\[calc\(50\%-6px\)\]{top:calc(50% - 6px)}.univer-z-10{z-index:10}.univer-z-\[-1\]{z-index:-1}.univer-z-\[100\]{z-index:100}.univer-z-\[1020\]{z-index:1020}.univer-z-\[1\]{z-index:1}.univer-m-0{margin:0}.univer-mx-2{margin-left:.5rem;margin-right:.5rem}.univer-mr-1{margin-right:.25rem}.univer-mr-2{margin-right:.5rem}.univer-box-border{box-sizing:border-box}.univer-line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.univer-block{display:block}.univer-flex{display:flex}.univer-inline-flex{display:inline-flex}.univer-grid{display:grid}.univer-hidden{display:none}.univer-size-3{width:.75rem;height:.75rem}.univer-size-3\.5{width:.875rem;height:.875rem}.univer-size-4{width:1rem;height:1rem}.univer-size-6{width:1.5rem;height:1.5rem}.univer-size-9{width:2.25rem;height:2.25rem}.univer-size-full{width:100%;height:100%}.univer-h-0{height:0px}.univer-h-0\.5{height:.125rem}.univer-h-1{height:.25rem}.univer-h-10{height:2.5rem}.univer-h-11{height:2.75rem}.univer-h-6{height:1.5rem}.univer-h-7{height:1.75rem}.univer-h-full{height:100%}.univer-min-h-0{min-height:0px}.univer-min-h-full{min-height:100%}.univer-w-0{width:0px}.univer-w-0\.5{width:.125rem}.univer-w-20{width:5rem}.univer-w-24{width:6rem}.univer-w-32{width:8rem}.univer-w-40{width:10rem}.univer-w-5{width:1.25rem}.univer-w-7{width:1.75rem}.univer-w-96{width:24rem}.univer-w-full{width:100%}.univer-w-max{width:-moz-max-content;width:max-content}.univer-w-screen{width:100vw}.univer-min-w-6{min-width:1.5rem}.univer-min-w-8{min-width:2rem}.univer-min-w-min{min-width:-moz-min-content;min-width:min-content}.univer-max-w-52{max-width:13rem}.univer-max-w-96{max-width:24rem}.univer-max-w-\[var\(--radix-popper-available-width\)\]{max-width:var(--radix-popper-available-width)}.univer-flex-1{flex:1 1 0%}.univer-flex-shrink-0,.univer-shrink-0{flex-shrink:0}.univer-origin-center{transform-origin:center}.-univer-translate-x-1\/2{--univer-tw-translate-x: -50%;transform:translate(-50%,var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.-univer-translate-y-1\/2{--univer-tw-translate-y: -50%;transform:translate(var(--univer-tw-translate-x),-50%) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-translate-x-0{--univer-tw-translate-x: 0px;transform:translateY(var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-translate-x-full{--univer-tw-translate-x: 100%;transform:translate(100%,var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y));transform:translate(var(--univer-tw-translate-x),var(--univer-tw-translate-y)) rotate(var(--univer-tw-rotate)) skew(var(--univer-tw-skew-x)) skewY(var(--univer-tw-skew-y)) scaleX(var(--univer-tw-scale-x)) scaleY(var(--univer-tw-scale-y))}.univer-cursor-not-allowed{cursor:not-allowed}.univer-cursor-pointer{cursor:pointer}.univer-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.univer-list-none{list-style-type:none}.univer-grid-flow-col{grid-auto-flow:column}.univer-grid-cols-\[auto\,1fr\]{grid-template-columns:auto 1fr}.univer-grid-cols-\[auto_1fr_auto\]{grid-template-columns:auto 1fr auto}.univer-grid-cols-none{grid-template-columns:none}.univer-grid-rows-\[100\%\]{grid-template-rows:100%}.univer-grid-rows-\[auto_1fr\]{grid-template-rows:auto 1fr}.univer-grid-rows-\[auto_1fr_auto\]{grid-template-rows:auto 1fr auto}.univer-flex-col{flex-direction:column}.univer-flex-wrap{flex-wrap:wrap}.univer-items-center{align-items:center}.univer-justify-center{justify-content:center}.univer-justify-between{justify-content:space-between}.univer-gap-1{gap:.25rem}.univer-gap-1\.5{gap:.375rem}.univer-gap-2{gap:.5rem}.univer-gap-2\.5{gap:.625rem}.univer-overflow-hidden{overflow:hidden}.univer-overflow-y-auto{overflow-y:auto}.univer-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.univer-whitespace-nowrap{white-space:nowrap}.\!univer-rounded-full{border-radius:9999px!important}.\!univer-rounded-xl{border-radius:.75rem!important}.univer-rounded{border-radius:.25rem}.univer-rounded-2xl{border-radius:1rem}.univer-rounded-full{border-radius:9999px}.univer-rounded-lg{border-radius:.5rem}.univer-rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.univer-rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.univer-border-none{border-style:none}.\!univer-bg-gray-200{background-color:var(--univer-gray-200)!important}.\!univer-bg-gray-500{background-color:var(--univer-gray-500)!important}.univer-bg-gray-100{background-color:var(--univer-gray-100)}.univer-bg-gray-200{background-color:var(--univer-gray-200)}.univer-bg-gray-400{background-color:var(--univer-gray-400)}.univer-bg-gray-700{background-color:var(--univer-gray-700)}.univer-bg-gray-900{background-color:var(--univer-gray-900)}.univer-bg-primary-600{background-color:var(--univer-primary-600)}.univer-bg-transparent{background-color:transparent}.univer-bg-white{background-color:var(--univer-white)}.univer-bg-none{background-image:none}.univer-p-0{padding:0}.univer-p-2{padding:.5rem}.univer-p-4{padding:1rem}.univer-px-1{padding-left:.25rem;padding-right:.25rem}.univer-px-1\.5{padding-left:.375rem;padding-right:.375rem}.univer-px-2{padding-left:.5rem;padding-right:.5rem}.univer-px-3{padding-left:.75rem;padding-right:.75rem}.univer-px-4{padding-left:1rem;padding-right:1rem}.univer-py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.univer-py-1{padding-top:.25rem;padding-bottom:.25rem}.univer-py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.univer-pb-2{padding-bottom:.5rem}.univer-pl-2{padding-left:.5rem}.univer-pl-3{padding-left:.75rem}.univer-pl-5{padding-left:1.25rem}.univer-pl-6{padding-left:1.5rem}.univer-pr-2{padding-right:.5rem}.univer-pr-5{padding-right:1.25rem}.univer-text-right{text-align:right}.univer-text-base{font-size:1rem;line-height:1.5rem}.univer-text-sm{font-size:.875rem;line-height:1.25rem}.univer-text-xs{font-size:.75rem;line-height:1rem}.univer-font-bold{font-weight:700}.univer-font-medium{font-weight:500}.univer-font-semibold{font-weight:600}.univer-leading-6{line-height:1.5rem}.\!univer-text-gray-600{color:var(--univer-gray-600)!important}.\!univer-text-white{color:var(--univer-white)!important}.univer-text-gray-200{color:var(--univer-gray-200)}.univer-text-gray-300{color:var(--univer-gray-300)}.univer-text-gray-400{color:var(--univer-gray-400)}.univer-text-gray-500{color:var(--univer-gray-500)}.univer-text-gray-800{color:var(--univer-gray-800)}.univer-text-gray-900{color:var(--univer-gray-900)}.univer-text-primary-600{color:var(--univer-primary-600)}.univer-text-white{color:var(--univer-white)}.univer-underline{text-decoration-line:underline}.univer-opacity-0{opacity:0}.univer-shadow{--univer-tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1);--univer-tw-shadow-colored: 0 1px 3px 0 var(--univer-tw-shadow-color), 0 1px 2px -1px var(--univer-tw-shadow-color);box-shadow:0 0 #0000,0 0 #0000,0 1px 3px #0000001a,0 1px 2px -1px #0000001a;box-shadow:var(--univer-tw-ring-offset-shadow, 0 0 rgba(0,0,0,0)),var(--univer-tw-ring-shadow, 0 0 rgba(0,0,0,0)),var(--univer-tw-shadow)}.univer-outline-none{outline:2px solid transparent;outline-offset:2px}.univer-transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.univer-transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@keyframes enter{0%{opacity:1;opacity:var(--univer-tw-enter-opacity, 1);transform:translateZ(0) scaleZ(1) rotate(0);transform:translate3d(var(--univer-tw-enter-translate-x, 0),var(--univer-tw-enter-translate-y, 0),0) scale3d(var(--univer-tw-enter-scale, 1),var(--univer-tw-enter-scale, 1),var(--univer-tw-enter-scale, 1)) rotate(var(--univer-tw-enter-rotate, 0))}}@keyframes exit{to{opacity:1;opacity:var(--univer-tw-exit-opacity, 1);transform:translateZ(0) scaleZ(1) rotate(0);transform:translate3d(var(--univer-tw-exit-translate-x, 0),var(--univer-tw-exit-translate-y, 0),0) scale3d(var(--univer-tw-exit-scale, 1),var(--univer-tw-exit-scale, 1),var(--univer-tw-exit-scale, 1)) rotate(var(--univer-tw-exit-rotate, 0))}}.univer-animate-in{animation-name:enter;animation-duration:.15s;--univer-tw-enter-opacity: initial;--univer-tw-enter-scale: initial;--univer-tw-enter-rotate: initial;--univer-tw-enter-translate-x: initial;--univer-tw-enter-translate-y: initial }.univer-fade-in{--univer-tw-enter-opacity: 0 }.univer-fade-in-70{--univer-tw-enter-opacity: .7 }.last\:univer-border-b-0:last-child{border-bottom-width:0px}.hover\:univer-bg-gray-100:hover{background-color:var(--univer-gray-100)}.hover\:univer-bg-gray-200:hover{background-color:var(--univer-gray-200)}.hover\:univer-opacity-50:hover{opacity:.5}.focus\:univer-bg-white:focus{background-color:var(--univer-white)}.disabled\:univer-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:univer-text-gray-300:disabled{color:var(--univer-gray-300)}.disabled\:hover\:univer-bg-transparent:hover:disabled{background-color:transparent}@media(min-width:640px){.sm\:\!univer-block{display:block!important}}.rtl\:univer-pr-2:where([dir=rtl],[dir=rtl] *){padding-right:.5rem}.dark\:\!univer-bg-gray-200:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-200)!important}.dark\:\!univer-bg-gray-500:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-500)!important}.dark\:\!univer-bg-gray-800:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-800)!important}.dark\:\!univer-bg-gray-900:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-900)!important}.dark\:\!univer-text-gray-200:where(.univer-dark,.univer-dark *){color:var(--univer-gray-200)!important}.dark\:\!univer-text-gray-300:where(.univer-dark,.univer-dark *){color:var(--univer-gray-300)!important}.dark\:\!univer-text-gray-500:where(.univer-dark,.univer-dark *){color:var(--univer-gray-500)!important}.dark\:\!univer-text-gray-600:where(.univer-dark,.univer-dark *){color:var(--univer-gray-600)!important}.dark\:\!univer-text-gray-800:where(.univer-dark,.univer-dark *){color:var(--univer-gray-800)!important}.dark\:\!univer-text-white:where(.univer-dark,.univer-dark *){color:var(--univer-white)!important}.dark\:hover\:\!univer-bg-gray-600:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-600)!important}.dark\:hover\:\!univer-bg-gray-700:hover:where(.univer-dark,.univer-dark *){background-color:var(--univer-gray-700)!important}.dark\:disabled\:\!univer-text-gray-600:disabled:where(.univer-dark,.univer-dark *){color:var(--univer-gray-600)!important}.\[\&\>\*\]\:univer-inline-flex>*{display:inline-flex}.\[\&\>\*\]\:univer-h-6>*{height:1.5rem}.\[\&\>\*\]\:univer-items-center>*{align-items:center}.\[\&\>\*\]\:univer-rounded>*{border-radius:.25rem}.\[\&\>\*\]\:univer-px-1>*{padding-left:.25rem;padding-right:.25rem}.\[\&\>\*\]\:univer-transition-colors>*{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\:\[\&\>\*\]\:univer-bg-gray-100>*:hover{background-color:var(--univer-gray-100)}.\[\&\>span\]\:univer-mt-0\.5>span{margin-top:.125rem}.\[\&\>span\]\:univer-w-full>span{width:100%}.\[\&\>span\]\:univer-truncate>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.\[\&\>span\]\:univer-text-sm>span{font-size:.875rem;line-height:1.25rem}.\[\&\>svg\]\:univer-size-\[18px\]>svg{width:18px;height:18px}.\[\&\>svg\]\:univer-text-lg>svg{font-size:1.125rem;line-height:1.75rem}.\[\&_input\:focus\]\:\!univer-ring-0 input:focus{--univer-tw-ring-offset-shadow: var(--univer-tw-ring-inset) 0 0 0 var(--univer-tw-ring-offset-width) var(--univer-tw-ring-offset-color) !important;--univer-tw-ring-shadow: var(--univer-tw-ring-inset) 0 0 0 calc(0px + var(--univer-tw-ring-offset-width)) var(--univer-tw-ring-color) !important;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),0 0 #0000!important;box-shadow:var(--univer-tw-ring-offset-shadow),var(--univer-tw-ring-shadow),var(--univer-tw-shadow, 0 0 rgba(0,0,0,0))!important}.\[\&_input\]\:univer-h-6 input{height:1.5rem}.\[\&_input\]\:univer-w-7 input{width:1.75rem}.\[\&_input\]\:univer-border-none input{border-style:none}.\[\&_input\]\:\!univer-bg-transparent input{background-color:transparent!important}.\[\&_input\]\:univer-p-0 input{padding:0}.\[\&_input\]\:univer-text-sm input{font-size:.875rem;line-height:1.25rem}
package/lib/index.js CHANGED
@@ -4443,7 +4443,7 @@ class on extends v1 {
4443
4443
  this._injector = r, this._instanceService = n, this._layoutService = i, this._lifecycleService = a, this._renderManagerService = o;
4444
4444
  }
4445
4445
  dispose() {
4446
- super.dispose(), clearTimeout(this._steadyTimeout), clearTimeout(this._renderTimeout);
4446
+ super.dispose(), clearTimeout(this._steadyTimeout), clearTimeout(this._renderTimeout), delete this._instanceService, delete this._layoutService, delete this._lifecycleService, delete this._renderManagerService;
4447
4447
  }
4448
4448
  _bootstrapWorkbench() {
4449
4449
  this.disposeWithMe(this.bootstrap(async (r, n) => {
@@ -4502,6 +4502,9 @@ let B3 = class extends on {
4502
4502
  );
4503
4503
  });
4504
4504
  }
4505
+ dispose() {
4506
+ super.dispose(), this._componentManager.dispose();
4507
+ }
4505
4508
  bootstrap(e) {
4506
4509
  return pi(this._injector, this._config, e);
4507
4510
  }
@@ -11,6 +11,7 @@ export declare class DesktopUIController extends SingleUnitUIController {
11
11
  private readonly _componentManager;
12
12
  constructor(_config: IUniverUIConfig, injector: Injector, lifecycleService: LifecycleService, renderManagerService: IRenderManagerService, layoutService: ILayoutService, instanceService: IUniverInstanceService, menuManagerService: IMenuManagerService, uiPartsService: IUIPartsService, _componentManager: ComponentManager);
13
13
  private _registerComponents;
14
+ dispose(): void;
14
15
  bootstrap(callback: (contentElement: HTMLElement, containerElement: HTMLElement) => void): IDisposable;
15
16
  private _initBuiltinComponents;
16
17
  }
package/lib/umd/index.js CHANGED
@@ -8,7 +8,7 @@ hover:univer-bg-gray-100 whitespace-nowrap univer-w-max
8
8
  `;function p6(e){const{children:t,className:n,style:r,disabled:i=!1,active:a=!1,noIcon:o,onClick:c,onDoubleClick:v,...m}=e,b=w=>{if(i){w.preventDefault();return}c&&c(w)},d=w=>{if(i){w.preventDefault();return}v&&v(w)};return C.jsx("button",{type:"button",className:T.clsx(m6,{"univer-px-2":o,"!univer-bg-gray-200 dark:!univer-bg-gray-500":a}),style:r,disabled:i,onClick:b,onDoubleClick:d,...m,children:t})}function b6(e){const{disabled$:t,hidden$:n,activated$:r,value$:i}=e,[a,o]=l.useState(),[c,v]=l.useState(!1),[m,b]=l.useState(!1),[d,w]=l.useState(!1);return l.useEffect(()=>{const y=[];return t&&y.push(t.subscribe(S=>v(S))),n&&y.push(n.subscribe(S=>w(S))),r&&y.push(r.subscribe(S=>b(S))),i&&y.push(i.subscribe(S=>o(S))),()=>y.forEach(S=>S.unsubscribe())},[r,t,n,i]),{disabled:c,value:a,activated:m,hidden:d}}const Ye=l.createContext({dropdownVisible:!1,setDropdownVisible:e=>{}}),d0=l.forwardRef((e,t)=>{const{children:n,...r}=e,i=l.useRef(null),[a,o]=l.useState(!1),[c,v]=l.useState(!1);function m(w){o(c?!1:w)}function b(w){v(w),o(!1)}const d=l.useMemo(()=>({dropdownVisible:c,setDropdownVisible:b}),[c]);return l.useImperativeHandle(t,()=>({el:i.current})),r.title?C.jsx(T.Tooltip,{visible:a,onVisibleChange:m,...r,children:C.jsx("span",{ref:i,children:C.jsx(Ye.Provider,{value:d,children:n})})}):C.jsx("span",{ref:i,children:n})});function f0(e){const{children:t,overlay:n,disabled:r,align:i="start"}=e,{dropdownVisible:a,setDropdownVisible:o}=l.useContext(Ye);function c(v){o(v)}return C.jsx(T.Dropdown,{align:i,overlay:C.jsx("div",{className:"univer-grid univer-gap-2",children:n}),disabled:r,open:a,onOpenChange:c,children:C.jsx("div",{className:"univer-h-full",onClick:v=>v.stopPropagation(),children:t})})}function be({icon:e,value:t,option:n,onOptionSelect:r}){var o;const i=c=>{r==null||r({value:c,label:n==null?void 0:n.label,commandId:n==null?void 0:n.commandId})},a=typeof n.label=="string"||typeof n.label=="object"&&((o=n.label)==null?void 0:o.selectable)!==!1;return C.jsxs("div",{className:T.clsx("univer-relative univer-flex univer-items-center univer-gap-2",{"univer-pl-6":a}),children:[a&&String(t)===String(n.value)&&C.jsx(Ne,{className:"univer-absolute univer-left-1 univer-top-0.5 univer-text-primary-600"}),C.jsx(d1,{className:"univer-text-sm",icon:e,value$:n.value$,value:n.value,label:n.label,onChange:i})]})}function L6({menuId:e,slot:t,value:n,options:r,children:i,disabled:a,onOptionSelect:o}){var R;const{dropdownVisible:c,setDropdownVisible:v}=l.useContext(Ye),m=N.useDependency(S1),[b,d]=l.useState({}),w=l.useMemo(()=>e?m.getMenuByPositionKey(e):[],[e]),y=l.useMemo(()=>w.filter(D=>{var x;if(!D.children)return!b[D.key];const I=((x=D.key)==null?void 0:x.toString())||"";return!b[I]}),[w,b]);function S(D){v(D)}if(l.useEffect(()=>{const D=[];return w.forEach(I=>{var x;if(I.children){const O=I.children.map(M=>{var Z,$;return($=(Z=M.item)==null?void 0:Z.hidden$)!=null?$:F.of(!1)}),B=F.combineLatest(O).subscribe(M=>{const Z=M.every($=>$===!0);d($=>({...$,[I.key]:Z}))});D.push(B)}else if((x=I.item)!=null&&x.hidden$){const O=I.item.hidden$.subscribe(B=>{d(M=>({...M,[I.key]:B}))});D.push(O)}}),()=>{D.forEach(I=>I==null?void 0:I.unsubscribe()),d({})}},[w]),t)return C.jsx(f0,{disabled:a,overlay:r.map((D,I)=>C.jsx(be,{value:n,option:D,onOptionSelect:o},I)),children:i});if(r!=null&&r.length){const D=r.map(I=>{var x;return{type:"item",className:T.clsx({"focus:univer-bg-white":typeof I.label!="string"&&((x=I.label)==null?void 0:x.hoverable)===!1}),children:C.jsx(be,{icon:I.icon,value:n,option:I,onOptionSelect:o}),disabled:I.disabled,onSelect:()=>{typeof I.value>"u"||o==null||o({...I})}}});for(const I of y){if(!I.item)continue;const{title:x,id:O,commandId:B,icon:M}=I.item;if(!x)throw new Error("Menu item title is required");D.push({type:"item",children:C.jsx(be,{icon:M,value:n,option:{label:{name:x,selectable:!1}}}),onSelect:()=>{o==null||o({commandId:B,id:O})}})}return C.jsx(T.DropdownMenu,{align:"start",items:D,disabled:a,open:c,onOpenChange:S,children:i})}else{const D=[];for(const I of y)if(I.item){const{title:x,id:O,commandId:B,icon:M}=I.item;if(!x)throw new Error("Menu item title is required");D.push({type:"item",children:C.jsx(be,{icon:M,value:n,option:{label:{name:x,selectable:!1}}}),onSelect:()=>{o==null||o({commandId:B,id:O})}})}else(R=I.children)!=null&&R.length;return C.jsx(T.DropdownMenu,{align:"start",items:D,disabled:a,open:c,onOpenChange:S,children:i})}}const te=l.forwardRef((e,t)=>{const n=N.useDependency(h.LocaleService),r=N.useDependency(h.ICommandService),i=N.useDependency(H1),a=N.useDependency(v1),{value:o,hidden:c,disabled:v,activated:m}=b6(e),b=(G,Y)=>{i.focus(),r.executeCommand(G,Y)},{tooltip:d,shortcut:w,icon:y,title:S,label:R,id:D,commandId:I,type:x,slot:O,params:B}=e,M=n.t(d!=null?d:"")+(w?` (${w})`:""),{selections:Z}=e,$=l.useMemo(()=>F.isObservable(Z)?Z:new F.Observable(G=>{G.next(Z)}),[Z]),X=N.useObservable($),U=l.useMemo(()=>F.isObservable(y)?y:new F.Observable(G=>{var e1,l1;const Y=(l1=(e1=X==null?void 0:X.find(C1=>C1.value===o))==null?void 0:e1.icon)!=null?l1:y;G.next(Y)}),[y,X,o]),W=N.useObservable(U,void 0,!0);function q(G){var a1;const Y=e.selectionsCommandId,e1=I!=null?I:D,l1=(a1=Y!=null?Y:I)!=null?a1:D;function C1(r1){if(v)return;let u1=l1;r1.id&&(u1=r1.id),b(u1,{value:r1.value})}function b1(r1){v||b(l1,{value:r1})}function y1(){v||G===g1.BUTTON_SELECTOR&&b(e1,{value:o})}return G===g1.BUTTON_SELECTOR?C.jsxs("div",{"data-u-command":D,"data-disabled":v,className:T.clsx("univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-rounded univer-pr-5 univer-text-sm univer-transition-colors hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",{"univer-text-gray-900 dark:!univer-text-white":!v,"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600":v}),children:[C.jsx("div",{className:T.clsx("univer-relative univer-z-[1] univer-flex univer-h-full univer-items-center univer-rounded-l univer-px-1 univer-transition-colors hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-600",{"univer-bg-gray-200 dark:!univer-bg-gray-500":m,"univer-bg-gray-100":m&&v}),onClick:y1,children:C.jsx(d1,{icon:W,title:S,value:o,label:R,onChange:b1})}),C.jsx(L6,{menuId:D,slot:O,value:o,options:X,disabled:v,onOptionSelect:C1,children:C.jsx("div",{className:T.clsx("univer-absolute univer-right-0 univer-top-0 univer-box-border univer-flex univer-h-6 univer-w-5 univer-items-center univer-justify-center univer-rounded-r univer-transition-colors hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-600",{"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600":v,"univer-bg-gray-200 dark:!univer-bg-gray-500":m,"univer-bg-gray-100":m&&v}),"data-disabled":v,children:C.jsx(Y1,{})})})]}):C.jsx(L6,{menuId:D,slot:O,value:o,options:X,disabled:v,onOptionSelect:C1,children:C.jsxs("div",{"data-u-command":D,className:T.clsx("univer-animate-in univer-fade-in univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-gap-2 univer-whitespace-nowrap univer-rounded univer-px-1 univer-transition-colors hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",{"univer-text-gray-900 dark:!univer-text-white":!v,"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600":v,"univer-bg-gray-200":m,"univer-bg-gray-100":m&&v}),children:[C.jsx(d1,{icon:W,title:S,value:o,label:R,onChange:b1}),C.jsx("div",{className:T.clsx("univer-flex univer-h-full univer-items-center",{"univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600":v}),children:C.jsx(Y1,{})})]})})}function J(){var Y;const G=a.get(typeof R=="string"?R:(Y=R==null?void 0:R.name)!=null?Y:"");return C.jsx(p6,{"data-u-command":D,className:"univer-text-sm",noIcon:!y,active:m,disabled:v,onClick:()=>{var e1;return b((e1=e.commandId)!=null?e1:e.id,o!=null?o:B)},onDoubleClick:()=>e.subId&&b(e.subId),children:G?C.jsx(d1,{title:S,value:o,label:R}):y?C.jsx(d1,{icon:y}):C.jsx(d1,{title:S})})}function K(){switch(x){case g1.BUTTON_SELECTOR:case g1.SELECTOR:case g1.SUBITEMS:return q(x);case g1.BUTTON:default:return J()}}return!c&&C.jsx(d0,{ref:t,title:M,placement:"bottom",children:K()})}),h0={[f1.START]:Mt,[f1.INSERT]:Rt,[f1.FORMULAS]:Te,[f1.DATA]:et,[f1.VIEW]:ft,[f1.OTHERS]:xe};function w6(e){const{ribbonType:t,headerMenuComponents:n,headerMenu:r=!0}=e,i=N.useDependency(S1),a=N.useDependency(h.IUniverInstanceService),o=N.useDependency(h.LocaleService),[c,v]=l.useState(0),m=N.useObservable(a.focused$);l.useEffect(()=>{const U=i.menuChanged$.subscribe(()=>{v(W=>W+1)});return()=>{U.unsubscribe()}},[]);const b=l.useRef(null),d=l.useRef({}),[w,y]=l.useState([]),[S,R]=l.useState(f1.START),[D,I]=l.useState(!1),[x,O]=l.useState([]),[B,M]=l.useState(!1),Z=l.useCallback(U=>{d.current={},R(U.key),I(!1)},[]);l.useEffect(()=>{var J;const U=i.getMenuByPositionKey(q1.RIBBON),W=[],q=[];for(const K of U)if(K.children){for(const G of K.children)if(G.children)for(const Y of G.children)(J=Y.item)!=null&&J.hidden$&&(W.push(Y.item.hidden$),q.push(`${K.key}/${G.key}/${Y.key}`))}F.combineLatest(W).subscribe(K=>{var e1,l1,C1,b1,y1,a1;const G=[],Y=K.map((r1,u1)=>r1?q[u1]:null).filter(r1=>!!r1);for(const r1 of U){const u1={...r1,children:[]};if((e1=r1.children)!=null&&e1.length)for(const L1 of r1.children){const I1={...L1,children:[]};let Z1=!0;if((l1=L1.children)!=null&&l1.length){for(const F1 of L1.children){const j1=`${r1.key}/${L1.key}/${F1.key}`;Y.includes(j1)||(C1=I1.children)==null||C1.push(F1)}(b1=I1.children)!=null&&b1.every(F1=>{var j1;return((j1=F1.children)==null?void 0:j1.length)===0})&&(Z1=!1)}Z1&&((y1=u1.children)==null||y1.push(I1))}(a1=u1.children)!=null&&a1.length&&u1.children.every(L1=>{var I1;return(I1=L1.children)==null?void 0:I1.length})&&G.push(u1)}if(t==="simple"){const r1=[{key:f1.START,children:[],order:0}];G.forEach(u1=>{var L1;(L1=u1.children)==null||L1.forEach(I1=>{var Z1;(Z1=r1[0].children)==null||Z1.push(I1)})}),y(r1)}else y(G)}).unsubscribe()},[c,m]);const $=l.useMemo(()=>{var J,K;const U=(K=(J=w.find(G=>G.key===S))==null?void 0:J.children)!=null?K:[],W=[],q=[];for(const G of U)if(G.children){const Y=G.children.filter(e1=>!x.includes(e1.key));Y.length>0&&W.push({...G,children:Y}),Y.length<G.children.length&&q.push({...G,children:G.children.filter(e1=>x.includes(e1.key))})}return{allGroups:U,visibleGroups:W,hiddenGroups:q}},[x,w,S]);l.useEffect(()=>{let U=null;const W=new ResizeObserver(h.throttle(q=>{for(const J of q)M(!0),U=requestAnimationFrame(()=>{var y1,a1;const{width:K}=J.contentRect,Y=Object.values(d.current).sort((r1,u1)=>r1.order-u1.order||r1.groupOrder-u1.groupOrder||r1.itemOrder-u1.itemOrder),e1=[];let l1=32;const b1=(((a1=(y1=w.find(r1=>r1.key===S))==null?void 0:y1.children)!=null?a1:[]).length-1)*8;l1+=b1;for(const{el:r1,key:u1}of Y){const{width:L1}=r1.getBoundingClientRect();l1+=L1+8,l1>K&&e1.push(u1)}O(e1),M(!1)})},100));return W.observe(b.current),()=>{U&&cancelAnimationFrame(U),W.disconnect()}},[w,S]);const X=l.useMemo(()=>C.jsx("div",{"aria-hidden":"true",className:T.clsx("univer-invisible univer-absolute -univer-left-[99999] -univer-top-[99999] univer-box-border univer-flex univer-h-10 univer-min-w-min univer-items-center univer-px-3 univer-opacity-0",{"univer-hidden":!B},T.divideXClassName,T.borderBottomClassName),children:$.allGroups.map((U,W)=>{var q,J;return(((q=U.children)==null?void 0:q.length)||U.item)&&C.jsx(l.Fragment,{children:C.jsx("div",{className:"univer-grid univer-shrink-0 univer-grid-flow-col univer-gap-2 univer-px-2",children:U.children&&((J=U.children)==null?void 0:J.map(K=>K.item&&C.jsx(te,{...K.item,ref:G=>{G!=null&&G.el&&(d.current[K.key]={el:G.el,key:K.key,order:W,groupOrder:U.order,itemOrder:K.order})}},K.key)))})},U.key)})}),[$.allGroups,B]);return C.jsxs(C.Fragment,{children:[r&&n&&n.size>0&&C.jsx("header",{className:T.clsx("univer-relative univer-h-11 univer-select-none",T.borderBottomClassName),children: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(m1,{components:n})})}),C.jsxs("div",{className:T.clsx("univer-box-border univer-grid univer-h-10 univer-grid-flow-col univer-items-center univer-px-3",{"univer-grid-cols-[auto,1fr]":w.length>1,"univer-grid-cols-none":w.length===1},T.borderBottomClassName),children:[w.length>1&&C.jsx(T.HoverCard,{className:"univer-max-w-96 !univer-rounded-xl",align:"start",open:D,overlay:C.jsx("div",{className:"univer-grid univer-gap-1 univer-px-2 univer-py-1",children:w.map(U=>{const W=h0[U.key];return C.jsxs("a",{"data-u-comp":"ribbon-group-btn",className:"univer-box-border univer-flex univer-cursor-pointer univer-items-center univer-gap-2.5 univer-rounded-lg univer-px-2 univer-py-1.5 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700",onClick:()=>Z(U),children:[C.jsx("span",{className:T.clsx("univer-box-border univer-flex univer-size-9 univer-flex-shrink-0 univer-items-center univer-justify-center univer-rounded-lg",T.borderClassName),children:C.jsx(W,{className:"univer-text-gray-500 dark:!univer-text-gray-300"})}),C.jsxs("span",{className:"univer-flex univer-flex-col",children:[C.jsx("strong",{className:"univer-text-sm univer-font-semibold univer-text-gray-800 dark:!univer-text-gray-200",children:o.t(U.key)}),C.jsx("span",{className:"univer-text-xs univer-text-gray-400",children:o.t(`${U.key}Desc`)})]})]},U.key)})}),onOpenChange:I,children:C.jsxs("a",{className:"univer-mr-2 univer-flex univer-h-7 univer-cursor-pointer univer-items-center univer-gap-1.5 univer-whitespace-nowrap !univer-rounded-full univer-bg-gray-700 univer-pl-3 univer-pr-2 univer-text-sm univer-text-white dark:!univer-bg-gray-200 dark:!univer-text-gray-800",onClick:()=>I(!0),children:[o.t(S),C.jsx(Y1,{className:"univer-text-gray-200 dark:!univer-text-gray-500"})]})}),C.jsxs("div",{"data-u-comp":"ribbon-toolbar",ref:b,className:T.clsx("univer-flex univer-overflow-hidden",T.divideXClassName),children:[$.visibleGroups.map(U=>{var W,q;return(((W=U.children)==null?void 0:W.length)||U.item)&&C.jsx(l.Fragment,{children:C.jsx("div",{className:"univer-grid univer-shrink-0 univer-grid-flow-col univer-gap-2 univer-px-2",children:U.children&&((q=U.children)==null?void 0:q.map(J=>J.item&&C.jsx(te,{...J.item},J.key)))})},U.key)}),x.length>0&&C.jsx("div",{"data-u-comp":"ribbon-toolbar-more",className:"univer-pl-2 rtl:univer-pr-2",children:C.jsx(T.Dropdown,{collisionPadding:{right:12,left:12},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:$.hiddenGroups.map(U=>{var W;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:U.children?(W=U.children)==null?void 0:W.map(q=>q.item&&C.jsx(te,{...q.item},q.key)):U.item&&C.jsx(te,{...U.item},U.key)})},U.key)})}),children:C.jsx("a",{className:m6,type:"button",children:C.jsx(xe,{})})})})]})]}),X]})}class ne extends h.Disposable{constructor(){super(...arguments);z(this,"_styleSheetId","univer-theme-css-variables")}injectThemeToHead(n){function r(c,v="--univer"){const m=[];function b(d,w=""){for(const y in d){const S=d[y],R=w?`${w}-${y}`:y;typeof S=="object"&&S!==null?b(S,R):m.push(`${v}-${R}: ${S};`)}}return b(c),m.join(`
9
9
  `)}const i=r(n),a=document.getElementById(this._styleSheetId);a&&a.remove();const o=document.createElement("style");o.setAttribute("id",this._styleSheetId),o.innerHTML=`:root {
10
10
  ${i}
11
- }`,document.head.appendChild(o)}dispose(){super.dispose()}}const re=h.createIdentifier("ui.contextmenu.service");class Xe extends h.Disposable{constructor(){super(...arguments);z(this,"_currentHandler",null);z(this,"disabled",!1)}get visible(){var n,r;return(r=(n=this._currentHandler)==null?void 0:n.visible)!=null?r:!1}disable(){this.disabled=!0}enable(){this.disabled=!1}triggerContextMenu(n,r){var i;n.stopPropagation(),!this.disabled&&((i=this._currentHandler)==null||i.handleContextMenu(n,r))}hideContextMenu(){var n;(n=this._currentHandler)==null||n.hideContextMenu()}registerContextMenuHandler(n){if(this._currentHandler)throw new Error("There is already a context menu handler!");return this._currentHandler=n,h.toDisposable(()=>this._currentHandler=null)}}function _6(){const e=l.useRef(null),[t,n]=l.useState(!1),[r,i]=l.useState(""),[a,o]=l.useState([0,0]),c=l.useRef(t),v=N.useDependency(re),m=N.useDependency(h.ICommandService),b=N.useInjector();c.current=t,l.useEffect(()=>{const y=v.registerContextMenuHandler({handleContextMenu:d,hideContextMenu(){n(!1)},get visible(){return c.current}});function S(R){e.current&&!e.current.contains(R.target)&&w()}return document.addEventListener("pointerdown",S),document.addEventListener("wheel",w),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("wheel",w),y.dispose()}},[v]);function d(y,S){n(!1),requestAnimationFrame(()=>{i(S),o([y.clientX,y.clientY]),n(!0)})}function w(){n(!1)}return C.jsx(T.Popup,{visible:t,offset:a,children:C.jsx("section",{ref:e,children:r&&C.jsx($e,{menuType:r,onOptionSelect:y=>{const{label:S,commandId:R,value:D}=y;m&&m.executeCommand(R!=null?R:S,{value:D}),b.get(H1).focus(),n(!1)}})})})}const Le=h.createIdentifier("univer.global-zone-service");function qe(){const e=N.useDependency(Le),[t,n]=l.useState(!1),r=N.useObservable(e.componentKey$,e.componentKey),i=N.useDependency(v1),a=l.useMemo(()=>{const o=i.get(r!=null?r:"");if(o)return o},[r,i]);return l.useEffect(()=>{const o=e.visible$.subscribe(c=>{n(c)});return()=>{o.unsubscribe()}},[e.visible$]),t?C.jsx("section",{className:T.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 Je(){const e=N.useDependency(k1),t=N.useObservable(e.sidebarOptions$),n=l.useRef(null),r=l.useMemo(()=>{if(!t)return null;const o={...t};for(const c of["children","header","footer"]){const v=c;if(t[v]){const{key:m,...b}=t[v];b&&(o[v]=C.jsx(d1,{...b},m))}}return o},[t]);l.useEffect(()=>(n.current&&e.setContainer(n.current),()=>{e.setContainer(void 0)}),[e]),l.useEffect(()=>{const o=v=>{e.scrollEvent$.next(v)},c=n.current;return c&&c.addEventListener("scroll",o),()=>{c==null||c.removeEventListener("scroll",o)}},[e]);const i=l.useMemo(()=>r!=null&&r.visible?typeof r.width=="number"?`${r.width}px`:r.width:0,[r]);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:T.clsx("univer-relative univer-h-full univer-bg-white univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-white",{"univer-w-96 univer-translate-x-0":r==null?void 0:r.visible,"univer-w-0 univer-translate-x-full":!(r!=null&&r.visible)}),style:{width:i},children:C.jsxs("section",{ref:n,className:T.clsx("univer-box-border univer-grid univer-h-0 univer-min-h-full univer-grid-rows-[auto_1fr_auto] univer-overflow-y-auto",T.borderLeftBottomClassName,T.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:[r==null?void 0:r.header,C.jsx("a",{className:"univer-cursor-pointer univer-text-gray-500 dark:!univer-text-gray-300",onClick:a,children:C.jsx(Re,{})})]}),C.jsx("section",{className:"univer-box-border univer-px-4",style:r==null?void 0:r.bodyStyle,children:r==null?void 0:r.children}),(r==null?void 0:r.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:r.footer})]})})}const we=h.createIdentifier("univer.zen-zone-service");function Qe(){const e=N.useDependency(we),[t,n]=l.useState(!1),[r,i]=l.useState(),a=N.useObservable(e.temporaryHidden$),o=N.useDependency(v1);l.useEffect(()=>{const v=[e.visible$.subscribe(m=>{n(m)}),e.componentKey$.subscribe(m=>{i(m)})];return()=>{v.forEach(m=>{m.unsubscribe()})}},[]);const c=l.useMemo(()=>{const v=o.get(r!=null?r:"");if(v)return v},[r]);return C.jsx("section",{className:T.clsx("univer-absolute univer-z-[-1] univer-flex",{"univer-animate-in univer-fade-in univer-inset-0 univer-z-[100] univer-bg-gray-100":t,"univer-hidden":a}),children:C.jsx("div",{className:"univer-relative univer-flex-1",children:c&&C.jsx(c,{})})})}function C0(e){const t=A9($1);return C.jsx(v0,{...e,...t})}function v0(e){var K;const{header:t=!0,toolbar:n=!0,footer:r=!0,headerMenu:i=!0,contextMenu:a=!0,ribbonType:o="default",mountContainer:c,onRendered:v}=e,m=N.useDependency(h.LocaleService),b=N.useDependency(h.ThemeService),d=N.useDependency(ne),w=l.useRef(null),S=N.useDependency(h.IConfigService).getConfig($1),R=p1(o1.CUSTOM_HEADER),D=p1(o1.FOOTER),I=p1(o1.HEADER),x=p1(o1.HEADER_MENU),O=p1(o1.CONTENT),B=p1(o1.LEFT_SIDEBAR),M=p1(o1.GLOBAL),Z=p1(o1.TOOLBAR),$=(K=S==null?void 0:S.popupRootId)!=null?K:"univer-popup-portal";l.useLayoutEffect(()=>{const G=b.currentTheme$.subscribe(Y=>{d.injectThemeToHead(Y)});return()=>{G.unsubscribe()}},[]);const[X,U]=l.useState(!1);l.useLayoutEffect(()=>{const G=b.darkMode$.subscribe(Y=>{U(Y),Y?document.documentElement.classList.add("univer-dark"):document.documentElement.classList.remove("univer-dark")});return()=>{G.unsubscribe()}},[]),l.useEffect(()=>{w.current&&(v==null||v(w.current))},[v]);const[W,q]=l.useState(m.getLocales()),J=l.useMemo(()=>document.createElement("div"),[]);return l.useEffect(()=>{document.body.appendChild(J);const G=[m.localeChanged$.subscribe(()=>{q(m.getLocales())})];return()=>{G.forEach(Y=>Y.unsubscribe()),document.body.removeChild(J)}},[m,c,J]),C.jsxs(T.ConfigProvider,{locale:W==null?void 0:W.design,mountContainer:J,children:[C.jsxs("div",{"data-u-comp":"workbench-layout",className:T.clsx("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",{"univer-dark":X}),tabIndex:-1,onBlur:G=>G.stopPropagation(),onContextMenu:G=>G.preventDefault(),children:[C.jsx("div",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",children:C.jsx(m1,{components:R},"custom-header")}),t&&n&&C.jsx("header",{"data-u-comp":"headerbar",className:"univer-relative univer-z-10 univer-w-full univer-overflow-hidden",children:C.jsx(m1,{components:Z,sharedProps:{ribbonType:o,headerMenuComponents:x,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(m1,{components:B},"left-sidebar")}),C.jsxs("section",{className:T.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",T.borderBottomClassName),children:[C.jsx("header",{children:t&&C.jsx(m1,{components:I},"header")}),C.jsx("section",{className:"univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",ref:w,"data-range-selector":!0,onContextMenu:G=>G.preventDefault(),children:C.jsx(m1,{components:O},"content")})]}),C.jsx("aside",{"data-u-comp":"right-sidebar",className:"univer-h-full",children:C.jsx(Je,{})})]}),r&&C.jsx("footer",{children:C.jsx(m1,{components:D,sharedProps:{contextMenu:a}},"footer")}),C.jsx(Qe,{})]})]}),C.jsx(m1,{components:M},"global"),C.jsx(qe,{}),a&&C.jsx(_6,{}),C.jsx(g0,{}),C.jsx("div",{id:$})]})}function g0(){const{mountContainer:e}=l.useContext(T.ConfigContext),t=p1(o1.FLOATING);return H3.createPortal(C.jsx(m1,{components:t},"floating"),e)}const m0=3e3;class Ke extends h.Disposable{constructor(n,r,i,a,o){super();z(this,"_steadyTimeout");z(this,"_renderTimeout");z(this,"_currentRenderId",null);this._injector=n,this._instanceService=r,this._layoutService=i,this._lifecycleService=a,this._renderManagerService=o}dispose(){super.dispose(),clearTimeout(this._steadyTimeout),clearTimeout(this._renderTimeout)}_bootstrapWorkbench(){this.disposeWithMe(this.bootstrap(async(n,r)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(r)),this.disposeWithMe(this._layoutService.registerContentElement(n)));try{await this._lifecycleService.onStage(h.LifecycleStages.Ready),this._renderTimeout=window.setTimeout(()=>{const i=this._renderManagerService.getRenderAll();for(const[a]of i)if(this._changeRenderUnit(a,n))break;this.disposeWithMe(this._instanceService.focused$.subscribe(a=>{a&&this._changeRenderUnit(a,n)})),this.disposeWithMe(this._renderManagerService.created$.subscribe(a=>{var o;a.unitId===((o=this._instanceService.getFocusedUnit())==null?void 0:o.getUnitId())&&this._changeRenderUnit(a.unitId,n)})),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},m0)},300)}catch(i){if(i instanceof h.LifecycleUnreachableError)return;throw i}}))}_changeRenderUnit(n,r){if(this._currentRenderId===n)return!1;const i=this._renderManagerService.getRenderById(n);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(r),i.activate(),this._currentRenderId=n,!0}}var p0=Object.getOwnPropertyDescriptor,b0=(e,t,n,r)=>{for(var i=r>1?void 0:r?p0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},V1=(e,t)=>(n,r)=>t(n,r,e);f.DesktopUIController=class extends Ke{constructor(t,n,r,i,a,o,c,v,m){super(n,o,a,r,i),this._config=t,this._componentManager=m,c.mergeMenu(n6),this._initBuiltinComponents(v),this._registerComponents(),this._bootstrapWorkbench()}_registerComponents(){[[T9,R9],[Z9,x9],[B9,P9],[F9,U9],[z9,j9],[$9,T.ColorPicker]].forEach(([t,n])=>{this.disposeWithMe(this._componentManager.register(t,n))})}bootstrap(t){return L0(this._injector,this._config,t)}_initBuiltinComponents(t){this.disposeWithMe(t.registerComponent(o1.FLOATING,()=>N.connectInjector(We,this._injector))),this.disposeWithMe(t.registerComponent(o1.CONTENT,()=>N.connectInjector(ze,this._injector))),this.disposeWithMe(t.registerComponent(o1.TOOLBAR,()=>N.connectInjector(w6,this._injector)))}},f.DesktopUIController=b0([V1(1,h.Inject(h.Injector)),V1(2,h.Inject(h.LifecycleService)),V1(3,G1.IRenderManagerService),V1(4,H1),V1(5,h.IUniverInstanceService),V1(6,S1),V1(7,_1),V1(8,h.Inject(v1))],f.DesktopUIController);function L0(e,t,n){let r;const i=t.container;if(typeof i=="string"){const v=document.getElementById(i);v?r=v:r=y6(i)}else i instanceof HTMLElement?r=i:r=y6("univer");const a=N.connectInjector(C0,e),o=v=>n(v,r);function c(){T.render(C.jsx(a,{...t,mountContainer:r,onRendered:o}),r)}return c(),h.toDisposable(()=>{T.render(C.jsx("div",{}),r),setTimeout(()=>T.render(C.jsx("div",{}),r),200),setTimeout(()=>T.unmount(r),500)})}function y6(e){const t=document.createElement("div");return t.id=e,t}const ie=h.createIdentifier("univer.ui.ui-controller");function w0(e){const{menuType:t,onOptionSelect:n}=e,r=N.useDependency(S1);if(!t)return null;const i=l.useMemo(()=>{const a=r.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)}, 72px)`},children:i.map(a=>a.item&&C.jsx(_0,{menuItem:a.item,onClick:o=>n==null?void 0:n({value:"",label:a.key,...o})},a.key))})}function _0(e){const{menuItem:t,onClick:n}=e,{id:r,type:i,title:a,label:o,icon:c}=t;if(i!==g1.BUTTON)throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${r}".`);const v=N.useObservable(t.disabled$,!1),m=N.useObservable(t.value$);return C.jsx("button",{type:"button",className:T.clsx("univer-w-18 univer-flex 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:()=>n({id:r}),children:C.jsx(d1,{value:m,title:a,label:o,icon:c})},r)}function M6(){const[e,t]=l.useState(!1),[n,r]=l.useState(""),[i,a]=l.useState([0,0]),o=l.useRef(e),c=N.useDependency(re),v=N.useDependency(h.ICommandService);o.current=e,l.useEffect(()=>{const d=c.registerContextMenuHandler({handleContextMenu:m,hideContextMenu(){t(!1)},get visible(){return o.current}});return document.addEventListener("pointerdown",b),document.addEventListener("wheel",b),()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("wheel",b),d.dispose()}},[c]);function m(d,w){r(w),a([d.clientX,d.clientY]),t(!0)}function b(){t(!1)}return C.jsx(T.Popup,{visible:e,offset:i,children:C.jsx("section",{onPointerDown:d=>d.stopPropagation(),children:n&&C.jsx(w0,{menuType:n,onOptionSelect:d=>{const{label:w,value:y,commandId:S}=d;v&&v.executeCommand(S!=null?S:w,{value:y}),t(!1)}})})})}function y0(e){const{header:t=!0,footer:n=!0,contextMenu:r=!0,mountContainer:i,onRendered:a}=e,o=N.useDependency(h.LocaleService),c=N.useDependency(h.ThemeService),v=N.useDependency(ne),m=l.useRef(null),b=p1(o1.FOOTER),d=p1(o1.HEADER),w=p1(o1.CONTENT),y=p1(o1.LEFT_SIDEBAR),S=p1(o1.GLOBAL),[R,D]=l.useState(!1);l.useEffect(()=>{const B=c.darkMode$.subscribe(M=>{D(M)});return()=>{B.unsubscribe()}},[]),l.useEffect(()=>{m.current&&(a==null||a(m.current))},[a]);const[I,x]=l.useState(o.getLocales()),O=l.useMemo(()=>document.createElement("div"),[]);return l.useLayoutEffect(()=>{const B=c.currentTheme$.subscribe(M=>{v.injectThemeToHead(M)});return()=>{B.unsubscribe()}},[]),l.useEffect(()=>{document.body.appendChild(O);const B=[o.localeChanged$.subscribe(()=>{x(o.getLocales())})];return()=>{B.forEach(M=>M.unsubscribe()),document.body.removeChild(O)}},[o,i,O]),C.jsxs(T.ConfigProvider,{locale:I==null?void 0:I.design,mountContainer:O,children:[C.jsxs("div",{"data-u-comp":"app-layout",className:T.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":R}),tabIndex:-1,onBlur:B=>B.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(m1,{components:y},"left-sidebar")}),C.jsxs("section",{className:T.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",T.borderBottomClassName),children:[C.jsx("header",{className:"univer-w-screen",children:t&&C.jsx(m1,{components:d},"header")}),C.jsx("section",{ref:m,className:"univer-relative univer-overflow-hidden","data-range-selector":!0,onContextMenu:B=>B.preventDefault(),children:C.jsx(m1,{components:w},"content")})]}),C.jsx("aside",{className:"univer-h-full",children:C.jsx(Je,{})})]}),n&&C.jsx("footer",{children:C.jsx(m1,{components:b},"footer")}),C.jsx(qe,{}),C.jsx(Qe,{})]})]}),C.jsx(m1,{components:S},"global"),r&&C.jsx(M6,{})]})}var M0=Object.getOwnPropertyDescriptor,S0=(e,t,n,r)=>{for(var i=r>1?void 0:r?M0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},B1=(e,t)=>(n,r)=>t(n,r,e);let e3=class extends Ke{constructor(e,t,n,r,i,a,o){super(t,a,i,n,r),this._config=e,this._initBuiltinComponents(o),this._bootstrapWorkbench()}bootstrap(e){return I0(this._injector,this._config,e)}_initBuiltinComponents(e){this.disposeWithMe(e.registerComponent(o1.CONTENT,()=>N.connectInjector(We,this._injector))),this.disposeWithMe(e.registerComponent(o1.CONTENT,()=>N.connectInjector(ze,this._injector)))}};e3=S0([B1(1,h.Inject(h.Injector)),B1(2,h.Inject(h.LifecycleService)),B1(3,G1.IRenderManagerService),B1(4,H1),B1(5,h.IUniverInstanceService),B1(6,_1)],e3);function I0(e,t,n){let r;const i=t.container;if(typeof i=="string"){const v=document.getElementById(i);v?r=v:r=S6(i)}else i instanceof HTMLElement?r=i:r=S6("univer");const a=N.connectInjector(y0,e),o=v=>n(v,r);function c(){T.render(C.jsx(a,{...t,mountContainer:r,onRendered:o}),r)}return c(),h.toDisposable(()=>{T.unmount(r)})}function S6(e){const t=document.createElement("div");return t.id=e,t}const oe=h.createIdentifier("ui.notification.service");var H0=Object.getOwnPropertyDescriptor,E0=(e,t,n,r)=>{for(var i=r>1?void 0:r?H0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},D0=(e,t)=>(n,r)=>t(n,r,e);const t3=h.createIdentifier("univer.ui.before-close-service");f.DesktopBeforeCloseService=class{constructor(t){z(this,"_beforeUnloadCallbacks",[]);z(this,"_onCloseCallbacks",[]);this._notificationService=t,this._init()}registerBeforeClose(t){return this._beforeUnloadCallbacks.push(t),{dispose:()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(n=>n!==t)}}}registerOnClose(t){return this._onCloseCallbacks.push(t),{dispose:()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(n=>n!==t)}}}_init(){window.addEventListener("beforeunload",t=>{let n=t;const r=this._beforeUnloadCallbacks.map(i=>i()).filter(i=>!!i).join(`
11
+ }`,document.head.appendChild(o)}dispose(){super.dispose()}}const re=h.createIdentifier("ui.contextmenu.service");class Xe extends h.Disposable{constructor(){super(...arguments);z(this,"_currentHandler",null);z(this,"disabled",!1)}get visible(){var n,r;return(r=(n=this._currentHandler)==null?void 0:n.visible)!=null?r:!1}disable(){this.disabled=!0}enable(){this.disabled=!1}triggerContextMenu(n,r){var i;n.stopPropagation(),!this.disabled&&((i=this._currentHandler)==null||i.handleContextMenu(n,r))}hideContextMenu(){var n;(n=this._currentHandler)==null||n.hideContextMenu()}registerContextMenuHandler(n){if(this._currentHandler)throw new Error("There is already a context menu handler!");return this._currentHandler=n,h.toDisposable(()=>this._currentHandler=null)}}function _6(){const e=l.useRef(null),[t,n]=l.useState(!1),[r,i]=l.useState(""),[a,o]=l.useState([0,0]),c=l.useRef(t),v=N.useDependency(re),m=N.useDependency(h.ICommandService),b=N.useInjector();c.current=t,l.useEffect(()=>{const y=v.registerContextMenuHandler({handleContextMenu:d,hideContextMenu(){n(!1)},get visible(){return c.current}});function S(R){e.current&&!e.current.contains(R.target)&&w()}return document.addEventListener("pointerdown",S),document.addEventListener("wheel",w),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("wheel",w),y.dispose()}},[v]);function d(y,S){n(!1),requestAnimationFrame(()=>{i(S),o([y.clientX,y.clientY]),n(!0)})}function w(){n(!1)}return C.jsx(T.Popup,{visible:t,offset:a,children:C.jsx("section",{ref:e,children:r&&C.jsx($e,{menuType:r,onOptionSelect:y=>{const{label:S,commandId:R,value:D}=y;m&&m.executeCommand(R!=null?R:S,{value:D}),b.get(H1).focus(),n(!1)}})})})}const Le=h.createIdentifier("univer.global-zone-service");function qe(){const e=N.useDependency(Le),[t,n]=l.useState(!1),r=N.useObservable(e.componentKey$,e.componentKey),i=N.useDependency(v1),a=l.useMemo(()=>{const o=i.get(r!=null?r:"");if(o)return o},[r,i]);return l.useEffect(()=>{const o=e.visible$.subscribe(c=>{n(c)});return()=>{o.unsubscribe()}},[e.visible$]),t?C.jsx("section",{className:T.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 Je(){const e=N.useDependency(k1),t=N.useObservable(e.sidebarOptions$),n=l.useRef(null),r=l.useMemo(()=>{if(!t)return null;const o={...t};for(const c of["children","header","footer"]){const v=c;if(t[v]){const{key:m,...b}=t[v];b&&(o[v]=C.jsx(d1,{...b},m))}}return o},[t]);l.useEffect(()=>(n.current&&e.setContainer(n.current),()=>{e.setContainer(void 0)}),[e]),l.useEffect(()=>{const o=v=>{e.scrollEvent$.next(v)},c=n.current;return c&&c.addEventListener("scroll",o),()=>{c==null||c.removeEventListener("scroll",o)}},[e]);const i=l.useMemo(()=>r!=null&&r.visible?typeof r.width=="number"?`${r.width}px`:r.width:0,[r]);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:T.clsx("univer-relative univer-h-full univer-bg-white univer-text-gray-900 dark:!univer-bg-gray-900 dark:!univer-text-white",{"univer-w-96 univer-translate-x-0":r==null?void 0:r.visible,"univer-w-0 univer-translate-x-full":!(r!=null&&r.visible)}),style:{width:i},children:C.jsxs("section",{ref:n,className:T.clsx("univer-box-border univer-grid univer-h-0 univer-min-h-full univer-grid-rows-[auto_1fr_auto] univer-overflow-y-auto",T.borderLeftBottomClassName,T.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:[r==null?void 0:r.header,C.jsx("a",{className:"univer-cursor-pointer univer-text-gray-500 dark:!univer-text-gray-300",onClick:a,children:C.jsx(Re,{})})]}),C.jsx("section",{className:"univer-box-border univer-px-4",style:r==null?void 0:r.bodyStyle,children:r==null?void 0:r.children}),(r==null?void 0:r.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:r.footer})]})})}const we=h.createIdentifier("univer.zen-zone-service");function Qe(){const e=N.useDependency(we),[t,n]=l.useState(!1),[r,i]=l.useState(),a=N.useObservable(e.temporaryHidden$),o=N.useDependency(v1);l.useEffect(()=>{const v=[e.visible$.subscribe(m=>{n(m)}),e.componentKey$.subscribe(m=>{i(m)})];return()=>{v.forEach(m=>{m.unsubscribe()})}},[]);const c=l.useMemo(()=>{const v=o.get(r!=null?r:"");if(v)return v},[r]);return C.jsx("section",{className:T.clsx("univer-absolute univer-z-[-1] univer-flex",{"univer-animate-in univer-fade-in univer-inset-0 univer-z-[100] univer-bg-gray-100":t,"univer-hidden":a}),children:C.jsx("div",{className:"univer-relative univer-flex-1",children:c&&C.jsx(c,{})})})}function C0(e){const t=A9($1);return C.jsx(v0,{...e,...t})}function v0(e){var K;const{header:t=!0,toolbar:n=!0,footer:r=!0,headerMenu:i=!0,contextMenu:a=!0,ribbonType:o="default",mountContainer:c,onRendered:v}=e,m=N.useDependency(h.LocaleService),b=N.useDependency(h.ThemeService),d=N.useDependency(ne),w=l.useRef(null),S=N.useDependency(h.IConfigService).getConfig($1),R=p1(o1.CUSTOM_HEADER),D=p1(o1.FOOTER),I=p1(o1.HEADER),x=p1(o1.HEADER_MENU),O=p1(o1.CONTENT),B=p1(o1.LEFT_SIDEBAR),M=p1(o1.GLOBAL),Z=p1(o1.TOOLBAR),$=(K=S==null?void 0:S.popupRootId)!=null?K:"univer-popup-portal";l.useLayoutEffect(()=>{const G=b.currentTheme$.subscribe(Y=>{d.injectThemeToHead(Y)});return()=>{G.unsubscribe()}},[]);const[X,U]=l.useState(!1);l.useLayoutEffect(()=>{const G=b.darkMode$.subscribe(Y=>{U(Y),Y?document.documentElement.classList.add("univer-dark"):document.documentElement.classList.remove("univer-dark")});return()=>{G.unsubscribe()}},[]),l.useEffect(()=>{w.current&&(v==null||v(w.current))},[v]);const[W,q]=l.useState(m.getLocales()),J=l.useMemo(()=>document.createElement("div"),[]);return l.useEffect(()=>{document.body.appendChild(J);const G=[m.localeChanged$.subscribe(()=>{q(m.getLocales())})];return()=>{G.forEach(Y=>Y.unsubscribe()),document.body.removeChild(J)}},[m,c,J]),C.jsxs(T.ConfigProvider,{locale:W==null?void 0:W.design,mountContainer:J,children:[C.jsxs("div",{"data-u-comp":"workbench-layout",className:T.clsx("univer-flex univer-h-full univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",{"univer-dark":X}),tabIndex:-1,onBlur:G=>G.stopPropagation(),onContextMenu:G=>G.preventDefault(),children:[C.jsx("div",{className:"univer-relative univer-flex univer-min-h-0 univer-flex-col univer-bg-white dark:!univer-bg-gray-800",children:C.jsx(m1,{components:R},"custom-header")}),t&&n&&C.jsx("header",{"data-u-comp":"headerbar",className:"univer-relative univer-z-10 univer-w-full univer-overflow-hidden",children:C.jsx(m1,{components:Z,sharedProps:{ribbonType:o,headerMenuComponents:x,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(m1,{components:B},"left-sidebar")}),C.jsxs("section",{className:T.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",T.borderBottomClassName),children:[C.jsx("header",{children:t&&C.jsx(m1,{components:I},"header")}),C.jsx("section",{className:"univer-relative univer-overflow-hidden dark:!univer-bg-gray-900",ref:w,"data-range-selector":!0,onContextMenu:G=>G.preventDefault(),children:C.jsx(m1,{components:O},"content")})]}),C.jsx("aside",{"data-u-comp":"right-sidebar",className:"univer-h-full",children:C.jsx(Je,{})})]}),r&&C.jsx("footer",{children:C.jsx(m1,{components:D,sharedProps:{contextMenu:a}},"footer")}),C.jsx(Qe,{})]})]}),C.jsx(m1,{components:M},"global"),C.jsx(qe,{}),a&&C.jsx(_6,{}),C.jsx(g0,{}),C.jsx("div",{id:$})]})}function g0(){const{mountContainer:e}=l.useContext(T.ConfigContext),t=p1(o1.FLOATING);return H3.createPortal(C.jsx(m1,{components:t},"floating"),e)}const m0=3e3;class Ke extends h.Disposable{constructor(n,r,i,a,o){super();z(this,"_steadyTimeout");z(this,"_renderTimeout");z(this,"_currentRenderId",null);this._injector=n,this._instanceService=r,this._layoutService=i,this._lifecycleService=a,this._renderManagerService=o}dispose(){super.dispose(),clearTimeout(this._steadyTimeout),clearTimeout(this._renderTimeout),delete this._instanceService,delete this._layoutService,delete this._lifecycleService,delete this._renderManagerService}_bootstrapWorkbench(){this.disposeWithMe(this.bootstrap(async(n,r)=>{this._layoutService&&(this.disposeWithMe(this._layoutService.registerRootContainerElement(r)),this.disposeWithMe(this._layoutService.registerContentElement(n)));try{await this._lifecycleService.onStage(h.LifecycleStages.Ready),this._renderTimeout=window.setTimeout(()=>{const i=this._renderManagerService.getRenderAll();for(const[a]of i)if(this._changeRenderUnit(a,n))break;this.disposeWithMe(this._instanceService.focused$.subscribe(a=>{a&&this._changeRenderUnit(a,n)})),this.disposeWithMe(this._renderManagerService.created$.subscribe(a=>{var o;a.unitId===((o=this._instanceService.getFocusedUnit())==null?void 0:o.getUnitId())&&this._changeRenderUnit(a.unitId,n)})),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},m0)},300)}catch(i){if(i instanceof h.LifecycleUnreachableError)return;throw i}}))}_changeRenderUnit(n,r){if(this._currentRenderId===n)return!1;const i=this._renderManagerService.getRenderById(n);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(r),i.activate(),this._currentRenderId=n,!0}}var p0=Object.getOwnPropertyDescriptor,b0=(e,t,n,r)=>{for(var i=r>1?void 0:r?p0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},V1=(e,t)=>(n,r)=>t(n,r,e);f.DesktopUIController=class extends Ke{constructor(t,n,r,i,a,o,c,v,m){super(n,o,a,r,i),this._config=t,this._componentManager=m,c.mergeMenu(n6),this._initBuiltinComponents(v),this._registerComponents(),this._bootstrapWorkbench()}_registerComponents(){[[T9,R9],[Z9,x9],[B9,P9],[F9,U9],[z9,j9],[$9,T.ColorPicker]].forEach(([t,n])=>{this.disposeWithMe(this._componentManager.register(t,n))})}dispose(){super.dispose(),this._componentManager.dispose()}bootstrap(t){return L0(this._injector,this._config,t)}_initBuiltinComponents(t){this.disposeWithMe(t.registerComponent(o1.FLOATING,()=>N.connectInjector(We,this._injector))),this.disposeWithMe(t.registerComponent(o1.CONTENT,()=>N.connectInjector(ze,this._injector))),this.disposeWithMe(t.registerComponent(o1.TOOLBAR,()=>N.connectInjector(w6,this._injector)))}},f.DesktopUIController=b0([V1(1,h.Inject(h.Injector)),V1(2,h.Inject(h.LifecycleService)),V1(3,G1.IRenderManagerService),V1(4,H1),V1(5,h.IUniverInstanceService),V1(6,S1),V1(7,_1),V1(8,h.Inject(v1))],f.DesktopUIController);function L0(e,t,n){let r;const i=t.container;if(typeof i=="string"){const v=document.getElementById(i);v?r=v:r=y6(i)}else i instanceof HTMLElement?r=i:r=y6("univer");const a=N.connectInjector(C0,e),o=v=>n(v,r);function c(){T.render(C.jsx(a,{...t,mountContainer:r,onRendered:o}),r)}return c(),h.toDisposable(()=>{T.render(C.jsx("div",{}),r),setTimeout(()=>T.render(C.jsx("div",{}),r),200),setTimeout(()=>T.unmount(r),500)})}function y6(e){const t=document.createElement("div");return t.id=e,t}const ie=h.createIdentifier("univer.ui.ui-controller");function w0(e){const{menuType:t,onOptionSelect:n}=e,r=N.useDependency(S1);if(!t)return null;const i=l.useMemo(()=>{const a=r.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)}, 72px)`},children:i.map(a=>a.item&&C.jsx(_0,{menuItem:a.item,onClick:o=>n==null?void 0:n({value:"",label:a.key,...o})},a.key))})}function _0(e){const{menuItem:t,onClick:n}=e,{id:r,type:i,title:a,label:o,icon:c}=t;if(i!==g1.BUTTON)throw new Error(`[MobileMenuItem]: on mobile devices only "BUTTON" type menu items are supported. Please check "${r}".`);const v=N.useObservable(t.disabled$,!1),m=N.useObservable(t.value$);return C.jsx("button",{type:"button",className:T.clsx("univer-w-18 univer-flex 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:()=>n({id:r}),children:C.jsx(d1,{value:m,title:a,label:o,icon:c})},r)}function M6(){const[e,t]=l.useState(!1),[n,r]=l.useState(""),[i,a]=l.useState([0,0]),o=l.useRef(e),c=N.useDependency(re),v=N.useDependency(h.ICommandService);o.current=e,l.useEffect(()=>{const d=c.registerContextMenuHandler({handleContextMenu:m,hideContextMenu(){t(!1)},get visible(){return o.current}});return document.addEventListener("pointerdown",b),document.addEventListener("wheel",b),()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("wheel",b),d.dispose()}},[c]);function m(d,w){r(w),a([d.clientX,d.clientY]),t(!0)}function b(){t(!1)}return C.jsx(T.Popup,{visible:e,offset:i,children:C.jsx("section",{onPointerDown:d=>d.stopPropagation(),children:n&&C.jsx(w0,{menuType:n,onOptionSelect:d=>{const{label:w,value:y,commandId:S}=d;v&&v.executeCommand(S!=null?S:w,{value:y}),t(!1)}})})})}function y0(e){const{header:t=!0,footer:n=!0,contextMenu:r=!0,mountContainer:i,onRendered:a}=e,o=N.useDependency(h.LocaleService),c=N.useDependency(h.ThemeService),v=N.useDependency(ne),m=l.useRef(null),b=p1(o1.FOOTER),d=p1(o1.HEADER),w=p1(o1.CONTENT),y=p1(o1.LEFT_SIDEBAR),S=p1(o1.GLOBAL),[R,D]=l.useState(!1);l.useEffect(()=>{const B=c.darkMode$.subscribe(M=>{D(M)});return()=>{B.unsubscribe()}},[]),l.useEffect(()=>{m.current&&(a==null||a(m.current))},[a]);const[I,x]=l.useState(o.getLocales()),O=l.useMemo(()=>document.createElement("div"),[]);return l.useLayoutEffect(()=>{const B=c.currentTheme$.subscribe(M=>{v.injectThemeToHead(M)});return()=>{B.unsubscribe()}},[]),l.useEffect(()=>{document.body.appendChild(O);const B=[o.localeChanged$.subscribe(()=>{x(o.getLocales())})];return()=>{B.forEach(M=>M.unsubscribe()),document.body.removeChild(O)}},[o,i,O]),C.jsxs(T.ConfigProvider,{locale:I==null?void 0:I.design,mountContainer:O,children:[C.jsxs("div",{"data-u-comp":"app-layout",className:T.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":R}),tabIndex:-1,onBlur:B=>B.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(m1,{components:y},"left-sidebar")}),C.jsxs("section",{className:T.clsx("univer-relative univer-grid univer-flex-1 univer-grid-rows-[auto_1fr] univer-overflow-hidden univer-bg-white dark:!univer-bg-gray-800",T.borderBottomClassName),children:[C.jsx("header",{className:"univer-w-screen",children:t&&C.jsx(m1,{components:d},"header")}),C.jsx("section",{ref:m,className:"univer-relative univer-overflow-hidden","data-range-selector":!0,onContextMenu:B=>B.preventDefault(),children:C.jsx(m1,{components:w},"content")})]}),C.jsx("aside",{className:"univer-h-full",children:C.jsx(Je,{})})]}),n&&C.jsx("footer",{children:C.jsx(m1,{components:b},"footer")}),C.jsx(qe,{}),C.jsx(Qe,{})]})]}),C.jsx(m1,{components:S},"global"),r&&C.jsx(M6,{})]})}var M0=Object.getOwnPropertyDescriptor,S0=(e,t,n,r)=>{for(var i=r>1?void 0:r?M0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},B1=(e,t)=>(n,r)=>t(n,r,e);let e3=class extends Ke{constructor(e,t,n,r,i,a,o){super(t,a,i,n,r),this._config=e,this._initBuiltinComponents(o),this._bootstrapWorkbench()}bootstrap(e){return I0(this._injector,this._config,e)}_initBuiltinComponents(e){this.disposeWithMe(e.registerComponent(o1.CONTENT,()=>N.connectInjector(We,this._injector))),this.disposeWithMe(e.registerComponent(o1.CONTENT,()=>N.connectInjector(ze,this._injector)))}};e3=S0([B1(1,h.Inject(h.Injector)),B1(2,h.Inject(h.LifecycleService)),B1(3,G1.IRenderManagerService),B1(4,H1),B1(5,h.IUniverInstanceService),B1(6,_1)],e3);function I0(e,t,n){let r;const i=t.container;if(typeof i=="string"){const v=document.getElementById(i);v?r=v:r=S6(i)}else i instanceof HTMLElement?r=i:r=S6("univer");const a=N.connectInjector(y0,e),o=v=>n(v,r);function c(){T.render(C.jsx(a,{...t,mountContainer:r,onRendered:o}),r)}return c(),h.toDisposable(()=>{T.unmount(r)})}function S6(e){const t=document.createElement("div");return t.id=e,t}const oe=h.createIdentifier("ui.notification.service");var H0=Object.getOwnPropertyDescriptor,E0=(e,t,n,r)=>{for(var i=r>1?void 0:r?H0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},D0=(e,t)=>(n,r)=>t(n,r,e);const t3=h.createIdentifier("univer.ui.before-close-service");f.DesktopBeforeCloseService=class{constructor(t){z(this,"_beforeUnloadCallbacks",[]);z(this,"_onCloseCallbacks",[]);this._notificationService=t,this._init()}registerBeforeClose(t){return this._beforeUnloadCallbacks.push(t),{dispose:()=>{this._beforeUnloadCallbacks=this._beforeUnloadCallbacks.filter(n=>n!==t)}}}registerOnClose(t){return this._onCloseCallbacks.push(t),{dispose:()=>{this._onCloseCallbacks=this._onCloseCallbacks.filter(n=>n!==t)}}}_init(){window.addEventListener("beforeunload",t=>{let n=t;const r=this._beforeUnloadCallbacks.map(i=>i()).filter(i=>!!i).join(`
12
12
  `);if(r)return this._notificationService.show({type:"error",title:"Some changes are not saved",content:r}),typeof n>"u"&&(n=window.event),n.returnValue=r,r}),window.addEventListener("unload",()=>{this._onCloseCallbacks.forEach(t=>t())})}},f.DesktopBeforeCloseService=E0([D0(0,oe)],f.DesktopBeforeCloseService);function I6(){return typeof navigator.clipboard<"u"&&typeof navigator.clipboard.readText<"u"}var O0=Object.getOwnPropertyDescriptor,V0=(e,t,n,r)=>{for(var i=r>1?void 0:r?O0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},n3=(e,t)=>(n,r)=>t(n,r,e);const r3="text/plain",i3="text/html",H6="image/png",E6="image/jpeg",D6="image/bmp",O6="image/webp",N0="image/svg+xml",R0=new Set([D6,E6,O6,H6]),o3=h.createIdentifier("univer.clipboard-interface-service");f.BrowserClipboardService=class extends h.Disposable{constructor(t,n,r){super(),this._localeService=t,this._logService=n,this._notificationService=r}get supportClipboard(){return I6()}async write(t,n){if(!this.supportClipboard)return this._legacyCopyHtml(n);try{return await navigator.clipboard.write([new ClipboardItem({[r3]:new Blob([t],{type:r3}),[i3]:new Blob([n],{type:i3})})])}catch(r){this._logService.error("[BrowserClipboardService]",r),this._showClipboardAuthenticationNotification()}}async writeText(t){if(!this.supportClipboard)return this._legacyCopyText(t);try{return await navigator.clipboard.writeText(t)}catch(n){this._logService.error("[BrowserClipboardService]",n),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 n=document.activeElement,r=x0();document.body.appendChild(r),r.innerHTML=t;try{V6(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_legacyCopyText(t){const n=document.activeElement,r=T0();document.body.appendChild(r),r.value=t;try{V6(r),document.execCommand("copy")}finally{n instanceof HTMLElement&&n.focus(),document.body.removeChild(r)}}_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=V0([n3(0,h.Inject(h.LocaleService)),n3(1,h.ILogService),n3(2,h.Optional(oe))],f.BrowserClipboardService);function T0(){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 x0(){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 V6(e){if(e instanceof HTMLTextAreaElement){const r=e.hasAttribute("readonly");return r||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),r||e.removeAttribute("readonly"),e.value}e.hasAttribute("contenteditable")&&e.focus();const t=document.createRange();t.selectNodeContents(e);const n=window.getSelection();if(!n)throw new Error;return n.removeAllRanges(),n.addRange(t),n.toString()}const _e=h.createIdentifier("univer.confirm-service");class Z0{constructor(){z(this,"confirmOptions$",new F.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 k0=e=>{const{children:t,onClose:n,onConfirm:r}=e,[i]=l.useState({}),a=t?l.cloneElement(t,{hooks:i}):null;return C.jsx(T.Confirm,{...e,children:a,onClose:()=>{const o=i.beforeClose;if(o){const c=o();if(c.cancel)return;n==null||n(c);return}n==null||n()},onConfirm:()=>{const o=i.beforeConfirm;if(o){const c=o();if(c.cancel)return;r==null||r(c);return}r==null||r()}})};function A0(){const e=N.useDependency(_e),[t,n]=l.useState([]);l.useEffect(()=>{const i=e.confirmOptions$.subscribe(a=>{n(a)});return()=>{i.unsubscribe()}},[]);const r=t.map(i=>{const{children:a,title:o,...c}=i,v=c;for(const m of["children","title"]){const b=m,d=i[b];d&&(v[b]=C.jsx(d1,{...d}))}return v});return r==null?void 0:r.map((i,a)=>C.jsx(k0,{...i,children:i.children},a))}var $0=Object.getOwnPropertyDescriptor,P0=(e,t,n,r)=>{for(var i=r>1?void 0:r?$0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},N6=(e,t)=>(n,r)=>t(n,r,e);f.DesktopConfirmService=class extends h.Disposable{constructor(n,r){super();z(this,"_confirmOptions",[]);z(this,"confirmOptions$",new F.BehaviorSubject([]));this._injector=n,this._uiPartsService=r,this._initUIPart()}open(n){return this._confirmOptions.find(r=>r.id===n.id)?this._confirmOptions=this._confirmOptions.map(r=>({...r.id===n.id?n:r,visible:r.id===n.id?!0:r.visible})):this._confirmOptions.push({...n,visible:!0}),this.confirmOptions$.next(this._confirmOptions),h.toDisposable(()=>{this._confirmOptions=[],this.confirmOptions$.next([])})}confirm(n){return new Promise(r=>{const i=this.open({...n,onConfirm:()=>{i.dispose(),r(!0)},onClose:()=>{i.dispose(),r(!1)}})})}close(n){this._confirmOptions=this._confirmOptions.map(r=>({...r,visible:r.id===n?!1:r.visible})),this.confirmOptions$.next([...this._confirmOptions])}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(o1.GLOBAL,()=>N.connectInjector(A0,this._injector)))}},f.DesktopConfirmService=P0([N6(0,h.Inject(h.Injector)),N6(1,_1)],f.DesktopConfirmService);const ye=h.createIdentifier("univer.ui.dialog-service");function U0(){const e=N.useDependency(ye),[t,n]=l.useState([]);l.useEffect(()=>{const a=e.getDialogs$().subscribe(o=>{n(o)});return()=>a.unsubscribe()},[]);const r=l.useMemo(()=>t.map(i=>{const{children:a,title:o,footer:c,...v}=i,m=v;for(const b of["children","title","footer"]){const d=b,w=i[d];w&&(m[d]=C.jsx(d1,{...w}))}return m}),[t]);return r==null?void 0:r.map(i=>C.jsx(T.Dialog,{...i},i.id))}var B0=Object.getOwnPropertyDescriptor,F0=(e,t,n,r)=>{for(var i=r>1?void 0:r?B0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},R6=(e,t)=>(n,r)=>t(n,r,e);f.DesktopDialogService=class extends h.Disposable{constructor(n,r){super();z(this,"_dialogOptions",[]);z(this,"_dialogOptions$",new F.Subject);this._injector=n,this._uiPartsService=r,this._initUIPart()}dispose(){super.dispose(),this._dialogOptions=[],this._dialogOptions$.complete()}open(n){return this._dialogOptions.find(r=>r.id===n.id)?this._dialogOptions=this._dialogOptions.map(r=>({...r.id===n.id?n:r,open:r.id===n.id?!0:r.open})):this._dialogOptions.push({...n,open:!0}),this._dialogOptions$.next(this._dialogOptions),h.toDisposable(()=>{this._dialogOptions=[],this._dialogOptions$.next([])})}close(n){this._dialogOptions=this._dialogOptions.map(r=>({...r,open:r.id===n?!1:r.open})),this._dialogOptions$.next([...this._dialogOptions])}closeAll(n){const r=new Set(n);this._dialogOptions=this._dialogOptions.map(i=>({...i,open:r.has(i.id)?i.open:!1})),this._dialogOptions$.next([...this._dialogOptions])}getDialogs$(){return this._dialogOptions$.asObservable()}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(o1.GLOBAL,()=>N.connectInjector(U0,this._injector)))}},f.DesktopDialogService=F0([R6(0,h.Inject(h.Injector)),R6(1,_1)],f.DesktopDialogService);const Me=h.createIdentifier("univer.ui.gallery-service");function j0(){const e=N.useDependency(Me),t=N.useObservable(e.gallery$);return t?C.jsx(T.Gallery,{...t}):null}var z0=Object.getOwnPropertyDescriptor,G0=(e,t,n,r)=>{for(var i=r>1?void 0:r?z0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},T6=(e,t)=>(n,r)=>t(n,r,e);f.DesktopGalleryService=class extends h.Disposable{constructor(n,r){super();z(this,"gallery$",new F.Subject);this._injector=n,this._uiPartsService=r,this._initUIPart()}dispose(){super.dispose()}open(n){return this.gallery$.next({open:!0,...n}),h.toDisposable(()=>{this.gallery$.complete()})}close(){this.gallery$.next({open:!1,images:[]})}_initUIPart(){this.disposeWithMe(this._uiPartsService.registerComponent(o1.GLOBAL,()=>N.connectInjector(j0,this._injector)))}},f.DesktopGalleryService=G0([T6(0,h.Inject(h.Injector)),T6(1,_1)],f.DesktopGalleryService);var W0=Object.getOwnPropertyDescriptor,Y0=(e,t,n,r)=>{for(var i=r>1?void 0:r?W0(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},X0=(e,t)=>(n,r)=>t(n,r,e);f.DesktopGlobalZoneService=class{constructor(t){z(this,"visible$",new F.Subject);z(this,"componentKey$",new F.Subject);z(this,"_componentKey","");this._componentManager=t}get componentKey(){return this._componentKey}set(t,n){return this._componentManager.register(t,n),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=Y0([X0(0,h.Inject(v1))],f.DesktopGlobalZoneService);class a3 extends h.Disposable{openFile(t){return new Promise(n=>{var i,a;const r=document.createElement("input");r.type="file",r.accept=(i=t==null?void 0:t.accept)!=null?i:"",r.multiple=(a=t==null?void 0:t.multiple)!=null?a:!1,r.onchange=o=>{const c=o.target.files;c&&n(Array.from(c))},r.click()})}downloadFile(t,n){const r=document.createElement("a");r.download=n,r.href=window.URL.createObjectURL(t),r.click()}}const l3=h.createIdentifier("univer-ui.local-file.service");var Se=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function q0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ie(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 s3={exports:{}};/*!
13
13
  localForage -- Offline Storage, Improved
14
14
  Version 1.10.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/ui",
3
- "version": "0.10.10",
3
+ "version": "0.10.11-nightly.202510220308",
4
4
  "private": false,
5
5
  "description": "UniverSheet normal plugin UI manager",
6
6
  "author": "DreamNum <developer@univer.ai>",
@@ -65,12 +65,12 @@
65
65
  "rxjs": ">=7.0.0"
66
66
  },
67
67
  "dependencies": {
68
- "@univerjs/icons": "^0.4.8",
69
- "@wendellhu/redi": "1.0.0",
68
+ "@univerjs/icons": "^0.4.9",
69
+ "@wendellhu/redi": "1.0.1",
70
70
  "localforage": "^1.10.0",
71
- "@univerjs/core": "0.10.10",
72
- "@univerjs/design": "0.10.10",
73
- "@univerjs/engine-render": "0.10.10"
71
+ "@univerjs/core": "0.10.11-nightly.202510220308",
72
+ "@univerjs/design": "0.10.11-nightly.202510220308",
73
+ "@univerjs/engine-render": "0.10.11-nightly.202510220308"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@testing-library/react": "^16.3.0",
@@ -80,11 +80,11 @@
80
80
  "rxjs": "^7.8.2",
81
81
  "tailwindcss": "3.4.17",
82
82
  "tailwindcss-animate": "^1.0.7",
83
- "typescript": "^5.9.2",
84
- "vite": "^7.1.4",
83
+ "typescript": "^5.9.3",
84
+ "vite": "^7.1.10",
85
85
  "vitest": "^3.2.4",
86
- "@univerjs/themes": "0.10.10",
87
- "@univerjs-infra/shared": "0.10.10"
86
+ "@univerjs-infra/shared": "0.10.11",
87
+ "@univerjs/themes": "0.10.11-nightly.202510220308"
88
88
  },
89
89
  "scripts": {
90
90
  "test": "vitest run",
package/LICENSE DELETED
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS