efficient-office 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Documents-ISV66NLW.js +1 -0
- package/dist/Slides-JI73C3NW.js +1 -0
- package/dist/SlidesEditor-5WCXE27J.js +1 -0
- package/dist/Spreadsheet-I3RO4HSS.js +1 -0
- package/dist/chunk-3RFDQOTI.js +1 -0
- package/dist/chunk-4NKXNXKY.js +1 -0
- package/dist/chunk-6ZFEBY6H.js +1 -0
- package/dist/chunk-7K7AY3V3.js +1 -0
- package/dist/chunk-B2X3NIQR.js +1 -0
- package/dist/chunk-B32ASXHM.js +1 -0
- package/dist/chunk-B6JN7D6G.js +1 -0
- package/dist/{chunk-QSM7NWZ2.js → chunk-BGAR3P46.js} +1 -1
- package/dist/chunk-COXKOQPZ.js +1 -0
- package/dist/chunk-GLT7O6TV.js +1 -0
- package/dist/{chunk-E4N3DBYM.js → chunk-HU4RI2OM.js} +1 -1
- package/dist/chunk-I3AC6PYR.js +1 -0
- package/dist/chunk-JCSB2PHB.js +1 -0
- package/dist/{chunk-USKJW3BA.js → chunk-MDG2ADZ7.js} +1 -1
- package/dist/chunk-PMGQ5GUH.js +1 -0
- package/dist/chunk-PXOQN7D6.js +1 -0
- package/dist/chunk-Q7NVDOCX.js +1 -0
- package/dist/chunk-XYVQTQ6N.js +1 -0
- package/dist/{deckPdf-Q4OXQ7HV.js → deckPdf-4RC7QJ45.js} +1 -1
- package/dist/documents/documents.css +4 -0
- package/dist/documents/index.d.ts +22 -7
- package/dist/documents/index.js +1 -1
- package/dist/docxPdf-EW5I5JR3.js +1 -0
- package/dist/importDocument-274VK7OM.js +1 -0
- package/dist/importSpreadsheet-4U3KEJ76.js +1 -0
- package/dist/pptxImport-Y7TB6PYP.js +1 -0
- package/dist/slides/index.d.ts +534 -7
- package/dist/slides/index.js +1 -1
- package/dist/slides/slides.css +102 -0
- package/dist/spreadsheet/index.d.ts +62 -44
- package/dist/spreadsheet/index.js +1 -1
- package/dist/spreadsheet/spreadsheet.css +4 -0
- package/dist/words-DK_ajpEa.d.ts +67 -0
- package/dist/workbookPdf-C5SSN226.js +1 -0
- package/package.json +2 -2
- package/dist/Documents-HT324TAY.js +0 -1
- package/dist/Slides-EUDBOA5K.js +0 -1
- package/dist/SlidesEditor-6KDRHX4H.js +0 -1
- package/dist/Spreadsheet-SOF7NDLP.js +0 -1
- package/dist/chunk-2AKHYM66.js +0 -1
- package/dist/chunk-2PIEDEY5.js +0 -1
- package/dist/chunk-2TZUCKZ7.js +0 -1
- package/dist/chunk-3SRMKGQW.js +0 -1
- package/dist/chunk-AVUZSUQD.js +0 -1
- package/dist/chunk-SB3YS3LH.js +0 -1
- package/dist/chunk-XKOHIZO5.js +0 -1
- package/dist/chunk-YYHJJIA4.js +0 -1
- package/dist/docxPdf-NCSEKI4J.js +0 -1
- package/dist/options-Djr917yc.d.ts +0 -10
- package/dist/pptxImport-QEKBZWT2.js +0 -1
- package/dist/workbookPdf-OJDSHKRR.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{importSpreadsheetFile as e,readWithSheetJs as t}from"./chunk-B6JN7D6G.js";import{readXlsx as r,writeXlsx as n}from"./chunk-N26CBJZA.js";import{SPREADSHEET_ACCEPT as o,SPREADSHEET_EXTENSIONS as l,SpreadsheetsConflict as a,sheetsOf as i,useSpreadsheetWords as c,useSpreadsheetsHost as s}from"./chunk-GLT7O6TV.js";import"./chunk-7K7AY3V3.js";import{DEFAULT_COL_WIDTH as u,DEFAULT_FONT_SIZE as d,DEFAULT_ROW_HEIGHT as f,FUNCTION_NAMES as h,MAX_COLS as m,MAX_ROWS as g,NUMBER_FORMATS as p,adjustDecimals as v,applyBorders as w,cellDisplay as b,cellLabel as x,changeStructure as y,clearValues as C,colLabel as k,columnValues as N,commitEntry as D,copyClip as S,cycleRefAbsolute as R,dataRegion as M,deleteSheet as T,duplicateSheet as E,editText as A,expandForMerges as z,fillRange as F,filteredRows as I,findCells as O,formatKey as L,formatNumber as P,isFormula as $,makeEvaluator as B,mergeRange as U,mergedAt as K,moveCells as H,newSheet as W,nextSheetName as X,normalizeRange as V,parseCsv as G,parseRangeLabel as Y,pasteClip as j,printRef as _,rangeContains as Z,rangeLabel as Q,rawAt as J,readEntry as q,renameSheet as ee,replaceInCell as te,selectionStats as re,serializeCsv as ne,sheetFromRows as oe,shiftFormula as le,sortRange as ae,tokenize as ie,unmergeRange as ce,updateFormats as se,usedBounds as ue,withFormat as de,writeCells as fe}from"./chunk-VKCG3LPQ.js";import{FileList as he}from"./chunk-PMGQ5GUH.js";import"./chunk-B32ASXHM.js";import{placeCopy as me}from"./chunk-XYVQTQ6N.js";import{useCallback as ge,useEffect as pe,useMemo as ve,useRef as we,useState as be}from"react";import{saveIndicator as xe,useAutosave as ye}from"efficient-easel/autosave";import{SaveState as Ce}from"efficient-easel/chrome";import"efficient-easel/chrome.css";import{useEaselStrings as ke}from"efficient-easel/strings";import{WindowTitle as Ne,useBrowserLayoutEffect as De,useWindowDirty as Se}from"efficient-shell";import{Icon as Re}from"efficient-shell/icons";import{Button as Me,Checkbox as Te,ColorPickerPanel as Ee,ContextMenu as Ae,DropdownMenu as ze,EmptyState as Fe,IconButton as Ie,Input as Oe,LoadingSpinner as Le,Popover as Pe,PopupMenu as $e,PopupMenuDivider as Be,PopupMenuItem as Ue,confirmDestructive as Ke,registerModalEscapeInterceptor as He,toDateKey as We,toast as Xe,useContextMenu as Ve}from"efficient-shell/ui";import{SPREADSHEET_PREVIEW_UPDATE_EVENT as Ge,peekSpreadsheetPreviewStage as Ye,claimSpreadsheetPreviewStage as je}from"efficient-shell/apps";import{forwardRef as _e,useCallback as Ze,useEffect as Qe,useImperativeHandle as Je,useMemo as qe,useRef as et,useState as tt}from"react";import{Icon as rt}from"efficient-shell/icons";import{jsx as nt,jsxs as ot}from"react/jsx-runtime";var lt,at=46,it=24,ct=4/3;function st(e,t){const r=new Float64Array(e+1);for(let n=0;n<e;n++)r[n+1]=r[n]+t(n);return r}function ut(e,t){let r=0,n=e.length-2;for(;r<n;){const o=r+n+1>>1;e[o]<=t?r=o:n=o-1}return r}function dt(e,t){if(void 0===lt)try{lt=document.createElement("canvas").getContext("2d")}catch{lt=null}const r=(t?.fontSize??d)*ct;return lt?(lt.font=`${t?.italic?"italic ":""}${t?.bold?"bold ":""}${r}px system-ui, sans-serif`,lt.measureText(e).width):e.length*r*.55}var ft=_e(function({sheet:e,sheetIndex:t,evaluator:r,filterHidden:n,selection:o,showGridlines:l,showFormulas:a,clipRange:i,highlights:s,pointing:h,onSelect:m,onPoint:g,onEdit:p,onFill:v,onResizeCol:w,onResizeRow:x,onAutoFitCol:y,onAutoFitRow:C,onHeaderMenu:N,onFilterButton:D,renderEditor:S,onKeyDown:R,onCopy:M,onCut:T,onPaste:E},A){const F=c(),I=et(null),[O,P]=tt({x:0,y:0}),[$,B]=tt({width:1e3,height:600}),[U,H]=tt(null),[W,X]=tt(null),[G,Y]=tt(null);Qe(()=>{const e=I.current;if(!e)return;const t=()=>{e.clientWidth&&e.clientHeight&&B({width:e.clientWidth,height:e.clientHeight})};if(t(),"undefined"==typeof ResizeObserver)return;const r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[]);const j=qe(()=>{const n=new Map;for(const[o,l]of Object.entries(e.formats)){if(!l.fontSize&&!l.wrap)continue;const[a,i]=o.split(":").map(Number);if(void 0!==e.rowHeights[a])continue;const c=(l.fontSize??d)*ct*1.4;let s=1;if(l.wrap&&""!==J(e,a,i)){const n=(e.colWidths[i]??u)-8;s=b(e,t,r,a,i).text.split("\n").reduce((e,t)=>e+Math.max(1,Math.ceil(dt(t,l)/Math.max(n,1))),0)}const h=Math.ceil(c*s+6);h>(n.get(a)??f)&&n.set(a,h)}return n},[e,t,r]),_=qe(()=>new Set(e.hiddenRows),[e.hiddenRows]),Z=qe(()=>new Set(e.hiddenCols),[e.hiddenCols]),Q=qe(()=>st(e.rowCount,t=>_.has(t)||n.has(t)?0:W?.row===t?W.height:e.rowHeights[t]??j.get(t)??f),[e.rowCount,e.rowHeights,_,n,j,W]),q=qe(()=>st(e.colCount,t=>Z.has(t)?0:U?.col===t?U.width:e.colWidths[t]??u),[e.colCount,e.colWidths,Z,U]),ee=Math.min(e.frozenRows,e.rowCount),te=Math.min(e.frozenCols,e.colCount),re=Q[ee],ne=q[te],oe=q[e.colCount],le=Q[e.rowCount],ae=Ze(e=>at+q[e]-(e>=te?O.x:0),[q,te,O.x]),ie=Ze(e=>it+Q[e]-(e>=ee?O.y:0),[Q,ee,O.y]),ce=Ze(e=>{const t=I.current;if(!t)return;const r=t.clientWidth-at-ne,n=t.clientHeight-it-re;let{scrollLeft:o,scrollTop:l}=t;if(e.col>=te){const t=q[e.col]-ne,n=q[e.col+1]-ne;t<o?o=t:n>o+r&&(o=n-r)}if(e.row>=ee){const t=Q[e.row]-re,r=Q[e.row+1]-re;t<l?l=t:r>l+n&&(l=r-n)}t.scrollTo(o,l)},[q,Q,ne,re,te,ee]);Je(A,()=>({focus:()=>I.current?.focus({preventScroll:!0}),scrollTo:ce,measureColumn:n=>{let o=0;for(let l=0;l<e.cells.length;l++){if(""===J(e,l,n))continue;const a=e.formats[L(l,n)];o=Math.max(o,dt(b(e,t,r,l,n).text,a))}return Math.ceil(o+8+4)}}),[ce,e,t,r]);const se=Ze((e,t)=>{const r=I.current.getBoundingClientRect(),n=e-r.left-at,o=t-r.top-it,l=n<ne?n:n+I.current.scrollLeft,a=o<re?o:o+I.current.scrollTop;return{row:ut(Q,Math.max(0,Math.min(a,le-1))),col:ut(q,Math.max(0,Math.min(l,oe-1)))}},[q,Q,ne,re,oe,le]),ue=Ze((e,t)=>{const r=I.current,n=t=>{const n=r.getBoundingClientRect();t.clientY>n.bottom-4?r.scrollBy(0,24):t.clientY<n.top+it&&r.scrollBy(0,-24),t.clientX>n.right-4?r.scrollBy(24,0):t.clientX<n.left+at&&r.scrollBy(-24,0),e(t)},o=e=>{window.removeEventListener("pointermove",n),window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",o),t(e)};window.addEventListener("pointermove",n),window.addEventListener("pointerup",o),window.addEventListener("pointercancel",o)},[]),de=Ze((t,r)=>{const n=z(e,V(t,r));m({active:t,range:n})},[e,m]),fe=Math.max(0,$.width-at-ne),he=Math.max(0,$.height-it-re),me=ut(Q,re+O.y),ge=ut(q,ne+O.x),pe=Math.min(e.rowCount-1,ut(Q,re+O.y+he)),ve=Math.min(e.colCount-1,ut(q,ne+O.x+fe)),we=(n,o,i,c)=>{const s=[],u=[],f=new Set,h=(n,o,i)=>{const c=L(n,o);if(f.has(c))return;f.add(c);const h=i?i.r2:n,m=i?i.c2:o,g=q[o],p=Q[n],v=q[m+1]-g,w=Q[h+1]-p;if(v<=0||w<=0)return;const x=e.formats[c],y=J(e,n,o),C=a&&"="===y[0]?{text:y,color:null,align:"left",error:!1}:b(e,t,r,n,o),k=x?.border,N="1px solid var(--ink)",D=!!x?.fill||!!k||!!i,S=l?"1px solid var(--line-subtle)":"1px solid transparent",R={position:"absolute",left:g,top:p,width:v,height:w,boxSizing:"border-box",borderRight:k?.right?N:S,borderBottom:k?.bottom?N:S,borderTop:k?.top?N:void 0,borderLeft:k?.left?N:void 0,background:x?.fill??(i?"var(--surface)":void 0)};if((D||l)&&s.push(nt("div",{style:R},`b${c}`)),!C.text)return;const M=x?.align??C.align;let T=C.text;"string"==typeof T&&!C.error&&"right"===C.align&&!x?.wrap&&dt(T,x)>v-4&&(T="#".repeat(Math.max(1,Math.floor(v/8))));let E=v,A=0;if(!i&&!x?.wrap&&"left"===C.align&&dt(T,x)>v-8){if("left"===M||"center"===M)for(let t=o+1;t<=Math.min(o+40,e.colCount-1)&&(""===J(e,n,t)&&!K(e,n,t));t++)E+=q[t+1]-q[t];if("right"===M||"center"===M)for(let t=o-1;t>=Math.max(o-40,0)&&(""===J(e,n,t)&&!K(e,n,t));t--)A+=q[t+1]-q[t]}const z=x?.vAlign??"bottom",F=C.error?"var(--danger-text)":C.color??x?.color;u.push(nt("div",{"data-cell":c,className:"pointer-events-none",style:{position:"absolute",left:g-A,top:p,width:E+A,height:w,boxSizing:"border-box",padding:"0 4px",overflow:"hidden",display:"flex",alignItems:"top"===z?"flex-start":"middle"===z?"center":"flex-end",justifyContent:x?.wrap?void 0:"right"===M?"flex-end":"center"===M?"center":"flex-start",textAlign:M,whiteSpace:x?.wrap?"pre-wrap":"pre",wordBreak:x?.wrap?"break-word":void 0,fontSize:(x?.fontSize??d)*ct,lineHeight:1.3,paddingBottom:"bottom"===z?2:void 0,fontWeight:x?.bold?700:void 0,fontStyle:x?.italic?"italic":void 0,textDecoration:[x?.underline?"underline":"",x?.strike?"line-through":""].join(" ").trim()||void 0,color:F},children:nt("span",{style:x?.wrap?{width:"100%"}:void 0,children:T})},`t${c}`))};for(let t=n;t<=o;t++)for(let r=i;r<=c;r++){const n=K(e,t,r);(!n||n.r1===t&&n.c1===r)&&h(t,r,n)}for(const t of e.merges)(t.r1<n||t.c1<i)&&t.r2>=n&&t.r1<=o&&t.c2>=i&&t.c1<=c&&h(t.r1,t.c1,t);return[...s,...u]},be=(t,r,n,l)=>{const a=[],c=(e,o,i,c)=>{e.r2<t||e.r1>r||e.c2<n||e.c1>l||a.push(nt("div",{style:{position:"absolute",boxSizing:"border-box",pointerEvents:"none",left:q[e.c1],top:Q[e.r1],width:q[e.c2+1]-q[e.c1],height:Q[e.r2+1]-Q[e.r1],...i},children:c},o))},u=o.range,d=u.r1!==u.r2||u.c1!==u.c2,f=K(e,o.active.row,o.active.col),h=!!f&&f.r1===u.r1&&f.r2===u.r2&&f.c1===u.c1&&f.c2===u.c2;return c(u,"sel",{background:d&&!h?"color-mix(in srgb, var(--accent-fill) 12%, transparent)":void 0,border:"2px solid var(--accent-fill)"}),G&&c(G,"fill",{border:"1px dashed var(--ink-muted)"}),i&&c(i,"clip",{border:"2px dashed var(--accent-fill)"}),s.forEach((e,t)=>c(e.range,`ref${t}`,{border:`2px solid ${e.color}`,background:`color-mix(in srgb, ${e.color} 10%, transparent)`})),a},xe=[];ee&&te&&xe.push({key:"corner",left:at,top:it,width:ne,height:re,offsetX:0,offsetY:0,r1:0,r2:ee-1,c1:0,c2:te-1}),ee&&xe.push({key:"top",left:at+ne,top:it,width:fe,height:re,offsetX:O.x,offsetY:0,r1:0,r2:ee-1,c1:ge,c2:ve}),te&&xe.push({key:"left",left:at,top:it+re,width:ne,height:he,offsetX:0,offsetY:O.y,r1:me,r2:pe,c1:0,c2:te-1}),xe.push({key:"main",left:at+ne,top:it+re,width:fe,height:he,offsetX:O.x,offsetY:O.y,r1:me,r2:pe,c1:ge,c2:ve});const ye=o.range,Ce=[];for(let e=0;e<te;e++)Ce.push(e);for(let e=ge;e<=ve;e++)Ce.push(e);const ke=[];for(let e=0;e<ee;e++)ke.push(e);for(let e=me;e<=pe;e++)ke.push(e);const Ne=0===ye.r1&&ye.r2===e.rowCount-1,De=0===ye.c1&&ye.c2===e.colCount-1,Se="absolute flex items-center justify-center select-none text-xs border-r border-b border-line",Re="bg-accent-tint text-accent-text",Me="bg-surface-sunken text-ink-muted",Te=ye.r2<ee||ye.r2>=me,Ee=ae(ye.c2+1),Ae=ie(ye.r2+1),ze=Te&&!h&&Ee>=at&&Ae>=it&&Ee<=$.width&&Ae<=$.height,Fe=K(e,o.active.row,o.active.col)??{r1:o.active.row,c1:o.active.col,r2:o.active.row,c2:o.active.col},Ie={x:ae(Fe.c1),y:ie(Fe.r1),width:q[Fe.c2+1]-q[Fe.c1],height:Q[Fe.r2+1]-Q[Fe.r1],viewportWidth:$.width,viewportHeight:$.height},{filter:Oe}=e,Le=Oe?.range.r1??-1,Pe=[];if(Oe&&(Le<ee||Le>=me&&Le<=pe))for(let e=Oe.range.c1;e<=Oe.range.c2;e++)q[e+1]>q[e]&&(e<te||e>=ge&&e<=ve)&&Pe.push(e);return nt("div",{ref:I,tabIndex:0,role:"grid","aria-label":e.name,"aria-rowcount":e.rowCount,"aria-colcount":e.colCount,className:"relative h-full w-full overflow-auto outline-none bg-surface text-ink",onScroll:e=>P({x:e.currentTarget.scrollLeft,y:e.currentTarget.scrollTop}),onKeyDown:R,onCopy:M,onCut:T,onPaste:E,children:nt("div",{style:{width:at+oe,height:it+le},children:ot("div",{className:"sticky top-0 left-0 overflow-hidden",style:{width:$.width,height:$.height},children:[ot("div",{className:"absolute inset-0",onPointerDown:t=>{if(0!==t.button)return;const r=se(t.clientX,t.clientY);if(h)return t.preventDefault(),g(V(r,r),!1),void ue(e=>g(V(r,se(e.clientX,e.clientY)),!1),e=>g(V(r,se(e.clientX,e.clientY)),!0));if(I.current?.focus({preventScroll:!0}),t.detail>=2)return t.preventDefault(),void p(r);const n=t.shiftKey?o.active:K(e,r.row,r.col)?{row:K(e,r.row,r.col).r1,col:K(e,r.row,r.col).c1}:r;de(n,r),ue(e=>de(n,se(e.clientX,e.clientY)),()=>{})},onContextMenu:e=>N(e,"cell",se(e.clientX,e.clientY)),children:[xe.map(e=>nt("div",{className:"absolute overflow-hidden",style:{left:e.left,top:e.top,width:e.width,height:e.height},children:ot("div",{className:"absolute",style:{left:-e.offsetX,top:-e.offsetY,width:oe,height:le},children:[we(e.r1,e.r2,e.c1,e.c2),be(e.r1,e.r2,e.c1,e.c2)]})},e.key)),re>0&&nt("div",{className:"absolute bg-line-strong pointer-events-none",style:{left:0,right:0,top:it+re-1,height:2}}),ne>0&&nt("div",{className:"absolute bg-line-strong pointer-events-none",style:{top:0,bottom:0,left:at+ne-1,width:2}})]}),Pe.map(e=>{const t=ae(e+1),r=ie(Le),n=Q[Le+1]-Q[Le],o=(Oe?.excluded[e]?.length??0)>0;return nt("button",{type:"button","aria-label":F.filterColumn(k(e)),onClick:t=>{t.stopPropagation(),D(e,t.currentTarget.getBoundingClientRect())},onPointerDown:e=>e.stopPropagation(),className:`absolute flex items-center justify-center rounded border ${o?"":"border-line"} ${o?"border-accent-fill bg-accent-tint":"bg-surface hover:bg-surface-sunken"}`,style:{left:t-19,top:r+Math.max(0,(n-17)/2),width:17,height:17},children:nt(rt,{name:"filter",size:11})},e)}),ze&&nt("div",{"aria-label":F.fillHandle,className:"absolute bg-accent-fill border border-surface cursor-crosshair",style:{left:Ee-5,top:Ae-5,width:8,height:8},onPointerDown:e=>{e.preventDefault(),e.stopPropagation();const t=o.range;let r=null;ue(e=>{r=(e=>{const r=se(e.clientX,e.clientY);return(r.row>t.r2?r.row-t.r2:r.row<t.r1?t.r1-r.row:0)>=(r.col>t.c2?r.col-t.c2:r.col<t.c1?t.c1-r.col:0)?{...t,r1:Math.min(t.r1,r.row),r2:Math.max(t.r2,r.row)}:{...t,c1:Math.min(t.c1,r.col),c2:Math.max(t.c2,r.col)}})(e),Y(r)},()=>{Y(null),!r||r.r1===t.r1&&r.r2===t.r2&&r.c1===t.c1&&r.c2===t.c2||v(r)})}}),nt("div",{className:"absolute top-0 overflow-hidden bg-surface-sunken",style:{left:at,right:0,height:it},children:Ce.map(t=>{const r=q[t+1]-q[t];if(r<=0)return null;const n=q[t]-(t>=te?O.x:0),l=t>=ye.c1&&t<=ye.c2;return ot("div",{className:`${Se} ${l?Re:Me} ${l&&Ne?"font-semibold":""}`,style:{left:n,top:0,width:r,height:it},onPointerDown:r=>((t,r)=>{if(0!==t.button)return;I.current?.focus({preventScroll:!0});const n=t.shiftKey?o.active.col:r,l=t=>{const r={r1:0,c1:Math.min(n,t),r2:e.rowCount-1,c2:Math.max(n,t)};m({active:{row:0,col:n},range:r})};l(r),ue(e=>l(se(e.clientX,e.clientY).col),()=>{})})(r,t),onContextMenu:e=>N(e,"col",{row:0,col:t}),children:[k(t),nt("div",{className:"absolute top-0 bottom-0 cursor-col-resize",style:{right:-3,width:7},onPointerDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation();const r=e.clientX,n=q[t+1]-q[t],o=e=>Math.max(16,Math.round(n+e.clientX-r));ue(e=>H({col:t,width:o(e)}),e=>{H(null),o(e)!==n&&w(t,o(e))})})(e,t),onDoubleClick:e=>{e.stopPropagation(),y(t)}})]},t)})}),nt("div",{className:"absolute left-0 overflow-hidden bg-surface-sunken",style:{top:it,bottom:0,width:at},children:ke.map(t=>{const r=Q[t+1]-Q[t];if(r<=0)return null;const n=Q[t]-(t>=ee?O.y:0),l=t>=ye.r1&&t<=ye.r2;return ot("div",{className:`${Se} ${l?Re:Me} ${l&&De?"font-semibold":""}`,style:{left:0,top:n,width:at,height:r},onPointerDown:r=>((t,r)=>{if(0!==t.button)return;I.current?.focus({preventScroll:!0});const n=t.shiftKey?o.active.row:r,l=t=>{const r={r1:Math.min(n,t),c1:0,r2:Math.max(n,t),c2:e.colCount-1};m({active:{row:n,col:0},range:r})};l(r),ue(e=>l(se(e.clientX,e.clientY).row),()=>{})})(r,t),onContextMenu:e=>N(e,"row",{row:t,col:0}),children:[t+1,nt("div",{className:"absolute left-0 right-0 cursor-row-resize",style:{bottom:-3,height:7},onPointerDown:e=>((e,t)=>{e.preventDefault(),e.stopPropagation();const r=e.clientY,n=Q[t+1]-Q[t],o=e=>Math.max(12,Math.round(n+e.clientY-r));ue(e=>X({row:t,height:o(e)}),e=>{X(null),o(e)!==n&&x(t,o(e))})})(e,t),onDoubleClick:e=>{e.stopPropagation(),C(t)}})]},t)})}),nt("div",{role:"button","aria-label":F.selectAll,className:`${Se} top-0 left-0 cursor-pointer bg-surface-sunken hover:bg-line`,style:{width:at,height:it},onPointerDown:t=>{t.preventDefault(),I.current?.focus({preventScroll:!0}),m({active:{row:0,col:0},range:{r1:0,c1:0,r2:e.rowCount-1,c2:e.colCount-1}})},onContextMenu:e=>N(e,"corner",{row:0,col:0})}),S?.(Ie)]})})})}),ht=["#000000","#434343","#666666","#999999","#cccccc","#efefef","#ffffff","#c00000","#ff0000","#ffc000","#ffff00","#92d050","#00b050","#00b0f0","#0070c0","#002060","#7030a0","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#c9daf8","#d9d2e9","#ead1dc"],mt=["#1a73e8","#d93025","#7b1fa2","#188038","#e37400","#c5221f"];function gt(e,t){let r=!1;for(let n=0;n<t;n++)'"'===e[n]&&(r=!r);return r}function pt(e,t){if("="!==e[0]||gt(e,t))return null;const r=/[A-Za-z][A-Za-z0-9.]*$/.exec(e.slice(0,t));if(!r)return null;if("!"===e[r.index-1]||"("===e[t])return null;const n=r[0].toUpperCase(),o=h.filter(e=>e.startsWith(n));return o.length?{start:r.index,prefix:n,matches:o.slice(0,8)}:null}var vt={ABS:"value",AND:"condition1, [condition2, ...]",AVERAGE:"value1, [value2, ...]",AVERAGEIF:"range, criterion, [average_range]",AVERAGEIFS:"average_range, range1, criterion1, ...",CEILING:"value, [factor]","CEILING.MATH":"value, [factor]",CHOOSE:"index, choice1, [choice2, ...]",COLUMN:"[cell]",COLUMNS:"range",CONCAT:"value1, [value2, ...]",CONCATENATE:"value1, [value2, ...]",COS:"angle",COUNT:"value1, [value2, ...]",COUNTA:"value1, [value2, ...]",COUNTBLANK:"range",COUNTIF:"range, criterion",COUNTIFS:"range1, criterion1, ...",DATE:"year, month, day",DATEDIF:"start, end, unit",DAY:"date",DAYS:"end, start",EDATE:"start, months",EOMONTH:"start, months",EXACT:"text1, text2",EXP:"value",FIND:"find, within, [start]",FLOOR:"value, [factor]","FLOOR.MATH":"value, [factor]",FV:"rate, periods, payment, [present], [type]",HLOOKUP:"key, range, row, [approximate]",HOUR:"time",IF:"condition, if_true, [if_false]",IFERROR:"value, [if_error]",IFNA:"value, [if_na]",IFS:"condition1, value1, ...",INDEX:"range, row, [column]",INT:"value",ISBLANK:"value",ISERROR:"value",ISLOGICAL:"value",ISNA:"value",ISNUMBER:"value",ISTEXT:"value",LARGE:"range, k",LEFT:"text, [count]",LEN:"text",LN:"value",LOG:"value, [base]",LOG10:"value",LOWER:"text",MATCH:"key, range, [type]",MAX:"value1, [value2, ...]",MEDIAN:"value1, [value2, ...]",MID:"text, start, count",MIN:"value1, [value2, ...]",MINUTE:"time",MOD:"value, divisor",MODE:"value1, [value2, ...]","MODE.SNGL":"value1, [value2, ...]",MONTH:"date",N:"value",NA:"",NETWORKDAYS:"start, end, [holidays]",NOT:"condition",NOW:"",NPV:"rate, value1, [value2, ...]",OR:"condition1, [condition2, ...]",PI:"",PMT:"rate, periods, present, [future], [type]",POWER:"value, exponent",PRODUCT:"value1, [value2, ...]",PROPER:"text",PV:"rate, periods, payment, [future], [type]",RAND:"",RANDBETWEEN:"low, high",RANK:"value, range, [ascending]","RANK.EQ":"value, range, [ascending]",REPLACE:"text, start, count, new",REPT:"text, count",RIGHT:"text, [count]",ROUND:"value, [places]",ROUNDDOWN:"value, [places]",ROUNDUP:"value, [places]",ROW:"[cell]",ROWS:"range",SEARCH:"find, within, [start]",SECOND:"time",SIGN:"value",SIN:"angle",SMALL:"range, k",SQRT:"value",STDEV:"value1, [value2, ...]","STDEV.P":"value1, [value2, ...]","STDEV.S":"value1, [value2, ...]",STDEVP:"value1, [value2, ...]",SUBSTITUTE:"text, find, new, [occurrence]",SUM:"value1, [value2, ...]",SUMIF:"range, criterion, [sum_range]",SUMIFS:"sum_range, range1, criterion1, ...",SUMPRODUCT:"range1, [range2, ...]",SWITCH:"value, case1, result1, ..., [default]",TAN:"angle",TEXT:"value, format",TEXTJOIN:"delimiter, skip_blank, value1, ...",TIME:"hour, minute, second",TODAY:"",TRIM:"text",TRUNC:"value, [places]",UPPER:"text",VALUE:"text",VAR:"value1, [value2, ...]","VAR.P":"value1, [value2, ...]","VAR.S":"value1, [value2, ...]",VARP:"value1, [value2, ...]",VLOOKUP:"key, range, column, [approximate]",WEEKDAY:"date, [type]",XLOOKUP:"key, lookup_range, result_range, [if_not_found], [match_mode]",XOR:"condition1, [condition2, ...]",YEAR:"date"};import{Fragment as wt,jsx as bt,jsxs as xt}from"react/jsx-runtime";var yt=[8,9,10,11,12,14,16,18,20,24,28,36],Ct="undefined"!=typeof navigator&&/Mac|iPhone|iPad/.test(navigator.platform),kt=Ct?"⌘":"Ctrl+";function Nt(e,t,r){const n=URL.createObjectURL(new Blob([e],{type:t})),o=document.createElement("a");o.href=n,o.download=r,o.click(),URL.revokeObjectURL(n)}var Dt=o;function St({spreadsheetId:t,onClose:r}){const n=c(),{store:o,canCreate:a=!0,canDelete:i=!0,chooseFile:u}=s(),[d]=be(()=>null!=Ye()),[f,h]=be(null),[m,g]=be(null);if(!o||d)return bt(Et,{onClose:r});if(t)return bt(Mt,{store:o,id:t,onClose:r});if(f?.id)return bt(Mt,{store:o,id:f.id,onClose:()=>h(null)},f.key);if(f?.file)return bt(Et,{initialFile:f.file,hasStore:!0,onClose:()=>h(null)},f.key);return bt(he,{words:{windowTitle:n.filesHeading,heading:n.filesHeading,newFile:n.newFile,emptyTitle:n.filesEmptyTitle,emptyBody:n.filesEmptyBody,deleteConfirm:n.deleteConfirm,createFailed:n.createFailed,deleteFailed:n.deleteFailed},files:n.files,list:o.list,create:()=>o.create(n.untitled),rename:o.rename,remove:o.remove,canCreate:a,canDelete:i,accept:Dt,choose:u&&{run:u,request:{title:n.files.choosing(n.fileKind,n.filesHeading),extensions:l}},onOpen:e=>h({key:Date.now(),id:e}),onOpenFile:(t,r)=>{m||(g(n.files.opening(t.name)),e(o,t).then(async e=>{const o=await me(r,e.id);Xe.success(n.files.savedCopy(e.title,t.name,o?r?.location:void 0)),h({key:Date.now(),id:e.id})}).catch(()=>Xe.error(n.files.openFailed(t.name))).finally(()=>g(null)))},busy:m})}function Rt({id:e,onClose:t}){return bt(St,{spreadsheetId:e,onClose:t})}function Mt({store:e,id:t,onClose:r,pane:n}){const o=c(),[l,a]=be(null),[i,s]=be(!1),u=ge(()=>{s(!1),e.get(t).then(e=>a(t=>({kept:e,nonce:(t?.nonce??0)+1})),()=>s(!0))},[t,e]);return pe(u,[u]),i?bt("div",{className:"office-open-failed",children:bt(Fe,{title:o.storedOpenFailed,children:r&&bt(Me,{onClick:r,children:o.backToFiles})})}):l?bt(Et,{stored:{store:e,...l.kept},onClose:r,onReload:u,pane:n},l.nonce):bt(Le,{size:"sm",padding:"",className:"h-full",label:o.loading})}function Tt({initial:e,spreadsheetId:t,bridge:r,onSaveToFiles:n}){const{store:o}=s(),l=ve(()=>({bridge:r,onSaveToFiles:n}),[r,n]);return o&&t?bt(Mt,{store:o,id:t,pane:l}):bt(Et,{initial:e??{rows:[],filename:""},pane:l})}function Et({stored:e,initialFile:o,hasStore:l,onClose:s,onReload:u,initial:f,pane:h}){const b=c(),k=we(void 0);void 0===k.current&&(k.current=e?null:f?{token:-1,data:f}:Ye());const he=we(k.current?.data??null),[me]=be(()=>{const e=k.current;if(!e)return null;const t=At(e.data,b.sheetName(1));return t?{sheet:t,title:e.data.filename.replace(/\.(csv|tsv|txt)$/i,"")}:-1===e.token&&e.data.filename?{sheet:W(b.sheetName(1)),title:e.data.filename}:null}),[Fe,Le]=be(()=>e?i(e.workbook,b.sheetName(1)):me?[me.sheet]:[W(b.sheetName(1))]),[_e,Ze]=be(0),[Qe,Je]=be(e?.title??me?.title??b.untitled),[qe,et]=be(()=>k.current?.data.onEmail),tt=we(Fe),rt=we([]),nt=we([]),[,ot]=be(0),lt=ge(e=>{const t=tt.current,r=e(t);r!==t&&(rt.current.push(t),rt.current.length>100&&rt.current.shift(),nt.current=[],tt.current=r,Le(r),ot(e=>e+1))},[]),at=ge(e=>{rt.current=[],nt.current=[],tt.current=e,Le(e),Ze(0),ot(e=>e+1)},[]),it=ge(()=>{const e=rt.current.pop();e&&(nt.current.push(tt.current),tt.current=e,Le(e),Ze(t=>Math.min(t,e.length-1)),ot(e=>e+1))},[]),ct=ge(()=>{const e=nt.current.pop();e&&(rt.current.push(tt.current),tt.current=e,Le(e),Ze(t=>Math.min(t,e.length-1)),ot(e=>e+1))},[]),st=we(Fe),ut=we(e?.version??""),dt=we(e?.title??""),[St,Rt]=be(!1),Mt=ke(),Tt=ye({save:async t=>{e&&(ut.current=await e.store.save(e.id,{sheets:t},ut.current))},onFailure:(e,t)=>{e instanceof a?(Tt.stop(),Rt(!0)):0===t&&Xe.error(b.saveFailed)}}),{push:Et,flush:zt}=Tt,Ft=we(Fe);pe(()=>{e&&Fe!==Ft.current&&(Ft.current=Fe,Et(Fe))},[Et,Fe,e]),pe(()=>()=>{zt()},[zt]),Se(e?Tt.state.pending||St:Fe!==st.current);const It=ge(e=>{const t=At(e,b.sheetName(1));t&&(at([t]),st.current=tt.current,Je(e.filename.replace(/\.(csv|tsv|txt)$/i,"")),et(()=>e.onEmail))},[at,b]);pe(()=>{const e=k.current;null!=e&&(je(e),e.data!==he.current&&It(e.data))},[]),pe(()=>{const e=k.current?.token;if(null==e)return;const t=t=>{const r=t.detail;r&&r.token===e&&It(r.data)};return window.addEventListener(Ge,t),()=>window.removeEventListener(Ge,t)},[]);const Ot=Math.min(_e,Fe.length-1),Lt=Fe[Ot],Pt=ve(()=>B(Fe),[Fe]),$t=ve(()=>I(Lt,Ot,Pt),[Lt,Ot,Pt]),Bt=we(null),Ut=we(null),[Kt,Ht]=be({}),Wt=Kt[Lt.id]??{active:{row:0,col:0},range:{r1:0,c1:0,r2:0,c2:0}},Xt=we(_e);Xt.current=_e;const Vt=ge(e=>{Ht(t=>({...t,[tt.current[Math.min(Xt.current,tt.current.length-1)].id]:e}))},[]),Gt=Wt.active,Yt=Lt.formats[L(Gt.row,Gt.col)]??{},jt=J(Lt,Gt.row,Gt.col),[_t,Zt]=be(null),Qt=we(_t);Qt.current=_t;const[Jt,qt]=be(null),[er,tr]=be(!0),[rr,nr]=be(!1),[or,lr]=be(null),[ar,ir]=be(null),[cr,sr]=be(!1),[ur,dr]=be(null),[fr,hr]=be(null),[mr,gr]=be(!1),[pr,vr]=be(""),[wr,br]=be(""),[xr,yr]=be({matchCase:!1,wholeCell:!1,inFormulas:!1}),Cr=we(null),kr=we(null),Nr=we(null),Dr=Ve(),Sr=Ve(),Rr=ge(()=>{Bt.current?.focus(),setTimeout(()=>{const e=document.activeElement;e&&e!==document.body&&!e.closest("[aria-haspopup]")||Bt.current?.focus()},0)},[]),Mr=ge(e=>{lt(t=>{const r=Math.min(Xt.current,t.length-1),n=e(t[r]);return n===t[r]?t:t.map((e,t)=>t===r?n:e)})},[lt]),Tr=we(null),Er=we(()=>!1);pe(()=>He(()=>!!Tr.current?.contains(document.activeElement)&&Er.current()),[]);const Ar=ge(e=>Lt.hiddenRows.includes(e)||$t.has(e),[Lt.hiddenRows,$t]),zr=ge(e=>Lt.hiddenCols.includes(e),[Lt.hiddenCols]),Fr=ge(e=>{const t=K(Lt,e.row,e.col),r=t??{r1:e.row,c1:e.col,r2:e.row,c2:e.col};Vt({active:t?{row:t.r1,col:t.c1}:e,range:r}),Bt.current?.scrollTo(e)},[Lt,Vt]),Ir=ge((e,t,r)=>{let{row:n,col:o}=e;const l=K(Lt,n,o);l&&(t>0&&(n=l.r2),t<0&&(n=l.r1),r>0&&(o=l.c2),r<0&&(o=l.c1));do{n+=t,o+=r}while(n>=0&&n<Lt.rowCount&&o>=0&&o<Lt.colCount&&(Ar(n)||zr(o)));return n<0||n>=Lt.rowCount||o<0||o>=Lt.colCount?e:{row:n,col:o}},[Lt,Ar,zr]),Or=ge((e,t,r)=>{const n=e=>""!==J(Lt,e.row,e.col);let o=e,l=Ir(o,t,r);if(l===o)return o;if(n(o)&&n(l)){for(;n(l);)if(o=l,l=Ir(o,t,r),l===o)return o;return o}for(;!n(l);)if(o=l,l=Ir(o,t,r),l===o)return o;return l},[Lt,Ir]),Lr=ge(e=>{const t=z(Lt,V(Wt.active,e));Vt({active:Wt.active,range:t}),Bt.current?.scrollTo(e)},[Lt,Wt.active,Vt]),Pr=ge(()=>{const{range:e,active:t}=Wt;return{row:t.row===e.r1?e.r2:e.r1,col:t.col===e.c1?e.c2:e.c1}},[Wt]),$r=we(null),Br=ge((e,t={})=>{const r=J(Lt,e.row,e.col),n=t.text??A(r,Lt.formats[L(e.row,e.col)]);qt(e=>e?.cut?null:e),t.inBar||null!==$r.current||($r.current=n.length),Zt({sheetId:Lt.id,row:e.row,col:e.col,text:n,mode:t.mode??(void 0!==t.text?"enter":"edit"),inBar:!!t.inBar,caret:n.length,pick:null,suggestion:0})},[Lt]),Ur=ge(e=>{const t=Qt.current;if(!t)return!1;Qt.current=null,Zt(null),lt(r=>{const n=r.findIndex(e=>e.id===t.sheetId);if(n<0)return r;const o=r[n];if(t.text===A(J(o,t.row,t.col),o.formats[L(t.row,t.col)])&&!e)return r;let l=o;if(e)for(let r=e.r1;r<=e.r2;r++)for(let n=e.c1;n<=e.c2;n++){const e=$(t.text)?le(q(t.text).raw,r-t.row,n-t.col):t.text;l=D(l,r,n,e)}else l=D(l,t.row,t.col,t.text);return r.map((e,t)=>t===n?l:e)});const r=tt.current.findIndex(e=>e.id===t.sheetId);return r>=0&&r!==Xt.current&&Ze(r),!0},[lt]),Kr=ge(()=>{const e=Qt.current;if(Qt.current=null,Zt(null),e){const t=tt.current.findIndex(t=>t.id===e.sheetId);t>=0&&t!==Xt.current&&Ze(t)}Rr()},[Rr]),Hr=ge((e,t)=>{Fr(Ir(Wt.active,e,t)),Rr()},[Rr,Fr,Wt.active,Ir]);De(()=>{if(!_t)return;const e=_t.inBar?Cr.current:kr.current;e&&(document.activeElement!==e&&e.focus({preventScroll:!0}),null!==$r.current&&(e.setSelectionRange($r.current,$r.current),$r.current=null))},[_t]);const Wr=ge((e,t)=>{Zt(r=>r?{...r,text:e,caret:t,pick:null,suggestion:0}:r)},[]),Xr=_t?.sheetId===Lt.id,Vr=_t?pt(_t.text,_t.caret):null,Gr=_t?function(e,t){if("="!==e[0])return null;const r=[];let n=!1;for(let o=1;o<t;o++){const t=e[o];if('"'===t&&(n=!n),!n)if("("===t){const t=/([A-Za-z][A-Za-z0-9.]*)$/.exec(e.slice(1,o));r.push({name:t?t[1].toUpperCase():"",argIndex:0})}else")"===t?r.pop():","!==t&&";"!==t||!r.length||r[r.length-1].argIndex++}for(let e=r.length-1;e>=0;e--)if(r[e].name)return r[e];return null}(_t.text,_t.caret):null,Yr=!!_t&&(null!==_t.pick||function(e,t){if("="!==e[0]||gt(e,t))return!1;const r=e.slice(0,t).trimEnd(),n=e.slice(t).trimStart()[0];return!(void 0!==n&&!/[,;)+\-*/^&=<>%]/.test(n))&&/[=(,;+\-*/^&<>]$/.test(r)}(_t.text,_t.caret)),jr=ve(()=>_t?function(e,t,r,n,o){if("="!==e[0])return[];const l=[];let a=0;for(const i of ie(e.slice(1)).tokens){if("ref"!==i.type)continue;const e=mt[a++%mt.length];if(!(null===i.ref.sheet?r:i.ref.sheet.toLowerCase()===t.toLowerCase()))continue;const c=i.ref.b??i.ref.a,s=V({row:i.ref.a.row??0,col:i.ref.a.col??0},{row:c.row??n-1,col:c.col??o-1});l.push({range:s,color:e})}return l}(_t.text,Lt.name,Xr,Lt.rowCount,Lt.colCount):[],[_t,Lt.name,Lt.rowCount,Lt.colCount,Xr]),_r=ge((e,t)=>{const r=Qt.current;if(!r)return;const n=_({sheet:r.sheetId===tt.current[Xt.current].id?null:tt.current[Xt.current].name,a:{row:e.r1,col:e.c1,rowAbs:!1,colAbs:!1},b:e.r1===e.r2&&e.c1===e.c2?null:{row:e.r2,col:e.c2,rowAbs:!1,colAbs:!1}}),o=r.pick?.start??r.caret,l=r.pick?.end??r.caret,a=r.text.slice(0,o)+n+r.text.slice(l),i=o+n.length;$r.current=i,Zt({...r,text:a,caret:i,pick:t?null:{start:o,end:i}})},[]),Zr=ge(e=>{const t=Qt.current,r=t?pt(t.text,t.caret):null;if(!t||!r)return;const n=function(e,t,r,n){const o=`${n}(`;return{text:e.slice(0,r)+o+e.slice(t),caret:r+o.length}}(t.text,t.caret,r.start,e);$r.current=n.caret,Zt({...t,text:n.text,caret:n.caret,suggestion:0,pick:null})},[]),Qr=e=>{if(_t){if(e.stopPropagation(),Vr){if("ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=Vr.matches.length;return void Zt({..._t,suggestion:(_t.suggestion+("ArrowDown"===e.key?1:t-1))%t})}if("Tab"===e.key||"Enter"===e.key&&_t.suggestion>0)return e.preventDefault(),void Zr(Vr.matches[_t.suggestion])}if("Enter"===e.key){if(e.altKey){e.preventDefault();const{selectionStart:t,selectionEnd:r,value:n}=e.currentTarget,o=`${n.slice(0,t)}\n${n.slice(r)}`;return $r.current=t+1,void Wr(o,t+1)}return e.preventDefault(),e.ctrlKey||e.metaKey?(Ur(Wt.range),void Rr()):(Ur(),void Hr(e.shiftKey?-1:1,0))}if("Tab"===e.key)return e.preventDefault(),Ur(),void Hr(0,e.shiftKey?-1:1);if("F4"===e.key){e.preventDefault();const t=function(e,t){if("="!==e[0])return null;const r=t-1;for(const t of ie(e.slice(1)).tokens){if("ref"!==t.type||r<t.start||r>t.end)continue;const n={...t.ref,a:R(t.ref.a),b:t.ref.b?R(t.ref.b):null},o=_(n);return{text:`=${e.slice(1,t.start+1)}${o}${e.slice(t.end+1)}`,caret:t.start+1+o.length}}return null}(_t.text,e.currentTarget.selectionStart);return void(t&&($r.current=t.caret,Wr(t.text,t.caret)))}"enter"!==_t.mode||_t.inBar||$(_t.text)||!e.key.startsWith("Arrow")||(e.preventDefault(),Ur(),Hr("ArrowDown"===e.key?1:"ArrowUp"===e.key?-1:0,"ArrowRight"===e.key?1:"ArrowLeft"===e.key?-1:0))}},Jr=e=>{const t=e.currentTarget.selectionStart;Zt(e=>e&&e.caret!==t?{...e,caret:t,pick:null}:e)},qr=ge(e=>{Ur(),e(),Rr()},[Ur,Rr]),en=we(Wt);en.current=Wt;const tn=h?.bridge,rn=we(Qe);rn.current=Qe;const nn=Kt[Lt.id]?Wt:null,on=we(nn);on.current=nn,pe(()=>{if(tn)return tn.attach({sheets:()=>tt.current,activeSheet:()=>Math.min(Xt.current,tt.current.length-1),title:()=>rn.current||b.untitled,selection:()=>on.current?{sheet:Math.min(Xt.current,tt.current.length-1),range:on.current.range}:null,commit:e=>lt(()=>e),undoLast:it})},[tn,lt,b,it]),pe(()=>{tn?.changed()},[tn,nn,Ot,Fe,Qe]);const ln=ge(e=>{qr(()=>Mr(t=>se(t,en.current.range,e)))},[qr,Mr]),an=ge(e=>{const t=!Yt[e];ln(r=>de(r,e,t||void 0))},[Yt,ln]),cn=ge(e=>{ln(t=>de(t,"numFmt","General"===e?void 0:e))},[ln]),sn=ge(e=>{const t=Pt.value(Ot,Gt.row,Gt.col),r=v(Yt.numFmt??"General",e,"number"==typeof t?t:null);cn(r)},[Gt,Yt.numFmt,Pt,Ot,cn]),un=ge((e,t)=>{const{range:r}=Wt,[n,o]="row"===e?[r.r1,r.r2]:[r.c1,r.c2],l="row"===e?Lt.rowCount:Lt.colCount,a=o-n+1>=l?1:o-n+1;l+a>("row"===e?g:m)||qr(()=>lt(r=>y(r,Ot,e,t?o+1:n,a)))},[Lt.colCount,Lt.rowCount,lt,Ot,qr,Wt]),dn=ge(e=>{const{range:t}=Wt,[r,n]="row"===e?[t.r1,t.r2]:[t.c1,t.c2],o="row"===e?Lt.rowCount:Lt.colCount,l=Math.min(n-r+1,o-1);l<1||qr(()=>{lt(t=>y(t,Ot,e,r,-l)),Fr({row:"row"===e?Math.min(r,o-l-1):Wt.active.row,col:"col"===e?Math.min(r,o-l-1):Wt.active.col})})},[Lt.colCount,Lt.rowCount,lt,Ot,qr,Fr,Wt]),fn=ge(e=>{const{range:t}=Wt;qr(()=>Mr(r=>{if("row"===e){const e=new Set(r.hiddenRows);for(let r=t.r1;r<=t.r2;r++)e.add(r);return{...r,hiddenRows:[...e]}}const n=new Set(r.hiddenCols);for(let e=t.c1;e<=t.c2;e++)n.add(e);return{...r,hiddenCols:[...n]}}))},[qr,Wt,Mr]),hn=ge(e=>{qr(()=>Mr(t=>"row"===e?{...t,hiddenRows:[]}:{...t,hiddenCols:[]}))},[qr,Mr]),mn=ge(e=>{qr(()=>Mr(t=>{const r=Wt.range.r1===Wt.range.r2&&Wt.range.c1===Wt.range.c2,n=0===Wt.range.r1&&Wt.range.r2===t.rowCount-1;let o=r?M(t,Wt.range):Wt.range;return n&&(o={...o,r2:Math.max(o.r1,ue(t)?.row??0)}),t.filter&&Z(t.filter.range,Wt.active.row,Wt.active.col)&&(o={...t.filter.range,r1:t.filter.range.r1+1}),ae(t,Ot,Pt,o,Wt.active.col,e)}))},[Pt,Ot,qr,Wt,Mr]),gn=ge(()=>{ir(null),qr(()=>Mr(e=>{if(e.filter)return{...e,filter:null};const t=M(e,Wt.range);return t.r1===t.r2?e:{...e,filter:{range:t,excluded:{}}}}))},[qr,Wt.range,Mr]),pn=ge(()=>{qr(()=>Mr(e=>e.merges.some(e=>Z(Wt.range,e.r1,e.c1))?ce(e,Wt.range):U(e,Wt.range)))},[qr,Wt.range,Mr]),vn=ge((e,t)=>{qr(()=>Mr(r=>({...r,frozenRows:e??r.frozenRows,frozenCols:t??r.frozenCols})))},[qr,Mr]),wn=ge(e=>{const{range:t,active:r}=Wt,n=t.r1===t.r2&&t.c1===t.c2;let o="";if(n){const e=(e,t)=>"number"==typeof Pt.value(Ot,e,t);let t=r.row;for(;t>0&&e(t-1,r.col);)t--;let n=r.col;for(;n>0&&e(r.row,n-1);)n--;t<r.row?o=Q({r1:t,c1:r.col,r2:r.row-1,c2:r.col}):n<r.col&&(o=Q({r1:r.row,c1:n,r2:r.row,c2:r.col-1}))}else o=Q(t);const l=n?r:{row:t.r2+1,col:t.c1};Ur(),n||Fr(l);const a=`=${e}(${o})`;$r.current=a.length-1,Br(l,{text:a})},[Ur,Pt,Ot,Fr,Wt,Br]),bn=ge((e,t)=>{const r=Wt.range,n={...r,r2:Math.min(r.r2,Math.max(r.r1,Lt.cells.length-1))},o=S(Lt,Ot,Pt,n,e);qt(o),t?(t.preventDefault(),t.clipboardData.setData("text/plain",o.text)):navigator.clipboard?.writeText(o.text).catch(()=>{})},[Lt,Pt,Ot,Wt.range]),xn=ge((e,t)=>{const{range:r}=Wt;if(Jt&&Jt.text===e){if(Jt.cut){const e=tt.current.findIndex(e=>e.id===Jt.sheetId);if(e<0)return;let t=null;return lt(n=>{const o=H(n,e,Jt,Ot,r);return t=o.range,o.sheets}),t&&Vt({active:{row:t.r1,col:t.c1},range:t}),void qt(null)}return void Mr(e=>{const n=j(e,Jt,r,t);return Vt({active:Wt.active,range:n.range}),n.sheet})}if(!e)return;const n=function(e){const t=e.replace(/\r\n?/g,"\n").replace(/\n$/,"");if(!t.includes("\t")&&!t.includes("\n"))return[[t]];if(!t.includes('"'))return t.split("\n").map(e=>e.split("\t"));const r=G(t.includes("\t")?t:`${t}\t`);return r.length?r:[[t]]}(e);Mr(e=>{let t=e;n.forEach((e,n)=>e.forEach((e,o)=>{t=D(t,r.r1+n,r.c1+o,e)}));const o=n.reduce((e,t)=>Math.max(e,t.length),1);return Vt({active:Wt.active,range:{r1:r.r1,c1:r.c1,r2:r.r1+n.length-1,c2:r.c1+o-1}}),t})},[Jt,lt,Ot,Wt,Vt,Mr]),yn=ge(e=>{qr(()=>{const t=navigator.clipboard?.readText?.();t?t.then(t=>xn(t,e)).catch(()=>{Jt&&xn(Jt.text,e)}):Jt&&xn(Jt.text,e)})},[Jt,xn,qr]);Er.current=()=>Qt.current?(Kr(),!0):ar?(ir(null),Rr(),!0):ur?(dr(null),Rr(),!0):cr?(sr(!1),Rr(),!0):null!==fr?(hr(null),Rr(),!0):mr?(gr(!1),Rr(),!0):!(!Jt&&!or)&&(qt(null),lr(null),!0);const Cn=Qe||b.spreadsheetFile,kn=ge(async()=>{Ur();try{const e=tt.current;Nt(await n(e,B(e)),"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",`${Cn}.xlsx`),st.current=e,ot(e=>e+1)}catch{Xe.error(b.saveFailed)}},[Ur,Cn,b]),Nn=()=>{const e=tt.current,t=Math.min(Xt.current,e.length-1);return ne(e[t],t,B(e))},Dn=async n=>{const o=n.name.replace(/\.(csv|tsv|txt|xlsx|xls|ods)$/i,"");try{if(Ur(),/\.(xlsx|xls|ods)$/i.test(n.name)){const e=new Uint8Array(await n.arrayBuffer()),o=/\.xlsx$/i.test(n.name)&&"undefined"!=typeof DecompressionStream?await r(e):await t(e);lt(()=>o),Ze(0)}else{const e=G(await n.text());if(!e.length)return;Mr(t=>({...oe(t.name,e),id:t.id}))}e||Je(o)}catch{Xe.error(b.openFailed)}};pe(()=>{o&&Dn(o)},[]);const Sn=ve(()=>mr?O(Lt,Ot,Pt,pr,xr):[],[Lt,Pt,mr,xr,pr,Ot]),Rn=Sn.findIndex(e=>e.row===Wt.active.row&&e.col===Wt.active.col),Mn=e=>{if(!Sn.length)return;const t=Rn<0?e>0?0:Sn.length-1:(Rn+e+Sn.length)%Sn.length;Fr(Sn[t])},Tn=()=>{Ur();const e=Ot+1;lt(t=>{const r=X(t,b.sheetBase);return[...t.slice(0,e),W(r),...t.slice(e)]}),Ze(e),Rr()},En=()=>{if(!ur)return;const{index:e,name:t}=ur;dr(null);const r=t.trim();r&&r!==Fe[e]?.name&&(Fe.some((t,n)=>n!==e&&t.name.toLowerCase()===r.toLowerCase())?Xe.error(b.sheetNameTaken):lt(t=>ee(t,e,r)))},An=(e,t)=>{const r=e+t;r<0||r>=Fe.length||(lt(t=>{const n=[...t],[o]=n.splice(e,1);return n.splice(r,0,o),n}),e===Ot?Ze(r):r===Ot&&Ze(e))},zn=ge(e=>{Qt.current&&Ur(),Vt(e),or&&(Mr(t=>se(t,e.range,()=>or)),lr(null))},[Ur,or,Vt,Mr]),Fn=ge((e,t,r)=>{"cell"!==t||Z(Wt.range,r.row,r.col)?"col"!==t||0===Wt.range.r1&&Wt.range.r2===Lt.rowCount-1&&r.col>=Wt.range.c1&&r.col<=Wt.range.c2?"row"!==t||0===Wt.range.c1&&Wt.range.c2===Lt.colCount-1&&r.row>=Wt.range.r1&&r.row<=Wt.range.r2||Vt({active:{row:r.row,col:0},range:{r1:r.row,c1:0,r2:r.row,c2:Lt.colCount-1}}):Vt({active:{row:0,col:r.col},range:{r1:0,c1:r.col,r2:Lt.rowCount-1,c2:r.col}}):Fr(r),Dr.open(e,{kind:t,pos:r})},[Lt.colCount,Lt.rowCount,Dr,Fr,Wt.range,Vt]),In=ge((e,t)=>{if(!Lt.filter)return;const r=N(Lt,Ot,Pt,Lt.filter.range,e);ir({col:e,x:t.left,y:t.bottom+2,values:r,unticked:new Set(Lt.filter.excluded[e]??[]),search:""})},[Lt,Pt,Ot]),On=(e,t)=>{ir(null),qr(()=>Mr(r=>{if(!r.filter)return r;const{range:n}=r.filter;return ae(r,Ot,Pt,{...n,r1:n.r1+1},e,t)}))},Ln=ve(()=>{const{range:e}=Wt;return e.r1===e.r2&&e.c1===e.c2?null:re(Lt,Ot,Pt,e,$t)},[Lt,Pt,$t,Ot,Wt]),Pn=e=>P(Number(e.toPrecision(12)),Ln?.firstFormat??"#,##0.##").text,$n=(e,t)=>xt("span",{className:"flex w-full items-center justify-between gap-6",children:[bt("span",{children:e}),bt("span",{className:"text-xs text-ink-faint",children:t})]}),Bn=(e,t,r,n={})=>({key:e,label:t,onSelect:r,...n}),Un=e=>({type:"divider",key:e}),Kn=[{key:"general",label:b.formatGeneral,code:p.general},{key:"number",label:b.formatNumber,code:p.number},{key:"percent",label:b.formatPercent,code:p.percent},{key:"scientific",label:b.formatScientific,code:p.scientific},{key:"currency",label:b.formatCurrency,code:p.currency},{key:"date",label:b.formatDate,code:p.date},{key:"time",label:b.formatTime,code:p.time},{key:"dateTime",label:b.formatDateTime,code:p.dateTime},{key:"text",label:b.formatText,code:p.text}].map(e=>({type:"radio",key:e.key,label:e.label,checked:(Yt.numFmt??"General")===e.code,onSelect:()=>cn(e.code)})),Hn=[["all",b.bordersAll],["outer",b.bordersOuter],["top",b.bordersTop],["bottom",b.bordersBottom],["left",b.bordersLeft],["right",b.bordersRight],["none",b.bordersNone]].map(([e,t])=>Bn(e,t,()=>qr(()=>Mr(t=>w(t,Wt.range,e))))),Wn=[...["left","center","right"].map(e=>({type:"radio",key:e,label:"left"===e?b.alignLeft:"center"===e?b.alignCenter:b.alignRight,checked:Yt.align===e,onSelect:()=>ln(t=>de(t,"align",e))})),Un("v"),...["top","middle","bottom"].map(e=>({type:"radio",key:e,label:"top"===e?b.alignTop:"middle"===e?b.alignMiddle:b.alignBottom,checked:(Yt.vAlign??"bottom")===e,onSelect:()=>ln(t=>de(t,"vAlign",e))}))],Xn=yt.map(e=>({type:"radio",key:String(e),label:String(e),checked:(Yt.fontSize??d)===e,onSelect:()=>ln(t=>de(t,"fontSize",e===d?void 0:e))})),Vn=["SUM","AVERAGE","COUNT","MAX","MIN"].map(e=>Bn(e,e,()=>wn(e))),Gn=[...[0,1,2].map(e=>({type:"radio",key:`r${e}`,label:b.freezeRows(e),checked:Lt.frozenRows===e,onSelect:()=>vn(e,null)})),{type:"radio",key:"rUp",label:b.freezeUpToRow(Gt.row+1),checked:Lt.frozenRows===Gt.row+1&&Gt.row>1,onSelect:()=>vn(Gt.row+1,null)},Un("c"),...[0,1,2].map(e=>({type:"radio",key:`c${e}`,label:b.freezeColumns(e),checked:Lt.frozenCols===e,onSelect:()=>vn(null,e)})),{type:"radio",key:"cUp",label:b.freezeUpToColumn(x(0,Gt.col).replace(/\d+$/,"")),checked:Lt.frozenCols===Gt.col+1&&Gt.col>1,onSelect:()=>vn(null,Gt.col+1)}],Yn=[...e?[]:[Bn("new",b.menuNew,()=>qr(()=>{lt(()=>[W(b.sheetName(1))]),Ze(0),Je(b.untitled)}))],Bn("open",b.menuOpen,()=>Ut.current?.click()),Un("a"),Bn("xlsx",$n(b.saveExcel,`${kt}S`),()=>{kn()}),Bn("csv",b.saveCsv,()=>qr(()=>Nt(Nn(),"text/csv",`${Cn}.csv`))),...qe?[Un("b"),Bn("email",b.email,()=>qr(()=>qe(Nn(),`${Cn}.csv`)))]:[],...!e&&h?.onSaveToFiles?[Un("c"),Bn("keep",b.saveToFiles,()=>qr(()=>h.onSaveToFiles?.(Qe.trim()||b.untitled,tt.current)))]:[]],jn=[Bn("undo",$n(b.undo,`${kt}Z`),()=>qr(it),{disabled:0===rt.current.length}),Bn("redo",$n(b.redo,Ct?"⇧⌘Z":"Ctrl+Y"),()=>qr(ct),{disabled:0===nt.current.length}),Un("a"),Bn("cut",$n(b.cut,`${kt}X`),()=>qr(()=>bn(!0))),Bn("copy",$n(b.copy,`${kt}C`),()=>qr(()=>bn(!1))),Bn("paste",$n(b.paste,`${kt}V`),()=>yn("all")),Bn("pasteValues",b.pasteValues,()=>yn("values")),Bn("pasteFormats",b.pasteFormats,()=>yn("formats")),Un("b"),Bn("find",$n(b.findReplace,`${kt}F`),()=>{gr(!0),setTimeout(()=>Nr.current?.focus(),0)}),Bn("clear",$n(b.clearValues,"Delete"),()=>qr(()=>Mr(e=>C(e,Wt.range))))],_n=[{type:"submenu",key:"freeze",label:b.freeze,items:Gn},{type:"checkbox",key:"gridlines",label:b.gridlines,checked:er,onSelect:()=>tr(e=>!e)},{type:"checkbox",key:"formulas",label:$n(b.showFormulas,`${kt}\``),checked:rr,onSelect:()=>nr(e=>!e)}],Zn=[Bn("rowAbove",b.rowsAbove,()=>un("row",!1)),Bn("rowBelow",b.rowsBelow,()=>un("row",!0)),Bn("colLeft",b.columnsLeft,()=>un("col",!1)),Bn("colRight",b.columnsRight,()=>un("col",!0)),Un("a"),Bn("sheet",b.sheet,Tn),{type:"submenu",key:"fn",label:b.function,items:Vn}],Qn=[{type:"submenu",key:"number",label:b.number,items:Kn},Un("a"),Bn("bold",$n(b.bold,`${kt}B`),()=>an("bold")),Bn("italic",$n(b.italic,`${kt}I`),()=>an("italic")),Bn("underline",$n(b.underline,`${kt}U`),()=>an("underline")),Bn("strike",b.strikethrough,()=>an("strike")),{type:"submenu",key:"size",label:b.fontSize,items:Xn},Un("b"),{type:"submenu",key:"align",label:b.alignment,items:Wn},{type:"submenu",key:"borders",label:b.borders,items:Hn},Bn("wrap",b.wrapText,()=>an("wrap")),Bn("merge",b.mergeCells,pn),Un("c"),Bn("clearFormat",b.clearFormatting,()=>qr(()=>Mr(e=>se(e,Wt.range,()=>({})))))],Jn=[Bn("asc",b.sortAscending,()=>mn(!0)),Bn("desc",b.sortDescending,()=>mn(!1)),Un("a"),{type:"checkbox",key:"filter",label:b.filter,checked:!!Lt.filter,onSelect:gn},Un("b"),Bn("hideRows",b.hideRows,()=>fn("row")),Bn("hideCols",b.hideColumns,()=>fn("col")),Bn("unhideRows",b.unhideRows,()=>hn("row"),{disabled:!Lt.hiddenRows.length}),Bn("unhideCols",b.unhideColumns,()=>hn("col"),{disabled:!Lt.hiddenCols.length})],qn="rounded px-2 py-0.5 text-xs text-ink-muted hover:bg-line-subtle hover:text-ink",eo="inline-flex h-7 items-center gap-1 rounded px-2 text-xs text-ink-muted hover:bg-line-subtle hover:text-ink",to=bt("div",{className:"mx-1 h-4 w-px bg-line"}),ro=e=>e.preventDefault(),no=(e,t,r,n={})=>bt(Ie,{"aria-label":e,title:e,size:"sm",variant:"ghost",onMouseDown:ro,onClick:r,disabled:n.disabled,...void 0!==n.pressed?{"aria-pressed":n.pressed}:{},children:t}),oo=(e,t,r)=>bt(Pe,{triggerLabel:e,align:"start",triggerClassName:"inline-flex h-7 w-7 flex-col items-center justify-center rounded text-ink-muted hover:bg-line-subtle hover:text-ink",trigger:xt(wt,{children:[t,bt("span",{className:"h-0.5 w-4 rounded-sm",style:{background:Yt[r]??("color"===r?"var(--ink)":"var(--line)")}})]}),children:({close:t})=>bt(Ee,{label:e,value:Yt[r]??"",presets:ht,clearable:!0,dragWrites:"end",onChange:e=>{ln(t=>de(t,r,e||void 0)),t()}})}),lo=e=>{if(!_t||!Xr||_t.inBar)return null;const t=Lt.formats[L(_t.row,_t.col)],r=(t?.fontSize??d)*(4/3),n=Math.min(Math.max(e.width,_t.text.length*r*.62+16),e.viewportWidth-e.x-4);return bt("textarea",{ref:kr,"aria-label":b.cellEditor,value:_t.text,spellCheck:!1,rows:1,onChange:e=>Wr(e.target.value,e.target.selectionStart),onSelect:Jr,onKeyDown:Qr,onPointerDown:e=>e.stopPropagation(),className:"absolute resize-none overflow-hidden border-2 border-accent-fill bg-surface text-ink outline-none",style:{left:e.x,top:e.y,width:n,minHeight:e.height,height:Math.max(e.height,_t.text.split("\n").length*r*1.35+6),padding:"0 2px",fontSize:r,lineHeight:1.3,fontWeight:t?.bold?700:void 0,fontStyle:t?.italic?"italic":void 0,background:t?.fill??void 0,color:t?.color??void 0}})},ao=e=>{if(!_t||!Xr)return null;const t=e.y+e.height+2,r=Math.max(0,Math.min(e.x,e.viewportWidth-320));if(Vr)return xt("div",{role:"listbox","aria-label":b.functions,className:"absolute w-80 overflow-hidden rounded-lg border border-line bg-surface shadow-lg",style:{left:r,top:t},onPointerDown:e=>e.preventDefault(),children:[Vr.matches.map((e,t)=>xt("div",{role:"option","aria-selected":t===_t.suggestion,onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),Zr(e)},className:"flex cursor-pointer items-center justify-between gap-3 px-2 py-1 text-xs "+(t===_t.suggestion?"bg-accent-tint text-accent-text":"text-ink hover:bg-surface-sunken"),children:[bt("span",{className:"font-medium",children:e}),bt("span",{className:"truncate "+(t===_t.suggestion?"text-accent-text":"text-ink-muted"),children:b.functionHelp(e)})]},e)),xt("div",{className:"border-t border-line px-2 py-1 font-mono text-xs text-ink-muted",children:[Vr.matches[_t.suggestion],"(",vt[Vr.matches[_t.suggestion]]??"",")"]})]});if(Gr&&void 0!==vt[Gr.name]){const e=vt[Gr.name].split(", ");return xt("div",{className:"absolute max-w-md rounded-lg border border-line bg-surface px-2 py-1 text-xs text-ink-muted shadow-lg",style:{left:r,top:t},children:[xt("div",{className:"font-mono",children:[Gr.name,"(",e.map((t,r)=>xt("span",{children:[r>0?", ":"",bt("span",{className:r===Math.min(Gr.argIndex,e.length-1)?"font-semibold text-ink":"",children:t})]},t+r)),")"]}),bt("div",{className:"mt-0.5",children:b.functionHelp(Gr.name)})]})}return null},io=ar?ar.values.filter(e=>e.toLowerCase().includes(ar.search.toLowerCase())):[];return xt("div",{ref:Tr,className:"flex h-full flex-col bg-surface text-ink",children:[!h&&bt(Ne,{title:`${uo=Qe||b.untitled,uo.length>24?`${uo.slice(0,23)}…`:uo} - Spreadsheets`}),bt("input",{ref:Ut,type:"file",accept:Dt,onChange:e=>{const t=e.target.files?.[0];Ut.current&&(Ut.current.value=""),t&&Dn(t)},className:"hidden"}),xt("div",{className:"flex shrink-0 items-center gap-1 border-b border-line bg-surface-sunken px-2 py-1",children:[s&&bt(Ie,{"aria-label":b.backToFiles,title:b.backToFiles,size:"sm",variant:"ghost",onClick:()=>{zt(),s()},children:bt(Re,{name:"arrow-left",size:16})}),cr?bt("input",{type:"text",value:Qe,autoFocus:!0,"aria-label":b.rename,onChange:e=>Je(e.target.value),onBlur:()=>{sr(!1);const t=Qe.trim()||b.untitled;if(t!==Qe&&Je(t),e&&t!==dt.current){const r=dt.current;dt.current=t,e.store.rename(e.id,t).catch(()=>{Xe.error(b.renameFailed),dt.current=r,Je(r)})}},onKeyDown:e=>{"Enter"===e.key&&(e.currentTarget.blur(),Rr())},className:"w-40 rounded border border-line bg-surface px-2 py-0.5 text-sm font-medium text-ink"}):bt("button",{type:"button",onClick:()=>sr(!0),title:b.rename,className:"max-w-[200px] truncate rounded px-2 py-0.5 text-sm font-medium text-ink hover:bg-line-subtle",children:Qe||b.untitled}),bt(ze,{trigger:b.menuFile,items:Yn,align:"start",triggerClassName:qn}),bt(ze,{trigger:b.menuEdit,items:jn,align:"start",triggerClassName:qn}),bt(ze,{trigger:b.menuView,items:_n,align:"start",triggerClassName:qn}),bt(ze,{trigger:b.menuInsert,items:Zn,align:"start",triggerClassName:qn}),bt(ze,{trigger:b.menuFormat,items:Qn,align:"start",triggerClassName:qn}),bt(ze,{trigger:b.menuData,items:Jn,align:"start",triggerClassName:qn}),(e||l)&&bt("span",{className:"office-save-state",children:bt(Ce,{...e?xe(Tt.state,Mt.save):{tone:Fe!==st.current?"off-unsaved":"off",label:Fe!==st.current?b.noStoreEdited:b.noStoreClean}})})]}),St&&xt("div",{className:"office-conflict",role:"alert",children:[bt("span",{children:b.conflict}),bt(Me,{variant:"secondary",onClick:u,children:b.reload})]}),xt("div",{className:"flex shrink-0 flex-wrap items-center gap-0.5 border-b border-line bg-surface-sunken px-2 py-1",children:[no(b.undo,bt(Re,{name:"undo",size:16}),()=>qr(it),{disabled:0===rt.current.length}),no(b.redo,bt(Re,{name:"redo",size:16}),()=>qr(ct),{disabled:0===nt.current.length}),no(b.formatPainter,bt(Re,{name:"copy-style",size:16}),()=>lr(e=>e?null:Yt),{pressed:!!or}),to,no(b.formatCurrency,bt(Re,{name:"dollar",size:16}),()=>cn(Yt.numFmt===p.currency?"General":p.currency),{pressed:Yt.numFmt===p.currency}),no(b.formatPercent,bt(Re,{name:"percent",size:16}),()=>cn(/%/.test(Yt.numFmt??"")?"General":"0%"),{pressed:/%/.test(Yt.numFmt??"")}),no(b.fewerDecimals,bt("span",{className:"text-xs",children:".0"}),()=>sn(-1)),no(b.moreDecimals,bt("span",{className:"text-xs",children:".00"}),()=>sn(1)),bt(ze,{trigger:xt("span",{title:b.number,className:"flex items-center gap-0.5",children:["123",bt(Re,{name:"chevron-down",size:12})]}),"aria-label":b.number,items:Kn,align:"start",triggerClassName:eo}),to,bt(ze,{trigger:xt("span",{title:b.fontSize,className:"flex items-center gap-0.5",children:[Yt.fontSize??d,bt(Re,{name:"chevron-down",size:12})]}),"aria-label":b.fontSize,items:Xn,align:"start",triggerClassName:eo}),no(b.bold,bt(Re,{name:"bold",size:16}),()=>an("bold"),{pressed:!!Yt.bold}),no(b.italic,bt(Re,{name:"italic",size:16}),()=>an("italic"),{pressed:!!Yt.italic}),no(b.underline,bt(Re,{name:"underline",size:16}),()=>an("underline"),{pressed:!!Yt.underline}),no(b.strikethrough,bt(Re,{name:"strike",size:16}),()=>an("strike"),{pressed:!!Yt.strike}),oo(b.textColor,bt(Re,{name:"text-color",size:14}),"color"),oo(b.fillColor,bt(Re,{name:"palette",size:14}),"fill"),to,bt(ze,{trigger:xt("span",{title:b.borders,className:"flex items-center gap-0.5",children:[bt(Re,{name:"border-all",size:16}),bt(Re,{name:"chevron-down",size:12})]}),"aria-label":b.borders,items:Hn,align:"start",triggerClassName:eo}),no(b.mergeCells,bt(Re,{name:"grid",size:16}),pn,{pressed:Lt.merges.some(e=>Z(e,Gt.row,Gt.col))}),bt(ze,{trigger:xt("span",{title:b.alignment,className:"flex items-center gap-0.5",children:["center"===Yt.align?bt(Re,{name:"align-center",size:16}):"right"===Yt.align?bt(Re,{name:"align-right",size:16}):bt(Re,{name:"align-left",size:16}),bt(Re,{name:"chevron-down",size:12})]}),"aria-label":b.alignment,items:Wn,align:"start",triggerClassName:eo}),no(b.wrapText,bt(Re,{name:"wrap",size:16}),()=>an("wrap"),{pressed:!!Yt.wrap}),to,no(b.filter,bt(Re,{name:"filter",size:16}),gn,{pressed:!!Lt.filter}),no(b.sortAscending,bt(Re,{name:"sort",size:16}),()=>mn(!0)),bt(ze,{trigger:xt("span",{title:b.functions,className:"flex items-center gap-0.5 text-sm",children:["Σ",bt(Re,{name:"chevron-down",size:12})]}),"aria-label":b.functions,items:Vn,align:"end",triggerClassName:eo})]}),xt("div",{className:"flex shrink-0 items-start gap-1 border-b border-line bg-surface px-2 py-1",children:[bt("input",{type:"text","aria-label":b.nameBox,spellCheck:!1,value:fr??(_t&&Xr?x(_t.row,_t.col):Q(Wt.range)),onFocus:e=>{hr(e.target.value),e.target.select()},onChange:e=>hr(e.target.value),onBlur:()=>hr(null),onKeyDown:e=>{if("Enter"===e.key){const e=Y(fr??"");e&&e.r2<Lt.rowCount&&e.c2<Lt.colCount&&(Vt({active:{row:e.r1,col:e.c1},range:z(Lt,e)}),Bt.current?.scrollTo({row:e.r1,col:e.c1})),hr(null),Rr()}},className:"w-20 shrink-0 rounded border border-line bg-surface px-2 py-0.5 text-center text-xs text-ink"}),bt("span",{className:"select-none pt-0.5 font-serif text-sm italic text-ink-faint","aria-hidden":"true",children:"fx"}),bt("textarea",{ref:Cr,"aria-label":b.formulaBar,spellCheck:!1,rows:1,value:_t?_t.text:A(jt,Yt),onFocus:()=>{_t?_t.inBar||Zt({..._t,inBar:!0}):Br(Gt,{inBar:!0,mode:"edit"})},onChange:e=>{_t&&Wr(e.target.value,e.target.selectionStart)},onSelect:Jr,onKeyDown:Qr,className:"max-h-24 min-h-[22px] flex-1 resize-y rounded border border-line bg-surface px-2 py-0.5 font-mono text-xs text-ink outline-none focus:border-accent-fill"})]}),mr&&xt("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-line bg-surface-sunken px-2 py-1 text-xs",children:[bt("div",{className:"w-44",children:bt(Oe,{ref:Nr,size:"sm","aria-label":b.find,placeholder:b.find,value:pr,onChange:e=>vr(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),Mn(e.shiftKey?-1:1))}})}),bt("span",{className:"w-16 text-center text-ink-muted",children:pr?b.hitCount(Rn<0?0:Rn+1,Sn.length):""}),no(b.previous,bt(Re,{name:"arrow-up",size:14}),()=>Mn(-1)),no(b.next,bt(Re,{name:"arrow-down",size:14}),()=>Mn(1)),bt("div",{className:"w-44",children:bt(Oe,{size:"sm","aria-label":b.replaceWith,placeholder:b.replaceWith,value:wr,onChange:e=>br(e.target.value)})}),bt(Me,{size:"sm",variant:"secondary",disabled:!Sn.length,onClick:()=>{if(Rn<0)return void Mn(1);const{row:e,col:t}=Sn[Rn];Mr(r=>{const n=te(J(r,e,t),pr,wr,xr);return n===J(r,e,t)?r:fe(r,[{row:e,col:t,raw:n}])}),Mn(1)},children:b.replace}),bt(Me,{size:"sm",variant:"secondary",disabled:!Sn.length,onClick:()=>{let e=0;Mr(t=>{const r=[];for(const{row:e,col:n}of Sn){const o=te(J(t,e,n),pr,wr,xr);o!==J(t,e,n)&&r.push({row:e,col:n,raw:o})}return e=r.length,fe(t,r)}),Xe.success(b.replacedCount(e))},children:b.replaceAll}),bt(Te,{label:b.matchCase,checked:xr.matchCase,onChange:e=>yr(t=>({...t,matchCase:e}))}),bt(Te,{label:b.wholeCell,checked:xr.wholeCell,onChange:e=>yr(t=>({...t,wholeCell:e}))}),bt(Te,{label:b.inFormulas,checked:xr.inFormulas,onChange:e=>yr(t=>({...t,inFormulas:e}))}),bt("div",{className:"ml-auto",children:no(b.close,bt(Re,{name:"close",size:14}),()=>{gr(!1),Rr()})})]}),bt("div",{className:"min-h-0 flex-1",children:bt(ft,{ref:Bt,sheet:Lt,sheetIndex:Ot,evaluator:Pt,filterHidden:$t,selection:Wt,showGridlines:er,showFormulas:rr,clipRange:Jt&&Jt.sheetId===Lt.id?Jt.range:null,highlights:jr,pointing:Yr,onSelect:zn,onPoint:_r,onEdit:e=>{Ur(),Fr(e),Br(K(Lt,e.row,e.col)?{row:K(Lt,e.row,e.col).r1,col:K(Lt,e.row,e.col).c1}:e)},onFill:e=>{const t=Wt.range;Mr(r=>F(r,t,e)),Vt({active:Wt.active,range:e})},onResizeCol:(e,t)=>Mr(r=>{const{range:n}=Wt,o=0===n.r1&&n.r2===r.rowCount-1&&e>=n.c1&&e<=n.c2,l={...r.colWidths};if(o)for(let e=n.c1;e<=n.c2;e++)l[e]=t;else l[e]=t;return{...r,colWidths:l}}),onResizeRow:(e,t)=>Mr(r=>({...r,rowHeights:{...r.rowHeights,[e]:t}})),onAutoFitCol:e=>{const t=Math.max(40,Bt.current?.measureColumn(e)??0);Mr(r=>({...r,colWidths:{...r.colWidths,[e]:t}}))},onAutoFitRow:e=>Mr(t=>{const r={...t.rowHeights};return delete r[e],{...t,rowHeights:r}}),onHeaderMenu:Fn,onFilterButton:In,renderEditor:e=>xt(wt,{children:[lo(e),ao(e)]}),onKeyDown:t=>{if(_t)return;const r=t.ctrlKey||t.metaKey,n=t.key,o=n.toLowerCase(),l="ArrowUp"===n?[-1,0]:"ArrowDown"===n?[1,0]:"ArrowLeft"===n?[0,-1]:"ArrowRight"===n?[0,1]:null;if(l){t.preventDefault();const e=t.shiftKey?Pr():Wt.active,n=r?Or(e,l[0],l[1]):Ir(e,l[0],l[1]);return void(t.shiftKey?Lr(n):Fr(n))}if("Tab"===n||"Enter"===n){if(t.preventDefault(),"Enter"===n&&r)return;const e=Wt.range.r1!==Wt.range.r2||Wt.range.c1!==Wt.range.c2,o="Enter"===n?t.shiftKey?-1:1:0,l="Tab"===n?t.shiftKey?-1:1:0;if(e){const{range:e}=Wt;let{row:t,col:r}=Wt.active;return t+=o,r+=l,r>e.c2&&(r=e.c1,t=t+1>e.r2?e.r1:t+1),r<e.c1&&(r=e.c2,t=t-1<e.r1?e.r2:t-1),t>e.r2&&(t=e.r1,r=r+1>e.c2?e.c1:r+1),t<e.r1&&(t=e.r2,r=r-1<e.c1?e.c2:r-1),Vt({active:{row:t,col:r},range:e}),void Bt.current?.scrollTo({row:t,col:r})}return void Fr(Ir(Wt.active,o,l))}if("Home"===n)return t.preventDefault(),void Fr(r?{row:Lt.frozenRows,col:Lt.frozenCols}:{row:Wt.active.row,col:0});if("End"===n){t.preventDefault();const e=ue(Lt);return void Fr(r?{row:e?.row??0,col:e?.col??0}:{row:Wt.active.row,col:Math.max(0,(Lt.cells[Wt.active.row]?.length??1)-1)})}if("PageDown"===n||"PageUp"===n){t.preventDefault();const e="PageDown"===n?25:-25;return void Fr({row:Math.max(0,Math.min(Lt.rowCount-1,Wt.active.row+e)),col:Wt.active.col})}if("Delete"===n||"Backspace"===n)return t.preventDefault(),void Mr(e=>C(e,Wt.range));if("F2"===n)return t.preventDefault(),void Br(Wt.active);if(" "===n&&(r||t.shiftKey))return t.preventDefault(),void Vt(r?{active:Wt.active,range:{r1:0,c1:Wt.range.c1,r2:Lt.rowCount-1,c2:Wt.range.c2}}:{active:Wt.active,range:{r1:Wt.range.r1,c1:0,r2:Wt.range.r2,c2:Lt.colCount-1}});if(!r)return!t.altKey||"="!==n&&"≠"!==n?1!==n.length||t.altKey?void("Process"!==n&&229!==t.keyCode||Br(Wt.active,{text:""})):(t.preventDefault(),void Br(Wt.active,{text:n})):(t.preventDefault(),void wn("SUM"));switch(o){case"z":return t.preventDefault(),void(t.shiftKey?ct():it());case"y":return t.preventDefault(),void ct();case"a":return t.preventDefault(),void Vt({active:Wt.active,range:{r1:0,c1:0,r2:Lt.rowCount-1,c2:Lt.colCount-1}});case"b":return t.preventDefault(),void an("bold");case"i":return t.preventDefault(),void an("italic");case"u":return t.preventDefault(),void an("underline");case"f":case"h":return t.preventDefault(),gr(!0),void setTimeout(()=>Nr.current?.focus(),0);case"s":return t.preventDefault(),void(e?zt():kn());case"d":{t.preventDefault();const{range:e}=Wt;return void(e.r2>e.r1?Mr(t=>F(t,{...e,r2:e.r1},e)):e.r1>0&&Mr(t=>F(t,{...e,r1:e.r1-1,r2:e.r1-1},{...e,r1:e.r1-1})))}case"r":{t.preventDefault();const{range:e}=Wt;return void(e.c2>e.c1?Mr(t=>F(t,{...e,c2:e.c1},e)):e.c1>0&&Mr(t=>F(t,{...e,c1:e.c1-1,c2:e.c1-1},{...e,c1:e.c1-1})))}case";":return t.preventDefault(),void Mr(e=>D(e,Wt.active.row,Wt.active.col,We(new Date)));case"`":return t.preventDefault(),void nr(e=>!e)}if(t.shiftKey){if("$"===n||"4"===n)return t.preventDefault(),void cn(p.currency);if("%"===n||"5"===n)return t.preventDefault(),void cn("0%")}},onCopy:e=>{_t||bn(!1,e)},onCut:e=>{_t||bn(!0,e)},onPaste:e=>{_t||(e.preventDefault(),xn(e.clipboardData.getData("text/plain"),"all"))}})}),xt("div",{className:"flex shrink-0 items-center border-t border-line bg-surface-sunken",children:[xt("div",{className:"flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto px-1 py-1",children:[bt(Ie,{"aria-label":b.addSheet,title:b.addSheet,size:"sm",variant:"ghost",onClick:Tn,children:bt(Re,{name:"add",size:14})}),Fe.map((e,t)=>bt("button",{type:"button",onClick:()=>(e=>{_t&&!Yr&&Ur(),Ze(e),ir(null)})(t),onDoubleClick:()=>dr({index:t,name:e.name}),onContextMenu:e=>Sr.open(e,t),style:e.tabColor?{boxShadow:`inset 0 -3px 0 ${e.tabColor}`}:void 0,className:"whitespace-nowrap rounded px-3 py-1 text-xs font-medium "+(t===Ot?"bg-accent-tint text-accent-text":"text-ink-muted hover:bg-line-subtle hover:text-ink"),children:ur?.index===t?bt("input",{type:"text",value:ur.name,autoFocus:!0,"aria-label":b.rename,onChange:e=>dr({index:t,name:e.target.value}),onBlur:En,onKeyDown:e=>{e.stopPropagation(),"Enter"===e.key&&En()},onClick:e=>e.stopPropagation(),className:"w-24 rounded border border-accent-fill bg-surface px-1 text-xs text-ink outline-none"}):e.name},e.id))]}),Ln&&Ln.count>0&&xt("div",{className:"flex shrink-0 items-center gap-3 border-l border-line px-3 py-1 text-xs text-ink-muted",children:[Ln.numbers>0&&xt("span",{children:[b.statSum,": ",Pn(Ln.sum)]}),null!==Ln.average&&xt("span",{children:[b.statAverage,": ",Pn(Ln.average)]}),xt("span",{children:[b.statCount,": ",Ln.count]}),Ln.numbers>0&&xt("span",{children:[b.statMin,": ",Pn(Ln.min)]}),Ln.numbers>0&&xt("span",{children:[b.statMax,": ",Pn(Ln.max)]})]})]}),Dr.state&&bt(Ae,{...Dr.props,items:(so=Dr.state.data.kind,[Bn("cut",b.cut,()=>qr(()=>bn(!0))),Bn("copy",b.copy,()=>qr(()=>bn(!1))),Bn("paste",b.paste,()=>yn("all")),Bn("pasteValues",b.pasteValues,()=>yn("values")),Un("a"),..."col"!==so?[Bn("rowAbove",b.rowsAbove,()=>un("row",!1)),Bn("rowBelow",b.rowsBelow,()=>un("row",!0))]:[],..."row"!==so?[Bn("colLeft",b.columnsLeft,()=>un("col",!1)),Bn("colRight",b.columnsRight,()=>un("col",!0))]:[],Un("b"),..."col"!==so?[Bn("delRows",b.deleteRows,()=>dn("row"),{danger:!0})]:[],..."row"!==so?[Bn("delCols",b.deleteColumns,()=>dn("col"),{danger:!0})]:[],Bn("clear",b.clearValues,()=>qr(()=>Mr(e=>C(e,Wt.range)))),Un("c"),..."col"!==so?[Bn("hideRows",b.hideRows,()=>fn("row"))]:[],..."row"!==so?[Bn("hideCols",b.hideColumns,()=>fn("col"))]:[],..."col"!==so&&Lt.hiddenRows.length?[Bn("unhideRows",b.unhideRows,()=>hn("row"))]:[],..."row"!==so&&Lt.hiddenCols.length?[Bn("unhideCols",b.unhideColumns,()=>hn("col"))]:[]])}),Sr.state&&bt(Ae,{...Sr.props,items:(co=Sr.state.data,[Bn("rename",b.rename,()=>dr({index:co,name:Fe[co].name})),Bn("duplicate",b.duplicate,()=>{lt(e=>E(e,co,X(e,Fe[co].name))),Ze(co+1)}),Bn("left",b.moveLeft,()=>An(co,-1),{disabled:0===co}),Bn("right",b.moveRight,()=>An(co,1),{disabled:co===Fe.length-1}),{type:"submenu",key:"colour",label:b.tabColor,items:[Bn("none",b.noColor,()=>lt(e=>e.map((e,t)=>t===co?{...e,tabColor:void 0}:e))),...ht.slice(7,17).map(e=>Bn(e,xt("span",{className:"flex items-center gap-2",children:[bt("span",{className:"inline-block h-3 w-3 rounded-sm",style:{background:e}}),e]}),()=>lt(t=>t.map((t,r)=>r===co?{...t,tabColor:e}:t))))]},Un("a"),Bn("delete",b.deleteSheet,()=>{(async e=>{Fe.length<=1||(null===ue(Fe[e])||await Ke({title:b.deleteSheetTitle,message:b.deleteSheetMessage(Fe[e].name),confirmLabel:b.deleteSheet}))&&(lt(t=>T(t,e)),Ze(t=>t>e||t>=Fe.length-1?Math.max(0,t-1):t))})(co)},{danger:!0,disabled:Fe.length<=1})])}),ar&&xt($e,{portal:!0,minWidth:230,onClose:()=>ir(null),style:{position:"fixed",left:ar.x,top:ar.y},children:[bt(Ue,{onClick:()=>On(ar.col,!0),children:b.sortAscending}),bt(Ue,{onClick:()=>On(ar.col,!1),children:b.sortDescending}),bt(Be,{}),bt("div",{className:"px-2 py-1",children:bt(Oe,{size:"sm","aria-label":b.find,placeholder:b.find,value:ar.search,onChange:e=>ir({...ar,search:e.target.value})})}),bt("div",{className:"max-h-52 overflow-y-auto px-2 py-1",children:io.map(e=>bt("div",{className:"py-0.5",children:bt(Te,{label:e||b.blank,checked:!ar.unticked.has(e),onChange:t=>{const r=new Set(ar.unticked);t?r.delete(e):r.add(e),ir({...ar,unticked:r})}})},e))}),xt("div",{className:"flex items-center justify-between gap-2 border-t border-line px-2 py-1",children:[bt(Me,{size:"sm",variant:"ghost",onClick:()=>ir({...ar,unticked:new Set}),children:b.clear}),bt(Me,{size:"sm",variant:"primary",onClick:()=>{if(!ar)return;const{col:e,unticked:t}=ar;ir(null),qr(()=>Mr(r=>{if(!r.filter)return r;const n={...r.filter.excluded};return t.size?n[e]=[...t]:delete n[e],{...r,filter:{...r.filter,excluded:n}}}))},children:b.apply})]})]})]});var co,so,uo}function At(e,t){const r=e.rows?e.rows.map(e=>e.map(e=>String(e??""))):G(e.csv??"");return 0===r.length?null:oe(t,r)}export{Mt as OpenSpreadsheet,Rt as SpreadsheetById,Tt as SpreadsheetPane,St as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=(e,n)=>e===n||JSON.stringify(e)===JSON.stringify(n);function n(n,s,t){return e(s,n)?t:s}function s(n,s,t,i){const r=new Map(n.map(e=>[e.id,e])),o=new Map(s.map(e=>[e.id,e])),a=new Map(t.map(e=>[e.id,e])),u=new Set,l=new Map;for(const e of new Set([...o.keys(),...a.keys()])){const n=r.get(e),s=o.get(e),t=a.get(e);if(n){if(!s||!t)continue;l.set(e,i(n,s,t))}else l.set(e,s??t);u.add(e)}return function(n,s,t,i){const r=e=>e.filter(e=>n.includes(e)&&i.has(e)),o=!e(r(n),r(s)),[a,u]=o?[s,t]:[t,s],l=a.filter(e=>i.has(e));return u.forEach((e,n)=>{if(l.includes(e)||!i.has(e))return;const s=u.slice(0,n).reverse().find(e=>l.includes(e));l.splice(s?l.indexOf(s)+1:0,0,e)}),l}([...r.keys()],[...o.keys()],[...a.keys()],u).map(e=>l.get(e))}var t=(e,s,t)=>n(e,s,t);function i(e,i,r){return{...r,background:n(e.background,i.background,r.background),notes:n(e.notes,i.notes,r.notes),layout:n(e.layout,i.layout,r.layout),skip:n(e.skip,i.skip,r.skip),transition:n(e.transition,i.transition,r.transition),animations:n(e.animations,i.animations,r.animations),elements:s(e.elements,i.elements,r.elements,t)}}function r(t,r,o){if(e(r,t))return o;if(e(o,t))return r;const a=s(t.slides,r.slides,o.slides,i);return{...o,theme:n(t.theme,r.theme,o.theme),slideNumbers:n(t.slideNumbers,r.slideNumbers,o.slideNumbers),slides:a.length>0?a:o.slides}}export{r as mergeDecks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE","LI","TR","TABLE","UL","OL","TBODY"]);function t(t){let o="";const n=t=>{for(const a of Array.from(t.childNodes)){if(3===a.nodeType){o+=(a.nodeValue??"").replace(//g,"");continue}if(1!==a.nodeType)continue;const t=a;if("BR"===t.tagName){o+="\n";continue}if("DEL"===t.tagName||t.hasAttribute("data-hidden"))continue;if("object"===t.getAttribute("data-kind")||"mark"===t.getAttribute("data-kind"))continue;if("TD"===t.tagName||"TH"===t.tagName){n(t),o=`${o.replace(/\n+$/,"")}\t`;continue}const r=e.has(t.tagName);n(t),r&&!o.endsWith("\n")&&(o+="\n")}};return n(t),o.replace(/\t\n/g,"\n").replace(/\n+$/,"\n")}function o(e){return(e.match(/[-ヿ㐀-鿿豈-]/g)?.length??0)+(e.replace(/[-ヿ㐀-鿿豈-]/g," ").match(/\S+/g)?.length??0)}function n(t,o,n){if(!o)return[];const a=function(e){const t=[],o=e=>{for(const n of Array.from(e.childNodes))if(3===n.nodeType)t.push(n);else if(1===n.nodeType){const e=n;if("false"===e.getAttribute("contenteditable")||e.hasAttribute("data-raw"))continue;o(e)}};return o(e),t}(t),r=o=>{let n=o.parentNode;for(;n&&n!==t&&!e.has(n.tagName)&&"TD"!==n.tagName;)n=n.parentNode;return n},i=[];let c=0;for(;c<a.length;){const e=r(a[c]);let t=c;const d=[];for(;t<a.length&&r(a[t])===e;)d.push(a[t++]);const s=d.map(e=>e.nodeValue??"").join(""),l=n?s:s.toLowerCase(),p=n?o:o.toLowerCase(),g=l.length===s.length?l:s;for(let e=g.indexOf(p);e>=0;e=g.indexOf(p,e+p.length)){const t=[];let o=0;for(const n of d){const a=(n.nodeValue??"").length,r=Math.max(e,o),i=Math.min(e+p.length,o+a);r<i&&t.push({node:n,start:r-o,end:i-o}),o+=a}i.push(t)}c=t}return i}function a(e,t){e.forEach((e,o)=>{const n=e.node.nodeValue??"";e.node.nodeValue=n.slice(0,e.start)+(0===o?t:"")+n.slice(e.end)})}function r(e,t){const o=[0];if(t<=0)return o;let n=0;for(const a of e)if(a.breakBefore&&a.top>n&&(n=a.top,o.push(n)),!(a.top+a.height-n<=t))if(a.height<=t)a.top>n&&(n=a.top,o.push(n));else for(;a.top+a.height-n>t;)n+=t,o.push(n);return o}function i(e,t,o=1){const n=[],a=e=>{const a=e.getBoundingClientRect();n.push({top:(a.top-t)/o,height:a.height/o,breakBefore:e.hasAttribute("data-break-before")})};for(const r of Array.from(e.children))"TABLE"===r.tagName?r.querySelectorAll("tr").forEach(a):"UL"===r.tagName||"OL"===r.tagName?r.querySelectorAll("li").forEach(a):a(r),r.querySelectorAll("[data-page-break]").forEach(e=>{const a=e.getBoundingClientRect();n.push({top:(a.bottom-t)/o,height:0,breakBefore:!0})});return n}var c=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","UL","OL","LI","TABLE","THEAD","TBODY","TFOOT","TR","TD","TH","COLGROUP","COL","B","STRONG","I","EM","U","S","STRIKE","SUB","SUP","SPAN","FONT","A","BR","IMG","PRE","HR"]),d=new Set(["SCRIPT","STYLE","TITLE","META","LINK","OBJECT","EMBED","IFRAME","NOSCRIPT","TEMPLATE","SVG","MATH","FORM","INPUT","BUTTON","SELECT","TEXTAREA","VIDEO","AUDIO","CANVAS"]),s=new Set(["color","background-color","font-weight","font-style","text-decoration-line","text-decoration","font-family","font-size","text-align","margin-left","line-height","width","height","list-style-type"]),l=/^(https?:|mailto:|tel:|#)/i,p=/^(data:image\/(png|jpe?g|gif|webp|bmp);base64,|blob:)/i;function g(e){const t=document.implementation.createHTMLDocument("");t.body.innerHTML=e;const o=(e,t,n)=>{for(const a of Array.from(e.childNodes)){if(3===a.nodeType){t.appendChild(n.createTextNode(a.nodeValue??""));continue}if(1!==a.nodeType)continue;const e=a,r=e.tagName.toUpperCase();if(d.has(r))continue;if(!c.has(r)){o(e,t,n);continue}if("IMG"===r&&!p.test(e.getAttribute("src")??""))continue;const i=n.createElement(r),g=(e.getAttribute("style")??"").split(";").map(e=>{const t=e.indexOf(":");if(t<0)return"";const o=e.slice(0,t).trim().toLowerCase(),n=e.slice(t+1).trim();return s.has(o)&&!/url\(|expression|mso-/i.test(n)?`${o}:${n}`:""}).filter(Boolean).join(";");g&&i.setAttribute("style",g),"A"===r&&l.test(e.getAttribute("href")??"")&&i.setAttribute("href",e.getAttribute("href")),"IMG"===r&&i.setAttribute("src",e.getAttribute("src"));for(const t of["colspan","rowspan","start","color","face","size"]){const o=e.getAttribute(t);null!==o&&i.setAttribute(t,o)}o(e,i,n),t.appendChild(i)}},n=document.createElement("div");return o(t.body,n,document),n.innerHTML}import{escapeHtml as f}from"efficient-shell/ui";var u="\nhtml,body{margin:0;background:#fff}\n.docs-page [data-comment]{background:none;border:0}\n.docs-page [data-locked]{background:none;box-shadow:none}\n.docs-page [data-page-break]{break-after:page;border:0;margin:0}\n.docs-page [data-break-before]{break-before:page}\n.docs-page tr,.docs-page img{break-inside:avoid}\n";function h(e,t){return`\n.docs-sheet{background:#fff;color:#777}\n.docs-sheet-line{border-color:#aaa}\n\n${`\n.docs-page{color:#000;background:#fff;white-space:pre-wrap;overflow-wrap:break-word;outline:none;line-height:1.08;tab-size:36pt;font-family:Calibri,Carlito,Arial,sans-serif;font-size:11pt}\n.docs-page p,.docs-page h1,.docs-page h2,.docs-page h3,.docs-page h4,.docs-page h5,.docs-page h6{margin:0;font:inherit;font-weight:400}\n.docs-page ul,.docs-page ol{margin:0;padding-left:24pt}\n.docs-page ul{list-style-type:disc}.docs-page ol{list-style-type:decimal}\n.docs-page ul ul{list-style-type:circle}.docs-page ul ul ul{list-style-type:square}\n.docs-page a{color:#0563c1;text-decoration:underline}\n.docs-page sub,.docs-page sup{font-size:.66em}\n.docs-page img{max-width:100%}\n.docs-page table{border-collapse:collapse;table-layout:fixed;width:100%}\n.docs-page td,.docs-page th{border:.5pt solid #000;padding:0 5.4pt;vertical-align:top}\n.docs-page table[data-no-borders] td,.docs-page table[data-no-borders] th{border:.5pt dotted #bbb}\n.docs-page td p{margin-bottom:0}\n.docs-page blockquote{margin:0 0 8pt 24pt;font-style:italic}\n.docs-page hr{border:0;border-top:.75pt solid #000;margin:6pt 0}\n.docs-page [data-hidden]{display:none}\n.docs-page [data-page-break]{display:block;height:0;border-top:1pt dashed #999;margin:6pt 0;user-select:none}\n.docs-page [data-comment]{background:#fff2cc;border-bottom:1.5pt solid #e0b000}\n.docs-page [data-locked]{background:#f4f4f4;box-shadow:-5pt 0 0 #bbb;cursor:not-allowed}\n.docs-page ins{color:#c00000;text-decoration:underline}\n.docs-page del{color:#c00000;text-decoration:line-through}\n.docs-page [data-kind="object"]{display:inline-block;background:#f4f4f4;border:.75pt dashed #999;color:#555;padding:1pt 5pt;cursor:not-allowed;white-space:normal}\n.docs-page [data-kind="field"]{background:#ededed}\n.docs-page [data-kind="note"]{vertical-align:super;font-size:.66em}\n.docs-page ::highlight(docs-find){background:#ffe680}\n.docs-page ::highlight(docs-find-current){background:#ff9f1a}\n\n${e.css}`.replaceAll(".docs-page",`.docs-page[data-doc="${t}"]`)}`}var b=e=>u.replaceAll(".docs-page",`.docs-page[data-doc="${e}"]`);function m(e,t,o){const n=e=>(e??"").replaceAll("{page}",String(t)).replaceAll("{pages}",String(o)),[a,r]=e.split(/\s*\|\s*/);return[n(a),n(r)]}function T(e,t){const[o,n]=function(e){return e.split(/\s*\|\s*/).map(e=>e.split(/(\{page\}|\{pages\})/).map(e=>"{page}"===e?"counter(page)":"{pages}"===e?"counter(pages)":e?`"${e.replace(/["\\\n\r]/g,"")}"`:"").filter(Boolean).join(" "))}(t),a="font:9pt Calibri,Carlito,Arial,sans-serif;color:#555";return`${o?`@${e}-left{content:${o};${a}}`:""}${n?`@${e}-right{content:${n};${a}}`:""}`}function A({title:e,html:t,doc:o,scope:n,page:a,header:r,footer:i}){const c=e=>Math.round(e)/20+"pt",d=`@page{size:${c(a.width)} ${c(a.height)};margin:${c(a.top)} ${c(a.right)} ${c(a.bottom)} ${c(a.left)};${T("top",r)}${T("bottom",i)}}`;return`<!doctype html><html><head><meta charset="utf-8"><meta name="generator" content="efficient-shell Documents"><title>${f(e)}</title><style>${h(o,n)}\n${b(n)}\n${d}</style></head><body><div class="docs-page" data-doc="${n}">${t}</div></body></html>`}export{t as documentText,o as countWords,n as findInNodes,a as replaceSpots,r as pageStarts,i as pageBlocks,g as sanitizeHtml,h as pageStyles,b as printStyles,m as marginText,A as pageDocument};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{titleOf as r}from"./chunk-XYVQTQ6N.js";var e=r=>new Promise((e,t)=>{const a=new FileReader;a.onload=()=>e(String(a.result)),a.onerror=()=>t(a.error??new Error("Unreadable picture")),a.readAsDataURL(r)});async function t(t,a,o={}){const{importPptx:n}=await(import("./pptxImport-Y7TB6PYP.js")),{document:i,notes:s}=await n(a,{storeImage:o.storeImage??e,onProgress:o.onProgress,signal:o.signal}),c=r(a.name),m=await t.create(c);try{await t.save(m.id,i,m.version)}catch(r){throw await t.remove(m.id).catch(()=>{}),r}return{id:m.id,title:c,notes:s}}export{t as importDeckFile};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ENGLISH_FILE_WORDS as e,ZH_HANS_FILE_WORDS as t}from"./chunk-B32ASXHM.js";var o={ABS:"Absolute value",AND:"True if all are true",AVERAGE:"Average of numbers",AVERAGEIF:"Average where a test passes",AVERAGEIFS:"Average on many tests",CEILING:"Rounds up to a multiple","CEILING.MATH":"Rounds up to a multiple",CHOOSE:"Picks by position",COLUMN:"Column number",COLUMNS:"Number of columns",CONCAT:"Joins text",CONCATENATE:"Joins text",COS:"Cosine",COUNT:"Counts numbers",COUNTA:"Counts non-blank cells",COUNTBLANK:"Counts blank cells",COUNTIF:"Counts where a test passes",COUNTIFS:"Counts on many tests",DATE:"Builds a date",DATEDIF:"Time between dates",DAY:"Day of the month",DAYS:"Days between dates",EDATE:"Date some months away",EOMONTH:"Last day of a month",EXACT:"Same text, case included",EXP:"e to a power",FIND:"Position of text, case exact",FLOOR:"Rounds down to a multiple","FLOOR.MATH":"Rounds down to a multiple",FV:"Future value",HLOOKUP:"Looks along the top row",HOUR:"Hour of a time",IF:"One value or another",IFERROR:"A fallback for an error",IFNA:"A fallback for #N/A",IFS:"First test that passes",INDEX:"The cell at a position",INT:"Rounds down to a whole number",ISBLANK:"True if blank",ISERROR:"True if an error",ISLOGICAL:"True if TRUE or FALSE",ISNA:"True if #N/A",ISNUMBER:"True if a number",ISTEXT:"True if text",LARGE:"The kth largest",LEFT:"Text from the start",LEN:"Length of text",LN:"Natural logarithm",LOG:"Logarithm",LOG10:"Base-10 logarithm",LOWER:"Lower case",MATCH:"Position of a value",MAX:"Largest number",MEDIAN:"Middle number",MID:"Text from the middle",MIN:"Smallest number",MINUTE:"Minute of a time",MOD:"Remainder",MODE:"Most common number","MODE.SNGL":"Most common number",MONTH:"Month of a date",N:"A value as a number",NA:"The #N/A error",NETWORKDAYS:"Working days between dates",NOT:"The opposite",NOW:"Date and time now",NPV:"Net present value",OR:"True if any is true",PI:"The number pi",PMT:"Loan payment",POWER:"A number to a power",PRODUCT:"Multiplies numbers",PROPER:"Capitals on each word",PV:"Present value",RAND:"Random from 0 to 1",RANDBETWEEN:"Random whole number",RANK:"Rank in a list","RANK.EQ":"Rank in a list",REPLACE:"Replaces by position",REPT:"Repeats text",RIGHT:"Text from the end",ROUND:"Rounds a number",ROUNDDOWN:"Rounds toward zero",ROUNDUP:"Rounds away from zero",ROW:"Row number",ROWS:"Number of rows",SEARCH:"Position of text, any case",SECOND:"Second of a time",SIGN:"Sign of a number",SIN:"Sine",SMALL:"The kth smallest",SQRT:"Square root",STDEV:"Standard deviation of a sample","STDEV.P":"Standard deviation of everything","STDEV.S":"Standard deviation of a sample",STDEVP:"Standard deviation of everything",SUBSTITUTE:"Replaces text",SUM:"Adds numbers",SUMIF:"Adds where a test passes",SUMIFS:"Adds on many tests",SUMPRODUCT:"Multiplies, then adds",SWITCH:"Picks a result by value",TAN:"Tangent",TEXT:"A number as formatted text",TEXTJOIN:"Joins with a separator",TIME:"Builds a time",TODAY:"Today's date",TRIM:"Removes extra spaces",TRUNC:"Cuts off decimals",UPPER:"Upper case",VALUE:"Text as a number",VAR:"Variance of a sample","VAR.P":"Variance of everything","VAR.S":"Variance of a sample",VARP:"Variance of everything",VLOOKUP:"Looks down the first column",WEEKDAY:"Day of the week",XLOOKUP:"Looks up in any column",XOR:"True if an odd number are true",YEAR:"Year of a date"},a={ABS:"绝对值",AND:"全部为真时返回真",AVERAGE:"数字的平均值",AVERAGEIF:"满足条件的平均值",AVERAGEIFS:"满足多个条件的平均值",CEILING:"向上舍入到倍数","CEILING.MATH":"向上舍入到倍数",CHOOSE:"按位置选择",COLUMN:"列号",COLUMNS:"列数",CONCAT:"连接文本",CONCATENATE:"连接文本",COS:"余弦",COUNT:"统计数字个数",COUNTA:"统计非空单元格",COUNTBLANK:"统计空单元格",COUNTIF:"统计满足条件的个数",COUNTIFS:"统计满足多个条件的个数",DATE:"生成日期",DATEDIF:"两个日期的间隔",DAY:"月份中的第几天",DAYS:"两个日期相差的天数",EDATE:"相隔若干个月的日期",EOMONTH:"月份的最后一天",EXACT:"文本完全相同",EXP:"e 的幂",FIND:"文本位置(区分大小写)",FLOOR:"向下舍入到倍数","FLOOR.MATH":"向下舍入到倍数",FV:"未来值",HLOOKUP:"在首行中查找",HOUR:"时间中的小时",IF:"二选一返回值",IFERROR:"出错时的备用值",IFNA:"#N/A 时的备用值",IFS:"第一个满足的条件",INDEX:"指定位置的单元格",INT:"向下取整",ISBLANK:"为空时返回真",ISERROR:"为错误时返回真",ISLOGICAL:"为逻辑值时返回真",ISNA:"为 #N/A 时返回真",ISNUMBER:"为数字时返回真",ISTEXT:"为文本时返回真",LARGE:"第 k 大的值",LEFT:"从开头截取文本",LEN:"文本长度",LN:"自然对数",LOG:"对数",LOG10:"以 10 为底的对数",LOWER:"转为小写",MATCH:"值的位置",MAX:"最大值",MEDIAN:"中位数",MID:"从中间截取文本",MIN:"最小值",MINUTE:"时间中的分钟",MOD:"余数",MODE:"出现最多的数字","MODE.SNGL":"出现最多的数字",MONTH:"日期中的月份",N:"转为数字",NA:"#N/A 错误",NETWORKDAYS:"两个日期之间的工作日",NOT:"取反",NOW:"当前日期和时间",NPV:"净现值",OR:"任一为真时返回真",PI:"圆周率",PMT:"贷款每期还款额",POWER:"幂运算",PRODUCT:"数字相乘",PROPER:"每个单词首字母大写",PV:"现值",RAND:"0 到 1 之间的随机数",RANDBETWEEN:"随机整数",RANK:"在列表中的排名","RANK.EQ":"在列表中的排名",REPLACE:"按位置替换",REPT:"重复文本",RIGHT:"从末尾截取文本",ROUND:"四舍五入",ROUNDDOWN:"向零舍入",ROUNDUP:"远离零舍入",ROW:"行号",ROWS:"行数",SEARCH:"文本位置(不区分大小写)",SECOND:"时间中的秒",SIGN:"数字的符号",SIN:"正弦",SMALL:"第 k 小的值",SQRT:"平方根",STDEV:"样本标准差","STDEV.P":"总体标准差","STDEV.S":"样本标准差",STDEVP:"总体标准差",SUBSTITUTE:"替换文本",SUM:"数字求和",SUMIF:"对满足条件的值求和",SUMIFS:"对满足多个条件的值求和",SUMPRODUCT:"相乘后求和",SWITCH:"按值选择结果",TAN:"正切",TEXT:"数字转为带格式的文本",TEXTJOIN:"用分隔符连接",TIME:"生成时间",TODAY:"今天的日期",TRIM:"删除多余空格",TRUNC:"截去小数",UPPER:"转为大写",VALUE:"文本转为数字",VAR:"样本方差","VAR.P":"总体方差","VAR.S":"样本方差",VARP:"总体方差",VLOOKUP:"在首列中查找",WEEKDAY:"星期几",XLOOKUP:"在任意列中查找",XOR:"奇数个为真时返回真",YEAR:"日期中的年份"},l={pdfPageFailed:e=>`Page ${e} couldn't be drawn for the PDF.`,files:e,fileKind:"Excel",untitled:"Untitled",backToFiles:"Back to files",filesHeading:"Spreadsheets",newFile:"New spreadsheet",openFile:"Open a file",filesEmptyTitle:"Make your first spreadsheet",filesEmptyBody:"Every change saves by itself.",deleteFile:"Delete",createFailed:"The spreadsheet could not be made.",deleteFailed:"The spreadsheet could not be deleted.",storedOpenFailed:"This spreadsheet could not be opened.",loading:"Loading",renameFailed:"The spreadsheet could not be renamed.",conflict:"Somebody else saved this spreadsheet, so your latest changes are not saved. Reload to see theirs.",reload:"Reload",noStoreEdited:"Not saved. Save as Excel to keep your changes",saveToFiles:"Save to Files",noStoreClean:"No autosave here. Save as Excel to keep a copy",deleteConfirm:e=>`Delete "${e}"? Nobody can open it again.`,spreadsheetFile:"spreadsheet",sheetBase:"Sheet",menuFile:"File",menuEdit:"Edit",menuView:"View",menuInsert:"Insert",menuFormat:"Format",menuData:"Data",menuNew:"New",menuOpen:"Open",saveExcel:"Save as Excel (.xlsx)",saveCsv:"Download this sheet as CSV",email:"Email",undo:"Undo",redo:"Redo",cut:"Cut",copy:"Copy",paste:"Paste",pasteValues:"Paste values only",pasteFormats:"Paste formatting only",findReplace:"Find and replace",clearValues:"Clear contents",freeze:"Freeze",gridlines:"Gridlines",showFormulas:"Show formulas",rowsAbove:"Rows above",rowsBelow:"Rows below",columnsLeft:"Columns left",columnsRight:"Columns right",sheet:"Sheet",function:"Function",functions:"Functions",number:"Number format",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",fontSize:"Font size",alignment:"Alignment",borders:"Borders",wrapText:"Wrap text",mergeCells:"Merge cells",clearFormatting:"Clear formatting",sortAscending:"Sort A to Z",sortDescending:"Sort Z to A",filter:"Filter",hideRows:"Hide rows",hideColumns:"Hide columns",unhideRows:"Show hidden rows",unhideColumns:"Show hidden columns",deleteRows:"Delete rows",deleteColumns:"Delete columns",formatGeneral:"Automatic",formatNumber:"Number",formatPercent:"Percent",formatScientific:"Scientific",formatCurrency:"Currency",formatDate:"Date",formatTime:"Time",formatDateTime:"Date and time",formatText:"Plain text",bordersAll:"All borders",bordersOuter:"Outer borders",bordersTop:"Top border",bordersBottom:"Bottom border",bordersLeft:"Left border",bordersRight:"Right border",bordersNone:"No borders",alignLeft:"Left",alignCenter:"Center",alignRight:"Right",alignTop:"Top",alignMiddle:"Middle",alignBottom:"Bottom",formatPainter:"Paint format",fewerDecimals:"Fewer decimal places",moreDecimals:"More decimal places",textColor:"Text color",fillColor:"Fill color",nameBox:"Selected cells",formulaBar:"Formula bar",cellEditor:"Cell contents",selectAll:"Select all",fillHandle:"Fill",find:"Find",replaceWith:"Replace with",replace:"Replace",replaceAll:"Replace all",previous:"Previous",next:"Next",close:"Close",matchCase:"Match case",wholeCell:"Whole cell",inFormulas:"In formulas",addSheet:"Add sheet",rename:"Rename",duplicate:"Duplicate",moveLeft:"Move left",moveRight:"Move right",tabColor:"Tab color",noColor:"No color",deleteSheet:"Delete sheet",deleteSheetTitle:"Delete this sheet?",sheetNameTaken:"Another sheet already has that name.",saveFailed:"Could not save the workbook. Try again.",openFailed:"Could not open that file. It may be damaged or an unsupported type.",statSum:"Sum",statAverage:"Average",statCount:"Count",statMin:"Min",statMax:"Max",blank:"(Blank)",clear:"Clear",apply:"Apply",sheetName:e=>`Sheet ${e}`,filterColumn:e=>`Filter column ${e}`,freezeRows:e=>0===e?"No frozen rows":1===e?"1 row":`${e} rows`,freezeColumns:e=>0===e?"No frozen columns":1===e?"1 column":`${e} columns`,freezeUpToRow:e=>`Up to row ${e}`,freezeUpToColumn:e=>`Up to column ${e}`,hitCount:(e,t)=>`${e} of ${t}`,replacedCount:e=>1===e?"Replaced in 1 cell":`Replaced in ${e} cells`,deleteSheetMessage:e=>`"${e}" and everything on it will be deleted. Formulas that use it will show #REF!.`,functionHelp:e=>o[e]??String(e)},r={pdfPageFailed:e=>`第 ${e} 页无法绘制到 PDF。`,files:t,fileKind:"Excel",untitled:"未命名",backToFiles:"返回文件",filesHeading:"电子表格",newFile:"新建电子表格",openFile:"打开文件",filesEmptyTitle:"创建您的第一个电子表格",filesEmptyBody:"每次更改都会自动保存。",deleteFile:"删除",createFailed:"无法创建电子表格。",deleteFailed:"无法删除电子表格。",storedOpenFailed:"无法打开此电子表格。",loading:"正在加载",renameFailed:"无法重命名电子表格。",conflict:"其他人已保存此电子表格,您最近的更改尚未保存。请重新加载以查看他们的版本。",reload:"重新加载",noStoreEdited:"未保存。请另存为 Excel 以保留更改",saveToFiles:"保存到文件",noStoreClean:"此处不会自动保存。请另存为 Excel 以保留副本",deleteConfirm:e=>`删除“${e}”?之后任何人都无法再打开它。`,spreadsheetFile:"电子表格",sheetBase:"工作表",menuFile:"文件",menuEdit:"编辑",menuView:"视图",menuInsert:"插入",menuFormat:"格式",menuData:"数据",menuNew:"新建",menuOpen:"打开",saveExcel:"另存为 Excel(.xlsx)",saveCsv:"将此工作表下载为 CSV",email:"发送邮件",undo:"撤销",redo:"重做",cut:"剪切",copy:"复制",paste:"粘贴",pasteValues:"仅粘贴数值",pasteFormats:"仅粘贴格式",findReplace:"查找和替换",clearValues:"清除内容",freeze:"冻结",gridlines:"网格线",showFormulas:"显示公式",rowsAbove:"在上方插入行",rowsBelow:"在下方插入行",columnsLeft:"在左侧插入列",columnsRight:"在右侧插入列",sheet:"工作表",function:"函数",functions:"函数",number:"数字格式",bold:"粗体",italic:"斜体",underline:"下划线",strikethrough:"删除线",fontSize:"字号",alignment:"对齐",borders:"边框",wrapText:"自动换行",mergeCells:"合并单元格",clearFormatting:"清除格式",sortAscending:"升序排序",sortDescending:"降序排序",filter:"筛选",hideRows:"隐藏行",hideColumns:"隐藏列",unhideRows:"显示隐藏的行",unhideColumns:"显示隐藏的列",deleteRows:"删除行",deleteColumns:"删除列",formatGeneral:"自动",formatNumber:"数字",formatPercent:"百分比",formatScientific:"科学计数",formatCurrency:"货币",formatDate:"日期",formatTime:"时间",formatDateTime:"日期和时间",formatText:"纯文本",bordersAll:"所有边框",bordersOuter:"外边框",bordersTop:"上边框",bordersBottom:"下边框",bordersLeft:"左边框",bordersRight:"右边框",bordersNone:"无边框",alignLeft:"左对齐",alignCenter:"居中",alignRight:"右对齐",alignTop:"顶端对齐",alignMiddle:"垂直居中",alignBottom:"底端对齐",formatPainter:"格式刷",fewerDecimals:"减少小数位",moreDecimals:"增加小数位",textColor:"文字颜色",fillColor:"填充颜色",nameBox:"所选单元格",formulaBar:"编辑栏",cellEditor:"单元格内容",selectAll:"全选",fillHandle:"填充",find:"查找",replaceWith:"替换为",replace:"替换",replaceAll:"全部替换",previous:"上一个",next:"下一个",close:"关闭",matchCase:"区分大小写",wholeCell:"整个单元格",inFormulas:"在公式中",addSheet:"添加工作表",rename:"重命名",duplicate:"复制工作表",moveLeft:"左移",moveRight:"右移",tabColor:"标签颜色",noColor:"无颜色",deleteSheet:"删除工作表",deleteSheetTitle:"删除此工作表?",sheetNameTaken:"已有工作表使用该名称。",saveFailed:"无法保存工作簿,请重试。",openFailed:"无法打开该文件,文件可能已损坏或类型不受支持。",statSum:"求和",statAverage:"平均值",statCount:"计数",statMin:"最小值",statMax:"最大值",blank:"(空白)",clear:"清除",apply:"应用",sheetName:e=>`工作表 ${e}`,filterColumn:e=>`筛选 ${e} 列`,freezeRows:e=>0===e?"不冻结行":`${e} 行`,freezeColumns:e=>0===e?"不冻结列":`${e} 列`,freezeUpToRow:e=>`冻结至第 ${e} 行`,freezeUpToColumn:e=>`冻结至 ${e} 列`,hitCount:(e,t)=>`${e} / ${t}`,replacedCount:e=>`已替换 ${e} 个单元格`,deleteSheetMessage:e=>`将删除“${e}”及其全部内容。引用它的公式将显示 #REF!。`,functionHelp:e=>a[e]??String(e)};export{l as ENGLISH_WORDS,r as ZH_HANS_WORDS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DECK_FONT as t,NO_FILL as e,SLIDE_H as n,SLIDE_W as r,newId as o}from"./chunk-PXOQN7D6.js";var i=t=>`M${t.map(([t,e])=>`${t},${e}`).join(" L")} Z`,a=(t,e,n,r=-Math.PI/2)=>i(Array.from({length:t},(o,i)=>{const a=r+2*i*Math.PI/t;return[e/2+e/2*Math.cos(a),n/2+n/2*Math.sin(a)]})),l={rect:(t,e)=>i([[0,0],[t,0],[t,e],[0,e]]),roundRect:(t,e,n)=>{const r=Math.min(n??Math.min(t,e)/6,t/2,e/2);return`M${r},0 H${t-r} A${r},${r} 0 0 1 ${t},${r} V${e-r} A${r},${r} 0 0 1 ${t-r},${e} H${r} A${r},${r} 0 0 1 0,${e-r} V${r} A${r},${r} 0 0 1 ${r},0 Z`},ellipse:(t,e)=>`M0,${e/2} A${t/2},${e/2} 0 1 1 ${t},${e/2} A${t/2},${e/2} 0 1 1 0,${e/2} Z`,triangle:(t,e)=>i([[t/2,0],[t,e],[0,e]]),rightTriangle:(t,e)=>i([[0,0],[t,e],[0,e]]),diamond:(t,e)=>i([[t/2,0],[t,e/2],[t/2,e],[0,e/2]]),pentagon:(t,e)=>a(5,t,e),hexagon:(t,e)=>a(6,t,e,0),octagon:(t,e)=>a(8,t,e,Math.PI/8),star:(t,e)=>i(Array.from({length:10},(n,r)=>{const o=-Math.PI/2+r*Math.PI/5,i=r%2==0?.5:.2;return[t/2+t*i*Math.cos(o),e/2+e*i*Math.sin(o)+.04*e]})),heart:(t,e)=>`M${t/2},${e} C${.1*t},${.7*e} 0,${.45*e} 0,${.28*e} C0,${.05*e} ${.25*t},0 ${.5*t},${.2*e} C${.75*t},0 ${t},${.05*e} ${t},${.28*e} C${t},${.45*e} ${.9*t},${.7*e} ${t/2},${e} Z`,cloud:(t,e)=>`M${.25*t},${.85*e} C${.05*t},${.85*e} 0,${.6*e} ${.12*t},${.5*e} C${.05*t},${.25*e} ${.3*t},${.15*e} ${.4*t},${.25*e} C${.45*t},${.05*e} ${.75*t},${.05*e} ${.75*t},${.3*e} C${.95*t},${.25*e} ${t},${.55*e} ${.88*t},${.65*e} C${t},${.8*e} ${.85*t},${.9*e} ${.72*t},${.85*e} Z`,bolt:(t,e)=>i([[.55*t,0],[.15*t,.55*e],[.45*t,.55*e],[.35*t,e],[.85*t,.4*e],[.55*t,.4*e],[.75*t,0]]),parallelogram:(t,e)=>i([[.25*t,0],[t,0],[.75*t,e],[0,e]]),trapezoid:(t,e)=>i([[.2*t,0],[.8*t,0],[t,e],[0,e]]),cylinder:(t,e)=>{const n=Math.min(.15*e,t/4);return`M0,${n} A${t/2},${n} 0 0 1 ${t},${n} V${e-n} A${t/2},${n} 0 0 1 0,${e-n} Z M0,${n} A${t/2},${n} 0 0 0 ${t},${n}`},plus:(t,e)=>{const n=t/3,r=e/3;return i([[n,0],[2*n,0],[2*n,r],[t,r],[t,2*r],[2*n,2*r],[2*n,e],[n,e],[n,2*r],[0,2*r],[0,r],[n,r]])},arrowRight:(t,e)=>i([[0,.25*e],[.6*t,.25*e],[.6*t,0],[t,e/2],[.6*t,e],[.6*t,.75*e],[0,.75*e]]),arrowLeft:(t,e)=>i([[t,.25*e],[.4*t,.25*e],[.4*t,0],[0,e/2],[.4*t,e],[.4*t,.75*e],[t,.75*e]]),arrowUp:(t,e)=>i([[.25*t,e],[.25*t,.4*e],[0,.4*e],[t/2,0],[t,.4*e],[.75*t,.4*e],[.75*t,e]]),arrowDown:(t,e)=>i([[.25*t,0],[.25*t,.6*e],[0,.6*e],[t/2,e],[t,.6*e],[.75*t,.6*e],[.75*t,0]]),arrowLeftRight:(t,e)=>i([[0,e/2],[.25*t,0],[.25*t,.25*e],[.75*t,.25*e],[.75*t,0],[t,e/2],[.75*t,e],[.75*t,.75*e],[.25*t,.75*e],[.25*t,e]]),chevron:(t,e)=>i([[0,0],[.7*t,0],[t,e/2],[.7*t,e],[0,e],[.3*t,e/2]]),callout:(t,e)=>i([[0,0],[t,0],[t,.75*e],[.4*t,.75*e],[.2*t,e],[.25*t,.75*e],[0,.75*e]]),calloutRound:(t,e)=>{const n=.12*Math.min(t,e),r=.75*e;return`M${n},0 H${t-n} A${n},${n} 0 0 1 ${t},${n} V${r-n} A${n},${n} 0 0 1 ${t-n},${r} H${.4*t} L${.2*t},${e} L${.25*t},${r} H${n} A${n},${n} 0 0 1 0,${r-n} V${n} A${n},${n} 0 0 1 ${n},0 Z`}};function s(t,e,n,r){return(l[t]??l.rect)(e,n,r)}var c={rect:"rect",roundRect:"roundRect",ellipse:"ellipse",triangle:"triangle",rightTriangle:"rtTriangle",diamond:"diamond",pentagon:"pentagon",hexagon:"hexagon",octagon:"octagon",star:"star5",heart:"heart",cloud:"cloud",bolt:"lightningBolt",parallelogram:"parallelogram",trapezoid:"trapezoid",cylinder:"can",plus:"plus",arrowRight:"rightArrow",arrowLeft:"leftArrow",arrowUp:"upArrow",arrowDown:"downArrow",arrowLeftRight:"leftRightArrow",chevron:"chevron",callout:"wedgeRectCallout",calloutRound:"wedgeRoundRectCallout",line:"line"},h=["bold","italic","underline","strike","color","highlight","size","font","link"];function u(t){return t.paragraphs&&t.paragraphs.length>0?t.paragraphs:t.text.split("\n").map(t=>({runs:[{text:t}]}))}function d(t){return t.map(t=>t.runs.map(t=>t.text).join("")).join("\n")}function f(t,e){const n=e.map(m);return{...t,paragraphs:n,text:d(n)}}var p=(t,e)=>h.every(n=>(t[n]??void 0)===(e[n]??void 0));function g(t){const e={};for(const n of h){const r=t[n];void 0!==r&&!1!==r&&""!==r&&(e[n]=r)}return e}function m(t){const e=[];for(const n of t.runs){const t=g(n),r=e[e.length-1];n.text&&(r&&p(g(r),t)?r.text+=n.text:e.push({text:n.text,...t}))}const n={};t.align&&"left"!==t.align&&(n.align=t.align),t.list&&(n.list=t.list),t.level&&(n.level=Math.max(0,Math.min(4,t.level))),t.lineHeight&&(n.lineHeight=t.lineHeight);const r=t.runs[0]?[{...g(t.runs[0]),text:""}]:[{text:""}];return{...n,runs:e.length>0?e:r}}function $(t){const e=[];let n=0;for(const r of t)e.push(n),n+=r.runs.reduce((t,e)=>t+e.text.length,0)+1;return e}function y(t,e,n,r){return function(t,e,n,r){const o=$(t);return t.map((t,i)=>{const a=o[i],l=t.runs.reduce((t,e)=>t+e.text.length,0),s=Math.max(e-a,0),c=Math.min(n-a,l);if(c<=s)return t;let h=0;const u=function(t,e,n){const r=[];let o=0;for(const i of t){const t=o+i.text.length,a=[e,n].filter(e=>e>o&&e<t).map(t=>t-o);let l=0;for(const t of[...a,i.text.length])t>l&&r.push({...i,text:i.text.slice(l,t)}),l=t;o=t}return r}(t.runs,s,c).map(t=>{const e=h>=s&&h+t.text.length<=c;return h+=t.text.length,e?r(t):t});return m({...t,runs:u})})}(t,e,n,t=>{const e={...t,...r};for(const t of h)void 0===e[t]&&delete e[t];return e})}function w(t,e,n){const r=[],o=$(t);if(t.forEach((t,i)=>{let a=o[i];for(const o of t.runs){const t=a+o.text.length;(e===n?e>a&&e<=t||e===a&&""===o.text:t>e&&a<n)&&r.push(g(o)),a=t}}),0===r.length){let n=0;o.forEach((t,r)=>{t<=e&&(n=r)}),r.push(g(t[n]?.runs[0]??{text:""}))}const i={};for(const t of h){const e=r[0][t];void 0!==e&&r.every(n=>n[t]===e)&&(i[t]=e)}return i}function x(t,e,n){const r=$(t);return t.map((t,e)=>e).filter(o=>r[o]+t[o].runs.reduce((t,e)=>t+e.text.length,0)>=e&&r[o]<=n)}function v(t,e,n,r){const o=new Set(x(t,e,n));return t.map((t,e)=>o.has(e)?m(r(t)):t)}function b(t,e,n,r){const o=x(t,e,n).every(e=>t[e].list===r);return v(t,e,n,t=>({...t,list:o?void 0:r}))}function M(t,e,n,r){return v(t,e,n,t=>({...t,level:Math.max(0,Math.min(4,(t.level??0)+r))}))}function k(t){const e=[];return t.map(t=>{const n=t.level??0;return e.length=n+1,"number"!==t.list?(t.list?e[n]=0:e.length=0,"bullet"===t.list?["•","◦","▪"][n%3]:null):(e[n]=(e[n]??0)+1,`${e[n]}.`)})}var S="data-run",C="data-paragraph",A=t=>t instanceof HTMLElement&&"false"===t.getAttribute("contenteditable");function I(t,e=[]){return A(t)||(t.nodeType===Node.TEXT_NODE?e.push(t):t.childNodes.forEach(t=>I(t,e))),e}var H=t=>I(t).reduce((t,e)=>t+e.data.replace(/\u200b/g,"").length,0);function j(t){const e=[...t.childNodes],n=[];let r=null;const o=(e,n)=>{if(!A(e))if(e.nodeType===Node.TEXT_NODE){const r=e.parentElement?.closest(`[${S}]`),o=r&&t.contains(r)?JSON.parse(r.getAttribute(S)||"{}"):{};n.push({...o,text:(e.textContent??"").replace(//g,"")})}else e.childNodes.forEach(t=>o(t,n))};for(const t of e){if(!(t instanceof HTMLElement&&(t.hasAttribute(C)||/^(DIV|P)$/.test(t.tagName)))){if(t instanceof HTMLElement&&"BR"===t.tagName){r=null;continue}r||(r={runs:[]},n.push(r)),o(t,r.runs);continue}r=null;const e=JSON.parse(t.getAttribute(C)||"{}"),i=[];o(t,i),n.push({...e,runs:i})}return(n.length>0?n:[{runs:[{text:""}]}]).map(m)}function z(t){const e=t.ownerDocument.getSelection();if(!e||0===e.rangeCount)return null;const n=e.getRangeAt(0);if(!t.contains(n.startContainer)||!t.contains(n.endContainer))return null;const r=(e,n)=>{const r=t.ownerDocument.createRange();r.setStart(t,0),r.setEnd(e,n);const o=[...t.childNodes];let i=0;return o.forEach((t,o)=>{if(r.intersectsNode(t)){o>0&&(i+=1);for(const o of I(t))o===e?i+=o.data.slice(0,n).replace(/\u200b/g,"").length:r.isPointInRange(o,o.data.length)&&(i+=o.data.replace(/\u200b/g,"").length)}}),i},o=r(n.startContainer,n.startOffset),i=r(n.endContainer,n.endOffset);return{start:Math.min(o,i),end:Math.max(o,i)}}function L(t,e,n){const r=e=>{const n=[...t.childNodes];let r=0;for(let t=0;t<n.length;t+=1){t>0&&(r+=1);const o=I(n[t]);if(e<=r+H(n[t])){let i=r;for(const t of o){const n=t.data.replace(/\u200b/g,"").length;if(e<=i+n)return[t,0===n?t.data.length:e-i];i+=n}return[n[t],n[t].childNodes.length]}r+=H(n[t])}return[t,t.childNodes.length]},o=t.ownerDocument.getSelection();if(!o)return;const i=t.ownerDocument.createRange(),[a,l]=r(e),[s,c]=r(n);i.setStart(a,l),i.setEnd(s,c),o.removeAllRanges(),o.addRange(i)}var E=24;function F(t,e){const n=t.x+t.w/2,r=t.y+t.h/2,o={n:[0,-t.h/2],e:[t.w/2,0],s:[0,t.h/2],w:[-t.w/2,0]}[e],i=t.rotation*Math.PI/180;return{x:n+o[0]*Math.cos(i)-o[1]*Math.sin(i),y:r+o[0]*Math.sin(i)+o[1]*Math.cos(i)}}function N(t,e,n,r){let o=null;for(const i of t)if(i.id!==r&&"connector"!==i.type)for(const t of["n","e","s","w"]){const r=F(i,t),a=Math.hypot(r.x-e,r.y-n);a<=40&&(!o||a<o.d)&&(o={id:i.id,side:t,...r,d:a})}return o&&{id:o.id,side:o.side,x:o.x,y:o.y}}function P(t,e){const n=Math.min(t.x,e.x),r=Math.min(t.y,e.y),o=Math.max(Math.abs(e.x-t.x),E),i=Math.max(Math.abs(e.y-t.y),E);return{x:n-(o===E?12:0),y:r-(i===E?12:0),w:o,h:i}}function R(t,e,n){return{...t,start:e,end:n,...P(e,n),rotation:0}}function W(t,e){const n=new Map(t.elements.map(t=>[t.id,t]));let r=!1;const o=t.elements.map(t=>{if("connector"!==t.type)return t;const o=r=>{if(!r.attach)return r;const o=n.get(r.attach.id);return o&&"connector"!==o.type?e?.has(t.id)&&!e.has(o.id)?{x:r.x,y:r.y}:{...F(o,r.attach.side),attach:r.attach}:{x:r.x,y:r.y}},i=R(t,o(t.start),o(t.end));return JSON.stringify(i)!==JSON.stringify(t)&&(r=!0),i});return r?{...t,elements:o}:t}function O(t){const e=t.start.x-t.x,n=t.start.y-t.y,r=t.end.x-t.x,o=t.end.y-t.y;if("straight"===t.route)return`M${e},${n} L${r},${o}`;if("elbow"===t.route){if(t.start.attach?"e"===(i=t.start.attach.side)||"w"===i:Math.abs(r-e)>=Math.abs(o-n)){return`M${e},${n} H${(e+r)/2} V${o} H${r}`}return`M${e},${n} V${(n+o)/2} H${r} V${o}`}var i;const a=Math.max(Math.abs(r-e),Math.abs(o-n))/2,l=(t,i,l,s=1)=>{if(!l)return Math.abs(r-e)>=Math.abs(o-n)?[t+s*a,i]:[t,i+s*a];const c={n:[0,-a],e:[a,0],s:[0,a],w:[-a,0]}[l];return[t+c[0],i+c[1]]},[s,c]=l(e,n,t.start.attach?.side,1),[h,u]=l(r,o,t.end.attach?.side,-1);return`M${e},${n} C${s},${c} ${h},${u} ${r},${o}`}import{Fragment as D,useLayoutEffect as T,useRef as V}from"react";import{Fragment as X,jsx as B,jsxs as Z}from"react/jsx-runtime";function Y({shape:t}){const{w:n,h:r,arrowEnd:o,arrowStart:i}=t,a=t.stroke??(t.fill===e?"#2c2c2a":t.fill),l=t.strokeWidth??4,s=r/2,c=Math.min(Math.max(4*l,14),n/2),h=c/2;return Z(X,{children:[B("line",{x1:i?c:0,y1:s,x2:o?n-c:n,y2:s,stroke:a,strokeWidth:l}),i&&B("polygon",{points:`0,${s} ${c},${s-h} ${c},${s+h}`,fill:a}),o&&B("polygon",{points:`${n},${s} ${n-c},${s-h} ${n-c},${s+h}`,fill:a})]})}function J({shape:t}){const{w:e,h:n,fill:r,stroke:o,strokeWidth:i}=t,a={fill:r,stroke:o,strokeWidth:o?i??4:void 0};switch(t.shape){case"line":return null;case"rect":return B("rect",{width:e,height:n,...a});case"ellipse":return B("ellipse",{cx:e/2,cy:n/2,rx:e/2,ry:n/2,...a});case"diamond":return B("polygon",{points:`${e/2},0 ${e},${n/2} ${e/2},${n} 0,${n/2}`,...a});case"roundRect":return B("rect",{width:e,height:n,rx:Math.min(t.radius??Math.min(e,n)/6,e/2,n/2),...a});default:return B("path",{d:s(t.shape,e,n,t.radius),...a,strokeLinejoin:"round"})}}function q({shape:t}){const e=Math.max(t.w,1),n=Math.max(t.h,1);return B("svg",{width:e,height:n,viewBox:`0 0 ${e} ${n}`,"aria-hidden":"true",style:{display:"block",overflow:"visible"},children:"line"===t.shape?B(Y,{shape:t}):B(J,{shape:t})})}import{useLayoutEffect as U,useRef as _,useState as Q}from"react";import{jsx as G,jsxs as K}from"react/jsx-runtime";var tt=e=>`${e?`'${e}', `:""}${t}, ui-sans-serif, system-ui, sans-serif`,et=1.4;function nt(t,e,n=1){const r=[e.underline||e.link?"underline":"",e.strike?"line-through":""].filter(Boolean).join(" ");return{fontFamily:e.font||t.font?tt(e.font??t.font):void 0,fontSize:e.size?e.size*n:void 0,fontWeight:void 0===e.bold?void 0:e.bold?700:400,fontStyle:e.italic?"italic":void 0,textDecoration:r||void 0,color:e.color,background:e.highlight}}function rt(t,e){const n=e.level??0,r=e.list?1:0;return{margin:0,textAlign:e.align??t.align,lineHeight:e.lineHeight??1.25,paddingLeft:n*et+r*et+"em",position:"relative",minHeight:`${e.lineHeight??1.25}em`}}function ot(t,e=1){return{fontFamily:tt(t.font),fontSize:t.fontSize*e,fontWeight:t.bold?700:400,color:t.color,whiteSpace:"pre-wrap",overflowWrap:"break-word"}}var it={position:"absolute",left:0,width:"1.4em",textAlign:"left"};function at({marker:t,level:e}){return t?G("span",{"aria-hidden":"true",contentEditable:!1,style:{...it,left:e*et+"em"},children:t}):null}function lt({el:t,run:e,scale:n,onLink:r}){const o=nt(t,e,n);return e.link&&r?G("a",{href:e.link,style:{...o,color:o.color??"inherit",cursor:"pointer"},onClick:t=>{t.preventDefault(),t.stopPropagation(),r(e.link)},children:e.text}):G("span",{style:o,children:e.text})}function st({element:t,onLink:e}){const n=u(t),r=k(n),o=_(null),[i,a]=Q(1),l=t.autofit,s=JSON.stringify([n,t.fontSize,t.w,t.h,t.font]);U(()=>{if(!l)return void a(1);const e=o.current;if(!e)return;let n=.2,r=1;if(e.style.fontSize=`${t.fontSize}px`,e.scrollHeight<=t.h+1)a(1);else{for(let o=0;o<8;o+=1){const o=(n+r)/2;e.style.fontSize=t.fontSize*o+"px",e.scrollHeight<=t.h+1?n=o:r=o}e.style.fontSize="",a(n)}},[l,s]);const c={top:"flex-start",middle:"center",bottom:"flex-end"}[t.anchor??"top"];return G("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:c,overflow:l?"hidden":void 0},children:G("div",{ref:o,style:ot(t,i),children:n.map((n,o)=>K("div",{"data-slide-paragraph":"",style:rt(t,n),children:[G(at,{marker:r[o],level:n.level??0}),n.runs.map((n,r)=>G(lt,{el:t,run:n,scale:i,onLink:e},r)),n.runs.every(t=>!t.text)&&""]},o))})})}function ct(t,e){const n=k(e),r=t=>Object.entries(t).filter(([,t])=>void 0!==t&&""!==t).map(([t,e])=>`${t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}:${"number"!=typeof e||/weight|height/i.test(t)?e:`${e}px`}`).join(";"),o=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");return e.map((e,i)=>{const{runs:a,...l}=e,s=e.level??0,c=n[i]?`<span contenteditable="false" aria-hidden="true" style="${r({...it,left:s*et+"em"})}">${o(n[i])}</span>`:"",h=a.map(e=>`<span ${S}="${o(JSON.stringify(g(e)))}" style="${r(nt(t,e))}">${o(e.text)||""}</span>`).join("");return`<div ${C}="${o(JSON.stringify(l))}" style="${r(rt(t,e))}">${c}${h}</div>`}).join("")}function ht(t){return t.series&&t.series.length>0&&t.categories?{categories:t.categories,series:t.series}:{categories:t.points.map(t=>t.label),series:[{name:"",color:t.color,values:t.points.map(t=>t.value)}]}}function ut(t){const{categories:e,series:n}=ht(t);return[["",...n.map(t=>t.name)],...e.map((t,e)=>[t,...n.map(t=>String(t.values[e]??""))])]}function dt(t,e,n){const r=ht(t).series,o=Math.max(1,...e.map(t=>t.length)),i=(e[0]??[]).slice(1),a=e.slice(1),l=Array.from({length:o-1},(t,e)=>({name:i[e]?.trim()??"",color:r[e]?.color??n[e%n.length],values:a.map(t=>{const n=Number((t[e+1]??"").trim());return Number.isFinite(n)?n:0})}));return function(t,e,n){const r=n[0]??{name:"",color:t.color,values:[]};return{...t,categories:e,series:n.map(t=>({...t,values:e.map((e,n)=>t.values[n]??0)})),color:r.color,points:e.map((t,e)=>({label:t,value:r.values[e]??0}))}}(t,a.map(t=>(t[0]??"").trim()),l)}var ft=.5;function pt(t,e="fadeIn"){return{id:o(),elementId:t,effect:e,start:"click",duration:.5,..."flyIn"===e?{from:"bottom"}:{}}}function gt(t){const e=(t.animations??[]).filter(e=>t.elements.some(t=>t.id===e.elementId)),n=[[]];let r=0,o=0;for(const t of e){if("click"===t.start){n.push([{animation:t,delay:0}]),o=0,r=t.duration;continue}const e=n[n.length-1],i="withPrevious"===t.start?o:r;e.push({animation:t,delay:i}),o=i,r=Math.max(r,i+t.duration)}return n}var mt=t=>gt(t).length-1,$t=new Set(["appear","fadeIn","flyIn","zoomIn"]),yt=t=>$t.has(t);function wt(t,e){const n=gt(t),r=new Set;return n.forEach((t,n)=>{for(const{animation:o}of t)yt(o.effect)&&n>e&&r.add(o.elementId),!yt(o.effect)&&n<e&&r.add(o.elementId)}),{hidden:r,playing:n[Math.min(e,n.length-1)]??[]}}function xt(t){switch(t.effect){case"appear":return[{opacity:0},{opacity:0,offset:.99},{opacity:1}];case"fadeIn":return[{opacity:0},{opacity:1}];case"zoomIn":return[{opacity:0,transform:"scale(0.3)"},{opacity:1,transform:"scale(1)"}];case"fadeOut":return[{opacity:1},{opacity:0}];case"flyIn":return[{opacity:0,transform:{left:"translateX(-1200px)",right:"translateX(1200px)",top:"translateY(-900px)",bottom:"translateY(900px)"}[t.from??"bottom"]},{opacity:1,transform:"translate(0, 0)"}]}}function vt(t){switch(t.kind){case"fade":return{incoming:[{opacity:0},{opacity:1}],outgoing:[{opacity:1},{opacity:1}]};case"slide":return{incoming:[{transform:"translateX(100%)"},{transform:"translateX(0)"}],outgoing:[{opacity:1},{opacity:1}]};case"push":return{incoming:[{transform:"translateX(100%)"},{transform:"translateX(0)"}],outgoing:[{transform:"translateX(0)"},{transform:"translateX(-100%)"}]};case"zoom":return{incoming:[{opacity:0,transform:"scale(0.6)"},{opacity:1,transform:"scale(1)"}],outgoing:[{opacity:1},{opacity:0}]};case"flip":return{incoming:[{transform:"perspective(2000px) rotateY(-90deg)",offset:0},{transform:"perspective(2000px) rotateY(-90deg)",offset:.5},{transform:"perspective(2000px) rotateY(0deg)"}],outgoing:[{transform:"perspective(2000px) rotateY(0deg)"},{transform:"perspective(2000px) rotateY(90deg)",offset:.5},{transform:"perspective(2000px) rotateY(90deg)"}]}}}function bt(t){const e=t.map((t,e)=>t.skip?-1:e).filter(t=>-1!==t);return e.length>0?e:t.map((t,e)=>e)}function Mt(t,e,n){const r=[...t],[o]=r.splice(e,1);return r.splice(Math.max(0,Math.min(n,r.length)),0,o),r}var kt=(t,e,n)=>t&&[...t.slice(0,e),n,...t.slice(e)],St=(t,e)=>t&&t.filter((t,n)=>n!==e);function Ct(t,e,n,r){if(!t)return t;const o="row"===e?"rows":"cols";return t.flatMap(t=>{const i=t[e],a=i+t[o];return 1===r?n<=i?[{...t,[e]:i+1}]:n<a?[{...t,[o]:t[o]+1}]:[t]:n<i?[{...t,[e]:i-1}]:n<a?t[o]>2?[{...t,[o]:t[o]-1}]:[]:[t]})}function At(t,e){const n=t.rows[0]?.length??1,r=t.rowHeights&&kt(t.rowHeights,e,t.rowHeights[Math.max(0,e-1)]??80);return{...t,rows:kt(t.rows,e,Array(n).fill("")),rowHeights:r,cellFills:kt(t.cellFills,e,Array(n).fill(null)),cellColors:kt(t.cellColors,e,Array(n).fill(null)),merges:Ct(t.merges,"row",e,1)}}function It(t,e){return t.rows.length<=1?t:{...t,rows:St(t.rows,e),rowHeights:St(t.rowHeights,e),cellFills:St(t.cellFills,e),cellColors:St(t.cellColors,e),merges:Ct(t.merges,"row",e,-1)}}function Ht(t,e){const n=(t.rows[0]?.length??0)+1;return{...t,rows:t.rows.map(t=>kt(t,e,"")),columnWidths:t.columnWidths&&(r=n,Array(r).fill(1/r)),cellFills:t.cellFills?.map(t=>kt(t,e,null)),cellColors:t.cellColors?.map(t=>kt(t,e,null)),merges:Ct(t.merges,"col",e,1)};var r}function jt(t,e){if((t.rows[0]?.length??0)<=1)return t;const n=t.columnWidths&&St(t.columnWidths,e),r=n?.reduce((t,e)=>t+e,0)||1;return{...t,rows:t.rows.map(t=>St(t,e)),columnWidths:n?.map(t=>t/r),cellFills:t.cellFills?.map(t=>St(t,e)),cellColors:t.cellColors?.map(t=>St(t,e)),merges:Ct(t.merges,"col",e,-1)}}var zt=(t,e,n)=>t.merges?.find(t=>e>=t.row&&e<t.row+t.rows&&n>=t.col&&n<t.col+t.cols);function Lt(t,e){if(e.rows*e.cols<2)return t;let{row:n,col:r,rows:o,cols:i}=e;const a=(t.merges??[]).filter(t=>t.row<n+o&&n<t.row+t.rows&&t.col<r+i&&r<t.col+t.cols);for(const t of a){const e=Math.max(n+o,t.row+t.rows),a=Math.max(r+i,t.col+t.cols);n=Math.min(n,t.row),r=Math.min(r,t.col),o=e-n,i=a-r}const l=[],s=t.rows.map((t,e)=>t.map((t,a)=>e>=n&&e<n+o&&a>=r&&a<r+i?(t.trim()&&l.push(t.trim()),""):t));s[n][r]=l.join(" ");const c=(t.merges??[]).filter(t=>!a.includes(t));return{...t,rows:s,merges:[...c,{row:n,col:r,rows:o,cols:i}]}}function Et(t,e,n){const r=zt(t,e,n);if(!r)return t;const o=t.merges.filter(t=>t!==r);return{...t,merges:o.length>0?o:void 0}}function Ft(t,e,n,r){return{...t,rows:t.rows.map((t,o)=>o===e?t.map((t,e)=>e===n?r:t):t)}}import{jsx as Nt,jsxs as Pt}from"react/jsx-runtime";var Rt=tt();function Wt(t){return{position:"absolute",left:t.x,top:t.y,width:t.w,height:t.h,transform:t.rotation?`rotate(${t.rotation}deg)`:void 0}}var Ot="#444441";function Dt(t){const e=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i.exec(t);if(!e)return Ot;const[n,r,o]=[e[1],e[2],e[3]].map(t=>parseInt(t,16)/255).map(t=>t<=.03928?t/12.92:((t+.055)/1.055)**2.4);return.2126*n+.7152*r+.0722*o<.25?"#f1efe8":Ot}function Tt({names:t,colors:e,side:n,ink:r}){return Nt("div",{style:{display:"flex",flexDirection:"right"===n?"column":"row",gap:24,justifyContent:"center",fontFamily:Rt,fontSize:28,color:r,padding:8},children:t.map((t,n)=>Pt("span",{style:{display:"inline-flex",alignItems:"center",gap:10,whiteSpace:"nowrap"},children:[Nt("span",{style:{width:22,height:22,background:e[n],display:"inline-block"}}),t]},n))})}function Vt({chart:t,w:e,h:n,ink:r}){const{categories:o,series:i}=ht(t),{kind:a}=t;if("pie"===a||"donut"===a){const r=i[0]?.values??[],l=r.reduce((t,e)=>t+Math.max(e,0),0)||1,s=Math.min(e,n)/2-8,c=e/2,h=n/2;let u=-Math.PI/2;const d=Bt(t,o.length);return Pt("svg",{width:e,height:n,viewBox:`0 0 ${e} ${n}`,role:"img","aria-label":"Chart",style:{display:"block"},children:[r.map((t,e)=>{const n=Math.max(t,0)/l*Math.PI*2,r=u;if(u+=n,n>=2*Math.PI-1e-6)return Nt("circle",{cx:c,cy:h,r:s,fill:d[e]},e);const o=n>Math.PI?1:0,i=t=>`${c+s*Math.cos(t)},${h+s*Math.sin(t)}`;return Nt("path",{d:`M${c},${h} L${i(r)} A${s},${s} 0 ${o} 1 ${i(u)} Z`,fill:d[e],stroke:"#ffffff",strokeWidth:4},e)}),"donut"===a&&Nt("circle",{cx:c,cy:h,r:.55*s,fill:"#ffffff"})]})}const l=(t=>Math.max(1,...t.flatMap(t=>t.values)))(i),s=Math.max(o.length,1);if("hbar"===a){const t=Math.min(240,.25*e),a=n/s,c=.7*a/Math.max(i.length,1),h=n=>Math.max(n,0)/l*(e-t-90);return Nt("svg",{width:e,height:n,viewBox:`0 0 ${e} ${n}`,role:"img","aria-label":"Chart",style:{display:"block"},children:o.map((e,n)=>Pt("g",{fontFamily:Rt,fontSize:30,fill:r,children:[Nt("text",{x:t-12,y:a*n+a/2+10,textAnchor:"end",children:e}),i.map((e,r)=>Pt(D,{children:[Nt("rect",{x:t,y:a*n+.15*a+c*r,width:h(e.values[n]??0),height:c,fill:e.color}),1===i.length&&Nt("text",{x:t+h(e.values[n]??0)+12,y:a*n+a/2+10,children:e.values[n]})]},r))]},n))})}const c=n-56,h=e/s,u=t=>c-Math.max(t,0)/l*(c-40),d=t=>h*t+h/2;return Pt("svg",{width:e,height:n,viewBox:`0 0 ${e} ${n}`,role:"img","aria-label":"Chart",style:{display:"block"},children:[i.map((t,e)=>{if("line"===a||"area"===a){const n=t.values.map((t,e)=>`${d(e)},${u(t)}`).join(" ");return Pt("g",{children:["area"===a&&Nt("polygon",{points:`${d(0)},${c} ${n} ${d(t.values.length-1)},${c}`,fill:t.color,fillOpacity:.35}),Nt("polyline",{fill:"none",stroke:t.color,strokeWidth:8,points:n})]},e)}const n=.7*h/i.length;return t.values.map((r,o)=>Nt("rect",{x:h*o+.15*h+n*e,y:u(r),width:n,height:c-u(r),fill:t.color},`${e}-${o}`))}),o.map((t,e)=>Pt("g",{fontFamily:Rt,fontSize:30,fill:r,textAnchor:"middle",children:[Nt("text",{x:d(e),y:n-14,children:t}),1===i.length&&Nt("text",{x:d(e),y:u(i[0].values[e]??0)-12,children:i[0].values[e]})]},e))]})}var Xt=["#534ab7","#1d9e75","#d85a30","#ef9f27","#378add","#d4537e","#5f5e5a","#97c459"];function Bt(t,e){const n=ht(t).series[0]?.color??t.color,r=Xt.filter(t=>t.toLowerCase()!==n.toLowerCase());return Array.from({length:e},(t,e)=>0===e?n:r[(e-1)%r.length])}function Zt({chart:t,ink:e=Ot}){const{categories:n,series:r}=ht(t),o="pie"===t.kind||"donut"===t.kind,i=t.legend??(o||r.length>1?"bottom":"none"),a=o?n:r.map(t=>t.name),l=o?Bt(t,n.length):r.map(t=>t.color);if("none"===i)return Nt(Vt,{chart:t,w:t.w,h:t.h,ink:e});const s="right"===i,c=s?Math.min(360,.3*t.w):t.w,h=s?t.h:64;return Pt("div",{style:{display:"flex",flexDirection:s?"row":"column",width:t.w,height:t.h},children:[Nt(Vt,{chart:t,w:s?t.w-c:t.w,h:s?t.h:t.h-h,ink:e}),Nt("div",{style:{width:s?c:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:Nt(Tt,{names:a,colors:l,side:i,ink:e})})]})}var Yt="#2c2c2a";function Jt({table:t,cellEditor:e,ink:n}){const r=t.fontSize??32,o=t.borderWidth??2,i=t.borderColor??"#b4b2a9",a=t.rows[0]?.length??0,{columnWidths:l,rowHeights:s}=t,c=s?.slice(0,t.rows.length).reduce((t,e)=>t+e,0)??0,h=e=>s?.[e]&&c?s[e]*(t.h-o)/c:void 0;return Pt("table",{style:{width:"100%",height:"100%",borderCollapse:"collapse",fontFamily:Rt,fontSize:r,lineHeight:t.fontSize?1.2:void 0,color:n&&n!==Ot?n:Yt,tableLayout:"fixed"},children:[l?.length===a&&Nt("colgroup",{children:l.map((t,e)=>Nt("col",{style:{width:100*t+"%"}},e))}),Nt("tbody",{children:t.rows.map((a,l)=>Nt("tr",{style:{height:h(l),background:0===l?t.headerFill:void 0,color:0===l?t.headerColor??(n&&n!==Ot?Yt:void 0):void 0,fontWeight:0===l?500:400},children:a.map((n,a)=>{const s=zt(t,l,a);return!s||s.row===l&&s.col===a?Nt("td",{"data-cell":`${l}:${a}`,rowSpan:s?.rows,colSpan:s?.cols,style:{border:o?`${o}px solid ${i}`:"none",padding:`${.25*r}px ${.5*r}px`,overflow:"hidden",background:t.cellFills?.[l]?.[a]??void 0,color:t.cellColors?.[l]?.[a]??void 0,verticalAlign:"top"},children:e?.(l,a)??n},a):null})},l))})]})}function qt({image:t}){if(!t.src)return Nt("div",{style:{width:"100%",height:"100%",background:"#f1efe8",border:"4px dashed #b4b2a9",boxSizing:"border-box"}});const e=t.crop??{left:0,top:0,right:0,bottom:0},n=Math.max(.05,1-e.left-e.right),r=Math.max(.05,1-e.top-e.bottom),o=e.left||e.top||e.right||e.bottom,i=Nt("img",{src:t.src,alt:t.alt,draggable:!1,style:o?{position:"absolute",width:100/n+"%",height:100/r+"%",left:-e.left/n*100+"%",top:-e.top/r*100+"%",objectFit:"fill",display:"block"}:{width:"100%",height:"100%",objectFit:"contain",display:"block"}});return Nt("div",{style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",opacity:t.opacity??1},children:i})}function Ut(t){if(!t)return null;const e=t.match(/(?:youtube\.com\/(?:watch\?(?:.*&)?v=|embed\/|shorts\/)|youtu\.be\/)([\w-]{6,})/);if(e)return{kind:"youtube",id:e[1]};const n=t.match(/vimeo\.com\/(?:video\/)?(\d+)/);return n?{kind:"vimeo",id:n[1]}:{kind:"file"}}function _t({video:t,live:e}){const n=Ut(t.src),r={width:"100%",height:"100%",border:0,display:"block",background:"#000"};if(e&&"youtube"===n?.kind)return Nt("iframe",{title:t.alt||"Video",src:`https://www.youtube-nocookie.com/embed/${n.id}`,style:r,allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0});if(e&&"vimeo"===n?.kind)return Nt("iframe",{title:t.alt||"Video",src:`https://player.vimeo.com/video/${n.id}`,style:r,allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0});if(e&&"file"===n?.kind)return Nt("video",{src:t.src,controls:!0,style:r,"aria-label":t.alt||"Video"});const o="youtube"===n?.kind?`https://img.youtube.com/vi/${n.id}/hqdefault.jpg`:null;return Pt("div",{style:{position:"relative",width:"100%",height:"100%",background:"#2c2c2a",overflow:"hidden"},children:[o&&Nt("img",{src:o,alt:t.alt,draggable:!1,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}),Pt("svg",{viewBox:"0 0 100 100","aria-hidden":"true",style:{position:"absolute",left:"50%",top:"50%",width:140,height:140,marginLeft:-70,marginTop:-70},children:[Nt("circle",{cx:"50",cy:"50",r:"48",fill:"rgba(0,0,0,0.55)"}),Nt("polygon",{points:"40,30 72,50 40,70",fill:"#ffffff"})]})]})}function Qt({connector:t}){const{w:e,h:n,stroke:r,strokeWidth:o}=t,i=Math.max(4*o,14),a=e=>{const n="end"===e?t.end:t.start,o=function(t,e){const n="end"===e?t.end:t.start,r=n.attach?.side;if("straight"!==t.route&&r)return{n:Math.PI/2,e:Math.PI,s:-Math.PI/2,w:0}[r];const o="end"===e?t.start:t.end;if("elbow"===t.route){return(t.start.attach?"e"===t.start.attach.side||"w"===t.start.attach.side:Math.abs(t.end.x-t.start.x)>=Math.abs(t.end.y-t.start.y))?n.x>=o.x?0:Math.PI:n.y>=o.y?Math.PI/2:-Math.PI/2}return Math.atan2(n.y-o.y,n.x-o.x)}(t,e)+("start"===e?Math.PI:0),a=n.x-t.x,l=n.y-t.y,s=t=>`${a-i*Math.cos(o)+t*(i/2)*Math.sin(o)},${l-i*Math.sin(o)-t*(i/2)*Math.cos(o)}`;return Nt("polygon",{points:`${a},${l} ${s(1)} ${s(-1)}`,fill:r})};return Pt("svg",{width:Math.max(e,1),height:Math.max(n,1),viewBox:`0 0 ${Math.max(e,1)} ${Math.max(n,1)}`,"aria-hidden":"true",style:{display:"block",overflow:"visible"},children:[Nt("path",{d:O(t),fill:"none",stroke:r,strokeWidth:o,strokeLinejoin:"round"}),t.arrowStart&&a("start"),t.arrowEnd&&a("end")]})}function Gt({element:t,options:e={}}){switch(t.type){case"text":return Nt(st,{element:t,onLink:e.onLink});case"shape":return Nt(q,{shape:t});case"image":return Nt(qt,{image:t});case"video":return Nt(_t,{video:t,live:e.live});case"connector":return Nt(Qt,{connector:t});case"chart":return Nt(Zt,{chart:t,ink:e.ink});case"table":return Nt(Jt,{table:t,cellEditor:e.cellEditor,ink:e.ink})}}function Kt({slide:e,width:o,editingId:i,editor:a,number:l,motion:s,options:c}){const h=o/r,u=V(null);return function(t,e){T(()=>{const n=t.current;if(!n||!e)return;const r=[];for(const{animation:t,delay:o}of e.playing){const e=n.querySelector(`[data-element="${CSS.escape(t.elementId)}"]`);if(!e)continue;const i=xt(t),a={duration:1e3*t.duration,delay:1e3*o,fill:"both",easing:"ease-out"},l=t.byParagraph?[...e.querySelectorAll("[data-slide-paragraph]")]:[];l.length>1?(l.forEach((e,n)=>r.push(e.animate(i,{...a,delay:1e3*(o+n*t.duration)}))),e.style.visibility="visible"):r.push(e.animate(i,a))}return()=>r.forEach(t=>t.cancel())},[t,e])}(u,s),Nt("div",{style:{width:o,height:n*h,overflow:"hidden",position:"relative",background:e.background},children:Pt("div",{ref:u,style:{width:r,height:n,transform:`scale(${h})`,transformOrigin:"0 0",position:"absolute",left:0,top:0},children:[e.elements.map(t=>Nt("div",{"data-element":t.id,style:{...Wt(t),visibility:s?.hidden.has(t.id)?"hidden":void 0},children:t.id===i?a:Nt(Gt,{element:t,options:{...c,ink:Dt(e.background)}})},t.id)),void 0!==l&&Nt("div",{style:{position:"absolute",right:60,bottom:36,fontFamily:`${t}, sans-serif`,fontSize:28,color:Dt(e.background)===Ot?"#888780":"#b4b2a9"},children:l})]})})}export{s as shapePath,c as PPTX_SHAPES,u as paragraphsOf,d as plainText,f as withParagraphs,y as applyStyle,w as styleAt,x as paragraphsIn,v as setParagraphs,b as toggleList,M as indent,k as listMarkers,j as readParagraphs,z as selectionOffsets,L as restoreSelection,ot as boxStyle,ct as editorHtml,ht as seriesOf,ut as chartToGrid,dt as gridToChart,N as nearestSide,R as withEnds,W as relayConnectors,O as connectorPath,ft as DEFAULT_TRANSITION_SECONDS,pt as newAnimation,mt as clicksOf,wt as stateAt,vt as transitionKeyframes,bt as shownSlides,Mt as moveAnimation,At as insertRow,It as removeRow,Ht as insertColumn,jt as removeColumn,zt as mergeAt,Lt as mergeCells,Et as unmergeCell,Ft as setCell,Rt as SLIDE_FONT,Ut as videoSource,Kt as SlideView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={open:"Open",fromComputer:"From this computer",fromDrive:"From Efficient Drive",rename:"Rename",delete:"Delete",name:"Name",renameFailed:"Couldn't rename this file.",choosing:(e,o)=>`Choosing a ${e} file for ${o}`,opening:e=>`Opening ${e}…`,openFailed:e=>`Couldn't open ${e}. Check that it isn't damaged or password-protected.`,savedCopy:(e,o,n)=>`${n?`Saved to ${n} as ${e}`:`Saved as ${e}`}. Your ${o} is unchanged.`},o={open:"打开",fromComputer:"从此电脑",fromDrive:"从 Efficient 云盘",rename:"重命名",delete:"删除",name:"名称",renameFailed:"无法重命名此文件。",choosing:(e,o)=>`正在为${o}选择 ${e} 文件`,opening:e=>`正在打开 ${e}…`,openFailed:e=>`无法打开 ${e}。请确认文件未损坏且没有密码保护。`,savedCopy:(e,o,n)=>`${n?`已保存到 ${n},名为 ${e}`:`已保存为 ${e}`}。原文件 ${o} 未作更改。`};export{e as ENGLISH_FILE_WORDS,o as ZH_HANS_FILE_WORDS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readXlsx as t}from"./chunk-N26CBJZA.js";import{formatKey as e,newSheet as r,parseCsv as s,sheetFromRows as n,writeCells as c}from"./chunk-VKCG3LPQ.js";import{titleOf as a}from"./chunk-XYVQTQ6N.js";async function o(t){const s=await(import("xlsx")),n=s.read(t,{type:"array",cellFormula:!0,cellNF:!0});return n.SheetNames.map(t=>{const a=n.Sheets[t],o=r(t),i=[],f={};if(a["!ref"]){const t=s.utils.decode_range(a["!ref"]);for(let r=t.s.r;r<=t.e.r;r++)for(let n=t.s.c;n<=t.e.c;n++){const t=a[s.utils.encode_cell({r:r,c:n})];if(!t||void 0===t.v&&!t.f)continue;const c=t.f?`=${t.f}`:"b"===t.t?t.v?"TRUE":"FALSE":String(t.v);i.push({row:r,col:n,raw:"s"===t.t&&/^(?:=|-?\d|'|true$|false$)/i.test(c)?`'${c}`:c}),t.z&&"General"!==t.z&&(f[e(r,n)]={numFmt:t.z})}}const l={};(a["!cols"]??[]).forEach((t,e)=>{t?.wpx&&(l[e]=t.wpx)});const m=(a["!merges"]??[]).map(t=>({r1:t.s.r,c1:t.s.c,r2:t.e.r,c2:t.e.c}));return{...c(o,i),formats:f,colWidths:l,merges:m}})}async function i(e,r,c="Sheet1"){const i=await async function(e,r){if(/\.(xlsx|xls|ods)$/i.test(e.name)){const r=new Uint8Array(await e.arrayBuffer());return/\.xlsx$/i.test(e.name)&&"undefined"!=typeof DecompressionStream?t(r):o(r)}const c=s(await e.text());return[n(r,c.length?c:[[""]])]}(r,c),f=a(r.name),l=await e.create(f);try{await e.save(l.id,{sheets:i},l.version)}catch(t){throw await e.remove(l.id).catch(()=>{}),t}return{id:l.id,title:f}}export{o as readWithSheetJs,i as importSpreadsheetFile};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ENGLISH_WORDS as t}from"./chunk-
|
|
1
|
+
import{ENGLISH_WORDS as t}from"./chunk-PXOQN7D6.js";import{createContext as e,useContext as r}from"react";import{jsx as o}from"react/jsx-runtime";var n=class extends Error{},a="efficient-office:slides",c=()=>{try{return JSON.parse(localStorage.getItem(a)??"{}")}catch{return{}}},s=t=>localStorage.setItem(a,JSON.stringify(t)),i={list:async()=>Object.values(c()).map(({id:t,title:e,updatedAt:r})=>({id:t,title:e,updatedAt:r})).sort((t,e)=>e.updatedAt.localeCompare(t.updatedAt)),get:async t=>{const e=c()[t];if(!e)throw new Error("No such deck");return e},create:async t=>{const e=(new Date).toISOString(),r={id:crypto.randomUUID(),title:t,document:{},version:crypto.randomUUID(),updatedAt:e};return s({...c(),[r.id]:r}),r},rename:async(t,e)=>{const r=c();r[t]&&s({...r,[t]:{...r[t],title:e,updatedAt:(new Date).toISOString()}})},save:async(t,e,r)=>{const o=c();if(!o[t]||o[t].version!==r)throw new n;const a=crypto.randomUUID();return s({...o,[t]:{...o[t],document:e,version:a,updatedAt:(new Date).toISOString()}}),a},remove:async t=>{const{[t]:e,...r}=c();s(r)}},d=e({store:i});function u({value:t,children:e}){return o(d.Provider,{value:t,children:e})}var l=()=>r(d),m=()=>r(d).words??t;export{n as SlidesConflict,i as browserSlidesStore,u as SlidesProvider,l as useSlidesHost,m as useSlidesWords};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BUILTIN_STYLES as t,DEFAULT_PAGE as e,REL as n,child as r,childrenOf as a,descendants as o,paraCss as s,parseParaProps as l,parseRunProps as c,parseXml as i,partText as d,readRels as w,readThemeFonts as m,readZip as p,resolveTarget as f,runCss as u}from"./chunk-RHW2M2UY.js";import{escapeHtml as b}from"efficient-shell/ui";var h={textBox:"Text box",chart:"Chart",diagram:"Diagram",equation:"Equation",picture:"Picture",object:"Object",contents:"Field"},g=new Set(["w:ins","w:del","w:moveFrom","w:moveTo","w:rPrChange","w:pPrChange","w:tcPrChange","w:trPrChange","w:tblPrChange","w:sectPrChange","w:cellIns","w:cellDel"]),$=new Set(["w:ins","w:del","w:moveFrom","w:moveTo"]),v={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",bmp:"image/bmp",webp:"image/webp",svg:"image/svg+xml"},x=/^(https?:|mailto:|tel:)/i,k=t=>b(t);function y(t,e){let n="";for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return`data:${e};base64,${btoa(n)}`}var P=(t,e)=>`${e}${++t.nextId}`,j=(t,e)=>t.src.slice(e.start,e.end),C=(t,e)=>e?j(t,e):void 0;function S(t,e){const n=[],a=new Set;let o=e;for(;o&&!a.has(o);){a.add(o);const e=t.styles.get(o);if(!e)break;n.unshift(e),o=r(e,"w:basedOn")?.attrs["w:val"]}return n}var I=t=>`"${t.replace(/["\\\n\r]/g,"")}"`;function M(t){return"w:t"===t.name||"w:delText"===t.name?t.text:"w:tab"===t.name?"\t":"w:instrText"===t.name||"w:instrDelText"===t.name?"":t.children.map(M).join("")}function T(t,e,n,r,a=""){const o=P(t,"x");return t.doc.raw.set(o,e),`<span data-raw="${o}" data-kind="${n}" contenteditable="false"${a}>${b(r)}</span>`}function N(t,e){const n=P(t,"x");return t.doc.raw.set(n,e),`<span data-raw="${n}" data-kind="mark"></span>`}function B(t,e,n){const a=n(j(t,e)),s=t=>o(e,new Set([t])).length>0,l=r(e,"wp:inline"),c=o(e,new Set(["a:blip"]))[0],i=c&&t.rels.get(c.attrs["r:embed"]),d=i&&!i.external?f(t.doc.docPath,i.target):void 0,w=d?.split(".").pop()?.toLowerCase()??"",m=d?t.doc.parts.get(d):void 0;if(m&&v[w]&&!s("wps:txbx")){const n=P(t,"x");t.doc.raw.set(n,a);const o=r(l??r(e,"wp:anchor"),"wp:extent"),s=Number(o?.attrs.cx)/12700,c=Number(o?.attrs.cy)/12700,i=s&&c?` style="width:${Math.round(100*s)/100}pt;height:${Math.round(100*c)/100}pt"`:"",d=l?"":' contenteditable="false"';return l||t.doc.notices.objects++,`<img data-raw="${n}" src="${k(t.imageUrl(m,v[w]))}"${i}${d} alt="">`}return t.doc.notices.objects++,s("wps:txbx")||s("w:txbxContent")?T(t,a,"object",`${t.labels.textBox}: ${M(e).slice(0,80)}`):s("c:chart")?T(t,a,"object",t.labels.chart):s("dgm:relIds")?T(t,a,"object",t.labels.diagram):T(t,a,"object",c?t.labels.picture:t.labels.object)}function A(t,e){const n=r(e,"w:rPr"),a=c(n,t.theme),s=C(t,n)??"",l=t=>`<w:r>${s}${t}</w:r>`;let i="";for(const n of e.children)switch(n.name){case"w:rPr":case"w:lastRenderedPageBreak":case"w:commentReference":case"w:fldChar":case"w:instrText":case"w:delInstrText":break;case"w:t":case"w:delText":i+=b(n.text);break;case"w:tab":i+="\t";break;case"w:noBreakHyphen":i+="‑";break;case"w:softHyphen":i+="";break;case"w:br":case"w:cr":"page"===n.attrs["w:type"]?i+='<span data-page-break contenteditable="false"></span>':"column"===n.attrs["w:type"]?i+=T(t,l(j(t,n)),"mark",""):i+="<br>";break;case"w:drawing":i+=B(t,n,l);break;case"mc:AlternateContent":case"w:pict":case"w:object":t.doc.notices.objects++,i+=T(t,l(j(t,n)),"object",o(n,new Set(["wps:txbx","w:txbxContent","v:textbox"])).length?`${t.labels.textBox}: ${M(o(n,new Set(["wps:txbx","w:txbxContent","v:textbox"]))[0]).slice(0,80)}`:t.labels.object);break;case"w:footnoteReference":case"w:endnoteReference":{const e=++t.footnoteCount;t.doc.notices.footnotes++;const r=t.footnotes.get(n.attrs["w:id"]);i+=T(t,l(j(t,n)),"note",String(e),r?` title="${k(r)}"`:"");break}default:i+=T(t,l(j(t,n)),"mark","")}if(!i)return"";if(a.vert&&(i=`<${"sub"===a.vert?"sub":"sup"}>${i}</${"sub"===a.vert?"sub":"sup"}>`),n){const e=P(t,"r");t.doc.runs.set(e,s);const o=u(a),l=r(n,"w:rStyle")?.attrs["w:val"];i=`<span data-r="${e}"${l?` data-rstyle="${k(l)}"`:""}${o?` style="${k(o)}"`:""}>${i}</span>`}for(const e of t.openComments)i=`<span data-comment="${k(e)}" title="${k(t.comments.get(e)??"")}">${i}</span>`;return i}function E(t,e){let n="",r=0,o=-1,s=-1,l="",c=!1;const i=()=>{o>=0&&(n+=T(t,t.src.slice(o,s),"field",l||t.labels.contents)),o=-1,l="",c=!1};for(const d of e){if("w:r"===d.name){const e=a(d,"w:fldChar");if(e.length||r>0){0===r&&(o=d.start,c=!1),c&&(l+=M(d));for(const t of e){const e=t.attrs["w:fldCharType"];"begin"===e?r++:"separate"===e&&1===r?c=!0:"end"===e&&r--}s=d.end,0===r&&i();continue}n+=A(t,d);continue}if(r>0)s=d.end;else switch(d.name){case"w:pPr":case"w:proofErr":break;case"w:commentRangeStart":t.openComments.add(d.attrs["w:id"]);break;case"w:commentRangeEnd":t.openComments.delete(d.attrs["w:id"]);break;case"w:hyperlink":{const e=d.attrs["r:id"]?t.rels.get(d.attrs["r:id"]):void 0,r=d.attrs["w:anchor"],a=e?.target??(r?`#${r}`:""),o=x.test(a)||a.startsWith("#"),s=`${e?` data-rel="${k(d.attrs["r:id"])}"`:""}${r?` data-anchor="${k(r)}"`:""}`;n+=`<a${o?` href="${k(a)}"`:""}${s}>${E(t,d.children)}</a>`;break}case"w:ins":case"w:moveTo":n+=`<ins>${E(t,d.children)}</ins>`;break;case"w:del":case"w:moveFrom":n+=`<del>${E(t,d.children)}</del>`;break;case"w:bookmarkStart":case"w:bookmarkEnd":case"w:permStart":case"w:permEnd":default:n+=N(t,j(t,d));break;case"m:oMath":case"m:oMathPara":t.doc.notices.objects++,n+=T(t,j(t,d),"object",t.labels.equation);break;case"w:fldSimple":case"w:sdt":case"w:smartTag":case"w:customXml":n+=T(t,j(t,d),"field",M(d)||t.labels.contents)}}return r>0&&(n+=b(l)),n}function R(t){return o(t,g).length>0}function F(t,e){const n=r(e,"w:pPr"),a=r(n,"w:pStyle")?.attrs["w:val"],o=r(n,"w:numPr")??function(t,e){let n;for(const a of S(t,e))n=r(r(a,"w:pPr"),"w:numPr")??n;return n}(t,a),s=r(o,"w:numId")?.attrs["w:val"];if(!s||"0"===s)return null;const l=Number(r(o,"w:ilvl")?.attrs["w:val"]??0),c=t.numbering.get(s)?.get(l);return{numId:s,ilvl:l,ordered:c?.ordered??!1,marker:c?.marker??""}}function L(t){const e=[],n=r(t,"w:pBdr");for(const t of["top","bottom","left","right"]){const a=r(n,`w:${t}`);if(!a||"nil"===a.attrs["w:val"]||"none"===a.attrs["w:val"])continue;const o=/^[0-9a-fA-F]{6}$/.test(a.attrs["w:color"]??"")?`#${a.attrs["w:color"]}`:"currentcolor";e.push(`border-${t}:${(Number(a.attrs["w:sz"])||4)/8}pt solid ${o}`)}const a=r(t,"w:shd")?.attrs["w:fill"];return a&&/^[0-9a-fA-F]{6}$/.test(a)&&e.push(`background-color:#${a}`),e.join(";")}function O(t,e,n){const a=r(e,"w:pPr"),c=r(a,"w:pStyle")?.attrs["w:val"],i=t.fieldOpen,d=function(t){let e=0;for(const n of o(t,new Set(["w:fldChar"]))){const t=n.attrs["w:fldCharType"];"begin"===t?e++:"end"===t&&e--}return e}(e),w=R(e)||i||0!==d;d>0&&(t.fieldOpen=!0),i&&d<0&&(t.fieldOpen=!1);const m=P(t,"p");t.doc.blocks.set(m,{xml:j(t,e),fingerprint:"",props:C(t,a),numId:n?.numId,ilvl:n?.ilvl});const p=n?0:function(t,e){if(!e)return 0;const n=r(t.styles.get(e),"w:name")?.attrs["w:val"]??"",a=/^heading ([1-6])$/i.exec(n);return a?Number(a[1]):0}(t,c),f=n?"li":p?`h${p}`:"p",u=l(a);n&&delete u.indentLeft,n&&delete u.firstLine;const b=[s(u),L(a)].filter(Boolean).join(";");let h=w?D(t,e):E(t,e.children);h&&!/<br>(<\/[^>]+>)*$/.test(h)||(h+="<br>");return`<${f} data-docx="${m}"${r(a,"w:pageBreakBefore")?" data-break-before":""}${c?` data-pstyle="${k(c)}"`:""}${b?` style="${k(b)}"`:""}${w?' data-locked contenteditable="false"':""}>${h}</${f}>`}function D(t,e){let n="";for(const r of e.children)"w:pPr"!==r.name&&"w:rPr"!==r.name&&"w:instrText"!==r.name&&"w:delInstrText"!==r.name&&("w:ins"===r.name||"w:moveTo"===r.name?n+=`<ins>${D(t,r)}</ins>`:"w:del"===r.name||"w:moveFrom"===r.name?n+=`<del>${D(t,r)}</del>`:"w:commentRangeStart"===r.name?t.openComments.add(r.attrs["w:id"]):"w:commentRangeEnd"===r.name?t.openComments.delete(r.attrs["w:id"]):"w:t"===r.name||"w:delText"===r.name?n+=b(r.text):"w:tab"===r.name?n+="\t":"w:br"===r.name?n+="<br>":"w:drawing"===r.name||"mc:AlternateContent"===r.name||"w:pict"===r.name?n+=`<span data-kind="object">${b(t.labels.object)}</span>`:n+=D(t,r));return n}function H(t,e){const n=P(t,"t"),o=r(e,"w:tblPr"),s=r(e,"w:tblGrid"),l=a(e,"w:tr"),c=l.some(t=>r(r(t,"w:trPr"),"w:gridBefore")||r(r(t,"w:trPr"),"w:gridAfter")),i=R(e)||c;c&&t.doc.notices.objects++,t.doc.blocks.set(n,{xml:j(t,e),fingerprint:"",props:C(t,o),tblGrid:C(t,s)});const d=r(o,"w:tblStyle")?.attrs["w:val"],w=a(s,"w:gridCol").map(t=>Number(t.attrs["w:w"])/20),m=new Map,p=l.map(t=>{const e=[];let n=0;for(const o of a(t,"w:tc")){const t=r(o,"w:tcPr"),a=Number(r(t,"w:gridSpan")?.attrs["w:val"]??1),s=r(t,"w:vMerge");if(s&&"restart"!==s.attrs["w:val"]&&m.has(n))m.get(n).rowSpan++;else{const t={node:o,rowSpan:1,col:n,span:a};e.push(t),s?m.set(n,t):m.delete(n)}n+=a}return e}),f=function(t,e,n){let a=r(e,"w:tblBorders");if(!a)for(const e of S(t,n))a=r(r(e,"w:tblPr"),"w:tblBorders")??a;return!!a&&a.children.some(t=>!["nil","none"].includes(t.attrs["w:val"]))}(t,o,d),u=l.map((e,n)=>{const a=P(t,"t");t.doc.blocks.set(a,{xml:"",fingerprint:"",props:C(t,r(e,"w:trPr"))});return`<tr data-docx="${a}">${p[n].map(e=>{const n=P(t,"t"),a=r(e.node,"w:tcPr");t.doc.blocks.set(n,{xml:"",fingerprint:"",props:C(t,a)});const o=r(a,"w:shd")?.attrs["w:fill"],s=[];o&&/^[0-9a-fA-F]{6}$/.test(o)&&s.push(`background-color:#${o.toLowerCase()}`);const l=r(a,"w:vAlign")?.attrs["w:val"];return"center"===l&&s.push("vertical-align:middle"),"bottom"===l&&s.push("vertical-align:bottom"),`<td data-docx="${n}"${e.span>1?` colspan="${e.span}"`:""}${e.rowSpan>1?` rowspan="${e.rowSpan}"`:""}${s.length?` style="${s.join(";")}"`:""}>${U(t,e.node.children)}</td>`}).join("")}</tr>`}).join(""),b=w.length?`<colgroup>${w.map(t=>`<col style="width:${Math.round(100*t)/100}pt">`).join("")}</colgroup>`:"";return`<table data-docx="${n}"${d?` data-tstyle="${k(d)}"`:""}${f?"":" data-no-borders"}${i?' data-locked contenteditable="false"':""}>${b}<tbody>${u}</tbody></table>`}function U(t,e){const n=[],o=[],s=t=>{for(;o.length>t;){const t=o.pop();n.push(`</li></${t.tag}>`)}};for(const l of e){const e="w:p"===l.name?F(t,l):null;if(e){for(;o.length&&o[o.length-1].ilvl>e.ilvl;)s(o.length-1);const r=o[o.length-1];!r||r.ilvl!==e.ilvl||r.numId===e.numId&&r.tag===(e.ordered?"ol":"ul")||s(o.length-1);const a=`${e.numId}:${e.ilvl}`,c=t.listCounters.get(a)??0;t.listCounters.set(a,c+1);const i=O(t,l,e),d=o[o.length-1];if(d&&d.ilvl===e.ilvl)n.push(`</li>${i.slice(0,i.lastIndexOf("</li>"))}`);else{const t=e.ordered?"ol":"ul",r=e.marker?` style="list-style-type:${e.marker}"`:"",a=e.ordered&&c?` start="${c+1}"`:"";n.push(`<${t} data-num-id="${k(e.numId)}" data-ilvl="${e.ilvl}"${a}${r}>${i.slice(0,i.lastIndexOf("</li>"))}`),o.push({tag:t,numId:e.numId,ilvl:e.ilvl})}continue}if("w:tcPr"!==l.name&&"w:sectPr"!==l.name)if(s(0),"w:p"===l.name)n.push(O(t,l,null));else if("w:tbl"===l.name)n.push(H(t,l));else if("w:sdt"===l.name){const e=P(t,"p");t.doc.blocks.set(e,{xml:j(t,l),fingerprint:""}),t.doc.notices.objects++;const o=U(t,a(r(l,"w:sdtContent"),"w:p"));n.push(`<div data-docx="${e}" data-locked contenteditable="false">${o}</div>`)}else{const e=P(t,"p");t.doc.blocks.set(e,{xml:j(t,l),fingerprint:""}),n.push(`<div data-docx="${e}" data-locked data-hidden contenteditable="false"></div>`)}}return s(0),n.join("")}function z(t){if("LI"!==t.tagName)return t.outerHTML;const e=t.cloneNode(!0);return Array.from(e.children).forEach(t=>{"UL"!==t.tagName&&"OL"!==t.tagName||t.remove()}),e.outerHTML}function q(t){const e=document.createElement("div");e.innerHTML=t.html,e.querySelectorAll("[data-docx]").forEach(e=>{const n=t.blocks.get(e.getAttribute("data-docx"));n&&(n.fingerprint=z(e))})}function W(t,e){const n=e?d(t,e):void 0;if(!n)return{text:"",editable:!0};const r=i(n),a=r.children.filter(t=>"w:p"===t.name),s=r.children.every(t=>"w:p"===t.name)&&0===o(r,new Set(["w:drawing","w:pict","mc:AlternateContent","w:sdt"])).length,l=a.map(t=>{let e="",n="",r=!1;const a=t=>{for(const o of t.children)if("w:t"===o.name)r||(e+=o.text);else if("w:tab"===o.name)r||(e+=" | ");else if("w:instrText"===o.name)n+=o.text;else if("w:fldChar"===o.name){const t=o.attrs["w:fldCharType"];"separate"!==t&&"end"!==t||(n&&(e+=G(n),n=""),r="separate"===t)}else"w:fldSimple"===o.name?e+=G(o.attrs["w:instr"]??"")||o.children.map(M).join(""):"w:pPr"!==o.name&&"w:rPr"!==o.name&&a(o)};return a(t),e}).filter(Boolean);return{text:l.join(" "),editable:s&&l.length<=1,part:e}}function G(t){const e=t.trim().split(/\s+/)[0]?.toUpperCase();return"PAGE"===e?"{page}":"NUMPAGES"===e?"{pages}":""}async function X(t,e={}){return Y(await p(t),t,e)}function Y(p,b,g={}){const v=w(p,"").find(t=>t.type.endsWith("/officeDocument")),x=v?f("",v.target):"word/document.xml",k=d(p,x);if(!k)throw new Error("Not a Word document");const P=i(k),j=r(P,"w:body");if(!j)throw new Error("Not a Word document");const C=w(p,x),T=t=>{const e=(t=>C.find(e=>e.type===t))(t);return e?f(x,e.target):void 0},N=m(T(n.theme)?d(p,T(n.theme)):void 0),B={parts:p,docPath:x,source:b,html:"",css:"",page:{...e},header:{text:"",editable:!0},footer:{text:"",editable:!0},blocks:new Map,runs:new Map,raw:new Map,notices:{comments:0,tracked:0,objects:0,footnotes:0},styles:[],theme:N},A={src:k,doc:B,labels:g.labels??h,rels:new Map(C.map(t=>[t.id,t])),theme:N,imageUrl:g.imageUrl??y,styles:new Map,numbering:new Map,listCounters:new Map,comments:new Map,footnotes:new Map,nextId:0,footnoteCount:0,openComments:new Set,fieldOpen:!1},E=T(n.styles),R=E?d(p,E):void 0,F=R?i(R):void 0;for(const t of a(F,"w:style"))A.styles.set(t.attrs["w:styleId"],t);const L=new Set(A.styles.keys());for(const[e,n]of Object.entries(t))L.has(e)||A.styles.set(e,i(n.xml));const O=r(F,"w:docDefaults");B.lang=r(r(r(O,"w:rPrDefault"),"w:rPr"),"w:lang")?.attrs["w:val"],B.css=function(t,e){const n=[],a=c(r(r(e,"w:rPrDefault"),"w:rPr"),t.theme),o=l(r(r(e,"w:pPrDefault"),"w:pPr"));t.doc.defaultFont=a.font,t.doc.defaultSize=a.size;let i=a,d=o;for(const[e,w]of t.styles){const m=w.attrs["w:type"];if("paragraph"!==m&&"character"!==m&&"table"!==m)continue;let p={},f={};for(const n of S(t,e))p={...p,...c(r(n,"w:rPr"),t.theme)},f={...f,...l(r(n,"w:pPr"))};if("paragraph"===m)n.push(`.docs-page [data-pstyle=${I(e)}]{${[u(p),s(f)].filter(Boolean).join(";")}}`),"1"===w.attrs["w:default"]&&(i={...a,...p},d={...o,...f});else if("character"===m)n.push(`.docs-page [data-rstyle=${I(e)}]{${u(p)}}`);else{const t=s(f);t&&n.push(`.docs-page table[data-tstyle=${I(e)}] p{${t}}`)}}return n.unshift(`.docs-page{${u(i)}}`,`.docs-page p,.docs-page h1,.docs-page h2,.docs-page h3,.docs-page h4,.docs-page h5,.docs-page h6,.docs-page li{${s(d)}}`),n.join("\n")}(A,O);const D=new Set(Object.keys(t));B.styles=[...A.styles.values()].filter(t=>"paragraph"===t.attrs["w:type"]&&"1"!==t.attrs["w:default"]&&(D.has(t.attrs["w:styleId"])||r(t,"w:qFormat"))&&!r(t,"w:hidden")&&!r(t,"w:semiHidden")).map(t=>({id:t.attrs["w:styleId"],name:r(t,"w:name")?.attrs["w:val"]??t.attrs["w:styleId"]}));const H=T(n.numbering),z=H?d(p,H):void 0;z&&function(t,e){const n=new Map;for(const t of a(e,"w:abstractNum")){const e=new Map;for(const n of a(t,"w:lvl")){const t=r(n,"w:numFmt")?.attrs["w:val"]??"decimal";e.set(Number(n.attrs["w:ilvl"]),{ordered:"bullet"!==t&&"none"!==t,marker:Z[t]??""})}n.set(t.attrs["w:abstractNumId"],e)}for(const o of a(e,"w:num")){const e=n.get(r(o,"w:abstractNumId")?.attrs["w:val"]??"");e&&t.numbering.set(o.attrs["w:numId"],e)}}(A,i(z));const G=T(n.comments),X=G?d(p,G):void 0;if(X){for(const t of a(i(X),"w:comment"))A.comments.set(t.attrs["w:id"],`${t.attrs["w:author"]??""}: ${M(t)}`);B.notices.comments=A.comments.size}const Y=T(n.footnotes),J=Y?d(p,Y):void 0;if(J)for(const t of a(i(J),"w:footnote"))A.footnotes.set(t.attrs["w:id"],M(t));B.notices.tracked=o(j,$).length;const K=r(j,"w:sectPr"),Q=r(K,"w:pgSz"),V=r(K,"w:pgMar"),_=(t,e,n)=>{const r=Number(t?.attrs[e]);return Number.isFinite(r)&&void 0!==t?.attrs[e]?r:n};B.page={width:_(Q,"w:w",e.width),height:_(Q,"w:h",e.height),top:Math.abs(_(V,"w:top",e.top)),right:_(V,"w:right",e.right),bottom:Math.abs(_(V,"w:bottom",e.bottom)),left:_(V,"w:left",e.left),header:_(V,"w:header",e.header),footer:_(V,"w:footer",e.footer)};const tt=t=>{const e=a(K,t).find(t=>"default"===t.attrs["w:type"]),n=e&&A.rels.get(e.attrs["r:id"]);return n?f(x,n.target):void 0};return B.header=W(p,tt("w:headerReference")),B.footer=W(p,tt("w:footerReference")),B.html=U(A,j.children),B.html||(B.html="<p><br></p>"),q(B),B}var Z={lowerLetter:"lower-alpha",upperLetter:"upper-alpha",lowerRoman:"lower-roman",upperRoman:"upper-roman",decimalZero:"decimal-leading-zero"};export{z as fingerprintOf,q as stampFingerprints,X as readDocx,Y as readParts};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ENGLISH_WORDS as r}from"./chunk-7K7AY3V3.js";import{newSheet as e}from"./chunk-VKCG3LPQ.js";var t=["xlsx","xls","ods","csv","tsv","txt"],s=t.map(r=>`.${r}`).join(",");import{createContext as o,useContext as a}from"react";import{jsx as n}from"react/jsx-runtime";var c=o(r);function i({words:r,children:e}){return n(c.Provider,{value:r,children:e})}var m=()=>a(c);import{createContext as l,useContext as u}from"react";import{jsx as v}from"react/jsx-runtime";var p=class extends Error{},x=l({});function d({value:r,children:e}){return v(x.Provider,{value:r,children:e})}var f=()=>u(x);function h(r,t){const s=Array.isArray(r?.sheets)?r.sheets:[];return s.length?s.map(r=>({...e(r.name),...r,cells:(r.cells??[]).map(r=>(r??[]).map(r=>r??""))})):[e(t)]}export{t as SPREADSHEET_EXTENSIONS,s as SPREADSHEET_ACCEPT,i as SpreadsheetWordsProvider,m as useSpreadsheetWords,p as SpreadsheetsConflict,d as SpreadsheetsProvider,f as useSpreadsheetsHost,h as sheetsOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ENGLISH_WORDS as r}from"./chunk-
|
|
1
|
+
import{ENGLISH_WORDS as r}from"./chunk-I3AC6PYR.js";import{createContext as e,useContext as o}from"react";import{jsx as t}from"react/jsx-runtime";var n=e(r);function a({words:r,children:e}){return t(n.Provider,{value:r,children:e})}var i=()=>o(n);import{createContext as s,useContext as c}from"react";import{jsx as d}from"react/jsx-runtime";var m=class extends Error{},u=s({});function l({value:r,children:e}){return d(u.Provider,{value:r,children:r.words?d(a,{words:r.words,children:e}):e})}var v=()=>c(u);export{a as DocumentsWordsProvider,i as useDocumentsWords,m as DocumentsConflict,l as DocumentsProvider,v as useDocumentsHost};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ENGLISH_FILE_WORDS as e,ZH_HANS_FILE_WORDS as t}from"./chunk-B32ASXHM.js";var o={pdfPageFailed:e=>`Page ${e} couldn't be drawn for the PDF.`,files:e,fileKind:"Word",backToFiles:"Back to files",filesHeading:"Documents",newFile:"New document",openFile:"Open a file",filesEmptyTitle:"Write your first document",filesEmptyBody:"Every change saves by itself.",deleteFile:"Delete",createFailed:"The document could not be made.",deleteFailed:"The document could not be deleted.",deleteConfirm:e=>`Delete "${e}"? Nobody can open it again.`,documentName:"Document name",documentPanel:"Document",pagePanel:"Page",outline:"Outline",outlineEmpty:"Headings in the document show here.",morePageSetup:"More page setup",export:"Export",renameFailed:"The document could not be renamed.",openFailed:"This document could not be opened.",conflict:"Somebody else saved this document, so your latest changes are not saved. Reload to see theirs.",reload:"Reload",noStoreEdited:"Not saved. Export to keep your changes",noStoreClean:"No autosave here. Export to keep a copy",openFromFiles:"Go back to your files to open another document.",untitled:"Untitled",loading:"Loading",newDocument:"New",open:"Open",rename:"Rename",menuFile:"File",menuInsert:"Insert",menuLayout:"Layout",save:"Save",saveDocx:"Save (.docx)",saveKeepType:"Save",saveAs:"Save as",saveAsWord:"Word document (.docx)",saveAsPdf:"PDF (from the print dialog)",saveAsWeb:"Web page (.html)",saveAsText:"Plain text (.txt)",print:"Print",undo:"Undo",redo:"Redo",find:"Find",replaceWith:"Replace with",replace:"Replace",replaceAll:"Replace all",matchCase:"Match case",previousMatch:"Previous match",nextMatch:"Next match",closeFind:"Close find",noMatches:"No matches",paragraphStyle:"Paragraph style",font:"Font",fontSize:"Font size",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",superscript:"Superscript",subscript:"Subscript",textColor:"Text color",highlight:"Highlight color",clearFormatting:"Clear formatting",bulletedList:"Bulleted list",numberedList:"Numbered list",decreaseIndent:"Decrease indent",increaseIndent:"Increase indent",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",justify:"Justify",lineSpacing:"Line spacing",styleNormal:"Normal",styleTitle:"Title",styleHeading1:"Heading 1",styleHeading2:"Heading 2",styleHeading3:"Heading 3",styleQuote:"Quote",table:"Table",image:"Image",link:"Link",linkPrompt:"Web address, or leave empty to remove the link.",linkInvalid:"That address can't be used as a link.",pageBreak:"Page break",pageNumber:"Page number",horizontalLine:"Horizontal line",rowAbove:"Insert row above",rowBelow:"Insert row below",columnLeft:"Insert column left",columnRight:"Insert column right",mergeCells:"Merge cells",mergeFailed:"These cells can't be merged: the selection would cut a merged cell.",cellShading:"Cell shading",noColor:"No color",deleteRow:"Delete row",deleteColumn:"Delete column",deleteTable:"Delete table",imageWidth:"Image width",imageOriginalSize:"Original size",imageRemove:"Remove image",pageSetup:"Page setup",paperSize:"Size",paperLetter:"US Letter",paperLegal:"US Legal",custom:"Custom",orientation:"Orientation",portrait:"Portrait",landscape:"Landscape",margins:"Margins",marginsNormal:"Normal, 2.54 cm",marginsNarrow:"Narrow, 1.27 cm",marginsModerate:"Moderate, 1.91 cm sides",marginsWide:"Wide, 5.08 cm sides",header:"Header",footer:"Footer",headerFooterHint:"{page} and {pages} become page numbers. A | pushes the text after it to the right.",headerFooterLocked:"This one holds a picture or a table, so it is kept as it is. Edit it in Word.",ok:"OK",cancel:"Cancel",dismiss:"Dismiss",zoomIn:"Zoom in",zoomOut:"Zoom out",wrapLines:"Wrap lines",objectTextBox:"Text box",objectChart:"Chart from Word. Kept as is.",objectDiagram:"Diagram from Word. Kept as is.",objectEquation:"Equation from Word. Kept as is.",objectPicture:"Picture from Word. Kept as is.",objectOther:"Object from Word. Kept as is.",objectField:"Field",discardMessage:"They haven't been saved.",discard:"Discard",keepEditing:"Keep editing",legacyDoc:".doc is the old Word format. Save it as .docx in Word first.",openedOldSave:"Opened as a document. Save it to get a Word file.",saveFailed:"The document could not be saved.",savedAsUtf8:"Saved as UTF-8: the original encoding can't be written from a browser.",dropHint:"Drop a document to open. Images insert into the page.",matchCount:(e,t)=>`${e} of ${t}`,replacedCount:e=>1===e?"1 replacement":`${e} replacements`,tableSize:(e,t)=>`${e} × ${t}`,pageLabel:e=>`Page ${e}`,pageOf:(e,t)=>`Page ${e} of ${t}`,wordCount:e=>1===e?"1 word":`${e.toLocaleString()} words`,lineColumn:(e,t)=>`Ln ${e}, Col ${t}`,lineCount:e=>1===e?"1 line":`${e.toLocaleString()} lines`,noticeComments:e=>1===e?"1 comment":`${e} comments`,noticeTracked:e=>1===e?"1 tracked change":`${e} tracked changes`,noticeObjects:e=>1===e?"1 object such as a text box":`${e} objects such as text boxes`,noticeFootnotes:e=>1===e?"1 footnote":`${e} footnotes`,noticeLead:e=>`Has ${e.length>1?`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`:e[0]}. They stay in the file, but need Word to edit.`,discardTitle:e=>`Discard your changes to ${e}?`,cannotRead:e=>`${e} can't be opened. It may be damaged or password protected.`,unsupported:e=>`Unsupported file type: .${e||"unknown"}`},a={pdfPageFailed:e=>`第 ${e} 页无法绘制到 PDF。`,files:t,fileKind:"Word",backToFiles:"返回文件",filesHeading:"文档",newFile:"新建文档",openFile:"打开文件",filesEmptyTitle:"写下您的第一份文档",filesEmptyBody:"每次更改都会自动保存。",deleteFile:"删除",createFailed:"无法创建文档。",deleteFailed:"无法删除文档。",deleteConfirm:e=>`删除“${e}”?之后任何人都无法再打开它。`,documentName:"文档名称",documentPanel:"文档",pagePanel:"页面",outline:"大纲",outlineEmpty:"文档中的标题会显示在这里。",morePageSetup:"更多页面设置",export:"导出",renameFailed:"无法重命名文档。",openFailed:"无法打开此文档。",conflict:"其他人已保存此文档,您最近的更改尚未保存。请重新加载以查看他们的版本。",reload:"重新加载",noStoreEdited:"未保存。请导出以保留更改",noStoreClean:"此处不会自动保存。请导出以保留副本",openFromFiles:"请返回文件列表以打开其他文档。",untitled:"未命名",loading:"正在加载",newDocument:"新建",open:"打开",rename:"重命名",menuFile:"文件",menuInsert:"插入",menuLayout:"布局",save:"保存",saveDocx:"保存 (.docx)",saveKeepType:"保存",saveAs:"另存为",saveAsWord:"Word 文档 (.docx)",saveAsPdf:"PDF(通过打印对话框)",saveAsWeb:"网页 (.html)",saveAsText:"纯文本 (.txt)",print:"打印",undo:"撤销",redo:"重做",find:"查找",replaceWith:"替换为",replace:"替换",replaceAll:"全部替换",matchCase:"区分大小写",previousMatch:"上一个匹配项",nextMatch:"下一个匹配项",closeFind:"关闭查找",noMatches:"无匹配项",paragraphStyle:"段落样式",font:"字体",fontSize:"字号",bold:"加粗",italic:"倾斜",underline:"下划线",strikethrough:"删除线",superscript:"上标",subscript:"下标",textColor:"文字颜色",highlight:"突出显示颜色",clearFormatting:"清除格式",bulletedList:"项目符号列表",numberedList:"编号列表",decreaseIndent:"减少缩进",increaseIndent:"增加缩进",alignLeft:"左对齐",alignCenter:"居中",alignRight:"右对齐",justify:"两端对齐",lineSpacing:"行距",styleNormal:"正文",styleTitle:"标题",styleHeading1:"标题 1",styleHeading2:"标题 2",styleHeading3:"标题 3",styleQuote:"引用",table:"表格",image:"图片",link:"链接",linkPrompt:"输入网址;留空则移除链接。",linkInvalid:"该地址不能用作链接。",pageBreak:"分页符",pageNumber:"页码",horizontalLine:"水平线",rowAbove:"在上方插入行",rowBelow:"在下方插入行",columnLeft:"在左侧插入列",columnRight:"在右侧插入列",mergeCells:"合并单元格",mergeFailed:"无法合并这些单元格:所选范围会切开已合并的单元格。",cellShading:"单元格底纹",noColor:"无颜色",deleteRow:"删除行",deleteColumn:"删除列",deleteTable:"删除表格",imageWidth:"图片宽度",imageOriginalSize:"原始大小",imageRemove:"移除图片",pageSetup:"页面设置",paperSize:"纸张大小",paperLetter:"美国信纸",paperLegal:"美国法律用纸",custom:"自定义",orientation:"方向",portrait:"纵向",landscape:"横向",margins:"页边距",marginsNormal:"常规,2.54 厘米",marginsNarrow:"窄,1.27 厘米",marginsModerate:"中等,左右 1.91 厘米",marginsWide:"宽,左右 5.08 厘米",header:"页眉",footer:"页脚",headerFooterHint:"{page} 和 {pages} 会变成页码。| 会把其后的文字推到右侧。",headerFooterLocked:"此处包含图片或表格,因此保持原样。请在 Word 中编辑。",ok:"确定",cancel:"取消",dismiss:"关闭",zoomIn:"放大",zoomOut:"缩小",wrapLines:"自动换行",objectTextBox:"文本框",objectChart:"来自 Word 的图表,保持原样。",objectDiagram:"来自 Word 的示意图,保持原样。",objectEquation:"来自 Word 的公式,保持原样。",objectPicture:"来自 Word 的图片,保持原样。",objectOther:"来自 Word 的对象,保持原样。",objectField:"域",discardMessage:"这些更改尚未保存。",discard:"放弃",keepEditing:"继续编辑",legacyDoc:".doc 是旧版 Word 格式,请先在 Word 中另存为 .docx。",openedOldSave:"已作为文档打开。保存后即可得到 Word 文件。",saveFailed:"无法保存文档。",savedAsUtf8:"已保存为 UTF-8:浏览器无法写入原始编码。",dropHint:"拖放文档以打开;图片会插入页面。",matchCount:(e,t)=>`第 ${e} 个,共 ${t} 个`,replacedCount:e=>`已替换 ${e} 处`,tableSize:(e,t)=>`${e} × ${t}`,pageLabel:e=>`第 ${e} 页`,pageOf:(e,t)=>`第 ${e} 页,共 ${t} 页`,wordCount:e=>`${e.toLocaleString()} 字`,lineColumn:(e,t)=>`第 ${e} 行,第 ${t} 列`,lineCount:e=>`${e.toLocaleString()} 行`,noticeComments:e=>`${e} 条批注`,noticeTracked:e=>`${e} 处修订`,noticeObjects:e=>`${e} 个文本框等对象`,noticeFootnotes:e=>`${e} 条脚注`,noticeLead:e=>`包含 ${e.join("、")}。它们会保留在文件中,但需要在 Word 中编辑。`,discardTitle:e=>`放弃对 ${e} 的更改?`,cannotRead:e=>`无法打开 ${e}。文件可能已损坏或受密码保护。`,unsupported:e=>`不支持的文件类型:.${e||"未知"}`};export{o as ENGLISH_WORDS,a as ZH_HANS_WORDS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readDocx as t}from"./chunk-COXKOQPZ.js";import{titleOf as a}from"./chunk-XYVQTQ6N.js";async function r(r,i){const e=new Uint8Array(await i.arrayBuffer());await t(e);const n=a(i.name),c=await r.create(n);try{await r.save(c.id,e,c.version)}catch(t){throw await r.remove(c.id).catch(()=>{}),t}return{id:c.id,title:n}}export{r as importDocumentFile};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ENGLISH_WORDS as r}from"./chunk-
|
|
1
|
+
import{ENGLISH_WORDS as r}from"./chunk-PXOQN7D6.js";var s=class extends Error{constructor(s=r.pptxPasswordProtected){super(s),this.name="PptxPasswordError"}},t=class extends Error{constructor(s=r.pptxUnreadable){super(s),this.name="PptxUnreadableError"}};export{s as PptxPasswordError,t as PptxUnreadableError};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useCallback as e,useEffect as t,useRef as i,useState as n}from"react";import{WindowTitle as l,activateWindowById as r}from"efficient-shell";import{Icon as a}from"efficient-shell/icons";import{Button as o,ContextMenu as c,buttonClasses as s,DropdownMenu as d,EmptyState as f,Input as m,confirmDestructive as u,registerModalEscapeInterceptor as p,toast as h,useContextMenu as g}from"efficient-shell/ui";import{jsx as v,jsxs as y}from"react/jsx-runtime";function w({words:m,files:p,list:w,create:b,rename:C,remove:N,canCreate:D,canDelete:F,canRename:S=!0,accept:x,choose:z,onOpen:A,onOpenFile:I,busy:T,extra:q}){const[B,E]=n(null),[O,P]=n(null),j=i(null),K=i(null),L=g(),M=e(()=>{w().then(E,()=>E([]))},[w]);t(M,[M]);const R=()=>j.current?.click(),W=async e=>{await u({message:m.deleteConfirm(e.title),confirmWord:p.delete})&&N(e.id).then(M,()=>h.error(m.deleteFailed))},G=D&&v(o,{onClick:()=>{b().then(({id:e})=>A(e),()=>h.error(m.createFailed))},children:m.newFile}),H=v(a,{name:"folder-open",size:16}),J=z?v(d,{align:"end",triggerClassName:s({variant:"ghost"}),trigger:y("span",{className:"office-filelist-open",children:[H,p.open,v(a,{name:"chevron-down",size:14})]}),items:[{key:"computer",label:p.fromComputer,icon:v(a,{name:"desktop",size:16}),onSelect:R},{key:"drive",label:p.fromDrive,icon:v(a,{name:"cloud",size:16}),onSelect:()=>{(async()=>{z&&(await new Promise(e=>requestAnimationFrame(()=>setTimeout(e,0))),z.run(z.request).then(e=>{if(!e)return;const t=K.current?.closest("[data-modal-panel]"),i=t?.getAttribute("data-window-key")??t?.getAttribute("data-window-owner");i&&r(i),K.current?.focus({preventScroll:!0}),I(e.file,e)},()=>h.error(p.openFailed(p.fromDrive))))})()}}]}):v(o,{variant:"ghost",leftIcon:H,onClick:R,children:p.open});return y("div",{className:"office-filelist",ref:K,tabIndex:-1,children:[v(l,{title:m.windowTitle}),v("input",{ref:j,type:"file",accept:x,className:"office-filelist-input",onChange:e=>{const t=e.target.files?.[0];e.target.value="",t&&I(t)}}),y("div",{className:"office-filelist-head",children:[v("h2",{children:m.heading}),J,B&&B.length>0&&G]}),q,T&&v("div",{className:"office-filelist-busy",role:"status",children:T}),0===B?.length?v("div",{className:"office-filelist-empty",children:v(f,{title:m.emptyTitle,description:m.emptyBody,children:G})}):v("ul",{className:"office-filelist-rows",children:B?.map(e=>y("li",{className:"office-filelist-row",onContextMenu:t=>L.open(t,e),children:[O===e.id?v(k,{title:e.title,label:p.name,onDone:t=>((e,t)=>{P(null);const i=t?.trim();i&&i!==e.title&&(E(t=>t?.map(t=>t.id===e.id?{...t,title:i}:t)??t),C(e.id,i).then(M,()=>{h.error(p.renameFailed),M()}))})(e,t)}):v(o,{variant:"link",onClick:()=>A(e.id),children:e.title}),v("span",{className:"office-filelist-date",children:new Date(e.updatedAt).toLocaleDateString()}),F&&v(o,{variant:"ghost",leftIcon:v(a,{name:"trash",size:16}),onClick:()=>{W(e)},children:p.delete})]},e.id))}),L.state&&v(c,{...L.props,items:(Q=L.state.data,[{key:"open",label:p.open,onSelect:()=>A(Q.id)},...S?[{key:"rename",label:p.rename,onSelect:()=>P(Q.id)}]:[],...F?[{key:"divider",type:"divider"},{key:"delete",label:p.delete,danger:!0,onSelect:()=>{W(Q)}}]:[]])})]});var Q}function k({title:e,label:l,onDone:r}){const[a,o]=n(e),c=i(null),s=i(!1),d=e=>{s.current||(s.current=!0,r(e))},f=i(d);return f.current=d,t(()=>{c.current?.focus(),c.current?.select()},[]),t(()=>p(()=>(f.current(null),!0)),[]),v("div",{className:"office-filelist-rename",children:v(m,{ref:c,"aria-label":l,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key?d(a):"Escape"===e.key&&(e.stopPropagation(),d(null))},onBlur:()=>d(a)})})}export{w as FileList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ENGLISH_FILE_WORDS as e,ZH_HANS_FILE_WORDS as t}from"./chunk-B32ASXHM.js";var o={rect:"Rectangle",roundRect:"Rounded rectangle",ellipse:"Ellipse",triangle:"Triangle",rightTriangle:"Right triangle",diamond:"Diamond",pentagon:"Pentagon",hexagon:"Hexagon",octagon:"Octagon",star:"Star",heart:"Heart",cloud:"Cloud",bolt:"Lightning bolt",parallelogram:"Parallelogram",trapezoid:"Trapezoid",cylinder:"Cylinder",plus:"Plus",arrowRight:"Right arrow",arrowLeft:"Left arrow",arrowUp:"Up arrow",arrowDown:"Down arrow",arrowLeftRight:"Left-right arrow",chevron:"Chevron",callout:"Callout",calloutRound:"Rounded callout",line:"Line"},n={rect:"矩形",roundRect:"圆角矩形",ellipse:"椭圆",triangle:"三角形",rightTriangle:"直角三角形",diamond:"菱形",pentagon:"五边形",hexagon:"六边形",octagon:"八边形",star:"星形",heart:"心形",cloud:"云形",bolt:"闪电形",parallelogram:"平行四边形",trapezoid:"梯形",cylinder:"圆柱形",plus:"加号",arrowRight:"右箭头",arrowLeft:"左箭头",arrowUp:"上箭头",arrowDown:"下箭头",arrowLeftRight:"左右箭头",chevron:"燕尾形",callout:"标注",calloutRound:"圆角标注",line:"线条"},i={blank:"Blank",simple:"Simple",midnight:"Midnight",editorial:"Editorial",dealerPitch:"Dealer pitch",monthlyReport:"Monthly report"},r={blank:"空白",simple:"简约",midnight:"午夜",editorial:"杂志",dealerPitch:"经销商推介",monthlyReport:"月度报告"},a={decks:"Decks",newDeck:"New deck",untitledDeck:"Untitled deck",emptyTitle:"Make your first deck",emptyBody:"Build slides here, then present them or export to PowerPoint.",openFailed:"Couldn't open this deck",createFailed:"Could not create a deck.",deleteFailed:"Could not delete this deck.",backToDecks:"Back to decks",deleteConfirm:e=>`Delete "${e}"? This can't be undone.`,delete:"Delete",deckName:"Deck name",slidesPanel:"Slides",slideNumber:e=>`Slide ${e}`,slideOf:(e,t)=>`Slide ${e} of ${t}`,addSlide:"Add slide",duplicateSlide:"Duplicate slide",deleteSlide:"Delete slide",slideText:"Slide text",undo:"Undo",redo:"Redo",export:"Export",exportFailed:"Could not export this deck.",present:"Present",endShow:"End show",popupBlocked:"Your browser blocked the audience window. Allow pop-ups for this site, then end the show and present again.",back:"Back",next:"Next",nextSlide:"Next slide",endOfDeck:"End of the deck.",notes:"Notes",noNotes:"No notes for this slide.",speakerNotes:"Speaker notes",saveFailed:"Could not save this deck. Trying again.",renameFailed:"Could not rename this deck.",conflict:"Somebody else changed this deck. Your latest edits aren't saved. Reload to see their version.",reload:"Reload",addText:"Add text",addShape:"Add shape",addImage:"Add image",addChart:"Add chart",addTable:"Add table",elementText:"Text",elementShape:"Shape",elementImage:"Image",elementChart:"Chart",elementTable:"Table",slide:"Slide",objects:e=>`${e} objects`,background:"Background",positionAndSize:"Position and size",width:"W",height:"H",angle:"Angle",align:"Align",alignLeft:"Align left",alignCentre:"Align centre",alignRight:"Align right",bringForward:"Bring forward",size:"Size",weight:"Weight",regular:"Regular",bold:"Bold",textAlignment:"Text alignment",left:"Left",centre:"Centre",right:"Right",colour:"Colour",rectangle:"Rectangle",ellipse:"Ellipse",roundedRectangle:"Rounded rectangle",diamond:"Diamond",lineShape:"Line",outlineColour:"Outline colour",imageAddress:"Image address",chooseImage:"Choose image",imageTitle:"Slide image",description:"Description",data:"Data",chartType:"Chart type",bar:"Bar",line:"Line",values:"Values",valuesHint:"One label and number a line, like Sept, 42.",rows:"Rows",rowsHint:"One row a line, with commas between cells.",headingColour:"Heading colour",pptxPasswordProtected:"This file has a password. Remove it in PowerPoint, then import the file again.",pptxUnreadable:"This file can't be read as a PowerPoint (.pptx) file.",pptxLegacyFormat:"This is an older Office file. Save it as .pptx in PowerPoint, then import it again.",pptxTooManySlides:(e,t)=>`This deck has ${e} slides, and a deck can have at most ${t}.`,pptxTooLarge:(e,t)=>`This deck comes to ${e} MiB without its pictures, and a deck can be at most ${t} MiB. Split it into smaller decks.`,pdfSlideFailed:e=>`Slide ${e} couldn't be drawn for the PDF.`,files:e,fileKind:"PowerPoint",importNotes:({skipped:e,animations:t,fonts:o})=>{const n=[e&&(1===e?"a chart, video or custom shape was":`${e} charts, videos or custom shapes were`)+" left out",t&&`animations on ${1===t?"1 slide were":`${t} slides were`} dropped`,o.length&&`${o.join(", ")} ${1===o.length?"is":"are"} shown in the deck's font`].filter(Boolean);return n.length?`Some things didn't come across: ${n.join("; ")}.`:null},dismiss:"Dismiss",newSlide:"New slide",layouts:"Layouts",layoutTitle:"Title",layoutTitleBody:"Title and body",layoutSection:"Section",layoutTwoColumns:"Two columns",layoutTitleOnly:"Title only",layoutBlank:"Blank",placeholderTitle:"Click to add a title",placeholderSubtitle:"Click to add a subtitle",placeholderBody:"Click to add text",addVideo:"Add video",addLine:"Add line or connector",elementVideo:"Video",elementConnector:"Connector",lineStraight:"Line",lineArrow:"Arrow",lineDoubleArrow:"Double arrow",connectorElbow:"Elbow connector",connectorCurved:"Curved connector",arrange:"Arrange",theme:"Theme",motion:"Motion",comments:"Comments",versionHistory:"Version history",font:"Font",fontSize:"Font size",smaller:"Smaller",larger:"Larger",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",textColour:"Text colour",highlight:"Highlight",link:"Link",linkPrompt:"Link to a web address, an email address, or a slide number",removeLink:"Remove link",badLink:"That link isn’t a web address, an email address or a slide number.",alignJustify:"Justify",bulletList:"Bulleted list",numberedList:"Numbered list",indentLess:"Decrease indent",indentMore:"Increase indent",lineSpacing:"Line spacing",verticalAlign:"Vertical alignment",top:"Top",middle:"Middle",bottom:"Bottom",shrinkToFit:"Shrink text to fit",cut:"Cut",copy:"Copy",paste:"Paste",duplicate:"Duplicate",copyStyle:"Copy style",pasteStyle:"Paste style",order:"Order",bringToFront:"Bring to front",sendBackward:"Send backward",sendToBack:"Send to back",alignTop:"Align top",alignMiddle:"Align middle",alignBottom:"Align bottom",distributeAcross:"Distribute horizontally",distributeDown:"Distribute vertically",distribute:"Distribute",group:"Group",ungroup:"Ungroup",lock:"Lock",unlock:"Unlock",locked:"Locked",comment:"Comment",grid:"Grid",crop:"Crop",cropLeft:"Left",cropTop:"Top",cropRight:"Right",cropBottom:"Bottom",opacity:"Opacity",replaceImage:"Replace image",videoAddress:"Video address",videoHint:"A YouTube or Vimeo link, or a video file.",chooseVideo:"Choose from Media Library",videoUnsupported:"This video can’t be played here. Open it from its link.",route:"Route",routeStraight:"Straight",routeElbow:"Elbow",routeCurved:"Curved",arrowStart:"Arrow at start",arrowEnd:"Arrow at end",lineWidth:"Line width",fill:"Fill",noFill:"No fill",outline:"Outline",chartBar:"Column",chartHbar:"Bar",chartArea:"Area",chartPie:"Pie",chartDonut:"Donut",legend:"Legend",legendBottom:"Bottom",legendRight:"Right",legendNone:"None",addSeries:"Series",addCategory:"Row",seriesName:"Series name",borders:"Borders",borderColour:"Border colour",borderWidth:"Border width",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",insertColumnLeft:"Insert column left",insertColumnRight:"Insert column right",deleteRow:"Delete row",deleteColumn:"Delete column",mergeCells:"Merge cells",unmergeCells:"Unmerge cells",cellEditHint:"Double-click a cell to type in it. Shift-click to choose several.",colours:"Colours",headingFont:"Headings",bodyFont:"Body",slideNumbers:"Slide numbers",skipSlide:"Skip slide",unskipSlide:"Don’t skip slide",skipped:"Skipped in the show",transition:"Transition",transitionNone:"None",transitionFade:"Fade",transitionSlide:"Slide from right",transitionPush:"Push",transitionZoom:"Zoom",transitionFlip:"Flip",duration:"Duration",applyToAll:"Apply to all slides",play:"Play",animations:"Object animations",addAnimation:"Add animation",removeAnimation:"Remove animation",selectToAnimate:"Select an object on the slide to animate it.",noAnimations:"No animations on this slide.",effectAppear:"Appear",effectFadeIn:"Fade in",effectFlyIn:"Fly in",effectZoomIn:"Zoom in",effectFadeOut:"Fade out",startClick:"On click",startWithPrevious:"With previous",startAfterPrevious:"After previous",fromLeft:"From left",fromRight:"From right",fromTop:"From top",fromBottom:"From bottom",byParagraph:"By paragraph",moveEarlier:"Earlier",moveLater:"Later",commentPlaceholder:"Comment or add others with @",replyPlaceholder:"Reply",post:"Comment",reply:"Reply",resolve:"Resolve",reopen:"Reopen",showResolved:"Show resolved",noComments:"No comments yet. Select something and choose Comment.",editComment:"Edit",deleteComment:"Delete",save:"Save",cancel:"Cancel",commentFailed:"Could not save this comment.",onSlide:"On the slide",objectGone:"The object it was on is gone.",resolvedBy:"Resolved",nameVersion:"Name this version",versionName:"Version name",restore:"Restore",previewVersion:"Preview",noVersions:"No earlier versions yet.",restoreFailed:"Could not restore this version.",closePreview:"Back to the deck",versionsFailed:"Could not load the history.",startFrom:"Start from",exportPptx:"PowerPoint (.pptx)",exportPdf:"PDF",exporting:"Exporting…",merged:"Somebody else changed this deck too. Their changes are in.",editingNow:e=>`${e} also here`,commentCount:e=>`${e} comments`,restoreConfirm:e=>`Restore the deck as it was on ${e}? You can undo this.`,shapeName:e=>o[e],starterName:e=>i[e],themeName:e=>({simple:"Simple",midnight:"Midnight",editorial:"Editorial"}[e]??e),presenterStep:(e,t)=>`Click ${e} of ${t}`,dealerPitch:[["Wheel and Tyre Haus","Dealer programme 2026"],["Why stock us","Fast restock from three warehouses"],["The range","Wheels, tyres and fitting kits"],["Margins and support","Tiered pricing and co-op marketing"],["Next steps","Book a range review"]],monthlyReport:[["Monthly report","October 2026"],["Highlights","What went well this month"],["Numbers","Sales, margin and stock"],["Risks","What needs attention"],["Next month","Priorities and owners"]]},l={decks:"演示文稿",newDeck:"新建演示文稿",untitledDeck:"未命名演示文稿",emptyTitle:"制作第一份演示文稿",emptyBody:"在这里制作幻灯片,然后放映或导出为 PowerPoint。",openFailed:"无法打开此演示文稿",createFailed:"无法创建演示文稿。",deleteFailed:"无法删除此演示文稿。",backToDecks:"返回演示文稿列表",deleteConfirm:e=>`要删除“${e}”吗?此操作无法撤销。`,delete:"删除",deckName:"演示文稿名称",slidesPanel:"幻灯片",slideNumber:e=>`第 ${e} 张幻灯片`,slideOf:(e,t)=>`第 ${e} 张,共 ${t} 张`,addSlide:"添加幻灯片",duplicateSlide:"复制幻灯片",deleteSlide:"删除幻灯片",slideText:"幻灯片文字",undo:"撤销",redo:"重做",export:"导出",exportFailed:"无法导出此演示文稿。",present:"放映",endShow:"结束放映",popupBlocked:"浏览器阻止了观众窗口。请允许此网站的弹出窗口,然后结束放映并重新放映。",back:"上一张",next:"下一张",nextSlide:"下一张幻灯片",endOfDeck:"演示文稿已结束。",notes:"备注",noNotes:"此幻灯片没有备注。",speakerNotes:"演讲者备注",saveFailed:"无法保存此演示文稿,正在重试。",renameFailed:"无法重命名此演示文稿。",conflict:"其他人修改了此演示文稿,您最近的编辑未保存。请重新加载以查看对方的版本。",reload:"重新加载",addText:"添加文字",addShape:"添加形状",addImage:"添加图片",addChart:"添加图表",addTable:"添加表格",elementText:"文字",elementShape:"形状",elementImage:"图片",elementChart:"图表",elementTable:"表格",slide:"幻灯片",objects:e=>`${e} 个对象`,background:"背景",positionAndSize:"位置和大小",width:"宽",height:"高",angle:"角度",align:"对齐",alignLeft:"左对齐",alignCentre:"居中对齐",alignRight:"右对齐",bringForward:"上移一层",size:"字号",weight:"字重",regular:"常规",bold:"粗体",textAlignment:"文字对齐",left:"左",centre:"中",right:"右",colour:"颜色",rectangle:"矩形",ellipse:"椭圆",roundedRectangle:"圆角矩形",diamond:"菱形",lineShape:"线条",outlineColour:"轮廓颜色",imageAddress:"图片地址",chooseImage:"选择图片",imageTitle:"幻灯片图片",description:"描述",data:"数据",chartType:"图表类型",bar:"柱形图",line:"折线图",values:"数值",valuesHint:"每行一个标签和数字,例如 九月, 42。",rows:"行",rowsHint:"每行一行数据,单元格之间用逗号分隔。",headingColour:"标题颜色",pptxPasswordProtected:"此文件设有密码。请先在 PowerPoint 中移除密码,再重新导入。",pptxUnreadable:"无法将此文件读取为 PowerPoint (.pptx) 文件。",pptxLegacyFormat:"这是旧版 Office 文件。请先在 PowerPoint 中另存为 .pptx,再重新导入。",pptxTooManySlides:(e,t)=>`此演示文稿有 ${e} 张幻灯片,最多只能有 ${t} 张。`,pptxTooLarge:(e,t)=>`此演示文稿不计图片已达 ${e} MiB,上限为 ${t} MiB。请拆分成较小的演示文稿。`,pdfSlideFailed:e=>`第 ${e} 张幻灯片无法绘制到 PDF。`,files:t,fileKind:"PowerPoint",importNotes:({skipped:e,animations:t,fonts:o})=>{const n=[e&&`${e} 个图表、视频或自定义形状未能导入`,t&&`${t} 张幻灯片的动画已移除`,o.length&&`${o.join("、")} 以演示文稿字体显示`].filter(Boolean);return n.length?`部分内容未能导入:${n.join(";")}。`:null},dismiss:"关闭",newSlide:"新建幻灯片",layouts:"版式",layoutTitle:"标题",layoutTitleBody:"标题和正文",layoutSection:"节标题",layoutTwoColumns:"两栏",layoutTitleOnly:"仅标题",layoutBlank:"空白",placeholderTitle:"单击添加标题",placeholderSubtitle:"单击添加副标题",placeholderBody:"单击添加文本",addVideo:"添加视频",addLine:"添加线条或连接线",elementVideo:"视频",elementConnector:"连接线",lineStraight:"直线",lineArrow:"箭头",lineDoubleArrow:"双向箭头",connectorElbow:"肘形连接线",connectorCurved:"曲线连接线",arrange:"排列",theme:"主题",motion:"动画",comments:"评论",versionHistory:"版本历史记录",font:"字体",fontSize:"字号",smaller:"减小字号",larger:"增大字号",italic:"斜体",underline:"下划线",strikethrough:"删除线",textColour:"文字颜色",highlight:"突出显示",link:"链接",linkPrompt:"链接到网址、电子邮件地址或幻灯片编号",removeLink:"移除链接",badLink:"该链接不是网址、电子邮件地址或幻灯片编号。",alignJustify:"两端对齐",bulletList:"项目符号列表",numberedList:"编号列表",indentLess:"减少缩进",indentMore:"增加缩进",lineSpacing:"行距",verticalAlign:"垂直对齐",top:"顶端",middle:"居中",bottom:"底端",shrinkToFit:"缩小文字以适应",cut:"剪切",copy:"复制",paste:"粘贴",duplicate:"创建副本",copyStyle:"复制格式",pasteStyle:"粘贴格式",order:"顺序",bringToFront:"置于顶层",sendBackward:"下移一层",sendToBack:"置于底层",alignTop:"顶端对齐",alignMiddle:"垂直居中",alignBottom:"底端对齐",distributeAcross:"横向分布",distributeDown:"纵向分布",distribute:"分布",group:"组合",ungroup:"取消组合",lock:"锁定",unlock:"解锁",locked:"已锁定",comment:"评论",grid:"网格",crop:"裁剪",cropLeft:"左",cropTop:"上",cropRight:"右",cropBottom:"下",opacity:"不透明度",replaceImage:"替换图片",videoAddress:"视频地址",videoHint:"YouTube 或 Vimeo 链接,或视频文件。",chooseVideo:"从媒体库选择",videoUnsupported:"此视频无法在此播放。请通过其链接打开。",route:"路线",routeStraight:"直线",routeElbow:"肘形",routeCurved:"曲线",arrowStart:"起点箭头",arrowEnd:"终点箭头",lineWidth:"线条粗细",fill:"填充",noFill:"无填充",outline:"轮廓",chartBar:"柱形图",chartHbar:"条形图",chartArea:"面积图",chartPie:"饼图",chartDonut:"圆环图",legend:"图例",legendBottom:"底部",legendRight:"右侧",legendNone:"无",addSeries:"系列",addCategory:"行",seriesName:"系列名称",borders:"边框",borderColour:"边框颜色",borderWidth:"边框粗细",insertRowAbove:"在上方插入行",insertRowBelow:"在下方插入行",insertColumnLeft:"在左侧插入列",insertColumnRight:"在右侧插入列",deleteRow:"删除行",deleteColumn:"删除列",mergeCells:"合并单元格",unmergeCells:"取消合并单元格",cellEditHint:"双击单元格即可输入。按住 Shift 单击可选择多个。",colours:"颜色",headingFont:"标题",bodyFont:"正文",slideNumbers:"幻灯片编号",skipSlide:"跳过幻灯片",unskipSlide:"不跳过幻灯片",skipped:"放映时跳过",transition:"切换效果",transitionNone:"无",transitionFade:"淡出",transitionSlide:"从右侧滑入",transitionPush:"推入",transitionZoom:"缩放",transitionFlip:"翻转",duration:"持续时间",applyToAll:"应用于所有幻灯片",play:"播放",animations:"对象动画",addAnimation:"添加动画",removeAnimation:"删除动画",selectToAnimate:"选择幻灯片上的对象以添加动画。",noAnimations:"此幻灯片没有动画。",effectAppear:"出现",effectFadeIn:"淡入",effectFlyIn:"飞入",effectZoomIn:"放大",effectFadeOut:"淡出",startClick:"单击时",startWithPrevious:"与上一动画同时",startAfterPrevious:"上一动画之后",fromLeft:"自左侧",fromRight:"自右侧",fromTop:"自顶部",fromBottom:"自底部",byParagraph:"按段落",moveEarlier:"提前",moveLater:"延后",commentPlaceholder:"发表评论,或使用 @ 添加其他人",replyPlaceholder:"回复",post:"评论",reply:"回复",resolve:"解决",reopen:"重新打开",showResolved:"显示已解决",noComments:"还没有评论。选择内容后选择“评论”。",editComment:"编辑",deleteComment:"删除",save:"保存",cancel:"取消",commentFailed:"无法保存此评论。",onSlide:"在幻灯片上",objectGone:"所评论的对象已被删除。",resolvedBy:"已解决",nameVersion:"命名此版本",versionName:"版本名称",restore:"恢复",previewVersion:"预览",noVersions:"还没有较早的版本。",restoreFailed:"无法恢复此版本。",closePreview:"返回演示文稿",versionsFailed:"无法加载历史记录。",startFrom:"开始于",exportPptx:"PowerPoint (.pptx)",exportPdf:"PDF",exporting:"正在导出…",merged:"其他人也修改了此演示文稿,其更改已合并。",editingNow:e=>`${e} 也在此处`,commentCount:e=>`${e} 条评论`,restoreConfirm:e=>`将演示文稿恢复为 ${e} 时的版本?此操作可以撤销。`,shapeName:e=>n[e],starterName:e=>r[e],themeName:e=>({simple:"简约",midnight:"午夜",editorial:"杂志"}[e]??e),presenterStep:(e,t)=>`第 ${e} 次单击,共 ${t} 次`,dealerPitch:[["Wheel and Tyre Haus","2026 年经销商计划"],["为何选择我们","三个仓库快速补货"],["产品系列","轮毂、轮胎和安装套件"],["利润与支持","阶梯定价和联合营销"],["后续步骤","预约产品系列评审"]],monthlyReport:[["月度报告","2026 年 10 月"],["亮点","本月进展顺利的方面"],["数据","销售、利润和库存"],["风险","需要关注的事项"],["下月","重点工作和负责人"]]},s=1920,d=1080,c="Inter",p=["Inter","Roboto","Montserrat","Lora","Playfair Display","JetBrains Mono"],m="transparent",h=20,u=["rect","roundRect","ellipse","triangle","rightTriangle","diamond","pentagon","hexagon","octagon","star","heart","cloud","bolt","parallelogram","trapezoid","cylinder","plus","arrowRight","arrowLeft","arrowUp","arrowDown","arrowLeftRight","chevron","callout","calloutRound","line"],g=()=>crypto.randomUUID();function f(){return{id:g(),background:"#ffffff",notes:"",elements:[]}}function w(e){const t=e,o=t?.slides;return Array.isArray(o)&&o.length>0?{...t,slides:o}:{slides:[f()]}}var y={text:"#2c2c2a",accents:["#534ab7","#1d9e75","#d85a30"],shapeFill:"#afa9ec"};function b(e,t=y){const o=(e,t)=>({id:g(),x:(s-e)/2,y:(d-t)/2,w:e,h:t,rotation:0}),n=t.accents[0]??y.accents[0];switch(e){case"text":return{...o(800,160),type:e,text:"Text",fontSize:64,bold:!1,color:t.text,align:"left",...t.bodyFont&&t.bodyFont!==c?{font:t.bodyFont}:{}};case"shape":return{...o(400,400),type:e,shape:"rect",fill:t.shapeFill};case"image":return{...o(800,450),type:e,src:"",alt:""};case"video":return{...o(960,540),type:e,src:"",alt:""};case"connector":{const n={x:760,y:540},i={x:1160,y:540};return{...o(400,24),y:528,type:e,start:n,end:i,route:"straight",stroke:t.text,strokeWidth:4,arrowEnd:!0}}case"chart":return{...o(900,600),type:e,kind:"bar",color:n,points:[{label:"A",value:40},{label:"B",value:65},{label:"C",value:90}]};case"table":return{...o(1e3,400),type:e,headerFill:"#eeedfe",rows:[["Heading","Heading"],["Cell","Cell"]]}}}function k(e,t,o){return{...e,slides:e.slides.map(e=>e.id===t?o(e):e)}}function x(e,t,o){const n=e.slides.findIndex(e=>e.id===t),i=[...e.slides];return i.splice(-1===n?i.length:n+1,0,o),{...e,slides:i}}function S(e){return{...e,id:g(),elements:e.elements.map(e=>({...e,id:g()}))}}function v(e,t){const o=e.slides.filter(e=>e.id!==t);return{...e,slides:o.length>0?o:[f()]}}function C(e,t,o){const n=e.slides.findIndex(e=>e.id===t);if(-1===n)return e;const i=[...e.slides],[r]=i.splice(n,1);return i.splice(Math.max(0,Math.min(o,i.length)),0,r),{...e,slides:i}}function T(e,t,o){return{...e,elements:e.elements.map(e=>t.has(e.id)?o(e):e)}}function P(e,t){return{...e,elements:e.elements.filter(e=>!t.has(e.id))}}function F(e,t,o){const n={...e,x:e.x+t,y:e.y+o};if("connector"!==n.type)return n;const i=e=>({...e,x:e.x+t,y:e.y+o});return{...n,start:i(n.start),end:i(n.end)}}function R(e,t){const o=[...e.elements];for(let e=o.length-2;e>=0;e-=1)t.has(o[e].id)&&!t.has(o[e+1].id)&&([o[e],o[e+1]]=[o[e+1],o[e]]);return{...e,elements:o}}function A(e){const t=Math.min(...e.map(e=>e.x)),o=Math.min(...e.map(e=>e.y));return{x:t,y:o,w:Math.max(...e.map(e=>e.x+e.w))-t,h:Math.max(...e.map(e=>e.y+e.h))-o}}function B(e,t){const o=[{x:0,y:0,w:s,h:d},...t],n=(e,t,o)=>{let n=null;for(const i of[e,e+t/2,e+t])for(const e of o){const t=e-i;Math.abs(t)<=8&&(!n||Math.abs(t)<Math.abs(n.shift))&&(n={shift:t,at:e})}return n},i=n(e.x,e.w,o.flatMap(e=>[e.x,e.x+e.w/2,e.x+e.w])),r=n(e.y,e.h,o.flatMap(e=>[e.y,e.y+e.h/2,e.y+e.h]));return{box:{...e,x:e.x+(i?.shift??0),y:e.y+(r?.shift??0)},guides:{x:i?[i.at]:[],y:r?[r.at]:[]}}}var L=["nw","n","ne","e","se","s","sw","w"];function D(e,t,o,n,i=!1){let{x:r,y:a,w:l,h:s}=e;if(t.includes("e")&&(l=Math.max(20,e.w+o)),t.includes("s")&&(s=Math.max(20,e.h+n)),t.includes("w")&&(l=Math.max(20,e.w-o),r=e.x+e.w-l),t.includes("n")&&(s=Math.max(20,e.h-n),a=e.y+e.h-s),i&&2===t.length){const o=Math.max(l/e.w,s/e.h);l=e.w*o,s=e.h*o,t.includes("w")&&(r=e.x+e.w-l),t.includes("n")&&(a=e.y+e.h-s)}return{x:r,y:a,w:l,h:s}}function N(e,t,o,n=!1){const i=180*Math.atan2(o-(e.y+e.h/2),t-(e.x+e.w/2))/Math.PI+90;return((n?15*Math.round(i/15):Math.round(i))%360+360)%360}function M(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h}function $(e,t){switch(t.type){case"commit":return t.doc===e.present?e:{past:[...e.past,e.present].slice(-200),present:t.doc,future:[]};case"live":return{...e,present:t.doc};case"settle":return t.from===e.present?e:{past:[...e.past,t.from].slice(-200),present:e.present,future:[]};case"undo":{const t=e.past[e.past.length-1];return t?{past:e.past.slice(0,-1),present:t,future:[e.present,...e.future]}:e}case"redo":{const[t,...o]=e.future;return t?{past:[...e.past,e.present],present:t,future:o}:e}case"rebase":return{past:e.past.map(t.rebase),present:t.rebase(e.present),future:e.future.map(t.rebase)}}}export{a as ENGLISH_WORDS,l as ZH_HANS_WORDS,s as SLIDE_W,d as SLIDE_H,c as DECK_FONT,p as DECK_FONTS,m as NO_FILL,h as MIN_SIZE,u as SHAPE_KINDS,g as newId,f as newSlide,w as asDocument,b as newElement,k as updateSlide,x as insertSlideAfter,S as copySlide,v as removeSlide,C as moveSlide,T as updateElements,P as removeElements,F as shiftElement,R as bringForward,A as boundsOf,B as snapBox,L as HANDLES,D as resizeBox,N as angleTo,M as boxesTouch,$ as historyReducer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{paragraphsOf as t,withParagraphs as e}from"./chunk-B2X3NIQR.js";import{DECK_FONT as o,DECK_FONTS as n,SLIDE_H as r,SLIDE_W as i,newId as a,newSlide as l}from"./chunk-PXOQN7D6.js";var s=[{id:"simple",name:"Simple",background:"#ffffff",text:"#2c2c2a",heading:"#26215c",accents:["#534ab7","#1d9e75","#d85a30","#ef9f27","#378add","#d4537e"],headingFont:o,bodyFont:o},{id:"midnight",name:"Midnight",background:"#26215c",text:"#eeedfe",heading:"#ffffff",accents:["#afa9ec","#5dcaa5","#f0997b","#fac775","#85b7eb","#ed93b1"],headingFont:"Montserrat",bodyFont:o},{id:"editorial",name:"Editorial",background:"#f1efe8",text:"#444441",heading:"#2c2c2a",accents:["#993c1d","#5f5e5a","#0f6e56","#854f0b","#185fa5","#993556"],headingFont:"Playfair Display",bodyFont:"Lora"}],c=s[0],d=t=>t.theme??c,f={title:96,subtitle:48,body:44};function u(t,e,o,n){return{id:a(),type:"text",...e,rotation:0,text:o,fontSize:f[t],bold:"title"===t,color:"title"===t?n.heading:n.text,font:"title"===t?n.headingFont:n.bodyFont,align:"left",anchor:"body"===t?"top":"bottom",placeholder:t,..."body"===t?{paragraphs:[{list:"bullet",runs:[{text:o}]}]}:{}}}var h=120,b={x:h,y:80,w:i-240,h:180},m={x:h,y:300,w:i-240,h:r-300-100},p=["title","titleBody","section","twoColumns","titleOnly","blank"];function y(t,e,o){const n={...l(),background:e.background,layout:t},r=(m.w-80)/2;return{...n,elements:(()=>{switch(t){case"title":return[{...u("title",{x:h,y:340,w:i-240,h:220},o.title,e),align:"center"},{...u("subtitle",{x:h,y:580,w:i-240,h:120},o.subtitle,e),align:"center",anchor:"top"}];case"titleBody":return[u("title",b,o.title,e),u("body",m,o.body,e)];case"section":return[u("title",{x:h,y:520,w:i-240,h:200},o.title,e)];case"twoColumns":return[u("title",b,o.title,e),u("body",{...m,w:r},o.body,e),u("body",{...m,x:m.x+r+80,w:r},o.body,e)];case"titleOnly":return[u("title",b,o.title,e)];case"blank":return[]}})()}}function g(n,r){const i=d(n),a=(t,e)=>!!t&&t.toLowerCase()===e.toLowerCase(),l=t=>{const e=i.accents.findIndex(e=>a(t,e));return-1===e?t:r.accents[e]??t},s=n=>{switch(n.type){case"text":{const l="title"===n.placeholder||!n.placeholder&&a(n.color,i.heading),s=t=>a(t,i.heading)?r.heading:a(t,i.text)?r.text:t,c=l?i.headingFont:i.bodyFont,d=l?r.headingFont:r.bodyFont,f=n.placeholder||(n.font??o)===c?d===o?void 0:d:n.font,u=t(n).map(t=>({...t,runs:t.runs.map(t=>({...t,color:s(t.color),font:t.font===c?void 0:t.font}))}));return e({...n,color:s(n.color)??n.color,font:f},u)}case"shape":return{...n,fill:l(n.fill),stroke:n.stroke&&(a(n.stroke,i.text)?r.text:l(n.stroke))};case"connector":return{...n,stroke:a(n.stroke,i.text)?r.text:l(n.stroke)};case"chart":return{...n,color:l(n.color),series:n.series?.map(t=>({...t,color:l(t.color)}))};default:return n}};return{...n,theme:r,slides:n.slides.map(t=>({...t,background:a(t.background,i.background)?r.background:t.background,elements:t.elements.map(s)}))}}var x=["blank","simple","midnight","editorial","dealerPitch","monthlyReport"];function k(o,n){if("blank"===o)return{slides:[l()]};const r=s.find(t=>t.id===o)??("dealerPitch"===o?s[1]:c);if("simple"===o||"midnight"===o||"editorial"===o)return{theme:r,slides:[y("title",r,n)]};const i="dealerPitch"===o?n.dealerPitch:n.monthlyReport,a=i.map(([o,a],l)=>((o,n,r)=>({...o,elements:o.elements.map(o=>{if("text"!==o.type)return o;const i="title"===o.placeholder?n:r;return e(o,t(o).slice(0,1).map(t=>({...t,runs:[{...t.runs[0],text:i}]})))})}))(y(0===l?"title":l===i.length-1?"section":"titleBody",r,n),o,a));return{theme:r,slideNumbers:!0,slides:a}}function w(t){const e=d(t),o=new Set([e.headingFont,e.bodyFont]);for(const e of t.slides)for(const t of e.elements)if("text"===t.type){t.font&&o.add(t.font);for(const e of t.paragraphs??[])for(const t of e.runs)t.font&&o.add(t.font)}return[...o].filter(t=>n.includes(t))}var F="data-slides-fonts";function v(t,e){const n=function(t){return`https://fonts.googleapis.com/css2?${[...t].sort().map(t=>`family=${t.replace(/ /g,"+")}:ital,wght@0,400;0,700;1,400;1,700`).join("&")}&display=swap`}([...new Set([o,...e])]),r=t.head.querySelector(`link[${F}]`);if(r?.href===n)return;const i=t.createElement("link");i.rel="stylesheet",i.crossOrigin="anonymous",i.href=n,i.setAttribute(F,""),t.head.appendChild(i),r?.remove()}export{s as THEMES,d as themeOf,p as LAYOUTS,y as slideFromLayout,g as applyTheme,x as STARTERS,k as starterDeck,w as fontsOf,v as ensureFonts};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n,e){const t=n.lastIndexOf(".");return t>0&&e.includes(n.slice(t+1).toLowerCase())}function e(n){const e=n.lastIndexOf(".");return(e>0?n.slice(0,e):n).trim()||n}async function t(n,e){return!!n?.place&&n.place(e).then(()=>!0,()=>!1)}export{n as hasExtension,e as titleOf,t as placeCopy};
|